diff --git a/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.2.minified.js b/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.2.minified.js index 36f031e8c901..09671794e4ac 100644 --- a/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.2.minified.js +++ b/crates/swc/tests/tsc-references/callSignaturesWithOptionalParameters.2.minified.js @@ -2,9 +2,5 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var c, i, a, f = function(x) {}, f2 = function(x, y) {}; f(1), f(), f2(1), f2(1, 2), c.foo(), c.foo(1), i(), i(1), i.foo(1), i.foo(1, 2), a(), a(1), a.foo(), a.foo(1); -var b = { - foo: function(x) {}, - a: function(x, y) {}, - b: function(x) {} -}; -b.foo(), b.foo(1), b.a(1), b.a(1, 2), b.b(), b.b(1); +var b_foo = function(x) {}, b_a = function(x, y) {}, b_b = function(x) {}; +b_foo(), b_foo(1), b_a(1), b_a(1, 2), b_b(), b_b(1); diff --git a/crates/swc/tests/tsc-references/checkJsdocSatisfiesTag10.2.minified.js b/crates/swc/tests/tsc-references/checkJsdocSatisfiesTag10.2.minified.js index 1bf7d574f164..f88d793b76ab 100644 --- a/crates/swc/tests/tsc-references/checkJsdocSatisfiesTag10.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsdocSatisfiesTag10.2.minified.js @@ -2,6 +2,7 @@ //// [/a.js] var p = { a: 0, - b: "hello" + b: "hello", + x: 8 }; p.a.toFixed(), p.b.substring(1), p.d; diff --git a/crates/swc/tests/tsc-references/checkJsdocSatisfiesTag7.2.minified.js b/crates/swc/tests/tsc-references/checkJsdocSatisfiesTag7.2.minified.js index 41feb46671ec..47cab0f6724a 100644 --- a/crates/swc/tests/tsc-references/checkJsdocSatisfiesTag7.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsdocSatisfiesTag7.2.minified.js @@ -2,6 +2,7 @@ //// [/a.js] var p = { a: 0, - b: "hello" + b: "hello", + x: 8 }; p.a.toFixed(), p.b.substring(1), p.d; diff --git a/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty2.2.minified.js b/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty2.2.minified.js index 1b972c2b38c1..a1931ea98469 100644 --- a/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty2.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsdocTypeTagOnObjectProperty2.2.minified.js @@ -1,17 +1,2 @@ //// [checkJsdocTypeTagOnObjectProperty2.ts] //// [0.js] -var lol, obj = { - bar: 42, - method1: function(n1) { - return "42"; - }, - method2: function(n1) { - return "lol"; - }, - arrowFunc: function() { - var num = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "0"; - return num + 42; - }, - lol: lol -}; -lol = "string", obj.method1(0), obj.method2("0"); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es2022).2.minified.js index bac0dcafc2c0..55eb47b4046f 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es2022).2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es2022).2.minified.js @@ -1,9 +1,6 @@ //// [destructuringObjectBindingPatternAndAssignment8.ts] -const K = { - a: "a", - b: "b" -}, { [K.a]: aVal, [K.b]: bVal } = { - [K.a]: 1, - [K.b]: 1 +const { a: aVal, b: bVal } = { + a: 1, + b: 1 }; console.log(aVal, bVal); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).2.minified.js index 9e863e21a791..2612ae46e946 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).2.minified.js @@ -1,7 +1,4 @@ //// [destructuringObjectBindingPatternAndAssignment8.ts] import { _ as _define_property } from "@swc/helpers/_/_define_property"; -var _obj, K = { - a: "a", - b: "b" -}, _ref = (_define_property(_obj = {}, K.a, 1), _define_property(_obj, K.b, 1), _obj); -console.log(_ref[K.a], _ref[K.b]); +var _obj, _ref = (_define_property(_obj = {}, "a", 1), _define_property(_obj, "b", 1), _obj); +console.log(_ref.a, _ref.b); diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js index d2f7e19536e0..eaa8395a93d7 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js @@ -1,11 +1,6 @@ //// [destructuringVariableDeclaration1ES5.ts] import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; -var _ref = { - a1: 10, - a2: "world" -}; -_ref.a1, _ref.a2; var tmp = { b11: "world" }; diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js index 1a793614d6ff..2b909cc28e4b 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js @@ -1,11 +1,6 @@ //// [destructuringVariableDeclaration1ES5iterable.ts] import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array"; -var _ref = { - a1: 10, - a2: "world" -}; -_ref.a1, _ref.a2; var tmp = { b11: "world" }; diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.2.minified.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.2.minified.js index a329a0e651df..8f0c7863eb68 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.2.minified.js @@ -1,9 +1,4 @@ //// [destructuringVariableDeclaration2.ts] -var _ref = { - a1: !0, - a2: 1 -}; -_ref.a1, _ref.a2; var _ref1 = [ 1, 2, diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.2.minified.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.2.minified.js index c2c8eab7536f..2275f1495c7e 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.2.minified.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.2.minified.js @@ -1,9 +1,6 @@ //// [logicalNotOperatorWithAnyOtherType.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var M, obj1 = { - x: "", - y: function() {} -}, A = function() { +var M, A = function() { function A() { _class_call_check(this, A); } @@ -11,4 +8,4 @@ var M, obj1 = { }(); M || (M = {}); var objA = new A(); -obj1.x, obj1.y, objA.a, M.n, A.foo(), objA.a, M.n; +objA.a, M.n, A.foo(), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/objectLiteralNormalization.2.minified.js b/crates/swc/tests/tsc-references/objectLiteralNormalization.2.minified.js index b0ad39064303..2a3a0b13f418 100644 --- a/crates/swc/tests/tsc-references/objectLiteralNormalization.2.minified.js +++ b/crates/swc/tests/tsc-references/objectLiteralNormalization.2.minified.js @@ -33,14 +33,11 @@ var b2 = _object_spread_props(_object_spread({}, b1), { z: 55 }); _object_spread({}, b2), opts; -var d1 = { - kind: "a", - pos: { - x: 0, - y: 0 - } +var d1_pos = { + x: 0, + y: 0 }; -d1.kind, d1.pos, d1.pos.x, d1.pos.y, d1.pos.a, d1.pos.b, f({ +d1_pos.x, d1_pos.y, d1_pos.a, d1_pos.b, f({ a: 1, b: 2 }, { diff --git a/crates/swc/tests/tsc-references/parserNotHexLiteral1.2.minified.js b/crates/swc/tests/tsc-references/parserNotHexLiteral1.2.minified.js index afcd1cc1012e..7fa99c515d5d 100644 --- a/crates/swc/tests/tsc-references/parserNotHexLiteral1.2.minified.js +++ b/crates/swc/tests/tsc-references/parserNotHexLiteral1.2.minified.js @@ -1,6 +1,2 @@ //// [parserNotHexLiteral1.ts] -var x = { - e0: "cat", - x0: "dog" -}; -console.info(x.x0), console.info(x.e0); +console.info("dog"), console.info("cat"); diff --git a/crates/swc/tests/tsc-references/spellingUncheckedJS.2.minified.js b/crates/swc/tests/tsc-references/spellingUncheckedJS.2.minified.js index 5f2c054c4883..d9b7baf71722 100644 --- a/crates/swc/tests/tsc-references/spellingUncheckedJS.2.minified.js +++ b/crates/swc/tests/tsc-references/spellingUncheckedJS.2.minified.js @@ -6,7 +6,9 @@ import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; export var inModule = 1; inmodule.toFixed(); -var object = {}; +var object = { + spaaace: 3 +}; object.spaaaace, object.spaace = 12, object.fresh = 12, other.puuuce, new Date().getGMTDate(), setIntegral(function() { return console.log("ok"); }, 500), AudioBuffin, Jimmy, Jon; diff --git a/crates/swc/tests/tsc-references/stringLiteralTypesAsTags01.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralTypesAsTags01.2.minified.js index c52cd8b16c14..a788ea8cbca4 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypesAsTags01.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypesAsTags01.2.minified.js @@ -1,5 +1 @@ //// [stringLiteralTypesAsTags01.ts] -var x = { - kind: "A" -}; -x.kind, x.kind; diff --git a/crates/swc/tests/tsc-references/stringLiteralTypesAsTags02.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralTypesAsTags02.2.minified.js index 279b963d54e1..ef85edf0b82a 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypesAsTags02.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypesAsTags02.2.minified.js @@ -1,5 +1 @@ //// [stringLiteralTypesAsTags02.ts] -var x = { - kind: "A" -}; -x.kind, x.kind; diff --git a/crates/swc/tests/tsc-references/stringLiteralTypesAsTags03.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralTypesAsTags03.2.minified.js index 4645662dac45..104c98632742 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypesAsTags03.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypesAsTags03.2.minified.js @@ -1,5 +1 @@ //// [stringLiteralTypesAsTags03.ts] -var x = { - kind: "A" -}; -x.kind, x.kind; diff --git a/crates/swc/tests/tsc-references/typeGuardFunctionOfFormThis.2.minified.js b/crates/swc/tests/tsc-references/typeGuardFunctionOfFormThis.2.minified.js index 009e9648878c..99db495c9eb4 100644 --- a/crates/swc/tests/tsc-references/typeGuardFunctionOfFormThis.2.minified.js +++ b/crates/swc/tests/tsc-references/typeGuardFunctionOfFormThis.2.minified.js @@ -28,11 +28,7 @@ var b, crate, RoyalGuard = function() { } return FollowerGuard.prototype.follow = function() {}, FollowerGuard; }(RoyalGuard), a = new FollowerGuard(); -a.isLeader() ? a.lead() : a.isFollower() && a.follow(), b.isLeader() ? b.lead() : b.isFollower() && b.follow(); -var holder2 = { - a: a -}; -holder2.a.isLeader(), holder2.a; +a.isLeader() ? a.lead() : a.isFollower() && a.follow(), b.isLeader() ? b.lead() : b.isFollower() && b.follow(), a.isLeader(); var ArrowGuard = function ArrowGuard() { var _this = this; _class_call_check(this, ArrowGuard), this.isElite = function() { diff --git a/crates/swc/tests/tsc-references/typeTagOnPropertyAssignment.2.minified.js b/crates/swc/tests/tsc-references/typeTagOnPropertyAssignment.2.minified.js index 7253fb9a7a63..057e2716a405 100644 --- a/crates/swc/tests/tsc-references/typeTagOnPropertyAssignment.2.minified.js +++ b/crates/swc/tests/tsc-references/typeTagOnPropertyAssignment.2.minified.js @@ -1,8 +1 @@ //// [typeTagOnPropertyAssignment.js] -var o = { - a: "a", - n: function() { - return "b"; - } -}; -o.a, o.n; diff --git a/crates/swc/tests/tsc-references/typedefTagExtraneousProperty.2.minified.js b/crates/swc/tests/tsc-references/typedefTagExtraneousProperty.2.minified.js index f296fb9d3488..09b31552a851 100644 --- a/crates/swc/tests/tsc-references/typedefTagExtraneousProperty.2.minified.js +++ b/crates/swc/tests/tsc-references/typedefTagExtraneousProperty.2.minified.js @@ -1,3 +1,5 @@ //// [typedefTagExtraneousProperty.js] -var y = {}; +var y = { + bye: "no" +}; y.ignoreMe = "ok but just because of the index signature", y.hi = "yes"; diff --git a/crates/swc/tests/tsc-references/typedefTagNested.2.minified.js b/crates/swc/tests/tsc-references/typedefTagNested.2.minified.js index 0aa2ca943abd..69ef0e6b9407 100644 --- a/crates/swc/tests/tsc-references/typedefTagNested.2.minified.js +++ b/crates/swc/tests/tsc-references/typedefTagNested.2.minified.js @@ -1,7 +1 @@ //// [a.js] -var sala = { - name: "uppsala", - not: 0, - nested: "ok" -}; -sala.name, sala.not, sala.nested; diff --git a/crates/swc/tests/tsc-references/unannotatedParametersAreOptional.2.minified.js b/crates/swc/tests/tsc-references/unannotatedParametersAreOptional.2.minified.js index 53eefa32fc0f..69760c2cf91d 100644 --- a/crates/swc/tests/tsc-references/unannotatedParametersAreOptional.2.minified.js +++ b/crates/swc/tests/tsc-references/unannotatedParametersAreOptional.2.minified.js @@ -7,8 +7,3 @@ var C = function() { return C.prototype.m = function(x) {}, C.m = function(x) {}, C; }(); C.m(), new C().m(), new C().p(); -var obj = { - m: function(x) {}, - p: function(x) {} -}; -obj.m(), obj.p(); diff --git a/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.2.minified.js b/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.2.minified.js index f600dc179eb1..12bc3a6fc2f2 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.2.minified.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.2.minified.js @@ -1,9 +1,6 @@ //// [voidOperatorWithAnyOtherType.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var M, obj1 = { - x: "", - y: 1 -}, A = function() { +var M, A = function() { function A() { _class_call_check(this, A); } @@ -11,4 +8,4 @@ var M, obj1 = { }(); M || (M = {}); var objA = new A(); -obj1.x, obj1.y, objA.a, M.n, A.foo(), objA.a, M.n; +objA.a, M.n, A.foo(), objA.a, M.n; diff --git a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs index 31fb9e13584a..38a1657e51c2 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs @@ -75,6 +75,8 @@ impl Optimizer<'_> { // No use => dropped if ref_count == 0 { + self.mode.store(ident.to_id(), &*init); + if init.may_have_side_effects(&self.expr_ctx) { // TODO: Inline partially return; diff --git a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs index 11f3df8ab4f2..3226a31f8119 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs @@ -89,8 +89,6 @@ pub(super) fn optimizer<'a>( prepend_stmts: Default::default(), append_stmts: Default::default(), vars: Default::default(), - vars_for_prop_hoisting: Default::default(), - simple_props: Default::default(), typeofs: Default::default(), data, ctx, @@ -209,10 +207,6 @@ struct Optimizer<'a> { vars: Vars, - /// Used for `hoist_props`. - vars_for_prop_hoisting: Box>>, - /// Used for `hoist_props`. - simple_props: Box>>, typeofs: Box>, /// This information is created by analyzing identifier usages. /// @@ -236,6 +230,9 @@ struct Vars { /// Used for inlining. lits: FxHashMap>, + /// Used for `hoist_props`. + hoisted_props: Box>, + /// Literals which are cheap to clone, but not sure if we can inline without /// making output bigger. /// @@ -279,6 +276,7 @@ impl Vars { lits_for_cmp: &self.lits_for_cmp, lits_for_array_access: &self.lits_for_array_access, lits: &self.lits, + hoisted_props: &self.hoisted_props, vars_to_remove: &self.removed, changed: false, }; @@ -2920,8 +2918,6 @@ impl VisitMut for Optimizer<'_> { } }; - self.store_var_for_prop_hoisting(var); - self.drop_unused_properties(var); debug_assert_valid(&var.init); @@ -2948,6 +2944,8 @@ impl VisitMut for Optimizer<'_> { true }); + self.hoist_props_of_vars(vars); + let uses_eval = self.data.scopes.get(&self.ctx.scope).unwrap().has_eval_call; if !uses_eval && !self.ctx.dont_use_prepend_nor_append { @@ -2967,6 +2965,9 @@ impl VisitMut for Optimizer<'_> { for v in vars.iter_mut() { let mut storage = None; self.drop_unused_var_declarator(v, &mut storage); + if let Some(expr) = &mut storage { + expr.visit_mut_with(self); + } side_effects.extend(storage); // Dropped. Side effects of the initializer is stored in `side_effects`. diff --git a/crates/swc_ecma_minifier/src/compress/optimize/props.rs b/crates/swc_ecma_minifier/src/compress/optimize/props.rs index fc529c4b5aa8..9e9c12a38a66 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/props.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/props.rs @@ -1,45 +1,70 @@ -use swc_common::DUMMY_SP; +use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; -use swc_ecma_utils::{contains_this_expr, prop_name_eq, ExprExt}; +use swc_ecma_utils::{private_ident, prop_name_eq, ExprExt}; use super::{unused::PropertyAccessOpts, Optimizer}; use crate::util::deeply_contains_this_expr; /// Methods related to the option `hoist_props`. impl Optimizer<'_> { - /// Store values of properties so we can replace property accesses with the - /// values. - pub(super) fn store_var_for_prop_hoisting(&mut self, n: &mut VarDeclarator) { + pub(super) fn hoist_props_of_vars(&mut self, n: &mut Vec) { if !self.options.hoist_props { + log_abort!("hoist_props: option is disabled"); return; } if self.ctx.is_exported { + log_abort!("hoist_props: Exported variable is not hoisted"); return; } + if self.ctx.in_top_level() && !self.options.top_level() { + log_abort!("hoist_props: Top-level variable is not hoisted"); + return; + } + + let mut new = Vec::with_capacity(n.len()); + for mut n in n.take() { + let new_vars = self.hoist_props_of_var(&mut n); + + if let Some(new_vars) = new_vars { + new.extend(new_vars); + } else { + new.push(n); + } + } + + *n = new; + } + fn hoist_props_of_var(&mut self, n: &mut VarDeclarator) -> Option> { if let Pat::Ident(name) = &mut n.name { - if self.options.top_retain.contains(&name.id.sym) { - return; + if name.id.span.ctxt == self.marks.top_level_ctxt + && self.options.top_retain.contains(&name.id.sym) + { + log_abort!("hoist_props: Variable `{}` is retained", name.id.sym); + return None; } // If a variable is initialized multiple time, we currently don't do anything // smart. - if !self - .data - .vars - .get(&name.to_id()) - .map(|v| { - !v.mutated() - && !v.used_as_ref - && !v.used_as_arg - && !v.used_in_cond - && (!v.is_fn_local || !self.mode.should_be_very_correct()) - && !v.is_infected() - }) - .unwrap_or(false) + let usage = self.data.vars.get(&name.to_id())?; + if usage.mutated() + || usage.used_in_cond + || usage.used_above_decl + || usage.used_as_ref + || usage.used_as_arg + || usage.indexed_with_dynamic_key + || usage.used_recursively { - log_abort!("[x] bad usage"); - return; + log_abort!("hoist_props: Variable `{}` is not a candidate", name.id); + return None; + } + + if usage.accessed_props.is_empty() { + log_abort!( + "hoist_props: Variable `{}` is not accessed with known keys", + name.id + ); + return None; } // We should abort if unknown property is used. @@ -53,145 +78,115 @@ impl Optimizer<'_> { if let Some(Expr::Object(init)) = n.init.as_deref() { for prop in &init.props { let prop = match prop { - PropOrSpread::Spread(_) => continue, + PropOrSpread::Spread(_) => return None, PropOrSpread::Prop(prop) => prop, }; - if let Prop::KeyValue(p) = &**prop { - match &*p.value { - Expr::Lit(..) | Expr::Arrow(..) => {} - Expr::Fn(f) => { - if contains_this_expr(&f.function.body) { - continue; - } + match &**prop { + Prop::KeyValue(p) => { + if !is_expr_fine_for_hoist_props(&p.value) { + return None; } - _ => continue, - }; - match &p.key { - PropName::Str(s) => { - if let Some(v) = unknown_used_props.get_mut(&s.value) { - *v -= 1; + match &p.key { + PropName::Str(s) => { + if let Some(v) = unknown_used_props.get_mut(&s.value) { + *v = 0; + } } - } - PropName::Ident(i) => { - if let Some(v) = unknown_used_props.get_mut(&i.sym) { - *v -= 1; + PropName::Ident(i) => { + if let Some(v) = unknown_used_props.get_mut(&i.sym) { + *v = 0; + } } + _ => return None, + } + } + Prop::Shorthand(p) => { + if let Some(v) = unknown_used_props.get_mut(&p.sym) { + *v = 0; } - _ => {} } + _ => return None, } } } else { if self.mode.should_be_very_correct() { - return; + return None; } } if !unknown_used_props.iter().all(|(_, v)| *v == 0) { log_abort!("[x] unknown used props: {:?}", unknown_used_props); - return; + return None; } if let Some(init) = n.init.as_deref() { self.mode.store(name.to_id(), init); } - if let Some(Expr::Object(init)) = n.init.as_deref_mut() { - for prop in &mut init.props { - let prop = match prop { - PropOrSpread::Spread(_) => continue, - PropOrSpread::Prop(prop) => prop, - }; + let mut new_vars = vec![]; - if let Prop::KeyValue(p) = &mut **prop { - self.vars.inline_with_multi_replacer(&mut p.value); + let object = n.init.as_mut()?.as_mut_object()?; - let value = match &*p.value { - Expr::Lit(..) => p.value.clone(), - Expr::Fn(..) | Expr::Arrow(..) => { - if self.options.hoist_props { - p.value.clone() - } else { - continue; - } - } - _ => continue, - }; - - match &p.key { - PropName::Str(s) => { - trace_op!( - "hoist_props: Storing a variable (`{}`) to inline properties", - name.id - ); - self.simple_props - .insert((name.to_id(), s.value.clone()), value); - } - PropName::Ident(i) => { - trace_op!( - "hoist_props: Storing a variable(`{}`) to inline properties", - name.id - ); - self.simple_props - .insert((name.to_id(), i.sym.clone()), value); - } - _ => {} - } - } - } - } + self.changed = true; + report_change!( + "hoist_props: Hoisting properties of a variable `{}`", + name.id.sym + ); - // If the variable is used multiple time, just ignore it. - if !self - .data - .vars - .get(&name.to_id()) - .map(|v| { - v.ref_count == 1 - && v.has_property_access - && !v.mutated() - && v.is_fn_local - && !v.executed_multiple_time - && !v.used_as_arg - && !v.used_in_cond - }) - .unwrap_or(false) - { - return; - } + for prop in &mut object.props { + let prop = match prop { + PropOrSpread::Spread(_) => unreachable!(), + PropOrSpread::Prop(prop) => prop, + }; - let init = match n.init.take() { - Some(v) => v, - None => return, - }; + let value = match &mut **prop { + Prop::KeyValue(p) => p.value.take(), + Prop::Shorthand(p) => p.clone().into(), + _ => unreachable!(), + }; - if let Expr::This(..) = &*init { - n.init = Some(init); - return; - } + let (key, suffix) = match &**prop { + Prop::KeyValue(p) => match &p.key { + PropName::Ident(i) => (i.sym.clone(), i.sym.clone()), + PropName::Str(s) => ( + s.value.clone(), + s.value + .clone() + .replace(|c: char| !Ident::is_valid_continue(c), "$") + .into(), + ), + _ => unreachable!(), + }, + Prop::Shorthand(p) => (p.sym.clone(), p.sym.clone()), + _ => unreachable!(), + }; - match self.vars_for_prop_hoisting.insert(name.to_id(), init) { - Some(prev) => { - panic!( - "two variable with same name and same span hygiene is invalid\nPrevious \ - value: {:?}", - prev - ); - } - None => { - trace_op!( - "hoist_props: Stored {}{:?} to inline property access", - name.id.sym, - name.id.span.ctxt - ); - } + let new_var_name = private_ident!(format!("{}_{}", name.id.sym, suffix)); + + let new_var = VarDeclarator { + span: DUMMY_SP, + name: new_var_name.clone().into(), + init: Some(value), + definite: false, + }; + + self.vars + .hoisted_props + .insert((name.to_id(), key), new_var_name); + + new_vars.push(new_var); } + // Mark the variable as dropped. + n.name.take(); + + return Some(new_vars); } + + None } - /// Replace property accesses to known values. pub(super) fn replace_props(&mut self, e: &mut Expr) { let member = match e { Expr::Member(m) => m, @@ -202,32 +197,56 @@ impl Optimizer<'_> { _ => return, }; if let Expr::Ident(obj) = &*member.obj { - if let MemberProp::Ident(prop) = &member.prop { - if let Some(mut value) = self - .simple_props - .get(&(obj.to_id(), prop.sym.clone())) - .cloned() - { - if let Expr::Fn(f) = &mut *value { - f.function.span = DUMMY_SP; - } - - report_change!("hoist_props: Inlining `{}.{}`", obj.sym, prop.sym); - self.changed = true; - *e = *value; - return; - } - } + let sym = match &member.prop { + MemberProp::Ident(i) => &i.sym, + MemberProp::Computed(e) => match &*e.expr { + Expr::Lit(Lit::Str(s)) => &s.value, + _ => return, + }, + _ => return, + }; - if let Some(value) = self.vars_for_prop_hoisting.remove(&obj.to_id()) { - member.obj = value; + if let Some(value) = self + .vars + .hoisted_props + .get(&(obj.to_id(), sym.clone())) + .cloned() + { + report_change!("hoist_props: Inlining `{}.{}`", obj.sym, sym); self.changed = true; - report_change!("hoist_props: Inlined a property"); + *e = value.into(); } } } } +fn is_expr_fine_for_hoist_props(value: &Expr) -> bool { + match value { + Expr::Ident(..) | Expr::Lit(..) | Expr::Arrow(..) | Expr::Fn(..) | Expr::Class(..) => true, + + Expr::Unary(u) => match u.op { + op!("void") | op!("typeof") | op!("!") => is_expr_fine_for_hoist_props(&u.arg), + _ => false, + }, + + Expr::Array(a) => a.elems.iter().all(|elem| match elem { + Some(elem) => elem.spread.is_none() && is_expr_fine_for_hoist_props(&elem.expr), + None => true, + }), + + Expr::Object(o) => o.props.iter().all(|prop| match prop { + PropOrSpread::Spread(_) => false, + PropOrSpread::Prop(p) => match &**p { + Prop::Shorthand(..) => true, + Prop::KeyValue(p) => is_expr_fine_for_hoist_props(&p.value), + _ => false, + }, + }), + + _ => false, + } +} + impl Optimizer<'_> { /// Converts `{ a: 1 }.a` into `1`. pub(super) fn handle_property_access(&mut self, e: &mut Expr) { diff --git a/crates/swc_ecma_minifier/src/compress/optimize/unused.rs b/crates/swc_ecma_minifier/src/compress/optimize/unused.rs index bdff3644c4a3..19c5a952f0db 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/unused.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/unused.rs @@ -3,7 +3,7 @@ use swc_atoms::JsWord; use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_usage_analyzer::util::is_global_var_with_pure_property_access; -use swc_ecma_utils::{contains_ident_ref, ExprExt}; +use swc_ecma_utils::{contains_ident_ref, contains_this_expr, ExprExt}; use swc_ecma_visit::{noop_visit_type, Visit, VisitWith}; use super::Optimizer; @@ -26,6 +26,9 @@ impl Optimizer<'_> { var: &mut VarDeclarator, storage_for_side_effects: &mut Option>, ) { + if self.mode.preserve_vars() { + return; + } if var.name.is_invalid() { return; } @@ -732,7 +735,7 @@ impl Optimizer<'_> { /// `var Parser = function Parser() {};` => `var Parser = function () {}` pub(super) fn remove_duplicate_name_of_function(&mut self, v: &mut VarDeclarator) { - if !self.options.unused { + if !self.options.unused || self.options.hoist_props { return; } @@ -790,9 +793,59 @@ impl Optimizer<'_> { let properties_used_via_this = { let mut v = ThisPropertyVisitor::default(); obj.visit_with(&mut v); + if v.should_abort { + return None; + } v.properties }; + let mut unknown_used_props = self + .data + .vars + .get(&name.to_id()) + .map(|v| v.accessed_props.clone()) + .unwrap_or_default(); + + // If there's an access to an unknown property, we should preserve all + // properties. + for prop in &obj.props { + let prop = match prop { + PropOrSpread::Spread(_) => return None, + PropOrSpread::Prop(prop) => prop, + }; + + if contains_this_expr(prop) { + return None; + } + + match &**prop { + Prop::KeyValue(p) => match &p.key { + PropName::Str(s) => { + if let Some(v) = unknown_used_props.get_mut(&s.value) { + *v = 0; + } + } + PropName::Ident(i) => { + if let Some(v) = unknown_used_props.get_mut(&i.sym) { + *v = 0; + } + } + _ => return None, + }, + Prop::Shorthand(p) => { + if let Some(v) = unknown_used_props.get_mut(&p.sym) { + *v = 0; + } + } + _ => return None, + } + } + + if !unknown_used_props.iter().all(|(_, v)| *v == 0) { + log_abort!("[x] unknown used props: {:?}", unknown_used_props); + return None; + } + let should_preserve_property = |sym: &JsWord| { if let "toString" = &**sym { return true; @@ -843,6 +896,43 @@ struct ThisPropertyVisitor { impl Visit for ThisPropertyVisitor { noop_visit_type!(); + fn visit_assign_expr(&mut self, e: &AssignExpr) { + if self.should_abort { + return; + } + + e.visit_children_with(self); + + if self.should_abort { + return; + } + + if let Expr::This(..) = &*e.right { + if e.op == op!("=") || e.op.may_short_circuit() { + self.should_abort = true; + } + } + } + + fn visit_call_expr(&mut self, n: &CallExpr) { + if self.should_abort { + return; + } + + n.visit_children_with(self); + + if self.should_abort { + return; + } + + for arg in &n.args { + if arg.expr.is_this() { + self.should_abort = true; + return; + } + } + } + fn visit_member_expr(&mut self, e: &MemberExpr) { if self.should_abort { return; @@ -850,6 +940,10 @@ impl Visit for ThisPropertyVisitor { e.visit_children_with(self); + if self.should_abort { + return; + } + if let Expr::This(..) = &*e.obj { match &e.prop { MemberProp::Ident(p) => { diff --git a/crates/swc_ecma_minifier/src/compress/optimize/util.rs b/crates/swc_ecma_minifier/src/compress/optimize/util.rs index 08e96061da95..ab671c14a532 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/util.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/util.rs @@ -224,6 +224,7 @@ pub(crate) struct Finalizer<'a> { pub lits: &'a FxHashMap>, pub lits_for_cmp: &'a FxHashMap>, pub lits_for_array_access: &'a FxHashMap>, + pub hoisted_props: &'a FxHashMap<(Id, JsWord), Ident>, pub vars_to_remove: &'a FxHashSet, @@ -411,6 +412,17 @@ impl VisitMut for Finalizer<'_> { } else { n.visit_mut_children_with(self); } + + if let Expr::Member(e) = n { + if let Expr::Ident(obj) = &*e.obj { + if let MemberProp::Ident(prop) = &e.prop { + if let Some(ident) = self.hoisted_props.get(&(obj.to_id(), prop.sym.clone())) { + self.changed = true; + *n = ident.clone().into(); + } + } + } + } } fn visit_mut_stmts(&mut self, n: &mut Vec) { diff --git a/crates/swc_ecma_minifier/src/eval.rs b/crates/swc_ecma_minifier/src/eval.rs index 67137351cefd..15dd2d56bfb9 100644 --- a/crates/swc_ecma_minifier/src/eval.rs +++ b/crates/swc_ecma_minifier/src/eval.rs @@ -63,16 +63,21 @@ impl Mode for Eval { w.cache.insert(id, Box::new(value.clone())); } - fn force_str_for_tpl(&self) -> bool { + fn preserve_vars(&self) -> bool { true } fn should_be_very_correct(&self) -> bool { false } + + fn force_str_for_tpl(&self) -> bool { + true + } } impl Evaluator { + #[tracing::instrument(name = "Evaluator::run", level = "debug", skip_all)] fn run(&mut self) { if !self.done { self.done = true; @@ -83,7 +88,8 @@ impl Evaluator { self.module.visit_mut_with(&mut compressor( marks, &CompressOptions { - hoist_props: true, + // We should not drop unused variables. + unused: false, top_level: Some(TopLevelOptions { functions: true }), ..Default::default() }, diff --git a/crates/swc_ecma_minifier/src/mode.rs b/crates/swc_ecma_minifier/src/mode.rs index 55cad30e394c..8a3b1da59192 100644 --- a/crates/swc_ecma_minifier/src/mode.rs +++ b/crates/swc_ecma_minifier/src/mode.rs @@ -3,6 +3,8 @@ use swc_ecma_ast::*; pub(crate) trait Mode: Send + Sync { fn store(&self, id: Id, value: &Expr); + fn preserve_vars(&self) -> bool; + fn should_be_very_correct(&self) -> bool; /// If this returns true, template literals with `\n` or `\r` will be @@ -15,11 +17,15 @@ pub struct Minification; impl Mode for Minification { fn store(&self, _: Id, _: &Expr) {} - fn force_str_for_tpl(&self) -> bool { + fn preserve_vars(&self) -> bool { false } fn should_be_very_correct(&self) -> bool { true } + + fn force_str_for_tpl(&self) -> bool { + false + } } diff --git a/crates/swc_ecma_minifier/tests/TODO.txt b/crates/swc_ecma_minifier/tests/TODO.txt index 52ba12010a4d..2031e7c8c43e 100644 --- a/crates/swc_ecma_minifier/tests/TODO.txt +++ b/crates/swc_ecma_minifier/tests/TODO.txt @@ -15,7 +15,6 @@ block_scope/issue_334/input.js class_properties/class_expression_constant/input.js class_properties/mangle_class_properties_keep_quoted/input.js class_properties/static_means_execution/input.js -classes/pure_prop_assignment_for_classes/input.js collapse_vars/cascade_statement/input.js collapse_vars/chained_1/input.js collapse_vars/chained_2/input.js @@ -185,6 +184,8 @@ harmony/issue_2874_2/input.js harmony/module_enabled/input.js harmony/module_mangle_scope/input.js harmony/regression_cannot_use_of/input.js +hoist_props/contains_this_3/input.js +hoist_props/hoist_function_with_call/input.js if_return/if_return_same_value/input.js if_return/if_var_return/input.js if_return/issue_2747/input.js diff --git a/crates/swc_ecma_minifier/tests/benches-full/echarts.js b/crates/swc_ecma_minifier/tests/benches-full/echarts.js index 2b9f0d60bfcd..65b7c4b83093 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/echarts.js +++ b/crates/swc_ecma_minifier/tests/benches-full/echarts.js @@ -12842,33 +12842,28 @@ specialAreas: this._specialAreas }; }, GeoJSONResource; - }(), storage = createHashMap(), geoSourceManager = { - registerMap: function(mapName, rawDef, rawSpecialAreas) { - if (rawDef.svg) { - var resource = new GeoSVGResource(mapName, rawDef.svg); - storage.set(mapName, resource); - } else { - var geoJSON = rawDef.geoJson || rawDef.geoJSON; - geoJSON && !rawDef.features ? rawSpecialAreas = rawDef.specialAreas : geoJSON = rawDef; - var resource = new GeoJSONResource(mapName, geoJSON, rawSpecialAreas); - storage.set(mapName, resource); - } - }, - getGeoResource: function(mapName) { - return storage.get(mapName); - }, - getMapForUser: function(mapName) { - var resource = storage.get(mapName); - return resource && 'geoJSON' === resource.type && resource.getMapForUser(); - }, - load: function(mapName, nameMap, nameProperty) { - var resource = storage.get(mapName); - if (!resource) { - console.error('Map ' + mapName + ' not exists. The GeoJSON of the map must be provided.'); - return; - } - return resource.load(nameMap, nameProperty); + }(), storage = createHashMap(), geoSourceManager_registerMap = function(mapName, rawDef, rawSpecialAreas) { + if (rawDef.svg) { + var resource = new GeoSVGResource(mapName, rawDef.svg); + storage.set(mapName, resource); + } else { + var geoJSON = rawDef.geoJson || rawDef.geoJSON; + geoJSON && !rawDef.features ? rawSpecialAreas = rawDef.specialAreas : geoJSON = rawDef; + var resource = new GeoJSONResource(mapName, geoJSON, rawSpecialAreas); + storage.set(mapName, resource); + } + }, geoSourceManager_getGeoResource = function(mapName) { + return storage.get(mapName); + }, geoSourceManager_getMapForUser = function(mapName) { + var resource = storage.get(mapName); + return resource && 'geoJSON' === resource.type && resource.getMapForUser(); + }, geoSourceManager_load = function(mapName, nameMap, nameProperty) { + var resource = storage.get(mapName); + if (!resource) { + console.error('Map ' + mapName + ' not exists. The GeoJSON of the map must be provided.'); + return; } + return resource.load(nameMap, nameProperty); }, isObject$2 = isObject, hasWindow = 'undefined' != typeof window, PRIORITY = { PROCESSOR: { FILTER: 1000, @@ -13727,7 +13722,7 @@ loadingEffects[name] = loadingFx; } function registerMap(mapName, geoJson, specialAreas) { - geoSourceManager.registerMap(mapName, geoJson, specialAreas); + geoSourceManager_registerMap(mapName, geoJson, specialAreas); } var registerTransform = function(externalTransform) { var type = (externalTransform = clone(externalTransform)).type; @@ -21235,7 +21230,7 @@ }, MapDraw.prototype._svgResourceChanged = function(mapName) { return this._svgMapName !== mapName; }, MapDraw.prototype._useSVG = function(mapName) { - var resource = geoSourceManager.getGeoResource(mapName); + var resource = geoSourceManager_getGeoResource(mapName); if (resource && 'geoSVG' === resource.type) { var svgGraphic = resource.useGraphic(this.uid); this._svgGroup.add(svgGraphic.root), this._svgGraphicRecord = svgGraphic, this._svgMapName = mapName; @@ -21243,7 +21238,7 @@ }, MapDraw.prototype._freeSVG = function() { var mapName = this._svgMapName; if (null != mapName) { - var resource = geoSourceManager.getGeoResource(mapName); + var resource = geoSourceManager_getGeoResource(mapName); resource && 'geoSVG' === resource.type && resource.freeGraphic(this.uid), this._svgGraphicRecord = null, this._svgDispatcherMap = null, this._svgGroup.removeAll(), this._svgMapName = null; } }, MapDraw.prototype._updateController = function(mapOrGeoModel, ecModel, api) { @@ -21432,7 +21427,7 @@ var name_2 = data.getName(i); dataNameMap.set(name_2, !0); } - return each(geoSourceManager.load(this.getMapType(), this.option.nameMap, this.option.nameProperty).regions, function(region) { + return each(geoSourceManager_load(this.getMapType(), this.option.nameMap, this.option.nameProperty).regions, function(region) { var name = region.name; dataNameMap.get(name) || toAppendNames.push(name); }), data.appendValues([], toAppendNames), data; @@ -21668,7 +21663,7 @@ 'lng', 'lat' ], _this.type = 'geo', _this._nameCoordMap = createHashMap(), _this.map = map; - var source = geoSourceManager.load(map, opt.nameMap, opt.nameProperty), resource = geoSourceManager.getGeoResource(map); + var source = geoSourceManager_load(map, opt.nameMap, opt.nameProperty), resource = geoSourceManager_getGeoResource(map); _this.resourceType = resource ? resource.type : null; var defaultParmas = GEO_DEFAULT_PARAMS[resource.type]; _this._regionsMap = source.regionsMap, _this._invertLongitute = defaultParmas.invertLongitute, _this.regions = source.regions, _this.aspectScale = retrieve2(opt.aspectScale, defaultParmas.aspectScale); @@ -21772,7 +21767,7 @@ }), geoList; }, GeoCreator.prototype.getFilledRegions = function(originRegionArr, mapName, nameMap, nameProperty) { for(var regionsArr = (originRegionArr || []).slice(), dataNameMap = createHashMap(), i = 0; i < regionsArr.length; i++)dataNameMap.set(regionsArr[i].name, regionsArr[i]); - return each(geoSourceManager.load(mapName, nameMap, nameProperty).regions, function(region) { + return each(geoSourceManager_load(mapName, nameMap, nameProperty).regions, function(region) { var name = region.name; dataNameMap.get(name) || regionsArr.push({ name: name @@ -21785,7 +21780,7 @@ return _this.type = GeoModel.type, _this; } return __extends(GeoModel, _super), GeoModel.prototype.init = function(option, parentModel, ecModel) { - var source = geoSourceManager.getGeoResource(option.map); + var source = geoSourceManager_getGeoResource(option.map); if (source && 'geoJSON' === source.type) { var itemStyle = option.itemStyle = option.itemStyle || {}; 'color' in itemStyle || (itemStyle.color = '#eee'); @@ -41277,7 +41272,7 @@ }, exports1.getInstanceByDom = getInstanceByDom, exports1.getInstanceById = function(key) { return instances$1[key]; }, exports1.getMap = function(mapName) { - return geoSourceManager.getMapForUser(mapName); + return geoSourceManager_getMapForUser(mapName); }, exports1.graphic = graphic$1, exports1.helper = helper, exports1.init = function(dom, theme, opts) { if (!dom) throw Error('Initialize failed: invalid dom.'); var existInstance = getInstanceByDom(dom); diff --git a/crates/swc_ecma_minifier/tests/benches-full/terser.js b/crates/swc_ecma_minifier/tests/benches-full/terser.js index 4895397bc661..a733570dff7c 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/terser.js +++ b/crates/swc_ecma_minifier/tests/benches-full/terser.js @@ -194,10 +194,7 @@ "&&", "??", "||" - ]), WHITESPACE_CHARS = makePredicate(characters(" \u00a0\n\r\t\f\u000b\u200b\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\uFEFF")), NEWLINE_CHARS = makePredicate(characters("\n\r\u2028\u2029")), PUNC_AFTER_EXPRESSION = makePredicate(characters(";]),:")), PUNC_BEFORE_EXPRESSION = makePredicate(characters("[{(,;:")), PUNC_CHARS = makePredicate(characters("[]{}(),;:")), UNICODE = { - ID_Start: /[$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, - ID_Continue: /(?:[$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4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10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0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11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF])+/ - }; + ]), WHITESPACE_CHARS = makePredicate(characters(" \u00a0\n\r\t\f\u000b\u200b\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\uFEFF")), NEWLINE_CHARS = makePredicate(characters("\n\r\u2028\u2029")), PUNC_AFTER_EXPRESSION = makePredicate(characters(";]),:")), PUNC_BEFORE_EXPRESSION = makePredicate(characters("[{(,;:")), PUNC_CHARS = makePredicate(characters("[]{}(),;:")), UNICODE_ID_Start = /[$A-Z_a-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\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DD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, UNICODE_ID_Continue = /(?:[$0-9A-Z_a-z\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\u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DF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF])+/; function get_full_char(str, pos) { if (is_surrogate_pair_head(str.charCodeAt(pos))) { if (is_surrogate_pair_tail(str.charCodeAt(pos + 1))) return str.charAt(pos) + str.charAt(pos + 1); @@ -214,10 +211,10 @@ return code >= 48 && code <= 57; } function is_identifier_start(ch) { - return UNICODE.ID_Start.test(ch); + return UNICODE_ID_Start.test(ch); } function is_identifier_char(ch) { - return UNICODE.ID_Continue.test(ch); + return UNICODE_ID_Continue.test(ch); } const BASIC_IDENT = /^[a-z_$][a-z0-9_$]*$/i; function is_basic_identifier_string(str) { @@ -226,8 +223,8 @@ function is_identifier_string(str, allow_surrogates) { if (BASIC_IDENT.test(str)) return !0; if (!allow_surrogates && /[\ud800-\udfff]/.test(str)) return !1; - var match = UNICODE.ID_Start.exec(str); - return !!match && 0 === match.index && (!(str = str.slice(match[0].length)) || !!(match = UNICODE.ID_Continue.exec(str)) && match[0].length === str.length); + var match = UNICODE_ID_Start.exec(str); + return !!match && 0 === match.index && (!(str = str.slice(match[0].length)) || !!(match = UNICODE_ID_Continue.exec(str)) && match[0].length === str.length); } function parse_js_number(num, allow_e = !0) { if (!allow_e && num.includes("e")) return NaN; diff --git a/crates/swc_ecma_minifier/tests/benches-full/three.js b/crates/swc_ecma_minifier/tests/benches-full/three.js index c22348a0a9d0..2607b3a3026b 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/three.js +++ b/crates/swc_ecma_minifier/tests/benches-full/three.js @@ -3266,19 +3266,15 @@ } }), WebGLCubeRenderTarget.prototype = Object.create(WebGLRenderTarget.prototype), WebGLCubeRenderTarget.prototype.constructor = WebGLCubeRenderTarget, WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = !0, WebGLCubeRenderTarget.prototype.fromEquirectangularTexture = function(renderer, texture) { this.texture.type = texture.type, this.texture.format = 1023, this.texture.encoding = texture.encoding, this.texture.generateMipmaps = texture.generateMipmaps, this.texture.minFilter = texture.minFilter, this.texture.magFilter = texture.magFilter; - var shader = { - uniforms: { + var geometry = new BoxBufferGeometry(5, 5, 5), material = new ShaderMaterial({ + name: 'CubemapFromEquirect', + uniforms: cloneUniforms({ tEquirect: { value: null } - }, + }), vertexShader: "\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include \n\t\t\t\t#include \n\n\t\t\t}\n\t\t", - fragmentShader: "\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t" - }, geometry = new BoxBufferGeometry(5, 5, 5), material = new ShaderMaterial({ - name: 'CubemapFromEquirect', - uniforms: cloneUniforms(shader.uniforms), - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader, + fragmentShader: "\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t", side: 1, blending: 0 }); @@ -8609,140 +8605,138 @@ return _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)), _this; } return _inheritsLoose(EdgesGeometry, _BufferGeometry), EdgesGeometry; - }(BufferGeometry), Earcut = { - triangulate: function(data, holeIndices, dim) { - dim = dim || 2; - var minX, minY, maxX, maxY, x, y, invSize, hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, !0), triangles = []; - if (!outerNode || outerNode.next === outerNode.prev) return triangles; - if (hasHoles && (outerNode = function(data, holeIndices, outerNode, dim) { - var i, len, start, end, list, queue = []; - for(i = 0, len = holeIndices.length; i < len; i++)start = holeIndices[i] * dim, end = i < len - 1 ? holeIndices[i + 1] * dim : data.length, (list = linkedList(data, start, end, dim, !1)) === list.next && (list.steiner = !0), queue.push(function(start) { - var p = start, leftmost = start; - do (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) && (leftmost = p), p = p.next; + }(BufferGeometry), Earcut_triangulate = function(data, holeIndices, dim) { + dim = dim || 2; + var minX, minY, maxX, maxY, x, y, invSize, hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, !0), triangles = []; + if (!outerNode || outerNode.next === outerNode.prev) return triangles; + if (hasHoles && (outerNode = function(data, holeIndices, outerNode, dim) { + var i, len, start, end, list, queue = []; + for(i = 0, len = holeIndices.length; i < len; i++)start = holeIndices[i] * dim, end = i < len - 1 ? holeIndices[i + 1] * dim : data.length, (list = linkedList(data, start, end, dim, !1)) === list.next && (list.steiner = !0), queue.push(function(start) { + var p = start, leftmost = start; + do (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) && (leftmost = p), p = p.next; + while (p !== start) + return leftmost; + }(list)); + for(queue.sort(compareX), i = 0; i < queue.length; i++)(function(hole, outerNode) { + if (outerNode = function(hole, outerNode) { + var m, p, m1, p1 = outerNode, hx = hole.x, hy = hole.y, qx = -1 / 0; + do { + if (hy <= p1.y && hy >= p1.next.y && p1.next.y !== p1.y) { + var x = p1.x + (hy - p1.y) * (p1.next.x - p1.x) / (p1.next.y - p1.y); + if (x <= hx && x > qx) { + if (qx = x, x === hx) { + if (hy === p1.y) return p1; + if (hy === p1.next.y) return p1.next; + } + m1 = p1.x < p1.next.x ? p1 : p1.next; + } + } + p1 = p1.next; + }while (p1 !== outerNode) + if (!m1) return null; + if (hx === qx) return m1; + var tan, stop = m1, mx = m1.x, my = m1.y, tanMin = 1 / 0; + p1 = m1; + do hx >= p1.x && p1.x >= mx && hx !== p1.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p1.x, p1.y) && (tan = Math.abs(hy - p1.y) / (hx - p1.x), locallyInside(p1, hole) && (tan < tanMin || tan === tanMin && (p1.x > m1.x || p1.x === m1.x && (m = m1, p = p1, 0 > area(m.prev, m, p.prev) && 0 > area(p.next, m, m.next)))) && (m1 = p1, tanMin = tan)), p1 = p1.next; + while (p1 !== stop) + return m1; + }(hole, outerNode)) { + var b = splitPolygon(outerNode, hole); + filterPoints(outerNode, outerNode.next), filterPoints(b, b.next); + } + })(queue[i], outerNode), outerNode = filterPoints(outerNode, outerNode.next); + return outerNode; + }(data, holeIndices, outerNode, dim)), data.length > 80 * dim) { + minX = maxX = data[0], minY = maxY = data[1]; + for(var i = dim; i < outerLen; i += dim)x = data[i], y = data[i + 1], x < minX && (minX = x), y < minY && (minY = y), x > maxX && (maxX = x), y > maxY && (maxY = y); + invSize = 0 !== (invSize = Math.max(maxX - minX, maxY - minY)) ? 1 / invSize : 0; + } + return function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { + if (ear) { + !pass && invSize && function(start, minX, minY, invSize) { + var p = start; + do null === p.z && (p.z = zOrder(p.x, p.y, minX, minY, invSize)), p.prevZ = p.prev, p.nextZ = p.next, p = p.next; while (p !== start) - return leftmost; - }(list)); - for(queue.sort(compareX), i = 0; i < queue.length; i++)(function(hole, outerNode) { - if (outerNode = function(hole, outerNode) { - var m, p, m1, p1 = outerNode, hx = hole.x, hy = hole.y, qx = -1 / 0; + p.prevZ.nextZ = null, p.prevZ = null, function(list) { + var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1; do { - if (hy <= p1.y && hy >= p1.next.y && p1.next.y !== p1.y) { - var x = p1.x + (hy - p1.y) * (p1.next.x - p1.x) / (p1.next.y - p1.y); - if (x <= hx && x > qx) { - if (qx = x, x === hx) { - if (hy === p1.y) return p1; - if (hy === p1.next.y) return p1.next; - } - m1 = p1.x < p1.next.x ? p1 : p1.next; - } + for(p = list, list = null, tail = null, numMerges = 0; p;){ + for(numMerges++, q = p, pSize = 0, i = 0; i < inSize && (pSize++, q = q.nextZ); i++); + for(qSize = inSize; pSize > 0 || qSize > 0 && q;)0 !== pSize && (0 === qSize || !q || p.z <= q.z) ? (e = p, p = p.nextZ, pSize--) : (e = q, q = q.nextZ, qSize--), tail ? tail.nextZ = e : list = e, e.prevZ = tail, tail = e; + p = q; } - p1 = p1.next; - }while (p1 !== outerNode) - if (!m1) return null; - if (hx === qx) return m1; - var tan, stop = m1, mx = m1.x, my = m1.y, tanMin = 1 / 0; - p1 = m1; - do hx >= p1.x && p1.x >= mx && hx !== p1.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p1.x, p1.y) && (tan = Math.abs(hy - p1.y) / (hx - p1.x), locallyInside(p1, hole) && (tan < tanMin || tan === tanMin && (p1.x > m1.x || p1.x === m1.x && (m = m1, p = p1, 0 > area(m.prev, m, p.prev) && 0 > area(p.next, m, m.next)))) && (m1 = p1, tanMin = tan)), p1 = p1.next; - while (p1 !== stop) - return m1; - }(hole, outerNode)) { - var b = splitPolygon(outerNode, hole); - filterPoints(outerNode, outerNode.next), filterPoints(b, b.next); + tail.nextZ = null, inSize *= 2; + }while (numMerges > 1) + }(p); + }(ear, minX, minY, invSize); + for(var prev, next, stop = ear; ear.prev !== ear.next;){ + if (prev = ear.prev, next = ear.next, invSize ? function(ear, minX, minY, invSize) { + var a = ear.prev, c = ear.next; + if (area(a, ear, c) >= 0) return !1; + for(var minTX = a.x < ear.x ? a.x < c.x ? a.x : c.x : ear.x < c.x ? ear.x : c.x, minTY = a.y < ear.y ? a.y < c.y ? a.y : c.y : ear.y < c.y ? ear.y : c.y, maxTX = a.x > ear.x ? a.x > c.x ? a.x : c.x : ear.x > c.x ? ear.x : c.x, maxTY = a.y > ear.y ? a.y > c.y ? a.y : c.y : ear.y > c.y ? ear.y : c.y, minZ = zOrder(minTX, minTY, minX, minY, invSize), maxZ = zOrder(maxTX, maxTY, minX, minY, invSize), p = ear.prevZ, n = ear.nextZ; p && p.z >= minZ && n && n.z <= maxZ;){ + if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0 || (p = p.prevZ, n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0)) return !1; + n = n.nextZ; + } + for(; p && p.z >= minZ;){ + if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return !1; + p = p.prevZ; + } + for(; n && n.z <= maxZ;){ + if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return !1; + n = n.nextZ; + } + return !0; + }(ear, minX, minY, invSize) : function(ear) { + var a = ear.prev, c = ear.next; + if (area(a, ear, c) >= 0) return !1; + for(var p = ear.next.next; p !== ear.prev;){ + if (pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return !1; + p = p.next; + } + return !0; + }(ear)) { + triangles.push(prev.i / dim), triangles.push(ear.i / dim), triangles.push(next.i / dim), removeNode(ear), ear = next.next, stop = next.next; + continue; } - })(queue[i], outerNode), outerNode = filterPoints(outerNode, outerNode.next); - return outerNode; - }(data, holeIndices, outerNode, dim)), data.length > 80 * dim) { - minX = maxX = data[0], minY = maxY = data[1]; - for(var i = dim; i < outerLen; i += dim)x = data[i], y = data[i + 1], x < minX && (minX = x), y < minY && (minY = y), x > maxX && (maxX = x), y > maxY && (maxY = y); - invSize = 0 !== (invSize = Math.max(maxX - minX, maxY - minY)) ? 1 / invSize : 0; - } - return function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { - if (ear) { - !pass && invSize && function(start, minX, minY, invSize) { - var p = start; - do null === p.z && (p.z = zOrder(p.x, p.y, minX, minY, invSize)), p.prevZ = p.prev, p.nextZ = p.next, p = p.next; - while (p !== start) - p.prevZ.nextZ = null, p.prevZ = null, function(list) { - var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1; + if ((ear = next) === stop) { + pass ? 1 === pass ? earcutLinked(ear = function(start, triangles, dim) { + var p = start; do { - for(p = list, list = null, tail = null, numMerges = 0; p;){ - for(numMerges++, q = p, pSize = 0, i = 0; i < inSize && (pSize++, q = q.nextZ); i++); - for(qSize = inSize; pSize > 0 || qSize > 0 && q;)0 !== pSize && (0 === qSize || !q || p.z <= q.z) ? (e = p, p = p.nextZ, pSize--) : (e = q, q = q.nextZ, qSize--), tail ? tail.nextZ = e : list = e, e.prevZ = tail, tail = e; - p = q; - } - tail.nextZ = null, inSize *= 2; - }while (numMerges > 1) - }(p); - }(ear, minX, minY, invSize); - for(var prev, next, stop = ear; ear.prev !== ear.next;){ - if (prev = ear.prev, next = ear.next, invSize ? function(ear, minX, minY, invSize) { - var a = ear.prev, c = ear.next; - if (area(a, ear, c) >= 0) return !1; - for(var minTX = a.x < ear.x ? a.x < c.x ? a.x : c.x : ear.x < c.x ? ear.x : c.x, minTY = a.y < ear.y ? a.y < c.y ? a.y : c.y : ear.y < c.y ? ear.y : c.y, maxTX = a.x > ear.x ? a.x > c.x ? a.x : c.x : ear.x > c.x ? ear.x : c.x, maxTY = a.y > ear.y ? a.y > c.y ? a.y : c.y : ear.y > c.y ? ear.y : c.y, minZ = zOrder(minTX, minTY, minX, minY, invSize), maxZ = zOrder(maxTX, maxTY, minX, minY, invSize), p = ear.prevZ, n = ear.nextZ; p && p.z >= minZ && n && n.z <= maxZ;){ - if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0 || (p = p.prevZ, n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0)) return !1; - n = n.nextZ; - } - for(; p && p.z >= minZ;){ - if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return !1; - p = p.prevZ; - } - for(; n && n.z <= maxZ;){ - if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return !1; - n = n.nextZ; - } - return !0; - }(ear, minX, minY, invSize) : function(ear) { - var a = ear.prev, c = ear.next; - if (area(a, ear, c) >= 0) return !1; - for(var p = ear.next.next; p !== ear.prev;){ - if (pointInTriangle(a.x, a.y, ear.x, ear.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return !1; - p = p.next; - } - return !0; - }(ear)) { - triangles.push(prev.i / dim), triangles.push(ear.i / dim), triangles.push(next.i / dim), removeNode(ear), ear = next.next, stop = next.next; - continue; - } - if ((ear = next) === stop) { - pass ? 1 === pass ? earcutLinked(ear = function(start, triangles, dim) { - var p = start; - do { - var a = p.prev, b = p.next.next; - !equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a) && (triangles.push(a.i / dim), triangles.push(p.i / dim), triangles.push(b.i / dim), removeNode(p), removeNode(p.next), p = start = b), p = p.next; - }while (p !== start) - return filterPoints(p); - }(filterPoints(ear), triangles, dim), triangles, dim, minX, minY, invSize, 2) : 2 === pass && function(start, triangles, dim, minX, minY, invSize) { - var a = start; - do { - for(var a1, b, b1 = a.next.next; b1 !== a.prev;){ - if (a.i !== b1.i && (a1 = a, b = b1, a1.next.i !== b.i && a1.prev.i !== b.i && !function(a, b) { - var p = a; - do { - if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return !0; - p = p.next; - }while (p !== a) - return !1; - }(a1, b) && (locallyInside(a1, b) && locallyInside(b, a1) && function(a, b) { - var p = a, inside = !1, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2; - do p.y > py != p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x && (inside = !inside), p = p.next; - while (p !== a) - return inside; - }(a1, b) && (area(a1.prev, a1, b.prev) || area(a1, b.prev, b)) || equals(a1, b) && area(a1.prev, a1, a1.next) > 0 && area(b.prev, b, b.next) > 0))) { - var c = splitPolygon(a, b1); - a = filterPoints(a, a.next), c = filterPoints(c, c.next), earcutLinked(a, triangles, dim, minX, minY, invSize), earcutLinked(c, triangles, dim, minX, minY, invSize); - return; - } - b1 = b1.next; + var a = p.prev, b = p.next.next; + !equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a) && (triangles.push(a.i / dim), triangles.push(p.i / dim), triangles.push(b.i / dim), removeNode(p), removeNode(p.next), p = start = b), p = p.next; + }while (p !== start) + return filterPoints(p); + }(filterPoints(ear), triangles, dim), triangles, dim, minX, minY, invSize, 2) : 2 === pass && function(start, triangles, dim, minX, minY, invSize) { + var a = start; + do { + for(var a1, b, b1 = a.next.next; b1 !== a.prev;){ + if (a.i !== b1.i && (a1 = a, b = b1, a1.next.i !== b.i && a1.prev.i !== b.i && !function(a, b) { + var p = a; + do { + if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return !0; + p = p.next; + }while (p !== a) + return !1; + }(a1, b) && (locallyInside(a1, b) && locallyInside(b, a1) && function(a, b) { + var p = a, inside = !1, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2; + do p.y > py != p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x && (inside = !inside), p = p.next; + while (p !== a) + return inside; + }(a1, b) && (area(a1.prev, a1, b.prev) || area(a1, b.prev, b)) || equals(a1, b) && area(a1.prev, a1, a1.next) > 0 && area(b.prev, b, b.next) > 0))) { + var c = splitPolygon(a, b1); + a = filterPoints(a, a.next), c = filterPoints(c, c.next), earcutLinked(a, triangles, dim, minX, minY, invSize), earcutLinked(c, triangles, dim, minX, minY, invSize); + return; } - a = a.next; - }while (a !== start) - }(ear, triangles, dim, minX, minY, invSize) : earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); - break; - } + b1 = b1.next; + } + a = a.next; + }while (a !== start) + }(ear, triangles, dim, minX, minY, invSize) : earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); + break; } } - }(outerNode, triangles, dim, minX, minY, invSize), triangles; - } + } + }(outerNode, triangles, dim, minX, minY, invSize), triangles; }; function linkedList(data, start, end, dim, clockwise) { var i, last; @@ -8820,7 +8814,7 @@ var holeIndex = contour.length; holes.forEach(removeDupEndPts); for(var i = 0; i < holes.length; i++)holeIndices.push(holeIndex), holeIndex += holes[i].length, addContour(vertices, holes[i]); - for(var triangles = Earcut.triangulate(vertices, holeIndices), _i = 0; _i < triangles.length; _i += 3)faces.push(triangles.slice(_i, _i + 3)); + for(var triangles = Earcut_triangulate(vertices, holeIndices), _i = 0; _i < triangles.length; _i += 3)faces.push(triangles.slice(_i, _i + 3)); return faces; } }; diff --git a/crates/swc_ecma_minifier/tests/benches-full/victory.js b/crates/swc_ecma_minifier/tests/benches-full/victory.js index 6cc3aba9fd45..08164beb4ea8 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/victory.js +++ b/crates/swc_ecma_minifier/tests/benches-full/victory.js @@ -12117,27 +12117,23 @@ min > globalMax - size ? globalMax - size : Math.max(min, globalMin), max < globalMin + size ? globalMin + size : Math.min(max, globalMax) ]; - }, fallbackProps = { - brushAreaStyle: { - stroke: "none", - fill: "black", - opacity: function(_ref) { - return _ref.active ? 0.2 : 0.1; - } - }, - brushStyle: { - pointerEvents: "none", - stroke: "none", - fill: "black", - opacity: function(_ref2) { - return _ref2.active ? 0.4 : 0.3; - } - }, - handleStyle: { - pointerEvents: "none", - stroke: "none", - fill: "none" - } + }, fallbackProps_brushAreaStyle = { + stroke: "none", + fill: "black", + opacity: function(_ref) { + return _ref.active ? 0.2 : 0.1; + } + }, fallbackProps_brushStyle = { + pointerEvents: "none", + stroke: "none", + fill: "black", + opacity: function(_ref2) { + return _ref2.active ? 0.4 : 0.3; + } + }, fallbackProps_handleStyle = { + pointerEvents: "none", + stroke: "none", + fill: "none" }, VictoryBrushLine = function(_React$Component) { var protoProps; function VictoryBrushLine() { @@ -12225,7 +12221,7 @@ value: function(props) { var handleComponent = props.handleComponent, handleStyle = props.handleStyle, id = props.id, brushDomain = props.brushDomain, _props$datum = props.datum, datum = void 0 === _props$datum ? {} : _props$datum, _props$activeBrushes2 = props.activeBrushes, activeBrushes = void 0 === _props$activeBrushes2 ? {} : _props$activeBrushes2; if (!brushDomain) return null; - var handleDimensions = this.getHandleDimensions(props), style = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, fallbackProps.handleStyle, handleStyle), minDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({ + var handleDimensions = this.getHandleDimensions(props), style = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, fallbackProps_handleStyle, handleStyle), minDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({ handleValue: victory_core__WEBPACK_IMPORTED_MODULE_6__.Collection.getMinValue(brushDomain) }, datum), maxDatum = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({ handleValue: victory_core__WEBPACK_IMPORTED_MODULE_6__.Collection.getMaxValue(brushDomain) @@ -12253,7 +12249,7 @@ value: function(props) { var brushComponent = props.brushComponent, brushStyle = props.brushStyle, _props$activeBrushes3 = props.activeBrushes, _props$datum2 = props.datum; if (!props.brushDomain) return null; - var brushWidth = props.brushWidth || props.width, rectDimensions = this.getRectDimensions(props, brushWidth), baseStyle = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, fallbackProps.brushStyle, brushStyle), style = victory_core__WEBPACK_IMPORTED_MODULE_6__.Helpers.evaluateStyle(baseStyle, { + var brushWidth = props.brushWidth || props.width, rectDimensions = this.getRectDimensions(props, brushWidth), baseStyle = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({}, fallbackProps_brushStyle, brushStyle), style = victory_core__WEBPACK_IMPORTED_MODULE_6__.Helpers.evaluateStyle(baseStyle, { datum: void 0 === _props$datum2 ? {} : _props$datum2, active: (void 0 === _props$activeBrushes3 ? {} : _props$activeBrushes3).brush }), brushProps = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({ @@ -12267,7 +12263,7 @@ value: function(props) { var brushAreaComponent = props.brushAreaComponent, brushAreaStyle = props.brushAreaStyle, _props$activeBrushes4 = props.activeBrushes, _props$datum3 = props.datum, brushAreaWidth = props.brushAreaWidth || props.width, cursor = this.getCursor(props), rectDimensions = this.getRectDimensions(props, brushAreaWidth, getFullDomain(props)), baseStyle = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({ cursor: cursor - }, fallbackProps.brushAreaStyle, brushAreaStyle), style = victory_core__WEBPACK_IMPORTED_MODULE_6__.Helpers.evaluateStyle(baseStyle, { + }, fallbackProps_brushAreaStyle, brushAreaStyle), style = victory_core__WEBPACK_IMPORTED_MODULE_6__.Helpers.evaluateStyle(baseStyle, { datum: void 0 === _props$datum3 ? {} : _props$datum3, active: (void 0 === _props$activeBrushes4 ? {} : _props$activeBrushes4).brushArea }), brushAreaProps = lodash_assign__WEBPACK_IMPORTED_MODULE_3___default()({ diff --git a/crates/swc_ecma_minifier/tests/exec.rs b/crates/swc_ecma_minifier/tests/exec.rs index 0097d9bc6f19..59374233bafc 100644 --- a/crates/swc_ecma_minifier/tests/exec.rs +++ b/crates/swc_ecma_minifier/tests/exec.rs @@ -2094,6 +2094,7 @@ console.log(a, b);"###; } #[test] +#[ignore = "Function (anonymous)"] fn terser_hoist_props_contains_this_2() { let src = r###"var o = { u: function () { diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/issue-2604/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/issue-2604/1/output.js index a5a5a348ff33..5b6779300bed 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/issue-2604/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/issue-2604/1/output.js @@ -15,7 +15,37 @@ push({ }(); }, "App.jsx": function() { - var ShaderChunk = {}; + var ShaderChunk = { + shadowmap_pars_vertex: "", + shadowmap_vertex: "", + shadowmask_pars_fragment: "", + skinbase_vertex: "", + skinning_pars_vertex: "", + skinning_vertex: "", + skinnormal_vertex: "", + specularmap_fragment: "", + specularmap_pars_fragment: "", + tonemapping_fragment: "", + tonemapping_pars_fragment: "", + uv_pars_fragment: "", + uv_pars_vertex: "", + uv_vertex: "", + uv2_pars_fragment: "", + uv2_pars_vertex: "", + uv2_vertex: "", + worldpos_vertex: "", + cube_frag: "", + cube_vert: "", + depth_frag: "", + depth_vert: "", + distanceRGBA_frag: "", + distanceRGBA_vert: "", + equirect_frag: "", + equirect_vert: "", + linedashed_frag: "", + linedashed_vert: "", + meshphong_frag: "" + }; ShaderLib.physical = { x: ShaderChunk.meshphysical_frag }; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js index 43fbdaf01484..964cb1133f56 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js @@ -4953,7 +4953,7 @@ } } ]), Code39Reader; - }(barcode_reader), get = __webpack_require__(13), get_default = __webpack_require__.n(get), code_39_vin_reader = function(_Code39Reader) { + }(barcode_reader), get = __webpack_require__(13), get_default = __webpack_require__.n(get), patterns_IOQ = /[IOQ]/g, patterns_AZ09 = /[A-Z0-9]{17}/, code_39_vin_reader = function(_Code39Reader) { inherits_default()(Code39VINReader, _Code39Reader); var hasNativeReflectConstruct, _super = (hasNativeReflectConstruct = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; @@ -4988,7 +4988,7 @@ var result = get_default()(getPrototypeOf_default()(Code39VINReader.prototype), "decode", this).call(this, row, start); if (!result) return null; var code = result.code; - return code ? (code = code.replace(/[IOQ]/g, "")).match(/[A-Z0-9]{17}/) ? this._checkChecksum(code) ? (result.code = code, result) : null : (console.log("Failed AZ09 pattern code:", code), null) : null; + return code ? (code = code.replace(patterns_IOQ, "")).match(patterns_AZ09) ? this._checkChecksum(code) ? (result.code = code, result) : null : (console.log("Failed AZ09 pattern code:", code), null) : null; } } ]), Code39VINReader; @@ -6249,7 +6249,7 @@ } } ]), Code93Reader; - }(barcode_reader), code_32_reader = function(_Code39Reader) { + }(barcode_reader), code_32_reader_patterns_AEIO = /[AEIO]/g, code_32_reader = function(_Code39Reader) { inherits_default()(Code32Reader, _Code39Reader); var hasNativeReflectConstruct, _super = (hasNativeReflectConstruct = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; @@ -6293,7 +6293,7 @@ var result = get_default()(getPrototypeOf_default()(Code32Reader.prototype), "decode", this).call(this, row, start); if (!result) return null; var code = result.code; - if (!code || (code = code.replace(/[AEIO]/g, ""), !this._checkChecksum(code))) return null; + if (!code || (code = code.replace(code_32_reader_patterns_AEIO, ""), !this._checkChecksum(code))) return null; var code32 = this._decodeCode32(code); return code32 ? (result.code = code32, result) : null; } 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 9522a960fc86..92e1bc35e1c7 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 @@ -1157,27 +1157,16 @@ }; }) }); - }, textTrackConverter = { - textTracksToJson: function(tech) { - var trackEls = tech.$$("track"), trackObjs = Array.prototype.map.call(trackEls, function(t) { - return t.track; - }); - return Array.prototype.map.call(trackEls, function(trackEl) { - var json = trackToJson_(trackEl.track); - return trackEl.src && (json.src = trackEl.src), json; - }).concat(Array.prototype.filter.call(tech.textTracks(), function(track) { - return -1 === trackObjs.indexOf(track); - }).map(trackToJson_)); - }, - jsonToTextTracks: function(json, tech) { - return json.forEach(function(track) { - var addedTrack = tech.addRemoteTextTrack(track).track; - !track.src && track.cues && track.cues.forEach(function(cue) { - return addedTrack.addCue(cue); - }); - }), tech.textTracks(); - }, - trackToJson_: trackToJson_ + }, textTrackConverter_textTracksToJson = function(tech) { + var trackEls = tech.$$("track"), trackObjs = Array.prototype.map.call(trackEls, function(t) { + return t.track; + }); + return Array.prototype.map.call(trackEls, function(trackEl) { + var json = trackToJson_(trackEl.track); + return trackEl.src && (json.src = trackEl.src), json; + }).concat(Array.prototype.filter.call(tech.textTracks(), function(track) { + return -1 === trackObjs.indexOf(track); + }).map(trackToJson_)); }, MODAL_CLASS_NAME = "vjs-modal-dialog", ModalDialog = function(_Component) { function ModalDialog(player, options) { var _this; @@ -5291,7 +5280,7 @@ var ratioParts = (void 0 !== this.aspectRatio_ && "auto" !== this.aspectRatio_ ? this.aspectRatio_ : this.videoWidth() > 0 ? this.videoWidth() + ":" + this.videoHeight() : "16:9").split(":"), ratioMultiplier = ratioParts[1] / ratioParts[0]; width = void 0 !== this.width_ ? this.width_ : void 0 !== this.height_ ? this.height_ / ratioMultiplier : this.videoWidth() || 300, height = void 0 !== this.height_ ? this.height_ : width * ratioMultiplier, idClass = /^[^a-zA-Z]/.test(this.id()) ? "dimensions-" + this.id() : this.id() + "-dimensions", this.addClass(idClass), setTextContent(this.styleEl_, "\n ." + idClass + " {\n width: " + width + "px;\n height: " + height + "px;\n }\n\n ." + idClass + ".vjs-fluid {\n padding-top: " + 100 * ratioMultiplier + "%;\n }\n "); }, _proto.loadTech_ = function(techName, source) { - var _this4 = this; + var json, tech, _this4 = this; this.tech_ && this.unloadTech_(); var titleTechName = toTitleCase$1(techName), camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1); "Html5" !== titleTechName && this.tag && (Tech.getTech("Html5").disposeMediaElement(this.tag), this.tag.player = null, this.tag = null), this.techName_ = titleTechName, this.isReady_ = !1; @@ -5322,7 +5311,12 @@ }), assign(techOptions, this.options_[titleTechName]), assign(techOptions, this.options_[camelTechName]), assign(techOptions, this.options_[techName.toLowerCase()]), this.tag && (techOptions.tag = this.tag), source && source.src === this.cache_.src && this.cache_.currentTime > 0 && (techOptions.startTime = this.cache_.currentTime); var TechClass = Tech.getTech(techName); if (!TechClass) throw Error("No Tech named '" + titleTechName + "' exists! '" + titleTechName + "' should be registered using videojs.registerTech()'"); - this.tech_ = new TechClass(techOptions), this.tech_.ready(bind(this, this.handleTechReady_), !0), textTrackConverter.jsonToTextTracks(this.textTracksJson_ || [], this.tech_), TECH_EVENTS_RETRIGGER.forEach(function(event) { + this.tech_ = new TechClass(techOptions), this.tech_.ready(bind(this, this.handleTechReady_), !0), json = this.textTracksJson_ || [], tech = this.tech_, json.forEach(function(track) { + var addedTrack = tech.addRemoteTextTrack(track).track; + !track.src && track.cues && track.cues.forEach(function(cue) { + return addedTrack.addCue(cue); + }); + }), tech.textTracks(), TECH_EVENTS_RETRIGGER.forEach(function(event) { _this4.on(_this4.tech_, event, function(e) { return _this4["handleTech" + toTitleCase$1(event) + "_"](e); }); @@ -5377,7 +5371,7 @@ ALL.names.forEach(function(name) { var props = ALL[name]; _this5[props.privateName] = _this5[props.getterName](); - }), this.textTracksJson_ = textTrackConverter.textTracksToJson(this.tech_), this.isReady_ = !1, this.tech_.dispose(), this.tech_ = !1, this.isPosterFromTech_ && (this.poster_ = "", this.trigger("posterchange")), this.isPosterFromTech_ = !1; + }), this.textTracksJson_ = textTrackConverter_textTracksToJson(this.tech_), this.isReady_ = !1, this.tech_.dispose(), this.tech_ = !1, this.isPosterFromTech_ && (this.poster_ = "", this.trigger("posterchange")), this.isPosterFromTech_ = !1; }, _proto.tech = function(safety) { return void 0 === safety && log$1.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"), this.tech_; }, _proto.addTechControlsListeners_ = function() { @@ -7581,7 +7575,7 @@ }, getWorkerString = function(fn) { return fn.toString().replace(/^function.+?{/, "").slice(0, -1); }, TransmuxWorker = factory(transform(getWorkerString(function() { - var _TransportPacketStream, _TransportParseStream, _ElementaryStream, _AdtsStream, ExpGolomb, _H264Stream, _NalByteStream, PROFILES_WITH_OPTIONAL_SPS_DATA, _AacStream, _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream, timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, Stream = function() { + var _TransportPacketStream, _TransportParseStream, _ElementaryStream, _AdtsStream, ExpGolomb, _H264Stream, _NalByteStream, PROFILES_WITH_OPTIONAL_SPS_DATA, _AacStream, _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream, startTime, getTimescaleFromMediaHeader, Stream = function() { this.init = function() { var listeners = {}; this.on = function(type, listener) { @@ -8404,10 +8398,8 @@ return "audio" === track.type ? audioTrun(track, offset) : videoTrun(track, offset); }; var mp4Generator = { - ftyp: ftyp, mdat: mdat, moof: moof, - moov: moov, initSegment: function(tracks) { var result, fileType = ftyp(), movie = moov(tracks); return (result = new Uint8Array(fileType.byteLength + movie.byteLength)).set(fileType), result.set(movie, fileType.byteLength), result; @@ -8453,15 +8445,6 @@ var h, i, j, currentGop, currentFrame, currentNal, dataOffset = 0, data = new Uint8Array(gops.byteLength + 4 * gops.nalCount), view = new DataView(data.buffer); for(h = 0; h < gops.length; h++)for(i = 0, currentGop = gops[h]; i < currentGop.length; i++)for(j = 0, currentFrame = currentGop[i]; j < currentFrame.length; j++)currentNal = currentFrame[j], view.setUint32(dataOffset, currentNal.data.byteLength), dataOffset += 4, data.set(currentNal.data, dataOffset), dataOffset += currentNal.data.byteLength; return data; - }, - generateSampleTableForFrame: function(frame, baseDataOffset) { - var samples = []; - return samples.push(sampleForFrame(frame, baseDataOffset || 0)), samples; - }, - concatenateNalDataForFrame: function(frame) { - var i, currentNal, dataOffset = 0, data = new Uint8Array(frame.byteLength + 4 * frame.length), view = new DataView(data.buffer); - for(i = 0; i < frame.length; i++)currentNal = frame[i], view.setUint32(dataOffset, currentNal.data.byteLength), dataOffset += 4, data.set(currentNal.data, dataOffset), dataOffset += currentNal.data.byteLength; - return data; } }, highPrefix = [ 33, @@ -8732,9 +8715,7 @@ var clock = { ONE_SECOND_IN_TS: 90000, secondsToVideoTs: secondsToVideoTs, - secondsToAudioTs: secondsToAudioTs, videoTsToSeconds: videoTsToSeconds, - audioTsToSeconds: audioTsToSeconds, audioTsToVideoTs: audioTsToVideoTs, videoTsToAudioTs: videoTsToAudioTs, metadataTsToSeconds: metadataTsToSeconds @@ -8742,36 +8723,27 @@ var i, sum = 0; for(i = 0; i < array.length; i++)sum += array[i].data.byteLength; return sum; - }, audioFrameUtils = { - prefixWithSilence: function(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { - var baseMediaDecodeTimeTs, silentFrame, i, firstFrame, frameDuration = 0, audioFillFrameCount = 0, audioFillDuration = 0; - if (frames.length && (baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)), audioAppendStartTs && videoBaseMediaDecodeTime && (audioFillDuration = (audioFillFrameCount = Math.floor((baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime)) / frameDuration)) * frameDuration), !(audioFillFrameCount < 1) && !(audioFillDuration > clock.ONE_SECOND_IN_TS / 2))) { - for((silentFrame = silence_1()[track.samplerate]) || (silentFrame = frames[0].data), i = 0; i < audioFillFrameCount; i++)firstFrame = frames[0], frames.splice(0, 0, { - data: silentFrame, - dts: firstFrame.dts - frameDuration, - pts: firstFrame.pts - frameDuration - }); - return track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)), audioFillDuration; - } - }, - trimAdtsFramesByEarliestDts: function(adtsFrames, track, earliestAllowedDts) { - return track.minSegmentDts >= earliestAllowedDts ? adtsFrames : (track.minSegmentDts = 1 / 0, adtsFrames.filter(function(currentFrame) { - return currentFrame.dts >= earliestAllowedDts && (track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts), track.minSegmentPts = track.minSegmentDts, !0); - })); - }, - generateSampleTable: function(frames) { - var i, samples = []; - for(i = 0; i < frames.length; i++)samples.push({ - size: frames[i].data.byteLength, - duration: 1024 + }, audioFrameUtils_prefixWithSilence = function(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) { + var baseMediaDecodeTimeTs, silentFrame, i, firstFrame, frameDuration = 0, audioFillFrameCount = 0, audioFillDuration = 0; + if (frames.length && (baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024)), audioAppendStartTs && videoBaseMediaDecodeTime && (audioFillDuration = (audioFillFrameCount = Math.floor((baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime)) / frameDuration)) * frameDuration), !(audioFillFrameCount < 1) && !(audioFillDuration > clock.ONE_SECOND_IN_TS / 2))) { + for((silentFrame = silence_1()[track.samplerate]) || (silentFrame = frames[0].data), i = 0; i < audioFillFrameCount; i++)firstFrame = frames[0], frames.splice(0, 0, { + data: silentFrame, + dts: firstFrame.dts - frameDuration, + pts: firstFrame.pts - frameDuration }); - return samples; - }, - concatenateFrameData: function(frames) { - var i, currentFrame, dataOffset = 0, data = new Uint8Array(sumFrameByteLengths(frames)); - for(i = 0; i < frames.length; i++)currentFrame = frames[i], data.set(currentFrame.data, dataOffset), dataOffset += currentFrame.data.byteLength; - return data; - } + return track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate)), audioFillDuration; + } + }, audioFrameUtils_generateSampleTable = function(frames) { + var i, samples = []; + for(i = 0; i < frames.length; i++)samples.push({ + size: frames[i].data.byteLength, + duration: 1024 + }); + return samples; + }, audioFrameUtils_concatenateFrameData = function(frames) { + var i, currentFrame, dataOffset = 0, data = new Uint8Array(sumFrameByteLengths(frames)); + for(i = 0; i < frames.length; i++)currentFrame = frames[i], data.set(currentFrame.data, dataOffset), dataOffset += currentFrame.data.byteLength; + return data; }, ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS, trackDecodeInfo = { clearDtsInfo: function(track) { delete track.minSegmentDts, delete track.maxSegmentDts, delete track.minSegmentPts, delete track.maxSegmentPts; @@ -8783,46 +8755,31 @@ collectDtsInfo: function(track, data) { "number" == typeof data.pts && (void 0 === track.timelineStartInfo.pts && (track.timelineStartInfo.pts = data.pts), void 0 === track.minSegmentPts ? track.minSegmentPts = data.pts : track.minSegmentPts = Math.min(track.minSegmentPts, data.pts), void 0 === track.maxSegmentPts ? track.maxSegmentPts = data.pts : track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts)), "number" == typeof data.dts && (void 0 === track.timelineStartInfo.dts && (track.timelineStartInfo.dts = data.dts), void 0 === track.minSegmentDts ? track.minSegmentDts = data.dts : track.minSegmentDts = Math.min(track.minSegmentDts, data.dts), void 0 === track.maxSegmentDts ? track.maxSegmentDts = data.dts : track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts)); } - }, captionPacketParser = { - parseSei: function(bytes) { - for(var i = 0, result = { - payloadType: -1, - payloadSize: 0 - }, payloadType = 0, payloadSize = 0; i < bytes.byteLength && 128 !== bytes[i];){ - for(; 0xff === bytes[i];)payloadType += 255, i++; - for(payloadType += bytes[i++]; 0xff === bytes[i];)payloadSize += 255, i++; - if (payloadSize += bytes[i++], !result.payload && 4 === payloadType) { - if ("GA94" === String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6])) { - result.payloadType = payloadType, result.payloadSize = payloadSize, result.payload = bytes.subarray(i, i + payloadSize); - break; - } - result.payload = void 0; + }, captionPacketParser_parseSei = function(bytes) { + for(var i = 0, result = { + payloadType: -1, + payloadSize: 0 + }, payloadType = 0, payloadSize = 0; i < bytes.byteLength && 128 !== bytes[i];){ + for(; 0xff === bytes[i];)payloadType += 255, i++; + for(payloadType += bytes[i++]; 0xff === bytes[i];)payloadSize += 255, i++; + if (payloadSize += bytes[i++], !result.payload && 4 === payloadType) { + if ("GA94" === String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6])) { + result.payloadType = payloadType, result.payloadSize = payloadSize, result.payload = bytes.subarray(i, i + payloadSize); + break; } - i += payloadSize, payloadType = 0, payloadSize = 0; + result.payload = void 0; } - return result; - }, - parseUserData: function(sei) { - return 181 !== sei.payload[0] || (sei.payload[1] << 8 | sei.payload[2]) != 49 || "GA94" !== String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) || 0x03 !== sei.payload[7] ? null : sei.payload.subarray(8, sei.payload.length - 1); - }, - parseCaptionPackets: function(pts, userData) { - var i, count, offset, data, results = []; - if (!(0x40 & userData[0])) return results; - for(i = 0, count = 0x1f & userData[0]; i < count; i++)data = { - type: 0x03 & userData[(offset = 3 * i) + 2], - pts: pts - }, 0x04 & userData[offset + 2] && (data.ccData = userData[offset + 3] << 8 | userData[offset + 4], results.push(data)); - return results; - }, - discardEmulationPreventionBytes: function(data) { - for(var newLength, newData, length = data.byteLength, emulationPreventionBytesPositions = [], i = 1; i < length - 2;)0 === data[i] && 0 === data[i + 1] && 0x03 === data[i + 2] ? (emulationPreventionBytesPositions.push(i + 2), i += 2) : i++; - if (0 === emulationPreventionBytesPositions.length) return data; - newData = new Uint8Array(newLength = length - emulationPreventionBytesPositions.length); - var sourceIndex = 0; - for(i = 0; i < newLength; sourceIndex++, i++)sourceIndex === emulationPreventionBytesPositions[0] && (sourceIndex++, emulationPreventionBytesPositions.shift()), newData[i] = data[sourceIndex]; - return newData; - }, - USER_DATA_REGISTERED_ITU_T_T35: 4 + i += payloadSize, payloadType = 0, payloadSize = 0; + } + return result; + }, captionPacketParser_parseCaptionPackets = function(pts, userData) { + var i, count, offset, data, results = []; + if (!(0x40 & userData[0])) return results; + for(i = 0, count = 0x1f & userData[0]; i < count; i++)data = { + type: 0x03 & userData[(offset = 3 * i) + 2], + pts: pts + }, 0x04 & userData[offset + 2] && (data.ccData = userData[offset + 3] << 8 | userData[offset + 4], results.push(data)); + return results; }, CaptionStream$1 = function CaptionStream(options) { options = options || {}, CaptionStream.prototype.init.call(this), this.parse708captions_ = "boolean" != typeof options.parse708captions || options.parse708captions, this.captionPackets_ = [], this.ccStreams_ = [ new Cea608Stream(0, 0), @@ -8836,8 +8793,8 @@ }, this), this.parse708captions_ && (this.cc708Stream_.on("data", this.trigger.bind(this, "data")), this.cc708Stream_.on("partialdone", this.trigger.bind(this, "partialdone")), this.cc708Stream_.on("done", this.trigger.bind(this, "done"))); }; CaptionStream$1.prototype = new Stream(), CaptionStream$1.prototype.push = function(event) { - var sei, userData, newCaptionPackets; - if ("sei_rbsp" === event.nalUnitType && (sei = captionPacketParser.parseSei(event.escapedRBSP)).payload && sei.payloadType === captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35 && (userData = captionPacketParser.parseUserData(sei))) { + var sei, userData, newCaptionPackets, sei1; + if ("sei_rbsp" === event.nalUnitType && (sei = captionPacketParser_parseSei(event.escapedRBSP)).payload && 4 === sei.payloadType && (userData = 181 !== (sei1 = sei).payload[0] || (sei1.payload[1] << 8 | sei1.payload[2]) != 49 || "GA94" !== String.fromCharCode(sei1.payload[3], sei1.payload[4], sei1.payload[5], sei1.payload[6]) || 0x03 !== sei1.payload[7] ? null : sei1.payload.subarray(8, sei1.payload.length - 1))) { if (event.dts < this.latestDts_) { this.ignoreNextEqualDts_ = !0; return; @@ -8846,7 +8803,7 @@ this.numSameDts_--, this.numSameDts_ || (this.ignoreNextEqualDts_ = !1); return; } - newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData), this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets), this.latestDts_ !== event.dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = event.dts; + newCaptionPackets = captionPacketParser_parseCaptionPackets(event.pts, userData), this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets), this.latestDts_ !== event.dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = event.dts; } }, CaptionStream$1.prototype.flushCCStreams = function(flushType) { this.ccStreams_.forEach(function(cc) { @@ -9287,11 +9244,7 @@ var baseRow = this.displayed_[this.row_]; baseRow += text, this.displayed_[this.row_] = baseRow; }; - var captionStream = { - CaptionStream: CaptionStream$1, - Cea608Stream: Cea608Stream, - Cea708Stream: Cea708Stream - }, streamTypes = { + var streamTypes = { H264_STREAM_TYPE: 0x1b, ADTS_STREAM_TYPE: 0x0f, METADATA_STREAM_TYPE: 0x15 @@ -9314,10 +9267,7 @@ }; }; TimestampRolloverStream$1.prototype = new Stream(); - var videoSample, audioSample, audioTrun, videoTrun, trunHeader, box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS, silence, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds, _MetadataStream, timestampRolloverStream = { - TimestampRolloverStream: TimestampRolloverStream$1, - handleRollover: handleRollover$1 - }, percentEncode$1 = function(bytes, start, end) { + var videoSample, audioSample, audioTrun, videoTrun, trunHeader, box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS, silence, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds, _MetadataStream, percentEncode$1 = function(bytes, start, end) { var i, result = ""; for(i = start; i < end; i++)result += "%" + ("00" + bytes[i].toString(16)).slice(-2); return result; @@ -9399,7 +9349,7 @@ } }; }).prototype = new Stream(); - var metadataStream = _MetadataStream, TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream; + var metadataStream = _MetadataStream; (_TransportPacketStream = function() { var buffer = new Uint8Array(188), bytesInBuffer = 0; _TransportPacketStream.prototype.init.call(this), this.push = function(bytes) { @@ -9553,10 +9503,10 @@ TransportPacketStream: _TransportPacketStream, TransportParseStream: _TransportParseStream, ElementaryStream: _ElementaryStream, - TimestampRolloverStream: TimestampRolloverStream, - CaptionStream: captionStream.CaptionStream, - Cea608Stream: captionStream.Cea608Stream, - Cea708Stream: captionStream.Cea708Stream, + TimestampRolloverStream: TimestampRolloverStream$1, + CaptionStream: CaptionStream$1, + Cea608Stream: Cea608Stream, + Cea708Stream: Cea708Stream, MetadataStream: metadataStream }; for(var type in streamTypes)streamTypes.hasOwnProperty(type) && (m2ts[type] = streamTypes[type]); @@ -9882,9 +9832,7 @@ }; }; }).prototype = new Stream(); - var h264 = { - H264Stream: _H264Stream - }, ADTS_SAMPLING_FREQUENCIES = [ + var h264_H264Stream = _H264Stream, ADTS_SAMPLING_FREQUENCIES = [ 96000, 88200, 64000, @@ -9999,7 +9947,7 @@ "levelIdc", "profileCompatibility", "sarRatio" - ], H264Stream = h264.H264Stream, isLikelyAacData = utils.isLikelyAacData, ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS, retriggerForStream = function(key, event) { + ], isLikelyAacData = utils.isLikelyAacData, ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS, retriggerForStream = function(key, event) { event.stream = key, this.trigger("log", event); }, addPipelineLogRetriggers = function(transmuxer, pipeline) { for(var keys = Object.keys(pipeline), i = 0; i < keys.length; i++){ @@ -10038,12 +9986,14 @@ }, this.setAudioAppendStart = function(timestamp) { audioAppendStartTs = timestamp; }, this.flush = function() { - var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; + var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed, adtsFrames1, earliestAllowedDts1; if (0 === adtsFrames.length) { this.trigger("done", "AudioSegmentStream"); return; } - frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts), track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps), videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime), track.samples = audioFrameUtils.generateSampleTable(frames), mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames)), adtsFrames = [], boxes = new Uint8Array((moof = mp4Generator.moof(sequenceNumber, [ + adtsFrames1 = adtsFrames, earliestAllowedDts1 = earliestAllowedDts, frames = track.minSegmentDts >= earliestAllowedDts1 ? adtsFrames1 : (track.minSegmentDts = 1 / 0, adtsFrames1.filter(function(currentFrame) { + return currentFrame.dts >= earliestAllowedDts1 && (track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts), track.minSegmentPts = track.minSegmentDts, !0); + })), track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps), videoClockCyclesOfSilencePrefixed = audioFrameUtils_prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime), track.samples = audioFrameUtils_generateSampleTable(frames), mdat = mp4Generator.mdat(audioFrameUtils_concatenateFrameData(frames)), adtsFrames = [], boxes = new Uint8Array((moof = mp4Generator.moof(sequenceNumber, [ track ])).byteLength + mdat.byteLength), sequenceNumber++, boxes.set(moof), boxes.set(mdat, moof.byteLength), trackDecodeInfo.clearDtsInfo(track), frameDuration = Math.ceil(1024 * ONE_SECOND_IN_TS$1 / track.samplerate), frames.length && (segmentDuration = frames.length * frameDuration, this.trigger("segmentTimingInfo", generateSegmentTimingInfo(clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0)), this.trigger("timingInfo", { start: frames[0].pts, @@ -10196,7 +10146,7 @@ }), pipeline.coalesceStream.on("data", this.trigger.bind(this, "data")), pipeline.coalesceStream.on("done", this.trigger.bind(this, "done")), addPipelineLogRetriggers(this, pipeline); }, this.setupTsPipeline = function() { var pipeline = {}; - this.transmuxPipeline_ = pipeline, pipeline.type = "ts", pipeline.metadataStream = new m2ts.MetadataStream(), pipeline.packetStream = new m2ts.TransportPacketStream(), pipeline.parseStream = new m2ts.TransportParseStream(), pipeline.elementaryStream = new m2ts.ElementaryStream(), pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream(), pipeline.adtsStream = new adts(), pipeline.h264Stream = new H264Stream(), pipeline.captionStream = new m2ts.CaptionStream(options), pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream), pipeline.headOfPipeline = pipeline.packetStream, pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream), pipeline.timestampRolloverStream.pipe(pipeline.h264Stream), pipeline.timestampRolloverStream.pipe(pipeline.adtsStream), pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream), pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream), pipeline.elementaryStream.on("data", function(data) { + this.transmuxPipeline_ = pipeline, pipeline.type = "ts", pipeline.metadataStream = new m2ts.MetadataStream(), pipeline.packetStream = new m2ts.TransportPacketStream(), pipeline.parseStream = new m2ts.TransportParseStream(), pipeline.elementaryStream = new m2ts.ElementaryStream(), pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream(), pipeline.adtsStream = new adts(), pipeline.h264Stream = new h264_H264Stream(), pipeline.captionStream = new m2ts.CaptionStream(options), pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream), pipeline.headOfPipeline = pipeline.packetStream, pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream), pipeline.timestampRolloverStream.pipe(pipeline.h264Stream), pipeline.timestampRolloverStream.pipe(pipeline.adtsStream), pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream), pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream), pipeline.elementaryStream.on("data", function(data) { var i; if ("metadata" === data.type) { for(i = data.tracks.length; i--;)videoTrack || "video" !== data.tracks[i].type ? audioTrack || "audio" !== data.tracks[i].type || ((audioTrack = data.tracks[i]).timelineStartInfo.baseMediaDecodeTime = self1.baseMediaDecodeTime) : (videoTrack = data.tracks[i]).timelineStartInfo.baseMediaDecodeTime = self1.baseMediaDecodeTime; @@ -10243,29 +10193,22 @@ this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset(); }; }).prototype = new Stream(); - var transmuxer = { - Transmuxer: _Transmuxer - }, bin = { - toUnsigned: function(value) { - return value >>> 0; - }, - toHexString: function(value) { - return ("00" + value.toString(16)).slice(-2); - } + var transmuxer_Transmuxer = _Transmuxer, bin_toUnsigned = function(value) { + return value >>> 0; }, parseType_1 = function(buffer) { return "" + (String.fromCharCode(buffer[0]) + String.fromCharCode(buffer[1]) + String.fromCharCode(buffer[2]) + String.fromCharCode(buffer[3])); - }, toUnsigned$2 = bin.toUnsigned, findBox_1 = function findBox(data, path) { + }, findBox_1 = function findBox(data, path) { var i, size, type, end, subresults, results = []; if (!path.length) return null; - for(i = 0; i < data.byteLength;)size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]), type = parseType_1(data.subarray(i + 4, i + 8)), end = size > 1 ? i + size : data.byteLength, type === path[0] && (1 === path.length ? results.push(data.subarray(i + 8, end)) : (subresults = findBox(data.subarray(i + 8, end), path.slice(1))).length && (results = results.concat(subresults))), i = end; + for(i = 0; i < data.byteLength;)size = bin_toUnsigned(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]), type = parseType_1(data.subarray(i + 4, i + 8)), end = size > 1 ? i + size : data.byteLength, type === path[0] && (1 === path.length ? results.push(data.subarray(i + 8, end)) : (subresults = findBox(data.subarray(i + 8, end), path.slice(1))).length && (results = results.concat(subresults))), i = end; return results; - }, toUnsigned$1 = bin.toUnsigned, parseTfdt = function(data) { + }, parseTfdt = function(data) { var result = { version: data[0], flags: new Uint8Array(data.subarray(1, 4)), - baseMediaDecodeTime: toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) + baseMediaDecodeTime: bin_toUnsigned(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]) }; - return 1 === result.version && (result.baseMediaDecodeTime *= 4294967296, result.baseMediaDecodeTime += toUnsigned$1(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11])), result; + return 1 === result.version && (result.baseMediaDecodeTime *= 4294967296, result.baseMediaDecodeTime += bin_toUnsigned(data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11])), result; }, parseSampleFlags_1 = function(flags) { return { isLeading: (0x0c & flags[0]) >>> 2, @@ -10293,7 +10236,14 @@ trackId: view.getUint32(4) }, baseDataOffsetPresent = 0x01 & result.flags[2], sampleDescriptionIndexPresent = 0x02 & result.flags[2], defaultSampleDurationPresent = 0x08 & result.flags[2], defaultSampleSizePresent = 0x10 & result.flags[2], defaultSampleFlagsPresent = 0x20 & result.flags[2], durationIsEmpty = 0x010000 & result.flags[0], defaultBaseIsMoof = 0x020000 & result.flags[0]; return i = 8, baseDataOffsetPresent && (i += 4, result.baseDataOffset = view.getUint32(12), i += 4), sampleDescriptionIndexPresent && (result.sampleDescriptionIndex = view.getUint32(i), i += 4), defaultSampleDurationPresent && (result.defaultSampleDuration = view.getUint32(i), i += 4), defaultSampleSizePresent && (result.defaultSampleSize = view.getUint32(i), i += 4), defaultSampleFlagsPresent && (result.defaultSampleFlags = view.getUint32(i)), durationIsEmpty && (result.durationIsEmpty = !0), !baseDataOffsetPresent && defaultBaseIsMoof && (result.baseDataOffsetIsMoof = !0), result; - }, discardEmulationPreventionBytes = captionPacketParser.discardEmulationPreventionBytes, CaptionStream = captionStream.CaptionStream, mapToSample = function(offset, samples) { + }, discardEmulationPreventionBytes = function(data) { + for(var newLength, newData, length = data.byteLength, emulationPreventionBytesPositions = [], i = 1; i < length - 2;)0 === data[i] && 0 === data[i + 1] && 0x03 === data[i + 2] ? (emulationPreventionBytesPositions.push(i + 2), i += 2) : i++; + if (0 === emulationPreventionBytesPositions.length) return data; + newData = new Uint8Array(newLength = length - emulationPreventionBytesPositions.length); + var sourceIndex = 0; + for(i = 0; i < newLength; sourceIndex++, i++)sourceIndex === emulationPreventionBytesPositions[0] && (sourceIndex++, emulationPreventionBytesPositions.shift()), newData[i] = data[sourceIndex]; + return newData; + }, mapToSample = function(offset, samples) { for(var approximateOffset = offset, i = 0; i < samples.length; i++){ var sample = samples[i]; if (approximateOffset < sample.size) return sample; @@ -10373,7 +10323,7 @@ this.isInitialized = function() { return isInitialized; }, this.init = function(options) { - captionStream = new CaptionStream(), isInitialized = !0, parsingPartial = !!options && options.isPartial, captionStream.on("data", function(event) { + captionStream = new CaptionStream$1(), isInitialized = !0, parsingPartial = !!options && options.isPartial, captionStream.on("data", function(event) { event.startTime = event.startPts / timescale, event.endTime = event.endPts / timescale, parsedCaptions.captions.push(event), parsedCaptions.captionStreams[event.stream] = !0; }), captionStream.on("log", function(log) { parsedCaptions.logs.push(log); @@ -10416,21 +10366,10 @@ logs: [] }, this.resetCaptionStream(); }, this.reset(); - }, toUnsigned = bin.toUnsigned, toHexString = bin.toHexString; - timescale = function(init) { - return findBox_1(init, [ - "moov", - "trak" - ]).reduce(function(result, trak) { - var tkhd, index, id, mdhd; - return (tkhd = findBox_1(trak, [ - "tkhd" - ])[0]) && (index = 0 === tkhd[0] ? 12 : 20, id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]), mdhd = findBox_1(trak, [ - "mdia", - "mdhd" - ])[0]) ? (index = 0 === mdhd[0] ? 12 : 20, result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]), result) : null; - }, {}); - }, startTime = function(timescale, fragment) { + }, toHexString = function(value) { + return ("00" + value.toString(16)).slice(-2); + }; + startTime = function(timescale, fragment) { var trafs, baseTimes, result; return trafs = findBox_1(fragment, [ "moof", @@ -10440,54 +10379,19 @@ "tfhd" ]).map(function(tfhd) { var scale, baseTime; - return scale = timescale[toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7])] || 90e3, (baseTime = "number" != typeof (baseTime = findBox_1(traf, [ + return scale = timescale[bin_toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7])] || 90e3, (baseTime = "number" != typeof (baseTime = findBox_1(traf, [ "tfdt" ]).map(function(tfdt) { var version, result; - return version = tfdt[0], result = toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]), 1 === version && (result *= 4294967296, result += toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11])), result; + return version = tfdt[0], result = bin_toUnsigned(tfdt[4] << 24 | tfdt[5] << 16 | tfdt[6] << 8 | tfdt[7]), 1 === version && (result *= 4294967296, result += bin_toUnsigned(tfdt[8] << 24 | tfdt[9] << 16 | tfdt[10] << 8 | tfdt[11])), result; })[0]) || isNaN(baseTime) ? 1 / 0 : baseTime) / scale; }); })), isFinite(result = Math.min.apply(null, baseTimes)) ? result : 0; - }, compositionStartTime = function(timescales, fragment) { - var trackId, trafBoxes = findBox_1(fragment, [ - "moof", - "traf" - ]), baseMediaDecodeTime = 0, compositionTimeOffset = 0; - if (trafBoxes && trafBoxes.length) { - var tfhd = findBox_1(trafBoxes[0], [ - "tfhd" - ])[0], trun = findBox_1(trafBoxes[0], [ - "trun" - ])[0], tfdt = findBox_1(trafBoxes[0], [ - "tfdt" - ])[0]; - if (tfhd && (trackId = parseTfhd(tfhd).trackId), tfdt && (baseMediaDecodeTime = parseTfdt(tfdt).baseMediaDecodeTime), trun) { - var parsedTrun = parseTrun(trun); - parsedTrun.samples && parsedTrun.samples.length && (compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0); - } - } - return (baseMediaDecodeTime + compositionTimeOffset) / (timescales[trackId] || 90e3); - }, getVideoTrackIds = function(init) { - var traks = findBox_1(init, [ - "moov", - "trak" - ]), videoTrackIds = []; - return traks.forEach(function(trak) { - var hdlrs = findBox_1(trak, [ - "mdia", - "hdlr" - ]), tkhds = findBox_1(trak, [ - "tkhd" - ]); - hdlrs.forEach(function(hdlr, index) { - var view, trackId, handlerType = parseType_1(hdlr.subarray(8, 12)), tkhd = tkhds[index]; - "vide" === handlerType && (trackId = 0 === (view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength)).getUint8(0) ? view.getUint32(12) : view.getUint32(20), videoTrackIds.push(trackId)); - }); - }), videoTrackIds; }, getTimescaleFromMediaHeader = function(mdhd) { var index = 0 === mdhd[0] ? 12 : 20; - return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); - }, getTracks = function(init) { + return bin_toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]); + }; + var probe$2_tracks = function(init) { var traks = findBox_1(init, [ "moov", "trak" @@ -10525,16 +10429,6 @@ ])[0]; mdhd && (track.timescale = getTimescaleFromMediaHeader(mdhd)), tracks.push(track); }), tracks; - }; - var probe$2 = { - findBox: findBox_1, - parseType: parseType_1, - timescale: timescale, - startTime: startTime, - compositionStartTime: compositionStartTime, - videoTrackIds: getVideoTrackIds, - tracks: getTracks, - getTimescaleFromMediaHeader: getTimescaleFromMediaHeader }, parsePid = function(packet) { var pid = 0x1f & packet[1]; return pid <<= 8, pid |= packet[2]; @@ -10558,7 +10452,7 @@ default: return null; } - }, handleRollover = timestampRolloverStream.handleRollover, probe = {}; + }, probe = {}; probe.ts = { parseType: function(packet, pmtPid) { var pid = parsePid(packet); @@ -10702,16 +10596,16 @@ if (segmentInfo.audio && segmentInfo.audio.length) { var audioBaseTimestamp = baseTimestamp; (void 0 === audioBaseTimestamp || isNaN(audioBaseTimestamp)) && (audioBaseTimestamp = segmentInfo.audio[0].dts), segmentInfo.audio.forEach(function(info) { - info.dts = handleRollover(info.dts, audioBaseTimestamp), info.pts = handleRollover(info.pts, audioBaseTimestamp), info.dtsTime = info.dts / ONE_SECOND_IN_TS, info.ptsTime = info.pts / ONE_SECOND_IN_TS; + info.dts = handleRollover$1(info.dts, audioBaseTimestamp), info.pts = handleRollover$1(info.pts, audioBaseTimestamp), info.dtsTime = info.dts / ONE_SECOND_IN_TS, info.ptsTime = info.pts / ONE_SECOND_IN_TS; }); } if (segmentInfo.video && segmentInfo.video.length) { var videoBaseTimestamp = baseTimestamp; if ((void 0 === videoBaseTimestamp || isNaN(videoBaseTimestamp)) && (videoBaseTimestamp = segmentInfo.video[0].dts), segmentInfo.video.forEach(function(info) { - info.dts = handleRollover(info.dts, videoBaseTimestamp), info.pts = handleRollover(info.pts, videoBaseTimestamp), info.dtsTime = info.dts / ONE_SECOND_IN_TS, info.ptsTime = info.pts / ONE_SECOND_IN_TS; + info.dts = handleRollover$1(info.dts, videoBaseTimestamp), info.pts = handleRollover$1(info.pts, videoBaseTimestamp), info.dtsTime = info.dts / ONE_SECOND_IN_TS, info.ptsTime = info.pts / ONE_SECOND_IN_TS; }), segmentInfo.firstKeyFrame) { var frame = segmentInfo.firstKeyFrame; - frame.dts = handleRollover(frame.dts, videoBaseTimestamp), frame.pts = handleRollover(frame.pts, videoBaseTimestamp), frame.dtsTime = frame.dts / ONE_SECOND_IN_TS, frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; + frame.dts = handleRollover$1(frame.dts, videoBaseTimestamp), frame.pts = handleRollover$1(frame.pts, videoBaseTimestamp), frame.dtsTime = frame.dts / ONE_SECOND_IN_TS, frame.ptsTime = frame.pts / ONE_SECOND_IN_TS; } } }, inspectAac_ = function(bytes) { @@ -10765,12 +10659,9 @@ result.audio = [], parseAudioPes_(bytes, pmt, result), 0 === result.audio.length && delete result.audio; } return result; - }, tsInspector = { - inspect: function(bytes, baseTimestamp) { - var result; - return (result = probe.aac.isLikelyAacData(bytes) ? inspectAac_(bytes) : inspectTs_(bytes)) && (result.audio || result.video) ? (adjustTimestamp_(result, baseTimestamp), result) : null; - }, - parseAudioPes_: parseAudioPes_ + }, tsInspector_inspect = function(bytes, baseTimestamp) { + var result; + return (result = probe.aac.isLikelyAacData(bytes) ? inspectAac_(bytes) : inspectTs_(bytes)) && (result.audio || result.video) ? (adjustTimestamp_(result, baseTimestamp), result) : null; }, wireTransmuxerEvents = function(self1, transmuxer) { transmuxer.on("data", function(segment) { var initArray = segment.initSegment; @@ -10872,7 +10763,7 @@ } var _proto = MessageHandlers.prototype; return _proto.init = function() { - this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new transmuxer.Transmuxer(this.options), wireTransmuxerEvents(this.self, this.transmuxer); + this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new transmuxer_Transmuxer(this.options), wireTransmuxerEvents(this.self, this.transmuxer); }, _proto.pushMp4Captions = function(data) { this.captionParser || (this.captionParser = new captionParser(), this.captionParser.init()); var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength), parsed = this.captionParser.parse(segment, data.trackIds, data.timescales); @@ -10885,16 +10776,16 @@ segment.buffer ]); }, _proto.probeMp4StartTime = function(_ref) { - var timescales = _ref.timescales, data = _ref.data, startTime = probe$2.startTime(timescales, data); + var timescales = _ref.timescales, data = _ref.data, startTime1 = startTime(timescales, data); this.self.postMessage({ action: "probeMp4StartTime", - startTime: startTime, + startTime: startTime1, data: data }, [ data.buffer ]); }, _proto.probeMp4Tracks = function(_ref2) { - var data = _ref2.data, tracks = probe$2.tracks(data); + var data = _ref2.data, tracks = probe$2_tracks(data); this.self.postMessage({ action: "probeMp4Tracks", tracks: tracks, @@ -10903,7 +10794,7 @@ data.buffer ]); }, _proto.probeTs = function(_ref3) { - var data = _ref3.data, baseStartTime = _ref3.baseStartTime, tsStartTime = "number" != typeof baseStartTime || isNaN(baseStartTime) ? void 0 : baseStartTime * clock.ONE_SECOND_IN_TS, timeInfo = tsInspector.inspect(data, tsStartTime), result = null; + var data = _ref3.data, baseStartTime = _ref3.baseStartTime, timeInfo = tsInspector_inspect(data, "number" != typeof baseStartTime || isNaN(baseStartTime) ? void 0 : baseStartTime * clock.ONE_SECOND_IN_TS), result = null; timeInfo && ((result = { hasVideo: timeInfo.video && 2 === timeInfo.video.length || !1, hasAudio: timeInfo.audio && 2 === timeInfo.audio.length || !1 @@ -11029,10 +10920,6 @@ reset: function(transmuxer) { enqueueAction("reset", transmuxer); }, - endTimeline: function(transmuxer) { - enqueueAction("endTimeline", transmuxer); - }, - transmux: transmux, createTransmuxer: function(options) { var transmuxer = new TransmuxWorker(); transmuxer.currentTransmux = null, transmuxer.transmuxQueue = []; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/output.js b/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/output.js index 0a0c7fff91e5..015204309231 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/39538/static/chunks/pages/index-1bd068cedc2b5af3/output.js @@ -216,7 +216,31 @@ }; var _extends = __webpack_require__(2769).Z, _interop_require_default = __webpack_require__(4507).Z, _interop_require_wildcard = __webpack_require__(8167).Z, _object_without_properties_loose = __webpack_require__(4719).Z, _react = _interop_require_wildcard(__webpack_require__(959)), _head = _interop_require_default(__webpack_require__(4357)), _imageConfig = __webpack_require__(1773), _useIntersection = __webpack_require__(757), _imageConfigContext = __webpack_require__(9664); __webpack_require__(8827); - var _normalizeTrailingSlash = __webpack_require__(8236), ref = {}, experimentalUnoptimized = (ref.experimentalRemotePatterns, ref.experimentalUnoptimized), configEnv = { + var _normalizeTrailingSlash = __webpack_require__(8236), ref = { + deviceSizes: [ + 640, + 750, + 828, + 1080, + 1200, + 1920, + 2048, + 3840 + ], + imageSizes: [ + 16, + 32, + 48, + 64, + 96, + 128, + 256, + 384 + ], + path: "/_next/image", + loader: "default", + dangerouslyAllowSVG: !1 + }, experimentalUnoptimized = (ref.experimentalRemotePatterns, ref.experimentalUnoptimized), configEnv = { deviceSizes: [ 640, 750, diff --git a/crates/swc_ecma_minifier/tests/fixture/next/54192/1/output.js b/crates/swc_ecma_minifier/tests/fixture/next/54192/1/output.js index 8d1c76c48e85..c22a16e77734 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/54192/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/54192/1/output.js @@ -11,17 +11,17 @@ } }); var jsx_runtime = __webpack_require__(7437), react = __webpack_require__(2265); - const Context = (0, react.createContext)({}), ClientCompoenent = ()=>{ + const Context = (0, react.createContext)({}), ContextDemo_Provider = (param)=>{ + let { children } = param; + return (0, jsx_runtime.jsx)(Context.Provider, { + value: {}, + children: children + }); + }, ClientCompoenent = ()=>{ const [count, setCount] = (0, react.useState)(0); return (0, jsx_runtime.jsxs)(jsx_runtime.Fragment, { children: [ - (0, jsx_runtime.jsx)((param)=>{ - let { children } = param; - return (0, jsx_runtime.jsx)(Context.Provider, { - value: {}, - children: children - }); - }, { + (0, jsx_runtime.jsx)(ContextDemo_Provider, { children: (0, jsx_runtime.jsx)("input", {}) }), (0, jsx_runtime.jsx)("button", { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js b/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js index 0f74d1997e5e..4878acabed85 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/chakra/output.js @@ -2076,48 +2076,26 @@ } }; } - }, size = { - lg: { - fontSize: "lg", - px: 4, - h: 12, - borderRadius: "md" - }, - md: { - fontSize: "md", - px: 4, - h: 10, - borderRadius: "md" - }, - sm: { - fontSize: "sm", - px: 3, - h: 8, - borderRadius: "sm" - }, - xs: { - fontSize: "xs", - px: 2, - h: 6, - borderRadius: "sm" - } - }, sizes$e = { - lg: { - field: size.lg, - addon: size.lg - }, - md: { - field: size.md, - addon: size.md - }, - sm: { - field: size.sm, - addon: size.sm - }, - xs: { - field: size.xs, - addon: size.xs - } + }, size_lg = { + fontSize: "lg", + px: 4, + h: 12, + borderRadius: "md" + }, size_md = { + fontSize: "md", + px: 4, + h: 10, + borderRadius: "md" + }, size_sm = { + fontSize: "sm", + px: 3, + h: 8, + borderRadius: "sm" + }, size_xs = { + fontSize: "xs", + px: 2, + h: 6, + borderRadius: "sm" }; function getDefaults(props) { var fc = props.focusBorderColor, ec = props.errorBorderColor; @@ -2139,7 +2117,24 @@ transitionDuration: "normal" } }, - sizes: sizes$e, + sizes: { + lg: { + field: size_lg, + addon: size_lg + }, + md: { + field: size_md, + addon: size_md + }, + sm: { + field: size_sm, + addon: size_sm + }, + xs: { + field: size_xs, + addon: size_xs + } + }, variants: { outline: function(props) { var theme = props.theme, _getDefaults = getDefaults(props), fc = _getDefaults.focusBorderColor, ec = _getDefaults.errorBorderColor; 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 cb1ffcf8c0c3..7449e159f63d 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 @@ -6594,321 +6594,312 @@ "use strict"; r.r(t), r.d(t, { default: function() { - return B; + return L; }, getCategory: function() { - return E; + return S; }, getCombiningClass: function() { - return _; + return A; }, getEastAsianWidth: function() { - return S; + return T; }, getNumericValue: function() { - return A; + return O; }, getScript: function() { - return x; + return k; }, isAlphabetic: function() { - return k; + return C; }, isBaseForm: function() { - return I; + return M; }, isDigit: function() { - return T; + return P; }, isLowerCase: function() { - return C; + return R; }, isMark: function() { - return j; + return N; }, isPunctuation: function() { - return O; + return F; }, isTitleCase: function() { - return F; + return j; }, isUpperCase: function() { - return P; + return I; }, isWhiteSpace: function() { - return R; + return B; } }); - var n = r(7055), i = r.n(n), o = r(1876).Buffer, a = { - categories: [ - "Cc", - "Zs", - "Po", - "Sc", - "Ps", - "Pe", - "Sm", - "Pd", - "Nd", - "Lu", - "Sk", - "Pc", - "Ll", - "So", - "Lo", - "Pi", - "Cf", - "No", - "Pf", - "Lt", - "Lm", - "Mn", - "Me", - "Mc", - "Nl", - "Zl", - "Zp", - "Cs", - "Co" - ], - combiningClasses: [ - "Not_Reordered", - "Above", - "Above_Right", - "Below", - "Attached_Above_Right", - "Attached_Below", - "Overlay", - "Iota_Subscript", - "Double_Below", - "Double_Above", - "Below_Right", - "Above_Left", - "CCC10", - "CCC11", - "CCC12", - "CCC13", - "CCC14", - "CCC15", - "CCC16", - "CCC17", - "CCC18", - "CCC19", - "CCC20", - "CCC21", - "CCC22", - "CCC23", - "CCC24", - "CCC25", - "CCC30", - "CCC31", - "CCC32", - "CCC27", - "CCC28", - "CCC29", - "CCC33", - "CCC34", - "CCC35", - "CCC36", - "Nukta", - "Virama", - "CCC84", - "CCC91", - "CCC103", - "CCC107", - "CCC118", - "CCC122", - "CCC129", - "CCC130", - "CCC132", - "Attached_Above", - "Below_Left", - "Left", - "Kana_Voicing", - "CCC26", - "Right" - ], - scripts: [ - "Common", - "Latin", - "Bopomofo", - "Inherited", - "Greek", - "Coptic", - "Cyrillic", - "Armenian", - "Hebrew", - "Arabic", - "Syriac", - "Thaana", - "Nko", - "Samaritan", - "Mandaic", - "Devanagari", - "Bengali", - "Gurmukhi", - "Gujarati", - "Oriya", - "Tamil", - "Telugu", - "Kannada", - "Malayalam", - "Sinhala", - "Thai", - "Lao", - "Tibetan", - "Myanmar", - "Georgian", - "Hangul", - "Ethiopic", - "Cherokee", - "Canadian_Aboriginal", - "Ogham", - "Runic", - "Tagalog", - "Hanunoo", - "Buhid", - "Tagbanwa", - "Khmer", - "Mongolian", - "Limbu", - "Tai_Le", - "New_Tai_Lue", - "Buginese", - "Tai_Tham", - "Balinese", - "Sundanese", - "Batak", - "Lepcha", - "Ol_Chiki", - "Braille", - "Glagolitic", - "Tifinagh", - "Han", - "Hiragana", - "Katakana", - "Yi", - "Lisu", - "Vai", - "Bamum", - "Syloti_Nagri", - "Phags_Pa", - "Saurashtra", - "Kayah_Li", - "Rejang", - "Javanese", - "Cham", - "Tai_Viet", - "Meetei_Mayek", - "null", - "Linear_B", - "Lycian", - "Carian", - "Old_Italic", - "Gothic", - "Old_Permic", - "Ugaritic", - "Old_Persian", - "Deseret", - "Shavian", - "Osmanya", - "Osage", - "Elbasan", - "Caucasian_Albanian", - "Linear_A", - "Cypriot", - "Imperial_Aramaic", - "Palmyrene", - "Nabataean", - "Hatran", - "Phoenician", - "Lydian", - "Meroitic_Hieroglyphs", - "Meroitic_Cursive", - "Kharoshthi", - "Old_South_Arabian", - "Old_North_Arabian", - "Manichaean", - "Avestan", - "Inscriptional_Parthian", - "Inscriptional_Pahlavi", - "Psalter_Pahlavi", - "Old_Turkic", - "Old_Hungarian", - "Hanifi_Rohingya", - "Old_Sogdian", - "Sogdian", - "Elymaic", - "Brahmi", - "Kaithi", - "Sora_Sompeng", - "Chakma", - "Mahajani", - "Sharada", - "Khojki", - "Multani", - "Khudawadi", - "Grantha", - "Newa", - "Tirhuta", - "Siddham", - "Modi", - "Takri", - "Ahom", - "Dogra", - "Warang_Citi", - "Nandinagari", - "Zanabazar_Square", - "Soyombo", - "Pau_Cin_Hau", - "Bhaiksuki", - "Marchen", - "Masaram_Gondi", - "Gunjala_Gondi", - "Makasar", - "Cuneiform", - "Egyptian_Hieroglyphs", - "Anatolian_Hieroglyphs", - "Mro", - "Bassa_Vah", - "Pahawh_Hmong", - "Medefaidrin", - "Miao", - "Tangut", - "Nushu", - "Duployan", - "SignWriting", - "Nyiakeng_Puachue_Hmong", - "Wancho", - "Mende_Kikakui", - "Adlam" - ], - eaw: [ - "N", - "Na", - "A", - "W", - "H", - "F" - ] - }, u = new Uint8Array(o.from("ABEAAAAAAAAAAXzwZXl5ONRt+/5bPVFZimRfKoTQJNm37CGE7Iw0j3UsTWKsoyI7kwyyTiEUzSD7NiEzhWYijH0wMVkHE4Mx49fzfo+3nuP4/fdZjvv+XNd5n/d9nef1WZvmKhTxiZndzDQBSEYQqxqKwnsKvGQucFh+6t6cJ792ePQBZv5S9yXSwkyjf/P4T7mTNnIAv1dOVhMlR9lflbUL9JeJguqsjvG9NTj/wLb566VAURnLo2vvRi89S3gW/33ihh2eXpDn40BIW7REl/7coRKIhAFlAiOtbLDTt6mMb4GzMF1gNnvX/sBxtbsAIjfztCNcQjcNDtLThRvuXu5M5g/CBjaLBE4lJm4qy/oZD97+IJryApcXfgWYlkvWbhfXgujOJKVu8B+ozqTLbxyJ5kNiR75CxDqfBM9eOlDMmGeoZ0iQbbS5VUplIwI+ZNXEKQVJxlwqjhOY7w3XwPesbLK5JZE+Tt4X8q8km0dzInsPPzbscrjBMVjF5mOHSeRdJVgKUjLTHiHqXSPkep8N/zFk8167KLp75f6RndkvzdfB6Uz3MmqvRArzdCbs1/iRZjYPLLF3U8Qs+H+Rb8iK51a6NIV2V9+07uJsTGFWpPz8J++7iRu2B6eAKlK/kujrLthwaD/7a6J5w90TusnH1JMAc+gNrql4aspOUG/RrsxUKmPzhHgP4Bleru+6Vfc/MBjgXVx7who94nPn7MPFrnwQP7g0k0Dq0h2GSKO6fTZ8nLodN1SiOUj/5EL/Xo1DBvRm0wmrh3x6phcJ20/9CuMr5h8WPqXMSasLoLHoufTmE7mzYrs6B0dY7KjuCogKqsvxnxAwXWvd9Puc9PnE8DOHT2INHxRlIyVHrqZahtfV2E/A2PDdtA3ewlRHMtFIBKO/T4IozWTQZ+mb+gdKuk/ZHrqloucK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K1FuSYAUQ1yBLnKxevrjayd+h2i8PjdB3YY6b0nr3JuOXGpPMyh4V2dslpR3DFEvgpsBLqhqLDOWP4yEvIL6f21PpA7/8B", "base64")), l = new (i())(u), s = Math.log2 || function(e) { + var n = r(7055), i = r.n(n), o = r(1876).Buffer, a = [ + "Cc", + "Zs", + "Po", + "Sc", + "Ps", + "Pe", + "Sm", + "Pd", + "Nd", + "Lu", + "Sk", + "Pc", + "Ll", + "So", + "Lo", + "Pi", + "Cf", + "No", + "Pf", + "Lt", + "Lm", + "Mn", + "Me", + "Mc", + "Nl", + "Zl", + "Zp", + "Cs", + "Co" + ], u = [ + "Not_Reordered", + "Above", + "Above_Right", + "Below", + "Attached_Above_Right", + "Attached_Below", + "Overlay", + "Iota_Subscript", + "Double_Below", + "Double_Above", + "Below_Right", + "Above_Left", + "CCC10", + "CCC11", + "CCC12", + "CCC13", + "CCC14", + "CCC15", + "CCC16", + "CCC17", + "CCC18", + "CCC19", + "CCC20", + "CCC21", + "CCC22", + "CCC23", + "CCC24", + "CCC25", + "CCC30", + "CCC31", + "CCC32", + "CCC27", + "CCC28", + "CCC29", + "CCC33", + "CCC34", + "CCC35", + "CCC36", + "Nukta", + "Virama", + "CCC84", + "CCC91", + "CCC103", + "CCC107", + "CCC118", + "CCC122", + "CCC129", + "CCC130", + "CCC132", + "Attached_Above", + "Below_Left", + "Left", + "Kana_Voicing", + "CCC26", + "Right" + ], l = [ + "Common", + "Latin", + "Bopomofo", + "Inherited", + "Greek", + "Coptic", + "Cyrillic", + "Armenian", + "Hebrew", + "Arabic", + "Syriac", + "Thaana", + "Nko", + "Samaritan", + "Mandaic", + "Devanagari", + "Bengali", + "Gurmukhi", + "Gujarati", + "Oriya", + "Tamil", + "Telugu", + "Kannada", + "Malayalam", + "Sinhala", + "Thai", + "Lao", + "Tibetan", + "Myanmar", + "Georgian", + "Hangul", + "Ethiopic", + "Cherokee", + "Canadian_Aboriginal", + "Ogham", + "Runic", + "Tagalog", + "Hanunoo", + "Buhid", + "Tagbanwa", + "Khmer", + "Mongolian", + "Limbu", + "Tai_Le", + "New_Tai_Lue", + "Buginese", + "Tai_Tham", + "Balinese", + "Sundanese", + "Batak", + "Lepcha", + "Ol_Chiki", + "Braille", + "Glagolitic", + "Tifinagh", + "Han", + "Hiragana", + "Katakana", + "Yi", + "Lisu", + "Vai", + "Bamum", + "Syloti_Nagri", + "Phags_Pa", + "Saurashtra", + "Kayah_Li", + "Rejang", + "Javanese", + "Cham", + "Tai_Viet", + "Meetei_Mayek", + "null", + "Linear_B", + "Lycian", + "Carian", + "Old_Italic", + "Gothic", + "Old_Permic", + "Ugaritic", + "Old_Persian", + "Deseret", + "Shavian", + "Osmanya", + "Osage", + "Elbasan", + "Caucasian_Albanian", + "Linear_A", + "Cypriot", + "Imperial_Aramaic", + "Palmyrene", + "Nabataean", + "Hatran", + "Phoenician", + "Lydian", + "Meroitic_Hieroglyphs", + "Meroitic_Cursive", + "Kharoshthi", + "Old_South_Arabian", + "Old_North_Arabian", + "Manichaean", + "Avestan", + "Inscriptional_Parthian", + "Inscriptional_Pahlavi", + "Psalter_Pahlavi", + "Old_Turkic", + "Old_Hungarian", + "Hanifi_Rohingya", + "Old_Sogdian", + "Sogdian", + "Elymaic", + "Brahmi", + "Kaithi", + "Sora_Sompeng", + "Chakma", + "Mahajani", + "Sharada", + "Khojki", + "Multani", + "Khudawadi", + "Grantha", + "Newa", + "Tirhuta", + "Siddham", + "Modi", + "Takri", + "Ahom", + "Dogra", + "Warang_Citi", + "Nandinagari", + "Zanabazar_Square", + "Soyombo", + "Pau_Cin_Hau", + "Bhaiksuki", + "Marchen", + "Masaram_Gondi", + "Gunjala_Gondi", + "Makasar", + "Cuneiform", + "Egyptian_Hieroglyphs", + "Anatolian_Hieroglyphs", + "Mro", + "Bassa_Vah", + "Pahawh_Hmong", + "Medefaidrin", + "Miao", + "Tangut", + "Nushu", + "Duployan", + "SignWriting", + "Nyiakeng_Puachue_Hmong", + "Wancho", + "Mende_Kikak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vIL6f21PpA7/8B", "base64")), f = new (i())(c), d = Math.log2 || function(e) { return Math.log(e) / Math.LN2; - }, c = function(e) { - return s(e) + 1 | 0; - }, f = c(a.categories.length - 1), d = c(a.combiningClasses.length - 1), p = c(a.scripts.length - 1), h = c(a.eaw.length - 1), y = d + p + h + 10, g = p + h + 10, v = h + 10, b = (1 << f) - 1, m = (1 << d) - 1, D = (1 << p) - 1, w = (1 << h) - 1, E = function(e) { - var t = l.get(e); - return a.categories[t >> y & b]; - }, _ = function(e) { - var t = l.get(e); - return a.combiningClasses[t >> g & m]; - }, x = function(e) { - var t = l.get(e); - return a.scripts[t >> v & D]; - }, S = function(e) { - var t = l.get(e); - return a.eaw[t >> 10 & w]; + }, p = function(e) { + return d(e) + 1 | 0; + }, h = p(a.length - 1), y = p(u.length - 1), g = p(l.length - 1), v = p(s.length - 1), b = y + g + v + 10, m = g + v + 10, D = v + 10, w = (1 << h) - 1, E = (1 << y) - 1, _ = (1 << g) - 1, x = (1 << v) - 1, S = function(e) { + return a[f.get(e) >> b & w]; }, A = function(e) { - var t = l.get(e), r = 1023 & t; + return u[f.get(e) >> m & E]; + }, k = function(e) { + return l[f.get(e) >> D & _]; + }, T = function(e) { + return s[f.get(e) >> 10 & x]; + }, O = function(e) { + var t = f.get(e), r = 1023 & t; if (0 === r) return null; if (r <= 50) return r - 1; if (r < 0x1e0) return ((r >> 4) - 12) / ((0xf & r) + 1); @@ -6920,44 +6911,44 @@ t = (r >> 2) - 0xbf; for(var i = (3 & r) + 1; i > 0;)t *= 60, i--; return t; - }, k = function(e) { - var t = E(e); - return "Lu" === t || "Ll" === t || "Lt" === t || "Lm" === t || "Lo" === t || "Nl" === t; - }, T = function(e) { - return "Nd" === E(e); - }, O = function(e) { - var t = E(e); - return "Pc" === t || "Pd" === t || "Pe" === t || "Pf" === t || "Pi" === t || "Po" === t || "Ps" === t; }, C = function(e) { - return "Ll" === E(e); + var t = S(e); + return "Lu" === t || "Ll" === t || "Lt" === t || "Lm" === t || "Lo" === t || "Nl" === t; }, P = function(e) { - return "Lu" === E(e); + return "Nd" === S(e); }, F = function(e) { - return "Lt" === E(e); + var t = S(e); + return "Pc" === t || "Pd" === t || "Pe" === t || "Pf" === t || "Pi" === t || "Po" === t || "Ps" === t; }, R = function(e) { - var t = E(e); - return "Zs" === t || "Zl" === t || "Zp" === t; + return "Ll" === S(e); }, I = function(e) { - var t = E(e); - return "Nd" === t || "No" === t || "Nl" === t || "Lu" === t || "Ll" === t || "Lt" === t || "Lm" === t || "Lo" === t || "Me" === t || "Mc" === t; + return "Lu" === S(e); }, j = function(e) { - var t = E(e); + return "Lt" === S(e); + }, B = function(e) { + var t = S(e); + return "Zs" === t || "Zl" === t || "Zp" === t; + }, M = function(e) { + var t = S(e); + return "Nd" === t || "No" === t || "Nl" === t || "Lu" === t || "Ll" === t || "Lt" === t || "Lm" === t || "Lo" === t || "Me" === t || "Mc" === t; + }, N = function(e) { + var t = S(e); return "Mn" === t || "Me" === t || "Mc" === t; - }, B = { - getCategory: E, - getCombiningClass: _, - getScript: x, - getEastAsianWidth: S, - getNumericValue: A, - isAlphabetic: k, - isDigit: T, - isPunctuation: O, - isLowerCase: C, - isUpperCase: P, - isTitleCase: F, - isWhiteSpace: R, - isBaseForm: I, - isMark: j + }, L = { + getCategory: S, + getCombiningClass: A, + getScript: k, + getEastAsianWidth: T, + getNumericValue: O, + isAlphabetic: C, + isDigit: P, + isPunctuation: F, + isLowerCase: R, + isUpperCase: I, + isTitleCase: j, + isWhiteSpace: B, + isBaseForm: M, + isMark: N }; }, 1290: function(e) { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js b/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js index 243db99ff816..b2395227b60d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/styled-components/1/output.js @@ -5322,33 +5322,31 @@ justifySelf: !0, alignSelf: !0, order: !0 - }), dist_index_esm_defaults = { - space: [ - 0, - 4, - 8, - 16, - 32, - 64, - 128, - 256, - 512 - ] - }, grid = system({ + }), dist_index_esm_defaults_space = [ + 0, + 4, + 8, + 16, + 32, + 64, + 128, + 256, + 512 + ], grid = system({ gridGap: { property: "gridGap", scale: "space", - defaultScale: dist_index_esm_defaults.space + defaultScale: dist_index_esm_defaults_space }, gridColumnGap: { property: "gridColumnGap", scale: "space", - defaultScale: dist_index_esm_defaults.space + defaultScale: dist_index_esm_defaults_space }, gridRowGap: { property: "gridRowGap", scale: "space", - defaultScale: dist_index_esm_defaults.space + defaultScale: dist_index_esm_defaults_space }, gridColumn: !0, gridRow: !0, @@ -5484,19 +5482,17 @@ backgroundRepeat: !0 }; background_dist_index_esm_config.bgImage = background_dist_index_esm_config.backgroundImage, background_dist_index_esm_config.bgSize = background_dist_index_esm_config.backgroundSize, background_dist_index_esm_config.bgPosition = background_dist_index_esm_config.backgroundPosition, background_dist_index_esm_config.bgRepeat = background_dist_index_esm_config.backgroundRepeat; - var background = system(background_dist_index_esm_config), position_dist_index_esm_defaults = { - space: [ - 0, - 4, - 8, - 16, - 32, - 64, - 128, - 256, - 512 - ] - }, position = system({ + var background = system(background_dist_index_esm_config), position_dist_index_esm_defaults_space = [ + 0, + 4, + 8, + 16, + 32, + 64, + 128, + 256, + 512 + ], position = system({ position: !0, zIndex: { property: "zIndex", @@ -5505,36 +5501,34 @@ top: { property: "top", scale: "space", - defaultScale: position_dist_index_esm_defaults.space + defaultScale: position_dist_index_esm_defaults_space }, right: { property: "right", scale: "space", - defaultScale: position_dist_index_esm_defaults.space + defaultScale: position_dist_index_esm_defaults_space }, bottom: { property: "bottom", scale: "space", - defaultScale: position_dist_index_esm_defaults.space + defaultScale: position_dist_index_esm_defaults_space }, left: { property: "left", scale: "space", - defaultScale: position_dist_index_esm_defaults.space + defaultScale: position_dist_index_esm_defaults_space } - }), space_dist_index_esm_defaults = { - space: [ - 0, - 4, - 8, - 16, - 32, - 64, - 128, - 256, - 512 - ] - }, index_esm_isNumber = function(n) { + }), space_dist_index_esm_defaults_space = [ + 0, + 4, + 8, + 16, + 32, + 64, + 128, + 256, + 512 + ], index_esm_isNumber = function(n) { return "number" == typeof n && !isNaN(n); }, getMargin = function(n, scale) { if (!index_esm_isNumber(n)) return get(scale, n, n); @@ -5546,31 +5540,31 @@ property: "margin", scale: "space", transform: getMargin, - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, marginTop: { property: "marginTop", scale: "space", transform: getMargin, - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, marginRight: { property: "marginRight", scale: "space", transform: getMargin, - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, marginBottom: { property: "marginBottom", scale: "space", transform: getMargin, - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, marginLeft: { property: "marginLeft", scale: "space", transform: getMargin, - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, marginX: { properties: [ @@ -5579,7 +5573,7 @@ ], scale: "space", transform: getMargin, - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, marginY: { properties: [ @@ -5588,33 +5582,33 @@ ], scale: "space", transform: getMargin, - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space } }, configs.margin.m = configs.margin.margin, configs.margin.mt = configs.margin.marginTop, configs.margin.mr = configs.margin.marginRight, configs.margin.mb = configs.margin.marginBottom, configs.margin.ml = configs.margin.marginLeft, configs.margin.mx = configs.margin.marginX, configs.margin.my = configs.margin.marginY, configs.padding = { padding: { property: "padding", scale: "space", - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, paddingTop: { property: "paddingTop", scale: "space", - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, paddingRight: { property: "paddingRight", scale: "space", - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, paddingBottom: { property: "paddingBottom", scale: "space", - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, paddingLeft: { property: "paddingLeft", scale: "space", - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, paddingX: { properties: [ @@ -5622,7 +5616,7 @@ "paddingRight" ], scale: "space", - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space }, paddingY: { properties: [ @@ -5630,7 +5624,7 @@ "paddingBottom" ], scale: "space", - defaultScale: space_dist_index_esm_defaults.space + defaultScale: space_dist_index_esm_defaults_space } }, configs.padding.p = configs.padding.padding, configs.padding.pt = configs.padding.paddingTop, configs.padding.pr = configs.padding.paddingRight, configs.padding.pb = configs.padding.paddingBottom, configs.padding.pl = configs.padding.paddingLeft, configs.padding.px = configs.padding.paddingX, configs.padding.py = configs.padding.paddingY; var margin = system(configs.margin), padding = system(configs.padding), space = compose(margin, padding), shadow = system({ diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/index.bf24abaa/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/index.bf24abaa/output.js index 0496423d20a6..ac3fbb932414 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/index.bf24abaa/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/wmr/archive-1/chunks/index.bf24abaa/output.js @@ -1,14 +1,12 @@ import { m } from "../index.f66dda46.js"; -const process = { - env: { - FOO: "bar", - OVERRIDE: "11", - EMPTY: "", - FOO_LOCAL: "bar", - NODE_ENV: "production" - } +const process_env = { + FOO: "bar", + OVERRIDE: "11", + EMPTY: "", + FOO_LOCAL: "bar", + NODE_ENV: "production" }; function Environment() { - return m`${Object.keys(process.env).sort().map((key)=>m``)}
Name ${42}Value
${key}${String(process.env[key])}
`; + return m`${Object.keys(process_env).sort().map((key)=>m``)}
Name ${42}Value
${key}${String(process_env[key])}
`; } export { Environment }; 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 0d689a79a4a9..567dead57410 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(null==t)throw TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n-1}function S(t){return t.trim().split(/\s+/g)}function T(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var r=0;rT(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 D(t,e){for(var n,r,i=e[0].toUpperCase()+e.slice(1),o=0;o1&&!r.firstMultiple?r.firstMultiple=U(n):1===o&&(r.firstMultiple=!1),a=r.firstInput,u=(c=r.firstMultiple)?c.center:a.center,l=n.center=q(i),n.timeStamp=f(),n.deltaTime=n.timeStamp-a.timeStamp,n.angle=X(u,l),n.distance=Y(u,l),h=n.center,d=r.offsetDelta||{},v=r.prevDelta||{},g=r.prevInput||{},(1===n.eventType||4===g.eventType)&&(v=r.prevDelta={x:g.deltaX||0,y:g.deltaY||0},d=r.offsetDelta={x:h.x,y:h.y}),n.deltaX=v.x+(h.x-d.x),n.deltaY=v.y+(h.y-d.y),n.offsetDirection=W(n.deltaX,n.deltaY),m=H(n.deltaTime,n.deltaX,n.deltaY),n.overallVelocityX=m.x,n.overallVelocityY=m.y,n.overallVelocity=p(m.x)>p(m.y)?m.x:m.y,n.scale=c?(b=c.pointers,Y(i[0],i[1],V)/Y(b[0],b[1],V)):1,n.rotation=c?(y=c.pointers,X(i[1],i[0],V)+X(y[1],y[0],V)):0,n.maxPointers=r.prevInput?n.pointers.length>r.prevInput.maxPointers?n.pointers.length:r.prevInput.maxPointers:n.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=H(c,u,l);r=h.x,i=h.y,n=p(h.x)>p(h.y)?h.x:h.y,o=W(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}(r,n),w=t.element,M(n.srcEvent.target,w)&&(w=n.srcEvent.target),n.target=w,t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function U(t){for(var e=[],n=0;n=p(e)?t<0?2:4:e<0?8:16}function Y(t,e,n){n||(n=F);var r=e[n[0]]-t[n[0]],i=e[n[1]]-t[n[1]];return Math.sqrt(r*r+i*i)}function X(t,e,n){n||(n=F);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&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(R(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(R(this.element),this.evWin,this.domHandler)}};var K={mousedown:1,mousemove:2,mouseup:4};function G(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,Z.apply(this,arguments)}w(G,Z,{handler:function(t){var e=K[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:z,srcEvent:t}))}});var $={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},J={2:N,3:"pen",4:z,5:"kinect"},Q="pointerdown",tt="pointermove pointerup pointercancel";function te(){this.evEl=Q,this.evWin=tt,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}i.MSPointerEvent&&!i.PointerEvent&&(Q="MSPointerDown",tt="MSPointerMove MSPointerUp MSPointerCancel"),w(te,Z,{handler:function(t){var e=this.store,n=!1,r=$[t.type.toLowerCase().replace("ms","")],i=J[t.pointerType]||t.pointerType,o=i==N,a=T(e,t.pointerId,"pointerId");1&r&&(0===t.button||o)?a<0&&(e.push(t),a=e.length-1):12&r&&(n=!0),!(a<0)&&(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:i,srcEvent:t}),n&&e.splice(a,1))}});var tn={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function tr(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Z.apply(this,arguments)}function ti(t,e){var n=k(t.touches),r=k(t.changedTouches);return 12&e&&(n=x(n.concat(r),"identifier",!0)),[n,r]}w(tr,Z,{handler:function(t){var e=tn[t.type];if(1===e&&(this.started=!0),this.started){var n=ti.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:N,srcEvent:t})}}});var to={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function ta(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},Z.apply(this,arguments)}function ts(t,e){var n=k(t.touches),r=this.targetIds;if(3&e&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=k(t.changedTouches),s=[],c=this.target;if(o=n.filter(function(t){return M(t.target,c)}),1===e)for(i=0;i-1&&r.splice(t,1)},2500)}}function th(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+t_(n)),r(e.options.event),t.additionalEvent&&r(t.additionalEvent),n>=8&&r(e.options.event+t_(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 tj.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=tP(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),w(tT,tj,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[tm]},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(tk,tE,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[tv]},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(tx,tj,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[tm]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),w(tD,tj,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return tS.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=tP(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),w(tC,tE,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tg]},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);n=-90&&e<=90,"invalid latitude");const n=512*(j+Math.log(Math.tan(S+e*T*.5)))/(2*j);return[512*(t*T+j)/(2*j),n]}function C([t,e]){const n=2*(Math.atan(Math.exp(e/512*(2*j)-j))-S);return[(t/512*(2*j)-j)*k,n*k]}function R(t){return 2*Math.atan(.5/t)*k}function A(t){return .5/Math.tan(.5*t*T)}function I(t,e,n=0){const[r,i,o]=t;if(M(Number.isFinite(r)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(o))return g(e,[r,i,o,1]);const a=g(e,[r,i,0,1]),s=g(e,[r,i,1,1]),c=a[2],u=s[2];return P([],a,s,c===u?0:((n||0)-c)/(u-c))}const L=Math.PI/180;function N(t,e,n){const{pixelUnprojectionMatrix:r}=t,i=g(r,[e,0,1,1]),o=g(r,[e,t.height,1,1]),a=(n*t.distanceScales.unitsPerMeter[2]-i[2])/(o[2]-i[2]),s=C(P([],i,o,a));return s[2]=n,s}class z{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=R(s=1.5):null===c?c=R(s):null===s&&(s=A(c));const p=x(i);s=Math.max(.75,s);const f=function({latitude:t,longitude:e,highPrecision:n=!1}){M(Number.isFinite(t)&&Number.isFinite(e));const r={},i=Math.cos(t*T),o=512/360,a=512/360/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 e=T*Math.tan(t*T)/i,n=512/4003e4*e,c=n/a*s;r.unitsPerDegree2=[0,o*e/2,n],r.unitsPerMeter2=[c,0,c]}return r}({longitude:r,latitude:n}),d=D([r,n]);if(d[2]=0,u){var g,m;g=[],m=f.unitsPerMeter,g[0]=u[0]*m[0],g[1]=u[1]*m[1],g[2]=u[2]*m[2],d[0]=d[0]+g[0],d[1]=d[1]+g[1],d[2]=d[2]+g[2]}this.projectionMatrix=function({width:t,height:e,pitch:n,altitude:r,fovy:i,nearZMultiplier:o,farZMultiplier:a}){var s,c,u;const{fov:l,aspect:h,near:p,far:f}=function({width:t,height:e,fovy:n=R(1.5),altitude:r,pitch:i=0,nearZMultiplier:o=1,farZMultiplier:a=1}){void 0!==r&&(n=R(r));const s=.5*n*T,c=A(n),u=i*T,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});return s=[],u=1/Math.tan(l/2),s[0]=u/h,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=u,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!=f&&f!==1/0?(c=1/(p-f),s[10]=(f+p)*c,s[14]=2*f*p*c):(s[10]=-1,s[14]=-2*p),s}({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,p,f,d,g,m,b,y,E,_,P,M,j,S,k,x,D,C;const R=v();return w(R,R,[0,0,-r]),s=Math.sin(a=-e*T),c=Math.cos(a),u=R[4],l=R[5],h=R[6],p=R[7],f=R[8],d=R[9],g=R[10],m=R[11],R!=R&&(R[0]=R[0],R[1]=R[1],R[2]=R[2],R[3]=R[3],R[12]=R[12],R[13]=R[13],R[14]=R[14],R[15]=R[15]),R[4]=u*c+f*s,R[5]=l*c+d*s,R[6]=h*c+g*s,R[7]=p*c+m*s,R[8]=f*c-u*s,R[9]=d*c-l*s,R[10]=g*c-h*s,R[11]=m*c-p*s,y=Math.sin(b=n*T),E=Math.cos(b),_=R[0],P=R[1],M=R[2],j=R[3],S=R[4],k=R[5],x=R[6],D=R[7],R!=R&&(R[8]=R[8],R[9]=R[9],R[10]=R[10],R[11]=R[11],R[12]=R[12],R[13]=R[13],R[14]=R[14],R[15]=R[15]),R[0]=_*E+S*y,R[1]=P*E+k*y,R[2]=M*E+x*y,R[3]=j*E+D*y,R[4]=S*E-_*y,R[5]=k*E-P*y,R[6]=x*E-M*y,R[7]=D*E-j*y,O(R,R,[i/=t,i,i]),o&&w(R,R,((C=[])[0]=-o[0],C[1]=-o[1],C[2]=-o[2],C)),R}({height:e,scale:p,center:d,pitch:o,bearing:a,altitude:s}),this.width=t,this.height=e,this.scale=p,this.latitude=n,this.longitude=r,this.zoom=i,this.pitch=o,this.bearing=a,this.altitude=s,this.fovy=c,this.center=d,this.meterOffset=u||[0,0,0],this.distanceScales=f,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,p,f,d,g,m,b,E,_,P,M,j,S,T,k,x,D,C,R;const{width:A,height:I,projectionMatrix:L,viewMatrix:N}=this,z=v();y(z,z,L),y(z,z,N),this.viewProjectionMatrix=z;const F=v();O(F,F,[A/2,-I/2,1]),w(F,F,[1,-1,0]),y(F,F,z);const V=(t=v(),e=F[0],n=F[1],r=F[2],i=F[3],o=F[4],a=F[5],s=F[6],c=F[7],u=F[8],l=F[9],h=F[10],p=F[11],f=F[12],d=F[13],g=F[14],m=F[15],b=e*a-n*o,E=e*s-r*o,_=e*c-i*o,P=n*s-r*a,M=n*c-i*a,j=r*c-i*s,S=u*d-l*f,T=u*g-h*f,k=u*m-p*f,x=l*g-h*d,D=l*m-p*d,(R=b*(C=h*m-p*g)-E*D+_*x+P*k-M*T+j*S)?(R=1/R,t[0]=(a*C-s*D+c*x)*R,t[1]=(r*D-n*C-i*x)*R,t[2]=(d*j-g*M+m*P)*R,t[3]=(h*M-l*j-p*P)*R,t[4]=(s*k-o*C-c*T)*R,t[5]=(e*C-r*k+i*T)*R,t[6]=(g*_-f*j-m*E)*R,t[7]=(u*j-h*_+p*E)*R,t[8]=(o*D-a*k+c*S)*R,t[9]=(n*k-e*D-i*S)*R,t[10]=(f*M-d*_+m*b)*R,t[11]=(l*_-u*M-p*b)*R,t[12]=(a*T-o*x-s*S)*R,t[13]=(e*x-n*T+r*S)*R,t[14]=(d*E-f*P-g*b)*R,t[15]=(u*P-l*E+h*b)*R,t):null);if(!V)throw Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=F,this.pixelUnprojectionMatrix=V}equals(t){return t instanceof z&&t.width===this.width&&t.height===this.height&&E(t.projectionMatrix,this.projectionMatrix)&&E(t.viewMatrix,this.viewMatrix)}project(t,{topLeft:e=!0}={}){const n=function(t,e){const[n,r,i=0]=t;return M(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i)),g(e,[n,r,i,1])}(this.projectPosition(t),this.pixelProjectionMatrix),[r,i]=n,o=e?i:this.height-i;return 2===t.length?[r,o]:[r,o,n[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=I([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]=D(t);return[e,n,(t[2]||0)*this.distanceScales.unitsPerMeter[2]]}unprojectPosition(t){const[e,n]=C(t);return[e,n,(t[2]||0)*this.distanceScales.metersPerUnit[2]]}projectFlat(t){return D(t)}unprojectFlat(t){return C(t)}getMapCenterByLngLatPosition({lngLat:t,pos:e}){var n;const r=I(e,this.pixelUnprojectionMatrix),i=_([],D(t),((n=[])[0]=-r[0],n[1]=-r[1],n));return C(_([],this.center,i))}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 t=o;o={top:t,bottom:t,left:t,right:t}}else M(Number.isFinite(o.top)&&Number.isFinite(o.bottom)&&Number.isFinite(o.left)&&Number.isFinite(o.right));const h=D([s,l<-85.051129?-85.051129:l>85.051129?85.051129:l]),p=D([u,c<-85.051129?-85.051129:c>85.051129?85.051129:c]),f=[Math.max(Math.abs(p[0]-h[0]),r),Math.max(Math.abs(p[1]-h[1]),r)],d=[t-o.left-o.right-2*Math.abs(a[0]),e-o.top-o.bottom-2*Math.abs(a[1])];M(d[0]>0&&d[1]>0);const v=d[0]/f[0],g=d[1]/f[1],m=(o.right-o.left)/2/v,y=(o.bottom-o.top)/2/g,w=C([(p[0]+h[0])/2+m,(p[1]+h[1])/2+y]),O=Math.min(i,b(Math.abs(Math.min(v,g))));return M(Number.isFinite(O)),{longitude:w[0],latitude:w[1],zoom:O}}(Object.assign({width:n,height:r,bounds:t},e));return new z({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]));return[[n,Math.min(...e.map(t=>t[1]))],[r,Math.max(...e.map(t=>t[1]))]]}getBoundingRegion(t={}){return function(t,e=0){let n,r;const{width:i,height:o,unproject:a}=t,s={targetZ:e},c=a([0,o],s),u=a([i,o],s);return(t.fovy?.5*t.fovy*L:Math.atan(.5/t.altitude))>(90-t.pitch)*L-.01?(n=N(t,0,e),r=N(t,i,e)):(n=a([0,0],s),r=a([i,0],s)),[c,u,r,n]}(this,t.z||0)}}const F=["longitude","latitude","zoom"],V={curve:1.414,speed:1.2};function Z(t,e,n){var r,i;const o=(n=Object.assign({},V,n)).curve,a=t.zoom,s=[t.longitude,t.latitude],c=x(a),u=e.zoom,l=[e.longitude,e.latitude],h=x(u-a),p=D(s),f=(r=[],i=D(l),r[0]=i[0]-p[0],r[1]=i[1]-p[1],r),d=Math.max(t.width,t.height),v=d/h,g=Math.hypot(f[0],f[1])*c,m=Math.max(g,.01),b=o*o,y=(v*v-d*d+b*b*m*m)/(2*d*b*m),w=(v*v-d*d-b*b*m*m)/(2*v*b*m),O=Math.log(Math.sqrt(y*y+1)-y),E=Math.log(Math.sqrt(w*w+1)-w);return{startZoom:a,startCenterXY:p,uDelta:f,w0:d,u1:g,S:(E-O)/o,rho:o,rho2:b,r0:O,r1:E}}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(){U&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),Y?(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(){U&&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;W.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}(),K=function(t,e){for(var n=0,r=Object.keys(e);n0},t}(),to="undefined"!=typeof WeakMap?new WeakMap:new B,ta=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=new ti(e,X.getInstance(),this);to.set(this,n)};["observe","unobserve","disconnect"].forEach(function(t){ta.prototype[t]=function(){var e;return(e=to.get(this))[t].apply(e,arguments)}});var ts=void 0!==q.ResizeObserver?q.ResizeObserver:ta;function tc(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}function tu(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 tv(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&&p.checkPropTypes(ty,t,"prop",e)}var tE=function(){function t(e){var n=this;if(tc(this,t),a(this,"props",tw),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 tl(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(tm(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:tm(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;tO(t=Object.assign({},tw,t),"Mapbox"),this.mapboxgl.accessToken=t.mapboxApiAccessToken||tw.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){tO(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(tm(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!==th)try{var e=th.createElement("div");if(e.className="mapboxgl-map",e.style.display="none",th.body.appendChild(e),!("static"!==window.getComputedStyle(e).position)){var n=th.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")),th.head.appendChild(n)}}catch(t){}}},{key:"_viewStateToMapboxProps",value:function(t){return{center:[t.longitude,t.latitude],zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}}}]),t}();a(tE,"initialized",!1),a(tE,"propTypes",ty),a(tE,"defaultProps",tw),a(tE,"savedMap",null);var t_=n(6158),tP=n.n(t_);function tM(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function tj(t,e,n){return Math.max(e,Math.min(n,t))}function tS(t,e,n){return tM(t)?t.map(function(t,r){return tS(t,e[r],n)}):n*e+(1-n)*t}function tT(t,e){if(!t)throw Error(e||"react-map-gl: assertion failed.")}function tk(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 tx(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)),tT(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=f(new z(Object.assign({},this._viewportProps,{zoom:s})).getMapCenterByLngLatPosition({lngLat:a,pos:e}),2),u=c[0],l=c[1];return this._getUpdatedMapState({zoom:s,longitude:u,latitude:l})}},{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=tj(r,n,e);var i=t.maxPitch,o=t.minPitch,a=t.pitch;return t.pitch=tj(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=m(n+180,360)-180),(a<-180||a>180)&&(a=m(a+180,360)-180);const s=b(e/512);if(i<=s)i=s,r=0;else{const t=e/2/Math.pow(2,i),n=C([0,t])[1];if(re&&(r=e)}}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 z(this._viewportProps);return t&&e.unproject(t)}},{key:"_calculateNewLngLat",value:function(t){var e=t.startPanLngLat,n=t.pos;return new z(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 tj(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=tj(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 tA(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 tI(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},n=c.current&&c.current.getMap();return n&&n.queryRenderedFeatures(t,e)}}},[]);var g=(0,h.useCallback)(function(t){var e=t.target;e===p.current&&e.scrollTo(0,0)},[]),m=v&&h.createElement(tN,{value:tZ(tZ({},d),{},{viewport:d.viewport||tU(tZ({map:v,props:t},a)),map:v,container:d.container||l.current})},h.createElement("div",{key:"map-overlays",className:"overlays",ref:p,style:tq,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=Object.assign({},tq,{visibility:t.visible&&function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tD;for(var n in e){var r,i=n.slice(0,3),o=(r=n.slice(3))[0].toLowerCase()+r.slice(1);if("min"===i&&t[o]e[n])return!1}return!0}(t.viewState||t,E)?"inherit":"hidden"});return h.createElement("div",{key:"map-container",ref:l,style:_},h.createElement("div",{key:"map-mapbox",ref:u,style:P,className:b}),m,!r&&!t.disableTokenWarning&&h.createElement(tY,null))});function tK(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(!function t(e,n){if(e===n)return!0;if(tM(e)&&tM(n)){if(e.length!==n.length)return!1;for(var r=0;r=Math.abs(e-n)}(t[i],e[i]))return!1}}catch(t){r.e(t)}finally{r.f()}return!0}},{key:"initializeProps",value:function(t,e){return{start:t,end:e}}},{key:"interpolateProps",value:function(t,e,n){tT(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(t,e){return e.transitionDuration}}]),t}();function t$(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function tJ(t,e){return(tJ=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function tQ(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&&tJ(t,e)}function t0(t){return(t0="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 t1(t,e){if(e&&("object"===t0(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return t$(t)}function t2(t){return(t2=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var t5={longitude:1,bearing:1};function t4(t){return Number.isFinite(t)||Array.isArray(t)}function t3(t,e,n){return t in t5&&Math.abs(n-e)>180&&(n=n<0?n+360:n-360),n}function t8(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 t6(t,void 0);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 t6(t,void 0)}}(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 t6(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 er(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 tc(this,r),a(t$(t=n.call(this)),"propNames",t9),t.props=Object.assign({},ee,e),t}tl(r,[{key:"initializeProps",value:function(t,e){var n,r={},i={},o=t8(t7);try{for(o.s();!(n=o.n()).done;){var a=n.value,s=t[a],c=e[a];tT(t4(s)&&t4(c),"".concat(a," must be supplied for transition")),r[a]=s,i[a]=t3(a,s,c)}}catch(t){o.e(t)}finally{o.f()}var u,l=t8(et);try{for(l.s();!(u=l.n()).done;){var h=u.value,p=t[h]||0,f=e[h]||0;r[h]=p,i[h]=t3(h,p,f)}}catch(t){l.e(t)}finally{l.f()}return{start:r,end:i}}},{key:"interpolateProps",value:function(t,e,n){var r,i=function(t,e,n,r={}){var i,o;const a={},{startZoom:s,startCenterXY:c,uDelta:u,w0:l,u1:h,S:p,rho:f,rho2:d,r0:v}=Z(t,e,r);if(h<.01){for(const r of F){const i=t[r],o=e[r];a[r]=n*o+(1-n)*i}return a}const g=n*p,m=s+b(1/(Math.cosh(v)/Math.cosh(v+f*g))),y=(i=[],o=(Math.cosh(v)*Math.tanh(v+f*g)-Math.sinh(v))/d*l/h,i[0]=u[0]*o,i[1]=u[1]*o,i);_(y,y,c);const w=C(y);return a.longitude=w[0],a.latitude=w[1],a.zoom=m,a}(t,e,n,this.props),o=t8(et);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tS(t[a],e[a],n)}}catch(t){o.e(t)}finally{o.f()}return i}},{key:"getDuration",value:function(t,e){var n=e.transitionDuration;return"auto"===n&&(n=function(t,e,n={}){let r;const{screenSpeed:i,speed:o,maxDuration:a}=n=Object.assign({},V,n),{S:s,rho:c}=Z(t,e,n),u=1e3*s;return r=Number.isFinite(i)?u/(i/c):u/o,Number.isFinite(a)&&r>a?0:r}(t,e,this.props)),n}}])}(tG);var ei=["longitude","latitude","zoom","bearing","pitch"],eo=function(t){tQ(r,t);var e,n=(e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,n=t2(r);return t=e?Reflect.construct(n,arguments,t2(this).constructor):n.apply(this,arguments),t1(this,t)});function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return tc(this,r),t=n.call(this),Array.isArray(e)&&(e={transitionProps:e}),t.propNames=e.transitionProps||ei,e.around&&(t.around=e.around),t}return tl(r,[{key:"initializeProps",value:function(t,e){var n={},r={};if(this.around){n.around=this.around;var i=new z(t).unproject(this.around);Object.assign(r,e,{around:new z(e).project(i),aroundLngLat:i})}var o,a=en(this.propNames);try{for(a.s();!(o=a.n()).done;){var s=o.value,c=t[s],u=e[s];tT(t4(c)&&t4(u),"".concat(s," must be supplied for transition")),n[s]=c,r[s]=t3(s,c,u)}}catch(t){a.e(t)}finally{a.f()}return{start:n,end:r}}},{key:"interpolateProps",value:function(t,e,n){var r,i={},o=en(this.propNames);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tS(t[a],e[a],n)}}catch(t){o.e(t)}finally{o.f()}if(e.around){var s=f(new z(Object.assign({},e,i)).getMapCenterByLngLatPosition({lngLat:e.aroundLngLat,pos:tS(t.around,e.around,n)}),2),c=s[0],u=s[1];i.longitude=c,i.latitude=u}return i}}]),r}(tG),ea=function(){},es={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},ec={transitionDuration:0,transitionEasing:function(t){return t},transitionInterpolator:new eo,transitionInterruption:es.BREAK,onTransitionStart:ea,onTransitionInterrupt:ea,onTransitionEnd:ea},eu=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tc(this,t),a(this,"_animationFrame",null),a(this,"_onTransitionFrame",function(){e._animationFrame=requestAnimationFrame(e._onTransitionFrame),e._updateViewport()}),this.props=null,this.onViewportChange=n.onViewportChange||ea,this.onStateChange=n.onStateChange||ea,this.time=n.getTime||Date.now}return tl(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===es.SNAP_TO_END?Object.assign(n,this.state.endProps):Object.assign(n,this.state.propsInTransition),this.state.interruption===es.UPDATE)){var i,o,a=this.time(),s=(a-this.state.startTime)/this.state.duration;r.transitionDuration=this.state.duration-(a-this.state.startTime),r.transitionEasing=(o=(i=this.state.easing)(s),function(t){return 1/(1-o)*(i(t*(1-s)+s)-o)}),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!!this._animationFrame}},{key:"_isTransitionEnabled",value:function(t){var e=t.transitionDuration,n=t.transitionInterpolator;return(e>0||"auto"===e)&&!!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===es.IGNORE||this._isUpdateDueToCurrentTransition(e):!this._isTransitionEnabled(e)||e.transitionInterpolator.arePropsEqual(t,e))}},{key:"_triggerTransition",value:function(t,e){tT(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 tR(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(eu,"defaultProps",ec);var el=n(840),eh=n.n(el);const ep={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)}}(eh().PointerEventInput),eh().MouseInput.prototype.handler=function(t){let e=ep[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 ef=eh().Manager;var ed=eh();const ev=ed?[[ed.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[ed.Rotate,{enable:!1}],[ed.Pinch,{enable:!1}],[ed.Swipe,{enable:!1}],[ed.Pan,{threshold:0,enable:!1}],[ed.Press,{enable:!1}],[ed.Tap,{event:"doubletap",taps:2,enable:!1}],[ed.Tap,{event:"anytap",enable:!1}],[ed.Tap,{enable:!1}]]:null,eg={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},em={doubletap:["tap"]},eb={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},ey={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},ew={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"},eO={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},eE="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",e_="undefined"!=typeof window?window:n.g;void 0!==n.g?n.g:window;let eP=!1;try{const t={get passive(){return eP=!0,!0}};e_.addEventListener("test",t,t),e_.removeEventListener("test",t,t)}catch(t){}const eM=-1!==eE.indexOf("firefox"),{WHEEL_EVENTS:ej}=ey,eS="wheel";class eT{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.events=ej.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(e=>t.addEventListener(e,this.handleEvent,!!eP&&{passive:!1}))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===eS&&(this.options.enable=e)}handleEvent(t){if(!this.options.enable)return;let e=t.deltaY;e_.WheelEvent&&(eM&&t.deltaMode===e_.WheelEvent.DOM_DELTA_PIXEL&&(e/=e_.devicePixelRatio),t.deltaMode===e_.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:eS,center:n,delta:e,srcEvent:t,pointerType:"mouse",target:t.target})}}const{MOUSE_EVENTS:ek}=ey,ex="pointermove",eD="pointerover",eC="pointerout",eR="pointerleave";class eA{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=ek.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===ex&&(this.enableMoveEvent=e),t===eD&&(this.enableOverEvent=e),t===eC&&(this.enableOutEvent=e),t===eR&&(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:eD,srcEvent:t,pointerType:"mouse",target:t.target})}handleOutEvent(t){this.enableOutEvent&&"mouseout"===t.type&&this.callback({type:eC,srcEvent:t,pointerType:"mouse",target:t.target})}handleLeaveEvent(t){this.enableLeaveEvent&&"mouseleave"===t.type&&this.callback({type:eR,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:ex,srcEvent:t,pointerType:"mouse",target:t.target});break;case"mouseup":this.pressed=!1}}}const{KEY_EVENTS:eI}=ey,eL="keydown",eN="keyup";class ez{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=eI.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===eL&&(this.enableDownEvent=e),t===eN&&(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:eL,srcEvent:t,key:t.key,target:t.target}),this.enableUpEvent&&"keyup"===t.type&&this.callback({type:eN,srcEvent:t,key:t.key,target:t.target}))}}const eF="contextmenu";class eV{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===eF&&(this.options.enable=e)}handleEvent(t){this.options.enable&&this.callback({type:eF,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})}}const eZ={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},eB={srcElement:"root",priority:0};class eU{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({},eB,n):eB;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 t=r.get(o.srcElement);t.splice(t.indexOf(o),1),0===t.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 e=!1;const r=()=>{t.handled=!0},i=()=>{t.handled=!0,e=!0},o=[];for(let a=0;a{const e=this.manager.get(t);e&&eg[t].forEach(t=>{e.recognizeWith(t)})}),e.recognizerOptions){const t=this.manager.get(r);if(t){const n=e.recognizerOptions[r];delete n.enable,t.set(n)}}for(const[n,r]of(this.wheelInput=new eT(t,this._onOtherEvent,{enable:!1}),this.moveInput=new eA(t,this._onOtherEvent,{enable:!1}),this.keyInput=new ez(t,this._onOtherEvent,{enable:!1,tabIndex:e.tabIndex}),this.contextmenuInput=new eV(t,this._onOtherEvent,{enable:!1}),this.events))r.isEmpty()||(this._toggleRecognizer(r.recognizerName,!0),this.manager.on(n,r.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=em[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:o,events:a}=this,s=eO[t]||t;let c=a.get(s);!c&&(c=new eU(this),a.set(s,c),c.recognizerName=ew[s]||s,o&&o.on(s,c.handleEvent)),c.add(t,e,n,r,i),c.isEmpty()||this._toggleRecognizer(c.recognizerName,!0)}_removeEventHandler(t,e){if("string"!=typeof t){for(const e in t)this._removeEventHandler(e,t[e]);return}const{events:n}=this,r=eO[t]||t,i=n.get(r);if(i&&(i.remove(t,e),i.isEmpty())){const{recognizerName:t}=i;let e=!1;for(const r of n.values())if(r.recognizerName===t&&!r.isEmpty()){e=!0;break}e||this._toggleRecognizer(t,!1)}}_onBasicInput(t){const{srcEvent:e}=t,n=eb[e.type];n&&this.manager.emit(n,t)}_onOtherEvent(t){this.manager.emit(t.type,t)}}function eW(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 eY(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&&e3.call(this,"onMouseEnter",t),s&&e3.call(this,"onMouseLeave",t),(a||s)&&this.setState({isHovering:o})}}function e7(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=e5.call(this,t)).features=e4.call(this,t.point),a.forEach(function(e){return e(t)}))}var nt=(0,h.forwardRef)(function(t,e){var n,a,s=(0,h.useContext)(tL),c=(0,h.useMemo)(function(){return t.controller||new eJ},[]),u=(0,h.useMemo)(function(){return new eH(null,{touchAction:t.touchAction,recognizerOptions:t.eventRecognizerOptions})},[]),l=(0,h.useRef)(null),p=(0,h.useRef)(null),f=(0,h.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=e0(e0({},f.state),e),l.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,tF(f.map,t)]}}),o&&o({viewState:t,interactionState:e,oldViewState:r}),a&&a(t,e,r)};(0,h.useImperativeHandle)(e,function(){return{getMap:p.current&&p.current.getMap,queryRenderedFeatures:p.current&&p.current.queryRenderedFeatures}},[]);var g=(0,h.useMemo)(function(){return e0(e0({},s),{},{eventManager:u,container:s.container||l.current})},[s,l.current]);g.onViewportChange=v,g.viewport=s.viewport||tU(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&&c.setOptions(e0(e0(e0({},f.props),f.props.viewState),{},{isInteractive:!!(f.props.onViewStateChange||f.props.onViewportChange),onViewportChange:v,onStateChange:m,eventManager:u,width:f.width,height:f.height}))};(0,h.useEffect)(function(){return u.setElement(l.current),u.on({pointerdown:e8.bind(f),pointermove:e9.bind(f),pointerup:e6.bind(f),pointerleave:e3.bind(f,"onMouseOut"),click:e7.bind(f),anyclick:e7.bind(f),dblclick:e3.bind(f,"onDblClick"),wheel:e3.bind(f,"onWheel"),contextmenu:e3.bind(f,"onContextMenu")}),function(){u.destroy()}},[]),tz(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 y=t.width,w=t.height,O=t.style,E=t.getCursor,_=(0,h.useMemo)(function(){return e0(e0({position:"relative"},O),{},{width:y,height:w,cursor:E(f.state)})},[O,y,w,E,f.state]);return n&&f._child||(f._child=h.createElement(tN,{value:g},h.createElement("div",{key:"event-canvas",ref:l,style:_},h.createElement(tX,r({},t,{width:"100%",height:"100%",style:null,onResize:function(t){var e=t.width,n=t.height;f.width=e,f.height=n,b(),f.props.onResize({width:e,height:n})},ref:p}))))),d=!1,f._child});nt.supported=tX.supported,nt.propTypes=e1,nt.defaultProps=e2;var ne=nt;p.string.isRequired,p.string,p.oneOf(["fill","line","symbol","circle","fill-extrusion","raster","background","heatmap","hillshade","sky"]).isRequired,p.string,p.string,p.string;var nn={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},nr={captureScroll:p.bool,captureDrag:p.bool,captureClick:p.bool,captureDoubleClick:p.bool,capturePointerMove:p.bool};function ni(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,h.useContext)(tL),n=(0,h.useRef)(null),r=(0,h.useRef)({props:t,state:{},context:e,containerRef:n}).current;return r.props=t,r.context=e,(0,h.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 no(t){var e=t.instance,n=ni(t),r=n.context,i=n.containerRef;return e._context=r,e._containerRef=i,e._render()}var na=function(t){tQ(i,t);var e,n=(e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,n=t2(i);return t=e?Reflect.construct(n,arguments,t2(this).constructor):n.apply(this,arguments),t1(this,t)});function i(){var t;tc(this,i);for(var e=arguments.length,r=Array(e),o=0;o2&&void 0!==arguments[2]?arguments[2]:"x";if(null===t)return e;var r="x"===n?t.offsetWidth:t.offsetHeight;return nv(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 nb=Object.assign({},nu,{className:p.string,longitude:p.number.isRequired,latitude:p.number.isRequired,style:p.object}),ny=Object.assign({},nl,{className:""});function nw(t){var e,n,r,i,o,s,c,u=(n=(e=f((0,h.useState)(null),2))[0],r=e[1],o=(i=f((0,h.useState)(null),2))[0],s=i[1],(c=ni(nc(nc({},t),{},{onDragStart:nf}))).callbacks=t,c.state.dragPos=n,c.state.setDragPos=r,c.state.dragOffset=o,c.state.setDragOffset=s,(0,h.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=nh(t);i.setDragPos(a);var s=i.dragOffset;if(r.onDrag&&s){var c=Object.assign({},t);c.lngLat=np(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=np(a,s,n,o),r.onDragEnd(c)}}(e,t)},pancancel:function(e){var n;return n=t.state,void(e.stopPropagation(),n.setDragPos(null),n.setDragOffset(null))}};return e.watch(n),function(){e.off(n)}}}(c)},[c.context.eventManager,!!n]),c),l=u.state,p=u.containerRef,d=t.children,v=t.className,g=t.draggable,m=t.style,b=l.dragPos,y=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,l=r.viewport,h=r.map;if(c&&u)return[c[0]+u[0],c[1]+u[1]];var p=tF(h,{longitude:i,latitude:o}),d=f(l.project([i,o,p]),2),v=d[0],g=d[1];return[v+=a,g+=s]}(u),w=f(y,2),O=w[0],E=w[1],_="translate(".concat(nv(O),"px, ").concat(nv(E),"px)"),P=g?b?"grabbing":"grab":"auto",M=(0,h.useMemo)(function(){var t=function(t){for(var e=1;e0){var g=p,m=v;for(p=0;p<=1;p+=.5)d=(f=n-p*a)+a,(v=Math.max(0,u-f)+Math.max(0,d-i+u))0){var E=h,_=O;for(h=0;h<=1;h+=b)w=(y=e-h*o)+o,(O=Math.max(0,u-y)+Math.max(0,w-r+u))<_&&(_=O,E=h);h=E}return nE.find(function(t){var e=nO[t];return e.x===h&&e.y===p})||s}({x:r,y:i,anchor:o,padding:s,width:S.width,height:S.height,selfWidth:e.clientWidth,selfHeight:e.clientHeight}):o),z=(c=M.current,l=(u=f(L,3))[0],p=u[1],d=u[2],v=t.offsetLeft,g=t.offsetTop,m=t.sortByDepth,y=ng(c,-(100*(b=nO[N]).x)),w=ng(c,-(100*b.y),"y"),O={position:"absolute",transform:"\n translate(".concat(y,"%, ").concat(w,"%)\n translate(").concat(nv(l+v),"px, ").concat(nv(p+g),"px)\n "),display:void 0,zIndex:void 0},m&&(d>1||d<-1||l<0||l>S.width||p<0||p>S.height?O.display="none":O.zIndex=Math.floor((1-d)/2*1e5)),O),F=(0,h.useCallback)(function(t){_.props.onClose();var e=_.context.eventManager;e&&e.once("click",function(t){return t.stopPropagation()},t.target)},[]);return h.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(N," ").concat(k),style:z,ref:M},h.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:C}}),h.createElement("div",{key:"content",ref:E,className:"mapboxgl-popup-content"},R&&h.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:F},"×"),A))}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}nM.propTypes=n_,nM.defaultProps=nP,h.memo(nM);var nS=Object.assign({},nr,{toggleLabel:p.string,className:p.string,style:p.object,compact:p.bool,customAttribution:p.oneOfType([p.string,p.arrayOf(p.string)])}),nT=Object.assign({},nn,{className:"",toggleLabel:"Toggle Attribution"});function nk(t){var e=ni(t),n=e.context,r=e.containerRef,i=(0,h.useRef)(null),o=f((0,h.useState)(!1),2),s=o[0],c=o[1];(0,h.useEffect)(function(){var e,o,a,s,c,u;return n.map&&(o={customAttribution:t.customAttribution},a=n.map,s=r.current,c=i.current,(u=new(tP()).AttributionControl(o))._map=a,u._container=s,u._innerContainer=c,u._updateAttributions(),u._updateEditLink(),a.on("styledata",u._updateData),a.on("sourcedata",u._updateData),e=u),function(){var t;return e&&void((t=e)._map.off("styledata",t._updateData),t._map.off("sourcedata",t._updateData))}},[n.map]);var u=void 0===t.compact?n.viewport.width<=640:t.compact;(0,h.useEffect)(function(){!u&&s&&c(!1)},[u]);var l=(0,h.useCallback)(function(){return c(function(t){return!t})},[]),p=(0,h.useMemo)(function(){return function(t){for(var e=1;ea)return 1}return 0}(o.map.version,"1.6.0")>=0?2:1:2},[o.map]),n=o.viewport.bearing,r={transform:"rotate(".concat(-n,"deg)")},2===e?h.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:r}):h.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:r})))))}function nW(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}nH.propTypes=nZ,nH.defaultProps=nB,h.memo(nH);var nY=Object.assign({},nr,{className:p.string,style:p.object,maxWidth:p.number,unit:p.oneOf(["imperial","metric","nautical"])}),nX=Object.assign({},nn,{className:"",maxWidth:100,unit:"metric"});function nK(t){var e=ni(t),n=e.context,r=e.containerRef,i=f((0,h.useState)(null),2),o=i[0],s=i[1];(0,h.useEffect)(function(){if(n.map){var t=new(tP()).ScaleControl;t._map=n.map,t._container=r.current,s(t)}},[n.map]),o&&(o.options=t,o._onMove());var c=(0,h.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(null==t)throw TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n-1}function S(t){return t.trim().split(/\s+/g)}function T(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var r=0;rT(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 D(t,e){for(var n,r,i=e[0].toUpperCase()+e.slice(1),o=0;o1&&!r.firstMultiple?r.firstMultiple=U(n):1===o&&(r.firstMultiple=!1),a=r.firstInput,u=(c=r.firstMultiple)?c.center:a.center,l=n.center=q(i),n.timeStamp=f(),n.deltaTime=n.timeStamp-a.timeStamp,n.angle=Y(u,l),n.distance=X(u,l),h=n.center,d=r.offsetDelta||{},v=r.prevDelta||{},g=r.prevInput||{},(1===n.eventType||4===g.eventType)&&(v=r.prevDelta={x:g.deltaX||0,y:g.deltaY||0},d=r.offsetDelta={x:h.x,y:h.y}),n.deltaX=v.x+(h.x-d.x),n.deltaY=v.y+(h.y-d.y),n.offsetDirection=H(n.deltaX,n.deltaY),m=W(n.deltaTime,n.deltaX,n.deltaY),n.overallVelocityX=m.x,n.overallVelocityY=m.y,n.overallVelocity=p(m.x)>p(m.y)?m.x:m.y,n.scale=c?(b=c.pointers,X(i[0],i[1],V)/X(b[0],b[1],V)):1,n.rotation=c?(y=c.pointers,Y(i[1],i[0],V)+Y(y[1],y[0],V)):0,n.maxPointers=r.prevInput?n.pointers.length>r.prevInput.maxPointers?n.pointers.length:r.prevInput.maxPointers:n.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=H(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}(r,n),w=t.element,M(n.srcEvent.target,w)&&(w=n.srcEvent.target),n.target=w,t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function U(t){for(var e=[],n=0;n=p(e)?t<0?2:4:e<0?8:16}function X(t,e,n){n||(n=F);var r=e[n[0]]-t[n[0]],i=e[n[1]]-t[n[1]];return Math.sqrt(r*r+i*i)}function Y(t,e,n){n||(n=F);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&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(R(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(R(this.element),this.evWin,this.domHandler)}};var K={mousedown:1,mousemove:2,mouseup:4};function G(){this.evEl="mousedown",this.evWin="mousemove mouseup",this.pressed=!1,Z.apply(this,arguments)}w(G,Z,{handler:function(t){var e=K[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:z,srcEvent:t}))}});var $={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},J={2:N,3:"pen",4:z,5:"kinect"},Q="pointerdown",tt="pointermove pointerup pointercancel";function te(){this.evEl=Q,this.evWin=tt,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}i.MSPointerEvent&&!i.PointerEvent&&(Q="MSPointerDown",tt="MSPointerMove MSPointerUp MSPointerCancel"),w(te,Z,{handler:function(t){var e=this.store,n=!1,r=$[t.type.toLowerCase().replace("ms","")],i=J[t.pointerType]||t.pointerType,o=i==N,a=T(e,t.pointerId,"pointerId");1&r&&(0===t.button||o)?a<0&&(e.push(t),a=e.length-1):12&r&&(n=!0),!(a<0)&&(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:i,srcEvent:t}),n&&e.splice(a,1))}});var tn={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function tr(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,Z.apply(this,arguments)}function ti(t,e){var n=k(t.touches),r=k(t.changedTouches);return 12&e&&(n=x(n.concat(r),"identifier",!0)),[n,r]}w(tr,Z,{handler:function(t){var e=tn[t.type];if(1===e&&(this.started=!0),this.started){var n=ti.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:N,srcEvent:t})}}});var to={touchstart:1,touchmove:2,touchend:4,touchcancel:8};function ta(){this.evTarget="touchstart touchmove touchend touchcancel",this.targetIds={},Z.apply(this,arguments)}function ts(t,e){var n=k(t.touches),r=this.targetIds;if(3&e&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=k(t.changedTouches),s=[],c=this.target;if(o=n.filter(function(t){return M(t.target,c)}),1===e)for(i=0;i-1&&r.splice(t,1)},2500)}}function th(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+t_(n)),r(e.options.event),t.additionalEvent&&r(t.additionalEvent),n>=8&&r(e.options.event+t_(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 tj.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=tP(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),w(tT,tj,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[tm]},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(tk,tE,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[tv]},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(tx,tj,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[tm]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),w(tD,tj,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return tS.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=tP(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),w(tC,tE,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tg]},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);n=-90&&e<=90,"invalid latitude");const n=512*(j+Math.log(Math.tan(S+e*T*.5)))/(2*j);return[512*(t*T+j)/(2*j),n]}function C([t,e]){const n=2*(Math.atan(Math.exp(e/512*(2*j)-j))-S);return[(t/512*(2*j)-j)*k,n*k]}function R(t){return 2*Math.atan(.5/t)*k}function A(t){return .5/Math.tan(.5*t*T)}function I(t,e,n=0){const[r,i,o]=t;if(M(Number.isFinite(r)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(o))return g(e,[r,i,o,1]);const a=g(e,[r,i,0,1]),s=g(e,[r,i,1,1]),c=a[2],u=s[2];return P([],a,s,c===u?0:((n||0)-c)/(u-c))}const L=Math.PI/180;function N(t,e,n){const{pixelUnprojectionMatrix:r}=t,i=g(r,[e,0,1,1]),o=g(r,[e,t.height,1,1]),a=(n*t.distanceScales.unitsPerMeter[2]-i[2])/(o[2]-i[2]),s=C(P([],i,o,a));return s[2]=n,s}class z{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=R(s=1.5):null===c?c=R(s):null===s&&(s=A(c));const p=x(i);s=Math.max(.75,s);const f=function({latitude:t,longitude:e,highPrecision:n=!1}){M(Number.isFinite(t)&&Number.isFinite(e));const r={},i=Math.cos(t*T),o=512/360,a=512/360/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 e=T*Math.tan(t*T)/i,n=512/4003e4*e,c=n/a*s;r.unitsPerDegree2=[0,o*e/2,n],r.unitsPerMeter2=[c,0,c]}return r}({longitude:r,latitude:n}),d=D([r,n]);if(d[2]=0,u){var g,m;g=[],m=f.unitsPerMeter,g[0]=u[0]*m[0],g[1]=u[1]*m[1],g[2]=u[2]*m[2],d[0]=d[0]+g[0],d[1]=d[1]+g[1],d[2]=d[2]+g[2]}this.projectionMatrix=function({width:t,height:e,pitch:n,altitude:r,fovy:i,nearZMultiplier:o,farZMultiplier:a}){var s,c,u;const{fov:l,aspect:h,near:p,far:f}=function({width:t,height:e,fovy:n=R(1.5),altitude:r,pitch:i=0,nearZMultiplier:o=1,farZMultiplier:a=1}){void 0!==r&&(n=R(r));const s=.5*n*T,c=A(n),u=i*T,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});return s=[],u=1/Math.tan(l/2),s[0]=u/h,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=u,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!=f&&f!==1/0?(c=1/(p-f),s[10]=(f+p)*c,s[14]=2*f*p*c):(s[10]=-1,s[14]=-2*p),s}({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,p,f,d,g,m,b,y,E,_,P,M,j,S,k,x,D,C;const R=v();return w(R,R,[0,0,-r]),s=Math.sin(a=-e*T),c=Math.cos(a),u=R[4],l=R[5],h=R[6],p=R[7],f=R[8],d=R[9],g=R[10],m=R[11],R!=R&&(R[0]=R[0],R[1]=R[1],R[2]=R[2],R[3]=R[3],R[12]=R[12],R[13]=R[13],R[14]=R[14],R[15]=R[15]),R[4]=u*c+f*s,R[5]=l*c+d*s,R[6]=h*c+g*s,R[7]=p*c+m*s,R[8]=f*c-u*s,R[9]=d*c-l*s,R[10]=g*c-h*s,R[11]=m*c-p*s,y=Math.sin(b=n*T),E=Math.cos(b),_=R[0],P=R[1],M=R[2],j=R[3],S=R[4],k=R[5],x=R[6],D=R[7],R!=R&&(R[8]=R[8],R[9]=R[9],R[10]=R[10],R[11]=R[11],R[12]=R[12],R[13]=R[13],R[14]=R[14],R[15]=R[15]),R[0]=_*E+S*y,R[1]=P*E+k*y,R[2]=M*E+x*y,R[3]=j*E+D*y,R[4]=S*E-_*y,R[5]=k*E-P*y,R[6]=x*E-M*y,R[7]=D*E-j*y,O(R,R,[i/=t,i,i]),o&&w(R,R,((C=[])[0]=-o[0],C[1]=-o[1],C[2]=-o[2],C)),R}({height:e,scale:p,center:d,pitch:o,bearing:a,altitude:s}),this.width=t,this.height=e,this.scale=p,this.latitude=n,this.longitude=r,this.zoom=i,this.pitch=o,this.bearing=a,this.altitude=s,this.fovy=c,this.center=d,this.meterOffset=u||[0,0,0],this.distanceScales=f,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,p,f,d,g,m,b,E,_,P,M,j,S,T,k,x,D,C,R;const{width:A,height:I,projectionMatrix:L,viewMatrix:N}=this,z=v();y(z,z,L),y(z,z,N),this.viewProjectionMatrix=z;const F=v();O(F,F,[A/2,-I/2,1]),w(F,F,[1,-1,0]),y(F,F,z);const V=(t=v(),e=F[0],n=F[1],r=F[2],i=F[3],o=F[4],a=F[5],s=F[6],c=F[7],u=F[8],l=F[9],h=F[10],p=F[11],f=F[12],d=F[13],g=F[14],m=F[15],b=e*a-n*o,E=e*s-r*o,_=e*c-i*o,P=n*s-r*a,M=n*c-i*a,j=r*c-i*s,S=u*d-l*f,T=u*g-h*f,k=u*m-p*f,x=l*g-h*d,D=l*m-p*d,(R=b*(C=h*m-p*g)-E*D+_*x+P*k-M*T+j*S)?(R=1/R,t[0]=(a*C-s*D+c*x)*R,t[1]=(r*D-n*C-i*x)*R,t[2]=(d*j-g*M+m*P)*R,t[3]=(h*M-l*j-p*P)*R,t[4]=(s*k-o*C-c*T)*R,t[5]=(e*C-r*k+i*T)*R,t[6]=(g*_-f*j-m*E)*R,t[7]=(u*j-h*_+p*E)*R,t[8]=(o*D-a*k+c*S)*R,t[9]=(n*k-e*D-i*S)*R,t[10]=(f*M-d*_+m*b)*R,t[11]=(l*_-u*M-p*b)*R,t[12]=(a*T-o*x-s*S)*R,t[13]=(e*x-n*T+r*S)*R,t[14]=(d*E-f*P-g*b)*R,t[15]=(u*P-l*E+h*b)*R,t):null);if(!V)throw Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=F,this.pixelUnprojectionMatrix=V}equals(t){return t instanceof z&&t.width===this.width&&t.height===this.height&&E(t.projectionMatrix,this.projectionMatrix)&&E(t.viewMatrix,this.viewMatrix)}project(t,{topLeft:e=!0}={}){const n=function(t,e){const[n,r,i=0]=t;return M(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i)),g(e,[n,r,i,1])}(this.projectPosition(t),this.pixelProjectionMatrix),[r,i]=n,o=e?i:this.height-i;return 2===t.length?[r,o]:[r,o,n[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=I([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]=D(t);return[e,n,(t[2]||0)*this.distanceScales.unitsPerMeter[2]]}unprojectPosition(t){const[e,n]=C(t);return[e,n,(t[2]||0)*this.distanceScales.metersPerUnit[2]]}projectFlat(t){return D(t)}unprojectFlat(t){return C(t)}getMapCenterByLngLatPosition({lngLat:t,pos:e}){var n;const r=I(e,this.pixelUnprojectionMatrix),i=_([],D(t),((n=[])[0]=-r[0],n[1]=-r[1],n));return C(_([],this.center,i))}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 t=o;o={top:t,bottom:t,left:t,right:t}}else M(Number.isFinite(o.top)&&Number.isFinite(o.bottom)&&Number.isFinite(o.left)&&Number.isFinite(o.right));const h=D([s,l<-85.051129?-85.051129:l>85.051129?85.051129:l]),p=D([u,c<-85.051129?-85.051129:c>85.051129?85.051129:c]),f=[Math.max(Math.abs(p[0]-h[0]),r),Math.max(Math.abs(p[1]-h[1]),r)],d=[t-o.left-o.right-2*Math.abs(a[0]),e-o.top-o.bottom-2*Math.abs(a[1])];M(d[0]>0&&d[1]>0);const v=d[0]/f[0],g=d[1]/f[1],m=(o.right-o.left)/2/v,y=(o.bottom-o.top)/2/g,w=C([(p[0]+h[0])/2+m,(p[1]+h[1])/2+y]),O=Math.min(i,b(Math.abs(Math.min(v,g))));return M(Number.isFinite(O)),{longitude:w[0],latitude:w[1],zoom:O}}(Object.assign({width:n,height:r,bounds:t},e));return new z({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]));return[[n,Math.min(...e.map(t=>t[1]))],[r,Math.max(...e.map(t=>t[1]))]]}getBoundingRegion(t={}){return function(t,e=0){let n,r;const{width:i,height:o,unproject:a}=t,s={targetZ:e},c=a([0,o],s),u=a([i,o],s);return(t.fovy?.5*t.fovy*L:Math.atan(.5/t.altitude))>(90-t.pitch)*L-.01?(n=N(t,0,e),r=N(t,i,e)):(n=a([0,0],s),r=a([i,0],s)),[c,u,r,n]}(this,t.z||0)}}const F=["longitude","latitude","zoom"],V={curve:1.414,speed:1.2};function Z(t,e,n){var r,i;const o=(n=Object.assign({},V,n)).curve,a=t.zoom,s=[t.longitude,t.latitude],c=x(a),u=e.zoom,l=[e.longitude,e.latitude],h=x(u-a),p=D(s),f=(r=[],i=D(l),r[0]=i[0]-p[0],r[1]=i[1]-p[1],r),d=Math.max(t.width,t.height),v=d/h,g=Math.hypot(f[0],f[1])*c,m=Math.max(g,.01),b=o*o,y=(v*v-d*d+b*b*m*m)/(2*d*b*m),w=(v*v-d*d-b*b*m*m)/(2*v*b*m),O=Math.log(Math.sqrt(y*y+1)-y),E=Math.log(Math.sqrt(w*w+1)-w);return{startZoom:a,startCenterXY:p,uDelta:f,w0:d,u1:g,S:(E-O)/o,rho:o,rho2:b,r0:O,r1:E}}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(){U&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),X?(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(){U&&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}(),K=function(t,e){for(var n=0,r=Object.keys(e);n0},t}(),to="undefined"!=typeof WeakMap?new WeakMap:new B,ta=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=new ti(e,Y.getInstance(),this);to.set(this,n)};["observe","unobserve","disconnect"].forEach(function(t){ta.prototype[t]=function(){var e;return(e=to.get(this))[t].apply(e,arguments)}});var ts=void 0!==q.ResizeObserver?q.ResizeObserver:ta;function tc(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}function tu(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 tv(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&&p.checkPropTypes(ty,t,"prop",e)}var tE=function(){function t(e){var n=this;if(tc(this,t),a(this,"props",tw),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 tl(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(tm(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:tm(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;tO(t=Object.assign({},tw,t),"Mapbox"),this.mapboxgl.accessToken=t.mapboxApiAccessToken||tw.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){tO(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(tm(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!==th)try{var e=th.createElement("div");if(e.className="mapboxgl-map",e.style.display="none",th.body.appendChild(e),!("static"!==window.getComputedStyle(e).position)){var n=th.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")),th.head.appendChild(n)}}catch(t){}}},{key:"_viewStateToMapboxProps",value:function(t){return{center:[t.longitude,t.latitude],zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}}}]),t}();a(tE,"initialized",!1),a(tE,"propTypes",ty),a(tE,"defaultProps",tw),a(tE,"savedMap",null);var t_=n(6158),tP=n.n(t_);function tM(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function tj(t,e,n){return Math.max(e,Math.min(n,t))}function tS(t,e,n){return tM(t)?t.map(function(t,r){return tS(t,e[r],n)}):n*e+(1-n)*t}function tT(t,e){if(!t)throw Error(e||"react-map-gl: assertion failed.")}function tk(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 tx(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)),tT(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=f(new z(Object.assign({},this._viewportProps,{zoom:s})).getMapCenterByLngLatPosition({lngLat:a,pos:e}),2),u=c[0],l=c[1];return this._getUpdatedMapState({zoom:s,longitude:u,latitude:l})}},{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=tj(r,n,e);var i=t.maxPitch,o=t.minPitch,a=t.pitch;return t.pitch=tj(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=m(n+180,360)-180),(a<-180||a>180)&&(a=m(a+180,360)-180);const s=b(e/512);if(i<=s)i=s,r=0;else{const t=e/2/Math.pow(2,i),n=C([0,t])[1];if(re&&(r=e)}}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 z(this._viewportProps);return t&&e.unproject(t)}},{key:"_calculateNewLngLat",value:function(t){var e=t.startPanLngLat,n=t.pos;return new z(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 tj(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=tj(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 tA(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 tI(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},n=c.current&&c.current.getMap();return n&&n.queryRenderedFeatures(t,e)}}},[]);var g=(0,h.useCallback)(function(t){var e=t.target;e===p.current&&e.scrollTo(0,0)},[]),m=v&&h.createElement(tN,{value:tZ(tZ({},d),{},{viewport:d.viewport||tU(tZ({map:v,props:t},a)),map:v,container:d.container||l.current})},h.createElement("div",{key:"map-overlays",className:"overlays",ref:p,style:tq,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=Object.assign({},tq,{visibility:t.visible&&function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tD;for(var n in e){var r,i=n.slice(0,3),o=(r=n.slice(3))[0].toLowerCase()+r.slice(1);if("min"===i&&t[o]e[n])return!1}return!0}(t.viewState||t,E)?"inherit":"hidden"});return h.createElement("div",{key:"map-container",ref:l,style:_},h.createElement("div",{key:"map-mapbox",ref:u,style:P,className:b}),m,!r&&!t.disableTokenWarning&&h.createElement(tX,null))});function tK(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(!function t(e,n){if(e===n)return!0;if(tM(e)&&tM(n)){if(e.length!==n.length)return!1;for(var r=0;r=Math.abs(e-n)}(t[i],e[i]))return!1}}catch(t){r.e(t)}finally{r.f()}return!0}},{key:"initializeProps",value:function(t,e){return{start:t,end:e}}},{key:"interpolateProps",value:function(t,e,n){tT(!1,"interpolateProps is not implemented")}},{key:"getDuration",value:function(t,e){return e.transitionDuration}}]),t}();function t$(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function tJ(t,e){return(tJ=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function tQ(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&&tJ(t,e)}function t0(t){return(t0="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 t1(t,e){if(e&&("object"===t0(e)||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return t$(t)}function t2(t){return(t2=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var t5={longitude:1,bearing:1};function t4(t){return Number.isFinite(t)||Array.isArray(t)}function t3(t,e,n){return t in t5&&Math.abs(n-e)>180&&(n=n<0?n+360:n-360),n}function t8(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 t6(t,void 0);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 t6(t,void 0)}}(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 t6(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 er(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 tc(this,r),a(t$(t=n.call(this)),"propNames",t9),t.props=Object.assign({},ee,e),t}tl(r,[{key:"initializeProps",value:function(t,e){var n,r={},i={},o=t8(t7);try{for(o.s();!(n=o.n()).done;){var a=n.value,s=t[a],c=e[a];tT(t4(s)&&t4(c),"".concat(a," must be supplied for transition")),r[a]=s,i[a]=t3(a,s,c)}}catch(t){o.e(t)}finally{o.f()}var u,l=t8(et);try{for(l.s();!(u=l.n()).done;){var h=u.value,p=t[h]||0,f=e[h]||0;r[h]=p,i[h]=t3(h,p,f)}}catch(t){l.e(t)}finally{l.f()}return{start:r,end:i}}},{key:"interpolateProps",value:function(t,e,n){var r,i=function(t,e,n,r={}){var i,o;const a={},{startZoom:s,startCenterXY:c,uDelta:u,w0:l,u1:h,S:p,rho:f,rho2:d,r0:v}=Z(t,e,r);if(h<.01){for(const r of F){const i=t[r],o=e[r];a[r]=n*o+(1-n)*i}return a}const g=n*p,m=s+b(1/(Math.cosh(v)/Math.cosh(v+f*g))),y=(i=[],o=(Math.cosh(v)*Math.tanh(v+f*g)-Math.sinh(v))/d*l/h,i[0]=u[0]*o,i[1]=u[1]*o,i);_(y,y,c);const w=C(y);return a.longitude=w[0],a.latitude=w[1],a.zoom=m,a}(t,e,n,this.props),o=t8(et);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tS(t[a],e[a],n)}}catch(t){o.e(t)}finally{o.f()}return i}},{key:"getDuration",value:function(t,e){var n=e.transitionDuration;return"auto"===n&&(n=function(t,e,n={}){let r;const{screenSpeed:i,speed:o,maxDuration:a}=n=Object.assign({},V,n),{S:s,rho:c}=Z(t,e,n),u=1e3*s;return r=Number.isFinite(i)?u/(i/c):u/o,Number.isFinite(a)&&r>a?0:r}(t,e,this.props)),n}}])}(tG);var ei=["longitude","latitude","zoom","bearing","pitch"],eo=function(t){tQ(r,t);var e,n=(e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,n=t2(r);return t=e?Reflect.construct(n,arguments,t2(this).constructor):n.apply(this,arguments),t1(this,t)});function r(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return tc(this,r),t=n.call(this),Array.isArray(e)&&(e={transitionProps:e}),t.propNames=e.transitionProps||ei,e.around&&(t.around=e.around),t}return tl(r,[{key:"initializeProps",value:function(t,e){var n={},r={};if(this.around){n.around=this.around;var i=new z(t).unproject(this.around);Object.assign(r,e,{around:new z(e).project(i),aroundLngLat:i})}var o,a=en(this.propNames);try{for(a.s();!(o=a.n()).done;){var s=o.value,c=t[s],u=e[s];tT(t4(c)&&t4(u),"".concat(s," must be supplied for transition")),n[s]=c,r[s]=t3(s,c,u)}}catch(t){a.e(t)}finally{a.f()}return{start:n,end:r}}},{key:"interpolateProps",value:function(t,e,n){var r,i={},o=en(this.propNames);try{for(o.s();!(r=o.n()).done;){var a=r.value;i[a]=tS(t[a],e[a],n)}}catch(t){o.e(t)}finally{o.f()}if(e.around){var s=f(new z(Object.assign({},e,i)).getMapCenterByLngLatPosition({lngLat:e.aroundLngLat,pos:tS(t.around,e.around,n)}),2),c=s[0],u=s[1];i.longitude=c,i.latitude=u}return i}}]),r}(tG),ea=function(){},es={BREAK:1,SNAP_TO_END:2,IGNORE:3,UPDATE:4},ec={transitionDuration:0,transitionEasing:function(t){return t},transitionInterpolator:new eo,transitionInterruption:es.BREAK,onTransitionStart:ea,onTransitionInterrupt:ea,onTransitionEnd:ea},eu=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tc(this,t),a(this,"_animationFrame",null),a(this,"_onTransitionFrame",function(){e._animationFrame=requestAnimationFrame(e._onTransitionFrame),e._updateViewport()}),this.props=null,this.onViewportChange=n.onViewportChange||ea,this.onStateChange=n.onStateChange||ea,this.time=n.getTime||Date.now}return tl(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===es.SNAP_TO_END?Object.assign(n,this.state.endProps):Object.assign(n,this.state.propsInTransition),this.state.interruption===es.UPDATE)){var i,o,a=this.time(),s=(a-this.state.startTime)/this.state.duration;r.transitionDuration=this.state.duration-(a-this.state.startTime),r.transitionEasing=(o=(i=this.state.easing)(s),function(t){return 1/(1-o)*(i(t*(1-s)+s)-o)}),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!!this._animationFrame}},{key:"_isTransitionEnabled",value:function(t){var e=t.transitionDuration,n=t.transitionInterpolator;return(e>0||"auto"===e)&&!!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===es.IGNORE||this._isUpdateDueToCurrentTransition(e):!this._isTransitionEnabled(e)||e.transitionInterpolator.arePropsEqual(t,e))}},{key:"_triggerTransition",value:function(t,e){tT(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 tR(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(eu,"defaultProps",ec);var el=n(840),eh=n.n(el);const ep={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)}}(eh().PointerEventInput),eh().MouseInput.prototype.handler=function(t){let e=ep[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 ef=eh().Manager;var ed=eh();const ev=ed?[[ed.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[ed.Rotate,{enable:!1}],[ed.Pinch,{enable:!1}],[ed.Swipe,{enable:!1}],[ed.Pan,{threshold:0,enable:!1}],[ed.Press,{enable:!1}],[ed.Tap,{event:"doubletap",taps:2,enable:!1}],[ed.Tap,{event:"anytap",enable:!1}],[ed.Tap,{enable:!1}]]:null,eg={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},em={doubletap:["tap"]},eb={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},ey={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},ew={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"},eO={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},eE="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",e_="undefined"!=typeof window?window:n.g;void 0!==n.g?n.g:window;let eP=!1;try{const t={get passive(){return eP=!0,!0}};e_.addEventListener("test",t,t),e_.removeEventListener("test",t,t)}catch(t){}const eM=-1!==eE.indexOf("firefox"),{WHEEL_EVENTS:ej}=ey,eS="wheel";class eT{constructor(t,e,n={}){this.element=t,this.callback=e,this.options=Object.assign({enable:!0},n),this.events=ej.concat(n.events||[]),this.handleEvent=this.handleEvent.bind(this),this.events.forEach(e=>t.addEventListener(e,this.handleEvent,!!eP&&{passive:!1}))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===eS&&(this.options.enable=e)}handleEvent(t){if(!this.options.enable)return;let e=t.deltaY;e_.WheelEvent&&(eM&&t.deltaMode===e_.WheelEvent.DOM_DELTA_PIXEL&&(e/=e_.devicePixelRatio),t.deltaMode===e_.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:eS,center:n,delta:e,srcEvent:t,pointerType:"mouse",target:t.target})}}const{MOUSE_EVENTS:ek}=ey,ex="pointermove",eD="pointerover",eC="pointerout",eR="pointerleave";class eA{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=ek.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===ex&&(this.enableMoveEvent=e),t===eD&&(this.enableOverEvent=e),t===eC&&(this.enableOutEvent=e),t===eR&&(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:eD,srcEvent:t,pointerType:"mouse",target:t.target})}handleOutEvent(t){this.enableOutEvent&&"mouseout"===t.type&&this.callback({type:eC,srcEvent:t,pointerType:"mouse",target:t.target})}handleLeaveEvent(t){this.enableLeaveEvent&&"mouseleave"===t.type&&this.callback({type:eR,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:ex,srcEvent:t,pointerType:"mouse",target:t.target});break;case"mouseup":this.pressed=!1}}}const{KEY_EVENTS:eI}=ey,eL="keydown",eN="keyup";class ez{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=eI.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===eL&&(this.enableDownEvent=e),t===eN&&(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:eL,srcEvent:t,key:t.key,target:t.target}),this.enableUpEvent&&"keyup"===t.type&&this.callback({type:eN,srcEvent:t,key:t.key,target:t.target}))}}const eF="contextmenu";class eV{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===eF&&(this.options.enable=e)}handleEvent(t){this.options.enable&&this.callback({type:eF,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})}}const eZ={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},eB={srcElement:"root",priority:0};class eU{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({},eB,n):eB;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 t=r.get(o.srcElement);t.splice(t.indexOf(o),1),0===t.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 e=!1;const r=()=>{t.handled=!0},i=()=>{t.handled=!0,e=!0},o=[];for(let a=0;a{const e=this.manager.get(t);e&&eg[t].forEach(t=>{e.recognizeWith(t)})}),e.recognizerOptions){const t=this.manager.get(r);if(t){const n=e.recognizerOptions[r];delete n.enable,t.set(n)}}for(const[n,r]of(this.wheelInput=new eT(t,this._onOtherEvent,{enable:!1}),this.moveInput=new eA(t,this._onOtherEvent,{enable:!1}),this.keyInput=new ez(t,this._onOtherEvent,{enable:!1,tabIndex:e.tabIndex}),this.contextmenuInput=new eV(t,this._onOtherEvent,{enable:!1}),this.events))r.isEmpty()||(this._toggleRecognizer(r.recognizerName,!0),this.manager.on(n,r.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=em[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:o,events:a}=this,s=eO[t]||t;let c=a.get(s);!c&&(c=new eU(this),a.set(s,c),c.recognizerName=ew[s]||s,o&&o.on(s,c.handleEvent)),c.add(t,e,n,r,i),c.isEmpty()||this._toggleRecognizer(c.recognizerName,!0)}_removeEventHandler(t,e){if("string"!=typeof t){for(const e in t)this._removeEventHandler(e,t[e]);return}const{events:n}=this,r=eO[t]||t,i=n.get(r);if(i&&(i.remove(t,e),i.isEmpty())){const{recognizerName:t}=i;let e=!1;for(const r of n.values())if(r.recognizerName===t&&!r.isEmpty()){e=!0;break}e||this._toggleRecognizer(t,!1)}}_onBasicInput(t){const{srcEvent:e}=t,n=eb[e.type];n&&this.manager.emit(n,t)}_onOtherEvent(t){this.manager.emit(t.type,t)}}function eH(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 eX(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&&nt.call(this,"onMouseEnter",t),s&&nt.call(this,"onMouseLeave",t),(a||s)&&this.setState({isHovering:o})}}function ni(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=e9.call(this,t)).features=e7.call(this,t.point),a.forEach(function(e){return e(t)}))}var no=(0,h.forwardRef)(function(t,e){var n,a,s=(0,h.useContext)(tL),c=(0,h.useMemo)(function(){return t.controller||new e5},[]),u=(0,h.useMemo)(function(){return new eW(null,{touchAction:t.touchAction,recognizerOptions:t.eventRecognizerOptions})},[]),l=(0,h.useRef)(null),p=(0,h.useRef)(null),f=(0,h.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=e3(e3({},f.state),e),l.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,tF(f.map,t)]}}),o&&o({viewState:t,interactionState:e,oldViewState:r}),a&&a(t,e,r)};(0,h.useImperativeHandle)(e,function(){return{getMap:p.current&&p.current.getMap,queryRenderedFeatures:p.current&&p.current.queryRenderedFeatures}},[]);var g=(0,h.useMemo)(function(){return e3(e3({},s),{},{eventManager:u,container:s.container||l.current})},[s,l.current]);g.onViewportChange=v,g.viewport=s.viewport||tU(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&&c.setOptions(e3(e3(e3({},f.props),f.props.viewState),{},{isInteractive:!!(f.props.onViewStateChange||f.props.onViewportChange),onViewportChange:v,onStateChange:m,eventManager:u,width:f.width,height:f.height}))};(0,h.useEffect)(function(){return u.setElement(l.current),u.on({pointerdown:ne.bind(f),pointermove:nr.bind(f),pointerup:nn.bind(f),pointerleave:nt.bind(f,"onMouseOut"),click:ni.bind(f),anyclick:ni.bind(f),dblclick:nt.bind(f,"onDblClick"),wheel:nt.bind(f,"onWheel"),contextmenu:nt.bind(f,"onContextMenu")}),function(){u.destroy()}},[]),tz(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 y=t.width,w=t.height,O=t.style,E=t.getCursor,_=(0,h.useMemo)(function(){return e3(e3({position:"relative"},O),{},{width:y,height:w,cursor:E(f.state)})},[O,y,w,E,f.state]);return n&&f._child||(f._child=h.createElement(tN,{value:g},h.createElement("div",{key:"event-canvas",ref:l,style:_},h.createElement(tY,r({},t,{width:"100%",height:"100%",style:null,onResize:function(t){var e=t.width,n=t.height;f.width=e,f.height=n,b(),f.props.onResize({width:e,height:n})},ref:p}))))),d=!1,f._child});no.supported=tY.supported,no.propTypes=e8,no.defaultProps=e6;var na=no;p.string.isRequired,p.string,p.oneOf(["fill","line","symbol","circle","fill-extrusion","raster","background","heatmap","hillshade","sky"]).isRequired,p.string,p.string,p.string;var ns={captureScroll:!1,captureDrag:!0,captureClick:!0,captureDoubleClick:!0,capturePointerMove:!1},nc={captureScroll:p.bool,captureDrag:p.bool,captureClick:p.bool,captureDoubleClick:p.bool,capturePointerMove:p.bool};function nu(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,h.useContext)(tL),n=(0,h.useRef)(null),r=(0,h.useRef)({props:t,state:{},context:e,containerRef:n}).current;return r.props=t,r.context=e,(0,h.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 nl(t){var e=t.instance,n=nu(t),r=n.context,i=n.containerRef;return e._context=r,e._containerRef=i,e._render()}var nh=function(t){tQ(i,t);var e,n=(e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}(),function(){var t,n=t2(i);return t=e?Reflect.construct(n,arguments,t2(this).constructor):n.apply(this,arguments),t1(this,t)});function i(){var t;tc(this,i);for(var e=arguments.length,r=Array(e),o=0;o2&&void 0!==arguments[2]?arguments[2]:"x";if(null===t)return e;var r="x"===n?t.offsetWidth:t.offsetHeight;return nw(e/100*r)/r*100};function nE(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 n_=Object.assign({},nd,{className:p.string,longitude:p.number.isRequired,latitude:p.number.isRequired,style:p.object}),nP=Object.assign({},nv,{className:""});function nM(t){var e,n,r,i,o,s,c,u=(n=(e=f((0,h.useState)(null),2))[0],r=e[1],o=(i=f((0,h.useState)(null),2))[0],s=i[1],(c=nu(nf(nf({},t),{},{onDragStart:nb}))).callbacks=t,c.state.dragPos=n,c.state.setDragPos=r,c.state.dragOffset=o,c.state.setDragOffset=s,(0,h.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=ng(t);i.setDragPos(a);var s=i.dragOffset;if(r.onDrag&&s){var c=Object.assign({},t);c.lngLat=nm(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=nm(a,s,n,o),r.onDragEnd(c)}}(e,t)},pancancel:function(e){var n;return n=t.state,void(e.stopPropagation(),n.setDragPos(null),n.setDragOffset(null))}};return e.watch(n),function(){e.off(n)}}}(c)},[c.context.eventManager,!!n]),c),l=u.state,p=u.containerRef,d=t.children,v=t.className,g=t.draggable,m=t.style,b=l.dragPos,y=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,l=r.viewport,h=r.map;if(c&&u)return[c[0]+u[0],c[1]+u[1]];var p=tF(h,{longitude:i,latitude:o}),d=f(l.project([i,o,p]),2),v=d[0],g=d[1];return[v+=a,g+=s]}(u),w=f(y,2),O=w[0],E=w[1],_="translate(".concat(nw(O),"px, ").concat(nw(E),"px)"),P=g?b?"grabbing":"grab":"auto",M=(0,h.useMemo)(function(){var t=function(t){for(var e=1;e0){var g=p,m=v;for(p=0;p<=1;p+=.5)d=(f=n-p*a)+a,(v=Math.max(0,u-f)+Math.max(0,d-i+u))0){var E=h,_=O;for(h=0;h<=1;h+=b)w=(y=e-h*o)+o,(O=Math.max(0,u-y)+Math.max(0,w-r+u))<_&&(_=O,E=h);h=E}return nS.find(function(t){var e=nj[t];return e.x===h&&e.y===p})||s}({x:r,y:i,anchor:o,padding:s,width:S.width,height:S.height,selfWidth:e.clientWidth,selfHeight:e.clientHeight}):o),z=(c=M.current,l=(u=f(L,3))[0],p=u[1],d=u[2],v=t.offsetLeft,g=t.offsetTop,m=t.sortByDepth,y=nO(c,-(100*(b=nj[N]).x)),w=nO(c,-(100*b.y),"y"),O={position:"absolute",transform:"\n translate(".concat(y,"%, ").concat(w,"%)\n translate(").concat(nw(l+v),"px, ").concat(nw(p+g),"px)\n "),display:void 0,zIndex:void 0},m&&(d>1||d<-1||l<0||l>S.width||p<0||p>S.height?O.display="none":O.zIndex=Math.floor((1-d)/2*1e5)),O),F=(0,h.useCallback)(function(t){_.props.onClose();var e=_.context.eventManager;e&&e.once("click",function(t){return t.stopPropagation()},t.target)},[]);return h.createElement("div",{className:"mapboxgl-popup mapboxgl-popup-anchor-".concat(N," ").concat(k),style:z,ref:M},h.createElement("div",{key:"tip",className:"mapboxgl-popup-tip",style:{borderWidth:C}}),h.createElement("div",{key:"content",ref:E,className:"mapboxgl-popup-content"},R&&h.createElement("button",{key:"close-button",className:"mapboxgl-popup-close-button",type:"button",onClick:F},"×"),A))}function nD(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}nx.propTypes=nT,nx.defaultProps=nk,h.memo(nx);var nC=Object.assign({},nc,{toggleLabel:p.string,className:p.string,style:p.object,compact:p.bool,customAttribution:p.oneOfType([p.string,p.arrayOf(p.string)])}),nR=Object.assign({},ns,{className:"",toggleLabel:"Toggle Attribution"});function nA(t){var e=nu(t),n=e.context,r=e.containerRef,i=(0,h.useRef)(null),o=f((0,h.useState)(!1),2),s=o[0],c=o[1];(0,h.useEffect)(function(){var e,o,a,s,c,u;return n.map&&(o={customAttribution:t.customAttribution},a=n.map,s=r.current,c=i.current,(u=new(tP()).AttributionControl(o))._map=a,u._container=s,u._innerContainer=c,u._updateAttributions(),u._updateEditLink(),a.on("styledata",u._updateData),a.on("sourcedata",u._updateData),e=u),function(){var t;return e&&void((t=e)._map.off("styledata",t._updateData),t._map.off("sourcedata",t._updateData))}},[n.map]);var u=void 0===t.compact?n.viewport.width<=640:t.compact;(0,h.useEffect)(function(){!u&&s&&c(!1)},[u]);var l=(0,h.useCallback)(function(){return c(function(t){return!t})},[]),p=(0,h.useMemo)(function(){return function(t){for(var e=1;ea)return 1}return 0}(o.map.version,"1.6.0")>=0?2:1:2},[o.map]),n=o.viewport.bearing,r={transform:"rotate(".concat(-n,"deg)")},2===e?h.createElement("span",{className:"mapboxgl-ctrl-icon","aria-hidden":"true",style:r}):h.createElement("span",{className:"mapboxgl-ctrl-compass-arrow",style:r})))))}function n$(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}nG.propTypes=nH,nG.defaultProps=nX,h.memo(nG);var nJ=Object.assign({},nc,{className:p.string,style:p.object,maxWidth:p.number,unit:p.oneOf(["imperial","metric","nautical"])}),nQ=Object.assign({},ns,{className:"",maxWidth:100,unit:"metric"});function n0(t){var e=nu(t),n=e.context,r=e.containerRef,i=f((0,h.useState)(null),2),o=i[0],s=i[1];(0,h.useEffect)(function(){if(n.map){var t=new(tP()).ScaleControl;t._map=n.map,t._container=r.current,s(t)}},[n.map]),o&&(o.options=t,o._onMove());var c=(0,h.useMemo)(function(){return function(t){for(var e=1;e"; for(var svgNode = reusableSVGContainer.firstChild; node.firstChild;)node.removeChild(node.firstChild); for(; svgNode.firstChild;)node.appendChild(svgNode.firstChild); @@ -3490,7 +3487,7 @@ function getListenerSetKey(domEventName, capture) { return domEventName + "__" + (capture ? "capture" : "bubble"); } - var didWarnInvalidHydration = !1, DANGEROUSLY_SET_INNER_HTML = "dangerouslySetInnerHTML", SUPPRESS_CONTENT_EDITABLE_WARNING = "suppressContentEditableWarning", SUPPRESS_HYDRATION_WARNING = "suppressHydrationWarning", AUTOFOCUS = "autoFocus", CHILDREN = "children", STYLE = "style", HTML$1 = "__html", HTML_NAMESPACE$1 = Namespaces.html; + var didWarnInvalidHydration = !1, DANGEROUSLY_SET_INNER_HTML = "dangerouslySetInnerHTML", SUPPRESS_CONTENT_EDITABLE_WARNING = "suppressContentEditableWarning", SUPPRESS_HYDRATION_WARNING = "suppressHydrationWarning", AUTOFOCUS = "autoFocus", CHILDREN = "children", STYLE = "style", HTML$1 = "__html"; warnedUnknownTags = { dialog: !0, webview: !0 @@ -3567,7 +3564,7 @@ }, warnForInvalidEventListener = function(registrationName, listener) { !1 === listener ? error("Expected `%s` listener to be a function, instead got `false`.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.", registrationName, registrationName, registrationName) : error("Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener); }, normalizeHTML = function(parent, html) { - var testElement = parent.namespaceURI === HTML_NAMESPACE$1 ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName); + var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName); return testElement.innerHTML = html, testElement.innerHTML; }; var validateDOMNesting = function() {}, updatedAncestorInfo = function() {}, specialTags = [ @@ -6869,7 +6866,7 @@ }(domElement, propKey, nextProp, propertyInfo); else { var ownNamespace = parentNamespace; - if (ownNamespace === HTML_NAMESPACE$1 && (ownNamespace = getIntrinsicNamespace(tag)), ownNamespace === HTML_NAMESPACE$1) extraAttributeNames.delete(propKey.toLowerCase()); + if (ownNamespace === HTML_NAMESPACE && (ownNamespace = getIntrinsicNamespace(tag)), ownNamespace === HTML_NAMESPACE) extraAttributeNames.delete(propKey.toLowerCase()); else { var standardName = function(propName) { var lowerCasedName = propName.toLowerCase(); @@ -6906,7 +6903,7 @@ } var domElement = function(type, props, rootContainerElement, parentNamespace) { var isCustomComponentTag, domElement, ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement), namespaceURI = parentNamespace; - if (namespaceURI === HTML_NAMESPACE$1 && (namespaceURI = getIntrinsicNamespace(type)), namespaceURI === HTML_NAMESPACE$1) { + if (namespaceURI === HTML_NAMESPACE && (namespaceURI = getIntrinsicNamespace(type)), namespaceURI === HTML_NAMESPACE) { if ((isCustomComponentTag = isCustomComponent(type, props)) || type === type.toLowerCase() || error("<%s /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.", type), "script" === type) { var div = ownerDocument.createElement("div"); div.innerHTML = ""; @@ -6920,7 +6917,7 @@ props.multiple ? node.multiple = !0 : props.size && (node.size = props.size); } } else domElement = ownerDocument.createElementNS(namespaceURI, type); - return namespaceURI !== HTML_NAMESPACE$1 || isCustomComponentTag || "[object HTMLUnknownElement]" !== Object.prototype.toString.call(domElement) || Object.prototype.hasOwnProperty.call(warnedUnknownTags, type) || (warnedUnknownTags[type] = !0, error("The tag <%s> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.", type)), domElement; + return namespaceURI !== HTML_NAMESPACE || isCustomComponentTag || "[object HTMLUnknownElement]" !== Object.prototype.toString.call(domElement) || Object.prototype.hasOwnProperty.call(warnedUnknownTags, type) || (warnedUnknownTags[type] = !0, error("The tag <%s> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.", type)), domElement; }(type, props, rootContainerInstance, hostContext.namespace); return hostInst = internalInstanceHandle, domElement[internalInstanceKey] = hostInst, node = domElement, props1 = props, node[internalPropsKey] = props1, domElement; }(type, newProps, rootContainerInstance, currentHostContext, workInProgress); diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/direct_access_2/output.js b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/direct_access_2/output.js index e2f097c3f7a4..a27d2a54866c 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/direct_access_2/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/direct_access_2/output.js @@ -1,6 +1,3 @@ -var o = { - a: 1 -}; console.log(function(k) { - if (o["a"]) return "PASS"; + return "PASS"; }(0)); diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_1/output.js b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_1/output.js index bb477cb34f3f..e0601b97615b 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_1/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_1/output.js @@ -1,11 +1 @@ -var obj = { - foo: 1, - bar: 2, - square: function(x) { - return x * x; - }, - cube: function(x) { - return x * x * x; - } -}; -console.log(obj.foo, obj.cube(3)); +console.log(1, 27); diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_2/output.js b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_2/output.js index bb477cb34f3f..2366a3d4d52e 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_2/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_2/output.js @@ -1,11 +1,2 @@ -var obj = { - foo: 1, - bar: 2, - square: function(x) { - return x * x; - }, - cube: function(x) { - return x * x * x; - } -}; -console.log(obj.foo, obj.cube(3)); +var x; +console.log(1, 3 * (x = 3) * x); diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_3/output.js b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_3/output.js index bb477cb34f3f..e0601b97615b 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_3/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2377_3/output.js @@ -1,11 +1 @@ -var obj = { - foo: 1, - bar: 2, - square: function(x) { - return x * x; - }, - cube: function(x) { - return x * x * x; - } -}; -console.log(obj.foo, obj.cube(3)); +console.log(1, 27); diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2473_4/output.js b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2473_4/output.js index 4b95e7646056..b7fb6e1dc228 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2473_4/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2473_4/output.js @@ -1,5 +1,3 @@ -(function () { - var o_a = 1, - o_b = 2; - console.log(o_a, o_b); +(function() { + console.log(1, 2); })(); diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2519/output.js b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2519/output.js index 8a2d2842d8ef..ca2d0be9f154 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2519/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_2519/output.js @@ -1,4 +1,4 @@ function testFunc() { - return 1 * ((6 + 5) / 2); + return 5.5; } console.log(testFunc()); diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_851_hoist_to_conflicting_name/output.js b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_851_hoist_to_conflicting_name/output.js index 7f6e09e2b9da..5371ed66c46f 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_851_hoist_to_conflicting_name/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/issue_851_hoist_to_conflicting_name/output.js @@ -1,5 +1 @@ -const BBB_CCC$0 = "PASS"; -if (id(true)) { - const BBB_CCC = BBB_CCC$0; - console.log(BBB_CCC); -} +if (id(true)) console.log("PASS"); diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_1/output.js b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_1/output.js index 6ec03b73076a..847e9e058e14 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_1/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_1/output.js @@ -1,11 +1,4 @@ -var obj_foo = 1; var obj_bar = 2; -function f() { - var obj_foo$0 = 3, - obj_bar$0 = 4, - obj_b_r = 5, - obj_b_r$0 = 6, - obj_b_r$1 = 7; - console.log(obj_foo, obj_foo$0, obj_bar$0, obj_b_r, obj_b_r$0, obj_b_r$1); -} -f(); +(function() { + console.log(1, 3, 4, 5, 6, 7); +})(); diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_2/output.js b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_2/output.js index 710ebe162885..97b5b6830c44 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_2/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_2/output.js @@ -1,10 +1,6 @@ -var o_p = 1, - o__ = function (x) { - return x; - }, - o__$2 = function (x) { - return x + 1; - }, - o__$0 = 2, - o__$1 = 3; -console.log(o_p === o_p, o__(4), o__$2(5), o__$0, o__$1); +var o_p = 1; +console.log(true, function(x) { + return 4; +}(0), function(x) { + return 6; +}(0), 2, 3); diff --git a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_3/output.js b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_3/output.js index d91ad44456c1..f61ab7cee27a 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_3/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/hoist_props/name_collision_3/output.js @@ -1,10 +1,6 @@ -var o_p = 1, - o__ = function (x) { - return x; - }, - o__$2 = function (x) { - return x + 1; - }, - o__$0 = 2, - o__$1 = 3; -console.log(o_p === o_p, o__(4), o__$2(5)); +var o_p = 1, o__$0 = 2, o__$1 = 3; +console.log(true, function(x) { + return 4; +}(0), function(x) { + return 6; +}(0)); diff --git a/crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs b/crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs index 5254c74a17d7..8547f10f7717 100644 --- a/crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs +++ b/crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs @@ -331,7 +331,7 @@ where let var = self.data.var_or_default(obj.to_id()); match &*e.left { - Expr::Lit(Lit::Str(prop)) => { + Expr::Lit(Lit::Str(prop)) if prop.value.parse::().is_err() => { var.add_accessed_property(prop.value.clone()); } @@ -457,11 +457,11 @@ where Expr::Ident(Ident { sym, .. }) if *sym == *"eval" => { self.scope.mark_eval_called(); } - Expr::Member(m) => for_each_id_ref_in_expr(&m.obj, &mut |id| { - self.data - .var_or_default(id.to_id()) - .mark_indexed_with_dynamic_key() - }), + Expr::Member(m) if !m.obj.is_ident() => { + for_each_id_ref_in_expr(&m.obj, &mut |id| { + self.data.var_or_default(id.to_id()).mark_used_as_ref() + }) + } _ => {} } } @@ -917,8 +917,15 @@ where let v = self.data.var_or_default(obj.to_id()); v.mark_has_property_access(); - if let MemberProp::Computed(..) = e.prop { - v.mark_indexed_with_dynamic_key(); + if let MemberProp::Computed(prop) = &e.prop { + match &*prop.expr { + Expr::Lit(Lit::Str(s)) if s.value.parse::().is_err() => { + v.add_accessed_property(s.value.clone()); + } + _ => { + v.mark_indexed_with_dynamic_key(); + } + } } if let MemberProp::Ident(prop) = &e.prop {