diff --git a/crates/swc/tests/fixture/issues-4xxx/issue-4249/1/output/index.js b/crates/swc/tests/fixture/issues-4xxx/issue-4249/1/output/index.js index 50406c0e823..308583da53f 100644 --- a/crates/swc/tests/fixture/issues-4xxx/issue-4249/1/output/index.js +++ b/crates/swc/tests/fixture/issues-4xxx/issue-4249/1/output/index.js @@ -1,5 +1,5 @@ foo({ bar: function(data, baz) { - !(!(baz ? data.quxA : data.quxB) && !(baz ? data.corgeA : data.corgeB) && (baz ? data.get("waldo") : data.waldo)) ? (baz ? data.quxA : data.quxB) || (baz ? data.get("waldo") : data.waldo) || (baz ? !data.corgeA : !data.corgeB) || pass() : pass(); + !(!(baz ? data.quxA : data.quxB) && !(baz ? data.corgeA : data.corgeB) && (baz ? data.get("waldo") : data.waldo)) && ((baz ? data.quxA : data.quxB) || (baz ? data.get("waldo") : data.waldo) || (baz ? !data.corgeA : !data.corgeB)) || pass(); } }); diff --git a/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands_es2015.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands_es2015.2.minified.js index b927e67abc8..f2f6d5c66d1 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands_es2015.2.minified.js @@ -7,4 +7,4 @@ class C { }(E || (E = {})), function(M1) { var a; M1.a = a; -}(M || (M = {})), E.a + new C(), E.a + C.foo(), E.a; +}(M || (M = {})), E.a, new C(), E.a, C.foo(), E.a; diff --git a/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands_es5.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands_es5.2.minified.js index 5f9d7113e3b..710f1a134e1 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands_es5.2.minified.js @@ -11,4 +11,4 @@ var E, M, C = function() { }(E || (E = {})), function(M1) { var a; M1.a = a; -}(M || (M = {})), E.a + new C(), E.a + C.foo(), E.a; +}(M || (M = {})), E.a, new C(), E.a, C.foo(), E.a; diff --git a/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum_es2015.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum_es2015.2.minified.js index 4b6c744665f..6cbcb291c42 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum_es2015.2.minified.js @@ -3,4 +3,4 @@ var E, F; E[E.a = 0] = "a", E[E.b = 1] = "b"; }(E || (E = {})), function(F) { F[F.c = 0] = "c", F[F.d = 1] = "d"; -}(F || (F = {})), E.a, E.a + E.b, E.a + E.b, E.a + F.c; +}(F || (F = {})), E.a, E.a, E.b, E.a, E.b, E.a, F.c; diff --git a/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum_es5.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum_es5.2.minified.js index 4b6c744665f..6cbcb291c42 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum_es5.2.minified.js @@ -3,4 +3,4 @@ var E, F; E[E.a = 0] = "a", E[E.b = 1] = "b"; }(E || (E = {})), function(F) { F[F.c = 0] = "c", F[F.d = 1] = "d"; -}(F || (F = {})), E.a, E.a + E.b, E.a + E.b, E.a + F.c; +}(F || (F = {})), E.a, E.a, E.b, E.a, E.b, E.a, F.c; diff --git a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion_es2015.2.minified.js b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion_es2015.2.minified.js index ffecb44370a..6aed2c1379e 100644 --- a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion_es2015.2.minified.js @@ -3,4 +3,4 @@ var E, F; E[E.a = 0] = "a", E[E.b = 1] = "b"; }(E || (E = {})), function(F) { F[F.c = 0] = "c", F[F.d = 1] = "d"; -}(F || (F = {})), E.a, E.a, E.a * E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a / E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a % E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a - E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a << E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a >> E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a >>> E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a & E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a ^ E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a | E.b, E.a, E.b, E.b, E.b; +}(F || (F = {})), E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b; diff --git a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion_es5.2.minified.js b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion_es5.2.minified.js index ffecb44370a..6aed2c1379e 100644 --- a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion_es5.2.minified.js @@ -3,4 +3,4 @@ var E, F; E[E.a = 0] = "a", E[E.b = 1] = "b"; }(E || (E = {})), function(F) { F[F.c = 0] = "c", F[F.d = 1] = "d"; -}(F || (F = {})), E.a, E.a, E.a * E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a / E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a % E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a - E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a << E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a >> E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a >>> E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a & E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a ^ E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a | E.b, E.a, E.b, E.b, E.b; +}(F || (F = {})), E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b; diff --git a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum_es2015.2.minified.js b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum_es2015.2.minified.js index 217a4457595..6b17e61f889 100644 --- a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum_es2015.2.minified.js @@ -1,4 +1,4 @@ var E; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; -}(E || (E = {})), E.a, E.a, E.a * E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a / E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a % E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a - E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a << E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a >> E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a >>> E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a & E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a ^ E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a | E.b, E.a, E.b, E.b, E.b; +}(E || (E = {})), E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b; diff --git a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum_es5.2.minified.js b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum_es5.2.minified.js index 217a4457595..6b17e61f889 100644 --- a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum_es5.2.minified.js @@ -1,4 +1,4 @@ var E; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; -}(E || (E = {})), E.a, E.a, E.a * E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a / E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a % E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a - E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a << E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a >> E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a >>> E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a & E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a ^ E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a | E.b, E.a, E.b, E.b, E.b; +}(E || (E = {})), E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b, E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b; diff --git a/crates/swc/tests/tsc-references/assignmentToVoidZero2_es2015.2.minified.js b/crates/swc/tests/tsc-references/assignmentToVoidZero2_es2015.2.minified.js index b71cce76f2d..0a850e50d01 100644 --- a/crates/swc/tests/tsc-references/assignmentToVoidZero2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentToVoidZero2_es2015.2.minified.js @@ -1,8 +1,8 @@ import { j, k } from './assignmentToVoidZero2'; exports.j = 1, exports.k = void 0; var o = {}; -o.x = 1, o.y = void 0, o.x + o.y; +o.x = 1, o.y = void 0, o.x, o.y; var c = new function() { this.p = 1, this.q = void 0; }(); -c.p + c.q; +c.p, c.q; diff --git a/crates/swc/tests/tsc-references/assignmentToVoidZero2_es5.2.minified.js b/crates/swc/tests/tsc-references/assignmentToVoidZero2_es5.2.minified.js index 925092e60f6..4c08482b246 100644 --- a/crates/swc/tests/tsc-references/assignmentToVoidZero2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentToVoidZero2_es5.2.minified.js @@ -1,8 +1,8 @@ import { j, k } from "./assignmentToVoidZero2"; exports.j = 1, exports.k = void 0; var o = {}; -o.x = 1, o.y = void 0, o.x + o.y; +o.x = 1, o.y = void 0, o.x, o.y; var c = new function() { this.p = 1, this.q = void 0; }(); -c.p + c.q; +c.p, c.q; diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType_es2015.2.minified.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType_es2015.2.minified.js index 10d4b79d71e..07278ae37be 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType_es2015.2.minified.js @@ -1,4 +1,4 @@ var ENUM1; !function(ENUM1) { ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM1.A + ENUM1.B, ENUM1.A + ENUM1.B, ENUM1.A, ENUM1.A, ENUM1.B; +}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM1.A, ENUM1.B, ENUM1.A, ENUM1.B, ENUM1.A, ENUM1.A, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType_es5.2.minified.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType_es5.2.minified.js index 10d4b79d71e..07278ae37be 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType_es5.2.minified.js @@ -1,4 +1,4 @@ var ENUM1; !function(ENUM1) { ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM1.A + ENUM1.B, ENUM1.A + ENUM1.B, ENUM1.A, ENUM1.A, ENUM1.B; +}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM1.A, ENUM1.B, ENUM1.A, ENUM1.B, ENUM1.A, ENUM1.A, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es2015.2.minified.js b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es2015.2.minified.js index df0653543ce..47c06fa6e67 100644 --- a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es2015.2.minified.js @@ -5,11 +5,7 @@ function foo3() { function m1() { return 1; } -foo3(), function(x) { - try {} catch (e) { - return []; - } finally{} -}(1), function(M1) { +foo3(), function(M1) { M1.x = 1, M1.C = class { }; }(M || (M = {})), (m1 || (m1 = {})).y = 2; diff --git a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es5.2.minified.js b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es5.2.minified.js index fabed6f4944..3a191967edf 100644 --- a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference_es5.2.minified.js @@ -3,10 +3,6 @@ function foo3() { return foo3(); } foo3(), function(x) { - try {} catch (e) { - return []; - } finally{} -}(1), function(x) { void 0 === x || swcHelpers.typeOf(x); }(1); var M, e1, C = function() { diff --git a/crates/swc/tests/tsc-references/classExtendsValidConstructorFunction_es2015.2.minified.js b/crates/swc/tests/tsc-references/classExtendsValidConstructorFunction_es2015.2.minified.js index f27fd275539..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/classExtendsValidConstructorFunction_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/classExtendsValidConstructorFunction_es2015.2.minified.js @@ -1 +0,0 @@ -new function() {}(); diff --git a/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandObjectType_es2015.2.minified.js b/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandObjectType_es2015.2.minified.js index 4fc910b584d..e5325822a86 100644 --- a/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandObjectType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandObjectType_es2015.2.minified.js @@ -1,4 +1,4 @@ var STRING; class CLASS { } -new Date(), STRING.toLowerCase(), new CLASS(), new Date(), STRING.toLowerCase(), new CLASS(); +STRING.toLowerCase(), new CLASS(), STRING.toLowerCase(), new CLASS(); diff --git a/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandObjectType_es5.2.minified.js b/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandObjectType_es5.2.minified.js index 8815be0106d..c84d00bbc6b 100644 --- a/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandObjectType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandObjectType_es5.2.minified.js @@ -3,4 +3,4 @@ var STRING, CLASS = function() { "use strict"; swcHelpers.classCallCheck(this, CLASS); }; -new Date(), STRING.toLowerCase(), new CLASS(), new Date(), STRING.toLowerCase(), new CLASS(); +STRING.toLowerCase(), new CLASS(), STRING.toLowerCase(), new CLASS(); diff --git a/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandStringType_es2015.2.minified.js b/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandStringType_es2015.2.minified.js index 0d9f76e35a2..795b3a522c8 100644 --- a/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandStringType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandStringType_es2015.2.minified.js @@ -1,2 +1,2 @@ var NUMBER; -new Date(), NUMBER.toString(), new Object, new Date(), NUMBER.toString(), new Object; +NUMBER.toString(), new Object, NUMBER.toString(), new Object; diff --git a/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandStringType_es5.2.minified.js b/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandStringType_es5.2.minified.js index 0d9f76e35a2..795b3a522c8 100644 --- a/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandStringType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commaOperatorWithSecondOperandStringType_es5.2.minified.js @@ -1,2 +1,2 @@ var NUMBER; -new Date(), NUMBER.toString(), new Object, new Date(), NUMBER.toString(), new Object; +NUMBER.toString(), new Object, NUMBER.toString(), new Object; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames10_ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames10_ES5_es2015.2.minified.js index 3ead0a6dff0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames10_ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames10_ES5_es2015.2.minified.js @@ -1 +0,0 @@ -"hello undefined bye"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames10_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames10_ES6_es2015.2.minified.js index 3ead0a6dff0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames10_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames10_ES6_es2015.2.minified.js @@ -1 +0,0 @@ -"hello undefined bye"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames11_ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames11_ES5_es2015.2.minified.js index 3ead0a6dff0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames11_ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames11_ES5_es2015.2.minified.js @@ -1 +0,0 @@ -"hello undefined bye"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames11_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames11_ES6_es2015.2.minified.js index 3ead0a6dff0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames11_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames11_ES6_es2015.2.minified.js @@ -1 +0,0 @@ -"hello undefined bye"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames13_ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames13_ES5_es2015.2.minified.js index 3ead0a6dff0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames13_ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames13_ES5_es2015.2.minified.js @@ -1 +0,0 @@ -"hello undefined bye"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames13_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames13_ES6_es2015.2.minified.js index 3ead0a6dff0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames13_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames13_ES6_es2015.2.minified.js @@ -1 +0,0 @@ -"hello undefined bye"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames16_ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames16_ES5_es2015.2.minified.js index 3ead0a6dff0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames16_ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames16_ES5_es2015.2.minified.js @@ -1 +0,0 @@ -"hello undefined bye"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames16_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames16_ES6_es2015.2.minified.js index 3ead0a6dff0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames16_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames16_ES6_es2015.2.minified.js @@ -1 +0,0 @@ -"hello undefined bye"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames4_ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames4_ES5_es2015.2.minified.js index 3ead0a6dff0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames4_ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames4_ES5_es2015.2.minified.js @@ -1 +0,0 @@ -"hello undefined bye"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames4_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames4_ES6_es2015.2.minified.js index 3ead0a6dff0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames4_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames4_ES6_es2015.2.minified.js @@ -1 +0,0 @@ -"hello undefined bye"; diff --git a/crates/swc/tests/tsc-references/constructorFunctionsStrict_es2015.2.minified.js b/crates/swc/tests/tsc-references/constructorFunctionsStrict_es2015.2.minified.js index 35d9b446074..748a1877509 100644 --- a/crates/swc/tests/tsc-references/constructorFunctionsStrict_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/constructorFunctionsStrict_es2015.2.minified.js @@ -11,4 +11,4 @@ function A(x) { } c.x = void 0, c.y = void 0; var k = A(1), j = new A(2); -k.x === j.x; +k.x, j.x; diff --git a/crates/swc/tests/tsc-references/constructorFunctionsStrict_es5.2.minified.js b/crates/swc/tests/tsc-references/constructorFunctionsStrict_es5.2.minified.js index 1e6d1353b33..55f155d186f 100644 --- a/crates/swc/tests/tsc-references/constructorFunctionsStrict_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/constructorFunctionsStrict_es5.2.minified.js @@ -12,4 +12,4 @@ function A(x) { } c.x = void 0, c.y = void 0; var k = A(1), j = new A(2); -k.x === j.x; +k.x, j.x; diff --git a/crates/swc/tests/tsc-references/constructorFunctions_es2015.2.minified.js b/crates/swc/tests/tsc-references/constructorFunctions_es2015.2.minified.js index 6127cb091f6..c919e3c6502 100644 --- a/crates/swc/tests/tsc-references/constructorFunctions_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/constructorFunctions_es2015.2.minified.js @@ -14,7 +14,7 @@ C2(), new C2(), C3(), new C3(); var C4 = function() { if (!(this instanceof C4)) return new C4(); }; -C4(), new C4(), new function() {}(), new class { +C4(), new C4(), new class { }(), new function() { this.functions = [ (x)=>x @@ -23,4 +23,4 @@ C4(), new C4(), new function() {}(), new class { , (x)=>x - 1 ]; -}(), new function(num) {}(); +}(); diff --git a/crates/swc/tests/tsc-references/constructorFunctions_es5.2.minified.js b/crates/swc/tests/tsc-references/constructorFunctions_es5.2.minified.js index ec00862426f..1b47a7fc94a 100644 --- a/crates/swc/tests/tsc-references/constructorFunctions_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/constructorFunctions_es5.2.minified.js @@ -15,7 +15,7 @@ C2(), new C2(), C3(), new C3(); var C4 = function() { if (!swcHelpers._instanceof(this, C4)) return new C4(); }; -C4(), new C4(), new function() {}(), new function _class() { +C4(), new C4(), new function _class() { "use strict"; swcHelpers.classCallCheck(this, _class); }(), new function() { @@ -30,4 +30,4 @@ C4(), new C4(), new function() {}(), new function _class() { return x - 1; } ]; -}(), new function(num) {}(); +}(); diff --git a/crates/swc/tests/tsc-references/constructorImplementationWithDefaultValues2_es5.2.minified.js b/crates/swc/tests/tsc-references/constructorImplementationWithDefaultValues2_es5.2.minified.js index 96fe607d679..172aff19940 100644 --- a/crates/swc/tests/tsc-references/constructorImplementationWithDefaultValues2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/constructorImplementationWithDefaultValues2_es5.2.minified.js @@ -9,5 +9,5 @@ var C = function() { swcHelpers.classCallCheck(this, D), this.y = y; }, E = function() { "use strict"; - arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : new Date(), swcHelpers.classCallCheck(this, E); + arguments.length > 0 && void 0 !== arguments[0] && arguments[0], swcHelpers.classCallCheck(this, E); }; diff --git a/crates/swc/tests/tsc-references/controlFlowAliasingCatchVariables_es2015.2.minified.js b/crates/swc/tests/tsc-references/controlFlowAliasingCatchVariables_es2015.2.minified.js index 44d66df0127..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/controlFlowAliasingCatchVariables_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/controlFlowAliasingCatchVariables_es2015.2.minified.js @@ -1,8 +0,0 @@ -try {} catch (e) { - const isString = 'string' == typeof e; - isString && e.toUpperCase(), 'string' == typeof e && e.toUpperCase(); -} -try {} catch (e1) { - const isString = 'string' == typeof e1; - e1 = 1, isString && e1.toUpperCase(), 'string' == typeof e1 && e1.toUpperCase(); -} diff --git a/crates/swc/tests/tsc-references/controlFlowAliasingCatchVariables_es5.2.minified.js b/crates/swc/tests/tsc-references/controlFlowAliasingCatchVariables_es5.2.minified.js index 7303c55d337..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/controlFlowAliasingCatchVariables_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/controlFlowAliasingCatchVariables_es5.2.minified.js @@ -1,7 +0,0 @@ -try {} catch (e) { - "string" == typeof e && e.toUpperCase(), "string" == typeof e && e.toUpperCase(); -} -try {} catch (e1) { - var isString = "string" == typeof e1; - e1 = 1, isString && e1.toUpperCase(), "string" == typeof e1 && e1.toUpperCase(); -} diff --git a/crates/swc/tests/tsc-references/controlFlowForInStatement2_es2015.2.minified.js b/crates/swc/tests/tsc-references/controlFlowForInStatement2_es2015.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/controlFlowForInStatement2_es5.2.minified.js b/crates/swc/tests/tsc-references/controlFlowForInStatement2_es5.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es2015.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es2015.2.minified.js index ef8e1cb3ef5..99b7914d819 100644 --- a/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es2015.2.minified.js @@ -3,4 +3,4 @@ export default class Decl { }; Entity(); var z = new Entity(); -z.p1 + z.p2; +z.p1, z.p2; diff --git a/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es5.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es5.2.minified.js index 1808712ff15..e5087c2a364 100644 --- a/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsCannotMerge02_es5.2.minified.js @@ -6,5 +6,5 @@ var Decl = function() { }; Entity(); var z = new Entity(); -z.p1 + z.p2; +z.p1, z.p2; export { Decl as default }; diff --git a/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es2015.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es2015.2.minified.js index ef8e1cb3ef5..99b7914d819 100644 --- a/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es2015.2.minified.js @@ -3,4 +3,4 @@ export default class Decl { }; Entity(); var z = new Entity(); -z.p1 + z.p2; +z.p1, z.p2; diff --git a/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es5.2.minified.js b/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es5.2.minified.js index 1808712ff15..e5087c2a364 100644 --- a/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/defaultExportsCannotMerge03_es5.2.minified.js @@ -6,5 +6,5 @@ var Decl = function() { }; Entity(); var z = new Entity(); -z.p1 + z.p2; +z.p1, z.p2; export { Decl as default }; diff --git a/crates/swc/tests/tsc-references/destructuringAssignabilityCheck_es2015.2.minified.js b/crates/swc/tests/tsc-references/destructuringAssignabilityCheck_es2015.2.minified.js index 8796390b34c..65447937e71 100644 --- a/crates/swc/tests/tsc-references/destructuringAssignabilityCheck_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringAssignabilityCheck_es2015.2.minified.js @@ -1,5 +1,4 @@ -const [] = {}, {} = void 0; +const {} = void 0; (([])=>0 )({}), (({})=>0 )(void 0); -const {} = 1, [] = {}; diff --git a/crates/swc/tests/tsc-references/destructuringCatch_es2015.2.minified.js b/crates/swc/tests/tsc-references/destructuringCatch_es2015.2.minified.js index feb4dc081c2..88a0a596977 100644 --- a/crates/swc/tests/tsc-references/destructuringCatch_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringCatch_es2015.2.minified.js @@ -20,4 +20,3 @@ try { } ]; } catch ([{ x: [y] , z }]) {} -try {} catch ([a2]) {} diff --git a/crates/swc/tests/tsc-references/destructuringCatch_es5.2.minified.js b/crates/swc/tests/tsc-references/destructuringCatch_es5.2.minified.js index 501630a9a4d..194bedd941a 100644 --- a/crates/swc/tests/tsc-references/destructuringCatch_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringCatch_es5.2.minified.js @@ -29,6 +29,3 @@ try { var ref = swcHelpers.slicedToArray(param2, 1)[0]; swcHelpers.slicedToArray(ref.x, 1)[0], ref.z; } -try {} catch (param3) { - swcHelpers.slicedToArray(param3, 1)[0]; -} diff --git a/crates/swc/tests/tsc-references/doWhileBreakStatements_es2015.2.minified.js b/crates/swc/tests/tsc-references/doWhileBreakStatements_es2015.2.minified.js index 01f530197cb..bd72dd7eaaa 100644 --- a/crates/swc/tests/tsc-references/doWhileBreakStatements_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/doWhileBreakStatements_es2015.2.minified.js @@ -1,4 +1,3 @@ -TWO: ; FOUR: for(;;)FIVE: for(;;)break FOUR; for(;;); for(;;)for(;;); diff --git a/crates/swc/tests/tsc-references/doWhileBreakStatements_es5.2.minified.js b/crates/swc/tests/tsc-references/doWhileBreakStatements_es5.2.minified.js index 01f530197cb..bd72dd7eaaa 100644 --- a/crates/swc/tests/tsc-references/doWhileBreakStatements_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/doWhileBreakStatements_es5.2.minified.js @@ -1,4 +1,3 @@ -TWO: ; FOUR: for(;;)FIVE: for(;;)break FOUR; for(;;); for(;;)for(;;); diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperator2_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperator2_es2015.2.minified.js index 2c993430018..ed3b710e874 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperator2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperator2_es2015.2.minified.js @@ -1,2 +1,2 @@ var temp = 10; -Math.pow(++temp, 3), Math.pow(--temp, 3), Math.pow(temp++, 3), Math.pow(temp--, 3), --temp, Math.pow(temp, 3), --temp, Math.pow(temp, 3), --temp, Math.pow(temp, 3), --temp, Math.pow(temp, 3), --temp, Math.pow(temp, 3), Math.pow(temp--, 3), Math.pow(temp++, 3), Math.pow(temp--, -temp), Math.pow(temp++, +temp), Math.pow(--temp, 3), Math.pow(--temp, 3), Math.pow(--temp, 3), Math.pow(--temp, 3), Math.pow(--temp, 3), --temp, --temp, --temp, --temp, --temp, ++temp, ++temp, ++temp, ++temp, Math.pow(3, ++temp), Math.pow(3, --temp), Math.pow(3, temp++), Math.pow(3, temp--), Math.pow(3, Math.pow(++temp, 2)), Math.pow(3, Math.pow(--temp, 2)), Math.pow(3, Math.pow(temp++, 2)), Math.pow(3, Math.pow(temp--, 2)), Math.pow(3, ++temp), Math.pow(3, ++temp), Math.pow(3, ++temp), Math.pow(3, ++temp), Math.pow(3, ++temp), Math.pow(3, --temp), Math.pow(3, --temp), Math.pow(3, --temp), Math.pow(3, --temp), Math.pow(3, --temp); +++temp, --temp, temp++, temp--, --temp, --temp, --temp, --temp, --temp, temp--, temp++, temp--, temp++, --temp, --temp, --temp, --temp, --temp, --temp, --temp, --temp, --temp, --temp, ++temp, ++temp, ++temp, ++temp, ++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, ++temp, ++temp, ++temp, ++temp, ++temp, --temp, --temp, --temp, --temp, --temp; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperator2_es5.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperator2_es5.2.minified.js index 2c993430018..ed3b710e874 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperator2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperator2_es5.2.minified.js @@ -1,2 +1,2 @@ var temp = 10; -Math.pow(++temp, 3), Math.pow(--temp, 3), Math.pow(temp++, 3), Math.pow(temp--, 3), --temp, Math.pow(temp, 3), --temp, Math.pow(temp, 3), --temp, Math.pow(temp, 3), --temp, Math.pow(temp, 3), --temp, Math.pow(temp, 3), Math.pow(temp--, 3), Math.pow(temp++, 3), Math.pow(temp--, -temp), Math.pow(temp++, +temp), Math.pow(--temp, 3), Math.pow(--temp, 3), Math.pow(--temp, 3), Math.pow(--temp, 3), Math.pow(--temp, 3), --temp, --temp, --temp, --temp, --temp, ++temp, ++temp, ++temp, ++temp, Math.pow(3, ++temp), Math.pow(3, --temp), Math.pow(3, temp++), Math.pow(3, temp--), Math.pow(3, Math.pow(++temp, 2)), Math.pow(3, Math.pow(--temp, 2)), Math.pow(3, Math.pow(temp++, 2)), Math.pow(3, Math.pow(temp--, 2)), Math.pow(3, ++temp), Math.pow(3, ++temp), Math.pow(3, ++temp), Math.pow(3, ++temp), Math.pow(3, ++temp), Math.pow(3, --temp), Math.pow(3, --temp), Math.pow(3, --temp), Math.pow(3, --temp), Math.pow(3, --temp); +++temp, --temp, temp++, temp--, --temp, --temp, --temp, --temp, --temp, temp--, temp++, temp--, temp++, --temp, --temp, --temp, --temp, --temp, --temp, --temp, --temp, --temp, --temp, ++temp, ++temp, ++temp, ++temp, ++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, ++temp, ++temp, ++temp, ++temp, ++temp, --temp, --temp, --temp, --temp, --temp; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperator3_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperator3_es2015.2.minified.js index 533d56bd7a1..36b72d018fa 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperator3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperator3_es2015.2.minified.js @@ -1,2 +1,2 @@ var temp = 10; -Math.pow(-++temp, 3), Math.pow(+--temp, 3), Math.pow(-temp++, 3), Math.pow(+temp--, 3), Math.pow(-Math.pow(1, ++temp), 3), Math.pow(-Math.pow(1, --temp), 3), Math.pow(-Math.pow(1, temp++), 3), Math.pow(-Math.pow(1, temp--), 3), Math.pow(-3, temp++), Math.pow(-3, temp--), Math.pow(-3, ++temp), Math.pow(-3, --temp), Math.pow(3, temp++), Math.pow(3, temp--), Math.pow(3, ++temp), Math.pow(3, --temp), Math.pow(-3, Math.pow(temp++, 2)), Math.pow(-3, Math.pow(temp--, 2)), Math.pow(-3, Math.pow(++temp, 2)), Math.pow(-3, Math.pow(--temp, 2)), Math.pow(3, Math.pow(temp++, 2)), Math.pow(3, Math.pow(temp--, 2)), Math.pow(3, Math.pow(++temp, 2)), Math.pow(3, Math.pow(--temp, 2)), Math.pow(3, -temp++), Math.pow(3, -temp--), Math.pow(3, -++temp), Math.pow(3, +--temp), Math.pow(3, Math.pow(-temp++, 2)), Math.pow(3, Math.pow(-temp--, 2)), Math.pow(3, Math.pow(+temp++, 2)), Math.pow(3, Math.pow(+temp--, 2)), Math.pow(3, Math.pow(-++temp, 2)), Math.pow(3, Math.pow(+--temp, 2)); +++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, temp++, temp--, ++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, temp++, temp--, ++temp, --temp; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperator3_es5.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperator3_es5.2.minified.js index 533d56bd7a1..36b72d018fa 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperator3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperator3_es5.2.minified.js @@ -1,2 +1,2 @@ var temp = 10; -Math.pow(-++temp, 3), Math.pow(+--temp, 3), Math.pow(-temp++, 3), Math.pow(+temp--, 3), Math.pow(-Math.pow(1, ++temp), 3), Math.pow(-Math.pow(1, --temp), 3), Math.pow(-Math.pow(1, temp++), 3), Math.pow(-Math.pow(1, temp--), 3), Math.pow(-3, temp++), Math.pow(-3, temp--), Math.pow(-3, ++temp), Math.pow(-3, --temp), Math.pow(3, temp++), Math.pow(3, temp--), Math.pow(3, ++temp), Math.pow(3, --temp), Math.pow(-3, Math.pow(temp++, 2)), Math.pow(-3, Math.pow(temp--, 2)), Math.pow(-3, Math.pow(++temp, 2)), Math.pow(-3, Math.pow(--temp, 2)), Math.pow(3, Math.pow(temp++, 2)), Math.pow(3, Math.pow(temp--, 2)), Math.pow(3, Math.pow(++temp, 2)), Math.pow(3, Math.pow(--temp, 2)), Math.pow(3, -temp++), Math.pow(3, -temp--), Math.pow(3, -++temp), Math.pow(3, +--temp), Math.pow(3, Math.pow(-temp++, 2)), Math.pow(3, Math.pow(-temp--, 2)), Math.pow(3, Math.pow(+temp++, 2)), Math.pow(3, Math.pow(+temp--, 2)), Math.pow(3, Math.pow(-++temp, 2)), Math.pow(3, Math.pow(+--temp, 2)); +++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, temp++, temp--, ++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, ++temp, --temp, temp++, temp--, temp++, temp--, ++temp, --temp; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperator4_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperator4_es2015.2.minified.js index 03c652f9d88..c28389d268c 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperator4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperator4_es2015.2.minified.js @@ -1,2 +1,2 @@ var temp; -Math.pow(--temp, 3), Math.pow(++temp, 3), Math.pow(temp--, 3), Math.pow(temp++, 3), Math.pow(1, Math.pow(--temp, 3)), Math.pow(1, Math.pow(++temp, 3)), Math.pow(1, Math.pow(temp--, 3)), Math.pow(1, Math.pow(temp++, 3)), Math.pow(void --temp, 3), Math.pow(void temp--, 3), Math.pow(void temp++, 4), Math.pow(void temp--, 4), Math.pow(1, Math.pow(void --temp, 3)), Math.pow(1, Math.pow(void temp--, 3)), Math.pow(1, Math.pow(void temp++, 4)), Math.pow(1, Math.pow(void temp--, 4)), Math.pow(~--temp, 3), Math.pow(~temp--, 3), Math.pow(~temp++, 4), Math.pow(~temp--, 4), Math.pow(1, Math.pow(~--temp, 3)), Math.pow(1, Math.pow(~temp--, 3)), Math.pow(1, Math.pow(~temp++, 4)), Math.pow(1, Math.pow(~temp--, 4)); +--temp, ++temp, temp--, temp++, --temp, ++temp, temp--, temp++, --temp, temp--, temp++, temp--, --temp, temp--, temp++, temp--, --temp, temp--, temp++, temp--, --temp, temp--, temp++, temp--; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperator4_es5.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperator4_es5.2.minified.js index 03c652f9d88..c28389d268c 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperator4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperator4_es5.2.minified.js @@ -1,2 +1,2 @@ var temp; -Math.pow(--temp, 3), Math.pow(++temp, 3), Math.pow(temp--, 3), Math.pow(temp++, 3), Math.pow(1, Math.pow(--temp, 3)), Math.pow(1, Math.pow(++temp, 3)), Math.pow(1, Math.pow(temp--, 3)), Math.pow(1, Math.pow(temp++, 3)), Math.pow(void --temp, 3), Math.pow(void temp--, 3), Math.pow(void temp++, 4), Math.pow(void temp--, 4), Math.pow(1, Math.pow(void --temp, 3)), Math.pow(1, Math.pow(void temp--, 3)), Math.pow(1, Math.pow(void temp++, 4)), Math.pow(1, Math.pow(void temp--, 4)), Math.pow(~--temp, 3), Math.pow(~temp--, 3), Math.pow(~temp++, 4), Math.pow(~temp--, 4), Math.pow(1, Math.pow(~--temp, 3)), Math.pow(1, Math.pow(~temp--, 3)), Math.pow(1, Math.pow(~temp++, 4)), Math.pow(1, Math.pow(~temp--, 4)); +--temp, ++temp, temp--, temp++, --temp, ++temp, temp--, temp++, --temp, temp--, temp++, temp--, --temp, temp--, temp++, temp--, --temp, temp--, temp++, temp--, --temp, temp--, temp++, temp--; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4ES6_es2015.2.minified.js index 9a0f4da3e17..bfe3a36e2e4 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4ES6_es2015.2.minified.js @@ -1,2 +1,2 @@ var t1 = 10; -`${Math.pow(t1, -10)} world`, `${Math.pow(-t1, 10) - t1} world`, `${Math.pow(-++t1, 10) - t1} world`, `${Math.pow(-t1++, 10) - t1} world`, `${Math.pow(~t1, Math.pow(10, --t1))} world`, `${typeof Math.pow(t1, Math.pow(10, t1))} world`, `${Math.pow(t1, -10)} hello world ${Math.pow(t1, -10)}`, `${Math.pow(-t1, 10) - t1} hello world ${Math.pow(-t1, 10) - t1}`, `${Math.pow(-++t1, 10) - t1} hello world ${Math.pow(t1, Math.pow(-++t1, -t1))}`, `${Math.pow(-t1++, 10) - t1} hello world ${Math.pow(10, Math.pow(-t1++, -t1))}`, `${Math.pow(~t1, Math.pow(10, --t1))} hello world ${Math.pow(~t1, Math.pow(10, --t1))}`, `${typeof Math.pow(t1, Math.pow(10, t1))} hello world ${typeof Math.pow(t1, Math.pow(10, t1))}`, `hello ${Math.pow(-t1, 10) - t1}`, `hello ${Math.pow(-++t1, 10) - t1}`, `hello ${Math.pow(-t1++, 10) - t1}`, `hello ${Math.pow(~t1, Math.pow(10, --t1))}`, `hello ${typeof Math.pow(t1, Math.pow(10, t1))}`; +++t1, t1++, --t1, ++t1, ++t1, t1++, t1++, --t1, --t1, ++t1, t1++, --t1; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4_es2015.2.minified.js index 9a0f4da3e17..bfe3a36e2e4 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTempalteString4_es2015.2.minified.js @@ -1,2 +1,2 @@ var t1 = 10; -`${Math.pow(t1, -10)} world`, `${Math.pow(-t1, 10) - t1} world`, `${Math.pow(-++t1, 10) - t1} world`, `${Math.pow(-t1++, 10) - t1} world`, `${Math.pow(~t1, Math.pow(10, --t1))} world`, `${typeof Math.pow(t1, Math.pow(10, t1))} world`, `${Math.pow(t1, -10)} hello world ${Math.pow(t1, -10)}`, `${Math.pow(-t1, 10) - t1} hello world ${Math.pow(-t1, 10) - t1}`, `${Math.pow(-++t1, 10) - t1} hello world ${Math.pow(t1, Math.pow(-++t1, -t1))}`, `${Math.pow(-t1++, 10) - t1} hello world ${Math.pow(10, Math.pow(-t1++, -t1))}`, `${Math.pow(~t1, Math.pow(10, --t1))} hello world ${Math.pow(~t1, Math.pow(10, --t1))}`, `${typeof Math.pow(t1, Math.pow(10, t1))} hello world ${typeof Math.pow(t1, Math.pow(10, t1))}`, `hello ${Math.pow(-t1, 10) - t1}`, `hello ${Math.pow(-++t1, 10) - t1}`, `hello ${Math.pow(-t1++, 10) - t1}`, `hello ${Math.pow(~t1, Math.pow(10, --t1))}`, `hello ${typeof Math.pow(t1, Math.pow(10, t1))}`; +++t1, t1++, --t1, ++t1, ++t1, t1++, t1++, --t1, --t1, ++t1, t1++, --t1; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString1ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString1ES6_es2015.2.minified.js index 292ddfd3457..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString1ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString1ES6_es2015.2.minified.js @@ -1 +0,0 @@ -"10000000020 hello world 10000000020"; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString1_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString1_es2015.2.minified.js index 292ddfd3457..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString1_es2015.2.minified.js @@ -1 +0,0 @@ -"10000000020 hello world 10000000020"; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString2ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString2ES6_es2015.2.minified.js index 7103a33be93..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString2ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString2ES6_es2015.2.minified.js @@ -1 +0,0 @@ -"hello 10000000020 hello world 10000000020"; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString2_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString2_es2015.2.minified.js index 7103a33be93..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString2_es2015.2.minified.js @@ -1 +0,0 @@ -"hello 10000000020 hello world 10000000020"; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString3ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString3ES6_es2015.2.minified.js index be2e2bfc8a4..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString3ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString3ES6_es2015.2.minified.js @@ -1 +0,0 @@ -"10000000020 hello world 10000000020 !!"; diff --git a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString3_es2015.2.minified.js b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString3_es2015.2.minified.js index be2e2bfc8a4..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emitExponentiationOperatorInTemplateString3_es2015.2.minified.js @@ -1 +0,0 @@ -"10000000020 hello world 10000000020 !!"; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5_es2015.2.minified.js index c5fe9fa6f91..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5_es2015.2.minified.js @@ -1,5 +0,0 @@ -({} = a), [] = a; -var a, [] = [ - 1, - 2 -]; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5iterable_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5iterable_es2015.2.minified.js index 50fa13c51f9..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5iterable_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5iterable_es2015.2.minified.js @@ -1,2 +0,0 @@ -var a; -({} = a), [] = a; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES6_es2015.2.minified.js index 50fa13c51f9..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES6_es2015.2.minified.js @@ -1,2 +0,0 @@ -var a; -({} = a), [] = a; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5_es2015.2.minified.js index dc0e46ee2f6..7c3cf167f43 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5_es2015.2.minified.js @@ -1,3 +1,3 @@ var a; let x, y, z, a1, a2, a3; -({} = { x , y , z } = a), [] = [a1, a2, a3] = a; +({ x , y , z } = a), [a1, a2, a3] = a; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5iterable_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5iterable_es2015.2.minified.js index dc0e46ee2f6..7c3cf167f43 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5iterable_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES5iterable_es2015.2.minified.js @@ -1,3 +1,3 @@ var a; let x, y, z, a1, a2, a3; -({} = { x , y , z } = a), [] = [a1, a2, a3] = a; +({ x , y , z } = a), [a1, a2, a3] = a; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES6_es2015.2.minified.js index dc0e46ee2f6..7c3cf167f43 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns02_ES6_es2015.2.minified.js @@ -1,3 +1,3 @@ var a; let x, y, z, a1, a2, a3; -({} = { x , y , z } = a), [] = [a1, a2, a3] = a; +({ x , y , z } = a), [a1, a2, a3] = a; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES5_es2015.2.minified.js index b8b103e0f1d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES5_es2015.2.minified.js @@ -1,2 +0,0 @@ -var a; -({} = {} = a), [] = [] = a; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES5iterable_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES5iterable_es2015.2.minified.js index b8b103e0f1d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES5iterable_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES5iterable_es2015.2.minified.js @@ -1,2 +0,0 @@ -var a; -({} = {} = a), [] = [] = a; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES6_es2015.2.minified.js index b8b103e0f1d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns03_ES6_es2015.2.minified.js @@ -1,2 +0,0 @@ -var a; -({} = {} = a), [] = [] = a; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5_es2015.2.minified.js index a04f87eeede..7c3cf167f43 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5_es2015.2.minified.js @@ -1,3 +1,3 @@ var a; let x, y, z, a1, a2, a3; -({ x , y , z } = {} = a), [a1, a2, a3] = [] = a; +({ x , y , z } = a), [a1, a2, a3] = a; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5iterable_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5iterable_es2015.2.minified.js index a04f87eeede..7c3cf167f43 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5iterable_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES5iterable_es2015.2.minified.js @@ -1,3 +1,3 @@ var a; let x, y, z, a1, a2, a3; -({ x , y , z } = {} = a), [a1, a2, a3] = [] = a; +({ x , y , z } = a), [a1, a2, a3] = a; diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES6_es2015.2.minified.js index a04f87eeede..7c3cf167f43 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns04_ES6_es2015.2.minified.js @@ -1,3 +1,3 @@ var a; let x, y, z, a1, a2, a3; -({ x , y , z } = {} = a), [a1, a2, a3] = [] = a; +({ x , y , z } = a), [a1, a2, a3] = a; diff --git a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5_es2015.2.minified.js index 651954cd155..f3ebede1f5f 100644 --- a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5_es2015.2.minified.js @@ -8,10 +8,9 @@ var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; - var { p1: {} , p2: [] } = a; - let { p1: {} , p2: [] } = a; - const { p1: {} , p2: [] } = a; - var {} = {}, {} = {}; + var {} = a; + let {} = a; + const {} = a; }(), function() { const ns = []; for (var {} of ns); diff --git a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable_es2015.2.minified.js index 651954cd155..f3ebede1f5f 100644 --- a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable_es2015.2.minified.js @@ -8,10 +8,9 @@ var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; - var { p1: {} , p2: [] } = a; - let { p1: {} , p2: [] } = a; - const { p1: {} , p2: [] } = a; - var {} = {}, {} = {}; + var {} = a; + let {} = a; + const {} = a; }(), function() { const ns = []; for (var {} of ns); diff --git a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES6_es2015.2.minified.js index 651954cd155..f3ebede1f5f 100644 --- a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES6_es2015.2.minified.js @@ -8,10 +8,9 @@ var {} = a, [] = a; let {} = a, [] = a; const {} = a, [] = a; - var { p1: {} , p2: [] } = a; - let { p1: {} , p2: [] } = a; - const { p1: {} , p2: [] } = a; - var {} = {}, {} = {}; + var {} = a; + let {} = a; + const {} = a; }(), function() { const ns = []; for (var {} of ns); diff --git a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer_es2015.2.minified.js b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer_es2015.2.minified.js index 352122a3abe..4f6301b4bfd 100644 --- a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer_es2015.2.minified.js @@ -6,5 +6,5 @@ class C { }, M1.F2 = function(x) { return x.toString(); }; -}(M || (M = {})), new Date(12), new Object(), new C(), new C(), new class { +}(M || (M = {})), new Object(), new C(), new C(), new class { }(), new C(), new M.A(); diff --git a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer_es5.2.minified.js b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer_es5.2.minified.js index 5cdeb5b3e75..9074c73a157 100644 --- a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer_es5.2.minified.js @@ -14,4 +14,4 @@ var M, C = function() { M1.A = A, M1.F2 = function(x) { return x.toString(); }; -}(M || (M = {})), new Date(12), new Object(), new C(), new C(), new D(), new C(), new M.A(); +}(M || (M = {})), new Object(), new C(), new C(), new D(), new C(), new M.A(); diff --git a/crates/swc/tests/tsc-references/everyTypeWithInitializer_es2015.2.minified.js b/crates/swc/tests/tsc-references/everyTypeWithInitializer_es2015.2.minified.js index d878a3af33e..851c9f549cb 100644 --- a/crates/swc/tests/tsc-references/everyTypeWithInitializer_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeWithInitializer_es2015.2.minified.js @@ -6,5 +6,5 @@ class C { }, M1.F2 = function(x) { return x.toString(); }; -}(M || (M = {})), new Date(12), new Object(), new C(), new C(), new class { +}(M || (M = {})), new Object(), new C(), new C(), new class { }(), new M.A(), M.F2; diff --git a/crates/swc/tests/tsc-references/everyTypeWithInitializer_es5.2.minified.js b/crates/swc/tests/tsc-references/everyTypeWithInitializer_es5.2.minified.js index 59d3e14a2cd..245db94ce82 100644 --- a/crates/swc/tests/tsc-references/everyTypeWithInitializer_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeWithInitializer_es5.2.minified.js @@ -14,4 +14,4 @@ var M, C = function() { M1.A = A, M1.F2 = function(x) { return x.toString(); }; -}(M || (M = {})), new Date(12), new Object(), new C(), new C(), new D(), new M.A(), M.F2; +}(M || (M = {})), new Object(), new C(), new C(), new D(), new M.A(), M.F2; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion_es2015.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion_es2015.2.minified.js index 35a539260ae..f534500d60b 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion_es2015.2.minified.js @@ -1,6 +1,6 @@ -var E, F, a, b; +var E, F; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; }(E || (E = {})), function(F) { F[F.c = 0] = "c", F[F.d = 1] = "d"; -}(F || (F = {})), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, E.b), Math.pow(E.a, 1), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(1, E.b); +}(F || (F = {})), E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion_es5.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion_es5.2.minified.js index 35a539260ae..f534500d60b 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion_es5.2.minified.js @@ -1,6 +1,6 @@ -var E, F, a, b; +var E, F; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; }(E || (E = {})), function(F) { F[F.c = 0] = "c", F[F.d = 1] = "d"; -}(F || (F = {})), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, E.b), Math.pow(E.a, 1), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(1, E.b); +}(F || (F = {})), E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum_es2015.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum_es2015.2.minified.js index 085e3d49b42..194e7120d8f 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum_es2015.2.minified.js @@ -1,4 +1,4 @@ -var E, a, b; +var E; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; -}(E || (E = {})), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, E.b), Math.pow(E.a, 1), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(1, E.b); +}(E || (E = {})), E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum_es5.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum_es5.2.minified.js index 085e3d49b42..194e7120d8f 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum_es5.2.minified.js @@ -1,4 +1,4 @@ -var E, a, b; +var E; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; -}(E || (E = {})), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, E.b), Math.pow(E.a, 1), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(1, E.b); +}(E || (E = {})), E.a, E.a, E.a, E.b, E.a, E.b, E.b, E.b; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands_es2015.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands_es2015.2.minified.js index 428586e951d..101dd481e22 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands_es2015.2.minified.js @@ -1,4 +1,4 @@ -var E, a, b, c, d, e, f; +var E; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; -}(E || (E = {})), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, c), Math.pow(E.a, d), Math.pow(E.a, e), Math.pow(E.a, f), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(c, E.b), Math.pow(d, E.b), Math.pow(e, E.b), Math.pow(f, E.b); +}(E || (E = {})), E.a, E.a, E.a, E.a, E.a, E.a, E.b, E.b, E.b, E.b, E.b, E.b; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands_es5.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands_es5.2.minified.js index 428586e951d..101dd481e22 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands_es5.2.minified.js @@ -1,4 +1,4 @@ -var E, a, b, c, d, e, f; +var E; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; -}(E || (E = {})), Math.pow(E.a, a), Math.pow(E.a, b), Math.pow(E.a, c), Math.pow(E.a, d), Math.pow(E.a, e), Math.pow(E.a, f), Math.pow(a, E.b), Math.pow(b, E.b), Math.pow(c, E.b), Math.pow(d, E.b), Math.pow(e, E.b), Math.pow(f, E.b); +}(E || (E = {})), E.a, E.a, E.a, E.a, E.a, E.a, E.b, E.b, E.b, E.b, E.b, E.b; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithNew_es2015.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithNew_es2015.2.minified.js index dd67782652b..25f4b1ad25a 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithNew_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithNew_es2015.2.minified.js @@ -1,2 +1,2 @@ var a, b, c; -Math.pow(new a, Math.pow(b, c)), Math.pow(new a, Math.pow(new b, c)), new (Math.pow(a, Math.pow(b, c))); +new a, new a, new b, new (Math.pow(a, Math.pow(b, c))); diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithNew_es5.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithNew_es5.2.minified.js index dd67782652b..25f4b1ad25a 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithNew_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithNew_es5.2.minified.js @@ -1,2 +1,2 @@ var a, b, c; -Math.pow(new a, Math.pow(b, c)), Math.pow(new a, Math.pow(new b, c)), new (Math.pow(a, Math.pow(b, c))); +new a, new a, new b, new (Math.pow(a, Math.pow(b, c))); diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithNullValueAndValidOperands_es2015.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithNullValueAndValidOperands_es2015.2.minified.js index 42614f7f5a2..c43be33853e 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithNullValueAndValidOperands_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithNullValueAndValidOperands_es2015.2.minified.js @@ -1,4 +1,4 @@ var E; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; -}(E || (E = {})), Math.pow(null, E.a), Math.pow(E.b, null); +}(E || (E = {})), E.a, E.b; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithNullValueAndValidOperands_es5.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithNullValueAndValidOperands_es5.2.minified.js index 42614f7f5a2..c43be33853e 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithNullValueAndValidOperands_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithNullValueAndValidOperands_es5.2.minified.js @@ -1,4 +1,4 @@ var E; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; -}(E || (E = {})), Math.pow(null, E.a), Math.pow(E.b, null); +}(E || (E = {})), E.a, E.b; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalidES6_es5.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalidES6_es5.2.minified.js index 6515ef24849..1561021f261 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalidES6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalidES6_es5.2.minified.js @@ -1,3 +1,3 @@ -Math.pow(1, "".concat(3)), Math.pow(1, "2".concat(3)), Math.pow(1, "".concat(3, "4")), Math.pow(1, "2".concat(3, "4")), Math.pow("".concat(3), 5), Math.pow("2".concat(3), 5), Math.pow("".concat(3, "4"), 5), Math.pow("2".concat(3, "4"), 5); +"".concat(3), "2".concat(3), "".concat(3, "4"), "2".concat(3, "4"), "".concat(3), "2".concat(3), "".concat(3, "4"), "2".concat(3, "4"); var k = 10; k = Math.pow(k, "".concat(3)), k = Math.pow(k, "2".concat(3)), k = Math.pow(k, "2".concat(3, "4")), kj = Math.pow(kj, "2".concat(3, "4")); diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalid_es5.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalid_es5.2.minified.js index 6f60fb9bc4c..5733424bf6d 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalid_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithTemplateStringInvalid_es5.2.minified.js @@ -1,3 +1,3 @@ -Math.pow(1, "".concat(3)), Math.pow(1, "2".concat(3)), Math.pow(1, "".concat(3, "4")), Math.pow(1, "2".concat(3, "4")), Math.pow("".concat(3), 5), Math.pow("2".concat(3), 5), Math.pow("".concat(3, "4"), 5), Math.pow("2".concat(3, "4"), 5); +"".concat(3), "2".concat(3), "".concat(3, "4"), "2".concat(3, "4"), "".concat(3), "2".concat(3), "".concat(3, "4"), "2".concat(3, "4"); var k = 10; k = Math.pow(k, "".concat(3)), k = Math.pow(k, "2".concat(3)), k = Math.pow(k, "2".concat(3, "4")), k = Math.pow(k, "2".concat(3, "4")); diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithUndefinedValueAndValidOperands_es2015.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithUndefinedValueAndValidOperands_es2015.2.minified.js index 4c02b5fb66e..c43be33853e 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithUndefinedValueAndValidOperands_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithUndefinedValueAndValidOperands_es2015.2.minified.js @@ -1,4 +1,4 @@ var E; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; -}(E || (E = {})), Math.pow(void 0, E.a), Math.pow(E.b, void 0); +}(E || (E = {})), E.a, E.b; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithUndefinedValueAndValidOperands_es5.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithUndefinedValueAndValidOperands_es5.2.minified.js index 4c02b5fb66e..c43be33853e 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithUndefinedValueAndValidOperands_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithUndefinedValueAndValidOperands_es5.2.minified.js @@ -1,4 +1,4 @@ var E; !function(E) { E[E.a = 0] = "a", E[E.b = 1] = "b"; -}(E || (E = {})), Math.pow(void 0, E.a), Math.pow(E.b, void 0); +}(E || (E = {})), E.a, E.b; diff --git a/crates/swc/tests/tsc-references/forBreakStatements_es2015.2.minified.js b/crates/swc/tests/tsc-references/forBreakStatements_es2015.2.minified.js index 01f530197cb..bd72dd7eaaa 100644 --- a/crates/swc/tests/tsc-references/forBreakStatements_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/forBreakStatements_es2015.2.minified.js @@ -1,4 +1,3 @@ -TWO: ; FOUR: for(;;)FIVE: for(;;)break FOUR; for(;;); for(;;)for(;;); diff --git a/crates/swc/tests/tsc-references/forBreakStatements_es5.2.minified.js b/crates/swc/tests/tsc-references/forBreakStatements_es5.2.minified.js index 01f530197cb..bd72dd7eaaa 100644 --- a/crates/swc/tests/tsc-references/forBreakStatements_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/forBreakStatements_es5.2.minified.js @@ -1,4 +1,3 @@ -TWO: ; FOUR: for(;;)FIVE: for(;;)break FOUR; for(;;); for(;;)for(;;); diff --git a/crates/swc/tests/tsc-references/forStatements_es2015.2.minified.js b/crates/swc/tests/tsc-references/forStatements_es2015.2.minified.js index 52ed56cf9ec..6ee47917002 100644 --- a/crates/swc/tests/tsc-references/forStatements_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/forStatements_es2015.2.minified.js @@ -9,7 +9,7 @@ class C { for(var M;;); for(;;); for(;;); -for(new Date(12);;); +for(;;); for(new Object();;); for(;;); for(;;); diff --git a/crates/swc/tests/tsc-references/forStatements_es5.2.minified.js b/crates/swc/tests/tsc-references/forStatements_es5.2.minified.js index 0cfac73eabc..42dcbef14d9 100644 --- a/crates/swc/tests/tsc-references/forStatements_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/forStatements_es5.2.minified.js @@ -17,7 +17,7 @@ for(!function(M1) { }(M || (M = {}));;); for(;;); for(;;); -for(new Date(12);;); +for(;;); for(new Object();;); for(;;); for(;;); 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 0c4301ab7f0..57553c8aa27 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es2015.2.minified.js @@ -1,6 +1,3 @@ !function(x) { return x; -}(()=>{}, 1), function(x) {}(1, ()=>{}), new Function(), function(x) {}((x)=>x -), function(x) {}((x)=>x -), function(x) {}((x, y)=>x -); +}(()=>{}, 1), new 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 9b40c4238f3..564e2fa015c 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction2_es5.2.minified.js @@ -1,7 +1,7 @@ import * as swcHelpers from "@swc/helpers"; !function(x) { return x; -}(function() {}, 1), function(x) {}(1, function() {}); +}(function() {}, 1); var C = function() { "use strict"; swcHelpers.classCallCheck(this, C); @@ -9,10 +9,4 @@ var C = function() { "use strict"; swcHelpers.classCallCheck(this, C2); }; -new Function(), function(x) {}(function(x) { - return x; -}), function(x) {}(function(x) { - return x; -}), function(x) {}(function(x, y) { - return x; -}); +new 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 7c1c7d7fc4f..0230f00e5b0 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es2015.2.minified.js @@ -1,7 +1 @@ -new Function(), function(x) {}((x)=>x -), function(x) {}((x)=>x -), function(x) {}(function(x) { - return x; -}), function(x) {}(function(x) { - return x; -}); +new 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 04b7c10ea4f..b5ccb900ac6 100644 --- a/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/functionConstraintSatisfaction_es5.2.minified.js @@ -3,15 +3,7 @@ var C = function() { "use strict"; swcHelpers.classCallCheck(this, C); }; -new Function(), function(x) {}(function(x) { - return x; -}), function(x) {}(function(x) { - return x; -}), function(x) {}(function(x) { - return x; -}), function(x) {}(function(x) { - return x; -}); +new Function(); var C2 = function() { "use strict"; swcHelpers.classCallCheck(this, C2); diff --git a/crates/swc/tests/tsc-references/generatedContextualTyping_es5.2.minified.js b/crates/swc/tests/tsc-references/generatedContextualTyping_es5.2.minified.js index cb482172eaf..51196ce21bd 100644 --- a/crates/swc/tests/tsc-references/generatedContextualTyping_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/generatedContextualTyping_es5.2.minified.js @@ -918,36 +918,4 @@ var x85 = function() { d2 ]; } -}, function(n) {}(function() { - return [ - d1, - d2 - ]; -}), function(n) {}(function() { - return [ - d1, - d2 - ]; -}), function(n) {}(function() { - return [ - d1, - d2 - ]; -}), function(n) {}(function() { - return [ - d1, - d2 - ]; -}), function(n) {}(function() { - return [ - d1, - d2 - ]; -}), function(n) {}(function() { - return [ - d1, - d2 - ]; -}), function(n) {}(function(n) { - return null; -}); +}; diff --git a/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2_es2015.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2_es2015.2.minified.js index d3cdad02bff..8a3297d61c6 100644 --- a/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2_es2015.2.minified.js @@ -4,15 +4,11 @@ var onlyT, TU; let E1; (E = E1 || (E1 = {}))[E.A = 0] = "A"; let F1; - (F = F1 || (F1 = {}))[F.A = 0] = "A", function(x, a, b) {}(E1.A, (x)=>E1.A - , (x)=>F1.A - ); + (F = F1 || (F1 = {}))[F.A = 0] = "A", E1.A; }(onlyT || (onlyT = {})), function(TU) { var E, F; let E2; (E = E2 || (E2 = {}))[E.A = 0] = "A"; let F2; - (F = F2 || (F2 = {}))[F.A = 0] = "A", function(x, a, b) {}(E2.A, (x)=>E2.A - , (x)=>F2.A - ); + (F = F2 || (F2 = {}))[F.A = 0] = "A", E2.A; }(TU || (TU = {})); diff --git a/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2_es5.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2_es5.2.minified.js index 2b7189c00d8..a772f78885f 100644 --- a/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2_es5.2.minified.js @@ -1,24 +1,8 @@ var onlyT, TU; !function(onlyT) { var E, F, E1, F1; - (function(a, b) {})(function(x) { - return 1; - }, function(x) { - return ""; - }), (E1 = E || (E = {}))[E1.A = 0] = "A", (F1 = F || (F = {}))[F1.A = 0] = "A", function(x, a, b) {}(E.A, function(x) { - return E.A; - }, function(x) { - return F.A; - }); + (E1 = E || (E = {}))[E1.A = 0] = "A", (F1 = F || (F = {}))[F1.A = 0] = "A", E.A; }(onlyT || (onlyT = {})), function(TU) { var E, F, E2, F2; - (function(a, b) {})(function(x) { - return 1; - }, function(x) { - return ""; - }), (E2 = E || (E = {}))[E2.A = 0] = "A", (F2 = F || (F = {}))[F2.A = 0] = "A", function(x, a, b) {}(E.A, function(x) { - return E.A; - }, function(x) { - return F.A; - }); + (E2 = E || (E = {}))[E2.A = 0] = "A", (F2 = F || (F = {}))[F2.A = 0] = "A", E.A; }(TU || (TU = {})); diff --git a/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments2_es5.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments2_es5.2.minified.js index 6b0620fdb11..11db2033670 100644 --- a/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments2_es5.2.minified.js @@ -1,13 +1,9 @@ var NonGenericParameter, GenericParameter; -NonGenericParameter || (NonGenericParameter = {}), function(cb) {}(function(x) {}), function(GenericParameter) { +NonGenericParameter || (NonGenericParameter = {}), function(GenericParameter) { var a, foo7 = function(x, cb) { return cb; }; - (function(cb) {})(function(x) { - return x; - }), function(cb) {}(function(x, y) { - return ""; - }), foo7(1, function(x) { + foo7(1, function(x) { return x; }), foo7(1, a); }(GenericParameter || (GenericParameter = {})); diff --git a/crates/swc/tests/tsc-references/ifDoWhileStatements_es2015.2.minified.js b/crates/swc/tests/tsc-references/ifDoWhileStatements_es2015.2.minified.js index e28263d5b0b..8817dc985cc 100644 --- a/crates/swc/tests/tsc-references/ifDoWhileStatements_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/ifDoWhileStatements_es2015.2.minified.js @@ -14,16 +14,8 @@ for(!function(M1) { }; }(N || (N = {}));;); for(;;); -do ; -while (null) -do ; -while (void 0) -do ; -while (0.0) for(;;); for(;;); -do ; -while ('') for(;;); for(;;); for(;;); @@ -48,19 +40,12 @@ do ; while (new D()) for(;;); for(;;); -do ; -while (null) for(var M, N, c = void 0; c;); do ; while (c) -do ; -while (0.0) for(var e = 'a string'; e;); do ; while (e) -''; -do ; -while ('') for(var g = /[a-z]/; g;); do ; while (g) @@ -85,8 +70,6 @@ while (k) function fn(x) { return null; } -do ; -while (null) for(; fn;); do ; while (fn) diff --git a/crates/swc/tests/tsc-references/ifDoWhileStatements_es5.2.minified.js b/crates/swc/tests/tsc-references/ifDoWhileStatements_es5.2.minified.js index e4aeb4fe020..d76f9b5552a 100644 --- a/crates/swc/tests/tsc-references/ifDoWhileStatements_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/ifDoWhileStatements_es5.2.minified.js @@ -32,16 +32,8 @@ for(!function(M1) { }; }(N || (N = {}));;); for(;;); -do ; -while (null); -do ; -while (void 0); -do ; -while (0.0); for(;;); for(;;); -do ; -while (""); for(;;); for(;;); for(;;); @@ -62,19 +54,12 @@ do ; while (new D()); for(;;); for(;;); -do ; -while (null); for(var c = void 0; c;); do ; while (c); -do ; -while (0.0); for(var e = "a string"; e;); do ; while (e); -""; -do ; -while (""); for(var g = /[a-z]/; g;); do ; while (g); @@ -99,8 +84,6 @@ while (k); function fn(x) { return null; } -do ; -while (null); for(; fn;); do ; while (fn); diff --git a/crates/swc/tests/tsc-references/inOperatorWithInvalidOperands_es2015.2.minified.js b/crates/swc/tests/tsc-references/inOperatorWithInvalidOperands_es2015.2.minified.js index 2ae9c10009d..c4451285fd8 100644 --- a/crates/swc/tests/tsc-references/inOperatorWithInvalidOperands_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inOperatorWithInvalidOperands_es2015.2.minified.js @@ -1,4 +1,4 @@ -var E, x; +var E; !function(E) { E[E.a = 0] = "a"; -}(E || (E = {})), E.a in x; +}(E || (E = {})), E.a; diff --git a/crates/swc/tests/tsc-references/inOperatorWithInvalidOperands_es5.2.minified.js b/crates/swc/tests/tsc-references/inOperatorWithInvalidOperands_es5.2.minified.js index 920454c5b8b..17144d5b376 100644 --- a/crates/swc/tests/tsc-references/inOperatorWithInvalidOperands_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inOperatorWithInvalidOperands_es5.2.minified.js @@ -1,8 +1,8 @@ import * as swcHelpers from "@swc/helpers"; -var E, x, Foo = function() { +var E, Foo = function() { "use strict"; swcHelpers.classCallCheck(this, Foo); }; !function(E) { E[E.a = 0] = "a"; -}(E || (E = {})), E.a in x; +}(E || (E = {})), E.a; diff --git a/crates/swc/tests/tsc-references/instanceMemberInitialization_es2015.2.minified.js b/crates/swc/tests/tsc-references/instanceMemberInitialization_es2015.2.minified.js index 51e41b86957..5e9c34c2011 100644 --- a/crates/swc/tests/tsc-references/instanceMemberInitialization_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/instanceMemberInitialization_es2015.2.minified.js @@ -6,4 +6,4 @@ class C { var c = new C(); c.x = 3; var c2 = new C(); -c.x === c2.x; +c.x, c2.x; diff --git a/crates/swc/tests/tsc-references/instanceMemberInitialization_es5.2.minified.js b/crates/swc/tests/tsc-references/instanceMemberInitialization_es5.2.minified.js index 70f95947367..56169ebdf38 100644 --- a/crates/swc/tests/tsc-references/instanceMemberInitialization_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/instanceMemberInitialization_es5.2.minified.js @@ -5,7 +5,7 @@ var C = function() { }, c = new C(); c.x = 3; var c2 = new C(); -c.x === c2.x; +c.x, c2.x; var MyMap = function(Map_) { "use strict"; swcHelpers.classCallCheck(this, MyMap), this.Map_ = Map_, this.store = new this.Map_(); diff --git a/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments_es2015.2.minified.js b/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments_es2015.2.minified.js index 635790223fb..db199753829 100644 --- a/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments_es2015.2.minified.js @@ -1,3 +1,3 @@ var f, a; new class { -}(), new function() {}(), new f(), new a(); +}(), new f(), new a(); diff --git a/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments_es5.2.minified.js b/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments_es5.2.minified.js index bd93993324a..bb2170033a4 100644 --- a/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/instantiateNonGenericTypeWithTypeArguments_es5.2.minified.js @@ -3,4 +3,4 @@ var f, a, C = function() { "use strict"; swcHelpers.classCallCheck(this, C); }; -new C(), new function() {}(), new f(), new a(); +new C(), new f(), new a(); diff --git a/crates/swc/tests/tsc-references/invalidSwitchBreakStatement_es2015.2.minified.js b/crates/swc/tests/tsc-references/invalidSwitchBreakStatement_es2015.2.minified.js index 84be0c10c8e..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/invalidSwitchBreakStatement_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidSwitchBreakStatement_es2015.2.minified.js @@ -1,4 +0,0 @@ -switch(12){ - case 5: - break; -} diff --git a/crates/swc/tests/tsc-references/invalidSwitchBreakStatement_es5.2.minified.js b/crates/swc/tests/tsc-references/invalidSwitchBreakStatement_es5.2.minified.js index 84be0c10c8e..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/invalidSwitchBreakStatement_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidSwitchBreakStatement_es5.2.minified.js @@ -1,4 +0,0 @@ -switch(12){ - case 5: - break; -} diff --git a/crates/swc/tests/tsc-references/library-reference-8_es2015.2.minified.js b/crates/swc/tests/tsc-references/library-reference-8_es2015.2.minified.js index b9d8ed64500..1ce14938454 100644 --- a/crates/swc/tests/tsc-references/library-reference-8_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/library-reference-8_es2015.2.minified.js @@ -1 +1 @@ -alpha.a + beta.b; +alpha.a, beta.b; diff --git a/crates/swc/tests/tsc-references/library-reference-8_es5.2.minified.js b/crates/swc/tests/tsc-references/library-reference-8_es5.2.minified.js index b9d8ed64500..1ce14938454 100644 --- a/crates/swc/tests/tsc-references/library-reference-8_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/library-reference-8_es5.2.minified.js @@ -1 +1 @@ -alpha.a + beta.b; +alpha.a, beta.b; diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType_es2015.2.minified.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType_es2015.2.minified.js index d29c34dc3e5..25288857efb 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType_es2015.2.minified.js @@ -1,4 +1,4 @@ var ENUM; !function(ENUM) { ENUM[ENUM.A = 0] = "A", ENUM[ENUM.B = 1] = "B", ENUM[ENUM.C = 2] = "C"; -}(ENUM || (ENUM = {})), ENUM.B, ENUM.B + ENUM.C, ENUM.B + ENUM.C, ENUM.B; +}(ENUM || (ENUM = {})), ENUM.B, ENUM.B, ENUM.C, ENUM.B, ENUM.C, ENUM.B; diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType_es5.2.minified.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType_es5.2.minified.js index d29c34dc3e5..25288857efb 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType_es5.2.minified.js @@ -1,4 +1,4 @@ var ENUM; !function(ENUM) { ENUM[ENUM.A = 0] = "A", ENUM[ENUM.B = 1] = "B", ENUM[ENUM.C = 2] = "C"; -}(ENUM || (ENUM = {})), ENUM.B, ENUM.B + ENUM.C, ENUM.B + ENUM.C, ENUM.B; +}(ENUM || (ENUM = {})), ENUM.B, ENUM.B, ENUM.C, ENUM.B, ENUM.C, ENUM.B; diff --git a/crates/swc/tests/tsc-references/mixinClassesAnnotated_es2015.2.minified.js b/crates/swc/tests/tsc-references/mixinClassesAnnotated_es2015.2.minified.js index 2ceb449e956..5b3153c3d2f 100644 --- a/crates/swc/tests/tsc-references/mixinClassesAnnotated_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/mixinClassesAnnotated_es2015.2.minified.js @@ -19,7 +19,7 @@ Tagged(Derived); const Thing2 = Tagged(((superClass)=>{ class _class extends superClass { print() { - this.x + this.y; + this.x, this.y; } } return _class.message = "hello", _class; diff --git a/crates/swc/tests/tsc-references/mixinClassesAnnotated_es5.2.minified.js b/crates/swc/tests/tsc-references/mixinClassesAnnotated_es5.2.minified.js index 3b667ea8f42..03370317c1d 100644 --- a/crates/swc/tests/tsc-references/mixinClassesAnnotated_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/mixinClassesAnnotated_es5.2.minified.js @@ -36,7 +36,7 @@ var Thing2 = Tagged(((_class = function(superClass) { return swcHelpers.classCallCheck(this, _class), _super.apply(this, arguments); } return _class.prototype.print = function() { - this.x + this.y; + this.x, this.y; }, _class; }(Derived)).message = "hello", _class)); Thing2.message; diff --git a/crates/swc/tests/tsc-references/mixinClassesAnonymous_es2015.2.minified.js b/crates/swc/tests/tsc-references/mixinClassesAnonymous_es2015.2.minified.js index 2ceb449e956..5b3153c3d2f 100644 --- a/crates/swc/tests/tsc-references/mixinClassesAnonymous_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/mixinClassesAnonymous_es2015.2.minified.js @@ -19,7 +19,7 @@ Tagged(Derived); const Thing2 = Tagged(((superClass)=>{ class _class extends superClass { print() { - this.x + this.y; + this.x, this.y; } } return _class.message = "hello", _class; diff --git a/crates/swc/tests/tsc-references/mixinClassesAnonymous_es5.2.minified.js b/crates/swc/tests/tsc-references/mixinClassesAnonymous_es5.2.minified.js index 3b667ea8f42..03370317c1d 100644 --- a/crates/swc/tests/tsc-references/mixinClassesAnonymous_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/mixinClassesAnonymous_es5.2.minified.js @@ -36,7 +36,7 @@ var Thing2 = Tagged(((_class = function(superClass) { return swcHelpers.classCallCheck(this, _class), _super.apply(this, arguments); } return _class.prototype.print = function() { - this.x + this.y; + this.x, this.y; }, _class; }(Derived)).message = "hello", _class)); Thing2.message; diff --git a/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.2.minified.js b/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.2.minified.js index 5159bf895dc..2471ce71a3b 100644 --- a/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/nameWithRelativePaths_es2015.2.minified.js @@ -6,4 +6,4 @@ var M21; export { M21 as M2 }; M2 = M21 || (M21 = {}), M2.x = !0; const foo0 = require('../foo_0'), foo1 = require('./test/foo_1'), foo2 = require('./.././test/foo_2'); -foo2.M2.x && foo0.foo + foo1.f(); +foo2.M2.x && (foo0.foo, foo1.f()); diff --git a/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.2.minified.js b/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.2.minified.js index 9fae3c80258..b4189e0eec6 100644 --- a/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/nameWithRelativePaths_es5.2.minified.js @@ -6,4 +6,4 @@ var M21; export { M21 as M2 }; M2 = M21 || (M21 = {}), M2.x = !0; var foo0 = require("../foo_0"), foo1 = require("./test/foo_1"), foo2 = require("./.././test/foo_2"); -foo2.M2.x && foo0.foo + foo1.f(); +foo2.M2.x && (foo0.foo, foo1.f()); diff --git a/crates/swc/tests/tsc-references/negateOperatorWithEnumType_es2015.2.minified.js b/crates/swc/tests/tsc-references/negateOperatorWithEnumType_es2015.2.minified.js index 0d4e607cd1a..d005b67f335 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithEnumType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithEnumType_es2015.2.minified.js @@ -1,4 +1,4 @@ var ENUM1; !function(ENUM1) { ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ENUM1.B, ENUM1.B + ENUM1[""], ENUM1.B; +}(ENUM1 || (ENUM1 = {})), ENUM1.B, ENUM1.B, ENUM1[""], ENUM1.B; diff --git a/crates/swc/tests/tsc-references/negateOperatorWithEnumType_es5.2.minified.js b/crates/swc/tests/tsc-references/negateOperatorWithEnumType_es5.2.minified.js index 0d4e607cd1a..d005b67f335 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithEnumType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithEnumType_es5.2.minified.js @@ -1,4 +1,4 @@ var ENUM1; !function(ENUM1) { ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ENUM1.B, ENUM1.B + ENUM1[""], ENUM1.B; +}(ENUM1 || (ENUM1 = {})), ENUM1.B, ENUM1.B, ENUM1[""], ENUM1.B; diff --git a/crates/swc/tests/tsc-references/newOperatorConformance_es2015.2.minified.js b/crates/swc/tests/tsc-references/newOperatorConformance_es2015.2.minified.js index eecb6a96e81..95840ab982f 100644 --- a/crates/swc/tests/tsc-references/newOperatorConformance_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/newOperatorConformance_es2015.2.minified.js @@ -1,6 +1,6 @@ new class { }, new class { constructor(n){} -}, new anyCtor, new anyCtor1(void 0), new function() {}(); +}, new anyCtor, new anyCtor1(void 0); var anyCtor, anyCtor1, nested = new new new (void 0)()()(); new nested(), new nested(); diff --git a/crates/swc/tests/tsc-references/newOperatorConformance_es5.2.minified.js b/crates/swc/tests/tsc-references/newOperatorConformance_es5.2.minified.js index 2ca068853ff..2839500b5ab 100644 --- a/crates/swc/tests/tsc-references/newOperatorConformance_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/newOperatorConformance_es5.2.minified.js @@ -9,6 +9,6 @@ var anyCtor, anyCtor1, nestedCtor, C0 = function() { "use strict"; swcHelpers.classCallCheck(this, T); }; -new C0, new T, new anyCtor, new anyCtor1(void 0), new function() {}(); +new C0, new T, new anyCtor, new anyCtor1(void 0); var nested = new new new nestedCtor()()(); new nested(), new nested(); diff --git a/crates/swc/tests/tsc-references/newOperatorErrorCases_noImplicitAny_es2015.2.minified.js b/crates/swc/tests/tsc-references/newOperatorErrorCases_noImplicitAny_es2015.2.minified.js index 7ca5d5b5b13..72b6675ff80 100644 --- a/crates/swc/tests/tsc-references/newOperatorErrorCases_noImplicitAny_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/newOperatorErrorCases_noImplicitAny_es2015.2.minified.js @@ -1,3 +1,3 @@ new function() { return 90; -}(), new function() {}(), new function() {}(); +}(); diff --git a/crates/swc/tests/tsc-references/newOperatorErrorCases_noImplicitAny_es5.2.minified.js b/crates/swc/tests/tsc-references/newOperatorErrorCases_noImplicitAny_es5.2.minified.js index 7ca5d5b5b13..72b6675ff80 100644 --- a/crates/swc/tests/tsc-references/newOperatorErrorCases_noImplicitAny_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/newOperatorErrorCases_noImplicitAny_es5.2.minified.js @@ -1,3 +1,3 @@ new function() { return 90; -}(), new function() {}(), new function() {}(); +}(); diff --git a/crates/swc/tests/tsc-references/newWithSpreadES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/newWithSpreadES5_es2015.2.minified.js index bb704cc0e64..638e7adebd8 100644 --- a/crates/swc/tests/tsc-references/newWithSpreadES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/newWithSpreadES5_es2015.2.minified.js @@ -3,4 +3,4 @@ function f(x, y, ...z) {} class B { constructor(x, y, ...z){} } -new f(1, 2, "string"), new f(1, 2, ...a), new f(1, 2, ...a, "string"), new function(...x) {}(...a, ...a), new f(1, 2, ...a, ...a), new f(1, 2, "string")(), new f(1, 2, ...a)(), new f(1, 2, ...a, "string")(), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new d[1].f(1, 2, "string"), new d[1].f(1, 2, ...a), new d[1].f(1, 2, ...a, "string"), new e["a-b"].f(1, 2, "string"), new e["a-b"].f(1, 2, ...a), new e["a-b"].f(1, 2, ...a, "string"), new B(1, 2, "string"), new B(1, 2, ...a), new B(1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new g[1]["a-b"](1, 2, "string"), new g[1]["a-b"](1, 2, ...a), new g[1]["a-b"](1, 2, ...a, "string"), new h["a-b"]["a-b"](1, 2, "string"), new h["a-b"]["a-b"](1, 2, ...a), new h["a-b"]["a-b"](1, 2, ...a, "string"), new i["a-b"][1](1, 2, "string"), new i["a-b"][1](1, 2, ...a), new i["a-b"][1](1, 2, ...a, "string"); +new f(1, 2, "string"), new f(1, 2, ...a), new f(1, 2, ...a, "string"), new f(1, 2, ...a, ...a), new f(1, 2, "string")(), new f(1, 2, ...a)(), new f(1, 2, ...a, "string")(), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new d[1].f(1, 2, "string"), new d[1].f(1, 2, ...a), new d[1].f(1, 2, ...a, "string"), new e["a-b"].f(1, 2, "string"), new e["a-b"].f(1, 2, ...a), new e["a-b"].f(1, 2, ...a, "string"), new B(1, 2, "string"), new B(1, 2, ...a), new B(1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new g[1]["a-b"](1, 2, "string"), new g[1]["a-b"](1, 2, ...a), new g[1]["a-b"](1, 2, ...a, "string"), new h["a-b"]["a-b"](1, 2, "string"), new h["a-b"]["a-b"](1, 2, ...a), new h["a-b"]["a-b"](1, 2, ...a, "string"), new i["a-b"][1](1, 2, "string"), new i["a-b"][1](1, 2, ...a), new i["a-b"][1](1, 2, ...a, "string"); diff --git a/crates/swc/tests/tsc-references/newWithSpreadES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/newWithSpreadES6_es2015.2.minified.js index bb704cc0e64..638e7adebd8 100644 --- a/crates/swc/tests/tsc-references/newWithSpreadES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/newWithSpreadES6_es2015.2.minified.js @@ -3,4 +3,4 @@ function f(x, y, ...z) {} class B { constructor(x, y, ...z){} } -new f(1, 2, "string"), new f(1, 2, ...a), new f(1, 2, ...a, "string"), new function(...x) {}(...a, ...a), new f(1, 2, ...a, ...a), new f(1, 2, "string")(), new f(1, 2, ...a)(), new f(1, 2, ...a, "string")(), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new d[1].f(1, 2, "string"), new d[1].f(1, 2, ...a), new d[1].f(1, 2, ...a, "string"), new e["a-b"].f(1, 2, "string"), new e["a-b"].f(1, 2, ...a), new e["a-b"].f(1, 2, ...a, "string"), new B(1, 2, "string"), new B(1, 2, ...a), new B(1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new g[1]["a-b"](1, 2, "string"), new g[1]["a-b"](1, 2, ...a), new g[1]["a-b"](1, 2, ...a, "string"), new h["a-b"]["a-b"](1, 2, "string"), new h["a-b"]["a-b"](1, 2, ...a), new h["a-b"]["a-b"](1, 2, ...a, "string"), new i["a-b"][1](1, 2, "string"), new i["a-b"][1](1, 2, ...a), new i["a-b"][1](1, 2, ...a, "string"); +new f(1, 2, "string"), new f(1, 2, ...a), new f(1, 2, ...a, "string"), new f(1, 2, ...a, ...a), new f(1, 2, "string")(), new f(1, 2, ...a)(), new f(1, 2, ...a, "string")(), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new d[1].f(1, 2, "string"), new d[1].f(1, 2, ...a), new d[1].f(1, 2, ...a, "string"), new e["a-b"].f(1, 2, "string"), new e["a-b"].f(1, 2, ...a), new e["a-b"].f(1, 2, ...a, "string"), new B(1, 2, "string"), new B(1, 2, ...a), new B(1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new g[1]["a-b"](1, 2, "string"), new g[1]["a-b"](1, 2, ...a), new g[1]["a-b"](1, 2, ...a, "string"), new h["a-b"]["a-b"](1, 2, "string"), new h["a-b"]["a-b"](1, 2, ...a), new h["a-b"]["a-b"](1, 2, ...a, "string"), new i["a-b"][1](1, 2, "string"), new i["a-b"][1](1, 2, ...a), new i["a-b"][1](1, 2, ...a, "string"); diff --git a/crates/swc/tests/tsc-references/newWithSpread_es2015.2.minified.js b/crates/swc/tests/tsc-references/newWithSpread_es2015.2.minified.js index bb704cc0e64..638e7adebd8 100644 --- a/crates/swc/tests/tsc-references/newWithSpread_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/newWithSpread_es2015.2.minified.js @@ -3,4 +3,4 @@ function f(x, y, ...z) {} class B { constructor(x, y, ...z){} } -new f(1, 2, "string"), new f(1, 2, ...a), new f(1, 2, ...a, "string"), new function(...x) {}(...a, ...a), new f(1, 2, ...a, ...a), new f(1, 2, "string")(), new f(1, 2, ...a)(), new f(1, 2, ...a, "string")(), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new d[1].f(1, 2, "string"), new d[1].f(1, 2, ...a), new d[1].f(1, 2, ...a, "string"), new e["a-b"].f(1, 2, "string"), new e["a-b"].f(1, 2, ...a), new e["a-b"].f(1, 2, ...a, "string"), new B(1, 2, "string"), new B(1, 2, ...a), new B(1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new g[1]["a-b"](1, 2, "string"), new g[1]["a-b"](1, 2, ...a), new g[1]["a-b"](1, 2, ...a, "string"), new h["a-b"]["a-b"](1, 2, "string"), new h["a-b"]["a-b"](1, 2, ...a), new h["a-b"]["a-b"](1, 2, ...a, "string"), new i["a-b"][1](1, 2, "string"), new i["a-b"][1](1, 2, ...a), new i["a-b"][1](1, 2, ...a, "string"); +new f(1, 2, "string"), new f(1, 2, ...a), new f(1, 2, ...a, "string"), new f(1, 2, ...a, ...a), new f(1, 2, "string")(), new f(1, 2, ...a)(), new f(1, 2, ...a, "string")(), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new b.f(1, 2, "string"), new b.f(1, 2, ...a), new b.f(1, 2, ...a, "string"), new d[1].f(1, 2, "string"), new d[1].f(1, 2, ...a), new d[1].f(1, 2, ...a, "string"), new e["a-b"].f(1, 2, "string"), new e["a-b"].f(1, 2, ...a), new e["a-b"].f(1, 2, ...a, "string"), new B(1, 2, "string"), new B(1, 2, ...a), new B(1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new c["a-b"](1, 2, "string"), new c["a-b"](1, 2, ...a), new c["a-b"](1, 2, ...a, "string"), new g[1]["a-b"](1, 2, "string"), new g[1]["a-b"](1, 2, ...a), new g[1]["a-b"](1, 2, ...a, "string"), new h["a-b"]["a-b"](1, 2, "string"), new h["a-b"]["a-b"](1, 2, ...a), new h["a-b"]["a-b"](1, 2, ...a, "string"), new i["a-b"][1](1, 2, "string"), new i["a-b"][1](1, 2, ...a), new i["a-b"][1](1, 2, ...a, "string"); diff --git a/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined_es2015.2.minified.js b/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined_es2015.2.minified.js index 8602ad6550e..a37c015ff9f 100644 --- a/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined_es2015.2.minified.js @@ -1,6 +1,6 @@ var E; function f() {} -new Date(), function(E) { +!function(E) { E[E.A = 0] = "A"; }(E || (E = {})), E.A, (f || (f = {})).bar = 1; class c { diff --git a/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined_es5.2.minified.js b/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined_es5.2.minified.js index 14bce3d5162..b598d92799d 100644 --- a/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined_es5.2.minified.js @@ -1,5 +1,4 @@ import * as swcHelpers from "@swc/helpers"; -new Date(); var E, C1 = function() { "use strict"; swcHelpers.classCallCheck(this, C1); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2_es5.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2_es5.2.minified.js index 844170ca43e..f4435212916 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2_es5.2.minified.js @@ -1,6 +1,6 @@ var ref, ref1, a = function() {}; !function() { - arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null !== (ref = a()) && void 0 !== ref; + arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null !== (ref = a()) && ref; }(), function() { - arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null !== (ref1 = a()) && void 0 !== ref1, arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null !== (ref1 = a()) && ref1, arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; }(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer_es5.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer_es5.2.minified.js index f276fc19494..70a5f6c75e8 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer_es5.2.minified.js @@ -1,4 +1,4 @@ var ref, a = function() {}; !function() { - arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null !== (ref = a()) && void 0 !== ref; + arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null !== (ref = a()) && ref; }(); diff --git a/crates/swc/tests/tsc-references/objectRestCatchES5_es2015.2.minified.js b/crates/swc/tests/tsc-references/objectRestCatchES5_es2015.2.minified.js index 91d1651fd84..a885268f673 100644 --- a/crates/swc/tests/tsc-references/objectRestCatchES5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/objectRestCatchES5_es2015.2.minified.js @@ -1,7 +1 @@ import * as swcHelpers from "@swc/helpers"; -try {} catch (_param) { - var { a } = _param; - swcHelpers.objectWithoutProperties(_param, [ - "a" - ]); -} diff --git a/crates/swc/tests/tsc-references/objectRestCatchES5_es5.2.minified.js b/crates/swc/tests/tsc-references/objectRestCatchES5_es5.2.minified.js index 23949dd1384..a885268f673 100644 --- a/crates/swc/tests/tsc-references/objectRestCatchES5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/objectRestCatchES5_es5.2.minified.js @@ -1,6 +1 @@ import * as swcHelpers from "@swc/helpers"; -try {} catch (_param) { - _param.a, swcHelpers.objectWithoutProperties(_param, [ - "a" - ]); -} diff --git a/crates/swc/tests/tsc-references/parser768531_es2015.2.minified.js b/crates/swc/tests/tsc-references/parser768531_es2015.2.minified.js index cc4a15e6c2b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/parser768531_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parser768531_es2015.2.minified.js @@ -1 +0,0 @@ -a: ; diff --git a/crates/swc/tests/tsc-references/parser768531_es5.2.minified.js b/crates/swc/tests/tsc-references/parser768531_es5.2.minified.js index cc4a15e6c2b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/parser768531_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parser768531_es5.2.minified.js @@ -1 +0,0 @@ -a: ; diff --git a/crates/swc/tests/tsc-references/parserAdditiveExpression1_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserAdditiveExpression1_es2015.2.minified.js index 8a16cf86b29..ad7e612a478 100644 --- a/crates/swc/tests/tsc-references/parserAdditiveExpression1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserAdditiveExpression1_es2015.2.minified.js @@ -1 +1 @@ -m.index + m[0].length; +m.index, m[0].length; diff --git a/crates/swc/tests/tsc-references/parserAdditiveExpression1_es5.2.minified.js b/crates/swc/tests/tsc-references/parserAdditiveExpression1_es5.2.minified.js index 8a16cf86b29..ad7e612a478 100644 --- a/crates/swc/tests/tsc-references/parserAdditiveExpression1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserAdditiveExpression1_es5.2.minified.js @@ -1 +1 @@ -m.index + m[0].length; +m.index, m[0].length; diff --git a/crates/swc/tests/tsc-references/parserConstructorAmbiguity1_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserConstructorAmbiguity1_es2015.2.minified.js index 566ee9a774b..de6a6c7dc8f 100644 --- a/crates/swc/tests/tsc-references/parserConstructorAmbiguity1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserConstructorAmbiguity1_es2015.2.minified.js @@ -1 +1 @@ -new Date < A; +A; diff --git a/crates/swc/tests/tsc-references/parserConstructorAmbiguity1_es5.2.minified.js b/crates/swc/tests/tsc-references/parserConstructorAmbiguity1_es5.2.minified.js index 566ee9a774b..de6a6c7dc8f 100644 --- a/crates/swc/tests/tsc-references/parserConstructorAmbiguity1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserConstructorAmbiguity1_es5.2.minified.js @@ -1 +1 @@ -new Date < A; +A; diff --git a/crates/swc/tests/tsc-references/parserConstructorAmbiguity2_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserConstructorAmbiguity2_es2015.2.minified.js index 566ee9a774b..de6a6c7dc8f 100644 --- a/crates/swc/tests/tsc-references/parserConstructorAmbiguity2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserConstructorAmbiguity2_es2015.2.minified.js @@ -1 +1 @@ -new Date < A; +A; diff --git a/crates/swc/tests/tsc-references/parserConstructorAmbiguity2_es5.2.minified.js b/crates/swc/tests/tsc-references/parserConstructorAmbiguity2_es5.2.minified.js index 566ee9a774b..de6a6c7dc8f 100644 --- a/crates/swc/tests/tsc-references/parserConstructorAmbiguity2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserConstructorAmbiguity2_es5.2.minified.js @@ -1 +1 @@ -new Date < A; +A; diff --git a/crates/swc/tests/tsc-references/parserDoStatement2_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserDoStatement2_es2015.2.minified.js index da8d2228d40..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/parserDoStatement2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserDoStatement2_es2015.2.minified.js @@ -1,2 +0,0 @@ -do ; -while (!1) diff --git a/crates/swc/tests/tsc-references/parserDoStatement2_es5.2.minified.js b/crates/swc/tests/tsc-references/parserDoStatement2_es5.2.minified.js index 2a9cfa9744a..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/parserDoStatement2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserDoStatement2_es5.2.minified.js @@ -1,2 +0,0 @@ -do ; -while (!1); diff --git a/crates/swc/tests/tsc-references/parserRealSource8_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource8_es2015.2.minified.js index 1e79ed121fd..c8927a29e9e 100644 --- a/crates/swc/tests/tsc-references/parserRealSource8_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource8_es2015.2.minified.js @@ -102,14 +102,16 @@ var TypeScript; return ast && (ast.nodeType == NodeType.List ? ast.enclosingScope = context.scopeChain.scope : ast.nodeType == NodeType.ModuleDeclaration ? preAssignModuleScopes(ast, context) : ast.nodeType == NodeType.ClassDeclaration ? preAssignClassScopes(ast, context) : ast.nodeType == NodeType.InterfaceDeclaration ? preAssignInterfaceScopes(ast, context) : ast.nodeType == NodeType.With ? preAssignWithScopes(ast, context) : ast.nodeType == NodeType.FuncDecl ? preAssignFuncDeclScopes(ast, context) : ast.nodeType == NodeType.Catch ? preAssignCatchScopes(ast, context) : ast.nodeType == NodeType.TypeRef && (go = !1)), walker.options.goChildren = go, ast; }, TypeScript1.postAssignScopes = function(ast, parent, walker) { var context = walker.state, go = !0; - if (ast) if (ast.nodeType == NodeType.ModuleDeclaration) popAssignScope(context), context.modDeclChain.pop(), context.modDeclChain.length >= 1 && (context.typeFlow.checker.currentModDecl = context.modDeclChain[context.modDeclChain.length - 1]); - else if (ast.nodeType == NodeType.ClassDeclaration) popAssignScope(context); - else if (ast.nodeType == NodeType.InterfaceDeclaration) popAssignScope(context); - else if (ast.nodeType == NodeType.With) popAssignScope(context); - else if (ast.nodeType == NodeType.FuncDecl) { - var funcDecl = ast; - (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) && !funcDecl.isOverload && popAssignScope(context); - } else ast.nodeType == NodeType.Catch ? ast.param && popAssignScope(context) : go = !1; + if (ast) { + if (ast.nodeType == NodeType.ModuleDeclaration) popAssignScope(context), context.modDeclChain.pop(), context.modDeclChain.length >= 1 && (context.typeFlow.checker.currentModDecl = context.modDeclChain[context.modDeclChain.length - 1]); + else if (ast.nodeType == NodeType.ClassDeclaration) popAssignScope(context); + else if (ast.nodeType == NodeType.InterfaceDeclaration) popAssignScope(context); + else if (ast.nodeType == NodeType.With) popAssignScope(context); + else if (ast.nodeType == NodeType.FuncDecl) { + var funcDecl = ast; + (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) && !funcDecl.isOverload && popAssignScope(context); + } else ast.nodeType == NodeType.Catch ? ast.param && popAssignScope(context) : go = !1; + } return walker.options.goChildren = go, ast; }; }(TypeScript || (TypeScript = {})); diff --git a/crates/swc/tests/tsc-references/parserRealSource8_es5.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource8_es5.2.minified.js index 0adf97f257d..dd67f0ec9c5 100644 --- a/crates/swc/tests/tsc-references/parserRealSource8_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource8_es5.2.minified.js @@ -77,14 +77,16 @@ import * as swcHelpers from "@swc/helpers"; return ast && (ast.nodeType == NodeType.List ? ast.enclosingScope = context.scopeChain.scope : ast.nodeType == NodeType.ModuleDeclaration ? preAssignModuleScopes(ast, context) : ast.nodeType == NodeType.ClassDeclaration ? preAssignClassScopes(ast, context) : ast.nodeType == NodeType.InterfaceDeclaration ? preAssignInterfaceScopes(ast, context) : ast.nodeType == NodeType.With ? preAssignWithScopes(ast, context) : ast.nodeType == NodeType.FuncDecl ? preAssignFuncDeclScopes(ast, context) : ast.nodeType == NodeType.Catch ? preAssignCatchScopes(ast, context) : ast.nodeType == NodeType.TypeRef && (go = !1)), walker.options.goChildren = go, ast; }, postAssignScopes = function(ast, parent, walker) { var context = walker.state, go = !0; - if (ast) if (ast.nodeType == NodeType.ModuleDeclaration) popAssignScope(context), context.modDeclChain.pop(), context.modDeclChain.length >= 1 && (context.typeFlow.checker.currentModDecl = context.modDeclChain[context.modDeclChain.length - 1]); - else if (ast.nodeType == NodeType.ClassDeclaration) popAssignScope(context); - else if (ast.nodeType == NodeType.InterfaceDeclaration) popAssignScope(context); - else if (ast.nodeType == NodeType.With) popAssignScope(context); - else if (ast.nodeType == NodeType.FuncDecl) { - var funcDecl = ast; - (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) && !funcDecl.isOverload && popAssignScope(context); - } else ast.nodeType == NodeType.Catch ? ast.param && popAssignScope(context) : go = !1; + if (ast) { + if (ast.nodeType == NodeType.ModuleDeclaration) popAssignScope(context), context.modDeclChain.pop(), context.modDeclChain.length >= 1 && (context.typeFlow.checker.currentModDecl = context.modDeclChain[context.modDeclChain.length - 1]); + else if (ast.nodeType == NodeType.ClassDeclaration) popAssignScope(context); + else if (ast.nodeType == NodeType.InterfaceDeclaration) popAssignScope(context); + else if (ast.nodeType == NodeType.With) popAssignScope(context); + else if (ast.nodeType == NodeType.FuncDecl) { + var funcDecl = ast; + (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) && !funcDecl.isOverload && popAssignScope(context); + } else ast.nodeType == NodeType.Catch ? ast.param && popAssignScope(context) : go = !1; + } return walker.options.goChildren = go, ast; }, AssignScopeContext = function(scopeChain, typeFlow, modDeclChain) { "use strict"; diff --git a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity1_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity1_es2015.2.minified.js index 76a2cf56717..cf366638368 100644 --- a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity1_es2015.2.minified.js @@ -1 +1 @@ -notregexp / a.foo(); +a.foo(); diff --git a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity1_es5.2.minified.js b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity1_es5.2.minified.js index 76a2cf56717..cf366638368 100644 --- a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity1_es5.2.minified.js @@ -1 +1 @@ -notregexp / a.foo(); +a.foo(); diff --git a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity2_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity2_es2015.2.minified.js index 76a2cf56717..cf366638368 100644 --- a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity2_es2015.2.minified.js @@ -1 +1 @@ -notregexp / a.foo(); +a.foo(); diff --git a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity2_es5.2.minified.js b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity2_es5.2.minified.js index 76a2cf56717..cf366638368 100644 --- a/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRegularExpressionDivideAmbiguity2_es5.2.minified.js @@ -1 +1 @@ -notregexp / a.foo(); +a.foo(); diff --git a/crates/swc/tests/tsc-references/parserSbp_7.9_A9_T3_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserSbp_7.9_A9_T3_es2015.2.minified.js index da8d2228d40..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/parserSbp_7.9_A9_T3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserSbp_7.9_A9_T3_es2015.2.minified.js @@ -1,2 +0,0 @@ -do ; -while (!1) diff --git a/crates/swc/tests/tsc-references/parserSbp_7.9_A9_T3_es5.2.minified.js b/crates/swc/tests/tsc-references/parserSbp_7.9_A9_T3_es5.2.minified.js index 2a9cfa9744a..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/parserSbp_7.9_A9_T3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserSbp_7.9_A9_T3_es5.2.minified.js @@ -1,2 +0,0 @@ -do ; -while (!1); diff --git a/crates/swc/tests/tsc-references/parser_breakTarget4_es2015.2.minified.js b/crates/swc/tests/tsc-references/parser_breakTarget4_es2015.2.minified.js index b9f91d54c69..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/parser_breakTarget4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parser_breakTarget4_es2015.2.minified.js @@ -1 +0,0 @@ -target1: ; diff --git a/crates/swc/tests/tsc-references/parser_breakTarget4_es5.2.minified.js b/crates/swc/tests/tsc-references/parser_breakTarget4_es5.2.minified.js index b9f91d54c69..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/parser_breakTarget4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parser_breakTarget4_es5.2.minified.js @@ -1 +0,0 @@ -target1: ; diff --git a/crates/swc/tests/tsc-references/parserindenter_es2015.2.minified.js b/crates/swc/tests/tsc-references/parserindenter_es2015.2.minified.js index f1239a4e61f..06d2fe6c1fb 100644 --- a/crates/swc/tests/tsc-references/parserindenter_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/parserindenter_es2015.2.minified.js @@ -12,8 +12,7 @@ var Formatting; } GetIndentationEditsWorker(token, nextToken, node, sameLineIndent) { var result = new List_TextEditInfo(), indentationInfo = null; - if (this.AdjustStartOffsetIfNeeded(token, node), this.scriptBlockBeginLineNumber == token.lineNumber()) return result; - if (!sameLineIndent && this.IsMultiLineString(token)) return result; + if (this.AdjustStartOffsetIfNeeded(token, node), this.scriptBlockBeginLineNumber == token.lineNumber() || !sameLineIndent && this.IsMultiLineString(token)) return result; if (null == (indentationInfo = this.GetSpecialCaseIndentation(token, node))) { for(; !node.CanIndent() && null != node.Parent && token.Span.span.start() == node.Parent.AuthorNode.Details.StartOffset;)node = node.Parent; indentationInfo = node.CanIndent() && token.Span.span.start() == node.AuthorNode.Details.StartOffset ? node.GetEffectiveIndentation(this) : token.Token == AuthorTokenKind.atkIdentifier && null != nextToken && nextToken.Token == AuthorTokenKind.atkColon ? node.GetEffectiveChildrenIndentation(this) : this.ApplyIndentationDeltaFromParent(token, node); @@ -193,17 +192,19 @@ var Formatting; } FillInheritedIndentation(tree) { var offset = -1, indentNode = null; - if (null != tree.StartNodeSelf) if (this.smartIndent || null === tree.StartNodePreviousSibling || 0 != tree.StartNodeSelf.AuthorNode.Label || 0 != tree.StartNodePreviousSibling.Label) { - if (this.smartIndent) for(parent = tree.StartNodeSelf; null != parent && parent.AuthorNode.Details.StartOffset == this.firstToken.Span.startPosition();)parent = parent.Parent; - else { - var startNodeLineNumber = this.snapshot.GetLineNumberFromPosition(tree.StartNodeSelf.AuthorNode.Details.StartOffset); - for(parent = tree.StartNodeSelf.Parent; null != parent && startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset);)parent = parent.Parent; + if (null != tree.StartNodeSelf) { + if (this.smartIndent || null === tree.StartNodePreviousSibling || 0 != tree.StartNodeSelf.AuthorNode.Label || 0 != tree.StartNodePreviousSibling.Label) { + if (this.smartIndent) for(parent = tree.StartNodeSelf; null != parent && parent.AuthorNode.Details.StartOffset == this.firstToken.Span.startPosition();)parent = parent.Parent; + else { + var startNodeLineNumber = this.snapshot.GetLineNumberFromPosition(tree.StartNodeSelf.AuthorNode.Details.StartOffset); + for(parent = tree.StartNodeSelf.Parent; null != parent && startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset);)parent = parent.Parent; + } + for(; null != parent && !parent.CanIndent();)parent = parent.Parent; + null != parent && parent.AuthorNode.Details.Kind != AuthorParseNodeKind.apnkProg && (offset = parent.AuthorNode.Details.StartOffset, indentNode = parent); + } else { + indentNode = tree.StartNodeSelf, offset = tree.StartNodePreviousSibling.Details.StartOffset; + for(var parent, lineNum = this.snapshot.GetLineNumberFromPosition(offset), node = indentNode; null != node.Parent && this.snapshot.GetLineNumberFromPosition(node.Parent.AuthorNode.Details.StartOffset) == lineNum;)(node = node.Parent).CanIndent() && ((indentNode = node).IndentationDelta = 0); } - for(; null != parent && !parent.CanIndent();)parent = parent.Parent; - null != parent && parent.AuthorNode.Details.Kind != AuthorParseNodeKind.apnkProg && (offset = parent.AuthorNode.Details.StartOffset, indentNode = parent); - } else { - indentNode = tree.StartNodeSelf, offset = tree.StartNodePreviousSibling.Details.StartOffset; - for(var parent, lineNum = this.snapshot.GetLineNumberFromPosition(offset), node = indentNode; null != node.Parent && this.snapshot.GetLineNumberFromPosition(node.Parent.AuthorNode.Details.StartOffset) == lineNum;)(node = node.Parent).CanIndent() && ((indentNode = node).IndentationDelta = 0); } if (null != indentNode) { var indentOverride = this.GetLineIndentationForOffset(offset); @@ -218,9 +219,8 @@ var Formatting; } } GetLineIndentationForOffset(offset) { - var indentationEdit; if (null != (indentationEdit = this.indentationBag.FindIndent(offset))) return indentationEdit.Indentation(); - for(var lineText = this.snapshot.GetLineFromPosition(offset).getText(), index = 0; index < lineText.length && (' ' == lineText.charAt(index) || '\t' == lineText.charAt(index));)++index; + for(var indentationEdit, lineText = this.snapshot.GetLineFromPosition(offset).getText(), index = 0; index < lineText.length && (' ' == lineText.charAt(index) || '\t' == lineText.charAt(index));)++index; return lineText.substr(0, index); } RegisterIndentation(indent, sameLineIndent) { diff --git a/crates/swc/tests/tsc-references/parserindenter_es5.2.minified.js b/crates/swc/tests/tsc-references/parserindenter_es5.2.minified.js index d04cb36a37b..f09d71a5079 100644 --- a/crates/swc/tests/tsc-references/parserindenter_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserindenter_es5.2.minified.js @@ -17,8 +17,7 @@ import * as swcHelpers from "@swc/helpers"; return result; }, _proto.GetIndentationEditsWorker = function(token, nextToken, node, sameLineIndent) { var result = new List_TextEditInfo(), indentationInfo = null; - if (this.AdjustStartOffsetIfNeeded(token, node), this.scriptBlockBeginLineNumber == token.lineNumber()) return result; - if (!sameLineIndent && this.IsMultiLineString(token)) return result; + if (this.AdjustStartOffsetIfNeeded(token, node), this.scriptBlockBeginLineNumber == token.lineNumber() || !sameLineIndent && this.IsMultiLineString(token)) return result; if (null == (indentationInfo = this.GetSpecialCaseIndentation(token, node))) { for(; !node.CanIndent() && null != node.Parent && token.Span.span.start() == node.Parent.AuthorNode.Details.StartOffset;)node = node.Parent; indentationInfo = node.CanIndent() && token.Span.span.start() == node.AuthorNode.Details.StartOffset ? node.GetEffectiveIndentation(this) : token.Token == AuthorTokenKind.atkIdentifier && null != nextToken && nextToken.Token == AuthorTokenKind.atkColon ? node.GetEffectiveChildrenIndentation(this) : this.ApplyIndentationDeltaFromParent(token, node); @@ -170,17 +169,19 @@ import * as swcHelpers from "@swc/helpers"; return indentationDeltaSize; }, _proto.FillInheritedIndentation = function(tree) { var offset = -1, indentNode = null; - if (null != tree.StartNodeSelf) if (this.smartIndent || null === tree.StartNodePreviousSibling || 0 != tree.StartNodeSelf.AuthorNode.Label || 0 != tree.StartNodePreviousSibling.Label) { - if (this.smartIndent) for(parent = tree.StartNodeSelf; null != parent && parent.AuthorNode.Details.StartOffset == this.firstToken.Span.startPosition();)parent = parent.Parent; - else { - var startNodeLineNumber = this.snapshot.GetLineNumberFromPosition(tree.StartNodeSelf.AuthorNode.Details.StartOffset); - for(parent = tree.StartNodeSelf.Parent; null != parent && startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset);)parent = parent.Parent; + if (null != tree.StartNodeSelf) { + if (this.smartIndent || null === tree.StartNodePreviousSibling || 0 != tree.StartNodeSelf.AuthorNode.Label || 0 != tree.StartNodePreviousSibling.Label) { + if (this.smartIndent) for(parent = tree.StartNodeSelf; null != parent && parent.AuthorNode.Details.StartOffset == this.firstToken.Span.startPosition();)parent = parent.Parent; + else { + var startNodeLineNumber = this.snapshot.GetLineNumberFromPosition(tree.StartNodeSelf.AuthorNode.Details.StartOffset); + for(parent = tree.StartNodeSelf.Parent; null != parent && startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset);)parent = parent.Parent; + } + for(; null != parent && !parent.CanIndent();)parent = parent.Parent; + null != parent && parent.AuthorNode.Details.Kind != AuthorParseNodeKind.apnkProg && (offset = parent.AuthorNode.Details.StartOffset, indentNode = parent); + } else { + indentNode = tree.StartNodeSelf, offset = tree.StartNodePreviousSibling.Details.StartOffset; + for(var parent, lineNum = this.snapshot.GetLineNumberFromPosition(offset), node = indentNode; null != node.Parent && this.snapshot.GetLineNumberFromPosition(node.Parent.AuthorNode.Details.StartOffset) == lineNum;)(node = node.Parent).CanIndent() && ((indentNode = node).IndentationDelta = 0); } - for(; null != parent && !parent.CanIndent();)parent = parent.Parent; - null != parent && parent.AuthorNode.Details.Kind != AuthorParseNodeKind.apnkProg && (offset = parent.AuthorNode.Details.StartOffset, indentNode = parent); - } else { - indentNode = tree.StartNodeSelf, offset = tree.StartNodePreviousSibling.Details.StartOffset; - for(var parent, lineNum = this.snapshot.GetLineNumberFromPosition(offset), node = indentNode; null != node.Parent && this.snapshot.GetLineNumberFromPosition(node.Parent.AuthorNode.Details.StartOffset) == lineNum;)(node = node.Parent).CanIndent() && ((indentNode = node).IndentationDelta = 0); } if (null != indentNode) { var indentOverride = this.GetLineIndentationForOffset(offset); @@ -194,9 +195,8 @@ import * as swcHelpers from "@swc/helpers"; }while (null != indentNode); } }, _proto.GetLineIndentationForOffset = function(offset) { - var indentationEdit; if (null != (indentationEdit = this.indentationBag.FindIndent(offset))) return indentationEdit.Indentation(); - for(var lineText = this.snapshot.GetLineFromPosition(offset).getText(), index = 0; index < lineText.length && (" " == lineText.charAt(index) || " " == lineText.charAt(index));)++index; + for(var indentationEdit, lineText = this.snapshot.GetLineFromPosition(offset).getText(), index = 0; index < lineText.length && (" " == lineText.charAt(index) || " " == lineText.charAt(index));)++index; return lineText.substr(0, index); }, _proto.RegisterIndentation = function(indent, sameLineIndent) { var indentationInfo = null; diff --git a/crates/swc/tests/tsc-references/plusOperatorWithEnumType_es2015.2.minified.js b/crates/swc/tests/tsc-references/plusOperatorWithEnumType_es2015.2.minified.js index 522fe8e5b9d..c644a12a3fb 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithEnumType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithEnumType_es2015.2.minified.js @@ -1,4 +1,4 @@ var ENUM, ENUM1; !function(ENUM1) { ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM[0] + ENUM1.B, ENUM1.B; +}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM[0], ENUM1.B, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/plusOperatorWithEnumType_es5.2.minified.js b/crates/swc/tests/tsc-references/plusOperatorWithEnumType_es5.2.minified.js index 522fe8e5b9d..c644a12a3fb 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithEnumType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithEnumType_es5.2.minified.js @@ -1,4 +1,4 @@ var ENUM, ENUM1; !function(ENUM1) { ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM[0] + ENUM1.B, ENUM1.B; +}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM[0], ENUM1.B, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead_es2015.2.minified.js b/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead_es2015.2.minified.js index db7bf001df0..31959f0b45f 100644 --- a/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead_es2015.2.minified.js @@ -20,7 +20,7 @@ new class { foo }), _tmp1 = { foo - }, swcHelpers.classPrivateFieldGet(this, _value).foo = swcHelpers.extends({}, _tmp1.foo), ({ foo: {} , } = _tmp1), swcHelpers.classPrivateFieldGet(this, _value), [swcHelpers.classPrivateFieldDestructureSet(this, _valueOne).value, ...swcHelpers.classPrivateFieldDestructureSet(this, _valueRest).value] = [ + }, swcHelpers.classPrivateFieldGet(this, _value).foo = swcHelpers.extends({}, _tmp1.foo), swcHelpers.classPrivateFieldGet(this, _value), [swcHelpers.classPrivateFieldDestructureSet(this, _valueOne).value, ...swcHelpers.classPrivateFieldDestructureSet(this, _valueRest).value] = [ 1, 2, 3 diff --git a/crates/swc/tests/tsc-references/scannerAdditiveExpression1_es2015.2.minified.js b/crates/swc/tests/tsc-references/scannerAdditiveExpression1_es2015.2.minified.js index 8a16cf86b29..ad7e612a478 100644 --- a/crates/swc/tests/tsc-references/scannerAdditiveExpression1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/scannerAdditiveExpression1_es2015.2.minified.js @@ -1 +1 @@ -m.index + m[0].length; +m.index, m[0].length; diff --git a/crates/swc/tests/tsc-references/scannerAdditiveExpression1_es5.2.minified.js b/crates/swc/tests/tsc-references/scannerAdditiveExpression1_es5.2.minified.js index 8a16cf86b29..ad7e612a478 100644 --- a/crates/swc/tests/tsc-references/scannerAdditiveExpression1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/scannerAdditiveExpression1_es5.2.minified.js @@ -1 +1 @@ -m.index + m[0].length; +m.index, m[0].length; diff --git a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements01_es2015.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements01_es2015.2.minified.js index aef19056644..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements01_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements01_es2015.2.minified.js @@ -1,9 +0,0 @@ -let x, y; -switch(x){ - case "foo": - break; - case "bar": - break; - case y: - break; -} diff --git a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements01_es5.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements01_es5.2.minified.js index cdb0b88ee1c..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements01_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements01_es5.2.minified.js @@ -1,9 +0,0 @@ -var x, y; -switch(x){ - case "foo": - break; - case "bar": - break; - case y: - break; -} diff --git a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements03_es2015.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements03_es2015.2.minified.js index 921d7fe7c7b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements03_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements03_es2015.2.minified.js @@ -1,18 +0,0 @@ -let x, z; -switch(x){ - case randBool() ? "foo" : "baz": - break; - case randBool(), "bar": - break; - case "bar": - break; - case "baz": - break; - case "foo": - break; - case "bar": - break; - case z || "baz": - case "baz": - break; -} diff --git a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements03_es5.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements03_es5.2.minified.js index 2191cbf5445..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements03_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements03_es5.2.minified.js @@ -1,18 +0,0 @@ -var x, z; -switch(x){ - case randBool() ? "foo" : "baz": - break; - case randBool(), "bar": - break; - case "bar": - break; - case "baz": - break; - case "foo": - break; - case "bar": - break; - case z || "baz": - case "baz": - break; -} diff --git a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements04_es2015.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements04_es2015.2.minified.js index 606050802eb..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements04_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements04_es2015.2.minified.js @@ -1,17 +0,0 @@ -let x, y; -switch(y){ - case x: - break; - case "foo": - break; - case "baz": - break; - case x: - break; - case "bar": - break; - case "foo": - break; - case "baz": - break; -} diff --git a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements04_es5.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements04_es5.2.minified.js index b564022a30b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements04_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralsWithSwitchStatements04_es5.2.minified.js @@ -1,17 +0,0 @@ -var x, y; -switch(y){ - case x: - break; - case "foo": - break; - case "baz": - break; - case x: - break; - case "bar": - break; - case "foo": - break; - case "baz": - break; -} diff --git a/crates/swc/tests/tsc-references/switchBreakStatements_es2015.2.minified.js b/crates/swc/tests/tsc-references/switchBreakStatements_es2015.2.minified.js index 777e698695d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/switchBreakStatements_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/switchBreakStatements_es2015.2.minified.js @@ -1,36 +0,0 @@ -switch(''){ - case 'a': - break; -} -ONE: switch(''){ - case 'a': - break ONE; -} -TWO: THREE: switch(''){ - case 'a': - break THREE; -} -FOUR: switch(''){ - case 'a': - FIVE: switch(''){ - case 'a': - break FOUR; - } -} -switch(''){ - case 'a': - SIX: switch(''){ - case 'a': - break SIX; - } -} -SEVEN: switch(''){ - case 'a': - switch(''){ - case 'a': - switch(''){ - case 'a': - break SEVEN; - } - } -} diff --git a/crates/swc/tests/tsc-references/switchBreakStatements_es5.2.minified.js b/crates/swc/tests/tsc-references/switchBreakStatements_es5.2.minified.js index 21606b6b8f8..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/switchBreakStatements_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/switchBreakStatements_es5.2.minified.js @@ -1,36 +0,0 @@ -switch(""){ - case "a": - break; -} -ONE: switch(""){ - case "a": - break ONE; -} -TWO: THREE: switch(""){ - case "a": - break THREE; -} -FOUR: switch(""){ - case "a": - FIVE: switch(""){ - case "a": - break FOUR; - } -} -switch(""){ - case "a": - SIX: switch(""){ - case "a": - break SIX; - } -} -SEVEN: switch(""){ - case "a": - switch(""){ - case "a": - switch(""){ - case "a": - break SEVEN; - } - } -} diff --git a/crates/swc/tests/tsc-references/switchCaseWithIntersectionTypes01_es2015.2.minified.js b/crates/swc/tests/tsc-references/switchCaseWithIntersectionTypes01_es2015.2.minified.js index a7c5898dde3..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/switchCaseWithIntersectionTypes01_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/switchCaseWithIntersectionTypes01_es2015.2.minified.js @@ -1,12 +0,0 @@ -var strAndNum, numAndBool, str, num, bool; -switch(strAndNum){ - case strAndNum: - break; - case str: - case num: - break; - case numAndBool: - break; - case bool: - break; -} diff --git a/crates/swc/tests/tsc-references/switchCaseWithIntersectionTypes01_es5.2.minified.js b/crates/swc/tests/tsc-references/switchCaseWithIntersectionTypes01_es5.2.minified.js index a7c5898dde3..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/switchCaseWithIntersectionTypes01_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/switchCaseWithIntersectionTypes01_es5.2.minified.js @@ -1,12 +0,0 @@ -var strAndNum, numAndBool, str, num, bool; -switch(strAndNum){ - case strAndNum: - break; - case str: - case num: - break; - case numAndBool: - break; - case bool: - break; -} diff --git a/crates/swc/tests/tsc-references/switchCaseWithUnionTypes01_es2015.2.minified.js b/crates/swc/tests/tsc-references/switchCaseWithUnionTypes01_es2015.2.minified.js index 386bf2d151f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/switchCaseWithUnionTypes01_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/switchCaseWithUnionTypes01_es2015.2.minified.js @@ -1,12 +0,0 @@ -var strOrNum, numOrBool, str, num, bool; -switch(strOrNum){ - case strOrNum: - break; - case str: - case num: - break; - case numOrBool: - break; - case bool: - break; -} diff --git a/crates/swc/tests/tsc-references/switchCaseWithUnionTypes01_es5.2.minified.js b/crates/swc/tests/tsc-references/switchCaseWithUnionTypes01_es5.2.minified.js index 386bf2d151f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/switchCaseWithUnionTypes01_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/switchCaseWithUnionTypes01_es5.2.minified.js @@ -1,12 +0,0 @@ -var strOrNum, numOrBool, str, num, bool; -switch(strOrNum){ - case strOrNum: - break; - case str: - case num: - break; - case numOrBool: - break; - case bool: - break; -} diff --git a/crates/swc/tests/tsc-references/switchStatements_es2015.2.minified.js b/crates/swc/tests/tsc-references/switchStatements_es2015.2.minified.js index bfee3ae5fbb..02337d66416 100644 --- a/crates/swc/tests/tsc-references/switchStatements_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/switchStatements_es2015.2.minified.js @@ -1,75 +1,8 @@ -var M, x; -switch(!function(M1) { +var M; +!function(M1) { function fn(x) { return ''; } M1.fn = fn; -}(M || (M = {})), x){ - case '': - case 12: - case !0: - case null: - case void 0: - case new Date(12): - case new Object(): - case /[a-z]/: - case []: - case {}: - case { - id: 12 - }: - case [ - 'a' - ]: - case typeof x: - case typeof M: - case M.fn(1): - case (x)=>'' - : - case '': - default: -} -class C { -} -switch(new C()){ - case new class extends C { - }(): - case { - id: 12, - name: '' - }: - case new C(): -} -switch(''){ -} -switch(12){ -} -switch(!0){ -} -switch(null){ -} -switch(void 0){ -} -switch(new Date(12)){ -} -switch(new Object()){ -} -switch(/[a-z]/){ -} -switch([]){ -} -switch({}){ -} -switch({ - id: 12 -}){ -} -switch([ - 'a' -]){ -} -switch((x)=>'' -){ -} -switch(''){ -} +}(M || (M = {})), new class { +}(), new Object(); diff --git a/crates/swc/tests/tsc-references/switchStatements_es5.2.minified.js b/crates/swc/tests/tsc-references/switchStatements_es5.2.minified.js index 7fb4dfbaf1c..a463698f4be 100644 --- a/crates/swc/tests/tsc-references/switchStatements_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/switchStatements_es5.2.minified.js @@ -1,33 +1,8 @@ import * as swcHelpers from "@swc/helpers"; -switch((M || (M = {})).fn = function(x) { +(M || (M = {})).fn = function(x) { return ""; -}, x){ - case "": - case 12: - case !0: - case null: - case void 0: - case new Date(12): - case new Object(): - case /[a-z]/: - case []: - case {}: - case { - id: 12 - }: - case [ - "a" - ]: - case void 0 === x ? "undefined" : swcHelpers.typeOf(x): - case void 0 === M ? "undefined" : swcHelpers.typeOf(M): - case M.fn(1): - case function(x) { - return ""; - }: - case "": - default: -} -var M, x, C = function() { +}; +var M, C = function() { "use strict"; swcHelpers.classCallCheck(this, C); }, D = function(C1) { @@ -39,45 +14,4 @@ var M, x, C = function() { } return D; }(C); -switch(new C()){ - case new D(): - case { - id: 12, - name: "" - }: - case new C(): -} -switch(""){ -} -switch(12){ -} -switch(!0){ -} -switch(null){ -} -switch(void 0){ -} -switch(new Date(12)){ -} -switch(new Object()){ -} -switch(/[a-z]/){ -} -switch([]){ -} -switch({}){ -} -switch({ - id: 12 -}){ -} -switch([ - "a" -]){ -} -switch(function(x) { - return ""; -}){ -} -switch(""){ -} +new C(), new Object(); diff --git a/crates/swc/tests/tsc-references/symbolType17_es2015.2.minified.js b/crates/swc/tests/tsc-references/symbolType17_es2015.2.minified.js new file mode 100644 index 00000000000..fc87ba0e20a --- /dev/null +++ b/crates/swc/tests/tsc-references/symbolType17_es2015.2.minified.js @@ -0,0 +1 @@ +"symbol"; diff --git a/crates/swc/tests/tsc-references/symbolType18_es2015.2.minified.js b/crates/swc/tests/tsc-references/symbolType18_es2015.2.minified.js new file mode 100644 index 00000000000..a1502b31ed2 --- /dev/null +++ b/crates/swc/tests/tsc-references/symbolType18_es2015.2.minified.js @@ -0,0 +1 @@ +"object"; diff --git a/crates/swc/tests/tsc-references/symbolType18_es5.2.minified.js b/crates/swc/tests/tsc-references/symbolType18_es5.2.minified.js new file mode 100644 index 00000000000..a1502b31ed2 --- /dev/null +++ b/crates/swc/tests/tsc-references/symbolType18_es5.2.minified.js @@ -0,0 +1 @@ +"object"; diff --git a/crates/swc/tests/tsc-references/symbolType19_es2015.2.minified.js b/crates/swc/tests/tsc-references/symbolType19_es2015.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/symbolType19_es5.2.minified.js b/crates/swc/tests/tsc-references/symbolType19_es5.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/symbolType1_es2015.2.minified.js b/crates/swc/tests/tsc-references/symbolType1_es2015.2.minified.js index 22c88ed07f1..cf12c2cf5b3 100644 --- a/crates/swc/tests/tsc-references/symbolType1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolType1_es2015.2.minified.js @@ -1 +1 @@ -Symbol() instanceof Symbol, Symbol instanceof Symbol(), (Symbol() || {}) instanceof Object, Symbol instanceof (Symbol() || {}); +Symbol(), Symbol(), Symbol(), Symbol(); diff --git a/crates/swc/tests/tsc-references/symbolType2_es2015.2.minified.js b/crates/swc/tests/tsc-references/symbolType2_es2015.2.minified.js index d027b307fef..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/symbolType2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolType2_es2015.2.minified.js @@ -1 +0,0 @@ -Symbol.isConcatSpreadable in {}, "" in Symbol.toPrimitive; diff --git a/crates/swc/tests/tsc-references/symbolType2_es5.2.minified.js b/crates/swc/tests/tsc-references/symbolType2_es5.2.minified.js index d027b307fef..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/symbolType2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolType2_es5.2.minified.js @@ -1 +0,0 @@ -Symbol.isConcatSpreadable in {}, "" in Symbol.toPrimitive; diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6_es2015.2.minified.js index 1ea1a57ab8e..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6_es2015.2.minified.js @@ -1 +0,0 @@ -(function(...x) {})`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n`; diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_es2015.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_es2015.2.minified.js index 1ea1a57ab8e..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_es2015.2.minified.js @@ -1 +0,0 @@ -(function(...x) {})`0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2028 2029 0085 t v f b r n`; diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6_es2015.2.minified.js index 59c9362db12..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6_es2015.2.minified.js @@ -1 +0,0 @@ -(function(...x) {})`0${" "}1${" "}2${" "}3${" "}4${" "}5${" "}6${" "}7${" "}8${" "}9${" "}10${" "}11${" "}12${" "}13${" "}14${" "}15${" "}16${" "}17${" "}18${" "}19${" "}20${" "}2028${" "}2029${" "}0085${" "}t${" "}v${" "}f${" "}b${" "}r${" "}n`; diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInferenceES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInferenceES6_es2015.2.minified.js index cdb40717dab..d5f467baaeb 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInferenceES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInferenceES6_es2015.2.minified.js @@ -10,9 +10,7 @@ function someGenerics8(strs, n) { function someGenerics9(strs, a, b, c) { return null; } -(function(n) {})``, (function(n) {})``, (function(n, m) {})`${3}`, (function(n, m) {})`${3}`, (function(strs, n) {})`${(n)=>n -}`, (function(strs, n) {})`${(n, x)=>n -}`, someGenerics3`${()=>'' +someGenerics3`${()=>'' }`, someGenerics3`${()=>void 0 }`, someGenerics3`${()=>3 }`, someGenerics4`${4}${()=>null diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInferenceES6_es5.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInferenceES6_es5.2.minified.js index acb38d2197a..1972e07d92b 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInferenceES6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInferenceES6_es5.2.minified.js @@ -252,9 +252,7 @@ function someGenerics6(strs, a, b, c) {} function someGenerics7(strs, a, b, c) {} !function(strs, n) {}(_templateObject(), function(n) { return n; -}), function(strs, n) {}(_templateObject1(), function(n, x) { - return n; -}), someGenerics3(_templateObject2(), function() { +}), _templateObject1(), someGenerics3(_templateObject2(), function() { return ""; }), someGenerics3(_templateObject3(), function() {}), someGenerics3(_templateObject4(), function() { return 3; @@ -302,4 +300,4 @@ function someGenerics7(strs, a, b, c) {} return n; }, function(n) { return n; -}), (_templateObject17(), someGenerics7)(_templateObject18(), null, null, null), _templateObject19(), _templateObject20(), new Date(), _templateObject21(), _templateObject22(), _templateObject23(); +}), (_templateObject17(), someGenerics7)(_templateObject18(), null, null, null), _templateObject19(), _templateObject20(), _templateObject21(), _templateObject22(), _templateObject23(); diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference_es2015.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference_es2015.2.minified.js index cdb40717dab..d5f467baaeb 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference_es2015.2.minified.js @@ -10,9 +10,7 @@ function someGenerics8(strs, n) { function someGenerics9(strs, a, b, c) { return null; } -(function(n) {})``, (function(n) {})``, (function(n, m) {})`${3}`, (function(n, m) {})`${3}`, (function(strs, n) {})`${(n)=>n -}`, (function(strs, n) {})`${(n, x)=>n -}`, someGenerics3`${()=>'' +someGenerics3`${()=>'' }`, someGenerics3`${()=>void 0 }`, someGenerics3`${()=>3 }`, someGenerics4`${4}${()=>null diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference_es5.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference_es5.2.minified.js index acb38d2197a..1972e07d92b 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsTypeArgumentInference_es5.2.minified.js @@ -252,9 +252,7 @@ function someGenerics6(strs, a, b, c) {} function someGenerics7(strs, a, b, c) {} !function(strs, n) {}(_templateObject(), function(n) { return n; -}), function(strs, n) {}(_templateObject1(), function(n, x) { - return n; -}), someGenerics3(_templateObject2(), function() { +}), _templateObject1(), someGenerics3(_templateObject2(), function() { return ""; }), someGenerics3(_templateObject3(), function() {}), someGenerics3(_templateObject4(), function() { return 3; @@ -302,4 +300,4 @@ function someGenerics7(strs, a, b, c) {} return n; }, function(n) { return n; -}), (_templateObject17(), someGenerics7)(_templateObject18(), null, null, null), _templateObject19(), _templateObject20(), new Date(), _templateObject21(), _templateObject22(), _templateObject23(); +}), (_templateObject17(), someGenerics7)(_templateObject18(), null, null, null), _templateObject19(), _templateObject20(), _templateObject21(), _templateObject22(), _templateObject23(); diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclareES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclareES6_es2015.2.minified.js index 10c82d76d1f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclareES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclareES6_es2015.2.minified.js @@ -1 +0,0 @@ -(function(x, ...ys) {})`Hello ${0} world!`; diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclare_es2015.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclare_es2015.2.minified.js index 10c82d76d1f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclare_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTagNamedDeclare_es2015.2.minified.js @@ -1 +0,0 @@ -(function(x, ...ys) {})`Hello ${0} world!`; diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6_es2015.2.minified.js index 8f58b488613..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6_es2015.2.minified.js @@ -1 +0,0 @@ -(function(...rest) {})`${function(x) {}}`; diff --git a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression_es2015.2.minified.js b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression_es2015.2.minified.js index 8f58b488613..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression_es2015.2.minified.js @@ -1 +0,0 @@ -(function(...rest) {})`${function(x) {}}`; diff --git a/crates/swc/tests/tsc-references/templateStringBinaryOperationsES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringBinaryOperationsES6_es2015.2.minified.js new file mode 100644 index 00000000000..28e9b0e2857 --- /dev/null +++ b/crates/swc/tests/tsc-references/templateStringBinaryOperationsES6_es2015.2.minified.js @@ -0,0 +1 @@ +"6"; diff --git a/crates/swc/tests/tsc-references/templateStringBinaryOperations_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringBinaryOperations_es2015.2.minified.js new file mode 100644 index 00000000000..28e9b0e2857 --- /dev/null +++ b/crates/swc/tests/tsc-references/templateStringBinaryOperations_es2015.2.minified.js @@ -0,0 +1 @@ +"6"; diff --git a/crates/swc/tests/tsc-references/templateStringInArray_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInArray_es2015.2.minified.js index 99e4c90bdb5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInArray_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInArray_es2015.2.minified.js @@ -1 +0,0 @@ -"abc123def"; diff --git a/crates/swc/tests/tsc-references/templateStringInParenthesesES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInParenthesesES6_es2015.2.minified.js index 45b7468eaa0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInParenthesesES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInParenthesesES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc0abc"; diff --git a/crates/swc/tests/tsc-references/templateStringInParentheses_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInParentheses_es2015.2.minified.js index 45b7468eaa0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInParentheses_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInParentheses_es2015.2.minified.js @@ -1 +0,0 @@ -"abc0abc"; diff --git a/crates/swc/tests/tsc-references/templateStringInPropertyAssignmentES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInPropertyAssignmentES6_es2015.2.minified.js index cd1c9d17dd8..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInPropertyAssignmentES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInPropertyAssignmentES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc123def456ghi"; diff --git a/crates/swc/tests/tsc-references/templateStringInPropertyAssignment_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInPropertyAssignment_es2015.2.minified.js index cd1c9d17dd8..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInPropertyAssignment_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInPropertyAssignment_es2015.2.minified.js @@ -1 +0,0 @@ -"abc123def456ghi"; diff --git a/crates/swc/tests/tsc-references/templateStringInSwitchAndCaseES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInSwitchAndCaseES6_es2015.2.minified.js index 8aa1b0b0f3e..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInSwitchAndCaseES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInSwitchAndCaseES6_es2015.2.minified.js @@ -1,6 +0,0 @@ -switch("abc0abc"){ - case "abc": - case "123": - case "abc0abc": - "def1def"; -} diff --git a/crates/swc/tests/tsc-references/templateStringInSwitchAndCase_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInSwitchAndCase_es2015.2.minified.js index 8aa1b0b0f3e..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInSwitchAndCase_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInSwitchAndCase_es2015.2.minified.js @@ -1,6 +0,0 @@ -switch("abc0abc"){ - case "abc": - case "123": - case "abc0abc": - "def1def"; -} diff --git a/crates/swc/tests/tsc-references/templateStringInTypeAssertionES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInTypeAssertionES6_es2015.2.minified.js index 99e4c90bdb5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInTypeAssertionES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInTypeAssertionES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc123def"; diff --git a/crates/swc/tests/tsc-references/templateStringInTypeAssertion_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInTypeAssertion_es2015.2.minified.js index 99e4c90bdb5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInTypeAssertion_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInTypeAssertion_es2015.2.minified.js @@ -1 +0,0 @@ -"abc123def"; diff --git a/crates/swc/tests/tsc-references/templateStringInTypeOfES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInTypeOfES6_es2015.2.minified.js index 99e4c90bdb5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInTypeOfES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInTypeOfES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc123def"; diff --git a/crates/swc/tests/tsc-references/templateStringInTypeOf_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInTypeOf_es2015.2.minified.js index 99e4c90bdb5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInTypeOf_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInTypeOf_es2015.2.minified.js @@ -1 +0,0 @@ -"abc123def"; diff --git a/crates/swc/tests/tsc-references/templateStringInUnaryPlusES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInUnaryPlusES6_es2015.2.minified.js index 99e4c90bdb5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInUnaryPlusES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInUnaryPlusES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc123def"; diff --git a/crates/swc/tests/tsc-references/templateStringInUnaryPlus_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInUnaryPlus_es2015.2.minified.js index 99e4c90bdb5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringInUnaryPlus_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInUnaryPlus_es2015.2.minified.js @@ -1 +0,0 @@ -"abc123def"; diff --git a/crates/swc/tests/tsc-references/templateStringInWhileES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInWhileES6_es2015.2.minified.js index 5ed21f2f772..4ab96f09617 100644 --- a/crates/swc/tests/tsc-references/templateStringInWhileES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInWhileES6_es2015.2.minified.js @@ -1 +1 @@ -for(;;)"def1def"; +for(;;); diff --git a/crates/swc/tests/tsc-references/templateStringInWhile_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringInWhile_es2015.2.minified.js index 5ed21f2f772..4ab96f09617 100644 --- a/crates/swc/tests/tsc-references/templateStringInWhile_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringInWhile_es2015.2.minified.js @@ -1 +1 @@ -for(;;)"def1def"; +for(;;); diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedAdditionES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedAdditionES6_es2015.2.minified.js index d66c36a7f94..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedAdditionES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedAdditionES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc20def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedAddition_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedAddition_es2015.2.minified.js index d66c36a7f94..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedAddition_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedAddition_es2015.2.minified.js @@ -1 +0,0 @@ -"abc20def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrayES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrayES6_es2015.2.minified.js index 6bcec16265f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrayES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrayES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc12,3,def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedArray_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedArray_es2015.2.minified.js index 6bcec16265f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedArray_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedArray_es2015.2.minified.js @@ -1 +0,0 @@ -"abc12,3,def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrowFunctionES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrowFunctionES6_es2015.2.minified.js index 477479e2f3d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrowFunctionES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrowFunctionES6_es2015.2.minified.js @@ -1,2 +0,0 @@ -`abc${(x)=>x -}def`; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrowFunction_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrowFunction_es2015.2.minified.js index 477479e2f3d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrowFunction_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedArrowFunction_es2015.2.minified.js @@ -1,2 +0,0 @@ -`abc${(x)=>x -}def`; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedConditionalES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedConditionalES6_es2015.2.minified.js index 918584e3f5d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedConditionalES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedConditionalES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abcfalsedef"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedConditional_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedConditional_es2015.2.minified.js index 918584e3f5d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedConditional_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedConditional_es2015.2.minified.js @@ -1 +0,0 @@ -"abcfalsedef"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedDivisionES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedDivisionES6_es2015.2.minified.js index e9104a4c1e3..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedDivisionES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedDivisionES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc1def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedDivision_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedDivision_es2015.2.minified.js index e9104a4c1e3..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedDivision_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedDivision_es2015.2.minified.js @@ -1 +0,0 @@ -"abc1def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedFunctionExpressionES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedFunctionExpressionES6_es2015.2.minified.js index a371e7924ea..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedFunctionExpressionES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedFunctionExpressionES6_es2015.2.minified.js @@ -1,3 +0,0 @@ -`abc${function y() { - return y; -}}def`; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedFunctionExpression_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedFunctionExpression_es2015.2.minified.js index a371e7924ea..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedFunctionExpression_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedFunctionExpression_es2015.2.minified.js @@ -1,3 +0,0 @@ -`abc${function y() { - return y; -}}def`; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedInOperatorES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedInOperatorES6_es2015.2.minified.js index be11a735709..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedInOperatorES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedInOperatorES6_es2015.2.minified.js @@ -1,4 +0,0 @@ -`abc${"hi" in { - hi: 10, - hello: 20 -}}def`; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedInOperator_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedInOperator_es2015.2.minified.js index be11a735709..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedInOperator_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedInOperator_es2015.2.minified.js @@ -1,4 +0,0 @@ -`abc${"hi" in { - hi: 10, - hello: 20 -}}def`; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedInstanceOfES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedInstanceOfES6_es2015.2.minified.js index 918584e3f5d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedInstanceOfES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedInstanceOfES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abcfalsedef"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedInstanceOf_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedInstanceOf_es2015.2.minified.js index 918584e3f5d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedInstanceOf_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedInstanceOf_es2015.2.minified.js @@ -1 +0,0 @@ -"abcfalsedef"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedModuloES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedModuloES6_es2015.2.minified.js index b7d85b060b1..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedModuloES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedModuloES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc0def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedModulo_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedModulo_es2015.2.minified.js index b7d85b060b1..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedModulo_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedModulo_es2015.2.minified.js @@ -1 +0,0 @@ -"abc0def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedMultiplicationES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedMultiplicationES6_es2015.2.minified.js index 77a84d7cf1b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedMultiplicationES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedMultiplicationES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc42def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedMultiplication_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedMultiplication_es2015.2.minified.js index 77a84d7cf1b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedMultiplication_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedMultiplication_es2015.2.minified.js @@ -1 +0,0 @@ -"abc42def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedNewOperatorES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedNewOperatorES6_es2015.2.minified.js index fce0b882d5e..9fe84f507d9 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedNewOperatorES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedNewOperatorES6_es2015.2.minified.js @@ -1 +1 @@ -`abc${new String("Hi")}def`; +new String("Hi"); diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedNewOperator_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedNewOperator_es2015.2.minified.js index fce0b882d5e..9fe84f507d9 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedNewOperator_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedNewOperator_es2015.2.minified.js @@ -1 +1 @@ -`abc${new String("Hi")}def`; +new String("Hi"); diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedObjectLiteralES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedObjectLiteralES6_es2015.2.minified.js index c277548dd24..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedObjectLiteralES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedObjectLiteralES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc[object Object]def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedObjectLiteral_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedObjectLiteral_es2015.2.minified.js index c277548dd24..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedObjectLiteral_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedObjectLiteral_es2015.2.minified.js @@ -1 +0,0 @@ -"abc[object Object]def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedTypeAssertionOnAdditionES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedTypeAssertionOnAdditionES6_es2015.2.minified.js index d66c36a7f94..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedTypeAssertionOnAdditionES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedTypeAssertionOnAdditionES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abc20def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedTypeAssertionOnAddition_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedTypeAssertionOnAddition_es2015.2.minified.js index d66c36a7f94..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedTypeAssertionOnAddition_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedTypeAssertionOnAddition_es2015.2.minified.js @@ -1 +0,0 @@ -"abc20def"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedUnaryPlusES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedUnaryPlusES6_es2015.2.minified.js index 151e6aa8e00..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedUnaryPlusES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedUnaryPlusES6_es2015.2.minified.js @@ -1 +0,0 @@ -"abcInfinitydef"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmbeddedUnaryPlus_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmbeddedUnaryPlus_es2015.2.minified.js index 151e6aa8e00..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmbeddedUnaryPlus_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmbeddedUnaryPlus_es2015.2.minified.js @@ -1 +0,0 @@ -"abcInfinitydef"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmptyLiteralPortionsES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmptyLiteralPortionsES6_es2015.2.minified.js index be2a8d79069..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmptyLiteralPortionsES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmptyLiteralPortionsES6_es2015.2.minified.js @@ -1 +0,0 @@ -"10203"; diff --git a/crates/swc/tests/tsc-references/templateStringWithEmptyLiteralPortions_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithEmptyLiteralPortions_es2015.2.minified.js index be2a8d79069..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithEmptyLiteralPortions_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithEmptyLiteralPortions_es2015.2.minified.js @@ -1 +0,0 @@ -"10203"; diff --git a/crates/swc/tests/tsc-references/templateStringWithOpenCommentInStringPortionES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithOpenCommentInStringPortionES6_es2015.2.minified.js index 4e16552af26..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithOpenCommentInStringPortionES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithOpenCommentInStringPortionES6_es2015.2.minified.js @@ -1 +0,0 @@ -" /**head 10 // still middle 20 /* still tail "; diff --git a/crates/swc/tests/tsc-references/templateStringWithOpenCommentInStringPortion_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringWithOpenCommentInStringPortion_es2015.2.minified.js index 4e16552af26..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringWithOpenCommentInStringPortion_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringWithOpenCommentInStringPortion_es2015.2.minified.js @@ -1 +0,0 @@ -" /**head 10 // still middle 20 /* still tail "; diff --git a/crates/swc/tests/tsc-references/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6_es2015.2.minified.js index b2444689dde..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6_es2015.2.minified.js @@ -1 +0,0 @@ -`${function(x) {}}`; diff --git a/crates/swc/tests/tsc-references/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression_es2015.2.minified.js b/crates/swc/tests/tsc-references/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression_es2015.2.minified.js index b2444689dde..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression_es2015.2.minified.js @@ -1 +0,0 @@ -`${function(x) {}}`; diff --git a/crates/swc/tests/tsc-references/topLevelFileModule_es2015.2.minified.js b/crates/swc/tests/tsc-references/topLevelFileModule_es2015.2.minified.js index e20afe00ff2..bf858fc8b4d 100644 --- a/crates/swc/tests/tsc-references/topLevelFileModule_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/topLevelFileModule_es2015.2.minified.js @@ -1,3 +1,3 @@ export var x; const foo = require("./vs/foo_0"), fum = require("./vs/fum"); -foo.x + fum.y; +foo.x, fum.y; diff --git a/crates/swc/tests/tsc-references/topLevelFileModule_es5.2.minified.js b/crates/swc/tests/tsc-references/topLevelFileModule_es5.2.minified.js index 65a174e58d4..d54ffe6cfdd 100644 --- a/crates/swc/tests/tsc-references/topLevelFileModule_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/topLevelFileModule_es5.2.minified.js @@ -1,3 +1,3 @@ export var x; var foo = require("./vs/foo_0"), fum = require("./vs/fum"); -foo.x + fum.y; +foo.x, fum.y; diff --git a/crates/swc/tests/tsc-references/typeArgumentInferenceTransitiveConstraints_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeArgumentInferenceTransitiveConstraints_es2015.2.minified.js index a7d111fcf90..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/typeArgumentInferenceTransitiveConstraints_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeArgumentInferenceTransitiveConstraints_es2015.2.minified.js @@ -1 +0,0 @@ -new Date(), new Date(), new Date(); diff --git a/crates/swc/tests/tsc-references/typeArgumentInferenceTransitiveConstraints_es5.2.minified.js b/crates/swc/tests/tsc-references/typeArgumentInferenceTransitiveConstraints_es5.2.minified.js index a7d111fcf90..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/typeArgumentInferenceTransitiveConstraints_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeArgumentInferenceTransitiveConstraints_es5.2.minified.js @@ -1 +0,0 @@ -new Date(), new Date(), new Date(); diff --git a/crates/swc/tests/tsc-references/typeArgumentInference_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeArgumentInference_es2015.2.minified.js index 4733ef1c81c..17433235504 100644 --- a/crates/swc/tests/tsc-references/typeArgumentInference_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeArgumentInference_es2015.2.minified.js @@ -39,4 +39,4 @@ noParams(), noParams(), noParams(), noGenericParams(''), noGenericParams(''), no ), someGenerics7((n)=>n , (n)=>n , (n)=>n -), someGenerics7(null, null, null), new Date(), new Date(); +), someGenerics7(null, null, null); diff --git a/crates/swc/tests/tsc-references/typeArgumentInference_es5.2.minified.js b/crates/swc/tests/tsc-references/typeArgumentInference_es5.2.minified.js index 093121a3e39..8a3f0333fff 100644 --- a/crates/swc/tests/tsc-references/typeArgumentInference_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeArgumentInference_es5.2.minified.js @@ -68,4 +68,4 @@ noParams(), noParams(), noParams(), noGenericParams(""), noGenericParams(""), no return n; }, function(n) { return n; -}), someGenerics7(null, null, null), new Date(), new Date(); +}), someGenerics7(null, null, null); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment29_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment29_es2015.2.minified.js index 8418a5fb2e2..c0b3eb251ff 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment29_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment29_es2015.2.minified.js @@ -3,7 +3,7 @@ function ExpandoDecl(n) { } ExpandoDecl.prop = 2, ExpandoDecl.m = function(n) { return n + 1; -}, ExpandoDecl.prop + ExpandoDecl.m(12) + ExpandoDecl(101).length; +}, ExpandoDecl.prop, ExpandoDecl.m(12), ExpandoDecl(101).length; const ExpandoExpr = function(n) { return n.toString(); }; @@ -13,7 +13,7 @@ ExpandoExpr.prop = { y: "" }, ExpandoExpr.m = function(n) { return n + 1; -}, ExpandoExpr.prop.x + ExpandoExpr.m(12) + ExpandoExpr(101).length; +}, ExpandoExpr.prop.x, ExpandoExpr.m(12), ExpandoExpr(101).length; const ExpandoArrow = (n)=>n.toString() ; function ExpandoMerge(n) { @@ -26,7 +26,7 @@ ExpandoArrow.prop = 2, ExpandoArrow.m = function(n) { return n + m; }; return nested.total = n + 1_000_000, nested; -}).also = -1, ExpandoMerge.p1 = 111, (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, (ExpandoMerge || (ExpandoMerge = {})).p3 = 333, ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge(1), function(Ns1) { +}).also = -1, ExpandoMerge.p1 = 111, (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, (ExpandoMerge || (ExpandoMerge = {})).p3 = 333, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge(1), function(Ns1) { function ExpandoNamespace() {} function foo() { return ExpandoNamespace; @@ -38,7 +38,7 @@ var Ns, ExpandoExpr2 = function(n) { }; ExpandoExpr2.prop = 2, ExpandoExpr2.m = function(n) { return n + 1; -}, ExpandoExpr2.prop + ExpandoExpr2.m(12) + ExpandoExpr2(101).length; +}, ExpandoExpr2.prop, ExpandoExpr2.m(12), ExpandoExpr2(101).length; class ExpandoClass { constructor(){ this.n = 1001; @@ -46,7 +46,7 @@ class ExpandoClass { } ExpandoClass.prop = 2, ExpandoClass.m = function(n) { return n + 1; -}, ExpandoClass.prop + ExpandoClass.m(12) + new ExpandoClass().n; +}, ExpandoClass.prop, ExpandoClass.m(12), new ExpandoClass().n; var ExpandoExpr3 = class { constructor(){ this.n = 10001; @@ -54,4 +54,4 @@ var ExpandoExpr3 = class { }; ExpandoExpr3.prop = 3, ExpandoExpr3.m = function(n) { return n + 1; -}, ExpandoExpr3.prop + ExpandoExpr3.m(13) + new ExpandoExpr3().n; +}, ExpandoExpr3.prop, ExpandoExpr3.m(13), new ExpandoExpr3().n; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment29_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment29_es5.2.minified.js index a597f8d47a1..2dcac56ea13 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment29_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment29_es5.2.minified.js @@ -4,7 +4,7 @@ function ExpandoDecl(n) { } ExpandoDecl.prop = 2, ExpandoDecl.m = function(n) { return n + 1; -}, ExpandoDecl.prop + ExpandoDecl.m(12) + ExpandoDecl(101).length; +}, ExpandoDecl.prop, ExpandoDecl.m(12), ExpandoDecl(101).length; var Ns, ExpandoExpr = function(n) { return n.toString(); }; @@ -14,7 +14,7 @@ ExpandoExpr.prop = { y: "" }, ExpandoExpr.m = function(n) { return n + 1; -}, ExpandoExpr.prop.x + ExpandoExpr.m(12) + ExpandoExpr(101).length; +}, ExpandoExpr.prop.x, ExpandoExpr.m(12), ExpandoExpr(101).length; var ExpandoArrow = function(n) { return n.toString(); }; @@ -28,7 +28,7 @@ ExpandoArrow.prop = 2, ExpandoArrow.m = function(n) { return n + m; }; return nested.total = n + 1_000_000, nested; -}).also = -1, ExpandoMerge.p1 = 111, (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, (ExpandoMerge || (ExpandoMerge = {})).p3 = 333, ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge(1), function(Ns1) { +}).also = -1, ExpandoMerge.p1 = 111, (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, (ExpandoMerge || (ExpandoMerge = {})).p3 = 333, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge(1), function(Ns1) { var ExpandoNamespace = function() {}; ExpandoNamespace.p6 = 42, Ns1.foo = function() { return ExpandoNamespace; @@ -39,18 +39,18 @@ var ExpandoExpr2 = function(n) { }; ExpandoExpr2.prop = 2, ExpandoExpr2.m = function(n) { return n + 1; -}, ExpandoExpr2.prop + ExpandoExpr2.m(12) + ExpandoExpr2(101).length; +}, ExpandoExpr2.prop, ExpandoExpr2.m(12), ExpandoExpr2(101).length; var ExpandoClass = function() { "use strict"; swcHelpers.classCallCheck(this, ExpandoClass), this.n = 1001; }; ExpandoClass.prop = 2, ExpandoClass.m = function(n) { return n + 1; -}, ExpandoClass.prop + ExpandoClass.m(12) + new ExpandoClass().n; +}, ExpandoClass.prop, ExpandoClass.m(12), new ExpandoClass().n; var ExpandoExpr3 = function _class() { "use strict"; swcHelpers.classCallCheck(this, _class), this.n = 10001; }; ExpandoExpr3.prop = 3, ExpandoExpr3.m = function(n) { return n + 1; -}, ExpandoExpr3.prop + ExpandoExpr3.m(13) + new ExpandoExpr3().n; +}, ExpandoExpr3.prop, ExpandoExpr3.m(13), new ExpandoExpr3().n; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment31_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment31_es2015.2.minified.js index e622ea1a55b..ec789ac643d 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment31_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment31_es2015.2.minified.js @@ -5,4 +5,4 @@ ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { return n + 1; }, (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, ExpandoMerge.p4 = 44444, ExpandoMerge.p6 = 66666, ExpandoMerge.p8 = !1, function(ExpandoMerge1) { ExpandoMerge1.p3 = 333, ExpandoMerge1.p4 = 4, ExpandoMerge1.p5 = 5, ExpandoMerge1.p6 = 6, ExpandoMerge1.p7 = 7, ExpandoMerge1.p8 = 6, ExpandoMerge1.p9 = 7; -}(ExpandoMerge || (ExpandoMerge = {})), ExpandoMerge.p5 = 555555, ExpandoMerge.p7 = 777777, ExpandoMerge.p9 = !1, ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001); +}(ExpandoMerge || (ExpandoMerge = {})), ExpandoMerge.p5 = 555555, ExpandoMerge.p7 = 777777, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12), ExpandoMerge(1001); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment31_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment31_es5.2.minified.js index e622ea1a55b..ec789ac643d 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment31_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment31_es5.2.minified.js @@ -5,4 +5,4 @@ ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { return n + 1; }, (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, ExpandoMerge.p4 = 44444, ExpandoMerge.p6 = 66666, ExpandoMerge.p8 = !1, function(ExpandoMerge1) { ExpandoMerge1.p3 = 333, ExpandoMerge1.p4 = 4, ExpandoMerge1.p5 = 5, ExpandoMerge1.p6 = 6, ExpandoMerge1.p7 = 7, ExpandoMerge1.p8 = 6, ExpandoMerge1.p9 = 7; -}(ExpandoMerge || (ExpandoMerge = {})), ExpandoMerge.p5 = 555555, ExpandoMerge.p7 = 777777, ExpandoMerge.p9 = !1, ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001); +}(ExpandoMerge || (ExpandoMerge = {})), ExpandoMerge.p5 = 555555, ExpandoMerge.p7 = 777777, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12), ExpandoMerge(1001); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.2.minified.js index 6611a6b6828..2fc0bec2b2a 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es2015.2.minified.js @@ -3,6 +3,6 @@ function ExpandoMerge(n) { } ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { return n + 1; -}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001), function(ExpandoMerge1) { +}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12), ExpandoMerge(1001), function(ExpandoMerge1) { ExpandoMerge1.p3 = 333, ExpandoMerge1.p4 = 4, ExpandoMerge1.p5 = 5, ExpandoMerge1.p6 = 6, ExpandoMerge1.p7 = 7, ExpandoMerge1.p8 = 6, ExpandoMerge1.p9 = 7; }(ExpandoMerge || (ExpandoMerge = {})), (ExpandoMerge || (ExpandoMerge = {})).p2 = 222; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.2.minified.js index 6611a6b6828..2fc0bec2b2a 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment32_es5.2.minified.js @@ -3,6 +3,6 @@ function ExpandoMerge(n) { } ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { return n + 1; -}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001), function(ExpandoMerge1) { +}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12), ExpandoMerge(1001), function(ExpandoMerge1) { ExpandoMerge1.p3 = 333, ExpandoMerge1.p4 = 4, ExpandoMerge1.p5 = 5, ExpandoMerge1.p6 = 6, ExpandoMerge1.p7 = 7, ExpandoMerge1.p8 = 6, ExpandoMerge1.p9 = 7; }(ExpandoMerge || (ExpandoMerge = {})), (ExpandoMerge || (ExpandoMerge = {})).p2 = 222; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.2.minified.js index d479a2e36a3..f3f1572a8e4 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es2015.2.minified.js @@ -5,4 +5,4 @@ function ExpandoMerge(n) { ExpandoMerge1.p3 = 333, ExpandoMerge1.p4 = 4, ExpandoMerge1.p5 = 5, ExpandoMerge1.p6 = 6, ExpandoMerge1.p7 = 7, ExpandoMerge1.p8 = 6, ExpandoMerge1.p9 = 7; }(ExpandoMerge || (ExpandoMerge = {})), (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { return n + 1; -}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001); +}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12), ExpandoMerge(1001); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.2.minified.js index d479a2e36a3..f3f1572a8e4 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment33_es5.2.minified.js @@ -5,4 +5,4 @@ function ExpandoMerge(n) { ExpandoMerge1.p3 = 333, ExpandoMerge1.p4 = 4, ExpandoMerge1.p5 = 5, ExpandoMerge1.p6 = 6, ExpandoMerge1.p7 = 7, ExpandoMerge1.p8 = 6, ExpandoMerge1.p9 = 7; }(ExpandoMerge || (ExpandoMerge = {})), (ExpandoMerge || (ExpandoMerge = {})).p2 = 222, ExpandoMerge.p1 = 111, ExpandoMerge.m = function(n) { return n + 1; -}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1 + ExpandoMerge.p2 + ExpandoMerge.p3 + ExpandoMerge.p4 + ExpandoMerge.p5 + ExpandoMerge.p6 + ExpandoMerge.p7 + ExpandoMerge.p8 + ExpandoMerge.p9 + ExpandoMerge.m(12) + ExpandoMerge(1001); +}, ExpandoMerge.p4 = 44444, ExpandoMerge.p5 = 555555, ExpandoMerge.p6 = 66666, ExpandoMerge.p7 = 777777, ExpandoMerge.p8 = !1, ExpandoMerge.p9 = !1, ExpandoMerge.p1, ExpandoMerge.p2, ExpandoMerge.p3, ExpandoMerge.p4, ExpandoMerge.p5, ExpandoMerge.p6, ExpandoMerge.p7, ExpandoMerge.p8, ExpandoMerge.p9, ExpandoMerge.m(12), ExpandoMerge(1001); diff --git a/crates/swc/tests/tsc-references/typeGuardEnums_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeGuardEnums_es2015.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/typeGuardEnums_es5.2.minified.js b/crates/swc/tests/tsc-references/typeGuardEnums_es5.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/typeGuardInClass_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeGuardInClass_es2015.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/typeGuardOfFormFunctionEquality_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeGuardOfFormFunctionEquality_es2015.2.minified.js index 773e7323223..3d01e9dbaf6 100644 --- a/crates/swc/tests/tsc-references/typeGuardOfFormFunctionEquality_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeGuardOfFormFunctionEquality_es2015.2.minified.js @@ -1,5 +1 @@ -switch(isString1(0, "")){ - case isString2(""): - default: -} -isString1(0, "") === isString2(""); +isString1(0, ""), isString1(0, ""), isString2(""); diff --git a/crates/swc/tests/tsc-references/typeGuardOfFormFunctionEquality_es5.2.minified.js b/crates/swc/tests/tsc-references/typeGuardOfFormFunctionEquality_es5.2.minified.js index 773e7323223..3d01e9dbaf6 100644 --- a/crates/swc/tests/tsc-references/typeGuardOfFormFunctionEquality_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeGuardOfFormFunctionEquality_es5.2.minified.js @@ -1,5 +1 @@ -switch(isString1(0, "")){ - case isString2(""): - default: -} -isString1(0, "") === isString2(""); +isString1(0, ""), isString1(0, ""), isString2(""); diff --git a/crates/swc/tests/tsc-references/typeGuardOfFormTypeOfIsOrderIndependent_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeGuardOfFormTypeOfIsOrderIndependent_es2015.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/typeGuardOfFormTypeOfIsOrderIndependent_es5.2.minified.js b/crates/swc/tests/tsc-references/typeGuardOfFormTypeOfIsOrderIndependent_es5.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/typeGuardOfFormTypeOfPrimitiveSubtype_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeGuardOfFormTypeOfPrimitiveSubtype_es2015.2.minified.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/crates/swc/tests/tsc-references/typeGuardsNestedAssignments_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeGuardsNestedAssignments_es2015.2.minified.js index 855bb98cc22..8e5f5d0f469 100644 --- a/crates/swc/tests/tsc-references/typeGuardsNestedAssignments_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeGuardsNestedAssignments_es2015.2.minified.js @@ -1,3 +1,3 @@ const re = /./g; let match; -for(; null != (match = re.exec("xxx"));)match[1].length + match[2].length; +for(; null != (match = re.exec("xxx"));)match[1].length, match[2].length; diff --git a/crates/swc/tests/tsc-references/typeGuardsNestedAssignments_es5.2.minified.js b/crates/swc/tests/tsc-references/typeGuardsNestedAssignments_es5.2.minified.js index c96352659a7..70e23647130 100644 --- a/crates/swc/tests/tsc-references/typeGuardsNestedAssignments_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/typeGuardsNestedAssignments_es5.2.minified.js @@ -2,4 +2,4 @@ import * as swcHelpers from "@swc/helpers"; for(var match, Foo = function() { "use strict"; swcHelpers.classCallCheck(this, Foo); -}, re = /./g; null != (match = re.exec("xxx"));)match[1].length + match[2].length; +}, re = /./g; null != (match = re.exec("xxx"));)match[1].length, match[2].length; diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType_es2015.2.minified.js index 882a28498f4..2c23abe6bac 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType_es2015.2.minified.js @@ -11,10 +11,6 @@ class A { }(M || (M = {})); var objA = new A(); ANY2[0], objA.a, M.n, A.foo(), ANY2[0], objA.a, M.n; -z: ; -x: ; -r: ; z: objA.a; z: A.foo; z: M.n; -z: ; diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType_es2015.2.minified.js index f439d5963c2..1f86b3cc6bf 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType_es2015.2.minified.js @@ -12,9 +12,6 @@ class A { }(M || (M = {})); var M, objA = new A(); objA.a, M.n, foo(), A.foo(), foo(), objA.a, M.n; -z: ; -r: ; -z: ; z: objA.a; z: A.foo; z: M.n; diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithEnumType_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeofOperatorWithEnumType_es2015.2.minified.js index 83390a13fb9..c493ff84ea3 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithEnumType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithEnumType_es2015.2.minified.js @@ -1,6 +1,4 @@ var ENUM, ENUM1; !function(ENUM1) { ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM[0] + ENUM1.B, ENUM[0] + ENUM1.B, ENUM1.B; -z: ; -z: ; +}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM[0], ENUM1.B, ENUM[0], ENUM1.B, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithNumberType_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeofOperatorWithNumberType_es2015.2.minified.js index 79b78b63e1b..eeb49c8978a 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithNumberType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithNumberType_es2015.2.minified.js @@ -9,10 +9,6 @@ class A { }(M || (M = {})); var M, objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n, objA.a, M.n; -z: ; -x: ; -r: ; -z: ; z: objA.a; z: A.foo; z: M.n; diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithStringType_es2015.2.minified.js b/crates/swc/tests/tsc-references/typeofOperatorWithStringType_es2015.2.minified.js index cea5edb4bb7..a2be16eda1a 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithStringType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithStringType_es2015.2.minified.js @@ -9,9 +9,6 @@ class A { }(M || (M = {})); var STRING, M, objA = new A(); objA.a, M.n, A.foo(), STRING.charAt(0), objA.a, M.n; -z: ; -x: ; -r: ; z: ""; z: objA.a; z: A.foo; diff --git a/crates/swc/tests/tsc-references/unknownType2_es2015.2.minified.js b/crates/swc/tests/tsc-references/unknownType2_es2015.2.minified.js index 433dea8284d..63331618157 100644 --- a/crates/swc/tests/tsc-references/unknownType2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/unknownType2_es2015.2.minified.js @@ -1,6 +1,6 @@ var NumberEnum, StringEnum; const u = void 0; -5 === u && u.toString(10), symb, aString, aBoolean, aNumber, anObject, anObjectLiteral, aUnion, anIntersection, aFunction, function(NumberEnum) { +5 === u && u.toString(10), function(NumberEnum) { NumberEnum[NumberEnum.A = 0] = "A", NumberEnum[NumberEnum.B = 1] = "B", NumberEnum[NumberEnum.C = 2] = "C"; }(NumberEnum || (NumberEnum = {})), function(StringEnum) { StringEnum.A = "A", StringEnum.B = "B", StringEnum.C = "C"; diff --git a/crates/swc/tests/tsc-references/unknownType2_es5.2.minified.js b/crates/swc/tests/tsc-references/unknownType2_es5.2.minified.js index 64ca3998ce5..dfcc558e379 100644 --- a/crates/swc/tests/tsc-references/unknownType2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/unknownType2_es5.2.minified.js @@ -1,5 +1,5 @@ var NumberEnum, StringEnum, u = void 0; -5 === u && u.toString(10), symb, aString, aBoolean, aNumber, anObject, anObjectLiteral, aUnion, anIntersection, aFunction, function(NumberEnum) { +5 === u && u.toString(10), function(NumberEnum) { NumberEnum[NumberEnum.A = 0] = "A", NumberEnum[NumberEnum.B = 1] = "B", NumberEnum[NumberEnum.C = 2] = "C"; }(NumberEnum || (NumberEnum = {})), function(StringEnum) { StringEnum.A = "A", StringEnum.B = "B", StringEnum.C = "C"; diff --git a/crates/swc/tests/tsc-references/voidOperatorWithEnumType_es2015.2.minified.js b/crates/swc/tests/tsc-references/voidOperatorWithEnumType_es2015.2.minified.js index 3257e59b046..c493ff84ea3 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithEnumType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithEnumType_es2015.2.minified.js @@ -1,4 +1,4 @@ var ENUM, ENUM1; !function(ENUM1) { ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM[0] + ENUM1.B, ENUM[0] + ENUM1.B, ENUM1.B; +}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM[0], ENUM1.B, ENUM[0], ENUM1.B, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/voidOperatorWithEnumType_es5.2.minified.js b/crates/swc/tests/tsc-references/voidOperatorWithEnumType_es5.2.minified.js index 3257e59b046..c493ff84ea3 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithEnumType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithEnumType_es5.2.minified.js @@ -1,4 +1,4 @@ var ENUM, ENUM1; !function(ENUM1) { ENUM1[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; -}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM[0] + ENUM1.B, ENUM[0] + ENUM1.B, ENUM1.B; +}(ENUM1 || (ENUM1 = {})), ENUM1.A, ENUM[0], ENUM1.B, ENUM[0], ENUM1.B, ENUM1.B; diff --git a/crates/swc/tests/tsc-references/whileBreakStatements_es2015.2.minified.js b/crates/swc/tests/tsc-references/whileBreakStatements_es2015.2.minified.js index 01f530197cb..bd72dd7eaaa 100644 --- a/crates/swc/tests/tsc-references/whileBreakStatements_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/whileBreakStatements_es2015.2.minified.js @@ -1,4 +1,3 @@ -TWO: ; FOUR: for(;;)FIVE: for(;;)break FOUR; for(;;); for(;;)for(;;); diff --git a/crates/swc/tests/tsc-references/whileBreakStatements_es5.2.minified.js b/crates/swc/tests/tsc-references/whileBreakStatements_es5.2.minified.js index 01f530197cb..bd72dd7eaaa 100644 --- a/crates/swc/tests/tsc-references/whileBreakStatements_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/whileBreakStatements_es5.2.minified.js @@ -1,4 +1,3 @@ -TWO: ; FOUR: for(;;)FIVE: for(;;)break FOUR; for(;;); for(;;)for(;;); 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 db4d14e88c4..305877785dd 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*as e from"@swc/helpers";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{ + a.id, (yield listOfUser(a.id)).forEach((b)=>{ insertQuery += `INSERT INTO "TABLE"("UUID", id, other_ids_here) VALUES ('${uuidv4()}', '${a.id}', now());`; }); } 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 ad51b7f2ba2..9b7c717e867 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 @@ -97,8 +97,7 @@ var ItemsList = function(_Component) { var Derived, Constructor1, protoProps, staticProps, _super = (Derived = ItemsList1, function() { var self, call, result, Super = _getPrototypeOf(Derived); if (function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + 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; diff --git a/crates/swc_ecma_minifier/src/compress/mod.rs b/crates/swc_ecma_minifier/src/compress/mod.rs index f8b5aa467a4..42b7cd48d2c 100644 --- a/crates/swc_ecma_minifier/src/compress/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/mod.rs @@ -334,8 +334,8 @@ where if cfg!(feature = "debug") && visitor.changed() { n.invoke(); - let start = n.dump(); - tracing::debug!("===== After pure =====\n{}", start); + let src = n.dump(); + tracing::debug!("===== After pure =====\n{}\n{}", start, src); } } diff --git a/crates/swc_ecma_minifier/src/compress/optimize/conditionals.rs b/crates/swc_ecma_minifier/src/compress/optimize/conditionals.rs index f9a549c5a5e..fdb3e13542f 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/conditionals.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/conditionals.rs @@ -150,6 +150,8 @@ where })); } else { new.extend(cur.take().map(Stmt::If).map(T::from_stmt)); + + cur = Some(stmt); } } None => { diff --git a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs index 21b24ec13ea..eb3845359fd 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs @@ -2149,6 +2149,7 @@ where in_fn_like: true, scope: n.span.ctxt, can_inline_arguments: true, + ..self.ctx }; let optimizer = &mut *self.with_ctx(ctx); @@ -2303,6 +2304,9 @@ where match n { Some(VarDeclOrExpr::Expr(e)) => match &mut **e { + Expr::Invalid(..) => { + *n = None; + } Expr::Seq(SeqExpr { exprs, .. }) if exprs.is_empty() => { *n = None; } @@ -2497,8 +2501,6 @@ where self.try_removing_block(s, false); - self.extract_vars_in_subscopes(s); - if !self.prepend_stmts.is_empty() || !self.append_stmts.is_empty() { let span = s.span(); *s = Stmt::Block(BlockStmt { diff --git a/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs b/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs index ff8eaed5ec4..f045a975bf4 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/sequences.rs @@ -5,8 +5,8 @@ use swc_atoms::js_word; use swc_common::{util::take::Take, Spanned, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_utils::{ - contains_arguments, contains_this_expr, ident::IdentLike, undefined, ExprExt, Id, StmtLike, - UsageFinder, + contains_arguments, contains_this_expr, ident::IdentLike, prepend_stmts, undefined, ExprExt, + Id, StmtLike, UsageFinder, }; use swc_ecma_visit::{noop_visit_type, Visit, VisitWith}; use tracing::{span, Level}; @@ -483,74 +483,27 @@ where e.exprs = new_exprs; } - /// Hoist variables in subscope. - /// - /// I don't know why it depends on `sequences`. - pub(super) fn extract_vars_in_subscopes(&mut self, s: &mut Stmt) { - if !self.options.sequences() { - return; + #[allow(unused)] + pub(super) fn optimize_with_extras(&mut self, stmts: &mut Vec, mut op: F) + where + F: FnMut(&mut Vec), + T: ModuleItemExt, + { + let old_prepend = self.prepend_stmts.take(); + let old_append = self.append_stmts.take(); + + op(stmts); + + if !self.prepend_stmts.is_empty() { + prepend_stmts(stmts, self.prepend_stmts.drain(..).map(T::from_stmt)); } - match s { - Stmt::If(stmt) if self.options.conditionals => { - self.extract_vars(&mut stmt.cons); - if let Some(alt) = &mut stmt.alt { - self.extract_vars(alt); - } - } - - _ => {} + if self.append_stmts.is_empty() { + stmts.extend(self.append_stmts.drain(..).map(T::from_stmt)); } - } - /// Move `var` in subscope to current scope. - /// - /// This method actually `hoist`s [VarDecl]s declared with `var`. - fn extract_vars(&mut self, s: &mut Stmt) { - let mut found_other = false; - if let Stmt::Block(bs) = s { - // Extract variables without - for stmt in &mut bs.stmts { - match stmt { - Stmt::Decl(Decl::Var( - v @ VarDecl { - kind: VarDeclKind::Var, - .. - }, - )) => { - for decl in &mut v.decls { - if decl.init.is_some() { - continue; - } - self.changed = true; - tracing::debug!("sequences: Hoisting `var` without init"); - let s = Stmt::Decl(Decl::Var(VarDecl { - span: v.span, - kind: VarDeclKind::Var, - declare: false, - decls: vec![decl.take()], - })); - if found_other { - self.append_stmts.push(s); - } else { - self.prepend_stmts.push(s); - } - } - - v.decls.retain(|v| !v.name.is_invalid()); - } - _ => { - found_other = true; - } - } - } - - bs.stmts.retain(|s| match s { - Stmt::Empty(..) => false, - Stmt::Decl(Decl::Var(v)) => !v.decls.is_empty(), - _ => true, - }); - } + self.prepend_stmts = old_prepend; + self.append_stmts = old_append; } /// diff --git a/crates/swc_ecma_minifier/src/compress/pure/conds.rs b/crates/swc_ecma_minifier/src/compress/pure/conds.rs index 869391fcbd9..2101bf49a71 100644 --- a/crates/swc_ecma_minifier/src/compress/pure/conds.rs +++ b/crates/swc_ecma_minifier/src/compress/pure/conds.rs @@ -169,12 +169,14 @@ impl Pure<'_> { let _lb = bin.left.as_pure_bool(); let rb = bin.right.as_pure_bool(); - if let (Value::Known(Type::Bool), Value::Known(Type::Bool)) = (lt, rt) { - // `!!b || true` => true - if let Value::Known(true) = rb { - self.changed = true; - tracing::debug!("conditionals: `!!foo || true` => `true`"); - *e = make_bool(bin.span, true); + if bin.op == op!("||") { + if let (Value::Known(Type::Bool), Value::Known(Type::Bool)) = (lt, rt) { + // `!!b || true` => true + if let Value::Known(true) = rb { + self.changed = true; + tracing::debug!("conditionals: `!!foo || true` => `true`"); + *e = make_bool(bin.span, true); + } } } } diff --git a/crates/swc_ecma_minifier/src/compress/util/mod.rs b/crates/swc_ecma_minifier/src/compress/util/mod.rs index fafbfd1f0b8..769e779213c 100644 --- a/crates/swc_ecma_minifier/src/compress/util/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/util/mod.rs @@ -754,6 +754,7 @@ pub(super) fn is_global_var(s: &str) -> bool { | "Number" | "NaN" | "Symbol" + | "Promise" ) } diff --git a/crates/swc_ecma_minifier/src/option/mod.rs b/crates/swc_ecma_minifier/src/option/mod.rs index b2633619f60..ff772c4a5a5 100644 --- a/crates/swc_ecma_minifier/src/option/mod.rs +++ b/crates/swc_ecma_minifier/src/option/mod.rs @@ -124,7 +124,7 @@ pub struct CompressOptions { #[serde(alias = "computed_props")] pub computed_props: bool, - #[serde(default)] + #[serde(default = "true_by_default")] #[serde(alias = "conditionals")] pub conditionals: bool, diff --git a/crates/swc_ecma_minifier/src/option/terser.rs b/crates/swc_ecma_minifier/src/option/terser.rs index 30b659d4ee0..f1f4e53c2cc 100644 --- a/crates/swc_ecma_minifier/src/option/terser.rs +++ b/crates/swc_ecma_minifier/src/option/terser.rs @@ -95,19 +95,19 @@ pub struct TerserCompressorOptions { pub comparisons: Option, #[serde(default)] - pub computed_props: bool, + pub computed_props: Option, #[serde(default)] - pub conditionals: bool, + pub conditionals: Option, #[serde(default)] - pub dead_code: bool, + pub dead_code: Option, #[serde(default = "true_by_default")] pub defaults: bool, #[serde(default)] - pub directives: bool, + pub directives: Option, #[serde(default)] pub drop_console: bool, @@ -179,10 +179,10 @@ pub struct TerserCompressorOptions { pub pure_funcs: Vec, #[serde(default)] - pub reduce_funcs: bool, + pub reduce_funcs: Option, #[serde(default)] - pub reduce_vars: bool, + pub reduce_vars: Option, #[serde(default)] pub sequences: Option, @@ -191,7 +191,7 @@ pub struct TerserCompressorOptions { pub side_effects: Option, #[serde(default)] - pub switches: bool, + pub switches: Option, #[serde(default)] pub top_retain: Option, @@ -311,10 +311,13 @@ impl TerserCompressorOptions { bools_as_ints: self.booleans_as_integers, collapse_vars: self.collapse_vars.unwrap_or(self.defaults), comparisons: self.comparisons.unwrap_or(self.defaults), - computed_props: self.computed_props, - conditionals: self.conditionals, - dead_code: self.dead_code, - directives: self.directives, + // TODO: Use self.defaults + computed_props: self.computed_props.unwrap_or(false), + conditionals: self.conditionals.unwrap_or(self.defaults), + // TODO: Use self.defaults + dead_code: self.dead_code.unwrap_or(false), + // TODO: Use self.defaults + directives: self.directives.unwrap_or(false), drop_console: self.drop_console, drop_debugger: self.drop_debugger.unwrap_or(self.defaults), ecma: self.ecma.into(), @@ -402,8 +405,10 @@ impl TerserCompressorOptions { PureGetterOption::Str(v.split(',').map(From::from).collect()) } }, - reduce_fns: self.reduce_funcs, - reduce_vars: self.reduce_vars, + // TODO: Use self.defaults + reduce_fns: self.reduce_funcs.unwrap_or(false), + // TODO: Use self.defaults + reduce_vars: self.reduce_vars.unwrap_or(false), sequences: self .sequences .map(|v| match v { @@ -418,7 +423,8 @@ impl TerserCompressorOptions { }) .unwrap_or(if self.defaults { 3 } else { 0 }), side_effects: self.side_effects.unwrap_or(self.defaults), - switches: self.switches, + // TODO: Use self.defaults + switches: self.switches.unwrap_or(false), top_retain: self.top_retain.map(From::from).unwrap_or_default(), top_level: self.toplevel.map(From::from), typeofs: self.typeofs.unwrap_or(self.defaults), diff --git a/crates/swc_ecma_minifier/tests/TODO.txt b/crates/swc_ecma_minifier/tests/TODO.txt index ca9f3623f3e..db15fedb78b 100644 --- a/crates/swc_ecma_minifier/tests/TODO.txt +++ b/crates/swc_ecma_minifier/tests/TODO.txt @@ -107,6 +107,7 @@ collapse_vars/unused_orig/input.js collapse_vars/var_defs/input.js collapse_vars/var_side_effects_2/input.js conditionals/equality_conditionals_false/input.js +conditionals/hoist_decl/input.js conditionals/ifs_5/input.js conditionals/ifs_6/input.js conditionals/ifs_same_consequent/input.js @@ -453,7 +454,6 @@ issue_269/strings_concat/input.js issue_2719/warn/input.js issue_281/collapse_vars_constants/input.js issue_281/inner_var_for_in_1/input.js -issue_281/issue_1288_side_effects/input.js issue_281/issue_1758/input.js issue_281/pure_annotation_1/input.js issue_281/pure_annotation_2/input.js @@ -511,7 +511,6 @@ loops/issue_2740_8/input.js negate_iife/issue_1254_negate_iife_nested/input.js negate_iife/issue_1254_negate_iife_true/input.js negate_iife/issue_1288/input.js -negate_iife/issue_1288_side_effects/input.js nullish/conditional_to_nullish_coalescing/input.js nullish/conditional_to_nullish_coalescing_2/input.js numbers/evaluate_1/input.js @@ -633,7 +632,6 @@ pure_getters/set_mutable_2/input.js pure_getters/strict_reduce_vars/input.js pure_getters/unsafe/input.js pure_getters/unsafe_reduce_vars/input.js -pure_globals/globals_whose_access_is_pure/input.js reduce_vars/array_forin_1/input.js reduce_vars/chained_assignments/input.js reduce_vars/conditional_chain_certain_part/input.js @@ -732,6 +730,7 @@ sequences/issue_1758/input.js sequences/lift_sequences_2/input.js sequences/lift_sequences_5/input.js sequences/side_effects_cascade_3/input.js +switch/if_switch_typeof/input.js template_string/array_join/input.js template_string/coerce_to_string/input.js template_string/evaluate_nested_templates/input.js @@ -741,8 +740,9 @@ template_string/special_chars_in_string/input.js template_string/tagged_template_function_inline_5/input.js template_string/template_concattenating_string/input.js template_string/template_string_with_predefined_constants/input.js +transform/if_else_empty/input.js transform/if_return/input.js -transform/while_if_break/input.js +transform/label_if_break/input.js try_catch/catch_destructuring_with_sequence/input.js typeof/issue_2728_3/input.js typeof/issue_2728_4/input.js diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js index 381dd898c0e..3f3ab689594 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2257/full/output.js @@ -670,10 +670,12 @@ return null === prototype || prototype === Object.prototype; } function forEach(obj, fn) { - if (null != obj) if ('object' != typeof obj && (obj = [ - obj - ]), isArray(obj)) for(var i = 0, l = obj.length; i < l; i++)fn.call(null, obj[i], i, obj); - else for(var key in obj)Object.prototype.hasOwnProperty.call(obj, key) && fn.call(null, obj[key], key, obj); + if (null != obj) { + if ('object' != typeof obj && (obj = [ + obj + ]), isArray(obj)) for(var i = 0, l = obj.length; i < l; i++)fn.call(null, obj[i], i, obj); + else for(var key in obj)Object.prototype.hasOwnProperty.call(obj, key) && fn.call(null, obj[key], key, obj); + } } function merge() { for(var args = [], _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; @@ -947,7 +949,7 @@ return Object.keys(descriptor).forEach(function(key) { desc1[key] = descriptor[key]; }), desc1.enumerable = !!desc1.enumerable, desc1.configurable = !!desc1.configurable, ('value' in desc1 || desc1.initializer) && (desc1.writable = !0), desc1 = decorators.slice().reverse().reduce(function(desc, decorator) { - return decorator ? decorator(target, property, desc) || desc : desc; + return decorator && decorator(target, property, desc) || desc; }, desc1), context && void 0 !== desc1.initializer && (desc1.value = desc1.initializer ? desc1.initializer.call(context) : void 0, desc1.initializer = void 0), void 0 === desc1.initializer && (Object.defineProperty(target, property, desc1), desc1 = null), desc1; } function _arrayWithHoles(arr) { @@ -1040,10 +1042,7 @@ } function _asyncIterator(iterable) { var method; - if ("function" == typeof Symbol) { - if (Symbol.asyncIterator && null != (method = iterable[Symbol.asyncIterator])) return method.call(iterable); - if (Symbol.iterator && null != (method = iterable[Symbol.iterator])) return method.call(iterable); - } + 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"); } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { @@ -1111,8 +1110,7 @@ } function construct(Parent1, args1, Class1) { return (construct = !function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + 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; @@ -1211,17 +1209,18 @@ var other1, element = elements[i]; if ("method" === element.kind && (other1 = newElements.find(function(other) { 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."); - 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 + ")."); - other1.decorators = element.decorators; + }))) { + if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other1.descriptor)) { + if (_hasDecorators(element) || _hasDecorators(other1)) throw new 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 + ")."); + other1.decorators = element.decorators; + } + _coalesceGetterSetter(element, other1); } - _coalesceGetterSetter(element, other1); - } - else newElements.push(element); + } else newElements.push(element); } return newElements; } @@ -2546,10 +2545,12 @@ return '[object Function]' === toString.call(val); } function forEach(obj, fn) { - if (null != obj) if ('object' != typeof obj && (obj = [ - obj - ]), isArray(obj)) for(var i = 0, l = obj.length; i < l; i++)fn.call(null, obj[i], i, obj); - else for(var key in obj)Object.prototype.hasOwnProperty.call(obj, key) && fn.call(null, obj[key], key, obj); + if (null != obj) { + if ('object' != typeof obj && (obj = [ + obj + ]), isArray(obj)) for(var i = 0, l = obj.length; i < l; i++)fn.call(null, obj[i], i, obj); + else for(var key in obj)Object.prototype.hasOwnProperty.call(obj, key) && fn.call(null, obj[key], key, obj); + } } function merge() { var result = {}; @@ -2958,22 +2959,24 @@ var bind = __webpack_require__(59561), IndexedObject = __webpack_require__(51478), toObject = __webpack_require__(89343), toLength = __webpack_require__(31998), arraySpeciesCreate = __webpack_require__(96582), push = [].push, createMethod = function(TYPE) { var IS_MAP = 1 == TYPE, IS_FILTER = 2 == TYPE, IS_SOME = 3 == TYPE, IS_EVERY = 4 == TYPE, IS_FIND_INDEX = 6 == TYPE, IS_FILTER_REJECT = 7 == TYPE, NO_HOLES = 5 == TYPE || IS_FIND_INDEX; return function($this, callbackfn, that, specificCreate) { - for(var value, result, O = toObject($this), self = IndexedObject(O), boundFunction = bind(callbackfn, that, 3), length = toLength(self.length), index = 0, create = specificCreate || arraySpeciesCreate, target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : void 0; length > index; index++)if ((NO_HOLES || index in self) && (result = boundFunction(value = self[index], index, O), TYPE)) if (IS_MAP) target[index] = result; - else if (result) switch(TYPE){ - case 3: - return !0; - case 5: - return value; - case 6: - return index; - case 2: - push.call(target, value); - } - else switch(TYPE){ - case 4: - return !1; - case 7: - push.call(target, value); + for(var value, result, O = toObject($this), self = IndexedObject(O), boundFunction = bind(callbackfn, that, 3), length = toLength(self.length), index = 0, create = specificCreate || arraySpeciesCreate, target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : void 0; length > index; index++)if ((NO_HOLES || index in self) && (result = boundFunction(value = self[index], index, O), TYPE)) { + if (IS_MAP) target[index] = result; + else if (result) switch(TYPE){ + case 3: + return !0; + case 5: + return value; + case 6: + return index; + case 2: + push.call(target, value); + } + else switch(TYPE){ + case 4: + return !1; + case 7: + push.call(target, value); + } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; }; @@ -3490,19 +3493,21 @@ return function() { return new IteratorConstructor(this); }; - }, TO_STRING_TAG = NAME + ' Iterator', INCORRECT_VALUES_NAME = !1, IterablePrototype = Iterable.prototype, nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT], defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT), anyNativeIterator = 'Array' == NAME ? IterablePrototype.entries || nativeIterator : nativeIterator; + }, TO_STRING_TAG = NAME + ' Iterator', INCORRECT_VALUES_NAME = !1, IterablePrototype = Iterable.prototype, nativeIterator = IterablePrototype[ITERATOR] || IterablePrototype['@@iterator'] || DEFAULT && IterablePrototype[DEFAULT], defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT), anyNativeIterator = 'Array' == NAME && IterablePrototype.entries || nativeIterator; if (anyNativeIterator && (CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()))) !== Object.prototype && CurrentIteratorPrototype.next && (IS_PURE || getPrototypeOf(CurrentIteratorPrototype) === IteratorPrototype || (setPrototypeOf ? setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype) : isCallable(CurrentIteratorPrototype[ITERATOR]) || redefine(CurrentIteratorPrototype, ITERATOR, returnThis)), setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, !0, !0), IS_PURE && (Iterators[TO_STRING_TAG] = returnThis)), PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES && (!IS_PURE && CONFIGURABLE_FUNCTION_NAME ? createNonEnumerableProperty(IterablePrototype, 'name', VALUES) : (INCORRECT_VALUES_NAME = !0, defaultIterator = function() { return nativeIterator.call(this); - })), DEFAULT) if (methods = { - values: getIterationMethod(VALUES), - keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), - entries: getIterationMethod(ENTRIES) - }, FORCED) for(KEY in methods)!BUGGY_SAFARI_ITERATORS && !INCORRECT_VALUES_NAME && KEY in IterablePrototype || redefine(IterablePrototype, KEY, methods[KEY]); - else $({ - target: NAME, - proto: !0, - forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME - }, methods); + })), DEFAULT) { + if (methods = { + values: getIterationMethod(VALUES), + keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), + entries: getIterationMethod(ENTRIES) + }, FORCED) for(KEY in methods)!BUGGY_SAFARI_ITERATORS && !INCORRECT_VALUES_NAME && KEY in IterablePrototype || redefine(IterablePrototype, KEY, methods[KEY]); + else $({ + target: NAME, + proto: !0, + forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME + }, methods); + } return (!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator && redefine(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT }), Iterators[NAME] = defaultIterator, methods; @@ -4445,9 +4450,7 @@ var isCallable = __webpack_require__(67106), isObject = __webpack_require__(39817); module.exports = function(input, pref) { var fn, val; - if ('string' === pref && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val; - if (isCallable(fn = input.valueOf) && !isObject(val = fn.call(input))) return val; - if ('string' !== pref && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val; + if ('string' === pref && isCallable(fn = input.toString) && !isObject(val = fn.call(input)) || isCallable(fn = input.valueOf) && !isObject(val = fn.call(input)) || 'string' !== pref && isCallable(fn = input.toString) && !isObject(val = fn.call(input))) return val; throw TypeError("Can't convert object to primitive value"); }; }, @@ -4948,17 +4951,17 @@ }), TypedArrayConstructor.prototype = TypedArrayConstructorPrototype) : (TypedArrayConstructor = wrapper(function(that, data, offset, $length) { anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME); var buffer, byteLength, length, index = 0, byteOffset = 0; - if (isObject(data)) if (isArrayBuffer(data)) { - buffer = data, byteOffset = toOffset(offset, BYTES); - var $len = data.byteLength; - if (void 0 === $length) { - if ($len % BYTES) throw RangeError(WRONG_LENGTH); - if ((byteLength = $len - byteOffset) < 0) throw RangeError(WRONG_LENGTH); - } else if ((byteLength = toLength($length) * BYTES) + byteOffset > $len) throw RangeError(WRONG_LENGTH); - length = byteLength / BYTES; - } else if (isTypedArray(data)) return fromList(TypedArrayConstructor, data); - else return typedArrayFrom.call(TypedArrayConstructor, data); - else byteLength = (length = toIndex(data)) * BYTES, buffer = new ArrayBuffer(byteLength); + if (isObject(data)) { + if (isArrayBuffer(data)) { + buffer = data, byteOffset = toOffset(offset, BYTES); + var $len = data.byteLength; + if (void 0 === $length) { + if ($len % BYTES || (byteLength = $len - byteOffset) < 0) throw RangeError(WRONG_LENGTH); + } else if ((byteLength = toLength($length) * BYTES) + byteOffset > $len) throw RangeError(WRONG_LENGTH); + length = byteLength / BYTES; + } else if (isTypedArray(data)) return fromList(TypedArrayConstructor, data); + else return typedArrayFrom.call(TypedArrayConstructor, data); + } else byteLength = (length = toIndex(data)) * BYTES, buffer = new ArrayBuffer(byteLength); for(setInternalState(that, { buffer: buffer, byteOffset: byteOffset, @@ -6051,7 +6054,7 @@ s = '' === s ? t : s + repeat.call('0', 7 - t.length) + t; } return s; - }, FORCED = nativeToFixed && !0 || !fails(function() { + }, FORCED = !!nativeToFixed || !fails(function() { nativeToFixed.call({}); }); $({ @@ -6071,11 +6074,13 @@ if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits'); if (number != number) return 'NaN'; if (number <= -1000000000000000000000 || number >= 1e21) return String(number); - if (number < 0 && (sign = '-', number = -number), number > 1e-21) if (z = (e = log(number * pow(2, 69, 1)) - 69) < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1), z *= 0x10000000000000, (e = 52 - e) > 0) { - for(multiply(data, 0, z), j = fractDigits; j >= 7;)multiply(data, 1e7, 0), j -= 7; - for(multiply(data, pow(10, j, 1), 0), j = e - 1; j >= 23;)divide(data, 8388608), j -= 23; - divide(data, 1 << j), multiply(data, 1, 1), divide(data, 2), result = dataToString(data); - } else multiply(data, 0, z), multiply(data, 1 << -e, 0), result = dataToString(data) + repeat.call('0', fractDigits); + if (number < 0 && (sign = '-', number = -number), number > 1e-21) { + if (z = (e = log(number * pow(2, 69, 1)) - 69) < 0 ? number * pow(2, -e, 1) : number / pow(2, e, 1), z *= 0x10000000000000, (e = 52 - e) > 0) { + for(multiply(data, 0, z), j = fractDigits; j >= 7;)multiply(data, 1e7, 0), j -= 7; + for(multiply(data, pow(10, j, 1), 0), j = e - 1; j >= 23;)divide(data, 8388608), j -= 23; + divide(data, 1 << j), multiply(data, 1, 1), divide(data, 2), result = dataToString(data); + } else multiply(data, 0, z), multiply(data, 1 << -e, 0), result = dataToString(data) + repeat.call('0', fractDigits); + } return result = fractDigits > 0 ? sign + ((k = result.length) <= fractDigits ? '0.' + repeat.call('0', fractDigits - k) + result : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits)) : sign + result; } }); @@ -6536,8 +6541,7 @@ "use strict"; var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen, $ = __webpack_require__(35437), IS_PURE = __webpack_require__(80627), global = __webpack_require__(19514), getBuiltIn = __webpack_require__(44990), NativePromise = __webpack_require__(91591), redefine = __webpack_require__(78109), redefineAll = __webpack_require__(59855), setPrototypeOf = __webpack_require__(59057), setToStringTag = __webpack_require__(77875), setSpecies = __webpack_require__(53988), aCallable = __webpack_require__(74618), isCallable = __webpack_require__(67106), isObject = __webpack_require__(39817), anInstance = __webpack_require__(51819), inspectSource = __webpack_require__(71975), iterate = __webpack_require__(7261), checkCorrectnessOfIteration = __webpack_require__(34124), speciesConstructor = __webpack_require__(94850), task = __webpack_require__(46660).set, microtask = __webpack_require__(50277), promiseResolve = __webpack_require__(56540), hostReportErrors = __webpack_require__(85033), newPromiseCapabilityModule = __webpack_require__(11098), perform = __webpack_require__(68275), InternalStateModule = __webpack_require__(44670), isForced = __webpack_require__(23736), wellKnownSymbol = __webpack_require__(81019), IS_BROWSER = __webpack_require__(23573), IS_NODE = __webpack_require__(96590), V8_VERSION = __webpack_require__(50661), SPECIES = wellKnownSymbol('species'), PROMISE = 'Promise', getInternalState = InternalStateModule.get, setInternalState = InternalStateModule.set, getInternalPromiseState = InternalStateModule.getterFor(PROMISE), NativePromisePrototype = NativePromise && NativePromise.prototype, PromiseConstructor = NativePromise, PromiseConstructorPrototype = NativePromisePrototype, TypeError = global.TypeError, document = global.document, process = global.process, newPromiseCapability = newPromiseCapabilityModule.f, newGenericPromiseCapability = newPromiseCapability, DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent), NATIVE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent), UNHANDLED_REJECTION = 'unhandledrejection', SUBCLASSING = !1, FORCED = isForced(PROMISE, function() { var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor), GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor); - if (!GLOBAL_CORE_JS_PROMISE && 66 === V8_VERSION) return !0; - if (IS_PURE && !PromiseConstructorPrototype.finally) return !0; + if (!GLOBAL_CORE_JS_PROMISE && 66 === V8_VERSION || IS_PURE && !PromiseConstructorPrototype.finally) return !0; if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return !1; var promise = new PromiseConstructor(function(resolve) { resolve(1); @@ -7477,8 +7481,7 @@ } for(var results = [];;){ var result = regExpExec(rx, S); - if (null === result) break; - if (results.push(result), !global) break; + if (null === result || (results.push(result), !global)) break; '' === toString(result[0]) && (rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode)); } for(var accumulatedResult = '', nextSourcePosition = 0, i = 0; i < results.length; i++){ @@ -8438,18 +8441,21 @@ entries: entries, updateURL: function() {}, updateSearchParams: updateSearchParams - }), void 0 !== init) if (isObject(init)) if (iteratorMethod = getIteratorMethod(init)) for(next = (iterator = getIterator(init, iteratorMethod)).next; !(step = next.call(iterator)).done;){ - if ((first = (entryNext = (entryIterator = getIterator(anObject(step.value))).next).call(entryIterator)).done || (second = entryNext.call(entryIterator)).done || !entryNext.call(entryIterator).done) throw TypeError('Expected sequence with length 2'); - entries.push({ - key: $toString(first.value), - value: $toString(second.value) - }); + }), void 0 !== init) { + if (isObject(init)) { + if (iteratorMethod = getIteratorMethod(init)) for(next = (iterator = getIterator(init, iteratorMethod)).next; !(step = next.call(iterator)).done;){ + if ((first = (entryNext = (entryIterator = getIterator(anObject(step.value))).next).call(entryIterator)).done || (second = entryNext.call(entryIterator)).done || !entryNext.call(entryIterator).done) throw TypeError('Expected sequence with length 2'); + entries.push({ + key: $toString(first.value), + value: $toString(second.value) + }); + } + else for(key in init)hasOwn(init, key) && entries.push({ + key: key, + value: $toString(init[key]) + }); + } else parseSearchParams(entries, 'string' == typeof init ? '?' === init.charAt(0) ? init.slice(1) : init : $toString(init)); } - else for(key in init)hasOwn(init, key) && entries.push({ - key: key, - value: $toString(init[key]) - }); - else parseSearchParams(entries, 'string' == typeof init ? '?' === init.charAt(0) ? init.slice(1) : init : $toString(init)); }, URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; if (redefineAll(URLSearchParamsPrototype, { append: function(name, value) { @@ -8567,12 +8573,10 @@ var EOF, $ = __webpack_require__(35437), DESCRIPTORS = __webpack_require__(87122), USE_NATIVE_URL = __webpack_require__(62902), global = __webpack_require__(19514), defineProperties = __webpack_require__(68381), redefine = __webpack_require__(78109), anInstance = __webpack_require__(51819), has = __webpack_require__(1521), assign = __webpack_require__(59038), arrayFrom = __webpack_require__(83581), codeAt = __webpack_require__(88668).codeAt, toASCII = __webpack_require__(41075), $toString = __webpack_require__(72729), setToStringTag = __webpack_require__(77875), URLSearchParamsModule = __webpack_require__(79085), InternalStateModule = __webpack_require__(44670), NativeURL = global.URL, URLSearchParams = URLSearchParamsModule.URLSearchParams, getInternalSearchParamsState = URLSearchParamsModule.getState, setInternalState = InternalStateModule.set, getInternalURLState = InternalStateModule.getterFor('URL'), floor = Math.floor, pow = Math.pow, INVALID_SCHEME = 'Invalid scheme', INVALID_HOST = 'Invalid host', INVALID_PORT = 'Invalid port', ALPHA = /[A-Za-z]/, ALPHANUMERIC = /[\d+-.A-Za-z]/, DIGIT = /\d/, HEX_START = /^0x/i, OCT = /^[0-7]+$/, DEC = /^\d+$/, HEX = /^[\dA-Fa-f]+$/, FORBIDDEN_HOST_CODE_POINT = /[\0\t\n\r #%/:<>?@[\\\]^|]/, FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\0\t\n\r #/:<>?@[\\\]^|]/, LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u0020]+|[\u0000-\u0020]+$/g, TAB_AND_NEW_LINE = /[\t\n\r]/g, parseHost = function(url, input) { var result, codePoints, index; if ('[' == input.charAt(0)) { - if (']' != input.charAt(input.length - 1)) return INVALID_HOST; - if (!(result = parseIPv6(input.slice(1, -1)))) return INVALID_HOST; + if (']' != input.charAt(input.length - 1) || !(result = parseIPv6(input.slice(1, -1)))) return INVALID_HOST; url.host = result; } else if (isSpecial(url)) { - if (input = toASCII(input), FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST; - if (null === (result = parseIPv4(input))) return INVALID_HOST; + if (input = toASCII(input), FORBIDDEN_HOST_CODE_POINT.test(input) || null === (result = parseIPv4(input))) return INVALID_HOST; url.host = result; } else { if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST; @@ -8622,8 +8626,7 @@ } for(value = length = 0; length < 4 && HEX.test(chr());)value = 16 * value + parseInt(chr(), 16), pointer++, length++; if ('.' == chr()) { - if (0 == length) return; - if (pointer -= length, pieceIndex > 6) return; + if (0 == length || (pointer -= length, pieceIndex > 6)) return; for(numbersSeen = 0; chr();){ if (ipv4Piece = null, numbersSeen > 0) { if ('.' != chr() || !(numbersSeen < 4)) return; @@ -8814,14 +8817,16 @@ state = FILE_HOST; continue; } - if (':' != chr || seenBracket) if (chr == EOF || '/' == chr || '?' == chr || '#' == chr || '\\' == chr && isSpecial(url)) { - if (isSpecial(url) && '' == buffer) return INVALID_HOST; - if (stateOverride && '' == buffer && (includesCredentials(url) || null !== url.port)) return; - if (failure = parseHost(url, buffer)) return failure; - if (buffer = '', state = PATH_START, stateOverride) return; - continue; - } else '[' == chr ? seenBracket = !0 : ']' == chr && (seenBracket = !1), buffer += chr; - else { + if (':' != chr || seenBracket) { + if (chr == EOF || '/' == chr || '?' == chr || '#' == chr || '\\' == chr && isSpecial(url)) { + if (isSpecial(url) && '' == buffer) return INVALID_HOST; + if (stateOverride && '' == buffer && (includesCredentials(url) || null !== url.port)) return; + if (failure = parseHost(url, buffer)) return failure; + if (buffer = '', state = PATH_START, stateOverride) return; + continue; + } + '[' == chr ? seenBracket = !0 : ']' == chr && (seenBracket = !1), buffer += chr; + } else { if ('' == buffer) return INVALID_HOST; if (failure = parseHost(url, buffer)) return failure; if (buffer = '', state = PORT, stateOverride == HOSTNAME) return; @@ -8843,14 +8848,15 @@ break; case FILE: if (url.scheme = 'file', '/' == chr || '\\' == chr) state = FILE_SLASH; - else if (base && 'file' == base.scheme) if (chr == EOF) url.host = base.host, url.path = base.path.slice(), url.query = base.query; - else if ('?' == chr) url.host = base.host, url.path = base.path.slice(), url.query = '', state = QUERY; - else if ('#' == chr) url.host = base.host, url.path = base.path.slice(), url.query = base.query, url.fragment = '', state = FRAGMENT; - else { - startsWithWindowsDriveLetter(codePoints.slice(pointer).join('')) || (url.host = base.host, url.path = base.path.slice(), shortenURLsPath(url)), state = PATH; - continue; - } - else { + else if (base && 'file' == base.scheme) { + if (chr == EOF) url.host = base.host, url.path = base.path.slice(), url.query = base.query; + else if ('?' == chr) url.host = base.host, url.path = base.path.slice(), url.query = '', state = QUERY; + else if ('#' == chr) url.host = base.host, url.path = base.path.slice(), url.query = base.query, url.fragment = '', state = FRAGMENT; + else { + startsWithWindowsDriveLetter(codePoints.slice(pointer).join('')) || (url.host = base.host, url.path = base.path.slice(), shortenURLsPath(url)), state = PATH; + continue; + } + } else { state = PATH; continue; } @@ -8880,10 +8886,11 @@ case PATH_START: if (isSpecial(url)) { if (state = PATH, '/' != chr && '\\' != chr) continue; - } else if (stateOverride || '?' != chr) if (stateOverride || '#' != chr) { - if (chr != EOF && (state = PATH, '/' != chr)) continue; - } else url.fragment = '', state = FRAGMENT; - else url.query = '', state = QUERY; + } else if (stateOverride || '?' != chr) { + if (stateOverride || '#' != chr) { + if (chr != EOF && (state = PATH, '/' != chr)) continue; + } else url.fragment = '', state = FRAGMENT; + } else url.query = '', state = QUERY; break; case PATH: if (chr == EOF || '/' == chr || '\\' == chr && isSpecial(url) || !stateOverride && ('?' == chr || '#' == chr)) { @@ -9662,18 +9669,19 @@ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function(ok) { if (ok) { var href = createHref(location), key = location.key, state = location.state; - if (canUseHistory) if (globalHistory.pushState({ - key: key, - state: state - }, null, href), forceRefresh) window.location.href = href; - else { - var prevIndex = allKeys.indexOf(history.location.key), nextKeys = allKeys.slice(0, prevIndex + 1); - nextKeys.push(location.key), allKeys = nextKeys, setState({ - action: action, - location: location - }); - } - else window.location.href = href; + if (canUseHistory) { + if (globalHistory.pushState({ + key: key, + state: state + }, null, href), forceRefresh) window.location.href = href; + else { + var prevIndex = allKeys.indexOf(history.location.key), nextKeys = allKeys.slice(0, prevIndex + 1); + nextKeys.push(location.key), allKeys = nextKeys, setState({ + action: action, + location: location + }); + } + } else window.location.href = href; } }); }, @@ -9682,18 +9690,19 @@ transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function(ok) { if (ok) { var href = createHref(location), key = location.key, state = location.state; - if (canUseHistory) if (globalHistory.replaceState({ - key: key, - state: state - }, null, href), forceRefresh) window.location.replace(href); - else { - var prevIndex = allKeys.indexOf(history.location.key); - -1 !== prevIndex && (allKeys[prevIndex] = location.key), setState({ - action: action, - location: location - }); - } - else window.location.replace(href); + if (canUseHistory) { + if (globalHistory.replaceState({ + key: key, + state: state + }, null, href), forceRefresh) window.location.replace(href); + else { + var prevIndex = allKeys.indexOf(history.location.key); + -1 !== prevIndex && (allKeys[prevIndex] = location.key), setState({ + action: action, + location: location + }); + } + } else window.location.replace(href); } }); }, @@ -9768,8 +9777,7 @@ if (path !== encodedPath) replaceHashPath(encodedPath); else { var a, b, location = getDOMLocation(), prevLocation = history.location; - if (!forceNextPop && (a = prevLocation, b = location, a.pathname === b.pathname && a.search === b.search && a.hash === b.hash)) return; - if (ignorePath === createPath(location)) return; + if (!forceNextPop && (a = prevLocation, b = location, a.pathname === b.pathname && a.search === b.search && a.hash === b.hash) || ignorePath === createPath(location)) return; ignorePath = null, handlePop(location); } } @@ -10380,8 +10388,7 @@ }; } }(options3), ret = Object.create(null); - if ('string' != typeof query) return ret; - if (!(query = query.trim().replace(/^[?#&]/, ''))) return ret; + if ('string' != typeof query || !(query = query.trim().replace(/^[?#&]/, ''))) return ret; for (const param of query.split('&')){ if ('' === param) continue; let [key, value] = splitOnFirst(options3.decode ? param.replace(/\+/g, ' ') : param, '='); @@ -10911,28 +10918,29 @@ var c = Error.prepareStackTrace; Error.prepareStackTrace = void 0; try { - if (b) if (b = function() { - throw Error(); - }, Object.defineProperty(b.prototype, "props", { - set: function() { + if (b) { + if (b = function() { throw Error(); + }, Object.defineProperty(b.prototype, "props", { + set: function() { + throw Error(); + } + }), "object" == typeof Reflect && Reflect.construct) { + try { + Reflect.construct(b, []); + } catch (k) { + var d = k; + } + Reflect.construct(a, [], b); + } else { + try { + b.call(); + } catch (k) { + d = k; + } + a.call(b.prototype); } - }), "object" == typeof Reflect && Reflect.construct) { - try { - Reflect.construct(b, []); - } catch (k) { - var d = k; - } - Reflect.construct(a, [], b); } else { - try { - b.call(); - } catch (k) { - d = k; - } - a.call(b.prototype); - } - else { try { throw Error(); } catch (k) { @@ -12448,12 +12456,13 @@ } a: { if ("select" === (k = (h = d ? ue(d) : window).nodeName && h.nodeName.toLowerCase()) || "input" === k && "file" === h.type) var Q, J = ve; - else if (me(h)) if (we) J = Fe; - else { - J = De; - var K = Ce; - } - else (k = h.nodeName) && "input" === k.toLowerCase() && ("checkbox" === h.type || "radio" === h.type) && (J = Ee); + else if (me(h)) { + if (we) J = Fe; + else { + J = De; + var K = Ce; + } + } else (k = h.nodeName) && "input" === k.toLowerCase() && ("checkbox" === h.type || "radio" === h.type) && (J = Ee); if (J && (J = J(a12, d))) { ne(g, J, c5, e); break a; @@ -12766,9 +12775,10 @@ function sg(a, b) { for(; null !== a;){ var c = a.alternate; - if ((a.childLanes & b) === b) if (null === c || (c.childLanes & b) === b) break; - else c.childLanes |= b; - else a.childLanes |= b, null !== c && (c.childLanes |= b); + if ((a.childLanes & b) === b) { + if (null === c || (c.childLanes & b) === b) break; + c.childLanes |= b; + } else a.childLanes |= b, null !== c && (c.childLanes |= b); a = a.return; } } @@ -12776,18 +12786,20 @@ ng = a, pg = og = null, null !== (a = a.dependencies) && null !== a.firstContext && (0 != (a.lanes & b) && (ug = !0), a.firstContext = null); } function vg(a, b) { - if (pg !== a && !1 !== b && 0 !== b) if (("number" != typeof b || 1073741823 === b) && (pg = a, b = 1073741823), b = { - context: a, - observedBits: b, - next: null - }, null === og) { - if (null === ng) throw Error(y(308)); - og = b, ng.dependencies = { - lanes: 0, - firstContext: b, - responders: null - }; - } else og = og.next = b; + if (pg !== a && !1 !== b && 0 !== b) { + if (("number" != typeof b || 1073741823 === b) && (pg = a, b = 1073741823), b = { + context: a, + observedBits: b, + next: null + }, null === og) { + if (null === ng) throw Error(y(308)); + og = b, ng.dependencies = { + lanes: 0, + firstContext: b, + responders: null + }; + } else og = og.next = b; + } return a._currentValue; } var wg = !1; @@ -12914,8 +12926,10 @@ callback: f.callback, next: null }, null === n ? (l = n = p, k = A) : n = n.next = p, g |= h; - if (null === (f = f.next)) if (null === (h = e.shared.pending)) break; - else f = h.next, h.next = null, e.lastBaseUpdate = h, e.shared.pending = null; + if (null === (f = f.next)) { + if (null === (h = e.shared.pending)) break; + f = h.next, h.next = null, e.lastBaseUpdate = h, e.shared.pending = null; + } } null === n && (k = A), e.baseState = k, e.firstBaseUpdate = l, e.lastBaseUpdate = n, Dg |= g, a.lanes = g, a.memoizedState = A; } @@ -13105,10 +13119,11 @@ case ta: a: { for(k2 = f.key; null !== d;){ - if (d.key === k2) if (4 === d.tag && d.stateNode.containerInfo === f.containerInfo && d.stateNode.implementation === f.implementation) { - c6(a15, d.sibling), (d = e5(d, f.children || [])).return = a15, a15 = d; - break a; - } else { + if (d.key === k2) { + if (4 === d.tag && d.stateNode.containerInfo === f.containerInfo && d.stateNode.implementation === f.implementation) { + c6(a15, d.sibling), (d = e5(d, f.children || [])).return = a15, a15 = d; + break a; + } c6(a15, d); break; } @@ -13789,24 +13804,27 @@ return (g = a.child, 0 == (e & f) && (e = g.memoizedProps, (c = null !== (c = c.compare) ? c : Je)(e, d) && a.ref === b.ref)) ? hi(a, b, f) : (b.flags |= 1, (a = Tg(g, d)).ref = b.ref, a.return = b, b.child = a); } function ki(a, b, c, d, e, f) { - if (null !== a && Je(a.memoizedProps, d) && a.ref === b.ref) if (ug = !1, 0 == (f & e)) return b.lanes = a.lanes, hi(a, b, f); - else 0 != (16384 & a.flags) && (ug = !0); + if (null !== a && Je(a.memoizedProps, d) && a.ref === b.ref) { + if (ug = !1, 0 == (f & e)) return b.lanes = a.lanes, hi(a, b, f); + 0 != (16384 & a.flags) && (ug = !0); + } return li(a, b, c, d, f); } function mi(a, b, c) { var d = b.pendingProps, e = d.children, f = null !== a ? a.memoizedState : null; - if ("hidden" === d.mode || "unstable-defer-without-hiding" === d.mode) if (0 == (4 & b.mode)) b.memoizedState = { - baseLanes: 0 - }, ni(b, c); - else { - if (0 == (1073741824 & c)) return a = null !== f ? f.baseLanes | c : c, b.lanes = b.childLanes = 1073741824, b.memoizedState = { - baseLanes: a - }, ni(b, a), null; - b.memoizedState = { + if ("hidden" === d.mode || "unstable-defer-without-hiding" === d.mode) { + if (0 == (4 & b.mode)) b.memoizedState = { baseLanes: 0 - }, ni(b, null !== f ? f.baseLanes : c); - } - else null !== f ? (d = f.baseLanes | c, b.memoizedState = null) : d = c, ni(b, d); + }, ni(b, c); + else { + if (0 == (1073741824 & c)) return a = null !== f ? f.baseLanes | c : c, b.lanes = b.childLanes = 1073741824, b.memoizedState = { + baseLanes: a + }, ni(b, a), null; + b.memoizedState = { + baseLanes: 0 + }, ni(b, null !== f ? f.baseLanes : c); + } + } else null !== f ? (d = f.baseLanes | c, b.memoizedState = null) : d = c, ni(b, d); return fi(a, b, e, c), b.child; } function oi(a, b) { @@ -14158,24 +14176,27 @@ return Ff(b.type) && Gf(), null; case 19: if (H(P), null === (d = b.memoizedState)) return null; - if (f = 0 != (64 & b.flags), null === (g = d.rendering)) if (f) Fi(d, !1); - else { - if (0 !== V || null !== a && 0 != (64 & a.flags)) for(a = b.child; null !== a;){ - if (null !== (g = ih(a))) { - for(b.flags |= 64, Fi(d, !1), null !== (f = g.updateQueue) && (b.updateQueue = f, b.flags |= 4), null === d.lastEffect && (b.firstEffect = null), b.lastEffect = d.lastEffect, d = c, c = b.child; null !== c;)f = c, a = d, f.flags &= 2, f.nextEffect = null, f.firstEffect = null, f.lastEffect = null, null === (g = f.alternate) ? (f.childLanes = 0, f.lanes = a, f.child = null, f.memoizedProps = null, f.memoizedState = null, f.updateQueue = null, f.dependencies = null, f.stateNode = null) : (f.childLanes = g.childLanes, f.lanes = g.lanes, f.child = g.child, f.memoizedProps = g.memoizedProps, f.memoizedState = g.memoizedState, f.updateQueue = g.updateQueue, f.type = g.type, a = g.dependencies, f.dependencies = null === a ? null : { - lanes: a.lanes, - firstContext: a.firstContext - }), c = c.sibling; - return I(P, 1 & P.current | 2), b.child; + if (f = 0 != (64 & b.flags), null === (g = d.rendering)) { + if (f) Fi(d, !1); + else { + if (0 !== V || null !== a && 0 != (64 & a.flags)) for(a = b.child; null !== a;){ + if (null !== (g = ih(a))) { + for(b.flags |= 64, Fi(d, !1), null !== (f = g.updateQueue) && (b.updateQueue = f, b.flags |= 4), null === d.lastEffect && (b.firstEffect = null), b.lastEffect = d.lastEffect, d = c, c = b.child; null !== c;)f = c, a = d, f.flags &= 2, f.nextEffect = null, f.firstEffect = null, f.lastEffect = null, null === (g = f.alternate) ? (f.childLanes = 0, f.lanes = a, f.child = null, f.memoizedProps = null, f.memoizedState = null, f.updateQueue = null, f.dependencies = null, f.stateNode = null) : (f.childLanes = g.childLanes, f.lanes = g.lanes, f.child = g.child, f.memoizedProps = g.memoizedProps, f.memoizedState = g.memoizedState, f.updateQueue = g.updateQueue, f.type = g.type, a = g.dependencies, f.dependencies = null === a ? null : { + lanes: a.lanes, + firstContext: a.firstContext + }), c = c.sibling; + return I(P, 1 & P.current | 2), b.child; + } + a = a.sibling; } - a = a.sibling; + null !== d.tail && O() > Ji && (b.flags |= 64, f = !0, Fi(d, !1), b.lanes = 33554432); + } + } else { + if (!f) { + if (null !== (a = ih(g))) { + if (b.flags |= 64, f = !0, null !== (c = a.updateQueue) && (b.updateQueue = c, b.flags |= 4), Fi(d, !0), null === d.tail && "hidden" === d.tailMode && !g.alternate && !lh) return null !== (b = b.lastEffect = d.lastEffect) && (b.nextEffect = null), null; + } else 2 * O() - d.renderingStartTime > Ji && 1073741824 !== c && (b.flags |= 64, f = !0, Fi(d, !1), b.lanes = 33554432); } - null !== d.tail && O() > Ji && (b.flags |= 64, f = !0, Fi(d, !1), b.lanes = 33554432); - } - else { - if (!f) if (null !== (a = ih(g))) { - if (b.flags |= 64, f = !0, null !== (c = a.updateQueue) && (b.updateQueue = c, b.flags |= 4), Fi(d, !0), null === d.tail && "hidden" === d.tailMode && !g.alternate && !lh) return null !== (b = b.lastEffect = d.lastEffect) && (b.nextEffect = null), null; - } else 2 * O() - d.renderingStartTime > Ji && 1073741824 !== c && (b.flags |= 64, f = !0, Fi(d, !1), b.lanes = 33554432); d.isBackwards ? (g.sibling = b.child, b.child = g) : (null !== (c = d.last) ? c.sibling = g : b.child = g, d.last = g); } return null !== d.tail ? (c = d.tail, d.rendering = c, d.tail = c.sibling, d.lastEffect = b.lastEffect, d.renderingStartTime = O(), c.sibling = null, b = P.current, I(P, f ? 1 & b | 2 : 1 & b), c) : null; @@ -14274,17 +14295,22 @@ default: "function" != typeof e.onClick && "function" == typeof d.onClick && (a.onclick = jf); } - for(l in vb(c, d), c = null, e)if (!d.hasOwnProperty(l) && e.hasOwnProperty(l) && null != e[l]) if ("style" === l) { - var h = e[l]; - for(g in h)h.hasOwnProperty(g) && (c || (c = {}), c[g] = ""); - } else "dangerouslySetInnerHTML" !== l && "children" !== l && "suppressContentEditableWarning" !== l && "suppressHydrationWarning" !== l && "autoFocus" !== l && (ca.hasOwnProperty(l) ? f || (f = []) : (f = f || []).push(l, null)); + for(l in vb(c, d), c = null, e)if (!d.hasOwnProperty(l) && e.hasOwnProperty(l) && null != e[l]) { + if ("style" === l) { + var h = e[l]; + for(g in h)h.hasOwnProperty(g) && (c || (c = {}), c[g] = ""); + } else "dangerouslySetInnerHTML" !== l && "children" !== l && "suppressContentEditableWarning" !== l && "suppressHydrationWarning" !== l && "autoFocus" !== l && (ca.hasOwnProperty(l) ? f || (f = []) : (f = f || []).push(l, null)); + } for(l in d){ var k = d[l]; - if (h = null != e ? e[l] : void 0, d.hasOwnProperty(l) && k !== h && (null != k || null != h)) if ("style" === l) if (h) { - for(g in h)!h.hasOwnProperty(g) || k && k.hasOwnProperty(g) || (c || (c = {}), c[g] = ""); - for(g in k)k.hasOwnProperty(g) && h[g] !== k[g] && (c || (c = {}), c[g] = k[g]); - } else c || (f || (f = []), f.push(l, c)), c = k; - else "dangerouslySetInnerHTML" === l ? (k = k ? k.__html : void 0, h = h ? h.__html : void 0, null != k && h !== k && (f = f || []).push(l, k)) : "children" === l ? "string" != typeof k && "number" != typeof k || (f = f || []).push(l, "" + k) : "suppressContentEditableWarning" !== l && "suppressHydrationWarning" !== l && (ca.hasOwnProperty(l) ? (null != k && "onScroll" === l && G("scroll", a), f || h === k || (f = [])) : "object" == typeof k && null !== k && k.$$typeof === Ga ? k.toString() : (f = f || []).push(l, k)); + if (h = null != e ? e[l] : void 0, d.hasOwnProperty(l) && k !== h && (null != k || null != h)) { + if ("style" === l) { + if (h) { + for(g in h)!h.hasOwnProperty(g) || k && k.hasOwnProperty(g) || (c || (c = {}), c[g] = ""); + for(g in k)k.hasOwnProperty(g) && h[g] !== k[g] && (c || (c = {}), c[g] = k[g]); + } else c || (f || (f = []), f.push(l, c)), c = k; + } else "dangerouslySetInnerHTML" === l ? (k = k ? k.__html : void 0, h = h ? h.__html : void 0, null != k && h !== k && (f = f || []).push(l, k)) : "children" === l ? "string" != typeof k && "number" != typeof k || (f = f || []).push(l, "" + k) : "suppressContentEditableWarning" !== l && "suppressHydrationWarning" !== l && (ca.hasOwnProperty(l) ? (null != k && "onScroll" === l && G("scroll", a), f || h === k || (f = [])) : "object" == typeof k && null !== k && k.$$typeof === Ga ? k.toString() : (f = f || []).push(l, k)); + } } c && (f = f || []).push("style", c); var l = f; @@ -14326,12 +14352,14 @@ var Ui = "function" == typeof WeakSet ? WeakSet : Set; function Vi(a) { var b = a.ref; - if (null !== b) if ("function" == typeof b) try { - b(null); - } catch (c) { - Wi(a, c); + if (null !== b) { + if ("function" == typeof b) try { + b(null); + } catch (c) { + Wi(a, c); + } + else b.current = null; } - else b.current = null; } function Xi(a, b) { switch(b.tag){ @@ -14455,13 +14483,15 @@ var c = a = a.next; do { var d = c, e = d.destroy; - if (d = d.tag, void 0 !== e) if (0 != (4 & d)) Zi(b, c); - else { - d = b; - try { - e(); - } catch (f) { - Wi(d, f); + if (d = d.tag, void 0 !== e) { + if (0 != (4 & d)) Zi(b, c); + else { + d = b; + try { + e(); + } catch (f) { + Wi(d, f); + } } } c = c.next; @@ -14519,11 +14549,7 @@ } c = c.return; } - for(c.sibling.return = c.return, c = c.sibling; 5 !== c.tag && 6 !== c.tag && 18 !== c.tag;){ - if (2 & c.flags) continue b; - if (null === c.child || 4 === c.tag) continue b; - c.child.return = c, c = c.child; - } + for(c.sibling.return = c.return, c = c.sibling; 5 !== c.tag && 6 !== c.tag && 18 !== c.tag;)if (2 & c.flags || null === c.child || 4 === c.tag) continue b; if (!(2 & c.flags)) { c = c.stateNode; break a; @@ -14936,10 +14962,12 @@ u.add(l), p.updateQueue = u; } else z.add(l); if (0 == (2 & p.mode)) { - if (p.flags |= 64, h.flags |= 16384, h.flags &= -2981, 1 === h.tag) if (null === h.alternate) h.tag = 17; - else { - var t = zg(-1, 1); - t.tag = 2, Ag(h, t); + if (p.flags |= 64, h.flags |= 16384, h.flags &= -2981, 1 === h.tag) { + if (null === h.alternate) h.tag = 17; + else { + var t = zg(-1, 1); + t.tag = 2, Ag(h, t); + } } h.lanes |= 1; break a; @@ -15478,48 +15506,49 @@ } ck = function(a23, b, c) { var d = b.lanes; - if (null !== a23) if (a23.memoizedProps !== b.pendingProps || N.current) ug = !0; - else if (0 != (c & d)) ug = 0 != (16384 & a23.flags); - else { - switch(ug = !1, b.tag){ - case 3: - ri(b), sh(); - break; - case 5: - gh(b); - break; - case 1: - Ff(b.type) && Jf(b); - break; - case 4: - eh(b, b.stateNode.containerInfo); - break; - case 10: - d = b.memoizedProps.value; - var e = b.type._context; - I(mg, e._currentValue), e._currentValue = d; - break; - case 13: - if (null !== b.memoizedState) { - if (0 != (c & b.child.childLanes)) return ti(a23, b, c); - return I(P, 1 & P.current), null !== (b = hi(a23, b, c)) ? b.sibling : null; - } - I(P, 1 & P.current); - break; - case 19: - if (d = 0 != (c & b.childLanes), 0 != (64 & a23.flags)) { - if (d) return Ai(a23, b, c); - b.flags |= 64; - } - if (null !== (e = b.memoizedState) && (e.rendering = null, e.tail = null, e.lastEffect = null), I(P, P.current), !d) return null; - break; - case 23: - case 24: - return b.lanes = 0, mi(a23, b, c); + if (null !== a23) { + if (a23.memoizedProps !== b.pendingProps || N.current) ug = !0; + else if (0 != (c & d)) ug = 0 != (16384 & a23.flags); + else { + switch(ug = !1, b.tag){ + case 3: + ri(b), sh(); + break; + case 5: + gh(b); + break; + case 1: + Ff(b.type) && Jf(b); + break; + case 4: + eh(b, b.stateNode.containerInfo); + break; + case 10: + d = b.memoizedProps.value; + var e = b.type._context; + I(mg, e._currentValue), e._currentValue = d; + break; + case 13: + if (null !== b.memoizedState) { + if (0 != (c & b.child.childLanes)) return ti(a23, b, c); + return I(P, 1 & P.current), null !== (b = hi(a23, b, c)) ? b.sibling : null; + } + I(P, 1 & P.current); + break; + case 19: + if (d = 0 != (c & b.childLanes), 0 != (64 & a23.flags)) { + if (d) return Ai(a23, b, c); + b.flags |= 64; + } + if (null !== (e = b.memoizedState) && (e.rendering = null, e.tail = null, e.lastEffect = null), I(P, P.current), !d) return null; + break; + case 23: + case 24: + return b.lanes = 0, mi(a23, b, c); + } + return hi(a23, b, c); } - return hi(a23, b, c); - } - else ug = !1; + } else ug = !1; switch(b.lanes = 0, b.tag){ case 2: if (d = b.type, null !== a23 && (a23.alternate = null, b.alternate = null, b.flags |= 2), a23 = b.pendingProps, e = Ef(b, M.current), tg(b, c), e = Ch(null, b, d, a23, e, c), b.flags |= 1, "object" == typeof e && null !== e && "function" == typeof e.render && void 0 === e.$$typeof) { @@ -15594,36 +15623,38 @@ a: { d = b.type._context, e = b.pendingProps, g = b.memoizedProps, f = e.value; var h = b.type._context; - if (I(mg, h._currentValue), h._currentValue = f, null !== g) if (0 == (f = He(h = g.value, f) ? 0 : ("function" == typeof d._calculateChangedBits ? d._calculateChangedBits(h, f) : 1073741823) | 0)) { - if (g.children === e.children && !N.current) { - b = hi(a23, b, c); - break a; - } - } else for(null !== (h = b.child) && (h.return = b); null !== h;){ - var k = h.dependencies; - if (null !== k) { - g = h.child; - for(var l = k.firstContext; null !== l;){ - if (l.context === d && 0 != (l.observedBits & f)) { - 1 === h.tag && ((l = zg(-1, c & -c)).tag = 2, Ag(h, l)), h.lanes |= c, null !== (l = h.alternate) && (l.lanes |= c), sg(h.return, c), k.lanes |= c; + if (I(mg, h._currentValue), h._currentValue = f, null !== g) { + if (0 == (f = He(h = g.value, f) ? 0 : ("function" == typeof d._calculateChangedBits ? d._calculateChangedBits(h, f) : 1073741823) | 0)) { + if (g.children === e.children && !N.current) { + b = hi(a23, b, c); + break a; + } + } else for(null !== (h = b.child) && (h.return = b); null !== h;){ + var k = h.dependencies; + if (null !== k) { + g = h.child; + for(var l = k.firstContext; null !== l;){ + if (l.context === d && 0 != (l.observedBits & f)) { + 1 === h.tag && ((l = zg(-1, c & -c)).tag = 2, Ag(h, l)), h.lanes |= c, null !== (l = h.alternate) && (l.lanes |= c), sg(h.return, c), k.lanes |= c; + break; + } + l = l.next; + } + } else g = 10 === h.tag && h.type === b.type ? null : h.child; + if (null !== g) g.return = h; + else for(g = h; null !== g;){ + if (g === b) { + g = null; break; } - l = l.next; + if (null !== (h = g.sibling)) { + h.return = g.return, g = h; + break; + } + g = g.return; } - } else g = 10 === h.tag && h.type === b.type ? null : h.child; - if (null !== g) g.return = h; - else for(g = h; null !== g;){ - if (g === b) { - g = null; - break; - } - if (null !== (h = g.sibling)) { - h.return = g.return, g = h; - break; - } - g = g.return; + h = g; } - h = g; } fi(a23, b, e.children, c), b = b.child; } @@ -17200,10 +17231,12 @@ } } function U(a) { - if (S = !1, T(a), !R) if (null !== J(L)) R = !0, f(V); - else { - var b = J(M); - null !== b && g(U, b.startTime - a); + if (S = !1, T(a), !R) { + if (null !== J(L)) R = !0, f(V); + else { + var b = J(M); + null !== b && g(U, b.startTime - a); + } } } function V(a, b) { diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/2558/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2558/1/output.js index 91899c56c58..69b7846941d 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/2558/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/2558/1/output.js @@ -110,13 +110,14 @@ } function parseToDict(search) { var dict = {}; - if ("object" == typeof search) 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 for(var key in search)search.hasOwnProperty(key) && appendTo(dict, key, search[key]); - else { + if ("object" == typeof search) { + 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 for(var key in search)search.hasOwnProperty(key) && appendTo(dict, key, search[key]); + } else { 0 === search.indexOf("?") && (search = search.slice(1)); for(var pairs = search.split("&"), j = 0; j < pairs.length; j++){ var value = pairs[j], index = value.indexOf('='); diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/4249/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/4249/output.js index 50406c0e823..308583da53f 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/4249/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/4249/output.js @@ -1,5 +1,5 @@ foo({ bar: function(data, baz) { - !(!(baz ? data.quxA : data.quxB) && !(baz ? data.corgeA : data.corgeB) && (baz ? data.get("waldo") : data.waldo)) ? (baz ? data.quxA : data.quxB) || (baz ? data.get("waldo") : data.waldo) || (baz ? !data.corgeA : !data.corgeB) || pass() : pass(); + !(!(baz ? data.quxA : data.quxB) && !(baz ? data.corgeA : data.corgeB) && (baz ? data.get("waldo") : data.waldo)) && ((baz ? data.quxA : data.quxB) || (baz ? data.get("waldo") : data.waldo) || (baz ? !data.corgeA : !data.corgeB)) || pass(); } }); diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/d3-time-format/3/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/d3-time-format/3/output.js index 755d8d9263f..476335f1cc2 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/d3-time-format/3/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/d3-time-format/3/output.js @@ -34,8 +34,10 @@ return newInterval(function(date) { if (date >= date) for(; floori(date), !test(date);)date.setTime(date - 1); }, function(date, step) { - if (date >= date) if (step < 0) for(; ++step <= 0;)for(; offseti(date, -1), !test(date);); - else for(; --step >= 0;)for(; offseti(date, 1), !test(date);); + if (date >= date) { + if (step < 0) for(; ++step <= 0;)for(; offseti(date, -1), !test(date);); + else for(; --step >= 0;)for(; offseti(date, 1), !test(date);); + } }); }, count && (interval.count = function(start, end) { return t0.setTime(+start), t1.setTime(+end), floori(t0), floori(t1), Math.floor(count(t0, t1)); diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/emotion/react/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/emotion/react/1/output.js index 0236de73ea4..0f780bb68c1 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/emotion/react/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/emotion/react/1/output.js @@ -340,17 +340,19 @@ case 59: characters += ';'; default: - if (Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets), 123 === character) if (0 === offset) parse(characters, root, reference, reference, props, rulesets, length, points, children); - else switch(atrule){ - case 100: - case 109: - case 115: - parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children); - break; - default: - parse(characters, reference, reference, reference, [ - '' - ], children, length, points, children); + if (Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets), 123 === character) { + if (0 === offset) parse(characters, root, reference, reference, props, rulesets, length, points, children); + else switch(atrule){ + case 100: + case 109: + case 115: + parse(value, reference, reference, rule && Utility_append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children); + break; + default: + parse(characters, reference, reference, reference, [ + '' + ], children, length, points, children); + } } } index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-core/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-core/1/output.js index 21d1c80bc48..fb4c4de5be7 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-core/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-core/1/output.js @@ -722,17 +722,18 @@ String(d1) ]), mc(c1.h, "t", d1), a3.C = 0, c1 = a3.l.H, a3.h = new fc, a3.g = nc(a3.l, c1 ? b1 : null, !a3.s), 0 < a3.O && (a3.L = new Ib(q(a3.Ia, a3, a3.g), a3.O)), Kb(a3.V, a3.g, "readystatechange", a3.gb), b1 = a3.H ? ya(a3.H) : {}, a3.s ? (a3.u || (a3.u = "POST"), b1["Content-Type"] = "application/x-www-form-urlencoded", a3.g.ea(a3.A, a3.u, a3.s, b1)) : (a3.u = "GET", a3.g.ea(a3.A, a3.u, null, b1)), I(1), function(a, b, c, d, e, f) { a.info(function() { - if (a.g) if (f) for(var h = "", n = f.split("&"), u = 0; u < n.length; u++){ - var m = n[u].split("="); - if (1 < m.length) { - var r = m[0]; - m = m[1]; - var G = r.split("_"); - h = 2 <= G.length && "type" == G[1] ? h + (r + "=" + m + "&") : h + (r + "=redacted&"); + if (a.g) { + if (f) for(var h = "", n = f.split("&"), u = 0; u < n.length; u++){ + var m = n[u].split("="); + if (1 < m.length) { + var r = m[0]; + m = m[1]; + var G = r.split("_"); + h = 2 <= G.length && "type" == G[1] ? h + (r + "=" + m + "&") : h + (r + "=redacted&"); + } } - } - else h = null; - else h = f; + else h = null; + } else h = f; return "XMLHTTP REQ (" + d + ") [attempt " + e + "]: " + b + "\n" + c + "\n" + h; }); }(a3.j, a3.u, a3.A, a3.m, a3.X, a3.s); @@ -787,8 +788,10 @@ var e = d; if (0 == e[0]) { a: if (!c.u) { - if (c.g) if (c.g.F + 3E3 < a.F) zc(c), Ac(c); - else break a; + if (c.g) { + if (c.g.F + 3E3 < a.F) zc(c), Ac(c); + else break a; + } Bc(c), J(18); } } else c.ta = e[1], 0 < c.ta - c.U && 37500 > e[2] && c.N && 0 == c.A && !c.v && (c.v = K(q(c.ab, c), 6E3)); @@ -801,36 +804,37 @@ } else Q(c, 11); } else if ((a.J || c.g == a) && zc(c), !sa(b)) for(e = c.Ca.g.parse(b), b = 0; b < e.length; b++){ let m = e[b]; - if (c.U = m[0], m = m[1], 2 == c.G) if ("c" == m[0]) { - c.J = m[1], c.la = m[2]; - const r = m[3]; - null != r && (c.ma = r, c.h.info("VER=" + c.ma)); - const G = m[4]; - null != G && (c.za = G, c.h.info("SVER=" + c.za)); - const Da = m[5]; - null != Da && "number" == typeof Da && 0 < Da && (d = 1.5 * Da, c.K = d, c.h.info("backChannelRequestTimeoutMs_=" + d)), d = c; - const ca = a.g; - if (ca) { - const Ea = ca.g ? ca.g.getResponseHeader("X-Client-Wire-Protocol") : null; - if (Ea) { - var f = d.i; - !f.g && (w(Ea, "spdy") || w(Ea, "quic") || w(Ea, "h2")) && (f.j = f.l, f.g = new Set, f.h && (Dc(f, f.h), f.h = null)); + if (c.U = m[0], m = m[1], 2 == c.G) { + if ("c" == m[0]) { + c.J = m[1], c.la = m[2]; + const r = m[3]; + null != r && (c.ma = r, c.h.info("VER=" + c.ma)); + const G = m[4]; + null != G && (c.za = G, c.h.info("SVER=" + c.za)); + const Da = m[5]; + null != Da && "number" == typeof Da && 0 < Da && (d = 1.5 * Da, c.K = d, c.h.info("backChannelRequestTimeoutMs_=" + d)), d = c; + const ca = a.g; + if (ca) { + const Ea = ca.g ? ca.g.getResponseHeader("X-Client-Wire-Protocol") : null; + if (Ea) { + var f = d.i; + !f.g && (w(Ea, "spdy") || w(Ea, "quic") || w(Ea, "h2")) && (f.j = f.l, f.g = new Set, f.h && (Dc(f, f.h), f.h = null)); + } + if (d.D) { + const xb = ca.g ? ca.g.getResponseHeader("X-HTTP-Session-Id") : null; + xb && (d.sa = xb, R(d.F, d.D, xb)); + } } - if (d.D) { - const xb = ca.g ? ca.g.getResponseHeader("X-HTTP-Session-Id") : null; - xb && (d.sa = xb, R(d.F, d.D, xb)); - } - } - c.G = 3, c.j && c.j.xa(), c.$ && (c.O = Date.now() - a.F, c.h.info("Handshake RTT: " + c.O + "ms")), d = c; - var h = a; - if (d.oa = Ec(d, d.H ? d.la : null, d.W), h.J) { - Fc(d.i, h); - var n = h, u = d.K; - u && n.setTimeout(u), n.B && (pc(n), lc(n)), d.g = h; - } else Gc(d); - 0 < c.l.length && Hc(c); - } else "stop" != m[0] && "close" != m[0] || Q(c, 7); - else 3 == c.G && ("stop" == m[0] || "close" == m[0] ? "stop" == m[0] ? Q(c, 7) : Ic(c) : "noop" != m[0] && c.j && c.j.wa(m), c.A = 0); + c.G = 3, c.j && c.j.xa(), c.$ && (c.O = Date.now() - a.F, c.h.info("Handshake RTT: " + c.O + "ms")), d = c; + var h = a; + if (d.oa = Ec(d, d.H ? d.la : null, d.W), h.J) { + Fc(d.i, h); + var n = h, u = d.K; + u && n.setTimeout(u), n.B && (pc(n), lc(n)), d.g = h; + } else Gc(d); + 0 < c.l.length && Hc(c); + } else "stop" != m[0] && "close" != m[0] || Q(c, 7); + } else 3 == c.G && ("stop" == m[0] || "close" == m[0] ? "stop" == m[0] ? Q(c, 7) : Ic(c) : "noop" != m[0] && c.j && c.j.wa(m), c.A = 0); } } I(4); @@ -865,8 +869,10 @@ if (1 < c) { if (c % 2) throw Error("Uneven number of arguments"); for(var d = 0; d < c; d += 2)this.set(arguments[d], arguments[d + 1]); - } else if (a) if (a instanceof S) for(c = a.T(), d = 0; d < c.length; d++)this.set(c[d], a.get(c[d])); - else for(d in a)this.set(d, a[d]); + } else if (a) { + if (a instanceof S) for(c = a.T(), d = 0; d < c.length; d++)this.set(c[d], a.get(c[d])); + else for(d in a)this.set(d, a[d]); + } } function Lc(a) { if (a.i != a.g.length) { @@ -1204,14 +1210,16 @@ }, k.abort = function() { this.response = this.responseText = "", this.v = new Headers, this.status = 0, this.j && this.j.cancel("Request was aborted."), 1 <= this.readyState && this.g && 4 != this.readyState && (this.g = !1, td(this)), this.readyState = rd; }, k.Va = function(a) { - if (this.g && (this.l = a, this.h || (this.status = this.l.status, this.statusText = this.l.statusText, this.h = a.headers, this.readyState = 2, sd(this)), this.g && (this.readyState = 3, sd(this), this.g))) if ("arraybuffer" === this.responseType) a.arrayBuffer().then(this.Ta.bind(this), this.ha.bind(this)); - else if (void 0 !== l.ReadableStream && "body" in a) { - if (this.j = a.body.getReader(), this.u) { - if (this.responseType) throw Error('responseType must be empty for "streamBinaryChunks" mode responses.'); - this.response = []; - } else this.response = this.responseText = "", this.A = new TextDecoder; - ud(this); - } else a.text().then(this.Ua.bind(this), this.ha.bind(this)); + if (this.g && (this.l = a, this.h || (this.status = this.l.status, this.statusText = this.l.statusText, this.h = a.headers, this.readyState = 2, sd(this)), this.g && (this.readyState = 3, sd(this), this.g))) { + if ("arraybuffer" === this.responseType) a.arrayBuffer().then(this.Ta.bind(this), this.ha.bind(this)); + else if (void 0 !== l.ReadableStream && "body" in a) { + if (this.j = a.body.getReader(), this.u) { + if (this.responseType) throw Error('responseType must be empty for "streamBinaryChunks" mode responses.'); + this.response = []; + } else this.response = this.responseText = "", this.A = new TextDecoder; + ud(this); + } else a.text().then(this.Ua.bind(this), this.ha.bind(this)); + } }, k.Sa = function(a) { if (this.g) { if (this.u && a.value) this.response.push(a.value); @@ -1232,7 +1240,7 @@ }, k.setRequestHeader = function(a, b) { this.v.append(a, b); }, k.getResponseHeader = function(a) { - return this.h ? this.h.get(a.toLowerCase()) || "" : ""; + return this.h && this.h.get(a.toLowerCase()) || ""; }, k.getAllResponseHeaders = function() { if (!this.h) return ""; const a = [], b = this.h.entries(); @@ -1357,7 +1365,7 @@ }), b6), "string" == typeof a ? null != c8 && encodeURIComponent(String(c8)) : R(a, b, c8)); } function Hd(a, b, c) { - return c && c.internalChannelParams ? c.internalChannelParams[a] || b : b; + return c && c.internalChannelParams && c.internalChannelParams[a] || b; } function Id(a) { this.za = 0, this.l = [], this.h = new Mb, this.la = this.oa = this.F = this.W = this.g = this.sa = this.D = this.aa = this.o = this.P = this.s = null, this.Za = this.V = 0, this.Xa = Hd("failFast", !1, a), this.N = this.v = this.u = this.m = this.j = null, this.X = !0, this.I = this.ta = this.U = -1, this.Y = this.A = this.C = 0, this.Pa = Hd("baseRetryDelayMs", 5E3, a), this.$a = Hd("retryDelaySeedMs", 1E4, a), this.Ya = Hd("forwardChannelMaxRetries", 2, a), this.ra = Hd("forwardChannelRequestTimeoutMs", 2E4, a), this.qa = a && a.xmlHttpFactory || void 0, this.Ba = a && a.Yb || !1, this.K = void 0, this.H = a && a.supportsCrossDomainXhr || !1, this.J = "", this.i = new gd(a && a.concurrentRequestLimit), this.Ca = new ld, this.ja = a && a.fastHandshake || !1, this.Ra = a && a.Wb || !1, a && a.Aa && this.h.Aa(), a && a.forceLongPolling && (this.X = !1), this.$ = !this.ja && this.X && a && a.detectBufferingProxy || !1, this.ka = void 0, this.O = 0, this.L = !1, this.B = null, this.Wa = !a || !1 !== a.Xb; @@ -1442,7 +1450,7 @@ null != a.v && (l.clearTimeout(a.v), a.v = null); } function uc(a, b) { - var a8, b7, c = null; + var c = null; if (a.g == b) { zc(a), wc(a), a.g = null; var d = 2; @@ -1451,12 +1459,13 @@ c = b.D, Fc(a.i, b), d = 1; } if (a.I = b.N, 0 != a.G) { - if (b.i) if (1 == d) { - c = b.s ? b.s.length : 0, b = Date.now() - b.F; - var e = a.C; - D(d = Sb(), new Vb(d, c, b, e)), Hc(a); - } else Gc(a); - else if (3 == (e = b.o) || 0 == e && 0 < a.I || !(1 == d && (a8 = a, b7 = b, !(Cc(a8.i) >= a8.i.j - (a8.m ? 1 : 0)) && (a8.m ? (a8.l = b7.D.concat(a8.l), !0) : 1 != a8.G && 2 != a8.G && !(a8.C >= (a8.Xa ? 0 : a8.Ya)) && (a8.m = K(q(a8.Ha, a8, b7), Od(a8, a8.C)), a8.C++, !0))) || 2 == d && Bc(a))) switch(c && 0 < c.length && ((b = a.i).i = b.i.concat(c)), e){ + if (b.i) { + if (1 == d) { + c = b.s ? b.s.length : 0, b = Date.now() - b.F; + var a8, b7, e = a.C; + D(d = Sb(), new Vb(d, c, b, e)), Hc(a); + } else Gc(a); + } else if (3 == (e = b.o) || 0 == e && 0 < a.I || !(1 == d && (a8 = a, b7 = b, !(Cc(a8.i) >= a8.i.j - (a8.m ? 1 : 0)) && (a8.m ? (a8.l = b7.D.concat(a8.l), !0) : 1 != a8.G && 2 != a8.G && !(a8.C >= (a8.Xa ? 0 : a8.Ya)) && (a8.m = K(q(a8.Ha, a8, b7), Od(a8, a8.C)), a8.C++, !0))) || 2 == d && Bc(a))) switch(c && 0 < c.length && ((b = a.i).i = b.i.concat(c)), e){ case 1: Q(a, 5); break; @@ -1639,37 +1648,39 @@ this.h.info("Origin Trials invoked: " + a); } catch (b) {} }, k.Ha = function(a) { - if (this.m) if (this.m = null, 1 == this.G) { - if (!a) { - this.V = Math.floor(1E5 * Math.random()), a = this.V++; - const e = new M(this, this.h, a, void 0); - let f = this.s; - if (this.P && (f ? Aa(f = ya(f), this.P) : f = this.P), null === this.o && (e.H = f), this.ja) a: { - for(var b = 0, c = 0; c < this.l.length; c++){ - b: { - var d = this.l[c]; - if ("__data__" in d.g && "string" == typeof (d = d.g.__data__)) { - d = d.length; - break b; + if (this.m) { + if (this.m = null, 1 == this.G) { + if (!a) { + this.V = Math.floor(1E5 * Math.random()), a = this.V++; + const e = new M(this, this.h, a, void 0); + let f = this.s; + if (this.P && (f ? Aa(f = ya(f), this.P) : f = this.P), null === this.o && (e.H = f), this.ja) a: { + for(var b = 0, c = 0; c < this.l.length; c++){ + b: { + var d = this.l[c]; + if ("__data__" in d.g && "string" == typeof (d = d.g.__data__)) { + d = d.length; + break b; + } + d = void 0; + } + if (void 0 === d) break; + if (4096 < (b += d)) { + b = c; + break a; + } + if (4096 === b || c === this.l.length - 1) { + b = c + 1; + break a; } - d = void 0; - } - if (void 0 === d) break; - if (4096 < (b += d)) { - b = c; - break a; - } - if (4096 === b || c === this.l.length - 1) { - b = c + 1; - break a; } + b = 1E3; } - b = 1E3; + else b = 1E3; + b = Pd(this, e, b), R(c = N(this.F), "RID", a), R(c, "CVER", 22), this.D && R(c, "X-HTTP-Session-Id", this.D), Kd(this, c), this.o && f && Gd(c, this.o, f), Dc(this.i, e), this.Ra && R(c, "TYPE", "init"), this.ja ? (R(c, "$req", b), R(c, "SID", "null"), e.$ = !0, ic(e, c, null)) : ic(e, c, b), this.G = 2; } - else b = 1E3; - b = Pd(this, e, b), R(c = N(this.F), "RID", a), R(c, "CVER", 22), this.D && R(c, "X-HTTP-Session-Id", this.D), Kd(this, c), this.o && f && Gd(c, this.o, f), Dc(this.i, e), this.Ra && R(c, "TYPE", "init"), this.ja ? (R(c, "$req", b), R(c, "SID", "null"), e.$ = !0, ic(e, c, null)) : ic(e, c, b), this.G = 2; - } - } else 3 == this.G && (a ? Qd(this, a) : 0 == this.l.length || id(this.i) || Qd(this)); + } else 3 == this.G && (a ? Qd(this, a) : 0 == this.l.length || id(this.i) || Qd(this)); + } }, k.Ga = function() { if (this.u = null, Rd(this), this.$ && !(this.L || null == this.g || 0 >= this.O)) { var a = 2 * this.O; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-firestore/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-firestore/1/output.js index a67b0c8dcb5..afd816fafe3 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-firestore/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/firebase-firestore/1/output.js @@ -219,10 +219,8 @@ X.T = -1; class it { constructor(t, e){ - if (this.seconds = t, this.nanoseconds = e, e < 0) throw new j(K.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e); - if (e >= 1e9) throw new j(K.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e); - if (t < -62135596800) throw new j(K.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t); - if (t >= 253402300800) throw new j(K.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t); + if (this.seconds = t, this.nanoseconds = e, e < 0 || e >= 1e9) throw new j(K.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e); + if (t < -62135596800 || t >= 253402300800) throw new j(K.INVALID_ARGUMENT, "Timestamp seconds out of range: " + t); } static now() { return it.fromMillis(Date.now()); @@ -884,8 +882,7 @@ } function zt(t, e) { var n, s; - if (t.limit !== e.limit) return !1; - if (t.orderBy.length !== e.orderBy.length) return !1; + if (t.limit !== e.limit || t.orderBy.length !== e.orderBy.length) return !1; for(let n5 = 0; n5 < t.orderBy.length; n5++)if (!ue(t.orderBy[n5], e.orderBy[n5])) return !1; if (t.filters.length !== e.filters.length) return !1; for(let i = 0; i < t.filters.length; i++)if (n = t.filters[i], s = e.filters[i], n.op !== s.op || !n.field.isEqual(s.field) || !Vt(n.value, s.value)) return !1; @@ -1040,8 +1037,7 @@ } function le(t, e) { if (null === t) return null === e; - if (null === e) return !1; - if (t.before !== e.before || t.position.length !== e.position.length) return !1; + if (null === e || t.before !== e.before || t.position.length !== e.position.length) return !1; for(let n = 0; n < t.position.length; n++)if (!Vt(t.position[n], e.position[n])) return !1; return !0; } @@ -1082,15 +1078,17 @@ } function Ee(t) { const e = t; - if (!e.S) if ("F" === e.limitType) e.S = Qt(e.path, e.collectionGroup, Te(e), e.filters, e.limit, e.startAt, e.endAt); - else { - const t = []; - for (const n of Te(e)){ - const e = "desc" === n.dir ? "asc" : "desc"; - t.push(new ae(n.field, e)); + if (!e.S) { + if ("F" === e.limitType) e.S = Qt(e.path, e.collectionGroup, Te(e), e.filters, e.limit, e.startAt, e.endAt); + else { + const t = []; + for (const n of Te(e)){ + const e = "desc" === n.dir ? "asc" : "desc"; + t.push(new ae(n.field, e)); + } + const n6 = e.endAt ? new oe(e.endAt.position, !e.endAt.before) : null, s = e.startAt ? new oe(e.startAt.position, !e.startAt.before) : null; + e.S = Qt(e.path, e.collectionGroup, t, e.filters, e.limit, n6, s); } - const n6 = e.endAt ? new oe(e.endAt.position, !e.endAt.before) : null, s = e.startAt ? new oe(e.startAt.position, !e.startAt.before) : null; - e.S = Qt(e.path, e.collectionGroup, t, e.filters, e.limit, n6, s); } return e.S; } @@ -1122,7 +1120,7 @@ }(t34, e16) && function(t, e) { for (const n of t.filters)if (!n.matches(e)) return !1; return !0; - }(t34, e16) && (t33 = t34, e15 = e16, (!t33.startAt || !!he(t33.startAt, Te(t33), e15)) && !(t33.endAt && he(t33.endAt, Te(t33), e15))); + }(t34, e16) && (t33 = t34, e15 = e16, !(t33.startAt && !he(t33.startAt, Te(t33), e15) || t33.endAt && he(t33.endAt, Te(t33), e15))); } function ve(t35) { return (e, n)=>{ @@ -1594,8 +1592,7 @@ return Math.pow(2, t) <= this.size + 1; } check() { - if (this.isRed() && this.left.isRed()) throw L(); - if (this.right.isRed()) throw L(); + if (this.isRed() && this.left.isRed() || this.right.isRed()) throw L(); const t = this.left.check(); if (t !== this.right.check()) throw L(); return t + (this.isRed() ? 0 : 1); @@ -1715,8 +1712,7 @@ }), e; } isEqual(t) { - if (!(t instanceof gn)) return !1; - if (this.size !== t.size) return !1; + if (!(t instanceof gn) || this.size !== t.size) return !1; const e = this.data.getIterator(), n = t.data.getIterator(); for(; e.hasNext();){ const t = e.getNext().key, s = n.getNext().key; @@ -1887,11 +1883,12 @@ const e = t.targetId, n = t.O.count, s = this.dt(e); if (s) { const t = s.target; - if (Ht(t)) if (0 === n) { - const n = new Pt(t.path); - this.ct(e, n, Kt.newNoDocument(n, rt.min())); - } else B(1 === n); - else this.wt(e) !== n && (this.lt(e), this.it = this.it.add(e)); + if (Ht(t)) { + if (0 === n) { + const n = new Pt(t.path); + this.ct(e, n, Kt.newNoDocument(n, rt.min())); + } else B(1 === n); + } else this.wt(e) !== n && (this.lt(e), this.it = this.it.add(e)); } } _t(t49) { @@ -4808,8 +4805,7 @@ return e ? this.copy(this.keyedMap.remove(t), this.sortedSet.remove(e)) : this; } isEqual(t) { - if (!(t instanceof $o)) return !1; - if (this.size !== t.size) return !1; + if (!(t instanceof $o) || this.size !== t.size) return !1; const e = this.sortedSet.getIterator(), n = t.sortedSet.getIterator(); for(; e.hasNext();){ const t = e.getNext().key, s = n.getNext().key; @@ -5182,7 +5178,7 @@ if (a.approximateByteSize() > 0) { var t212, e118, n42; const u = c.withResumeToken(a, s19).withSequenceNumber(t213.currentSequenceNumber); - i = i.insert(r, u), t212 = c, e118 = u, n42 = e, ((B(e118.resumeToken.approximateByteSize() > 0), 0 === t212.resumeToken.approximateByteSize()) ? 0 : e118.snapshotVersion.toMicroseconds() - t212.snapshotVersion.toMicroseconds() >= 3e8 ? 0 : !(n42.addedDocuments.size + n42.modifiedDocuments.size + n42.removedDocuments.size > 0)) || o4.push(n43.ze.updateTargetData(t213, u)); + i = i.insert(r, u), t212 = c, e118 = u, n42 = e, B(e118.resumeToken.approximateByteSize() > 0), (0 === t212.resumeToken.approximateByteSize() || e118.snapshotVersion.toMicroseconds() - t212.snapshotVersion.toMicroseconds() >= 3e8 || n42.addedDocuments.size + n42.modifiedDocuments.size + n42.removedDocuments.size > 0) && o4.push(n43.ze.updateTargetData(t213, u)); } }); let c2 = pn, r7; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js index 80a45b079a1..1a5fc5a023b 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/moment/1/output.js @@ -425,7 +425,7 @@ 2000, 1 ]).day(i), this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(), this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(), this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); - return strict ? 'dddd' === format ? -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) ? ii : null : 'ddd' === format ? -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) ? ii : null : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) ? ii : null : 'dddd' === format ? -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) ? ii : null : 'ddd' === format ? -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) ? ii : null : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) ? ii : null; + return strict ? 'dddd' === format ? -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) ? ii : null : 'ddd' === format ? -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) ? ii : null : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) ? ii : null : 'dddd' === format ? -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) || -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) ? ii : null : 'ddd' === format ? -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) || -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) ? ii : null : -1 !== (ii = indexOf.call(this._minWeekdaysParse, llc)) || -1 !== (ii = indexOf.call(this._weekdaysParse, llc)) ? ii : -1 !== (ii = indexOf.call(this._shortWeekdaysParse, llc)) ? ii : null; } function computeWeekdaysParse() { function cmpLenRev(a, b) { @@ -574,13 +574,15 @@ if (null === config) return delete locales[name], null; var locale, parentConfig = baseConfig; if (config.abbr = name, null != locales[name]) deprecateSimple('defineLocaleOverride', "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."), parentConfig = locales[name]._config; - else if (null != config.parentLocale) if (null != locales[config.parentLocale]) parentConfig = locales[config.parentLocale]._config; - else { - if (null == (locale = loadLocale(config.parentLocale))) return localeFamilies[config.parentLocale] || (localeFamilies[config.parentLocale] = []), localeFamilies[config.parentLocale].push({ - name: name, - config: config - }), null; - parentConfig = locale._config; + else if (null != config.parentLocale) { + if (null != locales[config.parentLocale]) parentConfig = locales[config.parentLocale]._config; + else { + if (null == (locale = loadLocale(config.parentLocale))) return localeFamilies[config.parentLocale] || (localeFamilies[config.parentLocale] = []), localeFamilies[config.parentLocale].push({ + name: name, + config: config + }), null; + parentConfig = locale._config; + } } return locales[name] = new Locale(mergeConfigs(parentConfig, config)), localeFamilies[name] && localeFamilies[name].forEach(function(x) { defineLocale(x.name, x.config); @@ -743,10 +745,12 @@ config._isValid = !1; return; } - if (match[4]) if (tzRegex.exec(match[4])) tzFormat = 'Z'; - else { - config._isValid = !1; - return; + if (match[4]) { + if (tzRegex.exec(match[4])) tzFormat = 'Z'; + else { + config._isValid = !1; + return; + } } config._f = dateFormat + (timeFormat || '') + (tzFormat || ''), configFromStringAndFormat(config); } else config._isValid = !1; @@ -1184,60 +1188,61 @@ return string; } proto.add = add, proto.calendar = function(time, formats) { - if (1 === arguments.length) if (arguments[0]) { - var input2, input1, arrayTest, dataTypeTest; - (input2 = arguments[0], isMoment(input2) || isDate(input2) || isString(input2) || isNumber(input2) || (arrayTest = isArray(input1 = input2), dataTypeTest = !1, arrayTest && (dataTypeTest = 0 === input1.filter(function(item) { - return !isNumber(item) && isString(input1); - }).length), arrayTest && dataTypeTest) || function(input) { - var i, property, objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = !1, properties = [ - 'years', - 'year', - 'y', - 'months', - 'month', - 'M', - 'days', - 'day', - 'd', - 'dates', - 'date', - 'D', - 'hours', - 'hour', - 'h', - 'minutes', - 'minute', - 'm', - 'seconds', - 'second', - 's', - 'milliseconds', - 'millisecond', - 'ms', - ]; - for(i = 0; i < properties.length; i += 1)property = properties[i], propertyTest = propertyTest || hasOwnProp(input, property); - return objectTest && propertyTest; - }(input2) || null == input2) ? (time = arguments[0], formats = void 0) : function(input) { - var i, property, objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = !1, properties = [ - 'sameDay', - 'nextDay', - 'lastDay', - 'nextWeek', - 'lastWeek', - 'sameElse', - ]; - for(i = 0; i < properties.length; i += 1)property = properties[i], propertyTest = propertyTest || hasOwnProp(input, property); - return objectTest && propertyTest; - }(arguments[0]) && (formats = arguments[0], time = void 0); - } else time = void 0, formats = void 0; + if (1 === arguments.length) { + if (arguments[0]) { + var input2, input1, arrayTest, dataTypeTest; + (input2 = arguments[0], isMoment(input2) || isDate(input2) || isString(input2) || isNumber(input2) || (arrayTest = isArray(input1 = input2), dataTypeTest = !1, arrayTest && (dataTypeTest = 0 === input1.filter(function(item) { + return !isNumber(item) && isString(input1); + }).length), arrayTest && dataTypeTest) || function(input) { + var i, property, objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = !1, properties = [ + 'years', + 'year', + 'y', + 'months', + 'month', + 'M', + 'days', + 'day', + 'd', + 'dates', + 'date', + 'D', + 'hours', + 'hour', + 'h', + 'minutes', + 'minute', + 'm', + 'seconds', + 'second', + 's', + 'milliseconds', + 'millisecond', + 'ms', + ]; + for(i = 0; i < properties.length; i += 1)property = properties[i], propertyTest = propertyTest || hasOwnProp(input, property); + return objectTest && propertyTest; + }(input2) || null == input2) ? (time = arguments[0], formats = void 0) : function(input) { + var i, property, objectTest = isObject(input) && !isObjectEmpty(input), propertyTest = !1, properties = [ + 'sameDay', + 'nextDay', + 'lastDay', + 'nextWeek', + 'lastWeek', + 'sameElse', + ]; + for(i = 0; i < properties.length; i += 1)property = properties[i], propertyTest = propertyTest || hasOwnProp(input, property); + return objectTest && propertyTest; + }(arguments[0]) && (formats = arguments[0], time = void 0); + } else time = void 0, formats = void 0; + } var now = time || createLocal(), sod = cloneWithOffset(now, this).startOf('day'), format = hooks.calendarFormat(this, sod) || 'sameElse', output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); return this.format(output || this.localeData().calendar(format, this, createLocal(now))); }, proto.clone = function() { return new Moment(this); }, proto.diff = function(input, units, asFloat) { var that, zoneDelta, output; - if (!this.isValid()) return NaN; - if (!(that = cloneWithOffset(input, this)).isValid()) return NaN; + if (!this.isValid() || !(that = cloneWithOffset(input, this)).isValid()) return NaN; switch(zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4, units = normalizeUnits(units)){ case 'year': output = monthDiff(this, that) / 12; @@ -1442,24 +1447,15 @@ }; }, proto.eraName = function() { var i, l, val, eras = this.localeData().eras(); - for(i = 0, l = eras.length; i < l; ++i){ - if (val = this.clone().startOf('day').valueOf(), eras[i].since <= val && val <= eras[i].until) return eras[i].name; - if (eras[i].until <= val && val <= eras[i].since) return eras[i].name; - } + for(i = 0, l = eras.length; i < l; ++i)if (val = this.clone().startOf('day').valueOf(), eras[i].since <= val && val <= eras[i].until || eras[i].until <= val && val <= eras[i].since) return eras[i].name; return ''; }, proto.eraNarrow = function() { var i, l, val, eras = this.localeData().eras(); - for(i = 0, l = eras.length; i < l; ++i){ - if (val = this.clone().startOf('day').valueOf(), eras[i].since <= val && val <= eras[i].until) return eras[i].narrow; - if (eras[i].until <= val && val <= eras[i].since) return eras[i].narrow; - } + for(i = 0, l = eras.length; i < l; ++i)if (val = this.clone().startOf('day').valueOf(), eras[i].since <= val && val <= eras[i].until || eras[i].until <= val && val <= eras[i].since) return eras[i].narrow; return ''; }, proto.eraAbbr = function() { var i, l, val, eras = this.localeData().eras(); - for(i = 0, l = eras.length; i < l; ++i){ - if (val = this.clone().startOf('day').valueOf(), eras[i].since <= val && val <= eras[i].until) return eras[i].abbr; - if (eras[i].until <= val && val <= eras[i].since) return eras[i].abbr; - } + for(i = 0, l = eras.length; i < l; ++i)if (val = this.clone().startOf('day').valueOf(), eras[i].since <= val && val <= eras[i].until || eras[i].until <= val && val <= eras[i].since) return eras[i].abbr; return ''; }, proto.eraYear = function() { var i, l, dir, val, eras = this.localeData().eras(); @@ -1494,8 +1490,8 @@ return weeksInYear(this.isoWeekYear(), 1, 4); }, proto.date = getSetDayOfMonth, proto.day = proto.days = function(input) { if (!this.isValid()) return null != input ? this : NaN; - var input4, locale, day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); - return null == input ? day : (input = (input4 = input, locale = this.localeData(), 'string' != typeof input4 ? input4 : isNaN(input4) ? 'number' == typeof (input4 = locale.weekdaysParse(input4)) ? input4 : null : parseInt(input4, 10)), this.add(input - day, 'd')); + var input5, locale, day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); + return null == input ? day : (input = (input5 = input, locale = this.localeData(), 'string' != typeof input5 ? input5 : isNaN(input5) ? 'number' == typeof (input5 = locale.weekdaysParse(input5)) ? input5 : null : parseInt(input5, 10)), this.add(input - day, 'd')); }, proto.weekday = function(input) { if (!this.isValid()) return null != input ? this : NaN; var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; @@ -1503,7 +1499,7 @@ }, proto.isoWeekday = function(input) { if (!this.isValid()) return null != input ? this : NaN; if (null == input) return this.day() || 7; - var input5, locale, weekday = (input5 = input, locale = this.localeData(), 'string' == typeof input5 ? locale.weekdaysParse(input5) % 7 || 7 : isNaN(input5) ? null : input5); + var input6, locale, weekday = (input6 = input, locale = this.localeData(), 'string' == typeof input6 ? locale.weekdaysParse(input6) % 7 || 7 : isNaN(input6) ? null : input6); return this.day(this.day() % 7 ? weekday : weekday - 7); }, proto.dayOfYear = function(input) { var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; @@ -1644,14 +1640,10 @@ }, proto$1.monthsParse = function(monthName, format, strict) { var i, mom, regex; if (this._monthsParseExact) return handleStrictParse.call(this, monthName, format, strict); - 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)) return i; - if (strict && 'MMM' === format && this._shortMonthsParse[i].test(monthName)) return i; - if (!strict && this._monthsParse[i].test(monthName)) return i; - } + 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)) 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) { @@ -1672,15 +1664,10 @@ }, proto$1.weekdaysParse = function(weekdayName, format, strict) { var i, mom, regex; if (this._weekdaysParseExact) return handleStrictParse$1.call(this, weekdayName, format, strict); - 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)) return i; - if (strict && 'ddd' === format && this._shortWeekdaysParse[i].test(weekdayName)) return i; - if (strict && 'dd' === format && this._minWeekdaysParse[i].test(weekdayName)) return i; - if (!strict && this._weekdaysParse[i].test(weekdayName)) return i; - } + 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)) 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) { diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/quagga2/1.4.2/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/quagga2/1.4.2/1/output.js index 4fc8fa778d7..784c1bf9efe 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/quagga2/1.4.2/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/quagga2/1.4.2/1/output.js @@ -24,8 +24,7 @@ value: !0 }); }, __webpack_require__.t = function(value, mode) { - if (1 & mode && (value = __webpack_require__(value)), 8 & mode) return value; - if (4 & mode && 'object' == typeof value && value && value.__esModule) return value; + if (1 & mode && (value = __webpack_require__(value)), 8 & mode || 4 & mode && 'object' == typeof value && value && value.__esModule) return value; var ns = Object.create(null); if (__webpack_require__.r(ns), Object.defineProperty(ns, 'default', { enumerable: !0, @@ -377,7 +376,7 @@ }, parsedArea = Object.keys(area).reduce(function(result, key) { var value, parsed = { value: parseFloat(value = area[key]), - unit: (value.indexOf('%') === value.length, '%') + unit: (value.indexOf('%'), value.length, '%') }, calculated = _dimensionsConverters[key](parsed, context); return result[key] = calculated, result; }, {}); @@ -1510,14 +1509,15 @@ rasterize: function(depthlabel) { var color, bc, lc, labelindex, cx, cy, vertex, p, cc, sc, pos, i, colorMap = [], connectedCount = 0; for(i = 0; i < 400; i++)colorMap[i] = 0; - for(cy = 1, colorMap[0] = imageData[0], cc = null; cy < height - 1; cy++)for(cx = 1, labelindex = 0, bc = colorMap[0]; cx < width - 1; cx++)if (0 === labelData[pos = cy * width + cx]) if ((color = imageData[pos]) !== bc) { - if (0 === labelindex) colorMap[lc = connectedCount + 1] = color, bc = color, null !== (vertex = tracer.contourTracing(cy, cx, lc, color, Rasterizer.DIR.OUTSIDE_EDGE)) && (connectedCount++, labelindex = lc, (p = Rasterizer.createContour2D()).dir = Rasterizer.CONTOUR_DIR.CW_DIR, p.index = labelindex, p.firstVertex = vertex, p.nextpeer = cc, p.insideContours = null, null !== cc && (cc.prevpeer = p), cc = p); - else if (null !== (vertex = tracer.contourTracing(cy, cx, Rasterizer.DIR.INSIDE_EDGE, color, labelindex))) { - for((p = Rasterizer.createContour2D()).firstVertex = vertex, p.insideContours = null, 0 === depthlabel ? p.dir = Rasterizer.CONTOUR_DIR.CCW_DIR : p.dir = Rasterizer.CONTOUR_DIR.CW_DIR, p.index = depthlabel, sc = cc; null !== sc && sc.index !== labelindex;)sc = sc.nextpeer; - null !== sc && (p.nextpeer = sc.insideContours, null !== sc.insideContours && (sc.insideContours.prevpeer = p), sc.insideContours = p); - } - } else labelData[pos] = labelindex; - else labelData[pos] === Rasterizer.DIR.OUTSIDE_EDGE || labelData[pos] === Rasterizer.DIR.INSIDE_EDGE ? (labelindex = 0, bc = labelData[pos] === Rasterizer.DIR.INSIDE_EDGE ? imageData[pos] : colorMap[0]) : bc = colorMap[labelindex = labelData[pos]]; + for(cy = 1, colorMap[0] = imageData[0], cc = null; cy < height - 1; cy++)for(cx = 1, labelindex = 0, bc = colorMap[0]; cx < width - 1; cx++)if (0 === labelData[pos = cy * width + cx]) { + if ((color = imageData[pos]) !== bc) { + if (0 === labelindex) colorMap[lc = connectedCount + 1] = color, bc = color, null !== (vertex = tracer.contourTracing(cy, cx, lc, color, Rasterizer.DIR.OUTSIDE_EDGE)) && (connectedCount++, labelindex = lc, (p = Rasterizer.createContour2D()).dir = Rasterizer.CONTOUR_DIR.CW_DIR, p.index = labelindex, p.firstVertex = vertex, p.nextpeer = cc, p.insideContours = null, null !== cc && (cc.prevpeer = p), cc = p); + else if (null !== (vertex = tracer.contourTracing(cy, cx, Rasterizer.DIR.INSIDE_EDGE, color, labelindex))) { + for((p = Rasterizer.createContour2D()).firstVertex = vertex, p.insideContours = null, 0 === depthlabel ? p.dir = Rasterizer.CONTOUR_DIR.CCW_DIR : p.dir = Rasterizer.CONTOUR_DIR.CW_DIR, p.index = depthlabel, sc = cc; null !== sc && sc.index !== labelindex;)sc = sc.nextpeer; + null !== sc && (p.nextpeer = sc.insideContours, null !== sc.insideContours && (sc.insideContours.prevpeer = p), sc.insideContours = p); + } + } else labelData[pos] = labelindex; + } else labelData[pos] === Rasterizer.DIR.OUTSIDE_EDGE || labelData[pos] === Rasterizer.DIR.INSIDE_EDGE ? (labelindex = 0, bc = labelData[pos] === Rasterizer.DIR.INSIDE_EDGE ? imageData[pos] : colorMap[0]) : bc = colorMap[labelindex = labelData[pos]]; for(sc = cc; null !== sc;)sc.index = depthlabel, sc = sc.nextpeer; return { cc: cc, @@ -1577,11 +1577,8 @@ xStart1 = u - 1 | 0; xStart2 = u + 1 | 0; sum = (images[inImagePtr + yStart1 + xStart1 | 0] | 0) + (images[inImagePtr + yStart1 + xStart2 | 0] | 0) + (images[inImagePtr + offset + u | 0] | 0) + (images[inImagePtr + yStart2 + xStart1 | 0] | 0) + (images[inImagePtr + yStart2 + xStart2 | 0] | 0) | 0; - if ((sum | 0) == 5) { - images[outImagePtr + offset + u | 0] = 1; - } else { - images[outImagePtr + offset + u | 0] = 0; - } + if ((sum | 0) == 5) images[outImagePtr + offset + u | 0] = 1; + else images[outImagePtr + offset + u | 0] = 0; } } } @@ -1647,11 +1644,8 @@ xStart1 = u - 1 | 0; xStart2 = u + 1 | 0; sum = (images[inImagePtr + yStart1 + xStart1 | 0] | 0) + (images[inImagePtr + yStart1 + xStart2 | 0] | 0) + (images[inImagePtr + offset + u | 0] | 0) + (images[inImagePtr + yStart2 + xStart1 | 0] | 0) + (images[inImagePtr + yStart2 + xStart2 | 0] | 0) | 0; - if ((sum | 0) > 0) { - images[outImagePtr + offset + u | 0] = 1; - } else { - images[outImagePtr + offset + u | 0] = 0; - } + if ((sum | 0) > 0) images[outImagePtr + offset + u | 0] = 1; + else images[outImagePtr + offset + u | 0] = 0; } } } @@ -3095,8 +3089,7 @@ }, function(module, exports) { module.exports = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -3373,8 +3366,7 @@ }(), barcode_reader = barcode_reader_BarcodeReader, code_128_reader = function(_BarcodeReader) { inherits_default()(Code128Reader, _BarcodeReader); var Derived, hasNativeReflectConstruct, _super = (Derived = Code128Reader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -4426,7 +4418,7 @@ else done = !0; unshift && (codeset = codeset === this.CODE_A ? this.CODE_B : this.CODE_A); } - return null === code ? null : (code.end = this._nextUnset(this._row, code.end), this._verifyTrailingWhitespace(code)) ? (checksum -= multiplier * rawResult[rawResult.length - 1]) % 103 !== rawResult[rawResult.length - 1] ? null : result.length ? (removeLastCharacter && result.splice(result.length - 1, 1), { + return null === code ? null : (code.end = this._nextUnset(this._row, code.end), this._verifyTrailingWhitespace(code) && (checksum -= multiplier * rawResult[rawResult.length - 1]) % 103 === rawResult[rawResult.length - 1] && result.length) ? (removeLastCharacter && result.splice(result.length - 1, 1), { code: result.join(''), start: startInfo.start, end: code.end, @@ -4435,7 +4427,7 @@ decodedCodes: decodedCodes, endInfo: code, format: this.FORMAT - }) : null : null; + }) : null; } }, { @@ -4624,8 +4616,7 @@ ], ean_reader = function(_BarcodeReader) { inherits_default()(EANReader, _BarcodeReader); var Derived, hasNativeReflectConstruct, _super = (Derived = EANReader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -4799,13 +4790,10 @@ start: startInfo.start, end: startInfo.end }; - if (decodedCodes.push(code), !(code = this._decodePayload(code, result, decodedCodes))) return null; - if (!(code = this._findEnd(code.end, !1))) return null; - if (decodedCodes.push(code), !this._checksum(result)) return null; + if (decodedCodes.push(code), !(code = this._decodePayload(code, result, decodedCodes)) || !(code = this._findEnd(code.end, !1)) || (decodedCodes.push(code), !this._checksum(result))) return null; if (this.supplements.length > 0) { var supplement = this._decodeExtensions(code.end); - if (!supplement) return null; - if (!supplement.decodedCodes) return null; + if (!supplement || !supplement.decodedCodes) return null; var lastCode = supplement.decodedCodes[supplement.decodedCodes.length - 1], endInfo = { start: lastCode.start + ((lastCode.end - lastCode.start) / 2 | 0), end: lastCode.end @@ -4878,8 +4866,7 @@ ]), code_39_reader = function(_BarcodeReader) { inherits_default()(Code39Reader, _BarcodeReader); var Derived, hasNativeReflectConstruct, _super = (Derived = Code39Reader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -4989,8 +4976,7 @@ do { counters = this._toCounters(nextStart, counters); var pattern = this._toPattern(counters); - if (pattern < 0) return null; - if (null === (decodedChar = this._patternToChar(pattern))) return null; + if (pattern < 0 || null === (decodedChar = this._patternToChar(pattern))) return null; result.push(decodedChar), lastStart = nextStart, nextStart += array_helper.a.sum(counters), nextStart = this._nextSet(this._row, nextStart); }while ('*' !== decodedChar) return (result.pop(), result.length && this._verifyTrailingWhitespace(lastStart, nextStart, counters)) ? { @@ -5010,8 +4996,7 @@ }, code_39_vin_reader = function(_Code39Reader) { inherits_default()(Code39VINReader, _Code39Reader); var Derived, hasNativeReflectConstruct, _super = (Derived = Code39VINReader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -5101,8 +5086,7 @@ ], codabar_reader = function(_BarcodeReader) { inherits_default()(NewCodabarReader, _BarcodeReader); var Derived, hasNativeReflectConstruct, _super = (Derived = NewCodabarReader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -5273,9 +5257,7 @@ if (null === decodedChar) return null; if (result.push(decodedChar), nextStart += 8, result.length > 1 && this._isStartEnd(pattern)) break; }while (nextStart < this._counters.length) - if (result.length - 2 < 4 || !this._isStartEnd(pattern)) return null; - if (!this._verifyWhitespace(start.startCounter, nextStart - 8)) return null; - if (!this._validateResult(result, start.startCounter)) return null; + if (result.length - 2 < 4 || !this._isStartEnd(pattern) || !this._verifyWhitespace(start.startCounter, nextStart - 8) || !this._validateResult(result, start.startCounter)) return null; nextStart = nextStart > this._counters.length ? this._counters.length : nextStart; var end = start.start + this._sumCounters(start.startCounter, nextStart - 8); return { @@ -5292,8 +5274,7 @@ }(barcode_reader), upc_reader = function(_EANReader) { inherits_default()(UPCReader, _EANReader); var Derived, hasNativeReflectConstruct, _super = (Derived = UPCReader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -5328,8 +5309,7 @@ }(ean_reader), ean_8_reader = function(_EANReader) { inherits_default()(EAN8Reader, _EANReader); var Derived, hasNativeReflectConstruct, _super = (Derived = EAN8Reader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -5373,8 +5353,7 @@ }(ean_reader), ean_2_reader = function(_EANReader) { inherits_default()(EAN2Reader, _EANReader); var Derived, hasNativeReflectConstruct, _super = (Derived = EAN2Reader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -5435,8 +5414,7 @@ ], ean_5_reader = function(_EANReader) { inherits_default()(EAN5Reader, _EANReader); var Derived, hasNativeReflectConstruct, _super = (Derived = EAN5Reader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -5469,8 +5447,7 @@ if (!(code = this._decodeCode(offset))) return null; decodedCodes.push(code), result1.push(code.code % 10), code.code >= 10 && (codeFrequency1 |= 1 << 4 - i1), 4 !== i1 && (offset = this._nextSet(this._row, code.end), offset = this._nextUnset(this._row, offset)); } - if (5 !== result1.length) return null; - if (function(result) { + if (5 !== result1.length || function(result) { for(var length = result.length, sum = 0, i = length - 2; i >= 0; i -= 2)sum += result[i]; sum *= 3; for(var _i = length - 1; _i >= 0; _i -= 2)sum += result[_i]; @@ -5505,8 +5482,7 @@ var upc_e_reader = function(_EANReader) { inherits_default()(UPCEReader, _EANReader); var Derived, hasNativeReflectConstruct, _super = (Derived = UPCEReader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -5646,8 +5622,7 @@ }(ean_reader), i2of5_reader = function(_BarcodeReader) { inherits_default()(I2of5Reader, _BarcodeReader); var Derived, hasNativeReflectConstruct, _super = (Derived = I2of5Reader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -5892,7 +5867,7 @@ var endInfo = this._findEnd(); if (!endInfo) return null; var counters = this._fillCounters(startInfo.end, endInfo.start, !1); - return this._verifyCounterLength(counters) && this._decodePayload(counters, result, decodedCodes) ? result.length % 2 != 0 || result.length < 6 ? null : (decodedCodes.push(endInfo), { + return this._verifyCounterLength(counters) ? !this._decodePayload(counters, result, decodedCodes) || result.length % 2 != 0 || result.length < 6 ? null : (decodedCodes.push(endInfo), { code: result.join(''), start: startInfo.start, end: endInfo.end, @@ -5992,8 +5967,7 @@ }, 0), _2of5_reader = function(_BarcodeReader) { inherits_default()(TwoOfFiveReader, _BarcodeReader); var Derived, hasNativeReflectConstruct, _super = (Derived = TwoOfFiveReader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -6124,14 +6098,14 @@ var decodedCodes = []; decodedCodes.push(startInfo); var result = []; - return this._decodePayload(counters, result, decodedCodes) ? result.length < 5 ? null : (decodedCodes.push(endInfo), { + return !this._decodePayload(counters, result, decodedCodes) || result.length < 5 ? null : (decodedCodes.push(endInfo), { code: result.join(''), start: startInfo.start, end: endInfo.end, startInfo: startInfo, decodedCodes: decodedCodes, format: this.FORMAT - }) : null; + }); } } ]), TwoOfFiveReader; @@ -6189,8 +6163,7 @@ ]), code_93_reader = function(_BarcodeReader) { inherits_default()(Code93Reader, _BarcodeReader); var Derived, hasNativeReflectConstruct, _super = (Derived = Code93Reader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -6343,8 +6316,7 @@ do { counters = this._toCounters(nextStart, counters); var pattern = this._toPattern(counters); - if (pattern < 0) return null; - if (null === (decodedChar = this._patternToChar(pattern))) return null; + if (pattern < 0 || null === (decodedChar = this._patternToChar(pattern))) return null; result.push(decodedChar), lastStart = nextStart, nextStart += array_helper.a.sum(counters), nextStart = this._nextSet(this._row, nextStart); }while ('*' !== decodedChar) return (result.pop(), result.length && this._verifyEnd(lastStart, nextStart) && this._verifyChecksums(result)) ? (result = result.slice(0, result.length - 2), null === (result = this._decodeExtended(result))) ? null : { @@ -6364,8 +6336,7 @@ }, code_32_reader = function(_Code39Reader) { inherits_default()(Code32Reader, _Code39Reader); var Derived, hasNativeReflectConstruct, _super = (Derived = Code32Reader, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; @@ -6410,8 +6381,7 @@ var result = get_default()(getPrototypeOf_default()(Code32Reader.prototype), "decode", this).call(this, row, start); if (!result) return null; var code = result.code; - if (!code) return null; - if (code = code.replace(code_32_reader_patterns.AEIO, ''), !this._checkChecksum(code)) return null; + if (!code || (code = code.replace(code_32_reader_patterns.AEIO, ''), !this._checkChecksum(code))) return null; var code32 = this._decodeCode32(code); return code32 ? (result.code = code32, result) : null; } @@ -6638,8 +6608,7 @@ }(), asyncToGenerator = __webpack_require__(20), asyncToGenerator_default = __webpack_require__.n(asyncToGenerator), regenerator = __webpack_require__(12), regenerator_default = __webpack_require__.n(regenerator), pick = __webpack_require__(85), pick_default = __webpack_require__.n(pick), wrapNativeSuper = __webpack_require__(86), wrapNativeSuper_default = __webpack_require__.n(wrapNativeSuper), Exception_Exception = function(_Error) { inherits_default()(Exception, _Error); var Derived, hasNativeReflectConstruct, _super = (Derived = Exception, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/react-autosuggest/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/react-autosuggest/1/output.js index 0f4f11993ff..c825e44471b 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/react-autosuggest/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/react-autosuggest/1/output.js @@ -96,8 +96,7 @@ var ItemsList = function(_Component) { var Derived, Constructor1, protoProps, staticProps, _super = (Derived = ItemsList1, function() { var self, call, result, Super = _getPrototypeOf(Derived); if (function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + 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; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js index 3756e4c8895..c9b19a15163 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/output.js @@ -57,8 +57,7 @@ if (1 != parent.nodeType || hasBlockDesc(node) || atomElements.test(node.nodeName) || "false" == node.contentEditable) return !1; off = domIndex(node) + (dir < 0 ? 0 : 1), node = parent; } else { - if (1 != node.nodeType) return !1; - if ("false" == (node = node.childNodes[off + (dir < 0 ? -1 : 0)]).contentEditable) return !1; + if (1 != node.nodeType || "false" == (node = node.childNodes[off + (dir < 0 ? -1 : 0)]).contentEditable) return !1; off = dir < 0 ? nodeSize(node) : 0; } } @@ -101,17 +100,19 @@ function scrollRectIntoView(view, rect, startDOM) { for(var scrollThreshold = view.someProp("scrollThreshold") || 0, scrollMargin = view.someProp("scrollMargin") || 5, doc = view.dom.ownerDocument, parent = startDOM || view.dom; parent; parent = parentNode(parent))if (1 == parent.nodeType) { var atTop = parent == doc.body || 1 != parent.nodeType, bounding = atTop ? windowRect(doc) : clientRect(parent), moveX = 0, moveY = 0; - if (rect.top < bounding.top + getSide(scrollThreshold, "top") ? moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top")) : rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom") && (moveY = rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom")), rect.left < bounding.left + getSide(scrollThreshold, "left") ? moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left")) : rect.right > bounding.right - getSide(scrollThreshold, "right") && (moveX = rect.right - bounding.right + getSide(scrollMargin, "right")), moveX || moveY) if (atTop) doc.defaultView.scrollBy(moveX, moveY); - else { - var startX = parent.scrollLeft, startY = parent.scrollTop; - moveY && (parent.scrollTop += moveY), moveX && (parent.scrollLeft += moveX); - var dX = parent.scrollLeft - startX, dY = parent.scrollTop - startY; - rect = { - left: rect.left - dX, - top: rect.top - dY, - right: rect.right - dX, - bottom: rect.bottom - dY - }; + if (rect.top < bounding.top + getSide(scrollThreshold, "top") ? moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top")) : rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom") && (moveY = rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom")), rect.left < bounding.left + getSide(scrollThreshold, "left") ? moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left")) : rect.right > bounding.right - getSide(scrollThreshold, "right") && (moveX = rect.right - bounding.right + getSide(scrollMargin, "right")), moveX || moveY) { + if (atTop) doc.defaultView.scrollBy(moveX, moveY); + else { + var startX = parent.scrollLeft, startY = parent.scrollTop; + moveY && (parent.scrollTop += moveY), moveX && (parent.scrollLeft += moveX); + var dX = parent.scrollLeft - startX, dY = parent.scrollTop - startY; + rect = { + left: rect.left - dX, + top: rect.top - dY, + right: rect.right - dX, + bottom: rect.bottom - dY + }; + } } if (atTop) break; } @@ -651,10 +652,11 @@ var assign, descObj, custom = view.nodeViews[node.type.name], spec = custom && custom(node, view, function() { return descObj ? descObj.parent ? descObj.parent.posBeforeChild(descObj) : void 0 : pos; }, 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"); - } 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); + if (node.isText) { + if (dom) { + if (3 != dom.nodeType) throw new 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)); var nodeDOM = dom; return (dom = applyOuterDeco(dom, outerDeco, node), spec) ? descObj = new CustomNodeViewDesc1(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos + 1) : node.isText ? new TextViewDesc1(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) : new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos + 1); @@ -1262,8 +1264,7 @@ } function selectVertically(view, dir, mods) { var sel = view.state.selection; - if (sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection && !sel.empty || mods.indexOf("s") > -1) return !1; - if (result1.mac && mods.indexOf("m") > -1) return !1; + if (sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection && !sel.empty || mods.indexOf("s") > -1 || result1.mac && mods.indexOf("m") > -1) return !1; var $from = sel.$from, $to = sel.$to; if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? "up" : "down")) { var next = moveSelectionBlock(view.state, dir); @@ -1597,8 +1598,7 @@ }, DOMObserver.prototype.registerMutation = function(mut, added) { if (added.indexOf(mut.target) > -1) return null; var desc = this.view.docView.nearestDesc(mut.target); - if ("attributes" == mut.type && (desc == this.view.docView || "contenteditable" == mut.attributeName || "style" == mut.attributeName && !mut.oldValue && !mut.target.getAttribute("style"))) return null; - if (!desc || desc.ignoreMutation(mut)) return null; + if ("attributes" == mut.type && (desc == this.view.docView || "contenteditable" == mut.attributeName || "style" == mut.attributeName && !mut.oldValue && !mut.target.getAttribute("style")) || !desc || desc.ignoreMutation(mut)) return null; if ("childList" == mut.type) { for(var i = 0; i < mut.addedNodes.length; i++)added.push(mut.addedNodes[i]); if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target)) return { @@ -1705,28 +1705,30 @@ return endComposition(view); } editHandlers.keydown = function(view2, event) { - if (view2.shiftKey = 16 == event.keyCode || event.shiftKey, !inOrNearComposition(view2, event)) if (229 != event.keyCode && view2.domObserver.forceFlush(), view2.lastKeyCode = event.keyCode, view2.lastKeyCodeTime = Date.now(), !result1.ios || 13 != event.keyCode || event.ctrlKey || event.altKey || event.metaKey) { - var view1, event1, event2, result, code, mods; - view2.someProp("handleKeyDown", function(f) { - return f(view2, event); - }) || (view1 = view2, code = (event1 = event).keyCode, mods = (result = "", (event2 = event1).ctrlKey && (result += "c"), event2.metaKey && (result += "m"), event2.altKey && (result += "a"), event2.shiftKey && (result += "s"), result), 8 == code || result1.mac && 72 == code && "c" == mods ? stopNativeHorizontalDelete(view1, -1) || skipIgnoredNodesLeft(view1) : 46 == code || result1.mac && 68 == code && "c" == mods ? stopNativeHorizontalDelete(view1, 1) || skipIgnoredNodesRight(view1) : 13 == code || 27 == code || (37 == code ? selectHorizontally(view1, -1, mods) || skipIgnoredNodesLeft(view1) : 39 == code ? selectHorizontally(view1, 1, mods) || skipIgnoredNodesRight(view1) : 38 == code ? selectVertically(view1, -1, mods) || skipIgnoredNodesLeft(view1) : 40 == code ? function(view) { - if (result1.safari && !(view.state.selection.$head.parentOffset > 0)) { - var ref = view.root.getSelection(), focusNode = ref.focusNode, focusOffset = ref.focusOffset; - if (focusNode && 1 == focusNode.nodeType && 0 == focusOffset && focusNode.firstChild && "false" == focusNode.firstChild.contentEditable) { - var child = focusNode.firstChild; - switchEditable(view, child, !0), setTimeout(function() { - return switchEditable(view, child, !1); - }, 20); + if (view2.shiftKey = 16 == event.keyCode || event.shiftKey, !inOrNearComposition(view2, event)) { + if (229 != event.keyCode && view2.domObserver.forceFlush(), view2.lastKeyCode = event.keyCode, view2.lastKeyCodeTime = Date.now(), !result1.ios || 13 != event.keyCode || event.ctrlKey || event.altKey || event.metaKey) { + var view1, event1, event2, result, code, mods; + view2.someProp("handleKeyDown", function(f) { + return f(view2, event); + }) || (view1 = view2, code = (event1 = event).keyCode, mods = (result = "", (event2 = event1).ctrlKey && (result += "c"), event2.metaKey && (result += "m"), event2.altKey && (result += "a"), event2.shiftKey && (result += "s"), result), 8 == code || result1.mac && 72 == code && "c" == mods ? stopNativeHorizontalDelete(view1, -1) || skipIgnoredNodesLeft(view1) : 46 == code || result1.mac && 68 == code && "c" == mods ? stopNativeHorizontalDelete(view1, 1) || skipIgnoredNodesRight(view1) : 13 == code || 27 == code || (37 == code ? selectHorizontally(view1, -1, mods) || skipIgnoredNodesLeft(view1) : 39 == code ? selectHorizontally(view1, 1, mods) || skipIgnoredNodesRight(view1) : 38 == code ? selectVertically(view1, -1, mods) || skipIgnoredNodesLeft(view1) : 40 == code ? function(view) { + if (result1.safari && !(view.state.selection.$head.parentOffset > 0)) { + var ref = view.root.getSelection(), focusNode = ref.focusNode, focusOffset = ref.focusOffset; + if (focusNode && 1 == focusNode.nodeType && 0 == focusOffset && focusNode.firstChild && "false" == focusNode.firstChild.contentEditable) { + var child = focusNode.firstChild; + switchEditable(view, child, !0), setTimeout(function() { + return switchEditable(view, child, !1); + }, 20); + } } - } - }(view1) || selectVertically(view1, 1, mods) || skipIgnoredNodesRight(view1) : mods == (result1.mac ? "m" : "c") && (66 == code || 73 == code || 89 == code || 90 == code))) ? event.preventDefault() : setSelectionOrigin(view2, "key"); - } else { - var now = Date.now(); - view2.lastIOSEnter = now, view2.lastIOSEnterFallbackTimeout = setTimeout(function() { - view2.lastIOSEnter == now && (view2.someProp("handleKeyDown", function(f) { - return f(view2, keyEvent(13, "Enter")); - }), view2.lastIOSEnter = 0); - }, 200); + }(view1) || selectVertically(view1, 1, mods) || skipIgnoredNodesRight(view1) : mods == (result1.mac ? "m" : "c") && (66 == code || 73 == code || 89 == code || 90 == code))) ? event.preventDefault() : setSelectionOrigin(view2, "key"); + } else { + var now = Date.now(); + view2.lastIOSEnter = now, view2.lastIOSEnterFallbackTimeout = setTimeout(function() { + view2.lastIOSEnter == now && (view2.someProp("handleKeyDown", function(f) { + return f(view2, keyEvent(13, "Enter")); + }), view2.lastIOSEnter = 0); + }, 200); + } } }, editHandlers.keyup = function(view, e) { 16 == e.keyCode && (view.shiftKey = !1); @@ -2264,10 +2266,12 @@ }, DecorationGroup.prototype.locals = function(node) { for(var result, sorted = !0, i = 0; i < this.members.length; i++){ var locals = this.members[i].localsInner(node); - if (locals.length) if (result) { - sorted && (result = result.slice(), sorted = !1); - for(var j = 0; j < locals.length; j++)result.push(locals[j]); - } else result = locals; + if (locals.length) { + if (result) { + sorted && (result = result.slice(), sorted = !1); + for(var j = 0; j < locals.length; j++)result.push(locals[j]); + } else result = locals; + } } return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none; }, DecorationGroup.from = function(members) { @@ -2366,24 +2370,26 @@ endB: endB }; }(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide); - if (!change) if (typeOver && sel2 instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection && !sel2.empty && sel2.$head.sameParent(sel2.$anchor) && !view8.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) change = { - start: sel2.from, - endA: sel2.to, - endB: sel2.to - }; - else if ((result1.ios && view8.lastIOSEnter > Date.now() - 225 || result1.android) && addedNodes.some(function(n) { - return "DIV" == n.nodeName || "P" == n.nodeName; - }) && view8.someProp("handleKeyDown", function(f) { - return f(view8, keyEvent(13, "Enter")); - })) { - view8.lastIOSEnter = 0; - return; - } else { - if (parse.sel) { - var sel$1 = resolveSelection(view8, view8.state.doc, parse.sel); - sel$1 && !sel$1.eq(view8.state.selection) && view8.dispatch(view8.state.tr.setSelection(sel$1)); + if (!change) { + if (typeOver && sel2 instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection && !sel2.empty && sel2.$head.sameParent(sel2.$anchor) && !view8.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) change = { + start: sel2.from, + endA: sel2.to, + endB: sel2.to + }; + else if ((result1.ios && view8.lastIOSEnter > Date.now() - 225 || result1.android) && addedNodes.some(function(n) { + return "DIV" == n.nodeName || "P" == n.nodeName; + }) && view8.someProp("handleKeyDown", function(f) { + return f(view8, keyEvent(13, "Enter")); + })) { + view8.lastIOSEnter = 0; + return; + } else { + if (parse.sel) { + var sel$1 = resolveSelection(view8, view8.state.doc, parse.sel); + sel$1 && !sel$1.eq(view8.state.selection) && view8.dispatch(view8.state.tr.setSelection(sel$1)); + } + return; } - return; } view8.domChangeCount++, view8.state.selection.from < view8.state.selection.to && change.start == change.endB && view8.state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_0__.TextSelection && (change.start > view8.state.selection.from && change.start <= view8.state.selection.from + 2 ? change.start = view8.state.selection.from : change.endA < view8.state.selection.to && change.endA >= view8.state.selection.to - 2 && (change.endB += view8.state.selection.to - change.endA, change.endA = view8.state.selection.to)), result1.ie && result1.ie_version <= 11 && change.endB == change.start + 1 && change.endA == change.start && change.start > parse.from && " \u00a0" == parse.doc.textBetween(change.start - parse.from - 1, change.start - parse.from + 1) && (change.start--, change.endA--, change.endB--); var $from2 = parse.doc.resolveNoCache(change.start - parse.from), $to = parse.doc.resolveNoCache(change.endB - parse.from), inlineChange = $from2.sameParent($to) && $from2.parent.inlineContent; @@ -2634,8 +2640,7 @@ var pos, elt1 = (view10.root.elementFromPoint ? view10.root : doc).elementFromPoint(coords3.left, coords3.top + 1); if (!elt1 || !view10.dom.contains(1 != elt1.nodeType ? elt1.parentNode : elt1)) { var box = view10.dom.getBoundingClientRect(); - if (!inRect(coords3, box)) return null; - if (!(elt1 = elementFromPoint(view10.dom, coords3, box))) return null; + if (!inRect(coords3, box) || !(elt1 = elementFromPoint(view10.dom, coords3, box))) return null; } if (result1.safari) for(var p = elt1; node1 && p; p = parentNode(p))p.draggable && (node1 = offset1 = null); if (elt1 = (dom = elt1, coords1 = coords3, (parent = dom.parentNode) && /^li$/i.test(parent.nodeName) && coords1.left < dom.getBoundingClientRect().left ? parent : dom), node1) { diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/31084/xml2js/parser/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/31084/xml2js/parser/output.js index 2a05c6b9576..146a479a4dd 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/31084/xml2js/parser/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/31084/xml2js/parser/output.js @@ -69,12 +69,14 @@ } catch (error1) { return err = error1, _this3.emit("error", err); } - }()), _this3.options.explicitChildren && !_this3.options.mergeAttrs && 'object' == typeof obj) if (_this3.options.preserveChildrenOrder) { - if (s) { - for(key in s[_this3.options.childkey] = s[_this3.options.childkey] || [], objClone = {}, obj)hasProp.call(obj, key) && (objClone[key] = obj[key]); - s[_this3.options.childkey].push(objClone), delete obj["#name"], 1 === Object.keys(obj).length && charkey in obj && !_this3.EXPLICIT_CHARKEY && (obj = obj[charkey]); - } - } else node = {}, _this3.options.attrkey in obj && (node[_this3.options.attrkey] = obj[_this3.options.attrkey], delete obj[_this3.options.attrkey]), !_this3.options.charsAsChildren && _this3.options.charkey in obj && (node[_this3.options.charkey] = obj[_this3.options.charkey], delete obj[_this3.options.charkey]), Object.getOwnPropertyNames(obj).length > 0 && (node[_this3.options.childkey] = obj), obj = node; + }()), _this3.options.explicitChildren && !_this3.options.mergeAttrs && 'object' == typeof obj) { + if (_this3.options.preserveChildrenOrder) { + if (s) { + for(key in s[_this3.options.childkey] = s[_this3.options.childkey] || [], objClone = {}, obj)hasProp.call(obj, key) && (objClone[key] = obj[key]); + s[_this3.options.childkey].push(objClone), delete obj["#name"], 1 === Object.keys(obj).length && charkey in obj && !_this3.EXPLICIT_CHARKEY && (obj = obj[charkey]); + } + } else node = {}, _this3.options.attrkey in obj && (node[_this3.options.attrkey] = obj[_this3.options.attrkey], delete obj[_this3.options.attrkey]), !_this3.options.charsAsChildren && _this3.options.charkey in obj && (node[_this3.options.charkey] = obj[_this3.options.charkey], delete obj[_this3.options.charkey]), Object.getOwnPropertyNames(obj).length > 0 && (node[_this3.options.childkey] = obj), obj = node; + } return stack.length > 0 ? _this3.assignOrPush(s, nodeName, obj) : (_this3.options.explicitRoot && (old = obj, (obj = {})[nodeName] = old), _this3.resultObject = obj, _this3.saxParser.ended = !0, _this3.emit("end", _this3.resultObject)); }), ontext = (_this4 = this, function(text) { var charChild, s; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js index 473155dbd80..6bcfaf92142 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js @@ -487,12 +487,14 @@ log$1.error(e); } } - }), 1 === data.handlers[type].length) if (elem.addEventListener) { - var options = !1; - supportsPassive() && passiveEvents.indexOf(type) > -1 && (options = { - passive: !0 - }), elem.addEventListener(type, data.dispatcher, options); - } else elem.attachEvent && elem.attachEvent('on' + type, data.dispatcher); + }), 1 === data.handlers[type].length) { + if (elem.addEventListener) { + var options = !1; + supportsPassive() && passiveEvents.indexOf(type) > -1 && (options = { + passive: !0 + }), elem.addEventListener(type, data.dispatcher, options); + } else elem.attachEvent && elem.attachEvent('on' + type, data.dispatcher); + } } function off(elem, type, fn) { if (DomData.has(elem)) { @@ -1871,20 +1873,22 @@ }); }, _proto.addWebVttScript_ = function() { var _this5 = this; - if (!global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) if (global_document__WEBPACK_IMPORTED_MODULE_1___default().body.contains(this.el())) { - if (!this.options_['vtt.js'] && isPlain(videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5___default()) && Object.keys(videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5___default()).length > 0) { - this.trigger('vttjsloaded'); - return; - } - var script = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('script'); - script.src = this.options_['vtt.js'] || 'https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js', script.onload = function() { - _this5.trigger('vttjsloaded'); - }, script.onerror = function() { - _this5.trigger('vttjserror'); - }, this.on('dispose', function() { - script.onload = null, script.onerror = null; - }), global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT = !0, this.el().parentNode.appendChild(script); - } else this.ready(this.addWebVttScript_); + if (!global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) { + if (global_document__WEBPACK_IMPORTED_MODULE_1___default().body.contains(this.el())) { + if (!this.options_['vtt.js'] && isPlain(videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5___default()) && Object.keys(videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5___default()).length > 0) { + this.trigger('vttjsloaded'); + return; + } + var script = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('script'); + script.src = this.options_['vtt.js'] || 'https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js', script.onload = function() { + _this5.trigger('vttjsloaded'); + }, script.onerror = function() { + _this5.trigger('vttjserror'); + }, this.on('dispose', function() { + script.onload = null, script.onerror = null; + }), global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT = !0, this.el().parentNode.appendChild(script); + } else this.ready(this.addWebVttScript_); + } }, _proto.emulateTextTracks = function() { var _this6 = this, tracks = this.textTracks(), remoteTracks = this.remoteTextTracks(), handleAddTrack = function(e) { return tracks.addTrack(e.track); @@ -2868,7 +2872,7 @@ }, _proto.enableInterval_ = function() { this.updateInterval || (this.updateInterval = this.setInterval(this.update, 30)); }, _proto.disableInterval_ = function(e) { - this.player_.liveTracker && this.player_.liveTracker.isLive() && e && 'ended' !== e.type || this.updateInterval && (this.clearInterval(this.updateInterval), this.updateInterval = null); + this.player_.liveTracker && this.player_.liveTracker.isLive() && e && 'ended' !== e.type || !this.updateInterval || (this.clearInterval(this.updateInterval), this.updateInterval = null); }, _proto.createEl = function() { return _Slider.prototype.createEl.call(this, 'div', { className: 'vjs-progress-holder' @@ -5190,15 +5194,17 @@ huge: 1 / 0 }, Player1 = function(_Component) { function Player(tag, options, ready) { - if (tag.id = tag.id || options.id || "vjs_video_" + _guid++, (options = assign(Player.getTagSettings(tag), options)).initChildren = !1, options.createEl = !1, options.evented = !1, options.reportTouchActivity = !1, !options.language) if ('function' == typeof tag.closest) { - var _this, closest = tag.closest('[lang]'); - closest && closest.getAttribute && (options.language = closest.getAttribute('lang')); - } else for(var element = tag; element && 1 === element.nodeType;){ - if (getAttributes(element).hasOwnProperty('lang')) { - options.language = element.getAttribute('lang'); - break; + if (tag.id = tag.id || options.id || "vjs_video_" + _guid++, (options = assign(Player.getTagSettings(tag), options)).initChildren = !1, options.createEl = !1, options.evented = !1, options.reportTouchActivity = !1, !options.language) { + if ('function' == typeof tag.closest) { + var _this, closest = tag.closest('[lang]'); + closest && closest.getAttribute && (options.language = closest.getAttribute('lang')); + } else for(var element = tag; element && 1 === element.nodeType;){ + if (getAttributes(element).hasOwnProperty('lang')) { + options.language = element.getAttribute('lang'); + break; + } + element = element.parentNode; } - element = element.parentNode; } if ((_this = _Component.call(this, null, options, ready) || this).boundDocumentFullscreenChange_ = function(e) { return _this.documentFullscreenChange_(e); @@ -6464,8 +6470,7 @@ return timeRangesList; }, isRangeDifferent = function(a, b) { if (a === b) return !1; - if (!a && b || !b && a) return !0; - if (a.length !== b.length) return !0; + if (!a && b || !b && a || a.length !== b.length) return !0; for(var i = 0; i < a.length; i++)if (a.start(i) !== b.start(i) || a.end(i) !== b.end(i)) return !0; return !1; }, lastBufferedEnd = function(a) { @@ -6892,8 +6897,7 @@ }, updateMaster$1 = function(master, newMedia, unchangedCheck) { void 0 === unchangedCheck && (unchangedCheck = isPlaylistUnchanged); var result = mergeOptions$2(master, {}), oldMedia = result.playlists[newMedia.id]; - if (!oldMedia) return null; - if (unchangedCheck(oldMedia, newMedia)) return null; + if (!oldMedia || unchangedCheck(oldMedia, newMedia)) return null; newMedia.segments = getAllSegments(newMedia); var mergedPlaylist = mergeOptions$2(oldMedia, newMedia); if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment && delete mergedPlaylist.preloadSegment, oldMedia.segments) { @@ -7279,9 +7283,7 @@ return endRequestAndCallback(error, request, '', bytes); }); var type = (0, _videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_12__.Xm)(bytes); - return 'ts' === type && bytes.length < 188 ? callbackOnCompleted(request, function() { - return endRequestAndCallback(error, request, '', bytes); - }) : !type && bytes.length < 376 ? callbackOnCompleted(request, function() { + return 'ts' === type && bytes.length < 188 || !type && bytes.length < 376 ? callbackOnCompleted(request, function() { return endRequestAndCallback(error, request, '', bytes); }) : endRequestAndCallback(null, request, type, bytes); } @@ -7299,18 +7301,14 @@ }); return request1; }, EventTarget = videojs.EventTarget, mergeOptions = videojs.mergeOptions, dashPlaylistUnchanged = function(a, b) { - if (!isPlaylistUnchanged(a, b)) return !1; - if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) return !1; - if (!a.sidx && b.sidx || a.sidx && !b.sidx) return !1; - if (a.segments && !b.segments || !a.segments && b.segments) return !1; + if (!isPlaylistUnchanged(a, b) || a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length) || a.segments && !b.segments || !a.segments && b.segments) return !1; if (!a.segments && !b.segments) return !0; for(var i = 0; i < a.segments.length; i++){ var aSegment = a.segments[i], bSegment = b.segments[i]; if (aSegment.uri !== bSegment.uri) return !1; if (aSegment.byterange || bSegment.byterange) { var aByterange = aSegment.byterange, bByterange = bSegment.byterange; - if (aByterange && !bByterange || !aByterange && bByterange) return !1; - if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) return !1; + if (aByterange && !bByterange || !aByterange && bByterange || aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) return !1; } } return !0; @@ -7612,10 +7610,12 @@ return !!listeners[type] && (index = listeners[type].indexOf(listener), listeners[type] = listeners[type].slice(), listeners[type].splice(index, 1), index > -1); }, this.trigger = function(type) { var callbacks, i, length, args; - if (callbacks = listeners[type]) if (2 === arguments.length) for(i = 0, length = callbacks.length; i < length; ++i)callbacks[i].call(this, arguments[1]); - else { - for(args = [], i = arguments.length, i = 1; i < arguments.length; ++i)args.push(arguments[i]); - for(i = 0, length = callbacks.length; i < length; ++i)callbacks[i].apply(this, args); + if (callbacks = listeners[type]) { + if (2 === arguments.length) for(i = 0, length = callbacks.length; i < length; ++i)callbacks[i].call(this, arguments[1]); + else { + for(args = [], i = arguments.length, i = 1; i < arguments.length; ++i)args.push(arguments[i]); + for(i = 0, length = callbacks.length; i < length; ++i)callbacks[i].apply(this, args); + } } }, this.dispose = function() { listeners = {}; @@ -8822,7 +8822,7 @@ return result; }, parseUserData: function(sei) { - return 181 !== sei.payload[0] ? null : (sei.payload[1] << 8 | sei.payload[2]) != 49 ? null : 'GA94' !== String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) ? null : 0x03 !== sei.payload[7] ? null : sei.payload.subarray(8, sei.payload.length - 1); + return 181 !== sei.payload[0] || (sei.payload[1] << 8 | sei.payload[2]) != 49 || 'GA94' !== String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) || 0x03 !== sei.payload[7] ? null : sei.payload.subarray(8, sei.payload.length - 1); }, parseCaptionPackets: function(pts, userData) { var i, count, offset, data, results = []; @@ -9209,32 +9209,34 @@ this.lastControlCode_ = null; return; } - if ((0xf000 & data) == 0x1000 ? this.lastControlCode_ = data : data !== this.PADDING_ && (this.lastControlCode_ = null), char0 = data >>> 8, char1 = 0xff & data, data !== this.PADDING_) if (data === this.RESUME_CAPTION_LOADING_) this.mode_ = 'popOn'; - else if (data === this.END_OF_CAPTION_) this.mode_ = 'popOn', this.clearFormatting(packet.pts), this.flushDisplayed(packet.pts), swap = this.displayed_, this.displayed_ = this.nonDisplayed_, this.nonDisplayed_ = swap, this.startPts_ = packet.pts; - else if (data === this.ROLL_UP_2_ROWS_) this.rollUpRows_ = 2, this.setRollUp(packet.pts); - else if (data === this.ROLL_UP_3_ROWS_) this.rollUpRows_ = 3, this.setRollUp(packet.pts); - else if (data === this.ROLL_UP_4_ROWS_) this.rollUpRows_ = 4, this.setRollUp(packet.pts); - else if (data === this.CARRIAGE_RETURN_) this.clearFormatting(packet.pts), this.flushDisplayed(packet.pts), this.shiftRowsUp_(), this.startPts_ = packet.pts; - else if (data === this.BACKSPACE_) 'popOn' === this.mode_ ? this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); - else if (data === this.ERASE_DISPLAYED_MEMORY_) this.flushDisplayed(packet.pts), this.displayed_ = createDisplayBuffer(); - else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) this.nonDisplayed_ = createDisplayBuffer(); - else if (data === this.RESUME_DIRECT_CAPTIONING_) 'paintOn' !== this.mode_ && (this.flushDisplayed(packet.pts), this.displayed_ = createDisplayBuffer()), this.mode_ = 'paintOn', this.startPts_ = packet.pts; - else if (this.isSpecialCharacter(char0, char1)) text = getCharFromCode((char0 = (0x03 & char0) << 8) | char1), this[this.mode_](packet.pts, text), this.column_++; - else if (this.isExtCharacter(char0, char1)) 'popOn' === this.mode_ ? this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1), text = getCharFromCode((char0 = (0x03 & char0) << 8) | char1), this[this.mode_](packet.pts, text), this.column_++; - else if (this.isMidRowCode(char0, char1)) this.clearFormatting(packet.pts), this[this.mode_](packet.pts, ' '), this.column_++, (0xe & char1) == 0xe && this.addFormatting(packet.pts, [ - 'i' - ]), (0x1 & char1) == 0x1 && this.addFormatting(packet.pts, [ - 'u' - ]); - else if (this.isOffsetControlCode(char0, char1)) this.column_ += 0x03 & char1; - else if (this.isPAC(char0, char1)) { - var row = ROWS.indexOf(0x1f20 & data); - 'rollUp' === this.mode_ && (row - this.rollUpRows_ + 1 < 0 && (row = this.rollUpRows_ - 1), this.setRollUp(packet.pts, row)), row !== this.row_ && (this.clearFormatting(packet.pts), this.row_ = row), 0x1 & char1 && -1 === this.formatting_.indexOf('u') && this.addFormatting(packet.pts, [ - 'u' - ]), (0x10 & data) == 0x10 && (this.column_ = ((0xe & data) >> 1) * 4), this.isColorPAC(char1) && (0xe & char1) == 0xe && this.addFormatting(packet.pts, [ + if ((0xf000 & data) == 0x1000 ? this.lastControlCode_ = data : data !== this.PADDING_ && (this.lastControlCode_ = null), char0 = data >>> 8, char1 = 0xff & data, data !== this.PADDING_) { + if (data === this.RESUME_CAPTION_LOADING_) this.mode_ = 'popOn'; + else if (data === this.END_OF_CAPTION_) this.mode_ = 'popOn', this.clearFormatting(packet.pts), this.flushDisplayed(packet.pts), swap = this.displayed_, this.displayed_ = this.nonDisplayed_, this.nonDisplayed_ = swap, this.startPts_ = packet.pts; + else if (data === this.ROLL_UP_2_ROWS_) this.rollUpRows_ = 2, this.setRollUp(packet.pts); + else if (data === this.ROLL_UP_3_ROWS_) this.rollUpRows_ = 3, this.setRollUp(packet.pts); + else if (data === this.ROLL_UP_4_ROWS_) this.rollUpRows_ = 4, this.setRollUp(packet.pts); + else if (data === this.CARRIAGE_RETURN_) this.clearFormatting(packet.pts), this.flushDisplayed(packet.pts), this.shiftRowsUp_(), this.startPts_ = packet.pts; + else if (data === this.BACKSPACE_) 'popOn' === this.mode_ ? this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1); + else if (data === this.ERASE_DISPLAYED_MEMORY_) this.flushDisplayed(packet.pts), this.displayed_ = createDisplayBuffer(); + else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) this.nonDisplayed_ = createDisplayBuffer(); + else if (data === this.RESUME_DIRECT_CAPTIONING_) 'paintOn' !== this.mode_ && (this.flushDisplayed(packet.pts), this.displayed_ = createDisplayBuffer()), this.mode_ = 'paintOn', this.startPts_ = packet.pts; + else if (this.isSpecialCharacter(char0, char1)) text = getCharFromCode((char0 = (0x03 & char0) << 8) | char1), this[this.mode_](packet.pts, text), this.column_++; + else if (this.isExtCharacter(char0, char1)) 'popOn' === this.mode_ ? this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1), text = getCharFromCode((char0 = (0x03 & char0) << 8) | char1), this[this.mode_](packet.pts, text), this.column_++; + else if (this.isMidRowCode(char0, char1)) this.clearFormatting(packet.pts), this[this.mode_](packet.pts, ' '), this.column_++, (0xe & char1) == 0xe && this.addFormatting(packet.pts, [ 'i' + ]), (0x1 & char1) == 0x1 && this.addFormatting(packet.pts, [ + 'u' ]); - } else this.isNormalChar(char0) && (0x00 === char1 && (char1 = null), text = getCharFromCode(char0), text += getCharFromCode(char1), this[this.mode_](packet.pts, text), this.column_ += text.length); + else if (this.isOffsetControlCode(char0, char1)) this.column_ += 0x03 & char1; + else if (this.isPAC(char0, char1)) { + var row = ROWS.indexOf(0x1f20 & data); + 'rollUp' === this.mode_ && (row - this.rollUpRows_ + 1 < 0 && (row = this.rollUpRows_ - 1), this.setRollUp(packet.pts, row)), row !== this.row_ && (this.clearFormatting(packet.pts), this.row_ = row), 0x1 & char1 && -1 === this.formatting_.indexOf('u') && this.addFormatting(packet.pts, [ + 'u' + ]), (0x10 & data) == 0x10 && (this.column_ = ((0xe & data) >> 1) * 4), this.isColorPAC(char1) && (0xe & char1) == 0xe && this.addFormatting(packet.pts, [ + 'i' + ]); + } else this.isNormalChar(char0) && (0x00 === char1 && (char1 = null), text = getCharFromCode(char0), text += getCharFromCode(char1), this[this.mode_](packet.pts, text), this.column_ += text.length); + } }; }; Cea608Stream1.prototype = new stream1(), Cea608Stream1.prototype.flushDisplayed = function(pts) { @@ -9890,7 +9892,7 @@ ]; break; } - sarRatio && sarRatio[0] / sarRatio[1]; + sarRatio && (sarRatio[0], sarRatio[1]); } return { profileIdc: profileIdc, @@ -9978,8 +9980,7 @@ var chunk, packet, tempLength, frameSize = 0, byteIndex = 0; for(everything.length ? (tempLength = everything.length, (everything = new Uint8Array(bytes.byteLength + tempLength)).set(everything.subarray(0, tempLength)), everything.set(bytes, tempLength)) : everything = bytes; everything.length - byteIndex >= 3;){ if (73 === everything[byteIndex] && 68 === everything[byteIndex + 1] && 51 === everything[byteIndex + 2]) { - if (everything.length - byteIndex < 10) break; - if (frameSize = utils.parseId3TagSize(everything, byteIndex), byteIndex + frameSize > everything.length) break; + if (everything.length - byteIndex < 10 || (frameSize = utils.parseId3TagSize(everything, byteIndex), byteIndex + frameSize > everything.length)) break; chunk = { type: 'timed-metadata', data: everything.subarray(byteIndex, byteIndex + frameSize) @@ -9987,8 +9988,7 @@ continue; } if ((0xff & everything[byteIndex]) == 0xff && (0xf0 & everything[byteIndex + 1]) == 0xf0) { - if (everything.length - byteIndex < 7) break; - if (frameSize = utils.parseAdtsSize(everything, byteIndex), byteIndex + frameSize > everything.length) break; + if (everything.length - byteIndex < 7 || (frameSize = utils.parseAdtsSize(everything, byteIndex), byteIndex + frameSize > everything.length)) break; packet = { type: 'audio', data: everything.subarray(byteIndex, byteIndex + frameSize), @@ -10175,26 +10175,20 @@ metadata: [], info: {} }, timelineStartPts = 0; - if (this.pendingTracks.length < this.numberOfTracks) { - if ('VideoSegmentStream' !== flushSource && 'AudioSegmentStream' !== flushSource) return; - if (this.remuxTracks) return; - if (0 === this.pendingTracks.length) { - this.emittedTracks++, this.emittedTracks >= this.numberOfTracks && (this.trigger('done'), this.emittedTracks = 0); - return; + if (!(this.pendingTracks.length < this.numberOfTracks) || ('VideoSegmentStream' === flushSource || 'AudioSegmentStream' === flushSource) && !this.remuxTracks) { + if (this.videoTrack ? (timelineStartPts = this.videoTrack.timelineStartInfo.pts, videoProperties.forEach(function(prop) { + event.info[prop] = this.videoTrack[prop]; + }, this)) : this.audioTrack && (timelineStartPts = this.audioTrack.timelineStartInfo.pts, audioProperties.forEach(function(prop) { + event.info[prop] = this.audioTrack[prop]; + }, this)), this.videoTrack || this.audioTrack) { + for(1 === this.pendingTracks.length ? event.type = this.pendingTracks[0].type : event.type = 'combined', this.emittedTracks += this.pendingTracks.length, initSegment = mp4Generator.initSegment(this.pendingTracks), event.initSegment = new Uint8Array(initSegment.byteLength), event.initSegment.set(initSegment), event.data = new Uint8Array(this.pendingBytes), i = 0; i < this.pendingBoxes.length; i++)event.data.set(this.pendingBoxes[i], offset), offset += this.pendingBoxes[i].byteLength; + for(i = 0; i < this.pendingCaptions.length; i++)(caption = this.pendingCaptions[i]).startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps), caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps), event.captionStreams[caption.stream] = !0, event.captions.push(caption); + for(i = 0; i < this.pendingMetadata.length; i++)(id3 = this.pendingMetadata[i]).cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps), event.metadata.push(id3); + for(event.metadata.dispatchType = this.metadataStream.dispatchType, this.pendingTracks.length = 0, this.videoTrack = null, this.pendingBoxes.length = 0, this.pendingCaptions.length = 0, this.pendingBytes = 0, this.pendingMetadata.length = 0, this.trigger('data', event), i = 0; i < event.captions.length; i++)caption = event.captions[i], this.trigger('caption', caption); + for(i = 0; i < event.metadata.length; i++)id3 = event.metadata[i], this.trigger('id3Frame', id3); } + this.emittedTracks >= this.numberOfTracks && (this.trigger('done'), this.emittedTracks = 0); } - if (this.videoTrack ? (timelineStartPts = this.videoTrack.timelineStartInfo.pts, videoProperties.forEach(function(prop) { - event.info[prop] = this.videoTrack[prop]; - }, this)) : this.audioTrack && (timelineStartPts = this.audioTrack.timelineStartInfo.pts, audioProperties.forEach(function(prop) { - event.info[prop] = this.audioTrack[prop]; - }, this)), this.videoTrack || this.audioTrack) { - for(1 === this.pendingTracks.length ? event.type = this.pendingTracks[0].type : event.type = 'combined', this.emittedTracks += this.pendingTracks.length, initSegment = mp4Generator.initSegment(this.pendingTracks), event.initSegment = new Uint8Array(initSegment.byteLength), event.initSegment.set(initSegment), event.data = new Uint8Array(this.pendingBytes), i = 0; i < this.pendingBoxes.length; i++)event.data.set(this.pendingBoxes[i], offset), offset += this.pendingBoxes[i].byteLength; - for(i = 0; i < this.pendingCaptions.length; i++)(caption = this.pendingCaptions[i]).startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps), caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps), event.captionStreams[caption.stream] = !0, event.captions.push(caption); - for(i = 0; i < this.pendingMetadata.length; i++)(id3 = this.pendingMetadata[i]).cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps), event.metadata.push(id3); - for(event.metadata.dispatchType = this.metadataStream.dispatchType, this.pendingTracks.length = 0, this.videoTrack = null, this.pendingBoxes.length = 0, this.pendingCaptions.length = 0, this.pendingBytes = 0, this.pendingMetadata.length = 0, this.trigger('data', event), i = 0; i < event.captions.length; i++)caption = event.captions[i], this.trigger('caption', caption); - for(i = 0; i < event.metadata.length; i++)id3 = event.metadata[i], this.trigger('id3Frame', id3); - } - this.emittedTracks >= this.numberOfTracks && (this.trigger('done'), this.emittedTracks = 0); }, _CoalesceStream.prototype.setRemux = function(val) { this.remuxTracks = val; }, (_Transmuxer = function(options) { @@ -10410,8 +10404,7 @@ return (!videoTrackIds || 0 !== videoTrackIds.length) && (!timescales || 'object' != typeof timescales || 0 !== Object.keys(timescales).length) && (trackId !== videoTrackIds[0] || timescale !== timescales[trackId]); }, this.parse = function(segment, videoTrackIds, timescales) { var parsedData; - if (!this.isInitialized()) return null; - if (!videoTrackIds || !timescales) return null; + if (!this.isInitialized() || !videoTrackIds || !timescales) return null; if (this.isNewInit(videoTrackIds, timescales)) timescale = timescales[trackId = videoTrackIds[0]]; else if (null === trackId || !timescale) return segmentCache.push(segment), null; for(; segmentCache.length > 0;){ @@ -10768,22 +10761,14 @@ var type = probe.aac.parseType(bytes, byteIndex); switch(type){ case 'timed-metadata': - if (bytes.length - byteIndex < 10) { - endLoop = !0; - break; - } - if ((frameSize = probe.aac.parseId3TagSize(bytes, byteIndex)) > bytes.length) { + if (bytes.length - byteIndex < 10 || (frameSize = probe.aac.parseId3TagSize(bytes, byteIndex)) > bytes.length) { endLoop = !0; break; } null === timestamp && (packet = bytes.subarray(byteIndex, byteIndex + frameSize), timestamp = probe.aac.parseAacTimestamp(packet)), byteIndex += frameSize; break; case 'audio': - if (bytes.length - byteIndex < 7) { - endLoop = !0; - break; - } - if ((frameSize = probe.aac.parseAdtsSize(bytes, byteIndex)) > bytes.length) { + if (bytes.length - byteIndex < 7 || (frameSize = probe.aac.parseAdtsSize(bytes, byteIndex)) > bytes.length) { endLoop = !0; break; } @@ -11041,10 +11026,10 @@ if (transmuxer.onmessage = function(event) { transmuxer.currentTransmux === options && ('data' === event.data.action && handleData_(event, transmuxedData, onData), 'trackinfo' === event.data.action && onTrackInfo(event.data.trackInfo), 'gopInfo' === event.data.action && handleGopInfo_(event, transmuxedData), 'audioTimingInfo' === event.data.action && onAudioTimingInfo(event.data.audioTimingInfo), 'videoTimingInfo' === event.data.action && onVideoTimingInfo(event.data.videoTimingInfo), 'videoSegmentTimingInfo' === event.data.action && onVideoSegmentTimingInfo(event.data.videoSegmentTimingInfo), 'audioSegmentTimingInfo' === event.data.action && onAudioSegmentTimingInfo(event.data.audioSegmentTimingInfo), 'id3Frame' === event.data.action && onId3([ event.data.id3Frame - ], event.data.id3Frame.dispatchType), 'caption' === event.data.action && onCaptions(event.data.caption), 'endedtimeline' === event.data.action && (waitForEndedTimelineEvent = !1, onEndedTimeline()), 'log' === event.data.action && onTransmuxerLog(event.data.log), 'transmuxed' === event.data.type && (waitForEndedTimelineEvent || (transmuxer.onmessage = null, handleDone_({ + ], event.data.id3Frame.dispatchType), 'caption' === event.data.action && onCaptions(event.data.caption), 'endedtimeline' === event.data.action && (waitForEndedTimelineEvent = !1, onEndedTimeline()), 'log' === event.data.action && onTransmuxerLog(event.data.log), 'transmuxed' !== event.data.type || waitForEndedTimelineEvent || (transmuxer.onmessage = null, handleDone_({ transmuxedData: transmuxedData, callback: onDone - }), dequeue(transmuxer)))); + }), dequeue(transmuxer))); }, audioAppendStart && transmuxer.postMessage({ action: 'setAudioAppendStart', appendStart: audioAppendStart @@ -11667,7 +11652,7 @@ return logFn1('could not choose a playlist with options', options), null; } }, lastBandwidthSelector = function() { - var pixelRatio = this.useDevicePixelRatio ? global_window__WEBPACK_IMPORTED_MODULE_0___default().devicePixelRatio || 1 : 1; + var pixelRatio = this.useDevicePixelRatio && global_window__WEBPACK_IMPORTED_MODULE_0___default().devicePixelRatio || 1; return simpleSelector(this.playlists.master, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_); }, minRebufferMaxBandwidthSelector = function(settings) { var master = settings.master, currentTime = settings.currentTime, bandwidth = settings.bandwidth, duration = settings.duration, segmentDuration = settings.segmentDuration, timeUntilRebuffer = settings.timeUntilRebuffer, currentTimeline = settings.currentTimeline, syncController = settings.syncController, compatiblePlaylists = master.playlists.filter(function(playlist) { @@ -11809,8 +11794,7 @@ if (akeys.length !== bkeys.length) return !1; for(var i = 0; i < akeys.length; i++){ var key = akeys[i]; - if (key !== bkeys[i]) return !1; - if (a[key] !== b[key]) return !1; + if (key !== bkeys[i] || a[key] !== b[key]) return !1; } return !0; }, getSyncSegmentCandidate = function(currentTimeline, segments, targetTime) { @@ -11994,12 +11978,14 @@ return; } var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; - if (this.logger_("live window shift [" + mediaSequenceDiff + "]"), null !== this.mediaIndex) if (this.mediaIndex -= mediaSequenceDiff, this.mediaIndex < 0) this.mediaIndex = null, this.partIndex = null; - else { - var segment = this.playlist_.segments[this.mediaIndex]; - if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) { - var mediaIndex = this.mediaIndex; - this.logger_("currently processing part (index " + this.partIndex + ") no longer exists."), this.resetLoader(), this.mediaIndex = mediaIndex; + if (this.logger_("live window shift [" + mediaSequenceDiff + "]"), null !== this.mediaIndex) { + if (this.mediaIndex -= mediaSequenceDiff, this.mediaIndex < 0) this.mediaIndex = null, this.partIndex = null; + else { + var segment = this.playlist_.segments[this.mediaIndex]; + if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) { + var mediaIndex = this.mediaIndex; + this.logger_("currently processing part (index " + this.partIndex + ") no longer exists."), this.resetLoader(), this.mediaIndex = mediaIndex; + } } } segmentInfo && (segmentInfo.mediaIndex -= mediaSequenceDiff, segmentInfo.mediaIndex < 0 ? (segmentInfo.mediaIndex = null, segmentInfo.partIndex = null) : (segmentInfo.mediaIndex >= 0 && (segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex]), segmentInfo.partIndex >= 0 && segmentInfo.segment.parts && (segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex]))), this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist); @@ -12082,10 +12068,12 @@ } var nextSegment = segments[next.mediaIndex], nextPart = nextSegment && 'number' == typeof next.partIndex && nextSegment.parts && nextSegment.parts[next.partIndex]; if (!nextSegment || 'number' == typeof next.partIndex && !nextPart) return null; - if ('number' != typeof next.partIndex && nextSegment.parts && (next.partIndex = 0, nextPart = nextSegment.parts[0]), !bufferedTime && nextPart && !nextPart.independent) if (0 === next.partIndex) { - var lastSegment = segments[next.mediaIndex - 1], lastSegmentLastPart = lastSegment.parts && lastSegment.parts.length && lastSegment.parts[lastSegment.parts.length - 1]; - lastSegmentLastPart && lastSegmentLastPart.independent && (next.mediaIndex -= 1, next.partIndex = lastSegment.parts.length - 1, next.independent = 'previous segment'); - } else nextSegment.parts[next.partIndex - 1].independent && (next.partIndex -= 1, next.independent = 'previous part'); + if ('number' != typeof next.partIndex && nextSegment.parts && (next.partIndex = 0, nextPart = nextSegment.parts[0]), !bufferedTime && nextPart && !nextPart.independent) { + if (0 === next.partIndex) { + var lastSegment = segments[next.mediaIndex - 1], lastSegmentLastPart = lastSegment.parts && lastSegment.parts.length && lastSegment.parts[lastSegment.parts.length - 1]; + lastSegmentLastPart && lastSegmentLastPart.independent && (next.mediaIndex -= 1, next.partIndex = lastSegment.parts.length - 1, next.independent = 'previous segment'); + } else nextSegment.parts[next.partIndex - 1].independent && (next.partIndex -= 1, next.independent = 'previous part'); + } var ended = this.mediaSource_ && 'ended' === this.mediaSource_.readyState; return next.mediaIndex >= segments.length - 1 && ended && !this.seeking_() ? null : this.generateSegmentInfo_(next); }, _proto.generateSegmentInfo_ = function(options) { @@ -12121,7 +12109,7 @@ }, _proto.timestampOffsetForSegment_ = function(options) { return timestampOffsetForSegment(options); }, _proto.earlyAbortWhenNeeded_ = function(stats) { - if (!this.vhs_.tech_.paused() && this.xhrOptions_.timeout && this.playlist_.attributes.BANDWIDTH && !(Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1000)) { + if (!(this.vhs_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_.attributes.BANDWIDTH || Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1000)) { var buffered, currentTime, playbackRate, currentTime1 = this.currentTime_(), measuredBandwidth = stats.bandwidth, segmentDuration = this.pendingSegment_.duration, requestTimeRemaining = Playlist.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived), timeUntilRebuffer$1 = (buffered = this.buffered_(), currentTime = currentTime1, void 0 === (playbackRate = this.vhs_.tech_.playbackRate()) && (playbackRate = 1), ((buffered.length ? buffered.end(buffered.length - 1) : 0) - currentTime) / playbackRate - 1); if (!(requestTimeRemaining <= timeUntilRebuffer$1)) { var switchCandidate = minRebufferMaxBandwidthSelector({ @@ -12145,10 +12133,10 @@ }, _proto.handleProgress_ = function(event, simpleSegment) { this.earlyAbortWhenNeeded_(simpleSegment.stats), this.checkForAbort_(simpleSegment.requestId) || this.trigger('progress'); }, _proto.handleTrackInfo_ = function(simpleSegment, trackInfo) { - this.earlyAbortWhenNeeded_(simpleSegment.stats), !this.checkForAbort_(simpleSegment.requestId) && (this.checkForIllegalMediaSwitch(trackInfo) || (trackInfo = trackInfo || {}, shallowEqual(this.currentMediaInfo_, trackInfo) || (this.appendInitSegment_ = { + this.earlyAbortWhenNeeded_(simpleSegment.stats), this.checkForAbort_(simpleSegment.requestId) || this.checkForIllegalMediaSwitch(trackInfo) || (trackInfo = trackInfo || {}, shallowEqual(this.currentMediaInfo_, trackInfo) || (this.appendInitSegment_ = { audio: !0, video: !0 - }, this.startingMediaInfo_ = trackInfo, this.currentMediaInfo_ = trackInfo, this.logger_('trackinfo update', trackInfo), this.trigger('trackinfo')), !this.checkForAbort_(simpleSegment.requestId) && (this.pendingSegment_.trackInfo = trackInfo, this.hasEnoughInfoToAppend_() && this.processCallQueue_()))); + }, this.startingMediaInfo_ = trackInfo, this.currentMediaInfo_ = trackInfo, this.logger_('trackinfo update', trackInfo), this.trigger('trackinfo')), !this.checkForAbort_(simpleSegment.requestId) && (this.pendingSegment_.trackInfo = trackInfo, this.hasEnoughInfoToAppend_() && this.processCallQueue_())); }, _proto.handleTimingInfo_ = function(simpleSegment, mediaType, timeType, time) { if (this.earlyAbortWhenNeeded_(simpleSegment.stats), !this.checkForAbort_(simpleSegment.requestId)) { var segmentInfo = this.pendingSegment_, timingInfoProperty = timingInfoPropertyForMedia(mediaType); @@ -12230,18 +12218,17 @@ }, _proto.getMediaInfo_ = function(segmentInfo) { return void 0 === segmentInfo && (segmentInfo = this.pendingSegment_), this.getCurrentMediaInfo_(segmentInfo) || this.startingMediaInfo_; }, _proto.hasEnoughInfoToAppend_ = function() { - if (!this.sourceUpdater_.ready()) return !1; - if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) return !1; + if (!this.sourceUpdater_.ready() || this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) return !1; var segmentInfo = this.pendingSegment_, trackInfo = this.getCurrentMediaInfo_(); if (!segmentInfo || !trackInfo) return !1; var hasAudio = trackInfo.hasAudio, hasVideo = trackInfo.hasVideo, isMuxed = trackInfo.isMuxed; - return (!hasVideo || !!segmentInfo.videoTimingInfo) && (!hasAudio || !!this.audioDisabled_ || !!isMuxed || !!segmentInfo.audioTimingInfo) && !shouldWaitForTimelineChange({ + return !(hasVideo && !segmentInfo.videoTimingInfo || hasAudio && !this.audioDisabled_ && !isMuxed && !segmentInfo.audioTimingInfo || shouldWaitForTimelineChange({ timelineChangeController: this.timelineChangeController_, currentTimeline: this.currentTimeline_, segmentTimeline: segmentInfo.timeline, loaderType: this.loaderType_, audioDisabled: this.audioDisabled_ - }); + })); }, _proto.handleData_ = function(simpleSegment, result) { if (this.earlyAbortWhenNeeded_(simpleSegment.stats), !this.checkForAbort_(simpleSegment.requestId)) { if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) { @@ -12602,7 +12589,7 @@ sourceUpdater.updating() || 'closed' === sourceUpdater.mediaSource.readyState || (sourceUpdater.queue.shift(), queueEntry.action(sourceUpdater), queueEntry.doneFn && queueEntry.doneFn(), shiftQueue('audio', sourceUpdater), shiftQueue('video', sourceUpdater)); return; } - if ('mediaSource' !== type && !(!sourceUpdater.ready() || 'closed' === sourceUpdater.mediaSource.readyState || _updating(type, sourceUpdater))) { + if (!('mediaSource' === type || !sourceUpdater.ready() || 'closed' === sourceUpdater.mediaSource.readyState || _updating(type, sourceUpdater))) { if (queueEntry.type !== type) { if (null === (queueIndex = nextQueueIndexOfType(type, sourceUpdater.queue))) return; queueEntry = sourceUpdater.queue[queueIndex]; @@ -13379,8 +13366,10 @@ return this.listeners[type] = this.listeners[type].slice(0), this.listeners[type].splice(index, 1), index > -1; }, _proto.trigger = function(type) { var callbacks = this.listeners[type]; - if (callbacks) if (2 === arguments.length) for(var length = callbacks.length, i = 0; i < length; ++i)callbacks[i].call(this, arguments[1]); - else for(var args = Array.prototype.slice.call(arguments, 1), _length = callbacks.length, _i = 0; _i < _length; ++_i)callbacks[_i].apply(this, args); + if (callbacks) { + if (2 === arguments.length) for(var length = callbacks.length, i = 0; i < length; ++i)callbacks[i].call(this, arguments[1]); + else for(var args = Array.prototype.slice.call(arguments, 1), _length = callbacks.length, _i = 0; _i < _length; ++_i)callbacks[_i].apply(this, args); + } }, _proto.dispose = function() { this.listeners = {}; }, _proto.pipe = function(destination) { @@ -13644,10 +13633,7 @@ } } }, groupMatch1 = function groupMatch(list, media) { - for(var i = 0; i < list.length; i++){ - if (playlistMatch(media, list[i])) return !0; - if (list[i].playlists && groupMatch(list[i].playlists, media)) return !0; - } + for(var i = 0; i < list.length; i++)if (playlistMatch(media, list[i]) || list[i].playlists && groupMatch(list[i].playlists, media)) return !0; return !1; }, activeTrack1 = { AUDIO: function(type, settings) { @@ -13690,17 +13676,19 @@ var variants = null; media.attributes[type2] && (variants = groups[media.attributes[type2]]); var groupKeys = Object.keys(groups); - if (!variants) if ('AUDIO' === type2 && groupKeys.length > 1 && isAudioOnly(settings.master)) for(var i = 0; i < groupKeys.length; i++){ - var groupPropertyList = groups[groupKeys[i]]; - if (groupMatch1(groupPropertyList, media)) { - variants = groupPropertyList; - break; + if (!variants) { + if ('AUDIO' === type2 && groupKeys.length > 1 && isAudioOnly(settings.master)) for(var i = 0; i < groupKeys.length; i++){ + var groupPropertyList = groups[groupKeys[i]]; + if (groupMatch1(groupPropertyList, media)) { + variants = groupPropertyList; + break; + } } + else groups.main ? variants = groups.main : 1 === groupKeys.length && (variants = groups[groupKeys[0]]); } - else groups.main ? variants = groups.main : 1 === groupKeys.length && (variants = groups[groupKeys[0]]); - return void 0 === track ? variants : null !== track && variants ? variants.filter(function(props) { + return void 0 === track ? variants : null !== track && variants && variants.filter(function(props) { return props.id === track.id; - })[0] || null : null; + })[0] || null; }), mediaTypes[type].activeTrack = activeTrack1[type](type, settings4), mediaTypes[type].onGroupChanged = (type3 = type, settings1 = settings4, function() { var _settings$segmentLoad = settings1.segmentLoaders, segmentLoader = _settings$segmentLoad[type3], mainSegmentLoader = _settings$segmentLoad.main, mediaType = settings1.mediaTypes[type3], activeTrack = mediaType.activeTrack(), activeGroup = mediaType.getActiveGroup(), previousActiveLoader = mediaType.activePlaylistLoader, lastGroup = mediaType.lastGroup_; if ((!activeGroup || !lastGroup || activeGroup.id !== lastGroup.id) && (mediaType.lastGroup_ = activeGroup, mediaType.lastTrack_ = activeTrack, stopLoaders(segmentLoader, mediaType), activeGroup && !activeGroup.isMasterPlaylist)) { @@ -13973,8 +13961,7 @@ _this3.loadOnPlay_ && _this3.tech_.off('play', _this3.loadOnPlay_); var selectedMedia, updatedPlaylist = _this3.masterPlaylistLoader_.media(); if (!updatedPlaylist) { - if (_this3.excludeUnsupportedVariants_(), _this3.enableLowInitialPlaylist && (selectedMedia = _this3.selectInitialPlaylist()), selectedMedia || (selectedMedia = _this3.selectPlaylist()), !selectedMedia || !_this3.shouldSwitchToMedia_(selectedMedia)) return; - if (_this3.initialMedia_ = selectedMedia, _this3.switchMedia_(_this3.initialMedia_, 'initial'), !('vhs-json' === _this3.sourceType_ && _this3.initialMedia_.segments)) return; + if (_this3.excludeUnsupportedVariants_(), _this3.enableLowInitialPlaylist && (selectedMedia = _this3.selectInitialPlaylist()), selectedMedia || (selectedMedia = _this3.selectPlaylist()), !selectedMedia || !_this3.shouldSwitchToMedia_(selectedMedia) || (_this3.initialMedia_ = selectedMedia, _this3.switchMedia_(_this3.initialMedia_, 'initial'), !('vhs-json' === _this3.sourceType_ && _this3.initialMedia_.segments))) return; updatedPlaylist = _this3.initialMedia_; } _this3.handleUpdatedMediaPlaylist(updatedPlaylist); @@ -14266,18 +14253,12 @@ var expired = this.syncController_.getExpiredTime(media, this.duration()); if (null !== expired) { var master = this.masterPlaylistLoader_.master, mainSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media)); - if (0 !== mainSeekable.length) { - if (this.mediaTypes_.AUDIO.activePlaylistLoader) { - if (media = this.mediaTypes_.AUDIO.activePlaylistLoader.media(), null === (expired = this.syncController_.getExpiredTime(media, this.duration()))) return; - if (0 === (audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media))).length) return; - } - this.seekable_ && this.seekable_.length && (oldEnd = this.seekable_.end(0), oldStart = this.seekable_.start(0)), audioSeekable ? audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0) ? this.seekable_ = mainSeekable : this.seekable_ = videojs.createTimeRanges([ - [ - audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), - audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0) - ] - ]) : this.seekable_ = mainSeekable, this.seekable_ && this.seekable_.length && this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart || (this.logger_("seekable updated [" + printableRange(this.seekable_) + "]"), this.tech_.trigger('seekablechanged')); - } + 0 !== mainSeekable.length && (!this.mediaTypes_.AUDIO.activePlaylistLoader || (media = this.mediaTypes_.AUDIO.activePlaylistLoader.media(), null !== (expired = this.syncController_.getExpiredTime(media, this.duration())) && 0 !== (audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media))).length)) && (this.seekable_ && this.seekable_.length && (oldEnd = this.seekable_.end(0), oldStart = this.seekable_.start(0)), audioSeekable ? audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0) ? this.seekable_ = mainSeekable : this.seekable_ = videojs.createTimeRanges([ + [ + audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), + audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0) + ] + ]) : this.seekable_ = mainSeekable, this.seekable_ && this.seekable_.length && this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart || (this.logger_("seekable updated [" + printableRange(this.seekable_) + "]"), this.tech_.trigger('seekablechanged'))); } } } @@ -14695,7 +14676,7 @@ var average = -1, lastSystemBandwidth = -1; if (decay < 0 || decay > 1) throw new 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 : 1; + 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_); }; }, diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js index 37debcde1a6..9ea011d45f8 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js @@ -643,7 +643,7 @@ offset: 4 }) || (0, byte_helpers.G3)(bytes, CONSTANTS.fmp4, { offset: 4 - })) || !!((0, byte_helpers.G3)(bytes, CONSTANTS.moof, { + }) || (0, byte_helpers.G3)(bytes, CONSTANTS.moof, { offset: 4 }) || (0, byte_helpers.G3)(bytes, CONSTANTS.moov, { offset: 4 @@ -797,15 +797,17 @@ } if (response.statusCode >= 400 && response.statusCode <= 599) { var cause = responseBody; - if (decodeResponseBody) if (window.TextDecoder) { - var contentTypeHeader, charset1 = (void 0 === (contentTypeHeader = response.headers && response.headers['content-type']) && (contentTypeHeader = ''), contentTypeHeader.toLowerCase().split(';').reduce(function(charset, contentType) { - var _contentType$split = contentType.split('='), type = _contentType$split[0], value = _contentType$split[1]; - return 'charset' === type.trim() ? value.trim() : charset; - }, 'utf-8')); - try { - cause = new TextDecoder(charset1).decode(responseBody); - } catch (e) {} - } else cause = String.fromCharCode.apply(null, new Uint8Array(responseBody)); + if (decodeResponseBody) { + if (window.TextDecoder) { + var contentTypeHeader, charset1 = (void 0 === (contentTypeHeader = response.headers && response.headers['content-type']) && (contentTypeHeader = ''), contentTypeHeader.toLowerCase().split(';').reduce(function(charset, contentType) { + var _contentType$split = contentType.split('='), type = _contentType$split[0], value = _contentType$split[1]; + return 'charset' === type.trim() ? value.trim() : charset; + }, 'utf-8')); + try { + cause = new TextDecoder(charset1).decode(responseBody); + } catch (e) {} + } else cause = String.fromCharCode.apply(null, new Uint8Array(responseBody)); + } callback({ cause: cause }); @@ -1196,8 +1198,7 @@ } function needNamespaceDefine(node, isHTML, visibleNamespaces) { var prefix = node.prefix || '', uri = node.namespaceURI; - if (!uri) return !1; - if ("xml" === prefix && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) return !1; + if (!uri || "xml" === prefix && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) return !1; for(var i = visibleNamespaces.length; i--;){ var ns = visibleNamespaces[i]; if (ns.prefix === prefix) return ns.namespace !== uri; @@ -1985,9 +1986,10 @@ 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 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; + 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 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 "="'); break; case '/': @@ -2370,8 +2372,10 @@ return this.listeners[type] = this.listeners[type].slice(0), this.listeners[type].splice(index, 1), index > -1; }, _proto.trigger = function(type) { var callbacks = this.listeners[type]; - if (callbacks) if (2 === arguments.length) for(var length = callbacks.length, i = 0; i < length; ++i)callbacks[i].call(this, arguments[1]); - else for(var args = Array.prototype.slice.call(arguments, 1), _length = callbacks.length, _i = 0; _i < _length; ++_i)callbacks[_i].apply(this, args); + if (callbacks) { + if (2 === arguments.length) for(var length = callbacks.length, i = 0; i < length; ++i)callbacks[i].call(this, arguments[1]); + else for(var args = Array.prototype.slice.call(arguments, 1), _length = callbacks.length, _i = 0; _i < _length; ++_i)callbacks[_i].apply(this, args); + } }, _proto.dispose = function() { this.listeners = {}; }, _proto.pipe = function(destination) { @@ -3817,10 +3821,12 @@ query: relativeParts.query, fragment: relativeParts.fragment }; - if (!relativeParts.netLoc && (builtParts.netLoc = baseParts.netLoc, '/' !== relativeParts.path[0])) if (relativeParts.path) { - var baseURLPath = baseParts.path, newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + relativeParts.path; - builtParts.path = URLToolkit.normalizePath(newPath); - } else builtParts.path = baseParts.path, relativeParts.params || (builtParts.params = baseParts.params, relativeParts.query || (builtParts.query = baseParts.query)); + if (!relativeParts.netLoc && (builtParts.netLoc = baseParts.netLoc, '/' !== relativeParts.path[0])) { + if (relativeParts.path) { + var baseURLPath = baseParts.path, newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + relativeParts.path; + builtParts.path = URLToolkit.normalizePath(newPath); + } else builtParts.path = baseParts.path, relativeParts.params || (builtParts.params = baseParts.params, relativeParts.query || (builtParts.query = baseParts.query)); + } return null === builtParts.path && (builtParts.path = opts.alwaysNormalize ? URLToolkit.normalizePath(relativeParts.path) : relativeParts.path), URLToolkit.buildURLFromParts(builtParts); }, parseURL: function(url) { @@ -4062,9 +4068,7 @@ continue; } var m4 = t.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/); - if (!m4) continue; - if (!(node = createElement(m4[1], m4[3]))) continue; - if (!shouldAdd(current1, node)) continue; + if (!m4 || !(node = createElement(m4[1], m4[3])) || !shouldAdd(current1, node)) continue; if (m4[2]) { var classes = m4[2].split('.'); classes.forEach(function(cl) { @@ -5203,8 +5207,7 @@ 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 (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) return fromArrayBuffer(value, encodingOrOffset, length); - if ('undefined' != typeof SharedArrayBuffer && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length); + 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'); var valueOf = value.valueOf && value.valueOf(); if (null != valueOf && valueOf !== value) return Buffer.from(valueOf, encodingOrOffset, length); @@ -5276,9 +5279,7 @@ } function slowToString(encoding, start, end) { var loweredCase = !1; - if ((void 0 === start || start < 0) && (start = 0), start > this.length) return ''; - if ((void 0 === end || end > this.length) && (end = this.length), end <= 0) return ''; - if ((end >>>= 0) <= (start >>>= 0)) return ''; + if ((void 0 === start || start < 0) && (start = 0), start > this.length || ((void 0 === end || end > this.length) && (end = this.length), end <= 0 || (end >>>= 0) <= (start >>>= 0))) return ''; for(encoding || (encoding = 'utf8');;)switch(encoding){ case 'hex': return hexSlice(this, start, end); @@ -5435,8 +5436,7 @@ if (offset + ext > buf.length) throw new RangeError('Index out of range'); } function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range'); - if (offset < 0) throw new RangeError('Index out of range'); + if (offset + ext > buf.length || offset < 0) throw new RangeError('Index out of range'); } function writeFloat(buf, value, offset, littleEndian, noAssert) { return value = +value, offset >>>= 0, noAssert || checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -340282346638528860000000000000000000000), ieee754.write(buf, value, offset, littleEndian, 23, 4), offset + 4; @@ -5706,8 +5706,7 @@ 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 (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) return 0; - if (0 === target.length || 0 === this.length) return 0; + 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'); @@ -5742,11 +5741,7 @@ for(var codePoint, length = string.length, leadSurrogate = null, bytes = [], i = 0; i < length; ++i){ if ((codePoint = string.charCodeAt(i)) > 0xD7FF && codePoint < 0xE000) { if (!leadSurrogate) { - if (codePoint > 0xDBFF) { - (units -= 3) > -1 && bytes.push(0xEF, 0xBF, 0xBD); - continue; - } - if (i + 1 === length) { + if (codePoint > 0xDBFF || i + 1 === length) { (units -= 3) > -1 && bytes.push(0xEF, 0xBF, 0xBD); continue; } @@ -5843,8 +5838,7 @@ var setPrototypeOf = __webpack_require__(9611); function _construct(Parent1, args1, Class1) { return (_construct = !function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/asmjs/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/asmjs/1/output.js index 1c5e17ed476..df915862cc0 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/asmjs/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/asmjs/1/output.js @@ -150,8 +150,8 @@ export function foo(global, env, buffer) { } function Qb() { var b = 0, d = 0; - BC(8104, 8, 400) | 0; - BC(8504, 408, 540) | 0; + BC(8104, 8, 400); + BC(8504, 408, 540); b = 9044; d = b + 44 | 0; do { @@ -163,7 +163,7 @@ export function foo(global, env, buffer) { c1[2273] = 0; c1[2274] = 948; c1[2275] = 948; - Ha1(17, 8104, o1 | 0) | 0; + Ha1(17, 8104, o1 | 0); return; } function Rb(a) { @@ -189,15 +189,12 @@ export function foo(global, env, buffer) { case 2: case 4: case 5: - { - if (c1[a + 52 >> 2] | 0) { - a = a + 48 | 0; - break a; - } - break; + if (c1[a + 52 >> 2] | 0) { + a = a + 48 | 0; + break a; } + break; default: - {} } if (!(c1[a + 68 >> 2] | 0)) { a = (b | 1) == 5 ? 948 : d; @@ -216,7 +213,7 @@ export function foo(global, env, buffer) { d = oB(1e3) | 0; Vb(b, (d | 0) != 0, 2456); c1[2276] = (c1[2276] | 0) + 1; - BC(d | 0, 8104, 1e3) | 0; + BC(d | 0, 8104, 1e3); if (a1[b + 2 >> 0] | 0) { c1[d + 4 >> 2] = 2; c1[d + 12 >> 2] = 4; @@ -256,7 +253,7 @@ export function foo(global, env, buffer) { a = a | 0; b = b | 0; var d = 0; - BC(a | 0, b | 0, 948) | 0; + BC(a | 0, b | 0, 948); ie(a + 948 | 0, b + 948 | 0); d = a + 960 | 0; a = b + 960 | 0; @@ -274,7 +271,7 @@ export function foo(global, env, buffer) { b = a + 944 | 0; d = c1[b >> 2] | 0; if (d | 0) { - _b(d + 948 | 0, a) | 0; + _b(d + 948 | 0, a); c1[b >> 2] = 0; } d = $b(a) | 0; @@ -308,7 +305,7 @@ export function foo(global, env, buffer) { h = 4; } else { a = e; - while(1){ + while(true){ if ((c1[a >> 2] | 0) == (b | 0)) { f = a; h = 4; @@ -322,21 +319,23 @@ export function foo(global, env, buffer) { } } while (0) - if ((h | 0) == 4) if ((f | 0) != (d | 0)) { - e = f + 4 | 0; - a = g - e | 0; - b = a >> 2; - if (b) { - GC(f | 0, e | 0, a | 0) | 0; - d = c1[i >> 2] | 0; - } - a = f + (b << 2) | 0; - if ((d | 0) == (a | 0)) a = 1; - else { - c1[i >> 2] = d + (~((d + -4 - a | 0) >>> 2) << 2); - a = 1; - } - } else a = 0; + if ((h | 0) == 4) { + if ((f | 0) != (d | 0)) { + e = f + 4 | 0; + a = g - e | 0; + b = a >> 2; + if (b) { + GC(f | 0, e | 0, a | 0); + d = c1[i >> 2] | 0; + } + a = f + (b << 2) | 0; + if ((d | 0) == (a | 0)) a = 1; + else { + c1[i >> 2] = d + (~((d + -4 - a | 0) >>> 2) << 2); + a = 1; + } + } else a = 0; + } return a | 0; } function $b(a) { @@ -377,7 +376,7 @@ export function foo(global, env, buffer) { do if (k | 0) { if ((c1[(ac(a, 0) | 0) + 944 >> 2] | 0) == (a | 0)) { if (!(_b(a + 948 | 0, b) | 0)) break; - BC(b + 400 | 0, 8504, 540) | 0; + BC(b + 400 | 0, 8504, 540); c1[b + 944 >> 2] = 0; nc(a); break; @@ -411,7 +410,7 @@ export function foo(global, env, buffer) { b = f >> 2; if (!b) f = d; else { - GC(g | 0, e | 0, f | 0) | 0; + GC(g | 0, e | 0, f | 0); d = c1[i >> 2] | 0; f = d; } @@ -440,7 +439,7 @@ export function foo(global, env, buffer) { bc(d); d = b + 976 | 0; e = c1[d >> 2] | 0; - BC(b | 0, 8104, 1e3) | 0; + BC(b | 0, 8104, 1e3); if (a1[e + 2 >> 0] | 0) { c1[b + 4 >> 2] = 2; c1[b + 12 >> 2] = 4; @@ -530,7 +529,7 @@ export function foo(global, env, buffer) { b = a + 948 | 0; c1[h >> 2] = (c1[b >> 2] | 0) + (d << 2); c1[g >> 2] = c1[h >> 2]; - mc(b, g, f) | 0; + mc(b, g, f); c1[(c1[f >> 2] | 0) + 944 >> 2] = a; nc(a); l1 = e; @@ -637,7 +636,7 @@ export function foo(global, env, buffer) { f = j - g | 0; g = f >> 2; if (g) { - GC(i | 0, e | 0, f | 0) | 0; + GC(i | 0, e | 0, f | 0); e = c1[k >> 2] | 0; } t = i + (g << 2) | 0; @@ -698,7 +697,7 @@ export function foo(global, env, buffer) { a = a | 0; b = b | 0; if (BB(a, b, 400) | 0) { - BC(a | 0, b | 0, 400) | 0; + BC(a | 0, b | 0, 400); nc(a); } return; @@ -1411,17 +1410,12 @@ export function foo(global, env, buffer) { ec(a, (b | 0) < 6, 2918); switch(b | 0){ case 0: - { - b = (c1[a + 496 >> 2] | 0) == 2 ? 5 : 4; - break; - } + b = (c1[a + 496 >> 2] | 0) == 2 ? 5 : 4; + break; case 2: - { - b = (c1[a + 496 >> 2] | 0) == 2 ? 4 : 5; - break; - } + b = (c1[a + 496 >> 2] | 0) == 2 ? 4 : 5; + break; default: - {} } return T1(g1[a + 424 + (b << 2) >> 2]); } @@ -1431,17 +1425,12 @@ export function foo(global, env, buffer) { ec(a, (b | 0) < 6, 2918); switch(b | 0){ case 0: - { - b = (c1[a + 496 >> 2] | 0) == 2 ? 5 : 4; - break; - } + b = (c1[a + 496 >> 2] | 0) == 2 ? 5 : 4; + break; case 2: - { - b = (c1[a + 496 >> 2] | 0) == 2 ? 4 : 5; - break; - } + b = (c1[a + 496 >> 2] | 0) == 2 ? 4 : 5; + break; default: - {} } return T1(g1[a + 448 + (b << 2) >> 2]); } @@ -1451,17 +1440,12 @@ export function foo(global, env, buffer) { ec(a, (b | 0) < 6, 2918); switch(b | 0){ case 0: - { - b = (c1[a + 496 >> 2] | 0) == 2 ? 5 : 4; - break; - } + b = (c1[a + 496 >> 2] | 0) == 2 ? 5 : 4; + break; case 2: - { - b = (c1[a + 496 >> 2] | 0) == 2 ? 4 : 5; - break; - } + b = (c1[a + 496 >> 2] | 0) == 2 ? 4 : 5; + break; default: - {} } return T1(g1[a + 472 + (b << 2) >> 2]); } @@ -1669,7 +1653,7 @@ export function foo(global, env, buffer) { if (!s) w = 21; else { r = 0; - while(1){ + while(true){ q = b + 524 + (r * 24 | 0) | 0; if (((Ld(T1(g1[q >> 2]), d) | 0 ? Ld(T1(g1[b + 524 + (r * 24 | 0) + 4 >> 2]), e) | 0 : 0) ? (c1[b + 524 + (r * 24 | 0) + 8 >> 2] | 0) == (i | 0) : 0) ? (c1[b + 524 + (r * 24 | 0) + 12 >> 2] | 0) == (j | 0) : 0) { w = 22; @@ -1694,7 +1678,7 @@ export function foo(global, env, buffer) { if (!s) w = 21; else { r = 0; - while(1){ + while(true){ q = b + 524 + (r * 24 | 0) | 0; H = T1(g1[q >> 2]); I = T1(g1[b + 524 + (r * 24 | 0) + 4 >> 2]); @@ -1723,12 +1707,14 @@ export function foo(global, env, buffer) { } } else if ((w | 0) == 22) { r = (a1[11697] | 0) != 0; - if (!((q | 0) != 0 & (F ^ 1))) if (r) { - w = 28; - break; - } else { - w = 31; - break; + if (!((q | 0) != 0 & (F ^ 1))) { + if (r) { + w = 28; + break; + } else { + w = 31; + break; + } } t = q + 16 | 0; c1[b + 908 >> 2] = c1[t >> 2]; @@ -1961,7 +1947,7 @@ export function foo(global, env, buffer) { a: do if ((D | 0) == 1) { h = 0; r = 0; - while(1){ + while(true){ q = ac(b, r) | 0; if (!h) { if (T1(Ee(q)) > T1(0.0) ? T1(Fe(q)) > T1(0.0) : 0) h = q; @@ -2035,7 +2021,7 @@ export function foo(global, env, buffer) { L = 0; oa = T1(0.0); da = T1(0.0); - while(1){ + while(true){ b: do if (G >>> 0 < Ia >>> 0) { C = c1[Ha >> 2] | 0; s = 0; @@ -2046,7 +2032,7 @@ export function foo(global, env, buffer) { r = 0; q = 0; t = G; - while(1){ + while(true){ B = c1[C + (t << 2) >> 2] | 0; if ((c1[B + 36 >> 2] | 0) != 1 ? (c1[B + 940 >> 2] = L, (c1[B + 24 >> 2] | 0) != 1) : 0) { x = T1(Ud(B, Ja, Ea)); @@ -2242,7 +2228,7 @@ export function foo(global, env, buffer) { E = T1(g1[ea >> 2]); Na = c1[ha >> 2] | 0; Oa = c1[ga >> 2] | 0; - Td(r, Fa ? Ma : E, Fa ? E : Ma, Ga, Fa ? Na : Oa, Fa ? Oa : Na, Ea, sa, o & (q ^ 1), 3488, p) | 0; + Td(r, Fa ? Ma : E, Fa ? E : Ma, Ga, Fa ? Na : Oa, Fa ? Oa : Na, Ea, sa, o & (q ^ 1), 3488, p); a1[Y >> 0] = a1[Y >> 0] | a1[r + 508 >> 0]; r = c1[r + 960 >> 2] | 0; }while ((r | 0) != 0) @@ -2274,61 +2260,48 @@ export function foo(global, env, buffer) { f = T1(0.0); } else X = 101; } else X = 101; - d: do if ((X | 0) == 101) { + d: if ((X | 0) == 101) { X = 0; switch(Z | 0){ case 1: - { - q = 0; - x = T1(v * T1(.5)); - f = T1(0.0); - break d; - } + q = 0; + x = T1(v * T1(.5)); + f = T1(0.0); + break d; case 2: - { - q = 0; - x = v; - f = T1(0.0); - break d; - } + q = 0; + x = v; + f = T1(0.0); + break d; case 3: - { - if (k >>> 0 <= 1) { - q = 0; - x = T1(0.0); - f = T1(0.0); - break d; - } - f = T1((k + -1 | 0) >>> 0); - q = 0; - x = T1(0.0); - f = T1(T1(cC(v, T1(0.0))) / f); - break d; - } - case 5: - { - f = T1(v / T1((k + 1 | 0) >>> 0)); - q = 0; - x = f; - break d; - } - case 4: - { - f = T1(v / T1(k >>> 0)); - q = 0; - x = T1(f * T1(.5)); - break d; - } - default: - { + if (k >>> 0 <= 1) { q = 0; x = T1(0.0); f = T1(0.0); break d; } + f = T1((k + -1 | 0) >>> 0); + q = 0; + x = T1(0.0); + f = T1(T1(cC(v, T1(0.0))) / f); + break d; + case 5: + f = T1(v / T1((k + 1 | 0) >>> 0)); + q = 0; + x = f; + break d; + case 4: + f = T1(v / T1(k >>> 0)); + q = 0; + x = T1(f * T1(.5)); + break d; + default: + q = 0; + x = T1(0.0); + f = T1(0.0); + break d; } } - while (0) e = T1($ + x); if (B) { w = T1(v / T1(q | 0)); @@ -2340,42 +2313,37 @@ export function foo(global, env, buffer) { e: do if ((c1[q + 36 >> 2] | 0) != 1) { switch(c1[q + 24 >> 2] | 0){ case 1: - { - if (Ne(q, Ja) | 0) { - if (!o) break e; - Ma = T1(Oe(q, Ja, H)); - Ma = T1(Ma + T1(se(b, Ja))); - Ma = T1(Ma + T1(me(q, Ja, Ea))); - g1[q + 400 + (c1[S >> 2] << 2) >> 2] = Ma; - break e; - } - break; + if (Ne(q, Ja) | 0) { + if (!o) break e; + Ma = T1(Oe(q, Ja, H)); + Ma = T1(Ma + T1(se(b, Ja))); + Ma = T1(Ma + T1(me(q, Ja, Ea))); + g1[q + 400 + (c1[S >> 2] << 2) >> 2] = Ma; + break e; } + break; case 0: - { - Oa = (c1[(Ke(q, Ja) | 0) + 4 >> 2] | 0) == 3; - Ma = T1(w + e); - e = Oa ? Ma : e; - if (o) { - Oa = q + 400 + (c1[S >> 2] << 2) | 0; - g1[Oa >> 2] = T1(e + T1(g1[Oa >> 2])); - } - Oa = (c1[(Le(q, Ja) | 0) + 4 >> 2] | 0) == 3; - Ma = T1(w + e); - e = Oa ? Ma : e; - if (M) { - Ma = T1(f + T1(Ud(q, Ja, Ea))); - v = qa; - e = T1(e + T1(Ma + T1(g1[q + 504 >> 2]))); - break e; - } else { - e = T1(e + T1(f + T1(Pe(q, Ja, Ea)))); - v = T1(cC(v, T1(Pe(q, Ka, Ea)))); - break e; - } + Oa = (c1[(Ke(q, Ja) | 0) + 4 >> 2] | 0) == 3; + Ma = T1(w + e); + e = Oa ? Ma : e; + if (o) { + Oa = q + 400 + (c1[S >> 2] << 2) | 0; + g1[Oa >> 2] = T1(e + T1(g1[Oa >> 2])); + } + Oa = (c1[(Le(q, Ja) | 0) + 4 >> 2] | 0) == 3; + Ma = T1(w + e); + e = Oa ? Ma : e; + if (M) { + Ma = T1(f + T1(Ud(q, Ja, Ea))); + v = qa; + e = T1(e + T1(Ma + T1(g1[q + 504 >> 2]))); + break e; + } else { + e = T1(e + T1(f + T1(Pe(q, Ja, Ea)))); + v = T1(cC(v, T1(Pe(q, Ka, Ea)))); + break e; } default: - {} } if (o) { Ma = T1(x + T1(se(b, Ja))); @@ -2446,7 +2414,7 @@ export function foo(global, env, buffer) { Ma = Fa ? e : F; e = Fa ? F : e; Oa = ((Sb(Ma) | 0) ^ 1) & 1; - Td(s, Ma, e, Ga, Oa, ((Sb(e) | 0) ^ 1) & 1, Ea, sa, 1, 3493, p) | 0; + Td(s, Ma, e, Ga, Oa, ((Sb(e) | 0) ^ 1) & 1, Ea, sa, 1, 3493, p); e = u; } else X = 139; while (0) @@ -2469,20 +2437,14 @@ export function foo(global, env, buffer) { } switch(q | 0){ case 1: - { - e = u; - break f; - } + e = u; + break f; case 2: - { - e = T1(u + T1(e * T1(.5))); - break f; - } + e = T1(u + T1(e * T1(.5))); + break f; default: - { - e = T1(u + e); - break f; - } + e = T1(u + e); + break f; } } while (0) @@ -2511,23 +2473,17 @@ export function foo(global, env, buffer) { e = T1(qa - oa); g: do switch(c1[b + 12 >> 2] | 0){ case 3: - { - u = T1(u + e); - z = T1(0.0); - break; - } + u = T1(u + e); + z = T1(0.0); + break; case 2: - { - u = T1(u + T1(e * T1(.5))); - z = T1(0.0); - break; - } + u = T1(u + T1(e * T1(.5))); + z = T1(0.0); + break; case 4: - { - if (qa > oa) z = T1(e / T1(k >>> 0)); - else z = T1(0.0); - break; - } + if (qa > oa) z = T1(e / T1(k >>> 0)); + else z = T1(0.0); + break; case 7: if (qa > oa) { u = T1(u + T1(e / T1(k << 1 >>> 0))); @@ -2540,11 +2496,9 @@ export function foo(global, env, buffer) { break g; } case 6: - { - z = T1(e / T1(L >>> 0)); - z = qa > oa & q ? z : T1(0.0); - break; - } + z = T1(e / T1(L >>> 0)); + z = qa > oa & q ? z : T1(0.0); + break; default: z = T1(0.0); } @@ -2554,13 +2508,13 @@ export function foo(global, env, buffer) { C = 976 + (Ka << 2) | 0; t = 0; r = 0; - while(1){ + while(true){ h: do if (r >>> 0 < Ia >>> 0) { v = T1(0.0); w = T1(0.0); e = T1(0.0); s = r; - while(1){ + while(true){ q = c1[(c1[Ha >> 2] | 0) + (s << 2) >> 2] | 0; do if ((c1[q + 36 >> 2] | 0) != 1 ? (c1[q + 24 >> 2] | 0) == 0 : 0) { if ((c1[q + 940 >> 2] | 0) != (t | 0)) break h; @@ -2601,53 +2555,42 @@ export function foo(global, env, buffer) { q = r; do { r = c1[(c1[Ha >> 2] | 0) + (q << 2) >> 2] | 0; - i: do if ((c1[r + 36 >> 2] | 0) != 1 ? (c1[r + 24 >> 2] | 0) == 0 : 0) switch(Je(b, r) | 0){ + i: if ((c1[r + 36 >> 2] | 0) != 1 ? (c1[r + 24 >> 2] | 0) == 0 : 0) switch(Je(b, r) | 0){ case 1: - { - Ma = T1(f + T1(me(r, Ka, Ea))); - g1[r + 400 + (c1[B >> 2] << 2) >> 2] = Ma; - break i; - } + Ma = T1(f + T1(me(r, Ka, Ea))); + g1[r + 400 + (c1[B >> 2] << 2) >> 2] = Ma; + break i; case 3: - { - Ma = T1(T1(u - T1(ne(r, Ka, Ea))) - T1(g1[r + 908 + (c1[C >> 2] << 2) >> 2])); - g1[r + 400 + (c1[B >> 2] << 2) >> 2] = Ma; - break i; - } + Ma = T1(T1(u - T1(ne(r, Ka, Ea))) - T1(g1[r + 908 + (c1[C >> 2] << 2) >> 2])); + g1[r + 400 + (c1[B >> 2] << 2) >> 2] = Ma; + break i; case 2: - { - Ma = T1(f + T1(T1(y - T1(g1[r + 908 + (c1[C >> 2] << 2) >> 2])) * T1(.5))); - g1[r + 400 + (c1[B >> 2] << 2) >> 2] = Ma; - break i; - } + Ma = T1(f + T1(T1(y - T1(g1[r + 908 + (c1[C >> 2] << 2) >> 2])) * T1(.5))); + g1[r + 400 + (c1[B >> 2] << 2) >> 2] = Ma; + break i; case 4: - { - Ma = T1(f + T1(me(r, Ka, Ea))); - g1[r + 400 + (c1[B >> 2] << 2) >> 2] = Ma; - if (ae(r, Ka, qa) | 0) break i; - if (Fa) { - v = T1(g1[r + 908 >> 2]); - e = T1(v + T1(Ud(r, Ja, Ea))); - w = y; - } else { - w = T1(g1[r + 912 >> 2]); - w = T1(w + T1(Ud(r, Ka, Ea))); - e = y; - v = T1(g1[r + 908 >> 2]); - } - if (Ld(e, v) | 0 ? Ld(w, T1(g1[r + 912 >> 2])) | 0 : 0) break i; - Td(r, e, w, Ga, 1, 1, Ea, sa, 1, 3501, p) | 0; - break i; + Ma = T1(f + T1(me(r, Ka, Ea))); + g1[r + 400 + (c1[B >> 2] << 2) >> 2] = Ma; + if (ae(r, Ka, qa) | 0) break i; + if (Fa) { + v = T1(g1[r + 908 >> 2]); + e = T1(v + T1(Ud(r, Ja, Ea))); + w = y; + } else { + w = T1(g1[r + 912 >> 2]); + w = T1(w + T1(Ud(r, Ka, Ea))); + e = y; + v = T1(g1[r + 908 >> 2]); } + if (Ld(e, v) | 0 ? Ld(w, T1(g1[r + 912 >> 2])) | 0 : 0) break i; + Td(r, e, w, Ga, 1, 1, Ea, sa, 1, 3501, p); + break i; case 5: - { - g1[r + 404 >> 2] = T1(T1(x - T1(Se(r))) + T1(Oe(r, 0, qa))); - break i; - } + g1[r + 404 >> 2] = T1(T1(x - T1(Se(r))) + T1(Oe(r, 0, qa))); + break i; default: break i; } - while (0) q = q + 1 | 0; }while ((q | 0) != (s | 0)) } @@ -2797,22 +2740,16 @@ export function foo(global, env, buffer) { switch(c1[a + 4 >> 2] | 0){ case 0: case 3: - { - a = 0; - break; - } + a = 0; + break; case 1: - { - if (T1(g1[a >> 2]) < T1(0.0)) a = 0; - else e = 5; - break; - } + if (T1(g1[a >> 2]) < T1(0.0)) a = 0; + else e = 5; + break; case 2: - { - if (T1(g1[a >> 2]) < T1(0.0)) a = 0; - else a = (Sb(d) | 0) ^ 1; - break; - } + if (T1(g1[a >> 2]) < T1(0.0)) a = 0; + else a = (Sb(d) | 0) ^ 1; + break; default: e = 5; } @@ -2824,15 +2761,11 @@ export function foo(global, env, buffer) { b = T1(b); switch(c1[a + 4 >> 2] | 0){ case 2: - { - b = T1(T1(T1(g1[a >> 2]) * b) / T1(100.0)); - break; - } + b = T1(T1(T1(g1[a >> 2]) * b) / T1(100.0)); + break; case 1: - { - b = T1(g1[a >> 2]); - break; - } + b = T1(g1[a >> 2]); + break; default: b = T1(t1); } @@ -2912,10 +2845,8 @@ export function foo(global, env, buffer) { switch(d | 0){ case 5: case 0: - { - a = CB(c1[489] | 0, e, f) | 0; - break; - } + a = CB(c1[489] | 0, e, f) | 0; + break; default: a = iC(e, f) | 0; } @@ -2942,7 +2873,7 @@ export function foo(global, env, buffer) { e = e | 0; f = f | 0; a = a | 0 ? a : 956; - Bb[c1[a + 8 >> 2] & 1](a, b, d, e, f) | 0; + Bb[c1[a + 8 >> 2] & 1](a, b, d, e, f); if ((d | 0) == 5) Ta(); else return; } @@ -2990,7 +2921,7 @@ export function foo(global, env, buffer) { e = a + 4 | 0; a = d - b | 0; if ((a | 0) > 0) { - BC(c1[e >> 2] | 0, b | 0, a | 0) | 0; + BC(c1[e >> 2] | 0, b | 0, a | 0); c1[e >> 2] = (c1[e >> 2] | 0) + (a >>> 2 << 2); } return; @@ -3039,17 +2970,13 @@ export function foo(global, env, buffer) { a: do if ((b | 0) == 2) { switch(a | 0){ case 2: - { - a = 3; - break a; - } + a = 3; + break a; case 3: break; default: - { - c = 4; - break a; - } + c = 4; + break a; } a = 2; } else c = 4; @@ -3237,7 +3164,7 @@ export function foo(global, env, buffer) { function Ge(b) { b = b | 0; var d = 0, e = 0; - yC(b + 400 | 0, 0, 540) | 0; + yC(b + 400 | 0, 0, 540); a1[b + 985 >> 0] = 1; lc(b); e = $b(b) | 0; @@ -3367,7 +3294,7 @@ export function foo(global, env, buffer) { Me(b, 0, i, h, D, B); d = T1(g1[A >> 2]); f = T1(g1[B >> 2]); - Td(b, d, f, k, c1[C >> 2] | 0, c1[D >> 2] | 0, h, i, 0, 3565, m) | 0; + Td(b, d, f, k, c1[C >> 2] | 0, c1[D >> 2] | 0, h, i, 0, 3565, m); i = T1(g1[b + 908 + (c1[976 + (F << 2) >> 2] << 2) >> 2]); g1[b + 504 >> 2] = T1(cC(i, T1(Ce(b, F, h)))); } @@ -3419,22 +3346,17 @@ export function foo(global, env, buffer) { switch(c1[f >> 2] | 0){ case 2: case 1: - { - f = Sb(d) | 0; - e = T1(g1[h >> 2]); - g1[h >> 2] = f | e < d ? e : d; - break; - } + f = Sb(d) | 0; + e = T1(g1[h >> 2]); + g1[h >> 2] = f | e < d ? e : d; + break; case 0: - { - if (!(Sb(d) | 0)) { - c1[f >> 2] = 2; - g1[h >> 2] = d; - } - break; + if (!(Sb(d) | 0)) { + c1[f >> 2] = 2; + g1[h >> 2] = d; } + break; default: - {} } return; } @@ -3479,7 +3401,7 @@ export function foo(global, env, buffer) { if (!d) b = 0; else { b = 0; - while(1){ + while(true){ e = ac(a, b) | 0; if ((c1[e + 24 >> 2] | 0) == 0 ? (c1[e + 20 >> 2] | 0) == 5 : 0) { b = 1; @@ -3513,7 +3435,7 @@ export function foo(global, env, buffer) { do if (h | 0) { d = 0; f = 0; - while(1){ + while(true){ e = ac(a, f) | 0; if (c1[e + 940 >> 2] | 0) { i = 8; @@ -3609,13 +3531,15 @@ export function foo(global, env, buffer) { } else k = T1(o + T1(be(c1[b + 996 >> 2] | 0, f))); l = Sb(j) | 0; m = Sb(k) | 0; - do if (l ^ m ? (p = T1(g1[b + 396 >> 2]), !(Sb(p) | 0)) : 0) if (l) { - j = T1(n + T1(T1(k - o) * p)); - break; - } else { - v = T1(o + T1(T1(j - n) / p)); - k = m ? v : k; - break; + do if (l ^ m ? (p = T1(g1[b + 396 >> 2]), !(Sb(p) | 0)) : 0) { + if (l) { + j = T1(n + T1(T1(k - o) * p)); + break; + } else { + v = T1(o + T1(T1(j - n) / p)); + k = m ? v : k; + break; + } } while (0) m = Sb(j) | 0; @@ -3624,13 +3548,13 @@ export function foo(global, env, buffer) { w = (m ^ 1) & 1; e = d > T1(0.0) & ((e | 0) != 0 & m); j = r ? j : e ? d : j; - Td(b, j, k, h, r ? w : e ? 2 : w, m & (l ^ 1) & 1, j, k, 0, 3623, i) | 0; + Td(b, j, k, h, r ? w : e ? 2 : w, m & (l ^ 1) & 1, j, k, 0, 3623, i); j = T1(g1[b + 908 >> 2]); j = T1(j + T1(Ud(b, 2, d))); k = T1(g1[b + 912 >> 2]); k = T1(k + T1(Ud(b, 0, d))); } - Td(b, j, k, h, 1, 1, j, k, 1, 3635, i) | 0; + Td(b, j, k, h, 1, 1, j, k, 1, 3635, i); if (Ze(b, s) | 0 ? !(Ne(b, s) | 0) : 0) { w = c1[976 + (s << 2) >> 2] | 0; v = T1(g1[a + 908 + (w << 2) >> 2]); @@ -3706,12 +3630,10 @@ export function foo(global, env, buffer) { switch(c1[b + 56 >> 2] | 0){ case 0: case 3: - { - d = T1(g1[b + 40 >> 2]); - if (d > T1(0.0) & ((Sb(d) | 0) ^ 1)) b = a1[(c1[b + 976 >> 2] | 0) + 2 >> 0] | 0 ? 1056 : 992; - else b = 1056; - break; - } + d = T1(g1[b + 40 >> 2]); + if (d > T1(0.0) & ((Sb(d) | 0) ^ 1)) b = a1[(c1[b + 976 >> 2] | 0) + 2 >> 0] | 0 ? 1056 : 992; + else b = 1056; + break; default: b = b + 52 | 0; } @@ -3791,7 +3713,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 2) << 2) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -3841,7 +3763,7 @@ export function foo(global, env, buffer) { c1[h >> 2] = e; }while (a >>> 0 < d >>> 0) } - if (g | 0) GC(i + (0 - g << 2) | 0, b | 0, f | 0) | 0; + if (g | 0) GC(i + (0 - g << 2) | 0, b | 0, f | 0); return; } function ff(a, b, d) { @@ -3856,12 +3778,12 @@ export function foo(global, env, buffer) { g = h - f | 0; e = j + (0 - (g >> 2) << 2) | 0; c1[i >> 2] = e; - if ((g | 0) > 0) BC(e | 0, f | 0, g | 0) | 0; + if ((g | 0) > 0) BC(e | 0, f | 0, g | 0); f = a + 4 | 0; g = b + 8 | 0; e = (c1[f >> 2] | 0) - h | 0; if ((e | 0) > 0) { - BC(c1[g >> 2] | 0, d | 0, e | 0) | 0; + BC(c1[g >> 2] | 0, d | 0, e | 0); c1[g >> 2] = (c1[g >> 2] | 0) + (e >>> 2 << 2); } h = c1[a >> 2] | 0; @@ -4608,7 +4530,7 @@ export function foo(global, env, buffer) { c1[a + 12 >> 2] = c1[b + 12 >> 2]; } else { Zg(d, 0); - Ja1(e | 0, d | 0) | 0; + Ja1(e | 0, d | 0); _g(a, d); $g(d); } @@ -4882,419 +4804,419 @@ export function foo(global, env, buffer) { f = b + 8 | 0; e = b; Eh(a, 3646); - Fh(a, 3651, 2) | 0; - Gh(a, 3665, 2) | 0; - Hh(a, 3682, 18) | 0; + Fh(a, 3651, 2); + Gh(a, 3665, 2); + Hh(a, 3682, 18); c1[Ga >> 2] = 19; c1[Ga + 4 >> 2] = 0; c1[d >> 2] = c1[Ga >> 2]; c1[d + 4 >> 2] = c1[Ga + 4 >> 2]; - Ih(a, 3690, d) | 0; + Ih(a, 3690, d); c1[Fa >> 2] = 1; c1[Fa + 4 >> 2] = 0; c1[d >> 2] = c1[Fa >> 2]; c1[d + 4 >> 2] = c1[Fa + 4 >> 2]; - Jh(a, 3696, d) | 0; + Jh(a, 3696, d); c1[Ea >> 2] = 2; c1[Ea + 4 >> 2] = 0; c1[d >> 2] = c1[Ea >> 2]; c1[d + 4 >> 2] = c1[Ea + 4 >> 2]; - Kh(a, 3706, d) | 0; + Kh(a, 3706, d); c1[Da >> 2] = 1; c1[Da + 4 >> 2] = 0; c1[d >> 2] = c1[Da >> 2]; c1[d + 4 >> 2] = c1[Da + 4 >> 2]; - Lh(a, 3722, d) | 0; + Lh(a, 3722, d); c1[Ca >> 2] = 2; c1[Ca + 4 >> 2] = 0; c1[d >> 2] = c1[Ca >> 2]; c1[d + 4 >> 2] = c1[Ca + 4 >> 2]; - Lh(a, 3734, d) | 0; + Lh(a, 3734, d); c1[Ba >> 2] = 3; c1[Ba + 4 >> 2] = 0; c1[d >> 2] = c1[Ba >> 2]; c1[d + 4 >> 2] = c1[Ba + 4 >> 2]; - Kh(a, 3753, d) | 0; + Kh(a, 3753, d); c1[Aa >> 2] = 4; c1[Aa + 4 >> 2] = 0; c1[d >> 2] = c1[Aa >> 2]; c1[d + 4 >> 2] = c1[Aa + 4 >> 2]; - Kh(a, 3769, d) | 0; + Kh(a, 3769, d); c1[za >> 2] = 5; c1[za + 4 >> 2] = 0; c1[d >> 2] = c1[za >> 2]; c1[d + 4 >> 2] = c1[za + 4 >> 2]; - Kh(a, 3783, d) | 0; + Kh(a, 3783, d); c1[ya >> 2] = 6; c1[ya + 4 >> 2] = 0; c1[d >> 2] = c1[ya >> 2]; c1[d + 4 >> 2] = c1[ya + 4 >> 2]; - Kh(a, 3796, d) | 0; + Kh(a, 3796, d); c1[xa >> 2] = 7; c1[xa + 4 >> 2] = 0; c1[d >> 2] = c1[xa >> 2]; c1[d + 4 >> 2] = c1[xa + 4 >> 2]; - Kh(a, 3813, d) | 0; + Kh(a, 3813, d); c1[wa >> 2] = 8; c1[wa + 4 >> 2] = 0; c1[d >> 2] = c1[wa >> 2]; c1[d + 4 >> 2] = c1[wa + 4 >> 2]; - Kh(a, 3825, d) | 0; + Kh(a, 3825, d); c1[va >> 2] = 3; c1[va + 4 >> 2] = 0; c1[d >> 2] = c1[va >> 2]; c1[d + 4 >> 2] = c1[va + 4 >> 2]; - Lh(a, 3843, d) | 0; + Lh(a, 3843, d); c1[ua >> 2] = 4; c1[ua + 4 >> 2] = 0; c1[d >> 2] = c1[ua >> 2]; c1[d + 4 >> 2] = c1[ua + 4 >> 2]; - Lh(a, 3853, d) | 0; + Lh(a, 3853, d); c1[ta >> 2] = 9; c1[ta + 4 >> 2] = 0; c1[d >> 2] = c1[ta >> 2]; c1[d + 4 >> 2] = c1[ta + 4 >> 2]; - Kh(a, 3870, d) | 0; + Kh(a, 3870, d); c1[sa >> 2] = 10; c1[sa + 4 >> 2] = 0; c1[d >> 2] = c1[sa >> 2]; c1[d + 4 >> 2] = c1[sa + 4 >> 2]; - Kh(a, 3884, d) | 0; + Kh(a, 3884, d); c1[ra >> 2] = 11; c1[ra + 4 >> 2] = 0; c1[d >> 2] = c1[ra >> 2]; c1[d + 4 >> 2] = c1[ra + 4 >> 2]; - Kh(a, 3896, d) | 0; + Kh(a, 3896, d); c1[qa >> 2] = 1; c1[qa + 4 >> 2] = 0; c1[d >> 2] = c1[qa >> 2]; c1[d + 4 >> 2] = c1[qa + 4 >> 2]; - Mh(a, 3907, d) | 0; + Mh(a, 3907, d); c1[pa >> 2] = 2; c1[pa + 4 >> 2] = 0; c1[d >> 2] = c1[pa >> 2]; c1[d + 4 >> 2] = c1[pa + 4 >> 2]; - Mh(a, 3915, d) | 0; + Mh(a, 3915, d); c1[oa >> 2] = 3; c1[oa + 4 >> 2] = 0; c1[d >> 2] = c1[oa >> 2]; c1[d + 4 >> 2] = c1[oa + 4 >> 2]; - Mh(a, 3928, d) | 0; + Mh(a, 3928, d); c1[na >> 2] = 4; c1[na + 4 >> 2] = 0; c1[d >> 2] = c1[na >> 2]; c1[d + 4 >> 2] = c1[na + 4 >> 2]; - Mh(a, 3948, d) | 0; + Mh(a, 3948, d); c1[ma >> 2] = 5; c1[ma + 4 >> 2] = 0; c1[d >> 2] = c1[ma >> 2]; c1[d + 4 >> 2] = c1[ma + 4 >> 2]; - Mh(a, 3960, d) | 0; + Mh(a, 3960, d); c1[la >> 2] = 6; c1[la + 4 >> 2] = 0; c1[d >> 2] = c1[la >> 2]; c1[d + 4 >> 2] = c1[la + 4 >> 2]; - Mh(a, 3974, d) | 0; + Mh(a, 3974, d); c1[ka >> 2] = 7; c1[ka + 4 >> 2] = 0; c1[d >> 2] = c1[ka >> 2]; c1[d + 4 >> 2] = c1[ka + 4 >> 2]; - Mh(a, 3983, d) | 0; + Mh(a, 3983, d); c1[ja >> 2] = 20; c1[ja + 4 >> 2] = 0; c1[d >> 2] = c1[ja >> 2]; c1[d + 4 >> 2] = c1[ja + 4 >> 2]; - Ih(a, 3999, d) | 0; + Ih(a, 3999, d); c1[ia >> 2] = 8; c1[ia + 4 >> 2] = 0; c1[d >> 2] = c1[ia >> 2]; c1[d + 4 >> 2] = c1[ia + 4 >> 2]; - Mh(a, 4012, d) | 0; + Mh(a, 4012, d); c1[ha >> 2] = 9; c1[ha + 4 >> 2] = 0; c1[d >> 2] = c1[ha >> 2]; c1[d + 4 >> 2] = c1[ha + 4 >> 2]; - Mh(a, 4022, d) | 0; + Mh(a, 4022, d); c1[ga >> 2] = 21; c1[ga + 4 >> 2] = 0; c1[d >> 2] = c1[ga >> 2]; c1[d + 4 >> 2] = c1[ga + 4 >> 2]; - Ih(a, 4039, d) | 0; + Ih(a, 4039, d); c1[fa >> 2] = 10; c1[fa + 4 >> 2] = 0; c1[d >> 2] = c1[fa >> 2]; c1[d + 4 >> 2] = c1[fa + 4 >> 2]; - Mh(a, 4053, d) | 0; + Mh(a, 4053, d); c1[ea >> 2] = 11; c1[ea + 4 >> 2] = 0; c1[d >> 2] = c1[ea >> 2]; c1[d + 4 >> 2] = c1[ea + 4 >> 2]; - Mh(a, 4065, d) | 0; + Mh(a, 4065, d); c1[da >> 2] = 12; c1[da + 4 >> 2] = 0; c1[d >> 2] = c1[da >> 2]; c1[d + 4 >> 2] = c1[da + 4 >> 2]; - Mh(a, 4084, d) | 0; + Mh(a, 4084, d); c1[ca >> 2] = 13; c1[ca + 4 >> 2] = 0; c1[d >> 2] = c1[ca >> 2]; c1[d + 4 >> 2] = c1[ca + 4 >> 2]; - Mh(a, 4097, d) | 0; + Mh(a, 4097, d); c1[ba >> 2] = 14; c1[ba + 4 >> 2] = 0; c1[d >> 2] = c1[ba >> 2]; c1[d + 4 >> 2] = c1[ba + 4 >> 2]; - Mh(a, 4117, d) | 0; + Mh(a, 4117, d); c1[aa >> 2] = 15; c1[aa + 4 >> 2] = 0; c1[d >> 2] = c1[aa >> 2]; c1[d + 4 >> 2] = c1[aa + 4 >> 2]; - Mh(a, 4129, d) | 0; + Mh(a, 4129, d); c1[$ >> 2] = 16; c1[$ + 4 >> 2] = 0; c1[d >> 2] = c1[$ >> 2]; c1[d + 4 >> 2] = c1[$ + 4 >> 2]; - Mh(a, 4148, d) | 0; + Mh(a, 4148, d); c1[_ >> 2] = 17; c1[_ + 4 >> 2] = 0; c1[d >> 2] = c1[_ >> 2]; c1[d + 4 >> 2] = c1[_ + 4 >> 2]; - Mh(a, 4161, d) | 0; + Mh(a, 4161, d); c1[Z >> 2] = 18; c1[Z + 4 >> 2] = 0; c1[d >> 2] = c1[Z >> 2]; c1[d + 4 >> 2] = c1[Z + 4 >> 2]; - Mh(a, 4181, d) | 0; + Mh(a, 4181, d); c1[Y >> 2] = 5; c1[Y + 4 >> 2] = 0; c1[d >> 2] = c1[Y >> 2]; c1[d + 4 >> 2] = c1[Y + 4 >> 2]; - Lh(a, 4196, d) | 0; + Lh(a, 4196, d); c1[X >> 2] = 6; c1[X + 4 >> 2] = 0; c1[d >> 2] = c1[X >> 2]; c1[d + 4 >> 2] = c1[X + 4 >> 2]; - Lh(a, 4206, d) | 0; + Lh(a, 4206, d); c1[W >> 2] = 7; c1[W + 4 >> 2] = 0; c1[d >> 2] = c1[W >> 2]; c1[d + 4 >> 2] = c1[W + 4 >> 2]; - Lh(a, 4217, d) | 0; + Lh(a, 4217, d); c1[V >> 2] = 3; c1[V + 4 >> 2] = 0; c1[d >> 2] = c1[V >> 2]; c1[d + 4 >> 2] = c1[V + 4 >> 2]; - Nh(a, 4235, d) | 0; + Nh(a, 4235, d); c1[U >> 2] = 1; c1[U + 4 >> 2] = 0; c1[d >> 2] = c1[U >> 2]; c1[d + 4 >> 2] = c1[U + 4 >> 2]; - Oh(a, 4251, d) | 0; + Oh(a, 4251, d); c1[T >> 2] = 4; c1[T + 4 >> 2] = 0; c1[d >> 2] = c1[T >> 2]; c1[d + 4 >> 2] = c1[T + 4 >> 2]; - Nh(a, 4263, d) | 0; + Nh(a, 4263, d); c1[S >> 2] = 5; c1[S + 4 >> 2] = 0; c1[d >> 2] = c1[S >> 2]; c1[d + 4 >> 2] = c1[S + 4 >> 2]; - Nh(a, 4279, d) | 0; + Nh(a, 4279, d); c1[R >> 2] = 6; c1[R + 4 >> 2] = 0; c1[d >> 2] = c1[R >> 2]; c1[d + 4 >> 2] = c1[R + 4 >> 2]; - Nh(a, 4293, d) | 0; + Nh(a, 4293, d); c1[Q >> 2] = 7; c1[Q + 4 >> 2] = 0; c1[d >> 2] = c1[Q >> 2]; c1[d + 4 >> 2] = c1[Q + 4 >> 2]; - Nh(a, 4306, d) | 0; + Nh(a, 4306, d); c1[P >> 2] = 8; c1[P + 4 >> 2] = 0; c1[d >> 2] = c1[P >> 2]; c1[d + 4 >> 2] = c1[P + 4 >> 2]; - Nh(a, 4323, d) | 0; + Nh(a, 4323, d); c1[O >> 2] = 9; c1[O + 4 >> 2] = 0; c1[d >> 2] = c1[O >> 2]; c1[d + 4 >> 2] = c1[O + 4 >> 2]; - Nh(a, 4335, d) | 0; + Nh(a, 4335, d); c1[N >> 2] = 2; c1[N + 4 >> 2] = 0; c1[d >> 2] = c1[N >> 2]; c1[d + 4 >> 2] = c1[N + 4 >> 2]; - Oh(a, 4353, d) | 0; + Oh(a, 4353, d); c1[M >> 2] = 12; c1[M + 4 >> 2] = 0; c1[d >> 2] = c1[M >> 2]; c1[d + 4 >> 2] = c1[M + 4 >> 2]; - Ph(a, 4363, d) | 0; + Ph(a, 4363, d); c1[L >> 2] = 1; c1[L + 4 >> 2] = 0; c1[d >> 2] = c1[L >> 2]; c1[d + 4 >> 2] = c1[L + 4 >> 2]; - Qh(a, 4376, d) | 0; + Qh(a, 4376, d); c1[K >> 2] = 2; c1[K + 4 >> 2] = 0; c1[d >> 2] = c1[K >> 2]; c1[d + 4 >> 2] = c1[K + 4 >> 2]; - Qh(a, 4388, d) | 0; + Qh(a, 4388, d); c1[J >> 2] = 13; c1[J + 4 >> 2] = 0; c1[d >> 2] = c1[J >> 2]; c1[d + 4 >> 2] = c1[J + 4 >> 2]; - Ph(a, 4402, d) | 0; + Ph(a, 4402, d); c1[I >> 2] = 14; c1[I + 4 >> 2] = 0; c1[d >> 2] = c1[I >> 2]; c1[d + 4 >> 2] = c1[I + 4 >> 2]; - Ph(a, 4411, d) | 0; + Ph(a, 4411, d); c1[H >> 2] = 15; c1[H + 4 >> 2] = 0; c1[d >> 2] = c1[H >> 2]; c1[d + 4 >> 2] = c1[H + 4 >> 2]; - Ph(a, 4421, d) | 0; + Ph(a, 4421, d); c1[G >> 2] = 16; c1[G + 4 >> 2] = 0; c1[d >> 2] = c1[G >> 2]; c1[d + 4 >> 2] = c1[G + 4 >> 2]; - Ph(a, 4433, d) | 0; + Ph(a, 4433, d); c1[F >> 2] = 17; c1[F + 4 >> 2] = 0; c1[d >> 2] = c1[F >> 2]; c1[d + 4 >> 2] = c1[F + 4 >> 2]; - Ph(a, 4446, d) | 0; + Ph(a, 4446, d); c1[E >> 2] = 18; c1[E + 4 >> 2] = 0; c1[d >> 2] = c1[E >> 2]; c1[d + 4 >> 2] = c1[E + 4 >> 2]; - Ph(a, 4458, d) | 0; + Ph(a, 4458, d); c1[D >> 2] = 3; c1[D + 4 >> 2] = 0; c1[d >> 2] = c1[D >> 2]; c1[d + 4 >> 2] = c1[D + 4 >> 2]; - Qh(a, 4471, d) | 0; + Qh(a, 4471, d); c1[C >> 2] = 1; c1[C + 4 >> 2] = 0; c1[d >> 2] = c1[C >> 2]; c1[d + 4 >> 2] = c1[C + 4 >> 2]; - Rh(a, 4486, d) | 0; + Rh(a, 4486, d); c1[B >> 2] = 10; c1[B + 4 >> 2] = 0; c1[d >> 2] = c1[B >> 2]; c1[d + 4 >> 2] = c1[B + 4 >> 2]; - Nh(a, 4496, d) | 0; + Nh(a, 4496, d); c1[A >> 2] = 11; c1[A + 4 >> 2] = 0; c1[d >> 2] = c1[A >> 2]; c1[d + 4 >> 2] = c1[A + 4 >> 2]; - Nh(a, 4508, d) | 0; + Nh(a, 4508, d); c1[z >> 2] = 3; c1[z + 4 >> 2] = 0; c1[d >> 2] = c1[z >> 2]; c1[d + 4 >> 2] = c1[z + 4 >> 2]; - Oh(a, 4519, d) | 0; + Oh(a, 4519, d); c1[y >> 2] = 4; c1[y + 4 >> 2] = 0; c1[d >> 2] = c1[y >> 2]; c1[d + 4 >> 2] = c1[y + 4 >> 2]; - Sh(a, 4530, d) | 0; + Sh(a, 4530, d); c1[x >> 2] = 19; c1[x + 4 >> 2] = 0; c1[d >> 2] = c1[x >> 2]; c1[d + 4 >> 2] = c1[x + 4 >> 2]; - Th(a, 4542, d) | 0; + Th(a, 4542, d); c1[w >> 2] = 12; c1[w + 4 >> 2] = 0; c1[d >> 2] = c1[w >> 2]; c1[d + 4 >> 2] = c1[w + 4 >> 2]; - Uh(a, 4554, d) | 0; + Uh(a, 4554, d); c1[v >> 2] = 13; c1[v + 4 >> 2] = 0; c1[d >> 2] = c1[v >> 2]; c1[d + 4 >> 2] = c1[v + 4 >> 2]; - Vh(a, 4568, d) | 0; + Vh(a, 4568, d); c1[u >> 2] = 2; c1[u + 4 >> 2] = 0; c1[d >> 2] = c1[u >> 2]; c1[d + 4 >> 2] = c1[u + 4 >> 2]; - Wh(a, 4578, d) | 0; + Wh(a, 4578, d); c1[t >> 2] = 20; c1[t + 4 >> 2] = 0; c1[d >> 2] = c1[t >> 2]; c1[d + 4 >> 2] = c1[t + 4 >> 2]; - Xh(a, 4587, d) | 0; + Xh(a, 4587, d); c1[s >> 2] = 22; c1[s + 4 >> 2] = 0; c1[d >> 2] = c1[s >> 2]; c1[d + 4 >> 2] = c1[s + 4 >> 2]; - Ih(a, 4602, d) | 0; + Ih(a, 4602, d); c1[r >> 2] = 23; c1[r + 4 >> 2] = 0; c1[d >> 2] = c1[r >> 2]; c1[d + 4 >> 2] = c1[r + 4 >> 2]; - Ih(a, 4619, d) | 0; + Ih(a, 4619, d); c1[q >> 2] = 14; c1[q + 4 >> 2] = 0; c1[d >> 2] = c1[q >> 2]; c1[d + 4 >> 2] = c1[q + 4 >> 2]; - Yh(a, 4629, d) | 0; + Yh(a, 4629, d); c1[p >> 2] = 1; c1[p + 4 >> 2] = 0; c1[d >> 2] = c1[p >> 2]; c1[d + 4 >> 2] = c1[p + 4 >> 2]; - Zh(a, 4637, d) | 0; + Zh(a, 4637, d); c1[o >> 2] = 4; c1[o + 4 >> 2] = 0; c1[d >> 2] = c1[o >> 2]; c1[d + 4 >> 2] = c1[o + 4 >> 2]; - Qh(a, 4653, d) | 0; + Qh(a, 4653, d); c1[n >> 2] = 5; c1[n + 4 >> 2] = 0; c1[d >> 2] = c1[n >> 2]; c1[d + 4 >> 2] = c1[n + 4 >> 2]; - Qh(a, 4669, d) | 0; + Qh(a, 4669, d); c1[m >> 2] = 6; c1[m + 4 >> 2] = 0; c1[d >> 2] = c1[m >> 2]; c1[d + 4 >> 2] = c1[m + 4 >> 2]; - Qh(a, 4686, d) | 0; + Qh(a, 4686, d); c1[k >> 2] = 7; c1[k + 4 >> 2] = 0; c1[d >> 2] = c1[k >> 2]; c1[d + 4 >> 2] = c1[k + 4 >> 2]; - Qh(a, 4701, d) | 0; + Qh(a, 4701, d); c1[j >> 2] = 8; c1[j + 4 >> 2] = 0; c1[d >> 2] = c1[j >> 2]; c1[d + 4 >> 2] = c1[j + 4 >> 2]; - Qh(a, 4719, d) | 0; + Qh(a, 4719, d); c1[i >> 2] = 9; c1[i + 4 >> 2] = 0; c1[d >> 2] = c1[i >> 2]; c1[d + 4 >> 2] = c1[i + 4 >> 2]; - Qh(a, 4736, d) | 0; + Qh(a, 4736, d); c1[h >> 2] = 21; c1[h + 4 >> 2] = 0; c1[d >> 2] = c1[h >> 2]; c1[d + 4 >> 2] = c1[h + 4 >> 2]; - _h(a, 4754, d) | 0; + _h(a, 4754, d); c1[g >> 2] = 2; c1[g + 4 >> 2] = 0; c1[d >> 2] = c1[g >> 2]; c1[d + 4 >> 2] = c1[g + 4 >> 2]; - Rh(a, 4772, d) | 0; + Rh(a, 4772, d); c1[f >> 2] = 3; c1[f + 4 >> 2] = 0; c1[d >> 2] = c1[f >> 2]; c1[d + 4 >> 2] = c1[f + 4 >> 2]; - Rh(a, 4790, d) | 0; + Rh(a, 4790, d); c1[e >> 2] = 4; c1[e + 4 >> 2] = 0; c1[d >> 2] = c1[e >> 2]; c1[d + 4 >> 2] = c1[e + 4 >> 2]; - Rh(a, 4808, d) | 0; + Rh(a, 4808, d); l1 = b; return; } @@ -5727,7 +5649,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7616] | 0)) { qi(9136); - Ha1(24, 9136, o1 | 0) | 0; + Ha1(24, 9136, o1 | 0); d = 7616; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -5807,7 +5729,7 @@ export function foo(global, env, buffer) { g = a + 28 | 0; c1[p >> 2] = c1[g >> 2]; c1[o >> 2] = c1[p >> 2]; - gi(a + 24 | 0, o, n, m, k, j, i) | 0; + gi(a + 24 | 0, o, n, m, k, j, i); c1[g >> 2] = c1[c1[g >> 2] >> 2]; l1 = h; return; @@ -5934,7 +5856,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -6081,7 +6003,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7632] | 0)) { Ti(9184); - Ha1(25, 9184, o1 | 0) | 0; + Ha1(25, 9184, o1 | 0); b = 7632; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -6111,7 +6033,7 @@ export function foo(global, env, buffer) { function Gi(a, b) { a = a | 0; b = b | 0; - Ni(b, a, a + 8 | 0, a + 16 | 0, a + 24 | 0, a + 32 | 0, a + 40 | 0) | 0; + Ni(b, a, a + 8 | 0, a + 16 | 0, a + 24 | 0, a + 32 | 0, a + 40 | 0); return; } function Hi(a) { @@ -6353,7 +6275,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7640] | 0)) { jj(9232); - Ha1(26, 9232, o1 | 0) | 0; + Ha1(26, 9232, o1 | 0); d = 7640; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -6492,7 +6414,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -6689,7 +6611,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7648] | 0)) { Ij(9268); - Ha1(27, 9268, o1 | 0) | 0; + Ha1(27, 9268, o1 | 0); d = 7648; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -6828,7 +6750,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -6982,7 +6904,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7656] | 0)) { ak(9304); - Ha1(28, 9304, o1 | 0) | 0; + Ha1(28, 9304, o1 | 0); d = 7656; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -7121,7 +7043,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -7309,7 +7231,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7664] | 0)) { yk(9340); - Ha1(29, 9340, o1 | 0) | 0; + Ha1(29, 9340, o1 | 0); d = 7664; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -7448,7 +7370,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -7625,7 +7547,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7672] | 0)) { Vk(9376); - Ha1(30, 9376, o1 | 0) | 0; + Ha1(30, 9376, o1 | 0); d = 7672; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -7764,7 +7686,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -7914,7 +7836,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7680] | 0)) { ml(9412); - Ha1(31, 9412, o1 | 0) | 0; + Ha1(31, 9412, o1 | 0); d = 7680; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -8053,7 +7975,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -8207,7 +8129,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7688] | 0)) { Gl(9448); - Ha1(32, 9448, o1 | 0) | 0; + Ha1(32, 9448, o1 | 0); d = 7688; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -8346,7 +8268,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -8519,7 +8441,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7696] | 0)) { am(9484); - Ha1(33, 9484, o1 | 0) | 0; + Ha1(33, 9484, o1 | 0); d = 7696; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -8658,7 +8580,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -8822,7 +8744,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7704] | 0)) { tm(9520); - Ha1(34, 9520, o1 | 0) | 0; + Ha1(34, 9520, o1 | 0); d = 7704; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -8961,7 +8883,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -9120,7 +9042,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7712] | 0)) { Mm(9556); - Ha1(35, 9556, o1 | 0) | 0; + Ha1(35, 9556, o1 | 0); d = 7712; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -9259,7 +9181,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -9409,7 +9331,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7720] | 0)) { dn(9592); - Ha1(36, 9592, o1 | 0) | 0; + Ha1(36, 9592, o1 | 0); d = 7720; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -9548,7 +9470,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -9674,7 +9596,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7736] | 0)) { An(9640); - Ha1(25, 9640, o1 | 0) | 0; + Ha1(25, 9640, o1 | 0); b = 7736; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -9684,7 +9606,7 @@ export function foo(global, env, buffer) { function on(a, b) { a = a | 0; b = b | 0; - un(b, a, a + 8 | 0) | 0; + un(b, a, a + 8 | 0); return; } function pn(a) { @@ -9850,7 +9772,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7744] | 0)) { Mn(9684); - Ha1(37, 9684, o1 | 0) | 0; + Ha1(37, 9684, o1 | 0); d = 7744; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -9989,7 +9911,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -10150,7 +10072,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7752] | 0)) { eo(9720); - Ha1(38, 9720, o1 | 0) | 0; + Ha1(38, 9720, o1 | 0); d = 7752; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -10289,7 +10211,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -10439,7 +10361,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7760] | 0)) { xo(9756); - Ha1(39, 9756, o1 | 0) | 0; + Ha1(39, 9756, o1 | 0); d = 7760; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -10578,7 +10500,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -10737,7 +10659,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7768] | 0)) { Qo(9792); - Ha1(40, 9792, o1 | 0) | 0; + Ha1(40, 9792, o1 | 0); d = 7768; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -10876,7 +10798,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -11040,7 +10962,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7776] | 0)) { hp(9828); - Ha1(41, 9828, o1 | 0) | 0; + Ha1(41, 9828, o1 | 0); d = 7776; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -11179,7 +11101,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -11338,7 +11260,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7784] | 0)) { Ap(9864); - Ha1(42, 9864, o1 | 0) | 0; + Ha1(42, 9864, o1 | 0); d = 7784; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -11477,7 +11399,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -11650,7 +11572,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7792] | 0)) { Wp(9900); - Ha1(43, 9900, o1 | 0) | 0; + Ha1(43, 9900, o1 | 0); d = 7792; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -11789,7 +11711,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -11904,7 +11826,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7800] | 0)) { mq(9936); - Ha1(44, 9936, o1 | 0) | 0; + Ha1(44, 9936, o1 | 0); d = 7800; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -12022,7 +11944,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -12124,7 +12046,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7808] | 0)) { Dq(9972); - Ha1(45, 9972, o1 | 0) | 0; + Ha1(45, 9972, o1 | 0); d = 7808; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -12242,7 +12164,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -12360,7 +12282,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7816] | 0)) { Yq(10008); - Ha1(46, 10008, o1 | 0) | 0; + Ha1(46, 10008, o1 | 0); d = 7816; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -12478,7 +12400,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -12557,7 +12479,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7832] | 0)) { nr(10052); - Ha1(25, 10052, o1 | 0) | 0; + Ha1(25, 10052, o1 | 0); b = 7832; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -12639,23 +12561,23 @@ export function foo(global, env, buffer) { f = b + 8 | 0; e = b; pr(a, 4827); - qr(a, 4834, 3) | 0; - rr(a, 3682, 47) | 0; + qr(a, 4834, 3); + rr(a, 3682, 47); c1[g >> 2] = 9; c1[g + 4 >> 2] = 0; c1[d >> 2] = c1[g >> 2]; c1[d + 4 >> 2] = c1[g + 4 >> 2]; - sr(a, 4841, d) | 0; + sr(a, 4841, d); c1[f >> 2] = 1; c1[f + 4 >> 2] = 0; c1[d >> 2] = c1[f >> 2]; c1[d + 4 >> 2] = c1[f + 4 >> 2]; - tr(a, 4871, d) | 0; + tr(a, 4871, d); c1[e >> 2] = 10; c1[e + 4 >> 2] = 0; c1[d >> 2] = c1[e >> 2]; c1[d + 4 >> 2] = c1[e + 4 >> 2]; - ur(a, 4891, d) | 0; + ur(a, 4891, d); l1 = b; return; } @@ -12789,7 +12711,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7840] | 0)) { Gr(10100); - Ha1(48, 10100, o1 | 0) | 0; + Ha1(48, 10100, o1 | 0); d = 7840; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -12928,7 +12850,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -13087,7 +13009,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7848] | 0)) { Zr(10136); - Ha1(49, 10136, o1 | 0) | 0; + Ha1(49, 10136, o1 | 0); d = 7848; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -13226,7 +13148,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -13399,7 +13321,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7856] | 0)) { ts(10172); - Ha1(50, 10172, o1 | 0) | 0; + Ha1(50, 10172, o1 | 0); d = 7856; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -13538,7 +13460,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (((f | 0) / -12 | 0) * 12 | 0) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -13680,7 +13602,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7864] | 0)) { Os(10208); - Ha1(51, 10208, o1 | 0) | 0; + Ha1(51, 10208, o1 | 0); d = 7864; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -13798,7 +13720,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -13903,7 +13825,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7872] | 0)) { et(10244); - Ha1(52, 10244, o1 | 0) | 0; + Ha1(52, 10244, o1 | 0); d = 7872; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -14021,7 +13943,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -14107,7 +14029,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7880] | 0)) { ut(10280); - Ha1(25, 10280, o1 | 0) | 0; + Ha1(25, 10280, o1 | 0); b = 7880; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -14163,8 +14085,8 @@ export function foo(global, env, buffer) { function vt(a) { a = a | 0; wt(a, 4920); - xt(a) | 0; - yt(a) | 0; + xt(a); + yt(a); return; } function wt(a, b) { @@ -14195,7 +14117,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7888] | 0)) { Bt(10328); - Ha1(53, 10328, o1 | 0) | 0; + Ha1(53, 10328, o1 | 0); b = 7888; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -14322,7 +14244,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7896] | 0)) { Nt(10364); - Ha1(54, 10364, o1 | 0) | 0; + Ha1(54, 10364, o1 | 0); b = 7896; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -14468,7 +14390,7 @@ export function foo(global, env, buffer) { function eu(a) { a = a | 0; fu(a, 4926); - gu(a) | 0; + gu(a); return; } function fu(a, b) { @@ -14492,7 +14414,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7912] | 0)) { iu(10412); - Ha1(56, 10412, o1 | 0) | 0; + Ha1(56, 10412, o1 | 0); b = 7912; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -14629,8 +14551,8 @@ export function foo(global, env, buffer) { function yu(a) { a = a | 0; zu(a, 4933); - Au(a) | 0; - Bu(a) | 0; + Au(a); + Bu(a); return; } function zu(a, b) { @@ -14661,7 +14583,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7920] | 0)) { Du(10452); - Ha1(58, 10452, o1 | 0) | 0; + Ha1(58, 10452, o1 | 0); b = 7920; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -14814,7 +14736,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7928] | 0)) { Tu(10488); - Ha1(59, 10488, o1 | 0) | 0; + Ha1(59, 10488, o1 | 0); b = 7928; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -14911,7 +14833,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7936] | 0)) { jv(10524); - Ha1(25, 10524, o1 | 0) | 0; + Ha1(25, 10524, o1 | 0); b = 7936; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -15005,7 +14927,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[7944] | 0)) { ov(10568); - Ha1(61, 10568, o1 | 0) | 0; + Ha1(61, 10568, o1 | 0); d = 7944; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -15138,7 +15060,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -15195,7 +15117,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7952] | 0)) { Rv(10612); - Ha1(25, 10612, o1 | 0) | 0; + Ha1(25, 10612, o1 | 0); b = 7952; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -15218,7 +15140,7 @@ export function foo(global, env, buffer) { b = l1; l1 = l1 + 16 | 0; d = b; - Iv() | 0; + Iv(); c1[d >> 2] = a; Jv(10608, d); l1 = b; @@ -15227,7 +15149,7 @@ export function foo(global, env, buffer) { function Iv() { if (!(a1[11714] | 0)) { c1[2652] = 0; - Ha1(62, 10608, o1 | 0) | 0; + Ha1(62, 10608, o1 | 0); a1[11714] = 1; } return 10608; @@ -15296,10 +15218,10 @@ export function foo(global, env, buffer) { a = a | 0; b = b | 0; var d = 0, e = 0; - Iv() | 0; + Iv(); d = c1[2652] | 0; a: do if (d | 0) { - while(1){ + while(true){ e = c1[d + 4 >> 2] | 0; if (e | 0 ? (AB(Tv(e) | 0, a) | 0) == 0 : 0) break; d = c1[d >> 2] | 0; @@ -15332,7 +15254,7 @@ export function foo(global, env, buffer) { function Vv() { if (!(a1[11716] | 0)) { c1[2664] = 0; - Ha1(63, 10656, o1 | 0) | 0; + Ha1(63, 10656, o1 | 0); a1[11716] = 1; } return 10656; @@ -15388,7 +15310,7 @@ export function foo(global, env, buffer) { c1[j >> 2] = d; c1[i >> 2] = e; c1[h >> 2] = f; - Vv() | 0; + Vv(); _v(10656, m, k, j, i, h); l1 = g; return; @@ -15436,7 +15358,7 @@ export function foo(global, env, buffer) { c1[j >> 2] = 0; e = (cw(i) | 0) + 1 | 0; dw(q, e); - if (e | 0) while(1){ + if (e | 0) while(true){ e = e + -1 | 0; OA(r, c1[f >> 2] | 0); g = c1[p >> 2] | 0; @@ -15451,10 +15373,10 @@ export function foo(global, env, buffer) { c1[r >> 2] = 0; c1[k >> 2] = 0; c1[m >> 2] = 0; - a: do if (c1[e >> 2] | 0) { + a: if (c1[e >> 2] | 0) { f = 0; g = 0; - while(1){ + while(true){ if ((f | 0) == (g | 0)) gw(r, e); else { c1[f >> 2] = c1[e >> 2]; @@ -15466,7 +15388,6 @@ export function foo(global, env, buffer) { g = c1[n >> 2] | 0; } } - while (0) c1[s >> 2] = hw(h) | 0; c1[t >> 2] = si(i) | 0; iw(d, a, s, t, q, r); @@ -15698,7 +15619,7 @@ export function foo(global, env, buffer) { c1[n >> 2] = 0; c1[m >> 2] = 0; c1[g >> 2] = 0; - Ba1(0, k | 0, a | 0, b | 0, d | 0, e | 0, f | 0, uw(j) | 0) | 0; + Ba1(0, k | 0, a | 0, b | 0, d | 0, e | 0, f | 0, uw(j) | 0); jw(j); kw(i); l1 = h; @@ -15792,7 +15713,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[7960] | 0)) { Fw(10664); - Ha1(25, 10664, o1 | 0) | 0; + Ha1(25, 10664, o1 | 0); b = 7960; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -15886,7 +15807,7 @@ export function foo(global, env, buffer) { e = a + 4 | 0; a = d - b | 0; if ((a | 0) > 0) { - BC(c1[e >> 2] | 0, b | 0, a | 0) | 0; + BC(c1[e >> 2] | 0, b | 0, a | 0); c1[e >> 2] = (c1[e >> 2] | 0) + (a >>> 2 << 2); } return; @@ -15917,7 +15838,7 @@ export function foo(global, env, buffer) { e = a + 4 | 0; a = d - b | 0; if ((a | 0) > 0) { - BC(c1[e >> 2] | 0, b | 0, a | 0) | 0; + BC(c1[e >> 2] | 0, b | 0, a | 0); c1[e >> 2] = (c1[e >> 2] | 0) + (a >>> 2 << 2); } return; @@ -15960,7 +15881,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 2) << 2) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -16024,7 +15945,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 2) << 2) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -16075,7 +15996,7 @@ export function foo(global, env, buffer) { if (h | 0) { j = c1[i + 8 >> 2] | 0; i = c1[i + 4 >> 2] | 0; - while(1){ + while(true){ OA(m, h); Vw(a, m, i, j); g = g + 4 | 0; @@ -16200,7 +16121,7 @@ export function foo(global, env, buffer) { if (!b) a = e; else { b = e; - while(1){ + while(true){ a = qC(12) | 0; j = (hx(f) | 0) + 4 | 0; i = c1[j + 4 >> 2] | 0; @@ -16275,7 +16196,7 @@ export function foo(global, env, buffer) { c1[i >> 2] = 0; c1[h >> 2] = 0; c1[d >> 2] = 0; - xa1(0, g | 0, a | 0, b | 0, tw(f) | 0) | 0; + xa1(0, g | 0, a | 0, b | 0, tw(f) | 0); kw(f); l1 = e; return; @@ -16339,7 +16260,7 @@ export function foo(global, env, buffer) { c1[h >> 2] = c1[b >> 2]; c1[g >> 2] = c1[h >> 2]; b = qw(g) | 0; - xa1(0, f | 0, a | 0, b | 0, rw(d) | 0) | 0; + xa1(0, f | 0, a | 0, b | 0, rw(d) | 0); l1 = e; return; } @@ -16418,7 +16339,7 @@ export function foo(global, env, buffer) { c1[h >> 2] = c1[i >> 2]; b = qw(h) | 0; d = rx(d) | 0; - $a(0, g | 0, a | 0, b | 0, d | 0, rx(e) | 0) | 0; + $a(0, g | 0, a | 0, b | 0, d | 0, rx(e) | 0); l1 = f; return; } @@ -16467,58 +16388,50 @@ export function foo(global, env, buffer) { c1[j + 8 >> 2] = 0; switch(f << 24 >> 24){ case 0: - { - a1[m >> 0] = 0; - wx(k, e, m); - xx(b, k) | 0; - wf(k); - break; - } + a1[m >> 0] = 0; + wx(k, e, m); + xx(b, k); + wf(k); + break; case 8: - { - o = PA(d) | 0; - a1[m >> 0] = 8; - OA(n, c1[o + 4 >> 2] | 0); - yx(k, e, m, n, o + 8 | 0); - xx(b, k) | 0; - wf(k); - break; - } + o = PA(d) | 0; + a1[m >> 0] = 8; + OA(n, c1[o + 4 >> 2] | 0); + yx(k, e, m, n, o + 8 | 0); + xx(b, k); + wf(k); + break; case 9: - { - h = PA(d) | 0; - d = c1[h + 4 >> 2] | 0; - if (d | 0) { - i = j + 8 | 0; - g = h + 12 | 0; - while(1){ - d = d + -1 | 0; - OA(k, c1[g >> 2] | 0); - f = c1[o >> 2] | 0; - if (f >>> 0 < (c1[i >> 2] | 0) >>> 0) { - c1[f >> 2] = c1[k >> 2]; - c1[o >> 2] = (c1[o >> 2] | 0) + 4; - } else ew(j, k); - if (!d) break; - else g = g + 4 | 0; - } + h = PA(d) | 0; + d = c1[h + 4 >> 2] | 0; + if (d | 0) { + i = j + 8 | 0; + g = h + 12 | 0; + while(true){ + d = d + -1 | 0; + OA(k, c1[g >> 2] | 0); + f = c1[o >> 2] | 0; + if (f >>> 0 < (c1[i >> 2] | 0) >>> 0) { + c1[f >> 2] = c1[k >> 2]; + c1[o >> 2] = (c1[o >> 2] | 0) + 4; + } else ew(j, k); + if (!d) break; + else g = g + 4 | 0; } - a1[m >> 0] = 9; - OA(n, c1[h + 8 >> 2] | 0); - zx(k, e, m, n, j); - xx(b, k) | 0; - wf(k); - break; } + a1[m >> 0] = 9; + OA(n, c1[h + 8 >> 2] | 0); + zx(k, e, m, n, j); + xx(b, k); + wf(k); + break; default: - { - o = PA(d) | 0; - a1[m >> 0] = f; - OA(n, c1[o + 4 >> 2] | 0); - Ax(k, e, m, n); - xx(b, k) | 0; - wf(k); - } + o = PA(d) | 0; + a1[m >> 0] = f; + OA(n, c1[o + 4 >> 2] | 0); + Ax(k, e, m, n); + xx(b, k); + wf(k); } kw(j); l1 = p; @@ -16794,7 +16707,7 @@ export function foo(global, env, buffer) { function Wx(a) { a = a | 0; Xx(a, 5044); - Yx(a) | 0; + Yx(a); return; } function Xx(a, b) { @@ -16818,7 +16731,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[8032] | 0)) { _x(10820); - Ha1(64, 10820, o1 | 0) | 0; + Ha1(64, 10820, o1 | 0); b = 8032; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -16980,12 +16893,12 @@ export function foo(global, env, buffer) { function qy(a) { a = a | 0; ry(a, 5052); - sy(a) | 0; - ty(a, 5058, 26) | 0; - uy(a, 5069, 1) | 0; - vy(a, 5077, 10) | 0; - wy(a, 5087, 19) | 0; - yy(a, 5094, 27) | 0; + sy(a); + ty(a, 5058, 26); + uy(a, 5069, 1); + vy(a, 5077, 10); + wy(a, 5087, 19); + yy(a, 5094, 27); return; } function ry(a, b) { @@ -17037,9 +16950,9 @@ export function foo(global, env, buffer) { a = a | 0; b = b | 0; var d = 0, e = 0; - a: while(1){ + a: while(true){ d = c1[2703] | 0; - while(1){ + while(true){ if ((d | 0) == (b | 0)) break a; e = c1[d >> 2] | 0; c1[2703] = e; @@ -17074,7 +16987,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[8040] | 0)) { Jy(10860); - Ha1(65, 10860, o1 | 0) | 0; + Ha1(65, 10860, o1 | 0); d = 8040; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -17192,7 +17105,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -17302,7 +17215,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[8048] | 0)) { $y(10896); - Ha1(66, 10896, o1 | 0) | 0; + Ha1(66, 10896, o1 | 0); d = 8048; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -17420,7 +17333,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -17524,7 +17437,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[8056] | 0)) { rz(10932); - Ha1(67, 10932, o1 | 0) | 0; + Ha1(67, 10932, o1 | 0); d = 8056; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -17642,7 +17555,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -17769,7 +17682,7 @@ export function foo(global, env, buffer) { if (!(e & 1)) c1[a >> 2] = c1[b >> 2]; else { Dz(d, 0); - Ja1(e | 0, d | 0) | 0; + Ja1(e | 0, d | 0); Ez(a, d); Fz(d); } @@ -17811,7 +17724,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[8064] | 0)) { Qz(10968); - Ha1(68, 10968, o1 | 0) | 0; + Ha1(68, 10968, o1 | 0); d = 8064; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -17929,7 +17842,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -18059,7 +17972,7 @@ export function foo(global, env, buffer) { var b = 0, d = 0; if (!(a1[8072] | 0)) { gA(11004); - Ha1(69, 11004, o1 | 0) | 0; + Ha1(69, 11004, o1 | 0); d = 8072; c1[d >> 2] = 1; c1[d + 4 >> 2] = 0; @@ -18177,7 +18090,7 @@ export function foo(global, env, buffer) { d = (c1[g >> 2] | 0) + (0 - (f >> 3) << 3) | 0; c1[g >> 2] = d; if ((f | 0) > 0) { - BC(d | 0, e | 0, f | 0) | 0; + BC(d | 0, e | 0, f | 0); e = g; d = c1[g >> 2] | 0; } else e = g; @@ -18290,7 +18203,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[8080] | 0)) { sA(11040); - Ha1(70, 11040, o1 | 0) | 0; + Ha1(70, 11040, o1 | 0); b = 8080; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -18406,7 +18319,7 @@ export function foo(global, env, buffer) { var b = 0; if (!(a1[8088] | 0)) { NA(11076); - Ha1(25, 11076, o1 | 0) | 0; + Ha1(25, 11076, o1 | 0); b = 8088; c1[b >> 2] = 1; c1[b + 4 >> 2] = 0; @@ -18478,7 +18391,7 @@ export function foo(global, env, buffer) { l1 = l1 + 16 | 0; e = d; c1[e >> 2] = c1[a >> 2]; - SA(b, e) | 0; + SA(b, e); l1 = d; return; } @@ -18558,7 +18471,7 @@ export function foo(global, env, buffer) { if (b | 0) { g = c1[f + 8 >> 2] | 0; f = c1[f + 4 >> 2] | 0; - while(1){ + while(true){ Ma1(b | 0, d1[f >> 0] | 0, a1[g >> 0] | 0); e = e + 4 | 0; b = c1[e >> 2] | 0; @@ -18588,14 +18501,14 @@ export function foo(global, env, buffer) { if (b | 0) { m = n; do { - while(1){ + while(true){ h = b; b = c1[b >> 2] | 0; h = c1[h + 4 >> 2] | 0; if (!(cB(h) | 0)) break; c1[p >> 2] = m; c1[o >> 2] = c1[p >> 2]; - dB(n, o) | 0; + dB(n, o); if (!b) break a; } eB(h); @@ -18610,7 +18523,7 @@ export function foo(global, env, buffer) { if (e | 0) { f = j; g = k; - while(1){ + while(true){ c1[f >> 2] = c1[(Xw(c1[e + 4 >> 2] | 0) | 0) >> 2]; c1[g >> 2] = c1[e + 8 >> 2]; e = c1[e >> 2] | 0; @@ -18647,55 +18560,48 @@ export function foo(global, env, buffer) { b = c1[b >> 2] | 0; }while ((b | 0) != 0) b = c1[(Iv() | 0) >> 2] | 0; - b: do if (b | 0) { - c: while(1){ + b: if (b | 0) { + c: while(true){ e = c1[b + 4 >> 2] | 0; if (e | 0 ? (q = c1[(Xw(e) | 0) >> 2] | 0, r = c1[(ax(e) | 0) >> 2] | 0, r | 0) : 0) { f = r; do { e = f + 4 | 0; g = aw(e) | 0; - d: do if (g | 0) switch(si(g) | 0){ + d: if (g | 0) switch(si(g) | 0){ case 0: break c; case 4: case 3: case 2: - { - k = fw(g) | 0; - m = bw(g) | 0; - n = (cw(g) | 0) + 1 | 0; - o = iB(g) | 0; - p = si(g) | 0; - t = hw(e) | 0; - Pa(q | 0, k | 0, m | 0, n | 0, o | 0, 0, p | 0, t | 0, kB(e) | 0, lB(e) | 0); - break d; - } + k = fw(g) | 0; + m = bw(g) | 0; + n = (cw(g) | 0) + 1 | 0; + o = iB(g) | 0; + p = si(g) | 0; + t = hw(e) | 0; + Pa(q | 0, k | 0, m | 0, n | 0, o | 0, 0, p | 0, t | 0, kB(e) | 0, lB(e) | 0); + break d; case 1: - { - j = fw(g) | 0; - k = bw(g) | 0; - m = (cw(g) | 0) + 1 | 0; - n = iB(g) | 0; - o = jB(e) | 0; - p = si(g) | 0; - t = hw(e) | 0; - Pa(q | 0, j | 0, k | 0, m | 0, n | 0, o | 0, p | 0, t | 0, kB(e) | 0, lB(e) | 0); - break d; - } + j = fw(g) | 0; + k = bw(g) | 0; + m = (cw(g) | 0) + 1 | 0; + n = iB(g) | 0; + o = jB(e) | 0; + p = si(g) | 0; + t = hw(e) | 0; + Pa(q | 0, j | 0, k | 0, m | 0, n | 0, o | 0, p | 0, t | 0, kB(e) | 0, lB(e) | 0); + break d; case 5: - { - n = fw(g) | 0; - o = bw(g) | 0; - p = (cw(g) | 0) + 1 | 0; - t = iB(g) | 0; - Pa(q | 0, n | 0, o | 0, p | 0, t | 0, mB(g) | 0, si(g) | 0, 0, 0, 0); - break d; - } + n = fw(g) | 0; + o = bw(g) | 0; + p = (cw(g) | 0) + 1 | 0; + t = iB(g) | 0; + Pa(q | 0, n | 0, o | 0, p | 0, t | 0, mB(g) | 0, si(g) | 0, 0, 0, 0); + break d; default: break d; } - while (0) f = c1[f >> 2] | 0; }while ((f | 0) != 0) } @@ -18704,7 +18610,6 @@ export function foo(global, env, buffer) { } Ta(); } - while (0) Sa(); l1 = s; return; @@ -18904,7 +18809,7 @@ export function foo(global, env, buffer) { break; } } - while(1){ + while(true){ d = b + 20 | 0; e = c1[d >> 2] | 0; if (e | 0) { @@ -19019,17 +18924,19 @@ export function foo(global, env, buffer) { a = 0; h = k << ((i | 0) == 31 ? 0 : 25 - (i >>> 1) | 0); g = 0; - while(1){ + while(true){ f = (c1[d + 4 >> 2] & -8) - k | 0; - if (f >>> 0 < e >>> 0) if (!f) { - a = d; - e = 0; - f = d; - v = 61; - break a; - } else { - a = d; - e = f; + if (f >>> 0 < e >>> 0) { + if (!f) { + a = d; + e = 0; + f = d; + v = 61; + break a; + } else { + a = d; + e = f; + } } f = c1[d + 20 >> 2] | 0; d = c1[d + 16 + (h >>> 31 << 2) >> 2] | 0; @@ -19072,7 +18979,7 @@ export function foo(global, env, buffer) { v = 61; } } - if ((v | 0) == 61) while(1){ + if ((v | 0) == 61) while(true){ v = 0; d = (c1[f + 4 >> 2] & -8) - k | 0; n = d >>> 0 < e >>> 0; @@ -19108,7 +19015,7 @@ export function foo(global, env, buffer) { break; } } - while(1){ + while(true){ d = b + 20 | 0; e = c1[d >> 2] | 0; if (e | 0) { @@ -19214,7 +19121,7 @@ export function foo(global, env, buffer) { } a = h << ((b | 0) == 31 ? 0 : 25 - (b >>> 1) | 0); d = c1[d >> 2] | 0; - while(1){ + while(true){ if ((c1[d + 4 >> 2] & -8 | 0) == (h | 0)) { v = 97; break; @@ -19326,7 +19233,7 @@ export function foo(global, env, buffer) { d = c1[2789] | 0; c: do if (d) { e = 11580; - while(1){ + while(true){ a = c1[e >> 2] | 0; if (a >>> 0 <= d >>> 0 ? (r = e + 4 | 0, (a + (c1[r >> 2] | 0) | 0) >>> 0 > d >>> 0) : 0) break; a = c1[e + 8 >> 2] | 0; @@ -19375,14 +19282,16 @@ export function foo(global, env, buffer) { while (0) do if ((v | 0) == 126) { d = 0 - b | 0; - if (!(i >>> 0 > b >>> 0 & (b >>> 0 < 2147483647 & (e | 0) != -1))) if ((e | 0) == -1) { - b = 0; - break; - } else { - h = b; - g = e; - v = 135; - break b; + if (!(i >>> 0 > b >>> 0 & (b >>> 0 < 2147483647 & (e | 0) != -1))) { + if ((e | 0) == -1) { + b = 0; + break; + } else { + h = b; + g = e; + v = 135; + break b; + } } a = c1[2903] | 0; a = j - b + a & 0 - a; @@ -19393,7 +19302,7 @@ export function foo(global, env, buffer) { break b; } if ((FC(a | 0) | 0) == -1) { - FC(d | 0) | 0; + FC(d | 0); b = 0; break; } else { @@ -19423,7 +19332,7 @@ export function foo(global, env, buffer) { j = c1[2789] | 0; do if (j) { b = 11580; - while(1){ + while(true){ a = c1[b >> 2] | 0; d = b + 4 | 0; e = c1[d >> 2] | 0; @@ -19451,7 +19360,7 @@ export function foo(global, env, buffer) { if (g >>> 0 < (c1[2787] | 0) >>> 0) c1[2787] = g; d = g + h | 0; b = 11580; - while(1){ + while(true){ if ((c1[b >> 2] | 0) == (d | 0)) { v = 153; break; @@ -19509,7 +19418,7 @@ export function foo(global, env, buffer) { break; } else d = e; } - while(1){ + while(true){ e = a + 20 | 0; f = c1[e >> 2] | 0; if (f | 0) { @@ -19617,7 +19526,7 @@ export function foo(global, env, buffer) { } a = f << ((b | 0) == 31 ? 0 : 25 - (b >>> 1) | 0); d = c1[e >> 2] | 0; - while(1){ + while(true){ if ((c1[d + 4 >> 2] & -8 | 0) == (f | 0)) { v = 194; break; @@ -19660,7 +19569,7 @@ export function foo(global, env, buffer) { return w | 0; } b = 11580; - while(1){ + while(true){ a = c1[b >> 2] | 0; if (a >>> 0 <= j >>> 0 ? (w = a + (c1[b + 4 >> 2] | 0) | 0, w >>> 0 > j >>> 0) : 0) break; b = c1[b + 8 >> 2] | 0; @@ -19749,7 +19658,7 @@ export function foo(global, env, buffer) { } a = g << ((d | 0) == 31 ? 0 : 25 - (d >>> 1) | 0); d = c1[e >> 2] | 0; - while(1){ + while(true){ if ((c1[d + 4 >> 2] & -8 | 0) == (g | 0)) { v = 216; break; @@ -19885,7 +19794,7 @@ export function foo(global, env, buffer) { break; } else b = d; } - while(1){ + while(true){ d = a + 20 | 0; e = c1[d >> 2] | 0; if (e | 0) { @@ -20004,7 +19913,7 @@ export function foo(global, env, buffer) { break; } else b = d; } - while(1){ + while(true){ d = a + 20 | 0; e = c1[d >> 2] | 0; if (e | 0) { @@ -20110,7 +20019,7 @@ export function foo(global, env, buffer) { do if (b & d) { b = f << ((a | 0) == 31 ? 0 : 25 - (a >>> 1) | 0); d = c1[e >> 2] | 0; - while(1){ + while(true){ if ((c1[d + 4 >> 2] & -8 | 0) == (f | 0)) { a = 73; break; @@ -20153,7 +20062,7 @@ export function foo(global, env, buffer) { c1[2791] = j; if (!j) a = 11588; else return; - while(1){ + while(true){ a = c1[a >> 2] | 0; if (!a) break; else a = a + 8 | 0; @@ -20201,7 +20110,7 @@ export function foo(global, env, buffer) { g = uB(gb(146, g | 0) | 0) | 0; a: do if ((e | 0) != (g | 0)) { b = 2; - while(1){ + while(true){ if ((g | 0) < 0) break; e = e - g | 0; p = c1[f + 4 >> 2] | 0; @@ -20319,7 +20228,7 @@ export function foo(global, env, buffer) { var e = 0, f = 0; a: do if (!d) b = 0; else { - while(1){ + while(true){ e = a1[b >> 0] | 0; f = a1[c >> 0] | 0; if (e << 24 >> 24 != f << 24 >> 24) break; @@ -20376,7 +20285,7 @@ export function foo(global, env, buffer) { c1[k >> 2] = r + 80; e = DB(b, d, n, q, o) | 0; if (h) { - sb[c1[b + 36 >> 2] & 7](b, 0, 0) | 0; + sb[c1[b + 36 >> 2] & 7](b, 0, 0); e = (c1[j >> 2] | 0) == 0 ? -1 : e; c1[g >> 2] = h; c1[f >> 2] = 0; @@ -20416,14 +20325,16 @@ export function foo(global, env, buffer) { k = 0; j = 0; p = 0; - a: while(1){ - do if ((j | 0) > -1) if ((k | 0) > (2147483647 - j | 0)) { - c1[(vB() | 0) >> 2] = 75; - j = -1; - break; - } else { - j = k + j | 0; - break; + a: while(true){ + do if ((j | 0) > -1) { + if ((k | 0) > (2147483647 - j | 0)) { + c1[(vB() | 0) >> 2] = 75; + j = -1; + break; + } else { + j = k + j | 0; + break; + } } while (0) k = a1[e >> 0] | 0; @@ -20431,28 +20342,23 @@ export function foo(global, env, buffer) { w = 87; break; } else m = e; - b: while(1){ + b: while(true){ switch(k << 24 >> 24){ case 37: - { - k = m; - w = 9; - break b; - } + k = m; + w = 9; + break b; case 0: - { - k = m; - break b; - } + k = m; + break b; default: - {} } v = m + 1 | 0; c1[D >> 2] = v; k = a1[v >> 0] | 0; m = v; } - c: do if ((w | 0) == 9) while(1){ + c: do if ((w | 0) == 9) while(true){ w = 0; if ((a1[m + 1 >> 0] | 0) != 37) break c; k = k + 1 | 0; @@ -20482,7 +20388,7 @@ export function foo(global, env, buffer) { d: do if (m >>> 0 < 32) { o = 0; q = k; - while(1){ + while(true){ k = 1 << m; if (!(k & 75913)) { k = q; @@ -20565,7 +20471,7 @@ export function foo(global, env, buffer) { } else m = -1; while (0) t = 0; - while(1){ + while(true){ if (((a1[n >> 0] | 0) + -65 | 0) >>> 0 > 57) { j = -1; break a; @@ -20620,175 +20526,139 @@ export function foo(global, env, buffer) { case 110: switch((t & 255) << 24 >> 24){ case 0: - { - c1[c1[E >> 2] >> 2] = j; - k = 0; - e = v; - continue a; - } + c1[c1[E >> 2] >> 2] = j; + k = 0; + e = v; + continue a; case 1: - { - c1[c1[E >> 2] >> 2] = j; - k = 0; - e = v; - continue a; - } + c1[c1[E >> 2] >> 2] = j; + k = 0; + e = v; + continue a; case 2: - { - k = c1[E >> 2] | 0; - c1[k >> 2] = j; - c1[k + 4 >> 2] = ((j | 0) < 0) << 31 >> 31; - k = 0; - e = v; - continue a; - } + k = c1[E >> 2] | 0; + c1[k >> 2] = j; + c1[k + 4 >> 2] = ((j | 0) < 0) << 31 >> 31; + k = 0; + e = v; + continue a; case 3: - { - b1[c1[E >> 2] >> 1] = j; - k = 0; - e = v; - continue a; - } + b1[c1[E >> 2] >> 1] = j; + k = 0; + e = v; + continue a; case 4: - { - a1[c1[E >> 2] >> 0] = j; - k = 0; - e = v; - continue a; - } + a1[c1[E >> 2] >> 0] = j; + k = 0; + e = v; + continue a; case 6: - { - c1[c1[E >> 2] >> 2] = j; - k = 0; - e = v; - continue a; - } + c1[c1[E >> 2] >> 2] = j; + k = 0; + e = v; + continue a; case 7: - { - k = c1[E >> 2] | 0; - c1[k >> 2] = j; - c1[k + 4 >> 2] = ((j | 0) < 0) << 31 >> 31; - k = 0; - e = v; - continue a; - } + k = c1[E >> 2] | 0; + c1[k >> 2] = j; + c1[k + 4 >> 2] = ((j | 0) < 0) << 31 >> 31; + k = 0; + e = v; + continue a; default: - { - k = 0; - e = v; - continue a; - } + k = 0; + e = v; + continue a; } case 112: - { - n = 120; - m = m >>> 0 > 8 ? m : 8; - e = u | 8; - w = 61; - break; - } + n = 120; + m = m >>> 0 > 8 ? m : 8; + e = u | 8; + w = 61; + break; case 88: case 120: - { - e = u; - w = 61; - break; - } + e = u; + w = 61; + break; case 111: - { - n = E; - e = c1[n >> 2] | 0; - n = c1[n + 4 >> 2] | 0; - r = KB(e, n, y) | 0; - s = z - r | 0; - o = 0; - q = 5642; - m = (u & 8 | 0) == 0 | (m | 0) > (s | 0) ? m : s + 1 | 0; - s = u; - w = 67; - break; - } + n = E; + e = c1[n >> 2] | 0; + n = c1[n + 4 >> 2] | 0; + r = KB(e, n, y) | 0; + s = z - r | 0; + o = 0; + q = 5642; + m = (u & 8 | 0) == 0 | (m | 0) > (s | 0) ? m : s + 1 | 0; + s = u; + w = 67; + break; case 105: case 100: - { - n = E; - e = c1[n >> 2] | 0; - n = c1[n + 4 >> 2] | 0; - if ((n | 0) < 0) { - e = wC(0, 0, e | 0, n | 0) | 0; - n = A1; - o = E; - c1[o >> 2] = e; - c1[o + 4 >> 2] = n; - o = 1; - q = 5642; - w = 66; - break e; - } else { - o = (u & 2049 | 0) != 0 & 1; - q = (u & 2048 | 0) == 0 ? (u & 1 | 0) == 0 ? 5642 : 5644 : 5643; - w = 66; - break e; - } + n = E; + e = c1[n >> 2] | 0; + n = c1[n + 4 >> 2] | 0; + if ((n | 0) < 0) { + e = wC(0, 0, e | 0, n | 0) | 0; + n = A1; + o = E; + c1[o >> 2] = e; + c1[o + 4 >> 2] = n; + o = 1; + q = 5642; + w = 66; + break e; + } else { + o = (u & 2049 | 0) != 0 & 1; + q = (u & 2048 | 0) == 0 ? (u & 1 | 0) == 0 ? 5642 : 5644 : 5643; + w = 66; + break e; } case 117: - { - n = E; - o = 0; - q = 5642; - e = c1[n >> 2] | 0; - n = c1[n + 4 >> 2] | 0; - w = 66; - break; - } + n = E; + o = 0; + q = 5642; + e = c1[n >> 2] | 0; + n = c1[n + 4 >> 2] | 0; + w = 66; + break; case 99: - { - a1[B >> 0] = c1[E >> 2]; - e = B; - o = 0; - q = 5642; - r = y; - n = 1; - m = s; - break; - } + a1[B >> 0] = c1[E >> 2]; + e = B; + o = 0; + q = 5642; + r = y; + n = 1; + m = s; + break; case 109: - { - n = MB(c1[(vB() | 0) >> 2] | 0) | 0; - w = 71; - break; - } + n = MB(c1[(vB() | 0) >> 2] | 0) | 0; + w = 71; + break; case 115: - { - n = c1[E >> 2] | 0; - n = n | 0 ? n : 5652; - w = 71; - break; - } + n = c1[E >> 2] | 0; + n = n | 0 ? n : 5652; + w = 71; + break; case 67: - { - c1[F >> 2] = c1[E >> 2]; - c1[C >> 2] = 0; - c1[E >> 2] = F; - r = -1; - n = F; - w = 75; - break; - } + c1[F >> 2] = c1[E >> 2]; + c1[C >> 2] = 0; + c1[E >> 2] = F; + r = -1; + n = F; + w = 75; + break; case 83: - { - e = c1[E >> 2] | 0; - if (!m) { - OB(d, 32, k, 0, u); - e = 0; - w = 84; - } else { - r = m; - n = e; - w = 75; - } - break; + e = c1[E >> 2] | 0; + if (!m) { + OB(d, 32, k, 0, u); + e = 0; + w = 84; + } else { + r = m; + n = e; + w = 75; } + break; case 65: case 71: case 70: @@ -20797,19 +20667,15 @@ export function foo(global, env, buffer) { case 103: case 102: case 101: - { - k = QB(d, +h1[E >> 3], k, m, u, n) | 0; - e = v; - continue a; - } + k = QB(d, +h1[E >> 3], k, m, u, n) | 0; + e = v; + continue a; default: - { - o = 0; - q = 5642; - r = y; - n = m; - m = u; - } + o = 0; + q = 5642; + r = y; + n = m; + m = u; } while (0) f: do if ((w | 0) == 61) { @@ -20843,7 +20709,7 @@ export function foo(global, env, buffer) { q = n; e = 0; m = 0; - while(1){ + while(true){ o = c1[q >> 2] | 0; if (!o) break; m = PB(G, o) | 0; @@ -20862,7 +20728,7 @@ export function foo(global, env, buffer) { w = 84; } else { o = 0; - while(1){ + while(true){ m = c1[n >> 2] | 0; if (!m) { w = 84; @@ -20912,28 +20778,30 @@ export function foo(global, env, buffer) { e = v; } g: do if ((w | 0) == 87) { - if (!d) if (!p) j = 0; - else { - j = 1; - while(1){ - e = c1[i + (j << 2) >> 2] | 0; - if (!e) break; - IB(g + (j << 3) | 0, e, f); - j = j + 1 | 0; - if ((j | 0) >= 10) { - j = 1; - break g; + if (!d) { + if (!p) j = 0; + else { + j = 1; + while(true){ + e = c1[i + (j << 2) >> 2] | 0; + if (!e) break; + IB(g + (j << 3) | 0, e, f); + j = j + 1 | 0; + if ((j | 0) >= 10) { + j = 1; + break g; + } } - } - while(1){ - if (c1[i + (j << 2) >> 2] | 0) { - j = -1; - break g; - } - j = j + 1 | 0; - if ((j | 0) >= 10) { - j = 1; - break; + while(true){ + if (c1[i + (j << 2) >> 2] | 0) { + j = -1; + break g; + } + j = j + 1 | 0; + if ((j | 0) >= 10) { + j = 1; + break; + } } } } @@ -20954,7 +20822,7 @@ export function foo(global, env, buffer) { a = a | 0; b = b | 0; d = d | 0; - if (!(c1[a >> 2] & 32)) aC(b, d, a) | 0; + if (!(c1[a >> 2] & 32)) aC(b, d, a); return; } function HB(b) { @@ -20978,110 +20846,88 @@ export function foo(global, env, buffer) { b = b | 0; d = d | 0; var e = 0, f = 0, g = 0.0; - a: do if (b >>> 0 <= 20) do switch(b | 0){ + a: if (b >>> 0 <= 20) switch(b | 0){ case 9: - { - e = (c1[d >> 2] | 0) + 3 & -4; - b = c1[e >> 2] | 0; - c1[d >> 2] = e + 4; - c1[a >> 2] = b; - break a; - } + e = (c1[d >> 2] | 0) + 3 & -4; + b = c1[e >> 2] | 0; + c1[d >> 2] = e + 4; + c1[a >> 2] = b; + break a; case 10: - { - e = (c1[d >> 2] | 0) + 3 & -4; - b = c1[e >> 2] | 0; - c1[d >> 2] = e + 4; - e = a; - c1[e >> 2] = b; - c1[e + 4 >> 2] = ((b | 0) < 0) << 31 >> 31; - break a; - } + e = (c1[d >> 2] | 0) + 3 & -4; + b = c1[e >> 2] | 0; + c1[d >> 2] = e + 4; + e = a; + c1[e >> 2] = b; + c1[e + 4 >> 2] = ((b | 0) < 0) << 31 >> 31; + break a; case 11: - { - e = (c1[d >> 2] | 0) + 3 & -4; - b = c1[e >> 2] | 0; - c1[d >> 2] = e + 4; - e = a; - c1[e >> 2] = b; - c1[e + 4 >> 2] = 0; - break a; - } + e = (c1[d >> 2] | 0) + 3 & -4; + b = c1[e >> 2] | 0; + c1[d >> 2] = e + 4; + e = a; + c1[e >> 2] = b; + c1[e + 4 >> 2] = 0; + break a; case 12: - { - e = (c1[d >> 2] | 0) + 7 & -8; - b = e; - f = c1[b >> 2] | 0; - b = c1[b + 4 >> 2] | 0; - c1[d >> 2] = e + 8; - e = a; - c1[e >> 2] = f; - c1[e + 4 >> 2] = b; - break a; - } + e = (c1[d >> 2] | 0) + 7 & -8; + b = e; + f = c1[b >> 2] | 0; + b = c1[b + 4 >> 2] | 0; + c1[d >> 2] = e + 8; + e = a; + c1[e >> 2] = f; + c1[e + 4 >> 2] = b; + break a; case 13: - { - f = (c1[d >> 2] | 0) + 3 & -4; - e = c1[f >> 2] | 0; - c1[d >> 2] = f + 4; - e = (e & 65535) << 16 >> 16; - f = a; - c1[f >> 2] = e; - c1[f + 4 >> 2] = ((e | 0) < 0) << 31 >> 31; - break a; - } + f = (c1[d >> 2] | 0) + 3 & -4; + e = c1[f >> 2] | 0; + c1[d >> 2] = f + 4; + e = (e & 65535) << 16 >> 16; + f = a; + c1[f >> 2] = e; + c1[f + 4 >> 2] = ((e | 0) < 0) << 31 >> 31; + break a; case 14: - { - f = (c1[d >> 2] | 0) + 3 & -4; - e = c1[f >> 2] | 0; - c1[d >> 2] = f + 4; - f = a; - c1[f >> 2] = e & 65535; - c1[f + 4 >> 2] = 0; - break a; - } + f = (c1[d >> 2] | 0) + 3 & -4; + e = c1[f >> 2] | 0; + c1[d >> 2] = f + 4; + f = a; + c1[f >> 2] = e & 65535; + c1[f + 4 >> 2] = 0; + break a; case 15: - { - f = (c1[d >> 2] | 0) + 3 & -4; - e = c1[f >> 2] | 0; - c1[d >> 2] = f + 4; - e = (e & 255) << 24 >> 24; - f = a; - c1[f >> 2] = e; - c1[f + 4 >> 2] = ((e | 0) < 0) << 31 >> 31; - break a; - } + f = (c1[d >> 2] | 0) + 3 & -4; + e = c1[f >> 2] | 0; + c1[d >> 2] = f + 4; + e = (e & 255) << 24 >> 24; + f = a; + c1[f >> 2] = e; + c1[f + 4 >> 2] = ((e | 0) < 0) << 31 >> 31; + break a; case 16: - { - f = (c1[d >> 2] | 0) + 3 & -4; - e = c1[f >> 2] | 0; - c1[d >> 2] = f + 4; - f = a; - c1[f >> 2] = e & 255; - c1[f + 4 >> 2] = 0; - break a; - } + f = (c1[d >> 2] | 0) + 3 & -4; + e = c1[f >> 2] | 0; + c1[d >> 2] = f + 4; + f = a; + c1[f >> 2] = e & 255; + c1[f + 4 >> 2] = 0; + break a; case 17: - { - f = (c1[d >> 2] | 0) + 7 & -8; - g = +h1[f >> 3]; - c1[d >> 2] = f + 8; - h1[a >> 3] = g; - break a; - } + f = (c1[d >> 2] | 0) + 7 & -8; + g = +h1[f >> 3]; + c1[d >> 2] = f + 8; + h1[a >> 3] = g; + break a; case 18: - { - f = (c1[d >> 2] | 0) + 7 & -8; - g = +h1[f >> 3]; - c1[d >> 2] = f + 8; - h1[a >> 3] = g; - break a; - } + f = (c1[d >> 2] | 0) + 7 & -8; + g = +h1[f >> 3]; + c1[d >> 2] = f + 8; + h1[a >> 3] = g; + break a; default: break a; } - while (0) - while (0) return; } function JB(b, c, e, f) { @@ -21115,7 +20961,7 @@ export function foo(global, env, buffer) { d = d | 0; var e = 0; if (c >>> 0 > 0 | (c | 0) == 0 & b >>> 0 > 4294967295) { - while(1){ + while(true){ e = HC(b | 0, c | 0, 10, 0) | 0; d = d + -1 | 0; a1[d >> 0] = e & 255 | 48; @@ -21126,7 +20972,7 @@ export function foo(global, env, buffer) { } c = b; } else c = b; - if (c) while(1){ + if (c) while(true){ d = d + -1 | 0; a1[d >> 0] = (c >>> 0) % 10 | 48; if (c >>> 0 < 10) break; @@ -21147,7 +20993,7 @@ export function foo(global, env, buffer) { f = (e | 0) != 0; a: do if (f & (b & 3 | 0) != 0) { g = d & 255; - while(1){ + while(true){ if ((a1[b >> 0] | 0) == g << 24 >> 24) { i = 6; break a; @@ -21162,13 +21008,15 @@ export function foo(global, env, buffer) { } } else i = 5; while (0) - if ((i | 0) == 5) if (f) i = 6; - else e = 0; + if ((i | 0) == 5) { + if (f) i = 6; + else e = 0; + } b: do if ((i | 0) == 6) { g = d & 255; if ((a1[b >> 0] | 0) != g << 24 >> 24) { f = P1(h, 16843009) | 0; - c: do if (e >>> 0 > 3) while(1){ + c: do if (e >>> 0 > 3) while(true){ h = c1[b >> 2] ^ f; if ((h & -2139062144 ^ -2139062144) & h + -16843009 | 0) break; b = b + 4 | 0; @@ -21186,7 +21034,7 @@ export function foo(global, env, buffer) { break; } } - while(1){ + while(true){ if ((a1[b >> 0] | 0) == g << 24 >> 24) break b; b = b + 1 | 0; e = e + -1 | 0; @@ -21212,7 +21060,7 @@ export function foo(global, env, buffer) { f = g; if ((c | 0) > (d | 0) & (e & 73728 | 0) == 0) { e = c - d | 0; - yC(f | 0, b | 0, (e >>> 0 < 256 ? e : 256) | 0) | 0; + yC(f | 0, b | 0, (e >>> 0 < 256 ? e : 256) | 0); if (e >>> 0 > 255) { b = c - d | 0; do { @@ -21250,7 +21098,7 @@ export function foo(global, env, buffer) { n = H + 512 | 0; c1[u >> 2] = 0; E = n + 12 | 0; - RB(e) | 0; + RB(e); if ((A1 | 0) < 0) { e = -e; C = 1; @@ -21259,7 +21107,7 @@ export function foo(global, env, buffer) { C = (h & 2049 | 0) != 0 & 1; B = (h & 2048 | 0) == 0 ? (h & 1 | 0) == 0 ? 5660 : 5665 : 5662; } - RB(e) | 0; + RB(e); D = A1 & 2146435072; do if (D >>> 0 < 2146435072 | (D | 0) == 2146435072 & false) { r = +SB(e, u) * 2.0; @@ -21342,7 +21190,7 @@ export function foo(global, env, buffer) { if ((j | 0) > 0) { n = D; p = m; - while(1){ + while(true){ o = (j | 0) < 29 ? j : 29; j = p + -4 | 0; if (j >>> 0 >= n >>> 0) { @@ -21362,7 +21210,7 @@ export function foo(global, env, buffer) { } } m = p; - while(1){ + while(true){ if (m >>> 0 <= n >>> 0) break; j = m + -4 | 0; if (!(c1[j >> 2] | 0)) m = j; @@ -21460,7 +21308,7 @@ export function foo(global, env, buffer) { c1[s >> 2] = x; if (x >>> 0 > 999999999) { m = s; - while(1){ + while(true){ n = m + -4 | 0; c1[m >> 2] = 0; if (n >>> 0 < j >>> 0) { @@ -21492,7 +21340,7 @@ export function foo(global, env, buffer) { x = j; } w = n; - while(1){ + while(true){ if (w >>> 0 <= x >>> 0) { u = 0; break; @@ -21584,7 +21432,7 @@ export function foo(global, env, buffer) { m = q; } } else if (m >>> 0 > G >>> 0) { - yC(G | 0, 48, m - F | 0) | 0; + yC(G | 0, 48, m - F | 0); do m = m + -1 | 0; while (m >>> 0 > G >>> 0) } @@ -21592,10 +21440,10 @@ export function foo(global, env, buffer) { n = n + 4 | 0; }while (n >>> 0 <= D >>> 0) if (t | 0) GB(b, 5710, 1); - if (n >>> 0 < w >>> 0 & (k | 0) > 0) while(1){ + if (n >>> 0 < w >>> 0 & (k | 0) > 0) while(true){ m = LB(c1[n >> 2] | 0, 0, s) | 0; if (m >>> 0 > G >>> 0) { - yC(G | 0, 48, m - F | 0) | 0; + yC(G | 0, 48, m - F | 0); do m = m + -1 | 0; while (m >>> 0 > G >>> 0) } @@ -21634,7 +21482,7 @@ export function foo(global, env, buffer) { m = n; } else { if (m >>> 0 <= G >>> 0) break; - yC(G | 0, 48, m + p | 0) | 0; + yC(G | 0, 48, m + p | 0); do m = m + -1 | 0; while (m >>> 0 > G >>> 0) } @@ -21684,23 +21532,19 @@ export function foo(global, env, buffer) { f = AC(d | 0, e | 0, 52) | 0; switch(f & 2047){ case 0: - { - if (a != 0.0) { - a = +TB(a * 18446744073709551616.0, b); - d = (c1[b >> 2] | 0) + -64 | 0; - } else d = 0; - c1[b >> 2] = d; - break; - } + if (a != 0.0) { + a = +TB(a * 18446744073709551616.0, b); + d = (c1[b >> 2] | 0) + -64 | 0; + } else d = 0; + c1[b >> 2] = d; + break; case 2047: break; default: - { - c1[b >> 2] = (f & 2047) + -1022; - c1[j1 >> 2] = d; - c1[j1 + 4 >> 2] = e & -2146435073 | 1071644672; - a = +h1[j1 >> 3]; - } + c1[b >> 2] = (f & 2047) + -1022; + c1[j1 >> 2] = d; + c1[j1 + 4 >> 2] = e & -2146435073 | 1071644672; + a = +h1[j1 >> 3]; } return +a; } @@ -21714,14 +21558,16 @@ export function foo(global, env, buffer) { b = 1; break; } - if (!(c1[c1[(VB() | 0) + 188 >> 2] >> 2] | 0)) if ((d & -128 | 0) == 57216) { - a1[b >> 0] = d; - b = 1; - break; - } else { - c1[(vB() | 0) >> 2] = 84; - b = -1; - break; + if (!(c1[c1[(VB() | 0) + 188 >> 2] >> 2] | 0)) { + if ((d & -128 | 0) == 57216) { + a1[b >> 0] = d; + b = 1; + break; + } else { + c1[(vB() | 0) >> 2] = 84; + b = -1; + break; + } } if (d >>> 0 < 2048) { a1[b >> 0] = d >>> 6 | 192; @@ -21763,7 +21609,7 @@ export function foo(global, env, buffer) { e = e | 0; var f = 0, g = 0; g = 0; - while(1){ + while(true){ if ((d1[5712 + g >> 0] | 0) == (b | 0)) { b = 2; break; @@ -21776,12 +21622,14 @@ export function foo(global, env, buffer) { break; } else g = f; } - if ((b | 0) == 2) if (!g) f = 5800; - else { - f = 5800; - b = 5; + if ((b | 0) == 2) { + if (!g) f = 5800; + else { + f = 5800; + b = 5; + } } - if ((b | 0) == 5) while(1){ + if ((b | 0) == 5) while(true){ do { b = f; f = f + 1 | 0; @@ -21817,7 +21665,7 @@ export function foo(global, env, buffer) { n = f >>> 2; m = g >>> 2; l = 0; - while(1){ + while(true){ j = h >>> 1; k = l + j | 0; i = k << 1; @@ -21882,7 +21730,7 @@ export function foo(global, env, buffer) { } b: do if ((a1[e + 75 >> 0] | 0) > -1) { i = d; - while(1){ + while(true){ if (!i) { h = 0; g = b; @@ -21903,7 +21751,7 @@ export function foo(global, env, buffer) { g = b; } while (0) - BC(f | 0, g | 0, d | 0) | 0; + BC(f | 0, g | 0, d | 0); c1[j >> 2] = (c1[j >> 2] | 0) + d; f = h + d | 0; } @@ -21938,12 +21786,14 @@ export function foo(global, env, buffer) { c = dC(a) | 0; do if ((c & 2147483647) >>> 0 <= 2139095040) { d = dC(b) | 0; - if ((d & 2147483647) >>> 0 <= 2139095040) if ((d ^ c | 0) < 0) { - a = (c | 0) < 0 ? b : a; - break; - } else { - a = a < b ? b : a; - break; + if ((d & 2147483647) >>> 0 <= 2139095040) { + if ((d ^ c | 0) < 0) { + a = (c | 0) < 0 ? b : a; + break; + } else { + a = a < b ? b : a; + break; + } } } else a = b; while (0) @@ -21960,12 +21810,14 @@ export function foo(global, env, buffer) { c = fC(a) | 0; do if ((c & 2147483647) >>> 0 <= 2139095040) { d = fC(b) | 0; - if ((d & 2147483647) >>> 0 <= 2139095040) if ((d ^ c | 0) < 0) { - a = (c | 0) < 0 ? a : b; - break; - } else { - a = a < b ? a : b; - break; + if ((d & 2147483647) >>> 0 <= 2139095040) { + if ((d ^ c | 0) < 0) { + a = (c | 0) < 0 ? a : b; + break; + } else { + a = a < b ? a : b; + break; + } } } else a = b; while (0) @@ -22018,9 +21870,11 @@ export function foo(global, env, buffer) { f = e - k | 0; h = (f | 0) > -1; b: do if ((d | 0) > (i | 0)) { - while(1){ - if (h) if (!f) break; - else e = f; + while(true){ + if (h) { + if (!f) break; + else e = f; + } e = e << 1; d = d + -1 | 0; f = e - k | 0; @@ -22031,10 +21885,12 @@ export function foo(global, env, buffer) { break a; } while (0) - if (h) if (!f) { - b = T1(a * T1(0.0)); - break; - } else e = f; + if (h) { + if (!f) { + b = T1(a * T1(0.0)); + break; + } else e = f; + } if (e >>> 0 < 8388608) do { e = e << 1; d = d + -1 | 0; @@ -22103,7 +21959,7 @@ export function foo(global, env, buffer) { a = a | 0; var b = 0; b = (a | 0) == 0 ? 1 : a; - while(1){ + while(true){ a = oB(b) | 0; if (a | 0) break; a = uC() | 0; @@ -22451,7 +22307,7 @@ export function foo(global, env, buffer) { g = i | g << 1; e = a << 1 | e >>> 31 | 0; n = a >>> 31 | b << 1 | 0; - wC(k | 0, d | 0, e | 0, n | 0) | 0; + wC(k | 0, d | 0, e | 0, n | 0); p = A1; o = p >> 31 | ((p | 0) < 0 ? -1 : 0) << 1; i = o & 1; @@ -22485,7 +22341,7 @@ export function foo(global, env, buffer) { b = c1[i1 >> 2] | 0; a = b + d | 0; if ((d | 0) > 0 & (a | 0) < (b | 0) | (a | 0) < 0) { - Y1() | 0; + Y1(); Qa(12); return -1; } @@ -22513,7 +22369,7 @@ export function foo(global, env, buffer) { a1[b >> 0] = a1[c >> 0] | 0; } b = e; - } else BC(b, c, d) | 0; + } else BC(b, c, d); return b | 0; } function HC(a, b, d, e) { @@ -22525,7 +22381,7 @@ export function foo(global, env, buffer) { g = l1; l1 = l1 + 16 | 0; f = g | 0; - DC(a, b, d, e, f) | 0; + DC(a, b, d, e, f); l1 = g; return (A1 = c1[f + 4 >> 2] | 0, c1[f >> 2] | 0) | 0; } diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-2/codemirror/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-2/codemirror/output.js index fc5eae9f024..a06a0d5cd32 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-2/codemirror/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-2/codemirror/output.js @@ -585,10 +585,12 @@ var i_end = st[i]; i_end > end && st.splice(i, 1, end, st[i + 1], i_end), i += 2, at = Math.min(end, i_end); } - if (style) if (overlay.opaque) st.splice(start, i - start, end, "overlay " + style), i = start + 2; - else for(; start < i; start += 2){ - var cur = st[start + 1]; - st[start + 1] = (cur ? cur + " " : "") + "overlay " + style; + if (style) { + if (overlay.opaque) st.splice(start, i - start, end, "overlay " + style), i = start + 2; + else for(; start < i; start += 2){ + var cur = st[start + 1]; + st[start + 1] = (cur ? cur + " " : "") + "overlay " + style; + } } }, lineClasses), context.state = state, context.baseTokens = null, context.baseTokenPos = 1; }(o1); @@ -845,10 +847,7 @@ function lineIsHidden(doc, line) { var sps = sawCollapsedSpans && line.markedSpans; if (sps) { - for(var sp = void 0, i = 0; i < sps.length; ++i)if ((sp = sps[i]).marker.collapsed) { - if (null == sp.from) return !0; - if (!sp.marker.widgetNode && 0 == sp.from && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) return !0; - } + for(var sp = void 0, i = 0; i < sps.length; ++i)if ((sp = sps[i]).marker.collapsed && (null == sp.from || !sp.marker.widgetNode && 0 == sp.from && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))) return !0; } } function lineIsHiddenInner(doc, line, span) { @@ -1551,8 +1550,7 @@ return coords; } function findViewIndex(cm, n) { - if (n >= cm.display.viewTo) return null; - if ((n -= cm.display.viewFrom) < 0) return null; + if (n >= cm.display.viewTo || (n -= cm.display.viewFrom) < 0) return null; for(var view = cm.display.view, i = 0; i < view.length; i++)if ((n -= view[i].size) < 0) return i; } function regChange(cm, from, to, lendiff) { @@ -2400,12 +2398,13 @@ else if (isWholeLineUpdate(doc, change)) { var added = linesFor(0, text2.length - 1); update(lastLine, lastLine.text, lastSpans), nlines && doc.remove(from.line, nlines), added.length && doc.insert(from.line, added); - } else if (firstLine == lastLine) if (1 == text2.length) update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans); - else { - var added$1 = linesFor(1, text2.length - 1); - added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight2)), update(firstLine, firstLine.text.slice(0, from.ch) + text2[0], spansFor(0)), doc.insert(from.line + 1, added$1); - } - else if (1 == text2.length) update(firstLine, firstLine.text.slice(0, from.ch) + text2[0] + lastLine.text.slice(to.ch), spansFor(0)), doc.remove(from.line + 1, nlines); + } else if (firstLine == lastLine) { + if (1 == text2.length) update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans); + else { + var added$1 = linesFor(1, text2.length - 1); + added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight2)), update(firstLine, firstLine.text.slice(0, from.ch) + text2[0], spansFor(0)), doc.insert(from.line + 1, added$1); + } + } else if (1 == text2.length) update(firstLine, firstLine.text.slice(0, from.ch) + text2[0] + lastLine.text.slice(to.ch), spansFor(0)), doc.remove(from.line + 1, nlines); else { update(firstLine, firstLine.text.slice(0, from.ch) + text2[0], spansFor(0)), update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans); var added$2 = linesFor(1, text2.length - 1); @@ -3327,8 +3326,7 @@ lineInfo: function(line) { var n; if ("number" == typeof line) { - if (!isLine(this, line)) return null; - if (n = line, line = getLine(this, line), !line) return null; + if (!isLine(this, line) || (n = line, line = getLine(this, line), !line)) return null; } else if (null == (n = lineNo1(line))) return null; return { line: n, @@ -3344,9 +3342,10 @@ addLineClass: docMethodOp(function(handle, where, cls) { return changeLine(this, handle, "gutter" == where ? "gutter" : "class", function(line) { var prop = "text" == where ? "textClass" : "background" == where ? "bgClass" : "gutter" == where ? "gutterClass" : "wrapClass"; - if (line[prop]) if (classTest(cls).test(line[prop])) return !1; - else line[prop] += " " + cls; - else line[prop] = cls; + if (line[prop]) { + if (classTest(cls).test(line[prop])) return !1; + line[prop] += " " + cls; + } else line[prop] = cls; return !0; }); }), @@ -3511,49 +3510,51 @@ if (clearDragCursor(cm), !(signalDOMEvent(cm, e) || eventInWidget(cm.display, e))) { e_preventDefault(e), ie && (lastDrop = +new Date); var pos = posFromMouse(cm, e, !0), files = e.dataTransfer.files; - if (!(!pos || cm.isReadOnly())) if (files && files.length && window.FileReader && window.File) for(var n = files.length, text = Array(n), read = 0, markAsReadAndPasteIfAllFilesAreRead = function() { - ++read == n && operation(cm, function() { - var change = { - from: pos = clipPos(cm.doc, pos), - to: pos, - text: cm.doc.splitLines(text.filter(function(t) { - return null != t; - }).join(cm.doc.lineSeparator())), - origin: "paste" - }; - makeChange(cm.doc, change), setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change)))); - })(); - }, readTextFromFile = function(file, i) { - if (cm.options.allowDropFileTypes && -1 == indexOf(cm.options.allowDropFileTypes, file.type)) { - markAsReadAndPasteIfAllFilesAreRead(); - return; - } - var reader = new FileReader; - reader.onerror = function() { - return markAsReadAndPasteIfAllFilesAreRead(); - }, reader.onload = function() { - var content = reader.result; - if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { + if (!(!pos || cm.isReadOnly())) { + if (files && files.length && window.FileReader && window.File) for(var n = files.length, text = Array(n), read = 0, markAsReadAndPasteIfAllFilesAreRead = function() { + ++read == n && operation(cm, function() { + var change = { + from: pos = clipPos(cm.doc, pos), + to: pos, + text: cm.doc.splitLines(text.filter(function(t) { + return null != t; + }).join(cm.doc.lineSeparator())), + origin: "paste" + }; + makeChange(cm.doc, change), setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change)))); + })(); + }, readTextFromFile = function(file, i) { + if (cm.options.allowDropFileTypes && -1 == indexOf(cm.options.allowDropFileTypes, file.type)) { markAsReadAndPasteIfAllFilesAreRead(); return; } - text[i] = content, markAsReadAndPasteIfAllFilesAreRead(); - }, reader.readAsText(file); - }, i12 = 0; i12 < files.length; i12++)readTextFromFile(files[i12], i12); - else { - if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) { - cm.state.draggingText(e), setTimeout(function() { - return cm.display.input.focus(); - }, 20); - return; - } - try { - var selected, text$1 = e.dataTransfer.getData("Text"); - if (text$1) { - if (cm.state.draggingText && !cm.state.draggingText.copy && (selected = cm.listSelections()), setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)), selected) for(var i$1 = 0; i$1 < selected.length; ++i$1)replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); - cm.replaceSelection(text$1, "around", "paste"), cm.display.input.focus(); + var reader = new FileReader; + reader.onerror = function() { + return markAsReadAndPasteIfAllFilesAreRead(); + }, reader.onload = function() { + var content = reader.result; + if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { + markAsReadAndPasteIfAllFilesAreRead(); + return; + } + text[i] = content, markAsReadAndPasteIfAllFilesAreRead(); + }, reader.readAsText(file); + }, i12 = 0; i12 < files.length; i12++)readTextFromFile(files[i12], i12); + else { + if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) { + cm.state.draggingText(e), setTimeout(function() { + return cm.display.input.focus(); + }, 20); + return; } - } catch (e$1) {} + try { + var selected, text$1 = e.dataTransfer.getData("Text"); + if (text$1) { + if (cm.state.draggingText && !cm.state.draggingText.copy && (selected = cm.listSelections()), setSelectionNoUndo(cm.doc, simpleSelection(pos, pos)), selected) for(var i$1 = 0; i$1 < selected.length; ++i$1)replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); + cm.replaceSelection(text$1, "around", "paste"), cm.display.input.focus(); + } + } catch (e$1) {} + } } } } @@ -3562,8 +3563,8 @@ } function forEachCodeMirror(f) { if (document.getElementsByClassName) { - for(var byClass = document.getElementsByClassName("CodeMirror"), editors = [], i14 = 0; i14 < byClass.length; i14++){ - var cm = byClass[i14].CodeMirror; + for(var byClass = document.getElementsByClassName("CodeMirror"), editors = [], i15 = 0; i15 < byClass.length; i15++){ + var cm = byClass[i15].CodeMirror; cm && editors.push(cm); } editors.length && editors[0].operation(function() { @@ -3690,8 +3691,8 @@ return "string" == typeof val ? keyMap[val] : val; } function deleteNearSelection(cm, compute) { - for(var ranges = cm.doc.sel.ranges, kill = [], i16 = 0; i16 < ranges.length; i16++){ - for(var toKill = compute(ranges[i16]); kill.length && 0 >= cmp(toKill.from, lst(kill).to);){ + for(var ranges = cm.doc.sel.ranges, kill = [], i17 = 0; i17 < ranges.length; i17++){ + for(var toKill = compute(ranges[i17]); kill.length && 0 >= cmp(toKill.from, lst(kill).to);){ var replaced = kill.pop(); if (0 > cmp(replaced.from, toKill.from)) { toKill.from = replaced.from; @@ -4146,7 +4147,7 @@ 16 == e.keyCode && (this.doc.sel.shift = !1), signalDOMEvent(this, e); } function onKeyPress(e) { - if ((!e.target || e.target == this.display.input.getField()) && !(eventInWidget(this.display, e) || signalDOMEvent(this, e)) && (!e.ctrlKey || e.altKey) && (!mac || !e.metaKey)) { + if (!(e.target && e.target != this.display.input.getField() || eventInWidget(this.display, e) || signalDOMEvent(this, e) || e.ctrlKey && !e.altKey || mac && e.metaKey)) { var cm, keyCode = e.keyCode, charCode = e.charCode; if (presto && keyCode == lastStoppedKey) { lastStoppedKey = null, e_preventDefault(e); @@ -4252,33 +4253,37 @@ var lastPos = start, editorSize = display.wrapper.getBoundingClientRect(), counter = 0; function extend(e) { var curCount = ++counter, cur = posFromMouse(cm, e, !0, "rectangle" == behavior.unit); - if (cur) if (0 != cmp(cur, lastPos)) { - cm.curOp.focus = activeElt(), function(pos) { - if (0 != cmp(lastPos, pos)) if (lastPos = pos, "rectangle" == behavior.unit) { - for(var ranges = [], tabSize = cm.options.tabSize, startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize), posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize), left = Math.min(startCol, posCol), right = Math.max(startCol, posCol), line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); line <= end; line++){ - var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); - left == right ? ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))) : text.length > leftPos && ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); + if (cur) { + if (0 != cmp(cur, lastPos)) { + cm.curOp.focus = activeElt(), function(pos) { + if (0 != cmp(lastPos, pos)) { + if (lastPos = pos, "rectangle" == behavior.unit) { + for(var ranges = [], tabSize = cm.options.tabSize, startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize), posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize), left = Math.min(startCol, posCol), right = Math.max(startCol, posCol), line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); line <= end; line++){ + var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); + left == right ? ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))) : text.length > leftPos && ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); + } + ranges.length || ranges.push(new Range(start, start)), setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), { + origin: "*mouse", + scroll: !1 + }), cm.scrollIntoView(pos); + } else { + var head, oldRange = ourRange, range = rangeForUnit(cm, pos, behavior.unit), anchor = oldRange.anchor; + cmp(range.anchor, anchor) > 0 ? (head = range.head, anchor = minPos(oldRange.from(), range.anchor)) : (head = range.anchor, anchor = maxPos(oldRange.to(), range.head)); + var ranges$1 = startSel.ranges.slice(0); + ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head)), setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse); + } } - ranges.length || ranges.push(new Range(start, start)), setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), { - origin: "*mouse", - scroll: !1 - }), cm.scrollIntoView(pos); - } else { - var head, oldRange = ourRange, range = rangeForUnit(cm, pos, behavior.unit), anchor = oldRange.anchor; - cmp(range.anchor, anchor) > 0 ? (head = range.head, anchor = minPos(oldRange.from(), range.anchor)) : (head = range.anchor, anchor = maxPos(oldRange.to(), range.head)); - var ranges$1 = startSel.ranges.slice(0); - ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head)), setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse); - } - }(cur); - var visible = visibleLines(display, doc); - (cur.line >= visible.to || cur.line < visible.from) && setTimeout(operation(cm, function() { - counter == curCount && extend(e); - }), 150); - } else { - var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; - outside && setTimeout(operation(cm, function() { - counter == curCount && (display.scroller.scrollTop += outside, extend(e)); - }), 50); + }(cur); + var visible = visibleLines(display, doc); + (cur.line >= visible.to || cur.line < visible.from) && setTimeout(operation(cm, function() { + counter == curCount && extend(e); + }), 150); + } else { + var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0; + outside && setTimeout(operation(cm, function() { + counter == curCount && (display.scroller.scrollTop += outside, extend(e)); + }), 50); + } } } function done(e) { @@ -4330,7 +4335,7 @@ return gutterEvent(cm, e, "gutterClick", !0); } function onContextMenu(cm, e) { - eventInWidget(cm.display, e) || contextMenuInGutter(cm, e) || !signalDOMEvent(cm, e, "contextmenu") && (captureRightClick || cm.display.input.onContextMenu(e)); + !(eventInWidget(cm.display, e) || contextMenuInGutter(cm, e) || signalDOMEvent(cm, e, "contextmenu")) && (captureRightClick || cm.display.input.onContextMenu(e)); } function contextMenuInGutter(cm, e) { return !!hasHandler(cm, "gutterContextMenu") && gutterEvent(cm, e, "gutterContextMenu", !1); @@ -4524,16 +4529,18 @@ var doc = cm.doc; cm.display.shift = !1, sel || (sel = doc.sel); var recent = +new Date - 200, paste = "paste" == origin || cm.state.pasteIncoming > recent, textLines = splitLinesAuto(inserted), multiPaste = null; - if (paste && sel.ranges.length > 1) if (lastCopied && lastCopied.text.join("\n") == inserted) { - if (sel.ranges.length % lastCopied.text.length == 0) { - multiPaste = []; - for(var i = 0; i < lastCopied.text.length; i++)multiPaste.push(doc.splitLines(lastCopied.text[i])); - } - } else textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection && (multiPaste = map1(textLines, function(l) { - return [ - l - ]; - })); + if (paste && sel.ranges.length > 1) { + if (lastCopied && lastCopied.text.join("\n") == inserted) { + if (sel.ranges.length % lastCopied.text.length == 0) { + multiPaste = []; + for(var i = 0; i < lastCopied.text.length; i++)multiPaste.push(doc.splitLines(lastCopied.text[i])); + } + } else textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection && (multiPaste = map1(textLines, function(l) { + return [ + l + ]; + })); + } for(var updateInput = cm.curOp.updateInput, i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--){ var range = sel.ranges[i$1], from = range.from(), to = range.to(); range.empty() && (deleted && deleted > 0 ? from = Pos(from.line, from.ch - deleted) : cm.state.overwrite && !paste ? to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)) : paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == textLines.join("\n") && (from = to = Pos(from.line, 0))); @@ -4626,8 +4633,7 @@ return moveInStorageOrder ? new Pos(start.line, mv(ch, 1), "before") : new Pos(start.line, ch, "after"); }; partPos >= 0 && partPos < bidi.length; partPos += dir){ var part = bidi[partPos], moveInStorageOrder1 = dir > 0 == (1 != part.level), ch7 = moveInStorageOrder1 ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1); - if (part.from <= ch7 && ch7 < part.to) return getRes(ch7, moveInStorageOrder1); - if (ch7 = moveInStorageOrder1 ? part.from : mv(part.to, -1), wrappedLineExtent.begin <= ch7 && ch7 < wrappedLineExtent.end) return getRes(ch7, moveInStorageOrder1); + if (part.from <= ch7 && ch7 < part.to || (ch7 = moveInStorageOrder1 ? part.from : mv(part.to, -1), wrappedLineExtent.begin <= ch7 && ch7 < wrappedLineExtent.end)) return getRes(ch7, moveInStorageOrder1); } }, res = searchInVisualLine(partPos2 + dir2, dir2, wrappedLineExtent2); if (res) return res; diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js index dbe9624f891..5a1d3285c70 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js @@ -153,8 +153,7 @@ 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 (isInstance(e, ArrayBuffer) || e && isInstance(e.buffer, ArrayBuffer)) return fromArrayBuffer(e, r, t); - if ("undefined" != typeof SharedArrayBuffer && (isInstance(e, SharedArrayBuffer) || e && isInstance(e.buffer, SharedArrayBuffer))) return fromArrayBuffer(e, r, t); + 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'); var f = e.valueOf && e.valueOf(); if (null != f && f !== e) return Buffer.from(f, r, t); @@ -226,9 +225,7 @@ } function slowToString(e, r, t) { var f = !1; - if ((void 0 === r || r < 0) && (r = 0), r > this.length) return ""; - if ((void 0 === t || t > this.length) && (t = this.length), t <= 0) return ""; - if ((t >>>= 0) <= (r >>>= 0)) return ""; + if ((void 0 === r || r < 0) && (r = 0), r > this.length || ((void 0 === t || t > this.length) && (t = this.length), t <= 0 || (t >>>= 0) <= (r >>>= 0))) return ""; for(e || (e = "utf8");;)switch(e){ case "hex": return hexSlice(this, r, t); @@ -385,8 +382,7 @@ if (t + f > e.length) throw new RangeError("Index out of range"); } function checkIEEE754(e, r, t, f, n, i) { - if (t + f > e.length) throw new RangeError("Index out of range"); - if (t < 0) throw new RangeError("Index out of range"); + if (t + f > e.length || t < 0) throw new 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; @@ -656,8 +652,7 @@ 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 (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) return 0; - if (0 === e.length || 0 === this.length) return 0; + 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"); @@ -692,11 +687,7 @@ for(var t, f = e.length, n = null, i = [], o = 0; o < f; ++o){ if ((t = e.charCodeAt(o)) > 55295 && t < 57344) { if (!n) { - if (t > 56319) { - (r -= 3) > -1 && i.push(239, 191, 189); - continue; - } - if (o + 1 === f) { + if (t > 56319 || o + 1 === f) { (r -= 3) > -1 && i.push(239, 191, 189); continue; } @@ -901,8 +892,7 @@ 901: function(r10) { r10.exports = function(r, e, o) { if (r.filter) return r.filter(e, o); - if (null == r) throw new TypeError; - if ("function" != typeof e) throw new TypeError; + if (null == r || "function" != typeof e) throw new 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); @@ -1706,15 +1696,11 @@ if ("function" != typeof Symbol || "function" != typeof Object.getOwnPropertySymbols) return !1; if ("symbol" == typeof Symbol.iterator) return !0; var r = {}, t = Symbol("test"), e = Object(t); - if ("string" == typeof t) return !1; - if ("[object Symbol]" !== Object.prototype.toString.call(t)) return !1; - if ("[object Symbol]" !== Object.prototype.toString.call(e)) return !1; + if ("string" == typeof t || "[object Symbol]" !== Object.prototype.toString.call(t) || "[object Symbol]" !== Object.prototype.toString.call(e)) return !1; for(t in r[t] = 42, r)return !1; - if ("function" == typeof Object.keys && 0 !== Object.keys(r).length) return !1; - if ("function" == typeof Object.getOwnPropertyNames && 0 !== Object.getOwnPropertyNames(r).length) return !1; + if ("function" == typeof Object.keys && 0 !== Object.keys(r).length || "function" == typeof Object.getOwnPropertyNames && 0 !== Object.getOwnPropertyNames(r).length) return !1; var n = Object.getOwnPropertySymbols(r); - if (1 !== n.length || n[0] !== t) return !1; - if (!Object.prototype.propertyIsEnumerable.call(r, t)) return !1; + if (1 !== n.length || n[0] !== t || !Object.prototype.propertyIsEnumerable.call(r, t)) return !1; if ("function" == typeof Object.getOwnPropertyDescriptor) { var i = Object.getOwnPropertyDescriptor(r, t); if (42 !== i.value || !0 !== i.enumerable) return !1; @@ -2105,13 +2091,15 @@ return r < 10 ? "0" + r.toString(10) : r.toString(10); } t17.debuglog = function(r) { - if (!i4[r = r.toUpperCase()]) if (a2.test(r)) { - var e = process.pid; - i4[r] = function() { - var o = t17.format.apply(t17, arguments); - console.error("%s %d: %s", r, e, o); - }; - } else i4[r] = function() {}; + if (!i4[r = r.toUpperCase()]) { + if (a2.test(r)) { + var e = process.pid; + i4[r] = function() { + var o = t17.format.apply(t17, arguments); + console.error("%s %d: %s", r, e, o); + }; + } else i4[r] = function() {}; + } return i4[r]; }, t17.inspect = inspect, inspect.colors = { bold: [ diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js index a613aa0abb6..1b959955727 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js @@ -169,7 +169,7 @@ } if (!strictCSP) { var container = target; - target && target.getRootNode ? (container = target.getRootNode()) && container != target || (container = document) : container = document; + target && target.getRootNode && (container = target.getRootNode()) && container != target || (container = document); var doc = container.ownerDocument || container; if (id && exports.hasCssString(id, container)) return null; id && (cssText += "\n/*# sourceURL=ace/css/" + id + " */"); @@ -898,10 +898,12 @@ clipboard.pasteCancelled() || ("string" == typeof data ? (data && host.onPaste(data, e), useragent.isIE && setTimeout(resetSelection), event.preventDefault(e)) : (text2.value = "", pasted = !0)); }; event.addCommandKeyListener(text2, host.onCommandKey.bind(host), host), event.addListener(text2, "select", function(e) { - if (!inComposition) if (copied) copied = !1; - else { - var text; - 0 === (text = text2).selectionStart && text.selectionEnd >= lastValue.length && text.value === lastValue && lastValue && text.selectionEnd !== lastSelectionEnd ? (host.selectAll(), resetSelection()) : isMobile && text2.selectionStart != lastSelectionStart && resetSelection(); + if (!inComposition) { + if (copied) copied = !1; + else { + var text; + 0 === (text = text2).selectionStart && text.selectionEnd >= lastValue.length && text.value === lastValue && lastValue && text.selectionEnd !== lastSelectionEnd ? (host.selectAll(), resetSelection()) : isMobile && text2.selectionStart != lastSelectionStart && resetSelection(); + } } }, host), event.addListener(text2, "input", onInput, host), event.addListener(text2, "cut", onCut, host), event.addListener(text2, "copy", onCopy, host), event.addListener(text2, "paste", onPaste, host), 'oncut' in text2 && 'oncopy' in text2 && 'onpaste' in text2 || event.addListener(parentNode, "keydown", function(e) { if ((!useragent.isMac || e.metaKey) && e.ctrlKey) switch(e.keyCode){ @@ -1189,10 +1191,12 @@ var screenRow = editor.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row, pos = mouseEvent.$pos; if (screenRow > editor.session.documentToScreenRow(pos.row, pos.column)) return hideTooltip(); } - if (tooltipAnnotation != annotation) if (tooltipAnnotation = annotation.text.join("
"), tooltip.setHtml(tooltipAnnotation), tooltip.show(), editor._signal("showGutterTooltip", tooltip), editor.on("mousewheel", hideTooltip), mouseHandler.$tooltipFollowsMouse) moveTooltip(mouseEvent); - else { - var rect = mouseEvent.domEvent.target.getBoundingClientRect(), style = tooltip.getElement().style; - style.left = rect.right + "px", style.top = rect.bottom + "px"; + if (tooltipAnnotation != annotation) { + if (tooltipAnnotation = annotation.text.join("
"), tooltip.setHtml(tooltipAnnotation), tooltip.show(), editor._signal("showGutterTooltip", tooltip), editor.on("mousewheel", hideTooltip), mouseHandler.$tooltipFollowsMouse) moveTooltip(mouseEvent); + else { + var rect = mouseEvent.domEvent.target.getBoundingClientRect(), style = tooltip.getElement().style; + style.left = rect.right + "px", style.top = rect.bottom + "px"; + } } }() : hideTooltip(); }, 50)); @@ -2499,10 +2503,12 @@ 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]); for(ix = 0, hiLevel = dir, lastArabic = !1, hasUBAT_AL = !1, hasUBAT_B = !1, hasUBAT_S = !1; ix < len; ix++){ - if (prevState = newState, classes[ix] = newClass = _getCharClass(chars, charTypes, classes, ix), action = 0xF0 & (newState = impTab[prevState][newClass]), newState &= 0x0F, levels[ix] = newLevel = impTab[newState][5], action > 0) if (0x10 == action) { - for(i = condPos; i < ix; i++)levels[i] = 1; - condPos = -1; - } else condPos = -1; + if (prevState = newState, classes[ix] = newClass = _getCharClass(chars, charTypes, classes, ix), action = 0xF0 & (newState = impTab[prevState][newClass]), newState &= 0x0F, levels[ix] = newLevel = impTab[newState][5], action > 0) { + if (0x10 == action) { + for(i = condPos; i < ix; i++)levels[i] = 1; + condPos = -1; + } else condPos = -1; + } if (impTab[newState][6]) -1 == condPos && (condPos = ix); else if (condPos > -1) { for(i = condPos; i < ix; i++)levels[i] = newLevel; @@ -2847,7 +2853,7 @@ rows < 0 ? rows -= widget.rowsAbove || 0 : rows > 0 && (rows += widget.rowCount - (widget.rowsAbove || 0)); } var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column, offsetX); - 0 !== rows && 0 === chars && docPos.row === this.lead.row && docPos.column === this.lead.column, this.moveCursorTo(docPos.row, docPos.column + chars, 0 === chars); + 0 !== rows && 0 === chars && docPos.row === this.lead.row && (docPos.column, this.lead.column), this.moveCursorTo(docPos.row, docPos.column + chars, 0 === chars); }, this.moveCursorToPosition = function(position) { this.moveCursorTo(position.row, position.column); }, this.moveCursorTo = function(row, column, keepDesiredColumn) { @@ -3394,15 +3400,13 @@ var stringBefore = token && /string|escape/.test(token.type), stringAfter = !rightToken || /string|escape/.test(rightToken.type); if (rightChar == quote) (pair = stringBefore !== stringAfter) && /string\.end/.test(rightToken.type) && (pair = !1); else { - if (stringBefore && !stringAfter) return null; - if (stringBefore && stringAfter) return null; + if (stringBefore && !stringAfter || stringBefore && stringAfter) return null; var wordRe = session.$mode.tokenRe; wordRe.lastIndex = 0; var isWordBefore = wordRe.test(leftChar); wordRe.lastIndex = 0; var isWordAfter = wordRe.test(leftChar); - if (isWordBefore || isWordAfter) return null; - if (rightChar && !/[\s;,.})\]\\]/.test(rightChar)) return null; + if (isWordBefore || isWordAfter || rightChar && !/[\s;,.})\]\\]/.test(rightChar)) return null; var charBefore = line[cursor.column - 2]; if (leftChar == quote && (charBefore == quote || wordRe.test(charBefore))) return null; pair = !0; @@ -5161,8 +5165,7 @@ for(var folds = foldLine.folds, i = 0; i < folds.length; i++){ var range = folds[i].range; if (range.contains(row, column)) { - if (1 == side && range.isEnd(row, column) && !range.isEmpty()) continue; - if (-1 == side && range.isStart(row, column) && !range.isEmpty()) continue; + if (1 == side && range.isEnd(row, column) && !range.isEmpty() || -1 == side && range.isStart(row, column) && !range.isEmpty()) continue; return folds[i]; } } @@ -6036,37 +6039,38 @@ }; }, this.$updateInternalDataOnChange = function(delta) { var useWrapMode = this.$useWrapMode, action = delta.action, start = delta.start, end = delta.end, firstRow = start.row, lastRow = end.row, len = lastRow - firstRow, removedFolds = null; - if (this.$updating = !0, 0 != len) if ("remove" === action) { - this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len); - var foldLines = this.$foldData; - removedFolds = this.getFoldsInRange(delta), this.removeFolds(removedFolds); - var foldLine = this.getFoldLine(end.row), idx = 0; - if (foldLine) { - foldLine.addRemoveChars(end.row, end.column, start.column - end.column), foldLine.shiftRow(-len); - var foldLineBefore = this.getFoldLine(firstRow); - foldLineBefore && foldLineBefore !== foldLine && (foldLineBefore.merge(foldLine), foldLine = foldLineBefore), idx = foldLines.indexOf(foldLine) + 1; + if (this.$updating = !0, 0 != len) { + if ("remove" === action) { + this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len); + var foldLines = this.$foldData; + removedFolds = this.getFoldsInRange(delta), this.removeFolds(removedFolds); + var foldLine = this.getFoldLine(end.row), idx = 0; + if (foldLine) { + foldLine.addRemoveChars(end.row, end.column, start.column - end.column), foldLine.shiftRow(-len); + var foldLineBefore = this.getFoldLine(firstRow); + foldLineBefore && foldLineBefore !== foldLine && (foldLineBefore.merge(foldLine), foldLine = foldLineBefore), idx = foldLines.indexOf(foldLine) + 1; + } + for(; idx < foldLines.length; idx++){ + var foldLine = foldLines[idx]; + foldLine.start.row >= end.row && foldLine.shiftRow(-len); + } + lastRow = firstRow; + } else { + var args = Array(len); + args.unshift(firstRow, 0); + var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache; + arr.splice.apply(arr, args); + var foldLines = this.$foldData, foldLine = this.getFoldLine(firstRow), idx = 0; + if (foldLine) { + var cmp = foldLine.range.compareInside(start.row, start.column); + 0 == cmp ? (foldLine = foldLine.split(start.row, start.column)) && (foldLine.shiftRow(len), foldLine.addRemoveChars(lastRow, 0, end.column - start.column)) : -1 == cmp && (foldLine.addRemoveChars(firstRow, 0, end.column - start.column), foldLine.shiftRow(len)), idx = foldLines.indexOf(foldLine) + 1; + } + for(; idx < foldLines.length; idx++){ + var foldLine = foldLines[idx]; + foldLine.start.row >= firstRow && foldLine.shiftRow(len); + } } - for(; idx < foldLines.length; idx++){ - var foldLine = foldLines[idx]; - foldLine.start.row >= end.row && foldLine.shiftRow(-len); - } - lastRow = firstRow; } else { - var args = Array(len); - args.unshift(firstRow, 0); - var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache; - arr.splice.apply(arr, args); - var foldLines = this.$foldData, foldLine = this.getFoldLine(firstRow), idx = 0; - if (foldLine) { - var cmp = foldLine.range.compareInside(start.row, start.column); - 0 == cmp ? (foldLine = foldLine.split(start.row, start.column)) && (foldLine.shiftRow(len), foldLine.addRemoveChars(lastRow, 0, end.column - start.column)) : -1 == cmp && (foldLine.addRemoveChars(firstRow, 0, end.column - start.column), foldLine.shiftRow(len)), idx = foldLines.indexOf(foldLine) + 1; - } - for(; idx < foldLines.length; idx++){ - var foldLine = foldLines[idx]; - foldLine.start.row >= firstRow && foldLine.shiftRow(len); - } - } - else { len = Math.abs(delta.start.column - delta.end.column), "remove" === action && (removedFolds = this.getFoldsInRange(delta), this.removeFolds(removedFolds), len = -len); var foldLine = this.getFoldLine(firstRow); foldLine && foldLine.addRemoveChars(firstRow, start.column, len); @@ -6277,10 +6281,12 @@ }).call(EditSession.prototype), require("./edit_session/folding").Folding.call(EditSession.prototype), require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype), config.defineOptions(EditSession.prototype, "session", { wrap: { set: function(value) { - if (value && "off" != value ? "free" == value ? value = !0 : "printMargin" == value ? value = -1 : "string" == typeof value && (value = parseInt(value, 10) || !1) : value = !1, this.$wrap != value) if (this.$wrap = value, value) { - var col = "number" == typeof value ? value : null; - this.setWrapLimitRange(col, col), this.setUseWrapMode(!0); - } else this.setUseWrapMode(!1); + if (value && "off" != value ? "free" == value ? value = !0 : "printMargin" == value ? value = -1 : "string" == typeof value && (value = parseInt(value, 10) || !1) : value = !1, this.$wrap != value) { + if (this.$wrap = value, value) { + var col = "number" == typeof value ? value : null; + this.setWrapLimitRange(col, col), this.setUseWrapMode(!0); + } else this.setUseWrapMode(!1); + } }, get: function() { return this.getUseWrapMode() ? -1 == this.$wrap ? "printMargin" : this.getWrapLimitRange().min ? this.$wrap : "free" : "off"; @@ -6563,16 +6569,17 @@ } }, this._addCommandToBinding = function(keyId, command, position) { var i, ckb = this.commandKeyBinding; - if (command) if (!ckb[keyId] || this.$singleCommand) ckb[keyId] = command; - else { - Array.isArray(ckb[keyId]) ? -1 != (i = ckb[keyId].indexOf(command)) && ckb[keyId].splice(i, 1) : ckb[keyId] = [ - ckb[keyId] - ], "number" != typeof position && (position = getPosition(command)); - var commands = ckb[keyId]; - for(i = 0; i < commands.length && !(getPosition(commands[i]) > position); i++); - commands.splice(i, 0, command); - } - else delete ckb[keyId]; + if (command) { + if (!ckb[keyId] || this.$singleCommand) ckb[keyId] = command; + else { + Array.isArray(ckb[keyId]) ? -1 != (i = ckb[keyId].indexOf(command)) && ckb[keyId].splice(i, 1) : ckb[keyId] = [ + ckb[keyId] + ], "number" != typeof position && (position = getPosition(command)); + var commands = ckb[keyId]; + for(i = 0; i < commands.length && !(getPosition(commands[i]) > position); i++); + commands.splice(i, 0, command); + } + } else delete ckb[keyId]; }, this.addCommands = function(commands) { commands && Object.keys(commands).forEach(function(name) { var command = commands[name]; @@ -6651,9 +6658,7 @@ for(var i = command.length; i--;)if (this.exec(command[i], editor, args)) return !0; return !1; } - if ("string" == typeof command && (command = this.commands[command]), !command) return !1; - if (editor && editor.$readOnly && !command.readOnly) return !1; - if (!1 != this.$checkCommandState && command.isAvailable && !command.isAvailable(editor)) return !1; + if ("string" == typeof command && (command = this.commands[command]), !command || editor && editor.$readOnly && !command.readOnly || !1 != this.$checkCommandState && command.isAvailable && !command.isAvailable(editor)) return !1; var e = { editor: editor, command: command, @@ -8472,8 +8477,7 @@ for(var first = (rows = this.$getSelectedRows(ranges[i])).first, last = rows.last; ++i < l;){ totalDiff && ranges[i].moveBy(totalDiff, 0); var subRows = this.$getSelectedRows(ranges[i]); - if (copy && subRows.first != last) break; - if (!copy && subRows.first > last + 1) break; + if (copy && subRows.first != last || !copy && subRows.first > last + 1) break; last = subRows.last; } for(i--, diff = this.session.$moveLines(first, last, copy ? 0 : dir), copy && -1 == dir && (rangeIndex = i + 1); rangeIndex <= i;)ranges[rangeIndex].moveBy(diff, 0), rangeIndex++; @@ -9002,25 +9006,30 @@ } function swap(d1, d2) { var i1 = "insert" == d1.action, i2 = "insert" == d2.action; - if (i1 && i2) if (cmp(d2.start, d1.end) >= 0) shift(d2, d1, -1); - else { - if (!(0 >= cmp(d2.start, d1.start))) return null; - shift(d1, d2, 1); - } - else if (i1 && !i2) if (cmp(d2.start, d1.end) >= 0) shift(d2, d1, -1); - else { - if (!(0 >= cmp(d2.end, d1.start))) return null; - shift(d1, d2, -1); - } - else if (!i1 && i2) if (cmp(d2.start, d1.start) >= 0) shift(d2, d1, 1); - else { - if (!(0 >= cmp(d2.start, d1.start))) return null; - shift(d1, d2, 1); - } - else if (!i1 && !i2) if (cmp(d2.start, d1.start) >= 0) shift(d2, d1, 1); - else { - if (!(0 >= cmp(d2.end, d1.start))) return null; - shift(d1, d2, -1); + if (i1 && i2) { + if (cmp(d2.start, d1.end) >= 0) shift(d2, d1, -1); + else { + if (!(0 >= cmp(d2.start, d1.start))) return null; + shift(d1, d2, 1); + } + } else if (i1 && !i2) { + if (cmp(d2.start, d1.end) >= 0) shift(d2, d1, -1); + else { + if (!(0 >= cmp(d2.end, d1.start))) return null; + shift(d1, d2, -1); + } + } else if (!i1 && i2) { + if (cmp(d2.start, d1.start) >= 0) shift(d2, d1, 1); + else { + if (!(0 >= cmp(d2.start, d1.start))) return null; + shift(d1, d2, 1); + } + } else if (!i1 && !i2) { + if (cmp(d2.start, d1.start) >= 0) shift(d2, d1, 1); + else { + if (!(0 >= cmp(d2.end, d1.start))) return null; + shift(d1, d2, -1); + } } return [ d2, @@ -9048,14 +9057,16 @@ if (i1 && i2) 0 > cmp(d1.start, c1.start) ? shift(c1, d1, 1) : shift(d1, c1, 1); else if (i1 && !i2) cmp(d1.start, c1.end) >= 0 ? shift(d1, c1, -1) : (0 >= cmp(d1.start, c1.start) || shift(d1, Range.fromPoints(c1.start, d1.start), -1), shift(c1, d1, 1)); else if (!i1 && i2) cmp(c1.start, d1.end) >= 0 ? shift(c1, d1, -1) : (0 >= cmp(c1.start, d1.start) || shift(c1, Range.fromPoints(d1.start, c1.start), -1), shift(d1, c1, 1)); - else if (!i1 && !i2) if (cmp(c1.start, d1.end) >= 0) shift(c1, d1, -1); - else { - if (!(0 >= cmp(c1.end, d1.start))) return 0 > cmp(d1.start, c1.start) && (before = d1, d1 = splitDelta(d1, c1.start)), cmp(d1.end, c1.end) > 0 && (after = splitDelta(d1, c1.end)), shiftPos(c1.end, d1.start, d1.end, -1), after && !before && (d1.lines = after.lines, d1.start = after.start, d1.end = after.end, after = d1), [ - c1, - before, - after - ].filter(Boolean); - shift(d1, c1, -1); + else if (!i1 && !i2) { + if (cmp(c1.start, d1.end) >= 0) shift(c1, d1, -1); + else { + if (!(0 >= cmp(c1.end, d1.start))) return 0 > cmp(d1.start, c1.start) && (before = d1, d1 = splitDelta(d1, c1.start)), cmp(d1.end, c1.end) > 0 && (after = splitDelta(d1, c1.end)), shiftPos(c1.end, d1.start, d1.end, -1), after && !before && (d1.lines = after.lines, d1.start = after.start, d1.end = after.end, after = d1), [ + c1, + before, + after + ].filter(Boolean); + shift(d1, c1, -1); + } } return [ c1, @@ -9256,8 +9267,7 @@ if (this.config = config, this.$updateCursorRow(), this.$lines.pageChanged(oldConfig, config)) return this.update(config); this.$lines.moveContainer(config); var lastRow = Math.min(config.lastRow + config.gutterOffset, this.session.getLength() - 1), oldLastRow = this.oldLastRow; - if (this.oldLastRow = lastRow, !oldConfig || oldLastRow < config.firstRow) return this.update(config); - if (lastRow < oldConfig.firstRow) return this.update(config); + if (this.oldLastRow = lastRow, !oldConfig || oldLastRow < config.firstRow || lastRow < oldConfig.firstRow) return this.update(config); if (oldConfig.firstRow < config.firstRow) for(var row = this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row > 0; row--)this.$lines.shift(); if (oldLastRow > lastRow) for(var row = this.session.getFoldedRowCount(lastRow + 1, oldLastRow); row > 0; row--)this.$lines.pop(); config.firstRow < oldConfig.firstRow && this.$lines.unshift(this.$renderLines(config, config.firstRow, oldConfig.firstRow - 1)), lastRow > oldLastRow && this.$lines.push(this.$renderLines(config, oldLastRow + 1, lastRow)), this.updateLineHighlight(), this._signal("afterRender"), this.$updateGutterWidth(config); @@ -9343,10 +9353,12 @@ continue; } var range = marker.range.clipRows(config.firstRow, config.lastRow); - if (!range.isEmpty()) if (range = range.toScreenRange(this.session), marker.renderer) { - var top = this.$getTop(range.start.row, config), left = this.$padding + range.start.column * config.characterWidth; - marker.renderer(html, range, left, top, config); - } else "fullLine" == marker.type ? this.drawFullLineMarker(html, range, marker.clazz, config) : "screenLine" == marker.type ? this.drawScreenLineMarker(html, range, marker.clazz, config) : range.isMultiLine() ? "text" == marker.type ? this.drawTextMarker(html, range, marker.clazz, config) : this.drawMultiLineMarker(html, range, marker.clazz, config) : this.drawSingleLineMarker(html, range, marker.clazz + " ace_start ace_br15", config); + if (!range.isEmpty()) { + if (range = range.toScreenRange(this.session), marker.renderer) { + var top = this.$getTop(range.start.row, config), left = this.$padding + range.start.column * config.characterWidth; + marker.renderer(html, range, left, top, config); + } else "fullLine" == marker.type ? this.drawFullLineMarker(html, range, marker.clazz, config) : "screenLine" == marker.type ? this.drawScreenLineMarker(html, range, marker.clazz, config) : range.isMultiLine() ? "text" == marker.type ? this.drawTextMarker(html, range, marker.clazz, config) : this.drawMultiLineMarker(html, range, marker.clazz, config) : this.drawSingleLineMarker(html, range, marker.clazz + " ace_start ace_br15", config); + } } if (-1 != this.i) for(; this.i < this.element.childElementCount;)this.element.removeChild(this.element.lastChild); } @@ -9476,10 +9488,7 @@ if (this.config = config, this.$lines.pageChanged(oldConfig, config)) return this.update(config); this.$lines.moveContainer(config); var lastRow = config.lastRow, oldLastRow = oldConfig ? oldConfig.lastRow : -1; - if (!oldConfig || oldLastRow < config.firstRow) return this.update(config); - if (lastRow < oldConfig.firstRow) return this.update(config); - if (!oldConfig || oldConfig.lastRow < config.firstRow) return this.update(config); - if (config.lastRow < oldConfig.firstRow) return this.update(config); + if (!oldConfig || oldLastRow < config.firstRow || lastRow < oldConfig.firstRow || !oldConfig || oldConfig.lastRow < config.firstRow || config.lastRow < oldConfig.firstRow) return this.update(config); if (oldConfig.firstRow < config.firstRow) for(var row = this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row > 0; row--)this.$lines.shift(); if (oldConfig.lastRow > config.lastRow) for(var row = this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row > 0; row--)this.$lines.pop(); config.firstRow < oldConfig.firstRow && this.$lines.unshift(this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1)), config.lastRow > oldConfig.lastRow && this.$lines.push(this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow)); @@ -9505,11 +9514,12 @@ if (i = m.index + m[0].length, before && valueFragment.appendChild(this.dom.createTextNode(before, this.element)), tab) { var tabSize = self.session.getScreenTabSize(screenColumn + m.index); valueFragment.appendChild(self.$tabStrings[tabSize].cloneNode(!0)), screenColumn += tabSize - 1; - } else if (simpleSpace) if (self.showSpaces) { - var span = this.dom.createElement("span"); - span.className = "ace_invisible ace_invisible_space", span.textContent = lang.stringRepeat(self.SPACE_CHAR, simpleSpace.length), valueFragment.appendChild(span); - } else valueFragment.appendChild(this.com.createTextNode(simpleSpace, this.element)); - else if (controlCharacter) { + } else if (simpleSpace) { + if (self.showSpaces) { + var span = this.dom.createElement("span"); + span.className = "ace_invisible ace_invisible_space", span.textContent = lang.stringRepeat(self.SPACE_CHAR, simpleSpace.length), valueFragment.appendChild(span); + } else valueFragment.appendChild(this.com.createTextNode(simpleSpace, this.element)); + } else if (controlCharacter) { var span = this.dom.createElement("span"); span.className = "ace_invisible ace_invisible_space ace_invalid", span.textContent = lang.stringRepeat(self.SPACE_CHAR, controlCharacter.length), valueFragment.appendChild(span); } else if (cjkSpace) { @@ -10599,11 +10609,12 @@ margin: 0 10px;\ return; } var w = 1, maxTop = this.$size.height - h; - if (composition) if (composition.useTextareaForIME) { - var val = this.textarea.value; - w = this.characterWidth * this.session.$getStringScreenWidth(val)[0]; - } else posTop += this.lineHeight + 2; - else posTop += this.lineHeight; + if (composition) { + if (composition.useTextareaForIME) { + var val = this.textarea.value; + w = this.characterWidth * this.session.$getStringScreenWidth(val)[0]; + } else posTop += this.lineHeight + 2; + } else posTop += this.lineHeight; (posLeft -= this.scrollLeft) > this.$size.scrollerWidth - w && (posLeft = this.$size.scrollerWidth - w), posLeft += this.gutterWidth + this.margin.left, dom.setStyle(style, "height", h + "px"), dom.setStyle(style, "width", w + "px"), dom.translate(this.textarea, Math.min(posLeft, this.$size.scrollerWidth - w), Math.min(posTop, maxTop)); } } @@ -10807,7 +10818,7 @@ margin: 0 10px;\ }, this.scrollBy = function(deltaX, deltaY) { deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY), deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX); }, this.isScrollableBy = function(deltaX, deltaY) { - return !!(deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top) || !!(deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom) || !!(deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left) || !!(deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth - this.layerConfig.width < -1 + this.scrollMargin.right) || void 0; + if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top || deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom || deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left || deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth - this.layerConfig.width < -1 + this.scrollMargin.right) return !0; }, this.pixelToScreenCoordinates = function(x, y) { if (this.$hasCssTransforms) { canvasPos = { @@ -12063,7 +12074,7 @@ background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZ (function() { this.getRowLength = function(row) { var h; - return (h = this.lineWidgets ? this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0 : 0, this.$useWrapMode && this.$wrapData[row]) ? this.$wrapData[row].length + 1 + h : 1 + h; + return (h = this.lineWidgets && this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0, this.$useWrapMode && this.$wrapData[row]) ? this.$wrapData[row].length + 1 + h : 1 + h; }, this.$getWidgetScreenLength = function() { var screenRows = 0; return this.lineWidgets.forEach(function(w) { diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/projects/angular/5/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/projects/angular/5/output.js index d2ae565712b..9d473f2b6f1 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/projects/angular/5/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/projects/angular/5/output.js @@ -1,8 +1,10 @@ function forEach(obj, iterator, context) { var key; - if (obj) if (isFunction(obj)) for(key in obj)'prototype' != key && 'length' != key && 'name' != key && obj.hasOwnProperty(key) && iterator.call(context, obj[key], key); - else if (obj.forEach && obj.forEach !== forEach) obj.forEach(iterator, context); - else if (isArrayLike(obj)) for(key = 0; key < obj.length; key++)iterator.call(context, obj[key], key); - else for(key in obj)obj.hasOwnProperty(key) && iterator.call(context, obj[key], key); + if (obj) { + if (isFunction(obj)) for(key in obj)'prototype' != key && 'length' != key && 'name' != key && obj.hasOwnProperty(key) && iterator.call(context, obj[key], key); + else if (obj.forEach && obj.forEach !== forEach) obj.forEach(iterator, context); + else if (isArrayLike(obj)) for(key = 0; key < obj.length; key++)iterator.call(context, obj[key], key); + else for(key in obj)obj.hasOwnProperty(key) && iterator.call(context, obj[key], key); + } return obj; } diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/projects/backbone/20/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/projects/backbone/20/output.js index 9c66d6058ac..be527a73f4c 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/projects/backbone/20/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/projects/backbone/20/output.js @@ -18,11 +18,13 @@ export const E = { for(i = 0, l = this.length; i < l; ++i)modelMap[(model = this.models[i]).cid] || toRemove.push(model); toRemove.length && this.remove(toRemove, options); } - if (toAdd.length || order && order.length) if (sortable && (sort = !0), this.length += toAdd.length, null != at) for(i = 0, l = toAdd.length; i < l; i++)this.models.splice(at + i, 0, toAdd[i]); - else { - order && (this.models.length = 0); - var orderedModels = order || toAdd; - for(i = 0, l = orderedModels.length; i < l; i++)this.models.push(orderedModels[i]); + if (toAdd.length || order && order.length) { + if (sortable && (sort = !0), this.length += toAdd.length, null != at) for(i = 0, l = toAdd.length; i < l; i++)this.models.splice(at + i, 0, toAdd[i]); + else { + order && (this.models.length = 0); + var orderedModels = order || toAdd; + for(i = 0, l = orderedModels.length; i < l; i++)this.models.push(orderedModels[i]); + } } if (sort && this.sort({ silent: !0 diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/projects/jquery/24/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/projects/jquery/24/output.js index c8f72eaf911..820385681c0 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/projects/jquery/24/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/projects/jquery/24/output.js @@ -1,17 +1,19 @@ export const obj = { buildFragment: function(elems, context, scripts, selection) { - for(var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length, safe = createSafeFragment(context), nodes = [], i = 0; i < l; i++)if ((elem = elems[i]) || 0 === elem) if ("object" === jQuery.type(elem)) jQuery.merge(nodes, elem.nodeType ? [ - elem - ] : elem); - else if (rhtml.test(elem)) { - for(tmp = tmp || safe.appendChild(context.createElement("div")), wrap = wrapMap[tag = (rtagName.exec(elem) || [ - "", - "" - ])[1].toLowerCase()] || wrapMap._default, tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1>") + wrap[2], j = wrap[0]; j--;)tmp = tmp.lastChild; - if (!jQuery.support.leadingWhitespace && rleadingWhitespace.test(elem) && nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0])), !jQuery.support.tbody) for(j = (elem = "table" !== tag || rtbody.test(elem) ? "" !== wrap[1] || rtbody.test(elem) ? 0 : tmp : tmp.firstChild) && elem.childNodes.length; j--;)jQuery.nodeName(tbody = elem.childNodes[j], "tbody") && !tbody.childNodes.length && elem.removeChild(tbody); - for(jQuery.merge(nodes, tmp.childNodes), tmp.textContent = ""; tmp.firstChild;)tmp.removeChild(tmp.firstChild); - tmp = safe.lastChild; - } else nodes.push(context.createTextNode(elem)); + for(var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length, safe = createSafeFragment(context), nodes = [], i = 0; i < l; i++)if ((elem = elems[i]) || 0 === elem) { + if ("object" === jQuery.type(elem)) jQuery.merge(nodes, elem.nodeType ? [ + elem + ] : elem); + else if (rhtml.test(elem)) { + for(tmp = tmp || safe.appendChild(context.createElement("div")), wrap = wrapMap[tag = (rtagName.exec(elem) || [ + "", + "" + ])[1].toLowerCase()] || wrapMap._default, tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1>") + wrap[2], j = wrap[0]; j--;)tmp = tmp.lastChild; + if (!jQuery.support.leadingWhitespace && rleadingWhitespace.test(elem) && nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0])), !jQuery.support.tbody) for(j = (elem = "table" !== tag || rtbody.test(elem) ? "
" !== wrap[1] || rtbody.test(elem) ? 0 : tmp : tmp.firstChild) && elem.childNodes.length; j--;)jQuery.nodeName(tbody = elem.childNodes[j], "tbody") && !tbody.childNodes.length && elem.removeChild(tbody); + for(jQuery.merge(nodes, tmp.childNodes), tmp.textContent = ""; tmp.firstChild;)tmp.removeChild(tmp.firstChild); + tmp = safe.lastChild; + } else nodes.push(context.createTextNode(elem)); + } for(tmp && safe.removeChild(tmp), jQuery.support.appendChecked || jQuery.grep(getAll(nodes, "input"), fixDefaultChecked), i = 0; elem = nodes[i++];)if ((!selection || -1 === jQuery.inArray(elem, selection)) && (contains = jQuery.contains(elem.ownerDocument, elem), tmp = getAll(safe.appendChild(elem), "script"), contains && setGlobalEval(tmp), scripts)) for(j = 0; elem = tmp[j++];)rscriptType.test(elem.type || "") && scripts.push(elem); return tmp = null, safe; } diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js index 47e69b98e7d..3596a371d08 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/output.js @@ -438,8 +438,7 @@ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4512), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8436), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(8370), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2911), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(3001), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7130), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2374), _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(9178), Welcome1 = function(_React$Component) { (0, _Users_timneutkens_projects_next_js_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_4__.Z)(Welcome, _React$Component); var Derived, hasNativeReflectConstruct, _super = (Derived = Welcome, hasNativeReflectConstruct = function() { - if ("undefined" == typeof Reflect || !Reflect.construct) return !1; - if (Reflect.construct.sham) return !1; + 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; 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 6a7fbd2e2fd..b7ed33b0da1 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){"use strict";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(),lm=new I(2),I!=Float32Array&&(lm[0]=0,lm[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)return null;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)return null;k=f(h.pop());case"hsl":if(3!==h.length)return null;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];default:return null}}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)return!0;if("string"==typeof a)return!0;if("boolean"==typeof a)return!0;if("number"==typeof a)return!0;if(a instanceof m)return!0;if(a instanceof fz)return!0;if(a instanceof fB)return!0;if(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 a=b,Array.isArray(a)?`(${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)return!1;if(a instanceof cn)return!1;if(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){var d,e,f,g,h,i,j,k,l,n,o,p;return new m((d=a.r,e=b.r,d*(1-(f=c))+e*f),(g=a.g,h=b.g,g*(1-(i=c))+h*i),(j=a.b,k=b.b,j*(1-(l=c))+k*l),(n=a.a,o=b.a,n*(1-(p=c))+o*p))},array:function(a,b,c){return a.map((f,g)=>{var a,d,e;return a=f,d=b[g],a*(1-(e=c))+d*e})}});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){var d,e,f,g,h,i,j,k,l,m,n,o;return{l:(d=a.l,e=b.l,d*(1-(f=c))+e*f),a:(g=a.a,h=b.a,g*(1-(i=c))+h*i),b:(j=a.b,k=b.b,j*(1-(l=c))+k*l),alpha:(m=a.alpha,n=b.alpha,m*(1-(o=c))+n*o)}}},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){var d,e,f,g,h,i,j,k,l;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:(d=a.c,e=b.c,d*(1-(f=c))+e*f),l:(g=a.l,h=b.l,g*(1-(i=c))+h*i),alpha:(j=a.alpha,k=b.alpha,j*(1-(l=c))+k*l)}}};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)return a.length;if(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)return a.stops[0][1];if(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)return a.stops[0][1];if(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){"use strict";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(),ll=new I(2),I!=Float32Array&&(ll[0]=0,ll[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)return null;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)return null;k=f(h.pop());case"hsl":if(3!==h.length)return null;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];default:return null}}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 a=b,Array.isArray(a)?`(${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){var d,e,f,g,h,i,j,k,l,n,o,p;return new m((d=a.r,e=b.r,d*(1-(f=c))+e*f),(g=a.g,h=b.g,g*(1-(i=c))+h*i),(j=a.b,k=b.b,j*(1-(l=c))+k*l),(n=a.a,o=b.a,n*(1-(p=c))+o*p))},array:function(a,b,c){return a.map((f,g)=>{var a,d,e;return a=f,d=b[g],a*(1-(e=c))+d*e})}});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){var d,e,f,g,h,i,j,k,l,m,n,o;return{l:(d=a.l,e=b.l,d*(1-(f=c))+e*f),a:(g=a.a,h=b.a,g*(1-(i=c))+h*i),b:(j=a.b,k=b.b,j*(1-(l=c))+k*l),alpha:(m=a.alpha,n=b.alpha,m*(1-(o=c))+n*o)}}},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){var d,e,f,g,h,i,j,k,l;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:(d=a.c,e=b.c,d*(1-(f=c))+e*f),l:(g=a.l,h=b.l,g*(1-(i=c))+h*i),alpha:(j=a.alpha,k=b.alpha,j*(1-(l=c))+k*l)}}};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. 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?(c=a.slice(1),["any"].concat(c.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,f=d.style;if(!a.type)return[new cc(b,a,'"type" is required')];const i=fp(a.type);let e;switch(i){case"vector":case"raster":case"raster-dem":return e=cR({key:b,value:a,valueSpec:c[`source_${i.replace("-","_")}`],style:d.style,styleSpec:c,objectElementValidators:gP});case"geojson":if(e=cR({key:b,value:a,valueSpec:c.source_geojson,style:f,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;e.push(...gy({key:`${b}.${g}.map`,value:j,expressionContext:"cluster-map"})),e.push(...gy({key:`${b}.${g}.reduce`,value:k,expressionContext:"cluster-reduce"}))}return e;case"video":return cR({key:b,value:a,valueSpec:c.source_video,style:f,styleSpec:c});case"image":return cR({key:b,value:a,valueSpec:c.source_image,style:f,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:f,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=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=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=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,c,d){const e=a.now||0,b=this.value.possiblyEvaluate(a,c,d),f=this.prior;if(f){if(e>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(ed.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=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 dC(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}function h7(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((180+a.lng)/360,dA(a.lat),dB(c,a.lat))}toLngLat(){return new dy(360*this.x-180,dC(this.y))}toAltitude(){return h7(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/h5*(1/Math.cos(dC(this.y)*Math.PI/180))}}function h8(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?(h8(c,i,j,g,h,d,a,e,f),h8(c,g,h,k,l,a,b,e,f)):c.push(b)}function h9(i,d,j){const b=[];let e,f,c;for(const a of i){const{x:g,y:h}=a;d(a),c?h8(b,e,f,g,h,c,a,d,j):b.push(a),e=g,f=h,c=a}return b}function ia(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 ib(d,g,e){const a=d.loadGeometry(),f=d.extent,j=8192/f;if(g&&e&&e.projection.isReprojectedInTileSpace){const m=1<{const c=360*((g.x+a.x/f)/m)-180,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)ia(l,j);return a}function ic(a,b){return{type:a.type,id:a.id,properties:a.properties,geometry:b?ib(a):[]}}function id(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=ic(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:ib(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;id(this.layoutVertexArray,a,b,-1,-1),id(this.layoutVertexArray,a,b,1,-1),id(this.layoutVertexArray,a,b,1,1),id(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(ii(a,b))return!0;for(let c=0;c1?b:b.sub(a)._mult(d)._add(a))}function im(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 io(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(io(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 iq(a,b,d){const c=b.paint.get(a).value;return"constant"===c.kind?c.value:d.programConfigurations.get(b.id).getMaxValue(a)}function ir(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function is(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 iv(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:iw(e,j,g),p=a?b.tilespaceRays.map(a=>iz(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]),ie(p,o,d))return!0}return!1}function iw(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 ix=Q(0,0,0),iy=Q(0,0,1);function iz(b,c){const a=aK();return ix[2]=c,b.intersectsPlane(ix,iy,a),new aF(a[0],a[1])}class dI extends bf{}function iA(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 iB(a,{width:b,height:c},d){if(b===a.width&&c===a.height)return;const e=iA({},{width:b,height:c},d);iC(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 iC(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 iI(c,m,a,d,e,k),m}function iG(c,e,f,d,g){var a,b;if(g===i0(c,e,f,d)>0)for(a=e;a=e;a-=d)b=iZ(a,c[a],c[a+1],b);return b&&iT(b,b.next)&&(i$(b),b=b.next),b}function iH(c,b){if(!c)return c;b||(b=c);var d,a=c;do if(d=!1,a.steiner|| !iT(a,a.next)&&0!==iS(a.prev,a,a.next))a=a.next;else{if(i$(a),(a=b=a.prev)===a.next)break;d=!0}while(d||a!==b)return b}function iI(a,b,c,e,f,d,h){if(a){!h&&d&&function(e,h,i,j){var b,c,f,g,d,a=e;do null===a.z&&(a.z=(b=a.x,c=a.y,f=h,g=i,d=j,(b=1431655765&((b=858993459&((b=252645135&((b=16711935&((b=32767*(b-f)*d)|b<<8))|b<<4))|b<<2))|b<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=32767*(c-g)*d)|c<<8))|c<<4))|c<<2))|c<<1))<<1)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==e)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?iK(a,e,f,d):iJ(a))b.push(i.i/c),b.push(a.i/c),b.push(g.i/c),i$(a),a=g.next,j=g.next;else if((a=g)===j){h?1===h?iI(a=iL(iH(a),b,c),b,c,e,f,d,2):2===h&&iM(a,b,c,e,f,d):iI(iH(a),b,c,e,f,d,1);break}}}function iJ(d){var e,f,g,h,i,j,b,c,k=d.prev,l=d,m=d.next;if(iS(k,l,m)>=0)return!1;for(var a=d.next.next;a!==d.prev;){if(e=k.x,f=k.y,g=l.x,h=l.y,i=m.x,j=m.y,b=a.x,c=a.y,(i-b)*(f-c)-(e-b)*(j-c)>=0&&(e-b)*(h-c)-(g-b)*(f-c)>=0&&(g-b)*(j-c)-(i-b)*(h-c)>=0&&iS(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function iK(f,R,S,T){var g,h,U,V,s,i,j,W,X,Y,t,u,v,w,x,y,k,l,z,A,B,C,D,E,m,n,F,G,H,I,J,K,o,p,L,M,N,O,P,Q,q,r,d=f.prev,e=f,a=f.next;if(iS(d,e,a)>=0)return!1;for(var _=d.x>e.x?d.x>a.x?d.x:a.x:e.x>a.x?e.x:a.x,aa=d.y>e.y?d.y>a.y?d.y:a.y:e.y>a.y?e.y:a.y,Z=(g=d.x=Z&&c&&c.z<=$;){if(b!==f.prev&&b!==f.next&&(t=d.x,u=d.y,v=e.x,w=e.y,x=a.x,y=a.y,k=b.x,l=b.y,(x-k)*(u-l)-(t-k)*(y-l)>=0&&(t-k)*(w-l)-(v-k)*(u-l)>=0&&(v-k)*(y-l)-(x-k)*(w-l)>=0)&&iS(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,c!==f.prev&&c!==f.next&&(z=d.x,A=d.y,B=e.x,C=e.y,D=a.x,E=a.y,m=c.x,n=c.y,(D-m)*(A-n)-(z-m)*(E-n)>=0&&(z-m)*(C-n)-(B-m)*(A-n)>=0&&(B-m)*(E-n)-(D-m)*(C-n)>=0)&&iS(c.prev,c,c.next)>=0)return!1;c=c.nextZ}for(;b&&b.z>=Z;){if(b!==f.prev&&b!==f.next&&(F=d.x,G=d.y,H=e.x,I=e.y,J=a.x,K=a.y,o=b.x,p=b.y,(J-o)*(G-p)-(F-o)*(K-p)>=0&&(F-o)*(I-p)-(H-o)*(G-p)>=0&&(H-o)*(K-p)-(J-o)*(I-p)>=0)&&iS(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;c&&c.z<=$;){if(c!==f.prev&&c!==f.next&&(L=d.x,M=d.y,N=e.x,O=e.y,P=a.x,Q=a.y,q=c.x,r=c.y,(P-q)*(M-r)-(L-q)*(Q-r)>=0&&(L-q)*(O-r)-(N-q)*(M-r)>=0&&(N-q)*(Q-r)-(P-q)*(O-r)>=0)&&iS(c.prev,c,c.next)>=0)return!1;c=c.nextZ}return!0}function iL(d,e,f){var a=d;do{var c=a.prev,b=a.next.next;!iT(c,b)&&iU(c,a,a.next,b)&&iX(c,b)&&iX(b,c)&&(e.push(c.i/f),e.push(a.i/f),e.push(b.i/f),i$(a),i$(a.next),a=d=b),a=a.next}while(a!==d)return iH(a)}function iM(d,e,f,g,h,i){var a=d;do{for(var b=a.next.next;b!==a.prev;){if(a.i!==b.i&&iR(a,b)){var c=iY(a,b);return a=iH(a,a.next),c=iH(c,c.next),iI(a,e,f,g,h,i),void iI(c,e,f,g,h,i)}b=b.next}a=a.next}while(a!==d)}function iN(a,b){return a.x-b.x}function iO(c,b){var a=function(j,s){var k,l,m,n,o,p,e,f,b,a=s,d=j.x,c=j.y,g=-1/0;do{if(c<=a.y&&c>=a.next.y&&a.next.y!==a.y){var h=a.x+(c-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(h<=d&&h>g){if(g=h,h===d){if(c===a.y)return a;if(c===a.next.y)return a.next}b=a.x=a.x&&a.x>=t&&d!==a.x&&(k=c=0&&(k-e)*(n-f)-(m-e)*(l-f)>=0&&(m-e)*(p-f)-(o-e)*(n-f)>=0)&&(i=Math.abs(c-a.y)/(d-a.x),iX(a,j)&&(ib.x||a.x===b.x&&iP(b,a)))&&(b=a,r=i)),a=a.next;while(a!==u)return b}(c,b);if(!a)return b;var d=iY(a,c),e=iH(a,a.next);return iH(d,d.next),b===a?e:b}function iP(a,b){return 0>iS(a.prev,a,b.prev)&&0>iS(b.next,a,a.next)}function iQ(c){var a=c,b=c;do(a.xd!=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)&&(iS(a.prev,a,b.prev)||iS(a,b.prev,b))||iT(a,b)&&iS(a.prev,a,a.next)>0&&iS(b.prev,b,b.next)>0)}function iS(b,a,c){return(a.y-b.y)*(c.x-a.x)-(a.x-b.x)*(c.y-a.y)}function iT(a,b){return a.x===b.x&&a.y===b.y}function iU(a,b,c,d){var e=iW(iS(a,b,c)),f=iW(iS(a,b,d)),g=iW(iS(c,d,a)),h=iW(iS(c,d,b));return e!==f&&g!==h||!(0!==e||!iV(a,c,b))||!(0!==f||!iV(a,d,b))||!(0!==g||!iV(c,a,d))||!(0!==h||!iV(c,b,d))}function iV(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 iW(a){return a>0?1:a<0?-1:0}function iX(a,b){return 0>iS(a.prev,a,a.next)?iS(a,b,a.next)>=0&&iS(a,a.prev,b)>=0:0>iS(a,b,a.prev)||0>iS(a,a.next,b)}function iY(a,b){var d=new i_(a.i,a.x,a.y),c=new i_(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 iZ(c,d,e,b){var a=new i_(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 i$(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 i_(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 i0(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);i2(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(i3(a,b,e),g(a[d],j)>0&&i3(a,b,d);hg(a[h],j);)h++;for(;g(a[c],j)>0;)c--}0===g(a[b],j)?i3(a,b,c):i3(a,++c,d),c<=e&&(b=c+1),e<=c&&(d=c-1)}}function i3(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function i4(a,b){return ab?1:0}function i5(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=i7("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=ic(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:ib(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=i8("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,iF),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 i5(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 jf(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(jf,{},b)},VectorTileFeature:dQ,VectorTileLayer:dR};const jg=_.VectorTileFeature.types;function jh(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){var c,d,e,f,g,h,i,j,k,l,m,n;a.x<0!=b.x<0&&this.addBorderIntersection(0,(c=a.y,d=b.y,c*(1-(e=(0-a.x)/(b.x-a.x)))+d*e)),a.x>8192!=b.x>8192&&this.addBorderIntersection(1,(f=a.y,g=b.y,f*(1-(h=(8192-a.x)/(b.x-a.x)))+g*h)),a.y<0!=b.y<0&&this.addBorderIntersection(2,(i=a.x,j=b.x,i*(1-(k=(0-a.y)/(b.y-a.y)))+j*k)),a.y>8192!=b.y>8192&&this.addBorderIntersection(3,(l=a.x,m=b.x,l*(1-(n=(8192-a.y)/(b.y-a.y)))+m*n))}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=i7("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(!ji(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),jh(this.layoutVertexArray,c.x,c.y,o,p,0,0,f),jh(this.layoutVertexArray,c.x,c.y,o,p,0,1,f),f+=z,jh(this.layoutVertexArray,d.x,d.y,o,p,0,0,f),jh(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"!==jg[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 jj={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 jk(a,b){return a.x*b.x+a.y*b.y}function jl(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=i7("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=ic(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:ib(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=i8("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,jp)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,jo),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 js(a,b){return b>0?b+2*a:a}d$.useIntegerZoom=!0;const jt=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),ju=j([{name:"a_projected_pos",components:3,type:"Float32"}],4);j([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const jv=j([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),jw=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 jx=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 jz={"!":"\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"};var jA=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)},jB=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 jC="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function jD(a){return a.type===P.Bytes?a.readVarint()+a.pos:a.pos+1}function jE(a,b,c){return c?4294967296*b+(a>>>0):4294967296*(b>>>0)+(a>>>0)}function jF(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 jG(b,c){for(var a=0;a>>8,a[c+2]=b>>>16,a[c+3]=b>>>24}function jR(a,b){return(a[b]|a[b+1]<<8|a[b+2]<<16)+(a[b+3]<<24)}function jS(b,a,c){a.glyphs=[],1===b&&c.readMessage(jT,a)}function jT(a,b,c){if(3===a){const{id:f,bitmap:g,width:d,height:e,left:h,top:i,advance:j}=c.readMessage(jU,{});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 jU(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=jP(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=jR(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=jP(this.buf,this.pos)+4294967296*jP(this.buf,this.pos+4);return this.pos+=8,a},readSFixed64:function(){var a=jP(this.buf,this.pos)+4294967296*jR(this.buf,this.pos+4);return this.pos+=8,a},readFloat:function(){var a=jA(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=jA(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(d,e,c){var a,b,f=c.buf;if(a=(112&(b=f[c.pos++]))>>4,b<128)return jE(d,a,e);if(a|=(127&(b=f[c.pos++]))<<3,b<128)return jE(d,a,e);if(a|=(127&(b=f[c.pos++]))<<10,b<128)return jE(d,a,e);if(a|=(127&(b=f[c.pos++]))<<17,b<128)return jE(d,a,e);if(a|=(127&(b=f[c.pos++]))<<24,b<128)return jE(d,a,e);if(a|=(1&(b=f[c.pos++]))<<31,b<128)return jE(d,a,e);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&&jC?(c=this.buf,d=b,e=a,jC.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=jD(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>=0x7fffffffffffffff||e< 0x8000000000000000)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&&jF(c,b,this),this.pos=c-1,this.writeVarint(b),this.pos+=b},writeFloat:function(a){this.realloc(4),jB(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),jB(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&&jF(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,jG,a)},writePackedSVarint:function(b,a){a.length&&this.writeMessage(b,jH,a)},writePackedBoolean:function(b,a){a.length&&this.writeMessage(b,jK,a)},writePackedFloat:function(b,a){a.length&&this.writeMessage(b,jI,a)},writePackedDouble:function(b,a){a.length&&this.writeMessage(b,jJ,a)},writePackedFixed32:function(b,a){a.length&&this.writeMessage(b,jL,a)},writePackedSFixed32:function(b,a){a.length&&this.writeMessage(b,jM,a)},writePackedFixed64:function(b,a){a.length&&this.writeMessage(b,jN,a)},writePackedSFixed64:function(b,a){a.length&&this.writeMessage(b,jO,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)return;if(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 jV{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(b,c){const a=new jV;return a.scale=b||1,a.fontStack=c,a}static forImage(b){const a=new jV;return a.imageName=b,a}}class jW{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(d,e){const a=new jW;for(let b=0;b=0&&b>=a&&jY[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 jW;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(jV.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 jX(u,c,v,d,w,i,x,y,z,e,f,j,m,k,l,A){const a=jW.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(),j3(a,e,i,c,d,k,l));for(const p of B){const g=new jW;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 j8(b){let c=0;for(let a=0;aj){var k,l,m,n,o,p;const q=(j-e)/f,w=(k=c.x,l=d.x,k*(1-(m=q))+l*m),x=(n=c.y,o=d.y,n*(1-(p=q))+o*p),r=new d7(w,x,0,d.angleTo(c),b);return!i||j7(a,r,v,i,s)?r:void 0}e+=f}}function kc(b,a,k,f,l,g,c,h,d){const m=j9(f,g,c),i=ka(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<=B){const o=new d7(m,n,0,C,c);o._round(),i&&!j7(a,o,j,i,p)||f.push(o)}}e+=l}return A||f.length||q||(f=kd(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 ke(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 kg(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=kh(d,0,a[0]),u=kh(e,0,a[1]),t=kh(d,a[0],a[2]),v=kh(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=ki(d,q,k),n=ki(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(jS,{}));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}}ke(g,0,0,d,m,d,this.f,this.v,this.z),ke(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 kl(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 kk([],km);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 kn(b.p.x-a,b.p.y-a,a,e)),d.push(new kn(b.p.x+a,b.p.y-a,a,e)),d.push(new kn(b.p.x-a,b.p.y+a,a,e)),d.push(new kn(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 km(a,b){return b.max-a.max}function kn(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,il(b,a,c))}}return(d?1:-1)*Math.sqrt(e)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}const ko=Number.POSITIVE_INFINITY,kp=Math.sqrt(2);function ea(b,a){return a[1]!==ko?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/kp;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 kq(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,ko]):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=jX(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=jX(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=j5(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=ku(f.horizontal)||f.vertical;a.iconsInText||(a.iconsInText=!!v&&v.iconsInText),(v||q)&&kr(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 kr(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=ku(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=j6(f,e.vertical,j,a.get("icon-text-fit-padding"),o,p)),g&&(f=j6(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=ko),a.allowVerticalPlacement&&h.vertical){const V=h.vertical;if(u)O=kw(V),j&&(P=kw(j));else{const W=f.layout.get("text-rotate").evaluate(b,{},c)+90;o=kv(r,e,d,m,s,t,V,I,W,v),j&&(y=kv(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=kg(z,E,M,X),F=j?kg(j,E,M,X):void 0;n=kv(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]>ks&&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]>ks||p[1]>ks)&&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=kw(q):l=kv(r,e,d,m,s,t,q,I,f.layout.get("text-rotate").evaluate(b,{},c),v));const _=1===q.positionedLines.length;if(S+=kt(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+=kt(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=kc(u,r,s,e.vertical||g,f,24,q,c.overscaling,8192);for(const v of D){const w=g;w&&kx(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=kb(k,s,e.vertical||g,f,24,q);x&&h(k,x,d)}}else if("Polygon"===b.type)for(const y of i5(b.geometry,0)){const z=kl(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 ks=32640;function kt(a,l,m,n,o,e,f,b,g,h,p,q,r,s,i,t,c){const j=function(_,d,i,O,n,P,Q,D){const u=[];if(0===d.positionedLines.length)return u;const j=O.layout.get("text-rotate").evaluate(P,{})*Math.PI/180,o=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]}(i);let E=Math.abs(d.top-d.bottom);for(const R of d.positionedLines)E-=R.lineOffset;const F=d.positionedLines.length,S=E/F;let v=d.top-i[1];for(let p=0;pks&&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]>ks||d[1]>ks)&&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 ku(a){for(const b in a)return a[b];return null}function kv(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 kw(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 kx(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=ic(h,s);if(!d._featureFilter.filter(y,a,c))continue;let e,f;if(s||(a.geometry=ib(h,c,w)),n){const C=d.getValueAndResolveTokens("text-field",a,c,r),t=fB.factory(C);kB(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===c3()||this.hasRTLText&&c4.isParsed())&&(e=jy(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:ky[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 kC={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,kC)}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 kC.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=kC.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 kD={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"])})},kE={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 kF 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 kG={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 kH(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 kI={circle:class extends be{constructor(a){super(a,iu)}createBucket(a){return new bf(a)}queryRadius(b){const a=b;return iq("circle-radius",this,a)+iq("circle-stroke-width",this,a)+ir(this.paint.get("circle-translate"))}queryIntersectsFeature(a,b,c,e,j,d,f,g){const h=it(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 iv(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,iD),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 iq("heatmap-radius",this,a)}queryIntersectsFeature(a,b,c,d,i,e,f,g){const h=this.paint.get("heatmap-radius").evaluate(b,c);return iv(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,iE)}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,i9)}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 ir(this.paint.get("fill-translate"))}queryIntersectsFeature(a,d,e,b,f,c){return!a.queryGeometry.isAboveHorizon&&ig(is(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,jj)}createBucket(a){return new dU(a)}queryRadius(){return ir(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=it(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 kQ(this.wrap*+b,a,this.canonical.z,this.canonical.x,this.canonical.y);{const c=this.canonical.z-a;return kQ(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 kV(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 kW(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 kT(b);const a=[];for(let g=0;g=1;b/=2){const d=f[f.length-1];c=new kT(b);for(let h=0;h0;){const{idx:u,t:B,nodex:g,nodey:h,depth:j}=t.pop();if(this.leaves[u]){kW(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)return!1;if(!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(k$).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(k$).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,o,p){var h;if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!p)return;let a;this.updateCacheSize(e,o),"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:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!p,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(("raster"===(h=this._source.type)||"image"===h||"video"===h)&&0!==a.length){const i={},q={},t=Object.keys(b);for(const j of t){const k=b[j],l=this._tiles[j];if(!l||l.fadeEndTime&&l.fadeEndTime<=b$.now())continue;const f=this.findLoadedParent(k,Math.max(k.overscaledZ-aD.maxOverzooming,this._source.minzoom));f&&(this._addTile(f.tileID),i[f.tileID.key]=f.tileID),q[j]=k}const u=a[a.length-1].overscaledZ;for(const m in this._tiles){const n=this._tiles[m];if(b[m]||!n.hasData())continue;let c=n.tileID;for(;c.overscaledZ>u;){c=c.scaledTo(c.overscaledZ-1);const r=this._tiles[c.key];if(r&&r.hasData()&&q[c.key]){b[m]=n.tileID;break}}}for(const g in i)b[g]||(this._coveredTiles[g]=!0,b[g]=i[g])}for(const v in b)this._tiles[v].clearFadeHold();const w=function(c,d){const a=[];for(const b in c)b in d||a.push(b);return a}(this._tiles,b);for(const s of w){const d=this._tiles[s];d.hasSymbolBuckets&&!d.holdingForFade()?d.setHoldDuration(this.map._fadeDuration):d.hasSymbolBuckets&&!d.symbolFadeFinished()||this._removeTile(+s)}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])break;if(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(){var a;if(this._source.hasTransition())return!0;if("raster"===(a=this._source.type)||"image"===a||"video"===a)for(const c in this._tiles){const b=this._tiles[c];if(void 0!==b.fadeEndTime&&b.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 k$(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}aD.maxOverzooming=10,aD.maxUnderzooming=3;class k_{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 kR(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(k1);let o=null;g.elevation&&b.length>0&&(o=k_.create(g.elevation,this.tileID));const h={};let i;for(let e=0;e(q||(q=ib(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=ic(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=k0(d.paint,c.paint,a,f,m),d.layout=k0(d.layout,c.layout,a,f,m);const r=!o||o(a,c,f,y);if(!r)continue;const s=new kS(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 k0(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 k1(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 k2=new Uint16Array(2178),k3=new Uint8Array(1089),k4=new Uint16Array(1089);function k5(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 k6={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=eM++,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((k2[2*t+0]+k2[2*u+0])/2-k2[2*a+0],(k2[2*t+1]+k2[2*u+1])/2-k2[2*a+1])>=16;if(k3[a]=k3[a]||(y?1:0),f<1022){const z=(i+s>>1)*33+(h+r>>1),A=(k+s>>1)*33+(j+r>>1);k3[a]=k3[a]||k3[z]||k3[A]}}const B=new am,C=new aq;let D=0;function E(b,c){const a=33*c+b;return 0===k4[a]&&(B.emplaceBack(k2[2*a+0],k2[2*a+1],8192*b/32,8192*c/32),k4[a]=++D),k4[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&&k3[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){var w,x;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 lf{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 kR(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)continue;if(!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&&(lg(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?(lg(a.layers,this.zoom,i),kq(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)&&(lg(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 lg(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 lh=aI(new Float64Array(16));class li{constructor(a,b){this._tr=a,this._worldSize=b}createInversionMatrix(){return lh}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 k9(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new li(a,b)};const lj=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(lj*Math.sin(d)),a=b*b,e=a*a*a;return{x:.5*(c*Math.cos(b)/(lj*(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=bM(180*(lj*d*(1.340264+ -0.24331799999999998*a+c*(.0062510000000000005+.034164*a))/Math.cos(b))/Math.PI,-180,180),k=bM(180*Math.asin(Math.sin(b)/lj)/Math.PI,-85.051129,85.051129);return new dy(j,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 k9(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new li(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 k9(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new li(a,b)};const lk=Math.PI/2;function ll(a){return Math.tan((lk+a)/2)}var lm,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(ll(b)/ll(a)),e=d*Math.pow(ll(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< -lk+1e-6&&(a=-lk+1e-6):a>lk-1e-6&&(a=lk-1e-6);const e=d/Math.pow(ll(a),c);return{x:.5*(e*Math.sin(c*b)/Math.PI+.5),y:1-.5*((d-e*Math.cos(c*b))/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))-lk)*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 k9(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new li(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:(180+a)/360,y:dA(b),z:0}),unproject(a,b){const c=dC(b);return new dy(360*a-180,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 k9(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new li(a,b)};const ln=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-.005916*11*c))),b=bM(b-f,-ln,ln)}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);return new dy(h,b*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 k9(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new li(a,b)};const lo=85.051129*aP,lp={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;return{x:.5*((.5*(a*(2/Math.PI)+2*c*Math.sin(a/2)/e)||0)/Math.PI+.5),y:1-.5*((.5*(b+Math.sin(b)/e)||0)/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,-lo,lo)}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 k9(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new li(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);if(0===d){bZ();try{b()}finally{}return{cancel(){}}}return 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();try{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()}finally{}}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,e,x=!0){var l,m,g,n,o,h,p,q,i;null==e&&(e=null);const r=this._source();if(!r)return e;if(a.y<0||a.y>1)return e;const j=r.getSource().maxzoom,s=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=k_.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 lf(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((180+a.center.lng)/360*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 kF(a):new kI[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}=lp.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,h7(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),a.writeVarint((m=o)<<1^m>>31),h+=n,i+=o}3===d&&a.writeVarint(15)}}function z(a,b){var c=typeof a;"string"===c?b.writeStringField(1,a):"boolean"===c?b.writeBooleanField(7,a):"number"===c&&(a%1!=0?b.writeDoubleField(3,a):a<0?b.writeSVarintField(6,a):b.writeVarintField(5,a))}function A(c,d,e,a,b,f){if(b-a<=e)return;const g=a+b>>1;B(c,d,g,a,b,f%2),A(c,d,e,a,g-1,f+1),A(c,d,e,g+1,b,f+1)}function B(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);B(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(C(g,a,b,e),a[2*d+h]>k&&C(g,a,b,d);ik;)c--}a[2*b+h]===k?C(g,a,b,c):C(g,a,++c,d),c<=e&&(b=c+1),e<=c&&(d=c-1)}}function C(d,c,a,b){D(d,a,b),D(c,2*a,2*b),D(c,2*a+1,2*b+1)}function D(a,b,c){const d=a[b];a[b]=a[c],a[c]=d}function E(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 F{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++)E(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];E(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 G=Math.fround||(f=new Float32Array(1),a=>(f[0]=+a,f[0]));class H{constructor(a){this.options=O(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 F(a,P,Q,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(b/360+.5,M(f),c/360+.5,M(e)),i=[];for(const m of l){const g=h.points[m];i.push(g.numPoints?K(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?K(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(I(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?O({},a.properties):a.properties;const d=this.points[a.index].properties,b=this.options.map(d);return c&&b===d?O({},b):b}}function I(a,b,c,d,e){return{x:G(a),y:G(b),zoom:1/0,id:c,parentId:-1,numPoints:d,properties:e}}function J(a,b){const[c,d]=a.geometry.coordinates;return{x:G(c/360+.5),y:G(M(d)),zoom:1/0,index:b,parentId:-1}}function K(a){return{type:"Feature",id:a.id,properties:L(a),geometry:{type:"Point",coordinates:[360*(a.x-.5),N(a.y)]}}}function L(b){const a=b.numPoints,c=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a;return O(O({},b.properties),{cluster:!0,cluster_id:b.id,point_count:a,point_count_abbreviated:c})}function M(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 N(a){return 360*Math.atan(Math.exp((180-360*a)*Math.PI/180))/Math.PI-90}function O(a,b){for(const c in b)a[c]=b[c];return a}function P(a){return a.x}function Q(a){return a.y}function R(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&&R(a,b,d,g),a[d+2]=f,c-d>3&&R(a,d,c,g))}function S(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 T(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)U(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,R(a,0,i,j),a[i+2]=1,a.size=Math.abs(h),a.start=0,a.end=a.size}function Y(b,d,e,f){for(var a=0;a1?1:a}function $(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)_(h,b,e,d,f);else if("LineString"===a)aa(h,b,e,d,f,!1,p.lineMetrics);else if("MultiLineString"===a)ac(h,b,e,d,f,!1);else if("Polygon"===a)ac(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 aa(b,u,e,f,o,v,m){for(var n,g,a=ab(b),p=0===o?ae:af,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=ab(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&&ad(a,c,d,s),i=a.length-3,v&&i>=3&&(a[i]!==a[0]||a[i+1]!==a[1])&&ad(a,a[0],a[1],a[2]),a.length&&u.push(a)}function ab(b){var a=[];return a.size=b.size,a.start=b.start,a.end=b.end,a}function ac(b,c,d,e,f,g){for(var a=0;aa.maxX&&(a.maxX=h),i>a.maxY&&(a.maxY=i)}return a}function al(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]=ak(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 z,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=$(g,h,d-i,d+s,0,a.minX,a.maxX,e),l=$(g,h,d+r,d+t,0,a.minX,a.maxX,e),g=null,k&&(n=$(k,h,b-i,b+s,1,a.minY,a.maxY,e),o=$(k,h,b+r,b+t,1,a.minY,a.maxY,e),k=null),l&&(p=$(l,h,b-i,b+s,1,a.minY,a.maxY,e),q=$(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,l=this.options,m=l.extent,h=l.debug;if(a<0||a>24)return null;var n,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[32*((1<<(k=d))*f+e)+k];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]?ai(this.tiles[i],m):null):null};class an 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 H(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:an},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){"use strict";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=100*b|0;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=100*b|0;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(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 ab{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 ab(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 ac;function ad(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 g=Math.max(0,Math.floor(-Math.log(Math.max(d-b,e-c))/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=ad(0,0,c,0,0,d,c,d),b=ad(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 ae={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=aa(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 ab(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==ac&&(ac=a.window.OffscreenCanvas&&new a.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.window.createImageBitmap),ac),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())return;if(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}}},af=function(c,d,e,f){const b=new ae[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 ag(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 ah(b,g,h,i,j,k,l,d=!1){const e=b.tilesIn(i,l,d);e.sort(aj);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,ag(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 ai(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[al]}numActive(){return Object.keys(this.active).length}}let am;function an(){return am||(am=new e),am}function ao(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 ap(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 ay{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 az=Math.tan(85*Math.PI/180);function aA(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 aB(g,j,h,i,f,b){if(h){if("globe"===f.projection.name){const c=aA(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 aC(d,e,f=0){const b=[d.x,d.y,f,1];f?a.transformMat4$1(b,b,e):aO(b,b,e);const c=b[3];return{point:new a.pointGeometry(b[0]/c,b[1]/c),signedDistanceFromCamera:c}}function aD(a,b){return Math.min(.5+a/b*.5,1.5)}function aE(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 aF(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.yaz}(b,c,e)?1===d.flipState?{needsFlipping:!0}:null:b.x>c.x?{needsFlipping:!0}:null}function aI(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=aG(f,o,s,t,c,p,e,b,d,n,q,r,!1,i,j);if(!h)return{notEnoughRoom:!0};const J=aC(h.first.point,w).point,K=aC(h.last.point,w).point;if(v&&!c){const k=aH(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:aK(e,A,y,1,m,void 0,i,j.canonical),x);if(b.flipState=l&&l.needsFlipping?1:2,l)return l}const C=aL(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 aJ(c,g,e,h,f){const b=h.projectTilePoint(c.x,c.y,g);if(!f)return aC(b,e,b.z);const d=f(c);return aC(new a.pointGeometry(b.x+d[0],b.y+d[1]),e,b.z+d[2])}function aK(a,d,b,e,f,g,h,i){const j=aJ(a.add(a.sub(d)._unit()),i,f,h,g).point,c=b.sub(j);return b.add(c._mult(e/c.mag()))}function aL(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=()=>aK(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=aJ(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 aM=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function aN(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,_=aC(new a.pointGeometry(g[0],g[1]),E,g[2]).point,w=t.signedDistanceFromCamera>0?aG(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 ax,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(aaC(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 aO(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=aA(f,b.tileID.canonical,g,k,this.transform,m);let n=null;if(g){const w=aB(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 aT(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=aU(d,g,h,p,e),q=this.collisionIndex.placeCollisionBox(e,s,aV(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,aV(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 aR(!1,!1,!1,!0),void(t[d.crossTileID]=!0)}if(t[d.crossTileID])return;if(y)return void(this.placements[d.crossTileID]=new aR(!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?aV(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 aS);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 aQ(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 aQ(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 aQ(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 aQ(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 aQ(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=aX(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=aX(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=aU(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&&aW(b.textCollisionBox.collisionVertexArray,d.text.placed,!k||p,e.x,e.y),g.verticalTextBox&&aW(b.textCollisionBox.collisionVertexArray,d.text.placed,!k||j,e.x,e.y)}const E=k&&Boolean(!j&&g.verticalIconBox);g.iconBox&&aW(b.iconCollisionBox.collisionVertexArray,d.icon.placed,E,l?e.x:0,l?e.y:0),g.verticalIconBox&&aW(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 aY(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 a_{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 a2=(c,b)=>a.emitValidationErrors(c,b&&b.filter(a=>"source.canvas"!==a.identifier)),a3=a.pick(i,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),a4=a.pick(i,["setCenter","setZoom","setBearing","setPitch"]),a5=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}(),a6={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(an(),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 a1,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(a5,!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&&a2(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=ap(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)return!1;if(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())return!0;if(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&&a6[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(),a2(this,a.validateStyle(b)))return!1;(b=a.clone$1(b)).layers=ap(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)||ar(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&&at(c,b,a)?d.push({command:i.setGeoJSONSourceData,args:[a,b[a].data]}):as(a,b,d,e)):aq(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(av),j=k.map(av),p=m.reduce(aw,{}),o=k.reduce(aw,{}),g=n.slice(),q=Object.create(null);let e,h,b,d,c,l,a;for(e=0,h=0;e!(a.command in a4));if(0===c.length)return!1;const d=c.filter(a=>!(a.command in a3));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=af(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(a2(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(ah(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(aj),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(ai(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)&&a2(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 aZ(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 ae[a]},c.setSourceType=function(a,b){ae[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=ba("","\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=ba("#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 a7=ba("\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."),a8=t;var a9={background:ba("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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("#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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("#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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("#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:ba("#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:ba("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:ba("#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:ba("\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:ba("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:ba("\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:ba("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:ba("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 ba(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?` +Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(l[1])} }\`.`)];const k=[];return"symbol"===b.layerType&&("text-field"===c&&e&&!e.glyphs&&k.push(new cc(d,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===c&&gn(fq(a))&&"identity"===fp(a.type)&&k.push(new cc(d,a,'"text-font" does not support identity functions'))),k.concat(gR({key:b.key,value:a,valueSpec:h,style:e,styleSpec:f,expressionContext:"property",propertyType:i,propertyKey:c}))}function cW(a){return gO(a,"paint")}function cX(a){return gO(a,"layout")}function a0(d){let b=[];const a=d.value,c=d.key,g=d.style,l=d.styleSpec;a.type||a.ref||b.push(new cc(c,a,'either "type" or "ref" is required'));let e=fp(a.type);const m=fp(a.ref);if(a.id){const n=fp(a.id);for(let i=0;i{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,f=d.style;if(!a.type)return[new cc(b,a,'"type" is required')];const i=fp(a.type);let e;switch(i){case"vector":case"raster":case"raster-dem":return e=cR({key:b,value:a,valueSpec:c[`source_${i.replace("-","_")}`],style:d.style,styleSpec:c,objectElementValidators:gP});case"geojson":if(e=cR({key:b,value:a,valueSpec:c.source_geojson,style:f,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;e.push(...gy({key:`${b}.${g}.map`,value:j,expressionContext:"cluster-map"})),e.push(...gy({key:`${b}.${g}.reduce`,value:k,expressionContext:"cluster-reduce"}))}return e;case"video":return cR({key:b,value:a,valueSpec:c.source_video,style:f,styleSpec:c});case"image":return cR({key:b,value:a,valueSpec:c.source_image,style:f,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:f,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=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=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=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 dC(a){return 360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90}function h7(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((180+a.lng)/360,dA(a.lat),dB(c,a.lat))}toLngLat(){return new dy(360*this.x-180,dC(this.y))}toAltitude(){return h7(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/h5*(1/Math.cos(dC(this.y)*Math.PI/180))}}function h8(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?(h8(c,i,j,g,h,d,a,e,f),h8(c,g,h,k,l,a,b,e,f)):c.push(b)}function h9(i,d,j){const b=[];let e,f,c;for(const a of i){const{x:g,y:h}=a;d(a),c?h8(b,e,f,g,h,c,a,d,j):b.push(a),e=g,f=h,c=a}return b}function ia(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 ib(d,g,e){const a=d.loadGeometry(),f=d.extent,j=8192/f;if(g&&e&&e.projection.isReprojectedInTileSpace){const m=1<{const c=360*((g.x+a.x/f)/m)-180,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)ia(l,j);return a}function ic(a,b){return{type:a.type,id:a.id,properties:a.properties,geometry:b?ib(a):[]}}function id(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=ic(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:ib(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;id(this.layoutVertexArray,a,b,-1,-1),id(this.layoutVertexArray,a,b,1,-1),id(this.layoutVertexArray,a,b,1,1),id(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(ii(a,b))return!0;for(let c=0;c1?b:b.sub(a)._mult(d)._add(a))}function im(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 io(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(io(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 iq(a,b,d){const c=b.paint.get(a).value;return"constant"===c.kind?c.value:d.programConfigurations.get(b.id).getMaxValue(a)}function ir(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])}function is(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 iv(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:iw(e,j,g),p=a?b.tilespaceRays.map(a=>iz(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]),ie(p,o,d))return!0}return!1}function iw(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 ix=Q(0,0,0),iy=Q(0,0,1);function iz(b,c){const a=aK();return ix[2]=c,b.intersectsPlane(ix,iy,a),new aF(a[0],a[1])}class dI extends bf{}function iA(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 iB(a,{width:b,height:c},d){if(b===a.width&&c===a.height)return;const e=iA({},{width:b,height:c},d);iC(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 iC(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 iI(c,m,a,d,e,k),m}function iG(c,e,f,d,g){var a,b;if(g===i0(c,e,f,d)>0)for(a=e;a=e;a-=d)b=iZ(a,c[a],c[a+1],b);return b&&iT(b,b.next)&&(i$(b),b=b.next),b}function iH(c,b){if(!c)return c;b||(b=c);var d,a=c;do if(d=!1,a.steiner|| !iT(a,a.next)&&0!==iS(a.prev,a,a.next))a=a.next;else{if(i$(a),(a=b=a.prev)===a.next)break;d=!0}while(d||a!==b)return b}function iI(a,b,c,e,f,d,h){if(a){!h&&d&&function(e,h,i,j){var b,c,f,g,d,a=e;do null===a.z&&(a.z=(b=a.x,c=a.y,f=h,g=i,d=j,(b=1431655765&((b=858993459&((b=252645135&((b=16711935&((b=32767*(b-f)*d)|b<<8))|b<<4))|b<<2))|b<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=32767*(c-g)*d)|c<<8))|c<<4))|c<<2))|c<<1))<<1)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==e)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?iK(a,e,f,d):iJ(a))b.push(i.i/c),b.push(a.i/c),b.push(g.i/c),i$(a),a=g.next,j=g.next;else if((a=g)===j){h?1===h?iI(a=iL(iH(a),b,c),b,c,e,f,d,2):2===h&&iM(a,b,c,e,f,d):iI(iH(a),b,c,e,f,d,1);break}}}function iJ(d){var e,f,g,h,i,j,b,c,k=d.prev,l=d,m=d.next;if(iS(k,l,m)>=0)return!1;for(var a=d.next.next;a!==d.prev;){if(e=k.x,f=k.y,g=l.x,h=l.y,i=m.x,j=m.y,b=a.x,c=a.y,(i-b)*(f-c)-(e-b)*(j-c)>=0&&(e-b)*(h-c)-(g-b)*(f-c)>=0&&(g-b)*(j-c)-(i-b)*(h-c)>=0&&iS(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function iK(f,R,S,T){var g,h,U,V,s,i,j,W,X,Y,t,u,v,w,x,y,k,l,z,A,B,C,D,E,m,n,F,G,H,I,J,K,o,p,L,M,N,O,P,Q,q,r,d=f.prev,e=f,a=f.next;if(iS(d,e,a)>=0)return!1;for(var _=d.x>e.x?d.x>a.x?d.x:a.x:e.x>a.x?e.x:a.x,aa=d.y>e.y?d.y>a.y?d.y:a.y:e.y>a.y?e.y:a.y,Z=(g=d.x=Z&&c&&c.z<=$;){if(b!==f.prev&&b!==f.next&&(t=d.x,u=d.y,v=e.x,w=e.y,x=a.x,y=a.y,k=b.x,l=b.y,(x-k)*(u-l)-(t-k)*(y-l)>=0&&(t-k)*(w-l)-(v-k)*(u-l)>=0&&(v-k)*(y-l)-(x-k)*(w-l)>=0)&&iS(b.prev,b,b.next)>=0||(b=b.prevZ,c!==f.prev&&c!==f.next&&(z=d.x,A=d.y,B=e.x,C=e.y,D=a.x,E=a.y,m=c.x,n=c.y,(D-m)*(A-n)-(z-m)*(E-n)>=0&&(z-m)*(C-n)-(B-m)*(A-n)>=0&&(B-m)*(E-n)-(D-m)*(C-n)>=0)&&iS(c.prev,c,c.next)>=0))return!1;c=c.nextZ}for(;b&&b.z>=Z;){if(b!==f.prev&&b!==f.next&&(F=d.x,G=d.y,H=e.x,I=e.y,J=a.x,K=a.y,o=b.x,p=b.y,(J-o)*(G-p)-(F-o)*(K-p)>=0&&(F-o)*(I-p)-(H-o)*(G-p)>=0&&(H-o)*(K-p)-(J-o)*(I-p)>=0)&&iS(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;c&&c.z<=$;){if(c!==f.prev&&c!==f.next&&(L=d.x,M=d.y,N=e.x,O=e.y,P=a.x,Q=a.y,q=c.x,r=c.y,(P-q)*(M-r)-(L-q)*(Q-r)>=0&&(L-q)*(O-r)-(N-q)*(M-r)>=0&&(N-q)*(Q-r)-(P-q)*(O-r)>=0)&&iS(c.prev,c,c.next)>=0)return!1;c=c.nextZ}return!0}function iL(d,e,f){var a=d;do{var c=a.prev,b=a.next.next;!iT(c,b)&&iU(c,a,a.next,b)&&iX(c,b)&&iX(b,c)&&(e.push(c.i/f),e.push(a.i/f),e.push(b.i/f),i$(a),i$(a.next),a=d=b),a=a.next}while(a!==d)return iH(a)}function iM(d,e,f,g,h,i){var a=d;do{for(var b=a.next.next;b!==a.prev;){if(a.i!==b.i&&iR(a,b)){var c=iY(a,b);return a=iH(a,a.next),c=iH(c,c.next),iI(a,e,f,g,h,i),void iI(c,e,f,g,h,i)}b=b.next}a=a.next}while(a!==d)}function iN(a,b){return a.x-b.x}function iO(c,b){var a=function(j,s){var k,l,m,n,o,p,e,f,b,a=s,d=j.x,c=j.y,g=-1/0;do{if(c<=a.y&&c>=a.next.y&&a.next.y!==a.y){var h=a.x+(c-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(h<=d&&h>g){if(g=h,h===d){if(c===a.y)return a;if(c===a.next.y)return a.next}b=a.x=a.x&&a.x>=t&&d!==a.x&&(k=c=0&&(k-e)*(n-f)-(m-e)*(l-f)>=0&&(m-e)*(p-f)-(o-e)*(n-f)>=0)&&(i=Math.abs(c-a.y)/(d-a.x),iX(a,j)&&(ib.x||a.x===b.x&&iP(b,a)))&&(b=a,r=i)),a=a.next;while(a!==u)return b}(c,b);if(!a)return b;var d=iY(a,c),e=iH(a,a.next);return iH(d,d.next),b===a?e:b}function iP(a,b){return 0>iS(a.prev,a,b.prev)&&0>iS(b.next,a,a.next)}function iQ(c){var a=c,b=c;do(a.xd!=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)&&(iS(a.prev,a,b.prev)||iS(a,b.prev,b))||iT(a,b)&&iS(a.prev,a,a.next)>0&&iS(b.prev,b,b.next)>0)}function iS(b,a,c){return(a.y-b.y)*(c.x-a.x)-(a.x-b.x)*(c.y-a.y)}function iT(a,b){return a.x===b.x&&a.y===b.y}function iU(a,b,c,d){var e=iW(iS(a,b,c)),f=iW(iS(a,b,d)),g=iW(iS(c,d,a)),h=iW(iS(c,d,b));return e!==f&&g!==h||!(0!==e||!iV(a,c,b))||!(0!==f||!iV(a,d,b))||!(0!==g||!iV(c,a,d))||!(0!==h||!iV(c,b,d))}function iV(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 iW(a){return a>0?1:a<0?-1:0}function iX(a,b){return 0>iS(a.prev,a,a.next)?iS(a,b,a.next)>=0&&iS(a,a.prev,b)>=0:0>iS(a,b,a.prev)||0>iS(a,a.next,b)}function iY(a,b){var d=new i_(a.i,a.x,a.y),c=new i_(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 iZ(c,d,e,b){var a=new i_(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 i$(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 i_(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 i0(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);i2(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(i3(a,b,e),g(a[d],j)>0&&i3(a,b,d);hg(a[h],j);)h++;for(;g(a[c],j)>0;)c--}0===g(a[b],j)?i3(a,b,c):i3(a,++c,d),c<=e&&(b=c+1),e<=c&&(d=c-1)}}function i3(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function i4(a,b){return ab?1:0}function i5(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=i7("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=ic(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:ib(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=i8("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,iF),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 i5(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 jf(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(jf,{},b)},VectorTileFeature:dQ,VectorTileLayer:dR};const jg=_.VectorTileFeature.types;function jh(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){var c,d,e,f,g,h,i,j,k,l,m,n;a.x<0!=b.x<0&&this.addBorderIntersection(0,(c=a.y,d=b.y,c*(1-(e=(0-a.x)/(b.x-a.x)))+d*e)),a.x>8192!=b.x>8192&&this.addBorderIntersection(1,(f=a.y,g=b.y,f*(1-(h=(8192-a.x)/(b.x-a.x)))+g*h)),a.y<0!=b.y<0&&this.addBorderIntersection(2,(i=a.x,j=b.x,i*(1-(k=(0-a.y)/(b.y-a.y)))+j*k)),a.y>8192!=b.y>8192&&this.addBorderIntersection(3,(l=a.x,m=b.x,l*(1-(n=(8192-a.y)/(b.y-a.y)))+m*n))}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=i7("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(!ji(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),jh(this.layoutVertexArray,c.x,c.y,o,p,0,0,f),jh(this.layoutVertexArray,c.x,c.y,o,p,0,1,f),f+=z,jh(this.layoutVertexArray,d.x,d.y,o,p,0,0,f),jh(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"!==jg[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 jj={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 jk(a,b){return a.x*b.x+a.y*b.y}function jl(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=i7("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=ic(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:ib(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=i8("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,jp)),this.layoutVertexBuffer=a.createVertexBuffer(this.layoutVertexArray,jo),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 js(a,b){return b>0?b+2*a:a}d$.useIntegerZoom=!0;const jt=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),ju=j([{name:"a_projected_pos",components:3,type:"Float32"}],4);j([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const jv=j([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),jw=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 jx=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 jz={"!":"\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"};var jA=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)},jB=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 jC="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function jD(a){return a.type===P.Bytes?a.readVarint()+a.pos:a.pos+1}function jE(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 jF(b,c){for(var a=0;a>>8,a[c+2]=b>>>16,a[c+3]=b>>>24}function jQ(a,b){return(a[b]|a[b+1]<<8|a[b+2]<<16)+(a[b+3]<<24)}function jR(b,a,c){a.glyphs=[],1===b&&c.readMessage(jS,a)}function jS(a,b,c){if(3===a){const{id:f,bitmap:g,width:d,height:e,left:h,top:i,advance:j}=c.readMessage(jT,{});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 jT(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=jO(this.buf,this.pos);return this.pos+=4,a},readSFixed32:function(){var a=jQ(this.buf,this.pos);return this.pos+=4,a},readFixed64:function(){var a=jO(this.buf,this.pos)+4294967296*jO(this.buf,this.pos+4);return this.pos+=8,a},readSFixed64:function(){var a=jO(this.buf,this.pos)+4294967296*jQ(this.buf,this.pos+4);return this.pos+=8,a},readFloat:function(){var a=jA(this.buf,this.pos,!0,23,4);return this.pos+=4,a},readDouble:function(){var a=jA(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&&jC?(c=this.buf,d=b,e=a,jC.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=jD(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>=0x7fffffffffffffff||e< 0x8000000000000000)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&&jE(c,b,this),this.pos=c-1,this.writeVarint(b),this.pos+=b},writeFloat:function(a){this.realloc(4),jB(this.buf,a,this.pos,!0,23,4),this.pos+=4},writeDouble:function(a){this.realloc(8),jB(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&&jE(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,jF,a)},writePackedSVarint:function(b,a){a.length&&this.writeMessage(b,jG,a)},writePackedBoolean:function(b,a){a.length&&this.writeMessage(b,jJ,a)},writePackedFloat:function(b,a){a.length&&this.writeMessage(b,jH,a)},writePackedDouble:function(b,a){a.length&&this.writeMessage(b,jI,a)},writePackedFixed32:function(b,a){a.length&&this.writeMessage(b,jK,a)},writePackedSFixed32:function(b,a){a.length&&this.writeMessage(b,jL,a)},writePackedFixed64:function(b,a){a.length&&this.writeMessage(b,jM,a)},writePackedSFixed64:function(b,a){a.length&&this.writeMessage(b,jN,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 jU{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(b,c){const a=new jU;return a.scale=b||1,a.fontStack=c,a}static forImage(b){const a=new jU;return a.imageName=b,a}}class jV{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(d,e){const a=new jV;for(let b=0;b=0&&b>=a&&jX[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 jV;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(jU.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 jW(u,c,v,d,w,i,x,y,z,e,f,j,m,k,l,A){const a=jV.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(),j2(a,e,i,c,d,k,l));for(const p of B){const g=new jV;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 j7(b){let c=0;for(let a=0;aj){var k,l,m,n,o,p;const q=(j-e)/f,w=(k=c.x,l=d.x,k*(1-(m=q))+l*m),x=(n=c.y,o=d.y,n*(1-(p=q))+o*p),r=new d7(w,x,0,d.angleTo(c),b);return!i||j6(a,r,v,i,s)?r:void 0}e+=f}}function kb(b,a,k,f,l,g,c,h,d){const m=j8(f,g,c),i=j9(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<=B){const o=new d7(m,n,0,C,c);o._round(),i&&!j6(a,o,j,i,p)||f.push(o)}}e+=l}return A||f.length||q||(f=kc(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 kd(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 kf(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=kg(d,0,a[0]),u=kg(e,0,a[1]),t=kg(d,a[0],a[2]),v=kg(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=kh(d,q,k),n=kh(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(jR,{}));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}}kd(g,0,0,d,m,d,this.f,this.v,this.z),kd(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 kk(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 kj([],kl);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 km(b.p.x-a,b.p.y-a,a,e)),d.push(new km(b.p.x+a,b.p.y-a,a,e)),d.push(new km(b.p.x-a,b.p.y+a,a,e)),d.push(new km(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 kl(a,b){return b.max-a.max}function km(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,il(b,a,c))}}return(d?1:-1)*Math.sqrt(e)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}const kn=Number.POSITIVE_INFINITY,ko=Math.sqrt(2);function ea(b,a){return a[1]!==kn?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/ko;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 kp(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,kn]):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=jW(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=jW(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=j4(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=kt(f.horizontal)||f.vertical;a.iconsInText||(a.iconsInText=!!v&&v.iconsInText),(v||q)&&kq(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 kq(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=kt(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=j5(f,e.vertical,j,a.get("icon-text-fit-padding"),o,p)),g&&(f=j5(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=kn),a.allowVerticalPlacement&&h.vertical){const V=h.vertical;if(u)O=kv(V),j&&(P=kv(j));else{const W=f.layout.get("text-rotate").evaluate(b,{},c)+90;o=ku(r,e,d,m,s,t,V,I,W,v),j&&(y=ku(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=kf(z,E,M,X),F=j?kf(j,E,M,X):void 0;n=ku(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]>kr&&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]>kr||p[1]>kr)&&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=kv(q):l=ku(r,e,d,m,s,t,q,I,f.layout.get("text-rotate").evaluate(b,{},c),v));const _=1===q.positionedLines.length;if(S+=ks(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+=ks(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=kb(u,r,s,e.vertical||g,f,24,q,c.overscaling,8192);for(const v of D){const w=g;w&&kw(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=ka(k,s,e.vertical||g,f,24,q);x&&h(k,x,d)}}else if("Polygon"===b.type)for(const y of i5(b.geometry,0)){const z=kk(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 kr=32640;function ks(a,l,m,n,o,e,f,b,g,h,p,q,r,s,i,t,c){const j=function(_,d,i,O,n,P,Q,D){const u=[];if(0===d.positionedLines.length)return u;const j=O.layout.get("text-rotate").evaluate(P,{})*Math.PI/180,o=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]}(i);let E=Math.abs(d.top-d.bottom);for(const R of d.positionedLines)E-=R.lineOffset;const F=d.positionedLines.length,S=E/F;let v=d.top-i[1];for(let p=0;pkr&&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]>kr||d[1]>kr)&&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 kt(a){for(const b in a)return a[b];return null}function ku(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 kv(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 kw(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=ic(h,s);if(!d._featureFilter.filter(y,a,c))continue;let e,f;if(s||(a.geometry=ib(h,c,w)),n){const C=d.getValueAndResolveTokens("text-field",a,c,r),t=fB.factory(C);kA(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===c3()||this.hasRTLText&&c4.isParsed())&&(e=jy(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:kx[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 kB={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,kB)}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 kB.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=kB.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 kC={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"])})},kD={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 kE 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 kF={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 kG(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 kH={circle:class extends be{constructor(a){super(a,iu)}createBucket(a){return new bf(a)}queryRadius(b){const a=b;return iq("circle-radius",this,a)+iq("circle-stroke-width",this,a)+ir(this.paint.get("circle-translate"))}queryIntersectsFeature(a,b,c,e,j,d,f,g){const h=it(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 iv(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,iD),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 iq("heatmap-radius",this,a)}queryIntersectsFeature(a,b,c,d,i,e,f,g){const h=this.paint.get("heatmap-radius").evaluate(b,c);return iv(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,iE)}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,i9)}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 ir(this.paint.get("fill-translate"))}queryIntersectsFeature(a,d,e,b,f,c){return!a.queryGeometry.isAboveHorizon&&ig(is(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,jj)}createBucket(a){return new dU(a)}queryRadius(){return ir(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=it(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 kP(this.wrap*+b,a,this.canonical.z,this.canonical.x,this.canonical.y);{const c=this.canonical.z-a;return kP(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 kU(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 kV(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 kS(b);const a=[];for(let g=0;g=1;b/=2){const d=f[f.length-1];c=new kS(b);for(let h=0;h0;){const{idx:u,t:B,nodex:g,nodey:h,depth:j}=t.pop();if(this.leaves[u]){kV(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(kZ).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(kZ).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,o,p){var h;if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!p)return;let a;this.updateCacheSize(e,o),"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:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!p,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(("raster"===(h=this._source.type)||"image"===h||"video"===h)&&0!==a.length){const i={},q={},t=Object.keys(b);for(const j of t){const k=b[j],l=this._tiles[j];if(!l||l.fadeEndTime&&l.fadeEndTime<=b$.now())continue;const f=this.findLoadedParent(k,Math.max(k.overscaledZ-aD.maxOverzooming,this._source.minzoom));f&&(this._addTile(f.tileID),i[f.tileID.key]=f.tileID),q[j]=k}const u=a[a.length-1].overscaledZ;for(const m in this._tiles){const n=this._tiles[m];if(b[m]||!n.hasData())continue;let c=n.tileID;for(;c.overscaledZ>u;){c=c.scaledTo(c.overscaledZ-1);const r=this._tiles[c.key];if(r&&r.hasData()&&q[c.key]){b[m]=n.tileID;break}}}for(const g in i)b[g]||(this._coveredTiles[g]=!0,b[g]=i[g])}for(const v in b)this._tiles[v].clearFadeHold();const w=function(c,d){const a=[];for(const b in c)b in d||a.push(b);return a}(this._tiles,b);for(const s of w){const d=this._tiles[s];d.hasSymbolBuckets&&!d.holdingForFade()?d.setHoldDuration(this.map._fadeDuration):d.hasSymbolBuckets&&!d.symbolFadeFinished()||this._removeTile(+s)}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(){var a;if(this._source.hasTransition())return!0;if("raster"===(a=this._source.type)||"image"===a||"video"===a)for(const c in this._tiles){const b=this._tiles[c];if(void 0!==b.fadeEndTime&&b.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 kZ(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}aD.maxOverzooming=10,aD.maxUnderzooming=3;class k${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 kQ(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(k0);let o=null;g.elevation&&b.length>0&&(o=k$.create(g.elevation,this.tileID));const h={};let i;for(let e=0;e(q||(q=ib(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=ic(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=k_(d.paint,c.paint,a,f,m),d.layout=k_(d.layout,c.layout,a,f,m);const r=!o||o(a,c,f,y);if(!r)continue;const s=new kR(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 k_(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 k0(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 k1=new Uint16Array(2178),k2=new Uint8Array(1089),k3=new Uint16Array(1089);function k4(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 k5={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=eM++,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((k1[2*t+0]+k1[2*u+0])/2-k1[2*a+0],(k1[2*t+1]+k1[2*u+1])/2-k1[2*a+1])>=16;if(k2[a]=k2[a]||(y?1:0),f<1022){const z=(i+s>>1)*33+(h+r>>1),A=(k+s>>1)*33+(j+r>>1);k2[a]=k2[a]||k2[z]||k2[A]}}const B=new am,C=new aq;let D=0;function E(b,c){const a=33*c+b;return 0===k3[a]&&(B.emplaceBack(k1[2*a+0],k1[2*a+1],8192*b/32,8192*c/32),k3[a]=++D),k3[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&&k2[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){var w,x;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 le{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 kQ(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&&(lf(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?(lf(a.layers,this.zoom,i),kp(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)&&(lf(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 lf(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 lg=aI(new Float64Array(16));class lh{constructor(a,b){this._tr=a,this._worldSize=b}createInversionMatrix(){return lg}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 k8(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lh(a,b)};const li=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(li*Math.sin(d)),a=b*b,e=a*a*a;return{x:.5*(c*Math.cos(b)/(li*(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=bM(180*(li*d*(1.340264+ -0.24331799999999998*a+c*(.0062510000000000005+.034164*a))/Math.cos(b))/Math.PI,-180,180),k=bM(180*Math.asin(Math.sin(b)/li)/Math.PI,-85.051129,85.051129);return new dy(j,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 k8(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lh(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 k8(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lh(a,b)};const lj=Math.PI/2;function lk(a){return Math.tan((lj+a)/2)}var ll,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(lk(b)/lk(a)),e=d*Math.pow(lk(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< -lj+1e-6&&(a=-lj+1e-6):a>lj-1e-6&&(a=lj-1e-6);const e=d/Math.pow(lk(a),c);return{x:.5*(e*Math.sin(c*b)/Math.PI+.5),y:1-.5*((d-e*Math.cos(c*b))/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))-lj)*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 k8(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lh(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:(180+a)/360,y:dA(b),z:0}),unproject(a,b){const c=dC(b);return new dy(360*a-180,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 k8(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lh(a,b)};const lm=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-.005916*11*c))),b=bM(b-f,-lm,lm)}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);return new dy(h,b*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 k8(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lh(a,b)};const ln=85.051129*aP,lo={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;return{x:.5*((.5*(a*(2/Math.PI)+2*c*Math.sin(a/2)/e)||0)/Math.PI+.5),y:1-.5*((.5*(b+Math.sin(b)/e)||0)/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,-ln,ln)}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 k8(a,this.pixelsPerMeter(a.center.lat,a.worldSize))},createTileTransform:(a,b)=>new lh(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,x=!0){var l,m,g,n,o,h,p,q,i;null==f&&(f=null);const r=this._source();if(!r||a.y<0||a.y>1)return f;const j=r.getSource().maxzoom,s=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=k$.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 le(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((180+a.center.lng)/360*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 kE(a):new kH[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}=lo.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,h7(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),a.writeVarint((m=o)<<1^m>>31),h+=n,i+=o}3===d&&a.writeVarint(15)}}function z(a,b){var c=typeof a;"string"===c?b.writeStringField(1,a):"boolean"===c?b.writeBooleanField(7,a):"number"===c&&(a%1!=0?b.writeDoubleField(3,a):a<0?b.writeSVarintField(6,a):b.writeVarintField(5,a))}function A(c,d,e,a,b,f){if(b-a<=e)return;const g=a+b>>1;B(c,d,g,a,b,f%2),A(c,d,e,a,g-1,f+1),A(c,d,e,g+1,b,f+1)}function B(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);B(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(C(g,a,b,e),a[2*d+h]>k&&C(g,a,b,d);ik;)c--}a[2*b+h]===k?C(g,a,b,c):C(g,a,++c,d),c<=e&&(b=c+1),e<=c&&(d=c-1)}}function C(d,c,a,b){D(d,a,b),D(c,2*a,2*b),D(c,2*a+1,2*b+1)}function D(a,b,c){const d=a[b];a[b]=a[c],a[c]=d}function E(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 F{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++)E(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];E(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 G=Math.fround||(f=new Float32Array(1),a=>(f[0]=+a,f[0]));class H{constructor(a){this.options=O(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 F(a,P,Q,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(b/360+.5,M(f),c/360+.5,M(e)),i=[];for(const m of l){const g=h.points[m];i.push(g.numPoints?K(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?K(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(I(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?O({},a.properties):a.properties;const d=this.points[a.index].properties,b=this.options.map(d);return c&&b===d?O({},b):b}}function I(a,b,c,d,e){return{x:G(a),y:G(b),zoom:1/0,id:c,parentId:-1,numPoints:d,properties:e}}function J(a,b){const[c,d]=a.geometry.coordinates;return{x:G(c/360+.5),y:G(M(d)),zoom:1/0,index:b,parentId:-1}}function K(a){return{type:"Feature",id:a.id,properties:L(a),geometry:{type:"Point",coordinates:[360*(a.x-.5),N(a.y)]}}}function L(b){const a=b.numPoints,c=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a;return O(O({},b.properties),{cluster:!0,cluster_id:b.id,point_count:a,point_count_abbreviated:c})}function M(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 N(a){return 360*Math.atan(Math.exp((180-360*a)*Math.PI/180))/Math.PI-90}function O(a,b){for(const c in b)a[c]=b[c];return a}function P(a){return a.x}function Q(a){return a.y}function R(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&&R(a,b,d,g),a[d+2]=f,c-d>3&&R(a,d,c,g))}function S(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 T(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)U(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,R(a,0,i,j),a[i+2]=1,a.size=Math.abs(h),a.start=0,a.end=a.size}function Y(b,d,e,f){for(var a=0;a1?1:a}function $(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)_(h,b,e,d,f);else if("LineString"===a)aa(h,b,e,d,f,!1,p.lineMetrics);else if("MultiLineString"===a)ac(h,b,e,d,f,!1);else if("Polygon"===a)ac(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 aa(b,u,e,f,o,v,m){for(var n,g,a=ab(b),p=0===o?ae:af,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=ab(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&&ad(a,c,d,s),i=a.length-3,v&&i>=3&&(a[i]!==a[0]||a[i+1]!==a[1])&&ad(a,a[0],a[1],a[2]),a.length&&u.push(a)}function ab(b){var a=[];return a.size=b.size,a.start=b.start,a.end=b.end,a}function ac(b,c,d,e,f,g){for(var a=0;aa.maxX&&(a.maxX=h),i>a.maxY&&(a.maxY=i)}return a}function al(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]=ak(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 z,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=$(g,h,d-i,d+s,0,a.minX,a.maxX,e),l=$(g,h,d+r,d+t,0,a.minX,a.maxX,e),g=null,k&&(n=$(k,h,b-i,b+s,1,a.minY,a.maxY,e),o=$(k,h,b+r,b+t,1,a.minY,a.maxY,e),k=null),l&&(p=$(l,h,b-i,b+s,1,a.minY,a.maxY,e),q=$(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,l=this.options,m=l.extent,h=l.debug;if(a<0||a>24)return null;var n,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[32*((1<<(k=d))*f+e)+k];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]?ai(this.tiles[i],m):null):null};class an 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 H(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:an},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){"use strict";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=100*b|0;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=100*b|0;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(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 ab{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 ab(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 ac;function ad(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 g=Math.max(0,Math.floor(-Math.log(Math.max(d-b,e-c))/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=ad(0,0,c,0,0,d,c,d),b=ad(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 ae={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=aa(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 ab(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==ac&&(ac=a.window.OffscreenCanvas&&new a.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.window.createImageBitmap),ac),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}}},af=function(c,d,e,f){const b=new ae[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 ag(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 ah(b,g,h,i,j,k,l,d=!1){const e=b.tilesIn(i,l,d);e.sort(aj);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,ag(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 ai(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[al]}numActive(){return Object.keys(this.active).length}}let am;function an(){return am||(am=new e),am}function ao(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 ap(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 ay{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 az=Math.tan(85*Math.PI/180);function aA(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 aB(g,j,h,i,f,b){if(h){if("globe"===f.projection.name){const c=aA(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 aC(d,e,f=0){const b=[d.x,d.y,f,1];f?a.transformMat4$1(b,b,e):aO(b,b,e);const c=b[3];return{point:new a.pointGeometry(b[0]/c,b[1]/c),signedDistanceFromCamera:c}}function aD(a,b){return Math.min(.5+a/b*.5,1.5)}function aE(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 aF(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.yaz}(b,c,e)?1===d.flipState?{needsFlipping:!0}:null:b.x>c.x?{needsFlipping:!0}:null}function aI(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=aG(f,o,s,t,c,p,e,b,d,n,q,r,!1,i,j);if(!h)return{notEnoughRoom:!0};const J=aC(h.first.point,w).point,K=aC(h.last.point,w).point;if(v&&!c){const k=aH(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:aK(e,A,y,1,m,void 0,i,j.canonical),x);if(b.flipState=l&&l.needsFlipping?1:2,l)return l}const C=aL(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 aJ(c,g,e,h,f){const b=h.projectTilePoint(c.x,c.y,g);if(!f)return aC(b,e,b.z);const d=f(c);return aC(new a.pointGeometry(b.x+d[0],b.y+d[1]),e,b.z+d[2])}function aK(a,d,b,e,f,g,h,i){const j=aJ(a.add(a.sub(d)._unit()),i,f,h,g).point,c=b.sub(j);return b.add(c._mult(e/c.mag()))}function aL(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=()=>aK(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=aJ(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 aM=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function aN(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,_=aC(new a.pointGeometry(g[0],g[1]),E,g[2]).point,w=t.signedDistanceFromCamera>0?aG(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 ax,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(aaC(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 aO(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=aA(f,b.tileID.canonical,g,k,this.transform,m);let n=null;if(g){const w=aB(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 aT(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=aU(d,g,h,p,e),q=this.collisionIndex.placeCollisionBox(e,s,aV(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,aV(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 aR(!1,!1,!1,!0),void(t[d.crossTileID]=!0)}if(t[d.crossTileID])return;if(y)return void(this.placements[d.crossTileID]=new aR(!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?aV(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 aS);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 aQ(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 aQ(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 aQ(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 aQ(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 aQ(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=aX(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=aX(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=aU(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&&aW(b.textCollisionBox.collisionVertexArray,d.text.placed,!k||p,e.x,e.y),g.verticalTextBox&&aW(b.textCollisionBox.collisionVertexArray,d.text.placed,!k||j,e.x,e.y)}const E=k&&Boolean(!j&&g.verticalIconBox);g.iconBox&&aW(b.iconCollisionBox.collisionVertexArray,d.icon.placed,E,l?e.x:0,l?e.y:0),g.verticalIconBox&&aW(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 aY(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 a_{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 a2=(c,b)=>a.emitValidationErrors(c,b&&b.filter(a=>"source.canvas"!==a.identifier)),a3=a.pick(i,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),a4=a.pick(i,["setCenter","setZoom","setBearing","setPitch"]),a5=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}(),a6={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(an(),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 a1,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(a5,!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&&a2(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=ap(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&&a6[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(),a2(this,a.validateStyle(b)))return!1;(b=a.clone$1(b)).layers=ap(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)||ar(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&&at(c,b,a)?d.push({command:i.setGeoJSONSourceData,args:[a,b[a].data]}):as(a,b,d,e)):aq(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(av),j=k.map(av),p=m.reduce(aw,{}),o=k.reduce(aw,{}),g=n.slice(),q=Object.create(null);let e,h,b,d,c,l,a;for(e=0,h=0;e!(a.command in a4));if(0===c.length)return!1;const d=c.filter(a=>!(a.command in a3));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=af(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(a2(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(ah(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(aj),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(ai(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)&&a2(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 aZ(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 ae[a]},c.setSourceType=function(a,b){ae[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=ba("","\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=ba("#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 a7=ba("\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."),a8=t;var a9={background:ba("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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("#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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("#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:ba("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:ba("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:ba("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:ba("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:ba("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:ba("#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:ba("#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:ba("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:ba("#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:ba("\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:ba("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:ba("\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:ba("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:ba("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 ba(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 bb{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 bd(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 be(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),bd(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)}),bf=(a,b)=>({u_matrix:a,u_image0:0,u_skirt_height:b}),bg=(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 bh(a,b){return null!=a&&null!=b&&!(!a.hasData()||!b.hasData())&&null!=a.demTexture&&null!=b.demTexture&&a.tileID.key!==b.tileID.key}const bi=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()}},bj={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function bk(a,c){const b=1<({u_matrix:a});function bm(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 bn extends a.SourceCache{constructor(a){const c={type:"raster-dem",maxzoom:a.transform.maxZoom},d=new n(an(),null),b=af("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 bo extends a.SourceCache{constructor(a){const b=af("proxy",{type:"geojson",maxzoom:a.transform.maxZoom},new n(an(),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 bp 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 bq 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 bo(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 bn(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)continue;if(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 bp(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),bd(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(bj[g]),a.push(bj[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);bi.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];bh(A,B)&&bi.newMorphing(g.key,A,B,d,250),e.activeTexture.set(f.TEXTURE0),v.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const t=bi.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=bg(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=bg(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=[bj[a]];d&&c.push(bj[i]),k=b.useProgram("terrainRaster",null,c),l=a},n=b.colorModeForRenderPass(),o=new a.DepthMode(h.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);bi.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];bh(t,u)&&bi.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=bi.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=bf(i.projMatrix,bk(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)return null;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,bl(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=bf(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 br(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",a8,a7.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",a8,a7.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 bu=(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}},bv=(d,b,e,f,g,h,c)=>a.extend(bu(d,b,e,f),bt(h,b,c),{u_height_factor:-Math.pow(2,g.overscaledZ)/c.tileSize/8}),bw=a=>({u_matrix:a}),bx=(b,c,d,e)=>a.extend(bw(b),bt(d,c,e)),by=(a,b)=>({u_matrix:a,u_world:b}),bz=(b,c,d,e,f)=>a.extend(bx(b,c,d,e),{u_world:f}),bA=(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}},bB=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},bC=(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]}},bD=(a,b,c=1)=>({u_matrix:a,u_color:b,u_overlay:0,u_overlay_scale:c}),bE=(a,b,c,d)=>({u_matrix:a,u_extrude_scale:V(b,1,c),u_intensity:d}),bF=(d,b,g,e,h,i)=>{const f=d.transform,j=f.calculatePixelsToTileUnitsMatrix(b),c={u_matrix:bI(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(bJ(g)){const k=bH(b,d.transform);c.u_texsize=b.lineAtlasTexture.size,c.u_scale=[k,e.fromScale,e.toScale],c.u_mix=e.t}return c},bG=(e,b,f,d,g)=>{const c=e.transform,h=bH(b,c);return{u_matrix:bI(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 bH(a,b){return 1/V(a,1,b.tileZoom)}function bI(c,a,b,d){return c.translatePosMatrix(d||a.tileID.projMatrix,a,b.paint.get("line-translate"),b.paint.get("line-translate-anchor"))}function bJ(b){const a=b.paint.get("line-dasharray").value;return a.value||"constant"!==a.kind}const bK=(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:bL(a.paint.get("raster-hue-rotate")),u_perspective_transform:h}};function bL(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 bM=(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}},bN=(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(bM(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})},bO=(b,c,d,e,f,g,h,i,j,k,l,m,n,o)=>a.extend(bN(b,c,d,e,f,g,h,i,!0,j,!0,l,m,n,o),{u_texsize_icon:k,u_texture_icon:1}),bP=(a,b,c)=>({u_matrix:a,u_opacity:b,u_color:c}),bQ=(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}),bR={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 bS;function bT(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,bC(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 aN(b.numGlyphs,e)}if(p){d.clear();const A=c.icon.placedSymbolArray;for(let f=0;f[0,0,0];aF(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?bU: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?bO(m.kind,y,u,j,b,D,E,F,p,T,z,x,G,v):bN(m.kind,y,u,j,b,D,E,F,i,p,!0,z,x,G,v):bM(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,bZ(c.buffers,H.segments,h,b,c.program,P,L,M,I)),I.u_is_halo=0}bZ(c.buffers,H.segments,h,b,c.program,P,L,M,c.uniformValues)}}function bZ(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?bz(k,b,m,d,x):by(k,x)}else p=f.indexBuffer,q=f.segments,o=g?bx(k,b,m,d):bw(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 b_(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}),b0(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?bv(v,b,w,p,g,o,e):bu(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 b0(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)continue;if(!(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 b1=new a.Color(1,0,0,1),b2=new a.Color(0,1,0,1),b3=new a.Color(0,0,1,1),b4=new a.Color(1,0,1,1),b5=new a.Color(0,1,1,1);function b6(a,c,b,d){b8(a,0,c+b/2,a.transform.width,b,d)}function b7(a,c,b,d){b8(a,c-b/2,0,b,a.transform.height,d)}function b8(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 b9(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,bD(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,bD(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:ca}=w;function cb(a,b,c,d){a.emplaceBack(b,c,d)}class cc{constructor(b){this.vertexArray=new a.StructArrayLayout3f12,this.indices=new a.StructArrayLayout3ui6,cb(this.vertexArray,-1,-1,1),cb(this.vertexArray,1,-1,1),cb(this.vertexArray,-1,1,1),cb(this.vertexArray,1,1,1),cb(this.vertexArray,-1,-1,-1),cb(this.vertexArray,1,-1,-1),cb(this.vertexArray,-1,1,-1),cb(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,ca),this.indexBuffer=b.createIndexBuffer(this.indices),this.segment=a.SegmentVector.simpleSegment(0,0,36,12)}}function cd(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 ce={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=aA(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);bW(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)&&bY(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)&&bY(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&&(bT(c,d,b,e,b.paint.get("text-translate"),b.paint.get("text-translate-anchor"),!0),bT(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=[];bJ(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?bG(b,f,c,l,C):bF(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))b_(b,d,c,e,f,a.StencilMode.disabled,a.ColorMode.disabled),b_(b,d,c,e,f,b.stencilModeFor3D(),b.colorModeForRenderPass()),b.resetStencilClippingMasks();else{const h=b.colorModeForRenderPass();b_(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)be(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];bc(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)return;if(0===f.paint.get("raster-opacity"))return;if(!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=bm(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=bK(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||(h=b.getBackgroundTiles(),i=Object.values(h).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?bQ(s,f,b,d,{tileID:c,tileSize:o},w):bP(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 cc(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)),cd(d,e,g,c,f,0),a.identity(c),a.rotateY(c,c,.5*Math.PI),cd(d,e,g,c,f,1),a.identity(c),a.rotateX(c,c,-(.5*Math.PI)),cd(d,e,g,c,f,2),a.identity(c),a.rotateX(c,c,.5*Math.PI),cd(d,e,g,c,f,3),a.identity(c),cd(d,e,g,c,f,4),a.identity(c),a.rotateY(c,c,Math.PI),cd(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,g,h,i){const d=b.context,e=d.gl,j=b.transform,f=b.useProgram("skybox");d.activeTexture.set(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,c.skyboxTexture);const k={u_matrix:j.skyboxMatrix,u_sun_direction:c.getCenter(b,!1),u_cubemap:0,u_opacity:h,u_temporal_offset:i};b.prepareDrawProgram(d,f),f.draw(d,e.TRIANGLES,g,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.backCW,k,"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 cc(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,bl(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,bl(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=bs.cacheKey(a,d,c);return this.cache[b]||(this.cache[b]=new bs(this.context,a,a9[a],c,bR[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 cg{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 cg(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ch(b,c){const d=a.getColumn(b,3);a.fromQuat(b,c),a.setColumn(b,3,d)}function ci(c,b){a.setColumn(c,3,[b[0],b[1],b[2],1])}function cj(c,d){const b=a.identity$1([]);return a.rotateZ$1(b,b,-d),a.rotateX$1(b,b,-c),b}function ck(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 cj(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=ck(g,b)}setPitchBearing(b,c){this.orientation=cj(a.degToRad(b),a.degToRad(-c))}}class cl{constructor(b,c){this._transform=a.identity([]),this._orientation=a.identity$1([]),c&&(this._orientation=c,ch(this._transform,this._orientation)),b&&ci(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){ci(this._transform,a)}get orientation(){return this._orientation}set orientation(a){this._orientation=a,ch(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=cj(a,b),ch(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]);return(c-this.position[2])/this.forward()[2]}clone(){return new cl([...this.position],[...this.orientation])}}function cm(b,e){const f=co(b),c=function(c,y,d,h,v){const l=new a.LngLat(d.lng-180*cp,d.lat),m=new a.LngLat(d.lng+180*cp,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+=cp;const q=p.toLngLat(),r=c.project(q.lng,q.lat),w=cr(r.x-g.x,r.y-g.y,e),s=a.MercatorCoordinate.fromLngLat(f);s.y+=cp;const t=s.toLngLat(),u=c.project(t.lng,t.lat),j=cr(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=cn(b);return a.scale(c,c,[d,d,1]),c}function cn(b){const c=b.projection,d=co(b),e=cq(c,b.center),f=cq(c,a.LngLat.convert(c.center));return Math.pow(2,e*d+(1-d)*f)}function co(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 cp=1/4e4;function cq(d,c){const b=a.clamp(c.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),e=new a.LngLat(c.lng-180*cp,b),f=new a.LngLat(c.lng+180*cp,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 cr(a,b,c){const d=Math.cos(c),e=Math.sin(c);return{x:a*d-b*e,y:a*e+b*d}}class cs{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 cg,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new cl,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this._horizonShift=.1}clone(){const a=new cs(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 ct(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)},cu=a.extend({deceleration:2500,maxSpeed:1400},d),cv=a.extend({deceleration:20,maxSpeed:1400},d),cw=a.extend({deceleration:1e3,maxSpeed:360},d),cx=a.extend({deceleration:1e3,maxSpeed:90},d);function cy(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 cC extends a.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,c,b){super(a,{originalEvent:b}),this._defaultPrevented=!1}}class cD{constructor(a,b){this._map=a,this._clickTolerance=b.clickTolerance}reset(){delete this._mousedownPos}wheel(a){return this._firePreventable(new cC(a.type,this._map,a))}mousedown(a,b){return this._mousedownPos=b,this._firePreventable(new cA(a.type,this._map,a))}mouseup(a){this._map.fire(new cA(a.type,this._map,a))}preclick(c){const b=a.extend({},c);b.type="preclick",this._map.fire(new cA(b.type,this._map,b))}click(a,b){this._mousedownPos&&this._mousedownPos.dist(b)>=this._clickTolerance||(this.preclick(a),this._map.fire(new cA(a.type,this._map,a)))}dblclick(a){return this._firePreventable(new cA(a.type,this._map,a))}mouseover(a){this._map.fire(new cA(a.type,this._map,a))}mouseout(a){this._map.fire(new cA(a.type,this._map,a))}touchstart(a){return this._firePreventable(new cB(a.type,this._map,a))}touchmove(a){this._map.fire(new cB(a.type,this._map,a))}touchend(a){this._map.fire(new cB(a.type,this._map,a))}touchcancel(a){this._map.fire(new cB(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cE{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(a){this._map.fire(new cA(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new cA("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._map.fire(new cA(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cF{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)return;if(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 cG(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=cG(b,c)))}touchmove(g,c,d){if(this.aborted||!this.centroid)return;const e=cG(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 cI{constructor(){this._zoomIn=new cH({numTouches:1,numTaps:2}),this._zoomOut=new cH({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 cJ={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=cJ[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=cG(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=cO(e,d,f),b=cO(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=cO(c,a,d),g=cO(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 cO(b,c,d){for(let a=0;aMath.abs(cP(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:cP(this._distance,c),pinchAround:b}}}function cR(a,b){return 180*a.angleWith(b)/Math.PI}class cS 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:cR(this._vector,c),pinchAround:b}}_isBelowThreshold(a){this._minDiameter=Math.min(this._minDiameter,a.mag());const b=25/(Math.PI*this._minDiameter)*360,c=cR(a,this._startVector);return Math.abs(c)Math.abs(a.x)}class cU 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,cT(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 cT(a)&&cT(b)&&f}}class cV{constructor(){this._panStep=100,this._bearingStep=15,this._pitchStep=10,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:cW,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 cW(a){return a*(2-a)}const cX=4.000244140625;class cY{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%cX==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)return;if(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)>cX?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 cZ{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 c_{constructor(){this._tap=new cH({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 c0{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 c1{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 c2{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 c3=a=>a.zoom||a.drag||a.pitch||a.rotate;class c4 extends a.Event{}function c5(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}const c6="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class c7 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 c8{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 c9{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 da(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 db={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 db)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:dc,HTMLElement:dd,ImageBitmap:de}=a.window;function df(a){a.parentNode&&a.parentNode.removeChild(a)}class dg{constructor(c,b,d=!1){this._clickTolerance=10,this.element=b,this.mouseRotate=new cL({clickTolerance:c.dragRotate._mouseRotate._clickTolerance}),this.map=c,d&&(this.mousePitch=new cM({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?dl(d,c,f/5280,a._getUIString("ScaleControl.Miles"),a):dl(d,c,f,a._getUIString("ScaleControl.Feet"),a)}else b&&"nautical"===b.unit?dl(d,c,e/1852,a._getUIString("ScaleControl.NauticalMiles"),a):e>=1e3?dl(d,c,e/1e3,a._getUIString("ScaleControl.Kilometers"),a):dl(d,c,e,a._getUIString("ScaleControl.Meters"),a)}function dl(d,e,a,f,b){const c=function(b){const c=Math.pow(10,`${Math.floor(b)}`.length-1);let a=b/c;return c*(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))}(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 c7{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 cs(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 c9,this._domRenderTaskQueue=new c9,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 dd))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=cz(b.pan.mag(),e,a.extend({},cu,k||{}));c.offset=b.pan.mult(f.amount/b.pan.mag()),c.center=this._map.transform.center,cy(c,f)}if(b.zoom){const g=cz(b.zoom,e,cv);c.zoom=this._map.transform.zoom+g.amount,cy(c,g)}if(b.bearing){const h=cz(b.bearing,e,cw);c.bearing=this._map.transform.bearing+a.clamp(h.amount,-179,179),cy(c,h)}if(b.pitch){const i=cz(b.pitch,e,cx);c.pitch=this._map.transform.pitch+i.amount,cy(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 cD(a,b));const n=a.boxZoom=new cF(a,b);this._add("boxZoom",n);const e=new cI,f=new c$;a.doubleClickZoom=new cZ(f,e),this._add("tapZoom",e),this._add("clickZoom",f);const g=new c_;this._add("tapDragZoom",g);const o=a.touchPitch=new cU(a);this._add("touchPitch",o);const h=new cL(b),i=new cM(b);a.dragRotate=new c1(b,h,i),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",i,["mouseRotate"]);const j=new cK(b),k=new cN(a,b);a.dragPan=new c0(d,j,k),this._add("mousePan",j),this._add("touchPan",k,["touchZoom","touchRotate"]);const l=new cS,m=new cQ;a.touchZoomRotate=new c2(d,m,l,g),this._add("touchRotate",l,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new cE(a));const p=a.scrollZoom=new cY(a,this);this._add("scrollZoom",p,["mousePan"]);const q=a.keyboard=new cV;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(c3(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||c5(d))&&(this._changes.push([d,m,i]),this._triggerRenderFrame()),(Object.keys(e).length||c5(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()})()&&!c5(d)){const t=b.zoom;b.cameraElevationReference="sea",b.recenterOnTerrain(),b.cameraElevationReference="ground",t!==b.zoom&&this._map._update(!0)}if(!c5(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=c3(this._eventsInProgress),c=c3(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=c3(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 c4("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=ct(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 c8,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 cA(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 cA(a,this,d.originalEvent)))},g=b=>{i&&(i=!1,c.call(this,new cA(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 dc||de&&b instanceof de){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 dc||de&&b instanceof de?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 dc||de&&b instanceof de)),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 dc?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 cf(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 c8&&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 dg(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=ct(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!==dh?c(dh):void 0!==a.window.navigator.permissions?a.window.navigator.permissions.query({name:"geolocation"}).then(a=>{c(dh="denied"!==a.state)}):c(dh=!!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,di=0,dj=!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&&dj)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":di--,dj=!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"),++di>1?(b={maximumAge:6e5,timeout:0},dj=!0):(b=this.options.positionOptions,dj=!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(){dk(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,dk(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=da(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=`${db[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(){an().acquire(al)},clearPrewarmedResources:function(){const a=am;a&&(a.isPreloaded()&&1===a.numActive()?(a.release(al),am=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 bp(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),bd(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(bj[g]),a.push(bj[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);bi.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];bh(A,B)&&bi.newMorphing(g.key,A,B,d,250),e.activeTexture.set(f.TEXTURE0),v.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const t=bi.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=bg(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=bg(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=[bj[a]];d&&c.push(bj[i]),k=b.useProgram("terrainRaster",null,c),l=a},n=b.colorModeForRenderPass(),o=new a.DepthMode(h.LEQUAL,a.DepthMode.ReadWrite,b.depthRangeFor3D);bi.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];bh(t,u)&&bi.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=bi.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=bf(i.projMatrix,bk(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)return null;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,bl(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=bf(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 br(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",a8,a7.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",a8,a7.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 bu=(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}},bv=(d,b,e,f,g,h,c)=>a.extend(bu(d,b,e,f),bt(h,b,c),{u_height_factor:-Math.pow(2,g.overscaledZ)/c.tileSize/8}),bw=a=>({u_matrix:a}),bx=(b,c,d,e)=>a.extend(bw(b),bt(d,c,e)),by=(a,b)=>({u_matrix:a,u_world:b}),bz=(b,c,d,e,f)=>a.extend(bx(b,c,d,e),{u_world:f}),bA=(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}},bB=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},bC=(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]}},bD=(a,b,c=1)=>({u_matrix:a,u_color:b,u_overlay:0,u_overlay_scale:c}),bE=(a,b,c,d)=>({u_matrix:a,u_extrude_scale:V(b,1,c),u_intensity:d}),bF=(d,b,g,e,h,i)=>{const f=d.transform,j=f.calculatePixelsToTileUnitsMatrix(b),c={u_matrix:bI(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(bJ(g)){const k=bH(b,d.transform);c.u_texsize=b.lineAtlasTexture.size,c.u_scale=[k,e.fromScale,e.toScale],c.u_mix=e.t}return c},bG=(e,b,f,d,g)=>{const c=e.transform,h=bH(b,c);return{u_matrix:bI(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 bH(a,b){return 1/V(a,1,b.tileZoom)}function bI(c,a,b,d){return c.translatePosMatrix(d||a.tileID.projMatrix,a,b.paint.get("line-translate"),b.paint.get("line-translate-anchor"))}function bJ(b){const a=b.paint.get("line-dasharray").value;return a.value||"constant"!==a.kind}const bK=(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:bL(a.paint.get("raster-hue-rotate")),u_perspective_transform:h}};function bL(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 bM=(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}},bN=(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(bM(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})},bO=(b,c,d,e,f,g,h,i,j,k,l,m,n,o)=>a.extend(bN(b,c,d,e,f,g,h,i,!0,j,!0,l,m,n,o),{u_texsize_icon:k,u_texture_icon:1}),bP=(a,b,c)=>({u_matrix:a,u_opacity:b,u_color:c}),bQ=(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}),bR={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 bS;function bT(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,bC(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 aN(b.numGlyphs,e)}if(p){d.clear();const A=c.icon.placedSymbolArray;for(let f=0;f[0,0,0];aF(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?bU: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?bO(m.kind,y,u,j,b,D,E,F,p,T,z,x,G,v):bN(m.kind,y,u,j,b,D,E,F,i,p,!0,z,x,G,v):bM(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,bZ(c.buffers,H.segments,h,b,c.program,P,L,M,I)),I.u_is_halo=0}bZ(c.buffers,H.segments,h,b,c.program,P,L,M,c.uniformValues)}}function bZ(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?bz(k,b,m,d,x):by(k,x)}else p=f.indexBuffer,q=f.segments,o=g?bx(k,b,m,d):bw(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 b_(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}),b0(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?bv(v,b,w,p,g,o,e):bu(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 b0(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 b1=new a.Color(1,0,0,1),b2=new a.Color(0,1,0,1),b3=new a.Color(0,0,1,1),b4=new a.Color(1,0,1,1),b5=new a.Color(0,1,1,1);function b6(a,c,b,d){b8(a,0,c+b/2,a.transform.width,b,d)}function b7(a,c,b,d){b8(a,c-b/2,0,b,a.transform.height,d)}function b8(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 b9(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,bD(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,bD(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:ca}=w;function cb(a,b,c,d){a.emplaceBack(b,c,d)}class cc{constructor(b){this.vertexArray=new a.StructArrayLayout3f12,this.indices=new a.StructArrayLayout3ui6,cb(this.vertexArray,-1,-1,1),cb(this.vertexArray,1,-1,1),cb(this.vertexArray,-1,1,1),cb(this.vertexArray,1,1,1),cb(this.vertexArray,-1,-1,-1),cb(this.vertexArray,1,-1,-1),cb(this.vertexArray,-1,1,-1),cb(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,ca),this.indexBuffer=b.createIndexBuffer(this.indices),this.segment=a.SegmentVector.simpleSegment(0,0,36,12)}}function cd(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 ce={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=aA(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);bW(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)&&bY(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)&&bY(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&&(bT(c,d,b,e,b.paint.get("text-translate"),b.paint.get("text-translate-anchor"),!0),bT(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=[];bJ(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?bG(b,f,c,l,C):bF(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))b_(b,d,c,e,f,a.StencilMode.disabled,a.ColorMode.disabled),b_(b,d,c,e,f,b.stencilModeFor3D(),b.colorModeForRenderPass()),b.resetStencilClippingMasks();else{const h=b.colorModeForRenderPass();b_(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)be(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];bc(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=bm(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=bK(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||(h=b.getBackgroundTiles(),i=Object.values(h).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?bQ(s,f,b,d,{tileID:c,tileSize:o},w):bP(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 cc(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)),cd(d,e,g,c,f,0),a.identity(c),a.rotateY(c,c,.5*Math.PI),cd(d,e,g,c,f,1),a.identity(c),a.rotateX(c,c,-(.5*Math.PI)),cd(d,e,g,c,f,2),a.identity(c),a.rotateX(c,c,.5*Math.PI),cd(d,e,g,c,f,3),a.identity(c),cd(d,e,g,c,f,4),a.identity(c),a.rotateY(c,c,Math.PI),cd(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,g,h,i){const d=b.context,e=d.gl,j=b.transform,f=b.useProgram("skybox");d.activeTexture.set(e.TEXTURE0),e.bindTexture(e.TEXTURE_CUBE_MAP,c.skyboxTexture);const k={u_matrix:j.skyboxMatrix,u_sun_direction:c.getCenter(b,!1),u_cubemap:0,u_opacity:h,u_temporal_offset:i};b.prepareDrawProgram(d,f),f.draw(d,e.TRIANGLES,g,a.StencilMode.disabled,b.colorModeForRenderPass(),a.CullFaceMode.backCW,k,"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 cc(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,bl(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,bl(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=bs.cacheKey(a,d,c);return this.cache[b]||(this.cache[b]=new bs(this.context,a,a9[a],c,bR[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 cg{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 cg(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ch(b,c){const d=a.getColumn(b,3);a.fromQuat(b,c),a.setColumn(b,3,d)}function ci(c,b){a.setColumn(c,3,[b[0],b[1],b[2],1])}function cj(c,d){const b=a.identity$1([]);return a.rotateZ$1(b,b,-d),a.rotateX$1(b,b,-c),b}function ck(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 cj(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=ck(g,b)}setPitchBearing(b,c){this.orientation=cj(a.degToRad(b),a.degToRad(-c))}}class cl{constructor(b,c){this._transform=a.identity([]),this._orientation=a.identity$1([]),c&&(this._orientation=c,ch(this._transform,this._orientation)),b&&ci(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){ci(this._transform,a)}get orientation(){return this._orientation}set orientation(a){this._orientation=a,ch(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=cj(a,b),ch(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]);return(c-this.position[2])/this.forward()[2]}clone(){return new cl([...this.position],[...this.orientation])}}function cm(b,e){const f=co(b),c=function(c,y,d,h,v){const l=new a.LngLat(d.lng-180*cp,d.lat),m=new a.LngLat(d.lng+180*cp,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+=cp;const q=p.toLngLat(),r=c.project(q.lng,q.lat),w=cr(r.x-g.x,r.y-g.y,e),s=a.MercatorCoordinate.fromLngLat(f);s.y+=cp;const t=s.toLngLat(),u=c.project(t.lng,t.lat),j=cr(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=cn(b);return a.scale(c,c,[d,d,1]),c}function cn(b){const c=b.projection,d=co(b),e=cq(c,b.center),f=cq(c,a.LngLat.convert(c.center));return Math.pow(2,e*d+(1-d)*f)}function co(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 cp=1/4e4;function cq(d,c){const b=a.clamp(c.lat,-a.MAX_MERCATOR_LATITUDE,a.MAX_MERCATOR_LATITUDE),e=new a.LngLat(c.lng-180*cp,b),f=new a.LngLat(c.lng+180*cp,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 cr(a,b,c){const d=Math.cos(c),e=Math.sin(c);return{x:a*d-b*e,y:a*e+b*d}}class cs{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 cg,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new cl,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this._horizonShift=.1}clone(){const a=new cs(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 ct(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)},cu=a.extend({deceleration:2500,maxSpeed:1400},d),cv=a.extend({deceleration:20,maxSpeed:1400},d),cw=a.extend({deceleration:1e3,maxSpeed:360},d),cx=a.extend({deceleration:1e3,maxSpeed:90},d);function cy(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 cC extends a.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(a,c,b){super(a,{originalEvent:b}),this._defaultPrevented=!1}}class cD{constructor(a,b){this._map=a,this._clickTolerance=b.clickTolerance}reset(){delete this._mousedownPos}wheel(a){return this._firePreventable(new cC(a.type,this._map,a))}mousedown(a,b){return this._mousedownPos=b,this._firePreventable(new cA(a.type,this._map,a))}mouseup(a){this._map.fire(new cA(a.type,this._map,a))}preclick(c){const b=a.extend({},c);b.type="preclick",this._map.fire(new cA(b.type,this._map,b))}click(a,b){this._mousedownPos&&this._mousedownPos.dist(b)>=this._clickTolerance||(this.preclick(a),this._map.fire(new cA(a.type,this._map,a)))}dblclick(a){return this._firePreventable(new cA(a.type,this._map,a))}mouseover(a){this._map.fire(new cA(a.type,this._map,a))}mouseout(a){this._map.fire(new cA(a.type,this._map,a))}touchstart(a){return this._firePreventable(new cB(a.type,this._map,a))}touchmove(a){this._map.fire(new cB(a.type,this._map,a))}touchend(a){this._map.fire(new cB(a.type,this._map,a))}touchcancel(a){this._map.fire(new cB(a.type,this._map,a))}_firePreventable(a){if(this._map.fire(a),a.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cE{constructor(a){this._map=a}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(a){this._map.fire(new cA(a.type,this._map,a))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new cA("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(a){this._delayContextMenu?this._contextMenuEvent=a:this._map.fire(new cA(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cF{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 cG(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=cG(b,c)))}touchmove(g,c,d){if(this.aborted||!this.centroid)return;const e=cG(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 cI{constructor(){this._zoomIn=new cH({numTouches:1,numTaps:2}),this._zoomOut=new cH({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 cJ={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=cJ[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=cG(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=cO(e,d,f),b=cO(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=cO(c,a,d),g=cO(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 cO(b,c,d){for(let a=0;aMath.abs(cP(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:cP(this._distance,c),pinchAround:b}}}function cR(a,b){return 180*a.angleWith(b)/Math.PI}class cS 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:cR(this._vector,c),pinchAround:b}}_isBelowThreshold(a){this._minDiameter=Math.min(this._minDiameter,a.mag());const b=25/(Math.PI*this._minDiameter)*360,c=cR(a,this._startVector);return Math.abs(c)Math.abs(a.x)}class cU 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,cT(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 cT(a)&&cT(b)&&f}}class cV{constructor(){this._panStep=100,this._bearingStep=15,this._pitchStep=10,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:cW,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 cW(a){return a*(2-a)}const cX=4.000244140625;class cY{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%cX==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)>cX?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 cZ{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 c_{constructor(){this._tap=new cH({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 c0{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 c1{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 c2{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 c3=a=>a.zoom||a.drag||a.pitch||a.rotate;class c4 extends a.Event{}function c5(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}const c6="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class c7 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 c8{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 c9{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 da(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 db={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 db)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:dc,HTMLElement:dd,ImageBitmap:de}=a.window;function df(a){a.parentNode&&a.parentNode.removeChild(a)}class dg{constructor(c,b,d=!1){this._clickTolerance=10,this.element=b,this.mouseRotate=new cL({clickTolerance:c.dragRotate._mouseRotate._clickTolerance}),this.map=c,d&&(this.mousePitch=new cM({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?dl(d,c,f/5280,a._getUIString("ScaleControl.Miles"),a):dl(d,c,f,a._getUIString("ScaleControl.Feet"),a)}else b&&"nautical"===b.unit?dl(d,c,e/1852,a._getUIString("ScaleControl.NauticalMiles"),a):e>=1e3?dl(d,c,e/1e3,a._getUIString("ScaleControl.Kilometers"),a):dl(d,c,e,a._getUIString("ScaleControl.Meters"),a)}function dl(d,e,a,f,b){const c=function(b){const c=Math.pow(10,`${Math.floor(b)}`.length-1);let a=b/c;return c*(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))}(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 c7{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 cs(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 c9,this._domRenderTaskQueue=new c9,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 dd))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=cz(b.pan.mag(),e,a.extend({},cu,k||{}));c.offset=b.pan.mult(f.amount/b.pan.mag()),c.center=this._map.transform.center,cy(c,f)}if(b.zoom){const g=cz(b.zoom,e,cv);c.zoom=this._map.transform.zoom+g.amount,cy(c,g)}if(b.bearing){const h=cz(b.bearing,e,cw);c.bearing=this._map.transform.bearing+a.clamp(h.amount,-179,179),cy(c,h)}if(b.pitch){const i=cz(b.pitch,e,cx);c.pitch=this._map.transform.pitch+i.amount,cy(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 cD(a,b));const n=a.boxZoom=new cF(a,b);this._add("boxZoom",n);const e=new cI,f=new c$;a.doubleClickZoom=new cZ(f,e),this._add("tapZoom",e),this._add("clickZoom",f);const g=new c_;this._add("tapDragZoom",g);const o=a.touchPitch=new cU(a);this._add("touchPitch",o);const h=new cL(b),i=new cM(b);a.dragRotate=new c1(b,h,i),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",i,["mouseRotate"]);const j=new cK(b),k=new cN(a,b);a.dragPan=new c0(d,j,k),this._add("mousePan",j),this._add("touchPan",k,["touchZoom","touchRotate"]);const l=new cS,m=new cQ;a.touchZoomRotate=new c2(d,m,l,g),this._add("touchRotate",l,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new cE(a));const p=a.scrollZoom=new cY(a,this);this._add("scrollZoom",p,["mousePan"]);const q=a.keyboard=new cV;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(c3(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||c5(d))&&(this._changes.push([d,m,i]),this._triggerRenderFrame()),(Object.keys(e).length||c5(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()})()&&!c5(d)){const t=b.zoom;b.cameraElevationReference="sea",b.recenterOnTerrain(),b.cameraElevationReference="ground",t!==b.zoom&&this._map._update(!0)}if(!c5(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=c3(this._eventsInProgress),c=c3(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=c3(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 c4("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=ct(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 c8,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 cA(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 cA(a,this,d.originalEvent)))},g=b=>{i&&(i=!1,c.call(this,new cA(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 dc||de&&b instanceof de){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 dc||de&&b instanceof de?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 dc||de&&b instanceof de)),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 dc?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 cf(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 c8&&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 dg(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=ct(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!==dh?c(dh):void 0!==a.window.navigator.permissions?a.window.navigator.permissions.query({name:"geolocation"}).then(a=>{c(dh="denied"!==a.state)}):c(dh=!!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,di=0,dj=!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&&dj)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":di--,dj=!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"),++di>1?(b={maximumAge:6e5,timeout:0},dj=!0):(b=this.options.positionOptions,dj=!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(){dk(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,dk(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=da(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=`${db[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(){an().acquire(al)},clearPrewarmedResources:function(){const a=am;a&&(a.isPreloaded()&&1===a.numActive()?(a.release(al),am=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 b641415eb60..154ff2c8424 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)}),bc=new h(4),h!=Float32Array&&(bc[0]=0,bc[1]=0,bc[2]=0,bc[3]=0);const aF=Math.log2||function(a){return Math.log(a)*Math.LOG2E};function aG(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 aH(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 aI(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 aJ(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 aK(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a}function aL(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 aM(a,b){if(!a)throw new Error(b||"@math.gl/web-mercator: assertion failed.")}bd=new h(2),h!=Float32Array&&(bd[0]=0,bd[1]=0),be=new h(3),h!=Float32Array&&(be[0]=0,be[1]=0,be[2]=0);const n=Math.PI,aN=n/4,aO=n/180,aP=180/n;function aQ(a){return Math.pow(2,a)}function aR([b,a]){return aM(Number.isFinite(b)),aM(Number.isFinite(a)&&a>= -90&&a<=90,"invalid latitude"),[512*(b*aO+n)/(2*n),512*(n+Math.log(Math.tan(aN+.5*(a*aO))))/(2*n)]}function aS([a,b]){return[(a/512*(2*n)-n)*aP,2*(Math.atan(Math.exp(b/512*(2*n)-n))-aN)*aP]}function aT(a){return 2*Math.atan(.5/a)*aP}function aU(a){return .5/Math.tan(.5*a*aO)}function aV(i,c,j=0){const[a,b,e]=i;if(aM(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 aL([],f,g,d===h?0:((j||0)-d)/(h-d))}const aW=Math.PI/180;function aX(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=aL([],b,f,i),g=aS(j);return g[2]=d,g}class aY{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=aT(a=1.5):null===b?b=aT(a):null===a&&(a=aU(b));const r=aQ(p);a=Math.max(.75,a);const s=function({latitude:c,longitude:i,highPrecision:j=!1}){aM(Number.isFinite(c)&&Number.isFinite(i));const b={},d=Math.cos(c*aO),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=aO*Math.tan(c*aO)/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=aR([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=aT(1.5),altitude:d,pitch:h=0,nearZMultiplier:i=1,farZMultiplier:j=1}){void 0!==d&&(a=aT(d));const b=.5*a*aO,c=aU(a),e=h*aO;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 aH(e,e,[0,0,-I]),a=e,b=e,m=-G*aO,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*aO,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,aI(e,e,[l/=F,l,l]),E&&aH(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();aG(G,G,K),aG(G,G,L),this.viewProjectionMatrix=G;const d=aB();aI(d,d,[I/2,-J/2,1]),aH(d,d,[1,-1,0]),aG(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 aY&&a.width===this.width&&a.height===this.height&&aJ(a.projectionMatrix,this.projectionMatrix)&&aJ(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 aM(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=aV([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]=aR(a),d=(a[2]||0)*this.distanceScales.unitsPerMeter[2];return[b,c,d]}unprojectPosition(a){const[b,c]=aS(a),d=(a[2]||0)*this.distanceScales.metersPerUnit[2];return[b,c,d]}projectFlat(a){return aR(a)}unprojectFlat(a){return aS(a)}getMapCenterByLngLatPosition({lngLat:c,pos:d}){var a,b;const e=aV(d,this.pixelUnprojectionMatrix),f=aR(c),g=aK([],f,(a=[],b=e,a[0]=-b[0],a[1]=-b[1],a)),h=aK([],this.center,g);return aS(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 aM(Number.isFinite(a.top)&&Number.isFinite(a.bottom)&&Number.isFinite(a.left)&&Number.isFinite(a.right));const c=aR([q,aE(t,-85.051129,85.051129)]),d=aR([s,aE(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])];aM(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=aS(w),l=Math.min(p,aF(Math.abs(Math.min(i,j))));return aM(Number.isFinite(l)),{longitude:k[0],latitude:k[1],zoom:l}}(Object.assign({width:a,height:b,bounds:c},d));return new aY({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*aW:Math.atan(.5/a.altitude),l=(90-a.pitch)*aW;return k>l-.01?(f=aX(a,0,d),g=aX(a,e,d)):(f=b([0,0],c),g=b([e,0],c)),[i,j,g,f]}(this,a.z||0)}}const aZ=["longitude","latitude","zoom"],a$={curve:1.414,speed:1.2};function a_(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=aQ(l),y=h.zoom,z=[h.longitude,h.latitude],A=aQ(y-l),r=aR(w),B=aR(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(){a0&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),a3?(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(){a0&&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;a2.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}(),a5=function(b,c){for(var a=0,d=Object.keys(c);a0},a}(),bi="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=a4.getInstance(),d=new bh(b,c,this);bi.set(this,d)}return a}();["observe","unobserve","disconnect"].forEach(function(a){O.prototype[a]=function(){var b;return(b=bi.get(this))[a].apply(b,arguments)}});var bj=void 0!==o.ResizeObserver?o.ResizeObserver:O;function bk(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function bl(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 bq(a,c){if(a){if("string"==typeof a)return br(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 br(a,c)}}function br(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(bk(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 bm(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(bt(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:bt(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;bv(a=Object.assign({},R,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){bv(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(bt(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 bw(a){return Array.isArray(a)||ArrayBuffer.isView(a)}function bx(a,b){if(a===b)return!0;if(bw(a)&&bw(b)){if(a.length!==b.length)return!1;for(var c=0;c=Math.abs(a-b)}function by(a,b,c){return Math.max(b,Math.min(c,a))}function bz(a,c,b){return bw(a)?a.map(function(a,d){return bz(a,c[d],b)}):b*c+(1-b)*a}function bA(a,b){if(!a)throw new Error(b||"react-map-gl: assertion failed.")}function bB(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 bC(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)),bA(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 aY(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=by(d,c,b);var e=a.maxPitch,f=a.minPitch,g=a.pitch;return a.pitch=by(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=aF(e/512);if(d<=f)d=f,a=0;else{const g=e/2/Math.pow(2,d),h=aS([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 aY(this._viewportProps);return a&&b.unproject(a)}},{key:"_calculateNewLngLat",value:function(a){var b=a.startPanLngLat,c=a.pos,d=new aY(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 by(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=by(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 bF(a){return a[0].toLowerCase()+a.slice(1)}function bG(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 bH(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(bI,{value:bN(bN({},b),{},{viewport:b.viewport||bP(bN({map:d,props:a},m)),map:d,container:b.container||h.current})},c.createElement("div",{key:"map-overlays",className:"overlays",ref:o,style:bQ,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=bF(a.slice(3));if("min"===d&&c[e]b[a])return!1}return!0}(a.viewState||a,v),y=Object.assign({},bQ,{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(bR,null))});j.supported=function(){return A()&&A().supported()},j.propTypes=T,j.defaultProps=U;var q=j;function bS(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(!bx(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){bA(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(b,a){return a.transitionDuration}}]),a}();function bT(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function bU(a,b){return(bU=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function bV(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&&bU(b,a)}function bW(a){return(bW="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 bX(b,a){if(a&&("object"===bW(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return bT(b)}function bY(a){return(bY=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}var bZ={longitude:1,bearing:1};function b$(a){return Number.isFinite(a)||Array.isArray(a)}function b_(b,c,a){return b in bZ&&Math.abs(a-c)>180&&(a=a<0?a+360:a-360),a}function b0(a,c){if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(e=b1(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 b1(a,c){if(a){if("string"==typeof a)return b2(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 b2(a,c)}}function b2(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 b8(a,c){if(a){if("string"==typeof a)return b9(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 b9(a,c)}}function b9(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 bk(this,d),g(bT(a=e.call(this)),"propNames",b3),a.props=Object.assign({},b6,b),a}bm(d,[{key:"initializeProps",value:function(h,i){var j,e={},f={},c=b0(b4);try{for(c.s();!(j=c.n()).done;){var a=j.value,g=h[a],k=i[a];bA(b$(g)&&b$(k),"".concat(a," must be supplied for transition")),e[a]=g,f[a]=b_(a,g,k)}}catch(n){c.e(n)}finally{c.f()}var l,d=b0(b5);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]=b_(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,r={}){var k,l,m,c,d,e;const a={},{startZoom:s,startCenterXY:t,uDelta:u,w0:v,u1:n,S:w,rho:o,rho2:x,r0:b}=a_(h,i,r);if(n<.01){for(const f of aZ){const y=h[f],z=i[f];a[f]=(k=y,l=z,(m=j)*l+(1-m)*k)}return a}const p=j*w,A=s+aF(1/(Math.cosh(b)/Math.cosh(b+o*p))),g=(c=[],d=u,e=v*((Math.cosh(b)*Math.tanh(b+o*p)-Math.sinh(b))/x)/n,c[0]=d[0]*e,c[1]=d[1]*e,c);aK(g,g,t);const q=aS(g);return a.longitude=q[0],a.latitude=q[1],a.zoom=A,a}(c,d,e,this.props),a=b0(b5);try{for(a.s();!(f=a.n()).done;){var b=f.value;g[b]=bz(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}=a_(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 ca=["longitude","latitude","zoom","bearing","pitch"],D=function(b){bV(a,b);var c,d,e=(c=a,d=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,b=bY(c);if(d){var e=bY(this).constructor;a=Reflect.construct(b,arguments,e)}else a=b.apply(this,arguments);return bX(this,a)});function a(){var c,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};return bk(this,a),c=e.call(this),Array.isArray(b)&&(b={transitionProps:b}),c.propNames=b.transitionProps||ca,b.around&&(c.around=b.around),c}return bm(a,[{key:"initializeProps",value:function(g,c){var d={},e={};if(this.around){d.around=this.around;var h=new aY(g).unproject(this.around);Object.assign(e,c,{around:new aY(c).project(h),aroundLngLat:h})}var i,b=b7(this.propNames);try{for(b.s();!(i=b.n()).done;){var a=i.value,f=g[a],j=c[a];bA(b$(f)&&b$(j),"".concat(a," must be supplied for transition")),d[a]=f,e[a]=b_(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=b7(this.propNames);try{for(c.s();!(g=c.n()).done;){var d=g.value;b[d]=bz(e[d],a[d],f)}}catch(i){c.e(i)}finally{c.f()}if(a.around){var h=aA(new aY(Object.assign({},a,b)).getMapCenterByLngLatPosition({lngLat:a.aroundLngLat,pos:bz(e.around,a.around,f)}),2),j=h[0],k=h[1];b.longitude=j,b.latitude=k}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]:{};bk(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 bm(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){bA(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 bE(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 cb={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=cb[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 cc=k().Manager;var e=k();const cd=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,ce={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},cf={doubletap:["tap"]},cg={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"]},ch={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"},ci={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;let Y=!1;try{const l={get passive(){return Y=!0,!0}};G.addEventListener("test",l,l),G.removeEventListener("test",l,l)}catch(cj){}const ck=-1!==X.indexOf("firefox"),{WHEEL_EVENTS:cl}=s,cm="wheel";class cn{constructor(b,c,a={}){this.element=b,this.callback=c,this.options=Object.assign({enable:!0},a),this.events=cl.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===cm&&(this.options.enable=b)}handleEvent(b){if(!this.options.enable)return;let a=b.deltaY;G.WheelEvent&&(ck&&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:cm,center:c,delta:b,srcEvent:a,pointerType:"mouse",target:a.target})}}const{MOUSE_EVENTS:co}=s,cp="pointermove",cq="pointerover",cr="pointerout",cs="pointerleave";class ct{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=co.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===cp&&(this.enableMoveEvent=b),a===cq&&(this.enableOverEvent=b),a===cr&&(this.enableOutEvent=b),a===cs&&(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:cq,srcEvent:a,pointerType:"mouse",target:a.target})}handleOutEvent(a){this.enableOutEvent&&"mouseout"===a.type&&this.callback({type:cr,srcEvent:a,pointerType:"mouse",target:a.target})}handleLeaveEvent(a){this.enableLeaveEvent&&"mouseleave"===a.type&&this.callback({type:cs,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:cp,srcEvent:a,pointerType:"mouse",target:a.target});break;case"mouseup":this.pressed=!1;break;default:}}}const{KEY_EVENTS:cu}=s,cv="keydown",cw="keyup";class cx{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=cu.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===cv&&(this.enableDownEvent=b),a===cw&&(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:cv,srcEvent:a,key:a.key,target:a.target}),this.enableUpEvent&&"keyup"===a.type&&this.callback({type:cw,srcEvent:a,key:a.key,target:a.target}))}}const cy="contextmenu";class cz{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===cy&&(this.options.enable=b)}handleEvent(a){this.options.enable&&this.callback({type:cy,center:{x:a.clientX,y:a.clientY},srcEvent:a,pointerType:"mouse",target:a.target})}}const cA={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},cB={srcElement:"root",priority:0};class cC{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({},cB,a):cB;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&&ce[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 cn(a,this._onOtherEvent,{enable:!1}),this.moveInput=new ct(a,this._onOtherEvent,{enable:!1}),this.keyInput=new cx(a,this._onOtherEvent,{enable:!1,tabIndex:b.tabIndex}),this.contextmenuInput=new cz(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=cf[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=ci[b]||b;let a=j.get(c);!a&&(a=new cC(this),j.set(c,a),a.recognizerName=ch[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=ci[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=cg[c.type];b&&this.manager.emit(b,a)}_onOtherEvent(a){this.manager.emit(a.type,a)}}function cE(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 cF(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&&cO.call(this,"onMouseEnter",a),h&&cO.call(this,"onMouseLeave",a),(e||h)&&this.setState({isHovering:d})}}function cS(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);break;default:}(a=a.filter(Boolean)).length&&((b=cM.call(this,b)).features=cN.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)(bJ),u=(0,c.useMemo)(function(){return b.controller||new Z},[]),v=(0,c.useMemo)(function(){return new cD(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=cL(cL({},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,bL(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 cL(cL({},f),{},{eventManager:v,container:f.container||g.current})},[f,g.current]);d.onViewportChange=k,d.viewport=f.viewport||bP(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(cL(cL(cL({},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:cP.bind(a),pointermove:cR.bind(a),pointerup:cQ.bind(a),pointerleave:cO.bind(a,"onMouseOut"),click:cS.bind(a),anyclick:cS.bind(a),dblclick:cO.bind(a,"onDblClick"),wheel:cO.bind(a,"onWheel"),contextmenu:cO.bind(a,"onContextMenu")}),function(){v.destroy()}},[]),bK(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 cL(cL({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(bI,{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 cT=m;function cU(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)cU(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)cU(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 cU(m,a.filter)||b.setFilter(c,m),(n!==a.minzoom||o!==a.maxzoom)&&b.setLayerZoomRange(c,n,o),j)cU(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=cY(cY({},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)(bJ),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 c_(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){bV(a,b);var d,e,f=(d=a,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}(),function(){var a,b=bY(d);if(e){var c=bY(this).constructor;a=Reflect.construct(b,arguments,c)}else a=b.apply(this,arguments);return bX(this,a)});function a(){var b;bk(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 c6(b/100*c)/c*100};function c8(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$(c1(c1({},d),{},{onDragStart:c4})),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=c2(b);d.setDragPos(e);var f=d.dragOffset;if(c.onDrag&&f){var g=Object.assign({},b);g.lngLat=c3(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=c3(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=bL(m,{longitude:g,latitude:h}),i=aA(l.project([g,h,n]),2),o=i[0],p=i[1];return[o+=j,p+=k]}(h),n=aA(u,2),v=n[0],w=n[1],x="translate(".concat(c6(v),"px, ").concat(c6(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 da(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 di(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 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)}),bc=new h(4),h!=Float32Array&&(bc[0]=0,bc[1]=0,bc[2]=0,bc[3]=0);const aF=Math.log2||function(a){return Math.log(a)*Math.LOG2E};function aG(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 aH(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 aI(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 aJ(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 aK(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a}function aL(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 aM(a,b){if(!a)throw new Error(b||"@math.gl/web-mercator: assertion failed.")}bd=new h(2),h!=Float32Array&&(bd[0]=0,bd[1]=0),be=new h(3),h!=Float32Array&&(be[0]=0,be[1]=0,be[2]=0);const n=Math.PI,aN=n/4,aO=n/180,aP=180/n;function aQ(a){return Math.pow(2,a)}function aR([b,a]){return aM(Number.isFinite(b)),aM(Number.isFinite(a)&&a>= -90&&a<=90,"invalid latitude"),[512*(b*aO+n)/(2*n),512*(n+Math.log(Math.tan(aN+.5*(a*aO))))/(2*n)]}function aS([a,b]){return[(a/512*(2*n)-n)*aP,2*(Math.atan(Math.exp(b/512*(2*n)-n))-aN)*aP]}function aT(a){return 2*Math.atan(.5/a)*aP}function aU(a){return .5/Math.tan(.5*a*aO)}function aV(i,c,j=0){const[a,b,e]=i;if(aM(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 aL([],f,g,d===h?0:((j||0)-d)/(h-d))}const aW=Math.PI/180;function aX(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=aL([],b,f,i),g=aS(j);return g[2]=d,g}class aY{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=aT(a=1.5):null===b?b=aT(a):null===a&&(a=aU(b));const r=aQ(p);a=Math.max(.75,a);const s=function({latitude:c,longitude:i,highPrecision:j=!1}){aM(Number.isFinite(c)&&Number.isFinite(i));const b={},d=Math.cos(c*aO),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=aO*Math.tan(c*aO)/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=aR([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=aT(1.5),altitude:d,pitch:h=0,nearZMultiplier:i=1,farZMultiplier:j=1}){void 0!==d&&(a=aT(d));const b=.5*a*aO,c=aU(a),e=h*aO;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 aH(e,e,[0,0,-I]),a=e,b=e,m=-G*aO,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*aO,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,aI(e,e,[l/=F,l,l]),E&&aH(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();aG(G,G,K),aG(G,G,L),this.viewProjectionMatrix=G;const d=aB();aI(d,d,[I/2,-J/2,1]),aH(d,d,[1,-1,0]),aG(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 aY&&a.width===this.width&&a.height===this.height&&aJ(a.projectionMatrix,this.projectionMatrix)&&aJ(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 aM(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=aV([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]=aR(a),d=(a[2]||0)*this.distanceScales.unitsPerMeter[2];return[b,c,d]}unprojectPosition(a){const[b,c]=aS(a),d=(a[2]||0)*this.distanceScales.metersPerUnit[2];return[b,c,d]}projectFlat(a){return aR(a)}unprojectFlat(a){return aS(a)}getMapCenterByLngLatPosition({lngLat:c,pos:d}){var a,b;const e=aV(d,this.pixelUnprojectionMatrix),f=aR(c),g=aK([],f,(a=[],b=e,a[0]=-b[0],a[1]=-b[1],a)),h=aK([],this.center,g);return aS(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 aM(Number.isFinite(a.top)&&Number.isFinite(a.bottom)&&Number.isFinite(a.left)&&Number.isFinite(a.right));const c=aR([q,aE(t,-85.051129,85.051129)]),d=aR([s,aE(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])];aM(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=aS(w),l=Math.min(p,aF(Math.abs(Math.min(i,j))));return aM(Number.isFinite(l)),{longitude:k[0],latitude:k[1],zoom:l}}(Object.assign({width:a,height:b,bounds:c},d));return new aY({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*aW:Math.atan(.5/a.altitude),l=(90-a.pitch)*aW;return k>l-.01?(f=aX(a,0,d),g=aX(a,e,d)):(f=b([0,0],c),g=b([e,0],c)),[i,j,g,f]}(this,a.z||0)}}const aZ=["longitude","latitude","zoom"],a$={curve:1.414,speed:1.2};function a_(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=aQ(l),y=h.zoom,z=[h.longitude,h.latitude],A=aQ(y-l),r=aR(w),B=aR(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(){a0&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),a3?(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(){a0&&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;a2.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}(),a5=function(b,c){for(var a=0,d=Object.keys(c);a0},a}(),bi="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=a4.getInstance(),d=new bh(b,c,this);bi.set(this,d)}return a}();["observe","unobserve","disconnect"].forEach(function(a){O.prototype[a]=function(){var b;return(b=bi.get(this))[a].apply(b,arguments)}});var bj=void 0!==o.ResizeObserver?o.ResizeObserver:O;function bk(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function bl(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 bq(a,c){if(a){if("string"==typeof a)return br(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 br(a,c)}}function br(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(bk(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 bm(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(bt(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:bt(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;bv(a=Object.assign({},R,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){bv(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(bt(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 bw(a){return Array.isArray(a)||ArrayBuffer.isView(a)}function bx(a,b){if(a===b)return!0;if(bw(a)&&bw(b)){if(a.length!==b.length)return!1;for(var c=0;c=Math.abs(a-b)}function by(a,b,c){return Math.max(b,Math.min(c,a))}function bz(a,c,b){return bw(a)?a.map(function(a,d){return bz(a,c[d],b)}):b*c+(1-b)*a}function bA(a,b){if(!a)throw new Error(b||"react-map-gl: assertion failed.")}function bB(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 bC(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)),bA(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 aY(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=by(d,c,b);var e=a.maxPitch,f=a.minPitch,g=a.pitch;return a.pitch=by(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=aF(e/512);if(d<=f)d=f,a=0;else{const g=e/2/Math.pow(2,d),h=aS([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 aY(this._viewportProps);return a&&b.unproject(a)}},{key:"_calculateNewLngLat",value:function(a){var b=a.startPanLngLat,c=a.pos,d=new aY(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 by(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=by(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 bF(a){return a[0].toLowerCase()+a.slice(1)}function bG(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 bH(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(bI,{value:bN(bN({},b),{},{viewport:b.viewport||bP(bN({map:d,props:a},m)),map:d,container:b.container||h.current})},c.createElement("div",{key:"map-overlays",className:"overlays",ref:o,style:bQ,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=bF(a.slice(3));if("min"===d&&c[e]b[a])return!1}return!0}(a.viewState||a,v),y=Object.assign({},bQ,{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(bR,null))});j.supported=function(){return A()&&A().supported()},j.propTypes=T,j.defaultProps=U;var q=j;function bS(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(!bx(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){bA(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(b,a){return a.transitionDuration}}]),a}();function bT(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function bU(a,b){return(bU=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a})(a,b)}function bV(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&&bU(b,a)}function bW(a){return(bW="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 bX(b,a){if(a&&("object"===bW(a)||"function"==typeof a))return a;if(void 0!==a)throw new TypeError("Derived constructors may only return object or undefined");return bT(b)}function bY(a){return(bY=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)})(a)}var bZ={longitude:1,bearing:1};function b$(a){return Number.isFinite(a)||Array.isArray(a)}function b_(b,c,a){return b in bZ&&Math.abs(a-c)>180&&(a=a<0?a+360:a-360),a}function b0(a,c){if("undefined"==typeof Symbol||null==a[Symbol.iterator]){if(Array.isArray(a)||(e=b1(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 b1(a,c){if(a){if("string"==typeof a)return b2(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 b2(a,c)}}function b2(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 b8(a,c){if(a){if("string"==typeof a)return b9(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 b9(a,c)}}function b9(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 bk(this,d),g(bT(a=e.call(this)),"propNames",b3),a.props=Object.assign({},b6,b),a}bm(d,[{key:"initializeProps",value:function(h,i){var j,e={},f={},c=b0(b4);try{for(c.s();!(j=c.n()).done;){var a=j.value,g=h[a],k=i[a];bA(b$(g)&&b$(k),"".concat(a," must be supplied for transition")),e[a]=g,f[a]=b_(a,g,k)}}catch(n){c.e(n)}finally{c.f()}var l,d=b0(b5);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]=b_(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,r={}){var k,l,m,c,d,e;const a={},{startZoom:s,startCenterXY:t,uDelta:u,w0:v,u1:n,S:w,rho:o,rho2:x,r0:b}=a_(h,i,r);if(n<.01){for(const f of aZ){const y=h[f],z=i[f];a[f]=(k=y,l=z,(m=j)*l+(1-m)*k)}return a}const p=j*w,A=s+aF(1/(Math.cosh(b)/Math.cosh(b+o*p))),g=(c=[],d=u,e=v*((Math.cosh(b)*Math.tanh(b+o*p)-Math.sinh(b))/x)/n,c[0]=d[0]*e,c[1]=d[1]*e,c);aK(g,g,t);const q=aS(g);return a.longitude=q[0],a.latitude=q[1],a.zoom=A,a}(c,d,e,this.props),a=b0(b5);try{for(a.s();!(f=a.n()).done;){var b=f.value;g[b]=bz(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}=a_(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 ca=["longitude","latitude","zoom","bearing","pitch"],D=function(b){bV(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=bY(c);if(d){var e=bY(this).constructor;a=Reflect.construct(b,arguments,e)}else a=b.apply(this,arguments);return bX(this,a)});function a(){var c,b=arguments.length>0&& void 0!==arguments[0]?arguments[0]:{};return bk(this,a),c=e.call(this),Array.isArray(b)&&(b={transitionProps:b}),c.propNames=b.transitionProps||ca,b.around&&(c.around=b.around),c}return bm(a,[{key:"initializeProps",value:function(g,c){var d={},e={};if(this.around){d.around=this.around;var h=new aY(g).unproject(this.around);Object.assign(e,c,{around:new aY(c).project(h),aroundLngLat:h})}var i,b=b7(this.propNames);try{for(b.s();!(i=b.n()).done;){var a=i.value,f=g[a],j=c[a];bA(b$(f)&&b$(j),"".concat(a," must be supplied for transition")),d[a]=f,e[a]=b_(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=b7(this.propNames);try{for(c.s();!(g=c.n()).done;){var d=g.value;b[d]=bz(e[d],a[d],f)}}catch(i){c.e(i)}finally{c.f()}if(a.around){var h=aA(new aY(Object.assign({},a,b)).getMapCenterByLngLatPosition({lngLat:a.aroundLngLat,pos:bz(e.around,a.around,f)}),2),j=h[0],k=h[1];b.longitude=j,b.latitude=k}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]:{};bk(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 bm(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){bA(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 bE(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 cb={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=cb[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 cc=k().Manager;var e=k();const cd=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,ce={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},cf={doubletap:["tap"]},cg={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"]},ch={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"},ci={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;let Y=!1;try{const l={get passive(){return Y=!0,!0}};G.addEventListener("test",l,l),G.removeEventListener("test",l,l)}catch(cj){}const ck=-1!==X.indexOf("firefox"),{WHEEL_EVENTS:cl}=s,cm="wheel";class cn{constructor(b,c,a={}){this.element=b,this.callback=c,this.options=Object.assign({enable:!0},a),this.events=cl.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===cm&&(this.options.enable=b)}handleEvent(b){if(!this.options.enable)return;let a=b.deltaY;G.WheelEvent&&(ck&&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:cm,center:c,delta:b,srcEvent:a,pointerType:"mouse",target:a.target})}}const{MOUSE_EVENTS:co}=s,cp="pointermove",cq="pointerover",cr="pointerout",cs="pointerleave";class ct{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=co.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===cp&&(this.enableMoveEvent=b),a===cq&&(this.enableOverEvent=b),a===cr&&(this.enableOutEvent=b),a===cs&&(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:cq,srcEvent:a,pointerType:"mouse",target:a.target})}handleOutEvent(a){this.enableOutEvent&&"mouseout"===a.type&&this.callback({type:cr,srcEvent:a,pointerType:"mouse",target:a.target})}handleLeaveEvent(a){this.enableLeaveEvent&&"mouseleave"===a.type&&this.callback({type:cs,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:cp,srcEvent:a,pointerType:"mouse",target:a.target});break;case"mouseup":this.pressed=!1;break;default:}}}const{KEY_EVENTS:cu}=s,cv="keydown",cw="keyup";class cx{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=cu.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===cv&&(this.enableDownEvent=b),a===cw&&(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:cv,srcEvent:a,key:a.key,target:a.target}),this.enableUpEvent&&"keyup"===a.type&&this.callback({type:cw,srcEvent:a,key:a.key,target:a.target}))}}const cy="contextmenu";class cz{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===cy&&(this.options.enable=b)}handleEvent(a){this.options.enable&&this.callback({type:cy,center:{x:a.clientX,y:a.clientY},srcEvent:a,pointerType:"mouse",target:a.target})}}const cA={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},cB={srcElement:"root",priority:0};class cC{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({},cB,a):cB;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&&ce[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 cn(a,this._onOtherEvent,{enable:!1}),this.moveInput=new ct(a,this._onOtherEvent,{enable:!1}),this.keyInput=new cx(a,this._onOtherEvent,{enable:!1,tabIndex:b.tabIndex}),this.contextmenuInput=new cz(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=cf[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=ci[b]||b;let a=j.get(c);!a&&(a=new cC(this),j.set(c,a),a.recognizerName=ch[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=ci[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=cg[c.type];b&&this.manager.emit(b,a)}_onOtherEvent(a){this.manager.emit(a.type,a)}}function cE(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 cF(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&&cO.call(this,"onMouseEnter",a),h&&cO.call(this,"onMouseLeave",a),(e||h)&&this.setState({isHovering:d})}}function cS(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);break;default:}(a=a.filter(Boolean)).length&&((b=cM.call(this,b)).features=cN.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)(bJ),u=(0,c.useMemo)(function(){return b.controller||new Z},[]),v=(0,c.useMemo)(function(){return new cD(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=cL(cL({},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,bL(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 cL(cL({},f),{},{eventManager:v,container:f.container||g.current})},[f,g.current]);d.onViewportChange=k,d.viewport=f.viewport||bP(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(cL(cL(cL({},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:cP.bind(a),pointermove:cR.bind(a),pointerup:cQ.bind(a),pointerleave:cO.bind(a,"onMouseOut"),click:cS.bind(a),anyclick:cS.bind(a),dblclick:cO.bind(a,"onDblClick"),wheel:cO.bind(a,"onWheel"),contextmenu:cO.bind(a,"onContextMenu")}),function(){v.destroy()}},[]),bK(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 cL(cL({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(bI,{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 cT=m;function cU(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)cU(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)cU(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 cU(m,a.filter)||b.setFilter(c,m),(n!==a.minzoom||o!==a.maxzoom)&&b.setLayerZoomRange(c,n,o),j)cU(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=cY(cY({},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)(bJ),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 c_(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){bV(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=bY(d);if(e){var c=bY(this).constructor;a=Reflect.construct(b,arguments,c)}else a=b.apply(this,arguments);return bX(this,a)});function a(){var b;bk(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 c6(b/100*c)/c*100};function c8(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$(c1(c1({},d),{},{onDragStart:c4})),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=c2(b);d.setDragPos(e);var f=d.dragOffset;if(c.onDrag&&f){var g=Object.assign({},b);g.lngLat=c3(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=c3(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=bL(m,{longitude:g,latitude:h}),i=aA(l.project([g,h,n]),2),o=i[0],p=i[1];return[o+=j,p+=k]}(h),n=aA(u,2),v=n[0],w=n[1],x="translate(".concat(c6(v),"px, ").concat(c6(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 da(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 di(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 newLength) for(key in changeDetected++, oldValue)oldValue.hasOwnProperty(key) && !newValue.hasOwnProperty(key) && (oldLength--, delete oldValue[key]); - } - else oldValue !== newValue && (oldValue = newValue, changeDetected++); + if (isObject(newValue = objGetter(self))) { + if (isArrayLike(newValue)) { + oldValue !== internalArray && (oldLength = (oldValue = internalArray).length = 0, changeDetected++), oldLength !== (newLength = newValue.length) && (changeDetected++, oldValue.length = oldLength = newLength); + for(var newLength, key, i = 0; i < newLength; i++)oldValue[i] !== newValue[i] && (changeDetected++, oldValue[i] = newValue[i]); + } else { + for(key in oldValue !== internalObject && (oldValue = internalObject = {}, oldLength = 0, changeDetected++), newLength = 0, newValue)newValue.hasOwnProperty(key) && (newLength++, oldValue.hasOwnProperty(key) ? oldValue[key] !== newValue[key] && (changeDetected++, oldValue[key] = newValue[key]) : (oldLength++, oldValue[key] = newValue[key], changeDetected++)); + if (oldLength > newLength) for(key in changeDetected++, oldValue)oldValue.hasOwnProperty(key) && !newValue.hasOwnProperty(key) && (oldLength--, delete oldValue[key]); + } + } else oldValue !== newValue && (oldValue = newValue, changeDetected++); return changeDetected; }, function() { listener(newValue, oldValue, self); @@ -2784,12 +2789,14 @@ } traverseScopesLoop: do { if (watchers = current.$$watchers) for(length = watchers.length; length--;)try { - if (watch = watchers[length]) if ((value = watch.get(current)) === (last = watch.last) || (watch.eq ? equals(value, last) : 'number' == typeof value && 'number' == typeof last && isNaN(value) && isNaN(last))) { - if (watch === lastDirtyWatch) { - dirty = !1; - break traverseScopesLoop; - } - } else dirty = !0, lastDirtyWatch = watch, watch.last = watch.eq ? copy(value) : value, watch.fn(value, last === initWatchVal ? value : last, current), ttl < 5 && (watchLog[logIdx = 4 - ttl] || (watchLog[logIdx] = []), logMsg = isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp, logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last), watchLog[logIdx].push(logMsg)); + if (watch = watchers[length]) { + if ((value = watch.get(current)) === (last = watch.last) || (watch.eq ? equals(value, last) : 'number' == typeof value && 'number' == typeof last && isNaN(value) && isNaN(last))) { + if (watch === lastDirtyWatch) { + dirty = !1; + break traverseScopesLoop; + } + } else dirty = !0, lastDirtyWatch = watch, watch.last = watch.eq ? copy(value) : value, watch.fn(value, last === initWatchVal ? value : last, current), ttl < 5 && (watchLog[logIdx = 4 - ttl] || (watchLog[logIdx] = []), logMsg = isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp, logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last), watchLog[logIdx].push(logMsg)); + } } catch (e) { clearPhase(), $exceptionHandler(e); } @@ -3358,8 +3365,7 @@ } function orderByFilter($parse) { return function(array, sortPredicate, reverseOrder) { - if (!isArray(array)) return array; - if (!sortPredicate) return array; + if (!isArray(array) || !sortPredicate) return array; sortPredicate = function(obj, iterator, context) { var results = []; return forEach(obj, function(value, index, list) { @@ -4197,10 +4203,12 @@ }, optionGroupNames = [ '' ], modelValue = ctrl.$modelValue, values = valuesFn(scope) || [], keys = keyName ? sortedKeys(values) : values, locals = {}, selectedSet = !1; - if (multiple) if (trackFn && isArray(modelValue)) { - selectedSet = new HashMap([]); - for(var trackIndex = 0; trackIndex < modelValue.length; trackIndex++)locals[valueName] = modelValue[trackIndex], selectedSet.put(trackFn(scope, locals), modelValue[trackIndex]); - } else selectedSet = new HashMap(modelValue); + if (multiple) { + if (trackFn && isArray(modelValue)) { + selectedSet = new HashMap([]); + for(var trackIndex = 0; trackIndex < modelValue.length; trackIndex++)locals[valueName] = modelValue[trackIndex], selectedSet.put(trackFn(scope, locals), modelValue[trackIndex]); + } else selectedSet = new HashMap(modelValue); + } for(index = 0; index < (length = keys.length); index++){ if (key = index, keyName) { if ('$' === (key = keys[index]).charAt(0)) continue; diff --git a/crates/swc_ecma_minifier/tests/projects/output/backbone-1.1.0.js b/crates/swc_ecma_minifier/tests/projects/output/backbone-1.1.0.js index 13f74a55151..56ad55bcda2 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/backbone-1.1.0.js +++ b/crates/swc_ecma_minifier/tests/projects/output/backbone-1.1.0.js @@ -291,11 +291,13 @@ for(i = 0, l = this.length; i < l; ++i)modelMap[(model = this.models[i]).cid] || toRemove.push(model); toRemove.length && this.remove(toRemove, options); } - if (toAdd.length || order && order.length) if (sortable && (sort = !0), this.length += toAdd.length, null != at) for(i = 0, l = toAdd.length; i < l; i++)this.models.splice(at + i, 0, toAdd[i]); - else { - order && (this.models.length = 0); - var orderedModels = order || toAdd; - for(i = 0, l = orderedModels.length; i < l; i++)this.models.push(orderedModels[i]); + if (toAdd.length || order && order.length) { + if (sortable && (sort = !0), this.length += toAdd.length, null != at) for(i = 0, l = toAdd.length; i < l; i++)this.models.splice(at + i, 0, toAdd[i]); + else { + order && (this.models.length = 0); + var orderedModels = order || toAdd; + for(i = 0, l = orderedModels.length; i < l; i++)this.models.push(orderedModels[i]); + } } if (sort && this.sort({ silent: !0 @@ -580,11 +582,13 @@ return match ? match[1] : ''; }, getFragment: function(fragment, forcePushState) { - if (null == fragment) if (this._hasPushState || !this._wantsHashChange || forcePushState) { - fragment = this.location.pathname; - var root = this.root.replace(trailingSlash, ''); - fragment.indexOf(root) || (fragment = fragment.slice(root.length)); - } else fragment = this.getHash(); + if (null == fragment) { + if (this._hasPushState || !this._wantsHashChange || forcePushState) { + fragment = this.location.pathname; + var root = this.root.replace(trailingSlash, ''); + fragment.indexOf(root) || (fragment = fragment.slice(root.length)); + } else fragment = this.getHash(); + } return fragment.replace(routeStripper, ''); }, start: function(options) { diff --git a/crates/swc_ecma_minifier/tests/projects/output/jquery-1.9.1.js b/crates/swc_ecma_minifier/tests/projects/output/jquery-1.9.1.js index 948cef17430..0f99ac87fb8 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/jquery-1.9.1.js +++ b/crates/swc_ecma_minifier/tests/projects/output/jquery-1.9.1.js @@ -239,24 +239,26 @@ return new Date().getTime(); } }), jQuery.ready.promise = function(obj) { - if (!readyList) if (readyList = jQuery.Deferred(), "complete" === document1.readyState) setTimeout(jQuery.ready); - else if (document1.addEventListener) document1.addEventListener("DOMContentLoaded", completed, !1), window1.addEventListener("load", completed, !1); - else { - document1.attachEvent("onreadystatechange", completed), window1.attachEvent("onload", completed); - var top = !1; - try { - top = null == window1.frameElement && document1.documentElement; - } catch (e) {} - top && top.doScroll && function doScrollCheck() { - if (!jQuery.isReady) { - try { - top.doScroll("left"); - } catch (e) { - return setTimeout(doScrollCheck, 50); + if (!readyList) { + if (readyList = jQuery.Deferred(), "complete" === document1.readyState) setTimeout(jQuery.ready); + else if (document1.addEventListener) document1.addEventListener("DOMContentLoaded", completed, !1), window1.addEventListener("load", completed, !1); + else { + document1.attachEvent("onreadystatechange", completed), window1.attachEvent("onload", completed); + var top = !1; + try { + top = null == window1.frameElement && document1.documentElement; + } catch (e) {} + top && top.doScroll && function doScrollCheck() { + if (!jQuery.isReady) { + try { + top.doScroll("left"); + } catch (e) { + return setTimeout(doScrollCheck, 50); + } + detach(), jQuery.ready(); } - detach(), jQuery.ready(); - } - }(); + }(); + } } return readyList.promise(obj); }, jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { @@ -558,7 +560,7 @@ }); }, delay: function(time, type) { - return time = jQuery.fx ? jQuery.fx.speeds[time] || time : time, type = type || "fx", this.queue(type, function(next, hooks) { + return time = jQuery.fx && jQuery.fx.speeds[time] || time, type = type || "fx", this.queue(type, function(next, hooks) { var timeout = setTimeout(next, time); hooks.stop = function() { clearTimeout(timeout); @@ -674,10 +676,11 @@ var hooks, notxml, ret, nType = elem.nodeType; if (elem && 3 !== nType && 8 !== nType && 2 !== nType) { if (typeof elem.getAttribute === core_strundefined) return jQuery.prop(elem, name, value); - if ((notxml = 1 !== nType || !jQuery.isXMLDoc(elem)) && (name = name.toLowerCase(), hooks = jQuery.attrHooks[name] || (rboolean.test(name) ? boolHook : nodeHook)), value !== undefined) if (null === value) jQuery.removeAttr(elem, name); - else if (hooks && notxml && "set" in hooks && undefined !== (ret = hooks.set(elem, value, name))) return ret; - else return elem.setAttribute(name, value + ""), value; - else if (hooks && notxml && "get" in hooks && null !== (ret = hooks.get(elem, name))) return ret; + if ((notxml = 1 !== nType || !jQuery.isXMLDoc(elem)) && (name = name.toLowerCase(), hooks = jQuery.attrHooks[name] || (rboolean.test(name) ? boolHook : nodeHook)), value !== undefined) { + if (null === value) jQuery.removeAttr(elem, name); + else if (hooks && notxml && "set" in hooks && undefined !== (ret = hooks.set(elem, value, name))) return ret; + else return elem.setAttribute(name, value + ""), value; + } else if (hooks && notxml && "get" in hooks && null !== (ret = hooks.get(elem, name))) return ret; else return typeof elem.getAttribute !== core_strundefined && (ret = elem.getAttribute(name)), null == ret ? undefined : ret; } }, @@ -862,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 ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, event.result = undefined, event.target || (event.target = elem), data = null == data ? [ event ] : jQuery.makeArray(data, [ event @@ -2057,23 +2060,27 @@ clone: function(elem, dataAndEvents, deepDataAndEvents) { var destElements, node, clone, i, srcElements, inPage = jQuery.contains(elem.ownerDocument, elem); if (jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test("<" + elem.nodeName + ">") ? clone = elem.cloneNode(!0) : (fragmentDiv.innerHTML = elem.outerHTML, fragmentDiv.removeChild(clone = fragmentDiv.firstChild)), (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && (1 === elem.nodeType || 11 === elem.nodeType) && !jQuery.isXMLDoc(elem)) for(i = 0, destElements = getAll(clone), srcElements = getAll(elem); null != (node = srcElements[i]); ++i)destElements[i] && fixCloneNodeIssues(node, destElements[i]); - if (dataAndEvents) if (deepDataAndEvents) for(i = 0, srcElements = srcElements || getAll(elem), destElements = destElements || getAll(clone); null != (node = srcElements[i]); i++)cloneCopyEvent(node, destElements[i]); - else cloneCopyEvent(elem, clone); + if (dataAndEvents) { + if (deepDataAndEvents) for(i = 0, srcElements = srcElements || getAll(elem), destElements = destElements || getAll(clone); null != (node = srcElements[i]); i++)cloneCopyEvent(node, destElements[i]); + else cloneCopyEvent(elem, clone); + } return (destElements = getAll(clone, "script")).length > 0 && setGlobalEval(destElements, !inPage && getAll(elem, "script")), destElements = srcElements = node = null, clone; }, buildFragment: function(elems, context, scripts, selection) { - for(var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length, safe = createSafeFragment(context), nodes = [], i = 0; i < l; i++)if ((elem = elems[i]) || 0 === elem) if ("object" === jQuery.type(elem)) jQuery.merge(nodes, elem.nodeType ? [ - elem - ] : elem); - else if (rhtml.test(elem)) { - for(tmp = tmp || safe.appendChild(context.createElement("div")), wrap = wrapMap[tag = (rtagName.exec(elem) || [ - "", - "" - ])[1].toLowerCase()] || wrapMap._default, tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1>") + wrap[2], j = wrap[0]; j--;)tmp = tmp.lastChild; - if (!jQuery.support.leadingWhitespace && rleadingWhitespace.test(elem) && nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0])), !jQuery.support.tbody) for(j = (elem = "table" !== tag || rtbody.test(elem) ? "
" !== wrap[1] || rtbody.test(elem) ? 0 : tmp : tmp.firstChild) && elem.childNodes.length; j--;)jQuery.nodeName(tbody = elem.childNodes[j], "tbody") && !tbody.childNodes.length && elem.removeChild(tbody); - for(jQuery.merge(nodes, tmp.childNodes), tmp.textContent = ""; tmp.firstChild;)tmp.removeChild(tmp.firstChild); - tmp = safe.lastChild; - } else nodes.push(context.createTextNode(elem)); + for(var j, elem, contains, tmp, tag, tbody, wrap, l = elems.length, safe = createSafeFragment(context), nodes = [], i = 0; i < l; i++)if ((elem = elems[i]) || 0 === elem) { + if ("object" === jQuery.type(elem)) jQuery.merge(nodes, elem.nodeType ? [ + elem + ] : elem); + else if (rhtml.test(elem)) { + for(tmp = tmp || safe.appendChild(context.createElement("div")), wrap = wrapMap[tag = (rtagName.exec(elem) || [ + "", + "" + ])[1].toLowerCase()] || wrapMap._default, tmp.innerHTML = wrap[1] + elem.replace(rxhtmlTag, "<$1>") + wrap[2], j = wrap[0]; j--;)tmp = tmp.lastChild; + if (!jQuery.support.leadingWhitespace && rleadingWhitespace.test(elem) && nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0])), !jQuery.support.tbody) for(j = (elem = "table" !== tag || rtbody.test(elem) ? "
" !== wrap[1] || rtbody.test(elem) ? 0 : tmp : tmp.firstChild) && elem.childNodes.length; j--;)jQuery.nodeName(tbody = elem.childNodes[j], "tbody") && !tbody.childNodes.length && elem.removeChild(tbody); + for(jQuery.merge(nodes, tmp.childNodes), tmp.textContent = ""; tmp.firstChild;)tmp.removeChild(tmp.firstChild); + tmp = safe.lastChild; + } else nodes.push(context.createTextNode(elem)); + } for(tmp && safe.removeChild(tmp), jQuery.support.appendChecked || jQuery.grep(getAll(nodes, "input"), fixDefaultChecked), i = 0; elem = nodes[i++];)if ((!selection || -1 === jQuery.inArray(elem, selection)) && (contains = jQuery.contains(elem.ownerDocument, elem), tmp = getAll(safe.appendChild(elem), "script"), contains && setGlobalEval(tmp), scripts)) for(j = 0; elem = tmp[j++];)rscriptType.test(elem.type || "") && scripts.push(elem); return tmp = null, safe; }, @@ -2466,11 +2473,13 @@ }, statusCode: function(map) { var code; - if (map) if (state < 2) for(code in map)statusCode[code] = [ - statusCode[code], - map[code] - ]; - else jqXHR1.always(map[jqXHR1.status]); + if (map) { + if (state < 2) for(code in map)statusCode[code] = [ + statusCode[code], + map[code] + ]; + else jqXHR1.always(map[jqXHR1.status]); + } return this; }, abort: function(statusText) { @@ -2537,14 +2546,16 @@ break; } } - if (!0 !== conv) if (conv && s.throws) response = conv(response); - else try { - response = conv(response); - } catch (e) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; + if (!0 !== conv) { + if (conv && s.throws) response = conv(response); + else try { + response = conv(response); + } catch (e) { + return { + state: "parsererror", + error: conv ? e : "No conversion from " + prev + " to " + current + }; + } } } prev = current; @@ -2656,15 +2667,17 @@ xhr.send(s.hasContent && s.data || null), callback = function(_, isAbort) { var status, responseHeaders, statusText, responses; try { - if (callback && (isAbort || 4 === xhr.readyState)) if (callback = undefined, handle && (xhr.onreadystatechange = jQuery.noop, xhrOnUnloadAbort && delete xhrCallbacks[handle]), isAbort) 4 !== xhr.readyState && xhr.abort(); - else { - responses = {}, status = xhr.status, responseHeaders = xhr.getAllResponseHeaders(), "string" == typeof xhr.responseText && (responses.text = xhr.responseText); - try { - statusText = xhr.statusText; - } catch (e) { - statusText = ""; + if (callback && (isAbort || 4 === xhr.readyState)) { + if (callback = undefined, handle && (xhr.onreadystatechange = jQuery.noop, xhrOnUnloadAbort && delete xhrCallbacks[handle]), isAbort) 4 !== xhr.readyState && xhr.abort(); + else { + responses = {}, status = xhr.status, responseHeaders = xhr.getAllResponseHeaders(), "string" == typeof xhr.responseText && (responses.text = xhr.responseText); + try { + statusText = xhr.statusText; + } catch (e) { + statusText = ""; + } + status || !s.isLocal || s.crossDomain ? 1223 === status && (status = 204) : status = responses.text ? 200 : 404; } - status || !s.isLocal || s.crossDomain ? 1223 === status && (status = 204) : status = responses.text ? 200 : 404; } } catch (firefoxAccessException) { isAbort || complete(-1, firefoxAccessException); diff --git a/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js b/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js index 16183e94cb2..8aac8db60f0 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js @@ -69,7 +69,7 @@ var removeData, orig2, uuid = 0, runiqueId = /^ui-id-\d+$/; function focusable(element, isTabIndexNotNaN) { var map, mapName, img, nodeName = element.nodeName.toLowerCase(); - return "area" === nodeName ? (mapName = (map = element.parentNode).name, !!element.href && !!mapName && "map" === map.nodeName.toLowerCase() && !!(img = $("img[usemap=#" + mapName + "]")[0]) && visible(img)) : (/input|select|textarea|button|object/.test(nodeName) ? !element.disabled : "a" === nodeName ? element.href || isTabIndexNotNaN : isTabIndexNotNaN) && visible(element); + return "area" === nodeName ? (mapName = (map = element.parentNode).name, !!element.href && !!mapName && "map" === map.nodeName.toLowerCase() && !!(img = $("img[usemap=#" + mapName + "]")[0]) && visible(img)) : (/input|select|textarea|button|object/.test(nodeName) ? !element.disabled : "a" === nodeName && element.href || isTabIndexNotNaN) && visible(element); } function visible(element) { return $.expr.filters.visible(element) && !$(element).parents().addBack().filter(function() { @@ -336,7 +336,7 @@ }, returnValue = value.apply(this, arguments), this._super = __super, this._superApply = __superApply, returnValue; }; }), constructor.prototype = $2.widget.extend(basePrototype, { - widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix || name : name + widgetEventPrefix: existingConstructor && basePrototype.widgetEventPrefix || name }, proxiedPrototype, { constructor: constructor, namespace: namespace, @@ -392,13 +392,15 @@ option: function(key, value) { var parts, curOption, i, options = key; if (0 === arguments.length) return $2.widget.extend({}, this.options); - if ("string" == typeof key) if (options = {}, key = (parts = key.split(".")).shift(), parts.length) { - for(i = 0, curOption = options[key] = $2.widget.extend({}, this.options[key]); i < parts.length - 1; i++)curOption[parts[i]] = curOption[parts[i]] || {}, curOption = curOption[parts[i]]; - if (key = parts.pop(), value === undefined1) return undefined1 === curOption[key] ? null : curOption[key]; - curOption[key] = value; - } else { - if (value === undefined1) return undefined1 === this.options[key] ? null : this.options[key]; - options[key] = value; + if ("string" == typeof key) { + if (options = {}, key = (parts = key.split(".")).shift(), parts.length) { + for(i = 0, curOption = options[key] = $2.widget.extend({}, this.options[key]); i < parts.length - 1; i++)curOption[parts[i]] = curOption[parts[i]] || {}, curOption = curOption[parts[i]]; + if (key = parts.pop(), value === undefined1) return undefined1 === curOption[key] ? null : curOption[key]; + curOption[key] = value; + } else { + if (value === undefined1) return undefined1 === this.options[key] ? null : this.options[key]; + options[key] = value; + } } return this._setOptions(options), this; }, @@ -1585,7 +1587,7 @@ ]); return; } - if (this._triggerPageBeforeChange(toPage, triggerData, settings) && !((beforeTransition = this._triggerWithDeprecated("beforetransition", triggerData)).deprecatedEvent.isDefaultPrevented() || beforeTransition.event.isDefaultPrevented())) { + if (!(!this._triggerPageBeforeChange(toPage, triggerData, settings) || (beforeTransition = this._triggerWithDeprecated("beforetransition", triggerData)).deprecatedEvent.isDefaultPrevented() || beforeTransition.event.isDefaultPrevented())) { if (isPageTransitioning = !0, toPage[0] !== $15.mobile.firstPage[0] || settings.dataUrl || (settings.dataUrl = $15.mobile.path.documentUrl.hrefNoHash), fromPage = settings.fromPage, url = settings.dataUrl && $15.mobile.path.convertUrlToDataUrl(settings.dataUrl) || toPage.jqmData("url"), pageUrl = url, $15.mobile.path.getFilePath(url), active = $15.mobile.navigate.history.getActive(), activeIsInitialPage = 0 === $15.mobile.navigate.history.activeIndex, historyDir = 0, pageTitle = document1.title, isDialog = ("dialog" === settings.role || "dialog" === toPage.jqmData("role")) && !0 !== toPage.jqmData("dialog"), fromPage && fromPage[0] === toPage[0] && !settings.allowSamePageTransition) { isPageTransitioning = !1, this._triggerWithDeprecated("transition", triggerData), this.element.trigger("pagechange", triggerData), settings.fromHashChange && $15.mobile.navigate.history.direct({ url: url @@ -1678,10 +1680,7 @@ if ($lastVClicked = $(target), $.data(target, "mobile-button")) { if (!getAjaxFormData($(target).closest("form"), !0)) return; target.parentNode && (target = target.parentNode); - } else { - if (!((target = findClosestLink(target)) && "#" !== $.mobile.path.parseUrl(target.getAttribute("href") || "#").hash)) return; - if (!$(target).jqmHijackable().length) return; - } + } else if (!((target = findClosestLink(target)) && "#" !== $.mobile.path.parseUrl(target.getAttribute("href") || "#").hash) || !$(target).jqmHijackable().length) return; ~target.className.indexOf("ui-link-inherit") ? target.parentNode && (btnEls = $.data(target.parentNode, "buttonElements")) : btnEls = $.data(target, "buttonElements"), btnEls ? target = btnEls.outer : needClosest = !0, $btn = $(target), needClosest && ($btn = $btn.closest(".ui-btn")), $btn.length > 0 && !$btn.hasClass("ui-state-disabled") && ($.mobile.removeActiveLinkClass(!0), $.mobile.activeClickedLink = $btn, $.mobile.activeClickedLink.addClass($.mobile.activeBtnClass)); } }), $.mobile.document.bind("click", function(event) { @@ -1697,10 +1696,12 @@ httpCleanup(); return; } - if (-1 !== href.search("#")) if (href = href.replace(/[^#]*#/, "")) href = $.mobile.path.isPath(href) ? $.mobile.path.makeUrlAbsolute(href, baseUrl) : $.mobile.path.makeUrlAbsolute("#" + href, documentUrl.hrefNoHash); - else { - event.preventDefault(); - return; + if (-1 !== href.search("#")) { + if (href = href.replace(/[^#]*#/, "")) href = $.mobile.path.isPath(href) ? $.mobile.path.makeUrlAbsolute(href, baseUrl) : $.mobile.path.makeUrlAbsolute("#" + href, documentUrl.hrefNoHash); + else { + event.preventDefault(); + return; + } } if ($link.is("[rel='external']") || $link.is(":jqmData(ajax='false')") || $link.is("[target]") || $.mobile.path.isExternal(href) && !$.mobile.path.isPermittedCrossDomainRequest(documentUrl, href)) { httpCleanup(); @@ -2075,8 +2076,10 @@ c: 4, d: 5 }, grid = o.grid; - if (!grid) if ($kids.length <= 5) for(letter in gridCols)gridCols[letter] === $kids.length && (grid = letter); - else grid = "a", $this.addClass("ui-grid-duo"); + if (!grid) { + if ($kids.length <= 5) for(letter in gridCols)gridCols[letter] === $kids.length && (grid = letter); + else grid = "a", $this.addClass("ui-grid-duo"); + } iterator = gridCols[grid], $this.addClass("ui-grid-" + grid), $kids.filter(":nth-child(" + iterator + "n+1)").addClass("ui-block-a"), iterator > 1 && $kids.filter(":nth-child(" + iterator + "n+2)").addClass("ui-block-b"), iterator > 2 && $kids.filter(":nth-child(" + iterator + "n+3)").addClass("ui-block-c"), iterator > 3 && $kids.filter(":nth-child(" + iterator + "n+4)").addClass("ui-block-d"), iterator > 4 && $kids.filter(":nth-child(" + iterator + "n+5)").addClass("ui-block-e"); }); }, function($, undefined) { @@ -3253,14 +3256,16 @@ }, _desiredCoords: function(openOptions) { var offset, dst = null, windowCoordinates = getWindowCoordinates(this.window), x = openOptions.x, y = openOptions.y, pTo = openOptions.positionTo; - if (pTo && "origin" !== pTo) if ("window" === pTo) x = windowCoordinates.cx / 2 + windowCoordinates.x, y = windowCoordinates.cy / 2 + windowCoordinates.y; - else { - try { - dst = $(pTo); - } catch (err) { - dst = null; + if (pTo && "origin" !== pTo) { + if ("window" === pTo) x = windowCoordinates.cx / 2 + windowCoordinates.x, y = windowCoordinates.cy / 2 + windowCoordinates.y; + else { + try { + dst = $(pTo); + } catch (err) { + dst = null; + } + dst && (dst.filter(":visible"), 0 === dst.length && (dst = null)); } - dst && (dst.filter(":visible"), 0 === dst.length && (dst = null)); } return dst && (x = (offset = dst.offset()).left + dst.outerWidth() / 2, y = offset.top + dst.outerHeight() / 2), ("number" !== $.type(x) || isNaN(x)) && (x = windowCoordinates.cx / 2 + windowCoordinates.x), ("number" !== $.type(y) || isNaN(y)) && (y = windowCoordinates.cy / 2 + windowCoordinates.y), { x: x, diff --git a/crates/swc_ecma_minifier/tests/projects/output/react-17.0.2.js b/crates/swc_ecma_minifier/tests/projects/output/react-17.0.2.js index 8c4b71c086a..5f11a5102b7 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/react-17.0.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/react-17.0.2.js @@ -735,10 +735,12 @@ } } function handleTimeout(currentTime) { - if (isHostTimeoutScheduled = !1, advanceTimers(currentTime), !isHostCallbackScheduled) if (null !== peek(taskQueue)) isHostCallbackScheduled = !0, requestHostCallback(flushWork); - else { - var firstTimer = peek(timerQueue); - null !== firstTimer && requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); + if (isHostTimeoutScheduled = !1, advanceTimers(currentTime), !isHostCallbackScheduled) { + if (null !== peek(taskQueue)) isHostCallbackScheduled = !0, requestHostCallback(flushWork); + else { + var firstTimer = peek(timerQueue); + null !== firstTimer && requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); + } } } function flushWork(hasTimeRemaining, initialTime) { diff --git a/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js b/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js index e7340ef9114..fa06f762a17 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js @@ -56,8 +56,7 @@ } } function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) { - if (null == value) return !0; - if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) return !0; + if (null == value || shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) return !0; if (isCustomComponentTag) return !1; if (null !== propertyInfo) switch(propertyInfo.type){ case 3: @@ -3644,7 +3643,7 @@ } function getPossibleStandardName(propName) { var lowerCasedName = propName.toLowerCase(); - return possibleStandardNames.hasOwnProperty(lowerCasedName) ? possibleStandardNames[lowerCasedName] || null : null; + return possibleStandardNames.hasOwnProperty(lowerCasedName) && possibleStandardNames[lowerCasedName] || null; } function warnForUnmatchedText(textNode, text) { warnForTextDifference(textNode.nodeValue, text); @@ -3659,7 +3658,7 @@ didWarnInvalidHydration || (didWarnInvalidHydration = !0, error1('Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase())); } function warnForInsertedHydratedText(parentNode, text) { - '' !== text && (didWarnInvalidHydration || (didWarnInvalidHydration = !0, error1('Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase()))); + '' === text || didWarnInvalidHydration || (didWarnInvalidHydration = !0, error1('Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase())); } normalizeMarkupForTextOrAttribute = function(markup) { return ('string' == typeof markup ? markup : '' + markup).replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, ''); @@ -6349,24 +6348,25 @@ } function updateOffscreenComponent(current, workInProgress, renderLanes) { var _subtreeRenderLanes, nextProps = workInProgress.pendingProps, nextChildren = nextProps.children, prevState = null !== current ? current.memoizedState : null; - if ('hidden' === nextProps.mode || 'unstable-defer-without-hiding' === nextProps.mode) if ((4 & workInProgress.mode) == 0) { - var nextState = { - baseLanes: NoLanes - }; - workInProgress.memoizedState = nextState, pushRenderLanes(workInProgress, renderLanes); - } else if ((1073741824 & renderLanes) !== NoLanes) { - var _nextState2 = { - baseLanes: NoLanes - }; - workInProgress.memoizedState = _nextState2, pushRenderLanes(workInProgress, null !== prevState ? prevState.baseLanes : renderLanes); - } else { - nextBaseLanes = null !== prevState ? prevState.baseLanes | renderLanes : renderLanes, markSpawnedWork(1073741824), workInProgress.lanes = workInProgress.childLanes = 1073741824; - var nextBaseLanes, _nextState = { - baseLanes: nextBaseLanes - }; - return workInProgress.memoizedState = _nextState, pushRenderLanes(workInProgress, nextBaseLanes), null; - } - else null !== prevState ? (_subtreeRenderLanes = prevState.baseLanes | renderLanes, workInProgress.memoizedState = null) : _subtreeRenderLanes = renderLanes, pushRenderLanes(workInProgress, _subtreeRenderLanes); + if ('hidden' === nextProps.mode || 'unstable-defer-without-hiding' === nextProps.mode) { + if ((4 & workInProgress.mode) == 0) { + var nextState = { + baseLanes: NoLanes + }; + workInProgress.memoizedState = nextState, pushRenderLanes(workInProgress, renderLanes); + } else if ((1073741824 & renderLanes) !== NoLanes) { + var _nextState2 = { + baseLanes: NoLanes + }; + workInProgress.memoizedState = _nextState2, pushRenderLanes(workInProgress, null !== prevState ? prevState.baseLanes : renderLanes); + } else { + nextBaseLanes = null !== prevState ? prevState.baseLanes | renderLanes : renderLanes, markSpawnedWork(1073741824), workInProgress.lanes = workInProgress.childLanes = 1073741824; + var nextBaseLanes, _nextState = { + baseLanes: nextBaseLanes + }; + return workInProgress.memoizedState = _nextState, pushRenderLanes(workInProgress, nextBaseLanes), null; + } + } else null !== prevState ? (_subtreeRenderLanes = prevState.baseLanes | renderLanes, workInProgress.memoizedState = null) : _subtreeRenderLanes = renderLanes, pushRenderLanes(workInProgress, _subtreeRenderLanes); return reconcileChildren(current, workInProgress, nextChildren, renderLanes), workInProgress.child; } didWarnAboutBadClass = {}, didWarnAboutModulePatternComponent = {}, didWarnAboutContextTypeOnFunctionComponent = {}, didWarnAboutGetDerivedStateOnFunctionComponent = {}, didWarnAboutFunctionRefs = {}, didWarnAboutReassigningProps = !1, didWarnAboutRevealOrder = {}, didWarnAboutTailOptions = {}; @@ -6584,33 +6584,37 @@ function updateSuspenseListComponent(current, workInProgress6, renderLanes4) { var tailMode, revealOrder2, nextProps = workInProgress6.pendingProps, revealOrder1 = nextProps.revealOrder, tailMode1 = nextProps.tail, newChildren = nextProps.children; !function(revealOrder) { - if (void 0 !== revealOrder && 'forwards' !== revealOrder && 'backwards' !== revealOrder && 'together' !== revealOrder && !didWarnAboutRevealOrder[revealOrder]) if (didWarnAboutRevealOrder[revealOrder] = !0, 'string' == typeof revealOrder) switch(revealOrder.toLowerCase()){ - case 'together': - case 'forwards': - case 'backwards': - error1('"%s" is not a valid value for revealOrder on . Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase()); - break; - case 'forward': - case 'backward': - error1('"%s" is not a valid value for revealOrder on . React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase()); - break; - default: - error1('"%s" is not a supported revealOrder on . Did you mean "together", "forwards" or "backwards"?', revealOrder); - break; + if (void 0 !== revealOrder && 'forwards' !== revealOrder && 'backwards' !== revealOrder && 'together' !== revealOrder && !didWarnAboutRevealOrder[revealOrder]) { + if (didWarnAboutRevealOrder[revealOrder] = !0, 'string' == typeof revealOrder) switch(revealOrder.toLowerCase()){ + case 'together': + case 'forwards': + case 'backwards': + error1('"%s" is not a valid value for revealOrder on . Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase()); + break; + case 'forward': + case 'backward': + error1('"%s" is not a valid value for revealOrder on . React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase()); + break; + default: + error1('"%s" is not a supported revealOrder on . Did you mean "together", "forwards" or "backwards"?', revealOrder); + break; + } + else error1('%s is not a supported value for revealOrder on . Did you mean "together", "forwards" or "backwards"?', revealOrder); } - else error1('%s is not a supported value for revealOrder on . Did you mean "together", "forwards" or "backwards"?', revealOrder); }(revealOrder1), tailMode = tailMode1, revealOrder2 = revealOrder1, void 0 === tailMode || didWarnAboutTailOptions[tailMode] || ('collapsed' !== tailMode && 'hidden' !== tailMode ? (didWarnAboutTailOptions[tailMode] = !0, error1('"%s" is not a supported value for tail on . Did you mean "collapsed" or "hidden"?', tailMode)) : 'forwards' !== revealOrder2 && 'backwards' !== revealOrder2 && (didWarnAboutTailOptions[tailMode] = !0, error1(' is only valid if revealOrder is "forwards" or "backwards". Did you mean to specify revealOrder="forwards"?', tailMode))), function(children, revealOrder) { - if (('forwards' === revealOrder || 'backwards' === revealOrder) && null != children && !1 !== children) if (Array.isArray(children)) { - for(var i = 0; i < children.length; i++)if (!validateSuspenseListNestedChild(children[i], i)) return; - } else { - var iteratorFn = getIteratorFn(children); - if ('function' == typeof iteratorFn) { - var childrenIterator = iteratorFn.call(children); - if (childrenIterator) for(var step = childrenIterator.next(), _i = 0; !step.done; step = childrenIterator.next()){ - if (!validateSuspenseListNestedChild(step.value, _i)) return; - _i++; - } - } else error1('A single row was passed to a . This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?', revealOrder); + if (('forwards' === revealOrder || 'backwards' === revealOrder) && null != children && !1 !== children) { + if (Array.isArray(children)) { + for(var i = 0; i < children.length; i++)if (!validateSuspenseListNestedChild(children[i], i)) return; + } else { + var iteratorFn = getIteratorFn(children); + if ('function' == typeof iteratorFn) { + var childrenIterator = iteratorFn.call(children); + if (childrenIterator) for(var step = childrenIterator.next(), _i = 0; !step.done; step = childrenIterator.next()){ + if (!validateSuspenseListNestedChild(step.value, _i)) return; + _i++; + } + } else error1('A single row was passed to a . This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?', revealOrder); + } } }(newChildren, revealOrder1), reconcileChildren(current, workInProgress6, newChildren, renderLanes4); var suspenseContext = suspenseStackCursor.current; @@ -6691,57 +6695,58 @@ var last = returnFiber.lastEffect; return null !== last ? (last.nextEffect = current, returnFiber.lastEffect = current) : returnFiber.firstEffect = returnFiber.lastEffect = current, current.nextEffect = null, current.flags = Deletion, newWorkInProgress.flags |= Placement, newWorkInProgress; }(current13, workInProgress16, createFiberFromTypeAndProps(workInProgress16.type, workInProgress16.key, workInProgress16.pendingProps, workInProgress16._debugOwner || null, workInProgress16.mode, workInProgress16.lanes)); - if (null !== current13) if (current13.memoizedProps !== workInProgress16.pendingProps || hasContextChanged() || workInProgress16.type !== current13.type) didReceiveUpdate = !0; - else if ((renderLanes12 & updateLanes1) !== NoLanes) didReceiveUpdate = (16384 & current13.flags) !== NoFlags; - else { - switch(didReceiveUpdate = !1, workInProgress16.tag){ - case 3: - pushHostRootContext(workInProgress16), resetHydrationState(); - break; - case 5: - pushHostContext(workInProgress16); - break; - case 1: - isContextProvider(workInProgress16.type) && pushContextProvider(workInProgress16); - break; - case 4: - pushHostContainer(workInProgress16, workInProgress16.stateNode.containerInfo); - break; - case 10: - var newValue = workInProgress16.memoizedProps.value; - pushProvider(workInProgress16, newValue); - break; - case 12: - (renderLanes12 & workInProgress16.childLanes) !== NoLanes && (workInProgress16.flags |= Update); - var stateNode = workInProgress16.stateNode; - stateNode.effectDuration = 0, stateNode.passiveEffectDuration = 0; - break; - case 13: - if (null !== workInProgress16.memoizedState) { - if ((renderLanes12 & workInProgress16.child.childLanes) !== NoLanes) return updateSuspenseComponent(current13, workInProgress16, renderLanes12); + if (null !== current13) { + if (current13.memoizedProps !== workInProgress16.pendingProps || hasContextChanged() || workInProgress16.type !== current13.type) didReceiveUpdate = !0; + else if ((renderLanes12 & updateLanes1) !== NoLanes) didReceiveUpdate = (16384 & current13.flags) !== NoFlags; + else { + switch(didReceiveUpdate = !1, workInProgress16.tag){ + case 3: + pushHostRootContext(workInProgress16), resetHydrationState(); + break; + case 5: + pushHostContext(workInProgress16); + break; + case 1: + isContextProvider(workInProgress16.type) && pushContextProvider(workInProgress16); + break; + case 4: + pushHostContainer(workInProgress16, workInProgress16.stateNode.containerInfo); + break; + case 10: + var newValue = workInProgress16.memoizedProps.value; + pushProvider(workInProgress16, newValue); + break; + case 12: + (renderLanes12 & workInProgress16.childLanes) !== NoLanes && (workInProgress16.flags |= Update); + var stateNode = workInProgress16.stateNode; + stateNode.effectDuration = 0, stateNode.passiveEffectDuration = 0; + break; + case 13: + if (null !== workInProgress16.memoizedState) { + if ((renderLanes12 & workInProgress16.child.childLanes) !== NoLanes) return updateSuspenseComponent(current13, workInProgress16, renderLanes12); + pushSuspenseContext(workInProgress16, 1 & suspenseStackCursor.current); + var child = bailoutOnAlreadyFinishedWork(current13, workInProgress16, renderLanes12); + if (null !== child) return child.sibling; + return null; + } pushSuspenseContext(workInProgress16, 1 & suspenseStackCursor.current); - var child = bailoutOnAlreadyFinishedWork(current13, workInProgress16, renderLanes12); - if (null !== child) return child.sibling; - return null; - } - pushSuspenseContext(workInProgress16, 1 & suspenseStackCursor.current); - break; - case 19: - var didSuspendBefore = (current13.flags & DidCapture) !== NoFlags, _hasChildWork = (renderLanes12 & workInProgress16.childLanes) !== NoLanes; - if (didSuspendBefore) { - if (_hasChildWork) return updateSuspenseListComponent(current13, workInProgress16, renderLanes12); - workInProgress16.flags |= DidCapture; - } - var renderState = workInProgress16.memoizedState; - if (null !== renderState && (renderState.rendering = null, renderState.tail = null, renderState.lastEffect = null), pushSuspenseContext(workInProgress16, suspenseStackCursor.current), !_hasChildWork) return null; - break; - case 23: - case 24: - return workInProgress16.lanes = NoLanes, updateOffscreenComponent(current13, workInProgress16, renderLanes12); + break; + case 19: + var didSuspendBefore = (current13.flags & DidCapture) !== NoFlags, _hasChildWork = (renderLanes12 & workInProgress16.childLanes) !== NoLanes; + if (didSuspendBefore) { + if (_hasChildWork) return updateSuspenseListComponent(current13, workInProgress16, renderLanes12); + workInProgress16.flags |= DidCapture; + } + var renderState = workInProgress16.memoizedState; + if (null !== renderState && (renderState.rendering = null, renderState.tail = null, renderState.lastEffect = null), pushSuspenseContext(workInProgress16, suspenseStackCursor.current), !_hasChildWork) return null; + break; + case 23: + case 24: + return workInProgress16.lanes = NoLanes, updateOffscreenComponent(current13, workInProgress16, renderLanes12); + } + return bailoutOnAlreadyFinishedWork(current13, workInProgress16, renderLanes12); } - return bailoutOnAlreadyFinishedWork(current13, workInProgress16, renderLanes12); - } - else didReceiveUpdate = !1; + } else didReceiveUpdate = !1; switch(workInProgress16.lanes = NoLanes, workInProgress16.tag){ case 2: return function(_current, workInProgress, Component, renderLanes) { @@ -7220,20 +7225,21 @@ var renderState = workInProgress.memoizedState; if (null === renderState) return null; var didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags, renderedTail = renderState.rendering; - if (null === renderedTail) if (didSuspendAlready) cutOffTailIfNeeded(renderState, !1); - else { - if (!(0 === workInProgressRootExitStatus && (null === current || (current.flags & DidCapture) === NoFlags))) for(var row = workInProgress.child; null !== row;){ - var suspended = findFirstSuspended(row); - if (null !== suspended) { - didSuspendAlready = !0, workInProgress.flags |= DidCapture, cutOffTailIfNeeded(renderState, !1); - var newThennables = suspended.updateQueue; - return null !== newThennables && (workInProgress.updateQueue = newThennables, workInProgress.flags |= Update), null === renderState.lastEffect && (workInProgress.firstEffect = null), workInProgress.lastEffect = renderState.lastEffect, resetChildFibers(workInProgress, renderLanes), pushSuspenseContext(workInProgress, 1 & suspenseStackCursor.current | 2), workInProgress.child; + if (null === renderedTail) { + if (didSuspendAlready) cutOffTailIfNeeded(renderState, !1); + else { + if (!(0 === workInProgressRootExitStatus && (null === current || (current.flags & DidCapture) === NoFlags))) for(var row = workInProgress.child; null !== row;){ + var suspended = findFirstSuspended(row); + if (null !== suspended) { + didSuspendAlready = !0, workInProgress.flags |= DidCapture, cutOffTailIfNeeded(renderState, !1); + var newThennables = suspended.updateQueue; + return null !== newThennables && (workInProgress.updateQueue = newThennables, workInProgress.flags |= Update), null === renderState.lastEffect && (workInProgress.firstEffect = null), workInProgress.lastEffect = renderState.lastEffect, resetChildFibers(workInProgress, renderLanes), pushSuspenseContext(workInProgress, 1 & suspenseStackCursor.current | 2), workInProgress.child; + } + row = row.sibling; } - row = row.sibling; + null !== renderState.tail && now() > workInProgressRootRenderTargetTime && (workInProgress.flags |= DidCapture, didSuspendAlready = !0, cutOffTailIfNeeded(renderState, !1), workInProgress.lanes = 33554432, markSpawnedWork(33554432)); } - null !== renderState.tail && now() > workInProgressRootRenderTargetTime && (workInProgress.flags |= DidCapture, didSuspendAlready = !0, cutOffTailIfNeeded(renderState, !1), workInProgress.lanes = 33554432, markSpawnedWork(33554432)); - } - else { + } else { if (!didSuspendAlready) { var _suspended = findFirstSuspended(renderedTail); if (null !== _suspended) { @@ -7401,20 +7407,25 @@ } assertValidProps(tag, nextProps); var styleUpdates1 = null; - for(propKey in lastProps)if (!nextProps.hasOwnProperty(propKey) && lastProps.hasOwnProperty(propKey) && null != lastProps[propKey]) if (propKey === STYLE) { - var lastStyle = lastProps[propKey]; - for(styleName in lastStyle)lastStyle.hasOwnProperty(styleName) && (styleUpdates1 || (styleUpdates1 = {}), styleUpdates1[styleName] = ''); - } else propKey !== DANGEROUSLY_SET_INNER_HTML && propKey !== CHILDREN && propKey !== SUPPRESS_CONTENT_EDITABLE_WARNING && propKey !== SUPPRESS_HYDRATION_WARNING && propKey !== AUTOFOCUS && (registrationNameDependencies1.hasOwnProperty(propKey) ? updatePayload || (updatePayload = []) : (updatePayload = updatePayload || []).push(propKey, null)); + for(propKey in lastProps)if (!nextProps.hasOwnProperty(propKey) && lastProps.hasOwnProperty(propKey) && null != lastProps[propKey]) { + if (propKey === STYLE) { + var lastStyle = lastProps[propKey]; + for(styleName in lastStyle)lastStyle.hasOwnProperty(styleName) && (styleUpdates1 || (styleUpdates1 = {}), styleUpdates1[styleName] = ''); + } else propKey !== DANGEROUSLY_SET_INNER_HTML && propKey !== CHILDREN && propKey !== SUPPRESS_CONTENT_EDITABLE_WARNING && propKey !== SUPPRESS_HYDRATION_WARNING && propKey !== AUTOFOCUS && (registrationNameDependencies1.hasOwnProperty(propKey) ? updatePayload || (updatePayload = []) : (updatePayload = updatePayload || []).push(propKey, null)); + } for(propKey in nextProps){ var nextProp = nextProps[propKey], lastProp = null != lastProps ? lastProps[propKey] : void 0; - if (nextProps.hasOwnProperty(propKey) && nextProp !== lastProp && (null != nextProp || null != lastProp)) if (propKey === STYLE) if (nextProp && Object.freeze(nextProp), lastProp) { - for(styleName in lastProp)!lastProp.hasOwnProperty(styleName) || nextProp && nextProp.hasOwnProperty(styleName) || (styleUpdates1 || (styleUpdates1 = {}), styleUpdates1[styleName] = ''); - for(styleName in nextProp)nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName] && (styleUpdates1 || (styleUpdates1 = {}), styleUpdates1[styleName] = nextProp[styleName]); - } else styleUpdates1 || (updatePayload || (updatePayload = []), updatePayload.push(propKey, styleUpdates1)), styleUpdates1 = nextProp; - else if (propKey === DANGEROUSLY_SET_INNER_HTML) { - var nextHtml = nextProp ? nextProp[HTML$1] : void 0, lastHtml = lastProp ? lastProp[HTML$1] : void 0; - null != nextHtml && lastHtml !== nextHtml && (updatePayload = updatePayload || []).push(propKey, nextHtml); - } else propKey === CHILDREN ? ('string' == typeof nextProp || 'number' == typeof nextProp) && (updatePayload = updatePayload || []).push(propKey, '' + nextProp) : propKey !== SUPPRESS_CONTENT_EDITABLE_WARNING && propKey !== SUPPRESS_HYDRATION_WARNING && (registrationNameDependencies1.hasOwnProperty(propKey) ? (null != nextProp && ('function' != typeof nextProp && warnForInvalidEventListener(propKey, nextProp), 'onScroll' === propKey && listenToNonDelegatedEvent('scroll', domElement)), updatePayload || lastProp === nextProp || (updatePayload = [])) : 'object' == typeof nextProp && null !== nextProp && nextProp.$$typeof === REACT_OPAQUE_ID_TYPE ? nextProp.toString() : (updatePayload = updatePayload || []).push(propKey, nextProp)); + if (nextProps.hasOwnProperty(propKey) && nextProp !== lastProp && (null != nextProp || null != lastProp)) { + if (propKey === STYLE) { + if (nextProp && Object.freeze(nextProp), lastProp) { + for(styleName in lastProp)!lastProp.hasOwnProperty(styleName) || nextProp && nextProp.hasOwnProperty(styleName) || (styleUpdates1 || (styleUpdates1 = {}), styleUpdates1[styleName] = ''); + for(styleName in nextProp)nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName] && (styleUpdates1 || (styleUpdates1 = {}), styleUpdates1[styleName] = nextProp[styleName]); + } else styleUpdates1 || (updatePayload || (updatePayload = []), updatePayload.push(propKey, styleUpdates1)), styleUpdates1 = nextProp; + } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { + var nextHtml = nextProp ? nextProp[HTML$1] : void 0, lastHtml = lastProp ? lastProp[HTML$1] : void 0; + null != nextHtml && lastHtml !== nextHtml && (updatePayload = updatePayload || []).push(propKey, nextHtml); + } else propKey === CHILDREN ? ('string' == typeof nextProp || 'number' == typeof nextProp) && (updatePayload = updatePayload || []).push(propKey, '' + nextProp) : propKey !== SUPPRESS_CONTENT_EDITABLE_WARNING && propKey !== SUPPRESS_HYDRATION_WARNING && (registrationNameDependencies1.hasOwnProperty(propKey) ? (null != nextProp && ('function' != typeof nextProp && warnForInvalidEventListener(propKey, nextProp), 'onScroll' === propKey && listenToNonDelegatedEvent('scroll', domElement)), updatePayload || lastProp === nextProp || (updatePayload = [])) : 'object' == typeof nextProp && null !== nextProp && nextProp.$$typeof === REACT_OPAQUE_ID_TYPE ? nextProp.toString() : (updatePayload = updatePayload || []).push(propKey, nextProp)); + } } return styleUpdates1 && (function(styleUpdates, nextStyles) { if (nextStyles) { @@ -7491,10 +7502,12 @@ updateQueue.add(wakeable), _workInProgress.updateQueue = updateQueue; } else wakeables.add(wakeable); if ((2 & _workInProgress.mode) == 0) { - if (_workInProgress.flags |= DidCapture, sourceFiber.flags |= 16384, sourceFiber.flags &= -2981, 1 === sourceFiber.tag) if (null === sourceFiber.alternate) sourceFiber.tag = 17; - else { - var update = createUpdate(-1, SyncLane); - update.tag = 2, enqueueUpdate(sourceFiber, update); + if (_workInProgress.flags |= DidCapture, sourceFiber.flags |= 16384, sourceFiber.flags &= -2981, 1 === sourceFiber.tag) { + if (null === sourceFiber.alternate) sourceFiber.tag = 17; + else { + var update = createUpdate(-1, SyncLane); + update.tag = 2, enqueueUpdate(sourceFiber, update); + } } sourceFiber.lanes = sourceFiber.lanes | SyncLane; return; @@ -7604,10 +7617,12 @@ return; case 1: var instance = finishedWork1.stateNode; - if (finishedWork1.flags & Update) if (null === current) finishedWork1.type !== finishedWork1.elementType || didWarnAboutReassigningProps || (instance.props !== finishedWork1.memoizedProps && error1("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork1.type) || 'instance'), instance.state !== finishedWork1.memoizedState && error1("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork1.type) || 'instance')), instance.componentDidMount(); - else { - var prevProps = finishedWork1.elementType === finishedWork1.type ? current.memoizedProps : resolveDefaultProps(finishedWork1.type, current.memoizedProps), prevState = current.memoizedState; - finishedWork1.type !== finishedWork1.elementType || didWarnAboutReassigningProps || (instance.props !== finishedWork1.memoizedProps && error1("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork1.type) || 'instance'), instance.state !== finishedWork1.memoizedState && error1("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork1.type) || 'instance')), instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); + if (finishedWork1.flags & Update) { + if (null === current) finishedWork1.type !== finishedWork1.elementType || didWarnAboutReassigningProps || (instance.props !== finishedWork1.memoizedProps && error1("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork1.type) || 'instance'), instance.state !== finishedWork1.memoizedState && error1("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork1.type) || 'instance')), instance.componentDidMount(); + else { + var prevProps = finishedWork1.elementType === finishedWork1.type ? current.memoizedProps : resolveDefaultProps(finishedWork1.type, current.memoizedProps), prevState = current.memoizedState; + finishedWork1.type !== finishedWork1.elementType || didWarnAboutReassigningProps || (instance.props !== finishedWork1.memoizedProps && error1("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork1.type) || 'instance'), instance.state !== finishedWork1.memoizedState && error1("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork1.type) || 'instance')), instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); + } } var updateQueue1 = finishedWork1.updateQueue; null !== updateQueue1 && (finishedWork1.type !== finishedWork1.elementType || didWarnAboutReassigningProps || (instance.props !== finishedWork1.memoizedProps && error1("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork1.type) || 'instance'), instance.state !== finishedWork1.memoizedState && error1("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork1.type) || 'instance')), commitUpdateQueue(finishedWork1, updateQueue1, instance)); @@ -7790,11 +7805,7 @@ if (null === node.return || isHostParent(node.return)) return null; node = node.return; } - for(node.sibling.return = node.return, node = node.sibling; 5 !== node.tag && 6 !== node.tag && 18 !== node.tag;){ - if (node.flags & Placement) continue siblings; - if (null === node.child || 4 === node.tag) continue siblings; - node.child.return = node, node = node.child; - } + for(node.sibling.return = node.return, node = node.sibling; 5 !== node.tag && 6 !== node.tag && 18 !== node.tag;)if (node.flags & Placement || null === node.child || 4 === node.tag) continue siblings; if (!(node.flags & Placement)) return node.stateNode; } }(finishedWork); @@ -9386,9 +9397,7 @@ }), function(fn) { attemptHydrationAtPriority = fn; }(function(priority, fn) { - try { - return fn(); - } finally{} + return fn(); }); var didWarnAboutUnstableCreatePortal = !1; function createPortal$1(children1, container) { diff --git a/crates/swc_ecma_minifier/tests/projects/output/underscore-1.5.2.js b/crates/swc_ecma_minifier/tests/projects/output/underscore-1.5.2.js index 6a11c3c0e4c..acb698df57b 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/underscore-1.5.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/underscore-1.5.2.js @@ -172,8 +172,7 @@ }, _.initial = function(array, n, guard) { return slice.call(array, 0, array.length - (null == n || guard ? 1 : n)); }, _.last = function(array, n, guard) { - if (null != array) if (null == n || guard) return array[array.length - 1]; - else return slice.call(array, Math.max(array.length - n, 0)); + if (null != array) return null == n || guard ? array[array.length - 1] : slice.call(array, Math.max(array.length - n, 0)); }, _.rest = _.tail = _.drop = function(array, n, guard) { return slice.call(array, null == n || guard ? 1 : n); }, _.compact = function(array) { diff --git a/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js b/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js index af013cd6689..b301e052bf9 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js +++ b/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js @@ -162,11 +162,13 @@ var YUI = function() { break; } } - if (mod.fn) if (Y.config.throwFail) mod.fn(Y, name); - else try { - mod.fn(Y, name); - } catch (e) { - return Y.error('Attach error: ' + name, e, name), !1; + if (mod.fn) { + if (Y.config.throwFail) mod.fn(Y, name); + else try { + mod.fn(Y, name); + } catch (e) { + return Y.error('Attach error: ' + name, e, name), !1; + } } if (use) { for(j = 0; j < use.length; j++)if (!done[use[j]]) { @@ -211,11 +213,13 @@ var YUI = function() { }, _notify: function(callback, response, args) { if (!response.success && this.config.loadErrorFn) this.config.loadErrorFn.call(this, this, callback, response, args); - else if (callback) if (this.Env._missed && this.Env._missed.length && (response.msg = 'Missing modules: ' + this.Env._missed.join(), response.success = !1), this.config.throwFail) callback(this, response); - else try { - callback(this, response); - } catch (e) { - this.error('use callback error', e, args); + else if (callback) { + if (this.Env._missed && this.Env._missed.length && (response.msg = 'Missing modules: ' + this.Env._missed.join(), response.success = !1), this.config.throwFail) callback(this, response); + else try { + callback(this, response); + } catch (e) { + this.error('use callback error', e, args); + } } }, _use: function(args, callback) { @@ -1383,15 +1387,17 @@ var YUI = function() { _config: function(o) { var i, j, val, a, f, group, groupName, mod3, self = this, mods = []; if (o) { - for(i in o)if (o.hasOwnProperty(i)) if (val = o[i], 'require' === i) self.require(val); - else if ('skin' === i) 'string' == typeof val && (self.skin.defaultSkin = o.skin, val = { - defaultSkin: val - }), Y.mix(self.skin, val, !0); - else if ('groups' === i) { - for(j in val)if (val.hasOwnProperty(j) && (groupName = j, group = val[j], self.addGroup(group, groupName), group.aliases)) for(a in group.aliases)group.aliases.hasOwnProperty(a) && self.addAlias(group.aliases[a], a); - } else if ('modules' === i) for(j in val)val.hasOwnProperty(j) && self.addModule(val[j], j); - else if ('aliases' === i) for(j in val)val.hasOwnProperty(j) && self.addAlias(val[j], j); - else 'gallery' === i ? this.groups.gallery.update && this.groups.gallery.update(val, o) : 'yui2' === i || '2in3' === i ? this.groups.yui2.update && this.groups.yui2.update(o['2in3'], o.yui2, o) : self[i] = val; + for(i in o)if (o.hasOwnProperty(i)) { + if (val = o[i], 'require' === i) self.require(val); + else if ('skin' === i) 'string' == typeof val && (self.skin.defaultSkin = o.skin, val = { + defaultSkin: val + }), Y.mix(self.skin, val, !0); + else if ('groups' === i) { + for(j in val)if (val.hasOwnProperty(j) && (groupName = j, group = val[j], self.addGroup(group, groupName), group.aliases)) for(a in group.aliases)group.aliases.hasOwnProperty(a) && self.addAlias(group.aliases[a], a); + } else if ('modules' === i) for(j in val)val.hasOwnProperty(j) && self.addModule(val[j], j); + else if ('aliases' === i) for(j in val)val.hasOwnProperty(j) && self.addAlias(val[j], j); + else 'gallery' === i ? this.groups.gallery.update && this.groups.gallery.update(val, o) : 'yui2' === i || '2in3' === i ? this.groups.yui2.update && this.groups.yui2.update(o['2in3'], o.yui2, o) : self[i] = val; + } } if (f = self.filter, L.isString(f) && (f = f.toUpperCase(), self.filterName = f, self.filter = self.FILTER_DEFS[f], 'DEBUG' === f && self.require('yui-log', 'dump')), self.filterName && self.coverage && 'COVERAGE' === self.filterName && L.isArray(self.coverage) && self.coverage.length) { for(i = 0; i < self.coverage.length; i++)mod3 = self.coverage[i], self.moduleInfo[mod3] && self.moduleInfo[mod3].use ? mods = [].concat(mods, self.moduleInfo[mod3].use) : mods.push(mod3); @@ -1750,10 +1756,12 @@ var YUI = function() { }, url = j, mods = comboSources[j], len = mods.length)) for(i = 0; i < len; i++)!inserted[mods[i]] && ((m1 = mods[i]) && (m1.combine || !m1.ext) ? (resCombos[j].comboSep = m1.comboSep, resCombos[j].group = m1.group, resCombos[j].maxURLLength = m1.maxURLLength, frag = (L.isValue(m1.root) ? m1.root : self.root) + (m1.path || m1.fullpath), frag = self._filter(frag, m1.name), resCombos[j][m1.type].push(frag), resCombos[j][m1.type + 'Mods'].push(m1)) : mods[i] && addSingle(mods[i])); for(j in resCombos)if (resCombos.hasOwnProperty(j)) { for(type in comboSep = resCombos[base = j].comboSep || self.comboSep, maxURLLength = resCombos[base].maxURLLength || self.maxURLLength, resCombos[base])if ('js' === type || 'css' === type) { - if (urls = resCombos[base][type], mods = resCombos[base][type + 'Mods'], len = urls.length, tmpBase = base + urls.join(comboSep), baseLen = tmpBase.length, maxURLLength <= base.length && (maxURLLength = 1024), len) if (baseLen > maxURLLength) { - for(s = 0, u = []; s < len; s++)u.push(urls[s]), (tmpBase = base + u.join(comboSep)).length > maxURLLength && (m1 = u.pop(), tmpBase = base + u.join(comboSep), resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)), u = [], m1 && u.push(m1)); - u.length && (tmpBase = base + u.join(comboSep), resolved[type].push(self._filter(tmpBase, null, resCombos[base].group))); - } else resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); + if (urls = resCombos[base][type], mods = resCombos[base][type + 'Mods'], len = urls.length, tmpBase = base + urls.join(comboSep), baseLen = tmpBase.length, maxURLLength <= base.length && (maxURLLength = 1024), len) { + if (baseLen > maxURLLength) { + for(s = 0, u = []; s < len; s++)u.push(urls[s]), (tmpBase = base + u.join(comboSep)).length > maxURLLength && (m1 = u.pop(), tmpBase = base + u.join(comboSep), resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)), u = [], m1 && u.push(m1)); + u.length && (tmpBase = base + u.join(comboSep), resolved[type].push(self._filter(tmpBase, null, resCombos[base].group))); + } else resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); + } resolved[type + 'Mods'] = resolved[type + 'Mods'].concat(mods); } } diff --git a/crates/swc_ecma_minifier/tests/terser/compress/conditionals/cond_7_1/output.js b/crates/swc_ecma_minifier/tests/terser/compress/conditionals/cond_7_1/output.js index 46ed1849a53..de4e181f9d3 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/conditionals/cond_7_1/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/conditionals/cond_7_1/output.js @@ -1,2 +1,2 @@ var x; -x = 2; +y, x = 2; diff --git a/crates/swc_ecma_minifier/tests/terser/compress/conditionals/ifs_1/output.js b/crates/swc_ecma_minifier/tests/terser/compress/conditionals/ifs_1/output.js index 42201a301bd..76af4671840 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/conditionals/ifs_1/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/conditionals/ifs_1/output.js @@ -1,3 +1,4 @@ foo && bar(); foo && bar(); foo || bar(); +foo; diff --git a/crates/swc_ecma_minifier/tests/terser/compress/switch/issue_1705_3/output.js b/crates/swc_ecma_minifier/tests/terser/compress/switch/issue_1705_3/output.js index e69de29bb2d..31142aabfe7 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/switch/issue_1705_3/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/switch/issue_1705_3/output.js @@ -0,0 +1 @@ +a; diff --git a/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_2/output.js b/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_2/output.js index 156c10fbf21..e69de29bb2d 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_2/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_2/output.js @@ -1 +0,0 @@ -(function () {})`test`; diff --git a/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_3/output.js b/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_3/output.js index 156c10fbf21..e69de29bb2d 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_3/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_3/output.js @@ -1 +0,0 @@ -(function () {})`test`; diff --git a/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_4/output.js b/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_4/output.js index 156c10fbf21..e69de29bb2d 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_4/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/template-string/tagged_template_function_inline_4/output.js @@ -1 +0,0 @@ -(function () {})`test`; diff --git a/crates/swc_ecma_transforms_optimization/src/simplify/branch/mod.rs b/crates/swc_ecma_transforms_optimization/src/simplify/branch/mod.rs index 73d0a7187f8..d84df97a41d 100644 --- a/crates/swc_ecma_transforms_optimization/src/simplify/branch/mod.rs +++ b/crates/swc_ecma_transforms_optimization/src/simplify/branch/mod.rs @@ -284,6 +284,16 @@ impl VisitMut for Remover { } } + fn visit_mut_opt_var_decl_or_expr(&mut self, n: &mut Option) { + n.visit_mut_children_with(self); + + if let Some(VarDeclOrExpr::Expr(e)) = n { + if e.is_invalid() { + *n = None; + } + } + } + fn visit_mut_pat(&mut self, p: &mut Pat) { p.visit_mut_children_with(self); @@ -483,6 +493,11 @@ impl VisitMut for Remover { // `1;` -> `;` Stmt::Expr(ExprStmt { span, expr, .. }) => { + // Directives + if let Expr::Lit(Lit::Str(..)) = &*expr { + return Stmt::Expr(ExprStmt { span, expr }); + } + let expr = *expr; match ignore_result(expr) { Some(e) => Stmt::Expr(ExprStmt { @@ -1117,7 +1132,13 @@ impl Remover { // Remove empty statements. Stmt::Empty(..) => continue, - Stmt::Expr(ExprStmt { ref expr, .. }) if expr.is_lit() && is_block_stmt => { + Stmt::Expr(ExprStmt { ref expr, .. }) + if match &**expr { + Expr::Lit(Lit::Str(..)) => false, + Expr::Lit(..) => true, + _ => false, + } && is_block_stmt => + { continue } @@ -1271,8 +1292,7 @@ fn ignore_result(e: Expr) -> Option { Expr::Lit(Lit::Num(..)) | Expr::Lit(Lit::Bool(..)) | Expr::Lit(Lit::Null(..)) - | Expr::Lit(Lit::Regex(..)) - | Expr::Ident(..) => None, + | Expr::Lit(Lit::Regex(..)) => None, Expr::Lit(Lit::Str(ref v)) if v.value.is_empty() => None, diff --git a/crates/swc_ecma_transforms_optimization/src/simplify/branch/tests.rs b/crates/swc_ecma_transforms_optimization/src/simplify/branch/tests.rs index baa6f31bf1a..65cc93a196c 100644 --- a/crates/swc_ecma_transforms_optimization/src/simplify/branch/tests.rs +++ b/crates/swc_ecma_transforms_optimization/src/simplify/branch/tests.rs @@ -76,8 +76,8 @@ fn test_fold_block() { test("{if(false)foo(); {bar()}}", "bar()"); test("{if(false)if(false)if(false)foo(); {bar()}}", "bar()"); - test("{'hi'}", ""); - test("{x==3}", ""); + test("{'hi'}", "'hi'"); + test("{x==3}", "x"); test("{`hello ${foo}`}", ""); test("{ (function(){x++}) }", ""); test_same("function f(){return;}"); @@ -86,11 +86,11 @@ fn test_fold_block() { test("{x=3;;;y=2;;;}", "x=3;y=2"); // Cases to test for empty block. - test("while(x()){x}", "while(x());"); + test("while(x()){x}", "while(x())x;"); test("while(x()){x()}", "while(x())x()"); - test("for(x=0;x<100;x++){x}", "for(x=0;x<100;x++);"); - test("for(x in y){x}", "for(x in y);"); - test("for (x of y) {x}", "for(x of y);"); + test("for(x=0;x<100;x++){x}", "for(x=0;x<100;x++)x;"); + test("for(x in y){x}", "for(x in y)x;"); + test("for (x of y) {x}", "for(x of y)x;"); test_same("for (let x = 1; x <10; x++ );"); test_same("for (var x = 1; x <10; x++ );"); } @@ -101,7 +101,7 @@ fn test_fold_block_with_declaration() { test_same("function f() {let x}"); test_same("{const x = 1}"); test_same("{x = 2; y = 4; let z;}"); - test("{'hi'; let x;}", "{let x}"); + test("{'hi'; let x;}", "{'hi'; let x}"); test("{x = 4; {let y}}", "x = 4; {let y}"); test_same("{class C {}} {class C {}}"); test("{label: var x}", "label: var x"); @@ -256,7 +256,7 @@ fn test_fold_useless_for() { fn test_fold_useless_do_1() { test("do { foo() } while(false);", "foo()"); test("do { foo() } while(void 0);", "foo()"); - test("do { foo() } while(undefined);", "foo()"); + test("do { foo() } while(undefined);", "foo(); undefined"); test("do { foo() } while(true);", "for(;;) foo();"); test("do { var a = 0; } while(false);", "var a=0"); } @@ -335,9 +335,9 @@ fn test_minimize_loop_with_constant_condition_do_while() { test("do { foo(); } while (true)", "for(;;)foo();"); test("do { foo(); } while (0)", "foo();"); test("do { foo(); } while (0.0)", "foo();"); - test("do { foo(); } while (NaN)", "foo();"); + test("do { foo(); } while (NaN)", "foo(); NaN"); test("do { foo(); } while (null)", "foo();"); - test("do { foo(); } while (undefined)", "foo();"); + test("do { foo(); } while (undefined)", "foo(); undefined"); test("do { foo(); } while ('')", "foo();"); } @@ -419,14 +419,14 @@ fn test_remove_useless_ops2() { #[test] fn test_optimize_switch_1() { - test("switch(a){}", ""); + test("switch(a){}", "a"); test("switch(foo()){}", "foo()"); - test("switch(a){default:}", ""); - test("switch(a){default:break;}", ""); - test("switch(a){default:var b;break;}", "var b"); - test("switch(a){case 1: default:}", ""); - test("switch(a){default: case 1:}", ""); - test("switch(a){default: break; case 1:break;}", ""); + test("switch(a){default:}", "a"); + test("switch(a){default:break;}", "a"); + test("switch(a){default:var b;break;}", "a;var b"); + test("switch(a){case 1: default:}", "a"); + test("switch(a){default: case 1:}", "a"); + test("switch(a){default: break; case 1:break;}", "a"); //test( // "switch(a){default: var b; break; case 1: var c; break;}", // "var c; var b;", @@ -946,12 +946,12 @@ fn test_remove_number() { #[test] fn test_remove_var_get1() { - test("a", ""); + test("a", "a"); } #[test] fn test_remove_var_get2() { - test("var a = 1;a", "var a = 1"); + test("var a = 1;a", "var a = 1; a"); } #[test] @@ -1263,9 +1263,9 @@ fn test_call_containing_spread() { // We use a function with no side-effects, otherwise the entire invocation would // be preserved. test("Math.sin(...c)", "[...c]"); - test("Math.sin(4, ...c, a)", "[...c]"); + test("Math.sin(4, ...c, a)", "[...c, a]"); test("Math.sin(foo(), ...c, bar())", "[foo(), ...c, bar()]"); - test("Math.sin(...a, b, ...c)", "[...a, ...c]"); + test("Math.sin(...a, b, ...c)", "[...a, b, ...c]"); test("Math.sin(...b, ...c)", "[...b, ...c]"); } @@ -1283,8 +1283,8 @@ fn test_new_containing_spread_1() { // We use a function with no side-effects, otherwise the entire invocation would // be preserved. test("new Date(...c)", "[...c]"); - test("new Date(4, ...c, a)", "[...c]"); - test("new Date(...a, b, ...c)", "[...a, ...c]"); + test("new Date(4, ...c, a)", "[...c, a]"); + test("new Date(...a, b, ...c)", "[...a, b, ...c]"); test("new Date(...b, ...c)", "[...b, ...c]"); } @@ -1316,7 +1316,7 @@ fn test_tagged_template_lit_substituting_template() { #[test] fn test_fold_assign() { - test("x=x", ""); + test("x=x", "x"); test_same("x=xy"); test_same("x=x + 1"); test_same("x.a=x.a"); @@ -1369,9 +1369,9 @@ fn test_array_literal() { #[test] fn test_array_literal_containing_spread() { test("([...c])", "[...c]"); - test("([4, ...c, a])", "[...c]"); + test("([4, ...c, a])", "[...c, a]"); test("([foo(), ...c, bar()])", "[foo(), ...c, bar()]"); - test("([...a, b, ...c])", "[...a, ...c]"); + test("([...a, b, ...c])", "[...a, b, ...c]"); test("([...b, ...c])", "[...b, ...c]"); } diff --git a/crates/swc_ecma_transforms_optimization/tests/simplify.rs b/crates/swc_ecma_transforms_optimization/tests/simplify.rs index c3c782397c6..ffa3f4394e7 100644 --- a/crates/swc_ecma_transforms_optimization/tests/simplify.rs +++ b/crates/swc_ecma_transforms_optimization/tests/simplify.rs @@ -644,7 +644,7 @@ test!( " function oe() { var e, t; - return e = t; + return t !== i && (e, t), e = t; } " ); diff --git a/crates/swc_node_bundler/tests/pass/issue-1328/case1/output/entry.js b/crates/swc_node_bundler/tests/pass/issue-1328/case1/output/entry.js index 78d5dcf9940..e4fc6541e5c 100644 --- a/crates/swc_node_bundler/tests/pass/issue-1328/case1/output/entry.js +++ b/crates/swc_node_bundler/tests/pass/issue-1328/case1/output/entry.js @@ -67,6 +67,7 @@ var load = __swcpack_require__.bind(void 0, function(module, exports1) { * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var runtime = function(exports) { + "use strict"; var Op = Object.prototype; var hasOwn = Op.hasOwnProperty; var undefined; // More compressible than void 0. diff --git a/crates/swc_node_bundler/tests/pass/regenerator/1/output/entry.js b/crates/swc_node_bundler/tests/pass/regenerator/1/output/entry.js index a494e21e5b2..a60f52a8187 100644 --- a/crates/swc_node_bundler/tests/pass/regenerator/1/output/entry.js +++ b/crates/swc_node_bundler/tests/pass/regenerator/1/output/entry.js @@ -67,6 +67,7 @@ var load = __swcpack_require__.bind(void 0, function(module, exports1) { * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var runtime = function(exports) { + "use strict"; var Op = Object.prototype; var hasOwn = Op.hasOwnProperty; var undefined; // More compressible than void 0.