diff --git a/crates/swc/tests/tsc-references/asyncMethodWithSuper_es5.2.minified.js b/crates/swc/tests/tsc-references/asyncMethodWithSuper_es5.2.minified.js index 3b207776cf8..5a978021cb5 100644 --- a/crates/swc/tests/tsc-references/asyncMethodWithSuper_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncMethodWithSuper_es5.2.minified.js @@ -22,9 +22,8 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; return _get(_get_prototype_of(B.prototype), _prop, _this); }; return _async_to_generator(function() { - var a, b; return _ts_generator(this, function(_state) { - return _superprop_get_x().call(_this1), _get(_get_prototype_of(B.prototype), "y", _this).call(_this1), _superprop_get("x").call(_this1), a = _superprop_get_x(), b = _superprop_get("x"), [ + return _superprop_get_x().call(_this1), _get(_get_prototype_of(B.prototype), "y", _this).call(_this1), _superprop_get("x").call(_this1), _superprop_get_x(), _superprop_get("x"), [ 2 ]; }); @@ -56,9 +55,9 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; return _set(_get_prototype_of(B.prototype), _prop, _value, _this, !0); }; return _async_to_generator(function() { - var f, a, b, ref, ref1; + var f, ref, ref1; return _ts_generator(this, function(_state) { - return f = function() {}, _superprop_get_x().call(_this1), _superprop_get("x").call(_this1), a = _superprop_get_x(), b = _superprop_get("x"), _superprop_set_x(f), _superprop_set("x", f), ref = { + return f = function() {}, _superprop_get_x().call(_this1), _superprop_get("x").call(_this1), _superprop_get_x(), _superprop_get("x"), _superprop_set_x(f), _superprop_set("x", f), ref = { f: f }, _superprop_update_x._ = ref.f, ref1 = { f: f diff --git a/crates/swc/tests/tsc-references/classStaticBlock24(module=system).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock24(module=system).2.minified.js index b1896acbd3a..23b62e91e64 100644 --- a/crates/swc/tests/tsc-references/classStaticBlock24(module=system).2.minified.js +++ b/crates/swc/tests/tsc-references/classStaticBlock24(module=system).2.minified.js @@ -3,7 +3,7 @@ System.register([ "@swc/helpers/src/_class_call_check.mjs" ], function(_export, _context) { "use strict"; - var _class_call_check, C, __; + var _class_call_check, C; return { setters: [ function(_classCallCheck) { @@ -14,10 +14,7 @@ System.register([ _export("C", C = function C() { "use strict"; _class_call_check(void 0, C); - }), __ = { - writable: !0, - value: void (C.x = 1) - }; + }), C.x = 1; } }; }); diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5.2.minified.js index 53e83717738..e2fb81b5233 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.classMethods.es5.2.minified.js @@ -28,7 +28,6 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; } return C2.prototype.f = function() { return _wrap_async_generator(function() { - var x; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -36,7 +35,7 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; 4 ]; case 1: - return x = _state.sent(), [ + return _state.sent(), [ 2 ]; } @@ -55,7 +54,6 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; } return C3.prototype.f = function() { return _wrap_async_generator(function() { - var x; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -64,7 +62,7 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; 1 ]; case 1: - return x = _state.sent(), [ + return _state.sent(), [ 2 ]; } @@ -87,7 +85,6 @@ import _ts_values from "@swc/helpers/src/_ts_values.mjs"; } return C4.prototype.f = function() { return _wrap_async_generator(function() { - var x; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -98,7 +95,7 @@ import _ts_values from "@swc/helpers/src/_ts_values.mjs"; ]), _await_async_generator)) ]; case 1: - return x = _state.sent(), [ + return _state.sent(), [ 2 ]; } @@ -121,7 +118,6 @@ import _ts_values from "@swc/helpers/src/_ts_values.mjs"; } return C5.prototype.f = function() { return _wrap_async_generator(function() { - var x; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -144,7 +140,7 @@ import _ts_values from "@swc/helpers/src/_ts_values.mjs"; })()), _await_async_generator)) ]; case 1: - return x = _state.sent(), [ + return _state.sent(), [ 2 ]; } @@ -164,7 +160,6 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; } return C6.prototype.f = function() { return _wrap_async_generator(function() { - var x; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -173,7 +168,7 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; _await_async_generator(1) ]; case 1: - return x = _state.sent(), [ + return _state.sent(), [ 2 ]; } diff --git a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5.2.minified.js b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5.2.minified.js index 11401aea6cf..ec6713842db 100644 --- a/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5.2.minified.js +++ b/crates/swc/tests/tsc-references/emitter.asyncGenerators.functionExpressions.es5.2.minified.js @@ -18,7 +18,6 @@ import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; !function() { var _ref = _wrap_async_generator(function() { - var x; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -26,7 +25,7 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; 4 ]; case 1: - return x = _state.sent(), [ + return _state.sent(), [ 2 ]; } @@ -41,7 +40,6 @@ import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; !function() { var _ref = _wrap_async_generator(function() { - var x; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -50,7 +48,7 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; 1 ]; case 1: - return x = _state.sent(), [ + return _state.sent(), [ 2 ]; } @@ -69,7 +67,6 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; import _ts_values from "@swc/helpers/src/_ts_values.mjs"; !function() { var _ref = _wrap_async_generator(function() { - var x; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -80,7 +77,7 @@ import _ts_values from "@swc/helpers/src/_ts_values.mjs"; ]), _await_async_generator)) ]; case 1: - return x = _state.sent(), [ + return _state.sent(), [ 2 ]; } @@ -99,7 +96,6 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; import _ts_values from "@swc/helpers/src/_ts_values.mjs"; !function() { var _ref = _wrap_async_generator(function() { - var x; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -122,7 +118,7 @@ import _ts_values from "@swc/helpers/src/_ts_values.mjs"; })()), _await_async_generator)) ]; case 1: - return x = _state.sent(), [ + return _state.sent(), [ 2 ]; } @@ -138,7 +134,6 @@ import _wrap_async_generator from "@swc/helpers/src/_wrap_async_generator.mjs"; import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; !function() { var _ref = _wrap_async_generator(function() { - var x; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -147,7 +142,7 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; _await_async_generator(1) ]; case 1: - return x = _state.sent(), [ + return _state.sent(), [ 2 ]; } diff --git a/crates/swc/tests/tsc-references/importCallExpressionAsyncES3CJS.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionAsyncES3CJS.2.minified.js index 59b49ab95d3..e0a4e110464 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionAsyncES3CJS.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionAsyncES3CJS.2.minified.js @@ -9,7 +9,6 @@ var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcar function cl1() {} return cl1.prototype.m = function() { return _asyncToGenerator(function() { - var req; return _tsGenerator(this, function(_state) { switch(_state.label){ case 0: @@ -20,7 +19,7 @@ var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcar }) ]; case 1: - return req = _state.sent(), [ + return _state.sent(), [ 2 ]; } diff --git a/crates/swc/tests/tsc-references/importCallExpressionAsyncES5CJS.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionAsyncES5CJS.2.minified.js index 59b49ab95d3..e0a4e110464 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionAsyncES5CJS.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionAsyncES5CJS.2.minified.js @@ -9,7 +9,6 @@ var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcar function cl1() {} return cl1.prototype.m = function() { return _asyncToGenerator(function() { - var req; return _tsGenerator(this, function(_state) { switch(_state.label){ case 0: @@ -20,7 +19,7 @@ var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcar }) ]; case 1: - return req = _state.sent(), [ + return _state.sent(), [ 2 ]; } diff --git a/crates/swc/tests/tsc-references/importCallExpressionES5System.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES5System.2.minified.js index c017c5a1922..38610528d9a 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES5System.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES5System.2.minified.js @@ -12,7 +12,7 @@ System.register([ "@swc/helpers/src/_class_call_check.mjs" ], function(_export, _context) { "use strict"; - var _class_call_check, p1, p2, C, D; + var _class_call_check; return { setters: [ function(_classCallCheck) { @@ -20,17 +20,9 @@ System.register([ } ], execute: function() { - _context.import("./0"), (p1 = _context.import("./0")).then(function(zero) { + _context.import("./0"), _context.import("./0").then(function(zero) { return zero.foo(); - }), _export("p2", p2 = _context.import("./0")), C = function() { - "use strict"; - function C() { - _class_call_check(this, C); - } - return C.prototype.method = function() { - import("./0"); - }, C; - }(), _export("D", D = function() { + }), _export("p2", _context.import("./0")), _export("D", function() { "use strict"; function D() { _class_call_check(this, D); diff --git a/crates/swc/tests/tsc-references/importCallExpressionES6System.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionES6System.2.minified.js index 9339dc6cee3..f9190dd1abd 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionES6System.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionES6System.2.minified.js @@ -9,12 +9,10 @@ System.register([], function(_export, _context) { }); //// [1.ts] System.register([], function(_export, _context) { - "use strict"; - var p1, p2; return _export("D", void 0), { setters: [], execute: function() { - _context.import("./0"), (p1 = _context.import("./0")).then((zero)=>zero.foo()), _export("p2", p2 = _context.import("./0")), _export("D", class { + _context.import("./0"), _context.import("./0").then((zero)=>zero.foo()), _export("p2", _context.import("./0")), _export("D", class { method() { _context.import("./0"); } diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem1.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem1.2.minified.js index 8547731ea9e..da3f2c37ba2 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem1.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem1.2.minified.js @@ -9,12 +9,10 @@ System.register([], function(_export, _context) { }); //// [1.ts] System.register([], function(_export, _context) { - "use strict"; - var p1, p2; return { setters: [], execute: function() { - _context.import("./0"), (p1 = _context.import("./0")).then((zero)=>zero.foo()), _export("p2", p2 = _context.import("./0")); + _context.import("./0"), _context.import("./0").then((zero)=>zero.foo()), _export("p2", _context.import("./0")); } }; }); diff --git a/crates/swc/tests/tsc-references/importCallExpressionInSystem4.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionInSystem4.2.minified.js index 5551538f512..f785884a1fb 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionInSystem4.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionInSystem4.2.minified.js @@ -34,23 +34,10 @@ System.register([], function(_export, _context) { }); //// [2.ts] System.register([], function(_export, _context) { - "use strict"; - var C, D; return _export("D", void 0), { setters: [], execute: async function() { - C = class { - myModule = _context.import("./0"); - method() { - _context.import("./0"), this.myModule.then((Zero)=>{ - console.log(Zero.foo()); - }, async (err)=>{ - console.log(err); - let one = await import("./1"); - console.log(one.backup()); - }); - } - }, _export("D", D = class { + _export("D", class { myModule = _context.import("./0"); method() { _context.import("./0"), this.myModule.then((Zero)=>{ diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem.2.minified.js index f147b6ecca7..6d03de6a9ee 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem.2.minified.js @@ -11,12 +11,10 @@ System.register([], function(_export, _context) { System.register([ "@swc/helpers/src/_async_to_generator.mjs" ], function(_export, _context) { - "use strict"; - var _async_to_generator; return { setters: [ function(_asyncToGenerator) { - _async_to_generator = _asyncToGenerator.default; + _asyncToGenerator.default; } ], execute: function() {} diff --git a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2.2.minified.js b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2.2.minified.js index 9a0cc93e257..1853dc53695 100644 --- a/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2.2.minified.js +++ b/crates/swc/tests/tsc-references/importCallExpressionNestedSystem2.2.minified.js @@ -12,15 +12,13 @@ System.register([ "@swc/helpers/src/_async_to_generator.mjs", "@swc/helpers/src/_ts_generator.mjs" ], function(_export, _context) { - "use strict"; - var _async_to_generator, _ts_generator; return { setters: [ function(_asyncToGenerator) { - _async_to_generator = _asyncToGenerator.default; + _asyncToGenerator.default; }, function(_tsGenerator) { - _ts_generator = _tsGenerator.default; + _tsGenerator.default; } ], execute: function() {} diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).2.minified.js index a7d300cffef..cd84d5ccd87 100644 --- a/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).2.minified.js @@ -6,8 +6,9 @@ var _name = new WeakMap(); console.log(new class { getValue(x) { var _y = new WeakMap(); + let tmp = _class_private_field_get(this, _name); return new class { - [_class_private_field_get(this, _name)]() { + [tmp]() { return x + _class_private_field_get(this, _y); } constructor(){ diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2022).2.minified.js index b6227c949ce..15b854057fd 100644 --- a/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2022).2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2022).2.minified.js @@ -5,12 +5,13 @@ console.log(new class { this.#name = name; } getValue(x) { + let obj = this; class Bar { #y = 100; - [this.#name]() { + [obj.#name]() { return x + this.#y; } } - return new Bar()[this.#name](); + return new Bar()[obj.#name](); } }("NAME").getValue(100)); diff --git a/crates/swc/tests/tsc-references/privateNameEmitHelpers.2.minified.js b/crates/swc/tests/tsc-references/privateNameEmitHelpers.2.minified.js index 7bd27e53382..bf5423a930c 100644 --- a/crates/swc/tests/tsc-references/privateNameEmitHelpers.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameEmitHelpers.2.minified.js @@ -9,14 +9,15 @@ export class C { constructor(){ _class_private_method_init(this, _b), _class_private_field_init(this, _c, { get: void 0, - set: function(v) { - _class_private_field_set(this, _a, _class_private_field_get(this, _a) + v); - } + set: set_c }), _class_private_field_init(this, _a, { writable: !0, value: 1 }); } } +function set_c(v) { + _class_private_field_set(this, _a, _class_private_field_get(this, _a) + v); +} //// [tslib.d.ts] export { }; diff --git a/crates/swc/tests/tsc-references/privateNameMethodClassExpression.2.minified.js b/crates/swc/tests/tsc-references/privateNameMethodClassExpression.2.minified.js index 95ff3b51ccf..712854a58d7 100644 --- a/crates/swc/tests/tsc-references/privateNameMethodClassExpression.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameMethodClassExpression.2.minified.js @@ -14,10 +14,11 @@ let C = (_field = new WeakMap(), _method = new WeakSet(), class { constructor(){ _class_private_method_init(this, _method), _class_private_field_init(this, _field, { writable: !0, - value: _class_private_method_get(this, _method, function() { - return 42; - }).call(this) + value: _class_private_method_get(this, _method, method).call(this) }); } }); +function method() { + return 42; +} console.log(C.getInstance().getField()), C.getInstance().#method, C.getInstance().#field; diff --git a/crates/swc/tests/tsc-references/privateNameNotAccessibleOutsideDefiningClass.2.minified.js b/crates/swc/tests/tsc-references/privateNameNotAccessibleOutsideDefiningClass.2.minified.js index be52e952be5..369b03222b6 100644 --- a/crates/swc/tests/tsc-references/privateNameNotAccessibleOutsideDefiningClass.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameNotAccessibleOutsideDefiningClass.2.minified.js @@ -1,8 +1,9 @@ //// [privateNameNotAccessibleOutsideDefiningClass.ts] import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; +var _foo = new WeakMap(); new class { constructor(){ - _class_private_field_init(this, new WeakMap(), { + _class_private_field_init(this, _foo, { writable: !0, value: 3 }); diff --git a/crates/swc/tests/tsc-references/privateNameSetterExprReturnValue.2.minified.js b/crates/swc/tests/tsc-references/privateNameSetterExprReturnValue.2.minified.js index bd0004bdd3b..3cd9c395e73 100644 --- a/crates/swc/tests/tsc-references/privateNameSetterExprReturnValue.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameSetterExprReturnValue.2.minified.js @@ -2,6 +2,7 @@ import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; import _class_private_field_set from "@swc/helpers/src/_class_private_field_set.mjs"; var _foo = new WeakMap(); +function set_foo(a) {} new class { bar() { let x = _class_private_field_set(this, _foo, 84); @@ -10,7 +11,7 @@ new class { constructor(){ _class_private_field_init(this, _foo, { get: void 0, - set: function(a) {} + set: set_foo }); } }().bar(); diff --git a/crates/swc/tests/tsc-references/privateNameSetterNoGetter.2.minified.js b/crates/swc/tests/tsc-references/privateNameSetterNoGetter.2.minified.js index 5448296edff..0defd0f8eff 100644 --- a/crates/swc/tests/tsc-references/privateNameSetterNoGetter.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameSetterNoGetter.2.minified.js @@ -10,8 +10,9 @@ let C = (_x = new WeakMap(), class { constructor(){ _class_private_field_init(this, _x, { get: void 0, - set: function(x) {} + set: set_x }); } }); +function set_x(x) {} console.log(new C().m()); diff --git a/crates/swc/tests/tsc-references/privateNameUnused.2.minified.js b/crates/swc/tests/tsc-references/privateNameUnused.2.minified.js index b6484525c59..8979312dacf 100644 --- a/crates/swc/tests/tsc-references/privateNameUnused.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameUnused.2.minified.js @@ -18,24 +18,27 @@ export class A { var _used1 = new WeakSet(), _unused1 = new WeakSet(); export class A2 { constructor(){ - _class_private_method_init(this, _used1), _class_private_method_init(this, _unused1), console.log(_class_private_method_get(this, _used1, function() {}).call(this)); + _class_private_method_init(this, _used1), _class_private_method_init(this, _unused1), console.log(_class_private_method_get(this, _used1, used).call(this)); } } +function used() {} var _used2 = new WeakMap(), _unused2 = new WeakMap(); export class A3 { constructor(){ _class_private_field_init(this, _used2, { get: get_used, - set: function(value) {} + set: set_used }), _class_private_field_init(this, _unused2, { get: get_unused, - set: function(value) {} + set: set_unused }), console.log(_class_private_field_get(this, _used2)); } } function get_used() { return 0; } +function set_used(value) {} function get_unused() { return 0; } +function set_unused(value) {} diff --git a/crates/swc/tests/tsc-references/privateNamesAndGenericClasses-2.2.minified.js b/crates/swc/tests/tsc-references/privateNamesAndGenericClasses-2.2.minified.js index 02a5a1efd92..6adf3fd2088 100644 --- a/crates/swc/tests/tsc-references/privateNamesAndGenericClasses-2.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesAndGenericClasses-2.2.minified.js @@ -16,10 +16,11 @@ class C { _class_private_method_init(this, _bar), _class_private_field_init(this, _foo, { writable: !0, value: void 0 - }), _class_private_field_set(this, _foo, t), t = _class_private_method_get(this, _bar, function() { - return _class_private_field_get(this, _foo); - }).call(this); + }), _class_private_field_set(this, _foo, t), t = _class_private_method_get(this, _bar, bar).call(this); } } +function bar() { + return _class_private_field_get(this, _foo); +} let a = new C(3), b = new C("hello"); a.baz = 5, a.baz, a.#foo, b = a = b; diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-1.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-1.2.minified.js index 87830cd5800..968bf3ef474 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-1.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-1.2.minified.js @@ -1,8 +1,9 @@ //// [privateNamesUnique-1.ts] import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; +var _foo = new WeakMap(); new class { constructor(){ - _class_private_field_init(this, new WeakMap(), { + _class_private_field_init(this, _foo, { writable: !0, value: void 0 }); diff --git a/crates/swc/tests/tsc-references/privateNamesUnique-5.2.minified.js b/crates/swc/tests/tsc-references/privateNamesUnique-5.2.minified.js index 413594581f7..e5db5a7ab19 100644 --- a/crates/swc/tests/tsc-references/privateNamesUnique-5.2.minified.js +++ b/crates/swc/tests/tsc-references/privateNamesUnique-5.2.minified.js @@ -1,8 +1,9 @@ //// [privateNamesUnique-5.ts] import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; +var _foo = new WeakMap(); new class { constructor(){ - _class_private_field_init(this, new WeakMap(), { + _class_private_field_init(this, _foo, { writable: !0, value: void 0 }); diff --git a/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead.2.minified.js b/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead.2.minified.js index a5aa4e37b8b..a046a5cb22e 100644 --- a/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead.2.minified.js +++ b/crates/swc/tests/tsc-references/privateWriteOnlyAccessorRead.2.minified.js @@ -5,6 +5,10 @@ import _class_private_field_set from "@swc/helpers/src/_class_private_field_set. import _extends from "@swc/helpers/src/_extends.mjs"; import _class_private_field_destructure from "@swc/helpers/src/_class_private_field_destructure.mjs"; var _value = new WeakMap(), _valueRest = new WeakMap(), _valueOne = new WeakMap(), _valueCompound = new WeakMap(); +function set_value(v) {} +function set_valueRest(v) {} +function set_valueOne(v) {} +function set_valueCompound(v) {} new class { m() { var _tmp, _tmp1; @@ -34,16 +38,16 @@ new class { constructor(){ _class_private_field_init(this, _value, { get: void 0, - set: function(v) {} + set: set_value }), _class_private_field_init(this, _valueRest, { get: void 0, - set: function(v) {} + set: set_valueRest }), _class_private_field_init(this, _valueOne, { get: void 0, - set: function(v) {} + set: set_valueOne }), _class_private_field_init(this, _valueCompound, { get: void 0, - set: function(v) {} + set: set_valueCompound }); } }().m(); diff --git a/crates/swc/tests/tsc-references/symbolDeclarationEmit11.2.minified.js b/crates/swc/tests/tsc-references/symbolDeclarationEmit11.2.minified.js index 869ffc4c03e..6e01549ae48 100644 --- a/crates/swc/tests/tsc-references/symbolDeclarationEmit11.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolDeclarationEmit11.2.minified.js @@ -1,8 +1,9 @@ //// [symbolDeclarationEmit11.ts] +let _isConcatSpreadable = Symbol.isConcatSpreadable, _toPrimitive = Symbol.toPrimitive, _toPrimitive1 = Symbol.toPrimitive; (class { - static [Symbol.isConcatSpreadable]() {} - static get [Symbol.toPrimitive]() { + static [_isConcatSpreadable]() {} + static get [_toPrimitive]() { return ""; } - static set [Symbol.toPrimitive](x) {} + static set [_toPrimitive1](x) {} })[Symbol.iterator] = 0; diff --git a/crates/swc/tests/tsc-references/typeGuardsInModule.2.minified.js b/crates/swc/tests/tsc-references/typeGuardsInModule.2.minified.js index af127631f0c..863fd7d26c8 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInModule.2.minified.js +++ b/crates/swc/tests/tsc-references/typeGuardsInModule.2.minified.js @@ -1,12 +1,12 @@ //// [typeGuardsInModule.ts] -var num, var1, m1, m2, m3; +var var1, m1, m2, m3; !function(m1) { var var2, var3; - num = "string" == typeof var1 && var1.length, "string" == typeof var2 && (num = var2.length), m1.var3 = var3; + "string" == typeof var1 && var1.length, "string" == typeof var2 && var2.length, m1.var3 = var3; }(m1 || (m1 = {})), function(m2) { var var2, var3, m3, m31, var4, var5; - m31 = m3 || (m3 = {}), num = "string" == typeof var1 && var1.length, num = "string" == typeof var2 && var2.length, "string" == typeof var4 && (num = var4.length), m31.var5 = var5, m2.var3 = var3; + m31 = m3 || (m3 = {}), "string" == typeof var1 && var1.length, "string" == typeof var2 && var2.length, "string" == typeof var4 && var4.length, m31.var5 = var5, m2.var3 = var3; }(m2 || (m2 = {})), function(m3) { var m4, var2, var3; - m4 = m3.m4 || (m3.m4 = {}), num = "string" == typeof var1 && var1.length, "string" == typeof var2 && (num = var2.length), m4.var3 = var3; + m4 = m3.m4 || (m3.m4 = {}), "string" == typeof var1 && var1.length, "string" == typeof var2 && var2.length, m4.var3 = var3; }(m3 || (m3 = {})); diff --git a/crates/swc/tests/tsc-references/typeGuardsObjectMethods.2.minified.js b/crates/swc/tests/tsc-references/typeGuardsObjectMethods.2.minified.js index 7b4663d5831..5bee91a9627 100644 --- a/crates/swc/tests/tsc-references/typeGuardsObjectMethods.2.minified.js +++ b/crates/swc/tests/tsc-references/typeGuardsObjectMethods.2.minified.js @@ -1,16 +1,16 @@ //// [typeGuardsObjectMethods.ts] -var num, strOrNum, var1, obj1 = { +var strOrNum, var1, obj1 = { method: function(param1) { var var2; - return num = "string" == typeof var1 && var1.length, num = "string" == typeof var2 && var2.length, num = "string" == typeof param1 && param1.length, strOrNum; + return "string" == typeof var1 && var1.length, "string" == typeof var2 && var2.length, "string" == typeof param1 && param1.length, strOrNum; }, get prop () { var var2; - return num = "string" == typeof var1 && var1.length, num = "string" == typeof var2 && var2.length, strOrNum; + return "string" == typeof var1 && var1.length, "string" == typeof var2 && var2.length, strOrNum; }, set prop (param){ var var21; - num = "string" == typeof var1 && var1.length, num = "string" == typeof var21 && var21.length, num = "string" == typeof param && param.length; + "string" == typeof var1 && var1.length, "string" == typeof var21 && var21.length, "string" == typeof param && param.length; } }; strOrNum = "string" == typeof obj1.method(strOrNum) && obj1.method(strOrNum), strOrNum = "string" == typeof obj1.prop && obj1.prop; diff --git a/crates/swc/tests/vercel/full/next-31419/1/output/index.js b/crates/swc/tests/vercel/full/next-31419/1/output/index.js index a7f0ae8a165..490b5818f6b 100644 --- a/crates/swc/tests/vercel/full/next-31419/1/output/index.js +++ b/crates/swc/tests/vercel/full/next-31419/1/output/index.js @@ -17,7 +17,7 @@ Promise.all(assignAll).then(function() { listOfUser(t.id) ]; case 1: - return (e = n.sent()).forEach(function(r) { + return n.sent().forEach(function(r) { insertQuery += 'INSERT INTO "TABLE"("UUID", id, other_ids_here) VALUES (\''.concat(uuidv4(), "', '").concat(t.id, "', now());"); }), [ 2 diff --git a/crates/swc/tests/vercel/full/next-33088/output/index.js b/crates/swc/tests/vercel/full/next-33088/output/index.js index a6c4bb88012..4837b62cef9 100644 --- a/crates/swc/tests/vercel/full/next-33088/output/index.js +++ b/crates/swc/tests/vercel/full/next-33088/output/index.js @@ -14,8 +14,8 @@ export default function i() { function t() { return (t = r(function() { var r, t; - return e(this, function(e) { - switch(e.label){ + return e(this, function(r) { + switch(r.label){ case 0: return [ 4, @@ -24,10 +24,10 @@ export default function i() { case 1: return [ 4, - (r = e.sent()).json() + r.sent().json() ]; case 2: - return u(t = e.sent()), [ + return u(r.sent()), [ 2 ]; } diff --git a/crates/swc/tests/vercel/full/utf8-1/output/index.js b/crates/swc/tests/vercel/full/utf8-1/output/index.js index 6d55d660097..b1e4a3cd8fe 100644 --- a/crates/swc/tests/vercel/full/utf8-1/output/index.js +++ b/crates/swc/tests/vercel/full/utf8-1/output/index.js @@ -9,15 +9,15 @@ var s = o.assetPrefix, i = o.page, $ = null, u = __webpack_hash__, d = (s = s || function p() { return (p = e(function() { var e, a, r, n, c; - return t(this, function(t) { - switch(t.label){ + return t(this, function(e) { + switch(e.label){ case 0: if (!($ !== __webpack_hash__) || "idle" !== module.hot.status()) return [ 2 ]; - t.label = 1; + e.label = 1; case 1: - return t.trys.push([ + return e.trys.push([ 1, 4, , @@ -29,17 +29,17 @@ function p() { case 2: return [ 4, - (e = t.sent()).json() + e.sent().json() ]; case 3: - return a = t.sent(), r = "/" === i ? "index" : i, (n = (Array.isArray(a.c) ? a.c : Object.keys(a.c)).some(function(e) { + return a = e.sent(), r = "/" === i ? "index" : i, (Array.isArray(a.c) ? a.c : Object.keys(a.c)).some(function(e) { return -1 !== e.indexOf("pages".concat(r.startsWith("/") ? r : "/".concat(r))) || -1 !== e.indexOf("pages".concat(r.startsWith("/") ? r : "/".concat(r)).replace(/\//g, "\\")); - })) ? document.location.reload(!0) : u = $, [ + }) ? document.location.reload(!0) : u = $, [ 3, 5 ]; case 4: - return c = t.sent(), console.error("Error occurred checking for update", c), document.location.reload(!0), [ + return c = e.sent(), console.error("Error occurred checking for update", c), document.location.reload(!0), [ 3, 5 ]; diff --git a/crates/swc_ecma_minifier/src/analyzer/mod.rs b/crates/swc_ecma_minifier/src/analyzer/mod.rs index c186dc71d58..d091c511a77 100644 --- a/crates/swc_ecma_minifier/src/analyzer/mod.rs +++ b/crates/swc_ecma_minifier/src/analyzer/mod.rs @@ -577,7 +577,7 @@ where n.super_class.visit_with(&mut *self.with_ctx(ctx)); } - n.body.visit_with(self); + self.with_child(n.span.ctxt, ScopeKind::Fn, |child| n.body.visit_with(child)) } #[cfg_attr(feature = "debug", tracing::instrument(skip(self, n)))] diff --git a/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs b/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs index d66c79222a1..ae71559ab19 100644 --- a/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs +++ b/crates/swc_ecma_minifier/src/analyzer/storage/normal.rs @@ -232,7 +232,9 @@ impl ProgramData { e.used_in_cond |= ctx.in_cond; if is_modify && ctx.is_exact_reassignment { - e.assign_count += 1; + if is_first { + e.assign_count += 1; + } if ctx.is_op_assign { e.usage_count += 1; diff --git a/crates/swc_ecma_minifier/src/compress/optimize/unused.rs b/crates/swc_ecma_minifier/src/compress/optimize/unused.rs index efd80d87220..a798d099cf8 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/unused.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/unused.rs @@ -688,7 +688,8 @@ where } if let Some(var) = self.data.vars.get(&i.to_id()) { - if var.is_fn_local + // technically this is inline + if !var.inline_prevented && var.usage_count == 0 && var.declared && (!var.declared_as_fn_param || !used_arguments || self.ctx.in_strict) diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2011/reduced/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/2011/reduced/analysis-snapshot.rust-debug index 4689a0ee8c7..f07d92bf24b 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2011/reduced/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2011/reduced/analysis-snapshot.rust-debug @@ -24,8 +24,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2011/reduced/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2011/reduced/output.js index e57374cdda5..399d1ff7f26 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2011/reduced/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2011/reduced/output.js @@ -1,6 +1,7 @@ +class ClassA { +} module.exports = class ClassB { - static MyA = class { - }; + static MyA = ClassA; it() { this.bb = new ClassB.MyA(); } diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/analysis-snapshot.rust-debug index 59057ce232d..40674ffa827 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/analysis-snapshot.rust-debug @@ -10659,7 +10659,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -12991,7 +12991,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 4, usage_count: 62, reassigned_with_assignment: false, @@ -16155,7 +16155,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -18945,7 +18945,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -18983,7 +18983,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 8, reassigned_with_assignment: false, @@ -22927,7 +22927,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -23121,7 +23121,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: true, @@ -24503,7 +24503,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 126, reassigned_with_assignment: false, @@ -27803,7 +27803,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 14, reassigned_with_assignment: false, @@ -28707,7 +28707,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -36577,7 +36577,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -36851,7 +36851,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -37867,7 +37867,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -38175,7 +38175,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -38733,7 +38733,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -41201,7 +41201,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -41395,7 +41395,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -47761,7 +47761,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -49333,7 +49333,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -49643,7 +49643,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 7, usage_count: 12, reassigned_with_assignment: true, @@ -50895,7 +50895,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -54359,7 +54359,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 8, reassigned_with_assignment: false, @@ -56547,7 +56547,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 8, reassigned_with_assignment: false, @@ -56975,7 +56975,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -59727,7 +59727,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -60241,7 +60241,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 3, usage_count: 11, reassigned_with_assignment: true, @@ -61825,7 +61825,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -63151,7 +63151,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 9, + assign_count: 0, mutation_by_call_count: 1, usage_count: 13, reassigned_with_assignment: false, @@ -63461,7 +63461,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 13, + assign_count: 4, mutation_by_call_count: 4, usage_count: 12, reassigned_with_assignment: true, @@ -65961,7 +65961,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: false, @@ -115401,7 +115401,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -122909,7 +122909,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -126225,7 +126225,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: true, @@ -126607,7 +126607,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -129581,7 +129581,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 20, usage_count: 20, reassigned_with_assignment: false, @@ -129657,7 +129657,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 4, usage_count: 7, reassigned_with_assignment: true, @@ -130645,7 +130645,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -131105,7 +131105,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: false, @@ -133853,7 +133853,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: true, @@ -135189,7 +135189,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 10, + assign_count: 9, mutation_by_call_count: 4, usage_count: 15, reassigned_with_assignment: true, @@ -135493,7 +135493,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -135797,7 +135797,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 21, usage_count: 37, reassigned_with_assignment: false, @@ -135873,7 +135873,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 0, mutation_by_call_count: 12, usage_count: 21, reassigned_with_assignment: false, @@ -135911,7 +135911,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -136141,7 +136141,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -136257,7 +136257,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -136449,7 +136449,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -136565,7 +136565,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -136643,7 +136643,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 6, usage_count: 8, reassigned_with_assignment: true, @@ -139047,7 +139047,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -148463,7 +148463,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -153523,7 +153523,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -156879,7 +156879,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 8, usage_count: 14, reassigned_with_assignment: true, @@ -158073,7 +158073,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -160161,7 +160161,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 6, reassigned_with_assignment: false, @@ -160583,7 +160583,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 6, usage_count: 9, reassigned_with_assignment: false, @@ -161275,7 +161275,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -163195,7 +163195,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 12, reassigned_with_assignment: false, @@ -165271,7 +165271,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -165615,7 +165615,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 4, usage_count: 9, reassigned_with_assignment: true, @@ -166155,7 +166155,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 3, mutation_by_call_count: 6, usage_count: 8, reassigned_with_assignment: true, @@ -166347,7 +166347,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 2, usage_count: 12, reassigned_with_assignment: true, @@ -166423,7 +166423,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -166697,7 +166697,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -168155,7 +168155,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -169975,7 +169975,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: false, @@ -176131,7 +176131,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: true, @@ -176285,7 +176285,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -176519,7 +176519,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 7, reassigned_with_assignment: false, @@ -177303,7 +177303,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 1, usage_count: 9, reassigned_with_assignment: true, @@ -177383,7 +177383,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: false, @@ -177539,7 +177539,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -177731,7 +177731,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: true, @@ -179553,7 +179553,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 6, usage_count: 6, reassigned_with_assignment: false, @@ -180213,7 +180213,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -180561,7 +180561,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -181525,7 +181525,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: true, @@ -181565,7 +181565,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 9, + assign_count: 6, mutation_by_call_count: 2, usage_count: 24, reassigned_with_assignment: true, @@ -181681,7 +181681,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 4, mutation_by_call_count: 1, usage_count: 26, reassigned_with_assignment: true, @@ -181721,7 +181721,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 10, usage_count: 22, reassigned_with_assignment: true, @@ -181919,7 +181919,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 9, + assign_count: 5, mutation_by_call_count: 7, usage_count: 28, reassigned_with_assignment: true, @@ -181959,7 +181959,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -181999,7 +181999,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -182039,7 +182039,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -182079,7 +182079,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -182119,7 +182119,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: true, @@ -182159,7 +182159,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 8, reassigned_with_assignment: true, @@ -182199,7 +182199,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -182319,7 +182319,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: true, @@ -182397,7 +182397,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 6, usage_count: 13, reassigned_with_assignment: true, @@ -183245,7 +183245,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -183325,7 +183325,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -183599,7 +183599,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -184219,7 +184219,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -184259,7 +184259,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -184337,7 +184337,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -193741,7 +193741,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 35, reassigned_with_assignment: false, @@ -196457,7 +196457,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -199927,7 +199927,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 7, usage_count: 12, reassigned_with_assignment: false, @@ -202753,7 +202753,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -202831,7 +202831,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -202909,7 +202909,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, @@ -203491,7 +203491,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -206849,7 +206849,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: true, @@ -207049,7 +207049,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 4, usage_count: 22, reassigned_with_assignment: true, @@ -207209,7 +207209,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 5, mutation_by_call_count: 2, usage_count: 9, reassigned_with_assignment: true, @@ -207289,7 +207289,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: true, @@ -207449,7 +207449,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 0, usage_count: 9, reassigned_with_assignment: true, @@ -208151,7 +208151,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -210103,7 +210103,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 7, reassigned_with_assignment: false, @@ -210257,7 +210257,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -216585,7 +216585,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -218481,7 +218481,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 12, reassigned_with_assignment: true, @@ -218679,7 +218679,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -219501,7 +219501,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -220173,7 +220173,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 7, usage_count: 7, reassigned_with_assignment: false, @@ -220211,7 +220211,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 7, usage_count: 7, reassigned_with_assignment: false, @@ -220327,7 +220327,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -220407,7 +220407,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 10, reassigned_with_assignment: false, @@ -221231,7 +221231,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, @@ -221471,7 +221471,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: true, @@ -221551,7 +221551,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: true, @@ -221709,7 +221709,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 2, mutation_by_call_count: 0, usage_count: 7, reassigned_with_assignment: true, @@ -221789,7 +221789,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -224899,7 +224899,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -224979,7 +224979,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -226611,7 +226611,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -226651,7 +226651,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -226729,7 +226729,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -226963,7 +226963,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -238017,7 +238017,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -238097,7 +238097,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: false, @@ -239241,7 +239241,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -239989,7 +239989,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 2, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -240305,7 +240305,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -240505,7 +240505,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -240545,7 +240545,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 2, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -244787,7 +244787,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -250477,7 +250477,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: true, @@ -250907,7 +250907,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -251141,7 +251141,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -251925,7 +251925,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -252751,7 +252751,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -252789,7 +252789,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -252827,7 +252827,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -253467,7 +253467,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -253507,7 +253507,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -253947,7 +253947,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 3, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: true, @@ -256319,7 +256319,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: false, @@ -266057,7 +266057,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: true, @@ -266213,7 +266213,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 2, usage_count: 7, reassigned_with_assignment: true, @@ -266289,7 +266289,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 0, usage_count: 7, reassigned_with_assignment: true, @@ -266529,7 +266529,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -266649,7 +266649,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: true, @@ -266729,7 +266729,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -266807,7 +266807,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 5, usage_count: 22, reassigned_with_assignment: true, @@ -266967,7 +266967,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 1, usage_count: 8, reassigned_with_assignment: true, @@ -267007,7 +267007,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -267087,7 +267087,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -275851,7 +275851,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: false, @@ -280343,7 +280343,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -287395,7 +287395,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -288269,7 +288269,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -291497,7 +291497,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -299909,7 +299909,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -299947,7 +299947,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -300105,7 +300105,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -300305,7 +300305,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 1, usage_count: 14, reassigned_with_assignment: true, @@ -300385,7 +300385,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 6, mutation_by_call_count: 3, usage_count: 12, reassigned_with_assignment: true, @@ -300425,7 +300425,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 8, reassigned_with_assignment: true, @@ -300621,7 +300621,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -300779,7 +300779,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 3, mutation_by_call_count: 4, usage_count: 9, reassigned_with_assignment: true, @@ -309075,7 +309075,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -309313,7 +309313,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 4, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -309629,7 +309629,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 6, usage_count: 7, reassigned_with_assignment: false, @@ -310933,7 +310933,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 5, reassigned_with_assignment: false, @@ -311369,7 +311369,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -311489,7 +311489,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -312363,7 +312363,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -317825,7 +317825,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -320303,7 +320303,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -322859,7 +322859,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -334027,7 +334027,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -334583,7 +334583,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -337523,7 +337523,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -340975,7 +340975,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -342533,7 +342533,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -348197,7 +348197,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -350575,7 +350575,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -350693,7 +350693,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 4, usage_count: 25, reassigned_with_assignment: true, @@ -352607,7 +352607,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -352801,7 +352801,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 9, reassigned_with_assignment: false, @@ -356309,7 +356309,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -356545,7 +356545,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 5, usage_count: 13, reassigned_with_assignment: true, @@ -356623,7 +356623,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -357883,7 +357883,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -365159,7 +365159,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: true, @@ -366023,7 +366023,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -367409,7 +367409,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -367959,7 +367959,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 6, reassigned_with_assignment: true, @@ -369027,7 +369027,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: false, @@ -376101,7 +376101,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -376141,7 +376141,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -376859,7 +376859,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -378097,7 +378097,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -378293,7 +378293,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -378485,7 +378485,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -378525,7 +378525,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -385079,7 +385079,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 7, reassigned_with_assignment: false, @@ -385673,7 +385673,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -396065,7 +396065,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -397087,7 +397087,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -397201,7 +397201,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -397277,7 +397277,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -402281,7 +402281,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -405481,7 +405481,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: true, @@ -406265,7 +406265,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: false, @@ -407353,7 +407353,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -408743,7 +408743,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 13, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -411841,7 +411841,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: true, @@ -412079,7 +412079,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -412119,7 +412119,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -412159,7 +412159,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -412239,7 +412239,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -412635,7 +412635,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -413315,7 +413315,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -413795,7 +413795,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -414067,7 +414067,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -414107,7 +414107,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -414187,7 +414187,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -414787,7 +414787,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -415307,7 +415307,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -415465,7 +415465,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -416385,7 +416385,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -416425,7 +416425,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -417773,7 +417773,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -417813,7 +417813,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -418449,7 +418449,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 6, usage_count: 6, reassigned_with_assignment: false, @@ -421269,7 +421269,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 5, mutation_by_call_count: 8, usage_count: 9, reassigned_with_assignment: true, @@ -421309,7 +421309,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 5, mutation_by_call_count: 6, usage_count: 19, reassigned_with_assignment: true, @@ -421349,7 +421349,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 5, usage_count: 14, reassigned_with_assignment: true, @@ -421549,7 +421549,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -421945,7 +421945,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -422533,7 +422533,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 117, usage_count: 272, reassigned_with_assignment: false, @@ -426575,7 +426575,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -426695,7 +426695,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -433897,7 +433897,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -434639,7 +434639,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -434759,7 +434759,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 0, usage_count: 11, reassigned_with_assignment: true, @@ -434839,7 +434839,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -439929,7 +439929,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -440521,7 +440521,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -441263,7 +441263,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 87, usage_count: 87, reassigned_with_assignment: false, @@ -441341,7 +441341,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -441969,7 +441969,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -442289,7 +442289,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 5, usage_count: 16, reassigned_with_assignment: true, @@ -442329,7 +442329,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 5, usage_count: 9, reassigned_with_assignment: true, @@ -442605,7 +442605,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js index a348c965297..6b50641459f 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js @@ -546,18 +546,18 @@ var ref = _react.useState(window.__ICE_PAGE_PROPS__), data = ref[0], setData = ref[1]; return _react.useEffect(function() { title && (document.title = title), scrollToTop && window.scrollTo(0, 0), window.__ICE_PAGE_PROPS__ ? window.__ICE_PAGE_PROPS__ = null : PageComponent.getInitialProps && swcHelpers.asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() { - var _location, href, origin, pathname, search, curPath, query, ssrError, initialContext, result; + var _location, href, origin, pathname, search, initialContext; return _regeneratorRuntime.default.wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){ case 0: return href = (_location = window.location).href, origin = _location.origin, pathname = _location.pathname, search = _location.search, initialContext = { pathname: pathname, - path: curPath = href.replace(origin, ""), - query: query = queryString.parse(search), - ssrError: ssrError = window.__ICE_SSR_ERROR__ + path: href.replace(origin, ""), + query: queryString.parse(search), + ssrError: window.__ICE_SSR_ERROR__ }, _ctx.next = 7, PageComponent.getInitialProps(initialContext); case 7: - setData(result = _ctx.sent); + setData(_ctx.sent); case 9: case "end": return _ctx.stop(); @@ -4663,7 +4663,7 @@ }, 41075: function(module) { "use strict"; - var base = 36, regexNonASCII = /[^\0-\u007E]/, regexSeparators = /[.\u3002\uFF0E\uFF61]/g, OVERFLOW_ERROR = "Overflow: input needs wider integers to process", baseMinusTMin = base - 1, floor = Math.floor, stringFromCharCode = String.fromCharCode, ucs2decode = function(string) { + var regexNonASCII = /[^\0-\u007E]/, regexSeparators = /[.\u3002\uFF0E\uFF61]/g, OVERFLOW_ERROR = "Overflow: input needs wider integers to process", floor = Math.floor, stringFromCharCode = String.fromCharCode, ucs2decode = function(string) { for(var output = [], counter = 0, length = string.length; counter < length;){ var value = string.charCodeAt(counter++); if (value >= 0xd800 && value <= 0xdbff && counter < length) { @@ -4676,8 +4676,8 @@ return digit + 22 + 75 * (digit < 26); }, adapt = function(delta, numPoints, firstTime) { var k = 0; - for(delta = firstTime ? floor(delta / 700) : delta >> 1, delta += floor(delta / numPoints); delta > 26 * baseMinusTMin >> 1; k += base)delta = floor(delta / baseMinusTMin); - return floor(k + (baseMinusTMin + 1) * delta / (delta + 38)); + for(delta = firstTime ? floor(delta / 700) : delta >> 1, delta += floor(delta / numPoints); delta > 455; k += 36)delta = floor(delta / 35); + return floor(k + 36 * delta / (delta + 38)); }, encode = function(input) { var i, currentValue, output = [], inputLength = (input = ucs2decode(input)).length, n = 128, delta = 0, bias = 72; for(i = 0; i < input.length; i++)(currentValue = input[i]) < 0x80 && output.push(stringFromCharCode(currentValue)); @@ -4690,10 +4690,10 @@ for(delta += (m - n) * handledCPCountPlusOne, n = m, i = 0; i < input.length; i++){ if ((currentValue = input[i]) < n && ++delta > 2147483647) throw RangeError(OVERFLOW_ERROR); if (currentValue == n) { - for(var q = delta, k = base;; k += base){ + for(var q = delta, k = 36;; k += 36){ var t = k <= bias ? 1 : k >= bias + 26 ? 26 : k - bias; if (q < t) break; - var qMinusT = q - t, baseMinusT = base - t; + var qMinusT = q - t, baseMinusT = 36 - t; output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT))), q = floor(qMinusT / baseMinusT); } output.push(stringFromCharCode(digitToBasic(q))), bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength), delta = 0, ++handledCPCount; @@ -10650,7 +10650,7 @@ exports.setInitialData = setInitialData, exports.getInitialData = getInitialData, exports.getRenderApp = getRenderApp, exports.reactAppRenderer = function(options) { var _a; return __awaiter(this, void 0, void 0, function() { - var appConfig, _b, buildConfig, appLifecycle, createBaseApp, emitLifeCycles, initAppLifeCycles, context, _c, href, origin_1, pathname, search, path, query, ssrError, initialContext, _d, _e, runtime, modifiedAppConfig; + var appConfig, _b, buildConfig, appLifecycle, createBaseApp, emitLifeCycles, initAppLifeCycles, context, _c, href, origin_1, pathname, search, initialContext, _d, _e, runtime, modifiedAppConfig; return __generator(this, function(_f) { switch(_f.label){ case 0: @@ -10669,9 +10669,9 @@ ]; return href = (_c = window.location).href, origin_1 = _c.origin, pathname = _c.pathname, search = _c.search, initialContext = { pathname: pathname, - path: path = href.replace(origin_1, ""), - query: query = queryString.parse(search), - ssrError: ssrError = window.__ICE_SSR_ERROR__ + path: href.replace(origin_1, ""), + query: queryString.parse(search), + ssrError: window.__ICE_SSR_ERROR__ }, _d = context, [ 4, appConfig.app.getInitialData(initialContext), diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/3126/1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/3126/1/analysis-snapshot.rust-debug index ca5d18db1b4..61ff7696fee 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/3126/1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/3126/1/analysis-snapshot.rust-debug @@ -285,7 +285,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: false, @@ -793,7 +793,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/analysis-snapshot.rust-debug index 3200e01c33a..f3bcaab158d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/1/analysis-snapshot.rust-debug @@ -51,7 +51,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 11, reassigned_with_assignment: false, @@ -1623,7 +1623,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -2163,7 +2163,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: false, @@ -3915,7 +3915,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -3955,7 +3955,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -5237,7 +5237,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -5667,7 +5667,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -5707,7 +5707,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -6905,7 +6905,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -7527,7 +7527,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 10, mutation_by_call_count: 10, usage_count: 19, reassigned_with_assignment: true, @@ -8417,7 +8417,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -8999,7 +8999,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -9775,7 +9775,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -9815,7 +9815,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -10131,7 +10131,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -10171,7 +10171,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -11023,7 +11023,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -14889,7 +14889,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -16009,7 +16009,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -17107,7 +17107,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: true, @@ -18881,7 +18881,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -18959,7 +18959,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -21981,7 +21981,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: true, @@ -22333,7 +22333,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -23027,7 +23027,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -25019,7 +25019,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 5, reassigned_with_assignment: false, @@ -25135,7 +25135,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 4, usage_count: 5, reassigned_with_assignment: false, @@ -25329,7 +25329,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: false, @@ -25753,7 +25753,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -25985,7 +25985,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -28639,7 +28639,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 2, mutation_by_call_count: 2, usage_count: 12, reassigned_with_assignment: true, @@ -29187,7 +29187,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -30217,7 +30217,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -30995,7 +30995,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/2/analysis-snapshot.rust-debug index d2e59026b70..a6b6a26fc44 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/emotion/react/2/analysis-snapshot.rust-debug @@ -1693,7 +1693,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/analysis-snapshot.rust-debug index d7d252b086a..9fa41f57d1d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/analysis-snapshot.rust-debug @@ -1566,7 +1566,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -4169,7 +4169,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 3, usage_count: 9, reassigned_with_assignment: false, @@ -5399,7 +5399,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -5857,7 +5857,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 10, usage_count: 26, reassigned_with_assignment: false, @@ -6431,7 +6431,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -12695,7 +12695,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: true, @@ -12847,7 +12847,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 11, reassigned_with_assignment: false, @@ -16287,7 +16287,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -20027,7 +20027,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -20103,7 +20103,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -23255,7 +23255,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 2, mutation_by_call_count: 6, usage_count: 16, reassigned_with_assignment: true, @@ -24641,7 +24641,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 3, usage_count: 6, reassigned_with_assignment: true, @@ -28505,7 +28505,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -28585,7 +28585,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -28625,7 +28625,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -30841,7 +30841,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 4, usage_count: 7, reassigned_with_assignment: true, @@ -35889,7 +35889,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -36819,7 +36819,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: true, @@ -36859,7 +36859,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 4, usage_count: 19, reassigned_with_assignment: true, @@ -37099,7 +37099,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -37763,7 +37763,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -37883,7 +37883,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 6, usage_count: 10, reassigned_with_assignment: true, @@ -38706,7 +38706,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -38746,7 +38746,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -39517,7 +39517,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -39787,7 +39787,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 5, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: true, @@ -40143,7 +40143,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -40461,7 +40461,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -40541,7 +40541,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -41509,7 +41509,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 7, usage_count: 11, reassigned_with_assignment: false, @@ -45273,7 +45273,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -45313,7 +45313,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -47911,7 +47911,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -50423,7 +50423,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -50929,7 +50929,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -54557,7 +54557,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -54913,7 +54913,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -59293,7 +59293,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: false, @@ -59409,7 +59409,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -61013,7 +61013,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 7, usage_count: 14, reassigned_with_assignment: true, @@ -64955,7 +64955,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 9, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js index 4963eec082b..d4839150d1c 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js @@ -2338,7 +2338,9 @@ Yd: function() { return Logger; } - }), (LogLevel1 = LogLevel || (LogLevel = {}))[LogLevel1.DEBUG = 0] = "DEBUG", LogLevel1[LogLevel1.VERBOSE = 1] = "VERBOSE", LogLevel1[LogLevel1.INFO = 2] = "INFO", LogLevel1[LogLevel1.WARN = 3] = "WARN", LogLevel1[LogLevel1.ERROR = 4] = "ERROR", LogLevel1[LogLevel1.SILENT = 5] = "SILENT"; + }); + const instances = []; + (LogLevel1 = LogLevel || (LogLevel = {}))[LogLevel1.DEBUG = 0] = "DEBUG", LogLevel1[LogLevel1.VERBOSE = 1] = "VERBOSE", LogLevel1[LogLevel1.INFO = 2] = "INFO", LogLevel1[LogLevel1.WARN = 3] = "WARN", LogLevel1[LogLevel1.ERROR = 4] = "ERROR", LogLevel1[LogLevel1.SILENT = 5] = "SILENT"; const levelStringToEnum = { debug: LogLevel.DEBUG, verbose: LogLevel.VERBOSE, @@ -2360,7 +2362,7 @@ }; class Logger { constructor(name){ - this.name = name, this._logLevel = defaultLogLevel, this._logHandler = defaultLogHandler, this._userLogHandler = null, [].push(this); + this.name = name, this._logLevel = defaultLogLevel, this._logHandler = defaultLogHandler, this._userLogHandler = null, instances.push(this); } get logLevel() { return this._logLevel; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/analysis-snapshot.rust-debug index 6b798b108a5..7384eeceb11 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/analysis-snapshot.rust-debug @@ -1856,7 +1856,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -2122,7 +2122,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -2426,7 +2426,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -4203,7 +4203,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -8250,7 +8250,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: true, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -8353,7 +8353,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -8440,7 +8440,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -8746,7 +8746,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: true, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -10257,7 +10257,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -11182,7 +11182,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -11488,7 +11488,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -12781,7 +12781,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -14702,7 +14702,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17052,7 +17052,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17269,7 +17269,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -27465,7 +27465,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -28129,7 +28129,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 7, reassigned_with_assignment: false, @@ -57073,7 +57073,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -60396,7 +60396,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: true, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -70001,7 +70001,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: true, @@ -71682,7 +71682,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -71709,7 +71709,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 7, usage_count: 18, reassigned_with_assignment: false, @@ -73022,7 +73022,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -74983,7 +74983,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -78879,7 +78879,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -85069,7 +85069,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -86631,7 +86631,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -87485,7 +87485,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -91299,7 +91299,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -102662,7 +102662,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -103122,7 +103122,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -108558,7 +108558,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -119123,7 +119123,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -121177,7 +121177,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -122987,7 +122987,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -124832,7 +124832,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -130317,7 +130317,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -138655,7 +138655,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -138693,7 +138693,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -164637,7 +164637,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -168699,7 +168699,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -171025,7 +171025,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -178393,7 +178393,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -188387,7 +188387,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -195273,7 +195273,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 18, reassigned_with_assignment: false, @@ -195666,7 +195666,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -196301,7 +196301,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 4, usage_count: 6, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js index 2bcafc64a04..23b2d995742 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js @@ -198,13 +198,24 @@ else for(let e1 = 0; e1 < t; e1++)n[e1] = Math.floor(256 * Math.random()); return n; } + X.T = -1; + class tt { + static I() { + const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length; + let n = ""; + for(; n.length < 20;){ + const s = Z(40); + for(let i = 0; i < s.length; ++i)n.length < 20 && s[i] < e && (n += t.charAt(s[i] % t.length)); + } + return n; + } + } function et(t, e) { return t < e ? -1 : t > e ? 1 : 0; } function nt(t, e, n) { return t.length === e.length && t.every((t, s)=>n(t, e[s])); } - X.T = -1; class it { constructor(t, e){ if (this.seconds = t, this.nanoseconds = e, e < 0 || e >= 1e9) throw new j(K.INVALID_ARGUMENT, "Timestamp nanoseconds out of range: " + e); @@ -2208,6 +2219,38 @@ return new ii(this.target, this.targetId, this.purpose, this.sequenceNumber, this.snapshotVersion, t, this.resumeToken); } } + class ri { + constructor(t){ + this.Wt = t; + } + } + class pi { + constructor(){ + this.Gt = new Ti(); + } + addToCollectionParentIndex(t, e) { + return this.Gt.add(e), js.resolve(); + } + getCollectionParents(t, e) { + return js.resolve(this.Gt.getEntries(e)); + } + } + class Ti { + constructor(){ + this.index = {}; + } + add(t) { + const e = t.lastSegment(), n = t.popLast(), s = this.index[e] || new gn(ht.comparator), i = !s.has(n); + return this.index[e] = s.add(n), i; + } + has(t) { + const e = t.lastSegment(), n = t.popLast(), s = this.index[e]; + return s && s.has(n); + } + getEntries(t) { + return (this.index[t] || new gn(ht.comparator)).toArray(); + } + } class Ri { constructor(t, e, n){ this.cacheSizeCollectionThreshold = t, this.percentileToCollect = e, this.maximumSequenceNumbersToCollect = n; @@ -2485,6 +2528,132 @@ Gn: r }))); } + class Rr { + constructor(t){ + this.N = t, this.Yn = new Map(), this.Xn = new Map(); + } + getBundleMetadata(t, e) { + return js.resolve(this.Yn.get(e)); + } + saveBundleMetadata(t, e) { + var n; + return this.Yn.set(e.id, { + id: (n = e).id, + version: n.version, + createTime: jn(n.createTime) + }), js.resolve(); + } + getNamedQuery(t, e) { + return js.resolve(this.Xn.get(e)); + } + saveNamedQuery(t, e) { + var t1; + return this.Xn.set(e.name, { + name: (t1 = e).name, + query: function(t) { + var t1, e; + const e1 = function(t) { + var t1, t2, e, n, s, i, o, c; + let e1 = function(t) { + const e = Wn(t); + return 4 === e.length ? ht.emptyPath() : Xn(e); + }(t.parent); + const n1 = t.structuredQuery, s1 = n1.from ? n1.from.length : 0; + let i1 = null; + if (s1 > 0) { + 1 === s1 || L(); + const t3 = n1.from[0]; + t3.allDescendants ? i1 = t3.collectionId : e1 = e1.child(t3.collectionId); + } + let r = []; + n1.where && (r = function hs(t) { + var t1; + return t ? void 0 !== t.unaryFilter ? [ + function(t) { + switch(t.unaryFilter.op){ + case "IS_NAN": + const e = ms(t.unaryFilter.field); + return Jt.create(e, "==", { + doubleValue: NaN + }); + case "IS_NULL": + const n = ms(t.unaryFilter.field); + return Jt.create(n, "==", { + nullValue: "NULL_VALUE" + }); + case "IS_NOT_NAN": + const s = ms(t.unaryFilter.field); + return Jt.create(s, "!=", { + doubleValue: NaN + }); + case "IS_NOT_NULL": + const i = ms(t.unaryFilter.field); + return Jt.create(i, "!=", { + nullValue: "NULL_VALUE" + }); + default: + return L(); + } + }(t) + ] : void 0 !== t.fieldFilter ? [ + (t1 = t, Jt.create(ms(t1.fieldFilter.field), function(t) { + switch(t){ + case "EQUAL": + return "=="; + case "NOT_EQUAL": + return "!="; + case "GREATER_THAN": + return ">"; + case "GREATER_THAN_OR_EQUAL": + return ">="; + case "LESS_THAN": + return "<"; + case "LESS_THAN_OR_EQUAL": + return "<="; + case "ARRAY_CONTAINS": + return "array-contains"; + case "IN": + return "in"; + case "NOT_IN": + return "not-in"; + case "ARRAY_CONTAINS_ANY": + return "array-contains-any"; + default: + return L(); + } + }(t1.fieldFilter.op), t1.fieldFilter.value)) + ] : void 0 !== t.compositeFilter ? t.compositeFilter.filters.map((t)=>hs(t)).reduce((t, e)=>t.concat(e)) : L() : []; + }(n1.where)); + let o1 = []; + n1.orderBy && (o1 = n1.orderBy.map((t)=>{ + var t1; + return t1 = t, new ae(ms(t1.field), function(t) { + switch(t){ + case "ASCENDING": + return "asc"; + case "DESCENDING": + return "desc"; + default: + return; + } + }(t1.direction)); + })); + let c1 = null, e2; + n1.limit && (c1 = At(e2 = "object" == typeof (t1 = n1.limit) ? t1.value : t1) ? null : e2); + let a = null; + n1.startAt && (a = fs(n1.startAt)); + let u = null; + return n1.endAt && (u = fs(n1.endAt)), t2 = e1, e = i1, n = o1, s = r, i = c1, o = a, c = u, new fe(t2, e, n, s, i, "F", o, c); + }({ + parent: t.parent, + structuredQuery: t.structuredQuery + }); + return "LAST" === t.limitType ? (t1 = e1, e = e1.limit, new fe(t1.path, t1.collectionGroup, t1.explicitOrderBy.slice(), t1.filters.slice(), e, "L", t1.startAt, t1.endAt)) : e1; + }(t1.bundledQuery), + readTime: jn(t1.readTime) + }), js.resolve(); + } + } class br { constructor(){ this.Zn = new gn(Pr.ts), this.es = new gn(Pr.ns); @@ -2642,6 +2811,53 @@ return e < 0 || e >= this.In.length ? null : this.In[e]; } } + class Vr { + constructor(t, e){ + this.Ht = t, this.ps = e, this.docs = new wn(Pt.comparator), this.size = 0; + } + addEntry(t, e, n) { + const s = e.key, i = this.docs.get(s), r = i ? i.size : 0, o = this.ps(e); + return this.docs = this.docs.insert(s, { + document: e.clone(), + size: o, + readTime: n + }), this.size += o - r, this.Ht.addToCollectionParentIndex(t, s.path.popLast()); + } + removeEntry(t) { + const e = this.docs.get(t); + e && (this.docs = this.docs.remove(t), this.size -= e.size); + } + getEntry(t, e) { + const n = this.docs.get(e); + return js.resolve(n ? n.document.clone() : Kt.newInvalidDocument(e)); + } + getEntries(t, e) { + let n = pn; + return e.forEach((t)=>{ + const e = this.docs.get(t); + n = n.insert(t, e ? e.document.clone() : Kt.newInvalidDocument(t)); + }), js.resolve(n); + } + getDocumentsMatchingQuery(t, e, n) { + let s = pn; + const i = new Pt(e.path.child("")), r = this.docs.getIteratorFrom(i); + for(; r.hasNext();){ + const { key: t1 , value: { document: i1 , readTime: o } , } = r.getNext(); + if (!e.path.isPrefixOf(t1.path)) break; + 0 >= o.compareTo(n) || Pe(e, i1) && (s = s.insert(i1.key, i1.clone())); + } + return js.resolve(s); + } + Ts(t, e) { + return js.forEach(this.docs, (t)=>e(t)); + } + newChangeBuffer(t) { + return new Sr(this); + } + getSize(t) { + return js.resolve(this.size); + } + } class Sr extends Qi { constructor(t){ super(), this.Se = t; @@ -2659,277 +2875,78 @@ return this.Se.getEntries(t, e); } } + class Dr { + constructor(t){ + this.persistence = t, this.Es = new ji((t)=>Wt(t), zt), this.lastRemoteSnapshotVersion = rt.min(), this.highestTargetId = 0, this.Is = 0, this.As = new br(), this.targetCount = 0, this.Rs = Ni.se(); + } + forEachTarget(t, e) { + return this.Es.forEach((t, n)=>e(n)), js.resolve(); + } + getLastRemoteSnapshotVersion(t) { + return js.resolve(this.lastRemoteSnapshotVersion); + } + getHighestSequenceNumber(t) { + return js.resolve(this.Is); + } + allocateTargetId(t) { + return this.highestTargetId = this.Rs.next(), js.resolve(this.highestTargetId); + } + setTargetsMetadata(t, e, n) { + return n && (this.lastRemoteSnapshotVersion = n), e > this.Is && (this.Is = e), js.resolve(); + } + ce(t) { + this.Es.set(t.target, t); + const e = t.targetId; + e > this.highestTargetId && (this.Rs = new Ni(e), this.highestTargetId = e), t.sequenceNumber > this.Is && (this.Is = t.sequenceNumber); + } + addTargetData(t, e) { + return this.ce(e), this.targetCount += 1, js.resolve(); + } + updateTargetData(t, e) { + return this.ce(e), js.resolve(); + } + removeTargetData(t, e) { + return this.Es.delete(e.target), this.As.cs(e.targetId), this.targetCount -= 1, js.resolve(); + } + removeTargets(t, e, n) { + let s = 0; + const i = []; + return this.Es.forEach((r, o)=>{ + o.sequenceNumber <= e && null === n.get(o.targetId) && (this.Es.delete(r), i.push(this.removeMatchingKeysForTargetId(t, o.targetId)), s++); + }), js.waitFor(i).next(()=>s); + } + getTargetCount(t) { + return js.resolve(this.targetCount); + } + getTargetData(t, e) { + const n = this.Es.get(e) || null; + return js.resolve(n); + } + addMatchingKeys(t, e, n) { + return this.As.ss(e, n), js.resolve(); + } + removeMatchingKeys(t, e, n) { + this.As.os(e, n); + const s = this.persistence.referenceDelegate, i = []; + return s && e.forEach((e)=>{ + i.push(s.markPotentiallyOrphaned(t, e)); + }), js.waitFor(i); + } + removeMatchingKeysForTargetId(t, e) { + return this.As.cs(e), js.resolve(); + } + getMatchingKeysForTargetId(t, e) { + const n = this.As.hs(e); + return js.resolve(n); + } + containsKey(t, e) { + return js.resolve(this.As.containsKey(e)); + } + } class Cr { constructor(t, e){ var t1, e1; - this.bs = {}, this.Le = new X(0), this.Be = !1, this.Be = !0, this.referenceDelegate = t(this), this.ze = new class { - constructor(t){ - this.persistence = t, this.Es = new ji((t)=>Wt(t), zt), this.lastRemoteSnapshotVersion = rt.min(), this.highestTargetId = 0, this.Is = 0, this.As = new br(), this.targetCount = 0, this.Rs = Ni.se(); - } - forEachTarget(t, e) { - return this.Es.forEach((t, n)=>e(n)), js.resolve(); - } - getLastRemoteSnapshotVersion(t) { - return js.resolve(this.lastRemoteSnapshotVersion); - } - getHighestSequenceNumber(t) { - return js.resolve(this.Is); - } - allocateTargetId(t) { - return this.highestTargetId = this.Rs.next(), js.resolve(this.highestTargetId); - } - setTargetsMetadata(t, e, n) { - return n && (this.lastRemoteSnapshotVersion = n), e > this.Is && (this.Is = e), js.resolve(); - } - ce(t) { - this.Es.set(t.target, t); - const e = t.targetId; - e > this.highestTargetId && (this.Rs = new Ni(e), this.highestTargetId = e), t.sequenceNumber > this.Is && (this.Is = t.sequenceNumber); - } - addTargetData(t, e) { - return this.ce(e), this.targetCount += 1, js.resolve(); - } - updateTargetData(t, e) { - return this.ce(e), js.resolve(); - } - removeTargetData(t, e) { - return this.Es.delete(e.target), this.As.cs(e.targetId), this.targetCount -= 1, js.resolve(); - } - removeTargets(t, e, n) { - let s = 0; - const i = []; - return this.Es.forEach((r, o)=>{ - o.sequenceNumber <= e && null === n.get(o.targetId) && (this.Es.delete(r), i.push(this.removeMatchingKeysForTargetId(t, o.targetId)), s++); - }), js.waitFor(i).next(()=>s); - } - getTargetCount(t) { - return js.resolve(this.targetCount); - } - getTargetData(t, e) { - const n = this.Es.get(e) || null; - return js.resolve(n); - } - addMatchingKeys(t, e, n) { - return this.As.ss(e, n), js.resolve(); - } - removeMatchingKeys(t, e, n) { - this.As.os(e, n); - const s = this.persistence.referenceDelegate, i = []; - return s && e.forEach((e)=>{ - i.push(s.markPotentiallyOrphaned(t, e)); - }), js.waitFor(i); - } - removeMatchingKeysForTargetId(t, e) { - return this.As.cs(e), js.resolve(); - } - getMatchingKeysForTargetId(t, e) { - const n = this.As.hs(e); - return js.resolve(n); - } - containsKey(t, e) { - return js.resolve(this.As.containsKey(e)); - } - }(this), this.Ht = new class { - constructor(){ - this.Gt = new class { - constructor(){ - this.index = {}; - } - add(t) { - const e = t.lastSegment(), n = t.popLast(), s = this.index[e] || new gn(ht.comparator), i = !s.has(n); - return this.index[e] = s.add(n), i; - } - has(t) { - const e = t.lastSegment(), n = t.popLast(), s = this.index[e]; - return s && s.has(n); - } - getEntries(t) { - return (this.index[t] || new gn(ht.comparator)).toArray(); - } - }(); - } - addToCollectionParentIndex(t, e) { - return this.Gt.add(e), js.resolve(); - } - getCollectionParents(t, e) { - return js.resolve(this.Gt.getEntries(e)); - } - }(), this.He = (t1 = this.Ht, e1 = (t)=>this.referenceDelegate.Ps(t), new class { - constructor(t, e){ - this.Ht = t, this.ps = e, this.docs = new wn(Pt.comparator), this.size = 0; - } - addEntry(t, e, n) { - const s = e.key, i = this.docs.get(s), r = i ? i.size : 0, o = this.ps(e); - return this.docs = this.docs.insert(s, { - document: e.clone(), - size: o, - readTime: n - }), this.size += o - r, this.Ht.addToCollectionParentIndex(t, s.path.popLast()); - } - removeEntry(t) { - const e = this.docs.get(t); - e && (this.docs = this.docs.remove(t), this.size -= e.size); - } - getEntry(t, e) { - const n = this.docs.get(e); - return js.resolve(n ? n.document.clone() : Kt.newInvalidDocument(e)); - } - getEntries(t, e) { - let n = pn; - return e.forEach((t)=>{ - const e = this.docs.get(t); - n = n.insert(t, e ? e.document.clone() : Kt.newInvalidDocument(t)); - }), js.resolve(n); - } - getDocumentsMatchingQuery(t, e, n) { - let s = pn; - const i = new Pt(e.path.child("")), r = this.docs.getIteratorFrom(i); - for(; r.hasNext();){ - const { key: t1 , value: { document: i1 , readTime: o } , } = r.getNext(); - if (!e.path.isPrefixOf(t1.path)) break; - 0 >= o.compareTo(n) || Pe(e, i1) && (s = s.insert(i1.key, i1.clone())); - } - return js.resolve(s); - } - Ts(t, e) { - return js.forEach(this.docs, (t)=>e(t)); - } - newChangeBuffer(t) { - return new Sr(this); - } - getSize(t) { - return js.resolve(this.size); - } - }(t1, e1)), this.N = new class { - constructor(t){ - this.Wt = t; - } - }(e), this.Je = new class { - constructor(t){ - this.N = t, this.Yn = new Map(), this.Xn = new Map(); - } - getBundleMetadata(t, e) { - return js.resolve(this.Yn.get(e)); - } - saveBundleMetadata(t, e) { - var n; - return this.Yn.set(e.id, { - id: (n = e).id, - version: n.version, - createTime: jn(n.createTime) - }), js.resolve(); - } - getNamedQuery(t, e) { - return js.resolve(this.Xn.get(e)); - } - saveNamedQuery(t, e) { - var t1; - return this.Xn.set(e.name, { - name: (t1 = e).name, - query: function(t) { - var t1, e; - const e1 = function(t) { - var t1, t2, e, n, s, i, o, c; - let e1 = function(t) { - const e = Wn(t); - return 4 === e.length ? ht.emptyPath() : Xn(e); - }(t.parent); - const n1 = t.structuredQuery, s1 = n1.from ? n1.from.length : 0; - let i1 = null; - if (s1 > 0) { - 1 === s1 || L(); - const t3 = n1.from[0]; - t3.allDescendants ? i1 = t3.collectionId : e1 = e1.child(t3.collectionId); - } - let r = []; - n1.where && (r = function hs(t) { - var t1; - return t ? void 0 !== t.unaryFilter ? [ - function(t) { - switch(t.unaryFilter.op){ - case "IS_NAN": - const e = ms(t.unaryFilter.field); - return Jt.create(e, "==", { - doubleValue: NaN - }); - case "IS_NULL": - const n = ms(t.unaryFilter.field); - return Jt.create(n, "==", { - nullValue: "NULL_VALUE" - }); - case "IS_NOT_NAN": - const s = ms(t.unaryFilter.field); - return Jt.create(s, "!=", { - doubleValue: NaN - }); - case "IS_NOT_NULL": - const i = ms(t.unaryFilter.field); - return Jt.create(i, "!=", { - nullValue: "NULL_VALUE" - }); - default: - return L(); - } - }(t) - ] : void 0 !== t.fieldFilter ? [ - (t1 = t, Jt.create(ms(t1.fieldFilter.field), function(t) { - switch(t){ - case "EQUAL": - return "=="; - case "NOT_EQUAL": - return "!="; - case "GREATER_THAN": - return ">"; - case "GREATER_THAN_OR_EQUAL": - return ">="; - case "LESS_THAN": - return "<"; - case "LESS_THAN_OR_EQUAL": - return "<="; - case "ARRAY_CONTAINS": - return "array-contains"; - case "IN": - return "in"; - case "NOT_IN": - return "not-in"; - case "ARRAY_CONTAINS_ANY": - return "array-contains-any"; - default: - return L(); - } - }(t1.fieldFilter.op), t1.fieldFilter.value)) - ] : void 0 !== t.compositeFilter ? t.compositeFilter.filters.map((t)=>hs(t)).reduce((t, e)=>t.concat(e)) : L() : []; - }(n1.where)); - let o1 = []; - n1.orderBy && (o1 = n1.orderBy.map((t)=>{ - var t1; - return t1 = t, new ae(ms(t1.field), function(t) { - switch(t){ - case "ASCENDING": - return "asc"; - case "DESCENDING": - return "desc"; - default: - return; - } - }(t1.direction)); - })); - let c1 = null, e2; - n1.limit && (c1 = At(e2 = "object" == typeof (t1 = n1.limit) ? t1.value : t1) ? null : e2); - let a = null; - n1.startAt && (a = fs(n1.startAt)); - let u = null; - return n1.endAt && (u = fs(n1.endAt)), t2 = e1, e = i1, n = o1, s = r, i = c1, o = a, c = u, new fe(t2, e, n, s, i, "F", o, c); - }({ - parent: t.parent, - structuredQuery: t.structuredQuery - }); - return "LAST" === t.limitType ? (t1 = e1, e = e1.limit, new fe(t1.path, t1.collectionGroup, t1.explicitOrderBy.slice(), t1.filters.slice(), e, "L", t1.startAt, t1.endAt)) : e1; - }(t1.bundledQuery), - readTime: jn(t1.readTime) - }), js.resolve(); - } - }(this.N); + this.bs = {}, this.Le = new X(0), this.Be = !1, this.Be = !0, this.referenceDelegate = t(this), this.ze = new Dr(this), this.Ht = new pi(), this.He = (t1 = this.Ht, e1 = (t)=>this.referenceDelegate.Ps(t), new Vr(t1, e1)), this.N = new ri(e), this.Je = new Rr(this.N); } start() { return Promise.resolve(); @@ -3583,6 +3600,30 @@ this.kr = !0; } } + class so { + constructor(t, e){ + this.asyncQueue = t, this.onlineStateHandler = e, this.state = "Unknown", this.Or = 0, this.Fr = null, this.Mr = !0; + } + Lr() { + 0 === this.Or && (this.Br("Unknown"), this.Fr = this.asyncQueue.enqueueAfterDelay("online_state_timeout", 1e4, ()=>(this.Fr = null, this.Ur("Backend didn't respond within 10 seconds."), this.Br("Offline"), Promise.resolve()))); + } + qr(t) { + "Online" === this.state ? this.Br("Unknown") : (this.Or++, this.Or >= 1 && (this.Kr(), this.Ur(`Connection failed 1 times. Most recent error: ${t.toString()}`), this.Br("Offline"))); + } + set(t) { + this.Kr(), this.Or = 0, "Online" === t && (this.Mr = !1), this.Br(t); + } + Br(t) { + t !== this.state && (this.state = t, this.onlineStateHandler(t)); + } + Ur(t) { + const e = `Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`; + this.Mr ? (O(e), this.Mr = !1) : $("OnlineStateTracker", e); + } + Kr() { + null !== this.Fr && (this.Fr.cancel(), this.Fr = null); + } + } class io { constructor(t, e, n, s, i){ this.localStore = t, this.datastore = e, this.asyncQueue = n, this.remoteSyncer = {}, this.jr = [], this.Qr = new Map(), this.Wr = new Set(), this.Gr = [], this.zr = i, this.zr.Ti((t)=>{ @@ -3592,30 +3633,7 @@ e.Wr.add(4), await oo(e), e.Hr.set("Unknown"), e.Wr.delete(4), await ro(e); }(this)); }); - }), this.Hr = new class { - constructor(t, e){ - this.asyncQueue = t, this.onlineStateHandler = e, this.state = "Unknown", this.Or = 0, this.Fr = null, this.Mr = !0; - } - Lr() { - 0 === this.Or && (this.Br("Unknown"), this.Fr = this.asyncQueue.enqueueAfterDelay("online_state_timeout", 1e4, ()=>(this.Fr = null, this.Ur("Backend didn't respond within 10 seconds."), this.Br("Offline"), Promise.resolve()))); - } - qr(t) { - "Online" === this.state ? this.Br("Unknown") : (this.Or++, this.Or >= 1 && (this.Kr(), this.Ur(`Connection failed 1 times. Most recent error: ${t.toString()}`), this.Br("Offline"))); - } - set(t) { - this.Kr(), this.Or = 0, "Online" === t && (this.Mr = !1), this.Br(t); - } - Br(t) { - t !== this.state && (this.state = t, this.onlineStateHandler(t)); - } - Ur(t) { - const e = `Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`; - this.Mr ? (O(e), this.Mr = !1) : $("OnlineStateTracker", e); - } - Kr() { - null !== this.Fr && (this.Fr.cancel(), this.Fr = null); - } - }(n, s); + }), this.Hr = new so(n, s); } } async function ro(t) { @@ -4355,17 +4373,7 @@ } class Kc { constructor(t, e, n){ - this.credentials = t, this.asyncQueue = e, this.databaseInfo = n, this.user = D.UNAUTHENTICATED, this.clientId = (class { - static I() { - const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", e = Math.floor(256 / t.length) * t.length; - let n = ""; - for(; n.length < 20;){ - const s = Z(40); - for(let i = 0; i < s.length; ++i)n.length < 20 && s[i] < e && (n += t.charAt(s[i] % t.length)); - } - return n; - } - }).I(), this.credentialListener = ()=>Promise.resolve(), this.credentials.start(e, async (t)=>{ + this.credentials = t, this.asyncQueue = e, this.databaseInfo = n, this.user = D.UNAUTHENTICATED, this.clientId = tt.I(), this.credentialListener = ()=>Promise.resolve(), this.credentials.start(e, async (t)=>{ $("FirestoreClient", "Received user=", t.uid), await this.credentialListener(t), this.user = t; }); } @@ -4609,94 +4617,95 @@ return _a(s1), new Ra(t.firestore, null, s1); } } + class Da { + constructor(){ + this._c = Promise.resolve(), this.mc = [], this.gc = !1, this.yc = [], this.Tc = null, this.Ec = !1, this.Ic = !1, this.Ac = [], this.ar = new Xr(this, "async_queue_retry"), this.Rc = ()=>{ + const t = Jr(); + t && $("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.ar.tr(); + }; + const t = Jr(); + t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Rc); + } + get isShuttingDown() { + return this.gc; + } + enqueueAndForget(t) { + this.enqueue(t); + } + enqueueAndForgetEvenWhileRestricted(t) { + this.bc(), this.Pc(t); + } + enterRestrictedMode(t) { + if (!this.gc) { + this.gc = !0, this.Ic = t || !1; + const e = Jr(); + e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Rc); + } + } + enqueue(t) { + if (this.bc(), this.gc) return new Promise(()=>{}); + const e = new Q(); + return this.Pc(()=>this.gc && this.Ic ? Promise.resolve() : (t().then(e.resolve, e.reject), e.promise)).then(()=>e.promise); + } + enqueueRetryable(t) { + this.enqueueAndForget(()=>(this.mc.push(t), this.vc())); + } + async vc() { + if (0 !== this.mc.length) { + try { + await this.mc[0](), this.mc.shift(), this.ar.reset(); + } catch (t) { + if (!Hs(t)) throw t; + $("AsyncQueue", "Operation failed with retryable error: " + t); + } + this.mc.length > 0 && this.ar.Xi(()=>this.vc()); + } + } + Pc(t) { + const e = this._c.then(()=>(this.Ec = !0, t().catch((t)=>{ + var t1; + this.Tc = t, this.Ec = !1; + let e; + const e1 = (e = (t1 = t).message || "", t1.stack && (e = t1.stack.includes(t1.message) ? t1.stack : t1.message + "\n" + t1.stack), e); + throw O("INTERNAL UNHANDLED ERROR: ", e1), t; + }).then((t)=>(this.Ec = !1, t)))); + return this._c = e, e; + } + enqueueAfterDelay(t, e, n) { + this.bc(), this.Ac.indexOf(t) > -1 && (e = 0); + const s = xo.createAndSchedule(this, t, e, n, (t)=>this.Vc(t)); + return this.yc.push(s), s; + } + bc() { + this.Tc && L(); + } + verifyOperationInProgress() {} + async Sc() { + let t; + do await (t = this._c); + while (t !== this._c) + } + Dc(t) { + for (const e of this.yc)if (e.timerId === t) return !0; + return !1; + } + Cc(t) { + return this.Sc().then(()=>{ + for (const e of (this.yc.sort((t, e)=>t.targetTimeMs - e.targetTimeMs), this.yc))if (e.skipDelay(), "all" !== t && e.timerId === t) break; + return this.Sc(); + }); + } + Nc(t) { + this.Ac.push(t); + } + Vc(t) { + const e = this.yc.indexOf(t); + this.yc.splice(e, 1); + } + } class ka extends Ta { constructor(t, e){ - super(t, e), this.type = "firestore", this._queue = new class { - constructor(){ - this._c = Promise.resolve(), this.mc = [], this.gc = !1, this.yc = [], this.Tc = null, this.Ec = !1, this.Ic = !1, this.Ac = [], this.ar = new Xr(this, "async_queue_retry"), this.Rc = ()=>{ - const t = Jr(); - t && $("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.ar.tr(); - }; - const t = Jr(); - t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Rc); - } - get isShuttingDown() { - return this.gc; - } - enqueueAndForget(t) { - this.enqueue(t); - } - enqueueAndForgetEvenWhileRestricted(t) { - this.bc(), this.Pc(t); - } - enterRestrictedMode(t) { - if (!this.gc) { - this.gc = !0, this.Ic = t || !1; - const e = Jr(); - e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Rc); - } - } - enqueue(t) { - if (this.bc(), this.gc) return new Promise(()=>{}); - const e = new Q(); - return this.Pc(()=>this.gc && this.Ic ? Promise.resolve() : (t().then(e.resolve, e.reject), e.promise)).then(()=>e.promise); - } - enqueueRetryable(t) { - this.enqueueAndForget(()=>(this.mc.push(t), this.vc())); - } - async vc() { - if (0 !== this.mc.length) { - try { - await this.mc[0](), this.mc.shift(), this.ar.reset(); - } catch (t) { - if (!Hs(t)) throw t; - $("AsyncQueue", "Operation failed with retryable error: " + t); - } - this.mc.length > 0 && this.ar.Xi(()=>this.vc()); - } - } - Pc(t) { - const e = this._c.then(()=>(this.Ec = !0, t().catch((t)=>{ - var t1; - this.Tc = t, this.Ec = !1; - let e; - const e1 = (e = (t1 = t).message || "", t1.stack && (e = t1.stack.includes(t1.message) ? t1.stack : t1.message + "\n" + t1.stack), e); - throw O("INTERNAL UNHANDLED ERROR: ", e1), t; - }).then((t)=>(this.Ec = !1, t)))); - return this._c = e, e; - } - enqueueAfterDelay(t, e, n) { - this.bc(), this.Ac.indexOf(t) > -1 && (e = 0); - const s = xo.createAndSchedule(this, t, e, n, (t)=>this.Vc(t)); - return this.yc.push(s), s; - } - bc() { - this.Tc && L(); - } - verifyOperationInProgress() {} - async Sc() { - let t; - do await (t = this._c); - while (t !== this._c) - } - Dc(t) { - for (const e of this.yc)if (e.timerId === t) return !0; - return !1; - } - Cc(t) { - return this.Sc().then(()=>{ - for (const e of (this.yc.sort((t, e)=>t.targetTimeMs - e.targetTimeMs), this.yc))if (e.skipDelay(), "all" !== t && e.timerId === t) break; - return this.Sc(); - }); - } - Nc(t) { - this.Ac.push(t); - } - Vc(t) { - const e = this.yc.indexOf(t); - this.yc.splice(e, 1); - } - }(), this._persistenceKey = "name" in t ? t.name : "[DEFAULT]"; + super(t, e), this.type = "firestore", this._queue = new Da(), this._persistenceKey = "name" in t ? t.name : "[DEFAULT]"; } _terminate() { return this._firestoreClient || Ma(this), this._firestoreClient.terminate(); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase/2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/firebase/2/analysis-snapshot.rust-debug index 4a3d20cb671..d4a93bba0aa 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase/2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase/2/analysis-snapshot.rust-debug @@ -129,7 +129,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -363,7 +363,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/analysis-snapshot.rust-debug index 3f44310ecda..50c0987bbb4 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/moment/1/analysis-snapshot.rust-debug @@ -1607,7 +1607,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: false, @@ -9901,7 +9901,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -9941,7 +9941,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: false, @@ -18027,7 +18027,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -33235,7 +33235,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -34755,7 +34755,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -34795,7 +34795,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -41123,7 +41123,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 8, usage_count: 8, reassigned_with_assignment: true, @@ -41591,7 +41591,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -41631,7 +41631,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 4, usage_count: 7, reassigned_with_assignment: true, @@ -49493,7 +49493,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -50883,7 +50883,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/analysis-snapshot.rust-debug index ce6e0661bf9..b487da96e0f 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/analysis-snapshot.rust-debug @@ -42501,7 +42501,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 12, reassigned_with_assignment: false, @@ -42621,7 +42621,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 7, reassigned_with_assignment: false, @@ -84999,7 +84999,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -87145,7 +87145,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -96743,7 +96743,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -98551,7 +98551,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -98589,7 +98589,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -113057,7 +113057,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -131915,7 +131915,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 6, usage_count: 8, reassigned_with_assignment: false, @@ -134581,7 +134581,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -134621,7 +134621,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -134661,7 +134661,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -134701,7 +134701,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -134741,7 +134741,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -134779,7 +134779,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -134935,7 +134935,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -134975,7 +134975,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -135051,7 +135051,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -135207,7 +135207,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -135285,7 +135285,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -135403,7 +135403,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -141939,7 +141939,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -141979,7 +141979,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -160107,7 +160107,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -160185,7 +160185,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -160223,7 +160223,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -160299,7 +160299,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -160491,7 +160491,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -160911,7 +160911,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -171045,7 +171045,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 58, usage_count: 80, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/react-autosuggest/1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/react-autosuggest/1/analysis-snapshot.rust-debug index b188eaf40b9..50d26ac8718 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/react-autosuggest/1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/react-autosuggest/1/analysis-snapshot.rust-debug @@ -3735,7 +3735,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/analysis-snapshot.rust-debug index d7debefda5c..6e040beacf5 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/react-countup/1/analysis-snapshot.rust-debug @@ -8739,7 +8739,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -9487,7 +9487,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -16169,7 +16169,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 9, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/vercel/006/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/issues/vercel/006/analysis-snapshot.rust-debug index 690980bb89f..c5589218d03 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/vercel/006/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/issues/vercel/006/analysis-snapshot.rust-debug @@ -176,8 +176,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -329,7 +329,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/analysis-snapshot.rust-debug index 9accc1479b7..6c88984b279 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/31077/static/chunks/1606726a.10299989c08cb523/analysis-snapshot.rust-debug @@ -171,7 +171,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -8189,7 +8189,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -8227,7 +8227,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: false, @@ -10041,7 +10041,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -10277,7 +10277,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 21, reassigned_with_assignment: false, @@ -11521,7 +11521,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -12999,7 +12999,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -13937,7 +13937,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -14405,7 +14405,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 7, reassigned_with_assignment: false, @@ -14565,7 +14565,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -15363,7 +15363,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -16589,7 +16589,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -17211,7 +17211,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -17521,7 +17521,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 1, usage_count: 18, reassigned_with_assignment: true, @@ -17559,7 +17559,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: false, @@ -17635,7 +17635,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -18989,7 +18989,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 13, reassigned_with_assignment: false, @@ -20429,7 +20429,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 4, usage_count: 9, reassigned_with_assignment: true, @@ -29061,7 +29061,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -32715,7 +32715,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -33339,7 +33339,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -36751,7 +36751,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -37291,7 +37291,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: false, @@ -40167,7 +40167,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -42091,7 +42091,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -42209,7 +42209,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 6, usage_count: 13, reassigned_with_assignment: false, @@ -42285,7 +42285,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -44147,7 +44147,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -44377,7 +44377,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -46949,7 +46949,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -47335,7 +47335,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: false, @@ -47759,7 +47759,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 6, reassigned_with_assignment: false, @@ -48573,7 +48573,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -49145,7 +49145,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 5, reassigned_with_assignment: false, @@ -49873,7 +49873,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: true, @@ -52323,7 +52323,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -62907,7 +62907,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -65005,7 +65005,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -65429,7 +65429,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: false, @@ -65739,7 +65739,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -68833,7 +68833,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -70077,7 +70077,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -72751,7 +72751,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 5, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/analysis-snapshot.rust-debug index e5748fbc3fe..b1cee713bb2 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/analysis-snapshot.rust-debug @@ -13,7 +13,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 8, reassigned_with_assignment: false, @@ -875,7 +875,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 52, reassigned_with_assignment: false, @@ -3535,7 +3535,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -7275,7 +7275,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 15, usage_count: 15, reassigned_with_assignment: false, @@ -21649,7 +21649,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -22527,7 +22527,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: true, @@ -22567,7 +22567,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -22727,7 +22727,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -29485,7 +29485,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -34355,7 +34355,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: false, @@ -44965,7 +44965,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -45125,7 +45125,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -45603,7 +45603,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 22, usage_count: 68, reassigned_with_assignment: false, @@ -50031,7 +50031,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 5, reassigned_with_assignment: false, @@ -53671,7 +53671,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 7, usage_count: 8, reassigned_with_assignment: true, @@ -60177,7 +60177,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 3, usage_count: 12, reassigned_with_assignment: false, @@ -72311,7 +72311,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -72549,7 +72549,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -105571,7 +105571,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 4, usage_count: 6, reassigned_with_assignment: false, @@ -109449,7 +109449,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: true, @@ -113077,7 +113077,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -113117,7 +113117,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -115605,7 +115605,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -115947,7 +115947,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -122273,7 +122273,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -133343,7 +133343,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -135195,7 +135195,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -136275,7 +136275,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -136783,7 +136783,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 5, usage_count: 206, reassigned_with_assignment: false, @@ -149469,7 +149469,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -149545,7 +149545,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -153135,7 +153135,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -158281,7 +158281,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: false, @@ -175191,7 +175191,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -176293,7 +176293,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 4, usage_count: 6, reassigned_with_assignment: true, @@ -179781,7 +179781,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 14, reassigned_with_assignment: false, @@ -179821,7 +179821,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -189577,7 +189577,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 4, usage_count: 24, reassigned_with_assignment: false, @@ -197307,7 +197307,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 6, usage_count: 6, reassigned_with_assignment: false, @@ -197893,7 +197893,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -200181,7 +200181,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -202783,7 +202783,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -203213,7 +203213,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 12, reassigned_with_assignment: false, @@ -209511,7 +209511,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -211203,7 +211203,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -213587,7 +213587,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -214977,7 +214977,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -218727,7 +218727,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -232177,7 +232177,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -255721,7 +255721,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -256145,7 +256145,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -264625,7 +264625,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -272921,7 +272921,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -278769,7 +278769,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -279657,7 +279657,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 2, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -279697,7 +279697,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 0, usage_count: 7, reassigned_with_assignment: true, @@ -305745,7 +305745,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: false, @@ -308763,7 +308763,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -310545,7 +310545,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -327125,7 +327125,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -327245,7 +327245,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -329711,7 +329711,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 5, mutation_by_call_count: 6, usage_count: 10, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js index dfc4276dd0e..0ded3fa89c3 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js @@ -10651,8 +10651,8 @@ parsePesTime: parsePesTime, videoPacketContainsKeyFrame: videoPacketContainsKeyFrame }, probe.aac = utils; - var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS, MP2T_PACKET_LENGTH = 188, parsePsi_ = function(bytes, pmt) { - for(var packet, startIndex = 0, endIndex = MP2T_PACKET_LENGTH; endIndex < bytes.byteLength;){ + var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS, parsePsi_ = function(bytes, pmt) { + for(var packet, startIndex = 0, endIndex = 188; endIndex < bytes.byteLength;){ if (0x47 === bytes[startIndex] && 0x47 === bytes[endIndex]) { switch(packet = bytes.subarray(startIndex, endIndex), probe.ts.parseType(packet, pmt.pid)){ case "pat": @@ -10664,30 +10664,30 @@ pmt.table[key] = table[key]; }); } - startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH; + startIndex += 188, endIndex += 188; continue; } startIndex++, endIndex++; } }, parseAudioPes_ = function(bytes, pmt, result) { - for(var packet, pesType, pusi, parsed, startIndex = 0, endIndex = MP2T_PACKET_LENGTH, endLoop = !1; endIndex <= bytes.byteLength;){ + for(var packet, pesType, pusi, parsed, startIndex = 0, endIndex = 188, endLoop = !1; endIndex <= bytes.byteLength;){ if (0x47 === bytes[startIndex] && (0x47 === bytes[endIndex] || endIndex === bytes.byteLength)) { if (packet = bytes.subarray(startIndex, endIndex), "pes" === probe.ts.parseType(packet, pmt.pid) && (pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), "audio" === pesType && pusi && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = "audio", result.audio.push(parsed), endLoop = !0)), endLoop) break; - startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH; + startIndex += 188, endIndex += 188; continue; } startIndex++, endIndex++; } - for(startIndex = (endIndex = bytes.byteLength) - MP2T_PACKET_LENGTH, endLoop = !1; startIndex >= 0;){ + for(startIndex = (endIndex = bytes.byteLength) - 188, endLoop = !1; startIndex >= 0;){ if (0x47 === bytes[startIndex] && (0x47 === bytes[endIndex] || endIndex === bytes.byteLength)) { if (packet = bytes.subarray(startIndex, endIndex), "pes" === probe.ts.parseType(packet, pmt.pid) && (pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), "audio" === pesType && pusi && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = "audio", result.audio.push(parsed), endLoop = !0)), endLoop) break; - startIndex -= MP2T_PACKET_LENGTH, endIndex -= MP2T_PACKET_LENGTH; + startIndex -= 188, endIndex -= 188; continue; } startIndex--, endIndex--; } }, parseVideoPes_ = function(bytes, pmt, result) { - for(var packet, pesType, pusi, parsed, frame, i, pes, startIndex = 0, endIndex = MP2T_PACKET_LENGTH, endLoop = !1, currentFrame = { + for(var packet, pesType, pusi, parsed, frame, i, pes, startIndex = 0, endIndex = 188, endLoop = !1, currentFrame = { data: [], size: 0 }; endIndex < bytes.byteLength;){ @@ -10704,15 +10704,15 @@ currentFrame.data.push(packet), currentFrame.size += packet.byteLength; } if (endLoop && result.firstKeyFrame) break; - startIndex += MP2T_PACKET_LENGTH, endIndex += MP2T_PACKET_LENGTH; + startIndex += 188, endIndex += 188; continue; } startIndex++, endIndex++; } - for(startIndex = (endIndex = bytes.byteLength) - MP2T_PACKET_LENGTH, endLoop = !1; startIndex >= 0;){ + for(startIndex = (endIndex = bytes.byteLength) - 188, endLoop = !1; startIndex >= 0;){ if (0x47 === bytes[startIndex] && 0x47 === bytes[endIndex]) { if (packet = bytes.subarray(startIndex, endIndex), "pes" === probe.ts.parseType(packet, pmt.pid) && (pesType = probe.ts.parsePesType(packet, pmt.table), pusi = probe.ts.parsePayloadUnitStartIndicator(packet), "video" === pesType && pusi && (parsed = probe.ts.parsePesTime(packet)) && (parsed.type = "video", result.video.push(parsed), endLoop = !0)), endLoop) break; - startIndex -= MP2T_PACKET_LENGTH, endIndex -= MP2T_PACKET_LENGTH; + startIndex -= 188, endIndex -= 188; continue; } startIndex--, endIndex--; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/analysis-snapshot.rust-debug index b55514d42c1..81626d3ef7c 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/analysis-snapshot.rust-debug @@ -93,7 +93,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 21, reassigned_with_assignment: false, @@ -12809,7 +12809,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -20393,7 +20393,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 9, reassigned_with_assignment: false, @@ -27625,7 +27625,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -29115,7 +29115,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 4, usage_count: 10, reassigned_with_assignment: true, @@ -30415,7 +30415,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 3, usage_count: 19, reassigned_with_assignment: false, @@ -30873,7 +30873,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -38509,7 +38509,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 9, reassigned_with_assignment: false, @@ -39085,7 +39085,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 9, reassigned_with_assignment: false, @@ -45729,7 +45729,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: false, @@ -47009,7 +47009,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -47047,7 +47047,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -51357,7 +51357,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -53287,7 +53287,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 9, reassigned_with_assignment: false, @@ -57075,7 +57075,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 5, mutation_by_call_count: 10, usage_count: 18, reassigned_with_assignment: true, @@ -59191,7 +59191,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -65205,7 +65205,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -66231,7 +66231,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -84165,7 +84165,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -89119,7 +89119,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 12, usage_count: 21, reassigned_with_assignment: true, @@ -91675,7 +91675,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -99127,7 +99127,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, @@ -109321,7 +109321,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 6, mutation_by_call_count: 18, usage_count: 19, reassigned_with_assignment: true, @@ -109511,7 +109511,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -109707,7 +109707,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -109897,7 +109897,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -109935,7 +109935,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -109973,7 +109973,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -113579,7 +113579,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 2, mutation_by_call_count: 4, usage_count: 10, reassigned_with_assignment: true, @@ -118701,7 +118701,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -122661,7 +122661,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 5, mutation_by_call_count: 9, usage_count: 13, reassigned_with_assignment: true, @@ -126743,7 +126743,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -129019,7 +129019,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js index 0d4a20427ba..ff6155c6278 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/pages/index-cb36c1bf7f830e3c/output.js @@ -3465,33 +3465,6 @@ return Object.keys(segmentInfo).forEach(function(key) { segmentInfo[key] || delete segmentInfo[key]; }), segmentInfo; - }, parseCaptionServiceMetadata = function(service) { - return "urn:scte:dash:cc:cea-608:2015" === service.schemeIdUri ? ("string" != typeof service.value ? [] : service.value.split(";")).map(function(value) { - if (language = value, /^CC\d=/.test(value)) { - var channel, language, _value$split = value.split("="); - channel = _value$split[0], language = _value$split[1]; - } else /^CC\d$/.test(value) && (channel = value); - return { - channel: channel, - language: language - }; - }) : "urn:scte:dash:cc:cea-708:2015" === service.schemeIdUri ? ("string" != typeof service.value ? [] : service.value.split(";")).map(function(value) { - var flags = { - channel: void 0, - language: void 0, - aspectRatio: 1, - easyReader: 0, - "3D": 0 - }; - if (/=/.test(value)) { - var _value$split2 = value.split("="), channel = _value$split2[0], _value$split2$ = _value$split2[1]; - flags.channel = channel, flags.language = value, (void 0 === _value$split2$ ? "" : _value$split2$).split(",").forEach(function(opt) { - var _opt$split = opt.split(":"), name = _opt$split[0], val = _opt$split[1]; - "lang" === name ? flags.language = val : "er" === name ? flags.easyReader = Number(val) : "war" === name ? flags.aspectRatio = Number(val) : "3D" === name && (flags["3D"] = Number(val)); - }); - } else flags.language = value; - return flags.channel && (flags.channel = "SERVICE" + flags.channel), flags; - }) : void 0; }, getPeriodStart = function(_ref) { var attributes = _ref.attributes, priorPeriodAttributes = _ref.priorPeriodAttributes, mpdType = _ref.mpdType; return "number" == typeof attributes.start ? attributes.start : priorPeriodAttributes && "number" == typeof priorPeriodAttributes.start && "number" == typeof priorPeriodAttributes.duration ? priorPeriodAttributes.start + priorPeriodAttributes.duration : priorPeriodAttributes || "static" !== mpdType ? null : 0; @@ -3524,9 +3497,34 @@ "number" == typeof period.attributes.duration && (periodAttributes.periodDuration = period.attributes.duration); var periodAttributes1, periodBaseUrls1, periodSegmentInfo, adaptationSets = findChildren(period.node, "AdaptationSet"), periodSegmentInfo1 = getSegmentInformation(period.node); return flatten(adaptationSets.map((periodAttributes1 = periodAttributes, periodBaseUrls1 = periodBaseUrls, periodSegmentInfo = periodSegmentInfo1, function(adaptationSet) { - var adaptationSetAttributes = parseAttributes(adaptationSet), adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls1, findChildren(adaptationSet, "BaseURL")), role = findChildren(adaptationSet, "Role")[0], roleAttributes = { + var service, adaptationSetAttributes = parseAttributes(adaptationSet), adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls1, findChildren(adaptationSet, "BaseURL")), role = findChildren(adaptationSet, "Role")[0], roleAttributes = { role: parseAttributes(role) - }, attrs = merge(periodAttributes1, adaptationSetAttributes, roleAttributes), accessibility = findChildren(adaptationSet, "Accessibility")[0], captionServices = parseCaptionServiceMetadata(parseAttributes(accessibility)); + }, attrs = merge(periodAttributes1, adaptationSetAttributes, roleAttributes), accessibility = findChildren(adaptationSet, "Accessibility")[0], captionServices = "urn:scte:dash:cc:cea-608:2015" === (service = parseAttributes(accessibility)).schemeIdUri ? ("string" != typeof service.value ? [] : service.value.split(";")).map(function(value) { + if (language = value, /^CC\d=/.test(value)) { + var channel, language, _value$split = value.split("="); + channel = _value$split[0], language = _value$split[1]; + } else /^CC\d$/.test(value) && (channel = value); + return { + channel: channel, + language: language + }; + }) : "urn:scte:dash:cc:cea-708:2015" === service.schemeIdUri ? ("string" != typeof service.value ? [] : service.value.split(";")).map(function(value) { + var flags = { + channel: void 0, + language: void 0, + aspectRatio: 1, + easyReader: 0, + "3D": 0 + }; + if (/=/.test(value)) { + var _value$split2 = value.split("="), channel = _value$split2[0], _value$split2$ = _value$split2[1]; + flags.channel = channel, flags.language = value, (void 0 === _value$split2$ ? "" : _value$split2$).split(",").forEach(function(opt) { + var _opt$split = opt.split(":"), name = _opt$split[0], val = _opt$split[1]; + "lang" === name ? flags.language = val : "er" === name ? flags.easyReader = Number(val) : "war" === name ? flags.aspectRatio = Number(val) : "3D" === name && (flags["3D"] = Number(val)); + }); + } else flags.language = value; + return flags.channel && (flags.channel = "SERVICE" + flags.channel), flags; + }) : void 0; captionServices && (attrs = merge(attrs, { captionServices: captionServices })); diff --git a/crates/swc_ecma_minifier/tests/fixture/next/36127/2/3/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/36127/2/3/analysis-snapshot.rust-debug index a2ad2cd8b4a..75ab85f6f92 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/36127/2/3/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/36127/2/3/analysis-snapshot.rust-debug @@ -759,7 +759,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: true, used_in_cond: true, var_kind: Some( @@ -1117,7 +1117,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -1509,7 +1509,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -2063,7 +2063,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -2715,7 +2715,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -3153,7 +3153,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -3465,7 +3465,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -3503,7 +3503,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -4529,7 +4529,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -5819,7 +5819,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -6277,7 +6277,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -6583,7 +6583,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: true, var_kind: None, @@ -6621,7 +6621,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: true, var_kind: None, @@ -6659,7 +6659,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -6696,8 +6696,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: true, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -7191,7 +7191,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/analysis-snapshot.rust-debug index 7694829eb87..fd24c8e998f 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/analysis-snapshot.rust-debug @@ -6203,7 +6203,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -11717,7 +11717,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 9, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/asmjs/1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/asmjs/1/analysis-snapshot.rust-debug index 10072f2ef51..bc6b5fc6f62 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/asmjs/1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/asmjs/1/analysis-snapshot.rust-debug @@ -186441,7 +186441,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -228119,7 +228119,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: true, @@ -235383,7 +235383,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 42, + assign_count: 0, mutation_by_call_count: 0, usage_count: 97, reassigned_with_assignment: false, @@ -236575,7 +236575,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -236615,7 +236615,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: true, @@ -236773,7 +236773,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 13, + assign_count: 9, mutation_by_call_count: 10, usage_count: 12, reassigned_with_assignment: true, @@ -243509,7 +243509,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -243549,7 +243549,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: true, @@ -243707,7 +243707,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 14, + assign_count: 10, mutation_by_call_count: 12, usage_count: 13, reassigned_with_assignment: true, @@ -249207,7 +249207,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: true, @@ -250903,7 +250903,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -256357,7 +256357,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -256437,7 +256437,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -260335,7 +260335,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 9, + assign_count: 3, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -260415,7 +260415,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -263313,7 +263313,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 10, + assign_count: 4, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -263393,7 +263393,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -267317,7 +267317,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -269179,7 +269179,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 5, usage_count: 5, reassigned_with_assignment: true, @@ -274205,7 +274205,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -274245,7 +274245,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 26, + assign_count: 21, mutation_by_call_count: 14, usage_count: 21, reassigned_with_assignment: true, @@ -277369,7 +277369,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/chakra/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/chakra/analysis-snapshot.rust-debug index c58b6ada57c..dbc1674faf7 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/chakra/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/chakra/analysis-snapshot.rust-debug @@ -1127,7 +1127,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -2779,7 +2779,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -4077,7 +4077,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -24903,7 +24903,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 11, + assign_count: 2, mutation_by_call_count: 10, usage_count: 15, reassigned_with_assignment: true, @@ -29853,7 +29853,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -32323,7 +32323,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -33363,7 +33363,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -38475,7 +38475,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -38515,7 +38515,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -46943,7 +46943,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/analysis-snapshot.rust-debug index 27ad966ed18..93e07a65086 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/analysis-snapshot.rust-debug @@ -1329,7 +1329,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 90, usage_count: 101, reassigned_with_assignment: false, @@ -5337,7 +5337,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -7353,7 +7353,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -7393,7 +7393,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -8753,7 +8753,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: false, @@ -8913,7 +8913,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: true, @@ -8953,7 +8953,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -9067,7 +9067,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -11003,7 +11003,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -11981,7 +11981,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: true, @@ -12293,7 +12293,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -12947,7 +12947,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 5, usage_count: 8, reassigned_with_assignment: false, @@ -16841,7 +16841,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -16879,7 +16879,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -16955,7 +16955,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 7, reassigned_with_assignment: false, @@ -19207,7 +19207,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 7, reassigned_with_assignment: false, @@ -20287,7 +20287,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 6, reassigned_with_assignment: false, @@ -25843,7 +25843,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -25923,7 +25923,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -27393,7 +27393,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -27627,7 +27627,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -27667,7 +27667,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -27705,7 +27705,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -27781,7 +27781,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -30231,7 +30231,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 8, usage_count: 11, reassigned_with_assignment: false, @@ -31371,7 +31371,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -32501,7 +32501,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -41383,7 +41383,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -44087,7 +44087,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -45173,7 +45173,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -45567,7 +45567,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -49777,7 +49777,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 5, usage_count: 5, reassigned_with_assignment: false, @@ -51491,7 +51491,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -51771,7 +51771,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -52397,7 +52397,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -52747,7 +52747,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -55269,7 +55269,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 9, usage_count: 9, reassigned_with_assignment: false, @@ -67055,7 +67055,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 5, usage_count: 8, reassigned_with_assignment: true, @@ -67175,7 +67175,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 5, usage_count: 7, reassigned_with_assignment: true, @@ -70613,7 +70613,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -71173,7 +71173,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -74653,7 +74653,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -75811,7 +75811,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: false, @@ -79635,7 +79635,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: true, @@ -79907,7 +79907,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -80567,7 +80567,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -80683,7 +80683,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 6, usage_count: 9, reassigned_with_assignment: false, @@ -80913,7 +80913,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: false, @@ -82183,7 +82183,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 14, reassigned_with_assignment: false, @@ -87523,7 +87523,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 4, usage_count: 10, reassigned_with_assignment: false, @@ -90259,7 +90259,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 6, usage_count: 6, reassigned_with_assignment: false, @@ -90921,7 +90921,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -92827,7 +92827,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: false, @@ -92867,7 +92867,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -93627,7 +93627,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -93667,7 +93667,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 5, usage_count: 5, reassigned_with_assignment: true, @@ -94605,7 +94605,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -94913,7 +94913,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -95491,7 +95491,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -96273,7 +96273,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -97451,7 +97451,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -101201,7 +101201,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -104059,7 +104059,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -105479,7 +105479,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 5, usage_count: 5, reassigned_with_assignment: true, @@ -108729,7 +108729,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -108847,7 +108847,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 6, usage_count: 6, reassigned_with_assignment: false, @@ -109075,7 +109075,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -109151,7 +109151,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -115573,7 +115573,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -117271,7 +117271,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -125335,7 +125335,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -125851,7 +125851,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -126121,7 +126121,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -127601,7 +127601,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -130417,7 +130417,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -133351,7 +133351,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -134801,7 +134801,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -136029,7 +136029,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: false, @@ -139109,7 +139109,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -139613,7 +139613,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 6, reassigned_with_assignment: false, @@ -141511,7 +141511,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 10, reassigned_with_assignment: false, @@ -143029,7 +143029,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -143069,7 +143069,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -144489,7 +144489,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -144565,7 +144565,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 6, usage_count: 6, reassigned_with_assignment: false, @@ -144953,7 +144953,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -145067,7 +145067,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 6, usage_count: 7, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js b/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js index f3401ddc749..771797eb0c3 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js @@ -4588,11 +4588,9 @@ if (null != ch && (moveInStorageOrder ? ch <= part.to && ch <= wrappedLineExtent.end : ch >= part.from && ch >= wrappedLineExtent.begin)) return new Pos(start.line, ch, moveInStorageOrder ? "before" : "after"); } var searchInVisualLine = function(partPos, dir, wrappedLineExtent) { - for(var getRes = function(ch, moveInStorageOrder) { - 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], moveInStorageOrder = dir > 0 == (1 != part.level), ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1); - if (part.from <= ch && ch < part.to || (ch = moveInStorageOrder ? part.from : mv(part.to, -1), wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end)) return getRes(ch, moveInStorageOrder); + for(; partPos >= 0 && partPos < bidi.length; partPos += dir){ + var ch, part = bidi[partPos], moveInStorageOrder = dir > 0 == (1 != part.level), ch1 = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1); + if (part.from <= ch1 && ch1 < part.to || (ch1 = moveInStorageOrder ? part.from : mv(part.to, -1), wrappedLineExtent.begin <= ch1 && ch1 < wrappedLineExtent.end)) return ch = ch1, moveInStorageOrder ? new Pos(start.line, mv(ch, 1), "before") : new Pos(start.line, ch, "after"); } }, res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent); if (res) return res; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/analysis-snapshot.rust-debug index 0c666491549..946170c4fad 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/analysis-snapshot.rust-debug @@ -33961,7 +33961,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -35461,7 +35461,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -35499,7 +35499,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -35537,7 +35537,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -35993,7 +35993,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/analysis-snapshot.rust-debug index 2acd6ac0934..37f4047cb20 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/analysis-snapshot.rust-debug @@ -4161,7 +4161,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 29, reassigned_with_assignment: false, @@ -6697,7 +6697,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -7057,7 +7057,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 10, usage_count: 20, reassigned_with_assignment: false, @@ -9667,7 +9667,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -9939,7 +9939,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -14539,7 +14539,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 1, usage_count: 9, reassigned_with_assignment: false, @@ -14815,7 +14815,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -16871,7 +16871,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -17269,7 +17269,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -17699,7 +17699,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -19499,7 +19499,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -19693,7 +19693,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -21879,7 +21879,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -23409,7 +23409,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -23567,7 +23567,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -23607,7 +23607,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -26817,7 +26817,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: true, @@ -30889,7 +30889,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -30969,7 +30969,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -32219,7 +32219,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -32295,7 +32295,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -32409,7 +32409,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 9, reassigned_with_assignment: false, @@ -32675,7 +32675,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -34521,7 +34521,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -35311,7 +35311,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -38027,7 +38027,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -43473,7 +43473,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -57629,7 +57629,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 30, reassigned_with_assignment: false, @@ -61367,7 +61367,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -62195,7 +62195,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -62787,7 +62787,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -63297,7 +63297,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -65201,7 +65201,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -65393,7 +65393,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: true, @@ -68135,7 +68135,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 4, usage_count: 5, reassigned_with_assignment: true, @@ -69101,7 +69101,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, @@ -69261,7 +69261,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -71257,7 +71257,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 2, usage_count: 8, reassigned_with_assignment: true, @@ -76063,7 +76063,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: true, @@ -79367,7 +79367,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -79599,7 +79599,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -81741,7 +81741,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -83049,7 +83049,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 7, reassigned_with_assignment: true, @@ -83929,7 +83929,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -84847,7 +84847,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 0, usage_count: 11, reassigned_with_assignment: true, @@ -86563,7 +86563,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -86603,7 +86603,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 5, mutation_by_call_count: 4, usage_count: 7, reassigned_with_assignment: true, @@ -91209,7 +91209,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -97549,7 +97549,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: true, @@ -98955,7 +98955,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 9, reassigned_with_assignment: true, @@ -99865,7 +99865,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -103657,7 +103657,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -103893,7 +103893,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -103933,7 +103933,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -103973,7 +103973,7 @@ TestSnapshot { declared_count: 3, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: false, @@ -104611,7 +104611,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: false, @@ -106477,7 +106477,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -106755,7 +106755,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: true, @@ -106989,7 +106989,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -109351,7 +109351,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -110333,7 +110333,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -110609,7 +110609,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -111505,7 +111505,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -114549,7 +114549,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 8, reassigned_with_assignment: true, @@ -115097,7 +115097,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -115137,7 +115137,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -116451,7 +116451,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -117383,7 +117383,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -118059,7 +118059,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -118259,7 +118259,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: true, @@ -120343,7 +120343,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -120463,7 +120463,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: false, @@ -121295,7 +121295,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -124623,7 +124623,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -124663,7 +124663,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -125563,7 +125563,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -125603,7 +125603,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -127565,7 +127565,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 6, usage_count: 10, reassigned_with_assignment: false, @@ -130369,7 +130369,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -132271,7 +132271,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -132711,7 +132711,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -135633,7 +135633,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: false, @@ -138469,7 +138469,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -140293,7 +140293,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 2, usage_count: 9, reassigned_with_assignment: true, @@ -140761,7 +140761,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -140801,7 +140801,7 @@ TestSnapshot { declared_count: 3, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -142131,7 +142131,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -145815,7 +145815,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -149377,7 +149377,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 5, usage_count: 5, reassigned_with_assignment: true, @@ -152475,7 +152475,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -154575,7 +154575,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -155077,7 +155077,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -161699,7 +161699,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 12, reassigned_with_assignment: false, @@ -161779,7 +161779,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: false, @@ -162319,7 +162319,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -164105,7 +164105,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -165651,7 +165651,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -168137,7 +168137,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -168575,7 +168575,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: false, @@ -169475,7 +169475,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -169513,7 +169513,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -169553,7 +169553,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: true, @@ -169751,7 +169751,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -169989,7 +169989,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -170107,7 +170107,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -170145,7 +170145,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -170261,7 +170261,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -170495,7 +170495,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -170611,7 +170611,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -170689,7 +170689,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -170729,7 +170729,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -170769,7 +170769,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -171975,7 +171975,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -176031,7 +176031,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 7, reassigned_with_assignment: false, @@ -176347,7 +176347,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -177687,7 +177687,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -179949,7 +179949,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -182873,7 +182873,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 12, reassigned_with_assignment: false, @@ -184391,7 +184391,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -187387,7 +187387,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 4, usage_count: 9, reassigned_with_assignment: false, @@ -192383,7 +192383,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -192541,7 +192541,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -192579,7 +192579,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -192735,7 +192735,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -192773,7 +192773,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: false, @@ -193161,7 +193161,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -193199,7 +193199,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/analysis-snapshot.rust-debug index 3666c33d18e..9beab239ff9 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/analysis-snapshot.rust-debug @@ -883,7 +883,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -2753,7 +2753,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 6, usage_count: 110, reassigned_with_assignment: false, @@ -5231,7 +5231,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 14, reassigned_with_assignment: false, @@ -7075,7 +7075,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -7549,7 +7549,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 8, reassigned_with_assignment: false, @@ -9291,7 +9291,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 14, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -9331,7 +9331,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: true, @@ -9915,7 +9915,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 12, usage_count: 175, reassigned_with_assignment: false, @@ -11713,7 +11713,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 10, + assign_count: 0, mutation_by_call_count: 2, usage_count: 12, reassigned_with_assignment: false, @@ -13589,7 +13589,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -16143,7 +16143,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -16381,7 +16381,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -19291,7 +19291,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -19839,7 +19839,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -29651,7 +29651,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 32, + assign_count: 21, mutation_by_call_count: 0, usage_count: 40, reassigned_with_assignment: true, @@ -31925,7 +31925,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 7, mutation_by_call_count: 4, usage_count: 31, reassigned_with_assignment: true, @@ -32827,7 +32827,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 18, + assign_count: 2, mutation_by_call_count: 5, usage_count: 13, reassigned_with_assignment: true, @@ -34073,7 +34073,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -71923,7 +71923,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -71963,7 +71963,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -72003,7 +72003,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -80675,7 +80675,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -81151,7 +81151,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -82107,7 +82107,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -91317,7 +91317,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -99255,7 +99255,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: false, @@ -100561,7 +100561,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -101321,7 +101321,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -106197,7 +106197,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: true, @@ -106539,7 +106539,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 25, usage_count: 44, reassigned_with_assignment: false, @@ -106653,7 +106653,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -106807,7 +106807,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -106961,7 +106961,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -107191,7 +107191,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -107231,7 +107231,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: true, @@ -120613,7 +120613,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -125069,7 +125069,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -125185,7 +125185,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 6, reassigned_with_assignment: false, @@ -126745,7 +126745,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -129279,7 +129279,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -129397,7 +129397,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 6, usage_count: 11, reassigned_with_assignment: true, @@ -129513,7 +129513,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 6, mutation_by_call_count: 0, usage_count: 26, reassigned_with_assignment: true, @@ -130093,7 +130093,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 2, mutation_by_call_count: 2, usage_count: 8, reassigned_with_assignment: true, @@ -130169,7 +130169,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -130209,7 +130209,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 19, + assign_count: 7, mutation_by_call_count: 26, usage_count: 88, reassigned_with_assignment: true, @@ -130367,7 +130367,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -131475,7 +131475,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -136255,7 +136255,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -139805,7 +139805,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -141799,7 +141799,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -141839,7 +141839,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -141917,7 +141917,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -144907,7 +144907,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -146569,7 +146569,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -147745,7 +147745,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -148709,7 +148709,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 10, + assign_count: 6, mutation_by_call_count: 2, usage_count: 25, reassigned_with_assignment: true, @@ -149221,7 +149221,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -149299,7 +149299,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -149379,7 +149379,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -149419,7 +149419,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 29, + assign_count: 15, mutation_by_call_count: 8, usage_count: 43, reassigned_with_assignment: true, @@ -149459,7 +149459,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 13, reassigned_with_assignment: false, @@ -149499,7 +149499,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: true, @@ -150315,7 +150315,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -150355,7 +150355,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -150395,7 +150395,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -150671,7 +150671,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -150711,7 +150711,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -150789,7 +150789,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -159545,7 +159545,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -161261,7 +161261,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 10, mutation_by_call_count: 0, usage_count: 34, reassigned_with_assignment: true, @@ -161805,7 +161805,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -165203,7 +165203,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -173037,7 +173037,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -173461,7 +173461,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -173855,7 +173855,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -179253,7 +179253,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 15, + assign_count: 13, mutation_by_call_count: 3, usage_count: 28, reassigned_with_assignment: true, @@ -179333,7 +179333,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 8, usage_count: 10, reassigned_with_assignment: false, @@ -179373,7 +179373,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -179413,7 +179413,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 18, + assign_count: 6, mutation_by_call_count: 3, usage_count: 22, reassigned_with_assignment: true, @@ -193751,7 +193751,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -219923,7 +219923,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -221179,7 +221179,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -221751,7 +221751,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -226051,7 +226051,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 7, usage_count: 7, reassigned_with_assignment: false, @@ -226089,7 +226089,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 7, usage_count: 7, reassigned_with_assignment: false, @@ -226165,7 +226165,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -227343,7 +227343,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 6, usage_count: 15, reassigned_with_assignment: true, @@ -227383,7 +227383,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 23, + assign_count: 12, mutation_by_call_count: 11, usage_count: 52, reassigned_with_assignment: true, @@ -227657,7 +227657,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -230155,7 +230155,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 10, reassigned_with_assignment: false, @@ -232567,7 +232567,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -247753,7 +247753,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -248349,7 +248349,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 6, mutation_by_call_count: 3, usage_count: 12, reassigned_with_assignment: true, @@ -248389,7 +248389,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 20, + assign_count: 9, mutation_by_call_count: 5, usage_count: 33, reassigned_with_assignment: true, @@ -248429,7 +248429,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -249249,7 +249249,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -256397,7 +256397,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -261379,7 +261379,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -261417,7 +261417,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -261775,7 +261775,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -262055,7 +262055,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 2, mutation_by_call_count: 8, usage_count: 9, reassigned_with_assignment: true, @@ -262095,7 +262095,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 17, + assign_count: 5, mutation_by_call_count: 3, usage_count: 24, reassigned_with_assignment: true, @@ -262135,7 +262135,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -264997,7 +264997,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -268746,7 +268746,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -276239,7 +276239,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 2, usage_count: 7, reassigned_with_assignment: true, @@ -276435,7 +276435,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -276475,7 +276475,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 4, usage_count: 25, reassigned_with_assignment: true, @@ -298899,7 +298899,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -314571,7 +314571,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -319631,7 +319631,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -320617,7 +320617,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: true, @@ -320735,7 +320735,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 4, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -327605,7 +327605,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -327643,7 +327643,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -327721,7 +327721,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -328077,7 +328077,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -328157,7 +328157,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 1, usage_count: 8, reassigned_with_assignment: true, @@ -335133,7 +335133,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -335557,7 +335557,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 12, reassigned_with_assignment: false, @@ -336857,7 +336857,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -345043,7 +345043,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -349659,7 +349659,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -360349,7 +360349,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -361935,7 +361935,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 67, usage_count: 67, reassigned_with_assignment: false, @@ -364043,7 +364043,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -376153,7 +376153,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -376343,7 +376343,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 7, reassigned_with_assignment: false, @@ -376381,7 +376381,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 7, reassigned_with_assignment: false, @@ -380947,7 +380947,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -383279,7 +383279,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -397855,7 +397855,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -398435,7 +398435,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -398871,7 +398871,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -404533,7 +404533,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 15, + assign_count: 0, mutation_by_call_count: 0, usage_count: 10, reassigned_with_assignment: false, @@ -406225,7 +406225,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -406735,7 +406735,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -421599,7 +421599,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -422861,7 +422861,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -424361,7 +424361,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -424399,7 +424399,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -424437,7 +424437,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -424893,7 +424893,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -428127,7 +428127,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -437983,7 +437983,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 5, usage_count: 16, reassigned_with_assignment: true, @@ -438023,7 +438023,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 5, usage_count: 14, reassigned_with_assignment: true, @@ -438063,7 +438063,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -438183,7 +438183,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -438339,7 +438339,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -441319,7 +441319,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -441901,7 +441901,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -458003,7 +458003,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -458119,7 +458119,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 12, reassigned_with_assignment: false, @@ -468409,7 +468409,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -477105,7 +477105,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 7, reassigned_with_assignment: false, @@ -482197,7 +482197,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 9, reassigned_with_assignment: false, @@ -487815,7 +487815,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -509183,7 +509183,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -513521,7 +513521,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 5, mutation_by_call_count: 6, usage_count: 19, reassigned_with_assignment: true, @@ -513561,7 +513561,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: true, @@ -513797,7 +513797,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: false, @@ -516065,7 +516065,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -521217,7 +521217,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -530133,7 +530133,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -532253,7 +532253,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -535145,7 +535145,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 6, reassigned_with_assignment: false, @@ -537377,7 +537377,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -541893,7 +541893,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 5, usage_count: 9, reassigned_with_assignment: true, @@ -541933,7 +541933,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -544223,7 +544223,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 5, reassigned_with_assignment: false, @@ -544417,7 +544417,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -547829,7 +547829,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 7, usage_count: 12, reassigned_with_assignment: true, @@ -547987,7 +547987,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -549013,7 +549013,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -549131,7 +549131,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -550869,7 +550869,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 7, usage_count: 12, reassigned_with_assignment: true, @@ -551027,7 +551027,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 0, mutation_by_call_count: 0, usage_count: 7, reassigned_with_assignment: false, @@ -551267,7 +551267,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js index 07c98533140..05c30a3ee55 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js @@ -817,21 +817,21 @@ if (!r[t]) throw Error("Font family not registered: " + t + ". Please register it calling Font.register() method."); return r[t].resolve(e); }, this.load = (e = d.default(h.default.mark(function e(r) { - var n, i, o; + var n, i; return h.default.wrap(function(e) { for(;;)switch(e.prev = e.next){ case 0: - if (n = r.fontFamily, !(i = S.includes(n))) { + if (n = r.fontFamily, !S.includes(n)) { e.next = 4; break; } return e.abrupt("return"); case 4: - if (!(!(o = t.getFont(r)).data && !o.loading)) { + if (!(!(i = t.getFont(r)).data && !i.loading)) { e.next = 8; break; } - return e.next = 8, o.load(); + return e.next = 8, i.load(); case 8: case "end": return e.stop(); @@ -1404,33 +1404,26 @@ return t.type === e; }; }, e$ = eE(T.Svg), ex = eE(T.Text), eS = eE(T.TextInstance), eA = function(e) { - return function(t) { - return n.mapValues(t, function(t, r) { - var i = n.matchPercent(t); - return i && eD.includes(r) ? i.percent * e.height : i && ew.includes(r) ? i.percent * e.width : t; - }); - }; - }, ek = function(e) { var t = n.matchPercent(e); return t ? t.percent : parseFloat(e); - }, eT = function(e) { + }, ek = function(e) { var t = Object.assign({}, e.style || {}, e.props); return Object.assign({}, e, { props: t }); - }, eO = function(e) { + }, eT = function(e) { var t = function(e) { return "none" === e ? null : e; }, r = n.mapValues(e.props, t); return Object.assign({}, e, { props: r }); - }, eC = function(e) { + }, eO = function(e) { var t = e.props || {}, r = Object.assign({}, n.pick(em, t), e.style || {}); return Object.assign({}, e, { style: r }); - }, eP = function(e) { + }, eC = function(e) { var t = n.evolve({ width: parseFloat, height: parseFloat, @@ -1440,7 +1433,7 @@ return Object.assign({}, e, { props: t }); - }, eF = function(e) { + }, eP = function(e) { if (!ex(e) || !e.children) return e; var t = function(e) { var t; @@ -1455,11 +1448,16 @@ return Object.assign({}, e, { children: r }); - }, eR = function(e) { + }, eF = function(e) { var t; return n.compose((t = e, function(e) { - var r = eA(t)(e.props); - return r = n.evolve({ + var r, i = (r = t, function(e) { + return n.mapValues(e, function(e, t) { + var i = n.matchPercent(e); + return i && eD.includes(t) ? i.percent * r.height : i && ew.includes(t) ? i.percent * r.width : e; + }); + })(e.props); + return i = n.evolve({ x: parseFloat, x1: parseFloat, x2: parseFloat, @@ -1473,18 +1471,18 @@ cy: parseFloat, width: parseFloat, height: parseFloat, - offset: ek, + offset: eA, fill: o.transformColor, - opacity: ek, + opacity: eA, stroke: o.transformColor, - stopOpacity: ek, + stopOpacity: eA, stopColor: o.transformColor, transform: o.processTransform - }, r), Object.assign({}, e, { - props: r + }, i), Object.assign({}, e, { + props: i }); - }), eF, eO, eT); - }, eI = function(e, t) { + }), eP, eT, ek); + }, eR = function(e, t) { var r = eh(e); return n.compose(ed, function e(t) { return function(r) { @@ -1495,35 +1493,35 @@ children: n }); }; - }(t), eP, eC, ev, function e(t) { + }(t), eC, eO, ev, function e(t) { return function(r) { if (!r.children) return r; - var i = n.compose(e(t), eR(t)), o = r.children.map(i); + var i = n.compose(e(t), eF(t)), o = r.children.map(i); return Object.assign({}, r, { children: o }); }; }(r))(e); - }, ej = function e(t, r) { + }, eI = function e(t, r) { if (!t.children) return t; var n = function(t) { return e(t, r); - }, i = e$(t) ? eI(t, r) : t, o = i.children.map(n); + }, i = e$(t) ? eR(t, r) : t, o = i.children.map(n); return Object.assign({}, i, { children: o }); - }, eB = function(e) { + }, ej = function(e) { return e.style.zIndex; - }, eM = function(e, t) { - var r = eB(e), n = eB(t); + }, eB = function(e, t) { + var r = ej(e), n = ej(t); return r || n ? r ? n ? n - r : -1 : 1 : 0; - }, eN = function e(t) { + }, eM = function e(t) { if (!t.children) return t; - var r, n = ((r = t).type !== T.Document && r.type !== T.Svg ? t.children.sort(eM) : t.children).map(e); + var r, n = ((r = t).type !== T.Document && r.type !== T.Svg ? t.children.sort(eB) : t.children).map(e); return Object.assign({}, t, { children: n }); - }, eL = {}, eU = z.default(), ez = function() { + }, eN = {}, eL = z.default(), eU = function() { var e; return e = W.default, function() { return e.apply(void 0, arguments).then(function(e) { @@ -1532,43 +1530,43 @@ return e; }); }; - }, eW = function(e) { + }, ez = function(e) { return "️" !== e; - }, eG = function(e, t) { + }, eW = function(e, t) { var r = t.url, n = t.format; - return "" + r + Array.from(e).filter(eW).map(function(e) { + return "" + r + Array.from(e).filter(ez).map(function(e) { return e.codePointAt(0).toString(16); }).join("-") + "." + n; - }, eq = function(e, t) { + }, eG = function(e, t) { if (!t || !t.url) return []; - for(var r, n = []; r = eU.exec(e);)!function() { + for(var r, n = []; r = eL.exec(e);)!function() { var e = r[0]; - if (!eL[e] || eL[e].loading) { - var i = eG(e, t); - eL[e] = { + if (!eN[e] || eN[e].loading) { + var i = eW(e, t); + eN[e] = { loading: !0 }; - var o = ez(); + var o = eU(); n.push(o({ uri: i }).then(function(t) { - eL[e].loading = !1, eL[e].data = t.data; + eN[e].loading = !1, eN[e].data = t.data; })); } }(); return n; - }, eV = function(e) { + }, eq = function(e) { for(var t = [], r = 0; r < e.length; r += 1){ - for(var n = e[r], i = void 0, o = 0; i = eU.exec(n.string);){ + for(var n = e[r], i = void 0, o = 0; i = eL.exec(n.string);){ var a = i.index, u = i[0], l = n.attributes.fontSize, s = n.string.slice(o, a + i[0].length); - eL[u] && eL[u].data ? t.push({ + eN[u] && eN[u].data ? t.push({ string: s.replace(i, ""), attributes: U.default({}, n.attributes, { attachment: { width: l, height: l, yOffset: Math.floor(0.1 * l), - image: eL[u].data + image: eN[u].data } }) }) : t.push({ @@ -1582,10 +1580,10 @@ }); } return t; - }, eH = function(e) { + }, eV = function(e) { var t, r, n; return (null === (t = e.props) || void 0 === t ? void 0 : t.src) || (null === (r = e.props) || void 0 === r ? void 0 : r.source) || (null === (n = e.props) || void 0 === n ? void 0 : n.href); - }, eZ = (S = N.default(L.default.mark(function e(t) { + }, eH = (S = N.default(L.default.mark(function e(t) { var r; return L.default.wrap(function(e) { for(;;)switch(e.prev = e.next){ @@ -1613,18 +1611,18 @@ }, e); })), function(e) { return S.apply(this, arguments); - }), eX = (A = N.default(L.default.mark(function e(t) { + }), eZ = (A = N.default(L.default.mark(function e(t) { var r, n, i; return L.default.wrap(function(e) { for(;;)switch(e.prev = e.next){ case 0: - if (r = eH(t), n = t.props.cache, r) { + if (r = eV(t), n = t.props.cache, r) { e.next = 5; break; } return console.warn(!1, 'Image should receive either a "src" or "source" prop'), e.abrupt("return"); case 5: - return e.prev = 5, e.next = 8, eZ(r); + return e.prev = 5, e.next = 8, eH(r); case 8: if (i = e.sent) { e.next = 11; @@ -1656,20 +1654,20 @@ ]); })), function(e) { return A.apply(this, arguments); - }), eJ = function(e, t) { + }), eX = function(e, t) { for(var r = [], n = (null === (o = t.children) || void 0 === o ? void 0 : o.slice(0)) || [], i = e ? e.getEmojiSource() : null; n.length > 0;){ var o, a, u = n.shift(); - u.type === T.Image && r.push(eX(u)), e && null !== (a = u.style) && void 0 !== a && a.fontFamily && r.push(e.load(u.style)), "string" == typeof u && r.push.apply(r, eq(u, i)), "string" == typeof u.value && r.push.apply(r, eq(u.value, i)), u.children && u.children.forEach(function(e) { + u.type === T.Image && r.push(eZ(u)), e && null !== (a = u.style) && void 0 !== a && a.fontFamily && r.push(e.load(u.style)), "string" == typeof u && r.push.apply(r, eG(u, i)), "string" == typeof u.value && r.push.apply(r, eG(u.value, i)), u.children && u.children.forEach(function(e) { n.push(e); }); } return r; - }, eY = (k = N.default(L.default.mark(function e(t, r) { + }, eJ = (k = N.default(L.default.mark(function e(t, r) { var n; return L.default.wrap(function(e) { for(;;)switch(e.prev = e.next){ case 0: - return n = eJ(r, t), e.next = 3, Promise.all(n); + return n = eX(r, t), e.next = 3, Promise.all(n); case 3: return e.abrupt("return", t); case 4: @@ -1679,19 +1677,19 @@ }, e); })), function(e, t) { return k.apply(this, arguments); - }), eK = { + }), eY = { color: "blue", textDecoration: "underline" - }, eQ = function(e, t) { - var r = t.type === T.Link ? eK : {}, n = Array.isArray(t.style) ? [].concat(t.style, [ + }, eK = function(e, t) { + var r = t.type === T.Link ? eY : {}, n = Array.isArray(t.style) ? [].concat(t.style, [ r ]) : Object.assign({}, r, t.style); return O.default(e, n); - }, e_ = function(e) { + }, eQ = function(e) { var t, r = (null === (t = e.props) || void 0 === t ? void 0 : t.dpi) || 72, n = e.box || e.style; return (function e(t) { return function(r) { - var n = eQ(t, r); + var n = eK(t, r); if (!r.children) return Object.assign({}, r, { style: n }); @@ -1704,26 +1702,26 @@ })(U.default({}, n, { dpi: r }))(e); - }, e0 = function(e) { + }, e_ = function(e) { if (!e.children) return e; - var t = e.children.map(e_); + var t = e.children.map(eQ); return Object.assign({}, e, { children: t }); - }, e1 = function(e) { + }, e0 = function(e) { return function(t) { var r, i; return n.isNil(null === (r = t.style) || void 0 === r ? void 0 : r[e]) ? "50%" : null === (i = t.style) || void 0 === i ? void 0 : i[e]; }; - }, e2 = function(e) { + }, e1 = function(e) { if (!e.box) return {}; - var t = e.box, r = t.left, i = t.top, o = t.width, a = t.height, u = e1("transformOriginX")(e), l = e1("transformOriginY")(e), s = n.matchPercent(u), c = n.matchPercent(l), f = s ? o * s.percent : u, d = c ? a * c.percent : l; + var t = e.box, r = t.left, i = t.top, o = t.width, a = t.height, u = e0("transformOriginX")(e), l = e0("transformOriginY")(e), s = n.matchPercent(u), c = n.matchPercent(l), f = s ? o * s.percent : u, d = c ? a * c.percent : l; return { left: r + f, top: i + d }; - }, e3 = function e(t) { - var r = e2(t), n = Object.assign({}, t, { + }, e2 = function e(t) { + var r = e1(t), n = Object.assign({}, t, { origin: r }); if (!t.children) return n; @@ -1731,19 +1729,19 @@ return Object.assign({}, n, { children: i }); - }, e4 = function(e) { + }, e3 = function(e) { if (!e.children) return e; - var t = e.children.map(e3); + var t = e.children.map(e2); return Object.assign({}, e, { children: t }); - }, e5 = function(e) { + }, e4 = function(e) { return "string" == typeof e ? { title: e, fit: !1, expanded: !1 } : e; - }, e8 = function(e) { + }, e5 = function(e) { for(var t = 0, r = (e.children || []).slice(0).map(function(e) { return { value: e, @@ -1752,7 +1750,7 @@ }); r.length > 0;)!function() { var e = r.shift(), n = e.value, i = e.parent; if (null !== (o = n.props) && void 0 !== o && o.bookmark) { - var o, a, u = e5(n.props.bookmark), l = t++, s = U.default({ + var o, a, u = e4(n.props.bookmark), l = t++, s = U.default({ ref: l, parent: null === (a = i) || void 0 === a ? void 0 : a.ref }, u); @@ -1766,13 +1764,13 @@ }); }(); return e; - }, e6 = [ + }, e8 = [ "portrait", "landscape" - ], e7 = function(e) { + ], e6 = function(e) { var t, r = (null === (t = e.props) || void 0 === t ? void 0 : t.orientation) || "portrait"; - return e6.includes(r) ? r : "portrait"; - }, e9 = { + return e8.includes(r) ? r : "portrait"; + }, e7 = { "4A0": [ 4767.87, 6740.79 @@ -1977,37 +1975,37 @@ 153, 243 ] - }, te = function(e) { + }, e9 = function(e) { return { width: e[0], height: e[1] }; - }, tt = function(e) { + }, te = function(e) { var t, r, n, i, o, a = (null === (i = e.props) || void 0 === i ? void 0 : i.size) || "A4", u = parseFloat((null === (o = e.props) || void 0 === o ? void 0 : o.dpi) || 72), l = typeof a, s = a; - return "string" === l ? s = te(e9[a.toUpperCase()]) : Array.isArray(a) ? s = te(a) : "number" === l && (s = te([ + return "string" === l ? s = e9(e7[a.toUpperCase()]) : Array.isArray(a) ? s = e9(a) : "number" === l && (s = e9([ a ])), s = (t = s, r = u / 72, { width: t.width ? t.width * r : t.width, height: t.height ? t.height * r : t.height - }), "landscape" === e7(e) ? { + }), "landscape" === e6(e) ? { width: (n = s).height, height: n.width } : s; - }, tr = function(e) { - var t = tt(e), r = G.default(e.style || {}); + }, tt = function(e) { + var t = te(e), r = G.default(e.style || {}); return U.default({}, e, { style: U.default({}, r, t) }); - }, tn = function(e) { + }, tr = function(e) { if (!e.children) return e; - var t = e.children.map(tr); + var t = e.children.map(tt); return Object.assign({}, e, { children: t }); - }, ti = function(e) { + }, tn = function(e) { var t; return (null === (t = e.props) || void 0 === t ? void 0 : t.fixed) === !0; - }, to = function(e, t) { + }, ti = function(e, t) { var r = 0; if (!e.lines) return 0; for(var n = 0; n < e.lines.length; n += 1){ @@ -2016,7 +2014,7 @@ r += i.box.height; } return e.lines.length; - }, ta = function(e, t) { + }, to = function(e, t) { var r = 0; if (!e.lines) return r; for(var n = 0; n < t; n += 1){ @@ -2025,7 +2023,7 @@ r += i.box.height; } return r; - }, tu = function(e, t) { + }, ta = function(e, t) { var r = n.get(e, [ "box", "top" @@ -2035,10 +2033,10 @@ ], 2), o = n.get(e, [ "props", "orphans" - ], 2), a = e.lines.length, u = to(e, t - r); + ], 2), a = e.lines.length, u = ti(e, t - r); return 0 === u ? 0 : a < o ? a : u < o || a < o + i ? 0 : a === o + i ? o : a - u < i ? a - i : u; - }, tl = function(e, t) { - var r = tu(e, t), n = ta(e, r), i = e.box.height - n, o = Object.assign({}, e, { + }, tu = function(e, t) { + var r = ta(e, t), n = to(e, r), i = e.box.height - n, o = Object.assign({}, e, { box: U.default({}, e.box, { height: n, borderBottomWidth: 0 @@ -2070,18 +2068,18 @@ o, a ]; - }, ts = function(e) { + }, tl = function(e) { var t; return (null === (t = e.box) || void 0 === t ? void 0 : t.top) || 0; - }, tc = function(e) { + }, ts = function(e) { var t; return !n.isNil(null === (t = e.style) || void 0 === t ? void 0 : t.height); - }, tf = function(e, t) { + }, tc = function(e, t) { if (!e) return [ null, null ]; - var r = ts(e), n = Object.assign({}, e, { + var r = tl(e), n = Object.assign({}, e, { box: U.default({}, e.box, { borderBottomWidth: 0 }), @@ -2094,7 +2092,7 @@ }) }); n.style.height = t - r; - var i = tc(e) ? e.box.height - (t - r) : null, o = Object.assign({}, e, { + var i = ts(e) ? e.box.height - (t - r) : null, o = Object.assign({}, e, { box: U.default({}, e.box, { top: 0, borderTopWidth: 0 @@ -2111,44 +2109,44 @@ n, o ]; - }, td = [ + }, tf = [ T.Svg, T.Note, T.Image, T.Canvas, - ], tp = function(e) { + ], td = function(e) { var t; - return !td.includes(e.type) && (!!n.isNil(null === (t = e.props) || void 0 === t ? void 0 : t.wrap) || e.props.wrap); - }, th = function(e, t) { + return !tf.includes(e.type) && (!!n.isNil(null === (t = e.props) || void 0 === t ? void 0 : t.wrap) || e.props.wrap); + }, tp = function(e, t) { var r = e._yogaNode; return r ? r.getComputedPadding(t) : null; - }, ty = function(e) { - var t = e.style, r = e.box, n = th(e, q.default.EDGE_TOP) || (null == r ? void 0 : r.paddingTop) || (null == t ? void 0 : t.paddingTop) || (null == t ? void 0 : t.paddingVertical) || (null == t ? void 0 : t.padding) || 0, i = th(e, q.default.EDGE_RIGHT) || (null == r ? void 0 : r.paddingRight) || (null == t ? void 0 : t.paddingRight) || (null == t ? void 0 : t.paddingHorizontal) || (null == t ? void 0 : t.padding) || 0, o = th(e, q.default.EDGE_BOTTOM) || (null == r ? void 0 : r.paddingBottom) || (null == t ? void 0 : t.paddingBottom) || (null == t ? void 0 : t.paddingVertical) || (null == t ? void 0 : t.padding) || 0, a = th(e, q.default.EDGE_LEFT) || (null == r ? void 0 : r.paddingLeft) || (null == t ? void 0 : t.paddingLeft) || (null == t ? void 0 : t.paddingHorizontal) || (null == t ? void 0 : t.padding) || 0; + }, th = function(e) { + var t = e.style, r = e.box, n = tp(e, q.default.EDGE_TOP) || (null == r ? void 0 : r.paddingTop) || (null == t ? void 0 : t.paddingTop) || (null == t ? void 0 : t.paddingVertical) || (null == t ? void 0 : t.padding) || 0, i = tp(e, q.default.EDGE_RIGHT) || (null == r ? void 0 : r.paddingRight) || (null == t ? void 0 : t.paddingRight) || (null == t ? void 0 : t.paddingHorizontal) || (null == t ? void 0 : t.padding) || 0, o = tp(e, q.default.EDGE_BOTTOM) || (null == r ? void 0 : r.paddingBottom) || (null == t ? void 0 : t.paddingBottom) || (null == t ? void 0 : t.paddingVertical) || (null == t ? void 0 : t.padding) || 0, a = tp(e, q.default.EDGE_LEFT) || (null == r ? void 0 : r.paddingLeft) || (null == t ? void 0 : t.paddingLeft) || (null == t ? void 0 : t.paddingHorizontal) || (null == t ? void 0 : t.padding) || 0; return { paddingTop: n, paddingRight: i, paddingBottom: o, paddingLeft: a }; - }, tg = function(e) { - var t, r = ty(e).paddingBottom; + }, ty = function(e) { + var t, r = th(e).paddingBottom; return (null === (t = e.style) || void 0 === t ? void 0 : t.height) - r; - }, tv = function(e) { - var t, r = null === (t = e.style) || void 0 === t ? void 0 : t.height, n = ty(e), i = n.paddingTop; + }, tg = function(e) { + var t, r = null === (t = e.style) || void 0 === t ? void 0 : t.height, n = th(e), i = n.paddingTop; return r - n.paddingBottom - i; - }, tb = [ + }, tv = [ "style", "children" - ], tm = function(e) { + ], tb = function(e) { return "string" == typeof e; - }, tD = function e(t) { + }, tm = function e(t) { if (!t) return null; - if (tm(t) || "number" == typeof t) return { + if (tb(t) || "number" == typeof t) return { type: i.TextInstance, value: "" + t }; - if (!tm(t.type)) return e(t.type(t.props)); - var r = t.type, o = t.props, a = o.style, u = o.children, l = V.default(o, tb), s = n.castArray(void 0 === u ? [] : u).map(e); + if (!tb(t.type)) return e(t.type(t.props)); + var r = t.type, o = t.props, a = o.style, u = o.children, l = V.default(o, tv), s = n.castArray(void 0 === u ? [] : u).map(e); return { type: r, style: void 0 === a ? {} : a, @@ -2156,7 +2154,7 @@ box: {}, children: s }; - }, tw = function(e) { + }, tD = function(e) { var t = 0, r = 1 / 0; if (!e || 0 === e.length) return 0; for(var n = 0; n < e.length; n += 1){ @@ -2164,35 +2162,35 @@ r = Math.min(r, i.box.top), t = Math.max(t, i.box.top + i.box.height); } return t - r; - }, tE = function(e) { + }, tw = function(e) { var t; return (null === (t = e.props) || void 0 === t ? void 0 : t.break) || !1; - }, t$ = function(e) { + }, tE = function(e) { var t; return null === (t = e.props) || void 0 === t ? void 0 : t.minPresenceAhead; - }, tx = function(e) { + }, t$ = function(e) { return function(t) { return Math.min(e.box.height, t); }; - }, tS = function(e, t) { + }, tx = function(e, t) { for(var r = 0, n = 0; n < e.length; n += 1){ var i = e[n]; if (i.box) { - var o = t > i.box.top, a = i.props.presenceAhead || tx(i); + var o = t > i.box.top, a = i.props.presenceAhead || t$(i); i && o && (r += a(t - i.box.top)); } } return r; - }, tA = function(e, t, r) { - var n = t$(e), i = tS(t, r), o = tw(t), a = r < e.box.top + e.box.height, u = tp(e); - return tE(e) || !u && a || n < o && i < n; - }, tk = [ + }, tS = function(e, t, r) { + var n = tE(e), i = tx(t, r), o = tD(t), a = r < e.box.top + e.box.height, u = td(e); + return tw(e) || !u && a || n < o && i < n; + }, tA = [ 8232, 8233 - ], tT = [ + ], tk = [ function(e) { return e.map(function(e) { - var t, r = RegExp((t = e.attributes.font, tk.reduce(function(e, r) { + var t, r = RegExp((t = e.attributes.font, tA.reduce(function(e, r) { return t && t.hasGlyphForCodePoint && t.hasGlyphForCodePoint(r) ? e : [].concat(e, [ String.fromCharCode(r) ]); @@ -2203,8 +2201,8 @@ }; }); }, - eV - ], tO = function e(t, r, n, i) { + eq + ], tT = function e(t, r, n, i) { if (void 0 === i && (i = 0), !r) return [ { string: "" @@ -2247,26 +2245,26 @@ attributes: A }) : F && (P = o).push.apply(P, e(t, F, A.link, i + 1)); } - for(var R = 0; R < tT.length; R += 1)o = (0, tT[R])(o); + for(var R = 0; R < tk.length; R += 1)o = (0, tk[R])(o); return o; - }, tC = function(e, t) { - var r = tO(e, t); + }, tO = function(e, t) { + var r = tT(e, t); return B.default(r); - }, tP = { + }, tC = { linebreaker: P.default, justification: F.default, textDecoration: j.default, scriptItemizer: R.default, wordHyphenation: I.default, fontSubstitution: ee - }, tF = C.default(tP), tR = function(e) { + }, tP = C.default(tC), tF = function(e) { var t; return null === (t = e.style) || void 0 === t ? void 0 : t.maxLines; - }, tI = function(e) { + }, tR = function(e) { var t; return null === (t = e.style) || void 0 === t ? void 0 : t.textOverflow; - }, tj = function(e, t, r) { - var n = tR(r), i = tI(r); + }, tI = function(e, t, r) { + var n = tF(r), i = tR(r); return { x: 0, y: 0, @@ -2275,8 +2273,8 @@ height: t || 1 / 0, truncateMode: i }; - }, tB = function(e, t, r, n) { - var i, o, a = tC(n, e), u = tj(t, r, e), l = (i = n, { + }, tj = function(e, t, r, n) { + var i, o, a = tO(n, e), u = tI(t, r, e), l = (i = n, { hyphenationPenalty: (o = e).props.hyphenationPenalty, shrinkWhitespaceFactor: { before: -0.5, @@ -2284,19 +2282,19 @@ }, hyphenationCallback: o.props.hyphenationCallback || (null == i ? void 0 : i.getHyphenationCallback()) || null }); - return tF(a, u, l).reduce(function(e, t) { + return tP(a, u, l).reduce(function(e, t) { return [].concat(e, t); }, []); - }, tM = function(e) { + }, tB = function(e) { return function(t) { return t.type === e; }; - }, tN = tM(T.Svg), tL = tM(T.Text), tU = function e(t, r) { - if (tL(n = t) && !n.lines) { + }, tM = tB(T.Svg), tN = tB(T.Text), tL = function e(t, r) { + if (tN(n = t) && !n.lines) { var n, i, o = t.box.width - (t.box.paddingRight + t.box.paddingLeft), a = t.box.height - (t.box.paddingTop + t.box.paddingBottom); - t.lines = tB(t, o, a, r); + t.lines = tj(t, o, a, r); } - if (!tN(i = t) && !tL(i)) { + if (!tM(i = t) && !tN(i)) { if (!t.children) return t; var u = function(t) { return e(t, r); @@ -2306,7 +2304,7 @@ }); } return t; - }, tz = [ + }, tU = [ "color", "fontFamily", "fontSize", @@ -2320,7 +2318,7 @@ "textAlign", "visibility", "wordSpacing", - ], tW = function(e, t) { + ], tz = function(e, t) { var r = U.default({}, e); return Object.entries(t).forEach(function(t) { var n, i, o, a = t[0], u = t[1]; @@ -2331,10 +2329,10 @@ return e && "none" !== e; }).join(" ") : i); }), r; - }, tG = function e(t) { + }, tW = function e(t) { if (t.type === T.Svg || !t.children) return t; - var r, i = n.pick(tz, t.style || {}), o = n.compose(e, (r = i, function(e) { - var t = tW(r, e.style || {}); + var r, i = n.pick(tU, t.style || {}), o = n.compose(e, (r = i, function(e) { + var t = tz(r, e.style || {}); return Object.assign({}, e, { style: t }); @@ -2342,18 +2340,18 @@ return Object.assign({}, t, { children: a }); - }, tq = function(e, t) { + }, tG = function(e, t) { var r = e._yogaNode; return r ? r.getComputedMargin(t) : null; - }, tV = function(e) { - var t = e.style, r = e.box, n = tq(e, q.default.EDGE_TOP) || (null == r ? void 0 : r.marginTop) || (null == t ? void 0 : t.marginTop) || (null == t ? void 0 : t.marginVertical) || (null == t ? void 0 : t.margin) || 0, i = tq(e, q.default.EDGE_RIGHT) || (null == r ? void 0 : r.marginRight) || (null == t ? void 0 : t.marginRight) || (null == t ? void 0 : t.marginHorizontal) || (null == t ? void 0 : t.margin) || 0, o = tq(e, q.default.EDGE_BOTTOM) || (null == r ? void 0 : r.marginBottom) || (null == t ? void 0 : t.marginBottom) || (null == t ? void 0 : t.marginVertical) || (null == t ? void 0 : t.margin) || 0, a = tq(e, q.default.EDGE_LEFT) || (null == r ? void 0 : r.marginLeft) || (null == t ? void 0 : t.marginLeft) || (null == t ? void 0 : t.marginHorizontal) || (null == t ? void 0 : t.margin) || 0; + }, tq = function(e) { + var t = e.style, r = e.box, n = tG(e, q.default.EDGE_TOP) || (null == r ? void 0 : r.marginTop) || (null == t ? void 0 : t.marginTop) || (null == t ? void 0 : t.marginVertical) || (null == t ? void 0 : t.margin) || 0, i = tG(e, q.default.EDGE_RIGHT) || (null == r ? void 0 : r.marginRight) || (null == t ? void 0 : t.marginRight) || (null == t ? void 0 : t.marginHorizontal) || (null == t ? void 0 : t.margin) || 0, o = tG(e, q.default.EDGE_BOTTOM) || (null == r ? void 0 : r.marginBottom) || (null == t ? void 0 : t.marginBottom) || (null == t ? void 0 : t.marginVertical) || (null == t ? void 0 : t.margin) || 0, a = tG(e, q.default.EDGE_LEFT) || (null == r ? void 0 : r.marginLeft) || (null == t ? void 0 : t.marginLeft) || (null == t ? void 0 : t.marginHorizontal) || (null == t ? void 0 : t.margin) || 0; return { marginTop: n, marginRight: i, marginBottom: o, marginLeft: a }; - }, tH = function(e) { + }, tV = function(e) { var t = e._yogaNode; return { top: (null == t ? void 0 : t.getComputedTop()) || 0, @@ -2361,32 +2359,32 @@ bottom: (null == t ? void 0 : t.getComputedBottom()) || 0, left: (null == t ? void 0 : t.getComputedLeft()) || 0 }; - }, tZ = { + }, tH = { width: 0, height: 0 - }, tX = function(e) { + }, tZ = function(e) { var t = e._yogaNode; return t ? { width: t.getComputedWidth(), height: t.getComputedHeight() - } : tZ; - }, tJ = function(e, t) { + } : tH; + }, tX = function(e, t) { return e ? e.getComputedBorder(t) : 0; - }, tY = function(e) { + }, tJ = function(e) { var t = e._yogaNode; return { - borderTopWidth: tJ(t, q.default.EDGE_TOP), - borderRightWidth: tJ(t, q.default.EDGE_RIGHT), - borderBottomWidth: tJ(t, q.default.EDGE_BOTTOM), - borderLeftWidth: tJ(t, q.default.EDGE_LEFT) + borderTopWidth: tX(t, q.default.EDGE_TOP), + borderRightWidth: tX(t, q.default.EDGE_RIGHT), + borderBottomWidth: tX(t, q.default.EDGE_BOTTOM), + borderLeftWidth: tX(t, q.default.EDGE_LEFT) }; - }, tK = { + }, tY = { hidden: q.default.OVERFLOW_HIDDEN, scroll: q.default.OVERFLOW_SCROLL - }, tQ = { + }, tK = { wrap: q.default.WRAP_WRAP, "wrap-reverse": q.default.WRAP_WRAP_REVERSE - }, t_ = function(e, t) { + }, tQ = function(e, t) { return function(r) { return function(i) { var o = i._yogaNode; @@ -2398,7 +2396,7 @@ return i; }; }; - }, t0 = t_("flexBasis"), t1 = { + }, t_ = tQ("flexBasis"), t0 = { "flex-start": q.default.ALIGN_FLEX_START, center: q.default.ALIGN_CENTER, "flex-end": q.default.ALIGN_FLEX_END, @@ -2406,51 +2404,51 @@ baseline: q.default.ALIGN_BASELINE, "space-between": q.default.ALIGN_SPACE_BETWEEN, "space-around": q.default.ALIGN_SPACE_AROUND - }, t2 = function(e) { + }, t1 = function(e) { return function(t) { return function(r) { var i = r._yogaNode, o = "items" === e ? q.default.ALIGN_STRETCH : q.default.ALIGN_AUTO; if (i) { - var a = t1[t] || o; + var a = t0[t] || o; i["setAlign" + n.upperFirst(e)](a); } return r; }; }; - }, t3 = t2("self"), t4 = t2("items"), t5 = t2("content"), t8 = { + }, t2 = t1("self"), t3 = t1("items"), t4 = t1("content"), t5 = { row: q.default.FLEX_DIRECTION_ROW, "row-reverse": q.default.FLEX_DIRECTION_ROW_REVERSE, "column-reverse": q.default.FLEX_DIRECTION_COLUMN_REVERSE - }, t6 = { + }, t8 = { center: q.default.JUSTIFY_CENTER, "flex-end": q.default.JUSTIFY_FLEX_END, "space-between": q.default.JUSTIFY_SPACE_BETWEEN, "space-around": q.default.JUSTIFY_SPACE_AROUND, "space-evenly": q.default.JUSTIFY_SPACE_EVENLY - }, t7 = t_("margin", q.default.EDGE_TOP), t9 = t_("margin", q.default.EDGE_RIGHT), re = t_("margin", q.default.EDGE_BOTTOM), rt = t_("margin", q.default.EDGE_LEFT), rr = t_("padding", q.default.EDGE_TOP), rn = t_("padding", q.default.EDGE_RIGHT), ri = t_("padding", q.default.EDGE_BOTTOM), ro = t_("padding", q.default.EDGE_LEFT), ra = t_("border", q.default.EDGE_TOP), ru = t_("border", q.default.EDGE_RIGHT), rl = t_("border", q.default.EDGE_BOTTOM), rs = t_("border", q.default.EDGE_LEFT), rc = t_("position", q.default.EDGE_TOP), rf = t_("position", q.default.EDGE_RIGHT), rd = t_("position", q.default.EDGE_BOTTOM), rp = t_("position", q.default.EDGE_LEFT), rh = t_("width"), ry = t_("minWidth"), rg = t_("maxWidth"), rv = t_("height"), rb = t_("minHeight"), rm = t_("maxHeight"), rD = function(e) { + }, t6 = tQ("margin", q.default.EDGE_TOP), t7 = tQ("margin", q.default.EDGE_RIGHT), t9 = tQ("margin", q.default.EDGE_BOTTOM), re = tQ("margin", q.default.EDGE_LEFT), rt = tQ("padding", q.default.EDGE_TOP), rr = tQ("padding", q.default.EDGE_RIGHT), rn = tQ("padding", q.default.EDGE_BOTTOM), ri = tQ("padding", q.default.EDGE_LEFT), ro = tQ("border", q.default.EDGE_TOP), ra = tQ("border", q.default.EDGE_RIGHT), ru = tQ("border", q.default.EDGE_BOTTOM), rl = tQ("border", q.default.EDGE_LEFT), rs = tQ("position", q.default.EDGE_TOP), rc = tQ("position", q.default.EDGE_RIGHT), rf = tQ("position", q.default.EDGE_BOTTOM), rd = tQ("position", q.default.EDGE_LEFT), rp = tQ("width"), rh = tQ("minWidth"), ry = tQ("maxWidth"), rg = tQ("height"), rv = tQ("minHeight"), rb = tQ("maxHeight"), rm = function(e) { return e.lines ? Math.max.apply(Math, [ 0 ].concat(e.lines.map(function(e) { return H.default(e); }))) : 0; - }, rw = function(e) { + }, rD = function(e) { return e.lines ? e.lines.reduce(function(e, t) { return e + t.box.height; }, 0) : -1; - }, rE = { + }, rw = { center: 0.5, right: 1 - }, r$ = function(e) { + }, rE = function(e) { var t; return null !== (t = e.image) && void 0 !== t && t.data ? e.image.width / e.image.height : 1; - }, rx = function(e) { + }, r$ = function(e) { var t; return n.isNil(null === (t = e.box) || void 0 === t ? void 0 : t.height); - }, rS = function(e) { + }, rx = function(e) { return Math.max.apply(Math, [ -1 / 0 ].concat(e)); - }, rA = function() { + }, rS = function() { var e = {}, t = [], r = function() { return e; }, n = function(e, r) { @@ -2468,83 +2466,83 @@ return t.push.apply(t, arguments), e; }; return e.rect = o, e.moveTo = i, e.lineTo = i, e.circle = a, e.polygon = u, e.ellipse = a, e.roundedRect = o, e.text = r, e.path = r, e.lineWidth = r, e.bezierCurveTo = r, e.quadraticCurveTo = r, e.scale = r, e.rotate = r, e.translate = r, e.dash = r, e.clip = r, e.save = r, e.fill = r, e.font = r, e.stroke = r, e.lineCap = r, e.opacity = r, e.restore = r, e.lineJoin = r, e.fontSize = r, e.fillColor = r, e.miterLimit = r, e.strokeColor = r, e.fillOpacity = r, e.strokeOpacity = r, e.linearGradient = r, e.radialGradient = r, e.getWidth = function() { - return rS(t.map(function(e) { + return rx(t.map(function(e) { return e[0]; })); }, e.getHeight = function() { - return rS(t.map(function(e) { + return rx(t.map(function(e) { return e[1]; })); }, e; - }, rk = "_yogaNode", rT = q.default.Config.create(); - rT.setPointScaleFactor(0); - var rO = function(e) { + }, rA = "_yogaNode", rk = q.default.Config.create(); + rk.setPointScaleFactor(0); + var rT = function(e) { return function(t) { return t.type === e; }; - }, rC = rO(T.Svg), rP = rO(T.Text), rF = rO(T.Note), rR = rO(T.Page), rI = rO(T.Image), rj = rO(T.Canvas), rB = rO(T.TextInstance), rM = function(e) { - var t = rR(e) ? e.box.height : e.style.height; - return rv(t); - }, rN = function(e) { + }, rO = rT(T.Svg), rC = rT(T.Text), rP = rT(T.Note), rF = rT(T.Page), rR = rT(T.Image), rI = rT(T.Canvas), rj = rT(T.TextInstance), rB = function(e) { + var t = rF(e) ? e.box.height : e.style.height; + return rg(t); + }, rM = function(e) { var t, r, i, o, a, u, l, s, c; - n.compose(rM(e), rh(e.style.width), ry(e.style.minWidth), rg(e.style.maxWidth), rb(e.style.minHeight), rm(e.style.maxHeight), t7(e.style.marginTop), t9(e.style.marginRight), re(e.style.marginBottom), rt(e.style.marginLeft), rr(e.style.paddingTop), rn(e.style.paddingRight), ri(e.style.paddingBottom), ro(e.style.paddingLeft), (t = e.style.position, function(e) { + n.compose(rB(e), rp(e.style.width), rh(e.style.minWidth), ry(e.style.maxWidth), rv(e.style.minHeight), rb(e.style.maxHeight), t6(e.style.marginTop), t7(e.style.marginRight), t9(e.style.marginBottom), re(e.style.marginLeft), rt(e.style.paddingTop), rr(e.style.paddingRight), rn(e.style.paddingBottom), ri(e.style.paddingLeft), (t = e.style.position, function(e) { var r = e._yogaNode; return !n.isNil(t) && r && r.setPositionType("absolute" === t ? q.default.POSITION_TYPE_ABSOLUTE : q.default.POSITION_TYPE_RELATIVE), e; - }), rc(e.style.top), rf(e.style.right), rd(e.style.bottom), rp(e.style.left), ra(e.style.borderTopWidth), ru(e.style.borderRightWidth), rl(e.style.borderBottomWidth), rs(e.style.borderLeftWidth), (r = e.style.display, function(e) { + }), rs(e.style.top), rc(e.style.right), rf(e.style.bottom), rd(e.style.left), ro(e.style.borderTopWidth), ra(e.style.borderRightWidth), ru(e.style.borderBottomWidth), rl(e.style.borderLeftWidth), (r = e.style.display, function(e) { var t = e._yogaNode; return t && t.setDisplay("none" === r ? q.default.DISPLAY_NONE : q.default.DISPLAY_FLEX), e; }), (i = e.style.flexDirection, function(e) { var t = e._yogaNode; if (t) { - var r = t8[i] || q.default.FLEX_DIRECTION_COLUMN; + var r = t5[i] || q.default.FLEX_DIRECTION_COLUMN; t.setFlexDirection(r); } return e; - }), t3(e.style.alignSelf), t5(e.style.alignContent), t4(e.style.alignItems), (o = e.style.justifyContent, function(e) { + }), t2(e.style.alignSelf), t4(e.style.alignContent), t3(e.style.alignItems), (o = e.style.justifyContent, function(e) { var t = e._yogaNode; if (!n.isNil(o) && t) { - var r = t6[o] || q.default.JUSTIFY_FLEX_START; + var r = t8[o] || q.default.JUSTIFY_FLEX_START; t.setJustifyContent(r); } return e; }), (a = e.style.flexWrap, function(e) { var t = e._yogaNode; if (t) { - var r = tQ[a] || q.default.WRAP_NO_WRAP; + var r = tK[a] || q.default.WRAP_NO_WRAP; t.setFlexWrap(r); } return e; }), (u = e.style.overflow, function(e) { var t = e._yogaNode; if (!n.isNil(u) && t) { - var r = tK[u] || q.default.OVERFLOW_VISIBLE; + var r = tY[u] || q.default.OVERFLOW_VISIBLE; t.setOverflow(r); } return e; }), (l = e.style.aspectRatio, function(e) { var t = e._yogaNode; return !n.isNil(l) && t && t.setAspectRatio(l), e; - }), t0(e.style.flexBasis), (s = e.style.flexGrow, function(e) { - return t_("flexGrow")(s || 0)(e); + }), t_(e.style.flexBasis), (s = e.style.flexGrow, function(e) { + return tQ("flexGrow")(s || 0)(e); }), (c = e.style.flexShrink, function(e) { - return t_("flexShrink")(c || 1)(e); + return tQ("flexShrink")(c || 1)(e); }))(e); - }, rL = function(e, t, r) { - var n, i, o, a, u, l, s, c = e[rk]; - return rP(e) && c.setMeasureFunc((n = e, i = r, function(e, t, r) { - if (t === q.default.MEASURE_MODE_EXACTLY) return n.lines || (n.lines = tB(n, e, r, i)), { - height: rw(n) + }, rN = function(e, t, r) { + var n, i, o, a, u, l, s, c = e[rA]; + return rC(e) && c.setMeasureFunc((n = e, i = r, function(e, t, r) { + if (t === q.default.MEASURE_MODE_EXACTLY) return n.lines || (n.lines = tj(n, e, r, i)), { + height: rD(n) }; if (t === q.default.MEASURE_MODE_AT_MOST) { - var o, a = rE[null === (o = n.style) || void 0 === o ? void 0 : o.textAlign] || 0; - return n.lines || (n.lines = tB(n, e, r, i), n.alignOffset = (e - rD(n)) * a), { - height: rw(n), - width: Math.min(e, rD(n)) + var o, a = rw[null === (o = n.style) || void 0 === o ? void 0 : o.textAlign] || 0; + return n.lines || (n.lines = tj(n, e, r, i), n.alignOffset = (e - rm(n)) * a), { + height: rD(n), + width: Math.min(e, rm(n)) }; } return {}; - })), rI(e) && c.setMeasureFunc((o = t, a = e, function(e, t, r, n) { - var i = r$(a), u = tV(a), l = ty(o), s = rx(o) ? 1 / 0 : o.box.height - l.paddingTop - l.paddingBottom - u.marginTop - u.marginBottom - 10; + })), rR(e) && c.setMeasureFunc((o = t, a = e, function(e, t, r, n) { + var i = rE(a), u = tq(a), l = th(o), s = r$(o) ? 1 / 0 : o.box.height - l.paddingTop - l.paddingBottom - u.marginTop - u.marginBottom - 10; return a.image ? t === q.default.MEASURE_MODE_EXACTLY && n === q.default.MEASURE_MODE_UNDEFINED ? { height: Math.min(s, e / i) } : n === q.default.MEASURE_MODE_EXACTLY && (t === q.default.MEASURE_MODE_AT_MOST || t === q.default.MEASURE_MODE_UNDEFINED) ? { @@ -2564,15 +2562,15 @@ width: 0, height: 0 }; - })), rj(e) && c.setMeasureFunc((u = t, l = e, function() { - var e = tV(l), t = ty(u), r = rx(u) ? 1 / 0 : u.box.height - t.paddingTop - t.paddingBottom - e.marginTop - e.marginBottom - 10, n = rA(); + })), rI(e) && c.setMeasureFunc((u = t, l = e, function() { + var e = tq(l), t = th(u), r = r$(u) ? 1 / 0 : u.box.height - t.paddingTop - t.paddingBottom - e.marginTop - e.marginBottom - 10, n = rS(); l.props.paint(n); var i = n.getWidth(); return { height: Math.min(r, n.getHeight()), width: i }; - })), rC(e) && c.setMeasureFunc((s = e, function(e, t, r, n) { + })), rO(e) && c.setMeasureFunc((s = e, function(e, t, r, n) { var i, o = ((i = s.props.viewBox) ? (i.maxX - i.minX) / (i.maxY - i.minY) : null) || 1; return t === q.default.MEASURE_MODE_EXACTLY || t === q.default.MEASURE_MODE_AT_MOST ? { width: e, @@ -2581,11 +2579,11 @@ width: r * o } : {}; })), e; - }, rU = function(e) { - return e[rk].calculateLayout(), e; - }, rz = function e(t) { - if (rB(t)) return t; - var r = Object.assign(ty(t), tV(t), tY(t), tH(t), tX(t)), n = Object.assign({}, t, { + }, rL = function(e) { + return e[rA].calculateLayout(), e; + }, rU = function e(t) { + if (rj(t)) return t; + var r = Object.assign(th(t), tq(t), tJ(t), tV(t), tZ(t)), n = Object.assign({}, t, { box: r }); if (!t.children) return n; @@ -2593,54 +2591,54 @@ return Object.assign({}, n, { children: i }); - }, rW = function e(t) { + }, rz = function e(t) { var r = Object.assign({}, t); - if (delete r[rk], !t.children) return r; + if (delete r[rA], !t.children) return r; var n = t.children.map(e); return Object.assign({}, r, { children: n }); - }, rG = function(e) { - return e[rk] && e[rk].freeRecursive(), e; - }, rq = function(e, t) { - return n.isNil(e) ? null : n.compose(rW, rG, rz, rU, function e(t, r) { + }, rW = function(e) { + return e[rA] && e[rA].freeRecursive(), e; + }, rG = function(e, t) { + return n.isNil(e) ? null : n.compose(rz, rW, rU, rL, function e(t, r) { return function(i) { - var o, a = q.default.Node.createWithConfig(rT), u = Object.assign({}, i); - if (u[rk] = a, rN(u), !rP(o = i) && !rF(o) && !rC(o) && i.children) { + var o, a = q.default.Node.createWithConfig(rk), u = Object.assign({}, i); + if (u[rA] = a, rM(u), !rC(o = i) && !rP(o) && !rO(o) && i.children) { var l, s = n.compose((l = a, function(e) { - return l.insertChild(e[rk], l.getChildCount()), e; + return l.insertChild(e[rA], l.getChildCount()), e; }), e(t, r)); u.children = i.children.map(s); } - return rL(u, t, r), u; + return rN(u, t, r), u; }; }(e, t))(e); - }, rV = function(e, t) { + }, rq = function(e, t) { if (!e.children) return e; var r = function(e) { - return rq(e, t); + return rG(e, t); }, n = e.children.map(r); return Object.assign({}, e, { children: n }); - }, rH = function(e) { + }, rV = function(e) { return e.type === T.Text; - }, rZ = function(e, t) { + }, rH = function(e, t) { return Object.assign({}, t, { children: e }); - }, rX = function(e) { + }, rZ = function(e) { var t; return (null === (t = e.box) || void 0 === t ? void 0 : t.top) || 0; - }, rJ = function(e) { + }, rX = function(e) { var t; return !n.isNil(null === (t = e.props) || void 0 === t ? void 0 : t.render); - }, rY = n.compose(tU, tG, rq), rK = function(e) { + }, rJ = n.compose(tL, tW, rG), rY = function(e) { console.warn("Node of type " + e.type + " can't wrap between pages and it's bigger than available page height"); - }, rQ = function(e, t, r) { + }, rK = function(e, t, r) { for(var n = [], i = [], o = 0; o < r.length; o += 1){ - var a = r[o], u = r.slice(o + 1), l = u.filter(ti), s = rX(a), c = a.box.height, f = e <= s, d = tA(a, u, e), p = e + 0.001 < s + c, h = tp(a), y = c <= t; - if (ti(a)) { + var a = r[o], u = r.slice(o + 1), l = u.filter(tn), s = rZ(a), c = a.box.height, f = e <= s, d = tS(a, u, e), p = e + 0.001 < s + c, h = td(a), y = c <= t; + if (tn(a)) { i.push(a), n.push(a); continue; } @@ -2654,7 +2652,7 @@ continue; } if (!y && !h) { - n.push(a), i.push.apply(i, u), rK(a); + n.push(a), i.push.apply(i, u), rY(a); break; } if (d) { @@ -2673,7 +2671,7 @@ break; } if (p) { - var w = r1(a, e, t), E = w[0], $ = w[1]; + var w = r0(a, e, t), E = w[0], $ = w[1]; E && n.push(E), $ && i.push($); continue; } @@ -2683,28 +2681,28 @@ n, i ]; + }, rQ = function(e, t, r) { + var n = r.children || [], i = e - rZ(r); + return rK(i, t, n); }, r_ = function(e, t, r) { - var n = r.children || [], i = e - rX(r); - return rQ(i, t, n); - }, r0 = function(e, t, r) { - var n = tf(e, t), i = n[0], o = n[1], a = r_(t, r, e), u = a[0], l = a[1]; + var n = tc(e, t), i = n[0], o = n[1], a = rQ(t, r, e), u = a[0], l = a[1]; return [ - rZ(u, i), - rZ(l, o), + rH(u, i), + rH(l, o), ]; - }, r1 = function(e, t, r) { - return rH(e) ? tl(e, t) : r0(e, t, r); - }, r2 = function e(t) { + }, r0 = function(e, t, r) { + return rV(e) ? tu(e, t) : r_(e, t, r); + }, r1 = function e(t) { var r = t.children || []; - return rJ(t) || r.some(e); - }, r3 = function e(t, r) { - var n = rJ(r), i = n && rH(r) ? U.default({}, r.box, { + return rX(t) || r.some(e); + }, r2 = function e(t, r) { + var n = rX(r), i = n && rV(r) ? U.default({}, r.box, { height: 0 }) : r.box, o = function(i) { if (void 0 === i && (i = []), n) { var o = r.props.render(t); return [ - tD(o) + tm(o) ].filter(Boolean); } return i.map(function(r) { @@ -2716,24 +2714,24 @@ lines: a, children: o }); - }, r4 = function(e, t, r) { - if (r2(t)) { - var n = r3(e, t); - return rY(n, r); + }, r3 = function(e, t, r) { + if (r1(t)) { + var n = r2(e, t); + return rJ(n, r); } return t; - }, r5 = function(e, t, r) { - var i = tg(e), o = tv(e), a = r4({ + }, r4 = function(e, t, r) { + var i = ty(e), o = tg(e), a = r3({ pageNumber: t - }, e, r), u = e.style.height, l = rQ(i, o, a.children), s = l[0], c = l[1], f = function(e) { - return rY(e, r); + }, e, r), u = e.style.height, l = rK(i, o, a.children), s = l[0], c = l[1], f = function(e) { + return rJ(e, r); }, d = U.default({}, e.box, { height: u }), p = f(Object.assign({}, e, { box: d, children: s })); - if (0 === c.length || c.every(ti)) return [ + if (0 === c.length || c.every(tn)) return [ p, null ]; @@ -2746,79 +2744,79 @@ p, g ]; - }, r8 = function(e, t, r, n) { - return r4({ + }, r5 = function(e, t, r, n) { + return r3({ totalPages: n.length, pageNumber: r + 1, subPageNumber: t.subPageNumber + 1, subPageTotalPages: t.subPageTotalPages }, t, e); - }, r6 = function(e) { + }, r8 = function(e) { return e.map(function(t, r) { return U.default({}, t, { subPageNumber: r, subPageTotalPages: e.length }); }); - }, r7 = function(e, t, r) { + }, r6 = function(e, t, r) { if (!e) return []; - for(var n = r5(e, t, r), i = [ + for(var n = r4(e, t, r), i = [ n[0] - ], o = n[1]; null !== o;)i.push((n = r5(o, t + i.length, r))[0]), o = n[1]; + ], o = n[1]; null !== o;)i.push((n = r4(o, t + i.length, r))[0]), o = n[1]; return i; - }, r9 = function(e, t) { + }, r7 = function(e, t) { for(var r = [], i = 1, o = 0; o < e.children.length; o += 1){ - var a = r7(e.children[o], i, t); - a = r6(a), i += a.length, r = r.concat(a); + var a = r6(e.children[o], i, t); + a = r8(a), i += a.length, r = r.concat(a); } return r = r.map(function() { for(var e, r = arguments.length, i = Array(r), o = 0; o < r; o++)i[o] = arguments[o]; - return e = r8.apply(void 0, [ + return e = r5.apply(void 0, [ t ].concat(i)), n.omit([ "subPageNumber", "subPageTotalPages" ], e); - }), rZ(r, e); - }, ne = function(e) { + }), rH(r, e); + }, r9 = function(e) { return function(t) { var r = n.matchPercent(t); return r ? r.percent * e.width : t; }; - }, nt = function(e) { + }, ne = function(e) { return function(t) { var r = n.matchPercent(t); return r ? r.percent * e.height : t; }; - }, nr = function(e) { + }, nt = function(e) { var t = e.style, r = n.evolve({ - paddingTop: nt(t), - paddingLeft: ne(t), - paddingRight: ne(t), - paddingBottom: nt(t) + paddingTop: ne(t), + paddingLeft: r9(t), + paddingRight: r9(t), + paddingBottom: ne(t) }, e.style); return Object.assign({}, e, { style: r }); - }, nn = function(e) { + }, nr = function(e) { if (!e.children) return e; - var t = e.children.map(nr); + var t = e.children.map(nt); return Object.assign({}, e, { children: t }); - }, ni = function(e) { + }, nn = function(e) { return function(t) { if (t) { var r = n.matchPercent(t); return r ? r.percent * Math.min(e.width, e.height) : t; } }; - }, no = function e(t) { + }, ni = function e(t) { var r = n.evolve({ - borderTopLeftRadius: ni(t.box), - borderTopRightRadius: ni(t.box), - borderBottomRightRadius: ni(t.box), - borderBottomLeftRadius: ni(t.box) + borderTopLeftRadius: nn(t.box), + borderTopRightRadius: nn(t.box), + borderBottomRightRadius: nn(t.box), + borderBottomLeftRadius: nn(t.box) }, t.style || {}), i = Object.assign({}, t, { style: r }); @@ -2827,47 +2825,47 @@ return Object.assign({}, i, { children: o }); - }, na = function(e, t) { + }, no = function(e, t) { var r = n.matchPercent(t); return r ? r.percent * e : t; - }, nu = function(e) { + }, na = function(e) { var t, r; return e.style.height - ((null === (t = e.style) || void 0 === t ? void 0 : t.paddingTop) || 0) - ((null === (r = e.style) || void 0 === r ? void 0 : r.paddingBottom) || 0); - }, nl = function(e, t) { + }, nu = function(e, t) { if (n.isNil(null === (r = e.style) || void 0 === r ? void 0 : r.height) || n.isNil(null === (i = t.style) || void 0 === i ? void 0 : i.height)) return t; - var r, i, o = nu(e), a = na(o, t.style.height), u = Object.assign({}, t.style, { + var r, i, o = na(e), a = no(o, t.style.height), u = Object.assign({}, t.style, { height: a }); return Object.assign({}, t, { style: u }); - }, ns = function(e) { + }, nl = function(e) { if (!e.children) return e; var t = function(t) { - return nl(e, t); + return nu(e, t); }, r = e.children.map(t); return Object.assign({}, e, { children: r }); - }, nc = function(e) { + }, ns = function(e) { if (!e.children) return e; - var t = e.children.map(ns); + var t = e.children.map(nl); return Object.assign({}, e, { children: t }); - }, nf = function(e) { + }, nc = function(e) { return function(t) { return t.type === e; }; - }, nd = nf(T.Link), np = nf(T.Text), nh = nf(T.TextInstance), ny = function(e) { + }, nf = nc(T.Link), nd = nc(T.Text), np = nc(T.TextInstance), nh = function(e) { var t; return !!(null !== (t = e.props) && void 0 !== t && t.render); + }, ny = function(e) { + return nd(e) || np(e); }, ng = function(e) { - return np(e) || nh(e); - }, nv = function(e) { var t = e.children || []; - return !!t.every(nh) || !t.every(np) && t.every(ng); - }, nb = function(e) { + return !!t.every(np) || !t.every(nd) && t.every(ny); + }, nv = function(e) { var t = { type: T.Text, props: {}, @@ -2880,18 +2878,18 @@ t ] }); - }, nm = function(e) { - return nd(e) ? ny(e) ? Object.assign({}, e, { + }, nb = function(e) { + return nf(e) ? nh(e) ? Object.assign({}, e, { type: T.Text - }) : nv(e) ? nb(e) : e : e; - }, nD = function e(t) { + }) : ng(e) ? nv(e) : e : e; + }, nm = function e(t) { if (!t.children) return t; - var r = n.compose(nm, e), i = t.children.map(r); + var r = n.compose(nb, e), i = t.children.map(r); return Object.assign({}, t, { children: i }); - }, nw = n.asyncCompose(eN, e4, r9, tU, no, rV, ej, eY, tG, nc, nn, e0, nD, e8, tn); - t.Z = nw; + }, nD = n.asyncCompose(eM, e3, r7, tL, ni, rq, eI, eJ, tW, ns, nr, e_, nm, e5, tr); + t.Z = nD; }, 5648: function(e) { "use strict"; @@ -4216,23 +4214,23 @@ }), f = function(e) { void 0 === e && (e = {}), n.document.props.onRender && n.document.props.onRender(e); }, d = (u = p(y().mark(function e() { - var t, r; + var t; return y().wrap(function(e) { for(;;)switch(e.prev = e.next){ case 0: return e.next = 2, c(); case 2: - return r = (t = e.sent).pipe(v()()), e.abrupt("return", new Promise(function(e, t) { - r.on("finish", function() { + return t = (0, e.sent).pipe(v()()), e.abrupt("return", new Promise(function(e, r) { + t.on("finish", function() { try { - var n = r.toBlob("application/pdf"); + var n = t.toBlob("application/pdf"); f({ blob: n }), e(n); } catch (i) { - t(i); + r(i); } - }), r.on("error", t); + }), t.on("error", r); })); case 5: case "end": @@ -5440,35 +5438,35 @@ 7518: function(e, t) { "use strict"; t.__esModule = !0, t.default = void 0; - var r = 0, n = function(e, t) { - for(var n, i = 0, o = [], a = [], u = r; u <= 3; u += 1)o[u] = a[u] = 0; - for(var l = 0; l < t.length; l += 1){ - var s = t[l], c = s.before + s.after; - i += c, o[s.priority] += c, s.unconstrained && (a[s.priority] += c); + var r = function(e, t) { + for(var r, n = 0, i = [], o = [], a = 0; a <= 3; a += 1)i[a] = o[a] = 0; + for(var u = 0; u < t.length; u += 1){ + var l = t[u], s = l.before + l.after; + n += s, i[l.priority] += s, l.unconstrained && (o[l.priority] += s); } - var f = -1, d = 0, p = e; - for(n = r; n <= 3; n += 1){ - var h = o[n]; - if (0 !== h) { - if (-1 === f && (f = n, d = h), Math.abs(p) <= Math.abs(h)) { - o[n] = p / h, a[n] = 0, p = 0; + var c = -1, f = 0, d = e; + for(r = 0; r <= 3; r += 1){ + var p = i[r]; + if (0 !== p) { + if (-1 === c && (c = r, f = p), Math.abs(d) <= Math.abs(p)) { + i[r] = d / p, o[r] = 0, d = 0; break; } - if (o[n] = 1, p -= h, 0 !== a[n]) { - a[n] = p / a[n], p = 0; + if (i[r] = 1, d -= p, 0 !== o[r]) { + o[r] = d / o[r], d = 0; break; } } } - for(var y = n + 1; y <= 3; y += 1)o[y] = 0, a[y] = 0; - p > 0 && f > -1 && (o[f] = (d + (e - i)) / d); - for(var g = [], v = 0; v < t.length; v += 1){ - var b = t[v], m = t[v + 1], D = b.after * o[b.priority]; - m && (D += m.before * o[m.priority]), b.unconstrained && (D += b.after * a[b.priority], m && (D += m.before * a[m.priority])), g.push(D); + for(var h = r + 1; h <= 3; h += 1)i[h] = 0, o[h] = 0; + d > 0 && c > -1 && (i[c] = (f + (e - n)) / f); + for(var y = [], g = 0; g < t.length; g += 1){ + var v = t[g], b = t[g + 1], m = v.after * i[v.priority]; + b && (m += b.before * i[b.priority]), v.unconstrained && (m += v.after * o[v.priority], b && (m += b.before * o[b.priority])), y.push(m); } - return g; + return y; }; - t.default = n; + t.default = r; }, 1845: function(e, t, r) { "use strict"; @@ -8809,7 +8807,7 @@ return u; }(Math); return e; - }, e.exports = t = n(); + }, e.exports = n(); }, 8214: function(e, t, r) { var n; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/regression-1/framework-798bab57daac3897/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/regression-1/framework-798bab57daac3897/analysis-snapshot.rust-debug index 7367e4241fd..21bdb8d1d4a 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/regression-1/framework-798bab57daac3897/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/regression-1/framework-798bab57daac3897/analysis-snapshot.rust-debug @@ -941,7 +941,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -1139,7 +1139,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -1255,7 +1255,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -1685,7 +1685,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -3313,7 +3313,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -4949,7 +4949,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -5263,7 +5263,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -5885,7 +5885,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -6041,7 +6041,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -6663,7 +6663,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 8, reassigned_with_assignment: false, @@ -6741,7 +6741,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -8529,7 +8529,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -9889,7 +9889,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -10471,7 +10471,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 8, reassigned_with_assignment: false, @@ -10939,7 +10939,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 6, mutation_by_call_count: 0, usage_count: 10, reassigned_with_assignment: true, @@ -11249,7 +11249,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 8, reassigned_with_assignment: false, @@ -12295,7 +12295,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: false, @@ -12449,7 +12449,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 8, reassigned_with_assignment: false, @@ -12683,7 +12683,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 13, + assign_count: 8, mutation_by_call_count: 1, usage_count: 9, reassigned_with_assignment: true, @@ -13115,7 +13115,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 7, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, @@ -13543,7 +13543,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: true, @@ -14011,7 +14011,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 16, + assign_count: 0, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: false, @@ -14473,7 +14473,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 14, reassigned_with_assignment: false, @@ -14511,7 +14511,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: true, @@ -14971,7 +14971,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -15165,7 +15165,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -15205,7 +15205,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -18321,7 +18321,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: true, @@ -18665,7 +18665,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -19159,7 +19159,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -21753,7 +21753,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 20, usage_count: 20, reassigned_with_assignment: false, @@ -21829,7 +21829,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 4, usage_count: 7, reassigned_with_assignment: true, @@ -23275,7 +23275,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: false, @@ -29447,7 +29447,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 10, usage_count: 14, reassigned_with_assignment: false, @@ -29599,7 +29599,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -29715,7 +29715,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -31395,7 +31395,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -34525,7 +34525,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 12, reassigned_with_assignment: false, @@ -35105,7 +35105,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 8, usage_count: 14, reassigned_with_assignment: true, @@ -36261,7 +36261,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -36649,7 +36649,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -38191,7 +38191,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 3, usage_count: 6, reassigned_with_assignment: false, @@ -40265,7 +40265,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -42963,7 +42963,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -45029,7 +45029,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 32, reassigned_with_assignment: false, @@ -45069,7 +45069,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -45109,7 +45109,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 8, usage_count: 19, reassigned_with_assignment: false, @@ -45417,7 +45417,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -45495,7 +45495,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -45573,7 +45573,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 5, mutation_by_call_count: 6, usage_count: 17, reassigned_with_assignment: true, @@ -45649,7 +45649,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -46075,7 +46075,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 26, + assign_count: 12, mutation_by_call_count: 53, usage_count: 138, reassigned_with_assignment: true, @@ -46841,7 +46841,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -50289,7 +50289,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: true, @@ -50443,7 +50443,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -50837,7 +50837,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 7, reassigned_with_assignment: false, @@ -51343,7 +51343,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 1, usage_count: 9, reassigned_with_assignment: true, @@ -51463,7 +51463,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: false, @@ -51891,7 +51891,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: true, @@ -52241,7 +52241,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -54215,7 +54215,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -55375,7 +55375,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -56851,7 +56851,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -56931,7 +56931,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -57011,7 +57011,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 1, usage_count: 9, reassigned_with_assignment: true, @@ -57051,7 +57051,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 8, reassigned_with_assignment: true, @@ -57091,7 +57091,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -58801,7 +58801,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -58841,7 +58841,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -58919,7 +58919,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -59545,7 +59545,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 6, mutation_by_call_count: 6, usage_count: 11, reassigned_with_assignment: true, @@ -60165,7 +60165,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -60243,7 +60243,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -60283,7 +60283,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, @@ -60597,7 +60597,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -61179,7 +61179,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 1, usage_count: 10, reassigned_with_assignment: true, @@ -62323,7 +62323,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: true, @@ -62363,7 +62363,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -62865,7 +62865,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 9, + assign_count: 8, mutation_by_call_count: 10, usage_count: 36, reassigned_with_assignment: true, @@ -63371,7 +63371,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -64937,7 +64937,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 10, + assign_count: 6, mutation_by_call_count: 0, usage_count: 12, reassigned_with_assignment: true, @@ -65097,7 +65097,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -65337,7 +65337,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 6, mutation_by_call_count: 10, usage_count: 33, reassigned_with_assignment: true, @@ -65457,7 +65457,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -65537,7 +65537,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 2, usage_count: 11, reassigned_with_assignment: true, @@ -67069,7 +67069,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -67497,7 +67497,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 12, reassigned_with_assignment: true, @@ -67695,7 +67695,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -67969,7 +67969,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -68205,7 +68205,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: true, @@ -68363,7 +68363,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 2, usage_count: 8, reassigned_with_assignment: true, @@ -68561,7 +68561,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -69155,7 +69155,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 9, reassigned_with_assignment: true, @@ -69351,7 +69351,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 10, usage_count: 10, reassigned_with_assignment: false, @@ -69389,7 +69389,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 10, usage_count: 10, reassigned_with_assignment: false, @@ -69505,7 +69505,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -70645,7 +70645,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 3, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -70805,7 +70805,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 10, reassigned_with_assignment: false, @@ -70925,7 +70925,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 5, mutation_by_call_count: 2, usage_count: 11, reassigned_with_assignment: true, @@ -71203,7 +71203,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -71283,7 +71283,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 22, + assign_count: 20, mutation_by_call_count: 18, usage_count: 40, reassigned_with_assignment: true, @@ -73611,7 +73611,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: true, @@ -73729,7 +73729,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: true, @@ -74247,7 +74247,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -74719,7 +74719,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, @@ -75117,7 +75117,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -75475,7 +75475,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, @@ -75555,7 +75555,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 4, usage_count: 24, reassigned_with_assignment: true, @@ -75875,7 +75875,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 6, usage_count: 7, reassigned_with_assignment: true, @@ -75955,7 +75955,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 14, reassigned_with_assignment: true, @@ -76189,7 +76189,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -76229,7 +76229,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -76387,7 +76387,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -76427,7 +76427,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 2, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -76931,7 +76931,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -77241,7 +77241,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -77359,7 +77359,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 7, reassigned_with_assignment: false, @@ -77755,7 +77755,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -77793,7 +77793,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -77951,7 +77951,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -78351,7 +78351,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -78391,7 +78391,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: true, @@ -78591,7 +78591,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -78749,7 +78749,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -79259,7 +79259,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 3, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: true, @@ -80155,7 +80155,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: true, @@ -80311,7 +80311,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 2, usage_count: 7, reassigned_with_assignment: true, @@ -80387,7 +80387,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -80427,7 +80427,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -80667,7 +80667,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -80823,7 +80823,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: true, @@ -80863,7 +80863,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: true, @@ -81141,7 +81141,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -81337,7 +81337,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -81377,7 +81377,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -83007,7 +83007,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -83401,7 +83401,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -83479,7 +83479,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -83517,7 +83517,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -83951,7 +83951,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, @@ -84221,7 +84221,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 5, usage_count: 11, reassigned_with_assignment: true, @@ -84573,7 +84573,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 3, mutation_by_call_count: 4, usage_count: 9, reassigned_with_assignment: true, @@ -85313,7 +85313,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -85551,7 +85551,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 4, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -85591,7 +85591,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 3, mutation_by_call_count: 6, usage_count: 15, reassigned_with_assignment: true, @@ -85867,7 +85867,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -85947,7 +85947,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -86773,7 +86773,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 8, usage_count: 19, reassigned_with_assignment: true, @@ -86813,7 +86813,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 4, mutation_by_call_count: 5, usage_count: 14, reassigned_with_assignment: true, @@ -87905,7 +87905,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -88367,7 +88367,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: true, @@ -88607,7 +88607,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 8, reassigned_with_assignment: false, @@ -88647,7 +88647,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 2, usage_count: 8, reassigned_with_assignment: true, @@ -88961,7 +88961,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 11, + assign_count: 0, mutation_by_call_count: 0, usage_count: 17, reassigned_with_assignment: false, @@ -90513,7 +90513,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -90947,7 +90947,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -91449,7 +91449,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 5, mutation_by_call_count: 6, usage_count: 19, reassigned_with_assignment: true, @@ -91489,7 +91489,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 3, mutation_by_call_count: 8, usage_count: 12, reassigned_with_assignment: true, @@ -92347,7 +92347,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 13, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -93007,7 +93007,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -93551,7 +93551,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 0, usage_count: 11, reassigned_with_assignment: true, @@ -93871,7 +93871,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -93987,7 +93987,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -94295,7 +94295,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 5, mutation_by_call_count: 8, usage_count: 9, reassigned_with_assignment: true, @@ -94335,7 +94335,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -94455,7 +94455,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -95085,7 +95085,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -95163,7 +95163,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -95521,7 +95521,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -97059,7 +97059,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/analysis-snapshot.rust-debug index 9ff13ecf44c..49ca0642d5e 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/analysis-snapshot.rust-debug @@ -369,7 +369,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -841,7 +841,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 6, reassigned_with_assignment: false, @@ -1585,7 +1585,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 2, mutation_by_call_count: 6, usage_count: 7, reassigned_with_assignment: true, @@ -1663,7 +1663,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 8, reassigned_with_assignment: false, @@ -2133,7 +2133,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 7, reassigned_with_assignment: false, @@ -2253,7 +2253,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: false, @@ -3125,7 +3125,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -3317,7 +3317,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -3393,7 +3393,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -3549,7 +3549,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -3587,7 +3587,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -3783,7 +3783,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -4099,7 +4099,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -4255,7 +4255,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -4295,7 +4295,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -5781,7 +5781,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -5819,7 +5819,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -9091,7 +9091,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: true, @@ -9487,7 +9487,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -9527,7 +9527,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -11107,7 +11107,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 7, reassigned_with_assignment: false, @@ -12843,7 +12843,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -13159,7 +13159,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -13239,7 +13239,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -15811,7 +15811,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 10, + assign_count: 1, mutation_by_call_count: 3, usage_count: 9, reassigned_with_assignment: true, @@ -16039,7 +16039,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -18145,7 +18145,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 2, mutation_by_call_count: 5, usage_count: 8, reassigned_with_assignment: true, @@ -18605,7 +18605,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -18643,7 +18643,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -21607,7 +21607,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 15, reassigned_with_assignment: false, @@ -21797,7 +21797,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -21835,7 +21835,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -23401,7 +23401,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -23909,7 +23909,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -23949,7 +23949,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -24381,7 +24381,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -25349,7 +25349,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: false, @@ -27215,7 +27215,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -27293,7 +27293,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -28479,7 +28479,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -28519,7 +28519,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -28599,7 +28599,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -30761,7 +30761,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -33231,7 +33231,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -34555,7 +34555,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -36083,7 +36083,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -37483,7 +37483,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: true, @@ -38195,7 +38195,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, @@ -38273,7 +38273,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -38353,7 +38353,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -40101,7 +40101,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -40141,7 +40141,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -42751,7 +42751,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -42831,7 +42831,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -43741,7 +43741,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -43779,7 +43779,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: false, @@ -46219,7 +46219,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -51815,7 +51815,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -52473,7 +52473,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 11, reassigned_with_assignment: false, @@ -52511,7 +52511,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -56289,7 +56289,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 7, usage_count: 12, reassigned_with_assignment: true, @@ -56367,7 +56367,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -57689,7 +57689,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -58401,7 +58401,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -58557,7 +58557,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 4, mutation_by_call_count: 6, usage_count: 8, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/analysis-snapshot.rust-debug index 8c87f401f0d..f6749d3fc33 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/analysis-snapshot.rust-debug @@ -1013,7 +1013,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -2450,7 +2450,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -2947,7 +2947,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -3219,7 +3219,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 139, reassigned_with_assignment: false, @@ -4326,7 +4326,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -4366,7 +4366,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -4406,7 +4406,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -4446,7 +4446,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -4909,7 +4909,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -5229,7 +5229,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 171, reassigned_with_assignment: false, @@ -5267,7 +5267,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 165, reassigned_with_assignment: false, @@ -5465,7 +5465,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 7, reassigned_with_assignment: false, @@ -6371,7 +6371,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -6411,7 +6411,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 30, usage_count: 39, reassigned_with_assignment: false, @@ -6567,7 +6567,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 12, usage_count: 79, reassigned_with_assignment: false, @@ -6730,7 +6730,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: true, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -8615,7 +8615,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 1, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -9561,7 +9561,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -10156,7 +10156,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -10579,7 +10579,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -11243,7 +11243,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -11450,7 +11450,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -11985,7 +11985,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -12101,7 +12101,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -12933,7 +12933,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -15391,7 +15391,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -15716,7 +15716,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -16559,7 +16559,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -17352,7 +17352,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17392,7 +17392,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17432,7 +17432,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17748,7 +17748,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17788,7 +17788,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17828,7 +17828,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17868,7 +17868,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17908,7 +17908,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17948,7 +17948,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -17988,7 +17988,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18028,7 +18028,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18068,7 +18068,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18108,7 +18108,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18188,7 +18188,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18228,7 +18228,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18268,7 +18268,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18308,7 +18308,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18348,7 +18348,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18388,7 +18388,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18468,7 +18468,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18548,7 +18548,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18588,7 +18588,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -18628,7 +18628,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -19051,7 +19051,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -19890,7 +19890,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -20120,7 +20120,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -20560,7 +20560,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: true, @@ -22129,7 +22129,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 2, usage_count: 28, reassigned_with_assignment: false, @@ -25410,7 +25410,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -28110,7 +28110,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -28805,7 +28805,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 2, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -28885,7 +28885,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -28925,7 +28925,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -28965,7 +28965,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -29005,7 +29005,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -29045,7 +29045,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -29085,7 +29085,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -29370,7 +29370,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -29608,7 +29608,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -30080,7 +30080,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: true, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -30270,7 +30270,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -31233,7 +31233,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 25, usage_count: 123, reassigned_with_assignment: false, @@ -31834,7 +31834,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: true, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -70313,7 +70313,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: false, @@ -70471,7 +70471,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -70511,7 +70511,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -71457,7 +71457,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: false, @@ -77199,7 +77199,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -77275,7 +77275,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -80784,7 +80784,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -80824,7 +80824,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -81096,7 +81096,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -81136,7 +81136,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -85915,7 +85915,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -86739,7 +86739,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -93325,7 +93325,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -95543,7 +95543,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -95891,7 +95891,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 0, usage_count: 17, reassigned_with_assignment: false, @@ -96211,7 +96211,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -96289,7 +96289,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: true, @@ -96329,7 +96329,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -103347,7 +103347,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -105009,7 +105009,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -107485,7 +107485,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -109784,7 +109784,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -109824,7 +109824,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -110159,7 +110159,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -114227,7 +114227,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 12, reassigned_with_assignment: false, @@ -115195,7 +115195,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 16, usage_count: 18, reassigned_with_assignment: false, @@ -117457,7 +117457,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, @@ -120129,7 +120129,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -120169,7 +120169,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -120249,7 +120249,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -120289,7 +120289,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -121041,7 +121041,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: true, @@ -121281,7 +121281,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: true, @@ -121601,7 +121601,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: true, @@ -121841,7 +121841,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: true, @@ -122161,7 +122161,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -122401,7 +122401,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -122681,7 +122681,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -122761,7 +122761,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -122841,7 +122841,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -122881,7 +122881,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -125277,7 +125277,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -132001,7 +132001,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -132079,7 +132079,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -132117,7 +132117,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -134234,7 +134234,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -134274,7 +134274,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -137671,7 +137671,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -137711,7 +137711,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -140843,7 +140843,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 45, reassigned_with_assignment: false, @@ -143051,7 +143051,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -150781,7 +150781,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -152389,7 +152389,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -152709,7 +152709,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -155661,7 +155661,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -157629,7 +157629,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 11, usage_count: 21, reassigned_with_assignment: false, @@ -157667,7 +157667,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 5, reassigned_with_assignment: false, @@ -157863,7 +157863,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -158337,7 +158337,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -159291,7 +159291,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -159331,7 +159331,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -160597,7 +160597,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -162591,7 +162591,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 7, reassigned_with_assignment: false, @@ -164673,7 +164673,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -165179,7 +165179,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -165217,7 +165217,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -168425,7 +168425,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -169908,7 +169908,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -170713,7 +170713,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -173119,7 +173119,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -173159,7 +173159,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 13, + assign_count: 3, mutation_by_call_count: 5, usage_count: 10, reassigned_with_assignment: true, @@ -173429,7 +173429,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -173469,7 +173469,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -179501,7 +179501,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -180757,7 +180757,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -181329,7 +181329,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -185149,7 +185149,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 0, mutation_by_call_count: 4, usage_count: 4, reassigned_with_assignment: false, @@ -185665,7 +185665,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 5, usage_count: 6, reassigned_with_assignment: true, @@ -185897,7 +185897,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 5, usage_count: 6, reassigned_with_assignment: true, @@ -190962,7 +190962,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -201795,7 +201795,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 7, reassigned_with_assignment: false, @@ -204099,7 +204099,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 7, usage_count: 21, reassigned_with_assignment: true, @@ -205223,7 +205223,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -212355,7 +212355,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 6, reassigned_with_assignment: false, @@ -212939,7 +212939,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -212977,7 +212977,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -213915,7 +213915,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -214031,7 +214031,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 14, reassigned_with_assignment: false, @@ -214109,7 +214109,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -214461,7 +214461,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: false, @@ -215671,7 +215671,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -218626,7 +218626,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: true, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -218702,7 +218702,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -219989,7 +219989,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -220645,7 +220645,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -220913,7 +220913,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -222291,7 +222291,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -223077,7 +223077,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -224687,7 +224687,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -224727,7 +224727,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -226290,7 +226290,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -226328,7 +226328,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -228679,7 +228679,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 19, reassigned_with_assignment: false, @@ -228717,7 +228717,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 17, reassigned_with_assignment: false, @@ -229445,7 +229445,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -229525,7 +229525,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: true, @@ -231331,7 +231331,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: true, @@ -237995,7 +237995,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -238771,7 +238771,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -239877,7 +239877,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -239995,7 +239995,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -240035,7 +240035,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -253273,7 +253273,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 1, mutation_by_call_count: 2, usage_count: 9, reassigned_with_assignment: true, @@ -253865,7 +253865,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 3, mutation_by_call_count: 0, usage_count: 12, reassigned_with_assignment: true, @@ -257639,7 +257639,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -259771,7 +259771,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 4, usage_count: 13, reassigned_with_assignment: true, @@ -263809,7 +263809,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -263849,7 +263849,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -264841,7 +264841,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -265265,7 +265265,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -267297,7 +267297,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -267575,7 +267575,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -267731,7 +267731,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -280927,7 +280927,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -284219,7 +284219,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 1, mutation_by_call_count: 4, usage_count: 10, reassigned_with_assignment: true, @@ -285081,7 +285081,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -288071,7 +288071,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -288111,7 +288111,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -288391,7 +288391,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -294638,7 +294638,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: true, used_in_cond: true, @@ -303011,7 +303011,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -303051,7 +303051,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -303411,7 +303411,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -303451,7 +303451,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -303491,7 +303491,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -311273,7 +311273,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 5, reassigned_with_assignment: false, @@ -315902,7 +315902,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: true, @@ -316639,7 +316639,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -318829,7 +318829,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 3, mutation_by_call_count: 0, usage_count: 7, reassigned_with_assignment: true, @@ -318869,7 +318869,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 3, mutation_by_call_count: 0, usage_count: 7, reassigned_with_assignment: true, @@ -321175,7 +321175,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -321213,7 +321213,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -321289,7 +321289,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -322593,7 +322593,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -322825,7 +322825,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -322865,7 +322865,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -322905,7 +322905,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 13, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -323801,7 +323801,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -323881,7 +323881,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -328600,7 +328600,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: true, @@ -332417,7 +332417,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 11, usage_count: 38, reassigned_with_assignment: false, @@ -332653,7 +332653,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -345139,7 +345139,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: true, @@ -347713,7 +347713,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -348569,7 +348569,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -351725,7 +351725,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -353113,7 +353113,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -356157,7 +356157,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -356237,7 +356237,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: true, @@ -356948,7 +356948,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -356988,7 +356988,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -357689,7 +357689,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -365813,7 +365813,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 3, mutation_by_call_count: 6, usage_count: 21, reassigned_with_assignment: true, @@ -371825,7 +371825,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -371985,7 +371985,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 2, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -372825,7 +372825,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -375259,7 +375259,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -379621,7 +379621,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: true, @@ -393523,7 +393523,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -393563,7 +393563,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -393603,7 +393603,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -393837,7 +393837,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -400005,7 +400005,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -403713,7 +403713,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -412847,7 +412847,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -413437,7 +413437,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -417599,7 +417599,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -422683,7 +422683,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -422801,7 +422801,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 38, reassigned_with_assignment: false, @@ -431375,7 +431375,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -432157,7 +432157,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -432197,7 +432197,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -433389,7 +433389,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -435465,7 +435465,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 6, + assign_count: 5, mutation_by_call_count: 0, usage_count: 7, reassigned_with_assignment: true, @@ -438829,7 +438829,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -439501,7 +439501,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -439541,7 +439541,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -442683,7 +442683,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 8, reassigned_with_assignment: false, @@ -448777,7 +448777,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 0, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: false, @@ -448817,7 +448817,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -450857,7 +450857,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -451457,7 +451457,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 4, reassigned_with_assignment: false, @@ -451577,7 +451577,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -451617,7 +451617,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 1, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -452095,7 +452095,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -452971,7 +452971,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -453365,7 +453365,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -453443,7 +453443,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -453481,7 +453481,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -459695,7 +459695,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -460682,7 +460682,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -460722,7 +460722,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -463541,7 +463541,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -465189,7 +465189,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 4, usage_count: 9, reassigned_with_assignment: false, @@ -467927,7 +467927,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 4, usage_count: 14, reassigned_with_assignment: false, @@ -468667,7 +468667,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -468705,7 +468705,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -468903,7 +468903,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -469019,7 +469019,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -469057,7 +469057,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -469287,7 +469287,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -469325,7 +469325,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -469363,7 +469363,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, @@ -469783,7 +469783,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -474623,7 +474623,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -479767,7 +479767,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 4, reassigned_with_assignment: false, @@ -481267,7 +481267,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -481347,7 +481347,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 11, reassigned_with_assignment: false, @@ -481503,7 +481503,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -481621,7 +481621,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -481661,7 +481661,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -481973,7 +481973,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -482051,7 +482051,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 12, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -482129,7 +482129,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -482207,7 +482207,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 8, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -482606,7 +482606,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -484355,7 +484355,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -484835,7 +484835,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -485189,7 +485189,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -485229,7 +485229,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -485269,7 +485269,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 10, + assign_count: 3, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: true, @@ -485389,7 +485389,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -490283,7 +490283,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 2, usage_count: 5, reassigned_with_assignment: false, @@ -492985,7 +492985,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -493185,7 +493185,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -499763,7 +499763,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -500003,7 +500003,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, @@ -500363,7 +500363,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -500403,7 +500403,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 5, reassigned_with_assignment: false, @@ -500983,7 +500983,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -501175,7 +501175,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 2, usage_count: 2, reassigned_with_assignment: false, @@ -502173,7 +502173,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -505434,7 +505434,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -505474,7 +505474,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -511017,7 +511017,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -512985,7 +512985,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 49, usage_count: 322, reassigned_with_assignment: false, @@ -516497,7 +516497,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -516535,7 +516535,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: false, @@ -519118,7 +519118,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -519238,7 +519238,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -525015,7 +525015,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 5, usage_count: 10, reassigned_with_assignment: false, @@ -533585,7 +533585,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -533825,7 +533825,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -533865,7 +533865,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -533905,7 +533905,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -539628,7 +539628,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -539668,7 +539668,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -539929,7 +539929,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -548543,7 +548543,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 5, + assign_count: 4, mutation_by_call_count: 0, usage_count: 10, reassigned_with_assignment: true, @@ -551203,7 +551203,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: false, @@ -551243,7 +551243,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: false, @@ -551283,7 +551283,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 13, + assign_count: 0, mutation_by_call_count: 3, usage_count: 4, reassigned_with_assignment: false, @@ -552519,7 +552519,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -554365,7 +554365,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -554405,7 +554405,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: false, @@ -554445,7 +554445,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 13, + assign_count: 0, mutation_by_call_count: 1, usage_count: 3, reassigned_with_assignment: false, @@ -554485,7 +554485,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 7, + assign_count: 2, mutation_by_call_count: 3, usage_count: 5, reassigned_with_assignment: true, @@ -554525,7 +554525,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -554565,7 +554565,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, @@ -554605,7 +554605,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 13, + assign_count: 0, mutation_by_call_count: 2, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/backbone/16/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/backbone/16/analysis-snapshot.rust-debug index 5c81485fa25..06515b2a508 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/backbone/16/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/backbone/16/analysis-snapshot.rust-debug @@ -327,7 +327,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/backbone/19/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/backbone/19/analysis-snapshot.rust-debug index af288110f64..f017581ba13 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/backbone/19/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/backbone/19/analysis-snapshot.rust-debug @@ -89,7 +89,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 4, usage_count: 9, reassigned_with_assignment: true, @@ -243,7 +243,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 2, usage_count: 4, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/backbone/20/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/backbone/20/analysis-snapshot.rust-debug index 6ff74b3380d..1f1bda0b412 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/backbone/20/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/backbone/20/analysis-snapshot.rust-debug @@ -763,7 +763,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/jquery/23/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/jquery/23/analysis-snapshot.rust-debug index 5a286ee7df2..d0d50fca99c 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/jquery/23/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/jquery/23/analysis-snapshot.rust-debug @@ -321,7 +321,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 5, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/analysis-snapshot.rust-debug index cc8f4f78c3f..69a62632a5d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/chunkfilename-b114cf1d23876beaa712/analysis-snapshot.rust-debug @@ -4737,7 +4737,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -5279,7 +5279,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -5469,7 +5469,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -5507,7 +5507,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/analysis-snapshot.rust-debug index cc8f4f78c3f..69a62632a5d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/function-7fe8439c89afccb77983/analysis-snapshot.rust-debug @@ -4737,7 +4737,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -5279,7 +5279,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -5469,7 +5469,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -5507,7 +5507,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/analysis-snapshot.rust-debug index 455e60de3f9..4a061f4ab55 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/head-432fc3a9a66c90ce2ec2/analysis-snapshot.rust-debug @@ -5815,7 +5815,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -6435,7 +6435,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -6625,7 +6625,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -6663,7 +6663,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/analysis-snapshot.rust-debug index 552799a85d1..ab6b165cd5f 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/multiple-modules-d02ebebcfa5282e50b34/analysis-snapshot.rust-debug @@ -4777,7 +4777,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -5319,7 +5319,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -5509,7 +5509,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -5547,7 +5547,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/analysis-snapshot.rust-debug index 6c3b5e83801..2b406d5d0f4 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/nested-05a7ce04b1f7eb6da341/analysis-snapshot.rust-debug @@ -4737,7 +4737,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -5279,7 +5279,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -5469,7 +5469,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -5507,7 +5507,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/analysis-snapshot.rust-debug index c2889fa12a4..fd904ccf503 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-chunk-e2d9573b8d7df68a6cde/analysis-snapshot.rust-debug @@ -7625,7 +7625,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -8399,7 +8399,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -8741,7 +8741,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -8779,7 +8779,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/analysis-snapshot.rust-debug index cc8f4f78c3f..69a62632a5d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-9ced90e71a0d75a11cdd/analysis-snapshot.rust-debug @@ -4737,7 +4737,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -5279,7 +5279,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -5469,7 +5469,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -5507,7 +5507,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/analysis-snapshot.rust-debug index bea21b9d54f..8323abf191c 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/no-ssr-custom-loading-7f61b2e27708ca1854e0/analysis-snapshot.rust-debug @@ -4737,7 +4737,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -5317,7 +5317,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -5507,7 +5507,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -5545,7 +5545,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/analysis-snapshot.rust-debug index cc8f4f78c3f..69a62632a5d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-994266264fb6ff57d32c/analysis-snapshot.rust-debug @@ -4737,7 +4737,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -5279,7 +5279,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -5469,7 +5469,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -5507,7 +5507,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/analysis-snapshot.rust-debug index cc8f4f78c3f..69a62632a5d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/next/archive-3/pages/dynamic/ssr-true-6d4aa8fc503b9d073aef/analysis-snapshot.rust-debug @@ -4737,7 +4737,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: true, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, @@ -5279,7 +5279,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 4, usage_count: 8, reassigned_with_assignment: false, @@ -5469,7 +5469,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, @@ -5507,7 +5507,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 3, usage_count: 3, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/hoofd.module.6c5395cb/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/hoofd.module.6c5395cb/analysis-snapshot.rust-debug index edf401041a7..d788675ad46 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/hoofd.module.6c5395cb/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/hoofd.module.6c5395cb/analysis-snapshot.rust-debug @@ -1929,7 +1929,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -2317,7 +2317,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -3103,7 +3103,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, 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 dfd912cc0e9..33a6d22333a 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 @@ -5,7 +5,7 @@ Thank you! Filter Expression: ${JSON.stringify(n,null,2)} `)}const a=tu[`filter_${r}`],l=ru(o,a);let c=null;if("error"===l.result)throw Error(l.value.map(i=>`${i.key}: ${i.message}`).join(", "));c=(i,r,n)=>l.value.evaluate(i,r,{},n);let h=null,u=null;if(o!==n){const d=ru(n,a);if("error"===d.result)throw Error(d.value.map(i=>`${i.key}: ${i.message}`).join(", "));h=(i,r,n,o,s)=>d.value.evaluate(i,r,{},n,void 0,void 0,o,s),u=!iu(d.value.expression)}return{filter:c,dynamicFilter:h||void 0,needGeometry:function i(r){if(!Array.isArray(r))return!1;if("within"===r[0])return!0;for(let n=1;n",">=","<","<=","to-boolean",]);function rI(i,r){return ir?1:0}function rM(i,r,n){switch(i){case"$type":return[`filter-type-${n}`,r];case"$id":return[`filter-id-${n}`,r];default:return[`filter-${n}`,i,r]}}function rA(i,r){if(0===r.length)return!1;switch(i){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(i=>typeof i!=typeof r[0])?["filter-in-large",i,["literal",r.sort(rI)],]:["filter-in-small",i,["literal",r],]}}function rC(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function rz(i){return["!",i]}function rk(i){if(rw(t$(i.value))){const r=t$(i.layerType);return rv(tf({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${r||"fill"}`]}))}return function i(r){const n=r.value,o=r.key;if("array"!==rt(n))return[new td(o,n,`array expected, ${rt(n)} found`),];const s=r.styleSpec;let a,l=[];if(n.length<1)return[new td(o,n,"filter array must have at least 1 element"),];switch(l=l.concat(rb({key:`${o}[0]`,value:n[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),tm(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===tm(n[1])&&l.push(new td(o,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":3!==n.length&&l.push(new td(o,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&"string"!==(a=rt(n[1]))&&l.push(new td(`${o}[1]`,n[1],`string expected, ${a} found`));for(let c=2;c{i in n&&r.push(new td(o,n[i],`"${i}" is prohibited for ref layers`))}),s.layers.forEach(i=>{tm(i.id)===c&&(p=i)}),p?p.ref?r.push(new td(o,n.ref,"ref cannot reference another ref layer")):l=tm(p.type):r.push(new td(o,n.ref,`ref layer "${c}" not found`))}else if("background"!==l&&"sky"!==l){if(n.source){const f=s.sources&&s.sources[n.source],m=f&&tm(f.type);f?"vector"===m&&"raster"===l?r.push(new td(o,n.source,`layer "${n.id}" requires a raster source`)):"raster"===m&&"raster"!==l?r.push(new td(o,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==m||n["source-layer"]?"raster-dem"===m&&"hillshade"!==l?r.push(new td(o,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===l&&n.paint&&n.paint["line-gradient"]&&("geojson"!==m||!f.lineMetrics)&&r.push(new td(o,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new td(o,n,`layer "${n.id}" must specify a "source-layer"`)):r.push(new td(o,n.source,`source "${n.source}" not found`))}else r.push(new td(o,n,'missing required property "source"'))}return r=r.concat(r$({key:o,value:n,valueSpec:a.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>rG({key:`${o}.type`,value:n.type,valueSpec:a.layer.type,style:i.style,styleSpec:i.styleSpec,object:n,objectKey:"type"}),filter:i=>rk(tf({layerType:l},i)),layout:i=>r$({layer:n,key:i.key,value:i.value,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>rL(tf({layerType:l},i))}}),paint:i=>r$({layer:n,key:i.key,value:i.value,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>rD(tf({layerType:l},i))}})}}))}function rR(i){const r=i.value,n=i.key,o=rt(r);return"string"!==o?[new td(n,r,`string expected, ${o} found`)]:[]}const rF={promoteId:function({key:i,value:r}){if("string"===rt(r))return rR({key:i,value:r});{const n=[];for(const o in r)n.push(...rR({key:`${i}.${o}`,value:r[o]}));return n}}};function rO(i){const r=i.value,n=i.key,o=i.styleSpec,s=i.style;if(!r.type)return[new td(n,r,'"type" is required')];const a=tm(r.type);let l;switch(a){case"vector":case"raster":case"raster-dem":return r$({key:n,value:r,valueSpec:o[`source_${a.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:rF});case"geojson":if(l=r$({key:n,value:r,valueSpec:o.source_geojson,style:s,styleSpec:o,objectElementValidators:rF}),r.cluster)for(const c in r.clusterProperties){const[h,u]=r.clusterProperties[c],d="string"==typeof h?[h,["accumulated"],["get",c],]:h;l.push(...rv({key:`${n}.${c}.map`,value:u,expressionContext:"cluster-map"})),l.push(...rv({key:`${n}.${c}.reduce`,value:d,expressionContext:"cluster-reduce"}))}return l;case"video":return r$({key:n,value:r,valueSpec:o.source_video,style:s,styleSpec:o});case"image":return r$({key:n,value:r,valueSpec:o.source_image,style:s,styleSpec:o});case"canvas":return[new td(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas"),];default:return rb({key:`${n}.type`,value:r.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image",]},style:s,styleSpec:o})}}function rU(i){const r=i.value,n=i.styleSpec,o=n.light,s=i.style;let a=[];const l=rt(r);if(void 0===r)return a;if("object"!==l)return a.concat([new td("light",r,`object expected, ${l} found`),]);for(const c in r){const h=c.match(/^(.*)-transition$/);a=a.concat(h&&o[h[1]]&&o[h[1]].transition?rG({key:c,value:r[c],valueSpec:n.transition,style:s,styleSpec:n}):o[c]?rG({key:c,value:r[c],valueSpec:o[c],style:s,styleSpec:n}):[new td(c,r[c],`unknown property "${c}"`),])}return a}function rV(i){const r=i.value,n=i.key,o=i.style,s=i.styleSpec,a=s.terrain;let l=[];const c=rt(r);if(void 0===r)return l;if("object"!==c)return l.concat([new td("terrain",r,`object expected, ${c} found`),]);for(const h in r){const u=h.match(/^(.*)-transition$/);l=l.concat(u&&a[u[1]]&&a[u[1]].transition?rG({key:h,value:r[h],valueSpec:s.transition,style:o,styleSpec:s}):a[h]?rG({key:h,value:r[h],valueSpec:a[h],style:o,styleSpec:s}):[new td(h,r[h],`unknown property "${h}"`),])}if(r.source){const d=o.sources&&o.sources[r.source],p=d&&tm(d.type);d?"raster-dem"!==p&&l.push(new td(n,r.source,`terrain cannot be used with a source of type ${p}, it only be used with a "raster-dem" source type`)):l.push(new td(n,r.source,`source "${r.source}" not found`))}else l.push(new td(n,r,'terrain is missing required property "source"'));return l}function rN(i){const r=i.value,n=i.style,o=i.styleSpec,s=o.fog;let a=[];const l=rt(r);if(void 0===r)return a;if("object"!==l)return a.concat([new td("fog",r,`object expected, ${l} found`),]);for(const c in r){const h=c.match(/^(.*)-transition$/);a=a.concat(h&&s[h[1]]&&s[h[1]].transition?rG({key:c,value:r[c],valueSpec:o.transition,style:n,styleSpec:o}):s[c]?rG({key:c,value:r[c],valueSpec:s[c],style:n,styleSpec:o}):[new td(c,r[c],`unknown property "${c}"`),])}return a}const rj={"*":()=>[],array:rg,boolean:function(i){const r=i.value,n=i.key,o=rt(r);return"boolean"!==o?[new td(n,r,`boolean expected, ${o} found`),]:[]},number:ry,color:function(i){const r=i.key,n=i.value,o=rt(n);return"string"!==o?[new td(r,n,`color expected, ${o} found`),]:null===tR.parseCSSColor(n)?[new td(r,n,`color expected, "${n}" found`),]:[]},constants:tp,enum:rb,filter:rk,function:rx,layer:rB,object:r$,source:rO,light:rU,terrain:rV,fog:rN,string:rR,formatted:function(i){return 0===rR(i).length?[]:rv(i)},resolvedImage:function(i){return 0===rR(i).length?[]:rv(i)},projection:function(i){const r=i.value,n=i.styleSpec,o=n.projection,s=i.style;let a=[];const l=rt(r);if("object"===l)for(const c in r)a=a.concat(rG({key:c,value:r[c],valueSpec:o[c],style:s,styleSpec:n}));else"string"!==l&&(a=a.concat([new td("projection",r,`object or string expected, ${l} found`),]));return a}};function rG(i){const r=i.value,n=i.valueSpec,o=i.styleSpec;return n.expression&&ri(tm(r))?rx(i):n.expression&&rh(t$(r))?rv(i):n.type&&rj[n.type]?rj[n.type](i):r$(tf({},i,{valueSpec:n.type?o[n.type]:n}))}function rZ(i){const r=i.value,n=i.key,o=rR(i);return o.length||(-1===r.indexOf("{fontstack}")&&o.push(new td(n,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&o.push(new td(n,r,'"glyphs" url must include a "{range}" token'))),o}function r_(i,r=tu){let n=[];return n=n.concat(rG({key:"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:rZ,"*":()=>[]}})),i.constants&&(n=n.concat(tp({key:"constants",value:i.constants,style:i,styleSpec:r}))),rq(n)}function rq(i){return[].concat(i).sort((i,r)=>i.line-r.line)}function rX(i){return function(...r){return rq(i.apply(this,r))}}r_.source=rX(rO),r_.light=rX(rU),r_.terrain=rX(rV),r_.fog=rX(rN),r_.layer=rX(rB),r_.filter=rX(rk),r_.paintProperty=rX(rD),r_.layoutProperty=rX(rL);const rW=r_,rH=rW.light,rK=rW.fog,rY=rW.paintProperty,rJ=rW.layoutProperty;function rQ(i,r){let n=!1;if(r&&r.length)for(const o of r)i.fire(new tc(Error(o.message))),n=!0;return n}var r0=r1;function r1(i,r,n){var o=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var s=new Int32Array(this.arrayBuffer);i=s[0],this.d=(r=s[1])+2*(n=s[2]);for(var a=0;a=d[m+0]&&o>=d[m+1])?(l[f]=!0,a.push(u[f])):l[f]=!1}}},r1.prototype._forEachCell=function(i,r,n,o,s,a,l,c){for(var h=this._convertToCellCoord(i),u=this._convertToCellCoord(r),d=this._convertToCellCoord(n),p=this._convertToCellCoord(o),f=h;f<=d;f++)for(var m=u;m<=p;m++){var $=this.d*m+f;if((!c||c(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&s.call(this,i,r,n,o,$,a,l,c))return}},r1.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},r1.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},r1.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,r=3+this.cells.length+1+1,n=0,o=0;o=0)continue;const u=i[h];c[h]=r5[l].shallow.indexOf(h)>=0?u:r7(u,r)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==l&&(c.$name=l),c}throw Error("can't serialize object of type "+typeof i)}function ne(i){if(null==i||"boolean"==typeof i||"number"==typeof i||"string"==typeof i||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||r8(i)||r9(i)||ArrayBuffer.isView(i)||i instanceof r2)return i;if(Array.isArray(i))return i.map(ne);if("object"==typeof i){const r=i.$name||"Object",{klass:n}=r5[r];if(!n)throw Error(`can't deserialize unregistered class ${r}`);if(n.deserialize)return n.deserialize(i);const o=Object.create(n.prototype);for(const s of Object.keys(i)){if("$name"===s)continue;const a=i[s];o[s]=r5[r].shallow.indexOf(s)>=0?a:ne(a)}return o}throw Error("can't deserialize object of type "+typeof i)}class nt{constructor(){this.first=!0}update(i,r){const n=Math.floor(i);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=i,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=1536&&i<=1791,nr=i=>i>=1872&&i<=1919,nn=i=>i>=2208&&i<=2303,no=i=>i>=11904&&i<=12031,ns=i=>i>=12032&&i<=12255,na=i=>i>=12272&&i<=12287,nl=i=>i>=12288&&i<=12351,nc=i=>i>=12352&&i<=12447,nh=i=>i>=12448&&i<=12543,nu=i=>i>=12544&&i<=12591,nd=i=>i>=12704&&i<=12735,np=i=>i>=12736&&i<=12783,nf=i=>i>=12784&&i<=12799,nm=i=>i>=12800&&i<=13055,n$=i=>i>=13056&&i<=13311,ng=i=>i>=13312&&i<=19903,ny=i=>i>=19968&&i<=40959,nx=i=>i>=40960&&i<=42127,nv=i=>i>=42128&&i<=42191,nb=i=>i>=44032&&i<=55215,nw=i=>i>=63744&&i<=64255,nT=i=>i>=64336&&i<=65023,nE=i=>i>=65040&&i<=65055,nS=i=>i>=65072&&i<=65103,nI=i=>i>=65104&&i<=65135,nM=i=>i>=65136&&i<=65279,nA=i=>i>=65280&&i<=65519;function nC(i){for(const r of i)if(nP(r.charCodeAt(0)))return!0;return!1}function nz(i){for(const r of i)if(!nk(r.charCodeAt(0)))return!1;return!0}function nk(i){return!(ni(i)||nr(i)||nn(i)||nT(i)||nM(i))}function nP(i){var r,n,o,s,a,l,c,h;return!(746!==i&&747!==i&&(i<4352||!(nd(i)||nu(i)||nS(i)&&!(i>=65097&&i<=65103)||nw(i)||n$(i)||no(i)||np(i)||!(!nl(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||12336===i)||ng(i)||ny(i)||nm(i)||(r=i)>=12592&&r<=12687||(n=i)>=43360&&n<=43391||(o=i)>=55216&&o<=55295||(s=i)>=4352&&s<=4607||nb(i)||nc(i)||na(i)||(a=i)>=12688&&a<=12703||ns(i)||nf(i)||nh(i)&&12540!==i||!(!nA(i)||65288===i||65289===i||65293===i||i>=65306&&i<=65310||65339===i||65341===i||65343===i||i>=65371&&i<=65503||65507===i||i>=65512&&i<=65519)||!(!nI(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||(l=i)>=5120&&l<=5759||(c=i)>=6320&&c<=6399||nE(i)||(h=i)>=19904&&h<=19967||nx(i)||nv(i))))}function nD(i){var r,n,o,s,a,l,c,h,u,d,p,f,m;return!(nP(i)||(n=r=i)>=128&&n<=255&&(167===r||169===r||174===r||177===r||188===r||189===r||190===r||215===r||247===r)||(o=r)>=8192&&o<=8303&&(8214===r||8224===r||8225===r||8240===r||8241===r||8251===r||8252===r||8258===r||8263===r||8264===r||8265===r||8273===r)||(s=r)>=8448&&s<=8527||(a=r)>=8528&&a<=8591||(l=r)>=8960&&l<=9215&&(r>=8960&&r<=8967||r>=8972&&r<=8991||r>=8996&&r<=9e3||9003===r||r>=9085&&r<=9114||r>=9150&&r<=9165||9167===r||r>=9169&&r<=9179||r>=9186&&r<=9215)||(c=r)>=9216&&c<=9279&&9251!==r||(h=r)>=9280&&h<=9311||(u=r)>=9312&&u<=9471||(d=r)>=9632&&d<=9727||(p=r)>=9728&&p<=9983&&!(r>=9754&&r<=9759)||(f=r)>=11008&&f<=11263&&(r>=11026&&r<=11055||r>=11088&&r<=11097||r>=11192&&r<=11243)||nl(r)||nh(r)||(m=r)>=57344&&m<=63743||nS(r)||nI(r)||nA(r)||8734===r||8756===r||8757===r||r>=9984&&r<=10087||r>=10102&&r<=10131||65532===r||65533===r)}function nL(i){return i>=1424&&i<=2303||nT(i)||nM(i)}function nB(i,r){var n;return!(!r&&nL(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||(n=i)>=6016&&n<=6143)}function nR(i){for(const r of i)if(nL(r.charCodeAt(0)))return!0;return!1}const nF="deferred",nO="loading",nU="loaded";let nV=null,nN="unavailable",nj=null;const nG=function(i){i&&"string"==typeof i&&i.indexOf("NetworkError")>-1&&(nN="error"),nV&&nV(i)};function nZ(){n_.fire(new tl("pluginStateChange",{pluginStatus:nN,pluginURL:nj}))}const n_=new th,nq=function(){return nN},nX=function(){if(nN!==nF||!nj)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");nN=nO,nZ(),nj&&e9({url:nj},i=>{i?nG(i):(nN=nU,nZ())})},nW={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>nN===nU||null!=nW.applyArabicShaping,isLoading:()=>nN===nO,setState(i){nN=i.pluginStatus,nj=i.pluginURL},isParsed:()=>null!=nW.applyArabicShaping&&null!=nW.processBidirectionalText&&null!=nW.processStyledBidirectionalText,getPluginURL:()=>nj};class nH{constructor(i,r){this.zoom=i,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition,this.pitch=r.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new nt,this.transition={},this.pitch=0)}isSupportedScript(i){return function(i,r){for(const n of i)if(!nB(n.charCodeAt(0),r))return!1;return!0}(i,nW.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const i=this.zoom,r=i-Math.floor(i),n=this.crossFadingFactor();return i>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class nK{constructor(i,r){this.property=i,this.value=r,this.expression=function(i,r){if(ri(i))return new rm(i,r);if(rh(i)){const n=rf(i,r);if("error"===n.result)throw Error(n.value.map(i=>`${i.key}: ${i.message}`).join(", "));return n.value}{let o=i;return"string"==typeof i&&"color"===r.type&&(o=tF.parse(i)),{kind:"constant",evaluate:()=>o}}}(void 0===r?i.specification.default:r,i.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(i,r,n){return this.property.possiblyEvaluate(this,i,r,n)}}class nY{constructor(i){this.property=i,this.value=new nK(i,void 0)}transitioned(i,r){return new nQ(this.property,this.value,r,et({},i.transition,this.transition),i.now)}untransitioned(){return new nQ(this.property,this.value,null,{},0)}}class nJ{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return eu(this._values[i].value.value)}setValue(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nY(this._values[i].property)),this._values[i].value=new nK(this._values[i].property,null===r?void 0:eu(r))}getTransition(i){return eu(this._values[i].transition)}setTransition(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nY(this._values[i].property)),this._values[i].transition=eu(r)||void 0}serialize(){const i={};for(const r of Object.keys(this._values)){const n=this.getValue(r);void 0!==n&&(i[r]=n);const o=this.getTransition(r);void 0!==o&&(i[`${r}-transition`]=o)}return i}transitioned(i,r){const n=new n0(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].transitioned(i,r._values[o]);return n}untransitioned(){const i=new n0(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].untransitioned();return i}}class nQ{constructor(i,r,n,o,s){const a=o.delay||0,l=o.duration||0;s=s||0,this.property=i,this.value=r,this.begin=s+a,this.end=this.begin+l,i.specification.transition&&(o.delay||o.duration)&&(this.prior=n)}possiblyEvaluate(i,r,n){const o=i.now||0,s=this.value.possiblyEvaluate(i,r,n),a=this.prior;if(a){if(o>this.end||this.value.isDataDriven())return this.prior=null,s;if(oo.zoomHistory.lastIntegerZoom?{from:i,to:r,other:n}:{from:n,to:r,other:i}}interpolate(i){return i}}class n6{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,o){if(void 0!==i.value){if("constant"===i.expression.kind){const s=i.expression.evaluate(r,null,{},n,o);return this._calculate(s,s,s,r)}return this._calculate(i.expression.evaluate(new nH(Math.floor(r.zoom-1),r)),i.expression.evaluate(new nH(Math.floor(r.zoom),r)),i.expression.evaluate(new nH(Math.floor(r.zoom+1),r)),r)}}_calculate(i,r,n,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:i,to:r}:{from:n,to:r}}interpolate(i){return i}}class n8{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,o){return!!i.expression.evaluate(r,null,{},n,o)}interpolate(){return!1}}class n9{constructor(i){for(const r in this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],i){const n=i[r];n.specification.overridable&&this.overridableProperties.push(r);const o=this.defaultPropertyValues[r]=new nK(n,void 0),s=this.defaultTransitionablePropertyValues[r]=new nY(n);this.defaultTransitioningPropertyValues[r]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=o.possiblyEvaluate({})}}}function n7(i,r){return 256*(i=K(Math.floor(i),0,255))+K(Math.floor(r),0,255)}r4("DataDrivenProperty",n5),r4("DataConstantProperty",n3),r4("CrossFadedDataDrivenProperty",n4),r4("CrossFadedProperty",n6),r4("ColorRampProperty",n8);const oe={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ot{constructor(i,r){this._structArray=i,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class oi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(i,r){return i._trim(),r&&(i.isTransferred=!0,r.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){const r=Object.create(this.prototype);return r.arrayBuffer=i.arrayBuffer,r.length=i.length,r.capacity=i.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function or(i,r=1){let n=0,o=0;return{members:i.map(i=>{const s=oe[i.type].BYTES_PER_ELEMENT,a=n=on(n,Math.max(r,s)),l=i.components||1;return o=Math.max(o,s),n+=s*l,{name:i.name,type:i.type,components:l,offset:a}}),size:on(n,Math.max(o,r)),alignment:r}}function on(i,r){return Math.ceil(i/r)*r}class oo extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.int16[o+0]=r,this.int16[o+1]=n,i}}oo.prototype.bytesPerElement=4,r4("StructArrayLayout2i4",oo);class os extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=4*i;return this.int16[a+0]=r,this.int16[a+1]=n,this.int16[a+2]=o,this.int16[a+3]=s,i}}os.prototype.bytesPerElement=8,r4("StructArrayLayout4i8",os);class oa extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=6*i,u=12*i,d=3*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.uint8[u+4]=o,this.uint8[u+5]=s,this.uint8[u+6]=a,this.uint8[u+7]=l,this.float32[d+2]=c,i}}oa.prototype.bytesPerElement=12,r4("StructArrayLayout2i4ub1f12",oa);class ol extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=o,i}}ol.prototype.bytesPerElement=12,r4("StructArrayLayout3f12",ol);class oc extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u){const d=this.length;return this.resize(d+1),this.emplace(d,i,r,n,o,s,a,l,c,h,u)}emplace(i,r,n,o,s,a,l,c,h,u,d){const p=10*i;return this.uint16[p+0]=r,this.uint16[p+1]=n,this.uint16[p+2]=o,this.uint16[p+3]=s,this.uint16[p+4]=a,this.uint16[p+5]=l,this.uint16[p+6]=c,this.uint16[p+7]=h,this.uint16[p+8]=u,this.uint16[p+9]=d,i}}oc.prototype.bytesPerElement=20,r4("StructArrayLayout10ui20",oc);class oh extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,i,r,n,o,s,a,l,c)}emplace(i,r,n,o,s,a,l,c,h){const u=8*i;return this.uint16[u+0]=r,this.uint16[u+1]=n,this.uint16[u+2]=o,this.uint16[u+3]=s,this.uint16[u+4]=a,this.uint16[u+5]=l,this.uint16[u+6]=c,this.uint16[u+7]=h,i}}oh.prototype.bytesPerElement=16,r4("StructArrayLayout8ui16",oh);class ou extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g){const y=this.length;return this.resize(y+1),this.emplace(y,i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y){const x=16*i;return this.int16[x+0]=r,this.int16[x+1]=n,this.int16[x+2]=o,this.int16[x+3]=s,this.uint16[x+4]=a,this.uint16[x+5]=l,this.uint16[x+6]=c,this.uint16[x+7]=h,this.int16[x+8]=u,this.int16[x+9]=d,this.int16[x+10]=p,this.int16[x+11]=f,this.int16[x+12]=m,this.int16[x+13]=$,this.int16[x+14]=g,this.int16[x+15]=y,i}}ou.prototype.bytesPerElement=32,r4("StructArrayLayout4i4ui4i4i32",ou);class od extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint32[1*i+0]=r,i}}od.prototype.bytesPerElement=4,r4("StructArrayLayout1ul4",od);class op extends oi{_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(i,r,n,o,s,a,l,c,h,u,d,p,f){const m=this.length;return this.resize(m+1),this.emplace(m,i,r,n,o,s,a,l,c,h,u,d,p,f)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m){const $=20*i,g=10*i;return this.int16[$+0]=r,this.int16[$+1]=n,this.int16[$+2]=o,this.int16[$+3]=s,this.int16[$+4]=a,this.float32[g+3]=l,this.float32[g+4]=c,this.float32[g+5]=h,this.float32[g+6]=u,this.int16[$+14]=d,this.uint32[g+8]=p,this.uint16[$+18]=f,this.uint16[$+19]=m,i}}op.prototype.bytesPerElement=40,r4("StructArrayLayout5i4f1i1ul2ui40",op);class of extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=8*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.int16[h+2]=o,this.int16[h+4]=s,this.int16[h+5]=a,this.int16[h+6]=l,this.int16[h+7]=c,i}}of.prototype.bytesPerElement=16,r4("StructArrayLayout3i2i2i16",of);class om extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,i,r,n,o,s)}emplace(i,r,n,o,s,a){const l=4*i,c=8*i;return this.float32[l+0]=r,this.float32[l+1]=n,this.float32[l+2]=o,this.int16[c+6]=s,this.int16[c+7]=a,i}}om.prototype.bytesPerElement=16,r4("StructArrayLayout2f1f2i16",om);class o$ extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=12*i,l=3*i;return this.uint8[a+0]=r,this.uint8[a+1]=n,this.float32[l+1]=o,this.float32[l+2]=s,i}}o$.prototype.bytesPerElement=12,r4("StructArrayLayout2ub2f12",o$);class og extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.uint16[s+0]=r,this.uint16[s+1]=n,this.uint16[s+2]=o,i}}og.prototype.bytesPerElement=6,r4("StructArrayLayout3ui6",og);class oy extends oi{_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(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w,T){const E=30*i,S=15*i,I=60*i;return this.int16[E+0]=r,this.int16[E+1]=n,this.int16[E+2]=o,this.float32[S+2]=s,this.float32[S+3]=a,this.uint16[E+8]=l,this.uint16[E+9]=c,this.uint32[S+5]=h,this.uint32[S+6]=u,this.uint32[S+7]=d,this.uint16[E+16]=p,this.uint16[E+17]=f,this.uint16[E+18]=m,this.float32[S+10]=$,this.float32[S+11]=g,this.uint8[I+48]=y,this.uint8[I+49]=x,this.uint8[I+50]=v,this.uint32[S+13]=b,this.int16[E+28]=w,this.uint8[I+58]=T,i}}oy.prototype.bytesPerElement=60,r4("StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60",oy);class ox extends oi{_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(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k){const P=this.length;return this.resize(P+1),this.emplace(P,i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k,P){const D=38*i,L=19*i;return this.int16[D+0]=r,this.int16[D+1]=n,this.int16[D+2]=o,this.float32[L+2]=s,this.float32[L+3]=a,this.int16[D+8]=l,this.int16[D+9]=c,this.int16[D+10]=h,this.int16[D+11]=u,this.int16[D+12]=d,this.int16[D+13]=p,this.uint16[D+14]=f,this.uint16[D+15]=m,this.uint16[D+16]=$,this.uint16[D+17]=g,this.uint16[D+18]=y,this.uint16[D+19]=x,this.uint16[D+20]=v,this.uint16[D+21]=b,this.uint16[D+22]=w,this.uint16[D+23]=T,this.uint16[D+24]=E,this.uint16[D+25]=S,this.uint16[D+26]=I,this.uint16[D+27]=M,this.uint16[D+28]=A,this.uint32[L+15]=C,this.float32[L+16]=z,this.float32[L+17]=k,this.float32[L+18]=P,i}}ox.prototype.bytesPerElement=76,r4("StructArrayLayout3i2f6i15ui1ul3f76",ox);class ov extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.float32[1*i+0]=r,i}}ov.prototype.bytesPerElement=4,r4("StructArrayLayout1f4",ov);class ob extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.int16[s+0]=r,this.int16[s+1]=n,this.int16[s+2]=o,i}}ob.prototype.bytesPerElement=6,r4("StructArrayLayout3i6",ob);class ow extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=7*i;return this.float32[h+0]=r,this.float32[h+1]=n,this.float32[h+2]=o,this.float32[h+3]=s,this.float32[h+4]=a,this.float32[h+5]=l,this.float32[h+6]=c,i}}ow.prototype.bytesPerElement=28,r4("StructArrayLayout7f28",ow);class oT extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=6*i;return this.uint32[3*i+0]=r,this.uint16[a+2]=n,this.uint16[a+3]=o,this.uint16[a+4]=s,i}}oT.prototype.bytesPerElement=12,r4("StructArrayLayout1ul3ui12",oT);class oE extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.uint16[o+0]=r,this.uint16[o+1]=n,i}}oE.prototype.bytesPerElement=4,r4("StructArrayLayout2ui4",oE);class oS extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint16[1*i+0]=r,i}}oS.prototype.bytesPerElement=2,r4("StructArrayLayout1ui2",oS);class oI extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.float32[o+0]=r,this.float32[o+1]=n,i}}oI.prototype.bytesPerElement=8,r4("StructArrayLayout2f8",oI);class oM extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=4*i;return this.float32[a+0]=r,this.float32[a+1]=n,this.float32[a+2]=o,this.float32[a+3]=s,i}}oM.prototype.bytesPerElement=16,r4("StructArrayLayout4f16",oM);class oA extends ot{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]}}oA.prototype.size=40;class oC extends op{get(i){return new oA(this,i)}}r4("CollisionBoxArray",oC);class oz extends ot{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(i){this._structArray.uint8[this._pos1+49]=i}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(i){this._structArray.uint8[this._pos1+50]=i}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(i){this._structArray.uint32[this._pos4+13]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(i){this._structArray.uint8[this._pos1+58]=i}}oz.prototype.size=60;class ok extends oy{get(i){return new oz(this,i)}}r4("PlacedSymbolArray",ok);class oP extends ot{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(i){this._structArray.uint32[this._pos4+15]=i}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]}}oP.prototype.size=76;class oD extends ox{get(i){return new oP(this,i)}}r4("SymbolInstanceArray",oD);class oL extends ov{getoffsetX(i){return this.float32[1*i+0]}}r4("GlyphOffsetArray",oL);class oB extends ob{getx(i){return this.int16[3*i+0]}gety(i){return this.int16[3*i+1]}gettileUnitDistanceFromAnchor(i){return this.int16[3*i+2]}}r4("SymbolLineVertexArray",oB);class oR extends ot{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]}}oR.prototype.size=12;class oF extends oT{get(i){return new oR(this,i)}}r4("FeatureIndexArray",oF);class oO extends ot{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}oO.prototype.size=4;class oU extends oE{get(i){return new oO(this,i)}}r4("FillExtrusionCentroidArray",oU);const oV=or([{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"},]),oN=or([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"},]);var oj=tB(function(i){i.exports=function(i,r){var n,o,s,a,l,c,h,u;for(o=i.length-(n=3&i.length),s=r,l=3432918353,c=461845907,u=0;u>>16)*l&65535)<<16)&4294967295)<<15|h>>>17))*c+(((h>>>16)*c&65535)<<16)&4294967295)<<13|s>>>19))+((5*(s>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(h=0,n){case 3:h^=(255&i.charCodeAt(u+2))<<16;case 2:h^=(255&i.charCodeAt(u+1))<<8;case 1:s^=h=(65535&(h=(h=(65535&(h^=255&i.charCodeAt(u)))*l+(((h>>>16)*l&65535)<<16)&4294967295)<<15|h>>>17))*c+(((h>>>16)*c&65535)<<16)&4294967295}return s^=i.length,s=2246822507*(65535&(s^=s>>>16))+((2246822507*(s>>>16)&65535)<<16)&4294967295,s=3266489909*(65535&(s^=s>>>13))+((3266489909*(s>>>16)&65535)<<16)&4294967295,(s^=s>>>16)>>>0}}),oG=tB(function(i){i.exports=function(i,r){for(var n,o=i.length,s=r^o,a=0;o>=4;)n=1540483477*(65535&(n=255&i.charCodeAt(a)|(255&i.charCodeAt(++a))<<8|(255&i.charCodeAt(++a))<<16|(255&i.charCodeAt(++a))<<24))+((1540483477*(n>>>16)&65535)<<16),s=1540483477*(65535&s)+((1540483477*(s>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),o-=4,++a;switch(o){case 3:s^=(255&i.charCodeAt(a+2))<<16;case 2:s^=(255&i.charCodeAt(a+1))<<8;case 1:s=1540483477*(65535&(s^=255&i.charCodeAt(a)))+((1540483477*(s>>>16)&65535)<<16)}return s=1540483477*(65535&(s^=s>>>13))+((1540483477*(s>>>16)&65535)<<16),(s^=s>>>15)>>>0}}),oZ=oj;oZ.murmur3=oj,oZ.murmur2=oG;class o_{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,r,n,o){this.ids.push(oq(i)),this.positions.push(r,n,o)}getPositions(i){const r=oq(i);let n=0,o=this.ids.length-1;for(;n>1;this.ids[s]>=r?o=s:n=s+1}const a=[];for(;this.ids[n]===r;)a.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return a}static serialize(i,r){const n=new Float64Array(i.ids),o=new Uint32Array(i.positions);return function i(r,n,o,s){for(;o>1];let l=o-1,c=s+1;for(;;){do l++;while(r[l]a)if(l>=c)break;oX(r,l,c),oX(n,3*l,3*c),oX(n,3*l+1,3*c+1),oX(n,3*l+2,3*c+2)}c-o`u_${i}`),this.type=n}setUniform(i,r,n){i.set(n.constantOr(this.value))}getBinding(i,r,n){return"color"===this.type?new oY(i,r):new oH(i,r)}}class o3{constructor(i,r){this.uniformNames=r.map(i=>`u_${i}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(i,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=i.pixelRatio,this.patternFrom=r.tl.concat(r.br),this.patternTo=i.tl.concat(i.br)}setUniform(i,r,n,o){const s="u_pattern_to"===o||"u_dash_to"===o?this.patternTo:"u_pattern_from"===o||"u_dash_from"===o?this.patternFrom:"u_pixel_ratio_to"===o?this.pixelRatioTo:"u_pixel_ratio_from"===o?this.pixelRatioFrom:null;s&&i.set(s)}getBinding(i,r,n){return"u_pattern_from"===n||"u_pattern_to"===n||"u_dash_from"===n||"u_dash_to"===n?new oK(i,r):new oH(i,r)}}class o5{constructor(i,r,n,o){this.expression=i,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(i,r,n,o,s,a){const l=this.paintVertexArray.length,c=this.expression.evaluate(new nH(0),r,{},s,o,a);this.paintVertexArray.resize(i),this._setPaintValue(l,i,c)}updatePaintArray(i,r,n,o,s){const a=this.expression.evaluate({zoom:0},n,o,void 0,s);this._setPaintValue(i,r,a)}_setPaintValue(i,r,n){if("color"===this.type){const o=o1(n);for(let s=i;s`u_${i}_t`),this.type=n,this.useIntegerZoom=o,this.zoom=s,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(i,r,n,o,s,a){const l=this.expression.evaluate(new nH(this.zoom),r,{},s,o,a),c=this.expression.evaluate(new nH(this.zoom+1),r,{},s,o,a),h=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(h,i,l,c)}updatePaintArray(i,r,n,o,s){const a=this.expression.evaluate({zoom:this.zoom},n,o,void 0,s),l=this.expression.evaluate({zoom:this.zoom+1},n,o,void 0,s);this._setPaintValue(i,r,a,l)}_setPaintValue(i,r,n,o){if("color"===this.type){const s=o1(n),a=o1(o);for(let l=i;l!0){this.binders={},this._buffers=[];const o=[];for(const s in i.paint._values){if(!n(s))continue;const a=i.paint.get(s);if(!(a instanceof n1&&i9(a.property.specification)))continue;const l=se(s,i.type),c=a.value,h=a.property.specification.type,u=a.property.useIntegerZoom,d=a.property.specification["property-type"],p="cross-faded"===d||"cross-faded-data-driven"===d,f="line-dasharray"===String(s)&&"constant"!==i.layout.get("line-cap").value.kind;if("constant"!==c.kind||f){if("source"===c.kind||f||p){const m=sr(s,h,"source");this.binders[s]=p?new o6(c,l,h,u,r,m,i.id):new o5(c,l,h,m),o.push(`/a_${s}`)}else{const $=sr(s,h,"composite");this.binders[s]=new o4(c,l,h,u,r,$),o.push(`/z_${s}`)}}else this.binders[s]=p?new o3(c.value,l):new o2(c.value,l,h),o.push(`/u_${s}`)}this.cacheKey=o.sort().join("")}getMaxValue(i){const r=this.binders[i];return r instanceof o5||r instanceof o4?r.maxValue:0}populatePaintArrays(i,r,n,o,s,a){for(const l in this.binders){const c=this.binders[l];(c instanceof o5||c instanceof o4||c instanceof o6)&&c.populatePaintArray(i,r,n,o,s,a)}}setConstantPatternPositions(i,r){for(const n in this.binders){const o=this.binders[n];o instanceof o3&&o.setConstantPatternPositions(i,r)}}updatePaintArrays(i,r,n,o,s,a){let l=!1;for(const c in i){const h=r.getPositions(c);for(const u of h){const d=n.feature(u.index);for(const p in this.binders){const f=this.binders[p];if((f instanceof o5||f instanceof o4||f instanceof o6)&&!0===f.expression.isStateDependent){const m=o.paint.get(p);f.expression=m.value,f.updatePaintArray(u.start,u.end,d,i[c],s,a),l=!0}}}}return l}defines(){const i=[];for(const r in this.binders){const n=this.binders[r];(n instanceof o2||n instanceof o3)&&i.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return i}getBinderAttributes(){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof o5||n instanceof o4||n instanceof o6)for(let o=0;o!0){for(const o of(this.programConfigurations={},i))this.programConfigurations[o.id]=new o8(o,r,n);this.needsUpload=!1,this._featureMap=new o_,this._bufferOffset=0}populatePaintArrays(i,r,n,o,s,a,l){for(const c in this.programConfigurations)this.programConfigurations[c].populatePaintArrays(i,r,o,s,a,l);void 0!==r.id&&this._featureMap.add(r.id,n,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,r,n,o,s){for(const a of n)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(i,this._featureMap,r,a,o,s)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(i);this.needsUpload=!1}}destroy(){for(const i in this.programConfigurations)this.programConfigurations[i].destroy()}}const o7={"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 se(i,r){return o7[i]||[i.replace(`${r}-`,"").replace(/-/g,"_"),]}const st={"line-pattern":{source:oc,composite:oc},"fill-pattern":{source:oc,composite:oc},"fill-extrusion-pattern":{source:oc,composite:oc},"line-dasharray":{source:oh,composite:oh}},si={color:{source:oI,composite:oM},number:{source:ov,composite:oI}};function sr(i,r,n){const o=st[i];return o&&o[n]||si[r][n]}r4("ConstantBinder",o2),r4("CrossFadedConstantBinder",o3),r4("SourceExpressionBinder",o5),r4("CrossFadedCompositeBinder",o6),r4("CompositeExpressionBinder",o4),r4("ProgramConfiguration",o8,{omit:["_buffers"]}),r4("ProgramConfigurationSet",o9);const sn="-transition";class so extends th{constructor(i,r){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==i.type&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,"background"!==i.type&&"sky"!==i.type&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),r.layout&&(this._unevaluatedLayout=new class{constructor(i){this._properties=i,this._values=Object.create(i.defaultPropertyValues)}getValue(i){return eu(this._values[i].value)}setValue(i,r){this._values[i]=new nK(this._values[i].property,null===r?void 0:eu(r))}serialize(){const i={};for(const r of Object.keys(this._values)){const n=this.getValue(r);void 0!==n&&(i[r]=n)}return i}possiblyEvaluate(i,r,n){const o=new n2(this._properties);for(const s of Object.keys(this._values))o._values[s]=this._values[s].possiblyEvaluate(i,r,n);return o}}(r.layout)),r.paint)){for(const n in this._transitionablePaint=new nJ(r.paint),i.paint)this.setPaintProperty(n,i.paint[n],{validate:!1});for(const o in i.layout)this.setLayoutProperty(o,i.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new n2(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(i){return"visibility"===i?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,r,n={}){null!=r&&this._validate(rJ,`layers.${this.id}.layout.${i}`,i,r,n)||("visibility"!==i?this._unevaluatedLayout.setValue(i,r):this.visibility=r)}getPaintProperty(i){return el(i,sn)?this._transitionablePaint.getTransition(i.slice(0,-sn.length)):this._transitionablePaint.getValue(i)}setPaintProperty(i,r,n={}){if(null!=r&&this._validate(rY,`layers.${this.id}.paint.${i}`,i,r,n))return!1;if(el(i,sn))return this._transitionablePaint.setTransition(i.slice(0,-sn.length),r||void 0),!1;{const o=this._transitionablePaint._values[i],s="cross-faded-data-driven"===o.property.specification["property-type"],a=o.value.isDataDriven(),l=o.value;this._transitionablePaint.setValue(i,r),this._handleSpecialPaintPropertyUpdate(i);const c=this._transitionablePaint._values[i].value;return c.isDataDriven()||a||s||this._handleOverridablePaintPropertyUpdate(i,l,c)}}_handleSpecialPaintPropertyUpdate(i){}getProgramIds(){return null}getProgramConfiguration(i){return null}_handleOverridablePaintPropertyUpdate(i,r,n){return!1}isHidden(i){return!!(this.minzoom&&i=this.maxzoom)||"none"===this.visibility}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,r){i.getCrossfadeParameters&&(this._crossfadeParameters=i.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,r)}serialize(){const i={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&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),eh(i,(i,r)=>!(void 0===i||"layout"===r&&!Object.keys(i).length||"paint"===r&&!Object.keys(i).length))}_validate(i,r,n,o,s={}){return(!s||!1!==s.validate)&&rQ(this,i.call(rW,{key:r,layerType:this.type,objectKey:n,value:o,styleSpec:tu,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const i in this.paint._values){const r=this.paint.get(i);if(r instanceof n1&&i9(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=rT(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const ss=or([{name:"a_pos",components:2,type:"Int16"},],4),{members:sa}=ss;class sl{constructor(i=[]){this.segments=i}prepareSegment(i,r,n,o){let s=this.segments[this.segments.length-1];return i>sl.MAX_VERTEX_ARRAY_LENGTH&&ep(`Max vertices per segment is ${sl.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!s||s.vertexLength+i>sl.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==o)&&(s={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==o&&(s.sortKey=o),this.segments.push(s)),s}get(){return this.segments}destroy(){for(const i of this.segments)for(const r in i.vaos)i.vaos[r].destroy()}static simpleSegment(i,r,n,o){return new sl([{vertexOffset:i,primitiveOffset:r,vertexLength:n,primitiveLength:o,vaos:{},sortKey:0},])}}sl.MAX_VERTEX_ARRAY_LENGTH=65535,r4("SegmentVector",sl);class sc{constructor(i,r){i&&(r?this.setSouthWest(i).setNorthEast(r):4===i.length?this.setSouthWest([i[0],i[1],]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1]))}setNorthEast(i){return this._ne=i instanceof sh?new sh(i.lng,i.lat):sh.convert(i),this}setSouthWest(i){return this._sw=i instanceof sh?new sh(i.lng,i.lat):sh.convert(i),this}extend(i){const r=this._sw,n=this._ne;let o,s;if(i instanceof sh)o=i,s=i;else{if(!(i instanceof sc))return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(sc.convert(i)):this.extend(sh.convert(i)):this;if(o=i._sw,s=i._ne,!o||!s)return this}return r||n?(r.lng=Math.min(o.lng,r.lng),r.lat=Math.min(o.lat,r.lat),n.lng=Math.max(s.lng,n.lng),n.lat=Math.max(s.lat,n.lat)):(this._sw=new sh(o.lng,o.lat),this._ne=new sh(s.lng,s.lat)),this}getCenter(){return new sh((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 sh(this.getWest(),this.getNorth())}getSouthEast(){return new sh(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(i){const{lng:r,lat:n}=sh.convert(i);let o=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&o}static convert(i){return!i||i instanceof sc?i:new sc(i)}}class sh{constructor(i,r){if(isNaN(i)||isNaN(r))throw Error(`Invalid LngLat object: (${i}, ${r})`);if(this.lng=+i,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new sh(J(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){const r=Math.PI/180,n=this.lat*r,o=i.lat*r,s=Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos((i.lng-this.lng)*r);return 6371008.8*Math.acos(Math.min(s,1))}toBounds(i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*this.lat);return new sc(new sh(this.lng-n,this.lat-r),new sh(this.lng+n,this.lat+r))}static convert(i){if(i instanceof sh)return i;if(Array.isArray(i)&&(2===i.length||3===i.length))return new sh(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&"object"==typeof i&&null!==i)return new sh(Number("lng"in i?i.lng:i.lon),Number(i.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const su=2*Math.PI*6371008.8;function sd(i){return su*Math.cos(i*Math.PI/180)}function sp(i){return(180+i)/360}function sf(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function sm(i,r){return i/sd(r)}function s$(i){return 360*i-180}function sg(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}function sy(i,r){return i*sd(sg(r))}class sx{constructor(i,r,n=0){this.x=+i,this.y=+r,this.z=+n}static fromLngLat(i,r=0){const n=sh.convert(i);return new sx(sp(n.lng),sf(n.lat),r/sd(n.lat))}toLngLat(){return new sh(s$(this.x),sg(this.y))}toAltitude(){return sy(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/su*(1/Math.cos(sg(this.y)*Math.PI/180))}}function sv(i,r,n,o,s,a,c,h,u){const d=(r+o)/2,p=(n+s)/2,f=new l(d,p);h(f),function(i,r,n,o,s,a){const l=n-s,c=o-a;return Math.abs((o-r)*l-(n-i)*c)/Math.hypot(l,c)}(f.x,f.y,a.x,a.y,c.x,c.y)>=u?(sv(i,r,n,d,p,a,f,h,u),sv(i,d,p,o,s,f,c,h,u)):i.push(c)}function sb(i,r,n){const o=[];let s,a,l;for(const c of i){const{x:h,y:u}=c;r(c),l?sv(o,s,a,h,u,l,c,r,n):o.push(c),s=h,a=u,l=c}return o}const sw=-16383-1;function sT(i,r){const n=Math.round(i.x*r),o=Math.round(i.y*r);return i.x=K(n,sw,16383),i.y=K(o,sw,16383),(ni.x+1||oi.y+1)&&ep("Geometry exceeds allowed extent, reduce your vector tile buffer size"),i}function sE(i,r,n){const o=i.loadGeometry(),s=i.extent,a=8192/s;if(r&&n&&n.projection.isReprojectedInTileSpace){const l=1<{const n=s$((r.x+i.x/s)/l),o=sg((r.y+i.y/s)/l),a=d.project(n,o);i.x=(a.x*c-h)*s,i.y=(a.y*c-u)*s};for(let f=0;f=s||$.y<0||$.y>=s||(p($),m.push($));o[f]=m}}for(const g of o)for(const y of g)sT(y,a);return o}function sS(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?sE(i):[]}}function sI(i,r,n,o,s){i.emplaceBack(2*r+(o+1)/2,2*n+(s+1)/2)}class sM{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new oo,this.indexArray=new og,this.segments=new sl,this.programConfigurations=new o9(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){const s=this.layers[0],a=[];let l=null;for(const{feature:c,id:h,index:u,sourceLayerIndex:d}of("circle"===s.type&&(l=s.layout.get("circle-sort-key")),i)){const p=this.layers[0]._featureFilter.needGeometry,f=sS(c,p);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom),f,n))continue;const m=l?l.evaluate(f,{},n):void 0,$={id:h,properties:c.properties,type:c.type,sourceLayerIndex:d,index:u,geometry:p?f.geometry:sE(c,n,o),patterns:{},sortKey:m};a.push($)}for(const g of(l&&a.sort((i,r)=>i.sortKey-r.sortKey),a)){const{geometry:y,index:x,sourceLayerIndex:v}=g,b=i[x].feature;this.addFeature(g,y,x,r.availableImages,n),r.featureIndex.insert(b,y,x,v,this.index)}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,sa),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,r,n,o,s){for(const a of r)for(const l of a){const c=l.x,h=l.y;if(c<0||c>=8192||h<0||h>=8192)continue;const u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),d=u.vertexLength;sI(this.layoutVertexArray,c,h,-1,-1),sI(this.layoutVertexArray,c,h,1,-1),sI(this.layoutVertexArray,c,h,1,1),sI(this.layoutVertexArray,c,h,-1,1),this.indexArray.emplaceBack(d,d+1,d+2),this.indexArray.emplaceBack(d,d+3,d+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,{},o,s)}}function sA(i,r){for(let n=0;n1){if(sP(i,r))return!0;for(let o=0;o1?n:n.sub(r)._mult(s)._add(r))}function sR(i,r){let n,o,s,a=!1;for(let l=0;lr.y!=s.y>r.y&&r.x<(s.x-o.x)*(r.y-o.y)/(s.y-o.y)+o.x&&(a=!a)}return a}function sF(i,r){let n=!1;for(let o=0,s=i.length-1;or.y!=l.y>r.y&&r.x<(l.x-a.x)*(r.y-a.y)/(l.y-a.y)+a.x&&(n=!n)}return n}function sO(i,r,n,o,s){for(const a of i)if(r<=a.x&&n<=a.y&&o>=a.x&&s>=a.y)return!0;const c=[new l(r,n),new l(r,s),new l(o,s),new l(o,n),];if(i.length>2){for(const h of c)if(sF(i,h))return!0}for(let u=0;us.x&&r.x>s.x||i.ys.y&&r.y>s.y)return!1;const a=ef(i,r,n[0]);return a!==ef(i,r,n[1])||a!==ef(i,r,n[2])||a!==ef(i,r,n[3])}function sV(i,r,n){const o=r.paint.get(i).value;return"constant"===o.kind?o.value:n.programConfigurations.get(r.id).getMaxValue(i)}function sN(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function sj(i,r,n,o,s){if(!r[0]&&!r[1])return i;const a=l.convert(r)._mult(s);"viewport"===n&&a._rotate(-o);const c=[];for(let h=0;h{var a,l,c;const h=F([],n,i),u=1/h[3]/r*s;return a=h,l=h,c=[u,u,o?1/h[3]:u,u],a[0]=l[0]*c[0],a[1]=l[1]*c[1],a[2]=l[2]*c[2],a[3]=l[3]*c[3],a}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5],].map(i=>{const r=z([],P([],R([],a[i[0]],a[i[1]]),R([],a[i[2]],a[i[1]]))),n=-k(r,a[i[1]]);return r.concat(n)});return new sq(a,l)}}class sX{constructor(i,r){this.min=i,this.max=r,this.center=A([],E([],this.min,this.max),.5)}quadrant(i){const r=[i%2==0,i<2],n=b(this.min),o=b(this.max);for(let s=0;s=0;if(0===a)return 0;a!==r.length&&(n=!1)}if(n)return 2;for(let c=0;c<3;c++){let h=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(let d=0;dthis.max[c]-this.min[c])return 0}return 1}}function sW(i,r,n,o,s,a,l,c,h){if(a&&i.queryGeometry.isAboveHorizon)return!1;for(const u of(a&&(h*=i.pixelToTileUnitsFactor),r))for(const d of u){const p=d.add(c),f=s&&n.elevation?n.elevation.exaggeration()*s.getElevationAt(p.x,p.y,!0):0,m=a?p:sH(p,f,o),$=a?i.tilespaceRays.map(i=>sJ(i,f)):i.queryGeometry.screenGeometry,g=F([],[d.x,d.y,f,1],o);if(!l&&a?h*=g[3]/n.cameraToCenterDistance:l&&!a&&(h*=n.cameraToCenterDistance/g[3]),sC($,m,h))return!0}return!1}function sH(i,r,n){const o=F([],[i.x,i.y,r,1],n);return new l(o[0]/o[3],o[1]/o[3])}const sK=T(0,0,0),sY=T(0,0,1);function sJ(i,r){const n=v();return sK[2]=r,i.intersectsPlane(sK,sY,n),new l(n[0],n[1])}class sQ extends sM{}function s0(i,{width:r,height:n},o,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==r*n*o)throw RangeError("mismatched image size")}else s=new Uint8Array(r*n*o);return i.width=r,i.height=n,i.data=s,i}function s1(i,{width:r,height:n},o){if(r===i.width&&n===i.height)return;const s=s0({},{width:r,height:n},o);s2(i,s,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,r),height:Math.min(i.height,n)},o),i.width=r,i.height=n,i.data=s.data}function s2(i,r,n,o,s,a){if(0===s.width||0===s.height)return r;if(s.width>i.width||s.height>i.height||n.x>i.width-s.width||n.y>i.height-s.height)throw RangeError("out of range source coordinates for image copy");if(s.width>r.width||s.height>r.height||o.x>r.width-s.width||o.y>r.height-s.height)throw RangeError("out of range destination coordinates for image copy");const l=i.data,c=r.data;for(let h=0;h{r[i.evaluationKey]=a;const l=i.expression.evaluate(r);s.data[n+o+0]=Math.floor(255*l.r/l.a),s.data[n+o+1]=Math.floor(255*l.g/l.a),s.data[n+o+2]=Math.floor(255*l.b/l.a),s.data[n+o+3]=Math.floor(255*l.a)};if(i.clips)for(let l=0,c=0;l80*n){o=a=i[0],s=l=i[1];for(var $=n;$a&&(a=c),h>l&&(l=h);u=0!==(u=Math.max(a-o,l-s))?1/u:0}return an(f,m,n,o,s,u),m}function ai(i,r,n,o,s){var a,l;if(s===aI(i,r,n,o)>0)for(a=r;a=r;a-=o)l=aT(a,i[a],i[a+1],l);return l&&ag(l,l.next)&&(aE(l),l=l.next),l}function ar(i,r){if(!i)return i;r||(r=i);var n,o=i;do if(n=!1,o.steiner||!ag(o,o.next)&&0!==a$(o.prev,o,o.next))o=o.next;else{if(aE(o),(o=r=o.prev)===o.next)break;n=!0}while(n||o!==r)return r}function an(i,r,n,o,s,a,l){if(i){!l&&a&&function(i,r,n,o){var s=i;do null===s.z&&(s.z=ad(s.x,s.y,r,n,o)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i)s.prevZ.nextZ=null,s.prevZ=null,function(i){var r,n,o,s,a,l,c,h,u=1;do{for(n=i,i=null,a=null,l=0;n;){for(l++,o=n,c=0,r=0;r0||h>0&&o;)0!==c&&(0===h||!o||n.z<=o.z)?(s=n,n=n.nextZ,c--):(s=o,o=o.nextZ,h--),a?a.nextZ=s:i=s,s.prevZ=a,a=s;n=o}a.nextZ=null,u*=2}while(l>1)}(s)}(i,o,s,a);for(var c,h,u=i;i.prev!==i.next;)if(c=i.prev,h=i.next,a?as(i,o,s,a):ao(i))r.push(c.i/n),r.push(i.i/n),r.push(h.i/n),aE(i),i=h.next,u=h.next;else if((i=h)===u){l?1===l?an(i=aa(ar(i),r,n),r,n,o,s,a,2):2===l&&al(i,r,n,o,s,a):an(ar(i),r,n,o,s,a,1);break}}}function ao(i){var r=i.prev,n=i,o=i.next;if(a$(r,n,o)>=0)return!1;for(var s=i.next.next;s!==i.prev;){if(af(r.x,r.y,n.x,n.y,o.x,o.y,s.x,s.y)&&a$(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function as(i,r,n,o){var s=i.prev,a=i,l=i.next;if(a$(s,a,l)>=0)return!1;for(var c=s.x>a.x?s.x>l.x?s.x:l.x:a.x>l.x?a.x:l.x,h=s.y>a.y?s.y>l.y?s.y:l.y:a.y>l.y?a.y:l.y,u=ad(s.x=u&&f&&f.z<=d;){if(p!==i.prev&&p!==i.next&&af(s.x,s.y,a.x,a.y,l.x,l.y,p.x,p.y)&&a$(p.prev,p,p.next)>=0||(p=p.prevZ,f!==i.prev&&f!==i.next&&af(s.x,s.y,a.x,a.y,l.x,l.y,f.x,f.y)&&a$(f.prev,f,f.next)>=0))return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==i.prev&&p!==i.next&&af(s.x,s.y,a.x,a.y,l.x,l.y,p.x,p.y)&&a$(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==i.prev&&f!==i.next&&af(s.x,s.y,a.x,a.y,l.x,l.y,f.x,f.y)&&a$(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function aa(i,r,n){var o=i;do{var s=o.prev,a=o.next.next;!ag(s,a)&&ay(s,o,o.next,a)&&ab(s,a)&&ab(a,s)&&(r.push(s.i/n),r.push(o.i/n),r.push(a.i/n),aE(o),aE(o.next),o=i=a),o=o.next}while(o!==i)return ar(o)}function al(i,r,n,o,s,a){var l=i;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&am(l,c)){var h=aw(l,c);return l=ar(l,l.next),h=ar(h,h.next),an(l,r,n,o,s,a),void an(h,r,n,o,s,a)}c=c.next}l=l.next}while(l!==i)}function ac(i,r){return i.x-r.x}function ah(i,r){var n=function(i,r){var n,o=r,s=i.x,a=i.y,l=-1/0;do{if(a<=o.y&&a>=o.next.y&&o.next.y!==o.y){var c=o.x+(a-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(c<=s&&c>l){if(l=c,c===s){if(a===o.y)return o;if(a===o.next.y)return o.next}n=o.x=o.x&&o.x>=d&&s!==o.x&&af(an.x||o.x===n.x&&au(n,o)))&&(n=o,f=h)),o=o.next;while(o!==u)return n}(i,r);if(!n)return r;var o=aw(n,i),s=ar(n,n.next);return ar(o,o.next),r===n?s:r}function au(i,r){return 0>a$(i.prev,i,r.prev)&&0>a$(r.next,i,i.next)}function ad(i,r,n,o,s){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-n)*s)|i<<8))|i<<4))|i<<2))|i<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=32767*(r-o)*s)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function ap(i){var r=i,n=i;do(r.x=0&&(i-l)*(o-c)-(n-l)*(r-c)>=0&&(n-l)*(a-c)-(s-l)*(o-c)>=0}function am(i,r){return i.next.i!==r.i&&i.prev.i!==r.i&&!function(i,r){var n=i;do{if(n.i!==i.i&&n.next.i!==i.i&&n.i!==r.i&&n.next.i!==r.i&&ay(n,n.next,i,r))return!0;n=n.next}while(n!==i)return!1}(i,r)&&(ab(i,r)&&ab(r,i)&&function(i,r){var n=i,o=!1,s=(i.x+r.x)/2,a=(i.y+r.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&s<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==i)return o}(i,r)&&(a$(i.prev,i,r.prev)||a$(i,r.prev,r))||ag(i,r)&&a$(i.prev,i,i.next)>0&&a$(r.prev,r,r.next)>0)}function a$(i,r,n){return(r.y-i.y)*(n.x-r.x)-(r.x-i.x)*(n.y-r.y)}function ag(i,r){return i.x===r.x&&i.y===r.y}function ay(i,r,n,o){var s=av(a$(i,r,n)),a=av(a$(i,r,o)),l=av(a$(n,o,i)),c=av(a$(n,o,r));return s!==a&&l!==c||!(0!==s||!ax(i,n,r))||!(0!==a||!ax(i,o,r))||!(0!==l||!ax(n,i,o))||!(0!==c||!ax(n,r,o))}function ax(i,r,n){return r.x<=Math.max(i.x,n.x)&&r.x>=Math.min(i.x,n.x)&&r.y<=Math.max(i.y,n.y)&&r.y>=Math.min(i.y,n.y)}function av(i){return i>0?1:i<0?-1:0}function ab(i,r){return 0>a$(i.prev,i,i.next)?a$(i,r,i.next)>=0&&a$(i,i.prev,r)>=0:0>a$(i,r,i.prev)||0>a$(i,i.next,r)}function aw(i,r){var n=new aS(i.i,i.x,i.y),o=new aS(r.i,r.x,r.y),s=i.next,a=r.prev;return i.next=r,r.prev=i,n.next=s,s.prev=n,o.next=n,n.prev=o,a.next=o,o.prev=a,o}function aT(i,r,n,o){var s=new aS(i,r,n);return o?(s.next=o.next,s.prev=o,o.next.prev=s,o.next=s):(s.prev=s,s.next=s),s}function aE(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function aS(i,r,n){this.i=i,this.x=r,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function aI(i,r,n,o){for(var s=0,a=r,l=n-o;ao;){if(s-o>600){var l=s-o+1,c=n-o+1,h=Math.log(l),u=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1);i(r,n,Math.max(o,Math.floor(n-c*u/l+d)),Math.min(s,Math.floor(n+(l-c)*u/l+d)),a)}var p=r[n],f=o,m=s;for(aA(r,o,n),a(r[s],p)>0&&aA(r,o,s);fa(r[f],p);)f++;for(;a(r[m],p)>0;)m--}0===a(r[o],p)?aA(r,o,m):aA(r,++m,s),m<=n&&(o=m+1),n<=m&&(s=m-1)}})(i,r,n||0,o||i.length-1,s||aC)}function aA(i,r,n){var o=i[r];i[r]=i[n],i[n]=o}function aC(i,r){return ir?1:0}function az(i,r){const n=i.length;if(n<=1)return[i];const o=[];let s,a;for(let l=0;l1)for(let h=0;h0&&n.holes.push(o+=i[s-1].length)}return n},ae.default=at;class aL{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new oo,this.indexArray=new og,this.indexArray2=new oE,this.programConfigurations=new o9(i.layers,i.zoom),this.segments=new sl,this.segments2=new sl,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){this.hasPattern=aP("fill",this.layers,r);const s=this.layers[0].layout.get("fill-sort-key"),a=[];for(const{feature:l,id:c,index:h,sourceLayerIndex:u}of i){const d=this.layers[0]._featureFilter.needGeometry,p=sS(l,d);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom),p,n))continue;const f=s?s.evaluate(p,{},n,r.availableImages):void 0,m={id:c,properties:l.properties,type:l.type,sourceLayerIndex:u,index:h,geometry:d?p.geometry:sE(l,n,o),patterns:{},sortKey:f};a.push(m)}for(const $ of(s&&a.sort((i,r)=>i.sortKey-r.sortKey),a)){const{geometry:g,index:y,sourceLayerIndex:x}=$;if(this.hasPattern){const v=aD("fill",this.layers,$,this.zoom,r);this.patternFeatures.push(v)}else this.addFeature($,g,y,n,{},r.availableImages);r.featureIndex.insert(i[y].feature,g,y,x,this.index)}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}addFeatures(i,r,n,o){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,r,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,s7),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),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(i,r,n,o,s,a=[]){for(const l of az(r,500)){let c=0;for(const h of l)c+=h.length;const u=this.segments.prepareSegment(c,this.layoutVertexArray,this.indexArray),d=u.vertexLength,p=[],f=[];for(const m of l){if(0===m.length)continue;m!==l[0]&&f.push(p.length/2);const $=this.segments2.prepareSegment(m.length,this.layoutVertexArray,this.indexArray2),g=$.vertexLength;this.layoutVertexArray.emplaceBack(m[0].x,m[0].y),this.indexArray2.emplaceBack(g+m.length-1,g),p.push(m[0].x),p.push(m[0].y);for(let y=1;y>3}if(s--,1===o||2===o)a+=i.readSVarint(),c+=i.readSVarint(),1===o&&(r&&h.push(r),r=[]),r.push(new l(a,c));else{if(7!==o)throw Error("unknown command "+o);r&&r.push(r[0].clone())}}return r&&h.push(r),h},aN.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var r=i.readVarint()+i.pos,n=1,o=0,s=0,a=0,l=1/0,c=-1/0,h=1/0,u=-1/0;i.pos>3}if(o--,1===n||2===n)(s+=i.readSVarint())c&&(c=s),(a+=i.readSVarint())u&&(u=a);else if(7!==n)throw Error("unknown command "+n)}return[l,h,c,u]},aN.prototype.toGeoJSON=function(i,r,n){var o,s,a=this.extent*Math.pow(2,n),l=this.extent*i,c=this.extent*r,h=this.loadGeometry(),u=aN.types[this.type];function d(i){for(var r=0;r>3;r=1===o?i.readString():2===o?i.readFloat():3===o?i.readDouble():4===o?i.readVarint64():5===o?i.readVarint():6===o?i.readSVarint():7===o?i.readBoolean():null}return r}(n))}function aX(i,r,n){if(3===i){var o=new aZ(n,n.readVarint()+n.pos);o.length&&(r[o.name]=o)}}a_.prototype.feature=function(i){if(i<0||i>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new aV(this._pbf,r,this.extent,this._keys,this._values)};var aW={VectorTile:function(i,r){this.layers=i.readFields(aX,{},r)},VectorTileFeature:aV,VectorTileLayer:aZ};const aH=aW.VectorTileFeature.types;function aK(i,r,n,o,s,a,l,c){i.emplaceBack((r<<1)+l,(n<<1)+a,(Math.floor(8192*o)<<1)+s,Math.round(c))}class aY{constructor(){this.acc=new l(0,0),this.polyCount=[]}startRing(i){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new l(i.x,i.y),this.max=new l(i.x,i.y))}append(i,r){this.currentPolyCount.edges++,this.acc._add(i);let n=!!this.borders;const o=this.min,s=this.max;i.xs.x&&(s.x=i.x,n=!0),i.ys.y&&(s.y=i.y,n=!0),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),n&&this.checkBorderIntersection(i,r)}checkBorderIntersection(i,r){r.x<0!=i.x<0&&this.addBorderIntersection(0,ix(r.y,i.y,(0-r.x)/(i.x-r.x))),r.x>8192!=i.x>8192&&this.addBorderIntersection(1,ix(r.y,i.y,(8192-r.x)/(i.x-r.x))),r.y<0!=i.y<0&&this.addBorderIntersection(2,ix(r.x,i.x,(0-r.y)/(i.y-r.y))),r.y>8192!=i.y>8192&&this.addBorderIntersection(3,ix(r.x,i.x,(8192-r.y)/(i.y-r.y)))}addBorderIntersection(i,r){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 n=this.borders[i];rn[1]&&(n[1]=r)}processBorderOverlap(i,r){if(i.x===r.x){if(i.y===r.y)return;const n=0===i.x?0:1;this.addBorderIntersection(n,r.y),this.addBorderIntersection(n,i.y)}else{const o=0===i.y?2:3;this.addBorderIntersection(o,r.x),this.addBorderIntersection(o,i.x)}}centroid(){const i=this.polyCount.reduce((i,r)=>i+r.edges,0);return 0!==i?this.acc.div(i)._round():new l(0,0)}span(){return new l(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((i,r)=>i+ +(r[0]!==Number.MAX_VALUE),0)}}class aJ{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new os,this.centroidVertexArray=new oU,this.indexArray=new og,this.programConfigurations=new o9(i.layers,i.zoom),this.segments=new sl,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.enableTerrain=i.enableTerrain}populate(i,r,n,o){for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of(this.features=[],this.hasPattern=aP("fill-extrusion",this.layers,r),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(i){const r=Math.exp(Math.PI*(1-i.y/(1<i.x<=0)||l.every(i=>i.x>=8192)||l.every(i=>i.y<=0)||l.every(i=>i.y>=8192))continue;for(let p=0;p=1){const y=f[$-1];if(!aQ(g,y)){c&&c.append(g,y),d.vertexLength+4>sl.MAX_VERTEX_ARRAY_LENGTH&&(d=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const x=g.sub(y)._perp(),v=x.x/(Math.abs(x.x)+Math.abs(x.y)),b=x.y>0?1:0,w=y.dist(g);m+w>32768&&(m=0),aK(this.layoutVertexArray,g.x,g.y,v,b,0,0,m),aK(this.layoutVertexArray,g.x,g.y,v,b,0,1,m),m+=w,aK(this.layoutVertexArray,y.x,y.y,v,b,0,0,m),aK(this.layoutVertexArray,y.x,y.y,v,b,0,1,m);const T=d.vertexLength;this.indexArray.emplaceBack(T,T+2,T+1),this.indexArray.emplaceBack(T+1,T+2,T+3),d.vertexLength+=4,d.primitiveLength+=2}}}}if(d.vertexLength+u>sl.MAX_VERTEX_ARRAY_LENGTH&&(d=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),"Polygon"!==aH[i.type])continue;const E=[],S=[],I=d.vertexLength;for(let M=0;M0){if(c.borders){c.vertexArrayOffset=this.centroidVertexArray.length;const D=c.borders,L=this.featuresOnBorder.push(c)-1;for(let B=0;B<4;B++)D[B][0]!==Number.MAX_VALUE&&this.borders[B].push(L)}this.encodeCentroid(c.borders?void 0:c.centroid(),c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,s,a,o)}sortBorders(){for(let i=0;i<4;i++)this.borders[i].sort((r,n)=>this.featuresOnBorder[r].borders[i][0]-this.featuresOnBorder[n].borders[i][0])}encodeCentroid(i,r,n=!0){let o,s;if(i){if(0!==i.y){const a=r.span()._mult(this.tileToMeter);o=(Math.max(i.x,1)<<3)+Math.min(7,Math.round(a.x/10)),s=(Math.max(i.y,1)<<3)+Math.min(7,Math.round(a.y/10))}else o=Math.ceil(7*(i.x+450)),s=0}else o=0,s=+n;let l=n?this.centroidVertexArray.length:r.vertexArrayOffset;for(const c of r.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*c.edges+c.top);for(let h=0;h<2*c.edges;h++)this.centroidVertexArray.emplace(l++,0,s),this.centroidVertexArray.emplace(l++,o,s);for(let u=0;u8192)||i.y===r.y&&(i.y<0||i.y>8192)}r4("FillExtrusionBucket",aJ,{omit:["layers","features"]}),r4("PartMetadata",aY);var a0={paint:new n9({"fill-extrusion-opacity":new n3(tu["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new n5(tu["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new n3(tu["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new n3(tu["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new n4(tu["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new n5(tu["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new n5(tu["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new n3(tu["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function a1(i,r){return i.x*r.x+i.y*r.y}function a2(i,r){if(1===i.length){let n=0;const o=r[n++];let s;for(;!s||o.equals(s);)if(!(s=r[n++]))return 1/0;for(;ni.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new oa,this.layoutVertexArray2=new ol,this.indexArray=new og,this.programConfigurations=new o9(i.layers,i.zoom),this.segments=new sl,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){this.hasPattern=aP("line",this.layers,r);const s=this.layers[0].layout.get("line-sort-key"),a=[];for(const{feature:l,id:c,index:h,sourceLayerIndex:u}of i){const d=this.layers[0]._featureFilter.needGeometry,p=sS(l,d);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom),p,n))continue;const f=s?s.evaluate(p,{},n):void 0,m={id:c,properties:l.properties,type:l.type,sourceLayerIndex:u,index:h,geometry:d?p.geometry:sE(l,n,o),patterns:{},sortKey:f};a.push(m)}s&&a.sort((i,r)=>i.sortKey-r.sortKey);const{lineAtlas:$,featureIndex:g}=r,y=this.addConstantDashes($);for(const x of a){const{geometry:v,index:b,sourceLayerIndex:w}=x;if(y&&this.addFeatureDashes(x,$),this.hasPattern){const T=aD("line",this.layers,x,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(x,v,b,n,$.positions,r.availableImages);g.insert(i[b].feature,v,b,w,this.index)}}addConstantDashes(i){let r=!1;for(const n of this.layers){const o=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"!==o.kind||"constant"!==s.kind)r=!0;else{const a=s.value,l=o.value;if(!l)continue;i.addDash(l.from,a),i.addDash(l.to,a),l.other&&i.addDash(l.other,a)}}return r}addFeatureDashes(i,r){const n=this.zoom;for(const o of this.layers){const s=o.paint.get("line-dasharray").value,a=o.layout.get("line-cap").value;if("constant"===s.kind&&"constant"===a.kind)continue;let l,c,h,u,d,p;if("constant"===s.kind){const f=s.value;if(!f)continue;l=f.other||f.to,c=f.to,h=f.from}else l=s.evaluate({zoom:n-1},i),c=s.evaluate({zoom:n},i),h=s.evaluate({zoom:n+1},i);"constant"===a.kind?u=d=p=a.value:(u=a.evaluate({zoom:n-1},i),d=a.evaluate({zoom:n},i),p=a.evaluate({zoom:n+1},i)),r.addDash(l,u),r.addDash(c,d),r.addDash(h,p);const m=r.getKey(l,u),$=r.getKey(c,d),g=r.getKey(h,p);i.patterns[o.id]={min:m,mid:$,max:g}}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}addFeatures(i,r,n,o){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,r,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,a9)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,a6),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&i.properties.hasOwnProperty("mapbox_clip_start")&&i.properties.hasOwnProperty("mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,r,n,o,s,a){const l=this.layers[0].layout,c=l.get("line-join").evaluate(i,{}),h=l.get("line-cap").evaluate(i,{}),u=l.get("line-miter-limit"),d=l.get("line-round-limit");for(const p of(this.lineClips=this.lineFeatureClips(i),r))this.addLine(p,i,c,h,u,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,s,a,o)}addLine(i,r,n,o,s,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let l=0;l=2&&i[h-1].equals(i[h-2]);)h--;let u=0;for(;u0;if(S&&x>u){const M=f.dist(m);if(M>2*d){const A=f.sub(f.sub(m)._mult(d/M)._round());this.updateDistance(m,A),this.addCurrentVertex(A,g,0,0,p),m=A}}const C=m&&$;let z=C?n:c?"butt":o;if(C&&"round"===z&&(Ts&&(z="bevel"),"bevel"===z&&(T>2&&(z="flipbevel"),T100)v=y.mult(-1);else{const k=T*g.add(y).mag()/g.sub(y).mag();v._perp()._mult(k*(I?-1:1))}this.addCurrentVertex(f,v,0,0,p),this.addCurrentVertex(f,v.mult(-1),0,0,p)}else if("bevel"===z||"fakeround"===z){const P=-Math.sqrt(T*T-1),D=I?P:0,L=I?0:P;if(m&&this.addCurrentVertex(f,g,D,L,p),"fakeround"===z){const B=Math.round(180*E/Math.PI/20);for(let R=1;R2*d){const j=f.add($.sub(f)._mult(d/N)._round());this.updateDistance(f,j),this.addCurrentVertex(j,y,0,0,p),f=j}}}}addCurrentVertex(i,r,n,o,s,a=!1){const l=r.y*o-r.x,c=-r.y-r.x*o;this.addHalfVertex(i,r.x+r.y*n,r.y-r.x*n,a,!1,n,s),this.addHalfVertex(i,l,c,a,!0,-o,s)}addHalfVertex({x:i,y:r},n,o,s,a,l,c){this.layoutVertexArray.emplaceBack((i<<1)+(s?1:0),(r<<1)+(a?1:0),Math.round(63*n)+128,Math.round(63*o)+128,1+(0===l?0:l<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineSoFar);const h=c.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,h),c.primitiveLength++),a?this.e2=h:this.e1=h}updateScaledDistance(){if(this.lineClips){const i=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=i*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(i,r){this.distance+=i.dist(r),this.updateScaledDistance()}}r4("LineBucket",lt,{omit:["layers","patternFeatures"]});const li=new n9({"line-cap":new n5(tu.layout_line["line-cap"]),"line-join":new n5(tu.layout_line["line-join"]),"line-miter-limit":new n3(tu.layout_line["line-miter-limit"]),"line-round-limit":new n3(tu.layout_line["line-round-limit"]),"line-sort-key":new n5(tu.layout_line["line-sort-key"])});var lr={paint:new n9({"line-opacity":new n5(tu.paint_line["line-opacity"]),"line-color":new n5(tu.paint_line["line-color"]),"line-translate":new n3(tu.paint_line["line-translate"]),"line-translate-anchor":new n3(tu.paint_line["line-translate-anchor"]),"line-width":new n5(tu.paint_line["line-width"]),"line-gap-width":new n5(tu.paint_line["line-gap-width"]),"line-offset":new n5(tu.paint_line["line-offset"]),"line-blur":new n5(tu.paint_line["line-blur"]),"line-dasharray":new n4(tu.paint_line["line-dasharray"]),"line-pattern":new n4(tu.paint_line["line-pattern"]),"line-gradient":new n8(tu.paint_line["line-gradient"])}),layout:li};const ln=new class extends n5{possiblyEvaluate(i,r){return r=new nH(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(i,r)}evaluate(i,r,n,o){return r=et({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,n,o)}}(lr.paint.properties["line-width"].specification);function lo(i,r){return r>0?r+2*i:i}ln.useIntegerZoom=!0;const ls=or([{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),la=or([{name:"a_projected_pos",components:3,type:"Float32"},],4);or([{name:"a_fade_opacity",components:1,type:"Uint32"},],4);const ll=or([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},]),lc=or([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},]);or([{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 lh=or([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},],4),lu=or([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"},],4);function ld(i,r){const{expression:n}=r;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new nH(i+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:o,interpolationType:s}=n;let a=0;for(;a{i.text=function(i,r,n){const o=r.layout.get("text-transform").evaluate(n,{});return"uppercase"===o?i=i.toLocaleUpperCase():"lowercase"===o&&(i=i.toLocaleLowerCase()),nW.applyArabicShaping&&(i=nW.applyArabicShaping(i)),i}(i.text,r,n)}),i}const lg={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","\xa2":"¢","\xa3":"£","\xa5":"¥","\xa6":"¦","\xac":"¬","\xaf":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function ly(i){return"︶"===i||"﹈"===i||"︸"===i||"﹄"===i||"﹂"===i||"︾"===i||"︼"===i||"︺"===i||"︘"===i||"﹀"===i||"︐"===i||"︓"===i||"︔"===i||"`"===i||" ̄"===i||"︑"===i||"︒"===i}function lx(i){return"︵"===i||"﹇"===i||"︷"===i||"﹃"===i||"﹁"===i||"︽"===i||"︻"===i||"︹"===i||"︗"===i||"︿"===i}var lv=function(i,r,n,o,s){var a,l,c=8*s-o-1,h=(1<>1,d=-7,p=n?s-1:0,f=n?-1:1,m=i[r+p];for(p+=f,a=m&(1<<-d)-1,m>>=-d,d+=c;d>0;a=256*a+i[r+p],p+=f,d-=8);for(l=a&(1<<-d)-1,a>>=-d,d+=o;d>0;l=256*l+i[r+p],p+=f,d-=8);if(0===a)a=1-u;else{if(a===h)return l?NaN:1/0*(m?-1:1);l+=Math.pow(2,o),a-=u}return(m?-1:1)*l*Math.pow(2,a-o)},lb=function(i,r,n,o,s,a){var l,c,h,u=8*a-s-1,d=(1<>1,f=23===s?5960464477539062e-23:0,m=o?0:a-1,$=o?1:-1,g=r<0||0===r&&1/r<0?1:0;for(isNaN(r=Math.abs(r))||r===1/0?(c=isNaN(r)?1:0,l=d):(l=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-l))<1&&(l--,h*=2),(r+=l+p>=1?f/h:f*Math.pow(2,1-p))*h>=2&&(l++,h/=2),l+p>=d?(c=0,l=d):l+p>=1?(c=(r*h-1)*Math.pow(2,s),l+=p):(c=r*Math.pow(2,p-1)*Math.pow(2,s),l=0));s>=8;i[n+m]=255&c,m+=$,c/=256,s-=8);for(l=l<0;i[n+m]=255&l,m+=$,l/=256,u-=8);i[n+m-$]|=128*g},lw=lT;function lT(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}lT.Varint=0,lT.Fixed64=1,lT.Bytes=2,lT.Fixed32=5;var lE="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function lS(i){return i.type===lT.Bytes?i.readVarint()+i.pos:i.pos+1}function lI(i,r,n){var o=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));n.realloc(o);for(var s=n.pos-1;s>=i;s--)n.buf[s+o]=n.buf[s]}function lM(i,r){for(var n=0;n>>8,i[n+2]=r>>>16,i[n+3]=r>>>24}function lO(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16)+(i[r+3]<<24)}function lU(i,r,n){r.glyphs=[],1===i&&n.readMessage(lV,r)}function lV(i,r,n){if(3===i){const{id:o,bitmap:s,width:a,height:l,left:c,top:h,advance:u}=n.readMessage(lN,{});r.glyphs.push({id:o,bitmap:new s3({width:a+6,height:l+6},s),metrics:{width:a,height:l,left:c,top:h,advance:u}})}else 4===i?r.ascender=n.readSVarint():5===i&&(r.descender=n.readSVarint())}function lN(i,r,n){1===i?r.id=n.readVarint():2===i?r.bitmap=n.readBytes():3===i?r.width=n.readVarint():4===i?r.height=n.readVarint():5===i?r.left=n.readSVarint():6===i?r.top=n.readSVarint():7===i&&(r.advance=n.readVarint())}function lj(i){let r=0,n=0;for(const o of i)r+=o.w*o.h,n=Math.max(n,o.w);i.sort((i,r)=>r.h-i.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),n),h:1/0},];let a=0,l=0;for(const c of i)for(let h=s.length-1;h>=0;h--){const u=s[h];if(!(c.w>u.w||c.h>u.h)){if(c.x=u.x,c.y=u.y,l=Math.max(l,c.y+c.h),a=Math.max(a,c.x+c.w),c.w===u.w&&c.h===u.h){const d=s.pop();h>3,a=this.pos;this.type=7&o,i(s,r,this),this.pos===a&&this.skip(o)}return r},readMessage:function(i,r){return this.readFields(i,r,this.readVarint()+this.pos)},readFixed32:function(){var i=lR(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=lO(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=lR(this.buf,this.pos)+4294967296*lR(this.buf,this.pos+4);return this.pos+=8,i},readSFixed64:function(){var i=lR(this.buf,this.pos)+4294967296*lO(this.buf,this.pos+4);return this.pos+=8,i},readFloat:function(){var i=lv(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=lv(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var r,n,o=this.buf;return r=127&(n=o[this.pos++]),n<128?r:(r|=(127&(n=o[this.pos++]))<<7,n<128?r:(r|=(127&(n=o[this.pos++]))<<14,n<128?r:(r|=(127&(n=o[this.pos++]))<<21,n<128?r:function(i,r,n){var o,s,a,l,c=n.buf;if(a=(112&(l=c[n.pos++]))>>4,l<128||(a|=(127&(l=c[n.pos++]))<<3,l<128)||(a|=(127&(l=c[n.pos++]))<<10,l<128)||(a|=(127&(l=c[n.pos++]))<<17,l<128)||(a|=(127&(l=c[n.pos++]))<<24,l<128)||(a|=(1&(l=c[n.pos++]))<<31,l<128))return o=i,s=a,r?4294967296*s+(o>>>0):4294967296*(s>>>0)+(o>>>0);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(n=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?-((i+1)/2):i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i,r,n,o=this.readVarint()+this.pos,s=this.pos;return this.pos=o,o-s>=12&&lE?(i=this.buf,r=s,n=o,lE.decode(i.subarray(r,n))):function(i,r,n){for(var o="",s=r;s239?4:h>223?3:h>191?2:1;if(s+d>n)break;1===d?h<128&&(u=h):2===d?128==(192&(a=i[s+1]))&&(u=(31&h)<<6|63&a)<=127&&(u=null):3===d?(l=i[s+2],128==(192&(a=i[s+1]))&&128==(192&l)&&((u=(15&h)<<12|(63&a)<<6|63&l)<=2047||u>=55296&&u<=57343)&&(u=null)):4===d&&(l=i[s+2],c=i[s+3],128==(192&(a=i[s+1]))&&128==(192&l)&&128==(192&c)&&((u=(15&h)<<18|(63&a)<<12|(63&l)<<6|63&c)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,d=1):u>65535&&(u-=65536,o+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),o+=String.fromCharCode(u),s+=d}return o}(this.buf,s,o)},readBytes:function(){var i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r},readPackedVarint:function(i,r){if(this.type!==lT.Bytes)return i.push(this.readVarint(r));var n=lS(this);for(i=i||[];this.pos127;);else if(r===lT.Bytes)this.pos=this.readVarint()+this.pos;else if(r===lT.Fixed32)this.pos+=4;else{if(r!==lT.Fixed64)throw Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(i,r){this.writeVarint(i<<3|r)},realloc:function(i){for(var r=this.length||16;r268435455||i<0?function(i,r){var n,o,s,a,l,c,h;if(i>=0?(n=i%4294967296|0,o=i/4294967296|0):(o=~(-i/4294967296),4294967295^(n=~(-i%4294967296))?n=n+1|0:(n=0,o=o+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");r.realloc(10),s=n,(a=r).buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,a.buf[a.pos]=127&(s>>>=7),l=o,c=r,h=(7&l)<<4,c.buf[c.pos++]|=h|((l>>>=3)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l)))))}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?-(2*i)-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var r=this.pos;this.pos=function(i,r,n){for(var o,s,a=0;a55295&&o<57344){if(!s){o>56319||a+1===r.length?(i[n++]=239,i[n++]=191,i[n++]=189):s=o;continue}if(o<56320){i[n++]=239,i[n++]=191,i[n++]=189,s=o;continue}o=s-55296<<10|o-56320|65536,s=null}else s&&(i[n++]=239,i[n++]=191,i[n++]=189,s=null);o<128?i[n++]=o:(o<2048?i[n++]=o>>6|192:(o<65536?i[n++]=o>>12|224:(i[n++]=o>>18|240,i[n++]=o>>12&63|128),i[n++]=o>>6&63|128),i[n++]=63&o|128)}return n}(this.buf,i,this.pos);var n=this.pos-r;n>=128&&lI(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeFloat:function(i){this.realloc(4),lb(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),lb(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var r=i.length;this.writeVarint(r),this.realloc(r);for(var n=0;n=128&&lI(n,o,this),this.pos=n-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,r,n){this.writeTag(i,lT.Bytes),this.writeRawMessage(r,n)},writePackedVarint:function(i,r){r.length&&this.writeMessage(i,lM,r)},writePackedSVarint:function(i,r){r.length&&this.writeMessage(i,lA,r)},writePackedBoolean:function(i,r){r.length&&this.writeMessage(i,lk,r)},writePackedFloat:function(i,r){r.length&&this.writeMessage(i,lC,r)},writePackedDouble:function(i,r){r.length&&this.writeMessage(i,lz,r)},writePackedFixed32:function(i,r){r.length&&this.writeMessage(i,lP,r)},writePackedSFixed32:function(i,r){r.length&&this.writeMessage(i,lD,r)},writePackedFixed64:function(i,r){r.length&&this.writeMessage(i,lL,r)},writePackedSFixed64:function(i,r){r.length&&this.writeMessage(i,lB,r)},writeBytesField:function(i,r){this.writeTag(i,lT.Bytes),this.writeBytes(r)},writeFixed32Field:function(i,r){this.writeTag(i,lT.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(i,r){this.writeTag(i,lT.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(i,r){this.writeTag(i,lT.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(i,r){this.writeTag(i,lT.Fixed64),this.writeSFixed64(r)},writeVarintField:function(i,r){this.writeTag(i,lT.Varint),this.writeVarint(r)},writeSVarintField:function(i,r){this.writeTag(i,lT.Varint),this.writeSVarint(r)},writeStringField:function(i,r){this.writeTag(i,lT.Bytes),this.writeString(r)},writeFloatField:function(i,r){this.writeTag(i,lT.Fixed32),this.writeFloat(r)},writeDoubleField:function(i,r){this.writeTag(i,lT.Fixed64),this.writeDouble(r)},writeBooleanField:function(i,r){this.writeVarintField(i,Boolean(r))}};class lG{constructor(i,{pixelRatio:r,version:n,stretchX:o,stretchY:s,content:a}){this.paddedRect=i,this.pixelRatio=r,this.stretchX=o,this.stretchY=s,this.content=a,this.version=n}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 lZ{constructor(i,r){const n={},o={};this.haveRenderCallbacks=[];const s=[];this.addImages(i,n,s),this.addImages(r,o,s);const{w:a,h:l}=lj(s),c=new s5({width:a||1,height:l||1});for(const h in i){const u=i[h],d=n[h].paddedRect;s5.copy(u.data,c,{x:0,y:0},{x:d.x+1,y:d.y+1},u.data)}for(const p in r){const f=r[p],m=o[p].paddedRect,$=m.x+1,g=m.y+1,y=f.data.width,x=f.data.height;s5.copy(f.data,c,{x:0,y:0},{x:$,y:g},f.data),s5.copy(f.data,c,{x:0,y:x-1},{x:$,y:g-1},{width:y,height:1}),s5.copy(f.data,c,{x:0,y:0},{x:$,y:g+x},{width:y,height:1}),s5.copy(f.data,c,{x:y-1,y:0},{x:$-1,y:g},{width:1,height:x}),s5.copy(f.data,c,{x:0,y:0},{x:$+y,y:g},{width:1,height:x})}this.image=c,this.iconPositions=n,this.patternPositions=o}addImages(i,r,n){for(const o in i){const s=i[o],a={x:0,y:0,w:s.data.width+2,h:s.data.height+2};n.push(a),r[o]=new lG(a,s),s.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(i,r){for(const n in i.dispatchRenderCallbacks(this.haveRenderCallbacks),i.updatedImages)this.patchUpdatedImage(this.iconPositions[n],i.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],i.getImage(n),r)}patchUpdatedImage(i,r,n){if(!i||!r||i.version===r.version)return;i.version=r.version;const[o,s]=i.tl;n.update(r.data,void 0,{x:o,y:s})}}r4("ImagePosition",lG),r4("ImageAtlas",lZ);const l_={horizontal:1,vertical:2,horizontalOnly:3};class lq{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(i,r){const n=new lq;return n.scale=i||1,n.fontStack=r,n}static forImage(i){const r=new lq;return r.imageName=i,r}}class lX{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,r){const n=new lX;for(let o=0;o=0&&o>=i&&lH[this.text.charCodeAt(o)];o--)n--;this.text=this.text.substring(i,n),this.sectionIndex=this.sectionIndex.slice(i,n)}substring(i,r){const n=new lX;return n.text=this.text.substring(i,r),n.sectionIndex=this.sectionIndex.slice(i,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,r)=>Math.max(i,this.sections[r].scale),0)}addTextSection(i,r){this.text+=i.text,this.sections.push(lq.forText(i.scale,i.fontStack||r));const n=this.sections.length-1;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function lW(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g){const y=lX.fromFeature(i,s);let x;p===l_.vertical&&y.verticalizePunctuation(f);const{processBidirectionalText:v,processStyledBidirectionalText:b}=nW;if(v&&1===y.sections.length){x=[];const w=v(y.toString(),l1(y,u,a,r,o,m,$));for(const T of w){const E=new lX;E.text=T,E.sections=y.sections;for(let S=0;S0&&q>z&&(z=q)}else{const X=n[L.fontStack];if(!X)continue;X[R]&&(U=X[R]);const W=r[L.fontStack];if(!W)continue;const H=W.glyphs[R];if(!H)continue;if(O=H.metrics,N=8203!==R?24:0,x){const K=void 0!==W.ascender?Math.abs(W.ascender):0,Y=void 0!==W.descender?Math.abs(W.descender):0,J=(K+Y)*F;k=0;let p=0;for(let f=0;f-n/2;){if(--l<0)return!1;c-=i[l].dist(a),a=i[l]}c+=i[l].dist(i[l+1]),l++;const h=[];let u=0;for(;co;)u-=h.shift().angleDelta;if(u>s)return!1;l++,c+=d.dist(p)}return!0}function l9(i){let r=0;for(let n=0;nu){const $=(u-h)/m,g=ix(p.x,f.x,$),y=ix(p.y,f.y,$),x=new l6(g,y,0,f.angleTo(p),d);return!l||l8(i,x,c,l,r)?x:void 0}h+=m}}function ci(i,r,n,o,s,a,l,c,h){const u=l7(o,a,l),d=ce(o,s),p=d*l,f=0===i[0].x||i[0].x===h||0===i[0].y||i[0].y===h;return r-p=0&&T=0&&E=0&&m+d<=p){const S=new l6(T,E,0,b,g);S._round(),s&&!l8(r,S,l,s,a)||$.push(S)}}f+=v}return h||$.length||c||($=i(r,f/2,o,s,a,l,c,!0,u)),$}(i,f?r/2*c%r:(d/2+2*a)*l*c%r,r,u,n,p,f,!1,h)}function cr(i,r,n,o,s){const a=[];for(let c=0;c=o&&f.x>=o||(p.x>=o?p=new l(o,p.y+(o-p.x)/(f.x-p.x)*(f.y-p.y))._round():f.x>=o&&(f=new l(o,p.y+(o-p.x)/(f.x-p.x)*(f.y-p.y))._round()),p.y>=s&&f.y>=s||(p.y>=s?p=new l(p.x+(s-p.y)/(f.y-p.y)*(f.x-p.x),s)._round():f.y>=s&&(f=new l(p.x+(s-p.y)/(f.y-p.y)*(f.x-p.x),s)._round()),u&&p.equals(u[u.length-1])||(u=[p],a.push(u)),u.push(f)))))}}return a}function cn(i,r,n,o,s,a,l,c,h){for(let u=r;u-1)a[++h]=c,l[h]=u,l[h+1]=1e20}for(let f=0,m=0;f{let o=this.entries[i];o||(o=this.entries[i]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=o.glyphs[r];if(void 0!==s)return void n(null,{stack:i,id:r,glyph:s});if(s=this._tinySDF(o,i,r))return o.glyphs[r]=s,void n(null,{stack:i,id:r,glyph:s});const a=Math.floor(r/256);if(256*a>65535)return void n(Error("glyphs > 65535 not supported"));if(o.ranges[a])return void n(null,{stack:i,id:r,glyph:s});let l=o.requests[a];l||(l=o.requests[a]=[],ca.loadGlyphRange(i,a,this.url,this.requestManager,(i,r)=>{if(r){for(const n in o.ascender=r.ascender,o.descender=r.descender,r.glyphs)this._doesCharSupportLocalGlyph(+n)||(o.glyphs[+n]=r.glyphs[+n]);o.ranges[a]=!0}for(const s of l)s(i,r);delete o.requests[a]})),l.push((o,s)=>{o?n(o):s&&n(null,{stack:i,id:r,glyph:s.glyphs[r]||null})})},(i,n)=>{if(i)r(i);else if(n){const o={};for(const{stack:s,id:a,glyph:l}of n)void 0===o[s]&&(o[s]={}),void 0===o[s].glyphs&&(o[s].glyphs={}),o[s].glyphs[a]=l&&{id:l.id,bitmap:l.bitmap.clone(),metrics:l.metrics},o[s].ascender=this.entries[s].ascender,o[s].descender=this.entries[s].descender;r(null,o)}})}_doesCharSupportLocalGlyph(i){return this.localGlyphMode!==cs.none&&(this.localGlyphMode===cs.all?!!this.localFontFamily:!!this.localFontFamily&&(ny(i)||nb(i)||nc(i)||nh(i))||nl(i))}_tinySDF(i,r,n){const o=this.localFontFamily;if(!o||!this._doesCharSupportLocalGlyph(n))return;let s=i.tinySDF;if(!s){let a="400";/bold/i.test(r)?a="900":/medium/i.test(r)?a="500":/light/i.test(r)&&(a="200"),(s=i.tinySDF=new ca.TinySDF({fontFamily:o,fontWeight:a,fontSize:48,buffer:6,radius:16})).fontWeight=a}if(this.localGlyphs[s.fontWeight][n])return this.localGlyphs[s.fontWeight][n];const l=String.fromCharCode(n),{data:c,width:h,height:u,glyphWidth:d,glyphHeight:p,glyphLeft:f,glyphTop:m,glyphAdvance:$}=s.draw(l);return this.localGlyphs[s.fontWeight][n]={id:n,bitmap:new s3({width:h,height:u},c),metrics:{width:d/2,height:p/2,left:f/2,top:m/2-27,advance:$/2,localGlyph:!0}}}}function cl(i,r,n,o){const s=[],a=i.image,c=a.pixelRatio,h=a.paddedRect.w-2,u=a.paddedRect.h-2,d=i.right-i.left,p=i.bottom-i.top,f=a.stretchX||[[0,h]],m=a.stretchY||[[0,u]],$=(i,r)=>i+r[1]-r[0],g=f.reduce($,0),y=m.reduce($,0),x=h-g,v=u-y;let b=0,w=g,T=0,E=y,S=0,I=x,M=0,A=v;if(a.content&&o){const C=a.content;b=cc(f,0,C[0]),T=cc(m,0,C[1]),w=cc(f,C[0],C[2]),E=cc(m,C[1],C[3]),S=C[0]-b,M=C[1]-T,I=C[2]-C[0]-w,A=C[3]-C[1]-E}const z=(o,s,h,u)=>{var f,m,$,x,v,C,z,k,P,D,L,B,R,F,O,U,V,N,j,G,Z,_,q,X,W,H,K,Y;const J=(f=o.stretch-b,m=w,$=d,f/m*$+i.left),Q=(x=o.fixed-S,v=I,C=o.stretch,z=g,x-v*C/z),ee=(k=s.stretch-T,P=E,D=p,k/P*D+i.top),et=(L=s.fixed-M,B=A,R=s.stretch,F=y,L-B*R/F),ei=(O=h.stretch-b,U=w,V=d,O/U*V+i.left),er=(N=h.fixed-S,j=I,G=h.stretch,Z=g,N-j*G/Z),en=(_=u.stretch-T,q=E,X=p,_/q*X+i.top),eo=(W=u.fixed-M,H=A,K=u.stretch,Y=y,W-H*K/Y),es=new l(J,ee),ea=new l(ei,ee),el=new l(ei,en),ec=new l(J,en),eh=new l(Q/c,et/c),eu=new l(er/c,eo/c),ed=r*Math.PI/180;if(ed){const ep=Math.sin(ed),ef=Math.cos(ed),em=[ef,-ep,ep,ef];es._matMult(em),ea._matMult(em),ec._matMult(em),el._matMult(em)}const e$=o.stretch+o.fixed,eg=s.stretch+s.fixed;return{tl:es,tr:ea,bl:ec,br:el,tex:{x:a.paddedRect.x+1+e$,y:a.paddedRect.y+1+eg,w:h.stretch+h.fixed-e$,h:u.stretch+u.fixed-eg},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:eh,pixelOffsetBR:eu,minFontScaleX:I/c/d,minFontScaleY:A/c/p,isSDF:n}};if(o&&(a.stretchX||a.stretchY)){const k=ch(f,x,g),P=ch(m,v,y);for(let D=0;D{if(i)s(i);else if(r){var n;const o={},a=(n=r,new lw(n).readFields(lU,{}));for(const l of a.glyphs)o[l.id]=l;s(null,{glyphs:o,ascender:a.ascender,descender:a.descender})}})},ca.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:n=8,cutoff:o=.25,fontFamily:s="sans-serif",fontWeight:a="normal",fontStyle:l="normal"}){this.buffer=r,this.cutoff=o,this.radius=n;const c=this.size=i+4*r,h=this._createCanvas(c),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${l} ${a} ${i}px ${s}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c)}_createCanvas(i){const r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){const{width:r,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:s,actualBoundingBoxRight:a}=this.ctx.measureText(i),l=Math.floor(n),c=Math.min(this.size-this.buffer,Math.ceil(a-s)),h=Math.min(this.size-this.buffer,Math.ceil(n)+Math.ceil(o)),u=c+2*this.buffer,d=h+2*this.buffer,p=u*d,f=new Uint8ClampedArray(p),m={data:f,width:u,height:d,glyphWidth:c,glyphHeight:h,glyphTop:l,glyphLeft:0,glyphAdvance:r};if(0===c||0===h)return m;const{ctx:$,buffer:g,gridInner:y,gridOuter:x}=this;$.clearRect(g,g,c,h),$.fillText(i,g,g+l+1);const v=$.getImageData(g,g,c,h);x.fill(1e20,0,p),y.fill(0,0,p);for(let b=0;b0?S*S:0,y[E]=S<0?S*S:0}}cn(x,0,0,u,d,u,this.f,this.v,this.z),cn(y,g,g,c,h,u,this.f,this.v,this.z);for(let I=0;Ir?1:0}){if(this.data=i,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const i=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:r,compare:n}=this,o=r[i];for(;i>0;){const s=i-1>>1,a=r[s];if(n(o,a)>=0)break;r[i]=a,i=s}r[i]=o}_down(i){const{data:r,compare:n}=this,o=this.length>>1,s=r[i];for(;in(r[c],l)&&(a=c,l=r[c]),n(l,s)>=0)break;r[i]=l,i=a}r[i]=s}}function cp(i,r=1,n=!1){let o=1/0,s=1/0,a=-1/0,c=-1/0;const h=i[0];for(let u=0;ua)&&(a=d.x),(!u||d.y>c)&&(c=d.y)}const p=Math.min(a-o,c-s);let f=p/2;const m=new cd([],cf);if(0===p)return new l(o,s);for(let $=o;$y.d||!y.d)&&(y=v,n&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,x)),v.max-y.d<=r||(f=v.h/2,m.push(new cm(v.p.x-f,v.p.y-f,f,i)),m.push(new cm(v.p.x+f,v.p.y-f,f,i)),m.push(new cm(v.p.x-f,v.p.y+f,f,i)),m.push(new cm(v.p.x+f,v.p.y+f,f,i)),x+=4)}return n&&(console.log(`num probes: ${x}`),console.log(`best distance: ${y.d}`)),y.p}function cf(i,r){return r.max-i.max}function cm(i,r,n,o){this.p=new l(i,r),this.h=n,this.d=function(i,r){let n=!1,o=1/0;for(let s=0;si.y!=d.y>i.y&&i.x<(d.x-u.x)*(i.y-u.y)/(d.y-u.y)+u.x&&(n=!n),o=Math.min(o,sB(i,u,d))}}return(n?1:-1)*Math.sqrt(o)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const c$=Number.POSITIVE_INFINITY,cg=Math.sqrt(2);function cy(i,r){return r[1]!==c$?function(i,r,n){let o=0,s=0;switch(r=Math.abs(r),n=Math.abs(n),i){case"top-right":case"top-left":case"top":s=n-7;break;case"bottom-right":case"bottom-left":case"bottom":s=7-n}switch(i){case"top-right":case"bottom-right":case"right":o=-r;break;case"top-left":case"bottom-left":case"left":o=r}return[o,s]}(i,r[0],r[1]):function(i,r){let n=0,o=0;r<0&&(r=0);const s=r/cg;switch(i){case"top-right":case"top-left":o=s-7;break;case"bottom-right":case"bottom-left":o=7-s;break;case"bottom":o=7-r;break;case"top":o=r-7}switch(i){case"top-right":case"bottom-right":n=-s;break;case"top-left":case"bottom-left":n=s;break;case"left":n=r;break;case"right":n=-r}return[n,o]}(i,r[0])}function cx(i,r,n,o,s,a,l,c,h,u){i.createArrays(),i.tilePixelRatio=8192/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;const d=i.layers[0].layout,p=i.layers[0]._unevaluatedLayout._values,f={};if("composite"===i.textSizeData.kind){const{minZoom:m,maxZoom:$}=i.textSizeData;f.compositeTextSizes=[p["text-size"].possiblyEvaluate(new nH(m),c),p["text-size"].possiblyEvaluate(new nH($),c),]}if("composite"===i.iconSizeData.kind){const{minZoom:g,maxZoom:y}=i.iconSizeData;f.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new nH(g),c),p["icon-size"].possiblyEvaluate(new nH(y),c),]}f.layoutTextSize=p["text-size"].possiblyEvaluate(new nH(h+1),c),f.layoutIconSize=p["icon-size"].possiblyEvaluate(new nH(h+1),c),f.textMaxSize=p["text-size"].possiblyEvaluate(new nH(18),c);const x="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),v=d.get("text-size");for(const b of i.features){const w=d.get("text-font").evaluate(b,{},c).join(","),T=v.evaluate(b,{},c),E=f.layoutTextSize.evaluate(b,{},c),S=(f.layoutIconSize.evaluate(b,{},c),{horizontal:{},vertical:void 0}),I=b.text;let M,A=[0,0];if(I){const C=I.toString(),z=24*d.get("text-letter-spacing").evaluate(b,{},c),k=24*d.get("text-line-height").evaluate(b,{},c),P=nz(C)?z:0,D=d.get("text-anchor").evaluate(b,{},c),L=d.get("text-variable-anchor");if(!L){const B=d.get("text-radial-offset").evaluate(b,{},c);A=B?cy(D,[24*B,c$]):d.get("text-offset").evaluate(b,{},c).map(i=>24*i)}let R=x?"center":d.get("text-justify").evaluate(b,{},c);const F=d.get("symbol-placement"),O="point"===F,U="point"===F?24*d.get("text-max-width").evaluate(b,{},c):0,V=o=>{i.allowVerticalPlacement&&nC(C)&&(S.vertical=lW(I,r,n,s,w,U,k,D,o,P,A,l_.vertical,!0,F,E,T))};if(!x&&L){const N="auto"===R?L.map(i=>cv(i)):[R];let j=!1;for(let G=0;G=0||!nC(C)){const q=lW(I,r,n,s,w,U,k,D,R,P,A,l_.horizontal,!1,F,E,T);q&&(S.horizontal[R]=q)}V("point"===F?"left":R)}}let X=!1;if(b.icon&&b.icon.name){const W=o[b.icon.name];W&&(M=l5(s[b.icon.name],d.get("icon-offset").evaluate(b,{},c),d.get("icon-anchor").evaluate(b,{},c)),X=W.sdf,void 0===i.sdfIcons?i.sdfIcons=W.sdf:i.sdfIcons!==W.sdf&&ep("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(W.pixelRatio!==i.pixelRatio||0!==d.get("icon-rotate").constantOr(1))&&(i.iconsNeedLinear=!0))}const H=cE(S.horizontal)||S.vertical;i.iconsInText||(i.iconsInText=!!H&&H.iconsInText),(H||M)&&cb(i,b,S,M,o,f,E,0,A,X,l,c,u)}a&&i.generateCollisionDebugBuffers(h,i.collisionBoxArray)}function cv(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function cb(i,r,n,o,s,a,l,c,h,u,d,p,f){let m=a.textMaxSize.evaluate(r,{},p);void 0===m&&(m=l);const $=i.layers[0].layout,g=$.get("icon-offset").evaluate(r,{},p),y=cE(n.horizontal)||n.vertical,x=l/24,v=i.tilePixelRatio*m/24,b=i.tilePixelRatio*$.get("symbol-spacing"),w=$.get("text-padding")*i.tilePixelRatio,T=$.get("icon-padding")*i.tilePixelRatio,E=$.get("text-max-angle")*j,S="map"===$.get("text-rotation-alignment")&&"point"!==$.get("symbol-placement"),I="map"===$.get("icon-rotation-alignment")&&"point"!==$.get("symbol-placement"),M=$.get("symbol-placement"),A=b/2,C=$.get("icon-text-fit");let z;o&&"none"!==C&&(i.allowVerticalPlacement&&n.vertical&&(z=l4(o,n.vertical,C,$.get("icon-text-fit-padding"),g,x)),y&&(o=l4(o,y,C,$.get("icon-text-fit-padding"),g,x)));const k=(l,c,m)=>{if(c.x<0||c.x>=8192||c.y<0||c.y>=8192)return;const{x:$,y:y,z:x}=f.projectTilePoint(c.x,c.y,m),v=new l6($,y,x,0,void 0);!function(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w,T,E,S,I){const M=i.addToLineVertexArray(r,o);let A,C,z,k,P,D,L,B=0,R=0,F=0,O=0,U=-1,V=-1;const N={};let j=oZ(""),G=0,Z=0;if(void 0===h._unevaluatedLayout.getValue("text-radial-offset")?[G,Z]=h.layout.get("text-offset").evaluate(w,{},I).map(i=>24*i):(G=24*h.layout.get("text-radial-offset").evaluate(w,{},I),Z=c$),i.allowVerticalPlacement&&s.vertical){const _=s.vertical;if($)D=cI(_),c&&(L=cI(c));else{const q=h.layout.get("text-rotate").evaluate(w,{},I)+90;z=cS(u,n,r,d,p,f,_,m,q,g),c&&(k=cS(u,n,r,d,p,f,c,x,q))}}if(a){const X=h.layout.get("icon-rotate").evaluate(w,{},I),W="none"!==h.layout.get("icon-text-fit"),H=cl(a,X,E,W),K=c?cl(c,X,E,W):void 0;C=cS(u,n,r,d,p,f,a,x,X),B=4*H.length;const Y=i.iconSizeData;let J=null;"source"===Y.kind?(J=[128*h.layout.get("icon-size").evaluate(w,{},I),])[0]>cw&&ep(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===Y.kind&&((J=[128*T.compositeIconSizes[0].evaluate(w,{},I),128*T.compositeIconSizes[1].evaluate(w,{},I),])[0]>cw||J[1]>cw)&&ep(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),i.addSymbols(i.icon,H,J,b,v,w,!1,n,r,M.lineStartIndex,M.lineLength,-1,S,I),U=i.icon.placedSymbolArray.length-1,K&&(R=4*K.length,i.addSymbols(i.icon,K,J,b,v,w,l_.vertical,n,r,M.lineStartIndex,M.lineLength,-1,S,I),V=i.icon.placedSymbolArray.length-1)}for(const Q in s.horizontal){const ee=s.horizontal[Q];A||(j=oZ(ee.text),$?P=cI(ee):A=cS(u,n,r,d,p,f,ee,m,h.layout.get("text-rotate").evaluate(w,{},I),g));const et=1===ee.positionedLines.length;if(F+=cT(i,n,r,ee,l,h,$,w,g,M,s.vertical?l_.horizontal:l_.horizontalOnly,et?Object.keys(s.horizontal):[Q],N,U,T,S,I),et)break}s.vertical&&(O+=cT(i,n,r,s.vertical,l,h,$,w,g,M,l_.vertical,["vertical"],N,V,T,S,I));let ei=-1;const er=(i,r)=>i?Math.max(i,r):r;ei=er(P,ei),ei=er(D,ei),ei=er(L,ei);const en=ei>-1?1:0;i.glyphOffsetArray.length>=cB.MAX_GLYPHS&&ep("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&i.addToSortKeyRanges(i.symbolInstances.length,w.sortKey),i.symbolInstances.emplaceBack(n.x,n.y,n.z,r.x,r.y,N.right>=0?N.right:-1,N.center>=0?N.center:-1,N.left>=0?N.left:-1,N.vertical>=0?N.vertical:-1,U,V,j,void 0!==A?A:i.collisionBoxArray.length,void 0!==A?A+1:i.collisionBoxArray.length,void 0!==z?z:i.collisionBoxArray.length,void 0!==z?z+1:i.collisionBoxArray.length,void 0!==C?C:i.collisionBoxArray.length,void 0!==C?C+1:i.collisionBoxArray.length,k||i.collisionBoxArray.length,k?k+1:i.collisionBoxArray.length,d,F,O,B,R,en,0,G,Z,ei)}(i,c,v,l,n,o,s,z,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,w,S,h,0,T,I,g,r,a,u,d,p)};if("line"===M)for(const P of cr(r.geometry,0,0,8192,8192)){const D=ci(P,b,E,n.vertical||y,o,24,v,i.overscaling,8192);for(const L of D){const B=y;B&&cM(i,B.text,A,L)||k(P,L,p)}}else if("line-center"===M){for(const R of r.geometry)if(R.length>1){const F=ct(R,E,n.vertical||y,o,24,v);F&&k(R,F,p)}}else if("Polygon"===r.type)for(const O of az(r.geometry,0)){const U=cp(O,16);k(O[0],new l6(U.x,U.y,0,0,void 0),p)}else if("LineString"===r.type)for(const V of r.geometry)k(V,new l6(V[0].x,V[0].y,0,0,void 0),p);else if("Point"===r.type)for(const N of r.geometry)for(const G of N)k([G],new l6(G.x,G.y,0,0,void 0),p)}const cw=32640;function cT(i,r,n,o,s,a,c,h,u,d,p,f,m,$,g,y,x){const v=function(i,r,n,o,s,a,c,h){const u=[];if(0===r.positionedLines.length)return u;const d=o.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,p=function(i){const r=i[0],n=i[1],o=r*n;return o>0?[r,-n]:o<0?[-r,n]:0===r?[n,r]:[n,-r]}(n);let f=Math.abs(r.top-r.bottom);for(const m of r.positionedLines)f-=m.lineOffset;const $=r.positionedLines.length,g=f/$;let y=r.top-n[1];for(let x=0;x<$;++x){const v=r.positionedLines[x];for(const b of(y=cu(r,g,y,x),v.positionedGlyphs)){if(!b.rect)continue;const w=b.rect||{};let T=4,E=!0,S=1,I=0;if(b.imageName){const M=c[b.imageName];if(!M)continue;if(M.sdf){ep("SDF images are not supported in formatted text and will be ignored.");continue}E=!1,T=1/(S=M.pixelRatio)}const A=(s||h)&&b.vertical,C=b.metrics.advance*b.scale/2,z=b.metrics,k=b.rect;if(null===k)continue;h&&r.verticalizable&&(I=b.imageName?C-b.metrics.width*b.scale/2:0);const P=s?[b.x+C,b.y]:[0,0];let D=[0,0],L=[0,0],B=!1;s||(A?(L=[b.x+C+p[0],b.y+p[1]-I,],B=!0):D=[b.x+C+n[0],b.y+n[1]-I,]);const R=k.w*b.scale/(S*(b.localGlyph?2:1)),F=k.h*b.scale/(S*(b.localGlyph?2:1));let O,U,V,N;if(A){const j=b.y-y,G=new l(-C,C-j),Z=-Math.PI/2,_=new l(...L);(O=new l(-C+D[0],D[1]))._rotateAround(Z,G)._add(_),O.x+=-j+C,O.y-=(z.left-T)*b.scale;const q=b.imageName?z.advance*b.scale:24*b.scale,X=String.fromCharCode(b.glyph);ly(X)?O.x+=(1-T)*b.scale:lx(X)?O.x+=q-z.height*b.scale+(-T-1)*b.scale:O.x+=b.imageName||z.width+2*T===k.w&&z.height+2*T===k.h?(q-F)/2:(q-(z.height+2*T)*b.scale)/2,U=new l(O.x,O.y-R),V=new l(O.x+F,O.y),N=new l(O.x+F,O.y-R)}else{const W=(z.left-T)*b.scale-C+D[0],H=(-z.top-T)*b.scale+D[1],K=W+R,Y=H+F;O=new l(W,H),U=new l(K,H),V=new l(W,Y),N=new l(K,Y)}if(d){let J;J=s?new l(0,0):B?new l(p[0],p[1]):new l(n[0],n[1]),O._rotateAround(d,J),U._rotateAround(d,J),V._rotateAround(d,J),N._rotateAround(d,J)}const Q=new l(0,0),ee=new l(0,0);u.push({tl:O,tr:U,bl:V,br:N,tex:w,writingMode:r.writingMode,glyphOffset:P,sectionIndex:b.sectionIndex,isSDF:E,pixelOffsetTL:Q,pixelOffsetBR:ee,minFontScaleX:0,minFontScaleY:0})}}return u}(0,o,u,a,c,h,s,i.allowVerticalPlacement),b=i.textSizeData;let w=null;for(const T of("source"===b.kind?(w=[128*a.layout.get("text-size").evaluate(h,{},x),])[0]>cw&&ep(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===b.kind&&((w=[128*g.compositeTextSizes[0].evaluate(h,{},x),128*g.compositeTextSizes[1].evaluate(h,{},x),])[0]>cw||w[1]>cw)&&ep(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),i.addSymbols(i.text,v,w,u,c,h,p,r,n,d.lineStartIndex,d.lineLength,$,y,x),f))m[T]=i.text.placedSymbolArray.length-1;return 4*v.length}function cE(i){for(const r in i)return i[r];return null}function cS(i,r,n,o,s,a,c,h,u,d){let p=c.top,f=c.bottom,m=c.left,$=c.right;const g=c.collisionPadding;if(g&&(m-=g[0],p-=g[1],$+=g[2],f+=g[3]),u){const y=new l(m,p),x=new l($,p),v=new l(m,f),b=new l($,f),w=u*j;let T=new l(0,0);d&&(T=new l(d[0],d[1])),y._rotateAround(w,T),x._rotateAround(w,T),v._rotateAround(w,T),b._rotateAround(w,T),m=Math.min(y.x,x.x,v.x,b.x),$=Math.max(y.x,x.x,v.x,b.x),p=Math.min(y.y,x.y,v.y,b.y),f=Math.max(y.y,x.y,v.y,b.y)}return i.emplaceBack(r.x,r.y,r.z,n.x,n.y,m,p,$,f,h,o,s,a),i.length-1}function cI(i){i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);const r=i.bottom-i.top;return r>0?Math.max(10,r):null}function cM(i,r,n,o){const s=i.compareText;if(r in s){const a=s[r];for(let l=a.length-1;l>=0;l--)if(o.dist(a[l])i.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=p([]),this.placementViewportMatrix=p([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ld(this.zoom,r["text-size"]),this.iconSizeData=ld(this.zoom,r["icon-size"]);const n=this.layers[0].layout,o=n.get("symbol-sort-key"),s=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==s&&void 0!==o.constantOr(1),this.sortFeaturesByY=("viewport-y"===s||"auto"===s&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(i=>l_[i]),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.sourceID=i.sourceID}createArrays(){this.text=new cD(new o9(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new cD(new o9(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new oL,this.lineVertexArray=new oB,this.symbolInstances=new oD}calculateGlyphDependencies(i,r,n,o,s){for(let a=0;a0)&&("constant"!==l.value.kind||l.value.value.length>0),d="constant"!==h.value.kind||!!h.value.value||Object.keys(h.parameters).length>0,p=a.get("symbol-sort-key");if(this.features=[],!u&&!d)return;const f=r.iconDependencies,m=r.glyphDependencies,$=r.availableImages,g=new nH(this.zoom);for(const{feature:y,id:x,index:v,sourceLayerIndex:b}of i){const w=s._featureFilter.needGeometry,T=sS(y,w);if(!s._featureFilter.filter(g,T,n))continue;let E,S;if(w||(T.geometry=sE(y,n,o)),u){const I=s.getValueAndResolveTokens("text-field",T,n,$),M=tV.factory(I);cP(M)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nq()||this.hasRTLText&&nW.isParsed())&&(E=l$(M,s,T))}if(d){const A=s.getValueAndResolveTokens("icon-image",T,n,$);S=A instanceof tN?A:tN.fromString(A)}if(!E&&!S)continue;const C=this.sortFeaturesByKey?p.evaluate(T,{},n):void 0;if(this.features.push({id:x,text:E,icon:S,index:v,sourceLayerIndex:b,geometry:T.geometry,properties:y.properties,type:cA[y.type],sortKey:C}),S&&(f[S.name]=!0),E){const z=l.evaluate(T,{},n).join(","),k="map"===a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");for(const P of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(l_.vertical)>=0,E.sections))if(P.image)f[P.image.name]=!0;else{const D=nC(E.toString()),L=P.fontStack||z,B=m[L]=m[L]||{};this.calculateGlyphDependencies(P.text,B,k,this.allowVerticalPlacement,D)}}}"line"===a.get("symbol-placement")&&(this.features=function(i){const r={},n={},o=[];let s=0;function a(r){o.push(i[r]),s++}function l(i,r,s){const a=n[i];return delete n[i],n[r]=a,o[a].geometry[0].pop(),o[a].geometry[0]=o[a].geometry[0].concat(s[0]),a}function c(i,n,s){const a=r[n];return delete r[n],r[i]=a,o[a].geometry[0].shift(),o[a].geometry[0]=s[0].concat(o[a].geometry[0]),a}function h(i,r,n){const o=n?r[0][r[0].length-1]:r[0][0];return`${i}:${o.x}:${o.y}`}for(let u=0;ui.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((i,r)=>i.sortKey-r.sortKey)}update(i,r,n,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,r,this.layers,n,o),this.icon.programConfigurations.updatePaintArrays(i,r,this.layers,n,o))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,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(i,r){const n=this.lineVertexArray.length;if(void 0!==i.segment){let o=i.dist(r[i.segment+1]),s=i.dist(r[i.segment]);const a={};for(let l=i.segment+1;l=0;c--)a[c]={x:r[c].x,y:r[c].y,tileUnitDistanceFromAnchor:s},c>0&&(s+=r[c-1].dist(r[c]));for(let h=0;h=0?r.rightJustifiedTextSymbolIndex:r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.leftJustifiedTextSymbolIndex>=0?r.leftJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex>=0?r.verticalPlacedTextSymbolIndex:o),a=lp(this.textSizeData,i,s)/24;return this.tilePixelRatio*a}getSymbolInstanceIconSize(i,r,n){const o=this.icon.placedSymbolArray.get(n),s=lp(this.iconSizeData,i,o);return this.tilePixelRatio*s}_commitDebugCollisionVertexUpdate(i,r,n){i.emplaceBack(r,-n,-n),i.emplaceBack(r,n,-n),i.emplaceBack(r,n,n),i.emplaceBack(r,-n,n)}_updateTextDebugCollisionBoxes(i,r,n,o,s,a){for(let l=o;l0}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(i,r){const n=i.placedSymbolArray.get(r),o=n.vertexStartIndex+4*n.numGlyphs;for(let s=n.vertexStartIndex;so[i]-o[r]||s[r]-s[i]),a}addToSortKeyRanges(i,r){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(const r of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){const n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex,].forEach((i,r,n)=>{i>=0&&n.indexOf(i)===r&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}r4("SymbolBucket",cB,{omit:["layers","collisionBoxArray","features","compareText",]}),cB.MAX_GLYPHS=65535,cB.addDynamicAttributes=ck;const cR=new n9({"symbol-placement":new n3(tu.layout_symbol["symbol-placement"]),"symbol-spacing":new n3(tu.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new n3(tu.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new n5(tu.layout_symbol["symbol-sort-key"]),"symbol-z-order":new n3(tu.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new n3(tu.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new n3(tu.layout_symbol["icon-ignore-placement"]),"icon-optional":new n3(tu.layout_symbol["icon-optional"]),"icon-rotation-alignment":new n3(tu.layout_symbol["icon-rotation-alignment"]),"icon-size":new n5(tu.layout_symbol["icon-size"]),"icon-text-fit":new n3(tu.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new n3(tu.layout_symbol["icon-text-fit-padding"]),"icon-image":new n5(tu.layout_symbol["icon-image"]),"icon-rotate":new n5(tu.layout_symbol["icon-rotate"]),"icon-padding":new n3(tu.layout_symbol["icon-padding"]),"icon-keep-upright":new n3(tu.layout_symbol["icon-keep-upright"]),"icon-offset":new n5(tu.layout_symbol["icon-offset"]),"icon-anchor":new n5(tu.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new n3(tu.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new n3(tu.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new n3(tu.layout_symbol["text-rotation-alignment"]),"text-field":new n5(tu.layout_symbol["text-field"]),"text-font":new n5(tu.layout_symbol["text-font"]),"text-size":new n5(tu.layout_symbol["text-size"]),"text-max-width":new n5(tu.layout_symbol["text-max-width"]),"text-line-height":new n5(tu.layout_symbol["text-line-height"]),"text-letter-spacing":new n5(tu.layout_symbol["text-letter-spacing"]),"text-justify":new n5(tu.layout_symbol["text-justify"]),"text-radial-offset":new n5(tu.layout_symbol["text-radial-offset"]),"text-variable-anchor":new n3(tu.layout_symbol["text-variable-anchor"]),"text-anchor":new n5(tu.layout_symbol["text-anchor"]),"text-max-angle":new n3(tu.layout_symbol["text-max-angle"]),"text-writing-mode":new n3(tu.layout_symbol["text-writing-mode"]),"text-rotate":new n5(tu.layout_symbol["text-rotate"]),"text-padding":new n3(tu.layout_symbol["text-padding"]),"text-keep-upright":new n3(tu.layout_symbol["text-keep-upright"]),"text-transform":new n5(tu.layout_symbol["text-transform"]),"text-offset":new n5(tu.layout_symbol["text-offset"]),"text-allow-overlap":new n3(tu.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new n3(tu.layout_symbol["text-ignore-placement"]),"text-optional":new n3(tu.layout_symbol["text-optional"])});var cF={paint:new n9({"icon-opacity":new n5(tu.paint_symbol["icon-opacity"]),"icon-color":new n5(tu.paint_symbol["icon-color"]),"icon-halo-color":new n5(tu.paint_symbol["icon-halo-color"]),"icon-halo-width":new n5(tu.paint_symbol["icon-halo-width"]),"icon-halo-blur":new n5(tu.paint_symbol["icon-halo-blur"]),"icon-translate":new n3(tu.paint_symbol["icon-translate"]),"icon-translate-anchor":new n3(tu.paint_symbol["icon-translate-anchor"]),"text-opacity":new n5(tu.paint_symbol["text-opacity"]),"text-color":new n5(tu.paint_symbol["text-color"],{runtimeType:tT,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new n5(tu.paint_symbol["text-halo-color"]),"text-halo-width":new n5(tu.paint_symbol["text-halo-width"]),"text-halo-blur":new n5(tu.paint_symbol["text-halo-blur"]),"text-translate":new n3(tu.paint_symbol["text-translate"]),"text-translate-anchor":new n3(tu.paint_symbol["text-translate-anchor"])}),layout:cR};class cO{constructor(i){this.type=i.property.overrides?i.property.overrides.runtimeType:tx,this.defaultValue=i}evaluate(i){if(i.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(i.formattedSection))return r.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}r4("FormatSectionOverride",cO,{omit:["defaultValue"]});class cU extends so{constructor(i){super(i,cF)}recalculate(i,r){super.recalculate(i,r),"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 n=this.layout.get("text-writing-mode");if(n){const o=[];for(const s of n)0>o.indexOf(s)&&o.push(s);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(i,r,n,o){var s;const a=this.layout.get(i).evaluate(r,{},n,o),l=this._unevaluatedLayout._values[i];return l.isDataDriven()||rh(l.value)||!a?a:(s=r.properties,a.replace(/{([^{}]+)}/g,(i,r)=>r in s?String(s[r]):""))}createBucket(i){return new cB(i)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const i of cF.paint.overridableProperties){if(!cU.hasPaintOverride(this.layout,i))continue;const r=this.paint.get(i),n=new cO(r),o=new rc(n,r.property.specification);let s=null;s="constant"===r.value.kind||"source"===r.value.kind?new rd("source",o):new rp("composite",o,r.value.zoomStops,r.value._interpolationType),this.paint._values[i]=new n1(r.property,s,r.parameters)}}_handleOverridablePaintPropertyUpdate(i,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&cU.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,r){const n=i.get("text-field"),o=cF.paint.properties[r];let s=!1;const a=i=>{for(const r of i)if(o.overrides&&o.overrides.hasOverride(r))return void(s=!0)};if("constant"===n.value.kind&&n.value.value instanceof tV)a(n.value.value.sections);else if("source"===n.value.kind){const l=i=>{s||(i instanceof tq&&tZ(i.value)===tM?a(i.value.sections):i instanceof tK?a(i.sections):i.eachChild(l))},c=n.value;c._styleExpression&&l(c._styleExpression.expression)}return s}getProgramConfiguration(i){return new o8(this,i)}}var cV={paint:new n9({"background-color":new n3(tu.paint_background["background-color"]),"background-pattern":new n6(tu.paint_background["background-pattern"]),"background-opacity":new n3(tu.paint_background["background-opacity"])})},cN={paint:new n9({"raster-opacity":new n3(tu.paint_raster["raster-opacity"]),"raster-hue-rotate":new n3(tu.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new n3(tu.paint_raster["raster-brightness-min"]),"raster-brightness-max":new n3(tu.paint_raster["raster-brightness-max"]),"raster-saturation":new n3(tu.paint_raster["raster-saturation"]),"raster-contrast":new n3(tu.paint_raster["raster-contrast"]),"raster-resampling":new n3(tu.paint_raster["raster-resampling"]),"raster-fade-duration":new n3(tu.paint_raster["raster-fade-duration"])})};class cj extends so{constructor(i){super(i,{}),this.implementation=i}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(i){this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)}onRemove(i){this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)}}var cG={paint:new n9({"sky-type":new n3(tu.paint_sky["sky-type"]),"sky-atmosphere-sun":new n3(tu.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new n3(tu.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new n3(tu.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new n3(tu.paint_sky["sky-gradient-radius"]),"sky-gradient":new n8(tu.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new n3(tu.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new n3(tu.paint_sky["sky-atmosphere-color"]),"sky-opacity":new n3(tu.paint_sky["sky-opacity"])})};function cZ(i,r,n){var o,s,a,l,c,h,u,d,p;const f=T(0,0,1),m=U(O());return o=m,s=m,a=n?-(i*j)+Math.PI:i*j,a*=.5,l=s[0],c=s[1],h=s[2],u=s[3],d=Math.sin(a),p=Math.cos(a),o[0]=l*p-h*d,o[1]=c*p+u*d,o[2]=h*p+l*d,o[3]=u*p-c*d,V(m,m,-(r*j)),L(f,f,m),z(f,f)}const c_={circle:class extends so{constructor(i){super(i,s_)}createBucket(i){return new sM(i)}queryRadius(i){const r=i;return sV("circle-radius",this,r)+sV("circle-stroke-width",this,r)+sN(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,n,o,s,a,l,c){const h=sG(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(r,n)+this.paint.get("circle-stroke-width").evaluate(r,n);return sW(i,o,a,l,c,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),h,u)}getProgramIds(){return["circle"]}getProgramConfiguration(i){return new o8(this,i)}},heatmap:class extends so{createBucket(i){return new sQ(i)}constructor(i){super(i,s4),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"heatmap-color"===i&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=s6({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(i){return sV("heatmap-radius",this,i)}queryIntersectsFeature(i,r,n,o,s,a,c,h){const u=this.paint.get("heatmap-radius").evaluate(r,n);return sW(i,o,a,c,h,!0,!0,new l(0,0),u)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(i){return new o8(this,i)}},hillshade:class extends so{constructor(i){super(i,s8)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare",]}getProgramConfiguration(i){return new o8(this,i)}},fill:class extends so{constructor(i){super(i,aR)}getProgramIds(){const i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),n=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getProgramConfiguration(i){return new o8(this,i)}recalculate(i,r){super.recalculate(i,r);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new aL(i)}queryRadius(){return sN(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,n,o,s,a){return!i.queryGeometry.isAboveHorizon&&sz(sj(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),o)}isTileClipped(){return!0}},"fill-extrusion":class extends so{constructor(i){super(i,a0)}createBucket(i){return new aJ(i)}queryRadius(){return sN(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion",]}getProgramConfiguration(i){return new o8(this,i)}queryIntersectsFeature(i,r,n,o,s,a,c,h,u){var d,p,f,m,$,g,y,x,v;const b=sG(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),w=this.paint.get("fill-extrusion-height").evaluate(r,n),T=this.paint.get("fill-extrusion-base").evaluate(r,n),E=[0,0],S=h&&a.elevation,I=a.elevation?a.elevation.exaggeration():1;if(S){const M=i.tile.getBucket(this).centroidVertexArray,A=u+1;if(A=3){for(let a=0;a1&&(c=i[++l]);const u=Math.abs(h-c.left),d=Math.abs(h-c.right),p=Math.min(u,d);let f;const m=s/n*(o+1);if(c.isDash){const $=o-Math.abs(m);f=Math.sqrt(p*p+$*$)}else f=o-Math.sqrt(p*p+m*m);this.image.data[a+h]=Math.max(0,Math.min(255,f+128))}}}addRegularDash(i,r){for(let n=i.length-1;n>=0;--n){const o=i[n],s=i[n+1];o.zeroLength?i.splice(n,1):s&&s.isDash===o.isDash&&(s.left=o.left,i.splice(n,1))}const a=i[0],l=i[i.length-1];a.isDash===l.isDash&&(a.left=l.left-this.width,l.right=a.right+this.width);const c=this.width*this.nextRow;let h=0,u=i[h];for(let d=0;d1&&(u=i[++h]);const p=Math.abs(d-u.left),f=Math.abs(d-u.right),m=Math.min(p,f);this.image.data[c+d]=Math.max(0,Math.min(255,(u.isDash?m:-m)+r+128))}}addDash(i,r){const n=this.getKey(i,r);if(this.positions[n])return this.positions[n];const o="round"===r,s=o?7:0,a=2*s+1;if(this.nextRow+a>this.height)return ep("LineAtlas out of space"),null;0===i.length&&i.push(1);let l=0;for(let c=0;c0;a--)s+=(r&(o=1<this.canonical.z?new c5(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new c5(i,this.wrap,i,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(i,r=!0){if(this.overscaledZ===i&&r)return this.key;if(i>this.canonical.z)return c4(this.wrap*+r,i,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-i;return c4(this.wrap*+r,i,i,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(i){if(i.wrap!==this.wrap)return!1;const r=this.canonical.z-i.canonical.z;return 0===i.overscaledZ||i.overscaledZ>r&&i.canonical.y===this.canonical.y>>r}children(i){if(this.overscaledZ>=i)return[new c5(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y),];const r=this.canonical.z+1,n=2*this.canonical.x,o=2*this.canonical.y;return[new c5(r,this.wrap,r,n,o),new c5(r,this.wrap,r,n+1,o),new c5(r,this.wrap,r,n,o+1),new c5(r,this.wrap,r,n+1,o+1),]}isLessThan(i){return this.wrapi.wrap)&&(this.overscaledZi.overscaledZ)&&(this.canonical.xi.canonical.x)&&this.canonical.yMath.abs(o[l])){if(n[l]r[l])return null}else{const c=1/o[l];let h=(i[l]-n[l])*c,u=(r[l]-n[l])*c;if(h>u){const d=h;h=u,u=d}if(h>s&&(s=h),ua)return null}return s}function hn(i,r,n,o,s,a,l,c,h,u,d){const p=o-i,f=s-r,m=a-n,$=l-i,g=c-r,y=h-n,x=d[1]*y-d[2]*g,v=d[2]*$-d[0]*y,b=d[0]*g-d[1]*$,w=p*x+f*v+m*b;if(1e-15>Math.abs(w))return null;const T=1/w,E=u[0]-i,S=u[1]-r,I=u[2]-n,M=(E*x+S*v+I*b)*T;if(M<0||M>1)return null;const A=S*m-I*f,C=I*p-E*m,z=E*f-S*p,k=(d[0]*A+d[1]*C+d[2]*z)*T;return k<0||M+k>1?null:($*A+g*C+y*z)*T}function ho(i,r,n,o,s,a,l,c,h){const u=1<{const a=o?1:0;s[0]=i*n,s[1]=r*n,s[2]=(i+1)*n-a,s[3]=(r+1)*n-a};let l=new hi(o);const c=[];for(let h=0;h=1;o/=2){const m=n[n.length-1];l=new hi(o);for(let $=0;$0;){const{idx:m,t:$,nodex:g,nodey:y,depth:x}=f.pop();if(this.leaves[m]){ho(g,y,x,i,r,n,o,d,p);const v=1<=B[2])return $}continue}let R=0;for(let F=0;F=h[u[N]]&&(u.splice(N,0,F),V=!0);V||(u[R]=F),R++}}for(let j=0;j=this.dim+1||r<-1||r>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(i+1)}_unpackMapbox(i,r,n){return(256*i*256+256*r+n)/10-1e4}_unpackTerrarium(i,r,n){return 256*i+r+n/256-32768}static pack(i,r){const n=[0,0,0,0],o=hh.getUnpackVector(r);let s=Math.floor((i+o[3])/o[2]);return n[2]=s%256,s=Math.floor(s/256),n[1]=s%256,s=Math.floor(s/256),n[0]=s,n}getPixels(){return new s5({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,r,n){if(this.dim!==i.dim)throw Error("dem dimension mismatch");let o=r*this.dim,s=r*this.dim+this.dim,a=n*this.dim,l=n*this.dim+this.dim;switch(r){case -1:o=s-1;break;case 1:s=o+1}switch(n){case -1:a=l-1;break;case 1:l=a+1}const c=-r*this.dim,h=-n*this.dim;for(let u=a;u{"source"===i.dataType&&"metadata"===i.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===i.dataType&&"content"===i.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new class{constructor(i,r){this.max=i,this.onRemove=r,this.reset()}reset(){for(const i in this.data)for(const r of this.data[i])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(i,r,n){const o=i.wrapped().key;void 0===this.data[o]&&(this.data[o]=[]);const s={value:r,timeout:void 0};if(void 0!==n&&(s.timeout=setTimeout(()=>{this.remove(i,s)},n)),this.data[o].push(s),this.order.push(o),this.order.length>this.max){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){const r=this.data[i].shift();return r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),r.value}getByKey(i){const r=this.data[i];return r?r[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,r){if(!this.has(i))return this;const n=i.wrapped().key,o=void 0===r?0:this.data[n].indexOf(r),s=this.data[n][o];return this.data[n].splice(o,1),s.timeout&&clearTimeout(s.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(s.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){const r=this._getAndRemoveByKey(this.order[0]);r&&this.onRemove(r)}return this}filter(i){const r=[];for(const n in this.data)for(const o of this.data[n])i(o.value)||r.push(o);for(const s of r)this.remove(s.value.tileID,s)}}(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(i,r,n){const o=String(r);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][o]=this.stateChanges[i][o]||{},et(this.stateChanges[i][o],n),null===this.deletedStates[i])for(const s in this.deletedStates[i]={},this.state[i])s!==o&&(this.deletedStates[i][s]=null);else if(this.deletedStates[i]&&null===this.deletedStates[i][o])for(const a in this.deletedStates[i][o]={},this.state[i][o])n[a]||(this.deletedStates[i][o][a]=null);else for(const l in n)this.deletedStates[i]&&this.deletedStates[i][o]&&null===this.deletedStates[i][o][l]&&delete this.deletedStates[i][o][l]}removeFeatureState(i,r,n){if(null===this.deletedStates[i])return;const o=String(r);if(this.deletedStates[i]=this.deletedStates[i]||{},n&&void 0!==r)null!==this.deletedStates[i][o]&&(this.deletedStates[i][o]=this.deletedStates[i][o]||{},this.deletedStates[i][o][n]=null);else if(void 0!==r){if(this.stateChanges[i]&&this.stateChanges[i][o])for(n in this.deletedStates[i][o]={},this.stateChanges[i][o])this.deletedStates[i][o][n]=null;else this.deletedStates[i][o]=null}else this.deletedStates[i]=null}getState(i,r){const n=String(r),o=et({},(this.state[i]||{})[n],(this.stateChanges[i]||{})[n]);if(null===this.deletedStates[i])return{};if(this.deletedStates[i]){const s=this.deletedStates[i][r];if(null===s)return{};for(const a in s)delete o[a]}return o}initializeTileState(i,r){i.setFeatureState(this.state,r)}coalesceChanges(i,r){const n={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const s={};for(const a in this.stateChanges[o])this.state[o][a]||(this.state[o][a]={}),et(this.state[o][a],this.stateChanges[o][a]),s[a]=this.state[o][a];n[o]=s}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const c={};if(null===this.deletedStates[l])for(const h in this.state[l])c[h]={},this.state[l][h]={};else for(const u in this.deletedStates[l]){if(null===this.deletedStates[l][u])this.state[l][u]={};else for(const d of Object.keys(this.deletedStates[l][u]))delete this.state[l][u][d];c[u]=this.state[l][u]}n[l]=n[l]||{},et(n[l],c)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(const p in i)i[p].setFeatureState(n,r)}}}onAdd(i){this.map=i,this._minTileCacheSize=i?i._minTileCacheSize:null,this._maxTileCacheSize=i?i._maxTileCacheSize:null}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const i in this._tiles){const r=this._tiles[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(i,r){return i.isSymbolTile=this._onlySymbols,this._source.loadTile(i,r)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i,()=>{})}_abortTile(i){if(this._source.abortTile)return this._source.abortTile(i,()=>{})}serialize(){return this._source.serialize()}prepare(i){for(const r in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){const n=this._tiles[r];n.upload(i),n.prepare(this.map.style.imageManager)}}getIds(){return ee(this._tiles).map(i=>i.tileID).sort(hd).map(i=>i.key)}getRenderableIds(i){const r=[];for(const n in this._tiles)this._isIdRenderable(+n,i)&&r.push(this._tiles[n]);return i?r.sort((i,r)=>{const n=i.tileID,o=r.tileID,s=new l(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),a=new l(o.canonical.x,o.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-o.overscaledZ||a.y-s.y||a.x-s.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(hd).map(i=>i.key)}hasRenderableParent(i){const r=this.findLoadedParent(i,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(i,r){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(r||!this._tiles[i].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(const i in this._cache.reset(),this._tiles)"errored"!==this._tiles[i].state&&this._reloadTile(+i,"reloading")}_reloadTile(i,r){const n=this._tiles[i];n&&("loading"!==n.state&&(n.state=r),this._loadTile(n,this._tileLoaded.bind(this,n,i,r)))}_tileLoaded(i,r,n,o){if(o){if(i.state="errored",404!==o.status)this._source.fire(new tc(o,{tile:i}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const s=this.map.painter.terrain;this.update(this.transform,s.getScaledDemTileSize(),!0),s.resetTileLookupCache(this.id)}else this.update(this.transform)}else i.timeAdded=eE.now(),"expired"===n&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(r,i),"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new tl("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(i){const r=this.getRenderableIds();for(let n=0;n1||(Math.abs(n)>1&&(1===Math.abs(n+s)?n+=s:1===Math.abs(n-s)&&(n-=s)),r.dem&&i.dem&&(i.dem.backfillBorder(r.dem,n,o),i.neighboringTiles&&i.neighboringTiles[a]&&(i.neighboringTiles[a].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,r,n,o){for(const s in this._tiles){let a=this._tiles[s];if(o[s]||!a.hasData()||a.tileID.overscaledZ<=r||a.tileID.overscaledZ>n)continue;let l=a.tileID;for(;a&&a.tileID.overscaledZ>r+1;){const c=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[c.key])&&a.hasData()&&(l=c)}let h=l;for(;h.overscaledZ>r;)if(i[(h=h.scaledTo(h.overscaledZ-1)).key]){o[l.key]=l;break}}}findLoadedParent(i,r){if(i.key in this._loadedParentTiles){const n=this._loadedParentTiles[i.key];return n&&n.tileID.overscaledZ>=r?n:null}for(let o=i.overscaledZ-1;o>=r;o--){const s=i.scaledTo(o),a=this._getLoadedTile(s);if(a)return a}}_getLoadedTile(i){const r=this._tiles[i.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,r){r=r||this._source.tileSize;const n=Math.ceil(i.width/r)+1,o=Math.ceil(i.height/r)+1,s=Math.floor(n*o*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,s):s,l="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(l)}handleWrapJump(i){const r=Math.round((i-(void 0===this._prevLng?i:this._prevLng))/360);if(this._prevLng=i,r){const n={};for(const o in this._tiles){const s=this._tiles[o];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+r),n[s.tileID.key]=s}for(const a in this._tiles=n,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(const l in this._tiles)this._setTileReloadTimer(+l,this._tiles[l])}}update(i,r,n){if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;let o;this.updateCacheSize(i,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?o=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new c5(i.canonical.z,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y)):(o=i.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(o=o.filter(i=>this._source.hasTile(i)))):o=[];const s=this._updateRetainedTiles(o);if(hp(this._source.type)&&0!==o.length){const a={},l={},c=Object.keys(s);for(const h of c){const u=s[h],d=this._tiles[h];if(!d||d.fadeEndTime&&d.fadeEndTime<=eE.now())continue;const p=this.findLoadedParent(u,Math.max(u.overscaledZ-hu.maxOverzooming,this._source.minzoom));p&&(this._addTile(p.tileID),a[p.tileID.key]=p.tileID),l[h]=u}const f=o[o.length-1].overscaledZ;for(const m in this._tiles){const $=this._tiles[m];if(s[m]||!$.hasData())continue;let g=$.tileID;for(;g.overscaledZ>f;){g=g.scaledTo(g.overscaledZ-1);const y=this._tiles[g.key];if(y&&y.hasData()&&l[g.key]){s[m]=$.tileID;break}}}for(const x in a)s[x]||(this._coveredTiles[x]=!0,s[x]=a[x])}for(const v in s)this._tiles[v].clearFadeHold();const b=function(i,r){const n=[];for(const o in i)o in r||n.push(o);return n}(this._tiles,s);for(const w of b){const T=this._tiles[w];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(+w)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){const r={};if(0===i.length)return r;const n={},o=i.reduce((i,r)=>Math.min(i,r.overscaledZ),1/0),s=i[0].overscaledZ,a=Math.max(s-hu.maxOverzooming,this._source.minzoom),l=Math.max(s+hu.maxUnderzooming,this._source.minzoom),c={};for(const h of i){const u=this._addTile(h);r[h.key]=h,u.hasData()||o=this._source.maxzoom){const f=d.children(this._source.maxzoom)[0],m=this.getTile(f);if(m&&m.hasData()){r[f.key]=f;continue}}else{const $=d.children(this._source.maxzoom);if(r[$[0].key]&&r[$[1].key]&&r[$[2].key]&&r[$[3].key])continue}let g=p.wasRequested();for(let y=d.overscaledZ-1;y>=a;--y){const x=d.scaledTo(y);if(n[x.key]||(n[x.key]=!0,(p=this.getTile(x))||!g||(p=this._addTile(x)),p&&(r[x.key]=x,g=p.wasRequested(),p.hasData())))break}}return r}_updateLoadedParentTileCache(){for(const i in this._loadedParentTiles={},this._tiles){const r=[];let n,o=this._tiles[i].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){n=this._loadedParentTiles[o.key];break}r.push(o.key);const s=o.scaledTo(o.overscaledZ-1);if(n=this._getLoadedTile(s))break;o=s}for(const a of r)this._loadedParentTiles[a]=n}}_addTile(i){let r=this._tiles[i.key];if(r)return r;(r=this._cache.getAndRemove(i))&&(this._setTileReloadTimer(i.key,r),r.tileID=i,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,r)));const n=Boolean(r);if(!n){const o=this.map?this.map.painter:null,s="raster"===this._source.type||"raster-dem"===this._source.type;r=new hF(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,o,s),this._loadTile(r,this._tileLoaded.bind(this,r,i.key,r.state))}return r?(r.uses++,this._tiles[i.key]=r,n||this._source.fire(new tl("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(i,r){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);const n=r.getExpiryTimeout();n&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},n))}_removeTile(i){const r=this._tiles[i];r&&(r.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),r.uses>0||(r.hasData()&&"reloading"!==r.state?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){for(const i in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+i);this._source._clear&&this._source._clear(),this._cache.reset()}tilesIn(i,r,n){const o=[],s=this.transform;if(!s)return o;for(const a in this._tiles){const l=this._tiles[a];if(n&&l.clearQueryDebugViz(),l.holdingForFade())continue;const c=i.containsTile(l,s,r);c&&o.push(c)}return o}getVisibleCoordinates(i){const r=this.getRenderableIds(i).map(i=>this._tiles[i].tileID);for(const n of r)n.projMatrix=this.transform.calculateProjMatrix(n.toUnwrapped());return r}hasTransition(){if(this._source.hasTransition())return!0;if(hp(this._source.type))for(const i in this._tiles){const r=this._tiles[i];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=eE.now())return!0}return!1}setFeatureState(i,r,n){this._state.updateState(i=i||"_geojsonTileLayer",r,n)}removeFeatureState(i,r,n){this._state.removeFeatureState(i=i||"_geojsonTileLayer",r,n)}getFeatureState(i,r){return this._state.getState(i=i||"_geojsonTileLayer",r)}setDependencies(i,r,n){const o=this._tiles[i];o&&o.setDependencies(r,n)}reloadTilesForDependencies(i,r){for(const n in this._tiles)this._tiles[n].hasDependency(i,r)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(i,r))}_preloadTiles(i,r){const n=new Map,o=Array.isArray(i)?i:[i],s=this.map.painter.terrain,a=this.usedForTerrain&&s?s.getScaledDemTileSize():this._source.tileSize;for(const l of o){const c=l.coveringTiles({tileSize:a,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const h of c)n.set(h.key,h);this.usedForTerrain&&l.updateElevation(!1)}const u=Array.from(n.values()),d="raster"===this._source.type||"raster-dem"===this._source.type;Q(u,(i,r)=>{const n=new hF(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,this.map.painter,d);this._loadTile(n,i=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),r(i,n)})},r)}}function hd(i,r){const n=Math.abs(2*i.wrap)-+(i.wrap<0),o=Math.abs(2*r.wrap)-+(r.wrap<0);return i.overscaledZ-r.overscaledZ||o-n||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function hp(i){return"raster"===i||"image"===i||"video"===i}hu.maxOverzooming=10,hu.maxUnderzooming=3;class hf{constructor(i,r,n){this._demTile=i,this._dem=this._demTile.dem,this._scale=r,this._offset=n}static create(i,r,n){const o=n||i.findDEMTileFor(r);if(!o||!o.dem)return;const s=o.dem,a=o.tileID,l=1<=0&&d[3]>=0&&c.insert(l,d[0],d[1],d[2],d[3])}}loadVTLayers(){if(!this.vtLayers)for(const i in this.vtLayers=new aW.VectorTile(new lw(this.rawTileData)).layers,this.sourceLayerCoder=new he(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[i]=[];return this.vtLayers}query(i,r,n,o){this.loadVTLayers();const s=i.params||{},a=rT(s.filter),l=i.tileResult,c=i.transform,h=l.bufferedTilespaceBounds,u=this.grid.query(h.min.x,h.min.y,h.max.x,h.max.y,(i,r,n,o)=>sO(l.bufferedTilespaceGeometry,i,r,n,o));u.sort(hg);let d=null;c.elevation&&u.length>0&&(d=hf.create(c.elevation,this.tileID));const p={};let f;for(let m=0;m(y||(y=sE(r,this.tileID.canonical,i.tileTransform)),n.queryIntersectsFeature(l,r,o,y,this.z,i.transform,i.pixelPosMatrix,d,s)))}return p}loadMatchingFeature(i,r,n,o,s,a,l,c,h){const{featureIndex:u,bucketIndex:d,sourceLayerIndex:p,layoutVertexArrayOffset:f}=r,m=this.bucketLayerIDs[d];if(o&&!function(i,r){for(let n=0;n=0)return!0;return!1}(o,m))return;const $=this.sourceLayerCoder.decode(p),g=this.vtLayers[$].feature(u);if(n.needGeometry){const y=sS(g,!0);if(!n.filter(new nH(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new nH(this.tileID.overscaledZ),g))return;const x=this.getId(g,$);for(let v=0;vo.indexOf(b))continue;const w=a[b];if(!w)continue;let T={};void 0!==x&&c&&(T=c.getState(w.sourceLayer||"_geojsonTileLayer",x));const E=et({},l[b]);E.paint=h$(E.paint,w.paint,g,T,s),E.layout=h$(E.layout,w.layout,g,T,s);const S=!h||h(g,w,T,f);if(!S)continue;const I=new ht(g,this.z,this.x,this.y,x);I.layer=E;let M=i[b];void 0===M&&(M=i[b]=[]),M.push({featureIndex:u,feature:I,intersectionZ:S})}}lookupSymbolFeatures(i,r,n,o,s,a,l,c){const h={};this.loadVTLayers();const u=rT(s);for(const d of i)this.loadMatchingFeature(h,{bucketIndex:n,sourceLayerIndex:o,featureIndex:d,layoutVertexArrayOffset:0},u,a,l,c,r);return h}loadFeature(i){const{featureIndex:r,sourceLayerIndex:n}=i;this.loadVTLayers();const o=this.sourceLayerCoder.decode(n),s=this.vtFeatures[o];if(s[r])return s[r];const a=this.vtLayers[o].feature(r);return s[r]=a,a}hasLayer(i){for(const r of this.bucketLayerIDs)for(const n of r)if(i===n)return!0;return!1}getId(i,r){let n=i.id;return this.promoteId&&"boolean"==typeof(n=i.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[r]])&&(n=Number(n)),n}}function h$(i,r,n,o,s){return ec(i,(i,a)=>{const l=r instanceof n2?r.get(a):null;return l&&l.evaluate?l.evaluate(n,o,s):l})}function hg(i,r){return r-i}r4("FeatureIndex",hm,{omit:["rawTileData","sourceLayerCoder"]});var hy=or([{name:"a_pos",type:"Int16",components:2},]);const hx=new Uint16Array(8184);for(let hv=0;hv<2046;hv++){let hb=hv+2,hw=0,hT=0,hE=0,hS=0,hI=0,hM=0;for(1&hb?hE=hS=hI=32:hw=hT=hM=32;(hb>>=1)>1;){const hA=hw+hE>>1,hC=hT+hS>>1;1&hb?(hE=hw,hS=hT,hw=hI,hT=hM):(hw=hE,hT=hS,hE=hI,hS=hM),hI=hA,hM=hC}const hz=4*hv;hx[hz+0]=hw,hx[hz+1]=hT,hx[hz+2]=hE,hx[hz+3]=hS}const hk=new Uint16Array(2178),hP=new Uint8Array(1089),hD=new Uint16Array(1089);function hL(i){return 0===i?-.03125:32===i?.03125:0}var hB=or([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2},]);const hR={type:2,extent:8192,loadGeometry:()=>[[new l(0,0),new l(8193,0),new l(8193,8193),new l(0,8193),new l(0,0),],]};class hF{constructor(i,r,n,o,s){this.tileID=i,this.uid=er(),this.uses=0,this.tileSize=r,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,this.expiredRequestCount=0,this.state="loading",o&&o.transform&&(this.projection=o.transform.projection)}registerFadeDuration(i){const r=i+this.timeAdded;rr.getLayer(i)).filter(Boolean);if(0!==s.length)for(const a of(o.layers=s,o.stateDependentLayerIds&&(o.stateDependentLayers=o.stateDependentLayerIds.map(i=>s.filter(r=>r.id===i)[0])),s))n[a.id]=o}return n}(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){const s=this.buckets[o];if(s instanceof cB){if(this.hasSymbolBuckets=!0,!n)break;s.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const a in this.buckets){const l=this.buckets[a];if(l instanceof cB&&l.hasRTLText){this.hasRTLText=!0,nW.isLoading()||nW.isLoaded()||"deferred"!==nq()||nX();break}}for(const c in this.queryPadding=0,this.buckets){const h=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(c).queryRadius(h))}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas)}else this.collisionBoxArray=new oC}unloadVectorData(){if(this.hasData()){for(const i in this.buckets)this.buckets[i].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(i){return this.buckets[i.id]}upload(i){for(const r in this.buckets){const n=this.buckets[r];n.uploadPending()&&n.upload(i)}const o=i.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new cY(i,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new cY(i,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new cY(i,this.lineAtlas.image,o.ALPHA),this.lineAtlas.uploaded=!0)}prepare(i){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture)}queryRenderedFeatures(i,r,n,o,s,a,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:o,pixelPosMatrix:l,transform:a,params:s,tileTransform:this.tileTransform},i,r,n):{}}querySourceFeatures(i,r){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const o=n.loadVTLayers(),s=r?r.sourceLayer:"",a=o._geojsonTileLayer||o[s];if(!a)return;const l=rT(r&&r.filter),{z:c,x:h,y:u}=this.tileID.canonical,d={z:c,x:h,y:u};for(let p=0;po)s=!1;else if(r){if(this.expirationTime=0;d--){const p=4*d,f=hx[p+0],m=hx[p+1],$=hx[p+2],g=hx[p+3],y=f+$>>1,x=m+g>>1,v=y+x-m,b=x+f-y,w=33*m+f,T=33*g+$,E=33*x+y,S=Math.hypot((hk[2*w+0]+hk[2*T+0])/2-hk[2*E+0],(hk[2*w+1]+hk[2*T+1])/2-hk[2*E+1])>=16;if(hP[E]=hP[E]||(S?1:0),d<1022){const I=(m+b>>1)*33+(f+v>>1),M=(g+b>>1)*33+($+v>>1);hP[E]=hP[E]||hP[I]||hP[M]}}const A=new os,C=new og;let z=0;function k(i,r){const n=33*r+i;return 0===hD[n]&&(A.emplaceBack(hk[2*n+0],hk[2*n+1],8192*i/32,8192*r/32),hD[n]=++z),hD[n]-1}function P(i,r,n,o,s,a){const l=i+n>>1,c=r+o>>1;if(Math.abs(i-s)+Math.abs(r-a)>1&&hP[33*c+l])P(s,a,i,r,l,c),P(n,o,s,a,l,c);else{const h=k(i,r),u=k(n,o),d=k(s,a);C.emplaceBack(h,u,d)}}return P(0,0,32,32,32,0),P(32,32,0,0,0,32),{vertices:A,indices:C}}(this.tileID.canonical,r);o=a.vertices,s=a.indices}else{for(const{x:l,y:c}of(o=new os,s=new og,n))o.emplaceBack(l,c,0,0);const h=ae(o.int16,void 0,4);for(let u=0;u{const o=65*n+r;i.emplaceBack(o+1,o,o+65),i.emplaceBack(o+65,o+65+1,o+1)};for(let n=0;n<64;n++)for(let o=0;o<64;o++)r(o,n);return i}getWirefameBuffer(i){if(!this.wireframeSegments){const r=this._createWireframeGrid();this.wireframeIndexBuffer=i.createIndexBuffer(r),this.wireframeSegments=sl.simpleSegment(0,0,4096,r.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}_createWireframeGrid(){const i=new oE,r=(r,n)=>{const o=65*n+r;i.emplaceBack(o,o+1),i.emplaceBack(o,o+65),i.emplaceBack(o,o+65+1)};for(let n=0;n<64;n++)for(let o=0;o<64;o++)r(o,n);return i}}function h0(i,r){if(!r.isReprojectedInTileSpace)return{scale:1<b&&(w(i,u,o,s,c,h),w(u,n,c,h,a,l))}w(p,f,o,a,s,a),w(f,m,s,a,s,l),w(m,$,s,l,o,l),w($,p,o,l,o,a),g-=b,y-=b,x+=b,v+=b;const T=1/Math.max(x-g,v-y);return{scale:T,x:g*T,y:y*T,x2:x*T,y2:v*T,projection:r}}class h1{constructor(i){const r={},n=[];for(const o in i){const s=i[o],a=r[o]={};for(const l in s.glyphs){const c=s.glyphs[+l];if(!c||0===c.bitmap.width||0===c.bitmap.height)continue;const h=c.metrics.localGlyph?2:1,u={x:0,y:0,w:c.bitmap.width+2*h,h:c.bitmap.height+2*h};n.push(u),a[l]=u}}const{w:d,h:p}=lj(n),f=new s3({width:d||1,height:p||1});for(const m in i){const $=i[m];for(const g in $.glyphs){const y=$.glyphs[+g];if(!y||0===y.bitmap.width||0===y.bitmap.height)continue;const x=r[m][g],v=y.metrics.localGlyph?2:1;s3.copy(y.bitmap,f,{x:0,y:0},{x:x.x+v,y:x.y+v},y.bitmap)}}this.image=f,this.positions=r}}r4("GlyphAtlas",h1);class h2{constructor(i){this.tileID=new c5(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.collectResourceTiming,this.returnDependencies=!!i.returnDependencies,this.promoteId=i.promoteId,this.enableTerrain=!!i.enableTerrain,this.isSymbolTile=i.isSymbolTile,this.tileTransform=h0(i.tileID.canonical,i.projection),this.projection=i.projection}parse(i,r,n,o,s){this.status="parsing",this.data=i,this.collisionBoxArray=new oC;const a=new he(Object.keys(i.layers).sort()),l=new hm(this.tileID,this.promoteId);l.bucketLayerIDs=[];const c={},h=new cJ(256,256),u={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:h,availableImages:n},d=r.familiesBySource[this.source];for(const p in d){const f=i.layers[p];if(!f)continue;let m=!1,$=!1;for(const g of d[p])"symbol"===g[0].type?m=!0:$=!0;if(!0===this.isSymbolTile&&!m||!1===this.isSymbolTile&&!$)continue;1===f.version&&ep(`Vector tile source "${this.source}" layer "${p}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const y=a.encode(p),x=[];for(let v=0;v=E.maxzoom||"none"!==E.visibility&&(h3(T,this.zoom,n),(c[E.id]=E.createBucket({index:l.bucketLayerIDs.length,layers:T,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:y,sourceID:this.source,enableTerrain:this.enableTerrain,availableImages:n})).populate(x,u,this.tileID.canonical,this.tileTransform),l.bucketLayerIDs.push(T.map(i=>i.id)))}}let S,I,M,A;h.trim();const C={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},z=ec(u.glyphDependencies,i=>Object.keys(i).map(Number));Object.keys(z).length?o.send("getGlyphs",{uid:this.uid,stacks:z},(i,r)=>{S||(S=i,I=r,D.call(this))},void 0,!1,C):I={};const k=Object.keys(u.iconDependencies);k.length?o.send("getImages",{icons:k,source:this.source,tileID:this.tileID,type:"icons"},(i,r)=>{S||(S=i,M=r,D.call(this))},void 0,!1,C):M={};const P=Object.keys(u.patternDependencies);function D(){if(S)return s(S);if(I&&M&&A){const i=new h1(I),r=new lZ(M,A);for(const o in c){const a=c[o];a instanceof cB?(h3(a.layers,this.zoom,n),cx(a,I,i.positions,M,r.iconPositions,this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection),a.projection=this.projection.name):a.hasPattern&&(a instanceof lt||a instanceof aL||a instanceof aJ)&&(h3(a.layers,this.zoom,n),a.addFeatures(u,this.tileID.canonical,r.patternPositions,n))}this.status="done",s(null,{buckets:ee(c).filter(i=>!i.isEmpty()),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:h,imageAtlas:r,glyphMap:this.returnDependencies?I:null,iconMap:this.returnDependencies?M:null,glyphPositions:this.returnDependencies?i.positions:null})}}P.length?o.send("getImages",{icons:P,source:this.source,tileID:this.tileID,type:"patterns"},(i,r)=>{S||(S=i,A=r,D.call(this))},void 0,!1,C):A={},D.call(this)}}function h3(i,r,n){const o=new nH(r);for(const s of i)s.recalculate(o,n)}class h5{constructor(i){this.entries={},this.scheduler=i}request(i,r,n,o){const s=this.entries[i]=this.entries[i]||{callbacks:[]};if(s.result){const[a,l]=s.result;return this.scheduler?this.scheduler.add(()=>{o(a,l)},r):o(a,l),()=>{}}return s.callbacks.push(o),s.cancel||(s.cancel=n((n,o)=>{for(const a of(s.result=[n,o],s.callbacks))this.scheduler?this.scheduler.add(()=>{a(n,o)},r):a(n,o);setTimeout(()=>delete this.entries[i],3e3)})),()=>{s.result||(s.callbacks=s.callbacks.filter(i=>i!==o),s.callbacks.length||(s.cancel(),delete this.entries[i]))}}}function h4(i,r,n){const o=JSON.stringify(i.request);return i.data&&(this.deduped.entries[o]={result:[null,i.data]}),this.deduped.request(o,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom},r=>{const o=e9(i.request,(i,o,s,a)=>{i?r(i):o&&r(null,{vectorTile:n?void 0:new aW.VectorTile(new lw(o)),rawData:o,cacheControl:s,expires:a})});return()=>{o.cancel(),r()}},r)}const h6=p(new Float64Array(16));class h8{constructor(i,r){this._tr=i,this._worldSize=r}createInversionMatrix(){return h6}createTileMatrix(i){let r,n,o;const s=i.canonical,a=p(new Float64Array(16)),l=this._tr.projection;if(l.isReprojectedInTileSpace){const c=h0(s,l);r=1,n=c.x+i.wrap*c.scale,o=c.y,$(a,a,[r/c.scale,r/c.scale,this._tr.pixelsPerMeter/this._worldSize,])}else r=this._worldSize/this._tr.zoomScale(s.z),n=(s.x+Math.pow(2,s.z)*i.wrap)*r,o=s.y*r;return m(a,a,[n,o,0]),$(a,a,[r/8192,r/8192,1]),a}pointCoordinate(i,r,n){const o=this._tr.horizonLineFromTop(!1),s=new l(i,Math.max(o,r));return this._tr.rayIntersectionCoordinate(this._tr.pointRayIntersection(s,n))}upVector(){return[0,0,1]}upVectorScale(){return 1}}const h9=Math.sqrt(3)/2,h7=Math.PI/2;function ue(i){return Math.tan((h7+i)/2)}const ut=85.051129*j,ui=85.051129*j,ur={albers:{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&&N(this.parallels,this.constants.parallels))return;const i=Math.sin(this.parallels[0]*j),r=(i+Math.sin(this.parallels[1]*j))/2,n=1+i*(2*r-i),o=Math.sqrt(n)/r;this.constants={n:r,c:n,r0:o,parallels:this.parallels}},project(i,r){this.initializeConstants();const n=(i-this.center[0])*j,{n:o,c:s,r0:a}=this.constants,l=Math.sqrt(s-2*o*Math.sin(r*j))/o;return{x:l*Math.sin(n*o),y:l*Math.cos(n*o)-a,z:0}},unproject(i,r){this.initializeConstants();const{n:n,c:o,r0:s}=this.constants,a=s+r;let l=Math.atan2(i,Math.abs(a))*Math.sign(a);a*n<0&&(l-=Math.PI*Math.sign(i)*Math.sign(a));const c=this.center[0]*j*n;l=J(l,-Math.PI-c,Math.PI-c);const h=l/n*G+this.center[0],u=Math.asin(K((o-(i*i+a*a)*n*n)/(2*n),-1,1)),d=K(u*G,-85.051129,85.051129);return new sh(h,d)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sd(i)*r,farthestPixelDistance(i){return hN(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new h8(i,r)},equalEarth:{name:"equalEarth",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(i,r){r=r/180*Math.PI,i=i/180*Math.PI;const n=Math.asin(h9*Math.sin(r)),o=n*n,s=o*o*o;return{x:.5*(i*Math.cos(n)/(h9*(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o)))/Math.PI+.5),y:1-.5*(n*(1.340264+-.081106*o+s*(893e-6+.003796*o))/Math.PI+1),z:0}},unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,o=n*n,s=o*o*o;for(let a,l,c=0;c<12&&(l=n*(1.340264+-.081106*o+s*(893e-6+.003796*o))-r,s=(o=(n=K(n-(a=l/(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o))),-Math.PI/3,Math.PI/3))*n)*o*o,!(1e-12>Math.abs(a)));++c);const h=h9*i*(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o))/Math.cos(n),u=Math.asin(Math.sin(n)/h9),d=K(180*h/Math.PI,-180,180),p=K(180*u/Math.PI,-85.051129,85.051129);return new sh(d,p)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sd(i)*r,farthestPixelDistance(i){return hN(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new h8(i,r)},equirectangular:{name:"equirectangular",supportsWorldCopies:!0,center:[0,0],range:[3.5,7],zAxisUnit:"meters",wrap:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project:(i,r)=>({x:.5+i/360,y:.5-r/360,z:0}),unproject(i,r){const n=K(360*(.5-r),-85.051129,85.051129);return new sh(360*(i-.5),n)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sd(i)*r,farthestPixelDistance(i){return hN(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new h8(i,r)},lambertConformalConic:{name:"lambertConformalConic",range:[3.5,7],zAxisUnit:"meters",center:[0,30],parallels:[30,30],conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&N(this.parallels,this.constants.parallels))return;const i=this.parallels[0]*j,r=this.parallels[1]*j,n=Math.cos(i),o=i===r?Math.sin(i):Math.log(n/Math.cos(r))/Math.log(ue(r)/ue(i)),s=n*Math.pow(ue(i),o)/o;this.constants={n:o,f:s,parallels:this.parallels}},project(i,r){this.initializeConstants(),r*=j,i=(i-this.center[0])*j;const{n:n,f:o}=this.constants;o>0?r<-h7+1e-6&&(r=-h7+1e-6):r>h7-1e-6&&(r=h7-1e-6);const s=o/Math.pow(ue(r),n),a=s*Math.sin(n*i),l=o-s*Math.cos(n*i);return{x:.5*(a/Math.PI+.5),y:1-.5*(l/Math.PI+.5),z:0}},unproject(i,r){this.initializeConstants(),i=(2*i-.5)*Math.PI,r=(2*(1-r)-.5)*Math.PI;const{n:n,f:o}=this.constants,s=o-r,a=Math.sign(s),l=Math.sign(n)*Math.sqrt(i*i+s*s);let c=Math.atan2(i,Math.abs(s))*a;s*n<0&&(c-=Math.PI*Math.sign(i)*a);const h=K(c/n*G+this.center[0],-180,180),u=K((2*Math.atan(Math.pow(o/l,1/n))-h7)*G,-85.051129,85.051129);return new sh(h,u)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sd(i)*r,farthestPixelDistance(i){return hN(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new h8(i,r)},mercator:{name:"mercator",wrap:!0,requiresDraping:!1,supportsWorldCopies:!0,supportsTerrain:!0,supportsFog:!0,supportsFreeCamera:!0,zAxisUnit:"meters",center:[0,0],project:(i,r)=>({x:sp(i),y:sf(r),z:0}),unproject(i,r){const n=s$(i),o=sg(r);return new sh(n,o)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sd(i)*r,farthestPixelDistance(i){return hN(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new h8(i,r)},naturalEarth:{name:"naturalEarth",center:[0,0],range:[3.5,7],isReprojectedInTileSpace:!0,zAxisUnit:"meters",unsupportedLayers:["custom"],project(i,r){const n=(r*=j)*r,o=n*n;return{x:.5*((i*=j)*(.8707-.131979*n+o*(o*(.003971*n-.001529*o)-.013791))/Math.PI+.5),y:1-.5*(r*(1.007226+n*(.015085+o*(.028874*n-.044475-.005916*o)))/Math.PI+1),z:0}},unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,o=25,s=0,a=n*n;do{a=n*n;const l=a*a;s=(n*(1.007226+a*(.015085+l*(.028874*a-.044475-.005916*l)))-r)/(1.007226+a*(.045255+l*(.259866*a-.311325-.005916*11*l))),n=K(n-s,-ut,ut)}while(Math.abs(s)>1e-6&&--o>0)a=n*n;const c=K(i/(.8707+a*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))*G,-180,180),h=n*G;return new sh(c,h)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sd(i)*r,farthestPixelDistance(i){return hN(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new h8(i,r)},winkelTripel:{name:"winkelTripel",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(i,r){r*=j,i*=j;const n=Math.cos(r),o=2/Math.PI,s=Math.acos(n*Math.cos(i/2)),a=Math.sin(s)/s,l=.5*(i*o+2*n*Math.sin(i/2)/a)||0,c=.5*(r+Math.sin(r)/a)||0;return{x:.5*(l/Math.PI+.5),y:1-.5*(c/Math.PI+1),z:0}},unproject(i,r){let n=i=(2*i-.5)*Math.PI,o=r=(2*(1-r)-1)*Math.PI,s=25,a=0,l=0;do{const c=Math.cos(o),h=Math.sin(o),u=2*h*c,d=h*h,p=c*c,f=Math.cos(n/2),m=Math.sin(n/2),$=2*f*m,g=m*m,y=1-p*f*f,x=y?1/y:0,v=y?Math.acos(c*f)*Math.sqrt(1/y):0,b=.5*(2*v*c*m+2*n/Math.PI)-i,w=.5*(v*h+o)-r,T=.5*x*(p*g+v*c*f*d)+1/Math.PI,E=x*($*u/4-v*h*m),S=.125*x*(u*m-v*h*p*$),I=.5*x*(d*f+v*g*c)+.5,M=E*S-I*T;a=(w*E-b*I)/M,l=(b*S-w*T)/M,n=K(n-a,-Math.PI,Math.PI),o=K(o-l,-ui,ui)}while((Math.abs(a)>1e-6||Math.abs(l)>1e-6)&&--s>0)return new sh(n*G,o*G)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sd(i)*r,farthestPixelDistance(i){return hN(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new h8(i,r)}};i.ARRAY_TYPE=u,i.AUTH_ERR_MSG=eB,i.Aabb=sX,i.Actor=class{constructor(i,r,n){this.target=i,this.parent=r,this.mapId=n,this.callbacks={},this.cancelCallbacks={},ea(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=e$()?i:h,this.scheduler=new class{constructor(){this.tasks={},this.taskQueue=[],ea(["process"],this),this.invoker=new class{constructor(i){this._callback=i,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(i,r){const n=this.nextId++,o=function({type:i,isSymbolTile:r,zoom:n}){return n=n||0,"message"===i?0:"maybePrepare"!==i||r?"parseTile"!==i||r?"parseTile"===i&&r?300-n:"maybePrepare"===i&&r?400-n:500:200-n:100-n}(r);return 0===o?(e$(),i(),{cancel(){}}):(this.tasks[n]={fn:i,metadata:r,priority:o,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}})}process(){e$();{if(this.taskQueue=this.taskQueue.filter(i=>!!this.tasks[i]),!this.taskQueue.length)return;const i=this.pick();if(null===i)return;const r=this.tasks[i];if(delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),!r)return;r.fn()}}pick(){let i=null,r=1/0;for(let n=0;n{n&&delete this.callbacks[l],this.target.postMessage({id:l,type:"",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const r=i.data,n=r.id;if(n&&(!r.targetMapId||this.mapId===r.targetMapId)){if(""===r.type){const o=this.cancelCallbacks[n];delete this.cancelCallbacks[n],o&&o.cancel()}else if(r.mustQueue||e$()){const s=this.callbacks[n];this.cancelCallbacks[n]=this.scheduler.add(()=>this.processTask(n,r),s&&s.metadata||{type:"message"})}else this.processTask(n,r)}}processTask(i,r){if(""===r.type){const n=this.callbacks[i];delete this.callbacks[i],n&&(r.error?n(ne(r.error)):n(null,ne(r.data)))}else{const o=ew(this.globalScope)?void 0:[],s=r.hasCallback?(r,n)=>{delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:r?r7(r):null,data:r7(n,o)},o)}:i=>{},a=ne(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,a,s);else if(this.parent.getWorkerSource){const l=r.type.split(".");this.parent.getWorkerSource(r.sourceMapId,l[0],a.source)[l[1]](a,s)}else s(Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.CanonicalTileID=c2,i.Color=tF,i.ColorMode=c9,i.CullFaceMode=c7,i.DEMData=hh,i.DataConstantProperty=n3,i.DedupedRequest=h5,i.DepthMode=c6,i.EXTENT=8192,i.Elevation=class{getAtPointOrZero(i,r=0){return this.getAtPoint(i,r)||0}getAtPoint(i,r,n=!0){null==r&&(r=null);const o=this._source();if(!o||i.y<0||i.y>1)return r;const s=o.getSource().maxzoom,a=1<{const o=this.getAtTileOffset(i,n.x,n.y),s=r.upVector(i.canonical,n.x,n.y);return A(s,s,o*r.upVectorScale(i.canonical)),s}}getForTilePoints(i,r,n,o){const s=hf.create(this,i,o);return!!s&&(r.forEach(i=>{i[2]=this.exaggeration()*s.getElevationAt(i[0],i[1],n)}),!0)}getMinMaxForTile(i){const r=this.findDEMTileFor(i);if(!r||!r.dem)return null;const n=r.dem.tree,o=r.tileID,s=1<Math.abs(o))return!1;const s=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1]+(i[2]-this.pos[2])*r[2])/o;return n[0]=this.pos[0]+this.dir[0]*s,n[1]=this.pos[1]+this.dir[1]*s,n[2]=this.pos[2]+this.dir[2]*s,!0}closestPointOnSphere(i,r,n){var o,s,a,l,c,h,u,d;if(o=this.pos,s=i,a=o[0],l=o[1],c=o[2],h=s[0],u=s[1],d=s[2],Math.abs(a-h)<=1e-6*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(l-u)<=1e-6*Math.max(1,Math.abs(l),Math.abs(u))&&Math.abs(c-d)<=1e-6*Math.max(1,Math.abs(c),Math.abs(d))||0===r)return n[0]=n[1]=n[2]=0,!1;const[p,f,m]=this.dir,$=this.pos[0]-i[0],g=this.pos[1]-i[1],y=this.pos[2]-i[2],x=p*p+f*f+m*m,v=2*($*p+g*f+y*m),b=v*v-4*x*($*$+g*g+y*y-r*r);if(b<0){const w=Math.max(-v/2,0),T=$+p*w,E=g+f*w,S=y+m*w,I=Math.hypot(T,E,S);return n[0]=T*r/I,n[1]=E*r/I,n[2]=S*r/I,!1}{const M=(-v-Math.sqrt(b))/(2*x);if(M<0){const A=Math.hypot($,g,y);return n[0]=$*r/A,n[1]=g*r/A,n[2]=y*r/A,!1}return n[0]=$+p*M,n[1]=g+f*M,n[2]=y+m*M,!0}}},i.RequestManager=class{constructor(i,r,n){this._transformRequestFn=i,this._customAccessToken=r,this._silenceAuthErrors=!!n,this._createSkuToken()}_createSkuToken(){const i=function(){let i="";for(let r=0;r<10;r++)i+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",i].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}normalizeStyleURL(i,r){if(!eR(i))return i;const n=eU(i);return n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!eR(i))return i;const n=eU(i);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeSourceURL(i,r){if(!eR(i))return i;const n=eU(i);return n.path=`/v4/${n.authority}.json`,n.params.push("secure"),this._makeAPIURL(n,this._customAccessToken||r)}normalizeSpriteURL(i,r,n,o){const s=eU(i);return eR(i)?(s.path=`/styles/v1${s.path}/sprite${r}${n}`,this._makeAPIURL(s,this._customAccessToken||o)):(s.path+=`${r}${n}`,eV(s))}normalizeTileURL(i,r,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!eR(i))return i;const o=eU(i);o.path=o.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||n&&"raster"!==o.authority&&512===n?"@2x":""}${eC.supported?".webp":"$1"}`),"raster"===o.authority?o.path=`/${eI.RASTER_URL_PREFIX}${o.path}`:(o.path=o.path.replace(/^.+\/v4\//,"/"),o.path=`/${eI.TILE_URL_VERSION}${o.path}`);const s=this._customAccessToken||function(i){for(const r of i){const n=r.match(/^access_token=(.*)$/);if(n)return n[1]}return null}(o.params)||eI.ACCESS_TOKEN;return eI.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&o.params.push(`sku=${this._skuToken}`),this._makeAPIURL(o,s)}canonicalizeTileURL(i,r){const n=eU(i);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return i;let o="mapbox://";n.path.match(/^\/raster\/v1\//)?o+=`raster/${n.path.replace(`/${eI.RASTER_URL_PREFIX}/`,"")}`:o+=`tiles/${n.path.replace(`/${eI.TILE_URL_VERSION}/`,"")}`;let s=n.params;return r&&(s=s.filter(i=>!i.match(/^access_token=/))),s.length&&(o+=`?${s.join("&")}`),o}canonicalizeTileset(i,r){const n=!!r&&eR(r),o=[];for(const s of i.tiles||[])eF(s)?o.push(this.canonicalizeTileURL(s,n)):o.push(s);return o}_makeAPIURL(i,r){const n="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",o=eU(eI.API_URL);if(i.protocol=o.protocol,i.authority=o.authority,"http"===i.protocol){const s=i.params.indexOf("secure");s>=0&&i.params.splice(s,1)}if("/"!==o.path&&(i.path=`${o.path}${i.path}`),!eI.REQUIRE_ACCESS_TOKEN)return eV(i);if(r=r||eI.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===r[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return i.params=i.params.filter(i=>-1===i.indexOf("access_token")),i.params.push(`access_token=${r||""}`),eV(i)}},i.ResourceType=e5,i.SegmentVector=sl,i.SourceCache=hu,i.StencilMode=c8,i.StructArrayLayout1ui2=oS,i.StructArrayLayout2f1f2i16=om,i.StructArrayLayout2i4=oo,i.StructArrayLayout2ui4=oE,i.StructArrayLayout3f12=ol,i.StructArrayLayout3ui6=og,i.StructArrayLayout4i8=os,i.Texture=cY,i.Tile=hF,i.Transitionable=nJ,i.Uniform1f=oH,i.Uniform1i=class extends oW{constructor(i,r){super(i,r),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},i.Uniform2f=class extends oW{constructor(i,r){super(i,r),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},i.Uniform3f=class extends oW{constructor(i,r){super(i,r),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},i.Uniform4f=oK,i.UniformColor=oY,i.UniformMatrix2f=class extends oW{constructor(i,r){super(i,r),this.current=o0}set(i){for(let r=0;r<4;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}},i.UniformMatrix3f=class extends oW{constructor(i,r){super(i,r),this.current=oQ}set(i){for(let r=0;r<9;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},i.UniformMatrix4f=class extends oW{constructor(i,r){super(i,r),this.current=oJ}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let r=1;r<16;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},i.UnwrappedTileID=c3,i.ValidationError=td,i.VectorTileWorkerSource=class extends th{constructor(i,r,n,o,s){super(),this.actor=i,this.layerIndex=r,this.availableImages=n,this.loadVectorData=s||h4,this.loading={},this.loaded={},this.deduped=new h5(i.scheduler),this.isSpriteLoaded=o,this.scheduler=i.scheduler}loadTile(i,r){const n=i.uid,o=i&&i.request,s=o&&o.collectResourceTiming,a=this.loading[n]=new h2(i);a.abort=this.loadVectorData(i,(l,c)=>{const h=!this.loading[n];if(delete this.loading[n],h||l||!c)return a.status="done",h||(this.loaded[n]=a),r(l);const u=c.rawData,d={};c.expires&&(d.expires=c.expires),c.cacheControl&&(d.cacheControl=c.cacheControl),a.vectorTile=c.vectorTile||new aW.VectorTile(new lw(u));const p=()=>{a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,(i,n)=>{if(i||!n)return r(i);const a={};if(s){const l=c0(o);l.length>0&&(a.resourceTiming=JSON.parse(JSON.stringify(l)))}r(null,et({rawTileData:u.slice(0)},n,d,a))})};this.isSpriteLoaded?p():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(p,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):p()}),this.loaded=this.loaded||{},this.loaded[n]=a})}reloadTile(i,r){const n=this.loaded,o=i.uid,s=this;if(n&&n[o]){const a=n[o];a.showCollisionBoxes=i.showCollisionBoxes,a.enableTerrain=!!i.enableTerrain,a.projection=i.projection;const l=(i,n)=>{const o=a.reloadCallback;o&&(delete a.reloadCallback,a.parse(a.vectorTile,s.layerIndex,this.availableImages,s.actor,o)),r(i,n)};"parsing"===a.status?a.reloadCallback=l:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,l):l())}}abortTile(i,r){const n=i.uid,o=this.loading[n];o&&(o.abort&&o.abort(),delete this.loading[n]),r()}removeTile(i,r){const n=this.loaded,o=i.uid;n&&n[o]&&delete n[o],r()}},i.WritingMode=l_,i.ZoomHistory=nt,i.add=E,i.addDynamicAttributes=ck,i.adjoint=function(i,r){var n=r[0],o=r[1],s=r[2],a=r[3],l=r[4],c=r[5],h=r[6],u=r[7],d=r[8];return i[0]=l*d-c*u,i[1]=s*u-o*d,i[2]=o*c-s*l,i[3]=c*h-a*d,i[4]=n*d-s*h,i[5]=s*a-n*c,i[6]=a*u-l*h,i[7]=o*h-n*u,i[8]=n*l-o*a,i},i.asyncAll=Q,i.bezier=W,i.bindAll=ea,i.boundsAttributes=hB,i.bufferConvexPolygon=function(i,r){const n=[];for(let o=0;oe0&&(i.getActor().send("enforceCacheSizeLimit",eQ),e3=0)},i.calculateGlobeMatrix=hJ,i.calculateGlobeMercatorMatrix=function(i){const r=i.worldSize,n=K(i.center.lat,-85.051129,85.051129),o=new l(sp(i.center.lng)*r,sf(n)*r),s=1/sd(i.center.lat)*r,a=i.pixelsPerMeter,c=r/(s/i.pixelsPerMeter),h=p(new Float64Array(16));return m(h,h,[o.x,o.y,0]),$(h,h,[c,c,a]),h},i.clamp=K,i.clearTileCache=function(i){const r=h.caches.delete(eK);i&&r.catch(i).then(()=>i())},i.clipLine=cr,i.clone=function(i){var r=new u(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r},i.clone$1=eu,i.collisionCircleLayout=lu,i.config=eI,i.conjugate=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},i.create=function(){var i=new u(16);return u!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},i.create$1=d,i.createExpression=ru,i.createLayout=or,i.createStyleLayer=function(i){return"custom"===i.type?new cj(i):new c_[i.type](i)},i.cross=P,i.degToRad=Z,i.div=function(i,r,n){return i[0]=r[0]/n[0],i[1]=r[1]/n[1],i[2]=r[2]/n[2],i},i.dot=k,i.ease=H,i.easeCubicInOut=X,i.emitValidationErrors=rQ,i.endsWith=el,i.enforceCacheSizeLimit=function(i){e1(),eY&&eY.then(r=>{r.keys().then(n=>{for(let o=0;oa&&(o+=(i[s]-a)*(i[s]-a)),r[s]Math.abs(r.parallels[0]+r.parallels[1])){let n=function(i){const r=Math.max(.01,Math.cos(i*j)),n=1/(2*Math.max(Math.PI*r,1/r));return{wrap:!0,supportsWorldCopies:!0,unsupportedLayers:["custom",],project(i,o){const s=Math.sin(o*j)/r;return{x:i*j*r*n+.5,y:-s*n+.5,z:0}},unproject(i,o){const s=K((i-.5)/n*G/r,-180,180),a=Math.asin(K(-(o-.5)/n*r,-1,1)),l=K(a*G,-85.051129,85.051129);return new sh(s,l)}}}(r.parallels[0]);if("lambertConformalConic"===r.name){const{project:o,unproject:s}=ur.mercator;n={wrap:!0,supportsWorldCopies:!0,project:o,unproject:s}}return et({},i,r,n)}return et({},i,r)}(r,i):r},i.getRTLTextPluginStatus=nq,i.getReferrer=e6,i.getTilePoint=function(i,{x:r,y:n},o=0){return new l(((r-o)*i.scale-i.x)*8192,(n*i.scale-i.y)*8192)},i.getTileVec3=function(i,r,n=0){return T(((r.x-n)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,sy(r.z,r.y))},i.getVideo=function(i,r){const n=h.document.createElement("video");n.muted=!0,n.onloadstart=function(){r(null,n)};for(let o=0;o0&&(l=1/Math.sqrt(l)),i[0]=n*l,i[1]=o*l,i[2]=s*l,i[3]=a*l,i},i.number=ix,i.ortho=function(i,r,n,o,s,a,l){var c=1/(r-n),h=1/(o-s),u=1/(a-l);return i[0]=-2*c,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*h,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*u,i[11]=0,i[12]=(r+n)*c,i[13]=(s+o)*h,i[14]=(l+a)*u,i[15]=1,i},i.pbf=lw,i.perspective=function(i,r,n,o,s){var a,l=1/Math.tan(r/2);return i[0]=l/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=l,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,null!=s&&s!==1/0?(i[10]=(s+o)*(a=1/(o-s)),i[14]=2*s*o*a):(i[10]=-1,i[14]=-2*o),i},i.pick=function(i,r){const n={};for(let o=0;othis._layers[i.id]),u=h[0];if("none"===u.visibility)continue;const d=u.source||"";let p=this.familiesBySource[d];p||(p=this.familiesBySource[d]={});const f=u.sourceLayer||"_geojsonTileLayer";let m=p[f];m||(m=p[f]=[]),m.push(h)}}}const{ImageBitmap:s}=i.window;class a{loadTile(r,n){const{uid:o,encoding:a,rawImageData:l,padding:c,buildQuadTree:h}=r,u=s&&l instanceof s?this.getImageData(l,c):l;n(null,new i.DEMData(o,u,a,c<1,h))}getImageData(r,n){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(r.width,r.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=r.width,this.offscreenCanvas.height=r.height,this.offscreenCanvasContext.drawImage(r,0,0,r.width,r.height);const o=this.offscreenCanvasContext.getImageData(-n,-n,r.width+2*n,r.height+2*n);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new i.RGBAImage({width:o.width,height:o.height},o.data)}}var l,c=function i(r,n){var o,s=r&&r.type;if("FeatureCollection"===s)for(o=0;o=Math.abs(c)?n-h+c:c-h+n,n=h}n+o>=0!=!!r&&i.reverse()}const d=i.vectorTile.VectorTileFeature.prototype.toGeoJSON;class p{constructor(r){this._feature=r,this.extent=i.EXTENT,this.type=r.type,this.properties=r.tags,"id"in r&&!isNaN(r.id)&&(this.id=parseInt(r.id,10))}loadGeometry(){if(1===this._feature.type){const r=[];for(const n of this._feature.geometry)r.push([new i.pointGeometry(n[0],n[1]),]);return r}{const o=[];for(const s of this._feature.geometry){const a=[];for(const l of s)a.push(new i.pointGeometry(l[0],l[1]));o.push(a)}return o}}toGeoJSON(i,r,n){return d.call(this,i,r,n)}}class f{constructor(r){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=r.length,this._features=r}feature(i){return new p(this._features[i])}}var m=i.vectorTile.VectorTileFeature,$=g;function g(i,r){this.options=r||{},this.features=i,this.length=i.length}function y(i,r){this.id="number"==typeof i.id?i.id:void 0,this.type=i.type,this.rawGeometry=1===i.type?[i.geometry]:i.geometry,this.properties=i.tags,this.extent=r||4096}g.prototype.feature=function(i){return new y(this.features[i],this.options.extent)},y.prototype.loadGeometry=function(){var r=this.rawGeometry;this.geometry=[];for(var n=0;n>31}function I(i,r){for(var n=i.loadGeometry(),o=i.type,s=0,a=0,l=n.length,c=0;ci[0],P=i=>i[1];class D{constructor(i,r=k,n=P,o=64,s=Float64Array){this.nodeSize=o,this.points=i;const a=i.length<65536?Uint16Array:Uint32Array,l=this.ids=new a(i.length),c=this.coords=new s(2*i.length);for(let h=0;h>1;(function i(r,n,o,s,a,l){for(;a>s;){if(a-s>600){const c=a-s+1,h=o-s+1,u=Math.log(c),d=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*d*(c-d)/c)*(h-c/2<0?-1:1);i(r,n,o,Math.max(s,Math.floor(o-h*d/c+p)),Math.min(a,Math.floor(o+(c-h)*d/c+p)),l)}const f=n[2*o+l];let m=s,$=a;for(A(r,n,s,o),n[2*a+l]>f&&A(r,n,s,a);m<$;){for(A(r,n,m,$),m++,$--;n[2*m+l]f;)$--}n[2*s+l]===f?A(r,n,s,$):A(r,n,++$,a),$<=o&&(s=$+1),o<=$&&(a=$-1)}})(r,n,c,s,a,l%2),i(r,n,o,s,c-1,l+1),i(r,n,o,c+1,a,l+1)}(l,c,o,0,l.length-1,0)}range(i,r,n,o){return function(i,r,n,o,s,a,l){const c=[0,i.length-1,0],h=[];let u,d;for(;c.length;){const p=c.pop(),f=c.pop(),m=c.pop();if(f-m<=l){for(let $=m;$<=f;$++)u=r[2*$],d=r[2*$+1],u>=n&&u<=s&&d>=o&&d<=a&&h.push(i[$]);continue}const g=Math.floor((m+f)/2);u=r[2*g],d=r[2*g+1],u>=n&&u<=s&&d>=o&&d<=a&&h.push(i[g]);const y=(p+1)%2;(0===p?n<=u:o<=d)&&(c.push(m),c.push(g-1),c.push(y)),(0===p?s>=u:a>=d)&&(c.push(g+1),c.push(f),c.push(y))}return h}(this.ids,this.coords,i,r,n,o,this.nodeSize)}within(i,r,n){return function(i,r,n,o,s,a){const l=[0,i.length-1,0],c=[],h=s*s;for(;l.length;){const u=l.pop(),d=l.pop(),p=l.pop();if(d-p<=a){for(let f=p;f<=d;f++)z(r[2*f],r[2*f+1],n,o)<=h&&c.push(i[f]);continue}const m=Math.floor((p+d)/2),$=r[2*m],g=r[2*m+1];z($,g,n,o)<=h&&c.push(i[m]);const y=(u+1)%2;(0===u?n-s<=$:o-s<=g)&&(l.push(p),l.push(m-1),l.push(y)),(0===u?n+s>=$:o+s>=g)&&(l.push(m+1),l.push(d),l.push(y))}return c}(this.ids,this.coords,i,r,n,this.nodeSize)}}const L=Math.fround||(l=new Float32Array(1),i=>(l[0]=+i,l[0]));class B{constructor(i){this.options=j(Object.create({minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:i=>i}),i),this.trees=Array(this.options.maxZoom+1)}load(i){const{log:r,minZoom:n,maxZoom:o,nodeSize:s}=this.options;r&&console.time("total time");const a=`prepare ${i.length} points`;r&&console.time(a),this.points=i;let l=[];for(let c=0;c=n;h--){const u=+Date.now();l=this._cluster(l,h),this.trees[h]=new D(l,G,Z,s,Float32Array),r&&console.log("z%d: %d clusters in %dms",h,l.length,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(i,r){let n=((i[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,i[1]));let s=180===i[2]?180:((i[2]+180)%360+360)%360-180;const a=Math.max(-90,Math.min(90,i[3]));if(i[2]-i[0]>=360)n=-180,s=180;else if(n>s){const l=this.getClusters([n,o,180,a],r),c=this.getClusters([-180,o,s,a],r);return l.concat(c)}const h=this.trees[this._limitZoom(r)],u=h.range(V(n),N(a),V(s),N(o)),d=[];for(const p of u){const f=h.points[p];d.push(f.numPoints?O(f):this.points[f.index])}return d}getChildren(i){const r=this._getOriginId(i),n=this._getOriginZoom(i),o="No cluster with the specified id.",s=this.trees[n];if(!s)throw Error(o);const a=s.points[r];if(!a)throw Error(o);const l=this.options.radius/(this.options.extent*Math.pow(2,n-1)),c=s.within(a.x,a.y,l),h=[];for(const u of c){const d=s.points[u];d.parentId===i&&h.push(d.numPoints?O(d):this.points[d.index])}if(0===h.length)throw Error(o);return h}getLeaves(i,r,n){const o=[];return this._appendLeaves(o,i,r=r||10,n=n||0,0),o}getTile(i,r,n){const o=this.trees[this._limitZoom(i)],s=Math.pow(2,i),{extent:a,radius:l}=this.options,c=l/a,h=(n-c)/s,u=(n+1+c)/s,d={features:[]};return this._addTileFeatures(o.range((r-c)/s,h,(r+1+c)/s,u),o.points,r,n,s,d),0===r&&this._addTileFeatures(o.range(1-c/s,h,1,u),o.points,s,n,s,d),r===s-1&&this._addTileFeatures(o.range(0,h,c/s,u),o.points,-1,n,s,d),d.features.length?d:null}getClusterExpansionZoom(i){let r=this._getOriginZoom(i)-1;for(;r<=this.options.maxZoom;){const n=this.getChildren(i);if(r++,1!==n.length)break;i=n[0].properties.cluster_id}return r}_appendLeaves(i,r,n,o,s){const a=this.getChildren(r);for(const l of a){const c=l.properties;if(c&&c.cluster?s+c.point_count<=o?s+=c.point_count:s=this._appendLeaves(i,c.cluster_id,n,o,s):sr&&(m+=g.numPoints||1)}if(m>f&&m>=l){let y=u.x*f,x=u.y*f,v=a&&f>1?this._map(u,!0):null;const b=(h<<5)+(r+1)+this.points.length;for(const w of p){const T=d.points[w];if(T.zoom<=r)continue;T.zoom=r;const E=T.numPoints||1;y+=T.x*E,x+=T.y*E,T.parentId=b,a&&(v||(v=this._map(u,!0)),a(v,this._map(T)))}u.parentId=b,n.push(R(y/m,x/m,b,m,v))}else if(n.push(u),m>1)for(const S of p){const I=d.points[S];I.zoom<=r||(I.zoom=r,n.push(I))}}return n}_getOriginId(i){return i-this.points.length>>5}_getOriginZoom(i){return(i-this.points.length)%32}_map(i,r){if(i.numPoints)return r?j({},i.properties):i.properties;const n=this.points[i.index].properties,o=this.options.map(n);return r&&o===n?j({},o):o}}function R(i,r,n,o,s){return{x:L(i),y:L(r),zoom:1/0,id:n,parentId:-1,numPoints:o,properties:s}}function F(i,r){const[n,o]=i.geometry.coordinates;return{x:L(V(n)),y:L(N(o)),zoom:1/0,index:r,parentId:-1}}function O(i){return{type:"Feature",id:i.id,properties:U(i),geometry:{type:"Point",coordinates:[360*(i.x-.5),function(i){const r=(180-360*i)*Math.PI/180;return 360*Math.atan(Math.exp(r))/Math.PI-90}(i.y),]}}}function U(i){const r=i.numPoints,n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r;return j(j({},i.properties),{cluster:!0,cluster_id:i.id,point_count:r,point_count_abbreviated:n})}function V(i){return i/360+.5}function N(i){const r=Math.sin(i*Math.PI/180),n=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return n<0?0:n>1?1:n}function j(i,r){for(const n in r)i[n]=r[n];return i}function G(i){return i.x}function Z(i){return i.y}function _(i,r,n,o,s,a){var l=s-n,c=a-o;if(0!==l||0!==c){var h=((i-n)*l+(r-o)*c)/(l*l+c*c);h>1?(n=s,o=a):h>0&&(n+=l*h,o+=c*h)}return(l=i-n)*l+(c=r-o)*c}function q(i,r,n,o){var s={id:void 0===i?null:i,type:r,geometry:n,tags:o,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(i){var r=i.geometry,n=i.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)X(i,r);else if("Polygon"===n||"MultiLineString"===n)for(var o=0;o0&&(l+=o?(s*u-h*a)/2:Math.sqrt(Math.pow(h-s,2)+Math.pow(u-a,2))),s=h,a=u}var d=r.length-3;r[2]=1,function i(r,n,o,s){for(var a,l=s,c=o-n>>1,h=o-n,u=r[n],d=r[n+1],p=r[o],f=r[o+1],m=n+3;ml)a=m,l=$;else if($===l){var g=Math.abs(m-c);gs&&(a-n>3&&i(r,n,a,s),r[a+2]=l,o-a>3&&i(r,a,o,s))}(r,0,d,n),r[d+2]=1,r.size=Math.abs(l),r.start=0,r.end=r.size}function Y(i,r,n,o){for(var s=0;s1?1:n}function ee(i,r,n,o,s,a,l,c){if(o/=r,a>=(n/=r)&&l=o)return null;for(var h=[],u=0;u=n&&$=o)){var g=[];if("Point"===f||"MultiPoint"===f)et(p,g,n,o,s);else if("LineString"===f)ei(p,g,n,o,s,!1,c.lineMetrics);else if("MultiLineString"===f)en(p,g,n,o,s,!1);else if("Polygon"===f)en(p,g,n,o,s,!0);else if("MultiPolygon"===f)for(var y=0;y=n&&l<=o&&(r.push(i[a]),r.push(i[a+1]),r.push(i[a+2]))}}function ei(i,r,n,o,s,a,l){for(var c,h,u=er(i),d=0===s?es:ea,p=i.start,f=0;fn&&(h=d(u,m,$,y,x,n),l&&(u.start=p+c*h)):v>o?b=n&&(h=d(u,m,$,y,x,n),w=!0),b>o&&v<=o&&(h=d(u,m,$,y,x,o),w=!0),!a&&w&&(l&&(u.end=p+c*h),r.push(u),u=er(i)),l&&(p+=c)}var T=i.length-3;m=i[T],$=i[T+1],g=i[T+2],(v=0===s?m:$)>=n&&v<=o&&eo(u,m,$,g),T=u.length-3,a&&T>=3&&(u[T]!==u[0]||u[T+1]!==u[1])&&eo(u,u[0],u[1],u[2]),u.length&&r.push(u)}function er(i){var r=[];return r.size=i.size,r.start=i.start,r.end=i.end,r}function en(i,r,n,o,s,a){for(var l=0;ll.maxX&&(l.maxX=d),p>l.maxY&&(l.maxY=p)}return l}function ep(i,r,n,o){var s=r.geometry,a=r.type,l=[];if("Point"===a||"MultiPoint"===a)for(var c=0;c0&&r.size<(s?l:o))n.numPoints+=r.length/3;else{for(var c=[],h=0;hl)&&(n.numSimplified++,c.push(r[h]),c.push(r[h+1])),n.numPoints++;s&&function(i,r){for(var n=0,o=0,s=i.length,a=s-2;o0===r)for(o=0,s=i.length;o24)throw Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw Error("promoteId and generateId cannot be used together.");var o,s,a,l,c,h,u=function(i,r){var n=[];if("FeatureCollection"===i.type)for(var o=0;o1&&console.time("creation"),f=this.tiles[p]=ed(i,r,n,o,h),this.tileCoords.push({z:r,x:n,y:o}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,o,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var m="z"+r;this.stats[m]=(this.stats[m]||0)+1,this.total++}if(f.source=i,s){if(r===h.maxZoom||r===s)continue;var $=1<1&&console.time("clipping");var g,y,x,v,b,w,T=.5*h.buffer/h.extent,E=.5-T,S=.5+T,I=1+T;g=y=x=v=null,b=ee(i,d,n-T,n+S,0,f.minX,f.maxX,h),w=ee(i,d,n+E,n+I,0,f.minX,f.maxX,h),i=null,b&&(g=ee(b,d,o-T,o+S,1,f.minY,f.maxY,h),y=ee(b,d,o+E,o+I,1,f.minY,f.maxY,h),b=null),w&&(x=ee(w,d,o-T,o+S,1,f.minY,f.maxY,h),v=ee(w,d,o+E,o+I,1,f.minY,f.maxY,h),w=null),u>1&&console.timeEnd("clipping"),c.push(g||[],r+1,2*n,2*o),c.push(y||[],r+1,2*n,2*o+1),c.push(x||[],r+1,2*n+1,2*o),c.push(v||[],r+1,2*n+1,2*o+1)}}},em.prototype.getTile=function(i,r,n){var o=this.options,s=o.extent,a=o.debug;if(i<0||i>24)return null;var l=1<1&&console.log("drilling down to z%d-%d-%d",i,r,n);for(var h,u=i,d=r,p=n;!h&&u>0;)u--,d=Math.floor(d/2),p=Math.floor(p/2),h=this.tiles[e$(u,d,p)];return h&&h.source?(a>1&&console.log("found parent tile z%d-%d-%d",u,d,p),a>1&&console.time("drilling down"),this.splitTile(h.source,u,d,p,i,r,n),a>1&&console.timeEnd("drilling down"),this.tiles[c]?eh(this.tiles[c],s):null):null};class eg extends i.VectorTileWorkerSource{constructor(i,r,n,o,s){super(i,r,n,o,function(i,r){const n=i.tileID.canonical;if(!this._geoJSONIndex)return r(null,null);const o=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!o)return r(null,null);const s=new f(o.features);let a=x(s);0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),r(null,{vectorTile:s,rawData:a.buffer})}),s&&(this.loadGeoJSON=s)}loadData(r,n){const o=r&&r.request,s=o&&o.collectResourceTiming;this.loadGeoJSON(r,(a,l)=>{if(a||!l)return n(a);if("object"!=typeof l)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{c(l,!0);try{var h,u;if(r.filter){const d=i.createExpression(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===d.result)throw Error(d.value.map(i=>`${i.key}: ${i.message}`).join(", "));const p=l.features.filter(i=>d.value.evaluate({zoom:0},i));l={type:"FeatureCollection",features:p}}this._geoJSONIndex=r.cluster?new B(function({superclusterOptions:r,clusterProperties:n}){if(!n||!r)return r;const o={},s={},a={accumulated:null,zoom:0},l={properties:null},c=Object.keys(n);for(const h of c){const[u,d]=n[h],p=i.createExpression(d),f=i.createExpression("string"==typeof u?[u,["accumulated",],["get",h,],]:u);o[h]=p.value,s[h]=f.value}return r.map=i=>{l.properties=i;const r={};for(const n of c)r[n]=o[n].evaluate(a,l);return r},r.reduce=(i,r)=>{for(const n of(l.properties=r,c))a.accumulated=i[n],i[n]=s[n].evaluate(a,l)},r}(r)).load(l.features):(h=l,u=r.geojsonVtOptions,new em(h,u))}catch(f){return n(f)}this.loaded={};const m={};if(s){const $=i.getPerformanceMeasurement(o);$&&(m.resourceTiming={},m.resourceTiming[r.source]=JSON.parse(JSON.stringify($)))}n(null,m)}})}reloadTile(i,r){const n=this.loaded;return n&&n[i.uid]?super.reloadTile(i,r):this.loadTile(i,r)}loadGeoJSON(r,n){if(r.request)i.getJSON(r.request,n);else{if("string"!=typeof r.data)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));try{return n(null,JSON.parse(r.data))}catch(o){return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(i,r){try{r(null,this._geoJSONIndex.getClusterExpansionZoom(i.clusterId))}catch(n){r(n)}}getClusterChildren(i,r){try{r(null,this._geoJSONIndex.getChildren(i.clusterId))}catch(n){r(n)}}getClusterLeaves(i,r){try{r(null,this._geoJSONIndex.getLeaves(i.clusterId,i.limit,i.offset))}catch(n){r(n)}}}class ey{constructor(r){this.self=r,this.actor=new i.Actor(r,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=i.getProjection({name:"mercator"}),this.workerSourceTypes={vector:i.VectorTileWorkerSource,geojson:eg},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(i,r)=>{if(this.workerSourceTypes[i])throw Error(`Worker source with name "${i}" already registered.`);this.workerSourceTypes[i]=r},this.self.registerRTLTextPlugin=r=>{if(i.plugin.isParsed())throw Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=r.applyArabicShaping,i.plugin.processBidirectionalText=r.processBidirectionalText,i.plugin.processStyledBidirectionalText=r.processStyledBidirectionalText}}clearCaches(i,r,n){delete this.layerIndexes[i],delete this.availableImages[i],delete this.workerSources[i],delete this.demWorkerSources[i],n()}checkIfReady(i,r,n){n()}setReferrer(i,r){this.referrer=r}spriteLoaded(r,n){for(const o in this.isSpriteLoaded[r]=n,this.workerSources[r]){const s=this.workerSources[r][o];for(const a in s)s[a]instanceof i.VectorTileWorkerSource&&(s[a].isSpriteLoaded=n,s[a].fire(new i.Event("isSpriteLoaded")))}}setImages(i,r,n){for(const o in this.availableImages[i]=r,this.workerSources[i]){const s=this.workerSources[i][o];for(const a in s)s[a].availableImages=r}n()}enableTerrain(i,r,n){this.terrain=r,n()}setProjection(r,n){this.projections[r]=i.getProjection(n)}setLayers(i,r,n){this.getLayerIndex(i).replace(r),n()}updateLayers(i,r,n){this.getLayerIndex(i).update(r.layers,r.removedIds),n()}loadTile(r,n,o){const s=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;s.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).loadTile(s,o)}loadDEMTile(r,n,o){const s=this.enableTerrain?i.extend({buildQuadTree:this.terrain},n):n;this.getDEMWorkerSource(r,n.source).loadTile(s,o)}reloadTile(r,n,o){const s=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;s.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).reloadTile(s,o)}abortTile(i,r,n){this.getWorkerSource(i,r.type,r.source).abortTile(r,n)}removeTile(i,r,n){this.getWorkerSource(i,r.type,r.source).removeTile(r,n)}removeSource(i,r,n){if(!this.workerSources[i]||!this.workerSources[i][r.type]||!this.workerSources[i][r.type][r.source])return;const o=this.workerSources[i][r.type][r.source];delete this.workerSources[i][r.type][r.source],void 0!==o.removeSource?o.removeSource(r,n):n()}loadWorkerSource(i,r,n){try{this.self.importScripts(r.url),n()}catch(o){n(o.toString())}}syncRTLPluginState(r,n,o){try{i.plugin.setState(n);const s=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&null!=s){this.self.importScripts(s);const a=i.plugin.isParsed();o(a?void 0:Error(`RTL Text Plugin failed to import scripts from ${s}`),a)}}catch(l){o(l.toString())}}getAvailableImages(i){let r=this.availableImages[i];return r||(r=[]),r}getLayerIndex(i){let r=this.layerIndexes[i];return r||(r=this.layerIndexes[i]=new o),r}getWorkerSource(i,r,n){return this.workerSources[i]||(this.workerSources[i]={}),this.workerSources[i][r]||(this.workerSources[i][r]={}),this.workerSources[i][r][n]||(this.workerSources[i][r][n]=new this.workerSourceTypes[r]({send:(r,n,o,s,a,l)=>{this.actor.send(r,n,o,i,a,l)},scheduler:this.actor.scheduler},this.getLayerIndex(i),this.getAvailableImages(i),this.isSpriteLoaded[i])),this.workerSources[i][r][n]}getDEMWorkerSource(i,r){return this.demWorkerSources[i]||(this.demWorkerSources[i]={}),this.demWorkerSources[i][r]||(this.demWorkerSources[i][r]=new a),this.demWorkerSources[i][r]}enforceCacheSizeLimit(r,n){i.enforceCacheSizeLimit(n)}getWorkerPerformanceMetrics(i,r,n){n(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new ey(self)),ey}),o(["./shared"],function(i){var r=n;function n(i){var r,s;return r=i,"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 i,r,n=new Blob([""],{type:"text/javascript"}),o=URL.createObjectURL(n);try{r=new Worker(o),i=!0}catch(s){i=!1}return r&&r.terminate(),URL.revokeObjectURL(o),i}()&&"Uint8ClampedArray"in window&&!!ArrayBuffer.isView&&!!function(){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");if(!r)return!1;var n=r.getImageData(0,0,1,1);return n&&n.width===i.width}()&&(void 0===o[s=r&&r.failIfMajorPerformanceCaveat]&&(o[s]=function(i){var r,o,s,a,l=(r=i,o=document.createElement("canvas"),(s=Object.create(n.webGLContextAttributes)).failIfMajorPerformanceCaveat=r,o.getContext("webgl",s)||o.getContext("experimental-webgl",s));if(!l)return!1;try{a=l.createShader(l.VERTEX_SHADER)}catch(c){return!1}return!(!a||l.isContextLost())&&(l.shaderSource(a,"void main() {}"),l.compileShader(a),!0===l.getShaderParameter(a,l.COMPILE_STATUS))}(s)),!!o[s]&&!document.documentMode)}var o={};function s(i,r){var n=r[0],o=r[1],s=r[2],a=r[3],l=n*a-s*o;return l?(i[0]=a*(l=1/l),i[1]=-o*l,i[2]=-s*l,i[3]=n*l,i):null}function a(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let n=0;n{i.window.removeEventListener("click",d,!0)},0)},l.mousePos=function(i,r){const n=i.getBoundingClientRect();return p(i,n,r)},l.touchPos=function(i,r){const n=i.getBoundingClientRect(),o=[];for(let s=0;s=0?0:r.button};class m extends i.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(i){if(this.loaded!==i&&(this.loaded=i,i)){for(const{ids:r,callback:n}of this.requestors)this._notify(r,n);this.requestors=[]}}getImage(i){return this.images[i]}addImage(i,r){this._validate(i,r)&&(this.images[i]=r)}_validate(r,n){let o=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "content" value`))),o=!1),o}_validateStretch(i,r){if(!i)return!0;let n=0;for(const o of i){if(o[0]{this.ready=!0})}broadcast(r,n,o){i.asyncAll(this.actors,(i,o)=>{i.send(r,n,o)},o=o||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(i=>{i.remove()}),this.actors=[],this.workerPool.release(this.id)}}function A(r,n,o){return n*(i.EXTENT/(r.tileSize*Math.pow(2,o-r.tileID.overscaledZ)))}M.Actor=i.Actor;class C{constructor(i,r,n){this.context=i;const o=i.gl;this.buffer=o.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete r.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const z={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class k{constructor(i,r,n,o){this.length=r.length,this.attributes=n,this.itemSize=r.bytesPerElement,this.dynamicDraw=o,this.context=i;const s=i.gl;this.buffer=s.createBuffer(),i.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||delete r.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){const r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,r){for(let n=0;no.pointCoordinate3D(i)),this.cameraGeometry=this.bufferedCameraGeometry(0)}static createFromScreenPoints(r,n){let o,s;if(r instanceof i.pointGeometry||"number"==typeof r[0]){const a=i.pointGeometry.convert(r);o=[i.pointGeometry.convert(r)],s=n.isPointAboveHorizon(a)}else{const l=i.pointGeometry.convert(r[0]),c=i.pointGeometry.convert(r[1]);o=[l,c],s=i.polygonizeBounds(l,c).every(i=>n.isPointAboveHorizon(i))}return new F(o,n.getCameraPoint(),s,n)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(r){return i.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const n=this.screenBounds[0],o=1===this.screenBounds.length?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],s=i.polygonizeBounds(n,o,0,!1);return this.cameraPoint.y>o.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x=o.x?s[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(s[3]=this.cameraPoint)),i.bufferConvexPolygon(s,r)}containsTile(r,n,o){var s;const a=r.queryPadding+1,l=r.tileID.wrap,c=o?this._bufferedCameraMercator(a,n).map(n=>i.getTilePoint(r.tileTransform,n,l)):this._bufferedScreenMercator(a,n).map(n=>i.getTilePoint(r.tileTransform,n,l)),h=this.screenGeometryMercator.map(n=>i.getTileVec3(r.tileTransform,n,l)),u=h.map(r=>new i.pointGeometry(r[0],r[1])),d=n.getFreeCameraOptions().position||new i.MercatorCoordinate(0,0,0),p=i.getTileVec3(r.tileTransform,d,l),f=h.map(r=>{const n=i.sub(r,r,p);return i.normalize(n,n),new i.Ray(p,n)}),m=A(r,1,n.zoom);if(i.polygonIntersectsBox(c,0,0,i.EXTENT,i.EXTENT))return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:f,bufferedTilespaceGeometry:c,bufferedTilespaceBounds:((s=i.getBounds(c)).min.x=i.clamp(s.min.x,0,i.EXTENT),s.min.y=i.clamp(s.min.y,0,i.EXTENT),s.max.x=i.clamp(s.max.x,0,i.EXTENT),s.max.y=i.clamp(s.max.y,0,i.EXTENT),s),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:m}}_bufferedScreenMercator(i,r){const n=O(i);if(this._screenRaycastCache[n])return this._screenRaycastCache[n];{const o=this.bufferedScreenGeometry(i).map(i=>r.pointCoordinate3D(i));return this._screenRaycastCache[n]=o,o}}_bufferedCameraMercator(i,r){const n=O(i);if(this._cameraRaycastCache[n])return this._cameraRaycastCache[n];{const o=this.bufferedCameraGeometry(i).map(i=>r.pointCoordinate3D(i));return this._cameraRaycastCache[n]=o,o}}}function O(i){return 100*i|0}function U(r,n,o){const s=function(s,a){if(s)return o(s);if(a){const l=i.pick(i.extend(a,r),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding",]);a.vector_layers&&(l.vectorLayers=a.vector_layers,l.vectorLayerIds=l.vectorLayers.map(i=>i.id)),l.tiles=n.canonicalizeTileset(l,r.url),o(null,l)}};return r.url?i.getJSON(n.transformRequest(n.normalizeSourceURL(r.url),i.ResourceType.Source),s):i.exported.frame(()=>s(null,r))}class V{constructor(r,n,o){this.bounds=i.LngLatBounds.convert(this.validateBounds(r)),this.minzoom=n||0,this.maxzoom=o||24}validateBounds(i){return Array.isArray(i)&&4===i.length?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3]),]:[-180,-90,180,90]}contains(r){const n=Math.pow(2,r.z),o=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*n),s=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*n),a=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*n),l=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*n);return r.x>=o&&r.x=s&&r.y{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(i.extend(this,n),n.bounds&&(this.tileBounds=new V(n.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(n.tiles),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(r,n){const o=i.exported.devicePixelRatio>=2,s=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),o,this.tileSize);r.request=i.getImage(this.map._requestManager.transformRequest(s,i.ResourceType.Tile),(o,s,a,l)=>{if(delete r.request,r.aborted)r.state="unloaded",n(null);else if(o)r.state="errored",n(o);else if(s){this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:a,expires:l});const c=this.map.painter.context,h=c.gl;r.texture=this.map.painter.getTileTexture(s.width),r.texture?r.texture.update(s,{useMipmap:!0}):(r.texture=new i.Texture(c,s,h.RGBA,{useMipmap:!0}),r.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE),c.extTextureFilterAnisotropic&&h.texParameterf(h.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax)),r.state="loaded",i.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(i,r){i.request&&(i.request.cancel(),delete i.request),r()}unloadTile(i,r){i.texture&&this.map.painter.saveTileTexture(i.texture),r()}hasTransition(){return!1}}let j;function G(r,n,o,s,a,l,c,h){const u=[r,o,a,n,s,l,1,1,1],d=[c,h,1],p=i.adjoint([],u),[f,m,$]=i.transformMat3(d,d,i.transpose(p,p));return i.multiply(u,[f,0,0,0,m,0,0,0,$],u)}class Z extends i.Evented{constructor(i,r,n,o){super(),this.id=i,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=r}load(r,n){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),(o,s)=>{this._loaded=!0,o?this.fire(new i.ErrorEvent(o)):s&&(this.image=i.exported.getImageData(s),this.width=this.image.width,this.height=this.image.height,r&&(this.coordinates=r),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(i){return this.image&&i.url&&(this.options.url=i.url,this.load(i.coordinates,()=>{this.texture=null})),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}setCoordinates(r){this.coordinates=r,delete this._boundsArray;const n=r.map(i.MercatorCoordinate.fromLngLat);return this.tileID=function(r){let n=1/0,o=1/0,s=-1/0,a=-1/0;for(const l of r)n=Math.min(n,l.x),o=Math.min(o,l.y),s=Math.max(s,l.x),a=Math.max(a,l.y);const c=Math.max(s-n,a-o),h=Math.max(0,Math.floor(-Math.log(c)/Math.LN2)),u=Math.pow(2,h);return new i.CanonicalTileID(h,Math.floor((n+s)/2*u),Math.floor((o+a)/2*u))}(n),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){delete this._boundsArray}_makeBoundsArray(){const r=i.tileTransform(this.tileID,this.map.transform.projection),[n,o,s,a]=this.coordinates.map(n=>{const o=r.projection.project(n[0],n[1]);return i.getTilePoint(r,o)._round()});return this.perspectiveTransform=function(r,n,o,s,a,l,c,h,u,d){const p=G(0,0,r,0,0,n,r,n),f=G(o,s,a,l,c,h,u,d);return i.multiply(f,i.adjoint(p,p),f),[f[6]/f[8]*r/i.EXTENT,f[7]/f[8]*n/i.EXTENT,]}(this.width,this.height,n.x,n.y,o.x,o.y,a.x,a.y,s.x,s.y),this._boundsArray=new i.StructArrayLayout4i8,this._boundsArray.emplaceBack(n.x,n.y,0,0),this._boundsArray.emplaceBack(o.x,o.y,i.EXTENT,0),this._boundsArray.emplaceBack(a.x,a.y,0,i.EXTENT),this._boundsArray.emplaceBack(s.x,s.y,i.EXTENT,i.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const r=this.map.painter.context,n=r.gl;for(const o in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new i.Texture(r,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this.tiles){const s=this.tiles[o];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture)}}loadTile(i,r){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={},r(null)):(i.state="errored",r(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const _={vector:class extends i.Evented{constructor(r,n,o,s){if(super(),this.id=r,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(n,["url","scheme","tileSize","promoteId",])),this._options=i.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(s),this._tileWorkers={},this._deduped=new i.DedupedRequest}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=U(this._options,this.map._requestManager,(r,n)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(i.extend(this,n),n.bounds&&(this.tileBounds=new V(n.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(n.tiles,this.map._requestManager._customAccessToken),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}setSourceProperty(i){this._tileJSONRequest&&this._tileJSONRequest.cancel(),i();const r=this.map.style._getSourceCaches(this.id);for(const n of r)n.clearTiles();this.load()}setTiles(i){return this.setSourceProperty(()=>{this._options.tiles=i}),this}setUrl(i){return this.setSourceProperty(()=>{this.url=i,this._options.url=i}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}loadTile(r,n){const o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),s={request:this.map._requestManager.transformRequest(o,i.ResourceType.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile};if(s.request.collectResourceTiming=this._collectResourceTiming,r.actor&&"expired"!==r.state)"loading"===r.state?r.reloadCallback=n:r.request=r.actor.send("reloadTile",s,l.bind(this));else if(r.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",s,l.bind(this),void 0,!0);else{const a=i.loadVectorTile.call({deduped:this._deduped},s,(i,n)=>{i||!n?l.call(this,i):(s.data={cacheControl:n.cacheControl,expires:n.expires,rawData:n.rawData.slice(0)},r.actor&&r.actor.send("loadTile",s,l.bind(this),void 0,!0))},!0);r.request={cancel:a}}function l(o,s){return delete r.request,r.aborted?n(null):o&&404!==o.status?n(o):(s&&s.resourceTiming&&(r.resourceTiming=s.resourceTiming),this.map._refreshExpiredTiles&&s&&r.setExpiryData(s),r.loadVectorData(s,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.type,source:this.id})}unloadTile(i){i.unloadVectorData(),i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:N,"raster-dem":class extends N{constructor(r,n,o,s){super(r,n,o,s),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(r,n){const o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function s(i,o){i&&(r.state="errored",n(i)),o&&(r.dem=o,r.dem.onDeserialize(),r.needsHillshadePrepare=!0,r.needsDEMTextureUpload=!0,r.state="loaded",n(null))}r.request=i.getImage(this.map._requestManager.transformRequest(o,i.ResourceType.Tile),(function(o,a,l,c){if(delete r.request,r.aborted)r.state="unloaded",n(null);else if(o)r.state="errored",n(o);else if(a){this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:l,expires:c});const h=i.window.ImageBitmap&&a instanceof i.window.ImageBitmap&&(null==j&&(j=i.window.OffscreenCanvas&&new i.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof i.window.createImageBitmap),j),u=1-(a.width-i.prevPowerOfTwo(a.width))/2;u<1||r.neighboringTiles||(r.neighboringTiles=this._getNeighboringTiles(r.tileID));const d=h?a:i.exported.getImageData(a,u),p={uid:r.uid,coord:r.tileID,source:this.id,rawImageData:d,encoding:this.encoding,padding:u};r.actor&&"expired"!==r.state||(r.actor=this.dispatcher.getActor(),r.actor.send("loadDEMTile",p,s.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(r){const n=r.canonical,o=Math.pow(2,n.z),s=(n.x-1+o)%o,a=0===n.x?r.wrap-1:r.wrap,l=(n.x+1+o)%o,c=n.x+1===o?r.wrap+1:r.wrap,h={};return h[new i.OverscaledTileID(r.overscaledZ,a,n.z,s,n.y).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,c,n.z,l,n.y).key]={backfilled:!1},n.y>0&&(h[new i.OverscaledTileID(r.overscaledZ,a,n.z,s,n.y-1).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,r.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,c,n.z,l,n.y-1).key]={backfilled:!1}),n.y+1{if(this._loaded=!0,this._pendingLoad=null,r)this.fire(new i.ErrorEvent(r));else{const o={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(o.resourceTiming=n.resourceTiming[this.id]),this.fire(new i.Event("data",o)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(r,n){const o=r.actor?"reloadTile":"loadTile";r.actor=this.actor,r.request=this.actor.send(o,{type:this.type,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(i,s)=>(delete r.request,r.unloadVectorData(),r.aborted?n(null):i?n(i):(r.loadVectorData(s,this.map.painter,"reloadTile"===o),n(null))),void 0,"loadTile"===o)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.aborted=!0}unloadTile(i){i.unloadVectorData(),this.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return i.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends Z{constructor(i,r,n,o){super(i,r,n,o),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;const r=this.options;for(const n of(this.urls=[],r.urls))this.urls.push(this.map._requestManager.transformRequest(n,i.ResourceType.Source).url);i.getVideo(this.urls,(r,n)=>{this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(this.video=n,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(r){if(this.video){const n=this.video.seekable;rn.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(i){this.map||(this.map=i,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 r=this.map.painter.context,n=r.gl;for(const o in this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture(r,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.tiles){const s=this.tiles[o];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:Z,canvas:class extends Z{constructor(r,n,o,s){super(r,n,o,s),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(i=>!Array.isArray(i)||2!==i.length||i.some(i=>"number"!=typeof i))||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof i.window.HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;const n=this.map.painter.context,o=n.gl;for(const s in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(n,this.canvas,o.RGBA,{premultiply:!0}),this.tiles){const a=this.tiles[s];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const i of[this.canvas.width,this.canvas.height,])if(isNaN(i)||i<=0)return!0;return!1}}},q=function(r,n,o,s){const a=new _[n.type](r,n,o,s);if(a.id!==r)throw Error(`Expected Source id to be ${r} instead of ${a.id}`);return i.bindAll(["load","abort","unload","serialize","prepare",],a),a};function X(r,n){const o=i.identity([]);return i.scale(o,o,[.5*r.width,-(.5*r.height),1,]),i.translate(o,o,[1,-1,0]),i.multiply$1(o,o,r.calculateProjMatrix(n.toUnwrapped()))}function W(i,r,n,o,s,a,l,c=!1){const h=i.tilesIn(o,l,c);h.sort(K);const u=[];for(const d of h)u.push({wrappedTileID:d.tile.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(r,n,i._state,d,s,a,X(i.transform,d.tile.tileID),c)});const p=function(i){const r={},n={};for(const o of i){const s=o.queryResults,a=o.wrappedTileID,l=n[a]=n[a]||{};for(const c in s){const h=s[c],u=l[c]=l[c]||{},d=r[c]=r[c]||[];for(const p of h)u[p.featureIndex]||(u[p.featureIndex]=!0,d.push(p))}}return r}(u);for(const f in p)p[f].forEach(r=>{const n=r.feature,o=i.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o});return p}function H(i,r){const n=i.getRenderableIds().map(r=>i.getTileByID(r)),o=[],s={};for(let a=0;a{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[J]}numActive(){return Object.keys(this.active).length}}let ee;function et(){return ee||(ee=new Q),ee}function ei(r,n){const o={};for(const s in r)"ref"!==s&&(o[s]=r[s]);return i.refProperties.forEach(i=>{i in n&&(o[i]=n[i])}),o}function er(i){i=i.slice();const r=Object.create(null);for(let n=0;n0?(s-l)/c:0;return this.points[a].mult(1-h).add(this.points[n].mult(h))}}class ep{constructor(i,r,n){const o=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(i/n),this.yCellCount=Math.ceil(r/n);for(let a=0;athis.width||o<0||r>this.height)return!s&&[];const l=[];if(i<=0&&r<=0&&this.width<=n&&this.height<=o){if(s)return!0;for(let c=0;c0:l}_queryCircle(i,r,n,o,s){const a=i-n,l=i+n,c=r-n,h=r+n;if(l<0||a>this.width||h<0||c>this.height)return!o&&[];const u=[];return this._forEachCell(a,c,l,h,this._queryCellCircle,u,{hitTest:o,circle:{x:i,y:r,radius:n},seenUids:{box:{},circle:{}}},s),o?u.length>0:u}query(i,r,n,o,s){return this._query(i,r,n,o,!1,s)}hitTest(i,r,n,o,s){return this._query(i,r,n,o,!0,s)}hitTestCircle(i,r,n,o){return this._queryCircle(i,r,n,!0,o)}_queryCell(i,r,n,o,s,a,l,c){const h=l.seenUids,u=this.boxCells[s];if(null!==u){const d=this.bboxes;for(const p of u)if(!h.box[p]){h.box[p]=!0;const f=4*p;if(i<=d[f+2]&&r<=d[f+3]&&n>=d[f+0]&&o>=d[f+1]&&(!c||c(this.boxKeys[p]))){if(l.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[p],x1:d[f],y1:d[f+1],x2:d[f+2],y2:d[f+3]})}}}const m=this.circleCells[s];if(null!==m){const $=this.circles;for(const g of m)if(!h.circle[g]){h.circle[g]=!0;const y=3*g;if(this._circleAndRectCollide($[y],$[y+1],$[y+2],i,r,n,o)&&(!c||c(this.circleKeys[g]))){if(l.hitTest)return a.push(!0),!0;{const x=$[y],v=$[y+1],b=$[y+2];a.push({key:this.circleKeys[g],x1:x-b,y1:v-b,x2:x+b,y2:v+b})}}}}}_queryCellCircle(i,r,n,o,s,a,l,c){const h=l.circle,u=l.seenUids,d=this.boxCells[s];if(null!==d){const p=this.bboxes;for(const f of d)if(!u.box[f]){u.box[f]=!0;const m=4*f;if(this._circleAndRectCollide(h.x,h.y,h.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!c||c(this.boxKeys[f])))return a.push(!0),!0}}const $=this.circleCells[s];if(null!==$){const g=this.circles;for(const y of $)if(!u.circle[y]){u.circle[y]=!0;const x=3*y;if(this._circlesCollide(g[x],g[x+1],g[x+2],h.x,h.y,h.radius)&&(!c||c(this.circleKeys[y])))return a.push(!0),!0}}}_forEachCell(i,r,n,o,s,a,l,c){const h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r),d=this._convertToXCellCoord(n),p=this._convertToYCellCoord(o);for(let f=h;f<=d;f++)for(let m=u;m<=p;m++)if(s.call(this,i,r,n,o,this.xCellCount*m+f,a,l,c))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,r,n,o,s,a){const l=o-i,c=s-r,h=n+a;return h*h>l*l+c*c}_circleAndRectCollide(i,r,n,o,s,a,l){const c=(a-o)/2,h=Math.abs(i-(o+c));if(h>c+n)return!1;const u=(l-s)/2,d=Math.abs(r-(s+u));if(d>u+n)return!1;if(h<=c||d<=u)return!0;const p=h-c,f=d-u;return p*p+f*f<=n*n}}const ef=Math.tan(85*Math.PI/180);function em(r,n,o,a,l,c){let h=i.create();if(o){if("globe"===l.projection.name)h=i.calculateGlobeMatrix(l,l.worldSize/l._projectionScaler,[0,0]),i.multiply$1(h,h,i.globeDenormalizeECEF(i.globeTileBounds(n)));else{const u=s([],c);h[0]=u[0],h[1]=u[1],h[4]=u[2],h[5]=u[3]}a||i.rotateZ(h,h,l.angle)}else i.multiply$1(h,l.labelPlaneMatrix,r);return h}function e$(r,n,o,s,a,l){if(o){if("globe"===a.projection.name){const c=em(r,n,o,s,a,l);return i.invert(c,c),i.multiply$1(c,r,c),c}{const h=i.clone(r),u=i.identity([]);return u[0]=l[0],u[1]=l[1],u[4]=l[2],u[5]=l[3],i.multiply$1(h,h,u),s||i.rotateZ(h,h,-a.angle),h}}return a.glCoordMatrix}function eg(r,n,o=0){const s=[r.x,r.y,o,1];o?i.transformMat4$1(s,s,n):eC(s,s,n);const a=s[3];return{point:new i.pointGeometry(s[0]/a,s[1]/a),signedDistanceFromCamera:a}}function ey(i,r){return Math.min(.5+i/r*.5,1.5)}function ex(i,r){const n=i[0]/i[3],o=i[1]/i[3];return n>=-r[0]&&n<=r[0]&&o>=-r[1]&&o<=r[1]}function ev(r,n,o,s,a,l,c,h,u,d){const p=o.transform,f=s?r.textSizeData:r.iconSizeData,m=i.evaluateSizeForZoom(f,o.transform.zoom),$=[256/o.width*2+1,256/o.height*2+1,],g=s?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;g.clear();const y=r.lineVertexArray,x=s?r.text.placedSymbolArray:r.icon.placedSymbolArray,v=o.transform.width/o.transform.height;let b=!1;for(let w=0;wMath.abs(o.x-n.x)*s?{useVertical:!0}:r.writingMode===i.WritingMode.vertical?n.yef}(n,o,s)?1===r.flipState?{needsFlipping:!0}:null:n.x>o.x?{needsFlipping:!0}:null}function eT(r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x){const v=n/24,b=r.lineOffsetX*v,w=r.lineOffsetY*v;let T;if(r.numGlyphs>1){const E=r.glyphStartIndex+r.numGlyphs,S=r.lineStartIndex,I=r.lineStartIndex+r.lineLength,M=eb(v,h,b,w,o,p,f,r,u,l,m,g,!1,y,x);if(!M)return{notEnoughRoom:!0};const A=eg(M.first.point,c).point,C=eg(M.last.point,c).point;if(s&&!o){const z=ew(r,A,C,$);if(r.flipState=z&&z.needsFlipping?1:2,z)return z}T=[M.first];for(let k=r.glyphStartIndex+1;k0?B.point:eS(f,L,P,1,a,void 0,y,x.canonical),$);if(r.flipState=R&&R.needsFlipping?1:2,R)return R}const F=eI(v*h.getoffsetX(r.glyphStartIndex),b,w,o,p,f,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,u,l,m,g,!1,!1,y,x);if(!F)return{notEnoughRoom:!0};T=[F]}for(const O of T)i.addDynamicAttributes(d,O.point,O.angle);return{}}function eE(r,n,o,s,a){const l=s.projectTilePoint(r.x,r.y,n);if(!a)return eg(l,o,l.z);const c=a(r);return eg(new i.pointGeometry(l.x+c[0],l.y+c[1]),o,l.z+c[2])}function eS(i,r,n,o,s,a,l,c){const h=eE(i.add(i.sub(r)._unit()),c,s,l,a).point,u=n.sub(h);return n.add(u._mult(o/u.mag()))}function eI(r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x){const v=s?r-n:r+n;let b=v>0?1:-1,w=0;s&&(b*=-1,w=Math.PI),b<0&&(w+=Math.PI);let T=b>0?h+c:h+c+1,E=a,S=a,I=0,M=0;const A=Math.abs(v),C=[],z=[];let k=l;const P=()=>{const r=T-b;return 0===I?l:new i.pointGeometry(d.getx(r),d.gety(r))},D=()=>eS(P(),k,S,A-I+1,p,m,y,x.canonical);for(;I+M<=A;){if((T+=b)=u)return null;if(S=E,C.push(E),$&&z.push(k||P()),void 0===(E=f[T])){k=new i.pointGeometry(d.getx(T),d.gety(T));const L=eE(k,x.canonical,p,y,m);E=L.signedDistanceFromCamera>0?f[T]=L.point:D()}else k=null;I+=M,M=S.dist(E)}g&&m&&(k=k||new i.pointGeometry(d.getx(T),d.gety(T)),f[T]=E=void 0===f[T]?E:D(),M=S.dist(E));const B=(A-I)/M,R=E.sub(S),F=R.mult(B)._add(S);o&&F._add(R._unit()._perp()._mult(o*b));const O=w+Math.atan2(E.y-S.y,E.x-S.x);return C.push(F),$&&(k=k||new i.pointGeometry(d.getx(T),d.gety(T)),z.push(function(r,n,o){const s=1-o;return new i.pointGeometry(r.x*s+n.x*o,r.y*s+n.y*o)}(z.length>0?z[z.length-1]:k,k,B))),{point:F,angle:O,path:C,tilePath:z}}const eM=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,]);function eA(i,r){for(let n=0;ni.sortKey-r.sortKey));this._currentPartIndex[0,0,0],b=new i.pointGeometry(n.tileAnchorX,n.tileAnchorY),w=this.transform.projection.projectTilePoint(n.tileAnchorX,n.tileAnchorY,$.canonical),T=v(b),E=[w.x+T[0],w.y+T[1],w.z+T[2]],S=this.projectAndGetPerspectiveRatio(l,E[0],E[1],E[2],$),{perspectiveRatio:I}=S,M=(d?a/I:a*I)/i.ONE_EM,A=eg(new i.pointGeometry(E[0],E[1]),c,E[2]).point,C=S.signedDistanceFromCamera>0?eb(M,s,n.lineOffsetX*M,n.lineOffsetY*M,!1,A,b,n,o,c,{},y&&!d?v:null,d&&!!y,this.transform.projection,$):null;let z=!1,k=!1,P=!0;if(C&&!S.aboveHorizon){const D=.5*f*I+m,L=new i.pointGeometry(-100,-100),B=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),R=new ed,F=C.first,O=C.last;let U=[];for(let V=F.path.length-1;V>=1;V--)U.push(F.path[V]);for(let N=1;N{const n=v(reg(i,h));U=G.some(i=>i.signedDistanceFromCamera<=0)?[]:G.map(i=>i.point)}let Z=[];if(U.length>0){const _=U[0].clone(),q=U[0].clone();for(let X=1;X=L.x&&q.x<=B.x&&_.y>=L.y&&q.y<=B.y?[U]:q.xB.x||q.yB.y?[]:i.clipLine([U],L.x,L.y,B.x,B.y)}for(const W of Z){R.reset(W,.25*D);let H=0;H=R.length<=.5*D?1:Math.ceil(R.paddedLength/j)+1;for(let K=0;K0){i.transformMat4$1(l,l,r);let h=!1;this.fogState&&a&&(h=function(r,n,o,s,a,l){const c=l.calculateFogTileMatrix(a),h=[n,o,s];return i.transformMat4(h,h,c),w(r,h,l.pitch,l._fov)}(this.fogState,n,o,s||0,a.toUnwrapped(),this.transform)>.9),c=l[2]>l[3]||h}else eC(l,l,r);return{point:new i.pointGeometry((l[0]/l[3]+1)/2*this.transform.width+100,(-l[1]/l[3]+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/l[3]*.5,1.5),signedDistanceFromCamera:l[3],aboveHorizon:c}}isOffscreen(i,r,n,o){return n<100||i>=this.screenRightBoundary||o<100||r>this.screenBottomBoundary}isInsideGrid(i,r,n,o){return n>=0&&i=0&&ri.collisionGroupID===r}}return this.collisionGroups[i]}}(o),this.collisionCircleArrays={},this.prevPlacement=s,s&&(s.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,n,o,s){const a=o.getBucket(n),l=o.latestFeatureIndex;if(!a||!l||n.id!==a.layerIds[0])return;const c=a.layers[0].layout,h=o.collisionBoxArray,u=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),d=o.tileSize/i.EXTENT,p=o.tileID.toUnwrapped(),f=this.transform.calculateProjMatrix(p),m="map"===c.get("text-pitch-alignment"),$="map"===c.get("text-rotation-alignment");n.compileFilter();const g=n.dynamicFilter(),y=n.dynamicFilterNeedsFeature(),x=this.transform.calculatePixelsToTileUnitsMatrix(o),v=em(f,o.tileID.canonical,m,$,this.transform,x);let b=null;if(m){const w=e$(f,o.tileID.canonical,m,$,this.transform,x);b=i.multiply$1([],this.transform.labelPlaneMatrix,w)}let T=null;g&&o.latestFeatureIndex&&(T={unwrappedTileID:p,dynamicFilter:g,dynamicFilterNeedsFeature:y,featureIndex:o.latestFeatureIndex}),this.retainedQueryData[a.bucketInstanceId]=new eL(a.bucketInstanceId,l,a.sourceLayerIndex,a.index,o.tileID);const E={bucket:a,layout:c,posMatrix:f,textLabelPlaneMatrix:v,labelToScreenMatrix:b,clippingData:T,scale:u,textPixelRatio:d,holdingForFade:o.holdingForFade(),collisionBoxArray:h,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(a.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:i.evaluateSizeForZoom(a.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(s)for(const S of a.sortKeyRanges){const{sortKey:I,symbolInstanceStart:M,symbolInstanceEnd:A}=S;r.push({sortKey:I,symbolInstanceStart:M,symbolInstanceEnd:A,parameters:E})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:E})}attemptAnchorPlacement(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x){const v=[p.textOffset0,p.textOffset1],b=eB(i,n,o,v,s),w=this.collisionIndex.placeCollisionBox(s,r,eR(b.x,b.y,a,l,this.transform.angle),d,c,h,u.predicate);if((!g||0!==this.collisionIndex.placeCollisionBox(m.getSymbolInstanceIconSize(x,this.transform.zoom,f),g,eR(b.x,b.y,a,l,this.transform.angle),d,c,h,u.predicate).box.length)&&w.box.length>0){let T;return this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(T=this.prevPlacement.variableOffsets[p.crossTileID].anchor),this.variableOffsets[p.crossTileID]={textOffset:v,width:n,height:o,anchor:i,textScale:s,prevAnchor:T},this.markUsedJustification(m,i,p,$),m.allowVerticalPlacement&&(this.markUsedOrientation(m,$,p),this.placedOrientations[p.crossTileID]=$),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(r,n,o,s){const{bucket:a,layout:l,posMatrix:c,textLabelPlaneMatrix:h,labelToScreenMatrix:u,clippingData:d,textPixelRatio:p,holdingForFade:f,collisionBoxArray:m,partiallyEvaluatedTextSize:$,partiallyEvaluatedIconSize:g,collisionGroup:y}=r.parameters,x=l.get("text-optional"),v=l.get("icon-optional"),b=l.get("text-allow-overlap"),w=l.get("icon-allow-overlap"),T="map"===l.get("text-rotation-alignment"),E="map"===l.get("text-pitch-alignment"),S="none"!==l.get("icon-text-fit"),I="viewport-y"===l.get("symbol-z-order"),M=b&&(w||!a.hasIconData()||v),A=w&&(b||!a.hasTextData()||x);!a.collisionArrays&&m&&a.deserializeCollisionBoxes(m),o&&s&&a.updateCollisionDebugBuffers(this.transform.zoom,m);const C=(r,s,m)=>{if(d){const I={zoom:this.transform.zoom,pitch:this.transform.pitch};let C=null;if(d.dynamicFilterNeedsFeature){const z=this.retainedQueryData[a.bucketInstanceId];C=d.featureIndex.loadFeature({featureIndex:r.featureIndex,bucketIndex:z.bucketIndex,sourceLayerIndex:z.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,d.dynamicFilter)(I,C,this.retainedQueryData[a.bucketInstanceId].tileID.canonical,new i.pointGeometry(r.tileAnchorX,r.tileAnchorY),this.transform.calculateDistanceTileData(d.unwrappedTileID)))return this.placements[r.crossTileID]=new eP(!1,!1,!1,!0),void(n[r.crossTileID]=!0)}if(n[r.crossTileID])return;if(f)return void(this.placements[r.crossTileID]=new eP(!1,!1,!1));let k=!1,P=!1,D=!0,L=null,B={box:null,offscreen:null},R={box:null,offscreen:null},F=null,O=null,U=null,V=0,N=0,j=0;m.textFeatureIndex?V=m.textFeatureIndex:r.useRuntimeCollisionCircles&&(V=r.featureIndex),m.verticalTextFeatureIndex&&(N=m.verticalTextFeatureIndex);const G=i=>{i.tileID=this.retainedQueryData[a.bucketInstanceId].tileID,(this.transform.elevation||i.elevation)&&(i.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[a.bucketInstanceId].tileID,i.tileAnchorX,i.tileAnchorY):0)},Z=m.textBox;if(Z){G(Z);const _=n=>{let o=i.WritingMode.horizontal;if(a.allowVerticalPlacement&&!n&&this.prevPlacement){const s=this.prevPlacement.placedOrientations[r.crossTileID];s&&(this.placedOrientations[r.crossTileID]=s,o=s,this.markUsedOrientation(a,o,r))}return o},q=(n,o)=>{if(a.allowVerticalPlacement&&r.numVerticalGlyphVertices>0&&m.verticalTextBox){for(const s of a.writingModes)if(s===i.WritingMode.vertical?R=B=o():B=n(),B&&B.box&&B.box.length)break}else B=n()};if(l.get("text-variable-anchor")){let X=l.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[r.crossTileID]){const W=this.prevPlacement.variableOffsets[r.crossTileID];X.indexOf(W.anchor)>0&&(X=X.filter(i=>i!==W.anchor)).unshift(W.anchor)}const H=(i,n,o)=>{const l=a.getSymbolInstanceTextSize($,r,this.transform.zoom,s),h=(i.x2-i.x1)*l+2*i.padding,u=(i.y2-i.y1)*l+2*i.padding,d=S&&!w?n:null;d&&G(d);let f={box:[],offscreen:!1};const m=b?2*X.length:X.length;for(let x=0;x=X.length,r,s,a,o,d,$,g);if(v&&(f=v.placedGlyphBoxes)&&f.box&&f.box.length){k=!0,L=v.shift;break}}return f};q(()=>H(Z,m.iconBox,i.WritingMode.horizontal),()=>{const n=m.verticalTextBox;return n&&G(n),a.allowVerticalPlacement&&!(B&&B.box&&B.box.length)&&r.numVerticalGlyphVertices>0&&n?H(n,m.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null}}),B&&(k=B.box,D=B.offscreen);const K=_(B&&B.box);if(!k&&this.prevPlacement){const Y=this.prevPlacement.variableOffsets[r.crossTileID];Y&&(this.variableOffsets[r.crossTileID]=Y,this.markUsedJustification(a,Y.anchor,r,K))}}else{const J=(n,o)=>{const l=a.getSymbolInstanceTextSize($,r,this.transform.zoom,s),h=this.collisionIndex.placeCollisionBox(l,n,new i.pointGeometry(0,0),b,p,c,y.predicate);return h&&h.box&&h.box.length&&(this.markUsedOrientation(a,o,r),this.placedOrientations[r.crossTileID]=o),h};q(()=>J(Z,i.WritingMode.horizontal),()=>{const n=m.verticalTextBox;return a.allowVerticalPlacement&&r.numVerticalGlyphVertices>0&&n?(G(n),J(n,i.WritingMode.vertical)):{box:null,offscreen:null}}),_(B&&B.box&&B.box.length)}}if(k=(F=B)&&F.box&&F.box.length>0,D=F&&F.offscreen,r.useRuntimeCollisionCircles){const Q=a.text.placedSymbolArray.get(r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex),ee=i.evaluateSizeForFeature(a.textSizeData,$,Q),et=l.get("text-padding");O=this.collisionIndex.placeCollisionCircles(b,Q,a.lineVertexArray,a.glyphOffsetArray,ee,c,h,u,o,E,y.predicate,r.collisionCircleDiameter*ee/i.ONE_EM,et,this.retainedQueryData[a.bucketInstanceId].tileID),k=b||O.circles.length>0&&!O.collisionDetected,D=D&&O.offscreen}if(m.iconFeatureIndex&&(j=m.iconFeatureIndex),m.iconBox){const ei=r=>{G(r);const n=S&&L?eR(L.x,L.y,T,E,this.transform.angle):new i.pointGeometry(0,0),o=a.getSymbolInstanceIconSize(g,this.transform.zoom,s);return this.collisionIndex.placeCollisionBox(o,r,n,w,p,c,y.predicate)};P=R&&R.box&&R.box.length&&m.verticalIconBox?(U=ei(m.verticalIconBox)).box.length>0:(U=ei(m.iconBox)).box.length>0,D=D&&U.offscreen}const er=x||0===r.numHorizontalGlyphVertices&&0===r.numVerticalGlyphVertices,en=v||0===r.numIconVertices;if(er||en?en?er||(P=P&&k):k=P&&k:P=k=P&&k,k&&F&&F.box&&this.collisionIndex.insertCollisionBox(F.box,l.get("text-ignore-placement"),a.bucketInstanceId,R&&R.box&&N?N:V,y.ID),P&&U&&this.collisionIndex.insertCollisionBox(U.box,l.get("icon-ignore-placement"),a.bucketInstanceId,j,y.ID),O&&(k&&this.collisionIndex.insertCollisionCircles(O.circles,l.get("text-ignore-placement"),a.bucketInstanceId,V,y.ID),o)){const eo=a.bucketInstanceId;let es=this.collisionCircleArrays[eo];void 0===es&&(es=this.collisionCircleArrays[eo]=new eD);for(let ea=0;ea=0;--k){const P=z[k];C(a.symbolInstances.get(P),P,a.collisionArrays[P])}}else for(let D=r.symbolInstanceStart;D=0&&(r.text.placedSymbolArray.get(c).crossTileID=a>=0&&c!==a?0:o.crossTileID)}markUsedOrientation(r,n,o){const s=n===i.WritingMode.horizontal||n===i.WritingMode.horizontalOnly?n:0,a=n===i.WritingMode.vertical?n:0,l=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,];for(const c of l)r.text.placedSymbolArray.get(c).placedOrientation=s;o.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;const r=this.prevPlacement;let n=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;const o=r?r.symbolFadeChange(i):1,s=r?r.opacities:{},a=r?r.variableOffsets:{},l=r?r.placedOrientations:{};for(const c in this.placements){const h=this.placements[c],u=s[c];u?(this.opacities[c]=new ek(u,o,h.text,h.icon,null,h.clipped),n=n||h.text!==u.text.placed||h.icon!==u.icon.placed):(this.opacities[c]=new ek(null,o,h.text,h.icon,h.skipFade,h.clipped),n=n||h.text||h.icon)}for(const d in s){const p=s[d];if(!this.opacities[d]){const f=new ek(p,o,!1,!1);f.isHidden()||(this.opacities[d]=f,n=n||p.text.placed||p.icon.placed)}}for(const m in a)this.variableOffsets[m]||!this.opacities[m]||this.opacities[m].isHidden()||(this.variableOffsets[m]=a[m]);for(const $ in l)this.placedOrientations[$]||!this.opacities[$]||this.opacities[$].isHidden()||(this.placedOrientations[$]=l[$]);n?this.lastPlacementChangeTime=i:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:i)}updateLayerOpacities(i,r){const n={};for(const o of r){const s=o.getBucket(i);s&&o.latestFeatureIndex&&i.id===s.layerIds[0]&&this.updateBucketOpacities(s,n,o.collisionBoxArray)}}updateBucketOpacities(r,n,o){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const s=r.layers[0].layout,a=!!r.layers[0].dynamicFilter(),l=new ek(null,0,!1,!1,!0),c=s.get("text-allow-overlap"),h=s.get("icon-allow-overlap"),u=s.get("text-variable-anchor"),d="map"===s.get("text-rotation-alignment"),p="map"===s.get("text-pitch-alignment"),f="none"!==s.get("icon-text-fit"),m=new ek(null,0,c&&(h||!r.hasIconData()||s.get("icon-optional")),h&&(c||!r.hasTextData()||s.get("text-optional")),!0);!r.collisionArrays&&o&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(o);const $=(i,r,n)=>{for(let o=0;o0||b>0,S=x.numIconVertices>0,I=this.placedOrientations[x.crossTileID],M=I===i.WritingMode.vertical,A=I===i.WritingMode.horizontal||I===i.WritingMode.horizontalOnly;if(!E&&!S||T.isHidden()||g++,E){const C=eO(T.text);$(r.text,v,M?0:C),$(r.text,b,A?0:C);const z=T.text.isHidden();[x.rightJustifiedTextSymbolIndex,x.centerJustifiedTextSymbolIndex,x.leftJustifiedTextSymbolIndex,].forEach(i=>{i>=0&&(r.text.placedSymbolArray.get(i).hidden=z||M?1:0)}),x.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(x.verticalPlacedTextSymbolIndex).hidden=z||A?1:0);const k=this.variableOffsets[x.crossTileID];k&&this.markUsedJustification(r,k.anchor,x,I);const P=this.placedOrientations[x.crossTileID];P&&(this.markUsedJustification(r,"left",x,P),this.markUsedOrientation(r,P,x))}if(S){const D=eO(T.icon);x.placedIconSymbolIndex>=0&&($(r.icon,x.numIconVertices,M?0:D),r.icon.placedSymbolArray.get(x.placedIconSymbolIndex).hidden=T.icon.isHidden()),x.verticalPlacedIconSymbolIndex>=0&&($(r.icon,x.numVerticalIconVertices,A?0:D),r.icon.placedSymbolArray.get(x.verticalPlacedIconSymbolIndex).hidden=T.icon.isHidden())}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const L=r.collisionArrays[y];if(L){let B=new i.pointGeometry(0,0),R=!0;if(L.textBox||L.verticalTextBox){if(u){const F=this.variableOffsets[w];F?(B=eB(F.anchor,F.width,F.height,F.textOffset,F.textScale),d&&B._rotate(p?this.transform.angle:-this.transform.angle)):R=!1}a&&(R=!T.clipped),L.textBox&&eF(r.textCollisionBox.collisionVertexArray,T.text.placed,!R||M,B.x,B.y),L.verticalTextBox&&eF(r.textCollisionBox.collisionVertexArray,T.text.placed,!R||A,B.x,B.y)}const O=R&&Boolean(!A&&L.verticalIconBox);L.iconBox&&eF(r.iconCollisionBox.collisionVertexArray,T.icon.placed,O,f?B.x:0,f?B.y:0),L.verticalIconBox&&eF(r.iconCollisionBox.collisionVertexArray,T.icon.placed,!O,f?B.x:0,f?B.y:0)}}}if(r.fullyClipped=0===g,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){const U=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=U.invProjMatrix,r.placementViewportMatrix=U.viewportMatrix,r.collisionCircleArray=U.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(i){return 0===this.fadeDuration?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return this.stale||i-this.lastPlacementChangeTimei}setStale(){this.stale=!0}}(r,a,l,c,h),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=o,this._showCollisionBoxes=s,this._done=!1}isDone(){return this._done}continuePlacement(r,n,o){const s=i.exported.now(),a=()=>{const r=i.exported.now()-s;return!this._forceFullPlacement&&r>2};for(;this._currentPlacementIndex>=0;){const l=n[r[this._currentPlacementIndex]],c=this.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&(!l.minzoom||l.minzoom<=c)&&(!l.maxzoom||l.maxzoom>c)){if(this._inProgressLayer||(this._inProgressLayer=new eU(l)),this._inProgressLayer.continuePlacement(o[l.source],this.placement,this._showCollisionBoxes,l,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(i){return this.placement.commit(i),this.placement}}const eN=512/i.EXTENT/2;class ej{constructor(i,r,n){this.tileID=i,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let o=0;oi.overscaledZ)for(const c in l){const h=l[c];h.tileID.isChildOf(i)&&h.findMatches(r.symbolInstances,i,s)}else{const u=l[i.scaledTo(Number(a)).key];u&&u.findMatches(r.symbolInstances,i,s)}}for(let d=0;d{r[i]=!0}),this.layerIndexes)r[n]||delete this.layerIndexes[n]}}const e_=(r,n)=>i.emitValidationErrors(r,n&&n.filter(i=>"source.canvas"!==i.identifier)),eq=i.pick(en,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection",]),eX=i.pick(en,["setCenter","setZoom","setBearing","setPitch",]),eW=function(){const r={},n=i.spec.$version;for(const o in i.spec.$root){const s=i.spec.$root[o];if(s.required){let a=null;null!=(a="version"===o?n:"array"===s.type?[]:{})&&(r[o]=a)}}return r}(),eH={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class eK extends i.Evented{constructor(r,n={}){super(),this.map=r,this.dispatcher=new M(et(),this),this.imageManager=new m,this.imageManager.setEventedParent(this),this.glyphManager=new i.GlyphManager(r._requestManager,n.localFontFamily?i.LocalGlyphMode.all:n.localIdeographFontFamily?i.LocalGlyphMode.ideographs:i.LocalGlyphMode.none,n.localFontFamily||n.localIdeographFontFamily),this.lineAtlas=new i.LineAtlas(256,512),this.crossTileSymbolIndex=new eZ,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new i.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());const o=this;this._rtlTextPluginCallback=eK.registerForPluginStateChange(r=>{o.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:r.pluginStatus,pluginURL:r.pluginURL},(r,n)=>{if(i.triggerPluginCompletionEvent(r),n&&n.every(i=>i))for(const s in o._sourceCaches){const a=o._sourceCaches[s],l=a.getSource().type;"vector"!==l&&"geojson"!==l||a.reload()}})}),this.on("data",i=>{if("source"!==i.dataType||"metadata"!==i.sourceDataType)return;const r=this.getSource(i.sourceId);if(r&&r.vectorLayerIds)for(const n in this._layers){const o=this._layers[n];o.source===r.id&&this._validateLayer(o)}})}loadURL(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"}));const o="boolean"==typeof n.validate?n.validate:!i.isMapboxURL(r);r=this.map._requestManager.normalizeStyleURL(r,n.accessToken);const s=this.map._requestManager.transformRequest(r,i.ResourceType.Style);this._request=i.getJSON(s,(r,n)=>{this._request=null,r?this.fire(new i.ErrorEvent(r)):n&&this._load(n,o)})}loadJSON(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(()=>{this._request=null,this._load(r,!1!==n.validate)})}loadEmpty(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(eW,!1)}_updateLayerCount(i,r){const n=r?1:-1;i.is3D()&&(this._num3DLayers+=n),"circle"===i.type&&(this._numCircleLayers+=n),"symbol"===i.type&&(this._numSymbolLayers+=n)}_load(r,n){if(n&&e_(this,i.validateStyle(r)))return;for(const o in this._loaded=!0,this.stylesheet=r,this.updateProjection(),r.sources)this.addSource(o,r.sources[o],{validate:!1});this._changed=!1,r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(r.glyphs);const s=er(this.stylesheet.layers);for(let a of(this._order=s.map(i=>i.id),this._layers={},this._serializedLayers={},s))(a=i.createStyleLayer(a)).setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=a,this._serializedLayers[a.id]=a.serialize(),this._updateLayerCount(a,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new y(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 i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}terrainSetForDrapingOnly(){return this.terrain&&0===this.terrain.drapeRenderMode}setProjection(i){i?this.stylesheet.projection=i:delete this.stylesheet.projection,this.updateProjection()}updateProjection(){const i=this.map.transform.projection,r=this.map.transform.setProjection(this.map._runtimeProjection||(this.stylesheet?this.stylesheet.projection:void 0)),n=this.map.transform.projection;if(this._loaded&&(n.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null)),this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),r){if(n.isReprojectedInTileSpace||i.isReprojectedInTileSpace)for(const o in this.map.painter.clearBackgroundTiles(),this._sourceCaches)this._sourceCaches[o].clearTiles();else this._forceSymbolLayerUpdate();this.map._update(!0)}}_loadSprite(r){this._spriteRequest=function(r,n,o){let s,a,l;const c=i.exported.devicePixelRatio>1?"@2x":"";let h=i.getJSON(n.transformRequest(n.normalizeSpriteURL(r,c,".json"),i.ResourceType.SpriteJSON),(i,r)=>{h=null,l||(l=i,s=r,d())}),u=i.getImage(n.transformRequest(n.normalizeSpriteURL(r,c,".png"),i.ResourceType.SpriteImage),(i,r)=>{u=null,l||(l=i,a=r,d())});function d(){if(l)o(l);else if(s&&a){const r=i.exported.getImageData(a),n={};for(const c in s){const{width:h,height:u,x:d,y:p,sdf:f,pixelRatio:m,stretchX:$,stretchY:g,content:y}=s[c],x=new i.RGBAImage({width:h,height:u});i.RGBAImage.copy(r,x,{x:d,y:p},{x:0,y:0},{width:h,height:u}),n[c]={data:x,pixelRatio:m,sdf:f,stretchX:$,stretchY:g,content:y}}o(null,n)}}return{cancel(){h&&(h.cancel(),h=null),u&&(u.cancel(),u=null)}}}(r,this.map._requestManager,(r,n)=>{if(this._spriteRequest=null,r)this.fire(new i.ErrorEvent(r));else if(n)for(const o in n)this.imageManager.addImage(o,n[o]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new i.Event("data",{dataType:"style"}))})}_validateLayer(r){const n=this.getSource(r.source);if(!n)return;const o=r.sourceLayer;o&&("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(o))&&this.fire(new i.ErrorEvent(Error(`Source layer "${o}" does not exist on source "${n.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const i in this._sourceCaches)if(!this._sourceCaches[i].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(i){const r=[];for(const n of i){const o=this._layers[n];"custom"!==o.type&&r.push(o.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(i){return!!this.terrain&&eH[i.type]}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}update(r){if(!this._loaded)return;const n=this._changed;if(this._changed){const o=Object.keys(this._updatedLayers),s=Object.keys(this._removedLayers);for(const a in(o.length||s.length)&&this._updateWorkerLayers(o,s),this._updatedSources){const l=this._updatedSources[a];"reload"===l?this._reloadSource(a):"clear"===l&&this._clearSource(a)}for(const c in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[c].updateTransitions(r);this.light.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._resetUpdates()}const h={};for(const u in this._sourceCaches){const d=this._sourceCaches[u];h[u]=d.used,d.used=!1}for(const p of this._order){const f=this._layers[p];if(f.recalculate(r,this._availableImages),!f.isHidden(r.zoom)){const m=this._getLayerSourceCache(f);m&&(m.used=!0)}const $=this.map.painter;if($){const g=f.getProgramIds();if(!g)continue;const y=f.getProgramConfiguration(r.zoom);for(const x of g)$.useProgram(x,y)}}for(const v in h){const b=this._sourceCaches[v];h[v]!==b.used&&b.getSource().fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:b.getSource().id}))}this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),n&&this.fire(new i.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const i=Object.keys(this._changedImages);if(i.length){for(const r in this._sourceCaches)this._sourceCaches[r].reloadTilesForDependencies(["icons","patterns"],i);this._changedImages={}}}_updateWorkerLayers(i,r){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(i),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(r){if(this._checkLoaded(),e_(this,i.validateStyle(r)))return!1;(r=i.clone$1(r)).layers=er(r.layers);const n=(function(i,r){if(!i)return[{command:en.setStyle,args:[r]},];let n=[];try{if(!a(i.version,r.version))return[{command:en.setStyle,args:[r]},];a(i.center,r.center)||n.push({command:en.setCenter,args:[r.center]}),a(i.zoom,r.zoom)||n.push({command:en.setZoom,args:[r.zoom]}),a(i.bearing,r.bearing)||n.push({command:en.setBearing,args:[r.bearing]}),a(i.pitch,r.pitch)||n.push({command:en.setPitch,args:[r.pitch]}),a(i.sprite,r.sprite)||n.push({command:en.setSprite,args:[r.sprite]}),a(i.glyphs,r.glyphs)||n.push({command:en.setGlyphs,args:[r.glyphs]}),a(i.transition,r.transition)||n.push({command:en.setTransition,args:[r.transition]}),a(i.light,r.light)||n.push({command:en.setLight,args:[r.light]}),a(i.fog,r.fog)||n.push({command:en.setFog,args:[r.fog]}),a(i.projection,r.projection)||n.push({command:en.setProjection,args:[r.projection]});const o={},s=[];!function(i,r,n,o){let s;for(s in r=r||{},i=i||{})i.hasOwnProperty(s)&&(r.hasOwnProperty(s)||es(s,n,o));for(s in r)r.hasOwnProperty(s)&&(i.hasOwnProperty(s)?a(i[s],r[s])||("geojson"===i[s].type&&"geojson"===r[s].type&&el(i,r,s)?n.push({command:en.setGeoJSONSourceData,args:[s,r[s].data,]}):ea(s,r,n,o)):eo(s,r,n))}(i.sources,r.sources,s,o);const l=[];i.layers&&i.layers.forEach(i=>{o[i.source]?n.push({command:en.removeLayer,args:[i.id]}):l.push(i)});let c=i.terrain;c&&o[c.source]&&(n.push({command:en.setTerrain,args:[void 0]}),c=void 0),n=n.concat(s),a(c,r.terrain)||n.push({command:en.setTerrain,args:[r.terrain]}),function(i,r,n){r=r||[];const o=(i=i||[]).map(eh),s=r.map(eh),l=i.reduce(eu,{}),c=r.reduce(eu,{}),h=o.slice(),u=Object.create(null);let d,p,f,m,$,g,y;for(d=0,p=0;d!(i.command in eX));if(0===n.length)return!1;const o=n.filter(i=>!(i.command in eq));if(o.length>0)throw Error(`Unimplemented: ${o.map(i=>i.command).join(", ")}.`);return n.forEach(i=>{"setTransition"!==i.command&&this[i.command].apply(this,i.args)}),this.stylesheet=r,this.updateProjection(),!0}addImage(r,n){if(this.getImage(r))return this.fire(new i.ErrorEvent(Error("An image with this name already exists.")));this.imageManager.addImage(r,n),this._afterImageUpdated(r)}updateImage(i,r){this.imageManager.updateImage(i,r)}getImage(i){return this.imageManager.getImage(i)}removeImage(r){if(!this.getImage(r))return this.fire(new i.ErrorEvent(Error("No image with this name exists.")));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(r,n,o={}){if(this._checkLoaded(),void 0!==this.getSource(r))throw Error("There is already a source with this ID");if(!n.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image",].indexOf(n.type)>=0&&this._validate(i.validateStyle.source,`sources.${r}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const s=q(r,n,this.dispatcher,this);s.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:s.serialize(),sourceId:r}));const a=n=>{const o=(n?"symbol:":"other:")+r,a=this._sourceCaches[o]=new i.SourceCache(o,s,n);(n?this._symbolSourceCaches:this._otherSourceCaches)[r]=a,a.style=this,a.onAdd(this.map)};a(!1),"vector"!==n.type&&"geojson"!==n.type||a(!0),s.onAdd&&s.onAdd(this.map),this._changed=!0}removeSource(r){this._checkLoaded();const n=this.getSource(r);if(void 0===n)throw Error("There is no source with this ID");for(const o in this._layers)if(this._layers[o].source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while layer "${o}" is using it.`)));if(this.terrain&&this.terrain.get().source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while terrain is using it.`)));const s=this._getSourceCaches(r);for(const a of s)delete this._sourceCaches[a.id],delete this._updatedSources[a.id],a.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:a.getSource().id})),a.setEventedParent(null),a.clearTiles();delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(i,r){this._checkLoaded(),this.getSource(i).setData(r),this._changed=!0}getSource(i){const r=this._getSourceCache(i);return r&&r.getSource()}addLayer(r,n,o={}){this._checkLoaded();const s=r.id;if(this.getLayer(s))return void this.fire(new i.ErrorEvent(Error(`Layer with id "${s}" already exists on this map`)));let a;if("custom"===r.type){if(e_(this,i.validateCustomStyleLayer(r)))return;a=i.createStyleLayer(r)}else{if("object"==typeof r.source&&(this.addSource(s,r.source),r=i.clone$1(r),r=i.extend(r,{source:s})),this._validate(i.validateStyle.layer,`layers.${s}`,r,{arrayIndex:-1},o))return;a=i.createStyleLayer(r),this._validateLayer(a),a.setEventedParent(this,{layer:{id:s}}),this._serializedLayers[a.id]=a.serialize(),this._updateLayerCount(a,!0)}const l=n?this._order.indexOf(n):this._order.length;if(n&&-1===l)return void this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`)));this._order.splice(l,0,s),this._layerOrderChanged=!0,this._layers[s]=a;const c=this._getLayerSourceCache(a);if(this._removedLayers[s]&&a.source&&c&&"custom"!==a.type){const h=this._removedLayers[s];delete this._removedLayers[s],h.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",c.pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(r,n){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===n)return;const o=this._order.indexOf(r);this._order.splice(o,1);const s=n?this._order.indexOf(n):this._order.length;n&&-1===s?this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`))):(this._order.splice(s,0,r),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(r){this._checkLoaded();const n=this._layers[r];if(!n)return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be removed.`)));n.setEventedParent(null),this._updateLayerCount(n,!1);const o=this._order.indexOf(r);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=n,delete this._layers[r],delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],n.onRemove&&n.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(i){return this._layers[i]}hasLayer(i){return i in this._layers}hasLayerType(i){for(const r in this._layers)if(this._layers[r].type===i)return!0;return!1}setLayerZoomRange(r,n,o){this._checkLoaded();const s=this.getLayer(r);s?s.minzoom===n&&s.maxzoom===o||(null!=n&&(s.minzoom=n),null!=o&&(s.maxzoom=o),this._updateLayer(s)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(r,n,o={}){this._checkLoaded();const s=this.getLayer(r);if(s){if(!a(s.filter,n))return null==n?(s.filter=void 0,void this._updateLayer(s)):void(this._validate(i.validateStyle.filter,`layers.${s.id}.filter`,n,{layerType:s.type},o)||(s.filter=i.clone$1(n),this._updateLayer(s)))}else this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be filtered.`)))}getFilter(r){return i.clone$1(this.getLayer(r).filter)}setLayoutProperty(r,n,o,s={}){this._checkLoaded();const l=this.getLayer(r);l?a(l.getLayoutProperty(n),o)||(l.setLayoutProperty(n,o,s),this._updateLayer(l)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(r,n){const o=this.getLayer(r);if(o)return o.getLayoutProperty(n);this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style.`)))}setPaintProperty(r,n,o,s={}){this._checkLoaded();const l=this.getLayer(r);l?a(l.getPaintProperty(n),o)||(l.setPaintProperty(n,o,s)&&this._updateLayer(l),this._changed=!0,this._updatedPaintProps[r]=!0):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(i,r){return this.getLayer(i).getPaintProperty(r)}setFeatureState(r,n){this._checkLoaded();const o=r.source,s=r.sourceLayer,a=this.getSource(o);if(void 0===a)return void this.fire(new i.ErrorEvent(Error(`The source '${o}' does not exist in the map's style.`)));const l=a.type;if("geojson"===l&&s)return void this.fire(new i.ErrorEvent(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===l&&!s)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided.")));const c=this._getSourceCaches(o);for(const h of c)h.setFeatureState(s,r.id,n)}removeFeatureState(r,n){this._checkLoaded();const o=r.source,s=this.getSource(o);if(void 0===s)return void this.fire(new i.ErrorEvent(Error(`The source '${o}' does not exist in the map's style.`)));const a=s.type,l="vector"===a?r.sourceLayer:void 0;if("vector"===a&&!l)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&"string"!=typeof r.id&&"number"!=typeof r.id)return void this.fire(new i.ErrorEvent(Error("A feature id is required to remove its specific state property.")));const c=this._getSourceCaches(o);for(const h of c)h.removeFeatureState(l,r.id,n)}getFeatureState(r){this._checkLoaded();const n=r.source,o=r.sourceLayer,s=this.getSource(n);if(void 0!==s){if("vector"!==s.type||o)return void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided."))),this._getSourceCaches(n)[0].getFeatureState(o,r.id);this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const r={};for(const n in this._sourceCaches){const o=this._sourceCaches[n].getSource();r[o.id]||(r[o.id]=o.serialize())}return i.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:r,layers:this._serializeLayers(this._order)},i=>void 0!==i)}_updateLayer(i){this._updatedLayers[i.id]=!0;const r=this._getLayerSourceCache(i);i.source&&!this._updatedSources[i.source]&&r&&"raster"!==r.getSource().type&&(this._updatedSources[i.source]="reload",r.pause()),this._changed=!0,i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){var r,n;const o={},s=[];for(let a=this._order.length-1;a>=0;a--){const l=this._order[a];if(r=l,"fill-extrusion"===this._layers[r].type)for(const c of(o[l]=a,i)){const h=c[l];if(h)for(const u of h)s.push(u)}}s.sort((i,r)=>r.intersectionZ-i.intersectionZ);const d=[];for(let p=this._order.length-1;p>=0;p--){const f=this._order[p];if(n=f,"fill-extrusion"===this._layers[n].type)for(let m=s.length-1;m>=0;m--){const $=s[m].feature;if(o[$.layer.id]{const r=this.getLayer(i);return r&&r.is3D()}):this.has3DLayers(),u=F.createFromScreenPoints(r,o);for(const d in this._sourceCaches){const p=this._sourceCaches[d].getSource().id;n.layers&&!s[p]||c.push(W(this._sourceCaches[d],this._layers,this._serializedLayers,u,n,o,h,!!this.map._showQueryGeometry))}return this.placement&&c.push(function(i,r,n,o,s,a,l){const c={},h=a.queryRenderedSymbols(o),u=[];for(const d of Object.keys(h).map(Number))u.push(l[d]);for(const p of(u.sort(K),u)){const f=p.featureIndex.lookupSymbolFeatures(h[p.bucketInstanceId],r,p.bucketIndex,p.sourceLayerIndex,s.filter,s.layers,s.availableImages,i);for(const m in f){const $=c[m]=c[m]||[],g=f[m];for(const y of(g.sort((i,r)=>{const n=p.featureSortOrder;if(n){const o=n.indexOf(i.featureIndex);return n.indexOf(r.featureIndex)-o}return r.featureIndex-i.featureIndex}),g))$.push(y)}}for(const x in c)c[x].forEach(r=>{const o=r.feature,s=n(i[x]).getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=s});return c}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),u.screenGeometry,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(r,n){n&&n.filter&&this._validate(i.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this._getSourceCaches(r);let s=[];for(const a of o)s=s.concat(H(a,n));return s}addSourceType(i,r,n){return eK.getSourceType(i)?n(Error(`A source type called "${i}" already exists.`)):(eK.setSourceType(i,r),r.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:i,url:r.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(r,n={}){this._checkLoaded();const o=this.light.getLight();let s=!1;for(const l in r)if(!a(r[l],o[l])){s=!0;break}if(!s)return;const c={now:i.exported.now(),transition:i.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(r,n),this.light.updateTransitions(c)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(r,n=1){if(this._checkLoaded(),!r)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(1===n){if("object"==typeof r.source){const o="terrain-dem-src";this.addSource(o,r.source),r=i.clone$1(r),r=i.extend(r,{source:o})}if(this._validate(i.validateStyle.terrain,"terrain",r))return}if(!this.terrain||this.terrain&&n!==this.terrain.drapeRenderMode)this._createTerrain(r,n);else{const s=this.terrain,l=s.get();for(const c in r)if(!a(r[c],l[c])){s.set(r),this.stylesheet.terrain=r;const h={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};s.updateTransitions(h);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(r){const n=this.fog=new I(r,this.map.transform);this.stylesheet.fog=r;const o={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(o)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(const i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),!r)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const n=this.fog,o=n.get();for(const s in r)if(!a(r[s],o[s])){n.set(r),this.stylesheet.fog=r;const l={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(l);break}}else this._createFog(r);this._markersNeedUpdate=!0}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const i=this._order.filter(i=>this.isLayerDraped(this._layers[i])),r=this._order.filter(i=>!this.isLayerDraped(this._layers[i]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...r)}_createTerrain(r,n){const o=this.terrain=new b(r,n);this.stylesheet.terrain=r,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();const s={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};o.updateTransitions(s)}_force3DLayerUpdate(){for(const i in this._layers){const r=this._layers[i];"fill-extrusion"===r.type&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(const i in this._layers){const r=this._layers[i];"symbol"===r.type&&this._updateLayer(r)}}_validate(r,n,o,s,a={}){return(!a||!1!==a.validate)&&e_(this,r.call(i.validateStyle,i.extend({key:n,style:this.serialize(),value:o,styleSpec:i.spec},s)))}_remove(){for(const r in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[r].setEventedParent(null);for(const n in this._sourceCaches)this._sourceCaches[n].clearTiles(),this._sourceCaches[n].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(i){const r=this._getSourceCaches(i);for(const n of r)n.clearTiles()}_reloadSource(i){const r=this._getSourceCaches(i);for(const n of r)n.resume(),n.reload()}_updateSources(i){for(const r in this._sourceCaches)this._sourceCaches[r].update(i)}_generateCollisionBoxes(){for(const i in this._sourceCaches){const r=this._sourceCaches[i];r.resume(),r.reload()}}_updatePlacement(r,n,o,s,a=!1){let l=!1,c=!1;const h={};for(const u of this._order){const d=this._layers[u];if("symbol"!==d.type)continue;if(!h[d.source]){const p=this._getLayerSourceCache(d);if(!p)continue;h[d.source]=p.getRenderableIds(!0).map(i=>p.getTileByID(i)).sort((i,r)=>r.tileID.overscaledZ-i.tileID.overscaledZ||(i.tileID.isLessThan(r.tileID)?-1:1))}const f=this.crossTileSymbolIndex.addLayer(d,h[d.source],r.center.lng,r.projection);l=l||f}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||0===o,this._layerOrderChanged&&this.fire(new i.Event("neworder")),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),r.zoom))&&(this.pauseablePlacement=new eV(r,this._order,a,n,o,s,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,h),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),c=!0),l&&this.pauseablePlacement.placement.setStale()),c||l)for(const m of this._order){const $=this._layers[m];"symbol"===$.type&&this.placement.updateLayerOpacities($,h[$.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}_releaseSymbolFadeTiles(){for(const i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}getImages(i,r,n){this.imageManager.getImages(r.icons,n),this._updateTilesForChangedImages();const o=i=>{i&&i.setDependencies(r.tileID.key,r.type,r.icons)};o(this._otherSourceCaches[r.source]),o(this._symbolSourceCaches[r.source])}getGlyphs(i,r,n){this.glyphManager.getGlyphs(r.stacks,n)}getResource(r,n,o){return i.makeRequest(n,o)}_getSourceCache(i){return this._otherSourceCaches[i]}_getLayerSourceCache(i){return"symbol"===i.type?this._symbolSourceCaches[i.source]:this._otherSourceCaches[i.source]}_getSourceCaches(i){const r=[];return this._otherSourceCaches[i]&&r.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&r.push(this._symbolSourceCaches[i]),r}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)}}eK.getSourceType=function(i){return _[i]},eK.setSourceType=function(i,r){_[i]=r},eK.registerForPluginStateChange=i.registerForPluginStateChange;var eY="\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",eJ="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 eQ={},e0={};eQ=e5("","\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),e0=e5("#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 e1=e5("\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."),e2=eY;var e3={background:e5("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:e5("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:e5("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:e5("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:e5("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:e5("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:e5("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:e5("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:e5("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:e5("#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:e5("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:e5("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:e5("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:e5("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:e5("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:e5("#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:e5("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:e5("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:e5("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:e5("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:e5("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:e5("#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:e5("#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:e5("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:e5("#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:e5("\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}",eJ),skyboxGradient:e5("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}",eJ),skyboxCapture:e5("\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:e5("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:e5("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 e5(i,r,n){const o=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,a=r.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),l=i.match(s),c=r.match(s),h=eY.match(s);let u=c?c.concat(l):l;n||(eQ.staticUniforms&&(u=eQ.staticUniforms.concat(u)),e0.staticUniforms&&(u=e0.staticUniforms.concat(u))),u&&(u=u.concat(h));const d={};return{fragmentSource:i=i.replace(o,(i,r,n,o,s)=>(d[s]=!0,"define"===r?` +Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(d[1])} }\`.`),];const p=[];return"symbol"===i.layerType&&("text-field"===l&&o&&!o.glyphs&&p.push(new td(n,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===l&&ri(t$(a))&&"identity"===tm(a.type)&&p.push(new td(n,a,'"text-font" does not support identity functions'))),p.concat(rG({key:i.key,value:a,valueSpec:u,style:o,styleSpec:s,expressionContext:"property",propertyType:r,propertyKey:l}))}function rD(i){return rP(i,"paint")}function rL(i){return rP(i,"layout")}function rB(i){let r=[];const n=i.value,o=i.key,s=i.style,a=i.styleSpec;n.type||n.ref||r.push(new td(o,n,'either "type" or "ref" is required'));let l=tm(n.type);const c=tm(n.ref);if(n.id){const h=tm(n.id);for(let u=0;u{i in n&&r.push(new td(o,n[i],`"${i}" is prohibited for ref layers`))}),s.layers.forEach(i=>{tm(i.id)===c&&(p=i)}),p?p.ref?r.push(new td(o,n.ref,"ref cannot reference another ref layer")):l=tm(p.type):r.push(new td(o,n.ref,`ref layer "${c}" not found`))}else if("background"!==l&&"sky"!==l){if(n.source){const f=s.sources&&s.sources[n.source],m=f&&tm(f.type);f?"vector"===m&&"raster"===l?r.push(new td(o,n.source,`layer "${n.id}" requires a raster source`)):"raster"===m&&"raster"!==l?r.push(new td(o,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==m||n["source-layer"]?"raster-dem"===m&&"hillshade"!==l?r.push(new td(o,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===l&&n.paint&&n.paint["line-gradient"]&&("geojson"!==m||!f.lineMetrics)&&r.push(new td(o,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new td(o,n,`layer "${n.id}" must specify a "source-layer"`)):r.push(new td(o,n.source,`source "${n.source}" not found`))}else r.push(new td(o,n,'missing required property "source"'))}return r=r.concat(r$({key:o,value:n,valueSpec:a.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>rG({key:`${o}.type`,value:n.type,valueSpec:a.layer.type,style:i.style,styleSpec:i.styleSpec,object:n,objectKey:"type"}),filter:i=>rk(tf({layerType:l},i)),layout:i=>r$({layer:n,key:i.key,value:i.value,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>rL(tf({layerType:l},i))}}),paint:i=>r$({layer:n,key:i.key,value:i.value,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>rD(tf({layerType:l},i))}})}}))}function rR(i){const r=i.value,n=i.key,o=rt(r);return"string"!==o?[new td(n,r,`string expected, ${o} found`)]:[]}const rF={promoteId:function({key:i,value:r}){if("string"===rt(r))return rR({key:i,value:r});{const n=[];for(const o in r)n.push(...rR({key:`${i}.${o}`,value:r[o]}));return n}}};function rO(i){const r=i.value,n=i.key,o=i.styleSpec,s=i.style;if(!r.type)return[new td(n,r,'"type" is required')];const a=tm(r.type);let l;switch(a){case"vector":case"raster":case"raster-dem":return r$({key:n,value:r,valueSpec:o[`source_${a.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:rF});case"geojson":if(l=r$({key:n,value:r,valueSpec:o.source_geojson,style:s,styleSpec:o,objectElementValidators:rF}),r.cluster)for(const c in r.clusterProperties){const[h,u]=r.clusterProperties[c],d="string"==typeof h?[h,["accumulated"],["get",c],]:h;l.push(...rv({key:`${n}.${c}.map`,value:u,expressionContext:"cluster-map"})),l.push(...rv({key:`${n}.${c}.reduce`,value:d,expressionContext:"cluster-reduce"}))}return l;case"video":return r$({key:n,value:r,valueSpec:o.source_video,style:s,styleSpec:o});case"image":return r$({key:n,value:r,valueSpec:o.source_image,style:s,styleSpec:o});case"canvas":return[new td(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas"),];default:return rb({key:`${n}.type`,value:r.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image",]},style:s,styleSpec:o})}}function rU(i){const r=i.value,n=i.styleSpec,o=n.light,s=i.style;let a=[];const l=rt(r);if(void 0===r)return a;if("object"!==l)return a.concat([new td("light",r,`object expected, ${l} found`),]);for(const c in r){const h=c.match(/^(.*)-transition$/);a=a.concat(h&&o[h[1]]&&o[h[1]].transition?rG({key:c,value:r[c],valueSpec:n.transition,style:s,styleSpec:n}):o[c]?rG({key:c,value:r[c],valueSpec:o[c],style:s,styleSpec:n}):[new td(c,r[c],`unknown property "${c}"`),])}return a}function rV(i){const r=i.value,n=i.key,o=i.style,s=i.styleSpec,a=s.terrain;let l=[];const c=rt(r);if(void 0===r)return l;if("object"!==c)return l.concat([new td("terrain",r,`object expected, ${c} found`),]);for(const h in r){const u=h.match(/^(.*)-transition$/);l=l.concat(u&&a[u[1]]&&a[u[1]].transition?rG({key:h,value:r[h],valueSpec:s.transition,style:o,styleSpec:s}):a[h]?rG({key:h,value:r[h],valueSpec:a[h],style:o,styleSpec:s}):[new td(h,r[h],`unknown property "${h}"`),])}if(r.source){const d=o.sources&&o.sources[r.source],p=d&&tm(d.type);d?"raster-dem"!==p&&l.push(new td(n,r.source,`terrain cannot be used with a source of type ${p}, it only be used with a "raster-dem" source type`)):l.push(new td(n,r.source,`source "${r.source}" not found`))}else l.push(new td(n,r,'terrain is missing required property "source"'));return l}function rN(i){const r=i.value,n=i.style,o=i.styleSpec,s=o.fog;let a=[];const l=rt(r);if(void 0===r)return a;if("object"!==l)return a.concat([new td("fog",r,`object expected, ${l} found`),]);for(const c in r){const h=c.match(/^(.*)-transition$/);a=a.concat(h&&s[h[1]]&&s[h[1]].transition?rG({key:c,value:r[c],valueSpec:o.transition,style:n,styleSpec:o}):s[c]?rG({key:c,value:r[c],valueSpec:s[c],style:n,styleSpec:o}):[new td(c,r[c],`unknown property "${c}"`),])}return a}const rj={"*":()=>[],array:rg,boolean:function(i){const r=i.value,n=i.key,o=rt(r);return"boolean"!==o?[new td(n,r,`boolean expected, ${o} found`),]:[]},number:ry,color:function(i){const r=i.key,n=i.value,o=rt(n);return"string"!==o?[new td(r,n,`color expected, ${o} found`),]:null===tR.parseCSSColor(n)?[new td(r,n,`color expected, "${n}" found`),]:[]},constants:tp,enum:rb,filter:rk,function:rx,layer:rB,object:r$,source:rO,light:rU,terrain:rV,fog:rN,string:rR,formatted:function(i){return 0===rR(i).length?[]:rv(i)},resolvedImage:function(i){return 0===rR(i).length?[]:rv(i)},projection:function(i){const r=i.value,n=i.styleSpec,o=n.projection,s=i.style;let a=[];const l=rt(r);if("object"===l)for(const c in r)a=a.concat(rG({key:c,value:r[c],valueSpec:o[c],style:s,styleSpec:n}));else"string"!==l&&(a=a.concat([new td("projection",r,`object or string expected, ${l} found`),]));return a}};function rG(i){const r=i.value,n=i.valueSpec,o=i.styleSpec;return n.expression&&ri(tm(r))?rx(i):n.expression&&rh(t$(r))?rv(i):n.type&&rj[n.type]?rj[n.type](i):r$(tf({},i,{valueSpec:n.type?o[n.type]:n}))}function rZ(i){const r=i.value,n=i.key,o=rR(i);return o.length||(-1===r.indexOf("{fontstack}")&&o.push(new td(n,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&o.push(new td(n,r,'"glyphs" url must include a "{range}" token'))),o}function r_(i,r=tu){let n=[];return n=n.concat(rG({key:"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:rZ,"*":()=>[]}})),i.constants&&(n=n.concat(tp({key:"constants",value:i.constants,style:i,styleSpec:r}))),rq(n)}function rq(i){return[].concat(i).sort((i,r)=>i.line-r.line)}function rX(i){return function(...r){return rq(i.apply(this,r))}}r_.source=rX(rO),r_.light=rX(rU),r_.terrain=rX(rV),r_.fog=rX(rN),r_.layer=rX(rB),r_.filter=rX(rk),r_.paintProperty=rX(rD),r_.layoutProperty=rX(rL);const rW=r_,rH=rW.light,rK=rW.fog,rY=rW.paintProperty,rJ=rW.layoutProperty;function rQ(i,r){let n=!1;if(r&&r.length)for(const o of r)i.fire(new tc(Error(o.message))),n=!0;return n}var r0=r1;function r1(i,r,n){var o=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var s=new Int32Array(this.arrayBuffer);i=s[0],this.d=(r=s[1])+2*(n=s[2]);for(var a=0;a=d[m+0]&&o>=d[m+1])?(l[f]=!0,a.push(u[f])):l[f]=!1}}},r1.prototype._forEachCell=function(i,r,n,o,s,a,l,c){for(var h=this._convertToCellCoord(i),u=this._convertToCellCoord(r),d=this._convertToCellCoord(n),p=this._convertToCellCoord(o),f=h;f<=d;f++)for(var m=u;m<=p;m++){var $=this.d*m+f;if((!c||c(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&s.call(this,i,r,n,o,$,a,l,c))return}},r1.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},r1.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},r1.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,r=3+this.cells.length+1+1,n=0,o=0;o=0)continue;const u=i[h];c[h]=r5[l].shallow.indexOf(h)>=0?u:r7(u,r)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==l&&(c.$name=l),c}throw Error("can't serialize object of type "+typeof i)}function ne(i){if(null==i||"boolean"==typeof i||"number"==typeof i||"string"==typeof i||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||r8(i)||r9(i)||ArrayBuffer.isView(i)||i instanceof r2)return i;if(Array.isArray(i))return i.map(ne);if("object"==typeof i){const r=i.$name||"Object",{klass:n}=r5[r];if(!n)throw Error(`can't deserialize unregistered class ${r}`);if(n.deserialize)return n.deserialize(i);const o=Object.create(n.prototype);for(const s of Object.keys(i)){if("$name"===s)continue;const a=i[s];o[s]=r5[r].shallow.indexOf(s)>=0?a:ne(a)}return o}throw Error("can't deserialize object of type "+typeof i)}class nt{constructor(){this.first=!0}update(i,r){const n=Math.floor(i);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=i,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=1536&&i<=1791,nr=i=>i>=1872&&i<=1919,nn=i=>i>=2208&&i<=2303,no=i=>i>=11904&&i<=12031,ns=i=>i>=12032&&i<=12255,na=i=>i>=12272&&i<=12287,nl=i=>i>=12288&&i<=12351,nc=i=>i>=12352&&i<=12447,nh=i=>i>=12448&&i<=12543,nu=i=>i>=12544&&i<=12591,nd=i=>i>=12704&&i<=12735,np=i=>i>=12736&&i<=12783,nf=i=>i>=12784&&i<=12799,nm=i=>i>=12800&&i<=13055,n$=i=>i>=13056&&i<=13311,ng=i=>i>=13312&&i<=19903,ny=i=>i>=19968&&i<=40959,nx=i=>i>=40960&&i<=42127,nv=i=>i>=42128&&i<=42191,nb=i=>i>=44032&&i<=55215,nw=i=>i>=63744&&i<=64255,nT=i=>i>=64336&&i<=65023,nE=i=>i>=65040&&i<=65055,nS=i=>i>=65072&&i<=65103,nI=i=>i>=65104&&i<=65135,nM=i=>i>=65136&&i<=65279,nA=i=>i>=65280&&i<=65519;function nC(i){for(const r of i)if(nP(r.charCodeAt(0)))return!0;return!1}function nz(i){for(const r of i)if(!nk(r.charCodeAt(0)))return!1;return!0}function nk(i){return!(ni(i)||nr(i)||nn(i)||nT(i)||nM(i))}function nP(i){var r,n,o,s,a,l,c,h;return!(746!==i&&747!==i&&(i<4352||!(nd(i)||nu(i)||nS(i)&&!(i>=65097&&i<=65103)||nw(i)||n$(i)||no(i)||np(i)||!(!nl(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||12336===i)||ng(i)||ny(i)||nm(i)||(r=i)>=12592&&r<=12687||(n=i)>=43360&&n<=43391||(o=i)>=55216&&o<=55295||(s=i)>=4352&&s<=4607||nb(i)||nc(i)||na(i)||(a=i)>=12688&&a<=12703||ns(i)||nf(i)||nh(i)&&12540!==i||!(!nA(i)||65288===i||65289===i||65293===i||i>=65306&&i<=65310||65339===i||65341===i||65343===i||i>=65371&&i<=65503||65507===i||i>=65512&&i<=65519)||!(!nI(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||(l=i)>=5120&&l<=5759||(c=i)>=6320&&c<=6399||nE(i)||(h=i)>=19904&&h<=19967||nx(i)||nv(i))))}function nD(i){var r,n,o,s,a,l,c,h,u,d,p,f,m;return!(nP(i)||(n=r=i)>=128&&n<=255&&(167===r||169===r||174===r||177===r||188===r||189===r||190===r||215===r||247===r)||(o=r)>=8192&&o<=8303&&(8214===r||8224===r||8225===r||8240===r||8241===r||8251===r||8252===r||8258===r||8263===r||8264===r||8265===r||8273===r)||(s=r)>=8448&&s<=8527||(a=r)>=8528&&a<=8591||(l=r)>=8960&&l<=9215&&(r>=8960&&r<=8967||r>=8972&&r<=8991||r>=8996&&r<=9e3||9003===r||r>=9085&&r<=9114||r>=9150&&r<=9165||9167===r||r>=9169&&r<=9179||r>=9186&&r<=9215)||(c=r)>=9216&&c<=9279&&9251!==r||(h=r)>=9280&&h<=9311||(u=r)>=9312&&u<=9471||(d=r)>=9632&&d<=9727||(p=r)>=9728&&p<=9983&&!(r>=9754&&r<=9759)||(f=r)>=11008&&f<=11263&&(r>=11026&&r<=11055||r>=11088&&r<=11097||r>=11192&&r<=11243)||nl(r)||nh(r)||(m=r)>=57344&&m<=63743||nS(r)||nI(r)||nA(r)||8734===r||8756===r||8757===r||r>=9984&&r<=10087||r>=10102&&r<=10131||65532===r||65533===r)}function nL(i){return i>=1424&&i<=2303||nT(i)||nM(i)}function nB(i,r){var n;return!(!r&&nL(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||(n=i)>=6016&&n<=6143)}function nR(i){for(const r of i)if(nL(r.charCodeAt(0)))return!0;return!1}const nF="deferred",nO="loading",nU="loaded";let nV=null,nN="unavailable",nj=null;const nG=function(i){i&&"string"==typeof i&&i.indexOf("NetworkError")>-1&&(nN="error"),nV&&nV(i)};function nZ(){n_.fire(new tl("pluginStateChange",{pluginStatus:nN,pluginURL:nj}))}const n_=new th,nq=function(){return nN},nX=function(){if(nN!==nF||!nj)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");nN=nO,nZ(),nj&&e9({url:nj},i=>{i?nG(i):(nN=nU,nZ())})},nW={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>nN===nU||null!=nW.applyArabicShaping,isLoading:()=>nN===nO,setState(i){nN=i.pluginStatus,nj=i.pluginURL},isParsed:()=>null!=nW.applyArabicShaping&&null!=nW.processBidirectionalText&&null!=nW.processStyledBidirectionalText,getPluginURL:()=>nj};class nH{constructor(i,r){this.zoom=i,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition,this.pitch=r.pitch):(this.now=0,this.fadeDuration=0,this.zoomHistory=new nt,this.transition={},this.pitch=0)}isSupportedScript(i){return function(i,r){for(const n of i)if(!nB(n.charCodeAt(0),r))return!1;return!0}(i,nW.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const i=this.zoom,r=i-Math.floor(i),n=this.crossFadingFactor();return i>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}}class nK{constructor(i,r){this.property=i,this.value=r,this.expression=function(i,r){if(ri(i))return new rm(i,r);if(rh(i)){const n=rf(i,r);if("error"===n.result)throw Error(n.value.map(i=>`${i.key}: ${i.message}`).join(", "));return n.value}{let o=i;return"string"==typeof i&&"color"===r.type&&(o=tF.parse(i)),{kind:"constant",evaluate:()=>o}}}(void 0===r?i.specification.default:r,i.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(i,r,n){return this.property.possiblyEvaluate(this,i,r,n)}}class nY{constructor(i){this.property=i,this.value=new nK(i,void 0)}transitioned(i,r){return new nQ(this.property,this.value,r,et({},i.transition,this.transition),i.now)}untransitioned(){return new nQ(this.property,this.value,null,{},0)}}class nJ{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues)}getValue(i){return eu(this._values[i].value.value)}setValue(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nY(this._values[i].property)),this._values[i].value=new nK(this._values[i].property,null===r?void 0:eu(r))}getTransition(i){return eu(this._values[i].transition)}setTransition(i,r){this._values.hasOwnProperty(i)||(this._values[i]=new nY(this._values[i].property)),this._values[i].transition=eu(r)||void 0}serialize(){const i={};for(const r of Object.keys(this._values)){const n=this.getValue(r);void 0!==n&&(i[r]=n);const o=this.getTransition(r);void 0!==o&&(i[`${r}-transition`]=o)}return i}transitioned(i,r){const n=new n0(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].transitioned(i,r._values[o]);return n}untransitioned(){const i=new n0(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].untransitioned();return i}}class nQ{constructor(i,r,n,o,s){const a=o.delay||0,l=o.duration||0;s=s||0,this.property=i,this.value=r,this.begin=s+a,this.end=this.begin+l,i.specification.transition&&(o.delay||o.duration)&&(this.prior=n)}possiblyEvaluate(i,r,n){const o=i.now||0,s=this.value.possiblyEvaluate(i,r,n),a=this.prior;if(a){if(o>this.end||this.value.isDataDriven())return this.prior=null,s;if(oo.zoomHistory.lastIntegerZoom?{from:i,to:r,other:n}:{from:n,to:r,other:i}}interpolate(i){return i}}class n8{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,o){if(void 0!==i.value){if("constant"===i.expression.kind){const s=i.expression.evaluate(r,null,{},n,o);return this._calculate(s,s,s,r)}return this._calculate(i.expression.evaluate(new nH(Math.floor(r.zoom-1),r)),i.expression.evaluate(new nH(Math.floor(r.zoom),r)),i.expression.evaluate(new nH(Math.floor(r.zoom+1),r)),r)}}_calculate(i,r,n,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:i,to:r}:{from:n,to:r}}interpolate(i){return i}}class n9{constructor(i){this.specification=i}possiblyEvaluate(i,r,n,o){return!!i.expression.evaluate(r,null,{},n,o)}interpolate(){return!1}}class n7{constructor(i){for(const r in this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],i){const n=i[r];n.specification.overridable&&this.overridableProperties.push(r);const o=this.defaultPropertyValues[r]=new nK(n,void 0),s=this.defaultTransitionablePropertyValues[r]=new nY(n);this.defaultTransitioningPropertyValues[r]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=o.possiblyEvaluate({})}}}function oe(i,r){return 256*(i=K(Math.floor(i),0,255))+K(Math.floor(r),0,255)}r4("DataDrivenProperty",n4),r4("DataConstantProperty",n5),r4("CrossFadedDataDrivenProperty",n6),r4("CrossFadedProperty",n8),r4("ColorRampProperty",n9);const ot={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class oi{constructor(i,r){this._structArray=i,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class or{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(i,r){return i._trim(),r&&(i.isTransferred=!0,r.push(i.arrayBuffer)),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){const r=Object.create(this.prototype);return r.arrayBuffer=i.arrayBuffer,r.length=i.length,r.capacity=i.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function on(i,r=1){let n=0,o=0;return{members:i.map(i=>{const s=ot[i.type].BYTES_PER_ELEMENT,a=n=oo(n,Math.max(r,s)),l=i.components||1;return o=Math.max(o,s),n+=s*l,{name:i.name,type:i.type,components:l,offset:a}}),size:oo(n,Math.max(o,r)),alignment:r}}function oo(i,r){return Math.ceil(i/r)*r}class os extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.int16[o+0]=r,this.int16[o+1]=n,i}}os.prototype.bytesPerElement=4,r4("StructArrayLayout2i4",os);class oa extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=4*i;return this.int16[a+0]=r,this.int16[a+1]=n,this.int16[a+2]=o,this.int16[a+3]=s,i}}oa.prototype.bytesPerElement=8,r4("StructArrayLayout4i8",oa);class ol extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=6*i,u=12*i,d=3*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.uint8[u+4]=o,this.uint8[u+5]=s,this.uint8[u+6]=a,this.uint8[u+7]=l,this.float32[d+2]=c,i}}ol.prototype.bytesPerElement=12,r4("StructArrayLayout2i4ub1f12",ol);class oc extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.float32[s+0]=r,this.float32[s+1]=n,this.float32[s+2]=o,i}}oc.prototype.bytesPerElement=12,r4("StructArrayLayout3f12",oc);class oh extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u){const d=this.length;return this.resize(d+1),this.emplace(d,i,r,n,o,s,a,l,c,h,u)}emplace(i,r,n,o,s,a,l,c,h,u,d){const p=10*i;return this.uint16[p+0]=r,this.uint16[p+1]=n,this.uint16[p+2]=o,this.uint16[p+3]=s,this.uint16[p+4]=a,this.uint16[p+5]=l,this.uint16[p+6]=c,this.uint16[p+7]=h,this.uint16[p+8]=u,this.uint16[p+9]=d,i}}oh.prototype.bytesPerElement=20,r4("StructArrayLayout10ui20",oh);class ou extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c){const h=this.length;return this.resize(h+1),this.emplace(h,i,r,n,o,s,a,l,c)}emplace(i,r,n,o,s,a,l,c,h){const u=8*i;return this.uint16[u+0]=r,this.uint16[u+1]=n,this.uint16[u+2]=o,this.uint16[u+3]=s,this.uint16[u+4]=a,this.uint16[u+5]=l,this.uint16[u+6]=c,this.uint16[u+7]=h,i}}ou.prototype.bytesPerElement=16,r4("StructArrayLayout8ui16",ou);class od extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g){const y=this.length;return this.resize(y+1),this.emplace(y,i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y){const x=16*i;return this.int16[x+0]=r,this.int16[x+1]=n,this.int16[x+2]=o,this.int16[x+3]=s,this.uint16[x+4]=a,this.uint16[x+5]=l,this.uint16[x+6]=c,this.uint16[x+7]=h,this.int16[x+8]=u,this.int16[x+9]=d,this.int16[x+10]=p,this.int16[x+11]=f,this.int16[x+12]=m,this.int16[x+13]=$,this.int16[x+14]=g,this.int16[x+15]=y,i}}od.prototype.bytesPerElement=32,r4("StructArrayLayout4i4ui4i4i32",od);class op extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint32[1*i+0]=r,i}}op.prototype.bytesPerElement=4,r4("StructArrayLayout1ul4",op);class of extends or{_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(i,r,n,o,s,a,l,c,h,u,d,p,f){const m=this.length;return this.resize(m+1),this.emplace(m,i,r,n,o,s,a,l,c,h,u,d,p,f)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m){const $=20*i,g=10*i;return this.int16[$+0]=r,this.int16[$+1]=n,this.int16[$+2]=o,this.int16[$+3]=s,this.int16[$+4]=a,this.float32[g+3]=l,this.float32[g+4]=c,this.float32[g+5]=h,this.float32[g+6]=u,this.int16[$+14]=d,this.uint32[g+8]=p,this.uint16[$+18]=f,this.uint16[$+19]=m,i}}of.prototype.bytesPerElement=40,r4("StructArrayLayout5i4f1i1ul2ui40",of);class om extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=8*i;return this.int16[h+0]=r,this.int16[h+1]=n,this.int16[h+2]=o,this.int16[h+4]=s,this.int16[h+5]=a,this.int16[h+6]=l,this.int16[h+7]=c,i}}om.prototype.bytesPerElement=16,r4("StructArrayLayout3i2i2i16",om);class o$ extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,i,r,n,o,s)}emplace(i,r,n,o,s,a){const l=4*i,c=8*i;return this.float32[l+0]=r,this.float32[l+1]=n,this.float32[l+2]=o,this.int16[c+6]=s,this.int16[c+7]=a,i}}o$.prototype.bytesPerElement=16,r4("StructArrayLayout2f1f2i16",o$);class og extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=12*i,l=3*i;return this.uint8[a+0]=r,this.uint8[a+1]=n,this.float32[l+1]=o,this.float32[l+2]=s,i}}og.prototype.bytesPerElement=12,r4("StructArrayLayout2ub2f12",og);class oy extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.uint16[s+0]=r,this.uint16[s+1]=n,this.uint16[s+2]=o,i}}oy.prototype.bytesPerElement=6,r4("StructArrayLayout3ui6",oy);class ox extends or{_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(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w){const T=this.length;return this.resize(T+1),this.emplace(T,i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w,T){const E=30*i,S=15*i,I=60*i;return this.int16[E+0]=r,this.int16[E+1]=n,this.int16[E+2]=o,this.float32[S+2]=s,this.float32[S+3]=a,this.uint16[E+8]=l,this.uint16[E+9]=c,this.uint32[S+5]=h,this.uint32[S+6]=u,this.uint32[S+7]=d,this.uint16[E+16]=p,this.uint16[E+17]=f,this.uint16[E+18]=m,this.float32[S+10]=$,this.float32[S+11]=g,this.uint8[I+48]=y,this.uint8[I+49]=x,this.uint8[I+50]=v,this.uint32[S+13]=b,this.int16[E+28]=w,this.uint8[I+58]=T,i}}ox.prototype.bytesPerElement=60,r4("StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60",ox);class ov extends or{_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(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k){const P=this.length;return this.resize(P+1),this.emplace(P,i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k)}emplace(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w,T,E,S,I,M,A,C,z,k,P){const D=38*i,L=19*i;return this.int16[D+0]=r,this.int16[D+1]=n,this.int16[D+2]=o,this.float32[L+2]=s,this.float32[L+3]=a,this.int16[D+8]=l,this.int16[D+9]=c,this.int16[D+10]=h,this.int16[D+11]=u,this.int16[D+12]=d,this.int16[D+13]=p,this.uint16[D+14]=f,this.uint16[D+15]=m,this.uint16[D+16]=$,this.uint16[D+17]=g,this.uint16[D+18]=y,this.uint16[D+19]=x,this.uint16[D+20]=v,this.uint16[D+21]=b,this.uint16[D+22]=w,this.uint16[D+23]=T,this.uint16[D+24]=E,this.uint16[D+25]=S,this.uint16[D+26]=I,this.uint16[D+27]=M,this.uint16[D+28]=A,this.uint32[L+15]=C,this.float32[L+16]=z,this.float32[L+17]=k,this.float32[L+18]=P,i}}ov.prototype.bytesPerElement=76,r4("StructArrayLayout3i2f6i15ui1ul3f76",ov);class ob extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.float32[1*i+0]=r,i}}ob.prototype.bytesPerElement=4,r4("StructArrayLayout1f4",ob);class ow extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,i,r,n)}emplace(i,r,n,o){const s=3*i;return this.int16[s+0]=r,this.int16[s+1]=n,this.int16[s+2]=o,i}}ow.prototype.bytesPerElement=6,r4("StructArrayLayout3i6",ow);class oT extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o,s,a,l){const c=this.length;return this.resize(c+1),this.emplace(c,i,r,n,o,s,a,l)}emplace(i,r,n,o,s,a,l,c){const h=7*i;return this.float32[h+0]=r,this.float32[h+1]=n,this.float32[h+2]=o,this.float32[h+3]=s,this.float32[h+4]=a,this.float32[h+5]=l,this.float32[h+6]=c,i}}oT.prototype.bytesPerElement=28,r4("StructArrayLayout7f28",oT);class oE extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=6*i;return this.uint32[3*i+0]=r,this.uint16[a+2]=n,this.uint16[a+3]=o,this.uint16[a+4]=s,i}}oE.prototype.bytesPerElement=12,r4("StructArrayLayout1ul3ui12",oE);class oS extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.uint16[o+0]=r,this.uint16[o+1]=n,i}}oS.prototype.bytesPerElement=4,r4("StructArrayLayout2ui4",oS);class oI extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){const r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint16[1*i+0]=r,i}}oI.prototype.bytesPerElement=2,r4("StructArrayLayout1ui2",oI);class oM extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r){const n=this.length;return this.resize(n+1),this.emplace(n,i,r)}emplace(i,r,n){const o=2*i;return this.float32[o+0]=r,this.float32[o+1]=n,i}}oM.prototype.bytesPerElement=8,r4("StructArrayLayout2f8",oM);class oA extends or{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,i,r,n,o)}emplace(i,r,n,o,s){const a=4*i;return this.float32[a+0]=r,this.float32[a+1]=n,this.float32[a+2]=o,this.float32[a+3]=s,i}}oA.prototype.bytesPerElement=16,r4("StructArrayLayout4f16",oA);class oC extends oi{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]}}oC.prototype.size=40;class oz extends of{get(i){return new oC(this,i)}}r4("CollisionBoxArray",oz);class ok extends oi{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(i){this._structArray.uint8[this._pos1+49]=i}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(i){this._structArray.uint8[this._pos1+50]=i}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(i){this._structArray.uint32[this._pos4+13]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(i){this._structArray.uint8[this._pos1+58]=i}}ok.prototype.size=60;class oP extends ox{get(i){return new ok(this,i)}}r4("PlacedSymbolArray",oP);class oD extends oi{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(i){this._structArray.uint32[this._pos4+15]=i}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]}}oD.prototype.size=76;class oL extends ov{get(i){return new oD(this,i)}}r4("SymbolInstanceArray",oL);class oB extends ob{getoffsetX(i){return this.float32[1*i+0]}}r4("GlyphOffsetArray",oB);class oR extends ow{getx(i){return this.int16[3*i+0]}gety(i){return this.int16[3*i+1]}gettileUnitDistanceFromAnchor(i){return this.int16[3*i+2]}}r4("SymbolLineVertexArray",oR);class oF extends oi{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]}}oF.prototype.size=12;class oO extends oE{get(i){return new oF(this,i)}}r4("FeatureIndexArray",oO);class oU extends oi{get a_centroid_pos0(){return this._structArray.uint16[this._pos2+0]}get a_centroid_pos1(){return this._structArray.uint16[this._pos2+1]}}oU.prototype.size=4;class oV extends oS{get(i){return new oU(this,i)}}r4("FillExtrusionCentroidArray",oV);const oN=on([{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"},]),oj=on([{name:"a_dash_to",components:4,type:"Uint16"},{name:"a_dash_from",components:4,type:"Uint16"},]);var oG=tB(function(i){i.exports=function(i,r){var n,o,s,a,l,c,h,u;for(o=i.length-(n=3&i.length),s=r,l=3432918353,c=461845907,u=0;u>>16)*l&65535)<<16)&4294967295)<<15|h>>>17))*c+(((h>>>16)*c&65535)<<16)&4294967295)<<13|s>>>19))+((5*(s>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(h=0,n){case 3:h^=(255&i.charCodeAt(u+2))<<16;case 2:h^=(255&i.charCodeAt(u+1))<<8;case 1:s^=h=(65535&(h=(h=(65535&(h^=255&i.charCodeAt(u)))*l+(((h>>>16)*l&65535)<<16)&4294967295)<<15|h>>>17))*c+(((h>>>16)*c&65535)<<16)&4294967295}return s^=i.length,s=2246822507*(65535&(s^=s>>>16))+((2246822507*(s>>>16)&65535)<<16)&4294967295,s=3266489909*(65535&(s^=s>>>13))+((3266489909*(s>>>16)&65535)<<16)&4294967295,(s^=s>>>16)>>>0}}),oZ=tB(function(i){i.exports=function(i,r){for(var n,o=i.length,s=r^o,a=0;o>=4;)n=1540483477*(65535&(n=255&i.charCodeAt(a)|(255&i.charCodeAt(++a))<<8|(255&i.charCodeAt(++a))<<16|(255&i.charCodeAt(++a))<<24))+((1540483477*(n>>>16)&65535)<<16),s=1540483477*(65535&s)+((1540483477*(s>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),o-=4,++a;switch(o){case 3:s^=(255&i.charCodeAt(a+2))<<16;case 2:s^=(255&i.charCodeAt(a+1))<<8;case 1:s=1540483477*(65535&(s^=255&i.charCodeAt(a)))+((1540483477*(s>>>16)&65535)<<16)}return s=1540483477*(65535&(s^=s>>>13))+((1540483477*(s>>>16)&65535)<<16),(s^=s>>>15)>>>0}}),o_=oG;o_.murmur3=oG,o_.murmur2=oZ;class oq{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(i,r,n,o){this.ids.push(oX(i)),this.positions.push(r,n,o)}getPositions(i){const r=oX(i);let n=0,o=this.ids.length-1;for(;n>1;this.ids[s]>=r?o=s:n=s+1}const a=[];for(;this.ids[n]===r;)a.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return a}static serialize(i,r){const n=new Float64Array(i.ids),o=new Uint32Array(i.positions);return function i(r,n,o,s){for(;o>1];let l=o-1,c=s+1;for(;;){do l++;while(r[l]a)if(l>=c)break;oW(r,l,c),oW(n,3*l,3*c),oW(n,3*l+1,3*c+1),oW(n,3*l+2,3*c+2)}c-o`u_${i}`),this.type=n}setUniform(i,r,n){i.set(n.constantOr(this.value))}getBinding(i,r,n){return"color"===this.type?new oJ(i,r):new oK(i,r)}}class o5{constructor(i,r){this.uniformNames=r.map(i=>`u_${i}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(i,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=i.pixelRatio,this.patternFrom=r.tl.concat(r.br),this.patternTo=i.tl.concat(i.br)}setUniform(i,r,n,o){const s="u_pattern_to"===o||"u_dash_to"===o?this.patternTo:"u_pattern_from"===o||"u_dash_from"===o?this.patternFrom:"u_pixel_ratio_to"===o?this.pixelRatioTo:"u_pixel_ratio_from"===o?this.pixelRatioFrom:null;s&&i.set(s)}getBinding(i,r,n){return"u_pattern_from"===n||"u_pattern_to"===n||"u_dash_from"===n||"u_dash_to"===n?new oY(i,r):new oK(i,r)}}class o4{constructor(i,r,n,o){this.expression=i,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(i,r,n,o,s,a){const l=this.paintVertexArray.length,c=this.expression.evaluate(new nH(0),r,{},s,o,a);this.paintVertexArray.resize(i),this._setPaintValue(l,i,c)}updatePaintArray(i,r,n,o,s){const a=this.expression.evaluate({zoom:0},n,o,void 0,s);this._setPaintValue(i,r,a)}_setPaintValue(i,r,n){if("color"===this.type){const o=o2(n);for(let s=i;s`u_${i}_t`),this.type=n,this.useIntegerZoom=o,this.zoom=s,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===n?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(i,r,n,o,s,a){const l=this.expression.evaluate(new nH(this.zoom),r,{},s,o,a),c=this.expression.evaluate(new nH(this.zoom+1),r,{},s,o,a),h=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(h,i,l,c)}updatePaintArray(i,r,n,o,s){const a=this.expression.evaluate({zoom:this.zoom},n,o,void 0,s),l=this.expression.evaluate({zoom:this.zoom+1},n,o,void 0,s);this._setPaintValue(i,r,a,l)}_setPaintValue(i,r,n,o){if("color"===this.type){const s=o2(n),a=o2(o);for(let l=i;l!0){this.binders={},this._buffers=[];const o=[];for(const s in i.paint._values){if(!n(s))continue;const a=i.paint.get(s);if(!(a instanceof n2&&i9(a.property.specification)))continue;const l=st(s,i.type),c=a.value,h=a.property.specification.type,u=a.property.useIntegerZoom,d=a.property.specification["property-type"],p="cross-faded"===d||"cross-faded-data-driven"===d,f="line-dasharray"===String(s)&&"constant"!==i.layout.get("line-cap").value.kind;if("constant"!==c.kind||f){if("source"===c.kind||f||p){const m=sn(s,h,"source");this.binders[s]=p?new o8(c,l,h,u,r,m,i.id):new o4(c,l,h,m),o.push(`/a_${s}`)}else{const $=sn(s,h,"composite");this.binders[s]=new o6(c,l,h,u,r,$),o.push(`/z_${s}`)}}else this.binders[s]=p?new o5(c.value,l):new o3(c.value,l,h),o.push(`/u_${s}`)}this.cacheKey=o.sort().join("")}getMaxValue(i){const r=this.binders[i];return r instanceof o4||r instanceof o6?r.maxValue:0}populatePaintArrays(i,r,n,o,s,a){for(const l in this.binders){const c=this.binders[l];(c instanceof o4||c instanceof o6||c instanceof o8)&&c.populatePaintArray(i,r,n,o,s,a)}}setConstantPatternPositions(i,r){for(const n in this.binders){const o=this.binders[n];o instanceof o5&&o.setConstantPatternPositions(i,r)}}updatePaintArrays(i,r,n,o,s,a){let l=!1;for(const c in i){const h=r.getPositions(c);for(const u of h){const d=n.feature(u.index);for(const p in this.binders){const f=this.binders[p];if((f instanceof o4||f instanceof o6||f instanceof o8)&&!0===f.expression.isStateDependent){const m=o.paint.get(p);f.expression=m.value,f.updatePaintArray(u.start,u.end,d,i[c],s,a),l=!0}}}}return l}defines(){const i=[];for(const r in this.binders){const n=this.binders[r];(n instanceof o3||n instanceof o5)&&i.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return i}getBinderAttributes(){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof o4||n instanceof o6||n instanceof o8)for(let o=0;o!0){for(const o of(this.programConfigurations={},i))this.programConfigurations[o.id]=new o9(o,r,n);this.needsUpload=!1,this._featureMap=new oq,this._bufferOffset=0}populatePaintArrays(i,r,n,o,s,a,l){for(const c in this.programConfigurations)this.programConfigurations[c].populatePaintArrays(i,r,o,s,a,l);void 0!==r.id&&this._featureMap.add(r.id,n,this._bufferOffset,i),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,r,n,o,s){for(const a of n)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(i,this._featureMap,r,a,o,s)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(i);this.needsUpload=!1}}destroy(){for(const i in this.programConfigurations)this.programConfigurations[i].destroy()}}const se={"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 st(i,r){return se[i]||[i.replace(`${r}-`,"").replace(/-/g,"_"),]}const si={"line-pattern":{source:oh,composite:oh},"fill-pattern":{source:oh,composite:oh},"fill-extrusion-pattern":{source:oh,composite:oh},"line-dasharray":{source:ou,composite:ou}},sr={color:{source:oM,composite:oA},number:{source:ob,composite:oM}};function sn(i,r,n){const o=si[i];return o&&o[n]||sr[r][n]}r4("ConstantBinder",o3),r4("CrossFadedConstantBinder",o5),r4("SourceExpressionBinder",o4),r4("CrossFadedCompositeBinder",o8),r4("CompositeExpressionBinder",o6),r4("ProgramConfiguration",o9,{omit:["_buffers"]}),r4("ProgramConfigurationSet",o7);const so="-transition";class ss extends th{constructor(i,r){if(super(),this.id=i.id,this.type=i.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==i.type&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,"background"!==i.type&&"sky"!==i.type&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),r.layout&&(this._unevaluatedLayout=new n1(r.layout)),r.paint)){for(const n in this._transitionablePaint=new nJ(r.paint),i.paint)this.setPaintProperty(n,i.paint[n],{validate:!1});for(const o in i.layout)this.setLayoutProperty(o,i.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new n3(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(i){return"visibility"===i?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,r,n={}){null!=r&&this._validate(rJ,`layers.${this.id}.layout.${i}`,i,r,n)||("visibility"!==i?this._unevaluatedLayout.setValue(i,r):this.visibility=r)}getPaintProperty(i){return el(i,so)?this._transitionablePaint.getTransition(i.slice(0,-so.length)):this._transitionablePaint.getValue(i)}setPaintProperty(i,r,n={}){if(null!=r&&this._validate(rY,`layers.${this.id}.paint.${i}`,i,r,n))return!1;if(el(i,so))return this._transitionablePaint.setTransition(i.slice(0,-so.length),r||void 0),!1;{const o=this._transitionablePaint._values[i],s="cross-faded-data-driven"===o.property.specification["property-type"],a=o.value.isDataDriven(),l=o.value;this._transitionablePaint.setValue(i,r),this._handleSpecialPaintPropertyUpdate(i);const c=this._transitionablePaint._values[i].value;return c.isDataDriven()||a||s||this._handleOverridablePaintPropertyUpdate(i,l,c)}}_handleSpecialPaintPropertyUpdate(i){}getProgramIds(){return null}getProgramConfiguration(i){return null}_handleOverridablePaintPropertyUpdate(i,r,n){return!1}isHidden(i){return!!(this.minzoom&&i=this.maxzoom)||"none"===this.visibility}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,r){i.getCrossfadeParameters&&(this._crossfadeParameters=i.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,r)}serialize(){const i={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&&(i.layout=i.layout||{},i.layout.visibility=this.visibility),eh(i,(i,r)=>!(void 0===i||"layout"===r&&!Object.keys(i).length||"paint"===r&&!Object.keys(i).length))}_validate(i,r,n,o,s={}){return(!s||!1!==s.validate)&&rQ(this,i.call(rW,{key:r,layerType:this.type,objectKey:n,value:o,styleSpec:tu,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const i in this.paint._values){const r=this.paint.get(i);if(r instanceof n2&&i9(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=rT(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const sa=on([{name:"a_pos",components:2,type:"Int16"},],4),{members:sl}=sa;class sc{constructor(i=[]){this.segments=i}prepareSegment(i,r,n,o){let s=this.segments[this.segments.length-1];return i>sc.MAX_VERTEX_ARRAY_LENGTH&&ep(`Max vertices per segment is ${sc.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!s||s.vertexLength+i>sc.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==o)&&(s={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==o&&(s.sortKey=o),this.segments.push(s)),s}get(){return this.segments}destroy(){for(const i of this.segments)for(const r in i.vaos)i.vaos[r].destroy()}static simpleSegment(i,r,n,o){return new sc([{vertexOffset:i,primitiveOffset:r,vertexLength:n,primitiveLength:o,vaos:{},sortKey:0},])}}sc.MAX_VERTEX_ARRAY_LENGTH=65535,r4("SegmentVector",sc);class sh{constructor(i,r){i&&(r?this.setSouthWest(i).setNorthEast(r):4===i.length?this.setSouthWest([i[0],i[1],]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1]))}setNorthEast(i){return this._ne=i instanceof su?new su(i.lng,i.lat):su.convert(i),this}setSouthWest(i){return this._sw=i instanceof su?new su(i.lng,i.lat):su.convert(i),this}extend(i){const r=this._sw,n=this._ne;let o,s;if(i instanceof su)o=i,s=i;else{if(!(i instanceof sh))return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(sh.convert(i)):this.extend(su.convert(i)):this;if(o=i._sw,s=i._ne,!o||!s)return this}return r||n?(r.lng=Math.min(o.lng,r.lng),r.lat=Math.min(o.lat,r.lat),n.lng=Math.max(s.lng,n.lng),n.lat=Math.max(s.lat,n.lat)):(this._sw=new su(o.lng,o.lat),this._ne=new su(s.lng,s.lat)),this}getCenter(){return new su((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 su(this.getWest(),this.getNorth())}getSouthEast(){return new su(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(i){const{lng:r,lat:n}=su.convert(i);let o=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&o}static convert(i){return!i||i instanceof sh?i:new sh(i)}}class su{constructor(i,r){if(isNaN(i)||isNaN(r))throw Error(`Invalid LngLat object: (${i}, ${r})`);if(this.lng=+i,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new su(J(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){const r=Math.PI/180,n=this.lat*r,o=i.lat*r,s=Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos((i.lng-this.lng)*r);return 6371008.8*Math.acos(Math.min(s,1))}toBounds(i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*this.lat);return new sh(new su(this.lng-n,this.lat-r),new su(this.lng+n,this.lat+r))}static convert(i){if(i instanceof su)return i;if(Array.isArray(i)&&(2===i.length||3===i.length))return new su(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&"object"==typeof i&&null!==i)return new su(Number("lng"in i?i.lng:i.lon),Number(i.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const sd=2*Math.PI*6371008.8;function sp(i){return sd*Math.cos(i*Math.PI/180)}function sf(i){return(180+i)/360}function sm(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function s$(i,r){return i/sp(r)}function sg(i){return 360*i-180}function sy(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}function sx(i,r){return i*sp(sy(r))}class sv{constructor(i,r,n=0){this.x=+i,this.y=+r,this.z=+n}static fromLngLat(i,r=0){const n=su.convert(i);return new sv(sf(n.lng),sm(n.lat),r/sp(n.lat))}toLngLat(){return new su(sg(this.x),sy(this.y))}toAltitude(){return sx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/sd*(1/Math.cos(sy(this.y)*Math.PI/180))}}function sb(i,r,n,o,s,a,c,h,u){const d=(r+o)/2,p=(n+s)/2,f=new l(d,p);h(f),function(i,r,n,o,s,a){const l=n-s,c=o-a;return Math.abs((o-r)*l-(n-i)*c)/Math.hypot(l,c)}(f.x,f.y,a.x,a.y,c.x,c.y)>=u?(sb(i,r,n,d,p,a,f,h,u),sb(i,d,p,o,s,f,c,h,u)):i.push(c)}function sw(i,r,n){const o=[];let s,a,l;for(const c of i){const{x:h,y:u}=c;r(c),l?sb(o,s,a,h,u,l,c,r,n):o.push(c),s=h,a=u,l=c}return o}const sT=-16383-1;function sE(i,r){const n=Math.round(i.x*r),o=Math.round(i.y*r);return i.x=K(n,sT,16383),i.y=K(o,sT,16383),(ni.x+1||oi.y+1)&&ep("Geometry exceeds allowed extent, reduce your vector tile buffer size"),i}function sS(i,r,n){const o=i.loadGeometry(),s=i.extent,a=8192/s;if(r&&n&&n.projection.isReprojectedInTileSpace){const l=1<{const n=sg((r.x+i.x/s)/l),o=sy((r.y+i.y/s)/l),a=d.project(n,o);i.x=(a.x*c-h)*s,i.y=(a.y*c-u)*s};for(let f=0;f=s||$.y<0||$.y>=s||(p($),m.push($));o[f]=m}}for(const g of o)for(const y of g)sE(y,a);return o}function sI(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?sS(i):[]}}function sM(i,r,n,o,s){i.emplaceBack(2*r+(o+1)/2,2*n+(s+1)/2)}class sA{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new os,this.indexArray=new oy,this.segments=new sc,this.programConfigurations=new o7(i.layers,i.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){const s=this.layers[0],a=[];let l=null;for(const{feature:c,id:h,index:u,sourceLayerIndex:d}of("circle"===s.type&&(l=s.layout.get("circle-sort-key")),i)){const p=this.layers[0]._featureFilter.needGeometry,f=sI(c,p);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom),f,n))continue;const m=l?l.evaluate(f,{},n):void 0,$={id:h,properties:c.properties,type:c.type,sourceLayerIndex:d,index:u,geometry:p?f.geometry:sS(c,n,o),patterns:{},sortKey:m};a.push($)}for(const g of(l&&a.sort((i,r)=>i.sortKey-r.sortKey),a)){const{geometry:y,index:x,sourceLayerIndex:v}=g,b=i[x].feature;this.addFeature(g,y,x,r.availableImages,n),r.featureIndex.insert(b,y,x,v,this.index)}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,sl),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(i,r,n,o,s){for(const a of r)for(const l of a){const c=l.x,h=l.y;if(c<0||c>=8192||h<0||h>=8192)continue;const u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),d=u.vertexLength;sM(this.layoutVertexArray,c,h,-1,-1),sM(this.layoutVertexArray,c,h,1,-1),sM(this.layoutVertexArray,c,h,1,1),sM(this.layoutVertexArray,c,h,-1,1),this.indexArray.emplaceBack(d,d+1,d+2),this.indexArray.emplaceBack(d,d+3,d+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,{},o,s)}}function sC(i,r){for(let n=0;n1){if(sD(i,r))return!0;for(let o=0;o1?n:n.sub(r)._mult(s)._add(r))}function sF(i,r){let n,o,s,a=!1;for(let l=0;lr.y!=s.y>r.y&&r.x<(s.x-o.x)*(r.y-o.y)/(s.y-o.y)+o.x&&(a=!a)}return a}function sO(i,r){let n=!1;for(let o=0,s=i.length-1;or.y!=l.y>r.y&&r.x<(l.x-a.x)*(r.y-a.y)/(l.y-a.y)+a.x&&(n=!n)}return n}function sU(i,r,n,o,s){for(const a of i)if(r<=a.x&&n<=a.y&&o>=a.x&&s>=a.y)return!0;const c=[new l(r,n),new l(r,s),new l(o,s),new l(o,n),];if(i.length>2){for(const h of c)if(sO(i,h))return!0}for(let u=0;us.x&&r.x>s.x||i.ys.y&&r.y>s.y)return!1;const a=ef(i,r,n[0]);return a!==ef(i,r,n[1])||a!==ef(i,r,n[2])||a!==ef(i,r,n[3])}function sN(i,r,n){const o=r.paint.get(i).value;return"constant"===o.kind?o.value:n.programConfigurations.get(r.id).getMaxValue(i)}function sj(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function sG(i,r,n,o,s){if(!r[0]&&!r[1])return i;const a=l.convert(r)._mult(s);"viewport"===n&&a._rotate(-o);const c=[];for(let h=0;h{var a,l,c;const h=F([],n,i),u=1/h[3]/r*s;return a=h,l=h,c=[u,u,o?1/h[3]:u,u],a[0]=l[0]*c[0],a[1]=l[1]*c[1],a[2]=l[2]*c[2],a[3]=l[3]*c[3],a}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5],].map(i=>{const r=z([],P([],R([],a[i[0]],a[i[1]]),R([],a[i[2]],a[i[1]]))),n=-k(r,a[i[1]]);return r.concat(n)});return new sX(a,l)}}class sW{constructor(i,r){this.min=i,this.max=r,this.center=A([],E([],this.min,this.max),.5)}quadrant(i){const r=[i%2==0,i<2],n=b(this.min),o=b(this.max);for(let s=0;s=0;if(0===a)return 0;a!==r.length&&(n=!1)}if(n)return 2;for(let c=0;c<3;c++){let h=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(let d=0;dthis.max[c]-this.min[c])return 0}return 1}}function sH(i,r,n,o,s,a,l,c,h){if(a&&i.queryGeometry.isAboveHorizon)return!1;for(const u of(a&&(h*=i.pixelToTileUnitsFactor),r))for(const d of u){const p=d.add(c),f=s&&n.elevation?n.elevation.exaggeration()*s.getElevationAt(p.x,p.y,!0):0,m=a?p:sK(p,f,o),$=a?i.tilespaceRays.map(i=>sQ(i,f)):i.queryGeometry.screenGeometry,g=F([],[d.x,d.y,f,1],o);if(!l&&a?h*=g[3]/n.cameraToCenterDistance:l&&!a&&(h*=n.cameraToCenterDistance/g[3]),sz($,m,h))return!0}return!1}function sK(i,r,n){const o=F([],[i.x,i.y,r,1],n);return new l(o[0]/o[3],o[1]/o[3])}const sY=T(0,0,0),sJ=T(0,0,1);function sQ(i,r){const n=v();return sY[2]=r,i.intersectsPlane(sY,sJ,n),new l(n[0],n[1])}class s0 extends sA{}function s1(i,{width:r,height:n},o,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==r*n*o)throw RangeError("mismatched image size")}else s=new Uint8Array(r*n*o);return i.width=r,i.height=n,i.data=s,i}function s2(i,{width:r,height:n},o){if(r===i.width&&n===i.height)return;const s=s1({},{width:r,height:n},o);s3(i,s,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,r),height:Math.min(i.height,n)},o),i.width=r,i.height=n,i.data=s.data}function s3(i,r,n,o,s,a){if(0===s.width||0===s.height)return r;if(s.width>i.width||s.height>i.height||n.x>i.width-s.width||n.y>i.height-s.height)throw RangeError("out of range source coordinates for image copy");if(s.width>r.width||s.height>r.height||o.x>r.width-s.width||o.y>r.height-s.height)throw RangeError("out of range destination coordinates for image copy");const l=i.data,c=r.data;for(let h=0;h{r[i.evaluationKey]=a;const l=i.expression.evaluate(r);s.data[n+o+0]=Math.floor(255*l.r/l.a),s.data[n+o+1]=Math.floor(255*l.g/l.a),s.data[n+o+2]=Math.floor(255*l.b/l.a),s.data[n+o+3]=Math.floor(255*l.a)};if(i.clips)for(let l=0,c=0;l80*n){o=a=i[0],s=l=i[1];for(var $=n;$a&&(a=c),h>l&&(l=h);u=0!==(u=Math.max(a-o,l-s))?1/u:0}return ao(f,m,n,o,s,u),m}function ar(i,r,n,o,s){var a,l;if(s===aM(i,r,n,o)>0)for(a=r;a=r;a-=o)l=aE(a,i[a],i[a+1],l);return l&&ay(l,l.next)&&(aS(l),l=l.next),l}function an(i,r){if(!i)return i;r||(r=i);var n,o=i;do if(n=!1,o.steiner||!ay(o,o.next)&&0!==ag(o.prev,o,o.next))o=o.next;else{if(aS(o),(o=r=o.prev)===o.next)break;n=!0}while(n||o!==r)return r}function ao(i,r,n,o,s,a,l){if(i){!l&&a&&function(i,r,n,o){var s=i;do null===s.z&&(s.z=ap(s.x,s.y,r,n,o)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i)s.prevZ.nextZ=null,s.prevZ=null,function(i){var r,n,o,s,a,l,c,h,u=1;do{for(n=i,i=null,a=null,l=0;n;){for(l++,o=n,c=0,r=0;r0||h>0&&o;)0!==c&&(0===h||!o||n.z<=o.z)?(s=n,n=n.nextZ,c--):(s=o,o=o.nextZ,h--),a?a.nextZ=s:i=s,s.prevZ=a,a=s;n=o}a.nextZ=null,u*=2}while(l>1)}(s)}(i,o,s,a);for(var c,h,u=i;i.prev!==i.next;)if(c=i.prev,h=i.next,a?aa(i,o,s,a):as(i))r.push(c.i/n),r.push(i.i/n),r.push(h.i/n),aS(i),i=h.next,u=h.next;else if((i=h)===u){l?1===l?ao(i=al(an(i),r,n),r,n,o,s,a,2):2===l&&ac(i,r,n,o,s,a):ao(an(i),r,n,o,s,a,1);break}}}function as(i){var r=i.prev,n=i,o=i.next;if(ag(r,n,o)>=0)return!1;for(var s=i.next.next;s!==i.prev;){if(am(r.x,r.y,n.x,n.y,o.x,o.y,s.x,s.y)&&ag(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function aa(i,r,n,o){var s=i.prev,a=i,l=i.next;if(ag(s,a,l)>=0)return!1;for(var c=s.x>a.x?s.x>l.x?s.x:l.x:a.x>l.x?a.x:l.x,h=s.y>a.y?s.y>l.y?s.y:l.y:a.y>l.y?a.y:l.y,u=ap(s.x=u&&f&&f.z<=d;){if(p!==i.prev&&p!==i.next&&am(s.x,s.y,a.x,a.y,l.x,l.y,p.x,p.y)&&ag(p.prev,p,p.next)>=0||(p=p.prevZ,f!==i.prev&&f!==i.next&&am(s.x,s.y,a.x,a.y,l.x,l.y,f.x,f.y)&&ag(f.prev,f,f.next)>=0))return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==i.prev&&p!==i.next&&am(s.x,s.y,a.x,a.y,l.x,l.y,p.x,p.y)&&ag(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==i.prev&&f!==i.next&&am(s.x,s.y,a.x,a.y,l.x,l.y,f.x,f.y)&&ag(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function al(i,r,n){var o=i;do{var s=o.prev,a=o.next.next;!ay(s,a)&&ax(s,o,o.next,a)&&aw(s,a)&&aw(a,s)&&(r.push(s.i/n),r.push(o.i/n),r.push(a.i/n),aS(o),aS(o.next),o=i=a),o=o.next}while(o!==i)return an(o)}function ac(i,r,n,o,s,a){var l=i;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&a$(l,c)){var h=aT(l,c);return l=an(l,l.next),h=an(h,h.next),ao(l,r,n,o,s,a),void ao(h,r,n,o,s,a)}c=c.next}l=l.next}while(l!==i)}function ah(i,r){return i.x-r.x}function au(i,r){var n=function(i,r){var n,o=r,s=i.x,a=i.y,l=-1/0;do{if(a<=o.y&&a>=o.next.y&&o.next.y!==o.y){var c=o.x+(a-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(c<=s&&c>l){if(l=c,c===s){if(a===o.y)return o;if(a===o.next.y)return o.next}n=o.x=o.x&&o.x>=d&&s!==o.x&&am(an.x||o.x===n.x&&ad(n,o)))&&(n=o,f=h)),o=o.next;while(o!==u)return n}(i,r);if(!n)return r;var o=aT(n,i),s=an(n,n.next);return an(o,o.next),r===n?s:r}function ad(i,r){return 0>ag(i.prev,i,r.prev)&&0>ag(r.next,i,i.next)}function ap(i,r,n,o,s){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-n)*s)|i<<8))|i<<4))|i<<2))|i<<1))|(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=32767*(r-o)*s)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function af(i){var r=i,n=i;do(r.x=0&&(i-l)*(o-c)-(n-l)*(r-c)>=0&&(n-l)*(a-c)-(s-l)*(o-c)>=0}function a$(i,r){return i.next.i!==r.i&&i.prev.i!==r.i&&!function(i,r){var n=i;do{if(n.i!==i.i&&n.next.i!==i.i&&n.i!==r.i&&n.next.i!==r.i&&ax(n,n.next,i,r))return!0;n=n.next}while(n!==i)return!1}(i,r)&&(aw(i,r)&&aw(r,i)&&function(i,r){var n=i,o=!1,s=(i.x+r.x)/2,a=(i.y+r.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&s<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==i)return o}(i,r)&&(ag(i.prev,i,r.prev)||ag(i,r.prev,r))||ay(i,r)&&ag(i.prev,i,i.next)>0&&ag(r.prev,r,r.next)>0)}function ag(i,r,n){return(r.y-i.y)*(n.x-r.x)-(r.x-i.x)*(n.y-r.y)}function ay(i,r){return i.x===r.x&&i.y===r.y}function ax(i,r,n,o){var s=ab(ag(i,r,n)),a=ab(ag(i,r,o)),l=ab(ag(n,o,i)),c=ab(ag(n,o,r));return s!==a&&l!==c||!(0!==s||!av(i,n,r))||!(0!==a||!av(i,o,r))||!(0!==l||!av(n,i,o))||!(0!==c||!av(n,r,o))}function av(i,r,n){return r.x<=Math.max(i.x,n.x)&&r.x>=Math.min(i.x,n.x)&&r.y<=Math.max(i.y,n.y)&&r.y>=Math.min(i.y,n.y)}function ab(i){return i>0?1:i<0?-1:0}function aw(i,r){return 0>ag(i.prev,i,i.next)?ag(i,r,i.next)>=0&&ag(i,i.prev,r)>=0:0>ag(i,r,i.prev)||0>ag(i,i.next,r)}function aT(i,r){var n=new aI(i.i,i.x,i.y),o=new aI(r.i,r.x,r.y),s=i.next,a=r.prev;return i.next=r,r.prev=i,n.next=s,s.prev=n,o.next=n,n.prev=o,a.next=o,o.prev=a,o}function aE(i,r,n,o){var s=new aI(i,r,n);return o?(s.next=o.next,s.prev=o,o.next.prev=s,o.next=s):(s.prev=s,s.next=s),s}function aS(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function aI(i,r,n){this.i=i,this.x=r,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function aM(i,r,n,o){for(var s=0,a=r,l=n-o;ao;){if(s-o>600){var l=s-o+1,c=n-o+1,h=Math.log(l),u=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1);i(r,n,Math.max(o,Math.floor(n-c*u/l+d)),Math.min(s,Math.floor(n+(l-c)*u/l+d)),a)}var p=r[n],f=o,m=s;for(aC(r,o,n),a(r[s],p)>0&&aC(r,o,s);fa(r[f],p);)f++;for(;a(r[m],p)>0;)m--}0===a(r[o],p)?aC(r,o,m):aC(r,++m,s),m<=n&&(o=m+1),n<=m&&(s=m-1)}})(i,r,n||0,o||i.length-1,s||az)}function aC(i,r,n){var o=i[r];i[r]=i[n],i[n]=o}function az(i,r){return ir?1:0}function ak(i,r){const n=i.length;if(n<=1)return[i];const o=[];let s,a;for(let l=0;l1)for(let h=0;h0&&n.holes.push(o+=i[s-1].length)}return n},at.default=ai;class aB{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new os,this.indexArray=new oy,this.indexArray2=new oS,this.programConfigurations=new o7(i.layers,i.zoom),this.segments=new sc,this.segments2=new sc,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){this.hasPattern=aD("fill",this.layers,r);const s=this.layers[0].layout.get("fill-sort-key"),a=[];for(const{feature:l,id:c,index:h,sourceLayerIndex:u}of i){const d=this.layers[0]._featureFilter.needGeometry,p=sI(l,d);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom),p,n))continue;const f=s?s.evaluate(p,{},n,r.availableImages):void 0,m={id:c,properties:l.properties,type:l.type,sourceLayerIndex:u,index:h,geometry:d?p.geometry:sS(l,n,o),patterns:{},sortKey:f};a.push(m)}for(const $ of(s&&a.sort((i,r)=>i.sortKey-r.sortKey),a)){const{geometry:g,index:y,sourceLayerIndex:x}=$;if(this.hasPattern){const v=aL("fill",this.layers,$,this.zoom,r);this.patternFeatures.push(v)}else this.addFeature($,g,y,n,{},r.availableImages);r.featureIndex.insert(i[y].feature,g,y,x,this.index)}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}addFeatures(i,r,n,o){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,r,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,ae),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.indexBuffer2=i.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(i),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(i,r,n,o,s,a=[]){for(const l of ak(r,500)){let c=0;for(const h of l)c+=h.length;const u=this.segments.prepareSegment(c,this.layoutVertexArray,this.indexArray),d=u.vertexLength,p=[],f=[];for(const m of l){if(0===m.length)continue;m!==l[0]&&f.push(p.length/2);const $=this.segments2.prepareSegment(m.length,this.layoutVertexArray,this.indexArray2),g=$.vertexLength;this.layoutVertexArray.emplaceBack(m[0].x,m[0].y),this.indexArray2.emplaceBack(g+m.length-1,g),p.push(m[0].x),p.push(m[0].y);for(let y=1;y>3}if(s--,1===o||2===o)a+=i.readSVarint(),c+=i.readSVarint(),1===o&&(r&&h.push(r),r=[]),r.push(new l(a,c));else{if(7!==o)throw Error("unknown command "+o);r&&r.push(r[0].clone())}}return r&&h.push(r),h},aj.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var r=i.readVarint()+i.pos,n=1,o=0,s=0,a=0,l=1/0,c=-1/0,h=1/0,u=-1/0;i.pos>3}if(o--,1===n||2===n)(s+=i.readSVarint())c&&(c=s),(a+=i.readSVarint())u&&(u=a);else if(7!==n)throw Error("unknown command "+n)}return[l,h,c,u]},aj.prototype.toGeoJSON=function(i,r,n){var o,s,a=this.extent*Math.pow(2,n),l=this.extent*i,c=this.extent*r,h=this.loadGeometry(),u=aj.types[this.type];function d(i){for(var r=0;r>3;r=1===o?i.readString():2===o?i.readFloat():3===o?i.readDouble():4===o?i.readVarint64():5===o?i.readVarint():6===o?i.readSVarint():7===o?i.readBoolean():null}return r}(n))}function aW(i,r,n){if(3===i){var o=new a_(n,n.readVarint()+n.pos);o.length&&(r[o.name]=o)}}aq.prototype.feature=function(i){if(i<0||i>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new aN(this._pbf,r,this.extent,this._keys,this._values)};var aH={VectorTile:function(i,r){this.layers=i.readFields(aW,{},r)},VectorTileFeature:aN,VectorTileLayer:a_};const aK=aH.VectorTileFeature.types;function aY(i,r,n,o,s,a,l,c){i.emplaceBack((r<<1)+l,(n<<1)+a,(Math.floor(8192*o)<<1)+s,Math.round(c))}class aJ{constructor(){this.acc=new l(0,0),this.polyCount=[]}startRing(i){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new l(i.x,i.y),this.max=new l(i.x,i.y))}append(i,r){this.currentPolyCount.edges++,this.acc._add(i);let n=!!this.borders;const o=this.min,s=this.max;i.xs.x&&(s.x=i.x,n=!0),i.ys.y&&(s.y=i.y,n=!0),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),n&&this.checkBorderIntersection(i,r)}checkBorderIntersection(i,r){r.x<0!=i.x<0&&this.addBorderIntersection(0,ix(r.y,i.y,(0-r.x)/(i.x-r.x))),r.x>8192!=i.x>8192&&this.addBorderIntersection(1,ix(r.y,i.y,(8192-r.x)/(i.x-r.x))),r.y<0!=i.y<0&&this.addBorderIntersection(2,ix(r.x,i.x,(0-r.y)/(i.y-r.y))),r.y>8192!=i.y>8192&&this.addBorderIntersection(3,ix(r.x,i.x,(8192-r.y)/(i.y-r.y)))}addBorderIntersection(i,r){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 n=this.borders[i];rn[1]&&(n[1]=r)}processBorderOverlap(i,r){if(i.x===r.x){if(i.y===r.y)return;const n=0===i.x?0:1;this.addBorderIntersection(n,r.y),this.addBorderIntersection(n,i.y)}else{const o=0===i.y?2:3;this.addBorderIntersection(o,r.x),this.addBorderIntersection(o,i.x)}}centroid(){const i=this.polyCount.reduce((i,r)=>i+r.edges,0);return 0!==i?this.acc.div(i)._round():new l(0,0)}span(){return new l(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce((i,r)=>i+ +(r[0]!==Number.MAX_VALUE),0)}}class aQ{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.id),this.index=i.index,this.hasPattern=!1,this.layoutVertexArray=new oa,this.centroidVertexArray=new oV,this.indexArray=new oy,this.programConfigurations=new o7(i.layers,i.zoom),this.segments=new sc,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.enableTerrain=i.enableTerrain}populate(i,r,n,o){for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of(this.features=[],this.hasPattern=aD("fill-extrusion",this.layers,r),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDone=[!1,!1,!1,!1],this.tileToMeter=function(i){const r=Math.exp(Math.PI*(1-i.y/(1<i.x<=0)||l.every(i=>i.x>=8192)||l.every(i=>i.y<=0)||l.every(i=>i.y>=8192))continue;for(let p=0;p=1){const y=f[$-1];if(!a0(g,y)){c&&c.append(g,y),d.vertexLength+4>sc.MAX_VERTEX_ARRAY_LENGTH&&(d=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const x=g.sub(y)._perp(),v=x.x/(Math.abs(x.x)+Math.abs(x.y)),b=x.y>0?1:0,w=y.dist(g);m+w>32768&&(m=0),aY(this.layoutVertexArray,g.x,g.y,v,b,0,0,m),aY(this.layoutVertexArray,g.x,g.y,v,b,0,1,m),m+=w,aY(this.layoutVertexArray,y.x,y.y,v,b,0,0,m),aY(this.layoutVertexArray,y.x,y.y,v,b,0,1,m);const T=d.vertexLength;this.indexArray.emplaceBack(T,T+2,T+1),this.indexArray.emplaceBack(T+1,T+2,T+3),d.vertexLength+=4,d.primitiveLength+=2}}}}if(d.vertexLength+u>sc.MAX_VERTEX_ARRAY_LENGTH&&(d=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),"Polygon"!==aK[i.type])continue;const E=[],S=[],I=d.vertexLength;for(let M=0;M0){if(c.borders){c.vertexArrayOffset=this.centroidVertexArray.length;const D=c.borders,L=this.featuresOnBorder.push(c)-1;for(let B=0;B<4;B++)D[B][0]!==Number.MAX_VALUE&&this.borders[B].push(L)}this.encodeCentroid(c.borders?void 0:c.centroid(),c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,s,a,o)}sortBorders(){for(let i=0;i<4;i++)this.borders[i].sort((r,n)=>this.featuresOnBorder[r].borders[i][0]-this.featuresOnBorder[n].borders[i][0])}encodeCentroid(i,r,n=!0){let o,s;if(i){if(0!==i.y){const a=r.span()._mult(this.tileToMeter);o=(Math.max(i.x,1)<<3)+Math.min(7,Math.round(a.x/10)),s=(Math.max(i.y,1)<<3)+Math.min(7,Math.round(a.y/10))}else o=Math.ceil(7*(i.x+450)),s=0}else o=0,s=+n;let l=n?this.centroidVertexArray.length:r.vertexArrayOffset;for(const c of r.polyCount){n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*c.edges+c.top);for(let h=0;h<2*c.edges;h++)this.centroidVertexArray.emplace(l++,0,s),this.centroidVertexArray.emplace(l++,o,s);for(let u=0;u8192)||i.y===r.y&&(i.y<0||i.y>8192)}r4("FillExtrusionBucket",aQ,{omit:["layers","features"]}),r4("PartMetadata",aJ);var a1={paint:new n7({"fill-extrusion-opacity":new n5(tu["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new n4(tu["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new n5(tu["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new n5(tu["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new n6(tu["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new n4(tu["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new n4(tu["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new n5(tu["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function a2(i,r){return i.x*r.x+i.y*r.y}function a3(i,r){if(1===i.length){let n=0;const o=r[n++];let s;for(;!s||o.equals(s);)if(!(s=r[n++]))return 1/0;for(;ni.id),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new ol,this.layoutVertexArray2=new oc,this.indexArray=new oy,this.programConfigurations=new o7(i.layers,i.zoom),this.segments=new sc,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(i,r,n,o){this.hasPattern=aD("line",this.layers,r);const s=this.layers[0].layout.get("line-sort-key"),a=[];for(const{feature:l,id:c,index:h,sourceLayerIndex:u}of i){const d=this.layers[0]._featureFilter.needGeometry,p=sI(l,d);if(!this.layers[0]._featureFilter.filter(new nH(this.zoom),p,n))continue;const f=s?s.evaluate(p,{},n):void 0,m={id:c,properties:l.properties,type:l.type,sourceLayerIndex:u,index:h,geometry:d?p.geometry:sS(l,n,o),patterns:{},sortKey:f};a.push(m)}s&&a.sort((i,r)=>i.sortKey-r.sortKey);const{lineAtlas:$,featureIndex:g}=r,y=this.addConstantDashes($);for(const x of a){const{geometry:v,index:b,sourceLayerIndex:w}=x;if(y&&this.addFeatureDashes(x,$),this.hasPattern){const T=aL("line",this.layers,x,this.zoom,r);this.patternFeatures.push(T)}else this.addFeature(x,v,b,n,$.positions,r.availableImages);g.insert(i[b].feature,v,b,w,this.index)}}addConstantDashes(i){let r=!1;for(const n of this.layers){const o=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"!==o.kind||"constant"!==s.kind)r=!0;else{const a=s.value,l=o.value;if(!l)continue;i.addDash(l.from,a),i.addDash(l.to,a),l.other&&i.addDash(l.other,a)}}return r}addFeatureDashes(i,r){const n=this.zoom;for(const o of this.layers){const s=o.paint.get("line-dasharray").value,a=o.layout.get("line-cap").value;if("constant"===s.kind&&"constant"===a.kind)continue;let l,c,h,u,d,p;if("constant"===s.kind){const f=s.value;if(!f)continue;l=f.other||f.to,c=f.to,h=f.from}else l=s.evaluate({zoom:n-1},i),c=s.evaluate({zoom:n},i),h=s.evaluate({zoom:n+1},i);"constant"===a.kind?u=d=p=a.value:(u=a.evaluate({zoom:n-1},i),d=a.evaluate({zoom:n},i),p=a.evaluate({zoom:n+1},i)),r.addDash(l,u),r.addDash(c,d),r.addDash(h,p);const m=r.getKey(l,u),$=r.getKey(c,d),g=r.getKey(h,p);i.patterns[o.id]={min:m,mid:$,max:g}}}update(i,r,n,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(i,r,this.stateDependentLayers,n,o)}addFeatures(i,r,n,o){for(const s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,r,n,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,a7)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,a8),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i){if(i.properties&&i.properties.hasOwnProperty("mapbox_clip_start")&&i.properties.hasOwnProperty("mapbox_clip_end"))return{start:+i.properties.mapbox_clip_start,end:+i.properties.mapbox_clip_end}}addFeature(i,r,n,o,s,a){const l=this.layers[0].layout,c=l.get("line-join").evaluate(i,{}),h=l.get("line-cap").evaluate(i,{}),u=l.get("line-miter-limit"),d=l.get("line-round-limit");for(const p of(this.lineClips=this.lineFeatureClips(i),r))this.addLine(p,i,c,h,u,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,n,s,a,o)}addLine(i,r,n,o,s,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let l=0;l=2&&i[h-1].equals(i[h-2]);)h--;let u=0;for(;u0;if(S&&x>u){const M=f.dist(m);if(M>2*d){const A=f.sub(f.sub(m)._mult(d/M)._round());this.updateDistance(m,A),this.addCurrentVertex(A,g,0,0,p),m=A}}const C=m&&$;let z=C?n:c?"butt":o;if(C&&"round"===z&&(Ts&&(z="bevel"),"bevel"===z&&(T>2&&(z="flipbevel"),T100)v=y.mult(-1);else{const k=T*g.add(y).mag()/g.sub(y).mag();v._perp()._mult(k*(I?-1:1))}this.addCurrentVertex(f,v,0,0,p),this.addCurrentVertex(f,v.mult(-1),0,0,p)}else if("bevel"===z||"fakeround"===z){const P=-Math.sqrt(T*T-1),D=I?P:0,L=I?0:P;if(m&&this.addCurrentVertex(f,g,D,L,p),"fakeround"===z){const B=Math.round(180*E/Math.PI/20);for(let R=1;R2*d){const j=f.add($.sub(f)._mult(d/N)._round());this.updateDistance(f,j),this.addCurrentVertex(j,y,0,0,p),f=j}}}}addCurrentVertex(i,r,n,o,s,a=!1){const l=r.y*o-r.x,c=-r.y-r.x*o;this.addHalfVertex(i,r.x+r.y*n,r.y-r.x*n,a,!1,n,s),this.addHalfVertex(i,l,c,a,!0,-o,s)}addHalfVertex({x:i,y:r},n,o,s,a,l,c){this.layoutVertexArray.emplaceBack((i<<1)+(s?1:0),(r<<1)+(a?1:0),Math.round(63*n)+128,Math.round(63*o)+128,1+(0===l?0:l<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineSoFar);const h=c.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,h),c.primitiveLength++),a?this.e2=h:this.e1=h}updateScaledDistance(){if(this.lineClips){const i=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=i*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(i,r){this.distance+=i.dist(r),this.updateScaledDistance()}}r4("LineBucket",li,{omit:["layers","patternFeatures"]});const lr=new n7({"line-cap":new n4(tu.layout_line["line-cap"]),"line-join":new n4(tu.layout_line["line-join"]),"line-miter-limit":new n5(tu.layout_line["line-miter-limit"]),"line-round-limit":new n5(tu.layout_line["line-round-limit"]),"line-sort-key":new n4(tu.layout_line["line-sort-key"])});var ln={paint:new n7({"line-opacity":new n4(tu.paint_line["line-opacity"]),"line-color":new n4(tu.paint_line["line-color"]),"line-translate":new n5(tu.paint_line["line-translate"]),"line-translate-anchor":new n5(tu.paint_line["line-translate-anchor"]),"line-width":new n4(tu.paint_line["line-width"]),"line-gap-width":new n4(tu.paint_line["line-gap-width"]),"line-offset":new n4(tu.paint_line["line-offset"]),"line-blur":new n4(tu.paint_line["line-blur"]),"line-dasharray":new n6(tu.paint_line["line-dasharray"]),"line-pattern":new n6(tu.paint_line["line-pattern"]),"line-gradient":new n9(tu.paint_line["line-gradient"])}),layout:lr};const lo=new class extends n4{possiblyEvaluate(i,r){return r=new nH(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(i,r)}evaluate(i,r,n,o){return r=et({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,n,o)}}(ln.paint.properties["line-width"].specification);function ls(i,r){return r>0?r+2*i:i}lo.useIntegerZoom=!0;const la=on([{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),ll=on([{name:"a_projected_pos",components:3,type:"Float32"},],4);on([{name:"a_fade_opacity",components:1,type:"Uint32"},],4);const lc=on([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},]),lh=on([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},]);on([{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 lu=on([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},],4),ld=on([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"},],4);function lp(i,r){const{expression:n}=r;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new nH(i+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:o,interpolationType:s}=n;let a=0;for(;a{i.text=function(i,r,n){const o=r.layout.get("text-transform").evaluate(n,{});return"uppercase"===o?i=i.toLocaleUpperCase():"lowercase"===o&&(i=i.toLocaleLowerCase()),nW.applyArabicShaping&&(i=nW.applyArabicShaping(i)),i}(i.text,r,n)}),i}const ly={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","\xa2":"¢","\xa3":"£","\xa5":"¥","\xa6":"¦","\xac":"¬","\xaf":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function lx(i){return"︶"===i||"﹈"===i||"︸"===i||"﹄"===i||"﹂"===i||"︾"===i||"︼"===i||"︺"===i||"︘"===i||"﹀"===i||"︐"===i||"︓"===i||"︔"===i||"`"===i||" ̄"===i||"︑"===i||"︒"===i}function lv(i){return"︵"===i||"﹇"===i||"︷"===i||"﹃"===i||"﹁"===i||"︽"===i||"︻"===i||"︹"===i||"︗"===i||"︿"===i}var lb=function(i,r,n,o,s){var a,l,c=8*s-o-1,h=(1<>1,d=-7,p=n?s-1:0,f=n?-1:1,m=i[r+p];for(p+=f,a=m&(1<<-d)-1,m>>=-d,d+=c;d>0;a=256*a+i[r+p],p+=f,d-=8);for(l=a&(1<<-d)-1,a>>=-d,d+=o;d>0;l=256*l+i[r+p],p+=f,d-=8);if(0===a)a=1-u;else{if(a===h)return l?NaN:1/0*(m?-1:1);l+=Math.pow(2,o),a-=u}return(m?-1:1)*l*Math.pow(2,a-o)},lw=function(i,r,n,o,s,a){var l,c,h,u=8*a-s-1,d=(1<>1,f=23===s?5960464477539062e-23:0,m=o?0:a-1,$=o?1:-1,g=r<0||0===r&&1/r<0?1:0;for(isNaN(r=Math.abs(r))||r===1/0?(c=isNaN(r)?1:0,l=d):(l=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-l))<1&&(l--,h*=2),(r+=l+p>=1?f/h:f*Math.pow(2,1-p))*h>=2&&(l++,h/=2),l+p>=d?(c=0,l=d):l+p>=1?(c=(r*h-1)*Math.pow(2,s),l+=p):(c=r*Math.pow(2,p-1)*Math.pow(2,s),l=0));s>=8;i[n+m]=255&c,m+=$,c/=256,s-=8);for(l=l<0;i[n+m]=255&l,m+=$,l/=256,u-=8);i[n+m-$]|=128*g},lT=lE;function lE(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}lE.Varint=0,lE.Fixed64=1,lE.Bytes=2,lE.Fixed32=5;var lS="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function lI(i){return i.type===lE.Bytes?i.readVarint()+i.pos:i.pos+1}function lM(i,r,n){var o=r<=16383?1:r<=2097151?2:r<=268435455?3:Math.floor(Math.log(r)/(7*Math.LN2));n.realloc(o);for(var s=n.pos-1;s>=i;s--)n.buf[s+o]=n.buf[s]}function lA(i,r){for(var n=0;n>>8,i[n+2]=r>>>16,i[n+3]=r>>>24}function lU(i,r){return(i[r]|i[r+1]<<8|i[r+2]<<16)+(i[r+3]<<24)}function lV(i,r,n){r.glyphs=[],1===i&&n.readMessage(lN,r)}function lN(i,r,n){if(3===i){const{id:o,bitmap:s,width:a,height:l,left:c,top:h,advance:u}=n.readMessage(lj,{});r.glyphs.push({id:o,bitmap:new s5({width:a+6,height:l+6},s),metrics:{width:a,height:l,left:c,top:h,advance:u}})}else 4===i?r.ascender=n.readSVarint():5===i&&(r.descender=n.readSVarint())}function lj(i,r,n){1===i?r.id=n.readVarint():2===i?r.bitmap=n.readBytes():3===i?r.width=n.readVarint():4===i?r.height=n.readVarint():5===i?r.left=n.readSVarint():6===i?r.top=n.readSVarint():7===i&&(r.advance=n.readVarint())}function lG(i){let r=0,n=0;for(const o of i)r+=o.w*o.h,n=Math.max(n,o.w);i.sort((i,r)=>r.h-i.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),n),h:1/0},];let a=0,l=0;for(const c of i)for(let h=s.length-1;h>=0;h--){const u=s[h];if(!(c.w>u.w||c.h>u.h)){if(c.x=u.x,c.y=u.y,l=Math.max(l,c.y+c.h),a=Math.max(a,c.x+c.w),c.w===u.w&&c.h===u.h){const d=s.pop();h>3,a=this.pos;this.type=7&o,i(s,r,this),this.pos===a&&this.skip(o)}return r},readMessage:function(i,r){return this.readFields(i,r,this.readVarint()+this.pos)},readFixed32:function(){var i=lF(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=lU(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=lF(this.buf,this.pos)+4294967296*lF(this.buf,this.pos+4);return this.pos+=8,i},readSFixed64:function(){var i=lF(this.buf,this.pos)+4294967296*lU(this.buf,this.pos+4);return this.pos+=8,i},readFloat:function(){var i=lb(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=lb(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var r,n,o=this.buf;return r=127&(n=o[this.pos++]),n<128?r:(r|=(127&(n=o[this.pos++]))<<7,n<128?r:(r|=(127&(n=o[this.pos++]))<<14,n<128?r:(r|=(127&(n=o[this.pos++]))<<21,n<128?r:function(i,r,n){var o,s,a,l,c=n.buf;if(a=(112&(l=c[n.pos++]))>>4,l<128||(a|=(127&(l=c[n.pos++]))<<3,l<128)||(a|=(127&(l=c[n.pos++]))<<10,l<128)||(a|=(127&(l=c[n.pos++]))<<17,l<128)||(a|=(127&(l=c[n.pos++]))<<24,l<128)||(a|=(1&(l=c[n.pos++]))<<31,l<128))return o=i,s=a,r?4294967296*s+(o>>>0):4294967296*(s>>>0)+(o>>>0);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(n=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?-((i+1)/2):i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i,r,n,o=this.readVarint()+this.pos,s=this.pos;return this.pos=o,o-s>=12&&lS?(i=this.buf,r=s,n=o,lS.decode(i.subarray(r,n))):function(i,r,n){for(var o="",s=r;s239?4:h>223?3:h>191?2:1;if(s+d>n)break;1===d?h<128&&(u=h):2===d?128==(192&(a=i[s+1]))&&(u=(31&h)<<6|63&a)<=127&&(u=null):3===d?(l=i[s+2],128==(192&(a=i[s+1]))&&128==(192&l)&&((u=(15&h)<<12|(63&a)<<6|63&l)<=2047||u>=55296&&u<=57343)&&(u=null)):4===d&&(l=i[s+2],c=i[s+3],128==(192&(a=i[s+1]))&&128==(192&l)&&128==(192&c)&&((u=(15&h)<<18|(63&a)<<12|(63&l)<<6|63&c)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,d=1):u>65535&&(u-=65536,o+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),o+=String.fromCharCode(u),s+=d}return o}(this.buf,s,o)},readBytes:function(){var i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r},readPackedVarint:function(i,r){if(this.type!==lE.Bytes)return i.push(this.readVarint(r));var n=lI(this);for(i=i||[];this.pos127;);else if(r===lE.Bytes)this.pos=this.readVarint()+this.pos;else if(r===lE.Fixed32)this.pos+=4;else{if(r!==lE.Fixed64)throw Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(i,r){this.writeVarint(i<<3|r)},realloc:function(i){for(var r=this.length||16;r268435455||i<0?function(i,r){var n,o,s,a,l,c,h;if(i>=0?(n=i%4294967296|0,o=i/4294967296|0):(o=~(-i/4294967296),4294967295^(n=~(-i%4294967296))?n=n+1|0:(n=0,o=o+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw Error("Given varint doesn't fit into 10 bytes");r.realloc(10),s=n,(a=r).buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,s>>>=7,a.buf[a.pos++]=127&s|128,a.buf[a.pos]=127&(s>>>=7),l=o,c=r,h=(7&l)<<4,c.buf[c.pos++]|=h|((l>>>=3)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l)))))}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?-(2*i)-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var r=this.pos;this.pos=function(i,r,n){for(var o,s,a=0;a55295&&o<57344){if(!s){o>56319||a+1===r.length?(i[n++]=239,i[n++]=191,i[n++]=189):s=o;continue}if(o<56320){i[n++]=239,i[n++]=191,i[n++]=189,s=o;continue}o=s-55296<<10|o-56320|65536,s=null}else s&&(i[n++]=239,i[n++]=191,i[n++]=189,s=null);o<128?i[n++]=o:(o<2048?i[n++]=o>>6|192:(o<65536?i[n++]=o>>12|224:(i[n++]=o>>18|240,i[n++]=o>>12&63|128),i[n++]=o>>6&63|128),i[n++]=63&o|128)}return n}(this.buf,i,this.pos);var n=this.pos-r;n>=128&&lM(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeFloat:function(i){this.realloc(4),lw(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),lw(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var r=i.length;this.writeVarint(r),this.realloc(r);for(var n=0;n=128&&lM(n,o,this),this.pos=n-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,r,n){this.writeTag(i,lE.Bytes),this.writeRawMessage(r,n)},writePackedVarint:function(i,r){r.length&&this.writeMessage(i,lA,r)},writePackedSVarint:function(i,r){r.length&&this.writeMessage(i,lC,r)},writePackedBoolean:function(i,r){r.length&&this.writeMessage(i,lP,r)},writePackedFloat:function(i,r){r.length&&this.writeMessage(i,lz,r)},writePackedDouble:function(i,r){r.length&&this.writeMessage(i,lk,r)},writePackedFixed32:function(i,r){r.length&&this.writeMessage(i,lD,r)},writePackedSFixed32:function(i,r){r.length&&this.writeMessage(i,lL,r)},writePackedFixed64:function(i,r){r.length&&this.writeMessage(i,lB,r)},writePackedSFixed64:function(i,r){r.length&&this.writeMessage(i,lR,r)},writeBytesField:function(i,r){this.writeTag(i,lE.Bytes),this.writeBytes(r)},writeFixed32Field:function(i,r){this.writeTag(i,lE.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(i,r){this.writeTag(i,lE.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(i,r){this.writeTag(i,lE.Fixed64),this.writeFixed64(r)},writeSFixed64Field:function(i,r){this.writeTag(i,lE.Fixed64),this.writeSFixed64(r)},writeVarintField:function(i,r){this.writeTag(i,lE.Varint),this.writeVarint(r)},writeSVarintField:function(i,r){this.writeTag(i,lE.Varint),this.writeSVarint(r)},writeStringField:function(i,r){this.writeTag(i,lE.Bytes),this.writeString(r)},writeFloatField:function(i,r){this.writeTag(i,lE.Fixed32),this.writeFloat(r)},writeDoubleField:function(i,r){this.writeTag(i,lE.Fixed64),this.writeDouble(r)},writeBooleanField:function(i,r){this.writeVarintField(i,Boolean(r))}};class lZ{constructor(i,{pixelRatio:r,version:n,stretchX:o,stretchY:s,content:a}){this.paddedRect=i,this.pixelRatio=r,this.stretchX=o,this.stretchY=s,this.content=a,this.version=n}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 l_{constructor(i,r){const n={},o={};this.haveRenderCallbacks=[];const s=[];this.addImages(i,n,s),this.addImages(r,o,s);const{w:a,h:l}=lG(s),c=new s4({width:a||1,height:l||1});for(const h in i){const u=i[h],d=n[h].paddedRect;s4.copy(u.data,c,{x:0,y:0},{x:d.x+1,y:d.y+1},u.data)}for(const p in r){const f=r[p],m=o[p].paddedRect,$=m.x+1,g=m.y+1,y=f.data.width,x=f.data.height;s4.copy(f.data,c,{x:0,y:0},{x:$,y:g},f.data),s4.copy(f.data,c,{x:0,y:x-1},{x:$,y:g-1},{width:y,height:1}),s4.copy(f.data,c,{x:0,y:0},{x:$,y:g+x},{width:y,height:1}),s4.copy(f.data,c,{x:y-1,y:0},{x:$-1,y:g},{width:1,height:x}),s4.copy(f.data,c,{x:0,y:0},{x:$+y,y:g},{width:1,height:x})}this.image=c,this.iconPositions=n,this.patternPositions=o}addImages(i,r,n){for(const o in i){const s=i[o],a={x:0,y:0,w:s.data.width+2,h:s.data.height+2};n.push(a),r[o]=new lZ(a,s),s.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(i,r){for(const n in i.dispatchRenderCallbacks(this.haveRenderCallbacks),i.updatedImages)this.patchUpdatedImage(this.iconPositions[n],i.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],i.getImage(n),r)}patchUpdatedImage(i,r,n){if(!i||!r||i.version===r.version)return;i.version=r.version;const[o,s]=i.tl;n.update(r.data,void 0,{x:o,y:s})}}r4("ImagePosition",lZ),r4("ImageAtlas",l_);const lq={horizontal:1,vertical:2,horizontalOnly:3};class lX{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(i,r){const n=new lX;return n.scale=i||1,n.fontStack=r,n}static forImage(i){const r=new lX;return r.imageName=i,r}}class lW{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,r){const n=new lW;for(let o=0;o=0&&o>=i&&lK[this.text.charCodeAt(o)];o--)n--;this.text=this.text.substring(i,n),this.sectionIndex=this.sectionIndex.slice(i,n)}substring(i,r){const n=new lW;return n.text=this.text.substring(i,r),n.sectionIndex=this.sectionIndex.slice(i,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,r)=>Math.max(i,this.sections[r].scale),0)}addTextSection(i,r){this.text+=i.text,this.sections.push(lX.forText(i.scale,i.fontStack||r));const n=this.sections.length-1;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function lH(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g){const y=lW.fromFeature(i,s);let x;p===lq.vertical&&y.verticalizePunctuation(f);const{processBidirectionalText:v,processStyledBidirectionalText:b}=nW;if(v&&1===y.sections.length){x=[];const w=v(y.toString(),l2(y,u,a,r,o,m,$));for(const T of w){const E=new lW;E.text=T,E.sections=y.sections;for(let S=0;S0&&q>z&&(z=q)}else{const X=n[L.fontStack];if(!X)continue;X[R]&&(U=X[R]);const W=r[L.fontStack];if(!W)continue;const H=W.glyphs[R];if(!H)continue;if(O=H.metrics,N=8203!==R?24:0,x){const K=void 0!==W.ascender?Math.abs(W.ascender):0,Y=void 0!==W.descender?Math.abs(W.descender):0,J=(K+Y)*F;k=0;let p=0;for(let f=0;f-n/2;){if(--l<0)return!1;c-=i[l].dist(a),a=i[l]}c+=i[l].dist(i[l+1]),l++;const h=[];let u=0;for(;co;)u-=h.shift().angleDelta;if(u>s)return!1;l++,c+=d.dist(p)}return!0}function l7(i){let r=0;for(let n=0;nu){const $=(u-h)/m,g=ix(p.x,f.x,$),y=ix(p.y,f.y,$),x=new l8(g,y,0,f.angleTo(p),d);return!l||l9(i,x,c,l,r)?x:void 0}h+=m}}function cr(i,r,n,o,s,a,l,c,h){const u=ce(o,a,l),d=ct(o,s),p=d*l,f=0===i[0].x||i[0].x===h||0===i[0].y||i[0].y===h;return r-p=0&&T=0&&E=0&&m+d<=p){const S=new l8(T,E,0,b,g);S._round(),s&&!l9(r,S,l,s,a)||$.push(S)}}f+=v}return h||$.length||c||($=i(r,f/2,o,s,a,l,c,!0,u)),$}(i,f?r/2*c%r:(d/2+2*a)*l*c%r,r,u,n,p,f,!1,h)}function cn(i,r,n,o,s){const a=[];for(let c=0;c=o&&f.x>=o||(p.x>=o?p=new l(o,p.y+(o-p.x)/(f.x-p.x)*(f.y-p.y))._round():f.x>=o&&(f=new l(o,p.y+(o-p.x)/(f.x-p.x)*(f.y-p.y))._round()),p.y>=s&&f.y>=s||(p.y>=s?p=new l(p.x+(s-p.y)/(f.y-p.y)*(f.x-p.x),s)._round():f.y>=s&&(f=new l(p.x+(s-p.y)/(f.y-p.y)*(f.x-p.x),s)._round()),u&&p.equals(u[u.length-1])||(u=[p],a.push(u)),u.push(f)))))}}return a}function co(i,r,n,o,s,a,l,c,h){for(let u=r;u-1)a[++h]=c,l[h]=u,l[h+1]=1e20}for(let f=0,m=0;f{let o=this.entries[i];o||(o=this.entries[i]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=o.glyphs[r];if(void 0!==s)return void n(null,{stack:i,id:r,glyph:s});if(s=this._tinySDF(o,i,r))return o.glyphs[r]=s,void n(null,{stack:i,id:r,glyph:s});const a=Math.floor(r/256);if(256*a>65535)return void n(Error("glyphs > 65535 not supported"));if(o.ranges[a])return void n(null,{stack:i,id:r,glyph:s});let l=o.requests[a];l||(l=o.requests[a]=[],cl.loadGlyphRange(i,a,this.url,this.requestManager,(i,r)=>{if(r){for(const n in o.ascender=r.ascender,o.descender=r.descender,r.glyphs)this._doesCharSupportLocalGlyph(+n)||(o.glyphs[+n]=r.glyphs[+n]);o.ranges[a]=!0}for(const s of l)s(i,r);delete o.requests[a]})),l.push((o,s)=>{o?n(o):s&&n(null,{stack:i,id:r,glyph:s.glyphs[r]||null})})},(i,n)=>{if(i)r(i);else if(n){const o={};for(const{stack:s,id:a,glyph:l}of n)void 0===o[s]&&(o[s]={}),void 0===o[s].glyphs&&(o[s].glyphs={}),o[s].glyphs[a]=l&&{id:l.id,bitmap:l.bitmap.clone(),metrics:l.metrics},o[s].ascender=this.entries[s].ascender,o[s].descender=this.entries[s].descender;r(null,o)}})}_doesCharSupportLocalGlyph(i){return this.localGlyphMode!==ca.none&&(this.localGlyphMode===ca.all?!!this.localFontFamily:!!this.localFontFamily&&(ny(i)||nb(i)||nc(i)||nh(i))||nl(i))}_tinySDF(i,r,n){const o=this.localFontFamily;if(!o||!this._doesCharSupportLocalGlyph(n))return;let s=i.tinySDF;if(!s){let a="400";/bold/i.test(r)?a="900":/medium/i.test(r)?a="500":/light/i.test(r)&&(a="200"),(s=i.tinySDF=new cl.TinySDF({fontFamily:o,fontWeight:a,fontSize:48,buffer:6,radius:16})).fontWeight=a}if(this.localGlyphs[s.fontWeight][n])return this.localGlyphs[s.fontWeight][n];const l=String.fromCharCode(n),{data:c,width:h,height:u,glyphWidth:d,glyphHeight:p,glyphLeft:f,glyphTop:m,glyphAdvance:$}=s.draw(l);return this.localGlyphs[s.fontWeight][n]={id:n,bitmap:new s5({width:h,height:u},c),metrics:{width:d/2,height:p/2,left:f/2,top:m/2-27,advance:$/2,localGlyph:!0}}}}function cc(i,r,n,o){const s=[],a=i.image,c=a.pixelRatio,h=a.paddedRect.w-2,u=a.paddedRect.h-2,d=i.right-i.left,p=i.bottom-i.top,f=a.stretchX||[[0,h]],m=a.stretchY||[[0,u]],$=(i,r)=>i+r[1]-r[0],g=f.reduce($,0),y=m.reduce($,0),x=h-g,v=u-y;let b=0,w=g,T=0,E=y,S=0,I=x,M=0,A=v;if(a.content&&o){const C=a.content;b=ch(f,0,C[0]),T=ch(m,0,C[1]),w=ch(f,C[0],C[2]),E=ch(m,C[1],C[3]),S=C[0]-b,M=C[1]-T,I=C[2]-C[0]-w,A=C[3]-C[1]-E}const z=(o,s,h,u)=>{var f,m,$,x,v,C,z,k,P,D,L,B,R,F,O,U,V,N,j,G,Z,_,q,X,W,H,K,Y;const J=(f=o.stretch-b,m=w,$=d,f/m*$+i.left),Q=(x=o.fixed-S,v=I,C=o.stretch,z=g,x-v*C/z),ee=(k=s.stretch-T,P=E,D=p,k/P*D+i.top),et=(L=s.fixed-M,B=A,R=s.stretch,F=y,L-B*R/F),ei=(O=h.stretch-b,U=w,V=d,O/U*V+i.left),er=(N=h.fixed-S,j=I,G=h.stretch,Z=g,N-j*G/Z),en=(_=u.stretch-T,q=E,X=p,_/q*X+i.top),eo=(W=u.fixed-M,H=A,K=u.stretch,Y=y,W-H*K/Y),es=new l(J,ee),ea=new l(ei,ee),el=new l(ei,en),ec=new l(J,en),eh=new l(Q/c,et/c),eu=new l(er/c,eo/c),ed=r*Math.PI/180;if(ed){const ep=Math.sin(ed),ef=Math.cos(ed),em=[ef,-ep,ep,ef];es._matMult(em),ea._matMult(em),ec._matMult(em),el._matMult(em)}const e$=o.stretch+o.fixed,eg=s.stretch+s.fixed;return{tl:es,tr:ea,bl:ec,br:el,tex:{x:a.paddedRect.x+1+e$,y:a.paddedRect.y+1+eg,w:h.stretch+h.fixed-e$,h:u.stretch+u.fixed-eg},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:eh,pixelOffsetBR:eu,minFontScaleX:I/c/d,minFontScaleY:A/c/p,isSDF:n}};if(o&&(a.stretchX||a.stretchY)){const k=cu(f,x,g),P=cu(m,v,y);for(let D=0;D{if(i)s(i);else if(r){var n;const o={},a=(n=r,new lT(n).readFields(lV,{}));for(const l of a.glyphs)o[l.id]=l;s(null,{glyphs:o,ascender:a.ascender,descender:a.descender})}})},cl.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:n=8,cutoff:o=.25,fontFamily:s="sans-serif",fontWeight:a="normal",fontStyle:l="normal"}){this.buffer=r,this.cutoff=o,this.radius=n;const c=this.size=i+4*r,h=this._createCanvas(c),u=this.ctx=h.getContext("2d",{willReadFrequently:!0});u.font=`${l} ${a} ${i}px ${s}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c)}_createCanvas(i){const r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){const{width:r,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o,actualBoundingBoxLeft:s,actualBoundingBoxRight:a}=this.ctx.measureText(i),l=Math.floor(n),c=Math.min(this.size-this.buffer,Math.ceil(a-s)),h=Math.min(this.size-this.buffer,Math.ceil(n)+Math.ceil(o)),u=c+2*this.buffer,d=h+2*this.buffer,p=u*d,f=new Uint8ClampedArray(p),m={data:f,width:u,height:d,glyphWidth:c,glyphHeight:h,glyphTop:l,glyphLeft:0,glyphAdvance:r};if(0===c||0===h)return m;const{ctx:$,buffer:g,gridInner:y,gridOuter:x}=this;$.clearRect(g,g,c,h),$.fillText(i,g,g+l+1);const v=$.getImageData(g,g,c,h);x.fill(1e20,0,p),y.fill(0,0,p);for(let b=0;b0?S*S:0,y[E]=S<0?S*S:0}}co(x,0,0,u,d,u,this.f,this.v,this.z),co(y,g,g,c,h,u,this.f,this.v,this.z);for(let I=0;I0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(i){this.data.push(i),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const i=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),i}peek(){return this.data[0]}_up(i){const{data:r,compare:n}=this,o=r[i];for(;i>0;){const s=i-1>>1,a=r[s];if(n(o,a)>=0)break;r[i]=a,i=s}r[i]=o}_down(i){const{data:r,compare:n}=this,o=this.length>>1,s=r[i];for(;in(r[c],l)&&(a=c,l=r[c]),n(l,s)>=0)break;r[i]=l,i=a}r[i]=s}}function cf(i,r){return ir?1:0}function cm(i,r=1,n=!1){let o=1/0,s=1/0,a=-1/0,c=-1/0;const h=i[0];for(let u=0;ua)&&(a=d.x),(!u||d.y>c)&&(c=d.y)}const p=Math.min(a-o,c-s);let f=p/2;const m=new cp([],c$);if(0===p)return new l(o,s);for(let $=o;$y.d||!y.d)&&(y=v,n&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,x)),v.max-y.d<=r||(f=v.h/2,m.push(new cg(v.p.x-f,v.p.y-f,f,i)),m.push(new cg(v.p.x+f,v.p.y-f,f,i)),m.push(new cg(v.p.x-f,v.p.y+f,f,i)),m.push(new cg(v.p.x+f,v.p.y+f,f,i)),x+=4)}return n&&(console.log(`num probes: ${x}`),console.log(`best distance: ${y.d}`)),y.p}function c$(i,r){return r.max-i.max}function cg(i,r,n,o){this.p=new l(i,r),this.h=n,this.d=function(i,r){let n=!1,o=1/0;for(let s=0;si.y!=d.y>i.y&&i.x<(d.x-u.x)*(i.y-u.y)/(d.y-u.y)+u.x&&(n=!n),o=Math.min(o,sR(i,u,d))}}return(n?1:-1)*Math.sqrt(o)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const cy=Number.POSITIVE_INFINITY,cx=Math.sqrt(2);function cv(i,r){return r[1]!==cy?function(i,r,n){let o=0,s=0;switch(r=Math.abs(r),n=Math.abs(n),i){case"top-right":case"top-left":case"top":s=n-7;break;case"bottom-right":case"bottom-left":case"bottom":s=7-n}switch(i){case"top-right":case"bottom-right":case"right":o=-r;break;case"top-left":case"bottom-left":case"left":o=r}return[o,s]}(i,r[0],r[1]):function(i,r){let n=0,o=0;r<0&&(r=0);const s=r/cx;switch(i){case"top-right":case"top-left":o=s-7;break;case"bottom-right":case"bottom-left":o=7-s;break;case"bottom":o=7-r;break;case"top":o=r-7}switch(i){case"top-right":case"bottom-right":n=-s;break;case"top-left":case"bottom-left":n=s;break;case"left":n=r;break;case"right":n=-r}return[n,o]}(i,r[0])}function cb(i,r,n,o,s,a,l,c,h,u){i.createArrays(),i.tilePixelRatio=8192/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;const d=i.layers[0].layout,p=i.layers[0]._unevaluatedLayout._values,f={};if("composite"===i.textSizeData.kind){const{minZoom:m,maxZoom:$}=i.textSizeData;f.compositeTextSizes=[p["text-size"].possiblyEvaluate(new nH(m),c),p["text-size"].possiblyEvaluate(new nH($),c),]}if("composite"===i.iconSizeData.kind){const{minZoom:g,maxZoom:y}=i.iconSizeData;f.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new nH(g),c),p["icon-size"].possiblyEvaluate(new nH(y),c),]}f.layoutTextSize=p["text-size"].possiblyEvaluate(new nH(h+1),c),f.layoutIconSize=p["icon-size"].possiblyEvaluate(new nH(h+1),c),f.textMaxSize=p["text-size"].possiblyEvaluate(new nH(18),c);const x="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),v=d.get("text-size");for(const b of i.features){const w=d.get("text-font").evaluate(b,{},c).join(","),T=v.evaluate(b,{},c),E=f.layoutTextSize.evaluate(b,{},c),S=(f.layoutIconSize.evaluate(b,{},c),{horizontal:{},vertical:void 0}),I=b.text;let M,A=[0,0];if(I){const C=I.toString(),z=24*d.get("text-letter-spacing").evaluate(b,{},c),k=24*d.get("text-line-height").evaluate(b,{},c),P=nz(C)?z:0,D=d.get("text-anchor").evaluate(b,{},c),L=d.get("text-variable-anchor");if(!L){const B=d.get("text-radial-offset").evaluate(b,{},c);A=B?cv(D,[24*B,cy]):d.get("text-offset").evaluate(b,{},c).map(i=>24*i)}let R=x?"center":d.get("text-justify").evaluate(b,{},c);const F=d.get("symbol-placement"),O="point"===F,U="point"===F?24*d.get("text-max-width").evaluate(b,{},c):0,V=o=>{i.allowVerticalPlacement&&nC(C)&&(S.vertical=lH(I,r,n,s,w,U,k,D,o,P,A,lq.vertical,!0,F,E,T))};if(!x&&L){const N="auto"===R?L.map(i=>cw(i)):[R];let j=!1;for(let G=0;G=0||!nC(C)){const q=lH(I,r,n,s,w,U,k,D,R,P,A,lq.horizontal,!1,F,E,T);q&&(S.horizontal[R]=q)}V("point"===F?"left":R)}}let X=!1;if(b.icon&&b.icon.name){const W=o[b.icon.name];W&&(M=l4(s[b.icon.name],d.get("icon-offset").evaluate(b,{},c),d.get("icon-anchor").evaluate(b,{},c)),X=W.sdf,void 0===i.sdfIcons?i.sdfIcons=W.sdf:i.sdfIcons!==W.sdf&&ep("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(W.pixelRatio!==i.pixelRatio||0!==d.get("icon-rotate").constantOr(1))&&(i.iconsNeedLinear=!0))}const H=cI(S.horizontal)||S.vertical;i.iconsInText||(i.iconsInText=!!H&&H.iconsInText),(H||M)&&cT(i,b,S,M,o,f,E,0,A,X,l,c,u)}a&&i.generateCollisionDebugBuffers(h,i.collisionBoxArray)}function cw(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function cT(i,r,n,o,s,a,l,c,h,u,d,p,f){let m=a.textMaxSize.evaluate(r,{},p);void 0===m&&(m=l);const $=i.layers[0].layout,g=$.get("icon-offset").evaluate(r,{},p),y=cI(n.horizontal)||n.vertical,x=l/24,v=i.tilePixelRatio*m/24,b=i.tilePixelRatio*$.get("symbol-spacing"),w=$.get("text-padding")*i.tilePixelRatio,T=$.get("icon-padding")*i.tilePixelRatio,E=$.get("text-max-angle")*j,S="map"===$.get("text-rotation-alignment")&&"point"!==$.get("symbol-placement"),I="map"===$.get("icon-rotation-alignment")&&"point"!==$.get("symbol-placement"),M=$.get("symbol-placement"),A=b/2,C=$.get("icon-text-fit");let z;o&&"none"!==C&&(i.allowVerticalPlacement&&n.vertical&&(z=l6(o,n.vertical,C,$.get("icon-text-fit-padding"),g,x)),y&&(o=l6(o,y,C,$.get("icon-text-fit-padding"),g,x)));const k=(l,c,m)=>{if(c.x<0||c.x>=8192||c.y<0||c.y>=8192)return;const{x:$,y:y,z:x}=f.projectTilePoint(c.x,c.y,m),v=new l8($,y,x,0,void 0);!function(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x,v,b,w,T,E,S,I){const M=i.addToLineVertexArray(r,o);let A,C,z,k,P,D,L,B=0,R=0,F=0,O=0,U=-1,V=-1;const N={};let j=o_(""),G=0,Z=0;if(void 0===h._unevaluatedLayout.getValue("text-radial-offset")?[G,Z]=h.layout.get("text-offset").evaluate(w,{},I).map(i=>24*i):(G=24*h.layout.get("text-radial-offset").evaluate(w,{},I),Z=cy),i.allowVerticalPlacement&&s.vertical){const _=s.vertical;if($)D=cA(_),c&&(L=cA(c));else{const q=h.layout.get("text-rotate").evaluate(w,{},I)+90;z=cM(u,n,r,d,p,f,_,m,q,g),c&&(k=cM(u,n,r,d,p,f,c,x,q))}}if(a){const X=h.layout.get("icon-rotate").evaluate(w,{},I),W="none"!==h.layout.get("icon-text-fit"),H=cc(a,X,E,W),K=c?cc(c,X,E,W):void 0;C=cM(u,n,r,d,p,f,a,x,X),B=4*H.length;const Y=i.iconSizeData;let J=null;"source"===Y.kind?(J=[128*h.layout.get("icon-size").evaluate(w,{},I),])[0]>cE&&ep(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===Y.kind&&((J=[128*T.compositeIconSizes[0].evaluate(w,{},I),128*T.compositeIconSizes[1].evaluate(w,{},I),])[0]>cE||J[1]>cE)&&ep(`${i.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),i.addSymbols(i.icon,H,J,b,v,w,!1,n,r,M.lineStartIndex,M.lineLength,-1,S,I),U=i.icon.placedSymbolArray.length-1,K&&(R=4*K.length,i.addSymbols(i.icon,K,J,b,v,w,lq.vertical,n,r,M.lineStartIndex,M.lineLength,-1,S,I),V=i.icon.placedSymbolArray.length-1)}for(const Q in s.horizontal){const ee=s.horizontal[Q];A||(j=o_(ee.text),$?P=cA(ee):A=cM(u,n,r,d,p,f,ee,m,h.layout.get("text-rotate").evaluate(w,{},I),g));const et=1===ee.positionedLines.length;if(F+=cS(i,n,r,ee,l,h,$,w,g,M,s.vertical?lq.horizontal:lq.horizontalOnly,et?Object.keys(s.horizontal):[Q],N,U,T,S,I),et)break}s.vertical&&(O+=cS(i,n,r,s.vertical,l,h,$,w,g,M,lq.vertical,["vertical"],N,V,T,S,I));let ei=-1;const er=(i,r)=>i?Math.max(i,r):r;ei=er(P,ei),ei=er(D,ei),ei=er(L,ei);const en=ei>-1?1:0;i.glyphOffsetArray.length>=cF.MAX_GLYPHS&&ep("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&i.addToSortKeyRanges(i.symbolInstances.length,w.sortKey),i.symbolInstances.emplaceBack(n.x,n.y,n.z,r.x,r.y,N.right>=0?N.right:-1,N.center>=0?N.center:-1,N.left>=0?N.left:-1,N.vertical>=0?N.vertical:-1,U,V,j,void 0!==A?A:i.collisionBoxArray.length,void 0!==A?A+1:i.collisionBoxArray.length,void 0!==z?z:i.collisionBoxArray.length,void 0!==z?z+1:i.collisionBoxArray.length,void 0!==C?C:i.collisionBoxArray.length,void 0!==C?C+1:i.collisionBoxArray.length,k||i.collisionBoxArray.length,k?k+1:i.collisionBoxArray.length,d,F,O,B,R,en,0,G,Z,ei)}(i,c,v,l,n,o,s,z,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,w,S,h,0,T,I,g,r,a,u,d,p)};if("line"===M)for(const P of cn(r.geometry,0,0,8192,8192)){const D=cr(P,b,E,n.vertical||y,o,24,v,i.overscaling,8192);for(const L of D){const B=y;B&&cC(i,B.text,A,L)||k(P,L,p)}}else if("line-center"===M){for(const R of r.geometry)if(R.length>1){const F=ci(R,E,n.vertical||y,o,24,v);F&&k(R,F,p)}}else if("Polygon"===r.type)for(const O of ak(r.geometry,0)){const U=cm(O,16);k(O[0],new l8(U.x,U.y,0,0,void 0),p)}else if("LineString"===r.type)for(const V of r.geometry)k(V,new l8(V[0].x,V[0].y,0,0,void 0),p);else if("Point"===r.type)for(const N of r.geometry)for(const G of N)k([G],new l8(G.x,G.y,0,0,void 0),p)}const cE=32640;function cS(i,r,n,o,s,a,c,h,u,d,p,f,m,$,g,y,x){const v=function(i,r,n,o,s,a,c,h){const u=[];if(0===r.positionedLines.length)return u;const d=o.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,p=function(i){const r=i[0],n=i[1],o=r*n;return o>0?[r,-n]:o<0?[-r,n]:0===r?[n,r]:[n,-r]}(n);let f=Math.abs(r.top-r.bottom);for(const m of r.positionedLines)f-=m.lineOffset;const $=r.positionedLines.length,g=f/$;let y=r.top-n[1];for(let x=0;x<$;++x){const v=r.positionedLines[x];for(const b of(y=cd(r,g,y,x),v.positionedGlyphs)){if(!b.rect)continue;const w=b.rect||{};let T=4,E=!0,S=1,I=0;if(b.imageName){const M=c[b.imageName];if(!M)continue;if(M.sdf){ep("SDF images are not supported in formatted text and will be ignored.");continue}E=!1,T=1/(S=M.pixelRatio)}const A=(s||h)&&b.vertical,C=b.metrics.advance*b.scale/2,z=b.metrics,k=b.rect;if(null===k)continue;h&&r.verticalizable&&(I=b.imageName?C-b.metrics.width*b.scale/2:0);const P=s?[b.x+C,b.y]:[0,0];let D=[0,0],L=[0,0],B=!1;s||(A?(L=[b.x+C+p[0],b.y+p[1]-I,],B=!0):D=[b.x+C+n[0],b.y+n[1]-I,]);const R=k.w*b.scale/(S*(b.localGlyph?2:1)),F=k.h*b.scale/(S*(b.localGlyph?2:1));let O,U,V,N;if(A){const j=b.y-y,G=new l(-C,C-j),Z=-Math.PI/2,_=new l(...L);(O=new l(-C+D[0],D[1]))._rotateAround(Z,G)._add(_),O.x+=-j+C,O.y-=(z.left-T)*b.scale;const q=b.imageName?z.advance*b.scale:24*b.scale,X=String.fromCharCode(b.glyph);lx(X)?O.x+=(1-T)*b.scale:lv(X)?O.x+=q-z.height*b.scale+(-T-1)*b.scale:O.x+=b.imageName||z.width+2*T===k.w&&z.height+2*T===k.h?(q-F)/2:(q-(z.height+2*T)*b.scale)/2,U=new l(O.x,O.y-R),V=new l(O.x+F,O.y),N=new l(O.x+F,O.y-R)}else{const W=(z.left-T)*b.scale-C+D[0],H=(-z.top-T)*b.scale+D[1],K=W+R,Y=H+F;O=new l(W,H),U=new l(K,H),V=new l(W,Y),N=new l(K,Y)}if(d){let J;J=s?new l(0,0):B?new l(p[0],p[1]):new l(n[0],n[1]),O._rotateAround(d,J),U._rotateAround(d,J),V._rotateAround(d,J),N._rotateAround(d,J)}const Q=new l(0,0),ee=new l(0,0);u.push({tl:O,tr:U,bl:V,br:N,tex:w,writingMode:r.writingMode,glyphOffset:P,sectionIndex:b.sectionIndex,isSDF:E,pixelOffsetTL:Q,pixelOffsetBR:ee,minFontScaleX:0,minFontScaleY:0})}}return u}(0,o,u,a,c,h,s,i.allowVerticalPlacement),b=i.textSizeData;let w=null;for(const T of("source"===b.kind?(w=[128*a.layout.get("text-size").evaluate(h,{},x),])[0]>cE&&ep(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===b.kind&&((w=[128*g.compositeTextSizes[0].evaluate(h,{},x),128*g.compositeTextSizes[1].evaluate(h,{},x),])[0]>cE||w[1]>cE)&&ep(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),i.addSymbols(i.text,v,w,u,c,h,p,r,n,d.lineStartIndex,d.lineLength,$,y,x),f))m[T]=i.text.placedSymbolArray.length-1;return 4*v.length}function cI(i){for(const r in i)return i[r];return null}function cM(i,r,n,o,s,a,c,h,u,d){let p=c.top,f=c.bottom,m=c.left,$=c.right;const g=c.collisionPadding;if(g&&(m-=g[0],p-=g[1],$+=g[2],f+=g[3]),u){const y=new l(m,p),x=new l($,p),v=new l(m,f),b=new l($,f),w=u*j;let T=new l(0,0);d&&(T=new l(d[0],d[1])),y._rotateAround(w,T),x._rotateAround(w,T),v._rotateAround(w,T),b._rotateAround(w,T),m=Math.min(y.x,x.x,v.x,b.x),$=Math.max(y.x,x.x,v.x,b.x),p=Math.min(y.y,x.y,v.y,b.y),f=Math.max(y.y,x.y,v.y,b.y)}return i.emplaceBack(r.x,r.y,r.z,n.x,n.y,m,p,$,f,h,o,s,a),i.length-1}function cA(i){i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);const r=i.bottom-i.top;return r>0?Math.max(10,r):null}function cC(i,r,n,o){const s=i.compareText;if(r in s){const a=s[r];for(let l=a.length-1;l>=0;l--)if(o.dist(a[l])i.id),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=p([]),this.placementViewportMatrix=p([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=lp(this.zoom,r["text-size"]),this.iconSizeData=lp(this.zoom,r["icon-size"]);const n=this.layers[0].layout,o=n.get("symbol-sort-key"),s=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==s&&void 0!==o.constantOr(1),this.sortFeaturesByY=("viewport-y"===s||"auto"===s&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(i=>lq[i]),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.sourceID=i.sourceID}createArrays(){this.text=new cB(new o7(this.layers,this.zoom,i=>/^text/.test(i))),this.icon=new cB(new o7(this.layers,this.zoom,i=>/^icon/.test(i))),this.glyphOffsetArray=new oB,this.lineVertexArray=new oR,this.symbolInstances=new oL}calculateGlyphDependencies(i,r,n,o,s){for(let a=0;a0)&&("constant"!==l.value.kind||l.value.value.length>0),d="constant"!==h.value.kind||!!h.value.value||Object.keys(h.parameters).length>0,p=a.get("symbol-sort-key");if(this.features=[],!u&&!d)return;const f=r.iconDependencies,m=r.glyphDependencies,$=r.availableImages,g=new nH(this.zoom);for(const{feature:y,id:x,index:v,sourceLayerIndex:b}of i){const w=s._featureFilter.needGeometry,T=sI(y,w);if(!s._featureFilter.filter(g,T,n))continue;let E,S;if(w||(T.geometry=sS(y,n,o)),u){const I=s.getValueAndResolveTokens("text-field",T,n,$),M=tV.factory(I);cL(M)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nq()||this.hasRTLText&&nW.isParsed())&&(E=lg(M,s,T))}if(d){const A=s.getValueAndResolveTokens("icon-image",T,n,$);S=A instanceof tN?A:tN.fromString(A)}if(!E&&!S)continue;const C=this.sortFeaturesByKey?p.evaluate(T,{},n):void 0;if(this.features.push({id:x,text:E,icon:S,index:v,sourceLayerIndex:b,geometry:T.geometry,properties:y.properties,type:cz[y.type],sortKey:C}),S&&(f[S.name]=!0),E){const z=l.evaluate(T,{},n).join(","),k="map"===a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");for(const P of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(lq.vertical)>=0,E.sections))if(P.image)f[P.image.name]=!0;else{const D=nC(E.toString()),L=P.fontStack||z,B=m[L]=m[L]||{};this.calculateGlyphDependencies(P.text,B,k,this.allowVerticalPlacement,D)}}}"line"===a.get("symbol-placement")&&(this.features=function(i){const r={},n={},o=[];let s=0;function a(r){o.push(i[r]),s++}function l(i,r,s){const a=n[i];return delete n[i],n[r]=a,o[a].geometry[0].pop(),o[a].geometry[0]=o[a].geometry[0].concat(s[0]),a}function c(i,n,s){const a=r[n];return delete r[n],r[i]=a,o[a].geometry[0].shift(),o[a].geometry[0]=s[0].concat(o[a].geometry[0]),a}function h(i,r,n){const o=n?r[0][r[0].length-1]:r[0][0];return`${i}:${o.x}:${o.y}`}for(let u=0;ui.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((i,r)=>i.sortKey-r.sortKey)}update(i,r,n,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(i,r,this.layers,n,o),this.icon.programConfigurations.updatePaintArrays(i,r,this.layers,n,o))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(i,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(i,r){const n=this.lineVertexArray.length;if(void 0!==i.segment){let o=i.dist(r[i.segment+1]),s=i.dist(r[i.segment]);const a={};for(let l=i.segment+1;l=0;c--)a[c]={x:r[c].x,y:r[c].y,tileUnitDistanceFromAnchor:s},c>0&&(s+=r[c-1].dist(r[c]));for(let h=0;h=0?r.rightJustifiedTextSymbolIndex:r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.leftJustifiedTextSymbolIndex>=0?r.leftJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex>=0?r.verticalPlacedTextSymbolIndex:o),a=lf(this.textSizeData,i,s)/24;return this.tilePixelRatio*a}getSymbolInstanceIconSize(i,r,n){const o=this.icon.placedSymbolArray.get(n),s=lf(this.iconSizeData,i,o);return this.tilePixelRatio*s}_commitDebugCollisionVertexUpdate(i,r,n){i.emplaceBack(r,-n,-n),i.emplaceBack(r,n,-n),i.emplaceBack(r,n,n),i.emplaceBack(r,-n,n)}_updateTextDebugCollisionBoxes(i,r,n,o,s,a){for(let l=o;l0}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(i,r){const n=i.placedSymbolArray.get(r),o=n.vertexStartIndex+4*n.numGlyphs;for(let s=n.vertexStartIndex;so[i]-o[r]||s[r]-s[i]),a}addToSortKeyRanges(i,r){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(const r of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){const n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex,].forEach((i,r,n)=>{i>=0&&n.indexOf(i)===r&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}r4("SymbolBucket",cF,{omit:["layers","collisionBoxArray","features","compareText",]}),cF.MAX_GLYPHS=65535,cF.addDynamicAttributes=cD;const cO=new n7({"symbol-placement":new n5(tu.layout_symbol["symbol-placement"]),"symbol-spacing":new n5(tu.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new n5(tu.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new n4(tu.layout_symbol["symbol-sort-key"]),"symbol-z-order":new n5(tu.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new n5(tu.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new n5(tu.layout_symbol["icon-ignore-placement"]),"icon-optional":new n5(tu.layout_symbol["icon-optional"]),"icon-rotation-alignment":new n5(tu.layout_symbol["icon-rotation-alignment"]),"icon-size":new n4(tu.layout_symbol["icon-size"]),"icon-text-fit":new n5(tu.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new n5(tu.layout_symbol["icon-text-fit-padding"]),"icon-image":new n4(tu.layout_symbol["icon-image"]),"icon-rotate":new n4(tu.layout_symbol["icon-rotate"]),"icon-padding":new n5(tu.layout_symbol["icon-padding"]),"icon-keep-upright":new n5(tu.layout_symbol["icon-keep-upright"]),"icon-offset":new n4(tu.layout_symbol["icon-offset"]),"icon-anchor":new n4(tu.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new n5(tu.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new n5(tu.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new n5(tu.layout_symbol["text-rotation-alignment"]),"text-field":new n4(tu.layout_symbol["text-field"]),"text-font":new n4(tu.layout_symbol["text-font"]),"text-size":new n4(tu.layout_symbol["text-size"]),"text-max-width":new n4(tu.layout_symbol["text-max-width"]),"text-line-height":new n4(tu.layout_symbol["text-line-height"]),"text-letter-spacing":new n4(tu.layout_symbol["text-letter-spacing"]),"text-justify":new n4(tu.layout_symbol["text-justify"]),"text-radial-offset":new n4(tu.layout_symbol["text-radial-offset"]),"text-variable-anchor":new n5(tu.layout_symbol["text-variable-anchor"]),"text-anchor":new n4(tu.layout_symbol["text-anchor"]),"text-max-angle":new n5(tu.layout_symbol["text-max-angle"]),"text-writing-mode":new n5(tu.layout_symbol["text-writing-mode"]),"text-rotate":new n4(tu.layout_symbol["text-rotate"]),"text-padding":new n5(tu.layout_symbol["text-padding"]),"text-keep-upright":new n5(tu.layout_symbol["text-keep-upright"]),"text-transform":new n4(tu.layout_symbol["text-transform"]),"text-offset":new n4(tu.layout_symbol["text-offset"]),"text-allow-overlap":new n5(tu.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new n5(tu.layout_symbol["text-ignore-placement"]),"text-optional":new n5(tu.layout_symbol["text-optional"])});var cU={paint:new n7({"icon-opacity":new n4(tu.paint_symbol["icon-opacity"]),"icon-color":new n4(tu.paint_symbol["icon-color"]),"icon-halo-color":new n4(tu.paint_symbol["icon-halo-color"]),"icon-halo-width":new n4(tu.paint_symbol["icon-halo-width"]),"icon-halo-blur":new n4(tu.paint_symbol["icon-halo-blur"]),"icon-translate":new n5(tu.paint_symbol["icon-translate"]),"icon-translate-anchor":new n5(tu.paint_symbol["icon-translate-anchor"]),"text-opacity":new n4(tu.paint_symbol["text-opacity"]),"text-color":new n4(tu.paint_symbol["text-color"],{runtimeType:tT,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new n4(tu.paint_symbol["text-halo-color"]),"text-halo-width":new n4(tu.paint_symbol["text-halo-width"]),"text-halo-blur":new n4(tu.paint_symbol["text-halo-blur"]),"text-translate":new n5(tu.paint_symbol["text-translate"]),"text-translate-anchor":new n5(tu.paint_symbol["text-translate-anchor"])}),layout:cO};class cV{constructor(i){this.type=i.property.overrides?i.property.overrides.runtimeType:tx,this.defaultValue=i}evaluate(i){if(i.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(i.formattedSection))return r.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}r4("FormatSectionOverride",cV,{omit:["defaultValue"]});class cN extends ss{constructor(i){super(i,cU)}recalculate(i,r){super.recalculate(i,r),"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 n=this.layout.get("text-writing-mode");if(n){const o=[];for(const s of n)0>o.indexOf(s)&&o.push(s);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(i,r,n,o){var s;const a=this.layout.get(i).evaluate(r,{},n,o),l=this._unevaluatedLayout._values[i];return l.isDataDriven()||rh(l.value)||!a?a:(s=r.properties,a.replace(/{([^{}]+)}/g,(i,r)=>r in s?String(s[r]):""))}createBucket(i){return new cF(i)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const i of cU.paint.overridableProperties){if(!cN.hasPaintOverride(this.layout,i))continue;const r=this.paint.get(i),n=new cV(r),o=new rc(n,r.property.specification);let s=null;s="constant"===r.value.kind||"source"===r.value.kind?new rd("source",o):new rp("composite",o,r.value.zoomStops,r.value._interpolationType),this.paint._values[i]=new n2(r.property,s,r.parameters)}}_handleOverridablePaintPropertyUpdate(i,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&cN.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,r){const n=i.get("text-field"),o=cU.paint.properties[r];let s=!1;const a=i=>{for(const r of i)if(o.overrides&&o.overrides.hasOverride(r))return void(s=!0)};if("constant"===n.value.kind&&n.value.value instanceof tV)a(n.value.value.sections);else if("source"===n.value.kind){const l=i=>{s||(i instanceof tq&&tZ(i.value)===tM?a(i.value.sections):i instanceof tK?a(i.sections):i.eachChild(l))},c=n.value;c._styleExpression&&l(c._styleExpression.expression)}return s}getProgramConfiguration(i){return new o9(this,i)}}var cj={paint:new n7({"background-color":new n5(tu.paint_background["background-color"]),"background-pattern":new n8(tu.paint_background["background-pattern"]),"background-opacity":new n5(tu.paint_background["background-opacity"])})},cG={paint:new n7({"raster-opacity":new n5(tu.paint_raster["raster-opacity"]),"raster-hue-rotate":new n5(tu.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new n5(tu.paint_raster["raster-brightness-min"]),"raster-brightness-max":new n5(tu.paint_raster["raster-brightness-max"]),"raster-saturation":new n5(tu.paint_raster["raster-saturation"]),"raster-contrast":new n5(tu.paint_raster["raster-contrast"]),"raster-resampling":new n5(tu.paint_raster["raster-resampling"]),"raster-fade-duration":new n5(tu.paint_raster["raster-fade-duration"])})};class cZ extends ss{constructor(i){super(i,{}),this.implementation=i}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){}serialize(){}onAdd(i){this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)}onRemove(i){this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)}}var c_={paint:new n7({"sky-type":new n5(tu.paint_sky["sky-type"]),"sky-atmosphere-sun":new n5(tu.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new n5(tu.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new n5(tu.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new n5(tu.paint_sky["sky-gradient-radius"]),"sky-gradient":new n9(tu.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new n5(tu.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new n5(tu.paint_sky["sky-atmosphere-color"]),"sky-opacity":new n5(tu.paint_sky["sky-opacity"])})};function cq(i,r,n){var o,s,a,l,c,h,u,d,p;const f=T(0,0,1),m=U(O());return o=m,s=m,a=n?-(i*j)+Math.PI:i*j,a*=.5,l=s[0],c=s[1],h=s[2],u=s[3],d=Math.sin(a),p=Math.cos(a),o[0]=l*p-h*d,o[1]=c*p+u*d,o[2]=h*p+l*d,o[3]=u*p-c*d,V(m,m,-(r*j)),L(f,f,m),z(f,f)}const cX={circle:class extends ss{constructor(i){super(i,sq)}createBucket(i){return new sA(i)}queryRadius(i){const r=i;return sN("circle-radius",this,r)+sN("circle-stroke-width",this,r)+sj(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,n,o,s,a,l,c){const h=sZ(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(r,n)+this.paint.get("circle-stroke-width").evaluate(r,n);return sH(i,o,a,l,c,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),h,u)}getProgramIds(){return["circle"]}getProgramConfiguration(i){return new o9(this,i)}},heatmap:class extends ss{createBucket(i){return new s0(i)}constructor(i){super(i,s6),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"heatmap-color"===i&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=s8({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(i){return sN("heatmap-radius",this,i)}queryIntersectsFeature(i,r,n,o,s,a,c,h){const u=this.paint.get("heatmap-radius").evaluate(r,n);return sH(i,o,a,c,h,!0,!0,new l(0,0),u)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(i){return new o9(this,i)}},hillshade:class extends ss{constructor(i){super(i,s9)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare",]}getProgramConfiguration(i){return new o9(this,i)}},fill:class extends ss{constructor(i){super(i,aF)}getProgramIds(){const i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),n=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&n.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),n}getProgramConfiguration(i){return new o9(this,i)}recalculate(i,r){super.recalculate(i,r);const n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new aB(i)}queryRadius(){return sj(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,n,o,s,a){return!i.queryGeometry.isAboveHorizon&&sk(sG(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),o)}isTileClipped(){return!0}},"fill-extrusion":class extends ss{constructor(i){super(i,a1)}createBucket(i){return new aQ(i)}queryRadius(){return sj(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion",]}getProgramConfiguration(i){return new o9(this,i)}queryIntersectsFeature(i,r,n,o,s,a,c,h,u){var d,p,f,m,$,g,y,x,v;const b=sZ(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,i.pixelToTileUnitsFactor),w=this.paint.get("fill-extrusion-height").evaluate(r,n),T=this.paint.get("fill-extrusion-base").evaluate(r,n),E=[0,0],S=h&&a.elevation,I=a.elevation?a.elevation.exaggeration():1;if(S){const M=i.tile.getBucket(this).centroidVertexArray,A=u+1;if(A=3){for(let a=0;a1&&(c=i[++l]);const u=Math.abs(h-c.left),d=Math.abs(h-c.right),p=Math.min(u,d);let f;const m=s/n*(o+1);if(c.isDash){const $=o-Math.abs(m);f=Math.sqrt(p*p+$*$)}else f=o-Math.sqrt(p*p+m*m);this.image.data[a+h]=Math.max(0,Math.min(255,f+128))}}}addRegularDash(i,r){for(let n=i.length-1;n>=0;--n){const o=i[n],s=i[n+1];o.zeroLength?i.splice(n,1):s&&s.isDash===o.isDash&&(s.left=o.left,i.splice(n,1))}const a=i[0],l=i[i.length-1];a.isDash===l.isDash&&(a.left=l.left-this.width,l.right=a.right+this.width);const c=this.width*this.nextRow;let h=0,u=i[h];for(let d=0;d1&&(u=i[++h]);const p=Math.abs(d-u.left),f=Math.abs(d-u.right),m=Math.min(p,f);this.image.data[c+d]=Math.max(0,Math.min(255,(u.isDash?m:-m)+r+128))}}addDash(i,r){const n=this.getKey(i,r);if(this.positions[n])return this.positions[n];const o="round"===r,s=o?7:0,a=2*s+1;if(this.nextRow+a>this.height)return ep("LineAtlas out of space"),null;0===i.length&&i.push(1);let l=0;for(let c=0;c{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=()=>{}}}const c2=h.performance;function c3(i){const r=i?i.url.toString():void 0;return c2.getEntriesByName(r)}class c5{constructor(){this.tasks={},this.taskQueue=[],ea(["process"],this),this.invoker=new c1(this.process),this.nextId=0}add(i,r){const n=this.nextId++,o=function({type:i,isSymbolTile:r,zoom:n}){return n=n||0,"message"===i?0:"maybePrepare"!==i||r?"parseTile"!==i||r?"parseTile"===i&&r?300-n:"maybePrepare"===i&&r?400-n:500:200-n:100-n}(r);return 0===o?(e$(),i(),{cancel(){}}):(this.tasks[n]={fn:i,metadata:r,priority:o,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}})}process(){e$();{if(this.taskQueue=this.taskQueue.filter(i=>!!this.tasks[i]),!this.taskQueue.length)return;const i=this.pick();if(null===i)return;const r=this.tasks[i];if(delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),!r)return;r.fn()}}pick(){let i=null,r=1/0;for(let n=0;n0;a--)s+=(r&(o=1<this.canonical.z?new c9(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new c9(i,this.wrap,i,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(i,r=!0){if(this.overscaledZ===i&&r)return this.key;if(i>this.canonical.z)return c7(this.wrap*+r,i,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-i;return c7(this.wrap*+r,i,i,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(i){if(i.wrap!==this.wrap)return!1;const r=this.canonical.z-i.canonical.z;return 0===i.overscaledZ||i.overscaledZ>r&&i.canonical.y===this.canonical.y>>r}children(i){if(this.overscaledZ>=i)return[new c9(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y),];const r=this.canonical.z+1,n=2*this.canonical.x,o=2*this.canonical.y;return[new c9(r,this.wrap,r,n,o),new c9(r,this.wrap,r,n+1,o),new c9(r,this.wrap,r,n,o+1),new c9(r,this.wrap,r,n+1,o+1),]}isLessThan(i){return this.wrapi.wrap)&&(this.overscaledZi.overscaledZ)&&(this.canonical.xi.canonical.x)&&this.canonical.yMath.abs(o[l])){if(n[l]r[l])return null}else{const c=1/o[l];let h=(i[l]-n[l])*c,u=(r[l]-n[l])*c;if(h>u){const d=h;h=u,u=d}if(h>s&&(s=h),ua)return null}return s}function hc(i,r,n,o,s,a,l,c,h,u,d){const p=o-i,f=s-r,m=a-n,$=l-i,g=c-r,y=h-n,x=d[1]*y-d[2]*g,v=d[2]*$-d[0]*y,b=d[0]*g-d[1]*$,w=p*x+f*v+m*b;if(1e-15>Math.abs(w))return null;const T=1/w,E=u[0]-i,S=u[1]-r,I=u[2]-n,M=(E*x+S*v+I*b)*T;if(M<0||M>1)return null;const A=S*m-I*f,C=I*p-E*m,z=E*f-S*p,k=(d[0]*A+d[1]*C+d[2]*z)*T;return k<0||M+k>1?null:($*A+g*C+y*z)*T}function hh(i,r,n,o,s,a,l,c,h){const u=1<{const a=o?1:0;s[0]=i*n,s[1]=r*n,s[2]=(i+1)*n-a,s[3]=(r+1)*n-a};let l=new ha(o);const c=[];for(let h=0;h=1;o/=2){const m=n[n.length-1];l=new ha(o);for(let $=0;$0;){const{idx:m,t:$,nodex:g,nodey:y,depth:x}=f.pop();if(this.leaves[m]){hh(g,y,x,i,r,n,o,d,p);const v=1<=B[2])return $}continue}let R=0;for(let F=0;F=h[u[N]]&&(u.splice(N,0,F),V=!0);V||(u[R]=F),R++}}for(let j=0;j=this.dim+1||r<-1||r>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(i+1)}_unpackMapbox(i,r,n){return(256*i*256+256*r+n)/10-1e4}_unpackTerrarium(i,r,n){return 256*i+r+n/256-32768}static pack(i,r){const n=[0,0,0,0],o=hm.getUnpackVector(r);let s=Math.floor((i+o[3])/o[2]);return n[2]=s%256,s=Math.floor(s/256),n[1]=s%256,s=Math.floor(s/256),n[0]=s,n}getPixels(){return new s4({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(i,r,n){if(this.dim!==i.dim)throw Error("dem dimension mismatch");let o=r*this.dim,s=r*this.dim+this.dim,a=n*this.dim,l=n*this.dim+this.dim;switch(r){case -1:o=s-1;break;case 1:s=o+1}switch(n){case -1:a=l-1;break;case 1:l=a+1}const c=-r*this.dim,h=-n*this.dim;for(let u=a;u{this.remove(i,s)},n)),this.data[o].push(s),this.order.push(o),this.order.length>this.max){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){const r=this.data[i].shift();return r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),r.value}getByKey(i){const r=this.data[i];return r?r[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,r){if(!this.has(i))return this;const n=i.wrapped().key,o=void 0===r?0:this.data[n].indexOf(r),s=this.data[n][o];return this.data[n].splice(o,1),s.timeout&&clearTimeout(s.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(s.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){const r=this._getAndRemoveByKey(this.order[0]);r&&this.onRemove(r)}return this}filter(i){const r=[];for(const n in this.data)for(const o of this.data[n])i(o.value)||r.push(o);for(const s of r)this.remove(s.value.tileID,s)}}class hg extends th{constructor(i,r,n){super(),this.id=i,this._onlySymbols=n,r.on("data",i=>{"source"===i.dataType&&"metadata"===i.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===i.dataType&&"content"===i.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new h$(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=null,this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new hs}onAdd(i){this.map=i,this._minTileCacheSize=i?i._minTileCacheSize:null,this._maxTileCacheSize=i?i._maxTileCacheSize:null}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const i in this._tiles){const r=this._tiles[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(i,r){return i.isSymbolTile=this._onlySymbols,this._source.loadTile(i,r)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i,()=>{})}_abortTile(i){if(this._source.abortTile)return this._source.abortTile(i,()=>{})}serialize(){return this._source.serialize()}prepare(i){for(const r in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){const n=this._tiles[r];n.upload(i),n.prepare(this.map.style.imageManager)}}getIds(){return ee(this._tiles).map(i=>i.tileID).sort(hy).map(i=>i.key)}getRenderableIds(i){const r=[];for(const n in this._tiles)this._isIdRenderable(+n,i)&&r.push(this._tiles[n]);return i?r.sort((i,r)=>{const n=i.tileID,o=r.tileID,s=new l(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),a=new l(o.canonical.x,o.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-o.overscaledZ||a.y-s.y||a.x-s.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(hy).map(i=>i.key)}hasRenderableParent(i){const r=this.findLoadedParent(i,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(i,r){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(r||!this._tiles[i].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(const i in this._cache.reset(),this._tiles)"errored"!==this._tiles[i].state&&this._reloadTile(+i,"reloading")}_reloadTile(i,r){const n=this._tiles[i];n&&("loading"!==n.state&&(n.state=r),this._loadTile(n,this._tileLoaded.bind(this,n,i,r)))}_tileLoaded(i,r,n,o){if(o){if(i.state="errored",404!==o.status)this._source.fire(new tc(o,{tile:i}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const s=this.map.painter.terrain;this.update(this.transform,s.getScaledDemTileSize(),!0),s.resetTileLookupCache(this.id)}else this.update(this.transform)}else i.timeAdded=eE.now(),"expired"===n&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(r,i),"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new tl("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(i){const r=this.getRenderableIds();for(let n=0;n1||(Math.abs(n)>1&&(1===Math.abs(n+s)?n+=s:1===Math.abs(n-s)&&(n-=s)),r.dem&&i.dem&&(i.dem.backfillBorder(r.dem,n,o),i.neighboringTiles&&i.neighboringTiles[a]&&(i.neighboringTiles[a].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,r,n,o){for(const s in this._tiles){let a=this._tiles[s];if(o[s]||!a.hasData()||a.tileID.overscaledZ<=r||a.tileID.overscaledZ>n)continue;let l=a.tileID;for(;a&&a.tileID.overscaledZ>r+1;){const c=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[c.key])&&a.hasData()&&(l=c)}let h=l;for(;h.overscaledZ>r;)if(i[(h=h.scaledTo(h.overscaledZ-1)).key]){o[l.key]=l;break}}}findLoadedParent(i,r){if(i.key in this._loadedParentTiles){const n=this._loadedParentTiles[i.key];return n&&n.tileID.overscaledZ>=r?n:null}for(let o=i.overscaledZ-1;o>=r;o--){const s=i.scaledTo(o),a=this._getLoadedTile(s);if(a)return a}}_getLoadedTile(i){const r=this._tiles[i.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,r){r=r||this._source.tileSize;const n=Math.ceil(i.width/r)+1,o=Math.ceil(i.height/r)+1,s=Math.floor(n*o*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,s):s,l="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(l)}handleWrapJump(i){const r=Math.round((i-(void 0===this._prevLng?i:this._prevLng))/360);if(this._prevLng=i,r){const n={};for(const o in this._tiles){const s=this._tiles[o];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+r),n[s.tileID.key]=s}for(const a in this._tiles=n,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(const l in this._tiles)this._setTileReloadTimer(+l,this._tiles[l])}}update(i,r,n){if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;let o;this.updateCacheSize(i,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?o=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new c9(i.canonical.z,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y)):(o=i.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(o=o.filter(i=>this._source.hasTile(i)))):o=[];const s=this._updateRetainedTiles(o);if(hx(this._source.type)&&0!==o.length){const a={},l={},c=Object.keys(s);for(const h of c){const u=s[h],d=this._tiles[h];if(!d||d.fadeEndTime&&d.fadeEndTime<=eE.now())continue;const p=this.findLoadedParent(u,Math.max(u.overscaledZ-hg.maxOverzooming,this._source.minzoom));p&&(this._addTile(p.tileID),a[p.tileID.key]=p.tileID),l[h]=u}const f=o[o.length-1].overscaledZ;for(const m in this._tiles){const $=this._tiles[m];if(s[m]||!$.hasData())continue;let g=$.tileID;for(;g.overscaledZ>f;){g=g.scaledTo(g.overscaledZ-1);const y=this._tiles[g.key];if(y&&y.hasData()&&l[g.key]){s[m]=$.tileID;break}}}for(const x in a)s[x]||(this._coveredTiles[x]=!0,s[x]=a[x])}for(const v in s)this._tiles[v].clearFadeHold();const b=function(i,r){const n=[];for(const o in i)o in r||n.push(o);return n}(this._tiles,s);for(const w of b){const T=this._tiles[w];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(+w)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){const r={};if(0===i.length)return r;const n={},o=i.reduce((i,r)=>Math.min(i,r.overscaledZ),1/0),s=i[0].overscaledZ,a=Math.max(s-hg.maxOverzooming,this._source.minzoom),l=Math.max(s+hg.maxUnderzooming,this._source.minzoom),c={};for(const h of i){const u=this._addTile(h);r[h.key]=h,u.hasData()||o=this._source.maxzoom){const f=d.children(this._source.maxzoom)[0],m=this.getTile(f);if(m&&m.hasData()){r[f.key]=f;continue}}else{const $=d.children(this._source.maxzoom);if(r[$[0].key]&&r[$[1].key]&&r[$[2].key]&&r[$[3].key])continue}let g=p.wasRequested();for(let y=d.overscaledZ-1;y>=a;--y){const x=d.scaledTo(y);if(n[x.key]||(n[x.key]=!0,(p=this.getTile(x))||!g||(p=this._addTile(x)),p&&(r[x.key]=x,g=p.wasRequested(),p.hasData())))break}}return r}_updateLoadedParentTileCache(){for(const i in this._loadedParentTiles={},this._tiles){const r=[];let n,o=this._tiles[i].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){n=this._loadedParentTiles[o.key];break}r.push(o.key);const s=o.scaledTo(o.overscaledZ-1);if(n=this._getLoadedTile(s))break;o=s}for(const a of r)this._loadedParentTiles[a]=n}}_addTile(i){let r=this._tiles[i.key];if(r)return r;(r=this._cache.getAndRemove(i))&&(this._setTileReloadTimer(i.key,r),r.tileID=i,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,r)));const n=Boolean(r);if(!n){const o=this.map?this.map.painter:null,s="raster"===this._source.type||"raster-dem"===this._source.type;r=new hG(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,o,s),this._loadTile(r,this._tileLoaded.bind(this,r,i.key,r.state))}return r?(r.uses++,this._tiles[i.key]=r,n||this._source.fire(new tl("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(i,r){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);const n=r.getExpiryTimeout();n&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},n))}_removeTile(i){const r=this._tiles[i];r&&(r.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),r.uses>0||(r.hasData()&&"reloading"!==r.state?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){for(const i in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+i);this._source._clear&&this._source._clear(),this._cache.reset()}tilesIn(i,r,n){const o=[],s=this.transform;if(!s)return o;for(const a in this._tiles){const l=this._tiles[a];if(n&&l.clearQueryDebugViz(),l.holdingForFade())continue;const c=i.containsTile(l,s,r);c&&o.push(c)}return o}getVisibleCoordinates(i){const r=this.getRenderableIds(i).map(i=>this._tiles[i].tileID);for(const n of r)n.projMatrix=this.transform.calculateProjMatrix(n.toUnwrapped());return r}hasTransition(){if(this._source.hasTransition())return!0;if(hx(this._source.type))for(const i in this._tiles){const r=this._tiles[i];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=eE.now())return!0}return!1}setFeatureState(i,r,n){this._state.updateState(i=i||"_geojsonTileLayer",r,n)}removeFeatureState(i,r,n){this._state.removeFeatureState(i=i||"_geojsonTileLayer",r,n)}getFeatureState(i,r){return this._state.getState(i=i||"_geojsonTileLayer",r)}setDependencies(i,r,n){const o=this._tiles[i];o&&o.setDependencies(r,n)}reloadTilesForDependencies(i,r){for(const n in this._tiles)this._tiles[n].hasDependency(i,r)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(i,r))}_preloadTiles(i,r){const n=new Map,o=Array.isArray(i)?i:[i],s=this.map.painter.terrain,a=this.usedForTerrain&&s?s.getScaledDemTileSize():this._source.tileSize;for(const l of o){const c=l.coveringTiles({tileSize:a,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const h of c)n.set(h.key,h);this.usedForTerrain&&l.updateElevation(!1)}const u=Array.from(n.values()),d="raster"===this._source.type||"raster-dem"===this._source.type;Q(u,(i,r)=>{const n=new hG(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,this.map.painter,d);this._loadTile(n,i=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),r(i,n)})},r)}}function hy(i,r){const n=Math.abs(2*i.wrap)-+(i.wrap<0),o=Math.abs(2*r.wrap)-+(r.wrap<0);return i.overscaledZ-r.overscaledZ||o-n||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function hx(i){return"raster"===i||"image"===i||"video"===i}hg.maxOverzooming=10,hg.maxUnderzooming=3;class hv{constructor(i,r,n){this._demTile=i,this._dem=this._demTile.dem,this._scale=r,this._offset=n}static create(i,r,n){const o=n||i.findDEMTileFor(r);if(!o||!o.dem)return;const s=o.dem,a=o.tileID,l=1<=0&&d[3]>=0&&c.insert(l,d[0],d[1],d[2],d[3])}}loadVTLayers(){if(!this.vtLayers)for(const i in this.vtLayers=new aH.VectorTile(new lT(this.rawTileData)).layers,this.sourceLayerCoder=new hn(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[i]=[];return this.vtLayers}query(i,r,n,o){this.loadVTLayers();const s=i.params||{},a=rT(s.filter),l=i.tileResult,c=i.transform,h=l.bufferedTilespaceBounds,u=this.grid.query(h.min.x,h.min.y,h.max.x,h.max.y,(i,r,n,o)=>sU(l.bufferedTilespaceGeometry,i,r,n,o));u.sort(hT);let d=null;c.elevation&&u.length>0&&(d=hv.create(c.elevation,this.tileID));const p={};let f;for(let m=0;m(y||(y=sS(r,this.tileID.canonical,i.tileTransform)),n.queryIntersectsFeature(l,r,o,y,this.z,i.transform,i.pixelPosMatrix,d,s)))}return p}loadMatchingFeature(i,r,n,o,s,a,l,c,h){const{featureIndex:u,bucketIndex:d,sourceLayerIndex:p,layoutVertexArrayOffset:f}=r,m=this.bucketLayerIDs[d];if(o&&!function(i,r){for(let n=0;n=0)return!0;return!1}(o,m))return;const $=this.sourceLayerCoder.decode(p),g=this.vtLayers[$].feature(u);if(n.needGeometry){const y=sI(g,!0);if(!n.filter(new nH(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new nH(this.tileID.overscaledZ),g))return;const x=this.getId(g,$);for(let v=0;vo.indexOf(b))continue;const w=a[b];if(!w)continue;let T={};void 0!==x&&c&&(T=c.getState(w.sourceLayer||"_geojsonTileLayer",x));const E=et({},l[b]);E.paint=hw(E.paint,w.paint,g,T,s),E.layout=hw(E.layout,w.layout,g,T,s);const S=!h||h(g,w,T,f);if(!S)continue;const I=new ho(g,this.z,this.x,this.y,x);I.layer=E;let M=i[b];void 0===M&&(M=i[b]=[]),M.push({featureIndex:u,feature:I,intersectionZ:S})}}lookupSymbolFeatures(i,r,n,o,s,a,l,c){const h={};this.loadVTLayers();const u=rT(s);for(const d of i)this.loadMatchingFeature(h,{bucketIndex:n,sourceLayerIndex:o,featureIndex:d,layoutVertexArrayOffset:0},u,a,l,c,r);return h}loadFeature(i){const{featureIndex:r,sourceLayerIndex:n}=i;this.loadVTLayers();const o=this.sourceLayerCoder.decode(n),s=this.vtFeatures[o];if(s[r])return s[r];const a=this.vtLayers[o].feature(r);return s[r]=a,a}hasLayer(i){for(const r of this.bucketLayerIDs)for(const n of r)if(i===n)return!0;return!1}getId(i,r){let n=i.id;return this.promoteId&&"boolean"==typeof(n=i.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[r]])&&(n=Number(n)),n}}function hw(i,r,n,o,s){return ec(i,(i,a)=>{const l=r instanceof n3?r.get(a):null;return l&&l.evaluate?l.evaluate(n,o,s):l})}function hT(i,r){return r-i}r4("FeatureIndex",hb,{omit:["rawTileData","sourceLayerCoder"]});var hE=on([{name:"a_pos",type:"Int16",components:2},]);const hS=new Uint16Array(8184);for(let hI=0;hI<2046;hI++){let hM=hI+2,hA=0,hC=0,hz=0,hk=0,hP=0,hD=0;for(1&hM?hz=hk=hP=32:hA=hC=hD=32;(hM>>=1)>1;){const hL=hA+hz>>1,hB=hC+hk>>1;1&hM?(hz=hA,hk=hC,hA=hP,hC=hD):(hA=hz,hC=hk,hz=hP,hk=hD),hP=hL,hD=hB}const hR=4*hI;hS[hR+0]=hA,hS[hR+1]=hC,hS[hR+2]=hz,hS[hR+3]=hk}const hF=new Uint16Array(2178),hO=new Uint8Array(1089),hU=new Uint16Array(1089);function hV(i){return 0===i?-.03125:32===i?.03125:0}var hN=on([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2},]);const hj={type:2,extent:8192,loadGeometry:()=>[[new l(0,0),new l(8193,0),new l(8193,8193),new l(0,8193),new l(0,0),],]};class hG{constructor(i,r,n,o,s){this.tileID=i,this.uid=er(),this.uses=0,this.tileSize=r,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,this.expiredRequestCount=0,this.state="loading",o&&o.transform&&(this.projection=o.transform.projection)}registerFadeDuration(i){const r=i+this.timeAdded;rr.getLayer(i)).filter(Boolean);if(0!==s.length)for(const a of(o.layers=s,o.stateDependentLayerIds&&(o.stateDependentLayers=o.stateDependentLayerIds.map(i=>s.filter(r=>r.id===i)[0])),s))n[a.id]=o}return n}(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){const s=this.buckets[o];if(s instanceof cF){if(this.hasSymbolBuckets=!0,!n)break;s.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const a in this.buckets){const l=this.buckets[a];if(l instanceof cF&&l.hasRTLText){this.hasRTLText=!0,nW.isLoading()||nW.isLoaded()||"deferred"!==nq()||nX();break}}for(const c in this.queryPadding=0,this.buckets){const h=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(c).queryRadius(h))}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas)}else this.collisionBoxArray=new oz}unloadVectorData(){if(this.hasData()){for(const i in this.buckets)this.buckets[i].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(i){return this.buckets[i.id]}upload(i){for(const r in this.buckets){const n=this.buckets[r];n.uploadPending()&&n.upload(i)}const o=i.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new cQ(i,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new cQ(i,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new cQ(i,this.lineAtlas.image,o.ALPHA),this.lineAtlas.uploaded=!0)}prepare(i){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture)}queryRenderedFeatures(i,r,n,o,s,a,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:o,pixelPosMatrix:l,transform:a,params:s,tileTransform:this.tileTransform},i,r,n):{}}querySourceFeatures(i,r){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const o=n.loadVTLayers(),s=r?r.sourceLayer:"",a=o._geojsonTileLayer||o[s];if(!a)return;const l=rT(r&&r.filter),{z:c,x:h,y:u}=this.tileID.canonical,d={z:c,x:h,y:u};for(let p=0;po)s=!1;else if(r){if(this.expirationTime=0;d--){const p=4*d,f=hS[p+0],m=hS[p+1],$=hS[p+2],g=hS[p+3],y=f+$>>1,x=m+g>>1,v=y+x-m,b=x+f-y,w=33*m+f,T=33*g+$,E=33*x+y,S=Math.hypot((hF[2*w+0]+hF[2*T+0])/2-hF[2*E+0],(hF[2*w+1]+hF[2*T+1])/2-hF[2*E+1])>=16;if(hO[E]=hO[E]||(S?1:0),d<1022){const I=(m+b>>1)*33+(f+v>>1),M=(g+b>>1)*33+($+v>>1);hO[E]=hO[E]||hO[I]||hO[M]}}const A=new oa,C=new oy;let z=0;function k(i,r){const n=33*r+i;return 0===hU[n]&&(A.emplaceBack(hF[2*n+0],hF[2*n+1],8192*i/32,8192*r/32),hU[n]=++z),hU[n]-1}function P(i,r,n,o,s,a){const l=i+n>>1,c=r+o>>1;if(Math.abs(i-s)+Math.abs(r-a)>1&&hO[33*c+l])P(s,a,i,r,l,c),P(n,o,s,a,l,c);else{const h=k(i,r),u=k(n,o),d=k(s,a);C.emplaceBack(h,u,d)}}return P(0,0,32,32,32,0),P(32,32,0,0,0,32),{vertices:A,indices:C}}(this.tileID.canonical,r);o=a.vertices,s=a.indices}else{for(const{x:l,y:c}of(o=new oa,s=new oy,n))o.emplaceBack(l,c,0,0);const h=at(o.int16,void 0,4);for(let u=0;u{const o=65*n+r;i.emplaceBack(o+1,o,o+65),i.emplaceBack(o+65,o+65+1,o+1)};for(let n=0;n<64;n++)for(let o=0;o<64;o++)r(o,n);return i}getWirefameBuffer(i){if(!this.wireframeSegments){const r=this._createWireframeGrid();this.wireframeIndexBuffer=i.createIndexBuffer(r),this.wireframeSegments=sc.simpleSegment(0,0,4096,r.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}_createWireframeGrid(){const i=new oS,r=(r,n)=>{const o=65*n+r;i.emplaceBack(o,o+1),i.emplaceBack(o,o+65),i.emplaceBack(o,o+65+1)};for(let n=0;n<64;n++)for(let o=0;o<64;o++)r(o,n);return i}}function h6(i,r){if(!r.isReprojectedInTileSpace)return{scale:1<b&&(w(i,u,o,s,c,h),w(u,n,c,h,a,l))}w(p,f,o,a,s,a),w(f,m,s,a,s,l),w(m,$,s,l,o,l),w($,p,o,l,o,a),g-=b,y-=b,x+=b,v+=b;const T=1/Math.max(x-g,v-y);return{scale:T,x:g*T,y:y*T,x2:x*T,y2:v*T,projection:r}}class h8{constructor(i){const r={},n=[];for(const o in i){const s=i[o],a=r[o]={};for(const l in s.glyphs){const c=s.glyphs[+l];if(!c||0===c.bitmap.width||0===c.bitmap.height)continue;const h=c.metrics.localGlyph?2:1,u={x:0,y:0,w:c.bitmap.width+2*h,h:c.bitmap.height+2*h};n.push(u),a[l]=u}}const{w:d,h:p}=lG(n),f=new s5({width:d||1,height:p||1});for(const m in i){const $=i[m];for(const g in $.glyphs){const y=$.glyphs[+g];if(!y||0===y.bitmap.width||0===y.bitmap.height)continue;const x=r[m][g],v=y.metrics.localGlyph?2:1;s5.copy(y.bitmap,f,{x:0,y:0},{x:x.x+v,y:x.y+v},y.bitmap)}}this.image=f,this.positions=r}}r4("GlyphAtlas",h8);class h9{constructor(i){this.tileID=new c9(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.collectResourceTiming,this.returnDependencies=!!i.returnDependencies,this.promoteId=i.promoteId,this.enableTerrain=!!i.enableTerrain,this.isSymbolTile=i.isSymbolTile,this.tileTransform=h6(i.tileID.canonical,i.projection),this.projection=i.projection}parse(i,r,n,o,s){this.status="parsing",this.data=i,this.collisionBoxArray=new oz;const a=new hn(Object.keys(i.layers).sort()),l=new hb(this.tileID,this.promoteId);l.bucketLayerIDs=[];const c={},h=new c0(256,256),u={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:h,availableImages:n},d=r.familiesBySource[this.source];for(const p in d){const f=i.layers[p];if(!f)continue;let m=!1,$=!1;for(const g of d[p])"symbol"===g[0].type?m=!0:$=!0;if(!0===this.isSymbolTile&&!m||!1===this.isSymbolTile&&!$)continue;1===f.version&&ep(`Vector tile source "${this.source}" layer "${p}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const y=a.encode(p),x=[];for(let v=0;v=E.maxzoom||"none"!==E.visibility&&(h7(T,this.zoom,n),(c[E.id]=E.createBucket({index:l.bucketLayerIDs.length,layers:T,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:y,sourceID:this.source,enableTerrain:this.enableTerrain,availableImages:n})).populate(x,u,this.tileID.canonical,this.tileTransform),l.bucketLayerIDs.push(T.map(i=>i.id)))}}let S,I,M,A;h.trim();const C={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},z=ec(u.glyphDependencies,i=>Object.keys(i).map(Number));Object.keys(z).length?o.send("getGlyphs",{uid:this.uid,stacks:z},(i,r)=>{S||(S=i,I=r,D.call(this))},void 0,!1,C):I={};const k=Object.keys(u.iconDependencies);k.length?o.send("getImages",{icons:k,source:this.source,tileID:this.tileID,type:"icons"},(i,r)=>{S||(S=i,M=r,D.call(this))},void 0,!1,C):M={};const P=Object.keys(u.patternDependencies);function D(){if(S)return s(S);if(I&&M&&A){const i=new h8(I),r=new l_(M,A);for(const o in c){const a=c[o];a instanceof cF?(h7(a.layers,this.zoom,n),cb(a,I,i.positions,M,r.iconPositions,this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection),a.projection=this.projection.name):a.hasPattern&&(a instanceof li||a instanceof aB||a instanceof aQ)&&(h7(a.layers,this.zoom,n),a.addFeatures(u,this.tileID.canonical,r.patternPositions,n))}this.status="done",s(null,{buckets:ee(c).filter(i=>!i.isEmpty()),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:h,imageAtlas:r,glyphMap:this.returnDependencies?I:null,iconMap:this.returnDependencies?M:null,glyphPositions:this.returnDependencies?i.positions:null})}}P.length?o.send("getImages",{icons:P,source:this.source,tileID:this.tileID,type:"patterns"},(i,r)=>{S||(S=i,A=r,D.call(this))},void 0,!1,C):A={},D.call(this)}}function h7(i,r,n){const o=new nH(r);for(const s of i)s.recalculate(o,n)}class ue{constructor(i){this.entries={},this.scheduler=i}request(i,r,n,o){const s=this.entries[i]=this.entries[i]||{callbacks:[]};if(s.result){const[a,l]=s.result;return this.scheduler?this.scheduler.add(()=>{o(a,l)},r):o(a,l),()=>{}}return s.callbacks.push(o),s.cancel||(s.cancel=n((n,o)=>{for(const a of(s.result=[n,o],s.callbacks))this.scheduler?this.scheduler.add(()=>{a(n,o)},r):a(n,o);setTimeout(()=>delete this.entries[i],3e3)})),()=>{s.result||(s.callbacks=s.callbacks.filter(i=>i!==o),s.callbacks.length||(s.cancel(),delete this.entries[i]))}}}function ut(i,r,n){const o=JSON.stringify(i.request);return i.data&&(this.deduped.entries[o]={result:[null,i.data]}),this.deduped.request(o,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom},r=>{const o=e9(i.request,(i,o,s,a)=>{i?r(i):o&&r(null,{vectorTile:n?void 0:new aH.VectorTile(new lT(o)),rawData:o,cacheControl:s,expires:a})});return()=>{o.cancel(),r()}},r)}const ui=p(new Float64Array(16));class ur{constructor(i,r){this._tr=i,this._worldSize=r}createInversionMatrix(){return ui}createTileMatrix(i){let r,n,o;const s=i.canonical,a=p(new Float64Array(16)),l=this._tr.projection;if(l.isReprojectedInTileSpace){const c=h6(s,l);r=1,n=c.x+i.wrap*c.scale,o=c.y,$(a,a,[r/c.scale,r/c.scale,this._tr.pixelsPerMeter/this._worldSize,])}else r=this._worldSize/this._tr.zoomScale(s.z),n=(s.x+Math.pow(2,s.z)*i.wrap)*r,o=s.y*r;return m(a,a,[n,o,0]),$(a,a,[r/8192,r/8192,1]),a}pointCoordinate(i,r,n){const o=this._tr.horizonLineFromTop(!1),s=new l(i,Math.max(o,r));return this._tr.rayIntersectionCoordinate(this._tr.pointRayIntersection(s,n))}upVector(){return[0,0,1]}upVectorScale(){return 1}}const un=Math.sqrt(3)/2,uo=Math.PI/2;function us(i){return Math.tan((uo+i)/2)}const ua=85.051129*j,ul=85.051129*j,uc={albers:{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&&N(this.parallels,this.constants.parallels))return;const i=Math.sin(this.parallels[0]*j),r=(i+Math.sin(this.parallels[1]*j))/2,n=1+i*(2*r-i),o=Math.sqrt(n)/r;this.constants={n:r,c:n,r0:o,parallels:this.parallels}},project(i,r){this.initializeConstants();const n=(i-this.center[0])*j,{n:o,c:s,r0:a}=this.constants,l=Math.sqrt(s-2*o*Math.sin(r*j))/o;return{x:l*Math.sin(n*o),y:l*Math.cos(n*o)-a,z:0}},unproject(i,r){this.initializeConstants();const{n:n,c:o,r0:s}=this.constants,a=s+r;let l=Math.atan2(i,Math.abs(a))*Math.sign(a);a*n<0&&(l-=Math.PI*Math.sign(i)*Math.sign(a));const c=this.center[0]*j*n;l=J(l,-Math.PI-c,Math.PI-c);const h=l/n*G+this.center[0],u=Math.asin(K((o-(i*i+a*a)*n*n)/(2*n),-1,1)),d=K(u*G,-85.051129,85.051129);return new su(h,d)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sp(i)*r,farthestPixelDistance(i){return hX(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new ur(i,r)},equalEarth:{name:"equalEarth",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(i,r){r=r/180*Math.PI,i=i/180*Math.PI;const n=Math.asin(un*Math.sin(r)),o=n*n,s=o*o*o;return{x:.5*(i*Math.cos(n)/(un*(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o)))/Math.PI+.5),y:1-.5*(n*(1.340264+-.081106*o+s*(893e-6+.003796*o))/Math.PI+1),z:0}},unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,o=n*n,s=o*o*o;for(let a,l,c=0;c<12&&(l=n*(1.340264+-.081106*o+s*(893e-6+.003796*o))-r,s=(o=(n=K(n-(a=l/(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o))),-Math.PI/3,Math.PI/3))*n)*o*o,!(1e-12>Math.abs(a)));++c);const h=un*i*(1.340264+-.24331799999999998*o+s*(.0062510000000000005+.034164*o))/Math.cos(n),u=Math.asin(Math.sin(n)/un),d=K(180*h/Math.PI,-180,180),p=K(180*u/Math.PI,-85.051129,85.051129);return new su(d,p)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sp(i)*r,farthestPixelDistance(i){return hX(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new ur(i,r)},equirectangular:{name:"equirectangular",supportsWorldCopies:!0,center:[0,0],range:[3.5,7],zAxisUnit:"meters",wrap:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project:(i,r)=>({x:.5+i/360,y:.5-r/360,z:0}),unproject(i,r){const n=K(360*(.5-r),-85.051129,85.051129);return new su(360*(i-.5),n)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sp(i)*r,farthestPixelDistance(i){return hX(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new ur(i,r)},lambertConformalConic:{name:"lambertConformalConic",range:[3.5,7],zAxisUnit:"meters",center:[0,30],parallels:[30,30],conic:!0,isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],initializeConstants(){if(this.constants&&N(this.parallels,this.constants.parallels))return;const i=this.parallels[0]*j,r=this.parallels[1]*j,n=Math.cos(i),o=i===r?Math.sin(i):Math.log(n/Math.cos(r))/Math.log(us(r)/us(i)),s=n*Math.pow(us(i),o)/o;this.constants={n:o,f:s,parallels:this.parallels}},project(i,r){this.initializeConstants(),r*=j,i=(i-this.center[0])*j;const{n:n,f:o}=this.constants;o>0?r<-uo+1e-6&&(r=-uo+1e-6):r>uo-1e-6&&(r=uo-1e-6);const s=o/Math.pow(us(r),n),a=s*Math.sin(n*i),l=o-s*Math.cos(n*i);return{x:.5*(a/Math.PI+.5),y:1-.5*(l/Math.PI+.5),z:0}},unproject(i,r){this.initializeConstants(),i=(2*i-.5)*Math.PI,r=(2*(1-r)-.5)*Math.PI;const{n:n,f:o}=this.constants,s=o-r,a=Math.sign(s),l=Math.sign(n)*Math.sqrt(i*i+s*s);let c=Math.atan2(i,Math.abs(s))*a;s*n<0&&(c-=Math.PI*Math.sign(i)*a);const h=K(c/n*G+this.center[0],-180,180),u=K((2*Math.atan(Math.pow(o/l,1/n))-uo)*G,-85.051129,85.051129);return new su(h,u)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sp(i)*r,farthestPixelDistance(i){return hX(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new ur(i,r)},mercator:{name:"mercator",wrap:!0,requiresDraping:!1,supportsWorldCopies:!0,supportsTerrain:!0,supportsFog:!0,supportsFreeCamera:!0,zAxisUnit:"meters",center:[0,0],project:(i,r)=>({x:sf(i),y:sm(r),z:0}),unproject(i,r){const n=sg(i),o=sy(r);return new su(n,o)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sp(i)*r,farthestPixelDistance(i){return hX(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new ur(i,r)},naturalEarth:{name:"naturalEarth",center:[0,0],range:[3.5,7],isReprojectedInTileSpace:!0,zAxisUnit:"meters",unsupportedLayers:["custom"],project(i,r){const n=(r*=j)*r,o=n*n;return{x:.5*((i*=j)*(.8707-.131979*n+o*(o*(.003971*n-.001529*o)-.013791))/Math.PI+.5),y:1-.5*(r*(1.007226+n*(.015085+o*(.028874*n-.044475-.005916*o)))/Math.PI+1),z:0}},unproject(i,r){i=(2*i-.5)*Math.PI;let n=r=(2*(1-r)-1)*Math.PI,o=25,s=0,a=n*n;do{a=n*n;const l=a*a;s=(n*(1.007226+a*(.015085+l*(.028874*a-.044475-.005916*l)))-r)/(1.007226+a*(.045255+l*(.259866*a-.311325-.005916*11*l))),n=K(n-s,-ua,ua)}while(Math.abs(s)>1e-6&&--o>0)a=n*n;const c=K(i/(.8707+a*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))*G,-180,180),h=n*G;return new su(c,h)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sp(i)*r,farthestPixelDistance(i){return hX(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new ur(i,r)},winkelTripel:{name:"winkelTripel",center:[0,0],range:[3.5,7],zAxisUnit:"meters",isReprojectedInTileSpace:!0,unsupportedLayers:["custom"],project(i,r){r*=j,i*=j;const n=Math.cos(r),o=2/Math.PI,s=Math.acos(n*Math.cos(i/2)),a=Math.sin(s)/s,l=.5*(i*o+2*n*Math.sin(i/2)/a)||0,c=.5*(r+Math.sin(r)/a)||0;return{x:.5*(l/Math.PI+.5),y:1-.5*(c/Math.PI+1),z:0}},unproject(i,r){let n=i=(2*i-.5)*Math.PI,o=r=(2*(1-r)-1)*Math.PI,s=25,a=0,l=0;do{const c=Math.cos(o),h=Math.sin(o),u=2*h*c,d=h*h,p=c*c,f=Math.cos(n/2),m=Math.sin(n/2),$=2*f*m,g=m*m,y=1-p*f*f,x=y?1/y:0,v=y?Math.acos(c*f)*Math.sqrt(1/y):0,b=.5*(2*v*c*m+2*n/Math.PI)-i,w=.5*(v*h+o)-r,T=.5*x*(p*g+v*c*f*d)+1/Math.PI,E=x*($*u/4-v*h*m),S=.125*x*(u*m-v*h*p*$),I=.5*x*(d*f+v*g*c)+.5,M=E*S-I*T;a=(w*E-b*I)/M,l=(b*S-w*T)/M,n=K(n-a,-Math.PI,Math.PI),o=K(o-l,-ul,ul)}while((Math.abs(a)>1e-6||Math.abs(l)>1e-6)&&--s>0)return new su(n*G,o*G)},projectTilePoint:(i,r)=>({x:i,y:r,z:0}),locationPoint:(i,r)=>i._coordinatePoint(i.locationCoordinate(r),!1),pixelsPerMeter:(i,r)=>1/sp(i)*r,farthestPixelDistance(i){return hX(i,this.pixelsPerMeter(i.center.lat,i.worldSize))},createTileTransform:(i,r)=>new ur(i,r)}};i.ARRAY_TYPE=u,i.AUTH_ERR_MSG=eB,i.Aabb=sW,i.Actor=class{constructor(i,r,n){this.target=i,this.parent=r,this.mapId=n,this.callbacks={},this.cancelCallbacks={},ea(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=e$()?i:h,this.scheduler=new c5}send(i,r,n,o,s=!1,a){const l=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=a,this.callbacks[l]=n);const c=ew(this.globalScope)?void 0:[];return this.target.postMessage({id:l,type:i,hasCallback:!!n,targetMapId:o,mustQueue:s,sourceMapId:this.mapId,data:r7(r,c)},c),{cancel:()=>{n&&delete this.callbacks[l],this.target.postMessage({id:l,type:"",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const r=i.data,n=r.id;if(n&&(!r.targetMapId||this.mapId===r.targetMapId)){if(""===r.type){const o=this.cancelCallbacks[n];delete this.cancelCallbacks[n],o&&o.cancel()}else if(r.mustQueue||e$()){const s=this.callbacks[n];this.cancelCallbacks[n]=this.scheduler.add(()=>this.processTask(n,r),s&&s.metadata||{type:"message"})}else this.processTask(n,r)}}processTask(i,r){if(""===r.type){const n=this.callbacks[i];delete this.callbacks[i],n&&(r.error?n(ne(r.error)):n(null,ne(r.data)))}else{const o=ew(this.globalScope)?void 0:[],s=r.hasCallback?(r,n)=>{delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:r?r7(r):null,data:r7(n,o)},o)}:i=>{},a=ne(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,a,s);else if(this.parent.getWorkerSource){const l=r.type.split(".");this.parent.getWorkerSource(r.sourceMapId,l[0],a.source)[l[1]](a,s)}else s(Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},i.CanonicalTileID=c6,i.Color=tF,i.ColorMode=hi,i.CullFaceMode=hr,i.DEMData=hm,i.DataConstantProperty=n5,i.DedupedRequest=ue,i.DepthMode=he,i.EXTENT=8192,i.Elevation=class{getAtPointOrZero(i,r=0){return this.getAtPoint(i,r)||0}getAtPoint(i,r,n=!0){null==r&&(r=null);const o=this._source();if(!o||i.y<0||i.y>1)return r;const s=o.getSource().maxzoom,a=1<{const o=this.getAtTileOffset(i,n.x,n.y),s=r.upVector(i.canonical,n.x,n.y);return A(s,s,o*r.upVectorScale(i.canonical)),s}}getForTilePoints(i,r,n,o){const s=hv.create(this,i,o);return!!s&&(r.forEach(i=>{i[2]=this.exaggeration()*s.getElevationAt(i[0],i[1],n)}),!0)}getMinMaxForTile(i){const r=this.findDEMTileFor(i);if(!r||!r.dem)return null;const n=r.dem.tree,o=r.tileID,s=1<Math.abs(o))return!1;const s=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1]+(i[2]-this.pos[2])*r[2])/o;return n[0]=this.pos[0]+this.dir[0]*s,n[1]=this.pos[1]+this.dir[1]*s,n[2]=this.pos[2]+this.dir[2]*s,!0}closestPointOnSphere(i,r,n){var o,s,a,l,c,h,u,d;if(o=this.pos,s=i,a=o[0],l=o[1],c=o[2],h=s[0],u=s[1],d=s[2],Math.abs(a-h)<=1e-6*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(l-u)<=1e-6*Math.max(1,Math.abs(l),Math.abs(u))&&Math.abs(c-d)<=1e-6*Math.max(1,Math.abs(c),Math.abs(d))||0===r)return n[0]=n[1]=n[2]=0,!1;const[p,f,m]=this.dir,$=this.pos[0]-i[0],g=this.pos[1]-i[1],y=this.pos[2]-i[2],x=p*p+f*f+m*m,v=2*($*p+g*f+y*m),b=v*v-4*x*($*$+g*g+y*y-r*r);if(b<0){const w=Math.max(-v/2,0),T=$+p*w,E=g+f*w,S=y+m*w,I=Math.hypot(T,E,S);return n[0]=T*r/I,n[1]=E*r/I,n[2]=S*r/I,!1}{const M=(-v-Math.sqrt(b))/(2*x);if(M<0){const A=Math.hypot($,g,y);return n[0]=$*r/A,n[1]=g*r/A,n[2]=y*r/A,!1}return n[0]=$+p*M,n[1]=g+f*M,n[2]=y+m*M,!0}}},i.RequestManager=class{constructor(i,r,n){this._transformRequestFn=i,this._customAccessToken=r,this._silenceAuthErrors=!!n,this._createSkuToken()}_createSkuToken(){const i=function(){let i="";for(let r=0;r<10;r++)i+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",i].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}normalizeStyleURL(i,r){if(!eR(i))return i;const n=eU(i);return n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!eR(i))return i;const n=eU(i);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||r)}normalizeSourceURL(i,r){if(!eR(i))return i;const n=eU(i);return n.path=`/v4/${n.authority}.json`,n.params.push("secure"),this._makeAPIURL(n,this._customAccessToken||r)}normalizeSpriteURL(i,r,n,o){const s=eU(i);return eR(i)?(s.path=`/styles/v1${s.path}/sprite${r}${n}`,this._makeAPIURL(s,this._customAccessToken||o)):(s.path+=`${r}${n}`,eV(s))}normalizeTileURL(i,r,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!eR(i))return i;const o=eU(i);o.path=o.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||n&&"raster"!==o.authority&&512===n?"@2x":""}${eC.supported?".webp":"$1"}`),"raster"===o.authority?o.path=`/${eI.RASTER_URL_PREFIX}${o.path}`:(o.path=o.path.replace(/^.+\/v4\//,"/"),o.path=`/${eI.TILE_URL_VERSION}${o.path}`);const s=this._customAccessToken||function(i){for(const r of i){const n=r.match(/^access_token=(.*)$/);if(n)return n[1]}return null}(o.params)||eI.ACCESS_TOKEN;return eI.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&o.params.push(`sku=${this._skuToken}`),this._makeAPIURL(o,s)}canonicalizeTileURL(i,r){const n=eU(i);if(!n.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!n.path.match(/\.[\w]+$/))return i;let o="mapbox://";n.path.match(/^\/raster\/v1\//)?o+=`raster/${n.path.replace(`/${eI.RASTER_URL_PREFIX}/`,"")}`:o+=`tiles/${n.path.replace(`/${eI.TILE_URL_VERSION}/`,"")}`;let s=n.params;return r&&(s=s.filter(i=>!i.match(/^access_token=/))),s.length&&(o+=`?${s.join("&")}`),o}canonicalizeTileset(i,r){const n=!!r&&eR(r),o=[];for(const s of i.tiles||[])eF(s)?o.push(this.canonicalizeTileURL(s,n)):o.push(s);return o}_makeAPIURL(i,r){const n="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",o=eU(eI.API_URL);if(i.protocol=o.protocol,i.authority=o.authority,"http"===i.protocol){const s=i.params.indexOf("secure");s>=0&&i.params.splice(s,1)}if("/"!==o.path&&(i.path=`${o.path}${i.path}`),!eI.REQUIRE_ACCESS_TOKEN)return eV(i);if(r=r||eI.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===r[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return i.params=i.params.filter(i=>-1===i.indexOf("access_token")),i.params.push(`access_token=${r||""}`),eV(i)}},i.ResourceType=e5,i.SegmentVector=sc,i.SourceCache=hg,i.StencilMode=ht,i.StructArrayLayout1ui2=oI,i.StructArrayLayout2f1f2i16=o$,i.StructArrayLayout2i4=os,i.StructArrayLayout2ui4=oS,i.StructArrayLayout3f12=oc,i.StructArrayLayout3ui6=oy,i.StructArrayLayout4i8=oa,i.Texture=cQ,i.Tile=hG,i.Transitionable=nJ,i.Uniform1f=oK,i.Uniform1i=class extends oH{constructor(i,r){super(i,r),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},i.Uniform2f=class extends oH{constructor(i,r){super(i,r),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},i.Uniform3f=class extends oH{constructor(i,r){super(i,r),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},i.Uniform4f=oY,i.UniformColor=oJ,i.UniformMatrix2f=class extends oH{constructor(i,r){super(i,r),this.current=o1}set(i){for(let r=0;r<4;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}},i.UniformMatrix3f=class extends oH{constructor(i,r){super(i,r),this.current=o0}set(i){for(let r=0;r<9;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},i.UniformMatrix4f=class extends oH{constructor(i,r){super(i,r),this.current=oQ}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let r=1;r<16;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},i.UnwrappedTileID=c8,i.ValidationError=td,i.VectorTileWorkerSource=class extends th{constructor(i,r,n,o,s){super(),this.actor=i,this.layerIndex=r,this.availableImages=n,this.loadVectorData=s||ut,this.loading={},this.loaded={},this.deduped=new ue(i.scheduler),this.isSpriteLoaded=o,this.scheduler=i.scheduler}loadTile(i,r){const n=i.uid,o=i&&i.request,s=o&&o.collectResourceTiming,a=this.loading[n]=new h9(i);a.abort=this.loadVectorData(i,(l,c)=>{const h=!this.loading[n];if(delete this.loading[n],h||l||!c)return a.status="done",h||(this.loaded[n]=a),r(l);const u=c.rawData,d={};c.expires&&(d.expires=c.expires),c.cacheControl&&(d.cacheControl=c.cacheControl),a.vectorTile=c.vectorTile||new aH.VectorTile(new lT(u));const p=()=>{a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,(i,n)=>{if(i||!n)return r(i);const a={};if(s){const l=c3(o);l.length>0&&(a.resourceTiming=JSON.parse(JSON.stringify(l)))}r(null,et({rawTileData:u.slice(0)},n,d,a))})};this.isSpriteLoaded?p():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(p,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):p()}),this.loaded=this.loaded||{},this.loaded[n]=a})}reloadTile(i,r){const n=this.loaded,o=i.uid,s=this;if(n&&n[o]){const a=n[o];a.showCollisionBoxes=i.showCollisionBoxes,a.enableTerrain=!!i.enableTerrain,a.projection=i.projection;const l=(i,n)=>{const o=a.reloadCallback;o&&(delete a.reloadCallback,a.parse(a.vectorTile,s.layerIndex,this.availableImages,s.actor,o)),r(i,n)};"parsing"===a.status?a.reloadCallback=l:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,l):l())}}abortTile(i,r){const n=i.uid,o=this.loading[n];o&&(o.abort&&o.abort(),delete this.loading[n]),r()}removeTile(i,r){const n=this.loaded,o=i.uid;n&&n[o]&&delete n[o],r()}},i.WritingMode=lq,i.ZoomHistory=nt,i.add=E,i.addDynamicAttributes=cD,i.adjoint=function(i,r){var n=r[0],o=r[1],s=r[2],a=r[3],l=r[4],c=r[5],h=r[6],u=r[7],d=r[8];return i[0]=l*d-c*u,i[1]=s*u-o*d,i[2]=o*c-s*l,i[3]=c*h-a*d,i[4]=n*d-s*h,i[5]=s*a-n*c,i[6]=a*u-l*h,i[7]=o*h-n*u,i[8]=n*l-o*a,i},i.asyncAll=Q,i.bezier=W,i.bindAll=ea,i.boundsAttributes=hN,i.bufferConvexPolygon=function(i,r){const n=[];for(let o=0;oe0&&(i.getActor().send("enforceCacheSizeLimit",eQ),e3=0)},i.calculateGlobeMatrix=h5,i.calculateGlobeMercatorMatrix=function(i){const r=i.worldSize,n=K(i.center.lat,-85.051129,85.051129),o=new l(sf(i.center.lng)*r,sm(n)*r),s=1/sp(i.center.lat)*r,a=i.pixelsPerMeter,c=r/(s/i.pixelsPerMeter),h=p(new Float64Array(16));return m(h,h,[o.x,o.y,0]),$(h,h,[c,c,a]),h},i.clamp=K,i.clearTileCache=function(i){const r=h.caches.delete(eK);i&&r.catch(i).then(()=>i())},i.clipLine=cn,i.clone=function(i){var r=new u(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r},i.clone$1=eu,i.collisionCircleLayout=ld,i.config=eI,i.conjugate=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},i.create=function(){var i=new u(16);return u!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},i.create$1=d,i.createExpression=ru,i.createLayout=on,i.createStyleLayer=function(i){return"custom"===i.type?new cZ(i):new cX[i.type](i)},i.cross=P,i.degToRad=Z,i.div=function(i,r,n){return i[0]=r[0]/n[0],i[1]=r[1]/n[1],i[2]=r[2]/n[2],i},i.dot=k,i.ease=H,i.easeCubicInOut=X,i.emitValidationErrors=rQ,i.endsWith=el,i.enforceCacheSizeLimit=function(i){e1(),eY&&eY.then(r=>{r.keys().then(n=>{for(let o=0;oa&&(o+=(i[s]-a)*(i[s]-a)),r[s]Math.abs(r.parallels[0]+r.parallels[1])){let n=function(i){const r=Math.max(.01,Math.cos(i*j)),n=1/(2*Math.max(Math.PI*r,1/r));return{wrap:!0,supportsWorldCopies:!0,unsupportedLayers:["custom",],project(i,o){const s=Math.sin(o*j)/r;return{x:i*j*r*n+.5,y:-s*n+.5,z:0}},unproject(i,o){const s=K((i-.5)/n*G/r,-180,180),a=Math.asin(K(-(o-.5)/n*r,-1,1)),l=K(a*G,-85.051129,85.051129);return new su(s,l)}}}(r.parallels[0]);if("lambertConformalConic"===r.name){const{project:o,unproject:s}=uc.mercator;n={wrap:!0,supportsWorldCopies:!0,project:o,unproject:s}}return et({},i,r,n)}return et({},i,r)}(r,i):r},i.getRTLTextPluginStatus=nq,i.getReferrer=e6,i.getTilePoint=function(i,{x:r,y:n},o=0){return new l(((r-o)*i.scale-i.x)*8192,(n*i.scale-i.y)*8192)},i.getTileVec3=function(i,r,n=0){return T(((r.x-n)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,sx(r.z,r.y))},i.getVideo=function(i,r){const n=h.document.createElement("video");n.muted=!0,n.onloadstart=function(){r(null,n)};for(let o=0;o0&&(l=1/Math.sqrt(l)),i[0]=n*l,i[1]=o*l,i[2]=s*l,i[3]=a*l,i},i.number=ix,i.ortho=function(i,r,n,o,s,a,l){var c=1/(r-n),h=1/(o-s),u=1/(a-l);return i[0]=-2*c,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*h,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*u,i[11]=0,i[12]=(r+n)*c,i[13]=(s+o)*h,i[14]=(l+a)*u,i[15]=1,i},i.pbf=lT,i.perspective=function(i,r,n,o,s){var a,l=1/Math.tan(r/2);return i[0]=l/n,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=l,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,null!=s&&s!==1/0?(i[10]=(s+o)*(a=1/(o-s)),i[14]=2*s*o*a):(i[10]=-1,i[14]=-2*o),i},i.pick=function(i,r){const n={};for(let o=0;othis._layers[i.id]),u=h[0];if("none"===u.visibility)continue;const d=u.source||"";let p=this.familiesBySource[d];p||(p=this.familiesBySource[d]={});const f=u.sourceLayer||"_geojsonTileLayer";let m=p[f];m||(m=p[f]=[]),m.push(h)}}}const{ImageBitmap:s}=i.window;class a{loadTile(r,n){const{uid:o,encoding:a,rawImageData:l,padding:c,buildQuadTree:h}=r,u=s&&l instanceof s?this.getImageData(l,c):l;n(null,new i.DEMData(o,u,a,c<1,h))}getImageData(r,n){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(r.width,r.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=r.width,this.offscreenCanvas.height=r.height,this.offscreenCanvasContext.drawImage(r,0,0,r.width,r.height);const o=this.offscreenCanvasContext.getImageData(-n,-n,r.width+2*n,r.height+2*n);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new i.RGBAImage({width:o.width,height:o.height},o.data)}}var l,c=function i(r,n){var o,s=r&&r.type;if("FeatureCollection"===s)for(o=0;o=Math.abs(c)?n-h+c:c-h+n,n=h}n+o>=0!=!!r&&i.reverse()}const d=i.vectorTile.VectorTileFeature.prototype.toGeoJSON;class p{constructor(r){this._feature=r,this.extent=i.EXTENT,this.type=r.type,this.properties=r.tags,"id"in r&&!isNaN(r.id)&&(this.id=parseInt(r.id,10))}loadGeometry(){if(1===this._feature.type){const r=[];for(const n of this._feature.geometry)r.push([new i.pointGeometry(n[0],n[1]),]);return r}{const o=[];for(const s of this._feature.geometry){const a=[];for(const l of s)a.push(new i.pointGeometry(l[0],l[1]));o.push(a)}return o}}toGeoJSON(i,r,n){return d.call(this,i,r,n)}}class f{constructor(r){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=r.length,this._features=r}feature(i){return new p(this._features[i])}}var m=i.vectorTile.VectorTileFeature,$=g;function g(i,r){this.options=r||{},this.features=i,this.length=i.length}function y(i,r){this.id="number"==typeof i.id?i.id:void 0,this.type=i.type,this.rawGeometry=1===i.type?[i.geometry]:i.geometry,this.properties=i.tags,this.extent=r||4096}g.prototype.feature=function(i){return new y(this.features[i],this.options.extent)},y.prototype.loadGeometry=function(){var r=this.rawGeometry;this.geometry=[];for(var n=0;n>31}function I(i,r){for(var n=i.loadGeometry(),o=i.type,s=0,a=0,l=n.length,c=0;ci[0],P=i=>i[1];class D{constructor(i,r=k,n=P,o=64,s=Float64Array){this.nodeSize=o,this.points=i;const a=i.length<65536?Uint16Array:Uint32Array,l=this.ids=new a(i.length),c=this.coords=new s(2*i.length);for(let h=0;h>1;(function i(r,n,o,s,a,l){for(;a>s;){if(a-s>600){const c=a-s+1,h=o-s+1,u=Math.log(c),d=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*d*(c-d)/c)*(h-c/2<0?-1:1);i(r,n,o,Math.max(s,Math.floor(o-h*d/c+p)),Math.min(a,Math.floor(o+(c-h)*d/c+p)),l)}const f=n[2*o+l];let m=s,$=a;for(A(r,n,s,o),n[2*a+l]>f&&A(r,n,s,a);m<$;){for(A(r,n,m,$),m++,$--;n[2*m+l]f;)$--}n[2*s+l]===f?A(r,n,s,$):A(r,n,++$,a),$<=o&&(s=$+1),o<=$&&(a=$-1)}})(r,n,c,s,a,l%2),i(r,n,o,s,c-1,l+1),i(r,n,o,c+1,a,l+1)}(l,c,o,0,l.length-1,0)}range(i,r,n,o){return function(i,r,n,o,s,a,l){const c=[0,i.length-1,0],h=[];let u,d;for(;c.length;){const p=c.pop(),f=c.pop(),m=c.pop();if(f-m<=l){for(let $=m;$<=f;$++)u=r[2*$],d=r[2*$+1],u>=n&&u<=s&&d>=o&&d<=a&&h.push(i[$]);continue}const g=Math.floor((m+f)/2);u=r[2*g],d=r[2*g+1],u>=n&&u<=s&&d>=o&&d<=a&&h.push(i[g]);const y=(p+1)%2;(0===p?n<=u:o<=d)&&(c.push(m),c.push(g-1),c.push(y)),(0===p?s>=u:a>=d)&&(c.push(g+1),c.push(f),c.push(y))}return h}(this.ids,this.coords,i,r,n,o,this.nodeSize)}within(i,r,n){return function(i,r,n,o,s,a){const l=[0,i.length-1,0],c=[],h=s*s;for(;l.length;){const u=l.pop(),d=l.pop(),p=l.pop();if(d-p<=a){for(let f=p;f<=d;f++)z(r[2*f],r[2*f+1],n,o)<=h&&c.push(i[f]);continue}const m=Math.floor((p+d)/2),$=r[2*m],g=r[2*m+1];z($,g,n,o)<=h&&c.push(i[m]);const y=(u+1)%2;(0===u?n-s<=$:o-s<=g)&&(l.push(p),l.push(m-1),l.push(y)),(0===u?n+s>=$:o+s>=g)&&(l.push(m+1),l.push(d),l.push(y))}return c}(this.ids,this.coords,i,r,n,this.nodeSize)}}const L={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:i=>i},B=Math.fround||(l=new Float32Array(1),i=>(l[0]=+i,l[0]));class R{constructor(i){this.options=G(Object.create(L),i),this.trees=Array(this.options.maxZoom+1)}load(i){const{log:r,minZoom:n,maxZoom:o,nodeSize:s}=this.options;r&&console.time("total time");const a=`prepare ${i.length} points`;r&&console.time(a),this.points=i;let l=[];for(let c=0;c=n;h--){const u=+Date.now();l=this._cluster(l,h),this.trees[h]=new D(l,Z,_,s,Float32Array),r&&console.log("z%d: %d clusters in %dms",h,l.length,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(i,r){let n=((i[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,i[1]));let s=180===i[2]?180:((i[2]+180)%360+360)%360-180;const a=Math.max(-90,Math.min(90,i[3]));if(i[2]-i[0]>=360)n=-180,s=180;else if(n>s){const l=this.getClusters([n,o,180,a],r),c=this.getClusters([-180,o,s,a],r);return l.concat(c)}const h=this.trees[this._limitZoom(r)],u=h.range(N(n),j(a),N(s),j(o)),d=[];for(const p of u){const f=h.points[p];d.push(f.numPoints?U(f):this.points[f.index])}return d}getChildren(i){const r=this._getOriginId(i),n=this._getOriginZoom(i),o="No cluster with the specified id.",s=this.trees[n];if(!s)throw Error(o);const a=s.points[r];if(!a)throw Error(o);const l=this.options.radius/(this.options.extent*Math.pow(2,n-1)),c=s.within(a.x,a.y,l),h=[];for(const u of c){const d=s.points[u];d.parentId===i&&h.push(d.numPoints?U(d):this.points[d.index])}if(0===h.length)throw Error(o);return h}getLeaves(i,r,n){const o=[];return this._appendLeaves(o,i,r=r||10,n=n||0,0),o}getTile(i,r,n){const o=this.trees[this._limitZoom(i)],s=Math.pow(2,i),{extent:a,radius:l}=this.options,c=l/a,h=(n-c)/s,u=(n+1+c)/s,d={features:[]};return this._addTileFeatures(o.range((r-c)/s,h,(r+1+c)/s,u),o.points,r,n,s,d),0===r&&this._addTileFeatures(o.range(1-c/s,h,1,u),o.points,s,n,s,d),r===s-1&&this._addTileFeatures(o.range(0,h,c/s,u),o.points,-1,n,s,d),d.features.length?d:null}getClusterExpansionZoom(i){let r=this._getOriginZoom(i)-1;for(;r<=this.options.maxZoom;){const n=this.getChildren(i);if(r++,1!==n.length)break;i=n[0].properties.cluster_id}return r}_appendLeaves(i,r,n,o,s){const a=this.getChildren(r);for(const l of a){const c=l.properties;if(c&&c.cluster?s+c.point_count<=o?s+=c.point_count:s=this._appendLeaves(i,c.cluster_id,n,o,s):sr&&(m+=g.numPoints||1)}if(m>f&&m>=l){let y=u.x*f,x=u.y*f,v=a&&f>1?this._map(u,!0):null;const b=(h<<5)+(r+1)+this.points.length;for(const w of p){const T=d.points[w];if(T.zoom<=r)continue;T.zoom=r;const E=T.numPoints||1;y+=T.x*E,x+=T.y*E,T.parentId=b,a&&(v||(v=this._map(u,!0)),a(v,this._map(T)))}u.parentId=b,n.push(F(y/m,x/m,b,m,v))}else if(n.push(u),m>1)for(const S of p){const I=d.points[S];I.zoom<=r||(I.zoom=r,n.push(I))}}return n}_getOriginId(i){return i-this.points.length>>5}_getOriginZoom(i){return(i-this.points.length)%32}_map(i,r){if(i.numPoints)return r?G({},i.properties):i.properties;const n=this.points[i.index].properties,o=this.options.map(n);return r&&o===n?G({},o):o}}function F(i,r,n,o,s){return{x:B(i),y:B(r),zoom:1/0,id:n,parentId:-1,numPoints:o,properties:s}}function O(i,r){const[n,o]=i.geometry.coordinates;return{x:B(N(n)),y:B(j(o)),zoom:1/0,index:r,parentId:-1}}function U(i){return{type:"Feature",id:i.id,properties:V(i),geometry:{type:"Point",coordinates:[360*(i.x-.5),function(i){const r=(180-360*i)*Math.PI/180;return 360*Math.atan(Math.exp(r))/Math.PI-90}(i.y),]}}}function V(i){const r=i.numPoints,n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r;return G(G({},i.properties),{cluster:!0,cluster_id:i.id,point_count:r,point_count_abbreviated:n})}function N(i){return i/360+.5}function j(i){const r=Math.sin(i*Math.PI/180),n=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return n<0?0:n>1?1:n}function G(i,r){for(const n in r)i[n]=r[n];return i}function Z(i){return i.x}function _(i){return i.y}function q(i,r,n,o,s,a){var l=s-n,c=a-o;if(0!==l||0!==c){var h=((i-n)*l+(r-o)*c)/(l*l+c*c);h>1?(n=s,o=a):h>0&&(n+=l*h,o+=c*h)}return(l=i-n)*l+(c=r-o)*c}function X(i,r,n,o){var s={id:void 0===i?null:i,type:r,geometry:n,tags:o,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(i){var r=i.geometry,n=i.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)W(i,r);else if("Polygon"===n||"MultiLineString"===n)for(var o=0;o0&&(l+=o?(s*u-h*a)/2:Math.sqrt(Math.pow(h-s,2)+Math.pow(u-a,2))),s=h,a=u}var d=r.length-3;r[2]=1,function i(r,n,o,s){for(var a,l=s,c=o-n>>1,h=o-n,u=r[n],d=r[n+1],p=r[o],f=r[o+1],m=n+3;ml)a=m,l=$;else if($===l){var g=Math.abs(m-c);gs&&(a-n>3&&i(r,n,a,s),r[a+2]=l,o-a>3&&i(r,a,o,s))}(r,0,d,n),r[d+2]=1,r.size=Math.abs(l),r.start=0,r.end=r.size}function J(i,r,n,o){for(var s=0;s1?1:n}function et(i,r,n,o,s,a,l,c){if(o/=r,a>=(n/=r)&&l=o)return null;for(var h=[],u=0;u=n&&$=o)){var g=[];if("Point"===f||"MultiPoint"===f)ei(p,g,n,o,s);else if("LineString"===f)er(p,g,n,o,s,!1,c.lineMetrics);else if("MultiLineString"===f)eo(p,g,n,o,s,!1);else if("Polygon"===f)eo(p,g,n,o,s,!0);else if("MultiPolygon"===f)for(var y=0;y=n&&l<=o&&(r.push(i[a]),r.push(i[a+1]),r.push(i[a+2]))}}function er(i,r,n,o,s,a,l){for(var c,h,u=en(i),d=0===s?ea:el,p=i.start,f=0;fn&&(h=d(u,m,$,y,x,n),l&&(u.start=p+c*h)):v>o?b=n&&(h=d(u,m,$,y,x,n),w=!0),b>o&&v<=o&&(h=d(u,m,$,y,x,o),w=!0),!a&&w&&(l&&(u.end=p+c*h),r.push(u),u=en(i)),l&&(p+=c)}var T=i.length-3;m=i[T],$=i[T+1],g=i[T+2],(v=0===s?m:$)>=n&&v<=o&&es(u,m,$,g),T=u.length-3,a&&T>=3&&(u[T]!==u[0]||u[T+1]!==u[1])&&es(u,u[0],u[1],u[2]),u.length&&r.push(u)}function en(i){var r=[];return r.size=i.size,r.start=i.start,r.end=i.end,r}function eo(i,r,n,o,s,a){for(var l=0;ll.maxX&&(l.maxX=d),p>l.maxY&&(l.maxY=p)}return l}function ef(i,r,n,o){var s=r.geometry,a=r.type,l=[];if("Point"===a||"MultiPoint"===a)for(var c=0;c0&&r.size<(s?l:o))n.numPoints+=r.length/3;else{for(var c=[],h=0;hl)&&(n.numSimplified++,c.push(r[h]),c.push(r[h+1])),n.numPoints++;s&&function(i,r){for(var n=0,o=0,s=i.length,a=s-2;o0===r)for(o=0,s=i.length;o24)throw Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw Error("promoteId and generateId cannot be used together.");var o,s,a,l,c,h,u=function(i,r){var n=[];if("FeatureCollection"===i.type)for(var o=0;o1&&console.time("creation"),f=this.tiles[p]=ep(i,r,n,o,h),this.tileCoords.push({z:r,x:n,y:o}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,o,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var m="z"+r;this.stats[m]=(this.stats[m]||0)+1,this.total++}if(f.source=i,s){if(r===h.maxZoom||r===s)continue;var $=1<1&&console.time("clipping");var g,y,x,v,b,w,T=.5*h.buffer/h.extent,E=.5-T,S=.5+T,I=1+T;g=y=x=v=null,b=et(i,d,n-T,n+S,0,f.minX,f.maxX,h),w=et(i,d,n+E,n+I,0,f.minX,f.maxX,h),i=null,b&&(g=et(b,d,o-T,o+S,1,f.minY,f.maxY,h),y=et(b,d,o+E,o+I,1,f.minY,f.maxY,h),b=null),w&&(x=et(w,d,o-T,o+S,1,f.minY,f.maxY,h),v=et(w,d,o+E,o+I,1,f.minY,f.maxY,h),w=null),u>1&&console.timeEnd("clipping"),c.push(g||[],r+1,2*n,2*o),c.push(y||[],r+1,2*n,2*o+1),c.push(x||[],r+1,2*n+1,2*o),c.push(v||[],r+1,2*n+1,2*o+1)}}},e$.prototype.getTile=function(i,r,n){var o=this.options,s=o.extent,a=o.debug;if(i<0||i>24)return null;var l=1<1&&console.log("drilling down to z%d-%d-%d",i,r,n);for(var h,u=i,d=r,p=n;!h&&u>0;)u--,d=Math.floor(d/2),p=Math.floor(p/2),h=this.tiles[eg(u,d,p)];return h&&h.source?(a>1&&console.log("found parent tile z%d-%d-%d",u,d,p),a>1&&console.time("drilling down"),this.splitTile(h.source,u,d,p,i,r,n),a>1&&console.timeEnd("drilling down"),this.tiles[c]?eu(this.tiles[c],s):null):null};class ex extends i.VectorTileWorkerSource{constructor(i,r,n,o,s){super(i,r,n,o,ey),s&&(this.loadGeoJSON=s)}loadData(r,n){const o=r&&r.request,s=o&&o.collectResourceTiming;this.loadGeoJSON(r,(a,l)=>{if(a||!l)return n(a);if("object"!=typeof l)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{c(l,!0);try{var h,u;if(r.filter){const d=i.createExpression(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===d.result)throw Error(d.value.map(i=>`${i.key}: ${i.message}`).join(", "));const p=l.features.filter(i=>d.value.evaluate({zoom:0},i));l={type:"FeatureCollection",features:p}}this._geoJSONIndex=r.cluster?new R(function({superclusterOptions:r,clusterProperties:n}){if(!n||!r)return r;const o={},s={},a={accumulated:null,zoom:0},l={properties:null},c=Object.keys(n);for(const h of c){const[u,d]=n[h],p=i.createExpression(d),f=i.createExpression("string"==typeof u?[u,["accumulated",],["get",h,],]:u);o[h]=p.value,s[h]=f.value}return r.map=i=>{l.properties=i;const r={};for(const n of c)r[n]=o[n].evaluate(a,l);return r},r.reduce=(i,r)=>{for(const n of(l.properties=r,c))a.accumulated=i[n],i[n]=s[n].evaluate(a,l)},r}(r)).load(l.features):(h=l,u=r.geojsonVtOptions,new e$(h,u))}catch(f){return n(f)}this.loaded={};const m={};if(s){const $=i.getPerformanceMeasurement(o);$&&(m.resourceTiming={},m.resourceTiming[r.source]=JSON.parse(JSON.stringify($)))}n(null,m)}})}reloadTile(i,r){const n=this.loaded;return n&&n[i.uid]?super.reloadTile(i,r):this.loadTile(i,r)}loadGeoJSON(r,n){if(r.request)i.getJSON(r.request,n);else{if("string"!=typeof r.data)return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));try{return n(null,JSON.parse(r.data))}catch(o){return n(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(i,r){try{r(null,this._geoJSONIndex.getClusterExpansionZoom(i.clusterId))}catch(n){r(n)}}getClusterChildren(i,r){try{r(null,this._geoJSONIndex.getChildren(i.clusterId))}catch(n){r(n)}}getClusterLeaves(i,r){try{r(null,this._geoJSONIndex.getLeaves(i.clusterId,i.limit,i.offset))}catch(n){r(n)}}}class ev{constructor(r){this.self=r,this.actor=new i.Actor(r,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=i.getProjection({name:"mercator"}),this.workerSourceTypes={vector:i.VectorTileWorkerSource,geojson:ex},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(i,r)=>{if(this.workerSourceTypes[i])throw Error(`Worker source with name "${i}" already registered.`);this.workerSourceTypes[i]=r},this.self.registerRTLTextPlugin=r=>{if(i.plugin.isParsed())throw Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=r.applyArabicShaping,i.plugin.processBidirectionalText=r.processBidirectionalText,i.plugin.processStyledBidirectionalText=r.processStyledBidirectionalText}}clearCaches(i,r,n){delete this.layerIndexes[i],delete this.availableImages[i],delete this.workerSources[i],delete this.demWorkerSources[i],n()}checkIfReady(i,r,n){n()}setReferrer(i,r){this.referrer=r}spriteLoaded(r,n){for(const o in this.isSpriteLoaded[r]=n,this.workerSources[r]){const s=this.workerSources[r][o];for(const a in s)s[a]instanceof i.VectorTileWorkerSource&&(s[a].isSpriteLoaded=n,s[a].fire(new i.Event("isSpriteLoaded")))}}setImages(i,r,n){for(const o in this.availableImages[i]=r,this.workerSources[i]){const s=this.workerSources[i][o];for(const a in s)s[a].availableImages=r}n()}enableTerrain(i,r,n){this.terrain=r,n()}setProjection(r,n){this.projections[r]=i.getProjection(n)}setLayers(i,r,n){this.getLayerIndex(i).replace(r),n()}updateLayers(i,r,n){this.getLayerIndex(i).update(r.layers,r.removedIds),n()}loadTile(r,n,o){const s=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;s.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).loadTile(s,o)}loadDEMTile(r,n,o){const s=this.enableTerrain?i.extend({buildQuadTree:this.terrain},n):n;this.getDEMWorkerSource(r,n.source).loadTile(s,o)}reloadTile(r,n,o){const s=this.enableTerrain?i.extend({enableTerrain:this.terrain},n):n;s.projection=this.projections[r]||this.defaultProjection,this.getWorkerSource(r,n.type,n.source).reloadTile(s,o)}abortTile(i,r,n){this.getWorkerSource(i,r.type,r.source).abortTile(r,n)}removeTile(i,r,n){this.getWorkerSource(i,r.type,r.source).removeTile(r,n)}removeSource(i,r,n){if(!this.workerSources[i]||!this.workerSources[i][r.type]||!this.workerSources[i][r.type][r.source])return;const o=this.workerSources[i][r.type][r.source];delete this.workerSources[i][r.type][r.source],void 0!==o.removeSource?o.removeSource(r,n):n()}loadWorkerSource(i,r,n){try{this.self.importScripts(r.url),n()}catch(o){n(o.toString())}}syncRTLPluginState(r,n,o){try{i.plugin.setState(n);const s=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&null!=s){this.self.importScripts(s);const a=i.plugin.isParsed();o(a?void 0:Error(`RTL Text Plugin failed to import scripts from ${s}`),a)}}catch(l){o(l.toString())}}getAvailableImages(i){let r=this.availableImages[i];return r||(r=[]),r}getLayerIndex(i){let r=this.layerIndexes[i];return r||(r=this.layerIndexes[i]=new o),r}getWorkerSource(i,r,n){return this.workerSources[i]||(this.workerSources[i]={}),this.workerSources[i][r]||(this.workerSources[i][r]={}),this.workerSources[i][r][n]||(this.workerSources[i][r][n]=new this.workerSourceTypes[r]({send:(r,n,o,s,a,l)=>{this.actor.send(r,n,o,i,a,l)},scheduler:this.actor.scheduler},this.getLayerIndex(i),this.getAvailableImages(i),this.isSpriteLoaded[i])),this.workerSources[i][r][n]}getDEMWorkerSource(i,r){return this.demWorkerSources[i]||(this.demWorkerSources[i]={}),this.demWorkerSources[i][r]||(this.demWorkerSources[i][r]=new a),this.demWorkerSources[i][r]}enforceCacheSizeLimit(r,n){i.enforceCacheSizeLimit(n)}getWorkerPerformanceMetrics(i,r,n){n(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new ev(self)),ev}),o(["./shared"],function(i){var r=n;function n(i){var r,s;return r=i,"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 i,r,n=new Blob([""],{type:"text/javascript"}),o=URL.createObjectURL(n);try{r=new Worker(o),i=!0}catch(s){i=!1}return r&&r.terminate(),URL.revokeObjectURL(o),i}()&&"Uint8ClampedArray"in window&&!!ArrayBuffer.isView&&!!function(){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");if(!r)return!1;var n=r.getImageData(0,0,1,1);return n&&n.width===i.width}()&&(void 0===o[s=r&&r.failIfMajorPerformanceCaveat]&&(o[s]=function(i){var r,o,s,a,l=(r=i,o=document.createElement("canvas"),(s=Object.create(n.webGLContextAttributes)).failIfMajorPerformanceCaveat=r,o.getContext("webgl",s)||o.getContext("experimental-webgl",s));if(!l)return!1;try{a=l.createShader(l.VERTEX_SHADER)}catch(c){return!1}return!(!a||l.isContextLost())&&(l.shaderSource(a,"void main() {}"),l.compileShader(a),!0===l.getShaderParameter(a,l.COMPILE_STATUS))}(s)),!!o[s]&&!document.documentMode)}var o={};function s(i,r){var n=r[0],o=r[1],s=r[2],a=r[3],l=n*a-s*o;return l?(i[0]=a*(l=1/l),i[1]=-o*l,i[2]=-s*l,i[3]=n*l,i):null}function a(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let n=0;n{i.window.removeEventListener("click",d,!0)},0)},l.mousePos=function(i,r){const n=i.getBoundingClientRect();return p(i,n,r)},l.touchPos=function(i,r){const n=i.getBoundingClientRect(),o=[];for(let s=0;s=0?0:r.button};class m extends i.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(i){if(this.loaded!==i&&(this.loaded=i,i)){for(const{ids:r,callback:n}of this.requestors)this._notify(r,n);this.requestors=[]}}getImage(i){return this.images[i]}addImage(i,r){this._validate(i,r)&&(this.images[i]=r)}_validate(r,n){let o=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchX" value`))),o=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "stretchY" value`))),o=!1),this._validateContent(n.content,n)||(this.fire(new i.ErrorEvent(Error(`Image "${r}" has invalid "content" value`))),o=!1),o}_validateStretch(i,r){if(!i)return!0;let n=0;for(const o of i){if(o[0]{this.ready=!0})}broadcast(r,n,o){i.asyncAll(this.actors,(i,o)=>{i.send(r,n,o)},o=o||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(i=>{i.remove()}),this.actors=[],this.workerPool.release(this.id)}}function A(r,n,o){return n*(i.EXTENT/(r.tileSize*Math.pow(2,o-r.tileID.overscaledZ)))}M.Actor=i.Actor;class C{constructor(i,r,n){this.context=i;const o=i.gl;this.buffer=o.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete r.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const z={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class k{constructor(i,r,n,o){this.length=r.length,this.attributes=n,this.itemSize=r.bytesPerElement,this.dynamicDraw=o,this.context=i;const s=i.gl;this.buffer=s.createBuffer(),i.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||delete r.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){const r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,r){for(let n=0;no.pointCoordinate3D(i)),this.cameraGeometry=this.bufferedCameraGeometry(0)}static createFromScreenPoints(r,n){let o,s;if(r instanceof i.pointGeometry||"number"==typeof r[0]){const a=i.pointGeometry.convert(r);o=[i.pointGeometry.convert(r)],s=n.isPointAboveHorizon(a)}else{const l=i.pointGeometry.convert(r[0]),c=i.pointGeometry.convert(r[1]);o=[l,c],s=i.polygonizeBounds(l,c).every(i=>n.isPointAboveHorizon(i))}return new e$(o,n.getCameraPoint(),s,n)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(r){return i.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const n=this.screenBounds[0],o=1===this.screenBounds.length?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],s=i.polygonizeBounds(n,o,0,!1);return this.cameraPoint.y>o.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x=o.x?s[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(s[3]=this.cameraPoint)),i.bufferConvexPolygon(s,r)}containsTile(r,n,o){var s;const a=r.queryPadding+1,l=r.tileID.wrap,c=o?this._bufferedCameraMercator(a,n).map(n=>i.getTilePoint(r.tileTransform,n,l)):this._bufferedScreenMercator(a,n).map(n=>i.getTilePoint(r.tileTransform,n,l)),h=this.screenGeometryMercator.map(n=>i.getTileVec3(r.tileTransform,n,l)),u=h.map(r=>new i.pointGeometry(r[0],r[1])),d=n.getFreeCameraOptions().position||new i.MercatorCoordinate(0,0,0),p=i.getTileVec3(r.tileTransform,d,l),f=h.map(r=>{const n=i.sub(r,r,p);return i.normalize(n,n),new i.Ray(p,n)}),m=A(r,1,n.zoom);if(i.polygonIntersectsBox(c,0,0,i.EXTENT,i.EXTENT))return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:f,bufferedTilespaceGeometry:c,bufferedTilespaceBounds:((s=i.getBounds(c)).min.x=i.clamp(s.min.x,0,i.EXTENT),s.min.y=i.clamp(s.min.y,0,i.EXTENT),s.max.x=i.clamp(s.max.x,0,i.EXTENT),s.max.y=i.clamp(s.max.y,0,i.EXTENT),s),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:m}}_bufferedScreenMercator(i,r){const n=eg(i);if(this._screenRaycastCache[n])return this._screenRaycastCache[n];{const o=this.bufferedScreenGeometry(i).map(i=>r.pointCoordinate3D(i));return this._screenRaycastCache[n]=o,o}}_bufferedCameraMercator(i,r){const n=eg(i);if(this._cameraRaycastCache[n])return this._cameraRaycastCache[n];{const o=this.bufferedCameraGeometry(i).map(i=>r.pointCoordinate3D(i));return this._cameraRaycastCache[n]=o,o}}}function eg(i){return 100*i|0}function ey(r,n,o){const s=function(s,a){if(s)return o(s);if(a){const l=i.pick(i.extend(a,r),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding",]);a.vector_layers&&(l.vectorLayers=a.vector_layers,l.vectorLayerIds=l.vectorLayers.map(i=>i.id)),l.tiles=n.canonicalizeTileset(l,r.url),o(null,l)}};return r.url?i.getJSON(n.transformRequest(n.normalizeSourceURL(r.url),i.ResourceType.Source),s):i.exported.frame(()=>s(null,r))}class ex{constructor(r,n,o){this.bounds=i.LngLatBounds.convert(this.validateBounds(r)),this.minzoom=n||0,this.maxzoom=o||24}validateBounds(i){return Array.isArray(i)&&4===i.length?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3]),]:[-180,-90,180,90]}contains(r){const n=Math.pow(2,r.z),o=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*n),s=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*n),a=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*n),l=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*n);return r.x>=o&&r.x=s&&r.y{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(i.extend(this,n),n.bounds&&(this.tileBounds=new ex(n.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(n.tiles),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(r,n){const o=i.exported.devicePixelRatio>=2,s=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),o,this.tileSize);r.request=i.getImage(this.map._requestManager.transformRequest(s,i.ResourceType.Tile),(o,s,a,l)=>{if(delete r.request,r.aborted)r.state="unloaded",n(null);else if(o)r.state="errored",n(o);else if(s){this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:a,expires:l});const c=this.map.painter.context,h=c.gl;r.texture=this.map.painter.getTileTexture(s.width),r.texture?r.texture.update(s,{useMipmap:!0}):(r.texture=new i.Texture(c,s,h.RGBA,{useMipmap:!0}),r.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE),c.extTextureFilterAnisotropic&&h.texParameterf(h.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax)),r.state="loaded",i.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(i,r){i.request&&(i.request.cancel(),delete i.request),r()}unloadTile(i,r){i.texture&&this.map.painter.saveTileTexture(i.texture),r()}hasTransition(){return!1}}let eb;function ew(r,n,o,s,a,l,c,h){const u=[r,o,a,n,s,l,1,1,1],d=[c,h,1],p=i.adjoint([],u),[f,m,$]=i.transformMat3(d,d,i.transpose(p,p));return i.multiply(u,[f,0,0,0,m,0,0,0,$],u)}class eT extends i.Evented{constructor(i,r,n,o){super(),this.id=i,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=r}load(r,n){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),(o,s)=>{this._loaded=!0,o?this.fire(new i.ErrorEvent(o)):s&&(this.image=i.exported.getImageData(s),this.width=this.image.width,this.height=this.image.height,r&&(this.coordinates=r),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(i){return this.image&&i.url&&(this.options.url=i.url,this.load(i.coordinates,()=>{this.texture=null})),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}setCoordinates(r){this.coordinates=r,delete this._boundsArray;const n=r.map(i.MercatorCoordinate.fromLngLat);return this.tileID=function(r){let n=1/0,o=1/0,s=-1/0,a=-1/0;for(const l of r)n=Math.min(n,l.x),o=Math.min(o,l.y),s=Math.max(s,l.x),a=Math.max(a,l.y);const c=Math.max(s-n,a-o),h=Math.max(0,Math.floor(-Math.log(c)/Math.LN2)),u=Math.pow(2,h);return new i.CanonicalTileID(h,Math.floor((n+s)/2*u),Math.floor((o+a)/2*u))}(n),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){delete this._boundsArray}_makeBoundsArray(){const r=i.tileTransform(this.tileID,this.map.transform.projection),[n,o,s,a]=this.coordinates.map(n=>{const o=r.projection.project(n[0],n[1]);return i.getTilePoint(r,o)._round()});return this.perspectiveTransform=function(r,n,o,s,a,l,c,h,u,d){const p=ew(0,0,r,0,0,n,r,n),f=ew(o,s,a,l,c,h,u,d);return i.multiply(f,i.adjoint(p,p),f),[f[6]/f[8]*r/i.EXTENT,f[7]/f[8]*n/i.EXTENT,]}(this.width,this.height,n.x,n.y,o.x,o.y,a.x,a.y,s.x,s.y),this._boundsArray=new i.StructArrayLayout4i8,this._boundsArray.emplaceBack(n.x,n.y,0,0),this._boundsArray.emplaceBack(o.x,o.y,i.EXTENT,0),this._boundsArray.emplaceBack(a.x,a.y,0,i.EXTENT),this._boundsArray.emplaceBack(s.x,s.y,i.EXTENT,i.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const r=this.map.painter.context,n=r.gl;for(const o in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new i.Texture(r,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this.tiles){const s=this.tiles[o];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture)}}loadTile(i,r){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={},r(null)):(i.state="errored",r(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const eE={vector:class extends i.Evented{constructor(r,n,o,s){if(super(),this.id=r,this.dispatcher=o,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(n,["url","scheme","tileSize","promoteId",])),this._options=i.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(s),this._tileWorkers={},this._deduped=new i.DedupedRequest}load(){this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ey(this._options,this.map._requestManager,(r,n)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(i.extend(this,n),n.bounds&&(this.tileBounds=new ex(n.bounds,this.minzoom,this.maxzoom)),i.postTurnstileEvent(n.tiles,this.map._requestManager._customAccessToken),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}setSourceProperty(i){this._tileJSONRequest&&this._tileJSONRequest.cancel(),i();const r=this.map.style._getSourceCaches(this.id);for(const n of r)n.clearTiles();this.load()}setTiles(i){return this.setSourceProperty(()=>{this._options.tiles=i}),this}setUrl(i){return this.setSourceProperty(()=>{this.url=i,this._options.url=i}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return i.extend({},this._options)}loadTile(r,n){const o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),s={request:this.map._requestManager.transformRequest(o,i.ResourceType.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile};if(s.request.collectResourceTiming=this._collectResourceTiming,r.actor&&"expired"!==r.state)"loading"===r.state?r.reloadCallback=n:r.request=r.actor.send("reloadTile",s,l.bind(this));else if(r.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",s,l.bind(this),void 0,!0);else{const a=i.loadVectorTile.call({deduped:this._deduped},s,(i,n)=>{i||!n?l.call(this,i):(s.data={cacheControl:n.cacheControl,expires:n.expires,rawData:n.rawData.slice(0)},r.actor&&r.actor.send("loadTile",s,l.bind(this),void 0,!0))},!0);r.request={cancel:a}}function l(o,s){return delete r.request,r.aborted?n(null):o&&404!==o.status?n(o):(s&&s.resourceTiming&&(r.resourceTiming=s.resourceTiming),this.map._refreshExpiredTiles&&s&&r.setExpiryData(s),r.loadVectorData(s,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.type,source:this.id})}unloadTile(i){i.unloadVectorData(),i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}},raster:ev,"raster-dem":class extends ev{constructor(r,n,o,s){super(r,n,o,s),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}loadTile(r,n){const o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function s(i,o){i&&(r.state="errored",n(i)),o&&(r.dem=o,r.dem.onDeserialize(),r.needsHillshadePrepare=!0,r.needsDEMTextureUpload=!0,r.state="loaded",n(null))}r.request=i.getImage(this.map._requestManager.transformRequest(o,i.ResourceType.Tile),(function(o,a,l,c){if(delete r.request,r.aborted)r.state="unloaded",n(null);else if(o)r.state="errored",n(o);else if(a){this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:l,expires:c});const h=i.window.ImageBitmap&&a instanceof i.window.ImageBitmap&&(null==eb&&(eb=i.window.OffscreenCanvas&&new i.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof i.window.createImageBitmap),eb),u=1-(a.width-i.prevPowerOfTwo(a.width))/2;u<1||r.neighboringTiles||(r.neighboringTiles=this._getNeighboringTiles(r.tileID));const d=h?a:i.exported.getImageData(a,u),p={uid:r.uid,coord:r.tileID,source:this.id,rawImageData:d,encoding:this.encoding,padding:u};r.actor&&"expired"!==r.state||(r.actor=this.dispatcher.getActor(),r.actor.send("loadDEMTile",p,s.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(r){const n=r.canonical,o=Math.pow(2,n.z),s=(n.x-1+o)%o,a=0===n.x?r.wrap-1:r.wrap,l=(n.x+1+o)%o,c=n.x+1===o?r.wrap+1:r.wrap,h={};return h[new i.OverscaledTileID(r.overscaledZ,a,n.z,s,n.y).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,c,n.z,l,n.y).key]={backfilled:!1},n.y>0&&(h[new i.OverscaledTileID(r.overscaledZ,a,n.z,s,n.y-1).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,r.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},h[new i.OverscaledTileID(r.overscaledZ,c,n.z,l,n.y-1).key]={backfilled:!1}),n.y+1{if(this._loaded=!0,this._pendingLoad=null,r)this.fire(new i.ErrorEvent(r));else{const o={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(o.resourceTiming=n.resourceTiming[this.id]),this.fire(new i.Event("data",o)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(r,n){const o=r.actor?"reloadTile":"loadTile";r.actor=this.actor,r.request=this.actor.send(o,{type:this.type,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(i,s)=>(delete r.request,r.unloadVectorData(),r.aborted?n(null):i?n(i):(r.loadVectorData(s,this.map.painter,"reloadTile"===o),n(null))),void 0,"loadTile"===o)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.aborted=!0}unloadTile(i){i.unloadVectorData(),this.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return i.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends eT{constructor(i,r,n,o){super(i,r,n,o),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;const r=this.options;for(const n of(this.urls=[],r.urls))this.urls.push(this.map._requestManager.transformRequest(n,i.ResourceType.Source).url);i.getVideo(this.urls,(r,n)=>{this._loaded=!0,r?this.fire(new i.ErrorEvent(r)):n&&(this.video=n,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(r){if(this.video){const n=this.video.seekable;rn.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(i){this.map||(this.map=i,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 r=this.map.painter.context,n=r.gl;for(const o in this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture(r,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.tiles){const s=this.tiles[o];"loaded"!==s.state&&(s.state="loaded",s.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:eT,canvas:class extends eT{constructor(r,n,o,s){super(r,n,o,s),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(i=>!Array.isArray(i)||2!==i.length||i.some(i=>"number"!=typeof i))||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof i.window.HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new i.ErrorEvent(new i.ValidationError(`sources.${r}`,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;const n=this.map.painter.context,o=n.gl;for(const s in this._boundsArray||this._makeBoundsArray(),this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,i.boundsAttributes.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(n,this.canvas,o.RGBA,{premultiply:!0}),this.tiles){const a=this.tiles[s];"loaded"!==a.state&&(a.state="loaded",a.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const i of[this.canvas.width,this.canvas.height,])if(isNaN(i)||i<=0)return!0;return!1}}},eS=function(r,n,o,s){const a=new eE[n.type](r,n,o,s);if(a.id!==r)throw Error(`Expected Source id to be ${r} instead of ${a.id}`);return i.bindAll(["load","abort","unload","serialize","prepare",],a),a};function eI(r,n){const o=i.identity([]);return i.scale(o,o,[.5*r.width,-(.5*r.height),1,]),i.translate(o,o,[1,-1,0]),i.multiply$1(o,o,r.calculateProjMatrix(n.toUnwrapped()))}function eM(i,r,n,o,s,a,l,c=!1){const h=i.tilesIn(o,l,c);h.sort(eC);const u=[];for(const d of h)u.push({wrappedTileID:d.tile.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(r,n,i._state,d,s,a,eI(i.transform,d.tile.tileID),c)});const p=function(i){const r={},n={};for(const o of i){const s=o.queryResults,a=o.wrappedTileID,l=n[a]=n[a]||{};for(const c in s){const h=s[c],u=l[c]=l[c]||{},d=r[c]=r[c]||[];for(const p of h)u[p.featureIndex]||(u[p.featureIndex]=!0,d.push(p))}}return r}(u);for(const f in p)p[f].forEach(r=>{const n=r.feature,o=i.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o});return p}function eA(i,r){const n=i.getRenderableIds().map(r=>i.getTileByID(r)),o=[],s={};for(let a=0;a{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[ek]}numActive(){return Object.keys(this.active).length}}let eD;function eL(){return eD||(eD=new eP),eD}function eB(r,n){const o={};for(const s in r)"ref"!==s&&(o[s]=r[s]);return i.refProperties.forEach(i=>{i in n&&(o[i]=n[i])}),o}function eR(i){i=i.slice();const r=Object.create(null);for(let n=0;n0?(s-l)/c:0;return this.points[a].mult(1-h).add(this.points[n].mult(h))}}class eq{constructor(i,r,n){const o=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(i/n),this.yCellCount=Math.ceil(r/n);for(let a=0;athis.width||o<0||r>this.height)return!s&&[];const l=[];if(i<=0&&r<=0&&this.width<=n&&this.height<=o){if(s)return!0;for(let c=0;c0:l}_queryCircle(i,r,n,o,s){const a=i-n,l=i+n,c=r-n,h=r+n;if(l<0||a>this.width||h<0||c>this.height)return!o&&[];const u=[];return this._forEachCell(a,c,l,h,this._queryCellCircle,u,{hitTest:o,circle:{x:i,y:r,radius:n},seenUids:{box:{},circle:{}}},s),o?u.length>0:u}query(i,r,n,o,s){return this._query(i,r,n,o,!1,s)}hitTest(i,r,n,o,s){return this._query(i,r,n,o,!0,s)}hitTestCircle(i,r,n,o){return this._queryCircle(i,r,n,!0,o)}_queryCell(i,r,n,o,s,a,l,c){const h=l.seenUids,u=this.boxCells[s];if(null!==u){const d=this.bboxes;for(const p of u)if(!h.box[p]){h.box[p]=!0;const f=4*p;if(i<=d[f+2]&&r<=d[f+3]&&n>=d[f+0]&&o>=d[f+1]&&(!c||c(this.boxKeys[p]))){if(l.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[p],x1:d[f],y1:d[f+1],x2:d[f+2],y2:d[f+3]})}}}const m=this.circleCells[s];if(null!==m){const $=this.circles;for(const g of m)if(!h.circle[g]){h.circle[g]=!0;const y=3*g;if(this._circleAndRectCollide($[y],$[y+1],$[y+2],i,r,n,o)&&(!c||c(this.circleKeys[g]))){if(l.hitTest)return a.push(!0),!0;{const x=$[y],v=$[y+1],b=$[y+2];a.push({key:this.circleKeys[g],x1:x-b,y1:v-b,x2:x+b,y2:v+b})}}}}}_queryCellCircle(i,r,n,o,s,a,l,c){const h=l.circle,u=l.seenUids,d=this.boxCells[s];if(null!==d){const p=this.bboxes;for(const f of d)if(!u.box[f]){u.box[f]=!0;const m=4*f;if(this._circleAndRectCollide(h.x,h.y,h.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!c||c(this.boxKeys[f])))return a.push(!0),!0}}const $=this.circleCells[s];if(null!==$){const g=this.circles;for(const y of $)if(!u.circle[y]){u.circle[y]=!0;const x=3*y;if(this._circlesCollide(g[x],g[x+1],g[x+2],h.x,h.y,h.radius)&&(!c||c(this.circleKeys[y])))return a.push(!0),!0}}}_forEachCell(i,r,n,o,s,a,l,c){const h=this._convertToXCellCoord(i),u=this._convertToYCellCoord(r),d=this._convertToXCellCoord(n),p=this._convertToYCellCoord(o);for(let f=h;f<=d;f++)for(let m=u;m<=p;m++)if(s.call(this,i,r,n,o,this.xCellCount*m+f,a,l,c))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,r,n,o,s,a){const l=o-i,c=s-r,h=n+a;return h*h>l*l+c*c}_circleAndRectCollide(i,r,n,o,s,a,l){const c=(a-o)/2,h=Math.abs(i-(o+c));if(h>c+n)return!1;const u=(l-s)/2,d=Math.abs(r-(s+u));if(d>u+n)return!1;if(h<=c||d<=u)return!0;const p=h-c,f=d-u;return p*p+f*f<=n*n}}const eX=Math.tan(85*Math.PI/180);function eW(r,n,o,a,l,c){let h=i.create();if(o){if("globe"===l.projection.name)h=i.calculateGlobeMatrix(l,l.worldSize/l._projectionScaler,[0,0]),i.multiply$1(h,h,i.globeDenormalizeECEF(i.globeTileBounds(n)));else{const u=s([],c);h[0]=u[0],h[1]=u[1],h[4]=u[2],h[5]=u[3]}a||i.rotateZ(h,h,l.angle)}else i.multiply$1(h,l.labelPlaneMatrix,r);return h}function eH(r,n,o,s,a,l){if(o){if("globe"===a.projection.name){const c=eW(r,n,o,s,a,l);return i.invert(c,c),i.multiply$1(c,r,c),c}{const h=i.clone(r),u=i.identity([]);return u[0]=l[0],u[1]=l[1],u[4]=l[2],u[5]=l[3],i.multiply$1(h,h,u),s||i.rotateZ(h,h,-a.angle),h}}return a.glCoordMatrix}function eK(r,n,o=0){const s=[r.x,r.y,o,1];o?i.transformMat4$1(s,s,n):e9(s,s,n);const a=s[3];return{point:new i.pointGeometry(s[0]/a,s[1]/a),signedDistanceFromCamera:a}}function eY(i,r){return Math.min(.5+i/r*.5,1.5)}function eJ(i,r){const n=i[0]/i[3],o=i[1]/i[3];return n>=-r[0]&&n<=r[0]&&o>=-r[1]&&o<=r[1]}function eQ(r,n,o,s,a,l,c,h,u,d){const p=o.transform,f=s?r.textSizeData:r.iconSizeData,m=i.evaluateSizeForZoom(f,o.transform.zoom),$=[256/o.width*2+1,256/o.height*2+1,],g=s?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;g.clear();const y=r.lineVertexArray,x=s?r.text.placedSymbolArray:r.icon.placedSymbolArray,v=o.transform.width/o.transform.height;let b=!1;for(let w=0;wMath.abs(o.x-n.x)*s?{useVertical:!0}:r.writingMode===i.WritingMode.vertical?n.yeX}(n,o,s)?1===r.flipState?{needsFlipping:!0}:null:n.x>o.x?{needsFlipping:!0}:null}function e2(r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x){const v=n/24,b=r.lineOffsetX*v,w=r.lineOffsetY*v;let T;if(r.numGlyphs>1){const E=r.glyphStartIndex+r.numGlyphs,S=r.lineStartIndex,I=r.lineStartIndex+r.lineLength,M=e0(v,h,b,w,o,p,f,r,u,l,m,g,!1,y,x);if(!M)return{notEnoughRoom:!0};const A=eK(M.first.point,c).point,C=eK(M.last.point,c).point;if(s&&!o){const z=e1(r,A,C,$);if(r.flipState=z&&z.needsFlipping?1:2,z)return z}T=[M.first];for(let k=r.glyphStartIndex+1;k0?B.point:e5(f,L,P,1,a,void 0,y,x.canonical),$);if(r.flipState=R&&R.needsFlipping?1:2,R)return R}const F=e4(v*h.getoffsetX(r.glyphStartIndex),b,w,o,p,f,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,u,l,m,g,!1,!1,y,x);if(!F)return{notEnoughRoom:!0};T=[F]}for(const O of T)i.addDynamicAttributes(d,O.point,O.angle);return{}}function e3(r,n,o,s,a){const l=s.projectTilePoint(r.x,r.y,n);if(!a)return eK(l,o,l.z);const c=a(r);return eK(new i.pointGeometry(l.x+c[0],l.y+c[1]),o,l.z+c[2])}function e5(i,r,n,o,s,a,l,c){const h=e3(i.add(i.sub(r)._unit()),c,s,l,a).point,u=n.sub(h);return n.add(u._mult(o/u.mag()))}function e4(r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x){const v=s?r-n:r+n;let b=v>0?1:-1,w=0;s&&(b*=-1,w=Math.PI),b<0&&(w+=Math.PI);let T=b>0?h+c:h+c+1,E=a,S=a,I=0,M=0;const A=Math.abs(v),C=[],z=[];let k=l;const P=()=>{const r=T-b;return 0===I?l:new i.pointGeometry(d.getx(r),d.gety(r))},D=()=>e5(P(),k,S,A-I+1,p,m,y,x.canonical);for(;I+M<=A;){if((T+=b)=u)return null;if(S=E,C.push(E),$&&z.push(k||P()),void 0===(E=f[T])){k=new i.pointGeometry(d.getx(T),d.gety(T));const L=e3(k,x.canonical,p,y,m);E=L.signedDistanceFromCamera>0?f[T]=L.point:D()}else k=null;I+=M,M=S.dist(E)}g&&m&&(k=k||new i.pointGeometry(d.getx(T),d.gety(T)),f[T]=E=void 0===f[T]?E:D(),M=S.dist(E));const B=(A-I)/M,R=E.sub(S),F=R.mult(B)._add(S);o&&F._add(R._unit()._perp()._mult(o*b));const O=w+Math.atan2(E.y-S.y,E.x-S.x);return C.push(F),$&&(k=k||new i.pointGeometry(d.getx(T),d.gety(T)),z.push(function(r,n,o){const s=1-o;return new i.pointGeometry(r.x*s+n.x*o,r.y*s+n.y*o)}(z.length>0?z[z.length-1]:k,k,B))),{point:F,angle:O,path:C,tilePath:z}}const e6=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,]);function e8(i,r){for(let n=0;n[0,0,0],b=new i.pointGeometry(n.tileAnchorX,n.tileAnchorY),w=this.transform.projection.projectTilePoint(n.tileAnchorX,n.tileAnchorY,$.canonical),T=v(b),E=[w.x+T[0],w.y+T[1],w.z+T[2]],S=this.projectAndGetPerspectiveRatio(l,E[0],E[1],E[2],$),{perspectiveRatio:I}=S,M=(d?a/I:a*I)/i.ONE_EM,A=eK(new i.pointGeometry(E[0],E[1]),c,E[2]).point,C=S.signedDistanceFromCamera>0?e0(M,s,n.lineOffsetX*M,n.lineOffsetY*M,!1,A,b,n,o,c,{},y&&!d?v:null,d&&!!y,this.transform.projection,$):null;let z=!1,k=!1,P=!0;if(C&&!S.aboveHorizon){const D=.5*f*I+m,L=new i.pointGeometry(-100,-100),B=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),R=new e_,F=C.first,O=C.last;let U=[];for(let V=F.path.length-1;V>=1;V--)U.push(F.path[V]);for(let N=1;N{const n=v(reK(i,h));U=G.some(i=>i.signedDistanceFromCamera<=0)?[]:G.map(i=>i.point)}let Z=[];if(U.length>0){const _=U[0].clone(),q=U[0].clone();for(let X=1;X=L.x&&q.x<=B.x&&_.y>=L.y&&q.y<=B.y?[U]:q.xB.x||q.yB.y?[]:i.clipLine([U],L.x,L.y,B.x,B.y)}for(const W of Z){R.reset(W,.25*D);let H=0;H=R.length<=.5*D?1:Math.ceil(R.paddedLength/j)+1;for(let K=0;K0){i.transformMat4$1(l,l,r);let h=!1;this.fogState&&a&&(h=function(r,n,o,s,a,l){const c=l.calculateFogTileMatrix(a),h=[n,o,s];return i.transformMat4(h,h,c),w(r,h,l.pitch,l._fov)}(this.fogState,n,o,s||0,a.toUnwrapped(),this.transform)>.9),c=l[2]>l[3]||h}else e9(l,l,r);return{point:new i.pointGeometry((l[0]/l[3]+1)/2*this.transform.width+100,(-l[1]/l[3]+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.cameraToCenterDistance/l[3]*.5,1.5),signedDistanceFromCamera:l[3],aboveHorizon:c}}isOffscreen(i,r,n,o){return n<100||i>=this.screenRightBoundary||o<100||r>this.screenBottomBoundary}isInsideGrid(i,r,n,o){return n>=0&&i=0&&ri.collisionGroupID===r}}return this.collisionGroups[i]}}function ts(r,n,o,s,a){const{horizontalAlign:l,verticalAlign:c}=i.getAnchorAlignment(r),h=i.evaluateVariableOffset(r,s);return new i.pointGeometry(-(l-.5)*n+h[0]*a,-(c-.5)*o+h[1]*a)}function ta(r,n,o,s,a){const l=new i.pointGeometry(r,n);return o&&l._rotate(s?a:-a),l}class tl{constructor(i,r,n,o,s){this.transform=i.clone(),this.collisionIndex=new e7(this.transform,s),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new to(n),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,n,o,s){const a=o.getBucket(n),l=o.latestFeatureIndex;if(!a||!l||n.id!==a.layerIds[0])return;const c=a.layers[0].layout,h=o.collisionBoxArray,u=Math.pow(2,this.transform.zoom-o.tileID.overscaledZ),d=o.tileSize/i.EXTENT,p=o.tileID.toUnwrapped(),f=this.transform.calculateProjMatrix(p),m="map"===c.get("text-pitch-alignment"),$="map"===c.get("text-rotation-alignment");n.compileFilter();const g=n.dynamicFilter(),y=n.dynamicFilterNeedsFeature(),x=this.transform.calculatePixelsToTileUnitsMatrix(o),v=eW(f,o.tileID.canonical,m,$,this.transform,x);let b=null;if(m){const w=eH(f,o.tileID.canonical,m,$,this.transform,x);b=i.multiply$1([],this.transform.labelPlaneMatrix,w)}let T=null;g&&o.latestFeatureIndex&&(T={unwrappedTileID:p,dynamicFilter:g,dynamicFilterNeedsFeature:y,featureIndex:o.latestFeatureIndex}),this.retainedQueryData[a.bucketInstanceId]=new tn(a.bucketInstanceId,l,a.sourceLayerIndex,a.index,o.tileID);const E={bucket:a,layout:c,posMatrix:f,textLabelPlaneMatrix:v,labelToScreenMatrix:b,clippingData:T,scale:u,textPixelRatio:d,holdingForFade:o.holdingForFade(),collisionBoxArray:h,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(a.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:i.evaluateSizeForZoom(a.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(s)for(const S of a.sortKeyRanges){const{sortKey:I,symbolInstanceStart:M,symbolInstanceEnd:A}=S;r.push({sortKey:I,symbolInstanceStart:M,symbolInstanceEnd:A,parameters:E})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:E})}attemptAnchorPlacement(i,r,n,o,s,a,l,c,h,u,d,p,f,m,$,g,y,x){const v=[p.textOffset0,p.textOffset1],b=ts(i,n,o,v,s),w=this.collisionIndex.placeCollisionBox(s,r,ta(b.x,b.y,a,l,this.transform.angle),d,c,h,u.predicate);if((!g||0!==this.collisionIndex.placeCollisionBox(m.getSymbolInstanceIconSize(x,this.transform.zoom,f),g,ta(b.x,b.y,a,l,this.transform.angle),d,c,h,u.predicate).box.length)&&w.box.length>0){let T;return this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(T=this.prevPlacement.variableOffsets[p.crossTileID].anchor),this.variableOffsets[p.crossTileID]={textOffset:v,width:n,height:o,anchor:i,textScale:s,prevAnchor:T},this.markUsedJustification(m,i,p,$),m.allowVerticalPlacement&&(this.markUsedOrientation(m,$,p),this.placedOrientations[p.crossTileID]=$),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(r,n,o,s){const{bucket:a,layout:l,posMatrix:c,textLabelPlaneMatrix:h,labelToScreenMatrix:u,clippingData:d,textPixelRatio:p,holdingForFade:f,collisionBoxArray:m,partiallyEvaluatedTextSize:$,partiallyEvaluatedIconSize:g,collisionGroup:y}=r.parameters,x=l.get("text-optional"),v=l.get("icon-optional"),b=l.get("text-allow-overlap"),w=l.get("icon-allow-overlap"),T="map"===l.get("text-rotation-alignment"),E="map"===l.get("text-pitch-alignment"),S="none"!==l.get("icon-text-fit"),I="viewport-y"===l.get("symbol-z-order"),M=b&&(w||!a.hasIconData()||v),A=w&&(b||!a.hasTextData()||x);!a.collisionArrays&&m&&a.deserializeCollisionBoxes(m),o&&s&&a.updateCollisionDebugBuffers(this.transform.zoom,m);const C=(r,s,m)=>{if(d){const I={zoom:this.transform.zoom,pitch:this.transform.pitch};let C=null;if(d.dynamicFilterNeedsFeature){const z=this.retainedQueryData[a.bucketInstanceId];C=d.featureIndex.loadFeature({featureIndex:r.featureIndex,bucketIndex:z.bucketIndex,sourceLayerIndex:z.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,d.dynamicFilter)(I,C,this.retainedQueryData[a.bucketInstanceId].tileID.canonical,new i.pointGeometry(r.tileAnchorX,r.tileAnchorY),this.transform.calculateDistanceTileData(d.unwrappedTileID)))return this.placements[r.crossTileID]=new ti(!1,!1,!1,!0),void(n[r.crossTileID]=!0)}if(n[r.crossTileID])return;if(f)return void(this.placements[r.crossTileID]=new ti(!1,!1,!1));let k=!1,P=!1,D=!0,L=null,B={box:null,offscreen:null},R={box:null,offscreen:null},F=null,O=null,U=null,V=0,N=0,j=0;m.textFeatureIndex?V=m.textFeatureIndex:r.useRuntimeCollisionCircles&&(V=r.featureIndex),m.verticalTextFeatureIndex&&(N=m.verticalTextFeatureIndex);const G=i=>{i.tileID=this.retainedQueryData[a.bucketInstanceId].tileID,(this.transform.elevation||i.elevation)&&(i.elevation=this.transform.elevation?this.transform.elevation.getAtTileOffset(this.retainedQueryData[a.bucketInstanceId].tileID,i.tileAnchorX,i.tileAnchorY):0)},Z=m.textBox;if(Z){G(Z);const _=n=>{let o=i.WritingMode.horizontal;if(a.allowVerticalPlacement&&!n&&this.prevPlacement){const s=this.prevPlacement.placedOrientations[r.crossTileID];s&&(this.placedOrientations[r.crossTileID]=s,o=s,this.markUsedOrientation(a,o,r))}return o},q=(n,o)=>{if(a.allowVerticalPlacement&&r.numVerticalGlyphVertices>0&&m.verticalTextBox){for(const s of a.writingModes)if(s===i.WritingMode.vertical?R=B=o():B=n(),B&&B.box&&B.box.length)break}else B=n()};if(l.get("text-variable-anchor")){let X=l.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[r.crossTileID]){const W=this.prevPlacement.variableOffsets[r.crossTileID];X.indexOf(W.anchor)>0&&(X=X.filter(i=>i!==W.anchor)).unshift(W.anchor)}const H=(i,n,o)=>{const l=a.getSymbolInstanceTextSize($,r,this.transform.zoom,s),h=(i.x2-i.x1)*l+2*i.padding,u=(i.y2-i.y1)*l+2*i.padding,d=S&&!w?n:null;d&&G(d);let f={box:[],offscreen:!1};const m=b?2*X.length:X.length;for(let x=0;x=X.length,r,s,a,o,d,$,g);if(v&&(f=v.placedGlyphBoxes)&&f.box&&f.box.length){k=!0,L=v.shift;break}}return f};q(()=>H(Z,m.iconBox,i.WritingMode.horizontal),()=>{const n=m.verticalTextBox;return n&&G(n),a.allowVerticalPlacement&&!(B&&B.box&&B.box.length)&&r.numVerticalGlyphVertices>0&&n?H(n,m.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null}}),B&&(k=B.box,D=B.offscreen);const K=_(B&&B.box);if(!k&&this.prevPlacement){const Y=this.prevPlacement.variableOffsets[r.crossTileID];Y&&(this.variableOffsets[r.crossTileID]=Y,this.markUsedJustification(a,Y.anchor,r,K))}}else{const J=(n,o)=>{const l=a.getSymbolInstanceTextSize($,r,this.transform.zoom,s),h=this.collisionIndex.placeCollisionBox(l,n,new i.pointGeometry(0,0),b,p,c,y.predicate);return h&&h.box&&h.box.length&&(this.markUsedOrientation(a,o,r),this.placedOrientations[r.crossTileID]=o),h};q(()=>J(Z,i.WritingMode.horizontal),()=>{const n=m.verticalTextBox;return a.allowVerticalPlacement&&r.numVerticalGlyphVertices>0&&n?(G(n),J(n,i.WritingMode.vertical)):{box:null,offscreen:null}}),_(B&&B.box&&B.box.length)}}if(k=(F=B)&&F.box&&F.box.length>0,D=F&&F.offscreen,r.useRuntimeCollisionCircles){const Q=a.text.placedSymbolArray.get(r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex),ee=i.evaluateSizeForFeature(a.textSizeData,$,Q),et=l.get("text-padding");O=this.collisionIndex.placeCollisionCircles(b,Q,a.lineVertexArray,a.glyphOffsetArray,ee,c,h,u,o,E,y.predicate,r.collisionCircleDiameter*ee/i.ONE_EM,et,this.retainedQueryData[a.bucketInstanceId].tileID),k=b||O.circles.length>0&&!O.collisionDetected,D=D&&O.offscreen}if(m.iconFeatureIndex&&(j=m.iconFeatureIndex),m.iconBox){const ei=r=>{G(r);const n=S&&L?ta(L.x,L.y,T,E,this.transform.angle):new i.pointGeometry(0,0),o=a.getSymbolInstanceIconSize(g,this.transform.zoom,s);return this.collisionIndex.placeCollisionBox(o,r,n,w,p,c,y.predicate)};P=R&&R.box&&R.box.length&&m.verticalIconBox?(U=ei(m.verticalIconBox)).box.length>0:(U=ei(m.iconBox)).box.length>0,D=D&&U.offscreen}const er=x||0===r.numHorizontalGlyphVertices&&0===r.numVerticalGlyphVertices,en=v||0===r.numIconVertices;if(er||en?en?er||(P=P&&k):k=P&&k:P=k=P&&k,k&&F&&F.box&&this.collisionIndex.insertCollisionBox(F.box,l.get("text-ignore-placement"),a.bucketInstanceId,R&&R.box&&N?N:V,y.ID),P&&U&&this.collisionIndex.insertCollisionBox(U.box,l.get("icon-ignore-placement"),a.bucketInstanceId,j,y.ID),O&&(k&&this.collisionIndex.insertCollisionCircles(O.circles,l.get("text-ignore-placement"),a.bucketInstanceId,V,y.ID),o)){const eo=a.bucketInstanceId;let es=this.collisionCircleArrays[eo];void 0===es&&(es=this.collisionCircleArrays[eo]=new tr);for(let ea=0;ea=0;--k){const P=z[k];C(a.symbolInstances.get(P),P,a.collisionArrays[P])}}else for(let D=r.symbolInstanceStart;D=0&&(r.text.placedSymbolArray.get(c).crossTileID=a>=0&&c!==a?0:o.crossTileID)}markUsedOrientation(r,n,o){const s=n===i.WritingMode.horizontal||n===i.WritingMode.horizontalOnly?n:0,a=n===i.WritingMode.vertical?n:0,l=[o.leftJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.rightJustifiedTextSymbolIndex,];for(const c of l)r.text.placedSymbolArray.get(c).placedOrientation=s;o.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;const r=this.prevPlacement;let n=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;const o=r?r.symbolFadeChange(i):1,s=r?r.opacities:{},a=r?r.variableOffsets:{},l=r?r.placedOrientations:{};for(const c in this.placements){const h=this.placements[c],u=s[c];u?(this.opacities[c]=new tt(u,o,h.text,h.icon,null,h.clipped),n=n||h.text!==u.text.placed||h.icon!==u.icon.placed):(this.opacities[c]=new tt(null,o,h.text,h.icon,h.skipFade,h.clipped),n=n||h.text||h.icon)}for(const d in s){const p=s[d];if(!this.opacities[d]){const f=new tt(p,o,!1,!1);f.isHidden()||(this.opacities[d]=f,n=n||p.text.placed||p.icon.placed)}}for(const m in a)this.variableOffsets[m]||!this.opacities[m]||this.opacities[m].isHidden()||(this.variableOffsets[m]=a[m]);for(const $ in l)this.placedOrientations[$]||!this.opacities[$]||this.opacities[$].isHidden()||(this.placedOrientations[$]=l[$]);n?this.lastPlacementChangeTime=i:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:i)}updateLayerOpacities(i,r){const n={};for(const o of r){const s=o.getBucket(i);s&&o.latestFeatureIndex&&i.id===s.layerIds[0]&&this.updateBucketOpacities(s,n,o.collisionBoxArray)}}updateBucketOpacities(r,n,o){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const s=r.layers[0].layout,a=!!r.layers[0].dynamicFilter(),l=new tt(null,0,!1,!1,!0),c=s.get("text-allow-overlap"),h=s.get("icon-allow-overlap"),u=s.get("text-variable-anchor"),d="map"===s.get("text-rotation-alignment"),p="map"===s.get("text-pitch-alignment"),f="none"!==s.get("icon-text-fit"),m=new tt(null,0,c&&(h||!r.hasIconData()||s.get("icon-optional")),h&&(c||!r.hasTextData()||s.get("text-optional")),!0);!r.collisionArrays&&o&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(o);const $=(i,r,n)=>{for(let o=0;o0||b>0,S=x.numIconVertices>0,I=this.placedOrientations[x.crossTileID],M=I===i.WritingMode.vertical,A=I===i.WritingMode.horizontal||I===i.WritingMode.horizontalOnly;if(!E&&!S||T.isHidden()||g++,E){const C=th(T.text);$(r.text,v,M?tu:C),$(r.text,b,A?tu:C);const z=T.text.isHidden();[x.rightJustifiedTextSymbolIndex,x.centerJustifiedTextSymbolIndex,x.leftJustifiedTextSymbolIndex,].forEach(i=>{i>=0&&(r.text.placedSymbolArray.get(i).hidden=z||M?1:0)}),x.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(x.verticalPlacedTextSymbolIndex).hidden=z||A?1:0);const k=this.variableOffsets[x.crossTileID];k&&this.markUsedJustification(r,k.anchor,x,I);const P=this.placedOrientations[x.crossTileID];P&&(this.markUsedJustification(r,"left",x,P),this.markUsedOrientation(r,P,x))}if(S){const D=th(T.icon);x.placedIconSymbolIndex>=0&&($(r.icon,x.numIconVertices,M?tu:D),r.icon.placedSymbolArray.get(x.placedIconSymbolIndex).hidden=T.icon.isHidden()),x.verticalPlacedIconSymbolIndex>=0&&($(r.icon,x.numVerticalIconVertices,A?tu:D),r.icon.placedSymbolArray.get(x.verticalPlacedIconSymbolIndex).hidden=T.icon.isHidden())}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const L=r.collisionArrays[y];if(L){let B=new i.pointGeometry(0,0),R=!0;if(L.textBox||L.verticalTextBox){if(u){const F=this.variableOffsets[w];F?(B=ts(F.anchor,F.width,F.height,F.textOffset,F.textScale),d&&B._rotate(p?this.transform.angle:-this.transform.angle)):R=!1}a&&(R=!T.clipped),L.textBox&&tc(r.textCollisionBox.collisionVertexArray,T.text.placed,!R||M,B.x,B.y),L.verticalTextBox&&tc(r.textCollisionBox.collisionVertexArray,T.text.placed,!R||A,B.x,B.y)}const O=R&&Boolean(!A&&L.verticalIconBox);L.iconBox&&tc(r.iconCollisionBox.collisionVertexArray,T.icon.placed,O,f?B.x:0,f?B.y:0),L.verticalIconBox&&tc(r.iconCollisionBox.collisionVertexArray,T.icon.placed,!O,f?B.x:0,f?B.y:0)}}}if(r.fullyClipped=0===g,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){const U=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=U.invProjMatrix,r.placementViewportMatrix=U.viewportMatrix,r.collisionCircleArray=U.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(i){return 0===this.fadeDuration?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return this.stale||i-this.lastPlacementChangeTimei}setStale(){this.stale=!0}}function tc(i,r,n,o,s){i.emplaceBack(r?1:0,n?1:0,o||0,s||0),i.emplaceBack(r?1:0,n?1:0,o||0,s||0),i.emplaceBack(r?1:0,n?1:0,o||0,s||0),i.emplaceBack(r?1:0,n?1:0,o||0,s||0)}function th(i){if(0===i.opacity&&!i.placed)return 0;if(1===i.opacity&&i.placed)return 4294967295;const r=i.placed?1:0,n=Math.floor(127*i.opacity);return 33554432*n+16777216*r+131072*n+65536*r+512*n+256*r+2*n+r}const tu=0;class td{constructor(i){this._sortAcrossTiles="viewport-y"!==i.layout.get("symbol-z-order")&&void 0!==i.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(i,r,n,o,s){const a=this._bucketParts;for(;this._currentTileIndexi.sortKey-r.sortKey));this._currentPartIndex{const r=i.exported.now()-s;return!this._forceFullPlacement&&r>2};for(;this._currentPlacementIndex>=0;){const l=n[r[this._currentPlacementIndex]],c=this.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&(!l.minzoom||l.minzoom<=c)&&(!l.maxzoom||l.maxzoom>c)){if(this._inProgressLayer||(this._inProgressLayer=new td(l)),this._inProgressLayer.continuePlacement(o[l.source],this.placement,this._showCollisionBoxes,l,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(i){return this.placement.commit(i),this.placement}}const tf=512/i.EXTENT/2;class tm{constructor(i,r,n){this.tileID=i,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let o=0;oi.overscaledZ)for(const c in l){const h=l[c];h.tileID.isChildOf(i)&&h.findMatches(r.symbolInstances,i,s)}else{const u=l[i.scaledTo(Number(a)).key];u&&u.findMatches(r.symbolInstances,i,s)}}for(let d=0;d{r[i]=!0}),this.layerIndexes)r[n]||delete this.layerIndexes[n]}}const tx=(r,n)=>i.emitValidationErrors(r,n&&n.filter(i=>"source.canvas"!==i.identifier)),tv=i.pick(eF,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection",]),tb=i.pick(eF,["setCenter","setZoom","setBearing","setPitch",]),tw=function(){const r={},n=i.spec.$version;for(const o in i.spec.$root){const s=i.spec.$root[o];if(s.required){let a=null;null!=(a="version"===o?n:"array"===s.type?[]:{})&&(r[o]=a)}}return r}(),tT={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class tE extends i.Evented{constructor(r,n={}){super(),this.map=r,this.dispatcher=new M(eL(),this),this.imageManager=new m,this.imageManager.setEventedParent(this),this.glyphManager=new i.GlyphManager(r._requestManager,n.localFontFamily?i.LocalGlyphMode.all:n.localIdeographFontFamily?i.LocalGlyphMode.ideographs:i.LocalGlyphMode.none,n.localFontFamily||n.localIdeographFontFamily),this.lineAtlas=new i.LineAtlas(256,512),this.crossTileSymbolIndex=new ty,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this.zoomHistory=new i.ZoomHistory,this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());const o=this;this._rtlTextPluginCallback=tE.registerForPluginStateChange(r=>{o.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:r.pluginStatus,pluginURL:r.pluginURL},(r,n)=>{if(i.triggerPluginCompletionEvent(r),n&&n.every(i=>i))for(const s in o._sourceCaches){const a=o._sourceCaches[s],l=a.getSource().type;"vector"!==l&&"geojson"!==l||a.reload()}})}),this.on("data",i=>{if("source"!==i.dataType||"metadata"!==i.sourceDataType)return;const r=this.getSource(i.sourceId);if(r&&r.vectorLayerIds)for(const n in this._layers){const o=this._layers[n];o.source===r.id&&this._validateLayer(o)}})}loadURL(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"}));const o="boolean"==typeof n.validate?n.validate:!i.isMapboxURL(r);r=this.map._requestManager.normalizeStyleURL(r,n.accessToken);const s=this.map._requestManager.transformRequest(r,i.ResourceType.Style);this._request=i.getJSON(s,(r,n)=>{this._request=null,r?this.fire(new i.ErrorEvent(r)):n&&this._load(n,o)})}loadJSON(r,n={}){this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(()=>{this._request=null,this._load(r,!1!==n.validate)})}loadEmpty(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(tw,!1)}_updateLayerCount(i,r){const n=r?1:-1;i.is3D()&&(this._num3DLayers+=n),"circle"===i.type&&(this._numCircleLayers+=n),"symbol"===i.type&&(this._numSymbolLayers+=n)}_load(r,n){if(n&&tx(this,i.validateStyle(r)))return;for(const o in this._loaded=!0,this.stylesheet=r,this.updateProjection(),r.sources)this.addSource(o,r.sources[o],{validate:!1});this._changed=!1,r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(r.glyphs);const s=eR(this.stylesheet.layers);for(let a of(this._order=s.map(i=>i.id),this._layers={},this._serializedLayers={},s))(a=i.createStyleLayer(a)).setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=a,this._serializedLayers[a.id]=a.serialize(),this._updateLayerCount(a,!0);this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new y(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 i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}terrainSetForDrapingOnly(){return this.terrain&&0===this.terrain.drapeRenderMode}setProjection(i){i?this.stylesheet.projection=i:delete this.stylesheet.projection,this.updateProjection()}updateProjection(){const i=this.map.transform.projection,r=this.map.transform.setProjection(this.map._runtimeProjection||(this.stylesheet?this.stylesheet.projection:void 0)),n=this.map.transform.projection;if(this._loaded&&(n.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null)),this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),r){if(n.isReprojectedInTileSpace||i.isReprojectedInTileSpace)for(const o in this.map.painter.clearBackgroundTiles(),this._sourceCaches)this._sourceCaches[o].clearTiles();else this._forceSymbolLayerUpdate();this.map._update(!0)}}_loadSprite(r){this._spriteRequest=function(r,n,o){let s,a,l;const c=i.exported.devicePixelRatio>1?"@2x":"";let h=i.getJSON(n.transformRequest(n.normalizeSpriteURL(r,c,".json"),i.ResourceType.SpriteJSON),(i,r)=>{h=null,l||(l=i,s=r,d())}),u=i.getImage(n.transformRequest(n.normalizeSpriteURL(r,c,".png"),i.ResourceType.SpriteImage),(i,r)=>{u=null,l||(l=i,a=r,d())});function d(){if(l)o(l);else if(s&&a){const r=i.exported.getImageData(a),n={};for(const c in s){const{width:h,height:u,x:d,y:p,sdf:f,pixelRatio:m,stretchX:$,stretchY:g,content:y}=s[c],x=new i.RGBAImage({width:h,height:u});i.RGBAImage.copy(r,x,{x:d,y:p},{x:0,y:0},{width:h,height:u}),n[c]={data:x,pixelRatio:m,sdf:f,stretchX:$,stretchY:g,content:y}}o(null,n)}}return{cancel(){h&&(h.cancel(),h=null),u&&(u.cancel(),u=null)}}}(r,this.map._requestManager,(r,n)=>{if(this._spriteRequest=null,r)this.fire(new i.ErrorEvent(r));else if(n)for(const o in n)this.imageManager.addImage(o,n[o]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new i.Event("data",{dataType:"style"}))})}_validateLayer(r){const n=this.getSource(r.source);if(!n)return;const o=r.sourceLayer;o&&("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(o))&&this.fire(new i.ErrorEvent(Error(`Source layer "${o}" does not exist on source "${n.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const i in this._sourceCaches)if(!this._sourceCaches[i].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(i){const r=[];for(const n of i){const o=this._layers[n];"custom"!==o.type&&r.push(o.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(const i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(i){return!!this.terrain&&tT[i.type]}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}update(r){if(!this._loaded)return;const n=this._changed;if(this._changed){const o=Object.keys(this._updatedLayers),s=Object.keys(this._removedLayers);for(const a in(o.length||s.length)&&this._updateWorkerLayers(o,s),this._updatedSources){const l=this._updatedSources[a];"reload"===l?this._reloadSource(a):"clear"===l&&this._clearSource(a)}for(const c in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[c].updateTransitions(r);this.light.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._resetUpdates()}const h={};for(const u in this._sourceCaches){const d=this._sourceCaches[u];h[u]=d.used,d.used=!1}for(const p of this._order){const f=this._layers[p];if(f.recalculate(r,this._availableImages),!f.isHidden(r.zoom)){const m=this._getLayerSourceCache(f);m&&(m.used=!0)}const $=this.map.painter;if($){const g=f.getProgramIds();if(!g)continue;const y=f.getProgramConfiguration(r.zoom);for(const x of g)$.useProgram(x,y)}}for(const v in h){const b=this._sourceCaches[v];h[v]!==b.used&&b.getSource().fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:b.getSource().id}))}this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),n&&this.fire(new i.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const i=Object.keys(this._changedImages);if(i.length){for(const r in this._sourceCaches)this._sourceCaches[r].reloadTilesForDependencies(["icons","patterns"],i);this._changedImages={}}}_updateWorkerLayers(i,r){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(i),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(r){if(this._checkLoaded(),tx(this,i.validateStyle(r)))return!1;(r=i.clone$1(r)).layers=eR(r.layers);const n=(function(i,r){if(!i)return[{command:eF.setStyle,args:[r]},];let n=[];try{if(!a(i.version,r.version))return[{command:eF.setStyle,args:[r]},];a(i.center,r.center)||n.push({command:eF.setCenter,args:[r.center]}),a(i.zoom,r.zoom)||n.push({command:eF.setZoom,args:[r.zoom]}),a(i.bearing,r.bearing)||n.push({command:eF.setBearing,args:[r.bearing]}),a(i.pitch,r.pitch)||n.push({command:eF.setPitch,args:[r.pitch]}),a(i.sprite,r.sprite)||n.push({command:eF.setSprite,args:[r.sprite]}),a(i.glyphs,r.glyphs)||n.push({command:eF.setGlyphs,args:[r.glyphs]}),a(i.transition,r.transition)||n.push({command:eF.setTransition,args:[r.transition]}),a(i.light,r.light)||n.push({command:eF.setLight,args:[r.light]}),a(i.fog,r.fog)||n.push({command:eF.setFog,args:[r.fog]}),a(i.projection,r.projection)||n.push({command:eF.setProjection,args:[r.projection]});const o={},s=[];!function(i,r,n,o){let s;for(s in r=r||{},i=i||{})i.hasOwnProperty(s)&&(r.hasOwnProperty(s)||eU(s,n,o));for(s in r)r.hasOwnProperty(s)&&(i.hasOwnProperty(s)?a(i[s],r[s])||("geojson"===i[s].type&&"geojson"===r[s].type&&eN(i,r,s)?n.push({command:eF.setGeoJSONSourceData,args:[s,r[s].data,]}):eV(s,r,n,o)):eO(s,r,n))}(i.sources,r.sources,s,o);const l=[];i.layers&&i.layers.forEach(i=>{o[i.source]?n.push({command:eF.removeLayer,args:[i.id]}):l.push(i)});let c=i.terrain;c&&o[c.source]&&(n.push({command:eF.setTerrain,args:[void 0]}),c=void 0),n=n.concat(s),a(c,r.terrain)||n.push({command:eF.setTerrain,args:[r.terrain]}),function(i,r,n){r=r||[];const o=(i=i||[]).map(eG),s=r.map(eG),l=i.reduce(eZ,{}),c=r.reduce(eZ,{}),h=o.slice(),u=Object.create(null);let d,p,f,m,$,g,y;for(d=0,p=0;d!(i.command in tb));if(0===n.length)return!1;const o=n.filter(i=>!(i.command in tv));if(o.length>0)throw Error(`Unimplemented: ${o.map(i=>i.command).join(", ")}.`);return n.forEach(i=>{"setTransition"!==i.command&&this[i.command].apply(this,i.args)}),this.stylesheet=r,this.updateProjection(),!0}addImage(r,n){if(this.getImage(r))return this.fire(new i.ErrorEvent(Error("An image with this name already exists.")));this.imageManager.addImage(r,n),this._afterImageUpdated(r)}updateImage(i,r){this.imageManager.updateImage(i,r)}getImage(i){return this.imageManager.getImage(i)}removeImage(r){if(!this.getImage(r))return this.fire(new i.ErrorEvent(Error("No image with this name exists.")));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(r,n,o={}){if(this._checkLoaded(),void 0!==this.getSource(r))throw Error("There is already a source with this ID");if(!n.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image",].indexOf(n.type)>=0&&this._validate(i.validateStyle.source,`sources.${r}`,n,null,o))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const s=eS(r,n,this.dispatcher,this);s.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:s.serialize(),sourceId:r}));const a=n=>{const o=(n?"symbol:":"other:")+r,a=this._sourceCaches[o]=new i.SourceCache(o,s,n);(n?this._symbolSourceCaches:this._otherSourceCaches)[r]=a,a.style=this,a.onAdd(this.map)};a(!1),"vector"!==n.type&&"geojson"!==n.type||a(!0),s.onAdd&&s.onAdd(this.map),this._changed=!0}removeSource(r){this._checkLoaded();const n=this.getSource(r);if(void 0===n)throw Error("There is no source with this ID");for(const o in this._layers)if(this._layers[o].source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while layer "${o}" is using it.`)));if(this.terrain&&this.terrain.get().source===r)return this.fire(new i.ErrorEvent(Error(`Source "${r}" cannot be removed while terrain is using it.`)));const s=this._getSourceCaches(r);for(const a of s)delete this._sourceCaches[a.id],delete this._updatedSources[a.id],a.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:a.getSource().id})),a.setEventedParent(null),a.clearTiles();delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(i,r){this._checkLoaded(),this.getSource(i).setData(r),this._changed=!0}getSource(i){const r=this._getSourceCache(i);return r&&r.getSource()}addLayer(r,n,o={}){this._checkLoaded();const s=r.id;if(this.getLayer(s))return void this.fire(new i.ErrorEvent(Error(`Layer with id "${s}" already exists on this map`)));let a;if("custom"===r.type){if(tx(this,i.validateCustomStyleLayer(r)))return;a=i.createStyleLayer(r)}else{if("object"==typeof r.source&&(this.addSource(s,r.source),r=i.clone$1(r),r=i.extend(r,{source:s})),this._validate(i.validateStyle.layer,`layers.${s}`,r,{arrayIndex:-1},o))return;a=i.createStyleLayer(r),this._validateLayer(a),a.setEventedParent(this,{layer:{id:s}}),this._serializedLayers[a.id]=a.serialize(),this._updateLayerCount(a,!0)}const l=n?this._order.indexOf(n):this._order.length;if(n&&-1===l)return void this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`)));this._order.splice(l,0,s),this._layerOrderChanged=!0,this._layers[s]=a;const c=this._getLayerSourceCache(a);if(this._removedLayers[s]&&a.source&&c&&"custom"!==a.type){const h=this._removedLayers[s];delete this._removedLayers[s],h.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",c.pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(r,n){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===n)return;const o=this._order.indexOf(r);this._order.splice(o,1);const s=n?this._order.indexOf(n):this._order.length;n&&-1===s?this.fire(new i.ErrorEvent(Error(`Layer with id "${n}" does not exist on this map.`))):(this._order.splice(s,0,r),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(r){this._checkLoaded();const n=this._layers[r];if(!n)return void this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be removed.`)));n.setEventedParent(null),this._updateLayerCount(n,!1);const o=this._order.indexOf(r);this._order.splice(o,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=n,delete this._layers[r],delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],n.onRemove&&n.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(i){return this._layers[i]}hasLayer(i){return i in this._layers}hasLayerType(i){for(const r in this._layers)if(this._layers[r].type===i)return!0;return!1}setLayerZoomRange(r,n,o){this._checkLoaded();const s=this.getLayer(r);s?s.minzoom===n&&s.maxzoom===o||(null!=n&&(s.minzoom=n),null!=o&&(s.maxzoom=o),this._updateLayer(s)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(r,n,o={}){this._checkLoaded();const s=this.getLayer(r);if(s){if(!a(s.filter,n))return null==n?(s.filter=void 0,void this._updateLayer(s)):void(this._validate(i.validateStyle.filter,`layers.${s.id}.filter`,n,{layerType:s.type},o)||(s.filter=i.clone$1(n),this._updateLayer(s)))}else this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be filtered.`)))}getFilter(r){return i.clone$1(this.getLayer(r).filter)}setLayoutProperty(r,n,o,s={}){this._checkLoaded();const l=this.getLayer(r);l?a(l.getLayoutProperty(n),o)||(l.setLayoutProperty(n,o,s),this._updateLayer(l)):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(r,n){const o=this.getLayer(r);if(o)return o.getLayoutProperty(n);this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style.`)))}setPaintProperty(r,n,o,s={}){this._checkLoaded();const l=this.getLayer(r);l?a(l.getPaintProperty(n),o)||(l.setPaintProperty(n,o,s)&&this._updateLayer(l),this._changed=!0,this._updatedPaintProps[r]=!0):this.fire(new i.ErrorEvent(Error(`The layer '${r}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(i,r){return this.getLayer(i).getPaintProperty(r)}setFeatureState(r,n){this._checkLoaded();const o=r.source,s=r.sourceLayer,a=this.getSource(o);if(void 0===a)return void this.fire(new i.ErrorEvent(Error(`The source '${o}' does not exist in the map's style.`)));const l=a.type;if("geojson"===l&&s)return void this.fire(new i.ErrorEvent(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===l&&!s)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided.")));const c=this._getSourceCaches(o);for(const h of c)h.setFeatureState(s,r.id,n)}removeFeatureState(r,n){this._checkLoaded();const o=r.source,s=this.getSource(o);if(void 0===s)return void this.fire(new i.ErrorEvent(Error(`The source '${o}' does not exist in the map's style.`)));const a=s.type,l="vector"===a?r.sourceLayer:void 0;if("vector"===a&&!l)return void this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&"string"!=typeof r.id&&"number"!=typeof r.id)return void this.fire(new i.ErrorEvent(Error("A feature id is required to remove its specific state property.")));const c=this._getSourceCaches(o);for(const h of c)h.removeFeatureState(l,r.id,n)}getFeatureState(r){this._checkLoaded();const n=r.source,o=r.sourceLayer,s=this.getSource(n);if(void 0!==s){if("vector"!==s.type||o)return void 0===r.id&&this.fire(new i.ErrorEvent(Error("The feature id parameter must be provided."))),this._getSourceCaches(n)[0].getFeatureState(o,r.id);this.fire(new i.ErrorEvent(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const r={};for(const n in this._sourceCaches){const o=this._sourceCaches[n].getSource();r[o.id]||(r[o.id]=o.serialize())}return i.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:r,layers:this._serializeLayers(this._order)},i=>void 0!==i)}_updateLayer(i){this._updatedLayers[i.id]=!0;const r=this._getLayerSourceCache(i);i.source&&!this._updatedSources[i.source]&&r&&"raster"!==r.getSource().type&&(this._updatedSources[i.source]="reload",r.pause()),this._changed=!0,i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){var r,n;const o={},s=[];for(let a=this._order.length-1;a>=0;a--){const l=this._order[a];if(r=l,"fill-extrusion"===this._layers[r].type)for(const c of(o[l]=a,i)){const h=c[l];if(h)for(const u of h)s.push(u)}}s.sort((i,r)=>r.intersectionZ-i.intersectionZ);const d=[];for(let p=this._order.length-1;p>=0;p--){const f=this._order[p];if(n=f,"fill-extrusion"===this._layers[n].type)for(let m=s.length-1;m>=0;m--){const $=s[m].feature;if(o[$.layer.id]{const r=this.getLayer(i);return r&&r.is3D()}):this.has3DLayers(),u=e$.createFromScreenPoints(r,o);for(const d in this._sourceCaches){const p=this._sourceCaches[d].getSource().id;n.layers&&!s[p]||c.push(eM(this._sourceCaches[d],this._layers,this._serializedLayers,u,n,o,h,!!this.map._showQueryGeometry))}return this.placement&&c.push(function(i,r,n,o,s,a,l){const c={},h=a.queryRenderedSymbols(o),u=[];for(const d of Object.keys(h).map(Number))u.push(l[d]);for(const p of(u.sort(eC),u)){const f=p.featureIndex.lookupSymbolFeatures(h[p.bucketInstanceId],r,p.bucketIndex,p.sourceLayerIndex,s.filter,s.layers,s.availableImages,i);for(const m in f){const $=c[m]=c[m]||[],g=f[m];for(const y of(g.sort((i,r)=>{const n=p.featureSortOrder;if(n){const o=n.indexOf(i.featureIndex);return n.indexOf(r.featureIndex)-o}return r.featureIndex-i.featureIndex}),g))$.push(y)}}for(const x in c)c[x].forEach(r=>{const o=r.feature,s=n(i[x]).getFeatureState(o.layer["source-layer"],o.id);o.source=o.layer.source,o.layer["source-layer"]&&(o.sourceLayer=o.layer["source-layer"]),o.state=s});return c}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),u.screenGeometry,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}querySourceFeatures(r,n){n&&n.filter&&this._validate(i.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const o=this._getSourceCaches(r);let s=[];for(const a of o)s=s.concat(eA(a,n));return s}addSourceType(i,r,n){return tE.getSourceType(i)?n(Error(`A source type called "${i}" already exists.`)):(tE.setSourceType(i,r),r.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:i,url:r.workerSourceURL},n):n(null,null))}getLight(){return this.light.getLight()}setLight(r,n={}){this._checkLoaded();const o=this.light.getLight();let s=!1;for(const l in r)if(!a(r[l],o[l])){s=!0;break}if(!s)return;const c={now:i.exported.now(),transition:i.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(r,n),this.light.updateTransitions(c)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(r,n=1){if(this._checkLoaded(),!r)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);if(1===n){if("object"==typeof r.source){const o="terrain-dem-src";this.addSource(o,r.source),r=i.clone$1(r),r=i.extend(r,{source:o})}if(this._validate(i.validateStyle.terrain,"terrain",r))return}if(!this.terrain||this.terrain&&n!==this.terrain.drapeRenderMode)this._createTerrain(r,n);else{const s=this.terrain,l=s.get();for(const c in r)if(!a(r[c],l[c])){s.set(r),this.stylesheet.terrain=r;const h={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};s.updateTransitions(h);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(r){const n=this.fog=new I(r,this.map.transform);this.stylesheet.fog=r;const o={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(o)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(const i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),!r)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const n=this.fog,o=n.get();for(const s in r)if(!a(r[s],o[s])){n.set(r),this.stylesheet.fog=r;const l={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};n.updateTransitions(l);break}}else this._createFog(r);this._markersNeedUpdate=!0}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const i=this._order.filter(i=>this.isLayerDraped(this._layers[i])),r=this._order.filter(i=>!this.isLayerDraped(this._layers[i]));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...r)}_createTerrain(r,n){const o=this.terrain=new b(r,n);this.stylesheet.terrain=r,this.dispatcher.broadcast("enableTerrain",!0),this._force3DLayerUpdate();const s={now:i.exported.now(),transition:i.extend({duration:0},this.stylesheet.transition)};o.updateTransitions(s)}_force3DLayerUpdate(){for(const i in this._layers){const r=this._layers[i];"fill-extrusion"===r.type&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(const i in this._layers){const r=this._layers[i];"symbol"===r.type&&this._updateLayer(r)}}_validate(r,n,o,s,a={}){return(!a||!1!==a.validate)&&tx(this,r.call(i.validateStyle,i.extend({key:n,style:this.serialize(),value:o,styleSpec:i.spec},s)))}_remove(){for(const r in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[r].setEventedParent(null);for(const n in this._sourceCaches)this._sourceCaches[n].clearTiles(),this._sourceCaches[n].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(i){const r=this._getSourceCaches(i);for(const n of r)n.clearTiles()}_reloadSource(i){const r=this._getSourceCaches(i);for(const n of r)n.resume(),n.reload()}_updateSources(i){for(const r in this._sourceCaches)this._sourceCaches[r].update(i)}_generateCollisionBoxes(){for(const i in this._sourceCaches){const r=this._sourceCaches[i];r.resume(),r.reload()}}_updatePlacement(r,n,o,s,a=!1){let l=!1,c=!1;const h={};for(const u of this._order){const d=this._layers[u];if("symbol"!==d.type)continue;if(!h[d.source]){const p=this._getLayerSourceCache(d);if(!p)continue;h[d.source]=p.getRenderableIds(!0).map(i=>p.getTileByID(i)).sort((i,r)=>r.tileID.overscaledZ-i.tileID.overscaledZ||(i.tileID.isLessThan(r.tileID)?-1:1))}const f=this.crossTileSymbolIndex.addLayer(d,h[d.source],r.center.lng,r.projection);l=l||f}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||0===o,this._layerOrderChanged&&this.fire(new i.Event("neworder")),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),r.zoom))&&(this.pauseablePlacement=new tp(r,this._order,a,n,o,s,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,h),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),c=!0),l&&this.pauseablePlacement.placement.setStale()),c||l)for(const m of this._order){const $=this._layers[m];"symbol"===$.type&&this.placement.updateLayerOpacities($,h[$.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}_releaseSymbolFadeTiles(){for(const i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}getImages(i,r,n){this.imageManager.getImages(r.icons,n),this._updateTilesForChangedImages();const o=i=>{i&&i.setDependencies(r.tileID.key,r.type,r.icons)};o(this._otherSourceCaches[r.source]),o(this._symbolSourceCaches[r.source])}getGlyphs(i,r,n){this.glyphManager.getGlyphs(r.stacks,n)}getResource(r,n,o){return i.makeRequest(n,o)}_getSourceCache(i){return this._otherSourceCaches[i]}_getLayerSourceCache(i){return"symbol"===i.type?this._symbolSourceCaches[i.source]:this._otherSourceCaches[i.source]}_getSourceCaches(i){const r=[];return this._otherSourceCaches[i]&&r.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&r.push(this._symbolSourceCaches[i]),r}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)}}tE.getSourceType=function(i){return eE[i]},tE.setSourceType=function(i,r){eE[i]=r},tE.registerForPluginStateChange=i.registerForPluginStateChange;var tS="\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",tI="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 tM={},tA={};tM=tP("","\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),tA=tP("#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 tC=tP("\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."),tz=tS;var tk={background:tP("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:tP("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:tP("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:tP("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:tP("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:tP("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:tP("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:tP("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:tP("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:tP("#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:tP("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:tP("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:tP("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:tP("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:tP("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:tP("#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:tP("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:tP("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:tP("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:tP("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:tP("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:tP("#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:tP("#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:tP("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:tP("#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:tP("\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}",tI),skyboxGradient:tP("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}",tI),skyboxCapture:tP("\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:tP("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:tP("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 tP(i,r,n){const o=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=/uniform (highp |mediump |lowp )?([\w]+) ([\w]+)([\s]*)([\w]*)/g,a=r.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),l=i.match(s),c=r.match(s),h=tS.match(s);let u=c?c.concat(l):l;n||(tM.staticUniforms&&(u=tM.staticUniforms.concat(u)),tA.staticUniforms&&(u=tA.staticUniforms.concat(u))),u&&(u=u.concat(h));const d={};return{fragmentSource:i=i.replace(o,(i,r,n,o,s)=>(d[s]=!0,"define"===r?` #ifndef HAS_UNIFORM_u_${s} varying ${n} ${o} ${s}; #else @@ -54,7 +54,7 @@ uniform ${n} ${o} u_${s}; #else ${n} ${o} ${s} = u_${s}; #endif -`}),staticAttributes:a,staticUniforms:u}}class e4{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(i,r,n,o,s,a,l,c){this.context=i;let h=this.boundPaintVertexBuffers.length!==o.length;for(let u=0;!h&&u{const a=o.paint.get("hillshade-shadow-color"),l=o.paint.get("hillshade-highlight-color"),c=o.paint.get("hillshade-accent-color");let h=o.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===o.paint.get("hillshade-illumination-anchor")&&(h-=r.transform.angle);const u=!r.options.moving;return{u_matrix:s||r.transform.calculateProjMatrix(n.tileID.toUnwrapped(),u),u_image:0,u_latrange:function(r,n){const o=Math.pow(2,n.canonical.z),s=n.canonical.y;return[new i.MercatorCoordinate(0,s/o).toLngLat().lat,new i.MercatorCoordinate(0,(s+1)/o).toLngLat().lat,]}(0,n.tileID),u_light:[o.paint.get("hillshade-exaggeration"),h,],u_shadow:a,u_highlight:l,u_accent:c}})(r,o,s,r.terrain?n.projMatrix:null);r.prepareDrawProgram(h,p,n.toUnwrapped());const{tileBoundsBuffer:m,tileBoundsIndexBuffer:$,tileBoundsSegments:g}=r.getTileBoundsBuffers(o);p.draw(h,u.TRIANGLES,a,l,c,i.CullFaceMode.disabled,f,s.id,m,$,g)}function e8(r,n,o){if(!n.needsDEMTextureUpload)return;const s=r.context,a=s.gl;s.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||r.getTileTexture(o.stride);const l=o.getPixels();n.demTexture?n.demTexture.update(l,{premultiply:!1}):n.demTexture=new i.Texture(s,l,a.RGBA,{premultiply:!1}),n.needsDEMTextureUpload=!1}function e9(r,n,o,s,a,l){const c=r.context,h=c.gl;if(!n.dem)return;const u=n.dem;if(c.activeTexture.set(h.TEXTURE1),e8(r,n,u),!n.demTexture)return;n.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);const d=u.dim;c.activeTexture.set(h.TEXTURE0);let p=n.fbo;if(!p){const f=new i.Texture(c,{width:d,height:d,data:null},h.RGBA);f.bind(h.LINEAR,h.CLAMP_TO_EDGE),(p=n.fbo=c.createFramebuffer(d,d,!0)).colorAttachment.set(f.texture)}c.bindFramebuffer.set(p.framebuffer),c.viewport.set([0,0,d,d]);const{tileBoundsBuffer:m,tileBoundsIndexBuffer:$,tileBoundsSegments:g}=r.getMercatorTileBoundsBuffers();r.useProgram("hillshadePrepare").draw(c,h.TRIANGLES,s,a,l,i.CullFaceMode.disabled,((r,n)=>{const o=n.stride,s=i.create();return i.ortho(s,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(s,s,[0,-i.EXTENT,0]),{u_matrix:s,u_image:1,u_dimension:[o,o],u_zoom:r.overscaledZ,u_unpack:n.unpackVector}})(n.tileID,u),o.id,m,$,g),n.needsHillshadePrepare=!1}const e7=(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image0:new i.Uniform1i(r,n.u_image0),u_skirt_height:new i.Uniform1f(r,n.u_skirt_height)}),te=(i,r)=>({u_matrix:i,u_image0:0,u_skirt_height:r}),tt=(i,r,n,o,s)=>({u_proj_matrix:Float32Array.from(i),u_globe_matrix:r,u_merc_matrix:n,u_zoom_transition:o,u_merc_center:s,u_image0:0});function ti(i,r){return null!=i&&null!=r&&!(!i.hasData()||!r.hasData())&&null!=i.demTexture&&null!=r.demTexture&&i.tileID.key!==r.tileID.key}const tr=new class{constructor(){this.operations={}}newMorphing(i,r,n,o,s){if(i in this.operations){const a=this.operations[i];a.to.tileID.key!==n.tileID.key&&(a.queued=n)}else this.operations[i]={startTime:o,phase:0,duration:s,from:r,to:n,queued:null}}getMorphValuesForProxy(i){if(!(i in this.operations))return null;const r=this.operations[i];return{from:r.from,to:r.to,phase:r.phase}}update(i){for(const r in this.operations){const n=this.operations[r];for(n.phase=(i-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,i)){delete this.operations[r];break}}}_nextOp(i,r){return!!i.queued&&(i.from=i.to,i.to=i.queued,i.queued=null,i.phase=0,i.startTime=r,!0)}_validOp(i){return i.from.hasData()&&i.to.hasData()}},tn={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function to(i,r){const n=1<({u_matrix:i});function ta(r,n,o,s,a){if(a>0){const l=i.exported.now(),c=(l-r.timeAdded)/a,h=n?(l-n.timeAdded)/a:-1,u=o.getSource(),d=s.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),p=!n||Math.abs(n.tileID.overscaledZ-d)>Math.abs(r.tileID.overscaledZ-d),f=p&&r.refreshedUponExpiration?1:i.clamp(p?c:1-h,0,1);return r.refreshedUponExpiration&&c>=1&&(r.refreshedUponExpiration=!1),n?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}class tl extends i.SourceCache{constructor(i){const r={type:"raster-dem",maxzoom:i.transform.maxZoom},n=new M(et(),null),o=q("mock-dem",r,n,i.style);super("mock-dem",o,!1),o.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,r){i.state="loaded",r(null)}}class tc extends i.SourceCache{constructor(i){const r=q("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},new M(et(),null),i.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,n,o){if(r.freezeTileCoverage)return;this.transform=r;const s=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((n,o)=>{if(n[o.key]="",!this._tiles[o.key]){const s=new i.Tile(o,this._source.tileSize*o.overscaleFactor(),r.tileZoom);s.state="loaded",this._tiles[o.key]=s}return n},{});for(const a in this._tiles)a in s||(this.freeFBO(a),this._tiles[a].unloadVectorData(),delete this._tiles[a])}freeFBO(i){const r=this.proxyCachedFBO[i];if(void 0!==r){const n=Object.values(r);this.renderCachePool.push(...n),delete this.proxyCachedFBO[i]}}deallocRenderCache(){this.renderCache.forEach(i=>i.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class th extends i.OverscaledTileID{constructor(i,r,n){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=r,this.projMatrix=n}}class tu extends i.Elevation{constructor(r,n){super(),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[o,s,a]=function(r){const n=new i.StructArrayLayout4i8,o=new i.StructArrayLayout3ui6;n.reserve(17161),o.reserve(33800);const s=i.EXTENT/128,a=i.EXTENT+s/2,l=a+s;for(let c=-s;ca||c<0||c>a?24575:0,d=i.clamp(Math.round(h),0,i.EXTENT),p=i.clamp(Math.round(c),0,i.EXTENT);n.emplaceBack(d+u,p,d,p)}const f=(i,r)=>{const n=131*r+i;o.emplaceBack(n+1,n,n+131),o.emplaceBack(n+131,n+131+1,n+1)};for(let m=1;m<129;m++)for(let $=1;$<129;$++)f($,m);return[0,129].forEach(i=>{for(let r=0;r<130;r++)f(r,i),f(i,r)}),[n,o,32768]}(),l=r.context;this.gridBuffer=l.createVertexBuffer(o,i.boundsAttributes.members),this.gridIndexBuffer=l.createIndexBuffer(s),this.gridSegments=i.SegmentVector.simpleSegment(0,0,o.length,s.length),this.gridNoSkirtSegments=i.SegmentVector.simpleSegment(0,0,o.length,a),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new tc(n.map),this.orthoMatrix=i.create(),i.ortho(this.orthoMatrix,0,i.EXTENT,0,i.EXTENT,0,1);const c=l.gl;this._overlapStencilMode=new i.StencilMode({func:c.GEQUAL,mask:255},0,255,c.KEEP,c.KEEP,c.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new tl(n.map)}set style(i){i.on("data",this._onStyleDataEvent.bind(this)),i.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=i,this._checkRenderCacheEfficiency()}update(r,n,o){if(r&&r.terrain){this._style!==r&&(this.style=r),this.enabled=!0;const s=r.terrain.properties;this.sourceCache=0===r.terrain.drapeRenderMode?this._mockSourceCache:r._getSourceCache(s.get("source")),this._exaggeration=s.get("exaggeration");const a=()=>{this.sourceCache.used&&i.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. +`}),staticAttributes:a,staticUniforms:u}}class tD{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(i,r,n,o,s,a,l,c){this.context=i;let h=this.boundPaintVertexBuffers.length!==o.length;for(let u=0;!h&&u{const a=o.paint.get("hillshade-shadow-color"),l=o.paint.get("hillshade-highlight-color"),c=o.paint.get("hillshade-accent-color");let h=o.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===o.paint.get("hillshade-illumination-anchor")&&(h-=r.transform.angle);const u=!r.options.moving;return{u_matrix:s||r.transform.calculateProjMatrix(n.tileID.toUnwrapped(),u),u_image:0,u_latrange:function(r,n){const o=Math.pow(2,n.canonical.z),s=n.canonical.y;return[new i.MercatorCoordinate(0,s/o).toLngLat().lat,new i.MercatorCoordinate(0,(s+1)/o).toLngLat().lat,]}(0,n.tileID),u_light:[o.paint.get("hillshade-exaggeration"),h,],u_shadow:a,u_highlight:l,u_accent:c}})(r,o,s,r.terrain?n.projMatrix:null);r.prepareDrawProgram(h,p,n.toUnwrapped());const{tileBoundsBuffer:m,tileBoundsIndexBuffer:$,tileBoundsSegments:g}=r.getTileBoundsBuffers(o);p.draw(h,u.TRIANGLES,a,l,c,i.CullFaceMode.disabled,f,s.id,m,$,g)}function tB(r,n,o){if(!n.needsDEMTextureUpload)return;const s=r.context,a=s.gl;s.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||r.getTileTexture(o.stride);const l=o.getPixels();n.demTexture?n.demTexture.update(l,{premultiply:!1}):n.demTexture=new i.Texture(s,l,a.RGBA,{premultiply:!1}),n.needsDEMTextureUpload=!1}function tR(r,n,o,s,a,l){const c=r.context,h=c.gl;if(!n.dem)return;const u=n.dem;if(c.activeTexture.set(h.TEXTURE1),tB(r,n,u),!n.demTexture)return;n.demTexture.bind(h.NEAREST,h.CLAMP_TO_EDGE);const d=u.dim;c.activeTexture.set(h.TEXTURE0);let p=n.fbo;if(!p){const f=new i.Texture(c,{width:d,height:d,data:null},h.RGBA);f.bind(h.LINEAR,h.CLAMP_TO_EDGE),(p=n.fbo=c.createFramebuffer(d,d,!0)).colorAttachment.set(f.texture)}c.bindFramebuffer.set(p.framebuffer),c.viewport.set([0,0,d,d]);const{tileBoundsBuffer:m,tileBoundsIndexBuffer:$,tileBoundsSegments:g}=r.getMercatorTileBoundsBuffers();r.useProgram("hillshadePrepare").draw(c,h.TRIANGLES,s,a,l,i.CullFaceMode.disabled,((r,n)=>{const o=n.stride,s=i.create();return i.ortho(s,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(s,s,[0,-i.EXTENT,0]),{u_matrix:s,u_image:1,u_dimension:[o,o],u_zoom:r.overscaledZ,u_unpack:n.unpackVector}})(n.tileID,u),o.id,m,$,g),n.needsHillshadePrepare=!1}const tF=(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image0:new i.Uniform1i(r,n.u_image0),u_skirt_height:new i.Uniform1f(r,n.u_skirt_height)}),tO=(i,r)=>({u_matrix:i,u_image0:0,u_skirt_height:r}),tU=(i,r,n,o,s)=>({u_proj_matrix:Float32Array.from(i),u_globe_matrix:r,u_merc_matrix:n,u_zoom_transition:o,u_merc_center:s,u_image0:0});function tV(i,r){return null!=i&&null!=r&&!(!i.hasData()||!r.hasData())&&null!=i.demTexture&&null!=r.demTexture&&i.tileID.key!==r.tileID.key}const tN=new class{constructor(){this.operations={}}newMorphing(i,r,n,o,s){if(i in this.operations){const a=this.operations[i];a.to.tileID.key!==n.tileID.key&&(a.queued=n)}else this.operations[i]={startTime:o,phase:0,duration:s,from:r,to:n,queued:null}}getMorphValuesForProxy(i){if(!(i in this.operations))return null;const r=this.operations[i];return{from:r.from,to:r.to,phase:r.phase}}update(i){for(const r in this.operations){const n=this.operations[r];for(n.phase=(i-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,i)){delete this.operations[r];break}}}_nextOp(i,r){return!!i.queued&&(i.from=i.to,i.to=i.queued,i.queued=null,i.phase=0,i.startTime=r,!0)}_validOp(i){return i.from.hasData()&&i.to.hasData()}},tj={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function tG(i,r){const n=1<({u_matrix:i});function t_(r,n,o,s,a){if(a>0){const l=i.exported.now(),c=(l-r.timeAdded)/a,h=n?(l-n.timeAdded)/a:-1,u=o.getSource(),d=s.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),p=!n||Math.abs(n.tileID.overscaledZ-d)>Math.abs(r.tileID.overscaledZ-d),f=p&&r.refreshedUponExpiration?1:i.clamp(p?c:1-h,0,1);return r.refreshedUponExpiration&&c>=1&&(r.refreshedUponExpiration=!1),n?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}class tq extends i.SourceCache{constructor(i){const r={type:"raster-dem",maxzoom:i.transform.maxZoom},n=new M(eL(),null),o=eS("mock-dem",r,n,i.style);super("mock-dem",o,!1),o.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,r){i.state="loaded",r(null)}}class tX extends i.SourceCache{constructor(i){const r=eS("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},new M(eL(),null),i.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,n,o){if(r.freezeTileCoverage)return;this.transform=r;const s=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((n,o)=>{if(n[o.key]="",!this._tiles[o.key]){const s=new i.Tile(o,this._source.tileSize*o.overscaleFactor(),r.tileZoom);s.state="loaded",this._tiles[o.key]=s}return n},{});for(const a in this._tiles)a in s||(this.freeFBO(a),this._tiles[a].unloadVectorData(),delete this._tiles[a])}freeFBO(i){const r=this.proxyCachedFBO[i];if(void 0!==r){const n=Object.values(r);this.renderCachePool.push(...n),delete this.proxyCachedFBO[i]}}deallocRenderCache(){this.renderCache.forEach(i=>i.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class tW extends i.OverscaledTileID{constructor(i,r,n){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=r,this.projMatrix=n}}class tH extends i.Elevation{constructor(r,n){super(),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[o,s,a]=function(r){const n=new i.StructArrayLayout4i8,o=new i.StructArrayLayout3ui6;n.reserve(17161),o.reserve(33800);const s=i.EXTENT/128,a=i.EXTENT+s/2,l=a+s;for(let c=-s;ca||c<0||c>a?24575:0,d=i.clamp(Math.round(h),0,i.EXTENT),p=i.clamp(Math.round(c),0,i.EXTENT);n.emplaceBack(d+u,p,d,p)}const f=(i,r)=>{const n=131*r+i;o.emplaceBack(n+1,n,n+131),o.emplaceBack(n+131,n+131+1,n+1)};for(let m=1;m<129;m++)for(let $=1;$<129;$++)f($,m);return[0,129].forEach(i=>{for(let r=0;r<130;r++)f(r,i),f(i,r)}),[n,o,32768]}(),l=r.context;this.gridBuffer=l.createVertexBuffer(o,i.boundsAttributes.members),this.gridIndexBuffer=l.createIndexBuffer(s),this.gridSegments=i.SegmentVector.simpleSegment(0,0,o.length,s.length),this.gridNoSkirtSegments=i.SegmentVector.simpleSegment(0,0,o.length,a),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new tX(n.map),this.orthoMatrix=i.create(),i.ortho(this.orthoMatrix,0,i.EXTENT,0,i.EXTENT,0,1);const c=l.gl;this._overlapStencilMode=new i.StencilMode({func:c.GEQUAL,mask:255},0,255,c.KEEP,c.KEEP,c.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new tq(n.map)}set style(i){i.on("data",this._onStyleDataEvent.bind(this)),i.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=i,this._checkRenderCacheEfficiency()}update(r,n,o){if(r&&r.terrain){this._style!==r&&(this.style=r),this.enabled=!0;const s=r.terrain.properties;this.sourceCache=0===r.terrain.drapeRenderMode?this._mockSourceCache:r._getSourceCache(s.get("source")),this._exaggeration=s.get("exaggeration");const a=()=>{this.sourceCache.used&&i.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 r=this.getScaledDemTileSize();this.sourceCache.update(n,r,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,a(),this._initializing=!0),a(),n.updateElevation(!o),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(i){this._findCoveringTileCache[i]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const r=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==r.efficiency&&i.warnOnce(`Terrain render cache efficiency is not optimal (${r.efficiency}%) and performance may be affected negatively, consider placing all background, fill and line layers before layer - with id '${r.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(i){i.coord&&"source"===i.dataType?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):"style"===i.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const i in this._style._sourceCaches)this._style._sourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(i=>i.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 i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,o=this.painter.transform;this._initializing&&(this._initializing=0===o._centerAltitude&&-1===this.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(o.center),-1),this._emptyDEMTextureDirty=!this._initializing);const s=this.proxyCoords=n.getIds().map(i=>{const r=n.getTileByID(i).tileID;return r.projMatrix=o.calculateProjMatrix(r.toUnwrapped()),r});(function(r,n){const o=n.transform.pointCoordinate(n.transform.getCameraPoint()),s=new i.pointGeometry(o.x,o.y);r.sort((r,n)=>{if(n.overscaledZ-r.overscaledZ)return n.overscaledZ-r.overscaledZ;const o=new i.pointGeometry(r.canonical.x+(1<{this.proxyToSource[i.key]={}}),this.terrainTileForTile={};const l=this._style._sourceCaches;for(const c in l){const h=l[c];if(!h.used||(h!==this.sourceCache&&this.resetTileLookupCache(h.id),this._setupProxiedCoordsForOrtho(h,r[c],a),h.usedForTerrain))continue;const u=r[c];h.getSource().reparseOverscaled&&this._assignTerrainTiles(u)}this.proxiedCoords[n.id]=s.map(i=>new th(i,i.key,this.orthoMatrix)),this._assignTerrainTiles(s),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(a),this.renderingToTexture=!1,this._updateTimestamp=i.exported.now();const d={};for(const p of(this._visibleDemTiles=[],this.proxyCoords)){const f=this.terrainTileForTile[p.key];if(!f)continue;const m=f.tileID.key;m in d||(this._visibleDemTiles.push(f),d[m]=m)}}_assignTerrainTiles(i){this._initializing||i.forEach(i=>{if(this.terrainTileForTile[i.key])return;const r=this._findTileCoveringTileID(i,this.sourceCache);r&&(this.terrainTileForTile[i.key]=r)})}_prepareDEMTextures(){const i=this.painter.context,r=i.gl;for(const n in this.terrainTileForTile){const o=this.terrainTileForTile[n],s=o.dem;s&&(!o.demTexture||o.needsDEMTextureUpload)&&(i.activeTexture.set(r.TEXTURE1),e8(this.painter,o,s))}}_prepareDemTileUniforms(i,r,n,o){if(!r||null==r.demTexture)return!1;const s=i.tileID.canonical,a=Math.pow(2,r.tileID.canonical.z-s.z),l=o||"";return n[`u_dem_tl${l}`]=[s.x*a%1,s.y*a%1,],n[`u_dem_scale${l}`]=a,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const r=this.painter.context,n=r.gl;if(!this._emptyDepthBufferTexture){const o={width:1,height:1,data:new Uint8Array([255,255,255,255,])};this._emptyDepthBufferTexture=new i.Texture(r,o,n.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let i=0;const r=this._visibleDemTiles.reduce((r,n)=>{if(!n.dem)return r;const o=n.dem.tree.minimums[0];return o>0&&i++,r+o},0);return i?r/i:0}_updateEmptyDEMTexture(){const r=this.painter.context,n=r.gl;r.activeTexture.set(n.TEXTURE2);const o=this._getLoadedAreaMinimum(),s={width:1,height:1,data:new Uint8Array(i.DEMData.pack(o,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;let a=this._emptyDEMTexture;return a?a.update(s,{premultiply:!1}):a=this._emptyDEMTexture=new i.Texture(r,s,n.RGBA,{premultiply:!1}),a}setupElevationDraw(r,n,o){var s;const a=this.painter.context,l=a.gl,c=(s=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:i.DEMData.getUnpackVector(s),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 h=this.painter.transform,u=h.projection.createTileTransform(h,h.worldSize),d=r.tileID.canonical;c.u_tile_tl_up=u.upVector(d,0,0),c.u_tile_tr_up=u.upVector(d,i.EXTENT,0),c.u_tile_br_up=u.upVector(d,i.EXTENT,i.EXTENT),c.u_tile_bl_up=u.upVector(d,0,i.EXTENT),c.u_tile_up_scale=u.upVectorScale(d);let p=null,f=null,m=1;if(o&&o.morphing&&this._useVertexMorphing){const $=o.morphing.srcDemTile,g=o.morphing.dstDemTile;m=o.morphing.phase,$&&g&&(this._prepareDemTileUniforms(r,$,c,"_prev")&&(f=$),this._prepareDemTileUniforms(r,g,c)&&(p=g))}if(f&&p?(a.activeTexture.set(l.TEXTURE2),p.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),a.activeTexture.set(l.TEXTURE4),f.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),c.u_dem_lerp=m):(p=this.terrainTileForTile[r.tileID.key],a.activeTexture.set(l.TEXTURE2),(this._prepareDemTileUniforms(r,p,c)?p.demTexture:this.emptyDEMTexture).bind(l.NEAREST,l.CLAMP_TO_EDGE)),a.activeTexture.set(l.TEXTURE3),o&&o.useDepthForOcclusion?(this._depthTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height,]):(this.emptyDepthBufferTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.u_depth_size_inv=[1,1]),o&&o.useMeterToDem&&p){const y=(1<{if(u===i)return;const o=[];n&&o.push(tn[d]),o.push(tn[i]),o.push("PROJECTION_GLOBE_VIEW"),h=r.useProgram("globeRaster",null,o),u=i},f=r.colorModeForRenderPass(),m=new i.DepthMode(c.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tr.update(a);const $=r.transform,g=i.calculateGlobeMatrix($,$.worldSize),y=i.calculateGlobeMercatorMatrix($),x=[i.mercatorXfromLng($.center.lng),i.mercatorYfromLat($.center.lat),],v=r.globeSharedBuffers;(d?[!1,!0]:[!1]).forEach(d=>{u=-1;const b=d?c.LINES:c.TRIANGLES;for(const w of s){const T=o.getTile(w),E=Math.pow(2,w.canonical.z),[S,I]=i.globeBuffersForTileMesh(r,T,w,E),M=i.StencilMode.disabled,A=n.prevTerrainTileForTile[w.key],C=n.terrainTileForTile[w.key];ti(A,C)&&tr.newMorphing(w.key,A,C,a,250),l.activeTexture.set(c.TEXTURE0),T.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);const z=tr.getMorphValuesForProxy(w.key),k=z?1:0,P={};z&&i.extend$1(P,{morphing:{srcDemTile:z.from,dstDemTile:z.to,phase:i.easeCubicInOut(z.phase)}});const D=i.globeMatrixForTile(w.canonical,g),L=tt($.projMatrix,D,y,i.globeToMercatorTransition($.zoom),x);if(p(k,d),n.setupElevationDraw(T,h,P),r.prepareDrawProgram(l,h,w.toUnwrapped()),v){const[B,R]=d?v.getWirefameBuffer(r.context):[v.gridIndexBuffer,v.gridSegments,];h.draw(l,b,m,M,f,i.CullFaceMode.backCCW,L,"globe_raster",S,B,R)}if(!d){const F=[0===w.canonical.y?i.globePoleMatrixForTile(w.canonical,!1,$):null,w.canonical.y===E-1?i.globePoleMatrixForTile(w.canonical,!0,$):null,];for(const O of F){if(!O)continue;const U=tt($.projMatrix,O,O,0,x);v&&h.draw(l,b,m,M,f,i.CullFaceMode.disabled,U,"globe_pole_raster",I,v.poleIndexBuffer,v.poleSegments)}}}})}(r,n,o,s,a);else{const l=r.context,c=l.gl;let h,u;const d=r.options.showTerrainWireframe?2:0,p=(i,n)=>{if(u===i)return;const o=[tn[i]];n&&o.push(tn[d]),h=r.useProgram("terrainRaster",null,o),u=i},f=r.colorModeForRenderPass(),m=new i.DepthMode(c.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tr.update(a);const $=r.transform,g=6*Math.pow(1.5,22-$.zoom)*n.exaggeration();(d?[!1,!0]:[!1]).forEach(d=>{u=-1;const y=d?c.LINES:c.TRIANGLES,[x,v]=d?n.getWirefameBuffer():[n.gridIndexBuffer,n.gridSegments,];for(const b of s){const w=o.getTile(b),T=i.StencilMode.disabled,E=n.prevTerrainTileForTile[b.key],S=n.terrainTileForTile[b.key];ti(E,S)&&tr.newMorphing(b.key,E,S,a,250),l.activeTexture.set(c.TEXTURE0),w.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST);const I=tr.getMorphValuesForProxy(b.key),M=I?1:0;let A;I&&(A={morphing:{srcDemTile:I.from,dstDemTile:I.to,phase:i.easeCubicInOut(I.phase)}});const C=te(b.projMatrix,to(b.canonical,$.renderWorldCopies)?g/10:g);p(M,d),n.setupElevationDraw(w,h,A),r.prepareDrawProgram(l,h,b.toUnwrapped()),h.draw(l,y,m,T,f,i.CullFaceMode.backCCW,C,"terrain_raster",n.gridBuffer,x,v)}})}}(n,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,r.splice(0,r.length))}renderBatch(r){if(0===this._drapedRenderBatches.length)return r+1;this.renderingToTexture=!0;const n=this.painter,o=this.painter.context,s=this.proxySourceCache,a=this.proxiedCoords[s.id],l=this._drapedRenderBatches.shift(),c=[],h=n.style.order;let u=0;for(const d of a){const p=s.getTileByID(d.proxyTileKey),f=s.proxyCachedFBO[d.key]?s.proxyCachedFBO[d.key][r]:void 0,m=void 0!==f?s.renderCache[f]:this.pool[u++],$=void 0!==f;if(p.texture=m.tex,$&&!m.dirty){c.push(p.tileID);continue}let g;o.bindFramebuffer.set(m.fb.framebuffer),this.renderedToTile=!1,m.dirty&&(o.clear({color:i.Color.transparent,stencil:0}),m.dirty=!1);for(let y=l.start;y<=l.end;++y){const x=n.style._layers[h[y]];if(x.isHidden(n.transform.zoom))continue;const v=n.style._getLayerSourceCache(x),b=v?this.proxyToSource[d.key][v.id]:[d];if(!b)continue;const w=b;o.viewport.set([0,0,m.fb.width,m.fb.height,]),g!==(v?v.id:null)&&(this._setupStencil(m,b,x,v),g=v?v.id:null),n.renderLayer(n,v,x,w)}this.renderedToTile?(m.dirty=!0,c.push(p.tileID)):$||--u,5===u&&(u=0,this.renderToBackBuffer(c))}return this.renderToBackBuffer(c),this.renderingToTexture=!1,o.bindFramebuffer.set(null),o.viewport.set([0,0,n.width,n.height]),l.end+1}postRender(){}renderCacheEfficiency(i){const r=i.order.length;if(0===r)return{efficiency:100};let n,o=0,s=0,a=!1;for(let l=0;li.dem).forEach(r=>{i=Math.min(i,r.dem.tree.minimums[0])}),0===i?i:(i-30)*this._exaggeration}raycast(i,r,n){if(!this._visibleDemTiles)return null;const o=this._visibleDemTiles.filter(i=>i.dem).map(o=>{const s=o.tileID,a=Math.pow(2,s.overscaledZ),{x:l,y:c}=s.canonical,h=l/a,u=(l+1)/a,d=c/a,p=(c+1)/a;return{minx:h,miny:d,maxx:u,maxy:p,t:o.dem.tree.raycastRoot(h,d,u,p,i,r,n),tile:o}});for(const s of(o.sort((i,r)=>(null!==i.t?i.t:Number.MAX_VALUE)-(null!==r.t?r.t:Number.MAX_VALUE)),o)){if(null==s.t)break;const a=s.tile.dem.tree.raycast(s.minx,s.miny,s.maxx,s.maxy,i,r,n);if(null!=a)return a}return null}_createFBO(){const r=this.painter.context,n=r.gl,o=this.drapeBufferSize;r.activeTexture.set(n.TEXTURE0);const s=new i.Texture(r,{width:o[0],height:o[1],data:null},n.RGBA);s.bind(n.LINEAR,n.CLAMP_TO_EDGE);const a=r.createFramebuffer(o[0],o[1],!1);return a.colorAttachment.set(s.texture),a.depthAttachment=new B(r,a.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,o[0],o[1]),this._stencilRef=0,a.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):a.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&!r.extTextureFilterAnisotropicForceOff&&n.texParameterf(n.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:a,tex:s,dirty:!1}}_initFBOPool(){for(;this.pool.length{const r=this._style._layers[i],n=r.isHidden(this.painter.transform.zoom),o=r.getCrossfadeParameters(),s=!!o&&1!==o.t,a=r.hasTransition();return"custom"!==r.type&&!n&&(s||a)})}_clearRasterFadeFromRenderCache(){let i=!1;for(const r in this._style._sourceCaches)if(this._style._sourceCaches[r]._source instanceof N){i=!0;break}if(i)for(let n=0;nr.renderCachePool.length){const n=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let o=0;o=0;c--){const h=a[c];if(r.getTileByID(h.key),void 0!==r.proxyCachedFBO[h.key]){const u=i[h.key],d=this.proxyToSource[h.key];let p=0;for(const f in d){const m=d[f],$=u[f];if(!$||$.length!==m.length||m.some((i,r)=>i!==$[r]||l[f]&&l[f].hasOwnProperty(i.key))){p=-1;break}++p}for(const g in r.proxyCachedFBO[h.key])r.renderCache[r.proxyCachedFBO[h.key][g]].dirty=p<0||p!==Object.values(u).length}}const y=[...this._drapedRenderBatches];for(const x of(y.sort((i,r)=>r.end-r.start-(i.end-i.start)),y))for(const v of a){if(r.proxyCachedFBO[v.key])continue;let b=r.renderCachePool.pop();void 0===b&&r.renderCache.length<50&&(b=r.renderCache.length,r.renderCache.push(this._createFBO())),void 0!==b&&(r.proxyCachedFBO[v.key]={},r.proxyCachedFBO[v.key][x.start]=b,r.renderCache[b].dirty=!0)}this._tilesDirty={}}_setupStencil(i,r,n,o){if(!o||!this._sourceTilesOverlap[o.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const s=this.painter.context,a=s.gl;if(r.length<=1)return void(this._overlapStencilType=!1);let l;if(n.isTileClipped())l=r.length,this._overlapStencilMode.test={func:a.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>r[r.length-1].overscaledZ))return void(this._overlapStencilType=!1);l=1,this._overlapStencilMode.test={func:a.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+l>255&&(s.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=l,this._overlapStencilMode.ref=this._stencilRef,n.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):i.StencilMode.disabled}_renderTileClippingMasks(r,n){const o=this.painter,s=this.painter.context,a=s.gl;o._tileClippingMaskIDs={},s.setColorMode(i.ColorMode.disabled),s.setDepthMode(i.DepthMode.disabled);const l=o.useProgram("clippingMask");for(const c of r){const h=o._tileClippingMaskIDs[c.key]=--n;l.draw(s,a.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:a.ALWAYS,mask:0},h,255,a.KEEP,a.KEEP,a.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,ts(c.projMatrix),"$clipping",o.tileExtentBuffer,o.quadTriangleIndexBuffer,o.tileExtentSegments)}}pointCoordinate(r){const n=this.painter.transform;if(r.x<0||r.x>n.width||r.y<0||r.y>n.height)return null;const o=[r.x,r.y,1,1];i.transformMat4$1(o,o,n.pixelMatrixInverse),i.scale$1(o,o,1/o[3]),o[0]/=n.worldSize,o[1]/=n.worldSize;const s=n._camera.position,a=i.mercatorZfromAltitude(1,n.center.lat),l=[s[0],s[1],s[2]/a,0],c=i.subtract([],o.slice(0,3),l);i.normalize(c,c);const h=this.raycast(l,c,this._exaggeration);return null!==h&&h?(i.scaleAndAdd(l,l,c,h),l[3]=l[2],l[2]*=a,l):null}drawDepth(){const r=this.painter,n=r.context,o=this.proxySourceCache,s=Math.ceil(r.width),a=Math.ceil(r.height);if(this._depthFBO&&(this._depthFBO.width!==s||this._depthFBO.height!==a)&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){const l=n.gl,c=n.createFramebuffer(s,a,!0);n.activeTexture.set(l.TEXTURE0);const h=new i.Texture(n,{width:s,height:a,data:null},l.RGBA);h.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.colorAttachment.set(h.texture);const u=n.createRenderbuffer(n.gl.DEPTH_COMPONENT16,s,a);c.depthAttachment.set(u),this._depthFBO=c,this._depthTexture=h}n.bindFramebuffer.set(this._depthFBO.framebuffer),n.viewport.set([0,0,s,a]),function(r,n,o,s){if("globe"===r.transform.projection.name)return;const a=r.context,l=a.gl;a.clear({depth:1});const c=r.useProgram("terrainDepth"),h=new i.DepthMode(l.LESS,i.DepthMode.ReadWrite,r.depthRangeFor3D);for(const u of s){const d=o.getTile(u),p=te(u.projMatrix,0);n.setupElevationDraw(d,c),c.draw(a,l.TRIANGLES,h,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.backCCW,p,"terrain_depth",n.gridBuffer,n.gridIndexBuffer,n.gridNoSkirtSegments)}}(r,this,o,this.proxyCoords)}_setupProxiedCoordsForOrtho(i,r,n){if(i.getSource() instanceof Z)return this._setupProxiedCoordsForImageSource(i,r,n);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};const o=this.proxiedCoords[i.id]=[],s=this.proxyCoords;for(let a=0;a(i.min.x=Math.min(i.min.x,r.x-c.x),i.min.y=Math.min(i.min.y,r.y-c.y),i.max.x=Math.max(i.max.x,r.x-c.x),i.max.y=Math.max(i.max.y,r.y-c.y),i),{min:new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=(r,n)=>{const o=r.wrap+r.canonical.x/(1<l+h.max.x||s+ac+h.max.y};for(let d=0;di.key===n.tileID.key);if(a)return a}if(n.tileID.key!==r.key){const l=r.canonical.z-n.tileID.canonical.z;let c,h,u;s=i.create();const d=n.tileID.wrap-r.wrap<0?(h=(c=i.EXTENT>>l)*((n.tileID.canonical.x<=d){const p=r.canonical.z-d;n.getSource().reparseOverscaled?(c=Math.max(r.canonical.z+2,n.transform.tileZoom),l=new i.OverscaledTileID(c,r.wrap,d,r.canonical.x>>p,r.canonical.y>>p)):0!==p&&(c=d,l=new i.OverscaledTileID(c,r.wrap,d,r.canonical.x>>p,r.canonical.y>>p))}l.key!==r.key&&(u.push(l.key),o=n.getTile(l))}const f=i=>{u.forEach(r=>{s[r]=i}),u.length=0};for(c-=1;c>=h&&(!o||!o.hasData());c--){o&&f(o.tileID.key);const m=l.calculateScaledKey(c);if((o=n.getTileByID(m))&&o.hasData())break;const $=s[m];if(null===$)break;void 0===$?u.push(m):o=n.getTileByID($)}return f(o?o.tileID.key:null),o&&o.hasData()?o:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(i){this.renderedToTile=!0}_clearRenderCacheForTile(i,r){let n=this._tilesDirty[i];n||(n=this._tilesDirty[i]={}),n[r.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const r=function(r){let n,o,s;const a=new i.StructArrayLayout2ui4;for(o=1;o<129;o++){for(n=1;n<129;n++)s=131*o+n,a.emplaceBack(s,s+1),a.emplaceBack(s,s+131),a.emplaceBack(s+1,s+131),128===o&&a.emplaceBack(s+131,s+131+1);a.emplaceBack(s+1,s+1+131)}return a}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(r),this.wireframeSegments=i.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,r.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}}function td(i){const r=[];for(let n=0;nv.indexOf(b)&&v.push(b);let w=s?s.defines():[];w=w.concat(l.map(i=>`#define ${i}`));const T=w.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",e2,e1.fragmentSource,e0.fragmentSource,o.fragmentSource).join("\n"),E=w.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",e2,e1.vertexSource,e0.vertexSource,eQ.vertexSource,o.vertexSource).join("\n"),S=p.createShader(p.FRAGMENT_SHADER);if(p.isContextLost())return void(this.failedToCreate=!0);p.shaderSource(S,T),p.compileShader(S),p.attachShader(this.program,S);const I=p.createShader(p.VERTEX_SHADER);if(p.isContextLost())return void(this.failedToCreate=!0);p.shaderSource(I,E),p.compileShader(I),p.attachShader(this.program,I),this.attributes={};const M={};this.numAttributes=$.length;for(let A=0;A>16,c>>16],u_pixel_coord_lower:[65535&l,65535&c]}}const tm=(r,n,o,s)=>{const a=n.style.light,l=a.properties.get("position"),c=[l.x,l.y,l.z],h=i.create$1();"viewport"===a.properties.get("anchor")&&(i.fromRotation(h,-n.transform.angle),i.transformMat3(c,c,h));const u=a.properties.get("color");return{u_matrix:r,u_lightpos:c,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+o,u_opacity:s}},t$=(r,n,o,s,a,l,c)=>i.extend(tm(r,n,o,s),tf(l,n,c),{u_height_factor:-Math.pow(2,a.overscaledZ)/c.tileSize/8}),tg=i=>({u_matrix:i}),ty=(r,n,o,s)=>i.extend(tg(r),tf(o,n,s)),tx=(i,r)=>({u_matrix:i,u_world:r}),tv=(r,n,o,s,a)=>i.extend(ty(r,n,o,s),{u_world:a}),tb=(r,n,o,s)=>{const a=r.transform;let l;return l="map"===s.paint.get("circle-pitch-alignment")?a.calculatePixelsToTileUnitsMatrix(o):new Float32Array([a.pixelsToGLUnits[0],0,0,a.pixelsToGLUnits[1],]),{u_camera_to_center_distance:a.cameraToCenterDistance,u_matrix:r.translatePosMatrix(n.projMatrix,o,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:i.exported.devicePixelRatio,u_extrude_scale:l}},tw=i=>{const r=[];return"map"===i.paint.get("circle-pitch-alignment")&&r.push("PITCH_WITH_MAP"),"map"===i.paint.get("circle-pitch-scale")&&r.push("SCALE_WITH_MAP"),r},tT=(r,n,o)=>{const s=i.EXTENT/o.tileSize;return{u_matrix:r,u_camera_to_center_distance:n.cameraToCenterDistance,u_extrude_scale:[n.pixelsToGLUnits[0]/s,n.pixelsToGLUnits[1]/s,]}},tE=(i,r,n=1)=>({u_matrix:i,u_color:r,u_overlay:0,u_overlay_scale:n}),tS=(i,r,n,o)=>({u_matrix:i,u_extrude_scale:A(r,1,n),u_intensity:o}),tI=(r,n,o,s,a,l)=>{const c=r.transform,h=c.calculatePixelsToTileUnitsMatrix(n),u={u_matrix:tC(r,n,o,a),u_pixels_to_tile_units:h,u_device_pixel_ratio:i.exported.devicePixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1],],u_dash_image:0,u_gradient_image:1,u_image_height:l,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0};if(tz(o)){const d=tA(n,r.transform);u.u_texsize=n.lineAtlasTexture.size,u.u_scale=[d,s.fromScale,s.toScale,],u.u_mix=s.t}return u},tM=(r,n,o,s,a)=>{const l=r.transform,c=tA(n,l);return{u_matrix:tC(r,n,o,a),u_texsize:n.imageAtlasTexture.size,u_pixels_to_tile_units:l.calculatePixelsToTileUnitsMatrix(n),u_device_pixel_ratio:i.exported.devicePixelRatio,u_image:0,u_scale:[c,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1],],u_alpha_discard_threshold:0}};function tA(i,r){return 1/A(i,1,r.tileZoom)}function tC(i,r,n,o){return i.translatePosMatrix(o||r.tileID.projMatrix,r,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}function tz(i){const r=i.paint.get("line-dasharray").value;return r.value||"constant"!==r.kind}const tk=(i,r,n,o,s,a)=>{var l,c;return{u_matrix:i,u_tl_parent:r,u_scale_parent:n,u_fade_t:o.mix,u_opacity:o.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(c=s.paint.get("raster-saturation"))>0?1-1/(1.001-c):-c,u_contrast_factor:(l=s.paint.get("raster-contrast"))>0?1/(1-l):1+l,u_spin_weights:function(i){i*=Math.PI/180;const r=Math.sin(i),n=Math.cos(i);return[(2*n+1)/3,(-Math.sqrt(3)*r-n+1)/3,(Math.sqrt(3)*r-n+1)/3,]}(s.paint.get("raster-hue-rotate")),u_perspective_transform:a}},tP=(i,r,n,o,s,a,l,c,h,u,d,p,f,m)=>{const $=s.transform;return{u_is_size_zoom_constant:+("constant"===i||"source"===i),u_is_size_feature_constant:+("constant"===i||"camera"===i),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:$.cameraToCenterDistance,u_pitch:$.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:$.width/$.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:l,u_coord_matrix:c,u_is_text:+h,u_pitch_with_map:+o,u_texsize:u,u_tile_id:d,u_zoom_transition:p,u_inv_rot_matrix:f,u_merc_center:m,u_texture:0}},tD=(r,n,o,s,a,l,c,h,u,d,p,f,m,$,g)=>{const{cameraToCenterDistance:y,_pitch:x}=a.transform;return i.extend(tP(r,n,o,s,a,l,c,h,u,d,f,m,$,g),{u_gamma_scale:s?y*Math.cos(a.terrain?0:x):1,u_device_pixel_ratio:i.exported.devicePixelRatio,u_is_halo:+p})},tL=(r,n,o,s,a,l,c,h,u,d,p,f,m,$)=>i.extend(tD(r,n,o,s,a,l,c,h,!0,u,!0,p,f,m,$),{u_texsize_icon:d,u_texture_icon:1}),tB=(i,r,n)=>({u_matrix:i,u_opacity:r,u_color:n}),tR=(r,n,o,s,a,l)=>i.extend(function(i,r,n,o){const s=n.imageManager.getPattern(i.from.toString()),a=n.imageManager.getPattern(i.to.toString()),{width:l,height:c}=n.imageManager.getPixelSize(),h=Math.pow(2,o.tileID.overscaledZ),u=o.tileSize*Math.pow(2,n.transform.tileZoom)/h,d=u*(o.tileID.canonical.x+o.tileID.wrap*h),p=u*o.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:s.tl,u_pattern_br_a:s.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[l,c],u_mix:r.t,u_pattern_size_a:s.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/A(o,1,n.transform.tileZoom),u_pixel_coord_upper:[d>>16,p>>16,],u_pixel_coord_lower:[65535&d,65535&p,]}}(s,l,o,a),{u_matrix:r,u_opacity:n}),tF={fillExtrusion:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_lightpos:new i.Uniform3f(r,n.u_lightpos),u_lightintensity:new i.Uniform1f(r,n.u_lightintensity),u_lightcolor:new i.Uniform3f(r,n.u_lightcolor),u_vertical_gradient:new i.Uniform1f(r,n.u_vertical_gradient),u_opacity:new i.Uniform1f(r,n.u_opacity)}),fillExtrusionPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_lightpos:new i.Uniform3f(r,n.u_lightpos),u_lightintensity:new i.Uniform1f(r,n.u_lightintensity),u_lightcolor:new i.Uniform3f(r,n.u_lightcolor),u_vertical_gradient:new i.Uniform1f(r,n.u_vertical_gradient),u_height_factor:new i.Uniform1f(r,n.u_height_factor),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade),u_opacity:new i.Uniform1f(r,n.u_opacity)}),fill:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),fillPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade)}),fillOutline:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_world:new i.Uniform2f(r,n.u_world)}),fillOutlinePattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_world:new i.Uniform2f(r,n.u_world),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade)}),circle:(r,n)=>({u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_extrude_scale:new i.UniformMatrix2f(r,n.u_extrude_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),collisionBox:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_extrude_scale:new i.Uniform2f(r,n.u_extrude_scale)}),collisionCircle:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_inv_matrix:new i.UniformMatrix4f(r,n.u_inv_matrix),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_viewport_size:new i.Uniform2f(r,n.u_viewport_size)}),debug:(r,n)=>({u_color:new i.UniformColor(r,n.u_color),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_overlay:new i.Uniform1i(r,n.u_overlay),u_overlay_scale:new i.Uniform1f(r,n.u_overlay_scale)}),clippingMask:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),heatmap:(r,n)=>({u_extrude_scale:new i.Uniform1f(r,n.u_extrude_scale),u_intensity:new i.Uniform1f(r,n.u_intensity),u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),heatmapTexture:(r,n)=>({u_image:new i.Uniform1i(r,n.u_image),u_color_ramp:new i.Uniform1i(r,n.u_color_ramp),u_opacity:new i.Uniform1f(r,n.u_opacity)}),hillshade:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_latrange:new i.Uniform2f(r,n.u_latrange),u_light:new i.Uniform2f(r,n.u_light),u_shadow:new i.UniformColor(r,n.u_shadow),u_highlight:new i.UniformColor(r,n.u_highlight),u_accent:new i.UniformColor(r,n.u_accent)}),hillshadePrepare:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_dimension:new i.Uniform2f(r,n.u_dimension),u_zoom:new i.Uniform1f(r,n.u_zoom),u_unpack:new i.Uniform4f(r,n.u_unpack)}),line:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_pixels_to_tile_units:new i.UniformMatrix2f(r,n.u_pixels_to_tile_units),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(r,n.u_units_to_pixels),u_dash_image:new i.Uniform1i(r,n.u_dash_image),u_gradient_image:new i.Uniform1i(r,n.u_gradient_image),u_image_height:new i.Uniform1f(r,n.u_image_height),u_texsize:new i.Uniform2f(r,n.u_texsize),u_scale:new i.Uniform3f(r,n.u_scale),u_mix:new i.Uniform1f(r,n.u_mix),u_alpha_discard_threshold:new i.Uniform1f(r,n.u_alpha_discard_threshold)}),linePattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixels_to_tile_units:new i.UniformMatrix2f(r,n.u_pixels_to_tile_units),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_image:new i.Uniform1i(r,n.u_image),u_units_to_pixels:new i.Uniform2f(r,n.u_units_to_pixels),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade),u_alpha_discard_threshold:new i.Uniform1f(r,n.u_alpha_discard_threshold)}),raster:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_tl_parent:new i.Uniform2f(r,n.u_tl_parent),u_scale_parent:new i.Uniform1f(r,n.u_scale_parent),u_fade_t:new i.Uniform1f(r,n.u_fade_t),u_opacity:new i.Uniform1f(r,n.u_opacity),u_image0:new i.Uniform1i(r,n.u_image0),u_image1:new i.Uniform1i(r,n.u_image1),u_brightness_low:new i.Uniform1f(r,n.u_brightness_low),u_brightness_high:new i.Uniform1f(r,n.u_brightness_high),u_saturation_factor:new i.Uniform1f(r,n.u_saturation_factor),u_contrast_factor:new i.Uniform1f(r,n.u_contrast_factor),u_spin_weights:new i.Uniform3f(r,n.u_spin_weights),u_perspective_transform:new i.Uniform2f(r,n.u_perspective_transform)}),symbolIcon:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_tile_id:new i.Uniform3f(r,n.u_tile_id),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_inv_rot_matrix:new i.UniformMatrix4f(r,n.u_inv_rot_matrix),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_texture:new i.Uniform1i(r,n.u_texture)}),symbolSDF:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_texture:new i.Uniform1i(r,n.u_texture),u_gamma_scale:new i.Uniform1f(r,n.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_tile_id:new i.Uniform3f(r,n.u_tile_id),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_inv_rot_matrix:new i.UniformMatrix4f(r,n.u_inv_rot_matrix),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_is_halo:new i.Uniform1i(r,n.u_is_halo)}),symbolTextAndIcon:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_texsize_icon:new i.Uniform2f(r,n.u_texsize_icon),u_texture:new i.Uniform1i(r,n.u_texture),u_texture_icon:new i.Uniform1i(r,n.u_texture_icon),u_gamma_scale:new i.Uniform1f(r,n.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(r,n.u_is_halo)}),background:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_opacity:new i.Uniform1f(r,n.u_opacity),u_color:new i.UniformColor(r,n.u_color)}),backgroundPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_opacity:new i.Uniform1f(r,n.u_opacity),u_image:new i.Uniform1i(r,n.u_image),u_pattern_tl_a:new i.Uniform2f(r,n.u_pattern_tl_a),u_pattern_br_a:new i.Uniform2f(r,n.u_pattern_br_a),u_pattern_tl_b:new i.Uniform2f(r,n.u_pattern_tl_b),u_pattern_br_b:new i.Uniform2f(r,n.u_pattern_br_b),u_texsize:new i.Uniform2f(r,n.u_texsize),u_mix:new i.Uniform1f(r,n.u_mix),u_pattern_size_a:new i.Uniform2f(r,n.u_pattern_size_a),u_pattern_size_b:new i.Uniform2f(r,n.u_pattern_size_b),u_scale_a:new i.Uniform1f(r,n.u_scale_a),u_scale_b:new i.Uniform1f(r,n.u_scale_b),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_tile_units_to_pixels:new i.Uniform1f(r,n.u_tile_units_to_pixels)}),terrainRaster:e7,terrainDepth:e7,skybox:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_sun_direction:new i.Uniform3f(r,n.u_sun_direction),u_cubemap:new i.Uniform1i(r,n.u_cubemap),u_opacity:new i.Uniform1f(r,n.u_opacity),u_temporal_offset:new i.Uniform1f(r,n.u_temporal_offset)}),skyboxGradient:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_color_ramp:new i.Uniform1i(r,n.u_color_ramp),u_center_direction:new i.Uniform3f(r,n.u_center_direction),u_radius:new i.Uniform1f(r,n.u_radius),u_opacity:new i.Uniform1f(r,n.u_opacity),u_temporal_offset:new i.Uniform1f(r,n.u_temporal_offset)}),skyboxCapture:(r,n)=>({u_matrix_3f:new i.UniformMatrix3f(r,n.u_matrix_3f),u_sun_direction:new i.Uniform3f(r,n.u_sun_direction),u_sun_intensity:new i.Uniform1f(r,n.u_sun_intensity),u_color_tint_r:new i.Uniform4f(r,n.u_color_tint_r),u_color_tint_m:new i.Uniform4f(r,n.u_color_tint_m),u_luminance:new i.Uniform1f(r,n.u_luminance)}),globeRaster:(r,n)=>({u_proj_matrix:new i.UniformMatrix4f(r,n.u_proj_matrix),u_globe_matrix:new i.UniformMatrix4f(r,n.u_globe_matrix),u_merc_matrix:new i.UniformMatrix4f(r,n.u_merc_matrix),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_image0:new i.Uniform1i(r,n.u_image0)}),globeAtmosphere:(r,n)=>({u_center:new i.Uniform2f(r,n.u_center),u_radius:new i.Uniform1f(r,n.u_radius),u_screen_size:new i.Uniform2f(r,n.u_screen_size),u_pixel_ratio:new i.Uniform1f(r,n.u_pixel_ratio),u_opacity:new i.Uniform1f(r,n.u_opacity),u_fadeout_range:new i.Uniform1f(r,n.u_fadeout_range),u_start_color:new i.Uniform3f(r,n.u_start_color),u_end_color:new i.Uniform3f(r,n.u_end_color)})};let tO;function tU(r,n,o,s,a,l,c){var h;const u=r.context,d=u.gl,p=r.useProgram("collisionBox"),f=[];let m=0,$=0;for(let g=0;g0){const E=i.create(),S=b;i.mul(E,v.placementInvProjMatrix,r.transform.glCoordMatrix),i.mul(E,E,v.placementViewportMatrix),f.push({circleArray:T,circleOffset:$,transform:S,invTransform:E}),m+=T.length/4,$=m}w&&(r.terrain&&r.terrain.setupElevationDraw(x,p),p.draw(u,d.LINES,i.DepthMode.disabled,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.disabled,tT(b,r.transform,x),o.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,null,r.transform.zoom,null,w.collisionVertexBuffer,w.collisionVertexBufferExt))}if(!c||!f.length)return;const I=r.useProgram("collisionCircle"),M=new i.StructArrayLayout2f1f2i16;M.resize(4*m),M._trim();let A=0;for(const C of f)for(let z=0;z[0,0,0];$.clear();for(let w=0;w=0&&(y[T.associatedIconIndex]={shiftedAnchor:F,angle:O})}else eA(T.numGlyphs,$)}if(p){g.clear();const V=r.icon.placedSymbolArray;for(let N=0;N[0,0,0];ev(L,P.projMatrix,r,a,J,ee,v,d,en,P)}const eo=r.translatePosMatrix(P.projMatrix,D,l,c),es=b||a&&M||ei?tV:J,ea=r.translatePosMatrix(ee,D,l,c,!0),el=F&&0!==o.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1);let ec;const eh=y.createInversionMatrix(P.toUnwrapped());ec=F?L.iconsInText?tL(O.kind,N,w,v,r,eo,es,ea,G,X,j,C,eh,I):tD(O.kind,N,w,v,r,eo,es,ea,a,G,!0,j,C,eh,I):tP(O.kind,N,w,v,r,eo,es,ea,a,G,j,C,eh,I);const eu={program:V,buffers:B,uniformValues:ec,atlasTexture:Z,atlasTextureIcon:W,atlasInterpolation:_,atlasInterpolationIcon:q,isSDF:F,hasHalo:el,tile:D,labelPlaneMatrixInv:Q};if(T&&L.canOverlap){E=!0;const ed=B.segments.get();for(const ep of ed)z.push({segments:new i.SegmentVector([ep]),sortKey:ep.sortKey,state:eu})}else z.push({segments:B.segments,sortKey:0,state:eu})}for(const ef of(E&&z.sort((i,r)=>i.sortKey-r.sortKey),z)){const eg=ef.state;if(r.terrain&&r.terrain.setupElevationDraw(eg.tile,eg.program,{useDepthForOcclusion:!A,labelPlaneMatrixInv:eg.labelPlaneMatrixInv}),m.activeTexture.set($.TEXTURE0),eg.atlasTexture.bind(eg.atlasInterpolation,$.CLAMP_TO_EDGE),eg.atlasTextureIcon&&(m.activeTexture.set($.TEXTURE1),eg.atlasTextureIcon&&eg.atlasTextureIcon.bind(eg.atlasInterpolationIcon,$.CLAMP_TO_EDGE)),eg.isSDF){const ey=eg.uniformValues;eg.hasHalo&&(ey.u_is_halo=1,t_(eg.buffers,ef.segments,o,r,eg.program,S,p,f,ey)),ey.u_is_halo=0}t_(eg.buffers,ef.segments,o,r,eg.program,S,p,f,eg.uniformValues)}}function t_(r,n,o,s,a,l,c,h,u){const d=s.context;a.draw(d,d.gl.TRIANGLES,l,c,h,i.CullFaceMode.disabled,u,o.id,r.layoutVertexBuffer,r.indexBuffer,n,o.paint,s.transform.zoom,r.programConfigurations.get(o.id),r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer)}function tq(r,n,o,s,a,l,c){const h=r.context.gl,u=o.paint.get("fill-pattern"),d=u&&u.constantOr(1),p=o.getCrossfadeParameters();let f,m,$,g,y;for(const x of(c?(m=d&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=h.LINES):(m=d?"fillPattern":"fill",f=h.TRIANGLES),s)){const v=n.getTile(x);if(d&&!v.patternsLoaded())continue;const b=v.getBucket(o);if(!b)continue;r.prepareDrawTile(x);const w=b.programConfigurations.get(o.id),T=r.useProgram(m,w);d&&(r.context.activeTexture.set(h.TEXTURE0),v.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),w.updatePaintBuffers(p));const E=u.constantOr(null);if(E&&v.imageAtlas){const S=v.imageAtlas,I=S.patternPositions[E.to.toString()],M=S.patternPositions[E.from.toString()];I&&M&&w.setConstantPatternPositions(I,M)}const A=r.translatePosMatrix(x.projMatrix,v,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));if(c){g=b.indexBuffer2,y=b.segments2;const C=r.terrain&&r.terrain.renderingToTexture?r.terrain.drapeBufferSize:[h.drawingBufferWidth,h.drawingBufferHeight,];$="fillOutlinePattern"===m&&d?tv(A,r,p,v,C):tx(A,C)}else g=b.indexBuffer,y=b.segments,$=d?ty(A,r,p,v):tg(A);r.prepareDrawProgram(r.context,T,x.toUnwrapped()),T.draw(r.context,f,a,r.stencilModeForClipping(x),l,i.CullFaceMode.disabled,$,o.id,b.layoutVertexBuffer,g,y,o.paint,r.transform.zoom,w)}}function tX(r,n,o,s,a,l,c){const h=r.context,u=h.gl,d=o.paint.get("fill-extrusion-pattern"),p=d.constantOr(1),f=o.getCrossfadeParameters(),m=o.paint.get("fill-extrusion-opacity");for(const $ of s){const g=n.getTile($),y=g.getBucket(o);if(!y)continue;const x=y.programConfigurations.get(o.id),v=r.useProgram(p?"fillExtrusionPattern":"fillExtrusion",x);if(r.terrain){const b=r.terrain;if(!y.enableTerrain)continue;if(b.setupElevationDraw(g,v,{useMeterToDem:!0}),tW(h,n,$,y,o,b),!y.centroidVertexBuffer){const w=v.attributes.a_centroid_pos;void 0!==w&&u.vertexAttrib2f(w,0,0)}}p&&(r.context.activeTexture.set(u.TEXTURE0),g.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),x.updatePaintBuffers(f));const T=d.constantOr(null);if(T&&g.imageAtlas){const E=g.imageAtlas,S=E.patternPositions[T.to.toString()],I=E.patternPositions[T.from.toString()];S&&I&&x.setConstantPatternPositions(S,I)}const M=r.translatePosMatrix($.projMatrix,g,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),A=o.paint.get("fill-extrusion-vertical-gradient"),C=p?t$(M,r,A,m,$,f,g):tm(M,r,A,m);r.prepareDrawProgram(h,v,$.toUnwrapped()),v.draw(h,h.gl.TRIANGLES,a,l,c,i.CullFaceMode.backCCW,C,o.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,o.paint,r.transform.zoom,x,r.terrain?y.centroidVertexBuffer:null)}}function tW(r,n,o,s,a,l){const c=[r=>{let n=r.canonical.x-1,o=r.wrap;return n<0&&(n=(1<{let n=r.canonical.x+1,o=r.wrap;return n===1<new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(0===r.canonical.y?1<new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<{const r=n.getSource().maxzoom,o=i=>{const r=n.getTileByID(i);if(r&&r.hasData())return r.getBucket(a)};let s,l,c;return(i.overscaledZ===i.canonical.z||i.overscaledZ>=r)&&(s=o(i.key)),i.overscaledZ>=r&&(l=o(i.calculateScaledKey(i.overscaledZ+1))),i.overscaledZ>r&&(c=o(i.calculateScaledKey(i.overscaledZ-1))),s||l||c},u=[0,0,0],d=(r,n)=>(u[0]=Math.min(r.min.y,n.min.y),u[1]=Math.max(r.max.y,n.max.y),u[2]=i.EXTENT-n.min.x>r.max.x?n.min.x-i.EXTENT:r.max.x,u),p=(r,n)=>(u[0]=Math.min(r.min.x,n.min.x),u[1]=Math.max(r.max.x,n.max.x),u[2]=i.EXTENT-n.min.y>r.max.y?n.min.y-i.EXTENT:r.max.y,u),f=[(i,r)=>d(i,r),(i,r)=>d(r,i),(i,r)=>p(i,r),(i,r)=>p(r,i),],m=new i.pointGeometry(0,0);let $,g,y;const x=(r,n,s,a,c)=>{const h=[[a?s:r,a?r:s,0],[a?s:n,a?n:s,0],],u=c<0?i.EXTENT+c:c,d=[a?u:(r+n)/2,a?(r+n)/2:u,0,];return 0===s&&c<0||0!==s&&c>0?l.getForTilePoints(y,[d],!0,g):h.push(d),l.getForTilePoints(o,h,!0,$),Math.max(h[0][2],h[1][2],d[2])/l.exaggeration()};for(let v=0;v<4;v++){const b=s.borders[v];if(0===b.length&&(s.borderDone[v]=!0),s.borderDone[v])continue;const w=y=c[v](o),T=h(w);if(!T||!T.enableTerrain||!(g=l.findDEMTileFor(w))||!g.dem)continue;if(!$){const E=l.findDEMTileFor(o);if(!E||!E.dem)return;$=E}const S=(v<2?1:5)-v,I=T.borders[S];let M=0;for(let A=0;Az[0]+3);)T.borderDone[S]||T.encodeCentroid(void 0,k,!1),M++;if(k&&Mz[1]-3)&&(D++,++M!==I.length);)k=T.featuresOnBorder[I[M]];if(k=T.featuresOnBorder[I[P]],C.intersectsCount()>1||k.intersectsCount()>1||1!==D){1!==D&&(M=P),s.encodeCentroid(void 0,C,!1),T.borderDone[S]||T.encodeCentroid(void 0,k,!1);continue}const L=f[v](C,k),B=v%2?i.EXTENT-1:0;m.x=x(L[0],Math.min(i.EXTENT-1,L[1]),B,v<2,L[2]),m.y=0,s.encodeCentroid(m,C,!1),T.borderDone[S]||T.encodeCentroid(m,k,!1)}else s.encodeCentroid(void 0,C,!1)}s.borderDone[v]=s.needsCentroidUpdate=!0,T.borderDone[S]||(T.borderDone[S]=T.needsCentroidUpdate=!0)}(s.needsCentroidUpdate||!s.centroidVertexBuffer&&0!==s.centroidVertexArray.length)&&s.uploadCentroid(r)}const tH=new i.Color(1,0,0,1),tK=new i.Color(0,1,0,1),tY=new i.Color(0,0,1,1),tJ=new i.Color(1,0,1,1),tQ=new i.Color(0,1,1,1);function t0(i,r,n,o){t2(i,0,r+n/2,i.transform.width,n,o)}function t1(i,r,n,o){t2(i,r-n/2,0,n,i.transform.height,o)}function t2(r,n,o,s,a,l){const c=r.context,h=c.gl;h.enable(h.SCISSOR_TEST),h.scissor(n*i.exported.devicePixelRatio,o*i.exported.devicePixelRatio,s*i.exported.devicePixelRatio,a*i.exported.devicePixelRatio),c.clear({color:l}),h.disable(h.SCISSOR_TEST)}function t3(r,n,o){const s=r.context,a=s.gl,l=o.projMatrix,c=r.useProgram("debug"),h=n.getTileByID(o.key);r.terrain&&r.terrain.setupElevationDraw(h,c);const u=i.DepthMode.disabled,d=i.StencilMode.disabled,p=r.colorModeForRenderPass(),f="$debug";s.activeTexture.set(a.TEXTURE0),r.emptyTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),h._makeDebugTileBoundsBuffers(r.context,r.transform.projection);const m=h._tileDebugBuffer||r.debugBuffer,$=h._tileDebugIndexBuffer||r.debugIndexBuffer,g=h._tileDebugSegments||r.debugSegments;c.draw(s,a.LINE_STRIP,u,d,p,i.CullFaceMode.disabled,tE(l,i.Color.red),f,m,$,g);const y=h.latestRawTileData,x=Math.floor((y&&y.byteLength||0)/1024),v=n.getTile(o).tileSize,b=512/Math.min(v,512)*(o.overscaledZ/r.transform.zoom)*.5;let w=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(w+=` => ${o.overscaledZ}`),function(i,r){i.initDebugOverlayCanvas();const n=i.debugOverlayCanvas,o=i.context.gl,s=i.debugOverlayCanvas.getContext("2d");s.clearRect(0,0,n.width,n.height),s.shadowColor="white",s.shadowBlur=2,s.lineWidth=1.5,s.strokeStyle="white",s.textBaseline="top",s.font="bold 36px Open Sans, sans-serif",s.fillText(r,5,5),s.strokeText(r,5,5),i.debugOverlayTexture.update(n),i.debugOverlayTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE)}(r,`${w} ${x}kb`),c.draw(s,a.TRIANGLES,u,d,i.ColorMode.alphaBlended,i.CullFaceMode.disabled,tE(l,i.Color.transparent,b),f,r.debugBuffer,r.quadTriangleIndexBuffer,r.debugSegments)}const t5=i.createLayout([{name:"a_pos_3f",components:3,type:"Float32"},]),{members:t4}=t5;function t6(i,r,n,o){i.emplaceBack(r,n,o)}class t8{constructor(r){this.vertexArray=new i.StructArrayLayout3f12,this.indices=new i.StructArrayLayout3ui6,t6(this.vertexArray,-1,-1,1),t6(this.vertexArray,1,-1,1),t6(this.vertexArray,-1,1,1),t6(this.vertexArray,1,1,1),t6(this.vertexArray,-1,-1,-1),t6(this.vertexArray,1,-1,-1),t6(this.vertexArray,-1,1,-1),t6(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=r.createVertexBuffer(this.vertexArray,t4),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=i.SegmentVector.simpleSegment(0,0,36,12)}}function t9(r,n,o,s,a,l){var c,h,u,d,p;const f=r.gl,m=n.paint.get("sky-atmosphere-color"),$=n.paint.get("sky-atmosphere-halo-color"),g=n.paint.get("sky-atmosphere-sun-intensity"),y=(c=i.fromMat4([],s),h=a,u=g,d=m,p=$,{u_matrix_3f:c,u_sun_direction:h,u_sun_intensity:u,u_color_tint_r:[d.r,d.g,d.b,d.a],u_color_tint_m:[p.r,p.g,p.b,p.a],u_luminance:5e-5});f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+l,n.skyboxTexture,0),o.draw(r,f.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.frontCW,y,"skyboxCapture",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}const t7={symbol:function(r,n,o,s,a){if("translucent"!==r.renderPass)return;const l=i.StencilMode.disabled,c=r.colorModeForRenderPass();o.layout.get("text-variable-anchor")&&function(r,n,o,s,a,l,c){const h=n.transform,u="map"===a,d="map"===l,p=h.projection.createTileTransform(h,h.worldSize);for(const f of r){const m=s.getTile(f),$=m.getBucket(o);if(!$||$.projection!==h.projection.name||!$.text||!$.text.segments.get().length)continue;const g=i.evaluateSizeForZoom($.textSizeData,h.zoom),y=n.transform.calculatePixelsToTileUnitsMatrix(m),x=em(f.projMatrix,m.tileID.canonical,d,u,n.transform,y),v="none"!==o.layout.get("icon-text-fit")&&$.hasIconData();if(g){const b=Math.pow(2,h.zoom-m.tileID.overscaledZ);tj($,u,d,c,i.symbolSize,h,x,f,b,g,v,p)}}}(s,r,o,n,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),a),0!==o.paint.get("icon-opacity").constantOr(1)&&tZ(r,n,o,s,!1,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),o.layout.get("icon-rotation-alignment"),o.layout.get("icon-pitch-alignment"),o.layout.get("icon-keep-upright"),l,c),0!==o.paint.get("text-opacity").constantOr(1)&&tZ(r,n,o,s,!0,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.layout.get("text-keep-upright"),l,c),n.map.showCollisionBoxes&&(tU(r,n,o,s,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),tU(r,n,o,s,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(r,n,o,s){if("translucent"!==r.renderPass)return;const a=o.paint.get("circle-opacity"),l=o.paint.get("circle-stroke-width"),c=o.paint.get("circle-stroke-opacity"),h=void 0!==o.layout.get("circle-sort-key").constantOr(1);if(0===a.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const u=r.context,d=u.gl,p=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),f=i.StencilMode.disabled,m=r.colorModeForRenderPass(),$=[];for(let g=0;gi.sortKey-r.sortKey);const I={useDepthForOcclusion:"globe"!==r.transform.projection.name};for(const M of $){const{programConfiguration:A,program:C,layoutVertexBuffer:z,indexBuffer:k,uniformValues:P,tile:D}=M.state,L=M.segments;r.terrain&&r.terrain.setupElevationDraw(D,C,I),r.prepareDrawProgram(u,C,D.tileID.toUnwrapped()),C.draw(u,d.TRIANGLES,p,f,m,i.CullFaceMode.disabled,P,o.id,z,k,L,o.paint,r.transform.zoom,A)}},heatmap:function(r,n,o,s){if(0!==o.paint.get("heatmap-opacity")){if("offscreen"===r.renderPass){const a=r.context,l=a.gl,c=i.StencilMode.disabled,h=new i.ColorMode([l.ONE,l.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(i,r,n){const o=i.gl;i.activeTexture.set(o.TEXTURE1),i.viewport.set([0,0,r.width/4,r.height/4,]);let s=n.heatmapFbo;if(s)o.bindTexture(o.TEXTURE_2D,s.colorAttachment.get()),i.bindFramebuffer.set(s.framebuffer);else{const a=o.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),s=n.heatmapFbo=i.createFramebuffer(r.width/4,r.height/4,!1),function(i,r,n,o){const s=i.gl;s.texImage2D(s.TEXTURE_2D,0,s.RGBA,r.width/4,r.height/4,0,s.RGBA,i.extRenderToTextureHalfFloat?i.extTextureHalfFloat.HALF_FLOAT_OES:s.UNSIGNED_BYTE,null),o.colorAttachment.set(n)}(i,r,a,s)}})(a,r,o),a.clear({color:i.Color.transparent});for(let u=0;u{const r=[];tz(i)&&r.push("RENDER_LINE_DASH"),i.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT");const n=i.paint.get("line-pattern").constantOr(1),o=1!==i.paint.get("line-opacity").constantOr(1);return!n&&o&&r.push("RENDER_LINE_ALPHA_DISCARD"),r})(o);let w=b.includes("RENDER_LINE_ALPHA_DISCARD");for(const T of(r.terrain&&r.terrain.clipOrMaskOverlapStencilType()&&(w=!1),s)){const E=n.getTile(T);if(m&&!E.patternsLoaded())continue;const S=E.getBucket(o);if(!S)continue;r.prepareDrawTile(T);const I=S.programConfigurations.get(o.id),M=r.useProgram(y,I,b),A=f.constantOr(null);if(A&&E.imageAtlas){const C=E.imageAtlas,z=C.patternPositions[A.to.toString()],k=C.patternPositions[A.from.toString()];z&&k&&I.setConstantPatternPositions(z,k)}const P=u.constantOr(null),D=p.constantOr(null);if(!m&&P&&D&&E.lineAtlas){const L=E.lineAtlas,B=L.getDash(P.to,D),R=L.getDash(P.from,D);B&&R&&I.setConstantPatternPositions(B,R)}const F=r.terrain?T.projMatrix:null,O=m?tM(r,E,o,g,F):tI(r,E,o,g,F,S.lineClipsArray.length);if($){const U=S.gradients[o.id];let V=U.texture;if(o.gradientVersion!==U.version){let N=256;if(o.stepInterpolant){const j=n.getSource().maxzoom,G=T.canonical.z===j?Math.ceil(1<{M.draw(x,v.TRIANGLES,c,n,h,i.CullFaceMode.disabled,O,o.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,o.paint,r.transform.zoom,I,S.layoutVertexBuffer2)};if(w){const _=r.stencilModeForClipping(T).ref;0===_&&r.terrain&&x.clear({stencil:0});const q={func:v.EQUAL,mask:255};O.u_alpha_discard_threshold=.8,Z(new i.StencilMode(q,_,255,v.KEEP,v.KEEP,v.INVERT)),O.u_alpha_discard_threshold=0,Z(new i.StencilMode(q,_,255,v.KEEP,v.KEEP,v.KEEP))}else Z(r.stencilModeForClipping(T))}w&&(r.resetStencilClippingMasks(),r.terrain&&x.clear({stencil:0}))},fill:function(r,n,o,s){const a=o.paint.get("fill-color"),l=o.paint.get("fill-opacity");if(0===l.constantOr(1))return;const c=r.colorModeForRenderPass(),h=o.paint.get("fill-pattern"),u=r.opaquePassEnabledForLayer()&&!h.constantOr(1)&&1===a.constantOr(i.Color.transparent).a&&1===l.constantOr(0)?"opaque":"translucent";if(r.renderPass===u){const d=r.depthModeForSublayer(1,"opaque"===r.renderPass?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly);tq(r,n,o,s,d,c,!1)}if("translucent"===r.renderPass&&o.paint.get("fill-antialias")){const p=r.depthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,i.DepthMode.ReadOnly);tq(r,n,o,s,p,c,!0)}},"fill-extrusion":function(r,n,o,s){const a=o.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===r.renderPass){const l=new i.DepthMode(r.context.gl.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);if(1!==a||o.paint.get("fill-extrusion-pattern").constantOr(1))tX(r,n,o,s,l,i.StencilMode.disabled,i.ColorMode.disabled),tX(r,n,o,s,l,r.stencilModeFor3D(),r.colorModeForRenderPass()),r.resetStencilClippingMasks();else{const c=r.colorModeForRenderPass();tX(r,n,o,s,l,i.StencilMode.disabled,c)}}},hillshade:function(r,n,o,s){if("offscreen"!==r.renderPass&&"translucent"!==r.renderPass)return;const a=r.context,l=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),c=r.colorModeForRenderPass(),h=r.terrain&&r.terrain.renderingToTexture,[u,d]="translucent"!==r.renderPass||h?[{},s]:r.stencilConfigForOverlap(s);for(const p of d){const f=n.getTile(p);if(f.needsHillshadePrepare&&"offscreen"===r.renderPass)e9(r,f,o,l,i.StencilMode.disabled,c);else if("translucent"===r.renderPass){const m=h&&r.terrain?r.terrain.stencilModeForRTTOverlap(p):u[p.overscaledZ];e6(r,p,f,o,l,m,c)}}a.viewport.set([0,0,r.width,r.height]),r.resetStencilClippingMasks()},raster:function(r,n,o,s,a,l){if("translucent"!==r.renderPass||0===o.paint.get("raster-opacity")||!s.length)return;const c=r.context,h=c.gl,u=n.getSource(),d=r.useProgram("raster"),p=r.colorModeForRenderPass(),f=r.terrain&&r.terrain.renderingToTexture,[m,$]=u instanceof Z||f?[{},s]:r.stencilConfigForOverlap(s),g=$[$.length-1].overscaledZ,y=!r.options.moving;for(const x of $){const v=f?i.DepthMode.disabled:r.depthModeForSublayer(x.overscaledZ-g,1===o.paint.get("raster-opacity")?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly,h.LESS),b=x.toUnwrapped(),w=n.getTile(x);if(f&&(!w||!w.hasData()))continue;const T=f?x.projMatrix:r.transform.calculateProjMatrix(b,y),E=r.terrain&&f?r.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ],S=l?0:o.paint.get("raster-fade-duration");w.registerFadeDuration(S);const I=n.findLoadedParent(x,0),M=ta(w,I,n,r.transform,S);let A,C;r.terrain&&r.terrain.prepareDrawTile(x);const z="nearest"===o.paint.get("raster-resampling")?h.NEAREST:h.LINEAR;c.activeTexture.set(h.TEXTURE0),w.texture.bind(z,h.CLAMP_TO_EDGE),c.activeTexture.set(h.TEXTURE1),I?(I.texture.bind(z,h.CLAMP_TO_EDGE),A=Math.pow(2,I.tileID.overscaledZ-w.tileID.overscaledZ),C=[w.tileID.canonical.x*A%1,w.tileID.canonical.y*A%1,]):w.texture.bind(z,h.CLAMP_TO_EDGE);const k=tk(T,C||[0,0],A||1,M,o,u instanceof Z?u.perspectiveTransform:[0,0]);if(r.prepareDrawProgram(c,d,b),u instanceof Z)d.draw(c,h.TRIANGLES,v,i.StencilMode.disabled,p,i.CullFaceMode.disabled,k,o.id,u.boundsBuffer,r.quadTriangleIndexBuffer,u.boundsSegments);else{const{tileBoundsBuffer:P,tileBoundsIndexBuffer:D,tileBoundsSegments:L}=r.getTileBoundsBuffers(w);d.draw(c,h.TRIANGLES,v,E,p,i.CullFaceMode.disabled,k,o.id,P,D,L)}}r.resetStencilClippingMasks()},background:function(r,n,o,s){const a=o.paint.get("background-color"),l=o.paint.get("background-opacity");if(0===l)return;const c=r.context,h=c.gl,u=r.transform,d=u.tileSize,p=o.paint.get("background-pattern");if(r.isPatternMissing(p))return;const f=!p&&1===a.a&&1===l&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==f)return;const m=i.StencilMode.disabled,$=r.depthModeForSublayer(0,"opaque"===f?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly),g=r.colorModeForRenderPass(),y=r.useProgram(p?"backgroundPattern":"background");let x,v=s;v||(v=Object.values(x=r.getBackgroundTiles()).map(i=>i.tileID)),p&&(c.activeTexture.set(h.TEXTURE0),r.imageManager.bind(r.context));const b=o.getCrossfadeParameters();for(const w of v){const T=w.toUnwrapped(),E=s?w.projMatrix:r.transform.calculateProjMatrix(T);r.prepareDrawTile(w);const S=n?n.getTile(w):x?x[w.key]:new i.Tile(w,d,u.zoom,r),I=p?tR(E,l,r,p,{tileID:w,tileSize:d},b):tB(E,l,a);r.prepareDrawProgram(c,y,T);const{tileBoundsBuffer:M,tileBoundsIndexBuffer:A,tileBoundsSegments:C}=r.getTileBoundsBuffers(S);y.draw(c,h.TRIANGLES,$,m,g,i.CullFaceMode.disabled,I,o.id,M,A,C)}},sky:function(r,n,o){const s=r.transform,a="mercator"===s.projection.name||"globe"===s.projection.name?1:i.smoothstep(7,8,s.zoom),l=o.paint.get("sky-opacity")*a;if(0===l)return;const c=r.context,h=o.paint.get("sky-type"),u=new i.DepthMode(c.gl.LEQUAL,i.DepthMode.ReadOnly,[0,1]),d=r.frameCounter/1e3%1;"atmosphere"===h?"offscreen"===r.renderPass?o.needsSkyboxCapture(r)&&(function(r,n,o,s){const a=r.context,l=a.gl;let c=n.skyboxFbo;if(!c){c=n.skyboxFbo=a.createFramebuffer(32,32,!1),n.skyboxGeometry=new t8(a),n.skyboxTexture=a.gl.createTexture(),l.bindTexture(l.TEXTURE_CUBE_MAP,n.skyboxTexture),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,l.LINEAR);for(let h=0;h<6;++h)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l.RGBA,32,32,0,l.RGBA,l.UNSIGNED_BYTE,null)}a.bindFramebuffer.set(c.framebuffer),a.viewport.set([0,0,32,32,]);const u=n.getCenter(r,!0),d=r.useProgram("skyboxCapture"),p=new Float64Array(16);i.identity(p),i.rotateY(p,p,-(.5*Math.PI)),t9(a,n,d,p,u,0),i.identity(p),i.rotateY(p,p,.5*Math.PI),t9(a,n,d,p,u,1),i.identity(p),i.rotateX(p,p,-(.5*Math.PI)),t9(a,n,d,p,u,2),i.identity(p),i.rotateX(p,p,.5*Math.PI),t9(a,n,d,p,u,3),i.identity(p),t9(a,n,d,p,u,4),i.identity(p),i.rotateY(p,p,Math.PI),t9(a,n,d,p,u,5),a.viewport.set([0,0,r.width,r.height,])}(r,o),o.markSkyboxValid(r)):"sky"===r.renderPass&&function(r,n,o,s,a){var l,c,h;const u=r.context,d=u.gl,p=r.transform,f=r.useProgram("skybox");u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_CUBE_MAP,n.skyboxTexture);const m=(l=p.skyboxMatrix,c=n.getCenter(r,!1),h=s,{u_matrix:l,u_sun_direction:c,u_cubemap:0,u_opacity:h,u_temporal_offset:a});r.prepareDrawProgram(u,f),f.draw(u,d.TRIANGLES,o,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,m,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,o,u,l,d):"gradient"===h&&"sky"===r.renderPass&&function(r,n,o,s,a){var l,c,h,u,d;const p=r.context,f=p.gl,m=r.transform,$=r.useProgram("skyboxGradient");n.skyboxGeometry||(n.skyboxGeometry=new t8(p)),p.activeTexture.set(f.TEXTURE0);let g=n.colorRampTexture;g||(g=n.colorRampTexture=new i.Texture(p,n.colorRamp,f.RGBA)),g.bind(f.LINEAR,f.CLAMP_TO_EDGE);const y=(l=m.skyboxMatrix,c=n.getCenter(r,!1),h=n.paint.get("sky-gradient-radius"),u=s,d=a,{u_matrix:l,u_color_ramp:0,u_center_direction:c,u_radius:i.degToRad(h),u_opacity:u,u_temporal_offset:d});r.prepareDrawProgram(p,$),$.draw(p,f.TRIANGLES,o,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,y,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,o,u,l,d)},debug:function(i,r,n){for(let o=0;or.getOpacity(this.transform.pitch)||.03>r.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);const[n,o]=r.getFovAdjustedRange(this.transform._fov);if(n>o)return void(this.transform.fogCullDistSq=null);const s=n+.78*(o-n);this.transform.fogCullDistSq=s*s}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(r,n){if(this.width=r*i.exported.devicePixelRatio,this.height=n*i.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height,]),this.style)for(const o of this.style.order)this.style._layers[o].resize()}setup(){const r=this.context,n=new i.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(i.EXTENT,0),n.emplaceBack(0,i.EXTENT),n.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=r.createVertexBuffer(n,i.posAttributes.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);const o=new i.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(i.EXTENT,0),o.emplaceBack(0,i.EXTENT),o.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=r.createVertexBuffer(o,i.posAttributes.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);const s=new i.StructArrayLayout2i4;s.emplaceBack(-1,-1),s.emplaceBack(1,-1),s.emplaceBack(-1,1),s.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(s,i.posAttributes.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);const a=new i.StructArrayLayout4i8;a.emplaceBack(0,0,0,0),a.emplaceBack(i.EXTENT,0,i.EXTENT,0),a.emplaceBack(0,i.EXTENT,0,i.EXTENT),a.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.mercatorBoundsBuffer=r.createVertexBuffer(a,i.boundsAttributes.members),this.mercatorBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);const l=new i.StructArrayLayout3ui6;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(l);const c=new i.StructArrayLayout1ui2;for(const h of[0,1,3,2,0])c.emplaceBack(h);this.debugIndexBuffer=r.createIndexBuffer(c),this.emptyTexture=new i.Texture(r,{width:1,height:1,data:new Uint8Array([0,0,0,0])},r.gl.RGBA),this.identityMat=i.create();const u=this.context.gl;this.stencilClearMode=new i.StencilMode({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.loadTimeStamps.push(i.window.performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(i){return i._makeTileBoundsBuffers(this.context,this.transform.projection),i._tileBoundsBuffer?{tileBoundsBuffer:i._tileBoundsBuffer,tileBoundsIndexBuffer:i._tileBoundsIndexBuffer,tileBoundsSegments:i._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context,n=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(r,n.TRIANGLES,i.DepthMode.disabled,this.stencilClearMode,i.ColorMode.disabled,i.CullFaceMode.disabled,ts(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,n,o){if(!n||this.currentStencilSource===n.id||!r.isTileClipped()||!o||0===o.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let s=!1;for(const a of o)if(void 0===this._tileClippingMaskIDs[a.key]){s=!0;break}if(!s)return}this.currentStencilSource=n.id;const l=this.context,c=l.gl;this.nextStencilID+o.length>256&&this.clearStencil(),l.setColorMode(i.ColorMode.disabled),l.setDepthMode(i.DepthMode.disabled);const h=this.useProgram("clippingMask");for(const u of(this._tileClippingMaskIDs={},o)){const d=n.getTile(u),p=this._tileClippingMaskIDs[u.key]=this.nextStencilID++,{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:$}=this.getTileBoundsBuffers(d);h.draw(l,c.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:c.ALWAYS,mask:0},p,255,c.KEEP,c.KEEP,c.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,ts(u.projMatrix),"$clipping",f,m,$)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,n=this.context.gl;return new i.StencilMode({func:n.NOTEQUAL,mask:255},r,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const n=this.context.gl;return new i.StencilMode({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(r){const n=this.context.gl,o=r.sort((i,r)=>r.overscaledZ-i.overscaledZ),s=o[o.length-1].overscaledZ,a=o[0].overscaledZ-s+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();const l={};for(let c=0;c=0;this.currentLayer--){const v=this.style._layers[o[this.currentLayer]],b=r._getLayerSourceCache(v);if(v.isSky())continue;const w=b?h[b.id]:void 0;this._renderTileClippingMasks(v,b,w),this.renderLayer(this,b,v,w)}if(this.renderPass="sky",(i.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const n=r._getLayerSourceCache(i);n&&!i.isHidden(this.transform.zoom)&&(!A||A.getSource().maxzoom0?r.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const r=this.imageManager.getPattern(i.from.toString()),n=this.imageManager.getPattern(i.to.toString());return!r||!n}currentGlobalDefines(){const i=this.terrain&&this.terrain.renderingToTexture,r=this.style&&this.style.fog,n=[];return this.terrain&&!this.terrain.renderingToTexture&&n.push("TERRAIN"),r&&!i&&0!==r.getOpacity(this.transform.pitch)&&n.push("FOG"),i&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}useProgram(i,r,n){this.cache=this.cache||{};const o=this.currentGlobalDefines().concat(n||[]),s=tp.cacheKey(i,o,r);return this.cache[s]||(this.cache[s]=new tp(this.context,i,e3[i],r,tF[i],o)),this.cache[s]}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 i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height,]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.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(i){this.terrain&&this.terrain.prepareDrawTile(i)}prepareDrawProgram(i,r,n){if(this.terrain&&this.terrain.renderingToTexture)return;const o=this.style.fog;if(o){const s=o.getOpacity(this.transform.pitch);0!==s&&r.setFogUniformValues(i,((i,r,n,o)=>{const s=r.properties.get("color"),a=i.frameCounter/1e3%1,l=[s.r/s.a,s.g/s.a,s.b/s.a,o,];return{u_fog_matrix:n?i.transform.calculateFogTileMatrix(n):i.identityMat,u_fog_range:r.getFovAdjustedRange(i.transform._fov),u_fog_color:l,u_fog_horizon_blend:r.properties.get("horizon-blend"),u_fog_temporal_offset:a}})(this,o,n,s))}}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const i=this.context.gl,r=i.createTexture();return i.bindTexture(i.TEXTURE_2D,r),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const i=this.style&&this.style.fog;return!!i&&0!==i.getOpacity(this.transform.pitch)}getBackgroundTiles(){const r=this._backgroundTiles,n=this._backgroundTiles={},o=this.transform.coveringTiles({tileSize:512});for(const s of o)n[s.key]=r[s.key]||new i.Tile(s,512,this.transform.tileZoom,this);return n}clearBackgroundTiles(){this._backgroundTiles={}}}class it{constructor(i=0,r=0,n=0,o=0){if(isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0||isNaN(o)||o<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=r,this.left=n,this.right=o}interpolate(r,n,o){return null!=n.top&&null!=r.top&&(this.top=i.number(r.top,n.top,o)),null!=n.bottom&&null!=r.bottom&&(this.bottom=i.number(r.bottom,n.bottom,o)),null!=n.left&&null!=r.left&&(this.left=i.number(r.left,n.left,o)),null!=n.right&&null!=r.right&&(this.right=i.number(r.right,n.right,o)),this}getCenter(r,n){const o=i.clamp((this.left+r-this.right)/2,0,r),s=i.clamp((this.top+n-this.bottom)/2,0,n);return new i.pointGeometry(o,s)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new it(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ii(r,n){const o=i.getColumn(r,3);i.fromQuat(r,n),i.setColumn(r,3,o)}function ir(r,n){i.setColumn(r,3,[n[0],n[1],n[2],1])}function io(r,n){const o=i.identity$1([]);return i.rotateZ$1(o,o,-n),i.rotateX$1(o,o,-r),o}function is(r,n){const o=[r[0],r[1],0],s=[n[0],n[1],0];if(i.length(o)>=1e-15){const a=i.normalize([],o);i.scale$2(s,a,i.dot(s,a)),n[0]=s[0],n[1]=s[1]}const l=i.cross([],n,r);if(1e-15>i.len(l))return null;const c=Math.atan2(-l[1],l[0]);return io(Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2]),c)}class ia{constructor(i,r){this.position=i,this.orientation=r}get position(){return this._position}set position(r){this._position=this._renderWorldCopies?function(r){if(!r)return;const n=Array.isArray(r)?new i.MercatorCoordinate(r[0],r[1],r[2]):r;return n.x=i.wrap(n.x,0,1),n}(r):r}lookAtPoint(r,n){if(this.orientation=null,!this.position)return;const o=this._elevation?this._elevation.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(r)):0,s=this.position,a=i.MercatorCoordinate.fromLngLat(r,o),l=[a.x-s.x,a.y-s.y,a.z-s.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=is(l,n)}setPitchBearing(r,n){this.orientation=io(i.degToRad(r),i.degToRad(-n))}}class il{constructor(r,n){this._transform=i.identity([]),this._orientation=i.identity$1([]),n&&(this._orientation=n,ii(this._transform,this._orientation)),r&&ir(this._transform,r)}get mercatorPosition(){const r=this.position;return new i.MercatorCoordinate(r[0],r[1],r[2])}get position(){const r=i.getColumn(this._transform,3);return[r[0],r[1],r[2]]}set position(i){ir(this._transform,i)}get orientation(){return this._orientation}set orientation(i){this._orientation=i,ii(this._transform,this._orientation)}getPitchBearing(){const i=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,r){this._orientation=io(i,r),ii(this._transform,this._orientation)}forward(){const r=i.getColumn(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){const r=i.getColumn(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){const r=i.getColumn(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,n){const o=new Float64Array(16);return i.invert(o,this.getWorldToCamera(r,n)),o}getWorldToCameraPosition(r,n,o){const s=this.position;i.scale$2(s,s,-r);const a=new Float64Array(16);return i.fromScaling(a,[o,o,o]),i.translate(a,a,s),a[10]*=n,a}getWorldToCamera(r,n){const o=new Float64Array(16),s=new Float64Array(4),a=this.position;return i.conjugate(s,this._orientation),i.scale$2(a,a,-r),i.fromQuat(o,s),i.translate(o,o,a),o[1]*=-1,o[5]*=-1,o[9]*=-1,o[13]*=-1,o[8]*=n,o[9]*=n,o[10]*=n,o[11]*=n,o}getCameraToClipPerspective(r,n,o,s){const a=new Float64Array(16);return i.perspective(a,r,n,o,s),a}getDistanceToElevation(r){const n=0===r?0:i.mercatorZfromAltitude(r,this.position[1]),o=this.forward();return(n-this.position[2])/o[2]}clone(){return new il([...this.position],[...this.orientation])}}function ic(r,n){const o=iu(r),s=function(r,n,o,s,a){const l=new i.LngLat(o.lng-180*id,o.lat),c=new i.LngLat(o.lng+180*id,o.lat),h=r.project(l.lng,l.lat),u=r.project(c.lng,c.lat),d=-Math.atan2(u.y-h.y,u.x-h.x),p=i.MercatorCoordinate.fromLngLat(o);p.y=i.clamp(p.y,-.999975,.999975);const f=p.toLngLat(),m=r.project(f.lng,f.lat),$=i.MercatorCoordinate.fromLngLat(f);$.x+=id;const g=$.toLngLat(),y=r.project(g.lng,g.lat),x=im(y.x-m.x,y.y-m.y,d),v=i.MercatorCoordinate.fromLngLat(f);v.y+=id;const b=v.toLngLat(),w=r.project(b.lng,b.lat),T=im(w.x-m.x,w.y-m.y,d),E=Math.abs(x.x)/Math.abs(T.y),S=i.identity([]);i.rotateZ(S,S,-d*(1-(a?0:s)));const I=i.identity([]);return i.scale(I,I,[1,1-(1-E)*s,1]),I[4]=-T.x/T.y*s,i.rotateZ(I,I,d),i.multiply$1(I,S,I),I}(r.projection,0,r.center,o,n),a=ih(r);return i.scale(s,s,[a,a,1]),s}function ih(r){const n=r.projection,o=iu(r),s=ip(n,r.center),a=ip(n,i.LngLat.convert(n.center));return Math.pow(2,s*o+(1-o)*a)}function iu(r){const n=r.projection.range;if(!n)return 0;const o=Math.max(r.width,r.height),s=Math.log(o/1024)/Math.LN2;return i.smoothstep(n[0]+s,n[1]+s,r.zoom)}const id=1/4e4;function ip(r,n){const o=i.clamp(n.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),s=new i.LngLat(n.lng-180*id,o),a=new i.LngLat(n.lng+180*id,o),l=r.project(s.lng,o),c=r.project(a.lng,o),h=i.MercatorCoordinate.fromLngLat(s),u=i.MercatorCoordinate.fromLngLat(a),d=c.x-l.x,p=c.y-l.y,f=u.x-h.x,m=u.y-h.y,$=Math.sqrt((f*f+m*m)/(d*d+p*p));return Math.log($)/Math.LN2}function im(i,r,n){const o=Math.cos(n),s=Math.sin(n);return{x:i*o-r*s,y:i*s+r*o}}class i${constructor(r,n,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===a||a,this._minZoom=r||0,this._maxZoom=n||22,this._minPitch=null==o?0:o,this._maxPitch=null==s?60:s,this.setProjection(),this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.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 it,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new il,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this._horizonShift=.1}clone(){const i=new i$(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.setProjection(this.getProjection()),i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i.tileSize=this.tileSize,i.setMaxBounds(this.getMaxBounds()),i.width=this.width,i.height=this.height,i.cameraElevationReference=this.cameraElevationReference,i._center=this._center,i._setZoom(this.zoom),i._cameraZoom=this._cameraZoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._nearZ=this._nearZ,i._farZ=this._farZ,i._averageElevation=this._averageElevation,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._camera=this._camera.clone(),i._calcMatrices(),i.freezeTileCoverage=this.freezeTileCoverage,i}get elevation(){return this._elevation}set elevation(i){this._elevation!==i&&(this._elevation=i,i?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())}updateElevation(i){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),i&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return i.pick(this.projection,["name","center","parallels",])}setProjection(r){null==r&&(r={name:"mercator"}),this.projectionOptions=r;const n=this.projection?this.getProjection():void 0;return this.projection=i.getProjection(r),!a(n,this.getProjection())&&(this._calcMatrices(),!0)}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(i){void 0===i?i=!0:null===i&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}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 i.pointGeometry(this.width,this.height)}get bearing(){return i.wrap(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(r){var n,o,s,a,l,c,h,u,d,p;const f=-r*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=(n=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n),o=this.rotationMatrix,s=this.rotationMatrix,a=this.angle,l=s[0],c=s[1],h=s[2],u=s[3],d=Math.sin(a),p=Math.cos(a),o[0]=l*p+h*d,o[1]=c*p+u*d,o[2]=-(l*d)+h*p,o[3]=-(c*d)+u*p)}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const n=i.clamp(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(i){this._averageElevation=i,this._calcFogMatrices()}get zoom(){return this._zoom}set zoom(i){const r=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())}_setZoom(i){this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom}_updateCenterElevation(){if(!this._elevation)return!1;const i=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center),-1);return -1===i?(this._cameraZoom=null,!1):(this._centerAltitude=i,!0)}_updateCameraOnTerrain(){this._cameraZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize)}sampleAverageElevation(){if(!this._elevation)return 0;const r=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8],],o=this.horizonLineFromTop();let s=0,a=0;for(let l=0;lr.maxzoom&&(n=r.maxzoom);const l=this.locationCoordinate(this.center),c=1<{const n=1/4e4,o=new i.MercatorCoordinate(r.x+n,r.y,r.z),s=new i.MercatorCoordinate(r.x,r.y+n,r.z),a=r.toLngLat(),l=o.toLngLat(),c=s.toLngLat(),h=this.locationCoordinate(a),u=this.locationCoordinate(l),d=this.locationCoordinate(c),p=Math.hypot(u.x-h.x,u.y-h.y),f=Math.hypot(d.x-h.x,d.y-h.y);return Math.sqrt(p*f)*v/n},w=r=>{const n=y,o=x;return{aabb:i.tileAABB(this,c,0,0,0,r,o,n,this.projection),zoom:0,x:0,y:0,minZ:o,maxZ:n,wrap:r,fullyVisible:!1}},T=[];let E=[];const S=n,I=r.reparseOverscaled?o:n,M=i=>i*i,A=M((f-this._centerAltitude)*p),C=i=>{if(!this._elevation||!i.tileID||!a)return;const r=this._elevation.getMinMaxForTile(i.tileID),n=i.aabb;r?(n.min[2]=r.min,n.max[2]=r.max,n.center[2]=(n.min[2]+n.max[2])/2):(i.shouldSplit=z(i),i.shouldSplit||(n.min[2]=n.max[2]=n.center[2]=this._centerAltitude))},z=r=>{if(r.zoom.85?1:u}const d=n*n+a*a+l;return d{if(r*M(.707)0;){const P=T.pop(),D=P.x,L=P.y;let B=P.fullyVisible;if(!B){const R=P.aabb.intersects(u);if(0===R)continue;B=2===R}if(P.zoom!==S&&z(P))for(let F=0;F<4;F++){const O=(D<<1)+F%2,U=(L<<1)+(F>>1),V={aabb:a?P.aabb.quadrant(F):i.tileAABB(this,c,P.zoom+1,O,U,P.wrap,P.minZ,P.maxZ,this.projection),zoom:P.zoom+1,x:O,y:U,wrap:P.wrap,fullyVisible:B,tileID:void 0,shouldSplit:void 0,minZ:P.minZ,maxZ:P.maxZ};s&&(V.tileID=new i.OverscaledTileID(P.zoom+1===S?I:P.zoom+1,P.wrap,P.zoom+1,O,U),C(V)),T.push(V)}else{const N=P.zoom===S?I:P.zoom;if(r.minzoom&&r.minzoom>N)continue;const j=h[0]-(.5+D+(P.wrap<{const o=[0,0,0,1],s=[i.EXTENT,i.EXTENT,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());i.transformMat4$1(o,o,a),i.transformMat4$1(s,s,a);const l=i.getAABBPointSquareDist(o,s);if(0===l)return!0;let c=!1;const h=this._elevation;if(h&&l>_&&0!==q){const u=this.calculateProjMatrix(n.tileID.toUnwrapped());let d;r.isTerrainDEM||(d=h.getMinMaxForTile(n.tileID)),d||(d={min:x,max:y});const p=i.furthestTileCorner(this.rotation),f=[p[0]*i.EXTENT,p[1]*i.EXTENT,d.max,];i.transformMat4(f,f,u),c=(1-f[1])*this.height*.5i.distanceSq-r.distanceSq).map(i=>i.tileID)}resize(i,r){this.width=i,this.height=r,this.pixelsToGLUnits=[2/i,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(r){const n=i.clamp(r.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),o=this.projection.project(r.lng,n);return new i.pointGeometry(o.x*this.worldSize,o.y*this.worldSize)}unproject(i){return this.projection.unproject(i.x/this.worldSize,i.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(r,n){const o=this.pointCoordinate(n),s=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(r);this.setLocation(new i.MercatorCoordinate(a.x-(o.x-s.x),a.y-(o.y-s.y)))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i){return this.projection.locationPoint(this,i)}locationPoint3D(i){return this._coordinatePoint(this.locationCoordinate(i),!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i){return this.coordinateLocation(this.pointCoordinate3D(i))}locationCoordinate(r,n){const o=n?i.mercatorZfromAltitude(n,r.lat):void 0,s=this.projection.project(r.lng,r.lat);return new i.MercatorCoordinate(s.x,s.y,o)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(r,n){const o=null!=n?n:this._centerAltitude,s=[r.x,r.y,0,1],a=[r.x,r.y,1,1];i.transformMat4$1(s,s,this.pixelMatrixInverse),i.transformMat4$1(a,a,this.pixelMatrixInverse);const l=a[3];i.scale$1(s,s,1/s[3]),i.scale$1(a,a,1/l);const c=s[2],h=a[2];return{p0:s,p1:a,t:c===h?0:(o-c)/(h-c)}}screenPointToMercatorRay(r){const n=[r.x,r.y,0,1],o=[r.x,r.y,1,1];return i.transformMat4$1(n,n,this.pixelMatrixInverse),i.transformMat4$1(o,o,this.pixelMatrixInverse),i.scale$1(n,n,1/n[3]),i.scale$1(o,o,1/o[3]),n[2]=i.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,o[2]=i.mercatorZfromAltitude(o[2],this._center.lat)*this.worldSize,i.scale$1(n,n,1/this.worldSize),i.scale$1(o,o,1/this.worldSize),new i.Ray([n[0],n[1],n[2]],i.normalize([],i.sub([],o,n)))}rayIntersectionCoordinate(r){const{p0:n,p1:o,t:s}=r,a=i.mercatorZfromAltitude(n[2],this._center.lat),l=i.mercatorZfromAltitude(o[2],this._center.lat);return new i.MercatorCoordinate(i.number(n[0],o[0],s)/this.worldSize,i.number(n[1],o[1],s)/this.worldSize,i.number(a,l,s))}pointCoordinate(i,r=this._centerAltitude){return this.projection.createTileTransform(this,this.worldSize).pointCoordinate(i.x,i.y,r)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);const n=this.elevation;let o=this.elevation.pointCoordinate(r);if(o)return new i.MercatorCoordinate(o[0],o[1],o[2]);let s=0,a=this.horizonLineFromTop();if(r.y>a)return this.pointCoordinate(r);const l=.02*a,c=r.clone();for(let h=0;h<10&&a-s>l;h++){c.y=i.number(s,a,.66);const u=n.pointCoordinate(c);u?(a=c.y,o=u):s=c.y}return o?new i.MercatorCoordinate(o[0],o[1],o[2]):this.pointCoordinate(r)}isPointAboveHorizon(i){if(this.elevation)return!this.elevation.pointCoordinate(i);{const r=this.horizonLineFromTop();return i.y0?new i.pointGeometry(s[0]/s[3],s[1]/s[3]):new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(r,n){var o,s,a,l,c,h,u,d;const p=new i.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),f=new i.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),m=new i.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),$=new i.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let g=this.pointCoordinate(p,r),y=this.pointCoordinate(f,r);const x=this.pointCoordinate(m,n),v=this.pointCoordinate($,n);return g.y>1&&y.y>=0?g=new i.MercatorCoordinate((1-v.y)/(o=v,((s=g).y-o.y)/(s.x-o.x))+v.x,1):g.y<0&&y.y<=1&&(g=new i.MercatorCoordinate(-v.y/(a=v,((l=g).y-a.y)/(l.x-a.x))+v.x,0)),y.y>1&&g.y>=0?y=new i.MercatorCoordinate((1-x.y)/(c=x,((h=y).y-c.y)/(h.x-c.x))+x.x,1):y.y<0&&g.y<=1&&(y=new i.MercatorCoordinate(-x.y/(u=x,((d=y).y-u.y)/(d.x-u.x))+x.x,0)),new i.LngLatBounds().extend(this.coordinateLocation(g)).extend(this.coordinateLocation(y)).extend(this.coordinateLocation(v)).extend(this.coordinateLocation(x))}_getBounds3D(){const i=this.elevation;if(!i.visibleDemTiles.length)return this._getBounds(0,0);const r=i.visibleDemTiles.reduce((i,r)=>{if(r.dem){const n=r.dem.tree;i.min=Math.min(i.min,n.minimums[0]),i.max=Math.max(i.max,n.maximums[0])}return i},{min:Number.MAX_VALUE,max:0});return this._getBounds(r.min*i.exaggeration(),r.max*i.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(i=!0){const r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,n=this.height/2-r*(1-this._horizonShift);return i?Math.max(0,n):n}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-i.MAX_MERCATOR_LATITUDE,this.maxLat=i.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLngp&&(c=p-u),p-dm&&(l=m-h),m-f.5?w-1:w,T>.5?T-1:T,0,]),this.alignedProjMatrix=E,c=i.create(),i.scale(c,c,[this.width/2,-this.height/2,1,]),i.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=i.create(),i.scale(c,c,[1,-1,1]),i.translate(c,c,[-1,-1,0]),i.scale(c,c,[2/this.width,2/this.height,1,]),this.glCoordMatrix=c,this.pixelMatrix=i.multiply$1(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},!(c=i.invert(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");this.pixelMatrixInverse=c,this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const r=this.cameraWorldSize,n=this.cameraPixelsPerMeter,o=this._camera.position,s=1/this.height,a=[r,r,n];i.scale$2(a,a,s),i.scale$2(o,o,-1),i.multiply$2(o,o,a);const l=i.create();i.translate(l,l,o),i.scale(l,l,a),this.mercatorFogMatrix=l,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,n,s)}_computeCameraPosition(i){const r=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,n=this._camera.forward(),o=this.point,s=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)*r-i/this.worldSize*this._centerAltitude;return[o.x/this.worldSize-n[0]*s,o.y/this.worldSize-n[1]*s,i/this.worldSize*this._centerAltitude-n[2]*s,]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),o=r[2];let s=1;o>0&&(s=Math.min((n-this._camera.position[2])/o,1)),this._camera.position=i.scaleAndAdd([],this._camera.position,r,s),this._updateStateFromCamera()}_updateStateFromCamera(){const r=this._camera.position,n=this._camera.forward(),{pitch:o,bearing:s}=this._camera.getPitchBearing(),a=i.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._projectionScaler,l=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.degToRad(this._maxPitch)),c=Math.max((r[2]-a)/Math.cos(o),l),h=this._zoomFromMercatorZ(c);i.scaleAndAdd(r,r,n,c),this._pitch=i.clamp(o,i.degToRad(this.minPitch),i.degToRad(this.maxPitch)),this.angle=i.wrap(s,-Math.PI,Math.PI),this._setZoom(i.clamp(h,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=this.coordinateLocation(new i.MercatorCoordinate(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){const i=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(i*this.tileSize))}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.warnOnce("Terrain is not yet supported with alternate projections. Use mercator to enable terrain."),1))}anyCornerOffEdge(r,n){const o=Math.min(r.x,n.x),s=Math.max(r.x,n.x),a=Math.min(r.y,n.y),l=Math.max(r.y,n.y);if(au||f.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.pointGeometry(0,0),new i.pointGeometry(this.width,this.height))}zoomDeltaToMovement(r,n){const o=i.length(i.sub([],this._camera.position,r)),s=this._zoomFromMercatorZ(o)+n;return o-this._mercatorZfromZoom(s)}getCameraPoint(){const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,r))}}function ig(i,r){let n=!1,o=null;const s=()=>{o=null,n&&(i(),o=setTimeout(s,r),n=!1)};return()=>(n=!0,o||s(),o)}const iy={linearity:.3,easing:i.bezier(0,0,.3,1)},ix=i.extend({deceleration:2500,maxSpeed:1400},iy),iv=i.extend({deceleration:20,maxSpeed:1400},iy),ib=i.extend({deceleration:1e3,maxSpeed:360},iy),iw=i.extend({deceleration:1e3,maxSpeed:90},iy);function iT(i,r){(!i.duration||i.durationn.unproject(i)),h=a.reduce((i,r,n,o)=>i.add(r.div(o.length)),new i.pointGeometry(0,0));super(r,{points:a,point:h,lngLats:c,lngLat:n.unproject(h),originalEvent:o}),this._defaultPrevented=!1}}class iM extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,n){super(i,{originalEvent:n}),this._defaultPrevented=!1}}class iA{constructor(i,r){this._map=i,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new iM(i.type,this._map,i))}mousedown(i,r){return this._mousedownPos=r,this._firePreventable(new iS(i.type,this._map,i))}mouseup(i){this._map.fire(new iS(i.type,this._map,i))}preclick(r){const n=i.extend({},r);n.type="preclick",this._map.fire(new iS(n.type,this._map,n))}click(i,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(i),this._map.fire(new iS(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new iS(i.type,this._map,i))}mouseover(i){this._map.fire(new iS(i.type,this._map,i))}mouseout(i){this._map.fire(new iS(i.type,this._map,i))}touchstart(i){return this._firePreventable(new iI(i.type,this._map,i))}touchmove(i){this._map.fire(new iI(i.type,this._map,i))}touchend(i){this._map.fire(new iI(i.type,this._map,i))}touchcancel(i){this._map.fire(new iI(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class iC{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(i){this._map.fire(new iS(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new iS("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new iS(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class iz{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,r){this.isEnabled()&&i.shiftKey&&0===i.button&&(l.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(i,r){if(!this._active)return;const n=r;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos){this._box&&(this._box.style.transform=`translate(${s}px,${c}px)`,this._box.style.width=a-s+"px",this._box.style.height=h-c+"px")})}mouseupWindow(r,n){if(!this._active||0!==r.button)return;const o=this._startPos,s=n;if(this.reset(),l.suppressClick(),o.x!==s.x||o.y!==s.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:r})),{cameraAnimation:i=>i.fitScreenCoordinates(o,s,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}keydown(i){this._active&&27===i.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",i))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),l.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(r,n){return this._map.fire(new i.Event(r,{originalEvent:n}))}}function ik(i,r){const n={};for(let o=0;othis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=r.timeStamp),o.length===this.numTouches&&(this.centroid=function(r){const n=new i.pointGeometry(0,0);for(const o of r)n._add(o);return n.div(r.length)}(n),this.touches=ik(o,n)))}touchmove(i,r,n){if(this.aborted||!this.centroid)return;const o=ik(n,r);for(const s in this.touches){const a=this.touches[s],l=o[s];(!l||l.dist(a)>30)&&(this.aborted=!0)}}touchend(i,r,n){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,r,n){this.singleTap.touchstart(i,r,n)}touchmove(i,r,n){this.singleTap.touchmove(i,r,n)}touchend(i,r,n){const o=this.singleTap.touchend(i,r,n);if(o){const s=i.timeStamp-this.lastTime<500,a=!this.lastTap||30>this.lastTap.dist(o);if(s&&a||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class iD{constructor(){this._zoomIn=new iP({numTouches:1,numTaps:2}),this._zoomOut=new iP({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,r,n){this._zoomIn.touchstart(i,r,n),this._zoomOut.touchstart(i,r,n)}touchmove(i,r,n){this._zoomIn.touchmove(i,r,n),this._zoomOut.touchmove(i,r,n)}touchend(i,r,n){const o=this._zoomIn.touchend(i,r,n),s=this._zoomOut.touchend(i,r,n);return o?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()+1,around:r.unproject(o)},{originalEvent:i})}):s?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()-1,around:r.unproject(s)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const iL={0:1,2:2};class iB{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(i,r){return!1}_move(i,r){return{}}mousedown(i,r){if(this._lastPoint)return;const n=l.mouseButton(i);this._correctButton(i,n)&&(this._lastPoint=r,this._eventButton=n)}mousemoveWindow(i,r){const n=this._lastPoint;if(n){if(i.preventDefault(),function(i,r){const n=iL[r];return void 0===i.buttons||(i.buttons&n)!==n}(i,this._eventButton))this.reset();else if(this._moved||!(r.dist(n)0&&(this._active=!0);const s=ik(o,n),a=new i.pointGeometry(0,0),l=new i.pointGeometry(0,0);let c=0;for(const h in s){const u=s[h],d=this._touches[h];d&&(a._add(u),l._add(u.sub(d)),c++,s[h]=u)}if(this._touches=s,c{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show")},500)}}class iV{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(i){}_move(i,r,n){return{}}touchstart(i,r,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier,],this._start([r[0],r[1]]))}touchmove(i,r,n){if(!this._firstTwoTouches)return;i.preventDefault();const[o,s]=this._firstTwoTouches,a=iN(n,r,o),l=iN(n,r,s);if(!a||!l)return;const c=this._aroundCenter?null:a.add(l).div(2);return this._move([a,l],c,i)}touchend(i,r,n){if(!this._firstTwoTouches)return;const[o,s]=this._firstTwoTouches,a=iN(n,r,o),c=iN(n,r,s);a&&c||(this._active&&l.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function iN(i,r,n){for(let o=0;oMath.abs(ij(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:ij(this._distance,n),pinchAround:r}}}function iZ(i,r){return 180*i.angleWith(r)/Math.PI}class i_ extends iV{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,r){const n=this._vector;if(this._vector=i[0].sub(i[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:iZ(this._vector,n),pinchAround:r}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());const r=25/(Math.PI*this._minDiameter)*360,n=iZ(i,this._startVector);return Math.abs(n)Math.abs(i.x)}class iX extends iV{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(i){this._lastPoints=i,iq(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,r,n){const o=i[0].sub(this._lastPoints[0]),s=i[1].sub(this._lastPoints[1]);if(!(this._map._cooperativeGestures&&n.touches.length<3)&&(this._valid=this.gestureBeginsVertically(o,s,n.timeStamp),this._valid))return this._lastPoints=i,this._active=!0,{pitchDelta:-((o.y+s.y)/2*.5)}}gestureBeginsVertically(i,r,n){if(void 0!==this._valid)return this._valid;const o=i.mag()>=2,s=r.mag()>=2;if(!o&&!s)return;if(!o||!s)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const a=i.y>0==r.y>0;return iq(i)&&iq(r)&&a}}class iW{constructor(){const i={panStep:100,bearingStep:15,pitchStep:10};this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let r=0,n=0,o=0,s=0,a=0;switch(i.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:i.shiftKey?n=-1:(i.preventDefault(),s=-1);break;case 39:i.shiftKey?n=1:(i.preventDefault(),s=1);break;case 38:i.shiftKey?o=1:(i.preventDefault(),a=-1);break;case 40:i.shiftKey?o=-1:(i.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,o=0),{cameraAnimation:l=>{const c=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:iH,zoom:r?Math.round(c)+r*(i.shiftKey?2:1):c,bearing:l.getBearing()+n*this._bearingStep,pitch:l.getPitch()+o*this._pitchStep,offset:[-s*this._panStep,-a*this._panStep,],center:l.getCenter()},{originalEvent:i})}}}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 iH(i){return i*(2-i)}class iK{constructor(r,n){this._map=r,this._el=r.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert","_isFullscreen",],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||this._isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=r.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const o=i.exported.now(),s=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,0!==n&&n%4.000244140625==0?this._type="wheel":0!==n&&4>Math.abs(n)?this._type="trackpad":s>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=200>Math.abs(s*n)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),r.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=r,this._delta-=n,this._active||this._start(r)),r.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){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 r=l.mousePos(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:r,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 r=this._map.transform,n=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(0!==this._delta){const o="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate;let s=2/(1+Math.exp(-Math.abs(this._delta*o)));this._delta<0&&0!==s&&(s=1/s);const a=n(),l=Math.pow(2,a),c="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):l;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(c*s))),"wheel"===this._type&&(this._startZoom=n(),this._easing=this._smoothOutEasing(200)),this._delta=0}const h="number"==typeof this._targetZoom?this._targetZoom:n(),u=this._startZoom,d=this._easing;let p,f=!1;if("wheel"===this._type&&u&&d){const m=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),$=d(m);p=i.number(u,h,$),m<1?this._frameId||(this._frameId=!0):f=!0}else p=h,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:p-n(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let n=i.ease;if(this._prevEase){const o=this._prevEase,s=(i.exported.now()-o.start)/o.duration,a=o.easing(s+.01)-o.easing(s),l=.27/Math.sqrt(a*a+1e-4)*.01,c=Math.sqrt(.0729-l*l);n=i.bezier(l,c,.25,1)}return this._prevEase={start:i.exported.now(),duration:r,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l.create("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(i.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!!i.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 iY{constructor(i,r){this._clickZoom=i,this._tapZoom=r}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 iJ{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,r){return i.preventDefault(),{cameraAnimation(n){n.easeTo({duration:300,zoom:n.getZoom()+(i.shiftKey?-1:1),around:n.unproject(r)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class iQ{constructor(){this._tap=new iP({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(i,r,n){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=r[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(i,r,n))}touchmove(i,r,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const o=r[0],s=o.y-this._swipePoint.y;return this._swipePoint=o,i.preventDefault(),this._active=!0,{zoomDelta:s/128}}}else this._tap.touchmove(i,r,n)}touchend(i,r,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(i,r,n)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class i0{constructor(i,r,n){this._el=i,this._mousePan=r,this._touchPan=n}enable(i){this._inertiaOptions=i||{},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 i1{constructor(i,r,n){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=r,this._mousePitch=n}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 i2{constructor(i,r,n,o){this._el=i,this._touchZoom=r,this._touchRotate=n,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),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 i3=i=>i.zoom||i.drag||i.pitch||i.rotate;class i5 extends i.Event{}function i4(i){return i.panDelta&&i.panDelta.mag()||i.zoomDelta||i.bearingDelta||i.pitchDelta}const i6="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class i8 extends i.Evented{constructor(r,n){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}getCenter(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(i,r){return this.jumpTo({center:i},r)}panBy(r,n,o){return r=i.pointGeometry.convert(r).mult(-1),this.panTo(this.transform.center,i.extend({offset:r},n),o)}panTo(r,n,o){return this.easeTo(i.extend({center:r},n),o)}getZoom(){return this.transform.zoom}setZoom(i,r){return this.jumpTo({zoom:i},r),this}zoomTo(r,n,o){return this.easeTo(i.extend({zoom:r},n),o)}zoomIn(i,r){return this.zoomTo(this.getZoom()+1,i,r),this}zoomOut(i,r){return this.zoomTo(this.getZoom()-1,i,r),this}getBearing(){return this.transform.bearing}setBearing(i,r){return this.jumpTo({bearing:i},r),this}getPadding(){return this.transform.padding}setPadding(i,r){return this.jumpTo({padding:i},r),this}rotateTo(r,n,o){return this.easeTo(i.extend({bearing:r},n),o)}resetNorth(r,n){return this.rotateTo(0,i.extend({duration:1e3},r),n),this}resetNorthPitch(r,n){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},r),n),this}snapToNorth(i,r){return Math.abs(this.getBearing())$=>{if(T&&(o.zoom=i.number(s,h,$)),E&&(o.bearing=i.number(a,u,$)),S&&(o.pitch=i.number(l,d,$)),I&&(o.interpolatePadding(c,p,$),m=o.centerPoint.add(f)),b)o.setLocationAtPoint(b,w);else{const g=o.zoomScale(o.zoom-s),M=h>s?Math.min(2,v):Math.max(.5,v),A=Math.pow(M,1-$),C=o.unproject(y.add(x.mult($*A)).mult(g));o.setLocationAtPoint(o.renderWorldCopies?C.wrap():C,m)}return r.preloadOnly||this._fireMoveEvents(n),o};if(r.preloadOnly){const A=this._emulate(M,r.duration,o);return this._preloadTiles(A),this}const C={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=T,this._rotating=E,this._pitching=S,this._padding=I,this._easeId=r.easeId,this._prepareEase(n,r.noMoveStart,C),this._ease(M(o),i=>{o.recenterOnTerrain(),this._afterEase(n,i)},r),this}_prepareEase(r,n,o={}){this._moving=!0,this.transform.cameraElevationReference="sea",n||o.moving||this.fire(new i.Event("movestart",r)),this._zooming&&!o.zooming&&this.fire(new i.Event("zoomstart",r)),this._rotating&&!o.rotating&&this.fire(new i.Event("rotatestart",r)),this._pitching&&!o.pitching&&this.fire(new i.Event("pitchstart",r))}_fireMoveEvents(r){this.fire(new i.Event("move",r)),this._zooming&&this.fire(new i.Event("zoom",r)),this._rotating&&this.fire(new i.Event("rotate",r)),this._pitching&&this.fire(new i.Event("pitch",r))}_afterEase(r,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.transform.cameraElevationReference="ground";const o=this._zooming,s=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new i.Event("zoomend",r)),s&&this.fire(new i.Event("rotateend",r)),a&&this.fire(new i.Event("pitchend",r)),this.fire(new i.Event("moveend",r))}flyTo(r,n){if(!r.essential&&i.exported.prefersReducedMotion){const o=i.pick(r,["center","zoom","bearing","pitch","around",]);return this.jumpTo(o,n)}this.stop(),r=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},r);const s=this.transform,a=this.getZoom(),l=this.getBearing(),c=this.getPitch(),h=this.getPadding(),u="zoom"in r?i.clamp(+r.zoom,s.minZoom,s.maxZoom):a,d="bearing"in r?this._normalizeBearing(r.bearing,l):l,p="pitch"in r?+r.pitch:c,f="padding"in r?r.padding:s.padding,m=s.zoomScale(u-a),$=i.pointGeometry.convert(r.offset);let g=s.centerPoint.add($);const y=s.pointLocation(g),x=i.LngLat.convert(r.center||y);this._normalizeCenter(x);const v=s.project(y),b=s.project(x).sub(v);let w=r.curve;const T=Math.max(s.width,s.height),E=T/m,S=b.mag();if("minZoom"in r){const I=i.clamp(Math.min(r.minZoom,a,u),s.minZoom,s.maxZoom),M=T/s.zoomScale(I-a);w=Math.sqrt(M/S*2)}const A=w*w;function C(i){const r=(E*E-T*T+(i?-1:1)*A*A*S*S)/(2*(i?E:T)*A*S);return Math.log(Math.sqrt(r*r+1)-r)}function z(i){return(Math.exp(i)-Math.exp(-i))/2}function k(i){return(Math.exp(i)+Math.exp(-i))/2}const P=C(0);let D=function(i){return k(P)/k(P+w*i)},L=function(i){var r;return T*((k(P)*(z(r=P+w*i)/k(r))-z(P))/A)/S},B=(C(1)-P)/w;if(1e-6>Math.abs(S)||!isFinite(B)){if(1e-6>Math.abs(T-E))return this.easeTo(r,n);const R=Er.maxDuration&&(r.duration=0);const F=l!==d,O=p!==c,U=!s.isPaddingEqual(f),V=o=>s=>{const m=s*B,y=1/D(m);o.zoom=1===s?u:a+o.scaleZoom(y),F&&(o.bearing=i.number(l,d,s)),O&&(o.pitch=i.number(c,p,s)),U&&(o.interpolatePadding(h,f,s),g=o.centerPoint.add($));const w=1===s?x:o.unproject(v.add(b.mult(L(m))).mult(y));return o.setLocationAtPoint(o.renderWorldCopies?w.wrap():w,g),o._updateCenterElevation(),r.preloadOnly||this._fireMoveEvents(n),o};if(r.preloadOnly){const N=this._emulate(V,r.duration,s);return this._preloadTiles(N),this}return this._zooming=!0,this._rotating=F,this._pitching=O,this._padding=U,this._prepareEase(n,!1),this._ease(V(s),()=>this._afterEase(n),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const n=this._onEaseEnd;delete this._onEaseEnd,n.call(this,r)}if(!i){const o=this.handlers;o&&o.stop(!1)}return this}_ease(r,n,o){!1===o.animate||0===o.duration?(r(1),n()):(this._easeStart=i.exported.now(),this._easeOptions=o,this._onEaseFrame=r,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,n){r=i.wrap(r,-180,180);const o=Math.abs(r-n);return Math.abs(r-360-n)180?-360:n<-180?360:0}_emulate(i,r,n){const o=Math.ceil(15*r/1e3),s=[],a=i(n.clone());for(let l=0;l<=o;l++){const c=a(l/o);s.push(c.clone())}return s}}class i9{constructor(r={}){this.options=r,i.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact",],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){const r=this.options&&this.options.compact;return this._map=i,this._container=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=l.create("button","mapboxgl-ctrl-attrib-button",this._container),l.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=l.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),r&&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===r&&(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(i,r){const n=this._map._getUIString(`AttributionControl.${r}`);i.setAttribute("aria-label",n),i.removeAttribute("title"),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}_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 r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN},];if(r){const o=n.reduce((i,r,o)=>(r.value&&(i+=`${r.key}=${r.value}${oi.indexOf(a.attribution)&&i.push(a.attribution)}}i.sort((i,r)=>i.length-r.length),i=i.filter((r,n)=>{for(let o=n+1;o=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i,]:i.unshift(this.options.customAttribution));const l=i.join(" | ");l!==this._attribHTML&&(this._attribHTML=l,i.length?(this._innerContainer.innerHTML=l,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 i7{constructor(){i.bindAll(["_updateLogo"],this),i.bindAll(["_updateCompact"],this)}onAdd(i){this._map=i,this._container=l.create("div","mapboxgl-ctrl");const r=l.create("a","mapboxgl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://www.mapbox.com/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),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(i){i&&"metadata"!==i.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const i=this._map.style._sourceCaches;if(0===Object.entries(i).length)return!0;for(const r in i){const n=i[r].getSource();if(n.hasOwnProperty("mapbox_logo")&&!n.mapbox_logo)return!1}return!0}_updateCompact(){const i=this._container.children;if(i.length){const r=i[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class re{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const r=++this._id;return this._queue.push({callback:i,id:r,cancelled:!1}),r}remove(i){const r=this._currentlyRunning,n=r?this._queue.concat(r):this._queue;for(const o of n)if(o.id===i)return void(o.cancelled=!0)}run(i=0){const r=this._currentlyRunning=this._queue;for(const n of(this._queue=[],r))if(!n.cancelled&&(n.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function rt(r,n,o){if(r=new i.LngLat(r.lng,r.lat),n){const s=new i.LngLat(r.lng-360,r.lat),a=new i.LngLat(r.lng+360,r.lat),l=360*Math.ceil(Math.abs(r.lng-o.center.lng)/360),c=o.locationPoint(r).distSqr(n),h=n.x<0||n.y<0||n.x>o.width||n.y>o.height;o.locationPoint(s).distSqr(n)180;){const u=o.locationPoint(r);if(u.x>=0&&u.y>=0&&u.x<=o.width&&u.y<=o.height)break;r.lng>o.center.lng?r.lng-=360:r.lng+=360}return r}const ri={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 rr extends i.Evented{constructor(r,n){if(super(),(r instanceof i.window.HTMLElement||n)&&(r=i.extend({element:r},n)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer",],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&"auto"!==r.pitchAlignment?r.pitchAlignment:this._rotationAlignment,this._updateMoving=()=>this._update(!0),r&&r.element)this._element=r.element,this._offset=i.pointGeometry.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=l.create("div");const o=l.createSVG("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},this._element),s=l.createSVG("radialGradient",{id:"shadowGradient"},l.createSVG("defs",{},o));l.createSVG("stop",{offset:"10%","stop-opacity":.4},s),l.createSVG("stop",{offset:"100%","stop-opacity":.05},s),l.createSVG("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o),l.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"},o),l.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"},o),l.createSVG("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),this._offset=i.pointGeometry.convert(r&&r.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",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()});const a=this._element.classList;for(const c in ri)a.remove(`mapboxgl-marker-anchor-${c}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(i){return i===this._map||(this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._updateMoving),i.on("moveend",this._update),i.on("remove",this._clearFadeTimer),i._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(r){return this._lngLat=i.LngLat.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(i){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")),i){if(!("offset"in i.options)){const r=Math.sqrt(91.125);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(24.6+r),],"bottom-right":[-r,-1*(24.6+r),],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=i,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(i){const r=i.code,n=i.charCode||i.keyCode;"Space"!==r&&"Enter"!==r&&32!==n&&13!==n||this.togglePopup()}_onMapClick(i){const r=i.originalEvent.target,n=this._element;this._popup&&(r===n||n.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const i=this._popup;return i&&(i.isOpen()?(i.remove(),this._element.setAttribute("aria-expanded","false")):(i.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_evaluateOpacity(){const i=this._pos?this._pos.sub(this._transformedOffset()):null;if(!this._withinScreenBounds(i))return void this._clearFadeTimer();const r=this._map.unproject(i);let n=!1;if(this._map.transform._terrainEnabled()&&this._map.getTerrain()){const o=this._map.getFreeCameraOptions();if(o.position){const s=o.position.toLngLat();n=s.distanceTo(r)<.9*s.distanceTo(this._lngLat)}}const a=(1-this._map._queryFogOpacity(r))*(n?.2:1);this._element.style.opacity=`${a}`,this._popup&&this._popup._setOpacity(`${a}`),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_withinScreenBounds(i){const r=this._map.transform;return!!i&&i.x>=0&&i.x=0&&i.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 i=this._map.transform,r=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&r._rotate(i.angle),"map"===this._pitchAlignment&&(r.y*=Math.cos(i._pitch)),r}getOffset(){return this._offset}setOffset(r){return this._offset=i.pointGeometry.convert(r),this._update(),this}_onMove(r){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=r.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=r.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 i.Event("dragstart"))),this.fire(new i.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 i.Event("dragend")),this._state="inactive"}_addDragHandler(i){this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=i.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(i){return this._draggable=!!i,this._map&&(i?(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(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&"auto"!==i?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const{HTMLImageElement:rn,HTMLElement:ro,ImageBitmap:rs}=i.window;function ra(i){i.parentNode&&i.parentNode.removeChild(i)}class rl{constructor(r,n,o=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new iF({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,o&&(this.mousePitch=new iO({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset",],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(i,r){this.mouseRotate.mousedown(i,r),this.mousePitch&&this.mousePitch.mousedown(i,r),l.disableDrag()}move(i,r){const n=this.map,o=this.mouseRotate.mousemoveWindow(i,r);if(o&&o.bearingDelta&&n.setBearing(n.getBearing()+o.bearingDelta),this.mousePitch){const s=this.mousePitch.mousemoveWindow(i,r);s&&s.pitchDelta&&n.setPitch(n.getPitch()+s.pitchDelta)}}off(){const i=this.element;i.removeEventListener("mousedown",this.mousedown),i.removeEventListener("touchstart",this.touchstart,{passive:!1}),i.removeEventListener("touchmove",this.touchmove),i.removeEventListener("touchend",this.touchend),i.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){l.enableDrag(),i.window.removeEventListener("mousemove",this.mousemove),i.window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(i.extend({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),l.mousePos(this.element,r)),i.window.addEventListener("mousemove",this.mousemove),i.window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,l.mousePos(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){1!==i.targetTouches.length?this.reset():(this._startPos=this._lastPos=l.touchPos(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){1!==i.targetTouches.length?this.reset():(this._lastPos=l.touchPos(this.element,i.targetTouches)[0],this.move({preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){0===i.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)5280?rp(r,o,h/5280,i._getUIString("ScaleControl.Miles"),i):rp(r,o,h,i._getUIString("ScaleControl.Feet"),i)}else n&&"nautical"===n.unit?rp(r,o,c/1852,i._getUIString("ScaleControl.NauticalMiles"),i):c>=1e3?rp(r,o,c/1e3,i._getUIString("ScaleControl.Kilometers"),i):rp(r,o,c,i._getUIString("ScaleControl.Meters"),i)}function rp(i,r,n,o,s){const a=function(i){const r=Math.pow(10,`${Math.floor(i)}`.length-1);let n=i/r;return r*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(i){const r=Math.pow(10,Math.ceil(-Math.log(i)/Math.LN10));return Math.round(i*r)/r}(n))}(n),l=a/n;s._requestDomTask(()=>{i.style.width=r*l+"px",i.innerHTML=`${a} ${o}`})}const rf={version:i.version,supported:r,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:class extends i8{constructor(r){if(null!=(r=i.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},r)).minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(super(new i$(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),r),this._interactive=r.interactive,this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=r.preserveDrawingBuffer,this._antialias=r.antialias,this._trackResize=r.trackResize,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=r.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=r.collectResourceTiming,this._optimizeForTerrain=r.optimizeForTerrain,this._renderTaskQueue=new re,this._domRenderTaskQueue=new re,this._controls=[],this._markers=[],this._mapId=i.uniqueId(),this._locale=i.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 ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},r.locale),this._clickTolerance=r.clickTolerance,this._cooperativeGestures=r.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new class{constructor(i){this.jumpTo(i)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;const n=i.easeCubicInOut((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(i){return i>=this._startTime&&i<=this._endTime}jumpTo(i){this._startTime=-1/0,this._endTime=-1/0,this._start=i,this._end=i}easeTo(i,r,n){this._start=this.getValue(r),this._end=i,this._startTime=r,this._endTime=r+n}}(0),this._requestManager=new i.RequestManager(r.transformRequest,r.accessToken,r.testMode),this._silenceAuthErrors=!!r.testMode,"string"==typeof r.container){if(this._container=i.window.document.getElementById(r.container),!this._container)throw Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof ro))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(this._container.childNodes.length>0&&i.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."),r.maxBounds&&this.setMaxBounds(r.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored",],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),void 0!==i.window&&(i.window.addEventListener("online",this._onWindowOnline,!1),i.window.addEventListener("resize",this._onWindowResize,!1),i.window.addEventListener("orientationchange",this._onWindowResize,!1),i.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new class{constructor(r,n){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new class{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,n=i.exported.now();for(;r.length>0&&n-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:o}of this._inertiaBuffer)n.zoom+=o.zoomDelta||0,n.bearing+=o.bearingDelta||0,n.pitch+=o.pitchDelta||0,o.panDelta&&n.pan._add(o.panDelta),o.around&&(n.around=o.around),o.pinchAround&&(n.pinchAround=o.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const l=iE(n.pan.mag(),s,i.extend({},ix,r||{}));a.offset=n.pan.mult(l.amount/n.pan.mag()),a.center=this._map.transform.center,iT(a,l)}if(n.zoom){const c=iE(n.zoom,s,iv);a.zoom=this._map.transform.zoom+c.amount,iT(a,c)}if(n.bearing){const h=iE(n.bearing,s,ib);a.bearing=this._map.transform.bearing+i.clamp(h.amount,-179,179),iT(a,h)}if(n.pitch){const u=iE(n.pitch,s,iw);a.pitch=this._map.transform.pitch+u.amount,iT(a,u)}if(a.zoom||a.bearing){const d=void 0===n.pinchAround?n.around:n.pinchAround;a.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),i.extend(a,{noMoveStart:!0})}}(r),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new class{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,n){const o=i.sub([],n,r);this.radius=i.length(o[2]<0?i.div([],o,this.constants):[o[0],o[1],0])}projectRay(r){i.div(r,r,this.constants),i.normalize(r,r),i.mul$1(r,r,this.constants);const n=i.scale$2([],r,this.radius);if(n[2]>0){const o=i.scale$2([],[0,0,1],i.dot(n,[0,0,1])),s=i.scale$2([],i.normalize([],[n[0],n[1],0]),this.radius),a=i.add([],n,i.scale$2([],i.sub([],i.add([],s,o),n),2));n[0]=a[0],n[1]=a[1]}return n}},this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),i.bindAll(["handleEvent","handleWindowEvent"],this);const o=this._el;for(const[s,a,l]of(this._listeners=[[o,"touchstart",{passive:!0},],[o,"touchmove",{passive:!1},],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0},],[i.window.document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1},],[o,"keyup",void 0],[o,"wheel",{passive:!1},],[o,"contextmenu",void 0],[i.window,"blur",void 0],],this._listeners))s.addEventListener(a,s===i.window.document?this.handleWindowEvent:this.handleEvent,l)}destroy(){for(const[r,n,o]of this._listeners)r.removeEventListener(n,r===i.window.document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(i){const r=this._map,n=r.getCanvasContainer();this._add("mapEvent",new iA(r,i));const o=r.boxZoom=new iz(r,i);this._add("boxZoom",o);const s=new iD,a=new iJ;r.doubleClickZoom=new iY(a,s),this._add("tapZoom",s),this._add("clickZoom",a);const l=new iQ;this._add("tapDragZoom",l);const c=r.touchPitch=new iX(r);this._add("touchPitch",c);const h=new iF(i),u=new iO(i);r.dragRotate=new i1(i,h,u),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);const d=new iR(i),p=new iU(r,i);r.dragPan=new i0(n,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate",]);const f=new i_,m=new iG;r.touchZoomRotate=new i2(n,m,f,l),this._add("touchRotate",f,["touchPan","touchZoom",]),this._add("touchZoom",m,["touchPan","touchRotate",]),this._add("blockableMapEvent",new iC(r));const $=r.scrollZoom=new iK(r,this);this._add("scrollZoom",$,["mousePan"]);const g=r.keyboard=new iW;for(const y of(this._add("keyboard",g),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard",]))i.interactive&&i[y]&&r[y].enable(i[y])}_add(i,r,n){this._handlers.push({handlerName:i,handler:r,allowed:n}),this._handlersById[i]=r}stop(i){if(!this._updatingCamera){for(const{handler:r}of this._handlers)r.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(i3(this._eventsInProgress))||this.isZooming()}_blockedByActive(i,r,n){for(const o in i)if(o!==n&&(!r||0>r.indexOf(o)))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){const r=[];for(const n of i)this._el.contains(n.target)&&r.push(n);return r}handleEvent(i,r){this._updatingCamera=!0;const n="renderFrame"===i.type,o=n?void 0:i,s={needsRenderFrame:!1},a={},c={},h=i.touches?this._getMapTouches(i.touches):void 0,u=h?l.touchPos(this._el,h):n?void 0:l.mousePos(this._el,i);for(const{handlerName:d,handler:p,allowed:f}of this._handlers){if(!p.isEnabled())continue;let m;this._blockedByActive(c,f,d)?p.reset():p[r||i.type]&&(m=p[r||i.type](i,u,h),this.mergeHandlerResult(s,a,m,d,o),m&&m.needsRenderFrame&&this._triggerRenderFrame()),(m||p.isActive())&&(c[d]=p)}const $={};for(const g in this._previousActiveHandlers)c[g]||($[g]=o);this._previousActiveHandlers=c,(Object.keys($).length||i4(s))&&(this._changes.push([s,a,$]),this._triggerRenderFrame()),(Object.keys(c).length||i4(s))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:y}=s;y&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],y(this._map))}mergeHandlerResult(r,n,o,s,a){if(!o)return;i.extend(r,o);const l={handlerName:s,originalEvent:o.originalEvent||a};void 0!==o.zoomDelta&&(n.zoom=l),void 0!==o.panDelta&&(n.drag=l),void 0!==o.pitchDelta&&(n.pitch=l),void 0!==o.bearingDelta&&(n.rotate=l)}_applyChanges(){const r={},n={},o={};for(const[s,a,l]of this._changes)s.panDelta&&(r.panDelta=(r.panDelta||new i.pointGeometry(0,0))._add(s.panDelta)),s.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(r.around=s.around),void 0!==s.aroundCoord&&(r.aroundCoord=s.aroundCoord),void 0!==s.pinchAround&&(r.pinchAround=s.pinchAround),s.noInertia&&(r.noInertia=s.noInertia),i.extend(n,a),i.extend(o,l);this._updateMapTransform(r,n,o),this._changes=[]}_updateMapTransform(r,n,o){const s=this._map,a=s.transform,l=i=>[i.x,i.y,i.z];if((i=>{const r=this._eventsInProgress.drag;return r&&!this._handlersById[r.handlerName].isActive()})()&&!i4(r)){const c=a.zoom;a.cameraElevationReference="sea",a.recenterOnTerrain(),a.cameraElevationReference="ground",c!==a.zoom&&this._map._update(!0)}if(!i4(r))return this._fireEvents(n,o,!0);let{panDelta:h,zoomDelta:u,bearingDelta:d,pitchDelta:p,around:f,aroundCoord:m,pinchAround:$}=r;void 0!==$&&(f=$),n.drag&&!this._eventsInProgress.drag&&f&&(this._dragOrigin=l(a.pointCoordinate3D(f)),this._trackingEllipsoid.setup(a._camera.position,this._dragOrigin)),a.cameraElevationReference="sea",s._stop(!0),f=f||s.transform.centerPoint,d&&(a.bearing+=d),p&&(a.pitch+=p),a._updateCameraState();const g=[0,0,0];if(h){const y=a.pointCoordinate(f),x=a.pointCoordinate(f.sub(h));y&&x&&(g[0]=x.x-y.x,g[1]=x.y-y.y)}const v=a.zoom,b=[0,0,0];if(u){const w=l(m||a.pointCoordinate3D(f)),T={dir:i.normalize([],i.sub([],w,a._camera.position))};if(T.dir[2]<0){const E=a.zoomDeltaToMovement(w,u);i.scale$2(b,T.dir,E)}}const S=i.add(g,g,b);a._translateCameraConstrained(S),u&&Math.abs(a.zoom-v)>1e-4&&a.recenterOnTerrain(),a.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(n,o,!0)}_fireEvents(r,n,o){const s=i3(this._eventsInProgress),a=i3(r),l={};for(const c in r){const{originalEvent:h}=r[c];this._eventsInProgress[c]||(l[`${c}start`]=h),this._eventsInProgress[c]=r[c]}for(const u in!s&&a&&this._fireEvent("movestart",a.originalEvent),l)this._fireEvent(u,l[u]);for(const d in a&&this._fireEvent("move",a.originalEvent),r){const{originalEvent:p}=r[d];this._fireEvent(d,p)}const f={};let m;for(const $ in this._eventsInProgress){const{handlerName:g,originalEvent:y}=this._eventsInProgress[$];this._handlersById[g].isActive()||(delete this._eventsInProgress[$],m=n[g]||y,f[`${$}end`]=m)}for(const x in f)this._fireEvent(x,f[x]);const v=i3(this._eventsInProgress);if(o&&(s||a)&&!v){var b,w;this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);T?(0!==(b=T.bearing||this._map.getBearing())&&-this._bearingSnap{delete this._frameId,this.handleEvent(new i5("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}(this,r),this._localFontFamily=r.localFontFamily,this._localIdeographFontFamily=r.localIdeographFontFamily,r.style&&this.setStyle(r.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),r.projection&&this.setProjection(r.projection),this._hash=r.hash&&new class{constructor(r){this._hashName=r&&encodeURIComponent(r),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash",],this),this._updateHash=ig(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,i.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return i.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(r){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,s=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,s),l=Math.round(n.lng*a)/a,c=Math.round(n.lat*a)/a,h=this._map.getBearing(),u=this._map.getPitch();let d="";if(d+=r?`/${l}/${c}/${o}`:`${o}/${c}/${l}`,(h||u)&&(d+="/"+Math.round(10*h)/10),u&&(d+=`/${Math.round(u)}`),this._hashName){const p=this._hashName;let f=!1;const m=i.window.location.hash.slice(1).split("&").map(i=>{const r=i.split("=")[0];return r===p?(f=!0,`${r}=${d}`):i}).filter(i=>i);return f||m.push(`${p}=${d}`),`#${m.join("&")}`}return`#${d}`}_getCurrentHash(){const r=i.window.location.hash.replace("#","");if(this._hashName){let n;return r.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(n=i)}),(n&&n[1]||"").split("/")}return r.split("/")}_onHashChange(){const i=this._getCurrentHash();if(i.length>=3&&!i.some(i=>isNaN(i))){const r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:r,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){const r=i.window.location.href.replace(/(#.+)?$/,this.getHashString());i.window.history.replaceState(i.window.history.state,null,r)}}("string"==typeof r.hash&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,i.extend({},r.fitBoundsOptions,{duration:0})))),this.resize(),r.attributionControl&&this.addControl(new i9({customAttribution:r.customAttribution})),this._logoControl=new i7,this.addControl(this._logoControl,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",r=>{this._update("style"===r.dataType),this.fire(new i.Event(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new i.Event(`${r.dataType}dataloading`,r))})}_getMapId(){return this._mapId}addControl(r,n){if(void 0===n&&(n=r.getDefaultPosition?r.getDefaultPosition():"top-right"),!r||!r.onAdd)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=r.onAdd(this);this._controls.push(r);const s=this._controlPositions[n];return -1!==n.indexOf("bottom")?s.insertBefore(o,s.firstChild):s.appendChild(o),this}removeControl(r){if(!r||!r.onRemove)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(r);return n>-1&&this._controls.splice(n,1),r.onRemove(this),this}hasControl(i){return this._controls.indexOf(i)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(r){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 n=!this._moving;return n&&this.fire(new i.Event("movestart",r)).fire(new i.Event("move",r)),this.fire(new i.Event("resize",r)),n&&this.fire(new i.Event("moveend",r)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(r){return this.transform.setMaxBounds(i.LngLatBounds.convert(r)),this._update()}setMinZoom(r){if((r=null==r?-2:r)>=-2&&r<=this.transform.maxZoom)return this.transform.minZoom=r,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=r,this._update(),this.getZoom()>r?this.setZoom(r):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(r){if((r=null==r?0:r)<0)throw Error("minPitch must be greater than or equal to 0");if(r>=0&&r<=this.transform.maxPitch)return this.transform.minPitch=r,this._update(),this.getPitch()85)throw Error("maxPitch must be less than or equal to 85");if(r>=this.transform.minPitch)return this.transform.maxPitch=r,this._update(),this.getPitch()>r?this.setPitch(r):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(i){return this.transform.renderWorldCopies=i,this._update()}getProjection(){return this.transform.getProjection()}setProjection(i){return this._lazyInitEmptyStyle(),"string"==typeof i&&(i={name:i}),this._runtimeProjection=i,this.style.updateProjection(),this._transitionFromGlobe=!1,this}project(r){return this.transform.locationPoint3D(i.LngLat.convert(r))}unproject(r){return this.transform.pointLocation3D(i.pointGeometry.convert(r))}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(i,r,n){if("mouseenter"===i||"mouseover"===i){let o=!1;const s=s=>{const a=r.filter(i=>this.getLayer(i)),l=a.length?this.queryRenderedFeatures(s.point,{layers:a}):[];l.length?o||(o=!0,n.call(this,new iS(i,this,s.originalEvent,{features:l}))):o=!1},a=()=>{o=!1};return{layers:new Set(r),listener:n,delegates:{mousemove:s,mouseout:a}}}if("mouseleave"===i||"mouseout"===i){let l=!1;const c=o=>{const s=r.filter(i=>this.getLayer(i));(s.length?this.queryRenderedFeatures(o.point,{layers:s}):[]).length?l=!0:l&&(l=!1,n.call(this,new iS(i,this,o.originalEvent)))},h=r=>{l&&(l=!1,n.call(this,new iS(i,this,r.originalEvent)))};return{layers:new Set(r),listener:n,delegates:{mousemove:c,mouseout:h}}}{const u=i=>{const o=r.filter(i=>this.getLayer(i)),s=o.length?this.queryRenderedFeatures(i.point,{layers:o}):[];s.length&&(i.features=s,n.call(this,i),delete i.features)};return{layers:new Set(r),listener:n,delegates:{[i]:u}}}}on(i,r,n){if(void 0===n)return super.on(i,r);Array.isArray(r)||(r=[r]);const o=this._createDelegatedListener(i,r,n);for(const s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[i]=this._delegatedListeners[i]||[],this._delegatedListeners[i].push(o),o.delegates)this.on(s,o.delegates[s]);return this}once(i,r,n){if(void 0===n)return super.once(i,r);Array.isArray(r)||(r=[r]);const o=this._createDelegatedListener(i,r,n);for(const s in o.delegates)this.once(s,o.delegates[s]);return this}off(i,r,n){if(void 0===n)return super.off(i,r);r=new Set(Array.isArray(r)?r:[r]);const o=(i,r)=>{if(i.size!==r.size)return!1;for(const n of i)if(!r.has(n))return!1;return!0},s=this._delegatedListeners?this._delegatedListeners[i]:void 0;return s&&(i=>{for(let s=0;s{r?this.fire(new i.ErrorEvent(r)):o&&this._updateDiff(o,n)})}else"object"==typeof r&&this._updateDiff(r,n)}_updateDiff(r,n){try{this.style.setState(r)&&this._update(!0)}catch(o){i.warnOnce(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(r,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():i.warnOnce("There is no style added to the map.")}addSource(i,r){return this._lazyInitEmptyStyle(),this.style.addSource(i,r),this._update(!0)}isSourceLoaded(r){const n=this.style&&this.style._getSourceCaches(r);if(0!==n.length)return n.every(i=>i.loaded());this.fire(new i.ErrorEvent(Error(`There is no source with ID '${r}'`)))}areTilesLoaded(){const i=this.style&&this.style._sourceCaches;for(const r in i){const n=i[r]._tiles;for(const o in n){const s=n[o];if("loaded"!==s.state&&"errored"!==s.state)return!1}}return!0}addSourceType(i,r,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(i,r,n)}removeSource(i){return this.style.removeSource(i),this._updateTerrain(),this._update(!0)}getSource(i){return this.style.getSource(i)}addImage(r,n,{pixelRatio:o=1,sdf:s=!1,stretchX:a,stretchY:l,content:c}={}){if(this._lazyInitEmptyStyle(),n instanceof rn||rs&&n instanceof rs){const{width:h,height:u,data:d}=i.exported.getImageData(n);this.style.addImage(r,{data:new i.RGBAImage({width:h,height:u},d),pixelRatio:o,stretchX:a,stretchY:l,content:c,sdf:s,version:0})}else{if(void 0===n.width||void 0===n.height)return this.fire(new i.ErrorEvent(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:p,height:f,data:m}=n,$=n;this.style.addImage(r,{data:new i.RGBAImage({width:p,height:f},new Uint8Array(m)),pixelRatio:o,stretchX:a,stretchY:l,content:c,sdf:s,version:0,userImage:$}),$.onAdd&&$.onAdd(this,r)}}}updateImage(r,n){const o=this.style.getImage(r);if(!o)return this.fire(new i.ErrorEvent(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=n instanceof rn||rs&&n instanceof rs?i.exported.getImageData(n):n,{width:a,height:l,data:c}=s;return void 0===a||void 0===l?this.fire(new i.ErrorEvent(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):a!==o.data.width||l!==o.data.height?this.fire(new i.ErrorEvent(Error("The width and height of the updated image must be that same as the previous version of the image"))):(o.data.replace(c,!(n instanceof rn||rs&&n instanceof rs)),void this.style.updateImage(r,o))}hasImage(r){return r?!!this.style.getImage(r):(this.fire(new i.ErrorEvent(Error("Missing required image id"))),!1)}removeImage(i){this.style.removeImage(i)}loadImage(r,n){i.getImage(this._requestManager.transformRequest(r,i.ResourceType.Image),(r,o)=>{n(r,o instanceof rn?i.exported.getImageData(o):o)})}listImages(){return this.style.listImages()}addLayer(i,r){return this._lazyInitEmptyStyle(),this.style.addLayer(i,r),this._update(!0)}moveLayer(i,r){return this.style.moveLayer(i,r),this._update(!0)}removeLayer(i){return this.style.removeLayer(i),this._update(!0)}getLayer(i){return this.style.getLayer(i)}setLayerZoomRange(i,r,n){return this.style.setLayerZoomRange(i,r,n),this._update(!0)}setFilter(i,r,n={}){return this.style.setFilter(i,r,n),this._update(!0)}getFilter(i){return this.style.getFilter(i)}setPaintProperty(i,r,n,o={}){return this.style.setPaintProperty(i,r,n,o),this._update(!0)}getPaintProperty(i,r){return this.style.getPaintProperty(i,r)}setLayoutProperty(i,r,n,o={}){return this.style.setLayoutProperty(i,r,n,o),this._update(!0)}getLayoutProperty(i,r){return this.style.getLayoutProperty(i,r)}setLight(i,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(i,r),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(i){return this._lazyInitEmptyStyle(),!i&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(i),this._averageElevationLastSampledAt=-1/0,this._update(!0)}_updateProjection(){"globe"===this.transform.projection.name&&this.transform.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX&&!this._transitionFromGlobe&&(this.setProjection({name:"mercator"}),this._transitionFromGlobe=!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(i){return this._lazyInitEmptyStyle(),this.style.setFog(i),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(r){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.LngLat.convert(r),this.transform):0}setFeatureState(i,r){return this.style.setFeatureState(i,r),this._update()}removeFeatureState(i,r){return this.style.removeFeatureState(i,r),this._update()}getFeatureState(i){return this.style.getFeatureState(i)}_updateContainerDimensions(){if(!this._container)return;const r=this._container.getBoundingClientRect().width||400,n=this._container.getBoundingClientRect().height||300;let o,s=this._container;for(;s&&!o;){const a=i.window.getComputedStyle(s).transform;a&&"none"!==a&&(o=a.match(/matrix.*\((.+)\)/)[1].split(", ")),s=s.parentElement}o?(this._containerWidth=o[0]&&"0"!==o[0]?Math.abs(r/o[0]):r,this._containerHeight=o[3]&&"0"!==o[3]?Math.abs(n/o[3]):n):(this._containerWidth=r,this._containerHeight=n)}_detectMissingCSS(){"rgb(250, 128, 114)"!==i.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&i.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 i=this._container;i.classList.add("mapboxgl-map"),(this._missingCSSCanary=l.create("div","mapboxgl-canary",i)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=l.create("div","mapboxgl-canvas-container",i);this._interactive&&r.classList.add("mapboxgl-interactive"),this._canvas=l.create("canvas","mapboxgl-canvas",r),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 n=this._controlContainer=l.create("div","mapboxgl-control-container",i),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right",].forEach(i=>{o[i]=l.create("div",`mapboxgl-ctrl-${i}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,n){const o=i.exported.devicePixelRatio||1;this._canvas.width=o*Math.ceil(r),this._canvas.height=o*Math.ceil(n),this._canvas.style.width=`${r}px`,this._canvas.style.height=`${n}px`}_addMarker(i){this._markers.push(i)}_removeMarker(i){const r=this._markers.indexOf(i);-1!==r&&this._markers.splice(r,1)}_setupPainter(){const n=i.extend({},r.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),o=this._canvas.getContext("webgl",n)||this._canvas.getContext("experimental-webgl",n);o?(i.storeAuthState(o,!0),this.painter=new ie(o,this.transform),this.on("data",i=>{"source"===i.dataType&&this.painter.setTileLoadedFlag(!0)}),i.exported$1.testSupport(o)):this.fire(new i.ErrorEvent(Error("Failed to initialize WebGL")))}_contextLost(r){r.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:r}))}_contextRestored(r){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:r}))}_onMapScroll(i){if(i.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(i){return this.style&&(this._styleDirty=this._styleDirty||i,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(i){return this._update(),this._renderTaskQueue.add(i)}_cancelRenderFrame(i){this._renderTaskQueue.remove(i)}_requestDomTask(i){!this.loaded()||this.loaded()&&!this.isMoving()?i():this._domRenderTaskQueue.add(i)}_render(r){let n;const o=this.painter.context.extTimerQuery,s=i.exported.now();this.listens("gpu-timing-frame")&&(n=o.createQueryEXT(),o.beginQueryEXT(o.TIME_ELAPSED_EXT,n));let a=this._updateAverageElevation(s);if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(r),this._domRenderTaskQueue.run(r),this._removed)return;this._updateProjection();let l=!1;const c=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const h=this.transform.zoom,u=this.transform.pitch,d=i.exported.now();this.style.zoomHistory.update(h,d);const p=new i.EvaluationParameters(h,{now:d,fadeDuration:c,pitch:u,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),f=p.crossFadingFactor();1===f&&f===this._crossFadingFactor||(l=!0,this._crossFadingFactor=f),this.style.update(p)}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,c,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:c,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.Event("load"))),this.style&&(this.style.hasTransitions()||l)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const m=i.exported.now()-s;o.endQueryEXT(o.TIME_ELAPSED_EXT,n),setTimeout(()=>{const r=o.getQueryObjectEXT(n,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(n),this.fire(new i.Event("gpu-timing-frame",{cpuTime:m,gpuTime:r}))},50)}if(this.listens("gpu-timing-layer")){const $=this.painter.collectGpuTimers();setTimeout(()=>{const r=this.painter.queryGpuTimers($);this.fire(new i.Event("gpu-timing-layer",{layerTimes:r}))},50)}const g=this._sourcesDirty||this._styleDirty||this._placementDirty||a;if(g||this._repaint)this.triggerRepaint();else{const y=!this.isMoving()&&this.loaded();if(y&&(a=this._updateAverageElevation(s,!0)),a)this.triggerRepaint();else if(this._triggerFrame(!1),y&&(this.fire(new i.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const x=this._calculateSpeedIndex();this.fire(new i.Event("speedindexcompleted",{speedIndex:x})),this.speedIndexTiming=!1}}return!this._loaded||this._fullyLoaded||g||(this._fullyLoaded=!0,this._authenticate()),this}_forceMarkerUpdate(){for(const i of this._markers)i._update()}_updateAverageElevation(i,r=!1){const n=i=>(this.transform.averageElevation=i,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&n(0);if((r||i-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(i)){const o=this.transform.averageElevation;let s=this.transform.sampleAverageElevation();isNaN(s)?s=0:this._averageElevationLastSampledAt=i;const a=Math.abs(o-s);if(a>1){if(this._isInitialLoad)return this._averageElevation.jumpTo(s),n(s);this._averageElevation.easeTo(s,i,300)}else if(a>1e-4)return this._averageElevation.jumpTo(s),n(s)}return!!this._averageElevation.isEasing(i)&&n(this._averageElevation.getValue(i))}_authenticate(){i.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,r=>{if(r&&(r.message===i.AUTH_ERR_MSG||401===r.status)){const n=this.painter.context.gl;i.storeAuthState(n,!1),this._logoControl instanceof i7&&this._logoControl._updateLogo(),n&&n.clear(n.DEPTH_BUFFER_BIT|n.COLOR_BUFFER_BIT|n.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.ErrorEvent(Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),i.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const i=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const n=this.painter.context.gl,o=n.createFramebuffer();function s(i){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,i,0);const r=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,r),r}return n.bindFramebuffer(n.FRAMEBUFFER,o),this._canvasPixelComparison(s(i),r.canvasCopies.map(s),r.timeStamps)}_canvasPixelComparison(i,r,n){let o=n[1]-n[0];const s=i.length/4;for(let a=0;a{const r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(i)}))}_preloadTiles(r){const n=this.style&&Object.values(this.style._sourceCaches)||[];return i.asyncAll(n,(i,n)=>i._preloadTiles(r,n),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(i){this._trackResize&&this.resize({originalEvent:i})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(i){this._showTileBoundaries!==i&&(this._showTileBoundaries=i,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(i){this._showTerrainWireframe!==i&&(this._showTerrainWireframe=i,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(i){this._speedIndexTiming!==i&&(this._speedIndexTiming=i,this._update())}get showPadding(){return!!this._showPadding}set showPadding(i){this._showPadding!==i&&(this._showPadding=i,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(i){this._showCollisionBoxes!==i&&(this._showCollisionBoxes=i,i?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(i){this._showOverdrawInspector!==i&&(this._showOverdrawInspector=i,this._update())}get repaint(){return!!this._repaint}set repaint(i){this._repaint!==i&&(this._repaint=i,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(i){this._vertices=i,this._update()}_setCacheLimits(r,n){i.setCacheLimits(r,n)}get version(){return i.version}},NavigationControl:class{constructor(r){this.options=i.extend({},{showCompass:!0,showZoom:!0,visualizePitch:!1},r),this._container=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons",],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),l.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),l.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=l.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))}_updateZoomButtons(){const i=this._map.getZoom(),r=i===this._map.getMaxZoom(),n=i===this._map.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const i=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=i)})}onAdd(i){return this._map=i,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 rl(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(i,r){const n=l.create("button",i,this._container);return n.type="button",n.addEventListener("click",r),n}_setButtonTitle(i,r){const n=this._map._getUIString(`NavigationControl.${r}`);i.setAttribute("aria-label",n),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends i.Evented{constructor(r){super(),this.options=i.extend({},{positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},r),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation",],this),this._onDeviceOrientationListener=this._onDeviceOrientation.bind(this),this._updateMarkerRotationThrottled=ig(this._updateMarkerRotation,20)}onAdd(r){var n;return this._map=r,this._container=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),n=this._setupUI,void 0!==rc?n(rc):void 0!==i.window.navigator.permissions?i.window.navigator.permissions.query({name:"geolocation"}).then(i=>{n(rc="denied"!==i.state)}):n(rc=!!i.window.navigator.geolocation),this._container}onRemove(){void 0!==this._geolocationWatchID&&(i.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,rh=0,ru=!1}_isOutOfMapMaxBounds(i){const r=this._map.getMaxBounds(),n=i.coords;return r&&(n.longituder.getEast()||n.latituder.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(r){if(this._map){if(this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,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(r),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",r)),this._finish()}}_updateCamera(r){const n=new i.LngLat(r.coords.longitude,r.coords.latitude),o=r.coords.accuracy,s=this._map.getBearing(),a=i.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(o),a,{geolocateSource:!0})}_updateMarker(r){if(r){const n=new i.LngLat(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const i=this._map._containerHeight/2,r=this._map.unproject([0,i]),n=this._map.unproject([100,i]),o=r.distanceTo(n)/100,s=Math.ceil(2*this._accuracy/o);this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}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(r){if(this._map){if(this.options.trackUserLocation){if(1===r.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 n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===r.code&&ru)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",r)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(r){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=l.create("button","mapboxgl-ctrl-geolocate",this._container),l.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===r){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",o),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=l.create("div","mapboxgl-user-location"),this._dotElement.appendChild(l.create("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(l.create("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new rr({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=l.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new rr({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",r=>{r.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r.originalEvent&&"resize"===r.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.Event("trackuserlocationend")))})}_onDeviceOrientation(i){this._userLocationDotMarker&&(i.webkitCompassHeading?this._heading=i.webkitCompassHeading:!0===i.absolute&&(this._heading=-1*i.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.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 i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":rh--,ru=!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 i.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 i.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 r;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++rh>1?(r={maximumAge:6e5,timeout:0},ru=!0):(r=this.options.positionOptions,ru=!1),this._geolocationWatchID=i.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,r),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else i.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const r=()=>{i.window.addEventListener("ondeviceorientationabsolute"in i.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientationListener)};void 0!==i.window.DeviceMotionEvent&&"function"==typeof i.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(i=>{"granted"===i&&r()}).catch(console.error):r()}_clearWatch(){i.window.navigator.geolocation.clearWatch(this._geolocationWatchID),i.window.removeEventListener("deviceorientation",this._onDeviceOrientationListener),i.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:i9,ScaleControl:class{constructor(r){this.options=i.extend({},{maxWidth:100,unit:"metric"},r),i.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){rd(this._map,this._container,this.options)}onAdd(i){return this._map=i,this._container=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",i.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(i){this.options.unit=i,rd(this._map,this._container,this.options)}},FullscreenControl:class{constructor(r){this._fullscreen=!1,r&&r.container&&(r.container instanceof i.window.HTMLElement?this._container=r.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon",],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in i.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(r){return this._map=r,this._container||(this._container=this._map.getContainer()),this._controlContainer=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!i.window.document.fullscreenEnabled&&!i.window.document.webkitFullscreenEnabled)}_setupUI(){const r=this._fullscreenButton=l.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);l.create("span","mapboxgl-ctrl-icon",r).setAttribute("aria-hidden",!0),r.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const i=this._getTitle();this._fullscreenButton.setAttribute("aria-label",i),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",i)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(i.window.document.fullscreenElement||i.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()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends i.Evented{constructor(r){super(),this.options=i.extend(Object.create({closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"}),r),i.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag",],this),this._classList=new Set(r&&r.className?r.className.trim().split(/\s+/):[])}addTo(r){return this._map&&this.remove(),this._map=r,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 i.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 i.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=i.LngLat.convert(r),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(r){return this.setDOMContent(i.window.document.createTextNode(r))}setHTML(r){const n=i.window.document.createDocumentFragment(),o=i.window.document.createElement("body");let s;for(o.innerHTML=r;s=o.firstChild;)n.appendChild(s);return this.setDOMContent(n)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(i){return this.options.maxWidth=i,this._update(),this}setDOMContent(i){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=l.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(i),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(i){return this._classList.add(i),this._container&&this._updateClassList(),this}removeClassName(i){return this._classList.delete(i),this._container&&this._updateClassList(),this}setOffset(i){return this.options.offset=i,this._update(),this}toggleClassName(i){let r;return this._classList.delete(i)?r=!1:(this._classList.add(i),r=!0),this._container&&this._updateClassList(),r}_createCloseButton(){this.options.closeButton&&(this._closeButton=l.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(i){this._update(i.point)}_onMouseMove(i){this._update(i.point)}_onDrag(i){this._update(i.point)}_getAnchor(i){if(this.options.anchor)return this.options.anchor;const r=this._pos,n=this._container.offsetWidth,o=this._container.offsetHeight;let s;return s=r.y+i.bottom.ythis._map.transform.height-o?["bottom"]:[],r.xthis._map.transform.width-n/2&&s.push("right"),0===s.length?"bottom":s.join("-")}_updateClassList(){const i=[...this._classList];i.push("mapboxgl-popup"),this._anchor&&i.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&i.push("mapboxgl-popup-track-pointer"),this._container.className=i.join(" ")}_update(r){if(this._map&&(this._lngLat||this._trackPointer)&&this._content){if(this._container||(this._container=l.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=l.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=rt(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||r){const n=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat),o=function(r){if(r||(r=new i.pointGeometry(0,0)),"number"==typeof r){const n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new i.pointGeometry(0,0),top:new i.pointGeometry(0,r),"top-left":new i.pointGeometry(n,n),"top-right":new i.pointGeometry(-n,n),bottom:new i.pointGeometry(0,-r),"bottom-left":new i.pointGeometry(n,-n),"bottom-right":new i.pointGeometry(-n,-n),left:new i.pointGeometry(r,0),right:new i.pointGeometry(-r,0)}}if(r instanceof i.pointGeometry||Array.isArray(r)){const o=i.pointGeometry.convert(r);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}return{center:i.pointGeometry.convert(r.center||[0,0,]),top:i.pointGeometry.convert(r.top||[0,0]),"top-left":i.pointGeometry.convert(r["top-left"]||[0,0]),"top-right":i.pointGeometry.convert(r["top-right"]||[0,0]),bottom:i.pointGeometry.convert(r.bottom||[0,0,]),"bottom-left":i.pointGeometry.convert(r["bottom-left"]||[0,0]),"bottom-right":i.pointGeometry.convert(r["bottom-right"]||[0,0]),left:i.pointGeometry.convert(r.left||[0,0]),right:i.pointGeometry.convert(r.right||[0,0,])}}(this.options.offset),s=this._anchor=this._getAnchor(o),a=n.add(o[s]).round();this._map._requestDomTask(()=>{this._container&&s&&(this._container.style.transform=`${ri[s]} translate(${a.x}px,${a.y}px)`)})}this._updateClassList()}}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const i=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])");i&&i.focus()}_onClose(){this.remove()}_setOpacity(i){this._content&&(this._content.style.opacity=i),this._tip&&(this._tip.style.opacity=i)}},Marker:rr,Style:eK,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,FreeCameraOptions:ia,Evented:i.Evented,config:i.config,prewarm:function(){et().acquire(J)},clearPrewarmedResources:function(){const i=ee;i&&(i.isPreloaded()&&1===i.numActive()?(i.release(J),ee=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 i.config.ACCESS_TOKEN},set accessToken(t){i.config.ACCESS_TOKEN=t},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(t){i.config.API_URL=t},get workerCount(){return Q.workerCount},set workerCount(e){Q.workerCount=e},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){i.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(r){i.clearTileCache(r)},workerUrl:"",workerClass:null,setNow:i.exported.setNow,restoreNow:i.exported.restoreNow};return rf}),n},i.exports=o()}},]); + with id '${r.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(i){i.coord&&"source"===i.dataType?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):"style"===i.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const i in this._style._sourceCaches)this._style._sourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(i=>i.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 i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,o=this.painter.transform;this._initializing&&(this._initializing=0===o._centerAltitude&&-1===this.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(o.center),-1),this._emptyDEMTextureDirty=!this._initializing);const s=this.proxyCoords=n.getIds().map(i=>{const r=n.getTileByID(i).tileID;return r.projMatrix=o.calculateProjMatrix(r.toUnwrapped()),r});(function(r,n){const o=n.transform.pointCoordinate(n.transform.getCameraPoint()),s=new i.pointGeometry(o.x,o.y);r.sort((r,n)=>{if(n.overscaledZ-r.overscaledZ)return n.overscaledZ-r.overscaledZ;const o=new i.pointGeometry(r.canonical.x+(1<{this.proxyToSource[i.key]={}}),this.terrainTileForTile={};const l=this._style._sourceCaches;for(const c in l){const h=l[c];if(!h.used||(h!==this.sourceCache&&this.resetTileLookupCache(h.id),this._setupProxiedCoordsForOrtho(h,r[c],a),h.usedForTerrain))continue;const u=r[c];h.getSource().reparseOverscaled&&this._assignTerrainTiles(u)}this.proxiedCoords[n.id]=s.map(i=>new tW(i,i.key,this.orthoMatrix)),this._assignTerrainTiles(s),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(a),this.renderingToTexture=!1,this._updateTimestamp=i.exported.now();const d={};for(const p of(this._visibleDemTiles=[],this.proxyCoords)){const f=this.terrainTileForTile[p.key];if(!f)continue;const m=f.tileID.key;m in d||(this._visibleDemTiles.push(f),d[m]=m)}}_assignTerrainTiles(i){this._initializing||i.forEach(i=>{if(this.terrainTileForTile[i.key])return;const r=this._findTileCoveringTileID(i,this.sourceCache);r&&(this.terrainTileForTile[i.key]=r)})}_prepareDEMTextures(){const i=this.painter.context,r=i.gl;for(const n in this.terrainTileForTile){const o=this.terrainTileForTile[n],s=o.dem;s&&(!o.demTexture||o.needsDEMTextureUpload)&&(i.activeTexture.set(r.TEXTURE1),tB(this.painter,o,s))}}_prepareDemTileUniforms(i,r,n,o){if(!r||null==r.demTexture)return!1;const s=i.tileID.canonical,a=Math.pow(2,r.tileID.canonical.z-s.z),l=o||"";return n[`u_dem_tl${l}`]=[s.x*a%1,s.y*a%1,],n[`u_dem_scale${l}`]=a,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const r=this.painter.context,n=r.gl;if(!this._emptyDepthBufferTexture){const o={width:1,height:1,data:new Uint8Array([255,255,255,255,])};this._emptyDepthBufferTexture=new i.Texture(r,o,n.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let i=0;const r=this._visibleDemTiles.reduce((r,n)=>{if(!n.dem)return r;const o=n.dem.tree.minimums[0];return o>0&&i++,r+o},0);return i?r/i:0}_updateEmptyDEMTexture(){const r=this.painter.context,n=r.gl;r.activeTexture.set(n.TEXTURE2);const o=this._getLoadedAreaMinimum(),s={width:1,height:1,data:new Uint8Array(i.DEMData.pack(o,this.sourceCache.getSource().encoding))};this._emptyDEMTextureDirty=!1;let a=this._emptyDEMTexture;return a?a.update(s,{premultiply:!1}):a=this._emptyDEMTexture=new i.Texture(r,s,n.RGBA,{premultiply:!1}),a}setupElevationDraw(r,n,o){var s;const a=this.painter.context,l=a.gl,c=(s=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:i.DEMData.getUnpackVector(s),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 h=this.painter.transform,u=h.projection.createTileTransform(h,h.worldSize),d=r.tileID.canonical;c.u_tile_tl_up=u.upVector(d,0,0),c.u_tile_tr_up=u.upVector(d,i.EXTENT,0),c.u_tile_br_up=u.upVector(d,i.EXTENT,i.EXTENT),c.u_tile_bl_up=u.upVector(d,0,i.EXTENT),c.u_tile_up_scale=u.upVectorScale(d);let p=null,f=null,m=1;if(o&&o.morphing&&this._useVertexMorphing){const $=o.morphing.srcDemTile,g=o.morphing.dstDemTile;m=o.morphing.phase,$&&g&&(this._prepareDemTileUniforms(r,$,c,"_prev")&&(f=$),this._prepareDemTileUniforms(r,g,c)&&(p=g))}if(f&&p?(a.activeTexture.set(l.TEXTURE2),p.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),a.activeTexture.set(l.TEXTURE4),f.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE,l.NEAREST),c.u_dem_lerp=m):(p=this.terrainTileForTile[r.tileID.key],a.activeTexture.set(l.TEXTURE2),(this._prepareDemTileUniforms(r,p,c)?p.demTexture:this.emptyDEMTexture).bind(l.NEAREST,l.CLAMP_TO_EDGE)),a.activeTexture.set(l.TEXTURE3),o&&o.useDepthForOcclusion?(this._depthTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height,]):(this.emptyDepthBufferTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.u_depth_size_inv=[1,1]),o&&o.useMeterToDem&&p){const y=(1<{if(u===i)return;const o=[];n&&o.push(tj[d]),o.push(tj[i]),o.push("PROJECTION_GLOBE_VIEW"),h=r.useProgram("globeRaster",null,o),u=i},f=r.colorModeForRenderPass(),m=new i.DepthMode(c.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tN.update(a);const $=r.transform,g=i.calculateGlobeMatrix($,$.worldSize),y=i.calculateGlobeMercatorMatrix($),x=[i.mercatorXfromLng($.center.lng),i.mercatorYfromLat($.center.lat),],v=r.globeSharedBuffers;(d?[!1,!0]:[!1]).forEach(d=>{u=-1;const b=d?c.LINES:c.TRIANGLES;for(const w of s){const T=o.getTile(w),E=Math.pow(2,w.canonical.z),[S,I]=i.globeBuffersForTileMesh(r,T,w,E),M=i.StencilMode.disabled,A=n.prevTerrainTileForTile[w.key],C=n.terrainTileForTile[w.key];tV(A,C)&&tN.newMorphing(w.key,A,C,a,250),l.activeTexture.set(c.TEXTURE0),T.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);const z=tN.getMorphValuesForProxy(w.key),k=z?1:0,P={};z&&i.extend$1(P,{morphing:{srcDemTile:z.from,dstDemTile:z.to,phase:i.easeCubicInOut(z.phase)}});const D=i.globeMatrixForTile(w.canonical,g),L=tU($.projMatrix,D,y,i.globeToMercatorTransition($.zoom),x);if(p(k,d),n.setupElevationDraw(T,h,P),r.prepareDrawProgram(l,h,w.toUnwrapped()),v){const[B,R]=d?v.getWirefameBuffer(r.context):[v.gridIndexBuffer,v.gridSegments,];h.draw(l,b,m,M,f,i.CullFaceMode.backCCW,L,"globe_raster",S,B,R)}if(!d){const F=[0===w.canonical.y?i.globePoleMatrixForTile(w.canonical,!1,$):null,w.canonical.y===E-1?i.globePoleMatrixForTile(w.canonical,!0,$):null,];for(const O of F){if(!O)continue;const U=tU($.projMatrix,O,O,0,x);v&&h.draw(l,b,m,M,f,i.CullFaceMode.disabled,U,"globe_pole_raster",I,v.poleIndexBuffer,v.poleSegments)}}}})}(r,n,o,s,a);else{const l=r.context,c=l.gl;let h,u;const d=r.options.showTerrainWireframe?2:0,p=(i,n)=>{if(u===i)return;const o=[tj[i]];n&&o.push(tj[d]),h=r.useProgram("terrainRaster",null,o),u=i},f=r.colorModeForRenderPass(),m=new i.DepthMode(c.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);tN.update(a);const $=r.transform,g=6*Math.pow(1.5,22-$.zoom)*n.exaggeration();(d?[!1,!0]:[!1]).forEach(d=>{u=-1;const y=d?c.LINES:c.TRIANGLES,[x,v]=d?n.getWirefameBuffer():[n.gridIndexBuffer,n.gridSegments,];for(const b of s){const w=o.getTile(b),T=i.StencilMode.disabled,E=n.prevTerrainTileForTile[b.key],S=n.terrainTileForTile[b.key];tV(E,S)&&tN.newMorphing(b.key,E,S,a,250),l.activeTexture.set(c.TEXTURE0),w.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST);const I=tN.getMorphValuesForProxy(b.key),M=I?1:0;let A;I&&(A={morphing:{srcDemTile:I.from,dstDemTile:I.to,phase:i.easeCubicInOut(I.phase)}});const C=tO(b.projMatrix,tG(b.canonical,$.renderWorldCopies)?g/10:g);p(M,d),n.setupElevationDraw(w,h,A),r.prepareDrawProgram(l,h,b.toUnwrapped()),h.draw(l,y,m,T,f,i.CullFaceMode.backCCW,C,"terrain_raster",n.gridBuffer,x,v)}})}}(n,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,r.splice(0,r.length))}renderBatch(r){if(0===this._drapedRenderBatches.length)return r+1;this.renderingToTexture=!0;const n=this.painter,o=this.painter.context,s=this.proxySourceCache,a=this.proxiedCoords[s.id],l=this._drapedRenderBatches.shift(),c=[],h=n.style.order;let u=0;for(const d of a){const p=s.getTileByID(d.proxyTileKey),f=s.proxyCachedFBO[d.key]?s.proxyCachedFBO[d.key][r]:void 0,m=void 0!==f?s.renderCache[f]:this.pool[u++],$=void 0!==f;if(p.texture=m.tex,$&&!m.dirty){c.push(p.tileID);continue}let g;o.bindFramebuffer.set(m.fb.framebuffer),this.renderedToTile=!1,m.dirty&&(o.clear({color:i.Color.transparent,stencil:0}),m.dirty=!1);for(let y=l.start;y<=l.end;++y){const x=n.style._layers[h[y]];if(x.isHidden(n.transform.zoom))continue;const v=n.style._getLayerSourceCache(x),b=v?this.proxyToSource[d.key][v.id]:[d];if(!b)continue;const w=b;o.viewport.set([0,0,m.fb.width,m.fb.height,]),g!==(v?v.id:null)&&(this._setupStencil(m,b,x,v),g=v?v.id:null),n.renderLayer(n,v,x,w)}this.renderedToTile?(m.dirty=!0,c.push(p.tileID)):$||--u,5===u&&(u=0,this.renderToBackBuffer(c))}return this.renderToBackBuffer(c),this.renderingToTexture=!1,o.bindFramebuffer.set(null),o.viewport.set([0,0,n.width,n.height]),l.end+1}postRender(){}renderCacheEfficiency(i){const r=i.order.length;if(0===r)return{efficiency:100};let n,o=0,s=0,a=!1;for(let l=0;li.dem).forEach(r=>{i=Math.min(i,r.dem.tree.minimums[0])}),0===i?i:(i-30)*this._exaggeration}raycast(i,r,n){if(!this._visibleDemTiles)return null;const o=this._visibleDemTiles.filter(i=>i.dem).map(o=>{const s=o.tileID,a=Math.pow(2,s.overscaledZ),{x:l,y:c}=s.canonical,h=l/a,u=(l+1)/a,d=c/a,p=(c+1)/a;return{minx:h,miny:d,maxx:u,maxy:p,t:o.dem.tree.raycastRoot(h,d,u,p,i,r,n),tile:o}});for(const s of(o.sort((i,r)=>(null!==i.t?i.t:Number.MAX_VALUE)-(null!==r.t?r.t:Number.MAX_VALUE)),o)){if(null==s.t)break;const a=s.tile.dem.tree.raycast(s.minx,s.miny,s.maxx,s.maxy,i,r,n);if(null!=a)return a}return null}_createFBO(){const r=this.painter.context,n=r.gl,o=this.drapeBufferSize;r.activeTexture.set(n.TEXTURE0);const s=new i.Texture(r,{width:o[0],height:o[1],data:null},n.RGBA);s.bind(n.LINEAR,n.CLAMP_TO_EDGE);const a=r.createFramebuffer(o[0],o[1],!1);return a.colorAttachment.set(s.texture),a.depthAttachment=new ep(r,a.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,o[0],o[1]),this._stencilRef=0,a.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):a.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&!r.extTextureFilterAnisotropicForceOff&&n.texParameterf(n.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:a,tex:s,dirty:!1}}_initFBOPool(){for(;this.pool.length{const r=this._style._layers[i],n=r.isHidden(this.painter.transform.zoom),o=r.getCrossfadeParameters(),s=!!o&&1!==o.t,a=r.hasTransition();return"custom"!==r.type&&!n&&(s||a)})}_clearRasterFadeFromRenderCache(){let i=!1;for(const r in this._style._sourceCaches)if(this._style._sourceCaches[r]._source instanceof ev){i=!0;break}if(i)for(let n=0;nr.renderCachePool.length){const n=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let o=0;o=0;c--){const h=a[c];if(r.getTileByID(h.key),void 0!==r.proxyCachedFBO[h.key]){const u=i[h.key],d=this.proxyToSource[h.key];let p=0;for(const f in d){const m=d[f],$=u[f];if(!$||$.length!==m.length||m.some((i,r)=>i!==$[r]||l[f]&&l[f].hasOwnProperty(i.key))){p=-1;break}++p}for(const g in r.proxyCachedFBO[h.key])r.renderCache[r.proxyCachedFBO[h.key][g]].dirty=p<0||p!==Object.values(u).length}}const y=[...this._drapedRenderBatches];for(const x of(y.sort((i,r)=>r.end-r.start-(i.end-i.start)),y))for(const v of a){if(r.proxyCachedFBO[v.key])continue;let b=r.renderCachePool.pop();void 0===b&&r.renderCache.length<50&&(b=r.renderCache.length,r.renderCache.push(this._createFBO())),void 0!==b&&(r.proxyCachedFBO[v.key]={},r.proxyCachedFBO[v.key][x.start]=b,r.renderCache[b].dirty=!0)}this._tilesDirty={}}_setupStencil(i,r,n,o){if(!o||!this._sourceTilesOverlap[o.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const s=this.painter.context,a=s.gl;if(r.length<=1)return void(this._overlapStencilType=!1);let l;if(n.isTileClipped())l=r.length,this._overlapStencilMode.test={func:a.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>r[r.length-1].overscaledZ))return void(this._overlapStencilType=!1);l=1,this._overlapStencilMode.test={func:a.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+l>255&&(s.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=l,this._overlapStencilMode.ref=this._stencilRef,n.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):i.StencilMode.disabled}_renderTileClippingMasks(r,n){const o=this.painter,s=this.painter.context,a=s.gl;o._tileClippingMaskIDs={},s.setColorMode(i.ColorMode.disabled),s.setDepthMode(i.DepthMode.disabled);const l=o.useProgram("clippingMask");for(const c of r){const h=o._tileClippingMaskIDs[c.key]=--n;l.draw(s,a.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:a.ALWAYS,mask:0},h,255,a.KEEP,a.KEEP,a.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,tZ(c.projMatrix),"$clipping",o.tileExtentBuffer,o.quadTriangleIndexBuffer,o.tileExtentSegments)}}pointCoordinate(r){const n=this.painter.transform;if(r.x<0||r.x>n.width||r.y<0||r.y>n.height)return null;const o=[r.x,r.y,1,1];i.transformMat4$1(o,o,n.pixelMatrixInverse),i.scale$1(o,o,1/o[3]),o[0]/=n.worldSize,o[1]/=n.worldSize;const s=n._camera.position,a=i.mercatorZfromAltitude(1,n.center.lat),l=[s[0],s[1],s[2]/a,0],c=i.subtract([],o.slice(0,3),l);i.normalize(c,c);const h=this.raycast(l,c,this._exaggeration);return null!==h&&h?(i.scaleAndAdd(l,l,c,h),l[3]=l[2],l[2]*=a,l):null}drawDepth(){const r=this.painter,n=r.context,o=this.proxySourceCache,s=Math.ceil(r.width),a=Math.ceil(r.height);if(this._depthFBO&&(this._depthFBO.width!==s||this._depthFBO.height!==a)&&(this._depthFBO.destroy(),delete this._depthFBO,delete this._depthTexture),!this._depthFBO){const l=n.gl,c=n.createFramebuffer(s,a,!0);n.activeTexture.set(l.TEXTURE0);const h=new i.Texture(n,{width:s,height:a,data:null},l.RGBA);h.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.colorAttachment.set(h.texture);const u=n.createRenderbuffer(n.gl.DEPTH_COMPONENT16,s,a);c.depthAttachment.set(u),this._depthFBO=c,this._depthTexture=h}n.bindFramebuffer.set(this._depthFBO.framebuffer),n.viewport.set([0,0,s,a]),function(r,n,o,s){if("globe"===r.transform.projection.name)return;const a=r.context,l=a.gl;a.clear({depth:1});const c=r.useProgram("terrainDepth"),h=new i.DepthMode(l.LESS,i.DepthMode.ReadWrite,r.depthRangeFor3D);for(const u of s){const d=o.getTile(u),p=tO(u.projMatrix,0);n.setupElevationDraw(d,c),c.draw(a,l.TRIANGLES,h,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.backCCW,p,"terrain_depth",n.gridBuffer,n.gridIndexBuffer,n.gridNoSkirtSegments)}}(r,this,o,this.proxyCoords)}_setupProxiedCoordsForOrtho(i,r,n){if(i.getSource() instanceof eT)return this._setupProxiedCoordsForImageSource(i,r,n);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};const o=this.proxiedCoords[i.id]=[],s=this.proxyCoords;for(let a=0;a(i.min.x=Math.min(i.min.x,r.x-c.x),i.min.y=Math.min(i.min.y,r.y-c.y),i.max.x=Math.max(i.max.x,r.x-c.x),i.max.y=Math.max(i.max.y,r.y-c.y),i),{min:new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=(r,n)=>{const o=r.wrap+r.canonical.x/(1<l+h.max.x||s+ac+h.max.y};for(let d=0;di.key===n.tileID.key);if(a)return a}if(n.tileID.key!==r.key){const l=r.canonical.z-n.tileID.canonical.z;let c,h,u;s=i.create();const d=n.tileID.wrap-r.wrap<0?(h=(c=i.EXTENT>>l)*((n.tileID.canonical.x<=d){const p=r.canonical.z-d;n.getSource().reparseOverscaled?(c=Math.max(r.canonical.z+2,n.transform.tileZoom),l=new i.OverscaledTileID(c,r.wrap,d,r.canonical.x>>p,r.canonical.y>>p)):0!==p&&(c=d,l=new i.OverscaledTileID(c,r.wrap,d,r.canonical.x>>p,r.canonical.y>>p))}l.key!==r.key&&(u.push(l.key),o=n.getTile(l))}const f=i=>{u.forEach(r=>{s[r]=i}),u.length=0};for(c-=1;c>=h&&(!o||!o.hasData());c--){o&&f(o.tileID.key);const m=l.calculateScaledKey(c);if((o=n.getTileByID(m))&&o.hasData())break;const $=s[m];if(null===$)break;void 0===$?u.push(m):o=n.getTileByID($)}return f(o?o.tileID.key:null),o&&o.hasData()?o:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(i){this.renderedToTile=!0}_clearRenderCacheForTile(i,r){let n=this._tilesDirty[i];n||(n=this._tilesDirty[i]={}),n[r.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const r=function(r){let n,o,s;const a=new i.StructArrayLayout2ui4;for(o=1;o<129;o++){for(n=1;n<129;n++)s=131*o+n,a.emplaceBack(s,s+1),a.emplaceBack(s,s+131),a.emplaceBack(s+1,s+131),128===o&&a.emplaceBack(s+131,s+131+1);a.emplaceBack(s+1,s+1+131)}return a}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(r),this.wireframeSegments=i.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,r.length)}return[this.wireframeIndexBuffer,this.wireframeSegments,]}}function tK(i){const r=[];for(let n=0;nv.indexOf(b)&&v.push(b);let w=s?s.defines():[];w=w.concat(l.map(i=>`#define ${i}`));const T=w.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",tz,tC.fragmentSource,tA.fragmentSource,o.fragmentSource).join("\n"),E=w.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",tz,tC.vertexSource,tA.vertexSource,tM.vertexSource,o.vertexSource).join("\n"),S=p.createShader(p.FRAGMENT_SHADER);if(p.isContextLost())return void(this.failedToCreate=!0);p.shaderSource(S,T),p.compileShader(S),p.attachShader(this.program,S);const I=p.createShader(p.VERTEX_SHADER);if(p.isContextLost())return void(this.failedToCreate=!0);p.shaderSource(I,E),p.compileShader(I),p.attachShader(this.program,I),this.attributes={};const M={};this.numAttributes=$.length;for(let A=0;A>16,c>>16],u_pixel_coord_lower:[65535&l,65535&c]}}const tQ=(r,n,o,s)=>{const a=n.style.light,l=a.properties.get("position"),c=[l.x,l.y,l.z],h=i.create$1();"viewport"===a.properties.get("anchor")&&(i.fromRotation(h,-n.transform.angle),i.transformMat3(c,c,h));const u=a.properties.get("color");return{u_matrix:r,u_lightpos:c,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+o,u_opacity:s}},t0=(r,n,o,s,a,l,c)=>i.extend(tQ(r,n,o,s),tJ(l,n,c),{u_height_factor:-Math.pow(2,a.overscaledZ)/c.tileSize/8}),t1=i=>({u_matrix:i}),t2=(r,n,o,s)=>i.extend(t1(r),tJ(o,n,s)),t3=(i,r)=>({u_matrix:i,u_world:r}),t5=(r,n,o,s,a)=>i.extend(t2(r,n,o,s),{u_world:a}),t4=(r,n,o,s)=>{const a=r.transform;let l;return l="map"===s.paint.get("circle-pitch-alignment")?a.calculatePixelsToTileUnitsMatrix(o):new Float32Array([a.pixelsToGLUnits[0],0,0,a.pixelsToGLUnits[1],]),{u_camera_to_center_distance:a.cameraToCenterDistance,u_matrix:r.translatePosMatrix(n.projMatrix,o,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:i.exported.devicePixelRatio,u_extrude_scale:l}},t6=i=>{const r=[];return"map"===i.paint.get("circle-pitch-alignment")&&r.push("PITCH_WITH_MAP"),"map"===i.paint.get("circle-pitch-scale")&&r.push("SCALE_WITH_MAP"),r},t8=(r,n,o)=>{const s=i.EXTENT/o.tileSize;return{u_matrix:r,u_camera_to_center_distance:n.cameraToCenterDistance,u_extrude_scale:[n.pixelsToGLUnits[0]/s,n.pixelsToGLUnits[1]/s,]}},t9=(i,r,n=1)=>({u_matrix:i,u_color:r,u_overlay:0,u_overlay_scale:n}),t7=(i,r,n,o)=>({u_matrix:i,u_extrude_scale:A(r,1,n),u_intensity:o}),ie=(r,n,o,s,a,l)=>{const c=r.transform,h=c.calculatePixelsToTileUnitsMatrix(n),u={u_matrix:ir(r,n,o,a),u_pixels_to_tile_units:h,u_device_pixel_ratio:i.exported.devicePixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1],],u_dash_image:0,u_gradient_image:1,u_image_height:l,u_texsize:[0,0],u_scale:[0,0,0],u_mix:0,u_alpha_discard_threshold:0};if(io(o)){const d=ii(n,r.transform);u.u_texsize=n.lineAtlasTexture.size,u.u_scale=[d,s.fromScale,s.toScale,],u.u_mix=s.t}return u},it=(r,n,o,s,a)=>{const l=r.transform,c=ii(n,l);return{u_matrix:ir(r,n,o,a),u_texsize:n.imageAtlasTexture.size,u_pixels_to_tile_units:l.calculatePixelsToTileUnitsMatrix(n),u_device_pixel_ratio:i.exported.devicePixelRatio,u_image:0,u_scale:[c,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1],],u_alpha_discard_threshold:0}};function ii(i,r){return 1/A(i,1,r.tileZoom)}function ir(i,r,n,o){return i.translatePosMatrix(o||r.tileID.projMatrix,r,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}function io(i){const r=i.paint.get("line-dasharray").value;return r.value||"constant"!==r.kind}const is=(i,r,n,o,s,a)=>{var l,c;return{u_matrix:i,u_tl_parent:r,u_scale_parent:n,u_fade_t:o.mix,u_opacity:o.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(c=s.paint.get("raster-saturation"))>0?1-1/(1.001-c):-c,u_contrast_factor:(l=s.paint.get("raster-contrast"))>0?1/(1-l):1+l,u_spin_weights:function(i){i*=Math.PI/180;const r=Math.sin(i),n=Math.cos(i);return[(2*n+1)/3,(-Math.sqrt(3)*r-n+1)/3,(Math.sqrt(3)*r-n+1)/3,]}(s.paint.get("raster-hue-rotate")),u_perspective_transform:a}},ia=(i,r,n,o,s,a,l,c,h,u,d,p,f,m)=>{const $=s.transform;return{u_is_size_zoom_constant:+("constant"===i||"source"===i),u_is_size_feature_constant:+("constant"===i||"camera"===i),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:$.cameraToCenterDistance,u_pitch:$.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:$.width/$.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:a,u_label_plane_matrix:l,u_coord_matrix:c,u_is_text:+h,u_pitch_with_map:+o,u_texsize:u,u_tile_id:d,u_zoom_transition:p,u_inv_rot_matrix:f,u_merc_center:m,u_texture:0}},il=(r,n,o,s,a,l,c,h,u,d,p,f,m,$,g)=>{const{cameraToCenterDistance:y,_pitch:x}=a.transform;return i.extend(ia(r,n,o,s,a,l,c,h,u,d,f,m,$,g),{u_gamma_scale:s?y*Math.cos(a.terrain?0:x):1,u_device_pixel_ratio:i.exported.devicePixelRatio,u_is_halo:+p})},ic=(r,n,o,s,a,l,c,h,u,d,p,f,m,$)=>i.extend(il(r,n,o,s,a,l,c,h,!0,u,!0,p,f,m,$),{u_texsize_icon:d,u_texture_icon:1}),ih=(i,r,n)=>({u_matrix:i,u_opacity:r,u_color:n}),iu=(r,n,o,s,a,l)=>i.extend(function(i,r,n,o){const s=n.imageManager.getPattern(i.from.toString()),a=n.imageManager.getPattern(i.to.toString()),{width:l,height:c}=n.imageManager.getPixelSize(),h=Math.pow(2,o.tileID.overscaledZ),u=o.tileSize*Math.pow(2,n.transform.tileZoom)/h,d=u*(o.tileID.canonical.x+o.tileID.wrap*h),p=u*o.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:s.tl,u_pattern_br_a:s.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[l,c],u_mix:r.t,u_pattern_size_a:s.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/A(o,1,n.transform.tileZoom),u_pixel_coord_upper:[d>>16,p>>16,],u_pixel_coord_lower:[65535&d,65535&p,]}}(s,l,o,a),{u_matrix:r,u_opacity:n}),id={fillExtrusion:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_lightpos:new i.Uniform3f(r,n.u_lightpos),u_lightintensity:new i.Uniform1f(r,n.u_lightintensity),u_lightcolor:new i.Uniform3f(r,n.u_lightcolor),u_vertical_gradient:new i.Uniform1f(r,n.u_vertical_gradient),u_opacity:new i.Uniform1f(r,n.u_opacity)}),fillExtrusionPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_lightpos:new i.Uniform3f(r,n.u_lightpos),u_lightintensity:new i.Uniform1f(r,n.u_lightintensity),u_lightcolor:new i.Uniform3f(r,n.u_lightcolor),u_vertical_gradient:new i.Uniform1f(r,n.u_vertical_gradient),u_height_factor:new i.Uniform1f(r,n.u_height_factor),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade),u_opacity:new i.Uniform1f(r,n.u_opacity)}),fill:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),fillPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade)}),fillOutline:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_world:new i.Uniform2f(r,n.u_world)}),fillOutlinePattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_world:new i.Uniform2f(r,n.u_world),u_image:new i.Uniform1i(r,n.u_image),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade)}),circle:(r,n)=>({u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_extrude_scale:new i.UniformMatrix2f(r,n.u_extrude_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),collisionBox:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_extrude_scale:new i.Uniform2f(r,n.u_extrude_scale)}),collisionCircle:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_inv_matrix:new i.UniformMatrix4f(r,n.u_inv_matrix),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_viewport_size:new i.Uniform2f(r,n.u_viewport_size)}),debug:(r,n)=>({u_color:new i.UniformColor(r,n.u_color),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_overlay:new i.Uniform1i(r,n.u_overlay),u_overlay_scale:new i.Uniform1f(r,n.u_overlay_scale)}),clippingMask:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),heatmap:(r,n)=>({u_extrude_scale:new i.Uniform1f(r,n.u_extrude_scale),u_intensity:new i.Uniform1f(r,n.u_intensity),u_matrix:new i.UniformMatrix4f(r,n.u_matrix)}),heatmapTexture:(r,n)=>({u_image:new i.Uniform1i(r,n.u_image),u_color_ramp:new i.Uniform1i(r,n.u_color_ramp),u_opacity:new i.Uniform1f(r,n.u_opacity)}),hillshade:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_latrange:new i.Uniform2f(r,n.u_latrange),u_light:new i.Uniform2f(r,n.u_light),u_shadow:new i.UniformColor(r,n.u_shadow),u_highlight:new i.UniformColor(r,n.u_highlight),u_accent:new i.UniformColor(r,n.u_accent)}),hillshadePrepare:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_image:new i.Uniform1i(r,n.u_image),u_dimension:new i.Uniform2f(r,n.u_dimension),u_zoom:new i.Uniform1f(r,n.u_zoom),u_unpack:new i.Uniform4f(r,n.u_unpack)}),line:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_pixels_to_tile_units:new i.UniformMatrix2f(r,n.u_pixels_to_tile_units),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(r,n.u_units_to_pixels),u_dash_image:new i.Uniform1i(r,n.u_dash_image),u_gradient_image:new i.Uniform1i(r,n.u_gradient_image),u_image_height:new i.Uniform1f(r,n.u_image_height),u_texsize:new i.Uniform2f(r,n.u_texsize),u_scale:new i.Uniform3f(r,n.u_scale),u_mix:new i.Uniform1f(r,n.u_mix),u_alpha_discard_threshold:new i.Uniform1f(r,n.u_alpha_discard_threshold)}),linePattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_texsize:new i.Uniform2f(r,n.u_texsize),u_pixels_to_tile_units:new i.UniformMatrix2f(r,n.u_pixels_to_tile_units),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_image:new i.Uniform1i(r,n.u_image),u_units_to_pixels:new i.Uniform2f(r,n.u_units_to_pixels),u_scale:new i.Uniform3f(r,n.u_scale),u_fade:new i.Uniform1f(r,n.u_fade),u_alpha_discard_threshold:new i.Uniform1f(r,n.u_alpha_discard_threshold)}),raster:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_tl_parent:new i.Uniform2f(r,n.u_tl_parent),u_scale_parent:new i.Uniform1f(r,n.u_scale_parent),u_fade_t:new i.Uniform1f(r,n.u_fade_t),u_opacity:new i.Uniform1f(r,n.u_opacity),u_image0:new i.Uniform1i(r,n.u_image0),u_image1:new i.Uniform1i(r,n.u_image1),u_brightness_low:new i.Uniform1f(r,n.u_brightness_low),u_brightness_high:new i.Uniform1f(r,n.u_brightness_high),u_saturation_factor:new i.Uniform1f(r,n.u_saturation_factor),u_contrast_factor:new i.Uniform1f(r,n.u_contrast_factor),u_spin_weights:new i.Uniform3f(r,n.u_spin_weights),u_perspective_transform:new i.Uniform2f(r,n.u_perspective_transform)}),symbolIcon:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_tile_id:new i.Uniform3f(r,n.u_tile_id),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_inv_rot_matrix:new i.UniformMatrix4f(r,n.u_inv_rot_matrix),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_texture:new i.Uniform1i(r,n.u_texture)}),symbolSDF:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_texture:new i.Uniform1i(r,n.u_texture),u_gamma_scale:new i.Uniform1f(r,n.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_tile_id:new i.Uniform3f(r,n.u_tile_id),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_inv_rot_matrix:new i.UniformMatrix4f(r,n.u_inv_rot_matrix),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_is_halo:new i.Uniform1i(r,n.u_is_halo)}),symbolTextAndIcon:(r,n)=>({u_is_size_zoom_constant:new i.Uniform1i(r,n.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(r,n.u_is_size_feature_constant),u_size_t:new i.Uniform1f(r,n.u_size_t),u_size:new i.Uniform1f(r,n.u_size),u_camera_to_center_distance:new i.Uniform1f(r,n.u_camera_to_center_distance),u_pitch:new i.Uniform1f(r,n.u_pitch),u_rotate_symbol:new i.Uniform1i(r,n.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(r,n.u_aspect_ratio),u_fade_change:new i.Uniform1f(r,n.u_fade_change),u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(r,n.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(r,n.u_coord_matrix),u_is_text:new i.Uniform1i(r,n.u_is_text),u_pitch_with_map:new i.Uniform1i(r,n.u_pitch_with_map),u_texsize:new i.Uniform2f(r,n.u_texsize),u_texsize_icon:new i.Uniform2f(r,n.u_texsize_icon),u_texture:new i.Uniform1i(r,n.u_texture),u_texture_icon:new i.Uniform1i(r,n.u_texture_icon),u_gamma_scale:new i.Uniform1f(r,n.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(r,n.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(r,n.u_is_halo)}),background:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_opacity:new i.Uniform1f(r,n.u_opacity),u_color:new i.UniformColor(r,n.u_color)}),backgroundPattern:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_opacity:new i.Uniform1f(r,n.u_opacity),u_image:new i.Uniform1i(r,n.u_image),u_pattern_tl_a:new i.Uniform2f(r,n.u_pattern_tl_a),u_pattern_br_a:new i.Uniform2f(r,n.u_pattern_br_a),u_pattern_tl_b:new i.Uniform2f(r,n.u_pattern_tl_b),u_pattern_br_b:new i.Uniform2f(r,n.u_pattern_br_b),u_texsize:new i.Uniform2f(r,n.u_texsize),u_mix:new i.Uniform1f(r,n.u_mix),u_pattern_size_a:new i.Uniform2f(r,n.u_pattern_size_a),u_pattern_size_b:new i.Uniform2f(r,n.u_pattern_size_b),u_scale_a:new i.Uniform1f(r,n.u_scale_a),u_scale_b:new i.Uniform1f(r,n.u_scale_b),u_pixel_coord_upper:new i.Uniform2f(r,n.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(r,n.u_pixel_coord_lower),u_tile_units_to_pixels:new i.Uniform1f(r,n.u_tile_units_to_pixels)}),terrainRaster:tF,terrainDepth:tF,skybox:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_sun_direction:new i.Uniform3f(r,n.u_sun_direction),u_cubemap:new i.Uniform1i(r,n.u_cubemap),u_opacity:new i.Uniform1f(r,n.u_opacity),u_temporal_offset:new i.Uniform1f(r,n.u_temporal_offset)}),skyboxGradient:(r,n)=>({u_matrix:new i.UniformMatrix4f(r,n.u_matrix),u_color_ramp:new i.Uniform1i(r,n.u_color_ramp),u_center_direction:new i.Uniform3f(r,n.u_center_direction),u_radius:new i.Uniform1f(r,n.u_radius),u_opacity:new i.Uniform1f(r,n.u_opacity),u_temporal_offset:new i.Uniform1f(r,n.u_temporal_offset)}),skyboxCapture:(r,n)=>({u_matrix_3f:new i.UniformMatrix3f(r,n.u_matrix_3f),u_sun_direction:new i.Uniform3f(r,n.u_sun_direction),u_sun_intensity:new i.Uniform1f(r,n.u_sun_intensity),u_color_tint_r:new i.Uniform4f(r,n.u_color_tint_r),u_color_tint_m:new i.Uniform4f(r,n.u_color_tint_m),u_luminance:new i.Uniform1f(r,n.u_luminance)}),globeRaster:(r,n)=>({u_proj_matrix:new i.UniformMatrix4f(r,n.u_proj_matrix),u_globe_matrix:new i.UniformMatrix4f(r,n.u_globe_matrix),u_merc_matrix:new i.UniformMatrix4f(r,n.u_merc_matrix),u_zoom_transition:new i.Uniform1f(r,n.u_zoom_transition),u_merc_center:new i.Uniform2f(r,n.u_merc_center),u_image0:new i.Uniform1i(r,n.u_image0)}),globeAtmosphere:(r,n)=>({u_center:new i.Uniform2f(r,n.u_center),u_radius:new i.Uniform1f(r,n.u_radius),u_screen_size:new i.Uniform2f(r,n.u_screen_size),u_pixel_ratio:new i.Uniform1f(r,n.u_pixel_ratio),u_opacity:new i.Uniform1f(r,n.u_opacity),u_fadeout_range:new i.Uniform1f(r,n.u_fadeout_range),u_start_color:new i.Uniform3f(r,n.u_start_color),u_end_color:new i.Uniform3f(r,n.u_end_color)})};let ip;function im(r,n,o,s,a,l,c){var h;const u=r.context,d=u.gl,p=r.useProgram("collisionBox"),f=[];let m=0,$=0;for(let g=0;g0){const E=i.create(),S=b;i.mul(E,v.placementInvProjMatrix,r.transform.glCoordMatrix),i.mul(E,E,v.placementViewportMatrix),f.push({circleArray:T,circleOffset:$,transform:S,invTransform:E}),m+=T.length/4,$=m}w&&(r.terrain&&r.terrain.setupElevationDraw(x,p),p.draw(u,d.LINES,i.DepthMode.disabled,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.disabled,t8(b,r.transform,x),o.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,null,r.transform.zoom,null,w.collisionVertexBuffer,w.collisionVertexBufferExt))}if(!c||!f.length)return;const I=r.useProgram("collisionCircle"),M=new i.StructArrayLayout2f1f2i16;M.resize(4*m),M._trim();let A=0;for(const C of f)for(let z=0;z[0,0,0];$.clear();for(let w=0;w=0&&(y[T.associatedIconIndex]={shiftedAnchor:F,angle:O})}else e8(T.numGlyphs,$)}if(p){g.clear();const V=r.icon.placedSymbolArray;for(let N=0;N[0,0,0];eQ(L,P.projMatrix,r,a,J,ee,v,d,en,P)}const eo=r.translatePosMatrix(P.projMatrix,D,l,c),es=b||a&&M||ei?i$:J,ea=r.translatePosMatrix(ee,D,l,c,!0),el=F&&0!==o.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1);let ec;const eh=y.createInversionMatrix(P.toUnwrapped());ec=F?L.iconsInText?ic(O.kind,N,w,v,r,eo,es,ea,G,X,j,C,eh,I):il(O.kind,N,w,v,r,eo,es,ea,a,G,!0,j,C,eh,I):ia(O.kind,N,w,v,r,eo,es,ea,a,G,j,C,eh,I);const eu={program:V,buffers:B,uniformValues:ec,atlasTexture:Z,atlasTextureIcon:W,atlasInterpolation:_,atlasInterpolationIcon:q,isSDF:F,hasHalo:el,tile:D,labelPlaneMatrixInv:Q};if(T&&L.canOverlap){E=!0;const ed=B.segments.get();for(const ep of ed)z.push({segments:new i.SegmentVector([ep]),sortKey:ep.sortKey,state:eu})}else z.push({segments:B.segments,sortKey:0,state:eu})}for(const ef of(E&&z.sort((i,r)=>i.sortKey-r.sortKey),z)){const em=ef.state;if(r.terrain&&r.terrain.setupElevationDraw(em.tile,em.program,{useDepthForOcclusion:!A,labelPlaneMatrixInv:em.labelPlaneMatrixInv}),m.activeTexture.set($.TEXTURE0),em.atlasTexture.bind(em.atlasInterpolation,$.CLAMP_TO_EDGE),em.atlasTextureIcon&&(m.activeTexture.set($.TEXTURE1),em.atlasTextureIcon&&em.atlasTextureIcon.bind(em.atlasInterpolationIcon,$.CLAMP_TO_EDGE)),em.isSDF){const e$=em.uniformValues;em.hasHalo&&(e$.u_is_halo=1,ib(em.buffers,ef.segments,o,r,em.program,S,p,f,e$)),e$.u_is_halo=0}ib(em.buffers,ef.segments,o,r,em.program,S,p,f,em.uniformValues)}}function ib(r,n,o,s,a,l,c,h,u){const d=s.context;a.draw(d,d.gl.TRIANGLES,l,c,h,i.CullFaceMode.disabled,u,o.id,r.layoutVertexBuffer,r.indexBuffer,n,o.paint,s.transform.zoom,r.programConfigurations.get(o.id),r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer)}function iw(r,n,o,s,a,l,c){const h=r.context.gl,u=o.paint.get("fill-pattern"),d=u&&u.constantOr(1),p=o.getCrossfadeParameters();let f,m,$,g,y;for(const x of(c?(m=d&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=h.LINES):(m=d?"fillPattern":"fill",f=h.TRIANGLES),s)){const v=n.getTile(x);if(d&&!v.patternsLoaded())continue;const b=v.getBucket(o);if(!b)continue;r.prepareDrawTile(x);const w=b.programConfigurations.get(o.id),T=r.useProgram(m,w);d&&(r.context.activeTexture.set(h.TEXTURE0),v.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),w.updatePaintBuffers(p));const E=u.constantOr(null);if(E&&v.imageAtlas){const S=v.imageAtlas,I=S.patternPositions[E.to.toString()],M=S.patternPositions[E.from.toString()];I&&M&&w.setConstantPatternPositions(I,M)}const A=r.translatePosMatrix(x.projMatrix,v,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));if(c){g=b.indexBuffer2,y=b.segments2;const C=r.terrain&&r.terrain.renderingToTexture?r.terrain.drapeBufferSize:[h.drawingBufferWidth,h.drawingBufferHeight,];$="fillOutlinePattern"===m&&d?t5(A,r,p,v,C):t3(A,C)}else g=b.indexBuffer,y=b.segments,$=d?t2(A,r,p,v):t1(A);r.prepareDrawProgram(r.context,T,x.toUnwrapped()),T.draw(r.context,f,a,r.stencilModeForClipping(x),l,i.CullFaceMode.disabled,$,o.id,b.layoutVertexBuffer,g,y,o.paint,r.transform.zoom,w)}}function iT(r,n,o,s,a,l,c){const h=r.context,u=h.gl,d=o.paint.get("fill-extrusion-pattern"),p=d.constantOr(1),f=o.getCrossfadeParameters(),m=o.paint.get("fill-extrusion-opacity");for(const $ of s){const g=n.getTile($),y=g.getBucket(o);if(!y)continue;const x=y.programConfigurations.get(o.id),v=r.useProgram(p?"fillExtrusionPattern":"fillExtrusion",x);if(r.terrain){const b=r.terrain;if(!y.enableTerrain)continue;if(b.setupElevationDraw(g,v,{useMeterToDem:!0}),iE(h,n,$,y,o,b),!y.centroidVertexBuffer){const w=v.attributes.a_centroid_pos;void 0!==w&&u.vertexAttrib2f(w,0,0)}}p&&(r.context.activeTexture.set(u.TEXTURE0),g.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),x.updatePaintBuffers(f));const T=d.constantOr(null);if(T&&g.imageAtlas){const E=g.imageAtlas,S=E.patternPositions[T.to.toString()],I=E.patternPositions[T.from.toString()];S&&I&&x.setConstantPatternPositions(S,I)}const M=r.translatePosMatrix($.projMatrix,g,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),A=o.paint.get("fill-extrusion-vertical-gradient"),C=p?t0(M,r,A,m,$,f,g):tQ(M,r,A,m);r.prepareDrawProgram(h,v,$.toUnwrapped()),v.draw(h,h.gl.TRIANGLES,a,l,c,i.CullFaceMode.backCCW,C,o.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,o.paint,r.transform.zoom,x,r.terrain?y.centroidVertexBuffer:null)}}function iE(r,n,o,s,a,l){const c=[r=>{let n=r.canonical.x-1,o=r.wrap;return n<0&&(n=(1<{let n=r.canonical.x+1,o=r.wrap;return n===1<new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(0===r.canonical.y?1<new i.OverscaledTileID(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<{const r=n.getSource().maxzoom,o=i=>{const r=n.getTileByID(i);if(r&&r.hasData())return r.getBucket(a)};let s,l,c;return(i.overscaledZ===i.canonical.z||i.overscaledZ>=r)&&(s=o(i.key)),i.overscaledZ>=r&&(l=o(i.calculateScaledKey(i.overscaledZ+1))),i.overscaledZ>r&&(c=o(i.calculateScaledKey(i.overscaledZ-1))),s||l||c},u=[0,0,0],d=(r,n)=>(u[0]=Math.min(r.min.y,n.min.y),u[1]=Math.max(r.max.y,n.max.y),u[2]=i.EXTENT-n.min.x>r.max.x?n.min.x-i.EXTENT:r.max.x,u),p=(r,n)=>(u[0]=Math.min(r.min.x,n.min.x),u[1]=Math.max(r.max.x,n.max.x),u[2]=i.EXTENT-n.min.y>r.max.y?n.min.y-i.EXTENT:r.max.y,u),f=[(i,r)=>d(i,r),(i,r)=>d(r,i),(i,r)=>p(i,r),(i,r)=>p(r,i),],m=new i.pointGeometry(0,0);let $,g,y;const x=(r,n,s,a,c)=>{const h=[[a?s:r,a?r:s,0],[a?s:n,a?n:s,0],],u=c<0?i.EXTENT+c:c,d=[a?u:(r+n)/2,a?(r+n)/2:u,0,];return 0===s&&c<0||0!==s&&c>0?l.getForTilePoints(y,[d],!0,g):h.push(d),l.getForTilePoints(o,h,!0,$),Math.max(h[0][2],h[1][2],d[2])/l.exaggeration()};for(let v=0;v<4;v++){const b=s.borders[v];if(0===b.length&&(s.borderDone[v]=!0),s.borderDone[v])continue;const w=y=c[v](o),T=h(w);if(!T||!T.enableTerrain||!(g=l.findDEMTileFor(w))||!g.dem)continue;if(!$){const E=l.findDEMTileFor(o);if(!E||!E.dem)return;$=E}const S=(v<2?1:5)-v,I=T.borders[S];let M=0;for(let A=0;Az[0]+3);)T.borderDone[S]||T.encodeCentroid(void 0,k,!1),M++;if(k&&Mz[1]-3)&&(D++,++M!==I.length);)k=T.featuresOnBorder[I[M]];if(k=T.featuresOnBorder[I[P]],C.intersectsCount()>1||k.intersectsCount()>1||1!==D){1!==D&&(M=P),s.encodeCentroid(void 0,C,!1),T.borderDone[S]||T.encodeCentroid(void 0,k,!1);continue}const L=f[v](C,k),B=v%2?i.EXTENT-1:0;m.x=x(L[0],Math.min(i.EXTENT-1,L[1]),B,v<2,L[2]),m.y=0,s.encodeCentroid(m,C,!1),T.borderDone[S]||T.encodeCentroid(m,k,!1)}else s.encodeCentroid(void 0,C,!1)}s.borderDone[v]=s.needsCentroidUpdate=!0,T.borderDone[S]||(T.borderDone[S]=T.needsCentroidUpdate=!0)}(s.needsCentroidUpdate||!s.centroidVertexBuffer&&0!==s.centroidVertexArray.length)&&s.uploadCentroid(r)}const iS=new i.Color(1,0,0,1),iI=new i.Color(0,1,0,1),iM=new i.Color(0,0,1,1),iA=new i.Color(1,0,1,1),iC=new i.Color(0,1,1,1);function iz(i,r,n,o){iP(i,0,r+n/2,i.transform.width,n,o)}function ik(i,r,n,o){iP(i,r-n/2,0,n,i.transform.height,o)}function iP(r,n,o,s,a,l){const c=r.context,h=c.gl;h.enable(h.SCISSOR_TEST),h.scissor(n*i.exported.devicePixelRatio,o*i.exported.devicePixelRatio,s*i.exported.devicePixelRatio,a*i.exported.devicePixelRatio),c.clear({color:l}),h.disable(h.SCISSOR_TEST)}function iD(r,n,o){const s=r.context,a=s.gl,l=o.projMatrix,c=r.useProgram("debug"),h=n.getTileByID(o.key);r.terrain&&r.terrain.setupElevationDraw(h,c);const u=i.DepthMode.disabled,d=i.StencilMode.disabled,p=r.colorModeForRenderPass(),f="$debug";s.activeTexture.set(a.TEXTURE0),r.emptyTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),h._makeDebugTileBoundsBuffers(r.context,r.transform.projection);const m=h._tileDebugBuffer||r.debugBuffer,$=h._tileDebugIndexBuffer||r.debugIndexBuffer,g=h._tileDebugSegments||r.debugSegments;c.draw(s,a.LINE_STRIP,u,d,p,i.CullFaceMode.disabled,t9(l,i.Color.red),f,m,$,g);const y=h.latestRawTileData,x=Math.floor((y&&y.byteLength||0)/1024),v=n.getTile(o).tileSize,b=512/Math.min(v,512)*(o.overscaledZ/r.transform.zoom)*.5;let w=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(w+=` => ${o.overscaledZ}`),function(i,r){i.initDebugOverlayCanvas();const n=i.debugOverlayCanvas,o=i.context.gl,s=i.debugOverlayCanvas.getContext("2d");s.clearRect(0,0,n.width,n.height),s.shadowColor="white",s.shadowBlur=2,s.lineWidth=1.5,s.strokeStyle="white",s.textBaseline="top",s.font="bold 36px Open Sans, sans-serif",s.fillText(r,5,5),s.strokeText(r,5,5),i.debugOverlayTexture.update(n),i.debugOverlayTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE)}(r,`${w} ${x}kb`),c.draw(s,a.TRIANGLES,u,d,i.ColorMode.alphaBlended,i.CullFaceMode.disabled,t9(l,i.Color.transparent,b),f,r.debugBuffer,r.quadTriangleIndexBuffer,r.debugSegments)}const iL=i.createLayout([{name:"a_pos_3f",components:3,type:"Float32"},]),{members:iB}=iL;function iR(i,r,n,o){i.emplaceBack(r,n,o)}class iF{constructor(r){this.vertexArray=new i.StructArrayLayout3f12,this.indices=new i.StructArrayLayout3ui6,iR(this.vertexArray,-1,-1,1),iR(this.vertexArray,1,-1,1),iR(this.vertexArray,-1,1,1),iR(this.vertexArray,1,1,1),iR(this.vertexArray,-1,-1,-1),iR(this.vertexArray,1,-1,-1),iR(this.vertexArray,-1,1,-1),iR(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=r.createVertexBuffer(this.vertexArray,iB),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=i.SegmentVector.simpleSegment(0,0,36,12)}}function iO(r,n,o,s,a,l){var c,h,u,d,p;const f=r.gl,m=n.paint.get("sky-atmosphere-color"),$=n.paint.get("sky-atmosphere-halo-color"),g=n.paint.get("sky-atmosphere-sun-intensity"),y=(c=i.fromMat4([],s),h=a,u=g,d=m,p=$,{u_matrix_3f:c,u_sun_direction:h,u_sun_intensity:u,u_color_tint_r:[d.r,d.g,d.b,d.a],u_color_tint_m:[p.r,p.g,p.b,p.a],u_luminance:5e-5});f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+l,n.skyboxTexture,0),o.draw(r,f.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.frontCW,y,"skyboxCapture",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}const iU={symbol:function(r,n,o,s,a){if("translucent"!==r.renderPass)return;const l=i.StencilMode.disabled,c=r.colorModeForRenderPass();o.layout.get("text-variable-anchor")&&function(r,n,o,s,a,l,c){const h=n.transform,u="map"===a,d="map"===l,p=h.projection.createTileTransform(h,h.worldSize);for(const f of r){const m=s.getTile(f),$=m.getBucket(o);if(!$||$.projection!==h.projection.name||!$.text||!$.text.segments.get().length)continue;const g=i.evaluateSizeForZoom($.textSizeData,h.zoom),y=n.transform.calculatePixelsToTileUnitsMatrix(m),x=eW(f.projMatrix,m.tileID.canonical,d,u,n.transform,y),v="none"!==o.layout.get("icon-text-fit")&&$.hasIconData();if(g){const b=Math.pow(2,h.zoom-m.tileID.overscaledZ);iy($,u,d,c,i.symbolSize,h,x,f,b,g,v,p)}}}(s,r,o,n,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),a),0!==o.paint.get("icon-opacity").constantOr(1)&&iv(r,n,o,s,!1,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),o.layout.get("icon-rotation-alignment"),o.layout.get("icon-pitch-alignment"),o.layout.get("icon-keep-upright"),l,c),0!==o.paint.get("text-opacity").constantOr(1)&&iv(r,n,o,s,!0,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.layout.get("text-keep-upright"),l,c),n.map.showCollisionBoxes&&(im(r,n,o,s,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),im(r,n,o,s,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(r,n,o,s){if("translucent"!==r.renderPass)return;const a=o.paint.get("circle-opacity"),l=o.paint.get("circle-stroke-width"),c=o.paint.get("circle-stroke-opacity"),h=void 0!==o.layout.get("circle-sort-key").constantOr(1);if(0===a.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const u=r.context,d=u.gl,p=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),f=i.StencilMode.disabled,m=r.colorModeForRenderPass(),$=[];for(let g=0;gi.sortKey-r.sortKey);const I={useDepthForOcclusion:"globe"!==r.transform.projection.name};for(const M of $){const{programConfiguration:A,program:C,layoutVertexBuffer:z,indexBuffer:k,uniformValues:P,tile:D}=M.state,L=M.segments;r.terrain&&r.terrain.setupElevationDraw(D,C,I),r.prepareDrawProgram(u,C,D.tileID.toUnwrapped()),C.draw(u,d.TRIANGLES,p,f,m,i.CullFaceMode.disabled,P,o.id,z,k,L,o.paint,r.transform.zoom,A)}},heatmap:function(r,n,o,s){if(0!==o.paint.get("heatmap-opacity")){if("offscreen"===r.renderPass){const a=r.context,l=a.gl,c=i.StencilMode.disabled,h=new i.ColorMode([l.ONE,l.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(i,r,n){const o=i.gl;i.activeTexture.set(o.TEXTURE1),i.viewport.set([0,0,r.width/4,r.height/4,]);let s=n.heatmapFbo;if(s)o.bindTexture(o.TEXTURE_2D,s.colorAttachment.get()),i.bindFramebuffer.set(s.framebuffer);else{const a=o.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR),s=n.heatmapFbo=i.createFramebuffer(r.width/4,r.height/4,!1),function(i,r,n,o){const s=i.gl;s.texImage2D(s.TEXTURE_2D,0,s.RGBA,r.width/4,r.height/4,0,s.RGBA,i.extRenderToTextureHalfFloat?i.extTextureHalfFloat.HALF_FLOAT_OES:s.UNSIGNED_BYTE,null),o.colorAttachment.set(n)}(i,r,a,s)}})(a,r,o),a.clear({color:i.Color.transparent});for(let u=0;u{const r=[];io(i)&&r.push("RENDER_LINE_DASH"),i.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT");const n=i.paint.get("line-pattern").constantOr(1),o=1!==i.paint.get("line-opacity").constantOr(1);return!n&&o&&r.push("RENDER_LINE_ALPHA_DISCARD"),r})(o);let w=b.includes("RENDER_LINE_ALPHA_DISCARD");for(const T of(r.terrain&&r.terrain.clipOrMaskOverlapStencilType()&&(w=!1),s)){const E=n.getTile(T);if(m&&!E.patternsLoaded())continue;const S=E.getBucket(o);if(!S)continue;r.prepareDrawTile(T);const I=S.programConfigurations.get(o.id),M=r.useProgram(y,I,b),A=f.constantOr(null);if(A&&E.imageAtlas){const C=E.imageAtlas,z=C.patternPositions[A.to.toString()],k=C.patternPositions[A.from.toString()];z&&k&&I.setConstantPatternPositions(z,k)}const P=u.constantOr(null),D=p.constantOr(null);if(!m&&P&&D&&E.lineAtlas){const L=E.lineAtlas,B=L.getDash(P.to,D),R=L.getDash(P.from,D);B&&R&&I.setConstantPatternPositions(B,R)}const F=r.terrain?T.projMatrix:null,O=m?it(r,E,o,g,F):ie(r,E,o,g,F,S.lineClipsArray.length);if($){const U=S.gradients[o.id];let V=U.texture;if(o.gradientVersion!==U.version){let N=256;if(o.stepInterpolant){const j=n.getSource().maxzoom,G=T.canonical.z===j?Math.ceil(1<{M.draw(x,v.TRIANGLES,c,n,h,i.CullFaceMode.disabled,O,o.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,o.paint,r.transform.zoom,I,S.layoutVertexBuffer2)};if(w){const _=r.stencilModeForClipping(T).ref;0===_&&r.terrain&&x.clear({stencil:0});const q={func:v.EQUAL,mask:255};O.u_alpha_discard_threshold=.8,Z(new i.StencilMode(q,_,255,v.KEEP,v.KEEP,v.INVERT)),O.u_alpha_discard_threshold=0,Z(new i.StencilMode(q,_,255,v.KEEP,v.KEEP,v.KEEP))}else Z(r.stencilModeForClipping(T))}w&&(r.resetStencilClippingMasks(),r.terrain&&x.clear({stencil:0}))},fill:function(r,n,o,s){const a=o.paint.get("fill-color"),l=o.paint.get("fill-opacity");if(0===l.constantOr(1))return;const c=r.colorModeForRenderPass(),h=o.paint.get("fill-pattern"),u=r.opaquePassEnabledForLayer()&&!h.constantOr(1)&&1===a.constantOr(i.Color.transparent).a&&1===l.constantOr(0)?"opaque":"translucent";if(r.renderPass===u){const d=r.depthModeForSublayer(1,"opaque"===r.renderPass?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly);iw(r,n,o,s,d,c,!1)}if("translucent"===r.renderPass&&o.paint.get("fill-antialias")){const p=r.depthModeForSublayer(o.getPaintProperty("fill-outline-color")?2:0,i.DepthMode.ReadOnly);iw(r,n,o,s,p,c,!0)}},"fill-extrusion":function(r,n,o,s){const a=o.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===r.renderPass){const l=new i.DepthMode(r.context.gl.LEQUAL,i.DepthMode.ReadWrite,r.depthRangeFor3D);if(1!==a||o.paint.get("fill-extrusion-pattern").constantOr(1))iT(r,n,o,s,l,i.StencilMode.disabled,i.ColorMode.disabled),iT(r,n,o,s,l,r.stencilModeFor3D(),r.colorModeForRenderPass()),r.resetStencilClippingMasks();else{const c=r.colorModeForRenderPass();iT(r,n,o,s,l,i.StencilMode.disabled,c)}}},hillshade:function(r,n,o,s){if("offscreen"!==r.renderPass&&"translucent"!==r.renderPass)return;const a=r.context,l=r.depthModeForSublayer(0,i.DepthMode.ReadOnly),c=r.colorModeForRenderPass(),h=r.terrain&&r.terrain.renderingToTexture,[u,d]="translucent"!==r.renderPass||h?[{},s]:r.stencilConfigForOverlap(s);for(const p of d){const f=n.getTile(p);if(f.needsHillshadePrepare&&"offscreen"===r.renderPass)tR(r,f,o,l,i.StencilMode.disabled,c);else if("translucent"===r.renderPass){const m=h&&r.terrain?r.terrain.stencilModeForRTTOverlap(p):u[p.overscaledZ];tL(r,p,f,o,l,m,c)}}a.viewport.set([0,0,r.width,r.height]),r.resetStencilClippingMasks()},raster:function(r,n,o,s,a,l){if("translucent"!==r.renderPass||0===o.paint.get("raster-opacity")||!s.length)return;const c=r.context,h=c.gl,u=n.getSource(),d=r.useProgram("raster"),p=r.colorModeForRenderPass(),f=r.terrain&&r.terrain.renderingToTexture,[m,$]=u instanceof eT||f?[{},s]:r.stencilConfigForOverlap(s),g=$[$.length-1].overscaledZ,y=!r.options.moving;for(const x of $){const v=f?i.DepthMode.disabled:r.depthModeForSublayer(x.overscaledZ-g,1===o.paint.get("raster-opacity")?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly,h.LESS),b=x.toUnwrapped(),w=n.getTile(x);if(f&&(!w||!w.hasData()))continue;const T=f?x.projMatrix:r.transform.calculateProjMatrix(b,y),E=r.terrain&&f?r.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ],S=l?0:o.paint.get("raster-fade-duration");w.registerFadeDuration(S);const I=n.findLoadedParent(x,0),M=t_(w,I,n,r.transform,S);let A,C;r.terrain&&r.terrain.prepareDrawTile(x);const z="nearest"===o.paint.get("raster-resampling")?h.NEAREST:h.LINEAR;c.activeTexture.set(h.TEXTURE0),w.texture.bind(z,h.CLAMP_TO_EDGE),c.activeTexture.set(h.TEXTURE1),I?(I.texture.bind(z,h.CLAMP_TO_EDGE),A=Math.pow(2,I.tileID.overscaledZ-w.tileID.overscaledZ),C=[w.tileID.canonical.x*A%1,w.tileID.canonical.y*A%1,]):w.texture.bind(z,h.CLAMP_TO_EDGE);const k=is(T,C||[0,0],A||1,M,o,u instanceof eT?u.perspectiveTransform:[0,0]);if(r.prepareDrawProgram(c,d,b),u instanceof eT)d.draw(c,h.TRIANGLES,v,i.StencilMode.disabled,p,i.CullFaceMode.disabled,k,o.id,u.boundsBuffer,r.quadTriangleIndexBuffer,u.boundsSegments);else{const{tileBoundsBuffer:P,tileBoundsIndexBuffer:D,tileBoundsSegments:L}=r.getTileBoundsBuffers(w);d.draw(c,h.TRIANGLES,v,E,p,i.CullFaceMode.disabled,k,o.id,P,D,L)}}r.resetStencilClippingMasks()},background:function(r,n,o,s){const a=o.paint.get("background-color"),l=o.paint.get("background-opacity");if(0===l)return;const c=r.context,h=c.gl,u=r.transform,d=u.tileSize,p=o.paint.get("background-pattern");if(r.isPatternMissing(p))return;const f=!p&&1===a.a&&1===l&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==f)return;const m=i.StencilMode.disabled,$=r.depthModeForSublayer(0,"opaque"===f?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly),g=r.colorModeForRenderPass(),y=r.useProgram(p?"backgroundPattern":"background");let x,v=s;v||(v=Object.values(x=r.getBackgroundTiles()).map(i=>i.tileID)),p&&(c.activeTexture.set(h.TEXTURE0),r.imageManager.bind(r.context));const b=o.getCrossfadeParameters();for(const w of v){const T=w.toUnwrapped(),E=s?w.projMatrix:r.transform.calculateProjMatrix(T);r.prepareDrawTile(w);const S=n?n.getTile(w):x?x[w.key]:new i.Tile(w,d,u.zoom,r),I=p?iu(E,l,r,p,{tileID:w,tileSize:d},b):ih(E,l,a);r.prepareDrawProgram(c,y,T);const{tileBoundsBuffer:M,tileBoundsIndexBuffer:A,tileBoundsSegments:C}=r.getTileBoundsBuffers(S);y.draw(c,h.TRIANGLES,$,m,g,i.CullFaceMode.disabled,I,o.id,M,A,C)}},sky:function(r,n,o){const s=r.transform,a="mercator"===s.projection.name||"globe"===s.projection.name?1:i.smoothstep(7,8,s.zoom),l=o.paint.get("sky-opacity")*a;if(0===l)return;const c=r.context,h=o.paint.get("sky-type"),u=new i.DepthMode(c.gl.LEQUAL,i.DepthMode.ReadOnly,[0,1]),d=r.frameCounter/1e3%1;"atmosphere"===h?"offscreen"===r.renderPass?o.needsSkyboxCapture(r)&&(function(r,n,o,s){const a=r.context,l=a.gl;let c=n.skyboxFbo;if(!c){c=n.skyboxFbo=a.createFramebuffer(32,32,!1),n.skyboxGeometry=new iF(a),n.skyboxTexture=a.gl.createTexture(),l.bindTexture(l.TEXTURE_CUBE_MAP,n.skyboxTexture),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,l.LINEAR);for(let h=0;h<6;++h)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l.RGBA,32,32,0,l.RGBA,l.UNSIGNED_BYTE,null)}a.bindFramebuffer.set(c.framebuffer),a.viewport.set([0,0,32,32,]);const u=n.getCenter(r,!0),d=r.useProgram("skyboxCapture"),p=new Float64Array(16);i.identity(p),i.rotateY(p,p,-(.5*Math.PI)),iO(a,n,d,p,u,0),i.identity(p),i.rotateY(p,p,.5*Math.PI),iO(a,n,d,p,u,1),i.identity(p),i.rotateX(p,p,-(.5*Math.PI)),iO(a,n,d,p,u,2),i.identity(p),i.rotateX(p,p,.5*Math.PI),iO(a,n,d,p,u,3),i.identity(p),iO(a,n,d,p,u,4),i.identity(p),i.rotateY(p,p,Math.PI),iO(a,n,d,p,u,5),a.viewport.set([0,0,r.width,r.height,])}(r,o),o.markSkyboxValid(r)):"sky"===r.renderPass&&function(r,n,o,s,a){var l,c,h;const u=r.context,d=u.gl,p=r.transform,f=r.useProgram("skybox");u.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_CUBE_MAP,n.skyboxTexture);const m=(l=p.skyboxMatrix,c=n.getCenter(r,!1),h=s,{u_matrix:l,u_sun_direction:c,u_cubemap:0,u_opacity:h,u_temporal_offset:a});r.prepareDrawProgram(u,f),f.draw(u,d.TRIANGLES,o,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,m,"skybox",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,o,u,l,d):"gradient"===h&&"sky"===r.renderPass&&function(r,n,o,s,a){var l,c,h,u,d;const p=r.context,f=p.gl,m=r.transform,$=r.useProgram("skyboxGradient");n.skyboxGeometry||(n.skyboxGeometry=new iF(p)),p.activeTexture.set(f.TEXTURE0);let g=n.colorRampTexture;g||(g=n.colorRampTexture=new i.Texture(p,n.colorRamp,f.RGBA)),g.bind(f.LINEAR,f.CLAMP_TO_EDGE);const y=(l=m.skyboxMatrix,c=n.getCenter(r,!1),h=n.paint.get("sky-gradient-radius"),u=s,d=a,{u_matrix:l,u_color_ramp:0,u_center_direction:c,u_radius:i.degToRad(h),u_opacity:u,u_temporal_offset:d});r.prepareDrawProgram(p,$),$.draw(p,f.TRIANGLES,o,i.StencilMode.disabled,r.colorModeForRenderPass(),i.CullFaceMode.backCW,y,"skyboxGradient",n.skyboxGeometry.vertexBuffer,n.skyboxGeometry.indexBuffer,n.skyboxGeometry.segment)}(r,o,u,l,d)},debug:function(i,r,n){for(let o=0;or.getOpacity(this.transform.pitch)||.03>r.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);const[n,o]=r.getFovAdjustedRange(this.transform._fov);if(n>o)return void(this.transform.fogCullDistSq=null);const s=n+.78*(o-n);this.transform.fogCullDistSq=s*s}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(r,n){if(this.width=r*i.exported.devicePixelRatio,this.height=n*i.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height,]),this.style)for(const o of this.style.order)this.style._layers[o].resize()}setup(){const r=this.context,n=new i.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(i.EXTENT,0),n.emplaceBack(0,i.EXTENT),n.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=r.createVertexBuffer(n,i.posAttributes.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);const o=new i.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(i.EXTENT,0),o.emplaceBack(0,i.EXTENT),o.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=r.createVertexBuffer(o,i.posAttributes.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);const s=new i.StructArrayLayout2i4;s.emplaceBack(-1,-1),s.emplaceBack(1,-1),s.emplaceBack(-1,1),s.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(s,i.posAttributes.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);const a=new i.StructArrayLayout4i8;a.emplaceBack(0,0,0,0),a.emplaceBack(i.EXTENT,0,i.EXTENT,0),a.emplaceBack(0,i.EXTENT,0,i.EXTENT),a.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.mercatorBoundsBuffer=r.createVertexBuffer(a,i.boundsAttributes.members),this.mercatorBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);const l=new i.StructArrayLayout3ui6;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(l);const c=new i.StructArrayLayout1ui2;for(const h of[0,1,3,2,0])c.emplaceBack(h);this.debugIndexBuffer=r.createIndexBuffer(c),this.emptyTexture=new i.Texture(r,{width:1,height:1,data:new Uint8Array([0,0,0,0])},r.gl.RGBA),this.identityMat=i.create();const u=this.context.gl;this.stencilClearMode=new i.StencilMode({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.loadTimeStamps.push(i.window.performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(i){return i._makeTileBoundsBuffers(this.context,this.transform.projection),i._tileBoundsBuffer?{tileBoundsBuffer:i._tileBoundsBuffer,tileBoundsIndexBuffer:i._tileBoundsIndexBuffer,tileBoundsSegments:i._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context,n=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(r,n.TRIANGLES,i.DepthMode.disabled,this.stencilClearMode,i.ColorMode.disabled,i.CullFaceMode.disabled,tZ(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,n,o){if(!n||this.currentStencilSource===n.id||!r.isTileClipped()||!o||0===o.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let s=!1;for(const a of o)if(void 0===this._tileClippingMaskIDs[a.key]){s=!0;break}if(!s)return}this.currentStencilSource=n.id;const l=this.context,c=l.gl;this.nextStencilID+o.length>256&&this.clearStencil(),l.setColorMode(i.ColorMode.disabled),l.setDepthMode(i.DepthMode.disabled);const h=this.useProgram("clippingMask");for(const u of(this._tileClippingMaskIDs={},o)){const d=n.getTile(u),p=this._tileClippingMaskIDs[u.key]=this.nextStencilID++,{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:$}=this.getTileBoundsBuffers(d);h.draw(l,c.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:c.ALWAYS,mask:0},p,255,c.KEEP,c.KEEP,c.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,tZ(u.projMatrix),"$clipping",f,m,$)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,n=this.context.gl;return new i.StencilMode({func:n.NOTEQUAL,mask:255},r,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const n=this.context.gl;return new i.StencilMode({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(r){const n=this.context.gl,o=r.sort((i,r)=>r.overscaledZ-i.overscaledZ),s=o[o.length-1].overscaledZ,a=o[0].overscaledZ-s+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();const l={};for(let c=0;c=0;this.currentLayer--){const v=this.style._layers[o[this.currentLayer]],b=r._getLayerSourceCache(v);if(v.isSky())continue;const w=b?h[b.id]:void 0;this._renderTileClippingMasks(v,b,w),this.renderLayer(this,b,v,w)}if(this.renderPass="sky",(i.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const n=r._getLayerSourceCache(i);n&&!i.isHidden(this.transform.zoom)&&(!A||A.getSource().maxzoom0?r.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const r=this.imageManager.getPattern(i.from.toString()),n=this.imageManager.getPattern(i.to.toString());return!r||!n}currentGlobalDefines(){const i=this.terrain&&this.terrain.renderingToTexture,r=this.style&&this.style.fog,n=[];return this.terrain&&!this.terrain.renderingToTexture&&n.push("TERRAIN"),r&&!i&&0!==r.getOpacity(this.transform.pitch)&&n.push("FOG"),i&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}useProgram(i,r,n){this.cache=this.cache||{};const o=this.currentGlobalDefines().concat(n||[]),s=tY.cacheKey(i,o,r);return this.cache[s]||(this.cache[s]=new tY(this.context,i,tk[i],r,id[i],o)),this.cache[s]}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 i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height,]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.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(i){this.terrain&&this.terrain.prepareDrawTile(i)}prepareDrawProgram(i,r,n){if(this.terrain&&this.terrain.renderingToTexture)return;const o=this.style.fog;if(o){const s=o.getOpacity(this.transform.pitch);0!==s&&r.setFogUniformValues(i,((i,r,n,o)=>{const s=r.properties.get("color"),a=i.frameCounter/1e3%1,l=[s.r/s.a,s.g/s.a,s.b/s.a,o,];return{u_fog_matrix:n?i.transform.calculateFogTileMatrix(n):i.identityMat,u_fog_range:r.getFovAdjustedRange(i.transform._fov),u_fog_color:l,u_fog_horizon_blend:r.properties.get("horizon-blend"),u_fog_temporal_offset:a}})(this,o,n,s))}}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){this.frameCopies.push(this.canvasCopy()),this.tileLoaded=!1}canvasCopy(){const i=this.context.gl,r=i.createTexture();return i.bindTexture(i.TEXTURE_2D,r),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const i=this.style&&this.style.fog;return!!i&&0!==i.getOpacity(this.transform.pitch)}getBackgroundTiles(){const r=this._backgroundTiles,n=this._backgroundTiles={},o=this.transform.coveringTiles({tileSize:512});for(const s of o)n[s.key]=r[s.key]||new i.Tile(s,512,this.transform.tileZoom,this);return n}clearBackgroundTiles(){this._backgroundTiles={}}}class iN{constructor(i=0,r=0,n=0,o=0){if(isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0||isNaN(o)||o<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=r,this.left=n,this.right=o}interpolate(r,n,o){return null!=n.top&&null!=r.top&&(this.top=i.number(r.top,n.top,o)),null!=n.bottom&&null!=r.bottom&&(this.bottom=i.number(r.bottom,n.bottom,o)),null!=n.left&&null!=r.left&&(this.left=i.number(r.left,n.left,o)),null!=n.right&&null!=r.right&&(this.right=i.number(r.right,n.right,o)),this}getCenter(r,n){const o=i.clamp((this.left+r-this.right)/2,0,r),s=i.clamp((this.top+n-this.bottom)/2,0,n);return new i.pointGeometry(o,s)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new iN(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ij(r,n){const o=i.getColumn(r,3);i.fromQuat(r,n),i.setColumn(r,3,o)}function iG(r,n){i.setColumn(r,3,[n[0],n[1],n[2],1])}function iZ(r,n){const o=i.identity$1([]);return i.rotateZ$1(o,o,-n),i.rotateX$1(o,o,-r),o}function i_(r,n){const o=[r[0],r[1],0],s=[n[0],n[1],0];if(i.length(o)>=1e-15){const a=i.normalize([],o);i.scale$2(s,a,i.dot(s,a)),n[0]=s[0],n[1]=s[1]}const l=i.cross([],n,r);if(1e-15>i.len(l))return null;const c=Math.atan2(-l[1],l[0]);return iZ(Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2]),c)}class iq{constructor(i,r){this.position=i,this.orientation=r}get position(){return this._position}set position(r){this._position=this._renderWorldCopies?function(r){if(!r)return;const n=Array.isArray(r)?new i.MercatorCoordinate(r[0],r[1],r[2]):r;return n.x=i.wrap(n.x,0,1),n}(r):r}lookAtPoint(r,n){if(this.orientation=null,!this.position)return;const o=this._elevation?this._elevation.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(r)):0,s=this.position,a=i.MercatorCoordinate.fromLngLat(r,o),l=[a.x-s.x,a.y-s.y,a.z-s.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=i_(l,n)}setPitchBearing(r,n){this.orientation=iZ(i.degToRad(r),i.degToRad(-n))}}class iX{constructor(r,n){this._transform=i.identity([]),this._orientation=i.identity$1([]),n&&(this._orientation=n,ij(this._transform,this._orientation)),r&&iG(this._transform,r)}get mercatorPosition(){const r=this.position;return new i.MercatorCoordinate(r[0],r[1],r[2])}get position(){const r=i.getColumn(this._transform,3);return[r[0],r[1],r[2]]}set position(i){iG(this._transform,i)}get orientation(){return this._orientation}set orientation(i){this._orientation=i,ij(this._transform,this._orientation)}getPitchBearing(){const i=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,r){this._orientation=iZ(i,r),ij(this._transform,this._orientation)}forward(){const r=i.getColumn(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){const r=i.getColumn(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){const r=i.getColumn(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,n){const o=new Float64Array(16);return i.invert(o,this.getWorldToCamera(r,n)),o}getWorldToCameraPosition(r,n,o){const s=this.position;i.scale$2(s,s,-r);const a=new Float64Array(16);return i.fromScaling(a,[o,o,o]),i.translate(a,a,s),a[10]*=n,a}getWorldToCamera(r,n){const o=new Float64Array(16),s=new Float64Array(4),a=this.position;return i.conjugate(s,this._orientation),i.scale$2(a,a,-r),i.fromQuat(o,s),i.translate(o,o,a),o[1]*=-1,o[5]*=-1,o[9]*=-1,o[13]*=-1,o[8]*=n,o[9]*=n,o[10]*=n,o[11]*=n,o}getCameraToClipPerspective(r,n,o,s){const a=new Float64Array(16);return i.perspective(a,r,n,o,s),a}getDistanceToElevation(r){const n=0===r?0:i.mercatorZfromAltitude(r,this.position[1]),o=this.forward();return(n-this.position[2])/o[2]}clone(){return new iX([...this.position],[...this.orientation])}}function iW(r,n){const o=iK(r),s=function(r,n,o,s,a){const l=new i.LngLat(o.lng-180*iY,o.lat),c=new i.LngLat(o.lng+180*iY,o.lat),h=r.project(l.lng,l.lat),u=r.project(c.lng,c.lat),d=-Math.atan2(u.y-h.y,u.x-h.x),p=i.MercatorCoordinate.fromLngLat(o);p.y=i.clamp(p.y,-.999975,.999975);const f=p.toLngLat(),m=r.project(f.lng,f.lat),$=i.MercatorCoordinate.fromLngLat(f);$.x+=iY;const g=$.toLngLat(),y=r.project(g.lng,g.lat),x=iQ(y.x-m.x,y.y-m.y,d),v=i.MercatorCoordinate.fromLngLat(f);v.y+=iY;const b=v.toLngLat(),w=r.project(b.lng,b.lat),T=iQ(w.x-m.x,w.y-m.y,d),E=Math.abs(x.x)/Math.abs(T.y),S=i.identity([]);i.rotateZ(S,S,-d*(1-(a?0:s)));const I=i.identity([]);return i.scale(I,I,[1,1-(1-E)*s,1]),I[4]=-T.x/T.y*s,i.rotateZ(I,I,d),i.multiply$1(I,S,I),I}(r.projection,0,r.center,o,n),a=iH(r);return i.scale(s,s,[a,a,1]),s}function iH(r){const n=r.projection,o=iK(r),s=iJ(n,r.center),a=iJ(n,i.LngLat.convert(n.center));return Math.pow(2,s*o+(1-o)*a)}function iK(r){const n=r.projection.range;if(!n)return 0;const o=Math.max(r.width,r.height),s=Math.log(o/1024)/Math.LN2;return i.smoothstep(n[0]+s,n[1]+s,r.zoom)}const iY=1/4e4;function iJ(r,n){const o=i.clamp(n.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),s=new i.LngLat(n.lng-180*iY,o),a=new i.LngLat(n.lng+180*iY,o),l=r.project(s.lng,o),c=r.project(a.lng,o),h=i.MercatorCoordinate.fromLngLat(s),u=i.MercatorCoordinate.fromLngLat(a),d=c.x-l.x,p=c.y-l.y,f=u.x-h.x,m=u.y-h.y,$=Math.sqrt((f*f+m*m)/(d*d+p*p));return Math.log($)/Math.LN2}function iQ(i,r,n){const o=Math.cos(n),s=Math.sin(n);return{x:i*o-r*s,y:i*s+r*o}}class i0{constructor(r,n,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===a||a,this._minZoom=r||0,this._maxZoom=n||22,this._minPitch=null==o?0:o,this._maxPitch=null==s?60:s,this.setProjection(),this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.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 iN,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new iX,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._projectionScaler=1,this._horizonShift=.1}clone(){const i=new i0(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.setProjection(this.getProjection()),i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i.tileSize=this.tileSize,i.setMaxBounds(this.getMaxBounds()),i.width=this.width,i.height=this.height,i.cameraElevationReference=this.cameraElevationReference,i._center=this._center,i._setZoom(this.zoom),i._cameraZoom=this._cameraZoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._nearZ=this._nearZ,i._farZ=this._farZ,i._averageElevation=this._averageElevation,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._camera=this._camera.clone(),i._calcMatrices(),i.freezeTileCoverage=this.freezeTileCoverage,i}get elevation(){return this._elevation}set elevation(i){this._elevation!==i&&(this._elevation=i,i?this._updateCenterElevation()&&this._updateCameraOnTerrain():(this._cameraZoom=null,this._centerAltitude=0),this._calcMatrices())}updateElevation(i){this._terrainEnabled()&&null==this._cameraZoom&&this._updateCenterElevation()&&this._updateCameraOnTerrain(),i&&this._constrainCameraAltitude(),this._calcMatrices()}getProjection(){return i.pick(this.projection,["name","center","parallels",])}setProjection(r){null==r&&(r={name:"mercator"}),this.projectionOptions=r;const n=this.projection?this.getProjection():void 0;return this.projection=i.getProjection(r),!a(n,this.getProjection())&&(this._calcMatrices(),!0)}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(i){void 0===i?i=!0:null===i&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSize(){const i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}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 i.pointGeometry(this.width,this.height)}get bearing(){return i.wrap(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(r){var n,o,s,a,l,c,h,u,d,p;const f=-r*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=(n=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n),o=this.rotationMatrix,s=this.rotationMatrix,a=this.angle,l=s[0],c=s[1],h=s[2],u=s[3],d=Math.sin(a),p=Math.cos(a),o[0]=l*p+h*d,o[1]=c*p+u*d,o[2]=-(l*d)+h*p,o[3]=-(c*d)+u*p)}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const n=i.clamp(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(i){this._averageElevation=i,this._calcFogMatrices()}get zoom(){return this._zoom}set zoom(i){const r=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._constrain(),this._calcMatrices())}_setZoom(i){this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom}_updateCenterElevation(){if(!this._elevation)return!1;const i=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center),-1);return -1===i?(this._cameraZoom=null,!1):(this._centerAltitude=i,!0)}_updateCameraOnTerrain(){this._cameraZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize)}sampleAverageElevation(){if(!this._elevation)return 0;const r=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8],],o=this.horizonLineFromTop();let s=0,a=0;for(let l=0;lr.maxzoom&&(n=r.maxzoom);const l=this.locationCoordinate(this.center),c=1<{const n=1/4e4,o=new i.MercatorCoordinate(r.x+n,r.y,r.z),s=new i.MercatorCoordinate(r.x,r.y+n,r.z),a=r.toLngLat(),l=o.toLngLat(),c=s.toLngLat(),h=this.locationCoordinate(a),u=this.locationCoordinate(l),d=this.locationCoordinate(c),p=Math.hypot(u.x-h.x,u.y-h.y),f=Math.hypot(d.x-h.x,d.y-h.y);return Math.sqrt(p*f)*v/n},w=r=>{const n=y,o=x;return{aabb:i.tileAABB(this,c,0,0,0,r,o,n,this.projection),zoom:0,x:0,y:0,minZ:o,maxZ:n,wrap:r,fullyVisible:!1}},T=[];let E=[];const S=n,I=r.reparseOverscaled?o:n,M=i=>i*i,A=M((f-this._centerAltitude)*p),C=i=>{if(!this._elevation||!i.tileID||!a)return;const r=this._elevation.getMinMaxForTile(i.tileID),n=i.aabb;r?(n.min[2]=r.min,n.max[2]=r.max,n.center[2]=(n.min[2]+n.max[2])/2):(i.shouldSplit=z(i),i.shouldSplit||(n.min[2]=n.max[2]=n.center[2]=this._centerAltitude))},z=r=>{if(r.zoom.85?1:u}const d=n*n+a*a+l;return d{if(r*M(.707)0;){const P=T.pop(),D=P.x,L=P.y;let B=P.fullyVisible;if(!B){const R=P.aabb.intersects(u);if(0===R)continue;B=2===R}if(P.zoom!==S&&z(P))for(let F=0;F<4;F++){const O=(D<<1)+F%2,U=(L<<1)+(F>>1),V={aabb:a?P.aabb.quadrant(F):i.tileAABB(this,c,P.zoom+1,O,U,P.wrap,P.minZ,P.maxZ,this.projection),zoom:P.zoom+1,x:O,y:U,wrap:P.wrap,fullyVisible:B,tileID:void 0,shouldSplit:void 0,minZ:P.minZ,maxZ:P.maxZ};s&&(V.tileID=new i.OverscaledTileID(P.zoom+1===S?I:P.zoom+1,P.wrap,P.zoom+1,O,U),C(V)),T.push(V)}else{const N=P.zoom===S?I:P.zoom;if(r.minzoom&&r.minzoom>N)continue;const j=h[0]-(.5+D+(P.wrap<{const o=[0,0,0,1],s=[i.EXTENT,i.EXTENT,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());i.transformMat4$1(o,o,a),i.transformMat4$1(s,s,a);const l=i.getAABBPointSquareDist(o,s);if(0===l)return!0;let c=!1;const h=this._elevation;if(h&&l>_&&0!==q){const u=this.calculateProjMatrix(n.tileID.toUnwrapped());let d;r.isTerrainDEM||(d=h.getMinMaxForTile(n.tileID)),d||(d={min:x,max:y});const p=i.furthestTileCorner(this.rotation),f=[p[0]*i.EXTENT,p[1]*i.EXTENT,d.max,];i.transformMat4(f,f,u),c=(1-f[1])*this.height*.5i.distanceSq-r.distanceSq).map(i=>i.tileID)}resize(i,r){this.width=i,this.height=r,this.pixelsToGLUnits=[2/i,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(r){const n=i.clamp(r.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),o=this.projection.project(r.lng,n);return new i.pointGeometry(o.x*this.worldSize,o.y*this.worldSize)}unproject(i){return this.projection.unproject(i.x/this.worldSize,i.y/this.worldSize)}get point(){return this.project(this.center)}setLocationAtPoint(r,n){const o=this.pointCoordinate(n),s=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(r);this.setLocation(new i.MercatorCoordinate(a.x-(o.x-s.x),a.y-(o.y-s.y)))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i){return this.projection.locationPoint(this,i)}locationPoint3D(i){return this._coordinatePoint(this.locationCoordinate(i),!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i){return this.coordinateLocation(this.pointCoordinate3D(i))}locationCoordinate(r,n){const o=n?i.mercatorZfromAltitude(n,r.lat):void 0,s=this.projection.project(r.lng,r.lat);return new i.MercatorCoordinate(s.x,s.y,o)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(r,n){const o=null!=n?n:this._centerAltitude,s=[r.x,r.y,0,1],a=[r.x,r.y,1,1];i.transformMat4$1(s,s,this.pixelMatrixInverse),i.transformMat4$1(a,a,this.pixelMatrixInverse);const l=a[3];i.scale$1(s,s,1/s[3]),i.scale$1(a,a,1/l);const c=s[2],h=a[2];return{p0:s,p1:a,t:c===h?0:(o-c)/(h-c)}}screenPointToMercatorRay(r){const n=[r.x,r.y,0,1],o=[r.x,r.y,1,1];return i.transformMat4$1(n,n,this.pixelMatrixInverse),i.transformMat4$1(o,o,this.pixelMatrixInverse),i.scale$1(n,n,1/n[3]),i.scale$1(o,o,1/o[3]),n[2]=i.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,o[2]=i.mercatorZfromAltitude(o[2],this._center.lat)*this.worldSize,i.scale$1(n,n,1/this.worldSize),i.scale$1(o,o,1/this.worldSize),new i.Ray([n[0],n[1],n[2]],i.normalize([],i.sub([],o,n)))}rayIntersectionCoordinate(r){const{p0:n,p1:o,t:s}=r,a=i.mercatorZfromAltitude(n[2],this._center.lat),l=i.mercatorZfromAltitude(o[2],this._center.lat);return new i.MercatorCoordinate(i.number(n[0],o[0],s)/this.worldSize,i.number(n[1],o[1],s)/this.worldSize,i.number(a,l,s))}pointCoordinate(i,r=this._centerAltitude){return this.projection.createTileTransform(this,this.worldSize).pointCoordinate(i.x,i.y,r)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);const n=this.elevation;let o=this.elevation.pointCoordinate(r);if(o)return new i.MercatorCoordinate(o[0],o[1],o[2]);let s=0,a=this.horizonLineFromTop();if(r.y>a)return this.pointCoordinate(r);const l=.02*a,c=r.clone();for(let h=0;h<10&&a-s>l;h++){c.y=i.number(s,a,.66);const u=n.pointCoordinate(c);u?(a=c.y,o=u):s=c.y}return o?new i.MercatorCoordinate(o[0],o[1],o[2]):this.pointCoordinate(r)}isPointAboveHorizon(i){if(this.elevation)return!this.elevation.pointCoordinate(i);{const r=this.horizonLineFromTop();return i.y0?new i.pointGeometry(s[0]/s[3],s[1]/s[3]):new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}_getBounds(r,n){var o,s,a,l,c,h,u,d;const p=new i.pointGeometry(this._edgeInsets.left,this._edgeInsets.top),f=new i.pointGeometry(this.width-this._edgeInsets.right,this._edgeInsets.top),m=new i.pointGeometry(this.width-this._edgeInsets.right,this.height-this._edgeInsets.bottom),$=new i.pointGeometry(this._edgeInsets.left,this.height-this._edgeInsets.bottom);let g=this.pointCoordinate(p,r),y=this.pointCoordinate(f,r);const x=this.pointCoordinate(m,n),v=this.pointCoordinate($,n);return g.y>1&&y.y>=0?g=new i.MercatorCoordinate((1-v.y)/(o=v,((s=g).y-o.y)/(s.x-o.x))+v.x,1):g.y<0&&y.y<=1&&(g=new i.MercatorCoordinate(-v.y/(a=v,((l=g).y-a.y)/(l.x-a.x))+v.x,0)),y.y>1&&g.y>=0?y=new i.MercatorCoordinate((1-x.y)/(c=x,((h=y).y-c.y)/(h.x-c.x))+x.x,1):y.y<0&&g.y<=1&&(y=new i.MercatorCoordinate(-x.y/(u=x,((d=y).y-u.y)/(d.x-u.x))+x.x,0)),new i.LngLatBounds().extend(this.coordinateLocation(g)).extend(this.coordinateLocation(y)).extend(this.coordinateLocation(v)).extend(this.coordinateLocation(x))}_getBounds3D(){const i=this.elevation;if(!i.visibleDemTiles.length)return this._getBounds(0,0);const r=i.visibleDemTiles.reduce((i,r)=>{if(r.dem){const n=r.dem.tree;i.min=Math.min(i.min,n.minimums[0]),i.max=Math.max(i.max,n.maximums[0])}return i},{min:Number.MAX_VALUE,max:0});return this._getBounds(r.min*i.exaggeration(),r.max*i.exaggeration())}getBounds(){return this._terrainEnabled()?this._getBounds3D():this._getBounds(0,0)}horizonLineFromTop(i=!0){const r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,n=this.height/2-r*(1-this._horizonShift);return i?Math.max(0,n):n}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-i.MAX_MERCATOR_LATITUDE,this.maxLat=i.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLngp&&(c=p-u),p-dm&&(l=m-h),m-f.5?w-1:w,T>.5?T-1:T,0,]),this.alignedProjMatrix=E,c=i.create(),i.scale(c,c,[this.width/2,-this.height/2,1,]),i.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=i.create(),i.scale(c,c,[1,-1,1]),i.translate(c,c,[-1,-1,0]),i.scale(c,c,[2/this.width,2/this.height,1,]),this.glCoordMatrix=c,this.pixelMatrix=i.multiply$1(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},!(c=i.invert(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");this.pixelMatrixInverse=c,this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const r=this.cameraWorldSize,n=this.cameraPixelsPerMeter,o=this._camera.position,s=1/this.height,a=[r,r,n];i.scale$2(a,a,s),i.scale$2(o,o,-1),i.multiply$2(o,o,a);const l=i.create();i.translate(l,l,o),i.scale(l,l,a),this.mercatorFogMatrix=l,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,n,s)}_computeCameraPosition(i){const r=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,n=this._camera.forward(),o=this.point,s=this._mercatorZfromZoom(this._cameraZoom?this._cameraZoom:this._zoom)*r-i/this.worldSize*this._centerAltitude;return[o.x/this.worldSize-n[0]*s,o.y/this.worldSize-n[1]*s,i/this.worldSize*this._centerAltitude-n[2]*s,]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),o=r[2];let s=1;o>0&&(s=Math.min((n-this._camera.position[2])/o,1)),this._camera.position=i.scaleAndAdd([],this._camera.position,r,s),this._updateStateFromCamera()}_updateStateFromCamera(){const r=this._camera.position,n=this._camera.forward(),{pitch:o,bearing:s}=this._camera.getPitchBearing(),a=i.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._projectionScaler,l=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.degToRad(this._maxPitch)),c=Math.max((r[2]-a)/Math.cos(o),l),h=this._zoomFromMercatorZ(c);i.scaleAndAdd(r,r,n,c),this._pitch=i.clamp(o,i.degToRad(this.minPitch),i.degToRad(this.maxPitch)),this.angle=i.wrap(s,-Math.PI,Math.PI),this._setZoom(i.clamp(h,this._minZoom,this._maxZoom)),this._terrainEnabled()&&this._updateCameraOnTerrain(),this._center=this.coordinateLocation(new i.MercatorCoordinate(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){const i=Math.min((null!=this._cameraZoom?this._cameraZoom:this._zoom)+2,this._maxZoom);return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(i*this.tileSize))}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.warnOnce("Terrain is not yet supported with alternate projections. Use mercator to enable terrain."),1))}anyCornerOffEdge(r,n){const o=Math.min(r.x,n.x),s=Math.max(r.x,n.x),a=Math.min(r.y,n.y),l=Math.max(r.y,n.y);if(au||f.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.pointGeometry(0,0),new i.pointGeometry(this.width,this.height))}zoomDeltaToMovement(r,n){const o=i.length(i.sub([],this._camera.position,r)),s=this._zoomFromMercatorZ(o)+n;return o-this._mercatorZfromZoom(s)}getCameraPoint(){const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,r))}}function i1(i,r){let n=!1,o=null;const s=()=>{o=null,n&&(i(),o=setTimeout(s,r),n=!1)};return()=>(n=!0,o||s(),o)}class i2{constructor(r){this._hashName=r&&encodeURIComponent(r),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash",],this),this._updateHash=i1(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,i.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return i.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(r){const n=this._map.getCenter(),o=Math.round(100*this._map.getZoom())/100,s=Math.ceil((o*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,s),l=Math.round(n.lng*a)/a,c=Math.round(n.lat*a)/a,h=this._map.getBearing(),u=this._map.getPitch();let d="";if(d+=r?`/${l}/${c}/${o}`:`${o}/${c}/${l}`,(h||u)&&(d+="/"+Math.round(10*h)/10),u&&(d+=`/${Math.round(u)}`),this._hashName){const p=this._hashName;let f=!1;const m=i.window.location.hash.slice(1).split("&").map(i=>{const r=i.split("=")[0];return r===p?(f=!0,`${r}=${d}`):i}).filter(i=>i);return f||m.push(`${p}=${d}`),`#${m.join("&")}`}return`#${d}`}_getCurrentHash(){const r=i.window.location.hash.replace("#","");if(this._hashName){let n;return r.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(n=i)}),(n&&n[1]||"").split("/")}return r.split("/")}_onHashChange(){const i=this._getCurrentHash();if(i.length>=3&&!i.some(i=>isNaN(i))){const r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:r,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){const r=i.window.location.href.replace(/(#.+)?$/,this.getHashString());i.window.history.replaceState(i.window.history.state,null,r)}}const i3={linearity:.3,easing:i.bezier(0,0,.3,1)},i5=i.extend({deceleration:2500,maxSpeed:1400},i3),i4=i.extend({deceleration:20,maxSpeed:1400},i3),i6=i.extend({deceleration:1e3,maxSpeed:360},i3),i8=i.extend({deceleration:1e3,maxSpeed:90},i3);class i9{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,n=i.exported.now();for(;r.length>0&&n-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:o}of this._inertiaBuffer)n.zoom+=o.zoomDelta||0,n.bearing+=o.bearingDelta||0,n.pitch+=o.pitchDelta||0,o.panDelta&&n.pan._add(o.panDelta),o.around&&(n.around=o.around),o.pinchAround&&(n.pinchAround=o.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const l=re(n.pan.mag(),s,i.extend({},i5,r||{}));a.offset=n.pan.mult(l.amount/n.pan.mag()),a.center=this._map.transform.center,i7(a,l)}if(n.zoom){const c=re(n.zoom,s,i4);a.zoom=this._map.transform.zoom+c.amount,i7(a,c)}if(n.bearing){const h=re(n.bearing,s,i6);a.bearing=this._map.transform.bearing+i.clamp(h.amount,-179,179),i7(a,h)}if(n.pitch){const u=re(n.pitch,s,i8);a.pitch=this._map.transform.pitch+u.amount,i7(a,u)}if(a.zoom||a.bearing){const d=void 0===n.pinchAround?n.around:n.pinchAround;a.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),i.extend(a,{noMoveStart:!0})}}function i7(i,r){(!i.duration||i.durationn.unproject(i)),h=a.reduce((i,r,n,o)=>i.add(r.div(o.length)),new i.pointGeometry(0,0));super(r,{points:a,point:h,lngLats:c,lngLat:n.unproject(h),originalEvent:o}),this._defaultPrevented=!1}}class rr extends i.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,n){super(i,{originalEvent:n}),this._defaultPrevented=!1}}class rn{constructor(i,r){this._map=i,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new rr(i.type,this._map,i))}mousedown(i,r){return this._mousedownPos=r,this._firePreventable(new rt(i.type,this._map,i))}mouseup(i){this._map.fire(new rt(i.type,this._map,i))}preclick(r){const n=i.extend({},r);n.type="preclick",this._map.fire(new rt(n.type,this._map,n))}click(i,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(i),this._map.fire(new rt(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new rt(i.type,this._map,i))}mouseover(i){this._map.fire(new rt(i.type,this._map,i))}mouseout(i){this._map.fire(new rt(i.type,this._map,i))}touchstart(i){return this._firePreventable(new ri(i.type,this._map,i))}touchmove(i){this._map.fire(new ri(i.type,this._map,i))}touchend(i){this._map.fire(new ri(i.type,this._map,i))}touchcancel(i){this._map.fire(new ri(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ro{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(i){this._map.fire(new rt(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new rt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new rt(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class rs{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,r){this.isEnabled()&&i.shiftKey&&0===i.button&&(l.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(i,r){if(!this._active)return;const n=r;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos){this._box&&(this._box.style.transform=`translate(${s}px,${c}px)`,this._box.style.width=a-s+"px",this._box.style.height=h-c+"px")})}mouseupWindow(r,n){if(!this._active||0!==r.button)return;const o=this._startPos,s=n;if(this.reset(),l.suppressClick(),o.x!==s.x||o.y!==s.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:r})),{cameraAnimation:i=>i.fitScreenCoordinates(o,s,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}keydown(i){this._active&&27===i.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",i))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),l.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(r,n){return this._map.fire(new i.Event(r,{originalEvent:n}))}}function ra(i,r){const n={};for(let o=0;othis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=r.timeStamp),o.length===this.numTouches&&(this.centroid=function(r){const n=new i.pointGeometry(0,0);for(const o of r)n._add(o);return n.div(r.length)}(n),this.touches=ra(o,n)))}touchmove(i,r,n){if(this.aborted||!this.centroid)return;const o=ra(n,r);for(const s in this.touches){const a=this.touches[s],l=o[s];(!l||l.dist(a)>30)&&(this.aborted=!0)}}touchend(i,r,n){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),0===n.length){const o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class rc{constructor(i){this.singleTap=new rl(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,r,n){this.singleTap.touchstart(i,r,n)}touchmove(i,r,n){this.singleTap.touchmove(i,r,n)}touchend(i,r,n){const o=this.singleTap.touchend(i,r,n);if(o){const s=i.timeStamp-this.lastTime<500,a=!this.lastTap||30>this.lastTap.dist(o);if(s&&a||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class rh{constructor(){this._zoomIn=new rc({numTouches:1,numTaps:2}),this._zoomOut=new rc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,r,n){this._zoomIn.touchstart(i,r,n),this._zoomOut.touchstart(i,r,n)}touchmove(i,r,n){this._zoomIn.touchmove(i,r,n),this._zoomOut.touchmove(i,r,n)}touchend(i,r,n){const o=this._zoomIn.touchend(i,r,n),s=this._zoomOut.touchend(i,r,n);return o?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()+1,around:r.unproject(o)},{originalEvent:i})}):s?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()-1,around:r.unproject(s)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const ru={0:1,2:2};class rd{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(i,r){return!1}_move(i,r){return{}}mousedown(i,r){if(this._lastPoint)return;const n=l.mouseButton(i);this._correctButton(i,n)&&(this._lastPoint=r,this._eventButton=n)}mousemoveWindow(i,r){const n=this._lastPoint;if(n){if(i.preventDefault(),function(i,r){const n=ru[r];return void 0===i.buttons||(i.buttons&n)!==n}(i,this._eventButton))this.reset();else if(this._moved||!(r.dist(n)0&&(this._active=!0);const s=ra(o,n),a=new i.pointGeometry(0,0),l=new i.pointGeometry(0,0);let c=0;for(const h in s){const u=s[h],d=this._touches[h];d&&(a._add(u),l._add(u.sub(d)),c++,s[h]=u)}if(this._touches=s,c{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show")},500)}}class rg{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(i){}_move(i,r,n){return{}}touchstart(i,r,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier,],this._start([r[0],r[1]]))}touchmove(i,r,n){if(!this._firstTwoTouches)return;i.preventDefault();const[o,s]=this._firstTwoTouches,a=ry(n,r,o),l=ry(n,r,s);if(!a||!l)return;const c=this._aroundCenter?null:a.add(l).div(2);return this._move([a,l],c,i)}touchend(i,r,n){if(!this._firstTwoTouches)return;const[o,s]=this._firstTwoTouches,a=ry(n,r,o),c=ry(n,r,s);a&&c||(this._active&&l.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function ry(i,r,n){for(let o=0;oMath.abs(rx(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:rx(this._distance,n),pinchAround:r}}}function rb(i,r){return 180*i.angleWith(r)/Math.PI}class rw extends rg{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,r){const n=this._vector;if(this._vector=i[0].sub(i[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:rb(this._vector,n),pinchAround:r}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());const r=25/(Math.PI*this._minDiameter)*360,n=rb(i,this._startVector);return Math.abs(n)Math.abs(i.x)}class rE extends rg{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(i){this._lastPoints=i,rT(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,r,n){const o=i[0].sub(this._lastPoints[0]),s=i[1].sub(this._lastPoints[1]);if(!(this._map._cooperativeGestures&&n.touches.length<3)&&(this._valid=this.gestureBeginsVertically(o,s,n.timeStamp),this._valid))return this._lastPoints=i,this._active=!0,{pitchDelta:-((o.y+s.y)/2*.5)}}gestureBeginsVertically(i,r,n){if(void 0!==this._valid)return this._valid;const o=i.mag()>=2,s=r.mag()>=2;if(!o&&!s)return;if(!o||!s)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const a=i.y>0==r.y>0;return rT(i)&&rT(r)&&a}}const rS={panStep:100,bearingStep:15,pitchStep:10};class rI{constructor(){const i=rS;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let r=0,n=0,o=0,s=0,a=0;switch(i.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:i.shiftKey?n=-1:(i.preventDefault(),s=-1);break;case 39:i.shiftKey?n=1:(i.preventDefault(),s=1);break;case 38:i.shiftKey?o=1:(i.preventDefault(),a=-1);break;case 40:i.shiftKey?o=-1:(i.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,o=0),{cameraAnimation:l=>{const c=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:rM,zoom:r?Math.round(c)+r*(i.shiftKey?2:1):c,bearing:l.getBearing()+n*this._bearingStep,pitch:l.getPitch()+o*this._pitchStep,offset:[-s*this._panStep,-a*this._panStep,],center:l.getCenter()},{originalEvent:i})}}}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 rM(i){return i*(2-i)}class rA{constructor(r,n){this._map=r,this._el=r.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert","_isFullscreen",],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||this._isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=r.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const o=i.exported.now(),s=o-(this._lastWheelEventTime||0);this._lastWheelEventTime=o,0!==n&&n%4.000244140625==0?this._type="wheel":0!==n&&4>Math.abs(n)?this._type="trackpad":s>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=200>Math.abs(s*n)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),r.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=r,this._delta-=n,this._active||this._start(r)),r.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){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 r=l.mousePos(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:r,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 r=this._map.transform,n=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(0!==this._delta){const o="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate;let s=2/(1+Math.exp(-Math.abs(this._delta*o)));this._delta<0&&0!==s&&(s=1/s);const a=n(),l=Math.pow(2,a),c="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):l;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(c*s))),"wheel"===this._type&&(this._startZoom=n(),this._easing=this._smoothOutEasing(200)),this._delta=0}const h="number"==typeof this._targetZoom?this._targetZoom:n(),u=this._startZoom,d=this._easing;let p,f=!1;if("wheel"===this._type&&u&&d){const m=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),$=d(m);p=i.number(u,h,$),m<1?this._frameId||(this._frameId=!0):f=!0}else p=h,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:p-n(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let n=i.ease;if(this._prevEase){const o=this._prevEase,s=(i.exported.now()-o.start)/o.duration,a=o.easing(s+.01)-o.easing(s),l=.27/Math.sqrt(a*a+1e-4)*.01,c=Math.sqrt(.0729-l*l);n=i.bezier(l,c,.25,1)}return this._prevEase={start:i.exported.now(),duration:r,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=l.create("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(i.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!!i.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 rC{constructor(i,r){this._clickZoom=i,this._tapZoom=r}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 rz{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,r){return i.preventDefault(),{cameraAnimation(n){n.easeTo({duration:300,zoom:n.getZoom()+(i.shiftKey?-1:1),around:n.unproject(r)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rk{constructor(){this._tap=new rc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(i,r,n){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?n.length>0&&(this._swipePoint=r[0],this._swipeTouch=n[0].identifier):this._tap.touchstart(i,r,n))}touchmove(i,r,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;const o=r[0],s=o.y-this._swipePoint.y;return this._swipePoint=o,i.preventDefault(),this._active=!0,{zoomDelta:s/128}}}else this._tap.touchmove(i,r,n)}touchend(i,r,n){this._tapTime?this._swipePoint&&0===n.length&&this.reset():this._tap.touchend(i,r,n)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rP{constructor(i,r,n){this._el=i,this._mousePan=r,this._touchPan=n}enable(i){this._inertiaOptions=i||{},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 rD{constructor(i,r,n){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=r,this._mousePitch=n}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 rL{constructor(i,r,n,o){this._el=i,this._touchZoom=r,this._touchRotate=n,this._tapDragZoom=o,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),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 rB=i=>i.zoom||i.drag||i.pitch||i.rotate;class rR extends i.Event{}class rF{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,n){const o=i.sub([],n,r);this.radius=i.length(o[2]<0?i.div([],o,this.constants):[o[0],o[1],0])}projectRay(r){i.div(r,r,this.constants),i.normalize(r,r),i.mul$1(r,r,this.constants);const n=i.scale$2([],r,this.radius);if(n[2]>0){const o=i.scale$2([],[0,0,1],i.dot(n,[0,0,1])),s=i.scale$2([],i.normalize([],[n[0],n[1],0]),this.radius),a=i.add([],n,i.scale$2([],i.sub([],i.add([],s,o),n),2));n[0]=a[0],n[1]=a[1]}return n}}function rO(i){return i.panDelta&&i.panDelta.mag()||i.zoomDelta||i.bearingDelta||i.pitchDelta}class rU{constructor(r,n){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new i9(r),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new rF,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),i.bindAll(["handleEvent","handleWindowEvent"],this);const o=this._el;for(const[s,a,l]of(this._listeners=[[o,"touchstart",{passive:!0},],[o,"touchmove",{passive:!1},],[o,"touchend",void 0],[o,"touchcancel",void 0],[o,"mousedown",void 0],[o,"mousemove",void 0],[o,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0},],[i.window.document,"mouseup",void 0],[o,"mouseover",void 0],[o,"mouseout",void 0],[o,"dblclick",void 0],[o,"click",void 0],[o,"keydown",{capture:!1},],[o,"keyup",void 0],[o,"wheel",{passive:!1},],[o,"contextmenu",void 0],[i.window,"blur",void 0],],this._listeners))s.addEventListener(a,s===i.window.document?this.handleWindowEvent:this.handleEvent,l)}destroy(){for(const[r,n,o]of this._listeners)r.removeEventListener(n,r===i.window.document?this.handleWindowEvent:this.handleEvent,o)}_addDefaultHandlers(i){const r=this._map,n=r.getCanvasContainer();this._add("mapEvent",new rn(r,i));const o=r.boxZoom=new rs(r,i);this._add("boxZoom",o);const s=new rh,a=new rz;r.doubleClickZoom=new rC(a,s),this._add("tapZoom",s),this._add("clickZoom",a);const l=new rk;this._add("tapDragZoom",l);const c=r.touchPitch=new rE(r);this._add("touchPitch",c);const h=new rf(i),u=new rm(i);r.dragRotate=new rD(i,h,u),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);const d=new rp(i),p=new r$(r,i);r.dragPan=new rP(n,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate",]);const f=new rw,m=new rv;r.touchZoomRotate=new rL(n,m,f,l),this._add("touchRotate",f,["touchPan","touchZoom",]),this._add("touchZoom",m,["touchPan","touchRotate",]),this._add("blockableMapEvent",new ro(r));const $=r.scrollZoom=new rA(r,this);this._add("scrollZoom",$,["mousePan"]);const g=r.keyboard=new rI;for(const y of(this._add("keyboard",g),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard",]))i.interactive&&i[y]&&r[y].enable(i[y])}_add(i,r,n){this._handlers.push({handlerName:i,handler:r,allowed:n}),this._handlersById[i]=r}stop(i){if(!this._updatingCamera){for(const{handler:r}of this._handlers)r.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(rB(this._eventsInProgress))||this.isZooming()}_blockedByActive(i,r,n){for(const o in i)if(o!==n&&(!r||0>r.indexOf(o)))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){const r=[];for(const n of i)this._el.contains(n.target)&&r.push(n);return r}handleEvent(i,r){this._updatingCamera=!0;const n="renderFrame"===i.type,o=n?void 0:i,s={needsRenderFrame:!1},a={},c={},h=i.touches?this._getMapTouches(i.touches):void 0,u=h?l.touchPos(this._el,h):n?void 0:l.mousePos(this._el,i);for(const{handlerName:d,handler:p,allowed:f}of this._handlers){if(!p.isEnabled())continue;let m;this._blockedByActive(c,f,d)?p.reset():p[r||i.type]&&(m=p[r||i.type](i,u,h),this.mergeHandlerResult(s,a,m,d,o),m&&m.needsRenderFrame&&this._triggerRenderFrame()),(m||p.isActive())&&(c[d]=p)}const $={};for(const g in this._previousActiveHandlers)c[g]||($[g]=o);this._previousActiveHandlers=c,(Object.keys($).length||rO(s))&&(this._changes.push([s,a,$]),this._triggerRenderFrame()),(Object.keys(c).length||rO(s))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:y}=s;y&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],y(this._map))}mergeHandlerResult(r,n,o,s,a){if(!o)return;i.extend(r,o);const l={handlerName:s,originalEvent:o.originalEvent||a};void 0!==o.zoomDelta&&(n.zoom=l),void 0!==o.panDelta&&(n.drag=l),void 0!==o.pitchDelta&&(n.pitch=l),void 0!==o.bearingDelta&&(n.rotate=l)}_applyChanges(){const r={},n={},o={};for(const[s,a,l]of this._changes)s.panDelta&&(r.panDelta=(r.panDelta||new i.pointGeometry(0,0))._add(s.panDelta)),s.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(r.around=s.around),void 0!==s.aroundCoord&&(r.aroundCoord=s.aroundCoord),void 0!==s.pinchAround&&(r.pinchAround=s.pinchAround),s.noInertia&&(r.noInertia=s.noInertia),i.extend(n,a),i.extend(o,l);this._updateMapTransform(r,n,o),this._changes=[]}_updateMapTransform(r,n,o){const s=this._map,a=s.transform,l=i=>[i.x,i.y,i.z];if((i=>{const r=this._eventsInProgress.drag;return r&&!this._handlersById[r.handlerName].isActive()})()&&!rO(r)){const c=a.zoom;a.cameraElevationReference="sea",a.recenterOnTerrain(),a.cameraElevationReference="ground",c!==a.zoom&&this._map._update(!0)}if(!rO(r))return this._fireEvents(n,o,!0);let{panDelta:h,zoomDelta:u,bearingDelta:d,pitchDelta:p,around:f,aroundCoord:m,pinchAround:$}=r;void 0!==$&&(f=$),n.drag&&!this._eventsInProgress.drag&&f&&(this._dragOrigin=l(a.pointCoordinate3D(f)),this._trackingEllipsoid.setup(a._camera.position,this._dragOrigin)),a.cameraElevationReference="sea",s._stop(!0),f=f||s.transform.centerPoint,d&&(a.bearing+=d),p&&(a.pitch+=p),a._updateCameraState();const g=[0,0,0];if(h){const y=a.pointCoordinate(f),x=a.pointCoordinate(f.sub(h));y&&x&&(g[0]=x.x-y.x,g[1]=x.y-y.y)}const v=a.zoom,b=[0,0,0];if(u){const w=l(m||a.pointCoordinate3D(f)),T={dir:i.normalize([],i.sub([],w,a._camera.position))};if(T.dir[2]<0){const E=a.zoomDeltaToMovement(w,u);i.scale$2(b,T.dir,E)}}const S=i.add(g,g,b);a._translateCameraConstrained(S),u&&Math.abs(a.zoom-v)>1e-4&&a.recenterOnTerrain(),a.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(n,o,!0)}_fireEvents(r,n,o){const s=rB(this._eventsInProgress),a=rB(r),l={};for(const c in r){const{originalEvent:h}=r[c];this._eventsInProgress[c]||(l[`${c}start`]=h),this._eventsInProgress[c]=r[c]}for(const u in!s&&a&&this._fireEvent("movestart",a.originalEvent),l)this._fireEvent(u,l[u]);for(const d in a&&this._fireEvent("move",a.originalEvent),r){const{originalEvent:p}=r[d];this._fireEvent(d,p)}const f={};let m;for(const $ in this._eventsInProgress){const{handlerName:g,originalEvent:y}=this._eventsInProgress[$];this._handlersById[g].isActive()||(delete this._eventsInProgress[$],m=n[g]||y,f[`${$}end`]=m)}for(const x in f)this._fireEvent(x,f[x]);const v=rB(this._eventsInProgress);if(o&&(s||a)&&!v){var b,w;this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);T?(0!==(b=T.bearing||this._map.getBearing())&&-this._bearingSnap{delete this._frameId,this.handleEvent(new rR("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const rV="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class rN extends i.Evented{constructor(r,n){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}getCenter(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(i,r){return this.jumpTo({center:i},r)}panBy(r,n,o){return r=i.pointGeometry.convert(r).mult(-1),this.panTo(this.transform.center,i.extend({offset:r},n),o)}panTo(r,n,o){return this.easeTo(i.extend({center:r},n),o)}getZoom(){return this.transform.zoom}setZoom(i,r){return this.jumpTo({zoom:i},r),this}zoomTo(r,n,o){return this.easeTo(i.extend({zoom:r},n),o)}zoomIn(i,r){return this.zoomTo(this.getZoom()+1,i,r),this}zoomOut(i,r){return this.zoomTo(this.getZoom()-1,i,r),this}getBearing(){return this.transform.bearing}setBearing(i,r){return this.jumpTo({bearing:i},r),this}getPadding(){return this.transform.padding}setPadding(i,r){return this.jumpTo({padding:i},r),this}rotateTo(r,n,o){return this.easeTo(i.extend({bearing:r},n),o)}resetNorth(r,n){return this.rotateTo(0,i.extend({duration:1e3},r),n),this}resetNorthPitch(r,n){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},r),n),this}snapToNorth(i,r){return Math.abs(this.getBearing())$=>{if(T&&(o.zoom=i.number(s,h,$)),E&&(o.bearing=i.number(a,u,$)),S&&(o.pitch=i.number(l,d,$)),I&&(o.interpolatePadding(c,p,$),m=o.centerPoint.add(f)),b)o.setLocationAtPoint(b,w);else{const g=o.zoomScale(o.zoom-s),M=h>s?Math.min(2,v):Math.max(.5,v),A=Math.pow(M,1-$),C=o.unproject(y.add(x.mult($*A)).mult(g));o.setLocationAtPoint(o.renderWorldCopies?C.wrap():C,m)}return r.preloadOnly||this._fireMoveEvents(n),o};if(r.preloadOnly){const A=this._emulate(M,r.duration,o);return this._preloadTiles(A),this}const C={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=T,this._rotating=E,this._pitching=S,this._padding=I,this._easeId=r.easeId,this._prepareEase(n,r.noMoveStart,C),this._ease(M(o),i=>{o.recenterOnTerrain(),this._afterEase(n,i)},r),this}_prepareEase(r,n,o={}){this._moving=!0,this.transform.cameraElevationReference="sea",n||o.moving||this.fire(new i.Event("movestart",r)),this._zooming&&!o.zooming&&this.fire(new i.Event("zoomstart",r)),this._rotating&&!o.rotating&&this.fire(new i.Event("rotatestart",r)),this._pitching&&!o.pitching&&this.fire(new i.Event("pitchstart",r))}_fireMoveEvents(r){this.fire(new i.Event("move",r)),this._zooming&&this.fire(new i.Event("zoom",r)),this._rotating&&this.fire(new i.Event("rotate",r)),this._pitching&&this.fire(new i.Event("pitch",r))}_afterEase(r,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.transform.cameraElevationReference="ground";const o=this._zooming,s=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,o&&this.fire(new i.Event("zoomend",r)),s&&this.fire(new i.Event("rotateend",r)),a&&this.fire(new i.Event("pitchend",r)),this.fire(new i.Event("moveend",r))}flyTo(r,n){if(!r.essential&&i.exported.prefersReducedMotion){const o=i.pick(r,["center","zoom","bearing","pitch","around",]);return this.jumpTo(o,n)}this.stop(),r=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},r);const s=this.transform,a=this.getZoom(),l=this.getBearing(),c=this.getPitch(),h=this.getPadding(),u="zoom"in r?i.clamp(+r.zoom,s.minZoom,s.maxZoom):a,d="bearing"in r?this._normalizeBearing(r.bearing,l):l,p="pitch"in r?+r.pitch:c,f="padding"in r?r.padding:s.padding,m=s.zoomScale(u-a),$=i.pointGeometry.convert(r.offset);let g=s.centerPoint.add($);const y=s.pointLocation(g),x=i.LngLat.convert(r.center||y);this._normalizeCenter(x);const v=s.project(y),b=s.project(x).sub(v);let w=r.curve;const T=Math.max(s.width,s.height),E=T/m,S=b.mag();if("minZoom"in r){const I=i.clamp(Math.min(r.minZoom,a,u),s.minZoom,s.maxZoom),M=T/s.zoomScale(I-a);w=Math.sqrt(M/S*2)}const A=w*w;function C(i){const r=(E*E-T*T+(i?-1:1)*A*A*S*S)/(2*(i?E:T)*A*S);return Math.log(Math.sqrt(r*r+1)-r)}function z(i){return(Math.exp(i)-Math.exp(-i))/2}function k(i){return(Math.exp(i)+Math.exp(-i))/2}const P=C(0);let D=function(i){return k(P)/k(P+w*i)},L=function(i){var r;return T*((k(P)*(z(r=P+w*i)/k(r))-z(P))/A)/S},B=(C(1)-P)/w;if(1e-6>Math.abs(S)||!isFinite(B)){if(1e-6>Math.abs(T-E))return this.easeTo(r,n);const R=Er.maxDuration&&(r.duration=0);const F=l!==d,O=p!==c,U=!s.isPaddingEqual(f),V=o=>s=>{const m=s*B,y=1/D(m);o.zoom=1===s?u:a+o.scaleZoom(y),F&&(o.bearing=i.number(l,d,s)),O&&(o.pitch=i.number(c,p,s)),U&&(o.interpolatePadding(h,f,s),g=o.centerPoint.add($));const w=1===s?x:o.unproject(v.add(b.mult(L(m))).mult(y));return o.setLocationAtPoint(o.renderWorldCopies?w.wrap():w,g),o._updateCenterElevation(),r.preloadOnly||this._fireMoveEvents(n),o};if(r.preloadOnly){const N=this._emulate(V,r.duration,s);return this._preloadTiles(N),this}return this._zooming=!0,this._rotating=F,this._pitching=O,this._padding=U,this._prepareEase(n,!1),this._ease(V(s),()=>this._afterEase(n),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const n=this._onEaseEnd;delete this._onEaseEnd,n.call(this,r)}if(!i){const o=this.handlers;o&&o.stop(!1)}return this}_ease(r,n,o){!1===o.animate||0===o.duration?(r(1),n()):(this._easeStart=i.exported.now(),this._easeOptions=o,this._onEaseFrame=r,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,n){r=i.wrap(r,-180,180);const o=Math.abs(r-n);return Math.abs(r-360-n)180?-360:n<-180?360:0}_emulate(i,r,n){const o=Math.ceil(15*r/1e3),s=[],a=i(n.clone());for(let l=0;l<=o;l++){const c=a(l/o);s.push(c.clone())}return s}}class rj{constructor(r={}){this.options=r,i.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact",],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){const r=this.options&&this.options.compact;return this._map=i,this._container=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=l.create("button","mapboxgl-ctrl-attrib-button",this._container),l.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=l.create("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),r&&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===r&&(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(i,r){const n=this._map._getUIString(`AttributionControl.${r}`);i.setAttribute("aria-label",n),i.removeAttribute("title"),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}_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 r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN},];if(r){const o=n.reduce((i,r,o)=>(r.value&&(i+=`${r.key}=${r.value}${oi.indexOf(a.attribution)&&i.push(a.attribution)}}i.sort((i,r)=>i.length-r.length),i=i.filter((r,n)=>{for(let o=n+1;o=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i,]:i.unshift(this.options.customAttribution));const l=i.join(" | ");l!==this._attribHTML&&(this._attribHTML=l,i.length?(this._innerContainer.innerHTML=l,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 rG{constructor(){i.bindAll(["_updateLogo"],this),i.bindAll(["_updateCompact"],this)}onAdd(i){this._map=i,this._container=l.create("div","mapboxgl-ctrl");const r=l.create("a","mapboxgl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://www.mapbox.com/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),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(i){i&&"metadata"!==i.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const i=this._map.style._sourceCaches;if(0===Object.entries(i).length)return!0;for(const r in i){const n=i[r].getSource();if(n.hasOwnProperty("mapbox_logo")&&!n.mapbox_logo)return!1}return!0}_updateCompact(){const i=this._container.children;if(i.length){const r=i[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class rZ{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const r=++this._id;return this._queue.push({callback:i,id:r,cancelled:!1}),r}remove(i){const r=this._currentlyRunning,n=r?this._queue.concat(r):this._queue;for(const o of n)if(o.id===i)return void(o.cancelled=!0)}run(i=0){const r=this._currentlyRunning=this._queue;for(const n of(this._queue=[],r))if(!n.cancelled&&(n.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function r_(r,n,o){if(r=new i.LngLat(r.lng,r.lat),n){const s=new i.LngLat(r.lng-360,r.lat),a=new i.LngLat(r.lng+360,r.lat),l=360*Math.ceil(Math.abs(r.lng-o.center.lng)/360),c=o.locationPoint(r).distSqr(n),h=n.x<0||n.y<0||n.x>o.width||n.y>o.height;o.locationPoint(s).distSqr(n)180;){const u=o.locationPoint(r);if(u.x>=0&&u.y>=0&&u.x<=o.width&&u.y<=o.height)break;r.lng>o.center.lng?r.lng-=360:r.lng+=360}return r}const rq={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 rX extends i.Evented{constructor(r,n){if(super(),(r instanceof i.window.HTMLElement||n)&&(r=i.extend({element:r},n)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer",],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&"auto"!==r.pitchAlignment?r.pitchAlignment:this._rotationAlignment,this._updateMoving=()=>this._update(!0),r&&r.element)this._element=r.element,this._offset=i.pointGeometry.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=l.create("div");const o=l.createSVG("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},this._element),s=l.createSVG("radialGradient",{id:"shadowGradient"},l.createSVG("defs",{},o));l.createSVG("stop",{offset:"10%","stop-opacity":.4},s),l.createSVG("stop",{offset:"100%","stop-opacity":.05},s),l.createSVG("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o),l.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"},o),l.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"},o),l.createSVG("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),this._offset=i.pointGeometry.convert(r&&r.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",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()});const a=this._element.classList;for(const c in rq)a.remove(`mapboxgl-marker-anchor-${c}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(i){return i===this._map||(this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._updateMoving),i.on("moveend",this._update),i.on("remove",this._clearFadeTimer),i._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(r){return this._lngLat=i.LngLat.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(i){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")),i){if(!("offset"in i.options)){const r=Math.sqrt(91.125);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(24.6+r),],"bottom-right":[-r,-1*(24.6+r),],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=i,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(i){const r=i.code,n=i.charCode||i.keyCode;"Space"!==r&&"Enter"!==r&&32!==n&&13!==n||this.togglePopup()}_onMapClick(i){const r=i.originalEvent.target,n=this._element;this._popup&&(r===n||n.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const i=this._popup;return i&&(i.isOpen()?(i.remove(),this._element.setAttribute("aria-expanded","false")):(i.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_evaluateOpacity(){const i=this._pos?this._pos.sub(this._transformedOffset()):null;if(!this._withinScreenBounds(i))return void this._clearFadeTimer();const r=this._map.unproject(i);let n=!1;if(this._map.transform._terrainEnabled()&&this._map.getTerrain()){const o=this._map.getFreeCameraOptions();if(o.position){const s=o.position.toLngLat();n=s.distanceTo(r)<.9*s.distanceTo(this._lngLat)}}const a=(1-this._map._queryFogOpacity(r))*(n?.2:1);this._element.style.opacity=`${a}`,this._popup&&this._popup._setOpacity(`${a}`),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_withinScreenBounds(i){const r=this._map.transform;return!!i&&i.x>=0&&i.x=0&&i.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 i=this._map.transform,r=this._offset.mult(this._scale);return"map"===this._rotationAlignment&&r._rotate(i.angle),"map"===this._pitchAlignment&&(r.y*=Math.cos(i._pitch)),r}getOffset(){return this._offset}setOffset(r){return this._offset=i.pointGeometry.convert(r),this._update(),this}_onMove(r){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=r.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=r.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 i.Event("dragstart"))),this.fire(new i.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 i.Event("dragend")),this._state="inactive"}_addDragHandler(i){this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._transformedOffset()),this._pointerdownPos=i.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(i){return this._draggable=!!i,this._map&&(i?(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(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&"auto"!==i?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}class rW{constructor(i){this.jumpTo(i)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;const n=i.easeCubicInOut((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(i){return i>=this._startTime&&i<=this._endTime}jumpTo(i){this._startTime=-1/0,this._endTime=-1/0,this._start=i,this._end=i}easeTo(i,r,n){this._start=this.getValue(r),this._end=i,this._startTime=r,this._endTime=r+n}}const rH={"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 ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},{HTMLImageElement:rK,HTMLElement:rY,ImageBitmap:rJ}=i.window,rQ={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};function r0(i){i.parentNode&&i.parentNode.removeChild(i)}const r1={showCompass:!0,showZoom:!0,visualizePitch:!1};class r2{constructor(r,n,o=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new rf({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,o&&(this.mousePitch=new rm({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset",],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(i,r){this.mouseRotate.mousedown(i,r),this.mousePitch&&this.mousePitch.mousedown(i,r),l.disableDrag()}move(i,r){const n=this.map,o=this.mouseRotate.mousemoveWindow(i,r);if(o&&o.bearingDelta&&n.setBearing(n.getBearing()+o.bearingDelta),this.mousePitch){const s=this.mousePitch.mousemoveWindow(i,r);s&&s.pitchDelta&&n.setPitch(n.getPitch()+s.pitchDelta)}}off(){const i=this.element;i.removeEventListener("mousedown",this.mousedown),i.removeEventListener("touchstart",this.touchstart,{passive:!1}),i.removeEventListener("touchmove",this.touchmove),i.removeEventListener("touchend",this.touchend),i.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){l.enableDrag(),i.window.removeEventListener("mousemove",this.mousemove),i.window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(i.extend({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),l.mousePos(this.element,r)),i.window.addEventListener("mousemove",this.mousemove),i.window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,l.mousePos(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){1!==i.targetTouches.length?this.reset():(this._startPos=this._lastPos=l.touchPos(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){1!==i.targetTouches.length?this.reset():(this._lastPos=l.touchPos(this.element,i.targetTouches)[0],this.move({preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){0===i.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)5280?r7(r,o,h/5280,i._getUIString("ScaleControl.Miles"),i):r7(r,o,h,i._getUIString("ScaleControl.Feet"),i)}else n&&"nautical"===n.unit?r7(r,o,c/1852,i._getUIString("ScaleControl.NauticalMiles"),i):c>=1e3?r7(r,o,c/1e3,i._getUIString("ScaleControl.Kilometers"),i):r7(r,o,c,i._getUIString("ScaleControl.Meters"),i)}function r7(i,r,n,o,s){const a=function(i){const r=Math.pow(10,`${Math.floor(i)}`.length-1);let n=i/r;return r*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(i){const r=Math.pow(10,Math.ceil(-Math.log(i)/Math.LN10));return Math.round(i*r)/r}(n))}(n),l=a/n;s._requestDomTask(()=>{i.style.width=r*l+"px",i.innerHTML=`${a} ${o}`})}const ne={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},nt={version:i.version,supported:r,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:class extends rN{constructor(r){if(null!=(r=i.extend({},rQ,r)).minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(super(new i0(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),r),this._interactive=r.interactive,this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=r.preserveDrawingBuffer,this._antialias=r.antialias,this._trackResize=r.trackResize,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=r.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=r.collectResourceTiming,this._optimizeForTerrain=r.optimizeForTerrain,this._renderTaskQueue=new rZ,this._domRenderTaskQueue=new rZ,this._controls=[],this._markers=[],this._mapId=i.uniqueId(),this._locale=i.extend({},rH,r.locale),this._clickTolerance=r.clickTolerance,this._cooperativeGestures=r.cooperativeGestures,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevation=new rW(0),this._requestManager=new i.RequestManager(r.transformRequest,r.accessToken,r.testMode),this._silenceAuthErrors=!!r.testMode,"string"==typeof r.container){if(this._container=i.window.document.getElementById(r.container),!this._container)throw Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof rY))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(this._container.childNodes.length>0&&i.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."),r.maxBounds&&this.setMaxBounds(r.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored",],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),void 0!==i.window&&(i.window.addEventListener("online",this._onWindowOnline,!1),i.window.addEventListener("resize",this._onWindowResize,!1),i.window.addEventListener("orientationchange",this._onWindowResize,!1),i.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1)),this.handlers=new rU(this,r),this._localFontFamily=r.localFontFamily,this._localIdeographFontFamily=r.localIdeographFontFamily,r.style&&this.setStyle(r.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),r.projection&&this.setProjection(r.projection),this._hash=r.hash&&new i2("string"==typeof r.hash&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,i.extend({},r.fitBoundsOptions,{duration:0})))),this.resize(),r.attributionControl&&this.addControl(new rj({customAttribution:r.customAttribution})),this._logoControl=new rG,this.addControl(this._logoControl,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",r=>{this._update("style"===r.dataType),this.fire(new i.Event(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new i.Event(`${r.dataType}dataloading`,r))})}_getMapId(){return this._mapId}addControl(r,n){if(void 0===n&&(n=r.getDefaultPosition?r.getDefaultPosition():"top-right"),!r||!r.onAdd)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=r.onAdd(this);this._controls.push(r);const s=this._controlPositions[n];return -1!==n.indexOf("bottom")?s.insertBefore(o,s.firstChild):s.appendChild(o),this}removeControl(r){if(!r||!r.onRemove)return this.fire(new i.ErrorEvent(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const n=this._controls.indexOf(r);return n>-1&&this._controls.splice(n,1),r.onRemove(this),this}hasControl(i){return this._controls.indexOf(i)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(r){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 n=!this._moving;return n&&this.fire(new i.Event("movestart",r)).fire(new i.Event("move",r)),this.fire(new i.Event("resize",r)),n&&this.fire(new i.Event("moveend",r)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(r){return this.transform.setMaxBounds(i.LngLatBounds.convert(r)),this._update()}setMinZoom(r){if((r=null==r?-2:r)>=-2&&r<=this.transform.maxZoom)return this.transform.minZoom=r,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=r,this._update(),this.getZoom()>r?this.setZoom(r):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(r){if((r=null==r?0:r)<0)throw Error("minPitch must be greater than or equal to 0");if(r>=0&&r<=this.transform.maxPitch)return this.transform.minPitch=r,this._update(),this.getPitch()85)throw Error("maxPitch must be less than or equal to 85");if(r>=this.transform.minPitch)return this.transform.maxPitch=r,this._update(),this.getPitch()>r?this.setPitch(r):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(i){return this.transform.renderWorldCopies=i,this._update()}getProjection(){return this.transform.getProjection()}setProjection(i){return this._lazyInitEmptyStyle(),"string"==typeof i&&(i={name:i}),this._runtimeProjection=i,this.style.updateProjection(),this._transitionFromGlobe=!1,this}project(r){return this.transform.locationPoint3D(i.LngLat.convert(r))}unproject(r){return this.transform.pointLocation3D(i.pointGeometry.convert(r))}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(i,r,n){if("mouseenter"===i||"mouseover"===i){let o=!1;const s=s=>{const a=r.filter(i=>this.getLayer(i)),l=a.length?this.queryRenderedFeatures(s.point,{layers:a}):[];l.length?o||(o=!0,n.call(this,new rt(i,this,s.originalEvent,{features:l}))):o=!1},a=()=>{o=!1};return{layers:new Set(r),listener:n,delegates:{mousemove:s,mouseout:a}}}if("mouseleave"===i||"mouseout"===i){let l=!1;const c=o=>{const s=r.filter(i=>this.getLayer(i));(s.length?this.queryRenderedFeatures(o.point,{layers:s}):[]).length?l=!0:l&&(l=!1,n.call(this,new rt(i,this,o.originalEvent)))},h=r=>{l&&(l=!1,n.call(this,new rt(i,this,r.originalEvent)))};return{layers:new Set(r),listener:n,delegates:{mousemove:c,mouseout:h}}}{const u=i=>{const o=r.filter(i=>this.getLayer(i)),s=o.length?this.queryRenderedFeatures(i.point,{layers:o}):[];s.length&&(i.features=s,n.call(this,i),delete i.features)};return{layers:new Set(r),listener:n,delegates:{[i]:u}}}}on(i,r,n){if(void 0===n)return super.on(i,r);Array.isArray(r)||(r=[r]);const o=this._createDelegatedListener(i,r,n);for(const s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[i]=this._delegatedListeners[i]||[],this._delegatedListeners[i].push(o),o.delegates)this.on(s,o.delegates[s]);return this}once(i,r,n){if(void 0===n)return super.once(i,r);Array.isArray(r)||(r=[r]);const o=this._createDelegatedListener(i,r,n);for(const s in o.delegates)this.once(s,o.delegates[s]);return this}off(i,r,n){if(void 0===n)return super.off(i,r);r=new Set(Array.isArray(r)?r:[r]);const o=(i,r)=>{if(i.size!==r.size)return!1;for(const n of i)if(!r.has(n))return!1;return!0},s=this._delegatedListeners?this._delegatedListeners[i]:void 0;return s&&(i=>{for(let s=0;s{r?this.fire(new i.ErrorEvent(r)):o&&this._updateDiff(o,n)})}else"object"==typeof r&&this._updateDiff(r,n)}_updateDiff(r,n){try{this.style.setState(r)&&this._update(!0)}catch(o){i.warnOnce(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(r,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():i.warnOnce("There is no style added to the map.")}addSource(i,r){return this._lazyInitEmptyStyle(),this.style.addSource(i,r),this._update(!0)}isSourceLoaded(r){const n=this.style&&this.style._getSourceCaches(r);if(0!==n.length)return n.every(i=>i.loaded());this.fire(new i.ErrorEvent(Error(`There is no source with ID '${r}'`)))}areTilesLoaded(){const i=this.style&&this.style._sourceCaches;for(const r in i){const n=i[r]._tiles;for(const o in n){const s=n[o];if("loaded"!==s.state&&"errored"!==s.state)return!1}}return!0}addSourceType(i,r,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(i,r,n)}removeSource(i){return this.style.removeSource(i),this._updateTerrain(),this._update(!0)}getSource(i){return this.style.getSource(i)}addImage(r,n,{pixelRatio:o=1,sdf:s=!1,stretchX:a,stretchY:l,content:c}={}){if(this._lazyInitEmptyStyle(),n instanceof rK||rJ&&n instanceof rJ){const{width:h,height:u,data:d}=i.exported.getImageData(n);this.style.addImage(r,{data:new i.RGBAImage({width:h,height:u},d),pixelRatio:o,stretchX:a,stretchY:l,content:c,sdf:s,version:0})}else{if(void 0===n.width||void 0===n.height)return this.fire(new i.ErrorEvent(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:p,height:f,data:m}=n,$=n;this.style.addImage(r,{data:new i.RGBAImage({width:p,height:f},new Uint8Array(m)),pixelRatio:o,stretchX:a,stretchY:l,content:c,sdf:s,version:0,userImage:$}),$.onAdd&&$.onAdd(this,r)}}}updateImage(r,n){const o=this.style.getImage(r);if(!o)return this.fire(new i.ErrorEvent(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=n instanceof rK||rJ&&n instanceof rJ?i.exported.getImageData(n):n,{width:a,height:l,data:c}=s;return void 0===a||void 0===l?this.fire(new i.ErrorEvent(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):a!==o.data.width||l!==o.data.height?this.fire(new i.ErrorEvent(Error("The width and height of the updated image must be that same as the previous version of the image"))):(o.data.replace(c,!(n instanceof rK||rJ&&n instanceof rJ)),void this.style.updateImage(r,o))}hasImage(r){return r?!!this.style.getImage(r):(this.fire(new i.ErrorEvent(Error("Missing required image id"))),!1)}removeImage(i){this.style.removeImage(i)}loadImage(r,n){i.getImage(this._requestManager.transformRequest(r,i.ResourceType.Image),(r,o)=>{n(r,o instanceof rK?i.exported.getImageData(o):o)})}listImages(){return this.style.listImages()}addLayer(i,r){return this._lazyInitEmptyStyle(),this.style.addLayer(i,r),this._update(!0)}moveLayer(i,r){return this.style.moveLayer(i,r),this._update(!0)}removeLayer(i){return this.style.removeLayer(i),this._update(!0)}getLayer(i){return this.style.getLayer(i)}setLayerZoomRange(i,r,n){return this.style.setLayerZoomRange(i,r,n),this._update(!0)}setFilter(i,r,n={}){return this.style.setFilter(i,r,n),this._update(!0)}getFilter(i){return this.style.getFilter(i)}setPaintProperty(i,r,n,o={}){return this.style.setPaintProperty(i,r,n,o),this._update(!0)}getPaintProperty(i,r){return this.style.getPaintProperty(i,r)}setLayoutProperty(i,r,n,o={}){return this.style.setLayoutProperty(i,r,n,o),this._update(!0)}getLayoutProperty(i,r){return this.style.getLayoutProperty(i,r)}setLight(i,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(i,r),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(i){return this._lazyInitEmptyStyle(),!i&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(i),this._averageElevationLastSampledAt=-1/0,this._update(!0)}_updateProjection(){"globe"===this.transform.projection.name&&this.transform.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX&&!this._transitionFromGlobe&&(this.setProjection({name:"mercator"}),this._transitionFromGlobe=!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(i){return this._lazyInitEmptyStyle(),this.style.setFog(i),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(r){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.LngLat.convert(r),this.transform):0}setFeatureState(i,r){return this.style.setFeatureState(i,r),this._update()}removeFeatureState(i,r){return this.style.removeFeatureState(i,r),this._update()}getFeatureState(i){return this.style.getFeatureState(i)}_updateContainerDimensions(){if(!this._container)return;const r=this._container.getBoundingClientRect().width||400,n=this._container.getBoundingClientRect().height||300;let o,s=this._container;for(;s&&!o;){const a=i.window.getComputedStyle(s).transform;a&&"none"!==a&&(o=a.match(/matrix.*\((.+)\)/)[1].split(", ")),s=s.parentElement}o?(this._containerWidth=o[0]&&"0"!==o[0]?Math.abs(r/o[0]):r,this._containerHeight=o[3]&&"0"!==o[3]?Math.abs(n/o[3]):n):(this._containerWidth=r,this._containerHeight=n)}_detectMissingCSS(){"rgb(250, 128, 114)"!==i.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&i.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 i=this._container;i.classList.add("mapboxgl-map"),(this._missingCSSCanary=l.create("div","mapboxgl-canary",i)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=l.create("div","mapboxgl-canvas-container",i);this._interactive&&r.classList.add("mapboxgl-interactive"),this._canvas=l.create("canvas","mapboxgl-canvas",r),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 n=this._controlContainer=l.create("div","mapboxgl-control-container",i),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right",].forEach(i=>{o[i]=l.create("div",`mapboxgl-ctrl-${i}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,n){const o=i.exported.devicePixelRatio||1;this._canvas.width=o*Math.ceil(r),this._canvas.height=o*Math.ceil(n),this._canvas.style.width=`${r}px`,this._canvas.style.height=`${n}px`}_addMarker(i){this._markers.push(i)}_removeMarker(i){const r=this._markers.indexOf(i);-1!==r&&this._markers.splice(r,1)}_setupPainter(){const n=i.extend({},r.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),o=this._canvas.getContext("webgl",n)||this._canvas.getContext("experimental-webgl",n);o?(i.storeAuthState(o,!0),this.painter=new iV(o,this.transform),this.on("data",i=>{"source"===i.dataType&&this.painter.setTileLoadedFlag(!0)}),i.exported$1.testSupport(o)):this.fire(new i.ErrorEvent(Error("Failed to initialize WebGL")))}_contextLost(r){r.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:r}))}_contextRestored(r){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:r}))}_onMapScroll(i){if(i.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(i){return this.style&&(this._styleDirty=this._styleDirty||i,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(i){return this._update(),this._renderTaskQueue.add(i)}_cancelRenderFrame(i){this._renderTaskQueue.remove(i)}_requestDomTask(i){!this.loaded()||this.loaded()&&!this.isMoving()?i():this._domRenderTaskQueue.add(i)}_render(r){let n;const o=this.painter.context.extTimerQuery,s=i.exported.now();this.listens("gpu-timing-frame")&&(n=o.createQueryEXT(),o.beginQueryEXT(o.TIME_ELAPSED_EXT,n));let a=this._updateAverageElevation(s);if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(r),this._domRenderTaskQueue.run(r),this._removed)return;this._updateProjection();let l=!1;const c=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const h=this.transform.zoom,u=this.transform.pitch,d=i.exported.now();this.style.zoomHistory.update(h,d);const p=new i.EvaluationParameters(h,{now:d,fadeDuration:c,pitch:u,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),f=p.crossFadingFactor();1===f&&f===this._crossFadingFactor||(l=!0,this._crossFadingFactor=f),this.style.update(p)}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,c,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:c,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.Event("load"))),this.style&&(this.style.hasTransitions()||l)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const m=i.exported.now()-s;o.endQueryEXT(o.TIME_ELAPSED_EXT,n),setTimeout(()=>{const r=o.getQueryObjectEXT(n,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(n),this.fire(new i.Event("gpu-timing-frame",{cpuTime:m,gpuTime:r}))},50)}if(this.listens("gpu-timing-layer")){const $=this.painter.collectGpuTimers();setTimeout(()=>{const r=this.painter.queryGpuTimers($);this.fire(new i.Event("gpu-timing-layer",{layerTimes:r}))},50)}const g=this._sourcesDirty||this._styleDirty||this._placementDirty||a;if(g||this._repaint)this.triggerRepaint();else{const y=!this.isMoving()&&this.loaded();if(y&&(a=this._updateAverageElevation(s,!0)),a)this.triggerRepaint();else if(this._triggerFrame(!1),y&&(this.fire(new i.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const x=this._calculateSpeedIndex();this.fire(new i.Event("speedindexcompleted",{speedIndex:x})),this.speedIndexTiming=!1}}return!this._loaded||this._fullyLoaded||g||(this._fullyLoaded=!0,this._authenticate()),this}_forceMarkerUpdate(){for(const i of this._markers)i._update()}_updateAverageElevation(i,r=!1){const n=i=>(this.transform.averageElevation=i,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&n(0);if((r||i-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(i)){const o=this.transform.averageElevation;let s=this.transform.sampleAverageElevation();isNaN(s)?s=0:this._averageElevationLastSampledAt=i;const a=Math.abs(o-s);if(a>1){if(this._isInitialLoad)return this._averageElevation.jumpTo(s),n(s);this._averageElevation.easeTo(s,i,300)}else if(a>1e-4)return this._averageElevation.jumpTo(s),n(s)}return!!this._averageElevation.isEasing(i)&&n(this._averageElevation.getValue(i))}_authenticate(){i.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,r=>{if(r&&(r.message===i.AUTH_ERR_MSG||401===r.status)){const n=this.painter.context.gl;i.storeAuthState(n,!1),this._logoControl instanceof rG&&this._logoControl._updateLogo(),n&&n.clear(n.DEPTH_BUFFER_BIT|n.COLOR_BUFFER_BIT|n.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.ErrorEvent(Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),i.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_updateTerrain(){this.painter.updateTerrain(this.style,this.isMoving()||this.isRotating()||this.isZooming())}_calculateSpeedIndex(){const i=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const n=this.painter.context.gl,o=n.createFramebuffer();function s(i){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,i,0);const r=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,r),r}return n.bindFramebuffer(n.FRAMEBUFFER,o),this._canvasPixelComparison(s(i),r.canvasCopies.map(s),r.timeStamps)}_canvasPixelComparison(i,r,n){let o=n[1]-n[0];const s=i.length/4;for(let a=0;a{const r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(i)}))}_preloadTiles(r){const n=this.style&&Object.values(this.style._sourceCaches)||[];return i.asyncAll(n,(i,n)=>i._preloadTiles(r,n),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(i){this._trackResize&&this.resize({originalEvent:i})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(i){this._showTileBoundaries!==i&&(this._showTileBoundaries=i,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(i){this._showTerrainWireframe!==i&&(this._showTerrainWireframe=i,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(i){this._speedIndexTiming!==i&&(this._speedIndexTiming=i,this._update())}get showPadding(){return!!this._showPadding}set showPadding(i){this._showPadding!==i&&(this._showPadding=i,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(i){this._showCollisionBoxes!==i&&(this._showCollisionBoxes=i,i?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(i){this._showOverdrawInspector!==i&&(this._showOverdrawInspector=i,this._update())}get repaint(){return!!this._repaint}set repaint(i){this._repaint!==i&&(this._repaint=i,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(i){this._vertices=i,this._update()}_setCacheLimits(r,n){i.setCacheLimits(r,n)}get version(){return i.version}},NavigationControl:class{constructor(r){this.options=i.extend({},r1,r),this._container=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons",],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),l.create("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),l.create("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=l.create("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))}_updateZoomButtons(){const i=this._map.getZoom(),r=i===this._map.getMaxZoom(),n=i===this._map.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const i=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=i)})}onAdd(i){return this._map=i,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 r2(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(i,r){const n=l.create("button",i,this._container);return n.type="button",n.addEventListener("click",r),n}_setButtonTitle(i,r){const n=this._map._getUIString(`NavigationControl.${r}`);i.setAttribute("aria-label",n),i.firstElementChild&&i.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends i.Evented{constructor(r){super(),this.options=i.extend({},r3,r),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation",],this),this._onDeviceOrientationListener=this._onDeviceOrientation.bind(this),this._updateMarkerRotationThrottled=i1(this._updateMarkerRotation,20)}onAdd(r){var n;return this._map=r,this._container=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),n=this._setupUI,void 0!==r5?n(r5):void 0!==i.window.navigator.permissions?i.window.navigator.permissions.query({name:"geolocation"}).then(i=>{n(r5="denied"!==i.state)}):n(r5=!!i.window.navigator.geolocation),this._container}onRemove(){void 0!==this._geolocationWatchID&&(i.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,r4=0,r6=!1}_isOutOfMapMaxBounds(i){const r=this._map.getMaxBounds(),n=i.coords;return r&&(n.longituder.getEast()||n.latituder.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(r){if(this._map){if(this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,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(r),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",r)),this._finish()}}_updateCamera(r){const n=new i.LngLat(r.coords.longitude,r.coords.latitude),o=r.coords.accuracy,s=this._map.getBearing(),a=i.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(o),a,{geolocateSource:!0})}_updateMarker(r){if(r){const n=new i.LngLat(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const i=this._map._containerHeight/2,r=this._map.unproject([0,i]),n=this._map.unproject([100,i]),o=r.distanceTo(n)/100,s=Math.ceil(2*this._accuracy/o);this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}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(r){if(this._map){if(this.options.trackUserLocation){if(1===r.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 n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===r.code&&r6)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",r)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(r){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=l.create("button","mapboxgl-ctrl-geolocate",this._container),l.create("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===r){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",o),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=l.create("div","mapboxgl-user-location"),this._dotElement.appendChild(l.create("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(l.create("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new rX({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=l.create("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new rX({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",r=>{r.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r.originalEvent&&"resize"===r.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.Event("trackuserlocationend")))})}_onDeviceOrientation(i){this._userLocationDotMarker&&(i.webkitCompassHeading?this._heading=i.webkitCompassHeading:!0===i.absolute&&(this._heading=-1*i.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.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 i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":r4--,r6=!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 i.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 i.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 r;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++r4>1?(r={maximumAge:6e5,timeout:0},r6=!0):(r=this.options.positionOptions,r6=!1),this._geolocationWatchID=i.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,r),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else i.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const r=()=>{i.window.addEventListener("ondeviceorientationabsolute"in i.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientationListener)};void 0!==i.window.DeviceMotionEvent&&"function"==typeof i.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(i=>{"granted"===i&&r()}).catch(console.error):r()}_clearWatch(){i.window.navigator.geolocation.clearWatch(this._geolocationWatchID),i.window.removeEventListener("deviceorientation",this._onDeviceOrientationListener),i.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:rj,ScaleControl:class{constructor(r){this.options=i.extend({},r8,r),i.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){r9(this._map,this._container,this.options)}onAdd(i){return this._map=i,this._container=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",i.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(i){this.options.unit=i,r9(this._map,this._container,this.options)}},FullscreenControl:class{constructor(r){this._fullscreen=!1,r&&r.container&&(r.container instanceof i.window.HTMLElement?this._container=r.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon",],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in i.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(r){return this._map=r,this._container||(this._container=this._map.getContainer()),this._controlContainer=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!i.window.document.fullscreenEnabled&&!i.window.document.webkitFullscreenEnabled)}_setupUI(){const r=this._fullscreenButton=l.create("button","mapboxgl-ctrl-fullscreen",this._controlContainer);l.create("span","mapboxgl-ctrl-icon",r).setAttribute("aria-hidden",!0),r.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const i=this._getTitle();this._fullscreenButton.setAttribute("aria-label",i),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",i)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(i.window.document.fullscreenElement||i.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()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends i.Evented{constructor(r){super(),this.options=i.extend(Object.create(ne),r),i.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag",],this),this._classList=new Set(r&&r.className?r.className.trim().split(/\s+/):[])}addTo(r){return this._map&&this.remove(),this._map=r,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 i.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 i.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=i.LngLat.convert(r),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(r){return this.setDOMContent(i.window.document.createTextNode(r))}setHTML(r){const n=i.window.document.createDocumentFragment(),o=i.window.document.createElement("body");let s;for(o.innerHTML=r;s=o.firstChild;)n.appendChild(s);return this.setDOMContent(n)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(i){return this.options.maxWidth=i,this._update(),this}setDOMContent(i){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=l.create("div","mapboxgl-popup-content",this._container);return this._content.appendChild(i),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(i){return this._classList.add(i),this._container&&this._updateClassList(),this}removeClassName(i){return this._classList.delete(i),this._container&&this._updateClassList(),this}setOffset(i){return this.options.offset=i,this._update(),this}toggleClassName(i){let r;return this._classList.delete(i)?r=!1:(this._classList.add(i),r=!0),this._container&&this._updateClassList(),r}_createCloseButton(){this.options.closeButton&&(this._closeButton=l.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(i){this._update(i.point)}_onMouseMove(i){this._update(i.point)}_onDrag(i){this._update(i.point)}_getAnchor(i){if(this.options.anchor)return this.options.anchor;const r=this._pos,n=this._container.offsetWidth,o=this._container.offsetHeight;let s;return s=r.y+i.bottom.ythis._map.transform.height-o?["bottom"]:[],r.xthis._map.transform.width-n/2&&s.push("right"),0===s.length?"bottom":s.join("-")}_updateClassList(){const i=[...this._classList];i.push("mapboxgl-popup"),this._anchor&&i.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&i.push("mapboxgl-popup-track-pointer"),this._container.className=i.join(" ")}_update(r){if(this._map&&(this._lngLat||this._trackPointer)&&this._content){if(this._container||(this._container=l.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=l.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=r_(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||r){const n=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat),o=function(r){if(r||(r=new i.pointGeometry(0,0)),"number"==typeof r){const n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new i.pointGeometry(0,0),top:new i.pointGeometry(0,r),"top-left":new i.pointGeometry(n,n),"top-right":new i.pointGeometry(-n,n),bottom:new i.pointGeometry(0,-r),"bottom-left":new i.pointGeometry(n,-n),"bottom-right":new i.pointGeometry(-n,-n),left:new i.pointGeometry(r,0),right:new i.pointGeometry(-r,0)}}if(r instanceof i.pointGeometry||Array.isArray(r)){const o=i.pointGeometry.convert(r);return{center:o,top:o,"top-left":o,"top-right":o,bottom:o,"bottom-left":o,"bottom-right":o,left:o,right:o}}return{center:i.pointGeometry.convert(r.center||[0,0,]),top:i.pointGeometry.convert(r.top||[0,0]),"top-left":i.pointGeometry.convert(r["top-left"]||[0,0]),"top-right":i.pointGeometry.convert(r["top-right"]||[0,0]),bottom:i.pointGeometry.convert(r.bottom||[0,0,]),"bottom-left":i.pointGeometry.convert(r["bottom-left"]||[0,0]),"bottom-right":i.pointGeometry.convert(r["bottom-right"]||[0,0]),left:i.pointGeometry.convert(r.left||[0,0]),right:i.pointGeometry.convert(r.right||[0,0,])}}(this.options.offset),s=this._anchor=this._getAnchor(o),a=n.add(o[s]).round();this._map._requestDomTask(()=>{this._container&&s&&(this._container.style.transform=`${rq[s]} translate(${a.x}px,${a.y}px)`)})}this._updateClassList()}}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const i=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])");i&&i.focus()}_onClose(){this.remove()}_setOpacity(i){this._content&&(this._content.style.opacity=i),this._tip&&(this._tip.style.opacity=i)}},Marker:rX,Style:tE,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,FreeCameraOptions:iq,Evented:i.Evented,config:i.config,prewarm:function(){eL().acquire(ek)},clearPrewarmedResources:function(){const i=eD;i&&(i.isPreloaded()&&1===i.numActive()?(i.release(ek),eD=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 i.config.ACCESS_TOKEN},set accessToken(t){i.config.ACCESS_TOKEN=t},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(t){i.config.API_URL=t},get workerCount(){return eP.workerCount},set workerCount(e){eP.workerCount=e},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){i.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(r){i.clearTileCache(r)},workerUrl:"",workerClass:null,setNow:i.exported.setNow,restoreNow:i.exported.restoreNow};return nt}),n},i.exports=o()}},]); 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 c82a9678453..ddf543b932c 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(t,e,n){var r;!function(i,o,a,s){"use strict";var c,u=["","webkit","Moz","MS","ms","o"],l=o.createElement("div"),h=Math.round,p=Math.abs,f=Date.now;function d(t,e,n){return setTimeout(O(t,n),e)}function v(t,e,n){return!!Array.isArray(t)&&(g(t,n[e],n),!0)}function g(t,e,n){var r;if(t){if(t.forEach)t.forEach(e,n);else if(s!==t.length)for(r=0;r\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=i.console&&(i.console.warn||i.console.log);return o&&o.call(i.console,r,n),t.apply(this,arguments)}}c="function"!=typeof Object.assign?function(t){if(t===s||null===t)throw TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n-1}function T(t){return t.trim().split(/\s+/g)}function k(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var r=0;rk(i,a)&&r.push(t[o]),i[o]=a,o++}return n&&(r=e?r.sort(function(t,n){return t[e]>n[e]}):r.sort()),r}function C(t,e){for(var n,r,i=e[0].toUpperCase()+e.slice(1),o=0;o1&&!o.firstMultiple?o.firstMultiple=q(i):1===c&&(o.firstMultiple=!1),u=o.firstInput,h=(l=o.firstMultiple)?l.center:u.center,d=i.center=H(a),i.timeStamp=f(),i.deltaTime=i.timeStamp-u.timeStamp,i.angle=K(h,d),i.distance=X(h,d),v=o,m=(g=i).center,b=v.offsetDelta||{},y=v.prevDelta||{},w=v.prevInput||{},(1===g.eventType||4===w.eventType)&&(y=v.prevDelta={x:w.deltaX||0,y:w.deltaY||0},b=v.offsetDelta={x:m.x,y:m.y}),g.deltaX=y.x+(m.x-b.x),g.deltaY=y.y+(m.y-b.y),i.offsetDirection=Y(i.deltaX,i.deltaY),O=W(i.deltaTime,i.deltaX,i.deltaY),i.overallVelocityX=O.x,i.overallVelocityY=O.y,i.overallVelocity=p(O.x)>p(O.y)?O.x:O.y,i.scale=l?(E=l.pointers,X(($=a)[0],$[1],B)/X(E[0],E[1],B)):1,i.rotation=l?(P=l.pointers,K((M=a)[1],M[0],B)+K(P[1],P[0],B)):0,i.maxPointers=o.prevInput?i.pointers.length>o.prevInput.maxPointers?i.pointers.length:o.prevInput.maxPointers:i.pointers.length,function(t,e){var n,r,i,o,a=t.lastInterval||e,c=e.timeStamp-a.timeStamp;if(8!=e.eventType&&(c>25||s===a.velocity)){var u=e.deltaX-a.deltaX,l=e.deltaY-a.deltaY,h=W(c,u,l);r=h.x,i=h.y,n=p(h.x)>p(h.y)?h.x:h.y,o=Y(u,l),t.lastInterval=e}else n=a.velocity,r=a.velocityX,i=a.velocityY,o=a.direction;e.velocity=n,e.velocityX=r,e.velocityY=i,e.direction=o}(o,i),S=r.element,j(i.srcEvent.target,S)&&(S=i.srcEvent.target),i.target=S,t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function q(t){for(var e=[],n=0;n=p(e)?t<0?2:4:e<0?8:16}function X(t,e,n){n||(n=V);var r=e[n[0]]-t[n[0]],i=e[n[1]]-t[n[1]];return Math.sqrt(r*r+i*i)}function K(t,e,n){n||(n=V);var r=e[n[0]]-t[n[0]];return 180*Math.atan2(e[n[1]]-t[n[1]],r)/Math.PI}Z.prototype={handler:function(){},init:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(A(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&M(this.element,this.evEl,this.domHandler),this.evTarget&&M(this.target,this.evTarget,this.domHandler),this.evWin&&M(A(this.element),this.evWin,this.domHandler)}};var G={mousedown:1,mousemove:2,mouseup:4};function _(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,Z.apply(this,arguments)}w(_,Z,{handler:function(t){var e=G[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:F,srcEvent:t}))}});var J={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Q={2:z,3:"pen",4:F,5:"kinect"},tt="pointerdown",te="pointermove pointerup pointercancel";function tn(){this.evEl=tt,this.evWin=te,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}i.MSPointerEvent&&!i.PointerEvent&&(tt="MSPointerDown",te="MSPointerMove MSPointerUp MSPointerCancel"),w(tn,Z,{handler:function(t){var e=this.store,n=!1,r=J[t.type.toLowerCase().replace("ms","")],i=Q[t.pointerType]||t.pointerType,o=k(e,t.pointerId,"pointerId");1&r&&(0===t.button||i==z)?o<0&&(e.push(t),o=e.length-1):12&r&&(n=!0),!(o<0)&&(e[o]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:i,srcEvent:t}),n&&e.splice(o,1))}});var tr={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function ti(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Z.apply(this,arguments)}function to(t,e){var n=x(t.touches),r=x(t.changedTouches);return 12&e&&(n=D(n.concat(r),"identifier",!0)),[n,r]}w(ti,Z,{handler:function(t){var e=tr[t.type];if(1===e&&(this.started=!0),this.started){var n=to.call(this,t,e);12&e&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:z,srcEvent:t})}}});var ta={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function ts(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},Z.apply(this,arguments)}function tc(t,e){var n=x(t.touches),r=this.targetIds;if(3&e&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=x(t.changedTouches),s=[],c=this.target;if(o=n.filter(function(t){return j(t.target,c)}),1===e)for(i=0;i-1&&r.splice(t,1)},2500)}}function tp(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,r=0;r-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,n=this.state;function r(n){e.manager.emit(n,t)}n<8&&r(e.options.event+tP(n)),r(e.options.event),t.additionalEvent&&r(t.additionalEvent),n>=8&&r(e.options.event+tP(n))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=32},canEmit:function(){for(var t=0;te.threshold&&i&e.direction},attrTest:function(t){return tS.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=tM(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),w(tk,tS,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[tb]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),w(tx,t$,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[tg]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distancee.time;if(this._input=t,r&&n&&(!(12&t.eventType)||i)){if(1&t.eventType)this.reset(),this._timer=d(function(){this.state=8,this.tryEmit()},e.time,this);else if(4&t.eventType)return 8}else this.reset();return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}}),w(tD,tS,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[tb]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),w(tC,tS,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return tT.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return 30&n?e=t.overallVelocity:6&n?e=t.overallVelocityX:24&n&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&p(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=tM(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),w(tR,t$,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tm]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distance1)for(var n=1;nt.length)&&(e=t.length);for(var n=0,r=Array(e);nn?n:t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),te=new h(4),h!=Float32Array&&(te[0]=0,te[1]=0,te[2]=0,te[3]=0);const m=Math.log2||function(t){return Math.log(t)*Math.LOG2E};function b(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],u=e[6],l=e[7],h=e[8],p=e[9],f=e[10],d=e[11],v=e[12],g=e[13],m=e[14],b=e[15],y=n[0],w=n[1],O=n[2],E=n[3];return t[0]=y*r+w*s+O*h+E*v,t[1]=y*i+w*c+O*p+E*g,t[2]=y*o+w*u+O*f+E*m,t[3]=y*a+w*l+O*d+E*b,y=n[4],w=n[5],O=n[6],E=n[7],t[4]=y*r+w*s+O*h+E*v,t[5]=y*i+w*c+O*p+E*g,t[6]=y*o+w*u+O*f+E*m,t[7]=y*a+w*l+O*d+E*b,y=n[8],w=n[9],O=n[10],E=n[11],t[8]=y*r+w*s+O*h+E*v,t[9]=y*i+w*c+O*p+E*g,t[10]=y*o+w*u+O*f+E*m,t[11]=y*a+w*l+O*d+E*b,y=n[12],w=n[13],O=n[14],E=n[15],t[12]=y*r+w*s+O*h+E*v,t[13]=y*i+w*c+O*p+E*g,t[14]=y*o+w*u+O*f+E*m,t[15]=y*a+w*l+O*d+E*b,t}function y(t,e,n){var r,i,o,a,s,c,u,l,h,p,f,d,v=n[0],g=n[1],m=n[2];return e===t?(t[12]=e[0]*v+e[4]*g+e[8]*m+e[12],t[13]=e[1]*v+e[5]*g+e[9]*m+e[13],t[14]=e[2]*v+e[6]*g+e[10]*m+e[14],t[15]=e[3]*v+e[7]*g+e[11]*m+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],u=e[6],l=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=c,t[6]=u,t[7]=l,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=r*v+s*g+h*m+e[12],t[13]=i*v+c*g+p*m+e[13],t[14]=o*v+u*g+f*m+e[14],t[15]=a*v+l*g+d*m+e[15]),t}function w(t,e,n){var r=n[0],i=n[1],o=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function O(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],c=t[6],u=t[7],l=t[8],h=t[9],p=t[10],f=t[11],d=t[12],v=t[13],g=t[14],m=t[15],b=e[0],y=e[1],w=e[2],O=e[3],E=e[4],$=e[5],P=e[6],M=e[7],j=e[8],S=e[9],T=e[10],k=e[11],x=e[12],D=e[13],C=e[14],R=e[15];return Math.abs(n-b)<=1e-6*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-w)<=1e-6*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(o-O)<=1e-6*Math.max(1,Math.abs(o),Math.abs(O))&&Math.abs(a-E)<=1e-6*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(s-$)<=1e-6*Math.max(1,Math.abs(s),Math.abs($))&&Math.abs(c-P)<=1e-6*Math.max(1,Math.abs(c),Math.abs(P))&&Math.abs(u-M)<=1e-6*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(l-j)<=1e-6*Math.max(1,Math.abs(l),Math.abs(j))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(p-T)<=1e-6*Math.max(1,Math.abs(p),Math.abs(T))&&Math.abs(f-k)<=1e-6*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(d-x)<=1e-6*Math.max(1,Math.abs(d),Math.abs(x))&&Math.abs(v-D)<=1e-6*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(g-C)<=1e-6*Math.max(1,Math.abs(g),Math.abs(C))&&Math.abs(m-R)<=1e-6*Math.max(1,Math.abs(m),Math.abs(R))}function E(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function $(t,e,n,r){var i=e[0],o=e[1];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t}function P(t,e){if(!t)throw Error(e||"@math.gl/web-mercator: assertion failed.")}tn=new h(2),h!=Float32Array&&(tn[0]=0,tn[1]=0),tr=new h(3),h!=Float32Array&&(tr[0]=0,tr[1]=0,tr[2]=0);const M=Math.PI,j=M/4,S=M/180,T=180/M;function k(t){return Math.pow(2,t)}function x([t,e]){P(Number.isFinite(t)),P(Number.isFinite(e)&&e>=-90&&e<=90,"invalid latitude");const n=512*(M+Math.log(Math.tan(j+.5*(e*S))))/(2*M);return[512*(t*S+M)/(2*M),n]}function D([t,e]){const n=2*(Math.atan(Math.exp(e/512*(2*M)-M))-j);return[(t/512*(2*M)-M)*T,n*T,]}function C(t){return 2*Math.atan(.5/t)*T}function R(t){return .5/Math.tan(.5*t*S)}function A(t,e,n=0){const[r,i,o]=t;if(P(Number.isFinite(r)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(o)){const a=f(e,[r,i,o,1,]);return a}const s=f(e,[r,i,0,1,]),c=f(e,[r,i,1,1,]),u=s[2],l=c[2];return $([],s,c,u===l?0:((n||0)-u)/(l-u))}const I=Math.PI/180;function L(t,e,n){const{pixelUnprojectionMatrix:r}=t,i=f(r,[e,0,1,1,]),o=f(r,[e,t.height,1,1,]),a=n*t.distanceScales.unitsPerMeter[2],s=(a-i[2])/(o[2]-i[2]),c=$([],i,o,s),u=D(c);return u[2]=n,u}class N{constructor({width:t,height:e,latitude:n=0,longitude:r=0,zoom:i=0,pitch:o=0,bearing:a=0,altitude:s=null,fovy:c=null,position:u=null,nearZMultiplier:l=.02,farZMultiplier:h=1.01}={width:1,height:1}){t=t||1,e=e||1,null===c&&null===s?c=C(s=1.5):null===c?c=C(s):null===s&&(s=R(c));const f=k(i);s=Math.max(.75,s);const d=function({latitude:t,longitude:e,highPrecision:n=!1}){P(Number.isFinite(t)&&Number.isFinite(e));const r={},i=Math.cos(t*S),o=512/360,a=o/i,s=512/4003e4/i;if(r.unitsPerMeter=[s,s,s,],r.metersPerUnit=[1/s,1/s,1/s,],r.unitsPerDegree=[o,a,s,],r.degreesPerUnit=[1/o,1/a,1/s,],n){const c=S*Math.tan(t*S)/i,u=512/4003e4*c,l=u/a*s;r.unitsPerDegree2=[0,o*c/2,u,],r.unitsPerMeter2=[l,0,l,]}return r}({longitude:r,latitude:n}),v=x([r,n]);if(v[2]=0,u){var g,m,b,O,E,$;O=v,E=v,$=(g=[],m=u,b=d.unitsPerMeter,g[0]=m[0]*b[0],g[1]=m[1]*b[1],g[2]=m[2]*b[2],g),O[0]=E[0]+$[0],O[1]=E[1]+$[1],O[2]=E[2]+$[2]}this.projectionMatrix=function({width:t,height:e,pitch:n,altitude:r,fovy:i,nearZMultiplier:o,farZMultiplier:a}){var s,c,u,l,h,p,f;const{fov:d,aspect:v,near:g,far:m}=function({width:t,height:e,fovy:n=C(1.5),altitude:r,pitch:i=0,nearZMultiplier:o=1,farZMultiplier:a=1}){void 0!==r&&(n=C(r));const s=.5*n*S,c=R(n),u=i*S,l=Math.sin(s)*c/Math.sin(Math.min(Math.max(Math.PI/2-u-s,.01),Math.PI-.01)),h=Math.sin(u)*l+c;return{fov:2*s,aspect:t/e,focalDistance:c,near:o,far:h*a}}({width:t,height:e,altitude:r,fovy:i,pitch:n,nearZMultiplier:o,farZMultiplier:a}),b=(s=[],c=d,u=v,l=g,h=m,f=1/Math.tan(c/2),s[0]=f/u,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=f,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=-1,s[12]=0,s[13]=0,s[15]=0,null!=h&&h!==1/0?(p=1/(l-h),s[10]=(h+l)*p,s[14]=2*h*l*p):(s[10]=-1,s[14]=-2*l),s);return b}({width:t,height:e,pitch:o,fovy:c,nearZMultiplier:l,farZMultiplier:h}),this.viewMatrix=function({height:t,pitch:e,bearing:n,altitude:r,scale:i,center:o=null}){var a,s,c,u,l,h,f,d,v,g,m,b,O,E,$,P,M,j,T,k,x,D,C,R,A,I,L,N;const z=p();return y(z,z,[0,0,-r]),a=z,s=z,u=Math.sin(c=-e*S),l=Math.cos(c),h=s[4],f=s[5],d=s[6],v=s[7],g=s[8],m=s[9],b=s[10],O=s[11],s!==a&&(a[0]=s[0],a[1]=s[1],a[2]=s[2],a[3]=s[3],a[12]=s[12],a[13]=s[13],a[14]=s[14],a[15]=s[15]),a[4]=h*l+g*u,a[5]=f*l+m*u,a[6]=d*l+b*u,a[7]=v*l+O*u,a[8]=g*l-h*u,a[9]=m*l-f*u,a[10]=b*l-d*u,a[11]=O*l-v*u,E=z,$=z,M=Math.sin(P=n*S),j=Math.cos(P),T=$[0],k=$[1],x=$[2],D=$[3],C=$[4],R=$[5],A=$[6],I=$[7],$!==E&&(E[8]=$[8],E[9]=$[9],E[10]=$[10],E[11]=$[11],E[12]=$[12],E[13]=$[13],E[14]=$[14],E[15]=$[15]),E[0]=T*j+C*M,E[1]=k*j+R*M,E[2]=x*j+A*M,E[3]=D*j+I*M,E[4]=C*j-T*M,E[5]=R*j-k*M,E[6]=A*j-x*M,E[7]=I*j-D*M,w(z,z,[i/=t,i,i]),o&&y(z,z,(L=[],N=o,L[0]=-N[0],L[1]=-N[1],L[2]=-N[2],L)),z}({height:e,scale:f,center:v,pitch:o,bearing:a,altitude:s}),this.width=t,this.height=e,this.scale=f,this.latitude=n,this.longitude=r,this.zoom=i,this.pitch=o,this.bearing=a,this.altitude=s,this.fovy=c,this.center=v,this.meterOffset=u||[0,0,0],this.distanceScales=d,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 t,e,n,r,i,o,a,s,c,u,l,h,f,d,v,g,m,O,E,$,P,M,j,S,T,k,x,D,C,R,A;const{width:I,height:L,projectionMatrix:N,viewMatrix:z}=this,F=p();b(F,F,N),b(F,F,z),this.viewProjectionMatrix=F;const V=p();w(V,V,[I/2,-L/2,1]),y(V,V,[1,-1,0]),b(V,V,F);const B=(t=p(),n=(e=V)[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],u=e[7],l=e[8],h=e[9],f=e[10],d=e[11],v=e[12],g=e[13],m=e[14],O=e[15],E=n*s-r*a,$=n*c-i*a,P=n*u-o*a,M=r*c-i*s,j=r*u-o*s,S=i*u-o*c,T=l*g-h*v,k=l*m-f*v,x=l*O-d*v,D=h*m-f*g,C=h*O-d*g,(A=E*(R=f*O-d*m)-$*C+P*D+M*x-j*k+S*T)?(A=1/A,t[0]=(s*R-c*C+u*D)*A,t[1]=(i*C-r*R-o*D)*A,t[2]=(g*S-m*j+O*M)*A,t[3]=(f*j-h*S-d*M)*A,t[4]=(c*x-a*R-u*k)*A,t[5]=(n*R-i*x+o*k)*A,t[6]=(m*P-v*S-O*$)*A,t[7]=(l*S-f*P+d*$)*A,t[8]=(a*C-s*x+u*T)*A,t[9]=(r*x-n*C-o*T)*A,t[10]=(v*j-g*P+O*E)*A,t[11]=(h*P-l*j-d*E)*A,t[12]=(s*k-a*D-c*T)*A,t[13]=(n*D-r*k+i*T)*A,t[14]=(g*$-v*M-m*E)*A,t[15]=(l*M-h*$+f*E)*A,t):null);if(!B)throw Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=V,this.pixelUnprojectionMatrix=B}equals(t){return t instanceof N&&t.width===this.width&&t.height===this.height&&O(t.projectionMatrix,this.projectionMatrix)&&O(t.viewMatrix,this.viewMatrix)}project(t,{topLeft:e=!0}={}){const n=this.projectPosition(t),r=function(t,e){const[n,r,i=0]=t;return P(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i)),f(e,[n,r,i,1])}(n,this.pixelProjectionMatrix),[i,o]=r,a=e?o:this.height-o;return 2===t.length?[i,a]:[i,a,r[2]]}unproject(t,{topLeft:e=!0,targetZ:n}={}){const[r,i,o]=t,a=e?i:this.height-i,s=n&&n*this.distanceScales.unitsPerMeter[2],c=A([r,a,o],this.pixelUnprojectionMatrix,s),[u,l,h]=this.unprojectPosition(c);return Number.isFinite(o)?[u,l,h]:Number.isFinite(n)?[u,l,n]:[u,l]}projectPosition(t){const[e,n]=x(t),r=(t[2]||0)*this.distanceScales.unitsPerMeter[2];return[e,n,r]}unprojectPosition(t){const[e,n]=D(t),r=(t[2]||0)*this.distanceScales.metersPerUnit[2];return[e,n,r]}projectFlat(t){return x(t)}unprojectFlat(t){return D(t)}getMapCenterByLngLatPosition({lngLat:t,pos:e}){var n,r;const i=A(e,this.pixelUnprojectionMatrix),o=x(t),a=E([],o,(n=[],r=i,n[0]=-r[0],n[1]=-r[1],n)),s=E([],this.center,a);return D(s)}getLocationAtPoint({lngLat:t,pos:e}){return this.getMapCenterByLngLatPosition({lngLat:t,pos:e})}fitBounds(t,e={}){const{width:n,height:r}=this,{longitude:i,latitude:o,zoom:a}=function({width:t,height:e,bounds:n,minExtent:r=0,maxZoom:i=24,padding:o=0,offset:a=[0,0]}){const[[s,c],[u,l]]=n;if(Number.isFinite(o)){const h=o;o={top:h,bottom:h,left:h,right:h}}else P(Number.isFinite(o.top)&&Number.isFinite(o.bottom)&&Number.isFinite(o.left)&&Number.isFinite(o.right));const p=x([s,g(l,-85.051129,85.051129),]),f=x([u,g(c,-85.051129,85.051129),]),d=[Math.max(Math.abs(f[0]-p[0]),r),Math.max(Math.abs(f[1]-p[1]),r),],v=[t-o.left-o.right-2*Math.abs(a[0]),e-o.top-o.bottom-2*Math.abs(a[1]),];P(v[0]>0&&v[1]>0);const b=v[0]/d[0],y=v[1]/d[1],w=(o.right-o.left)/2/b,O=(o.bottom-o.top)/2/y,E=[(f[0]+p[0])/2+w,(f[1]+p[1])/2+O,],$=D(E),M=Math.min(i,m(Math.abs(Math.min(b,y))));return P(Number.isFinite(M)),{longitude:$[0],latitude:$[1],zoom:M}}(Object.assign({width:n,height:r,bounds:t},e));return new N({width:n,height:r,longitude:i,latitude:o,zoom:a})}getBounds(t){const e=this.getBoundingRegion(t),n=Math.min(...e.map(t=>t[0])),r=Math.max(...e.map(t=>t[0])),i=Math.min(...e.map(t=>t[1])),o=Math.max(...e.map(t=>t[1]));return[[n,i],[r,o],]}getBoundingRegion(t={}){return function(t,e=0){const{width:n,height:r,unproject:i}=t,o={targetZ:e},a=i([0,r],o),s=i([n,r],o);let c,u;const l=t.fovy?.5*t.fovy*I:Math.atan(.5/t.altitude),h=(90-t.pitch)*I;return l>h-.01?(c=L(t,0,e),u=L(t,n,e)):(c=i([0,0],o),u=i([n,0],o)),[a,s,u,c]}(this,t.z||0)}}const z=["longitude","latitude","zoom"],F={curve:1.414,speed:1.2};function V(t,e,n){var r,i,o,a;n=Object.assign({},F,n);const s=n.curve,c=t.zoom,u=[t.longitude,t.latitude],l=k(c),h=e.zoom,p=[e.longitude,e.latitude],f=k(h-c),d=x(u),v=x(p),g=(r=[],i=v,o=d,r[0]=i[0]-o[0],r[1]=i[1]-o[1],r),m=Math.max(t.width,t.height),b=m/f,y=Math.hypot((a=g)[0],a[1])*l,w=Math.max(y,.01),O=s*s,E=(b*b-m*m+O*O*w*w)/(2*m*O*w),$=(b*b-m*m-O*O*w*w)/(2*b*O*w),P=Math.log(Math.sqrt(E*E+1)-E),M=Math.log(Math.sqrt($*$+1)-$);return{startZoom:c,startCenterXY:d,uDelta:g,w0:m,u1:y,S:(M-P)/s,rho:s,rho2:O,r0:P,r1:M}}var B=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,r){return t[0]===e&&(n=r,!0)}),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),r=this.__entries__[n];return r&&r[1]},e.prototype.set=function(e,n){var r=t(this.__entries__,e);~r?this.__entries__[r][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,r=t(n,e);~r&&n.splice(r,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n0},t.prototype.connect_=function(){Z&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),W?(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)},t.prototype.disconnect_=function(){Z&&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)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e;H.some(function(t){return!!~n.indexOf(t)})&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),X=function(t,e){for(var n=0,r=Object.keys(e);n0},t}(),ts="undefined"!=typeof WeakMap?new WeakMap:new B,tc=function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var n=Y.getInstance(),r=new ta(e,n,this);ts.set(this,r)};["observe","unobserve","disconnect"].forEach(function(t){tc.prototype[t]=function(){var e;return(e=ts.get(this))[t].apply(e,arguments)}});var tu=void 0!==U.ResizeObserver?U.ResizeObserver:tc;function tl(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}function th(t,e){for(var n=0;n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function tm(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n1&&void 0!==arguments[1]?arguments[1]:"component";t.debug&&u.checkPropTypes(tO,t,"prop",e)}var tP=function(){function t(e){var n=this;if(tl(this,t),a(this,"props",tE),a(this,"width",0),a(this,"height",0),a(this,"_fireLoadEvent",function(){n.props.onLoad({type:"load",target:n._map})}),a(this,"_handleError",function(t){n.props.onError(t)}),!e.mapboxgl)throw Error("Mapbox not available");this.mapboxgl=e.mapboxgl,t.initialized||(t.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(e)}return tp(t,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(t){return this._update(this.props,t),this}},{key:"redraw",value:function(){var t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(e){this._map=t.savedMap;var n=this._map.getContainer(),r=e.container;for(r.classList.add("mapboxgl-map");n.childNodes.length>0;)r.appendChild(n.childNodes[0]);this._map._container=r,t.savedMap=null,e.mapStyle&&this._map.setStyle(ty(e.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(e){if(e.reuseMaps&&t.savedMap)this._reuse(e);else{if(e.gl){var n=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=n,e.gl}}var r={container:e.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:ty(e.mapStyle),interactive:!1,trackResize:!1,attributionControl:e.attributionControl,preserveDrawingBuffer:e.preserveDrawingBuffer};e.transformRequest&&(r.transformRequest=e.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},r,e.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!t.savedMap?(t.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(t){var e=this;t=Object.assign({},tE,t),t$(t,"Mapbox"),this.mapboxgl.accessToken=t.mapboxApiAccessToken||tE.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=t.mapboxApiUrl,this._create(t);var n=t.container;Object.defineProperty(n,"offsetWidth",{configurable:!0,get:function(){return e.width}}),Object.defineProperty(n,"clientWidth",{configurable:!0,get:function(){return e.width}}),Object.defineProperty(n,"offsetHeight",{configurable:!0,get:function(){return e.height}}),Object.defineProperty(n,"clientHeight",{configurable:!0,get:function(){return e.height}});var r=this._map.getCanvas();r&&(r.style.outline="none"),this._updateMapViewport({},t),this._updateMapSize({},t),this.props=t}},{key:"_update",value:function(t,e){if(this._map){t$(e=Object.assign({},this.props,e),"Mapbox");var n=this._updateMapViewport(t,e),r=this._updateMapSize(t,e);this._updateMapStyle(t,e),!e.asyncRender&&(n||r)&&this.redraw(),this.props=e}}},{key:"_updateMapStyle",value:function(t,e){t.mapStyle!==e.mapStyle&&this._map.setStyle(ty(e.mapStyle),{diff:!e.preventStyleDiffing})}},{key:"_updateMapSize",value:function(t,e){var n=t.width!==e.width||t.height!==e.height;return n&&(this.width=e.width,this.height=e.height,this._map.resize()),n}},{key:"_updateMapViewport",value:function(t,e){var n=this._getViewState(t),r=this._getViewState(e),i=r.latitude!==n.latitude||r.longitude!==n.longitude||r.zoom!==n.zoom||r.pitch!==n.pitch||r.bearing!==n.bearing||r.altitude!==n.altitude;return i&&(this._map.jumpTo(this._viewStateToMapboxProps(r)),r.altitude!==n.altitude&&(this._map.transform.altitude=r.altitude)),i}},{key:"_getViewState",value:function(t){var e=t.viewState||t,n=e.longitude,r=e.latitude,i=e.zoom,o=e.pitch,a=e.bearing,s=e.altitude;return{longitude:n,latitude:r,zoom:i,pitch:void 0===o?0:o,bearing:void 0===a?0:a,altitude:void 0===s?1.5:s}}},{key:"_checkStyleSheet",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==tf)try{var e=tf.createElement("div");if(e.className="mapboxgl-map",e.style.display="none",tf.body.appendChild(e),!("static"!==window.getComputedStyle(e).position)){var n=tf.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(t,"/mapbox-gl.css")),tf.head.appendChild(n)}}catch(r){}}},{key:"_viewStateToMapboxProps",value:function(t){return{center:[t.longitude,t.latitude,],zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}}},]),t}();a(tP,"initialized",!1),a(tP,"propTypes",tO),a(tP,"defaultProps",tE),a(tP,"savedMap",null);var tM=n(6158),tj=n.n(tM);function tS(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function tT(t,e){if(t===e)return!0;if(tS(t)&&tS(e)){if(t.length!==e.length)return!1;for(var n=0;n=Math.abs(t-e)}function tk(t,e,n){return Math.max(e,Math.min(n,t))}function tx(t,e,n){return tS(t)?t.map(function(t,r){return tx(t,e[r],n)}):n*e+(1-n)*t}function tD(t,e){if(!t)throw Error(e||"react-map-gl: assertion failed.")}function tC(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function tR(t){for(var e=1;e0,"`scale` must be a positive number");var i=this._state,o=i.startZoom,a=i.startZoomLngLat;Number.isFinite(o)||(o=this._viewportProps.zoom,a=this._unproject(n)||this._unproject(e)),tD(a,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var s=this._calculateNewZoom({scale:r,startZoom:o||0}),c=new N(Object.assign({},this._viewportProps,{zoom:s})).getMapCenterByLngLatPosition({lngLat:a,pos:e}),u=l(c,2),h=u[0],p=u[1];return this._getUpdatedMapState({zoom:s,longitude:h,latitude:p})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(e){return new t(Object.assign({},this._viewportProps,this._state,e))}},{key:"_applyConstraints",value:function(t){var e=t.maxZoom,n=t.minZoom,r=t.zoom;t.zoom=tk(r,n,e);var i=t.maxPitch,o=t.minPitch,a=t.pitch;return t.pitch=tk(a,o,i),Object.assign(t,function({width:t,height:e,longitude:n,latitude:r,zoom:i,pitch:o=0,bearing:a=0}){(n<-180||n>180)&&(n=d(n+180,360)-180),(a<-180||a>180)&&(a=d(a+180,360)-180);const s=m(e/512);if(i<=s)i=s,r=0;else{const c=e/2/Math.pow(2,i),u=D([0,c])[1];if(rl&&(r=l)}}return{width:t,height:e,longitude:n,latitude:r,zoom:i,pitch:o,bearing:a}}(t)),t}},{key:"_unproject",value:function(t){var e=new N(this._viewportProps);return t&&e.unproject(t)}},{key:"_calculateNewLngLat",value:function(t){var e=t.startPanLngLat,n=t.pos;return new N(this._viewportProps).getMapCenterByLngLatPosition({lngLat:e,pos:n})}},{key:"_calculateNewZoom",value:function(t){var e=t.scale,n=t.startZoom,r=this._viewportProps,i=r.maxZoom;return tk(n+Math.log2(e),r.minZoom,i)}},{key:"_calculateNewPitchAndBearing",value:function(t){var e=t.deltaScaleX,n=t.deltaScaleY,r=t.startBearing,i=t.startPitch;n=tk(n,-1,1);var o=this._viewportProps,a=o.minPitch,s=o.maxPitch,c=i;return n>0?c=i+n*(s-i):n<0&&(c=i-n*(a-i)),{pitch:c,bearing:r+180*e}}},{key:"_getRotationParams",value:function(t,e){var n=t[0]-e[0],r=t[1]-e[1],i=t[1],o=e[1],a=this._viewportProps,s=a.width,c=a.height,u=0;return r>0?Math.abs(c-o)>5&&(u=r/(o-c)*1.2):r<0&&o>5&&(u=1-i/o),{deltaScaleX:n/s,deltaScaleY:u=Math.min(1,Math.max(-1,u))}}},]),t}();function tN(t){return t[0].toLowerCase()+t.slice(1)}function tz(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function tF(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},r=t.current&&t.current.getMap();return r&&r.queryRenderedFeatures(e,n)}}},[]);var g=(0,c.useCallback)(function(t){var e=t.target;e===f.current&&e.scrollTo(0,0)},[]),m=v&&c.createElement(tB,{value:tW(tW({},d),{},{viewport:d.viewport||tX(tW({map:v,props:t},a)),map:v,container:d.container||p.current})},c.createElement("div",{key:"map-overlays",className:"overlays",ref:f,style:tK,onScroll:g},t.children)),b=t.className,y=t.width,w=t.height,O=t.style,E=t.visibilityConstraints,$=Object.assign({position:"relative"},O,{width:y,height:w}),P=t.visible&&function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tA;for(var n in e){var r=n.slice(0,3),i=tN(n.slice(3));if("min"===r&&t[i]e[n])return!1}return!0}(t.viewState||t,E),M=Object.assign({},tK,{visibility:P?"inherit":"hidden"});return c.createElement("div",{key:"map-container",ref:p,style:$},c.createElement("div",{key:"map-mapbox",ref:h,style:M,className:b}),m,!r&&!t.disableTokenWarning&&c.createElement(tJ,null))});tQ.supported=function(){return tj()&&tj().supported()},tQ.propTypes=tG,tQ.defaultProps=t_;var t0=tQ;function t1(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}(this.propNames||[]);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(!tT(t[i],e[i]))return!1}}catch(o){r.e(o)}finally{r.f()}return!0}},{key:"initializeProps",value:function(t,e){return{start:t,end:e}}},{key:"interpolateProps",value:function(t,e,n){tD(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(t,e){return e.transitionDuration}},]),t}();function t4(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function t3(t,e){return(t3=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function t5(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&t3(t,e)}function t8(t){return(t8="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function t6(t,e){if(e&&("object"===t8(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return t4(t)}function t7(t){return(t7=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var t9={longitude:1,bearing:1};function et(t){return Number.isFinite(t)||Array.isArray(t)}function ee(t,e,n){return t in t9&&Math.abs(n-e)>180&&(n=n<0?n+360:n-360),n}function en(t,e){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return er(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return er(t,e)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function er(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function eu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n0&&void 0!==arguments[0]?arguments[0]:{};return tl(this,i),a(t4(t=r.call(this)),"propNames",ei),t.props=Object.assign({},es,e),t}return tp(i,[{key:"initializeProps",value:function(t,e){var n,r={},i={},o=en(eo);try{for(o.s();!(n=o.n()).done;){var a=n.value,s=t[a],c=e[a];tD(et(s)&&et(c),"".concat(a," must be supplied for transition")),r[a]=s,i[a]=ee(a,s,c)}}catch(u){o.e(u)}finally{o.f()}var l,h=en(ea);try{for(h.s();!(l=h.n()).done;){var p=l.value,f=t[p]||0,d=e[p]||0;r[p]=f,i[p]=ee(p,f,d)}}catch(v){h.e(v)}finally{h.f()}return{start:r,end:i}}},{key:"interpolateProps",value:function(t,e,n){var r,i=function(t,e,n,r={}){var i,o,a;const s={},{startZoom:c,startCenterXY:u,uDelta:l,w0:h,u1:p,S:f,rho:d,rho2:g,r0:b}=V(t,e,r);if(p<.01){for(const y of z){const w=t[y],O=e[y];s[y]=v(w,O,n)}return s}const $=n*f,P=Math.cosh(b)/Math.cosh(b+d*$),M=h*((Math.cosh(b)*Math.tanh(b+d*$)-Math.sinh(b))/g)/p,j=c+m(1/P),S=(i=[],o=l,a=M,i[0]=o[0]*a,i[1]=o[1]*a,i);E(S,S,u);const T=D(S);return s.longitude=T[0],s.latitude=T[1],s.zoom=j,s}(t,e,n,this.props),o=en(ea);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tx(t[a],e[a],n)}}catch(s){o.e(s)}finally{o.f()}return i}},{key:"getDuration",value:function(t,e){var n=e.transitionDuration;return"auto"===n&&(n=function(t,e,n={}){n=Object.assign({},F,n);const{screenSpeed:r,speed:i,maxDuration:o}=n,{S:a,rho:s}=V(t,e,n),c=1e3*a;let u;return u=Number.isFinite(r)?c/(r/s):c/i,Number.isFinite(o)&&u>o?0:u}(t,e,this.props)),n}},]),i}(t2);var el=["longitude","latitude","zoom","bearing","pitch",],eh=function(t){t5(i,t);var e,n,r=(e=i,n=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(t){return!1}}(),function(){var t,r=t7(e);if(n){var i=t7(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return t6(this,t)});function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return tl(this,i),t=r.call(this),Array.isArray(e)&&(e={transitionProps:e}),t.propNames=e.transitionProps||el,e.around&&(t.around=e.around),t}return tp(i,[{key:"initializeProps",value:function(t,e){var n={},r={};if(this.around){n.around=this.around;var i=new N(t).unproject(this.around);Object.assign(r,e,{around:new N(e).project(i),aroundLngLat:i})}var o,a=ec(this.propNames);try{for(a.s();!(o=a.n()).done;){var s=o.value,c=t[s],u=e[s];tD(et(c)&&et(u),"".concat(s," must be supplied for transition")),n[s]=c,r[s]=ee(s,c,u)}}catch(l){a.e(l)}finally{a.f()}return{start:n,end:r}}},{key:"interpolateProps",value:function(t,e,n){var r,i={},o=ec(this.propNames);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tx(t[a],e[a],n)}}catch(s){o.e(s)}finally{o.f()}if(e.around){var c=new N(Object.assign({},e,i)).getMapCenterByLngLatPosition({lngLat:e.aroundLngLat,pos:tx(t.around,e.around,n)}),u=l(c,2),h=u[0],p=u[1];i.longitude=h,i.latitude=p}return i}},]),i}(t2),ep=function(){},ef={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},ed={transitionDuration:0,transitionEasing:function(t){return t},transitionInterpolator:new eh,transitionInterruption:ef.BREAK,onTransitionStart:ep,onTransitionInterrupt:ep,onTransitionEnd:ep},ev=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tl(this,t),a(this,"_animationFrame",null),a(this,"_onTransitionFrame",function(){e._animationFrame=requestAnimationFrame(e._onTransitionFrame),e._updateViewport()}),this.props=null,this.onViewportChange=n.onViewportChange||ep,this.onStateChange=n.onStateChange||ep,this.time=n.getTime||Date.now}return tp(t,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(t){var e=this.props;if(this.props=t,!e||this._shouldIgnoreViewportChange(e,t))return!1;if(this._isTransitionEnabled(t)){var n=Object.assign({},e),r=Object.assign({},t);if(this._isTransitionInProgress()&&(e.onTransitionInterrupt(),this.state.interruption===ef.SNAP_TO_END?Object.assign(n,this.state.endProps):Object.assign(n,this.state.propsInTransition),this.state.interruption===ef.UPDATE)){var i,o,a,s=this.time(),c=(s-this.state.startTime)/this.state.duration;r.transitionDuration=this.state.duration-(s-this.state.startTime),r.transitionEasing=(a=(i=this.state.easing)(o=c),function(t){return 1/(1-a)*(i(t*(1-o)+o)-a)}),r.transitionInterpolator=n.transitionInterpolator}return r.onTransitionStart(),this._triggerTransition(n,r),!0}return this._isTransitionInProgress()&&(e.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return Boolean(this._animationFrame)}},{key:"_isTransitionEnabled",value:function(t){var e=t.transitionDuration,n=t.transitionInterpolator;return(e>0||"auto"===e)&&Boolean(n)}},{key:"_isUpdateDueToCurrentTransition",value:function(t){return!!this.state.propsInTransition&&this.state.interpolator.arePropsEqual(t,this.state.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(t,e){return!t||(this._isTransitionInProgress()?this.state.interruption===ef.IGNORE||this._isUpdateDueToCurrentTransition(e):!this._isTransitionEnabled(e)||e.transitionInterpolator.arePropsEqual(t,e))}},{key:"_triggerTransition",value:function(t,e){tD(this._isTransitionEnabled(e)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var n=e.transitionInterpolator,r=n.getDuration?n.getDuration(t,e):e.transitionDuration;if(0!==r){var i=e.transitionInterpolator.initializeProps(t,e),o={inTransition:!0,isZooming:t.zoom!==e.zoom,isPanning:t.longitude!==e.longitude||t.latitude!==e.latitude,isRotating:t.bearing!==e.bearing||t.pitch!==e.pitch};this.state={duration:r,easing:e.transitionEasing,interpolator:e.transitionInterpolator,interruption:e.transitionInterruption,startTime:this.time(),startProps:i.start,endProps:i.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(o)}}},{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 t=this.time(),e=this.state,n=e.startTime,r=e.duration,i=e.easing,o=e.interpolator,a=e.startProps,s=e.endProps,c=!1,u=(t-n)/r;u>=1&&(u=1,c=!0),u=i(u);var l=o.interpolateProps(a,s,u),h=new tL(Object.assign({},this.props,l));this.state.propsInTransition=h.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),c&&(this._endTransition(),this.props.onTransitionEnd())}},]),t}();a(ev,"defaultProps",ed);var eg=n(840),em=n.n(eg);const eb={mousedown:1,mousemove:2,mouseup:4};!function(t){const e=t.prototype.handler;t.prototype.handler=function(t){const n=this.store;t.button>0&&"pointerdown"===t.type&&!function(t,e){for(let n=0;ne.pointerId===t.pointerId)&&n.push(t),e.call(this,t)}}(em().PointerEventInput),em().MouseInput.prototype.handler=function(t){let e=eb[t.type];1&e&&t.button>=0&&(this.pressed=!0),2&e&&0===t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))};const ey=em().Manager;var ew=em();const eO=ew?[[ew.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1},],[ew.Rotate,{enable:!1},],[ew.Pinch,{enable:!1},],[ew.Swipe,{enable:!1},],[ew.Pan,{threshold:0,enable:!1},],[ew.Press,{enable:!1},],[ew.Tap,{event:"doubletap",taps:2,enable:!1},],[ew.Tap,{event:"anytap",enable:!1},],[ew.Tap,{enable:!1},],]:null,eE={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},e$={doubletap:["tap"]},eP={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},eM={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave",],WHEEL_EVENTS:["wheel","mousewheel"]},ej={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"},eS={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},eT="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",ek="undefined"!=typeof window?window:n.g;void 0!==n.g?n.g:window;let ex=!1;try{const eD={get passive(){return ex=!0,!0}};ek.addEventListener("test",eD,eD),ek.removeEventListener("test",eD,eD)}catch(eC){}const eR=-1!==eT.indexOf("firefox"),{WHEEL_EVENTS:eA}=eM,eI="wheel";class eL{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.events=eA.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(e=>t.addEventListener(e,this.handleEvent,!!ex&&{passive:!1}))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===eI&&(this.options.enable=e)}handleEvent(t){if(!this.options.enable)return;let e=t.deltaY;ek.WheelEvent&&(eR&&t.deltaMode===ek.WheelEvent.DOM_DELTA_PIXEL&&(e/=ek.devicePixelRatio),t.deltaMode===ek.WheelEvent.DOM_DELTA_LINE&&(e*=40));const n={x:t.clientX,y:t.clientY};0!==e&&e%4.000244140625==0&&(e=Math.floor(e/4.000244140625)),t.shiftKey&&e&&(e*=.25),this._onWheel(t,-e,n)}_onWheel(t,e,n){this.callback({type:eI,center:n,delta:e,srcEvent:t,pointerType:"mouse",target:t.target})}}const{MOUSE_EVENTS:eN}=eM,ez="pointermove",eF="pointerover",eV="pointerout",eB="pointerleave";class eZ{constructor(t,e,n={}){this.element=t,this.callback=e,this.pressed=!1,this.options=Object.assign({enable:!0},n),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=eN.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(e=>t.addEventListener(e,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===ez&&(this.enableMoveEvent=e),t===eF&&(this.enableOverEvent=e),t===eV&&(this.enableOutEvent=e),t===eB&&(this.enableLeaveEvent=e)}handleEvent(t){this.handleOverEvent(t),this.handleOutEvent(t),this.handleLeaveEvent(t),this.handleMoveEvent(t)}handleOverEvent(t){this.enableOverEvent&&"mouseover"===t.type&&this.callback({type:eF,srcEvent:t,pointerType:"mouse",target:t.target})}handleOutEvent(t){this.enableOutEvent&&"mouseout"===t.type&&this.callback({type:eV,srcEvent:t,pointerType:"mouse",target:t.target})}handleLeaveEvent(t){this.enableLeaveEvent&&"mouseleave"===t.type&&this.callback({type:eB,srcEvent:t,pointerType:"mouse",target:t.target})}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case"mousedown":t.button>=0&&(this.pressed=!0);break;case"mousemove":0===t.which&&(this.pressed=!1),this.pressed||this.callback({type:ez,srcEvent:t,pointerType:"mouse",target:t.target});break;case"mouseup":this.pressed=!1}}}const{KEY_EVENTS:eU}=eM,eq="keydown",eH="keyup";class eW{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=eU.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),t.tabIndex=n.tabIndex||0,t.style.outline="none",this.events.forEach(e=>t.addEventListener(e,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===eq&&(this.enableDownEvent=e),t===eH&&(this.enableUpEvent=e)}handleEvent(t){const e=t.target||t.srcElement;("INPUT"!==e.tagName||"text"!==e.type)&&"TEXTAREA"!==e.tagName&&(this.enableDownEvent&&"keydown"===t.type&&this.callback({type:eq,srcEvent:t,key:t.key,target:t.target}),this.enableUpEvent&&"keyup"===t.type&&this.callback({type:eH,srcEvent:t,key:t.key,target:t.target}))}}const eY="contextmenu";class eX{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.handleEvent=this.handleEvent.bind(this),t.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(t,e){t===eY&&(this.options.enable=e)}handleEvent(t){this.options.enable&&this.callback({type:eY,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})}}const eK={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},eG={srcElement:"root",priority:0};class e_{constructor(t){this.eventManager=t,this.handlers=[],this.handlersByElement=new Map,this.handleEvent=this.handleEvent.bind(this),this._active=!1}isEmpty(){return!this._active}add(t,e,n,r=!1,i=!1){const{handlers:o,handlersByElement:a}=this;n&&("object"!=typeof n||n.addEventListener)&&(n={srcElement:n}),n=n?Object.assign({},eG,n):eG;let s=a.get(n.srcElement);s||(s=[],a.set(n.srcElement,s));const c={type:t,handler:e,srcElement:n.srcElement,priority:n.priority};r&&(c.once=!0),i&&(c.passive=!0),o.push(c),this._active=this._active||!c.passive;let u=s.length-1;for(;u>=0&&!(s[u].priority>=c.priority);)u--;s.splice(u+1,0,c)}remove(t,e){const{handlers:n,handlersByElement:r}=this;for(let i=n.length-1;i>=0;i--){const o=n[i];if(o.type===t&&o.handler===e){n.splice(i,1);const a=r.get(o.srcElement);a.splice(a.indexOf(o),1),0===a.length&&r.delete(o.srcElement)}}this._active=n.some(t=>!t.passive)}handleEvent(t){if(this.isEmpty())return;const e=this._normalizeEvent(t);let n=t.srcEvent.target;for(;n&&n!==e.rootElement;){if(this._emit(e,n),e.handled)return;n=n.parentNode}this._emit(e,"root")}_emit(t,e){const n=this.handlersByElement.get(e);if(n){let r=!1;const i=()=>{t.handled=!0},o=()=>{t.handled=!0,r=!0},a=[];for(let s=0;s{const e=this.manager.get(t);e&&eE[t].forEach(t=>{e.recognizeWith(t)})}),e.recognizerOptions){const i=this.manager.get(r);if(i){const o=e.recognizerOptions[r];delete o.enable,i.set(o)}}for(const[a,s]of(this.wheelInput=new eL(t,this._onOtherEvent,{enable:!1}),this.moveInput=new eZ(t,this._onOtherEvent,{enable:!1}),this.keyInput=new eW(t,this._onOtherEvent,{enable:!1,tabIndex:e.tabIndex}),this.contextmenuInput=new eX(t,this._onOtherEvent,{enable:!1}),this.events))s.isEmpty()||(this._toggleRecognizer(s.recognizerName,!0),this.manager.on(a,s.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(t,e,n){this._addEventHandler(t,e,n,!1)}once(t,e,n){this._addEventHandler(t,e,n,!0)}watch(t,e,n){this._addEventHandler(t,e,n,!1,!0)}off(t,e){this._removeEventHandler(t,e)}_toggleRecognizer(t,e){const{manager:n}=this;if(!n)return;const r=n.get(t);if(r&&r.options.enable!==e){r.set({enable:e});const i=e$[t];i&&!this.options.recognizers&&i.forEach(i=>{const o=n.get(i);e?(o.requireFailure(t),r.dropRequireFailure(i)):o.dropRequireFailure(t)})}this.wheelInput.enableEventType(t,e),this.moveInput.enableEventType(t,e),this.keyInput.enableEventType(t,e),this.contextmenuInput.enableEventType(t,e)}_addEventHandler(t,e,n,r,i){if("string"!=typeof t){for(const o in n=e,t)this._addEventHandler(o,t[o],n,r,i);return}const{manager:a,events:s}=this,c=eS[t]||t;let u=s.get(c);!u&&(u=new e_(this),s.set(c,u),u.recognizerName=ej[c]||c,a&&a.on(c,u.handleEvent)),u.add(t,e,n,r,i),u.isEmpty()||this._toggleRecognizer(u.recognizerName,!0)}_removeEventHandler(t,e){if("string"!=typeof t){for(const n in t)this._removeEventHandler(n,t[n]);return}const{events:r}=this,i=eS[t]||t,o=r.get(i);if(o&&(o.remove(t,e),o.isEmpty())){const{recognizerName:a}=o;let s=!1;for(const c of r.values())if(c.recognizerName===a&&!c.isEmpty()){s=!0;break}s||this._toggleRecognizer(a,!1)}}_onBasicInput(t){const{srcEvent:e}=t,n=eP[e.type];n&&this.manager.emit(n,t)}_onOtherEvent(t){this.manager.emit(t.type,t)}}function eQ(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function e0(t){for(var e=1;e0),a=o&&!this.state.isHovering,s=!o&&this.state.isHovering;(r||a)&&(t.features=e,r&&r(t)),a&&nr.call(this,"onMouseEnter",t),s&&nr.call(this,"onMouseLeave",t),(a||s)&&this.setState({isHovering:o})}}function ns(t){var e=this.props,n=e.onClick,r=e.onNativeClick,i=e.onDblClick,o=e.doubleClickZoom,a=[],s=i||o;switch(t.type){case"anyclick":a.push(r),s||a.push(n);break;case"click":s&&a.push(n)}(a=a.filter(Boolean)).length&&((t=ne.call(this,t)).features=nn.call(this,t.point),a.forEach(function(e){return e(t)}))}var nc=(0,c.forwardRef)(function(t,e){var n,a,s=(0,c.useContext)(tZ),u=(0,c.useMemo)(function(){return t.controller||new e5},[]),l=(0,c.useMemo)(function(){return new eJ(null,{touchAction:t.touchAction,recognizerOptions:t.eventRecognizerOptions})},[]),h=(0,c.useRef)(null),p=(0,c.useRef)(null),f=(0,c.useRef)({width:0,height:0,state:{isHovering:!1,isDragging:!1}}).current;f.props=t,f.map=p.current&&p.current.getMap(),f.setState=function(e){f.state=e6(e6({},f.state),e),h.current.style.cursor=t.getCursor(f.state)};var d=!0,v=function(t,e,r){if(d){n=[t,e,r,];return}var i=f.props,o=i.onViewStateChange,a=i.onViewportChange;Object.defineProperty(t,"position",{get:function(){return[0,0,tq(f.map,t),]}}),o&&o({viewState:t,interactionState:e,oldViewState:r}),a&&a(t,e,r)};(0,c.useImperativeHandle)(e,function(){var t;return{getMap:(t=p).current&&t.current.getMap,queryRenderedFeatures:t.current&&t.current.queryRenderedFeatures}},[]);var g=(0,c.useMemo)(function(){return e6(e6({},s),{},{eventManager:l,container:s.container||h.current})},[s,h.current]);g.onViewportChange=v,g.viewport=s.viewport||tX(f),f.viewport=g.viewport;var m=function(t){var e=t.isDragging,n=void 0!==e&&e;if(n!==f.state.isDragging&&f.setState({isDragging:n}),d){a=t;return}var r=f.props.onInteractionStateChange;r&&r(t)},b=function(){f.width&&f.height&&u.setOptions(e6(e6(e6({},f.props),f.props.viewState),{},{isInteractive:Boolean(f.props.onViewStateChange||f.props.onViewportChange),onViewportChange:v,onStateChange:m,eventManager:l,width:f.width,height:f.height}))},y=function(t){var e=t.width,n=t.height;f.width=e,f.height=n,b(),f.props.onResize({width:e,height:n})};(0,c.useEffect)(function(){return l.setElement(h.current),l.on({pointerdown:ni.bind(f),pointermove:na.bind(f),pointerup:no.bind(f),pointerleave:nr.bind(f,"onMouseOut"),click:ns.bind(f),anyclick:ns.bind(f),dblclick:nr.bind(f,"onDblClick"),wheel:nr.bind(f,"onWheel"),contextmenu:nr.bind(f,"onContextMenu")}),function(){l.destroy()}},[]),tU(function(){if(n){var t;v.apply(void 0,function(t){if(Array.isArray(t))return i(t)}(t=n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}a&&m(a)}),b();var w=t.width,O=t.height,E=t.style,$=t.getCursor,P=(0,c.useMemo)(function(){return e6(e6({position:"relative"},E),{},{width:w,height:O,cursor:$(f.state)})},[E,w,O,$,f.state]);return n&&f._child||(f._child=c.createElement(tB,{value:g},c.createElement("div",{key:"event-canvas",ref:h,style:P},c.createElement(t0,r({},t,{width:"100%",height:"100%",style:null,onResize:y,ref:p}))))),d=!1,f._child});nc.supported=t0.supported,nc.propTypes=e7,nc.defaultProps=nt;var nu=nc;u.string.isRequired,u.string,u.oneOf(["fill","line","symbol","circle","fill-extrusion","raster","background","heatmap","hillshade","sky",]).isRequired,u.string,u.string,u.string;var nl={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},nh={captureScroll:u.bool,captureDrag:u.bool,captureClick:u.bool,captureDoubleClick:u.bool,capturePointerMove:u.bool};function np(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,c.useContext)(tZ),n=(0,c.useRef)(null),r=(0,c.useRef)({props:t,state:{},context:e,containerRef:n}).current;return r.props=t,r.context=e,(0,c.useEffect)(function(){return function(t){var e=t.containerRef.current,n=t.context.eventManager;if(e&&n){var r={wheel:function(e){var n=t.props;n.captureScroll&&e.stopPropagation(),n.onScroll&&n.onScroll(e,t)},panstart:function(e){var n=t.props;n.captureDrag&&e.stopPropagation(),n.onDragStart&&n.onDragStart(e,t)},anyclick:function(e){var n=t.props;n.captureClick&&e.stopPropagation(),n.onNativeClick&&n.onNativeClick(e,t)},click:function(e){var n=t.props;n.captureClick&&e.stopPropagation(),n.onClick&&n.onClick(e,t)},dblclick:function(e){var n=t.props;n.captureDoubleClick&&e.stopPropagation(),n.onDoubleClick&&n.onDoubleClick(e,t)},pointermove:function(e){var n=t.props;n.capturePointerMove&&e.stopPropagation(),n.onPointerMove&&n.onPointerMove(e,t)}};return n.watch(r,e),function(){n.off(r)}}}(r)},[e.eventManager]),r}function nf(t){var e=t.instance,n=np(t),r=n.context,i=n.containerRef;return e._context=r,e._containerRef=i,e._render()}var nd=function(t){t5(o,t);var e,n,i=(e=o,n=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(t){return!1}}(),function(){var t,r=t7(e);if(n){var i=t7(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return t6(this,t)});function o(){var t;tl(this,o);for(var e=arguments.length,n=Array(e),r=0;r2&&void 0!==arguments[2]?arguments[2]:"x";if(null===t)return e;var r="x"===n?t.offsetWidth:t.offsetHeight;return n$(e/100*r)/r*100};function nM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}var nj=Object.assign({},nm,{className:u.string,longitude:u.number.isRequired,latitude:u.number.isRequired,style:u.object}),nS=Object.assign({},nb,{className:""});function nT(t){var e,n,r,i,o,s,u,h,p=(e=t,r=(n=l((0,c.useState)(null),2))[0],i=n[1],s=(o=l((0,c.useState)(null),2))[0],u=o[1],(h=np(ng(ng({},e),{},{onDragStart:nO}))).callbacks=e,h.state.dragPos=r,h.state.setDragPos=i,h.state.dragOffset=s,h.state.setDragOffset=u,(0,c.useEffect)(function(){return function(t){var e=t.context.eventManager;if(e&&t.state.dragPos){var n={panmove:function(e){return function(t,e){var n=e.props,r=e.callbacks,i=e.state,o=e.context;t.stopPropagation();var a=ny(t);i.setDragPos(a);var s=i.dragOffset;if(r.onDrag&&s){var c=Object.assign({},t);c.lngLat=nw(a,s,n,o),r.onDrag(c)}}(e,t)},panend:function(e){return function(t,e){var n=e.props,r=e.callbacks,i=e.state,o=e.context;t.stopPropagation();var a=i.dragPos,s=i.dragOffset;if(i.setDragPos(null),i.setDragOffset(null),r.onDragEnd&&a&&s){var c=Object.assign({},t);c.lngLat=nw(a,s,n,o),r.onDragEnd(c)}}(e,t)},pancancel:function(e){var n,r;return n=e,r=t.state,void(n.stopPropagation(),r.setDragPos(null),r.setDragOffset(null))}};return e.watch(n),function(){e.off(n)}}}(h)},[h.context.eventManager,Boolean(r)]),h),f=p.state,d=p.containerRef,v=t.children,g=t.className,m=t.draggable,b=t.style,y=f.dragPos,w=function(t){var e=t.props,n=t.state,r=t.context,i=e.longitude,o=e.latitude,a=e.offsetLeft,s=e.offsetTop,c=n.dragPos,u=n.dragOffset,h=r.viewport,p=r.map;if(c&&u)return[c[0]+u[0],c[1]+u[1],];var f=tq(p,{longitude:i,latitude:o}),d=h.project([i,o,f,]),v=l(d,2),g=v[0],m=v[1];return[g+=a,m+=s]}(p),O=l(w,2),E=O[0],$=O[1],P="translate(".concat(n$(E),"px, ").concat(n$($),"px)"),M=m?y?"grabbing":"grab":"auto",j=(0,c.useMemo)(function(){var t=function(t){for(var e=1;e0){var g=p,m=v;for(p=0;p<=1;p+=.5)(v=Math.max(0,u-f)+Math.max(0,(d=(f=n-p*a)+a)-i+u))0){var E=h,$=O;for(h=0;h<=1;h+=b)(O=Math.max(0,u-y)+Math.max(0,(w=(y=e-h*o)+o)-r+u))<$&&($=O,E=h);h=E}return nx.find(function(t){var e=nk[t];return e.x===h&&e.y===p})||s}({x:E,y:$,anchor:P,padding:j,width:b.width,height:b.height,selfWidth:y.clientWidth,selfHeight:y.clientHeight}):P),H=(S=t,T=a,k=i.current,x=U,D=q,R=(C=l(x,3))[0],A=C[1],I=C[2],L=S.offsetLeft,N=S.offsetTop,z=S.sortByDepth,V=nP(k,-(100*(F=nk[D]).x)),B=nP(k,-(100*F.y),"y"),Z={position:"absolute",transform:"\n translate(".concat(V,"%, ").concat(B,"%)\n translate(").concat(n$(R+L),"px, ").concat(n$(A+N),"px)\n "),display:void 0,zIndex:void 0},z&&(I>1||I<-1||R<0||R>T.width||A<0||A>T.height?Z.display="none":Z.zIndex=Math.floor((1-I)/2*1e5)),Z),W=(0,c.useCallback)(function(t){n.props.onClose();var e=n.context.eventManager;e&&e.once("click",function(t){return t.stopPropagation()},t.target)},[]);return c.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(q," ").concat(u),style:H,ref:i},c.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:f}}),c.createElement("div",{key:"content",ref:e,className:"mapboxgl-popup-content"},d&&c.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:W},"\xd7"),v))}function nA(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}nR.propTypes=nD,nR.defaultProps=nC,c.memo(nR);var nI=Object.assign({},nh,{toggleLabel:u.string,className:u.string,style:u.object,compact:u.bool,customAttribution:u.oneOfType([u.string,u.arrayOf(u.string),])}),nL=Object.assign({},nl,{className:"",toggleLabel:"Toggle Attribution"});function nN(t){var e=np(t),n=e.context,r=e.containerRef,i=(0,c.useRef)(null),o=l((0,c.useState)(!1),2),s=o[0],u=o[1];(0,c.useEffect)(function(){var e,o,a,s,c,u;return n.map&&(e=(o={customAttribution:t.customAttribution},a=n.map,s=r.current,c=i.current,(u=new(tj()).AttributionControl(o))._map=a,u._container=s,u._innerContainer=c,u._updateAttributions(),u._updateEditLink(),a.on("styledata",u._updateData),a.on("sourcedata",u._updateData),u)),function(){var t;return e&&void((t=e)._map.off("styledata",t._updateData),t._map.off("sourcedata",t._updateData))}},[n.map]);var h=void 0===t.compact?n.viewport.width<=640:t.compact;(0,c.useEffect)(function(){!h&&s&&u(!1)},[h]);var p=(0,c.useCallback)(function(){return u(function(t){return!t})},[]),f=(0,c.useMemo)(function(){return function(t){for(var e=1;ea)return 1}return 0}(e.map.version,"1.6.0")>=0?2:1:2},[e.map]),r=e.viewport.bearing,i={transform:"rotate(".concat(-r,"deg)")},2===n?c.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:i}):c.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:i})))))}function n0(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}nQ.propTypes=nK,nQ.defaultProps=nG,c.memo(nQ);var n1=Object.assign({},nh,{className:u.string,style:u.object,maxWidth:u.number,unit:u.oneOf(["imperial","metric","nautical"])}),n2=Object.assign({},nl,{className:"",maxWidth:100,unit:"metric"});function n4(t){var e=np(t),n=e.context,r=e.containerRef,i=l((0,c.useState)(null),2),o=i[0],s=i[1];(0,c.useEffect)(function(){if(n.map){var t=new(tj()).ScaleControl;t._map=n.map,t._container=r.current,s(t)}},[n.map]),o&&(o.options=t,o._onMove());var u=(0,c.useMemo)(function(){return function(t){for(var e=1;e\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=i.console&&(i.console.warn||i.console.log);return o&&o.call(i.console,r,n),t.apply(this,arguments)}}c="function"!=typeof Object.assign?function(t){if(t===s||null===t)throw TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n-1}function T(t){return t.trim().split(/\s+/g)}function k(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var r=0;rk(i,a)&&r.push(t[o]),i[o]=a,o++}return n&&(r=e?r.sort(function(t,n){return t[e]>n[e]}):r.sort()),r}function C(t,e){for(var n,r,i=e[0].toUpperCase()+e.slice(1),o=0;o1&&!o.firstMultiple?o.firstMultiple=q(i):1===c&&(o.firstMultiple=!1),u=o.firstInput,h=(l=o.firstMultiple)?l.center:u.center,d=i.center=H(a),i.timeStamp=f(),i.deltaTime=i.timeStamp-u.timeStamp,i.angle=K(h,d),i.distance=X(h,d),v=o,m=(g=i).center,b=v.offsetDelta||{},y=v.prevDelta||{},w=v.prevInput||{},(1===g.eventType||4===w.eventType)&&(y=v.prevDelta={x:w.deltaX||0,y:w.deltaY||0},b=v.offsetDelta={x:m.x,y:m.y}),g.deltaX=y.x+(m.x-b.x),g.deltaY=y.y+(m.y-b.y),i.offsetDirection=Y(i.deltaX,i.deltaY),O=W(i.deltaTime,i.deltaX,i.deltaY),i.overallVelocityX=O.x,i.overallVelocityY=O.y,i.overallVelocity=p(O.x)>p(O.y)?O.x:O.y,i.scale=l?(E=l.pointers,X(($=a)[0],$[1],B)/X(E[0],E[1],B)):1,i.rotation=l?(P=l.pointers,K((M=a)[1],M[0],B)+K(P[1],P[0],B)):0,i.maxPointers=o.prevInput?i.pointers.length>o.prevInput.maxPointers?i.pointers.length:o.prevInput.maxPointers:i.pointers.length,function(t,e){var n,r,i,o,a=t.lastInterval||e,c=e.timeStamp-a.timeStamp;if(8!=e.eventType&&(c>25||s===a.velocity)){var u=e.deltaX-a.deltaX,l=e.deltaY-a.deltaY,h=W(c,u,l);r=h.x,i=h.y,n=p(h.x)>p(h.y)?h.x:h.y,o=Y(u,l),t.lastInterval=e}else n=a.velocity,r=a.velocityX,i=a.velocityY,o=a.direction;e.velocity=n,e.velocityX=r,e.velocityY=i,e.direction=o}(o,i),S=r.element,j(i.srcEvent.target,S)&&(S=i.srcEvent.target),i.target=S,t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function q(t){for(var e=[],n=0;n=p(e)?t<0?2:4:e<0?8:16}function X(t,e,n){n||(n=V);var r=e[n[0]]-t[n[0]],i=e[n[1]]-t[n[1]];return Math.sqrt(r*r+i*i)}function K(t,e,n){n||(n=V);var r=e[n[0]]-t[n[0]];return 180*Math.atan2(e[n[1]]-t[n[1]],r)/Math.PI}Z.prototype={handler:function(){},init:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(A(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&M(this.element,this.evEl,this.domHandler),this.evTarget&&M(this.target,this.evTarget,this.domHandler),this.evWin&&M(A(this.element),this.evWin,this.domHandler)}};var G={mousedown:1,mousemove:2,mouseup:4};function _(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,Z.apply(this,arguments)}w(_,Z,{handler:function(t){var e=G[t.type];1&e&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:F,srcEvent:t}))}});var J={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},Q={2:z,3:"pen",4:F,5:"kinect"},tt="pointerdown",te="pointermove pointerup pointercancel";function tn(){this.evEl=tt,this.evWin=te,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}i.MSPointerEvent&&!i.PointerEvent&&(tt="MSPointerDown",te="MSPointerMove MSPointerUp MSPointerCancel"),w(tn,Z,{handler:function(t){var e=this.store,n=!1,r=J[t.type.toLowerCase().replace("ms","")],i=Q[t.pointerType]||t.pointerType,o=k(e,t.pointerId,"pointerId");1&r&&(0===t.button||i==z)?o<0&&(e.push(t),o=e.length-1):12&r&&(n=!0),!(o<0)&&(e[o]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:i,srcEvent:t}),n&&e.splice(o,1))}});var tr={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function ti(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Z.apply(this,arguments)}function to(t,e){var n=x(t.touches),r=x(t.changedTouches);return 12&e&&(n=D(n.concat(r),"identifier",!0)),[n,r]}w(ti,Z,{handler:function(t){var e=tr[t.type];if(1===e&&(this.started=!0),this.started){var n=to.call(this,t,e);12&e&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:z,srcEvent:t})}}});var ta={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function ts(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},Z.apply(this,arguments)}function tc(t,e){var n=x(t.touches),r=this.targetIds;if(3&e&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=x(t.changedTouches),s=[],c=this.target;if(o=n.filter(function(t){return j(t.target,c)}),1===e)for(i=0;i-1&&r.splice(t,1)},2500)}}function tp(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,r=0;r-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,n=this.state;function r(n){e.manager.emit(n,t)}n<8&&r(e.options.event+tP(n)),r(e.options.event),t.additionalEvent&&r(t.additionalEvent),n>=8&&r(e.options.event+tP(n))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=32},canEmit:function(){for(var t=0;te.threshold&&i&e.direction},attrTest:function(t){return tS.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=tM(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),w(tk,tS,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[tb]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),w(tx,t$,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[tg]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distancee.time;if(this._input=t,r&&n&&(!(12&t.eventType)||i)){if(1&t.eventType)this.reset(),this._timer=d(function(){this.state=8,this.tryEmit()},e.time,this);else if(4&t.eventType)return 8}else this.reset();return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&4&t.eventType?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=f(),this.manager.emit(this.options.event,this._input)))}}),w(tD,tS,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[tb]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),w(tC,tS,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return tT.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return 30&n?e=t.overallVelocity:6&n?e=t.overallVelocityX:24&n&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&p(e)>this.options.velocity&&4&t.eventType},emit:function(t){var e=tM(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),w(tR,t$,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tm]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distance1)for(var n=1;nt.length)&&(e=t.length);for(var n=0,r=Array(e);nn?n:t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),te=new h(4),h!=Float32Array&&(te[0]=0,te[1]=0,te[2]=0,te[3]=0);const m=Math.log2||function(t){return Math.log(t)*Math.LOG2E};function b(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],u=e[6],l=e[7],h=e[8],p=e[9],f=e[10],d=e[11],v=e[12],g=e[13],m=e[14],b=e[15],y=n[0],w=n[1],O=n[2],E=n[3];return t[0]=y*r+w*s+O*h+E*v,t[1]=y*i+w*c+O*p+E*g,t[2]=y*o+w*u+O*f+E*m,t[3]=y*a+w*l+O*d+E*b,y=n[4],w=n[5],O=n[6],E=n[7],t[4]=y*r+w*s+O*h+E*v,t[5]=y*i+w*c+O*p+E*g,t[6]=y*o+w*u+O*f+E*m,t[7]=y*a+w*l+O*d+E*b,y=n[8],w=n[9],O=n[10],E=n[11],t[8]=y*r+w*s+O*h+E*v,t[9]=y*i+w*c+O*p+E*g,t[10]=y*o+w*u+O*f+E*m,t[11]=y*a+w*l+O*d+E*b,y=n[12],w=n[13],O=n[14],E=n[15],t[12]=y*r+w*s+O*h+E*v,t[13]=y*i+w*c+O*p+E*g,t[14]=y*o+w*u+O*f+E*m,t[15]=y*a+w*l+O*d+E*b,t}function y(t,e,n){var r,i,o,a,s,c,u,l,h,p,f,d,v=n[0],g=n[1],m=n[2];return e===t?(t[12]=e[0]*v+e[4]*g+e[8]*m+e[12],t[13]=e[1]*v+e[5]*g+e[9]*m+e[13],t[14]=e[2]*v+e[6]*g+e[10]*m+e[14],t[15]=e[3]*v+e[7]*g+e[11]*m+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],u=e[6],l=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=c,t[6]=u,t[7]=l,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=r*v+s*g+h*m+e[12],t[13]=i*v+c*g+p*m+e[13],t[14]=o*v+u*g+f*m+e[14],t[15]=a*v+l*g+d*m+e[15]),t}function w(t,e,n){var r=n[0],i=n[1],o=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function O(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],c=t[6],u=t[7],l=t[8],h=t[9],p=t[10],f=t[11],d=t[12],v=t[13],g=t[14],m=t[15],b=e[0],y=e[1],w=e[2],O=e[3],E=e[4],$=e[5],P=e[6],M=e[7],j=e[8],S=e[9],T=e[10],k=e[11],x=e[12],D=e[13],C=e[14],R=e[15];return Math.abs(n-b)<=1e-6*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-w)<=1e-6*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(o-O)<=1e-6*Math.max(1,Math.abs(o),Math.abs(O))&&Math.abs(a-E)<=1e-6*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(s-$)<=1e-6*Math.max(1,Math.abs(s),Math.abs($))&&Math.abs(c-P)<=1e-6*Math.max(1,Math.abs(c),Math.abs(P))&&Math.abs(u-M)<=1e-6*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(l-j)<=1e-6*Math.max(1,Math.abs(l),Math.abs(j))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(p-T)<=1e-6*Math.max(1,Math.abs(p),Math.abs(T))&&Math.abs(f-k)<=1e-6*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(d-x)<=1e-6*Math.max(1,Math.abs(d),Math.abs(x))&&Math.abs(v-D)<=1e-6*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(g-C)<=1e-6*Math.max(1,Math.abs(g),Math.abs(C))&&Math.abs(m-R)<=1e-6*Math.max(1,Math.abs(m),Math.abs(R))}function E(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t}function $(t,e,n,r){var i=e[0],o=e[1];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t}function P(t,e){if(!t)throw Error(e||"@math.gl/web-mercator: assertion failed.")}tn=new h(2),h!=Float32Array&&(tn[0]=0,tn[1]=0),tr=new h(3),h!=Float32Array&&(tr[0]=0,tr[1]=0,tr[2]=0);const M=Math.PI,j=M/4,S=M/180,T=180/M;function k(t){return Math.pow(2,t)}function x([t,e]){P(Number.isFinite(t)),P(Number.isFinite(e)&&e>=-90&&e<=90,"invalid latitude");const n=512*(M+Math.log(Math.tan(j+.5*(e*S))))/(2*M);return[512*(t*S+M)/(2*M),n]}function D([t,e]){const n=2*(Math.atan(Math.exp(e/512*(2*M)-M))-j);return[(t/512*(2*M)-M)*T,n*T,]}function C(t){return 2*Math.atan(.5/t)*T}function R(t){return .5/Math.tan(.5*t*S)}function A(t,e,n=0){const[r,i,o]=t;if(P(Number.isFinite(r)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(o)){const a=f(e,[r,i,o,1,]);return a}const s=f(e,[r,i,0,1,]),c=f(e,[r,i,1,1,]),u=s[2],l=c[2];return $([],s,c,u===l?0:((n||0)-u)/(l-u))}const I=Math.PI/180;function L(t,e,n){const{pixelUnprojectionMatrix:r}=t,i=f(r,[e,0,1,1,]),o=f(r,[e,t.height,1,1,]),a=n*t.distanceScales.unitsPerMeter[2],s=(a-i[2])/(o[2]-i[2]),c=$([],i,o,s),u=D(c);return u[2]=n,u}class N{constructor({width:t,height:e,latitude:n=0,longitude:r=0,zoom:i=0,pitch:o=0,bearing:a=0,altitude:s=null,fovy:c=null,position:u=null,nearZMultiplier:l=.02,farZMultiplier:h=1.01}={width:1,height:1}){t=t||1,e=e||1,null===c&&null===s?c=C(s=1.5):null===c?c=C(s):null===s&&(s=R(c));const f=k(i);s=Math.max(.75,s);const d=function({latitude:t,longitude:e,highPrecision:n=!1}){P(Number.isFinite(t)&&Number.isFinite(e));const r={},i=Math.cos(t*S),o=512/360,a=o/i,s=512/4003e4/i;if(r.unitsPerMeter=[s,s,s,],r.metersPerUnit=[1/s,1/s,1/s,],r.unitsPerDegree=[o,a,s,],r.degreesPerUnit=[1/o,1/a,1/s,],n){const c=S*Math.tan(t*S)/i,u=512/4003e4*c,l=u/a*s;r.unitsPerDegree2=[0,o*c/2,u,],r.unitsPerMeter2=[l,0,l,]}return r}({longitude:r,latitude:n}),v=x([r,n]);if(v[2]=0,u){var g,m,b,O,E,$;O=v,E=v,$=(g=[],m=u,b=d.unitsPerMeter,g[0]=m[0]*b[0],g[1]=m[1]*b[1],g[2]=m[2]*b[2],g),O[0]=E[0]+$[0],O[1]=E[1]+$[1],O[2]=E[2]+$[2]}this.projectionMatrix=function({width:t,height:e,pitch:n,altitude:r,fovy:i,nearZMultiplier:o,farZMultiplier:a}){var s,c,u,l,h,p,f;const{fov:d,aspect:v,near:g,far:m}=function({width:t,height:e,fovy:n=C(1.5),altitude:r,pitch:i=0,nearZMultiplier:o=1,farZMultiplier:a=1}){void 0!==r&&(n=C(r));const s=.5*n*S,c=R(n),u=i*S,l=Math.sin(s)*c/Math.sin(Math.min(Math.max(Math.PI/2-u-s,.01),Math.PI-.01)),h=Math.sin(u)*l+c;return{fov:2*s,aspect:t/e,focalDistance:c,near:o,far:h*a}}({width:t,height:e,altitude:r,fovy:i,pitch:n,nearZMultiplier:o,farZMultiplier:a}),b=(s=[],c=d,u=v,l=g,h=m,f=1/Math.tan(c/2),s[0]=f/u,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=f,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=-1,s[12]=0,s[13]=0,s[15]=0,null!=h&&h!==1/0?(p=1/(l-h),s[10]=(h+l)*p,s[14]=2*h*l*p):(s[10]=-1,s[14]=-2*l),s);return b}({width:t,height:e,pitch:o,fovy:c,nearZMultiplier:l,farZMultiplier:h}),this.viewMatrix=function({height:t,pitch:e,bearing:n,altitude:r,scale:i,center:o=null}){var a,s,c,u,l,h,f,d,v,g,m,b,O,E,$,P,M,j,T,k,x,D,C,R,A,I,L,N;const z=p();return y(z,z,[0,0,-r]),a=z,s=z,u=Math.sin(c=-e*S),l=Math.cos(c),h=s[4],f=s[5],d=s[6],v=s[7],g=s[8],m=s[9],b=s[10],O=s[11],s!==a&&(a[0]=s[0],a[1]=s[1],a[2]=s[2],a[3]=s[3],a[12]=s[12],a[13]=s[13],a[14]=s[14],a[15]=s[15]),a[4]=h*l+g*u,a[5]=f*l+m*u,a[6]=d*l+b*u,a[7]=v*l+O*u,a[8]=g*l-h*u,a[9]=m*l-f*u,a[10]=b*l-d*u,a[11]=O*l-v*u,E=z,$=z,M=Math.sin(P=n*S),j=Math.cos(P),T=$[0],k=$[1],x=$[2],D=$[3],C=$[4],R=$[5],A=$[6],I=$[7],$!==E&&(E[8]=$[8],E[9]=$[9],E[10]=$[10],E[11]=$[11],E[12]=$[12],E[13]=$[13],E[14]=$[14],E[15]=$[15]),E[0]=T*j+C*M,E[1]=k*j+R*M,E[2]=x*j+A*M,E[3]=D*j+I*M,E[4]=C*j-T*M,E[5]=R*j-k*M,E[6]=A*j-x*M,E[7]=I*j-D*M,w(z,z,[i/=t,i,i]),o&&y(z,z,(L=[],N=o,L[0]=-N[0],L[1]=-N[1],L[2]=-N[2],L)),z}({height:e,scale:f,center:v,pitch:o,bearing:a,altitude:s}),this.width=t,this.height=e,this.scale=f,this.latitude=n,this.longitude=r,this.zoom=i,this.pitch=o,this.bearing=a,this.altitude=s,this.fovy=c,this.center=v,this.meterOffset=u||[0,0,0],this.distanceScales=d,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 t,e,n,r,i,o,a,s,c,u,l,h,f,d,v,g,m,O,E,$,P,M,j,S,T,k,x,D,C,R,A;const{width:I,height:L,projectionMatrix:N,viewMatrix:z}=this,F=p();b(F,F,N),b(F,F,z),this.viewProjectionMatrix=F;const V=p();w(V,V,[I/2,-L/2,1]),y(V,V,[1,-1,0]),b(V,V,F);const B=(t=p(),n=(e=V)[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],u=e[7],l=e[8],h=e[9],f=e[10],d=e[11],v=e[12],g=e[13],m=e[14],O=e[15],E=n*s-r*a,$=n*c-i*a,P=n*u-o*a,M=r*c-i*s,j=r*u-o*s,S=i*u-o*c,T=l*g-h*v,k=l*m-f*v,x=l*O-d*v,D=h*m-f*g,C=h*O-d*g,(A=E*(R=f*O-d*m)-$*C+P*D+M*x-j*k+S*T)?(A=1/A,t[0]=(s*R-c*C+u*D)*A,t[1]=(i*C-r*R-o*D)*A,t[2]=(g*S-m*j+O*M)*A,t[3]=(f*j-h*S-d*M)*A,t[4]=(c*x-a*R-u*k)*A,t[5]=(n*R-i*x+o*k)*A,t[6]=(m*P-v*S-O*$)*A,t[7]=(l*S-f*P+d*$)*A,t[8]=(a*C-s*x+u*T)*A,t[9]=(r*x-n*C-o*T)*A,t[10]=(v*j-g*P+O*E)*A,t[11]=(h*P-l*j-d*E)*A,t[12]=(s*k-a*D-c*T)*A,t[13]=(n*D-r*k+i*T)*A,t[14]=(g*$-v*M-m*E)*A,t[15]=(l*M-h*$+f*E)*A,t):null);if(!B)throw Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=V,this.pixelUnprojectionMatrix=B}equals(t){return t instanceof N&&t.width===this.width&&t.height===this.height&&O(t.projectionMatrix,this.projectionMatrix)&&O(t.viewMatrix,this.viewMatrix)}project(t,{topLeft:e=!0}={}){const n=this.projectPosition(t),r=function(t,e){const[n,r,i=0]=t;return P(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i)),f(e,[n,r,i,1])}(n,this.pixelProjectionMatrix),[i,o]=r,a=e?o:this.height-o;return 2===t.length?[i,a]:[i,a,r[2]]}unproject(t,{topLeft:e=!0,targetZ:n}={}){const[r,i,o]=t,a=e?i:this.height-i,s=n&&n*this.distanceScales.unitsPerMeter[2],c=A([r,a,o],this.pixelUnprojectionMatrix,s),[u,l,h]=this.unprojectPosition(c);return Number.isFinite(o)?[u,l,h]:Number.isFinite(n)?[u,l,n]:[u,l]}projectPosition(t){const[e,n]=x(t),r=(t[2]||0)*this.distanceScales.unitsPerMeter[2];return[e,n,r]}unprojectPosition(t){const[e,n]=D(t),r=(t[2]||0)*this.distanceScales.metersPerUnit[2];return[e,n,r]}projectFlat(t){return x(t)}unprojectFlat(t){return D(t)}getMapCenterByLngLatPosition({lngLat:t,pos:e}){var n,r;const i=A(e,this.pixelUnprojectionMatrix),o=x(t),a=E([],o,(n=[],r=i,n[0]=-r[0],n[1]=-r[1],n)),s=E([],this.center,a);return D(s)}getLocationAtPoint({lngLat:t,pos:e}){return this.getMapCenterByLngLatPosition({lngLat:t,pos:e})}fitBounds(t,e={}){const{width:n,height:r}=this,{longitude:i,latitude:o,zoom:a}=function({width:t,height:e,bounds:n,minExtent:r=0,maxZoom:i=24,padding:o=0,offset:a=[0,0]}){const[[s,c],[u,l]]=n;if(Number.isFinite(o)){const h=o;o={top:h,bottom:h,left:h,right:h}}else P(Number.isFinite(o.top)&&Number.isFinite(o.bottom)&&Number.isFinite(o.left)&&Number.isFinite(o.right));const p=x([s,g(l,-85.051129,85.051129),]),f=x([u,g(c,-85.051129,85.051129),]),d=[Math.max(Math.abs(f[0]-p[0]),r),Math.max(Math.abs(f[1]-p[1]),r),],v=[t-o.left-o.right-2*Math.abs(a[0]),e-o.top-o.bottom-2*Math.abs(a[1]),];P(v[0]>0&&v[1]>0);const b=v[0]/d[0],y=v[1]/d[1],w=(o.right-o.left)/2/b,O=(o.bottom-o.top)/2/y,E=[(f[0]+p[0])/2+w,(f[1]+p[1])/2+O,],$=D(E),M=Math.min(i,m(Math.abs(Math.min(b,y))));return P(Number.isFinite(M)),{longitude:$[0],latitude:$[1],zoom:M}}(Object.assign({width:n,height:r,bounds:t},e));return new N({width:n,height:r,longitude:i,latitude:o,zoom:a})}getBounds(t){const e=this.getBoundingRegion(t),n=Math.min(...e.map(t=>t[0])),r=Math.max(...e.map(t=>t[0])),i=Math.min(...e.map(t=>t[1])),o=Math.max(...e.map(t=>t[1]));return[[n,i],[r,o],]}getBoundingRegion(t={}){return function(t,e=0){const{width:n,height:r,unproject:i}=t,o={targetZ:e},a=i([0,r],o),s=i([n,r],o);let c,u;const l=t.fovy?.5*t.fovy*I:Math.atan(.5/t.altitude),h=(90-t.pitch)*I;return l>h-.01?(c=L(t,0,e),u=L(t,n,e)):(c=i([0,0],o),u=i([n,0],o)),[a,s,u,c]}(this,t.z||0)}}const z=["longitude","latitude","zoom"],F={curve:1.414,speed:1.2};function V(t,e,n){var r,i,o,a;n=Object.assign({},F,n);const s=n.curve,c=t.zoom,u=[t.longitude,t.latitude],l=k(c),h=e.zoom,p=[e.longitude,e.latitude],f=k(h-c),d=x(u),v=x(p),g=(r=[],i=v,o=d,r[0]=i[0]-o[0],r[1]=i[1]-o[1],r),m=Math.max(t.width,t.height),b=m/f,y=Math.hypot((a=g)[0],a[1])*l,w=Math.max(y,.01),O=s*s,E=(b*b-m*m+O*O*w*w)/(2*m*O*w),$=(b*b-m*m-O*O*w*w)/(2*b*O*w),P=Math.log(Math.sqrt(E*E+1)-E),M=Math.log(Math.sqrt($*$+1)-$);return{startZoom:c,startCenterXY:d,uDelta:g,w0:m,u1:y,S:(M-P)/s,rho:s,rho2:O,r0:P,r1:M}}var B=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,r){return t[0]===e&&(n=r,!0)}),n}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),r=this.__entries__[n];return r&&r[1]},e.prototype.set=function(e,n){var r=t(this.__entries__,e);~r?this.__entries__[r][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,r=t(n,e);~r&&n.splice(r,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n0},t.prototype.connect_=function(){Z&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),W?(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)},t.prototype.disconnect_=function(){Z&&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)},t.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e;H.some(function(t){return!!~n.indexOf(t)})&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),X=function(t,e){for(var n=0,r=Object.keys(e);n0},t}(),ts="undefined"!=typeof WeakMap?new WeakMap:new B,tc=function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function.");if(!arguments.length)throw TypeError("1 argument required, but only 0 present.");var n=Y.getInstance(),r=new ta(e,n,this);ts.set(this,r)};["observe","unobserve","disconnect"].forEach(function(t){tc.prototype[t]=function(){var e;return(e=ts.get(this))[t].apply(e,arguments)}});var tu=void 0!==U.ResizeObserver?U.ResizeObserver:tc;function tl(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}function th(t,e){for(var n=0;n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function tm(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n1&&void 0!==arguments[1]?arguments[1]:"component";t.debug&&u.checkPropTypes(tO,t,"prop",e)}var tP=function(){function t(e){var n=this;if(tl(this,t),a(this,"props",tE),a(this,"width",0),a(this,"height",0),a(this,"_fireLoadEvent",function(){n.props.onLoad({type:"load",target:n._map})}),a(this,"_handleError",function(t){n.props.onError(t)}),!e.mapboxgl)throw Error("Mapbox not available");this.mapboxgl=e.mapboxgl,t.initialized||(t.initialized=!0,this._checkStyleSheet(this.mapboxgl.version)),this._initialize(e)}return tp(t,[{key:"finalize",value:function(){return this._destroy(),this}},{key:"setProps",value:function(t){return this._update(this.props,t),this}},{key:"redraw",value:function(){var t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}},{key:"getMap",value:function(){return this._map}},{key:"_reuse",value:function(e){this._map=t.savedMap;var n=this._map.getContainer(),r=e.container;for(r.classList.add("mapboxgl-map");n.childNodes.length>0;)r.appendChild(n.childNodes[0]);this._map._container=r,t.savedMap=null,e.mapStyle&&this._map.setStyle(ty(e.mapStyle),{diff:!1}),this._map.isStyleLoaded()?this._fireLoadEvent():this._map.once("styledata",this._fireLoadEvent)}},{key:"_create",value:function(e){if(e.reuseMaps&&t.savedMap)this._reuse(e);else{if(e.gl){var n=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(){return HTMLCanvasElement.prototype.getContext=n,e.gl}}var r={container:e.container,center:[0,0],zoom:8,pitch:0,bearing:0,maxZoom:24,style:ty(e.mapStyle),interactive:!1,trackResize:!1,attributionControl:e.attributionControl,preserveDrawingBuffer:e.preserveDrawingBuffer};e.transformRequest&&(r.transformRequest=e.transformRequest),this._map=new this.mapboxgl.Map(Object.assign({},r,e.mapOptions)),this._map.once("load",this._fireLoadEvent),this._map.on("error",this._handleError)}return this}},{key:"_destroy",value:function(){this._map&&(this.props.reuseMaps&&!t.savedMap?(t.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(t){var e=this;t=Object.assign({},tE,t),t$(t,"Mapbox"),this.mapboxgl.accessToken=t.mapboxApiAccessToken||tE.mapboxApiAccessToken,this.mapboxgl.baseApiUrl=t.mapboxApiUrl,this._create(t);var n=t.container;Object.defineProperty(n,"offsetWidth",{configurable:!0,get:function(){return e.width}}),Object.defineProperty(n,"clientWidth",{configurable:!0,get:function(){return e.width}}),Object.defineProperty(n,"offsetHeight",{configurable:!0,get:function(){return e.height}}),Object.defineProperty(n,"clientHeight",{configurable:!0,get:function(){return e.height}});var r=this._map.getCanvas();r&&(r.style.outline="none"),this._updateMapViewport({},t),this._updateMapSize({},t),this.props=t}},{key:"_update",value:function(t,e){if(this._map){t$(e=Object.assign({},this.props,e),"Mapbox");var n=this._updateMapViewport(t,e),r=this._updateMapSize(t,e);this._updateMapStyle(t,e),!e.asyncRender&&(n||r)&&this.redraw(),this.props=e}}},{key:"_updateMapStyle",value:function(t,e){t.mapStyle!==e.mapStyle&&this._map.setStyle(ty(e.mapStyle),{diff:!e.preventStyleDiffing})}},{key:"_updateMapSize",value:function(t,e){var n=t.width!==e.width||t.height!==e.height;return n&&(this.width=e.width,this.height=e.height,this._map.resize()),n}},{key:"_updateMapViewport",value:function(t,e){var n=this._getViewState(t),r=this._getViewState(e),i=r.latitude!==n.latitude||r.longitude!==n.longitude||r.zoom!==n.zoom||r.pitch!==n.pitch||r.bearing!==n.bearing||r.altitude!==n.altitude;return i&&(this._map.jumpTo(this._viewStateToMapboxProps(r)),r.altitude!==n.altitude&&(this._map.transform.altitude=r.altitude)),i}},{key:"_getViewState",value:function(t){var e=t.viewState||t,n=e.longitude,r=e.latitude,i=e.zoom,o=e.pitch,a=e.bearing,s=e.altitude;return{longitude:n,latitude:r,zoom:i,pitch:void 0===o?0:o,bearing:void 0===a?0:a,altitude:void 0===s?1.5:s}}},{key:"_checkStyleSheet",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"0.47.0";if(void 0!==tf)try{var e=tf.createElement("div");if(e.className="mapboxgl-map",e.style.display="none",tf.body.appendChild(e),!("static"!==window.getComputedStyle(e).position)){var n=tf.createElement("link");n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("href","https://api.tiles.mapbox.com/mapbox-gl-js/v".concat(t,"/mapbox-gl.css")),tf.head.appendChild(n)}}catch(r){}}},{key:"_viewStateToMapboxProps",value:function(t){return{center:[t.longitude,t.latitude,],zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}}},]),t}();a(tP,"initialized",!1),a(tP,"propTypes",tO),a(tP,"defaultProps",tE),a(tP,"savedMap",null);var tM=n(6158),tj=n.n(tM);function tS(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function tT(t,e){if(t===e)return!0;if(tS(t)&&tS(e)){if(t.length!==e.length)return!1;for(var n=0;n=Math.abs(t-e)}function tk(t,e,n){return Math.max(e,Math.min(n,t))}function tx(t,e,n){return tS(t)?t.map(function(t,r){return tx(t,e[r],n)}):n*e+(1-n)*t}function tD(t,e){if(!t)throw Error(e||"react-map-gl: assertion failed.")}function tC(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function tR(t){for(var e=1;e0,"`scale` must be a positive number");var i=this._state,o=i.startZoom,a=i.startZoomLngLat;Number.isFinite(o)||(o=this._viewportProps.zoom,a=this._unproject(n)||this._unproject(e)),tD(a,"`startZoomLngLat` prop is required for zoom behavior to calculate where to position the map.");var s=this._calculateNewZoom({scale:r,startZoom:o||0}),c=new N(Object.assign({},this._viewportProps,{zoom:s})).getMapCenterByLngLatPosition({lngLat:a,pos:e}),u=l(c,2),h=u[0],p=u[1];return this._getUpdatedMapState({zoom:s,longitude:h,latitude:p})}},{key:"zoomEnd",value:function(){return this._getUpdatedMapState({startZoomLngLat:null,startZoom:null})}},{key:"_getUpdatedMapState",value:function(e){return new t(Object.assign({},this._viewportProps,this._state,e))}},{key:"_applyConstraints",value:function(t){var e=t.maxZoom,n=t.minZoom,r=t.zoom;t.zoom=tk(r,n,e);var i=t.maxPitch,o=t.minPitch,a=t.pitch;return t.pitch=tk(a,o,i),Object.assign(t,function({width:t,height:e,longitude:n,latitude:r,zoom:i,pitch:o=0,bearing:a=0}){(n<-180||n>180)&&(n=d(n+180,360)-180),(a<-180||a>180)&&(a=d(a+180,360)-180);const s=m(e/512);if(i<=s)i=s,r=0;else{const c=e/2/Math.pow(2,i),u=D([0,c])[1];if(rl&&(r=l)}}return{width:t,height:e,longitude:n,latitude:r,zoom:i,pitch:o,bearing:a}}(t)),t}},{key:"_unproject",value:function(t){var e=new N(this._viewportProps);return t&&e.unproject(t)}},{key:"_calculateNewLngLat",value:function(t){var e=t.startPanLngLat,n=t.pos;return new N(this._viewportProps).getMapCenterByLngLatPosition({lngLat:e,pos:n})}},{key:"_calculateNewZoom",value:function(t){var e=t.scale,n=t.startZoom,r=this._viewportProps,i=r.maxZoom;return tk(n+Math.log2(e),r.minZoom,i)}},{key:"_calculateNewPitchAndBearing",value:function(t){var e=t.deltaScaleX,n=t.deltaScaleY,r=t.startBearing,i=t.startPitch;n=tk(n,-1,1);var o=this._viewportProps,a=o.minPitch,s=o.maxPitch,c=i;return n>0?c=i+n*(s-i):n<0&&(c=i-n*(a-i)),{pitch:c,bearing:r+180*e}}},{key:"_getRotationParams",value:function(t,e){var n=t[0]-e[0],r=t[1]-e[1],i=t[1],o=e[1],a=this._viewportProps,s=a.width,c=a.height,u=0;return r>0?Math.abs(c-o)>5&&(u=r/(o-c)*1.2):r<0&&o>5&&(u=1-i/o),{deltaScaleX:n/s,deltaScaleY:u=Math.min(1,Math.max(-1,u))}}},]),t}();function tN(t){return t[0].toLowerCase()+t.slice(1)}function tz(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function tF(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},r=t.current&&t.current.getMap();return r&&r.queryRenderedFeatures(e,n)}}},[]);var g=(0,c.useCallback)(function(t){var e=t.target;e===f.current&&e.scrollTo(0,0)},[]),m=v&&c.createElement(tB,{value:tW(tW({},d),{},{viewport:d.viewport||tX(tW({map:v,props:t},a)),map:v,container:d.container||p.current})},c.createElement("div",{key:"map-overlays",className:"overlays",ref:f,style:tK,onScroll:g},t.children)),b=t.className,y=t.width,w=t.height,O=t.style,E=t.visibilityConstraints,$=Object.assign({position:"relative"},O,{width:y,height:w}),P=t.visible&&function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tA;for(var n in e){var r=n.slice(0,3),i=tN(n.slice(3));if("min"===r&&t[i]e[n])return!1}return!0}(t.viewState||t,E),M=Object.assign({},tK,{visibility:P?"inherit":"hidden"});return c.createElement("div",{key:"map-container",ref:p,style:$},c.createElement("div",{key:"map-mapbox",ref:h,style:M,className:b}),m,!r&&!t.disableTokenWarning&&c.createElement(tJ,null))});tQ.supported=function(){return tj()&&tj().supported()},tQ.propTypes=tG,tQ.defaultProps=t_;var t0=tQ;function t1(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}(this.propNames||[]);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(!tT(t[i],e[i]))return!1}}catch(o){r.e(o)}finally{r.f()}return!0}},{key:"initializeProps",value:function(t,e){return{start:t,end:e}}},{key:"interpolateProps",value:function(t,e,n){tD(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(t,e){return e.transitionDuration}},]),t}();function t4(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function t3(t,e){return(t3=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function t5(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&t3(t,e)}function t8(t){return(t8="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function t6(t,e){if(e&&("object"===t8(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return t4(t)}function t7(t){return(t7=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var t9={longitude:1,bearing:1};function et(t){return Number.isFinite(t)||Array.isArray(t)}function ee(t,e,n){return t in t9&&Math.abs(n-e)>180&&(n=n<0?n+360:n-360),n}function en(t,e){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return er(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return er(t,e)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function er(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o,a=!0,s=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==i.return||i.return()}finally{if(s)throw o}}}}function eu(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n0&&void 0!==arguments[0]?arguments[0]:{};return tl(this,i),a(t4(t=r.call(this)),"propNames",ei),t.props=Object.assign({},es,e),t}return tp(i,[{key:"initializeProps",value:function(t,e){var n,r={},i={},o=en(eo);try{for(o.s();!(n=o.n()).done;){var a=n.value,s=t[a],c=e[a];tD(et(s)&&et(c),"".concat(a," must be supplied for transition")),r[a]=s,i[a]=ee(a,s,c)}}catch(u){o.e(u)}finally{o.f()}var l,h=en(ea);try{for(h.s();!(l=h.n()).done;){var p=l.value,f=t[p]||0,d=e[p]||0;r[p]=f,i[p]=ee(p,f,d)}}catch(v){h.e(v)}finally{h.f()}return{start:r,end:i}}},{key:"interpolateProps",value:function(t,e,n){var r,i=function(t,e,n,r={}){var i,o,a;const s={},{startZoom:c,startCenterXY:u,uDelta:l,w0:h,u1:p,S:f,rho:d,rho2:g,r0:b}=V(t,e,r);if(p<.01){for(const y of z){const w=t[y],O=e[y];s[y]=v(w,O,n)}return s}const $=n*f,P=Math.cosh(b)/Math.cosh(b+d*$),M=h*((Math.cosh(b)*Math.tanh(b+d*$)-Math.sinh(b))/g)/p,j=c+m(1/P),S=(i=[],o=l,a=M,i[0]=o[0]*a,i[1]=o[1]*a,i);E(S,S,u);const T=D(S);return s.longitude=T[0],s.latitude=T[1],s.zoom=j,s}(t,e,n,this.props),o=en(ea);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tx(t[a],e[a],n)}}catch(s){o.e(s)}finally{o.f()}return i}},{key:"getDuration",value:function(t,e){var n=e.transitionDuration;return"auto"===n&&(n=function(t,e,n={}){n=Object.assign({},F,n);const{screenSpeed:r,speed:i,maxDuration:o}=n,{S:a,rho:s}=V(t,e,n),c=1e3*a;let u;return u=Number.isFinite(r)?c/(r/s):c/i,Number.isFinite(o)&&u>o?0:u}(t,e,this.props)),n}},]),i}(t2);var el=["longitude","latitude","zoom","bearing","pitch",],eh=function(t){t5(i,t);var e,n,r=(e=i,n=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(t){return!1}}(),function(){var t,r=t7(e);if(n){var i=t7(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return t6(this,t)});function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return tl(this,i),t=r.call(this),Array.isArray(e)&&(e={transitionProps:e}),t.propNames=e.transitionProps||el,e.around&&(t.around=e.around),t}return tp(i,[{key:"initializeProps",value:function(t,e){var n={},r={};if(this.around){n.around=this.around;var i=new N(t).unproject(this.around);Object.assign(r,e,{around:new N(e).project(i),aroundLngLat:i})}var o,a=ec(this.propNames);try{for(a.s();!(o=a.n()).done;){var s=o.value,c=t[s],u=e[s];tD(et(c)&&et(u),"".concat(s," must be supplied for transition")),n[s]=c,r[s]=ee(s,c,u)}}catch(l){a.e(l)}finally{a.f()}return{start:n,end:r}}},{key:"interpolateProps",value:function(t,e,n){var r,i={},o=ec(this.propNames);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tx(t[a],e[a],n)}}catch(s){o.e(s)}finally{o.f()}if(e.around){var c=new N(Object.assign({},e,i)).getMapCenterByLngLatPosition({lngLat:e.aroundLngLat,pos:tx(t.around,e.around,n)}),u=l(c,2),h=u[0],p=u[1];i.longitude=h,i.latitude=p}return i}},]),i}(t2),ep=function(){},ef={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},ed={transitionDuration:0,transitionEasing:function(t){return t},transitionInterpolator:new eh,transitionInterruption:ef.BREAK,onTransitionStart:ep,onTransitionInterrupt:ep,onTransitionEnd:ep},ev=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tl(this,t),a(this,"_animationFrame",null),a(this,"_onTransitionFrame",function(){e._animationFrame=requestAnimationFrame(e._onTransitionFrame),e._updateViewport()}),this.props=null,this.onViewportChange=n.onViewportChange||ep,this.onStateChange=n.onStateChange||ep,this.time=n.getTime||Date.now}return tp(t,[{key:"getViewportInTransition",value:function(){return this._animationFrame?this.state.propsInTransition:null}},{key:"processViewportChange",value:function(t){var e=this.props;if(this.props=t,!e||this._shouldIgnoreViewportChange(e,t))return!1;if(this._isTransitionEnabled(t)){var n=Object.assign({},e),r=Object.assign({},t);if(this._isTransitionInProgress()&&(e.onTransitionInterrupt(),this.state.interruption===ef.SNAP_TO_END?Object.assign(n,this.state.endProps):Object.assign(n,this.state.propsInTransition),this.state.interruption===ef.UPDATE)){var i,o,a,s=this.time(),c=(s-this.state.startTime)/this.state.duration;r.transitionDuration=this.state.duration-(s-this.state.startTime),r.transitionEasing=(a=(i=this.state.easing)(o=c),function(t){return 1/(1-a)*(i(t*(1-o)+o)-a)}),r.transitionInterpolator=n.transitionInterpolator}return r.onTransitionStart(),this._triggerTransition(n,r),!0}return this._isTransitionInProgress()&&(e.onTransitionInterrupt(),this._endTransition()),!1}},{key:"_isTransitionInProgress",value:function(){return Boolean(this._animationFrame)}},{key:"_isTransitionEnabled",value:function(t){var e=t.transitionDuration,n=t.transitionInterpolator;return(e>0||"auto"===e)&&Boolean(n)}},{key:"_isUpdateDueToCurrentTransition",value:function(t){return!!this.state.propsInTransition&&this.state.interpolator.arePropsEqual(t,this.state.propsInTransition)}},{key:"_shouldIgnoreViewportChange",value:function(t,e){return!t||(this._isTransitionInProgress()?this.state.interruption===ef.IGNORE||this._isUpdateDueToCurrentTransition(e):!this._isTransitionEnabled(e)||e.transitionInterpolator.arePropsEqual(t,e))}},{key:"_triggerTransition",value:function(t,e){tD(this._isTransitionEnabled(e)),this._animationFrame&&cancelAnimationFrame(this._animationFrame);var n=e.transitionInterpolator,r=n.getDuration?n.getDuration(t,e):e.transitionDuration;if(0!==r){var i=e.transitionInterpolator.initializeProps(t,e),o={inTransition:!0,isZooming:t.zoom!==e.zoom,isPanning:t.longitude!==e.longitude||t.latitude!==e.latitude,isRotating:t.bearing!==e.bearing||t.pitch!==e.pitch};this.state={duration:r,easing:e.transitionEasing,interpolator:e.transitionInterpolator,interruption:e.transitionInterruption,startTime:this.time(),startProps:i.start,endProps:i.end,animation:null,propsInTransition:{}},this._onTransitionFrame(),this.onStateChange(o)}}},{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 t=this.time(),e=this.state,n=e.startTime,r=e.duration,i=e.easing,o=e.interpolator,a=e.startProps,s=e.endProps,c=!1,u=(t-n)/r;u>=1&&(u=1,c=!0),u=i(u);var l=o.interpolateProps(a,s,u),h=new tL(Object.assign({},this.props,l));this.state.propsInTransition=h.getViewportProps(),this.onViewportChange(this.state.propsInTransition,this.props),c&&(this._endTransition(),this.props.onTransitionEnd())}},]),t}();a(ev,"defaultProps",ed);var eg=n(840),em=n.n(eg);const eb={mousedown:1,mousemove:2,mouseup:4};!function(t){const e=t.prototype.handler;t.prototype.handler=function(t){const n=this.store;t.button>0&&"pointerdown"===t.type&&!function(t,e){for(let n=0;ne.pointerId===t.pointerId)&&n.push(t),e.call(this,t)}}(em().PointerEventInput),em().MouseInput.prototype.handler=function(t){let e=eb[t.type];1&e&&t.button>=0&&(this.pressed=!0),2&e&&0===t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))};const ey=em().Manager;var ew=em();const eO=ew?[[ew.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1},],[ew.Rotate,{enable:!1},],[ew.Pinch,{enable:!1},],[ew.Swipe,{enable:!1},],[ew.Pan,{threshold:0,enable:!1},],[ew.Press,{enable:!1},],[ew.Tap,{event:"doubletap",taps:2,enable:!1},],[ew.Tap,{event:"anytap",enable:!1},],[ew.Tap,{enable:!1},],]:null,eE={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},e$={doubletap:["tap"]},eP={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},eM={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave",],WHEEL_EVENTS:["wheel","mousewheel"]},ej={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"},eS={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},eT="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",ek="undefined"!=typeof window?window:n.g;void 0!==n.g?n.g:window;let ex=!1;try{const eD={get passive(){return ex=!0,!0}};ek.addEventListener("test",eD,eD),ek.removeEventListener("test",eD,eD)}catch(eC){}const eR=-1!==eT.indexOf("firefox"),{WHEEL_EVENTS:eA}=eM,eI="wheel";class eL{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.events=eA.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(e=>t.addEventListener(e,this.handleEvent,!!ex&&{passive:!1}))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===eI&&(this.options.enable=e)}handleEvent(t){if(!this.options.enable)return;let e=t.deltaY;ek.WheelEvent&&(eR&&t.deltaMode===ek.WheelEvent.DOM_DELTA_PIXEL&&(e/=ek.devicePixelRatio),t.deltaMode===ek.WheelEvent.DOM_DELTA_LINE&&(e*=40));const n={x:t.clientX,y:t.clientY};0!==e&&e%4.000244140625==0&&(e=Math.floor(e/4.000244140625)),t.shiftKey&&e&&(e*=.25),this._onWheel(t,-e,n)}_onWheel(t,e,n){this.callback({type:eI,center:n,delta:e,srcEvent:t,pointerType:"mouse",target:t.target})}}const{MOUSE_EVENTS:eN}=eM,ez="pointermove",eF="pointerover",eV="pointerout",eB="pointerleave";class eZ{constructor(t,e,n={}){this.element=t,this.callback=e,this.pressed=!1,this.options=Object.assign({enable:!0},n),this.enableMoveEvent=this.options.enable,this.enableLeaveEvent=this.options.enable,this.enableOutEvent=this.options.enable,this.enableOverEvent=this.options.enable,this.events=eN.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(e=>t.addEventListener(e,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===ez&&(this.enableMoveEvent=e),t===eF&&(this.enableOverEvent=e),t===eV&&(this.enableOutEvent=e),t===eB&&(this.enableLeaveEvent=e)}handleEvent(t){this.handleOverEvent(t),this.handleOutEvent(t),this.handleLeaveEvent(t),this.handleMoveEvent(t)}handleOverEvent(t){this.enableOverEvent&&"mouseover"===t.type&&this.callback({type:eF,srcEvent:t,pointerType:"mouse",target:t.target})}handleOutEvent(t){this.enableOutEvent&&"mouseout"===t.type&&this.callback({type:eV,srcEvent:t,pointerType:"mouse",target:t.target})}handleLeaveEvent(t){this.enableLeaveEvent&&"mouseleave"===t.type&&this.callback({type:eB,srcEvent:t,pointerType:"mouse",target:t.target})}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case"mousedown":t.button>=0&&(this.pressed=!0);break;case"mousemove":0===t.which&&(this.pressed=!1),this.pressed||this.callback({type:ez,srcEvent:t,pointerType:"mouse",target:t.target});break;case"mouseup":this.pressed=!1}}}const{KEY_EVENTS:eU}=eM,eq="keydown",eH="keyup";class eW{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=eU.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),t.tabIndex=n.tabIndex||0,t.style.outline="none",this.events.forEach(e=>t.addEventListener(e,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===eq&&(this.enableDownEvent=e),t===eH&&(this.enableUpEvent=e)}handleEvent(t){const e=t.target||t.srcElement;("INPUT"!==e.tagName||"text"!==e.type)&&"TEXTAREA"!==e.tagName&&(this.enableDownEvent&&"keydown"===t.type&&this.callback({type:eq,srcEvent:t,key:t.key,target:t.target}),this.enableUpEvent&&"keyup"===t.type&&this.callback({type:eH,srcEvent:t,key:t.key,target:t.target}))}}const eY="contextmenu";class eX{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.handleEvent=this.handleEvent.bind(this),t.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(t,e){t===eY&&(this.options.enable=e)}handleEvent(t){this.options.enable&&this.callback({type:eY,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})}}const eK={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},eG={srcElement:"root",priority:0};class e_{constructor(t){this.eventManager=t,this.handlers=[],this.handlersByElement=new Map,this.handleEvent=this.handleEvent.bind(this),this._active=!1}isEmpty(){return!this._active}add(t,e,n,r=!1,i=!1){const{handlers:o,handlersByElement:a}=this;n&&("object"!=typeof n||n.addEventListener)&&(n={srcElement:n}),n=n?Object.assign({},eG,n):eG;let s=a.get(n.srcElement);s||(s=[],a.set(n.srcElement,s));const c={type:t,handler:e,srcElement:n.srcElement,priority:n.priority};r&&(c.once=!0),i&&(c.passive=!0),o.push(c),this._active=this._active||!c.passive;let u=s.length-1;for(;u>=0&&!(s[u].priority>=c.priority);)u--;s.splice(u+1,0,c)}remove(t,e){const{handlers:n,handlersByElement:r}=this;for(let i=n.length-1;i>=0;i--){const o=n[i];if(o.type===t&&o.handler===e){n.splice(i,1);const a=r.get(o.srcElement);a.splice(a.indexOf(o),1),0===a.length&&r.delete(o.srcElement)}}this._active=n.some(t=>!t.passive)}handleEvent(t){if(this.isEmpty())return;const e=this._normalizeEvent(t);let n=t.srcEvent.target;for(;n&&n!==e.rootElement;){if(this._emit(e,n),e.handled)return;n=n.parentNode}this._emit(e,"root")}_emit(t,e){const n=this.handlersByElement.get(e);if(n){let r=!1;const i=()=>{t.handled=!0},o=()=>{t.handled=!0,r=!0},a=[];for(let s=0;s{const e=this.manager.get(t);e&&eE[t].forEach(t=>{e.recognizeWith(t)})}),e.recognizerOptions){const i=this.manager.get(r);if(i){const o=e.recognizerOptions[r];delete o.enable,i.set(o)}}for(const[a,s]of(this.wheelInput=new eL(t,this._onOtherEvent,{enable:!1}),this.moveInput=new eZ(t,this._onOtherEvent,{enable:!1}),this.keyInput=new eW(t,this._onOtherEvent,{enable:!1,tabIndex:e.tabIndex}),this.contextmenuInput=new eX(t,this._onOtherEvent,{enable:!1}),this.events))s.isEmpty()||(this._toggleRecognizer(s.recognizerName,!0),this.manager.on(a,s.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(t,e,n){this._addEventHandler(t,e,n,!1)}once(t,e,n){this._addEventHandler(t,e,n,!0)}watch(t,e,n){this._addEventHandler(t,e,n,!1,!0)}off(t,e){this._removeEventHandler(t,e)}_toggleRecognizer(t,e){const{manager:n}=this;if(!n)return;const r=n.get(t);if(r&&r.options.enable!==e){r.set({enable:e});const i=e$[t];i&&!this.options.recognizers&&i.forEach(i=>{const o=n.get(i);e?(o.requireFailure(t),r.dropRequireFailure(i)):o.dropRequireFailure(t)})}this.wheelInput.enableEventType(t,e),this.moveInput.enableEventType(t,e),this.keyInput.enableEventType(t,e),this.contextmenuInput.enableEventType(t,e)}_addEventHandler(t,e,n,r,i){if("string"!=typeof t){for(const o in n=e,t)this._addEventHandler(o,t[o],n,r,i);return}const{manager:a,events:s}=this,c=eS[t]||t;let u=s.get(c);!u&&(u=new e_(this),s.set(c,u),u.recognizerName=ej[c]||c,a&&a.on(c,u.handleEvent)),u.add(t,e,n,r,i),u.isEmpty()||this._toggleRecognizer(u.recognizerName,!0)}_removeEventHandler(t,e){if("string"!=typeof t){for(const n in t)this._removeEventHandler(n,t[n]);return}const{events:r}=this,i=eS[t]||t,o=r.get(i);if(o&&(o.remove(t,e),o.isEmpty())){const{recognizerName:a}=o;let s=!1;for(const c of r.values())if(c.recognizerName===a&&!c.isEmpty()){s=!0;break}s||this._toggleRecognizer(a,!1)}}_onBasicInput(t){const{srcEvent:e}=t,n=eP[e.type];n&&this.manager.emit(n,t)}_onOtherEvent(t){this.manager.emit(t.type,t)}}function e0(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function e1(t){for(var e=1;e0),a=o&&!this.state.isHovering,s=!o&&this.state.isHovering;(r||a)&&(t.features=e,r&&r(t)),a&&ni.call(this,"onMouseEnter",t),s&&ni.call(this,"onMouseLeave",t),(a||s)&&this.setState({isHovering:o})}}function nc(t){var e=this.props,n=e.onClick,r=e.onNativeClick,i=e.onDblClick,o=e.doubleClickZoom,a=[],s=i||o;switch(t.type){case"anyclick":a.push(r),s||a.push(n);break;case"click":s&&a.push(n)}(a=a.filter(Boolean)).length&&((t=nn.call(this,t)).features=nr.call(this,t.point),a.forEach(function(e){return e(t)}))}var nu=(0,c.forwardRef)(function(t,e){var n,a,s=(0,c.useContext)(tZ),u=(0,c.useMemo)(function(){return t.controller||new e8},[]),l=(0,c.useMemo)(function(){return new eQ(null,{touchAction:t.touchAction,recognizerOptions:t.eventRecognizerOptions})},[]),h=(0,c.useRef)(null),p=(0,c.useRef)(null),f=(0,c.useRef)({width:0,height:0,state:{isHovering:!1,isDragging:!1}}).current;f.props=t,f.map=p.current&&p.current.getMap(),f.setState=function(e){f.state=e7(e7({},f.state),e),h.current.style.cursor=t.getCursor(f.state)};var d=!0,v=function(t,e,r){if(d){n=[t,e,r,];return}var i=f.props,o=i.onViewStateChange,a=i.onViewportChange;Object.defineProperty(t,"position",{get:function(){return[0,0,tq(f.map,t),]}}),o&&o({viewState:t,interactionState:e,oldViewState:r}),a&&a(t,e,r)};(0,c.useImperativeHandle)(e,function(){var t;return{getMap:(t=p).current&&t.current.getMap,queryRenderedFeatures:t.current&&t.current.queryRenderedFeatures}},[]);var g=(0,c.useMemo)(function(){return e7(e7({},s),{},{eventManager:l,container:s.container||h.current})},[s,h.current]);g.onViewportChange=v,g.viewport=s.viewport||tX(f),f.viewport=g.viewport;var m=function(t){var e=t.isDragging,n=void 0!==e&&e;if(n!==f.state.isDragging&&f.setState({isDragging:n}),d){a=t;return}var r=f.props.onInteractionStateChange;r&&r(t)},b=function(){f.width&&f.height&&u.setOptions(e7(e7(e7({},f.props),f.props.viewState),{},{isInteractive:Boolean(f.props.onViewStateChange||f.props.onViewportChange),onViewportChange:v,onStateChange:m,eventManager:l,width:f.width,height:f.height}))},y=function(t){var e=t.width,n=t.height;f.width=e,f.height=n,b(),f.props.onResize({width:e,height:n})};(0,c.useEffect)(function(){return l.setElement(h.current),l.on({pointerdown:no.bind(f),pointermove:ns.bind(f),pointerup:na.bind(f),pointerleave:ni.bind(f,"onMouseOut"),click:nc.bind(f),anyclick:nc.bind(f),dblclick:ni.bind(f,"onDblClick"),wheel:ni.bind(f,"onWheel"),contextmenu:ni.bind(f,"onContextMenu")}),function(){l.destroy()}},[]),tU(function(){if(n){var t;v.apply(void 0,function(t){if(Array.isArray(t))return i(t)}(t=n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||o(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}a&&m(a)}),b();var w=t.width,O=t.height,E=t.style,$=t.getCursor,P=(0,c.useMemo)(function(){return e7(e7({position:"relative"},E),{},{width:w,height:O,cursor:$(f.state)})},[E,w,O,$,f.state]);return n&&f._child||(f._child=c.createElement(tB,{value:g},c.createElement("div",{key:"event-canvas",ref:h,style:P},c.createElement(t0,r({},t,{width:"100%",height:"100%",style:null,onResize:y,ref:p}))))),d=!1,f._child});nu.supported=t0.supported,nu.propTypes=e9,nu.defaultProps=ne;var nl=nu;u.string.isRequired,u.string,u.oneOf(["fill","line","symbol","circle","fill-extrusion","raster","background","heatmap","hillshade","sky",]).isRequired,u.string,u.string,u.string;var nh={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},np={captureScroll:u.bool,captureDrag:u.bool,captureClick:u.bool,captureDoubleClick:u.bool,capturePointerMove:u.bool};function nf(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,c.useContext)(tZ),n=(0,c.useRef)(null),r=(0,c.useRef)({props:t,state:{},context:e,containerRef:n}).current;return r.props=t,r.context=e,(0,c.useEffect)(function(){return function(t){var e=t.containerRef.current,n=t.context.eventManager;if(e&&n){var r={wheel:function(e){var n=t.props;n.captureScroll&&e.stopPropagation(),n.onScroll&&n.onScroll(e,t)},panstart:function(e){var n=t.props;n.captureDrag&&e.stopPropagation(),n.onDragStart&&n.onDragStart(e,t)},anyclick:function(e){var n=t.props;n.captureClick&&e.stopPropagation(),n.onNativeClick&&n.onNativeClick(e,t)},click:function(e){var n=t.props;n.captureClick&&e.stopPropagation(),n.onClick&&n.onClick(e,t)},dblclick:function(e){var n=t.props;n.captureDoubleClick&&e.stopPropagation(),n.onDoubleClick&&n.onDoubleClick(e,t)},pointermove:function(e){var n=t.props;n.capturePointerMove&&e.stopPropagation(),n.onPointerMove&&n.onPointerMove(e,t)}};return n.watch(r,e),function(){n.off(r)}}}(r)},[e.eventManager]),r}function nd(t){var e=t.instance,n=nf(t),r=n.context,i=n.containerRef;return e._context=r,e._containerRef=i,e._render()}var nv=function(t){t5(o,t);var e,n,i=(e=o,n=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(t){return!1}}(),function(){var t,r=t7(e);if(n){var i=t7(this).constructor;t=Reflect.construct(r,arguments,i)}else t=r.apply(this,arguments);return t6(this,t)});function o(){var t;tl(this,o);for(var e=arguments.length,n=Array(e),r=0;r2&&void 0!==arguments[2]?arguments[2]:"x";if(null===t)return e;var r="x"===n?t.offsetWidth:t.offsetHeight;return nP(e/100*r)/r*100};function nj(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}var nS=Object.assign({},nb,{className:u.string,longitude:u.number.isRequired,latitude:u.number.isRequired,style:u.object}),nT=Object.assign({},ny,{className:""});function nk(t){var e,n,r,i,o,s,u,h,p=(e=t,r=(n=l((0,c.useState)(null),2))[0],i=n[1],s=(o=l((0,c.useState)(null),2))[0],u=o[1],(h=nf(nm(nm({},e),{},{onDragStart:nE}))).callbacks=e,h.state.dragPos=r,h.state.setDragPos=i,h.state.dragOffset=s,h.state.setDragOffset=u,(0,c.useEffect)(function(){return function(t){var e=t.context.eventManager;if(e&&t.state.dragPos){var n={panmove:function(e){return function(t,e){var n=e.props,r=e.callbacks,i=e.state,o=e.context;t.stopPropagation();var a=nw(t);i.setDragPos(a);var s=i.dragOffset;if(r.onDrag&&s){var c=Object.assign({},t);c.lngLat=nO(a,s,n,o),r.onDrag(c)}}(e,t)},panend:function(e){return function(t,e){var n=e.props,r=e.callbacks,i=e.state,o=e.context;t.stopPropagation();var a=i.dragPos,s=i.dragOffset;if(i.setDragPos(null),i.setDragOffset(null),r.onDragEnd&&a&&s){var c=Object.assign({},t);c.lngLat=nO(a,s,n,o),r.onDragEnd(c)}}(e,t)},pancancel:function(e){var n,r;return n=e,r=t.state,void(n.stopPropagation(),r.setDragPos(null),r.setDragOffset(null))}};return e.watch(n),function(){e.off(n)}}}(h)},[h.context.eventManager,Boolean(r)]),h),f=p.state,d=p.containerRef,v=t.children,g=t.className,m=t.draggable,b=t.style,y=f.dragPos,w=function(t){var e=t.props,n=t.state,r=t.context,i=e.longitude,o=e.latitude,a=e.offsetLeft,s=e.offsetTop,c=n.dragPos,u=n.dragOffset,h=r.viewport,p=r.map;if(c&&u)return[c[0]+u[0],c[1]+u[1],];var f=tq(p,{longitude:i,latitude:o}),d=h.project([i,o,f,]),v=l(d,2),g=v[0],m=v[1];return[g+=a,m+=s]}(p),O=l(w,2),E=O[0],$=O[1],P="translate(".concat(nP(E),"px, ").concat(nP($),"px)"),M=m?y?"grabbing":"grab":"auto",j=(0,c.useMemo)(function(){var t=function(t){for(var e=1;e0){var g=p,m=v;for(p=0;p<=1;p+=.5)(v=Math.max(0,u-f)+Math.max(0,(d=(f=n-p*a)+a)-i+u))0){var E=h,$=O;for(h=0;h<=1;h+=b)(O=Math.max(0,u-y)+Math.max(0,(w=(y=e-h*o)+o)-r+u))<$&&($=O,E=h);h=E}return nD.find(function(t){var e=nx[t];return e.x===h&&e.y===p})||s}({x:E,y:$,anchor:P,padding:j,width:b.width,height:b.height,selfWidth:y.clientWidth,selfHeight:y.clientHeight}):P),H=(S=t,T=a,k=i.current,x=U,D=q,R=(C=l(x,3))[0],A=C[1],I=C[2],L=S.offsetLeft,N=S.offsetTop,z=S.sortByDepth,V=nM(k,-(100*(F=nx[D]).x)),B=nM(k,-(100*F.y),"y"),Z={position:"absolute",transform:"\n translate(".concat(V,"%, ").concat(B,"%)\n translate(").concat(nP(R+L),"px, ").concat(nP(A+N),"px)\n "),display:void 0,zIndex:void 0},z&&(I>1||I<-1||R<0||R>T.width||A<0||A>T.height?Z.display="none":Z.zIndex=Math.floor((1-I)/2*1e5)),Z),W=(0,c.useCallback)(function(t){n.props.onClose();var e=n.context.eventManager;e&&e.once("click",function(t){return t.stopPropagation()},t.target)},[]);return c.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(q," ").concat(u),style:H,ref:i},c.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:f}}),c.createElement("div",{key:"content",ref:e,className:"mapboxgl-popup-content"},d&&c.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:W},"\xd7"),v))}function nI(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}nA.propTypes=nC,nA.defaultProps=nR,c.memo(nA);var nL=Object.assign({},np,{toggleLabel:u.string,className:u.string,style:u.object,compact:u.bool,customAttribution:u.oneOfType([u.string,u.arrayOf(u.string),])}),nN=Object.assign({},nh,{className:"",toggleLabel:"Toggle Attribution"});function nz(t){var e=nf(t),n=e.context,r=e.containerRef,i=(0,c.useRef)(null),o=l((0,c.useState)(!1),2),s=o[0],u=o[1];(0,c.useEffect)(function(){var e,o,a,s,c,u;return n.map&&(e=(o={customAttribution:t.customAttribution},a=n.map,s=r.current,c=i.current,(u=new(tj()).AttributionControl(o))._map=a,u._container=s,u._innerContainer=c,u._updateAttributions(),u._updateEditLink(),a.on("styledata",u._updateData),a.on("sourcedata",u._updateData),u)),function(){var t;return e&&void((t=e)._map.off("styledata",t._updateData),t._map.off("sourcedata",t._updateData))}},[n.map]);var h=void 0===t.compact?n.viewport.width<=640:t.compact;(0,c.useEffect)(function(){!h&&s&&u(!1)},[h]);var p=(0,c.useCallback)(function(){return u(function(t){return!t})},[]),f=(0,c.useMemo)(function(){return function(t){for(var e=1;ea)return 1}return 0}(e.map.version,"1.6.0")>=0?2:1:2},[e.map]),r=e.viewport.bearing,i={transform:"rotate(".concat(-r,"deg)")},2===n?c.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:i}):c.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:i})))))}function n1(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}n0.propTypes=nG,n0.defaultProps=n_,c.memo(n0);var n2=Object.assign({},np,{className:u.string,style:u.object,maxWidth:u.number,unit:u.oneOf(["imperial","metric","nautical"])}),n4=Object.assign({},nh,{className:"",maxWidth:100,unit:"metric"});function n3(t){var e=nf(t),n=e.context,r=e.containerRef,i=l((0,c.useState)(null),2),o=i[0],s=i[1];(0,c.useEffect)(function(){if(n.map){var t=new(tj()).ScaleControl;t._map=n.map,t._container=r.current,s(t)}},[n.map]),o&&(o.options=t,o._onMove());var u=(0,c.useMemo)(function(){return function(t){for(var e=1;e 0 && number > -1 && number < 1 && (formatedText = number.toFixed(fractionSize)); else { - var fractionLen = (numStr.split(DECIMAL_SEP)[1] || "").length; + var fractionLen = (numStr.split(".")[1] || "").length; isUndefined(fractionSize) && (fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac)); - var pow = Math.pow(10, fractionSize), fraction = ("" + (number = Math.round(number * pow) / pow)).split(DECIMAL_SEP), whole = fraction[0]; + var pow = Math.pow(10, fractionSize), fraction = ("" + (number = Math.round(number * pow) / pow)).split("."), whole = fraction[0]; fraction = fraction[1] || ""; var i, pos = 0, lgroup = pattern.lgSize, group = pattern.gSize; if (whole.length >= lgroup + group) for(i = 0, pos = whole.length - lgroup; i < pos; i++)(pos - i) % group == 0 && 0 !== i && (formatedText += groupSep), formatedText += whole.charAt(i); @@ -3286,6 +3278,13 @@ return formats[uppercase(shortForm ? "SHORT" + name : name)][value]; }; } + $FilterProvider.$inject = [ + "$provide" + ], currencyFilter.$inject = [ + "$locale" + ], numberFilter.$inject = [ + "$locale" + ]; var DATE_FORMATS = { yyyy: dateGetter("FullYear", 4), yy: dateGetter("FullYear", 2, 0, !0), 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 79a3ac2c2a3..6b277f82bb6 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 @@ -4708,13 +4708,13 @@ }); }(jQuery), function($, window) { $.mobile.iosorientationfixEnabled = !0; - var zoom, evt, x, y, z, aig, ua = navigator.userAgent; + var zoom, x, y, z, aig, ua = navigator.userAgent; if (!(/iPhone|iPad|iPod/.test(navigator.platform) && /OS [1-5]_[0-9_]* like Mac OS X/i.test(ua) && ua.indexOf("AppleWebKit") > -1)) { $.mobile.iosorientationfixEnabled = !1; return; } function checkTilt(e) { - x = Math.abs((aig = (evt = e.originalEvent).accelerationIncludingGravity).x), y = Math.abs(aig.y), z = Math.abs(aig.z), !window.orientation && (x > 7 || (z > 6 && y < 8 || z < 8 && y > 6) && x > 5) ? zoom.enabled && zoom.disable() : zoom.enabled || zoom.enable(); + x = Math.abs((aig = e.originalEvent.accelerationIncludingGravity).x), y = Math.abs(aig.y), z = Math.abs(aig.z), !window.orientation && (x > 7 || (z > 6 && y < 8 || z < 8 && y > 6) && x > 5) ? zoom.enabled && zoom.disable() : zoom.enabled || zoom.enable(); } zoom = $.mobile.zoom, $.mobile.document.on("mobileinit", function() { $.mobile.iosorientationfixEnabled && $.mobile.window.bind("orientationchange.iosorientationfix", zoom.enable).bind("devicemotion.iosorientationfix", checkTilt); 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 40d83f97dfe..5902e5c3392 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 @@ -2286,55 +2286,55 @@ var _ReactInternals$Sched$1 = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.SchedulerTracing, __interactionsRef = _ReactInternals$Sched$1.__interactionsRef, __subscriberRef = _ReactInternals$Sched$1.__subscriberRef, unstable_getThreadID = (_ReactInternals$Sched$1.unstable_clear, _ReactInternals$Sched$1.unstable_getCurrent, _ReactInternals$Sched$1.unstable_getThreadID), unstable_wrap = (_ReactInternals$Sched$1.unstable_subscribe, _ReactInternals$Sched$1.unstable_trace, _ReactInternals$Sched$1.unstable_unsubscribe, _ReactInternals$Sched$1.unstable_wrap); if (!(null != __interactionsRef && null != __interactionsRef.current)) throw Error("It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling"); unstable_now(); - var NoLanes = 0, SyncLane = 1, return_highestLanePriority = 8; + var return_highestLanePriority = 8; function getHighestPriorityLanes(lanes) { - if ((SyncLane & lanes) !== NoLanes) return return_highestLanePriority = 15, SyncLane; - if ((2 & lanes) !== NoLanes) return return_highestLanePriority = 14, 2; - if ((4 & lanes) !== NoLanes) return return_highestLanePriority = 13, 4; + if ((1 & lanes) != 0) return return_highestLanePriority = 15, 1; + if ((2 & lanes) != 0) return return_highestLanePriority = 14, 2; + if ((4 & lanes) != 0) return return_highestLanePriority = 13, 4; var inputDiscreteLanes = 24 & lanes; - if (inputDiscreteLanes !== NoLanes) return return_highestLanePriority = 12, inputDiscreteLanes; - if ((32 & lanes) !== NoLanes) return return_highestLanePriority = 11, 32; + if (0 !== inputDiscreteLanes) return return_highestLanePriority = 12, inputDiscreteLanes; + if ((32 & lanes) != 0) return return_highestLanePriority = 11, 32; var inputContinuousLanes = 192 & lanes; - if (inputContinuousLanes !== NoLanes) return return_highestLanePriority = 10, inputContinuousLanes; - if ((256 & lanes) !== NoLanes) return return_highestLanePriority = 9, 256; + if (0 !== inputContinuousLanes) return return_highestLanePriority = 10, inputContinuousLanes; + if ((256 & lanes) != 0) return return_highestLanePriority = 9, 256; var defaultLanes = 3584 & lanes; - if (defaultLanes !== NoLanes) return return_highestLanePriority = 8, defaultLanes; - if ((4096 & lanes) !== NoLanes) return return_highestLanePriority = 7, 4096; + if (0 !== defaultLanes) return return_highestLanePriority = 8, defaultLanes; + if ((4096 & lanes) != 0) return return_highestLanePriority = 7, 4096; var transitionLanes = 4186112 & lanes; - if (transitionLanes !== NoLanes) return return_highestLanePriority = 6, transitionLanes; + if (0 !== transitionLanes) return return_highestLanePriority = 6, transitionLanes; var retryLanes = 62914560 & lanes; - if (retryLanes !== NoLanes) return return_highestLanePriority = 5, retryLanes; + if (0 !== retryLanes) return return_highestLanePriority = 5, retryLanes; if (67108864 & lanes) return return_highestLanePriority = 4, 67108864; - if ((134217728 & lanes) !== NoLanes) return return_highestLanePriority = 3, 134217728; + if ((134217728 & lanes) != 0) return return_highestLanePriority = 3, 134217728; var idleLanes = 805306368 & lanes; - return idleLanes !== NoLanes ? (return_highestLanePriority = 2, idleLanes) : (1073741824 & lanes) !== NoLanes ? (return_highestLanePriority = 1, 1073741824) : (error("Should have found matching lanes. This is a bug in React."), return_highestLanePriority = 8, lanes); + return 0 !== idleLanes ? (return_highestLanePriority = 2, idleLanes) : (1073741824 & lanes) != 0 ? (return_highestLanePriority = 1, 1073741824) : (error("Should have found matching lanes. This is a bug in React."), return_highestLanePriority = 8, lanes); } function getNextLanes(root, wipLanes) { var lanes, index, pendingLanes = root.pendingLanes; - if (pendingLanes === NoLanes) return return_highestLanePriority = 0, NoLanes; - var nextLanes = NoLanes, nextLanePriority = 0, expiredLanes = root.expiredLanes, suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; - if (expiredLanes !== NoLanes) nextLanes = expiredLanes, nextLanePriority = return_highestLanePriority = 15; + if (0 === pendingLanes) return return_highestLanePriority = 0, 0; + var nextLanes = 0, nextLanePriority = 0, expiredLanes = root.expiredLanes, suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; + if (0 !== expiredLanes) nextLanes = expiredLanes, nextLanePriority = return_highestLanePriority = 15; else { var nonIdlePendingLanes = 134217727 & pendingLanes; - if (nonIdlePendingLanes !== NoLanes) { + if (0 !== nonIdlePendingLanes) { var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; - if (nonIdleUnblockedLanes !== NoLanes) nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes), nextLanePriority = return_highestLanePriority; + if (0 !== nonIdleUnblockedLanes) nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes), nextLanePriority = return_highestLanePriority; else { var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - nonIdlePingedLanes !== NoLanes && (nextLanes = getHighestPriorityLanes(nonIdlePingedLanes), nextLanePriority = return_highestLanePriority); + 0 !== nonIdlePingedLanes && (nextLanes = getHighestPriorityLanes(nonIdlePingedLanes), nextLanePriority = return_highestLanePriority); } } else { var unblockedLanes = pendingLanes & ~suspendedLanes; - unblockedLanes !== NoLanes ? (nextLanes = getHighestPriorityLanes(unblockedLanes), nextLanePriority = return_highestLanePriority) : pingedLanes !== NoLanes && (nextLanes = getHighestPriorityLanes(pingedLanes), nextLanePriority = return_highestLanePriority); + 0 !== unblockedLanes ? (nextLanes = getHighestPriorityLanes(unblockedLanes), nextLanePriority = return_highestLanePriority) : 0 !== pingedLanes && (nextLanes = getHighestPriorityLanes(pingedLanes), nextLanePriority = return_highestLanePriority); } } - if (nextLanes === NoLanes) return NoLanes; - if (nextLanes = pendingLanes & (lanes = nextLanes, (((index = 31 - clz32(lanes)) < 0 ? NoLanes : 1 << index) << 1) - 1), wipLanes !== NoLanes && wipLanes !== nextLanes && (wipLanes & suspendedLanes) === NoLanes) { + if (0 === nextLanes) return 0; + if (nextLanes = pendingLanes & (((index = 31 - clz32(lanes = nextLanes)) < 0 ? 0 : 1 << index) << 1) - 1, 0 !== wipLanes && wipLanes !== nextLanes && (wipLanes & suspendedLanes) == 0) { if (getHighestPriorityLanes(wipLanes), nextLanePriority <= return_highestLanePriority) return wipLanes; return_highestLanePriority = nextLanePriority; } var entangledLanes = root.entangledLanes; - if (entangledLanes !== NoLanes) for(var entanglements = root.entanglements, lanes1 = nextLanes & entangledLanes; lanes1 > 0;){ + if (0 !== entangledLanes) for(var entanglements = root.entanglements, lanes1 = nextLanes & entangledLanes; lanes1 > 0;){ var index1 = pickArbitraryLaneIndex(lanes1), lane = 1 << index1; nextLanes |= entanglements[index1], lanes1 &= ~lane; } @@ -2347,10 +2347,10 @@ } function getLanesToRetrySynchronouslyOnError(root) { var everythingButOffscreen = -1073741825 & root.pendingLanes; - return everythingButOffscreen !== NoLanes ? everythingButOffscreen : 1073741824 & everythingButOffscreen ? 1073741824 : NoLanes; + return 0 !== everythingButOffscreen ? everythingButOffscreen : 1073741824 & everythingButOffscreen ? 1073741824 : 0; } function includesNonIdleWork(lanes) { - return (134217727 & lanes) !== NoLanes; + return (134217727 & lanes) != 0; } function includesOnlyRetries(lanes) { return (62914560 & lanes) === lanes; @@ -2362,7 +2362,7 @@ case 5: break; case 15: - return SyncLane; + return 1; case 14: return 2; case 12: @@ -2389,9 +2389,6 @@ function pickArbitraryLaneIndex(lanes) { return 31 - clz32(lanes); } - function includesSomeLane(a, b) { - return (a & b) !== NoLanes; - } function isSubsetOfLanes(set, subset) { return (set & subset) === subset; } @@ -4155,7 +4152,7 @@ } var rendererID = null, injectedHook = null, hasLoggedError = !1, isDevToolsPresent = "undefined" != typeof __REACT_DEVTOOLS_GLOBAL_HOOK__, Scheduler_runWithPriority = unstable_runWithPriority, Scheduler_scheduleCallback = unstable_scheduleCallback, Scheduler_cancelCallback = unstable_cancelCallback, Scheduler_requestPaint = unstable_requestPaint, Scheduler_now$1 = unstable_now, Scheduler_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel, Scheduler_ImmediatePriority = unstable_ImmediatePriority, Scheduler_UserBlockingPriority = unstable_UserBlockingPriority, Scheduler_NormalPriority = unstable_NormalPriority, Scheduler_LowPriority = unstable_LowPriority, Scheduler_IdlePriority = unstable_IdlePriority; if (!(null != __interactionsRef && null != __interactionsRef.current)) throw Error("It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling"); - var fakeCallbackNode = {}, NormalPriority$1 = 97, shouldYield = unstable_shouldYield, requestPaint = void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, syncQueue = null, immediateQueueCallbackNode = null, isFlushingSyncQueue = !1, initialTimeMs$1 = Scheduler_now$1(), now = initialTimeMs$1 < 10000 ? Scheduler_now$1 : function() { + var fakeCallbackNode = {}, shouldYield = unstable_shouldYield, requestPaint = void 0 !== Scheduler_requestPaint ? Scheduler_requestPaint : function() {}, syncQueue = null, immediateQueueCallbackNode = null, isFlushingSyncQueue = !1, initialTimeMs$1 = Scheduler_now$1(), now = initialTimeMs$1 < 10000 ? Scheduler_now$1 : function() { return Scheduler_now$1() - initialTimeMs$1; }; function getCurrentPriorityLevel() { @@ -4165,7 +4162,7 @@ case Scheduler_UserBlockingPriority: return 98; case Scheduler_NormalPriority: - return NormalPriority$1; + return 97; case Scheduler_LowPriority: return 96; case Scheduler_IdlePriority: @@ -4180,7 +4177,7 @@ return Scheduler_ImmediatePriority; case 98: return Scheduler_UserBlockingPriority; - case NormalPriority$1: + case 97: return Scheduler_NormalPriority; case 96: return Scheduler_LowPriority; @@ -4338,8 +4335,8 @@ } function prepareToReadContext(workInProgress, renderLanes) { currentlyRenderingFiber = workInProgress, lastContextDependency = null, lastContextWithAllBitsObserved = null; - var dependencies = workInProgress.dependencies; - null !== dependencies && null !== dependencies.firstContext && (includesSomeLane(dependencies.lanes, renderLanes) && markWorkInProgressReceivedUpdate(), dependencies.firstContext = null); + var a, b, dependencies = workInProgress.dependencies; + null !== dependencies && null !== dependencies.firstContext && (a = dependencies.lanes, (a & (b = renderLanes)) != 0 && markWorkInProgressReceivedUpdate(), dependencies.firstContext = null); } function readContext(context, observedBits) { if (isDisallowedContextReadInDEV && error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."), lastContextWithAllBitsObserved === context) ; @@ -4354,7 +4351,7 @@ if (null === lastContextDependency) { if (!(null !== currentlyRenderingFiber)) throw Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."); lastContextDependency = contextItem, currentlyRenderingFiber.dependencies = { - lanes: NoLanes, + lanes: 0, firstContext: contextItem, responders: null }; @@ -4494,7 +4491,7 @@ } } if (null !== firstBaseUpdate) { - for(var newState = queue.baseState, newLanes = NoLanes, newBaseState = null, newFirstBaseUpdate = null, newLastBaseUpdate = null, update = firstBaseUpdate;;){ + for(var newState = queue.baseState, newLanes = 0, newBaseState = null, newFirstBaseUpdate = null, newLastBaseUpdate = null, update = firstBaseUpdate;;){ var updateLane = update.lane, updateEventTime = update.eventTime; if (isSubsetOfLanes(renderLanes, updateLane)) { if (null !== newLastBaseUpdate) { @@ -4567,7 +4564,7 @@ var partialState = getDerivedStateFromProps(nextProps, prevState); warnOnUndefinedDerivedState(ctor, partialState); var memoizedState = null == partialState ? prevState : _assign({}, prevState, partialState); - workInProgress.memoizedState = memoizedState, workInProgress.lanes === NoLanes && (workInProgress.updateQueue.baseState = memoizedState); + workInProgress.memoizedState = memoizedState, 0 === workInProgress.lanes && (workInProgress.updateQueue.baseState = memoizedState); } warnOnInvalidCallback = function(callback, callerName) { if (null !== callback && "function" != typeof callback) { @@ -5209,7 +5206,7 @@ rendererSigil$1 = {}; var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; didWarnAboutUseOpaqueIdentifier = {}, didWarnAboutMismatchedHooksForComponent = new Set(); - var renderLanes = NoLanes, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, didScheduleRenderPhaseUpdateDuringThisPass = !1, currentHookNameInDev = null, hookTypesDev = null, hookTypesUpdateIndexDev = -1, ignorePreviousDependencies = !1; + var renderLanes = 0, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, didScheduleRenderPhaseUpdateDuringThisPass = !1, currentHookNameInDev = null, hookTypesDev = null, hookTypesUpdateIndexDev = -1, ignorePreviousDependencies = !1; function mountHookTypesDev() { var hookName = currentHookNameInDev; null === hookTypesDev ? hookTypesDev = [ @@ -5243,7 +5240,7 @@ return !0; } function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderLanes) { - renderLanes = nextRenderLanes, currentlyRenderingFiber$1 = workInProgress, hookTypesDev = null !== current ? current._debugHookTypes : null, hookTypesUpdateIndexDev = -1, ignorePreviousDependencies = null !== current && current.type !== workInProgress.type, workInProgress.memoizedState = null, workInProgress.updateQueue = null, workInProgress.lanes = NoLanes, null !== current && null !== current.memoizedState ? ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV : null !== hookTypesDev ? ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV : ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; + renderLanes = nextRenderLanes, currentlyRenderingFiber$1 = workInProgress, hookTypesDev = null !== current ? current._debugHookTypes : null, hookTypesUpdateIndexDev = -1, ignorePreviousDependencies = null !== current && current.type !== workInProgress.type, workInProgress.memoizedState = null, workInProgress.updateQueue = null, workInProgress.lanes = 0, null !== current && null !== current.memoizedState ? ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV : null !== hookTypesDev ? ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV : ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; var children = Component(props, secondArg); if (didScheduleRenderPhaseUpdateDuringThisPass) { var numberOfReRenders = 0; @@ -5254,7 +5251,7 @@ } ReactCurrentDispatcher$1.current = ContextOnlyDispatcher, workInProgress._debugHookTypes = hookTypesDev; var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next; - if (renderLanes = NoLanes, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, currentHookNameInDev = null, hookTypesDev = null, hookTypesUpdateIndexDev = -1, didScheduleRenderPhaseUpdate = !1, didRenderTooFewHooks) throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement."); + if (renderLanes = 0, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, currentHookNameInDev = null, hookTypesDev = null, hookTypesUpdateIndexDev = -1, didScheduleRenderPhaseUpdate = !1, didRenderTooFewHooks) throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement."); return children; } function bailoutHooks(current, workInProgress, lanes) { @@ -5269,7 +5266,7 @@ } didScheduleRenderPhaseUpdate = !1; } - renderLanes = NoLanes, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, hookTypesDev = null, hookTypesUpdateIndexDev = -1, currentHookNameInDev = null, isUpdatingOpaqueValueInRenderPhase = !1, didScheduleRenderPhaseUpdateDuringThisPass = !1; + renderLanes = 0, currentlyRenderingFiber$1 = null, currentHook = null, workInProgressHook = null, hookTypesDev = null, hookTypesUpdateIndexDev = -1, currentHookNameInDev = null, isUpdatingOpaqueValueInRenderPhase = !1, didScheduleRenderPhaseUpdateDuringThisPass = !1; } function mountWorkInProgressHook() { var hook = { @@ -5643,7 +5640,7 @@ var priorityLevel = getCurrentPriorityLevel(); runWithPriority$1(priorityLevel < 98 ? 98 : priorityLevel, function() { setPending(!0); - }), runWithPriority$1(priorityLevel > NormalPriority$1 ? NormalPriority$1 : priorityLevel, function() { + }), runWithPriority$1(priorityLevel > 97 ? 97 : priorityLevel, function() { var prevTransition = ReactCurrentBatchConfig$1.transition; ReactCurrentBatchConfig$1.transition = 1; try { @@ -5715,7 +5712,7 @@ var alternate = fiber.alternate; if (fiber === currentlyRenderingFiber$1 || null !== alternate && alternate === currentlyRenderingFiber$1) didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = !0; else { - if (fiber.lanes === NoLanes && (null === alternate || alternate.lanes === NoLanes)) { + if (0 === fiber.lanes && (null === alternate || 0 === alternate.lanes)) { var prevDispatcher, lastRenderedReducer = queue.lastRenderedReducer; if (null !== lastRenderedReducer) { prevDispatcher = ReactCurrentDispatcher$1.current, ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; @@ -6279,8 +6276,8 @@ } var _type = Component.type, _innerPropTypes = _type.propTypes; _innerPropTypes && checkPropTypes(_innerPropTypes, nextProps, "prop", getComponentName(_type)); - var currentChild = current.child; - if (!includesSomeLane(updateLanes, renderLanes)) { + var a, b, currentChild = current.child; + if (a = updateLanes, b = renderLanes, (a & b) == 0) { var prevProps = currentChild.memoizedProps, compare = Component.compare; if ((compare = null !== compare ? compare : shallowEqual)(prevProps, nextProps) && current.ref === workInProgress.ref) return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } @@ -6290,7 +6287,7 @@ } function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) { if (workInProgress.type !== workInProgress.elementType) { - var outerMemoType = workInProgress.elementType; + var a, b, outerMemoType = workInProgress.elementType; if (outerMemoType.$$typeof === REACT_LAZY_TYPE) { var lazyComponent = outerMemoType, payload = lazyComponent._payload, init = lazyComponent._init; try { @@ -6303,7 +6300,7 @@ } } if (null !== current && shallowEqual(current.memoizedProps, nextProps) && current.ref === workInProgress.ref && workInProgress.type === current.type) { - if (didReceiveUpdate = !1, !includesSomeLane(renderLanes, updateLanes)) return workInProgress.lanes = current.lanes, bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + if (didReceiveUpdate = !1, a = renderLanes, (a & (b = updateLanes)) == 0) return workInProgress.lanes = current.lanes, bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); (16384 & current.flags) != 0 && (didReceiveUpdate = !0); } return updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes); @@ -6312,17 +6309,19 @@ var a, _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) workInProgress.memoizedState = { - baseLanes: NoLanes + baseLanes: 0 }, pushRenderLanes(workInProgress, renderLanes); - else if (includesSomeLane(renderLanes, 1073741824)) workInProgress.memoizedState = { - baseLanes: NoLanes - }, pushRenderLanes(workInProgress, null !== prevState ? prevState.baseLanes : renderLanes); else { - nextBaseLanes = null !== prevState ? (a1 = prevState.baseLanes) | renderLanes : renderLanes, markSpawnedWork(1073741824), workInProgress.lanes = workInProgress.childLanes = 1073741824; - var nextBaseLanes, a1, _nextState = { - baseLanes: nextBaseLanes - }; - return workInProgress.memoizedState = _nextState, pushRenderLanes(workInProgress, nextBaseLanes), null; + if ((1073741824 & (a1 = renderLanes)) != 0) workInProgress.memoizedState = { + baseLanes: 0 + }, pushRenderLanes(workInProgress, null !== prevState ? prevState.baseLanes : renderLanes); + else { + nextBaseLanes = null !== prevState ? (a2 = prevState.baseLanes) | renderLanes : renderLanes, markSpawnedWork(1073741824), workInProgress.lanes = workInProgress.childLanes = 1073741824; + var a1, nextBaseLanes, a2, _nextState = { + baseLanes: nextBaseLanes + }; + return workInProgress.memoizedState = _nextState, pushRenderLanes(workInProgress, nextBaseLanes), null; + } } } else null !== prevState ? (_subtreeRenderLanes = (a = prevState.baseLanes) | renderLanes, workInProgress.memoizedState = null) : _subtreeRenderLanes = renderLanes, pushRenderLanes(workInProgress, _subtreeRenderLanes); return reconcileChildren(current, workInProgress, nextChildren, renderLanes), workInProgress.child; @@ -6490,7 +6489,7 @@ mode: "hidden", children: primaryChildren }; - return (2 & mode) == 0 && null !== progressedPrimaryFragment ? ((primaryChildFragment = progressedPrimaryFragment).childLanes = NoLanes, primaryChildFragment.pendingProps = primaryChildProps, 8 & workInProgress.mode && (primaryChildFragment.actualDuration = 0, primaryChildFragment.actualStartTime = -1, primaryChildFragment.selfBaseDuration = 0, primaryChildFragment.treeBaseDuration = 0), fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null)) : (primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, NoLanes, null), fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null)), primaryChildFragment.return = workInProgress, fallbackChildFragment.return = workInProgress, primaryChildFragment.sibling = fallbackChildFragment, workInProgress.child = primaryChildFragment, fallbackChildFragment; + return (2 & mode) == 0 && null !== progressedPrimaryFragment ? ((primaryChildFragment = progressedPrimaryFragment).childLanes = 0, primaryChildFragment.pendingProps = primaryChildProps, 8 & workInProgress.mode && (primaryChildFragment.actualDuration = 0, primaryChildFragment.actualStartTime = -1, primaryChildFragment.selfBaseDuration = 0, primaryChildFragment.treeBaseDuration = 0), fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null)) : (primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, 0, null), fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null)), primaryChildFragment.return = workInProgress, fallbackChildFragment.return = workInProgress, primaryChildFragment.sibling = fallbackChildFragment, workInProgress.child = primaryChildFragment, fallbackChildFragment; } function updateSuspensePrimaryChildren(current, workInProgress, primaryChildren, renderLanes) { var current1, offscreenProps, currentPrimaryChildFragment = current.child, currentFallbackChildFragment = currentPrimaryChildFragment.sibling, primaryChildFragment = (current1 = currentPrimaryChildFragment, offscreenProps = { @@ -6505,7 +6504,7 @@ children: primaryChildren }; if ((2 & mode) == 0 && workInProgress.child !== currentPrimaryChildFragment) { - (primaryChildFragment = workInProgress.child).childLanes = NoLanes, primaryChildFragment.pendingProps = primaryChildProps, 8 & workInProgress.mode && (primaryChildFragment.actualDuration = 0, primaryChildFragment.actualStartTime = -1, primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration, primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration); + (primaryChildFragment = workInProgress.child).childLanes = 0, primaryChildFragment.pendingProps = primaryChildProps, 8 & workInProgress.mode && (primaryChildFragment.actualDuration = 0, primaryChildFragment.actualStartTime = -1, primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration, primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration); var progressedLastEffect = primaryChildFragment.lastEffect; null !== progressedLastEffect ? (workInProgress.firstEffect = primaryChildFragment.firstEffect, workInProgress.lastEffect = progressedLastEffect, progressedLastEffect.nextEffect = null) : workInProgress.firstEffect = workInProgress.lastEffect = null; } else primaryChildFragment = createWorkInProgress(current1 = currentPrimaryChildFragment, primaryChildProps); @@ -6625,7 +6624,8 @@ didReceiveUpdate = !0; } function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) { - return (null !== current && (workInProgress.dependencies = current.dependencies), profilerStartTime = -1, markSkippedUpdateLanes(workInProgress.lanes), includesSomeLane(renderLanes, workInProgress.childLanes)) ? (!function(current, workInProgress) { + var a, b; + return (null !== current && (workInProgress.dependencies = current.dependencies), profilerStartTime = -1, markSkippedUpdateLanes(workInProgress.lanes), ((a = renderLanes) & workInProgress.childLanes) != 0) ? (!function(current, workInProgress) { if (!(null === current || workInProgress.child === current.child)) throw Error("Resuming work not yet implemented."); if (null !== workInProgress.child) { var currentChild = workInProgress.child, newChild = createWorkInProgress(currentChild, currentChild.pendingProps); @@ -6651,7 +6651,7 @@ }(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes)); if (null !== current) { if (current.memoizedProps !== workInProgress.pendingProps || hasContextChanged() || workInProgress.type !== current.type) didReceiveUpdate = !0; - else if (includesSomeLane(renderLanes, updateLanes)) didReceiveUpdate = (16384 & current.flags) != 0; + else if (a = renderLanes, (a & (b = updateLanes)) != 0) didReceiveUpdate = (16384 & current.flags) != 0; else { switch(didReceiveUpdate = !1, workInProgress.tag){ case 3: @@ -6671,22 +6671,22 @@ pushProvider(workInProgress, newValue); break; case 12: - includesSomeLane(renderLanes, workInProgress.childLanes) && (workInProgress.flags |= 4); - var stateNode = workInProgress.stateNode; + a1 = renderLanes, (a1 & (b1 = workInProgress.childLanes)) != 0 && (workInProgress.flags |= 4); + var a, b, a1, b1, stateNode = workInProgress.stateNode; stateNode.effectDuration = 0, stateNode.passiveEffectDuration = 0; break; case 13: if (null !== workInProgress.memoizedState) { - if (includesSomeLane(renderLanes, workInProgress.child.childLanes)) return updateSuspenseComponent(current, workInProgress, renderLanes); + if (a2 = renderLanes, (a2 & (b2 = workInProgress.child.childLanes)) != 0) return updateSuspenseComponent(current, workInProgress, renderLanes); pushSuspenseContext(workInProgress, 1 & suspenseStackCursor.current); - var parentContext, parentContext1, child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + var a2, b2, parentContext, parentContext1, child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); if (null !== child) return child.sibling; return null; } pushSuspenseContext(workInProgress, 1 & suspenseStackCursor.current); break; case 19: - var didSuspendBefore = (64 & current.flags) != 0, _hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); + var a3, b3, didSuspendBefore = (64 & current.flags) != 0, _hasChildWork = (a3 = renderLanes, (a3 & (b3 = workInProgress.childLanes)) != 0); if (didSuspendBefore) { if (_hasChildWork) return updateSuspenseListComponent(current, workInProgress, renderLanes); workInProgress.flags |= 64; @@ -6696,12 +6696,12 @@ break; case 23: case 24: - return workInProgress.lanes = NoLanes, updateOffscreenComponent(current, workInProgress, renderLanes); + return workInProgress.lanes = 0, updateOffscreenComponent(current, workInProgress, renderLanes); } return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } } else didReceiveUpdate = !1; - switch(workInProgress.lanes = NoLanes, workInProgress.tag){ + switch(workInProgress.lanes = 0, workInProgress.tag){ case 2: return function(_current, workInProgress, Component, renderLanes) { null !== _current && (_current.alternate = null, workInProgress.alternate = null, workInProgress.flags |= 2); @@ -7418,10 +7418,10 @@ markFailedErrorBoundaryForHotReloading(fiber), "function" != typeof getDerivedStateFromError && (instance = this, null === legacyErrorBoundariesThatAlreadyFailed ? legacyErrorBoundariesThatAlreadyFailed = new Set([ instance ]) : legacyErrorBoundariesThatAlreadyFailed.add(instance), logCapturedError(fiber, errorInfo)); - var instance, error$1 = errorInfo.value, stack = errorInfo.stack; + var instance, a, error$1 = errorInfo.value, stack = errorInfo.stack; this.componentDidCatch(error$1, { componentStack: null !== stack ? stack : "" - }), "function" == typeof getDerivedStateFromError || includesSomeLane(fiber.lanes, SyncLane) || error("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.", getComponentName(fiber.type) || "Unknown"); + }), "function" == typeof getDerivedStateFromError || (1 & (a = fiber.lanes)) != 0 || error("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.", getComponentName(fiber.type) || "Unknown"); } : update.callback = function() { markFailedErrorBoundaryForHotReloading(fiber); }, update; @@ -7453,11 +7453,11 @@ if (_workInProgress.flags |= 64, sourceFiber.flags |= 16384, sourceFiber.flags &= -2981, 1 === sourceFiber.tag) { if (null === sourceFiber.alternate) sourceFiber.tag = 17; else { - var a, b, update = createUpdate(-1, SyncLane); + var a, update = createUpdate(-1, 1); update.tag = 2, enqueueUpdate(sourceFiber, update); } } - sourceFiber.lanes = (a = sourceFiber.lanes, b = SyncLane, a | b); + sourceFiber.lanes = 1 | sourceFiber.lanes; return; } attachPingListener(root, wakeable, rootRenderLanes), _workInProgress.flags |= 4096, _workInProgress.lanes = rootRenderLanes; @@ -7474,8 +7474,8 @@ case 3: var _errorInfo = value; workInProgress.flags |= 4096; - var a1, b1, lane = pickArbitraryLane(rootRenderLanes); - workInProgress.lanes = (a1 = workInProgress.lanes, b1 = lane, a1 | b1); + var a1, b, lane = pickArbitraryLane(rootRenderLanes); + workInProgress.lanes = (a1 = workInProgress.lanes, b = lane, a1 | b); var _update = createRootErrorUpdate(workInProgress, _errorInfo, lane); enqueueCapturedUpdate(workInProgress, _update); return; @@ -7483,8 +7483,8 @@ var errorInfo = value, ctor = workInProgress.type, instance = workInProgress.stateNode; if ((64 & workInProgress.flags) == 0 && ("function" == typeof ctor.getDerivedStateFromError || null !== instance && "function" == typeof instance.componentDidCatch && !isAlreadyFailedLegacyErrorBoundary(instance))) { workInProgress.flags |= 4096; - var a2, b2, _lane = pickArbitraryLane(rootRenderLanes); - workInProgress.lanes = (a2 = workInProgress.lanes, b2 = _lane, a2 | b2); + var a2, b1, _lane = pickArbitraryLane(rootRenderLanes); + workInProgress.lanes = (a2 = workInProgress.lanes, b1 = _lane, a2 | b1); var _update2 = createClassErrorUpdate(workInProgress, errorInfo, _lane); enqueueCapturedUpdate(workInProgress, _update2); return; @@ -7931,19 +7931,19 @@ var symbolFor$1 = Symbol.for; symbolFor$1("selector.component"), symbolFor$1("selector.has_pseudo_class"), symbolFor$1("selector.role"), symbolFor$1("selector.test_id"), symbolFor$1("selector.text"); } - var commitHooks = [], ceil = Math.ceil, ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing, executionContext = 0, workInProgressRoot = null, workInProgress = null, workInProgressRootRenderLanes = NoLanes, subtreeRenderLanes = NoLanes, subtreeRenderLanesCursor = createCursor(NoLanes), workInProgressRootExitStatus = 0, workInProgressRootFatalError = null, workInProgressRootIncludedLanes = NoLanes, workInProgressRootSkippedLanes = NoLanes, workInProgressRootUpdatedLanes = NoLanes, workInProgressRootPingedLanes = NoLanes, mostRecentlyUpdatedRoot = null, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = 1 / 0; + var commitHooks = [], ceil = Math.ceil, ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing, executionContext = 0, workInProgressRoot = null, workInProgress = null, workInProgressRootRenderLanes = 0, subtreeRenderLanes = 0, subtreeRenderLanesCursor = createCursor(0), workInProgressRootExitStatus = 0, workInProgressRootFatalError = null, workInProgressRootIncludedLanes = 0, workInProgressRootSkippedLanes = 0, workInProgressRootUpdatedLanes = 0, workInProgressRootPingedLanes = 0, mostRecentlyUpdatedRoot = null, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = 1 / 0; function resetRenderTimer() { workInProgressRootRenderTargetTime = now() + 500; } - var nextEffect = null, hasUncaughtError = !1, firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, pendingPassiveEffectsRenderPriority = 90, pendingPassiveEffectsLanes = NoLanes, pendingPassiveHookEffectsMount = [], pendingPassiveHookEffectsUnmount = [], rootsWithPendingDiscreteUpdates = null, nestedUpdateCount = 0, rootWithNestedUpdates = null, nestedPassiveUpdateCount = 0, spawnedWorkDuringRender = null, currentEventTime = -1, currentEventWipLanes = NoLanes, currentEventPendingLanes = NoLanes, isFlushingPassiveEffects = !1, focusedInstanceHandle = null, shouldFireAfterActiveInstanceBlur = !1; + var nextEffect = null, hasUncaughtError = !1, firstUncaughtError = null, legacyErrorBoundariesThatAlreadyFailed = null, rootDoesHavePassiveEffects = !1, rootWithPendingPassiveEffects = null, pendingPassiveEffectsRenderPriority = 90, pendingPassiveEffectsLanes = 0, pendingPassiveHookEffectsMount = [], pendingPassiveHookEffectsUnmount = [], rootsWithPendingDiscreteUpdates = null, nestedUpdateCount = 0, rootWithNestedUpdates = null, nestedPassiveUpdateCount = 0, spawnedWorkDuringRender = null, currentEventTime = -1, currentEventWipLanes = 0, currentEventPendingLanes = 0, isFlushingPassiveEffects = !1, focusedInstanceHandle = null, shouldFireAfterActiveInstanceBlur = !1; function requestEventTime() { return (48 & executionContext) != 0 ? now() : -1 !== currentEventTime ? currentEventTime : currentEventTime = now(); } function requestUpdateLane(fiber) { - var wipLanes, pendingLanes, lane, lane1, mode = fiber.mode; - if ((2 & mode) == 0) return SyncLane; - if ((4 & mode) == 0) return 99 === getCurrentPriorityLevel() ? SyncLane : 2; - if (currentEventWipLanes === NoLanes && (currentEventWipLanes = workInProgressRootIncludedLanes), 0 !== ReactCurrentBatchConfig.transition) return currentEventPendingLanes !== NoLanes && (currentEventPendingLanes = null !== mostRecentlyUpdatedRoot ? mostRecentlyUpdatedRoot.pendingLanes : NoLanes), wipLanes = currentEventWipLanes, pendingLanes = currentEventPendingLanes, 0 === (lane = pickArbitraryLane(4186112 & ~pendingLanes)) && 0 === (lane = pickArbitraryLane(4186112 & ~wipLanes)) && (lane = pickArbitraryLane(4186112)), lane; + var wipLanes, lane, lane1, mode = fiber.mode; + if ((2 & mode) == 0) return 1; + if ((4 & mode) == 0) return 99 === getCurrentPriorityLevel() ? 1 : 2; + if (0 === currentEventWipLanes && (currentEventWipLanes = workInProgressRootIncludedLanes), 0 !== ReactCurrentBatchConfig.transition) return 0 !== currentEventPendingLanes && (currentEventPendingLanes = null !== mostRecentlyUpdatedRoot ? mostRecentlyUpdatedRoot.pendingLanes : 0), wipLanes = currentEventWipLanes, 0 === (lane = pickArbitraryLane(4186112 & ~currentEventPendingLanes)) && 0 === (lane = pickArbitraryLane(4186112 & ~wipLanes)) && (lane = pickArbitraryLane(4186112)), lane; var schedulerPriority = getCurrentPriorityLevel(); return (4 & executionContext) != 0 && 98 === schedulerPriority ? findUpdateLane(12, currentEventWipLanes) : findUpdateLane(function(schedulerPriorityLevel) { switch(schedulerPriorityLevel){ @@ -8005,7 +8005,7 @@ }(fiber), null; markRootUpdated(root, lane, eventTime), root === workInProgressRoot && (workInProgressRootUpdatedLanes = (a = workInProgressRootUpdatedLanes, b = lane, a | b), 4 === workInProgressRootExitStatus && markRootSuspended$1(root, workInProgressRootRenderLanes)); var priorityLevel = getCurrentPriorityLevel(); - lane === SyncLane ? (8 & executionContext) != 0 && (48 & executionContext) == 0 ? (schedulePendingInteractions(root, lane), performSyncWorkOnRoot(root)) : (ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, lane), 0 === executionContext && (resetRenderTimer(), flushSyncCallbackQueue())) : ((4 & executionContext) != 0 && (98 === priorityLevel || 99 === priorityLevel) && (null === rootsWithPendingDiscreteUpdates ? rootsWithPendingDiscreteUpdates = new Set([ + 1 === lane ? (8 & executionContext) != 0 && (48 & executionContext) == 0 ? (schedulePendingInteractions(root, lane), performSyncWorkOnRoot(root)) : (ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, lane), 0 === executionContext && (resetRenderTimer(), flushSyncCallbackQueue())) : ((4 & executionContext) != 0 && (98 === priorityLevel || 99 === priorityLevel) && (null === rootsWithPendingDiscreteUpdates ? rootsWithPendingDiscreteUpdates = new Set([ root ]) : rootsWithPendingDiscreteUpdates.add(root)), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, lane)), mostRecentlyUpdatedRoot = root; } @@ -8021,11 +8021,11 @@ !function(root, currentTime) { for(var pendingLanes = root.pendingLanes, suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, lanes = pendingLanes; lanes > 0;){ var index = pickArbitraryLaneIndex(lanes), lane = 1 << index, expirationTime = expirationTimes[index]; - -1 === expirationTime ? ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) && (expirationTimes[index] = computeExpirationTime(lane, currentTime)) : expirationTime <= currentTime && (root.expiredLanes |= lane), lanes &= ~lane; + -1 === expirationTime ? ((lane & suspendedLanes) == 0 || (lane & pingedLanes) != 0) && (expirationTimes[index] = computeExpirationTime(lane, currentTime)) : expirationTime <= currentTime && (root.expiredLanes |= lane), lanes &= ~lane; } }(root, currentTime); - var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes), newCallbackPriority = return_highestLanePriority; - if (nextLanes === NoLanes) { + var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : 0), newCallbackPriority = return_highestLanePriority; + if (0 === nextLanes) { null !== existingCallbackNode && (cancelCallback(existingCallbackNode), root.callbackNode = null, root.callbackPriority = 0); return; } @@ -8064,12 +8064,12 @@ }(newCallbackPriority), performConcurrentWorkOnRoot.bind(null, root)), root.callbackPriority = newCallbackPriority, root.callbackNode = newCallbackNode; } function performConcurrentWorkOnRoot(root) { - if (currentEventTime = -1, currentEventWipLanes = NoLanes, currentEventPendingLanes = NoLanes, (48 & executionContext) != 0) throw Error("Should not already be working."); + if (currentEventTime = -1, currentEventWipLanes = 0, currentEventPendingLanes = 0, (48 & executionContext) != 0) throw Error("Should not already be working."); var originalCallbackNode = root.callbackNode; if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode) return null; - var lanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); - if (lanes === NoLanes) return null; - var exitStatus = function(root, lanes) { + var lanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : 0); + if (0 === lanes) return null; + var a, b, exitStatus = function(root, lanes) { var prevExecutionContext = executionContext; executionContext |= 16; var prevDispatcher = pushDispatcher(); @@ -8080,13 +8080,13 @@ } catch (thrownValue) { handleError(root, thrownValue); } - return (resetContextDependencies(), popInteractions(prevInteractions), popDispatcher(prevDispatcher), executionContext = prevExecutionContext, null !== workInProgress) ? 0 : (workInProgressRoot = null, workInProgressRootRenderLanes = NoLanes, workInProgressRootExitStatus); + return (resetContextDependencies(), popInteractions(prevInteractions), popDispatcher(prevDispatcher), executionContext = prevExecutionContext, null !== workInProgress) ? 0 : (workInProgressRoot = null, workInProgressRootRenderLanes = 0, workInProgressRootExitStatus); }(root, lanes); - if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) prepareFreshStack(root, NoLanes); + if (a = workInProgressRootIncludedLanes, (a & (b = workInProgressRootUpdatedLanes)) != 0) prepareFreshStack(root, 0); else if (0 !== exitStatus) { - if (2 === exitStatus && (executionContext |= 64, root.hydrate && (root.hydrate = !1, clearContainer(root.containerInfo)), (lanes = getLanesToRetrySynchronouslyOnError(root)) !== NoLanes && (exitStatus = renderRootSync(root, lanes))), 1 === exitStatus) { + if (2 === exitStatus && (executionContext |= 64, root.hydrate && (root.hydrate = !1, clearContainer(root.containerInfo)), 0 !== (lanes = getLanesToRetrySynchronouslyOnError(root)) && (exitStatus = renderRootSync(root, lanes))), 1 === exitStatus) { var fatalError = workInProgressRootFatalError; - throw prepareFreshStack(root, NoLanes), markRootSuspended$1(root, lanes), ensureRootIsScheduled(root, now()), fatalError; + throw prepareFreshStack(root, 0), markRootSuspended$1(root, lanes), ensureRootIsScheduled(root, now()), fatalError; } var finishedWork = root.current.alternate; root.finishedWork = finishedWork, root.finishedLanes = lanes, function(root, exitStatus, lanes) { @@ -8102,7 +8102,7 @@ if (markRootSuspended$1(root, lanes), includesOnlyRetries(lanes) && !shouldForceFlushFallbacksInDEV()) { var lanes1, msUntilTimeout = globalMostRecentFallbackTime + 500 - now(); if (msUntilTimeout > 10) { - if (getNextLanes(root, NoLanes) !== NoLanes) break; + if (0 !== getNextLanes(root, 0)) break; var suspendedLanes = root.suspendedLanes; if (!isSubsetOfLanes(suspendedLanes, lanes)) { requestEventTime(), markRootPinged(root, suspendedLanes); @@ -8139,20 +8139,20 @@ return (ensureRootIsScheduled(root, now()), root.callbackNode === originalCallbackNode) ? performConcurrentWorkOnRoot.bind(null, root) : null; } function markRootSuspended$1(root, suspendedLanes) { - var set, subset, set1, subset1; - suspendedLanes = (set1 = suspendedLanes = (set = suspendedLanes, subset = workInProgressRootPingedLanes, set & ~subset), subset1 = workInProgressRootUpdatedLanes, set1 & ~subset1), function(root, suspendedLanes) { + var set, set1; + !function(root, suspendedLanes) { root.suspendedLanes |= suspendedLanes, root.pingedLanes &= ~suspendedLanes; for(var expirationTimes = root.expirationTimes, lanes = suspendedLanes; lanes > 0;){ var index = pickArbitraryLaneIndex(lanes), lane = 1 << index; expirationTimes[index] = -1, lanes &= ~lane; } - }(root, suspendedLanes); + }(root, suspendedLanes = (set1 = suspendedLanes = (set = suspendedLanes) & ~workInProgressRootPingedLanes) & ~workInProgressRootUpdatedLanes); } function performSyncWorkOnRoot(root) { if ((48 & executionContext) != 0) throw Error("Should not already be working."); - if (flushPassiveEffects(), root === workInProgressRoot && includesSomeLane(root.expiredLanes, workInProgressRootRenderLanes) ? (lanes = workInProgressRootRenderLanes, exitStatus = renderRootSync(root, lanes), includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes) && (lanes = getNextLanes(root, lanes), exitStatus = renderRootSync(root, lanes))) : (lanes = getNextLanes(root, NoLanes), exitStatus = renderRootSync(root, lanes)), 0 !== root.tag && 2 === exitStatus && (executionContext |= 64, root.hydrate && (root.hydrate = !1, clearContainer(root.containerInfo)), (lanes = getLanesToRetrySynchronouslyOnError(root)) !== NoLanes && (exitStatus = renderRootSync(root, lanes))), 1 === exitStatus) { - var lanes, exitStatus, fatalError = workInProgressRootFatalError; - throw prepareFreshStack(root, NoLanes), markRootSuspended$1(root, lanes), ensureRootIsScheduled(root, now()), fatalError; + if (flushPassiveEffects(), root === workInProgressRoot && (a = root.expiredLanes, b = workInProgressRootRenderLanes, (a & b) != 0) ? (lanes = workInProgressRootRenderLanes, exitStatus = renderRootSync(root, lanes), a1 = workInProgressRootIncludedLanes, (a1 & (b1 = workInProgressRootUpdatedLanes)) != 0 && (lanes = getNextLanes(root, lanes), exitStatus = renderRootSync(root, lanes))) : (lanes = getNextLanes(root, 0), exitStatus = renderRootSync(root, lanes)), 0 !== root.tag && 2 === exitStatus && (executionContext |= 64, root.hydrate && (root.hydrate = !1, clearContainer(root.containerInfo)), 0 !== (lanes = getLanesToRetrySynchronouslyOnError(root)) && (exitStatus = renderRootSync(root, lanes))), 1 === exitStatus) { + var a, b, a1, b1, lanes, exitStatus, fatalError = workInProgressRootFatalError; + throw prepareFreshStack(root, 0), markRootSuspended$1(root, lanes), ensureRootIsScheduled(root, now()), fatalError; } var finishedWork = root.current.alternate; return root.finishedWork = finishedWork, root.finishedLanes = lanes, commitRoot(root), ensureRootIsScheduled(root, now()), null; @@ -8194,10 +8194,10 @@ subtreeRenderLanes = subtreeRenderLanesCursor.current, pop(subtreeRenderLanesCursor, fiber); } function prepareFreshStack(root, lanes) { - root.finishedWork = null, root.finishedLanes = NoLanes; + root.finishedWork = null, root.finishedLanes = 0; var timeoutHandle = root.timeoutHandle; if (-1 !== timeoutHandle && (root.timeoutHandle = -1, cancelTimeout(timeoutHandle)), null !== workInProgress) for(var interruptedWork = workInProgress.return; null !== interruptedWork;)unwindInterruptedWork(interruptedWork), interruptedWork = interruptedWork.return; - workInProgressRoot = root, workInProgress = createWorkInProgress(root.current, null), workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes, workInProgressRootExitStatus = 0, workInProgressRootFatalError = null, workInProgressRootSkippedLanes = NoLanes, workInProgressRootUpdatedLanes = NoLanes, workInProgressRootPingedLanes = NoLanes, spawnedWorkDuringRender = null, ReactStrictModeWarnings.discardPendingWarnings(); + workInProgressRoot = root, workInProgress = createWorkInProgress(root.current, null), workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes, workInProgressRootExitStatus = 0, workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, workInProgressRootUpdatedLanes = 0, workInProgressRootPingedLanes = 0, spawnedWorkDuringRender = null, ReactStrictModeWarnings.discardPendingWarnings(); } function handleError(root, thrownValue) { for(;;){ @@ -8230,8 +8230,8 @@ __interactionsRef.current = prevInteractions; } function markSkippedUpdateLanes(lane) { - var a, b; - workInProgressRootSkippedLanes = (a = lane, b = workInProgressRootSkippedLanes, a | b); + var a; + workInProgressRootSkippedLanes = (a = lane) | workInProgressRootSkippedLanes; } function renderRootSync(root, lanes) { var prevExecutionContext = executionContext; @@ -8245,7 +8245,7 @@ handleError(root, thrownValue); } if (resetContextDependencies(), popInteractions(prevInteractions), executionContext = prevExecutionContext, popDispatcher(prevDispatcher), null !== workInProgress) throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."); - return workInProgressRoot = null, workInProgressRootRenderLanes = NoLanes, workInProgressRootExitStatus; + return workInProgressRoot = null, workInProgressRootRenderLanes = 0, workInProgressRootExitStatus; } function workLoopSync() { for(; null !== workInProgress;)performUnitOfWork(workInProgress); @@ -8292,16 +8292,17 @@ 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5); } function resetChildLanes(completedWork) { - if (24 !== completedWork.tag && 23 !== completedWork.tag || null === completedWork.memoizedState || includesSomeLane(subtreeRenderLanes, 1073741824) || (4 & completedWork.mode) === NoLanes) { - var newChildLanes = NoLanes; + var a; + if (24 !== completedWork.tag && 23 !== completedWork.tag || null === completedWork.memoizedState || (1073741824 & (a = subtreeRenderLanes)) != 0 || (4 & completedWork.mode) == 0) { + var newChildLanes = 0; if ((8 & completedWork.mode) != 0) { - for(var a, b, a1, b1, actualDuration = completedWork.actualDuration, treeBaseDuration = completedWork.selfBaseDuration, shouldBubbleActualDurations = null === completedWork.alternate || completedWork.child !== completedWork.alternate.child, child = completedWork.child; null !== child;)newChildLanes = (a1 = newChildLanes) | ((a = child.lanes) | child.childLanes), shouldBubbleActualDurations && (actualDuration += child.actualDuration), treeBaseDuration += child.treeBaseDuration, child = child.sibling; + for(var a1, b, a2, b1, actualDuration = completedWork.actualDuration, treeBaseDuration = completedWork.selfBaseDuration, shouldBubbleActualDurations = null === completedWork.alternate || completedWork.child !== completedWork.alternate.child, child = completedWork.child; null !== child;)newChildLanes = (a2 = newChildLanes) | ((a1 = child.lanes) | child.childLanes), shouldBubbleActualDurations && (actualDuration += child.actualDuration), treeBaseDuration += child.treeBaseDuration, child = child.sibling; if (13 === completedWork.tag && null !== completedWork.memoizedState) { var primaryChildFragment = completedWork.child; null !== primaryChildFragment && (treeBaseDuration -= primaryChildFragment.treeBaseDuration); } completedWork.actualDuration = actualDuration, completedWork.treeBaseDuration = treeBaseDuration; - } else for(var a2, b2, a3, b3, _child = completedWork.child; null !== _child;)newChildLanes = (a3 = newChildLanes) | ((a2 = _child.lanes) | _child.childLanes), _child = _child.sibling; + } else for(var a3, b2, a4, b3, _child = completedWork.child; null !== _child;)newChildLanes = (a4 = newChildLanes) | ((a3 = _child.lanes) | _child.childLanes), _child = _child.sibling; completedWork.childLanes = newChildLanes; } } @@ -8315,7 +8316,7 @@ if (ReactStrictModeWarnings.flushLegacyContextWarning(), ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(), (48 & executionContext) != 0) throw Error("Should not already be working."); var firstEffect, finishedWork = root.finishedWork, lanes = root.finishedLanes; if (null === finishedWork) return null; - if (root.finishedWork = null, root.finishedLanes = NoLanes, !(finishedWork !== root.current)) throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."); + if (root.finishedWork = null, root.finishedLanes = 0, !(finishedWork !== root.current)) throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."); root.callbackNode = null; var remainingLanes = (a = finishedWork.lanes) | finishedWork.childLanes; if (!function(root, remainingLanes) { @@ -8323,9 +8324,9 @@ root.pendingLanes = remainingLanes, root.suspendedLanes = 0, root.pingedLanes = 0, root.expiredLanes &= remainingLanes, root.mutableReadLanes &= remainingLanes, root.entangledLanes &= remainingLanes; for(var entanglements = root.entanglements, eventTimes = root.eventTimes, expirationTimes = root.expirationTimes, lanes = noLongerPendingLanes; lanes > 0;){ var index = pickArbitraryLaneIndex(lanes), lane = 1 << index; - entanglements[index] = NoLanes, eventTimes[index] = -1, expirationTimes[index] = -1, lanes &= ~lane; + entanglements[index] = 0, eventTimes[index] = -1, expirationTimes[index] = -1, lanes &= ~lane; } - }(root, remainingLanes), null !== rootsWithPendingDiscreteUpdates && (24 & remainingLanes) === NoLanes && rootsWithPendingDiscreteUpdates.has(root) && rootsWithPendingDiscreteUpdates.delete(root), root === workInProgressRoot && (workInProgressRoot = null, workInProgress = null, workInProgressRootRenderLanes = NoLanes), finishedWork.flags > 1 ? null !== finishedWork.lastEffect ? (finishedWork.lastEffect.nextEffect = finishedWork, firstEffect = finishedWork.firstEffect) : firstEffect = finishedWork : firstEffect = finishedWork.firstEffect, null !== firstEffect) { + }(root, remainingLanes), null !== rootsWithPendingDiscreteUpdates && (24 & remainingLanes) == 0 && rootsWithPendingDiscreteUpdates.has(root) && rootsWithPendingDiscreteUpdates.delete(root), root === workInProgressRoot && (workInProgressRoot = null, workInProgress = null, workInProgressRootRenderLanes = 0), finishedWork.flags > 1 ? null !== finishedWork.lastEffect ? (finishedWork.lastEffect.nextEffect = finishedWork, firstEffect = finishedWork.firstEffect) : firstEffect = finishedWork : firstEffect = finishedWork.firstEffect, null !== firstEffect) { var a, b, prevExecutionContext = executionContext; executionContext |= 32; var focusedElem, input, prevInteractions = pushInteractions(root); @@ -8421,7 +8422,7 @@ var nextNextEffect = nextEffect.nextEffect; nextEffect.nextEffect = null, 8 & nextEffect.flags && detachFiberAfterEffects(nextEffect), nextEffect = nextNextEffect; } - if ((remainingLanes = root.pendingLanes) !== NoLanes) { + if (0 !== (remainingLanes = root.pendingLanes)) { if (null !== spawnedWorkDuringRender) { var expirationTimes = spawnedWorkDuringRender; spawnedWorkDuringRender = null; @@ -8429,7 +8430,7 @@ } schedulePendingInteractions(root, remainingLanes); } else legacyErrorBoundariesThatAlreadyFailed = null; - if (rootDidHavePassiveEffects || finishPendingInteractions(root, lanes), remainingLanes === SyncLane ? root === rootWithNestedUpdates ? nestedUpdateCount++ : (nestedUpdateCount = 0, rootWithNestedUpdates = root) : nestedUpdateCount = 0, !function(root, priorityLevel) { + if (rootDidHavePassiveEffects || finishPendingInteractions(root, lanes), 1 === remainingLanes ? root === rootWithNestedUpdates ? nestedUpdateCount++ : (nestedUpdateCount = 0, rootWithNestedUpdates = root) : nestedUpdateCount = 0, !function(root, priorityLevel) { if (injectedHook && "function" == typeof injectedHook.onCommitFiberRoot) try { var didError = (64 & root.current.flags) == 64; injectedHook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); @@ -8450,7 +8451,7 @@ var current = nextEffect.alternate; !shouldFireAfterActiveInstanceBlur && null !== focusedInstanceHandle && ((8 & nextEffect.flags) != 0 ? doesFiberContain(nextEffect, focusedInstanceHandle) && (shouldFireAfterActiveInstanceBlur = !0) : 13 === nextEffect.tag && isSuspenseBoundaryBeingHidden(current, nextEffect) && doesFiberContain(nextEffect, focusedInstanceHandle) && (shouldFireAfterActiveInstanceBlur = !0)); var flags = nextEffect.flags; - (256 & flags) != 0 && (setCurrentFiber(nextEffect), commitBeforeMutationLifeCycles(current, nextEffect), resetCurrentFiber()), (512 & flags) == 0 || rootDoesHavePassiveEffects || (rootDoesHavePassiveEffects = !0, scheduleCallback(NormalPriority$1, function() { + (256 & flags) != 0 && (setCurrentFiber(nextEffect), commitBeforeMutationLifeCycles(current, nextEffect), resetCurrentFiber()), (512 & flags) == 0 || rootDoesHavePassiveEffects || (rootDoesHavePassiveEffects = !0, scheduleCallback(97, function() { return flushPassiveEffects(), null; })), nextEffect = nextEffect.nextEffect; } @@ -8495,20 +8496,20 @@ } function flushPassiveEffects() { if (90 !== pendingPassiveEffectsRenderPriority) { - var priorityLevel = pendingPassiveEffectsRenderPriority > NormalPriority$1 ? NormalPriority$1 : pendingPassiveEffectsRenderPriority; + var priorityLevel = pendingPassiveEffectsRenderPriority > 97 ? 97 : pendingPassiveEffectsRenderPriority; return pendingPassiveEffectsRenderPriority = 90, runWithPriority$1(priorityLevel, flushPassiveEffectsImpl); } return !1; } function enqueuePendingPassiveHookEffectMount(fiber, effect) { - pendingPassiveHookEffectsMount.push(effect, fiber), rootDoesHavePassiveEffects || (rootDoesHavePassiveEffects = !0, scheduleCallback(NormalPriority$1, function() { + pendingPassiveHookEffectsMount.push(effect, fiber), rootDoesHavePassiveEffects || (rootDoesHavePassiveEffects = !0, scheduleCallback(97, function() { return flushPassiveEffects(), null; })); } function enqueuePendingPassiveHookEffectUnmount(fiber, effect) { pendingPassiveHookEffectsUnmount.push(effect, fiber), fiber.flags |= 8192; var alternate = fiber.alternate; - null !== alternate && (alternate.flags |= 8192), rootDoesHavePassiveEffects || (rootDoesHavePassiveEffects = !0, scheduleCallback(NormalPriority$1, function() { + null !== alternate && (alternate.flags |= 8192), rootDoesHavePassiveEffects || (rootDoesHavePassiveEffects = !0, scheduleCallback(97, function() { return flushPassiveEffects(), null; })); } @@ -8519,7 +8520,7 @@ function flushPassiveEffectsImpl() { if (null === rootWithPendingPassiveEffects) return !1; var root = rootWithPendingPassiveEffects, lanes = pendingPassiveEffectsLanes; - if (rootWithPendingPassiveEffects = null, pendingPassiveEffectsLanes = NoLanes, (48 & executionContext) != 0) throw Error("Cannot flush passive effects while already rendering."); + if (rootWithPendingPassiveEffects = null, pendingPassiveEffectsLanes = 0, (48 & executionContext) != 0) throw Error("Cannot flush passive effects while already rendering."); isFlushingPassiveEffects = !0; var prevExecutionContext = executionContext; executionContext |= 32; @@ -8560,10 +8561,10 @@ hasUncaughtError || (hasUncaughtError = !0, firstUncaughtError = error); }; function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { - var errorInfo = createCapturedValue(error, sourceFiber), update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); + var errorInfo = createCapturedValue(error, sourceFiber), update = createRootErrorUpdate(rootFiber, errorInfo, 1); enqueueUpdate(rootFiber, update); - var eventTime = requestEventTime(), root = markUpdateLaneFromFiberToRoot(rootFiber, SyncLane); - null !== root && (markRootUpdated(root, SyncLane, eventTime), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, SyncLane)); + var eventTime = requestEventTime(), root = markUpdateLaneFromFiberToRoot(rootFiber, 1); + null !== root && (markRootUpdated(root, 1, eventTime), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, 1)); } function captureCommitPhaseError(sourceFiber, error) { if (3 === sourceFiber.tag) { @@ -8578,10 +8579,10 @@ if (1 === fiber.tag) { var ctor = fiber.type, instance = fiber.stateNode; if ("function" == typeof ctor.getDerivedStateFromError || "function" == typeof instance.componentDidCatch && !isAlreadyFailedLegacyErrorBoundary(instance)) { - var errorInfo = createCapturedValue(error, sourceFiber), update = createClassErrorUpdate(fiber, errorInfo, SyncLane); + var errorInfo = createCapturedValue(error, sourceFiber), update = createClassErrorUpdate(fiber, errorInfo, 1); enqueueUpdate(fiber, update); - var eventTime = requestEventTime(), root = markUpdateLaneFromFiberToRoot(fiber, SyncLane); - if (null !== root) markRootUpdated(root, SyncLane, eventTime), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, SyncLane); + var eventTime = requestEventTime(), root = markUpdateLaneFromFiberToRoot(fiber, 1); + if (null !== root) markRootUpdated(root, 1, eventTime), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, 1); else if ("function" == typeof instance.componentDidCatch && !isAlreadyFailedLegacyErrorBoundary(instance)) try { instance.componentDidCatch(error, errorInfo); } catch (errorToIgnore) {} @@ -8595,12 +8596,12 @@ var a, pingCache = root.pingCache; null !== pingCache && pingCache.delete(wakeable); var eventTime = requestEventTime(); - markRootPinged(root, pingedLanes), workInProgressRoot === root && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes) && (4 === workInProgressRootExitStatus || 3 === workInProgressRootExitStatus && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < 500 ? prepareFreshStack(root, NoLanes) : workInProgressRootPingedLanes = (a = workInProgressRootPingedLanes) | pingedLanes), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, pingedLanes); + markRootPinged(root, pingedLanes), workInProgressRoot === root && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes) && (4 === workInProgressRootExitStatus || 3 === workInProgressRootExitStatus && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < 500 ? prepareFreshStack(root, 0) : workInProgressRootPingedLanes = (a = workInProgressRootPingedLanes) | pingedLanes), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, pingedLanes); } function resolveRetryWakeable(boundaryFiber, wakeable) { null !== (retryCache = boundaryFiber.stateNode) && retryCache.delete(wakeable); - var retryCache, boundaryFiber1, eventTime, root, fiber, wipLanes, lane, mode, retryLane = 0; - boundaryFiber1 = boundaryFiber, 0 === retryLane && (retryLane = (2 & (mode = (fiber = boundaryFiber1).mode)) == 0 ? SyncLane : (4 & mode) == 0 ? 99 === getCurrentPriorityLevel() ? SyncLane : 2 : (currentEventWipLanes === NoLanes && (currentEventWipLanes = workInProgressRootIncludedLanes), wipLanes = currentEventWipLanes, 0 === (lane = pickArbitraryLane(62914560 & ~wipLanes)) && (lane = pickArbitraryLane(62914560)), lane)), eventTime = requestEventTime(), null !== (root = markUpdateLaneFromFiberToRoot(boundaryFiber1, retryLane)) && (markRootUpdated(root, retryLane, eventTime), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, retryLane)); + var retryCache, boundaryFiber1, eventTime, root, fiber, lane, mode, retryLane = 0; + boundaryFiber1 = boundaryFiber, 0 === retryLane && (retryLane = (2 & (mode = (fiber = boundaryFiber1).mode)) == 0 ? 1 : (4 & mode) == 0 ? 99 === getCurrentPriorityLevel() ? 1 : 2 : (0 === currentEventWipLanes && (currentEventWipLanes = workInProgressRootIncludedLanes), 0 === (lane = pickArbitraryLane(62914560 & ~currentEventWipLanes)) && (lane = pickArbitraryLane(62914560)), lane)), eventTime = requestEventTime(), null !== (root = markUpdateLaneFromFiberToRoot(boundaryFiber1, retryLane)) && (markRootUpdated(root, retryLane, eventTime), ensureRootIsScheduled(root, eventTime), schedulePendingInteractions(root, retryLane)); } var didWarnStateUpdateForNotYetMountedComponent = null; function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { @@ -8691,7 +8692,8 @@ function startWorkOnPendingInteractions(root, lanes) { var interactions = new Set(); if (root.pendingInteractionMap.forEach(function(scheduledInteractions, scheduledLane) { - includesSomeLane(lanes, scheduledLane) && scheduledInteractions.forEach(function(interaction) { + var a, b; + a = lanes, (a & (b = scheduledLane)) != 0 && scheduledInteractions.forEach(function(interaction) { return interactions.add(interaction); }); }), root.memoizedInteractions = interactions, interactions.size > 0) { @@ -8722,7 +8724,8 @@ } finally{ var pendingInteractionMap = root.pendingInteractionMap; pendingInteractionMap.forEach(function(scheduledInteractions, lane) { - includesSomeLane(remainingLanesAfterCommit, lane) || (pendingInteractionMap.delete(lane), scheduledInteractions.forEach(function(interaction) { + var a, b; + a = remainingLanesAfterCommit, (a & (b = lane)) != 0 || (pendingInteractionMap.delete(lane), scheduledInteractions.forEach(function(interaction) { if (interaction.__count--, null !== subscriber && 0 === interaction.__count) try { subscriber.onInteractionScheduledWorkCompleted(interaction); } catch (error) { @@ -8817,7 +8820,7 @@ var family = resolveFamily(candidateType); void 0 !== family && (staleFamilies.has(family) ? needsRemount = !0 : updatedFamilies.has(family) && (1 === tag ? needsRemount = !0 : needsRender = !0)); } - null !== failedBoundaries && (failedBoundaries.has(fiber) || null !== alternate && failedBoundaries.has(alternate)) && (needsRemount = !0), needsRemount && (fiber._debugNeedsRemount = !0), (needsRemount || needsRender) && scheduleUpdateOnFiber(fiber, SyncLane, -1), null === child || needsRemount || scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies), null !== sibling && scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); + null !== failedBoundaries && (failedBoundaries.has(fiber) || null !== alternate && failedBoundaries.has(alternate)) && (needsRemount = !0), needsRemount && (fiber._debugNeedsRemount = !0), (needsRemount || needsRender) && scheduleUpdateOnFiber(fiber, 1, -1), null === child || needsRemount || scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies), null !== sibling && scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); })(root.current, updatedFamilies, staleFamilies); }); } @@ -8881,7 +8884,7 @@ } var debugCounter = 1; function FiberNode(tag, pendingProps, key, mode) { - this.tag = tag, this.key = key, this.elementType = null, this.type = null, this.stateNode = null, this.return = null, this.child = null, this.sibling = null, this.index = 0, this.ref = null, this.pendingProps = pendingProps, this.memoizedProps = null, this.updateQueue = null, this.memoizedState = null, this.dependencies = null, this.mode = mode, this.flags = 0, this.nextEffect = null, this.firstEffect = null, this.lastEffect = null, this.lanes = NoLanes, this.childLanes = NoLanes, this.alternate = null, this.actualDuration = Number.NaN, this.actualStartTime = Number.NaN, this.selfBaseDuration = Number.NaN, this.treeBaseDuration = Number.NaN, this.actualDuration = 0, this.actualStartTime = -1, this.selfBaseDuration = 0, this.treeBaseDuration = 0, this._debugID = debugCounter++, this._debugSource = null, this._debugOwner = null, this._debugNeedsRemount = !1, this._debugHookTypes = null, hasBadMapPolyfill || "function" != typeof Object.preventExtensions || Object.preventExtensions(this); + this.tag = tag, this.key = key, this.elementType = null, this.type = null, this.stateNode = null, this.return = null, this.child = null, this.sibling = null, this.index = 0, this.ref = null, this.pendingProps = pendingProps, this.memoizedProps = null, this.updateQueue = null, this.memoizedState = null, this.dependencies = null, this.mode = mode, this.flags = 0, this.nextEffect = null, this.firstEffect = null, this.lastEffect = null, this.lanes = 0, this.childLanes = 0, this.alternate = null, this.actualDuration = Number.NaN, this.actualStartTime = Number.NaN, this.selfBaseDuration = Number.NaN, this.treeBaseDuration = Number.NaN, this.actualDuration = 0, this.actualStartTime = -1, this.selfBaseDuration = 0, this.treeBaseDuration = 0, this._debugID = debugCounter++, this._debugSource = null, this._debugOwner = null, this._debugNeedsRemount = !1, this._debugHookTypes = null, hasBadMapPolyfill || "function" != typeof Object.preventExtensions || Object.preventExtensions(this); } var createFiber = function(tag, pendingProps, key, mode) { return new FiberNode(tag, pendingProps, key, mode); @@ -8912,7 +8915,7 @@ function resetWorkInProgress(workInProgress, renderLanes) { workInProgress.flags &= 2, workInProgress.nextEffect = null, workInProgress.firstEffect = null, workInProgress.lastEffect = null; var current = workInProgress.alternate; - if (null === current) workInProgress.childLanes = NoLanes, workInProgress.lanes = renderLanes, workInProgress.child = null, workInProgress.memoizedProps = null, workInProgress.memoizedState = null, workInProgress.updateQueue = null, workInProgress.dependencies = null, workInProgress.stateNode = null, workInProgress.selfBaseDuration = 0, workInProgress.treeBaseDuration = 0; + if (null === current) workInProgress.childLanes = 0, workInProgress.lanes = renderLanes, workInProgress.child = null, workInProgress.memoizedProps = null, workInProgress.memoizedState = null, workInProgress.updateQueue = null, workInProgress.dependencies = null, workInProgress.stateNode = null, workInProgress.selfBaseDuration = 0, workInProgress.treeBaseDuration = 0; else { workInProgress.childLanes = current.childLanes, workInProgress.lanes = current.lanes, workInProgress.child = current.child, workInProgress.memoizedProps = current.memoizedProps, workInProgress.memoizedState = current.memoizedState, workInProgress.updateQueue = current.updateQueue, workInProgress.type = current.type; var currentDependencies = current.dependencies; @@ -9008,7 +9011,7 @@ return null === target && (target = createFiber(2, null, null, 0)), target.tag = source.tag, target.key = source.key, target.elementType = source.elementType, target.type = source.type, target.stateNode = source.stateNode, target.return = source.return, target.child = source.child, target.sibling = source.sibling, target.index = source.index, target.ref = source.ref, target.pendingProps = source.pendingProps, target.memoizedProps = source.memoizedProps, target.updateQueue = source.updateQueue, target.memoizedState = source.memoizedState, target.dependencies = source.dependencies, target.mode = source.mode, target.flags = source.flags, target.nextEffect = source.nextEffect, target.firstEffect = source.firstEffect, target.lastEffect = source.lastEffect, target.lanes = source.lanes, target.childLanes = source.childLanes, target.alternate = source.alternate, target.actualDuration = source.actualDuration, target.actualStartTime = source.actualStartTime, target.selfBaseDuration = source.selfBaseDuration, target.treeBaseDuration = source.treeBaseDuration, target._debugID = source._debugID, target._debugSource = source._debugSource, target._debugOwner = source._debugOwner, target._debugNeedsRemount = source._debugNeedsRemount, target._debugHookTypes = source._debugHookTypes, target; } function FiberRootNode(containerInfo, tag, hydrate) { - switch(this.tag = tag, this.containerInfo = containerInfo, this.pendingChildren = null, this.current = null, this.pingCache = null, this.finishedWork = null, this.timeoutHandle = -1, this.context = null, this.pendingContext = null, this.hydrate = hydrate, this.callbackNode = null, this.callbackPriority = 0, this.eventTimes = createLaneMap(NoLanes), this.expirationTimes = createLaneMap(-1), this.pendingLanes = NoLanes, this.suspendedLanes = NoLanes, this.pingedLanes = NoLanes, this.expiredLanes = NoLanes, this.mutableReadLanes = NoLanes, this.finishedLanes = NoLanes, this.entangledLanes = NoLanes, this.entanglements = createLaneMap(NoLanes), this.mutableSourceEagerHydrationData = null, this.interactionThreadID = unstable_getThreadID(), this.memoizedInteractions = new Set(), this.pendingInteractionMap = new Map(), tag){ + switch(this.tag = tag, this.containerInfo = containerInfo, this.pendingChildren = null, this.current = null, this.pingCache = null, this.finishedWork = null, this.timeoutHandle = -1, this.context = null, this.pendingContext = null, this.hydrate = hydrate, this.callbackNode = null, this.callbackPriority = 0, this.eventTimes = createLaneMap(0), this.expirationTimes = createLaneMap(-1), this.pendingLanes = 0, this.suspendedLanes = 0, this.pingedLanes = 0, this.expiredLanes = 0, this.mutableReadLanes = 0, this.finishedLanes = 0, this.entangledLanes = 0, this.entanglements = createLaneMap(0), this.mutableSourceEagerHydrationData = null, this.interactionThreadID = unstable_getThreadID(), this.memoizedInteractions = new Set(), this.pendingInteractionMap = new Map(), tag){ case 1: this._debugRootType = "createBlockingRoot()"; break; @@ -9157,28 +9160,28 @@ var hook = findHook(fiber, id); if (null !== hook) { var newState = copyWithSet(hook.memoizedState, path, value); - hook.memoizedState = newState, hook.baseState = newState, fiber.memoizedProps = _assign({}, fiber.memoizedProps), scheduleUpdateOnFiber(fiber, SyncLane, -1); + hook.memoizedState = newState, hook.baseState = newState, fiber.memoizedProps = _assign({}, fiber.memoizedProps), scheduleUpdateOnFiber(fiber, 1, -1); } }, overrideHookStateDeletePath = function(fiber, id, path) { var hook = findHook(fiber, id); if (null !== hook) { var newState = copyWithDelete(hook.memoizedState, path); - hook.memoizedState = newState, hook.baseState = newState, fiber.memoizedProps = _assign({}, fiber.memoizedProps), scheduleUpdateOnFiber(fiber, SyncLane, -1); + hook.memoizedState = newState, hook.baseState = newState, fiber.memoizedProps = _assign({}, fiber.memoizedProps), scheduleUpdateOnFiber(fiber, 1, -1); } }, overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) { var hook = findHook(fiber, id); if (null !== hook) { var newState = copyWithRename(hook.memoizedState, oldPath, newPath); - hook.memoizedState = newState, hook.baseState = newState, fiber.memoizedProps = _assign({}, fiber.memoizedProps), scheduleUpdateOnFiber(fiber, SyncLane, -1); + hook.memoizedState = newState, hook.baseState = newState, fiber.memoizedProps = _assign({}, fiber.memoizedProps), scheduleUpdateOnFiber(fiber, 1, -1); } }, overrideProps = function(fiber, path, value) { - fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value), fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps), scheduleUpdateOnFiber(fiber, SyncLane, -1); + fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value), fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps), scheduleUpdateOnFiber(fiber, 1, -1); }, overridePropsDeletePath = function(fiber, path) { - fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path), fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps), scheduleUpdateOnFiber(fiber, SyncLane, -1); + fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path), fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps), scheduleUpdateOnFiber(fiber, 1, -1); }, overridePropsRenamePath = function(fiber, oldPath, newPath) { - fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath), fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps), scheduleUpdateOnFiber(fiber, SyncLane, -1); + fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath), fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps), scheduleUpdateOnFiber(fiber, 1, -1); }, scheduleUpdate = function(fiber) { - scheduleUpdateOnFiber(fiber, SyncLane, -1); + scheduleUpdateOnFiber(fiber, 1, -1); }, setSuspenseHandler = function(newShouldSuspendImpl) { shouldSuspendImpl = newShouldSuspendImpl; }, ReactDOMRoot.prototype.render = ReactDOMBlockingRoot.prototype.render = function(children) { 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 358621179a2..c46c47ad401 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 @@ -137,8 +137,8 @@ var YUI = function() { return this; }, _attach: function(r, moot) { - var i, name, mod, details, req, use, after, j, loader, def, go, mods = YUI.Env.mods, aliases = YUI.Env.aliases, Y = this, cache = YUI.Env._renderedMods, loader = Y.Env._loader, done = Y.Env._attached, len = r.length, c = []; - for(i = 0; i < len; i++)if (mod = mods[name = r[i]], c.push(name), loader && loader.conditions[name]) for(j in loader.conditions[name])loader.conditions[name].hasOwnProperty(j) && (go = (def = loader.conditions[name][j]) && (def.ua && Y.UA[def.ua] || def.test && def.test(Y))) && c.push(def.name); + var i, name, mod, details, req, use, after, j, loader, def, mods = YUI.Env.mods, aliases = YUI.Env.aliases, Y = this, cache = YUI.Env._renderedMods, loader = Y.Env._loader, done = Y.Env._attached, len = r.length, c = []; + for(i = 0; i < len; i++)if (mod = mods[name = r[i]], c.push(name), loader && loader.conditions[name]) for(j in loader.conditions[name])loader.conditions[name].hasOwnProperty(j) && (def = loader.conditions[name][j]) && (def.ua && Y.UA[def.ua] || def.test && def.test(Y)) && c.push(def.name); for(i = 0, len = (r = c).length; i < len; i++)if (!done[r[i]]) { if (mod = mods[name = r[i]], aliases && aliases[name] && !mod) { Y._attach(aliases[name]); @@ -226,7 +226,7 @@ var YUI = function() { this.Array || this._attach([ "yui-base" ]); - var len, loader, handleBoot, i, Y = this, G_ENV = YUI.Env, mods = G_ENV.mods, Env = Y.Env, used = Env._used, aliases = G_ENV.aliases, queue = G_ENV._loaderQueue, firstArg = args[0], YArray = Y.Array, config = Y.config, boot = config.bootstrap, missing = [], r = [], ret = !0, fetchCSS = config.fetchCSS, process1 = function(names, skip) { + var len, loader, handleBoot, i, Y = this, G_ENV = YUI.Env, mods = G_ENV.mods, Env = Y.Env, used = Env._used, aliases = G_ENV.aliases, queue = G_ENV._loaderQueue, firstArg = args[0], YArray = Y.Array, config = Y.config, boot = config.bootstrap, missing = [], r = [], fetchCSS = config.fetchCSS, process1 = function(names, skip) { var name, len, m, req, use, i = 0, a = []; if (names.length) { if (aliases) { @@ -246,7 +246,7 @@ var YUI = function() { }; if ("*" === firstArg) { for(i in args = [], mods)mods.hasOwnProperty(i) && args.push(i); - return (ret = Y._attach(args)) && handleLoader(), Y; + return Y._attach(args) && handleLoader(), Y; } return (mods.loader || mods["loader-base"]) && !Y.Loader && Y._attach([ "loader" + (mods.loader ? "" : "-base") @@ -256,7 +256,7 @@ var YUI = function() { ]) && Y._use(args, callback); }, G_ENV._bootstrapping ? queue.add(handleBoot) : (G_ENV._bootstrapping = !0, Y.Get.script(config.base + config.loaderPath, { onEnd: handleBoot - }))) : (ret = Y._attach(args)) && handleLoader(), Y; + }))) : Y._attach(args) && handleLoader(), Y; }, namespace: function() { for(var o, j, d, arg, a = arguments, i = 0; i < a.length; i++)if (o = this, (arg = a[i]).indexOf(".") > -1) for(j = "YAHOO" == (d = arg.split("."))[0] ? 1 : 0; j < d.length; j++)o[d[j]] = o[d[j]] || {}, o = o[d[j]]; @@ -1328,13 +1328,13 @@ var YUI = function() { "groups", "skin" ], 0, !0), YUI.Env[VERSION] = META; - var VERSION, BUILD, CDN_BASE, COMBO_BASE, META, groups, yui2Update, galleryUpdate, modulekey, NOT_FOUND = {}, NO_REQUIREMENTS = [], GLOBAL_ENV = YUI.Env, GLOBAL_LOADED = GLOBAL_ENV._loaded, INTL = "intl", VERSION1 = Y.version, YObject = Y.Object, oeach = YObject.each, yArray = Y.Array, _queue = GLOBAL_ENV._loaderQueue, META1 = GLOBAL_ENV[VERSION1], L = Y.Lang, ON_PAGE = GLOBAL_ENV.mods, _path = function(dir, file, type, nomin) { + var VERSION, BUILD, CDN_BASE, COMBO_BASE, META, groups, yui2Update, galleryUpdate, NOT_FOUND = {}, NO_REQUIREMENTS = [], GLOBAL_ENV = YUI.Env, GLOBAL_LOADED = GLOBAL_ENV._loaded, INTL = "intl", VERSION1 = Y.version, YObject = Y.Object, oeach = YObject.each, yArray = Y.Array, _queue = GLOBAL_ENV._loaderQueue, META1 = GLOBAL_ENV[VERSION1], L = Y.Lang, ON_PAGE = GLOBAL_ENV.mods, _path = function(dir, file, type, nomin) { var path = dir + "/" + file; return nomin || (path += "-min"), path += "." + (type || "css"); }; YUI.Env._cssLoaded || (YUI.Env._cssLoaded = {}), Y.Env.meta = META1, Y.Loader = function(o) { var self = this; - o = o || {}, modulekey = META1.md5, self.context = Y, self.base = Y.Env.meta.base + Y.Env.meta.root, self.comboBase = Y.Env.meta.comboBase, self.combine = o.base && o.base.indexOf(self.comboBase.substr(0, 20)) > -1, self.comboSep = "&", self.maxURLLength = 1024, self.ignoreRegistered = o.ignoreRegistered, self.root = Y.Env.meta.root, self.timeout = 0, self.forceMap = {}, self.allowRollup = !1, self.filters = {}, self.required = {}, self.patterns = {}, self.moduleInfo = {}, self.groups = Y.merge(Y.Env.meta.groups), self.skin = Y.merge(Y.Env.meta.skin), self.conditions = {}, self.config = o, self._internal = !0, self._populateCache(), self.loaded = GLOBAL_LOADED[VERSION1], self.async = !0, self._inspectPage(), self._internal = !1, self._config(o), self.forceMap = self.force ? Y.Array.hash(self.force) : {}, self.testresults = null, Y.config.tests && (self.testresults = Y.config.tests), self.sorted = [], self.dirty = !0, self.inserted = {}, self.skipped = {}, self.tested = {}, self.ignoreRegistered && self._resetModules(); + o = o || {}, META1.md5, self.context = Y, self.base = Y.Env.meta.base + Y.Env.meta.root, self.comboBase = Y.Env.meta.comboBase, self.combine = o.base && o.base.indexOf(self.comboBase.substr(0, 20)) > -1, self.comboSep = "&", self.maxURLLength = 1024, self.ignoreRegistered = o.ignoreRegistered, self.root = Y.Env.meta.root, self.timeout = 0, self.forceMap = {}, self.allowRollup = !1, self.filters = {}, self.required = {}, self.patterns = {}, self.moduleInfo = {}, self.groups = Y.merge(Y.Env.meta.groups), self.skin = Y.merge(Y.Env.meta.skin), self.conditions = {}, self.config = o, self._internal = !0, self._populateCache(), self.loaded = GLOBAL_LOADED[VERSION1], self.async = !0, self._inspectPage(), self._internal = !1, self._config(o), self.forceMap = self.force ? Y.Array.hash(self.force) : {}, self.testresults = null, Y.config.tests && (self.testresults = Y.config.tests), self.sorted = [], self.dirty = !0, self.inserted = {}, self.skipped = {}, self.tested = {}, self.ignoreRegistered && self._resetModules(); }, Y.Loader.prototype = { _populateCache: function() { var i, self = this, defaults = META1.modules, cache = GLOBAL_ENV._renderedMods; diff --git a/crates/swc_ecma_minifier/tests/single-pass/uiw-codemirror/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/single-pass/uiw-codemirror/analysis-snapshot.rust-debug index c336ecff790..dcb3dfa438c 100644 --- a/crates/swc_ecma_minifier/tests/single-pass/uiw-codemirror/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/single-pass/uiw-codemirror/analysis-snapshot.rust-debug @@ -685,7 +685,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -1699,7 +1699,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -1737,7 +1737,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: false, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/arrow/arrow_functions_with_body/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/arrow/arrow_functions_with_body/analysis-snapshot.rust-debug index 26588e55489..47877f760b6 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/arrow/arrow_functions_with_body/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/arrow/arrow_functions_with_body/analysis-snapshot.rust-debug @@ -529,7 +529,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/class_expression_not_constant/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/class_expression_not_constant/analysis-snapshot.rust-debug index 19fd30dc2fc..c97a4caaab8 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/class_expression_not_constant/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/class_expression_not_constant/analysis-snapshot.rust-debug @@ -62,8 +62,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: true, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/class_expression_properties_side_effects/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/class_expression_properties_side_effects/analysis-snapshot.rust-debug index 62a390dfb4e..db170b2eea1 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/class_expression_properties_side_effects/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/class_expression_properties_side_effects/analysis-snapshot.rust-debug @@ -101,7 +101,7 @@ TestSnapshot { exported: false, used_above_decl: true, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/computed_class_properties/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/computed_class_properties/analysis-snapshot.rust-debug index e8c4566fa0d..d552053e79f 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/computed_class_properties/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/computed_class_properties/analysis-snapshot.rust-debug @@ -100,8 +100,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: true, var_kind: Some( @@ -140,8 +140,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: Some( @@ -149,7 +149,7 @@ TestSnapshot { ), var_initialized: true, declared_as_catch_param: false, - no_side_effect_for_member_access: true, + no_side_effect_for_member_access: false, used_as_callee: false, used_as_arg: false, pure_fn: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_class_properties_side_effects/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_class_properties_side_effects/analysis-snapshot.rust-debug index a4ab4827da6..3226589200a 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_class_properties_side_effects/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_class_properties_side_effects/analysis-snapshot.rust-debug @@ -63,7 +63,7 @@ TestSnapshot { exported: false, used_above_decl: true, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_means_execution/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_means_execution/analysis-snapshot.rust-debug index 8d0241fafca..1ae32cde952 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_means_execution/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_means_execution/analysis-snapshot.rust-debug @@ -176,8 +176,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: Some( @@ -185,7 +185,7 @@ TestSnapshot { ), var_initialized: true, declared_as_catch_param: false, - no_side_effect_for_member_access: true, + no_side_effect_for_member_access: false, used_as_callee: false, used_as_arg: true, pure_fn: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_property_side_effects/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_property_side_effects/analysis-snapshot.rust-debug index 84fffb99101..c6ddb0f9aeb 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_property_side_effects/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/class_properties/static_property_side_effects/analysis-snapshot.rust-debug @@ -100,8 +100,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: true, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -138,8 +138,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: Some( @@ -147,7 +147,7 @@ TestSnapshot { ), var_initialized: true, declared_as_catch_param: false, - no_side_effect_for_member_access: true, + no_side_effect_for_member_access: false, used_as_callee: false, used_as_arg: true, pure_fn: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/classes/class_recursive_refs/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/classes/class_recursive_refs/analysis-snapshot.rust-debug index 18f490f55b5..55c3febbd25 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/classes/class_recursive_refs/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/classes/class_recursive_refs/analysis-snapshot.rust-debug @@ -62,8 +62,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -100,7 +100,7 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, + is_fn_local: false, used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, @@ -138,8 +138,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/classes/class_recursive_refs/output.js b/crates/swc_ecma_minifier/tests/terser/compress/classes/class_recursive_refs/output.js index e69de29bb2d..2f2c5d39fcb 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/classes/class_recursive_refs/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/classes/class_recursive_refs/output.js @@ -0,0 +1,3 @@ +class c { + [c] = 42; +} diff --git a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/chained_3/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/chained_3/analysis-snapshot.rust-debug index c8dedeffb14..15978714684 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/chained_3/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/chained_3/analysis-snapshot.rust-debug @@ -13,7 +13,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -89,7 +89,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_assignment/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_assignment/analysis-snapshot.rust-debug index 3373808a33a..4820c99fdee 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_assignment/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_assignment/analysis-snapshot.rust-debug @@ -1103,7 +1103,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_lvalues/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_lvalues/analysis-snapshot.rust-debug index 1dcbee54a7e..5fa46595aa2 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_lvalues/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_lvalues/analysis-snapshot.rust-debug @@ -13,7 +13,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -1585,7 +1585,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_lvalues_drop_assign/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_lvalues_drop_assign/analysis-snapshot.rust-debug index 1dcbee54a7e..5fa46595aa2 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_lvalues_drop_assign/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/collapse_vars_lvalues_drop_assign/analysis-snapshot.rust-debug @@ -13,7 +13,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -1585,7 +1585,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_1537_destructuring_2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_1537_destructuring_2/analysis-snapshot.rust-debug index 75856d4bb6c..376c89d73f6 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_1537_destructuring_2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_1537_destructuring_2/analysis-snapshot.rust-debug @@ -13,7 +13,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_2298/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_2298/analysis-snapshot.rust-debug index ea552a83e9e..b93ba8f6130 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_2298/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_2298/analysis-snapshot.rust-debug @@ -243,7 +243,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_2497/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_2497/analysis-snapshot.rust-debug index 641a1ff0806..a5de2773297 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_2497/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_2497/analysis-snapshot.rust-debug @@ -171,7 +171,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/modified/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/modified/analysis-snapshot.rust-debug index 5c346912d16..09531cb862a 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/modified/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/modified/analysis-snapshot.rust-debug @@ -53,7 +53,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -173,7 +173,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/dead_code/collapse_vars_lvalues_drop_assign/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/dead_code/collapse_vars_lvalues_drop_assign/analysis-snapshot.rust-debug index 8b863b38c45..c5949f29324 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/dead_code/collapse_vars_lvalues_drop_assign/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/dead_code/collapse_vars_lvalues_drop_assign/analysis-snapshot.rust-debug @@ -13,7 +13,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, @@ -323,7 +323,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/chained_3/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/chained_3/analysis-snapshot.rust-debug index c8dedeffb14..15978714684 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/chained_3/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/chained_3/analysis-snapshot.rust-debug @@ -13,7 +13,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, @@ -89,7 +89,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_1830_2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_1830_2/analysis-snapshot.rust-debug index c8d4032ed3a..da64d99a6df 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_1830_2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_1830_2/analysis-snapshot.rust-debug @@ -53,7 +53,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_2226_1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_2226_1/analysis-snapshot.rust-debug index a9a065e63ca..1728836ecbf 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_2226_1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_2226_1/analysis-snapshot.rust-debug @@ -207,7 +207,7 @@ TestSnapshot { declared_count: 0, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 1, usage_count: 6, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_2768/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_2768/analysis-snapshot.rust-debug index 3c7e32fd003..3e209489638 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_2768/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/issue_2768/analysis-snapshot.rust-debug @@ -13,7 +13,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 1, usage_count: 2, reassigned_with_assignment: true, @@ -53,7 +53,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 2, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: true, @@ -169,7 +169,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw/analysis-snapshot.rust-debug index 2338fd01801..10a357a72ef 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw/analysis-snapshot.rust-debug @@ -139,7 +139,7 @@ TestSnapshot { exported: false, used_above_decl: true, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: true, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_2/analysis-snapshot.rust-debug index 2338fd01801..10a357a72ef 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_2/analysis-snapshot.rust-debug @@ -139,7 +139,7 @@ TestSnapshot { exported: false, used_above_decl: true, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: true, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_3/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_3/analysis-snapshot.rust-debug index 2338fd01801..10a357a72ef 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_3/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_3/analysis-snapshot.rust-debug @@ -139,7 +139,7 @@ TestSnapshot { exported: false, used_above_decl: true, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: true, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_4/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_4/analysis-snapshot.rust-debug index 2338fd01801..10a357a72ef 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_4/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_which_might_throw_4/analysis-snapshot.rust-debug @@ -139,7 +139,7 @@ TestSnapshot { exported: false, used_above_decl: true, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: true, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_with_static_props_side_effects/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_with_static_props_side_effects/analysis-snapshot.rust-debug index 4aeae055bc7..1626a507b6c 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_with_static_props_side_effects/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_with_static_props_side_effects/analysis-snapshot.rust-debug @@ -100,8 +100,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: Some( @@ -109,7 +109,7 @@ TestSnapshot { ), var_initialized: true, declared_as_catch_param: false, - no_side_effect_for_member_access: true, + no_side_effect_for_member_access: false, used_as_callee: false, used_as_arg: true, pure_fn: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_with_static_props_side_effects_2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_with_static_props_side_effects_2/analysis-snapshot.rust-debug index 538a60069fe..a54b3cb9d24 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_with_static_props_side_effects_2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/unused_class_with_static_props_side_effects_2/analysis-snapshot.rust-debug @@ -100,14 +100,14 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, var_initialized: true, declared_as_catch_param: false, - no_side_effect_for_member_access: true, + no_side_effect_for_member_access: false, used_as_callee: true, used_as_arg: false, pure_fn: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/variable_refs_outside_unused_class/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/variable_refs_outside_unused_class/analysis-snapshot.rust-debug index b45a049cd46..03268b702e0 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/variable_refs_outside_unused_class/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/drop_unused/variable_refs_outside_unused_class/analysis-snapshot.rust-debug @@ -140,8 +140,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: Some( @@ -180,8 +180,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: Some( diff --git a/crates/swc_ecma_minifier/tests/terser/compress/export/export_default_anonymous_class/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/export/export_default_anonymous_class/analysis-snapshot.rust-debug index 5dade3fab05..57bce617ba1 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/export/export_default_anonymous_class/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/export/export_default_anonymous_class/analysis-snapshot.rust-debug @@ -25,7 +25,7 @@ TestSnapshot { exported: false, used_above_decl: true, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_1841_1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_1841_1/analysis-snapshot.rust-debug index d690d917c69..b85e6298e8d 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_1841_1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_1841_1/analysis-snapshot.rust-debug @@ -169,7 +169,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_1841_2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_1841_2/analysis-snapshot.rust-debug index d690d917c69..b85e6298e8d 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_1841_2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_1841_2/analysis-snapshot.rust-debug @@ -169,7 +169,7 @@ TestSnapshot { declared_count: 2, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_2107/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_2107/analysis-snapshot.rust-debug index 7b44e118ea2..8b5641ff516 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_2107/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/functions/issue_2107/analysis-snapshot.rust-debug @@ -13,7 +13,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/harmony/classes/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/harmony/classes/analysis-snapshot.rust-debug index 37a16c81123..d4df5cf646b 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/harmony/classes/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/harmony/classes/analysis-snapshot.rust-debug @@ -177,7 +177,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/harmony/format_methods/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/harmony/format_methods/analysis-snapshot.rust-debug index d4ee152a848..fc2cc36f55f 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/harmony/format_methods/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/harmony/format_methods/analysis-snapshot.rust-debug @@ -101,7 +101,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, @@ -329,7 +329,7 @@ TestSnapshot { exported: false, used_above_decl: true, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/harmony/issue_1753/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/harmony/issue_1753/analysis-snapshot.rust-debug index 5ba5be8bc00..5ae336ef867 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/harmony/issue_1753/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/harmony/issue_1753/analysis-snapshot.rust-debug @@ -63,7 +63,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: true, used_in_cond: true, var_kind: Some( @@ -103,7 +103,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: true, used_in_cond: true, var_kind: Some( @@ -143,7 +143,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/harmony/issue_1753_disable/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/harmony/issue_1753_disable/analysis-snapshot.rust-debug index 5ba5be8bc00..5ae336ef867 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/harmony/issue_1753_disable/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/harmony/issue_1753_disable/analysis-snapshot.rust-debug @@ -63,7 +63,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: true, used_in_cond: true, var_kind: Some( @@ -103,7 +103,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: true, used_in_cond: true, var_kind: Some( @@ -143,7 +143,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/hoist_class/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/hoist_class/analysis-snapshot.rust-debug index f27ce4c18db..53cb6f3223d 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/hoist_class/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/hoist_class/analysis-snapshot.rust-debug @@ -255,7 +255,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/hoist_class_with_new/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/hoist_class_with_new/analysis-snapshot.rust-debug index 85dd63c5882..b7428acea45 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/hoist_class_with_new/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/hoist_class_with_new/analysis-snapshot.rust-debug @@ -141,7 +141,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/issue_1043/issue_1043/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/issue_1043/issue_1043/analysis-snapshot.rust-debug index 686b07ace11..fba9e5f38b8 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/issue_1043/issue_1043/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/issue_1043/issue_1043/analysis-snapshot.rust-debug @@ -129,7 +129,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: true, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 3, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/issue_281/modified/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/issue_281/modified/analysis-snapshot.rust-debug index f69be99b21c..544a818ff82 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/issue_281/modified/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/issue_281/modified/analysis-snapshot.rust-debug @@ -13,7 +13,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/object/getter_setter_with_computed_value/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/object/getter_setter_with_computed_value/analysis-snapshot.rust-debug index 4d465900949..96da56cef89 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/object/getter_setter_with_computed_value/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/object/getter_setter_with_computed_value/analysis-snapshot.rust-debug @@ -139,7 +139,7 @@ TestSnapshot { exported: false, used_above_decl: true, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/properties/issue_t64/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/properties/issue_t64/analysis-snapshot.rust-debug index d869c12fdbc..dbafefeb953 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/properties/issue_t64/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/properties/issue_t64/analysis-snapshot.rust-debug @@ -25,7 +25,7 @@ TestSnapshot { exported: false, used_above_decl: true, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/defun_single_use_loop/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/defun_single_use_loop/analysis-snapshot.rust-debug index 15d7da4a0c4..476ae67dbab 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/defun_single_use_loop/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/defun_single_use_loop/analysis-snapshot.rust-debug @@ -169,7 +169,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_conditional/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_conditional/analysis-snapshot.rust-debug index 6ce4b32d57a..5d9e39220c8 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_conditional/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_conditional/analysis-snapshot.rust-debug @@ -51,7 +51,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_expansion/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_expansion/analysis-snapshot.rust-debug index 4d34a335c96..49afddc3666 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_expansion/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_expansion/analysis-snapshot.rust-debug @@ -51,7 +51,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_conditional/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_conditional/analysis-snapshot.rust-debug index ab595430830..4f2e99384da 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_conditional/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_conditional/analysis-snapshot.rust-debug @@ -51,7 +51,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_sequence/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_sequence/analysis-snapshot.rust-debug index ed5d85367fa..a4402501e60 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_sequence/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_sequence/analysis-snapshot.rust-debug @@ -51,7 +51,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_throw/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_throw/analysis-snapshot.rust-debug index 4d2c385f8a5..c82d24f06ef 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_throw/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_local_throw/analysis-snapshot.rust-debug @@ -51,7 +51,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_throw/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_throw/analysis-snapshot.rust-debug index 5555e04f7f4..cb8427a823a 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_throw/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/escape_throw/analysis-snapshot.rust-debug @@ -51,7 +51,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_2496/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_2496/analysis-snapshot.rust-debug index 05f0d82afc4..4bcf3d4e8e3 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_2496/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_2496/analysis-snapshot.rust-debug @@ -177,7 +177,7 @@ TestSnapshot { exported: false, used_above_decl: false, is_fn_local: true, - used_by_nested_fn: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: None, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3113_1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3113_1/analysis-snapshot.rust-debug index ef597707417..3dcf8f95ede 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3113_1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3113_1/analysis-snapshot.rust-debug @@ -131,7 +131,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -169,7 +169,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3113_2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3113_2/analysis-snapshot.rust-debug index ef597707417..3dcf8f95ede 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3113_2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3113_2/analysis-snapshot.rust-debug @@ -131,7 +131,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 1, reassigned_with_assignment: false, @@ -169,7 +169,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3140_5/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3140_5/analysis-snapshot.rust-debug index 731591b6942..8a20c008de4 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3140_5/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_3140_5/analysis-snapshot.rust-debug @@ -169,7 +169,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_741_reference_cycle/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_741_reference_cycle/analysis-snapshot.rust-debug index 01512fdfd6c..d15a6f9d43f 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_741_reference_cycle/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/issue_741_reference_cycle/analysis-snapshot.rust-debug @@ -53,7 +53,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 1, + assign_count: 0, mutation_by_call_count: 1, usage_count: 1, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/multi_def_2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/multi_def_2/analysis-snapshot.rust-debug index 6f4da35708a..a20295d4dfb 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/multi_def_2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/multi_def_2/analysis-snapshot.rust-debug @@ -247,7 +247,7 @@ TestSnapshot { declared_count: 3, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 4, + assign_count: 2, mutation_by_call_count: 0, usage_count: 0, reassigned_with_assignment: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/reduce_class_with_side_effects_in_properties/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/reduce_class_with_side_effects_in_properties/analysis-snapshot.rust-debug index af1b0e4c083..9cc246a23c0 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/reduce_class_with_side_effects_in_properties/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/reduce_vars/reduce_class_with_side_effects_in_properties/analysis-snapshot.rust-debug @@ -176,8 +176,8 @@ TestSnapshot { accessed_props: {}, exported: false, used_above_decl: false, - is_fn_local: true, - used_by_nested_fn: false, + is_fn_local: false, + used_by_nested_fn: true, executed_multiple_time: false, used_in_cond: false, var_kind: Some( @@ -185,7 +185,7 @@ TestSnapshot { ), var_initialized: true, declared_as_catch_param: false, - no_side_effect_for_member_access: true, + no_side_effect_for_member_access: false, used_as_callee: false, used_as_arg: true, pure_fn: false, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/typeof/typeof_defun_1/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/typeof/typeof_defun_1/analysis-snapshot.rust-debug index ccbd66e62f5..a300ae20c96 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/typeof/typeof_defun_1/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/typeof/typeof_defun_1/analysis-snapshot.rust-debug @@ -127,7 +127,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 2, + assign_count: 1, mutation_by_call_count: 0, usage_count: 2, reassigned_with_assignment: true, diff --git a/crates/swc_ecma_minifier/tests/terser/compress/typeof/typeof_defun_2/analysis-snapshot.rust-debug b/crates/swc_ecma_minifier/tests/terser/compress/typeof/typeof_defun_2/analysis-snapshot.rust-debug index 8d8156fe299..1c573321f8a 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/typeof/typeof_defun_2/analysis-snapshot.rust-debug +++ b/crates/swc_ecma_minifier/tests/terser/compress/typeof/typeof_defun_2/analysis-snapshot.rust-debug @@ -51,7 +51,7 @@ TestSnapshot { declared_count: 1, declared_as_fn_param: false, declared_as_fn_expr: false, - assign_count: 3, + assign_count: 0, mutation_by_call_count: 0, usage_count: 6, reassigned_with_assignment: false,