1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="005e33b2-6a1a-bb06-76af-30edd551edef")}catch(e){}}(); 2(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([typeof document === "object" ? document.currentScript : undefined, 3171725, ((__turbopack_context__, module, exports) => { 4 5/* Mapbox GL JS is Copyright © 2020 Mapbox and subject to the Mapbox Terms of Service ((https://www.mapbox.com/legal/tos/). */ (function(global, factory) { 6 ("TURBOPACK compile-time truthy", 1) ? module.exports = factory() : "TURBOPACK unreachable"; 7})(/*TURBOPACK member replacement*/ __turbopack_context__.e, function() { 8 'use strict'; 9 let shared, worker, mapboxgl; 10 if (typeof self !== "undefined") self.__mapboxImport = (u)=>import(/* webpackIgnore: true */ /* @vite-ignore */ u); 11 function define(_, chunk) { 12 if (!shared) { 13 shared = chunk; 14 } else if (!worker) { 15 worker = chunk; 16 } else { 17 const sharedChunk = {}; 18 shared(void 0, sharedChunk); 19 mapboxgl = chunk(sharedChunk); 20 const workerBundleString = "self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; self.__mapboxImport = (u) => import(u); (" + shared + ")(undefined, sharedChunk); (" + worker + ")(undefined, sharedChunk); self.onerror = null;"; 21 if (typeof window !== "undefined" && window && window.URL && window.URL.createObjectURL) { 22 mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([ 23 workerBundleString 24 ], { 25 type: "text/javascript" 26 })); 27 } 28 } 29 } 30 define([ 31 "require", 32 "exports" 33 ], function(e1, t1) { 34 var i = "3.30.0", n = 1e-6, r = "undefined" != typeof Float32Array ? Float32Array : Array; 35 function o(e1, t1) { 36 var i = t1[0], n = t1[1], r = t1[2], o = t1[3], a = i * o - r * n; 37 return a ? (e1[0] = o * (a = 1 / a), e1[1] = -n * a, e1[2] = -r * a, e1[3] = i * a, e1) : null; 38 } 39 function a() { 40 var e1 = new r(9); 41 return r != Float32Array && (e1[1] = 0, e1[2] = 0, e1[3] = 0, e1[5] = 0, e1[6] = 0, e1[7] = 0), e1[0] = 1, e1[4] = 1, e1[8] = 1, e1; 42 } 43 function s(e1, t1, i) { 44 var n = t1[0], r = t1[1], o = t1[2], a = t1[3], s = t1[4], l = t1[5], c = t1[6], u = t1[7], h = t1[8], d = i[0], f = i[1], p = i[2], m = i[3], _ = i[4], g = i[5], y = i[6], x = i[7], v = i[8]; 45 return e1[0] = d * n + f * a + p * c, e1[1] = d * r + f * s + p * u, e1[2] = d * o + f * l + p * h, e1[3] = m * n + _ * a + g * c, e1[4] = m * r + _ * s + g * u, e1[5] = m * o + _ * l + g * h, e1[6] = y * n + x * a + v * c, e1[7] = y * r + x * s + v * u, e1[8] = y * o + x * l + v * h, e1; 46 } 47 function l(e1, t1) { 48 var i = Math.sin(t1), n = Math.cos(t1); 49 return e1[0] = n, e1[1] = i, e1[2] = 0, e1[3] = -i, e1[4] = n, e1[5] = 0, e1[6] = 0, e1[7] = 0, e1[8] = 1, e1; 50 } 51 function c() { 52 var e1 = new r(16); 53 return r != Float32Array && (e1[1] = 0, e1[2] = 0, e1[3] = 0, e1[4] = 0, e1[6] = 0, e1[7] = 0, e1[8] = 0, e1[9] = 0, e1[11] = 0, e1[12] = 0, e1[13] = 0, e1[14] = 0), e1[0] = 1, e1[5] = 1, e1[10] = 1, e1[15] = 1, e1; 54 } 55 function u(e1) { 56 var t1 = new r(16); 57 return t1[0] = e1[0], t1[1] = e1[1], t1[2] = e1[2], t1[3] = e1[3], t1[4] = e1[4], t1[5] = e1[5], t1[6] = e1[6], t1[7] = e1[7], t1[8] = e1[8], t1[9] = e1[9], t1[10] = e1[10], t1[11] = e1[11], t1[12] = e1[12], t1[13] = e1[13], t1[14] = e1[14], t1[15] = e1[15], t1; 58 } 59 function h(e1, t1) { 60 return e1[0] = t1[0], e1[1] = t1[1], e1[2] = t1[2], e1[3] = t1[3], e1[4] = t1[4], e1[5] = t1[5], e1[6] = t1[6], e1[7] = t1[7], e1[8] = t1[8], e1[9] = t1[9], e1[10] = t1[10], e1[11] = t1[11], e1[12] = t1[12], e1[13] = t1[13], e1[14] = t1[14], e1[15] = t1[15], e1; 61 } 62 function d(e1) { 63 return e1[0] = 1, e1[1] = 0, e1[2] = 0, e1[3] = 0, e1[4] = 0, e1[5] = 1, e1[6] = 0, e1[7] = 0, e1[8] = 0, e1[9] = 0, e1[10] = 1, e1[11] = 0, e1[12] = 0, e1[13] = 0, e1[14] = 0, e1[15] = 1, e1; 64 } 65 function f(e1, t1) { 66 if (e1 === t1) { 67 var i = t1[1], n = t1[2], r = t1[3], o = t1[6], a = t1[7], s = t1[11]; 68 e1[1] = t1[4], e1[2] = t1[8], e1[3] = t1[12], e1[4] = i, e1[6] = t1[9], e1[7] = t1[13], e1[8] = n, e1[9] = o, e1[11] = t1[14], e1[12] = r, e1[13] = a, e1[14] = s; 69 } else e1[0] = t1[0], e1[1] = t1[4], e1[2] = t1[8], e1[3] = t1[12], e1[4] = t1[1], e1[5] = t1[5], e1[6] = t1[9], e1[7] = t1[13], e1[8] = t1[2], e1[9] = t1[
vendor: 4,128 bytes, lines 69-92
696], e1[10] = t1[10], e1[11] = t1[14], e1[12] = t1[3], e1[13] = t1[7], e1[14] = t1[11], e1[15] = t1[15]; 70 return e1; 71 } 72 function p(e1, t1) { 73 var i = t1[0], n = t1[1], r = t1[2], o = t1[3], a = t1[4], s = t1[5], l = t1[6], c = t1[7], u = t1[8], h = t1[9], d = t1[10], f = t1[11], p = t1[12], m = t1[13], _ = t1[14], g = t1[15], y = i * s - n * a, x = i * l - r * a, v = i * c - o * a, b = n * l - r * s, w = n * c - o * s, A = r * c - o * l, E = u * m - h * p, I = u * _ - d * p, M = u * g - f * p, T = h * _ - d * m, S = h * g - f * m, z = d * g - f * _, R = y * z - x * S + v * T + b * M - w * I + A * E; 74 return R ? (e1[0] = (s * z - l * S + c * T) * (R = 1 / R), e1[1] = (r * S - n * z - o * T) * R, e1[2] = (m * A - _ * w + g * b) * R, e1[3] = (d * w - h * A - f * b) * R, e1[4] = (l * M - a * z - c * I) * R, e1[5] = (i * z - r * M + o * I) * R, e1[6] = (_ * v - p * A - g * x) * R, e1[7] = (u * A - d * v + f * x) * R, e1[8] = (a * S - s * M + c * E) * R, e1[9] = (n * M - i * S - o * E) * R, e1[10] = (p * w - m * v + g * y) * R, e1[11] = (h * v - u * w - f * y) * R, e1[12] = (s * I - a * T - l * E) * R, e1[13] = (i * T - n * I + r * E) * R, e1[14] = (m * x - p * b - _ * y) * R, e1[15] = (u * b - h * x + d * y) * R, e1) : null; 75 } 76 function m(e1, t1, i) { 77 var n = t1[0], r = t1[1], o = t1[2], a = t1[3], s = t1[4], l = t1[5], c = t1[6], u = t1[7], h = t1[8], d = t1[9], f = t1[10], p = t1[11], m = t1[12], _ = t1[13], g = t1[14], y = t1[15], x = i[0], v = i[1], b = i[2], w = i[3]; 78 return e1[0] = x * n + v * s + b * h + w * m, e1[1] = x * r + v * l + b * d + w * _, e1[2] = x * o + v * c + b * f + w * g, e1[3] = x * a + v * u + b * p + w * y, e1[4] = (x = i[4]) * n + (v = i[5]) * s + (b = i[6]) * h + (w = i[7]) * m, e1[5] = x * r + v * l + b * d + w * _, e1[6] = x * o + v * c + b * f + w * g, e1[7] = x * a + v * u + b * p + w * y, e1[8] = (x = i[8]) * n + (v = i[9]) * s + (b = i[10]) * h + (w = i[11]) * m, e1[9] = x * r + v * l + b * d + w * _, e1[10] = x * o + v * c + b * f + w * g, e1[11] = x * a + v * u + b * p + w * y, e1[12] = (x = i[12]) * n + (v = i[13]) * s + (b = i[14]) * h + (w = i[15]) * m, e1[13] = x * r + v * l + b * d + w * _, e1[14] = x * o + v * c + b * f + w * g, e1[15] = x * a + v * u + b * p + w * y, e1; 79 } 80 function _(e1, t1, i) { 81 var n, r, o, a, s, l, c, u, h, d, f, p, m = i[0], _ = i[1], g = i[2]; 82 return t1 === e1 ? (e1[12] = t1[0] * m + t1[4] * _ + t1[8] * g + t1[12], e1[13] = t1[1] * m + t1[5] * _ + t1[9] * g + t1[13], e1[14] = t1[2] * m + t1[6] * _ + t1[10] * g + t1[14], e1[15] = t1[3] * m + t1[7] * _ + t1[11] * g + t1[15]) : (r = t1[1], o = t1[2], a = t1[3], s = t1[4], l = t1[5], c = t1[6], u = t1[7], h = t1[8], d = t1[9], f = t1[10], p = t1[11], e1[0] = n = t1[0], e1[1] = r, e1[2] = o, e1[3] = a, e1[4] = s, e1[5] = l, e1[6] = c, e1[7] = u, e1[8] = h, e1[9] = d, e1[10] = f, e1[11] = p, e1[12] = n * m + s * _ + h * g + t1[12], e1[13] = r * m + l * _ + d * g + t1[13], e1[14] = o * m + c * _ + f * g + t1[14], e1[15] = a * m + u * _ + p * g + t1[15]), e1; 83 } 84 function g(e1, t1, i) { 85 var n = i[0], r = i[1], o = i[2]; 86 return e1[0] = t1[0] * n, e1[1] = t1[1] * n, e1[2] = t1[2] * n, e1[3] = t1[3] * n, e1[4] = t1[4] * r, e1[5] = t1[5] * r, e1[6] = t1[6] * r, e1[7] = t1[7] * r, e1[8] = t1[8] * o, e1[9] = t1[9] * o, e1[10] = t1[10] * o, e1[11] = t1[11] * o, e1[12] = t1[12], e1[13] = t1[13], e1[14] = t1[14], e1[15] = t1[15], e1; 87 } 88 function y(e1, t1, i) { 89 var n = Math.sin(i), r = Math.cos(i), o = t1[4], a = t1[5], s = t1[6], l = t1[7], c = t1[8], u = t1[9], h = t1[10], d = t1[11]; 90 return t1 !== e1 && (e1[0] = t1[0], e1[1] = t1[1], e1[2] = t1[2], e1[3] = t1[3], e1[12] = t1[12], e1[13] = t1[13], e1[14] = t1[14], e1[15] = t1[15]), e1[4] = o * r + c * n, e1[5] = a * r + u * n, e1[6] = s * r + h * n, e1[7] = l * r + d * n, e1[8] = c * r - o * n, e1[9] = u * r - a * n, e1[10] = h * r - s * n, e1[11] = d * r - l * n, e1; 91 } 92 function x(e1, t1, i) {
93 var n = Math.sin(i), r = Math.cos(i), o = t1[0], a = t1[1], s = t1[2], l = t1[3], c = t1[8], u = t1[9], h = t1[10], d = t1[11]; 94 return t1 !== e1 && (e1[4] = t1[4], e1[5] = t1[5], e1[6] = t1[6], e1[7] = t1[7], e1[12] = t1[12], e1[13] = t1[13], e1[14] = t1[14], e1[15] = t1[15]), e1[0] = o * r - c * n, e1[1] = a * r - u * n, e1[2] = s * r - h * n, e1[3] = l * r - d * n, e1[8] = o * n + c * r, e1[9] = a * n + u * r, e1[10] = s * n + h * r, e1[11] = l * n + d * r, e1; 95 } 96 function v(e1, t1, i) { 97 var n = Math.sin(i), r = Math.cos(i), o = t1[0], a = t1[1], s = t1[2], l = t1[3], c = t1[4], u = t1[5], h = t1[6], d = t1[7]; 98 return t1 !== e1 && (e1[8] = t1[8], e1[9] = t1[9], e1[10] = t1[10], e1[11] = t1[11], e1[12] = t1[12], e1[13] = t1[13], e1[14] = t1[14], e1[15] = t1[15]), e1[0] = o * r + c * n, e1[1] = a * r + u * n, e1[2] = s * r + h * n, e1[3] = l * r + d * n, e1[4] = c * r - o * n, e1[5] = u * r - a * n, e1[6] = h * r - s * n, e1[7] = d * r - l * n, e1; 99 } 100 function b(e1, t1) { 101 return e1[0] = 1, e1[1] = 0, e1[2] = 0, e1[3] = 0, e1[4] = 0, e1[5] = 1, e1[6] = 0, e1[7] = 0, e1[8] = 0, e1[9] = 0, e1[10] = 1, e1[11] = 0, e1[12] = t1[0], e1[13] = t1[1], e1[14] = t1[2], e1[15] = 1, e1; 102 } 103 function w(e1, t1) { 104 return e1[0] = t1[0], e1[1] = 0, e1[2] = 0, e1[3] = 0, e1[4] = 0, e1[5] = t1[1], e1[6] = 0, e1[7] = 0, e1[8] = 0, e1[9] = 0, e1[10] = t1[2], e1[11] = 0, e1[12] = 0, e1[13] = 0, e1[14] = 0, e1[15] = 1, e1; 105 } 106 function A(e1, t1, i) { 107 var r, o, a, s = i[0], l = i[1], c = i[2], u = Math.sqrt(s * s + l * l + c * c); 108 return u < n ? null : (s *= u = 1 / u, l *= u, c *= u, r = Math.sin(t1), o = Math.cos(t1), e1[0] = s * s * (a = 1 - o) + o, e1[1] = l * s * a + c * r, e1[2] = c * s * a - l * r, e1[3] = 0, e1[4] = s * l * a - c * r, e1[5] = l * l * a + o, e1[6] = c * l * a + s * r, e1[7] = 0, e1[8] = s * c * a + l * r, e1[9] = l * c * a - s * r, e1[10] = c * c * a + o, e1[11] = 0, e1[12] = 0, e1[13] = 0, e1[14] = 0, e1[15] = 1, e1); 109 } 110 function E(e1, t1) { 111 var i = t1[0], n = t1[1], r = t1[2], o = t1[4], a = t1[5], s = t1[6], l = t1[8], c = t1[9], u = t1[10]; 112 return e1[0] = Math.sqrt(i * i + n * n + r * r), e1[1] = Math.sqrt(o * o + a * a + s * s), e1[2] = Math.sqrt(l * l + c * c + u * u), e1; 113 } 114 function I(e1, t1) { 115 var i = new r(3); 116 E(i, t1); 117 var n = 1 / i[0], o = 1 / i[1], a = 1 / i[2], s = t1[0] * n, l = t1[1] * o, c = t1[2] * a, u = t1[4] * n, h = t1[5] * o, d = t1[6] * a, f = t1[8] * n, p = t1[9] * o, m = t1[10] * a, _ = s + h + m, g = 0; 118 return _ > 0 ? (g = 2 * Math.sqrt(_ + 1), e1[3] = .25 * g, e1[0] = (d - p) / g, e1[1] = (f - c) / g, e1[2] = (l - u) / g) : s > h && s > m ? (g = 2 * Math.sqrt(1 + s - h - m), e1[3] = (d - p) / g, e1[0] = .25 * g, e1[1] = (l + u) / g, e1[2] = (f + c) / g) : h > m ? (g = 2 * Math.sqrt(1 + h - s - m), e1[3] = (f - c) / g, e1[0] = (l + u) / g, e1[1] = .25 * g, e1[2] = (d + p) / g) : (g = 2 * Math.sqrt(1 + m - s - h), e1[3] = (l - u) / g, e1[0] = (f + c) / g, e1[1] = (d + p) / g, e1[2] = .25 * g), e1; 119 } 120 function M(e1, t1) { 121 var i = t1[0], n = t1[1], r = t1[2], o = t1[3], a = i + i, s = n + n, l = r + r, c = i * a, u = n * a, h = n * s, d = r * a, f = r * s, p = r * l, m = o * a, _ = o * s, g = o * l; 122 return e1[0] = 1 - h - p, e1[1] = u + g, e1[2] = d - _, e1[3] = 0, e1[4] = u - g, e1[5] = 1 - c - p, e1[6] = f + m, e1[7] = 0, e1[8] = d + _, e1[9] = f - m, e1[10] = 1 - c - h, e1[11] = 0, e1[12] = 0, e1[13] = 0, e1[14] = 0, e1[15] = 1, e1; 123 } 124 var T = function(e1, t1, i, n, r) { 125 var o = 1 / Math.tan(t1 / 2); 126 if (e1[0] = o / i, e1[1] = 0, e1[2] = 0, e1[3] = 0, e1[4] = 0, e1[5] = o, e1[6] = 0, e1[7] = 0, e1[8] = 0, e1[9] = 0, e1[11] = -1, e1[12] = 0, e1[13] = 0, e1[15] = 0, null != r && r !== 1 / 0) { 127 var a = 1 / (n - r); 128 e1[10] = (r + n) * a, e1[14] = 2 * r * n * a; 129 } else e1[10] = -1, e1[14] = -2 * n; 130 return e1; 131 }, S = function(e1, t1, i, n, r, o, a) { 132 var s = 1 / (t1 - i), l = 1 / (n - r), c = 1 / (o - a); 133 return e1[0] = -2 * s, e1[1] = 0, e1[2] = 0, e1[3] = 0, e1[4] = 0, e1[5] = -2 * l, e1[6] = 0, e1[7] = 0, e1[8] = 0, e1[9] = 0, e1[10] = 2 * c, e1[
13311] = 0, e1[12] = (t1 + i) * s, e1[13] = (r + n) * l, e1[14] = (a + o) * c, e1[15] = 1, e1; 134 }, z = m; 135 function R() { 136 var e1 = new r(3); 137 return r != Float32Array && (e1[0] = 0, e1[1] = 0, e1[2] = 0), e1; 138 } 139 function P(e1) { 140 var t1 = new r(3); 141 return t1[0] = e1[0], t1[1] = e1[1], t1[2] = e1[2], t1; 142 } 143 function D(e1) { 144 var t1 = e1[0], i = e1[1], n = e1[2]; 145 return Math.sqrt(t1 * t1 + i * i + n * n); 146 } 147 function F(e1, t1, i) { 148 var n = new r(3); 149 return n[0] = e1, n[1] = t1, n[2] = i, n; 150 } 151 function C(e1, t1, i, n) { 152 return e1[0] = t1, e1[1] = i, e1[2] = n, e1; 153 } 154 function L(e1, t1, i) { 155 return e1[0] = t1[0] + i[0], e1[1] = t1[1] + i[1], e1[2] = t1[2] + i[2], e1; 156 } 157 function O(e1, t1, i) { 158 return e1[0] = t1[0] - i[0], e1[1] = t1[1] - i[1], e1[2] = t1[2] - i[2], e1; 159 } 160 function B(e1, t1, i) { 161 return e1[0] = t1[0] * i[0], e1[1] = t1[1] * i[1], e1[2] = t1[2] * i[2], e1; 162 } 163 function V(e1, t1, i) { 164 return e1[0] = Math.min(t1[0], i[0]), e1[1] = Math.min(t1[1], i[1]), e1[2] = Math.min(t1[2], i[2]), e1; 165 } 166 function N(e1, t1, i) { 167 return e1[0] = Math.max(t1[0], i[0]), e1[1] = Math.max(t1[1], i[1]), e1[2] = Math.max(t1[2], i[2]), e1; 168 } 169 function k(e1, t1, i) { 170 return e1[0] = t1[0] * i, e1[1] = t1[1] * i, e1[2] = t1[2] * i, e1; 171 } 172 function U(e1, t1, i, n) { 173 return e1[0] = t1[0] + i[0] * n, e1[1] = t1[1] + i[1] * n, e1[2] = t1[2] + i[2] * n, e1; 174 } 175 function j(e1, t1) { 176 var i = t1[0] - e1[0], n = t1[1] - e1[1], r = t1[2] - e1[2]; 177 return Math.sqrt(i * i + n * n + r * r); 178 } 179 function G(e1, t1) { 180 var i = t1[0] - e1[0], n = t1[1] - e1[1], r = t1[2] - e1[2]; 181 return i * i + n * n + r * r; 182 } 183 function H(e1) { 184 var t1 = e1[0], i = e1[1], n = e1[2]; 185 return t1 * t1 + i * i + n * n; 186 } 187 function $(e1, t1) { 188 return e1[0] = -t1[0], e1[1] = -t1[1], e1[2] = -t1[2], e1; 189 } 190 function Z(e1, t1) { 191 var i = t1[0], n = t1[1], r = t1[2], o = i * i + n * n + r * r; 192 return o > 0 && (o = 1 / Math.sqrt(o)), e1[0] = t1[0] * o, e1[1] = t1[1] * o, e1[2] = t1[2] * o, e1; 193 } 194 function W(e1, t1) { 195 return e1[0] * t1[0] + e1[1] * t1[1] + e1[2] * t1[2]; 196 } 197 function q(e1, t1, i) { 198 var n = t1[0], r = t1[1], o = t1[2], a = i[0], s = i[1], l = i[2]; 199 return e1[0] = r * l - o * s, e1[1] = o * a - n * l, e1[2] = n * s - r * a, e1; 200 } 201 function X(e1, t1, i, n) { 202 var r = t1[0], o = t1[1], a = t1[2]; 203 return e1[0] = r + n * (i[0] - r), e1[1] = o + n * (i[1] - o), e1[2] = a + n * (i[2] - a), e1; 204 } 205 function Y(e1, t1, i) { 206 var n = t1[0], r = t1[1], o = t1[2], a = i[3] * n + i[7] * r + i[11] * o + i[15];
207 return e1[0] = (i[0] * n + i[4] * r + i[8] * o + i[12]) / (a = a || 1), e1[1] = (i[1] * n + i[5] * r + i[9] * o + i[13]) / a, e1[2] = (i[2] * n + i[6] * r + i[10] * o + i[14]) / a, e1; 208 } 209 function J(e1, t1, i) { 210 var n = t1[0], r = t1[1], o = t1[2]; 211 return e1[0] = n * i[0] + r * i[3] + o * i[6], e1[1] = n * i[1] + r * i[4] + o * i[7], e1[2] = n * i[2] + r * i[5] + o * i[8], e1; 212 } 213 function K(e1, t1, i) { 214 var n = i[0], r = i[1], o = i[2], a = i[3], s = t1[0], l = t1[1], c = t1[2], u = r * c - o * l, h = o * s - n * c, d = n * l - r * s; 215 return e1[0] = s + a * (u += u) + r * (d += d) - o * (h += h), e1[1] = l + a * h + o * u - n * d, e1[2] = c + a * d + n * h - r * u, e1; 216 } 217 function Q(e1) { 218 return e1[0] = 0, e1[1] = 0, e1[2] = 0, e1; 219 } 220 function ee(e1, t1) { 221 return e1[0] === t1[0] && e1[1] === t1[1] && e1[2] === t1[2]; 222 } 223 var te = O, ie = B, ne = D; 224 function re() { 225 var e1 = new r(4); 226 return r != Float32Array && (e1[0] = 0, e1[1] = 0, e1[2] = 0, e1[3] = 0), e1; 227 } 228 function oe(e1, t1, i, n) { 229 var o = new r(4); 230 return o[0] = e1, o[1] = t1, o[2] = i, o[3] = n, o; 231 } 232 function ae(e1, t1, i) { 233 return e1[0] = t1[0] * i, e1[1] = t1[1] * i, e1[2] = t1[2] * i, e1[3] = t1[3] * i, e1; 234 } 235 function se(e1, t1) { 236 var i = t1[0], n = t1[1], r = t1[2], o = t1[3], a = i * i + n * n + r * r + o * o; 237 return a > 0 && (a = 1 / Math.sqrt(a)), e1[0] = i * a, e1[1] = n * a, e1[2] = r * a, e1[3] = o * a, e1; 238 } 239 function le(e1, t1, i) { 240 var n = t1[0], r = t1[1], o = t1[2], a = t1[3];
241 return e1[0] = i[0] * n + i[4] * r + i[8] * o + i[12] * a, e1[1] = i[1] * n + i[5] * r + i[9] * o + i[13] * a, e1[2] = i[2] * n + i[6] * r + i[10] * o + i[14] * a, e1[3] = i[3] * n + i[7] * r + i[11] * o + i[15] * a, e1; 242 } 243 function ce() { 244 var e1 = new r(4); 245 return r != Float32Array && (e1[0] = 0, e1[1] = 0, e1[2] = 0), e1[3] = 1, e1; 246 } 247 function ue(e1) { 248 return e1[0] = 0, e1[1] = 0, e1[2] = 0, e1[3] = 1, e1; 249 } 250 function he(e1, t1) { 251 var i = 2 * Math.acos(t1[3]), r = Math.sin(i / 2); 252 return r > n ? (e1[0] = t1[0] / r, e1[1] = t1[1] / r, e1[2] = t1[2] / r) : (e1[0] = 1, e1[1] = 0, e1[2] = 0), i; 253 } 254 function de(e1, t1, i) { 255 i *= .5; 256 var n = t1[0], r = t1[1], o = t1[2], a = t1[3], s = Math.sin(i), l = Math.cos(i); 257 return e1[0] = n * l + a * s, e1[1] = r * l + o * s, e1[2] = o * l - r * s, e1[3] = a * l - n * s, e1; 258 } 259 function fe(e1, t1, i) { 260 i *= .5; 261 var n = t1[0], r = t1[1], o = t1[2], a = t1[3], s = Math.sin(i), l = Math.cos(i); 262 return e1[0] = n * l - o * s, e1[1] = r * l + a * s, e1[2] = o * l + n * s, e1[3] = a * l - r * s, e1; 263 } 264 function pe(e1, t1, i) { 265 i *= .5; 266 var n = t1[0], r = t1[1], o = t1[2], a = t1[3], s = Math.sin(i), l = Math.cos(i); 267 return e1[0] = n * l + r * s, e1[1] = r * l - n * s, e1[2] = o * l + a * s, e1[3] = a * l - o * s, e1; 268 } 269 R(), re(); 270 var me, _e, ge, ye = se, xe = (me = R(), _e = F(1, 0, 0), ge = F(0, 1, 0), function(e1, t1, i) { 271 var n = W(t1, i); 272 return n < -.999999 ? (q(me, _e, t1), ne(me) < 1e-6 && q(me, ge, t1), Z(me, me), function(e1, t1, i) { 273 i *= .5; 274 var n = Math.sin(i); 275 e1[0] = n * t1[0], e1[1] = n * t1[1], e1[2] = n * t1[2], e1[3] = Math.cos(i); 276 }(e1, me, Math.PI), e1) : n > .999999 ? (e1[0] = 0, e1[1] = 0, e1[2] = 0, e1[3] = 1, e1) : (q(me, t1, i), e1[0] = me[0], e1[
2761] = me[1], e1[2] = me[2], e1[3] = 1 + n, ye(e1, e1)); 277 }); 278 function ve() { 279 var e1 = new r(2); 280 return r != Float32Array && (e1[0] = 0, e1[1] = 0), e1; 281 } 282 function be(e1, t1) { 283 var i = new r(2); 284 return i[0] = e1, i[1] = t1, i; 285 } 286 function we(e1, t1, i) { 287 return e1[0] = t1, e1[1] = i, e1; 288 } 289 function Ae(e1, t1, i) { 290 return e1[0] = t1[0] + i[0], e1[1] = t1[1] + i[1], e1; 291 } 292 function Ee(e1, t1, i) { 293 return e1[0] = t1[0] - i[0], e1[1] = t1[1] - i[1], e1; 294 } 295 function Ie(e1, t1, i) { 296 return e1[0] = t1[0] * i, e1[1] = t1[1] * i, e1; 297 } 298 function Me(e1) { 299 var t1 = e1[0], i = e1[1]; 300 return Math.sqrt(t1 * t1 + i * i); 301 } 302 function Te(e1, t1) { 303 var i = t1[0], n = t1[1], r = i * i + n * n; 304 return r > 0 && (r = 1 / Math.sqrt(r)), e1[0] = t1[0] * r, e1[1] = t1[1] * r, e1; 305 } 306 function Se(e1, t1) { 307 return e1[0] * t1[0] + e1[1] * t1[1]; 308 } 309 ce(), ce(), a(); 310 var ze = Ee; 311 function Re(e1, t1, i, n) { 312 const r = 3 * e1, o = 3 * (i - e1) - r, a = 1 - r - o, s = 3 * t1, l = 3 * (n - t1) - s, c = 1 - s - l; 313 return function(e1) { 314 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e-6; 315 if (e1 <= 0) return 0; 316 if (e1 >= 1) return 1; 317 let i = e1; 318 for(let n = 0; n < 8; n++){ 319 const n = ((a * i + o) * i + r) * i - e1; 320 if (Math.abs(n) < t1) return ((c * i + l) * i + s) * i; 321 const u = (3 * a * i + 2 * o) * i + r; 322 if (Math.abs(u) < 1e-6) break; 323 i -= n / u; 324 } 325 let n = 0, u = 1; 326 i = e1; 327 for(let s = 0; s < 20; s++){ 328 const s = ((a * i + o) * i + r) * i; 329 if (Math.abs(s - e1) < t1) break; 330 e1 > s ? n = i : u = i, i = .5 * (n + u); 331 } 332 return ((c * i + l) * i + s) * i; 333 }; 334 } 335 function Pe(e1, t1) { 336 this.x = e1, this.y = t1; 337 } 338 function De(e1, t1) { 339 if (Array.isArray(e1)) { 340 if (!Array.isArray(t1) || e1.length !== t1.length) return !1; 341 for(let i = 0; i < e1.length; i++)if (!De(e1[i], t1[i])) return !1; 342 return !0; 343 } 344 if ("object" == typeof e1 && null !== e1 && null !== t1) { 345 if ("object" != typeof t1) return !1; 346 const i = e1, n = t1; 347 if (Object.keys(i).length !== Object.keys(n).length) return !1; 348 for(const e1 in i)if (!De(i[e1], n[e1])) return !1; 349 return !0; 350 } 351 return e1 === t1; 352 } 353 function Fe(e1, t1) { 354 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : e1.length - 1, r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : Le; 355 for(; n > i;){ 356 if (n - i > 600) { 357 const o = n - i + 1, a = t1 - i + 1, s = Math.log(o), l = .5 * Math.exp(2 * s / 3), c = .5 * Math.sqrt(s * l * (o - l) / o) * (a - o / 2 < 0 ? -1 : 1); 358 Fe(e1, t1, Math.max(i, Math.floor(t1 - a * l / o + c)), Math.min(n, Math.floor(t1 + (o - a) * l / o + c)), r); 359 } 360 const o = e1[t1]; 361 let a = i, s = n; 362 for(Ce(e1, i, t1), r(e1[n], o) > 0 && Ce(e1, i, n); a < s;){ 363 for(Ce(e1, a, s), a++, s--; r(e1[a], o) < 0;)a++; 364 for(; r(e1[s], o) > 0;)s--; 365 } 366 0 === r(e1[i], o) ? Ce(e1, i, s) : (s++, Ce(e1, s, n)), s <= t1 && (i = s + 1), t1 <= s && (n = s - 1); 367 } 368 } 369 function Ce(e1, t1, i) { 370 const n = e1[t1]; 371 e1[t1] = e1[i], e1[i] = n; 372 } 373 function Le(e1, t1) { 374 return e1 < t1 ? -1 : e1 > t1 ? 1 : 0; 375 } 376 function Oe(e1) { 377 let t1 = 0; 378 for(let i, n, r = 0, o = e1.length, a = o - 1; r < o; a = r++)i = e1[r], n = e1[a], t1 += (n.x - i.x) * (i.y + n.y); 379 return t1; 380 } 381 function Be(e1, t1) { 382 return t1.area - e1.area; 383 } 384 function Ve(e1) { 385 const t1 = e1.length; 386 if (t1 < 3) return !0; 387 const i = e1[0]; 388 let n = 0, r = 0, o = 1; 389 for(;
389 o < t1 && (n = e1[o].x - i.x, r = e1[o].y - i.y, 0 === n && 0 === r); o++); 390 if (o === t1) return !0; 391 for(; o < t1; o++)if (n * (e1[o].y - i.y) - r * (e1[o].x - i.x) !== 0) return !1; 392 return !0; 393 } 394 function Ne(e1, t1) { 395 const i = e1.length, n = []; 396 let r, o; 397 for(let t1 = 0; t1 < i; t1++){ 398 const i = Oe(e1[t1]); 399 0 === i && Ve(e1[t1]) || (e1[t1].area = Math.abs(i), void 0 === o && (o = i < 0), o === i < 0 ? (r && n.push(r), r = [ 400 e1[t1] 401 ]) : r.push(e1[t1])); 402 } 403 if (r && n.push(r), t1 > 1) for(let e1 = 0; e1 < n.length; e1++){ 404 const i = n[e1]; 405 i.length <= t1 || (Fe(i, t1, 1, i.length - 1, Be), n[e1] = i.slice(0, t1)); 406 } 407 return n; 408 } 409 function ke(e1, t1) { 410 e1[0] = Math.min(e1[0], t1[0]), e1[1] = Math.min(e1[1], t1[1]), e1[2] = Math.max(e1[2], t1[0]), e1[3] = Math.max(e1[3], t1[1]); 411 } 412 function Ue(e1, t1) { 413 return !(e1[0] <= t1[0] || e1[2] >= t1[2] || e1[1] <= t1[1] || e1[3] >= t1[3]); 414 } 415 function je(e1, t1, i) { 416 const n = e1[0] - t1[0], r = e1[1] - t1[1], o = e1[0] - i[0], a = e1[1] - i[1]; 417 return n * a - o * r === 0 && n * o <= 0 && r * a <= 0; 418 } 419 function Ge(e1, t1, i) { 420 return t1[1] > e1[1] != i[1] > e1[1] && e1[0] < (i[0] - t1[0]) * (e1[1] - t1[1]) / (i[1] - t1[1]) + t1[0]; 421 } 422 function He(e1, t1) { 423 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 424 let n = !1; 425 for(let r = 0, o = t1.length; r < o; r++){ 426 const o = t1[r]; 427 for(let t1 = 0, r = o.length, a = r - 1; t1 < r; a = t1++){ 428 const r = o[a], s = o[t1]; 429 if (je(e1, r, s)) return i; 430 Ge(e1, r, s) && (n = !n); 431 } 432 } 433 return n; 434 } 435 function $e(e1, t1, i, n) { 436 const r = n[0] - i[0], o = n[1] - i[1], a = (e1[0] - i[0]) * o - r * (e1[1] - i[1]), s = (t1[0] - i[0]) * o - r * (t1[1] - i[1]); 437 return a > 0 && s < 0 || a < 0 && s > 0; 438 } 439 function Ze(e1, t1, i, n) { 440 return 0 !== (r = [ 441 n[0] - i[0], 442 n[1] - i[1] 443 ])[0] * (o = [ 444 t1[0] - e1[0], 445 t1[1] - e1[1] 446 ])[1] - r[1] * o[0] && !(!$e(e1, t1, i, n) || !$e(i, n, e1, t1)); 447 //TURBOPACK unreachable 448 ; 449 var r, o; 450 } 451 function We(e1) { 452 const t1 = new Pe(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY), i = new Pe(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY); 453 for (const n of e1[0])t1.x > n.x && (t1.x = n.x), t1.y > n.y && (t1.y = n.y), i.x < n.x && (i.x = n.x), i.y < n.y && (i.y = n.y); 454 return { 455 min: t1, 456 max: i 457 }; 458 } 459 ve(), Pe.prototype = { 460 clone () { 461 return new Pe(this.x, this.y); 462 }, 463 add (e1) { 464 return this.clone()._add(e1); 465 }, 466 sub (e1) { 467 return this.clone()._sub(e1); 468 }, 469 multByPoint (e1) { 470 return this.clone()._multByPoint(e1); 471 }, 472 divByPoint (e1) { 473 return this.clone()._divByPoint(e1); 474 }, 475 mult (e1) { 476 return this.clone()._mult(e1); 477 }, 478 div (e1) { 479 return this.clone()._div(e1); 480 }, 481 rotate (e1) { 482 return this.clone()._rotate(e1); 483 }, 484 rotateAround (e1, t1) { 485 return this.clone()._rotateAround(e1, t1); 486 }, 487 matMult (e1) { 488 return this.clone()._matMult(e1); 489 }, 490 unit () { 491 return this.clone()._unit(); 492 }, 493 perp () { 494 return this.clone()._perp(); 495 }, 496 round () { 497 return this.clone()._round(); 498 }, 499 mag () { 500 return Math.sqrt(this.x * this.x + this.y * this.y); 501 }, 502 equals (e1) { 503 return this.x === e1.x && this.y === e1.y; 504 }, 505 dist (e1) { 506 return Math.sqrt(this.distSqr(e1)); 507 }, 508 distSqr (e1) { 509 const t1 = e1.x - this.x, i = e1.y - this.y; 510 return t1 * t1 + i * i; 511 }, 512 angle () { 513 return Math.atan2(this.y, this.x); 514 }, 515 angleTo (e1) {
516 return Math.atan2(this.y - e1.y, this.x - e1.x); 517 }, 518 angleWith (e1) { 519 return this.angleWithSep(e1.x, e1.y); 520 }, 521 angleWithSep (e1, t1) { 522 return Math.atan2(this.x * t1 - this.y * e1, this.x * e1 + this.y * t1); 523 }, 524 _matMult (e1) { 525 const t1 = e1[2] * this.x + e1[3] * this.y; 526 return this.x = e1[0] * this.x + e1[1] * this.y, this.y = t1, this; 527 }, 528 _add (e1) { 529 return this.x += e1.x, this.y += e1.y, this; 530 }, 531 _sub (e1) { 532 return this.x -= e1.x, this.y -= e1.y, this; 533 }, 534 _mult (e1) { 535 return this.x *= e1, this.y *= e1, this; 536 }, 537 _div (e1) { 538 return this.x /= e1, this.y /= e1, this; 539 }, 540 _multByPoint (e1) { 541 return this.x *= e1.x, this.y *= e1.y, this; 542 }, 543 _divByPoint (e1) { 544 return this.x /= e1.x, this.y /= e1.y, this; 545 }, 546 _unit () { 547 return this._div(this.mag()), this; 548 }, 549 _perp () { 550 const e1 = this.y; 551 return this.y = this.x, this.x = -e1, this; 552 }, 553 _rotate (e1) { 554 const t1 = Math.cos(e1), i = Math.sin(e1), n = i * this.x + t1 * this.y; 555 return this.x = t1 * this.x - i * this.y, this.y = n, this; 556 }, 557 _rotateAround (e1, t1) { 558 const i = Math.cos(e1), n = Math.sin(e1), r = t1.y + n * (this.x - t1.x) + i * (this.y - t1.y); 559 return this.x = t1.x + i * (this.x - t1.x) - n * (this.y - t1.y), this.y = r, this; 560 }, 561 _round () { 562 return this.x = Math.round(this.x), this.y = Math.round(this.y), this; 563 }, 564 constructor: Pe 565 }, Pe.convert = function(e1) { 566 if (e1 instanceof Pe) return e1; 567 if (Array.isArray(e1)) return new Pe(+e1[0], +e1[1]); 568 if (void 0 !== e1.x && void 0 !== e1.y) return new Pe(+e1.x, +e1.y); 569 throw new Error("Expected [x, y] or {x, y} point format"); 570 }; 571 const qe = Math.PI / 180, Xe = 180 / Math.PI, Ye = /^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; 572 function Je(e1) { 573 return e1 * qe; 574 } 575 function Ke(e1) { 576 return e1 * Xe; 577 } 578 const Qe = [ 579 [ 580 0, 581 0 582 ], 583 [ 584 1, 585 0 586 ], 587 [ 588 1, 589 1 590 ], 591 [ 592 0, 593 1 594 ] 595 ]; 596 function et(e1) { 597 if (e1 <= 0) return 0; 598 if (e1 >= 1) return 1; 599 const t1 = e1 * e1, i = t1 * e1; 600 return 4 * (e1 < .5 ? i : 3 * (e1 - t1) + i - .75); 601 } 602 const tt = Re(.25, .1, .25, 1); 603 function it(e1, t1, i) { 604 return Math.min(i, Math.max(t1, e1)); 605 } 606 function nt(e1, t1, i) { 607 return (i = it((i - e1) / (t1 - e1), 0, 1)) * i * (3 - 2 * i); 608 } 609 function rt(e1, t1, i) { 610 const n = i - t1, r = ((e1 - t1) % n + n) % n + t1; 611 return r === t1 ? i : r; 612 } 613 function ot(e1, t1, i) { 614 if (!e1.length) return i(null, []); 615 let n = e1.length; 616 const r = new Array(e1.length); 617 let o = null; 618 e1.forEach((e1, a)=>{ 619 t1(e1, (e1, t1)=>{ 620 e1 && (o = e1), r[a] = t1, 0 === --n && i(o, r); 621 }); 622 }); 623 } 624 function at(e1, t1) { 625 const i = {}; 626 for(let n = 0; n < t1.length; n++){ 627 const r = t1[n]; 628 r in e1 && (i[r] = e1[r]); 629 } 630 return i; 631 } 632 let st = 1; 633 function lt() { 634 return function e1(t1) { 635 return t1 ? (t1 ^ Math.random() * (16 >> t1 / 4)).toString(16) : ([ 636 1e7 637 ] + -[ 638 1e3 639 ] + -4e3 + -8e3 + -1e11).replace(/[018]/g, e1); 640 }(); 641 } 642 function ct(e1) { 643 return e1 <= 1 ? 1 : Math.pow(2, Math.ceil(Math.log2(e1))); 644 } 645 function ut(e1) { 646 return !!e1 && Ye.test(e1); 647 } 648 function ht(e1, t1) {
649 e1.forEach((e1)=>{ 650 t1[e1] && (t1[e1] = t1[e1].bind(t1)); 651 }); 652 } 653 function dt(e1, t1, i) { 654 const n = {}; 655 for(const i in e1)n[i] = t1.call(this, e1[i], i, e1); 656 return n; 657 } 658 function ft(e1, t1, i) { 659 const n = {}; 660 for(const i in e1)t1.call(this, e1[i], i, e1) && (n[i] = e1[i]); 661 return n; 662 } 663 function pt(e1) { 664 return Array.isArray(e1) ? e1.map(pt) : "object" == typeof e1 && e1 ? dt(e1, pt) : e1; 665 } 666 function mt(e1, t1) { 667 for(let i = 0; i < e1.length; i++)if (t1.includes(e1[i])) return !0; 668 return !1; 669 } 670 const _t = {}; 671 function gt(e1) { 672 _t[e1] || ("undefined" != typeof console && console.warn(e1), _t[e1] = !0); 673 } 674 function yt(e1, t1, i) { 675 return (i.y - e1.y) * (t1.x - e1.x) > (t1.y - e1.y) * (i.x - e1.x); 676 } 677 function xt(param) { 678 let [e1, t1, i] = param; 679 const n = Je(t1 + 90), r = Je(i); 680 return { 681 x: e1 * Math.cos(n) * Math.sin(r), 682 y: e1 * Math.sin(n) * Math.sin(r), 683 z: e1 * Math.cos(r), 684 azimuthal: t1, 685 polar: i 686 }; 687 } 688 function vt(e1, t1, i) { 689 const n = Math.sqrt(e1 * e1 + t1 * t1 + i * i), r = n > 0 ? Math.acos(i / n) * Xe : 0; 690 let o = 0 !== e1 || 0 !== t1 ? Math.atan2(-t1, -e1) * Xe + 90 : 0; 691 return o < 0 && (o += 360), [ 692 n, 693 o, 694 r 695 ]; 696 } 697 function bt(e1) { 698 return ("undefined" != typeof self || void 0 !== e1) && "undefined" != typeof WorkerGlobalScope && (void 0 !== e1 ? e1 : self) instanceof WorkerGlobalScope; 699 } 700 function wt(e1) { 701 const t1 = {}; 702 if (e1.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, (e1, i, n, r)=>{ 703 const o = n || r; 704 return t1[i] = !o || o.toLowerCase(), ""; 705 }), t1["max-age"]) { 706 const e1 = parseInt(t1["max-age"], 10); 707 isNaN(e1) ? delete t1["max-age"] : t1["max-age"] = e1; 708 } 709 return t1; 710 } 711 function At(e1) { 712 return e1 ? { 713 cacheControl: e1.get("cache-control"), 714 expires: e1.get("expires") 715 } : { 716 cacheControl: void 0, 717 expires: void 0 718 }; 719 } 720 function Et(e1) { 721 try { 722 const t1 = self[e1]; 723 return t1.setItem("_mapbox_test_", 1), t1.removeItem("_mapbox_test_"), !0; 724 } catch (e1) { 725 return !1; 726 } 727 } 728 function It(e1, t1) { 729 return [ 730 e1[4 * t1], 731 e1[4 * t1 + 1], 732 e1[4 * t1 + 2], 733 e1[4 * t1 + 3] 734 ]; 735 } 736 function Mt(e1, t1, i) { 737 e1[4 * t1 + 0] = i[0], e1[4 * t1 + 1] = i[1], e1[4 * t1 + 2] = i[2], e1[4 * t1 + 3] = i[3]; 738 } 739 function Tt(e1) { 740 return [ 741 Math.pow(e1[0], 1 / 2.2), 742 Math.pow(e1[1], 1 / 2.2), 743 Math.pow(e1[2], 1 / 2.2) 744 ]; 745 } 746 function St(e1) { 747 return e1 > 0 ? 1 / (1.001 - e1) : 1 + e1; 748 } 749 function zt(e1) { 750 return e1 > 0 ? 1 - 1 / (1.001 - e1) : -e1; 751 } 752 function Rt(e1, t1, i) { 753 return (e1 - t1.min) * (i.max - i.min) / (t1.max - t1.min) + i.min; 754 } 755 function Pt(e1) { 756 return e1 * e1 * e1 * e1 * e1; 757 } 758 function Dt(e1) { 759 return e1 >>>= 0, e1 = Math.imul(2747636419 ^ e1, 2654435769) >>> 0, e1 = Math.imul(e1 ^ e1 >>> 16, 2654435769) >>> 0, (e1 = Math.imul(e1 ^ e1 >>> 16, 2654435769) >>> 0) / 4294967296; 760 } 761 let Ft, Ct, Lt, Ot, Bt, Vt; 762 function Nt() { 763 return Ft !== null && Ft !== void 0 ? Ft : Ft = self.OffscreenCanvas && !!new OffscreenCanvas(1, 1).getContext("2d") && "function" == typeof self.createImageBitmap, Ft; 764 }
765 const kt = { 766 requestIdleCallback: (e1)=>{ 767 if ("undefined" != typeof requestIdleCallback) return requestIdleCallback(e1); 768 setTimeout(()=>e1({ 769 didTimeout: !1, 770 timeRemaining: ()=>50 771 }), 0); 772 }, 773 now: ()=>void 0 !== Ot ? Ot : performance.now(), 774 setNow (e1) { 775 Ot = e1; 776 }, 777 restoreNow () { 778 Ot = void 0; 779 }, 780 frame (e1) { 781 const t1 = requestAnimationFrame(e1); 782 return { 783 cancel: ()=>cancelAnimationFrame(t1) 784 }; 785 }, 786 getImageData (e1) { 787 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; 788 const { width: i, height: n } = e1; 789 Bt || (Bt = document.createElement("canvas")); 790 const r = Bt.getContext("2d", { 791 willReadFrequently: !0 792 }); 793 if (!r) throw new Error("failed to create canvas 2d context"); 794 return (i > Bt.width || n > Bt.height) && (Bt.width = i, Bt.height = n), r.clearRect(-t1, -t1, i + 2 * t1, n + 2 * t1), r.drawImage(e1, 0, 0, i, n), r.getImageData(-t1, -t1, i + 2 * t1, n + 2 * t1); 795 }, 796 resolveURL: (e1)=>(Ct || (Ct = document.createElement("a")), Ct.href = e1, Ct.href), 797 get devicePixelRatio () { 798 return window.devicePixelRatio; 799 }, 800 get prefersReducedMotion () { 801 return !!window.matchMedia && (Lt !== null && Lt !== void 0 ? Lt : Lt = window.matchMedia("(prefers-reduced-motion: reduce)"), Lt.matches); 802 }, 803 hasCanvasFingerprintNoise () { 804 if (void 0 !== Vt) return Vt; 805 if (!Nt()) return Vt = !1, !1; 806 const e1 = new OffscreenCanvas(85, 1), t1 = e1.getContext("2d", { 807 willReadFrequently: !0 808 }); 809 let i = 0; 810 for(let n = 0; n < e1.width; ++n)t1.fillStyle = "rgba(".concat(i++, ",").concat(i++, ",").concat(i++, ", 255)"), t1.fillRect(n, 0, 1, 1); 811 const n = t1.getImageData(0, 0, e1.width, e1.height); 812 i = 0; 813 for(let e1 = 0; e1 < n.data.length; ++e1)if (e1 % 4 != 3 && i++ !== n.data[e1]) return Vt = !0, !0; 814 return Vt = !1, !1; 815 } 816 }; 817 let Ut; 818 const jt = { 819 API_URL: "https://api.mapbox.com", 820 API_URL_REGEX: /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i, 821 API_TILEJSON_REGEX: /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i, 822 API_SPRITE_REGEX: /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i, 823 API_FONTS_REGEX: /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i, 824 API_STYLE_REGEX: /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i, 825 API_CDN_URL_REGEX: /^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i, 826 get EVENTS_URL () { 827 if (!jt.API_URL) return null; 828 try { 829 const e1 = new URL(jt.API_URL); 830 return "api.mapbox.cn" === e1.hostname ? "https://events.mapbox.cn/events/v2" : "api.mapbox.com" === e1.hostname ? "https://events.mapbox.com/events/v2" : null; 831 } catch (e1) { 832 return null; 833 } 834 }, 835 SESSION_PATH: "/map-sessions/v1", 836 FEEDBACK_URL: "https://apps.mapbox.com/feedback", 837 TILE_URL_VERSION: "v4", 838 RASTER_URL_PREFIX: "raster/v1", 839 RASTERARRAYS_URL_PREFIX: "rasterarrays/v1", 840 REQUIRE_ACCESS_TOKEN: !0, 841 ACCESS_TOKEN: null, 842 DEFAULT_STYLE: "mapbox://styles/mapbox/standard", 843 MAX_PARALLEL_IMAGE_REQUESTS: 16, 844 DRACO_URL: "/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm", 845 MESHOPT_URL: "/mapbox-gl-js/meshopt_base_v1.2.wasm", 846 MESHOPT_SIMD_URL: "/mapbox-gl-js/meshopt_simd_v1.2.wasm",
847 BUILDING_GEN_URL: "/mapbox-gl-js/building-gen/building_gen_v1.2.6.wasm", 848 GLYPHS_URL: "mapbox://fonts/mapbox/{fontstack}/{range}.pbf", 849 TILES3D_URL_PREFIX: "3dtiles/v1", 850 TILE_PROVIDER_URLS: Object.assign(Object.create(null), { 851 pmtiles: "/mapbox-gl-js/plugins/mapbox-gl-pmtiles-provider/v0.0.2/mapbox-gl-pmtiles-provider.js" 852 }) 853 }; 854 function Gt() { 855 return new URL(jt.DRACO_URL, jt.API_URL).href; 856 } 857 function Ht() { 858 if ("object" != typeof WebAssembly) throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer"); 859 return new URL(function() { 860 if (void 0 === Ut) { 861 if ("object" != typeof WebAssembly) return !1; 862 const e1 = new Uint8Array([ 863 0, 864 97, 865 115, 866 109, 867 1, 868 0, 869 0, 870 0, 871 1, 872 4, 873 1, 874 96, 875 0, 876 0, 877 3, 878 3, 879 2, 880 0, 881 0, 882 5, 883 3, 884 1, 885 0, 886 1, 887 12, 888 1, 889 0, 890 10, 891 22, 892 2, 893 12, 894 0, 895 65, 896 0, 897 65, 898 0, 899 65, 900 0, 901 252, 902 10, 903 0, 904 0, 905 11, 906 7, 907 0, 908 65, 909 0, 910 253, 911 15, 912 26, 913 11 914 ]); 915 Ut = WebAssembly.validate(e1); 916 } 917 return Ut; 918 }() ? jt.MESHOPT_SIMD_URL : jt.MESHOPT_URL, jt.API_URL).href; 919 } 920 function $t() { 921 return new URL(jt.BUILDING_GEN_URL, jt.API_URL).href; 922 } 923 function Zt(e1, t1) { 924 const i = e1.indexOf("?"), n = i < 0 ? e1 : e1.slice(0, i), r = new URLSearchParams(i < 0 ? "" : e1.slice(i)); 925 for (const [e1, i] of Object.entries(t1))r.set(e1, i); 926 return "".concat(n, "?").concat(r); 927 } 928 function Wt(e1) { 929 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
930 persistentParams: [] 931 }; 932 const i = e1.indexOf("?"); 933 if (i < 0) return e1; 934 const n = new URLSearchParams, r = new URLSearchParams(e1.slice(i)); 935 for (const e1 of t1.persistentParams){ 936 const t1 = r.get(e1); 937 t1 && n.set(e1, t1); 938 } 939 const o = n.toString(); 940 return "".concat(e1.slice(0, i)).concat(o.length > 0 ? "?".concat(o) : ""); 941 } 942 const qt = "mapbox-tiles"; 943 let Xt = 500, Yt = 50; 944 const Jt = [ 945 "language", 946 "worldview", 947 "jobid" 948 ]; 949 let Kt; 950 function Qt() { 951 try { 952 return caches; 953 } catch (e1) {} 954 } 955 function ei() { 956 const e1 = Qt(); 957 e1 && null == Kt && (Kt = e1.open(qt)); 958 } 959 let ti = 1 / 0; 960 function ii(e1) { 961 return jt.API_URL_REGEX.test(e1); 962 } 963 function ni(e1) { 964 return 0 === e1.indexOf("mapbox:"); 965 } 966 function ri(e1) { 967 return jt.API_CDN_URL_REGEX.test(e1); 968 } 969 function oi(e1) { 970 return jt.API_SPRITE_REGEX.test(e1); 971 } 972 function ai(e1) { 973 return jt.API_STYLE_REGEX.test(e1) && !oi(e1); 974 } 975 const si = { 976 Unknown: "Unknown", 977 Style: "Style", 978 Source: "Source", 979 Tile: "Tile", 980 Glyphs: "Glyphs", 981 SpriteImage: "SpriteImage", 982 SpriteJSON: "SpriteJSON", 983 Iconset: "Iconset", 984 Image: "Image", 985 Model: "Model" 986 }; 987 Object.freeze(si); 988 class li extends Error { 989 get message() { 990 return 401 === this.status && ii(this.url) ? "".concat(this.statusText, ": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/guides/#access-tokens-and-token-scopes") : this.statusText; 991 } 992 toString() { 993 return "".concat(this.name, ": ").concat(this.message, " (").concat(this.status, "): ").concat(this.url); 994 } 995 constructor(e1, t1, i){ 996 super(), this.url = i, this.statusText = e1, this.status = t1; 997 } 998 } 999 function ci(e1) { 1000 return "object" == typeof e1 && null !== e1 && "status" in e1 && 404 === e1.status; 1001 } 1002 const ui = bt() ? ()=>self.worker.referrer : ()=>("blob:" === location.protocol ? parent : self).location.href, hi = /^\w+:/, di = /[\r\n]+/; 1003 async function fi(e1, t1) { 1004 let i; 1005 return i = "arrayBuffer" === e1.type ? await t1.arrayBuffer() : "json" === e1.type ? await t1.json() : await t1.text(), { 1006 data: i, 1007 headers: t1.headers 1008 }; 1009 } 1010 async function pi(e1, t1) { 1011 return t1 && t1.throwIfAborted(), (i = e1.url).startsWith("file:") || ui().startsWith("file:") && !hi.test(i) ? async function(e1, t1) { 1012 return new Promise((i, n)=>{ 1013 const r = new XMLHttpRequest, o = ()=>{ 1014 t1.removeEventListener("abort", o), r.abort(), n(t1.reason); 1015 }; 1016 t1 && t1.addEventListener("abort", o), r.open(e1.method || "GET", e1.url, !0), "arrayBuffer" === e1.type && (r.responseType = "arraybuffer"); 1017 for(const t1 in e1.headers)r.setRequestHeader(t1, e1.headers[t1]); 1018 "json" === e1.type && (r.responseType = "text", r.setRequestHeader("Accept", "application/json")), r.withCredentials = "include" === e1.credentials, r.onerror = ()=>{ 1019 t1 && t1.removeEventListener("abort", o), n(new Error(r.statusText)); 1020 }, r.onload = ()=>{ 1021 if (t1 && t1.removeEventListener("abort", o), (r.status >= 200 && r.status < 300 || 0 === r.status) && null !== r.response) { 1022 let t1 = r.response; 1023 if ("json" === e1.type) try { 1024 t1 = JSON.parse(r.response); 1025 } catch (e1) { 1026 return void n(e1); 1027 } 1028 const o = new Headers; 1029 r.getAllResponseHeaders().trim().split(di).forEac
vendor: 1,290 bytes, lines 1029-1056
1029h((e1)=>{ 1030 const t1 = e1.split(": "), i = t1.shift(), n = t1.join(": "); 1031 i && o.set(i, n); 1032 }), i({ 1033 data: t1, 1034 headers: o 1035 }); 1036 } else n(new li(r.statusText, r.status, e1.url)); 1037 }, r.send(e1.body); 1038 }); 1039 }(e1, t1) : async function(e1, t1) { 1040 const i = new Request(e1.url, { 1041 method: e1.method || "GET", 1042 body: e1.body, 1043 credentials: e1.credentials, 1044 headers: e1.headers, 1045 referrer: ui(), 1046 referrerPolicy: e1.referrerPolicy, 1047 signal: t1 1048 }), n = (r = i.url).indexOf("sku=") > 0 && ii(r); 1049 var r; 1050 if ("json" === e1.type && i.headers.set("Accept", "application/json"), n) { 1051 let n = null; 1052 try { 1053 n = await async function(e1) { 1054 if (ei(), null == Kt) return null; 1055 const t1 = await Kt; 1056 let i = Wt(e1.url, {
1057 persistentParams: Jt 1058 }); 1059 const n = e1.headers.get("Range"); 1060 n && (i = Zt(i, { 1061 range: n 1062 })); 1063 const r = await t1.match(i); 1064 if (!r) return null; 1065 const o = function(e1) { 1066 if (!e1) return !1; 1067 const t1 = new Date(e1.headers.get("expires") || 0), i = wt(e1.headers.get("cache-control") || ""); 1068 return Number(t1) > Date.now() && !i["no-cache"]; 1069 }(r); 1070 return t1.delete(i).catch((e1)=>gt(e1.message)), o && t1.put(i, r.clone()).catch((e1)=>gt(e1.message)), { 1071 response: r, 1072 fresh: o 1073 }; 1074 }(i); 1075 } catch (e1) { 1076 "SecurityError" !== e1.message && gt(e1.toString()); 1077 } 1078 if (n && n.fresh) return t1 && t1.throwIfAborted(), fi(e1, n.response); 1079 } 1080 const o = Date.now(); 1081 let a; 1082 try { 1083 a = await fetch(i); 1084 } catch (t1) { 1085 if ("AbortError" === t1.name) throw t1; 1086 throw new Error("".concat(t1.message, " ").concat(e1.url), { 1087 cause: t1 1088 }); 1089 } 1090 if (t1 && t1.throwIfAborted(), !a.ok) throw new li(a.statusText, a.status, e1.url); 1091 const s = n ? a.clone() : null, l = await fi(e1, a); 1092 return s && async function(e1, t1, i) { 1093 if (ei(), null == Kt) return; 1094 const n = wt(t1.headers.get("cache-control") || ""); 1095 if (n["no-store"]) return; 1096 const r = { 1097 status: t1.status, 1098 statusText: t1.statusText, 1099 headers: new Headers(t1.headers) 1100 }; 1101 n["max-age"] && r.headers.set("Expires", new Date(i + 1e3 * n["max-age"]).toUTCString()); 1102 const o = r.headers.get("expires"); 1103 if (!o) return; 1104 if (new Date(o).getTime() - i < 42e4) return; 1105 let a = Wt(e1.url, {
1106 persistentParams: Jt 1107 }); 1108 if (206 === t1.status) { 1109 const t1 = e1.headers.get("Range"); 1110 if (!t1) return; 1111 r.status = 200, a = Zt(a, { 1112 range: t1 1113 }); 1114 } 1115 const s = new Response(200 !== (l = t1.status) && 404 !== l && [ 1116 101, 1117 103, 1118 204, 1119 205, 1120 304 1121 ].includes(l) ? null : t1.body, r); 1122 var l; 1123 if (ei(), null != Kt) try { 1124 const e1 = await Kt; 1125 await e1.put(a, s); 1126 } catch (e1) { 1127 gt(e1.message); 1128 } 1129 }(i, s, o), l; 1130 }(e1, t1); 1131 //TURBOPACK unreachable 1132 ; 1133 var i; 1134 } 1135 async function mi(e1, t1) { 1136 return pi(Object.assign(e1, { 1137 type: "json" 1138 }), t1); 1139 } 1140 async function _i(e1, t1) { 1141 return pi(Object.assign(e1, { 1142 type: "arrayBuffer" 1143 }), t1); 1144 } 1145 function gi(e1) { 1146 const t1 = document.createElement("a"); 1147 return t1.href = e1, t1.protocol === location.protocol && t1.host === location.host; 1148 } 1149 let yi, xi; 1150 yi = [], xi = 0; 1151 const vi = "01", bi = { 1152 create: "create", 1153 load: "load", 1154 fullLoad: "fullLoad" 1155 }, wi = { 1156 mark (e1) { 1157 performance.mark(e1); 1158 }, 1159 measure (e1, t1, i) { 1160 performance.measure(e1, t1, i); 1161 } 1162 }; 1163 function Ai(e1) { 1164 const t1 = e1.name.split("?")[0]; 1165 return ri(t1) && t1.includes("mapbox-gl.js") ? "javascript" : ri(t1) && t1.includes("mapbox-gl.css") ? "css" : function(e1) { 1166 return jt.API_FONTS_REGEX.test(e1); 1167 }(t1) ? "fontRange" : oi(t1) ? "sprite" : ai(t1) ? "style" : function(e1) { 1168 return jt.API_TILEJSON_REGEX.test(e1); 1169 }(t1) ? "tilejson" : "other"; 1170 } 1171 const Ei = /(\.(png|jpg)\d*)(?=$)/, Ii = /^.+\/v4\//, Mi = /\.[\w]+$/, Ti = /^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/, Si = /^access_token=(.*)$/, zi = "NO_ACCESS_TOKEN", Ri = /^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/; 1172 function Pi(e1) { 1173 const t1 = e1.match(Ri); 1174 if (!t1) throw new Error("Unable to parse URL object"); 1175 return { 1176 protocol: t1[1], 1177 authority: t1[2], 1178 path: t1[3] || "/", 1179 params: t1[4] ? t1[4].split("&") : [] 1180 }; 1181 } 1182 function Di(e1) { 1183 const t1 = e1.params.length ? "?".concat(e1.params.join("&")) : ""; 1184 return "".concat(e1.protocol, "://").concat(e1.authority).concat(e1.path).concat(t1); 1185 } 1186 const Fi = "mapbox.eventData"; 1187 function Ci(e1) { 1188 if (!e1) return null; 1189 const t1 = e1.split("."); 1190 if (!t1 || 3 !== t1.length) return null; 1191 try { 1192 return JSON.parse(decodeURIComponent(atob(t1[1]).split("").map((e1)=>"%" + ("00" + e1.charCodeAt(0).toString(16)).slice(-2)).join(""))); 1193 } catch (e1) { 1194 return null; 1195 } 1196 } 1197 function Li(e1) { 1198 return !(!jt.EVENTS_URL || !e1 && !jt.ACCESS_TOKEN); 1199 } 1200 let Oi; 1201 const Bi = /^[\w.+-]+(\/[\w.+-]+)?$/; 1202 let Vi = "other"; 1203 class Ni { 1204 getStorageKey(e1) { 1205 const t1 = Ci(jt.ACCESS_TOKEN); 1206 let i = ""; 1207 return i = t1 && t1.u ? btoa(encodeURIComponent(t1.u).replace(/%([0-9A-F]{2})/g, (e1, t1)=>String.fromCharCode(Number("0x" + t1)))) : jt.ACCESS_TOKEN || "", e1 ? "".concat(Fi, ".").concat(e1, ":").concat(i) : "".concat(Fi, ":").concat(i); 1208 } 1209 fetchEventData() {
1210 const e1 = Et("localStorage"), t1 = this.getStorageKey(), i = this.getStorageKey("uuid"), n = this.getStorageKey("uuidTimestamp"); 1211 if (e1) try { 1212 const e1 = localStorage.getItem(t1); 1213 e1 && (this.eventData = JSON.parse(e1)); 1214 const r = localStorage.getItem(i); 1215 r && (this.anonId = r); 1216 const o = localStorage.getItem(n); 1217 o && (this.anonIdTimestamp = Number(o)); 1218 const a = Date.now() - 864e5; 1219 (!this.anonIdTimestamp || this.anonIdTimestamp < a) && this.refreshUUID(); 1220 } catch (e1) { 1221 gt("Unable to read from LocalStorage"); 1222 } 1223 } 1224 refreshUUID() { 1225 this.anonId = lt(), this.anonIdTimestamp = Date.now(); 1226 } 1227 saveEventData() { 1228 const e1 = Et("localStorage"), t1 = this.getStorageKey(), i = this.getStorageKey("uuid"), n = this.getStorageKey("uuidTimestamp"), r = this.anonId, o = this.anonIdTimestamp; 1229 if (e1 && r) try { 1230 localStorage.setItem(i, r), Object.keys(this.eventData).length >= 1 && localStorage.setItem(t1, JSON.stringify(this.eventData)), o && localStorage.setItem(n, o.toString()); 1231 } catch (e1) { 1232 gt("Unable to write to LocalStorage"); 1233 } 1234 } 1235 processRequests() {} 1236 postEvent(e1, t1, i, n) { 1237 if (!jt.EVENTS_URL) return; 1238 const r = Pi(jt.EVENTS_URL); 1239 r.params.push("access_token=".concat(n || jt.ACCESS_TOKEN || "")); 1240 const o = { 1241 event: this.type, 1242 created: new Date(e1).toISOString() 1243 }, a = t1 ? Object.assign(o, t1) : o, s = { 1244 url: Di(r), 1245 headers: { 1246 "Content-Type": "text/plain" 1247 }, 1248 body: JSON.stringify([ 1249 a 1250 ]) 1251 }; 1252 this.pendingRequest = !0, (async function(e1) { 1253 return pi(Object.assign(e1, { 1254 method: "POST" 1255 }), void 0); 1256 })(s).then(()=>{ 1257 this.pendingRequest = !1, i(null), this.saveEventData(), this.processRequests(); 1258 }).catch((e1)=>{ 1259 this.pendingRequest = !1, i(e1), this.saveEventData(), this.processRequests(); 1260 }); 1261 } 1262 queueRequest(e1, t1) { 1263 this.queue.push({ 1264 ...e1, 1265 customAccessToken: t1 1266 }), this.processRequests(); 1267 } 1268 constructor(e1){ 1269 this.type = e1, this.anonId = null, this.anonIdTimestamp = null, this.eventData = {}, this.queue = [], this.pendingRequest = !1; 1270 } 1271 } 1272 class ki extends Ni { 1273 postMetricsEvent(e1) { 1274 if (!Li(e1)) return; 1275 this.anonId || this.fetchEventData(), ut(this.anonId) || this.refreshUUID(); 1276 const t1 = { 1277 ...this.data, 1278 sessionId: this.anonId 1279 }; 1280 this.queueRequest({ 1281 timestamp: Date.now(), 1282 payload: t1 1283 }, e1); 1284 } 1285 processRequests() { 1286 if (this.pendingRequest || 0 === this.queue.length) return; 1287 const { timestamp: e1, payload: t1, customAccessToken: i } = this.queue.shift(); 1288 this.postEvent(e1, t1, ()=>{}, i); 1289 } 1290 constructor(e1){ 1291 super("metrics"), e1 && (this.data = e1); 1292 } 1293 } 1294 const Ui = new class extends Ni { 1295 postTurnstileEvent(e1, t1) { 1296 Li(t1) && Array.isArray(e1) && e1.some((e1)=>ni(e1) || ii(e1)) && this.queueRequest({ 1297 timestamp: Date.now() 1298 }, t1); 1299 } 1300 processRequests() { 1301 if (this.pendingRequest || 0 === this.queue.length) return; 1302 this.anonId && this.anonIdTimestamp && this.eventData.lastSuccess && this.eventData.tokenU || this.fetchEventData(); 1303 const e1 = Ci(jt.ACCESS_TOKEN), t1 = e1 ? e1.u : jt.ACCESS_TOKEN; 1304 let n = t1 !== this.eventData.tokenU; 1305 ut(this.anonId) || (this.refreshUUID(), n = !0); 1306 const { timestamp: r, customAccessToken: o } = this.queue.shift(); 1307 if (this.eventData.lastSuccess) { 1308 const e1 = new Date(this.eventData.lastSuccess), t1 = new Date(r), i = (r - this.eventData.lastSuccess) / 864e5; 1309 n = n || i >= 1 || i < -1 || e1.getDate() !== t1.getDate(); 1310 } else n = !0; 1311 if (!n) return void this.processRequests(); 1312 const a = { 1313 version: "2.2", 1314 sdkIdentifier: "mapbox-gl-js", 1315 sdkVersion: i, 1316 skuId: vi, 1317 "enabled.telemetry": !1, 1318 userId: this.anonId, 1319 bundleFormat: "umd", 1320 bundleDistribution: Vi 1321 }; 1322 Oi && (a.sdkInfo = Oi), this.postEvent(r, a, (e1)=>{ 1323 e1 || (this.eventData.lastSuccess = r, this.eventData.tokenU = t1); 1324 }, o); 1325 } 1326 constructor(e1){ 1327 super("appUserTurnstile"), this._customAccessToken = e1; 1328 } 1329 }, ji = Ui.postTurnstileEvent.bind(Ui), Gi = new class extends Ni { 1330 postMapLoadEvent(e1, t1, i, n) { 1331 this.skuToken = t1, this.errorCb = n, jt.EVENTS_URL && (i || jt.ACCESS_TOKEN ? this.queueRequest({ 1332 id: e1, 1333 timestamp: Date.now() 1334 }, i) : this.errorCb(new Error(zi))); 1335 } 1336 processRequests() { 1337 if (this.pendingRequest || 0 === this.queue.length) return; 1338 const { id: e1, timestamp: t1, customAccessToken: n } = this.queue.shift(); 1339 if (e1 && this.success[e1]) return; 1340 this.anonId && this.anonIdTimestamp || this.fetchEventData(), ut(this.anonId) || this.refreshUUID(); 1341 const r = { 1342 version: "2.2", 1343 sdkIdentifier: "mapbox-gl-js", 1344 sdkVersion: i, 1345 skuId: vi, 1346 skuToken: this.skuToken, 1347 userId: this.anonId, 1348 bundleFormat: "umd", 1349 bundleDistribution: Vi 1350 }; 1351 Oi && (r.sdkInfo = Oi), this.postEvent(t1, r, (t1)=>{ 1352 t1 ? this.errorCb(t1) : e1 && (this.success[e1] = !0); 1353 }, n); 1354 } 1355 remove() { 1356 this.errorCb = null; 1357 } 1358 constructor(){ 1359 super("map.load"), this.success = {}, this.skuToken = ""; 1360 } 1361 }, Hi = Gi.postMapLoadEvent.bind(Gi), $i = new class extends Ni { 1362 getMapInstanceId(e1) { 1363 let t1 = this.mapInstanceIdMap.get(e1); 1364 return t1 || (t1 = lt(), this.mapInstanceIdMap.set(e1, t1)), t1; 1365 } 1366 getEventId(e1) { 1367 const t1 = this.eventIdPerMapInstanceMap.get(e1) || 0; 1368 return this.eventIdPerMapInstanceMap.set(e1, t1 + 1), t1; 1369 } 1370 postStyleLoadEvent(e1, t1) { 1371 const { map: i, style: n, importedStyles: r } = t1; 1372 if (!Li(e1)) return; 1373 const o = this.getMapInstanceId(i), a = { 1374 mapInstanceId: o, 1375 eventId: this.getEventId(o), 1376 style: n 1377 }; 1378 r.length && (a.importedStyles = r), this.queueRequest({ 1379 timestamp: Date.now(), 1380 payload: a 1381 }, e1); 1382 } 1383 processRequests() { 1384 if (this.pendingRequest || 0 === this.queue.length) return; 1385 const { timestamp: e1, payload: t1, customAccessToken: i } = this.queue.shift(); 1386 this.postEvent(e1, t1, ()=>{}, i); 1387 } 1388 constructor(){ 1389 super("style.load"), this.eventIdPerMapInstanceMap = new Map, this.mapInstanceIdMap = new WeakMap; 1390 } 1391 }, Zi = $i.postStyleLoadEvent.bind($i), Wi = new ki({ 1392 attributes: [ 1393 {
1394 name: "maps/js/layer-animations/style-with-appearances" 1395 } 1396 ] 1397 }), qi = Wi.postMetricsEvent.bind(Wi), Xi = new ki({ 1398 attributes: [ 1399 { 1400 name: "maps/js/layer-animations/runtime-appearances" 1401 } 1402 ] 1403 }), Yi = Xi.postMetricsEvent.bind(Xi), Ji = new class extends Ni { 1404 postPerformanceEvent(e1, t1) { 1405 Li(e1) && this.queueRequest({ 1406 timestamp: Date.now(), 1407 performanceData: t1 1408 }, e1); 1409 } 1410 processRequests() { 1411 if (this.pendingRequest || 0 === this.queue.length) return; 1412 const { timestamp: e1, performanceData: t1, customAccessToken: n } = this.queue.shift(), r = function(e1) { 1413 const t1 = performance.getEntriesByType("resource"), n = performance.getEntriesByType("mark"), r = function(e1) { 1414 const t1 = {}; 1415 if (e1) { 1416 for(const i in e1)if ("other" !== i) for (const n of e1[i]){ 1417 const e1 = "".concat(i, "ResolveRangeMin"), r = "".concat(i, "ResolveRangeMax"), o = "".concat(i, "RequestCount"), a = "".concat(i, "RequestCachedCount"); 1418 t1[e1] = Math.min(t1[e1] || 1 / 0, n.startTime), t1[r] = Math.max(t1[r] || -1 / 0, n.responseEnd); 1419 const s = (e1)=>{ 1420 void 0 === t1[e1] && (t1[e1] = 0), ++t1[e1]; 1421 }; 1422 void 0 !== n.transferSize && 0 === n.transferSize && s(a), s(o); 1423 } 1424 } 1425 return t1; 1426 }(function(e1, t1) { 1427 const i = {}; 1428 if (e1) for (const n of e1){ 1429 const e1 = t1(n); 1430 void 0 === i[e1] && (i[e1] = []), i[e1].push(n); 1431 } 1432 return i; 1433 }(t1, Ai)), o = window.devicePixelRatio, a = navigator.connection || navigator.mozConnection || navigator.webkitConnection, s = a ? a.effectiveType : void 0, l = { 1434 counters: [], 1435 metadata: [], 1436 attributes: [] 1437 }, c = (e1, t1, i)=>{ 1438 null != i && e1.push({ 1439 name: t1, 1440 value: i.toString() 1441 }); 1442 }; 1443 for(const e1 in r)c(l.counters, e1, r[e1]); 1444 if (e1.interactionRange[0] !== 1 / 0 && e1.interactionRange[1] !== -1 / 0 && (c(l.counters, "interactionRangeMin", e1.interactionRange[0]), c(l.counters, "interactionRangeMax", e1.interactionRange[1])), n) for (const e1 of Object.values(bi)){ 1445 const t1 = n.find((t1)=>t1.name === e1); 1446 t1 && c(l.counters, e1, t1.startTime); 1447 } 1448 return c(l.counters, "visibilityHidden", e1.visibilityHidden), c(l.attributes, "style", function(e1) { 1449 if (e1) for (const t1 of e1){ 1450 const e1 = t1.name.split("?")[0]; 1451 if (ai(e1)) { 1452 const t1 = e1.split("/").slice(-2); 1453 if (2 === t1.length) return "mapbox://styles/".concat(t1[0], "/").concat(t1[1]); 1454 } 1455 } 1456 }(t1)), c(l.attributes, "terrainEnabled", e1.terrainEnabled ? "true" : "false"), c(l.attributes, "fogEnabled", e1.fogEnabled ? "true" : "false"), c(l.attributes, "projection", e1.projection), c(l.attributes, "zoom", e1.zoom), c(l.metadata, "devicePixelRatio", o), c(l.metadata, "connectionEffectiveType", s), c(l.metadata, "navigatorUserAgent", navigator.userAgent), c(l.metadata, "screenWidth", window.screen.width), c(l.metadata, "screenHeight", window.screen.height), c(l.metadata, "windowWidth", window.innerWidth), c(l.metadata, "windowHeight", window.innerHeight), c(l.metadata, "mapWidth", e1.width / o), c(l.metadata, "mapHeight", e1.height / o), c(l.metadata, "webglRenderer", e1.renderer), c(l.metadata, "webglVendor", e1.vendor), c(l.metadata, "sdkVersion", i), c(l.metadata, "sdkIdentifier", "mapbox-gl-js"), l; 1457 }(t1); 1458 for (const e1 of r.metadata); 1459 for (const e1 of r.counters); 1460 for (const e1 of r.attributes); 1461 this.postEvent(e1, r, ()=>{}, n); 1462 } 1463 constructor(){ 1464 super("gljs.performance"); 1465 } 1466 }, Ki = Ji.postPerformanceEvent.bind(Ji), Qi = new class extends Ni { 1467 getSession(e1, t1, i, n) { 1468 if (!jt.API_URL || !jt.SESSION_PATH) return; 1469 const r = Pi(jt.API_URL + jt.SESSION_PATH); 1470 r.params.push("sku=".concat(t1 || "")), r.params.push("access_token=".concat(n || jt.ACCESS_TOKEN || "")); 1471 const o = { 1472 url: Di(r), 1473 headers: { 1474 "Content-Type": "text/plain" 1475 } 1476 }; 1477 this.pendingRequest = !0, (async function(e1) { 1478 return pi(Object.assign(e1, { 1479 method: "GET" 1480 }), void 0); 1481 })(o).then(()=>{ 1482 this.pendingRequest = !1, i(null), this.saveEventData(), this.processRequests(); 1483 }).catch((e1)=>{ 1484 this.pendingRequest = !1, i(e1), this.saveEventData(), this.processRequests(); 1485 }); 1486 } 1487 getSessionAPI(e1, t1, i, n) { 1488 this.skuToken = t1, this.errorCb = n, jt.EVENTS_URL && jt.SESSION_PATH && jt.API_URL && (i || jt.ACCESS_TOKEN ? this.queueRequest({ 1489 id: e1, 1490 timestamp: Date.now() 1491 }, i) : this.errorCb(new Error(zi))); 1492 } 1493 processRequests() { 1494 if (this.pendingRequest || 0 === this.queue.length) return; 1495 const { id: e1, timestamp: t1, customAccessToken: i } = this.queue.shift();
1496 e1 && this.success[e1] || this.getSession(t1, this.skuToken, (t1)=>{ 1497 t1 ? this.errorCb(t1) : e1 && (this.success[e1] = !0); 1498 }, i); 1499 } 1500 remove() { 1501 this.errorCb = null; 1502 } 1503 constructor(){ 1504 super("map.auth"), this.success = {}, this.skuToken = ""; 1505 } 1506 }, en = Qi.getSessionAPI.bind(Qi), tn = new Set; 1507 function nn(e1) { 1508 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; 1509 const i = 3432918353, n = 461845907, r = e1.length, o = r - (3 & r); 1510 let a, s = 0 | t1, l = 0; 1511 for(; l < o;)a = 255 & e1.charCodeAt(l) | (255 & e1.charCodeAt(l + 1)) << 8 | (255 & e1.charCodeAt(l + 2)) << 16 | (255 & e1.charCodeAt(l + 3)) << 24, l += 4, a = Math.imul(a, i), a = a << 15 | a >>> 17, a = Math.imul(a, n), s ^= a, s = s << 13 | s >>> 19, s = Math.imul(s, 5) + 3864292196 | 0; 1512 a = 0; 1513 const c = 3 & r; 1514 return c > 0 && (c >= 3 && (a ^= (255 & e1.charCodeAt(l + 2)) << 16), c >= 2 && (a ^= (255 & e1.charCodeAt(l + 1)) << 8), a ^= 255 & e1.charCodeAt(l), a = Math.imul(a, i), a = a << 15 | a >>> 17, a = Math.imul(a, n), s ^= a), s ^= r, s ^= s >>> 16, s = Math.imul(s, 2246822507), s ^= s >>> 13, s = Math.imul(s, 3266489909), s ^= s >>> 16, s >>> 0; 1515 } 1516 class rn { 1517 constructor(e1, ...t1){ 1518 Object.assign(this, t1[0] || {}), this.type = e1; 1519 } 1520 } 1521 class on extends rn { 1522 constructor(e1, t1 = {}){ 1523 super("error", { 1524 error: e1, 1525 ...t1 1526 }), this.error = e1; 1527 } 1528 } 1529 function an(e1, t1, i) { 1530 i[e1] && i[e1].includes(t1) || (i[e1] = i[e1] || [], i[e1].push(t1)); 1531 } 1532 function sn(e1, t1, i) { 1533 if (i[e1]) { 1534 const n = i[e1].indexOf(t1); 1535 -1 !== n && i[e1].splice(n, 1); 1536 } 1537 } 1538 class ln { 1539 on(e1, t1) { 1540 return an(e1, t1, this._listeners), this; 1541 } 1542 off(e1, t1) { 1543 return sn(e1, t1, this._listeners), sn(e1, t1, this._oneTimeListeners), this; 1544 } 1545 once(e1, t1) { 1546 return t1 ? (an(e1, t1, this._oneTimeListeners), this) : new Promise((t1)=>{ 1547 this.once(e1, t1); 1548 }); 1549 } 1550 fire(e1, t1) { 1551 const i = "string" == typeof e1 ? new rn(e1, t1) : e1, n = i.type; 1552 if (this.listens(n)) { 1553 i.target = this; 1554 const e1 = this._listeners[n] ? this._listeners[n].slice() : []; 1555 for (const t1 of e1)t1.call(this, i); 1556 const t1 = this._oneTimeListeners[n] ? this._oneTimeListeners[n].slice() : []; 1557 for (const e1 of t1)sn(n, e1, this._oneTimeListeners), e1.call(this, i); 1558 const r = this._eventedParent; 1559 if (r) { 1560 const e1 = "function" == typeof this._eventedParentData ? this._eventedParentData() : this._eventedParentData; 1561 Object.assign(i, e1), r.fire(i); 1562 } 1563 } else i instanceof on && console.error(i.error); 1564 return this; 1565 } 1566 listens(e1) { 1567 return !!(this._listeners[e1] && this._listeners[e1].length > 0 || this._oneTimeListeners[e1] && this._oneTimeListeners[e1].length > 0 || this._eventedParent && this._eventedParent.listens(e1)); 1568 } 1569 setEventedParent(e1, t1) { 1570 return this._eventedParent = e1, this._eventedParentData = t1, this; 1571 } 1572 constructor(){ 1573 this._listeners = {}, this._oneTimeListeners = {}; 1574 } 1575 } 1576 class cn { 1577 static from(e1) { 1578 return new cn(e1); 1579 } 1580 static toString(e1) { 1581 return e1.iconsetId ? "".concat(e1.name, "\x1f").
1581concat(e1.iconsetId) : e1.name; 1582 } 1583 static parse(e1) { 1584 const [t1, i] = e1.split("�"); 1585 return new cn({ 1586 name: t1, 1587 iconsetId: i 1588 }); 1589 } 1590 static isEqual(e1, t1) { 1591 return e1.name === t1.name && e1.iconsetId === t1.iconsetId; 1592 } 1593 toString() { 1594 return cn.toString(this); 1595 } 1596 serialize() { 1597 return { 1598 name: this.name, 1599 iconsetId: this.iconsetId 1600 }; 1601 } 1602 constructor(e1){ 1603 "string" == typeof e1 ? this.name = e1 : (this.name = e1.name, this.iconsetId = e1.iconsetId); 1604 } 1605 } 1606 var un, hn = {}, dn = function() { 1607 if (un) return hn; 1608 un = 1; 1609 var e1 = { 1610 transparent: [ 1611 0, 1612 0, 1613 0, 1614 0 1615 ], 1616 aliceblue: [ 1617 240, 1618 248, 1619 255, 1620 1 1621 ], 1622 antiquewhite: [ 1623 250, 1624 235, 1625 215, 1626 1 1627 ], 1628 aqua: [ 1629 0, 1630 255, 1631 255, 1632 1 1633 ], 1634 aquamarine: [ 1635 127, 1636 255, 1637 212, 1638 1 1639 ], 1640 azure: [ 1641 240, 1642 255, 1643 255, 1644 1 1645 ], 1646 beige: [ 1647 245, 1648 245, 1649 220, 1650 1 1651 ], 1652 bisque: [ 1653 255, 1654 228, 1655 196, 1656 1 1657 ], 1658 black: [ 1659 0, 1660 0, 1661 0, 1662 1 1663 ], 1664 blanchedalmond: [ 1665 255, 1666 235, 1667 205, 1668 1 1669 ], 1670 blue: [ 1671 0, 1672 0, 1673 255, 1674 1 1675 ], 1676 blueviolet: [ 1677 138, 1678 43, 1679 226, 1680 1 1681 ], 1682 brown: [ 1683 165, 1684 42, 1685 42, 1686 1 1687 ], 1688 burlywood: [ 1689 222, 1690 184, 1691 135, 1692 1 1693 ], 1694 cadetblue: [ 1695 95, 1696 158, 1697 160, 1698 1 1699 ], 1700 chartreuse: [ 1701 127, 1702 255, 1703 0, 1704 1 1705 ], 1706 chocolate: [ 1707 210, 1708 105, 1709 30, 1710 1 1711 ], 1712 coral: [ 1713 255, 1714 127, 1715 80, 1716 1 1717 ], 1718 cornflowerblue: [ 1719 100, 1720 149, 1721 237, 1722 1 1723 ], 1724 cornsilk: [ 1725 255, 1726 248, 1727 220, 1728 1 1729 ], 1730 crimson: [ 1731 220, 1732 20, 1733 60, 1734 1 1735 ], 1736 cyan: [ 1737 0, 1738 255, 1739 255, 1740 1 1741 ], 1742 darkblue: [ 1743 0, 1744 0, 1745 139, 1746 1 1747 ], 1748 darkcyan: [ 1749 0, 1750 139, 1751 139, 1752 1 1753 ], 1754 darkgoldenrod: [ 1755 184, 1756 134, 1757 11, 1758 1 1759 ], 1760 darkgray: [ 1761 169, 1762 169, 1763 169, 1764 1 1765 ], 1766 darkgreen: [ 1767 0, 1768 100, 1769 0, 1770 1 1771 ], 1772 darkgrey: [ 1773 169, 1774 169, 1775 169, 1776 1 1777 ], 1778 darkkhaki: [ 1779 189, 1780 183, 1781 107, 1782 1 1783 ], 1784 darkmagenta: [ 1785 139, 1786 0, 1787 139, 1788 1 1789 ], 1790 darkolivegreen: [ 1791 85, 1792 107, 1793 47, 1794 1 1795 ], 1796 darkorange: [ 1797 255, 1798 140, 1799 0, 1800 1 1801 ], 1802 darkorchid: [ 1803 153, 1804 50,
1805 204, 1806 1 1807 ], 1808 darkred: [ 1809 139, 1810 0, 1811 0, 1812 1 1813 ], 1814 darksalmon: [ 1815 233, 1816 150, 1817 122, 1818 1 1819 ], 1820 darkseagreen: [ 1821 143, 1822 188, 1823 143, 1824 1 1825 ], 1826 darkslateblue: [ 1827 72, 1828 61, 1829 139, 1830 1 1831 ], 1832 darkslategray: [ 1833 47, 1834 79, 1835 79, 1836 1 1837 ], 1838 darkslategrey: [ 1839 47, 1840 79, 1841 79, 1842 1 1843 ], 1844 darkturquoise: [ 1845 0, 1846 206, 1847 209, 1848 1 1849 ], 1850 darkviolet: [ 1851 148, 1852 0, 1853 211, 1854 1 1855 ], 1856 deeppink: [ 1857 255, 1858 20, 1859 147, 1860 1 1861 ], 1862 deepskyblue: [ 1863 0, 1864 191, 1865 255, 1866 1 1867 ], 1868 dimgray: [ 1869 105, 1870 105, 1871 105, 1872 1 1873 ], 1874 dimgrey: [ 1875 105, 1876 105, 1877 105, 1878 1 1879 ], 1880 dodgerblue: [ 1881 30, 1882 144, 1883 255, 1884 1 1885 ], 1886 firebrick: [ 1887 178, 1888 34, 1889 34, 1890 1 1891 ], 1892 floralwhite: [ 1893 255, 1894 250, 1895 240, 1896 1 1897 ], 1898 forestgreen: [ 1899 34, 1900 139, 1901 34, 1902 1 1903 ], 1904 fuchsia: [ 1905 255, 1906 0, 1907 255, 1908 1 1909 ], 1910 gainsboro: [ 1911 220, 1912 220, 1913 220, 1914 1 1915 ], 1916 ghostwhite: [ 1917 248, 1918 248, 1919 255, 1920 1 1921 ], 1922 gold: [ 1923 255, 1924 215, 1925 0, 1926 1 1927 ], 1928 goldenrod: [ 1929 218, 1930 165, 1931 32, 1932 1 1933 ], 1934 gray: [ 1935 128, 1936 128, 1937 128, 1938 1 1939 ], 1940 green: [ 1941 0, 1942 128, 1943 0, 1944 1 1945 ], 1946 greenyellow: [ 1947 173, 1948 255, 1949 47, 1950 1 1951 ], 1952 grey: [ 1953 128, 1954 128, 1955 128, 1956 1 1957 ], 1958 honeydew: [ 1959 240, 1960 255, 1961 240, 1962 1 1963 ], 1964 hotpink: [ 1965 255, 1966 105, 1967 180, 1968 1 1969 ], 1970 indianred: [ 1971 205, 1972 92, 1973 92, 1974 1 1975 ], 1976 indigo: [ 1977 75, 1978 0, 1979 130, 1980 1 1981 ], 1982 ivory: [ 1983 255, 1984 255, 1985 240, 1986 1 1987 ], 1988 khaki: [ 1989 240, 1990 230, 1991 140, 1992 1 1993 ], 1994 lavender: [ 1995 230, 1996 230, 1997 250, 1998 1 1999 ], 2000 lavenderblush: [ 2001 255, 2002 240, 2003 245, 2004 1 2005 ], 2006 lawngreen: [ 2007 124, 2008 252, 2009 0, 2010 1 2011 ], 2012 lemonchiffon: [ 2013 255, 2014 250, 2015 205, 2016 1 2017 ], 2018 lightblue: [ 2019 173, 2020 216, 2021 230, 2022 1 2023 ], 2024 lightcoral: [ 2025 240, 2026 128, 2027 128, 2028 1 2029 ], 2030 lightcyan: [ 2031 224, 2032 255, 2033 255, 2034 1 2035 ], 2036 lightgoldenrodyellow: [ 2037 250, 2038 250, 2039 210, 2040 1 2041 ], 2042 lightgray: [ 2043 211, 2044 211, 2045 211, 2046 1 2047 ], 2048 lightgreen: [ 2049 144, 2050 238, 2051 144, 2052 1 2053 ], 2054 lightgrey: [ 2055 211, 2056 211, 2057 211, 2058 1 2059 ], 2060 lightpink: [ 2061 255, 2062 182, 2063 193, 2064 1 2065 ], 2066 lightsalmon: [ 2067 255, 2068 160, 2069 122, 2070 1 2071 ], 2072 lightseagreen: [ 2073 32, 2074 178, 2075 170, 2076 1 2077 ], 2078 lightskyblue: [ 2079 135, 2080 206, 2081 250, 2082 1 2083 ], 2084 lightslategray: [ 2085 119, 2086 136, 2087 153, 2088 1 2089 ], 2090 lightslategrey: [ 2091 119, 2092 136, 2093 153, 2094 1 2095 ], 2096 lightsteelblue: [ 2097 176, 2098 196, 2099 222, 2100 1 2101 ], 2102 lightyellow: [ 2103 255, 2104 255, 2105 224, 2106 1 2107 ], 2108 lime: [ 2109 0, 2110 255, 2111 0, 2112 1 2113 ], 2114 limegreen: [ 2115 50,
2116 205, 2117 50, 2118 1 2119 ], 2120 linen: [ 2121 250, 2122 240, 2123 230, 2124 1 2125 ], 2126 magenta: [ 2127 255, 2128 0, 2129 255, 2130 1 2131 ], 2132 maroon: [ 2133 128, 2134 0, 2135 0, 2136 1 2137 ], 2138 mediumaquamarine: [ 2139 102, 2140 205, 2141 170, 2142 1 2143 ], 2144 mediumblue: [ 2145 0, 2146 0, 2147 205, 2148 1 2149 ], 2150 mediumorchid: [ 2151 186, 2152 85, 2153 211, 2154 1 2155 ], 2156 mediumpurple: [ 2157 147, 2158 112, 2159 219, 2160 1 2161 ], 2162 mediumseagreen: [ 2163 60, 2164 179, 2165 113, 2166 1 2167 ], 2168 mediumslateblue: [ 2169 123, 2170 104, 2171 238, 2172 1 2173 ], 2174 mediumspringgreen: [ 2175 0, 2176 250, 2177 154, 2178 1 2179 ], 2180 mediumturquoise: [ 2181 72, 2182 209, 2183 204, 2184 1 2185 ], 2186 mediumvioletred: [ 2187 199, 2188 21, 2189 133, 2190 1 2191 ], 2192 midnightblue: [ 2193 25, 2194 25, 2195 112, 2196 1 2197 ], 2198 mintcream: [ 2199 245, 2200 255, 2201 250, 2202 1 2203 ], 2204 mistyrose: [ 2205 255, 2206 228, 2207 225, 2208 1 2209 ], 2210 moccasin: [ 2211 255, 2212 228, 2213 181, 2214 1 2215 ], 2216 navajowhite: [ 2217 255, 2218 222, 2219 173, 2220 1 2221 ], 2222 navy: [ 2223 0, 2224 0, 2225 128, 2226 1 2227 ], 2228 oldlace: [ 2229 253, 2230 245, 2231 230, 2232 1 2233 ], 2234 olive: [ 2235 128, 2236 128, 2237 0, 2238 1 2239 ], 2240 olivedrab: [ 2241 107, 2242 142, 2243 35, 2244 1 2245 ], 2246 orange: [ 2247 255, 2248 165, 2249 0, 2250 1 2251 ], 2252 orangered: [ 2253 255, 2254 69, 2255 0, 2256 1 2257 ], 2258 orchid: [ 2259 218, 2260 112, 2261 214, 2262 1 2263 ], 2264 palegoldenrod: [ 2265 238, 2266 232, 2267 170, 2268 1 2269 ], 2270 palegreen: [ 2271 152, 2272 251, 2273 152, 2274 1 2275 ], 2276 paleturquoise: [ 2277 175, 2278 238, 2279 238, 2280 1 2281 ], 2282 palevioletred: [ 2283 219, 2284 112, 2285 147, 2286 1 2287 ], 2288 papayawhip: [ 2289 255, 2290 239, 2291 213, 2292 1 2293 ], 2294 peachpuff: [ 2295 255, 2296 218, 2297 185, 2298 1 2299 ], 2300 peru: [ 2301 205, 2302 133, 2303 63, 2304 1 2305 ], 2306 pink: [ 2307 255, 2308 192, 2309 203, 2310 1 2311 ], 2312 plum: [ 2313 221, 2314 160, 2315 221, 2316 1 2317 ], 2318 powderblue: [ 2319 176, 2320 224, 2321 230, 2322 1 2323 ], 2324 purple: [ 2325 128, 2326 0, 2327 128, 2328 1 2329 ], 2330 rebeccapurple: [ 2331 102, 2332 51, 2333 153, 2334 1 2335 ], 2336 red: [ 2337 255, 2338 0, 2339 0, 2340 1 2341 ], 2342 rosybrown: [ 2343 188, 2344 143, 2345 143, 2346 1 2347 ], 2348 royalblue: [ 2349 65, 2350 105, 2351 225, 2352 1 2353 ], 2354 saddlebrown: [ 2355 139, 2356 69, 2357 19, 2358 1 2359 ], 2360 salmon: [ 2361 250, 2362 128, 2363 114, 2364 1 2365 ], 2366 sandybrown: [ 2367 244, 2368 164, 2369 96, 2370 1 2371 ], 2372 seagreen: [ 2373 46, 2374 139, 2375 87, 2376 1 2377 ], 2378 seashell: [ 2379 255, 2380 245, 2381 238, 2382 1 2383 ], 2384 sienna: [ 2385 160, 2386 82, 2387 45,
2388 1 2389 ], 2390 silver: [ 2391 192, 2392 192, 2393 192, 2394 1 2395 ], 2396 skyblue: [ 2397 135, 2398 206, 2399 235, 2400 1 2401 ], 2402 slateblue: [ 2403 106, 2404 90, 2405 205, 2406 1 2407 ], 2408 slategray: [ 2409 112, 2410 128, 2411 144, 2412 1 2413 ], 2414 slategrey: [ 2415 112, 2416 128, 2417 144, 2418 1 2419 ], 2420 snow: [ 2421 255, 2422 250, 2423 250, 2424 1 2425 ], 2426 springgreen: [ 2427 0, 2428 255, 2429 127, 2430 1 2431 ], 2432 steelblue: [ 2433 70, 2434 130, 2435 180, 2436 1 2437 ], 2438 tan: [ 2439 210, 2440 180, 2441 140, 2442 1 2443 ], 2444 teal: [ 2445 0, 2446 128, 2447 128, 2448 1 2449 ], 2450 thistle: [ 2451 216, 2452 191, 2453 216, 2454 1 2455 ], 2456 tomato: [ 2457 255, 2458 99, 2459 71, 2460 1 2461 ], 2462 turquoise: [ 2463 64, 2464 224, 2465 208, 2466 1 2467 ], 2468 violet: [ 2469 238, 2470 130, 2471 238, 2472 1 2473 ], 2474 wheat: [ 2475 245, 2476 222, 2477 179, 2478 1 2479 ], 2480 white: [ 2481 255, 2482 255, 2483 255, 2484 1 2485 ], 2486 whitesmoke: [ 2487 245, 2488 245, 2489 245, 2490 1 2491 ], 2492 yellow: [ 2493 255, 2494 255, 2495 0, 2496 1 2497 ], 2498 yellowgreen: [ 2499 154, 2500 205, 2501 50, 2502 1 2503 ] 2504 }; 2505 function t1(e1) { 2506 return (e1 = Math.round(e1)) < 0 ? 0 : e1 > 255 ? 255 : e1; 2507 } 2508 function i(e1) { 2509 return t1("%" === e1[e1.length - 1] ? parseFloat(e1) / 100 * 255 : parseInt(e1)); 2510 } 2511 function n(e1) { 2512 return (t1 = "%" === e1[e1.length - 1] ? parseFloat(e1) / 100 : parseFloat(e1)) < 0 ? 0 : t1 > 1 ? 1 : t1; 2513 //TURBOPACK unreachable 2514 ; 2515 var t1; 2516 } 2517 function r(e1, t1, i) { 2518 return i < 0 ? i += 1 : i > 1 && (i -= 1), 6 * i < 1 ? e1 + (t1 - e1) * i * 6 : 2 * i < 1 ? t1 : 3 * i < 2 ? e1 + (t1 - e1) * (2 / 3 - i) * 6 : e1; 2519 } 2520 try { 2521 hn.parseCSSColor = function(o) { 2522 var a, s = o.replace(/ /g, "").toLowerCase(); 2523 if (s in e1) return e1[s].slice(); 2524 if ("#" === s[0]) return 4 === s.length ? (a = parseInt(s.substr(1), 16)) >= 0 && a <= 4095 ? [ 2525 (3840 & a) >> 4 | (3840 & a) >> 8, 2526 240 & a | (240 & a) >> 4, 2527 15 & a | (15 & a) << 4, 2528 1 2529 ] : null : 7 === s.length && (a = parseInt(s.substr(1), 16)) >= 0 && a <= 16777215 ? [ 2530 (16711680 & a) >> 16, 2531 (65280 & a) >> 8, 2532 255 & a, 2533 1 2534 ] : null; 2535 var l = s.indexOf("("), c = s.indexOf(")"); 2536 if (-1 !== l && c + 1 === s.length) { 2537 var u = s.substr(0, l), h = s.substr(l + 1, c - (l + 1)).split(","), d = 1; 2538 switch(u){ 2539 case "rgba": 2540 if (4 !== h.length) return null; 2541 d = n(h.pop()); 2542 case "rgb": 2543 return 3 !== h.length ? null : [ 2544 i(h[0]), 2545 i(h[1]), 2546 i(h[2]), 2547 d 2548 ]; 2549 case "hsla": 2550 if (4 !== h.length) return null; 2551 d = n(h.pop()); 2552 case "hsl": 2553 if (3 !== h.length) return null; 2554 var f = (parseFloat(h[0]) % 360 + 360) % 360 / 360, p = n(h[1]), m = n(h[2]), _ = m <= .5 ? m * (p + 1) : m + p - m * p, g = 2 * m - _; 2555 return [ 2556 t1(255 * r(g, _, f + 1 / 3)), 2557 t1(255 * r(g, _, f)), 2558 t1(255 * r(g, _, f - 1 / 3)), 2559 d 2560 ]; 2561 default: 2562 return null; 2563 } 2564 } 2565 return null; 2566 }; 2567 } catch (e1) {} 2568 return hn; 2569 }(); 2570 function fn(e1, t1, i) { 2571 return e1 * (1 - i) + t1 * i; 2572 } 2573 const pn = new Map; 2574 class mn { 2575 static parse(e1) { 2576 if (!e1) return; 2577 if (e1 instanceof mn) return e1; 2578 if ("string" != typeof e1) return; 2579 const t1 = pn.get(e1); 2580 if (t1) return t1; 2581 const i = dn.parseCSSColor(e1); 2582 if (!i) return; 2583 const n = new mn(i[0] / 255, i[1] / 255, i[2] / 255, i[3]); 2584 return pn.set(e1, n), n; 2585 } 2586 toString() { 2587 const { r: e1, g: t1, b: i, a: n } = this; 2588 return "rgba(".concat(Math.round(255 * e1), ",").concat(Math.round(255 * t1), ",").concat(Math.round(255 * i), ",").concat(n, ")"); 2589 } 2590 toNonPremultipliedRenderColor(e1) { 2591 const { r: t1, g: i, b: n, a: r } = this; 2592 return new gn(e1, t1, i, n, r); 2593 } 2594 toPremultipliedRenderColor(e1) { 2595 const { r: t1, g: i, b: n, a: r } = this; 2596 return new yn(e1, t1 * r, i * r, n * r, r); 2597 } 2598 clone() { 2599 return new mn(this.r, this.g, this.b, this.a); 2600 } 2601 constructor(e1, t1, i, n = 1){ 2602 this.r = e1, this.g = t1, this.b = i, this.a = n; 2603 } 2604 } 2605 class _n { 2606 toArray() { 2607 const { r: e1, g: t1, b: i, a: n } = this; 2608 return [ 2609 255 * e1, 2610 255 * t1, 2611 255 * i, 2612 n 2613 ]; 2614 } 2615 toHslaArray() { 2616 let { r: e1, g: t1, b: i, a: n } = this; 2617 if (this.premultiplied) { 2618 if (0 === n) return [ 2619 0, 2620 0, 2621 0, 2622 0 2623 ]; 2624 const r = 1 / n; 2625 e1 *= r, t1 *= r, i *= r; 2626 } 2627 const r = Math.min(Math.max(e1, 0), 1), o = Math.min(Math.max(t1, 0), 1), a = Math.min(Math.max(i, 0), 1), s = Math.min(r, o, a), l = Math.max(r, o, a), c = l - s, u = .5 * (s + l); 2628 if (0 === c) return [ 2629 0, 2630 0, 2631 100 * u, 2632 n 2633 ]; 2634 const h = u > .5 ? c / (2 - l - s) : c / (l + s); 2635 let d; 2636 switch(l){ 2637 case r: 2638 d = 60 * ((o - a) / c + (o < a ? 6 : 0)); 2639 break; 2640 case o: 2641 d = 60 * ((a - r) / c + 2); 2642 break; 2643 default: 2644 d = 60 * ((r - o) / c + 4); 2645 } 2646 return [ 2647 d, 2648 100 * h, 2649 100 * u, 2650 n 2651 ]; 2652 } 2653 toArray01() { 2654 const { r: e1, g: t1, b: i, a: n } = this; 2655 return [ 2656 e1, 2657 t1, 2658 i, 2659 n 2660 ]; 2661 } 2662 toArray01Scaled(e1) { 2663 const { r: t1, g: i, b: n } = this; 2664 return [ 2665 t1 * e1, 2666 i * e1, 2667 n * e1 2668 ]; 2669 } 2670 toArray01Linear() { 2671 const { r: e1, g: t1, b: i, a: n } = this; 2672 return [ 2673 Math.pow(e1, 2.2), 2674 Math.pow(t1, 2.2), 2675 Math.pow(i, 2.2), 2676 n 2677 ]; 2678 } 2679 constructor(e1, t1, i, n, r, o = !1){ 2680 if (this.premultiplied = !1, this.premultiplied = o, e1) { 2681 const o = e1.image.height, a = o * o; 2682 this.premultiplied ? (t1 = 0 === r ? 0 : t1 / r * (o - 1), i = 0 === r ? 0 : i / r * (o - 1), n = 0 === r ? 0 : n / r * (o - 1)) : (t1 *= o - 1, i *= o - 1, n *= o - 1), t1 = Math.max(0, Math.min(o - 1, t1)), i = Math.max(0, Math.min(o - 1, i)), n = Math.max(0, Math.min(o - 1, n)); 2683 const s = Math.floor(t1), l = Math.floor(i), c = Math.floor(n), u = Math.
2683ceil(t1), h = Math.ceil(i), d = Math.ceil(n), f = t1 - s, p = i - l, m = n - c, _ = e1.image.data, g = 4 * (s + l * a + c * o), y = 4 * (s + l * a + d * o), x = 4 * (s + h * a + c * o), v = 4 * (s + h * a + d * o), b = 4 * (u + l * a + c * o), w = 4 * (u + l * a + d * o), A = 4 * (u + h * a + c * o), E = 4 * (u + h * a + d * o); 2684 this.r = fn(fn(fn(_[g], _[y], m), fn(_[x], _[v], m), p), fn(fn(_[b], _[w], m), fn(_[A], _[E], m), p), f) / 255 * (this.premultiplied ? r : 1), this.g = fn(fn(fn(_[g + 1], _[y + 1], m), fn(_[x + 1], _[v + 1], m), p), fn(fn(_[b + 1], _[w + 1], m), fn(_[A + 1], _[E + 1], m), p), f) / 255 * (this.premultiplied ? r : 1), this.b = fn(fn(fn(_[g + 2], _[y + 2], m), fn(_[x + 2], _[v + 2], m), p), fn(fn(_[b + 2], _[w + 2], m), fn(_[A + 2], _[E + 2], m), p), f) / 255 * (this.premultiplied ? r : 1), this.a = r; 2685 } else this.r = t1, this.g = i, this.b = n, this.a = r; 2686 } 2687 } 2688 class gn extends _n { 2689 constructor(e1, t1, i, n, r){ 2690 super(e1, t1, i, n, r, !1); 2691 } 2692 } 2693 class yn extends _n { 2694 constructor(e1, t1, i, n, r){ 2695 super(e1, t1, i, n, r, !0); 2696 } 2697 } 2698 function xn(e1, t1, i) { 2699 return e1.map((e1, n)=>fn(e1, t1[n], i)); 2700 } 2701 mn.black = new mn(0, 0, 0, 1), mn.white = new mn(1, 1, 1, 1), mn.transparent = new mn(0, 0, 0, 0), mn.red = new mn(1, 0, 0, 1), mn.blue = new mn(0, 0, 1, 1); 2702 var vn = Object.freeze({ 2703 __proto__: null, 2704 array: xn, 2705 color: function(e1, t1, i) { 2706 return new mn(fn(e1.r, t1.r, i), fn(e1.g, t1.g, i), fn(e1.b, t1.b, i), fn(e1.a, t1.a, i)); 2707 }, 2708 number: fn 2709 }); 2710 class bn extends Error { 2711 constructor(e1, t1){ 2712 super(t1), this.message = t1, this.key = e1; 2713 } 2714 } 2715 class wn { 2716 concat(e1) { 2717 return new wn(this, e1); 2718 } 2719 get(e1) { 2720 if (this.bindings[e1]) return this.bindings[e1]; 2721 if (this.parent) return this.parent.get(e1); 2722 throw new Error("".concat(e1, " not found in scope.")); 2723 } 2724 has(e1) { 2725 return !!this.bindings[e1] || !!this.parent && this.parent.has(e1); 2726 } 2727 constructor(e1, t1 = []){ 2728 this.parent = e1, this.bindings = Object.create(null); 2729 for (const [e1, i] of t1)this.bindings[e1] = i; 2730 } 2731 } 2732 const An = { 2733 kind: "null" 2734 }, En = { 2735 kind: "number" 2736 }, In = { 2737 kind: "string" 2738 }, Mn = { 2739 kind: "boolean" 2740 }, Tn = { 2741 kind: "color" 2742 }, Sn = { 2743 kind: "object" 2744 }, zn = { 2745 kind: "value" 2746 }, Rn = { 2747 kind: "collator" 2748 }, Pn = { 2749 kind: "formatted" 2750 }, Dn = { 2751 kind: "resolvedImage" 2752 }; 2753 function Fn(e1, t1) { 2754 return { 2755 kind: "array", 2756 itemType: e1, 2757 N: t1 2758 }; 2759 } 2760 function Cn(e1) { 2761 if ("array" === e1.kind) { 2762 const t1 = Cn(e1.itemType); 2763 return "number" == typeof e1.N ? "array<".concat(t1, ", ").concat(e1.N, ">") : "value" === e1.itemType.kind ? "array" : "array<".concat(t1, ">"); 2764 } 2765 return e1.kind; 2766 } 2767 const Ln = [ 2768 An, 2769 En, 2770 In, 2771 Mn, 2772 Tn, 2773 Pn, 2774 Sn, 2775 Fn(zn), 2776 Dn 2777 ]; 2778 function On(e1, t1) { 2779 if ("error" === t1.kind) return null; 2780 if ("array" === e1.kind) { 2781 if ("array" === t1.kind && (0 === t1.N && "value" === t1.itemType.kind || !On(e1.itemType, t1.itemType)) && ("number" != typeof e1.N || e1.N === t1.N)) return null; 2782 } else { 2783 if (e1.kind === t1.kind) return null; 2784 if ("value" === e1.kind) { 2785 for (const e1 of Ln)if (!On(e1, t1)) return null; 2786 } 2787 }
2788 return "Expected ".concat(Cn(e1), " but found ").concat(Cn(t1), " instead."); 2789 } 2790 function Bn(e1, t1) { 2791 return t1.some((t1)=>"null" === t1 ? null === e1 : "array" === t1 ? Array.isArray(e1) : "object" === t1 ? e1 && !Array.isArray(e1) && "object" == typeof e1 : t1 === typeof e1); 2792 } 2793 function Vn(e1, t1) { 2794 return "array" === e1.kind && "array" === t1.kind ? e1.N === t1.N && Vn(e1.itemType, t1.itemType) : e1.kind === t1.kind; 2795 } 2796 class Nn { 2797 compare(e1, t1) { 2798 return this.collator.compare(e1, t1); 2799 } 2800 resolvedLocale() { 2801 return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale; 2802 } 2803 constructor(e1, t1, i){ 2804 this.sensitivity = e1 ? t1 ? "variant" : "case" : t1 ? "accent" : "base", this.locale = i, this.collator = new Intl.Collator(this.locale ? this.locale : [], { 2805 sensitivity: this.sensitivity, 2806 usage: "search" 2807 }); 2808 } 2809 } 2810 class kn { 2811 constructor(e1, t1, i, n, r){ 2812 this.text = e1.normalize ? e1.normalize() : e1, this.image = t1, this.scale = i, this.fontStack = n, this.textColor = r; 2813 } 2814 } 2815 class Un { 2816 static fromString(e1) { 2817 return new Un([ 2818 new kn(e1, null, null, null, null) 2819 ]); 2820 } 2821 isEmpty() { 2822 return 0 === this.sections.length || !this.sections.some((e1)=>0 !== e1.text.length || !!e1.image && e1.image.hasPrimary()); 2823 } 2824 static factory(e1) { 2825 return e1 instanceof Un ? e1 : Un.fromString(e1); 2826 } 2827 toString() { 2828 return 0 === this.sections.length ? "" : this.sections.map((e1)=>e1.text).join(""); 2829 } 2830 serialize() { 2831 const e1 = [ 2832 "format" 2833 ]; 2834 for (const t1 of this.sections){ 2835 if (t1.image) { 2836 const i = t1.image.getPrimary().id.toString(); 2837 e1.push([ 2838 "image", 2839 i 2840 ]); 2841 continue; 2842 } 2843 e1.push(t1.text); 2844 const i = {}; 2845 t1.fontStack && (i["text-font"] = [ 2846 "literal", 2847 t1.fontStack.split(",") 2848 ]), t1.scale && (i["font-scale"] = t1.scale), t1.textColor && (i["text-color"] = [ 2849 "rgba" 2850 ].concat(t1.textColor.toNonPremultipliedRenderColor(null).toArray())), e1.push(i); 2851 } 2852 return e1; 2853 } 2854 constructor(e1){ 2855 this.sections = e1; 2856 } 2857 } 2858 class jn { 2859 toString() { 2860 return JSON.stringify(this); 2861 } 2862 static parse(e1) { 2863 let t1, i, n, r; 2864 try { 2865 ({ id: t1, params: i, sx: n, sy: r } = JSON.parse(e1) || {}); 2866 } catch (e1) { 2867 return null; 2868 } 2869 return t1 ? new jn(t1, { 2870 params: i, 2871 sx: n, 2872 sy: r 2873 }) : null; 2874 } 2875 scaleSelf(e1) { 2876 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : e1; 2877 return this.sx *= e1, this.sy *= t1, this; 2878 } 2879 constructor(e1, t1 = {}){ 2880 this.id = cn.from(e1), this.params = t1.params, this.sx = t1.sx || 1, this.sy = t1.sy || 1; 2881 } 2882 } 2883 class Gn { 2884 toString() { 2885 return this.primaryId && this.secondaryId ? "[".concat(this.primaryId.name, ",").concat(this.secondaryId.name, "]") : this.primaryId.name; 2886 } 2887 hasPrimary() { 2888 return !!this.primaryId; 2889 } 2890 getPrimary() { 2891 return new jn(this.primaryId, this.primaryOptions); 2892 } 2893 hasSecondary() { 2894 return !!this.secondaryId; 2895 } 2896 getSecondary() { 2897 return this.secondaryId ? new jn(this.secondaryId, this.secondaryOptions) : null; 2898 } 2899 static from(e1) { 2900 return "string" != typeof e1 ? e1 : Gn.build({ 2901 name: e1 2902 }); 2903 } 2904 static build(e1, t1, i, n) { 2905 return !e1 || "object" == typeof e1 && !("name" in e1) ? null : new Gn(e1, i, t1, n); 2906 } 2907 constructor(e1, t1, i, n, r = !1){ 2908 this.primaryId = cn.from(e1), this.primaryOptions = t1, i && (this.secondaryId = cn.from(i)), this.secondaryOptions = n, this.available = r; 2909 } 2910 } 2911 function Hn(e1, t1, i, n) { 2912 return "number" == typeof e1 && e1 >= 0 && e1 <= 255 && "number" == typeof t1 && t1 >= 0 && t1 <= 255 && "number" == typeof i && i >= 0 && i <= 255 ? void 0 === n || "number" == typeof n && n >= 0 && n <= 1 ? null : "Invalid rgba value [".concat([ 2913 e1, 2914 t1, 2915 i, 2916 n 2917 ].join(", "), "]: 'a' must be between 0 and 1.") : "Invalid rgba value [".concat(("number" == typeof n ? [ 2918 e1, 2919 t1, 2920 i, 2921 n 2922 ] : [ 2923 e1, 2924 t1, 2925 i 2926 ]).join(", "), "]: 'r', 'g', and 'b' must be between 0 and 255."); 2927 } 2928 function $n(e1) { 2929 if (null === e1) return !0; 2930 if ("string" == typeof e1) return !0; 2931 if ("boolean" == typeof e1) return !0; 2932 if ("number" == typeof e1) return !0; 2933 if (e1 instanceof mn) return !0; 2934 if (e1 instanceof Nn) return !0; 2935 if (e1 instanceof Un) return !0; 2936 if (e1 instanceof Gn) return !0; 2937 if (Array.isArray(e1)) { 2938 for (const t1 of e1)if (!$n(t1)) return !1; 2939 return !0; 2940 } 2941 if ("object" == typeof e1) { 2942 for(const t1 in e1)if (!$n(e1[t1])) return !1; 2943 return !0; 2944 } 2945 return !1; 2946 } 2947 function Zn(e1) { 2948 if (null === e1) return An; 2949 if ("string" == typeof e1) return In; 2950 if ("boolean" == typeof e1) return Mn; 2951 if ("number" == typeof e1) return En; 2952 if (e1 instanceof mn) return Tn; 2953 if (e1 instanceof Nn) return Rn; 2954 if (e1 instanceof Un) return Pn; 2955 if (e1 instanceof Gn) return Dn; 2956 if (Array.isArray(e1)) { 2957 const t1 = e1.length; 2958 let i; 2959 for (const t1 of e1){ 2960 const e1 = Zn(t1); 2961 if (i) { 2962 if (i === e1) continue; 2963 i = zn; 2964 break; 2965 } 2966 i = e1; 2967 } 2968 return Fn(i || zn, t1); 2969 } 2970 return Sn; 2971 } 2972 function Wn(e1) { 2973 return null === e1 ? "" : "string" == typeof e1 || "number" == typeof e1 || "boolean" == typeof e1 ? String(e1) : e1 instanceof Un || e1 instanceof Gn || e1 instanceof mn ? e1.toString() : JSON.stringify(e1); 2974 } 2975 class qn { 2976 static parse(e1, t1) { 2977 if (2 !== e1.length) return t1.error("'literal' expression requires exactly one argument, but found ".concat(e1.length - 1, " instead.")); 2978 if (!$n(e1[1])) return t1.error("invalid value"); 2979 const i = e1[1]; 2980 let n = Zn(i); 2981 const r = t1.expectedType; 2982 return "array" !== n.kind || 0 !== n.N || !r || "array" !== r.kind || "number" == typeof r.N && 0 !== r.N || (n = r), new qn(n, i); 2983 } 2984 evaluate() { 2985 return this.value; 2986 } 2987 eachChild() {} 2988 outputDefined() { 2989 return !0; 2990 } 2991 serialize() { 2992 return "array" === this.type.kind || "object" === this.type.kind ? [ 2993 "literal", 2994 this.value 2995 ] : this.value instanceof mn ? [ 2996 "rgba" 2997 ].concat(this.value.toNonPremultipliedRenderColor(null).toArray()) : this.value instanceof Un ? this.value.serialize() : this.value; 2998 } 2999 constructor(e1, t1){ 3000 this.type = e1, this.value = t1; 3001 } 3002 } 3003 class Xn { 3004 toJSON() { 3005 return this.message; 3006 } 3007 constructor(e1){ 3008 this.name = "ExpressionEvaluationError", this.message = e1; 3009 } 3010 } 3011 const Yn = {
vendor: 7,977 bytes, lines 3012-3172
3012 string: In, 3013 number: En, 3014 boolean: Mn, 3015 object: Sn 3016 }; 3017 class Jn { 3018 static parse(e1, t1) { 3019 if (e1.length < 2) return t1.error("Expected at least one argument."); 3020 let i, n = 1; 3021 const r = e1[0]; 3022 if ("array" === r) { 3023 let r, o; 3024 if (e1.length > 2) { 3025 const i = e1[1]; 3026 if ("string" != typeof i || !(i in Yn) || "object" === i) return t1.error('The item type argument of "array" must be one of string, number, boolean', 1); 3027 r = Yn[i], n++; 3028 } else r = zn; 3029 if (e1.length > 3) { 3030 if (null !== e1[2] && ("number" != typeof e1[2] || e1[2] < 0 || e1[2] !== Math.floor(e1[2]))) return t1.error('The length argument to "array" must be a positive integer literal', 2); 3031 o = e1[2], n++; 3032 } 3033 i = Fn(r, o); 3034 } else i = Yn[r]; 3035 const o = []; 3036 for(; n < e1.length; n++){ 3037 const i = t1.parse(e1[n], n, zn); 3038 if (!i) return null; 3039 o.push(i); 3040 } 3041 return new Jn(i, o); 3042 } 3043 evaluate(e1) { 3044 for(let t1 = 0; t1 < this.args.length; t1++){ 3045 const i = this.args[t1].evaluate(e1); 3046 if (!On(this.type, Zn(i))) return i; 3047 if (t1 === this.args.length - 1) throw new Xn("The expression ".concat(JSON.stringify(this.args[t1].serialize()), " evaluated to ").concat(Cn(Zn(i)), " but was expected to be of type ").concat(Cn(this.type), ".")); 3048 } 3049 return null; 3050 } 3051 eachChild(e1) { 3052 this.args.forEach(e1); 3053 } 3054 outputDefined() { 3055 return this.args.every((e1)=>e1.outputDefined()); 3056 } 3057 serialize() { 3058 const e1 = this.type, t1 = [ 3059 e1.kind 3060 ]; 3061 if ("array" === e1.kind) { 3062 const i = e1.itemType; 3063 if ("string" === i.kind || "number" === i.kind || "boolean" === i.kind) { 3064 t1.push(i.kind); 3065 const n = e1.N; 3066 ("number" == typeof n || this.args.length > 1) && t1.push(n); 3067 } 3068 } 3069 return t1.concat(this.args.map((e1)=>e1.serialize())); 3070 } 3071 constructor(e1, t1){ 3072 this.type = e1, this.args = t1; 3073 } 3074 } 3075 class Kn { 3076 static parse(e1, t1) { 3077 if (e1.length < 2) return t1.error("Expected at least one argument."); 3078 const i = e1[1]; 3079 if (!Array.isArray(i) && "object" == typeof i) return t1.error("First argument must be an image or text section."); 3080 const n = []; 3081 let r = !1; 3082 for(let i = 1; i <= e1.length - 1; ++i){ 3083 const o = e1[i]; 3084 if (r && "object" == typeof o && !Array.isArray(o)) { 3085 r = !1; 3086 let e1 = null; 3087 if (o["font-scale"] && (e1 = t1.parseObjectValue(o["font-scale"], i, "font-scale", En), !e1)) return null; 3088 let a = null; 3089 if (o["text-font"] && (a = t1.parseObjectValue(o["text-font"], i, "text-font", Fn(In)), !a)) return null; 3090 let s = null; 3091 if (o["text-color"] && (s = t1.parseObjectValue(o["text-color"], i, "text-color", Tn), !s)) return null; 3092 const l = n.at(-1); 3093 l.scale = e1, l.font = a, l.textColor = s; 3094 } else { 3095 const o = t1.parse(e1[i], i, zn); 3096 if (!o) return null; 3097 const a = o.type.kind; 3098 if ("string" !== a && "value" !== a && "null" !== a && "resolvedImage" !== a) return t1.error("Formatted text type must be 'string', 'value', 'image' or 'null'."); 3099 r = !0, n.push({ 3100 content: o, 3101 scale: null, 3102 font: null, 3103 textColor: null 3104 }); 3105 } 3106 } 3107 return new Kn(n); 3108 } 3109 evaluate(e1) { 3110 return new Un(this.sections.map((t1)=>{ 3111 const i = t1.content.evaluate(e1); 3112 return Vn(Zn(i), Dn) ? new kn("", i, null, null, null) : new kn(Wn(i), null, t1.scale ? t1.scale.evaluate(e1) : null, t1.font ? t1.font.evaluate(e1).join(",") : null, t1.textColor ? t1.textColor.evaluate(e1) : null); 3113 })); 3114 } 3115 eachChild(e1) { 3116 for (const t1 of this.sections)e1(t1.content), t1.scale && e1(t1.scale), t1.font && e1(t1.font), t1.textColor && e1(t1.textColor); 3117 } 3118 outputDefined() { 3119 return !1; 3120 } 3121 serialize() { 3122 const e1 = [ 3123 "format" 3124 ]; 3125 for (const t1 of this.sections){ 3126 e1.push(t1.content.serialize()); 3127 const i = {}; 3128 t1.scale && (i["font-scale"] = t1.scale.serialize()), t1.font && (i["text-font"] = t1.font.serialize()), t1.textColor && (i["text-color"] = t1.textColor.serialize()), e1.push(i); 3129 } 3130 return e1; 3131 } 3132 constructor(e1){ 3133 this.type = Pn, this.sections = e1; 3134 } 3135 } 3136 class Qn { 3137 static parse(e1, t1) { 3138 if (e1.length < 2) return t1.error("Expected two or more arguments."); 3139 let i = 1; 3140 const n = []; 3141 function r() { 3142 if (i < e1.length) { 3143 const r = t1.parse(e1[i], i++, In); 3144 return r ? (n.push({ 3145 image: r, 3146 options: {} 3147 }), !0) : (t1.error(n.length ? "Secondary image variant is not a string." : "No image name provided."), !1); 3148 } 3149 return !0; 3150 } 3151 function o() { 3152 if (i < e1.length) { 3153 const o = e1[i]; 3154 if (null === (r = o) || "object" != typeof r || Array.isArray(r)) return !0; 3155 const a = o.params, s = o.iconset, l = t1.concat(i); 3156 if (!a && !s) return i++, !0; 3157 if (a) { 3158 if ("object" != typeof a || a.constructor !== Object) return l.error('Image options "params" should be an object'), !1; 3159 const e1 = {}, t1 = l.concat(void 0, "params"); 3160 for(const i in a){ 3161 if (!i) return t1.error("Image parameter name should be non-empty"), !1; 3162 const n = t1.concat(void 0, i).parse(a[i], void 0, Tn, void 0, { 3163 typeAnnotation: "coerce" 3164 }); 3165 if (!n) return !1; 3166 e1[i] = n; 3167 } 3168 n.at(-1).options.params = e1; 3169 } 3170 if (s) { 3171 if ("object" != typeof s || s.constructor !== Object) return l.error('Image options "iconset" should be an object'), !1; 3172 if (!s.id) return l.error('Image options "iconset" should have an "i
3172d" property'), !1; 3173 n.at(-1).options.iconset = s; 3174 } 3175 return i++, !0; 3176 } 3177 var r; 3178 return !0; 3179 } 3180 for(let e1 = 0; e1 < 2; e1++)if (!r() || !o()) return; 3181 return new Qn(n[0].image, n[1] ? n[1].image : void 0, n[0].options, n[1] ? n[1].options : void 0); 3182 } 3183 evaluateParams(e1, t1) { 3184 const i = {}; 3185 if (t1) { 3186 for(const n in t1)if (t1[n]) try { 3187 i[n] = t1[n].evaluate(e1); 3188 } catch (e1) { 3189 continue; 3190 } 3191 if (0 !== Object.keys(i).length) return { 3192 params: i 3193 }; 3194 } 3195 } 3196 evaluate(e1) { 3197 const t1 = { 3198 name: this.namePrimary.evaluate(e1), 3199 iconsetId: this.iconsetIdPrimary 3200 }, i = this.nameSecondary ? { 3201 name: this.nameSecondary.evaluate(e1), 3202 iconsetId: this.iconsetIdSecondary 3203 } : void 0, n = Gn.build(t1, i, this.paramsPrimary ? this.evaluateParams(e1, this.paramsPrimary) : void 0, this.paramsSecondary ? this.evaluateParams(e1, this.paramsSecondary) : void 0); 3204 if (n && e1.availableImages) { 3205 const t1 = n.getPrimary().id; 3206 if (n.available = e1.availableImages.some((e1)=>cn.isEqual(e1, t1)), n.available) { 3207 const t1 = n.getSecondary() ? n.getSecondary().id : null; 3208 t1 && (n.available = e1.availableImages.some((e1)=>cn.isEqual(e1, t1))); 3209 } 3210 } 3211 return n; 3212 } 3213 eachChild(e1) { 3214 if (e1(this.namePrimary), this.paramsPrimary) for(const t1 in this.paramsPrimary)this.paramsPrimary[t1] && e1(this.paramsPrimary[t1]); 3215 if (this.nameSecondary && (e1(this.nameSecondary), this.paramsSecondary)) for(const t1 in this.paramsSecondary)this.paramsSecondary[t1] && e1(this.paramsSecondary[t1]); 3216 } 3217 outputDefined() { 3218 return !1; 3219 } 3220 serializeOptions(e1, t1) { 3221 const i = {}; 3222 if (t1 && (i.iconset = { 3223 id: t1 3224 }), e1) { 3225 i.params = {}; 3226 for(const t1 in e1)e1[t1] && (i.params[t1] = e1[t1].serialize()); 3227 } 3228 return Object.keys(i).length > 0 ? i : void 0; 3229 } 3230 serialize() { 3231 const e1 = [ 3232 "image", 3233 this.namePrimary.serialize() 3234 ]; 3235 if (this.paramsPrimary || this.iconsetIdPrimary) { 3236 const t1 = this.serializeOptions(this.paramsPrimary, this.iconsetIdPrimary); 3237 t1 && e1.push(t1); 3238 } 3239 if (this.nameSecondary && (e1.push(this.nameSecondary.serialize()), this.paramsSecondary || this.iconsetIdSecondary)) { 3240 const t1 = this.serializeOptions(this.paramsSecondary, this.iconsetIdSecondary); 3241 t1 && e1.push(t1); 3242 } 3243 return e1; 3244 } 3245 constructor(e1, t1, i, n){ 3246 this._imageWarnHistory = {}, this.type = Dn, this.namePrimary = e1, this.nameSecondary = t1, i && (this.paramsPrimary = i.params, this.iconsetIdPrimary = i.iconset ? i.iconset.id : void 0), n && (this.paramsSecondary = n.params, this.iconsetIdSecondary = n.iconset ? n.iconset.id : void 0); 3247 } 3248 } 3249 function er(e1) { 3250 return ir(e1) ? "string" : nr(e1) ? "number" : rr(e1) ? "boolean" : Array.isArray(e1) ? "array" : null === e1 ? "null" : tr(e1) ? "object" : typeof e1; 3251 } 3252 function tr(e1) { 3253 return null != e1 && !Array.isArray(e1) && "function" != typeof e1 && !(e1 instanceof String || e1 instanceof Number || e1 instanceof Boolean) && "object" == typeof e1; 3254 } 3255 function ir(e1) { 3256 return "string" == typeof e1 || e1 instanceof String; 3257 } 3258 function nr(e1) { 3259 return "number" == typeof e1 || e1 instanceof Number; 3260 } 3261 function rr(e1) { 3262 return "boolean" == typeof e1 || e1 instanceof Boolean; 3263 } 3264 const or = { 3265 "to-boolean": Mn, 3266 "to-color": Tn, 3267 "to-number": En, 3268 "to-string": In 3269 }; 3270 class ar { 3271 static parse(e1, t1) { 3272 if (e1.length < 2) return t1.error("Expected at least one argument."); 3273 const i = e1[0], n = []; 3274 let r = An; 3275 if ("to-array" === i) { 3276 if (!Array.isArray(e1[1])) return null; 3277 const i = e1[1].length; 3278 if (t1.expectedType) { 3279 if ("array" !== t1.expectedType.kind) return t1.error("Expected ".concat(t1.expectedType.kind, " but found array.")); 3280 r = Fn(t1.expectedType.itemType, i); 3281 } else { 3282 if (!(i > 0 && $n(e1[1][0]))) return null; 3283 r = Fn(Zn(e1[1][0]), i); 3284 } 3285 for(let o = 0; o < i; o++){ 3286 const i = e1[1][o]; 3287 let a; 3288 if (Array.isArray(i)) a = t1.parse(i, void 0, r.itemType); 3289 else { 3290 const e1 = er(i); 3291 if (e1 !== r.itemType.kind) return t1.error("Expected ".concat(r.itemType.kind, " but found ").concat(e1, ".")); 3292 a = t1.registry.literal.parse([ 3293 "literal", 3294 void 0 === i ? null : i 3295 ], t1); 3296 } 3297 if (!a) return null; 3298 n.push(a); 3299 } 3300 } else { 3301 if (("to-boolean" === i || "to-string" === i) && 2 !== e1.length) return t1.error("Expected one argument."); 3302 r = or[i]; 3303 for(let i = 1; i < e1.length; i++){ 3304 const r = t1.parse(e1[i], i, zn); 3305 if (!r) return null; 3306 n.push(r); 3307 } 3308 } 3309 return new ar(r, n); 3310 } 3311 evaluate(e1) { 3312 if ("boolean" === this.type.kind) return Boolean(this.args[0].evaluate(e1)); 3313 if ("color" === this.type.kind) { 3314 let t1, i; 3315 for (const n of this.args){ 3316 if (t1 = n.evaluate(e1), i = null, t1 instanceof mn) return t1; 3317 if ("string" == typeof t1) {
3318 const i = e1.parseColor(t1); 3319 if (i) return i; 3320 } else if (Array.isArray(t1) && (i = t1.length < 3 || t1.length > 4 ? "Invalid rbga value ".concat(JSON.stringify(t1), ": expected an array containing either three or four numeric values.") : Hn(t1[0], t1[1], t1[2], t1[3]), !i)) return new mn(t1[0] / 255, t1[1] / 255, t1[2] / 255, t1[3]); 3321 } 3322 throw new Xn(i || "Could not parse color from value '".concat("string" == typeof t1 ? t1 : String(JSON.stringify(t1)), "'")); 3323 } 3324 if ("number" === this.type.kind) { 3325 let t1 = null; 3326 for (const i of this.args){ 3327 if (t1 = i.evaluate(e1), null === t1) return 0; 3328 const n = Number(t1); 3329 if (!isNaN(n)) return n; 3330 } 3331 throw new Xn("Could not convert ".concat(JSON.stringify(t1), " to number.")); 3332 } 3333 return "formatted" === this.type.kind ? Un.fromString(Wn(this.args[0].evaluate(e1))) : "resolvedImage" === this.type.kind ? Gn.build(Wn(this.args[0].evaluate(e1))) : "array" === this.type.kind ? this.args.map((t1)=>t1.evaluate(e1)) : Wn(this.args[0].evaluate(e1)); 3334 } 3335 eachChild(e1) { 3336 this.args.forEach(e1); 3337 } 3338 outputDefined() { 3339 return this.args.every((e1)=>e1.outputDefined()); 3340 } 3341 serialize() { 3342 if ("formatted" === this.type.kind) return new Kn([ 3343 { 3344 content: this.args[0], 3345 scale: null, 3346 font: null, 3347 textColor: null 3348 } 3349 ]).serialize(); 3350 if ("resolvedImage" === this.type.kind) return new Qn(this.args[0]).serialize(); 3351 const e1 = "array" === this.type.kind ? [] : [ 3352 "to-".concat(this.type.kind) 3353 ]; 3354 return this.eachChild((t1)=>{ 3355 e1.push(t1.serialize()); 3356 }), e1; 3357 } 3358 constructor(e1, t1){ 3359 this.type = e1, this.args = t1; 3360 } 3361 } 3362 const sr = [ 3363 "Unknown", 3364 "Point", 3365 "LineString", 3366 "Polygon" 3367 ]; 3368 class lr { 3369 id() { 3370 return this.feature && void 0 !== this.feature.id ? this.feature.id : null; 3371 } 3372 geometryType() { 3373 return this.feature ? "number" == typeof this.feature.type ? sr[this.feature.type] : this.feature.type : null; 3374 } 3375 geometry() { 3376 return this.feature && "geometry" in this.feature ? this.feature.geometry : null; 3377 } 3378 canonicalID() { 3379 return this.canonical; 3380 } 3381 properties() { 3382 return this.feature && this.feature.properties || {}; 3383 } 3384 measureLight(e1) { 3385 return this.globals.brightness || 0; 3386 } 3387 distanceFromCenter() { 3388 if (this.featureTileCoord && this.featureDistanceData) { 3389 const e1 = this.featureDistanceData.center, t1 = this.featureDistanceData.scale, { x: i, y: n } = this.featureTileCoord; 3390 return this.featureDistanceData.bearing[0] * (i * t1 - e1[0]) + this.featureDistanceData.bearing[1] * (n * t1 - e1[1]); 3391 } 3392 return 0; 3393 } 3394 parseColor(e1) { 3395 return mn.parse(e1); 3396 } 3397 getConfig(e1) { 3398 return this.options ? this.options.get(e1) : null; 3399 } 3400 constructor(e1, t1, i){ 3401 this.globals = null, this.feature = null, this.featureState = null, this.formattedSection = null, this.availableImages = null, this.canonical = null, this.featureTileCoord = null, this.featureDistanceData = null, this.scope = e1, this.options = t1, this.iconImageUseTheme = i; 3402 } 3403 } 3404 class cr { 3405 evaluate(e1) { 3406 if (!this._evaluate) { 3407 const e1 = cr.definitions[this.name]; 3408 this._evaluate = Array.isArray(e1) ? e1[2] : e1.overloads[this._overloadIndex][1]; 3409 } 3410 return this._evaluate(e1, this.args); 3411 } 3412 eachChild(e1) {
3413 this.args.forEach(e1); 3414 } 3415 outputDefined() { 3416 return !1; 3417 } 3418 serialize() { 3419 return [ 3420 this.name 3421 ].concat(this.args.map((e1)=>e1.serialize())); 3422 } 3423 static parse(e1, t1) { 3424 const i = e1[0], n = cr.definitions[i]; 3425 if (!n) return t1.error('Unknown expression "'.concat(i, '". If you wanted a literal array, use ["literal", [...]].'), 0); 3426 const r = Array.isArray(n) ? n[0] : n.type, o = Array.isArray(n) ? [ 3427 [ 3428 n[1], 3429 n[2] 3430 ] 3431 ] : n.overloads, a = []; 3432 let s = null, l = -1; 3433 for (const [n, c] of o){ 3434 if (Array.isArray(n) && n.length !== e1.length - 1) continue; 3435 a.push(n), l++, null === s ? s = t1._forkForSignature() : s.errors.length = 0; 3436 const o = []; 3437 let u = !1; 3438 for(let t1 = 1; t1 < e1.length; t1++){ 3439 const i = e1[t1], r = Array.isArray(n) ? n[t1 - 1] : n.type, a = s.parse(i, 1 + o.length, r); 3440 if (!a) { 3441 u = !0; 3442 break; 3443 } 3444 o.push(a); 3445 } 3446 if (!u) if (Array.isArray(n) && n.length !== o.length) s.error("Expected ".concat(n.length, " arguments, but found ").concat(o.length, " instead.")); 3447 else { 3448 for(let e1 = 0; e1 < o.length; e1++){ 3449 const t1 = Array.isArray(n) ? n[e1] : n.type; 3450 s.checkSubtype(t1, o[e1].type, e1 + 1); 3451 } 3452 if (0 === s.errors.length) return new cr(i, r, c, o, l); 3453 } 3454 } 3455 if (1 === a.length) t1.errors.push(...s.errors); 3456 else { 3457 const i = (a.length ? a : o.map((param)=>{ 3458 let [e1] = param; 3459 return e1; 3460 })).map(ur).join(" | "), n = []; 3461 for(let i = 1; i < e1.length; i++){ 3462 const r = t1.parse(e1[i], 1 + n.length); 3463 if (!r) return null; 3464 n.push(Cn(r.type)); 3465 } 3466 t1.error("Expected arguments of type ".concat(i, ", but found (").concat(n.join(", "), ") instead.")); 3467 } 3468 return null; 3469 } 3470 static register(e1, t1) { 3471 cr.definitions = t1; 3472 for(const i in t1)e1[i] = cr; 3473 } 3474 constructor(e1, t1, i, n, r){ 3475 this.name = e1, this.type = t1, this._evaluate = i, this.args = n, this._overloadIndex = r; 3476 } 3477 } 3478 function ur(e1) { 3479 return Array.isArray(e1) ? "(".concat(e1.map(Cn).join(", "), ")") : "(".concat(Cn(e1.type), "...)"); 3480 } 3481 class hr { 3482 static parse(e1, t1) { 3483 if (2 !== e1.length) return t1.error("Expected one argument."), null; 3484 const i = e1[1]; 3485 if ("object" != typeof i || Array.isArray(i)) return t1.error("Collator options argument must be an object."), null; 3486 const n = void 0 === i["case-sensitive"] ? t1.parse(!1, 1, Mn) : t1.parseObjectValue(i["case-sensitive"], 1, "case-sensitive", Mn); 3487 if (!n) return null; 3488 const r = void 0 === i["diacritic-sensitive"] ? t1.parse(!1, 1, Mn) : t1.parseObjectValue(i["diacritic-sensitive"], 1, "diacritic-sensitive", Mn); 3489 if (!r) return null; 3490 let o = null; 3491 return i.locale && (o = t1.parseObjectValue(i.locale, 1, "locale", In), !o) ? null : new hr(n, r, o); 3492 } 3493 evaluate(e1) { 3494 return new Nn(this.caseSensitive.evaluate(e1), this.diacriticSensitive.evaluate(e1), this.locale ? this.locale.evaluate(e1) : null); 3495 } 3496 eachChild(e1) { 3497 e1(this.caseSensitive), e1(this.diacriticSensitive), this.locale && e1(this.locale); 3498 } 3499 outputDefined() { 3500 return !1; 3501 } 3502 serialize() { 3503 const e1 = {}; 3504 return e1["case-sensitive"] = this.caseSensitive.serialize(), e1["diacritic-sensitive"] = this.diacriticSensitive.serialize(), this.locale && (e1.locale = this.locale.serialize()), [ 3505 "collator", 3506 e1 3507 ]; 3508 } 3509 constructor(e1, t1, i){ 3510 this.type = Rn, this.locale = i, this.caseSensitive = e1, this.diacriticSensitive = t1; 3511 } 3512 } 3513 function dr(e1) { 3514 return (180 + e1) / 360; 3515 } 3516 function fr(e1) { 3517 return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + e1 * Math.PI / 360))) / 360; 3518 } 3519 function pr(e1) { 3520 return 360 * e1 - 180; 3521 } 3522 function mr(e1) { 3523 return 360 / Math.PI * Math.atan(Math.exp((180 - 360 * e1) * Math.PI / 180)) - 90; 3524 } 3525 const _r = 8192; 3526 function gr(e1, t1) { 3527 const i = dr(e1[0]), n = fr(e1[1]), r = Math.pow(2, t1.z); 3528 return [ 3529 Math.round(i * r * _r), 3530 Math.round(n * r * _r) 3531 ]; 3532 } 3533 function yr(e1, t1) { 3534 for(let i = 0; i < t1.length; i++)if (He(e1, t1[i])) return !0; 3535 return !1; 3536 } 3537 function xr(e1, t1, i) { 3538 for (const n of i)for(let i = 0, r = n.length, o = r - 1; i < r; o = i++)if (Ze(e1, t1, n[o], n[i])) return !0; 3539 return !1; 3540 } 3541 function vr(e1, t1) { 3542 for(let i = 0; i < e1.length; ++i)if (!He(e1[i], t1)) return !1; 3543 for(let i = 0; i < e1.length - 1; ++i)if (xr(e1[i], e1[i + 1], t1)) return !1; 3544 return !0; 3545 } 3546 function br(e1, t1) { 3547 for(let i = 0; i < t1.length; i++)if (vr(e1, t1[i])) return !0; 3548 return !1; 3549 } 3550 function wr(e1, t1, i) { 3551 const n = []; 3552 for(let r = 0;
3552 r < e1.length; r++){ 3553 const o = []; 3554 for(let n = 0; n < e1[r].length; n++){ 3555 const a = gr(e1[r][n], i); 3556 ke(t1, a), o.push(a); 3557 } 3558 n.push(o); 3559 } 3560 return n; 3561 } 3562 function Ar(e1, t1, i) { 3563 const n = []; 3564 for(let r = 0; r < e1.length; r++){ 3565 const o = wr(e1[r], t1, i); 3566 n.push(o); 3567 } 3568 return n; 3569 } 3570 function Er(e1, t1, i, n) { 3571 if (e1[0] < i[0] || e1[0] > i[2]) { 3572 const t1 = .5 * n; 3573 let r = e1[0] - i[0] > t1 ? -n : i[0] - e1[0] > t1 ? n : 0; 3574 0 === r && (r = e1[0] - i[2] > t1 ? -n : i[2] - e1[0] > t1 ? n : 0), e1[0] += r; 3575 } 3576 ke(t1, e1); 3577 } 3578 function Ir(e1, t1, i, n) { 3579 const r = Math.pow(2, n.z) * _r, o = [ 3580 n.x * _r, 3581 n.y * _r 3582 ], a = []; 3583 if (!e1) return a; 3584 for (const n of e1)for (const e1 of n){ 3585 const n = [ 3586 e1.x + o[0], 3587 e1.y + o[1] 3588 ]; 3589 Er(n, t1, i, r), a.push(n); 3590 } 3591 return a; 3592 } 3593 function Mr(e1, t1, i, n) { 3594 const r = Math.pow(2, n.z) * _r, o = [ 3595 n.x * _r, 3596 n.y * _r 3597 ], a = []; 3598 if (!e1) return a; 3599 for (const i of e1){ 3600 const e1 = []; 3601 for (const n of i){ 3602 const i = [ 3603 n.x + o[0], 3604 n.y + o[1] 3605 ]; 3606 ke(t1, i), e1.push(i); 3607 } 3608 a.push(e1); 3609 } 3610 if (t1[2] - t1[0] <= r / 2) { 3611 (s = t1)[0] = s[1] = 1 / 0, s[2] = s[3] = -1 / 0; 3612 for (const e1 of a)for (const n of e1)Er(n, t1, i, r); 3613 } 3614 var s; 3615 return a; 3616 } 3617 class Tr { 3618 static parse(e1, t1) { 3619 if (2 !== e1.length) return t1.error("'within' expression requires exactly one argument, but found ".concat(e1.length - 1, " instead.")); 3620 if ($n(e1[1])) { 3621 const t1 = e1[1]; 3622 if ("FeatureCollection" === t1.type) for(let e1 = 0; e1 < t1.features.length; ++e1){ 3623 const i = t1.features[e1].geometry.type; 3624 if ("Polygon" === i || "MultiPolygon" === i) return new Tr(t1, t1.features[e1].geometry); 3625 } 3626 else if ("Feature" === t1.type) { 3627 const e1 = t1.geometry.type; 3628 if ("Polygon" === e1 || "MultiPolygon" === e1) return new Tr(t1, t1.geometry); 3629 } else if ("Polygon" === t1.type || "MultiPolygon" === t1.type) return new Tr(t1, t1); 3630 } 3631 return t1.error("'within' expression requires valid geojson object that contains polygon geometry type."); 3632 } 3633 evaluate(e1) { 3634 if (null != e1.geometry() && null != e1.canonicalID()) { 3635 if ("Point" === e1.geometryType()) return function(e1, t1) { 3636 const i = [ 3637 1 / 0, 3638 1 / 0, 3639 -1 / 0, 3640 -1 / 0 3641 ], n = [ 3642 1 / 0, 3643 1 / 0, 3644 -1 / 0, 3645 -1 / 0 3646 ], r = e1.canonicalID(); 3647 if (!r) return !1; 3648 if ("Polygon" === t1.type) { 3649 const o = wr(t1.coordinates, n, r), a = Ir(e1.geometry(), i, n, r); 3650 if (!Ue(i, n)) return !1; 3651 for (const e1 of a)if (!He(e1, o)) return !1; 3652 } 3653 if ("MultiPolygon" === t1.type) { 3654 const o = Ar(t1.coordinates, n, r), a = Ir(e1.geometry(), i, n, r); 3655 if (!Ue(i, n)) return !1; 3656 for (const e1 of a)if (!yr(e1, o)) return !1; 3657 } 3658 return !0; 3659 }(e1, this.geometries); 3660 if ("LineString" === e1.geometryType()) return function(e1, t1) { 3661 const i = [ 3662 1 / 0, 3663 1 / 0, 3664 -1 / 0, 3665 -1 / 0 3666 ], n = [ 3667 1 / 0, 3668 1 / 0, 3669 -1 / 0, 3670 -1 / 0 3671 ], r = e1.canonicalID(); 3672 if (!r) return !1; 3673 if ("Polygon" === t1.type) { 3674 const o = wr(t1.coordinates, n, r), a = Mr(e1.geometry(), i, n, r); 3675 if (!Ue(i, n)) return !1; 3676 for (const e1 of a)if (!vr(e1, o)) return !1; 3677 } 3678 if ("MultiPolygon" === t1.type) { 3679 const o = Ar(t1.coordinates, n, r), a = Mr(e1.geometry(), i, n, r); 3680 if (!Ue(i, n)) return !1; 3681 for (const e1 of a)if (!br(e1, o)) return !1; 3682 } 3683 return !0; 3684 }(e1, this.geometries); 3685 } 3686 return !1; 3687 } 3688 eachChild() {} 3689 outputDefined() { 3690 return !0; 3691 } 3692 serialize() { 3693 return [ 3694 "within", 3695 this.geojson 3696 ]; 3697 } 3698 constructor(e1, t1){ 3699 this.type = Mn, this.geojson = e1, this.geometries = t1; 3700 } 3701 } 3702 class Sr { 3703 push(e1) { 3704 this.data.push(e1), this._up(this.length++); 3705 } 3706 pop() { 3707 if (0 === this.length) return; 3708 const e1 = this.data[0], t1 = this.data.pop(); 3709 return --this.length > 0 && (this.data[0] = t1, this._down(0)), e1; 3710 } 3711 peek() { 3712 return this.data[0]; 3713 } 3714 _up(e1) { 3715 const { data: t1, compare: i } = this, n = t1[e1]; 3716 for(; e1 > 0;){ 3717 const r = e1 - 1 >> 1, o = t1[r]; 3718 if (i(n, o) >= 0) break; 3719 t1[e1] = o, e1 = r; 3720 } 3721 t1[e1] = n; 3722 } 3723 _down(e1) { 3724 const { data: t1, compare: i } = this, n = this.length >> 1, r = t1[e1]; 3725 for(; e1 < n;){ 3726 let n = 1 + (e1 << 1); 3727 const o = n + 1; 3728 if (o < this.length && i(t1[o], t1[n]) < 0 && (n = o), i(t1[n], r) >= 0) break; 3729 t1[e1] = t1[n], e1 = n; 3730 } 3731 t1[e1] = r; 3732 } 3733 constructor(e1 = [], t1 = (e1, t1)=>e1 < t1 ? -1 : e1 > t1 ? 1 : 0){
3734 if (this.data = e1, this.length = this.data.length, this.compare = t1, this.length > 0) for(let e1 = (this.length >> 1) - 1; e1 >= 0; e1--)this._down(e1); 3735 } 3736 } 3737 var zr = 8192; 3738 function Rr(e1, t1, i) { 3739 return [ 3740 e1, 3741 t1, 3742 i 3743 ].filter(Boolean).join("�"); 3744 } 3745 function Pr(e1, t1) { 3746 switch(e1){ 3747 case "string": 3748 return Wn(t1); 3749 case "number": 3750 return +t1; 3751 case "boolean": 3752 return !!t1; 3753 case "color": 3754 return mn.parse(t1); 3755 case "formatted": 3756 return Un.fromString(Wn(t1)); 3757 case "resolvedImage": 3758 return Gn.build(Wn(t1)); 3759 } 3760 return t1; 3761 } 3762 function Dr(e1, t1, i, n) { 3763 return void 0 !== n && (e1 = n * Math.round(e1 / n)), void 0 !== t1 && e1 < t1 && (e1 = t1), void 0 !== i && e1 > i && (e1 = i), e1; 3764 } 3765 class Fr { 3766 static parse(e1, t1) { 3767 let i = t1.expectedType; 3768 if (i !== null && i !== void 0 ? i : i = zn, e1.length < 2 || e1.length > 3) return t1.error("Invalid number of arguments for 'config' expression."); 3769 const n = t1.parse(e1[1], 1); 3770 if (!(n instanceof qn)) return t1.error("Key name of 'config' expression must be a string literal."); 3771 let r, o = !0; 3772 const a = Wn(n.value); 3773 if (e1.length >= 3) { 3774 const i = t1.parse(e1[2], 2); 3775 if (!(i instanceof qn)) return t1.error("Scope of 'config' expression must be a string literal."); 3776 r = Wn(i.value); 3777 } 3778 if (t1.options) { 3779 const e1 = Rr(a, r, t1._scope), i = t1.options.get(e1); 3780 i && (o = Cr(i.value || i.default)); 3781 } 3782 return new Fr(i, a, r, o); 3783 } 3784 evaluate(e1) { 3785 const t1 = Rr(this.key, this.scope, e1.scope), i = e1.getConfig(t1); 3786 if (!i) return null; 3787 const { type: n, value: r, values: o, minValue: a, maxValue: s, stepValue: l } = i, c = i.default.evaluate(e1); 3788 let u = c; 3789 if (r) { 3790 const t1 = e1.scope; 3791 e1.scope = (t1 || "").split("�").slice(1).join("�"), u = r.evaluate(e1), e1.scope = t1; 3792 } 3793 return n && (u = Pr(n, u)), void 0 === u || void 0 === a && void 0 === s && void 0 === l || ("number" == typeof u ? u = Dr(u, a, s, l) : Array.isArray(u) && (u = u.map((e1)=>"number" == typeof e1 ? Dr(e1, a, s, l) : e1))), void 0 !== r && void 0 !== u && o && !o.includes(u) && (u = c, n && (u = Pr(n, u))), (n && n !== this.type || void 0 !== u && !Vn(Zn(u), this.type)) && (u = Pr(this.type.kind, u)), u; 3794 } 3795 eachChild() {} 3796 outputDefined() { 3797 return !1; 3798 } 3799 serialize() { 3800 const e1 = [ 3801 "config", 3802 this.key 3803 ]; 3804 return this.scope && e1.concat(this.scope), e1; 3805 } 3806 constructor(e1, t1, i, n = !1){ 3807 this.type = e1, this.key = t1, this.scope = i, this.featureConstant = n; 3808 } 3809 } 3810 function Cr(e1) { 3811 if (e1 instanceof cr) { 3812 if ("get" === e1.name && 1 === e1.args.length) return !1; 3813 if ("feature-state" === e1.name) return !1; 3814 if ("has" === e1.name && 1 === e1.args.length) return !1; 3815 if ("properties" === e1.name || "geometry-type" === e1.name || "id" === e1.name) return !1; 3816 if (e1.name.startsWith("filter-")) return !1; 3817 } 3818 if (e1 instanceof Tr) return !1; 3819 if (e1 instanceof bo) return !1; 3820 if (e1 instanceof Fr) return e1.featureConstant; 3821 let t1 = !0; 3822 return e1.eachChild((e1)=>{ 3823 t1 && !Cr(e1) && (t1 = !1); 3824 }), t1; 3825 } 3826 function Lr(e1) { 3827 if (e1 instanceof cr && "feature-state" === e1.name) return !1; 3828 let t1 = !0; 3829 return e1.eachChild((e1)=>{ 3830 t1 && !Lr(e1) && (t1 = !1); 3831 }), t1; 3832 } 3833 function Or(e1, t1) { 3834 if (e1 instanceof cr && t1.has(e1.name)) return !1; 3835 let i = !0; 3836 return e1.eachChild((e1)=>{ 3837 i && !Or(e1, t1) && (i = !1); 3838 }), i; 3839 } 3840 function Br(e1, t1) { 3841 return Or(e1, new Set(t1)); 3842 } 3843 const Vr = 1 / 298.257223563, Nr = Vr * (2 - Vr), kr = Math.PI / 180; 3844 function Ur(e1) { 3845 const t1 = 6378.137 * kr * 1e3, i = Math.cos(e1 * kr), n = 1 / (1 -
3845Nr * (1 - i * i)), r = Math.sqrt(n); 3846 return [ 3847 t1 * r * i, 3848 t1 * r * n * (1 - Nr) 3849 ]; 3850 } 3851 function jr(e1) { 3852 for(; e1 < -180;)e1 += 360; 3853 for(; e1 > 180;)e1 -= 360; 3854 return e1; 3855 } 3856 function Gr(e1, t1, i, n) { 3857 const r = jr(e1[0] - t1[0]) * i, o = (e1[1] - t1[1]) * n; 3858 return Math.sqrt(r * r + o * o); 3859 } 3860 function Hr(e1, t1, i, n, r) { 3861 let o = t1[0], a = t1[1], s = jr(i[0] - o) * n, l = (i[1] - a) * r; 3862 if (0 !== s || 0 !== l) { 3863 const t1 = (jr(e1[0] - o) * n * s + (e1[1] - a) * r * l) / (s * s + l * l); 3864 t1 > 1 ? (o = i[0], a = i[1]) : t1 > 0 && (o += s / n * t1, a += l / r * t1); 3865 } 3866 return s = jr(e1[0] - o) * n, l = (e1[1] - a) * r, Math.sqrt(s * s + l * l); 3867 } 3868 function $r(e1, t1) { 3869 return t1.dist - e1.dist; 3870 } 3871 function Zr(e1) { 3872 const t1 = [ 3873 1 / 0, 3874 1 / 0, 3875 -1 / 0, 3876 -1 / 0 3877 ]; 3878 if (t1.length !== e1.length) return !1; 3879 for(let i = 0; i < t1.length; i++)if (t1[i] !== e1[i]) return !1; 3880 return !0; 3881 } 3882 function Wr(e1) { 3883 return e1[1] - e1[0] + 1; 3884 } 3885 function qr(e1, t1) { 3886 const i = e1[1] >= e1[0] && e1[1] < t1; 3887 return i || console.warn("Distance Expression: Index is out of range"), i; 3888 } 3889 function Xr(e1, t1) { 3890 if (e1[0] > e1[1]) return [ 3891 null, 3892 null 3893 ]; 3894 const i = Wr(e1); 3895 if (t1) { 3896 if (2 === i) return [ 3897 e1, 3898 null 3899 ]; 3900 const t1 = Math.floor(i / 2); 3901 return [ 3902 [ 3903 e1[0], 3904 e1[0] + t1 3905 ], 3906 [ 3907 e1[0] + t1, 3908 e1[1] 3909 ] 3910 ]; 3911 } 3912 { 3913 if (1 === i) return [ 3914 e1, 3915 null 3916 ]; 3917 const t1 = Math.floor(i / 2) - 1; 3918 return [ 3919 [ 3920 e1[0], 3921 e1[0] + t1 3922 ], 3923 [ 3924 e1[0] + t1 + 1, 3925 e1[1] 3926 ] 3927 ]; 3928 } 3929 } 3930 function Yr(e1, t1) { 3931 const i = [ 3932 1 / 0, 3933 1 / 0, 3934 -1 / 0, 3935 -1 / 0 3936 ]; 3937 if (!qr(t1, e1.length)) return i; 3938 for(let n = t1[0]; n <= t1[1]; ++n)ke(i, e1[n]); 3939 return i; 3940 } 3941 function Jr(e1) { 3942 const t1 = [ 3943 1 / 0, 3944 1 / 0, 3945 -1 / 0, 3946 -1 / 0 3947 ]; 3948 for(let i = 0; i < e1.length; ++i)for(let n = 0; n < e1[i].length; ++n)ke(t1, e1[i][n]); 3949 return t1; 3950 } 3951 function Kr(e1, t1, i, n) { 3952 if (Zr(e1) || Zr(t1)) return NaN; 3953 let r = 0, o = 0; 3954 return e1[2] < t1[0] && (r = t1[0] - e1[2]), e1[0] > t1[2] && (r = e1[0] - t1[2]), e1[1] > t1[3] && (o = e1[1] - t1[3]), e1[3] < t1[1] && (o = t1[1] - e1[3]), Gr([ 3955 0, 3956 0 3957 ], [ 3958 r, 3959 o 3960 ], i, n); 3961 } 3962 function Qr(e1, t1) { 3963 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 8192; 3964 const n = Math.pow(2, t1.z), r = (e1.y / i + t1.y) / n; 3965 return [ 3966 pr((e1.x / i + t1.x) / n), 3967 mr(r) 3968 ]; 3969 } 3970 function eo(e1, t1) { 3971 const i = []; 3972 for(let n = 0; n < e1.length; ++n)i.push(Qr(e1[n], t1)); 3973 return i; 3974 } 3975 function to(e1, t1, i, n) { 3976 const r = function(e1, t1, i, n) { 3977 let r = 1 / 0, o = e1[0][0], a = e1[0][1]; 3978 for(let s = 0; s < e1.length - 1; s++){ 3979 let l = e1[s][0], c = e1[s][1], u = jr(e1[s + 1][0] - l) * i, h = (e1[s + 1][1] - c) * n, d = 0; 3980 0 === u && 0 === h || (d = (jr(t1[0] - l) * i * u + (t1[1] - c) * n * h) / (u * u + h * h), d > 1 ? (l = e1[s + 1][0], c = e1[s + 1][1]) : d > 0 && (l += u / i * d, c += h / n * d)), u = jr(t1[0] - l) * i, h = (t1[1] - c) * n; 3981 const f = u * u + h * h; 3982 f < r && (r = f, o = l, a = c); 3983 } 3984 return [ 3985 o, 3986 a 3987 ]; 3988 }(t1, e1, i, n); 3989 return Gr(e1, r, i, n); 3990 } 3991 function io(e1, t1, i, n, r, o) { 3992 const a = i.slice(n[0], n[1] + 1); 3993 let s = 1 / 0; 3994 for(let i = t1[0]; i <= t1[1]; ++i)if (0 === (s = Math.min(s, to(e1[i], a, r, o)))) return 0; 3995 return s; 3996 } 3997 function no(e1, t1, i, n, r, o) { 3998 const a = Math.min(Hr(e1, i, n, r, o), Hr(t1, i, n, r, o)), s = Math.min(Hr(i, e1, t1, r, o), Hr(n, e1, t1, r, o)); 3999 return Math.min(a, s); 4000 } 4001 function ro(e1, t1, i, n, r, o) { 4002 if (!qr(t1, e1.length) || !qr(n, i.length)) return NaN; 4003 let a = 1 / 0; 4004 for(let s = t1[0]; s < t1[1]; ++s)for(let t1 = n[0]; t1 < n[1]; ++t1){
4005 if (Ze(e1[s], e1[s + 1], i[t1], i[t1 + 1])) return 0; 4006 a = Math.min(a, no(e1[s], e1[s + 1], i[t1], i[t1 + 1], r, o)); 4007 } 4008 return a; 4009 } 4010 function oo(e1, t1, i, n, r, o) { 4011 if (!qr(t1, e1.length) || !qr(n, i.length)) return NaN; 4012 let a = 1 / 0; 4013 for(let s = t1[0]; s <= t1[1]; ++s)for(let t1 = n[0]; t1 <= n[1]; ++t1)if (0 === (a = Math.min(a, Gr(e1[s], i[t1], r, o)))) return a; 4014 return a; 4015 } 4016 function ao(e1, t1, i, n) { 4017 if (He(e1, t1, !0)) return 0; 4018 let r = 1 / 0; 4019 for (const o of t1){ 4020 const t1 = o.length; 4021 if (t1 < 2) return console.warn("Distance Expression: Invalid polygon!"), NaN; 4022 if (o[0] !== o[t1 - 1] && 0 === (r = Math.min(r, Hr(e1, o[t1 - 1], o[0], i, n)))) return r; 4023 if (0 === (r = Math.min(r, to(e1, o, i, n)))) return r; 4024 } 4025 return r; 4026 } 4027 function so(e1, t1, i, n, r) { 4028 if (!qr(t1, e1.length)) return NaN; 4029 for(let n = t1[0]; n <= t1[1]; ++n)if (He(e1[n], i, !0)) return 0; 4030 let o = 1 / 0; 4031 for(let a = t1[0]; a < t1[1]; ++a)for (const t1 of i)for(let i = 0, s = t1.length, l = s - 1; i < s; l = i++){ 4032 if (Ze(e1[a], e1[a + 1], t1[l], t1[i])) return 0; 4033 o = Math.min(o, no(e1[a], e1[a + 1], t1[l], t1[i], n, r)); 4034 } 4035 return o; 4036 } 4037 function lo(e1, t1) { 4038 for (const i of e1)for(let e1 = 0; e1 <= i.length - 1; ++e1)if (He(i[e1], t1, !0)) return !0; 4039 return !1; 4040 } 4041 function co(e1, t1, i, n) { 4042 let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1 / 0; 4043 const o = Jr(e1), a = Jr(t1); 4044 if (r !== 1 / 0 && Kr(o, a, i, n) >= r) return r; 4045 if (Ue(o, a)) { 4046 if (lo(e1, t1)) return 0; 4047 } else if (lo(t1, e1)) return 0; 4048 let s = r; 4049 for (const r of e1)for(let e1 = 0, o = r.length, a = o - 1; e1 < o; a = e1++)for (const o of t1)for(let t1 = 0, l = o.length, c = l - 1; t1 < l; c = t1++){ 4050 if (Ze(r[a], r[e1], o[c], o[t1])) return 0; 4051 s = Math.min(s, no(r[a], r[e1], o[c], o[t1], i, n)); 4052 } 4053 return s; 4054 } 4055 function uo(e1, t1, i, n, r, o, a, s) { 4056 if (null === a || null === s) return; 4057 const l = Kr(Yr(r, a), Yr(o, s), i, n); 4058 l < t1 && e1.push({ 4059 dist: l, 4060 range1: a, 4061 range2: s 4062 }); 4063 } 4064 function ho(e1, t1, i, n, r) { 4065 let o = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 1 / 0; 4066 let a = Math.min(Gr(e1[0], i[0][0], n, r), o); 4067 if (0 === a) return a; 4068 const s = new Sr([ 4069 { 4070 dist: 0, 4071 range1: [ 4072 0, 4073 e1.length - 1 4074 ], 4075 range2: [ 4076 0, 4077 0 4078 ] 4079 } 4080 ], $r), l = t1 ? 50 : 100, c = Jr(i); 4081 for(; s.length;){ 4082 const o = s.pop(); 4083 if (o.dist >= a) continue; 4084 const u = o.range1; 4085 if (Wr(u) <= l) { 4086 if (!qr(u, e1.length)) return NaN; 4087 if (t1) { 4088 const t1 = so(e1, u, i, n, r); 4089 if (0 === (a = Math.min(a, t1))) return a; 4090 } else for(let t1 = u[0]; t1 <= u[1]; ++t1){ 4091 const o = ao(e1[t1], i, n, r); 4092 if (0 === (a = Math.min(a, o))) return a; 4093 } 4094 } else { 4095 const i = Xr(u, t1); 4096 if (null !== i[0]) { 4097 const t1 = Kr(Yr(e1, i[0]), c, n, r); 4098 t1 < a && s.push({ 4099 dist: t1, 4100 range1: i[0], 4101 range2: [ 4102 0, 4103 0 4104 ] 4105 }); 4106 } 4107 if (null !== i[1]) { 4108 const t1 = Kr(Yr(e1, i[1]), c, n, r); 4109 t1 < a && s.push({ 4110 dist: t1, 4111 range1: i[1], 4112 range2: [ 4113 0, 4114 0 4115 ] 4116 }); 4117 } 4118 } 4119 } 4120 return a; 4121 } 4122 function fo(e1, t1, i, n, r, o) { 4123 let a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 1 / 0; 4124 let s = Math.min(a, Gr(e1[0], i[0], r, o)); 4125 if (0 === s) return s; 4126 const l = new Sr([ 4127 { 4128 dist: 0, 4129 range1: [ 4130 0, 4131 e1.length - 1 4132 ], 4133 range2: [ 4134 0, 4135 i.length - 1 4136 ] 4137 } 4138 ], $r), c = t1 ? 50 : 100, u = n ? 50 : 100; 4139 for(; l.length;){ 4140 const a = l.pop(); 4141 if (a.dist >= s) continue; 4142 const h = a.range1, d = a.range2; 4143 if (Wr(h) <= c && Wr(d) <= u) { 4144 if (!qr(h, e1.length) || !qr(d, i.length)) return NaN; 4145 if (t1 && n ? s = Math.min(s, ro(e1, h, i, d, r, o)) : t1 || n ? t1 && !n ? s = Math.min(s, io(i, d, e1, h, r, o)) : !t1 && n && (s = Math.min(s, io(e1, h, i, d, r, o))) : s = Math.min(s, oo(e1, h, i, d, r, o)), 0 === s) return s; 4146 } else { 4147 const a = Xr(h, t1), c = Xr(d, n); 4148 uo(l, s, r, o, e1, i, a[0], c[0]), uo(l, s, r, o, e1, i, a[0], c[
41481]), uo(l, s, r, o, e1, i, a[1], c[0]), uo(l, s, r, o, e1, i, a[1], c[1]); 4149 } 4150 } 4151 return s; 4152 } 4153 function po(e1, t1, i, n, r) { 4154 let o = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 1 / 0; 4155 let a = o; 4156 const s = Yr(e1, [ 4157 0, 4158 e1.length - 1 4159 ]); 4160 for (const o of i)if (!(a !== 1 / 0 && Kr(s, Yr(o, [ 4161 0, 4162 o.length - 1 4163 ]), n, r) >= a) && (a = Math.min(a, fo(e1, t1, o, !0, n, r, a)), 0 === a)) return a; 4164 return a; 4165 } 4166 function mo(e1, t1, i, n, r) { 4167 let o = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 1 / 0; 4168 let a = o; 4169 const s = Yr(e1, [ 4170 0, 4171 e1.length - 1 4172 ]); 4173 for (const o of i){ 4174 if (a !== 1 / 0 && Kr(s, Jr(o), n, r) >= a) continue; 4175 const i = ho(e1, t1, o, n, r, a); 4176 if (isNaN(i)) return i; 4177 if (0 === (a = Math.min(a, i))) return a; 4178 } 4179 return a; 4180 } 4181 function _o(e1, t1, i) { 4182 const n = []; 4183 for (const i of e1)for (const e1 of i)n.push(Qr(e1, t1)); 4184 const [r, o] = Ur(n[0][1]); 4185 return "Point" === i.type || "MultiPoint" === i.type || "LineString" === i.type ? fo(n, !1, "Point" === i.type ? [ 4186 i.coordinates 4187 ] : i.coordinates, "LineString" === i.type, r, o) : "MultiLineString" === i.type ? po(n, !1, i.coordinates, r, o) : "Polygon" === i.type || "MultiPolygon" === i.type ? mo(n, !1, "Polygon" === i.type ? [ 4188 i.coordinates 4189 ] : i.coordinates, r, o) : null; 4190 } 4191 function go(e1, t1, i) { 4192 const n = []; 4193 for (const i of e1){ 4194 const e1 = []; 4195 for (const n of i)e1.push(Qr(n, t1)); 4196 n.push(e1); 4197 } 4198 const [r, o] = Ur(n[0][0][1]); 4199 if ("Point" === i.type || "MultiPoint" === i.type || "LineString" === i.type) return po("Point" === i.type ? [ 4200 i.coordinates 4201 ] : i.coordinates, "LineString" === i.type, n, r, o); 4202 if ("MultiLineString" === i.type) { 4203 let e1 = 1 / 0; 4204 for(let t1 = 0; t1 < i.coordinates.length; t1++){ 4205 const a = po(i.coordinates[t1], !0, n, r, o, e1); 4206 if (isNaN(a)) return a; 4207 if (0 === (e1 = Math.min(e1, a))) return e1; 4208 } 4209 return e1; 4210 } 4211 if ("Polygon" === i.type || "MultiPolygon" === i.type) { 4212 let e1 = 1 / 0; 4213 for(let t1 = 0; t1 < n.length; t1++){ 4214 const a = mo(n[t1], !0, "Polygon" === i.type ? [ 4215 i.coordinates 4216 ] : i.coordinates, r, o, e1); 4217 if (isNaN(a)) return a; 4218 if (0 === (e1 = Math.min(e1, a))) return e1; 4219 } 4220 return e1; 4221 } 4222 return null; 4223 } 4224 function yo(e1, t1, i) { 4225 const n = []; 4226 for (const i of Ne(e1, 0)){ 4227 const e1 = []; 4228 for(let n = 0; n < i.length; ++n)e1.push(eo(i[n], t1)); 4229 n.push(e1); 4230 } 4231 const [r, o] = Ur(n[0][0][0][1]); 4232 if ("Point" === i.type || "MultiPoint" === i.type || "LineString" === i.type) return mo("Point" === i.type ? [ 4233 i.coordinates 4234 ] : i.coordinates, "LineString" === i.type, n, r, o); 4235 if ("MultiLineString" === i.type) { 4236 let e1 = 1 / 0; 4237 for(let t1 = 0; t1 < i.coordinates.length; t1++){ 4238 const a = mo(i.coordinates[t1], !0, n, r, o, e1); 4239 if (isNaN(a)) return a; 4240 if (0 === (e1 = Math.min(e1, a))) return e1; 4241 } 4242 return e1; 4243 } 4244 return "Polygon" === i.type || "MultiPolygon" === i.type ? function(e1, t1, i, n) { 4245 let r = 1 / 0; 4246 for (const o of e1)for (const e1 of t1){ 4247 const t1 = co(o, e1, i, n, r); 4248 if (isNaN(t1)) return t1; 4249 if (0 === (r = Math.min(r, t1))) return r; 4250 } 4251 return r; 4252 }("Polygon" === i.type ? [ 4253 i.coordinates 4254 ] : i.coordinates, n, r, o) : null; 4255 } 4256 function xo(e1) { 4257 return "Point" === e1 || "MultiPoint" === e1 || "LineString" === e1 || "MultiLineString" === e1 || "Polygon" === e1 || "MultiPolygon" === e1; 4258 } 4259 function vo(e1) { 4260 if (!$n(e1) || "object" != typeof e1 || null === e1 || Array.isArray(e1)) return null; 4261 const t1 = e1; 4262 if ("FeatureCollection" === t1.type) { 4263 if (0 === t1.features.length) return null; 4264 const e1 = []; 4265 for (const i of t1.features){ 4266 if (!xo(i.geometry.type)) return null; 4267 e1.push(i.geometry); 4268 } 4269 return e1; 4270 } 4271 return "Feature" === t1.type ? xo(t1.geometry.type) ? [ 4272 t1.geometry 4273 ] : null : xo(t1.type) ? [ 4274 t1 4275 ] : null; 4276 } 4277 class bo { 4278 static parse(e1, t1) { 4279 if (2 !== e1.length) return t1.error("'distance' expression requires either one argument, but found ' ".concat(e1.length - 1, " instead.")); 4280 const i = e1[1], n = $n(i) && !Array.isArray(i), r = t1.parse(n ? [ 4281 "literal", 4282 i 4283 ] : i, 1, zn); 4284 if (!r) return null; 4285 for (const [e1, i] of [ 4286 [ 4287 [ 4288 "measure-light" 4289 ], 4290 "brightness" 4291 ], 4292 [ 4293 [ 4294 "pitch" 4295 ], 4296 "pitch" 4297 ], 4298 [ 4299 [ 4300 "distance-from-center" 4301 ], 4302 "distance-from-center" 4303 ] 4304 ])if (!Br(r, e1)) return t1.error("'distance' expression may not depend on ".concat(i, ".")); 4305 return Lr(r) ? r instanceof qn && !vo(r.value) ? t1.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].") : new bo(r) : t1.error("'distance' expression may not depend on feature-state."); 4306 } 4307 evaluate(e1) { 4308 const t1 = vo(this.geojson.evaluate(e1)); 4309 if (!t1) return console.warn("Distance Expression: could not resolve a valid Point/LineString/Polygon GeoJSON geometry."), null; 4310 const i = e1.geometry(), n = e1.canonicalID(); 4311 if (null == i || null == n) return console.warn("Distance Expression: requires valid feature and canonical information."), null; 4312 const r = e1.geometryType(), o = "Point" === r ? _o : "LineString" === r ? go : "Polygon" === r ? yo : null; 4313 if (!o) return console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries."), null; 4314 let a = 1 / 0; 4315 for (const e1 of t1){
4316 const t1 = o(i, n, e1); 4317 if (null == t1 || isNaN(t1)) return t1; 4318 if (0 === (a = Math.min(a, t1))) break; 4319 } 4320 return a; 4321 } 4322 eachChild(e1) { 4323 e1(this.geojson); 4324 } 4325 outputDefined() { 4326 return !0; 4327 } 4328 serialize() { 4329 return [ 4330 "distance", 4331 this.geojson.serialize() 4332 ]; 4333 } 4334 constructor(e1){ 4335 this.type = En, this.geojson = e1; 4336 } 4337 } 4338 class wo { 4339 static parse(e1, t1) { 4340 if (2 !== e1.length || "string" != typeof e1[1]) return t1.error("'var' expression requires exactly one string literal argument."); 4341 const i = e1[1]; 4342 return t1.scope.has(i) ? new wo(i, t1.scope.get(i)) : t1.error('Unknown variable "'.concat(i, '". Make sure "').concat(i, '" has been bound in an enclosing "let" expression before using it.'), 1); 4343 } 4344 evaluate(e1) { 4345 return this.boundExpression.evaluate(e1); 4346 } 4347 eachChild() {} 4348 outputDefined() { 4349 return !1; 4350 } 4351 serialize() { 4352 return [ 4353 "var", 4354 this.name 4355 ]; 4356 } 4357 constructor(e1, t1){ 4358 this.type = t1.type, this.name = e1, this.boundExpression = t1; 4359 } 4360 } 4361 class Ao { 4362 get key() { 4363 let e1 = ""; 4364 for(let t1 = 0; t1 < this.path.length; t1++){ 4365 const i = this.path[t1]; 4366 e1 += "string" == typeof i ? "['".concat(i, "']") : "[".concat(i, "]"); 4367 } 4368 return e1; 4369 } 4370 parse(e1, t1, i, n) { 4371 let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}; 4372 if (t1 || i) { 4373 const o = this.expectedType, a = this.scope; 4374 n && (this.scope = this.scope.concat(n)), this.expectedType = i || null; 4375 const s = "number" == typeof t1; 4376 s && this.path.push(t1); 4377 const l = this._parse(e1, r); 4378 return s && this.path.pop(), this.expectedType = o, this.scope = a, l; 4379 } 4380 return this._parse(e1, r); 4381 } 4382 parseObjectValue(e1, t1, i, n, r) { 4383 let o = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}; 4384 const a = this.expectedType, s = this.scope; 4385 r && (this.scope = this.scope.concat(r)), this.expectedType = n || null, this.path.push(t1), this.path.push(i); 4386 const l = this._parse(e1, o); 4387 return this.path.pop(), this.path.pop(), this.expectedType = a, this.scope = s, l; 4388 } 4389 _parse(e1, t1) { 4390 if (null !== e1 && "string" != typeof e1 && "boolean" != typeof e1 && "number" != typeof e1 || (e1 = [ 4391 "literal", 4392 e1 4393 ]), Array.isArray(e1)) { 4394 if (0 === e1.length) return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].'); 4395 const i = "string" == typeof e1[0] && Object.hasOwn(this.registry, e1[0]) ? this.registry[e1[0]] : void 0; 4396 if (i) { 4397 let n = i.parse(e1, this); 4398 if (!n) return null; 4399 if (this.expectedType) { 4400 const e1 = this.expectedType, i = n.type; 4401 if ("string" !== e1.kind && "number" !== e1.kind && "boolean" !== e1.kind && "object" !== e1.kind && "array" !== e1.kind || "value" !== i.kind) if ("color" !== e1.kind && "formatted" !== e1.kind && "resolvedImage" !== e1.kind || "value" !== i.kind && "string" !== i.kind) { 4402 if (this.checkSubtype(e1, i)) return null; 4403 } else n = Io(n, e1, t1.typeAnnotation || "coerce"); 4404 else n = Io(n, e1, t1.typeAnnotation || "assert"); 4405 } 4406 if (!(n instanceof qn) && "resolvedImage" !== n.type.kind && Mo(n)) { 4407 const e1 = new lr(this._scope, this.options, this.iconImageUseTheme); 4408 try { 4409 n = new qn(n.type, n.evaluate(e1)); 4410 } catch (e1) { 4411 return this.error(e1.message), null; 4412 } 4413 } 4414 return n; 4415 } 4416 return ar.parse([ 4417 "to-array", 4418 e1 4419 ], this); 4420 } 4421 return this.error(void 0 === e1 ? "'undefined' value invalid. Use null instead." : "object" == typeof e1 ? 'Bare objects invalid. Use ["literal", {...}] instead.' : "Expected an array, but found ".concat(typeof e1, " instead.")); 4422 } 4423 concat(e1, t1, i, n) { 4424 const r = n ? this.scope.concat(n) : this.scope, o = this.path.slice(); 4425 return "number" == typeof e1 && o.push(e1), "string" == typeof t1 && o.push(t1), new Ao(this.registry, o, i || null, r, this.errors, this._scope, this.options, this.iconImageUseTheme); 4426 } 4427 _forkForSignature() { 4428 return new Ao(this.registry, this.path.slice(), null, this.scope, [], this._scope, this.options, this.iconImageUseTheme); 4429 } 4430 error(e1) { 4431 for(var _len = arguments.length, t1 = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){ 4432 t1[_key - 1] = arguments[_key]; 4433 } 4434 const i = "".concat(this.key).concat(t1.map((e1)=>"[".concat(e1, "]")).join("")); 4435 this.errors.push(new bn(i, e1)); 4436 } 4437 checkSubtype(e1, t1, i) { 4438 const n = On(e1, t1); 4439 return n && this.error(n, ..."number" == typeof i ? [ 4440 i 4441 ] : []), n; 4442 } 4443 constructor(e1, t1 = [], i, n = new wn, r = [], o, a, s){ 4444 this.registry = e1, this.path = t1, this.scope = n, this.errors = r, this.expectedType = i, this._scope = o, this.options = a, this.iconImageUseTheme = s; 4445 } 4446 } 4447 const Eo = new Set([ 4448 "zoom", 4449 "heatmap-density", 4450 "worldview", 4451 "line-progress", 4452 "raster-value", 4453 "sky-radial-progress", 4454 "accumulated", 4455 "is-supported-script", 4456 "pitch", 4457 "distance-from-center", 4458 "measure-light", 4459 "raster-particle-speed", 4460 "is-active-floor" 4461 ]); 4462 function Io(e1, t1, i) { 4463 return "assert" === i ? new Jn(t1, [ 4464 e1 4465 ]) : "coerce" === i ? new ar(t1, [ 4466 e1 4467 ]) : e1; 4468 } 4469 function Mo(e1) { 4470 if (e1 instanceof wo) return Mo(e1.boundExpression); 4471 if (e1 instanceof cr && "error" === e1.name) return !1; 4472 if (e1 instanceof hr) return !1; 4473 if (e1 instanceof Tr) return !1; 4474 if (e1 instanceof bo) return !1; 4475 if (e1 instanceof Fr) return !1; 4476 const t1 = e1 instanceof ar || e1 instanceof Jn; 4477 let i = !0; 4478 return e1.eachChild((e1)=>{ 4479 i = t1 ? i && Mo(e1) : i && e1 instanceof qn; 4480 }
4480), !!i && Cr(e1) && Or(e1, Eo); 4481 } 4482 function To(e1, t1) { 4483 const i = e1.length - 1; 4484 let n, r, o = 0, a = i, s = 0; 4485 for(; o <= a;)if (s = Math.floor((o + a) / 2), n = e1[s], r = e1[s + 1], n <= t1) { 4486 if (s === i || t1 < r) return s; 4487 o = s + 1; 4488 } else { 4489 if (!(n > t1)) throw new Xn("Input is not a number."); 4490 a = s - 1; 4491 } 4492 return 0; 4493 } 4494 class So { 4495 static parse(e1, t1) { 4496 if (e1.length - 1 < 4) return t1.error("Expected at least 4 arguments, but found only ".concat(e1.length - 1, ".")); 4497 if ((e1.length - 1) % 2 != 0) return t1.error("Expected an even number of arguments."); 4498 const i = t1.parse(e1[1], 1, En); 4499 if (!i) return null; 4500 const n = []; 4501 let r = null; 4502 t1.expectedType && "value" !== t1.expectedType.kind && (r = t1.expectedType); 4503 for(let i = 1; i < e1.length; i += 2){ 4504 const o = 1 === i ? -1 / 0 : e1[i], a = e1[i + 1], s = i, l = i + 1; 4505 if ("number" != typeof o) return t1.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', s); 4506 if (n.length && n.at(-1)[0] >= o) return t1.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', s); 4507 const c = t1.parse(a, l, r); 4508 if (!c) return null; 4509 r = r || c.type, n.push([ 4510 o, 4511 c 4512 ]); 4513 } 4514 return new So(r, i, n); 4515 } 4516 evaluate(e1) { 4517 const t1 = this.labels, i = this.outputs; 4518 if (1 === t1.length) return i[0].evaluate(e1); 4519 const n = this.input.evaluate(e1); 4520 if (n <= t1[0]) return i[0].evaluate(e1); 4521 const r = t1.length; 4522 return n >= t1[r - 1] ? i[r - 1].evaluate(e1) : i[To(t1, n)].evaluate(e1); 4523 } 4524 eachChild(e1) { 4525 e1(this.input); 4526 for (const t1 of this.outputs)e1(t1); 4527 } 4528 outputDefined() { 4529 return this.outputs.every((e1)=>e1.outputDefined()); 4530 } 4531 serialize() { 4532 const e1 = [ 4533 "step", 4534 this.input.serialize() 4535 ]; 4536 for(let t1 = 0; t1 < this.labels.length; t1++)t1 > 0 && e1.push(this.labels[t1]), e1.push(this.outputs[t1].serialize()); 4537 return e1; 4538 } 4539 constructor(e1, t1, i){ 4540 this.type = e1, this.input = t1, this.labels = [], this.outputs = []; 4541 for (const [e1, t1] of i)this.labels.push(e1), this.outputs.push(t1); 4542 } 4543 } 4544 const zo = .95047, Ro = 1.08883, Po = 4 / 29, Do = 6 / 29, Fo = 3 * Do * Do, Co = Do * Do * Do, Lo = Math.PI / 180, Oo = 180 / Math.PI; 4545 function Bo(e1) { 4546 return e1 > Co ? Math.pow(e1, 1 / 3) : e1 / Fo + Po; 4547 } 4548 function Vo(e1) { 4549 return e1 > Do ? e1 * e1 * e1 : Fo * (e1 - Po); 4550 } 4551 function No(e1) { 4552 return 255 * (e1 <= .0031308 ? 12.92 * e1 : 1.055 * Math.pow(e1, 1 / 2.4) - .055); 4553 } 4554 function ko(e1) { 4555 return (e1 /= 255) <= .04045 ? e1 / 12.92 : Math.pow((e1 + .055) / 1.055, 2.4); 4556 } 4557 function Uo(e1) { 4558 const t1 = ko(e1.r), i = ko(e1.g), n = ko(e1.b), r = Bo((.4124564 * t1 + .3575761 * i + .1804375 * n) / zo), o = Bo((.2126729 * t1 + .7151522 * i + .072175 * n) / 1); 4559 return { 4560 l: 116 * o - 16, 4561 a: 500 * (r - o), 4562 b: 200 * (o - Bo((.0193339 * t1 + .119192 * i + .9503041 * n) / Ro)), 4563 alpha: e1.a 4564 }; 4565 } 4566 function jo(e1) { 4567 let t1 = (e1.l + 16) / 116, i = isNaN(e1.a) ? t1 : t1 + e1.a / 500, n = isNaN(e1.b) ? t1 : t1 - e1.b / 200; 4568 return t1 = 1 * Vo(t1), i = zo * Vo(i), n = Ro * Vo(n), new mn(No(3.2404542 *
4568i - 1.5371385 * t1 - .4985314 * n), No(-.969266 * i + 1.8760108 * t1 + .041556 * n), No(.0556434 * i - .2040259 * t1 + 1.0572252 * n), e1.alpha); 4569 } 4570 function Go(e1, t1, i) { 4571 const n = t1 - e1; 4572 return e1 + i * (n > 180 || n < -180 ? n - 360 * Math.round(n / 360) : n); 4573 } 4574 const Ho = { 4575 forward: Uo, 4576 reverse: jo, 4577 interpolate: function(e1, t1, i) { 4578 return { 4579 l: fn(e1.l, t1.l, i), 4580 a: fn(e1.a, t1.a, i), 4581 b: fn(e1.b, t1.b, i), 4582 alpha: fn(e1.alpha, t1.alpha, i) 4583 }; 4584 } 4585 }, $o = { 4586 forward: function(e1) { 4587 const { l: t1, a: i, b: n } = Uo(e1), r = Math.atan2(n, i) * Oo; 4588 return { 4589 h: r < 0 ? r + 360 : r, 4590 c: Math.sqrt(i * i + n * n), 4591 l: t1, 4592 alpha: e1.a 4593 }; 4594 }, 4595 reverse: function(e1) { 4596 const t1 = e1.h * Lo, i = e1.c; 4597 return jo({ 4598 l: e1.l, 4599 a: Math.cos(t1) * i, 4600 b: Math.sin(t1) * i, 4601 alpha: e1.alpha 4602 }); 4603 }, 4604 interpolate: function(e1, t1, i) { 4605 return { 4606 h: Go(e1.h, t1.h, i), 4607 c: fn(e1.c, t1.c, i), 4608 l: fn(e1.l, t1.l, i), 4609 alpha: fn(e1.alpha, t1.alpha, i) 4610 }; 4611 } 4612 }; 4613 var Zo = Object.freeze({ 4614 __proto__: null, 4615 hcl: $o, 4616 lab: Ho 4617 }); 4618 class Wo { 4619 static interpolationFactor(e1, t1, i, n) { 4620 let r = 0; 4621 if ("exponential" === e1.name) r = qo(t1, e1.base, i, n); 4622 else if ("linear" === e1.name) r = qo(t1, 1, i, n); 4623 else if ("cubic-bezier" === e1.name) { 4624 const o = e1.controlPoints; 4625 r = Re(o[0], o[1], o[2], o[3])(qo(t1, 1, i, n)); 4626 } 4627 return r; 4628 } 4629 static parse(e1, t1) { 4630 let [i, n, r, ...o] = e1; 4631 if (!Array.isArray(n) || 0 === n.length) return t1.error("Expected an interpolation type expression.", 1); 4632 if ("linear" === n[0]) n = { 4633 name: "linear" 4634 }; 4635 else if ("exponential" === n[0]) { 4636 const e1 = n[1]; 4637 if ("number" != typeof e1) return t1.error("Exponential interpolation requires a numeric base.", 1, 1); 4638 n = { 4639 name: "exponential", 4640 base: e1 4641 }; 4642 } else { 4643 if ("cubic-bezier" !== n[0]) return t1.error("Unknown interpolation type ".concat(String(n[0])), 1, 0); 4644 { 4645 const e1 = n.slice(1); 4646 if (4 !== e1.length || e1.some((e1)=>"number" != typeof e1 || e1 < 0 || e1 > 1)) return t1.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.", 1); 4647 n = { 4648 name: "cubic-bezier", 4649 controlPoints: e1 4650 }; 4651 } 4652 } 4653 if (e1.length - 1 < 4) return t1.error("Expected at least 4 arguments, but found only ".concat(e1.length - 1, ".")); 4654 if (e1.length - 1 > 3 && (e1.length - 1) % 2 != 0) return t1.error("Expected an even number of arguments."); 4655 if (r = t1.parse(r, 2, En), !r) return null; 4656 const a = []; 4657 let s = null; 4658 "interpolate-hcl" === i || "interpolate-lab" === i ? s = Tn : t1.expectedType && "value" !== t1.expectedType.kind && (s = t1.expectedType); 4659 for(let e1 = 0; e1 < o.length; e1 += 2){ 4660 const i = o[e1], n = o[e1 + 1], r = e1 + 3, l = e1 + 4; 4661 if ("number" != typeof i) return t1.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
4661omputed expressions) for the input values.', r); 4662 if (a.length && a.at(-1)[0] >= i) return t1.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', r); 4663 const c = t1.parse(n, l, s); 4664 if (!c) return null; 4665 s = s || c.type, a.push([ 4666 i, 4667 c 4668 ]); 4669 } 4670 return "number" === s.kind || "color" === s.kind || "array" === s.kind && "number" === s.itemType.kind && "number" == typeof s.N ? new Wo(s, i, n, r, a) : t1.error("Type ".concat(Cn(s), " is not interpolatable.")); 4671 } 4672 evaluate(e1) { 4673 const t1 = this.labels, i = this.outputs; 4674 if (1 === t1.length) return i[0].evaluate(e1); 4675 const n = this.input.evaluate(e1); 4676 if (n <= t1[0]) return i[0].evaluate(e1); 4677 const r = t1.length; 4678 if (n >= t1[r - 1]) return i[r - 1].evaluate(e1); 4679 const o = To(t1, n), a = Wo.interpolationFactor(this.interpolation, n, t1[o], t1[o + 1]), s = i[o].evaluate(e1), l = i[o + 1].evaluate(e1); 4680 return "interpolate" === this.operator ? vn[this.type.kind.toLowerCase()](s, l, a) : "interpolate-hcl" === this.operator ? $o.reverse($o.interpolate($o.forward(s), $o.forward(l), a)) : Ho.reverse(Ho.interpolate(Ho.forward(s), Ho.forward(l), a)); 4681 } 4682 eachChild(e1) { 4683 e1(this.input); 4684 for (const t1 of this.outputs)e1(t1); 4685 } 4686 outputDefined() { 4687 return this.outputs.every((e1)=>e1.outputDefined()); 4688 } 4689 serialize() { 4690 let e1; 4691 e1 = "linear" === this.interpolation.name ? [ 4692 "linear" 4693 ] : "exponential" === this.interpolation.name ? 1 === this.interpolation.base ? [ 4694 "linear" 4695 ] : [ 4696 "exponential", 4697 this.interpolation.base 4698 ] : [ 4699 "cubic-bezier", 4700 ...this.interpolation.controlPoints 4701 ]; 4702 const t1 = [ 4703 this.operator, 4704 e1, 4705 this.input.serialize() 4706 ]; 4707 for(let e1 = 0; e1 < this.labels.length; e1++)t1.push(this.labels[e1], this.outputs[e1].serialize()); 4708 return t1; 4709 } 4710 constructor(e1, t1, i, n, r){ 4711 this.type = e1, this.operator = t1, this.interpolation = i, this.input = n, this.labels = [], this.outputs = []; 4712 for (const [e1, t1] of r)this.labels.push(e1), this.outputs.push(t1); 4713 } 4714 } 4715 function qo(e1, t1, i, n) { 4716 const r = n - i, o = e1 - i; 4717 return 0 === r ? 0 : 1 === t1 ? o / r : (Math.pow(t1, o) - 1) / (Math.pow(t1, r) - 1); 4718 } 4719 class Xo { 4720 static parse(e1, t1) { 4721 if (e1.length < 2) return t1.error("Expectected at least one argument."), null; 4722 let i = null; 4723 const n = t1.expectedType; 4724 n && "value" !== n.kind && (i = n); 4725 const r = []; 4726 for (const n of e1.slice(1)){ 4727 const e1 = t1.parse(n, 1 + r.length, i, void 0, { 4728 typeAnnotation: "omit" 4729 }); 4730 if (!e1) return null; 4731 i = i || e1.type, r.push(e1); 4732 } 4733 const o = n && r.some((e1)=>On(n, e1.type)); 4734 return new Xo(o ? zn : i, r); 4735 } 4736 evaluate(e1) { 4737 let t1, i = null, n = 0; 4738 for (const r of this.args){ 4739 if (n++, i = r.evaluate(e1), i && i instanceof Gn && !i.available && (t1 || (t1 = i), i = null, n === this.args.length)) return t1; 4740 if (null !== i) break; 4741 } 4742 return i; 4743 } 4744 eachChild(e1) {
4745 this.args.forEach(e1); 4746 } 4747 outputDefined() { 4748 return this.args.every((e1)=>e1.outputDefined()); 4749 } 4750 serialize() { 4751 const e1 = [ 4752 "coalesce" 4753 ]; 4754 return this.eachChild((t1)=>{ 4755 e1.push(t1.serialize()); 4756 }), e1; 4757 } 4758 constructor(e1, t1){ 4759 this.type = e1, this.args = t1; 4760 } 4761 } 4762 const Yo = /[^a-zA-Z0-9_]/; 4763 class Jo { 4764 evaluate(e1) { 4765 return this.result.evaluate(e1); 4766 } 4767 eachChild(e1) { 4768 for (const t1 of this.bindings)e1(t1[1]); 4769 e1(this.result); 4770 } 4771 static parse(e1, t1) { 4772 if (e1.length < 4) return t1.error("Expected at least 3 arguments, but found ".concat(e1.length - 1, " instead.")); 4773 const i = []; 4774 for(let n = 1; n < e1.length - 1; n += 2){ 4775 const r = e1[n]; 4776 if ("string" != typeof r) return t1.error("Expected string, but found ".concat(typeof r, " instead."), n); 4777 if (Yo.test(r)) return t1.error("Variable names must contain only alphanumeric characters or '_'.", n); 4778 const o = t1.parse(e1[n + 1], n + 1); 4779 if (!o) return null; 4780 i.push([ 4781 r, 4782 o 4783 ]); 4784 } 4785 const n = t1.parse(e1.at(-1), e1.length - 1, t1.expectedType, i); 4786 return n ? new Jo(i, n) : null; 4787 } 4788 outputDefined() { 4789 return this.result.outputDefined(); 4790 } 4791 serialize() { 4792 const e1 = [ 4793 "let" 4794 ]; 4795 for (const [t1, i] of this.bindings)e1.push(t1, i.serialize()); 4796 return e1.push(this.result.serialize()), e1; 4797 } 4798 constructor(e1, t1){ 4799 this.type = t1.type, this.bindings = [].concat(e1), this.result = t1; 4800 } 4801 } 4802 class Ko { 4803 static parse(e1, t1) { 4804 if (3 !== e1.length) return t1.error("Expected 2 arguments, but found ".concat(e1.length - 1, " instead.")); 4805 const i = t1.parse(e1[1], 1, En), n = t1.parse(e1[2], 2, Fn(t1.expectedType || zn)); 4806 return i && n ? new Ko(n.type.itemType, i, n) : null; 4807 } 4808 evaluate(e1) { 4809 const t1 = this.index.evaluate(e1), i = this.input.evaluate(e1); 4810 if (t1 < 0) throw new Xn("Array index out of bounds: negative index"); 4811 if (t1 >= i.length) throw new Xn("Array index out of bounds: index exceeds array size"); 4812 if (t1 !== Math.floor(t1)) throw new Xn("Array index must be an integer. Use at-interpolated for fractional indices"); 4813 return i[t1]; 4814 } 4815 eachChild(e1) { 4816 e1(this.index), e1(this.input); 4817 } 4818 outputDefined() { 4819 return !1; 4820 } 4821 serialize() { 4822 return [ 4823 "at", 4824 this.index.serialize(), 4825 this.input.serialize() 4826 ]; 4827 } 4828 constructor(e1, t1, i){ 4829 this.type = e1, this.index = t1, this.input = i; 4830 } 4831 } 4832 class Qo { 4833 static parse(e1, t1) { 4834 if (3 !== e1.length) return t1.error("Expected 2 arguments, but found ".concat(e1.length - 1, " instead.")); 4835 const i = t1.parse(e1[1], 1, En), n = t1.parse(e1[2], 2, Fn(t1.expectedType || zn)); 4836 return i && n ? new Qo(n.type.itemType, i, n) : null; 4837 } 4838 evaluate(e1) { 4839 const t1 = this.index.evaluate(e1), i = this.input.evaluate(e1); 4840 if (t1 < 0) throw new Xn("Array index out of bounds: ".concat(t1, " < 0.")); 4841 if (t1 >
4841 i.length - 1) throw new Xn("Array index out of bounds: ".concat(t1, " > ").concat(i.length - 1, ".")); 4842 if (t1 === Math.floor(t1)) return i[t1]; 4843 const n = Math.floor(t1), r = Math.ceil(t1), o = i[n], a = i[r]; 4844 if ("number" != typeof o || "number" != typeof a) throw new Xn("Cannot interpolate between non-number values at index ".concat(t1, ".")); 4845 return fn(o, a, t1 - n); 4846 } 4847 eachChild(e1) { 4848 e1(this.index), e1(this.input); 4849 } 4850 outputDefined() { 4851 return !1; 4852 } 4853 serialize() { 4854 return [ 4855 "at-interpolated", 4856 this.index.serialize(), 4857 this.input.serialize() 4858 ]; 4859 } 4860 constructor(e1, t1, i){ 4861 this.type = e1, this.index = t1, this.input = i; 4862 } 4863 } 4864 class ea { 4865 static parse(e1, t1) { 4866 if (e1.length < 5) return t1.error("Expected at least 4 arguments, but found only ".concat(e1.length - 1, ".")); 4867 if (e1.length % 2 != 1) return t1.error("Expected an even number of arguments."); 4868 let i, n; 4869 t1.expectedType && "value" !== t1.expectedType.kind && (n = t1.expectedType); 4870 const r = {}, o = []; 4871 for(let a = 2; a < e1.length - 1; a += 2){ 4872 let s = e1[a]; 4873 const l = e1[a + 1]; 4874 if (Array.isArray(s) || (s = [ 4875 s 4876 ]), 0 === s.length) return t1.error("Expected at least one branch label.", a); 4877 for (const e1 of s){ 4878 if ("number" != typeof e1 && "string" != typeof e1) return t1.error("Branch labels must be numbers or strings.", a); 4879 if ("number" == typeof e1 && Math.abs(e1) > Number.MAX_SAFE_INTEGER) return t1.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER, "."), a); 4880 if ("number" == typeof e1 && Math.floor(e1) !== e1) return t1.error("Numeric branch labels must be integer values.", a); 4881 if (i) { 4882 if (t1.checkSubtype(i, Zn(e1), a)) return null; 4883 } else i = Zn(e1); 4884 if (void 0 !== r[String(e1)]) return t1.error("Branch labels must be unique.", a); 4885 r[String(e1)] = o.length; 4886 } 4887 const c = t1.parse(l, a, n); 4888 if (!c) return null; 4889 n = n || c.type, o.push(c); 4890 } 4891 const a = t1.parse(e1[1], 1, zn); 4892 if (!a) return null; 4893 const s = t1.parse(e1.at(-1), e1.length - 1, n); 4894 return s ? "value" !== a.type.kind && t1.checkSubtype(i, a.type, 1) ? null : new ea(i, n, a, r, o, s) : null; 4895 } 4896 evaluate(e1) { 4897 const t1 = this.input.evaluate(e1); 4898 return (Vn(Zn(t1), this.inputType) && this.outputs[this.cases[t1]] || this.otherwise).evaluate(e1); 4899 } 4900 eachChild(e1) { 4901 e1(this.input), this.outputs.forEach(e1), e1(this.otherwise); 4902 } 4903 outputDefined() { 4904 return this.outputs.every((e1)=>e1.outputDefined()) && this.otherwise.outputDefined(); 4905 } 4906 serialize() { 4907 const e1 = [ 4908 "match", 4909 this.input.serialize() 4910 ], t1 = Object.keys(this.cases).sort(), i = [], n = {}; 4911 for (const e1 of t1){ 4912 const t1 = n[this.cases[e1]]; 4913 void 0 === t1 ? (n[this.cases[e1]] = i.length, i.push([ 4914 this.cases[e1], 4915 [ 4916 e1 4917 ] 4918 ])) : i[t1][1].push(e1); 4919 } 4920 const r = (e1)=>"number" === this.inputType.kind ? Number(e1) : e1; 4921 for (const [t1, n] of i)e1.push(1 === n.length ? r(n[0]) : n.map(r)), e1.push(this.outputs[t1].serialize()); 4922 return e1.push(this.otherwise.serialize()), e1; 4923 } 4924 constructor(e1, t1, i, n, r, o){ 4925 this.inputType = e1, this.type = t1, this.input = i, this.cases = n, this.outputs = r, this.otherwise = o; 4926 } 4927 } 4928 class ta { 4929 static parse(e1, t1) { 4930 if (e1.length < 4) return t1.error("Expected at least 3 arguments, but found only ".concat(e1.length - 1, ".")), null; 4931 if (e1.length % 2 != 0) return t1.error("Expected an odd number of arguments."), null; 4932 let i; 4933 t1.expectedType && "value" !== t1.expectedType.kind && (i = t1.expectedType); 4934 const n = []; 4935 for(let r = 1;
4935 r < e1.length - 1; r += 2){ 4936 const o = t1.parse(e1[r], r, Mn); 4937 if (!o) return null; 4938 const a = t1.parse(e1[r + 1], r + 1, i); 4939 if (!a) return null; 4940 n.push([ 4941 o, 4942 a 4943 ]), i = i || a.type; 4944 } 4945 const r = t1.parse(e1.at(-1), e1.length - 1, i); 4946 return r ? new ta(i, n, r) : null; 4947 } 4948 evaluate(e1) { 4949 for (const [t1, i] of this.branches)if (t1.evaluate(e1)) return i.evaluate(e1); 4950 return this.otherwise.evaluate(e1); 4951 } 4952 eachChild(e1) { 4953 for (const [t1, i] of this.branches)e1(t1), e1(i); 4954 e1(this.otherwise); 4955 } 4956 outputDefined() { 4957 return this.branches.every((param)=>{ 4958 let [e1, t1] = param; 4959 return t1.outputDefined(); 4960 }) && this.otherwise.outputDefined(); 4961 } 4962 serialize() { 4963 const e1 = [ 4964 "case" 4965 ]; 4966 return this.eachChild((t1)=>{ 4967 e1.push(t1.serialize()); 4968 }), e1; 4969 } 4970 constructor(e1, t1, i){ 4971 this.type = e1, this.branches = t1, this.otherwise = i; 4972 } 4973 } 4974 class ia { 4975 static parse(e1, t1) { 4976 if (e1.length <= 2 || e1.length >= 5) return t1.error("Expected 3 or 4 arguments, but found ".concat(e1.length - 1, " instead.")), null; 4977 const i = t1.parse(e1[1], 1, zn), n = t1.parse(e1[2], 2, En); 4978 if (!i || !n) return null; 4979 if (r = i.type, ![ 4980 Fn(zn), 4981 In, 4982 zn 4983 ].some((e1)=>e1.kind === r.kind)) return t1.error("Expected first argument to be of type array or string, but found ".concat(Cn(i.type), " instead")), null; 4984 var r; 4985 if (4 === e1.length) { 4986 const r = t1.parse(e1[3], 3, En); 4987 return r ? new ia(i.type, i, n, r) : null; 4988 } 4989 return new ia(i.type, i, n); 4990 } 4991 evaluate(e1) { 4992 const t1 = this.input.evaluate(e1), i = this.beginIndex.evaluate(e1); 4993 if (!Bn(t1, [ 4994 "string", 4995 "array" 4996 ])) throw new Xn("Expected first argument to be of type array or string, but found ".concat(Cn(Zn(t1)), " instead.")); 4997 if (this.endIndex) { 4998 const n = this.endIndex.evaluate(e1); 4999 return t1.slice(i, n); 5000 } 5001 return t1.slice(i); 5002 } 5003 eachChild(e1) { 5004 e1(this.input), e1(this.beginIndex), this.endIndex && e1(this.endIndex); 5005 } 5006 outputDefined() { 5007 return !1; 5008 } 5009 serialize() { 5010 if (null != this.endIndex && void 0 !== this.endIndex) { 5011 const e1 = this.endIndex.serialize(); 5012 return [ 5013 "slice", 5014 this.input.serialize(), 5015 this.beginIndex.serialize(), 5016 e1 5017 ]; 5018 } 5019 return [ 5020 "slice", 5021 this.input.serialize(), 5022 this.beginIndex.serialize() 5023 ]; 5024 } 5025 constructor(e1, t1, i, n){ 5026 this.type = e1, this.input = t1, this.beginIndex = i, this.endIndex = n; 5027 } 5028 } 5029 function na(e1, t1) { 5030 return "==" === e1 || "!=" === e1 ? "boolean" === t1.kind || "string" === t1.kind || "number" === t1.kind || "null" === t1.kind || "value" === t1.kind : "string" === t1.kind || "number" === t1.kind || "value" === t1.kind; 5031 } 5032 function ra(e1, t1, i, n) { 5033 return 0 === n.compare(t1, i); 5034 } 5035 function oa(e1, t1, i) { 5036 const n = "==" !== e1 && "!=" !== e1; 5037 return class r { 5038 static parse(e1, t1) { 5039 if (3 !== e1.length && 4 !== e1.length) return t1.error("Expected two or three arguments."); 5040 const i = e1[0]; 5041 let o = t1.parse(e1[1], 1, zn); 5042 if (!o) return null; 5043 if (!na(i, o.type)) return t1.error('"'.concat(i, "\" comparisons are not supported for type '").concat(Cn(o.type), "'."), 1); 5044 let a = t1.parse(e1[2], 2, zn); 5045 if (!a) return null; 5046 if (!na(i, a.type)) return t1.error('"'.concat(i, "\" comparisons are not supported for type '").concat(Cn(a.type), "'."), 2); 5047 if (o.type.kind !== a.type.kind && "value" !== o.type.kind && "value" !== a.type.kind) return t1.error("Cannot compare types '".concat(Cn(o.type), "' and '").concat(Cn(a.type), "'.")); 5048 n && ("value" === o.type.kind && "value" !== a.type.kind ? o = new Jn(a.type, [ 5049 o 5050 ]) : "value" !== o.type.kind && "value" === a.type.kind && (a = new Jn(o.type, [ 5051 a 5052 ]))); 5053 let s = null; 5054 if (4 === e1.length) { 5055 if ("string" !== o.type.kind && "string" !== a.type.kind && "value" !== o.type.kind && "value" !== a.type.kind) return t1.error("Cannot use collator to compare non-string types."); 5056 if (s = t1.parse(e1[3], 3, Rn), !s) return null; 5057 } 5058 return new r(o, a, s); 5059 } 5060 evaluate(r) { 5061 const o = this.lhs.evaluate(r), a = this.rhs.evaluate(r); 5062 if (n && this.hasUntypedArgument) { 5063 const t1 = Zn(o), i = Zn(a); 5064 if (t1.kind !== i.kind || "string" !== t1.kind && "number" !== t1.kind) throw new Xn('Expected arguments for "'.concat(e1, '" to be (string, string) or (number, number), but found (').concat(t1.kind, ", ").concat(i.kind, ") instead.")); 5065 } 5066 if (this.collator && !n && this.hasUntypedArgument) { 5067 const e1 = Zn(o), i = Zn(a); 5068 if ("string" !== e1.kind || "string" !== i.kind) return t1(r, o, a); 5069 } 5070 return this.collator ? i(r, o, a, this.collator.evaluate(r)) : t1(r, o, a); 5071 } 5072 eachChild(e1) { 5073 e1(this.lhs), e1(this.rhs), this.collator && e1(this.collator); 5074 } 5075 outputDefined() { 5076 return !0; 5077 } 5078 serialize() { 5079 const t1 = [ 5080 e1 5081 ]; 5082 return this.eachChild((e1)=>{ 5083 t1.push(e1.serialize()); 5084 }), t1; 5085 } 5086 constructor(e1, t1, i){ 5087 this.type = Mn, this.lhs = e1, this.rhs = t1, this.collator = i, this.hasUntypedArgument = "value" === e1.type.kind || "value" === t1.type.kind; 5088 } 5089 }; 5090 } 5091 const aa = oa("==", function(e1, t1, i) { 5092 return t1 === i; 5093 }, ra), sa = oa("!=", function(e1, t1, i) { 5094 return t1 !== i; 5095 }, function(e1, t1, i, n) { 5096 return !ra(0, t1, i, n); 5097 }), la = oa("<", function(e1, t1, i) { 5098 return t1 < i; 5099 }, function(e1, t1, i, n) { 5100 return n.compare(t1, i) < 0; 5101 }), ca = oa(">", function(e1, t1, i) { 5102 return t1 > i; 5103 }, function(e1, t1, i, n) { 5104 return n.compare(t1, i) > 0; 5105 }), ua = oa("<=", function(e1, t1, i) { 5106 return t1 <= i; 5107 }, function(e1, t1, i, n) { 5108 return n.compare(t1, i) <= 0; 5109 }), ha = oa(">=", function(e1, t1, i) { 5110 return t1 >= i; 5111 }, function(e1, t1, i, n) { 5112 return n.compare(t1, i) >= 0; 5113 }); 5114 class da { 5115 static parse(e1, t1) { 5116 if (3 !== e1.length) return t1.error("Expected two arguments."); 5117 const i = t1.parse(e1[1], 1, En); 5118 if (!i) return null; 5119 const n = e1[2]; 5120 if ("object" != typeof n || Array.isArray(n)) return t1.error("NumberFormat options argument must be an object."); 5121 let r = null; 5122 if (n.locale && (r = t1.parseObjectValue(n.locale, 2, "locale", In), !r)) return null; 5123 let o = null; 5124 if (n.currency && (o = t1.parseObjectValue(n.currency, 2, "currency", In), !o)) return null; 5125 let a = null; 5126 if (n.unit && (a = t1.parseObjectValue(n.unit, 2, "unit", In), !a)) return null; 5127 let s = null; 5128 if (void 0 !== n["min-fraction-digits"] && (s = t1.parseObjectValue(n["min-fraction-digits"], 2, "min-fraction-digits", En), !s)) return null; 5129 let l = null; 5130 return void 0 === n["max-fraction-digits"] || (l = t1.parseObjectValue(n["max-fraction-digits"], 2, "max-fraction-digits", En), l) ? new da(i, r, o, a, s, l) : null; 5131 } 5132 evaluate(e1) { 5133 return new Intl.NumberFormat(this.locale ? this.locale.evaluate(e1) : [], { 5134 style: (this.currency ? "currency" : this.unit && "unit") || "decimal", 5135 currency: this.currency ? this.currency.evaluate(e1) : void 0, 5136 unit: this.unit ? this.unit.evaluate(e1) : void 0, 5137 minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(e1) : void 0, 5138 maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(e1) : void 0 5139 }).format(this.number.evaluate(e1)); 5140 } 5141 eachChild(e1) { 5142 e1(this.number), this.locale && e1(this.locale), this.currency && e1(this.currency), this.unit && e1(this.unit), this.minFractionDigits && e1(this.minFractionDigits), this.maxFractionDigits && e1(this.maxFractionDigits); 5143 } 5144 outputDefined() { 5145 return !1; 5146 } 5147 serialize() { 5148 const e1 = {}; 5149 return this.locale && (e1.locale = this.locale.serialize()), this.currency && (e1.currency = this.currency.serialize()), this.unit && (e1.unit = this.unit.serialize()), this.minFractionDigits && (e1["min-fraction-digits"] = this.minFractionDigits.serialize()), this.maxFractionDigits && (e1["max-fraction-digits"] = this.maxFractionDigits.serialize()), [ 5150 "number-format", 5151 this.number.serialize(), 5152 e1 5153 ]; 5154 } 5155 constructor(e1, t1, i, n, r, o){ 5156 this.type = In, this.number = e1, this.locale = t1, this.currency = i, this.unit = n, this.minFractionDigits = r, this.maxFractionDigits = o; 5157 } 5158 } 5159 class fa { 5160 static parse(e1, t1) { 5161 if (2 !== e1.length) return t1.error("Expected 1 argument, but found ".concat(e1.length - 1, " instead.")), null; 5162 const i = t1.parse(e1[1], 1); 5163 return i ? "array" !== i.type.kind && "string" !== i.type.kind && "value" !== i.type.kind ? (t1.error("Expected argument of type string or array, but found ".concat(Cn(i.type), " instead.")), null) : new fa(i) : null; 5164 } 5165 evaluate(e1) { 5166 const t1 = this.input.evaluate(e1); 5167 if ("string" == typeof t1) return t1.length; 5168 if (Array.isArray(t1)) return t1.length; 5169 throw new Xn("Expected value to be of type string or array, but found ".concat(Cn(Zn(t1)), " instead.")); 5170 } 5171 eachChild(e1) { 5172 e1(this.input); 5173 } 5174 outputDefined() { 5175 return !1; 5176 } 5177 serialize() { 5178 const e1 = [ 5179 "length" 5180 ]; 5181 return this.eachChild((t1)=>{ 5182 e1.push(t1.serialize()); 5183 }), e1; 5184 } 5185 constructor(e1){ 5186 this.type = En, this.input = e1; 5187 } 5188 } 5189 function pa(e1) { 5190 return function() { 5191 e1 = 1831565813 + (e1 |= 0) | 0; 5192 let t1 = Math.imul(e1 ^ e1 >>> 15, 1 | e1); 5193 return t1 = t1 + Math.imul(t1 ^ t1 >>> 7, 61 | t1) ^ t1, ((t1 ^ t1 >>> 14) >>> 0) / 4294967296; 5194 }; 5195 } 5196 const ma = { 5197 "==": aa, 5198 "!=": sa, 5199 ">": ca, 5200 "<": la, 5201 ">=": ha, 5202 "<=": ua, 5203 array: Jn, 5204 at: Ko, 5205 "at-interpolated": Qo, 5206 boolean: Jn, 5207 case: ta, 5208 coalesce: Xo, 5209 collator: hr, 5210 format: Kn, 5211 image: Qn, 5212 interpolate: Wo, 5213 "interpolate-hcl": Wo, 5214 "interpolate-lab": Wo, 5215 length: fa, 5216 let: Jo, 5217 literal: qn, 5218 match: ea, 5219 number: Jn, 5220 "number-format": da, 5221 object: Jn, 5222 slice: ia, 5223 step: So,
5224 string: Jn, 5225 "to-boolean": ar, 5226 "to-color": ar, 5227 "to-number": ar, 5228 "to-string": ar, 5229 var: wo, 5230 within: Tr, 5231 distance: bo, 5232 config: Fr 5233 }; 5234 function _a(e1, param) { 5235 let [t1, i, n, r] = param; 5236 t1 = t1.evaluate(e1), i = i.evaluate(e1), n = n.evaluate(e1); 5237 const o = r ? r.evaluate(e1) : 1, a = Hn(t1, i, n, o); 5238 if (a) throw new Xn(a); 5239 return new mn(t1 / 255, i / 255, n / 255, o); 5240 } 5241 function ga(e1, param) { 5242 let [t1, i, n, r] = param; 5243 t1 = t1.evaluate(e1), i = i.evaluate(e1), n = n.evaluate(e1); 5244 const o = r ? r.evaluate(e1) : 1, a = function(e1, t1, i, n) { 5245 return "number" == typeof e1 && e1 >= 0 && e1 <= 360 ? "number" == typeof t1 && t1 >= 0 && t1 <= 100 && "number" == typeof i && i >= 0 && i <= 100 ? void 0 === n || "number" == typeof n && n >= 0 && n <= 1 ? null : "Invalid hsla value [".concat([ 5246 e1, 5247 t1, 5248 i, 5249 n 5250 ].join(", "), "]: 'a' must be between 0 and 1.") : "Invalid hsla value [".concat(("number" == typeof n ? [ 5251 e1, 5252 t1, 5253 i, 5254 n 5255 ] : [ 5256 e1, 5257 t1, 5258 i 5259 ]).join(", "), "]: 's', and 'l' must be between 0 and 100.") : "Invalid hsla value [".concat(("number" == typeof n ? [ 5260 e1, 5261 t1, 5262 i, 5263 n 5264 ] : [ 5265 e1, 5266 t1, 5267 i 5268 ]).join(", "), "]: 'h' must be between 0 and 360."); 5269 }(t1, i, n, o); 5270 if (a) throw new Xn(a); 5271 const s = "hsla(".concat(t1, ", ").concat(i, "%, ").concat(n, "%, ").concat(o, ")"), l = mn.parse(s); 5272 if (!l) throw new Xn("Failed to parse HSLA color: ".concat(s)); 5273 return l; 5274 } 5275 function ya(e1, t1) { 5276 return e1 in t1; 5277 } 5278 function xa(e1, t1) { 5279 const i = t1[e1]; 5280 return void 0 === i ? null : i; 5281 } 5282 function va(e1) { 5283 return { 5284 type: e1 5285 }; 5286 } 5287 function ba(e1, t1) { 5288 if (!Bn(e1, [ 5289 "boolean", 5290 "string", 5291 "number", 5292 "null" 5293 ])) throw new Xn("Expected first argument to be of type boolean, string, number or null, but found ".concat(Cn(Zn(e1)), " instead.")); 5294 if (!Bn(t1, [ 5295 "string", 5296 "array" 5297 ])) throw new Xn("Expected second argument to be of type array or string, but found ".concat(Cn(Zn(t1)), " instead.")); 5298 } 5299 function wa(e1) { 5300 if (e1 instanceof Fr) return new Set([ 5301 e1.key 5302 ]); 5303 let t1 = new Set; 5304 return e1.eachChild((e1)=>{ 5305 t1 = new Set([ 5306 ...t1, 5307 ...wa(e1) 5308 ]); 5309 }), t1; 5310 } 5311 function Aa(e1) { 5312 if (e1 instanceof cr && "is-active-floor" === e1.name) return !0; 5313 let t1 = !1; 5314 return e1.eachChild((e1)=>{ 5315 !t1 && Aa(e1) && (t1 = !0); 5316 }), t1; 5317 } 5318 function Ea(e1) { 5319 return { 5320 result: "success", 5321 value: e1 5322 }; 5323 } 5324 function Ia(e1) { 5325 return { 5326 result: "error", 5327 value: e1 5328 }; 5329 } 5330 function Ma(e1, t1) { 5331 return !!e1 && !!e1.parameters && e1.parameters.includes(t1); 5332 } 5333 function Ta(e1) { 5334 return "data-driven" === e1["property-type"]; 5335 } 5336 function Sa(e1) { 5337 return Ma(e1.expression, "measure-light"); 5338 } 5339 function za(e1) { 5340 return Ma(e1.expression, "zoom"); 5341 } 5342 function Ra(e1) { 5343 return !!e1.expression && e1.expression.interpolated; 5344 } 5345 function Pa(e1) { 5346 return "object" == typeof e1 && null !== e1 && !Array.isArray(e1); 5347 } 5348 function Da(e1) { 5349 return e1; 5350 } 5351 function Fa(e1, t1) { 5352 const i = "color" === t1.type, n = e1.stops && "object" == typeof e1.stops[0][0], r = n || !(n || void 0 !== e1.property), o = e1.type || (Ra(t1) ? "exponential" : "interval"); 5353 if (i && ((e1 = { 5354 ...e1 5355 }
5355).stops && (e1.stops = e1.stops.map((e1)=>[ 5356 e1[0], 5357 mn.parse(e1[1]) 5358 ])), e1.default = mn.parse(e1.default ? e1.default : t1.default)), e1.colorSpace && "rgb" !== e1.colorSpace && !Zo[e1.colorSpace]) throw new Error("Unknown color space: ".concat(e1.colorSpace)); 5359 let a, s, l; 5360 if ("exponential" === o) a = Ba; 5361 else if ("interval" === o) a = Oa; 5362 else if ("categorical" === o) { 5363 a = La, s = Object.create(null); 5364 for (const t1 of e1.stops)s[t1[0]] = t1[1]; 5365 l = typeof e1.stops[0][0]; 5366 } else { 5367 if ("identity" !== o) throw new Error('Unknown function type "'.concat(o, '"')); 5368 a = Va; 5369 } 5370 if (n) { 5371 const i = {}, n = []; 5372 for(let t1 = 0; t1 < e1.stops.length; t1++){ 5373 const r = e1.stops[t1], o = r[0].zoom; 5374 void 0 === i[o] && (i[o] = { 5375 zoom: o, 5376 type: e1.type, 5377 property: e1.property, 5378 default: e1.default, 5379 stops: [] 5380 }, n.push(o)), i[o].stops.push([ 5381 r[0].value, 5382 r[1] 5383 ]); 5384 } 5385 const r = []; 5386 for (const e1 of n)r.push([ 5387 i[e1].zoom, 5388 Fa(i[e1], t1) 5389 ]); 5390 const o = { 5391 name: "linear" 5392 }; 5393 return { 5394 kind: "composite", 5395 interpolationType: o, 5396 interpolationFactor: Wo.interpolationFactor.bind(void 0, o), 5397 zoomStops: r.map((e1)=>e1[0]), 5398 evaluate: (param, n)=>{ 5399 let { zoom: i } = param; 5400 return Ba({ 5401 stops: r, 5402 base: e1.base 5403 }, t1, i).evaluate(i, n); 5404 } 5405 }; 5406 } 5407 if (r) { 5408 const i = "exponential" === o ? { 5409 name: "exponential", 5410 base: void 0 !== e1.base ? e1.base : 1 5411 } : null; 5412 return { 5413 kind: "camera", 5414 interpolationType: i, 5415 interpolationFactor: Wo.interpolationFactor.bind(void 0, i), 5416 zoomStops: e1.stops.map((e1)=>e1[0]), 5417 evaluate: (param)=>{ 5418 let { zoom: i } = param; 5419 return a(e1, t1, i, s, l); 5420 } 5421 }; 5422 } 5423 return { 5424 kind: "source", 5425 evaluate (i, n) { 5426 const r = n && n.properties ? n.properties[e1.property] : void 0; 5427 return void 0 === r ? Ca(e1.default, t1.default) : a(e1, t1, r, s, l); 5428 } 5429 }; 5430 } 5431 function Ca(e1, t1, i) { 5432 return void 0 !== e1 ? e1 : void 0 !== t1 ? t1 : void 0 !== i ? i : void 0; 5433 } 5434 function La(e1, t1, i, n, r) { 5435 return Ca(typeof i === r ? n[i] : void 0, e1.default, t1.default); 5436 } 5437 function Oa(e1, t1, i) { 5438 if (!nr(i)) return Ca(e1.default, t1.default); 5439 const n = e1.stops.length; 5440 if (1 === n) return e1.stops[0][1]; 5441 if (i <= e1.stops[0][0]) return e1.stops[0][1]; 5442 if (i >= e1.stops[n - 1][0]) return e1.stops[n - 1][1]; 5443 const r = To(e1.stops.map((e1)=>e1[0]), i); 5444 return e1.stops[r][1]; 5445 } 5446 function Ba(e1, t1, i) { 5447 const n = void 0 !== e1.base ? e1.base : 1; 5448 if (!nr(i)) return Ca(e1.default, t1.default); 5449 const r = e1.stops.length; 5450 if (1 === r) return e1.stops[0][1]; 5451 if (i <= e1.stops[0][0]) return e1.stops[0][1]; 5452 if (i >= e1.stops[r - 1][0]) return e1.stops[r - 1][1]; 5453 const o = To(e1.stops.map((e1)=>e1[0]), i), a = function(e1, t1, i, n) { 5454 const r = n - i, o = e1 - i; 5455 return 0 === r ? 0 : 1 === t1 ? o / r : (Math.pow(t1, o) - 1) / (Math.pow(t1, r) - 1); 5456 }(i, n, e1.stops[o][0], e1.stops[o + 1][0]), s = e1.stops[o][1], l = e1.stops[o + 1][1]; 5457 let c = vn[t1.type] || Da; 5458 if (e1.colorSpace && "rgb" !== e1.colorSpace) { 5459 const t1 = Zo[e1.colorSpace]; 5460 c = (e1, i)=>t1.reverse(t1.interpolate(t1.forward(e1), t1.forward(i), a)); 5461 } 5462 return "function" == typeof s.evaluate ? { 5463 evaluate () { 5464 for(var _len = arguments.length, e1 = new Array(_len), _key = 0; _key < _len; _key++){ 5465 e1[_key] = arguments[_key]; 5466 } 5467 const t1 = s.evaluate.apply(void 0, e1), i = l.evaluate.apply(void 0, e1); 5468 if (void 0 !== t1 && void 0 !== i) return c(t1, i, a); 5469 } 5470 } : c(s, l, a); 5471 } 5472 function Va(e1, t1, i) { 5473 return "color" === t1.type ? i = mn.parse(i) : "formatted" === t1.type ? i = Un.fromString(i.toString()) : "resolvedImage" === t1.type ? i = Gn.build(i.toString()) : er(i) === t1.type || "enum" === t1.type && t1.values[i] || (i = void 0), Ca(i, e1.default, t1.default); 5474 } 5475 cr.register(ma, {
5476 error: [ 5477 { 5478 kind: "error" 5479 }, 5480 [ 5481 In 5482 ], 5483 (e1, param)=>{ 5484 let [t1] = param; 5485 throw new Xn(t1.evaluate(e1)); 5486 } 5487 ], 5488 typeof: [ 5489 In, 5490 [ 5491 zn 5492 ], 5493 (e1, param)=>{ 5494 let [t1] = param; 5495 return Cn(Zn(t1.evaluate(e1))); 5496 } 5497 ], 5498 "to-rgba": [ 5499 Fn(En, 4), 5500 [ 5501 Tn 5502 ], 5503 (e1, param)=>{ 5504 let [t1] = param; 5505 return t1.evaluate(e1).toNonPremultipliedRenderColor(null).toArray(); 5506 } 5507 ], 5508 "to-hsla": [ 5509 Fn(En, 4), 5510 [ 5511 Tn 5512 ], 5513 (e1, param)=>{ 5514 let [t1] = param; 5515 return t1.evaluate(e1).toNonPremultipliedRenderColor(null).toHslaArray(); 5516 } 5517 ], 5518 rgb: [ 5519 Tn, 5520 [ 5521 En, 5522 En, 5523 En 5524 ], 5525 _a 5526 ], 5527 rgba: [ 5528 Tn, 5529 [ 5530 En, 5531 En, 5532 En, 5533 En 5534 ], 5535 _a 5536 ], 5537 hsl: [ 5538 Tn, 5539 [ 5540 En, 5541 En, 5542 En 5543 ], 5544 ga 5545 ], 5546 hsla: [ 5547 Tn, 5548 [ 5549 En, 5550 En, 5551 En, 5552 En 5553 ], 5554 ga 5555 ], 5556 has: { 5557 type: Mn, 5558 overloads: [ 5559 [ 5560 [ 5561 In 5562 ], 5563 (e1, param)=>{ 5564 let [t1] = param; 5565 return ya(t1.evaluate(e1), e1.properties()); 5566 } 5567 ], 5568 [ 5569 [ 5570 In, 5571 Sn 5572 ], 5573 (e1, param)=>{ 5574 let [t1, i] = param; 5575 return ya(t1.evaluate(e1), i.evaluate(e1)); 5576 } 5577 ] 5578 ] 5579 }, 5580 get: { 5581 type: zn, 5582 overloads: [ 5583 [ 5584 [ 5585 In 5586 ], 5587 (e1, param)=>{ 5588 let [t1] = param; 5589 return xa(t1.evaluate(e1), e1.properties()); 5590 } 5591 ], 5592 [ 5593 [ 5594 In, 5595 Sn 5596 ], 5597 (e1, param)=>{ 5598 let [t1, i] = param; 5599 return xa(t1.evaluate(e1), i.evaluate(e1)); 5600 } 5601 ] 5602 ] 5603 }, 5604 "feature-state": [ 5605 zn, 5606 [ 5607 In 5608 ], 5609 (e1, param)=>{ 5610 let [t1] = param; 5611 return xa(t1.evaluate(e1), e1.featureState || {}); 5612 } 5613 ], 5614 properties: [ 5615 Sn, 5616 [], 5617 (e1)=>e1.properties() 5618 ], 5619 "geometry-type": [ 5620 In, 5621 [], 5622 (e1)=>e1.geometryType() 5623 ], 5624 worldview: [ 5625 In, 5626 [], 5627 (e1)=>e1.globals.worldview || "" 5628 ], 5629 "is-active-floor": [ 5630 Mn, 5631 va(In), 5632 (e1, t1)=>{ 5633 if (!(e1.globals && e1.globals.activeFloors && e1.globals.activeFloors.size > 0)) return !1; 5634 if (0 === t1.length) return !0; 5635 const i = e1.globals.activeFloors; 5636 return t1.some((t1)=>{ 5637 const n = t1.evaluate(e1); 5638 return i.has(n); 5639 }); 5640 } 5641 ], 5642 id: [ 5643 zn, 5644 [], 5645 (e1)=>e1.id() 5646 ], 5647 zoom: [ 5648 En, 5649 [], 5650 (e1)=>e1.globals.zoom 5651 ], 5652 pitch: [ 5653 En, 5654 [], 5655 (e1)=>e1.globals.pitch || 0 5656 ], 5657 "distance-from-center": [ 5658 En, 5659 [], 5660 (e1)=>e1.distanceFromCenter() 5661 ], 5662 "measure-light": [ 5663 En, 5664 [ 5665 In 5666 ], 5667 (e1, param)=>
5667{ 5668 let [t1] = param; 5669 return e1.measureLight(t1.evaluate(e1)); 5670 } 5671 ], 5672 "heatmap-density": [ 5673 En, 5674 [], 5675 (e1)=>e1.globals.heatmapDensity || 0 5676 ], 5677 "line-progress": [ 5678 En, 5679 [], 5680 (e1)=>e1.globals.lineProgress || 0 5681 ], 5682 "raster-value": [ 5683 En, 5684 [], 5685 (e1)=>e1.globals.rasterValue || 0 5686 ], 5687 "raster-particle-speed": [ 5688 En, 5689 [], 5690 (e1)=>e1.globals.rasterParticleSpeed || 0 5691 ], 5692 "sky-radial-progress": [ 5693 En, 5694 [], 5695 (e1)=>e1.globals.skyRadialProgress || 0 5696 ], 5697 accumulated: [ 5698 zn, 5699 [], 5700 (e1)=>void 0 === e1.globals.accumulated ? null : e1.globals.accumulated 5701 ], 5702 "+": [ 5703 En, 5704 va(En), 5705 (e1, t1)=>{ 5706 let i = 0; 5707 for (const n of t1)i += n.evaluate(e1); 5708 return i; 5709 } 5710 ], 5711 "*": [ 5712 En, 5713 va(En), 5714 (e1, t1)=>{ 5715 let i = 1; 5716 for (const n of t1)i *= n.evaluate(e1); 5717 return i; 5718 } 5719 ], 5720 "-": { 5721 type: En, 5722 overloads: [ 5723 [ 5724 [ 5725 En, 5726 En 5727 ], 5728 (e1, param)=>{ 5729 let [t1, i] = param; 5730 return t1.evaluate(e1) - i.evaluate(e1); 5731 } 5732 ], 5733 [ 5734 [ 5735 En 5736 ], 5737 (e1, param)=>{ 5738 let [t1] = param; 5739 return -t1.evaluate(e1); 5740 } 5741 ] 5742 ] 5743 }, 5744 "/": [ 5745 En, 5746 [ 5747 En, 5748 En 5749 ], 5750 (e1, param)=>{ 5751 let [t1, i] = param; 5752 return t1.evaluate(e1) / i.evaluate(e1); 5753 } 5754 ], 5755 "%": [ 5756 En, 5757 [ 5758 En, 5759 En 5760 ], 5761 (e1, param)=>{ 5762 let [t1, i] = param; 5763 return t1.evaluate(e1) % i.evaluate(e1); 5764 } 5765 ], 5766 ln2: [ 5767 En, 5768 [], 5769 ()=>Math.LN2 5770 ], 5771 pi: [ 5772 En, 5773 [], 5774 ()=>Math.PI 5775 ], 5776 e: [ 5777 En, 5778 [], 5779 ()=>Math.E 5780 ], 5781 "^": [ 5782 En, 5783 [ 5784 En, 5785 En 5786 ], 5787 (e1, param)=>{ 5788 let [t1, i] = param; 5789 return Math.pow(t1.evaluate(e1), i.evaluate(e1)); 5790 } 5791 ], 5792 sqrt: [ 5793 En, 5794 [ 5795 En 5796 ], 5797 (e1, param)=>{ 5798 let [t1] = param; 5799 return Math.sqrt(t1.evaluate(e1)); 5800 } 5801 ], 5802 log10: [ 5803 En, 5804 [ 5805 En 5806 ], 5807 (e1, param)=>{ 5808 let [t1] = param; 5809 return Math.log(t1.evaluate(e1)) / Math.LN10; 5810 } 5811 ], 5812 ln: [ 5813 En, 5814 [ 5815 En 5816 ], 5817 (e1, param)=>{ 5818 let [t1] = param; 5819 return Math.log(t1.evaluate(e1)); 5820 } 5821 ], 5822 log2: [ 5823 En, 5824 [ 5825 En 5826 ], 5827 (e1, param)=>
5827{ 5828 let [t1] = param; 5829 return Math.log2(t1.evaluate(e1)); 5830 } 5831 ], 5832 sin: [ 5833 En, 5834 [ 5835 En 5836 ], 5837 (e1, param)=>{ 5838 let [t1] = param; 5839 return Math.sin(t1.evaluate(e1)); 5840 } 5841 ], 5842 cos: [ 5843 En, 5844 [ 5845 En 5846 ], 5847 (e1, param)=>{ 5848 let [t1] = param; 5849 return Math.cos(t1.evaluate(e1)); 5850 } 5851 ], 5852 tan: [ 5853 En, 5854 [ 5855 En 5856 ], 5857 (e1, param)=>{ 5858 let [t1] = param; 5859 return Math.tan(t1.evaluate(e1)); 5860 } 5861 ], 5862 asin: [ 5863 En, 5864 [ 5865 En 5866 ], 5867 (e1, param)=>{ 5868 let [t1] = param; 5869 return Math.asin(t1.evaluate(e1)); 5870 } 5871 ], 5872 acos: [ 5873 En, 5874 [ 5875 En 5876 ], 5877 (e1, param)=>{ 5878 let [t1] = param; 5879 return Math.acos(t1.evaluate(e1)); 5880 } 5881 ], 5882 atan: [ 5883 En, 5884 [ 5885 En 5886 ], 5887 (e1, param)=>{ 5888 let [t1] = param; 5889 return Math.atan(t1.evaluate(e1)); 5890 } 5891 ], 5892 min: [ 5893 En, 5894 va(En), 5895 (e1, t1)=>Math.min(...t1.map((t1)=>t1.evaluate(e1))) 5896 ], 5897 max: [ 5898 En, 5899 va(En), 5900 (e1, t1)=>Math.max(...t1.map((t1)=>t1.evaluate(e1))) 5901 ], 5902 abs: [ 5903 En, 5904 [ 5905 En 5906 ], 5907 (e1, param)=>{ 5908 let [t1] = param; 5909 return Math.abs(t1.evaluate(e1)); 5910 } 5911 ], 5912 round: [ 5913 En, 5914 [ 5915 En 5916 ], 5917 (e1, param)=>{ 5918 let [t1] = param; 5919 const i = t1.evaluate(e1); 5920 return i < 0 ? -Math.round(-i) : Math.round(i); 5921 } 5922 ], 5923 floor: [ 5924 En, 5925 [ 5926 En 5927 ], 5928 (e1, param)=>{ 5929 let [t1] = param; 5930 return Math.floor(t1.evaluate(e1)); 5931 } 5932 ], 5933 ceil: [ 5934 En, 5935 [ 5936 En 5937 ], 5938 (e1, param)=>{ 5939 let [t1] = param; 5940 return Math.ceil(t1.evaluate(e1)); 5941 } 5942 ], 5943 "filter-==": [ 5944 Mn, 5945 [ 5946 In, 5947 zn 5948 ], 5949 (e1, param)=>{ 5950 let [t1, i] = param; 5951 return e1.properties()[t1.value] === i.value; 5952 } 5953 ], 5954 "filter-id-==": [ 5955 Mn, 5956 [ 5957 zn 5958 ], 5959 (e1, param)=>{ 5960 let [t1] = param; 5961 return e1.id() === t1.value; 5962 } 5963 ], 5964 "filter-type-==": [ 5965 Mn, 5966 [ 5967 In 5968 ], 5969 (e1, param)=>{ 5970 let [t1] = param; 5971 return e1.geometryType() === t1.value; 5972 } 5973 ], 5974 "filter-<": [ 5975 Mn, 5976 [ 5977 In, 5978 zn 5979 ], 5980 (e1, param)=>{ 5981 let [t1, i] = param; 5982 const n = e1.properties()[t1.value], r = i.value; 5983 return typeof n == typeof r && n < r; 5984 } 5985 ], 5986 "filter-id-<": [ 5987 Mn, 5988 [ 5989 zn 5990 ], 5991 (e1, param)=>
5991{ 5992 let [t1] = param; 5993 const i = e1.id(), n = t1.value; 5994 return typeof i == typeof n && i < n; 5995 } 5996 ], 5997 "filter->": [ 5998 Mn, 5999 [ 6000 In, 6001 zn 6002 ], 6003 (e1, param)=>{ 6004 let [t1, i] = param; 6005 const n = e1.properties()[t1.value], r = i.value; 6006 return typeof n == typeof r && n > r; 6007 } 6008 ], 6009 "filter-id->": [ 6010 Mn, 6011 [ 6012 zn 6013 ], 6014 (e1, param)=>{ 6015 let [t1] = param; 6016 const i = e1.id(), n = t1.value; 6017 return typeof i == typeof n && i > n; 6018 } 6019 ], 6020 "filter-<=": [ 6021 Mn, 6022 [ 6023 In, 6024 zn 6025 ], 6026 (e1, param)=>{ 6027 let [t1, i] = param; 6028 const n = e1.properties()[t1.value], r = i.value; 6029 return typeof n == typeof r && n <= r; 6030 } 6031 ], 6032 "filter-id-<=": [ 6033 Mn, 6034 [ 6035 zn 6036 ], 6037 (e1, param)=>{ 6038 let [t1] = param; 6039 const i = e1.id(), n = t1.value; 6040 return typeof i == typeof n && i <= n; 6041 } 6042 ], 6043 "filter->=": [ 6044 Mn, 6045 [ 6046 In, 6047 zn 6048 ], 6049 (e1, param)=>{ 6050 let [t1, i] = param; 6051 const n = e1.properties()[t1.value], r = i.value; 6052 return typeof n == typeof r && n >= r; 6053 } 6054 ], 6055 "filter-id->=": [ 6056 Mn, 6057 [ 6058 zn 6059 ], 6060 (e1, param)=>{ 6061 let [t1] = param; 6062 const i = e1.id(), n = t1.value; 6063 return typeof i == typeof n && i >= n; 6064 } 6065 ], 6066 "filter-has": [ 6067 Mn, 6068 [ 6069 zn 6070 ], 6071 (e1, param)=>{ 6072 let [t1] = param; 6073 return t1.value in e1.properties(); 6074 } 6075 ], 6076 "filter-has-id": [ 6077 Mn, 6078 [], 6079 (e1)=>null !== e1.id() && void 0 !== e1.id() 6080 ], 6081 "filter-type-in": [ 6082 Mn, 6083 [ 6084 Fn(In) 6085 ], 6086 (e1, param)=>{ 6087 let [t1] = param; 6088 return t1.value.includes(e1.geometryType()); 6089 } 6090 ], 6091 "filter-id-in": [ 6092 Mn, 6093 [ 6094 Fn(zn) 6095 ], 6096 (e1, param)=>{ 6097 let [t1] = param; 6098 return t1.value.includes(e1.id()); 6099 } 6100 ], 6101 "filter-in-small": [ 6102 Mn, 6103 [ 6104 In, 6105 Fn(zn) 6106 ], 6107 (e1, param)=>{ 6108 let [t1, i] = param; 6109 return i.value.includes(e1.properties()[t1.value]); 6110 } 6111 ], 6112 "filter-in-large": [ 6113 Mn, 6114 [ 6115 In, 6116 Fn(zn) 6117 ], 6118 (e1, param)=>{ 6119 let [t1, i] = param; 6120 return function(e1, t1, i, n) { 6121 for(; i <= n;){ 6122 const r = i + n >> 1; 6123 if (t1[r] === e1) return !0; 6124 t1[r] > e1 ? n = r - 1 : i = r + 1; 6125 } 6126 return !1; 6127 }(e1.properties()[t1.value], i.value, 0, i.value.length - 1); 6128 } 6129 ], 6130 all: { 6131 type: Mn, 6132 overloads: [ 6133 [ 6134 [ 6135 Mn, 6136 Mn 6137 ], 6138 (e1, param)=>
6138{ 6139 let [t1, i] = param; 6140 return t1.evaluate(e1) && i.evaluate(e1); 6141 } 6142 ], 6143 [ 6144 va(Mn), 6145 (e1, t1)=>{ 6146 for (const i of t1)if (!i.evaluate(e1)) return !1; 6147 return !0; 6148 } 6149 ] 6150 ] 6151 }, 6152 any: { 6153 type: Mn, 6154 overloads: [ 6155 [ 6156 [ 6157 Mn, 6158 Mn 6159 ], 6160 (e1, param)=>{ 6161 let [t1, i] = param; 6162 return t1.evaluate(e1) || i.evaluate(e1); 6163 } 6164 ], 6165 [ 6166 va(Mn), 6167 (e1, t1)=>{ 6168 for (const i of t1)if (i.evaluate(e1)) return !0; 6169 return !1; 6170 } 6171 ] 6172 ] 6173 }, 6174 "!": [ 6175 Mn, 6176 [ 6177 Mn 6178 ], 6179 (e1, param)=>{ 6180 let [t1] = param; 6181 return !t1.evaluate(e1); 6182 } 6183 ], 6184 "is-supported-script": [ 6185 Mn, 6186 [ 6187 In 6188 ], 6189 (e1, param)=>{ 6190 let [t1] = param; 6191 const i = e1.globals && e1.globals.isSupportedScript; 6192 return !i || i(t1.evaluate(e1)); 6193 } 6194 ], 6195 upcase: [ 6196 In, 6197 [ 6198 In 6199 ], 6200 (e1, param)=>{ 6201 let [t1] = param; 6202 return t1.evaluate(e1).toUpperCase(); 6203 } 6204 ], 6205 downcase: [ 6206 In, 6207 [ 6208 In 6209 ], 6210 (e1, param)=>{ 6211 let [t1] = param; 6212 return t1.evaluate(e1).toLowerCase(); 6213 } 6214 ], 6215 concat: [ 6216 In, 6217 va(zn), 6218 (e1, t1)=>t1.map((t1)=>Wn(t1.evaluate(e1))).join("") 6219 ], 6220 split: [ 6221 Fn(In), 6222 [ 6223 In, 6224 In 6225 ], 6226 (e1, param)=>{ 6227 let [t1, i] = param; 6228 return t1.evaluate(e1).split(i.evaluate(e1)); 6229 } 6230 ], 6231 in: [ 6232 Mn, 6233 [ 6234 zn, 6235 zn 6236 ], 6237 (e1, param)=>{ 6238 let [t1, i] = param; 6239 const n = t1.evaluate(e1), r = i.evaluate(e1); 6240 return null != r && (ba(n, r), r.includes(n)); 6241 } 6242 ], 6243 "index-of": { 6244 type: En, 6245 overloads: [ 6246 [ 6247 [ 6248 zn, 6249 zn 6250 ], 6251 (e1, param)=>{ 6252 let [t1, i] = param; 6253 const n = t1.evaluate(e1), r = i.evaluate(e1); 6254 return ba(n, r), r.indexOf(n); 6255 } 6256 ], 6257 [ 6258 [ 6259 zn, 6260 zn, 6261 En 6262 ], 6263 (e1, param)=>{ 6264 let [t1, i, n] = param; 6265 const r = t1.evaluate(e1), o = i.evaluate(e1), a = n.evaluate(e1); 6266 return ba(r, o), o.indexOf(r, a); 6267 } 6268 ] 6269 ] 6270 }, 6271 "resolved-locale": [ 6272 In, 6273 [ 6274 Rn 6275 ], 6276 (e1, param)=>
6276{ 6277 let [t1] = param; 6278 return t1.evaluate(e1).resolvedLocale(); 6279 } 6280 ], 6281 random: [ 6282 En, 6283 [ 6284 En, 6285 En, 6286 zn 6287 ], 6288 (e1, t1)=>{ 6289 const [i, n, r] = t1.map((t1)=>t1.evaluate(e1)); 6290 if (i > n) return i; 6291 if (i === n) return i; 6292 let o; 6293 if ("string" == typeof r) o = function(e1) { 6294 let t1 = 0; 6295 if (0 === e1.length) return t1; 6296 for(let i = 0; i < e1.length; i++)t1 = (t1 << 5) - t1 + e1.charCodeAt(i), t1 &= t1; 6297 return t1; 6298 }(r); 6299 else { 6300 if ("number" != typeof r) throw new Xn("Invalid seed input: ".concat(r)); 6301 o = r; 6302 } 6303 return i + pa(o)() * (n - i); 6304 } 6305 ] 6306 }); 6307 class Na { 6308 evaluateWithoutErrorHandling(e1, t1, i, n, r, o, a, s) { 6309 const l = this._evaluator; 6310 return l.globals = e1, l.feature = t1, l.featureState = i, l.canonical = n || null, l.availableImages = r || null, l.formattedSection = o, l.featureTileCoord = a || null, l.featureDistanceData = s || null, this.expression.evaluate(l); 6311 } 6312 evaluate(e1, t1, i, n, r, o, a, s, l) { 6313 this._evaluator || (this._evaluator = new lr(this._scope, this._options, this._iconImageUseTheme)), this._evaluator.globals = e1, this._evaluator.feature = t1 || null, this._evaluator.featureState = i || null, this._evaluator.canonical = n || null, this._evaluator.availableImages = r || null, this._evaluator.formattedSection = o || null, this._evaluator.featureTileCoord = a || null, this._evaluator.featureDistanceData = s || null, this._evaluator.iconImageUseTheme = l || null; 6314 try { 6315 const e1 = this.expression.evaluate(this._evaluator); 6316 if (null == e1 || "number" == typeof e1 && e1 != e1) return this._defaultValue; 6317 if (this._enumValues && !(e1 in this._enumValues)) throw new Xn("Expected value to be one of ".concat(Object.keys(this._enumValues).map((e1)=>JSON.stringify(e1)).join(", "), ", but found ").concat(JSON.stringify(e1), " instead.")); 6318 return e1; 6319 } catch (e1) { 6320 const t1 = e1; 6321 return this._warningHistory[t1.message] || (this._warningHistory[t1.message] = !0, "undefined" != typeof console && console.warn('Failed to evaluate expression "'.concat(JSON.stringify(this.expression.serialize()), '". ').concat(t1.message))), this._defaultValue; 6322 } 6323 } 6324 constructor(e1, t1, i, n, r){ 6325 this.expression = e1, this._warningHistory = {}, this._scope = i, this._options = n, this._iconImageUseTheme = r, this._evaluator = new lr(i, n, r), this._defaultValue = t1 ? function(e1) { 6326 return "color" === e1.type && (Pa(e1.default) || Array.isArray(e1.default)) ? new mn(0, 0, 0, 0) : "color" === e1.type ? mn.parse(e1.default) || null : void 0 === e1.default ? null : e1.default; 6327 }(t1) : null, this._enumValues = t1 && "enum" === t1.type ? t1.values : null, this.configDependencies = wa(e1), this.isIndoorDependent = Aa(e1); 6328 } 6329 } 6330 function ka(e1) { 6331 return Array.isArray(e1) && e1.length > 0 && "string" == typeof e1[0] && Object.hasOwn(ma, e1[0]); 6332 } 6333 function Ua(e1, t1, i, n, r) { 6334 const o = new Ao(ma, [], t1 ? function(e1) { 6335 const t1 = { 6336 color: Tn, 6337 string: In, 6338 number: En, 6339 enum: In, 6340 boolean: Mn, 6341 formatted: Pn, 6342 resolvedImage: Dn, 6343 object: Sn 6344 }; 6345 return "array" === e1.type ? Fn(t1[e1.value] || zn, e1.length) : t1[e1.type]; 6346 }(t1) : void 0, void 0, void 0, i, n, r), a = o.parse(e1, void 0, void 0, void 0, t1 && "string" === t1.type ? { 6347 typeAnnotation: "coerce" 6348 } : void 0); 6349 return a ? Ea(new Na(a, t1, i, n, r)) : Ia(o.errors); 6350 } 6351 class ja { 6352 evaluateWithoutErrorHandling(e1, t1, i, n, r, o) { 6353 return this._styleExpression.evaluateWithoutErrorHandling(e1, t1, i, n, r, o); 6354 } 6355 evaluate(e1, t1, i, n, r, o, a) { 6356 return this._styleExpression.evaluate(e1, t1, i, n, r, o, void 0, void 0, a); 6357 } 6358 constructor(e1, t1, i, n){ 6359 this.kind = e1, this._styleExpression = t1, this.isLightConstant = i, this.isLineProgressConstant = n, this.isStateDependent = "constant" !== e1 && !Lr(t1.expression), this.configDependencies = wa(t1.expression), this.isIndo
6359orDependent = Aa(t1.expression); 6360 } 6361 } 6362 class Ga { 6363 evaluateWithoutErrorHandling(e1, t1, i, n, r, o) { 6364 return this._styleExpression.evaluateWithoutErrorHandling(e1, t1, i, n, r, o); 6365 } 6366 evaluate(e1, t1, i, n, r, o) { 6367 return this._styleExpression.evaluate(e1, t1, i, n, r, o); 6368 } 6369 interpolationFactor(e1, t1, i) { 6370 return this.interpolationType ? Wo.interpolationFactor(this.interpolationType, e1, t1, i) : 0; 6371 } 6372 constructor(e1, t1, i, n, r, o){ 6373 this.kind = e1, this.zoomStops = i, this._styleExpression = t1, this.isStateDependent = "camera" !== e1 && !Lr(t1.expression), this.isIndoorDependent = Aa(t1.expression), this.isLightConstant = r, this.isLineProgressConstant = o, this.configDependencies = wa(t1.expression), this.interpolationType = n; 6374 } 6375 } 6376 function Ha(e1, t1, i, n, r) { 6377 if ("error" === (e1 = Ua(e1, t1, i, n, r)).result) return e1; 6378 const o = e1.value.expression, a = Cr(o); 6379 if (!a && !Ta(t1)) return Ia([ 6380 new bn("", "data expressions not supported") 6381 ]); 6382 const s = Br(o, [ 6383 "zoom", 6384 "pitch", 6385 "distance-from-center" 6386 ]); 6387 if (!s && !za(t1)) return Ia([ 6388 new bn("", "zoom expressions not supported") 6389 ]); 6390 const l = Br(o, [ 6391 "measure-light" 6392 ]); 6393 if (!l && !Sa(t1)) return Ia([ 6394 new bn("", "measure-light expression not supported") 6395 ]); 6396 const c = Br(o, [ 6397 "line-progress" 6398 ]); 6399 if (!c && !function(e1) { 6400 return Ma(e1.expression, "line-progress"); 6401 }(t1)) return Ia([ 6402 new bn("", "line-progress expression not supported") 6403 ]); 6404 const u = t1.expression && t1.expression.relaxZoomRestriction, h = Za(o); 6405 return h || s || u ? h instanceof bn ? Ia([ 6406 h 6407 ]) : h instanceof Wo && !Ra(t1) ? Ia([ 6408 new bn("", '"interpolate" expressions cannot be used with this property') 6409 ]) : Ea(h ? new Ga(a && c ? "camera" : "composite", e1.value, h.labels, h instanceof Wo ? h.interpolation : void 0, l, c) : new ja(a && c ? "constant" : "source", e1.value, l, c)) : Ia([ 6410 new bn("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.') 6411 ]); 6412 } 6413 class $a { 6414 static deserialize(e1) { 6415 return new $a(e1._parameters, e1._specification); 6416 } 6417 static serialize(e1) { 6418 return { 6419 _parameters: e1._parameters, 6420 _specification: e1._specification 6421 }; 6422 } 6423 constructor(e1, t1){ 6424 this._parameters = e1, this._specification = t1, Object.assign(this, Fa(this._parameters, this._specification)); 6425 } 6426 } 6427 function Za(e1) { 6428 let t1 = null; 6429 if (e1 instanceof Jo) t1 = Za(e1.result); 6430 else if (e1 instanceof Xo) { 6431 for (const i of e1.args)if (t1 = Za(i), t1) break; 6432 } else (e1 instanceof So || e1 instanceof Wo) && e1.input instanceof cr && "zoom" === e1.input.name && (t1 = e1); 6433 return t1 instanceof bn || e1.eachChild((e1)=>{ 6434 const i = Za(e1); 6435 i instanceof bn ? t1 = i : t1 && i && t1 !== i && (t1 = new bn("", 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.')); 6436 }), t1; 6437 } 6438 class Wa { 6439 keysLength() { 6440 return this.boxKeys.length + this.circleKeys.length; 6441 } 6442 clear() { 6443 for (const e1 of this.boxCells)e1 && (e1.length = 0); 6444 for (const e1 of this.circleCells)e1 && (e1.length = 0); 6445 this.circleKeys.length = 0, this.boxKeys.length = 0, this.bboxes.length = 0, this.circles.length = 0, this.boxUid = 0, this.circleUid = 0; 6446 } 6447 insert(e1, t1, i, n, r) { 6448 const o = this.boxUid++, a = this._xCell(t1), s = this._yCell(i), l = this._xCell(n), c = this._yCell(r); 6449 for(let e1 = a; e1 <= l; e1++)for(let t1 = s; t1 <= c; t1++)this.boxCells[this.xCellCount * t1 + e1].push(o); 6450 this.boxKeys.push(e1), this.bboxes.push(t1, i, n, r); 6451 }
vendor: 10,262 bytes, lines 6452-6627
6452 insertCircle(e1, t1, i, n) { 6453 const r = this.circleUid++, o = this._xCell(t1 - n), a = this._yCell(i - n), s = this._xCell(t1 + n), l = this._yCell(i + n); 6454 for(let e1 = o; e1 <= s; e1++)for(let t1 = a; t1 <= l; t1++)this.circleCells[this.xCellCount * t1 + e1].push(r); 6455 this.circleKeys.push(e1), this.circles.push(t1, i, n); 6456 } 6457 query(e1, t1, i, n, r) { 6458 const o = []; 6459 if (i < 0 || e1 > this.width || n < 0 || t1 > this.height) return o; 6460 const a = this._nextGen(), { boxCells: s, circleCells: l, boxKeys: c, circleKeys: u, bboxes: h, circles: d, boxSeen: f, circleSeen: p, xCellCount: m } = this, _ = this._xCell(e1), g = this._yCell(t1), y = this._xCell(i), x = this._yCell(n); 6461 for(let v = _; v <= y; v++)for(let _ = g; _ <= x; _++){ 6462 const g = m * _ + v, y = s[g]; 6463 if (y) for(let s = 0; s < y.length; s++){ 6464 const l = y[s]; 6465 if (f[l] === a) continue; 6466 f[l] = a; 6467 const u = 4 * l, d = h[u], p = h[u + 1], m = h[u + 2], _ = h[u + 3]; 6468 e1 <= m && t1 <= _ && i >= d && n >= p && (!r || r(c[l])) && o.push({ 6469 key: c[l], 6470 x1: d, 6471 y1: p, 6472 x2: m, 6473 y2: _ 6474 }); 6475 } 6476 const x = l[g]; 6477 if (x) for(let s = 0; s < x.length; s++){ 6478 const l = x[s]; 6479 if (p[l] === a) continue; 6480 p[l] = a; 6481 const c = 3 * l, h = d[c], f = d[c + 1], m = d[c + 2]; 6482 !this._circleAndRectCollide(h, f, m, e1, t1, i, n) || r && !r(u[l]) || o.push({ 6483 key: u[l], 6484 x1: h - m, 6485 y1: f - m, 6486 x2: h + m, 6487 y2: f + m 6488 }); 6489 } 6490 } 6491 return o; 6492 } 6493 queryKeys(e1, t1, i, n, r) { 6494 const o = []; 6495 if (i < 0 || e1 > this.width || n < 0 || t1 > this.height) return o; 6496 const a = this._nextGen(), { boxCells: s, boxKeys: l, bboxes: c, boxSeen: u, xCellCount: h, xScale: d, yScale: f } = this, p = this._xCell(e1), m = this._yCell(t1), _ = this._xCell(i), g = this._yCell(n); 6497 for(let y = p; y <= _; y++)for(let p = m; p <= g; p++){ 6498 if (r && !r(y / d, p / f, (y + 1) / d, (p + 1) / f)) continue; 6499 const m = s[h * p + y]; 6500 if (m) for(let s = 0; s < m.length; s++){ 6501 const h = m[s]; 6502 if (u[h] === a) continue; 6503 u[h] = a; 6504 const d = 4 * h, f = c[d], p = c[d + 1], _ = c[d + 2], g = c[d + 3]; 6505 (r ? r(f, p, _, g) : e1 <= _ && t1 <= g && i >= f && n >= p) && o.push(l[h]); 6506 } 6507 } 6508 return o; 6509 } 6510 hitTest(e1, t1, i, n, r) { 6511 if (i < 0 || e1 > this.width || n < 0 || t1 > this.height) return !1; 6512 const o = this._nextGen(), { boxCells: a, circleCells: s, boxKeys: l, circleKeys: c, bboxes: u, circles: h, boxSeen: d, circleSeen: f, xCellCount: p } = this, m = this._xCell(e1), _ = this._yCell(t1), g = this._xCell(i), y = this._yCell(n); 6513 for(let x = m; x <= g; x++)for(let m = _; m <= y; m++){ 6514 const _ = p * m + x, g = a[_]; 6515 if (g) for(let a = 0; a < g.length; a++){ 6516 const s = g[a]; 6517 if (d[s] === o) continue; 6518 d[s] = o; 6519 const c = 4 * s; 6520 if (e1 <= u[c + 2] && t1 <= u[c + 3] && i >= u[c] && n >= u[c + 1] && (!r || r(l[s]))) return !0; 6521 } 6522 const y = s[_]; 6523 if (y) for(let a = 0; a < y.length; a++){ 6524 const s = y[a]; 6525 if (f[s] === o) continue; 6526 f[s] = o; 6527 const l = 3 * s; 6528 if (this._circleAndRectCollide(h[l], h[l + 1], h[l + 2], e1, t1, i, n) && (!r || r(c[s]))) return !0; 6529 } 6530 } 6531 return !1; 6532 } 6533 hitTestCircle(e1, t1, i, n) { 6534 const r = e1 - i, o = t1 - i, a = e1 + i, s = t1 + i; 6535 if (a < 0 || r > this.width || s < 0 || o > this.height) return !1; 6536 const l = this._nextGen(), { boxCells: c, circleCells: u, boxKeys: h, circleKeys: d, bboxes: f, circles: p, boxSeen: m, circleSeen: _, xCellCount: g } = this, y = this._xCell(r), x = this._yCell(o), v = this._xCell(a), b = this._yCell(s); 6537 for(let r = y; r <= v; r++)for(let o = x; o <= b; o++){ 6538 const a = g * o + r, s = c[a]; 6539 if (s) for(let r = 0; r < s.length; r++){ 6540 const o = s[r]; 6541 if (m[o] === l) continue; 6542 m[o] = l; 6543 const a = 4 * o; 6544 if (this._circleAndRectCollide(e1, t1, i, f[a], f[a + 1], f[a + 2], f[a + 3]) && (!n || n(h[o]))) return !0; 6545 } 6546 const y = u[a]; 6547 if (y) for(let r = 0; r < y.length; r++){ 6548 const o = y[r]; 6549 if (_[o] === l) continue; 6550 _[o] = l; 6551 const a = 3 * o; 6552 if (this._circlesCollide(p[a], p[a + 1], p[a + 2], e1, t1, i) && (!n || n(d[o]))) return !0; 6553 } 6554 } 6555 return !1; 6556 } 6557 static serialize(e1, t1) { 6558 const i = e1.toArrayBuffer(); 6559 return t1 && t1.add(i), { 6560 buffer: i 6561 }; 6562 } 6563 static deserialize(e1) { 6564 return new Wa(e1.buffer); 6565 } 6566 toArrayBuffer() { 6567 const e1 = this.xCellCount * this.yCellCount; 6568 let t1 = 0, i = 0; 6569 for(let n = 0; n < e1; n++)t1 += this.boxCells[n].length, i += this.circleCells[n].length; 6570 const n = new Int32Array(6 + (e1 + 1) + t1 + (e1 + 1) + i + this.boxUid + this.circleUid + 4 * this.boxUid + 3 * this.circleUid); 6571 n[0] = this.width, n[1] = this.height, n[2] = this.xCellCount, n[3] = this.yCellCount, n[4] = this.boxUid, n[5] = this.circleUid; 6572 let r = 6 + (e1 + 1); 6573 for(let t1 = 0; t1 < e1; t1++){ 6574 n[6 + t1] = r; 6575 const e1 = this.boxCells[t1]; 6576 n.set(e1, r), r += e1.length; 6577 } 6578 n[6 + e1] = r; 6579 const o = r; 6580 r += e1 + 1; 6581 for(let t1 = 0; t1 < e1; t1++){ 6582 n[o + t1] = r; 6583 const e1 = this.circleCells[t1]; 6584 n.set(e1, r), r += e1.length; 6585 } 6586 return n[o + e1] = r, n.set(this.boxKeys, r), r += this.boxUid, n.set(this.circleKeys, r), r += this.circleUid, n.set(this.bboxes, r), r += 4 * this.boxUid, n.set(this.circles, r), n.buffer; 6587 } 6588 _xCell(e1) { 6589 return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(e1 * this.xScale))); 6590 } 6591 _yCell(e1) { 6592 return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(e1 * this.yScale))); 6593 } 6594 _nextGen() { 6595 return this.boxSeen.length < this.boxUid && (this.boxSeen = new Uint32Array(this.boxUid)), this.circleSeen.length < this.circleUid && (this.circleSeen = new Uint32Array(this.circleUid)), this.generation = this.generation + 1 >>> 0, 0 === this.generation && (this.boxSeen.fill(0), this.circleSeen.fill(0), this.generation = 1), this.generation; 6596 } 6597 _circlesCollide(e1, t1, i, n, r, o) { 6598 const a = n - e1, s = r - t1, l = i + o; 6599 return l * l > a * a + s * s; 6600 } 6601 _circleAndRectCollide(e1, t1, i, n, r, o, a) { 6602 const s = (o - n) / 2, l = Math.abs(e1 - (n + s)); 6603 if (l > s + i) return !1; 6604 const c = (a - r) / 2, u = Math.abs(t1 - (r + c)); 6605 if (u > c + i) return !1; 6606 if (l <= s || u <= c) return !0; 6607 const h = l - s, d = u - c; 6608 return h * h + d * d <= i * i; 6609 } 6610 constructor(e1, t1, i){ 6611 if (this.boxSeen = new Uint32Array(0), this.circleSeen = new Uint32Array(0), this.generation = 0, e1 instanceof ArrayBuffer) { 6612 const t1 = new Int32Array(e1); 6613 this.width = t1[0], this.height = t1[1], this.xCellCount = t1[2], this.yCellCount = t1[3], this.boxUid = t1[4], this.circleUid = t1[5]; 6614 const i = this.xCellCount * this.yCellCount, n = []; 6615 for(let e1 = 0; e1 < i; e1++){ 6616 const i = t1[6 + e1], r = t1[6 + e1 + 1]; 6617 n.push(i === r ? null : t1.subarray(i, r)); 6618 } 6619 const r = t1[6 + i], o = []; 6620 for(let e1 = 0; e1 < i; e1++){ 6621 const i = t1[r + e1], n = t1[r + e1 + 1]; 6622 o.push(i === n ? null : t1.subarray(i, n)); 6623 } 6624 let a = t1[r + i]; 6625 this.boxCells = n, this.circleCells = o, this.boxKeys = t1.subarray(a, a + this.boxUid), a += this.boxUid, this.circleKeys = t1.subarray(a, a + this.circleUid), a += this.circleUid, this.bboxes = t1.subarray(a, a + 4 * this.boxUid), a += 4 * this.boxUid, this.circles = t1.subarray(a, a + 3 * this.circleUid); 6626 } else { 6627 this.width = e1, this.height = t1, this.xCellCount = Math.
6627ceil(e1 / i), this.yCellCount = Math.ceil(t1 / i); 6628 const n = this.xCellCount * this.yCellCount, r = [], o = []; 6629 for(let e1 = 0; e1 < n; e1++)r.push([]), o.push([]); 6630 this.boxCells = r, this.circleCells = o, this.boxKeys = [], this.circleKeys = [], this.bboxes = [], this.circles = [], this.boxUid = 0, this.circleUid = 0; 6631 } 6632 this.xScale = this.xCellCount / this.width, this.yScale = this.yCellCount / this.height; 6633 } 6634 } 6635 const qa = {}; 6636 function Xa(e1, t1) { 6637 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 6638 Object.defineProperty(e1, "_classRegistryKey", { 6639 value: t1, 6640 writable: !1 6641 }), qa[t1] = { 6642 klass: e1, 6643 omit: i.omit || [] 6644 }; 6645 } 6646 Xa(Object, "Object"), Xa(Wa, "Grid"), delete Pe.prototype.constructor, Xa(mn, "Color"), Xa(Un, "Formatted"), Xa(kn, "FormattedSection"), Xa(Gn, "ResolvedImage"), Xa($a, "StylePropertyFunction"), Xa(Na, "StyleExpression", { 6647 omit: [ 6648 "_evaluator" 6649 ] 6650 }), Xa(cn, "ImageId"), Xa(jn, "ImageVariant"), Xa(Ga, "ZoomDependentExpression"), Xa(ja, "ZoomConstantExpression"), Xa(cr, "CompoundExpression", { 6651 omit: [ 6652 "_evaluate" 6653 ] 6654 }); 6655 for(const e1 in ma)qa[ma[e1]._classRegistryKey] || Xa(ma[e1], "Expression".concat(e1)); 6656 function Ya(e1) { 6657 return e1 && (e1 instanceof ArrayBuffer || e1.constructor && "ArrayBuffer" === e1.constructor.name); 6658 } 6659 const Ja = { 6660 Error, 6661 TypeError, 6662 RangeError, 6663 SyntaxError, 6664 ReferenceError, 6665 URIError, 6666 EvalError 6667 }, Ka = new Set([ 6668 "message", 6669 "stack", 6670 "cause", 6671 "errors", 6672 "name", 6673 "class" 6674 ]); 6675 function Qa(e1, t1) { 6676 if (null === e1) return null; 6677 const i = typeof e1; 6678 if ("object" !== i) return "bigint" === i ? { 6679 $name: "BigInt", 6680 value: e1.toString() 6681 } : e1; 6682 if (Array.isArray(e1)) { 6683 const i = e1.length, n = []; 6684 n.length = i; 6685 for(let r = 0; r < i; r++)n[r] = Qa(e1[r], t1); 6686 return n; 6687 } 6688 if (ArrayBuffer.isView(e1)) return t1 && t1.add(e1.buffer), e1; 6689 if (Ya(e1) || e1 instanceof ImageBitmap) return t1 && t1.add(e1), e1; 6690 if (e1 instanceof ImageData) return t1 && t1.add(e1.data.buffer), e1; 6691 if (e1 instanceof Map) { 6692 const i = { 6693 $name: "Map", 6694 entries: [] 6695 }; 6696 for (const [n, r] of e1.entries())i.entries.push(Qa(n), Qa(r, t1)); 6697 return i; 6698 } 6699 if (e1 instanceof Headers) return { 6700 $name: "Headers", 6701 entries: [ 6702 ...e1 6703 ] 6704 }; 6705 if (e1 instanceof Set) { 6706 const t1 = { 6707 $name: "Set" 6708 }; 6709 let i = 0; 6710 for (const n of e1.values())t1[++i] = Qa(n); 6711 return t1; 6712 } 6713 if (e1 instanceof Date || e1 instanceof RegExp || e1 instanceof Boolean || e1 instanceof Number || e1 instanceof String) return e1; 6714 if (e1 instanceof Error) { 6715 const i = e1, n = i.constructor && i.constructor.name || "Error", r = { 6716 $name: "$Error", 6717 class: i instanceof li ? "AJAXError" : i instanceof DOMException ? "DOMException" : i instanceof AggregateError ? "AggregateError" : Ja[n] ? n : "Error", 6718 name: i.name, 6719 message: i.message 6720 }; 6721 i.stack && (r.stack = i.stack), "cause" in i && i.cause !== i && (r.cause = Qa(i.cause, t1)), i instanceof AggregateError && (r.errors = i.errors.filter((e1)=>e1 !== i).map((e1)=>Qa(e1, t1))); 6722 const o = i; 6723 for(const e1 in o)Object.hasOwn(o, e1) && (Ka.has(e1) || (r[e1] = Qa(o[e1], t1))); 6724 return r; 6725 } 6726 const n = e1.constructor || Object, r = n._classRegistryKey; 6727 if (!r) throw new Error("Can't serialize object of unregistered class \"".concat(n.name, '".')); 6728 const o = n.serialize ? n.serialize(e1, t1) : {}; 6729 if (!n.serialize) { 6730 const i = qa[r].omit, n = e1; 6731 for(const e1 in n)Object.hasOwn(n, e1) && (i.includes(e1) || (o[e1] = Qa(n[e1], t1))); 6732 } 6733 if (o.$name) throw new Error("$name property is reserved for worker serialization logic."); 6734 return "Object" !== r && (o.$name = r), o; 6735 } 6736 function es(e1) { 6737 if (null === e1 || "object" != typeof e1) return e1; 6738 if (Array.isArray(e1)) { 6739 for(let t1 = 0; t1 < e1.length; t1++)e1[t1] = es(e1[t1]); 6740 return e1; 6741 } 6742 if (ArrayBuffer.isView(e1) || Ya(e1) || e1 instanceof ImageBitmap || e1 instanceof ImageData || e1 instanceof Date || e1 instanceof RegExp || e1 instanceof Boolean || e1 instanceof Number || e1 instanceof String) return e1; 6743 const t1 = e1.$name || "Object"; 6744 if ("Map" === t1) {
6745 const t1 = e1.entries || [], i = new Map; 6746 for(let e1 = 0; e1 < t1.length; e1 += 2)i.set(es(t1[e1]), es(t1[e1 + 1])); 6747 return i; 6748 } 6749 if ("Headers" === t1) return new Headers(e1.entries); 6750 if ("Set" === t1) { 6751 const t1 = new Set; 6752 for(const i in e1)"$name" !== i && t1.add(es(e1[i])); 6753 return t1; 6754 } 6755 if ("BigInt" === t1) return BigInt(e1.value); 6756 if ("$Error" === t1) { 6757 const t1 = e1.class || "Error", i = e1.name || t1, n = e1.message || ""; 6758 let r; 6759 r = "DOMException" === t1 ? new DOMException(n, i) : "AggregateError" === t1 ? new AggregateError((e1.errors || []).map(es), n) : "AJAXError" === t1 ? new li(e1.statusText, e1.status, e1.url) : new (Ja[t1] || Error)(n), "DOMException" !== t1 && (r.name = i), e1.stack && (r.stack = e1.stack), "cause" in e1 && (r.cause = es(e1.cause)); 6760 const o = r; 6761 for(const t1 in e1)Object.hasOwn(e1, t1) && ("$name" === t1 || Ka.has(t1) || (o[t1] = es(e1[t1]))); 6762 return r; 6763 } 6764 const { klass: i } = qa[t1]; 6765 if (!i) throw new Error("Can't deserialize unregistered class \"".concat(t1, '".')); 6766 if (i.deserialize) return i.deserialize(e1); 6767 const n = Object.create(i.prototype); 6768 for(const t1 in e1)"$name" !== t1 && (n[t1] = es(e1[t1])); 6769 return n; 6770 } 6771 const ts = (e1)=>e1 >= 1536 && e1 <= 1791, is = (e1)=>e1 >= 1872 && e1 <= 1919, ns = (e1)=>e1 >= 2208 && e1 <= 2303, rs = (e1)=>e1 >= 11904 && e1 <= 12031, os = (e1)=>e1 >= 12032 && e1 <= 12255, as = (e1)=>e1 >= 12272 && e1 <= 12287, ss = (e1)=>e1 >= 12288 && e1 <= 12351, ls = (e1)=>e1 >= 12352 && e1 <= 12447, cs = (e1)=>e1 >= 12448 && e1 <= 12543, us = (e1)=>e1 >= 12544 && e1 <= 12591, hs = (e1)=>e1 >= 12704 && e1 <= 12735, ds = (e1)=>e1 >= 12736 && e1 <= 12783, fs = (e1)=>e1 >= 12784 && e1 <= 12799, ps = (e1)=>e1 >= 12800 && e1 <= 13055, ms = (e1)=>e1 >= 13056 && e1 <= 13311, _s = (e1)=>e1 >= 13312 && e1 <= 19903, gs = (e1)=>e1 >= 19968 && e1 <= 40959, ys = (e1)=>e1 >= 40960 && e1 <= 42127, xs = (e1)=>e1 >= 42128 && e1 <= 42191, vs = (e1)=>e1 >= 44032 && e1 <= 55215, bs = (e1)=>e1 >= 63744 && e1 <= 64255, ws = (e1)=>e1 >= 64336 && e1 <= 65023, As = (e1)=>e1 >= 65040 && e1 <= 65055, Es = (e1)=>e1 >= 65072 && e1 <= 65103, Is = (e1)=>e1 >= 65104 && e1 <= 65135, Ms = (e1)=>e1 >= 65136 && e1 <= 65279, Ts = (e1)=>e1 >= 65280 && e1 <= 65519; 6772 function Ss(e1) { 6773 for (const t1 of e1)if (Rs(t1.charCodeAt(0))) return !0; 6774 return !1; 6775 } 6776 function zs(e1) { 6777 return !(ts(e1) || is(e1) || ns(e1) || ws(e1) || Ms(e1)); 6778 } 6779 function Rs(e1) { 6780 return !(746 !== e1 && 747 !== e1 && (e1 < 4352 || !(hs(e1) || us(e1) || Es(e1) && !(e1 >= 65097 && e1 <= 65103) || bs(e1) || ms(e1) || rs(e1) || ds(e1) || !(!ss(e1) || e1 >= 12296 && e1 <= 12305 || e1 >= 12308 && e1 <= 12319 || 12336 === e1) || _s(e1) || gs(e1) || ps(e1) || ((e1)=>e1 >= 12592 && e1 <= 12687)(e1) || ((e1)=>e1 >= 43360 && e1 <= 43391)(e1) || ((e1)=>e1 >= 55216 && e1 <= 55295)(e1) || ((e1)=>e1 >= 4352 && e1 <= 4607)(e1) || vs(e1) || ls(e1) || as(e1) || ((e1)=>e1 >= 12688 && e1 <= 12703)(e1) || os(e1) || fs(e1) || cs(e1) && 12540 !== e1 || !(!Ts(e1) || 65288 === e1 || 65289 === e1 || 65293 === e1 || e1 >= 65306 && e1 <= 65310 || 65339 === e1 || 65341 === e1 || 65343 === e1 || e1 >= 65371 && e1 <= 65503 || 65507 === e1 || e1 >= 65512 && e1 <= 65519) || !(!Is(e1) || e1 >= 65112 && e1 <= 65118 || e1 >= 65123 && e1 <= 65126) || ((e1)=>e1 >= 5120 && e1 <= 5759)(e1) || ((e1)=>e1 >= 6320 && e1 <= 6399)(e1) || As(e1) || ((e1)=>e1 >= 19904 && e1 <= 19967)(e1) || ys(e1) || xs(e1)))); 6781 } 6782 function Ps(e1) { 6783 return !(Rs(e1) || function(e1) { 6784 return !!(((e1)=>e1 >= 128 && e1 <= 255)(e1) && (167 === e1 || 169 === e1 || 174 === e1 || 177 === e1 || 188 === e1 || 189 === e1 || 190 === e1 || 215 === e1 || 247 === e1) || ((e1)=>e1 >= 8192 && e1 <= 8303)(e1) && (8214 === e1 || 8224 === e1 || 8225 === e1 || 8240 === e1 || 8241 === e1 || 8251 === e1 || 8252 === e1 || 8258 === e1 || 8263 === e1 || 8264 === e1 || 8265 === e1 || 8273 === e1) || ((e1)=>e1 >= 8448 && e1 <= 8527)(e1) || ((e1)=>e1 >= 8528 && e1 <= 8591)(e1) || ((e1)=>e1 >= 8960 && e1 <= 9215)(e1) && (e1 >= 8960 && e1 <= 8967 || e1 >= 8972 && e1 <= 8991 || e1 >= 8996 && e1 <= 9e3 || 9003 === e1 || e1 >= 9085 && e1 <= 9114 || e1 >= 9150 && e1 <= 9165 || 9167 === e1 || e1 >= 9169 && e1 <= 9179 || e1 >= 9186 && e1 <= 9215) || ((e1)=>e1 >= 9216 && e1 <= 9279)(e1) && 9251 !== e1 || ((e1)=>e1 >= 9280 && e1 <= 9311)(e1) || ((e1)=>e1 >= 9312 && e1 <= 9471)(e1) || ((e1)=>e1 >= 9632 && e1 <= 9727)(e1) || ((e1)=>e1 >= 9728 && e1 <= 9983)(e1) && !(e1 >= 9754 && e1 <= 9759) || ((e1)=>e1 >= 11008 && e1 <= 11263)(e1) && (e1 >= 11026 && e1 <= 11055 || e1 >= 11088 && e1 <= 11097 || e1 >= 11192 && e1 <= 11243) || ss(e1) || cs(e1) || ((e1)=>e1 >= 57344 && e1 <= 63743)(e1) || Es(e1) || Is(e1) || Ts(e1) || 8734 === e1 || 8756
6784=== e1 || 8757 === e1 || e1 >= 9984 && e1 <= 10087 || e1 >= 10102 && e1 <= 10131 || 65532 === e1 || 65533 === e1); 6785 }(e1)); 6786 } 6787 function Ds(e1) { 6788 return e1 >= 1424 && e1 <= 2303 || ws(e1) || Ms(e1); 6789 } 6790 function Fs(e1, t1) { 6791 return !(!t1 && Ds(e1) || e1 >= 2304 && e1 <= 3583 || e1 >= 3840 && e1 <= 4255 || ((e1)=>e1 >= 6016 && e1 <= 6143)(e1)); 6792 } 6793 function Cs(e1) { 6794 for (const t1 of e1)if (Ds(t1.charCodeAt(0))) return !0; 6795 return !1; 6796 } 6797 const Ls = { 6798 unavailable: "unavailable", 6799 deferred: "deferred", 6800 loading: "loading", 6801 parsing: "parsing", 6802 parsed: "parsed", 6803 loaded: "loaded", 6804 error: "error" 6805 }; 6806 let Os = null, Bs = Ls.unavailable, Vs = null; 6807 const Ns = function(e1) { 6808 e1 && (Bs = Ls.error), Os && Os(e1); 6809 }; 6810 function ks() { 6811 Us.fire(new rn("pluginStateChange", { 6812 pluginStatus: Bs, 6813 pluginURL: Vs 6814 })); 6815 } 6816 const Us = new ln, js = function() { 6817 return Bs; 6818 }, Gs = function() { 6819 if (Bs !== Ls.deferred || !Vs) throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified"); 6820 Bs = Ls.loading, ks(), Vs && _i({ 6821 url: Vs 6822 }).then(()=>{ 6823 Bs = Ls.loaded, ks(); 6824 }).catch((e1)=>{ 6825 Ns(e1); 6826 }); 6827 }, Hs = { 6828 applyArabicShaping: null, 6829 processBidirectionalText: null, 6830 processStyledBidirectionalText: null, 6831 isLoaded: ()=>Bs === Ls.loaded || null != Hs.applyArabicShaping, 6832 isLoading: ()=>Bs === Ls.loading, 6833 setState (e1) { 6834 Bs = e1.pluginStatus, Vs = e1.pluginURL; 6835 }, 6836 isParsing: ()=>Bs === Ls.parsing, 6837 isParsed: ()=>Bs === Ls.parsed, 6838 getPluginURL: ()=>Vs 6839 }; 6840 class $s { 6841 isSupportedScript(e1) { 6842 return function(e1, t1) { 6843 for (const i of e1)if (!Fs(i.charCodeAt(0), t1)) return !1; 6844 return !0; 6845 }(e1, Hs.isLoaded()); 6846 } 6847 constructor(e1, t1){ 6848 this.zoom = e1, t1 ? (this.now = t1.now, this.fadeDuration = t1.fadeDuration, this.transition = t1.transition, this.pitch = t1.pitch, this.brightness = t1.brightness, this.worldview = t1.worldview, this.activeFloors = t1.activeFloors) : (this.now = 0, this.fadeDuration = 0, this.transition = {}, this.pitch = 0, this.brightness = 0); 6849 } 6850 } 6851 class Zs { 6852 isIndoorDependent() { 6853 return this.expression.isIndoorDependent; 6854 } 6855 isDataDriven() { 6856 return "source" === this.expression.kind || "composite" === this.expression.kind; 6857 } 6858 possiblyEvaluate(e1, t1, i, n) { 6859 return this.property.possiblyEvaluate(this, e1, t1, i, n); 6860 } 6861 constructor(e1, t1, i, n, r){ 6862 this.property = e1, this.value = t1, this.expression = function(e1, t1, i, n, r) { 6863 if (Pa(e1)) return new $a(e1, t1); 6864 if (ka(e1) || Array.isArray(e1) && e1.length > 0) { 6865 const o = Ha(e1, t1, i, n, r); 6866 if ("error" === o.result) throw new Error(o.value.map((e1)=>"".concat(e1.key, ": ").concat(e1.message)).join(", ")); 6867 return o.value; 6868 } 6869 { 6870 let i = e1; 6871 return "string" == typeof e1 && "color" === t1.type && (i = mn.parse(e1)), { 6872 kind: "constant", 6873 configDependencies: new Set, 6874 isIndoorDependent: !1, 6875 evaluate: ()=>i 6876 }; 6877 } 6878 }(void 0 === t1 ? e1.specification.default : t1, e1.specification, i, n, r); 6879 } 6880 } 6881 class Ws { 6882 transitioned(e1, t1) { 6883 return new Xs(this.property, this.value, t1, { 6884 ...e1.transition, 6885 ...this.transition 6886 }, e1.now); 6887 } 6888 untransitioned() { 6889 return new Xs(this.property, this.value, null, {}, 0); 6890 } 6891 constructor(e1, t1, i, n){ 6892 this.property = e1, this.value = new Zs(e1, void 0, t1, i, n); 6893 } 6894 } 6895 class qs { 6896 getValue(e1) { 6897 return pt(this._values[e1].value.value); 6898 } 6899 setValue(e1, t1) {
6900 Object.hasOwn(this._values, e1) || (this._values[e1] = new Ws(this._values[e1].property, this._scope, this._options, this._iconImageUseTheme)), this._values[e1].value = new Zs(this._values[e1].property, null === t1 ? void 0 : pt(t1), this._scope, this._options, this._iconImageUseTheme), this._values[e1].value.expression.configDependencies && (this.configDependencies = new Set([ 6901 ...this.configDependencies, 6902 ...this._values[e1].value.expression.configDependencies 6903 ]), this._isIndoorDependent = this._isIndoorDependent || this._values[e1].value.isIndoorDependent()); 6904 } 6905 setTransitionOrValue(e1, t1) { 6906 t1 && (this._options = t1); 6907 const i = this._properties.properties; 6908 if (e1) for(const t1 in e1){ 6909 const n = e1[t1]; 6910 if (t1.endsWith("-transition")) { 6911 const e1 = t1.slice(0, -11); 6912 i[e1] && this.setTransition(e1, n); 6913 } else Object.hasOwn(i, t1) && this.setValue(t1, n); 6914 } 6915 } 6916 getTransition(e1) { 6917 return pt(this._values[e1].transition); 6918 } 6919 setTransition(e1, t1) { 6920 Object.hasOwn(this._values, e1) || (this._values[e1] = new Ws(this._values[e1].property)), this._values[e1].transition = pt(t1) || void 0; 6921 } 6922 serialize() { 6923 const e1 = {}; 6924 for (const t1 of Object.keys(this._values)){ 6925 const i = this.getValue(t1); 6926 void 0 !== i && (e1[t1] = i); 6927 const n = this.getTransition(t1); 6928 void 0 !== n && (e1["".concat(t1, "-transition")] = n); 6929 } 6930 return e1; 6931 } 6932 transitioned(e1, t1) { 6933 const i = new Ys(this._properties); 6934 for (const n of Object.keys(this._values))i._values[n] = this._values[n].transitioned(e1, t1._values[n]); 6935 return i; 6936 } 6937 untransitioned() { 6938 const e1 = new Ys(this._properties); 6939 for (const t1 of Object.keys(this._values))e1._values[t1] = this._values[t1].untransitioned(); 6940 return e1; 6941 } 6942 isIndoorDependent() { 6943 return this._isIndoorDependent; 6944 } 6945 constructor(e1, t1, i, n){ 6946 this._properties = e1, this._values = Object.create(e1.defaultTransitionablePropertyValues), this._scope = t1, this._options = i, this._iconImageUseTheme = n, this._isIndoorDependent = !1, this.configDependencies = new Set; 6947 } 6948 } 6949 class Xs { 6950 possiblyEvaluate(e1, t1, i) { 6951 const n = e1.now || 0, r = this.value.possiblyEvaluate(e1, t1, i), o = this.prior; 6952 if (o) { 6953 if (n > this.end) return this.prior = null, r; 6954 if (this.value.isDataDriven()) return this.prior = null, r; 6955 if (n < this.begin) return o.possiblyEvaluate(e1, t1, i); 6956 { 6957 const a = (n - this.begin) / (this.end - this.begin); 6958 return this.property.interpolate(o.possiblyEvaluate(e1, t1, i), r, et(a)); 6959 } 6960 } 6961 return r; 6962 } 6963 constructor(e1, t1, i, n, r){ 6964 const o = n.delay || 0, a = n.duration || 0; 6965 r = r || 0, this.property = e1, this.value = t1, this.begin = r + o, this.end = this.begin + a, e1.specification.transition && (n.delay || n.duration) && (this.prior = i); 6966 } 6967 } 6968 class Ys { 6969 possiblyEvaluate(e1, t1, i) { 6970 const n = new Qs(this._properties); 6971 for (const r of Object.keys(this._values))n._values[r] = this._values[r].possiblyEvaluate(e1, t1, i); 6972 return n; 6973 } 6974 hasTransition() { 6975 for (const e1 of Object.keys(this._values))if (this._values[e1].prior) return !0; 6976 return !1; 6977 } 6978 constructor(e1){ 6979 this._properties = e1, this._values = Object.create(e1.defaultTransitioningPropertyValues); 6980 } 6981 } 6982 class Js { 6983 getValue(e1) { 6984 return pt(this._values[e1].value); 6985 } 6986 setValue(e1, t1) { 6987 this._values[e1] = new Zs(this._values[e1].property, null === t1 ? void 0 : pt(t1), this._scope, this._options, this._iconImageUseTheme), this._values[e1].expression.configDependencies && (this.configDependencies = new Set([ 6988 ...this.configDependencies, 6989 ...this._values[e1].expression.configDependencies 6990 ]), this._isIndoorDependent = this._isIndoorDependent || this._values[e1].isIndoorDependent()); 6991 } 6992 serialize() { 6993 const e1 = {}; 6994 for (const t1 of Object.keys(this._values)){ 6995 const i = this.getValue(t1); 6996 void 0 !== i && (e1[t1] = i); 6997 } 6998 return e1; 6999 } 7000 possiblyEvaluate(e1, t1, i, n) { 7001 const r = new Qs(this._properties); 7002 for (const o of Object.keys(this._values))r._values[o] = this._values[o].possiblyEvaluate(e1, t1, i, n); 7003 return r; 7004 } 7005 isIndoorDependent() { 7006 return this._isIndoorDependent; 7007 } 7008 constructor(e1, t1, i, n){ 7009 this._properties = e1, this._values = Object.create(e1.defaultPropertyValues), this._scope = t1, this._options = i, this._iconImageUseTheme = n, this._isIndoorDependent = !1, this.configDependencies = new Set; 7010 } 7011 } 7012 class Ks { 7013 isConstant() { 7014 return "constant" === this.value.kind; 7015 } 7016 constantOr(e1) { 7017 return "constant" === this.value.kind ? this.value.value : e1; 7018 } 7019 evaluate(e1, t1, i, n, r) { 7020 return this.property.evaluate(this.value, this.parameters, e1, t1, i, n, this.iconImageUseTheme, r); 7021 } 7022 constructor(e1, t1, i, n){ 7023 this.property = e1, this.value = t1, this.parameters = i, this.iconImageUseTheme = n; 7024 } 7025 } 7026 class Qs { 7027 get(e1) { 7028 return this._values[e1]; 7029 } 7030 constructor(e1){ 7031 this._properties = e1, this._values = Object.create(e1.defaultPossiblyEvaluatedValues); 7032 } 7033 } 7034 class el { 7035 possiblyEvaluate(e1, t1) { 7036 return e1.expression.evaluate(t1); 7037 } 7038 interpolate(e1, t1, i) { 7039 const n = vn[this.specification.type]; 7040 return n ? n(e1, t1, i) : e1; 7041 } 7042 constructor(e1){
vendor: 2,560 bytes, lines 7043-7096
7043 this.specification = e1; 7044 } 7045 } 7046 class tl { 7047 possiblyEvaluate(e1, t1, i, n, r) { 7048 return "constant" === e1.expression.kind || "camera" === e1.expression.kind ? new Ks(this, { 7049 kind: "constant", 7050 value: e1.expression.evaluate(t1, null, {}, i, n, void 0, r) 7051 }, t1) : new Ks(this, e1.expression, t1, r); 7052 } 7053 interpolate(e1, t1, i) { 7054 if ("constant" !== e1.value.kind || "constant" !== t1.value.kind) return e1; 7055 if (void 0 === e1.value.value || void 0 === t1.value.value) return new Ks(this, { 7056 kind: "constant", 7057 value: void 0 7058 }, e1.parameters); 7059 const n = vn[this.specification.type]; 7060 return n ? new Ks(this, { 7061 kind: "constant", 7062 value: n(e1.value.value, t1.value.value, i) 7063 }, e1.parameters) : e1; 7064 } 7065 evaluate(e1, t1, i, n, r, o, a, s) { 7066 return "constant" === e1.kind ? e1.value : e1.evaluate(t1, i, n, r, o, s, a); 7067 } 7068 constructor(e1, t1){ 7069 this.specification = e1, this.overrides = t1; 7070 } 7071 } 7072 class il { 7073 possiblyEvaluate(e1, t1, i, n) { 7074 return !!e1.expression.evaluate(t1, null, {}, i, n); 7075 } 7076 interpolate() { 7077 return !1; 7078 } 7079 constructor(e1){ 7080 this.specification = e1; 7081 } 7082 } 7083 class nl { 7084 constructor(e1){ 7085 this.properties = e1, this.defaultPropertyValues = {}, this.defaultTransitionablePropertyValues = {}, this.defaultTransitioningPropertyValues = {}, this.defaultPossiblyEvaluatedValues = {}, this.overridableProperties = []; 7086 const t1 = new $s(0, {}); 7087 for(const i in e1){ 7088 const n = e1[i], r = n.specification; 7089 r && r.overridable && this.overridableProperties.push(i); 7090 const o = this.defaultPropertyValues[i] = new Zs(n, void 0), a = this.defaultTransitionablePropertyValues[i] = new Ws(n); 7091 this.defaultTransitioningPropertyValues[i] = a.untransitioned(), this.defaultPossiblyEvaluatedValues[i] = o.possiblyEvaluate(t1); 7092 } 7093 } 7094 } 7095 Xa(tl, "DataDrivenProperty"), Xa(el, "DataConstantProperty"), Xa(il, "ColorRampProperty"); 7096 var rl =
vendor: 51,719 bytes, line 7096
7096JSON.parse('{"expression":1,"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"function":{"type":{"type":"enum","default":"exponential","values":{"identity":1,"exponential":1,"interval":1,"categorical":1}},"default":{"type":"*"},"expression":1,"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"colorSpace":{"type":"enum","default":"rgb","values":{"rgb":1,"lab":1,"hcl":1}}},"$version":8,"$root":{"transition":{"type":"transition"},"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1,"object":{}}},"default":{"type":"*","expression":1},"values":{"type":"array","value":"*"},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}},"id":{"type":"string"},"properties":{"type":"properties"}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","default":"mapbox","values":{"terrarium":1,"mapbox":1}},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"minimum":0,"maximum":512},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"}},"modelLightOverrides":{"light-ambient-color":{"type":"color"},"light-ambient-intensity":{"type":"number"},"light-directional-color":{"type":"color"},"light-directional-intensity":{"type":"number"}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","default":[0,0],"minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"},"lightOverrides":{"type":"modelLightOverrides"},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"id":{"type":"string"},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_sky":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_model":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"model-id":{"type":"string","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","default":[],"value":"enum","values":{"model":1,"symbol":1},"expression":1},"clip-layer-scope":{"type":"array","default":[],"value":"string","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"expression":1},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-markup":1},"expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_heatmap":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill-extrusion":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","default":3,"minimum":1,"maximum":200,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-unit-width":{"type":"number","default":3.1,"minimum":1,"maximum":20,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-window":{"type":"array","default":[0.9,0.9],"minimum":0.1,"maximum":1,"length":2,"value":"number","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-roof-shape":{"type":"enum","default":"flat","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flip-roof-orientation":{"type":"boolean","default":false,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","default":"butt","values":{"butt":1,"round":1,"square":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-join":{"type":"enum","default":"miter","values":{"bevel":1,"round":1,"miter":1,"none":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["feature","line-progress","zoom"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"line-cross-slope":{"type":"number","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"line-width-unit":{"type":"enum","default":"pixels","values":{"pixels":1,"meters":1},"expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","line-progress","zoom"]},"transition":1,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","default":"point","values":{"point":1,"line":1,"line-center":1},"expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":1,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","default":"auto","values":{"auto":1,"viewport-y":1,"source":1},"expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"icon-text-fit":{"type":"enum","default":"none","values":{"none":1,"width":1,"height":1,"both":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","default":[0,0,0,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"use-theme":1,"property-type":"data-driven","appearance":1,"tokens":1},"icon-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-anchor":{"type":"enum","default":"center","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven","tokens":1},"text-font":{"type":"array","default":["Open Sans Regular","Arial Unicode MS Regular"],"value":"string","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-justify":{"type":"enum","default":"center","values":{"auto":1,"left":1,"center":1,"right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","default":"center","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","default":"none","values":{"none":1,"uppercase":1,"lowercase":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster-particle":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_hillshade":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"expression":{"parameters":["distance-from-center","feature","pitch","zoom"]},"property-type":"data-driven"},"filter_fill":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_hillshade":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster-particle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_clip":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_model":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_line":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_circle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_fill-extrusion":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_building":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_heatmap":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function_stop":{"type":"array","minimum":0,"maximum":24,"length":2,"value":["number","color"]},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"camera":{"camera-projection":{"type":"enum","default":"perspective","values":{"perspective":1,"orthographic":1}}},"colorTheme":{"data":{"type":"string","expression":1}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"projection":{"name":{"type":"enum","default":"mercator","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1}},"center":{"type":"array","minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"parallels":{"type":"array","minimum":[-90,-90],"maximum":[90,90],"length":2,"value":"number"}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-outline-color":{"type":"color","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","default":"flat","values":{"terrain":1,"flat":1}},"fill-extrusion-base-alignment":{"type":"enum","default":"terrain","values":{"terrain":1,"flat":1}},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-extrusion-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"fill-extrusion-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":1},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"use-theme":1,"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"building-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"building-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-dasharray":{"type":"array","minimum":0,"value":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-trim-offset":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number"},"line-trim-fade-range":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-trim-color":{"type":"color","default":"transparent","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-border-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-blend-mode":{"type":"enum","default":"default","values":{"default":1,"multiply":1,"additive":1},"expression":{"parameters":["zoom"]}},"line-blend-additive-clamp":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-cutout-depth":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"circle-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":1,"parameters":["heatmap-density"]},"use-theme":1},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"icon-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1,"overridable":1},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"text-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"text-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":1},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven","appearance":1}
7096},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-value"]},"use-theme":1},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-range":{"type":"array","length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-scale":{"type":"enum","default":"linear","values":{"linear":1,"log":1},"expression":{"parameters":[]}},"raster-hue-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-resampling":{"type":"enum","default":"linear","values":{"linear":1,"nearest":1},"expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-elevation-reference":{"type":"enum","default":"sea","values":{"sea":1,"ground":1},"expression":1},"raster-allow-draping":{"type":"boolean","default":true}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-particle-speed"]},"use-theme":1},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":1,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"hillshade-shadow-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-accent-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_background":{"background-pitch-alignment":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_sky":{"sky-type":{"type":"enum","default":"atmosphere","values":{"gradient":1,"atmosphere":1},"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":1,"parameters":["sky-radial-progress"]},"use-theme":1},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":1},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":1},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-rotation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-scale":{"type":"array","default":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-translation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"model-color-mix-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-type":{"type":"enum","default":"common-3d","values":{"common-3d":1,"location-indicator":1}},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"model-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"model-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"model-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"model-line-cutout-mode":{"type":"enum","default":"enabled","values":{"enabled":1,"disabled":1,"enabled-above-cutout":1},"expression":1}},"promoteId":{"*":{"type":"*"}}}'); 7097 function ol(e1) { 7098 return e1 instanceof Number || e1 instanceof String || e1 instanceof Boolean ? e1.valueOf() : e1; 7099 } 7100 function al(e1) { 7101 if (Array.isArray(e1)) return e1.map(al); 7102 if (e1 instanceof Object && !(e1 instanceof Number || e1 instanceof String || e1 instanceof Boolean)) { 7103 const t1 = {}, i = e1; 7104 for(const e1 in i)t1[e1] = al(i[e1]); 7105 return t1; 7106 } 7107 return ol(e1); 7108 } 7109 function sl(e1) { 7110 if (!0 === e1 || !1 === e1) return !0; 7111 if (!Array.isArray(e1) || 0 === e1.length) return !1; 7112 switch(e1[0]){ 7113 case "has": 7114 return e1.length >
7114= 2 && "$id" !== e1[1] && "$type" !== e1[1]; 7115 case "in": 7116 return e1.length >= 3 && ("string" != typeof e1[1] || Array.isArray(e1[2])); 7117 case "!in": 7118 case "!has": 7119 case "none": 7120 return !1; 7121 case "==": 7122 case "!=": 7123 case ">": 7124 case ">=": 7125 case "<": 7126 case "<=": 7127 return 3 !== e1.length || Array.isArray(e1[1]) || Array.isArray(e1[2]); 7128 case "any": 7129 case "all": 7130 for (const t1 of e1.slice(1))if (!sl(t1) && "boolean" != typeof t1) return !1; 7131 return !0; 7132 default: 7133 return !0; 7134 } 7135 } 7136 function ll(e1) { 7137 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "fill"; 7138 if (null == e1) return { 7139 filter: ()=>!0, 7140 needGeometry: !1, 7141 needFeature: !1 7142 }; 7143 sl(e1) || (e1 = ml(e1)); 7144 const r = e1; 7145 let o = !0; 7146 try { 7147 o = function(e1) { 7148 if (!hl(e1)) return e1; 7149 let t1 = al(e1); 7150 return ul(t1), t1 = cl(t1), t1; 7151 }(r); 7152 } catch (e1) { 7153 console.warn("Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n".concat(JSON.stringify(r, null, 2), "\n ")); 7154 } 7155 let a = null, s = null; 7156 if ("background" !== n && "sky" !== n && "slot" !== n) { 7157 s = rl["filter_".concat(n)]; 7158 const e1 = Ua(o, s, t1, i); 7159 if ("error" === e1.result) throw new Error(e1.value.map((e1)=>"".concat(e1.key, ": ").concat(e1.message)).join(", ")); 7160 a = (t1, i, n)=>e1.value.evaluate(t1, i, {}, n); 7161 } 7162 let l = null, c = null; 7163 if (o !== r) { 7164 const e1 = Ua(r, s, t1, i); 7165 if ("error" === e1.result) throw new Error(e1.value.map((e1)=>"".concat(e1.key, ": ").concat(e1.message)).join(", ")); 7166 l = (t1, i, n, r, o)=>e1.value.evaluate(t1, i, {}, n, void 0, void 0, r, o), c = !Cr(e1.value.expression); 7167 } 7168 return { 7169 filter: a, 7170 dynamicFilter: l || void 0, 7171 needGeometry: pl(o), 7172 needFeature: !!c 7173 }; 7174 } 7175 function cl(e1) { 7176 if (!Array.isArray(e1)) return e1; 7177 const t1 = function(e1) { 7178 if (dl.has(e1[0])) { 7179 for(let t1 = 1; t1 < e1.length; t1++)if (hl(e1[t1])) return !0; 7180 } 7181 return e1; 7182 }(e1); 7183 return !0 === t1 ? t1 : t1.map((e1)=>cl(e1)); 7184 } 7185 function ul(e1) { 7186 let t1 = !1; 7187 const i = []; 7188 if ("case" === e1[0]) { 7189 for(let n = 1; n < e1.length - 1; n += 2)t1 = t1 || hl(e1[n]), i.push(e1[n + 1]); 7190 i.push(e1.at(-1)); 7191 } else if ("match" === e1[0]) { 7192 t1 = t1 || hl(e1[1]); 7193 for(let t1 = 2; t1 < e1.length - 1; t1 += 2)i.push(e1[t1 + 1]); 7194 i.push(e1.at(-1)); 7195 } else if ("step" === e1[0]) { 7196 t1 = t1 || hl(e1[1]); 7197 for(let t1 = 1; t1 < e1.length - 1; t1 += 2)i.push(e1[t1 + 1]); 7198 } 7199 t1 && (e1.length = 0, e1.push("any", ...i)); 7200 for(let t1 = 1; t1 < e1.length; t1++)ul(e1[t1]); 7201 } 7202 function hl(e1) { 7203 if (!Array.isArray(e1)) return !1; 7204 if ("pitch" === (t1 = e1[0]) || "distance-from-center" === t1) return !0; 7205 var t1; 7206 for(let t1 = 1; t1 < e1.length; t1++)if (hl(e1[t1])) return !0; 7207 return !1; 7208 } 7209 const dl = new Set([ 7210 "in", 7211 "==", 7212 "!=", 7213 ">", 7214 ">=", 7215 "<", 7216 "<=", 7217 "to-boolean" 7218 ]); 7219 function fl(e1, t1) { 7220 return e1 < t1 ? -1 : e1 > t1 ? 1 : 0; 7221 } 7222 function pl(e1) { 7223 if (!Array.isArray(e1)) return !1; 7224 if ("within" === e1[0] || "distance" === e1[0]) return !0; 7225 for(let t1 = 1; t1 < e1.length; t1++)if (pl(e1[t1])) return !0; 7226 return !1; 7227 } 7228 function ml(e1) { 7229 if (!e1) return !0; 7230 const t1 = e1[0]; 7231 return e1.length <= 1 ? "any" !== t1 : "==" === t1 ? _l(e1[1], e1[2], "==") : "!=" === t1 ? xl(_l(e1[1], e1[2], "==")) : "<" === t1 || ">" === t1 || "<=" === t1 || ">=" === t1 ? _l(e1[1], e1[2], t1) : "any" === t1 ? (i = e1.slice(1), [ 7232 "any" 7233 ].concat(i.map(ml))) : "all" === t1 ? [ 7234 "all" 7235 ].concat(e1.slice(1).map(ml)) : "none" === t1 ? [ 7236 "all" 7237 ].concat(e1.slice(1).map(ml).map(xl)) : "in" === t1 ? gl(e1[1], e1.slice(2)) : "!in" === t1 ? xl(gl(e1[1], e1.slice(2))) : "has" === t1 ? yl(e1[1]) : "!has" !== t1 || xl(yl(e1[1])); 7238 //TURBOPACK unreachable 7239 ; 7240 var i; 7241 } 7242 function _l(e1, t1, i) { 7243 switch(e1){ 7244 case "$type": 7245 return [ 7246 "filter-type-".concat(i), 7247 t1 7248 ]; 7249 case "$id": 7250 return [ 7251 "filter-id-".concat(i), 7252 t1 7253 ]; 7254 default: 7255 return [ 7256 "filter-".concat(i), 7257 e1, 7258 t1 7259 ]; 7260 } 7261 } 7262 function gl(e1, t1) { 7263 if (0 === t1.length) return !1; 7264 switch(e1){ 7265 case "$type": 7266 return [ 7267 "filter-type-in", 7268 [ 7269 "literal", 7270 t1 7271 ] 7272 ]; 7273 case "$id": 7274 return [ 7275 "filter-id-in", 7276 [ 7277 "literal", 7278 t1 7279 ] 7280 ]; 7281 default: 7282 return t1.length > 200 && !t1.some((e1)=>typeof e1 != typeof t1[0]) ? [ 7283 "filter-in-large", 7284 e1, 7285 [ 7286 "literal", 7287 t1.sort(fl) 7288 ] 7289 ] : [ 7290 "filter-in-small", 7291 e1, 7292 [ 7293 "literal", 7294 t1 7295 ] 7296 ]; 7297 } 7298 } 7299 function yl(e1) { 7300 switch(e1){ 7301 case "$type": 7302 return !0; 7303 case "$id": 7304 return [ 7305 "filter-has-id" 7306 ]; 7307 default: 7308 return [ 7309 "filter-has", 7310 e1 7311 ]; 7312 } 7313 } 7314 function xl(e1) { 7315 return [ 7316 "!", 7317 e1 7318 ]; 7319 } 7320 const vl = "�"; 7321 function bl(e1, t1) { 7322 return t1 ? "".concat(e1).concat(vl).concat(t1) : e1; 7323 } 7324 function wl(e1) { 7325 const t1 = e1.indexOf(vl); 7326 return t1 >= 0 ? e1.slice(t1 + 1) : ""; 7327 } 7328 let Al; 7329 const El = ()=>Al || (Al = new nl({ 7330 "icon-size": new tl(rl.layout_symbol["icon-size"]), 7331 "icon-image": new tl(rl.layout_symbol["icon-image"]), 7332 "icon-rotate": new tl(rl.layout_symbol["icon-rotate"]), 7333 "icon-offset": new tl(rl.layout_symbol["icon-offset"]), 7334 "text-size": new tl(rl.layout_symbol["text-size"]), 7335 "text-rotate": new tl(rl.layout_symbol["text-rotate"]), 7336 "text-offset": new tl(rl.layout_symbol["text-offset"]) 7337 })); 7338 let Il; 7339 const Ml = ()=>Il || (Il = new nl({ 7340 "icon-opacity": new tl(rl.paint_symbol["icon-opacity"]), 7341 "icon-occlusion-opacity": new tl(rl.paint_symbol["icon-occlusion-opacity"]), 7342 "icon-emissive-strength": new tl(rl.paint_symbol["icon-emissive-strength"]), 7343 "text-emissive-strength": new tl(rl.paint_symbol["text-emissive-strength"]), 7344 "icon-color": new tl(rl.paint_symbol["icon-color"]), 7345 "icon-halo-color": new tl(rl.paint_symbol["icon-halo-color"]), 7346 "icon-halo-width": new tl(rl.paint_symbol["icon-halo-width"]), 7347 "icon-halo-blur": new tl(rl.paint_symbol["icon-halo-blur"]), 7348 "icon-translate": new tl(rl.paint_symbol["icon-translate"]), 7349 "text-opacity": new tl(rl.paint_symbol["text-opacity"]), 7350 "text-occlusion-opacity": new tl(rl.paint_symbol["text-occlusion-opacity"]), 7351 "text-color": new tl(rl.paint_symbol["text-color"], { 7352 runtimeType: Tn, 7353 getOverride: (e1)=>e1.textColor, 7354 hasOverride: (e1)=>!!e1.textColor 7355 }), 7356 "text-halo-color": new tl(rl.paint_symbol["text-halo-color"]), 7357 "text-halo-width": new tl(rl.paint_symbol["text-halo-width"]), 7358 "text-halo-blur": new tl(rl.paint_symbol["text-halo-blur"]), 7359 "text-translate": new tl(rl.paint_symbol["text-translate"]), 7360 "symbol-z-offset": new tl(rl.paint_symbol["symbol-z-offset"]), 7361 "icon-color-use-theme": new tl({ 7362 type: "string", 7363 default: "default", 7364 "property-type": "data-driven" 7365 }), 7366 "icon-halo-color-use-theme": new tl({ 7367 type: "string", 7368 default: "default", 7369 "property-type": "data-driven" 7370 }), 7371 "text-color-use-theme": new tl({ 7372 type: "string", 7373 default: "default", 7374 "property-type": "data-driven" 7375 }), 7376 "text-halo-color-use-theme": new tl({ 7377 type: "string", 7378 default: "default", 7379 "property-type": "data-driven" 7380 }) 7381 })); 7382 class Tl { 7383 isActive(e1) { 7384 return !(this.condition || !e1.isHidden || "hidden" !== this.name) || this.condition.evaluate(e1.globals, e1.feature, e1.featureState, e1.canonical); 7385 } 7386 getCondition() { 7387 return this.condition; 7388 } 7389 getName() { 7390 return this.name; 7391 } 7392 getLayoutProperty(e1) { 7393 return this.layoutProperties.get(e1); 7394 } 7395 getPaintProperty(e1) { 7396 return this.paintProperties.get(e1); 7397 } 7398 getUnevaluatedLayoutProperties() { 7399 return this.unevaluatedLayout; 7400 } 7401 getUnevaluatedLayoutProperty(e1) { 7402 return this.unevaluatedLayout._values[e1]; 7403 } 7404 getUnevaluatedPaintProperty(e1) { 7405 return this.unevaluatedPaint._values[e1]; 7406 } 7407 recalculate(e1, t1, i) { 7408 this.unevaluatedLayout && (this.layoutProperties = this.unevaluatedLayout.possiblyEvaluate(e1, void 0, t1, i)), this.unevaluatedPaint && (this.paintProperties = this.unevaluatedPaint.possiblyEvaluate(e1, void 0, t1, "")); 7409 } 7410 serialize() { 7411 const e1 = {}; 7412 e1.condition = this.condition.expression.serialize(), this.name && (e1.name = this.name); 7413 const t1 = { 7414 ...this.unevaluatedLayout ? this.unevaluatedLayout.serialize() : {}, 7415 ...this.unevaluatedPaint ? this.unevaluatedPaint.serialize() : {} 7416 }; 7417 return Object.keys(t1).length > 0 && (e1.properties = t1), e1; 7418 } 7419 hasIconLayoutProperties() { 7420 const e1 = this.hasLayoutProperty("icon-image"), t1 = this.hasLayoutProperty("icon-size"), i = this.hasLayoutProperty("icon-offset"), n = this.hasLayoutProperty("icon-rotate"); 7421 return e1 || t1 || i || n; 7422 } 7423 hasTextLayoutProperties() { 7424 const e1 = this.hasLayoutProperty("text-size"), t1 = this.hasLayoutProperty("text-offset"), i = this.hasLayoutProperty("text-rotate"); 7425 return e1 || t1 || i; 7426 } 7427 hasIconPaintProperties() { 7428 return !!this.unevaluatedPaint && Object.keys(this.unevaluatedPaint._values).filter((e1)=>!e1.endsWith("-use-theme")).some((e1)=>(e1.startsWith("icon-") || "symbol-z-offset" === e1) && this.hasPaintProperty(e1)); 7429 } 7430 hasTextPaintProperties() { 7431 return !!this.unevaluatedPaint && Object.keys(this.unevaluatedPaint._values).filter((e1)=>!e1.endsWith("-use-theme")).some((e1)=>(e1.startsWith("text-") || "symbol-z-offset" === e1) && this.hasPaintProperty(e1)); 7432 } 7433 hasLayoutProperty(e1) { 7434 return this.unevaluatedLayout && void 0 !== this.unevaluatedLayout._values[e1].value; 7435 } 7436 hasPaintProperty(e1) { 7437 return this.unevaluatedPaint && void 0 !== this.unevaluatedPaint._values[e1].value; 7438 } 7439 constructor(e1, t1, i, n, r, o){ 7440 this._conditionSpec = e1, this._propertiesSpec = i; 7441 const a = Ua(e1, rl.appearance.condition); 7442 if ("success" === a.result && (this.condition = a.value), this.name = t1, i) {
7443 this.layoutProperties = new Qs(El()), this.unevaluatedLayout = new Js(El(), n, r, o), this.paintProperties = new Qs(Ml()), this.unevaluatedPaint = new Js(Ml(), n, r, ""); 7444 for(const e1 in i)e1 in this.unevaluatedLayout._values ? this.unevaluatedLayout.setValue(e1, i[e1]) : e1 in this.unevaluatedPaint._values && this.unevaluatedPaint.setValue(e1, i[e1]); 7445 } 7446 } 7447 } 7448 const Sl = "-transition", zl = new Set([ 7449 "fill", 7450 "line", 7451 "background", 7452 "hillshade", 7453 "raster" 7454 ]); 7455 class Rl extends ln { 7456 onAdd(e1) {} 7457 onRemove(e1) {} 7458 isDraped(e1) { 7459 return !this.is3D(!0) && zl.has(this.type); 7460 } 7461 getLayoutProperty(e1) { 7462 return "visibility" === e1 ? this.visibility : this._unevaluatedLayout.getValue(e1); 7463 } 7464 setLayoutProperty(e1, t1) { 7465 if ("custom" === this.type && "visibility" === e1) return void (this.visibility = t1); 7466 const i = this._unevaluatedLayout; 7467 i._properties.properties[e1] && (i.setValue(e1, t1), "visibility" === e1 && this.possiblyEvaluateVisibility()); 7468 } 7469 setAppearances(e1) { 7470 this.appearances = [], e1.forEach((e1)=>{ 7471 this.appearances.push(new Tl(e1.condition, e1.name, e1.properties, this.scope, this.options, this.iconImageUseTheme)); 7472 }), this.appearancesVersion++; 7473 } 7474 possiblyEvaluateVisibility() { 7475 this._unevaluatedLayout._values.visibility && (this.visibility = this._unevaluatedLayout._values.visibility.possiblyEvaluate({ 7476 zoom: 0 7477 })); 7478 } 7479 getPaintProperty(e1) { 7480 return e1.endsWith(Sl) ? this._transitionablePaint.getTransition(e1.slice(0, -11)) : this._transitionablePaint.getValue(e1); 7481 } 7482 isPaintProperty(e1) { 7483 return !!this._transitionablePaint._properties.properties[e1]; 7484 } 7485 setPaintProperty(e1, t1) { 7486 const i = this._transitionablePaint, n = i._properties.properties; 7487 if (e1.endsWith(Sl)) { 7488 const r = e1.slice(0, -11); 7489 return n[r] && i.setTransition(r, t1 || void 0), !1; 7490 } 7491 if (!n[e1]) return !1; 7492 const r = i._values[e1], o = r.value.isDataDriven(), a = r.value; 7493 i.setValue(e1, t1), this._handleSpecialPaintPropertyUpdate(e1); 7494 const s = i._values[e1].value, l = s.isDataDriven(), c = e1.endsWith("pattern") || "line-dasharray" === e1; 7495 return l || o || c || this._handleOverridablePaintPropertyUpdate(e1, a, s); 7496 } 7497 _handleSpecialPaintPropertyUpdate(e1) {} 7498 getProgramIds() { 7499 return null; 7500 } 7501 getDefaultProgramParams(e1, t1, i) { 7502 return null; 7503 } 7504 _handleOverridablePaintPropertyUpdate(e1, t1, i) { 7505 return !1; 7506 } 7507 isHidden(e1) { 7508 return !!(this.minzoom && e1 < this.minzoom) || !!(this.maxzoom && e1 >= this.maxzoom) || "none" === this.visibility; 7509 } 7510 updateTransitions(e1) { 7511 this._transitioningPaint = this._transitionablePaint.transitioned(e1, this._transitioningPaint); 7512 } 7513 hasTransition() { 7514 return this._transitioningPaint.hasTransition(); 7515 } 7516 recalculate(e1, t1) { 7517 this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(e1, void 0, t1, this.iconImageUseTheme)), this.paint = this._transitioningPaint.possiblyEvaluate(e1, void 0, t1); 7518 } 7519 serialize() { 7520 const e1 = { 7521 id: this.id, 7522 type: this.type, 7523 slot: this.slot, 7524 source: this.source, 7525 "source-layer": this.sourceLayer, 7526 metadata: this.metadata, 7527 minzoom: this.minzoom, 7528 maxzoom: this.maxzoom, 7529 filter: this.filter, 7530 layout: this._unevaluatedLayout && this._unevaluatedLayout.serialize(), 7531 paint: this._transitionablePaint && this._transitionablePaint.serialize() 7532 }; 7533 return 0 !== this.appearances.length && (e1.appearances = this.appearances.map((e1)=>e1.serialize())), ft(e1, (e1, t1)=>!(void 0 === e1 || "layout" === t1 && !Object.keys(e1).length || "paint" === t1 && !Object.keys(e1).length)); 7534 } 7535 is3D(e1) { 7536 return !1; 7537 } 7538 hasElevation() { 7539 return !1; 7540 } 7541 mayUse(e1) { 7542 return !1; 7543 } 7544 prepare() { 7545 return Promise.resolve(); 7546 } 7547 isSky() { 7548 return !1; 7549 } 7550 isTileClipped() { 7551 return !1; 7552 } 7553 hasOffscreenPass() { 7554 return !1; 7555 } 7556 hasShadowPass() { 7557 return !1; 7558 } 7559 canCastShadows() { 7560 return !1; 7561 } 7562 hasLightBeamPass() { 7563 return !1; 7564 } 7565 cutoffRange() { 7566 return 0; 7567 } 7568 tileCoverLift() { 7569 return 0; 7570 } 7571 resize() {} 7572 _clear() {} 7573 isStateDependent() { 7574 for(const e1 in this.paint._values){ 7575 const t1 = this.paint.get(e1); 7576 if (t1 instanceof Ks && Ta(t1.property.specification) && ("source" === t1.value.kind || "composite" === t1.value.kind) && t1.value.isStateDependent) return !0; 7577 } 7578 for (const e1 of this.appearances)if (!Lr(e1.condition.expression)) return !0; 7579 return !1; 7580 } 7581 compileFilter(e1) { 7582 this._filterCompiled || (this._featureFilter = ll(this.filter, this.scope, e1), this._filterCompiled = !0); 7583 } 7584 invalidateCompiledFilter() { 7585 this._filterCompiled = !1; 7586 } 7587 dynamicFilter() { 7588 return this._featureFilter.dynamicFilter; 7589 } 7590 dynamicFilterNeedsFeature() { 7591 return this._featureFilter.needFeature; 7592 } 7593 dynamicFilterNeedsGeometry() { 7594 return this._featureFilter.needGeometry; 7595 } 7596 getLayerRenderingStats() { 7597 return this._stats; 7598 } 7599 resetLayerRenderingStats(e1) { 7600 this._stats && ("shadow" === e1.renderPass ? this._stats.numRen
vendor: 12,580 bytes, lines 7600-7844
7600deredVerticesInShadowPass = 0 : this._stats.numRenderedVerticesInTransparentPass = 0); 7601 } 7602 getAppearances() { 7603 return this.appearances; 7604 } 7605 queryRenderedFeatures(e1, t1, i) { 7606 return {}; 7607 } 7608 queryRadius(e1) {} 7609 queryIntersectsFeature(e1, t1, i, n, r, o, a, s, l, c) {} 7610 constructor(e1, t1, i, n, r, o){ 7611 if (super(), this.id = e1.id, this.fqid = bl(this.id, i), this.type = e1.type, this.scope = i, this.lut = n, this.options = r, this.iconImageUseTheme = o, this.appearances = new Array, this.appearancesVersion = 0, this._featureFilter = { 7612 filter: ()=>!0, 7613 needGeometry: !1, 7614 needFeature: !1 7615 }, this._filterCompiled = !1, "custom" !== e1.type && (this.metadata = e1.metadata, this.minzoom = e1.minzoom, this.maxzoom = e1.maxzoom, e1.type && "background" !== e1.type && "sky" !== e1.type && "slot" !== e1.type && (this.source = e1.source, this.sourceLayer = e1["source-layer"], this.filter = e1.filter), e1.slot && (this.slot = e1.slot), e1.appearances && this.setAppearances(e1.appearances), t1.layout && (this._unevaluatedLayout = new Js(t1.layout, this.scope, r, this.iconImageUseTheme)), t1.paint)) { 7616 this._transitionablePaint = new qs(t1.paint, this.scope, r); 7617 for(const t1 in e1.paint)this.setPaintProperty(t1, e1.paint[t1]); 7618 for(const t1 in e1.layout)this.setLayoutProperty(t1, e1.layout[t1]); 7619 this._transitioningPaint = this._transitionablePaint.untransitioned(), this.paint = new Qs(t1.paint); 7620 } 7621 } 7622 } 7623 function Pl(e1, t1, i) { 7624 if (!e1._unevaluatedLayout) return !1; 7625 const n = e1._unevaluatedLayout.getValue(t1); 7626 return void 0 !== n && ("string" != typeof n || i(n)); 7627 } 7628 function Dl(e1, t1) { 7629 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 2; 7630 const n = t1 && t1.length, r = n ? t1[0] * i : e1.length; 7631 let o = Fl(e1, 0, r, i, !0); 7632 const a = []; 7633 if (!o || o.next === o.prev) return a; 7634 let s, l, c; 7635 if (n && (o = function(e1, t1, i, n) { 7636 const r = []; 7637 for(let i = 0, o = t1.length; i < o; i++){ 7638 const a = Fl(e1, t1[i] * n, i < o - 1 ? t1[i + 1] * n : e1.length, n, !1); 7639 a === a.next && (a.steiner = !0), r.push(Hl(a)); 7640 } 7641 r.sort(kl); 7642 for(let e1 = 0; e1 < r.length; e1++)i = Ul(r[e1], i); 7643 return i; 7644 }(e1, t1, o, i)), e1.length > 80 * i) { 7645 s = e1[0], l = e1[1]; 7646 let t1 = s, n = l; 7647 for(let o = i; o < r; o += i){ 7648 const i = e1[o], r = e1[o + 1]; 7649 i < s && (s = i), r < l && (l = r), i > t1 && (t1 = i), r > n && (n = r); 7650 } 7651 c = Math.max(t1 - s, n - l), c = 0 !== c ? 32767 / c : 0; 7652 } 7653 return Ll(o, a, i, s, l, c, 0), a; 7654 } 7655 function Fl(e1, t1, i, n, r) { 7656 let o; 7657 if (r === function(e1, t1, i, n) { 7658 let r = 0; 7659 for(let o = t1, a = i - n; o < i; o += n)r += (e1[a] - e1[o]) * (e1[o + 1] + e1[a + 1]), a = o; 7660 return r; 7661 }(e1, t1, i, n) > 0) for(let r = t1; r < i; r += n)o = tc(r / n | 0, e1[r], e1[r + 1], o); 7662 else for(let r = i - n; r >= t1; r -= n)o = tc(r / n | 0, e1[r], e1[r + 1], o); 7663 return o && Xl(o, o.next) && (ic(o), o = o.next), o; 7664 } 7665 function Cl(e1, t1) { 7666 if (!e1) return e1; 7667 t1 || (t1 = e1); 7668 let i, n = e1; 7669 do { 7670 if (i = !1, n.steiner || !Xl(n, n.next) && 0 !== ql(n.prev, n, n.next)) n = n.next; 7671 else { 7672 if (ic(n), n = t1 = n.prev, n === n.next) break; 7673 i = !0; 7674 } 7675 }while (i || n !== t1) 7676 return t1; 7677 } 7678 function Ll(e1, t1, i, n, r, o, a) { 7679 if (!e1) return; 7680 !a && o && function(e1, t1, i, n) { 7681 let r = e1; 7682 do { 7683 0 === r.z && (r.z = Gl(r.x, r.y, t1, i, n)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next; 7684 }while (r !== e1) 7685 r.prevZ.nextZ = null, r.prevZ = null, function(e1) { 7686 let t1, i = 1; 7687 do { 7688 let n, r = e1; 7689 e1 = null; 7690 let o = null; 7691 for(t1 = 0; r;){ 7692 t1++; 7693 let a = r, s = 0; 7694 for(let e1 = 0; e1 < i && (s++, a = a.nextZ, a); e1++); 7695 let l = i; 7696 for(; s > 0 || l > 0 && a;)0 !== s && (0 === l || !a || r.z <= a.z) ? (n = r, r = r.nextZ, s--) : (n = a, a = a.nextZ, l--), o ? o.nextZ = n : e1 = n, n.prevZ = o, o = n; 7697 r = a; 7698 } 7699 o.nextZ = null, i *= 2; 7700 }while (t1 > 1) 7701 }(r); 7702 }(e1, n, r, o); 7703 let s = e1; 7704 for(; e1.prev !== e1.next;){ 7705 const l = e1.prev, c = e1.next; 7706 if (o ? Bl(e1, n, r, o) : Ol(e1)) t1.push(l.i, e1.i, c.i), ic(e1), e1 = c.next, s = c.next; 7707 else if ((e1 = c) === s) { 7708 a ? 1 === a ? Ll(e1 = Vl(Cl(e1), t1), t1, i, n, r, o, 2) : 2 === a && Nl(e1, t1, i, n, r, o) : Ll(Cl(e1), t1, i, n, r, o, 1); 7709 break; 7710 } 7711 } 7712 } 7713 function Ol(e1) { 7714 const t1 = e1.prev, i = e1, n = e1.next; 7715 if (ql(t1, i, n) >= 0) return !1; 7716 const r = t1.x, o = i.x, a = n.x, s = t1.y, l = i.y, c = n.y, u = Math.min(r, o, a), h = Math.min(s, l, c), d = Math.max(r, o, a), f = Math.max(s, l, c); 7717 let p = n.next; 7718 for(; p !== t1;){ 7719 if (p.x >= u && p.x <= d && p.y >= h && p.y <= f && Zl(r, s, o, l, a, c, p.x, p.y) && ql(p.prev, p, p.next) >= 0) return !1; 7720 p = p.next; 7721 } 7722 return !0; 7723 } 7724 function Bl(e1, t1, i, n) { 7725 const r = e1.prev, o = e1, a = e1.next; 7726 if (ql(r, o, a) >= 0) return !1; 7727 const s = r.x, l = o.x, c = a.x, u = r.y, h = o.y, d = a.y, f = Math.min(s, l, c), p = Math.min(u, h, d), m = Math.max(s, l, c), _ = Math.max(u, h, d), g = Gl(f, p, t1, i, n), y = Gl(m, _, t1, i, n); 7728 let x = e1.prevZ, v = e1.nextZ; 7729 for(; x && x.z >= g && v && v.z <= y;){ 7730 if (x.x >= f && x.x <= m && x.y >= p && x.y <= _ && x !== r && x !== a && Zl(s, u, l, h, c, d, x.x, x.y) && ql(x.prev, x, x.next) >= 0) return !1; 7731 if (x = x.prevZ, v.x >= f && v.x <= m && v.y >= p && v.y <= _ && v !== r && v !== a && Zl(s, u, l, h, c, d, v.x, v.y) && ql(v.prev, v, v.next) >= 0) return !1; 7732 v = v.nextZ; 7733 } 7734 for(; x && x.z >= g;){ 7735 if (x.x >= f && x.x <= m && x.y >= p && x.y <= _ && x !== r && x !== a && Zl(s, u, l, h, c, d, x.x, x.y) && ql(x.prev, x, x.next) >= 0) return !1; 7736 x = x.prevZ; 7737 } 7738 for(; v && v.z <= y;){ 7739 if (v.x >= f && v.x <= m && v.y >= p && v.y <= _ && v !== r && v !== a && Zl(s, u, l, h, c, d, v.x, v.y) && ql(v.prev, v, v.next) >= 0) return !1; 7740 v = v.nextZ; 7741 } 7742 return !0; 7743 } 7744 function Vl(e1, t1) { 7745 let i = e1; 7746 do { 7747 const n = i.prev, r = i.next.next; 7748 !Xl(n, r) && Yl(n, i, i.next, r) && Ql(n, r) && Ql(r, n) && (t1.push(n.i, i.i, r.i), ic(i), ic(i.next), i = e1 = r), i = i.next; 7749 }while (i !== e1) 7750 return Cl(i); 7751 } 7752 function Nl(e1, t1, i, n, r, o) { 7753 let a = e1; 7754 do { 7755 let e1 = a.next.next; 7756 for(; e1 !== a.prev;){ 7757 if (a.i !== e1.i && Wl(a, e1)) { 7758 let s = ec(a, e1); 7759 return a = Cl(a, a.next), s = Cl(s, s.next), Ll(a, t1, i, n, r, o, 0), void Ll(s, t1, i, n, r, o, 0); 7760 } 7761 e1 = e1.next; 7762 } 7763 a = a.next; 7764 }while (a !== e1) 7765 } 7766 function kl(e1, t1) { 7767 let i = e1.x - t1.x; 7768 return 0 === i && (i = e1.y - t1.y, 0 === i) && (i = (e1.next.y - e1.y) / (e1.next.x - e1.x) - (t1.next.y - t1.y) / (t1.next.x - t1.x)), i; 7769 } 7770 function Ul(e1, t1) { 7771 const i = function(e1, t1) { 7772 let i = t1; 7773 const n = e1.x, r = e1.y; 7774 let o, a = -1 / 0; 7775 if (Xl(e1, i)) return i; 7776 do { 7777 if (Xl(e1, i.next)) return i.next; 7778 if (r <= i.y && r >= i.next.y && i.next.y !== i.y) { 7779 const e1 = i.x + (r - i.y) * (i.next.x - i.x) / (i.next.y - i.y); 7780 if (e1 <= n && e1 > a && (a = e1, o = i.x < i.next.x ? i : i.next, e1 === n)) return o; 7781 } 7782 i = i.next; 7783 }while (i !== t1) 7784 if (!o) return null; 7785 const s = o, l = o.x, c = o.y; 7786 let u = 1 / 0; 7787 i = o; 7788 do { 7789 if (n >= i.x && i.x >= l && n !== i.x && $l(r < c ? n : a, r, l, c, r < c ? a : n, r, i.x, i.y)) { 7790 const t1 = Math.abs(r - i.y) / (n - i.x); 7791 Ql(i, e1) && (t1 < u || t1 === u && (i.x > o.x || i.x === o.x && jl(o, i))) && (o = i, u = t1); 7792 } 7793 i = i.next; 7794 }while (i !== s) 7795 return o; 7796 }(e1, t1); 7797 if (!i) return t1; 7798 const n = ec(i, e1); 7799 return Cl(n, n.next), Cl(i, i.next); 7800 } 7801 function jl(e1, t1) { 7802 return ql(e1.prev, e1, t1.prev) < 0 && ql(t1.next, e1, e1.next) < 0; 7803 } 7804 function Gl(e1, t1, i, n, r) { 7805 return (e1 = 1431655765 & ((e1 = 858993459 & ((e1 = 252645135 & ((e1 = 16711935 & ((e1 = (e1 - i) * r | 0) | e1 << 8)) | e1 << 4)) | e1 << 2)) | e1 << 1)) | (t1 = 1431655765 & ((t1 = 858993459 & ((t1 = 252645135 & ((t1 = 16711935 & ((t1 = (t1 - n) * r | 0) | t1 << 8)) | t1 << 4)) | t1 << 2)) | t1 << 1)) << 1; 7806 } 7807 function Hl(e1) { 7808 let t1 = e1, i = e1; 7809 do { 7810 (t1.x < i.x || t1.x === i.x && t1.y < i.y) && (i = t1), t1 = t1.next; 7811 }while (t1 !== e1) 7812 return i; 7813 } 7814 function $l(e1, t1, i, n, r, o, a, s) { 7815 return (r - a) * (t1 - s) >= (e1 - a) * (o - s) && (e1 - a) * (n - s) >= (i - a) * (t1 - s) && (i - a) * (o - s) >= (r - a) * (n - s); 7816 } 7817 function Zl(e1, t1, i, n, r, o, a, s) { 7818 return !(e1 === a && t1 === s) && $l(e1, t1, i, n, r, o, a, s); 7819 } 7820 function Wl(e1, t1) { 7821 return e1.next.i !== t1.i && e1.prev.i !== t1.i && !function(e1, t1) { 7822 let i = e1; 7823 do { 7824 if (i.i !== e1.i && i.next.i !== e1.i && i.i !== t1.i && i.next.i !== t1.i && Yl(i, i.next, e1, t1)) return !0; 7825 i = i.next; 7826 }while (i !== e1) 7827 return !1; 7828 }(e1, t1) && (Ql(e1, t1) && Ql(t1, e1) && function(e1, t1) { 7829 let i = e1, n = !1; 7830 const r = (e1.x + t1.x) / 2, o = (e1.y + t1.y) / 2; 7831 do { 7832 i.y > o != i.next.y > o && i.next.y !== i.y && r < (i.next.x - i.x) * (o - i.y) / (i.next.y - i.y) + i.x && (n = !n), i = i.next; 7833 }while (i !== e1) 7834 return n; 7835 }(e1, t1) && (ql(e1.prev, e1, t1.prev) || ql(e1, t1.prev, t1)) || Xl(e1, t1) && ql(e1.prev, e1, e1.next) > 0 && ql(t1.prev, t1, t1.next) > 0); 7836 } 7837 function ql(e1, t1, i) { 7838 return (t1.y - e1.y) * (i.x - t1.x) - (t1.x - e1.x) * (i.y - t1.y); 7839 } 7840 function Xl(e1, t1) { 7841 return e1.x === t1.x && e1.y === t1.y; 7842 } 7843 function Yl(e1, t1, i, n) { 7844 const r = Kl(ql(e1, t1, i)), o = Kl(ql(e1, t1, n)), a = Kl(ql(i, n, e1
7844)), s = Kl(ql(i, n, t1)); 7845 return r !== o && a !== s || !(0 !== r || !Jl(e1, i, t1)) || !(0 !== o || !Jl(e1, n, t1)) || !(0 !== a || !Jl(i, e1, n)) || !(0 !== s || !Jl(i, t1, n)); 7846 } 7847 function Jl(e1, t1, i) { 7848 return t1.x <= Math.max(e1.x, i.x) && t1.x >= Math.min(e1.x, i.x) && t1.y <= Math.max(e1.y, i.y) && t1.y >= Math.min(e1.y, i.y); 7849 } 7850 function Kl(e1) { 7851 return e1 > 0 ? 1 : e1 < 0 ? -1 : 0; 7852 } 7853 function Ql(e1, t1) { 7854 return ql(e1.prev, e1, e1.next) < 0 ? ql(e1, t1, e1.next) >= 0 && ql(e1, e1.prev, t1) >= 0 : ql(e1, t1, e1.prev) < 0 || ql(e1, e1.next, t1) < 0; 7855 } 7856 function ec(e1, t1) { 7857 const i = nc(e1.i, e1.x, e1.y), n = nc(t1.i, t1.x, t1.y), r = e1.next, o = t1.prev; 7858 return e1.next = t1, t1.prev = e1, i.next = r, r.prev = i, n.next = i, i.prev = n, o.next = n, n.prev = o, n; 7859 } 7860 function tc(e1, t1, i, n) { 7861 const r = nc(e1, t1, i); 7862 return n ? (r.next = n.next, r.prev = n, n.next.prev = r, n.next = r) : (r.prev = r, r.next = r), r; 7863 } 7864 function ic(e1) { 7865 e1.next.prev = e1.prev, e1.prev.next = e1.next, e1.prevZ && (e1.prevZ.nextZ = e1.nextZ), e1.nextZ && (e1.nextZ.prevZ = e1.prevZ); 7866 } 7867 function nc(e1, t1, i) { 7868 return { 7869 i: e1, 7870 x: t1, 7871 y: i, 7872 prev: null, 7873 next: null, 7874 z: 0, 7875 prevZ: null, 7876 nextZ: null, 7877 steiner: !1 7878 }; 7879 } 7880 function rc(e1, t1) { 7881 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; 7882 if (!e1) return null; 7883 const n = "string" == typeof e1 ? Gn.from(e1).getPrimary() : e1.getPrimary(), r = "string" == typeof e1 ? null : e1.getSecondary(); 7884 for (const e1 of [ 7885 n, 7886 r 7887 ]){ 7888 if (!e1) continue; 7889 const n = e1.id.toString(); 7890 t1.has(n) || t1.set(n, []), e1.scaleSelf(i), t1.get(n).push(e1); 7891 } 7892 return { 7893 primary: n.toString(), 7894 secondary: r ? r.toString() : null 7895 }; 7896 } 7897 function oc(e1, t1, i, n) { 7898 const r = n.patternDependencies; 7899 let o = !1; 7900 for (const n of t1){ 7901 const t1 = n.paint.get("".concat(e1, "-pattern")); 7902 t1.isConstant() || (o = !0), rc(t1.constantOr(null), r, i) && (o = !0); 7903 } 7904 return o; 7905 } 7906 function ac(e1, t1, i, n, r, o) { 7907 const a = o.patternDependencies; 7908 for (const s of t1){ 7909 const t1 = s.paint.get("".concat(e1, "-pattern")).value; 7910 if ("constant" !== t1.kind) { 7911 const e1 = rc(t1.evaluate({ 7912 zoom: n 7913 }, i, {}, void 0, o.availableImages), a, r); 7914 if (!e1) continue; 7915 const { primary: l, secondary: c } = e1; 7916 l && (i.patterns[s.id] = [ 7917 l, 7918 c 7919 ].filter(Boolean)); 7920 } 7921 } 7922 return i; 7923 } 7924 const sc = zr / Math.PI / 2, lc = 64, cc = [ 7925 lc, 7926 32, 7927 16 7928 ], uc = -sc, hc = sc; 7929 function dc(e1, t1, i) { 7930 let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : sc; 7931 return i = Je(i), [ 7932 e1 * Math.sin(i) * n, 7933 -t1 * n, 7934 e1 * Math.cos(i) * n 7935 ]; 7936 } 7937 function fc(e1, t1, i) { 7938 return dc(Math.cos(Je(e1)), Math.sin(Je(e1)), t1, i); 7939 } 7940 const pc = 6371008.8, mc = 2 * Math.PI * pc; 7941 class _c { 7942 wrap() { 7943 return new _c(rt(this.lng, -180, 180), this.lat); 7944 } 7945 toArray() { 7946 return [ 7947 this.lng, 7948 this.lat 7949 ]; 7950 } 7951 toString() { 7952 return "LngLat(".concat(this.lng, ", ").concat(this.lat, ")"); 7953 } 7954 distanceTo(e1) { 7955 const t1 = Math.PI / 180, i = this.lat * t1, n = e1.lat * t1, r = Math.sin(i) * Math.sin(n) + Math.
7955cos(i) * Math.cos(n) * Math.cos((e1.lng - this.lng) * t1); 7956 return pc * Math.acos(Math.min(r, 1)); 7957 } 7958 toBounds() { 7959 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0; 7960 const t1 = 360 * e1 / 40075017, i = t1 / Math.cos(Math.PI / 180 * this.lat); 7961 return new gc({ 7962 lng: this.lng - i, 7963 lat: this.lat - t1 7964 }, { 7965 lng: this.lng + i, 7966 lat: this.lat + t1 7967 }); 7968 } 7969 toEcef(e1) { 7970 return fc(this.lat, this.lng, sc + e1 * sc / pc); 7971 } 7972 static convert(e1) { 7973 if (e1 instanceof _c) return e1; 7974 if (Array.isArray(e1) && (2 === e1.length || 3 === e1.length)) return new _c(Number(e1[0]), Number(e1[1])); 7975 if (!Array.isArray(e1) && "object" == typeof e1 && null !== e1) return new _c(Number("lng" in e1 ? e1.lng : e1.lon), Number(e1.lat)); 7976 throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]"); 7977 } 7978 constructor(e1, t1){ 7979 if (isNaN(e1) || isNaN(t1)) throw new Error("Invalid LngLat object: (".concat(e1, ", ").concat(t1, ")")); 7980 if (this.lng = +e1, this.lat = +t1, this.lat > 90 || this.lat < -90) throw new Error("Invalid LngLat latitude value: must be between -90 and 90"); 7981 } 7982 } 7983 class gc { 7984 setNorthEast(e1) { 7985 return this._ne = e1 instanceof _c ? new _c(e1.lng, e1.lat) : _c.convert(e1), this; 7986 } 7987 setSouthWest(e1) { 7988 return this._sw = e1 instanceof _c ? new _c(e1.lng, e1.lat) : _c.convert(e1), this; 7989 } 7990 extend(e1) { 7991 const t1 = this._sw, i = this._ne; 7992 let n, r; 7993 if (e1 instanceof _c) n = e1, r = e1; 7994 else { 7995 if (!(e1 instanceof gc)) return Array.isArray(e1) ? 4 === e1.length || e1.every(Array.isArray) ? this.extend(gc.convert(e1)) : this.extend(_c.convert(e1)) : "object" == typeof e1 && null !== e1 && Object.hasOwn(e1, "lat") && (Object.hasOwn(e1, "lon") || Object.hasOwn(e1, "lng")) ? this.extend(_c.convert(e1)) : this;
7996 if (n = e1._sw, r = e1._ne, !n || !r) return this; 7997 } 7998 return t1 || i ? (t1.lng = Math.min(n.lng, t1.lng), t1.lat = Math.min(n.lat, t1.lat), i.lng = Math.max(r.lng, i.lng), i.lat = Math.max(r.lat, i.lat)) : (this._sw = new _c(n.lng, n.lat), this._ne = new _c(r.lng, r.lat)), this; 7999 } 8000 getCenter() { 8001 return new _c((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2); 8002 } 8003 getSouthWest() { 8004 return this._sw; 8005 } 8006 getNorthEast() { 8007 return this._ne; 8008 } 8009 getNorthWest() { 8010 return new _c(this.getWest(), this.getNorth()); 8011 } 8012 getSouthEast() { 8013 return new _c(this.getEast(), this.getSouth()); 8014 } 8015 getWest() { 8016 return this._sw.lng; 8017 } 8018 getSouth() { 8019 return this._sw.lat; 8020 } 8021 getEast() { 8022 return this._ne.lng; 8023 } 8024 getNorth() { 8025 return this._ne.lat; 8026 } 8027 toArray() { 8028 return [ 8029 this._sw.toArray(), 8030 this._ne.toArray() 8031 ]; 8032 } 8033 toString() { 8034 return "LngLatBounds(".concat(this._sw.toString(), ", ").concat(this._ne.toString(), ")"); 8035 } 8036 isEmpty() { 8037 return !(this._sw && this._ne); 8038 } 8039 contains(e1) { 8040 const { lng: t1, lat: i } = _c.convert(e1); 8041 let n = this._sw.lng <= t1 && t1 <= this._ne.lng; 8042 return this._sw.lng > this._ne.lng && (n = this._sw.lng >= t1 && t1 >= this._ne.lng), this._sw.lat <= i && i <= this._ne.lat && n; 8043 } 8044 static convert(e1) { 8045 if (e1) return e1 instanceof gc ? e1 : new gc(e1); 8046 } 8047 constructor(e1, t1){ 8048 e1 && (t1 ? this.setSouthWest(e1).setNorthEast(t1) : Array.isArray(e1) && 4 === e1.length ? this.setSouthWest([ 8049 e1[0], 8050 e1[1] 8051 ]).setNorthEast([ 8052 e1[2], 8053 e1[3] 8054 ]) : this.setSouthWest(e1[0]).setNorthEast(e1[1])); 8055 } 8056 } 8057 function yc(e1) { 8058 return mc * Math.cos(e1 * Math.PI / 180); 8059 } 8060 function xc(e1, t1) { 8061 return e1 / yc(t1); 8062 } 8063 function vc(e1, t1) { 8064 return e1 * yc(mr(t1)); 8065 } 8066 const bc = 85.051129; 8067 function wc(e1) { 8068 return Math.cos(Je(it(e1, -85.051129, bc))); 8069 } 8070 function Ac(e1, t1) { 8071 const i = it(t1, 0, 25.5), n = Math.pow(2, i); 8072 return wc(e1) * mc / (512 * n); 8073 } 8074 function Ec(e1) { 8075 return 1 / Math.cos(e1 * Math.PI / 180); 8076 } 8077 function Ic(e1) { 8078 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; 8079 const i = Math.exp(Math.PI * (1 - (e1.y + t1 / zr) / (1 << e1.z) * 2)); 8080 return 80150034 * i / (i * i + 1) / zr / (1 << e1.z); 8081 } 8082 class Mc { 8083 static fromLngLat(e1) { 8084 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; 8085 const i = _c.convert(e1); 8086 return new Mc(dr(i.lng), fr(i.lat), xc(t1, i.lat)); 8087 } 8088 toLngLat() { 8089 return new _c(pr(this.x), mr(this.y)); 8090 } 8091 toAltitude() { 8092 return vc(this.z, this.y); 8093 } 8094 meterInMercatorCoordinateUnits() { 8095 return 1 / mc * Ec(mr(this.y)); 8096 } 8097 constructor(e1, t1, i = 0){ 8098 this.x = +e1, this.y = +t1, this.z = +i; 8099 } 8100 } 8101 function Tc(e1, t1, i, n, r, o, a, s, l) { 8102 const c = (t1 + n) / 2, u = (i + r) / 2, h = new Pe(c, u); 8103 s(h), function(e1, t1, i, n, r, o) { 8104 const a = i - r, s = n - o; 8105 return Math.abs((n - t1) * a - (i - e1) * s) / Math.hypot(a, s); 8106 }(h.x, h.y, o.x, o.y, a.x, a.y) >= l ? (Tc(e1, t1, i, c, u, o, h, s, l), Tc(e1, c, u, n, r, h, a, s, l)) : e1.push(a); 8107 } 8108 function Sc(e1, t1, i) { 8109 let n = e1[0], r = n.x, o = n.y; 8110 t1(n); 8111 const a = [ 8112 n 8113 ]; 8114 for(let s = 1; s < e1.length; s++){ 8115 const l = e1[s], { x: c, y: u } = l; 8116 t1(l), Tc(a, r, o, c, u, n, l, t1, i), r = c, o = u, n = l; 8117 } 8118 return a; 8119 } 8120 function zc(e1, t1, i, n) { 8121 if (n(t1, i)) { 8122 const r = t1.add(i)._mult(.5); 8123 zc(e1, t1, r, n), zc(e1, r, i, n); 8124 } else e1.push(i); 8125 } 8126 function Rc(e1, t1) { 8127 let i = e1[0]; 8128 const n = [ 8129 i 8130 ]; 8131 for(let r = 1;
8131 r < e1.length; r++){ 8132 const o = e1[r]; 8133 zc(n, i, o, t1), i = o; 8134 } 8135 return n; 8136 } 8137 const Pc = Math.pow(2, 14) - 1, Dc = -Pc - 1; 8138 function Fc(e1, t1) { 8139 const i = Math.round(e1.x * t1), n = Math.round(e1.y * t1); 8140 return e1.x = it(i, Dc, Pc), e1.y = it(n, Dc, Pc), (i < e1.x || i > e1.x + 1 || n < e1.y || n > e1.y + 1) && gt("Geometry exceeds allowed extent, reduce your vector tile buffer size"), e1; 8141 } 8142 function Cc(e1, t1, i) { 8143 const n = e1.loadGeometry(), r = e1.extent, o = zr / r; 8144 if (t1 && i && i.projection.isReprojectedInTileSpace) { 8145 const o = 1 << t1.z, { scale: a, x: s, y: l, projection: c } = i, u = (e1)=>{ 8146 const i = pr((t1.x + e1.x / r) / o), n = mr((t1.y + e1.y / r) / o), u = c.project(i, n); 8147 e1.x = (u.x * a - s) * r, e1.y = (u.y * a - l) * r; 8148 }; 8149 for(let t1 = 0; t1 < n.length; t1++)if (1 !== e1.type) n[t1] = Sc(n[t1], u, 1); 8150 else { 8151 const e1 = []; 8152 for (const i of n[t1])i.x < 0 || i.x >= r || i.y < 0 || i.y >= r || (u(i), e1.push(i)); 8153 n[t1] = e1; 8154 } 8155 } 8156 for (const e1 of n)for (const t1 of e1)Fc(t1, o); 8157 return n; 8158 } 8159 function Lc(e1, t1) { 8160 return { 8161 type: e1.type, 8162 id: e1.id, 8163 properties: e1.properties, 8164 geometry: t1 ? Cc(e1) : [] 8165 }; 8166 } 8167 const Oc = { 8168 Int8: Int8Array, 8169 Uint8: Uint8Array, 8170 Int16: Int16Array, 8171 Uint16: Uint16Array, 8172 Int32: Int32Array, 8173 Uint32: Uint32Array, 8174 Float32: Float32Array 8175 }; 8176 class Bc { 8177 constructor(e1, t1){ 8178 this._structArray = e1, this._pos1 = t1 * this.size, this._pos2 = this._pos1 / 2, this._pos4 = this._pos1 / 4, this._pos8 = this._pos1 / 8; 8179 } 8180 } 8181 const Vc = new ArrayBuffer(0); 8182 class Nc { 8183 static serialize(e1, t1) { 8184 return e1._trim(), t1 && e1.arrayBuffer && t1.add(e1.arrayBuffer), { 8185 length: e1.length, 8186 arrayBuffer: e1.arrayBuffer 8187 }; 8188 } 8189 static deserialize(e1) { 8190 const t1 = Object.create(this.prototype); 8191 return t1.arrayBuffer = e1.arrayBuffer, t1.length = e1.length, e1.arrayBuffer ? t1.capacity = e1.arrayBuffer.byteLength / t1.bytesPerElement : (t1.capacity = 0, t1.arrayBuffer = Vc), t1._refreshViews(), t1; 8192 } 8193 _trim() { 8194 this.length !== this.capacity && (this.capacity = this.length, this.arrayBuffer = this.arrayBuffer.slice(0, this.length * this.bytesPerElement), this._refreshViews()); 8195 } 8196 clear() { 8197 this.length = 0; 8198 } 8199 resize(e1) { 8200 this.reserve(e1), this.length = e1; 8201 } 8202 resizeExact(e1) { 8203 this.reserveExact(e1), this.length = e1; 8204 } 8205 reserve(e1) { 8206 e1 > this.capacity && this._allocate(Math.max(e1, Math.floor(5 * this.capacity), 128)); 8207 } 8208 reserveExact(e1) { 8209 (e1 > this.capacity || !this.arrayBuffer) && this._allocate(e1); 8210 } 8211 _allocate(e1) { 8212 this._reallocCount++, this.capacity = e1, this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement); 8213 const t1 = this.uint8; 8214 this._refreshViews(), t1 && this.uint8.set(t1); 8215 } 8216 reserveForAdditional(e1) { 8217 this.reserve(this.length + e1); 8218 } 8219 _refreshViews() { 8220 throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout"); 8221 } 8222 emplace() { 8223 for(var _len = arguments.length, e1 = new Array(_len), _key = 0; _key < _len; _key++){ 8224 e1[_key] = arguments[_key]; 8225 } 8226 throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout"); 8227 } 8228 emplaceBack() { 8229 for(var _len = arguments.length, e1 = new Array(_len), _key = 0; _key < _len; _key++){ 8230 e1[_key] = arguments[_key]; 8231 } 8232 throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout"); 8233 } 8234 destroy() { 8235 this.int8 = this.uint8 = this.int16 = this.uint16
8235= this.int32 = this.uint32 = this.float32 = null, this.arrayBuffer = null; 8236 } 8237 constructor(){ 8238 this._reallocCount = 0, this.capacity = 0, this.length = 0; 8239 } 8240 } 8241 function kc(e1) { 8242 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1; 8243 let i = 0, n = 0; 8244 return { 8245 members: e1.map((e1)=>{ 8246 const r = Oc[e1.type].BYTES_PER_ELEMENT, o = i = Uc(i, Math.max(t1, r)), a = e1.components || 1; 8247 return n = Math.max(n, r), i += r * a, { 8248 name: e1.name, 8249 type: e1.type, 8250 components: a, 8251 offset: o 8252 }; 8253 }), 8254 size: Uc(i, Math.max(n, t1)), 8255 alignment: t1 8256 }; 8257 } 8258 function Uc(e1, t1) { 8259 return Math.ceil(e1 / t1) * t1; 8260 } 8261 class jc extends Nc { 8262 _refreshViews() { 8263 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); 8264 } 8265 emplaceBack(e1, t1) { 8266 const i = this.length; 8267 return this.resize(i + 1), this.emplace(i, e1, t1); 8268 } 8269 emplace(e1, t1, i) { 8270 const n = 2 * e1; 8271 return this.int16[n + 0] = t1, this.int16[n + 1] = i, e1; 8272 } 8273 } 8274 jc.prototype.bytesPerElement = 4, Xa(jc, "StructArrayLayout2i4"); 8275 class Gc extends Nc { 8276 _refreshViews() { 8277 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); 8278 } 8279 emplaceBack(e1, t1, i) { 8280 const n = this.length; 8281 return this.resize(n + 1), this.emplace(n, e1, t1, i); 8282 } 8283 emplace(e1, t1, i, n) { 8284 const r = 3 * e1; 8285 return this.int16[r + 0] = t1, this.int16[r + 1] = i, this.int16[r + 2] = n, e1; 8286 } 8287 }
8288 Gc.prototype.bytesPerElement = 6, Xa(Gc, "StructArrayLayout3i6"); 8289 class Hc extends Nc { 8290 _refreshViews() { 8291 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); 8292 } 8293 emplaceBack(e1, t1, i, n) { 8294 const r = this.length; 8295 return this.resize(r + 1), this.emplace(r, e1, t1, i, n); 8296 } 8297 emplace(e1, t1, i, n, r) { 8298 const o = 4 * e1; 8299 return this.int16[o + 0] = t1, this.int16[o + 1] = i, this.uint16[o + 2] = n, this.uint16[o + 3] = r, e1; 8300 } 8301 } 8302 Hc.prototype.bytesPerElement = 8, Xa(Hc, "StructArrayLayout2i2ui8"); 8303 class $c extends Nc { 8304 _refreshViews() { 8305 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8306 } 8307 emplaceBack(e1) { 8308 const t1 = this.length; 8309 return this.resize(t1 + 1), this.emplace(t1, e1); 8310 } 8311 emplace(e1, t1) { 8312 return this.float32[1 * e1 + 0] = t1, e1; 8313 } 8314 } 8315 $c.prototype.bytesPerElement = 4, Xa($c, "StructArrayLayout1f4"); 8316 class Zc extends Nc { 8317 _refreshViews() { 8318 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8319 } 8320 emplaceBack(e1, t1, i) { 8321 const n = this.length; 8322 return this.resize(n + 1), this.emplace(n, e1, t1, i); 8323 } 8324 emplace(e1, t1, i, n) { 8325 const r = 4 * e1, o = 2 * e1; 8326 return this.int16[r + 0] = t1, this.int16[r + 1] = i, this.float32[o + 1] = n, e1; 8327 } 8328 } 8329 Zc.prototype.bytesPerElement = 8, Xa(Zc, "StructArrayLayout2i1f8"); 8330 class Wc extends Nc { 8331 _refreshViews() { 8332 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); 8333 } 8334 emplaceBack(e1, t1, i) { 8335 const n = this.length; 8336 return this.resize(n + 1), this.emplace(n, e1, t1, i); 8337 } 8338 emplace(e1, t1, i, n) { 8339 const r = 4 * e1; 8340 return this.int16[r + 0] = t1, this.int16[r + 1] = i, this.int16[r + 2] = n, e1; 8341 } 8342 } 8343 Wc.prototype.bytesPerElement = 8, Xa(Wc, "StructArrayLayout3i8"); 8344 class qc extends Nc { 8345 _refreshViews() { 8346 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); 8347 } 8348 emplaceBack(e1, t1, i, n) { 8349 const r = this.length; 8350 return this.resize(r + 1), this.emplace(r, e1, t1, i, n); 8351 } 8352 emplace(e1, t1, i, n, r) { 8353 const o = 4 * e1; 8354 return this.int16[o + 0] = t1, this.int16[o + 1] = i, this.int16[o + 2] = n, this.int16[o + 3] = r, e1; 8355 } 8356 } 8357 qc.prototype.bytesPerElement = 8, Xa(qc, "StructArrayLayout4i8"); 8358 class Xc extends Nc { 8359 _refreshViews() { 8360 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); 8361 } 8362 emplaceBack(e1, t1, i, n, r) { 8363 const o = this.length; 8364 return this.resize(o + 1), this.emplace(o, e1, t1, i, n, r); 8365 } 8366 emplace(e1, t1, i, n, r, o) { 8367 const a = 5 * e1; 8368 return this.int16[a + 0] = t1, this.int16[a + 1] = i, this.int16[a + 2] = n, this.int16[a + 3] = r, this.int16[a + 4] = o, e1; 8369 } 8370 } 8371 Xc.prototype.bytesPerElement = 10, Xa(Xc, "StructArrayLayout5i10"); 8372 class Yc extends Nc { 8373 _refreshViews() { 8374 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8375 } 8376 emplaceBack(e1, t1, i, n, r, o, a) { 8377 const s = this.length; 8378 return this.resize(s + 1), this.emplace(s, e1, t1, i, n, r, o, a); 8379 } 8380 emplace(e1, t1, i, n, r, o, a, s) { 8381 const l = 6 * e1, c = 12 * e1, u = 3 * e1; 8382 return this.int16[l + 0] = t1, this.int16[l + 1] = i, this.uint8[c + 4] = n, this.uint8[c + 5] = r, this.uint8[c + 6] = o, this.uint8[c + 7] = a, this.float32[u + 2] = s, e1; 8383 } 8384 } 8385 Yc.prototype.bytesPerElement = 12, Xa(Yc, "StructArrayLayout2i4ub1f12"); 8386 class Jc extends Nc { 8387 _refreshViews() { 8388 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8389 } 8390 emplaceBack(e1, t1, i) { 8391 const n = this.length; 8392 return this.resize(n + 1), this.emplace(n, e1, t1, i); 8393 } 8394 emplace(e1, t1, i, n) { 8395 const r = 3 * e1; 8396 return this.float32[r + 0] = t1, this.float32[r + 1] = i, this.float32[r + 2] = n, e1; 8397 } 8398 } 8399 Jc.prototype.bytesPerElement = 12, Xa(Jc, "StructArrayLayout3f12"); 8400 class Kc extends Nc { 8401 _refreshViews() { 8402 this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16
8402= new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8403 } 8404 emplaceBack(e1, t1, i, n, r) { 8405 const o = this.length; 8406 return this.resize(o + 1), this.emplace(o, e1, t1, i, n, r); 8407 } 8408 emplace(e1, t1, i, n, r, o) { 8409 const a = 6 * e1, s = 3 * e1; 8410 return this.uint16[a + 0] = t1, this.uint16[a + 1] = i, this.uint16[a + 2] = n, this.uint16[a + 3] = r, this.float32[s + 2] = o, e1; 8411 } 8412 } 8413 Kc.prototype.bytesPerElement = 12, Xa(Kc, "StructArrayLayout4ui1f12"); 8414 class Qc extends Nc { 8415 _refreshViews() { 8416 this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); 8417 } 8418 emplaceBack(e1, t1, i, n) { 8419 const r = this.length; 8420 return this.resize(r + 1), this.emplace(r, e1, t1, i, n); 8421 } 8422 emplace(e1, t1, i, n, r) { 8423 const o = 4 * e1; 8424 return this.uint16[o + 0] = t1, this.uint16[o + 1] = i, this.uint16[o + 2] = n, this.uint16[o + 3] = r, e1; 8425 } 8426 } 8427 Qc.prototype.bytesPerElement = 8, Xa(Qc, "StructArrayLayout4ui8"); 8428 class eu extends Nc { 8429 _refreshViews() { 8430 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); 8431 } 8432 emplaceBack(e1, t1, i, n, r, o) { 8433 const a = this.length; 8434 return this.resize(a + 1), this.emplace(a, e1, t1, i, n, r, o); 8435 } 8436 emplace(e1, t1, i, n, r, o, a) { 8437 const s = 6 * e1; 8438 return this.int16[s + 0] = t1, this.int16[s + 1] = i, this.int16[s + 2] = n, this.int16[s + 3] = r, this.int16[s + 4] = o, this.int16[s + 5] = a, e1; 8439 } 8440 } 8441 eu.prototype.bytesPerElement = 12, Xa(eu, "StructArrayLayout6i12"); 8442 class tu extends Nc { 8443 _refreshViews() { 8444 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); 8445 } 8446 emplaceBack(e1, t1, i, n, r, o, a, s, l, c, u, h) { 8447 const d = this.length; 8448 return this.resize(d + 1), this.emplace(d, e1, t1, i, n, r, o, a, s, l, c, u, h); 8449 } 8450 emplace(e1, t1, i, n, r, o, a, s, l, c, u, h, d) { 8451 const f = 12 * e1; 8452 return this.int16[f + 0] = t1, this.int16[f + 1] = i, this.int16[f + 2] = n, this.int16[f + 3] = r, this.uint16[f + 4] = o, this.uint16[f + 5] = a, this.uint16[f + 6] = s, this.uint16[f + 7] = l, this.int16[f + 8] = c, this.int16[f + 9] = u, this.int16[f + 10] = h, this.int16[f + 11] = d, e1; 8453 } 8454 } 8455 tu.prototype.bytesPerElement = 24, Xa(tu, "StructArrayLayout4i4ui4i24"); 8456 class iu extends Nc { 8457 _refreshViews() { 8458 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8459 } 8460 emplaceBack(e1, t1, i, n, r, o) { 8461 const a = this.length; 8462 return this.resize(a + 1), this.emplace(a, e1, t1, i, n, r, o); 8463 } 8464 emplace(e1, t1, i, n, r, o, a) { 8465 const s = 10 * e1, l = 5 * e1; 8466 return this.int16[s + 0] = t1, this.int16[s + 1] = i, this.int16[s + 2] = n, this.float32[l + 2] = r, this.float32[l + 3] = o, this.float32[l + 4] = a, e1; 8467 } 8468 } 8469 iu.prototype.bytesPerElement = 20, Xa(iu, "StructArrayLayout3i3f20"); 8470 class nu extends Nc { 8471 _refreshViews() { 8472 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8473 } 8474 emplaceBack(e1, t1, i, n) { 8475 const r = this.length; 8476 return this.resize(r + 1), this.emplace(r, e1, t1, i, n); 8477 } 8478 emplace(e1, t1, i, n, r) { 8479 const o = 4 * e1; 8480 return this.float32[o + 0] = t1, this.float32[o + 1] = i, this.float32[o + 2] = n, this.float32[o + 3] = r, e1; 8481 } 8482 } 8483 nu.prototype.bytesPerElement = 16, Xa(nu, "StructArrayLayout4f16"); 8484 class ru extends Nc { 8485 _refreshViews() { 8486 this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer); 8487 } 8488 emplaceBack(e1) { 8489 const t1 = this.length; 8490 return this.resize(t1 + 1), this.emplace(t1, e1); 8491 } 8492 emplace(e1, t1) { 8493 return this.uint32[1 * e1 + 0] = t1, e1; 8494 } 8495 }
8496 ru.prototype.bytesPerElement = 4, Xa(ru, "StructArrayLayout1ul4"); 8497 class ou extends Nc { 8498 _refreshViews() { 8499 this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); 8500 } 8501 emplaceBack(e1, t1) { 8502 const i = this.length; 8503 return this.resize(i + 1), this.emplace(i, e1, t1); 8504 } 8505 emplace(e1, t1, i) { 8506 const n = 2 * e1; 8507 return this.uint16[n + 0] = t1, this.uint16[n + 1] = i, e1; 8508 } 8509 } 8510 ou.prototype.bytesPerElement = 4, Xa(ou, "StructArrayLayout2ui4"); 8511 class au extends Nc { 8512 _refreshViews() { 8513 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); 8514 } 8515 emplaceBack(e1, t1, i, n, r, o, a, s, l, c, u, h, d) { 8516 const f = this.length; 8517 return this.resize(f + 1), this.emplace(f, e1, t1, i, n, r, o, a, s, l, c, u, h, d); 8518 } 8519 emplace(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f) { 8520 const p = 20 * e1, m = 10 * e1; 8521 return this.int16[p + 0] = t1, this.int16[p + 1] = i, this.int16[p + 2] = n, this.int16[p + 3] = r, this.int16[p + 4] = o, this.float32[m + 3] = a, this.float32[m + 4] = s, this.float32[m + 5] = l, this.float32[m + 6] = c, this.int16[p + 14] = u, this.uint32[m + 8] = h, this.uint16[p + 18] = d, this.uint16[p + 19] = f, e1; 8522 } 8523 } 8524 au.prototype.bytesPerElement = 40, Xa(au, "StructArrayLayout5i4f1i1ul2ui40"); 8525 class su extends Nc { 8526 _refreshViews() { 8527 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); 8528 } 8529 emplaceBack(e1, t1, i, n, r, o, a) { 8530 const s = this.length; 8531 return this.resize(s + 1), this.emplace(s, e1, t1, i, n, r, o, a); 8532 } 8533 emplace(e1, t1, i, n, r, o, a, s) { 8534 const l = 8 * e1; 8535 return this.int16[l + 0] = t1, this.int16[l + 1] = i, this.int16[l + 2] = n, this.int16[l + 4] = r, this.int16[l + 5] = o, this.int16[l + 6] = a, this.int16[l + 7] = s, e1; 8536 } 8537 } 8538 su.prototype.bytesPerElement = 16, Xa(su, "StructArrayLayout3i2i2i16"); 8539 class lu extends Nc { 8540 _refreshViews() { 8541 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); 8542 } 8543 emplaceBack(e1, t1, i, n, r) { 8544 const o = this.length; 8545 return this.resize(o + 1), this.emplace(o, e1, t1, i, n, r); 8546 } 8547 emplace(e1, t1, i, n, r, o) { 8548 const a = 4 * e1, s = 8 * e1; 8549 return this.float32[a + 0] = t1, this.float32[a + 1] = i, this.float32[a + 2] = n, this.int16[s + 6] = r, this.int16[s + 7] = o, e1; 8550 } 8551 } 8552 lu.prototype.bytesPerElement = 16, Xa(lu, "StructArrayLayout2f1f2i16"); 8553 class cu extends Nc { 8554 _refreshViews() { 8555 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8556 } 8557 emplaceBack(e1, t1, i, n, r, o) { 8558 const a = this.length; 8559 return this.resize(a + 1), this.emplace(a, e1, t1, i, n, r, o); 8560 } 8561 emplace(e1, t1, i, n, r, o, a) { 8562 const s = 20 * e1, l = 5 * e1; 8563 return this.uint8[s + 0] = t1, this.uint8[s + 1] = i, this.float32[l + 1] = n, this.float32[l + 2] = r, this.float32[l + 3] = o, this.float32[l + 4] = a, e1; 8564 } 8565 } 8566 cu.prototype.bytesPerElement = 20, Xa(cu, "StructArrayLayout2ub4f20"); 8567 class uu extends Nc { 8568 _refreshViews() { 8569 this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16
vendor: 8,381 bytes, lines 8569-8695
8569= new Uint16Array(this.arrayBuffer); 8570 } 8571 emplaceBack(e1, t1, i) { 8572 const n = this.length; 8573 return this.resize(n + 1), this.emplace(n, e1, t1, i); 8574 } 8575 emplace(e1, t1, i, n) { 8576 const r = 3 * e1; 8577 return this.uint16[r + 0] = t1, this.uint16[r + 1] = i, this.uint16[r + 2] = n, e1; 8578 } 8579 } 8580 uu.prototype.bytesPerElement = 6, Xa(uu, "StructArrayLayout3ui6"); 8581 class hu extends Nc { 8582 _refreshViews() { 8583 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer); 8584 } 8585 emplaceBack(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g, y, x, v) { 8586 const b = this.length; 8587 return this.resize(b + 1), this.emplace(b, e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g, y, x, v); 8588 } 8589 emplace(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g, y, x, v, b) { 8590 const w = 30 * e1, A = 15 * e1, E = 60 * e1; 8591 return this.int16[w + 0] = t1, this.int16[w + 1] = i, this.int16[w + 2] = n, this.float32[A + 2] = r, this.float32[A + 3] = o, this.uint16[w + 8] = a, this.uint16[w + 9] = s, this.uint32[A + 5] = l, this.uint32[A + 6] = c, this.uint32[A + 7] = u, this.uint16[w + 16] = h, this.uint16[w + 17] = d, this.uint16[w + 18] = f, this.float32[A + 10] = p, this.float32[A + 11] = m, this.uint8[E + 48] = _, this.uint8[E + 49] = g, this.uint8[E + 50] = y, this.uint32[A + 13] = x, this.int16[w + 28] = v, this.uint8[E + 58] = b, e1; 8592 } 8593 } 8594 hu.prototype.bytesPerElement = 60, Xa(hu, "StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60"); 8595 class du extends Nc { 8596 _refreshViews() { 8597 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer); 8598 } 8599 emplaceBack(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g, y, x, v, b, w, A, E, I, M, T, S, z, R, P, D) { 8600 const F = this.length; 8601 return this.resize(F + 1), this.emplace(F, e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g, y, x, v, b, w, A, E, I, M, T, S, z, R, P, D); 8602 } 8603 emplace(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g, y, x, v, b, w, A, E, I, M, T, S, z, R, P, D, F) { 8604 const C = 20 * e1, L = 40 * e1, O = 80 * e1; 8605 return this.float32[C + 0] = t1, this.float32[C + 1] = i, this.int16[L + 4] = n, this.int16[L + 5] = r, this.int16[L + 6] = o, this.int16[L + 7] = a, this.int16[L + 8] = s, this.int16[L + 9] = l, this.int16[L + 10] = c, this.int16[L + 11] = u, this.int16[L + 12] = h, this.uint16[L + 13] = d, this.uint16[L + 14] = f, this.uint16[L + 15] = p, this.uint16[L + 16] = m, this.uint16[L + 17] = _, this.uint16[L + 18] = g, this.uint16[L + 19] = y, this.uint16[L + 20] = x, this.uint16[L + 21] = v, this.uint16[L + 22] = b, this.uint16[L + 23] = w, this.uint16[L + 24] = A, this.uint16[L + 25] = E, this.uint16[L + 26] = I, this.uint16[L + 27] = M, this.uint32[C + 14] = T, this.float32[C + 15] = S, this.float32[C + 16] = z, this.float32[C + 17] = R, this.float32[C + 18] = P, this.uint8[O + 76] = D, this.uint16[L + 39] = F, e1; 8606 } 8607 } 8608 du.prototype.bytesPerElement = 80, Xa(du, "StructArrayLayout2f9i15ui1ul4f1ub1ui80"); 8609 class fu extends Nc { 8610 _refreshViews() { 8611 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8612 } 8613 emplaceBack(e1, t1, i, n, r, o) { 8614 const a = this.length; 8615 return this.resize(a + 1), this.emplace(a, e1, t1, i, n, r, o); 8616 } 8617 emplace(e1, t1, i, n, r, o, a) { 8618 const s = 6 * e1; 8619 return this.float32[s + 0] = t1, this.float32[s + 1] = i, this.float32[s + 2] = n, this.float32[s + 3] = r, this.float32[s + 4] = o, this.float32[s + 5] = a, e1; 8620 } 8621 } 8622 fu.prototype.bytesPerElement = 24, Xa(fu, "StructArrayLayout6f24"); 8623 class pu extends Nc { 8624 _refreshViews() { 8625 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8626 } 8627 emplaceBack(e1, t1, i, n, r) { 8628 const o = this.length; 8629 return this.resize(o + 1), this.emplace(o, e1, t1, i, n, r); 8630 } 8631 emplace(e1, t1, i, n, r, o) { 8632 const a = 5 * e1; 8633 return this.float32[a + 0] = t1, this.float32[a + 1] = i, this.float32[a + 2] = n, this.float32[a + 3] = r, this.float32[a + 4] = o, e1; 8634 } 8635 } 8636 pu.prototype.bytesPerElement = 20, Xa(pu, "StructArrayLayout5f20"); 8637 class mu extends Nc { 8638 _refreshViews() { 8639 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8640 } 8641 emplaceBack(e1, t1, i, n, r, o, a) { 8642 const s = this.length; 8643 return this.resize(s + 1), this.emplace(s, e1, t1, i, n, r, o, a); 8644 } 8645 emplace(e1, t1, i, n, r, o, a, s) { 8646 const l = 7 * e1; 8647 return this.float32[l + 0] = t1, this.float32[l + 1] = i, this.float32[l + 2] = n, this.float32[l + 3] = r, this.float32[l + 4] = o, this.float32[l + 5] = a, this.float32[l + 6] = s, e1; 8648 } 8649 } 8650 mu.prototype.bytesPerElement = 28, Xa(mu, "StructArrayLayout7f28"); 8651 class _u extends Nc { 8652 _refreshViews() { 8653 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8654 } 8655 emplaceBack(e1, t1, i, n, r, o, a, s, l, c, u) { 8656 const h = this.length; 8657 return this.resize(h + 1), this.emplace(h, e1, t1, i, n, r, o, a, s, l, c, u); 8658 } 8659 emplace(e1, t1, i, n, r, o, a, s, l, c, u, h) { 8660 const d = 11 * e1; 8661 return this.float32[d + 0] = t1, this.float32[d + 1] = i, this.float32[d + 2] = n, this.float32[d + 3] = r, this.float32[d + 4] = o, this.float32[d + 5] = a, this.float32[d + 6] = s, this.float32[d + 7] = l, this.float32[d + 8] = c, this.float32[d + 9] = u, this.float32[d + 10] = h, e1; 8662 } 8663 } 8664 _u.prototype.bytesPerElement = 44, Xa(_u, "StructArrayLayout11f44"); 8665 class gu extends Nc { 8666 _refreshViews() { 8667 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8668 } 8669 emplaceBack(e1, t1, i, n, r, o, a, s, l) { 8670 const c = this.length; 8671 return this.resize(c + 1), this.emplace(c, e1, t1, i, n, r, o, a, s, l); 8672 } 8673 emplace(e1, t1, i, n, r, o, a, s, l, c) { 8674 const u = 9 * e1; 8675 return this.float32[u + 0] = t1, this.float32[u + 1] = i, this.float32[u + 2] = n, this.float32[u + 3] = r, this.float32[u + 4] = o, this.float32[u + 5] = a, this.float32[u + 6] = s, this.float32[u + 7] = l, this.float32[u + 8] = c, e1; 8676 } 8677 } 8678 gu.prototype.bytesPerElement = 36, Xa(gu, "StructArrayLayout9f36"); 8679 class yu extends Nc { 8680 _refreshViews() { 8681 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8682 } 8683 emplaceBack(e1, t1) { 8684 const i = this.length; 8685 return this.resize(i + 1), this.emplace(i, e1, t1); 8686 } 8687 emplace(e1, t1, i) { 8688 const n = 2 * e1; 8689 return this.float32[n + 0] = t1, this.float32[n + 1] = i, e1; 8690 } 8691 } 8692 yu.prototype.bytesPerElement = 8, Xa(yu, "StructArrayLayout2f8"); 8693 class xu extends Nc { 8694 _refreshViews() { 8695 this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16
8695= new Uint16Array(this.arrayBuffer); 8696 } 8697 emplaceBack(e1, t1, i, n) { 8698 const r = this.length; 8699 return this.resize(r + 1), this.emplace(r, e1, t1, i, n); 8700 } 8701 emplace(e1, t1, i, n, r) { 8702 const o = 6 * e1; 8703 return this.uint32[3 * e1 + 0] = t1, this.uint16[o + 2] = i, this.uint16[o + 3] = n, this.uint16[o + 4] = r, e1; 8704 } 8705 } 8706 xu.prototype.bytesPerElement = 12, Xa(xu, "StructArrayLayout1ul3ui12"); 8707 class vu extends Nc { 8708 _refreshViews() { 8709 this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); 8710 } 8711 emplaceBack(e1) { 8712 const t1 = this.length; 8713 return this.resize(t1 + 1), this.emplace(t1, e1); 8714 } 8715 emplace(e1, t1) { 8716 return this.uint16[1 * e1 + 0] = t1, e1; 8717 } 8718 } 8719 vu.prototype.bytesPerElement = 2, Xa(vu, "StructArrayLayout1ui2"); 8720 class bu extends Nc { 8721 _refreshViews() { 8722 this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8723 } 8724 emplaceBack(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m) { 8725 const _ = this.length; 8726 return this.resize(_ + 1), this.emplace(_, e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m); 8727 } 8728 emplace(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _) { 8729 const g = 16 * e1; 8730 return this.float32[g + 0] = t1, this.float32[g + 1] = i, this.float32[g + 2] = n, this.float32[g + 3] = r, this.float32[g + 4] = o, this.float32[g + 5] = a, this.float32[g + 6] = s, this.float32[g + 7] = l, this.float32[g + 8] = c, this.float32[g + 9] = u, this.float32[g + 10] = h, this.float32[g + 11] = d, this.float32[g + 12] = f, this.float32[g + 13] = p, this.float32[g + 14] = m, this.float32[g + 15] = _, e1; 8731 } 8732 } 8733 bu.prototype.bytesPerElement = 64, Xa(bu, "StructArrayLayout16f64"); 8734 class wu extends Nc { 8735 _refreshViews() { 8736 this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); 8737 } 8738 emplaceBack(e1, t1, i, n, r, o, a) { 8739 const s = this.length; 8740 return this.resize(s + 1), this.emplace(s, e1, t1, i, n, r, o, a); 8741 } 8742 emplace(e1, t1, i, n, r, o, a, s) { 8743 const l = 10 * e1, c = 5 * e1; 8744 return this.uint16[l + 0] = t1, this.uint16[l + 1] = i, this.uint16[l + 2] = n, this.uint16[l + 3] = r, this.float32[c + 2] = o, this.float32[c + 3] = a, this.float32[c + 4] = s, e1; 8745 } 8746 } 8747 wu.prototype.bytesPerElement = 20, Xa(wu, "StructArrayLayout4ui3f20"); 8748 class Au extends Nc { 8749 _refreshViews() { 8750 this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); 8751 } 8752 emplaceBack(e1) { 8753 const t1 = this.length; 8754 return this.resize(t1 + 1), this.emplace(t1, e1); 8755 } 8756 emplace(e1, t1) { 8757 return this.int16[1 * e1 + 0] = t1, e1; 8758 } 8759 } 8760 Au.prototype.bytesPerElement = 2, Xa(Au, "StructArrayLayout1i2"); 8761 class Eu extends Nc { 8762 _refreshViews() { 8763 this.uint8 = new Uint8Array(this.arrayBuffer); 8764 } 8765 emplaceBack(e1) { 8766 const t1 = this.length; 8767 return this.resize(t1 + 1), this.emplace(t1, e1); 8768 } 8769 emplace(e1, t1) { 8770 return this.uint8[1 * e1 + 0] = t1, e1; 8771 } 8772 } 8773 Eu.prototype.bytesPerElement = 1, Xa(Eu, "StructArrayLayout1ub1"); 8774 class Iu extends Bc { 8775 get projectedAnchorX() { 8776 return this._structArray.int16[this._pos2 + 0]; 8777 } 8778 get projectedAnchorY() { 8779 return this._structArray.int16[this._pos2 + 1]; 8780 } 8781 get projectedAnchorZ() { 8782 return this._structArray.int16[this._pos2 + 2]; 8783 } 8784 get tileAnchorX() { 8785 return this._structArray.int16[this._pos2 + 3]; 8786 } 8787 get tileAnchorY() { 8788 return this._structArray.int16[this._pos2 + 4]; 8789 } 8790 get x1() { 8791 return this._structArray.float32[this._pos4 + 3]; 8792 } 8793 get y1() { 8794 return this._structArray.float32[this._pos4 + 4]; 8795 } 8796 get x2() { 8797 return this._structArray.float32[this._pos4 + 5]; 8798 } 8799 get y2() { 8800 return this._structArray.float32[this._pos4 + 6]; 8801 } 8802 get padding() { 8803 return this._structArray.int16[this._pos2 + 14]; 8804 } 8805 get featureIndex() { 8806 return this._structArray.uint32[this._pos4 + 8]; 8807 } 8808 get sourceLayerIndex() { 8809 return this._structArray.uint16[this._pos2 + 18]; 8810 } 8811 get bucketIndex() { 8812 return this._structArray.uint16[this._pos2 + 19]; 8813 } 8814 } 8815 Iu.prototype.size = 40; 8816 class Mu extends au { 8817 get(e1) { 8818 return new Iu(this, e1); 8819 } 8820 } 8821 Xa(Mu, "CollisionBoxArray"); 8822 class Tu extends Bc { 8823 get projectedAnchorX() { 8824 return this._structArray.int16[this._pos2 + 0]; 8825 } 8826 get projectedAnchorY() { 8827 return this._structArray.int16[this._pos2 + 1]; 8828 } 8829 get projectedAnchorZ() { 8830 return this._structArray.int16[this._pos2 + 2]; 8831 } 8832 get tileAnchorX() { 8833 return this._structArray.float32[this._pos4 + 2]; 8834 } 8835 get tileAnchorY() { 8836 return this._structArray.float32[this._pos4 + 3]; 8837 } 8838 get glyphStartIndex() { 8839 return this._structArray.uint16[this._pos2 + 8]; 8840 } 8841 get numGlyphs() { 8842 return this._structArray.uint16[this._pos2 + 9]; 8843 } 8844 get vertexStartIndex() { 8845 return this._structArray.uint32[this._pos4 + 5]; 8846 } 8847 get lineStartIndex() { 8848 return this._structArray.uint32[this._pos4 + 6]; 8849 } 8850 get lineLength() { 8851 return this._structArray.uint32[this._pos4 + 7]; 8852 } 8853 get segment() { 8854 return this._structArray.uint16[this._pos2 + 16]; 8855 } 8856 get lowerSize() { 8857 return this._structArray.uint16[this._pos2 + 17]; 8858 } 8859 get upperSize() { 8860 return this._structArray.uint16[this._pos2 + 18]; 8861 } 8862 get lineOffsetX() { 8863 return this._structArray.float32[this._pos4 + 10]; 8864 } 8865 get lineOffsetY() { 8866 return this._structArray.float32[this._pos4 + 11]; 8867 } 8868 get writingMode() { 8869 return this._structArray.uint8[this._pos1 + 48]; 8870 } 8871 get placedOrientation() { 8872 return this._structArray.uint8[this._pos1 + 49]; 8873 } 8874 set placedOrientation(e1) {
8875 this._structArray.uint8[this._pos1 + 49] = e1; 8876 } 8877 get hidden() { 8878 return this._structArray.uint8[this._pos1 + 50]; 8879 } 8880 set hidden(e1) { 8881 this._structArray.uint8[this._pos1 + 50] = e1; 8882 } 8883 get crossTileID() { 8884 return this._structArray.uint32[this._pos4 + 13]; 8885 } 8886 set crossTileID(e1) { 8887 this._structArray.uint32[this._pos4 + 13] = e1; 8888 } 8889 get associatedIconIndex() { 8890 return this._structArray.int16[this._pos2 + 28]; 8891 } 8892 get flipState() { 8893 return this._structArray.uint8[this._pos1 + 58]; 8894 } 8895 set flipState(e1) { 8896 this._structArray.uint8[this._pos1 + 58] = e1; 8897 } 8898 } 8899 Tu.prototype.size = 60; 8900 class Su extends hu { 8901 get(e1) { 8902 return new Tu(this, e1); 8903 } 8904 } 8905 Xa(Su, "PlacedSymbolArray"); 8906 class zu extends Bc { 8907 get tileAnchorX() { 8908 return this._structArray.float32[this._pos4 + 0]; 8909 } 8910 get tileAnchorY() { 8911 return this._structArray.float32[this._pos4 + 1]; 8912 } 8913 get projectedAnchorX() { 8914 return this._structArray.int16[this._pos2 + 4]; 8915 } 8916 get projectedAnchorY() { 8917 return this._structArray.int16[this._pos2 + 5]; 8918 } 8919 get projectedAnchorZ() { 8920 return this._structArray.int16[this._pos2 + 6]; 8921 } 8922 get rightJustifiedTextSymbolIndex() { 8923 return this._structArray.int16[this._pos2 + 7]; 8924 } 8925 get centerJustifiedTextSymbolIndex() { 8926 return this._structArray.int16[this._pos2 + 8]; 8927 } 8928 get leftJustifiedTextSymbolIndex() { 8929 return this._structArray.int16[this._pos2 + 9]; 8930 } 8931 get verticalPlacedTextSymbolIndex() { 8932 return this._structArray.int16[this._pos2 + 10]; 8933 } 8934 get placedIconSymbolIndex() { 8935 return this._structArray.int16[this._pos2 + 11]; 8936 } 8937 get verticalPlacedIconSymbolIndex() { 8938 return this._structArray.int16[this._pos2 + 12]; 8939 } 8940 get key() { 8941 return this._structArray.uint16[this._pos2 + 13]; 8942 } 8943 get textBoxStartIndex() { 8944 return this._structArray.uint16[this._pos2 + 14]; 8945 } 8946 get textBoxEndIndex() { 8947 return this._structArray.uint16[this._pos2 + 15]; 8948 } 8949 get verticalTextBoxStartIndex() { 8950 return this._structArray.uint16[this._pos2 + 16]; 8951 } 8952 get verticalTextBoxEndIndex() { 8953 return this._structArray.uint16[this._pos2 + 17]; 8954 } 8955 get iconBoxStartIndex() { 8956 return this._structArray.uint16[this._pos2 + 18]; 8957 } 8958 get iconBoxEndIndex() { 8959 return this._structArray.uint16[this._pos2 + 19]; 8960 } 8961 get verticalIconBoxStartIndex() { 8962 return this._structArray.uint16[this._pos2 + 20]; 8963 } 8964 get verticalIconBoxEndIndex() { 8965 return this._structArray.uint16[this._pos2 + 21]; 8966 } 8967 get featureIndex() { 8968 return this._structArray.uint16[this._pos2 + 22]; 8969 } 8970 get numHorizontalGlyphVertices() { 8971 return this._structArray.uint16[this._pos2 + 23]; 8972 } 8973 get numVerticalGlyphVertices() { 8974 return this._structArray.uint16[this._pos2 + 24]; 8975 } 8976 get numIconVertices() { 8977 return this._structArray.uint16[this._pos2 + 25]; 8978 } 8979 get numVerticalIconVertices() { 8980 return this._structArray.uint16[this._pos2 + 26]; 8981 } 8982 get useRuntimeCollisionCircles() { 8983 return this._structArray.uint16[this._pos2 + 27]; 8984 } 8985 get crossTileID() { 8986 return this._structArray.uint32[this._pos4 + 14]; 8987 } 8988 set crossTileID(e1) { 8989 this._structArray.uint32[this._pos4 + 14] = e1; 8990 } 8991 get textOffset0() { 8992 return this._structArray.float32[this._pos4 + 15]; 8993 } 8994 get textOffset1() { 8995 return this._structArray.float32[this._pos4 + 16]; 8996 } 8997 get collisionCircleDiameter() { 8998 return this._structArray.float32[this._pos4 + 17]; 8999 } 9000 get zOffset() { 9001 return this._structArray.float32[this._pos4 + 18]; 9002 } 9003 set zOffset(e1) { 9004 this._structArray.float32[this._pos4 + 18] = e1; 9005 } 9006 get hasIconTextFit() { 9007 return this._structArray.uint8[this._pos1 + 76]; 9008 } 9009 get elevationFeatureIndex() { 9010 return this._structArray.uint16[this._pos2 + 39]; 9011 } 9012 } 9013 zu.prototype.size = 80; 9014 class Ru extends du { 9015 get(e1) { 9016 return new zu(this, e1); 9017 } 9018 } 9019 Xa(Ru, "SymbolInstanceArray"); 9020 class Pu extends $c { 9021 getoffsetX(e1) { 9022 return this.float32[1 * e1 + 0]; 9023 } 9024 } 9025 Xa(Pu, "GlyphOffsetArray"); 9026 class Du extends jc { 9027 getx(e1) { 9028 return this.int16[2 * e1 + 0]; 9029 } 9030 gety(e1) { 9031 return this.int16[2 * e1 + 1]; 9032 } 9033 } 9034 Xa(Du, "SymbolLineVertexArray"); 9035 class Fu extends Bc { 9036 get featureIndex() { 9037 return this._structArray.uint32[this._pos4 + 0]; 9038 } 9039 get sourceLayerIndex() { 9040 return this._structArray.uint16[this._pos2 + 2]; 9041 } 9042 get bucketIndex() { 9043 return this._structArray.uint16[this._pos2 + 3]; 9044 } 9045 get layoutVertexArrayOffset() { 9046 return this._structArray.uint16[this._pos2 + 4]; 9047 } 9048 } 9049 Fu.prototype.size = 12; 9050 class Cu extends xu { 9051 get(e1) { 9052 return new Fu(this, e1); 9053 } 9054 } 9055 Xa(Cu, "FeatureIndexArray"); 9056 class Lu extends ou { 9057 geta_centroid_pos0(e1) { 9058 return this.uint16[2 * e1 + 0]; 9059 } 9060 geta_centroid_pos1(e1) { 9061 return this.uint16[2 * e1 + 1]; 9062 } 9063 } 9064 Xa(Lu, "FillExtrusionCentroidArray"); 9065 class Ou extends Bc { 9066 get a_join_normal_inside0() { 9067 return this._structArray.int16[this._pos2 + 0]; 9068 } 9069 get a_join_normal_inside1() { 9070 return this._structArray.int16[this._pos2 + 1]; 9071 } 9072 get a_join_normal_inside2() { 9073 return this._structArray.int16[this._pos2 + 2]; 9074 } 9075 } 9076 Ou.prototype.size = 6; 9077 class Bu extends Gc { 9078 get(e1) { 9079 return new Ou(this, e1); 9080 } 9081 } 9082 Xa(Bu, "FillExtrusionWallArray"); 9083 const Vu = kc([ 9084 { 9085 name: "a_pos", 9086 components: 2, 9087 type: "Int16" 9088 } 9089 ], 4), Nu = kc([ 9090 { 9091 name: "a_road_z_offset", 9092 components: 1, 9093 type: "Float32" 9094 } 9095 ], 4), ku = kc([ 9096 { 9097 name: "a_pos", 9098 components: 2, 9099 type: "Int16" 9100 }, 9101 { 9102 name: "a_height", 9103 components: 1, 9104 type: "Float32" 9105 } 9106 ], 4), Uu = kc([ 9107 { 9108 name: "a_pos_normal_3", 9109 components: 3, 9110 type: "Int16" 9111 } 9112 ], 4); 9113 class ju { 9114 _prepareSegment(e1, t1, i, n, r) { 9115 let o = this.segments.at(-1); 9116 return e1 > ju.MAX_VERTEX_ARRAY_LENGTH && gt("Max vertices per segment is ".concat(ju.MAX_VERTEX_ARRAY_LENGTH, ": bucket requested ").concat(e1)), (!o || o.vertexLength + e1 > ju.MAX_VERTEX_ARRAY_LENGTH || o.sortKey !== n || void 0 !== r && o && void 0 !== o.batchIndex && o.batchIndex !== r) && (o = { 9117 vertexOffset: t1, 9118 primitiveOffset: i, 9119 vertexLength: 0, 9120 primitiveLength: 0 9121 }, void 0 !== n && (o.sortKey = n), void 0 !== r && (o.batchIndex = r), this.segments.push(o)), o; 9122 } 9123 prepareSegment(e1, t1, i, n, r) { 9124 return this._prepareSegment(e1, t1.length, i.length, n, r); 9125 } 9126 get() { 9127 return this.segments; 9128 } 9129 destroy() { 9130 for (const e1 of this.segments)for(const t1 in e1.vaos)e1.vaos[t1].destroy(); 9131 } 9132 static simpleSegment(e1, t1, i, n) { 9133 return new ju([ 9134 { 9135 vertexOffset: e1, 9136 primitiveOffset: t1, 9137 vertexLength: i, 9138 primitiveLength: n, 9139 vaos: {}, 9140 sortKey: 0 9141 } 9142 ]); 9143 } 9144 constructor(e1 = []){ 9145 this.segments = e1; 9146 } 9147 } 9148 function Gu(e1, t1) { 9149 return 256 * (e1 = it(Math.floor(e1), 0, 255)) + it(Math.floor(t1), 0, 255); 9150 } 9151 ju.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, Xa(ju, "SegmentVector"); 9152 const Hu = kc([ 9153 { 9154 name: "a_pattern", 9155 components: 4, 9156 type: "Uint16" 9157 }, 9158 { 9159 name: "a_pixel_ratio", 9160 components: 1, 9161 type: "Float32" 9162 } 9163 ]), $u = kc([ 9164 { 9165 name: "a_pattern_b", 9166 components: 4, 9167 type: "Uint16" 9168 } 9169 ]), Zu = kc([ 9170 { 9171 name: "a_dash", 9172 components: 4, 9173 type: "Uint16" 9174 } 9175 ]); 9176 class Wu { 9177 add(e1, t1, i, n) {
vendor: 32,768 bytes, lines 9178-9875
9178 this.ids.push(qu(e1)), this.positions.push(t1, i, n); 9179 } 9180 eachPosition(e1, t1) { 9181 const i = qu(e1); 9182 let n = 0, r = this.ids.length - 1; 9183 for(; n < r;){ 9184 const e1 = n + r >> 1; 9185 this.ids[e1] >= i ? r = e1 : n = e1 + 1; 9186 } 9187 for(; this.ids[n] === i;)t1(this.positions[3 * n], this.positions[3 * n + 1], this.positions[3 * n + 2]), n++; 9188 } 9189 static serialize(e1, t1) { 9190 const i = new Float64Array(e1.ids), n = new Uint32Array(e1.positions); 9191 return Xu(i, n, 0, i.length - 1), t1 && (t1.add(i.buffer), t1.add(n.buffer)), { 9192 ids: i, 9193 positions: n 9194 }; 9195 } 9196 static deserialize(e1) { 9197 const t1 = new Wu; 9198 let i; 9199 t1.ids = e1.ids, t1.positions = e1.positions; 9200 for (const e1 of t1.ids)e1 !== i && t1.uniqueIds.push(e1), i = e1; 9201 return t1.indexed = !0, t1; 9202 } 9203 constructor(){ 9204 this.ids = [], this.uniqueIds = [], this.positions = [], this.indexed = !1; 9205 } 9206 } 9207 function qu(e1) { 9208 const t1 = +e1; 9209 return Number.isSafeInteger(t1) ? t1 : nn(String(e1)); 9210 } 9211 function Xu(e1, t1, i, n) { 9212 for(; i < n;){ 9213 const r = e1[i + n >> 1]; 9214 let o = i - 1, a = n + 1; 9215 for(;;){ 9216 do { 9217 o++; 9218 }while (e1[o] < r) 9219 do { 9220 a--; 9221 }while (e1[a] > r) 9222 if (o >= a) break; 9223 Yu(e1, o, a), Yu(t1, 3 * o, 3 * a), Yu(t1, 3 * o + 1, 3 * a + 1), Yu(t1, 3 * o + 2, 3 * a + 2); 9224 } 9225 a - i < n - a ? (Xu(e1, t1, i, a), i = a + 1) : (Xu(e1, t1, a + 1, n), n = a); 9226 } 9227 } 9228 function Yu(e1, t1, i) { 9229 const n = e1[t1]; 9230 e1[t1] = e1[i], e1[i] = n; 9231 } 9232 Xa(Wu, "FeaturePositionMap"); 9233 class Ju { 9234 fetchUniformLocation(e1, t1) { 9235 return this.location || this.initialized || (this.location = this.gl.getUniformLocation(e1, t1), this.initialized = !0), !!this.location; 9236 } 9237 set(e1, t1, i) { 9238 throw new Error("Uniform#set() must be implemented by each concrete Uniform"); 9239 } 9240 constructor(e1){ 9241 this.gl = e1.gl, this.initialized = !1; 9242 } 9243 } 9244 class Ku extends Ju { 9245 set(e1, t1, i) { 9246 this.fetchUniformLocation(e1, t1) && this.current !== i && (this.current = i, this.gl.uniform1i(this.location, i)); 9247 } 9248 constructor(e1){ 9249 super(e1), this.current = 0; 9250 } 9251 } 9252 class Qu extends Ju { 9253 set(e1, t1, i) { 9254 this.fetchUniformLocation(e1, t1) && this.current !== i && (this.current = i, this.gl.uniform1f(this.location, i)); 9255 } 9256 constructor(e1){ 9257 super(e1), this.current = 0; 9258 } 9259 } 9260 class eh extends Ju { 9261 set(e1, t1, i) { 9262 this.fetchUniformLocation(e1, t1) && (i[0] === this.current[0] && i[1] === this.current[1] || (this.current = i, this.gl.uniform2f(this.location, i[0], i[1]))); 9263 } 9264 constructor(e1){ 9265 super(e1), this.current = [ 9266 0, 9267 0 9268 ]; 9269 } 9270 } 9271 class th extends Ju { 9272 set(e1, t1, i) { 9273 this.fetchUniformLocation(e1, t1) && (i[0] === this.current[0] && i[1] === this.current[1] && i[2] === this.current[2] || (this.current = i, this.gl.uniform3f(this.location, i[0], i[1], i[2]))); 9274 } 9275 constructor(e1){ 9276 super(e1), this.current = [ 9277 0, 9278 0, 9279 0 9280 ]; 9281 } 9282 } 9283 class ih extends Ju { 9284 set(e1, t1, i) { 9285 this.fetchUniformLocation(e1, t1) && (i[0] === this.current[0] && i[1] === this.current[1] && i[2] === this.current[2] && i[3] === this.current[3] || (this.current = i, this.gl.uniform4ui(this.location, i[0], i[1], i[2], i[3]))); 9286 } 9287 constructor(e1){ 9288 super(e1), this.current = [ 9289 0, 9290 0, 9291 0, 9292 0 9293 ]; 9294 } 9295 } 9296 class nh extends Ju { 9297 set(e1, t1, i) { 9298 this.fetchUniformLocation(e1, t1) && (i[0] === this.current[0] && i[1] === this.current[1] && i[2] === this.current[2] && i[3] === this.current[3] || (this.current = i, this.gl.uniform4f(this.location, i[0], i[1], i[2], i[3]))); 9299 } 9300 constructor(e1){ 9301 super(e1), this.current = [ 9302 0, 9303 0, 9304 0, 9305 0 9306 ]; 9307 } 9308 } 9309 class rh extends Ju { 9310 set(e1, t1, i) { 9311 this.fetchUniformLocation(e1, t1) && (i.r === this.current.r && i.g === this.current.g && i.b === this.current.b && i.a === this.current.a || (this.current = i, this.gl.uniform4f(this.location, i.r, i.g, i.b, i.a))); 9312 } 9313 constructor(e1){ 9314 super(e1), this.current = mn.transparent.toPremultipliedRenderColor(null); 9315 } 9316 } 9317 class oh extends Ju { 9318 set(e1, t1, i) { 9319 if (!this.fetchUniformLocation(e1, t1)) return; 9320 const n = this.current; 9321 if (i[12] !== n[12] || i[0] !== n[0]) return n.set(i), void this.gl.uniformMatrix4fv(this.location, !1, n); 9322 for(let e1 = 1; e1 < 16; e1++)if (i[e1] !== n[e1]) { 9323 n.set(i), this.gl.uniformMatrix4fv(this.location, !1, n); 9324 break; 9325 } 9326 } 9327 constructor(e1){ 9328 super(e1), this.current = new Float32Array(16); 9329 } 9330 } 9331 class ah extends Ju { 9332 set(e1, t1, i) { 9333 if (!this.fetchUniformLocation(e1, t1)) return; 9334 const n = this.current; 9335 for(let e1 = 0; e1 < 4; e1++)if (i[e1] !== n[e1]) { 9336 n.set(i), this.gl.uniformMatrix2fv(this.location, !1, n); 9337 break; 9338 } 9339 } 9340 constructor(e1){ 9341 super(e1), this.current = new Float32Array(4); 9342 } 9343 } 9344 function sh(e1) { 9345 return [ 9346 Gu(255 * e1.r, 255 * e1.g), 9347 Gu(255 * e1.b, 255 * e1.a) 9348 ]; 9349 } 9350 function lh(e1, t1, i, n, r, o, a, s) { 9351 return !!e1 && ("composite" === e1.kind || "source" === e1.kind ? "none" === e1.evaluate(new $s(0, { 9352 brightness: o, 9353 worldview: s 9354 }), t1, i, r, n, a) : "none" === e1.value); 9355 } 9356 class ch { 9357 setUniform(e1, t1, i, n, r) { 9358 const o = n.constantOr(this.value); 9359 t1.set(e1, r, o instanceof mn ? o.toPremultipliedRenderColor(this.lutExpression && "constant" === this.lutExpression.kind && "none" === this.lutExpression.value ? null : this.context.lut) : o); 9360 } 9361 getBinding(e1, t1) { 9362 return "color" === this.type ? new rh(e1) : new Qu(e1); 9363 } 9364 constructor(e1, t1, i, n){ 9365 this.value = e1, this.uniformNames = t1.map((e1)=>"u_".concat(e1)), this.type = i, this.context = n; 9366 } 9367 } 9368 class uh { 9369 setConstantPatternPositions(e1, t1) { 9370 this.pixelRatio = e1.pixelRatio || 1, this.pattern = e1.tl.concat(e1.br), this.patternTransition = t1 ? t1.tl.concat(t1.br) : this.pattern; 9371 } 9372 setUniform(e1, t1, i, n, r) { 9373 let o = null; 9374 "u_pattern" !== r && "u_dash" !== r || (o = this.pattern), "u_pattern_b" === r && (o = this.patternTransition), "u_pixel_ratio" === r && (o = this.pixelRatio), o && t1.set(e1, r, o); 9375 } 9376 getBinding(e1, t1) { 9377 return "u_pattern" === t1 || "u_pattern_b" === t1 || "u_dash" === t1 ? new ih(e1) : new Qu(e1); 9378 } 9379 constructor(e1, t1){ 9380 this.uniformNames = t1.map((e1)=>"u_".concat(e1)), this.pattern = null, this.patternTransition = null, this.pixelRatio = 1; 9381 } 9382 } 9383 class hh { 9384 populatePaintArray(e1, t1, i, n, r, o, a, s) { 9385 const l = this.paintVertexArray.length, c = "composite" === this.expression.kind || "source" === this.expression.kind ? this.expression.evaluate(new $s(0, { 9386 brightness: o, 9387 worldview: s 9388 }), t1, {}, r, n, a) : "constant" === this.expression.kind && this.expression.value, u = lh(this.lutExpression, t1, {}, n, r, o, a, s); 9389 this.paintVertexArray.resize(e1), this._setPaintValue(l, e1, c, u ? null : this.context.lut); 9390 } 9391 updatePaintArray(e1, t1, i, n, r, o, a, s) { 9392 const l = "composite" === this.expression.kind || "source" === this.expression.kind ? this.expression.evaluate({ 9393 zoom: 0, 9394 brightness: a, 9395 worldview: s 9396 }, i, n, void 0, r) : "constant" === this.expression.kind && this.expression.value, c = lh(this.lutExpression, i, n, r, void 0, a, void 0, s); 9397 this._setPaintValue(e1, t1, l, c ? null : this.context.lut); 9398 } 9399 _setPaintValue(e1, t1, i, n) { 9400 if ("color" === this.type) { 9401 const r = sh(i.toPremultipliedRenderColor(n)); 9402 for(let i = e1; i < t1; i++)this.paintVertexArray.emplace(i, r[0], r[1]); 9403 } else { 9404 for(let n = e1; n < t1; n++)this.paintVertexArray.emplace(n, i); 9405 this.maxValue = Math.max(this.maxValue, Math.abs(i)); 9406 } 9407 } 9408 upload(e1) { 9409 this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = e1.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.lutExpression && "constant" !== this.lutExpression.kind && (this.lutExpression.isStateDependent || !this.lutExpression.isLightConstant) || "constant" !== this.expression.kind && (this.expression.isStateDependent || !this.expression.isLightConstant))); 9410 } 9411 destroy() { 9412 this.paintVertexBuffer && this.paintVertexBuffer.destroy(); 9413 } 9414 constructor(e1, t1, i, n){ 9415 this.expression = e1, this.type = i, this.maxValue = 0, this.paintVertexAttributes = t1.map((e1)=>({ 9416 name: "a_".concat(e1), 9417 type: "Float32", 9418 components: "color" === i ? 2 : 1, 9419 offset: 0 9420 })), this.paintVertexArray = new n; 9421 } 9422 } 9423 class dh { 9424 populatePaintArray(e1, t1, i, n, r, o, a, s) { 9425 const l = this.expression.evaluate(new $s(this.context.zoom, { 9426 brightness: o, 9427 worldview: s 9428 }), t1, {}, r, n, a), c = this.expression.evaluate(new $s(this.context.zoom + 1, { 9429 brightness: o, 9430 worldview: s 9431 }), t1, {}, r, n, a), u = lh(this.lutExpression, t1, {}, n, r, o, a, s), h = this.paintVertexArray.length; 9432 this.paintVertexArray.resize(e1), this._setPaintValue(h, e1, l, c, u ? null : this.context.lut); 9433 } 9434 updatePaintArray(e1, t1, i, n, r, o, a, s) { 9435 const l = this.expression.evaluate({ 9436 zoom: this.context.zoom, 9437 brightness: a, 9438 worldview: s 9439 }, i, n, void 0, r), c = this.expression.evaluate({ 9440 zoom: this.context.zoom + 1, 9441 brightness: a, 9442 worldview: s 9443 }, i, n, void 0, r), u = lh(this.lutExpression, i, n, r, void 0, a, void 0, s); 9444 this._setPaintValue(e1, t1, l, c, u ? null : this.context.lut); 9445 } 9446 _setPaintValue(e1, t1, i, n, r) { 9447 if ("color" === this.type) { 9448 const o = sh(i.toPremultipliedRenderColor(r)), a = sh(n.toPremultipliedRenderColor(r)); 9449 for(let i = e1; i < t1; i++)this.paintVertexArray.emplace(i, o[0], o[1], a[0], a[1]); 9450 } else { 9451 for(let r = e1; r < t1; r++)this.paintVertexArray.emplace(r, i, n); 9452 this.maxValue = Math.max(this.maxValue, Math.abs(i), Math.abs(n)); 9453 } 9454 } 9455 upload(e1) { 9456 this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = e1.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent || !this.expression.isLightConstant)); 9457 } 9458 destroy() { 9459 this.paintVertexBuffer && this.paintVertexBuffer.destroy(); 9460 } 9461 setUniform(e1, t1, i, n, r) { 9462 const o = this.useIntegerZoom ? Math.floor(i.zoom) : i.zoom, a = it(this.expression.interpolationFactor(o, this.context.zoom, this.context.zoom + 1), 0, 1); 9463 t1.set(e1, r, a); 9464 } 9465 getBinding(e1, t1) { 9466 return new Qu(e1); 9467 } 9468 constructor(e1, t1, i, n, r, o){ 9469 this.expression = e1, this.uniformNames = t1.map((e1)=>"u_".concat(e1, "_t")), this.type = i, this.useIntegerZoom = n, this.context = r, this.maxValue = 0, this.paintVertexAttributes = t1.map((e1)=>({ 9470 name: "a_".concat(e1), 9471 type: "Float32", 9472 components: "color" === i ? 4 : 2, 9473 offset: 0 9474 })), this.paintVertexArray = new o; 9475 } 9476 } 9477 class fh { 9478 populatePaintArray(e1, t1, i, n) { 9479 const r = this.paintVertexArray.length; 9480 this.paintVertexArray.resize(e1), this._setPaintValues(r, e1, t1.patterns && t1.patterns[this.layerId], i); 9481 } 9482 updatePaintArray(e1, t1, i, n, r, o, a) { 9483 this._setPaintValues(e1, t1, i.patterns && i.patterns[this.layerId], o); 9484 } 9485 _setPaintValues(e1, t1, i, n) { 9486 if (!n || !i) return; 9487 const r = n[i[0]], o = n[i[1]]; 9488 if (r) { 9489 if (r) { 9490 const { tl: i, br: n, pixelRatio: o } = r; 9491 for(let r = e1; r < t1; r++)this.paintVertexArray.emplace(r, i[0], i[1], n[0], n[1], o); 9492 } 9493 if (o) { 9494 this.paintTransitionVertexArray.resize(this.paintVertexArray.length); 9495 const { tl: i, br: n } = o; 9496 for(let r = e1; r < t1; r++)this.paintTransitionVertexArray.emplace(r, i[0], i[1], n[0], n[1]); 9497 } 9498 } 9499 } 9500 upload(e1) { 9501 const t1 = this.expression.isStateDependent || !this.expression.isLightConstant; 9502 this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer = e1.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, t1)), this.paintTransitionVertexArray && this.paintTransitionVertexArray.length && (this.paintTransitionVertexBuffer = e1.createVertexBuffer(this.paintTransitionVertexArray, $u.members, t1)); 9503 } 9504 destroy() { 9505 this.paintVertexBuffer && this.paintVertexBuffer.destroy(), this.paintTransitionVertexBuffer && this.paintTransitionVertexBuffer.destroy(); 9506 } 9507 constructor(e1, t1, i, n, r){ 9508 this.expression = e1, this.layerId = r, this.paintVertexAttributes = ("array" === i ? Zu : Hu).members; 9509 for(let e1 = 0; e1 < t1.length; ++e1); 9510 this.paintVertexArray = new n, this.paintTransitionVertexArray = new Qc; 9511 } 9512 } 9513 class ph { 9514 updateExpressions(e1) { 9515 const t1 = e1; 9516 for(const e1 in this.binders){ 9517 const i = this.binders[e1]; 9518 if (i instanceof hh || i instanceof dh || i instanceof fh) { 9519 const n = t1.paint.get(e1); 9520 i.expression = n.value; 9521 } 9522 } 9523 } 9524 getMaxValue(e1) { 9525 const t1 = this.binders[e1]; 9526 return t1 instanceof hh || t1 instanceof dh ? t1.maxValue : 0; 9527 } 9528 populatePaintArrays(e1, t1, i, n, r, o, a, s) { 9529 for(const l in this.binders){ 9530 const c = this.binders[l]; 9531 c.context = this.context, (c instanceof hh || c instanceof dh || c instanceof fh) && c.populatePaintArray(e1, t1, i, n, r, o, a, s); 9532 } 9533 } 9534 setConstantPatternPositions(e1, t1) { 9535 for(const i in this.binders){ 9536 const n = this.binders[i]; 9537 n instanceof uh && n.setConstantPatternPositions(e1, t1); 9538 } 9539 } 9540 getPatternTransitionVertexBuffer(e1) { 9541 const t1 = this.binders[e1]; 9542 return t1 instanceof fh ? t1.paintTransitionVertexBuffer : null; 9543 } 9544 updatePaintArrays(e1, t1, i, n, r, o, a, s, l, c) { 9545 let u = !1; 9546 const h = Object.keys(e1), d = 0 !== h.length && !s, f = d ? h : t1.uniqueIds; 9547 this.context.lut = r.lut; 9548 for(const s in this.binders){ 9549 const h = this.binders[s]; 9550 if (h.context = this.context, (h instanceof hh || h instanceof dh || h instanceof fh) && h.expression && h.expression.kind && "constant" !== h.expression.kind && (!0 === h.expression.isStateDependent || !1 === h.expression.isLightConstant)) { 9551 const p = r.paint.get(s); 9552 h.expression = p.value; 9553 for (const i of f){ 9554 const r = e1[i.toString()]; 9555 t1.eachPosition(i, (e1, t1, i)=>{ 9556 const s = n.feature(e1); 9557 h.updatePaintArray(t1, i, s, r, o, a, l, c); 9558 }); 9559 } 9560 if (!d) for (const t1 of i.uniqueIds){ 9561 const r = e1[t1.toString()]; 9562 i.eachPosition(t1, (e1, t1, i)=>{ 9563 const s = n.feature(e1); 9564 h.updatePaintArray(t1, i, s, r, o, a, l, c); 9565 }); 9566 } 9567 u = !0; 9568 } 9569 } 9570 return u; 9571 } 9572 defines() { 9573 const e1 = []; 9574 for(const t1 in this.binders){ 9575 const i = this.binders[t1]; 9576 (i instanceof ch || i instanceof uh) && e1.push(...i.uniformNames.map((e1)=>"#define HAS_UNIFORM_".concat(e1))); 9577 } 9578 return e1; 9579 } 9580 getPaintVertexBuffers() { 9581 return this._buffers; 9582 } 9583 getUniforms(e1) { 9584 const t1 = []; 9585 for(const i in this.binders){ 9586 const n = this.binders[i]; 9587 if (n instanceof ch || n instanceof uh || n instanceof dh) for (const r of n.uniformNames)t1.push({ 9588 name: r, 9589 property: i, 9590 binding: n.getBinding(e1, r) 9591 }); 9592 } 9593 return t1; 9594 } 9595 setUniforms(e1, t1, i, n, r) { 9596 for (const { name: t1, property: o, binding: a } of i)this.binders[o].setUniform(e1, a, r, n.get(o), t1); 9597 } 9598 updatePaintBuffers() { 9599 this._buffers = []; 9600 for(const e1 in this.binders){ 9601 const t1 = this.binders[e1]; 9602 (t1 instanceof hh || t1 instanceof dh || t1 instanceof fh) && t1.paintVertexBuffer && this._buffers.push(t1.paintVertexBuffer), t1 instanceof fh && t1.paintTransitionVertexBuffer && this._buffers.push(t1.paintTransitionVertexBuffer); 9603 } 9604 } 9605 upload(e1) { 9606 for(const t1 in this.binders){ 9607 const i = this.binders[t1]; 9608 (i instanceof hh || i instanceof dh || i instanceof fh) && i.upload(e1); 9609 } 9610 this.updatePaintBuffers(); 9611 } 9612 destroy() { 9613 for(const e1 in this.binders){ 9614 const t1 = this.binders[e1]; 9615 (t1 instanceof hh || t1 instanceof dh || t1 instanceof fh) && t1.destroy(); 9616 } 9617 } 9618 constructor(e1, t1, i = ()=>!0){ 9619 this.binders = {}, this._buffers = [], this.context = t1; 9620 const n = [], r = e1; 9621 for(const o in e1.paint._values){ 9622 const a = r.paint.get(o); 9623 if (o.endsWith("-use-theme")) continue; 9624 if (!i(o)) continue; 9625 if (!(a instanceof Ks && Ta(a.property.specification))) continue; 9626 const s = gh(o, e1.type), l = a.value, c = a.property.specification.type, u = !!a.property.useIntegerZoom, h = "line-dasharray" === o || o.endsWith("pattern"), d = r.paint.get("".concat(o, "-use-theme")), f = "line-dasharray" === o && "constant" !== r.layout.get("line-cap").value.kind || d && "constant" !== d.value.kind; 9627 if ("constant" !== l.kind || f) if ("source" === l.kind || f || h) { 9628 const t1 = vh(o, c, "source"); 9629 this.binders[o] = h ? new fh(l, s, c, t1, e1.id) : new hh(l, s, c, t1), n.push("/a_".concat(o)); 9630 } else { 9631 const e1 = vh(o, c, "composite"); 9632 this.binders[o] = new dh(l, s, c, u, t1, e1), n.push("/z_".concat(o)); 9633 } 9634 else this.binders[o] = h ? new uh(l.value, s) : new ch(l.value, s, c, t1), n.push("/u_".concat(o)); 9635 d && (this.binders[o].lutExpression = d.value); 9636 } 9637 this.cacheKey = n.sort().join(""); 9638 } 9639 } 9640 class mh { 9641 populatePaintArrays(e1, t1, i, n, r, o, a, s, l) { 9642 for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e1, t1, n, r, o, a, s, l); 9643 void 0 !== t1.id ? this._featureMap.add(t1.id, i, this._bufferOffset, e1) : (this._featureMapWithoutIds.add(this._idlessCounter, i, this._bufferOffset, e1), this._idlessCounter += 1), this._bufferOffset = e1, this.needsUpload = !0; 9644 } 9645 updatePaintArrays(e1, t1, i, n, r, o, a, s) { 9646 for (const l of i)this.needsUpload = this.programConfigurations[l.id].updatePaintArrays(e1, this._featureMap, this._featureMapWithoutIds, t1, l, n, r, o, a || 0, s) || this.needsUpload; 9647 } 9648 get(e1) { 9649 return this.programConfigurations[e1]; 9650 } 9651 upload(e1) { 9652 if (this.needsUpload) { 9653 for(const t1 in this.programConfigurations)this.programConfigurations[t1].upload(e1); 9654 this.needsUpload = !1; 9655 } 9656 } 9657 destroy() { 9658 for(const e1 in this.programConfigurations)this.programConfigurations[e1].destroy(); 9659 } 9660 updateExpressions(e1) { 9661 const t1 = new Set; 9662 for (const i of e1){ 9663 const e1 = this.programConfigurations[i.id]; 9664 e1 && (e1.updateExpressions(i), t1.add(i.id)); 9665 } 9666 for(const e1 in this.programConfigurations)t1.has(e1) || delete this.programConfigurations[e1]; 9667 } 9668 constructor(e1, t1, i = ()=>!0){ 9669 this.programConfigurations = {}; 9670 for (const n of e1)this.programConfigurations[n.id] = new ph(n, t1, i); 9671 this.needsUpload = !1, this._featureMap = new Wu, this._featureMapWithoutIds = new Wu, this._bufferOffset = 0, this._idlessCounter = 0; 9672 } 9673 } 9674 const _h = { 9675 "text-opacity": [ 9676 "opacity" 9677 ], 9678 "icon-opacity": [ 9679 "opacity" 9680 ], 9681 "text-occlusion-opacity": [ 9682 "occlusion_opacity" 9683 ], 9684 "icon-occlusion-opacity": [ 9685 "occlusion_opacity" 9686 ], 9687 "text-color": [ 9688 "fill_color" 9689 ], 9690 "icon-color": [ 9691 "fill_color" 9692 ], 9693 "text-emissive-strength": [ 9694 "emissive_strength" 9695 ], 9696 "icon-emissive-strength": [ 9697 "emissive_strength" 9698 ], 9699 "text-halo-color": [ 9700 "halo_color" 9701 ], 9702 "icon-halo-color": [ 9703 "halo_color" 9704 ], 9705 "text-halo-blur": [ 9706 "halo_blur" 9707 ], 9708 "icon-halo-blur": [ 9709 "halo_blur" 9710 ], 9711 "text-halo-width": [ 9712 "halo_width" 9713 ], 9714 "icon-halo-width": [ 9715 "halo_width" 9716 ], 9717 "symbol-z-offset": [ 9718 "z_offset" 9719 ], 9720 "line-gap-width": [ 9721 "gapwidth" 9722 ], 9723 "line-pattern": [ 9724 "pattern", 9725 "pixel_ratio", 9726 "pattern_b" 9727 ], 9728 "fill-pattern": [ 9729 "pattern", 9730 "pixel_ratio", 9731 "pattern_b" 9732 ], 9733 "fill-extrusion-pattern": [ 9734 "pattern", 9735 "pixel_ratio", 9736 "pattern_b" 9737 ], 9738 "line-dasharray": [ 9739 "dash" 9740 ], 9741 "fill-bridge-guard-rail-color": [ 9742 "structure_color" 9743 ], 9744 "fill-tunnel-structure-color": [ 9745 "structure_color" 9746 ] 9747 }; 9748 function gh(e1, t1) { 9749 return _h[e1] || [ 9750 e1.replace("".concat(t1, "-"), "").replace(/-/g, "_") 9751 ]; 9752 } 9753 const yh = { 9754 "line-pattern": { 9755 source: Kc, 9756 composite: Kc 9757 }, 9758 "fill-pattern": { 9759 source: Kc, 9760 composite: Kc 9761 }, 9762 "fill-extrusion-pattern": { 9763 source: Kc, 9764 composite: Kc 9765 }, 9766 "line-dasharray": { 9767 source: Qc, 9768 composite: Qc 9769 } 9770 }, xh = { 9771 color: { 9772 source: yu, 9773 composite: nu 9774 }, 9775 number: { 9776 source: $c, 9777 composite: yu 9778 } 9779 }; 9780 function vh(e1, t1, i) { 9781 const n = yh[e1]; 9782 return n && n[i] || xh[t1][i]; 9783 } 9784 Xa(ch, "ConstantBinder"), Xa(uh, "PatternConstantBinder"), Xa(hh, "SourceExpressionBinder", { 9785 omit: [ 9786 "expression" 9787 ] 9788 }), Xa(fh, "PatternCompositeBinder", { 9789 omit: [ 9790 "expression" 9791 ] 9792 }), Xa(dh, "CompositeExpressionBinder", { 9793 omit: [ 9794 "expression" 9795 ] 9796 }), Xa(ph, "ProgramConfiguration", { 9797 omit: [ 9798 "_buffers" 9799 ] 9800 }), Xa(mh, "ProgramConfigurationSet"); 9801 class bh { 9802 update(e1, t1, i, n, r, o, a, s) { 9803 this.programConfigurations.updatePaintArrays(e1, t1, r, i, n, o, a, s); 9804 } 9805 isEmpty() { 9806 return 0 === this.layoutVertexArray.length; 9807 } 9808 needsUpload() { 9809 return this.programConfigurations.needsUpload; 9810 } 9811 upload(e1) { 9812 this.uploaded || (this.layoutVertexBuffer = e1.createVertexBuffer(this.layoutVertexArray, Vu.members), this.indexBuffer = e1.createIndexBuffer(this.indexArray), this.lineIndexBuffer = e1.createIndexBuffer(this.lineIndexArray)), this.programConfigurations.upload(e1), this.uploaded = !0; 9813 } 9814 destroy() { 9815 this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.lineIndexBuffer.destroy(), this.programConfigurations.destroy(), this.triangleSegments.destroy(), this.lineSegments.destroy()); 9816 } 9817 populatePaintArrays(e1, t1, i, n, r, o, a) { 9818 this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, e1, t1, i, n, r, o, void 0, a); 9819 } 9820 constructor(e1, t1, i){ 9821 this.layoutVertexArray = new jc, this.indexArray = new uu, this.lineIndexArray = new ou, this.triangleSegments = new ju, this.lineSegments = new ju, this.programConfigurations = new mh(e1, { 9822 zoom: t1, 9823 lut: i 9824 }), this.uploaded = !1; 9825 } 9826 } 9827 Xa(bh, "FillBufferData"); 9828 class wh { 9829 updateFootprints(e1, t1) {} 9830 updateAppearances(e1, t1, i, n) { 9831 return { 9832 hasLayoutChanges: !1, 9833 hasUboChanges: !1 9834 }; 9835 } 9836 populate(e1, t1, i, n) { 9837 this.hasPattern = oc("fill", this.layers, this.pixelRatio, t1); 9838 const r = this.layers[0].layout.get("fill-sort-key"), o = []; 9839 for (const { feature: a, id: s, index: l, sourceLayerIndex: c } of e1){ 9840 const e1 = this.layers[0]._featureFilter.needGeometry, u = Lc(a, e1); 9841 if (!this.layers[0]._featureFilter.filter(new $s(this.zoom, { 9842 worldview: this.worldview, 9843 activeFloors: t1.activeFloors 9844 }), u, i)) continue; 9845 const h = r ? r.evaluate(u, {}, i, t1.availableImages) : void 0, d = { 9846 id: s, 9847 properties: a.properties, 9848 type: a.type, 9849 sourceLayerIndex: c, 9850 index: l, 9851 geometry: e1 ? u.geometry : Cc(a, i, n), 9852 patterns: {}, 9853 sortKey: h 9854 }; 9855 o.push(d); 9856 } 9857 r && o.sort((e1, t1)=>e1.sortKey - t1.sortKey); 9858 for (const n of o){ 9859 const { geometry: r, index: o, sourceLayerIndex: a } = n; 9860 if (this.hasPattern) { 9861 const e1 = ac("fill", this.layers, n, this.zoom, this.pixelRatio, t1); 9862 this.patternFeatures.push(e1); 9863 } else this.addFeature(n, r, o, i, {}, t1.availableImages, t1.brightness, t1.elevationFeatures); 9864 t1.featureIndex.insert(e1[o].feature, r, o, a, this.index); 9865 } 9866 !this.hasPattern && this.hdExt && this.hdExt.buildFrcSegments(this); 9867 } 9868 update(e1, t1, i, n, r, o, a) { 9869 this.bufferData.update(e1, t1, i, n, r, o, a, this.worldview), this.hdExt && this.hdExt.update(e1, t1, i, n, r, o, a, this.worldview); 9870 } 9871 updateExpressions(e1) { 9872 this.bufferData.programConfigurations.updateExpressions(e1), this.hdExt && this.hdExt.updateExpressions(e1); 9873 } 9874 addFeatures(e1, t1, i, n, r, o) { 9875 for (const r of this.patternFeatures)this.add
9875Feature(r, r.geometry, r.index, t1, i, n, o, e1.elevationFeatures); 9876 this.hdExt && this.hdExt.buildFrcSegments(this); 9877 } 9878 isEmpty() { 9879 return this.bufferData.isEmpty() && (!this.hdExt || this.hdExt.isEmpty()); 9880 } 9881 uploadPending() { 9882 return !this.uploaded || this.bufferData.needsUpload() || null != this.hdExt && this.hdExt.needsUpload(); 9883 } 9884 upload(e1) { 9885 this.bufferData.upload(e1), this.hdExt && this.hdExt.upload(e1); 9886 } 9887 destroy() { 9888 this.bufferData.destroy(), this.hdExt && this.hdExt.destroy(); 9889 } 9890 addFeature(e1, t1, i, n, r) { 9891 let o = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : [], a = arguments.length > 6 ? arguments[6] : void 0, s = arguments.length > 7 ? arguments[7] : void 0; 9892 const l = this.hdExt ? this.hdExt.trackFeatureFrc(e1.properties) : null, c = this.bufferData.indexArray.length, u = Ne(t1, 500);
vendor: 65,881 bytes, lines 9893-11049
9893 null != this.hdExt && this.hdExt.handleFeature(e1, u, i, n, s, this) || this.addGeometry(u, this.bufferData), this.bufferData.populatePaintArrays(e1, i, r, o, n, a, this.worldview), this.hdExt && this.hdExt.populatePaintArrays(e1, i, r, o, n, a, this.worldview), this.hdExt && this.hdExt.recordFeatureRange(this, c, this.bufferData.indexArray.length, l); 9894 } 9895 addGeometry(e1, t1, i, n) { 9896 let r = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY, a = null; 9897 i && (a = i.elevationSampler.constantElevation(i.elevation, i.bias), null != a && (r = a, o = a)); 9898 const s = i ? t1 : null, l = (e1, t1, n)=>{ 9899 if (null != i) if (t1.push(e1), null != a) s.elevatedLayoutVertexArray.emplaceBack(a), n.push(a); 9900 else { 9901 const t1 = i.elevationSampler.pointElevation(e1, i.elevation, i.bias); 9902 s.elevatedLayoutVertexArray.emplaceBack(t1), n.push(t1), r = Math.min(r, t1), o = Math.max(o, t1); 9903 } 9904 }; 9905 for (const r of e1){ 9906 let e1 = 0; 9907 for (const t1 of r)e1 += t1.length; 9908 const o = t1.triangleSegments.prepareSegment(e1, t1.layoutVertexArray, t1.indexArray), a = o.vertexLength, s = [], c = [], u = [], h = [], d = [], f = t1.layoutVertexArray.length; 9909 for (const e1 of r){ 9910 if (0 === e1.length) continue; 9911 e1 !== r[0] && c.push(s.length / 2); 9912 const n = t1.lineSegments.prepareSegment(e1.length, t1.layoutVertexArray, t1.lineIndexArray), o = n.vertexLength; 9913 i && d.push(t1.layoutVertexArray.length - f), l(e1[0], u, h), t1.layoutVertexArray.emplaceBack(e1[0].x, e1[0].y), t1.lineIndexArray.emplaceBack(o + e1.length - 1, o), s.push(e1[0].x), s.push(e1[0].y); 9914 for(let i = 1; i < e1.length; i++)l(e1[i], u, h), t1.layoutVertexArray.emplaceBack(e1[i].x, e1[i].y), t1.lineIndexArray.emplaceBack(o + i - 1, o + i), s.push(e1[i].x), s.push(e1[i].y); 9915 n.vertexLength += e1.length, n.primitiveLength += e1.length; 9916 } 9917 const p = Dl(s, c); 9918 for(let e1 = 0; e1 < p.length; e1 += 3)t1.indexArray.emplaceBack(a + p[e1], a + p[e1 + 1], a + p[e1 + 2]); 9919 if (p.length > 0 && i && n) { 9920 const e1 = i.elevation.isTunnel(), t1 = i.elevation.safeArea, r = n.addVertices(u, h); 9921 n.addTriangles(p, r, e1); 9922 const o = d.length; 9923 if (o > 0) { 9924 for(let a = 0; a < o - 1; a++)n.addRenderableRing(i.index, d[a] + r, d[a + 1] - d[a], e1, t1, i.featureInfo); 9925 n.addRenderableRing(i.index, d[o - 1] + r, u.length - d[o - 1], e1, t1, i.featureInfo); 9926 } 9927 } 9928 o.vertexLength += e1, o.primitiveLength += p.length / 3; 9929 } 9930 return [ 9931 r, 9932 o 9933 ]; 9934 } 9935 constructor(e1){ 9936 this.zoom = e1.zoom, this.pixelRatio = e1.pixelRatio, this.overscaling = e1.overscaling, this.layers = e1.layers, this.layerIds = this.layers.map((e1)=>e1.fqid), this.index = e1.index, this.hasPattern = !1, this.patternFeatures = [], this.lut = e1.lut, this.bufferData = new bh(e1.layers, e1.zoom, e1.lut), this.stateDependentLayerIds = this.layers.filter((e1)=>e1.isStateDependent()).map((e1)=>e1.id), this.projection = e1.projection, this.sourceLayerIndex = e1.sourceLayerIndex, this.sourceLayerName = e1.sourceLayerName || "", this.worldview = e1.worldview, this.hasAppearances = null; 9937 } 9938 } 9939 Xa(wh, "FillBucket", { 9940 omit: [ 9941 "layers", 9942 "patternFeatures" 9943 ] 9944 }); 9945 const Ah = kc([ 9946 { 9947 name: "a_pos_normal", 9948 components: 2, 9949 type: "Int16" 9950 }, 9951 { 9952 name: "a_data", 9953 components: 4, 9954 type: "Uint8" 9955 }, 9956 { 9957 name: "a_linesofar", 9958 components: 1, 9959 type: "Float32" 9960 } 9961 ], 4), Eh = kc([ 9962 { 9963 name: "a_z_offset_width", 9964 components: 4, 9965 type: "Float32" 9966 } 9967 ], 4), Ih = kc([ 9968 { 9969 name: "a_elevation_id_col", 9970 components: 3, 9971 type: "Float32" 9972 } 9973 ], 4), Mh = kc([ 9974 { 9975 name: "a_elevation_ground_scale", 9976 components: 1, 9977 type: "Float32" 9978 } 9979 ], 4), { members: Th } = Ah, Sh = kc([ 9980 { 9981 name: "a_packed", 9982 components: 3, 9983 type: "Float32" 9984 } 9985 ]), { members: zh } = Sh, Rh = kc([ 9986 { 9987 name: "a_pattern_data", 9988 components: 3, 9989 type: "Float32" 9990 } 9991 ]), { members: Ph } = Rh; 9992 class Dh { 9993 loadGeometry() { 9994 if (this._geometry < 0) throw new Error("feature has no geometry"); 9995 const e1 = this._pbf; 9996 e1.pos = this._geometry; 9997 const t1 = e1.readVarint() + e1.pos, i = []; 9998 let n, r = 1, o = 0, a = 0, s = 0; 9999 for(; e1.pos < t1;){ 10000 if (o <= 0) { 10001 const t1 = e1.readVarint(); 10002 if (r = 7 & t1, o = t1 >> 3, 0 === o) continue; 10003 } 10004 if (o--, 1 === r) a += e1.readSVarint(), s += e1.readSVarint(), n && i.push(n), n = [ 10005 new Pe(a, s) 10006 ]; 10007 else if (2 === r) a += e1.readSVarint(), s += e1.readSVarint(), n && n.push(new Pe(a, s)); 10008 else { 10009 if (7 !== r) throw new Error("unknown command ".concat(r)); 10010 n && n.push(n[0].clone()); 10011 } 10012 } 10013 return n && i.push(n), i; 10014 } 10015 bbox() { 10016 if (this._geometry < 0) throw new Error("feature has no geometry"); 10017 const e1 = this._pbf; 10018 e1.pos = this._geometry; 10019 const t1 = e1.readVarint() + e1.pos; 10020 let i = 1, n = 0, r = 0, o = 0, a = 1 / 0, s = -1 / 0, l = 1 / 0, c = -1 / 0; 10021 for(; e1.pos < t1;){ 10022 if (n <= 0) { 10023 const t1 = e1.readVarint(); 10024 if (i = 7 & t1, n = t1 >> 3, 0 === n) continue; 10025 } 10026 if (n--, 1 === i || 2 === i) r += e1.readSVarint(), o += e1.readSVarint(), r < a && (a = r), r > s && (s = r), o < l && (l = o), o > c && (c = o); 10027 else if (7 !== i) throw new Error("unknown command ".concat(i)); 10028 } 10029 return [ 10030 a, 10031 l, 10032 s, 10033 c 10034 ]; 10035 } 10036 toGeoJSON(e1, t1, i) { 10037 const n = this.extent * Math.pow(2, i), r = this.extent * e1, o = this.extent * t1, a = this.loadGeometry(); 10038 function s(e1) { 10039 return [ 10040 360 * (e1.x + r) / n - 180, 10041 360 / Math.PI * Math.atan(Math.exp((1 - 2 * (e1.y + o) / n) * Math.PI)) - 90 10042 ]; 10043 } 10044 function l(e1) { 10045 return e1.map(s); 10046 } 10047 let c; 10048 if (1 === this.type) { 10049 const e1 = []; 10050 for (const t1 of a)e1.push(t1[0]); 10051 const t1 = l(e1); 10052 c = 1 === e1.length ? { 10053 type: "Point", 10054 coordinates: t1[0] 10055 } : { 10056 type: "MultiPoint", 10057 coordinates: t1 10058 }; 10059 } else if (2 === this.type) { 10060 const e1 = a.map(l); 10061 c = 1 === e1.length ? { 10062 type: "LineString", 10063 coordinates: e1[0] 10064 } : { 10065 type: "MultiLineString", 10066 coordinates: e1 10067 }; 10068 } else { 10069 if (3 !== this.type) throw new Error("unknown feature type"); 10070 { 10071 const e1 = function(e1) { 10072 const t1 = e1.length; 10073 if (t1 <= 1) return [ 10074 e1 10075 ]; 10076 const i = []; 10077 let n, r; 10078 for(let o = 0; o < t1; o++){ 10079 const t1 = Fh(e1[o]); 10080 0 !== t1 && (void 0 === r && (r = t1 < 0), r === t1 < 0 ? (n && i.push(n), n = [ 10081 e1[o] 10082 ]) : n && n.push(e1[o])); 10083 } 10084 return n && i.push(n), i; 10085 }(a), t1 = []; 10086 for (const i of e1)t1.push(i.map(l)); 10087 c = 1 === t1.length ? { 10088 type: "Polygon", 10089 coordinates: t1[0] 10090 } : { 10091 type: "MultiPolygon", 10092 coordinates: t1 10093 }; 10094 } 10095 } 10096 const u = { 10097 type: "Feature", 10098 geometry: c, 10099 properties: this.properties 10100 }; 10101 return null != this.id && (u.id = this.id), u; 10102 } 10103 constructor(e1, t1, i, n, r){ 10104 for(this.properties = Object.create(null), this.extent = i, this.type = 0, this.id = void 0, this._pbf = e1, this._geometry = -1, this._keys = n, this._values = r; e1.pos < t1;){ 10105 const t1 = e1.readVarint(); 10106 if (8 === t1) this.id = e1.readVarint(); 10107 else if (18 === t1) { 10108 const t1 = e1.readVarint() + e1.pos; 10109 for(; e1.pos < t1;){ 10110 const t1 = n[e1.readVarint()], i = r[e1.readVarint()]; 10111 this.properties[t1] = i; 10112 } 10113 } else 24 === t1 ? this.type = e1.readVarint() : 34 === t1 ? (this._geometry = e1.pos, e1.skip(t1)) : e1.skip(t1); 10114 } 10115 } 10116 } 10117 function Fh(e1) { 10118 let t1 = 0; 10119 for(let i, n, r = 0, o = e1.length, a = o - 1; r < o; a = r++)i = e1[r], n = e1[a], t1 += (n.x - i.x) * (i.y + n.y); 10120 return t1; 10121 } 10122 Dh.types = [ 10123 "Unknown", 10124 "Point", 10125 "LineString", 10126 "Polygon" 10127 ]; 10128 class Ch { 10129 feature(e1) { 10130 if (e1 < 0 || e1 >= this._features.length) throw new Error("feature index out of bounds"); 10131 this._pbf.pos = this._features[e1]; 10132 const t1 = this._pbf.readVarint() + this._pbf.pos; 10133 return new Dh(this._pbf, t1, this.extent, this._keys, this._values); 10134 } 10135 constructor(e1, t1){ 10136 for(this.version = 1, this.name = "", this.extent = 4096, this.length = 0, this._pbf = e1, this._keys = [], this._values = [], this._features = [], void 0 === t1 && (t1 = e1.length); e1.pos < t1;){ 10137 const t1 = e1.readVarint(); 10138 10 === t1 ? this.name = e1.readString() : 18 === t1 ? (this._features.push(e1.pos), e1.skip(t1)) : 26 === t1 ? this._keys.push(e1.readString()) : 34 === t1 ? this._values.push(Lh(e1)) : 40 === t1 ? this.extent = e1.readVarint() : 120 === t1 ? this.version = e1.readVarint() : e1.skip(t1); 10139 } 10140 this.length = this._features.length; 10141 } 10142 } 10143 function Lh(e1) { 10144 let t1 = null; 10145 const i = e1.readVarint() + e1.pos; 10146 for(; e1.pos < i;){ 10147 const i = e1.readVarint(); 10148 t1 = 10 === i ? e1.readString() : 21 === i ? e1.readFloat() : 25 === i ? e1.readDouble() : 32 === i ? e1.readVarint(!0) : 40 === i ? e1.readVarint() : 48 === i ? e1.readSVarint() : 56 === i ? e1.readBoolean() : (e1.skip(i), null); 10149 } 10150 if (null == t1) throw new Error("unknown feature value"); 10151 return t1; 10152 } 10153 class Oh { 10154 constructor(e1, t1 = e1.length){ 10155 const i = Object.create(null); 10156 for(; e1.pos < t1;){ 10157 const t1 = e1.readVarint(); 10158 if (26 === t1) { 10159 const t1 = new Ch(e1, e1.readVarint() + e1.pos); 10160 t1.length && (i[t1.name] = t1); 10161 } else e1.skip(t1); 10162 } 10163 this.layers = i; 10164 } 10165 } 10166 function Bh(e1, t1) { 10167 for(let i = 0; i < e1.length; i++)if (qh(t1, e1[i])) return !0; 10168 for(let i = 0; i < t1.length; i++)if (qh(e1, t1[i])) return !0; 10169 return !!Uh(e1, t1); 10170 } 10171 function Vh(e1, t1, i) { 10172 return !!qh(e1, t1) || !!$h(t1, e1, i); 10173 } 10174 function Nh(e1, t1) { 10175 if (1 === e1.length) return Wh(t1, e1[0]); 10176 for(let i = 0; i < t1.length; i++){ 10177 const n = t1[i]; 10178 for(let t1 = 0; t1 < n.length; t1++)if (qh(e1, n[t1])) return !0; 10179 } 10180 for(let i = 0; i < e1.length; i++)if (Wh(t1, e1[i])) return !0; 10181 for(let i = 0; i < t1.length; i++)if (Uh(e1, t1[i])) return !0; 10182 return !1; 10183 } 10184 function kh(e1, t1, i) { 10185 if (e1.length > 1) { 10186 if (Uh(e1, t1)) return !0; 10187 for(let n = 0; n < t1.length; n++)if ($h(t1[n], e1, i)) return !0; 10188 } 10189 for(let n = 0; n < e1.length; n++)if ($h(e1[n], t1, i)) return !0; 10190 return !1; 10191 } 10192 function Uh(e1, t1) { 10193 if (0 === e1.length || 0 === t1.length) return !1; 10194 for(let i = 0; i < e1.length - 1; i++){ 10195 const n = e1[i], r = e1[i + 1]; 10196 for(let e1 = 0; e1 < t1.length - 1; e1++)if (jh(n, r, t1[e1], t1[e1 + 1])) return !0; 10197 } 10198 return !1; 10199 } 10200 function jh(e1, t1, i, n) { 10201 return yt(e1, i, n) !== yt(t1, i, n) && yt(e1, t1, i) !== yt(e1, t1, n); 10202 } 10203 function Gh(e1, t1, i) { 10204 return (e1.x - i.x) * (t1.y - i.y) - (e1.y - i.y) * (t1.x - i.x); 10205 } 10206 function Hh(e1, t1, i, n) { 10207 const r = Gh(e1, t1, n), o = Gh(e1, t1, i); 10208 if (Math.sign(r) === Math.sign(o)) return; 10209 const a = Gh(i, n, e1), s = a + o - r; 10210 return Math.sign(a) !== Math.sign(s) ? [ 10211 a / (a - s), 10212 o / (o - r) 10213 ] : void 0; 10214 } 10215 function $h(e1, t1, i) { 10216 const n = i * i; 10217 if (1 === t1.length) return e1.distSqr(t1[0]) < n; 10218 for(let i = 1; i < t1.length; i++)if (Zh(e1, t1[i - 1], t1[i]) < n) return !0; 10219 return !1; 10220 } 10221 function Zh(e1, t1, i) { 10222 const n = t1.distSqr(i); 10223 if (0 === n) return e1.distSqr(t1); 10224 const r = ((e1.x - t1.x) * (i.x - t1.x) + (e1.y - t1.y) * (i.y - t1.y)) / n; 10225 return e1.distSqr(r < 0 ? t1 : r > 1 ? i : i.sub(t1)._mult(r)._add(t1)); 10226 } 10227 function Wh(e1, t1) { 10228 let i, n, r, o = !1; 10229 for(let a = 0; a < e1.length; a++){ 10230 i = e1[a]; 10231 for(let e1 = 0, a = i.length - 1; e1 < i.length; a = e1++)n = i[e1], r = i[a], n.y > t1.y != r.y > t1.y && t1.x < (r.x - n.x) * (t1.y - n.y) / (r.y - n.y) + n.x && (o = !o); 10232 } 10233 return o; 10234 } 10235 function qh(e1, t1) { 10236 let i = !1; 10237 for(let n = 0, r = e1.length - 1; n < e1.length; r = n++){ 10238 const o = e1[n], a = e1[r]; 10239 o.y > t1.y != a.y > t1.y && t1.x < (a.x - o.x) * (t1.y - o.y) / (a.y - o.y) + o.x && (i = !i); 10240 } 10241 return i; 10242 } 10243 function Xh(e1, t1, i, n, r) { 10244 for (const o of e1)if (t1 <= o.x && i <= o.y && n >= o.x && r >= o.y) return !0; 10245 const o = [ 10246 new Pe(t1, i), 10247 new Pe(t1, r), 10248 new Pe(n, r), 10249 new Pe(n, i) 10250 ]; 10251 if (e1.length > 2) { 10252 for (const t1 of o)if (qh(e1, t1)) return !0; 10253 } 10254 for(let t1 = 0; t1 < e1.length - 1; t1++)if (Yh(e1[t1], e1[t1 + 1], o)) return !0; 10255 return !1; 10256 } 10257 function Yh(e1, t1, i) { 10258 const n = i[0], r = i[2]; 10259 if (e1.x < n.x && t1.x < n.x || e1.x > r.x && t1.x > r.x || e1.y < n.y && t1.y < n.y || e1.y > r.y && t1.y > r.y) return !1; 10260 const o = yt(e1, t1, i[0]); 10261 return o !== yt(e1, t1, i[1]) || o !== yt(e1, t1, i[2]) || o !== yt(e1, t1, i[3]); 10262 } 10263 function Jh(e1, t1, i, n, r, o) { 10264 let a = t1.y - e1.y, s = e1.x - t1.x; 10265 if (o = o || 0) { 10266 const e1 = a * a + s * s; 10267 if (0 === e1) return !0; 10268 const t1 = Math.sqrt(e1); 10269 a /= t1, s /= t1; 10270 } 10271 return !((i.x - e1.x) * a + (i.y - e1.y) * s - o < 0 || (n.x - e1.x) * a + (n.y - e1.y) * s - o < 0 || (r.x - e1.x) * a + (r.y - e1.y) * s - o < 0); 10272 } 10273 function Kh(e1, t1, i, n, r, o, a) { 10274 return !(Jh(e1, t1, n, r, o, a) || Jh(t1, i, n, r, o, a) || Jh(i, e1, n, r, o, a) || Jh(n, r, e1, t1, i, a) || Jh(r, o, e1, t1, i, a) || Jh(o, n, e1, t1, i, a)); 10275 } 10276 class Qh extends Pe { 10277 constructor(e1, t1, i){ 10278 super(e1, t1), this.z = i; 10279 } 10280 } 10281 class ed extends Qh { 10282 constructor(e1, t1, i, n){ 10283 super(e1, t1, i), this.w = n; 10284 } 10285 } 10286 function td(e1, t1, i, n) { 10287 const r = "x" === i ? "y" : "x", o = (n - e1[i]) / (t1[i] - e1[i]); 10288 e1[r] = Math.round(e1[r] + (t1[r] - e1[r]) * o), e1[i] = n, Object.hasOwn(e1, "z") && (e1.z = fn(e1.z, t1.z, o)), Object.hasOwn(e1, "w") && (e1.w = fn(e1.w, t1.w, o)); 10289 } 10290 function id(e1, t1, i, n) { 10291 const r = i, o = n; 10292 for (const i of [ 10293 "x", 10294 "y" 10295 ]){ 10296 let n = e1, a = t1; 10297 n[i] >= a[i] && (n = t1, a = e1), n[i] < r && a[i] > r && td(n, a, i, r), n[i] < o && a[i] > o && td(a, n, i, o); 10298 } 10299 } 10300 function nd(e1, t1, i, n, r, o) { 10301 const a = []; 10302 for(let s = 0; s < e1.length; s++){ 10303 const l = e1[s]; 10304 let c; 10305 const u = a.length; 10306 let h = 0; 10307 for(let e1 = 0; e1 < l.length - 1; e1++){ 10308 let u = l[e1], d = l[e1 + 1], f = 0; 10309 const p = h; 10310 let m, _; 10311 o && (f = Math.hypot(d.x - u.x, d.y - u.y), h += f, m = u, _ = d), u.x < t1 && d.x < t1 || (u.x < t1 ? u = new Pe(t1, u.y + (t1 - u.x) / (d.x - u.x) * (d.y - u.y))._round() : d.x < t1 && (d = new Pe(t1, u.y + (t1 - u.x) / (d.x - u.x) * (d.y - u.y))._round()), u.y < i && d.y < i || (u.y < i ? u = new Pe(u.x + (i - u.y) / (d.y - u.y) * (d.x - u.x), i)._round() : d.y < i && (d = new Pe(u.x + (i - u.y) / (d.y - u.y) * (d.x - u.x), i)._round()), u.x >= n && d.x >= n || (u.x >= n ? u = new Pe(n, u.y + (n - u.x) / (d.x - u.x) * (d.y - u.y))._round() : d.x >= n && (d = new Pe(n, u.y + (n - u.x) / (d.x - u.x) * (d.y - u.y))._round()), u.y >= r && d.y >= r || (u.y >= r ? u = new Pe(u.x + (r - u.y) / (d.y - u.y) * (d.x - u.x), r)._round() : d.y >= r && (d = new Pe(u.x + (r - u.y) / (d.y - u.y) * (d.x - u.x), r)._round()), c && u.equals(c.at(-1)) || (c = [ 10312 u 10313 ], a.push(c), o && o.push({ 10314 progress: { 10315 min: p + od(m, _, u) * f, 10316 max: 1 10317 }, 10318 parentIndex: s, 10319 prevPoint: m, 10320 nextPoint: _ 10321 })), c.push(d), o && (o.at(-1).progress.max = p + od(m, _, d) * f, o.at(-1).nextPoint = _))))); 10322 } 10323 if (o && h > 0) for(let e1 = u; e1 < a.length; e1++)o[e1].progress.min /= h, o[e1].progress.max /= h; 10324 } 10325 return a; 10326 } 10327 function rd(e1, t1, i, n, r) { 10328 if (e1.length < 2) return void n.push(e1); 10329 const o = []; 10330 for(; t1.valid();){ 10331 const [i, n] = t1.get(); 10332 for(let t1 = 0; t1 < e1.length - 1; t1++){ 10333 const r = e1[t1], a = e1[t1 + 1], s = Hh(r, a, i, n); 10334 if (s) { 10335 const [e1] = s, i = new Pe(fn(r.x, a.x, e1), fn(r.y, a.y, e1)); 10336 o.push({ 10337 t: t1 + e1, 10338 distance: 0, 10339 point: i 10340 }); 10341 } 10342 } 10343 t1.next(); 10344 } 10345 if (0 === o.length) return void n.push(e1); 10346 o.sort((e1, t1)=>e1.t - t1.t); 10347 let a = 0, s = 0, l = []; 10348 for(n.push(l); a !== e1.length;){ 10349 if (s === o.length) { 10350 for(; a !== e1.length;)0 !== l.length && l.at(-1).equals(e1[a]) || l.push(e1[a]), a++; 10351 break; 10352 } 10353 o[s].t <= a ? (0 !== l.length && l.at(-1).equals(o[s].point) || l.push(o[s].point), Math.trunc(o[s].t), s++) : (0 !== l.length && l.at(-1).equals(e1[a]) || l.push(e1[a]), a++); 10354 } 10355 } 10356 function od(e1, t1, i) { 10357 return e1.x !== t1.x ? (i.x - e1.x) / (t1.x - e1.x) : e1.y !== t1.y ? (i.y - e1.y) / (t1.y - e1.y) : 0; 10358 } 10359 function ad(e1, param, n, r) { 10360 let { width: t1, height: i } = param; 10361 if (r) { 10362 if (r instanceof Uint8ClampedArray) r = new Uint8Array(r.buffer); 10363 else if (r.length !== t1 * i * n) throw new RangeError("mismatched image size"); 10364 } else r = new Uint8Array(t1 * i * n); 10365 return e1.width = t1, e1.height = i, e1.data = r, e1; 10366 } 10367 function sd(e1, t1, i) { 10368 const { width: n, height: r } = t1; 10369 n === e1.width && r === e1.height || (ld(e1, t1, { 10370 x: 0, 10371 y: 0 10372 }, { 10373 x: 0, 10374 y: 0 10375 }, { 10376 width: Math.min(e1.width, n), 10377 height: Math.min(e1.height, r) 10378 }, i, null), e1.width = n, e1.height = r, e1.data = t1.data); 10379 } 10380 function ld(e1, t1, i, n, r, o, a, s) { 10381 if (0 === r.width || 0 === r.height) return t1; 10382 if (r.width > e1.width || r.height > e1.height || i.x > e1.width - r.width || i.y > e1.height - r.height) throw new RangeError("out of range source coordinates for image copy"); 10383 if (r.width > t1.width || r.height > t1.height || n.x > t1.width - r.width || n.y > t1.height - r.height) throw new RangeError("out of range destination coordinates for image copy"); 10384 const l = e1.data, c = t1.data, u = 4 === o && s; 10385 for(let s = 0; s < r.height; s++){ 10386 const h = ((i.y + s) * e1.width + i.x) * o, d = ((n.y + s) * t1.width + n.x) * o; 10387 if (u) for(let e1 = 0; e1 < r.width; e1++){ 10388 const t1 = h + e1 * o + 3, i = d + e1 * o; 10389 c[i + 0] = 255, c[i + 1] = 255, c[i + 2] = 255, c[i + 3] = l[t1]; 10390 } 10391 else if (a) for(let e1 = 0; e1 < r.width; e1++){ 10392 const t1 = h + e1 * o, i = d + e1 * o, n = new mn(l[t1 + 0] / 255, l[t1 + 1] / 255, l[t1 + 2] / 255, l[t1 + 3]).toNonPremultipliedRenderColor(a).toArray(); 10393 c[i + 0] = n[0], c[i + 1] = n[1], c[i + 2] = n[2], c[i + 3] = n[3]; 10394 } 10395 else for(let e1 = 0; e1 < r.width * o; e1++)c[d + e1] = l[h + e1]; 10396 } 10397 return t1; 10398 } 10399 class cd { 10400 resize(e1) { 10401 sd(this, new cd(e1), 1); 10402 } 10403 clone() { 10404 return new cd({ 10405 width: this.width, 10406 height: this.height 10407 }, new Uint8Array(this.data)); 10408 } 10409 static copy(e1, t1, i, n, r) { 10410 ld(e1, t1, i, n, r, 1, null); 10411 } 10412 constructor(e1, t1){ 10413 ad(this, e1, 1, t1); 10414 } 10415 } 10416 class ud { 10417 resize(e1) { 10418 sd(this, new ud(e1), 4); 10419 } 10420 replace(e1, t1) { 10421 t1 ? this.data.set(e1) : this.data = e1 instanceof Uint8ClampedArray ? new Uint8Array(e1.buffer) : e1; 10422 } 10423 clone() { 10424 return new ud({ 10425 width: this.width, 10426 height: this.height 10427 }, new Uint8Array(this.data)); 10428 } 10429 static copy(e1, t1, i, n, r, o, a) { 10430 ld(e1, t1, i, n, r, 4, o, a); 10431 } 10432 constructor(e1, t1){ 10433 ad(this, e1, 4, t1); 10434 } 10435 } 10436 class hd { 10437 constructor(e1, t1){ 10438 this.width = e1.width, this.height = e1.height, this.data = t1 instanceof Uint8Array ? new Float32Array(t1.buffer) : t1; 10439 } 10440 } 10441 Xa(cd, "AlphaImage"), Xa(ud, "RGBAImage"); 10442 class dd { 10443 getDash(e1, t1) { 10444 const i = this.getKey(e1, t1); 10445 return this.positions[i]; 10446 } 10447 trim() { 10448 const e1 = this.width, t1 = this.height = ct(this.nextRow); 10449 this.image.resize({ 10450 width: e1, 10451 height: t1 10452 }); 10453 } 10454 getKey(e1, t1) { 10455 return e1.join(",") + t1; 10456 } 10457 getDashRanges(e1, t1, i) { 10458 const n = []; 10459 let r = e1.length % 2 == 1 ? -e1.at(-1) * i : 0, o = e1[0] * i, a = !0; 10460 n.push({ 10461 left: r, 10462 right: o, 10463 isDash: a, 10464 zeroLength: 0 === e1[0] 10465 }); 10466 let s = e1[0]; 10467 for(let t1 = 1; t1 < e1.length; t1++){ 10468 a = !a; 10469 const l = e1[t1]; 10470 r = s * i, s += l, o = s * i, n.push({ 10471 left: r, 10472 right: o, 10473 isDash: a, 10474 zeroLength: 0 === l 10475 }); 10476 } 10477 return n; 10478 } 10479 addRoundDash(e1, t1, i) { 10480 const n = t1 / 2; 10481 for(let t1 = -i; t1 <= i; t1++){ 10482 const r = this.width * (this.nextRow + i + t1); 10483 let o = 0, a = e1[o]; 10484 for(let s = 0; s < this.width; s++){ 10485 s / a.right > 1 && (a = e1[++o]); 10486 const l = Math.abs(s - a.left), c = Math.abs(s - a.right), u = Math.min(l, c); 10487 let h; 10488 const d = t1 / i * (n + 1); 10489 if (a.isDash) { 10490 const e1 = n - Math.abs(d); 10491 h = Math.sqrt(u * u + e1 * e1); 10492 } else h = n - Math.sqrt(u * u + d * d); 10493 this.image.data[r + s] = Math.max(0, Math.min(255, h + 128)); 10494 } 10495 } 10496 } 10497 addRegularDash(e1, t1) { 10498 for(let t1 = e1.length - 1; t1 >= 0; --t1){ 10499 const i = e1[t1], n = e1[t1 + 1]; 10500 i.zeroLength ? e1.splice(t1, 1) : n && n.isDash === i.isDash && (n.left = i.left, e1.splice(t1, 1)); 10501 } 10502 const i = e1[0], n = e1.at(-1); 10503 i.isDash === n.isDash && (i.left = n.left - this.width, n.right = i.right + this.width); 10504 const r = this.width * this.nextRow; 10505 let o = 0, a = e1[o]; 10506 for(let i = 0; i < this.width; i++){ 10507 i / a.right > 1 && (a = e1[++o]); 10508 const n = Math.abs(i - a.left), s = Math.abs(i - a.right), l = Math.min(n, s); 10509 this.image.data[r + i] = Math.max(0, Math.min(255, (a.isDash ? l : -l) + t1 + 128)); 10510 } 10511 } 10512 addDash(e1, t1) { 10513 const i = this.getKey(e1, t1); 10514 if (this.positions[i]) return this.positions[i]; 10515 const n = "round" === t1, r = n ? 7 : 0, o = 2 * r + 1; 10516 if (this.nextRow + o > this.height) return gt("LineAtlas out of space"), null; 10517 0 === e1.length && e1.push(1); 10518 let a = 0; 10519 for(let t1 = 0; t1 < e1.length; t1++)e1[t1] < 0 && (gt("Negative value is found in line dasharray, replacing values with 0"), e1[t1] = 0), a += e1[t1]; 10520 if (0 !== a) { 10521 const i = this.width / a, o = this.getDashRanges(e1, this.width, i); 10522 n ? this.addRoundDash(o, i, r) : this.addRegularDash(o, "square" === t1 ? .5 * i : 0); 10523 } 10524 const s = this.nextRow + r; 10525 let l = 0; 10526 if (0 !== a) { 10527 const e1 = this.width * s; 10528 for(let t1 = 0; t1 < this.width; t1++)this.image.data[e1 + t1] >= 128 && l++; 10529 } 10530 const c = Math.round(l / this.width * 4095); 10531 this.nextRow += o; 10532 const u = Math.floor(a), h = { 10533 tl: [ 10534 s, 10535 r | c << 4 10536 ], 10537 br: [ 10538 u, 10539 Math.round(65535 * (a - u)) 10540 ] 10541 }; 10542 return this.positions[i] = h, h; 10543 } 10544 constructor(e1, t1){ 10545 this.width = e1, this.height = t1, this.nextRow = 0, this.image = new cd({ 10546 width: e1, 10547 height: t1 10548 }), this.positions = {}, this.uploaded = !1; 10549 } 10550 } 10551 Xa(dd, "LineAtlas"); 10552 const fd = "3d_elevation_id", pd = "level", md = Dh.types, _d = Math.cos(Math.PI / 180 * 37.5), gd = Math.cos(Math.PI / 180 * 5); 10553 class yd { 10554 updateFootprints(e1, t1) {} 10555 updateAppearances(e1, t1, i, n) { 10556 return { 10557 hasLayoutChanges: !1, 10558 hasUboChanges: !1 10559 }; 10560 } 10561 populate(e1, t1, i, n) { 10562 this.showElevationIdDebug = t1.showElevationIdDebug, this.terrainEnabled = t1.terrainEnabled, this.hasPattern = oc("line", this.layers, this.pixelRatio, t1); 10563 const r = this.layers[0].layout.get("line-sort-key"); 10564 this.tileToMeter = Ic(i); 10565 const o = this.layers[0].layout.get("line-elevation-reference"); 10566 if ("hd-road-markup" === o) this.elevationType = "road"; 10567 else { 10568 const e1 = this.layers[0].layout.get("line-z-offset"), t1 = e1.isConstant() && !e1.constantOr(0); 10569 this.elevationType = "sea" !== o && "ground" !== o && t1 ? "none" : "offset", "offset" === this.elevationType && "none" === o && gt("line-elevation-reference: ground is used for the layer ".concat(this.layerIds[0], " because non-zero line-z-offset value was found.")), this.isSeaLevelReference = "sea" === o; 10570 } 10571 const a = this.layers[0].layout.get("line-cross-slope"); 10572 this.hasCrossSlope = "offset" === this.elevationType && void 0 !== a; 10573 const s = []; 10574 for (const { feature: o, id: a, index: l, sourceLayerIndex: c } of e1){ 10575 const e1 = this.layers[0]._featureFilter.needGeometry, u = Lc(o, e1); 10576 if (!this.layers[0]._featureFilter.filter(new $s(this.zoom, { 10577 worldview: this.worldview, 10578 activeFloors: t1.activeFloors 10579 }), u, i)) continue; 10580 const h = r ? r.evaluate(u, {}, i) : void 0, d = { 10581 id: a, 10582 properties: o.properties, 10583 type: o.type, 10584 sourceLayerIndex: c, 10585 index: l, 10586 geometry: e1 ? u.geometry : Cc(o, i, n), 10587 patterns: {}, 10588 sortKey: h 10589 }; 10590 s.push(d); 10591 } 10592 r && s.sort((e1, t1)=>e1.sortKey - t1.sortKey); 10593 const { lineAtlas: l, featureIndex: c } = t1, u = this.addConstantDashes(l); 10594 for (const n of s){ 10595 const { geometry: r, index: o, sourceLayerIndex: a } = n; 10596 if (u && this.addFeatureDashes(n, l), this.hasPattern) { 10597 const e1 = ac("line", this.layers, n, this.zoom, this.pixelRatio, t1); 10598 this.patternFeatures.push(e1); 10599 } else this.addFeature(n, r, o, i, l.positions, t1.availableImages, t1.brightness, t1.elevationFeatures, t1.elevationParams, t1.crossSourceElevationEnabled); 10600 c.insert(e1[o].feature, r, o, a, this.index); 10601 } 10602 !this.hasPattern && this.hdExt && this.hdExt.buildFrcSegments(this), this.hdExt && this.hdExt.endPopulate(); 10603 } 10604 addConstantDashes(e1) { 10605 let t1 = !1; 10606 for (const i of this.layers){ 10607 const n = i.paint.get("line-dasharray").value, r = i.layout.get("line-cap").value; 10608 if ("constant" !== n.kind || "constant" !== r.kind) t1 = !0; 10609 else { 10610 const t1 = r.value, i = n.value; 10611 if (!i) continue; 10612 e1.addDash(i, t1); 10613 } 10614 } 10615 return t1; 10616 } 10617 addFeatureDashes(e1, t1) { 10618 const i = this.zoom; 10619 for (const n of this.layers){ 10620 const r = n.paint.get("line-dasharray").value, o = n.layout.get("line-cap").value; 10621 if ("constant" === r.kind && "constant" === o.kind) continue; 10622 let a, s; 10623 if ("constant" === r.kind) { 10624 if (a = r.value, !a) continue; 10625 } else a = r.evaluate({ 10626 zoom: i 10627 }, e1); 10628 s = "constant" === o.kind ? o.value : o.evaluate({ 10629 zoom: i 10630 }, e1), t1.addDash(a, s), e1.patterns[n.id] = [ 10631 t1.getKey(a, s) 10632 ]; 10633 } 10634 } 10635 update(e1, t1, i, n, r, o, a, s, l) { 10636 this.programConfigurations.updatePaintArrays(e1, t1, r, i, n, o, a, l); 10637 } 10638 updateExpressions(e1) { 10639 this.programConfigurations.updateExpressions(e1); 10640 } 10641 addFeatures(e1, t1, i, n, r, o) { 10642 for (const r of this.patternFeatures)this.addFeature(r, r.geometry, r.index, t1, i, n, o, e1.elevationFeatures, e1.elevationParams, e1.crossSourceElevationEnabled); 10643 this.hdExt && (this.hdExt.buildFrcSegments(this), this.hdExt.endPopulate()); 10644 } 10645 isEmpty() { 10646 return 0 === this.layoutVertexArray.length; 10647 } 10648 uploadPending() { 10649 return !this.uploaded || this.programConfigurations.needsUpload; 10650 } 10651 upload(e1) { 10652 this.uploaded || (0 !== this.layoutVertexArray2.length && (this.layoutVertexBuffer2 = e1.createVertexBuffer(this.layoutVertexArray2, zh)), 0 !== this.patternVertexArray.length && (this.patternVertexBuffer = e1.createVertexBuffer(this.patternVertexArray, Ph)), !this.zOffsetVertexBuffer && this.zOffsetVertexArray.length > 0 && (this.zOffsetVertexBuffer = e1.createVertexBuffer(this.zOffsetVertexArray, Eh.members, !0)), !this.elevationIdColVertexBuffer && this.elevationIdColVertexArray.length > 0 && (this.elevationIdColVertexBuffer = e1.createVertexBuffer(this.elevationIdColVertexArray, Ih.members, !0)), !this.elevationGroundScaleVertexBuffer && this.elevationGroundScaleVertexArray.length > 0 && (this.elevationGroundScaleVertexBuffer = e1.createVertexBuffer(this.elevationGroundScaleVertexArray, Mh.members, !0)), this.layoutVertexBuffer = e1.createVertexBuffer(this.layoutVertexArray, Th), this.indexBuffer = e1.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(e1), this.uploaded = !0; 10653 } 10654 destroy() { 10655 this.layoutVertexBuffer && (this.zOffsetVertexBuffer && this.zOffsetVertexBuffer.destroy(), this.elevationIdColVertexBuffer && this.elevationIdColVertexBuffer.destroy(), this.elevationGroundScaleVertexBuffer && this.elevationGroundScaleVertexBuffer.destroy(), this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy()); 10656 } 10657 lineFeatureClips(e1, t1) { 10658 let i, n; 10659 if (t1 && t1 > 0 ? (i = "mapbox_clip_start_".concat(t1), n = "mapbox_clip_end_".concat(t1)) : (i = "mapbox_clip_start", n = "mapbox_clip_end"), e1.properties && Object.hasOwn(e1.properties, i) && Object.hasOwn(e1.properties, n)) return { 10660 start: +e1.properties[i], 10661 end: +e1.properties[n] 10662 }; 10663 } 10664 addFeature(e1, t1, i, n, r, o, a, s, l, c) { 10665 const u = this.layers[0].layout, h = this.hdExt ? this.hdExt.trackFeatureFrc(e1.properties) : null, d = this.indexArray.length, f = u.get("line-join").evaluate(e1, {}), p = u.get("line-cap").evaluate(e1, {}), m = u.get("line-miter-limit"), _ = u.get("line-round-limit"); 10666 this.lineClips = this.lineFeatureClips(e1), this.lineFeature = e1; 10667 const g = !(!e1.properties || !Object.hasOwn(e1.properties, "mapbox_line_metrics")) && e1.properties.mapbox_line_metrics; 10668 this.zOffsetValue = u.get("line-z-offset").value; 10669 const y = this.layers[0].paint, x = y.get("line-width").value; 10670 "constant" !== x.kind && !1 === x.isLineProgressConstant && (this.variableWidthValue = x); 10671 const v = y.get("line-emissive-strength").value; 10672 if ("constant" !== v.kind && !1 === v.isLineProgressConstant && (this.variableEmissiveStrengthValue = v), this.isSeaLevelReference) { 10673 const e1 = u.get("line-elevation-ground-scale").value; 10674 "constant" === e1.kind && 0 === e1.value || (this.elevationGroundScaleValue = e1); 10675 } 10676 if (null == this.hdExt || !this.hdExt.handleFeature(e1, t1, n, s, l, !!c, f, p, m, _, this)) for(let i = 0; i < t1.length; i++)this.addLine(t1[i], e1, n, f, p, m, _, void 0, g && i > 0 ? i : null); 10677 this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, e1, i, r, o, n, a, void 0, this.worldview), this.hdExt && this.hdExt.recordFeatureRange(this, d, this.indexArray.length, h); 10678 } 10679 fillNonElevatedRoadSegment(e1) { 10680 for(let t1 = Math.max(e1, this.zOffsetVertexArray.length); t1 < this.layoutVertexArray.length; t1++)this.zOffsetVertexArray.emplaceBack(0, 0, 0, 0), this.showElevationIdDebug && this.elevationIdColVertexArray.emplaceBack(0, 0, 0); 10681 } 10682 addLine(e1, t1, i, n, r, o, a, s, l) { 10683 this.distance = 0, this.prevDistance = 0, this.scaledDistance = 0, this.totalDistance = 0, this.totalFeatureLength = 0, this.lineSoFar = 0, this.currentVertex = void 0, this.lineClips = l ? this.lineFeatureClips(t1, l) : this.lineClips; 10684 const c = "none" === n; 10685 this.patternJoinNone = this.hasPattern && c, this.currentLineJoinType = n, this.segmentStart = 0, this.segmentStartf32 = 0, this.segmentPoints = []; 10686 const u = s && s.progress.min > 0, h = s && s.progress.max < 1; 10687 if (this.lineClips) { 10688 let i = { 10689 min: this.lineClips.start, 10690 max: this.lineClips.end 10691 }, n = 1; 10692 if (s) { 10693 const e1 = this.lineClips.end - this.lineClips.start; 10694 i = function(e1, t1, i) { 10695 return { 10696 min: Rt(e1.min, t1, i), 10697 max: Rt(e1.max, t1, i) 10698 }; 10699 }(s.progress, { 10700 min: 0, 10701 max: 1 10702 }, i), e1 > 0 && (n = (i.max - i.min) / e1); 10703 } 10704 const r = +t1.properties.mapbox_clip_feature_len, o = +t1.properties.mapbox_clip_seg_len; 10705 if (Number.isNaN(r) || Number.isNaN(o)) { 10706 for(let t1 = 0; t1 < e1.length - 1; t1++)this.totalDistance += e1[t1].dist(e1[t1 + 1]); 10707 const t1 = this.totalDistance / (i.max - i.min); 10708 this.totalFeatureLength = Number.isFinite(t1) ? t1 : 0, this.lineClips.start = i.min, this.lineClips.end = i.max, this.maxLineLength = Math.max(this.maxLineLength, this.totalDistance); 10709 } else this.totalFeatureLength = r, this.distance = o * n, this.lineClips.start = i.min, this.lineClips.end = i.max, this.maxLineLength = Math.max(this.maxLineLength, this.distance); 10710 this.lineClipsArray.push(this.lineClips), this.updateScaledDistance(); 10711 } 10712 const d = "Polygon" === md[t1.type]; 10713 let f = e1.length; 10714 for(; f >= 2 && e1[f - 1].equals(e1[f - 2]);)f--; 10715 let p = 0; 10716 for(; p < f - 1 && e1[p].equals(e1[p + 1]);)p++; 10717 if (f < (d ? 3 : 2)) return; 10718 "bevel" === n && (o = 1.05); 10719 const m = this.segments.prepareSegment(10 * f, this.layoutVertexArray, this.indexArray); 10720 let _, g, y, x, v, b, w, A; 10721 s && s.prevDir && (b = s.prevDir.perp()), s && s.nextDir && (w = s.nextDir.perp()), this.e1 = this.e2 = -1, d && (_ = e1[f - 2], v = e1[p].sub(_)._unit()._perp()); 10722 for(let t1 = p; t1 < f; t1++){ 10723 if (y = t1 === f - 1 ? d ? e1[p + 1] : void 0 : e1[t1 + 1], y && e1[t1].equals(y)) continue; 10724 v && (x = v), _ && (g = _), _ = e1[t1], A = this.evaluateLineProgressFeatures(g ? g.dist(_) : 0), v = y ? y.sub(_)._unit()._perp() : x, x = x || v; 10725 const i = g && y; 10726 let s = i ? n : d || c ? "butt" : r; 10727 const l = x.x * v.x + x.y * v.y; 10728 if (c) { 10729 const e1 = function(e1) { 10730 if (e1.patternJoinNone) { 10731 const t1 = e1.segmentPoints.length / 2, i = e1.lineSoFar - e1.segmentStart; 10732 for(let n = 0; n < t1; ++n){ 10733 const t1 = e1.segmentPoints[2 * n + 1], r = Math.round(e1.segmentPoints[2 * n]) + .5 + .25 * t1; 10734 e1.patternVertexArray.emplaceBack(r, i, e1.segmentStart), e1.patternVertexArray.emplaceBack(r, i, e1.segmentStart); 10735 } 10736 e1.segmentPoints.length = 0; 10737 } 10738 e1.e1 = e1.e2 = -1; 10739 }; 10740 if (i && l < gd) { 10741 this.updateDistance(g, _), this.addCurrentVertex(_, x, 1, 1, m, A), e1(this), this.addCurrentVertex(_, v, -1, -1, m, A); 10742 continue; 10743 } 10744 if (g) { 10745 if (!y) { 10746 this.updateDistance(g, _), this.addCurrentVertex(_, x, 1, 1, m, A), e1(this); 10747 continue; 10748 } 10749 s = "miter"; 10750 } 10751 } 10752 let E = x.add(v); 10753 0 === E.x && 0 === E.y || E._unit(); 10754 const I = E.x * v.x + E.y * v.y, M = 0 !== I ? 1 / I : 1 / 0, T = 2 * Math.sqrt(2 - 2 * I), S = I < _d && g && y, z = x.x * v.y - x.y * v.x > 0, R = this.overscaling <= 16 ? 122880 / (512 * this.overscaling) : 0; 10755 if (i && "round" === s) { 10756 if (M < a) s = "miter"; 10757 else if (M <= 2) { 10758 const e1 = xd(_, -10, 8202); 10759 s = "offset" === this.elevationType && (e1 || this.hasCrossSlope) ? "miter" : "fakeround"; 10760 } 10761 } 10762 if ("miter" === s && M > o && (s = "bevel"), "bevel" === s && (M > 2 && (s = "flipbevel"), M < o && (s = "miter")), g && !("miter" === s && S) && this.updateDistance(g, _), "miter" === s) if (S) { 10763 const e1 = _.dist(g); 10764 if (e1 > 2 * R) { 10765 const t1 = _.sub(_.sub(g)._mult(R / e1)._round()); 10766 this.updateDistance(g, t1), this.addCurrentVertex(t1, x, 0, 0, m, A), g = t1; 10767 } 10768 this.updateDistance(g, _), E._mult(M), this.addCurrentVertex(_, E, 0, 0, m, A); 10769 const t1 = _.dist(y); 10770 if (t1 > 2 * R) { 10771 const e1 = _.add(y.sub(_)._mult(R / t1)._round()); 10772 this.updateDistance(_, e1), this.addCurrentVertex(e1, v, 0, 0, m, A), _ = e1; 10773 } 10774 } else E._mult(M), this.addCurrentVertex(_, E, 0, 0, m, A); 10775 else if ("flipbevel" === s) { 10776 if (M > 100) E = v.mult(-1); 10777 else { 10778 const e1 = M * x.add(v).mag() / x.sub(v).mag(); 10779 E._perp()._mult(e1 * (z ? -1 : 1)); 10780 } 10781 this.addCurrentVertex(_, E, 0, 0, m, A), this.addCurrentVertex(_, E.mult(-1), 0, 0, m, A); 10782 } else if ("bevel" === s || "fakeround" === s) { 10783 const e1 = _.dist(g); 10784 let t1 = 1; 10785 if ("offset" === this.elevationType && "bevel" === s && "round" !== this.currentLineJoinType && !this.patternJoinNone && null != A && g && y) { 10786 const i = 4 * R; 10787 e1 < i && (t1 = Math.max(0, e1 / i)); 10788 } 10789 null != A && g && this.addCurrentVertex(_, w || x, -t1, -t1, m, A); 10790 const i = e1 <= 1 * R && "bevel" !== s, n = i ? 1 : M, r = E.mult(z ? 1 : -1); 10791 r._mult(n); 10792 const o = v.mult(z ? -1 : 1), a = x.mult(z ? -1 : 1), c = this.evaluateLineProgressFeatures(this.distance); 10793 if (null == A && (this.addHalfVertex(_, r.x, r.y, !1, !z, 0, m, c), i || this.addHalfVertex(_, r.x + 2 * a.x, r.y + 2 * a.y, !1, z, 0, m, c)), "fakeround" === s) { 10794 const e1 = Math.round(180 * T / Math.PI / 20); 10795 this.addHalfVertex(_, a.x, a.y, !1, z, 0, m, c); 10796 for(let t1 = 0; t1 < e1; t1++){ 10797 let i = t1 / e1; 10798 if (.5 !== i) { 10799 const e1 = i - .5; 10800 i += i * e1 * (i - 1) * ((1.0904 + l * (l * (3.55645 - 1.43519 * l) - 3.2452)) * e1 * e1 + (.848013 + l * (.215638 * l - 1.06021))); 10801 } 10802 const n = o.sub(a)._mult(i)._add(a)._unit(); 10803 this.addHalfVertex(_, n.x, n.y, !1, z, 0, m, c); 10804 } 10805 this.addHalfVertex(_, o.x, o.y, !1, z, 0, m, c); 10806 } 10807 i || null != A || this.addHalfVertex(_, r.x + 2 * o.x, r.y + 2 * o.y, !1, z, 0, m, c), null != A && y && this.addCurrentVertex(_, b || v, t1, t1, m, A); 10808 } else if ("butt" === s) this.addCurrentVertex(_, E, 0, 0, m, A); 10809 else if ("square" === s) { 10810 if (!g) { 10811 const e1 = u ? 0 : -1; 10812 this.addCurrentVertex(_, E, e1, e1, m, A); 10813 } 10814 if (this.addCurrentVertex(_, E, 0, 0, m, A), g) { 10815 const e1 = h ? 0 : 1; 10816 this.addCurrentVertex(_, E, e1, e1, m, A); 10817 } 10818 } else if ("round" === s) { 10819 if (g) { 10820 const e1 = !i && w ? w : x; 10821 this.addCurrentVertex(_, e1, 0, 0, m, A), !i && h || this.addCurrentVertex(_, e1, 1, 1, m, A, !0); 10822 } 10823 if (y) { 10824 const e1 = !i && b ? b : v; 10825 !i && u || this.addCurrentVertex(_, e1, -1, -1, m, A, !0), this.addCurrentVertex(_, e1, 0, 0, m, A); 10826 } 10827 } 10828 } 10829 } 10830 addVerticesTo(e1, t1, i, n, r, o, a, s, l, c) { 10831 const u = (t1.w - e1.w) / this.tessellationStep | 0; 10832 let h = 0; 10833 const d = this.scaledDistance; 10834 if (u > 1) { 10835 this.lineSoFar = e1.w; 10836 const i = (t1.x - e1.x) / u, n = (t1.y - e1.y) / u, r = (t1.z - e1.z) / u, o = (t1.w - e1.w) / u, a = t1.x - e1.x, s = t1.y - e1.y, d = Math.sqrt(a * a + s * s); 10837 if (0 === d) return; 10838 const f = -s / d, p = a / d, m = f, _ = p, g = -f, y = -p; 10839 for(let t1 = 1; t1 < u; ++t1){ 10840 e1.x += i, e1.y += n, e1.z += r, this.lineSoFar += o, h += o; 10841 const t1 = this.evaluateLineProgressFeatures(this.prevDistance + h); 10842 this.scaledDistance = (this.prevDistance + h) / this.totalDistance, this.addHalfVertex(e1, m, _, c, !1, 0, l, t1), this.addHalfVertex(e1, g, y, c, !0, 0, l, t1); 10843 } 10844 } 10845 this.lineSoFar = t1.w, this.scaledDistance = d; 10846 const f = this.evaluateLineProgressFeatures(this.distance); 10847 this.addHalfVertex(t1, i, n, c, !1, a, l, f), this.addHalfVertex(t1, r, o, c, !0, -s, l, f); 10848 } 10849 evaluateLineProgressFeatures(e1) { 10850 if (!this.variableWidthValue && !this.variableEmissiveStrengthValue && "offset" !== this.elevationType) return null; 10851 this.evaluationGlobals.lineProgress = 0, this.lineClips ? this.evaluationGlobals.lineProgress = Math.min(1, (this.totalFeatureLength * this.lineClips.start + e1) / this.totalFeatureLength) : gt("line-progress evaluation for ".concat(this.layerIds[0], " requires enabling 'lineMetrics' for the source.")); 10852 let t1 = 0; 10853 this.variableWidthValue && "constant" !== this.variableWidthValue.kind && (t1 = this.variableWidthValue.evaluate(this.evaluationGlobals, this.lineFeature) || 0, t1 *= .5); 10854 let i = 0; 10855 this.variableEmissiveStrengthValue && "constant" !== this.variableEmissiveStrengthValue.kind && (i = this.variableEmissiveStrengthValue.evaluate(this.evaluationGlobals, this.lineFeature) || 0); 10856 const n = this.evaluateElevationGroundScale(); 10857 return "offset" !== this.elevationType ? { 10858 zOffset: 0, 10859 variableWidth: t1, 10860 elevationGroundScale: n, 10861 variableEmissiveStrength: i 10862 } : "constant" === this.zOffsetValue.kind ? { 10863 zOffset: this.zOffsetValue.value, 10864 variableWidth: t1, 10865 elevationGroundScale: n, 10866 variableEmissiveStrength: i 10867 } : { 10868 zOffset: this.zOffsetValue.evaluate(this.evaluationGlobals, this.lineFeature) || 0, 10869 variableWidth: t1, 10870 elevationGroundScale: n, 10871 variableEmissiveStrength: i 10872 }; 10873 } 10874 evaluateElevationGroundScale() { 10875 return this.elevationGroundScaleValue ? "constant" === this.elevationGroundScaleValue.kind ? this.elevationGroundScaleValue.value : this.elevationGroundScaleValue.evaluate(this.evaluationGlobals, this.lineFeature) || 0 : 0; 10876 } 10877 addCurrentVertex(e1, t1, i, n, r, o) { 10878 let a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : !1; 10879 const s = t1.x + t1.y * i, l = t1.y - t1.x * i, c = t1.y * n - t1.x, u = -t1.y - t1.x * n; 10880 if (null != o) { 10881 const t1 = "offset" === this.elevationType, h = "offset" === this.elevationType ? 2 : 10, d = -h, f = zr + h, p = o.zOffset, m = new ed(e1.x, e1.y, p, this.lineSoFar), _ = !!t1 && xd(e1, d, f), g = this.lineSoFar, y = this.distance; 10882 if (this.currentVertex) if (_) { 10883 const t1 = this.currentVertexIsOutside, o = this.currentVertex, h = new ed(e1.x, e1.y, p, this.lineSoFar); 10884 if (id(o, h, d, f), !xd(h, d, f)) { 10885 if (t1) { 10886 this.e1 = this.e2 = -1, this.distance -= o.dist(m), this.lineSoFar = o.w; 10887 const e1 = this.evaluateLineProgressFeatures(o.w - this.totalFeatureLength * (this.lineClips ? this.lineClips.start : 0)); 10888 this.addHalfVertex(o, s, l, a, !1, i, r, e1), this.addHalfVertex(o, c, u, a, !0, -n, r, e1), this.prevDistance = this.distance; 10889 } 10890 this.distance = this.prevDistance + o.dist(h), this.scaledDistance = this.distance / this.totalDistance, this.addVerticesTo(o, h, s, l, c, u, i, n, r, a), this.distance = y, this.scaledDistance = this.distance / this.totalDistance; 10891 } 10892 } else { 10893 const e1 = this.currentVertex; 10894 if (this.currentVertexIsOutside) { 10895 id(e1, m, d, f), this.e1 = this.e2 = -1, this.distance -= e1.dist(m), this.scaledDistance = this.distance / this.totalDistance, this.lineSoFar = e1.w; 10896 const t1 = this.evaluateLineProgressFeatures(e1.w - this.totalFeatureLength * (this.lineClips ? this.lineClips.start : 0)); 10897 this.addHalfVertex(e1, s, l, a, !1, i, r, t1), this.addHalfVertex(e1, c, u, a, !0, -n, r, t1), this.prevDistance = this.distance, this.distance = y, this.scaledDistance = this.distance / this.totalDistance; 10898 } 10899 this.addVerticesTo(e1, m, s, l, c, u, i, n, r, a); 10900 } 10901 else _ || (this.addHalfVertex(e1, s, l, a, !1, i, r, o), this.addHalfVertex(e1, c, u, a, !0, -n, r, o)); 10902 this.currentVertex = m, this.currentVertexIsOutside = _, this.lineSoFar = g; 10903 } else this.addHalfVertex(e1, s, l, a, !1, i, r, o), this.addHalfVertex(e1, c, u, a, !0, -n, r, o); 10904 } 10905 addHalfVertex(param, i, n, r, o, a, s, l) { 10906 let { x: e1, y: t1 } = param; 10907 if (this.patternJoinNone && (0 === this.segmentPoints.length && (this.segmentStart = this.lineSoFar, this.segmentStartf32 = Math.fround(this.lineSoFar)), o || this.segmentPoints.push(this.lineSoFar - this.segmentStart, a)), this.layoutVertexArray.emplaceBack((e1 << 1) + (r ? 1 : 0), (t1 << 1) + (o ? 1 : 0), Math.round(63 * i) + 128, Math.round(63 * n) + 128, 1 + (0 === a ? 0 : a < 0 ? -1 : 1), 0, this.lineSoFar - this.segmentStartf32), this.lineClips) { 10908 const e1 = fn(this.lineClips.start, this.lineClips.end, this.scaledDistance); 10909 this.layoutVertexArray2.emplaceBack(this.scaledDistance, this.lineClipsArray.length, e1); 10910 } 10911 const c = s.vertexLength++; 10912 if (this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, c), s.primitiveLength++), o ? this.e2 = c : this.e1 = c, null != l && (this.zOffsetVertexArray.emplaceBack(l.zOffset, l.variableWidth, l.variableWidth, l.variableEmissiveStrength), this.showElevationIdDebug && this.elevationIdColVertexArray.emplaceBack(0, 0, 0)), this.elevationGroundScaleValue) { 10913 const e1 = l ? l.elevationGroundScale : this.evaluateElevationGroundScale(); 10914 this.elevationGroundScaleVertexArray.emplaceBack(e1); 10915 } 10916 } 10917 updateScaledDistance() { 10918 this.lineClips ? (this.scaledDistance = this.distance / this.totalDistance, this.lineSoFar = this.totalFeatureLength * this.lineClips.start + this.distance) : this.lineSoFar = this.distance; 10919 } 10920 updateDistance(e1, t1) { 10921 this.prevDistance = this.distance, this.distance += e1.dist(t1), this.updateScaledDistance(); 10922 } 10923 constructor(e1){ 10924 this.evaluationGlobals = { 10925 zoom: 0, 10926 lineProgress: void 0 10927 }, this.elevationType = "none", this.isSeaLevelReference = !1, this.showElevationIdDebug = !1, this.terrainEnabled = !1, this.zoom = e1.zoom, this.evaluationGlobals.zoom = this.zoom, this.overscaling = e1.overscaling, this.pixelRatio = e1.pixelRatio, this.layers = e1.layers, this.layerIds = this.layers.map((e1)=>e1.fqid), this.index = e1.index, this.projection = e1.projection, this.hasPattern = !1, this.hasCrossSlope = !1, this.patternFeatures = [], this.lineClipsArray = [], this.gradients = {}, this.borderGradients = {}, this.layers.forEach((e1)=>{ 10928 this.gradients[e1.id] = {}, this.borderGradients[e1.id] = {}; 10929 }), this.layoutVertexArray = new Yc, this.layoutVertexArray2 = new Jc, this.patternVertexArray = new Jc, this.indexArray = new uu, this.programConfigurations = new mh(e1.layers, { 10930 zoom: e1.zoom, 10931 lut: e1.lut 10932 }), this.segments = new ju, this.sourceLayerName = e1.sourceLayerName || "", this.maxLineLength = 0, this.zOffsetVertexArray = new nu, this.elevationIdColVertexArray = new Jc, this.elevationGroundScaleVertexArray = new $c, this.stateDependentLayerIds = this.layers.filter((e1)=>e1.isStateDependent()).map((e1)=>e1.id), this.tessellationStep = e1.tessellationStep ? e1.tessellationStep : 128, this.worldview = e1.worldview, this.hasAppearances = null; 10933 } 10934 } 10935 function xd(e1, t1, i) { 10936 return e1.x < t1 || e1.x > i || e1.y < t1 || e1.y > i; 10937 } 10938 Xa(yd, "LineBucket", { 10939 omit: [ 10940 "layers", 10941 "patternFeatures", 10942 "currentVertex", 10943 "currentVertexIsOutside" 10944 ] 10945 }); 10946 const vd = kc([ 10947 { 10948 name: "a_pos", 10949 components: 2, 10950 type: "Int16" 10951 } 10952 ], 4), bd = kc([ 10953 { 10954 name: "a_circle_z_offset", 10955 components: 1, 10956 type: "Float32" 10957 } 10958 ], 4), wd = kc([ 10959 { 10960 name: "a_pos_3", 10961 components: 3, 10962 type: "Int16" 10963 }, 10964 { 10965 name: "a_pos_normal_3", 10966 components: 3, 10967 type: "Int16" 10968 } 10969 ]); 10970 class Ad { 10971 updateFootprints(e1, t1) {} 10972 updateAppearances(e1, t1, i, n) { 10973 return { 10974 hasLayoutChanges: !1, 10975 hasUboChanges: !1 10976 }; 10977 } 10978 populate(e1, t1, i, n) { 10979 const r = this.layers[0], o = []; 10980 let a = null; 10981 "circle" === r.type && (a = r.layout.get("circle-sort-key")); 10982 for (const { feature: r, id: s, index: l, sourceLayerIndex: c } of e1){ 10983 const e1 = this.layers[0]._featureFilter.needGeometry, u = Lc(r, e1); 10984 if (!this.layers[0]._featureFilter.filter(new $s(this.zoom, { 10985 worldview: this.worldview, 10986 activeFloors: t1.activeFloors 10987 }), u, i)) continue; 10988 const h = a ? a.evaluate(u, {}, i) : void 0, d = { 10989 id: s, 10990 properties: r.properties, 10991 type: r.type, 10992 sourceLayerIndex: c, 10993 index: l, 10994 geometry: e1 ? u.geometry : Cc(r, i, n), 10995 patterns: {}, 10996 sortKey: h 10997 }; 10998 o.push(d); 10999 } 11000 a && o.sort((e1, t1)=>e1.sortKey - t1.sortKey); 11001 let s = null; 11002 "globe" === n.projection.name && (this.globeExtVertexArray = new eu, s = n.projection); 11003 for (const n of o){ 11004 const { geometry: r, index: o, sourceLayerIndex: a } = n, l = e1[o].feature; 11005 this.addFeature(n, r, o, t1.availableImages, i, s, t1.brightness, t1.elevationFeatures), t1.featureIndex.insert(l, r, o, a, this.index); 11006 } 11007 this.hdExt && this.hdExt.finalize(); 11008 } 11009 update(e1, t1, i, n, r, o, a) { 11010 this.programConfigurations.updatePaintArrays(e1, t1, r, i, n, o, a, this.worldview); 11011 } 11012 updateExpressions(e1) { 11013 this.programConfigurations.updateExpressions(e1); 11014 } 11015 isEmpty() { 11016 return 0 === this.layoutVertexArray.length; 11017 } 11018 uploadPending() { 11019 return !this.uploaded || this.programConfigurations.needsUpload; 11020 } 11021 upload(e1) { 11022 this.uploaded || (this.layoutVertexBuffer = e1.createVertexBuffer(this.layoutVertexArray, vd.members), this.indexBuffer = e1.createIndexBuffer(this.indexArray), this.globeExtVertexArray && (this.globeExtVertexBuffer = e1.createVertexBuffer(this.globeExtVertexArray, wd.members)), this.hdExt && this.hdExt.upload(e1)), this.programConfigurations.upload(e1), this.uploaded = !0; 11023 } 11024 destroy() { 11025 this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.globeExtVertexBuffer && this.globeExtVertexBuffer.destroy(), this.hdExt && this.hdExt.destroy()); 11026 } 11027 addFeature(e1, t1, i, n, r, o, a, s) { 11028 this.hdExt && this.hdExt.beginFeature(e1, s, r); 11029 for (const i of t1)for (const t1 of i){ 11030 const i = t1.x, n = t1.y; 11031 if (i < 0 || i >= zr || n < 0 || n >= zr) continue; 11032 if (o) { 11033 const e1 = o.projectTilePoint(i, n, r), t1 = o.upVector(r, i, n); 11034 this.addGlobeExtVertex(e1, t1), this.addGlobeExtVertex(e1, t1), this.addGlobeExtVertex(e1, t1), this.addGlobeExtVertex(e1, t1); 11035 } 11036 const a = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, e1.sortKey), s = a.vertexLength; 11037 this.addCircleVertex(i, n, -1, -1), this.addCircleVertex(i, n, 1, -1), this.addCircleVertex(i, n, 1, 1), this.addCircleVertex(i, n, -1, 1), this.hdExt && this.hdExt.writeVertexQuad(i, n), this.indexArray.emplaceBack(s, s + 1, s + 2), this.indexArray.emplaceBack(s, s + 2, s + 3), a.vertexLength += 4, a.primitiveLength += 2; 11038 } 11039 this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, e1, i, {}, n, r, a, void 0, this.worldview); 11040 } 11041 addCircleVertex(e1, t1, i, n) { 11042 this.layoutVertexArray.emplaceBack(2 * e1 + (i + 1) / 2, 2 * t1 + (n + 1) / 2); 11043 } 11044 addGlobeExtVertex(e1, t1) { 11045 const i = 16384; 11046 this.globeExtVertexArray.emplaceBack(e1.x, e1.y, e1.z, t1[0] * i, t1[1] * i, t1[2] * i); 11047 } 11048 constructor(e1){ 11049 this.zoom = e1.zoom, this.overscaling = e1.overscaling, this.layers = e1.layers, this.layerIds = this.layers.map((e1)=>e1.fqid), this.index = e1.index, this.hasPattern = !1, this.projection = e
110491.projection, this.layoutVertexArray = new jc, this.indexArray = new uu, this.segments = new ju, this.programConfigurations = new mh(e1.layers, { 11050 zoom: e1.zoom, 11051 lut: e1.lut 11052 }), this.stateDependentLayerIds = this.layers.filter((e1)=>e1.isStateDependent()).map((e1)=>e1.id), this.worldview = e1.worldview, this.hasAppearances = null; 11053 } 11054 } 11055 Xa(Ad, "CircleBucket", { 11056 omit: [ 11057 "layers" 11058 ] 11059 }); 11060 const Ed = kc([ 11061 { 11062 name: "a_pos_offset", 11063 components: 4, 11064 type: "Int16" 11065 }, 11066 { 11067 name: "a_tex_size", 11068 components: 4, 11069 type: "Uint16" 11070 }, 11071 { 11072 name: "a_pixeloffset", 11073 components: 4, 11074 type: "Int16" 11075 } 11076 ], 4), Id = kc([ 11077 { 11078 name: "a_globe_anchor", 11079 components: 3, 11080 type: "Int16" 11081 }, 11082 { 11083 name: "a_globe_normal", 11084 components: 3, 11085 type: "Float32" 11086 } 11087 ], 4), Md = kc([ 11088 { 11089 name: "a_projected_pos", 11090 components: 4, 11091 type: "Float32" 11092 } 11093 ], 4); 11094 kc([ 11095 { 11096 name: "a_fade_opacity", 11097 components: 1, 11098 type: "Uint32" 11099 } 11100 ], 4); 11101 const Td = kc([ 11102 { 11103 name: "a_auto_z_offset", 11104 components: 1, 11105 type: "Float32" 11106 } 11107 ], 4), Sd = kc([ 11108 { 11109 name: "a_feature_index", 11110 components: 1, 11111 type: "Float32" 11112 } 11113 ], 4), zd = kc([ 11114 { 11115 name: "a_x_axis", 11116 components: 3, 11117 type: "Float32" 11118 }, 11119 { 11120 name: "a_y_axis", 11121 components: 3, 11122 type: "Float32" 11123 } 11124 ]), Rd = kc([ 11125 { 11126 name: "a_texb", 11127 components: 2, 11128 type: "Uint16" 11129 } 11130 ]), Pd = kc([ 11131 { 11132 name: "a_placed", 11133 components: 2, 11134 type: "Uint8" 11135 }, 11136 { 11137 name: "a_shift", 11138 components: 2, 11139 type: "Float32" 11140 }, 11141 { 11142 name: "a_elevation_from_sea", 11143 components: 2, 11144 type: "Float32" 11145 } 11146 ]), Dd = kc([ 11147 { 11148 name: "a_size_scale", 11149 components: 1, 11150 type: "Float32" 11151 }, 11152 { 11153 name: "a_padding", 11154 components: 2, 11155 type: "Float32" 11156 }, 11157 { 11158 name: "a_auto_z_offset", 11159 components: 1, 11160 type: "Float32" 11161 } 11162 ]); 11163 kc([ 11164 { 11165 type: "Int16", 11166 name: "projectedAnchorX" 11167 }, 11168 { 11169 type: "Int16", 11170 name: "projectedAnchorY" 11171 }, 11172 { 11173 type: "Int16", 11174 name: "projectedAnchorZ" 11175 }, 11176 { 11177 type: "Int16", 11178 name: "tileAnchorX" 11179 }, 11180 { 11181 type: "Int16", 11182 name: "tileAnchorY" 11183 }, 11184 { 11185 type: "Float32", 11186 name: "x1" 11187 }, 11188 { 11189 type: "Float32", 11190 name: "y1" 11191 }, 11192 { 11193 type: "Float32", 11194 name: "x2" 11195 }, 11196 { 11197 type: "Float32", 11198 name: "y2" 11199 }, 11200 { 11201 type: "Int16", 11202 name: "padding" 11203 }, 11204 { 11205 type: "Uint32", 11206 name: "featureIndex" 11207 }, 11208 { 11209 type: "Uint16", 11210 name: "sourceLayerIndex" 11211 }, 11212 { 11213 type: "Uint16", 11214 name: "bucketIndex" 11215 } 11216 ]); 11217 const Fd = kc([ 11218 { 11219 name: "a_pos", 11220 components: 3, 11221 type: "Int16" 11222 }, 11223 { 11224 name: "a_anchor_pos", 11225 components: 2, 11226 type: "Int16" 11227 }, 11228 { 11229 name: "a_extrude", 11230 components: 2, 11231 type: "Int16" 11232 } 11233 ], 4), Cd = kc([ 11234 { 11235 name: "a_pos_2f", 11236 components: 2, 11237 type: "Float32" 11238 }, 11239 { 11240 name: "a_radius", 11241 components: 1, 11242 type: "Float32" 11243 }, 11244 { 11245 name: "a_flags", 11246 components: 2, 11247 type: "Int16" 11248 } 11249 ], 4); 11250 kc([ 11251 { 11252 name: "triangle", 11253 components: 3, 11254 type: "Uint16" 11255 } 11256 ]), kc([ 11257 { 11258 type: "Int16", 11259 name: "projectedAnchorX" 11260 }, 11261 { 11262 type: "Int16", 11263 name: "projectedAnchorY" 11264 }, 11265 { 11266 type: "Int16", 11267 name: "projectedAnchorZ" 11268 }, 11269 { 11270 type: "Float32", 11271 name: "tileAnchorX" 11272 }, 11273 { 11274 type: "Float32", 11275 name: "tileAnchorY" 11276 }, 11277 { 11278 type: "Uint16", 11279 name: "glyphStartIndex" 11280 }, 11281 { 11282 type: "Uint16", 11283 name: "numGlyphs" 11284 }, 11285 { 11286 type: "Uint32", 11287 name: "vertexStartIndex" 11288 }, 11289 { 11290 type: "Uint32", 11291 name: "lineStartIndex" 11292 }, 11293 { 11294 type: "Uint32", 11295 name: "lineLength" 11296 }, 11297 { 11298 type: "Uint16", 11299 name: "segment" 11300 }, 11301 { 11302 type: "Uint16", 11303 name: "lowerSize" 11304 }, 11305 { 11306 type: "Uint16", 11307 name: "upperSize" 11308 }, 11309 { 11310 type: "Float32", 11311 name: "lineOffsetX" 11312 }, 11313 { 11314 type: "Float32", 11315 name: "lineOffsetY" 11316 }, 11317 { 11318 type: "Uint8",
11319 name: "writingMode" 11320 }, 11321 { 11322 type: "Uint8", 11323 name: "placedOrientation" 11324 }, 11325 { 11326 type: "Uint8", 11327 name: "hidden" 11328 }, 11329 { 11330 type: "Uint32", 11331 name: "crossTileID" 11332 }, 11333 { 11334 type: "Int16", 11335 name: "associatedIconIndex" 11336 }, 11337 { 11338 type: "Uint8", 11339 name: "flipState" 11340 } 11341 ]), kc([ 11342 { 11343 type: "Float32", 11344 name: "tileAnchorX" 11345 }, 11346 { 11347 type: "Float32", 11348 name: "tileAnchorY" 11349 }, 11350 { 11351 type: "Int16", 11352 name: "projectedAnchorX" 11353 }, 11354 { 11355 type: "Int16", 11356 name: "projectedAnchorY" 11357 }, 11358 { 11359 type: "Int16", 11360 name: "projectedAnchorZ" 11361 }, 11362 { 11363 type: "Int16", 11364 name: "rightJustifiedTextSymbolIndex" 11365 }, 11366 { 11367 type: "Int16", 11368 name: "centerJustifiedTextSymbolIndex" 11369 }, 11370 { 11371 type: "Int16", 11372 name: "leftJustifiedTextSymbolIndex" 11373 }, 11374 { 11375 type: "Int16", 11376 name: "verticalPlacedTextSymbolIndex" 11377 }, 11378 { 11379 type: "Int16", 11380 name: "placedIconSymbolIndex" 11381 }, 11382 { 11383 type: "Int16", 11384 name: "verticalPlacedIconSymbolIndex" 11385 }, 11386 { 11387 type: "Uint16", 11388 name: "key" 11389 }, 11390 { 11391 type: "Uint16", 11392 name: "textBoxStartIndex" 11393 }, 11394 { 11395 type: "Uint16", 11396 name: "textBoxEndIndex" 11397 }, 11398 { 11399 type: "Uint16", 11400 name: "verticalTextBoxStartIndex" 11401 }, 11402 { 11403 type: "Uint16", 11404 name: "verticalTextBoxEndIndex" 11405 }, 11406 { 11407 type: "Uint16", 11408 name: "iconBoxStartIndex" 11409 }, 11410 { 11411 type: "Uint16", 11412 name: "iconBoxEndIndex" 11413 }, 11414 { 11415 type: "Uint16", 11416 name: "verticalIconBoxStartIndex" 11417 }, 11418 { 11419 type: "Uint16", 11420 name: "verticalIconBoxEndIndex" 11421 }, 11422 { 11423 type: "Uint16", 11424 name: "featureIndex" 11425 }, 11426 { 11427 type: "Uint16", 11428 name: "numHorizontalGlyphVertices" 11429 }, 11430 { 11431 type: "Uint16", 11432 name: "numVerticalGlyphVertices" 11433 }, 11434 { 11435 type: "Uint16", 11436 name: "numIconVertices" 11437 }, 11438 { 11439 type: "Uint16", 11440 name: "numVerticalIconVertices" 11441 }, 11442 { 11443 type: "Uint16", 11444 name: "useRuntimeCollisionCircles" 11445 }, 11446 { 11447 type: "Uint32", 11448 name: "crossTileID" 11449 }, 11450 { 11451 type: "Float32", 11452 components: 2, 11453 name: "textOffset" 11454 }, 11455 { 11456 type: "Float32", 11457 name: "collisionCircleDiameter" 11458 }, 11459 { 11460 type: "Float32", 11461 name: "zOffset" 11462 }, 11463 { 11464 type: "Uint8", 11465 name: "hasIconTextFit" 11466 }, 11467 { 11468 type: "Uint16", 11469 name: "elevationFeatureIndex" 11470 } 11471 ]), kc([ 11472 { 11473 type: "Float32", 11474 name: "offsetX" 11475 } 11476 ]), kc([ 11477 { 11478 type: "Int16", 11479 name: "x" 11480 }, 11481 { 11482 type: "Int16", 11483 name: "y" 11484 } 11485 ]); 11486 const Ld = new Float32Array(1), Od = new Uint32Array(Ld.buffer); 11487 function Bd(e1) { 11488 return Ld[0] = e1, Od[0]; 11489 } 11490 const Vd = class e1 { 11491 static getBlockIndices(t1) { 11492 let i = e1._blockIndicesTemplate; 11493 if (!i) { 11494 i = e1._blockIndicesTemplate = new Uint32Array(t1); 11495 for(let e1 = 0; e1 < t1; e1++)i[e1] = e1; 11496 } 11497 return i; 11498 } 11499 _initBuffers(t1) { 11500 const i = t1.gl; 11501 if (this.totalBytes > t1.maxUniformBlockSize) throw new Error("UBO size ".concat(this.totalBytes, " exceeds device limit ").concat(t1.maxUniformBlockSize)); 11502 i.isContextLost() || (this.headerBuffer = i.createBuffer(), i.bindBuffer(i.UNIFORM_BUFFER, this.headerBuffer), i.bufferData(i.UNIFORM_BUFFER, e1.HEADER_BYTES, i.DYNAMIC_DRAW), this.propertiesBuffer = i.createBuffer(), i.bindBuffer(i.UNIFORM_BUFFER, this.propertiesBuffer), i.bufferData(i.UNIFORM_BUFFER, this.totalBytes, i.DYNAMIC_DRAW), this.blockIndicesBuffer = i.createBuffer(), i.bindBuffer(i.UNIFORM_BUFFER, this.blockIndicesBuffer), i.bufferData(i.UNIFORM_BUFFER, this.totalBytes, i.DYNAMIC_DRAW), i.bindBuffer(i.UNIFORM_BUFFER, null)); 11503 } 11504 markHeaderDirty() { 11505 this._headerDirty = !0; 11506 } 11507 writeDataDrivenBlock(e1, t1) { 11508 const i = this.headerData, n = 4 * i[2]; 11509 if (0 === n) return; 11510 const r = t1 * n; 11511 if (r + n > this.propertiesData.length) throw new Error("UBO write out of bounds: feature index ".concat(t1, " exceeds propertiesData capacity")); 11512 const o = i[0]; 11513 for(let t1 = 0; t1 < 9; t1++)o & 1 << t1 && this._copyFromFlat(r + 4 * i[3 + t1], t1, e1); 11514 (-1 === this._propsDirtyMin || r < this._propsDirtyMin) && (this._propsDirtyMin = r); 11515 const a = r + n; 11516 a > this._propsDirtyMax && (this._propsDirtyMax = a); 11517 } 11518 rightSizeForTransfer() { 11519 const e1 = -1 === this._propsDirtyMax ? 0 : this._propsDirtyMax; 11520 e1 < this.propertiesData.length && (this.propertiesData = this.propertiesData.slice(0, e1)); 11521 } 11522 _copyFromFlat(t1, i, n) { 11523 let r = 4;
11524 (i < 2 || 8 === i) && (r = this.headerData[1] >>> i & 1 ? 8 : 4); 11525 const o = e1.EVAL_FLAT_OFFSETS[i]; 11526 this.propertiesData.set(n.subarray(o, o + r), t1); 11527 } 11528 upload(t1) { 11529 this.context || (this.context = t1); 11530 const i = t1.gl; 11531 this.headerBuffer && this.propertiesBuffer && this.blockIndicesBuffer || this._initBuffers(t1); 11532 let n = !1; 11533 if (this._headerDirty && (i.bindBuffer(i.UNIFORM_BUFFER, this.headerBuffer), i.bufferSubData(i.UNIFORM_BUFFER, 0, this.headerData), this._headerDirty = !1, n = !0), -1 !== this._propsDirtyMin) { 11534 const e1 = this._propsDirtyMin, t1 = this._propsDirtyMax; 11535 i.bindBuffer(i.UNIFORM_BUFFER, this.propertiesBuffer), i.bufferSubData(i.UNIFORM_BUFFER, 4 * e1, this.propertiesData, e1, t1 - e1), this._propsDirtyMin = -1, this._propsDirtyMax = -1, n = !0; 11536 } 11537 this._blockIndicesDirty && (i.bindBuffer(i.UNIFORM_BUFFER, this.blockIndicesBuffer), i.bufferSubData(i.UNIFORM_BUFFER, 0, e1.getBlockIndices(this.propsDwords)), this._blockIndicesDirty = !1, n = !0), n && i.bindBuffer(i.UNIFORM_BUFFER, null); 11538 } 11539 bind(e1, t1) { 11540 const i = e1.gl, n = (e1, n, r)=>{ 11541 if (!n) return; 11542 const o = i.getUniformBlockIndex(t1, e1); 11543 o !== i.INVALID_INDEX && (i.uniformBlockBinding(t1, o, r), i.bindBufferBase(i.UNIFORM_BUFFER, r, n)); 11544 }, r = 3 * this.batchIndex; 11545 n("SymbolPaintPropertiesHeaderUniform", this.headerBuffer, r), n("SymbolPaintPropertiesUniform", this.propertiesBuffer, r + 1), n("SymbolPaintPropertiesIndexUniform", this.blockIndicesBuffer, r + 2); 11546 } 11547 destroy() { 11548 if (this.context) { 11549 const e1 = this.context.gl; 11550 this.headerBuffer && (e1.deleteBuffer(this.headerBuffer), this.headerBuffer = null), this.propertiesBuffer && (e1.deleteBuffer(this.propertiesBuffer), this.propertiesBuffer = null), this.blockIndicesBuffer && (e1.deleteBuffer(this.blockIndicesBuffer), this.blockIndicesBuffer = null); 11551 } 11552 } 11553 constructor(e1, t1, i, n){ 11554 this.batchIndex = t1, this.headerBuffer = null, this.propertiesBuffer = null, this.blockIndicesBuffer = null, this.context = e1 || null, this.propsDwords = i, this.totalBytes = 4 * this.propsDwords, this.headerData = n, this.propertiesData = new Float32Array(this.propsDwords), this._headerDirty = !0, this._propsDirtyMin = -1, this._propsDirtyMax = -1, this._blockIndicesDirty = !0, e1 && this._initBuffers(e1); 11555 } 11556 }; 11557 Vd.HEADER_DWORDS = 16, Vd.HEADER_BYTES = 64, Vd.EVAL_FLAT_OFFSETS = [ 11558 0, 11559 8, 11560 16, 11561 20, 11562 24, 11563 28, 11564 32, 11565 36, 11566 40 11567 ], Vd.EVAL_FLAT_TOTAL = 48, Vd._blockIndicesTemplate = null; 11568 let Nd = Vd; 11569 function kd(e1, t1, i, n, r, o, a, s) { 11570 return !!e1 && ("constant" === e1.kind ? "none" === e1.value : "none" === e1.evaluate({ 11571 zoom: 0, 11572 brightness: o, 11573 worldview: s 11574 }, t1, i, r, n, a)); 11575 } 11576 function Ud(e1) { 11577 if (!(e1 instanceof Ks)) return !1; 11578 const t1 = e1.value; 11579 return ("source" === t1.kind || "composite" === t1.kind) && t1.isStateDependent; 11580 } 11581 Xa(Nd, "SymbolPropertiesUBO", { 11582 omit: [ 11583 "headerBuffer", 11584 "propertiesBuffer", 11585 "blockIndicesBuffer" 11586 ] 11587 }); 11588 const jd = [ 11589 "icon", 11590 "text" 11591 ].map((e1)=>[ 11592 "".concat(e1, "-color"), 11593 "".concat(e1, "-halo-color"), 11594 "".concat(e1, "-opacity"), 11595 "".concat(e1, "-halo-width"), 11596 "".concat(e1, "-halo-blur"), 11597 "".concat(e1, "-emissive-strength"), 11598 "".concat(e1, "-occlusion-opacity"), 11599 "symbol-z-offset", 11600 "".concat(e1, "-translate") 11601 ]), Gd = new Float32Array(Nd.EVAL_FLAT_TOTAL), Hd = [ 11602 0, 11603 0 11604 ], $d = new WeakMap; 11605 class Zd { 11606 updateHeader() { 11607 const e1 = this.layer.paint; 11608 let t1 = 0, i = 0, n = 0, r = 0, o = !0; 11609 const a = this._floorZoom, s = jd[+this.isText]; 11610 for(let l = 0; l < 9; l++){ 11611 const c = s[l], u = l < 2, h = e1.get(c), d = !(!h || "function" != typeof h.isConstant || h.isConstant()), f = this._appearancesHavePaintProperties(c); 11612 if (!d && !f) { 11613 const e1 = this._layerUnevaluated(c); 11614 e1 && e1.expression && "camera" === e1.expression.kind && (n |= 1 << l); 11615 continue; 11616 } 11617 t1 |= 1 << l; 11618 const p = this._collectZoomSignatures(c, a), m = p.hasZ
vendor: 4,588 bytes, lines 11618-11691
11618oom, _ = p.differs, g = 8 === l; 11619 this.zoomDependency[l] = _ ? 2 : m ? 1 : 0; 11620 const y = _ || g && m; 11621 y && (i |= 1 << l); 11622 const x = h && h.value; 11623 x && !1 === x.isLightConstant && (o = !1), this.header[3 + l] = r, r += y ? 2 : 1, m && !_ && p.representative && (this._computeZoomRange(p.representative, a, this.sharedZoomRanges, 2 * l), u && (this.header[12 + 2 * l] = Bd(this.sharedZoomRanges[2 * l]), this.header[12 + 2 * l + 1] = Bd(this.sharedZoomRanges[2 * l + 1]))); 11624 } 11625 this.header[0] = t1, this.header[1] = i, this.header[2] = r, this.isLightConstant = o, this.cameraMask = n; 11626 } 11627 _recomputeSharedRanges() { 11628 const e1 = this._floorZoom, t1 = jd[+this.isText]; 11629 let i = 0, n = !1; 11630 for(let r = 0; r < 9; r++){ 11631 const o = t1[r], a = this.zoomDependency[r]; 11632 if (this.header[0] & 1 << r) { 11633 if (0 !== a && 2 !== a) { 11634 const t1 = this._collectZoomSignatures(o, e1); 11635 t1.representative && (this._computeZoomRange(t1.representative, e1, this.sharedZoomRanges, 2 * r), r < 2 && (this.header[12 + 2 * r] = Bd(this.sharedZoomRanges[2 * r]), this.header[12 + 2 * r + 1] = Bd(this.sharedZoomRanges[2 * r + 1]), n = !0)); 11636 } 11637 } else { 11638 const e1 = this._layerUnevaluated(o); 11639 e1 && e1.expression && "camera" === e1.expression.kind && (i |= 1 << r); 11640 } 11641 } 11642 if (this.cameraMask = i, n) for (const e1 of this.ubos)e1.markHeaderDirty(); 11643 } 11644 _collectZoomSignatures(e1, t1) { 11645 let i = !1, n = !1, r = null, o = 0, a = 0; 11646 const s = (e1)=>{ 11647 if (!e1) return; 11648 this._computeZoomRange(e1, t1, this._zoomRangeScratch, 0); 11649 const s = this._zoomRangeScratch[0], l = this._zoomRangeScratch[1]; 11650 i ? s === o && l === a || (n = !0) : (i = !0, o = s, a = l, r = e1); 11651 }; 11652 s(this._zoomExprOf(this._layerUnevaluated(e1))); 11653 for (const t1 of this.layer.getAppearances() || [])t1.hasPaintProperty(e1) && s(this._zoomExprOf(t1.getUnevaluatedPaintProperty(e1))); 11654 return { 11655 hasZoom: i, 11656 differs: n, 11657 representative: r 11658 }; 11659 } 11660 evaluateAllProperties(e1, t1, i, n, r, o, a) { 11661 const s = { 11662 brightness: r, 11663 worldview: this.worldview 11664 }, l = { 11665 feature: e1, 11666 featureState: t1, 11667 canonical: i, 11668 availableImages: n, 11669 params: new $s(this.zoom, s), 11670 paramsNext: new $s(this.zoom + 1, s), 11671 formattedSection: o, 11672 activeAppearance: a 11673 }, c = jd[+this.isText]; 11674 for(let e1 = 0; e1 < 9; e1++){ 11675 const t1 = c[e1], i = e1 < 2, n = 8 === e1, r = this.zoomDependency[e1], o = 0 !== r, a = 2 === r, s = Nd.EVAL_FLAT_OFFSETS[e1], u = s + (i || n ? 4 : 2); 11676 i ? this._evaluateColorValue(t1, e1, o, a, u, l, s) : n ? this._evaluateTranslateValue(t1, e1, o, a, u, l, s) : this._evaluateFloatValue(t1, e1, o, a, u, l, s); 11677 } 11678 return Gd; 11679 } 11680 _resolveProp(e1, t1) { 11681 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, n = arguments.length > 3 ? arguments[3] : void 0; 11682 const r = this.layer.paint, o = r.get(e1), a = e1, s = !(!t1 || !t1.hasPaintProperty(a)), l = s ? n && o && o.property.overrides && o.property.overrides.hasOverride(n) ? o : t1.paintProperties.get(a) : r.get(e1); 11683 if (i || !l || "function" != typeof l.isConstant || !l.isConstant()) return l; 11684 const c = s ? t1.getUnevaluatedPaintProperty(a) : this._layerUnevaluated(e1); 11685 return this._unbakeCamera(l, c); 11686 } 11687 _unbakeCamera(e1, t1) { 11688 const i = t1 && t1.expression; 11689 if (!i || "camera" !== i.kind) return e1; 11690 let n = $d.get(t1); 11691 return n || (n = new Ks(e1.property, i, e1.parameters, e1.iconImageUseTheme), $d.set(t1, n)
11691), n; 11692 } 11693 _layerUnevaluated(e1) { 11694 const t1 = this.layer._transitionablePaint._values[e1]; 11695 return t1 && t1.value; 11696 } 11697 _zoomExprOf(e1) { 11698 const t1 = e1 && e1.expression; 11699 return !t1 || "composite" !== t1.kind && "camera" !== t1.kind ? null : t1; 11700 } 11701 _evalAt(e1, t1, i) { 11702 return e1.property.evaluate(e1.value, t1, i.feature, i.featureState, i.canonical, i.availableImages, e1.iconImageUseTheme, i.formattedSection); 11703 } 11704 _evaluateColorValue(e1, t1, i, n, r, o, a) { 11705 const s = this._resolveProp(e1, o.activeAppearance, !1, o.formattedSection); 11706 if (this._writePropertyZoomRange(t1, i, n, s, r), !s) return Gd[a] = 0, Gd[a + 1] = 0, Gd[a + 2] = 0, void (Gd[a + 3] = 1); 11707 const l = this._resolveProp("".concat(e1, "-use-theme"), o.activeAppearance, !0), c = kd(l && "string" != typeof l ? l.value : void 0, o.feature, o.featureState, o.availableImages, o.canonical, o.params.brightness, o.formattedSection, this.worldview) ? null : this.lut, u = (s.isConstant() ? s.constantOr(mn.transparent) : this._evalAt(s, o.params, o) || mn.transparent).toNonPremultipliedRenderColor(c); 11708 if (Gd[a] = Gu(255 * u.r, 255 * u.g), Gd[a + 1] = Gu(255 * u.b, 255 * u.a), i) { 11709 const e1 = (this._evalAt(s, o.paramsNext, o) || mn.transparent).toNonPremultipliedRenderColor(c); 11710 Gd[a + 2] = Gu(255 * e1.r, 255 * e1.g), Gd[a + 3] = Gu(255 * e1.b, 255 * e1.a); 11711 } else Gd[a + 2] = Gd[a], Gd[a + 3] = Gd[a + 1]; 11712 } 11713 _computeZoomRange(e1, t1, i, n) { 11714 let r = 0, o = 1; 11715 const a = !e1 || "composite" !== e1.kind && "camera" !== e1.kind ? null : e1.zoomStops; 11716 if (a && a.length > 0) if (null == e1.interpolationType) { 11717 r = o = 1; 11718 for (const e1 of a)if (e1 > t1 && e1 < t1 + 1) { 11719 r = o = e1 - t1; 11720 break; 11721 } 11722 } else a[0] > t1 && a[0] < t1 + 1 && (r = a[0] - t1); 11723 i[n] = r, i[n + 1] = o; 11724 } 11725 _writeZoomRange(e1, t1) { 11726 this._computeZoomRange(e1 && e1.value, this._floorZoom, Gd, t1); 11727 } 11728 _writePropertyZoomRange(e1, t1, i, n, r) { 11729 i ? this._writeZoomRange(n, r) : t1 ? (Gd[r] = this.sharedZoomRanges[2 * e1], Gd[r + 1] = this.sharedZoomRanges[2 * e1 + 1]) : (Gd[r] = 0, Gd[r + 1] = 0); 11730 } 11731 _evaluateFloatValue(e1, t1, i, n, r, o, a) { 11732 var _ref; 11733 const s = e1.endsWith("opacity") ? 1 : 0, l = this._resolveProp(e1, o.activeAppearance); 11734 this._writePropertyZoomRange(t1, i, n, l, r); 11735 const c = (_ref = l ? l.isConstant() ? l.constantOr(s) : this._evalAt(l, o.params, o) : s) !== null && _ref !== void 0 ? _ref : s; 11736 if (Gd[a] = c, i) { 11737 const e1 = this._evalAt(l, o.paramsNext, o); 11738 Gd[a + 1] = e1 !== null && e1 !== void 0 ? e1 : s; 11739 } else Gd[a + 1] = c; 11740 } 11741 _evaluateTranslateValue(e1, t1, i, n, r, o, a) { 11742 const s = this._resolveProp(e1, o.activeAppearance); 11743 this._writePropertyZoomRange(t1, i, n, s, r); 11744 const l = !!s && "function" == typeof s.isConstant && !s.isConstant(), c = s ? "function" != typeof s.isConstant ? s : l ? this._evalAt(s, o.params, o) : s.constantOr(Hd) : void 0; 11745 if (Gd[a] = c ? c[0] : 0, Gd[a + 1] = c ? c[1] : 0, i) { 11746 const e1 = l ? this._evalAt(s, o.paramsNext, o) : c; 11747 Gd[a + 2] = e1 ? e1[0] : 0, Gd[a + 3] = e1 ? e1[1] : 0; 11748 } else Gd[a + 2] = Gd[a], Gd[a + 3] = Gd[a + 1]; 11749 } 11750 _appearancesHavePaintProperties(e1) { 11751 return this.layer.getAppearances().some((t1)=>t1.hasPaintProperty(e1)); 11752 } 11753 hasStateDependentPaint(e1) { 11754 const t1 = e1.paint, i = jd[+this.isText]; 11755 for (const e1 of i)if (Ud(t1.get(e1))) return !0; 11756 for (const t1 of e1.getAppearances() || [])for (const e1 of i){ 11757 const i = e1; 11758 if (t1.hasPaintProperty(i) && Ud(t1.paintProperties.get(i))) return !0; 11759 } 11760 return !1; 11761 } 11762 hasPerFeatureTranslate() { 11763 return !!(256 & this.header[0]); 11764 } 11765 getCurrentBatchIndex() { 11766 return 0 === this.maxFeaturesPerBatch ? 0 : Math.floor(this.featureCount / this.maxFeaturesPerBatch); 11767 } 11768 _writeFeatureBlock(e1, t1) { 11769 const i = this.isAllConstant ? 0 : e1; 11770 let n = Math.floor(i / this.maxFeaturesPerBatch), r = i % this.maxFeaturesPerBatch; 11771 this._batchExceedsDeviceLimit(n) && (n = 0, r = 0); 11772 const o = this.ubos[n]; 11773 return !!o && (o.writeDataDrivenBlock(t1, r), !0); 11774 } 11775 _batchExceedsDeviceLimit(e1) { 11776 return 3 * e1 + 2 >= this.maxUniformBufferBindings; 11777 } 11778 _reevaluateAt(e1, t1, i, n, r, o) { 11779 if (!t1) return; 11780 const a = this.allFeatureVtIndices[e1], s = t1.feature(a); 11781 if (!s) return; 11782 const l = this.allFeatureIds[e1], c = null != l && r[l] || {}, u = { 11783 type: s.type, 11784 id: l, 11785 properties: s.properties || {}, 11786 geometry: [] 11787 }, h = this.activeAppearanceByVtIndex ? this.activeAppearanceByVtIndex.get(a) : void 0, d = this.evaluateAllProperties(u,
11787c, i, n, o, (this.allFormattedSections ? this.allFormattedSections[e1] : void 0) || void 0, h); 11788 this._writeFeatureBlock(e1, d); 11789 } 11790 _ensureRangeMaps() { 11791 if (!this.featureVertexRangesFromId) { 11792 this.featureVertexRangesFromId = new Map, this.featureVertexRangesFromVtIndex = new Map; 11793 for(let e1 = 0; e1 < this.allFeatureVtIndices.length; e1++){ 11794 const t1 = this.allFeatureIds[e1]; 11795 if (null != t1) { 11796 let i = this.featureVertexRangesFromId.get(t1); 11797 i || this.featureVertexRangesFromId.set(t1, i = []), i.push(e1); 11798 } 11799 const i = this.allFeatureVtIndices[e1]; 11800 let n = this.featureVertexRangesFromVtIndex.get(i); 11801 n || this.featureVertexRangesFromVtIndex.set(i, n = []), n.push(e1); 11802 } 11803 } 11804 } 11805 populateUBO(e1, t1, i, n, r, o) { 11806 const a = e1.id, s = this.header, l = this.evaluateAllProperties(e1, {}, i, n, r, o); 11807 let c, u; 11808 this.isAllConstant ? (c = 0, u = 0 === this.featureCount, u && (this.featureCount = 1)) : (c = this.featureCount++, u = !0); 11809 let h = Math.floor(c / this.maxFeaturesPerBatch), d = c % this.maxFeaturesPerBatch; 11810 return u && (this._batchExceedsDeviceLimit(h) ? (gt("Too many symbol features: batch ".concat(h, " requires binding points up to ").concat(3 * h + 2, ", device limit ").concat(this.maxUniformBufferBindings, ". Some features will render incorrectly.")), h = 0, d = 0) : (this.ubos[h] || (this.ubos[h] = new Nd(null, h, this.uboSizeDwords, s)), this.ubos[h].writeDataDrivenBlock(l, d))), this.allFeatureVtIndices.push(t1), this.allFeatureIds.push(a), this.allFormattedSections.push(o || null), d; 11811 } 11812 updateFeatures(e1, t1, i, n, r, o, a) { 11813 this.layer = t1, this.cachedConstantUniforms = null, this._ensureRangeMaps(); 11814 for (const t1 of e1){ 11815 const e1 = this.featureVertexRangesFromId.get(t1); 11816 if (e1) for (const t1 of e1)this._reevaluateAt(t1, i, n, r, o, a); 11817 } 11818 } 11819 updateDynamicExpressions(e1, t1, i, n, r, o) { 11820 if (this.layer = e1, this.cachedConstantUniforms = null, this._recomputeSharedRanges(), 0 !== this.header[0]) for(let e1 = 0; e1 < this.allFeatureVtIndices.length; e1++)this._reevaluateAt(e1, t1, i, n, r, o); 11821 } 11822 updateFeaturePaintForAppearance(e1, t1, i, n, r, o, a) { 11823 if (!this.layer) return !1; 11824 if (this.activeAppearanceByVtIndex || (this.activeAppearanceByVtIndex = new Map), this.activeAppearanceByVtIndex.set(e1, a || null), 0 === this.header[0]) return !1; 11825 this._ensureRangeMaps(); 11826 const s = this.featureVertexRangesFromVtIndex.get(e1); 11827 if (!s) return !1; 11828 let l = !1; 11829 for (const e1 of s){ 11830 const s = this.evaluateAllProperties(t1, i, n, r, o, (this.allFormattedSections ? this.allFormattedSections[e1] : void 0) || void 0, a); 11831 l = this._writeFeatureBlock(e1, s) || l; 11832 } 11833 return l; 11834 } 11835 getConstantUniformValues(e1, t1) { 11836 const i = !!this.cameraMask; 11837 if (this.cachedConstantUniforms && this.cachedConstantPaint === this.layer.paint && this.cachedConstantBrightness === t1 && (!i || this.cachedConstantRenderZoom === e1)) return this.cachedConstantUniforms; 11838 const n = this.layer.paint, r = i ? new $s(e1, { 11839 brightness: t1, 11840 worldview: this.worldview 11841 }) : null, o = { 11842 type: 1, 11843 id: void 0, 11844 properties: {}, 11845 geometry: [] 11846 }, a = jd[+this.isText], s = (e1)=>{ 11847 const i = a[e1], s = n.get(i); 11848 if (!s) return [ 11849 0, 11850 0, 11851 0, 11852 1 11853 ]; 11854 const l = n.get("".concat(i, "-use-theme")), c = kd(l && "string" != typeof l ? l.value : void 0, o, {}, [], void 0, t1, void 0, this.worldview) ? null : this.lut; 11855 return (this.cameraMask & 1 << e1 && r ? s.property.evaluate(s.value, r, o, {}, void 0, []) || mn.transparent : s.constantOr(mn.transparent)).toNonPremultipliedRenderColor(c).toArray01(); 11856 }, l = (e1, t1)=>{ 11857 var _i_property_evaluate; 11858 const i = n.get(a[e1]); 11859 return i ? this.cameraMask & 1 << e1 && r ? (_i_property_evaluate = i.property.evaluate(i.value, r, o, {}, void 0, [])) !== null && _i_property_evaluate !== void 0 ? _i_property_evaluate : t1 : i.constantOr(t1) : t1; 11860 }, c = { 11861 fill_np_color: s(0), 11862 halo_np_color: s(1), 11863 opacity: l(2, 1), 11864 halo_width: l(3, 0), 11865 halo_blur: l(4, 0),
11866 emissive_strength: l(5, 0), 11867 occlusion_opacity: l(6, 1), 11868 z_offset: l(7, 0) 11869 }; 11870 return this.cachedConstantUniforms = c, this.cachedConstantRenderZoom = e1, this.cachedConstantBrightness = t1, this.cachedConstantPaint = this.layer.paint, c; 11871 } 11872 finalize() { 11873 for (const e1 of this.ubos)e1.rightSizeForTransfer(); 11874 } 11875 upload(e1) { 11876 for (const t1 of this.ubos)t1.upload(e1); 11877 } 11878 bind(e1, t1) { 11879 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; 11880 this.ubos[i] && this.ubos[i].bind(e1, t1); 11881 } 11882 destroy() { 11883 for (const e1 of this.ubos)e1.destroy(); 11884 this.ubos = [], this.featureVertexRangesFromId = null, this.featureVertexRangesFromVtIndex = null, this.allFeatureVtIndices = [], this.allFeatureIds = [], this.featureCount = 0, this.maxFeaturesPerBatch = 0; 11885 } 11886 constructor(e1, t1, i, n, r = "", o, a){ 11887 this.layer = e1, this.zoom = t1, this.lut = i, this.isText = n, this.worldview = r, this.maxUniformBufferBindings = o || 24, this.uboSizeDwords = a || 4096, this.allFeatureVtIndices = [], this.allFeatureIds = [], this.allFormattedSections = [], this.featureVertexRangesFromId = null, this.featureVertexRangesFromVtIndex = null, this.ubos = [], this.featureCount = 0, this.cachedConstantUniforms = null, this.cachedConstantRenderZoom = null, this.cachedConstantBrightness = void 0, this.cachedConstantPaint = null, this.activeAppearanceByVtIndex = null, this.zoomDependency = new Uint8Array(9), this.sharedZoomRanges = new Float32Array(18), this._zoomRangeScratch = new Float32Array(2), this._floorZoom = Math.floor(this.zoom), this.header = new Uint32Array(Nd.HEADER_DWORDS), this.updateHeader(), this.isAllConstant = 0 === this.header[0]; 11888 const s = 4 * this.header[2]; 11889 this.maxFeaturesPerBatch = 0 === s ? Number.MAX_SAFE_INTEGER : Math.floor(this.uboSizeDwords / s); 11890 } 11891 } 11892 Xa(Zd, "SymbolPropertyBinderUBO", { 11893 omit: [ 11894 "layer", 11895 "cachedConstantUniforms", 11896 "cachedConstantRenderZoom", 11897 "cachedConstantBrightness", 11898 "cachedConstantPaint", 11899 "activeAppearanceByVtIndex", 11900 "featureVertexRangesFromId", 11901 "featureVertexRangesFromVtIndex" 11902 ] 11903 }); 11904 const Wd = 24; 11905 function qd(e1, t1, i) { 11906 return e1.sections.forEach((e1)=>{ 11907 e1.text = function(e1, t1, i) { 11908 const n = t1.layout.get("text-transform").evaluate(i, {}); 11909 return "uppercase" === n ? e1 = e1.toLocaleUpperCase() : "lowercase" === n && (e1 = e1.toLocaleLowerCase()), Hs.applyArabicShaping && (e1 = Hs.applyArabicShaping(e1)), e1; 11910 }(e1.text, t1, i); 11911 }), e1; 11912 } 11913 const Xd = { 11914 horizontal: 1, 11915 vertical: 2, 11916 horizontalOnly: 3 11917 }; 11918 function Yd(e1) { 11919 let t1 = .5, i = .5; 11920 switch(e1){ 11921 case "right": 11922 case "top-right": 11923 case "bottom-right": 11924 t1 = 1; 11925 break; 11926 case "left": 11927 case "top-left": 11928 case "bottom-left": 11929 t1 = 0; 11930 } 11931 switch(e1){ 11932 case "bottom": 11933 case "bottom-right": 11934 case "bottom-left": 11935 i = 1; 11936 break; 11937 case "top": 11938 case "top-right": 11939 case "top-left": 11940 i = 0; 11941 } 11942 return { 11943 horizontalAlign: t1, 11944 verticalAlign: i 11945 }; 11946 } 11947 function Jd(e1, t1, i, n) { 11948 const { horizontalAlign: r, verticalAlign: o } = Yd(n), a = i[0] - e1.displaySize[0] * r, s = i[1] - e1.displaySize[1] * o; 11949 return { 11950 imagePrimary: e1, 11951 imageSecondary: t1, 11952 top: s, 11953 bottom: s + e1.displaySize[1], 11954 left: a, 11955 right: a + e1.displaySize[0] 11956 }; 11957 } 11958 function Kd(e1, t1, i, n, r, o) { 11959 const a = e1.imagePrimary; 11960 let s; 11961 if (a.content) { 11962 const e1 = a.content, t1 = a.pixelRatio || 1; 11963 s = [ 11964 e1[0] / t1, 11965 e1[1] / t1,
11966 a.displaySize[0] - e1[2] / t1, 11967 a.displaySize[1] - e1[3] / t1 11968 ]; 11969 } 11970 const l = t1.left * o, c = t1.right * o; 11971 let u, h, d, f; 11972 "width" === i || "both" === i ? (f = r[0] + l - n[3], h = r[0] + c + n[1]) : (f = r[0] + (l + c - a.displaySize[0]) / 2, h = f + a.displaySize[0]); 11973 const p = t1.top * o, m = t1.bottom * o; 11974 return "height" === i || "both" === i ? (u = r[1] + p - n[0], d = r[1] + m + n[2]) : (u = r[1] + (p + m - a.displaySize[1]) / 2, d = u + a.displaySize[1]), { 11975 imagePrimary: a, 11976 imageSecondary: void 0, 11977 top: u, 11978 right: h, 11979 bottom: d, 11980 left: f, 11981 collisionPadding: s 11982 }; 11983 } 11984 const Qd = { 11985 "!": "ï¸", 11986 "#": "ï¼", 11987 $: "ï¼", 11988 "%": "ï¼ ", 11989 "&": "ï¼", 11990 "(": "︵", 11991 ")": "︶", 11992 "*": "ï¼", 11993 "+": "ï¼", 11994 ",": "ï¸", 11995 "-": "︲", 11996 ".": "ã»", 11997 "/": "ï¼", 11998 ":": "ï¸", 11999 ";": "ï¸", 12000 "<": "︿", 12001 "=": "ï¼", 12002 ">": "ï¹", 12003 "?": "ï¸", 12004 "@": "ï¼ ", 12005 "[": "ï¹", 12006 "\\": "ï¼¼", 12007 "]": "ï¹", 12008 "^": "ï¼¾", 12009 _: "︳", 12010 "`": "ï½", 12011 "{": "︷", 12012 "|": "â", 12013 "}": "︸", 12014 "~": "ï½", 12015 "¢": "ï¿ ", 12016 "£": "ï¿¡", 12017 "Â¥": "ï¿¥", 12018 "¦": "¦", 12019 "¬": "ï¿¢", 12020 "¯": "ï¿£", 12021 "â": "︲", 12022 "â": "︱", 12023 "â": "ï¹", 12024 "â": "ï¹", 12025 "â": "ï¹", 12026 "â": "ï¹", 12027 "â¦": "ï¸", 12028 "â§": "ã»", 12029 "â©": "₩", 12030 "ã": "ï¸", 12031 "ã": "ï¸", 12032 "ã": "︿", 12033 "ã": "ï¹", 12034 "ã": "︽", 12035 "ã": "︾", 12036 "ã": "ï¹", 12037 "ã": "ï¹", 12038 "ã": "ï¹", 12039 "ã": "ï¹", 12040 "ã": "︻", 12041 "ã": "︼", 12042 "ã": "︹", 12043 "ã": "︺", 12044 "ã": "ï¸", 12045 "ã": "ï¸", 12046 "ï¼": "ï¸", 12047 "ï¼": "︵", 12048 "ï¼": "︶", 12049 "ï¼": "ï¸", 12050 "ï¼": "︲", 12051 "ï¼": "ã»", 12052 "ï¼": "ï¸", 12053 "ï¼": "ï¸", 12054 "ï¼": "︿", 12055 "ï¼": "ï¹", 12056 "ï¼": "ï¸", 12057 "ï¼»": "ï¹", 12058 "ï¼½": "ï¹", 12059 "_": "︳", 12060 "ï½": "︷", 12061 "ï½": "â", 12062 "ï½": "︸", 12063 "ï½": "︵", 12064 "ï½ ": "︶", 12065 "。": "ï¸", 12066 "ï½¢": "ï¹", 12067 "ï½£": "ï¹" 12068 }; 12069 function ef(e1) { 12070 return "︶" === e1 || "ï¹" === e1 || "︸" === e1 || "ï¹" === e1 || "ï¹" === e1 || "︾" === e1 || "︼" === e1 || "︺" === e1 || "ï¸" === e1 || "ï¹" === e1 || "ï¸" === e1 || "ï¸" === e1 || "ï¸" === e1 || "ï½" === e1 || "ï¿£" === e1 || "ï¸" === e1 || "ï¸" === e1; 12071 } 12072 function tf(e1) { 12073 return "︵" === e1 || "ï¹" === e1 || "︷" === e1 || "ï¹" === e1 || "ï¹" === e1 || "︽" === e1 || "︻" === e1 || "︹" === e1 || "ï¸" === e1 || "︿" === e1; 12074 } 12075 const nf = 128; 12076 function rf(e1, t1, i, n) { 12077 const { expression: r } = t1; 12078 if ("constant" === r.kind) return { 12079 kind: "constant", 12080 layoutSize: r.evaluate(new $s(e1 + 1, { 12081 worldview: i 12082 }), void 0, void 0, void 0, n) 12083 }; 12084 if ("source" === r.kind) return { 12085 kind: "source" 12086 }; 12087 { 12088 const { zoomStops: t1, interpolationType: o } = r; 12089 let a = 0; 12090 for(; a < t1.length && t1[a] <= e1;)a++; 12091 a = Math.max(0, a - 1); 12092 let s = a; 12093 for(; s < t1.length && t1[s] < e1 + 1;)s++; 12094 s = Math.min(t1.length - 1, s); 12095 const l = t1[a], c = t1[s]; 12096 return "composite" === r.kind ? { 12097 kind: "composite", 12098 minZoom: l, 12099 maxZoom: c, 12100 interpolationType: o 12101 } : { 12102 kind: "camera", 12103 minZoom: l, 12104 maxZoom: c, 12105 minSize: r.evaluate(new $s(l, { 12106 worldview: i 12107 }), void 0, void 0, void 0, n), 12108 maxSize: r.evaluate(new $s(c, { 12109 worldview: i 12110 }), void 0, void 0, void 0, n), 12111 interpolationType: o 12112 }; 12113 } 12114 } 12115 function of(e1, param, param1) { 12116 let { uSize: t1, uSizeT: i } = param, { lowerSize: n, upperSize: r } = param1; 12117 return "source" === e1.kind ? n / nf : "composite" === e1.kind ? fn(n / nf, r / nf, i) : t1; 12118 } 12119 function af(e1, t1) { 12120 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; 12121 let n = 0, r = 0; 12122 if ("constant" === e1.kind) r = e1.layoutSize * i; 12123 else if ("source" !== e1.kind) {
12124 const { interpolationType: o, minZoom: a, maxZoom: s } = e1, l = o ? it(Wo.interpolationFactor(o, t1, a, s), 0, 1) : 0; 12125 "camera" === e1.kind ? r = fn(e1.minSize, e1.maxSize, l) * i : n = l * i; 12126 } 12127 return { 12128 uSizeT: n, 12129 uSize: r 12130 }; 12131 } 12132 const sf = Number.POSITIVE_INFINITY, lf = Math.sqrt(2), cf = 32640; 12133 function uf(e1, t1, i, n, r, o, a) { 12134 const s = e1.hasLayoutProperty(r) ? t1.getAppearanceValueAndResolveTokens(e1, r, i, n, []) : null; 12135 return (Array.isArray(o) ? Array.isArray(s) : typeof s == typeof o) ? a ? a(s) : s : o; 12136 } 12137 function hf(e1, t1, i, n, r, o, a, s) { 12138 return { 12139 appearanceIconOffset: uf(e1, t1, i, n, "icon-offset", r), 12140 appearanceIconRotate: uf(e1, t1, i, n, "icon-rotate", o), 12141 appearanceIconSize: uf(e1, t1, i, n, "icon-size", a, (e1)=>e1 * s) 12142 }; 12143 } 12144 function df(e1, t1, i, n, r, o, a) { 12145 const s = uf(e1, t1, i, n, "text-offset", r, (param)=>{ 12146 let [e1, t1] = param; 12147 return [ 12148 e1 * Wd, 12149 t1 * Wd 12150 ]; 12151 }); 12152 return { 12153 appearanceTextOffset: s, 12154 appearanceTextRotate: uf(e1, t1, i, n, "text-rotate", o), 12155 appearanceTextSize: uf(e1, t1, i, n, "text-size", a) 12156 }; 12157 } 12158 function ff(e1, t1, i, n, r, o, a, s, l, c) { 12159 if (!e1) return; 12160 const u = function(e1, t1, i, n, r, o, a) { 12161 if ("camera" === e1.kind) return e1.maxSize; 12162 if ("composite" === e1.kind) { 12163 const n = t1.possiblyEvaluate(new $s(e1.maxZoom, { 12164 worldview: o 12165 }), i, a).evaluate(r, {}, i, a), s = t1.possiblyEvaluate(new $s(e1.minZoom, { 12166 worldview: o 12167 }), i, a).evaluate(r, {}, i, a); 12168 return Math.max(n, s); 12169 } 12170 return t1.possiblyEvaluate(new $s(n, { 12171 worldview: o 12172 }), i, a).evaluate(r, {}, i, a); 12173 }(t1, i, n, r, o, l, c); 12174 return e1.scaleSelf(u * s * a); 12175 } 12176 function pf(e1, t1, i, n, r, o, a, s, l, c) { 12177 return { 12178 iconPrimary: ff(e1.getPrimary(), t1, i, n, r, o, a, s, l, c), 12179 iconSecondary: ff(e1.getSecondary(), t1, i, n, r, o, a, s, l, c) 12180 }; 12181 } 12182 function mf(e1, t1) { 12183 return e1 * t1 / 24; 12184 } 12185 function _f(e1, t1, i, n, r, o) { 12186 let a = null; 12187 return "source" === t1.kind ? (a = [ 12188 nf * i * n 12189 ], a[0] > cf && gt("".concat(e1, ': Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".'))) : "composite" === t1.kind && (a = [ 12190 nf * r * n, 12191 nf * o * n 12192 ], (a[0] > cf || a[1] > cf) && gt("".concat(e1, ': Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".'))), a; 12193 } 12194 const gf = kc([ 12195 { 12196 type: "Float32", 12197 name: "a_globe_pos", 12198 components: 3 12199 }, 12200 { 12201 type: "Float32", 12202 name: "a_uv", 12203 components: 2 12204 } 12205 ]), { members: yf } = gf, xf = kc([ 12206 { 12207 name: "a_pos_3", 12208 components: 3, 12209 type: "Int16" 12210 } 12211 ]); 12212 var vf = kc([ 12213 { 12214 name: "a_pos", 12215 type: "Int16", 12216 components: 2 12217 } 12218 ]); 12219 class bf { 12220 intersectsPlane(e1, t1, i) { 12221 const n = Se(t1, this.dir); 12222 if (Math.abs(n) < 1e-6) return !1; 12223 const r = ((e1[0] - this.pos[0]) * t1[0] + (e1[1] - this.pos[1]) * t1[1]) / n; 12224 return i[0] = this.pos[0] + this.dir[0] * r, i[1] = this.pos[1] + this.dir[1] * r, !0; 12225 } 12226 constructor(e1, t1){ 12227 this.pos = e1, this.dir = t1; 12228 } 12229 } 12230 class wf { 12231 intersectsPlane(e1, t1, i) { 12232 const n = W(t1, this.dir); 12233 if (Math.abs(n) < 1e-6) return !1; 12234 const r = ((e1[0] - this.pos[0]) * t1[0] + (e1[1] - this.pos[1]) * t1[1] + (e1[2] - this.pos[2]) * t1[2]) / n; 12235 return i[0] = this.pos[0] + this.dir[0] * r, i[1] = this.pos[1] + this.dir[1] * r, i[2] = this.pos[2] + this.dir[2] * r, !0; 12236 } 12237 closestPointOnSphere(e1, t1, i) { 12238 if (function(e1, t1) { 12239 var i = e1[0], r = e1[1], o = e1[2], a = t1[0], s = t1[1], l = t1[2]; 12240 return Math.abs(i - a) <= n * Math.max(1, Math.abs(i), Math.abs(a)
12240) && Math.abs(r - s) <= n * Math.max(1, Math.abs(r), Math.abs(s)) && Math.abs(o - l) <= n * Math.max(1, Math.abs(o), Math.abs(l)); 12241 }(this.pos, e1) || 0 === t1) return i[0] = i[1] = i[2] = 0, !1; 12242 const [r, o, a] = this.dir, s = this.pos[0] - e1[0], l = this.pos[1] - e1[1], c = this.pos[2] - e1[2], u = r * r + o * o + a * a, h = 2 * (s * r + l * o + c * a), d = h * h - 4 * u * (s * s + l * l + c * c - t1 * t1); 12243 if (d < 0) { 12244 const e1 = Math.max(-h / 2, 0), n = s + r * e1, u = l + o * e1, d = c + a * e1, f = Math.hypot(n, u, d); 12245 return i[0] = n * t1 / f, i[1] = u * t1 / f, i[2] = d * t1 / f, !1; 12246 } 12247 { 12248 const e1 = (-h - Math.sqrt(d)) / (2 * u); 12249 if (e1 < 0) { 12250 const e1 = Math.hypot(s, l, c); 12251 return i[0] = s * t1 / e1, i[1] = l * t1 / e1, i[2] = c * t1 / e1, !1; 12252 } 12253 return i[0] = s + r * e1, i[1] = l + o * e1, i[2] = c + a * e1, !0; 12254 } 12255 } 12256 constructor(e1, t1){ 12257 this.pos = e1, this.dir = t1; 12258 } 12259 } 12260 class Af { 12261 static fromInvProjectionMatrix(e1, t1, i) { 12262 const n = [ 12263 -1, 12264 1, 12265 1 12266 ], r = [ 12267 1, 12268 1, 12269 1 12270 ], o = [ 12271 1, 12272 -1, 12273 1 12274 ], a = [ 12275 -1, 12276 -1, 12277 1 12278 ], s = Y(n, n, e1), l = Y(r, r, e1), c = Y(o, o, e1), u = Y(a, a, e1); 12279 return new Af(s, l, c, u, t1 / i); 12280 } 12281 constructor(e1, t1, i, n, r){ 12282 this.TL = e1, this.TR = t1, this.BR = i, this.BL = n, this.horizon = r; 12283 } 12284 } 12285 function Ef(e1, t1, i, n) { 12286 const r = t1[0], o = t1[1], a = t1[2], s = i[0], l = i[1], c = i[2]; 12287 let u = 1 / 0, h = -1 / 0; 12288 for(let t1 = 0; t1 < e1.length; t1++){ 12289 const i = e1[t1], n = (i[0] - r) * s + (i[1] - o) * l + (i[2] - a) * c; 12290 n < u && (u = n), n > h && (h = n); 12291 } 12292 return n[0] = u, n[1] = h, n; 12293 } 12294 function If(e1, t1) { 12295 let i = !0; 12296 for(let n = 0; n < e1.planes.length; n++){ 12297 const r = e1.planes[n]; 12298 let o = 0; 12299 for(let e1 = 0; e1 < t1.length; e1++)o += +(W(r, t1[e1]) + r[3] >= 0); 12300 if (0 === o) return 0; 12301 o !== t1.length && (i = !1); 12302 } 12303 return i ? 2 : 1; 12304 } 12305 const Mf = [ 12306 0, 12307 0 12308 ]; 12309 function Tf(e1, t1) { 12310 for (const i of e1.projections){ 12311 const n = Ef(t1, e1.points[0], i.axis, Mf); 12312 if (i.projection[1] < n[0] || i.projection[0] > n[1]) return 0; 12313 } 12314 return 1; 12315 } 12316 function Sf(e1, t1) { 12317 const i = t1[0], n = t1[1], r = t1[2], o = t1[3]; 12318 for(let t1 = 0; t1 < e1.length; t1++){ 12319 const a = e1[t1]; 12320 if (i * a[0] + n * a[1] + r * a[2] + o >= 0) return !0; 12321 } 12322 return !1; 12323 } 12324 class zf { 12325 static fromInvProjectionMatrix(e1, t1, i, n) { 12326 const r = Math.pow(2, i), o = [ 12327 [ 12328 -1, 12329 1, 12330 -1, 12331 1 12332 ], 12333 [ 12334 1, 12335 1, 12336 -1, 12337 1 12338 ], 12339 [ 12340 1, 12341 -1, 12342 -1, 12343 1 12344 ], 12345 [ 12346 -1, 12347 -1, 12348 -1, 12349 1 12350 ], 12351 [ 12352 -1, 12353 1, 12354 1, 12355 1 12356 ], 12357 [ 12358 1, 12359 1, 12360 1, 12361 1 12362 ], 12363 [ 12364 1, 12365 -1, 12366 1, 12367 1 12368 ], 12369 [ 12370 -1, 12371 -1, 12372 1, 12373 1 12374 ] 12375 ].map((i)=>{ 12376 const o = le([], i, e1), a = 1 / o[3] / t1 * r; 12377 return (s = o)[0] = (l = o)[0] * (c = [ 12378 a, 12379 a, 12380 n ? 1 / o[3] : a, 12381 a 12382 ])[0], s[1] = l[1] * c[1], s[2] = l[2] * c[2], s[3] = l[3] * c[3], s; 12383 //TURBOPACK unreachable 12384 ; 12385 var s, l, c; 12386 }), a = [ 12387 [ 12388 0, 12389 1, 12390 2 12391 ], 12392 [ 12393 6, 12394 5, 12395 4 12396 ], 12397 [ 12398 0, 12399 3, 12400 7 12401 ], 12402 [ 12403 2, 12404 1, 12405 5 12406 ], 12407 [ 12408 3, 12409 2, 12410 6 12411 ], 12412 [ 12413 0, 12414 4, 12415 5 12416 ] 12417 ].map((e1)=>{ 12418 const t1 = Z([], q([], te([], o[e1[0]], o[e1[1]]), te([], o[e1[2]], o[e1[1]]))), i = -W(t
vendor: 17,633 bytes, lines 12418-12894
124181, o[e1[1]]); 12419 return t1.concat(i); 12420 }), s = []; 12421 for(let e1 = 0; e1 < o.length; e1++)s.push([ 12422 o[e1][0], 12423 o[e1][1], 12424 o[e1][2] 12425 ]); 12426 return new zf(s, a); 12427 } 12428 intersectsPrecise(e1, t1, i) { 12429 for(let i = 0; i < t1.length; i++)if (!Sf(e1, t1[i])) return 0; 12430 for(let t1 = 0; t1 < this.planes.length; t1++)if (!Sf(e1, this.planes[t1])) return 0; 12431 const n = this.points, r = n[0][0], o = n[0][1], a = n[0][2]; 12432 for (const t1 of i)for (const i of this.frustumEdges){ 12433 const s = t1[1] * i[2] - t1[2] * i[1], l = t1[2] * i[0] - t1[0] * i[2], c = t1[0] * i[1] - t1[1] * i[0]; 12434 if (0 === s && 0 === l && 0 === c) continue; 12435 let u = 1 / 0, h = -1 / 0; 12436 for(let e1 = 0; e1 < n.length; e1++){ 12437 const t1 = n[e1], i = (t1[0] - r) * s + (t1[1] - o) * l + (t1[2] - a) * c; 12438 i < u && (u = i), i > h && (h = i); 12439 } 12440 let d = 1 / 0, f = -1 / 0; 12441 for(let t1 = 0; t1 < e1.length; t1++){ 12442 const i = e1[t1], n = (i[0] - r) * s + (i[1] - o) * l + (i[2] - a) * c; 12443 n < d && (d = n), n > f && (f = n); 12444 } 12445 if (u > f || d > h) return 0; 12446 } 12447 return 1; 12448 } 12449 containsPoint(e1) { 12450 for (const t1 of this.planes){ 12451 const i = t1[3]; 12452 if (W([ 12453 t1[0], 12454 t1[1], 12455 t1[2] 12456 ], e1) + i < 0) return !1; 12457 } 12458 return !0; 12459 } 12460 constructor(e1, t1){ 12461 this.points = e1 || new Array(8).fill([ 12462 0, 12463 0, 12464 0 12465 ]), this.planes = t1 || new Array(6).fill([ 12466 0, 12467 0, 12468 0, 12469 0 12470 ]), this.bounds = Rf.fromPoints(this.points), this.projections = [], this.frustumEdges = [ 12471 te([], this.points[2], this.points[3]), 12472 te([], this.points[0], this.points[3]), 12473 te([], this.points[4], this.points[0]), 12474 te([], this.points[5], this.points[1]), 12475 te([], this.points[6], this.points[2]), 12476 te([], this.points[7], this.points[3]) 12477 ]; 12478 for (const e1 of this.frustumEdges){ 12479 const t1 = [ 12480 0, 12481 -e1[2], 12482 e1[1] 12483 ], i = [ 12484 e1[2], 12485 0, 12486 -e1[0] 12487 ]; 12488 this.projections.push({ 12489 axis: t1, 12490 projection: Ef(this.points, this.points[0], t1, [ 12491 0, 12492 0 12493 ]) 12494 }), this.projections.push({ 12495 axis: i, 12496 projection: Ef(this.points, this.points[0], i, [ 12497 0, 12498 0 12499 ]) 12500 }); 12501 } 12502 } 12503 } 12504 class Rf { 12505 static fromPoints(e1) { 12506 const t1 = [ 12507 1 / 0, 12508 1 / 0, 12509 1 / 0 12510 ], i = [ 12511 -1 / 0, 12512 -1 / 0, 12513 -1 / 0 12514 ]; 12515 for (const n of e1)V(t1, t1, n), N(i, i, n); 12516 return new Rf(t1, i); 12517 } 12518 static fromTileIdAndHeight(e1, t1, i) { 12519 const n = 1 << e1.canonical.z, r = e1.canonical.x, o = e1.canonical.y; 12520 return new Rf([ 12521 r / n, 12522 o / n, 12523 t1 12524 ], [ 12525 (r + 1) / n, 12526 (o + 1) / n, 12527 i 12528 ]); 12529 } 12530 static applyTransform(e1, t1) { 12531 const i = e1.getCorners(); 12532 for(let e1 = 0; e1 < i.length; ++e1)Y(i[e1], i[e1], t1); 12533 return Rf.fromPoints(i); 12534 } 12535 static applyTransformFast(e1, t1) { 12536 const i = [ 12537 t1[12], 12538 t1[13], 12539 t1[14] 12540 ], n = [ 12541 ...i 12542 ]; 12543 for(let r = 0; r < 3; r++)for(let o = 0; o < 3; o++){ 12544 const a = t1[4 * o + r], s = a * e1.min[o], l = a * e1.max[o]; 12545 i[r] += Math.min(s, l), n[r] += Math.max(s, l); 12546 } 12547 return new Rf(i, n); 12548 } 12549 static projectAabbCorners(e1, t1) { 12550 const i = e1.getCorners(); 12551 for(let e1 = 0; e1 < i.length; ++e1)Y(i[e1], i[e1], t1); 12552 return i; 12553 } 12554 quadrant(e1) { 12555 const t1 = [ 12556 e1 % 2 == 0, 12557 e1 < 2 12558 ], i = P(this.min), n = P(this.max); 12559 for(let e1 = 0; e1 < t1.length; e1++)i[e1] = t1[e1] ? this.min[e1] : this.center[e1], n[e1] = t1[e1] ? this.center[e1] : this.max[e1]; 12560 return n[2] = this.max[2], new Rf(i, n); 12561 } 12562 distanceX(e1) { 12563 return Math.max(Math.min(this.max[0], e1[0]), this.min[0]) - e1[0]; 12564 } 12565 distanceY(e1) { 12566 return Math.max(Math.min(this.max[1], e1[1]), this.min[1]) - e1[1]; 12567 } 12568 distanceZ(e1) { 12569 return Math.max(Math.min(this.max[2], e1[2]), this.min[2]) - e1[2]; 12570 } 12571 getCorners() { 12572 const e1 = this.min, t1 = this.max; 12573 return [ 12574 [ 12575 e1[0], 12576 e1[1], 12577 e1[2] 12578 ], 12579 [ 12580 t1[0], 12581 e1[1], 12582 e1[2] 12583 ], 12584 [ 12585 t1[0], 12586 t1[1], 12587 e1[2] 12588 ], 12589 [ 12590 e1[0], 12591 t1[1], 12592 e1[2] 12593 ], 12594 [ 12595 e1[0], 12596 e1[1], 12597 t1[2] 12598 ], 12599 [ 12600 t1[0], 12601 e1[1], 12602 t1[2] 12603 ], 12604 [ 12605 t1[0], 12606 t1[1], 12607 t1[2] 12608 ], 12609 [ 12610 e1[0], 12611 t1[1], 12612 t1[2] 12613 ] 12614 ]; 12615 } 12616 intersects(e1) { 12617 return this.intersectsAabb(e1.bounds) ? If(e1, this.getCorners()) : 0; 12618 } 12619 intersectsFlat(e1) { 12620 return this.intersectsAabb(e1.bounds) ? If(e1, [ 12621 [ 12622 this.min[0], 12623 this.min[1], 12624 0 12625 ], 12626 [ 12627 this.max[0], 12628 this.min[1], 12629 0 12630 ], 12631 [ 12632 this.max[0], 12633 this.max[1], 12634 0 12635 ], 12636 [ 12637 this.min[0], 12638 this.max[1], 12639 0 12640 ] 12641 ]) : 0; 12642 } 12643 intersectsPrecise(e1, t1) { 12644 return t1 || this.intersects(e1) ? Tf(e1, this.getCorners()) : 0; 12645 } 12646 intersectsPreciseFlat(e1, t1) { 12647 return t1 || this.intersectsFlat(e1) ? Tf(e1, [ 12648 [ 12649 this.min[0], 12650 this.min[1], 12651 0 12652 ], 12653 [ 12654 this.max[0], 12655 this.min[1], 12656 0 12657 ], 12658 [ 12659 this.max[0], 12660 this.max[1], 12661 0 12662 ], 12663 [ 12664 this.min[0], 12665 this.max[1], 12666 0 12667 ] 12668 ]) : 0; 12669 } 12670 intersectsAabb(e1) { 12671 for(let t1 = 0; t1 < 3; ++t1)if (this.min[t1] > e1.max[t1] || e1.min[t1] > this.max[t1]) return !1; 12672 return !0; 12673 } 12674 intersectsAabbXY(e1) { 12675 return !(this.min[0] > e1.max[0] || e1.min[0] > this.max[0] || this.min[1] > e1.max[1] || e1.min[1] > this.max[1]); 12676 } 12677 encapsulate(e1) { 12678 for(let t1 = 0; t1 < 3; t1++)this.min[t1] = Math.min(this.min[t1], e1.min[t1]), this.max[t1] = Math.max(this.max[t1], e1.max[t1]); 12679 } 12680 encapsulatePoint(e1) { 12681 for(let t1 = 0; t1 < 3; t1++)this.min[t1] = Math.min(this.min[t1], e1[t1]), this.max[t1] = Math.max(this.max[t1], e1[t1]); 12682 } 12683 closestPoint(e1) { 12684 return [ 12685 Math.max(Math.min(this.max[0], e1[0]), this.min[0]), 12686 Math.max(Math.min(this.max[1], e1[1]), this.min[1]), 12687 Math.max(Math.min(this.max[2], e1[2]), this.min[2]) 12688 ]; 12689 } 12690 constructor(e1, t1){ 12691 this.min = e1, this.max = t1, this.center = k([], L([], this.min, this.max), .5); 12692 } 12693 } 12694 function Pf(e1) { 12695 return e1 * sc / pc; 12696 } 12697 Xa(Rf, "Aabb"); 12698 const Df = [ 12699 new Rf([ 12700 uc, 12701 uc, 12702 uc 12703 ], [ 12704 hc, 12705 hc, 12706 hc 12707 ]), 12708 new Rf([ 12709 uc, 12710 uc, 12711 uc 12712 ], [ 12713 0, 12714 0, 12715 hc 12716 ]), 12717 new Rf([ 12718 0, 12719 uc, 12720 uc 12721 ], [ 12722 hc, 12723 0, 12724 hc 12725 ]), 12726 new Rf([ 12727 uc, 12728 0, 12729 uc 12730 ], [ 12731 0, 12732 hc, 12733 hc 12734 ]), 12735 new Rf([ 12736 0, 12737 0, 12738 uc 12739 ], [ 12740 hc, 12741 hc, 12742 hc 12743 ]) 12744 ]; 12745 function Ff(e1, t1, i) { 12746 let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0; 12747 const r = k([], e1._camera.position, e1.worldSize), o = [ 12748 t1, 12749 i, 12750 1, 12751 1 12752 ]; 12753 le(o, o, e1.pixelMatrixInverse), ae(o, o, 1 / o[3]); 12754 const a = Z([], te([], o, r)), s = e1.globeMatrix, l = [ 12755 s[12], 12756 s[13], 12757 s[14] 12758 ], c = te([], l, r), u = D(c), h = Z([], c), d = e1.worldSize / (2 * Math.PI), f = W(h, a), p = Math.asin(d / u); 12759 if (p < Math.acos(f)) { 12760 if (!n) return null; 12761 const e1 = [], t1 = []; 12762 k(e1, a, u / f), Z(t1, te(t1, e1, c)), Z(a, L(a, c, k(a, t1, Math.tan(p) * u))); 12763 } 12764 const m = []; 12765 new wf(r, a).closestPointOnSphere(l, d, m); 12766 const _ = Z([], It(s, 0)), g = Z([], It(s, 1)), y = Z([], It(s, 2)), x = W(_, m), v = W(g, m), b = W(y, m), w = Ke(Math.asin(-v / d)); 12767 let A = Ke(Math.atan2(x, b)); 12768 A = e1.center.lng + function(e1, t1) { 12769 const i = (t1 - e1 + 180) % 360 - 180; 12770 return i < -180 ? i + 360 : i; 12771 }(e1.center.lng, A); 12772 const E = dr(A), I = it(fr(w), 0, 1); 12773 return new Mc(E, I); 12774 } 12775 class Cf { 12776 constructor(e1, t1, i){ 12777 this.a = te([], e1, i), this.b = te([], t1, i), this.center = i; 12778 const n = Z([], this.a), r = Z([], this.b); 12779 this.angle = Math.acos(W(n, r)); 12780 } 12781 } 12782 function Lf(e1, t1) { 12783 if (0 === e1.angle) return null; 12784 let i; 12785 return i = 0 === e1.a[t1] ? 1 / e1.angle * .5 * Math.PI : 1 / e1.angle * Math.atan(e1.b[t1] / e1.a[t1] / Math.sin(e1.angle) - 1 / Math.tan(e1.angle)), i < 0 || i > 1 ? null : function(e1, t1, i, n) { 12786 const r = Math.sin(i); 12787 return e1 * (Math.sin((1 - n) * i) / r) + t1 * (Math.sin(n * i) / r); 12788 }(e1.a[t1], e1.b[t1], e1.angle, it(i, 0, 1)) + e1.center[t1]; 12789 } 12790 function Of(e1) { 12791 if (e1.z <= 1) return Df[e1.z + 2 * e1.y + e1.x]; 12792 const t1 = Uf(kf(e1)); 12793 return Rf.fromPoints(t1); 12794 } 12795 function Bf(e1, t1, i) { 12796 return k(e1, e1, 1 - i), U(e1, e1, t1, i); 12797 } 12798 function Vf(e1, t1, i) { 12799 for (const n of e1)Y(n, n, t1), k(n, n, i); 12800 } 12801 function Nf(e1, t1, i, n) { 12802 const r = t1 / e1.worldSize, o = e1.globeMatrix; 12803 if (i.z <= 1) { 12804 const e1 = Of(i).getCorners(); 12805 return Vf(e1, o, r), Rf.fromPoints(e1); 12806 } 12807 const a = kf(i, n), s = Uf(a, sc + Pf(e1._tileCoverLift)); 12808 Vf(s, o, r); 12809 const l = Number.MAX_VALUE, c = [ 12810 -l, 12811 -l, 12812 -l 12813 ], u = [ 12814 l, 12815 l, 12816 l 12817 ]; 12818 if (a.contains(e1.center)) { 12819 for (const e1 of s)V(u, u, e1), N(c, c, e1); 12820 c[2] = 0; 12821 const t1 = e1.point, i = [ 12822 t1.x * r, 12823 t1.y * r, 12824 0 12825 ]; 12826 return V(u, u, i), N(c, c, i), new Rf(u, c); 12827 } 12828 if (e1._tileCoverLift > 0) { 12829 for (const e1 of s)V(u, u, e1), N(c, c, e1); 12830 return new Rf(u, c); 12831 } 12832 const h = [ 12833 o[12] * r, 12834 o[13] * r, 12835 o[14] * r 12836 ], d = a.getCenter(), f = it(e1.center.lat, -85.051129, bc), p = it(d.lat, -85.051129, bc), m = dr(e1.center.lng), _ = fr(f); 12837 let g = m - dr(d.lng); 12838 const y = _ - fr(p); 12839 g > .5 ? g -= 1 : g < -.5 && (g += 1); 12840 let x = 0; 12841 Math.abs(g) > Math.abs(y) ? x = g >= 0 ? 1 : 3 : (x = y >= 0 ? 0 : 2, U(h, h, [ 12842 o[4] * r, 12843 o[5] * r, 12844 o[6] * r 12845 ], -Math.sin(Je(y >= 0 ? a.getSouth() : a.getNorth())) * sc)); 12846 const v = s[x], b = s[(x + 1) % 4], w = new Cf(v, b, h), A = [ 12847 Lf(w, 0) || v[0], 12848 Lf(w, 1) || v[1], 12849 Lf(w, 2) || v[2] 12850 ], E = Yf(e1.zoom); 12851 if (E > 0) { 12852 const n = function(param, n, r, o, a) { 12853 let { x: e1, y: t1, z: i } = param; 12854 const s = 1 / (1 << i); 12855 let l = e1 * s, c = l + s, u = t1 * s, h = u + s, d = 0; 12856 const f = (l + c) / 2 - o; 12857 return f > .5 ? d = -1 : f < -.5 && (d = 1), l = ((l + d) * n - (o *= n)) * r + o, c = ((c + d) * n - o) * r + o, u = (u * n - (a *= n)) * r + a, h = (h * n - a) * r + a, [ 12858 [ 12859 l, 12860 h, 12861 0 12862 ], 12863 [ 12864 c, 12865 h, 12866 0 12867 ], 12868 [ 12869 c, 12870 u, 12871 0 12872 ], 12873 [ 12874 l, 12875 u, 12876 0 12877 ] 12878 ]; 12879 }(i, t1, e1._pixelsPerMercatorPixel, m, _); 12880 for(let e1 = 0; e1 < s.length; e1++)Bf(s[e1], n[e1], E); 12881 const r = L([], n[x], n[(x + 1) % 4]); 12882 k(r, r, .5), Bf(A, r, E); 12883 } 12884 for (const e1 of s)V(u, u, e1), N(c, c, e1); 12885 return u[2] = Math.min(v[2], b[2]), V(u, u, A), N(c, c, A), new Rf(u, c); 12886 } 12887 function kf(param) { 12888 let { x: e1, y: t1, z: i } = param, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1; 12889 const r = 1 / (1 << i), o = new _c(pr(e1 * r), t1 === (1 << i) - 1 && n ? -90 : mr((t1 + 1) * r)), a = new _c(pr((e1 + 1) * r), 0 === t1 && n ? 90 : mr(t1 * r)); 12890 return new gc(o, a); 12891 } 12892 function Uf(e1) { 12893 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : sc; 12894 const i = Je(e1.getNorth()), n = Je(e1.getSouth()), r = Math.
12894cos(i), o = Math.cos(n), a = Math.sin(i), s = Math.sin(n), l = e1.getWest(), c = e1.getEast(); 12895 return [ 12896 dc(o, s, l, t1), 12897 dc(o, s, c, t1), 12898 dc(r, a, c, t1), 12899 dc(r, a, l, t1) 12900 ]; 12901 } 12902 function jf(e1, t1, i, n) { 12903 const r = 1 << i.z, o = (e1 / zr + i.x) / r; 12904 return fc(mr((t1 / zr + i.y) / r), pr(o), n); 12905 } 12906 function Gf(param) { 12907 let { min: e1, max: t1 } = param; 12908 return 16383 / Math.max(t1[0] - e1[0], t1[1] - e1[1], t1[2] - e1[2]); 12909 } 12910 const Hf = new Float64Array(16); 12911 function $f(e1) { 12912 const t1 = Gf(e1), i = w(Hf, [ 12913 t1, 12914 t1, 12915 t1 12916 ]); 12917 return _(i, i, $([], e1.min)); 12918 } 12919 function Zf(e1) { 12920 const t1 = 1 / Gf(e1); 12921 return b(Hf, e1.min), g(Hf, Hf, [ 12922 t1, 12923 t1, 12924 t1 12925 ]); 12926 } 12927 function Wf(e1) { 12928 const t1 = zr / (2 * Math.PI); 12929 return e1 / (2 * Math.PI) / t1; 12930 } 12931 function qf(e1, t1) { 12932 return zr / (512 * Math.pow(2, e1)) * Gf(Of(t1)); 12933 } 12934 function Xf(e1, t1, i, n, r) { 12935 const o = Wf(i), a = [ 12936 e1, 12937 t1, 12938 -i / (2 * Math.PI) 12939 ], s = d(new Float64Array(16)); 12940 return _(s, s, a), g(s, s, [ 12941 o, 12942 o, 12943 o 12944 ]), y(s, s, Je(-r)), x(s, s, Je(-n)), s; 12945 } 12946 function Yf(e1) { 12947 return nt(5, 6, e1); 12948 } 12949 function Jf(e1, t1) { 12950 const i = fc(t1.lat, t1.lng), n = function(e1) { 12951 const t1 = fc(e1._center.lat, e1._center.lng); 12952 let i = q([], F(0, 1, 0), t1); 12953 const n = A([], -e1.angle, t1); 12954 i = Y(i, i, n), A(n, -e1._pitch, i); 12955 const r = Z([], t1); 12956 return k(r, r, Pf(e1.cameraToCenterDistance / e1.pixelsPerMeter)), Y(r, r, n), L([], t1, r); 12957 }(e1); 12958 return a = (r = O([], n, i))[0], s = r[1], l = r[2], c = (o = i)[0], u = o[1], h = o[2], f = (d = Math.sqrt((a * a + s * s + l * l) * (c * c + u * u + h * h))) && W(r, o) / d, Math.acos(Math.min(Math.max(f, -1), 1)); 12959 //TURBOPACK unreachable 12960 ; 12961 var r, o, a, s, l, c, u, h, d, f; 12962 } 12963 function Kf(e1, t1) { 12964 return Jf(e1, t1) > Math.PI / 2 * 1.01; 12965 } 12966 const Qf = Je(85), ep = Math.cos(Qf), tp = Math.sin(Qf); 12967 function ip(e1, t1) { 12968 const i = e1.fovAboveCenter, n = e1.elevation ? e1.elevation.getMinElevationBelowMSL() * t1 : 0, r = Math.min(n, e1.isOrthographic ? -10 * t1 : 0), o = (e1._camera.position[2] * e1.worldSize - r) / Math.cos(e1._pitch), a = Math.sin(i) * o / Math.sin(Math.max(Math.PI / 2 - e1._pitch - i, .01)); 12969 let s = Math.sin(e1._pitch) * a + o; 12970 const l = o * (1 / e1._horizonShift); 12971 if (!e1.elevation || 0 === e1.elevation.exaggeration()) { 12972 let t1 = Math.max(e1.zoom - 17, 0); 12973 e1.isOrthographic && (t1 /= 10), s *= 1 + t1; 12974 } 12975 return Math.min(1.01 * s, l); 12976 } 12977 class np { 12978 equals(e1) { 12979 return this.z === e1.z && this.x === e1.x && this.y === e1.y; 12980 } 12981 isChildOf(e1) { 12982 const t1 = this.z - e1.z; 12983 return 0 === e1.z || e1.z < this.z && e1.x === this.x >> t1 && e1.y === this.y >> t1; 12984 } 12985 url(e1, t1) { 12986 const i = function(e1, t1, i) { 12987 const n = 2 ** i, r = 2 * Math.PI * 6378137, o = r * (e1 / n - .5), a = r * (.5 - (t1 + 1) / n); 12988 return "".concat(o, ",").concat(a, ",").concat(o + r / n, ",").concat(a + r / n); 12989 }(this.x, this.y, this.z), n = function(e1, t1, i) { 12990 let n, r = ""; 12991 for(let o = e1; o > 0; o--)n = 1 << o - 1, r += (t1 & n ? 1 : 0) + (i & n ? 2 : 0); 12992 return r; 12993 }(this.z, this.x, this.y); 12994 return e1[(this.x + this.y) % e1.length].replace("{prefix}", (this.x % 16).toString(16) + (this.y % 16).toString(16)).replace(/{z}/g, String(this.z)).replace(/{x}/g, String(this.x)).replace(/{y}/g, String("tms" === t1 ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace("{quadkey}", n).replace("{bbox-epsg-3857}", i); 12995 } 12996 toString() { 12997 return "".concat(this.z, "/").concat(this.x, "/").concat(this.y); 12998 } 12999 constructor(e1, t1, i){ 13000 this.z = e1, this.x = t1, this.y = i, this.key = ap(0, e1, e1, t1, i); 13001 } 13002 } 13003 class rp { 13004 constructor(e1, t1){ 13005 this.wrap = e1, this.canonical = t1, this.key = ap(e1, t1.z, t1.z, t1.x, t1.y); 13006 } 13007 } 13008 class op { 13009 equals(e1) { 13010 return this.overscaledZ === e1.overscaledZ && this.wrap === e1.wrap && this.canonical.equals(e1.canonical); 13011 } 13012 scaledTo(e1) { 13013 const t1 = this.canonical.z - e1; 13014 return e1 > this.canonical.z ? new op(e1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new op(e1, this.wrap, e1, this.canonical.x >> t1, this.canonical.y >> t1); 13015 } 13016 calculateScaledKey(e1) { 13017 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0; 13018 if (this.overscaledZ === e1 && t1) return this.key; 13019 if (e1 > this.canonical.z) return ap(this.wrap * +t1, e1, this.canonical.z, this.canonical.x, this.canonical.y); 13020 { 13021 const i = this.canonical.z - e1; 13022 return ap(this.wrap * +t1, e1, e1, this.canonical.x >> i, this.canonical.y >> i); 13023 } 13024 } 13025 isChildOf(e1) { 13026 if (e1.wrap !== this.wrap) return !1; 13027 const t1 = this.canonical.z - e1.canonical.z; 13028 return 0 === e1.overscaledZ || e1.overscaledZ < this.overscaledZ && e1.canonical.z < this.canonical.z && e1.canonical.x === this.canonical.x >> t1 && e1.canonical.y === this.canonical.y >> t1; 13029 } 13030 children(e1) { 13031 if (this.overscaledZ >= e1) return [ 13032 new op(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) 13033 ]; 13034 const t1 = this.canonical.z + 1, i = 2 * this.canonical.x, n = 2 * this.canonical.y; 13035 return [ 13036 new op(t1, this.wrap, t1, i, n), 13037 new op(t1, this.wrap, t1, i + 1, n), 13038 new op(t1, this.wrap, t1, i, n + 1), 13039 new op(t1, this.wrap, t1, i + 1, n + 1) 13040 ]; 13041 } 13042 isLessThan(e1) { 13043 return this.wrap < e1.wrap || !(this.wrap > e1.wrap) && (this.overscaledZ < e1.overscaledZ || !(this.overscaledZ >
vendor: 20,332 bytes, lines 13043-13485
13043 e1.overscaledZ) && (this.canonical.x < e1.canonical.x || !(this.canonical.x > e1.canonical.x) && this.canonical.y < e1.canonical.y)); 13044 } 13045 wrapped() { 13046 return new op(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y); 13047 } 13048 unwrapTo(e1) { 13049 return new op(this.overscaledZ, e1, this.canonical.z, this.canonical.x, this.canonical.y); 13050 } 13051 overscaleFactor() { 13052 return Math.pow(2, this.overscaledZ - this.canonical.z); 13053 } 13054 toUnwrapped() { 13055 return new rp(this.wrap, this.canonical); 13056 } 13057 toString() { 13058 return "".concat(this.overscaledZ, "/").concat(this.canonical.x, "/").concat(this.canonical.y); 13059 } 13060 constructor(e1, t1, i, n, r){ 13061 this.overscaledZ = e1, this.wrap = t1, this.canonical = new np(i, +n, +r), this.key = 0 === t1 && e1 === i ? this.canonical.key : ap(t1, e1, i, n, r); 13062 } 13063 } 13064 function ap(e1, t1, i, n, r) { 13065 const o = 1 << Math.min(i, 22); 13066 let a = o * (r % o) + n % o; 13067 return e1 && i < 22 && (a += o * o * ((e1 < 0 ? -2 * e1 - 1 : 2 * e1) % (1 << 2 * (22 - i)))), 16 * (32 * a + i) + (t1 - i); 13068 } 13069 const sp = [ 13070 (e1)=>{ 13071 let t1 = e1.canonical.x - 1, i = e1.wrap; 13072 return t1 < 0 && (t1 = (1 << e1.canonical.z) - 1, i--), new op(e1.overscaledZ, i, e1.canonical.z, t1, e1.canonical.y); 13073 }, 13074 (e1)=>{ 13075 let t1 = e1.canonical.x + 1, i = e1.wrap; 13076 return t1 === 1 << e1.canonical.z && (t1 = 0, i++), new op(e1.overscaledZ, i, e1.canonical.z, t1, e1.canonical.y); 13077 }, 13078 (e1)=>new op(e1.overscaledZ, e1.wrap, e1.canonical.z, e1.canonical.x, (0 === e1.canonical.y ? 1 << e1.canonical.z : e1.canonical.y) - 1), 13079 (e1)=>new op(e1.overscaledZ, e1.wrap, e1.canonical.z, e1.canonical.x, e1.canonical.y === (1 << e1.canonical.z) - 1 ? 0 : e1.canonical.y + 1) 13080 ]; 13081 function lp(e1, t1) { 13082 if (!t1.isReprojectedInTileSpace) return { 13083 scale: 1 << e1.z, 13084 x: e1.x, 13085 y: e1.y, 13086 x2: e1.x + 1, 13087 y2: e1.y + 1, 13088 projection: t1 13089 }; 13090 const i = Math.pow(2, -e1.z), n = e1.x * i, r = (e1.x + 1) * i, o = e1.y * i, a = (e1.y + 1) * i, s = pr(n), l = pr(r), c = mr(o), u = mr(a), h = t1.project(s, c), d = t1.project(l, c), f = t1.project(l, u), p = t1.project(s, u); 13091 let m = Math.min(h.x, d.x, f.x, p.x), _ = Math.min(h.y, d.y, f.y, p.y), g = Math.max(h.x, d.x, f.x, p.x), y = Math.max(h.y, d.y, f.y, p.y); 13092 const x = i / 16; 13093 function v(e1, i, n, r, o, a) { 13094 const s = (n + o) / 2, l = (r + a) / 2, c = t1.project(pr(s), mr(l)), u = Math.max(0, m - c.x, _ - c.y, c.x - g, c.y - y); 13095 m = Math.min(m, c.x), g = Math.max(g, c.x), _ = Math.min(_, c.y), y = Math.max(y, c.y), u > x && (v(e1, c, n, r, s, l), v(c, i, s, l, o, a)); 13096 } 13097 v(h, d, n, o, r, o), v(d, f, r, o, r, a), v(f, p, r, a, n, a), v(p, h, n, a, n, o), m -= x, _ -= x, g += x, y += x; 13098 const b = 1 / Math.max(g - m, y - _); 13099 return { 13100 scale: b, 13101 x: m * b, 13102 y: _ * b, 13103 x2: g * b, 13104 y2: y * b, 13105 projection: t1 13106 }; 13107 } 13108 function cp(e1, t1, i, n, r, o, a, s, l) { 13109 if ("globe" === l.name) return Nf(e1, t1, new np(i, n, r), !1); 13110 const c = lp({ 13111 z: i, 13112 x: n, 13113 y: r 13114 }, l); 13115 return new Rf([ 13116 (o + c.x / c.scale) * t1, 13117 t1 * (c.y / c.scale), 13118 a 13119 ], [ 13120 (o + c.x2 / c.scale) * t1, 13121 t1 * (c.y2 / c.scale), 13122 s 13123 ]); 13124 } 13125 Xa(np, "CanonicalTileID"), Xa(op, "OverscaledTileID", { 13126 omit: [ 13127 "projMatrix", 13128 "expandedProjMatrix" 13129 ] 13130 }); 13131 const up = d(new Float32Array(16)); 13132 class hp { 13133 project(e1, t1) { 13134 return { 13135 x: 0, 13136 y: 0, 13137 z: 0 13138 }; 13139 } 13140 unproject(e1, t1) { 13141 return new _c(0, 0); 13142 } 13143 projectTilePoint(e1, t1, i) { 13144 return { 13145 x: e1, 13146 y: t1, 13147 z: 0 13148 }; 13149 } 13150 locationPoint(e1, t1, i) { 13151 let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0; 13152 return e1._coordinatePoint(e1.locationCoordinate(t1, i), n); 13153 } 13154 pixelsPerMeter(e1, t1) { 13155 return xc(1, e1) * t1; 13156 } 13157 pixelSpaceConversion(e1, t1, i) { 13158 return 1; 13159 } 13160 farthestPixelDistance(e1) { 13161 return ip(e1, e1.pixelsPerMeter); 13162 } 13163 pointCoordinate(e1, t1, i, n) { 13164 const r = e1.horizonLineFromTop(!1), o = new Pe(t1, Math.max(r, i)); 13165 return e1.rayIntersectionCoordinate(e1.pointRayIntersection(o, n)); 13166 } 13167 pointCoordinate3D(e1, t1, i) { 13168 const n = new Pe(t1, i); 13169 if (e1.elevation) return e1.elevation.pointCoordinate(n); 13170 { 13171 const t1 = this.pointCoordinate(e1, n.x, n.y, 0); 13172 return [ 13173 t1.x, 13174 t1.y, 13175 t1.z 13176 ]; 13177 } 13178 } 13179 isPointAboveHorizon(e1, t1) { 13180 if (e1.elevation && e1.elevation.visibleDemTiles.length) return !this.pointCoordinate3D(e1, t1.x, t1.y); 13181 const i = e1.horizonLineFromTop(); 13182 return t1.y < i; 13183 } 13184 createInversionMatrix(e1, t1) { 13185 return up; 13186 } 13187 createTileMatrix(e1, t1, i) { 13188 let n, r, o; 13189 const a = i.canonical, s = d(new Float64Array(16)); 13190 if (this.isReprojectedInTileSpace) { 13191 const l = lp(a, this); 13192 n = 1, r = l.x + i.wrap * l.scale, o = l.y, g(s, s, [ 13193 n / l.scale, 13194 n / l.scale, 13195 e1.pixelsPerMeter / t1 13196 ]); 13197 } else n = t1 / e1.zoomScale(a.z), r = (a.x + Math.pow(2, a.z) * i.wrap) * n, o = a.y * n; 13198 return _(s, s, [ 13199 r, 13200 o, 13201 0 13202 ]), g(s, s, [ 13203 n / zr, 13204 n / zr, 13205 1 13206 ]), s; 13207 } 13208 upVector(e1, t1, i) { 13209 return [ 13210 0, 13211 0, 13212 1 13213 ]; 13214 } 13215 upVectorScale(e1, t1, i) { 13216 return { 13217 metersToTile: 1 13218 }; 13219 } 13220 constructor(e1){ 13221 this.spec = e1, this.name = e1.name, this.wrap = !1, this.requiresDraping = !1, this.supportsWorldCopies = !1, this.supportsTerrain = !1, this.supportsFog = !1, this.supportsFreeCamera = !1, this.zAxisUnit = "meters", this.isReprojectedInTileSpace = !0, this.unsupportedLayers = [ 13222 "custom" 13223 ], this.center = [ 13224 0, 13225 0 13226 ], this.range = [ 13227 3.5, 13228 7 13229 ]; 13230 } 13231 } 13232 class dp extends hp { 13233 project(e1, t1) { 13234 const { n: i, c: n, r0: r } = this, o = Je(e1 - this.center[0]), a = Je(t1), s = Math.sqrt(n - 2 * i * Math.sin(a)) / i; 13235 return { 13236 x: s * Math.sin(o * i), 13237 y: s * Math.cos(o * i) - r, 13238 z: 0 13239 }; 13240 } 13241 unproject(e1, t1) { 13242 const { n: i, c: n, r0: r } = this, o = r + t1; 13243 let a = Math.atan2(e1, Math.abs(o)) * Math.sign(o); 13244 o * i < 0 && (a -= Math.PI * Math.sign(e1) * Math.sign(o)); 13245 const s = Je(this.center[0]) * i; 13246 a = rt(a, -Math.PI - s, Math.PI - s); 13247 const l = it(Ke(a / i) + this.center[0], -180, 180), c = Math.asin(it((n - (e1 * e1 + o * o) * i * i) / (2 * i), -1, 1)), u = it(Ke(c), -85.051129, bc); 13248 return new _c(l, u); 13249 } 13250 constructor(e1){ 13251 super(e1), this.range = [ 13252 4, 13253 7 13254 ], this.center = e1.center || [ 13255 -96, 13256 37.5 13257 ]; 13258 const [t1, i] = this.parallels = e1.parallels || [ 13259 29.5, 13260 45.5 13261 ], n = Math.sin(Je(t1)); 13262 this.n = (n + Math.sin(Je(i))) / 2, this.c = 1 + n * (2 * this.n - n), this.r0 = Math.sqrt(this.c) / this.n; 13263 } 13264 } 13265 const fp = 1.340264, pp = -.081106, mp = 893e-6, _p = .003796, gp = Math.sqrt(3) / 2; 13266 class yp extends hp { 13267 project(e1, t1) { 13268 t1 = t1 / 180 * Math.PI, e1 = e1 / 180 * Math.PI; 13269 const i = Math.asin(gp * Math.sin(t1)), n = i * i, r = n * n * n; 13270 return { 13271 x: .5 * (e1 * Math.cos(i) / (gp * (fp + 3 * pp * n + r * (7 * mp + 9 * _p * n))) / Math.PI + .5), 13272 y: 1 - .5 * (i * (fp + pp * n + r * (mp + _p * n)) / Math.PI + 1), 13273 z: 0 13274 }; 13275 } 13276 unproject(e1, t1) { 13277 e1 = (2 * e1 - .5) * Math.PI; 13278 let i = t1 = (2 * (1 - t1) - 1) * Math.PI, n = i * i, r = n * n * n; 13279 for(let e1, o, a, s = 0; s < 12 && (o = i * (fp + pp * n + r * (mp + _p * n)) - t1, a = fp + 3 * pp * n + r * (7 * mp + 9 * _p * n), e1 = o / a, i = it(i - e1, -Math.PI / 3, Math.PI / 3), n = i * i, r = n * n * n, !(Math.abs(e1) < 1e-12)); ++s); 13280 const o = gp * e1 * (fp + 3 * pp * n + r * (7 * mp + 9 * _p * n)) / Math.cos(i), a = Math.asin(Math.sin(i) / gp), s = it(180 * o / Math.PI, -180, 180), l = it(180 * a / Math.PI, -85.051129, bc); 13281 return new _c(s, l); 13282 } 13283 } 13284 class xp extends hp { 13285 project(e1, t1) { 13286 return { 13287 x: .5 + e1 / 360, 13288 y: .5 - t1 / 360, 13289 z: 0 13290 }; 13291 } 13292 unproject(e1, t1) { 13293 const i = 360 * (e1 - .5), n = it(360 * (.5 - t1), -85.051129, bc); 13294 return new _c(i, n); 13295 } 13296 constructor(e1){ 13297 super(e1), this.wrap = !0, this.supportsWorldCopies = !0; 13298 } 13299 } 13300 const vp = Math.PI / 2; 13301 function bp(e1) { 13302 return Math.tan((vp + e1) / 2); 13303 } 13304 class wp extends hp { 13305 project(e1, t1) { 13306 t1 = Je(t1), this.southernCenter && (t1 = -t1), e1 = Je(e1 - this.center[0]); 13307 const i = 1e-6, { n, f: r } = this; 13308 r > 0 ? t1 < -vp + i && (t1 = -vp + i) : t1 > vp - i && (t1 = vp - i); 13309 const o = r / Math.pow(bp(t1), n); 13310 let a = o * Math.sin(n * e1), s = r - o * Math.cos(n * e1); 13311 return a = .5 * (a / Math.PI + .5), s = .5 * (s / Math.PI + .5), { 13312 x: a, 13313 y: this.southernCenter ? s : 1 - s, 13314 z: 0 13315 }; 13316 } 13317 unproject(e1, t1) { 13318 e1 = (2 * e1 - .5) * Math.PI, this.southernCenter && (t1 = 1 - t1), t1 = (2 * (1 - t1) - .5) * Math.PI; 13319 const { n: i, f: n } = this, r = n - t1, o = Math.sign(r), a = Math.sign(i) * Math.sqrt(e1 * e1 + r * r); 13320 let s = Math.atan2(e1, Math.abs(r)) * o; 13321 r * i < 0 && (s -= Math.PI * Math.sign(e1) * o); 13322 const l = it(Ke(s / i) + this.center[0], -180, 180), c = it(Ke(2 * Math.atan(Math.pow(n / a, 1 / i)) - vp), -85.051129, bc); 13323 return new _c(l, this.southernCenter ? -c : c); 13324 } 13325 constructor(e1){ 13326 super(e1), this.center = e1.center || [ 13327 0, 13328 30 13329 ]; 13330 const [t1, i] = this.parallels = e1.parallels || [ 13331 30, 13332 30 13333 ]; 13334 let n = Je(t1), r = Je(i); 13335 this.southernCenter = n + r < 0, this.southernCenter && (n = -n, r = -r); 13336 const o = Math.cos(n), a = bp(n); 13337 this.n = n === r ? Math.sin(n) : Math.log(o / Math.cos(r)) / Math.log(bp(r) / a), this.f = o * Math.pow(bp(n), this.n) / this.n; 13338 } 13339 } 13340 class Ap extends hp { 13341 project(e1, t1) { 13342 return { 13343 x: dr(e1), 13344 y: fr(t1), 13345 z: 0 13346 }; 13347 } 13348 unproject(e1, t1) { 13349 const i = pr(e1), n = mr(t1); 13350 return new _c(i, n); 13351 } 13352 constructor(e1){ 13353 super(e1), this.wrap = !0, this.supportsWorldCopies = !0, this.supportsTerrain = !0, this.supportsFog = !0, this.supportsFreeCamera = !0, this.isReprojectedInTileSpace = !1, this.unsupportedLayers = [], this.range = null; 13354 } 13355 } 13356 const Ep = Je(bc); 13357 class Ip extends hp { 13358 project(e1, t1) { 13359 const i = (t1 = Je(t1)) * t1, n = i * i; 13360 return { 13361 x: .5 * ((e1 = Je(e1)) * (.8707 - .131979 * i + n * (n * (.003971 * i - .001529 * n) - .013791)) / Math.PI + .5), 13362 y: 1 - .5 * (t1 * (1.007226 + i * (.015085 + n * (.028874 * i - .044475 - .005916 * n))) / Math.PI + 1), 13363 z: 0 13364 }; 13365 } 13366 unproject(e1, t1) { 13367 e1 = (2 * e1 - .5) * Math.PI; 13368 let i = t1 = (2 * (1 - t1) - 1) * Math.PI, n = 25, r = 0, o = i * i; 13369 do { 13370 o = i * i; 13371 const e1 = o * o; 13372 r = (i * (1.007226 + o * (.015085 + e1 * (.028874 * o - .044475 - .005916 * e1))) - t1) / (1.007226 + o * (.045255 + e1 * (.259866 * o - .311325 - .005916 * 11 * e1))), i = it(i - r, -Ep, Ep); 13373 }while (Math.abs(r) > 1e-6 && --n > 0) 13374 o = i * i; 13375 const a = it(Ke(e1 / (.8707 + o * (o * (o * o * o * (.003971 - .001529 * o) - .013791) - .131979))), -180, 180), s = Ke(i); 13376 return new _c(a, s); 13377 } 13378 } 13379 const Mp = Je(bc); 13380 class Tp extends hp { 13381 project(e1, t1) { 13382 t1 = Je(t1), e1 = Je(e1); 13383 const i = Math.cos(t1), n = 2 / Math.PI, r = Math.acos(i * Math.cos(e1 / 2)), o = Math.sin(r) / r, a = .5 * (e1 * n + 2 * i * Math.sin(e1 / 2) / o) || 0, s = .5 * (t1 + Math.sin(t1) / o) || 0; 13384 return { 13385 x: .5 * (a / Math.PI + .5), 13386 y: 1 - .5 * (s / Math.PI + 1), 13387 z: 0 13388 }; 13389 } 13390 unproject(e1, t1) { 13391 let i = e1 = (2 * e1 - .5) * Math.PI, n = t1 = (2 * (1 - t1) - 1) * Math.PI, r = 25; 13392 const o = 1e-6; 13393 let a = 0, s = 0; 13394 do { 13395 const r = Math.cos(n), o = Math.sin(n), l = 2 * o * r, c = o * o, u = r * r, h = Math.cos(i / 2), d = Math.sin(i / 2), f = 2 * h * d, p = d * d, m = 1 - u * h * h, _ = m ? 1 / m : 0, g = m ? Math.acos(r * h) * Math.sqrt(1 / m) : 0, y = .5 * (2 * g * r * d + 2 * i / Math.PI) - e1, x = .5 * (g * o + n) - t1, v = .5 * _ * (u * p + g * r * h * c) + 1 / Math.PI, b = _ * (f * l / 4 - g * o * d), w = .125 * _ * (l * d - g * o * u * f), A = .5 * _ * (c * h + g * p * r) + .5, E = b * w - A * v; 13396 a = (x * b - y * A) / E, s = (y * w - x * v) / E, i = it(i - a, -Math.PI, Math.PI), n = it(n - s, -Mp, Mp); 13397 }while ((Math.abs(a) > o || Math.abs(s) > o) && --r > 0) 13398 return new _c(Ke(i), Ke(n)); 13399 } 13400 } 13401 class Sp extends hp { 13402 project(e1, t1) { 13403 const { scale: i, cosPhi: n } = this; 13404 return { 13405 x: Je(e1) * n * i + .5, 13406 y: -Math.sin(Je(t1)) / n * i + .5, 13407 z: 0 13408 }; 13409 } 13410 unproject(e1, t1) { 13411 const { scale: i, cosPhi: n } = this, r = -(t1 - .5) / i, o = it(Ke((e1 - .5) / i) / n, -180, 180), a = Math.asin(it(r * n, -1, 1)), s = it(Ke(a), -85.051129, bc); 13412 return new _c(o, s); 13413 } 13414 constructor(e1){ 13415 super(e1), this.center = e1.center || [ 13416 0, 13417 0 13418 ], this.parallels = e1.parallels || [ 13419 0, 13420 0 13421 ], this.cosPhi = Math.max(.01, Math.cos(Je(this.parallels[0]))), this.scale = 1 / (2 * Math.max(Math.PI * this.cosPhi, 1 / this.cosPhi)), this.wrap = !0, this.supportsWorldCopies = !0; 13422 } 13423 } 13424 class zp extends Ap { 13425 projectTilePoint(e1, t1, i) { 13426 const n = jf(e1, t1, i); 13427 return Y(n, n, $f(Of(i))), { 13428 x: n[0], 13429 y: n[1], 13430 z: n[2] 13431 }; 13432 } 13433 locationPoint(e1, t1, i) { 13434 const n = fc(t1.lat, t1.lng), r = Z([], n), o = i ? e1._centerAltitude + i : e1.elevation ? e1.elevation.getAtPointOrZero(e1.locationCoordinate(t1), e1._centerAltitude) : e1._centerAltitude; 13435 U(n, n, r, xc(1, 0) * zr * o); 13436 const a = d(new Float64Array(16)); 13437 return m(a, e1.pixelMatrix, e1.globeMatrix), Y(n, n, a), new Pe(n[0], n[1]); 13438 } 13439 pixelsPerMeter(e1, t1) { 13440 return xc(1, 0) * t1; 13441 } 13442 pixelSpaceConversion(e1, t1, i) { 13443 const n = xc(1, e1) * t1, r = fn(xc(1, 45) * t1, n, i); 13444 return this.pixelsPerMeter(e1, t1) / r; 13445 } 13446 createTileMatrix(e1, t1, i) { 13447 const n = Zf(Of(i.canonical)); 13448 return m(new Float64Array(16), e1.globeMatrix, n); 13449 } 13450 createInversionMatrix(e1, t1) { 13451 const { center: i } = e1, n = $f(Of(t1)); 13452 return x(n, n, Je(i.lng)), y(n, n, Je(i.lat)), g(n, n, [ 13453 e1._pixelsPerMercatorPixel, 13454 e1._pixelsPerMercatorPixel, 13455 1 13456 ]), Float32Array.from(n); 13457 } 13458 pointCoordinate(e1, t1, i, n) { 13459 return Ff(e1, t1, i, !0) || new Mc(0, 0); 13460 } 13461 pointCoordinate3D(e1, t1, i) { 13462 const n = this.pointCoordinate(e1, t1, i, 0); 13463 return [ 13464 n.x, 13465 n.y, 13466 n.z 13467 ]; 13468 } 13469 isPointAboveHorizon(e1, t1) { 13470 return !Ff(e1, t1.x, t1.y, !1); 13471 } 13472 farthestPixelDistance(e1) { 13473 const t1 = function(e1, t1) { 13474 const i = e1.cameraToCenterDistance, n = e1._centerAltitude * t1, r = e1._camera, o = e1._camera.forward(), a = L([], k([], o, -i), [ 13475 0, 13476 0, 13477 n 13478 ]), s = e1.worldSize / (2 * Math.PI), l = [ 13479 0, 13480 0, 13481 -s 13482 ], c = e1.width / e1.height, u = Math.tan(e1.fovAboveCenter), h = k([], r.up(), u), d = k([], r.right(), u * c), f = Z([], L([], L([], o, h), d)), p = []; 13483 let m; 13484 if (new wf(a, f).closestPointOnSphere(l, s, p)) { 13485 const t1 = L([], p, l), i = te([], t1, a);
13486 m = Math.cos(e1.fovAboveCenter) * D(i); 13487 } else { 13488 const e1 = te([], a, l), t1 = te([], l, a); 13489 Z(t1, t1); 13490 const i = D(e1) - s; 13491 m = Math.sqrt(i * (i + 2 * s)); 13492 const n = Math.acos(m / (s + i)) - Math.acos(W(o, t1)); 13493 m *= Math.cos(n); 13494 } 13495 return 1.01 * m; 13496 }(e1, this.pixelsPerMeter(e1.center.lat, e1.worldSize)), i = Yf(e1.zoom); 13497 if (i > 0) { 13498 const n = ip(e1, xc(1, e1.center.lat) * e1.worldSize), r = e1.worldSize / (2 * Math.PI), o = Math.max(e1.width, e1.height) / e1.worldSize * Math.PI; 13499 return fn(t1, n + r * (1 - Math.cos(o)), Math.pow(i, 10)); 13500 } 13501 return t1; 13502 } 13503 upVector(e1, t1, i) { 13504 return jf(t1, i, e1, 1); 13505 } 13506 upVectorScale(e1) { 13507 return { 13508 metersToTile: Pf(Gf(Of(e1))) 13509 }; 13510 } 13511 constructor(e1){ 13512 super(e1), this.requiresDraping = !0, this.supportsWorldCopies = !1, this.supportsFog = !0, this.zAxisUnit = "pixels", this.unsupportedLayers = [ 13513 "debug" 13514 ], this.range = [ 13515 3, 13516 5 13517 ]; 13518 } 13519 } 13520 function Rp(e1) { 13521 const t1 = e1.parallels, i = !!t1 && Math.abs(t1[0] + t1[1]) < .01; 13522 switch(e1.name){ 13523 case "mercator": 13524 return new Ap(e1); 13525 case "equirectangular": 13526 return new xp(e1); 13527 case "naturalEarth": 13528 return new Ip(e1); 13529 case "equalEarth": 13530 return new yp(e1); 13531 case "winkelTripel": 13532 return new Tp(e1); 13533 case "albers": 13534 return i ? new Sp(e1) : new dp(e1); 13535 case "lambertConformalConic": 13536 return i ? new Sp(e1) : new wp(e1); 13537 case "globe": 13538 return new zp(e1); 13539 } 13540 throw new Error("Invalid projection name: ".concat(e1.name)); 13541 } 13542 const Pp = Number.MAX_SAFE_INTEGER, Dp = Pp - 1; 13543 function Fp(e1, t1, i, n) { 13544 return e1.order < t1 || e1.order === Pp || !(e1.clipMask & i) || function(e1, t1) { 13545 if (0 === t1.length) return !1; 13546 let i = e1; 13547 for(; "" !== i;){ 13548 if (t1.includes(i)) return !1; 13549 i = wl(i); 13550 } 13551 return !0; 13552 }(n, e1.clipScope); 13553 } 13554 function Cp(e1, t1) { 13555 return e1.x - t1.x || e1.y - t1.y; 13556 } 13557 function Lp(e1, t1) { 13558 return 0 === Cp(e1.min, t1.min) && 0 === Cp(e1.max, t1.max); 13559 } 13560 function Op(e1, t1) { 13561 return !(e1.min.x > t1.max.x || e1.max.x < t1.min.x || e1.min.y > t1.max.y || e1.max.y < t1.min.y); 13562 } 13563 function Bp(e1, t1) { 13564 if (e1.length !== t1.length) return !1; 13565 for(let i = 0; i < e1.length; i++)if (e1[i].sourceId !== t1[i].sourceId || !Lp(e1[i], t1[i]) || e1[i].order !== t1[i].order || e1[i].clipMask !== t1[i].clipMask || !De(e1[i].clipScope, t1[i].clipScope)) return !1; 13566 return !0; 13567 } 13568 function Vp(e1, t1, i) { 13569 const n = 1 / zr, r = 1 / (1 << i.canonical.z), o = (t1.x * n + i.canonical.x) * r + i.wrap, a = (t1.y * n + i.canonical.y) * r; 13570 return { 13571 min: new Pe((e1.x * n + i.canonical.x) * r + i.wrap, (e1.y * n + i.canonical.y) * r), 13572 max: new Pe(o, a) 13573 }; 13574 } 13575 function Np(e1, t1, i) { 13576 const n = 1 << i.canonical.z, r = ((t1.x - i.wrap) * n - i.canonical.x) * zr, o = (t1.y * n - i.canonical.y) * zr; 13577 return { 13578 min: new Pe(((e1.x - i.wrap) * n - i.canonical.x) * zr, (e1.y * n - i.canonical.y) * zr), 13579 max: new Pe(r, o) 13580 }; 13581 } 13582 function kp(e1, t1, i, n, r, o, a) { 13583 const s = e1.indices, l = e1.vertices, c = []; 13584 for(let u = n; u < n + r; u += 3){ 13585 const n = t1[i[u + 0] + o], r = t1[i[u + 1] + o], h = t1[i[u + 2] + o], d = Math.min(n.x, r.x, h.x), f = Math.max(n.x, r.x, h.x), p = Math.min(n.y, r.y, h.y), m = Math.max(n.y, r.y, h.y);
13586 c.length = 0, e1.grid.query(new Pe(d, p), new Pe(f, m), c); 13587 for(let e1 = 0; e1 < c.length; e1++){ 13588 const t1 = c[e1]; 13589 if (Kh(l[s[3 * t1 + 0]], l[s[3 * t1 + 1]], l[s[3 * t1 + 2]], n, r, h, a)) return !0; 13590 } 13591 } 13592 return !1; 13593 } 13594 function Up(e1, t1, i, n) { 13595 if (!e1 || !i) return !1; 13596 let r = e1.vertices; 13597 if (!t1.canonical.equals(n.canonical) || t1.wrap !== n.wrap) { 13598 if (i.vertices.length < e1.vertices.length) return Up(i, n, e1, t1); 13599 const o = t1.canonical, a = n.canonical, s = Math.pow(2, a.z - o.z); 13600 r = e1.vertices.map((e1)=>new Pe((e1.x + o.x * zr) * s - a.x * zr, (e1.y + o.y * zr) * s - a.y * zr)); 13601 } 13602 return kp(i, r, e1.indices, 0, e1.indices.length, 0, 0); 13603 } 13604 function jp(e1, t1, i, n) { 13605 const r = Math.pow(2, n.z - i.z); 13606 return new Pe((e1 + i.x * zr) * r - n.x * zr, (t1 + i.y * zr) * r - n.y * zr); 13607 } 13608 function Gp(e1, t1) { 13609 const i = []; 13610 t1.grid.queryPoint(e1, i); 13611 const n = t1.indices, r = t1.vertices; 13612 for(let t1 = 0; t1 < i.length; t1++){ 13613 const o = i[t1]; 13614 if (qh([ 13615 r[n[3 * o + 0]], 13616 r[n[3 * o + 1]], 13617 r[n[3 * o + 2]] 13618 ], e1)) return !0; 13619 } 13620 return !1; 13621 } 13622 const Hp = 4294967296, $p = 1 / Hp, Zp = "undefined" == typeof TextDecoder ? null : new TextDecoder("utf-8"); 13623 class Wp { 13624 readFields(e1, t1) { 13625 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.length; 13626 let n; 13627 for(; n = this.nextField(i);)e1(n, t1, this); 13628 return t1; 13629 } 13630 readMessage(e1, t1) { 13631 return this.readFields(e1, t1, this.readVarint() + this.pos); 13632 } 13633 readFixed32() { 13634 const e1 = this.dataView.getUint32(this.pos, !0); 13635 return this.pos += 4, e1; 13636 } 13637 readSFixed32() { 13638 const e1 = this.dataView.getInt32(this.pos, !0); 13639 return this.pos += 4, e1; 13640 } 13641 readFixed64() { 13642 const e1 = this.dataView.getUint32(this.pos, !0) + this.dataView.getUint32(this.pos + 4, !0) * Hp; 13643 return this.pos += 8, e1; 13644 } 13645 readSFixed64() { 13646 const e1 = this.dataView.getUint32(this.pos, !0) + this.dataView.getInt32(this.pos + 4, !0) * Hp; 13647 return this.pos += 8, e1; 13648 } 13649 readFloat() { 13650 const e1 = this.dataView.getFloat32(this.pos, !0); 13651 return this.pos += 4, e1; 13652 } 13653 readDouble() { 13654 const e1 = this.dataView.getFloat64(this.pos, !0); 13655 return this.pos += 8, e1; 13656 } 13657 readVarint(e1) { 13658 const t1 = this.buf, i = t1[this.pos++]; 13659 if (i < 128) return i; 13660 let n, r = 127 & i; 13661 return n = t1[this.pos++], r |= (127 & n) << 7, n < 128 ? r : (n = t1[this.pos++], r |= (127 & n) << 14, n < 128 ? r : (n = t1[this.pos++], r |= (127 & n) << 21, n < 128 ? r : (n = t1[this.pos], r |= (15 & n) << 28, function(e1, t1, i) { 13662 const n = i.buf; 13663 let r, o; 13664 if (o = n[i.pos++], r = (112 & o) >> 4, o < 128) return qp(e1, r, t1); 13665 if (o = n[i.pos++], r |= (127 & o) << 3, o < 128) return qp(e1, r, t1); 13666 if (o = n[i.pos++], r |= (127 & o) << 10, o < 128) return qp(e1, r, t1); 13667 if (o = n[i.pos++], r |= (127 & o) << 17, o < 128) return qp(e1, r, t1); 13668 if (o = n[i.pos++], r |= (127 & o) << 24, o < 128) return qp(e1, r, t1); 13669 if (o = n[i.pos++], r |= (1 & o) << 31, o < 128) return qp(e1, r, t1); 13670 throw new Error("Expected varint not more than 10 bytes"); 13671 }(r, e1, this)))); 13672 } 13673 readSVarint() { 13674 const e1 = this.readVarint(); 13675 return e1 % 2 == 1 ? (e1 + 1) / -2 : e1 / 2; 13676 } 13677 readBoolean() { 13678 return Boolean(this.readVarint()); 13679 } 13680 readString() { 13681 const e1 = this.readVarint() + this.pos, t1 = this.pos; 13682 return this.pos = e1, e1 - t1 >= 12 && Zp ? Zp.decode(this.buf.subarray(t1, e1)) : function(e1, t1, i) { 13683 let n = "", r = t1; 13684 for(; r < i;){ 13685 const t1 = e1[r]; 13686 let o, a, s, l = null, c = t1 > 239 ? 4 : t1 > 223 ? 3 : t1 > 191 ? 2 : 1; 13687 if (r + c > i) break; 13688 1 === c ? t1 < 128 && (l = t1) : 2 === c ? (o = e1[r + 1], 128 == (192 & o) && (l = (31 & t1) << 6 | 63 & o, l <= 127 && (l = null))) : 3 === c ? (o = e1[r + 1], a = e1[r + 2], 128 == (192 & o) && 128 == (192 & a) && (l = (15 & t1) << 12 | (63 & o) << 6 | 63 & a, (l <= 2047 || l >= 55296 && l <= 57343) && (l = null))) : 4 === c && (o = e1[r + 1], a = e1[r + 2], s = e1[r + 3], 128 == (192 & o) && 128 == (192 & a) && 128 == (192 & s) && (l = (15 & t1) << 18 | (63 & o) << 12 | (63 & a) << 6 | 63 & s, (l <= 65535 || l >= 1114112) && (l = null))), null === l ? (l = 65533, c = 1) : l > 65535 && (l -= 65536, n += String.fromCharCode(l >>> 10 & 1023 | 55296), l = 56320 | 1023 & l), n += String.fromCharCode(l), r += c; 13689 } 13690 return n; 13691 }(this.buf, t1, e1); 13692 } 13693 readBytes() { 13694 const e1 = this.readVarint() + this.pos, t1 = this.buf.subarray(this.pos, e1); 13695 return this.pos = e1, t1; 13696 } 13697 readPackedVarint() { 13698 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t1 = arguments.length > 1 ? arguments[1] : void 0; 13699 const i = this.readPackedEnd(); 13700 for(; this.pos < i;)e1.push(this.readVarint(t1)); 13701 return e1; 13702 } 13703 readPackedSVarint() { 13704 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; 13705 const t1 = this.readPackedEnd(); 13706 for(; this.pos < t1;)e1.push(this.readSVarint()); 13707 return e1; 13708 } 13709 readPackedBoolean() { 13710 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; 13711 const t1 = this.readPackedEnd(); 13712 for(; this.pos < t1;)e1.push(this.readBoolean()); 13713 return e1; 13714 } 13715 readPackedFloat() { 13716 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; 13717 const t1 = this.readPackedEnd(); 13718 for(; this.pos < t1;)e1.push(this.readFloat()); 13719 return e1; 13720 } 13721 readPackedDouble() { 13722 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; 13723 const t1 = this.readPackedEnd(); 13724 for(; this.pos < t1;)e1.push(this.readDouble()); 13725 return e1; 13726 } 13727 readPackedFixed32() { 13728 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; 13729 const t1 = this.readPackedEnd(); 13730 for(; this.pos < t1;)e1.push(this.readFixed32()); 13731 return e1; 13732 } 13733 readPackedSFixed32() { 13734 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; 13735 const t1 = this.readPackedEnd(); 13736 for(; this.pos < t1;)e1.push(this.readSFixed32()); 13737 return e1; 13738 } 13739 readPackedFixed64() { 13740 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; 13741 const t1 = this.readPackedEnd(); 13742 for(; this.pos < t1;)e1.push(this.readFixed64()); 13743 return e1; 13744 } 13745 readPackedSFixed64() { 13746 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; 13747 const t1 = this.readPackedEnd(); 13748 for(; this.pos < t1;)e1.push(this.readSFixed64()); 13749 return e1; 13750 } 13751 readPackedEnd() { 13752 return 2 === this.type ? this.readVarint() + this.pos : this.pos + 1; 13753 } 13754 nextField() { 13755 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.length; 13756 if (this.pos === this._valueStart && this.skip(this.type), this.pos >= e1) return 0; 13757 const t1 = this.readVarint(); 13758 return this.type = 7 & t1, this._valueStart = this.pos, t1 >>> 3; 13759 } 13760 skip(e1) { 13761 const t1 = 7 & e1; 13762 if (0 === t1) for(; this.buf[this.pos++] > 127;); 13763 else if (2 === t1) this.pos = this.readVarint() + this.pos; 13764 else if (5 === t1) this.pos += 4; 13765 else { 13766 if (1 !== t1) throw new Error("Unimplemented type: ".concat(t1)); 13767 this.pos += 8; 13768 } 13769 } 13770 constructor(e1){ 13771 this.buf = ArrayBuffer.isView(e1) ? e1 : new Uint8Array(e1), this.dataView = new DataView(this.buf.buffer, this.buf.byteOffset, this.buf.byteLength), this.pos = 0, this.type = 0, this._valueStart = -1, this.length = this.buf.length; 13772 } 13773 } 13774 function qp(e1, t1, i) { 13775 return i ? 4294967296 * t1 + (e1 >>> 0) : 4294967296 * (t1 >>> 0) + (e1 >>> 0); 13776 } 13777 function Xp(e1, t1, i) { 13778 const n = t1 <= 16383 ? 1 : t1 <= 2097151 ? 2 : t1 <= 268435455 ? 3 : Math.floor(Math.log(t1) / (7 * Math.LN2)); 13779 i.realloc(n), i.buf.copyWithin(e1 + n, e1, i.pos); 13780 } 13781 function Yp(e1, t1) { 13782 const i = e1.length; 13783 let n = t1.buf, r = t1.pos, o = t1.length; 13784 for(let a = 0; a < i; a++){ 13785 let i = e1[a]; 13786 if (i < 0 || r + 10 > o) t1.pos = r, t1.writeVarint(i), n = t1.buf, r = t1.pos, o = t1.length; 13787 else { 13788 for(; i > 127;)n[r++] = i % 128 | 128, i = Math.floor(i / 128); 13789 n[r++] = i; 13790 } 13791 } 13792 t1.pos = r; 13793 } 13794 function Jp(e1, t1) { 13795 for(let i = 0; i < e1.length; i++)t1.writeSVarint(e1[i]); 13796 } 13797 function Kp(e1, t1) { 13798 for(let i = 0; i < e1.length; i++)t1.writeFloat(e1[i]); 13799 } 13800 function Qp(e1, t1) { 13801 for(let i = 0; i < e1.length; i++)t1.writeDouble(e1[i]); 13802 } 13803 function em(e1, t1) { 13804 for(let i = 0; i < e1.length; i++)t1.writeBoolean(e1[i]); 13805 } 13806 function tm(e1, t1) { 13807 for(let i = 0; i < e1.length; i++)t1.writeFixed32(e1[i]); 13808 } 13809 function im(e1, t1) { 13810 for(let i = 0; i < e1.length; i++)t1.writeSFixed32(e1[i]); 13811 } 13812 function nm(e1, t1) { 13813 for(let i = 0; i < e1.length;
vendor: 11,352 bytes, lines 13813-14008
13813 i++)t1.writeFixed64(e1[i]); 13814 } 13815 function rm(e1, t1) { 13816 for(let i = 0; i < e1.length; i++)t1.writeSFixed64(e1[i]); 13817 } 13818 function om(e1, t1, i) { 13819 let n; 13820 for(; n = e1.nextField(t1);)3 === n ? i.glyphs.push(am(e1, e1.readVarint() + e1.pos)) : 4 === n ? i.ascender = e1.readSVarint() : 5 === n && (i.descender = e1.readSVarint()); 13821 } 13822 function am(e1, t1) { 13823 let i, n, r = 0, o = 0, a = 0, s = 0, l = 0, c = 0; 13824 for(; n = e1.nextField(t1);)1 === n ? r = e1.readVarint() : 2 === n ? i = e1.readBytes() : 3 === n ? o = e1.readVarint() : 4 === n ? a = e1.readVarint() : 5 === n ? s = e1.readSVarint() : 6 === n ? l = e1.readSVarint() : 7 === n && (c = e1.readVarint()); 13825 return { 13826 id: r, 13827 bitmap: new cd({ 13828 width: o + 6, 13829 height: a + 6 13830 }, i), 13831 metrics: { 13832 width: o, 13833 height: a, 13834 left: s, 13835 top: l, 13836 advance: c 13837 } 13838 }; 13839 } 13840 function sm(e1) { 13841 let t1 = 0, i = 0; 13842 for (const n of e1)t1 += n.w * n.h, i = Math.max(i, n.w); 13843 e1.sort((e1, t1)=>t1.h - e1.h); 13844 const n = [ 13845 { 13846 x: 0, 13847 y: 0, 13848 w: Math.max(Math.ceil(Math.sqrt(t1 / .95)), i), 13849 h: 1 / 0 13850 } 13851 ]; 13852 let r = 0, o = 0; 13853 for (const t1 of e1)for(let e1 = n.length - 1; e1 >= 0; e1--){ 13854 const i = n[e1]; 13855 if (!(t1.w > i.w || t1.h > i.h)) { 13856 if (t1.x = i.x, t1.y = i.y, o = Math.max(o, t1.y + t1.h), r = Math.max(r, t1.x + t1.w), t1.w === i.w && t1.h === i.h) { 13857 const t1 = n.pop(); 13858 t1 && e1 < n.length && (n[e1] = t1); 13859 } else t1.h === i.h ? (i.x += t1.w, i.w -= t1.w) : t1.w === i.w ? (i.y += t1.h, i.h -= t1.h) : (n.push({ 13860 x: i.x + t1.w, 13861 y: i.y, 13862 w: i.w - t1.w, 13863 h: t1.h 13864 }), i.y += t1.h, i.h -= t1.h); 13865 break; 13866 } 13867 } 13868 return { 13869 w: r, 13870 h: o, 13871 fill: t1 / (r * o) || 0 13872 }; 13873 } 13874 function lm(e1, t1) { 13875 return e1.id < t1.id ? -1 : e1.id > t1.id ? 1 : e1.version < t1.version ? -1 : e1.version > t1.version ? 1 : e1.sx < t1.sx ? -1 : e1.sx > t1.sx ? 1 : e1.sy < t1.sy ? -1 : e1.sy > t1.sy ? 1 : 0; 13876 } 13877 function cm(e1) { 13878 let t1 = 0; 13879 for(let i = 0; i < e1.length; i++)t1 = (t1 << 5) - t1 + e1.charCodeAt(i), t1 &= t1; 13880 return t1; 13881 } 13882 function um(e1, t1) { 13883 return (e1 << 5) - e1 + t1; 13884 } 13885 function hm(e1, t1, i, n) { 13886 for (const [r] of e1.entries()){ 13887 const e1 = n && n.get(r) || jn.parse(r), o = e1.id.toString(), a = t1.get(o) || 0; 13888 i.push({ 13889 id: r, 13890 version: a, 13891 sx: e1.sx, 13892 sy: e1.sy 13893 }); 13894 } 13895 } 13896 class dm { 13897 subsetOf(e1) { 13898 return this.scope === e1.scope && this.isSubsetArray(this.iconDescriptors, e1.iconDescriptors, lm) && this.isSubsetArray(this.patternDescriptors, e1.patternDescriptors, lm); 13899 } 13900 isSubsetArray(e1, t1, i) { 13901 let n = 0, r = 0; 13902 if (e1.length > t1.length) return !1; 13903 for(; n < e1.length && r < t1.length;){ 13904 const o = i(e1[n], t1[r]); 13905 if (0 === o) n++, r++; 13906 else { 13907 if (o < 0) return !1; 13908 r++; 13909 } 13910 } 13911 return n === e1.length; 13912 } 13913 constructor(e1, t1, i, n, r = "", o){ 13914 this.scope = r, this.iconDescriptors = [], this.patternDescriptors = [], this.requiresMipMaps = t1.size > 0, hm(e1, i, this.iconDescriptors, o), hm(t1, i, this.patternDescriptors, o), this.iconDescriptors.sort(lm), this.patternDescriptors.sort(lm); 13915 let a = 0; 13916 a = um(a, cm(r)), a = um(a, 1); 13917 const s = n ? n.data : ""; 13918 s && (a = um(a, cm(s))), a = um(a, 1); 13919 for (const e1 of this.iconDescriptors)a = um(a, cm(e1.id)), a = um(a, e1.version), a = um(a, e1.sx), a = um(a, e1.sy); 13920 a = um(a, 1); 13921 for (const e1 of this.patternDescriptors)a = um(a, cm(e1.id)), a = um(a, e1.version), a = um(a, e1.sx), a = um(a, e1.sy); 13922 this.hash = a; 13923 } 13924 } 13925 function fm(e1) { 13926 switch(e1){ 13927 case WebGL2RenderingContext.RGBA8: 13928 case WebGL2RenderingContext.RGBA16F: 13929 return WebGL2RenderingContext.RGBA; 13930 case WebGL2RenderingContext.DEPTH_COMPONENT16: 13931 return WebGL2RenderingContext.DEPTH_COMPONENT; 13932 case WebGL2RenderingContext.DEPTH24_STENCIL8: 13933 return WebGL2RenderingContext.DEPTH_STENCIL; 13934 case WebGL2RenderingContext.R8: 13935 case WebGL2RenderingContext.R32F: 13936 return WebGL2RenderingContext.RED; 13937 } 13938 } 13939 function pm(e1) { 13940 switch(e1){ 13941 case WebGL2RenderingContext.RGBA8: 13942 return WebGL2RenderingContext.UNSIGNED_BYTE; 13943 case WebGL2RenderingContext.RGBA16F: 13944 return WebGL2RenderingContext.HALF_FLOAT; 13945 case WebGL2RenderingContext.DEPTH_COMPONENT16: 13946 return WebGL2RenderingContext.UNSIGNED_SHORT; 13947 case WebGL2RenderingContext.DEPTH24_STENCIL8: 13948 return WebGL2RenderingContext.UNSIGNED_INT_24_8; 13949 case WebGL2RenderingContext.R8: 13950 return WebGL2RenderingContext.UNSIGNED_BYTE; 13951 case WebGL2RenderingContext.R32F: 13952 return WebGL2RenderingContext.FLOAT; 13953 } 13954 } 13955 Xa(dm, "AtlasContentDescriptor"); 13956 class mm { 13957 update(e1, t1) { 13958 const i = e1 && e1 instanceof HTMLVideoElement && 0 === e1.width ? e1.videoWidth : e1.width, n = e1 && e1 instanceof HTMLVideoElement && 0 === e1.height ? e1.videoHeight : e1.height, { context: r } = this, { gl: o } = r, { x: a, y: s } = t1 && t1.position ? t1.position : { 13959 x: 0, 13960 y: 0 13961 }, l = a + i, c = s + n; 13962 this.size && (this.size[0] !== l || this.size[1] !== c) && (!t1 || void 0 === t1.recreateWhenResize || t1.recreateWhenResize) && (o.bindTexture(o.TEXTURE_2D, null), o.deleteTexture(this.texture), this.texture = o.createTexture(), this.size = null), o.bindTexture(o.TEXTURE_2D, this.texture), r.pixelStoreUnpackFlipY.set(!1), r.pixelStoreUnpack.set(1), r.pixelStoreUnpackPremultiplyAlpha.set(this.format === o.RGBA8 && (!t1 || !1 !== t1.premultiply)); 13963 const u = e1 instanceof HTMLImageElement || e1 instanceof HTMLCanvasElement || e1 instanceof HTMLVideoElement || e1 instanceof ImageData || ImageBitmap && e1 instanceof ImageBitmap; 13964 if (!this.size && l > 0 && c > 0) { 13965 const e1 = this.useMipmap ? Math.floor(Math.log2(Math.max(l, c))) + 1 : 1; 13966 o.texStorage2D(o.TEXTURE_2D, e1, this.format, l, c), this.size = [ 13967 l, 13968 c 13969 ]; 13970 } 13971 this.size && (u ? o.texSubImage2D(o.TEXTURE_2D, 0, a, s, fm(this.format), pm(this.format), e1) : "data" in e1 && e1.data && o.texSubImage2D(o.TEXTURE_2D, 0, a, s, i, n, fm(this.format), pm(this.format), e1.data)), this.useMipmap && o.generateMipmap(o.TEXTURE_2D); 13972 } 13973 bind(e1, t1) { 13974 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 13975 const { context: n } = this, { gl: r } = n; 13976 r.bindTexture(r.TEXTURE_2D, this.texture), e1 !== this.minFilter && (r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, e1), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, this.useMipmap && !i ? e1 === r.NEAREST ? r.NEAREST_MIPMAP_NEAREST : r.LINEAR_MIPMAP_LINEAR : e1), this.minFilter = e1), t1 !== this.wrapS && (r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, t1), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, t1), this.wrapS = t1); 13977 } 13978 bindExtraParam(e1, t1, i, n, r) { 13979 const { context: o } = this, { gl: a } = o; 13980 a.bindTexture(a.TEXTURE_2D, this.texture), t1 !== this.magFilter && (a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MAG_FILTER, t1), this.magFilter = t1), e1 !== this.minFilter && (a.texParameteri(a.TEXTURE_2D, a.TEXTURE_MIN_FILTER, this.useMipmap ? e1 === a.NEAREST ? a.NEAREST_MIPMAP_NEAREST : a.LINEAR_MIPMAP_LINEAR : e1), this.minFilter = e1), i !== this.wrapS && (a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_S, i), this.wrapS = i), n !== this.wrapT && (a.texParameteri(a.TEXTURE_2D, a.TEXTURE_WRAP_T, n), this.wrapT = n), r !== this.compareMode && (r ? (a.texParameteri(a.TEXTURE_2D, a.TEXTURE_COMPARE_MODE, a.COMPARE_REF_TO_TEXTURE), a.texParameteri(a.TEXTURE_2D, a.TEXTURE_COMPARE_FUNC, r)) : a.texParameteri(a.TEXTURE_2D, a.TEXTURE_COMPARE_MODE, a.NONE), this.compareMode = r); 13981 } 13982 destroy() { 13983 const { gl: e1 } = this.context; 13984 e1.deleteTexture(this.texture), this.texture = null; 13985 } 13986 constructor(e1, t1, i, n){ 13987 this.context = e1, this.format = i, this.useMipmap = n && n.useMipmap, this.texture = e1.gl.createTexture(), this.update(t1, { 13988 premultiply: n && n.premultiply 13989 }); 13990 } 13991 } 13992 class _m { 13993 bind(e1, t1) { 13994 const { context: i } = this, { gl: n } = i; 13995 n.bindTexture(n.TEXTURE_3D, this.texture), e1 !== this.minFilter && (n.texParameteri(n.TEXTURE_3D, n.TEXTURE_MAG_FILTER, e1), n.texParameteri(n.TEXTURE_3D, n.TEXTURE_MIN_FILTER, e1), this.minFilter = e1), t1 !== this.wrapS && (n.texParameteri(n.TEXTURE_3D, n.TEXTURE_WRAP_S, t1), n.texParameteri(n.TEXTURE_3D, n.TEXTURE_WRAP_T, t1), this.wrapS = t1); 13996 } 13997 destroy() { 13998 const { gl: e1 } = this.context; 13999 e1.deleteTexture(this.texture), this.texture = null; 14000 } 14001 constructor(e1, t1, i, n){ 14002 this.context = e1, this.format = n, this.size = i, this.texture = e1.gl.createTexture(); 14003 const [r, o, a] = this.size, { gl: s } = e1; 14004 s.bindTexture(s.TEXTURE_3D, this.texture), e1.pixelStoreUnpackFlipY.set(!1), e1.pixelStoreUnpack.set(1), e1.pixelStoreUnpackPremultiplyAlpha.set(!1), "data" in t1 && t1.data && s.texImage3D(s.TEXTURE_3D, 0, this.format, r, o, a, 0, fm(this.format), pm(this.format), t1.data); 14005 } 14006 } 14007 class gm { 14008 static getImagePositionScale(e1, t1, i) {
14009 if (t1 && e1) { 14010 const { sx: t1, sy: i } = e1; 14011 return { 14012 x: t1, 14013 y: i 14014 }; 14015 } 14016 return { 14017 x: i, 14018 y: i 14019 }; 14020 } 14021 get tl() { 14022 return [ 14023 this.paddedRect.x + this.padding, 14024 this.paddedRect.y + this.padding 14025 ]; 14026 } 14027 get br() { 14028 return [ 14029 this.paddedRect.x + this.paddedRect.w - this.padding, 14030 this.paddedRect.y + this.paddedRect.h - this.padding 14031 ]; 14032 } 14033 get displaySize() { 14034 return [ 14035 (this.paddedRect.w - 2 * this.padding) / this.scale.x, 14036 (this.paddedRect.h - 2 * this.padding) / this.scale.y 14037 ]; 14038 } 14039 constructor(e1, t1, i, n){ 14040 this.paddedRect = e1; 14041 const { pixelRatio: r, version: o, stretchX: a, stretchY: s, content: l, sdf: c, usvg: u } = t1; 14042 this.pixelRatio = r, this.stretchX = a, this.stretchY = s, this.content = l, this.version = o, this.padding = i, this.sdf = c, this.usvg = u, this.scale = gm.getImagePositionScale(n, u, r); 14043 } 14044 } 14045 function ym(e1, t1, i) { 14046 const n = jn.parse(e1), r = function(e1, t1) { 14047 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [ 14048 1, 14049 1 14050 ]; 14051 return { 14052 x: 0, 14053 y: 0, 14054 w: (e1.data ? e1.data.width : e1.width * i[0]) + 2 * t1, 14055 h: (e1.data ? e1.data.height : e1.height * i[1]) + 2 * t1 14056 }; 14057 }(t1, i, [ 14058 n.sx, 14059 n.sy 14060 ]); 14061 return { 14062 bin: r, 14063 imagePosition: new gm(r, t1, i, n), 14064 imageVariant: n 14065 }; 14066 } 14067 function xm(e1, t1) { 14068 const i = []; 14069 for (const [n, r] of e1.entries()){ 14070 const e1 = jn.parse(n); 14071 e1 && (i.push({ 14072 key: n, 14073 value: r, 14074 variant: e1 14075 }), t1 && t1.set(n, e1)); 14076 } 14077 i.sort((e1, t1)=>{ 14078 const i = e1.variant.id.toString().localeCompare(t1.variant.id.toString()); 14079 return 0 !== i ? i : e1.variant.sx !== t1.variant.sx ? e1.variant.sx - t1.variant.sx : e1.variant.sy !== t1.variant.sy ? e1.variant.sy - t1.variant.sy : e1.key.localeCompare(t1.key); 14080 }); 14081 const n = new Map; 14082 for (const e1 of i)n.set(e1.key, e1.value); 14083 return n; 14084 } 14085 class vm { 14086 constructor(e1){ 14087 this.sourceAtlasHash = e1; 14088 } 14089 } 14090 class bm { 14091 addImages(e1, t1, i, n) { 14092 for (const [r, o] of e1.entries()){ 14093 const { bin: e1, imagePosition: a, imageVariant: s } = ym(r, o, i); 14094 t1.set(r, a), n.push(e1), o.hasRenderCallback && this.haveRenderCallbacks.push(s.id); 14095 } 14096 } 14097 patchUpdatedImages(e1, t1, i, n) { 14098 this.haveRenderCallbacks = this.haveRenderCallbacks.filter((t1)=>e1.hasImage(t1, i)), e1.dispatchRenderCallbacks(this.haveRenderCallbacks, i); 14099 for (const r of e1.getUpdatedImages(i)){ 14100 for (const n of this.iconPositions.keys()){ 14101 const o = jn.parse(n); 14102 if (cn.isEqual(o.id, r)) { 14103 const o = e1.getImage(r, i); 14104 this.patchUpdatedImage(this.iconPositions.get(n), o, t1, null); 14105 } 14106 } 14107 for (const o of this.patternPositions.keys()){ 14108 const a = jn.parse(o); 14109 if (cn.isEqual(a.id, r)) { 14110 const a = e1.getImage(r, i); 14111 this.patchUpdatedImage(this.patternPositions.get(o), a, t1, n || this.lut); 14112 } 14113 } 14114 } 14115 } 14116 patchUpdatedImage(e1, t1, i) { 14117 let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null; 14118 if (!e1 || !t1) return; 14119 if (e1.version === t1.version) return; 14120 e1.version = t1.version;
vendor: 17,409 bytes, lines 14121-14527
14121 const [r, o] = e1.tl, a = e1.sdf; 14122 if (this.lut || a) { 14123 const e1 = { 14124 width: t1.data.width, 14125 height: t1.data.height 14126 }, s = new ud(e1); 14127 ud.copy(t1.data, s, { 14128 x: 0, 14129 y: 0 14130 }, { 14131 x: 0, 14132 y: 0 14133 }, e1, n, a), i.update(s, { 14134 position: { 14135 x: r, 14136 y: o 14137 }, 14138 recreateWhenResize: !1 14139 }); 14140 } else i.update(t1.data, { 14141 position: { 14142 x: r, 14143 y: o 14144 }, 14145 recreateWhenResize: !1 14146 }); 14147 } 14148 constructor(e1, t1, i, n, r = ""){ 14149 const o = new Map, a = new Map; 14150 this.haveRenderCallbacks = []; 14151 const s = [], l = void 0 !== n, c = l ? new Map : void 0, u = l ? xm(e1, c) : e1, h = l ? xm(t1, c) : t1; 14152 this.addImages(u, o, 1, s), this.addImages(h, a, 2, s); 14153 const { w: d, h: f } = sm(s), p = new ud({ 14154 width: d || 1, 14155 height: f || 1 14156 }); 14157 for (const [e1, t1] of u.entries()){ 14158 const i = o.get(e1).paddedRect; 14159 ud.copy(t1.data, p, { 14160 x: 0, 14161 y: 0 14162 }, { 14163 x: i.x + 1, 14164 y: i.y + 1 14165 }, t1.data, null, t1.sdf); 14166 } 14167 for (const [e1, t1] of h.entries()){ 14168 const n = a.get(e1), r = n.paddedRect; 14169 let o = n.padding; 14170 const s = r.x + o, l = r.y + o, c = t1.data.width, u = t1.data.height; 14171 o = o > 1 ? o - 1 : o, ud.copy(t1.data, p, { 14172 x: 0, 14173 y: 0 14174 }, { 14175 x: s, 14176 y: l 14177 }, t1.data, i), ud.copy(t1.data, p, { 14178 x: 0, 14179 y: u - o 14180 }, { 14181 x: s, 14182 y: l - o 14183 }, { 14184 width: c, 14185 height: o 14186 }, i), ud.copy(t1.data, p, { 14187 x: 0, 14188 y: 0 14189 }, { 14190 x: s, 14191 y: l + u 14192 }, { 14193 width: c, 14194 height: o 14195 }, i), ud.copy(t1.data, p, { 14196 x: c - o, 14197 y: 0 14198 }, { 14199 x: s - o, 14200 y: l 14201 }, { 14202 width: o, 14203 height: u 14204 }, i), ud.copy(t1.data, p, { 14205 x: 0, 14206 y: 0 14207 }, { 14208 x: s + c, 14209 y: l 14210 }, { 14211 width: o, 14212 height: u 14213 }, i), ud.copy(t1.data, p, { 14214 x: c - o, 14215 y: u - o 14216 }, { 14217 x: s - o, 14218 y: l - o 14219 }, { 14220 width: o, 14221 height: o 14222 }, i), ud.copy(t1.data, p, { 14223 x: 0, 14224 y: u - o 14225 }, { 14226 x: s + c, 14227 y: l - o 14228 }, { 14229 width: o, 14230 height: o 14231 }, i), ud.copy(t1.data, p, { 14232 x: 0, 14233 y: 0 14234 }, { 14235 x: s + c, 14236 y: l + u 14237 }, { 14238 width: o, 14239 height: o 14240 }, i), ud.copy(t1.data, p, { 14241 x: c - o, 14242 y: 0 14243 }, { 14244 x: s - o, 14245 y: l + u 14246 }, { 14247 width: o, 14248 height: o 14249 }, i); 14250 } 14251 this.lut = i, this.image = p, this.iconPositions = o, this.patternPositions = a, l && (this.contentDescriptor = new dm(u, h, n, i, r, c)); 14252 } 14253 } 14254 Xa(gm, "ImagePosition"), Xa(bm, "ImageAtlas", { 14255 omit: [ 14256 "lut" 14257 ] 14258 }), Xa(vm, "ImageAtlasReference"); 14259 class wm { 14260 loadGlyphRange(e1, t1, i, n, r) { 14261 if ("server" === this.fontstackCompositing) return void wm.loadGlyphRange(e1, t1, i, n, r); 14262 const o = e1.split(",").map((e1)=>e1.trim()).filter((e1)=>e1.length > 0); 14263 0 !== o.length ? 1 !== o.length ? this._loadMultipleFonts(o, t1, i, n, r) : this._loadFont(o[0], t1, i, n, r) : r(new Error("Empty fontstack")); 14264 } 14265 _loadMultipleFonts(e1, t1, i, n, r) { 14266 const o = e1.map(()=>null), a = { 14267 completed: 0, 14268 firstError: null, 14269 callbackCalled: !1 14270 }, s = (t1, i, n)=>{ 14271 if (!a.callbackCalled && (i && !a.firstError && (a.firstError = i), n && (o[t1] = n), a.completed++, a.completed === e1.length)) { 14272 a.callbackCalled = !0; 14273 const e1 = o.filter((e1)=>null !== e1); 14274 if (0 === e1.length) return void r(a.firstError || new Error("All fonts failed to load")); 14275 const t1 = this._composeGlyphs(e1); 14276 r(null, t1); 14277 } 14278 }; 14279 for(let r = 0; r < e1.length; r++)this._loadFont(e1[r], t1, i, n, (e1, t1)=>{ 14280 s(r, e1, t1); 14281 }); 14282 } 14283 _loadFont(e1, t1, i, n, r) { 14284 const o = "".concat(e1, ":").concat(t1); 14285 if (this.cachedRanges.has(o)) { 14286 const e1 = this.cachedRanges.get(o); 14287 return void kt.frame(()=>r(null, e1)); 14288 } 14289 const a = this.pendingRequests.get(o); 14290 a ? a.push(r) : (this.pendingRequests.set(o, [ 14291 r 14292 ]), wm.loadGlyphRange(e1, t1, i, n, (e1, t1)=>{ 14293 e1 || this.cachedRanges.set(o, t1 || null); 14294 const i = this.pendingRequests.get(o); 14295 if (this.pendingRequests.delete(o), i) for (const n of i)n(e1, t1); 14296 })); 14297 } 14298 _composeGlyphs(e1) { 14299 const t1 = {}; 14300 let i, n; 14301 for (const r of e1)if (void 0 === i && void 0 !== r.ascender && (i = r.ascender), void 0 === n && void 0 !== r.descender && (n = r.descender), r.glyphs) for(const e1 in r.glyphs)void 0 === t1[e1] && (t1[e1] = r.glyphs[e1]); 14302 return { 14303 glyphs: t1, 14304 ascender: i, 14305 descender: n 14306 }; 14307 } 14308 constructor(e1){ 14309 this.pendingRequests = new Map, this.cachedRanges = new Map, this.fontstackCompositing = e1 && e1.fontstackCompositing || "client"; 14310 } 14311 } 14312 wm.loadGlyphRange = async function(e1, t1, i, n, r) { 14313 const o = 256 * t1, a = o + 255; 14314 let s; 14315 try { 14316 const t1 = await n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}", e1).replace("{range}", "".concat(o, "-").concat(a)), si.Glyphs), { data: r } = await _i(t1), l = {}, c = function(e1) { 14317 return function(e1) { 14318 const t1 = { 14319 glyphs: [] 14320 }; 14321 let i; 14322 for(; i = e1.nextField();)1 === i && om(e1, e1.readVarint() + e1.pos, t1); 14323 return t1; 14324 }(new Wp(e1)); 14325 }(r); 14326 for (const e1 of c.glyphs)l[e1.id] = e1; 14327 s = { 14328 glyphs: l, 14329 ascender: c.ascender, 14330 descender: c.descender 14331 }; 14332 } catch (e1) { 14333 return r(e1); 14334 } 14335 r(null, s); 14336 }; 14337 const Am = 1e20, Em = new Float64Array(256); 14338 for(let e1 = 0; e1 < 256; e1++){ 14339 const t1 = .5 - Math.pow(e1 / 255, 1 / 2.2); 14340 Em[e1] = t1 * Math.abs(t1); 14341 } 14342 function Im(e1, t1, i, n, r, o, a, s, l) { 14343 for(let c = t1; c < t1 + n; c++)Mm(e1, i * o + c, o, r, a, s, l); 14344 for(let c = i; c < i + r; c++)Mm(e1, c * o + t1, 1, n, a, s, l); 14345 } 14346 function Mm(e1, t1, i, n, r, o, a) { 14347 o[0] = 0, a[0] = -Am, a[1] = Am, r[0] = e1[t1]; 14348 for(let s = 1, l = 0, c = 0; s < n; s++){ 14349 r[s] = e1[t1 + s * i]; 14350 const n = s * s; 14351 do { 14352 const e1 = o[l]; 14353 c = (r[s] - r[e1] + n - e1 * e1) / (s - e1) / 2; 14354 }while (c <= a[l] && --l > -1) 14355 l++, o[l] = s, a[l] = c, a[l + 1] = Am; 14356 } 14357 for(let s = 0, l = 0; s < n; s++){ 14358 for(; a[l + 1] < s;)l++; 14359 const n = o[l], c = s - n; 14360 e1[t1 + s * i] = r[n] + c * c; 14361 } 14362 } 14363 Em[255] = -Am; 14364 const Tm = /bold/i, Sm = /medium/i, zm = /light/i, Rm = { 14365 none: 0, 14366 ideographs: 1, 14367 all: 2 14368 }; 14369 class Pm { 14370 setURL(e1) { 14371 this.url = e1; 14372 } 14373 prefetchRange(e1, t1) { 14374 const i = this.url || jt.GLYPHS_URL; 14375 if (!i) return; 14376 let n = this.entries[e1]; 14377 n || (n = this.entries[e1] = { 14378 glyphs: {}, 14379 requests: {}, 14380 ranges: {} 14381 }), n.ranges[t1] || n.requests[t1] || (n.requests[t1] = [], this.glyphLoader.loadGlyphRange(e1, t1, i, this.requestManager, (e1, i)=>{ 14382 if (i) { 14383 n.ascender = i.ascender, n.descender = i.descender; 14384 for(const e1 in i.glyphs)this._doesCharSupportLocalGlyph(+e1) || (n.glyphs[+e1] = i.glyphs[+e1]); 14385 n.ranges[t1] = !0; 14386 } 14387 for (const r of n.requests[t1] || [])r(e1, i); 14388 delete n.requests[t1]; 14389 })); 14390 } 14391 getGlyphs(e1, t1) { 14392 const i = [], n = this.url || jt.GLYPHS_URL; 14393 for(const t1 in e1)for (const n of e1[t1])i.push({ 14394 stack: t1, 14395 id: n 14396 }); 14397 ot(i, (param, i)=>{ 14398 let { stack: e1, id: t1 } = param; 14399 let r = this.entries[e1]; 14400 r || (r = this.entries[e1] = { 14401 glyphs: {}, 14402 requests: {}, 14403 ranges: {}, 14404 ascender: void 0, 14405 descender: void 0 14406 }); 14407 let o = r.glyphs[t1]; 14408 if (void 0 !== o) return void i(null, { 14409 stack: e1, 14410 id: t1, 14411 glyph: o 14412 }); 14413 if (o = this._tinySDF(r, e1, t1), o) return r.glyphs[t1] = o, void i(null, { 14414 stack: e1, 14415 id: t1, 14416 glyph: o 14417 }); 14418 const a = Math.floor(t1 / 256); 14419 if (256 * a > 65535) return gt("glyphs > 65535 not supported"), void i(null, { 14420 stack: e1, 14421 id: t1, 14422 glyph: o 14423 }); 14424 if (r.ranges[a]) return void i(null, { 14425 stack: e1, 14426 id: t1, 14427 glyph: o 14428 }); 14429 let s = r.requests[a]; 14430 s || (s = r.requests[a] = [], this.glyphLoader.loadGlyphRange(e1, a, n, this.requestManager, (e1, t1)=>{ 14431 if (t1) { 14432 r.ascender = t1.ascender, r.descender = t1.descender; 14433 for(const e1 in t1.glyphs)this._doesCharSupportLocalGlyph(+e1) || (r.glyphs[+e1] = t1.glyphs[+e1]); 14434 r.ranges[a] = !0; 14435 } 14436 for (const i of s)i(e1, t1); 14437 delete r.requests[a]; 14438 })), s.push((n, r)=>{ 14439 n ? i(n) : r && i(null, { 14440 stack: e1, 14441 id: t1, 14442 glyph: r.glyphs[t1] || null 14443 }); 14444 }); 14445 }, (e1, i)=>{ 14446 if (e1) t1(e1); 14447 else if (i) { 14448 const e1 = {}; 14449 for (const { stack: t1, id: n, glyph: r } of i)void 0 === e1[t1] && (e1[t1] = {}), void 0 === e1[t1].glyphs && (e1[t1].glyphs = {}), e1[t1].glyphs[n] = r && { 14450 id: r.id, 14451 bitmap: r.bitmap.clone(), 14452 metrics: r.metrics 14453 }, e1[t1].ascender = this.entries[t1].ascender, e1[t1].descender = this.entries[t1].descender; 14454 t1(null, e1); 14455 } 14456 }); 14457 } 14458 _doesCharSupportLocalGlyph(e1) { 14459 return this.localGlyphMode !== Rm.none && (this.localGlyphMode === Rm.all ? !!this.localFontFamily : !!this.localFontFamily && (gs(e1) || vs(e1) || ls(e1) || cs(e1) || ss(e1) || _s(e1) || (t1 = e1) >= 131072 && t1 <= 173791 || ((e1)=>e1 >= 66736 && e1 <= 66815)(e1))); 14460 //TURBOPACK unreachable 14461 ; 14462 var t1; 14463 } 14464 _tinySDF(e1, t1, i) { 14465 const n = this.localFontFamily; 14466 if (!n || !this._doesCharSupportLocalGlyph(i)) return; 14467 let r = e1.tinySDF; 14468 if (!r) { 14469 let i = "400"; 14470 Tm.test(t1) ? i = "900" : Sm.test(t1) ? i = "500" : zm.test(t1) && (i = "200"), r = e1.tinySDF = new Pm.TinySDF({ 14471 fontFamily: n, 14472 fontWeight: i, 14473 fontSize: 48, 14474 buffer: 6, 14475 radius: 16 14476 }), r.fontWeight = i; 14477 } 14478 const o = r.fontWeight; 14479 if (this.localGlyphs[o][i]) return this.localGlyphs[o][i]; 14480 const a = String.fromCodePoint(i), { data: s, width: l, height: c, glyphWidth: u, glyphHeight: h, glyphLeft: d, glyphTop: f, glyphAdvance: p } = r.draw(a); 14481 return this.localGlyphs[o][i] = { 14482 id: i, 14483 bitmap: new cd({ 14484 width: l, 14485 height: c 14486 }, s), 14487 metrics: { 14488 width: u / 2, 14489 height: h / 2, 14490 left: d / 2, 14491 top: f / 2 - 27, 14492 advance: p / 2, 14493 localGlyph: !0 14494 } 14495 }; 14496 } 14497 constructor(e1, t1, i, n){ 14498 this.requestManager = e1, this.localGlyphMode = t1, this.localFontFamily = i, this.url = "", this.entries = {}, this.localGlyphs = { 14499 200: {}, 14500 400: {}, 14501 500: {}, 14502 900: {} 14503 }, this.glyphLoader = new wm({ 14504 fontstackCompositing: n 14505 }); 14506 } 14507 } 14508 function Dm(e1, t1) { 14509 return e1 + t1[1] - t1[0]; 14510 } 14511 function Fm(e1, t1, i, n) { 14512 let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1; 14513 const o = [], a = e1.imagePrimary, s = a.pixelRatio, l = a.paddedRect.w - 2, c = a.paddedRect.h - 2, u = (e1.right - e1.left) * r, h = (e1.bottom - e1.top) * r, d = a.stretchX || [ 14514 [ 14515 0, 14516 l 14517 ] 14518 ], f = a.stretchY || [ 14519 [ 14520 0, 14521 c 14522 ] 14523 ], p = d.reduce(Dm, 0), m = f.reduce(Dm, 0), _ = l - p, g = c - m; 14524 let y = 0, x = p, v = 0, b = m, w = 0, A = _, E = 0, I = g; 14525 if (a.content && n) { 14526 const e1 = a.content; 14527 y = Cm(d, 0, e1[0]), v = Cm(f, 0, e1[1]), x = Cm(d, e1[0], e1[2]), b = Cm(f, e1[1], e1[3]), w = e1[0] - y, E = e1[1] - v, A = e1[2] - e1[0] - x, I = e
145271[3] - e1[1] - b; 14528 } 14529 const M = (n, o, l, c)=>{ 14530 const d = Bm(n.stretch - y, x, u, e1.left * r), f = Vm(n.fixed - w, A, n.stretch, p), _ = Bm(o.stretch - v, b, h, e1.top * r), g = Vm(o.fixed - E, I, o.stretch, m), M = Bm(l.stretch - y, x, u, e1.left * r), T = Vm(l.fixed - w, A, l.stretch, p), S = Bm(c.stretch - v, b, h, e1.top * r), z = Vm(c.fixed - E, I, c.stretch, m), R = new Pe(d, _), P = new Pe(M, _), D = new Pe(M, S), F = new Pe(d, S), C = new Pe(f / s, g / s), L = new Pe(T / s, z / s), O = t1 * Math.PI / 180; 14531 if (O) { 14532 const e1 = Math.sin(O), t1 = Math.cos(O), i = [ 14533 t1, 14534 -e1, 14535 e1, 14536 t1 14537 ]; 14538 R._matMult(i), P._matMult(i), F._matMult(i), D._matMult(i); 14539 } 14540 const B = n.stretch + n.fixed, V = l.stretch + l.fixed, N = o.stretch + o.fixed, k = c.stretch + c.fixed, U = e1.imageSecondary; 14541 return { 14542 tl: R, 14543 tr: P, 14544 bl: F, 14545 br: D, 14546 texPrimary: { 14547 x: a.paddedRect.x + 1 + B, 14548 y: a.paddedRect.y + 1 + N, 14549 w: V - B, 14550 h: k - N 14551 }, 14552 texSecondary: U ? { 14553 x: U.paddedRect.x + 1 + B, 14554 y: U.paddedRect.y + 1 + N, 14555 w: V - B, 14556 h: k - N 14557 } : void 0, 14558 writingMode: void 0, 14559 glyphOffset: [ 14560 0, 14561 0 14562 ], 14563 sectionIndex: 0, 14564 pixelOffsetTL: C, 14565 pixelOffsetBR: L, 14566 minFontScaleX: A / s / u, 14567 minFontScaleY: I / s / h, 14568 isSDF: i 14569 }; 14570 }; 14571 if (a.stretchX || a.stretchY) { 14572 const e1 = Lm(d, _, p), t1 = Lm(f, g, m); 14573 for(let i = 0; i < e1.length - 1; i++){ 14574 const n = e1[i], r = e1[i + 1]; 14575 for(let e1 = 0; e1 < t1.length - 1; e1++)o.push(M(n, t1[e1], r, t1[e1 + 1])); 14576 } 14577 } else o.push(M({ 14578 fixed: 0, 14579 stretch: -1 14580 }, { 14581 fixed: 0, 14582 stretch: -1 14583 }, { 14584 fixed: 0, 14585 stretch: l + 1 14586 }, { 14587 fixed: 0, 14588 stretch: c + 1 14589 })); 14590 return o; 14591 } 14592 function Cm(e1, t1, i) { 14593 let n = 0; 14594 for (const r of e1)n += Math.max(t1, Math.min(i, r[1])) - Math.max(t1, Math.min(i, r[0])); 14595 return n; 14596 } 14597 function Lm(e1, t1, i) { 14598 const n = [ 14599 { 14600 fixed: -1, 14601 stretch: 0 14602 } 14603 ]; 14604 for (const [t1, i] of e1){ 14605 const e1 = n.at(-1); 14606 n.push({ 14607 fixed: t1 - e1.stretch, 14608 stretch: e1.stretch 14609 }), n.push({ 14610 fixed: t1 - e1.stretch, 14611 stretch: e1.stretch + (i - t1) 14612 }); 14613 } 14614 return n.push({ 14615 fixed: t1 + 1, 14616 stretch: i 14617 }), n; 14618 } 14619 function Om(e1) { 14620 return 2 * e1.length + 1; 14621 } 14622 function Bm(e1, t1, i, n) { 14623 return e1 / t1 * i + n; 14624 } 14625 function Vm(e1, t1, i, n) { 14626 return e1 - t1 * i / n; 14627 } 14628 function Nm(e1, t1, i, n) { 14629 const r = t1 + e1.positionedLines[n].lineOffset; 14630 return 0 === n ? i + r / 2 : i + (r + (t1 + e1.positionedLines[n - 1].lineOffset)) / 2; 14631 } 14632 function km(e1, t1, i, n, r, o, a, s, l) { 14633 let c = arguments.length > 9 && arguments[9] !== void 0 ? arguments[9] : 1; 14634 const u = []; 14635 if (0 === t1.positionedLines.length) return u; 14636 const h = (void 0 !== l ? l : n.layout.get("text-rotate").evaluate(o, {})) * Math.PI / 180, d = function(e1) { 14637 const t1 = e1[0], i = e1[1], n = t1 * i; 14638 return n > 0 ? [ 14639 t1, 14640 -i 14641 ] : n < 0 ? [ 14642 -t1, 14643 i 14644 ] : 0 === t1 ? [ 14645 i, 14646 t1 14647 ] : [ 14648 i, 14649 -t1 14650 ]; 14651 }(i); 14652 let f = Math.abs(t1.top - t1.bottom); 14653 for (const e1 of t1.positionedLines)f -= e1.lineOffset; 14654 const p = t1.positionedLines.length, m = f / p; 14655 let _ = t1.top - i[1]; 14656 for(let e1 = 0; e1 < p; ++e1){ 14657 const n = t1.positionedLines[e1]; 14658 _ = Nm(t1, m, _, e1); 14659 for (const e1 of n.positionedGlyphs){ 14660 if (!e1.rect) continue; 14661 const n = e1.rect || {}; 14662 let o = 4, l = !0, f = 1, p = 0; 14663 if (e1.image) { 14664 const t1 = a.get(e1.image.toString()); 14665 if (!t1) continue; 14666 if (t1.sdf) { 14667 gt("SDF images are not supported in formatted text and will be ignored."); 14668 continue; 14669 } 14670 l = !1, f = t1.pixelRatio, o = 1 / f, t1.usvg || (f /= c); 14671 } 14672 const m = (r || s) && e1.vertical, g = e1.metrics.advance * e1.scale / 2, y = e1.metrics, x = e
vendor: 16,177 bytes, lines 14672-14942
146721.rect; 14673 if (null === x) continue; 14674 s && t1.verticalizable && (p = e1.image ? g - e1.metrics.width * e1.scale / 2 : 0); 14675 const v = r ? [ 14676 e1.x + g, 14677 e1.y 14678 ] : [ 14679 0, 14680 0 14681 ]; 14682 let b = [ 14683 0, 14684 0 14685 ], w = [ 14686 0, 14687 0 14688 ], A = !1; 14689 r || (m ? (w = [ 14690 e1.x + g + d[0], 14691 e1.y + d[1] - p 14692 ], A = !0) : b = [ 14693 e1.x + g + i[0], 14694 e1.y + i[1] - p 14695 ]); 14696 const E = x.w * e1.scale / (f * (e1.localGlyph ? 2 : 1)), I = x.h * e1.scale / (f * (e1.localGlyph ? 2 : 1)); 14697 let M, T, S, z; 14698 if (m) { 14699 const t1 = e1.y - _, i = new Pe(-g, g - t1), n = -Math.PI / 2, r = new Pe(...w); 14700 M = new Pe(-g + b[0], b[1]), M._rotateAround(n, i)._add(r), M.x += -t1 + g, M.y -= (y.left - o) * e1.scale; 14701 const a = e1.image ? y.advance * e1.scale : Wd * e1.scale, s = String.fromCodePoint(e1.glyph); 14702 ef(s) ? M.x += (1 - o) * e1.scale : tf(s) ? M.x += a - y.height * e1.scale + (-o - 1) * e1.scale : M.x += e1.image || y.width + 2 * o === x.w && y.height + 2 * o === x.h ? (a - I) / 2 : (a - (y.height + 2 * o) * e1.scale) / 2, T = new Pe(M.x, M.y - E), S = new Pe(M.x + I, M.y), z = new Pe(M.x + I, M.y - E); 14703 } else { 14704 const t1 = (y.left - o) * e1.scale - g + b[0], i = (-y.top - o) * e1.scale + b[1], n = t1 + E, r = i + I; 14705 M = new Pe(t1, i), T = new Pe(n, i), S = new Pe(t1, r), z = new Pe(n, r); 14706 } 14707 if (h) { 14708 let e1; 14709 e1 = r ? new Pe(0, 0) : A ? new Pe(d[0], d[1]) : new Pe(i[0], i[1]), M._rotateAround(h, e1), T._rotateAround(h, e1), S._rotateAround(h, e1), z._rotateAround(h, e1); 14710 } 14711 const R = new Pe(0, 0), P = new Pe(0, 0); 14712 u.push({ 14713 tl: M, 14714 tr: T, 14715 bl: S, 14716 br: z, 14717 texPrimary: n, 14718 texSecondary: void 0, 14719 writingMode: t1.writingMode, 14720 glyphOffset: v, 14721 sectionIndex: e1.sectionIndex, 14722 isSDF: l, 14723 pixelOffsetTL: R, 14724 pixelOffsetBR: P, 14725 minFontScaleX: 0, 14726 minFontScaleY: 0 14727 }); 14728 } 14729 } 14730 return u; 14731 } 14732 Pm.TinySDF = class { 14733 _createCanvas(e1) { 14734 if ("undefined" != typeof OffscreenCanvas) return new OffscreenCanvas(e1, e1); 14735 const t1 = document.createElement("canvas"); 14736 return t1.width = t1.height = e1, t1; 14737 } 14738 draw(e1) { 14739 const { width: t1, actualBoundingBoxAscent: i, actualBoundingBoxDescent: n, actualBoundingBoxLeft: r, actualBoundingBoxRight: o } = this.ctx.measureText(e1), a = Math.ceil(i), s = Math.floor(-r), l = Math.max(0, Math.min(this.size - this.buffer, Math.ceil(o) - s)), c = Math.max(0, Math.min(this.size - this.buffer, a + Math.ceil(n))), u = l + 2 * this.buffer, h = c + 2 * this.buffer, d = Math.max(u * h, 0), f = new Uint8ClampedArray(d), p = { 14740 data: f, 14741 width: u, 14742 height: h, 14743 glyphWidth: l, 14744 glyphHeight: c, 14745 glyphTop: a, 14746 glyphLeft: s, 14747 glyphAdvance: t1 14748 }; 14749 if (0 === l || 0 === c) return p; 14750 const { ctx: m, buffer: _, gridInner: g, gridOuter: y } = this; 14751 this.lang && (m.lang = this.lang), m.clearRect(_, _, l, c), m.fillText(e1, _ - s, _ + a); 14752 const x = m.getImageData(_, _, l, c); 14753 y.fill(Am, 0, d), g.fill(0, 0, d); 14754 let v = 3; 14755 for(let e1 = 0; e1 < c; e1++){ 14756 let t1 = (e1 + _) * u + _; 14757 for(let e1 = 0; e1 < l; e1++, v += 4, t1++){ 14758 const e1 = x.data[v]; 14759 if (0 === e1) continue; 14760 const i = Em[e1]; 14761 y[t1] = Math.max(0, i), g[t1] = Math.max(0, -i); 14762 } 14763 } 14764 Im(y, 0, 0, u, h, u, this.f, this.v, this.z); 14765 const b = Math.min(_, 1); 14766 Im(g, _ - b, _ - b, l + 2 * b, c + 2 * b, u, this.f, this.v, this.z); 14767 const w = 255 / this.radius, A = 255 * (1 - this.cutoff); 14768 for(let e1 = 0; e1 < d; e1++){ 14769 const t1 = Math.sqrt(y[e1]) - Math.sqrt(g[e1]); 14770 f[e1] = Math.round(A - w * t1); 14771 } 14772 return p; 14773 } 14774 constructor({ fontSize: e1 = 24, buffer: t1 = 3, radius: i = 8, cutoff: n = .25, fontFamily: r = "sans-serif", fontWeight: o = "normal", fontStyle: a = "normal", lang: s = null } = {}){ 14775 this.buffer = t1, this.radius = i, this.cutoff = n, this.lang = s; 14776 const l = this.size = e1 + 4 * t1, c = this._createCanvas(l), u = this.ctx = c.getContext("2d", { 14777 willReadFrequently: !0 14778 }); 14779 u.font = "".concat(a, " ").concat(o, " ").concat(e1, "px ").concat(r), u.textBaseline = "alphabetic", u.textAlign = "left", u.fillStyle = "black", this.gridOuter = new Float64Array(l * l), this.gridInner = new Float64Array(l * l), this.f = new Float64Array(l), this.z = new Float64Array(l + 1), this.v = new Uint16Array(l); 14780 } 14781 }; 14782 class Um { 14783 update(e1, t1) { 14784 const i = this.lastParams, n = !i || i.zoom !== e1.zoom || i.pitch !== (e1.pitch || 0) || i.brightness !== (e1.brightness || 0) || i.worldview !== e1.worldview; 14785 this.lastParams = { 14786 zoom: e1.zoom, 14787 pitch: e1.pitch || 0, 14788 brightness: e1.brightness || 0, 14789 worldview: e1.worldview 14790 }; 14791 const r = t1 && this.anyStateDependent; 14792 if (!n && !r && -2 !== this.lastAllFeaturesIndex) return { 14793 kind: "no-changes" 14794 }; 14795 if (!this.anyFeatureDependent && !r) { 14796 const t1 = this.evaluateAllFeatures(e1); 14797 return t1 === this.lastAllFeaturesIndex ? { 14798 kind: "no-changes" 14799 } : (this.lastAllFeaturesIndex = t1, { 14800 kind: "all-features", 14801 appearanceIndex: t1 14802 }); 14803 } 14804 return { 14805 kind: "per-feature" 14806 }; 14807 } 14808 evaluateAllFeatures(e1) { 14809 for(let t1 = 0; t1 < this.appearances.length; t1++){ 14810 const i = this.appearances[t1]; 14811 if (i.condition && i.condition.evaluate(e1, void 0, void 0, void 0)) return t1; 14812 } 14813 return -1; 14814 } 14815 constructor(e1, t1){ 14816 this.lastParams = null, this.lastAllFeaturesIndex = -2, this.appearancesVersion = t1, this.appearances = e1; 14817 const i = e1.map((e1)=>(function(e1) { 14818 if (!e1.condition) return { 14819 featureDependent: !1, 14820 stateDependent: !1, 14821 zoomDependent: !1, 14822 pitchDependent: !1, 14823 brightnessDependent: !1, 14824 worldviewDependent: !1 14825 }; 14826 const t1 = e1.condition.expression; 14827 return { 14828 featureDependent: !Cr(t1), 14829 stateDependent: !Lr(t1), 14830 zoomDependent: !Br(t1, [ 14831 "zoom" 14832 ]), 14833 pitchDependent: !Br(t1, [ 14834 "pitch" 14835 ]), 14836 brightnessDependent: !Br(t1, [ 14837 "brightness", 14838 "measure-light" 14839 ]), 14840 worldviewDependent: !Br(t1, [ 14841 "worldview" 14842 ]) 14843 }; 14844 })(e1)); 14845 this.anyFeatureDependent = i.some((e1)=>e1.featureDependent), this.anyStateDependent = i.some((e1)=>e1.stateDependent); 14846 } 14847 } 14848 const jm = Dh.types, Gm = [ 14849 { 14850 name: "a_fade_opacity", 14851 components: 1, 14852 type: "Uint8", 14853 offset: 0 14854 } 14855 ]; 14856 function Hm(e1, t1, i, n, r, o, a, s, l, c, u, h, d) { 14857 const f = s ? Math.min(cf, Math.round(s[0])) : 0, p = s ? Math.min(cf, Math.round(s[1])) : 0; 14858 e1.emplaceBack(t1, i, Math.round(32 * n), Math.round(32 * r), o, a, (f << 1) + (l ? 1 : 0), 0 + (p << 1), 16 * c, 16 * u, 256 * h, 256 * d); 14859 } 14860 function $m(e1, t1, i) { 14861 e1.emplaceBack(t1, i); 14862 } 14863 function Zm(e1, t1, i, n, r, o, a) { 14864 e1.emplaceBack(t1, i, n, r, o, a); 14865 } 14866 function Wm(e1, t1, i, n, r) { 14867 const o = 5 * t1 + 2; 14868 e1.float32[o + 0] = i, e1.float32[o + 1] = n, e1.float32[o + 2] = r; 14869 } 14870 function qm(e1, t1, i, n, r) { 14871 e1.emplaceBack(t1, i, n, r), e1.emplaceBack(t1, i, n, r), e1.emplaceBack(t1, i, n, r), e1.emplaceBack(t1, i, n, r); 14872 } 14873 function Xm(e1) { 14874 for (const t1 of e1.sections)if (Cs(t1.text)) return !0; 14875 return !1; 14876 } 14877 const Ym = 12; 14878 class Jm { 14879 isEmpty() { 14880 return 0 === this.layoutVertexArray.length && 0 === this.indexArray.length && 0 === this.dynamicLayoutVertexArray.length && 0 === this.opacityVertexArray.length && 0 === this.iconTransitioningVertexArray.length; 14881 } 14882 getBatchGrouping(e1) { 14883 const t1 = e1.get().length === this.segments.get().length; 14884 if (t1 && this.cachedBatchIndices && this.cachedBatchSegments) return { 14885 batchIndices: this.cachedBatchIndices, 14886 batchSegments: this.cachedBatchSegments 14887 }; 14888 const i = new Map; 14889 for (const t1 of e1.get()){ 14890 const e1 = void 0 !== t1.batchIndex ? t1.batchIndex : 0; 14891 i.has(e1) || i.set(e1, []), i.get(e1).push(t1); 14892 } 14893 const n = Array.from(i.keys()).sort((e1, t1)=>e1 - t1), r = new Map; 14894 for (const e1 of n){ 14895 const t1 = i.get(e1); 14896 r.set(e1, new ju(t1)); 14897 } 14898 return t1 && (this.cachedBatchIndices = n, this.cachedBatchSegments = r), { 14899 batchIndices: n, 14900 batchSegments: r 14901 }; 14902 } 14903 snapshotSymbolVertexData(e1, t1) { 14904 const i = e1 * Ym; 14905 return this.layoutVertexArray.uint16.slice(i, i + t1 * Ym); 14906 } 14907 restoreSymbolVertexData(e1, t1) { 14908 this.layoutVertexArray.uint16.set(t1, e1 * Ym); 14909 } 14910 snapshotIconTransitioningVertexData(e1, t1) { 14911 const i = 2 * e1; 14912 return this.iconTransitioningVertexArray.uint16.slice(i, i + 2 * t1); 14913 } 14914 restoreIconTransitioningVertexData(e1, t1) { 14915 this.iconTransitioningVertexArray.uint16.set(t1, 2 * e1); 14916 } 14917 updateSymbolVertexData(e1, t1, i, n, r, o, a, s, l, c, u, h, d) { 14918 const f = this.layoutVertexArray.uint16, p = e1 * Ym; 14919 f[p] = t1, f[p + 1] = i, f[p + 2] = n, f[p + 3] = r, f[p + 4] = o, f[p + 5] = a, f[p + 6] = s, f[p + 7] = l, f[p + 8] = c, f[p + 9] = u, f[p + 10] = h, f[p + 11] = d; 14920 } 14921 upload(e1, t1, i, n, r, o) { 14922 this.isEmpty() || (i && (this.cachedBatchIndices = null, this.cachedBatchSegments = null, this.layoutVertexBuffer = e1.createVertexBuffer(this.layoutVertexArray, Ed.members, !!o), this.indexBuffer = e1.createIndexBuffer(this.indexArray, t1), this.dynamicLayoutVertexBuffer = e1.createVertexBuffer(this.dynamicLayoutVertexArray, Md.members, !0), this.opacityVertexBuffer = e1.createVertexBuffer(this.opacityVertexArray, Gm, !0), this.iconTransitioningVertexArray.length > 0 && (this.iconTransitioningVertexBuffer = e1.createVertexBuffer(this.iconTransitioningVertexArray, Rd.members, !0)), this.globeExtVertexArray.length > 0 && (this.globeExtVertexBuffer = e1.createVertexBuffer(this.globeExtVertexArray, Id.members, !0)), !this.zOffsetVertexBuffer && (this.zOffsetVertexArray.length > 0 || r) && (this.zOffsetVertexBuffer = e1.createVertexBuffer(this.zOffsetVertexArray, Td.members, !0)), !this.orientationVertexBuffer && this.orientationVertexArray && this.orientationVertexArray.length > 0 && (this.orientationVertexBuffer = e1.createVertexBuffer(this.orientationVertexArray, zd.members, !0)), this.opacityVertexBuffer.itemSize = 1, this.featureIdArray.length > 0 && (this.featureIdBuffer = e1.createVertexBuffer(this.featureIdArray, Sd.members, !1))), (i || n) && (this.programConfigurations.upload(e1), this.uboBinder && this.uboBinder.upload(e1))); 14923 } 14924 destroy() { 14925 this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.dynamicLayoutVertexBuffer.destroy(), this.opacityVertexBuffer.destroy(), this.iconTransitioningVertexBuffer && this.iconTransitioningVertexBuffer.destroy(), this.globeExtVertexBuffer && this.globeExtVertexBuffer.destroy(), this.zOffsetVertexBuffer && this.zOffsetVertexBuffer.destroy(), this.orientationVertexBuffer && this.orientationVertexBuffer.destroy(), this.featureIdBuffer && this.featureIdBuffer.destroy(), this.uboBinder && this.uboBinder.destroy()); 14926 } 14927 constructor(e1){ 14928 this.layoutVertexArray = new tu, this.indexArray = new uu, this.programConfigurations = e1, this.segments = new ju, this.dynamicLayoutVertexArray = new nu, this.opacityVertexArray = new ru, this.placedSymbolArray = new Su, this.iconTransitioningVertexArray = new ou, this.globeExtVertexArray = new iu, this.zOffsetVertexArray = new $c, this.orientationVertexArray = new fu, this.symbolInstanceIndices = [], this.uboBinder = null, this.featureIdArray = new $c, this.featureIdBuffer = null, this.cachedBatchIndices = null, this.cachedBatchSegments = null; 14929 } 14930 } 14931 Xa(Jm, "SymbolBuffers", { 14932 omit: [ 14933 "cachedBatchIndices", 14934 "cachedBatchSegments" 14935 ] 14936 }); 14937 class Km { 14938 upload(e1) { 14939 this.layoutVertexBuffer = e1.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes), this.indexBuffer = e1.createIndexBuffer(this.indexArray), this.collisionVertexBuffer = e1.createVertexBuffer(this.collisionVertexArray, Pd.members, !0), this.collisionVertexBufferExt = e1.createVertexBuffer(this.collisionVertexArrayExt, Dd.members, !0); 14940 } 14941 destroy() { 14942 this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy(), this.collisionVertexBufferExt.de
14942stroy()); 14943 } 14944 constructor(e1, t1, i){ 14945 this.layoutVertexArray = new e1, this.layoutAttributes = t1, this.indexArray = new i, this.segments = new ju, this.collisionVertexArray = new cu, this.collisionVertexArrayExt = new nu; 14946 } 14947 } 14948 Xa(Km, "CollisionBuffers"); 14949 class Qm { 14950 hasAnyAppearanceLayoutProperty(e1) { 14951 const t1 = this.layers[0].getAppearances(); 14952 if (!t1 || 0 === t1.length) return !1; 14953 const i = Array.isArray(e1) ? e1 : [ 14954 e1 14955 ]; 14956 return t1.some((e1)=>i.some((t1)=>e1.hasLayoutProperty(t1))); 14957 } 14958 getAppearanceFeatureData(e1) { 14959 return this.featureAppearanceData.get(e1); 14960 } 14961 createArrays() { 14962 this.text = new Jm(new mh(this.layers, { 14963 zoom: this.zoom, 14964 lut: this.lut 14965 }, (e1)=>e1.startsWith("text") || e1.startsWith("symbol"))), this.icon = new Jm(new mh(this.layers, { 14966 zoom: this.zoom, 14967 lut: this.lut 14968 }, (e1)=>e1.startsWith("icon") || e1.startsWith("symbol"))), this.text.uboBinder = new Zd(this.layers[0], this.zoom, this.lut, !0, "", this.maxUniformBufferBindings, this.maxUniformBlockSizeDwords), this.icon.uboBinder = new Zd(this.layers[0], this.zoom, this.lut, !1, "", this.maxUniformBufferBindings, this.maxUniformBlockSizeDwords), this.glyphOffsetArray = new Pu, this.lineVertexArray = new Du, this.symbolInstances = new Ru; 14969 } 14970 calculateGlyphDependencies(e1, t1, i, n, r) { 14971 for (const i of e1){ 14972 const e1 = i.codePointAt(0); 14973 if (void 0 === e1) break; 14974 if (t1[e1] = !0, n && r && e1 <= 65535) { 14975 const e1 = Qd[i]; 14976 e1 && (t1[e1.charCodeAt(0)] = !0); 14977 } 14978 } 14979 } 14980 calculateEffectiveAppearanceIconSize(e1, t1, i, n, r, o, a) { 14981 if (!e1.hasLayoutProperty("icon-size")) return a * o; 14982 let s = 1; 14983 const l = e1.getUnevaluatedLayoutProperty("icon-size"), c = rf(this.zoom, l, this.worldview, r), u = af(c, t1); 14984 if ("constant" !== c.kind && "camera" !== c.kind || (s = u.uSize), "composite" === c.kind) { 14985 const { minZoom: e1, maxZoom: t1 } = c, o = l.possiblyEvaluate(new $s(e1, { 14986 worldview: this.worldview 14987 }), n), a = l.possiblyEvaluate(new $s(t1, { 14988 worldview: this.worldview 14989 }), n), h = o.evaluate(i, {}, n, r); 14990 s = h + (a.evaluate(i, {}, n, r) - h) * u.uSizeT; 14991 } 14992 return "source" === c.kind && (s = l.possiblyEvaluate(new $s(this.zoom, { 14993 worldview: this.worldview 14994 }), n).evaluate(i, {}, n, r)), s * o; 14995 } 14996 updateFootprints(e1, t1) {} 14997 updateReplacement(e1, t1) { 14998 if (t1.updateTime === this.replacementUpdateTime) return !1; 14999 this.replacementUpdateTime = t1.updateTime; 15000 const i = t1.getReplacementRegionsForTile(e1.toUnwrapped(), !0); 15001 return !Bp(this.activeReplacements, i) && (this.activeReplacements = i, !0); 15002 } 15003 getResolvedImageFromTokens(e1) { 15004 return "string" == typeof e1 ? Gn.build(e1) : e1; 15005 } 15006 populate(e1, t1, i, n) { 15007 const r = this.layers[0], o = r.layout, a = "globe" === this.projection.name, s = o.get("text-font"), l = o.get("text-field"), c = o.get("icon-image"), [u, h] = o.get("icon-size-scale-range"), d = it(t1.scaleFactor || 1, u, h), [f, p] = o.get("text-size-scale-range"), m = it(t1.scaleFactor || 1, f, p), _ = ("constant" !== l.value.kind || l.value.value instanceof Un && !l.value.value.isEmpty() || l.value.value.toString().length > 0) && ("constant" !== s.value.kind || s.value.value.length >
vendor: 4,924 bytes, lines 15007-15085
15007 0), g = "constant" !== c.value.kind || !!c.value.value || Object.keys(c.parameters).length > 0, y = this.hasAnyAppearanceLayoutProperty("icon-image"), x = o.get("symbol-sort-key"); 15008 if (this.features = [], this.featureAppearanceData = new Map, !_ && !g && !y) return; 15009 const v = t1.iconDependencies, b = t1.glyphDependencies, w = t1.availableImages, A = new $s(this.zoom, { 15010 worldview: this.worldview, 15011 activeFloors: t1.activeFloors 15012 }), E = (e1)=>{ 15013 const t1 = e1.id.toString(); 15014 v.has(t1) ? v.get(t1).push(e1) : v.set(t1, [ 15015 e1 15016 ]); 15017 }; 15018 for (const t1 of e1){ 15019 const { feature: e1, id: l, index: c, sourceLayerIndex: u } = t1, h = r._featureFilter.needGeometry, f = Lc(e1, h); 15020 if (!r._featureFilter.filter(A, f, i)) continue; 15021 if (h || (f.geometry = Cc(e1, i, n)), a && 1 !== e1.type && i.z <= 5) { 15022 const e1 = f.geometry, t1 = .98078528056, n = (e1, n)=>W(jf(e1.x, e1.y, i, 1), jf(n.x, n.y, i, 1)) < t1; 15023 for(let t1 = 0; t1 < e1.length; t1++)e1[t1] = Rc(e1[t1], n); 15024 } 15025 let p, I; 15026 if (_) { 15027 const e1 = r.getValueAndResolveTokens("text-field", f, i, w), t1 = Un.factory(e1); 15028 Xm(t1) && (this.hasRTLText = !0), (!this.hasRTLText || "unavailable" === js() || this.hasRTLText && Hs.isParsed()) && (p = qd(t1, r, f)); 15029 } 15030 if (g) { 15031 const e1 = r.getValueAndResolveTokens("icon-image", f, i, w); 15032 I = this.getResolvedImageFromTokens(e1); 15033 } 15034 const M = this.layers[0]; 15035 let T = !1; 15036 if (!I && y) { 15037 const e1 = M.getAppearances(); 15038 for (const t1 of e1)if (t1.getLayoutProperty("icon-image")) { 15039 const e1 = M.getAppearanceValueAndResolveTokens(t1, "icon-image", f, i, w); 15040 if (e1) { 15041 I = this.getResolvedImageFromTokens(e1), T = !0; 15042 break; 15043 } 15044 } 15045 } 15046 if (!p && !I) continue; 15047 const S = this.sortFeaturesByKey ? x.evaluate(f, {}, i) : void 0, z = { 15048 id: l, 15049 text: p, 15050 icon: I, 15051 index: c, 15052 sourceLayerIndex: u, 15053 geometry: f.geometry, 15054 properties: e1.properties, 15055 type: jm[e1.type], 15056 sortKey: S 15057 }; 15058 if (this.features.push(z), this.featureAppearanceData.set(c, { 15059 id: l, 15060 properties: e1.properties, 15061 usesAppearanceIconAsPlaceholder: T 15062 }), I) { 15063 const e1 = M._unevaluatedLayout._values, { iconPrimary: t1, iconSecondary: n } = pf(I, this.iconSizeData, e1["icon-size"], i, this.zoom, z, this.pixelRatio, d, this.worldview, w); 15064 E(t1), n && (this.hasAnySecondaryIcon = !0, E(n)); 15065 } 15066 const R = M.getAppearances(); 15067 if (0 !== R.length && R.forEach((e1)=>{ 15068 if (!e1.getLayoutProperty("icon-image")) return; 15069 const { iconPrimary: t1, iconSecondary: n } = this.getCombinedIconVariants(e1, M, f, i, w, z, d); 15070 t1 && (E(t1), n && (this.hasAnySecondaryIcon = !0, E(n))); 15071 }), p) { 15072 const e1 = s.evaluate(f, {}, i).join(","), t1 = "map" === o.get("text-rotation-alignment") && "point" !== o.get("symbol-placement"); 15073 this.allowVerticalPlacement = this.writingModes && this.writingModes.includes(Xd.vertical); 15074 for (const i of p.sections)if (i.image) { 15075 const e1 = i.image.getPrimary().scaleSelf(this.pixelRatio * m), t1 = e1.id.toString(), n = v.get(t1) || []; 15076 n.push(e1), v.set(t1, n); 15077 } else { 15078 const n = Ss(p.toString()), r = i.fontStack || e1, o = b[r] = b[r] || {}; 15079 this.calculateGlyphDependencies(i.text, o, t1, this.allowVerticalPlacement, n); 15080 } 15081 } 15082 } 15083 "line" === o.get("symbol-placement") && (this.features = function(e1) { 15084 const t1 = {}, i = {}, n = []; 15085 let r = 0;
15086 function o(t1) { 15087 n.push(e1[t1]), r++; 15088 } 15089 function a(e1, t1, r) { 15090 const o = i[e1]; 15091 return delete i[e1], i[t1] = o, n[o].geometry[0].pop(), n[o].geometry[0] = n[o].geometry[0].concat(r[0]), o; 15092 } 15093 function s(e1, i, r) { 15094 const o = t1[i]; 15095 return delete t1[i], t1[e1] = o, n[o].geometry[0].shift(), n[o].geometry[0] = r[0].concat(n[o].geometry[0]), o; 15096 } 15097 function l(e1, t1, i) { 15098 const n = i ? t1[0].at(-1) : t1[0][0]; 15099 return "".concat(e1, ":").concat(n.x, ":").concat(n.y); 15100 } 15101 for(let c = 0; c < e1.length; c++){ 15102 const u = e1[c], h = u.geometry, d = u.text ? u.text.toString() : null; 15103 if (!d || h.length > 1) { 15104 o(c); 15105 continue; 15106 } 15107 const f = l(d, h, !1), p = l(d, h, !0); 15108 if (f in i && p in t1 && i[f] !== t1[p]) { 15109 const e1 = s(f, p, h), r = a(f, p, n[e1].geometry); 15110 delete t1[f], delete i[p], i[l(d, n[r].geometry, !0)] = r, n[e1].geometry = null; 15111 } else f in i ? a(f, p, h) : p in t1 ? s(f, p, h) : (o(c), t1[f] = r - 1, i[p] = r - 1); 15112 } 15113 return n.filter((e1)=>e1.geometry); 15114 }(this.features)), "hd-road-markup" === o.get("symbol-elevation-reference") ? (this.elevationType = "road", this.hdExt && (this.hdExt.configureCrossSource(i, t1.elevationParams, t1.crossSourceElevationEnabled, t1.terrainEnabled), t1.elevationFeatures && t1.elevationFeatures.length > 0 && this.hdExt.addElevationFeatures(t1.elevationFeatures, i))) : o.get("symbol-z-elevate") && (this.elevationType = "offset"), "none" !== this.elevationType && (this.zOffsetBuffersNeedUpload = !0), this.sortFeaturesByKey && this.features.sort((e1, t1)=>e1.sortKey - t1.sortKey); 15115 } 15116 getCombinedIconVariants(e1, t1, i, n, r, o, a) { 15117 let s; 15118 if (e1.hasLayoutProperty("icon-image")) { 15119 const o = t1.getAppearanceValueAndResolveTokens(e1, "icon-image", i, n, r); 15120 s = this.getResolvedImageFromTokens(o); 15121 } else { 15122 const e1 = t1.getValueAndResolveTokens("icon-image", i, n, r); 15123 s = this.getResolvedImageFromTokens(e1); 15124 } 15125 if (s) { 15126 const i = e1.hasLayoutProperty("icon-size") ? e1.getUnevaluatedLayoutProperty("icon-size") : t1._unevaluatedLayout._values["icon-size"], l = rf(this.zoom, i, this.worldview, r), { iconPrimary: c, iconSecondary: u } = pf(s, l, i, n, this.zoom, o, this.pixelRatio, a, this.worldview, r); 15127 return { 15128 iconPrimary: c, 15129 iconSecondary: u 15130 }; 15131 } 15132 return { 15133 iconPrimary: void 0, 15134 iconSecondary: void 0 15135 }; 15136 } 15137 getCombinedIconPrimary(e1, t1, i, n, r, o, a) { 15138 return this.getCombinedIconVariants(e1, t1, i, n, r, o, a).iconPrimary; 15139 } 15140 updateSymbolInstanceIconVertices(e1, t1, i, n, r, o) { 15141 const { canonical: a, availableImages: s, globalProperties: l, layer: c, iconScaleFactor: u, featureState: h, layoutIconOffset: d, layoutIconSize: f, layoutIconRotate: p } = o; 15142 if (e1.placedIconSymbolIndex < 0) return { 15143 vertexOffsetDelta: 0, 15144 hasChanges: !1 15145 }; 15146 if (t1.activeAppearanceIndex === i) return { 15147 vertexOffsetDelta: e1.numIconVertices, 15148 hasChanges: !1 15149 }; 15150 const m = i >= 0 ? c.appearances[i] : null; 15151 if (m) { 15152 const i = { 15153 sortKey: void 0, 15154 text: void 0, 15155 icon: null, 15156 index: e1.featureIndex, 15157 sourceLayerIndex: e1.featureIndex, 15158 geometry: [], 15159 properties: t1.properties, 15160 type: "Point", 15161 id: t1.id 15162 }, { iconPrimary: o, iconSecondary: _ } = this.getCombinedIconVariants(m, c, n, a, s, i, u); 15163 if (!o) return { 15164 vertexOffsetDelta: 0, 15165 hasChanges: !1 15166 }; 15167 const g = o.toString(), y = this.iconAtlasPositions && this.iconAtlasPositions.get(g); 15168 if (y) { 15169 const { appearanceIconOffset: i, appearanceIconRotate: o } = hf(m, c, n, a, d, p, f, u), g = c.layout.get("icon-anchor").evaluate(n, h, a); 15170 let x = Jd(y, _ ? this.iconAtlasPositions && this.iconAtlasPositions.get(_.toString()) : void 0, i, g); 15171 const v = y.sdf, b = c.layout.get("icon-text-fit").constantOr("none"); 15172 "none" !== b && t1.textShaping && t1.iconTextFitPadding && t1.fontScale && (x = Kd(x, t1.textShaping, b, t1.iconTextFitPadding, i, t1.fontScale));
vendor: 33,233 bytes, lines 15173-15610
15173 const w = this.calculateEffectiveAppearanceIconSize(m, l.zoom, n, a, s, u, f), A = 0, E = 1 + (Math.min(cf, Math.round(w * nf)) << 1), I = Fm(x, o, v, "none" !== b, u), M = this.icon.iconTransitioningVertexArray.length > 0; 15174 t1.isUsingAppearanceIconVertexData || (t1.isUsingAppearanceIconVertexData = !0, t1.layoutBasedIconVertexData = this.icon.snapshotSymbolVertexData(r, e1.numIconVertices), M && (t1.layoutBasedIconTransitioningVertexData = this.icon.snapshotIconTransitioningVertexData(r, e1.numIconVertices))); 15175 const T = Math.floor(e1.numIconVertices / 4), S = Math.min(I.length, T); 15176 let z = r; 15177 const R = M ? this.icon.iconTransitioningVertexArray.uint16 : null; 15178 for(let i = 0; i < S; ++i){ 15179 const n = I[i], r = t1.layoutBasedIconVertexData[0] || e1.tileAnchorX, o = t1.layoutBasedIconVertexData[1] || e1.tileAnchorY, a = 16 * n.pixelOffsetTL.x, s = 16 * n.pixelOffsetTL.y, l = 16 * n.pixelOffsetBR.x, c = 16 * n.pixelOffsetBR.y, u = 16 * n.minFontScaleX, h = 16 * n.minFontScaleY; 15180 if (this.icon.updateSymbolVertexData(z, r, o, Math.round(32 * n.tl.x), Math.round(32 * n.tl.y), n.texPrimary.x, n.texPrimary.y, A, E, a, s, u, h), this.icon.updateSymbolVertexData(z + 1, r, o, Math.round(32 * n.tr.x), Math.round(32 * n.tr.y), n.texPrimary.x + n.texPrimary.w, n.texPrimary.y, A, E, l, s, u, h), this.icon.updateSymbolVertexData(z + 2, r, o, Math.round(32 * n.bl.x), Math.round(32 * n.bl.y), n.texPrimary.x, n.texPrimary.y + n.texPrimary.h, A, E, a, c, u, h), this.icon.updateSymbolVertexData(z + 3, r, o, Math.round(32 * n.br.x), Math.round(32 * n.br.y), n.texPrimary.x + n.texPrimary.w, n.texPrimary.y + n.texPrimary.h, A, E, l, c, u, h), R) { 15181 const e1 = n.texSecondary ? n.texSecondary : n.texPrimary, t1 = 2 * z; 15182 R[t1] = e1.x, R[t1 + 1] = e1.y, R[t1 + 2] = e1.x + e1.w, R[t1 + 3] = e1.y, R[t1 + 4] = e1.x, R[t1 + 5] = e1.y + e1.h, R[t1 + 6] = e1.x + e1.w, R[t1 + 7] = e1.y + e1.h; 15183 } 15184 z += 4; 15185 } 15186 const P = e1.numIconVertices - 4 * S; 15187 for(let e1 = 0; e1 < P; ++e1)this.icon.updateSymbolVertexData(z + e1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); 15188 return { 15189 vertexOffsetDelta: e1.numIconVertices, 15190 hasChanges: !0 15191 }; 15192 } 15193 } else { 15194 if (t1.usesAppearanceIconAsPlaceholder) return this.icon.updateSymbolVertexData(r, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), this.icon.updateSymbolVertexData(r + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), this.icon.updateSymbolVertexData(r + 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), this.icon.updateSymbolVertexData(r + 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), { 15195 vertexOffsetDelta: e1.numIconVertices, 15196 hasChanges: !0 15197 }; 15198 if (t1.isUsingAppearanceIconVertexData) return this.icon.restoreSymbolVertexData(r, t1.layoutBasedIconVertexData), t1.layoutBasedIconTransitioningVertexData && this.icon.restoreIconTransitioningVertexData(r, t1.layoutBasedIconTransitioningVertexData), t1.isUsingAppearanceIconVertexData = !1, { 15199 vertexOffsetDelta: t1.layoutBasedIconVertexData.length / Ym, 15200 hasChanges: !0 15201 }; 15202 } 15203 return { 15204 vertexOffsetDelta: e1.numIconVertices, 15205 hasChanges: !1 15206 }; 15207 } 15208 updateSymbolInstanceTextVertices(e1, t1, i, n, r, o) { 15209 const { canonical: a, layer: s, textScaleFactor: l, imageMap: c, featureState: u, layoutTextOffset: h, layoutTextSize: d, layoutTextRotate: f, layoutMinZoomSize: p, layoutMaxZoomSize: m, layoutTextSizeMinZoom: _, layoutTextSizeMaxZoom: g, availableImages: y } = o, x = e1.numHorizontalGlyphVertices > 0 || e1.numVerticalGlyphVertices > 0; 15210 if (!x) return { 15211 vertexOffsetDelta: x ? e1.numHorizontalGlyphVertices + e1.numVerticalGlyphVertices : 0, 15212 hasChanges: !1 15213 }; 15214 if (t1.activeAppearanceIndex === i) return { 15215 vertexOffsetDelta: e1.numHorizontalGlyphVertices + e1.numVerticalGlyphVertices, 15216 hasChanges: !1 15217 }; 15218 const v = i >= 0 ? s.appearances[i] : null; 15219 if (v && t1.textShaping) { 15220 const { appearanceTextOffset: i, appearanceTextRotate: o, appearanceTextSize: x } = df(v, s, n, a, h, f, d); 15221 t1.fontScale = mf(x, t1.textScaleFactor); 15222 const b = v.getUnevaluatedLayoutProperty("text-size"); 15223 let w = this.textSizeData, A = _, E = g; 15224 v.hasLayoutProperty("text-size") && (w = rf(this.zoom, b, this.worldview, y), A = "composite" === this.textSizeData.kind ? this.textSizeData.minZoom : 0, E = "composite" === this.textSizeData.kind ? this.textSizeData.maxZoom : 0); 15225 const I = t1.textShaping.bottom - h[1], M = t1.textShaping.left - h[0], T = t1.textShaping.right - h[0]; 15226 t1.textShaping.top = i[1] + (t1.textShaping.top - h[1]), t1.textShaping.bottom = i[1] + I, t1.textShaping.left = i[0] + M, t1.textShaping.right = i[0] + T; 15227 const S = km(0, t1.textShaping, i, s, !1, n, c, this.allowVerticalPlacement, o), z = x && "composite" === w.kind ? b.possiblyEvaluate(new $s(A, {}), a).evaluate(n, u, a) : p, R = x && "composite" === w.kind ? b.possiblyEvaluate(new $s(E, {}), a).evaluate(n, u, a) : m, P = _f(v.name, w, x, l, z, R), D = Array.isArray(P) ? P[1] : x, F = 0, C = 1 + (Math.min(cf, Math.round(D * nf)) << 1); 15228 t1.isUsingAppearanceTextVertexData || (t1.isUsingAppearanceTextVertexData = !0, t1.layoutBasedTextVertexData = this.text.snapshotSymbolVertexData(r, e1.numHorizontalGlyphVertices + e1.numVerticalGlyphVertices)); 15229 for(let t1 = 0; t1 < S.length && t1 < (e1.numHorizontalGlyphVertices + e1.numVerticalGlyphVertices) / 4; ++t1){ 15230 const i = S[t1], n = i.glyphOffset[1], o = e1.tileAnchorX, a = e1.tileAnchorY, s = r + 4 * t1; 15231 this.text.updateSymbolVertexData(s, o, a, Math.round(32 * i.tl.x), Math.round(32 * (n + i.tl.y)), i.texPrimary.x, i.texPrimary.y, F, C, i.pixelOffsetTL.x, i.pixelOffsetTL.y, i.minFontScaleX, i.minFontScaleY), this.text.updateSymbolVertexData(s + 1, o, a, Math.round(32 * i.tr.x), Math.round(32 * (n + i.tr.y)), i.texPrimary.x + i.texPrimary.w, i.texPrimary.y, F, C, i.pixelOffsetBR.x, i.pixelOffsetTL.y, i.minFontScaleX, i.minFontScaleY), this.text.updateSymbolVertexData(s + 2, o, a, Math.round(32 * i.bl.x), Math.round(32 * (n + i.bl.y)), i.texPrimary.x, i.texPrimary.y + i.texPrimary.h, F, C, i.pixelOffsetTL.x, i.pixelOffsetBR.y, i.minFontScaleX, i.minFontScaleY), this.text.updateSymbolVertexData(s + 3, o, a, Math.round(32 * i.br.x), Math.round(32 * (n + i.br.y)), i.texPrimary.x + i.texPrimary.w, i.texPrimary.y + i.texPrimary.h, F, C, i.pixelOffsetBR.x, i.pixelOffsetBR.y, i.minFontScaleX, i.minFontScaleY); 15232 } 15233 return { 15234 vertexOffsetDelta: e1.numHorizontalGlyphVertices + e1.numVerticalGlyphVertices, 15235 hasChanges: !0 15236 }; 15237 } 15238 return t1.isUsingAppearanceTextVertexData ? (this.text.restoreSymbolVertexData(r, t1.layoutBasedTextVertexData), t1.isUsingAppearanceTextVertexData = !1, { 15239 vertexOffsetDelta: t1.layoutBasedTextVertexData.length / Ym, 15240 hasChanges: !0 15241 }) : { 15242 vertexOffsetDelta: e1.numHorizontalGlyphVertices + e1.numVerticalGlyphVertices, 15243 hasChanges: !1 15244 }; 15245 } 15246 updateExpressions(e1) { 15247 this.text && this.text.programConfigurations.updateExpressions(e1), this.icon && this.icon.programConfigurations.updateExpressions(e1); 15248 } 15249 update(e1, t1, i, n, r, o, a, s) { 15250 if (this.text.uboBinder || this.text.programConfigurations.updatePaintArrays(e1, t1, r, i, n, o, a, this.worldview), this.icon.uboBinder || this.icon.programConfigurations.updatePaintArrays(e1, t1, r, i, n, o, a, this.worldview), s) { 15251 if (o) for (const n of [ 15252 this.text.uboBinder, 15253 this.icon.uboBinder 15254 ])n && !n.isLightConstant && n.updateDynamicExpressions(r[0], t1, s, i, e1, a); 15255 else if (Object.keys(e1).length > 0) { 15256 const n = r[0], o = [ 15257 this.text.uboBinder, 15258 this.icon.uboBinder 15259 ].filter((e1)=>e1 && e1.hasStateDependentPaint(n)); 15260 if (o.length > 0) { 15261 const r = new Set(Object.keys(e1).map((e1)=>{ 15262 const t1 = Number(e1); 15263 return !isNaN(t1) && Number.isSafeInteger(t1) && String(t1) === e1 ? t1 : e1; 15264 })); 15265 for (const l of o)l.updateFeatures(r, n, t1, s, i, e1, a); 15266 } 15267 } 15268 } 15269 } 15270 updateZOffset() { 15271 const e1 = (e1, t1, n)=>{ 15272 i += t1, i > e1.length && e1.resize(i); 15273 for(let r = -t1; r < 0; r++)e1.emplace(r + i, n); 15274 }, t1 = (e1, t1, i)=>{ 15275 n += t1, n > e1.length && e1.resize(n); 15276 for(let r = -t1; r < 0; r++)e1.emplace(r + n, i); 15277 }; 15278 if (!this.zOffsetBuffersNeedUpload) return; 15279 this.zOffsetBuffersNeedUpload = !1; 15280 let i = 0, n = 0; 15281 for(let i = 0; i < this.symbolInstances.length; i++){ 15282 const n = this.symbolInstances.get(i), { numHorizontalGlyphVertices: r, numVerticalGlyphVertices: o, numIconVertices: a } = n, s = n.zOffset, l = a > 0; 15283 if ((r > 0 || o > 0) && (e1(this.text.zOffsetVertexArray, r, s), e1(this.text.zOffsetVertexArray, o, s)), l) { 15284 const { placedIconSymbolIndex: e1, verticalPlacedIconSymbolIndex: i } = n; 15285 e1 >= 0 && t1(this.icon.zOffsetVertexArray, a, s), i >= 0 && t1(this.icon.zOffsetVertexArray, n.numVerticalIconVertices, s); 15286 } 15287 } 15288 this.text.zOffsetVertexBuffer && this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray), this.icon.zOffsetVertexBuffer && this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray); 15289 } 15290 isEmpty() { 15291 return 0 === this.symbolInstances.length && !this.hasRTLText; 15292 } 15293 uploadPending() { 15294 return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload; 15295 } 15296 upload(e1, t1, i, n, r) { 15297 !this.uploaded && this.hasDebugData() && (this.textCollisionBox.upload(e1), this.iconCollisionBox.upload(e1)), this.text.upload(e1, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload, this.zOffsetBuffersNeedUpload, this.hasAppearances), null === this.hasAppearances && (this.hasAppearances = this.layers.some((e1)=>e1.appearances && e1.appearances.length > 0)), this.icon.upload(e1, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload, this.zOffsetBuffersNeedUpload, this.hasAppearances), this.uploaded = !0; 15298 } 15299 updateAppearances(e1, t1, i, n, r) { 15300 let o = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !1; 15301 const a = { 15302 hasLayoutChanges: !1, 15303 hasUboChanges: !1 15304 }; 15305 if (!e1 || !i || !this.featureAppearanceData) return a; 15306 const s = t1 || {}, l = this.icon.layoutVertexArray && this.icon.layoutVertexArray.length > 0 && this.icon.layoutVertexArray.arrayBuffer, c = this.text.layoutVertexArray && this.text.layoutVertexArray.length > 0 && this.text.layoutVertexArray.arrayBuffer; 15307 if (!l && !c) return a; 15308 const u = this.layers[0], h = u.layout; 15309 this.featureAppearances && this.featureAppearances.appearancesVersion === u.appearancesVersion || (this.featureAppearances = new Um(u.appearances, u.appearancesVersion)); 15310 const d = this.featureAppearances.update(n, o); 15311 if ("no-changes" === d.kind) return a; 15312 let f = 1, p = 0, m = !1, _ = !1; 15313 if (l) { 15314 const [e1, t1] = h.get("icon-size-scale-range"); 15315 f = it(1, e1, t1); 15316 } 15317 let g = 1, y = 0, x = !1; 15318 if (c) { 15319 const [e1, t1] = h.get("text-size-scale-range"); 15320 g = it(1, e1, t1); 15321 } 15322 const v = new Map; 15323 if (r && i) for (const e1 of i){ 15324 const t1 = r.getImage(e1, u.scope); 15325 if (t1) { 15326 const i = new jn(e1.toString()); 15327 v.set(i.toString(), t1); 15328 } 15329 } 15330 const b = [ 15331 this.text.uboBinder, 15332 this.icon.uboBinder 15333 ]; 15334 for(let t1 = 0; t1 < this.symbolInstances.length; t1++){ 15335 const r = this.symbolInstances.get(t1), o = this.getAppearanceFeatureData(r.featureIndex); 15336 if (!o) continue; 15337 const a = o.id, w = void 0 !== a ? s[String(a)] : void 0, A = { 15338 type: "Point", 15339 id: o.id, 15340 properties: o.properties, 15341 geometry: [] 15342 }; 15343 let E; 15344 if ("all-features" === d.kind) E = d.appearanceIndex; 15345 else { 15346 const t1 = u.appearances ? u.appearances.findIndex((t1)=>t1.isActive({ 15347 globals: n, 15348 feature: A, 15349 canonical: e1, 15350 featureState: w 15351 })) : -1; 15352 E = t1 >= 0 ? t1 : -1; 15353 } 15354 const I = o.activeAppearanceIndex !== E; 15355 if (c) { 15356 const t1 = h.get("text-size"), n = "composite" === this.textSizeData.kind ? this.textSizeData.minZoom : 0, a = "composite" === this.textSizeData.kind ? this.textSizeData.maxZoom : 0, s = { 15357 canonical: e1, 15358 layer: u, 15359 featureState: w, 15360 availableImages: i, 15361 textScaleFactor: g, 15362 imageMap: v, 15363 layoutTextOffset: h.get("text-offset").evaluate(A, w, e1).map((e1)=>e1 * Wd), 15364 layoutTextSize: t1.evaluate(A, w, e1), 15365 layoutTextRotate: h.get("text-rotate").evaluate(A, w, e1), 15366 layoutMinZoomSize: t1.evaluate(A, { 15367 zoom: n 15368 }, e1), 15369 layoutMaxZoomSize: t1.evaluate(A, { 15370 zoom: a 15371 }, e1), 15372 layoutTextSizeMinZoom: n, 15373 layoutTextSizeMaxZoom: a 15374 }, l = this.updateSymbolInstanceTextVertices(r, o, E, A, y, s); 15375 y += l.vertexOffsetDelta, x = x || l.hasChanges; 15376 } 15377 if (l) { 15378 const t1 = { 15379 canonical: e1, 15380 layer: u, 15381 featureState: w, 15382 availableImages: i, 15383 globalProperties: n, 15384 iconScaleFactor: f, 15385 layoutIconOffset: h.get("icon-offset").evaluate(A, w, e1), 15386 layoutIconSize: h.get("icon-size").evaluate(A, w, e1, i), 15387 layoutIconRotate: h.get("icon-rotate").evaluate(A, w, e1) 15388 }, a = this.updateSymbolInstanceIconVertices(r, o, E, A, p, t1); 15389 p += a.vertexOffsetDelta, m = m || a.hasChanges; 15390 } 15391 if (I) { 15392 const t1 = r.featureIndex, o = n ? n.brightness : null, a = w || {}, s = E >= 0 ? u.appearances[E] : null; 15393 for (const n of b)n && (n.layer = u, _ = n.updateFeaturePaintForAppearance(t1, A, a, e1, i, o, s) || _); 15394 } 15395 o.activeAppearanceIndex = E; 15396 } 15397 return m && this.icon.layoutVertexBuffer && null !== this.icon.layoutVertexArray.arrayBuffer && this.icon.layoutVertexArray.length === this.icon.layoutVertexBuffer.length && this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray), m && this.icon.iconTransitioningVertexBuffer && this.icon.iconTransitioningVertexArray.length > 0 && this.icon.iconTransitioningVertexArray.length === this.icon.iconTransitioningVertexBuffer.length && this.icon.iconTransitioningVertexBuffer.updateData(this.icon.iconTransitioningVertexArray), x && this.text.layoutVertexBuffer && null !== this.text.layoutVertexArray.arrayBuffer && this.text.layoutVertexArray.length === this.text.layoutVertexBuffer.length && this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray), { 15398 hasLayoutChanges: m || x, 15399 hasUboChanges: _ 15400 }; 15401 } 15402 destroyDebugData() { 15403 this.textCollisionBox.destroy(), this.iconCollisionBox.destroy(); 15404 } 15405 getProjection() { 15406 return this.projectionInstance || (this.projectionInstance = Rp(this.projection)), this.projectionInstance; 15407 } 15408 destroy() { 15409 this.text.destroy(), this.icon.destroy(), this.hasDebugData() && this.destroyDebugData(); 15410 } 15411 addToLineVertexArray(e1, t1) { 15412 const i = this.lineVertexArray.length; 15413 if (void 0 !== e1.segment) for (const { x: e1, y: i } of t1)this.lineVertexArray.emplaceBack(e1, i); 15414 return { 15415 lineStartIndex: i, 15416 lineLength: this.lineVertexArray.length - i 15417 }; 15418 } 15419 addSymbols(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g) { 15420 const y = e1.indexArray, x = e1.layoutVertexArray, v = e1.globeExtVertexArray, b = g, w = e1.uboBinder ? e1.uboBinder.getCurrentBatchIndex() : void 0, A = e1.segments.prepareSegment(4 * b, x, y, this.canOverlap ? o.sortKey : void 0, w), E = this.glyphOffsetArray.length, I = A.vertexLength, M = this.allowVerticalPlacement && a === Xd.vertical ? Math.PI / 2 : 0, T = o.text && o.text.sections; 15421 let S = x.length, z = -1; 15422 for(let n = 0; n < t1.length; n++){ 15423 const { tl: r, tr: a, bl: c, br: u, texPrimary: h, texSecondary: _, pixelOffsetTL: g, pixelOffsetBR: b, minFontScaleX: w, minFontScaleY: E, glyphOffset: I, isSDF: R, sectionIndex: P } = t1[n], D = A.vertexLength, F = I[1]; 15424 if (Hm(x, l.x, l.y, r.x, F + r.y, h.x, h.y, i, R, g.x, g.y, w, E), Hm(x, l.x, l.y, a.x, F + a.y, h.x + h.w, h.y, i, R, b.x, g.y, w, E), Hm(x, l.x, l.y, c.x, F + c.y, h.x, h.y + h.h, i, R, g.x, b.y, w, E), Hm(x, l.x, l.y, u.x, F + u.y, h.x + h.w, h.y + h.h, i, R, b.x, b.y, w, E), s) { 15425 const { x: t1, y: i, z: n } = s.anchor, [r, o, a] = s.up; 15426 Zm(v, t1, i, n, r, o, a), Zm(v, t1, i, n, r, o, a), Zm(v, t1, i, n, r, o, a), Zm(v, t1, i, n, r, o, a), qm(e1.dynamicLayoutVertexArray, t1, i, n, M); 15427 } else qm(e1.dynamicLayoutVertexArray, l.x, l.y, l.z, M); 15428 if (m) { 15429 const t1 = _ || h; 15430 $m(e1.iconTransitioningVertexArray, t1.x, t1.y), $m(e1.iconTransitioningVertexArray, t1.x + t1.w, t1.y), $m(e1.iconTransitioningVertexArray, t1.x, t1.y + t1.h), $m(e1.iconTransitioningVertexArray, t1.x + t1.w, t1.y + t1.h); 15431 } 15432 if (y.emplaceBack(D, D + 1, D + 2), y.emplaceBack(D + 1, D + 2, D + 3), A.vertexLength += 4, A.primitiveLength += 2, this.glyphOffsetArray.emplaceBack(I[0]), (n === t1.length - 1 || P !== t1[n + 1].sectionIndex) && (e1.uboBinder || e1.programConfigurations.populatePaintArrays(x.length, o, o.index, {}, d, f, p, T && T[P], this.worldview), e1.uboBinder)) { 15433 const t1 = e1.uboBinder.populateUBO(o, o.index, f, d, p, T && T[P]); 15434 z = t1; 15435 const i = x.length - S; 15436 for(let n = 0; n < i; n++)e1.featureIdArray.emplaceBack(t1); 15437 S = x.length; 15438 } 15439 } 15440 const R = g - t1.length; 15441 if (0 !== R && (this._addNullVertices(R, x, i, s, v, e1, m, A, y), e1.uboBinder && z >= 0)) { 15442 const t1 = 4 * R; 15443 for(let i = 0; i < t1; i++)e1.featureIdArray.emplaceBack(z); 15444 } 15445 const P = s ? s.anchor : l; 15446 e1.placedSymbolArray.emplaceBack(P.x, P.y, P.z, l.x, l.y, E, this.glyphOffsetArray.length - E, I, c, u, l.segment, i ? i[0] : 0, i ? i[1] : 0, n[0], n[1], a, 0, 0, 0, h, 0), e1.symbolInstanceIndices.push(_); 15447 } 15448 _addNullVertices(e1, t1, i, n, r, o, a, s, l) { 15449 for(let c = 0; c < e1; c++){ 15450 for(let e1 = 0; e1 < 4; e1++)Hm(t1, 0, 0, 0, 0, 0, 0, i, !1, 0, 0, 0, 0), n ? (Zm(r, 0, 0, 0, 0, 0, 0), qm(o.dynamicLayoutVertexArray, 0, 0, 0, 0)) : qm(o.dynamicLayoutVertexArray, 0, 0, 0, 0), a && $m(o.iconTransitioningVertexArray, 0, 0); 15451 const e1 = s.vertexLength; 15452 l.emplaceBack(e1, e1 + 1, e1 + 2), l.emplaceBack(e1 + 1, e1 + 2, e1 + 3), s.vertexLength += 4, s.primitiveLength += 2, this.glyphOffsetArray.emplaceBack(0); 15453 } 15454 } 15455 _commitLayoutVertex(e1, t1, i, n, r, o, a) { 15456 e1.emplaceBack(t1, i, n, r, o, Math.round(a.x), Math.round(a.y)); 15457 } 15458 _addCollisionDebugVertices(e1, t1, i, n, r, o, a) { 15459 const s = i.segments.prepareSegment(4, i.layoutVertexArray, i.indexArray), l = s.vertexLength, c = a.tileAnchorX, u = a.tileAnchorY; 15460 for(let e1 = 0; e1 < 4; e1++)i.collisionVertexArray.emplaceBack(0, 0, 0, 0, 0, 0); 15461 this._commitDebugCollisionVertexUpdate(i.collisionVertexArrayExt, t1, e1.padding, a.zOffset), this._commitLayoutVertex(i.layoutVertexArray, n, r, o, c, u, new Pe(e1.x1, e1.y1)), this._commitLayoutVertex(i.layoutVertexArray, n, r, o, c, u, new Pe(e1.x2, e1.y1)), this._commitLayoutVertex(i.layoutVertexArray, n, r, o, c, u, new Pe(e1.x2, e1.y2)), this._commitLayoutVertex(i.layoutVertexArray, n, r, o, c, u, new Pe(e1.x1, e1.y2)), s.vertexLength += 4; 15462 const h = i.indexArray; 15463 h.emplaceBack(l, l + 1), h.emplaceBack(l + 1, l + 2), h.emplaceBack(l + 2, l + 3), h.emplaceBack(l + 3, l), s.primitiveLength += 4; 15464 } 15465 _addTextDebugCollisionBoxes(e1, t1, i, n, r, o) { 15466 for(let a = n; a < r; a++){ 15467 const n = i.get(a), r = this.getSymbolInstanceTextSize(e1, o, t1, a); 15468 this._addCollisionDebugVertices(n, r, this.textCollisionBox, n.projectedAnchorX, n.projectedAnchorY, n.projectedAnchorZ, o); 15469 } 15470 } 15471 _addIconDebugCollisionBoxes(e1, t1, i, n, r, o) { 15472 for(let a = n; a < r; a++){ 15473 const n = i.get(a), r = this.getSymbolInstanceIconSize(e1, t1, o.placedIconSymbolIndex); 15474 this._addCollisionDebugVertices(n, r, this.iconCollisionBox, n.projectedAnchorX, n.projectedAnchorY, n.projectedAnchorZ, o); 15475 } 15476 } 15477 generateCollisionDebugBuffers(e1, t1, i) { 15478 this.hasDebugData() && this.destroyDebugData(), this.textCollisionBox = new Km(su, Fd.members, ou), this.iconCollisionBox = new Km(su, Fd.members, ou); 15479 const n = af(this.iconSizeData, e1), r = af(this.textSizeData, e1, i); 15480 for(let i = 0; i < this.symbolInstances.length; i++){ 15481 const o = this.symbolInstances.get(i); 15482 this._addTextDebugCollisionBoxes(r, e1, t1, o.textBoxStartIndex, o.textBoxEndIndex, o), this._addTextDebugCollisionBoxes(r, e1, t1, o.verticalTextBoxStartIndex, o.verticalTextBoxEndIndex, o), this._addIconDebugCollisionBoxes(n, e1, t1, o.iconBoxStartIndex, o.iconBoxEndIndex, o), this._addIconDebugCollisionBoxes(n, e1, t1, o.verticalIconBoxStartIndex, o.verticalIconBoxEndIndex, o); 15483 } 15484 } 15485 getSymbolInstanceTextSize(e1, t1, i, n) { 15486 const r = this.text.placedSymbolArray.get(t1.rightJustifiedTextSymbolIndex >= 0 ? t1.rightJustifiedTextSymbolIndex : t1.centerJustifiedTextSymbolIndex >= 0 ? t1.centerJustifiedTextSymbolIndex : t1.leftJustifiedTextSymbolIndex >= 0 ? t1.leftJustifiedTextSymbolIndex : t1.verticalPlacedTextSymbolIndex >= 0 ? t1.verticalPlacedTextSymbolIndex : n), o = of(this.textSizeData, e1, r) / Wd; 15487 return this.tilePixelRatio * o; 15488 } 15489 getSymbolInstanceIconSize(e1, t1, i) { 15490 const n = this.icon.placedSymbolArray.get(i), r = of(this.iconSizeData, e1, n); 15491 return this.tilePixelRatio * r; 15492 } 15493 _commitDebugCollisionVertexUpdate(e1, t1, i, n) { 15494 e1.emplaceBack(t1, -i, -i, n), e1.emplaceBack(t1, i, -i, n), e1.emplaceBack(t1, i, i, n), e1.emplaceBack(t1, -i, i, n); 15495 } 15496 _updateTextDebugCollisionBoxes(e1, t1, i, n, r, o, a) { 15497 for(let a = n; a < r; a++){ 15498 const n = i.get(a), r = this.getSymbolInstanceTextSize(e1, o, t1, a); 15499 this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt, r, n.padding, o.zOffset); 15500 } 15501 } 15502 _updateIconDebugCollisionBoxes(e1, t1, i, n, r, o, a) { 15503 for(let a = n; a < r; a++){ 15504 const n = i.get(a), r = this.getSymbolInstanceIconSize(e1, t1, o.placedIconSymbolIndex); 15505 this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt, r, n.padding, o.zOffset); 15506 } 15507 } 15508 updateCollisionDebugBuffers(e1, t1, i, n) { 15509 if (!this.hasDebugData()) return; 15510 this.hasTextCollisionBoxData() && this.textCollisionBox.collisionVertexArrayExt.clear(), this.hasIconCollisionBoxData() && this.iconCollisionBox.collisionVertexArrayExt.clear(); 15511 const r = af(this.iconSizeData, e1, n), o = af(this.textSizeData, e1, i); 15512 for(let a = 0; a < this.symbolInstances.length; a++){ 15513 const s = this.symbolInstances.get(a); 15514 this._updateTextDebugCollisionBoxes(o, e1, t1, s.textBoxStartIndex, s.textBoxEndIndex, s, i), this._updateTextDebugCollisionBoxes(o, e1, t1, s.verticalTextBoxStartIndex, s.verticalTextBoxEndIndex, s, i), this._updateIconDebugCollisionBoxes(r, e1, t1, s.iconBoxStartIndex, s.iconBoxEndIndex, s, n), this._updateIconDebugCollisionBoxes(r, e1, t1, s.verticalIconBoxStartIndex, s.verticalIconBoxEndIndex, s, n); 15515 } 15516 this.hasTextCollisionBoxData() && this.textCollisionBox.collisionVertexBufferExt && this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt), this.hasIconCollisionBoxData() && this.iconCollisionBox.collisionVertexBufferExt && this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt); 15517 } 15518 _deserializeCollisionBoxesForSymbol(e1, t1, i, n, r, o, a, s, l) { 15519 const c = {}; 15520 if (t1 < i) { 15521 const { x1: i, y1: n, x2: r, y2: o, padding: a, projectedAnchorX: s, projectedAnchorY: l, projectedAnchorZ: u, tileAnchorX: h, tileAnchorY: d, featureIndex: f } = e1.get(t1); 15522 c.textBox = { 15523 x1: i, 15524 y1: n, 15525 x2: r, 15526 y2: o, 15527 padding: a, 15528 projectedAnchorX: s, 15529 projectedAnchorY: l, 15530 projectedAnchorZ: u, 15531 tileAnchorX: h, 15532 tileAnchorY: d 15533 }, c.textFeatureIndex = f; 15534 } 15535 if (n < r) { 15536 const { x1: t1, y1: i, x2: r, y2: o, padding: a, projectedAnchorX: s, projectedAnchorY: l, projectedAnchorZ: u, tileAnchorX: h, tileAnchorY: d, featureIndex: f } = e1.get(n); 15537 c.verticalTextBox = { 15538 x1: t1, 15539 y1: i, 15540 x2: r, 15541 y2: o, 15542 padding: a, 15543 projectedAnchorX: s, 15544 projectedAnchorY: l, 15545 projectedAnchorZ: u, 15546 tileAnchorX: h, 15547 tileAnchorY: d 15548 }, c.verticalTextFeatureIndex = f; 15549 } 15550 if (o < a) { 15551 const { x1: t1, y1: i, x2: n, y2: r, padding: a, projectedAnchorX: s, projectedAnchorY: l, projectedAnchorZ: u, tileAnchorX: h, tileAnchorY: d, featureIndex: f } = e1.get(o); 15552 c.iconBox = { 15553 x1: t1, 15554 y1: i, 15555 x2: n, 15556 y2: r, 15557 padding: a, 15558 projectedAnchorX: s, 15559 projectedAnchorY: l, 15560 projectedAnchorZ: u, 15561 tileAnchorX: h, 15562 tileAnchorY: d 15563 }, c.iconFeatureIndex = f; 15564 } 15565 if (s < l) { 15566 const { x1: t1, y1: i, x2: n, y2: r, padding: o, projectedAnchorX: a, projectedAnchorY: l, projectedAnchorZ: u, tileAnchorX: h, tileAnchorY: d, featureIndex: f } = e1.get(s); 15567 c.verticalIconBox = { 15568 x1: t1, 15569 y1: i, 15570 x2: n, 15571 y2: r, 15572 padding: o, 15573 projectedAnchorX: a, 15574 projectedAnchorY: l, 15575 projectedAnchorZ: u, 15576 tileAnchorX: h, 15577 tileAnchorY: d 15578 }, c.verticalIconFeatureIndex = f; 15579 } 15580 return c; 15581 } 15582 deserializeCollisionBoxes(e1) { 15583 this.collisionArrays = []; 15584 for(let t1 = 0; t1 < this.symbolInstances.length; t1++){ 15585 const i = this.symbolInstances.get(t1); 15586 this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e1, i.textBoxStartIndex, i.textBoxEndIndex, i.verticalTextBoxStartIndex, i.verticalTextBoxEndIndex, i.iconBoxStartIndex, i.iconBoxEndIndex, i.verticalIconBoxStartIndex, i.verticalIconBoxEndIndex)); 15587 } 15588 } 15589 hasTextData() { 15590 return this.text.segments.get().length > 0; 15591 } 15592 hasIconData() { 15593 return this.icon.segments.get().length > 0; 15594 } 15595 hasDebugData() { 15596 return this.textCollisionBox && this.iconCollisionBox; 15597 } 15598 hasTextCollisionBoxData() { 15599 return this.hasDebugData() && this.textCollisionBox.segments.get().length > 0; 15600 } 15601 hasIconCollisionBoxData() { 15602 return this.hasDebugData() && this.iconCollisionBox.segments.get().length > 0; 15603 } 15604 hasIconTextFit() { 15605 return this.hasAnyIconTextFit; 15606 } 15607 addIndicesForPlacedSymbol(e1, t1) { 15608 const i = e1.placedSymbolArray.get(t1), n = i.vertexStartIndex + 4 * i.numGlyphs; 15609 for(let t1 = i.vertexStartIndex; t1 < n; t1 += 4)e1.indexArray.emplaceBack(t1, t1 + 1, t1 + 2), e1.indexArray.emplaceBack(t1 + 1, t1 + 2, t1 + 3); 15610 }
15611 getSortedSymbolIndexes(e1) { 15612 if (this.sortedAngle === e1 && void 0 !== this.symbolInstanceIndexes) return this.symbolInstanceIndexes; 15613 const t1 = Math.sin(e1), i = Math.cos(e1), n = [], r = [], o = []; 15614 for(let e1 = 0; e1 < this.symbolInstances.length; ++e1){ 15615 o.push(e1); 15616 const a = this.symbolInstances.get(e1); 15617 n.push(0 | Math.round(t1 * a.tileAnchorX + i * a.tileAnchorY)), r.push(a.featureIndex); 15618 } 15619 return o.sort((e1, t1)=>n[e1] - n[t1] || r[t1] - r[e1]), o; 15620 } 15621 getSortedIndexesByZOffset() { 15622 if (!this.zOffsetSortDirty) return this.symbolInstanceIndexesSortedZOffset; 15623 if (!this.symbolInstanceIndexesSortedZOffset) { 15624 this.symbolInstanceIndexesSortedZOffset = []; 15625 for(let e1 = 0; e1 < this.symbolInstances.length; ++e1)this.symbolInstanceIndexesSortedZOffset.push(e1); 15626 } 15627 return this.zOffsetSortDirty = !1, this.symbolInstanceIndexesSortedZOffset.sort((e1, t1)=>this.symbolInstances.get(t1).zOffset - this.symbolInstances.get(e1).zOffset); 15628 } 15629 addToSortKeyRanges(e1, t1) { 15630 const i = this.sortKeyRanges.at(-1); 15631 i && i.sortKey === t1 ? i.symbolInstanceEnd = e1 + 1 : this.sortKeyRanges.push({ 15632 sortKey: t1, 15633 symbolInstanceStart: e1, 15634 symbolInstanceEnd: e1 + 1 15635 }); 15636 } 15637 sortFeatures(e1) { 15638 if (this.sortFeaturesByY && this.sortedAngle !== e1) if (this.text.segments.get().length > 1 || this.icon.segments.get().length > 1) this.sortFeaturesByY = !1; 15639 else { 15640 this.symbolInstanceIndexes = this.getSortedSymbolIndexes(e1), this.sortedAngle = e1, this.text.indexArray.clear(), this.icon.indexArray.clear(), this.featureSortOrder = []; 15641 for (const e1 of this.symbolInstanceIndexes){ 15642 const t1 = this.symbolInstances.get(e1); 15643 this.featureSortOrder.push(t1.featureIndex); 15644 const { rightJustifiedTextSymbolIndex: i, centerJustifiedTextSymbolIndex: n, leftJustifiedTextSymbolIndex: r, verticalPlacedTextSymbolIndex: o, placedIconSymbolIndex: a, verticalPlacedIconSymbolIndex: s } = t1; 15645 i >= 0 && this.addIndicesForPlacedSymbol(this.text, i), n >= 0 && n !== i && this.addIndicesForPlacedSymbol(this.text, n), r >= 0 && r !== n && r !== i && this.addIndicesForPlacedSymbol(this.text, r), o >= 0 && this.addIndicesForPlacedSymbol(this.text, o), a >= 0 && this.addIndicesForPlacedSymbol(this.icon, a), s >= 0 && this.addIndicesForPlacedSymbol(this.icon, s); 15646 } 15647 this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray), this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray); 15648 } 15649 } 15650 constructor(e1){ 15651 this.collisionBoxArray = e1.collisionBoxArray, this.zoom = e1.zoom, this.overscaling = e1.overscaling, this.layers = e1.layers, this.layerIds = this.layers.map((e1)=>e1.fqid), this.index = e1.index, this.pixelRatio = e1.pixelRatio, this.sourceLayerIndex = e1.sourceLayerIndex, this.hasPattern = !1, this.hasRTLText = !1, this.fullyClipped = !1, this.hasAnyIconTextFit = !1, this.sortKeyRanges = [], this.collisionCircleArray = [], this.placementInvProjMatrix = d([]), this.placementViewportMatrix = d([]); 15652 const t1 = this.layers[0]._unevaluatedLayout._values; 15653 this.worldview = e1.worldview, this.localizable = e1.localizable, this.maxUniformBufferBindings = e1.maxUniformBufferBindings, this.maxUniformBlockSizeDwords = e1.maxUniformBlockSizeDwords, this.textSizeData = rf(this.zoom, t1["text-size"], this.worldview, e1.availableImages), this.iconSizeData = rf(this.zoom, t1["icon-size"], this.worldview, e1.availableImages); 15654 const i = this.layers[0].layout, n = i.get("symbol-sort-key"), r = i.get("symbol-z-order"); 15655 this.lut = e1.lut, this.canOverlap = i.get("text-allow-overlap") || i.get("icon-allow-overlap") || i.get("text-ignore-placement") || i.get("icon-ignore-placement"), this.sortFeaturesByKey = "viewport-y" !== r && void 0 !== n.constantOr(1), this.sortFeaturesByY = ("viewport-y" === r || "auto" === r && !this.sortFeaturesByKey) && this.canOverlap, this.writingModes = i.get("text-writing-mode").map((e1)=>Xd[e1]), this.stateDependentLayerIds = this.layers.filter((e1)=>e1.isStateDependent()).map((e1)=>
vendor: 23,286 bytes, lines 15655-16053
15655e1.id), this.sourceID = e1.sourceID, this.projection = e1.projection, this.hasAnyZOffset = !1, this.zOffsetSortDirty = !1, this.zOffsetBuffersNeedUpload = !1, this.elevationType = "none", this.activeReplacements = [], this.replacementUpdateTime = 0, this.hasAnySecondaryIcon = !1, this.hasAppearances = null, this.featureAppearances = null, this.featureAppearanceData = new Map; 15656 } 15657 } 15658 Xa(Qm, "SymbolBucket", { 15659 omit: [ 15660 "layers", 15661 "collisionBoxArray", 15662 "compareText", 15663 "features" 15664 ] 15665 }), Qm.addDynamicAttributes = qm; 15666 class e_ extends bh { 15667 upload(e1) { 15668 const t1 = this.uploaded; 15669 super.upload(e1), !t1 && this.elevatedLayoutVertexArray.length > 0 && (this.elevatedLayoutVertexBuffer = e1.createVertexBuffer(this.elevatedLayoutVertexArray, Nu.members)); 15670 } 15671 destroy() { 15672 this.elevatedLayoutVertexBuffer && this.elevatedLayoutVertexBuffer.destroy(), super.destroy(); 15673 } 15674 constructor(e1, t1, i){ 15675 super(e1, t1, i), this.elevatedLayoutVertexArray = new $c; 15676 } 15677 } 15678 Xa(e_, "ElevatedFillBufferData"); 15679 class t_ { 15680 static isOnBorder(e1, t1) { 15681 return e1 <= 0 && t1 <= 0 || e1 >= zr && t1 >= zr; 15682 } 15683 static evaluate(e1) { 15684 if (0 === e1.length) return new t_; 15685 let t1 = []; 15686 for (const i of e1)t1.push(...i.portals); 15687 if (0 === t1.length) return new t_; 15688 for (const e1 of t1){ 15689 const t1 = e1.va, i = e1.vb; 15690 (t_.isOnBorder(t1.x, i.x) || t_.isOnBorder(t1.y, i.y)) && (e1.type = "border"); 15691 } 15692 const i = t1.filter((e1)=>"unevaluated" !== e1.type), n = t1.filter((e1)=>"unevaluated" === e1.type); 15693 if (0 === n.length) return new t_; 15694 n.sort((e1, t1)=>e1.hash === t1.hash ? e1.isTunnel === t1.isTunnel ? 0 : e1.isTunnel ? -1 : 1 : e1.hash < t1.hash ? 1 : -1), t1 = i.concat(n); 15695 let r = i.length, o = r, a = r; 15696 do { 15697 if (o++, o === t1.length || t1[r].hash !== t1[o].hash) { 15698 if (o - r === 2) { 15699 a < r && (t1[a] = t1[r], t1[r] = null); 15700 const e1 = t1[a], i = t1[o - 1]; 15701 e1.type = e1.isTunnel !== i.isTunnel ? "tunnel" : "polygon", e1.connection = { 15702 a: e1.connection.a, 15703 b: i.connection.a 15704 }, a++; 15705 } 15706 r = o; 15707 } 15708 }while (r !== t1.length) 15709 return t1.splice(a), t1.sort((e1, t1)=>e1.hash < t1.hash ? 1 : -1), { 15710 portals: t1 15711 }; 15712 } 15713 constructor(){ 15714 this.portals = []; 15715 } 15716 } 15717 Xa(t_, "ElevationPortalGraph"); 15718 class i_ { 15719 addVertex(e1, t1, i) { 15720 let n = e1[2]; 15721 null != i && (n *= i); 15722 const r = "".concat(e1[0], ",").concat(e1[1], ",").concat(e1[2], ",").concat(t1[0], ",").concat(t1[1], ",").concat(t1[2]), o = this.vertexLookup.get(r); 15723 if (null != o) return o; 15724 const a = this.outPositions.length; 15725 this.vertexLookup.set(r, a); 15726 const s = Math.trunc(16384 * t1[0]), l = Math.trunc(16384 * t1[1]), c = Math.trunc(16384 * t1[2]); 15727 return this.outPositions.emplaceBack(e1[0], e1[1], n), this.outNormals.emplaceBack(s, l, c), a; 15728 } 15729 addTriangle(e1, t1, i) { 15730 this.outIndices.emplaceBack(e1, t1, i); 15731 } 15732 addTriangles(e1, t1, i) { 15733 let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0; 15734 if (0 === e1.length) return; 15735 const r = R(), o = R(); 15736 for(let a = 0; a < e1.length; a += 3){ 15737 const s = t1[e1[a + 0]], l = t1[e1[a + 1]], c = t1[e1[a + 2]], u = i[e1[a + 1]] + n, h = i[e1[a + 2]] + n; 15738 C(r, s.x, s.y, i[e1[a + 0]] + n); 15739 const d = this.addVertex(r, o); 15740 C(r, l.x, l.y, u); 15741 const f = this.addVertex(r, o); 15742 C(r, c.x, c.y, h); 15743 const p = this.addVertex(r, o); 15744 this.outIndices.emplaceBack(d, f, p); 15745 } 15746 } 15747 addQuad(e1, t1, i, n, r, o) { 15748 const a = this.addVertex(e1, r, o), s = this.addVertex(t1, r, o), l = this.addVertex(i, r, o), c = this.addVertex(n, r, o); 15749 this.addTriangle(a, s, l), this.addTriangle(l, c, a); 15750 } 15751 getVertexCount() { 15752 return this.outPositions.length; 15753 } 15754 clearVertexLookup() { 15755 this.vertexLookup.clear(); 15756 } 15757 constructor(e1, t1, i){ 15758 this.outPositions = e1, this.outNormals = t1, this.outIndices = i, this.vertexLookup = new Map; 15759 } 15760 } 15761 class n_ { 15762 addVertices(e1, t1) { 15763 const i = this.unevalVertices.length; 15764 for(let i = 0; i < e1.length; i++)this.unevalVertices.push(e1[i]), this.unevalHeights.push(t1[i]); 15765 return i; 15766 } 15767 addTriangles(e1, t1, i) { 15768 const n = i ? this.unevalTunnelTriangles : this.unevalTriangles; 15769 for (const i of e1)n.push(i + t1); 15770 } 15771 addRenderableRing(e1, t1, i, n, r, o) { 15772 const a = [ 15773 new Pe(r.min.x, r.min.y), 15774 new Pe(r.max.x, r.min.y), 15775 new Pe(r.max.x, r.max.y), 15776 new Pe(r.min.x, r.max.y) 15777 ]; 15778 for(let s = 0; s < i - 1; s++){ 15779 const i = t1 + s, l = i + 1, c = this.unevalVertices[i], u = this.unevalVertices[l]; 15780 if (!(c.x >= r.min.x && c.x <= r.max.x && c.y >= r.min.y && c.y <= r.max.y || u.x >= r.min.x && u.x <= r.max.x && u.y >= r.min.y && u.y <= r.max.y || Yh(c, u, a))) continue; 15781 if (this.isOnBorder(c.x, u.x) || this.isOnBorder(c.y, u.y)) continue; 15782 const h = n_.computeEdgeHash(this.unevalVertices[i], this.unevalVertices[l]); 15783 let d, f = this.vertexHashLookup.get(n_.computePosHash(c)); 15784 null != f ? d = f.next : (f = this.vertexHashLookup.get(n_.computePosHash(u)), d = null != f ? f.prev : h), this.unevalEdges.push({ 15785 polygonIdx: e1, 15786 a: i, 15787 b: l, 15788 hash: h, 15789 portalHash: d, 15790 isTunnel: n, 15791 type: "unevaluated", 15792 featureInfo: o 15793 }); 15794 } 15795 } 15796 addPortalCandidates(e1, t1, i, n, r) { 15797 if (0 !== t1.length) { 15798 this.vertexHashLookup.clear(); 15799 for (const r of t1){ 15800 if (0 === r.length) continue; 15801 const t1 = r[0]; 15802 let o = n_.computeEdgeHash(t1[t1.length - 2], t1.at(-1)); 15803 for(let r = 0; r < t1.length - 1; r++){ 15804 const a = t1[r + 0], s = t1[r + 1], l = be(s.x - a.x, s.y - a.y), c = Me(l); 15805 if (0 === c) continue; 15806 let u = "unevaluated"; 15807 const h = n.pointElevation(a), d = n.pointElevation(s); 15808 Math.abs(h) < .01 && Math.abs(d) < .01 ? u = "entrance" : (this.isOnBorder(a.x, s.x) || this.isOnBorder(a.y, s.y)) && (u = "border"); 15809 const f = n_.computeEdgeHash(a, s); 15810 this.unevaluatedPortals.portals.push({ 15811 connection: { 15812 a: e1, 15813 b: void 0 15814 }, 15815 va: a, 15816 vb: s, 15817 vab: l, 15818 length: c, 15819 hash: f, 15820 isTunnel: i, 15821 type: u 15822 }); 15823 const p = n_.computePosHash(a); 15824 this.vertexHashLookup.has(p) || this.vertexHashLookup.set(p, { 15825 prev: o, 15826 next: f 15827 }), o = f; 15828 } 15829 } 15830 } 15831 } 15832 construct(e1) { 15833 if (0 === this.unevalVertices.length) return; 15834 const t1 = ()=>({ 15835 vertexOffset: 0, 15836 primitiveOffset: this.indexArray.length 15837 }), i = (e1)=>{ 15838 e1.primitiveLength = this.indexArray.length - e1.primitiveOffset; 15839 }, n = new i_(this.vertexPositions, this.vertexNormals, this.indexArray); 15840 this.prepareEdges(e1.portals, this.unevalEdges); 15841 const r = t1(), o = t1(), a = t1(), s = (e1, t1)=>{ 15842 e1.sort((e1, i)=>e1.type === t1 && i.type !== t1 ? -1 : e1.type !== t1 && i.type === t1 ? 1 : 0); 15843 const i = e1.findIndex((e1)=>e1.type !== t1); 15844 return i >= 0 ? i : e1.length; 15845 }; 15846 let l = 0; 15847 this.unevalEdges.length > 0 && (l = s(this.unevalEdges, "none"), this.constructBridgeStructures(n, this.unevalVertices, this.unevalHeights, this.unevalEdges, { 15848 min: 0, 15849 max: l 15850 }, this.tileToMeters)), i(a); 15851 const c = t1(), u = t1(); 15852 if (this.unevalEdges.length > 0) { 15853 const e1 = this.unevalEdges.splice(l), t1 = s(e1, "tunnel") + l; 15854 this.unevalEdges.push(...e1), this.constructTunnelStructures(n, this.unevalVertices, this.unevalHeights, this.unevalEdges, { 15855 min: 0, 15856 max: l 15857 }, { 15858 min: l, 15859 max: t1 15860 }); 15861 } 15862 i(c), n.addTriangles(this.unevalTriangles, this.unevalVertices, this.unevalHeights), i(u), n.addTriangles(this.unevalTunnelTriangles, this.unevalVertices, this.unevalHeights), i(o), n.addTriangles(this.unevalTunnelTriangles, this.unevalVertices, this.unevalHeights, 4), i(r), this.maskSegments = ju.simpleSegment(0, u.primitiveOffset, 0, u.primitiveLength), this.depthSegments = ju.simpleSegment(0, o.primitiveOffset, 0, o.primitiveLength), this.renderableBridgeSegments = ju.simpleSegment(0, a.primitiveOffset, 0, a.primitiveLength), this.renderableTunnelSegments = ju.simpleSegment(0, c.primitiveOffset, 0, c.primitiveLength), this.shadowCasterSegments = ju.simpleSegment(0, r.primitiveOffset, 0, r.primitiveLength); 15863 } 15864 update(e1, t1, i, n, r, o, a, s) { 15865 this.bridgeProgramConfigurations.updatePaintArrays(e1, t1, r, i, n, o, a, s), this.tunnelProgramConfigurations.updatePaintArrays(e1, t1, r, i, n, o, a, s); 15866 } 15867 upload(e1) { 15868 this.vertexBuffer || 0 === this.vertexPositions.length || 0 === this.vertexNormals.length || 0 === this.indexArray.length || (this.vertexBuffer = e1.createVertexBuffer(this.vertexPositions, ku.members), this.vertexBufferNormal = e1.createVertexBuffer(this.vertexNormals, Uu.members), this.indexBuffer = e1.createIndexBuffer(this.indexArray), this.bridgeProgramConfigurations.upload(e1), this.tunnelProgramConfigurations.upload(e1)); 15869 } 15870 destroy() { 15871 this.vertexBuffer && (this.vertexBuffer.destroy(), this.vertexBufferNormal.destroy(), this.indexBuffer.destroy()), this.maskSegments && (this.maskSegments.destroy(), this.depthSegments.destroy(), this.renderableBridgeSegments.destroy(), this.renderableTunnelSegments.destroy(), this.shadowCasterSegments.destroy()), this.bridgeProgramConfigurations.destroy(), this.tunnelProgramConfigurations.destroy(); 15872 } 15873 populatePaintArrays(e1, t1, i, n, r) { 15874 const o = (o, a)=>{ 15875 for(let s = 0; s < a.length - 1; s++){ 15876 const l = a[s].featureIndex, c = a[s + 1].vertexStart, u = e1.feature(l); 15877 o.populatePaintArrays(c, u, l, {}, i, t1, n, void 0, r); 15878 } 15879 }; 15880 o(this.bridgeProgramConfigurations, this.bridgeFeatureSections), o(this.tunnelProgramConfigurations, this.tunnelFeatureSections); 15881 } 15882 computeVertexConnections(e1, t1, i, n, r) { 15883 const o = new Map; 15884 for(let a = n; a < r; a++){ 15885 const n = i[a], r = n.a, s = n.b, l = n_.computePosHash(e1[r]), c = n_.computePosHash(e1[s]); 15886 let u = o.get(l); 15887 u || (u = {}, o.set(l, u)); 15888 let h = o.get(c); 15889 h || (h = {}, o.set(c, h)), t1[r] <= 0 && t1[s] <= 0 || (u.to = s, h.from = r); 15890 } 15891 return o; 15892 } 15893 isTerminalVertex(e1, t1) { 15894 const i = n_.computePosHash(this.unevalVertices[e1]), n = t1.get(i); 15895 return !n || !n.from || !n.to; 15896 } 15897 constructBridgeStructures(e1, t1, i, n, r, o) { 15898 e1.clearVertexLookup(); 15899 const a = this.computeVertexConnections(t1, i, n, r.min, r.max), s = 1 / o, l = .5 * s, c = (e1, n)=>C(e1, t1[n].x, t1[n].y, i[n] * s), u = R(), h = R(), d = R(), f = R(), p = R(), m = (e1, i)=>{ 15900 const n = a.get(n_.computePosHash(t1[i])), r = n.from, o = n.to; 15901 if (!r || !o) return; 15902 c(u, r), c(h, i), c(d, o), Q(f), ee(u, h) || (te(p, h, u), Z(f, p)), ee(d, h) || (te(p, d, h), L(f, f, Z(p, p))); 15903 const s = ne(f); 15904 return s > 0 ? k(e1, f, 1 / s) : void 0; 15905 }; 15906 let _ = Number.POSITIVE_INFINITY; 15907 this.sortSubarray(n, r.min, r.max, (e1, t1)=>e1.featureInfo.featureIndex - t1.featureInfo.featureIndex); 15908 const g = R(), y = R(), x = R(), v = R(), b = R(), w = R(), A = R(), E = R(), I = R(), M = [ 15909 R(), 15910 R(), 15911 R(), 15912 R() 15913 ], T = [ 15914 R(), 15915 R(), 15916 R(), 15917 R() 15918 ], S = [ 15919 { 15920 coord: new Pe(0, 0), 15921 height: 0 15922 }, 15923 { 15924 coord: new Pe(0, 0), 15925 height: 0 15926 } 15927 ], z = (e1, t1)=>e1 > t1; 15928 for(let c = r.min; c < r.max; c++){ 15929 const r = n[c]; 15930 if (!r.featureInfo.guardRailEnabled) continue; 15931 if (!this.prepareEdgePoints(S, t1, i, r, z)) continue; 15932 const [u, h] = S; 15933 if (C(g, u.coord.x, u.coord.y, s * u.height), C(y, h.coord.x, h.coord.y, s * h.height), ee(g, y)) continue; 15934 te(x, y, g), Z(x, x); 15935 const d = m(E, r.a) || x, f = m(I, r.b) || x; 15936 C(v, d[1], -d[0], 0), Z(v, v), C(b, f[1], -f[0], 0), Z(b, b), q(E, v, d), Z(w, E), q(E, b, f), Z(A, E), L(M[0], g, k(E, te(E, v, w), l)), L(M[1], g, k(E, L(E, v, w), l)), L(M[2], g, k(E, w, l)), M[3] = g, L(T[0], y, k(E, te(E, b, A), l)), L(T[1], y, k(E, L(E, b, A), l)), L(T[2], y, k(E, A, l)), T[3] = y, _ = this.addFeatureSection(r.featureInfo.featureIndex, _, this.bridgeFeatureSections, e1); 15937 const p = e1.addVertex(M[0], v, o), R = e1.addVertex(M[1], v, o), P = e1.addVertex(T[0], b, o), D = e1.addVertex(T[1], b, o); 15938 e1.addTriangle(p, R, P), e1.addTriangle(R, D, P); 15939 const F = e1.addVertex(M[1], w, o), O = e1.addVertex(M[2], w, o), B = e1.addVertex(T[1], A, o), V = e1.addVertex(T[2], A, o); 15940 e1.addTriangle(F, O, B), e1.addTriangle(O, V, B), $(v, v), $(b, b); 15941 const N = e1.addVertex(M[2], v, o), U = e1.addVertex(M[3], v, o), j = e1.addVertex(T[2], b, o), G = e1.addVertex(T[3], b, o); 15942 e1.addTriangle(N, U, j), e1.addTriangle(U, G, j); 15943 const H = this.isTerminalVertex(r.a, a), W = this.isTerminalVertex(r.b, a); 15944 u.height < .01 && H && e1.addQuad(M[3], M[2], M[1], M[0], $(d, d), o), h.height < .01 && W && e1.addQuad(T[0], T[1], T[2], T[3], f, o); 15945 } 15946 this.bridgeFeatureSections.push({ 15947 featureIndex: Number.POSITIVE_INFINITY, 15948 vertexStart: e1.getVertexCount() 15949 }); 15950 } 15951 constructTunnelStructures(e1, t1, i, n, r, o) { 15952 e1.clearVertexLookup(); 15953 let a = Number.POSITIVE_INFINITY; 15954 const s = (e1, t1)=>e1.featureInfo.featureIndex - t1.featureInfo.featureIndex; 15955 this.sortSubarray(n, r.min, r.max, s), this.sortSubarray(n, o.min, o.max, s); 15956 const l = (e1)=>Z(e1, e1), c = [ 15957 { 15958 coord: new Pe(0, 0), 15959 height: 0 15960 }, 15961 { 15962 coord: new Pe(0, 0), 15963 height: 0 15964 } 15965 ], u = (e1, t1)=>e1 < t1, h = R(), d = R(), f = R(), p = R(), m = R(); 15966 for(let o = r.min; o < r.max; o++){ 15967 if (!this.prepareEdgePoints(c, t1, i, n[o], u)) continue; 15968 const [r, s] = c, _ = l(C(m, -(s.coord.y - r.coord.y), s.coord.x - r.coord.x, 0)); 15969 a = this.addFeatureSection(n[o].featureInfo.featureIndex, a, this.tunnelFeatureSections, e1), e1.addQuad(C(h, r.coord.x, r.coord.y, r.height), C(d, s.coord.x, s.coord.y, s.height), C(f, s.coord.x, s.coord.y, n[o].isTunnel ? s.height + 4 : 0), C(p, r.coord.x, r.coord.y, n[o].isTunnel ? r.height + 4 : 0), _); 15970 } 15971 for(let r = o.min; r < o.max; r++){ 15972 const o = n[r]; 15973 o.isTunnel && ([o.a, o.b] = [ 15974 o.b, 15975 o.a 15976 ]); 15977 const s = t1[o.a], c = t1[o.b], u = l(C(m, -(c.y - s.y), c.x - s.x, 0)); 15978 a = this.addFeatureSection(o.featureInfo.featureIndex, a, this.tunnelFeatureSections, e1), e1.addQuad(C(h, c.x, c.y, 0), C(d, s.x, s.y, 0), C(f, s.x, s.y, i[o.a] + 4), C(p, c.x, c.y, i[o.b] + 4), u), e1.addQuad(C(h, s.x, s.y, 0), C(d, c.x, c.y, 0), C(f, c.x, c.y, i[o.b] + 4), C(p, s.x, s.y, i[o.a] + 4), u); 15979 } 15980 this.tunnelFeatureSections.push({ 15981 featureIndex: Number.POSITIVE_INFINITY, 15982 vertexStart: e1.getVertexCount() 15983 }); 15984 } 15985 setElevatedPoint(e1, t1, i, n) { 15986 e1.coord.x = t1, e1.coord.y = i, e1.height = n; 15987 } 15988 prepareEdgePoints(e1, t1, i, n, r) { 15989 let o = t1[n.a].x, a = t1[n.a].y, s = t1[n.b].x, l = t1[n.b].y, c = i[n.a], u = i[n.b]; 15990 const h = r(c, 0), d = r(u, 0); 15991 if (h && d) return this.setElevatedPoint(e1[0], o, a, c), this.setElevatedPoint(e1[1], s, l, u), !0; 15992 if (!h && !d) return !1; 15993 if (h) { 15994 if (!d) { 15995 const e1 = u / (u - c); 15996 s = fn(s, o, e1), l = fn(l, a, e1), u = fn(u, c, e1); 15997 } 15998 } else { 15999 const e1 = c / (c - u); 16000 o = fn(o, s, e1), a = fn(a, l, e1), c = fn(c, u, e1); 16001 } 16002 return this.setElevatedPoint(e1[0], o, a, c), this.setElevatedPoint(e1[1], s, l, u), !0; 16003 } 16004 prepareEdges(e1, t1) { 16005 if (0 === t1.length) return; 16006 t1.sort((e1, t1)=>e1.hash === t1.hash ? t1.polygonIdx - e1.polygonIdx : t1.hash > e1.hash ? 1 : -1); 16007 let i = 0, n = 0, r = 0, o = t1[i].polygonIdx; 16008 do { 16009 n++, (n === t1.length || t1[i].hash !== t1[n].hash) && ((1 === n - i || t1[n - 1].polygonIdx !== o) && (r < i && (t1[r] = t1[i], t1[i] = null), t1[r].type = "none", r++), i = n, i !== t1.length && (o = t1[i].polygonIdx)); 16010 }while (i !== t1.length) 16011 if (t1.splice(r), 0 !== t1.length && 0 !== e1.length) { 16012 t1.sort((e1, t1)=>e1.portalHash < t1.portalHash ? 1 : -1); 16013 let i = 0, n = 0; 16014 for(; i !== t1.length && n !== e1.length;){ 16015 const r = t1[i], o = e1[n]; 16016 r.portalHash > o.hash ? i++ : o.hash > r.portalHash ? n++ : (r.type = o.type, i++); 16017 } 16018 } 16019 } 16020 isOnBorder(e1, t1) { 16021 return e1 <= 0 && t1 <= 0 || e1 >= zr && t1 >= zr; 16022 } 16023 addFeatureSection(e1, t1, i, n) { 16024 return e1 !== t1 && (t1 = e1, i.push({ 16025 featureIndex: e1, 16026 vertexStart: n.getVertexCount() 16027 }), n.clearVertexLookup()), t1; 16028 } 16029 sortSubarray(e1, t1, i, n) { 16030 const r = e1.slice(t1, i); 16031 r.sort(n), e1.splice(t1, r.length, ...r); 16032 } 16033 static computeEdgeHash(e1, t1) { 16034 return (e1.y === t1.y && e1.x > t1.x || e1.y > t1.y) && ([e1, t1] = [ 16035 t1, 16036 e1 16037 ]), BigInt(n_.computePosHash(e1)) << 32n | BigInt(n_.computePosHash(t1)); 16038 } 16039 static computePosHash(e1) { 16040 return ((65535 & e1.x) << 16 | 65535 & e1.y) >>> 0; 16041 } 16042 constructor(e1, t1, i, n){ 16043 this.unevaluatedPortals = new t_, this.bridgeFeatureSections = [], this.tunnelFeatureSections = [], this.vertexHashLookup = new Map, this.unevalVertices = [], this.unevalHeights = [], this.unevalTriangles = [], this.unevalTunnelTriangles = [], this.unevalEdges = [], this.vertexPositions = new Zc, this.vertexNormals = new Wc, this.indexArray = new uu, this.tileToMeters = Ic(e1), this.bridgeProgramConfigurations = new mh(t1, { 16044 zoom: i, 16045 lut: n 16046 }, (e1)=>"fill-tunnel-structure-color" !== e1), this.tunnelProgramConfigurations = new mh(t1, { 16047 zoom: i, 16048 lut: n 16049 }, (e1)=>"fill-bridge-guard-rail-color" !== e1); 16050 } 16051 } 16052 class r_ { 16053 reset(e1) {
16054 return this.feature = e1, this._valid = !0, this._geometry = e1.loadGeometry(), 0 !== this._geometry.length && 0 !== this._geometry[0].length || (this._valid = !1), this; 16055 } 16056 geometry(e1, t1) { 16057 return this._valid && e1(t1(this._geometry)), this; 16058 } 16059 require(e1, t1, i) { 16060 return this.get(e1, !0, t1, i); 16061 } 16062 optional(e1, t1, i) { 16063 return this.get(e1, !1, t1, i); 16064 } 16065 success() { 16066 return this._valid; 16067 } 16068 get(e1, t1, i, n) { 16069 const r = Object.hasOwn(this.feature.properties, e1) ? +this.feature.properties[e1] : void 0; 16070 return this._valid && void 0 !== r && !Number.isNaN(r) ? i(n ? n(r) : r) : t1 && (this._valid = !1), this; 16071 } 16072 constructor(){ 16073 this._valid = !1; 16074 } 16075 } 16076 class o_ { 16077 parseFeature(e1, t1, i) { 16078 return this.featureFunc(e1, t1, i); 16079 } 16080 parseVertex(e1, t1, i) { 16081 return this.vertexFunc(e1, t1, i); 16082 } 16083 constructor(e1, t1){ 16084 this.featureFunc = e1, this.vertexFunc = t1; 16085 } 16086 } 16087 const a_ = new o_((e1, t1, i)=>e1.reset(t1).require(fd, (e1)=>{ 16088 i.id = e1; 16089 }).optional("fixed_height_relative", (e1)=>{ 16090 i.constantHeight = e1; 16091 }, l_.decodeRelativeHeight).geometry((e1)=>{ 16092 i.bounds = e1; 16093 }, We).success(), (e1, t1, i)=>e1.reset(t1).require(fd, (e1)=>{ 16094 i.id = e1; 16095 }).require("elevation_idx", (e1)=>{ 16096 i.idx = e1; 16097 }).require("extent", (e1)=>{ 16098 i.extent = e1; 16099 }).require("height_relative", (e1)=>{ 16100 i.height = e1; 16101 }, l_.decodeRelativeHeight).geometry((e1)=>{ 16102 i.position = e1; 16103 }, l_.getPoint).success()), s_ = new o_((e1, t1, i)=>e1.reset(t1).require(fd, (e1)=>{ 16104 i.id = e1; 16105 }).optional("fixed_height", (e1)=>{ 16106 i.constantHeight = e1; 16107 }, l_.decodeMetricHeight).geometry((e1)=>{ 16108 i.bounds = e1; 16109 }, We).success(), (e1, t1, i)=>e1.reset(t1).require(fd, (e1)=>{ 16110 i.id = e1; 16111 }).require("elevation_idx", (e1)=>{ 16112 i.idx = e1; 16113 }).require("extent", (e1)=>{ 16114 i.extent = e1; 16115 }).require("height", (e1)=>{ 16116 i.height = e1; 16117 }, l_.decodeMetricHeight).geometry((e1)=>{ 16118 i.position = e1; 16119 }, l_.getPoint).success()); 16120 class l_ { 16121 static getPoint(e1) { 16122 return be(e1[0][0].x, e1[0][0].y); 16123 } 16124 static decodeRelativeHeight(e1) { 16125 return 1e-4 * e1 * 5; 16126 } 16127 static decodeMetricHeight(e1) { 16128 return 1e-4 * e1; 16129 } 16130 static getVersionSchema(e1) { 16131 return e1 ? "1.0.1" === e1 ? s_ : void 0 : a_; 16132 } 16133 static parse(e1) { 16134 const t1 = [], i = [], n = e1.length, r = new r_; 16135 for(let o = 0; o < n; o++){ 16136 const n = e1.feature(o), a = n.properties.version, s = l_.getVersionSchema(a); 16137 if (void 0 === s) { 16138 gt("Unknown elevation feature version number ".concat(a || "(unknown)")); 16139 continue; 16140 } 16141 const l = n.properties.type; 16142 if (!l) continue; 16143 const c = Dh.types[n.type]; 16144 if ("Point" === c && "curve_point" === l) { 16145 const e1 = {}; 16146 s.parseVertex(r, n, e1) && t1.push(e1); 16147 } else if ("Polygon" === c && "curve_meta" === l) { 16148 const e1 = {}; 16149 s.parseFeature(r, n, e1) && i.push(e1); 16150 } 16151 } 16152 return { 16153 vertices: t1,
vendor: 11,893 bytes, lines 16154-16389
16154 features: i 16155 }; 16156 } 16157 } 16158 const c_ = [ 16159 ve(), 16160 ve(), 16161 ve(), 16162 ve(), 16163 ve(), 16164 ve(), 16165 ve() 16166 ], u_ = ve(), h_ = ve(); 16167 function d_(e1) { 16168 return [ 16169 e1[0], 16170 e1[1] 16171 ]; 16172 } 16173 function f_(e1) { 16174 return be(e1[0], e1[1]); 16175 } 16176 class p_ { 16177 get() { 16178 const e1 = this.feature.vertices[this.index], t1 = this.feature.vertexProps[this.index].dir, i = t1[1], n = -t1[0], r = (e1.extent + 1) * this.metersToTile, o = this.sampler ? this.sampler.pointTransform(e1.position) : e1.position; 16179 return [ 16180 new Pe(Math.trunc(o[0] + i * r), Math.trunc(o[1] + n * r)), 16181 new Pe(Math.trunc(o[0] - i * r), Math.trunc(o[1] - n * r)) 16182 ]; 16183 } 16184 next() { 16185 this.index++; 16186 } 16187 valid() { 16188 return this.index < this.feature.vertices.length; 16189 } 16190 constructor(e1, t1, i = null){ 16191 this.feature = e1, this.metersToTile = t1, this.sampler = i, this.index = 0; 16192 } 16193 } 16194 class m_ { 16195 pointElevation(e1) { 16196 if (null != this.constantHeight) return this.constantHeight; 16197 const t1 = this.getClosestEdge(e1); 16198 if (null == t1) return 0; 16199 const [i, n] = t1; 16200 return fn(this.vertices[this.edges[i].a].height, this.vertices[this.edges[i].b].height, n); 16201 } 16202 computeSlopeNormal(e1, t1) { 16203 const i = this.getClosestEdge(e1); 16204 if (!i) return F(0, 0, 1); 16205 const n = i[0], r = this.edges[n], o = this.edgeProps[n].vec, a = F(o[0], o[1], (this.vertices[r.b].height - this.vertices[r.a].height) * t1), s = F(a[1], -a[0], 0); 16206 q(s, s, a); 16207 const l = D(s); 16208 return l > 0 ? k(s, s, 1 / l) : C(s, 0, 0, 1); 16209 } 16210 getSafeArea() { 16211 return this.safeArea; 16212 } 16213 isTunnel() { 16214 return this.heightRange.max <= -5; 16215 } 16216 getClosestEdge(e1) { 16217 if (0 === this.edges.length) return; 16218 let t1 = 0, i = Number.POSITIVE_INFINITY, n = 0; 16219 const [r, o, a, s, l, c, u] = c_; 16220 we(u, e1.x, e1.y); 16221 const h = new bf(u, null); 16222 for(let e1 = 0; e1 < this.edges.length; e1++){ 16223 const d = this.edges[e1], f = this.edgeProps[e1].dir; 16224 h.dir = f; 16225 const p = this.vertices[d.a].position, m = this.vertices[d.b].position, _ = h.intersectsPlane(p, this.vertexProps[d.a].dir, r), g = h.intersectsPlane(m, this.vertexProps[d.b].dir, o); 16226 if (!_ || !g) continue; 16227 Ee(a, o, r), Ee(s, u, r); 16228 const y = Se(a, a), x = y > 0 ? Se(s, a) / y : 0, v = it(x, 0, 1), b = Math.abs((x - v) * this.edgeProps[e1].len); 16229 Ee(l, u, p), we(c, f[1], -f[0]); 16230 const w = b + Math.abs(Se(l, c)); 16231 w < i && (t1 = e1, i = w, n = v); 16232 } 16233 return [ 16234 t1, 16235 n 16236 ]; 16237 } 16238 tessellate(e1) { 16239 const t1 = R(), i = R(), n = R(), r = R(); 16240 for(let o = this.edges.length - 1; o >= 0; --o){ 16241 const a = this.edges[o].a, s = this.edges[o].b, { position: l, height: c, extent: u } = this.vertices[a], { position: h, height: d, extent: f } = this.vertices[s], p = this.vertexProps[a].dir, m = this.vertexProps[s].dir; 16242 if (C(t1, l[0] / e1, l[1] / e1, c), C(i, h[0] / e1, h[1] / e1, d), C(n, p[1], -p[0], 0), k(n, n, u), C(r, m[1], -m[0], 0), k(r, r, f), this.distSqLines(F(t1[0] + .5 * n[0], t1[1] + .5 * n[1], t1[2] + .5 * n[2]), F(i[0] - .5 * r[0], i[1] - .5 * r[1], i[2] - .5 * r[2]), F(t1[0] - .5 * n[0], t1[1] - .5 * n[1], t1[2] - .5 * n[2]), F(i[0] + .5 * r[0], i[1] + .5 * r[1], i[2] + .5 * r[2])) <= .0025000000000000005) continue; 16243 const _ = this.vertices.length, g = Ae(ve(), l, h); 16244 this.vertices.push({ 16245 position: Ie(g, g, .5), 16246 height: .5 * (c + d), 16247 extent: .5 * (u + f), 16248 index: .5 * ((void 0 !== this.vertices[a].index ? this.vertices[a].index : a) + (void 0 !== this.vertices[s].index ? this.vertices[s].index : s)) 16249 }); 16250 const y = Ae(ve(), p, m); 16251 this.vertexProps.push({ 16252 dir: Te(y, y) 16253 }), this.edges.splice(o, 1), this.edgeProps.splice(o, 1), this.edges.push({ 16254 a, 16255 b: _ 16256 }), this.edges.push({ 16257 a: _, 16258 b: s 16259 }); 16260 const x = Ee(ve(), this.vertices[_].position, l), v = Me(x), b = { 16261 vec: x, 16262 dir: Ie(ve(), x, 1 / v), 16263 len: v 16264 }; 16265 this.edgeProps.push(b), this.edgeProps.push(b); 16266 } 16267 } 16268 distSqLines(e1, t1, i, n) { 16269 const r = O(R(), t1, e1), o = O(R(), n, i), a = O(R(), e1, i), s = W(r, r), l = W(r, o), c = W(r, a), u = W(o, o), h = W(o, a), d = s * u - l * l; 16270 if (0 === d) return G(X(r, i, n, W(a, o) / W(o, o)), e1); 16271 const f = (s * h - l * c) / d; 16272 return G(X(r, e1, t1, (l * h - c * u) / d), X(o, i, n, f)); 16273 } 16274 static serialize(e1, t1) { 16275 const i = { 16276 id: e1.id, 16277 heightRange: { 16278 min: e1.heightRange.min, 16279 max: e1.heightRange.max 16280 }, 16281 safeArea: (n = e1.safeArea, { 16282 min: { 16283 x: n.min.x, 16284 y: n.min.y 16285 }, 16286 max: { 16287 x: n.max.x, 16288 y: n.max.y 16289 } 16290 }) 16291 }; 16292 var n; 16293 return null != e1.constantHeight ? (i.constantHeight = e1.constantHeight, i) : 0 === e1.vertices.length ? (i.vertices = [], i.vertexProps = [], i.edges = [], i.edgeProps = [], i) : (i.vertices = e1.vertices.map((e1)=>({ 16294 position: d_(e1.position), 16295 height: e1.height, 16296 extent: e1.extent, 16297 index: e1.index 16298 })), i.vertexProps = e1.vertexProps.map((e1)=>({ 16299 dir: d_(e1.dir) 16300 })), i.edges = e1.edges.map((e1)=>({ 16301 a: e1.a, 16302 b: e1.b 16303 })), i.edgeProps = e1.edgeProps.map((e1)=>({ 16304 vec: d_(e1.vec), 16305 dir: d_(e1.dir), 16306 len: e1.len 16307 })), i); 16308 } 16309 static deserialize(e1) { 16310 const t1 = function(e1) { 16311 return { 16312 min: new Pe(e1.min.x, e1.min.y), 16313 max: new Pe(e1.max.x, e1.max.y) 16314 }; 16315 }(e1.safeArea); 16316 if (null != e1.constantHeight) return new m_(e1.id, t1, e1.constantHeight); 16317 if (!e1.vertices || 0 === e1.vertices.length) { 16318 const i = Object.create(m_.prototype); 16319 return i.id = e1.id, i.constantHeight = void 0, i.heightRange = { 16320 min: e1.heightRange.min, 16321 max: e1.heightRange.max 16322 }, i.safeArea = t1, i.vertices = [], i.vertexProps = [], i.edges = [], i.edgeProps = [], i; 16323 } 16324 const i = Object.create(m_.prototype); 16325 return i.id = e1.id, i.constantHeight = void 0, i.heightRange = { 16326 min: e1.heightRange.min, 16327 max: e1.heightRange.max 16328 }, i.safeArea = t1, i.vertices = e1.vertices.map((e1)=>({ 16329 position: f_(e1.position), 16330 height: e1.height, 16331 extent: e1.extent, 16332 index: e1.index 16333 })), i.vertexProps = (e1.vertexProps || []).map((e1)=>({ 16334 dir: f_(e1.dir) 16335 })), i.edges = (e1.edges || []).map((e1)=>({ 16336 a: e1.a, 16337 b: e1.b 16338 })), i.edgeProps = (e1.edgeProps || []).map((e1)=>({ 16339 vec: f_(e1.vec), 16340 dir: f_(e1.dir), 16341 len: e1.len 16342 })), i; 16343 } 16344 constructor(e1, t1, i, n, r, o){ 16345 if (this.vertices = new Array, this.vertexProps = new Array, this.edges = new Array, this.edgeProps = new Array, this.id = e1, this.heightRange = { 16346 min: i, 16347 max: i 16348 }, this.safeArea = t1, this.constantHeight = i, null == this.constantHeight && (null != this.constantHeight || 0 !== n.length)) { 16349 this.vertices = n, this.edges = r; 16350 for(let e1 = 0; e1 < this.vertices.length; e1++)this.vertices[e1].index = void 0 !== this.vertices[e1].index ? this.vertices[e1].index : e1; 16351 this.edges = this.edges.filter((e1)=>{ 16352 return e1.a < this.vertices.length && e1.b < this.vertices.length && !((t1 = this.vertices[e1.a].position)[0] === (i = this.vertices[e1.b].position)[0] && t1[1] === i[1]); 16353 //TURBOPACK unreachable 16354 ; 16355 var t1, i; 16356 }), this.heightRange = { 16357 min: Number.POSITIVE_INFINITY, 16358 max: Number.NEGATIVE_INFINITY 16359 }; 16360 for (const e1 of this.vertices)this.vertexProps.push({ 16361 dir: be(0, 0) 16362 }), this.heightRange.min = Math.min(this.heightRange.min, e1.height), this.heightRange.max = Math.max(this.heightRange.max, e1.height); 16363 for (const e1 of this.edges){ 16364 const t1 = this.vertices[e1.a].position, i = this.vertices[e1.b].position, n = Ee(ve(), i, t1), r = Me(n), o = Ie(ve(), n, 1 / r); 16365 this.edgeProps.push({ 16366 vec: n, 16367 dir: o, 16368 len: r 16369 }); 16370 const a = this.vertexProps[e1.a].dir, s = this.vertexProps[e1.b].dir; 16371 Ae(a, a, o), Ae(s, s, o); 16372 } 16373 for (const e1 of this.vertexProps)0 === e1.dir[0] && 0 === e1.dir[1] || Te(e1.dir, e1.dir); 16374 this.tessellate(o); 16375 } 16376 } 16377 } 16378 class __ { 16379 pointTransform(e1) { 16380 return be(e1[0] * this.zScale + this.xOffset, e1[1] * this.zScale + this.yOffset); 16381 } 16382 pointTransformInPlace(e1) { 16383 e1[0] = e1[0] * this.zScale + this.xOffset, e1[1] = e1[1] * this.zScale + this.yOffset; 16384 } 16385 constantElevation(e1, t1) { 16386 if (null != e1.constantHeight) return this.computeBiasedHeight(e1.constantHeight, t1); 16387 } 16388 pointElevation(e1, t1, i) { 16389 const n = this.constantElevation(t1, i);
16390 return null != n ? n : (e1.x = e1.x * this.zScale + this.xOffset, e1.y = e1.y * this.zScale + this.yOffset, this.computeBiasedHeight(t1.pointElevation(e1), i)); 16391 } 16392 computeBiasedHeight(e1, t1) { 16393 return t1 <= 0 ? e1 : e1 + t1 * nt(0, t1, e1 >= 0 ? e1 : Math.abs(.5 * e1)); 16394 } 16395 constructor(e1, t1){ 16396 this.zScale = 1, this.xOffset = 0, this.yOffset = 0, e1.equals(t1) || (this.zScale = Math.pow(2, t1.z - e1.z), this.xOffset = (e1.x * this.zScale - t1.x) * zr, this.yOffset = (e1.y * this.zScale - t1.y) * zr); 16397 } 16398 } 16399 function g_(e1) { 16400 if (0 === e1) return [ 16401 0, 16402 0, 16403 0 16404 ]; 16405 const t1 = pa(e1); 16406 return [ 16407 t1(), 16408 t1(), 16409 t1() 16410 ]; 16411 } 16412 function y_(e1, t1) { 16413 let i = 0, n = e1.length - 1; 16414 for(; i <= n;){ 16415 const r = i + n >> 1; 16416 e1[r].feature.id < t1 ? i = r + 1 : n = r - 1; 16417 } 16418 return i < e1.length && e1[i].feature.id === t1 ? i : -1; 16419 } 16420 function x_(e1, t1, i, n) { 16421 if (!e1.properties) return; 16422 const r = +e1.properties[fd]; 16423 if (Number.isNaN(r)) return; 16424 if (t1) { 16425 const e1 = t1.find((e1)=>e1.id === r); 16426 if (e1 && n) return { 16427 tileId: n, 16428 feature: e1 16429 }; 16430 } 16431 if (!i || 0 === i.length) return; 16432 const o = y_(i, r); 16433 if (!(o < 0)) { 16434 if (n) { 16435 for(let e1 = o; e1 < i.length && i[e1].feature.id === r; e1++)if (i[e1].tileId.key === n.key) return i[e1]; 16436 } 16437 return i[o]; 16438 } 16439 } 16440 function v_(e1, t1) { 16441 return e1 > t1 ? 1 : e1 < t1 ? -1 : 0; 16442 } 16443 Xa(m_, "ElevationFeature"); 16444 class b_ { 16445 rotateLeft(e1) { 16446 var t1 = e1.right; 16447 t1 && (e1.right = t1.left, t1.left && (t1.left.parent = e1), t1.parent = e1.parent), e1.parent ? e1 === e1.parent.left ? e1.parent.left = t1 : e1.parent.right = t1 : this._root = t1, t1 && (t1.left = e1), e1.parent = t1; 16448 } 16449 rotateRight(e1) { 16450 var t1 = e1.left; 16451 t1 && (e1.left = t1.right, t1.right && (t1.right.parent = e1), t1.parent = e1.parent), e1.parent ? e1 === e1.parent.left ? e1.parent.left = t1 : e1.parent.right = t1 : this._root = t1, t1 && (t1.right = e1), e1.parent = t1; 16452 } 16453 _splay(e1) { 16454 for(; e1.parent;){ 16455 var t1 = e1.parent; 16456 t1.parent ? t1.left === e1 && t1.parent.left === t1 ? (this.rotateRight(t1.parent), this.rotateRight(t1)) : t1.right === e1 && t1.parent.right === t1 ? (this.rotateLeft(t1.parent), this.rotateLeft(t1)) : t1.left === e1 && t1.parent.right === t1 ? (this.rotateRight(t1), this.rotateLeft(t1)) : (this.rotateLeft(t1), this.rotateRight(t1)) : t1.left === e1 ? this.rotateRight(t1) : this.rotateLeft(t1); 16457 } 16458 } 16459 splay(e1) { 16460 for(var t1, i, n, r, o; e1.parent;)(i = (t1 = e1.parent).parent) && i.parent ? ((n = i.parent).left === i ? n.left = e1 : n.right = e1, e1.parent = n) : (e1.parent = null, this._root = e1), r = e1.left, o = e1.right, e1 === t1.left ? (i && (i.left === t1 ? (t1.right ? (i.left = t1.right, i.left.parent = i) : i.left = null, t1.right = i, i.parent = t1) : (r ? (i.right = r, r.parent = i) : i.right = null, e1.left = i, i.parent = e1)), o ? (t1.left = o, o.parent = t1) : t1.left = null, e1.right = t1, t1.parent = e1) : (i && (i.right === t1 ? (t1.left ? (i.right = t1.left, i.right.parent = i) : i.right = null, t1.left = i, i.parent = t1) : (o ? (i.left = o, o.parent = i) : i.left = null, e1.right = i, i.parent = e1)), r ? (t1.right = r, r.parent = t1) : t1.right = null, e1.left = t1, t1.parent = e1); 16461 } 16462 replace(e1, t1) { 16463 e1.parent ? e1 === e1.parent.left ? e1.parent.left = t1 : e1.parent.right = t1 : this._root = t1, t1 && (t1.parent = e1.parent); 16464 } 16465 minNode() { 16466 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this._root; 16467 if (e1) for(; e1.left;)e1 = e1.left; 16468 return e1; 16469 } 16470 maxNode() { 16471 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this._root; 16472 if (e1) for(; e1.right;)e1 = e1.right; 16473 return e1; 16474 } 16475 insert(e1, t1) { 16476 var i = this._root, n = null, r = this._compare; 16477 if (this._noDuplicates) for(; i;){ 16478 if (n = i, 0 === r(i.key, e1)) return; 16479 i = r(i.key, e1) < 0 ? i.right : i.left; 16480 } 16481 else for(; i;)n = i, i = r(i.key, e1) < 0 ? i.right : i.left; 16482 return i = { 16483 key: e1, 16484 data: t1, 16485 left: null, 16486 right: null, 16487 parent: n 16488 }, n ? r(n.key, i.key) < 0 ? n.right = i : n.left = i : this._root = i, this.splay(i), this._size++, i; 16489 } 16490 find(e1) { 16491 for(var t1 = this._root, i = this._compare; t1;){ 16492 var n = i(t1.key, e1); 16493 if (n < 0) t1 = t1.right; 16494 else { 16495 if (!(n > 0)) return t1; 16496 t1 = t1.left; 16497 } 16498 } 16499 return null; 16500 } 16501 contains(e1) { 16502 for(var t1 = this._root, i = this._compare; t1;){ 16503 var n = i(e1, t1.key); 16504 if (0 === n) return !0; 16505 t1 = n < 0 ? t1.left : t1.right; 16506 } 16507 return !1; 16508 } 16509 remove(e1) { 16510 var t1 = this.find(e1); 16511 if (!t1) return !1; 16512 if (this.splay(t1), t1.left) if (t1.right) { 16513 var i = this.minNode(t1.right); 16514 i.parent !== t1 && (this.replace(i, i.right), i.right = t1.right, i.right.parent = i), this.replace(t1, i), i.left = t1.left, i.left.parent = i; 16515 } else this.replace(t1, t1.left); 16516 else this.replace(t1, t1.right); 16517 return this._size--, !0; 16518 } 16519 removeNode(e1) { 16520 if (!e1) return !1; 16521 if (this.splay(e1), e1.left) if (e1.right) { 16522 var t1 = this.minNode(e1.right); 16523 t1.parent !== e1 && (this.replace(t1, t1.right), t1.right = e1.right, t1.right.parent = t1), this.replace(e1, t1), t1.left = e1.left, t1.left.parent = t1; 16524 } else this.replace(e1, e1.left); 16525 else this.replace(e1, e1.right); 16526 return this._size--, !0; 16527 } 16528 erase(e1) { 16529 var t1 = this.find(e1); 16530 if (t1) { 16531 this.splay(t1); 16532 var i = t1.left, n = t1.right, r = null; 16533 i && (i.parent = null, r = this.maxNode(i), this.splay(r), this._root = r), n && (i ? r.right = n : this._root = n, n.parent = r), this._size--; 16534 } 16535 } 16536 pop() { 16537 var e1 = this._root, t1 = null; 16538 if (e1) { 16539 for(; e1.left;)e1 = e1.left; 16540 t1 = { 16541 key: e1.key, 16542 data: e1.data 16543 }, this.remove(e1.key); 16544 } 16545 return t1; 16546 } 16547 next(e1) { 16548 var t1 = e1; 16549 if (t1) if (t1.right) for(t1 = t1.right; t1 && t1.left;)t1 = t1.left;
16550 else for(t1 = e1.parent; t1 && t1.right === e1;)e1 = t1, t1 = t1.parent; 16551 return t1; 16552 } 16553 prev(e1) { 16554 var t1 = e1; 16555 if (t1) if (t1.left) for(t1 = t1.left; t1 && t1.right;)t1 = t1.right; 16556 else for(t1 = e1.parent; t1 && t1.left === e1;)e1 = t1, t1 = t1.parent; 16557 return t1; 16558 } 16559 forEach(e1) { 16560 for(var t1 = this._root, i = [], n = !1, r = 0; !n;)t1 ? (i.push(t1), t1 = t1.left) : i.length > 0 ? (e1(t1 = i.pop(), r++), t1 = t1.right) : n = !0; 16561 return this; 16562 } 16563 range(e1, t1, i, n) { 16564 const r = [], o = this._compare; 16565 let a, s = this._root; 16566 for(; 0 !== r.length || s;)if (s) r.push(s), s = s.left; 16567 else { 16568 if (s = r.pop(), a = o(s.key, t1), a > 0) break; 16569 if (o(s.key, e1) >= 0 && i.call(n, s)) return this; 16570 s = s.right; 16571 } 16572 return this; 16573 } 16574 keys() { 16575 for(var e1 = this._root, t1 = [], i = [], n = !1; !n;)e1 ? (t1.push(e1), e1 = e1.left) : t1.length > 0 ? (e1 = t1.pop(), i.push(e1.key), e1 = e1.right) : n = !0; 16576 return i; 16577 } 16578 values() { 16579 for(var e1 = this._root, t1 = [], i = [], n = !1; !n;)e1 ? (t1.push(e1), e1 = e1.left) : t1.length > 0 ? (e1 = t1.pop(), i.push(e1.data), e1 = e1.right) : n = !0; 16580 return i; 16581 } 16582 at(e1) { 16583 for(var t1 = this._root, i = [], n = !1, r = 0; !n;)if (t1) i.push(t1), t1 = t1.left; 16584 else if (i.length > 0) { 16585 if (t1 = i.pop(), r === e1) return t1; 16586 r++, t1 = t1.right; 16587 } else n = !0; 16588 return null; 16589 } 16590 load() { 16591 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 16592 if (0 !== this._size) throw new Error("bulk-load: tree is not empty"); 16593 const n = e1.length; 16594 return i && A_(e1, t1, 0, n - 1, this._compare), this._root = w_(null, e1, t1, 0, n), this._size = n, this; 16595 } 16596 min() { 16597 var e1 = this.minNode(this._root); 16598 return e1 ? e1.key : null; 16599 } 16600 max() { 16601 var e1 = this.maxNode(this._root); 16602 return e1 ? e1.key : null; 16603 } 16604 isEmpty() { 16605 return null === this._root; 16606 } 16607 get size() { 16608 return this._size; 16609 } 16610 static createTree(e1, t1, i, n, r) { 16611 return new b_(i, r).load(e1, t1, n); 16612 } 16613 constructor(e1 = v_, t1 = !1){ 16614 this._compare = e1, this._root = null, this._size = 0, this._noDuplicates = !!t1; 16615 } 16616 } 16617 function w_(e1, t1, i, n, r) { 16618 const o = r - n; 16619 if (o > 0) { 16620 const a = n + Math.floor(o / 2), s = { 16621 key: t1[a], 16622 data: i[a], 16623 parent: e1 16624 }; 16625 return s.left = w_(s, t1, i, n, a), s.right = w_(s, t1, i, a + 1, r), s; 16626 } 16627 return null; 16628 } 16629 function A_(e1, t1, i, n, r) { 16630 if (i >= n) return; 16631 const o = e1[i + n >> 1]; 16632 let a = i - 1, s = n + 1; 16633 for(;;){ 16634 do { 16635 a++; 16636 }while (r(e1[a], o) < 0) 16637 do { 16638 s--; 16639 }while (r(e1[s], o) > 0) 16640 if (a >= s) break; 16641 let i = e1[a]; 16642 e1[a] = e1[s], e1[s] = i, i = t1[a], t1[a] = t1[s], t1[s] = i; 16643 } 16644 A_(e1, t1, i, s, r), A_(e1, t1, s + 1, n, r); 16645 } 16646 const E_ = 11102230246251565e-32, I_ = 134217729, M_ = (3 + 8 * E_) * E_; 16647 function T_(e1, t1, i, n, r) { 16648 let o, a, s, l, c = t1[0], u = n[0], h = 0, d = 0; 16649 u > c == u > -c ? (o = c, c = t1[++h]) : (o = u, u = n[++d]); 16650 let f = 0; 16651 if (h < e1 && d < i) for(u > c == u > -c ? (a = c + o, s = o - (a - c), c = t1[++h]) : (a = u + o, s = o - (a - u), u = n[++d]), o = a, 0 !== s && (r[f++] = s); h < e1 && d < i;)u > c == u > -c ? (a = o + c, l = a - o, s = o - (a - l) + (c - l), c = t1[++h]) : (a = o + u, l = a - o, s = o - (a - l) + (u - l), u = n[++d]), o = a, 0 !== s && (r[f++] = s); 16652 for(; h < e1;)a = o + c, l = a - o, s = o - (a - l) + (c - l), c = t1[++h], o = a, 0 !== s && (r[f++] = s); 16653 for(; d < i;)a = o + u, l = a - o, s = o - (a - l) + (u - l), u = n[++d], o = a, 0 !== s && (r[f++] = s); 16654 return 0 === o && 0 !== f || (r[f++] = o), f; 16655 } 16656 function S_(e1) { 16657 return new Float64Array(e1); 16658 } 16659 const z_ = S_(4), R_ = S_(8), P_ = S_(12), D_ = S_(16), F_ = S_(4); 16660 function C_(e1, t1, i) { 16661 null === t1 ? (e1.inOut = !1, e1.otherInOut = !0) : (e1.isSubject === t1.isSubject ? (e1.inOut = !t1.inOut, e1.otherInOut = t1.otherInOut) : (e1.inOut = !t1.otherInOut, e1.otherInOut = t1.isVertical() ? !t1.inOut : t1.inOut), t1 && (e1.prevInResult = !L_(t1, i) || t1.isVertical() ? t1.prevInResult : t1)), e1.resultTransition = L_(e1, i) ? function(e1, t1) { 16662 let i, n = !e1.inOut, r = !e1.otherInOut; 16663 switch(t1){ 16664 case 0: 16665 i = n && r; 16666 break; 16667 case 1: 16668 i = n || r; 16669 break; 16670 case 3: 16671 i = n !== r; 16672 break; 16673 case 2: 16674 i = e1.isSubject ? n && !r : r && !n; 16675 } 16676 return i ? 1 : -1; 16677 }(e1, i) : 0; 16678 } 16679 function L_(e1, t1) { 16680 switch(e1.type){ 16681 case 0: 16682 switch(t1){ 16683 case 0: 16684 return !e1.otherInOut; 16685 case 1: 16686 return e1.otherInOut; 16687 case 2: 16688 return e1.isSubject && e1.otherInOut || !e1.isSubject && !e1.otherInOut; 16689 case 3: 16690 return !0; 16691 } 16692 break; 16693 case 2: 16694 return 0 === t1 || 1 === t1; 16695 case 3: 16696 return 2 === t1; 16697 case 1: 16698 return !1; 16699 } 16700 return !1; 16701 } 16702 class O_ { 16703 isBelow(e1) { 16704 const t1 = this.point, i = this.otherEvent.point; 16705 return this.left ? (t1[0] - e1[0]) * (i[1] - e1[1]) - (i[0] - e1[0]) * (t1[1] - e1[1]) > 0 : (i[0] - e1[0]) * (t1[1] - e1[1]) - (t1[0] - e1[0]) * (i[1] - e1[1]) > 0; 16706 } 16707 isAbove(e1) { 16708 return !this.isBelow(e1); 16709 } 16710 isVertical() { 16711 return this.point[0] === this.otherEvent.point[0]; 16712 } 16713 get inResult() { 16714 return 0 !== this.resultTransition; 16715 } 16716 clone() { 16717 const e1 = new O_(this.point, this.left, this.otherEvent, this.isSubject, this.type); 16718 return e1.contourId = this.contourId, e1.resultTransition = this.resultTransition, e1.prevInResult = this.prevInResult, e1.isExteriorRing = this.isExteriorRing, e1.inOut = this.inOut, e1.otherInOut = this.otherInOut, e1; 16719 } 16720 constructor(e1, t1, i, n, r){ 16721 this.left = t1, this.point = e1, this.otherEvent = i, this.isSubject = n !== null && n !== void 0 ? n : !1, this.type = r || 0, this.inOut = !1, this.otherInOut = !1, this.prevInResult = null, this.resultTransition = 0, this.otherPos = -1, this.outputContourId = -1, this.isExteriorRing = !0; 16722 } 16723 } 16724 function B_(e1, t1) {
vendor: 4,297 bytes, lines 16725-16763
16725 return e1[0] === t1[0] && e1[1] === t1[1]; 16726 } 16727 function V_(e1, t1, i) { 16728 const n = function(e1, t1, i, n, r, o) { 16729 const a = (t1 - o) * (i - r), s = (e1 - r) * (n - o), l = a - s; 16730 if (0 === a || 0 === s || a > 0 != s > 0) return l; 16731 const c = Math.abs(a + s); 16732 return Math.abs(l) >= 33306690738754716e-32 * c ? l : -function(e1, t1, i, n, r, o, a) { 16733 let s, l, c, u, h, d, f, p, m, _, g, y, x, v, b, w, A, E; 16734 const I = e1 - r, M = i - r, T = t1 - o, S = n - o; 16735 v = I * S, d = I_ * I, f = d - (d - I), p = I - f, d = I_ * S, m = d - (d - S), _ = S - m, b = p * _ - (v - f * m - p * m - f * _), w = T * M, d = I_ * T, f = d - (d - T), p = T - f, d = I_ * M, m = d - (d - M), _ = M - m, A = p * _ - (w - f * m - p * m - f * _), g = b - A, h = b - g, z_[0] = b - (g + h) + (h - A), y = v + g, h = y - v, x = v - (y - h) + (g - h), g = x - w, h = x - g, z_[1] = x - (g + h) + (h - w), E = y + g, h = E - y, z_[2] = y - (E - h) + (g - h), z_[3] = E; 16736 let z = function(e1, t1) { 16737 let i = t1[0]; 16738 for(let e1 = 1; e1 < 4; e1++)i += t1[e1]; 16739 return i; 16740 }(0, z_), R = 22204460492503146e-32 * a; 16741 if (z >= R || -z >= R) return z; 16742 if (h = e1 - I, s = e1 - (I + h) + (h - r), h = i - M, c = i - (M + h) + (h - r), h = t1 - T, l = t1 - (T + h) + (h - o), h = n - S, u = n - (S + h) + (h - o), 0 === s && 0 === l && 0 === c && 0 === u) return z; 16743 if (R = 11093356479670487e-47 * a + M_ * Math.abs(z), z += I * u + S * s - (T * c + M * l), z >= R || -z >= R) return z; 16744 v = s * S, d = I_ * s, f = d - (d - s), p = s - f, d = I_ * S, m = d - (d - S), _ = S - m, b = p * _ - (v - f * m - p * m - f * _), w = l * M, d = I_ * l, f = d - (d - l), p = l - f, d = I_ * M, m = d - (d - M), _ = M - m, A = p * _ - (w - f * m - p * m - f * _), g = b - A, h = b - g, F_[0] = b - (g + h) + (h - A), y = v + g, h = y - v, x = v - (y - h) + (g - h), g = x - w, h = x - g, F_[1] = x - (g + h) + (h - w), E = y + g, h = E - y, F_[2] = y - (E - h) + (g - h), F_[3] = E; 16745 const P = T_(4, z_, 4, F_, R_); 16746 v = I * u, d = I_ * I, f = d - (d - I), p = I - f, d = I_ * u, m = d - (d - u), _ = u - m, b = p * _ - (v - f * m - p * m - f * _), w = T * c, d = I_ * T, f = d - (d - T), p = T - f, d = I_ * c, m = d - (d - c), _ = c - m, A = p * _ - (w - f * m - p * m - f * _), g = b - A, h = b - g, F_[0] = b - (g + h) + (h - A), y = v + g, h = y - v, x = v - (y - h) + (g - h), g = x - w, h = x - g, F_[1] = x - (g + h) + (h - w), E = y + g, h = E - y, F_[2] = y - (E - h) + (g - h), F_[3] = E; 16747 const D = T_(P, R_, 4, F_, P_); 16748 v = s * u, d = I_ * s, f = d - (d - s), p = s - f, d = I_ * u, m = d - (d - u), _ = u - m, b = p * _ - (v - f * m - p * m - f * _), w = l * c, d = I_ * l, f = d - (d - l), p = l - f, d = I_ * c, m = d - (d - c), _ = c - m, A = p * _ - (w - f * m - p * m - f * _), g = b - A, h = b - g, F_[0] = b - (g + h) + (h - A), y = v + g, h = y - v, x = v - (y - h) + (g - h), g = x - w, h = x - g, F_[1] = x - (g + h) + (h - w), E = y + g, h = E - y, F_[2] = y - (E - h) + (g - h), F_[3] = E; 16749 const F = T_(D, P_, 4, F_, D_); 16750 return D_[F - 1]; 16751 }(e1, t1, i, n, r, o, c); 16752 }(e1[0], e1[1], t1[0], t1[1], i[0], i[1]); 16753 return n > 0 ? -1 : n < 0 ? 1 : 0; 16754 } 16755 function N_(e1, t1) { 16756 const i = e1.point, n = t1.point; 16757 return i[0] > n[0] ? 1 : i[0] < n[0] ? -1 : i[1] !== n[1] ? i[1] > n[1] ? 1 : -1 : function(e1, t1, i) { 16758 return e1.left !== t1.left ? e1.left ? 1 : -1 : 0 !== V_(i, e1.otherEvent.point, t1.otherEvent.point) ? e1.isBelow(t1.otherEvent.point) ? -1 : 1 : !e1.isSubject && t1.isSubject ? 1 : -1; 16759 }(e1, t1, i); 16760 } 16761 function k_(e1, t1, i) { 16762 const n = new O_(t1, !1, e1, e1.isSubject), r = new O_(t1, !0, e1.otherEvent, e1.isSubject); 16763 return B_(e1.point, e1.otherEvent.point) && console.warn("what is that, a collapsed
vendor: 11,184 bytes, lines 16763-16974
16763segment?", e1), n.contourId = r.contourId = e1.contourId, N_(r, e1.otherEvent) > 0 && (e1.otherEvent.left = !0, r.left = !1), e1.otherEvent.otherEvent = r, e1.otherEvent = n, i.push(r), i.push(n), i; 16764 } 16765 function U_(e1, t1) { 16766 return e1[0] * t1[1] - e1[1] * t1[0]; 16767 } 16768 function j_(e1, t1) { 16769 return e1[0] * t1[0] + e1[1] * t1[1]; 16770 } 16771 function G_(e1, t1, i) { 16772 const n = function(e1, t1, i, n) { 16773 const r = [ 16774 t1[0] - e1[0], 16775 t1[1] - e1[1] 16776 ], o = [ 16777 n[0] - i[0], 16778 n[1] - i[1] 16779 ]; 16780 function a(e1, t1, i) { 16781 return [ 16782 e1[0] + t1 * i[0], 16783 e1[1] + t1 * i[1] 16784 ]; 16785 } 16786 const s = [ 16787 i[0] - e1[0], 16788 i[1] - e1[1] 16789 ]; 16790 let l = U_(r, o), c = l * l; 16791 const u = j_(r, r); 16792 if (c > 0) { 16793 const t1 = U_(s, o) / l; 16794 if (t1 < 0 || t1 > 1) return null; 16795 const n = U_(s, r) / l; 16796 return n < 0 || n > 1 ? null : 0 === t1 || 1 === t1 ? [ 16797 a(e1, t1, r) 16798 ] : 0 === n || 1 === n ? [ 16799 a(i, n, o) 16800 ] : [ 16801 a(e1, t1, r) 16802 ]; 16803 } 16804 if (l = U_(s, r), c = l * l, c > 0) return null; 16805 const h = j_(r, s) / u, d = h + j_(r, o) / u, f = Math.min(h, d), p = Math.max(h, d); 16806 return f <= 1 && p >= 0 ? 1 === f ? [ 16807 a(e1, f > 0 ? f : 0, r) 16808 ] : 0 === p ? [ 16809 a(e1, p < 1 ? p : 1, r) 16810 ] : [ 16811 a(e1, f > 0 ? f : 0, r), 16812 a(e1, p < 1 ? p : 1, r) 16813 ] : null; 16814 }(e1.point, e1.otherEvent.point, t1.point, t1.otherEvent.point), r = n ? n.length : 0; 16815 if (0 === r || 1 === r && (B_(e1.point, t1.point) || B_(e1.otherEvent.point, t1.otherEvent.point)) || 2 === r && e1.isSubject === t1.isSubject) return 0; 16816 if (1 === r) return !B_(e1.point, n[0]) && !B_(e1.otherEvent.point, n[0]) && k_(e1, n[0], i), !B_(t1.point, n[0]) && !B_(t1.otherEvent.point, n[0]) && k_(t1, n[0], i), 1; 16817 const o = []; 16818 let a = !1, s = !1; 16819 return B_(e1.point, t1.point) ? a = !0 : 1 === N_(e1, t1) ? o.push(t1, e1) : o.push(e1, t1), B_(e1.otherEvent.point, t1.otherEvent.point) ? s = !0 : 1 === N_(e1.otherEvent, t1.otherEvent) ? o.push(t1.otherEvent, e1.otherEvent) : o.push(e1.otherEvent, t1.otherEvent), a && s || a ? (t1.type = 1, e1.type = t1.inOut === e1.inOut ? 2 : 3, a && !s && k_(o[1].otherEvent, o[0].point, i), 2) : s ? (k_(o[0], o[1].point, i), 3) : o[0] !== o[3].otherEvent ? (k_(o[0], o[1].point, i), k_(o[1], o[2].point, i), 3) : (k_(o[0], o[1].point, i), k_(o[3].otherEvent, o[2].point, i), 3); 16820 } 16821 function H_(e1, t1) { 16822 if (e1 === t1) return 0; 16823 if (0 !== V_(e1.point, e1.otherEvent.point, t1.point) || 0 !== V_(e1.point, e1.otherEvent.point, t1.otherEvent.point)) return B_(e1.point, t1.point) ? e1.isBelow(t1.otherEvent.point) ? -1 : 1 : e1.point[0] === t1.point[0] ? e1.point[1] < t1.point[1] ? -1 : 1 : 1 === N_(e1, t1) ? t1.isAbove(e1.point) ? -1 : 1 : e1.isBelow(t1.point) ? -1 : 1; 16824 if (e1.isSubject !== t1.isSubject) return e1.isSubject ? -1 : 1; 16825 { 16826 var _e_contourId, _t_contourId; 16827 let i = e1.point, n = t1.point; 16828 if (i[0] === n[0] && i[1] === n[1]) return i = e1.otherEvent.point, n = t1.otherEvent.point, i[0] === n[0] && i[1] === n[1] ? 0 : ((_e_contourId = e1.contourId) !== null && _e_contourId !== void 0 ? _e_contourId : 0) > ((_t_contourId = t1.contourId) !== null && _t_contourId !== void 0 ? _t_contourId : 0) ? 1 : -1; 16829 } 16830 return 1 === N_(e1, t1) ? 1 : -1; 16831 } 16832 class $_ { 16833 isExterior() { 16834 return null == this.holeOf; 16835 } 16836 constructor(){ 16837 this.points = [], this.holeIds = [], this.holeOf = null, this.depth = null; 16838 } 16839 } 16840 function Z_(e1, t1, i, n) { 16841 let r, o = e1 + 1, a = t1[e1].point; 16842 const s = t1.length; 16843 for(o < s && (r = t1[o].point); o < s && r[0] === a[0] && r[1] === a[1];){ 16844 if (!i[o]) return o; 16845 o++, o < s && (r = t1[o].point); 16846 } 16847 for(o = e1 - 1; i[o] && o > n;)o--; 16848 return o; 16849 } 16850 function W_(e1, t1, i) { 16851 const n = new $_; 16852 if (null != e1.prevInResult) { 16853 const r = e1.prevInResult, o = r.outputContourId; 16854 if (r.resultTransition > 0) { 16855 const e1 = t1[o]; 16856 if (null != e1.holeOf) { 16857 const r = e1.holeOf; 16858 t1[r].holeIds.push(i), n.holeOf = r, n.depth = t1[o].depth; 16859 } else t1[o].holeIds.push(i), n.holeOf = o, n.depth = t1[o].depth + 1; 16860 } else n.holeOf = null, n.depth = t1[o].depth; 16861 } else n.holeOf = null, n.depth = 0; 16862 return n; 16863 } 16864 const q_ = Math.max, X_ = Math.min; 16865 let Y_ = 0; 16866 function J_(e1, t1, i, n, r, o) { 16867 let a, s, l, c, u, h; 16868 for(a = 0, s = e1.length - 1; a < s; a++){ 16869 if (l = e1[a], c = e1[a + 1], u = new O_(l, !1, void 0, t1), h = new O_(c, !1, u, t1), u.otherEvent = h, l[0] === c[0] && l[1] === c[1]) continue; 16870 u.contourId = h.contourId = i, o || (u.isExteriorRing = !1, h.isExteriorRing = !1), N_(u, h) > 0 ? h.left = !0 : u.left = !0; 16871 const s = l[0], d = l[1]; 16872 r[0] = X_(r[0], s), r[1] = X_(r[1], d), r[2] = q_(r[2], s), r[3] = q_(r[3], d), n.push(u), n.push(h); 16873 } 16874 } 16875 const K_ = []; 16876 function Q_(e1, t1, i) { 16877 let n = e1, r = t1; 16878 "number" == typeof e1[0][0][0] && (n = [ 16879 e1 16880 ]), "number" == typeof t1[0][0][0] && (r = [ 16881 t1 16882 ]); 16883 let o = function(e1, t1, i) { 16884 let n = null; 16885 return e1.length * t1.length === 0 && (0 === i ? n = K_ : 2 === i ? n = e1 : (1 === i || 3 === i) && (n = 0 === e1.length ? t1 : e1)), n; 16886 }(n, r, i); 16887 if (o) return o === K_ ? null : o; 16888 const a = [ 16889 1 / 0, 16890 1 / 0, 16891 -1 / 0, 16892 -1 / 0 16893 ], s = [ 16894 1 / 0, 16895 1 / 0, 16896 -1 / 0, 16897 -1 / 0 16898 ], l = function(e1, t1, i, n, r) { 16899 const o = new Sr(void 0, N_); 16900 let a, s, l, c, u, h; 16901 for(l = 0, c = e1.length; l < c; l++)for(a = e1[l], u = 0, h = a.length; u < h; u++)s = 0 === u, s && Y_++, J_(a[u], !0, Y_, o, i, s); 16902 for(l = 0, c = t1.length; l < c; l++)for(a = t1[l], u = 0, h = a.length; u < h; u++)s = 0 === u, 2 === r && (s = !1), s && Y_++, J_(a[u], !1, Y_, o, n, s); 16903 return o; 16904 }(n, r, a, s, i); 16905 if (o = function(e1, t1, i, n, r) { 16906 let o = null; 16907 return (i[0] > n[2] || n[0] > i[2] || i[1] > n[3] || n[1] > i[3]) && (0 === r ? o = K_ : 2 === r ? o = e1 : (1 === r || 3 === r) && (o = e1.concat(t1))), o; 16908 }(n, r, a, s, i), o) return o === K_ ? null : o; 16909 const c = function(e1, t1, i, n, r, o) { 16910 const a = new b_(H_), s = [], l = Math.min(n[2], r[2]); 16911 let c, u, h; 16912 for(; 0 !== e1.length;){ 16913 let t1 = e1.pop(); 16914 if (s.push(t1), 0 === o && t1.point[0] > l || 2 === o && t1.point[0] > n[2]) break; 16915 if (t1.left) { 16916 u = c = a.insert(t1), h = a.minNode(), c = c !== h ? a.prev(c) : null, u = a.next(u); 16917 const i = c ? c.key : null; 16918 let n; 16919 if (C_(t1, i, o), u && 2 === G_(t1, u.key, e1) && (C_(t1, i, o), C_(u.key, t1, o)), c && 2 === G_(c.key, t1, e1)) { 16920 let e1 = c; 16921 e1 = e1 !== h ? a.prev(e1) : null, n = e1 ? e1.key : null, C_(i, n, o), C_(t1, i, o); 16922 } 16923 } else t1 = t1.otherEvent, u = c = a.find(t1), c && u && (c = c !== h ? a.prev(c) : null, u = a.next(u), a.remove(t1), u && c && G_(c.key, u.key, e1)); 16924 } 16925 return s; 16926 }(l, 0, 0, a, s, i), u = function(e1) { 16927 let t1, i; 16928 const n = function(e1) { 16929 let t1, i, n, r, o; 16930 const a = []; 16931 for(i = 0, n = e1.length; i < n; i++)t1 = e1[i], (t1.left && t1.inResult || !t1.left && t1.otherEvent.inResult) && a.push(t1); 16932 let s = !1; 16933 for(; !s;)for(s = !0, i = 0, n = a.length; i < n; i++)i + 1 < n && 1 === N_(a[i], a[i + 1]) && (r = a[i], a[i] = a[i + 1], a[i + 1] = r, s = !1); 16934 for(i = 0, n = a.length; i < n; i++)t1 = a[i], t1.otherPos = i; 16935 for(i = 0, n = a.length; i < n; i++)t1 = a[i], t1.left || (o = t1.otherPos, t1.otherPos = t1.otherEvent.otherPos, t1.otherEvent.otherPos = o); 16936 return a; 16937 }(e1), r = {}, o = []; 16938 for(t1 = 0, i = n.length; t1 < i; t1++){ 16939 if (r[t1]) continue; 16940 const e1 = o.length, i = W_(n[t1], o, e1), a = (t1)=>{ 16941 r[t1] = !0, t1 < n.length && n[t1] && (n[t1].outputContourId = e1); 16942 }; 16943 let s = t1, l = t1; 16944 for(i.points.push(n[t1].point); a(s), s = n[s].otherPos, a(s), i.points.push(n[s].point), s = Z_(s, n, r, l), !(s == l || s >= n.length) && n[s];); 16945 o.push(i); 16946 } 16947 return o; 16948 }(c), h = []; 16949 for(let e1 = 0; e1 < u.length; e1++){ 16950 let t1 = u[e1]; 16951 if (t1.isExterior()) { 16952 let e1 = [ 16953 t1.points 16954 ]; 16955 for(let i = 0; i < t1.holeIds.length; i++)e1.push(u[t1.holeIds[i]].points); 16956 h.push(e1); 16957 } 16958 } 16959 return h; 16960 } 16961 function eg(e1, t1) { 16962 const i = Q_(ig(e1), ig([ 16963 t1 16964 ]), 0); 16965 return null == i ? [] : og(i); 16966 } 16967 function tg(e1, t1) { 16968 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; 16969 const n = 65536; 16970 let r = ig(e1, n); 16971 const o = []; 16972 for(; t1.valid(); t1.next()){ 16973 const [e1, r] = t1.get(); 16974 let a = e1.x * n, s = e1.y * n, l = r.x * n, c = r.y *
16974n; 16975 const u = l - a, h = c - s, d = Math.hypot(u, h); 16976 if (0 === d) continue; 16977 a -= u * i, s -= h * i, l += u * i, c += h * i; 16978 const f = Math.trunc(h / d * 3), p = -Math.trunc(u / d * 3); 16979 o.push([ 16980 [ 16981 [ 16982 a, 16983 s 16984 ], 16985 [ 16986 l, 16987 c 16988 ], 16989 [ 16990 l + f, 16991 c + p 16992 ], 16993 [ 16994 a + f, 16995 s + p 16996 ], 16997 [ 16998 a, 16999 s 17000 ] 17001 ] 17002 ]); 17003 } 17004 return o.length > 0 && (r = Q_(r, o, 2)), og(r, 1 / n, .001); 17005 } 17006 function ig(e1) { 17007 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1; 17008 return [ 17009 e1.map((e1)=>e1.map((e1)=>[ 17010 e1.x * t1, 17011 e1.y * t1 17012 ])) 17013 ]; 17014 } 17015 function ng(e1, t1) { 17016 const i = Math.floor(e1) + .5; 17017 return Math.abs(e1 - i) <= t1 ? Math.round(i) : Math.round(e1); 17018 } 17019 class rg { 17020 canonicalize(e1, t1) { 17021 const i = this.tolerance, n = Math.floor(e1 / i), r = Math.floor(t1 / i); 17022 for(let o = -1; o <= 1; o++){ 17023 const a = this.buckets.get(n + o); 17024 if (a) for(let o = -1; o <= 1; o++){ 17025 const s = a.get(r + o); 17026 if (s) { 17027 for (const o of s)if (Math.abs(this.xs[o] - e1) <= i && Math.abs(this.ys[o] - t1) <= i) { 17028 const i = this.ixs[o], a = this.iys[o]; 17029 return this.xs[o] === e1 && this.ys[o] === t1 || this.store(e1, t1, i, a, n, r), [ 17030 i, 17031 a 17032 ]; 17033 } 17034 } 17035 } 17036 } 17037 const o = ng(e1, i), a = ng(t1, i); 17038 return this.store(e1, t1, o, a, n, r), [ 17039 o, 17040 a 17041 ]; 17042 } 17043 store(e1, t1, i, n, r, o) { 17044 const a = this.xs.length; 17045 this.xs.push(e1), this.ys.push(t1), this.ixs.push(i), this.iys.push(n); 17046 let s = this.buckets.get(r); 17047 s || (s = new Map, this.buckets.set(r, s)); 17048 let l = s.get(o); 17049 l || (l = [], s.set(o, l)), l.push(a); 17050 } 17051 constructor(e1){ 17052 this.xs = [], this.ys = [], this.ixs = [], this.iys = [], this.buckets = new Map, this.tolerance = e1; 17053 } 17054 } 17055 function og(e1) { 17056 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1, i = arguments.length > 2 ? arguments[2] : void 0; 17057 const n = null != i ? new rg(i) : null; 17058 return e1.map((e1)=>e1.map((e1, i)=>{ 17059 const r = e1.map((e1)=>{ 17060 const i = e1[0] * t1, r = e1[1] * t1; 17061 if (n) { 17062 const [e1, t1] = n.canonicalize(i, r); 17063 return new Pe(e1, t1); 17064 } 17065 return new Pe(Math.round(i), Math.round(r)); 17066 }); 17067 return i > 0 && r.reverse(), r; 17068 })); 17069 } 17070 class ag { 17071 empty() { 17072 return 0 === this.frcCoverage.size; 17073 } 17074 constructor(){ 17075 this.frcCoverage = new Set, this.featureTriSegments = [], this.frcPerLevel = new Map, this.frcNonRoadSegments = new ju; 17076 } 17077 } 17078 function sg(e1, t1, i) { 17079 if (0 === e1.frcCoverage.size || 0 === e1.featureTriSegments.length) return; 17080 const n = i.get(), r = t1.uint16, o = []; 17081 e1.featureTriSegments.sort((e1, t1)=>e1.segIdx !== t1.segIdx ? e1.segIdx - t1.segIdx : null === e1.frc && null === t1.frc ? 0 : null === e1.frc ? -1 : null === t1.frc ? 1 : t1.frc - e1.frc); 17082 const a = new Map; 17083 let s = 0, l = e1.featureTriSegments[0].frc, c = { 17084 vertexOffset: n[s].vertexOffset, 17085 primitiveOffset: 0, 17086 vertexLength: n[s].vertexLength, 17087 primitiveLength: 0, 17088 vaos: {}, 17089 sortKey: void 0 17090 }; 17091 const u = ()=>{ 17092 c.primitiveLength > 0 && (a.has(l) || a.set(l, []), a.get(l).push({ 17093 ...c 17094 })); 17095 }; 17096 for (const t1 of e1.featureTriSegments){ 17097 t1.segIdx !== s && (u(), s = t1.segIdx, l = t1.frc, c = { 17098 vertexOffset: n[s].vertexOffset, 17099 primitiveOffset: o.length / 3, 17100 vertexLength: n[s].vertexLength, 17101 primitiveLength: 0, 17102 vaos: {}, 17103 sortKey: void 0 17104 }), t1.frc !== l && (u(), l = t1.frc, c = { 17105 ...c, 17106 primitiveOffset: o.length / 3, 17107 primitiveLength: 0 17108 }); 17109 for(let e1 = t1.start; e1 < t1.end; e1++)o.push(r[e1]); 17110 c.primitiveLength += (t1.end - t1.start) / 3; 17111 } 17112 u(); 17113 for(let e1 = 0; e1 < o.length; e1++)r[e1] = o[e1]; 17114 for (const [t1, i] of a)null !== t1 ? e1.frcPerLevel.set(t1, new ju(i)) : e1.frcNonRoadSegments = new ju(i); 17115 e1.featureTriSegments = []; 17116 } 17117 Xa(ag, "FrcSegmentData"); 17118 const lg = { 17119 motorway: 0, 17120 motorway_link: 0, 17121 trunk: 1, 17122 trunk_link: 1, 17123 primary: 2, 17124 primary_link: 2, 17125 secondary: 3, 17126 secondary_link: 3, 17127 tertiary: 4, 17128 tertiary_link: 4, 17129 unclassified: 5, 17130 unclassified_link: 5, 17131 street: 6, 17132 street_limited: 6, 17133 residential: 6, 17134 service: 7, 17135 living_street: 7, 17136 pedestrian: 8, 17137 track: 8, 17138 path: 8, 17139 footway: 8, 17140 cycleway: 8, 17141 sidewalk: 8, 17142 crossing: 8 17143 }; 17144 function cg(e1) { 17145 for (const t1 of [ 17146 "class", 17147 "incident_class" 17148 ]){ 17149 const i = e1[t1]; 17150 if ("string" != typeof i) continue; 17151 const n = lg[i]; 17152 if (void 0 !== n) return n; 17153 } 17154 return null; 17155 } 17156 function ug(e1, t1, i) { 17157 for (const n of e1)if (n.startsWith("(")) { 17158 const e1 = n.indexOf(")"); 17159 if (-1 === e1) continue; 17160 if (n.slice(1, e1) === t1 && n.slice(e1 + 1) === i) return !0; 17161 } else if (n === i) return !0; 17162 return !1; 17163 } 17164 class hg { 17165 isEmpty() { 17166 const e1 = !this.elevationBufferData || this.elevationBufferData.isEmpty(), t1 = !this.frcData || this.frcData.empty(); 17167 return e1 && t1; 17168 } 17169 needsUpload() { 17170 return !!this.elevationBufferData && this.elevationBufferData.needsUpload(); 17171 } 17172 trackFeatureFrc(e1) { 17173 if (!this.frcData) return null; 17174 const t1 = cg(e1 || {}); 17175 return null !== t1 && this.frcData.frcCoverage.add(t1), t1; 17176 } 17177 recordFeatureRange(e1, t1, i, n) { 17178 if (!this.frcData || i <= t1) return;
vendor: 4,808 bytes, lines 17179-17262
17179 const r = e1.bufferData.triangleSegments.get(); 17180 this.frcData.featureTriSegments.push({ 17181 start: 3 * t1, 17182 end: 3 * i, 17183 segIdx: r.length > 0 ? r.length - 1 : 0, 17184 frc: n 17185 }); 17186 } 17187 buildFrcSegments(e1) { 17188 this.frcData && !this.frcData.empty() && sg(this.frcData, e1.bufferData.indexArray, e1.bufferData.triangleSegments); 17189 } 17190 handleFeature(e1, t1, i, n, r, o) { 17191 const a = new Array; 17192 if (!this.elevationMode) return !1; 17193 const s = x_(e1, r, void 0, n); 17194 if (!s) return !1; 17195 { 17196 const e1 = this.clipPolygonsToTile(t1, 1); 17197 e1.length > 0 && a.push({ 17198 polygons: e1, 17199 elevationFeature: s.feature, 17200 elevationTileID: s.tileId 17201 }); 17202 } 17203 const l = { 17204 guardRailEnabled: o.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e1, {}, n), 17205 featureIndex: i 17206 }; 17207 for (const t1 of a)if (t1.elevationFeature) { 17208 if ("hd-road-base" === this.elevationMode) { 17209 this.elevatedStructures || (this.elevatedStructures = new n_(t1.elevationTileID, o.layers, o.zoom, o.lut)); 17210 const i = t1.elevationFeature.isTunnel(); 17211 let n = 0; 17212 Object.hasOwn(e1.properties, pd) && (n = +e1.properties[pd]), this.elevatedStructures.addPortalCandidates(t1.elevationFeature.id, t1.polygons, i, t1.elevationFeature, n); 17213 } 17214 null == t1.elevationFeature.constantHeight && (t1.polygons = this.prepareElevatedPolygons(t1.polygons, t1.elevationFeature, t1.elevationTileID)); 17215 const r = new __(n, t1.elevationTileID); 17216 this.addElevatedGeometry(o, t1.polygons, r, t1.elevationFeature, "hd-road-base" === this.elevationMode ? 0 : .05, i, l); 17217 } 17218 return !0; 17219 } 17220 populatePaintArrays(e1, t1, i, n, r, o, a) { 17221 this.elevationBufferData && this.elevationBufferData.populatePaintArrays(e1, t1, i, n, r, o, a); 17222 } 17223 update(e1, t1, i, n, r, o, a, s) { 17224 this.elevationBufferData && this.elevationBufferData.update(e1, t1, i, n, r, o, a, s), this.elevatedStructures && this.elevatedStructures.update(e1, t1, i, n, r, o, a, s); 17225 } 17226 updateExpressions(e1) { 17227 this.elevationBufferData && this.elevationBufferData.programConfigurations.updateExpressions(e1), this.elevatedStructures && (this.elevatedStructures.bridgeProgramConfigurations.updateExpressions(e1), this.elevatedStructures.tunnelProgramConfigurations.updateExpressions(e1)); 17228 } 17229 upload(e1) { 17230 this.elevationBufferData && this.elevationBufferData.upload(e1), this.elevatedStructures && this.elevatedStructures.upload(e1); 17231 } 17232 destroy() { 17233 this.elevationBufferData && this.elevationBufferData.destroy(), this.elevatedStructures && this.elevatedStructures.destroy(); 17234 } 17235 getUnevaluatedPortalGraph() { 17236 return this.elevatedStructures ? this.elevatedStructures.unevaluatedPortals : void 0; 17237 } 17238 setEvaluatedPortalGraph(e1, t1, i, n, r, o) { 17239 this.elevatedStructures && (this.elevatedStructures.construct(e1), this.elevatedStructures.populatePaintArrays(t1, i, n, r, o)); 17240 } 17241 addElevatedGeometry(e1, t1, i, n, r, o, a) { 17242 const s = { 17243 elevation: n, 17244 elevationSampler: i, 17245 bias: r, 17246 index: o, 17247 featureInfo: a 17248 }, [l, c] = e1.addGeometry(t1, this.elevationBufferData, s, this.elevatedStructures); 17249 null == this.elevationBufferData.heightRange ? this.elevationBufferData.heightRange = { 17250 min: l, 17251 max: c 17252 } : (this.elevationBufferData.heightRange.min = Math.min(this.elevationBufferData.heightRange.min, l), this.elevationBufferData.heightRange.max = Math.max(this.elevationBufferData.heightRange.max, c)); 17253 } 17254 prepareElevatedPolygons(e1, t1, i) { 17255 const n = 1 / Ic(i), r = []; 17256 for (const i of e1){ 17257 const e1 = tg(i, new p_(t1, n), .1); 17258 r.push(...e1); 17259 } 17260 return r; 17261 } 17262 clipPolygonsToTile(e1, t1) {
17263 const i = -t1, n = -t1, r = zr + t1, o = zr + t1; 17264 let a = 0; 17265 const s = [], l = []; 17266 for(; a < e1.length; a++){ 17267 const t1 = e1[a], c = We(t1); 17268 (c.min.x >= i && c.max.x <= r && c.min.y >= n && c.max.y <= o ? s : l).push(t1); 17269 } 17270 if (s.length === e1.length) return e1; 17271 const c = [ 17272 new Pe(i, n), 17273 new Pe(r, n), 17274 new Pe(r, o), 17275 new Pe(i, o), 17276 new Pe(i, n) 17277 ], u = s; 17278 for (const e1 of l)u.push(...eg(e1, c)); 17279 return u; 17280 } 17281 constructor(e1, t1, i){ 17282 this.elevationMode = t1, t1 && (this.elevationBufferData = new e_(e1.layers, e1.zoom, e1.lut)), i && (this.frcData = new ag); 17283 } 17284 } 17285 function dg(e1, t1) { 17286 return e1.nextPoint.sub(t1.at(-2)).unit(); 17287 } 17288 function fg(e1, t1) { 17289 return t1[1].sub(e1.prevPoint).unit(); 17290 } 17291 Xa(hg, "FillHDExtension"), Xa(n_, "ElevatedStructures"); 17292 class pg { 17293 isEmpty() { 17294 const e1 = !this.elevationEnabled || void 0 === this.heightRange, t1 = !this.frcData || this.frcData.empty(); 17295 return e1 && t1; 17296 } 17297 trackFeatureFrc(e1) { 17298 if (!this.frcData) return null; 17299 const t1 = cg(e1 || {}); 17300 return null !== t1 && this.frcData.frcCoverage.add(t1), t1; 17301 } 17302 recordFeatureRange(e1, t1, i, n) { 17303 if (!this.frcData || i <= t1) return; 17304 const r = e1.segments.get(); 17305 this.frcData.featureTriSegments.push({ 17306 start: 3 * t1, 17307 end: 3 * i, 17308 segIdx: r.length > 0 ? r.length - 1 : 0, 17309 frc: n 17310 }); 17311 } 17312 buildFrcSegments(e1) { 17313 this.frcData && !this.frcData.empty() && sg(this.frcData, e1.indexArray, e1.segments); 17314 }
vendor: 30,967 bytes, lines 17315-17837
17315 handleFeature(e1, t1, i, n, r, o, a, s, l, c, u) { 17316 if (!this.elevationEnabled) return !1; 17317 if (!u.terrainEnabled) { 17318 const h = x_(e1, n, r ? r.registry : void 0, i), d = null != e1.properties && Object.hasOwn(e1.properties, fd) && !Number.isNaN(+e1.properties[fd]); 17319 if (!h && d && o && (!r || !r.allProvidersReady)) return this.hasDeferredElevationFeatures = !0, !0; 17320 if (h) { 17321 let n = h.feature, o = h.tileId; 17322 if (!h.tileId.equals(i)) { 17323 const t1 = this.mergedFeatureCache ? this.mergedFeatureCache.get(n.id) : void 0; 17324 if (t1) n = t1, o = i; 17325 else { 17326 const t1 = function(e1, t1, i) { 17327 if (!e1.properties || !t1 || 0 === t1.length) return []; 17328 const n = +e1.properties[fd]; 17329 if (Number.isNaN(n)) return []; 17330 const r = y_(t1, n); 17331 if (r < 0) return []; 17332 const o = []; 17333 for(let e1 = r; e1 < t1.length && t1[e1].feature.id === n; e1++){ 17334 const n = t1[e1]; 17335 (n.tileId.isChildOf(i) || i.isChildOf(n.tileId) || null != n.feature.constantHeight) && o.push(n); 17336 } 17337 return o; 17338 }(e1, r ? r.registry : void 0, i); 17339 t1.length > 1 && (n = function(e1, t1) { 17340 const i = t1.slice().sort((e1, t1)=>t1.tileId.z - e1.tileId.z), n = new Pe(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY), r = new Pe(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY), o = []; 17341 for (const t1 of i){ 17342 const i = new __(t1.tileId, e1); 17343 for (const e1 of t1.feature.vertices)o.push({ 17344 position: i.pointTransform(e1.position), 17345 height: e1.height, 17346 extent: e1.extent, 17347 index: e1.index 17348 }); 17349 const a = t1.feature.safeArea; 17350 u_[0] = a.min.x, u_[1] = a.min.y, h_[0] = a.max.x, h_[1] = a.max.y, i.pointTransformInPlace(u_), i.pointTransformInPlace(h_), n.x = Math.min(n.x, u_[0], h_[0]), n.y = Math.min(n.y, u_[1], h_[1]), r.x = Math.max(r.x, u_[0], h_[0]), r.y = Math.max(r.y, u_[1], h_[1]); 17351 } 17352 const a = { 17353 min: n, 17354 max: r 17355 }; 17356 if (null != i[0].feature.constantHeight) return new m_(i[0].feature.id, a, i[0].feature.constantHeight); 17357 o.sort((e1, t1)=>e1.index - t1.index); 17358 const s = []; 17359 for (const e1 of o)0 !== s.length && s.at(-1).index === e1.index || s.push(e1); 17360 const l = []; 17361 for(let e1 = 1; e1 < s.length; e1++)s[e1].index - s[e1 - 1].index <= 1 && l.push({ 17362 a: e1 - 1, 17363 b: e1 17364 }); 17365 const c = 1 / Ic(e1); 17366 return new m_(i[0].feature.id, a, void 0, s, l, c); 17367 }(i, t1), o = i, this.mergedFeatureCache || (this.mergedFeatureCache = new Map), this.mergedFeatureCache.set(n.id, n)); 17368 } 17369 } 17370 const d = nd(t1, -1, -1, 8193, 8193), f = this.prepareElevatedLines(d, n, o, i); 17371 for (const t1 of f){ 17372 const r = u.layoutVertexArray.length; 17373 u.addLine(t1, e1, i, a, s, l, c); 17374 const h = new __(i, o), d = u.showElevationIdDebug ? g_(n.id) : null; 17375 for(let e1 = r; e1 < u.layoutVertexArray.length; e1++){ 17376 const t1 = new Pe(u.layoutVertexArray.int16[6 * e1] >> 1, u.layoutVertexArray.int16[6 * e1 + 1] >> 1), i = h.pointElevation(t1, n, .05); 17377 this.updateHeightRange(i), e1 < u.zOffsetVertexArray.length ? u.zOffsetVertexArray.float32[4 * e1] = i : u.zOffsetVertexArray.emplaceBack(i, 0, 0, 0), d ? e1 < u.elevationIdColVertexArray.length ? (u.elevationIdColVertexArray.float32[3 * e1] = d[0], u.elevationIdColVertexArray.float32[3 * e1 + 1] = d[1], u.elevationIdColVertexArray.float32[3 * e1 + 2] = d[2]) : u.elevationIdColVertexArray.emplaceBack(d[0], d[1], d[2]) : u.showElevationIdDebug && (e1 < u.elevationIdColVertexArray.length ? (u.elevationIdColVertexArray.float32[3 * e1] = 0, u.elevationIdColVertexArray.float32[3 * e1 + 1] = 0, u.elevationIdColVertexArray.float32[3 * e1 + 2] = 0) : u.elevationIdColVertexArray.emplaceBack(0, 0, 0)); 17378 } 17379 } 17380 return !0; 17381 } 17382 if (d && o && r && r.allProvidersReady && r.hasCoveringTile) return !0; 17383 } 17384 const h = !(!e1.properties || !Object.hasOwn(e1.properties, "mapbox_line_metrics")) && e1.properties.mapbox_line_metrics, d = u.layoutVertexArray.length, f = [], p = nd(t1, -1, -1, 8193, 8193, f); 17385 for(let t1 = 0; t1 < p.length; t1++){ 17386 const n = p[t1], r = f[t1], o = { 17387 progress: { 17388 min: r.progress.min, 17389 max: r.progress.max 17390 }, 17391 nextDir: dg(r, n), 17392 prevDir: fg(r, n) 17393 }; 17394 u.addLine(n, e1, i, a, s, l, c, o, h && r.parentIndex > 0 ? r.parentIndex : null); 17395 } 17396 return u.fillNonElevatedRoadSegment(d), !0; 17397 } 17398 prepareElevatedLines(e1, t1, i, n) { 17399 if (null != t1.constantHeight) return e1; 17400 const r = [], o = 1 / Ic(n), a = i.equals(n) ? null : new __(i, n); 17401 for (const i of e1)rd(i, new p_(t1, o, a), 0, r); 17402 return r; 17403 } 17404 updateHeightRange(e1) { 17405 this.heightRange ? (this.heightRange.min = Math.min(this.heightRange.min, e1), this.heightRange.max = Math.max(this.heightRange.max, e1)) : this.heightRange = { 17406 min: e1, 17407 max: e1 17408 }; 17409 } 17410 endPopulate() { 17411 this.mergedFeatureCache = void 0; 17412 } 17413 constructor(e1, t1){ 17414 this.elevationEnabled = e1, this.hasDeferredElevationFeatures = !1, t1 && (this.frcData = new ag); 17415 } 17416 } 17417 Xa(pg, "LineHDExtension"); 17418 class mg { 17419 beginFeature(e1, t1, i) { 17420 const n = x_(e1, t1, void 0, i); 17421 this.currentFeatureElevation = n ? n.feature : void 0; 17422 } 17423 writeVertexQuad(e1, t1) { 17424 const i = this.currentFeatureElevation ? this.currentFeatureElevation.pointElevation(new Pe(e1, t1)) : 0; 17425 this.hasElevation = this.hasElevation || 0 !== i; 17426 for(let e1 = 0; e1 < 4; e1++)this.elevatedLayoutVertexArray.emplaceBack(i); 17427 } 17428 finalize() { 17429 this.hasElevation || (this.elevatedLayoutVertexArray = void 0); 17430 } 17431 upload(e1) { 17432 this.elevatedLayoutVertexArray && !this.elevatedLayoutVertexBuffer && (this.elevatedLayoutVertexBuffer = e1.createVertexBuffer(this.elevatedLayoutVertexArray, bd.members)); 17433 } 17434 destroy() { 17435 this.elevatedLayoutVertexBuffer && this.elevatedLayoutVertexBuffer.destroy(); 17436 } 17437 constructor(){ 17438 this.elevatedLayoutVertexArray = new $c, this.hasElevation = !1; 17439 } 17440 } 17441 Xa(mg, "CircleHDExtension"); 17442 const _g = (e1, t1, i, n)=>{ 17443 for(let r = 0; r < t1; r++)e1.emplaceBack(i[0], i[1], i[2], n[0], n[1], n[2]); 17444 }; 17445 class gg { 17446 configureCrossSource(e1, t1, i, n) { 17447 this.consumerCanonical = e1, this.elevationParams = t1, this.crossSourceElevationEnabled = i, this.terrainEnabled = n; 17448 } 17449 addElevationFeatures(e1, t1) { 17450 for (const i of e1)this.elevationFeatureIdToIndex.set(i.id, this.elevationFeatures.length), this.elevationFeatures.push(i), this.elevationFeatureTileIds.push(t1); 17451 } 17452 resolveRoadElevation(e1, t1) { 17453 const i = this.elevationFeatureIdToIndex.get(t1); 17454 if (void 0 !== i) return i; 17455 if (this.terrainEnabled || !this.crossSourceElevationEnabled) return 65535; 17456 const n = x_(e1, void 0, this.elevationParams ? this.elevationParams.registry : void 0, this.consumerCanonical); 17457 if (n) { 17458 const e1 = this.elevationFeatures.length; 17459 return this.elevationFeatureIdToIndex.set(t1, e1), this.elevationFeatures.push(n.feature), this.elevationFeatureTileIds.push(n.tileId), e1; 17460 } 17461 return this.elevationParams && this.elevationParams.allProvidersReady ? 65535 : (this.hasDeferredElevationFeatures = !0, "defer"); 17462 } 17463 getElevationFeatureSampler(e1, t1) { 17464 if (t1.equals(e1)) return new __(e1, t1); 17465 this.elevationFeatureSamplerCache || (this.elevationFeatureSamplerCache = new Map); 17466 let i = this.elevationFeatureSamplerCache.get(t1.key); 17467 return i || (i = new __(e1, t1), this.elevationFeatureSamplerCache.set(t1.key, i)), i; 17468 } 17469 isCrossTileRoadElevation(e1, t1) { 17470 if (65535 === e1 || e1 >= this.elevationFeatures.length) return !1; 17471 const i = this.elevationFeatureTileIds[e1]; 17472 return null != i && !i.equals(t1); 17473 } 17474 getRoadFeatureHeightAtAnchor(e1, t1, i) { 17475 if (65535 === e1 || e1 >= this.elevationFeatures.length) return null; 17476 const n = this.elevationFeatures[e1], r = this.elevationFeatureTileIds[e1]; 17477 return r.equals(i) ? n.pointElevation(t1) : this.getElevationFeatureSampler(i, r).pointElevation(new Pe(t1.x, t1.y), n, 0); 17478 } 17479 sampleRoadFeatureHeight(e1, t1, i) { 17480 const n = this.getRoadFeatureHeightAtAnchor(e1, t1, i); 17481 return null === n ? void 0 : n; 17482 } 17483 clearWorkerState() { 17484 this.consumerCanonical = void 0, this.elevationParams = null, this.crossSourceElevationEnabled = !1, this.terrainEnabled = !1, this.elevationFeatureIdToIndex.clear(); 17485 } 17486 updateRoadElevation(e1, t1) { 17487 if (this.elevationStateComplete) return; 17488 this.elevationStateComplete = !0, e1.hasAnyZOffset = !1; 17489 let i = !1; 17490 const n = Ic(t1), r = 1 / n; 17491 let o = !1, a = !1; 17492 for(let s = 0; s < e1.symbolInstances.length; s++){ 17493 const l = e1.symbolInstances.get(s), c = F(1, 0, 0), u = F(0, 1, 0), { numHorizontalGlyphVertices: h, numVerticalGlyphVertices: d, numIconVertices: f, numVerticalIconVertices: p } = l, m = h > 0 || d > 0, _ = f > 0, g = l.elevationFeatureIndex, y = g < this.elevationFeatures.length ? this.elevationFeatures[g] : void 0; 17494 if (y) { 17495 const s = new Pe(l.tileAnchorX, l.tileAnchorY), h = this.sampleRoadFeatureHeight(g, s, t1), d = void 0 !== h ? .075 + h : .075; 17496 l.zOffset !== d && (i = !0, l.zOffset = d), 0 !== d && (e1.hasAnyZOffset = !0); 17497 const f = y.computeSlopeNormal(s, r), p = xe(ce(), F(0, 0, 1), f); 17498 K(c, c, p), K(u, u, p), c[2] *= n, u[2] *= n, 1 === c[0] && 0 === c[1] && 0 === c[2] && 0 === u[0] && 1 === u[1] && 0 === u[2] || (o = o || m, a = a || _); 17499 } 17500 if (m && (_g(e1.text.orientationVertexArray, h, c, u), _g(e1.text.orientationVertexArray, d, c, u)), _) { 17501 const { placedIconSymbolIndex: t1, verticalPlacedIconSymbolIndex: i } = l; 17502 t1 >= 0 && _g(e1.icon.orientationVertexArray, f, c, u), i >= 0 && _g(e1.icon.orientationVertexArray, p, c, u); 17503 } 17504 } 17505 o || (e1.text.orientationVertexArray = void 0), a || (e1.icon.orientationVertexArray = void 0), i && (e1.zOffsetBuffersNeedUpload = !0, e1.zOffsetSortDirty = !0); 17506 } 17507 getRoadFeatureHeightForPlacedSymbol(e1, t1, i, n, r) { 17508 const o = e1.symbolInstances.get(t1.symbolInstanceIndices[i]); 17509 return this.getRoadFeatureHeightAtAnchor(o.elevationFeatureIndex, n, r); 17510 } 17511 getElevationFeatureForPlacedSymbol(e1, t1, i) { 17512 const n = e1.symbolInstances.get(t1.symbolInstanceIndices[i]).elevationFeatureIndex; 17513 if (n < this.elevationFeatures.length) return this.elevationFeatures[n]; 17514 } 17515 makeRoadSymbolElevationParams(e1, t1, i, n, r, o, a, s, l) { 17516 const c = this.getElevationFeatureForPlacedSymbol(e1, t1, i), u = void 0 !== c ? c : null, h = e1.symbolInstances.get(t1.symbolInstanceIndices[i]); 17517 return this.isCrossTileRoadElevation(h.elevationFeatureIndex, n.canonical) ? { 17518 getElevation: (r)=>{ 17519 const o = this.getRoadFeatureHeightForPlacedSymbol(e1, t1, i, r, n.canonical); 17520 return function(e1, t1, i, n, r, o) { 17521 const a = n.upVector(t1, i.x, i.y); 17522 return k(a, a, e1 * n.upVectorScale(t1, r, o).metersToTile), [ 17523 a[0], 17524 a[1], 17525 a[2] 17526 ]; 17527 }(null !== o ? o : 0, n.canonical, r, a, s, l); 17528 }, 17529 elevation: o, 17530 elevationFeature: null 17531 } : { 17532 getElevation: r, 17533 elevation: o, 17534 elevationFeature: u 17535 }; 17536 } 17537 constructor(){ 17538 this.elevationFeatures = [], this.elevationFeatureTileIds = [], this.elevationFeatureIdToIndex = new Map, this.elevationStateComplete = !1, this.hasDeferredElevationFeatures = !1, this.elevationParams = null, this.crossSourceElevationEnabled = !1, this.terrainEnabled = !1; 17539 } 17540 } 17541 Xa(gg, "SymbolHDExtension", { 17542 omit: [ 17543 "consumerCanonical", 17544 "elevationParams", 17545 "crossSourceElevationEnabled", 17546 "terrainEnabled", 17547 "hasDeferredElevationFeatures", 17548 "elevationFeatureIdToIndex" 17549 ] 17550 }); 17551 let yg = null, xg = null, vg = null, bg = null; 17552 const wg = 5120, Ag = 5121, Eg = 5122, Ig = 5123, Mg = 5125, Tg = 5126, Sg = { 17553 [wg]: Int8Array, 17554 [Ag]: Uint8Array, 17555 [Eg]: Int16Array, 17556 [Ig]: Uint16Array, 17557 [Mg]: Uint32Array, 17558 [Tg]: Float32Array 17559 }, zg = { 17560 [wg]: "DT_INT8", 17561 [Ag]: "DT_UINT8", 17562 [Eg]: "DT_INT16", 17563 [Ig]: "DT_UINT16", 17564 [Mg]: "DT_UINT32", 17565 [Tg]: "DT_FLOAT32" 17566 }, Rg = { 17567 SCALAR: 1, 17568 VEC2: 2, 17569 VEC3: 3, 17570 VEC4: 4, 17571 MAT2: 4, 17572 MAT3: 9, 17573 MAT4: 16 17574 }; 17575 function Pg(e1, t1, i) { 17576 const n = i.json.bufferViews.length, r = i.buffers.length; 17577 t1.bufferView = n, i.json.bufferViews[n] = { 17578 buffer: r, 17579 byteLength: e1.byteLength 17580 }, i.buffers[r] = e1; 17581 } 17582 const Dg = "KHR_draco_mesh_compression"; 17583 function Fg(e1, t1) { 17584 const i = e1.extensions && e1.extensions[Dg]; 17585 if (!i) return; 17586 const n = new yg.Decoder, r = kg(t1, i.bufferView), o = new yg.Mesh; 17587 if (!n.DecodeArrayToMesh(r, r.byteLength, o)) throw new Error("Failed to decode Draco mesh"); 17588 const a = t1.json.accessors[e1.indices], s = Sg[a.componentType], l = a.count * s.BYTES_PER_ELEMENT, c = yg._malloc(l); 17589 s === Uint16Array ? n.GetTrianglesUInt16Array(o, l, c) : n.GetTrianglesUInt32Array(o, l, c), Pg(yg.memory.buffer.slice(c, c + l), a, t1), yg._free(c); 17590 for (const r of Object.keys(i.attributes)){ 17591 const a = n.GetAttributeByUniqueId(o, i.attributes[r]), s = t1.json.accessors[e1.attributes[r]], l = zg[s.componentType], c = s.count * Rg[s.type] * Sg[s.componentType].BYTES_PER_ELEMENT, u = yg._malloc(c); 17592 n.GetAttributeDataArrayForAllPoints(o, a, yg[l], c, u), Pg(yg.memory.buffer.slice(u, u + c), s, t1), yg._free(u); 17593 } 17594 n.destroy(), o.destroy(), delete e1.extensions[Dg]; 17595 } 17596 const Cg = "EXT_meshopt_compression"; 17597 function Lg(e1, t1) { 17598 if (!e1.extensions || !e1.extensions[Cg]) return; 17599 const i = e1.extensions[Cg], n = new Uint8Array(t1.buffers[i.buffer], i.byteOffset || 0, i.byteLength || 0), r = new Uint8Array(i.count * i.byteStride); 17600 vg.decodeGltfBuffer(r, i.count, i.byteStride, n, i.mode, i.filter), e1.buffer = t1.buffers.length, e1.byteOffset = 0, t1.buffers[e1.buffer] = r.buffer, delete e1.extensions[Cg]; 17601 } 17602 const Og = 1179937895, Bg = new TextDecoder("utf8"); 17603 function Vg(e1, t1) { 17604 return new URL(e1, t1).href; 17605 } 17606 async function Ng(e1, t1, i, n, r) { 17607 const o = await fetch(Vg(e1.uri, n), { 17608 signal: r 17609 }), a = await o.arrayBuffer(); 17610 t1.buffers[i] = a; 17611 } 17612 function kg(e1, t1) { 17613 const i = e1.json.bufferViews[t1]; 17614 return new Uint8Array(e1.buffers[i.buffer], i.byteOffset || 0, i.byteLength); 17615 } 17616 async function Ug(e1, t1, i, n, r) { 17617 if (e1.uri) { 17618 const o = Vg(e1.uri, n), a = await fetch(o, { 17619 signal: r 17620 }), s = await a.blob(), l = await createImageBitmap(s); 17621 t1.images[i] = l; 17622 } else if (void 0 !== e1.bufferView) { 17623 const n = kg(t1, e1.bufferView), r = new Blob([ 17624 n 17625 ], { 17626 type: e1.mimeType 17627 }), o = await createImageBitmap(r); 17628 t1.images[i] = o; 17629 } 17630 } 17631 async function jg(e1) { 17632 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, i = arguments.length > 2 ? arguments[2] : void 0, n = arguments.length > 3 ? arguments[3] : void 0; 17633 const r = { 17634 json: null, 17635 images: [], 17636 buffers: [] 17637 }; 17638 if (new Uint32Array(e1, t1, 1)[0] === Og) { 17639 const i = new Uint32Array(e1, t1); 17640 let n = 2; 17641 const o = (i[n++] >> 2) - 3, a = i[n++] >> 2; 17642 if (n++, r.json = JSON.parse(Bg.decode(i.subarray(n, n + a))), n += a, n < o) { 17643 const o = i[n++]; 17644 n++; 17645 const a = t1 + (n << 2); 17646 r.buffers[0] = e1.slice(a, a + o); 17647 } 17648 } else r.json = JSON.parse(Bg.decode(new Uint8Array(e1, t1))); 17649 const { buffers: o, images: a, meshes: s, extensionsUsed: l, bufferViews: c } = r.json; 17650 if (o) { 17651 const e1 = []; 17652 for(let t1 = 0; t1 < o.length; t1++){ 17653 const a = o[t1]; 17654 a.uri ? e1.push(Ng(a, r, t1, i, n)) : r.buffers[t1] || (r.buffers[t1] = null); 17655 } 17656 await Promise.all(e1); 17657 } 17658 n && n.throwIfAborted(); 17659 const u = [], h = l && l.includes(Dg), d = l && l.includes(Cg); 17660 if (h && u.push(function() { 17661 if (!yg) return null != xg || (xg = (function(e1) { 17662 let t1, i = null; 17663 function n() { 17664 t1 = new Uint8Array(i.buffer); 17665 } 17666 function r() { 17667 throw new Error("Unexpected Draco error."); 17668 } 17669 return WebAssembly.instantiateStreaming(e1, { 17670 a: { 17671 a: r, 17672 d: function(e1, i, n) { 17673 return t1.copyWithin(e1, i, i + n); 17674 }, 17675 c: function(e1) { 17676 const r = t1.length, o = Math.max(e1 >>> 0, Math.ceil(1.2 * r)), a = Math.ceil((o - r) / 65536); 17677 try { 17678 return i.grow(a), n(), !0; 17679 } catch (e1) { 17680 return !1; 17681 } 17682 }, 17683 b: r 17684 } 17685 }).then((e1)=>{ 17686 const { Rb: r, Qb: o, P: a, T: s, X: l, Ja: c, La: u, Qa: h, Va: d, Wa: f, eb: p, jb: m, f: _, e: g, yb: y, zb: x, Ab: v, Bb: b, Db: w, Gb: A } = e1.instance.exports; 17687 i = g; 17688 const E = (()=>{ 17689 let e1 = 0, i = 0, n = 0, a = 0; 17690 return (s)=>{ 17691 n && (r(a), r(e1), i += n, n = e1 = 0), e1 || (i += 128, e1 = o(i)); 17692 const l = s.length + 7 & -8; 17693 let c = e1; 17694 l >= i && (n = l, c = a = o(l)); 17695 for(let e1 = 0; e1 < s.length; e1++)t1[c + e1] = s[e1]; 17696 return c; 17697 }; 17698 })(); 17699 return n(), _(), { 17700 memory: g, 17701 _free: r, 17702 _malloc: o, 17703 Mesh: class { 17704 destroy() { 17705 s(this.ptr); 17706 } 17707 constructor(){ 17708 this.ptr = a(); 17709 } 17710 }, 17711 Decoder: class { 17712 destroy() { 17713 m(this.ptr); 17714 } 17715 DecodeArrayToMesh(e1, t1, i) { 17716 const n = E(e1), r = u(this.ptr, n, t1, i.ptr); 17717 return !!l(r); 17718 } 17719 GetAttributeByUniqueId(e1, t1) { 17720 return { 17721 ptr: h(this.ptr, e1.ptr, t1) 17722 }; 17723 } 17724 GetTrianglesUInt16Array(e1, t1, i) { 17725 d(this.ptr, e1.ptr, t1, i); 17726 } 17727 GetTrianglesUInt32Array(e1, t1, i) { 17728 f(this.ptr, e1.ptr, t1, i); 17729 } 17730 GetAttributeDataArrayForAllPoints(e1, t1, i, n, r) { 17731 p(this.ptr, e1.ptr, t1.ptr, i, n, r); 17732 } 17733 constructor(){ 17734 this.ptr = c(); 17735 } 17736 }, 17737 DT_INT8: y(), 17738 DT_UINT8: x(), 17739 DT_INT16: v(), 17740 DT_UINT16: b(), 17741 DT_UINT32: w(), 17742 DT_FLOAT32: A() 17743 }; 17744 }); 17745 })(fetch(Gt())).then((e1)=>{ 17746 yg = e1, xg = null; 17747 })), xg; 17748 }()), d && u.push(function() { 17749 var e1; 17750 if (!vg) return null != bg || (bg = (e1 = fetch(Ht()), WebAssembly.instantiateStreaming(e1, {}).then((e1)=>{ 17751 const { sbrk: t1, memory: i, meshopt_decodeVertexBuffer: n, meshopt_decodeIndexBuffer: r, meshopt_decodeIndexSequence: o, meshopt_decodeFilterOct: a, meshopt_decodeFilterQuat: s, meshopt_decodeFilterExp: l } = e1.instance.exports, c = { 17752 ATTRIBUTES: n, 17753 TRIANGLES: r, 17754 INDICES: o 17755 }, u = { 17756 OCTAHEDRAL: a, 17757 QUATERNION: s, 17758 EXPONENTIAL: l 17759 }; 17760 return e1.instance.exports.__wasm_call_ctors(), { 17761 decodeGltfBuffer (e1, n, r, o, a, s) { 17762 const l = n + 3 & -4, h = t1(l * r), d = t1(o.length), f = new Uint8Array(i.buffer); 17763 f.set(o, d); 17764 const p = c[a](h, n, r, d, o.length); 17765 if (0 === p && u[s] && u[s](h, l, r), e1.set(f.subarray(h, h + n * r)), t1(h - t1(0)), 0 !== p) throw new Error("Malformed buffer data: ".concat(p)); 17766 } 17767 }; 17768 })).then((e1)=>{ 17769 vg = e1, bg = null; 17770 })), bg; 17771 }()), a) for(let e1 = 0; e1 < a.length; e1++)u.push(Ug(a[e1], r, e1, i, n)); 17772 if (u.length && await Promise.all(u), n && n.throwIfAborted(), h && s) for (const { primitives: e1 } of s)for (const t1 of e1)Fg(t1, r); 17773 if (d && s && c) for (const e1 of c)Lg(e1, r); 17774 return r; 17775 } 17776 async function Gg(e1, t1) { 17777 const { data: i } = await _i({ 17778 url: e1 17779 }, t1); 17780 return jg(i, 0, e1, t1); 17781 } 17782 class Hg { 17783 _lazyInitLookup() { 17784 this.lookup || (this.lookup = new Uint8Array(Math.ceil(this.triangleCount / 8))), this.lookup.fill(0); 17785 } 17786 queryPoint(e1, t1) { 17787 if (0 === this.triangleCount || 0 === this.cells.length) return; 17788 if (e1.x > this.max.x || this.min.x > e1.x || e1.y > this.max.y || this.min.y > e1.y) return; 17789 const i = $g(e1.x - this.min.x, this.xScale, this.cellsX), n = $g(e1.y - this.min.y, this.yScale, this.cellsY), r = this.cells[n * this.cellsX + i]; 17790 if (r) { 17791 this._lazyInitLookup(); 17792 for(let e1 = 0; e1 < r.len; e1++){ 17793 const i = this.payload[r.start + e1], n = Math.floor(i / 8), o = 1 << i % 8; 17794 if (!(this.lookup[n] & o) && (this.lookup[n] |= o, t1.push(i), t1.length === this.triangleCount)) return; 17795 } 17796 } 17797 } 17798 query(e1, t1, i) { 17799 if (0 === this.triangleCount || 0 === this.cells.length) return; 17800 if (e1.x > this.max.x || this.min.x > t1.x) return; 17801 if (e1.y > this.max.y || this.min.y > t1.y) return; 17802 this._lazyInitLookup(); 17803 const n = $g(e1.x - this.min.x, this.xScale, this.cellsX), r = $g(t1.x - this.min.x, this.xScale, this.cellsX), o = $g(e1.y - this.min.y, this.yScale, this.cellsY), a = $g(t1.y - this.min.y, this.yScale, this.cellsY); 17804 for(let e1 = o; e1 <= a; e1++)for(let t1 = n; t1 <= r; t1++){ 17805 const n = this.cells[e1 * this.cellsX + t1]; 17806 if (n) for(let e1 = 0; e1 < n.len; e1++){ 17807 const t1 = this.payload[n.start + e1], r = Math.floor(t1 / 8), o = 1 << t1 % 8; 17808 if (!(this.lookup[r] & o) && (this.lookup[r] |= o, i.push(t1), i.length === this.triangleCount)) return; 17809 } 17810 } 17811 } 17812 constructor(e1, t1, i, n){ 17813 if (this.triangleCount = t1.length / 3, this.min = new Pe(0, 0), this.max = new Pe(0, 0), this.xScale = 0, this.yScale = 0, this.cellsX = 0, this.cellsY = 0, this.cells = [], this.payload = [], 0 === this.triangleCount || 0 === e1.length) return; 17814 const [r, o] = [ 17815 e1[0].clone(), 17816 e1[0].clone() 17817 ]; 17818 for(let t1 = 1; t1 < e1.length; ++t1){ 17819 const i = e1[t1]; 17820 r.x = Math.min(r.x, i.x), r.y = Math.min(r.y, i.y), o.x = Math.max(o.x, i.x), o.y = Math.max(o.y, i.y); 17821 } 17822 if (n) { 17823 const e1 = Math.ceil(Math.max(o.x - r.x, o.y - r.y) / n); 17824 i = Math.max(i, e1); 17825 } 17826 if (0 === i) return; 17827 this.min = r, this.max = o; 17828 const a = this.max.sub(this.min); 17829 a.x = Math.max(a.x, 1), a.y = Math.max(a.y, 1); 17830 const s = Math.max(a.x, a.y) / i; 17831 this.cellsX = Math.max(1, Math.ceil(a.x / s)), this.cellsY = Math.max(1, Math.ceil(a.y / s)), this.xScale = 1 / s, this.yScale = 1 / s; 17832 const l = []; 17833 for(let i = 0; i < this.triangleCount; i++){ 17834 const n = e1[t1[3 * i + 0]].sub(this.min), r = e1[t1[3 * i + 1]].sub(this.min), o = e1[t1[3 * i + 2]].sub(this.min), a = $g(Math.floor(Math.min(n.x, r.x, o.x)), this.xScale, this.cellsX), c = $g(Math.floor(Math.max(n.x, r.x, o.x)), this.xScale, this.cellsX), u = $g(Math.floor(Math.min(n.y, r.y, o.y)), this.yScale, this.cellsY), h = $g(Math.floor(Math.max(n.y, r.y, o.y)), this.yScale, this.cellsY), d = new Pe(0, 0), f = new Pe(0, 0), p = new Pe(0, 0), m = new Pe(0, 0); 17835 for(let e1 = u; e1 <= h; ++e1){ 17836 d.y = f.y = e1 * s, p.y = m.y = (e1 + 1) * s; 17837 for(let t1 = a; t1 <= c;
17837 ++t1)d.x = p.x = t1 * s, f.x = m.x = (t1 + 1) * s, (Kh(n, r, o, d, f, m) || Kh(n, r, o, d, m, p)) && l.push({ 17838 cellIdx: e1 * this.cellsX + t1, 17839 triIdx: i 17840 }); 17841 } 17842 } 17843 if (0 === l.length) return; 17844 l.sort((e1, t1)=>e1.cellIdx - t1.cellIdx || e1.triIdx - t1.triIdx); 17845 let c = 0; 17846 for(; c < l.length;){ 17847 const e1 = l[c].cellIdx, t1 = { 17848 start: this.payload.length, 17849 len: 0 17850 }; 17851 for(; c < l.length && l[c].cellIdx === e1;)++t1.len, this.payload.push(l[c++].triIdx); 17852 this.cells[e1] = t1; 17853 } 17854 } 17855 } 17856 function $g(e1, t1, i) { 17857 return Math.max(0, Math.min(i - 1, Math.floor(e1 * t1))); 17858 } 17859 Xa(Hg, "TriangleGridIndex"); 17860 const Zg = kc([ 17861 { 17862 name: "a_pos_3f", 17863 components: 3, 17864 type: "Float32" 17865 } 17866 ]), Wg = kc([ 17867 { 17868 name: "a_color_3f", 17869 components: 3, 17870 type: "Float32" 17871 } 17872 ]), qg = kc([ 17873 { 17874 name: "a_color_4f", 17875 components: 4, 17876 type: "Float32" 17877 } 17878 ]), Xg = kc([ 17879 { 17880 name: "a_uv_2f", 17881 components: 2, 17882 type: "Float32" 17883 } 17884 ]), Yg = kc([ 17885 { 17886 name: "a_normal_3f", 17887 components: 3, 17888 type: "Float32" 17889 } 17890 ]), Jg = kc([ 17891 { 17892 name: "a_normal_matrix0", 17893 components: 4, 17894 type: "Float32" 17895 }, 17896 { 17897 name: "a_normal_matrix1", 17898 components: 4, 17899 type: "Float32" 17900 }, 17901 { 17902 name: "a_normal_matrix2", 17903 components: 4, 17904 type: "Float32" 17905 }, 17906 { 17907 name: "a_normal_matrix3", 17908 components: 4, 17909 type: "Float32" 17910 } 17911 ]), Kg = kc([ 17912 { 17913 name: "a_pbr", 17914 components: 4, 17915 type: "Uint16" 17916 }, 17917 { 17918 name: "a_heightBasedEmissiveStrength", 17919 components: 3, 17920 type: "Float32" 17921 } 17922 ]); 17923 function Qg(e1, t1) { 17924 const i = ty(e1.projection, e1.zoom, e1.width, e1.height), n = function(e1, t1, i, n, r) { 17925 const o = new _c(i.lng - 180 * iy, i.lat), a = new _c(i.lng + 180 * iy, i.lat), s = e1.project(o.lng, o.lat), l = e1.project(a.lng, a.lat), c = -Math.atan2(l.y - s.y, l.x - s.x), u = Mc.fromLngLat(i); 17926 u.y = it(u.y, -1 + iy, 1 - iy); 17927 const h = u.toLngLat(), f = e1.project(h.lng, h.lat), p = Mc.fromLngLat(h); 17928 p.x += iy; 17929 const _ = p.toLngLat(), y = e1.project(_.lng, _.lat), x = ry(y.x - f.x, y.y - f.y, c), b = Mc.fromLngLat(h); 17930 b.y += iy; 17931 const w = b.toLngLat(), A = e1.project(w.lng, w.lat), E = ry(A.x - f.x, A.y - f.y, c), I = Math.abs(x.x) / Math.abs(E.y), M = d([]); 17932 v(M, M, -c * (1 - (r ? 0 : n))); 17933 const T = d([]); 17934 return g(T, T, [ 17935 1, 17936 1 - (1 - I) * n, 17937 1 17938 ]), T[4] = -E.x / E.y * n, v(T, T, c), m(T, M, T), T; 17939 }(e1.projection, 0, e1.center, i, t1), r = ey(e1); 17940 return g(n, n, [ 17941 r, 17942 r, 17943 1 17944 ]), n; 17945 } 17946 function ey(e1) { 17947 const t1 = e1.projection, i = ty(e1.projection, e1.zoom, e1.width, e1.height), n = ny(t1, e1.center), r = ny(t1, _c.convert(t1.center)); 17948 return Math.pow(2, n * i + (1 - i) * r); 17949 } 17950 function ty(e1, t1, i, n) { 17951 let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1 / 0; 17952 const o = e1.range; 17953 if (!o) return 0; 17954 const a = Math.min(r, Math.max(i, n)), s = Math.log2(a / 1024); 17955 return nt(o[0] + s, o[1] + s, t1); 17956 } 17957 const iy = 1 / 4e4; 17958 function ny(e1, t1) { 17959 const i = it(t1.lat, -85.051129, bc), n = new _c(t1.lng - 180 * iy, i), r = new _c(t1.lng + 180 * iy, i), o = e1.project(n.lng, i), a = e1.project(r.lng, i), s = Mc.fromLngLat(n), l = Mc.fromLngLat(r), c = a.x - o.x, u = a.y - o.y, h = l.x - s.x, d = l.y - s.y, f = Math.sqrt((h * h + d * d) / (c * c + u * u)); 17960 return Math.log2(f); 17961 } 17962 function ry(e1, t1, i) { 17963 const n = Math.cos(i), r = Math.sin(i); 17964 return {
vendor: 14,549 bytes, lines 17965-18327
17965 x: e1 * n - t1 * r, 17966 y: e1 * r + t1 * n 17967 }; 17968 } 17969 const oy = new Float64Array([ 17970 1, 17971 0, 17972 0, 17973 0, 17974 0, 17975 0, 17976 1, 17977 0, 17978 0, 17979 1, 17980 0, 17981 0, 17982 0, 17983 0, 17984 0, 17985 1 17986 ]); 17987 function ay(e1, t1, i) { 17988 d(e1), v(e1, e1, Je(t1[2])), y(e1, e1, Je(t1[0])), x(e1, e1, Je(t1[1])), g(e1, e1, i), m(e1, e1, oy); 17989 } 17990 function sy(e1, t1, i, n, r, o, a, s) { 17991 const l = [ 17992 i[0] - t1[0], 17993 i[1] - t1[1], 17994 0 17995 ], c = [ 17996 n[0] - t1[0], 17997 n[1] - t1[1], 17998 0 17999 ]; 18000 if (D(l) < 1e-12 || D(c) < 1e-12) return ue(e1); 18001 const u = q([], l, c); 18002 Z(u, u), O(c, n, t1), l[2] = (o - r) * s, c[2] = (a - r) * s; 18003 const h = l; 18004 return q(h, l, c), Z(h, h), xe(e1, u, h); 18005 } 18006 function ly(e1, t1) { 18007 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 18008 const n = Yf(t1.zoom), r = function(e1, t1, i) { 18009 const n = t1.worldSize, r = [ 18010 e1[12], 18011 e1[13], 18012 e1[14] 18013 ], o = mr(r[1] / n), a = pr(r[0] / n), s = d([]), l = xc(1, o) * n, c = xc(1, 0) * n * Ac(o, t1.zoom), u = 1 / Wf(n); 18014 let h = c * u; 18015 if (i) { 18016 const e1 = ty(t1.projection, t1.zoom, t1.width, t1.height, 1024); 18017 h = u * t1.projection.pixelSpaceConversion(t1.center.lat, n, e1); 18018 } 18019 const f = fc(o, a); 18020 L(f, f, k([], Z([], f), l * h * r[2])); 18021 const p = function(e1) { 18022 const t1 = [ 18023 e1[0], 18024 e1[1], 18025 e1[2] 18026 ]; 18027 let i = [ 18028 0, 18029 1, 18030 0 18031 ]; 18032 const n = q([], i, t1); 18033 return q(i, t1, n), 0 === H(i) && (i = [ 18034 0, 18035 1, 18036 0 18037 ], q(n, t1, i)), Z(n, n), Z(i, i), Z(t1, t1), [ 18038 n[0], 18039 n[1], 18040 n[2], 18041 0, 18042 i[0], 18043 i[1], 18044 i[2], 18045 0, 18046 t1[0], 18047 t1[1], 18048 t1[2], 18049 0, 18050 e1[0], 18051 e1[1], 18052 e1[2], 18053 1 18054 ]; 18055 }(f); 18056 g(s, s, [ 18057 h, 18058 h, 18059 h * l 18060 ]), _(s, s, [ 18061 -r[0], 18062 -r[1], 18063 -r[2] 18064 ]); 18065 const y = m([], t1.globeMatrix, p); 18066 return m(y, y, s), m(y, y, e1), y; 18067 }(e1, t1, i); 18068 if (n > 0) { 18069 const i = function(e1, t1) { 18070 const i = t1.worldSize, n = xc(1, 0) * i * Ac(t1.center.lat, t1.zoom) / Wf(i), r = xc(1, t1.center.lat) * i, o = d([]); 18071 x(o, o, Je(t1.center.lng)), y(o, o, Je(t1.center.lat)), _(o, o, [ 18072 0, 18073 0, 18074 sc 18075 ]), g(o, o, [ 18076 n, 18077 n, 18078 n * r 18079 ]); 18080 const a = t1.point; 18081 return _(o, o, [ 18082 -a.x, 18083 -a.y, 18084 0 18085 ]), m(o, o, e1), m(o, t1.globeMatrix, o); 18086 }(e1, t1); 18087 return function(e1, t1, i) { 18088 const n = (e1, t1, i)=>{ 18089 const n = D(e1), r = D(t1), o = Bf(e1, t1, i); 18090 return k(o, o, 1 / D(o) * fn(n, r, i)); 18091 }, r = n([ 18092 e1[0], 18093 e1[1], 18094 e1[2] 18095 ], [ 18096 t1[0], 18097 t1[1], 18098 t1[2] 18099 ], i), o = n([ 18100 e1[4], 18101 e1[5], 18102 e1[6] 18103 ], [ 18104 t1[4], 18105 t1[5], 18106 t1[6] 18107 ], i), a = n([ 18108 e1[8], 18109 e1[9], 18110 e1[10] 18111 ], [ 18112 t1[8], 18113 t1[9], 18114 t1[10] 18115 ], i), s = Bf([ 18116 e1[12], 18117 e1[13], 18118 e1[14] 18119 ], [ 18120 t1[12], 18121 t1[13], 18122 t1[14] 18123 ], i); 18124 return [ 18125 r[0], 18126 r[1], 18127 r[2], 18128 0, 18129 o[0], 18130 o[1], 18131 o[2], 18132 0, 18133 a[0], 18134 a[1], 18135 a[2], 18136 0, 18137 s[0], 18138 s[1], 18139 s[2], 18140 1 18141 ]; 18142 }(r, i, n); 18143 } 18144 return r; 18145 } 18146 function cy(e1, t1, i, n) { 18147 const r = Rf.projectAabbCorners(n, i); 18148 let o = Number.MAX_VALUE; 18149 for(let e1 = 0; e1 < r.length; ++e1){ 18150 const i = r[e1]; 18151 i[0] = (.5 * i[0] + .5) * t1.width, i[1] = (.5 - .5 * i[1]) * t1.height, i[2] < o && (o = i[2]); 18152 } 18153 const a = function(e1) { 18154 const t1 = []; 18155 let i = 0; 18156 for(let t1 = 1; t1 < e1.length; t1++)(e1[t1][0] < e1[i][0] || e1[t1][0] === e1[i][0] && e1[t1][1] < e1[i][1]) && (i = t1); 18157 let n, r = i; 18158 const o = new Uint8Array(e1.length); 18159 do { 18160 if (o[r]) break; 18161 t1.push(new Pe(e1[r][0], e1[r][1])), o[r] = 1, n = (r + 1) % e1.length; 18162 for(let t1 = 0; t1 < e1.length; t1++){ 18163 if (e1[t1][0] === e1[n][0] && e1[t1][1] === e1[n][1] || e1[t1][0] === e1[r][0] && e1[t1][1] === e1[r][1]) continue; 18164 const i = [ 18165 e1[t1][0] - e1[r][0], 18166 e1[t1][1] - e1[r][1] 18167 ], o = [ 18168 e1[n][0] - e1[r][0], 18169 e1[n][1] - e1[r][1] 18170 ], a = i[0] * o[1] - i[1] * o[0]; 18171 (a > 0 || 0 === a && i[0] * o[0] + i[1] * o[1] >= 0 && i[0] * i[0] + i[1] * i[1] > o[0] * o[0] + o[1] * o[1]) && (n = t1); 18172 } 18173 r = n; 18174 }while (r !== i) 18175 return t1.length > 0 && t1.push(t1[0]), t1; 18176 }(r); 18177 if (Bh(e1, a)) return o; 18178 } 18179 const uy = 64, hy = [ 18180 1, 18181 1, 18182 1 18183 ]; 18184 function dy(e1, t1, i, n, r, o, a, s, l) { 18185 let c = arguments.length > 9 && arguments[9] !== void 0 ? arguments[9] : !1; 18186 const u = i.zoom, h = i.project(n), f = Ac(n.lat, u), p = 1 / f; 18187 d(e1), _(e1, e1, [ 18188 h.x + a[0] * p, 18189 h.y + a[1] * p, 18190 a[2] 18191 ]); 18192 let y = 1, x = 1; 18193 const v = i.worldSize; 18194 if (c) { 18195 if ("mercator" === i.projection.name) { 18196 let e1 = 0; 18197 i.elevation && (e1 = i.elevation.getAtPointOrZero(new Mc(h.x / v, h.y / v), 0)); 18198 const t1 = le([], [ 18199 h.x, 18200 h.y, 18201 e1, 18202 1 18203 ], i.projMatrix)[3] / i.cameraToCenterDistance; 18204 y = t1, x = t1 * Ac(i.center.lat, u); 18205 } else if ("globe" === i.projection.name) { 18206 const t1 = ly(e1, i), r = [ 18207 0, 18208 0, 18209 0, 18210 1 18211 ]; 18212 le(r, r, m([], i.projMatrix, t1)); 18213 const o = r[3] / i.cameraToCenterDistance, a = Yf(u), s = i.projection.pixelsPerMeter(n.lat, v) * Ac(n.lat, u), l = i.projection.pixelsPerMeter(i.center.lat, v) * Ac(i.center.lat, u); 18214 y = o / fn(s, wc(i.center.lat), a), x = o * f / s, y *= l, x *= l; 18215 } 18216 } else y = p; 18217 g(e1, e1, [ 18218 y, 18219 y, 18220 x 18221 ]); 18222 const b = [ 18223 ...e1 18224 ], w = t1.orientation, A = []; 18225 if (ay(A, [ 18226 w[0] + (r ? r[0] : 0), 18227 w[1] + (r ? r[1] : 0), 18228 w[2] + (r ? r[2] : 0) 18229 ], o), m(e1, b, A), s && i.elevation) { 18230 let r = 0; 18231 const o = []; 18232 if (l && i.elevation) { 18233 r = function(e1, t1, i, n, r) { 18234 const o = t1.elevation; 18235 if (!o) return 0; 18236 const a = Rf.projectAabbCorners(i, n), s = xc(1, r.lat) * t1.worldSize, l = function(e1, t1) { 18237 const i = [ 18238 0, 18239 0, 18240 1 18241 ], n = [ 18242 { 18243 corners: [ 18244 0, 18245 1, 18246 3, 18247 2 18248 ], 18249 dotProductWithUp: 0 18250 }, 18251 { 18252 corners: [ 18253 1, 18254 5, 18255 2, 18256 6 18257 ], 18258 dotProductWithUp: 0 18259 }, 18260 { 18261 corners: [ 18262 0, 18263 4, 18264 1, 18265 5 18266 ], 18267 dotProductWithUp: 0 18268 }, 18269 { 18270 corners: [ 18271 2, 18272 6, 18273 3, 18274 7 18275 ], 18276 dotProductWithUp: 0 18277 }, 18278 { 18279 corners: [ 18280 4, 18281 7, 18282 5, 18283 6 18284 ], 18285 dotProductWithUp: 0 18286 }, 18287 { 18288 corners: [ 18289 0, 18290 3, 18291 4, 18292 7 18293 ], 18294 dotProductWithUp: 0 18295 } 18296 ]; 18297 for (const r of n){ 18298 const n = e1[r.corners[0]], o = e1[r.corners[1]], a = e1[r.corners[2]], s = [ 18299 o[0] - n[0], 18300 o[1] - n[1], 18301 t1 * (o[2] - n[2]) 18302 ], l = q(s, s, [ 18303 a[0] - n[0], 18304 a[1] - n[1], 18305 t1 * (a[2] - n[2]) 18306 ]); 18307 Z(l, l), r.dotProductWithUp = W(l, i); 18308 } 18309 return n.sort((e1, t1)=>e1.dotProductWithUp - t1.dotProductWithUp), n[0].corners; 18310 }(a, s), c = a[l[0]], u = a[l[1]], h = a[l[2]], d = a[l[3]], f = o.getAtPointOrZero(new Mc(c[0] / t1.worldSize, c[1] / t1.worldSize), 0), p = o.getAtPointOrZero(new Mc(u[0] / t1.worldSize, u[1] / t1.worldSize), 0), m = o.getAtPointOrZero(new Mc(h[0] / t1.worldSize, h[1] / t1.worldSize), 0), _ = o.getAtPointOrZero(new Mc(d[0] / t1.worldSize, d[1] / t1.worldSize), 0), g = (f + _) / 2, y = (p + m) / 2; 18311 return g > y ? p < m ? sy(e1, u, d, c, p, _, f, s) : sy(e1, h, c, d, m, f, _, s) : f < _ ? sy(e1, c, u, h, f, p, m, s) : sy(e1, d, h, u, _, m, p, s), Math.max(g, y); 18312 }(o, i, t1.aabb, e1, n); 18313 const a = m([], M([], o), A); 18314 m(e1, b, a); 18315 } else r = i.elevation.getAtPointOrZero(new Mc(h.x / v, h.y / v), 0); 18316 0 !== r && (e1[14] += r); 18317 } 18318 } 18319 class fy { 18320 _applyTransformations(e1, t1) { 18321 m(e1.globalMatrix, t1, e1.localMatrix); 18322 const i = this.nodeOverrides.get(e1.name); 18323 if (void 0 !== i) { 18324 if (i.orientation) { 18325 const t1 = []; 18326 r = i.orientation, d(n = t1), x(n, n, Je(r[1])), v(n, n, Je(r[2])), y(n, n, Je(r[0])), m(e1.globalMatrix, e1.globalMatrix, t1); 18327 }
18328 i.minZoom && (e1.minZoom = i.minZoom), i.maxZoom && (e1.maxZoom = i.maxZoom); 18329 } 18330 var n, r; 18331 if (e1.meshes) for (const t1 of e1.meshes){ 18332 const i = Rf.applyTransformFast(t1.aabb, e1.globalMatrix); 18333 this.aabb.encapsulate(i); 18334 } 18335 if (e1.children) for (const t1 of e1.children)this._applyTransformations(t1, e1.globalMatrix); 18336 } 18337 computeBoundsAndApplyParent() { 18338 const e1 = d([]); 18339 this.aabb = new Rf([ 18340 1 / 0, 18341 1 / 0, 18342 1 / 0 18343 ], [ 18344 -1 / 0, 18345 -1 / 0, 18346 -1 / 0 18347 ]); 18348 for (const t1 of this.nodes)this._applyTransformations(t1, e1); 18349 } 18350 computeModelMatrix(e1, t1, i, n, r, o) { 18351 let a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : !1; 18352 dy(this.matrix, this, e1.transform, this.position, t1, i, n, r, o, a); 18353 } 18354 upload(e1) { 18355 if (!this.uploaded) { 18356 for (const t1 of this.nodes)_y(t1, e1); 18357 for (const e1 of this.nodes)yy(e1); 18358 this.uploaded = !0; 18359 } 18360 } 18361 destroy() { 18362 for (const e1 of this.nodes)vy(e1); 18363 } 18364 constructor(e1, t1, i, n, r){ 18365 this.materialOverrides = new Map, this.nodeOverrides = new Map, this.materialOverrideNames = [], this.nodeOverrideNames = [], this.featureProperties = {}, this.id = e1, this.uri = t1, this.position = null != i ? new _c(i[0], i[1]) : new _c(0, 0), this.orientation = n !== null && n !== void 0 ? n : [ 18366 0, 18367 0, 18368 0 18369 ], this.nodes = r, this.uploaded = !1, this.aabb = new Rf([ 18370 1 / 0, 18371 1 / 0, 18372 1 / 0 18373 ], [ 18374 -1 / 0, 18375 -1 / 0, 18376 -1 / 0 18377 ]), this.matrix = []; 18378 } 18379 } 18380 function py(e1, t1) { 18381 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 18382 e1.uploaded || (e1.gfxTexture = new mm(t1, e1.image, i ? t1.gl.R8 : t1.gl.RGBA8, { 18383 useMipmap: e1.sampler.minFilter >= t1.gl.NEAREST_MIPMAP_NEAREST 18384 }), e1.uploaded = !0, e1.image = null); 18385 } 18386 function my(e1, t1, i) { 18387 e1.indexBuffer = t1.createIndexBuffer(e1.indexArray, !1, !0), e1.vertexBuffer = t1.createVertexBuffer(e1.vertexArray, Zg.members, !1, !0), e1.normalArray && (e1.normalBuffer = t1.createVertexBuffer(e1.normalArray, Yg.members, !1, !0)), e1.texcoordArray && (e1.texcoordBuffer = t1.createVertexBuffer(e1.texcoordArray, Xg.members, !1, !0)), e1.colorArray && (e1.colorBuffer = t1.createVertexBuffer(e1.colorArray, (12 === e1.colorArray.bytesPerElement ? Wg : qg).members, !1, !0)), e1.featureArray && (e1.pbrBuffer = t1.createVertexBuffer(e1.featureArray, Kg.members, !0)), e1.segments = ju.simpleSegment(0, 0, e1.vertexArray.length, e1.indexArray.length); 18388 const n = e1.material; 18389 n.pbrMetallicRoughness.baseColorTexture && py(n.pbrMetallicRoughness.baseColorTexture, t1), n.pbrMetallicRoughness.metallicRoughnessTexture && py(n.pbrMetallicRoughness.metallicRoughnessTexture, t1), n.normalTexture && py(n.normalTexture, t1), n.occlusionTexture && py(n.occlusionTexture, t1, i), n.emissionTexture && py(n.emissionTexture, t1); 18390 } 18391 function _y(e1, t1, i) { 18392 if (e1.meshes) for (const n of e1.meshes)my(n, t1, i); 18393 if (e1.lodMeshes) for (const n of e1.lodMeshes)my(n, t1, i); 18394 if (e1.children) for (const n of e1.children)_y(n, t1, i); 18395 } 18396 function gy(e1) { 18397 e1.indexArray.destroy(), e1.vertexArray.destroy(), e1.colorArray && e1.colorArray.destroy(), e1.normalArray && e1.normalArray.destroy(), e1.texcoordArray && e1.texcoordArray.destroy(), e1.featureArray && e1.featureArray.destroy(); 18398 } 18399 function yy(e1) { 18400 if (e1.meshes) for (const t1 of e1.meshes)gy(t1); 18401 if (e1.lodMeshes) for (const t1 of e1.lodMeshes)gy(t1); 18402 if (e1.children) for (const t1 of e1.children)yy(t1); 18403 } 18404 function xy(e1) { 18405 var t1; 18406 e1.vertexBuffer && (e1.vertexBuffer.destroy(), e1.indexBuffer.destroy(), e1.normalBuffer && e1.normalBuffer.destroy(), e1.texcoordBuffer && e1.texcoordBuffer.destroy(), e1.colorBuffer && e1.colorBuffer.destroy(), e1.pbrBuffer && e1.pbrBuffer.destroy(), e1.segments.destroy(), e1.material && ((t1 = e1.material).pbrMetallicRoughness.baseColorTexture && t1.pbrMetallicRoughness.baseColorTexture.gfxTexture && t1.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(), t1.pbrMetallicRoughness.metallicRoughnessTexture && t1.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture && t1.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(), t1.normalTexture && t1.normalTexture.gfxTexture && t1.normalTexture.gfxTexture.destroy(), t1.emissionTexture && t1.emissionTexture.gfxTexture && t1.emissionTexture.gfxTexture.destroy(), t1.occlusionTexture && t1.occlusionTexture.gfxTexture && t1.occlusionTexture.gfxTexture.destroy())); 18407 } 18408 function vy(e1) { 18409 if (e1.meshes) for (const t1 of e1.meshes)xy(t1); 18410 if (e1.lodMeshes) for (const t1 of e1.lodMeshes)xy(t1); 18411 if (e1.footprintDebugMesh && (e1.footprintDebugMesh.vertexBuffer.destroy(), e1.footprintDebugMesh.indexBuffer.destroy(), e1.footprintDebugMesh.segments.destroy()), e1.children) for (const t1 of e1.children)vy(t1); 18412 } 18413 function by(e1, t1, i, n) { 18414 return e1[0] <= n[0] && t1[0] >
vendor: 81,770 bytes, lines 18414-19881
18414= i[0] && e1[1] <= n[1] && t1[1] >= i[1] && e1[2] <= n[2] && t1[2] >= i[2]; 18415 } 18416 function wy(e1, t1, i, n, r, o, a, s, l, c, u) { 18417 const h = .5 * (c[0] + u[0]), d = .5 * (c[1] + u[1]), f = .5 * (c[2] + u[2]), p = .5 * (u[0] - c[0]), m = .5 * (u[1] - c[1]), _ = .5 * (u[2] - c[2]), g = e1 - h, y = t1 - d, x = i - f, v = n - h, b = r - d, w = o - f, A = a - h, E = s - d, I = l - f, M = v - g, T = b - y, S = w - x, z = A - v, R = E - b, P = I - w, D = g - A, F = y - E, C = x - I; 18418 let L, O, B, V, N, k; 18419 if (L = x * T - y * S, O = w * T - b * S, B = I * T - E * S, V = Math.min(L, O, B), N = Math.max(L, O, B), k = Math.abs(S) * m + Math.abs(T) * _, V > k || N < -k) return !1; 18420 if (L = x * R - y * P, O = w * R - b * P, B = I * R - E * P, V = Math.min(L, O, B), N = Math.max(L, O, B), k = Math.abs(P) * m + Math.abs(R) * _, V > k || N < -k) return !1; 18421 if (L = x * F - y * C, O = w * F - b * C, B = I * F - E * C, V = Math.min(L, O, B), N = Math.max(L, O, B), k = Math.abs(C) * m + Math.abs(F) * _, V > k || N < -k) return !1; 18422 if (L = g * S - x * M, O = v * S - w * M, B = A * S - I * M, V = Math.min(L, O, B), N = Math.max(L, O, B), k = Math.abs(S) * p + Math.abs(M) * _, V > k || N < -k) return !1; 18423 if (L = g * P - x * z, O = v * P - w * z, B = A * P - I * z, V = Math.min(L, O, B), N = Math.max(L, O, B), k = Math.abs(P) * p + Math.abs(z) * _, V > k || N < -k) return !1; 18424 if (L = g * C - x * D, O = v * C - w * D, B = A * C - I * D, V = Math.min(L, O, B), N = Math.max(L, O, B), k = Math.abs(C) * p + Math.abs(D) * _, V > k || N < -k) return !1; 18425 if (L = y * M - g * T, O = b * M - v * T, B = E * M - A * T, V = Math.min(L, O, B), N = Math.max(L, O, B), k = Math.abs(T) * p + Math.abs(M) * m, V > k || N < -k) return !1; 18426 if (L = y * z - g * R, O = b * z - v * R, B = E * z - A * R, V = Math.min(L, O, B), N = Math.max(L, O, B), k = Math.abs(R) * p + Math.abs(z) * m, V > k || N < -k) return !1; 18427 if (L = y * D - g * F, O = b * D - v * F, B = E * D - A * F, V = Math.min(L, O, B), N = Math.max(L, O, B), k = Math.abs(F) * p + Math.abs(D) * m, V > k || N < -k) return !1; 18428 if (V = Math.min(g, v, A), N = Math.max(g, v, A), V > p || N < -p) return !1; 18429 if (V = Math.min(y, b, E), N = Math.max(y, b, E), V > m || N < -m) return !1; 18430 if (V = Math.min(x, w, I), N = Math.max(x, w, I), V > _ || N < -_) return !1; 18431 const U = T * P - S * R, j = S * z - M * P, G = M * R - T * z, H = -(U * g + j * y + G * x); 18432 return k = p * Math.abs(U) + m * Math.abs(j) + _ * Math.abs(G), !(Math.abs(H) > k); 18433 } 18434 const Ay = []; 18435 class Ey { 18436 serializeFromGltf(e1, t1, i, n) { 18437 if (e1.length < 7) return; 18438 let r = 0; 18439 if (109 !== e1[r++] || 98 !== e1[r++] || 120 !== e1[r++] || 98 !== e1[r++] || 118 !== e1[r++] || 104 !== e1[r++]) return; 18440 if (43 !== e1[r++]) return; 18441 const o = new DataView(e1.buffer, e1.byteOffset), a = o.getUint16(r, !0); 18442 if (r += 2, 0 === a) return; 18443 this._nodes = []; 18444 let s = 0; 18445 for(let e1 = 0; e1 < a; e1++){ 18446 const e1 = [ 18447 t1[3 * s], 18448 t1[3 * s + 1], 18449 t1[3 * s + 2] 18450 ], n = [ 18451 i[3 * s], 18452 i[3 * s + 1], 18453 i[3 * s + 2] 18454 ]; 18455 s++; 18456 const a = o.getUint16(r, !0); 18457 r += 2; 18458 let l = 0, c = 0; 18459 65535 === a && (l = o.getUint16(r, !0), r += 2, c = o.getUint32(r, !0), r += 4), this._nodes.push({ 18460 aabbMin: e1, 18461 aabbMax: n, 18462 backChild: a, 18463 indexCount: l, 18464 indexOffset: c 18465 }); 18466 } 18467 const l = o.getUint32(r, !0); 18468 this._indices = n.slice(0, l); 18469 } 18470 setVertices(e1) { 18471 this._vertices = e1; 18472 } 18473 findHighestPoint(e1, t1) { 18474 if (!this._nodes || 0 === this._nodes.length) return null; 18475 if (!by(this._nodes[0].aabbMin, this._nodes[0].aabbMax, e1, t1)) return null; 18476 const i = Ay; 18477 i.length = 0, i.push(0); 18478 let n = -1 / 0; 18479 for(; i.length > 0;){ 18480 const r = i.pop(), o = this._nodes[r]; 18481 if (o.aabbMax[2] <= n) continue; 18482 if (65535 === o.backChild) { 18483 for(let i = 0; i < o.indexCount; i += 3){ 18484 const r = 3 * this._indices[o.indexOffset + i], a = 3 * this._indices[o.indexOffset + i + 1], s = 3 * this._indices[o.indexOffset + i + 2]; 18485 wy(this._vertices[r], this._vertices[r + 1], this._vertices[r + 2], this._vertices[a], this._vertices[a + 1], this._vertices[a + 2], this._vertices[s], this._vertices[s + 1], this._vertices[s + 2], e1, t1) && (n = Math.max(n, this._vertices[r + 2], this._vertices[a + 2], this._vertices[s + 2])); 18486 } 18487 continue; 18488 } 18489 const a = r + 1, s = o.backChild, l = this._nodes[a], c = this._nodes[s], u = by(l.aabbMin, l.aabbMax, e1, t1), h = by(c.aabbMin, c.aabbMax, e1, t1); 18490 u && h ? l.aabbMax[2] < c.aabbMax[2] ? (i.push(a), i.push(s)) : (i.push(s), i.push(a)) : u ? i.push(a) : h && i.push(s); 18491 } 18492 return n >= 0 ? n : null; 18493 } 18494 } 18495 function Iy(e1, t1) { 18496 const i = e1.json.bufferViews[t1.bufferView], n = Sg[t1.componentType]; 18497 return new n(e1.buffers[i.buffer], (t1.byteOffset || 0) + (i.byteOffset || 0), t1.count * (i.byteStride && i.byteStride !== Rg[t1.type] * n.BYTES_PER_ELEMENT ? i.byteStride / n.BYTES_PER_ELEMENT : Rg[t1.type])); 18498 } 18499 function My(e1, t1, i, n) { 18500 const r = Sg[t1.componentType], o = function(e1) { 18501 switch(e1){ 18502 case Int8Array: 18503 return 1 / 127; 18504 case Uint8Array: 18505 return 1 / 255; 18506 case Int16Array: 18507 return 1 / 32767; 18508 case Uint16Array: 18509 return 1 / 65535; 18510 default: 18511 return 1; 18512 } 18513 }(r), a = e1.json.bufferViews[t1.bufferView], s = a.byteStride ? a.byteStride / r.BYTES_PER_ELEMENT : Rg[t1.type], l = i.float32, c = l.length / i.capacity, u = t1.count * s; 18514 for(let e1 = 0, t1 = 0; e1 < u; e1 += s, t1 += c)for(let i = 0; i < c; i++)l[t1 + i] = n[e1 + i] * o; 18515 } 18516 function Ty(e1, t1, i) { 18517 const n = e1.indices, r = e1.attributes, o = {}; 18518 o.indexArray = new uu; 18519 const a = t1.json.accessors[n], s = Iy(t1, a); 18520 o.indexArray.resizeExact(a.count / 3), o.indexArray.uint16.set(s), o.vertexArray = new Jc; 18521 const l = t1.json.accessors[r.POSITION], c = Iy(t1, l); 18522 o.vertexArray.resizeExact(l.count), o.vertexArray.float32.set(c), o.aabb = new Rf(l.min, l.max); 18523 const [u, h, d] = l.min, [f, p, m] = l.max; 18524 if (o.centroid = [ 18525 .5 * (u + f), 18526 .5 * (h + p), 18527 .5 * (d + m) 18528 ], void 0 !== r.COLOR_0) { 18529 const e1 = t1.json.accessors[r.COLOR_0], i = Rg[e1.type], n = Iy(t1, e1); 18530 o.colorArray = 3 === i ? new Jc : new nu, o.colorArray.resizeExact(e1.count), My(t1, e1, o.colorArray, n); 18531 } 18532 if (void 0 !== r.NORMAL) { 18533 o.normalArray = new Jc; 18534 const e1 = t1.json.accessors[r.NORMAL]; 18535 o.normalArray.resizeExact(e1.count); 18536 const i = Iy(t1, e1); 18537 My(t1, e1, o.normalArray, i); 18538 } 18539 if (void 0 !== r.TEXCOORD_0 && i.length > 0) { 18540 o.texcoordArray = new yu; 18541 const e1 = t1.json.accessors[r.TEXCOORD_0]; 18542 o.texcoordArray.resizeExact(e1.count); 18543 const i = Iy(t1, e1); 18544 My(t1, e1, o.texcoordArray, i); 18545 } 18546 if (void 0 !== r._FEATURE_ID_RGBA4444) { 18547 const e1 = t1.json.accessors[r._FEATURE_ID_RGBA4444]; 18548 t1.json.extensionsUsed && t1.json.extensionsUsed.includes("EXT_meshopt_compression") && (o.featureData = Iy(t1, e1)); 18549 } 18550 void 0 !== r._FEATURE_RGBA4444 && (o.featureData = new Uint32Array(Iy(t1, t1.json.accessors[r._FEATURE_RGBA4444]).buffer)); 18551 const _ = e1.material; 18552 return o.material = function(e1, t1) { 18553 const { emissiveFactor: i = [ 18554 0, 18555 0, 18556 0 18557 ], alphaMode: n = "OPAQUE", alphaCutoff: r = .5, normalTexture: o, occlusionTexture: a, emissiveTexture: s, doubleSided: l, name: c } = e1, { baseColorFactor: u = [ 18558 1, 18559 1, 18560 1, 18561 1 18562 ], metallicFactor: h = 1, roughnessFactor: d = 1, baseColorTexture: f, metallicRoughnessTexture: p } = e1.pbrMetallicRoughness || {}, m = a ? t1[a.index] : void 0; 18563 if (a && a.extensions && a.extensions.KHR_texture_transform && m) { 18564 const e1 = a.extensions.KHR_texture_transform; 18565 m.offsetScale = [ 18566 e1.offset[0], 18567 e1.offset[1], 18568 e1.scale[0], 18569 e1.scale[1] 18570 ]; 18571 } 18572 return { 18573 name: c, 18574 pbrMetallicRoughness: { 18575 baseColorFactor: new mn(...u), 18576 metallicFactor: h, 18577 roughnessFactor: d, 18578 baseColorTexture: f ? t1[f.index] : void 0, 18579 metallicRoughnessTexture: p ? t1[p.index] : void 0 18580 }, 18581 doubleSided: l, 18582 emissiveFactor: new mn(...i), 18583 alphaMode: n, 18584 alphaCutoff: r, 18585 normalTexture: o ? t1[o.index] : void 0, 18586 occlusionTexture: m, 18587 emissionTexture: s ? t1[s.index] : void 0, 18588 defined: void 0 === e1.defined 18589 }; 18590 }(void 0 !== _ ? t1.json.materials[_] : { 18591 defined: !1 18592 }, i), o; 18593 } 18594 function Sy(e1, t1, i) { 18595 const { matrix: n, rotation: r, translation: o, scale: a, mesh: s, extras: l, children: c, name: h } = e1, d = {}; 18596 if (d.name = h, d.localMatrix = n || function(e1, t1, i, n) { 18597 var r = t1[0], o = t1[1], a = t1[2], s = t1[3], l = r + r, c = o + o, u = a + a, h = r * l, d = r * c, f = r * u, p = o * c, m = o * u, _ = a * u, g = s * l, y = s * c, x = s * u, v = n[0], b = n[1], w = n[2]; 18598 return e1[0] = (1 - (p + _)) * v, e1[1] = (d + x) * v, e1[2] = (f - y) * v, e1[3] = 0, e1[4] = (d - x) * b, e1[5] = (1 - (h + _)) * b, e1[6] = (m + g) * b, e1[7] = 0, e1[8] = (f + y) * w, e1[9] = (m - g) * w, e1[10] = (1 - (h + p)) * w, e1[11] = 0, e1[12] = i[0], e1[13] = i[1], e1[14] = i[2], e1[15] = 1, e1; 18599 }([], r || [ 18600 0, 18601 0, 18602 0, 18603 1 18604 ], o || [ 18605 0, 18606 0, 18607 0 18608 ], a || [ 18609 1, 18610 1, 18611 1 18612 ]), d.globalMatrix = u(d.localMatrix), void 0 !== s) { 18613 d.meshes = i[s]; 18614 const e1 = d.anchor = [ 18615 0, 18616 0 18617 ]; 18618 for (const t1 of d.meshes){ 18619 const { min: i, max: n } = t1.aabb; 18620 e1[0] += i[0] + n[0], e1[1] += i[1] + n[1]; 18621 } 18622 e1[0] = Math.floor(e1[0] / d.meshes.length / 2), e1[1] = Math.floor(e1[1] / d.meshes.length / 2); 18623 } 18624 if (l && (l.id && (d.id = l.id), l.lights && (d.lights = function(e1) { 18625 if (!e1.length) return []; 18626 const t1 = function(e1) { 18627 const t1 = atob(e1), i = new Uint8Array(t1.length); 18628 for(let e1 = 0; e1 < t1.length; e1++)i[e1] = t1.codePointAt(e1); 18629 return i; 18630 }(e1), i = [], n = t1.length / 24, r = new Uint16Array(t1.buffer), o = new Float32Array(t1.buffer); 18631 for(let e1 = 0; e1 < n; e1++){ 18632 const t1 = r[2 * e1 * 6] / 30, n = r[2 * e1 * 6 + 1] / 30, a = r[2 * e1 * 6 + 10] / 100, s = o[6 * e1 + 1], l = o[6 * e1 + 2], c = o[6 * e1 + 3], u = o[6 * e1 + 4], h = c - s, d = u - l, f = Math.hypot(h, d); 18633 i.push({ 18634 pos: [ 18635 s + .5 * h, 18636 l + .5 * d, 18637 n 18638 ], 18639 normal: [ 18640 d / f, 18641 -h / f, 18642 0 18643 ], 18644 width: f, 18645 height: t1, 18646 depth: a, 18647 points: [ 18648 s, 18649 l, 18650 c, 18651 u 18652 ] 18653 }); 18654 } 18655 return i; 18656 }(l.lights)), l.MAPBOX_geometry_bloom && (d.isGeometryBloom = l.MAPBOX_geometry_bloom), l.MAPBOX_zoom_min && (d.minZoom = l.MAPBOX_zoom_min), l.MAPBOX_zoom_max && (d.maxZoom = l.MAPBOX_zoom_max)), c) { 18657 const e1 = []; 18658 for (const n of c)e1.push(Sy(t1.json.nodes[n], t1, i)); 18659 d.children = e1; 18660 } 18661 if (e1.extensions && e1.extensions.mbx_bvh && (d.meshBVH = function(e1, t1, i) { 18662 const n = t1.binaryAccessor, r = t1.positionMinAccessor, o = t1.positionMaxAccessor, a = t1.indexAccessor; 18663 if (!(Number.isInteger(n) && Number.isInteger(r) && Number.isInteger(o) && Number.isInteger(a))) return null; 18664 const s = e1.json.accessors; 18665 if (n >= s.length || r >= s.length || o >= s.length || a >= s.length) return null; 18666 const l = s[n], c = s[r], u = s[o], h = s[a]; 18667 if (void 0 === l.bufferView || void 0 === c.bufferView || void 0 === u.bufferView || void 0 === h.bufferView) return null; 18668 const d = e1.json.bufferViews; 18669 if (l.bufferView >= d.length || c.bufferView >= d.length || u.bufferView >= d.length || h.bufferView >= d.length) return null; 18670 const f = d[l.bufferView], p = d[c.bufferView], m = d[u.bufferView], _ = d[h.bufferView]; 18671 if (f.buffer >= e1.buffers.length || p.buffer >= e1.buffers.length || m.buffer >= e1.buffers.length || _.buffer >= e1.buffers.length) return null; 18672 const g = (e1, t1, i)=>e1 >= 0 && e1 <= i && t1 <= i - e1, y = l.byteOffset || 0, x = c.byteOffset || 0, v = u.byteOffset || 0, b = h.byteOffset || 0; 18673 if (!(g(y, 0, f.byteLength) && g(x, 3 * c.count * 4, p.byteLength) && g(v, 3 * u.count * 4, m.byteLength) && g(b, 4 * h.count, _.byteLength))) return null; 18674 const w = new Uint8Array(e1.buffers[f.buffer], (f.byteOffset || 0) + y, f.byteLength - y), A = new Float32Array(e1.buffers[p.buffer], (p.byteOffset || 0) + x, 3 * c.count), E = new Float32Array(e1.buffers[m.buffer], (m.byteOffset || 0) + v, 3 * u.count), I = new Uint32Array(e1.buffers[_.buffer], (_.byteOffset || 0) + b, h.count), M = new Ey; 18675 if (M.serializeFromGltf(w, A, E, I), void 0 !== i && e1.json.meshes && e1.json.meshes[i]) { 18676 const t1 = e1.json.meshes[i].primitives[0]; 18677 if (t1 && void 0 !== t1.attributes.POSITION && t1.attributes.POSITION < s.length) { 18678 const i = s[t1.attributes.POSITION]; 18679 if (void 0 !== i.bufferView && i.bufferView < d.length) { 18680 const t1 = d[i.bufferView]; 18681 if (t1.buffer < e1.buffers.length) { 18682 const n = i.byteOffset || 0, r = t1.byteStride ? t1.byteStride / 4 : 3; 18683 if (g(n, i.count * r * 4, t1.byteLength)) { 18684 const o = (t1.byteOffset || 0) + n; 18685 if (3 === r) M.setVertices(new Float32Array(e1.buffers[t1.buffer], o, 3 * i.count)); 18686 else { 18687 const n = new Float32Array(e1.buffers[t1.buffer], o, i.count * r), a = new Float32Array(3 * i.count); 18688 for(let e1 = 0; e1 < i.count; e1++)a[3 * e1] = n[e1 * r], a[3 * e1 + 1] = n[e1 * r + 1], a[3 * e1 + 2] = n[e1 * r + 2]; 18689 M.setVertices(a); 18690 } 18691 } 18692 } 18693 } 18694 } 18695 } 18696 return M; 18697 }(t1, e1.extensions.mbx_bvh, s)), !d.meshBVH && d.children) { 18698 for (const e1 of d.children)if (e1.meshBVH) { 18699 d.meshBVH = e1.meshBVH; 18700 break; 18701 } 18702 } 18703 return d; 18704 } 18705 function zy(e1) { 18706 if (0 === e1.vertices.length || 0 === e1.indices.length) return null; 18707 const t1 = new Hg(e1.vertices, e1.indices, 8, 256), [i, n] = [ 18708 t1.min.clone(), 18709 t1.max.clone() 18710 ]; 18711 return { 18712 vertices: e1.vertices, 18713 indices: e1.indices, 18714 grid: t1, 18715 min: i, 18716 max: n 18717 }; 18718 } 18719 function Ry(e1) { 18720 if (!e1.extras || !e1.extras.ground) return null; 18721 const t1 = e1.extras.ground; 18722 if (!t1 || !Array.isArray(t1) || 0 === t1.length) return null; 18723 const i = t1[0]; 18724 if (!i || !Array.isArray(i) || 0 === i.length) return null; 18725 const n = []; 18726 for (const e1 of i){ 18727 if (!Array.isArray(e1) || 2 !== e1.length) continue; 18728 const t1 = e1[0], i = e1[1]; 18729 "number" == typeof t1 && "number" == typeof i && n.push(new Pe(t1, i)); 18730 } 18731 if (n.length < 3) return null; 18732 n.length > 1 && n.at(-1).equals(n[0]) && n.pop(); 18733 let r = 0; 18734 for(let e1 = 0; e1 < n.length; e1++){ 18735 const t1 = n[e1], i = n[(e1 + 1) % n.length], o = n[(e1 + 2) % n.length]; 18736 r += (t1.x - i.x) * (o.y - i.y) - (o.x - i.x) * (t1.y - i.y); 18737 } 18738 r > 0 && n.reverse(); 18739 const o = Dl(n.flatMap((e1)=>[ 18740 e1.x, 18741 e1.y 18742 ]), []); 18743 return 0 === o.length ? null : { 18744 vertices: n, 18745 indices: o 18746 }; 18747 } 18748 function Py(e1, t1) { 18749 const i = [], n = []; 18750 let r = 0; 18751 const o = []; 18752 for (const a of e1){ 18753 r = i.length; 18754 const e1 = a.vertexArray.float32, s = a.indexArray.uint16; 18755 for(let n = 0; n < a.vertexArray.length; n++)o[0] = e1[3 * n + 0], o[1] = e1[3 * n + 1], o[2] = e1[3 * n + 2], Y(o, o, t1), i.push(new Pe(o[0], o[1])); 18756 for(let e1 = 0; e1 < 3 * a.indexArray.length; e1++)n.push(s[e1] + r); 18757 } 18758 if (n.length % 3 != 0) return null; 18759 for(let e1 = 0; e1 < n.length; e1 += 3){ 18760 const t1 = i[n[e1 + 0]], r = i[n[e1 + 1]], o = i[n[e1 + 2]]; 18761 (t1.x - r.x) * (o.y - r.y) - (o.x - r.x) * (t1.y - r.y) > 0 && ([n[e1 + 1], n[e1 + 2]] = [ 18762 n[e1 + 2], 18763 n[e1 + 1] 18764 ]); 18765 } 18766 return { 18767 vertices: i, 18768 indices: n 18769 }; 18770 } 18771 function Dy(e1, t1) { 18772 for(let i = 0; i < e1.length; i++)if (e1[i].name === t1) return i; 18773 return -1; 18774 } 18775 function Fy(e1) { 18776 const t1 = function(e1, t1) { 18777 const i = [], n = WebGL2RenderingContext; 18778 if (e1.json.textures) for (const r of e1.json.textures){ 18779 const o = { 18780 magFilter: n.LINEAR, 18781 minFilter: n.NEAREST, 18782 wrapS: n.REPEAT, 18783 wrapT: n.REPEAT 18784 }; 18785 void 0 !== r.sampler && Object.assign(o, e1.json.samplers[r.sampler]), i.push({ 18786 image: t1[r.source], 18787 sampler: o, 18788 uploaded: !1 18789 }); 18790 } 18791 return i; 18792 }(e1, e1.images), i = function(e1, t1) { 18793 const i = []; 18794 if (!e1.json.meshes) return i; 18795 for (const n of e1.json.meshes){ 18796 const r = []; 18797 for (const i of n.primitives)r.push(Ty(i, e1, t1)); 18798 i.push(r); 18799 } 18800 return i; 18801 }(e1, t1), { scenes: n, scene: r, nodes: o } = e1.json; 18802 let a = n ? Dy(n, "Default Scene") : -1; 18803 a < 0 && (a = r || 0); 18804 const s = n && n[a] ? n[a].nodes || [] : [ 18805 ...o.keys() 18806 ], l = []; 18807 for (const t1 of s)l.push(Sy(o[t1], e1, i)); 18808 !function(e1, t1, i) { 18809 const n = {}, r = new Set; 18810 for(let o = 0; o < e1.length; o++){ 18811 const e1 = i[t1[o]]; 18812 if (!e1.extras) continue; 18813 const a = e1.extras["mapbox:footprint:version"], s = e1.extras["mapbox:footprint:id"]; 18814 (a || s) && r.add(o), "1.0.0" === a && s && (n[s] = o); 18815 } 18816 for(let o = 0; o < e1.length; o++){ 18817 if (r.has(o)) continue; 18818 const a = e1[o], s = i[t1[o]]; 18819 if (!s.extras) continue; 18820 let l = null; 18821 a.id in n && (l = Py(e1[n[a.id]].meshes, a.localMatrix)), l || (l = Ry(s)), l && (a.footprint = zy(l)); 18822 } 18823 if (r.size > 0) { 18824 const t1 = Array.from(r.values()).sort((e1, t1)=>e1 - t1); 18825 for(let i = t1.length - 1; i >= 0; i--)e1.splice(t1[i], 1); 18826 } 18827 }(l, s, e1.json.nodes); 18828 const c = n ? Dy(n, "LOD") : -1; 18829 if (c >= 0) { 18830 const t1 = n[c].nodes, r = new Map; 18831 for (const n of t1){ 18832 const t1 = Sy(o[n], e1, i); 18833 t1.id && r.set(t1.id, t1); 18834 } 18835 for (const e1 of l)if (e1.id) { 18836 const t1 = r.get(e1.id); 18837 t1 && t1.meshes && (e1.lodMeshes = t1.meshes, t1.meshBVH && (e1.meshBVH = t1.meshBVH)); 18838 } 18839 } 18840 return l; 18841 } 18842 function Cy(e1) { 18843 e1.heightmap = new Float32Array(4096), e1.heightmap.fill(-1); 18844 const t1 = e1.vertexArray.float32, i = e1.aabb.min[0] - 1, n = e1.aabb.min[1] - 1, r = uy / (e1.aabb.max[0] - i + 2), o = uy / (e1.aabb.max[1] - n + 2); 18845 for(let a = 0; a < t1.length; a += 3){ 18846 const s = t1[a + 2], l = (t1[a + 0] - i) * r | 0, c = (t1[a + 1] - n) * o | 0; 18847 s > e1.heightmap[c * uy + l] && (e1.heightmap[c * uy + l] = s); 18848 } 18849 } 18850 function Ly(e1, t1, i, n, r) { 18851 i.reserve(i.length + 4 * e1.length), n.reserve(n.length + 10 * e1.length), r.reserve(r.length + 10 * e1.length); 18852 let o = n.length; 18853 for (const a of e1){ 18854 const e1 = Math.min(10, Math.max(4, 1.3 * a.height)) * t1, s = [ 18855 -a.normal[1], 18856 a.normal[0], 18857 0 18858 ], l = Math.min(.29, .1 * a.width / a.depth), c = a.width - 2 * a.depth * t1 * (l + .01), u = U([], a.pos, s, c / 2), h = U([], a.pos, s, -c / 2), d = [ 18859 u[0], 18860 u[1], 18861 u[2] + a.height 18862 ], f = [ 18863 h[0], 18864 h[1], 18865 h[2] + a.height 18866 ], p = U([], a.normal, s, l); 18867 k(p, p, e1); 18868 const m = U([], a.normal, s, -l); 18869 k(m, m, e1), L(p, u, p), L(m, h, m), u[2] += .1, h[2] += .1, n.emplaceBack(p[0], p[1], p[2]), n.emplaceBack(m[0], m[1], m[2]), n.emplaceBack(u[0], u[1], u[2]), n.emplaceBack(h[0], h[1], h[2]), n.emplaceBack(d[0], d[1], d[2]), n.emplaceBack(f[0], f[1], f[2]), n.emplaceBack(u[0], u[1], u[2]), n.emplaceBack(h[0], h[1], h[2]), n.emplaceBack(p[0], p[1], p[2]), n.emplaceBack(m[0], m[1], m[2]); 18870 const _ = c / e1 / 2; 18871 r.emplaceBack(-_ - l, -1, _, .8), r.emplaceBack(_ + l, -1, _, .8), r.emplaceBack(-_, 0, _, 1.3), r.emplaceBack(_, 0, _, 1.3), r.emplaceBack(_ + l, -.8, _, .7), r.emplaceBack(_ + l, -.8, _, .7), r.emplaceBack(0, 0, _, 1.3), r.emplaceBack(0, 0, _, 1.3), r.emplaceBack(_ + l, -1.2, _, .8), r.emplaceBack(_ + l, -1.2, _, .8), i.emplaceBack(6 + o, 4 + o, 8 + o), i.emplaceBack(7 + o, 9 + o, 5 + o), i.emplaceBack(0 + o, 1 + o, 2 + o), i.emplaceBack(1 + o, 3 + o, 2 + o), o += 10; 18872 } 18873 } 18874 function Oy(e1, t1) { 18875 const i = {}; 18876 i.indexArray = new uu, i.vertexArray = new Jc, i.colorArray = new nu, i.indexArray.reserveExact(4 * e1.length), i.vertexArray.reserveExact(10 * e1.length), i.colorArray.reserveExact(10 * e1.length), Ly(e1, t1, i.indexArray, i.vertexArray, i.colorArray); 18877 const n = { 18878 defined: !0 18879 }; 18880 n.emissiveFactor = mn.black; 18881 const r = {}; 18882 return r.baseColorFactor = mn.white, n.pbrMetallicRoughness = r, i.material = n, i.aabb = new Rf([ 18883 1 / 0, 18884 1 / 0, 18885 1 / 0 18886 ], [ 18887 -1 / 0, 18888 -1 / 0, 18889 -1 / 0 18890 ]), i; 18891 } 18892 Xa(Ey, "ModelBVH"); 18893 const By = kc([ 18894 { 18895 name: "a_pos_3f", 18896 components: 3, 18897 type: "Float32" 18898 } 18899 ]), Vy = kc([ 18900 { 18901 name: "a_normal_3", 18902 components: 3, 18903 type: "Int16" 18904 } 18905 ]), Ny = kc([ 18906 { 18907 name: "a_centroid_3", 18908 components: 3, 18909 type: "Int16" 18910 } 18911 ]), ky = kc([ 18912 { 18913 name: "a_part_color_emissive", 18914 components: 2, 18915 type: "Uint16" 18916 } 18917 ]), Uy = kc([ 18918 { 18919 name: "a_faux_facade_color_emissive", 18920 components: 2, 18921 type: "Uint16" 18922 } 18923 ]), jy = kc([ 18924 { 18925 name: "a_faux_facade_data", 18926 components: 4, 18927 type: "Uint16" 18928 } 18929 ]), Gy = kc([ 18930 { 18931 name: "a_faux_facade_vertical_range", 18932 components: 2, 18933 type: "Uint16" 18934 } 18935 ]), Hy = kc([ 18936 { 18937 name: "a_bloom_attenuation", 18938 components: 4, 18939 type: "Float32" 18940 } 18941 ]), $y = kc([ 18942 { 18943 name: "a_flood_light_wall_radius_1i16", 18944 components: 1, 18945 type: "Int16" 18946 } 18947 ]), Zy = kc([ 18948 { 18949 name: "a_pos_normal_ed", 18950 components: 4, 18951 type: "Int16" 18952 } 18953 ]), Wy = kc([ 18954 { 18955 name: "a_pos_end", 18956 components: 4, 18957 type: "Int16" 18958 }, 18959 { 18960 name: "a_angular_offset_factor", 18961 components: 1, 18962 type: "Int16" 18963 } 18964 ]), qy = kc([ 18965 { 18966 name: "a_flood_light_ground_radius", 18967 components: 1, 18968 type: "Float32" 18969 } 18970 ]), Xy = kc([ 18971 { 18972 name: "a_centroid_pos", 18973 components: 2, 18974 type: "Uint16" 18975 } 18976 ]), Yy = kc([ 18977 { 18978 name: "a_join_normal_inside", 18979 components: 3, 18980 type: "Int16" 18981 } 18982 ]), Jy = kc([ 18983 { 18984 name: "a_hidden_by_landmark", 18985 components: 1, 18986 type: "Uint8" 18987 } 18988 ]), Ky = kc([ 18989 { 18990 name: "a_pos_3", 18991 components: 3, 18992 type: "Int16" 18993 }, 18994 { 18995 name: "a_pos_normal_3", 18996 components: 3, 18997 type: "Int16" 18998 } 18999 ]), { members: Qy } = Zy; 19000 function ex(e1, t1, i, n) { 19001 const r = [], o = 0 === n ? (e1, t1, i, n, r, o)=>{ 19002 e1.push(new Pe(o, i + (o - t1) / (n - t1) * (r - i))); 19003 } : (e1, t1, i, n, r, o)=>{ 19004 e1.push(new Pe(t1 + (o - i) / (r - i) * (n - t1), o)); 19005 }; 19006 for (const a of e1){ 19007 const e1 = []; 19008 for (const r of a){ 19009 if (r.length <= 2) continue; 19010 const a = []; 19011 for(let e1 = 0; e1 < r.length - 1; e1++){ 19012 const s = r[e1].x, l = r[e1].y, c = r[e1 + 1].x, u = r[e1 + 1].y, h = 0 === n ? s : l, d = 0 === n ? c : u; 19013 h < t1 ? d > t1 && o(a, s, l, c, u, t1) : h > i ? d < i && o(a, s, l, c, u, i) : a.push(r[e1]), d < t1 && h >= t1 && o(a, s, l, c, u, t1), d > i && h <= i && o(a, s, l, c, u, i); 19014 } 19015 let s = r.at(-1); 19016 const l = 0 === n ? s.x : s.y; 19017 l >= t1 && l <= i && a.push(s), a.length && (s = a.at(-1), a[0].x === s.x && a[0].y === s.y || a.push(a[0]), e1.push(a)); 19018 } 19019 e1.length && r.push(e1); 19020 } 19021 return r; 19022 } 19023 const tx = { 19024 None: 0, 19025 Model: 1, 19026 Symbol: 2, 19027 FillExtrusion: 4 19028 }, ix = [ 19029 new Pe(0, 0), 19030 new Pe(zr, 0), 19031 new Pe(zr, zr), 19032 new Pe(0, zr) 19033 ]; 19034 function nx(e1, t1) { 19035 const i = []; 19036 let n = []; 19037 if (!t1 || e1.length < 2) return [ 19038 e1 19039 ]; 19040 if (2 === e1.length) return Yh(e1[0], e1[1], ix) ? [ 19041 e1 19042 ] : []; 19043 for(let t1 = 0; t1 < e1.length + 2; t1++){ 19044 const r = 0 === t1 ? e1.at(-1) : e1[(t1 - 1) % e1.length], o = e1[t1 % e1.length], a = e1[(t1 + 1) % e1.length], s = Yh(r, o, ix), l = Yh(o, a, ix), c = s || l; 19045 c && n.push(o), c && l || n.length > 0 && (n.length > 1 && i.push(n), n = []); 19046 } 19047 return n.length > 1 && i.push(n), i; 19048 } 19049 const rx = Dh.types, ox = [ 19050 "fill-extrusion-base", 19051 "fill-extrusion-height", 19052 "fill-extrusion-color", 19053 "fill-extrusion-pattern", 19054 "fill-extrusion-flood-light-wall-radius", 19055 "fill-extrusion-line-width", 19056 "fill-extrusion-emissive-strength" 19057 ], ax = [ 19058 "fill-extrusion-flood-light-ground-radius" 19059 ], sx = Math.pow(2, 13), lx = Math.pow(2, 15) - 1, cx = new Pe(0, 1), ux = 2147483648, hx = 1073741824; 19060 function dx(e1, t1, i, n, r, o, a, s) { 19061 e1.emplaceBack((t1 << 1) + a, (i << 1) + o, (Math.floor(n * sx) << 1) + r, Math.round(s)); 19062 } 19063 function fx(e1, t1, i) { 19064 e1.emplaceBack(t1.x * zr, t1.y * zr, i ? 1 : 0); 19065 } 19066 function px(e1, t1, i, n, r, o) { 19067 e1.emplaceBack(t1.x, t1.y, (i.x << 1) + n, (i.y << 1) + r, o); 19068 } 19069 function mx(e1, t1, i) { 19070 const n = 16384; 19071 e1.emplaceBack(t1.x, t1.y, t1.z, i[0] * n, i[1] * n, i[2] * n); 19072 } 19073 class _x { 19074 constructor(){ 19075 this.vertexOffset = 0, this.vertexCount = 0, this.indexOffset = 0, this.indexCount = 0; 19076 } 19077 } 19078 class gx { 19079 get length() { 19080 return this.data.length; 19081 } 19082 push(e1) { 19083 this.data.push(e1); 19084 } 19085 get(e1) { 19086 return this.data[e1]; 19087 } 19088 static serialize(e1, t1) { 19089 const i = e1.data.length, n = new Uint32Array(4 * i), r = []; 19090 r.length = i; 19091 for(let t1 = 0; t1 < i; t1++){ 19092 const i = e1.data[t1], o = 4 * t1; 19093 n[o] = i.vertexOffset, n[o + 1] = i.vertexCount, n[o + 2] = i.indexOffset, n[o + 3] = i.indexCount, r[t1] = i.ringIndices; 19094 } 19095 return t1 && t1.add(n.buffer), { 19096 scalars: n, 19097 rings: r 19098 }; 19099 } 19100 static deserialize(e1) { 19101 const { scalars: t1, rings: i } = e1, n = t1.length / 4, r = new gx, o = []; 19102 o.length = n, r.data = o; 19103 for(let e1 = 0; e1 < n; e1++){ 19104 const n = 4 * e1, o = new _x; 19105 o.vertexOffset = t1[n], o.vertexCount = t1[n + 1], o.indexOffset = t1[n + 2], o.indexCount = t1[n + 3], o.ringIndices = i[e1], r.data[e1] = o; 19106 } 19107 return r; 19108 } 19109 constructor(){ 19110 this.data = []; 19111 } 19112 } 19113 class yx { 19114 span() { 19115 return new Pe(this.max.x - this.min.x, this.max.y - this.min.y); 19116 } 19117 constructor(){ 19118 this.centroidXY = new Pe(0, 0), this.vertexArrayOffset = 0, this.vertexCount = 0, this.groundVertexArrayOffset = 0, this.groundVertexCount = 0, this.flags = 0, this.footprintSegIdx = -1, this.footprintSegLen = 0, this.polygonSegIdx = -1, this.polygonSegLen = 0, this.min = new Pe(Number.MAX_VALUE, Number.MAX_VALUE), this.max = new Pe(-Number.MAX_VALUE, -Number.MAX_VALUE), this.height = 0, this.buildingId = 0, this.groupCentroidPos = new Pe(0, 0); 19119 } 19120 } 19121 class xx { 19122 get length() { 19123 return this.data.length; 19124 } 19125 push(e1) { 19126 this.data.push(e1); 19127 } 19128 get(e1) { 19129 return this.data[e1]; 19130 } 19131 find(e1) { 19132 return this.data.find(e1); 19133 } 19134 [Symbol.iterator]() { 19135 return this.data[Symbol.iterator](); 19136 } 19137 static serialize(e1, t1) { 19138 const i = e1.data.length, n = new Float64Array(15 * i); 19139 for(let t1 = 0; t1 < i; t1++){ 19140 const i = e1.data[t1], r = 15 * t1; 19141 n[r] = i.centroidXY.x, n[r + 1] = i.centroidXY.y, n[r + 2] = i.min.x, n[r + 3] = i.min.y, n[r + 4] = i.max.x, n[r + 5] = i.max.y, n[r + 6] = i.groupCentroidPos.x, n[r + 7] = i.groupCentroidPos.y, n[r + 8] = i.vertexArrayOffset, n[r + 9] = i.vertexCount, n[r + 10] = i.groundVertexArrayOffset, n[r + 11] = i.groundVertexCount, n[r + 12] = i.footprintSegLen, n[r + 13] = i.height, n[r + 14] = i.buildingId; 19142 } 19143 return t1 && t1.add(n.buffer), { 19144 buffer: n 19145 }; 19146 } 19147 static deserialize(e1) { 19148 const t1 = e1.buffer, i = t1.length / 15, n = new xx; 19149 n.buffer = t1; 19150 const r = []; 19151 r.length = i, n.data = r; 19152 let o = 0; 19153 for(let e1 = 0; e1 < i; e1++){ 19154 const i = 15 * e1, r = new yx; 19155 r.centroidXY = new Pe(t1[i], t1[i + 1]), r.min = new Pe(t1[i + 2], t1[i + 3]), r.max = new Pe(t1[i + 4], t1[i + 5]), r.groupCentroidPos = new Pe(t1[i + 6], t1[i + 7]), r.vertexArrayOffset = t1[i + 8], r.vertexCount = t1[i + 9], r.groundVertexArrayOffset = t1[i + 10], r.groundVertexCount = t1[i + 11], r.footprintSegLen = t1[i + 12], r.height = t1[i + 13], r.buildingId = t1[i + 14], r.footprintSegIdx = o, o += r.footprintSegLen, n.data[e1] = r; 19156 } 19157 return n; 19158 } 19159 constructor(){ 19160 this.data = [], this.buffer = null; 19161 } 19162 } 19163 class vx { 19164 startRing(e1, t1) { 19165 e1.min.x === Number.MAX_VALUE && (e1.min.x = e1.max.x = t1.x, e1.min.y = e1.max.y = t1.y); 19166 } 19167 appendEdge(e1, t1, i) { 19168 this.accCount++, this.acc._add(t1); 19169 let n = !!this.borders; 19170 t1.x < e1.min.x ? (e1.min.x = t1.x, n = !0) : t1.x > e1.max.x && (e1.max.x = t1.x, n = !0), t1.y < e1.min.y ? (e1.min.y = t1.y, n = !0) : t1.y > e1.max.y && (e1.max.y = t1.y, n = !0), ((0 === t1.x || t1.x === zr) && t1.x === i.x) != ((0 === t1.y || t1.y === zr) && t1.y === i.y) && this.processBorderOverlap(t1, i), n && this.checkBorderIntersection(t1, i); 19171 } 19172 checkBorderIntersection(e1, t1) { 19173 t1.x < 0 != e1.x < 0 && this.addBorderIntersection(0, fn(t1.y, e1.y, (0 - t1.x) / (e1.x - t1.x))), t1.x > zr != e1.x > zr && this.addBorderIntersection(1, fn(t1.y, e1.y, (zr - t1.x) / (e1.x - t1.x))), t1.y < 0 != e1.y < 0 && this.addBorderIntersection(2, fn(t1.x, e1.x, (0 - t1.y) / (e1.y - t1.y))), t1.y > zr != e1.y > zr && this.addBorderIntersection(3, fn(t1.x, e1.x, (zr - t1.y) / (e1.y - t1.y))); 19174 } 19175 addBorderIntersection(e1, t1) { 19176 this.borders || (this.borders = [ 19177 [ 19178 Number.MAX_VALUE, 19179 -Number.MAX_VALUE 19180 ], 19181 [ 19182 Number.MAX_VALUE, 19183 -Number.MAX_VALUE 19184 ], 19185 [ 19186 Number.MAX_VALUE, 19187 -Number.MAX_VALUE 19188 ], 19189 [ 19190 Number.MAX_VALUE, 19191 -Number.MAX_VALUE 19192 ] 19193 ]); 19194 const i = this.borders[e1]; 19195 t1 < i[0] && (i[0] = t1), t1 > i[1] && (i[1] = t1); 19196 } 19197 processBorderOverlap(e1, t1) { 19198 if (e1.x === t1.x) { 19199 if (e1.y === t1.y) return; 19200 const i = 0 === e1.x ? 0 : 1; 19201 this.addBorderIntersection(i, t1.y), this.addBorderIntersection(i, e1.y); 19202 } else { 19203 const i = 0 === e1.y ? 2 : 3; 19204 this.addBorderIntersection(i, t1.x), this.addBorderIntersection(i, e1.x); 19205 } 19206 } 19207 centroid() { 19208 return 0 === this.accCount ? new Pe(0, 0) : new Pe(Math.floor(Math.max(0, this.acc.x) / this.accCount), Math.floor(Math.max(0, this.acc.y) / this.accCount)); 19209 } 19210 intersectsCount() { 19211 return this.borders ? this.borders.reduce((e1, t1)=>e1 + +(t1[0] !== Number.MAX_VALUE), 0) : 0; 19212 } 19213 constructor(){ 19214 this.acc = new Pe(0, 0), this.accCount = 0, this.centroidDataIndex = 0; 19215 } 19216 } 19217 function bx(e1, t1) { 19218 const i = e1.add(t1)._unit(), n = it(e1.x * i.x + e1.y * i.y, -1, 1); 19219 var r, o, a; 19220 return a = Math.acos(n), Math.min(4, Math.max(-4, Math.tan(a))) / 4 * lx * ((r = e1).x * (o = t1).y - r.y * o.x < 0 ? -1 : 1); 19221 } 19222 const wx = [ 19223 (e1)=>e1.x < 0, 19224 (e1)=>e1.x > zr, 19225 (e1)=>e1.y < 0, 19226 (e1)=>e1.y > zr 19227 ]; 19228 function Ax(e1, t1, i, n) { 19229 const r = [ 19230 4 19231 ]; 19232 if (0 === n) return r; 19233 i._mult(n); 19234 const o = e1.sub(i), a = t1.sub(i), s = [ 19235 e1, 19236 t1, 19237 o, 19238 a 19239 ]; 19240 for(let e1 = 0; e1 < 4; e1++)for (const t1 of s)if (wx[e1](t1)) { 19241 r.push(e1); 19242 break; 19243 } 19244 return r; 19245 } 19246 class Ex { 19247 getDefaultSegment() { 19248 return this.regionSegments[4]; 19249 } 19250 hasData() { 19251 return 0 !== this.vertexArray.length; 19252 } 19253 addData(e1, t1, i) { 19254 let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1; 19255 const r = e1.length; 19256 if (r > 2) { 19257 let o = Math.max(0, this._segments.get().length - 1); 19258 const a = this._segments._prepareSegment(4 * r, this.vertexArray.length, 2 * this._segmentToGroundQuads[o].length); 19259 let s; 19260 o !== this._segments.get().length - 1 && (o++, this._segmentToGroundQuads[o] = [], this._segmentToRegionTriCounts[o] = [ 19261 0, 19262 0, 19263 0, 19264 0, 19265 0 19266 ]); 19267 { 19268 const t1 = e1[0], i = e1[1]; 19269 s = bx(t1.sub(e1[r - 1])._perp()._unit(), i.sub(t1)._perp()._unit()); 19270 } 19271 for(let l = 0; l < r; l++){ 19272 const c = l === r - 1 ? 0 : l + 1, u = e1[l], h = e1[c], d = e1[c === r - 1 ? 0 : c + 1], f = h.sub(u)._perp()._unit(), p = bx(f, d.sub(h)._perp()._unit()), m = s, _ = p; 19273 if (Dx(u, h, t1) || n && Fx(u, t1) && Fx(h, t1)) { 19274 s = p; 19275 continue; 19276 } 19277 const g = a.vertexLength; 19278 px(this.vertexArray, u, h, 1, 1, m), px(this.vertexArray, u, h, 1, 0, m), px(this.vertexArray, u, h, 0, 1, _), px(this.vertexArray, u, h, 0, 0, _), a.vertexLength += 4; 19279 const y = Ax(u, h, f, i); 19280 for (const e1 of y)this._segmentToGroundQuads[o].push({ 19281 id: g, 19282 region: e1 19283 }), this._segmentToRegionTriCounts[o][e1] += 2, a.primitiveLength += 2; 19284 s = p; 19285 } 19286 } 19287 } 19288 prepareBorderSegments() { 19289 if (!this.hasData()) return; 19290 const e1 = this._segments.get(), t1 = e1.length; 19291 for(let e1 = 0; e1 < t1; e1++)this._segmentToGroundQuads[e1].sort((e1, t1)=>e1.region - t1.region); 19292 for(let i = 0; i < t1; i++){ 19293 const t1 = this._segmentToGroundQuads[i], n = e1[i], r = this._segmentToRegionTriCounts[i]; 19294 r.reduce((e1, t1)=>e1 + t1, 0); 19295 let o = 0; 19296 for(let e1 = 0; e1 <= 4; e1++){ 19297 const t1 = r[e1]; 19298 if (0 !== t1) { 19299 let i = this.regionSegments[e1]; 19300 i || (i = this.regionSegments[e1] = new ju); 19301 const r = { 19302 vertexOffset: n.vertexOffset, 19303 primitiveOffset: n.primitiveOffset + o, 19304 vertexLength: n.vertexLength, 19305 primitiveLength: t1 19306 }; 19307 i.get().push(r); 19308 } 19309 o += t1; 19310 } 19311 for(let e1 = 0; e1 < t1.length; e1++){ 19312 const i = t1[e1].id; 19313 this.indexArray.emplaceBack(i, i + 1, i + 3), this.indexArray.emplaceBack(i, i + 3, i + 2); 19314 } 19315 } 19316 this._segmentToGroundQuads = null, this._segmentToRegionTriCounts = null, this._segments.destroy(), this._segments = null; 19317 } 19318 addPaintPropertiesData(e1, t1, i, n, r, o, a) { 19319 this.hasData() && this.programConfigurations.populatePaintArrays(this.vertexArray.length, e1, t1, i, n, r, o, void 0, a); 19320 } 19321 upload(e1) { 19322 this.hasData() && (this.vertexBuffer = e1.createVertexBuffer(this.vertexArray, Wy.members), this.indexBuffer = e1.createIndexBuffer(this.indexArray), null != this.groundRadiusArray && (this.groundRadiusBuffer = e1.createVertexBuffer(this.groundRadiusArray, qy.members))); 19323 } 19324 uploadPaintProperties(e1) { 19325 this.hasData() && this.programConfigurations.upload(e1); 19326 } 19327 update(e1, t1, i, n, r, o, a, s) { 19328 this.hasData() && this.programConfigurations.updatePaintArrays(e1, t1, i, n, r, o, a, s); 19329 } 19330 updateHiddenByLandmark(e1) { 19331 this.updateHiddenByLandmarkRange(e1.groundVertexArrayOffset, e1.groundVertexCount, !!(e1.flags & ux || e1.flags & hx)); 19332 } 19333 updateHiddenByLandmarkRange(e1, t1, i) { 19334 if (!this.hasData()) return; 19335 const n = t1 + e1; 19336 if (0 !== t1) { 19337 for(let t1 = e1; t1 < n; ++t1)this.hiddenByLandmarkVertexArray.emplace(t1, i ? 1 : 0); 19338 this._needsHiddenByLandmarkUpdate = !0; 19339 } 19340 } 19341 uploadHiddenByLandmark(e1) { 19342 this.hasData() && this._needsHiddenByLandmarkUpdate && (!this.hiddenByLandmarkVertexBuffer && this.hiddenByLandmarkVertexArray.length > 0 ? this.hiddenByLandmarkVertexBuffer = e1.createVertexBuffer(this.hiddenByLandmarkVertexArray, Jy.members, !0) : this.hiddenByLandmarkVertexBuffer && this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray), this._needsHiddenByLandmarkUpdate = !1); 19343 } 19344 destroy() { 19345 if (this.vertexBuffer) { 19346 this.vertexBuffer.destroy(), this.indexBuffer.destroy(), this.hiddenByLandmarkVertexBuffer && this.hiddenByLandmarkVertexBuffer.destroy(), this.groundRadiusBuffer && this.groundRadiusBuffer.destroy(), this._segments && this._segments.destroy(), this.programConfigurations.destroy(); 19347 for(let e1 = 0; e1 <= 4; e1++){ 19348 const t1 = this.regionSegments[e1]; 19349 t1 && t1.destroy(); 19350 } 19351 } 19352 } 19353 constructor(e1){ 19354 this.groundRadiusArray = null, this.groundRadiusBuffer = null, this.vertexArray = new Xc, this.indexArray = new uu, this.programConfigurations = new mh(e1.layers, { 19355 zoom: e1.zoom, 19356 lut: e1.lut 19357 }, (e1)=>ax.includes(e1)), this._segments = new ju, this.hiddenByLandmarkVertexArray = new Eu, this._segmentToGroundQuads = {}, this._segmentToGroundQuads[0] = [], this._segmentToRegionTriCounts = {}, this._segmentToRegionTriCounts[0] = [ 19358 0, 19359 0, 19360 0, 19361 0, 19362 0 19363 ], this.regionSegments = {}, this.regionSegments[4] = new ju; 19364 } 19365 } 19366 class Ix { 19367 updateFootprints(e1, t1) {} 19368 updateAppearances(e1, t1, i, n) { 19369 return { 19370 hasLayoutChanges: !1, 19371 hasUboChanges: !1 19372 }; 19373 } 19374 populate(e1, t1, i, n) { 19375 this.features = [], this.hasPattern = oc("fill-extrusion", this.layers, this.pixelRatio, t1), this.featuresOnBorder = [], this.borderFeatureIndices = [ 19376 [], 19377 [], 19378 [], 19379 [] 19380 ], this.borderDoneWithNeighborZ = [ 19381 -1, 19382 -1, 19383 -1, 19384 -1 19385 ], this.selfDEMTileTimestamp = Number.MAX_VALUE, this.borderDEMTileTimestamp = [ 19386 Number.MAX_VALUE, 19387 Number.MAX_VALUE, 19388 Number.MAX_VALUE, 19389 Number.MAX_VALUE 19390 ], this.tileToMeter = Ic(i), this.edgeRadius = this.layers[0].layout.get("fill-extrusion-edge-radius") / this.tileToMeter, this.wallMode = 0 !== this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1); 19391 for (const { feature: r, id: o, index: a, sourceLayerIndex: s } of e1){ 19392 const e1 = this.layers[0]._featureFilter.needGeometry, l = Lc(r, e1); 19393 if (!this.layers[0]._featureFilter.filter(new $s(this.zoom, { 19394 worldview: this.worldview, 19395 activeFloors: t1.activeFloors 19396 }), l, i)) continue; 19397 const c = { 19398 id: o, 19399 sourceLayerIndex: s, 19400 index: a, 19401 geometry: e1 ? l.geometry : Cc(r, i, n), 19402 properties: r.properties, 19403 type: r.type, 19404 patterns: {} 19405 }, u = this.layoutVertexArray.length, h = "Polygon" === rx[c.type]; 19406 if (this.hasPattern) this.features.push({ 19407 featureId: r.id, 19408 feature: ac("fill-extrusion", this.layers, c, this.zoom, this.pixelRatio, t1) 19409 }); 19410 else if (this.wallMode) for (const e1 of c.geometry)for (const o of nx(e1, h))this.addFeature(r.id, c, [ 19411 o 19412 ], a, i, {}, t1.availableImages, n, t1.brightness); 19413 else this.addFeature(r.id, c, c.geometry, a, i, {}, t1.availableImages, n, t1.brightness); 19414 t1.featureIndex.insert(r, c.geometry, a, s, this.index, u); 19415 } 19416 this._finalizeBuildingGroups(), this.sortBorders(), "mercator" === this.projection.name && this.splitToSubtiles(), this.groundEffect.prepareBorderSegments(), this.polygonSegments.length = 0; 19417 } 19418 addFeatures(e1, t1, i, n, r, o) { 19419 for (const { featureId: e1, feature: a } of this.features){ 19420 const s = "Polygon" === rx[a.type], { geometry: l } = a; 19421 if (this.wallMode) for (const c of l)for (const l of nx(c, s))this.addFeature(e1, a, [ 19422 l 19423 ], a.index, t1, i, n, r, o); 19424 else this.addFeature(e1, a, l, a.index, t1, i, n, r, o); 19425 } 19426 this._finalizeBuildingGroups(), this.sortBorders(), "mercator" === this.projection.name && this.splitToSubtiles(); 19427 } 19428 update(e1, t1, i, n, r, o, a) { 19429 this.programConfigurations.updatePaintArrays(e1, t1, r, i, n, o, a, this.worldview), this.groundEffect.update(e1, t1, r, i, n, o, a, this.worldview); 19430 } 19431 updateExpressions(e1) { 19432 this.programConfigurations.updateExpressions(e1), this.groundEffect.programConfigurations.updateExpressions(e1); 19433 } 19434 isEmpty() { 19435 return 0 === this.layoutVertexArray.length; 19436 } 19437 uploadPending() { 19438 return !this.uploaded || this.programConfigurations.needsUpload || this.groundEffect.programConfigurations.needsUpload; 19439 } 19440 upload(e1) { 19441 this.uploaded || (this.layoutVertexBuffer = e1.createVertexBuffer(this.layoutVertexArray, Qy), this.indexBuffer = e1.createIndexBuffer(this.indexArray), this.wallVertexBuffer = e1.createVertexBuffer(this.wallVertexArray, Yy.members), this.layoutVertexExtArray && (this.layoutVertexExtBuffer = e1.createVertexBuffer(this.layoutVertexExtArray, Ky.members, !0)), this.groundEffect.upload(e1)), this.groundEffect.uploadPaintProperties(e1), this.programConfigurations.upload(e1), this.uploaded = !0; 19442 } 19443 uploadCentroid(e1) { 19444 this.groundEffect.uploadHiddenByLandmark(e1), this.needsCentroidUpdate && (!this.centroidVertexBuffer && this.centroidVertexArray.length > 0 ? this.centroidVertexBuffer = e1.createVertexBuffer(this.centroidVertexArray, Xy.members, !0) : this.centroidVertexBuffer && this.centroidVertexBuffer.updateData(this.centroidVertexArray), this.needsCentroidUpdate = !1); 19445 } 19446 destroy() { 19447 this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.centroidVertexBuffer && this.centroidVertexBuffer.destroy(), this.layoutVertexExtBuffer && this.layoutVertexExtBuffer.destroy(), this.groundEffect.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy()); 19448 } 19449 addFeature(e1, t1, i, n, r, o, a, s, l) { 19450 const c = this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t1, {}) / this.tileToMeter, u = [ 19451 new Pe(0, 0), 19452 new Pe(zr, zr) 19453 ], h = s.projection, d = "globe" === h.name, f = this.wallMode || "Polygon" === rx[t1.type], p = new vx; 19454 p.centroidDataIndex = this.centroidData.length; 19455 const m = new yx; 19456 m.buildingId = e1, t1.properties && Object.hasOwn(t1.properties, "building_id") && (m.buildingId = Number(t1.properties.building_id)), p.buildingId = m.buildingId; 19457 const _ = this.layers[0].paint.get("fill-extrusion-base").evaluate(t1, {}, r) <= 0, g = this.layers[0].paint.get("fill-extrusion-height").evaluate(t1, {}, r); 19458 let y; 19459 if (m.height = g, m.vertexArrayOffset = this.layoutVertexArray.length, m.groundVertexArrayOffset = this.groundEffect.vertexArray.length, d && !this.layoutVertexExtArray && (this.layoutVertexExtArray = new eu), this.wallMode) { 19460 if (d) return void gt("Non zero fill-extrusion-line-width is not yet supported on globe."); 19461 if (1 !== i.length) return; 19462 y = function(e1) { 19463 const t1 = e1[0].x === e1.at(-1).x && e1[0].y === e1.at(-1).y, i = function(e1) { 19464 let t1 = 0; 19465 const i = e1.length; 19466 for(let n = 0; n < i; n++)t1 += (e1[(n + 1) % i].x - e1[n].x) * (e1[(n + 1) % i].y + e1[n].y); 19467 return t1 >= 0; 19468 }(e1); 19469 i || (e1 = e1.reverse()); 19470 const n = { 19471 geometry: [], 19472 joinNormals: [], 19473 indices: [] 19474 }, r = [], o = [], a = []; 19475 let s = e1.length; 19476 for(; s >= 2 && e1[s - 1].equals(e1[s - 2]);)s--; 19477 if (s < (t1 ? 3 : 2)) return n; 19478 let l, c, u, h, d, f = 0; 19479 for(; f < s - 1 && e1[f].equals(e1[f + 1]);)f++; 19480 t1 && (l = e1[s - 2], d = e1[f].sub(l)._unit()._perp()); 19481 for(let i = f; i < s; i++){ 19482 if (u = i === s - 1 ? t1 ? e1[f + 1] : void 0 : e1[i + 1], u && e1[i].equals(u)) continue; 19483 d && (h = d), l && (c = l), l = e1[i], d = u ? u.sub(l)._unit()._perp() : h, h = h || d; 19484 let n = h.add(d); 19485 0 === n.x && 0 === n.y || n._unit(); 19486 const p = n.x * d.x + n.y * d.y, m = 0 !== p ? 1 / p : 1 / 0, _ = h.x * d.y - h.y * d.x > 0; 19487 let g = "miter"; 19488 const y = 2; 19489 "miter" === g && m > y && (g = "bevel"), "bevel" === g && (m > 100 && (g = "flipbevel"), m < y && (g = "miter")); 19490 const x = (e1, t1, i, n)=>{ 19491 const s = new Pe(e1.x, e1.y), l = new Pe(e1.x, e1.y); 19492 s.x += t1.x * n, s.y += t1.y * n, l.x -= t1.x * Math.max(i, 1), l.y -= t1.y * Math.max(i, 1), a.push(t1), r.push(s), o.push(l); 19493 }; 19494 if ("miter" === g) n._mult(m), x(l, n, 0, 0); 19495 else if ("flipbevel" === g) n = d.mult(-1), x(l, n, 0, 0), x(l, n.mult(-1), 0, 0); 19496 else { 19497 const e1 = -Math.sqrt(m * m - 1), t1 = _ ? e1 : 0, i = _ ? 0 : e1; 19498 c && x(l, h, t1, i), u && x(l, d, t1, i); 19499 } 19500 } 19501 n.geometry = [ 19502 ...r, 19503 ...o.reverse(), 19504 r[0] 19505 ], n.joinNormals = [ 19506 ...a, 19507 ...a.reverse(), 19508 a.at(-1) 19509 ]; 19510 const p = n.geometry.length - 1; 19511 for(let e1 = 0; e1 < p / 2; e1++)if (e1 + 1 < p / 2) { 19512 let t1 = e1, i = e1 + 1, r = p - 1 - e1, o = p - 2 - e1; 19513 t1 = 0 === t1 ? p - 1 : t1 - 1, i = 0 === i ? p - 1 : i - 1, r = 0 === r ? p - 1 : r - 1, o = 0 === o ? p - 1 : o - 1, n.indices.push(r), n.indices.push(i), n.indices.push(t1), n.indices.push(r), n.indices.push(o), n.indices.push(i); 19514 } 19515 return n; 19516 }(i[0]), i = [ 19517 y.geometry 19518 ]; 19519 } 19520 const x = (e1, t1)=>e1 < (t1.length - 1) / 2 || e1 === t1.length - 1, v = this.wallMode ? [ 19521 i 19522 ] : Ne(i, 500); 19523 for(let e1 = v.length - 1; e1 >= 0; e1--){ 19524 const t1 = v[e1]; 19525 (0 === t1.length || Cx(t1[0])) && v.splice(e1, 1); 19526 } 19527 let b; 19528 if (d) b = Vx(v, u, r); 19529 else { 19530 b = []; 19531 for (const e1 of v)b.push({ 19532 polygon: e1, 19533 bounds: u 19534 }); 19535 } 19536 const w = f ? this.edgeRadius : 0, A = w > 0 && this.zoom < 17, E = (e1, t1)=>{ 19537 if (0 === e1.length) return !1; 19538 const i = e1.at(-1); 19539 return t1.x === i.x && t1.y === i.y; 19540 }; 19541 for (const { polygon: e1, bounds: t1 } of b){ 19542 let i = 0, n = 0; 19543 for (const t1 of e1)f && !t1[0].equals(t1.at(-1)) && t1.push(t1[0]), n += f ? t1.length - 1 : t1.length; 19544 const o = this.segments.prepareSegment((f ? 5 : 4) * n, this.layoutVertexArray, this.indexArray); 19545 m.footprintSegIdx < 0 && (m.footprintSegIdx = this.footprintSegments.length), m.polygonSegIdx < 0 && (m.polygonSegIdx = this.polygonSegments.length); 19546 const a = { 19547 triangleArrayOffset: this.indexArray.length, 19548 triangleCount: 0, 19549 triangleSegIdx: this.segments.segments.length - 1 19550 }, s = new _x; 19551 if (s.vertexOffset = this.footprintVertices.length, s.indexOffset = 3 * this.footprintIndices.length, s.ringIndices = [], f) { 19552 const n = [], a = []; 19553 i = o.vertexLength; 19554 for(let i = 0; i < e1.length; i++){ 19555 const l = e1[i]; 19556 l.length && 0 !== i && a.push(n.length / 2); 19557 const u = []; 19558 let f, p; 19559 f = l[1].sub(l[0])._perp()._unit(), s.ringIndices.push(l.length - 1); 19560 for(let e1 = 1; e1 < l.length; e1++){ 19561 const t1 = l[e1], i = l[e1 === l.length - 1 ? 1 : e1 + 1], a = t1.clone(); 19562 if (w) { 19563 p = Tx(t1, i, f); 19564 const e1 = Sx(f, p), n = zx(f, p), r = w * Math.min(4, 1 / n); 19565 a.x += r * e1.x, a.y += r * e1.y, a.x = Math.round(a.x), a.y = Math.round(a.y), f = p; 19566 } 19567 if (!_ || 0 !== w && !A || E(u, a) || u.push(a), dx(this.layoutVertexArray, a.x, a.y, 0, 0, 1, 1, 0), this.wallMode) { 19568 const t1 = x(e1, l); 19569 fx(this.wallVertexArray, y.joinNormals[e1], !t1); 19570 } 19571 o.vertexLength++, this.footprintVertices.emplaceBack(t1.x, t1.y), n.push(t1.x, t1.y), d && mx(this.layoutVertexExtArray, h.projectTilePoint(a.x, a.y, r), h.upVector(r, a.x, a.y)); 19572 } 19573 _ && (0 === w || A) && (0 !== u.length && E(u, u[0]) && u.pop(), this.groundEffect.addData(u, t1, c)); 19574 } 19575 const l = this.wallMode ? y.indices : Dl(n, a); 19576 for(let e1 = 0; e1 < l.length; e1 += 3)this.footprintIndices.emplaceBack(s.vertexOffset + l[e1 + 0], s.vertexOffset + l[e1 + 1], s.vertexOffset + l[e1 + 2]), this.indexArray.emplaceBack(i + l[e1], i + l[e1 + 2], i + l[e1 + 1]), o.primitiveLength++; 19577 s.indexCount += l.length, s.vertexCount += this.footprintVertices.length - s.vertexOffset; 19578 } 19579 for(let n = 0; n < e1.length; n++){ 19580 const a = e1[n]; 19581 p.startRing(m, a[0]); 19582 let s = a.length > 4 && Lx(a[a.length - 2], a[0], a[1]), l = w ? Rx(a[a.length - 2], a[0], a[1], w) : 0; 19583 const u = []; 19584 let g, v, b; 19585 v = a[1].sub(a[0])._perp()._unit(); 19586 let A = !0; 19587 for(let e1 = 1, n = 0; e1 < a.length; e1++){ 19588 let c = a[e1 - 1], f = a[e1]; 19589 const I = a[e1 === a.length - 1 ? 1 : e1 + 1]; 19590 if (p.appendEdge(m, f, c), Dx(f, c, t1)) { 19591 w && (v = I.sub(f)._perp()._unit(), A = !A); 19592 continue; 19593 } 19594 const M = f.sub(c)._perp(), T = M.x / (Math.abs(M.x) + Math.abs(M.y)), S = M.y > 0 ? 1 : 0, z = c.dist(f); 19595 if (n + z > 32768 && (n = 0), w) { 19596 b = Tx(f, I, v); 19597 let e1 = Px(c, f, I, zx(v, b), w); 19598 isNaN(e1) && (e1 = 0); 19599 const t1 = Mx(c, f, new Pe(0, 0)); 19600 c = c.add(t1.mult(l))._round(), f = f.add(t1.mult(-e1))._round(), l = e1, v = b, _ && this.zoom >= 17 && (E(u, c) || u.push(c), E(u, f) || u.push(f)); 19601 } 19602 const R = o.vertexLength, P = a.length > 4 && Lx(c, f, I); 19603 let D = Ox(n, s, A); 19604 if (dx(this.layoutVertexArray, c.x, c.y, T, S, 0, 0, D), dx(this.layoutVertexArray, c.x, c.y, T, S, 0, 1, D), this.wallMode) { 19605 const t1 = x(e1 - 1, a), i = y.joinNormals[e1 - 1]; 19606 fx(this.wallVertexArray, i, t1), fx(this.wallVertexArray, i, t1); 19607 } 19608 if (n += z, D = Ox(n, P, !A), s = P, dx(this.layoutVertexArray, f.x, f.y, T, S, 0, 0, D), dx(this.layoutVertexArray, f.x, f.y, T, S, 0, 1, D), this.wallMode) { 19609 const t1 = x(e1, a), i = y.joinNormals[e1]; 19610 fx(this.wallVertexArray, i, t1), fx(this.wallVertexArray, i, t1); 19611 } 19612 if (o.vertexLength += 4, this.indexArray.emplaceBack(R + 0, R + 1, R + 2), this.indexArray.emplaceBack(R + 1, R + 3, R + 2), o.primitiveLength += 2, w) { 19613 const n = i + (1 === e1 ? a.length - 2 : e1 - 2), r = 1 === e1 ? i : n + 1; 19614 if (this.indexArray.emplaceBack(R + 1, n, R + 3), this.indexArray.emplaceBack(n, r, R + 3), o.primitiveLength += 2, void 0 === g && (g = R), !Dx(I, a[e1], t1)) { 19615 const t1 = e1 === a.length - 1 ? g : o.vertexLength; 19616 this.indexArray.emplaceBack(R + 2, R + 3, t1), this.indexArray.emplaceBack(R + 3, t1 + 1, t1), this.indexArray.emplaceBack(R + 3, r, t1 + 1), o.primitiveLength += 3; 19617 } 19618 A = !A; 19619 } 19620 if (d) { 19621 const e1 = this.layoutVertexExtArray, t1 = h.projectTilePoint(c.x, c.y, r), i = h.projectTilePoint(f.x, f.y, r), n = h.upVector(r, c.x, c.y), o = h.upVector(r, f.x, f.y); 19622 mx(e1, t1, n), mx(e1, t1, n), mx(e1, i, o), mx(e1, i, o); 19623 } 19624 } 19625 f && (i += a.length - 1), _ && w && this.zoom >= 17 && (0 !== u.length && E(u, u[0]) && u.pop(), this.groundEffect.addData(u, t1, c, w > 0)); 19626 } 19627 this.footprintSegments.push(s), a.triangleCount = this.indexArray.length - a.triangleArrayOffset, this.polygonSegments.push(a), ++m.footprintSegLen, ++m.polygonSegLen; 19628 } 19629 if (m.vertexCount = this.layoutVertexArray.length - m.vertexArrayOffset, m.groundVertexCount = this.groundEffect.vertexArray.length - m.groundVertexArrayOffset, 0 !== m.vertexCount) { 19630 if (m.centroidXY = p.borders ? cx : this.encodeCentroid(p, m), t1.properties && Object.hasOwn(t1.properties, "building_id")) { 19631 const e1 = m.buildingId; 19632 let t1 = this.buildingGroups.get(e1); 19633 t1 || (t1 = { 19634 accX: 0, 19635 accY: 0, 19636 accCount: 0, 19637 mergedMin: new Pe(Number.MAX_VALUE, Number.MAX_VALUE), 19638 mergedMax: new Pe(-Number.MAX_VALUE, -Number.MAX_VALUE), 19639 partIndices: [] 19640 }, this.buildingGroups.set(e1, t1)), t1.accX += p.acc.x, t1.accY += p.acc.y, t1.accCount += p.accCount, t1.mergedMin.x = Math.min(t1.mergedMin.x, m.min.x), t1.mergedMin.y = Math.min(t1.mergedMin.y, m.min.y), t1.mergedMax.x = Math.max(t1.mergedMax.x, m.max.x), t1.mergedMax.y = Math.max(t1.mergedMax.y, m.max.y), t1.partIndices.push(this.centroidData.length); 19641 } 19642 if (this.centroidData.push(m), p.borders) { 19643 this.featuresOnBorder.push(p); 19644 const e1 = this.featuresOnBorder.length - 1; 19645 for(let t1 = 0; t1 < p.borders.length; t1++)p.borders[t1][0] !== Number.MAX_VALUE && this.borderFeatureIndices[t1].push(e1); 19646 } 19647 this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t1, n, o, a, r, l, void 0, this.worldview), this.groundEffect.addPaintPropertiesData(t1, n, o, a, r, l, this.worldview), this.maxHeight = Math.max(this.maxHeight, g); 19648 } 19649 } 19650 _finalizeBuildingGroups() { 19651 for (const [, e1] of this.buildingGroups){ 19652 if (0 === e1.partIndices.length) continue; 19653 const t1 = new vx; 19654 t1.acc = new Pe(e1.accX, e1.accY), t1.accCount = e1.accCount; 19655 const i = new yx; 19656 i.min = e1.mergedMin, i.max = e1.mergedMax; 19657 const n = this.encodeCentroid(t1, i), r = t1.centroid(); 19658 for (const t1 of e1.partIndices){ 19659 const i = this.centroidData.get(t1); 19660 i.centroidXY.x === cx.x && i.centroidXY.y === cx.y || (i.centroidXY = n), i.min = e1.mergedMin, i.max = e1.mergedMax, i.groupCentroidPos = r; 19661 } 19662 } 19663 this.buildingGroups.clear(); 19664 } 19665 sortBorders() { 19666 for(let e1 = 0; e1 < this.borderFeatureIndices.length; e1++)this.borderFeatureIndices[e1].sort((t1, i)=>this.featuresOnBorder[t1].borders[e1][0] - this.featuresOnBorder[i].borders[e1][0]); 19667 } 19668 splitToSubtiles() { 19669 const e1 = []; 19670 for(let t1 = 0; t1 < this.centroidData.length; t1++){ 19671 const i = this.centroidData.get(t1), n = +(i.min.y + i.max.y > zr), r = 2 * n + (+(i.min.x + i.max.x > zr) ^ n); 19672 for(let n = 0; n < i.polygonSegLen; n++){ 19673 const o = i.polygonSegIdx + n; 19674 e1.push({ 19675 centroidIdx: t1, 19676 subtile: r, 19677 polygonSegmentIdx: o, 19678 triangleSegmentIdx: this.polygonSegments[o].triangleSegIdx 19679 }); 19680 } 19681 } 19682 const t1 = new uu; 19683 e1.sort((e1, t1)=>e1.triangleSegmentIdx === t1.triangleSegmentIdx ? e1.subtile - t1.subtile : e1.triangleSegmentIdx - t1.triangleSegmentIdx); 19684 let i = 0, n = 0, r = 0; 19685 for (const t1 of e1){ 19686 if (t1.triangleSegmentIdx !== i) break; 19687 r++; 19688 } 19689 const o = e1.length; 19690 for(; n !== e1.length;){ 19691 i = e1[n].triangleSegmentIdx; 19692 let a = 0, s = n, l = n; 19693 for(let t1 = s; t1 < r && e1[t1].subtile === a; t1++)l++; 19694 for(; s !== r;){ 19695 const n = e1[s]; 19696 a = n.subtile; 19697 const o = this.centroidData.get(n.centroidIdx).min.clone(), c = this.centroidData.get(n.centroidIdx).max.clone(), u = { 19698 vertexOffset: this.segments.segments[i].vertexOffset, 19699 primitiveOffset: t1.length, 19700 vertexLength: this.segments.segments[i].vertexLength, 19701 primitiveLength: 0, 19702 sortKey: void 0, 19703 vaos: {} 19704 }; 19705 for(let i = s; i < l; i++){ 19706 const n = e1[i], r = this.polygonSegments[n.polygonSegmentIdx], a = this.centroidData.get(n.centroidIdx).min, s = this.centroidData.get(n.centroidIdx).max, l = this.indexArray.uint16; 19707 for(let e1 = r.triangleArrayOffset; e1 < r.triangleArrayOffset + r.triangleCount; e1++)t1.emplaceBack(l[3 * e1], l[3 * e1 + 1], l[3 * e1 + 2]); 19708 u.primitiveLength += r.triangleCount, o.x = Math.min(o.x, a.x), o.y = Math.min(o.y, a.y), c.x = Math.max(c.x, s.x), c.y = Math.max(c.y, s.y); 19709 } 19710 u.primitiveLength > 0 && this.triangleSubSegments.push({ 19711 segment: u, 19712 min: o, 19713 max: c 19714 }), s = l; 19715 for(let t1 = s; t1 < r && e1[t1].subtile === e1[s].subtile; t1++)l++; 19716 } 19717 n = r; 19718 for(let t1 = n; t1 < o && e1[t1].triangleSegmentIdx === e1[n].triangleSegmentIdx; t1++)r++; 19719 } 19720 t1._trim(), this.indexArray = t1; 19721 } 19722 getVisibleSegments(e1, t1, i) { 19723 const n = new ju; 19724 if (this.wallMode) { 19725 for (const e1 of this.triangleSubSegments)n.segments.push(e1.segment); 19726 return n; 19727 } 19728 let r = 0, o = 0; 19729 const a = 1 << e1.canonical.z; 19730 if (t1) { 19731 const i = t1.getMinMaxForTile(e1); 19732 i && (r = i.min, o = i.max); 19733 } 19734 o += this.maxHeight; 19735 const s = e1.toUnwrapped(); 19736 let l; 19737 const c = [ 19738 s.canonical.x / a + s.wrap, 19739 s.canonical.y / a 19740 ], u = [ 19741 (s.canonical.x + 1) / a + s.wrap, 19742 (s.canonical.y + 1) / a 19743 ], h = (e1, t1, i)=>[ 19744 fn(e1[0], t1[0], i[0]), 19745 fn(e1[1], t1[1], i[1]) 19746 ], d = [], f = []; 19747 for (const e1 of this.triangleSubSegments){ 19748 d[0] = e1.min.x / zr, d[1] = e1.min.y / zr, f[0] = e1.max.x / zr, f[1] = e1.max.y / zr; 19749 const t1 = h(c, u, d), a = h(c, u, f); 19750 if (0 === new Rf([ 19751 t1[0], 19752 t1[1], 19753 r 19754 ], [ 19755 a[0], 19756 a[1], 19757 o 19758 ]).intersectsPrecise(i)) { 19759 l && (n.segments.push(l), l = void 0); 19760 continue; 19761 } 19762 const s = e1.segment; 19763 l && l.vertexOffset !== s.vertexOffset && (n.segments.push(l), l = void 0), l ? (l.vertexLength += s.vertexLength, l.primitiveLength += s.primitiveLength) : l = { 19764 vertexOffset: s.vertexOffset, 19765 primitiveLength: s.primitiveLength, 19766 vertexLength: s.vertexLength, 19767 primitiveOffset: s.primitiveOffset, 19768 sortKey: void 0, 19769 vaos: {} 19770 }; 19771 } 19772 return l && n.segments.push(l), n; 19773 } 19774 encodeCentroid(e1, t1) { 19775 const i = e1.centroid(), n = t1.span(), r = Math.min(7, Math.round(n.x * this.tileToMeter / 10)), o = Math.min(6, Math.round(n.y * this.tileToMeter / 10)); 19776 return new Pe(it(i.x, 1, 8191) << 3 | r, it(i.y, 1, 8191) << 3 | o); 19777 } 19778 encodeBorderCentroid(e1) { 19779 if (!e1.borders) return new Pe(0, 0); 19780 const t1 = e1.borders, i = Number.MAX_VALUE; 19781 if (t1[0][0] !== i || t1[1][0] !== i) { 19782 const e1 = t1[0][0] !== i ? 0 : 1; 19783 return new Pe(6 | (t1[0][0] !== i ? 0 : 65528), (t1[e1][0] + t1[e1][1]) / 2 << 3 | 6); 19784 } 19785 { 19786 const e1 = t1[2][0] !== i ? 2 : 3; 19787 return new Pe((t1[e1][0] + t1[e1][1]) / 2 << 3 | 6, 6 | (t1[2][0] !== i ? 0 : 65528)); 19788 } 19789 } 19790 showCentroid(e1, t1) { 19791 const i = this.centroidData.get(e1.centroidDataIndex); 19792 if (i.flags &= ux, "keep" !== t1 || 7 & ~i.centroidXY.y) { 19793 if (0 !== i.groupCentroidPos.x || 0 !== i.groupCentroidPos.y) { 19794 const e1 = i.span(), t1 = Math.min(7, Math.round(e1.x * this.tileToMeter / 10)), n = Math.min(6, Math.round(e1.y * this.tileToMeter / 10)); 19795 i.centroidXY = new Pe(it(i.groupCentroidPos.x, 1, 8191) << 3 | t1, it(i.groupCentroidPos.y, 1, 8191) << 3 | n); 19796 } else i.centroidXY = new Pe(0, 0); 19797 this.writeCentroidToBuffer(i); 19798 } else this.writeCentroidToBuffer(i); 19799 } 19800 writeCentroidToBuffer(e1) { 19801 this.groundEffect.updateHiddenByLandmark(e1); 19802 const t1 = e1.vertexArrayOffset, i = e1.vertexCount + e1.vertexArrayOffset, n = -1073741824 & e1.flags ? cx : e1.centroidXY, r = this.centroidVertexArray.geta_centroid_pos0(t1); 19803 if (this.centroidVertexArray.geta_centroid_pos1(t1) !== n.y || r !== n.x) { 19804 for(let e1 = t1; e1 < i; ++e1)this.centroidVertexArray.emplace(e1, n.x, n.y); 19805 this.needsCentroidUpdate = !0; 19806 } 19807 } 19808 createCentroidsBuffer() { 19809 this.centroidVertexArray.resize(this.layoutVertexArray.length), this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length); 19810 for (const e1 of this.centroidData)this.writeCentroidToBuffer(e1); 19811 } 19812 updateReplacement(e1, t1, i) { 19813 if (t1.updateTime === this.replacementUpdateTime) return; 19814 this.replacementUpdateTime = t1.updateTime; 19815 const n = t1.getReplacementRegionsForTile(e1.toUnwrapped()); 19816 if (Bp(this.activeReplacements, n)) return; 19817 if (this.activeReplacements = n, 0 === this.centroidVertexArray.length) this.createCentroidsBuffer(); 19818 else for (const e1 of this.centroidData)e1.flags &= 1073741823; 19819 const r = []; 19820 for (const t1 of this.activeReplacements){ 19821 if (t1.order < i) continue; 19822 const n = Math.max(1, Math.pow(2, t1.footprintTileId.canonical.z - e1.canonical.z)); 19823 if (t1.footprint.buildingIds) for (const e1 of this.centroidData)e1.flags & ux || e1.flags & hx || t1.min.x > e1.max.x || e1.min.x > t1.max.x || t1.min.y > e1.max.y || e1.min.y > t1.max.y || t1.footprint.buildingIds.has(e1.buildingId) && (e1.flags |= t1.clipMask !== tx.None ? -1073741824 : ux); 19824 else for (const i of this.centroidData)if (!(i.flags & ux || i.flags & hx || t1.min.x > i.max.x || i.min.x > t1.max.x || t1.min.y > i.max.y || i.min.y > t1.max.y)) for(let o = 0; o < i.footprintSegLen; o++){ 19825 const a = this.footprintSegments.get(i.footprintSegIdx + o); 19826 if (r.length = 0, Nx(this.footprintVertices, a.vertexOffset, a.vertexCount, t1.footprintTileId.canonical, e1.canonical, r), kp(t1.footprint, r, this.footprintIndices.uint16, a.indexOffset, a.indexCount, -a.vertexOffset, -n)) { 19827 i.flags |= t1.clipMask !== tx.None ? -1073741824 : ux; 19828 break; 19829 } 19830 } 19831 } 19832 for (const e1 of this.centroidData)this.writeCentroidToBuffer(e1); 19833 this.borderDoneWithNeighborZ = [ 19834 -1, 19835 -1, 19836 -1, 19837 -1 19838 ]; 19839 } 19840 footprintContainsPoint(e1, t1, i) { 19841 let n = !1; 19842 for(let r = 0; r < i.footprintSegLen; r++){ 19843 const o = this.footprintSegments.get(i.footprintSegIdx + r); 19844 let a = 0; 19845 for (const i of o.ringIndices){ 19846 for(let r = a, s = i + a - 1; r < i + a; s = r++){ 19847 const i = this.footprintVertices.int16[2 * (r + o.vertexOffset) + 0], a = this.footprintVertices.int16[2 * (r + o.vertexOffset) + 1], l = this.footprintVertices.int16[2 * (s + o.vertexOffset) + 1]; 19848 a > t1 != l > t1 && e1 < (this.footprintVertices.int16[2 * (s + o.vertexOffset) + 0] - i) * (t1 - a) / (l - a) + i && (n = !n); 19849 } 19850 a = i; 19851 } 19852 } 19853 return n; 19854 } 19855 getHeightAtTileCoord(e1, t1) { 19856 let i = Number.NEGATIVE_INFINITY, n = !0; 19857 const r = 4 * (e1 + zr) * zr + (t1 + zr); 19858 if (Object.hasOwn(this.partLookup, r)) { 19859 const e1 = this.partLookup[r]; 19860 return e1 ? { 19861 height: e1.height, 19862 hidden: !!(e1.flags & ux) 19863 } : void 0; 19864 } 19865 const o = this.centroidData.buffer, a = this.centroidData.length; 19866 for(let s = 0; s < a; s++){ 19867 const a = 15 * s; 19868 if (e1 > o[a + 4] || o[a + 2] > e1 || t1 > o[a + 5] || o[a + 3] > t1) continue; 19869 const l = o[a + 13]; 19870 if (l <= i) continue; 19871 const c = this.centroidData.get(s); 19872 this.footprintContainsPoint(e1, t1, c) && (i = l, this.partLookup[r] = c, n = !!(c.flags & ux)); 19873 } 19874 if (i !== Number.NEGATIVE_INFINITY) return { 19875 height: i, 19876 hidden: n 19877 }; 19878 this.partLookup[r] = void 0; 19879 } 19880 constructor(e1){ 19881 this.zoom = e1.zoom, this.canonical = e1.canonical, this.overscaling = e1.overscaling, this.layers = e1.layers, this.pixelRatio = e1.pixelRatio, this.layerIds = this.layers.map((e1)=>e1.fqid), this.index = e1.index, this.hasPattern = !1, this.edgeRadius = 0, this.projection = e
198811.projection, this.activeReplacements = [], this.replacementUpdateTime = 0, this.centroidData = new xx, this.footprintIndices = new uu, this.footprintVertices = new jc, this.footprintSegments = new gx, this.layoutVertexArray = new qc, this.centroidVertexArray = new Lu, this.wallVertexArray = new Bu, this.indexArray = new uu, this.programConfigurations = new mh(e1.layers, { 19882 zoom: e1.zoom, 19883 lut: e1.lut 19884 }, (e1)=>ox.includes(e1)), this.segments = new ju, this.stateDependentLayerIds = this.layers.filter((e1)=>e1.isStateDependent()).map((e1)=>e1.id), this.groundEffect = new Ex(e1), this.maxHeight = 0, this.partLookup = {}, this.triangleSubSegments = [], this.polygonSegments = [], this.buildingGroups = new Map, this.worldview = e1.worldview, this.hasAppearances = null; 19885 } 19886 } 19887 function Mx(e1, t1, i) { 19888 return e1.equals(t1) ? i : t1.sub(e1)._unit(); 19889 } 19890 function Tx(e1, t1, i) { 19891 return e1.equals(t1) ? i : t1.sub(e1)._perp()._unit(); 19892 } 19893 function Sx(e1, t1) { 19894 const i = e1.add(t1), n = i.mag(); 19895 return 0 === n ? e1 : i.div(n); 19896 } 19897 function zx(e1, t1) { 19898 const i = Sx(e1, t1); 19899 return e1.x * i.x + e1.y * i.y; 19900 } 19901 function Rx(e1, t1, i, n) { 19902 let r, o; 19903 return e1.equals(t1) ? (o = Tx(t1, i, new Pe(0, 0)), r = o) : (r = t1.sub(e1)._perp()._unit(), o = Tx(t1, i, r)), Px(e1, t1, i, zx(r, o), n); 19904 } 19905 function Px(e1, t1, i, n, r) { 19906 const o = Math.sqrt(1 - n * n); 19907 return Math.min(e1.dist(t1) / 3, t1.dist(i) / 3, r * o / n); 19908 } 19909 function Dx(e1, t1, i) { 19910 return e1.x < i[0].x && t1.x < i[0].x || e1.x > i[1].x && t1.x > i[1].x || e1.y < i[0].y && t1.y < i[0].y || e1.y > i[1].y && t1.y > i[1].y; 19911 } 19912 function Fx(e1, t1) { 19913 return e1.x < t1[0].x || e1.x > t1[1].x || e1.y < t1[0].y || e1.y > t1[1].y; 19914 } 19915 function Cx(e1) { 19916 return e1.every((e1)=>e1.x <= 0) || e1.every((e1)=>e1.x >= zr) || e1.every((e1)=>e1.y <= 0) || e1.every((e1)=>e1.y >= zr); 19917 } 19918 function Lx(e1, t1, i) { 19919 if (e1.x < 0 || e1.x >= zr || t1.x < 0 || t1.x >= zr || i.x < 0 || i.x >= zr) return !1; 19920 const n = i.sub(t1), r = n.perp(), o = e1.sub(t1); 19921 return (n.x * o.x + n.y * o.y) / Math.sqrt((n.x * n.x + n.y * n.y) * (o.x * o.x + o.y * o.y)) > -.866 && r.x * o.x + r.y * o.y < 0; 19922 } 19923 function Ox(e1, t1, i) { 19924 const n = t1 ? 2 | e1 : -3 & e1; 19925 return i ? 1 | n : -2 & n; 19926 } 19927 function Bx() { 19928 const e1 = Math.PI / 32, t1 = Math.tan(e1), i = pc; 19929 return i * Math.sqrt(1 + 2 * t1 * t1) - i; 19930 } 19931 function Vx(e1, t1, i) { 19932 const n = 1 << i.z, r = pr(i.x / n), o = pr((i.x + 1) / n), a = mr(i.y / n), s = mr((i.y + 1) / n); 19933 return function(e1, t1, i, n) { 19934 let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0, o = arguments.length > 5 ? arguments[5] : void 0; 19935 const a = []; 19936 if (!e1.length || !i || !n) return a; 19937 const s = (e1, t1)=>{ 19938 for (const i of e1)a.push({ 19939 polygon: i, 19940 bounds: t1 19941 }); 19942 }, l = Math.ceil(Math.log2(i)), c = Math.ceil(Math.log2(n)), u = l - c, h = []; 19943 for(let e1 = 0; e1 < Math.abs(u); e1++)h.push(u > 0 ? 0 : 1); 19944 for(let e1 = 0; e1 < Math.min(l, c); e1++)h.push(0), h.push(1); 19945 let d = e1; 19946 if (d = ex(d, t1[0].y - r, t1[1].y + r, 1), d = ex(d, t1[0].x - r, t1[1].x + r, 0), !d.length) return a; 19947 const f = []; 19948 for(h.length ? f.push({ 19949 polygons: d, 19950 bounds: t1, 19951 depth: 0 19952 }) : s(d, t1); f.length;){ 19953 const e1 = f.pop(), t1 = e1.depth, i = h[t1], n = e1.bounds[0], a = e1.bounds[1], l = 0 === i ? n.x : n.y, c = 0 === i ? a.x : a.y, u = o ? o(i, l, c) : .5 * (l + c), d = ex(e1.polygons, l - r, u
vendor: 42,033 bytes, lines 19953-20562
19953+ r, i), p = ex(e1.polygons, u - r, c + r, i); 19954 if (d.length) { 19955 const e1 = [ 19956 n, 19957 new Pe(0 === i ? u : a.x, 1 === i ? u : a.y) 19958 ]; 19959 h.length > t1 + 1 ? f.push({ 19960 polygons: d, 19961 bounds: e1, 19962 depth: t1 + 1 19963 }) : s(d, e1); 19964 } 19965 if (p.length) { 19966 const e1 = [ 19967 new Pe(0 === i ? u : n.x, 1 === i ? u : n.y), 19968 a 19969 ]; 19970 h.length > t1 + 1 ? f.push({ 19971 polygons: p, 19972 bounds: e1, 19973 depth: t1 + 1 19974 }) : s(p, e1); 19975 } 19976 } 19977 return a; 19978 }(e1, t1, Math.ceil((o - r) / 11.25), Math.ceil((a - s) / 11.25), 1, (e1, t1, r)=>{ 19979 if (0 === e1) return .5 * (t1 + r); 19980 { 19981 const e1 = mr((i.y + t1 / zr) / n); 19982 return (fr(.5 * (mr((i.y + r / zr) / n) + e1)) * n - i.y) * zr; 19983 } 19984 }); 19985 } 19986 function Nx(e1, t1, i, n, r, o) { 19987 const a = Math.pow(2, n.z - r.z); 19988 for(let s = 0; s < i; s++){ 19989 let i = e1.int16[2 * (s + t1) + 0], l = e1.int16[2 * (s + t1) + 1]; 19990 i = (i + r.x * zr) * a - n.x * zr, l = (l + r.y * zr) * a - n.y * zr, o.push(new Pe(i, l)); 19991 } 19992 } 19993 Xa(Ix, "FillExtrusionBucket", { 19994 omit: [ 19995 "layers", 19996 "features" 19997 ] 19998 }), Xa(yx, "PartData"), Xa(xx, "PartDataArray"), Xa(gx, "FootprintSegmentArray"), Xa(vx, "BorderCentroidData"), Xa(Ex, "GroundEffect"); 19999 const kx = 4096; 20000 class Ux { 20001 createIntArray(e1) { 20002 const t1 = this.memoryStackNextFree; 20003 return this.memoryStackNextFree += e1.length * Int32Array.BYTES_PER_ELEMENT, this.memoryStackNextFree - this.memoryStack > kx ? -1 : (new Int32Array(this.module.heap32.buffer, t1, e1.length).set(e1), t1); 20004 } 20005 createFloatArray(e1) { 20006 const t1 = this.memoryStackNextFree; 20007 return this.memoryStackNextFree += e1.length * Float32Array.BYTES_PER_ELEMENT, this.memoryStackNextFree - this.memoryStack > kx ? -1 : (new Float32Array(this.module.heapF32.buffer, t1, e1.length).set(e1), t1); 20008 } 20009 readStringBuffer(e1) { 20010 let t1 = ""; 20011 for(; 0 !== this.module.heapU8[e1];)t1 += String.fromCharCode(this.module.heapU8[e1]), ++e1; 20012 return t1; 20013 } 20014 setStyle(e1) { 20015 const t1 = e1.normalScale; 20016 this.module.setStyle(t1[0], t1[1], t1[2], e1.tileToMeters); 20017 } 20018 setAOOptions(e1, t1) { 20019 this.module.setAOOptions(e1 ? 1 : 0, t1); 20020 } 20021 setMetricOptions(e1, t1) { 20022 this.module.setMetricOptions(e1 ? 1 : 0, t1); 20023 } 20024 setStructuralOptions(e1) { 20025 this.module.setStructuralOptions(e1 ? 1 : 0); 20026 } 20027 setFacadeOptions(e1, t1) { 20028 this.module.setFacadeOptions(e1, t1 ? 1 : 0); 20029 } 20030 setFauxFacadeOptions(e1, t1, i) { 20031 this.module.setFauxFacadeOptions(e1 ? 1 : 0, t1 ? 1 : 0, i); 20032 } 20033 setFacadeClassifierOptions(e1) { 20034 this.module.setFacadeClassifierOptions(e1); 20035 } 20036 generateMesh(e1, t1) { 20037 this.memoryStackNextFree = this.memoryStack; 20038 for (const t1 of e1){ 20039 const e1 = this.createIntArray(t1.ringIndices), i = this.createFloatArray(t1.coordinates); 20040 if (-1 === e1 || -1 === i) return "building_gen: Out of stack memory: ".concat(this.memoryStackNextFree - this.memoryStack, "/4096"); 20041 this.module.addFeature(t1.id, t1.sourceId, t1.minHeight, t1.height, t1.roofType, i, e1, t1.ringIndices.length - 1); 20042 } 20043 for (const e1 of t1){ 20044 let t1; 20045 t1 = e1.entrances ? JSON.parse(e1.entrances) : []; 20046 const i = this.createFloatArray(t1), n = this.createFloatArray(e1.coordinates); 20047 if (-1 === i || -1 === n) return "building_gen: Out of stack memory: ".concat(this.memoryStackNextFree - this.memoryStack, "/4096"); 20048 this.module.addFacade(e1.sourceId, e1.crossPerc, e1.distanceToRoad, i, t1.length, n, e1.coordinates.length); 20049 } 20050 if (!this.module.generateMesh()) { 20051 const e1 = this.module.getLastError(); 20052 return this.readStringBuffer(e1); 20053 } 20054 const i = this.module.getMeshCount(), n = new Array(i); 20055 for(let e1 = 0; e1 < i; e1++){ 20056 const t1 = this.module.getPositionsPtr(e1), i = this.module.getPositionsLength(e1), r = new Float32Array(this.module.heapF32.buffer, t1, i), o = this.module.getNormalsPtr(e1), a = this.module.getNormalsLength(e1), s = new Float32Array(this.module.heapF32.buffer, o, a), l = this.module.getAOPtr(e1), c = this.module.getAOLength(e1), u = new Float32Array(this.module.heapF32.buffer, l, c), h = this.module.getUVPtr(e1), d = this.module.getUVLength(e1), f = new Float32Array(this.module.heapF32.buffer, h, d), p = this.module.getFauxFacadePtr(e1), m = this.module.getFauxFacadeLength(e1), _ = new Uint8Array(this.module.heapU8.buffer, p, m), g = this.module.getIndicesPtr(e1), y = this.module.getIndicesLength(e1), x = new Int16Array(this.module.heap16.buffer, g, y), v = this.module.getBuildingPart(e1); 20057 n[e1] = { 20058 positions: r, 20059 normals: s, 20060 ao: u, 20061 uv: f, 20062 isFauxFacade: _, 20063 indices: x, 20064 buildingPart: v 20065 }; 20066 } 20067 const r = this.module.getRingCount(), o = []; 20068 for(let e1 = 0; e1 < r; e1++){ 20069 const t1 = this.module.getRingPtr(e1), i = this.module.getRingLength(e1), n = new Float32Array(this.module.heapF32.buffer, t1, i); 20070 o.push(n); 20071 } 20072 return { 20073 meshes: n, 20074 outerRingLength: this.module.getOuterRingLength(), 20075 modifiedPolygonRings: o 20076 }; 20077 } 20078 constructor(e1){ 20079 this.module = e1, this.memoryStack = this.module.malloc(kx), this.memoryStackNextFree = this.memoryStack; 20080 } 20081 } 20082 const jx = Dh.types, Gx = 32767; 20083 function Hx(e1, t1) { 20084 const i = zr + t1; 20085 for (const n of e1)for (const e1 of n)if (e1.x < -t1 || e1.x > i || e1.y < -t1 || e1.y > i) return !1; 20086 return !0; 20087 } 20088 function $x(e1) { 20089 switch(e1){ 20090 case "flat": 20091 return 3; 20092 case "hipped": 20093 return 1; 20094 case "gabled": 20095 return 2; 20096 case "parapet": 20097 return 0; 20098 case "mansard": 20099 return 4; 20100 case "skillion": 20101 return 5; 20102 case "pyramidal": 20103 return 6; 20104 default: 20105 throw new Error("Unknown roof shape: ".concat(e1)); 20106 } 20107 } 20108 let Zx, Wx, qx = null, Xx = null, Yx = null; 20109 class Jx { 20110 constructor(){ 20111 this.layoutVertexArray = new Jc, this.layoutAttenuationArray = new nu, this.layoutColorArray = new ou, this.indexArray = new uu, this.indexArrayForConflation = new uu, this.segmentsBucket = new ju; 20112 } 20113 } 20114 class Kx { 20115 reserve(e1, t1, i) { 20116 this.layoutVertexArray.reserveForAdditional(e1), this.layoutCentroidArray.reserveForAdditional(e1), this.layoutFloodLightDataArray.reserveForAdditional(e1), this.layoutNormalArray.reserveForAdditional(e1), this.layoutAOArray.reserveForAdditional(e1), this.layoutColorArray.reserveForAdditional(e1), this.indexArray.reserveForAdditional(t1), i && (this.layoutFacadePaintArray.reserveForAdditional(e1), this.layoutFacadeDataArray.reserveForAdditional(e1), this.layoutFacadeVerticalRangeArray.reserveForAdditional(e1)); 20117 } 20118 constructor(e1){ 20119 this.layoutFacadePaintArray = null, this.layoutFacadeDataArray = null, this.layoutFacadeVerticalRangeArray = null, this.segmentsBucket = new ju, this.entranceBloom = new Jx; 20120 const t1 = 66560; 20121 this.layoutVertexArray = new Jc, this.layoutVertexArray.reserve(t1), this.layoutNormalArray = new Gc, this.layoutNormalArray.reserve(t1), this.layoutCentroidArray = new Gc, this.layoutCentroidArray.reserve(t1), this.layoutColorArray = new ou, this.layoutColorArray.reserve(t1), this.layoutFloodLightDataArray = new Au, this.layoutFloodLightDataArray.reserve(t1), this.layoutAOArray = new Eu, this.layoutAOArray.reserve(t1), this.indexArray = new uu, this.indexArray.reserve(66560), this.indexArrayForConflation = new uu, this.segmentsBucket = new ju, this.entranceBloom = new Jx, e1 && (this.layoutFacadePaintArray = new ou, this.layoutFacadeDataArray = new Qc, this.layoutFacadeVerticalRangeArray = new ou); 20122 } 20123 } 20124 class Qx { 20125 updateFootprints(e1, t1) { 20126 const i = new Hg([], [], 1), n = { 20127 vertices: [], 20128 indices: new Uint32Array(0), 20129 grid: i, 20130 min: this.footprintsMin, 20131 max: this.footprintsMax, 20132 buildingIds: this.buildingIds 20133 }; 20134 t1.push({ 20135 footprint: n, 20136 id: e1 20137 }); 20138 } 20139 updateAppearances(e1, t1, i, n) { 20140 return { 20141 hasLayoutChanges: !1, 20142 hasUboChanges: !1 20143 }; 20144 } 20145 populate(e1, t1, i, n) { 20146 if (!Yx) return; 20147 const r = Ic(i); 20148 this.tileToMeter = r, this.brightness = t1.brightness, Yx.setStyle({ 20149 normalScale: [ 20150 1, 20151 -1, 20152 r 20153 ], 20154 tileToMeters: r 20155 }), Yx.setAOOptions(!1, .3), Yx.setMetricOptions(!1, 16), Yx.setStructuralOptions(!0), Yx.setFacadeClassifierOptions(3); 20156 const o = new Map, a = new Map; 20157 let s = 0; 20158 for (const { feature: t1 } of e1){ 20159 if ("LineString" !== jx[t1.type]) { 20160 o.set(t1.id, t1.properties.source_id); 20161 continue; 20162 } 20163 const e1 = this.layers[0]._featureFilter.needGeometry; 20164 if (e1 && !this.layers[0]._featureFilter.filter(new $s(this.zoom), t1, i)) continue; 20165 const r = Lc(t1, e1); 20166 if (!e1 && !this.layers[0]._featureFilter.filter(new $s(this.zoom), r, i)) continue; 20167 const l = e1 ? r.geometry : Cc(t1, i, n), c = []; 20168 for (const e1 of l)for (const t1 of e1)c.push(t1.x), c.push(t1.y); 20169 const u = { 20170 coordinates: c, 20171 crossPerc: t1.properties.cross_perc, 20172 distanceToRoad: t1.properties.distance_to_road, 20173 entrances: t1.properties.entrances, 20174 sourceId: 0 20175 }, h = t1.properties.source_id; 20176 let d = a.get(h); 20177 d || (d = [], a.set(h, d)), d.push(u), ++s; 20178 } 20179 this.maxHeight = 0; 20180 const l = new Array, c = new Set, u = (e1)=>{ 20181 null != e1 && c.add(e1); 20182 }, h = (e1, t1)=>{ 20183 null != e1 && l.push({ 20184 buildingId: e1, 20185 footprintIndex: t1 20186 }); 20187 }, d = 64 * (e1.length - s), f = d / 2; 20188 this.buildingWithFacade.reserve(d, f, !0), this.buildingWithoutFacade.reserve(2 * d, 2 * f, !1), this.footprintsIndices.reserve(16 * (e1.length - s)), this.footprintsVertices.reserve(8 * (e1.length - s)); 20189 for (const { feature: s, id: l, index: d, sourceLayerIndex: f } of e1){ 20190 if ("LineString" === jx[s.type]) continue; 20191 const e1 = this.layers[0]._featureFilter.needGeometry; 20192 if (e1 && !this.layers[0]._featureFilter.filter(new $s(this.zoom), s, i)) continue; 20193 let p = null; 20194 if (s.properties && Object.hasOwn(s.properties, "building_id") && (p = Number(s.properties.building_id), c.has(p))) continue; 20195 const m = Lc(s, e1); 20196 if (!e1 && !this.layers[0]._featureFilter.filter(new $s(this.zoom), m, i)) continue; 20197 const _ = e1 ? m.geometry : Cc(s, i, n), g = Ne(_, 500); 20198 let y = !1; 20199 for (const e1 of g)if (1 !== e1.length) { 20200 y = !0; 20201 break; 20202 } 20203 if (y) { 20204 u(p); 20205 continue; 20206 } 20207 if (!Hx(_, 163)) { 20208 u(p); 20209 continue; 20210 } 20211 const x = this.layers[0], v = $x(x.layout.get("building-roof-shape").evaluate(s, {}, i)), b = x.layout.get("building-base").evaluate(s, {}, i), w = x.layout.get("building-height").evaluate(s, {}, i), A = x.layout.get("building-flood-light-ground-radius").evaluate(s, {}, i), E = x.paint.get("building-ambient-occlusion-intensity"), I = A / this.tileToMeter; 20212 s.properties["building-part"] = "roof"; 20213 const M = x.paint.get("building-color").evaluate(s, {}, this.canonical).toPremultipliedRenderColor(this.lut), T = x.paint.get("building-emissive-strength").evaluate(s, {}, this.canonical); 20214 s.properties["building-part"] = "wall"; 20215 const S = x.paint.get("building-color").evaluate(s, {}, this.canonical).toPremultipliedRenderColor(this.lut), z = x.paint.get("building-emissive-strength").evaluate(s, {}, this.canonical); 20216 s.properties["building-part"] = "window"; 20217 const R = x.paint.get("building-color").evaluate(s, {}, this.canonical).toPremultipliedRenderColor(this.lut), P = x.paint.get("building-emissive-strength").evaluate(s, {}, this.canonical); 20218 s.properties["building-part"] = "door"; 20219 const D = x.paint.get("building-color").evaluate(s, {}, this.canonical).toPremultipliedRenderColor(this.lut), F = x.paint.get("building-emissive-strength").evaluate(s, {}, this.canonical); 20220 let C = x.layout.get("building-flood-light-wall-radius").evaluate(s, {}, i); 20221 C = it(C, 0, 2048); 20222 const L = C / 2048 * Gx, O = o.get(l), B = a.get(O) || [], V = 0 !== B.length && x.layout.get("building-facade").evaluate(s, {}, i); 20223 Yx.setFacadeOptions(4, !0), Yx.setFauxFacadeOptions(V, !1, 1); 20224 let N = 0, k = 0, U = 0, j = 0, G = 0, H = 0, $ = 0, Z = 0, W = 0, q = 0, X = 0; 20225 if (V) { 20226 let e1 = Math.round(x.layout.get("building-facade-floors").evaluate(s, {}, i)); 20227 if (0 === b) { 20228 e1 = Math.max(1, e1 - (B.length > 0 ? 1 : 0)); 20229 let t1 = 4; 20230 if (w > 100) { 20231 const e1 = [ 20232 10, 20233 13, 20234 15 20235 ]; 20236 t1 = e1[s.id ? s.id % e1.length : 0]; 20237 } else w <= 10 && (t1 = 3); 20238 Yx.setFacadeOptions(t1, !0), G = (w < 15 ? 1.3 : 1.61803) * t1 / r; 20239 } else G = b / r; 20240 H = w / r, G = Math.min(G, H), U = x.layout.get("building-facade-unit-width").evaluate(s, {}, i) / r, j = (H - G) / e1, Yx.setFauxFacadeOptions(!0, !0, U); 20241 const t1 = x.layout.get("building-facade-window").evaluate(s, {}, i); 20242 N = t1[0], k = t1[1], $ = Math.floor(65535 * Math.min(1, G / zr)), Z = Math.floor(65535 * Math.min(1, H / zr)), W = Math.floor(255 * N) << 8 | Math.floor(255 * k), q = Math.floor(65535 * Math.min(1, U / zr)), X = Math.floor(65535 * Math.min(1, j / zr)); 20243 } 20244 const Y = Array(g.length), J = { 20245 x: 1 / 0, 20246 y: 1 / 0 20247 }, K = { 20248 x: -1 / 0, 20249 y: -1 / 0 20250 }, Q = { 20251 x: 0, 20252 y: 0 20253 }; 20254 let ee = 0; 20255 for(let e1 = 0; e1 < g.length; e1++){ 20256 const t1 = g[e1]; 20257 if (t1.length > 0) { 20258 const i = [], n = Array(t1.length + 1); 20259 n[0] = 0; 20260 for(let e1 = 0; e1 < t1.length; e1++){ 20261 const r = t1[e1]; 20262 for(let e1 = 0; e1 < r.length; e1++){ 20263 const t1 = r[r.length - e1 - 1]; 20264 J.x = Math.min(J.x, t1.x), J.y = Math.min(J.y, t1.y), K.x = Math.max(K.x, t1.x), K.y = Math.max(K.y, t1.y), Q.x += t1.x, Q.y += t1.y, ee++, i.push(t1.x), i.push(t1.y); 20265 } 20266 n[e1 + 1] = i.length; 20267 } 20268 Y[e1] = { 20269 id: s.id ? s.id : 0, 20270 height: w, 20271 minHeight: b, 20272 sourceId: 0, 20273 roofType: v, 20274 coordinates: i, 20275 ringIndices: n 20276 }; 20277 } 20278 } 20279 Q.x /= ee || 1, Q.y /= ee || 1; 20280 const te = Yx.generateMesh(Y, B); 20281 if ("string" == typeof te) { 20282 gt("Unable to generate building ".concat(s.id, ": ").concat(te)), u(p); 20283 continue; 20284 } 20285 if (0 === te.meshes.length || 0 === te.modifiedPolygonRings.length) { 20286 u(p); 20287 continue; 20288 } 20289 const ie = V ? this.buildingWithFacade : this.buildingWithoutFacade; 20290 let ne = 0; 20291 for (const e1 of te.meshes)ne += e1.positions.length / 3; 20292 const re = ie.segmentsBucket.prepareSegment(ne, ie.layoutVertexArray, ie.indexArray), oe = []; 20293 let ae = null, se = 0, le = -1; 20294 const ce = ie.layoutVertexArray.length, ue = ce + ne; 20295 ie.layoutVertexArray.resize(ue), ie.layoutCentroidArray.resize(ue), ie.layoutNormalArray.resize(ue), ie.layoutAOArray.resize(ue), ie.layoutColorArray.resize(ue), ie.layoutFloodLightDataArray.resize(ue), V && (ie.layoutFacadePaintArray.resize(ue), ie.layoutFacadeDataArray.resize(ue), ie.layoutFacadeVerticalRangeArray.resize(ue)); 20296 const he = ie.indexArray.length; 20297 let de = 0, fe = ce; 20298 for (const e1 of te.meshes){ 20299 let t1, i; 20300 if (1 === e1.buildingPart) t1 = M, i = T; 20301 else if (0 === e1.buildingPart) t1 = S, i = z; 20302 else if (2 === e1.buildingPart) t1 = R, i = P; 20303 else { 20304 if (3 !== e1.buildingPart) continue; 20305 t1 = D, i = F; 20306 } 20307 if (i = it(i, 0, 1), 3 === e1.buildingPart) { 20308 const t1 = new Array; 20309 for(let i = 0; i < e1.positions.length; i += 12){ 20310 const n = e1.positions[i + 0], r = e1.positions[i + 1], o = e1.positions[i + 3], a = e1.positions[i + 4], s = e1.positions[i + 2], l = e1.positions[i + 8] - s, c = 1, u = o - n, h = a - r, d = Math.hypot(u, h); 20311 t1.push({ 20312 pos: [ 20313 n + .5 * u, 20314 r + .5 * h, 20315 s 20316 ], 20317 normal: [ 20318 h / d, 20319 -u / d, 20320 0 20321 ], 20322 width: d, 20323 height: l, 20324 depth: c, 20325 points: [ 20326 n, 20327 r, 20328 o, 20329 a 20330 ] 20331 }); 20332 } 20333 const i = ie.entranceBloom.segmentsBucket.prepareSegment(10 * t1.length, ie.entranceBloom.layoutVertexArray, ie.entranceBloom.indexArray), n = ie.entranceBloom.layoutVertexArray.length; 20334 se = ie.entranceBloom.indexArray.length, Ly(t1, .5 / this.tileToMeter, ie.entranceBloom.indexArray, ie.entranceBloom.layoutVertexArray, ie.entranceBloom.layoutAttenuationArray); 20335 const r = ie.entranceBloom.layoutVertexArray.length - n; 20336 le = ie.entranceBloom.indexArray.length - se; 20337 for(let e1 = 0; e1 < r; e1++)ie.entranceBloom.layoutColorArray.emplaceBack(255 * D.r << 8 | 255 * D.g, 255 * D.b << 8 | 51 * F); 20338 i.vertexLength += r, i.primitiveLength += le, ae = { 20339 part: e1.buildingPart, 20340 vertexOffset: n, 20341 vertexLength: r 20342 }; 20343 } 20344 ie.layoutVertexArray.float32.set(e1.positions, 3 * fe); 20345 const n = e1.positions.length / 3; 20346 for(let r = 0; r < n; ++r){ 20347 const n = 3 * r; 20348 de = Math.max(de, e1.positions[n + 2]); 20349 const o = e1.normals[n + 1] * Gx, a = e1.normals[n + 2] * Gx, s = 3 * (fe + r); 20350 ie.layoutNormalArray.int16[s] = e1.normals[n] * Gx, ie.layoutNormalArray.int16[s + 1] = o, ie.layoutNormalArray.int16[s + 2] = a; 20351 const l = e1.ao[r]; 20352 ie.layoutAOArray.uint8[fe + r] = 255 * l; 20353 const c = 1 + (l - 1) * E, u = 255 * t1.b * c << 8 | 255 * i; 20354 ie.layoutColorArray.uint16[2 * (fe + r)] = 255 * t1.r * c << 8 | 255 * t1.g * c, ie.layoutColorArray.uint16[2 * (fe + r) + 1] = u; 20355 } 20356 const r = Math.min(8191, Math.max(0, Math.floor(Q.x))), o = Math.min(8191, Math.max(0, Math.floor(Q.y))), a = Math.floor(w), s = 20, l = 4 * r + Math.min(3, Math.round((K.x - J.x) * this.tileToMeter / s)), c = 4 * o + Math.min(3, Math.round((K.y - J.y) * this.tileToMeter / s)); 20357 for(let e1 = 0; e1 < n; ++e1){ 20358 const t1 = 3 * (fe + e1); 20359 ie.layoutCentroidArray.int16[t1] = l, ie.layoutCentroidArray.int16[t1 + 1] = c, ie.layoutCentroidArray.int16[t1 + 2] = a; 20360 } 20361 if (ie.layoutFloodLightDataArray.int16.fill(0 === e1.buildingPart ? L : 0, fe, fe + n), V) { 20362 const t1 = 255 * R.r << 8 | 255 * R.g, i = 255 * R.b << 8 | 255 * P; 20363 for(let e1 = 0; e1 < n; ++e1){ 20364 const n = 2 * (fe + e1); 20365 ie.layoutFacadePaintArray.uint16[n] = t1, ie.layoutFacadePaintArray.uint16[n + 1] = i; 20366 } 20367 for(let t1 = 0; t1 < n; ++t1)if (e1.isFauxFacade[t1]) { 20368 const i = Math.min(65535, Math.floor(e1.uv[2 * t1] * te.outerRingLength)); 20369 ie.layoutFacadeDataArray.emplace(fe + t1, 1 | i, W, q, X), ie.layoutFacadeVerticalRangeArray.emplace(fe + t1, $, Z); 20370 } else ie.layoutFacadeDataArray.emplace(fe + t1, 0, 0, 0, 0), ie.layoutFacadeVerticalRangeArray.emplace(fe + t1, 0, 0); 20371 } 20372 const u = re.vertexLength, h = e1.indices.length / 3, d = ie.indexArray.length; 20373 ie.indexArray.resize(d + h); 20374 for(let t1 = 0; t1 < h; ++t1){ 20375 const i = 3 * t1, n = 3 * d + i; 20376 ie.indexArray.uint16[n] = u + e1.indices[i], ie.indexArray.uint16[n + 1] = u + e1.indices[i + 1], ie.indexArray.uint16[n + 2] = u + e1.indices[i + 2]; 20377 } 20378 1 !== e1.buildingPart && 0 !== e1.buildingPart && 2 !== e1.buildingPart && 3 !== e1.buildingPart || oe.push({ 20379 part: e1.buildingPart, 20380 vertexOffset: fe, 20381 vertexLength: e1.positions.length / 3 20382 }), fe += n, re.vertexLength += n, re.primitiveLength += e1.indices.length / 3; 20383 } 20384 this.maxHeight = Math.max(this.maxHeight, de); 20385 const pe = ie.indexArray.length - he, me = this.footprintsIndices.length, _e = this.footprintsVertices.length, ge = [], ye = new Pe(1 / 0, 1 / 0), xe = new Pe(-1 / 0, -1 / 0), ve = b <= 0, be = this.groundEffect.vertexArray.length; 20386 for (const e1 of te.modifiedPolygonRings){ 20387 const t1 = [], i = new Pe(1 / 0, 1 / 0), n = new Pe(-1 / 0, -1 / 0); 20388 for(let r = 0; r < e1.length; r += 2){ 20389 const o = e1.length - r - 2; 20390 i.x = Math.min(i.x, e1[o]), i.y = Math.min(i.y, e1[o + 1]), n.x = Math.max(n.x, e1[o]), n.y = Math.max(n.y, e1[o + 1]); 20391 const a = new Pe(e1[o], e1[o + 1]); 20392 ve && t1.push(a), ge.push(a.x, a.y), this.footprintsVertices.emplaceBack(a.x, a.y); 20393 } 20394 ye.x = Math.min(ye.x, i.x), ye.y = Math.min(ye.y, i.y), xe.x = Math.max(xe.x, n.x), xe.y = Math.max(xe.y, n.y), ve && this.groundEffect.addData(t1, [ 20395 i, 20396 n 20397 ], I); 20398 } 20399 const we = this.groundEffect.vertexArray.length - be; 20400 this.groundEffect.groundRadiusArray.reserveForAdditional(we); 20401 for(let e1 = 0; e1 < we; e1++)this.groundEffect.groundRadiusArray.emplaceBack(A); 20402 (J.x < 0 || K.x > zr || J.y < 0 || K.y > zr) && this.featuresOnBorder.push({ 20403 featureId: s.id, 20404 footprintIndex: this.footprints.length 20405 }); 20406 { 20407 const e1 = Dl(ge, null, 2); 20408 this.footprintsIndices.resize(this.footprintsIndices.length + e1.length), this.footprintsIndices.uint16.set(e1, me), this.buildingIds.add(p !== null && p !== void 0 ? p : s.id), this.footprintsMin.x = Math.min(this.footprintsMin.x, ye.x), this.footprintsMin.y = Math.min(this.footprintsMin.y, ye.y), this.footprintsMax.x = Math.max(this.footprintsMax.x, xe.x), this.footprintsMax.y = Math.max(this.footprintsMax.y, xe.y); 20409 const t1 = { 20410 footprintVertexOffset: _e, 20411 footprintVertexLength: this.footprintsVertices.length - _e, 20412 footprintIndexOffset: me, 20413 footprintIndexLength: this.footprintsIndices.length - me, 20414 min: ye, 20415 max: xe, 20416 hiddenFlags: 0, 20417 indicesOffset: he, 20418 indicesLength: pe, 20419 bloomIndicesOffset: se, 20420 bloomIndicesLength: le, 20421 groundEffectVertexOffset: be, 20422 groundEffectVertexLength: we, 20423 hasFauxFacade: V, 20424 height: de, 20425 promoteId: l, 20426 feature: m, 20427 parts: oe, 20428 buildingBloom: ae 20429 }, i = this.footprints.length; 20430 void 0 !== s.id && this.featureFootprintLookup.set(s.id, i), h(p, i), this.footprints.push(t1); 20431 } 20432 this.programConfigurations.populatePaintArrays(ie.layoutVertexArray.length, s, d, {}, t1.availableImages, i, t1.brightness), this.groundEffect.addPaintPropertiesData(s, d, {}, t1.availableImages, i, t1.brightness), t1.featureIndex.insert(s, _, d, f, this.index, ce); 20433 } 20434 l.forEach((param)=>{ 20435 let { buildingId: e1, footprintIndex: t1 } = param; 20436 c.has(e1) && (this.footprints[t1].hiddenFlags |= 4); 20437 }); 20438 const p = new Set; 20439 this.buildingIds.forEach((e1, t1, i)=>{ 20440 c.has(e1) || p.add(e1); 20441 }), this.buildingIds = p, this.groundEffect.prepareBorderSegments(); 20442 } 20443 update(e1, t1, i, n, r, o, a) { 20444 this.programConfigurations.updatePaintArrays(e1, t1, r, i, n, o, a), this.groundEffect.update(e1, t1, r, i, n, o, a), this.evaluate(this.layers[0], e1), this.colorBufferUploaded = !1; 20445 } 20446 updateExpressions(e1) { 20447 this.programConfigurations.updateExpressions(e1), this.groundEffect.programConfigurations.updateExpressions(e1); 20448 } 20449 isEmpty() { 20450 return 0 === this.buildingWithoutFacade.layoutVertexArray.length && 0 === this.buildingWithFacade.layoutVertexArray.length; 20451 } 20452 uploadPending() { 20453 return !this.uploaded || this.programConfigurations.needsUpload || this.groundEffect.programConfigurations.needsUpload; 20454 } 20455 upload(e1) { 20456 const t1 = (t1)=>{ 20457 t1.layoutVertexBuffer = e1.createVertexBuffer(t1.layoutVertexArray, By.members), t1.layoutNormalBuffer = e1.createVertexBuffer(t1.layoutNormalArray, Vy.members), t1.layoutCentroidBuffer = e1.createVertexBuffer(t1.layoutCentroidArray, Ny.members), t1.layoutFloodLightDataBuffer = e1.createVertexBuffer(t1.layoutFloodLightDataArray, $y.members), t1.layoutFacadeDataArray && t1.layoutFacadeDataArray.length && (t1.layoutFacadeDataBuffer = e1.createVertexBuffer(t1.layoutFacadeDataArray, jy.members)), t1.layoutFacadeVerticalRangeArray && t1.layoutFacadeVerticalRangeArray.length && (t1.layoutFacadeVerticalRangeBuffer = e1.createVertexBuffer(t1.layoutFacadeVerticalRangeArray, Gy.members)), t1.entranceBloom.layoutVertexArray.length && (t1.entranceBloom.layoutVertexBuffer = e1.createVertexBuffer(t1.entranceBloom.layoutVertexArray, By.members), t1.entranceBloom.layoutAttenuationBuffer = e1.createVertexBuffer(t1.entranceBloom.layoutAttenuationArray, Hy.members)), this.uploadUpdatedColorBuffer(e1), this.uploadUpdatedIndexBuffer(e1); 20458 }; 20459 this.uploaded || (t1(this.buildingWithoutFacade), t1(this.buildingWithFacade), this.groundEffect.upload(e1)), this.groundEffect.uploadPaintProperties(e1), this.programConfigurations.upload(e1), this.uploaded = !0; 20460 } 20461 destroy() { 20462 const e1 = (e1)=>{ 20463 e1.layoutVertexBuffer && (e1.layoutVertexBuffer.destroy(), e1.layoutNormalBuffer.destroy(), e1.layoutColorBuffer.destroy(), e1.segmentsBucket.destroy(), e1.indexBuffer && e1.indexBuffer.destroy(), e1.entranceBloom.layoutVertexBuffer && (e1.entranceBloom.layoutVertexBuffer.destroy(), e1.entranceBloom.layoutColorBuffer.destroy(), e1.entranceBloom.layoutAttenuationBuffer.destroy(), e1.entranceBloom.indexBuffer.destroy(), e1.entranceBloom.segmentsBucket.destroy())); 20464 }; 20465 e1(this.buildingWithoutFacade), e1(this.buildingWithFacade), this.groundEffect.destroy(), this.programConfigurations.destroy(); 20466 } 20467 updateFootprintHiddenFlags(e1, t1) { 20468 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0; 20469 let n = !1; 20470 const r = i ? t1 : 0, o = 0 | (i ? -1 : ~t1); 20471 0 === this.groundEffect.hiddenByLandmarkVertexArray.length && this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length); 20472 for (const t1 of e1){ 20473 const e1 = this.footprints[t1], i = e1.hiddenFlags & o | r; 20474 e1.hiddenFlags !== i && (e1.hiddenFlags = i, n = !0, this.groundEffect.updateHiddenByLandmarkRange(e1.groundEffectVertexOffset, e1.groundEffectVertexLength, 0 !== e1.hiddenFlags)); 20475 } 20476 return n && (this.indexArrayForConflationUploaded = !1), n; 20477 } 20478 uploadUpdatedIndexBuffer(e1) { 20479 if (this.groundEffect.uploadHiddenByLandmark(e1), this.indexArrayForConflationUploaded) return; 20480 const t1 = (e1)=>{ 20481 0 !== e1.indexArray.length && (e1.indexArrayForConflation.resize(e1.indexArray.length), e1.indexArrayForConflation.uint16.set(e1.indexArray.uint16), e1.entranceBloom.indexArrayForConflation.resize(e1.entranceBloom.indexArray.length), e1.entranceBloom.indexArrayForConflation.uint16.set(e1.entranceBloom.indexArray.uint16)); 20482 }; 20483 t1(this.buildingWithoutFacade), t1(this.buildingWithFacade); 20484 for (const e1 of this.footprints){ 20485 const t1 = e1.hasFauxFacade ? this.buildingWithFacade : this.buildingWithoutFacade, i = e1.indicesOffset + e1.indicesLength; 20486 if (0 !== e1.hiddenFlags) { 20487 for(let n = e1.indicesOffset; n < i; n++)t1.indexArrayForConflation.uint16[3 * n + 0] = 0, t1.indexArrayForConflation.uint16[3 * n + 1] = 0, t1.indexArrayForConflation.uint16[3 * n + 2] = 0; 20488 const n = e1.bloomIndicesOffset + e1.bloomIndicesLength; 20489 for(let i = e1.bloomIndicesOffset; i < n; i++)t1.entranceBloom.indexArrayForConflation.uint16[3 * i + 0] = 0, t1.entranceBloom.indexArrayForConflation.uint16[3 * i + 1] = 0, t1.entranceBloom.indexArrayForConflation.uint16[3 * i + 2] = 0; 20490 } 20491 } 20492 const i = (t1)=>{ 20493 0 !== t1.indexArray.length && (t1.indexBuffer ? t1.indexBuffer.updateData(t1.indexArrayForConflation) : t1.indexBuffer = e1.createIndexBuffer(t1.indexArrayForConflation, !0), t1.entranceBloom.indexBuffer ? t1.entranceBloom.indexBuffer.updateData(t1.entranceBloom.indexArrayForConflation) : t1.entranceBloom.indexBuffer = e1.createIndexBuffer(t1.entranceBloom.indexArrayForConflation, !0)); 20494 }; 20495 i(this.buildingWithoutFacade), i(this.buildingWithFacade), this.indexArrayForConflationUploaded = !0; 20496 } 20497 uploadUpdatedColorBuffer(e1) { 20498 const t1 = (t1)=>{ 20499 t1.layoutColorBuffer ? t1.layoutColorBuffer.updateData(t1.layoutColorArray) : t1.layoutColorBuffer = e1.createVertexBuffer(t1.layoutColorArray, ky.members, !0), t1.layoutFacadePaintArray && (t1.layoutFacadePaintBuffer ? t1.layoutFacadePaintBuffer.updateData(t1.layoutFacadePaintArray) : t1.layoutFacadePaintBuffer = e1.createVertexBuffer(t1.layoutFacadePaintArray, Uy.members, !0)), t1.entranceBloom.layoutColorBuffer ? t1.entranceBloom.layoutColorBuffer.updateData(t1.entranceBloom.layoutColorArray) : t1.entranceBloom.layoutColorBuffer = e1.createVertexBuffer(t1.entranceBloom.layoutColorArray, ky.members, !0); 20500 }; 20501 t1(this.buildingWithoutFacade), t1(this.buildingWithFacade), this.colorBufferUploaded = !0; 20502 } 20503 evaluate(e1, t1) { 20504 const i = e1.paint.get("building-ambient-occlusion-intensity"); 20505 for (const n of this.footprints){ 20506 if (4 & n.hiddenFlags) continue; 20507 const r = t1[n.promoteId], o = n.feature; 20508 o.properties["building-part"] = "roof"; 20509 const a = e1.paint.get("building-color").evaluate(o, r, this.canonical).toPremultipliedRenderColor(this.lut), s = e1.paint.get("building-emissive-strength").evaluate(o, r, this.canonical); 20510 o.properties["building-part"] = "wall"; 20511 const l = e1.paint.get("building-color").evaluate(o, r, this.canonical).toPremultipliedRenderColor(this.lut), c = e1.paint.get("building-emissive-strength").evaluate(o, r, this.canonical); 20512 o.properties["building-part"] = "window"; 20513 const u = e1.paint.get("building-color").evaluate(o, r, this.canonical).toPremultipliedRenderColor(this.lut), h = e1.paint.get("building-emissive-strength").evaluate(o, r, this.canonical); 20514 o.properties["building-part"] = "door"; 20515 const d = e1.paint.get("building-color").evaluate(o, r, this.canonical).toPremultipliedRenderColor(this.lut), f = e1.paint.get("building-emissive-strength").evaluate(o, r, this.canonical), p = n.hasFauxFacade ? this.buildingWithFacade : this.buildingWithoutFacade; 20516 for (const e1 of n.parts){ 20517 let t1, r = a; 20518 1 === e1.part ? (r = a, t1 = s) : 0 === e1.part ? (r = l, t1 = c) : 2 === e1.part ? (r = u, t1 = h) : 3 === e1.part && (r = d, t1 = f), t1 = it(t1, 0, 1); 20519 for(let o = 0; o < e1.vertexLength; o++){ 20520 const a = e1.vertexOffset + o, s = 1 + (p.layoutAOArray.uint8[a] / 255 - 1) * i; 20521 p.layoutColorArray.emplace(a, r.r * s * 255 << 8 | r.g * s * 255, r.b * s * 255 << 8 | 255 * t1), n.hasFauxFacade && p.layoutFacadePaintArray.emplace(a, 255 * u.r << 8 | 255 * u.g, 255 * u.b << 8 | 255 * h); 20522 } 20523 } 20524 const m = n.buildingBloom; 20525 if (m) for(let e1 = 0; e1 < m.vertexLength; e1++)p.entranceBloom.layoutColorArray.emplace(m.vertexOffset + e1, 255 * d.r << 8 | 255 * d.g, 255 * d.b << 8 | 51 * f); 20526 } 20527 } 20528 needsEvaluation() { 20529 return !this.colorBufferUploaded; 20530 } 20531 updateReplacement(e1, t1, i) { 20532 if (t1.updateTime === this.replacementUpdateTime) return; 20533 this.replacementUpdateTime = t1.updateTime; 20534 const n = t1.getReplacementRegionsForTile(e1.toUnwrapped()); 20535 if (Bp(this.activeReplacements, n)) return; 20536 this.activeReplacements = n; 20537 for (const e1 of this.footprints)e1.hiddenFlags &= -2; 20538 const r = []; 20539 for (const t1 of this.activeReplacements){ 20540 if (t1.order < i) continue; 20541 const n = Math.max(1, Math.pow(2, t1.footprintTileId.canonical.z - e1.canonical.z)); 20542 for (const i of this.footprints)i.min.x > t1.max.x || i.max.x < t1.min.x || i.min.y > t1.max.y || i.max.y < t1.min.y || (r.length = 0, tv(this.footprintsVertices, i.footprintVertexOffset, i.footprintVertexLength, t1.footprintTileId.canonical, e1.canonical, r), kp(t1.footprint, r, this.footprintsIndices.uint16, i.footprintIndexOffset, i.footprintIndexLength, 0, -n) && (i.hiddenFlags |= 1)); 20543 } 20544 0 === this.groundEffect.hiddenByLandmarkVertexArray.length && this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length); 20545 for (const e1 of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(e1.groundEffectVertexOffset, e1.groundEffectVertexLength, 0 !== e1.hiddenFlags); 20546 this.indexArrayForConflationUploaded = !1; 20547 } 20548 getFootprint(e1) { 20549 if (void 0 !== e1.id) { 20550 const t1 = this.featureFootprintLookup.get(e1.id); 20551 return this.footprints[t1]; 20552 } 20553 return null; 20554 } 20555 getHeightAtTileCoord(e1, t1) { 20556 let i = Number.NEGATIVE_INFINITY, n = !0; 20557 const r = 4 * (e1 + zr) * zr + (t1 + zr); 20558 if (Object.hasOwn(this.footprintLookup, r)) { 20559 const e1 = this.footprintLookup[r]; 20560 return e1 ? { 20561 height: e1.height, 20562
20562 hidden: 0 !== e1.hiddenFlags 20563 } : void 0; 20564 } 20565 const o = new Pe(e1, t1); 20566 for (const a of this.footprints)e1 > a.max.x || a.min.x > e1 || t1 > a.max.y || a.min.y > t1 || a.height <= i || ev(o, this.footprintsVertices.float32.subarray(2 * a.footprintVertexOffset, 2 * (a.footprintVertexOffset + a.footprintVertexLength)), this.footprintsIndices.uint16.subarray(a.footprintIndexOffset, a.footprintIndexOffset + a.footprintIndexLength)) && (i = a.height, this.footprintLookup[r] = a, n = 0 !== a.hiddenFlags); 20567 if (i !== Number.NEGATIVE_INFINITY) return { 20568 height: i, 20569 hidden: n 20570 }; 20571 this.footprintLookup[r] = void 0; 20572 } 20573 constructor(e1){ 20574 this.requiresHDRuntime = !0, this.colorBufferUploaded = !1, this.maxHeight = 0, this.replacementUpdateTime = 0, this.activeReplacements = [], this.footprints = [], this.footprintsVertices = new yu, this.footprintsIndices = new vu, this.footprintsMin = new Pe(1 / 0, 1 / 0), this.footprintsMax = new Pe(-1 / 0, -1 / 0), this.featuresOnBorder = [], this.buildingWithoutFacade = new Kx(!1), this.buildingWithFacade = new Kx(!0), this.indexArrayForConflationUploaded = !1, this.featureFootprintLookup = new Map, this.buildingIds = new Set, this.footprintLookup = {}, this.zoom = e1.zoom, this.canonical = e1.canonical, this.layers = e1.layers, this.layerIds = this.layers.map((e1)=>e1.fqid), this.index = e1.index, this.hasPattern = !1, this.worldview = e1.worldview, this.lut = e1.lut, this.programConfigurations = new mh(e1.layers, { 20575 zoom: e1.zoom, 20576 lut: e1.lut 20577 }), this.stateDependentLayerIds = this.layers.filter((e1)=>e1.isStateDependent()).map((e1)=>e1.id), this.projection = e1.projection, this.groundEffect = new Ex(e1), this.groundEffect.groundRadiusArray = new $c, this.hasAppearances = null; 20578 } 20579 } 20580 function ev(e1, t1, i) { 20581 for(let n = 0; n < i.length; n += 3){ 20582 const r = i[n], o = i[n + 1], a = i[n + 2], s = t1[2 * r + 0], l = t1[2 * r + 1], c = t1[2 * o + 0], u = t1[2 * o + 1], h = t1[2 * a + 0], d = t1[2 * a + 1], f = (s - h) * (e1.y - d) - (l - d) * (e1.x - h), p = (c - s) * (e1.y - l) - (u - l) * (e1.x - s); 20583 if (f < 0 != p < 0 && 0 !== f && 0 !== p) continue; 20584 const m = (h - c) * (e1.y - u) - (d - u) * (e1.x - c); 20585 if (0 === m || m < 0 == f + p <= 0) return !0; 20586 } 20587 return !1; 20588 } 20589 function tv(e1, t1, i, n, r, o) { 20590 const a = Math.pow(2, n.z - r.z); 20591 for(let s = 0; s < i; s++){ 20592 let i = e1.float32[2 * (s + t1) + 0], l = e1.float32[2 * (s + t1) + 1]; 20593 i = (i + r.x * zr) * a - n.x * zr, l = (l + r.y * zr) * a - n.y * zr, o.push(new Pe(i, l)); 20594 } 20595 } 20596 Xa(Qx, "BuildingBucket", { 20597 omit: [ 20598 "layers" 20599 ] 20600 }), Xa(Kx, "BuildingGeometry"), Xa(Jx, "BuildingBloomGeometry"); 20601 class iv { 20602 hasGeometry() { 20603 return this.rings.length > 0 && this.rings[0].length > 0; 20604 } 20605 constructor(e1 = 0, t1 = []){ 20606 this.frcMask = e1, this.rings = t1; 20607 } 20608 } 20609 async function nv() {} 20610 function rv(e1, t1, i) { 20611 const n = t1.paint.get(e1).value; 20612 return "constant" === n.kind ? n.value : i.programConfigurations.get(t1.id).getMaxValue(e1); 20613 } 20614 function ov(e1) { 20615 return Math.sqrt(e1[0] * e1[0] + e1[1] * e1[1]); 20616 } 20617 function av(e1, t1, i, n, r) { 20618 if (!t1[0] && !t1[1]) return e1; 20619 const o = Pe.convert(t1)._mult(r); 20620 "viewport" === i && o._rotate(-n); 20621 const a = []; 20622 for(let t1 = 0; t1 < e1.length; t1++)a.push(e1[t1].sub(o)); 20623 return a; 20624 } 20625 function sv(e1, t1, i, n) { 20626 const r = Pe.convert(e1)._mult(n); 20627 return "viewport" === t1 && r._rotate(-i), r; 20628 } 20629 Xa(iv, "FrcCoveragePolygon"); 20630 const lv = c(), cv = (e1)=>{ 20631 const t1 = []; 20632 return "map" === e1.paint.get("circle-pitch-alignment") && t1.push("PITCH_WITH_MAP"), "map" === e1.paint.get("circle-pitch-scale") && t1.push("SCALE_WITH_MAP"), t1; 20633 }; 20634 function uv(e1, t1, i, n, r, o, a, s, l) { 20635 if (o && e1.queryGeometry.isAboveHorizon) return !1; 20636 o && (l *= e1.pixelToTileUnitsFactor); 20637 const c = e1.tileID.canonical, u = i.projection.upVectorScale(c, i.center.lat, i.worldSize).metersToTile; 20638 for (const h of t1)for (const t1 of h){ 20639 const h = t1.add(s), d = r && i.elevation ? i.elevation.exaggeration() * r.getElevationAt(h.x, h.y, !0) : 0, f = i.projection.projectTilePoint(h.x, h.y, c); 20640 if (d > 0) { 20641 const e1 = i.projection.upVector(c, h.x, h.y); 20642 f.x += e1[0] * u * d, f.y += e1[1] * u * d, f.z += e1[2] * u * d; 20643 } 20644 const p = o ? h : hv(f.x, f.y, f.z, n), m = o ? e1.tilespaceRays.map((e1)=>pv(e1, d)) : e1.queryGeometry.screenGeometry, _ = le([], [ 20645 f.x, 20646 f.y, 20647 f.z, 20648 1 20649 ], n); 20650 if (!a && o ? l *= _[3] / i.cameraToCenterDistance : a && !o && (l *= i.cameraToCenterDistance / _[3]), o) { 20651 const e1 = mr((t1.y / zr + c.y) / (1 << c.z)); 20652 l /= i.projection.pixelsPerMeter(e1, 1) / xc(1, e1); 20653 } 20654 if (Vh(m, p, l)) return !0; 20655 } 20656 return !1; 20657 } 20658 function hv(e1, t1, i, n) { 20659 const r = le([], [ 20660 e1, 20661 t1, 20662 i, 20663 1 20664 ], n); 20665 return new Pe(r[0] / r[3], r[1] / r[3]); 20666 } 20667 const dv = F(0, 0, 0), fv = F(0, 0, 1); 20668 function pv(e1, t1) { 20669 const i = R(); 20670 return dv[2] = t1, e1.intersectsPlane(dv, fv, i), new Pe(i[0], i[1]); 20671 } 20672 class mv extends Ad { 20673 } 20674 let _v, gv; 20675 Xa(mv, "HeatmapBucket", { 20676 omit: [ 20677 "layers" 20678 ] 20679 }); 20680 const yv = (e1, t1, i, n)=>fn(t1, i, "log" === n ? (Math.pow(10, e1) - 1) / 9 : e1); 20681 function xv(e1) { 20682 const { expression: t1, evaluationKey: i, resolution: n = 256, clips: r, scale: o = "linear", lut: a = null } = e1, s = r ? r.length : 1, l = e1.image || new ud({ 20683 width: n, 20684 height: s 20685 }), c = {}, u = (e1, n, r)=>
20685{ 20686 var _ref; 20687 c[i] = r; 20688 const o = t1.evaluate(c), s = (_ref = o === null || o === void 0 ? void 0 : o.toNonPremultipliedRenderColor(a)) !== null && _ref !== void 0 ? _ref : null; 20689 s && (l.data[e1 + n + 0] = Math.floor(255 * s.r), l.data[e1 + n + 1] = Math.floor(255 * s.g), l.data[e1 + n + 2] = Math.floor(255 * s.b), l.data[e1 + n + 3] = Math.floor(255 * s.a)); 20690 }; 20691 for(let e1 = 0, t1 = 0; e1 < s; ++e1, t1 += 4 * n){ 20692 var _ref, _ref1; 20693 const i = (_ref = r === null || r === void 0 ? void 0 : r[e1].start) !== null && _ref !== void 0 ? _ref : 0, a = (_ref1 = r === null || r === void 0 ? void 0 : r[e1].end) !== null && _ref1 !== void 0 ? _ref1 : 1; 20694 for(let e1 = 0, r = 0; e1 < n; e1++, r += 4)u(t1, r, yv(e1 / (n - 1), i, a, o)); 20695 } 20696 return l; 20697 } 20698 let vv, bv, wv, Av, Ev, Iv, Mv, Tv, Sv, zv, Rv, Pv; 20699 class Dv { 20700 updateFootprints(e1, t1) { 20701 for (const i of this.footprints)t1.push({ 20702 footprint: i, 20703 id: e1 20704 }); 20705 } 20706 updateAppearances(e1, t1, i, n) { 20707 return { 20708 hasLayoutChanges: !1, 20709 hasUboChanges: !1 20710 }; 20711 } 20712 populate(e1, t1, i, n) { 20713 const r = []; 20714 for (const { feature: o, id: a, index: s, sourceLayerIndex: l } of e1){ 20715 const e1 = this.layers[0]._featureFilter.needGeometry, c = Lc(o, e1); 20716 if (!this.layers[0]._featureFilter.filter(new $s(this.zoom, { 20717 worldview: this.worldview, 20718 activeFloors: t1.activeFloors 20719 }), c, i)) continue; 20720 const u = { 20721 id: a, 20722 properties: o.properties, 20723 type: o.type, 20724 sourceLayerIndex: l, 20725 index: s, 20726 geometry: e1 ? c.geometry : Cc(o, i, n), 20727 patterns: {} 20728 }; 20729 r.push(u); 20730 } 20731 for (const n of r){ 20732 const { geometry: r, index: o, sourceLayerIndex: a } = n; 20733 this.addFeature(n, r, o, i, {}, t1.availableImages, t1.brightness), t1.featureIndex.insert(e1[o].feature, r, o, a, this.index); 20734 } 20735 } 20736 isEmpty() { 20737 return 0 === this.footprints.length; 20738 } 20739 uploadPending() { 20740 return !1; 20741 } 20742 upload(e1) {} 20743 update(e1, t1, i, n, r, o, a) {} 20744 destroy() {} 20745 addFeature(e1, t1, i, n, r) { 20746 let o = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : [], a = arguments.length > 6 ? arguments[6] : void 0; 20747 for (const e1 of Ne(t1, 2)){ 20748 const t1 = [], i = [], n = [], r = new Pe(1 / 0, 1 / 0), o = new Pe(-1 / 0, -1 / 0); 20749 for (const a of e1)if (0 !== a.length) { 20750 a !== e1[0] && n.push(i.length / 2); 20751 for(let e1 = 0; e1 < a.length; e1++)i.push(a[e1].x), i.push(a[e1].y), t1.push(a[e1]), r.x = Math.min(r.x, a[e1].x), r.y = Math.min(r.y, a[e1].y), o.x = Math.max(o.x, a[e1].x), o.y = Math.max(o.y, a[e1].y); 20752 } 20753 const a = Dl(i, n), s = new Hg(t1, a, 8, 256); 20754 this.footprints.push({ 20755 vertices: t1, 20756 indices: a, 20757 grid: s, 20758 min: r, 20759 max: o 20760 }); 20761 } 20762 } 20763 constructor(e1){ 20764 this.zoom = e1.zoom, this.layers = e1.layers, this.layerIds = this.layers.map((e1)=>e1.fqid), this.index = e1.index, this.hasPattern = !1, this.stateDependentLayerIds = this.layers.filter((e1)=>e1.isStateDependent()).map((e1)=>e1.id), this.footprints = [], this.worldview = e1.worldview, this.hasAppearances = null; 20765 } 20766 } 20767 function Fv(e1, t1) { 20768 return e1.x * t1.x + e1.y * t1.y; 20769 } 20770 function Cv(e1, t1) { 20771 if (1 === e1.length) { 20772 let i = 0; 20773 const n = t1[i++]; 20774 let r; 20775 for(; !r || n.equals(r);)if (r = t1[i++], !r) return 1 / 0; 20776 for(; i < t1.length; i++){ 20777 const o = t1[i], a = e1[0], s = r.sub(n), l = o.sub(n), c = a.sub(n), u = Fv(s, s), h = Fv(s, l), d = Fv(l, l), f = Fv(c, s), p = Fv(c, l), m = u * d - h * h, _ = (d * f - h * p) / m, g = (u * p - h * f) / m, y = n.z * (1 - _ - g) + r.z * _ + o.z * g; 20778 if (isFinite(y)) return y; 20779 } 20780 return 1 / 0; 20781 } 20782 { 20783 let e1 = 1 / 0; 20784 for (const i of t1)e1 = Math.min(e1, i.z); 20785 return e1; 20786 } 20787 } 20788 function Lv(e1, t1, i) { 20789 let n = 1 / 0; 20790 Nh(i, t1) && (n = Cv(i, t1[0])); 20791 for(let r = 0; r < t1.length; r++){ 20792 const o = t1[r], a = e1[r]; 20793 for(let e1 = 0; e1 < o.length - 1; e1++){ 20794 const t1 = o[e1], r = [ 20795 t1, 20796 o[e1 + 1], 20797 a[e1 + 1], 20798 a[e1], 20799 t1 20800 ]; 20801 Bh(i, r) && (n = Math.min(n, Cv(i, r))); 20802 } 20803 } 20804 return n !== 1 / 0 && n; 20805 } 20806 function Ov(e1, t1, i, n, r, o, a, s, l, c, u) { 20807 return "globe" === e1.projection.name ? function(e1, t1, i, n, r, o, a, s, l, c, u) { 20808 const h = [], d = [], f = e1.projection.upVectorScale(u, e1.center.lat, e1.worldSize).metersToTile, p = [ 20809 0, 20810 0, 20811 0, 20812 1 20813 ], m = [ 20814 0, 20815 0, 20816 0, 20817 1 20818 ], _ = (e1, t1, i, n)=>{
vendor: 2,812 bytes, lines 20819-20867
20819 e1[0] = t1, e1[1] = i, e1[2] = n, e1[3] = 1; 20820 }, g = Bx(); 20821 i > 0 && (i += g), n += g; 20822 for (const g of t1){ 20823 const t1 = [], y = []; 20824 for (const h of g){ 20825 const d = h.x + r.x, g = h.y + r.y, x = e1.projection.projectTilePoint(d, g, u), v = e1.projection.upVector(u, h.x, h.y); 20826 let b = i, w = n; 20827 if (a) { 20828 const e1 = Bv(d, g, i, n, a, s, l, c); 20829 b += e1.base, w += e1.top; 20830 } 20831 0 !== i ? _(p, x.x + v[0] * f * b, x.y + v[1] * f * b, x.z + v[2] * f * b) : _(p, x.x, x.y, x.z), _(m, x.x + v[0] * f * w, x.y + v[1] * f * w, x.z + v[2] * f * w), Y(p, p, o), Y(m, m, o), t1.push(new Qh(p[0], p[1], p[2])), y.push(new Qh(m[0], m[1], m[2])); 20832 } 20833 h.push(t1), d.push(y); 20834 } 20835 return [ 20836 h, 20837 d 20838 ]; 20839 }(e1, t1, i, n, r, o, a, s, l, c, u) : a ? function(e1, t1, i, n, r, o, a, s, l) { 20840 const c = [], u = [], h = [ 20841 0, 20842 0, 20843 0, 20844 1 20845 ]; 20846 for (const d of e1){ 20847 const e1 = [], f = []; 20848 for (const c of d){ 20849 const u = c.x + n.x, d = c.y + n.y, p = Bv(u, d, t1, i, o, a, s, l); 20850 h[0] = u, h[1] = d, h[2] = p.base, h[3] = 1, le(h, h, r), h[3] = Math.max(h[3], 1e-5); 20851 const m = new Qh(h[0] / h[3], h[1] / h[3], h[2] / h[3]); 20852 h[0] = u, h[1] = d, h[2] = p.top, h[3] = 1, le(h, h, r), h[3] = Math.max(h[3], 1e-5); 20853 const _ = new Qh(h[0] / h[3], h[1] / h[3], h[2] / h[3]); 20854 e1.push(m), f.push(_); 20855 } 20856 c.push(e1), u.push(f); 20857 } 20858 return [ 20859 c, 20860 u 20861 ]; 20862 }(t1, i, n, r, o, a, s, l, c) : function(e1, t1, i, n, r) { 20863 const o = [], a = [], s = r[8] * t1, l = r[9] * t1, c = r[10] * t1, u = r[11] * t1, h = r[8] * i, d = r[9] * i, f = r[10] * i, p = r[11] * i; 20864 for (const t1 of e1){ 20865 const e1 = [], i = []; 20866 for (const o of t1){ 20867 const t1 = o.x + n.x, a = o.y + n.y, m = r[0] * t1 + r[4] * a + r[12], _ = r[1] * t1 + r[5] * a + r[13], g = r[2] * t1 + r[6] * a + r[14], y = r[3] * t1 + r[7] * a + r[15], x = m + s, v = _ + l, b = g + c, w = Math.max(y + u, 1e-5), A = m + h, E = _ + d, I = g + f, M = Math.max(y + p, 1e-5);
20868 e1.push(new Qh(x / w, v / w, b / w)), i.push(new Qh(A / M, E / M, I / M)); 20869 } 20870 o.push(e1), a.push(i); 20871 } 20872 return [ 20873 o, 20874 a 20875 ]; 20876 }(t1, i, n, r, o); 20877 } 20878 function Bv(e1, t1, i, n, r, o, a, s) { 20879 const l = a * r.getElevationAt(e1, t1, !0, !0), c = 0 !== o[0], u = c ? 0 === o[1] ? a * (o[0] / 7 - 450) : a * function(e1, t1, i) { 20880 const n = Math.floor(t1[0] / 8), r = Math.floor(t1[1] / 8), o = 10 * (t1[0] - 8 * n), a = 10 * (t1[1] - 8 * r), s = e1.getElevationAt(n, r, !0, !0), l = e1.getMeterToDEM(i), c = Math.floor(.5 * (o * l - 1)), u = Math.floor(.5 * (a * l - 1)), h = e1.tileCoordToPixel(n, r), d = 2 * c + 1, f = 2 * u + 1, p = function(e1, t1, i, n, r) { 20881 return [ 20882 e1.getElevationAtPixel(t1, i, !0), 20883 e1.getElevationAtPixel(t1 + r, i, !0), 20884 e1.getElevationAtPixel(t1, i + r, !0), 20885 e1.getElevationAtPixel(t1 + n, i + r, !0) 20886 ]; 20887 }(e1, h.x - c, h.y - u, d, f), m = Math.abs(p[0] - p[1]), _ = Math.abs(p[2] - p[3]), g = Math.abs(p[0] - p[2]) + Math.abs(p[1] - p[3]), y = Math.min(.25, .5 * l * (m + _) / d), x = Math.min(.25, .5 * l * g / f); 20888 return s + Math.max(y * o, x * a); 20889 }(r, o, s) : l; 20890 return { 20891 base: l + (0 === i ? -1 : i), 20892 top: c ? Math.max(u + n, l + i + 2) : l + n 20893 }; 20894 } 20895 function Vv(e1, t1, i) { 20896 return t1 * (zr / (e1.tileSize * Math.pow(2, i - e1.tileID.overscaledZ))); 20897 } 20898 function Nv(e1, t1) { 20899 return 1 / Vv(e1, 1, t1.tileZoom); 20900 } 20901 function kv(e1, t1, i, n) { 20902 return e1.translatePosMatrix(n || t1.tileID.projMatrix, t1, i.paint.get("line-translate"), i.paint.get("line-translate-anchor")); 20903 } 20904 Xa(Dv, "ClipBucket", { 20905 omit: [ 20906 "layers" 20907 ] 20908 }); 20909 const Uv = (e1)=>{ 20910 const t1 = []; 20911 jv(e1) && t1.push("RENDER_LINE_DASH"), e1.paint.get("line-gradient") && t1.push("RENDER_LINE_GRADIENT"), "multiply" === e1.paint.get("line-blend-mode") && t1.push("LINE_BLEND_MULTIPLY"), "additive" === e1.paint.get("line-blend-mode") && t1.push("LINE_BLEND_ADDITIVE"); 20912 const i = e1.paint.get("line-trim-offset"); 20913 0 === i[0] && 0 === i[1] || t1.push("RENDER_LINE_TRIM_OFFSET"); 20914 const n = 0 !== e1.paint.get("line-border-width").constantOr(1); 20915 n && t1.push("RENDER_LINE_BORDER"), n && e1.paint.get("line-border-gradient") && t1.push("RENDER_LINE_BORDER_GRADIENT"); 20916 const r = "none" === e1.layout.get("line-join").constantOr("miter"), o = !!e1.paint.get("line-pattern").constantOr(1); 20917 return r && o && t1.push("LINE_JOIN_NONE"), t1; 20918 }; 20919 function jv(e1) { 20920 const t1 = e1.paint.get("line-dasharray").value; 20921 return "constant" !== t1.kind || t1.value; 20922 } 20923 let Gv; 20924 const Hv = ()=>Gv || (Gv = { 20925 layout: Rv || (Rv = new nl({ 20926 "line-cap": new tl(rl.layout_line["line-cap"]), 20927 "line-join": new tl(rl.layout_line["line-join"]), 20928 "line-miter-limit": new el(rl.layout_line["line-miter-limit"]), 20929 "line-round-limit": new el(rl.layout_line["line-round-limit"]), 20930 "line-sort-key": new tl(rl.layout_line["line-sort-key"]), 20931 "line-z-offset": new tl(rl.layout_line["line-z-offset"]), 20932 "line-elevation-reference": new el(rl.layout_line["line-elevation-reference"]), 20933 "line-cross-slope": new el(rl.layout_line["line-cross-slope"]), 20934 visibility: new el(rl.layout_line.visibility), 20935 "line-width-unit": new el(rl.layout_line["line-width-unit"]), 20936 "line-elevation-ground-scale": new tl(rl.layout_line["line-elevation-ground-scale"]) 20937 })), 20938 paint: Pv || (Pv = new nl({ 20939 "line-opacity": new tl(rl.paint_line["line-opacity"]), 20940 "line-color": new tl(rl.paint_line["line-color"]), 20941 "line-translate": new el(rl.paint_line["line-translate"]), 20942 "line-translate-anchor": new el(rl.paint_line["line-translate-anchor"]), 20943 "line-width": new tl(rl.paint_line["line-width"]), 20944 "line-gap-width": new tl(rl.paint_line["line-gap-width"]), 20945 "line-offset": new tl(rl.paint_line["line-offset"]),
20946 "line-blur": new tl(rl.paint_line["line-blur"]), 20947 "line-dasharray": new tl(rl.paint_line["line-dasharray"]), 20948 "line-pattern": new tl(rl.paint_line["line-pattern"]), 20949 "line-pattern-cross-fade": new el(rl.paint_line["line-pattern-cross-fade"]), 20950 "line-gradient": new il(rl.paint_line["line-gradient"]), 20951 "line-trim-offset": new el(rl.paint_line["line-trim-offset"]), 20952 "line-trim-fade-range": new el(rl.paint_line["line-trim-fade-range"]), 20953 "line-trim-color": new el(rl.paint_line["line-trim-color"]), 20954 "line-emissive-strength": new tl(rl.paint_line["line-emissive-strength"]), 20955 "line-border-width": new tl(rl.paint_line["line-border-width"]), 20956 "line-border-color": new tl(rl.paint_line["line-border-color"]), 20957 "line-border-gradient": new il(rl.paint_line["line-border-gradient"]), 20958 "line-occlusion-opacity": new el(rl.paint_line["line-occlusion-opacity"]), 20959 "line-blend-mode": new el(rl.paint_line["line-blend-mode"]), 20960 "line-blend-additive-clamp": new el(rl.paint_line["line-blend-additive-clamp"]), 20961 "line-cutout-depth": new el(rl.paint_line["line-cutout-depth"]), 20962 "line-color-use-theme": new tl({ 20963 type: "string", 20964 default: "default", 20965 "property-type": "data-driven" 20966 }), 20967 "line-gradient-use-theme": new tl({ 20968 type: "string", 20969 default: "default", 20970 "property-type": "data-driven" 20971 }), 20972 "line-trim-color-use-theme": new tl({ 20973 type: "string", 20974 default: "default", 20975 "property-type": "data-driven" 20976 }), 20977 "line-border-color-use-theme": new tl({ 20978 type: "string", 20979 default: "default", 20980 "property-type": "data-driven" 20981 }), 20982 "line-border-gradient-use-theme": new tl({ 20983 type: "string", 20984 default: "default", 20985 "property-type": "data-driven" 20986 }) 20987 })) 20988 }, Gv); 20989 class $v extends tl { 20990 possiblyEvaluate(e1, t1) { 20991 return t1 = new $s(Math.floor(t1.zoom), { 20992 now: t1.now, 20993 fadeDuration: t1.fadeDuration, 20994 transition: t1.transition, 20995 worldview: t1.worldview 20996 }), super.possiblyEvaluate(e1, t1); 20997 } 20998 evaluate(e1, t1, i, n) { 20999 return t1 = { 21000 ...t1, 21001 zoom: Math.floor(t1.zoom) 21002 }, super.evaluate(e1, t1, i, n); 21003 } 21004 } 21005 let Zv, Wv, qv, Xv; 21006 function Yv(e1, t1) { 21007 return t1 > 0 ? t1 + 2 * e1 : e1; 21008 } 21009 function Jv(e1, t1) { 21010 return t1.replace(/{([^{}]+)}/g, (t1, i)=>i in e1 ? String(e1[i]) : ""); 21011 } 21012 class Kv { 21013 evaluate(e1) { 21014 if (e1.formattedSection) { 21015 const t1 = this.defaultValue.property.overrides; 21016 if (t1 && t1.hasOverride(e1.formattedSection)) return t1.getOverride(e1.formattedSection); 21017 } 21018 return e1.feature && e1.featureState ? this.defaultValue.evaluate(e1.feature, e1.featureState) : this.defaultValue.property.specification.default; 21019 } 21020 eachChild(e1) { 21021 this.defaultValue.isConstant() || e1(this.defaultValue.value._styleExpression.expression); 21022 } 21023 outputDefined() { 21024 return !1; 21025 } 21026 serialize() { 21027 return null; 21028 } 21029 constructor(e1){ 21030 this.type = e1.property.overrides ? e1.property.overrides.runtimeType : An, this.defaultValue = e1; 21031 } 21032 } 21033 Xa(Kv, "FormatSectionOverride", { 21034 omit: [ 21035 "defaultValue" 21036 ] 21037 }); 21038 const Qv = ()=>Xv || (Xv = { 21039 layout: Wv || (Wv = new nl({ 21040 "symbol-placement": new el(rl.layout_symbol["symbol-placement"]), 21041 "symbol-spacing": new el(rl.layout_symbol["symbol-spacing"]), 21042 "symbol-avoid-edges": new el(rl.layout_symbol["symbol-avoid-edges"]), 21043 "symbol-sort-key": new tl(rl.layout_symbol["symbol-sort-key"]), 21044 "symbol-z-order": new el(rl.layout_symbol["symbol-z-order"]), 21045 "symbol-z-elevate": new el(rl.layout_symbol["symbol-z-elevate"]), 21046 "symbol-elevation-reference": new el(rl.layout_symbol["symbol-elevation-reference"]), 21047 "icon-allow-overlap": new el(rl.layout_symbol["icon-allow-overlap"]), 21048 "icon-ignore-placement": new el(rl.layout_symbol["icon-ignore-placement"]), 21049 "icon-optional": new el(rl.layout_symbol["icon-optional"]), 21050 "icon-rotation-alignment": new el(rl.layout_symbol["icon-rotation-alignment"]), 21051 "icon-size": new tl(rl.layout_symbol["icon-size"]), 21052 "icon-size-scale-range": new el(rl.layout_symbol["icon-size-scale-range"]), 21053 "icon-text-fit": new tl(rl.layout_symbol["icon-text-fit"]), 21054 "icon-text-fit-padding": new tl(rl.layout_symbol["icon-text-fit-padding"]), 21055 "icon-image": new tl(rl.layout_symbol["icon-image"]), 21056 "icon-image-use-theme": new el({ 21057 type: "string", 21058 default: "default", 21059 "property-type": "data-constant" 21060 }), 21061 "icon-rotate": new tl(rl.layout_symbol["icon-rotate"]), 21062 "icon-padding": new el(rl.layout_symbol["icon-padding"]), 21063 "icon-keep-upright": new el(rl.layout_symbol["icon-keep-upright"]), 21064 "icon-offset": new tl(rl.layout_symbol["icon-offset"]), 21065 "icon-anchor": new tl(rl.layout_symbol["icon-anchor"]), 21066 "icon-pitch-alignment": new el(rl.layout_symbol["icon-pitch-alignment"]), 21067 "text-pitch-alignment": new el(rl.layout_symbol["text-pitch-alignment"]), 21068 "text-rotation-alignment": new el(rl.layout_symbol["text-rotation-alignment"]), 21069 "text-field": new tl(rl.layout_symbol["text-field"]), 21070 "text-font": new tl(rl.layout_symbol["text-font"]), 21071 "text-size": new tl(rl.layout_symbol["text-size"]), 21072 "text-size-scale-range": new el(rl.layout_symbol["text-size-scale-range"]), 21073 "text-max-width": new tl(rl.layout_symbol["text-max-width"]), 21074 "text-line-height": new tl(rl.layout_symbol["text-line-height"]), 21075 "text-letter-spacing": new tl(rl.layout_symbol["text-letter-spacing"]), 21076 "text-justify": new tl(rl.layout_symbol["text-justify"]), 21077 "text-radial-offset": new tl(rl.layout_symbol["text-radial-offset"]), 21078 "text-variable-anchor": new el(rl.layout_symbol["text-variable-anchor"]), 21079 "text-anchor": new tl(rl.layout_symbol["text-anchor"]), 21080 "text-max-angle": new el(rl.layout_symbol["text-max-angle"]), 21081 "text-writing-mode": new el(rl.layout_symbol["text-writing-mode"]), 21082 "text-rotate": new tl(rl.layout_symbol["text-rotate"]), 21083 "text-padding": new el(rl.layout_symbol["text-padding"]), 21084 "text-keep-upright": new el(rl.layout_symbol["text-keep-upright"]), 21085 "text-transform": new tl(rl.layout_symbol["text-transform"]), 21086 "text-offset": new tl(rl.layout_symbol["text-offset"]), 21087 "text-allow-overlap": new el(rl.layout_symbol["text-allow-overlap"]), 21088 "text-ignore-placement": new el(rl.layout_symbol["text-ignore-placement"]), 21089 "text-optional": new el(rl.layout_symbol["text-optional"]), 21090 visibility: new el(rl.layout_symbol.visibility) 21091 })), 21092 paint: qv || (qv = new nl({ 21093 "icon-opacity": new tl(rl.paint_symbol["icon-opacity"]), 21094 "icon-occlusion-opacity": new tl(rl.paint_symbol["icon-occlusion-opacity"]), 21095 "icon-emissive-strength": new tl(rl.paint_symbol["icon-emissive-strength"]), 21096 "text-emissive-strength": new tl(rl.paint_symbol["text-emissive-strength"]), 21097 "icon-color": new tl(rl.paint_symbol["icon-color"]), 21098 "icon-halo-color": new tl(rl.paint_symbol["icon-halo-color"]), 21099 "icon-halo-width": new tl(rl.paint_symbol["icon-halo-width"]), 21100 "icon-halo-blur": new tl(rl.paint_symbol["icon-halo-blur"]), 21101 "icon-translate": new el(rl.paint_symbol["icon-translate"]), 21102 "icon-translate-anchor": new el(rl.paint_symbol["icon-translate-anchor"]), 21103 "icon-image-cross-fade": new el(rl.paint_symbol["icon-image-cross-fade"]), 21104 "text-opacity": new tl(rl.paint_symbol["text-opacity"]), 21105 "text-occlusion-opacity": new tl(rl.paint_symbol["text-occlusion-opacity"]), 21106 "text-color": new tl(rl.paint_symbol["text-color"], { 21107 runtimeType: Tn, 21108 getOverride: (e1)=>e1.textColor, 21109 hasOverride: (e1)=>!!e1.textColor 21110 }), 21111 "text-halo-color": new tl(rl.paint_symbol["text-halo-color"]), 21112 "text-halo-width": new tl(rl.paint_symbol["text-halo-width"]), 21113 "text-halo-blur": new tl(rl.paint_symbol["text-halo-blur"]), 21114 "text-translate": new el(rl.paint_symbol["text-translate"]), 21115 "text-translate-anchor": new el(rl.paint_symbol["text-translate-anchor"]), 21116 "icon-color-saturation": new el(rl.paint_symbol["icon-color-saturation"]), 21117 "icon-color-contrast": new el(rl.paint_symbol["icon-color-contrast"]), 21118 "icon-color-brightness-min": new el(rl.paint_symbol["icon-color-brightness-min"]), 21119 "icon-color-brightness-max": new el(rl.paint_symbol["icon-color-brightness-max"]), 21120 "symbol-z-offset": new tl(rl.paint_symbol["symbol-z-offset"]), 21121 "icon-color-use-theme": new tl({ 21122 type: "string", 21123 default: "default", 21124 "property-type": "data-driven" 21125 }), 21126 "icon-halo-color-use-theme": new tl({ 21127 type: "string", 21128 default: "default", 21129 "property-type": "data-driven" 21130 }), 21131 "text-color-use-theme": new tl({ 21132 type: "string", 21133 default: "default", 21134 "property-type": "data-driven" 21135 }), 21136 "text-halo-color-use-theme": new tl({ 21137 type: "string", 21138 default: "default", 21139 "property-type": "data-driven" 21140 }) 21141 })) 21142 }, Xv); 21143 class eb extends Rl { 21144 _handleSpecialPaintPropertyUpdate(e1) { 21145 "icon-occlusion-opacity" !== e1 && "text-occlusion-opacity" !== e1 || (this.hasOcclusionOpacityProperties = !0); 21146 } 21147 recalculate(e1, t1) { 21148 super.recalculate(e1, t1), this.appearances && this.appearances.forEac
vendor: 36,744 bytes, lines 21148-21893
21148h((i)=>{ 21149 i.recalculate(e1, t1, this.iconImageUseTheme); 21150 }), 0 !== this.appearances.length && delete this.layout._values["text-variable-anchor"], "auto" === this.layout.get("icon-rotation-alignment") && (this.layout._values["icon-rotation-alignment"] = "point" !== this.layout.get("symbol-placement") ? "map" : "viewport"), "auto" === this.layout.get("text-rotation-alignment") && (this.layout._values["text-rotation-alignment"] = "point" !== this.layout.get("symbol-placement") ? "map" : "viewport"), "auto" === this.layout.get("text-pitch-alignment") && (this.layout._values["text-pitch-alignment"] = this.layout.get("text-rotation-alignment")), "auto" === this.layout.get("icon-pitch-alignment") && (this.layout._values["icon-pitch-alignment"] = this.layout.get("icon-rotation-alignment")); 21151 const i = this.layout.get("text-writing-mode"); 21152 if (i) { 21153 const e1 = []; 21154 for (const t1 of i)e1.includes(t1) || e1.push(t1); 21155 this.layout._values["text-writing-mode"] = e1; 21156 } else this.layout._values["text-writing-mode"] = "point" === this.layout.get("symbol-placement") ? [ 21157 "horizontal" 21158 ] : [ 21159 "horizontal", 21160 "vertical" 21161 ]; 21162 this._setPaintOverrides(); 21163 } 21164 getColorAdjustmentMatrix(e1, t1, i, n) { 21165 return this._saturation === e1 && this._contrast === t1 && this._brightnessMin === i && this._brightnessMax === n || (this._colorAdjustmentMatrix = function(e1, t1, i, n) { 21166 e1 = zt(e1), t1 = St(t1); 21167 const r = c(), o = e1 / 3, a = 1 - 2 * o, s = [ 21168 a, 21169 o, 21170 o, 21171 0, 21172 o, 21173 a, 21174 o, 21175 0, 21176 o, 21177 o, 21178 a, 21179 0, 21180 0, 21181 0, 21182 0, 21183 1 21184 ], l = .5 - .5 * t1, u = n - i; 21185 return m(r, [ 21186 u, 21187 0, 21188 0, 21189 0, 21190 0, 21191 u, 21192 0, 21193 0, 21194 0, 21195 0, 21196 u, 21197 0, 21198 i, 21199 i, 21200 i, 21201 1 21202 ], [ 21203 t1, 21204 0, 21205 0, 21206 0, 21207 0, 21208 t1, 21209 0, 21210 0, 21211 0, 21212 0, 21213 t1, 21214 0, 21215 l, 21216 l, 21217 l, 21218 1 21219 ]), m(r, r, s), r; 21220 }(e1, t1, i, n), this._saturation = e1, this._contrast = t1, this._brightnessMin = i, this._brightnessMax = n), this._colorAdjustmentMatrix; 21221 } 21222 getValueAndResolveTokens(e1, t1, i, n) { 21223 const r = this.layout.get(e1).evaluate(t1, {}, i, n), o = this._unevaluatedLayout._values[e1]; 21224 return o.isDataDriven() || ka(o.value) || !r ? r : Jv(t1.properties, r); 21225 } 21226 getAppearanceValueAndResolveTokens(e1, t1, i, n, r) { 21227 const o = e1.getLayoutProperty(t1); 21228 if (!o) return; 21229 const a = o.evaluate(i, {}, n, r), s = e1.getUnevaluatedLayoutProperties()._values[t1]; 21230 return s.isDataDriven() || ka(s.value) || !a || "string" != typeof a ? a : Jv(i.properties, a); 21231 } 21232 createBucket(e1) { 21233 return new Qm(e1); 21234 } 21235 queryRadius() { 21236 return 0; 21237 } 21238 queryIntersectsFeature() { 21239 return !1; 21240 } 21241 _setPaintOverrides() { 21242 for (const e1 of Qv().paint.overridableProperties){ 21243 if (!eb.hasPaintOverride(this.layout, e1)) continue; 21244 const t1 = this.paint.get(e1), i = new Kv(t1), n = new Na(i, t1.property.specification, this.scope, this.options, this.layout.get("icon-image-use-theme")); 21245 let r = null; 21246 r = "constant" === t1.value.kind || "source" === t1.value.kind ? new ja("source", n) : new Ga("composite", n, t1.value.zoomStops, t1.value.interpolationType), this.paint._values[e1] = new Ks(t1.property, r, t1.parameters); 21247 } 21248 } 21249 _handleOverridablePaintPropertyUpdate(e1, t1, i) { 21250 return !(!this.layout || t1.isDataDriven() || i.isDataDriven()) && eb.hasPaintOverride(this.layout, e1); 21251 } 21252 static hasPaintOverride(e1, t1) { 21253 const i = e1.get("text-field"), n = Qv().paint.properties[t1]; 21254 let r = !1; 21255 const o = (e1)=>{ 21256 for (const t1 of e1)if (n.overrides && n.overrides.hasOverride(t1)) return void (r = !0); 21257 }; 21258 if ("constant" === i.value.kind && i.value.value instanceof Un) o(i.value.value.sections); 21259 else if ("source" === i.value.kind) { 21260 const e1 = (t1)=>{ 21261 r || (t1 instanceof qn && Zn(t1.value) === Pn ? o(t1.value.sections) : t1 instanceof Kn ? o(t1.sections) : t1.eachChild(e1)); 21262 }, t1 = i.value; 21263 t1._styleExpression && e1(t1._styleExpression.expression); 21264 } 21265 return r; 21266 } 21267 getProgramIds() { 21268 return [ 21269 "symbol" 21270 ]; 21271 } 21272 getDefaultProgramParams(e1, t1, i) { 21273 return { 21274 config: new ph(this, { 21275 zoom: t1, 21276 lut: i 21277 }), 21278 overrideFog: !1 21279 }; 21280 } 21281 hasElevation() { 21282 return this.layout && "hd-road-markup" === this.layout.get("symbol-elevation-reference"); 21283 } 21284 mayUse(e1) { 21285 return "HD" === e1 && Pl(this, "symbol-elevation-reference", (e1)=>"hd-road-markup" === e1); 21286 } 21287 prepare() { 21288 return this.mayUse("HD") ? nv() : Promise.resolve(); 21289 } 21290 constructor(e1, t1, i, n){ 21291 super(e1, Qv(), t1, i, n, e1.layout ? e1.layout["icon-image-use-theme"] : null), this._colorAdjustmentMatrix = d([]), this.hasOcclusionOpacityProperties = void 0 !== e1.paint && ("icon-occlusion-opacity" in e1.paint || "text-occlusion-opacity" in e1.paint); 21292 } 21293 } 21294 let tb, ib, nb, rb; 21295 const ob = 1024, ab = (Math.pow(ob, 2) - 1) / 268170240; 21296 class sb extends Rl { 21297 getProgramIds() { 21298 return [ 21299 "raster" 21300 ]; 21301 } 21302 hasColorMap() { 21303 return !!this._transitionablePaint._values["raster-color"].value.value; 21304 } 21305 tileCoverLift() { 21306 return this.paint.get("raster-elevation"); 21307 } 21308 isDraped(e1) { 21309 const t1 = e1 ? e1._source : null; 21310 return (!t1 || "image" !== t1.type && "video" !== t1.type && "canvas" !== t1.type || !t1.onNorthPole && !t1.onSouthPole) && 0 === this.paint.get("raster-elevation") && this.paint.get("raster-allow-draping"); 21311 } 21312 _handleSpecialPaintPropertyUpdate(e1) { 21313 "raster-color" !== e1 && "raster-color-range" !== e1 && "raster-color-scale" !== e1 || (this._curRampRange = [ 21314 NaN, 21315 NaN 21316 ], this.updateColorRamp()); 21317 } 21318 _clear() { 21319 this.colorRampTexture && (this.colorRampTexture.destroy(), this.colorRampTexture = null); 21320 } 21321 updateColorRamp(e1) { 21322 if (!this.hasColorMap()) return; 21323 if (!this._curRampRange) return; 21324 const t1 = this._transitionablePaint._values["raster-color"].value.expression, [i, n] = e1 || this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({ 21325 zoom: 0 21326 }) || [ 21327 NaN, 21328 NaN 21329 ]; 21330 if (isNaN(i) && isNaN(n)) return; 21331 if (i === this._curRampRange[0] && n === this._curRampRange[1]) return; 21332 const r = this._transitionablePaint._values["raster-color-scale"].value.expression.evaluate({ 21333 zoom: 0 21334 }); 21335 this.colorRamp = xv({ 21336 expression: t1, 21337 evaluationKey: "rasterValue", 21338 image: this.colorRamp, 21339 clips: [ 21340 { 21341 start: i, 21342 end: n 21343 } 21344 ], 21345 resolution: ob, 21346 scale: r 21347 }), this.colorRampTexture = null, this._curRampRange = [ 21348 i, 21349 n 21350 ]; 21351 } 21352 is3D(e1) { 21353 return this.paint.get("raster-elevation") > 0 || !this.paint.get("raster-allow-draping"); 21354 } 21355 constructor(e1, t1, i, n){ 21356 super(e1, { 21357 layout: nb || (nb = new nl({ 21358 visibility: new el(rl.layout_raster.visibility) 21359 })), 21360 paint: rb || (rb = new nl({ 21361 "raster-opacity": new el(rl.paint_raster["raster-opacity"]), 21362 "raster-color": new il(rl.paint_raster["raster-color"]), 21363 "raster-color-mix": new el(rl.paint_raster["raster-color-mix"]), 21364 "raster-color-range": new el(rl.paint_raster["raster-color-range"]), 21365 "raster-color-scale": new el(rl.paint_raster["raster-color-scale"]), 21366 "raster-hue-rotate": new el(rl.paint_raster["raster-hue-rotate"]), 21367 "raster-brightness-min": new el(rl.paint_raster["raster-brightness-min"]), 21368 "raster-brightness-max": new el(rl.paint_raster["raster-brightness-max"]), 21369 "raster-saturation": new el(rl.paint_raster["raster-saturation"]), 21370 "raster-contrast": new el(rl.paint_raster["raster-contrast"]), 21371 "raster-resampling": new el(rl.paint_raster["raster-resampling"]), 21372 "raster-fade-duration": new el(rl.paint_raster["raster-fade-duration"]), 21373 "raster-emissive-strength": new el(rl.paint_raster["raster-emissive-strength"]), 21374 "raster-array-band": new el(rl.paint_raster["raster-array-band"]), 21375 "raster-elevation": new el(rl.paint_raster["raster-elevation"]), 21376 "raster-elevation-reference": new el(rl.paint_raster["raster-elevation-reference"]), 21377 "raster-allow-draping": new el(rl.paint_raster["raster-allow-draping"]), 21378 "raster-color-use-theme": new tl({ 21379 type: "string", 21380 default: "default", 21381 "property-type": "data-driven" 21382 }) 21383 })) 21384 }, t1, i, n), this.updateColorRamp(), this._curRampRange = [ 21385 NaN, 21386 NaN 21387 ]; 21388 } 21389 } 21390 let lb, cb, ub, hb, db, fb, pb; 21391 class mb extends Rl { 21392 mayUse(e1) { 21393 return "HD" === e1; 21394 } 21395 _clear() { 21396 this.colorRampTexture && (this.colorRampTexture.destroy(), this.colorRampTexture = null), this.tileFramebuffer && (this.tileFramebuffer.destroy(), this.tileFramebuffer = null), this.particleFramebuffer && (this.particleFramebuffer.destroy(), this.particleFramebuffer = null); 21397 } 21398 onRemove(e1) { 21399 this.colorRampTexture && this.colorRampTexture.destroy(), this.tileFramebuffer && this.tileFramebuffer.destroy(), this.particleFramebuffer && this.particleFramebuffer.destroy(); 21400 } 21401 hasColorMap() { 21402 return !!this._transitionablePaint._values["raster-particle-color"].value.value; 21403 } 21404 getProgramIds() { 21405 return [ 21406 "rasterParticle" 21407 ]; 21408 } 21409 hasOffscreenPass() { 21410 return "none" !== this.visibility; 21411 } 21412 isDraped(e1) { 21413 return !1; 21414 } 21415 _handleSpecialPaintPropertyUpdate(e1) { 21416 "raster-particle-color" !== e1 && "raster-particle-max-speed" !== e1 || (this._updateColorRamp(), this._invalidateAnimationState()), "raster-particle-count" === e1 && this._invalidateAnimationState(); 21417 } 21418 _updateColorRamp() { 21419 if (!this.hasColorMap()) return; 21420 const e1 = this._transitionablePaint._values["raster-particle-color"].value.expression, t1 = this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({ 21421 zoom: 0 21422 }); 21423 this.colorRamp = xv({ 21424 expression: e1, 21425 evaluationKey: "rasterParticleSpeed", 21426 image: this.colorRamp, 21427 clips: [ 21428 { 21429 start: 0, 21430 end: t1 21431 } 21432 ], 21433 resolution: 256 21434 }), this.colorRampTexture = null; 21435 } 21436 _invalidateAnimationState() { 21437 this.lastInvalidatedAt = kt.now(); 21438 } 21439 tileCoverLift() { 21440 return this.paint.get("raster-particle-elevation"); 21441 } 21442 constructor(e1, t1, i, n){ 21443 super(e1, { 21444 layout: lb || (lb = new nl({ 21445 visibility: new el(rl["layout_raster-particle"].visibility) 21446 })), 21447 paint: cb || (cb = new nl({ 21448 "raster-particle-array-band": new el(rl["paint_raster-particle"]["raster-particle-array-band"]), 21449 "raster-particle-count": new el(rl["paint_raster-particle"]["raster-particle-count"]), 21450 "raster-particle-color": new il(rl["paint_raster-particle"]["raster-particle-color"]), 21451 "raster-particle-max-speed": new el(rl["paint_raster-particle"]["raster-particle-max-speed"]), 21452 "raster-particle-speed-factor": new el(rl["paint_raster-particle"]["raster-particle-speed-factor"]), 21453 "raster-particle-fade-opacity-factor": new el(rl["paint_raster-particle"]["raster-particle-fade-opacity-factor"]), 21454 "raster-particle-reset-rate-factor": new el(rl["paint_raster-particle"]["raster-particle-reset-rate-factor"]), 21455 "raster-particle-elevation": new el(rl["paint_raster-particle"]["raster-particle-elevation"]), 21456 "raster-particle-color-use-theme": new tl({ 21457 type: "string", 21458 default: "default", 21459 "property-type": "data-driven" 21460 }) 21461 })) 21462 }, t1, i, n), this._updateColorRamp(), this.lastInvalidatedAt = kt.now(); 21463 } 21464 } 21465 class _b extends Rl { 21466 is3D(e1) { 21467 return "3d" === this.implementation.renderingMode; 21468 } 21469 hasOffscreenPass() { 21470 return void 0 !== this.implementation.prerender; 21471 } 21472 isDraped(e1) { 21473 return void 0 !== this.implementation.renderToTile; 21474 } 21475 shouldRedrape() { 21476 return !!this.implementation.shouldRerenderTiles && this.implementation.shouldRerenderTiles(); 21477 } 21478 recalculate() {} 21479 updateTransitions() {} 21480 hasTransition() { 21481 return !1; 21482 } 21483 serialize() {} 21484 onAdd(e1) { 21485 this.implementation.onAdd && this.implementation.onAdd(e1, e1.painter.context.gl); 21486 } 21487 onRemove(e1) { 21488 this.implementation.onRemove && this.implementation.onRemove(e1, e1.painter.context.gl); 21489 } 21490 constructor(e1, t1){ 21491 super(e1, {}, t1, null), this.implementation = e1, e1.slot && (this.slot = e1.slot); 21492 } 21493 } 21494 function gb(e1, t1, i) { 21495 const n = [ 21496 0, 21497 0, 21498 1 21499 ], r = ue([]); 21500 return fe(r, r, i ? -Je(e1) + Math.PI : Je(e1)), de(r, r, -Je(t1)), K(n, n, r), Z(n, n); 21501 } 21502 class yb { 21503 constructor(e1, t1){ 21504 this.feature = e1, this.instancedDataOffset = t1, this.instancedDataCount = 0, this.rotation = [ 21505 0, 21506 0, 21507 0 21508 ], this.scale = [ 21509 1, 21510 1, 21511 1 21512 ], this.translation = [ 21513 0, 21514 0, 21515 0 21516 ]; 21517 } 21518 } 21519 class xb { 21520 colorForInstance(e1) { 21521 const t1 = 16 * e1, i = this.instancedDataArray.float32; 21522 let n = Math.floor(i[t1 + 2]); 21523 const r = 1.05 * (i[t1 + 2] - n); 21524 return n /= 100, [ 21525 i[t1] % 1 * 1.05, 21526 i[t1 + 1] % 1 * 1.05, 21527 r, 21528 n 21529 ]; 21530 } 21531 tileCoordinatesForInstance(e1) { 21532 const t1 = 16 * e1, i = this.instancedDataArray.float32; 21533 let n = i[t1 + 0]; 21534 return n = n > zr ? n - zr : n, new Pe(Math.trunc(n), Math.trunc(i[t1 + 1])); 21535 } 21536 translationForInstance(e1) { 21537 const t1 = 16 * e1, i = this.instancedDataArray.float32; 21538 return [ 21539 i[t1 + 4], 21540 i[t1 + 5], 21541 i[t1 + 6] 21542 ]; 21543 } 21544 rotationScaleForInstance(e1) { 21545 const t1 = 16 * e1, i = this.instancedDataArray.float32; 21546 return [ 21547 i[t1 + 7], 21548 i[t1 + 8], 21549 i[t1 + 9], 21550 i[t1 + 10], 21551 i[t1 + 11], 21552 i[t1 + 12], 21553 i[t1 + 13], 21554 i[t1 + 14], 21555 i[t1 + 15] 21556 ]; 21557 } 21558 transformForInstance(e1) { 21559 const t1 = 16 * e1, i = this.instancedDataArray.float32; 21560 return [ 21561 i[t1 + 7], 21562 i[t1 + 8], 21563 i[t1 + 9], 21564 i[t1 + 4], 21565 i[t1 + 10], 21566 i[t1 + 11], 21567 i[t1 + 12], 21568 i[t1 + 5], 21569 i[t1 + 13], 21570 i[t1 + 14], 21571 i[t1 + 15], 21572 i[t1 + 6], 21573 0, 21574 0, 21575 0, 21576 1 21577 ]; 21578 } 21579 constructor(){ 21580 this.maxScale = 1, this.maxXYTranslationDistance = 0, this.instancedDataArray = new bu, this.instancesEvaluatedElevation = [], this.features = [], this.idToFeaturesIndex = {}; 21581 } 21582 } 21583 class vb { 21584 updateFootprints(e1, t1) {} 21585 updateAppearances(e1, t1, i, n) { 21586 return { 21587 hasLayoutChanges: !1, 21588 hasUboChanges: !1 21589 }; 21590 } 21591 populate(e1, t1, i, n) { 21592 this.tileToMeter = Ic(i); 21593 const r = this.layers[0]._featureFilter.needGeometry; 21594 this.lookup = new Uint8Array(this.lookupDim * this.lookupDim); 21595 const o = "hd-road-markup" === this.layers[0].paint.get("model-elevation-reference") ? t1.elevationFeatures : void 0; 21596 for (const { feature: a, id: s, index: l, sourceLayerIndex: c } of e1){ 21597 const e1 = s !== null && s !== void 0 ? s : a.properties && Object.hasOwn(a.properties, "id") ? a.properties.id : void 0, u = Lc(a, r); 21598 if (!this.layers[0]._featureFilter.filter(new $s(this.zoom, { 21599 worldview: this.worldview, 21600 activeFloors: t1.activeFloors 21601 }), u, i)) continue; 21602 const h = { 21603 id: e1, 21604 sourceLayerIndex: c, 21605 index: l, 21606 geometry: r ? u.geometry : Cc(a, i, n), 21607 properties: a.properties, 21608 type: a.type, 21609 patterns: {} 21610 }, d = this.addFeature(h, h.geometry, u, o, i); 21611 d && t1.featureIndex.insert(a, h.geometry, l, c, this.index, this.instancesPerModel[d].instancedDataArray.length, 256); 21612 } 21613 this.lookup = null; 21614 } 21615 evaluateQueryRenderedFeaturePadding() { 21616 const e1 = this.layers[0].modelManager, t1 = this.layers[0].scope; 21617 let i = 0; 21618 for (const n of this.modelUris){ 21619 const r = e1.getModel(n, t1); 21620 if (!r) continue; 21621 const o = this.instancesPerModel[n]; 21622 if (o) { 21623 const e1 = .5 * j(r.aabb.max, r.aabb.min) * o.maxScale + o.maxXYTranslationDistance, t1 = Math.min(zr, Math.max(e1 / this.tileToMeter, 256)); 21624 i = Math.max(t1, i); 21625 } 21626 } 21627 return i; 21628 } 21629 update(e1, t1, i, n) { 21630 for(const t1 in this.instancesPerModel){ 21631 const i = this.instancesPerModel[t1]; 21632 for(const t1 in e1)Object.hasOwn(i.idToFeaturesIndex, t1) && (this.evaluate(i.features[i.idToFeaturesIndex[t1]], e1[t1], i, !0), this.uploaded = !1); 21633 } 21634 this.maxHeight = 0; 21635 } 21636 updateZoomBasedPaintProperties() { 21637 if (!this.hasZoomDependentProperties) return !1; 21638 let e1 = !1; 21639 for(const t1 in this.instancesPerModel){ 21640 const i = this.instancesPerModel[t1]; 21641 for (const t1 of i.features){ 21642 const n = this.layers[0], r = t1.feature, o = this.canonical, a = n.paint.get("model-rotation").evaluate(r, {}, o), s = n.paint.get("model-scale").evaluate(r, {}, o), l = n.paint.get("model-translation").evaluate(r, {}, o); 21643 ee(t1.rotation, a) && ee(t1.scale, s) && ee(t1.translation, l) || (this.evaluate(t1, t1.featureStates, i, !0), e1 = !0); 21644 } 21645 } 21646 return e1; 21647 } 21648 updateReplacement(e1, t1, i, n) { 21649 if (t1.updateTime === this.replacementUpdateTime) return !1; 21650 this.replacementUpdateTime = t1.updateTime; 21651 const r = t1.getReplacementRegionsForTile(e1.toUnwrapped(), !0); 21652 if (Bp(this.activeReplacements, r)) return !1; 21653 this.activeReplacements = r; 21654 let o = !1; 21655 for(const t1 in this.instancesPerModel){ 21656 const r = this.instancesPerModel[t1], a = r.instancedDataArray; 21657 for (const t1 of r.features){ 21658 const r = t1.instancedDataOffset, s = t1.instancedDataCount; 21659 for(let t1 = 0; t1 < s; t1++){ 21660 const s = 16 * (t1 + r); 21661 let l = a.float32[s + 0]; 21662 const c = l > zr; 21663 l = c ? l - zr : l; 21664 const u = Math.floor(l), h = Math.floor(a.float32[s + 1]); 21665 let d = !1; 21666 for (const t1 of this.activeReplacements)if (!Fp(t1, i, tx.Model, n) && !(t1.min.x > u || u > t1.max.x || t1.min.y > h || h > t1.max.y) && (d = Gp(jp(u, h, e1.canonical, t1.footprintTileId.canonical), t1.footprint), d)) break; 21667 a.float32[s] = d ? l + zr : l, o = o || d !== c; 21668 } 21669 } 21670 } 21671 return o; 21672 } 21673 isEmpty() { 21674 for(const e1 in this.instancesPerModel)if (0 !== this.instancesPerModel[e1].instancedDataArray.length) return !1; 21675 return !0; 21676 } 21677 uploadPending() { 21678 return !this.uploaded; 21679 } 21680 upload(e1) { 21681 if (!this.uploaded) for(const t1 in this.instancesPerModel){ 21682 const i = this.instancesPerModel[t1]; 21683 i.instancedDataArray.length < 0 || 0 === i.instancedDataArray.length || (i.instancedDataBuffer ? i.instancedDataBuffer.updateData(i.instancedDataArray) : i.instancedDataBuffer = e1.createVertexBuffer(i.instancedDataArray, Jg.members, !0, void 0, this.instanceCount)); 21684 } 21685 this.uploaded = !0; 21686 } 21687 destroy(e1) { 21688 for(const e1 in this.instancesPerModel){ 21689 const t1 = this.instancesPerModel[e1]; 21690 0 !== t1.instancedDataArray.length && t1.instancedDataBuffer && t1.instancedDataBuffer.destroy(); 21691 } 21692 const t1 = this.layers[0].modelManager; 21693 if (e1 && t1 && this.modelUris && this.modelsRequested) for (const e1 of this.modelUris)t1.removeModel(e1, "", !0); 21694 } 21695 addFeature(e1, t1, i, n, r) { 21696 const o = this.layers[0], a = o.layout.get("model-id"), s = o.layout.get("model-allow-density-reduction"), l = a.evaluate(i, {}, this.canonical); 21697 if (!l) return gt("modelId is not evaluated for layer ".concat(o.id, " and it is not going to get rendered.")), l; 21698 !l.includes("://") && !this.styleDefinedModelURLs[l] || this.modelUris.includes(l) || this.modelUris.push(l), this.instancesPerModel[l] || (this.instancesPerModel[l] = new xb); 21699 const c = this.instancesPerModel[l], u = c.instancedDataArray, h = new yb(i, u.length); 21700 let d; 21701 if (n) { 21702 const t1 = x_(e1, n, void 0, r); 21703 d = t1 ? t1.feature : void 0; 21704 } 21705 for (const e1 of t1)for (const t1 of e1){ 21706 if (t1.x < 0 || t1.x >= zr || t1.y < 0 || t1.y >= zr) continue; 21707 if (0 !== this.lookupDim && s) { 21708 const e1 = (this.lookupDim - 1) / zr, i = this.lookupDim * (t1.y * e1 | 0) + t1.x * e1 | 0; 21709 if (this.lookup) { 21710 if (0 !== this.lookup[i]) continue; 21711 this.lookup[i] = 1; 21712 } 21713 } 21714 this.instanceCount++; 21715 const e1 = u.length; 21716 if (u.resize(e1 + 1), n) { 21717 c.instancesRoadElevation || (c.instancesRoadElevation = []); 21718 const e1 = d ? d.pointElevation(new Pe(t1.x, t1.y)) : 0; 21719 c.instancesRoadElevation.push(e1); 21720 } 21721 c.instancesEvaluatedElevation.push(0), u.float32[16 * e1] = t1.x, u.float32[16 * e1 + 1] = t1.y; 21722 } 21723 return h.instancedDataCount = c.instancedDataArray.length - h.instancedDataOffset, h.instancedDataCount > 0 && (e1.id && (c.idToFeaturesIndex[e1.id] = c.features.length), c.features.push(h), this.evaluate(h, {}, c, !1)), l; 21724 } 21725 getModelUris() { 21726 return this.modelUris; 21727 } 21728 evaluate(e1, t1, i, n) { 21729 const r = this.layers[0], o = e1.feature, a = this.canonical, s = e1.rotation = r.paint.get("model-rotation").evaluate(o, t1, a), l = e1.scale = r.paint.get("model-scale").evaluate(o, t1, a), c = e1.translation = r.paint.get("model-translation").evaluate(o, t1, a), { r: u, g: h, b: d } = r.paint.get("model-color").evaluate(o, t1, a), f = r.paint.get("model-color-mix-intensity").evaluate(o, t1, a), p = []; 21730 this.maxVerticalOffset < c[2] && (this.maxVerticalOffset = c[2]); 21731 const m = c[0] * c[0] + c[1] * c[1], _ = m > 0 ? Math.sqrt(m) : 0; 21732 i.maxScale = Math.max(Math.max(i.maxScale, l[0]), Math.max(l[1], l[2])), i.maxXYTranslationDistance = Math.max(i.maxXYTranslationDistance, _), this.maxScale = Math.max(Math.max(this.maxScale, l[0]), Math.max(l[1], l[2])), ay(p, s, l); 21733 const g = Math.round(100 * f) + d / 1.05; 21734 for(let t1 = 0; t1 < e1.instancedDataCount; ++t1){ 21735 const r = e1.instancedDataOffset + t1, o = 16 * r, s = i.instancedDataArray.float32; 21736 let l = 0; 21737 n && (l = s[o + 6] - i.instancesEvaluatedElevation[r]); 21738 const d = 0 | s[o + 1]; 21739 s[o] = (0 | s[o]) + u / 1.05, s[o + 1] = d + h / 1.05, s[o + 2] = g, s[o + 3] = 1 / (a.z > 10 ? this.tileToMeter : Ic(a, d)), s[o + 4] = c[0], s[o + 5] = c[1], s[o + 6] = c[2] + (i.instancesRoadElevation ? i.instancesRoadElevation[r] : 0) + l, s[o + 7] = p[0], s[o + 8] = p[1], s[o + 9] = p[2], s[o + 10] = p[4], s[o + 11] = p[5], s[o + 12] = p[6], s[o + 13] = p[8], s[o + 14] = p[9], s[o + 15] = p[10], i.instancesEvaluatedElevation[r] = c[2]; 21740 } 21741 } 21742 constructor(e1){ 21743 this.requiresStandardRuntime = !0, this.zoom = e1.zoom, this.canonical = e1.canonical, this.overscaledZ = this.canonical.z + Math.log2(e1.overscaling), this.layers = e1.layers, this.layerIds = this.layers.map((e1)=>e1.fqid), this.projection = e1.projection, this.index = e1.index, this.worldview = e1.worldview, this.hasZoomDependentProperties = this.layers[0].isZoomDependent(), this.stateDependentLayerIds = this.layers.filter((e1)=>e1.isStateDependent()).map((e1)=>e1.id), this.hasPattern = !1, this.instancesPerModel = {}, this.validForExaggeration = 0, this.maxVerticalOffset = 0, this.maxScale = 0, this.maxHeight = 0, this.lookupDim = this.zoom > this.canonical.z + 1 ? 0 : this.zoom > this.canonical.z ? 256 : this.zoom > 15 ? 75 : 100, this.instanceCount = 0, this.terrainElevationMin = 0, this.terrainElevationMax = 0, this.validForDEMTile = { 21744 id: null, 21745 timestamp: 0 21746 }, this.modelUris = [], this.modelsRequested = !1, this.activeReplacements = [], this.replacementUpdateTime = 0, this.styleDefinedModelURLs = e1.styleDefinedModelURLs, this.hasAppearances = null; 21747 } 21748 } 21749 Xa(vb, "ModelBucket", { 21750 omit: [ 21751 "layers" 21752 ] 21753 }), Xa(xb, "PerModelAttributes"), Xa(yb, "ModelFeature"); 21754 class bb { 21755 static create(e1, t1, i) { 21756 const n = i || e1.findDEMTileFor(t1); 21757 if (!n || !n.dem) return; 21758 const r = n.dem, o = n.tileID, a = 1 << t1.canonical.z - o.canonical.z; 21759 return new bb(n, r.dim / zr / a, [ 21760 (t1.canonical.x / a - o.canonical.x) * r.dim, 21761 (t1.canonical.y / a - o.canonical.y) * r.dim 21762 ]); 21763 } 21764 tileCoordToPixel(e1, t1) { 21765 const i = t1 * this._scale + this._offset[1]; 21766 return new Pe(Math.floor(e1 * this._scale + this._offset[0]), Math.floor(i)); 21767 } 21768 getElevationAt(e1, t1, i, n) { 21769 const r = e1 * this._scale + this._offset[0], o = t1 * this._scale + this._offset[1], a = Math.floor(r), s = Math.floor(o), l = this._dem; 21770 return n = !!n, i ? fn(fn(l.get(a, s, n), l.get(a, s + 1, n), o - s), fn(l.get(a + 1, s, n), l.get(a + 1, s + 1, n), o - s), r - a) : l.get(a, s, n); 21771 } 21772 getElevationAtPixel(e1, t1, i) { 21773 return this._dem.get(e1, t1, !!i); 21774 } 21775 getMeterToDEM(e1) { 21776 return (1 << this._demTile.tileID.canonical.z) * xc(1, e1) * this._dem.stride; 21777 } 21778 constructor(e1, t1, i){ 21779 this._demTile = e1, this._dem = this._demTile.dem, this._scale = t1, this._offset = i; 21780 } 21781 } 21782 const wb = new Float32Array(262144), Ab = new Uint8Array(262144), Eb = [ 21783 0, 21784 0, 21785 0 21786 ], Ib = [ 21787 0, 21788 0, 21789 0 21790 ]; 21791 function Mb(e1) { 21792 let t1 = 0; 21793 if (e1.meshes) for (const i of e1.meshes)t1 = Math.max(t1, i.aabb.max[2]); 21794 if (e1.children) for (const i of e1.children)t1 = Math.max(t1, Mb(i)); 21795 return t1; 21796 } 21797 function Tb(e1, t1, i) { 21798 if (e1.meshes) for (const n of e1.meshes){ 21799 if (n.aabb.min[0] === 1 / 0) continue; 21800 const r = Rf.applyTransform(n.aabb, e1.globalMatrix); 21801 i.insert(t1, r.min[0], r.min[1], r.max[0], r.max[1]); 21802 } 21803 if (e1.children) for (const n of e1.children)Tb(n, t1, i); 21804 } 21805 const Sb = [ 21806 "", 21807 "wall", 21808 "door", 21809 "roof", 21810 "window", 21811 "lamp", 21812 "logo" 21813 ]; 21814 class zb { 21815 _getLocalBounds() { 21816 if (!this.node.meshes) return new Rf([ 21817 1 / 0, 21818 1 / 0, 21819 1 / 0 21820 ], [ 21821 -1 / 0, 21822 -1 / 0, 21823 -1 / 0 21824 ]); 21825 if (!this.aabb) { 21826 let e1 = 0; 21827 const t1 = new Rf([ 21828 1 / 0, 21829 1 / 0, 21830 1 / 0 21831 ], [ 21832 -1 / 0, 21833 -1 / 0, 21834 -1 / 0 21835 ]); 21836 for (const i of this.node.meshes)this.node.lightMeshIndex !== e1 && (i.transformedAabb = Rf.applyTransformFast(i.aabb, this.node.globalMatrix), t1.encapsulate(i.transformedAabb)), e1++; 21837 this.aabb = t1; 21838 } 21839 return this.aabb; 21840 } 21841 constructor(e1){ 21842 this.node = e1, this.evaluatedRMEA = [ 21843 [ 21844 1, 21845 0, 21846 0, 21847 1 21848 ], 21849 [ 21850 1, 21851 0, 21852 0, 21853 1 21854 ], 21855 [ 21856 1, 21857 0, 21858 0, 21859 1 21860 ], 21861 [ 21862 1, 21863 0, 21864 0, 21865 1 21866 ], 21867 [ 21868 .4, 21869 1, 21870 0, 21871 1 21872 ], 21873 [ 21874 1, 21875 0, 21876 0, 21877 1 21878 ], 21879 [ 21880 1, 21881 0, 21882 0, 21883 1 21884 ] 21885 ], this.hiddenByReplacement = !1, this.evaluatedTranslation = [ 21886 0, 21887 0, 21888 0 21889 ], this.evaluatedScale = [ 21890 1, 21891 1, 21892 1 21893 ], this.evaluatedColor = [], this.emissionHeightBasedParams = [], this.cameraCollisionOpacity = 1, this.targetL
21893od = -1, this.feature = { 21894 type: "Point", 21895 id: e1.id, 21896 geometry: [], 21897 properties: { 21898 height: Mb(e1) 21899 } 21900 }, this.aabb = this._getLocalBounds(), this.state = null; 21901 } 21902 } 21903 class Rb { 21904 updateFootprints(e1, t1) { 21905 for (const i of this.getNodesInfo()){ 21906 const n = i.node; 21907 n.footprint && t1.push({ 21908 footprint: n.footprint, 21909 id: e1 21910 }); 21911 } 21912 } 21913 updateAppearances(e1, t1, i, n) { 21914 return { 21915 hasLayoutChanges: !1, 21916 hasUboChanges: !1 21917 }; 21918 } 21919 update(e1) { 21920 const t1 = 0 !== Object.keys(e1).length; 21921 if (t1 && !this.stateDependentLayers.length) return; 21922 const i = t1 ? this.stateDependentLayers : this.layers; 21923 if (!De(e1, this.states)) for (const t1 of i)this.evaluate(t1, e1); 21924 this.states = structuredClone(e1); 21925 } 21926 populate() { 21927 console.log("populate 3D model bucket"); 21928 } 21929 uploadPending() { 21930 return !this.uploaded || this.needsUpload; 21931 } 21932 upload(e1) { 21933 if (!this.needsUpload) return; 21934 const t1 = this.getNodesInfo(); 21935 for (const i of t1){ 21936 const t1 = i.node; 21937 this.uploaded ? this.updatePbrBuffer(t1) : _y(t1, e1, !0); 21938 } 21939 for (const e1 of t1)yy(e1.node); 21940 this.uploaded = !0, this.needsUpload = !1; 21941 } 21942 updatePbrBuffer(e1) { 21943 let t1 = !1; 21944 if (!e1.meshes) return t1; 21945 for (const i of e1.meshes)i.pbrBuffer && (i.pbrBuffer.updateData(i.featureArray), t1 = !0); 21946 if (e1.lodMeshes) for (const i of e1.lodMeshes)i.pbrBuffer && (i.pbrBuffer.updateData(i.featureArray), t1 = !0); 21947 return t1; 21948 } 21949 needsReEvaluation(e1, t1, i) { 21950 const n = e1.transform.projectionOptions, r = e1.style.getBrightness(), o = this.brightness !== r; 21951 if (!this.uploaded || this.dirty || n.name !== this.projection.name || Pb(i.paint.get("model-color").value, o) || Pb(i.paint.get("model-color-mix-intensity").value, o) || Pb(i.paint.get("model-roughness").value, o) || Pb(i.paint.get("model-emissive-strength").value, o) || Pb(i.paint.get("model-height-based-emissive-strength-multiplier").value, o)) { 21952 this.projection = n, this.brightness = r; 21953 const e1 = this.getNodesInfo(); 21954 for (const t1 of e1)t1.state = null; 21955 return !0; 21956 } 21957 return !1; 21958 } 21959 evaluateTransform(e1, t1) { 21960 if (e1.transform.zoom === this.zoom) return; 21961 this.zoom = e1.transform.zoom; 21962 const i = this.getNodesInfo(), n = this.id.canonical; 21963 for (const e1 of i){ 21964 const i = e1.feature; 21965 e1.evaluatedTranslation = t1.paint.get("model-translation").evaluate(i, {}, n), e1.evaluatedScale = t1.paint.get("model-scale").evaluate(i, {}, n); 21966 } 21967 } 21968 evaluate(e1, t1) { 21969 const i = this.getNodesInfo(); 21970 for (const n of i){ 21971 if (!n.node.meshes) continue; 21972 const i = n.feature, r = t1 && t1[i.id]; 21973 if (De(r, n.state)) continue; 21974 n.state = structuredClone(r); 21975 const o = n.node.meshes && n.node.meshes[0].featureData, a = n.evaluatedColor[2], s = n.evaluatedRMEA[2], l = this.id.canonical; 21976 if (n.hasTranslucentParts = !1, o) { 21977 for(let t1 = 0; t1 < Sb.length; t1++){ 21978 const o = Sb[t1]; 21979 o.length && (i.properties.part = o); 21980 const a = e1.paint.get("model-color").evaluate(i, r, l).toPremultipliedRenderColor(null), s = e1.paint.get("model-color-mix-intensity").evaluate(i, r, l); 21981 n.evaluatedColor[t1] = [ 21982 a.r, 21983 a.g, 21984 a.b, 21985 s 21986 ], n.evaluatedRMEA[t1][0] = e1.paint.get("model-roughness").evaluate(i, r, l), n.evaluatedRMEA[t1][2] = e1.paint.get("model-emissive-strength").evaluate(i, r, l), n.evaluatedRMEA[t1][3] = a.a, n.emissionHeightBasedParams[t1] = e1.paint.get("model-height-based-emissive-strength-multiplier").evaluate(i, r, l), !n.hasTranslucentParts && a.a < 1 && (n.hasTranslucentParts = !0); 21987 } 21988 delete i.properties.part, Lb(n, a !== n.evaluatedColor[2] || s !== n.evaluatedRMEA[2], this.modelTraits); 21989 } else n.evaluatedRMEA[0][2] = e1.paint.get("model-emissive-strength").evaluate(i, r, l);
vendor: 4,632 bytes, lines 21990-22052
21990 n.evaluatedTranslation = e1.paint.get("model-translation").evaluate(i, r, l), n.evaluatedScale = e1.paint.get("model-scale").evaluate(i, r, l), this.updatePbrBuffer(n.node) || (this.needsUpload = !0); 21991 } 21992 this.dirty = !1; 21993 } 21994 elevationUpdate(e1, t1, i, n) { 21995 const r = e1.findDEMTileFor(i); 21996 if (r && (r.tileID.canonical !== this.terrainTile || t1 !== this.terrainExaggeration)) { 21997 if (r.dem && r.tileID.overscaledZ !== this.elevationReadFromZ) { 21998 this.elevationReadFromZ = r.tileID.overscaledZ; 21999 const t1 = bb.create(e1, i, r); 22000 if (!t1) return; 22001 4 & this.modelTraits && this.updateDEM(e1, t1, i, n); 22002 for (const e1 of this.getNodesInfo()){ 22003 const i = e1.node; 22004 if (!i.footprint || !i.footprint.vertices || !i.footprint.vertices.length) continue; 22005 const n = i.footprint.vertices; 22006 let r = t1.getElevationAt(n[0].x, n[0].y, !0, !0); 22007 for(let e1 = 1; e1 < n.length; e1++)r = Math.min(r, t1.getElevationAt(n[e1].x, n[e1].y, !0, !0)); 22008 i.elevation = r; 22009 } 22010 } 22011 this.terrainTile = r.tileID.canonical, this.terrainExaggeration = t1; 22012 } 22013 } 22014 updateDEM(e1, t1, i, n) { 22015 let r = t1._dem._modifiedForSources[n]; 22016 if (void 0 === r && (t1._dem._modifiedForSources[n] = [], r = t1._dem._modifiedForSources[n]), r.includes(i.canonical)) return; 22017 const o = t1._dem.dim; 22018 r.push(i.canonical); 22019 let a = !1; 22020 for (const e1 of this.getNodesInfo()){ 22021 const i = e1.node; 22022 if (!i.footprint || !i.footprint.grid) continue; 22023 const n = i.footprint.grid, r = t1.tileCoordToPixel(n.min.x, n.min.y), s = t1.tileCoordToPixel(n.max.x, n.max.y), l = Math.min(Math.min(o - s.y, r.x), Math.min(r.y, o - s.x)); 22024 if (l < 0) continue; 22025 const c = it(l, 2, 5); 22026 let u = Math.max(0, r.x - c), h = Math.max(0, r.y - c), d = Math.min(s.x + c, o - 1), f = Math.min(s.y + c, o - 1); 22027 for(let e1 = h; e1 <= f; ++e1)for(let t1 = u; t1 <= d; ++t1)Ab[e1 * o + t1] = 255; 22028 let p = 0, m = 0; 22029 for(let e1 = 0; e1 < n.cellsY; ++e1)for(let i = 0; i < n.cellsX; ++i){ 22030 if (!n.cells[e1 * n.cellsX + i]) continue; 22031 const r = t1.tileCoordToPixel(n.min.x + i / n.xScale, n.min.y + e1 / n.yScale), a = t1.tileCoordToPixel(n.min.x + (i + 1) / n.xScale, n.min.y + (e1 + 1) / n.yScale); 22032 for(let e1 = r.y; e1 <= Math.min(a.y + 1, o - 1); ++e1)for(let i = r.x; i <= Math.min(a.x + 1, o - 1); ++i)255 === Ab[e1 * o + i] && (Ab[e1 * o + i] = 0, p += t1.getElevationAtPixel(i, e1), m++); 22033 } 22034 const _ = p / m; 22035 u = Math.max(1, r.x - c), h = Math.max(1, r.y - c), d = Math.min(s.x + c, o - 2), f = Math.min(s.y + c, o - 2), a = !0; 22036 for(let e1 = h; e1 <= f; ++e1)for(let i = u; i <= d; ++i)0 === Ab[e1 * o + i] && (wb[e1 * o + i] = t1._dem.set(i, e1, _)); 22037 for(let e1 = 1; e1 < c; ++e1){ 22038 u = Math.max(1, r.x - e1), h = Math.max(1, r.y - e1), d = Math.min(s.x + e1, o - 2), f = Math.min(s.y + e1, o - 2); 22039 for(let i = h; i <= f; ++i)for(let n = u; n <= d; ++n){ 22040 const r = i * o + n; 22041 if (255 === Ab[r]) { 22042 let a = 0, s = 0, l = -1, u = -1; 22043 for(let t1 = -1; t1 <= 1; ++t1)for(let r = -1; r <= 1; ++r){ 22044 const c = (i + t1) * o + n + r; 22045 if (Ab[c] >= e1) continue; 22046 const h = wb[c], d = Math.abs(h); 22047 d > s && (a = h, s = d, l = r, u = t1); 22048 } 22049 if (s > .1) { 22050 const o = 1 - (e1 + .5 * Math.abs(l * u)) / c; 22051 let s = t1._dem.get(n, i) + a * o; 22052 const h = t1._dem.get(n + l, i + u), d = t1._dem.get(n - l, i - u,
22052!0); 22053 (s - h) * (s - d) > 0 && (s = (h + d) / 2), wb[r] = t1._dem.set(n, i, s), Ab[r] = e1; 22054 } 22055 } 22056 } 22057 } 22058 } 22059 a && (t1._demTile.needsDEMTextureUpload = !0, t1._dem._timestamp = kt.now()); 22060 } 22061 setFilter(e1) { 22062 this.filter = e1 ? ll(e1) : null; 22063 } 22064 getNodesInfo() { 22065 return this.filter ? this.nodesInfo.filter((e1)=>this.filter.filter(new $s(this.id.overscaledZ, { 22066 worldview: this.worldview 22067 }), e1.feature, this.id.canonical)) : this.nodesInfo; 22068 } 22069 destroy() { 22070 const e1 = this.getNodesInfo(); 22071 for (const t1 of e1)yy(t1.node), vy(t1.node); 22072 } 22073 isEmpty() { 22074 return !this.nodesInfo.length; 22075 } 22076 updateReplacement(e1, t1) { 22077 if (t1.updateTime === this.replacementUpdateTime) return; 22078 this.replacementUpdateTime = t1.updateTime; 22079 const i = t1.getReplacementRegionsForTile(e1.toUnwrapped()); 22080 for (const e1 of this.getNodesInfo()){ 22081 const t1 = e1.node.footprint; 22082 e1.hiddenByReplacement = !!t1 && !i.some((e1)=>e1.footprint === t1); 22083 } 22084 } 22085 getHeightAtTileCoord(e1, t1) { 22086 const i = [ 22087 0, 22088 0, 22089 0 22090 ], n = d([]); 22091 for (const r of this.getNodesInfo()){ 22092 const o = r.node.meshes[0], a = o.transformedAabb; 22093 if (e1 < a.min[0] || t1 < a.min[1] || e1 > a.max[0] || t1 > a.max[1]) continue; 22094 if (!0 === r.node.hidden) return { 22095 height: 1 / 0, 22096 maxHeight: r.feature.properties.height, 22097 hidden: !1, 22098 verticalScale: r.evaluatedScale[2] 22099 }; 22100 if (p(n, r.node.globalMatrix), i[0] = e1, i[1] = t1, i[2] = 0, Y(i, i, n), r.node.meshBVH) { 22101 const e1 = i[0], t1 = i[1]; 22102 Eb[0] = e1 - 1, Eb[1] = t1 - 1, Eb[2] = -1e3, Ib[0] = e1 + 1, Ib[1] = t1 + 1, Ib[2] = 1e3; 22103 const n = r.node.meshBVH.findHighestPoint(Eb, Ib); 22104 if (null !== n) return { 22105 height: n, 22106 maxHeight: r.feature.properties.height, 22107 hidden: r.hiddenByReplacement, 22108 verticalScale: r.evaluatedScale[2] 22109 }; 22110 continue; 22111 } 22112 const s = (i[0] - o.aabb.min[0]) / (o.aabb.max[0] - o.aabb.min[0]) * uy | 0, l = Math.min(63, (i[1] - o.aabb.min[1]) / (o.aabb.max[1] - o.aabb.min[1]) * uy | 0) * uy + Math.min(63, s), c = o.heightmap[l]; 22113 if (c < 0 && r.node.footprint) { 22114 const i = []; 22115 if (r.node.footprint.grid.query(new Pe(e1, t1), new Pe(e1, t1), i), i.length > 0) return { 22116 height: void 0, 22117 maxHeight: r.feature.properties.height, 22118 hidden: r.hiddenByReplacement, 22119 verticalScale: r.evaluatedScale[2] 22120 }; 22121 continue; 22122 } 22123 if (r.hiddenByReplacement) return; 22124 return { 22125 height: c, 22126 maxHeight: r.feature.properties.height, 22127 hidden: !1, 22128 verticalScale: r.evaluatedScale[2] 22129 }; 22130 } 22131 } 22132 constructor(e1, t1, i, n, r, o, a, s){ 22133 this.requiresStandardRuntime = !0, this.isTiled3dModelBucket = !0, this.id = i, this.layers = e1, this.layerIds = this.layers.map((e1)=>e1.fqid), this.stateDependentLayerIds = this.layers.filter((e1)=>e1.isStateDependent()).map((e1)=>e1.id), this.modelTraits |= 1, this.uploaded = !1, this.hasPattern = !1, n && (this.modelTraits |= 4), r && (this.modelTraits |= 8), this.zoom = -1, this.terrainExaggeration = 1, this.projection = { 22134 name: "mercator" 22135 }, this.replacementUpdateTime = 0, this.elevationReadFromZ = 255, this.brightness = o, this.worldview = s, this.dirty = !0, this.needsUpload = !1, this.filter = null, this.nodesInfo = []; 22136 for (const e1 of t1)this.nodesInfo.push(new zb(e1)), Tb(e1, a.featureIndexArray.length, a.grid), a.featureIndexArray.emplaceBack(this.nodesInfo.length - 1, 0, a.bucketLayerIDs.length - 1, 0); 22137 this.states = {}, this.hasAppearances = null; 22138 } 22139 } 22140 function Pb(e1, t1) { 22141 return e1 instanceof ja && !e1.isLightConstant && t1; 22142 } 22143 function Db(e1) { 22144 const t1 = it(e1, 0, 2); 22145 return Math.min(Math.round(.5 * t1 * 255), 255); 22146 } 22147 const Fb = new Float64Array(10 * Sb.length); 22148 function Cb(e1, t1, i, n, r, o) { 22149 if (!e1.featureData) return; 22150 const a = e1.featureArray = new wu; 22151 a.reserveExact(e1.featureData.length), function(e1, t1, i) {
22152 const n = i - t1; 22153 for(let i = 0; i < Sb.length; i++){ 22154 const r = e1.evaluatedRMEA[i], o = e1.evaluatedColor[i], a = e1.emissionHeightBasedParams[i], s = it(a[0], 0, 1), l = it(a[1], 0, 1); 22155 let c = 65535, u = 0, h = 1, d = 1; 22156 if (s !== l && 0 !== n) { 22157 const e1 = it(a[2], 0, 1), i = it(a[3], 0, 1), r = n * (l - s); 22158 u = 1 / r, h = -(t1 + n * s) / r, d = Math.pow(10, it(a[4], -1, 1)), c = 255 * e1 << 8 | 255 * i; 22159 } 22160 const f = Fb, p = 10 * i; 22161 f[p] = 255 * o[0], f[p + 1] = 255 * o[1], f[p + 2] = 255 * o[2], f[p + 3] = o[3], f[p + 4] = Math.floor(255 * r[3]), f[p + 5] = Db(r[2]) << 8 | 15 * r[0] << 4 | 15 * r[1], f[p + 6] = c, f[p + 7] = u, f[p + 8] = h, f[p + 9] = d; 22162 } 22163 }(t1, e1.aabb.min[2], e1.aabb.max[2]); 22164 const s = Fb, l = t1.node; 22165 let c = r && !!l.lights; 22166 for (const t1 of e1.featureData){ 22167 const e1 = t1 >> i & 65535, r = t1 >> n & 15, u = r < 8 ? r : 0, h = 10 * u; 22168 let d = (61440 & e1 | (61440 & e1) >> 4) >> 8, f = (3840 & e1 | (3840 & e1) >> 4) >> 4, p = 240 & e1 | (240 & e1) >> 4; 22169 const m = (15 & e1 | (15 & e1) << 4) / 255, _ = s[h + 3]; 22170 _ > 0 && (d = fn(d, s[h], _), f = fn(f, s[h + 1], _), p = fn(p, s[h + 2], _)), o && (d *= m, f *= m, p *= m); 22171 const g = d << 8 | f, y = p << 8 | s[h + 4], x = s[h + 5], v = s[h + 6], b = s[h + 7], w = s[h + 8], A = s[h + 9]; 22172 if (a.emplaceBack(g, y, x, v, b, w, A), c && 2 === u) { 22173 c = !1; 22174 const e1 = 10 * l.lights.length, t1 = new wu; 22175 t1.reserveExact(e1); 22176 for(let i = 0; i < e1; i++)t1.emplaceBack(g, y, x, v, b, w, A); 22177 l.meshes[l.lightMeshIndex].featureArray = t1; 22178 } 22179 } 22180 } 22181 function Lb(e1, t1, i) { 22182 const n = e1.node, r = 8 & i, o = r ? 0 : 16, a = r ? 16 : 0; 22183 for(let i = 0; i < n.meshes.length; i++)n.lights && n.lightMeshIndex === i || Cb(n.meshes[i], e1, o, a, t1, !1); 22184 if (n.lodMeshes) for (const t1 of n.lodMeshes)Cb(t1, e1, o, a, !1, !0); 22185 } 22186 Xa(Rb, "Tiled3dModelBucket", { 22187 omit: [ 22188 "layers" 22189 ] 22190 }), Xa(zb, "Tiled3dModelFeature"); 22191 class Ob { 22192 encode(e1) { 22193 return this._stringToNumber[e1]; 22194 } 22195 decode(e1) { 22196 return this._numberToString[e1]; 22197 } 22198 constructor(e1){ 22199 this._stringToNumber = {}, this._numberToString = []; 22200 for(let t1 = 0; t1 < e1.length; t1++){ 22201 const i = e1[t1]; 22202 this._stringToNumber[i] = t1, this._numberToString[t1] = i; 22203 } 22204 } 22205 } 22206 const Bb = [ 22207 "id", 22208 "tile", 22209 "layer", 22210 "source", 22211 "sourceLayer", 22212 "state" 22213 ]; 22214 class Vb { 22215 clone() { 22216 const e1 = new Vb(this._vectorTileFeature, this._z, this._x, this._y, this.id); 22217 return this.state && (e1.state = { 22218 ...this.state 22219 }), this.layer && (e1.layer = { 22220 ...this.layer 22221 }), this.source && (e1.source = this.source), this.sourceLayer && (e1.sourceLayer = this.sourceLayer), e1; 22222 } 22223 get geometry() { 22224 return void 0 === this._geometry && this._vectorTileFeature && (this._geometry = this._vectorTileFeature.toGeoJSON(this._x, this._y, this._z).geometry), this._geometry; 22225 } 22226 set geometry(e1) { 22227 this._geometry = e1; 22228 } 22229 toJSON() { 22230 const e1 = { 22231 type: "Feature", 22232 state: void 0, 22233 geometry: this.geometry, 22234 properties: this.properties 22235 }; 22236 for (const t1 of Bb)void 0 !== this[t1] && (e1[t1] = this[t1]); 22237 return e1; 22238 } 22239 constructor(e1, t1, i, n, r){ 22240 this.type = "Feature", this._vectorTileFeature = e1, this._z = t1, this._x = i, this._y = n, this.properties = e1 ? e1.properties : {}, this.id = r; 22241 } 22242 } 22243 const Nb = { 22244 BaseColor: 5, 22245 MetallicRoughness: 6, 22246 Normal: 7, 22247 Occlusion: 8, 22248 Emission: 9, 22249 LUT: 10, 22250 ShadowMap0: 11 22251 }, kb = new Float32Array(d([])), Ub = [ 22252 0, 22253 0, 22254 0 22255 ], jb = function(e1, t1, i, n, r, o, s, c, u, h, d, f, p) { 22256 let m = arguments.length > 13 && arguments[13] !== void 0 ? arguments[13] : [ 22257 0, 22258 0, 22259 0 22260 ], _ = arguments.length > 14 ? arguments[14] : void 0, g = arguments.length > 15 ? arguments[15] : void 0, y = arguments.length > 16 ? arguments[16] : void 0, x = arguments.length > 17 && arguments[17] !== void 0 ? arguments[17] : 1, v = arguments.length > 18 && arguments[18] !== void 0 ? arguments[18] : !1; 22261 let b = Ub, w = 0, A = Ub; 22262 if (!v) { 22263 const e1 = r.style.light, t1 = e1.properties.get("position"); 22264 if (b = [ 22265 -t1.x, 22266 -t1.y, 22267 t1.z 22268 ], "viewport" === e1.properties.get("anchor")) { 22269 const e1 = a(); 22270 l(e1, -r.transform.angle), J(b, b, e1); 22271 } 22272 const i = e1.properties.get("color").toNonPremultipliedRenderColor(null); 22273 w = e1.properties.get("intensity"), A = [ 22274 i.r, 22275 i.g, 22276 i.b 22277 ]; 22278 } 22279 const E = "MASK" === d.alphaMode, I = p.paint.get("model-ambient-occlusion-intensity"), M = p.paint.get("model-color").constantOr(mn.white).toNonPremultipliedRenderColor(null); 22280 return M.a = p.paint.get("model-color-mix-intensity").constantOr(0), y && (M.r = y[0], M.g = y[1], M.b = y[2], M.a = y[3]), g && (M.r = g.color.r, M.g = g.color.g, M.b = g.color.b, M.a = g.colorMix, f = g.emissionStrength, o *= g.opacity), { 22281 u_matrix: e1, 22282 u_lighting_matrix: t1, 22283 u_normal_matrix: i, 22284 u_node_matrix: n || kb, 22285 u_lightpos: b, 22286 u_lightintensity: w, 22287 u_lightcolor: A, 22288 u_camera_pos: m, 22289 u_opacity: o, 22290 u_baseTextureIsAlpha: 0,
22291 u_alphaMask: +E, 22292 u_alphaCutoff: d.alphaCutoff, 22293 u_baseColorFactor: s.toNonPremultipliedRenderColor(null).toArray01(), 22294 u_emissiveFactor: c.toNonPremultipliedRenderColor(null).toArray01(), 22295 u_metallicFactor: u, 22296 u_roughnessFactor: h, 22297 u_baseColorTexture: Nb.BaseColor, 22298 u_metallicRoughnessTexture: Nb.MetallicRoughness, 22299 u_normalTexture: Nb.Normal, 22300 u_occlusionTexture: Nb.Occlusion, 22301 u_emissionTexture: Nb.Emission, 22302 u_lutTexture: Nb.LUT, 22303 u_color_mix: M.toArray01(), 22304 u_aoIntensity: I, 22305 u_emissive_strength: f, 22306 u_occlusionTextureTransform: _ || [ 22307 0, 22308 0, 22309 0, 22310 0 22311 ], 22312 u_dithered_discard_threshold: x 22313 }; 22314 }, Gb = function(e1) { 22315 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : kb, i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : kb; 22316 return { 22317 u_matrix: e1, 22318 u_instance: t1, 22319 u_node_matrix: i 22320 }; 22321 }, Hb = 7680; 22322 class $b { 22323 constructor(e1, t1, i, n, r, o){ 22324 this.test = e1, this.ref = t1, this.mask = i, this.fail = n, this.depthFail = r, this.pass = o; 22325 } 22326 } 22327 $b.disabled = new $b({ 22328 func: 519, 22329 mask: 0 22330 }, 0, 0, Hb, Hb, Hb); 22331 const Zb = 770, Wb = 771; 22332 class qb { 22333 constructor(e1, t1, i, n){ 22334 this.blendFunction = e1, this.blendColor = t1.toNonPremultipliedRenderColor(null), this.mask = i, this.blendEquation = n; 22335 } 22336 } 22337 qb.Replace = [ 22338 1, 22339 0, 22340 1, 22341 0 22342 ], qb.disabled = new qb(qb.Replace, mn.transparent, [ 22343 !1, 22344 !1, 22345 !1, 22346 !1 22347 ]), qb.unblended = new qb(qb.Replace, mn.transparent, [ 22348 !0, 22349 !0, 22350 !0, 22351 !0 22352 ]), qb.alphaBlended = new qb([ 22353 1, 22354 Wb, 22355 1, 22356 Wb 22357 ], mn.transparent, [ 22358 !0, 22359 !0, 22360 !0, 22361 !0 22362 ]), qb.alphaBlendedNonPremultiplied = new qb([ 22363 Zb, 22364 Wb, 22365 Zb, 22366 Wb 22367 ], mn.transparent, [ 22368 !0, 22369 !0, 22370 !0, 22371 !0 22372 ]), qb.multiply = new qb([ 22373 774, 22374 0, 22375 774, 22376 0 22377 ], mn.transparent, [ 22378 !0, 22379 !0, 22380 !0, 22381 !0 22382 ]), qb.multiplyAccumulateAlpha = new qb([ 22383 774, 22384 0, 22385 1, 22386 Wb 22387 ], mn.transparent, [ 22388 !0, 22389 !0, 22390 !0, 22391 !0 22392 ]), qb.additive = new qb([ 22393 1, 22394 1, 22395 1, 22396 1 22397 ], mn.transparent, [ 22398 !0, 22399 !0, 22400 !0, 22401 !0 22402 ]), qb.additiveAlphaWeighted = new qb([ 22403 Zb, 22404 1, 22405 773, 22406 1 22407 ], mn.transparent, [ 22408 !0, 22409 !0, 22410 !0, 22411 !0 22412 ]), qb.additiveAlphaWeightedUnboundedAlpha = new qb([ 22413 Zb, 22414 1, 22415 1, 22416 1 22417 ], mn.transparent, [ 22418 !0, 22419 !0, 22420 !0, 22421 !0 22422 ]); 22423 class Xb { 22424 constructor(e1, t1, i){ 22425 this.func = e1, this.mask = t1, this.range = i; 22426 } 22427 } 22428 Xb.ReadOnly = !1, Xb.ReadWrite = !0, Xb.disabled = new Xb(519, Xb.ReadOnly, [ 22429 0, 22430 1 22431 ]); 22432 const Yb = 1029, Jb = 2305; 22433 class Kb { 22434 constructor(e1, t1, i){ 22435 this.enable = e1, this.mode = t1, this.frontFace = i; 22436 } 22437 } 22438 Kb.disabled = new Kb(!1, Yb, Jb), Kb.backCCW = new Kb(!0, Yb, Jb), Kb.backCW = new Kb(!0, Yb, 2304), Kb.frontCW = new Kb(!0, 1028, 2304), Kb.frontCCW = new Kb(!0, 1028, Jb); 22439 class Qb { 22440 interpolate(e1, t1, i) { 22441 return null != t1.top && null != e1.top && (this.top = fn(e1.top, t1.top, i)), null != t1.bottom && null != e1.bottom && (this.bottom = fn(e1.bottom, t1.bottom, i)), null != t1.left && null != e1.left && (this.left = fn(e1.left, t1.left, i)), null != t1.right && null != e1.right && (this.right = fn(e1.right, t1.right, i)), this; 22442 } 22443 getCenter(e1, t1) { 22444 return new Pe(it((this.left + e1 - this.right) / 2, 0, e1), it((this.top + t1 - this.bottom) / 2, 0, t1)); 22445 } 22446 equals(e1) { 22447 return this.top === e1.top && this.bottom === e1.bottom && this.left === e1.left && this.right === e1.right; 22448 } 22449 clone() { 22450 return new Qb(this.top, this.bottom, this.left, this.right); 22451 } 22452 toJSON() { 22453 return { 22454 top: this.top, 22455 bottom: this.bottom, 22456 left: this.left, 22457 right: this.right 22458 }; 22459 } 22460 constructor(e1 = 0, t1 = 0, i = 0, n = 0){ 22461 if (isNaN(e1) || e1 < 0 || isNaN(t1) || t1 < 0 || isNaN(i) || i < 0 || isNaN(n) || n < 0) throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers"); 22462 this.top = e1, this.bottom = t1, this.left = i, this.right = n; 22463 } 22464 } 22465 function ew(e1, t1) { 22466 const i = It(e1, 3); 22467 M(e1, t1), Mt(e1, 3, i); 22468 } 22469 function tw(e1, t1) { 22470 const i = ue([]); 22471 return pe(i, i, -t1), de(i, i, -e1), i; 22472 } 22473 function iw(e1, t1) { 22474 const i = [ 22475 e1[0], 22476 e1[1], 22477 0 22478 ], n = [ 22479 t1[0], 22480 t1[1], 22481 0 22482 ]; 22483 if (D(i) >= 1e-15) { 22484 const e1 = Z([], i);
22485 k(n, e1, W(n, e1)), t1[0] = n[0], t1[1] = n[1]; 22486 } 22487 const r = q([], t1, e1); 22488 if (ne(r) < 1e-15) return null; 22489 const o = Math.atan2(-r[1], r[0]); 22490 return tw(Math.atan2(Math.sqrt(e1[0] * e1[0] + e1[1] * e1[1]), -e1[2]), o); 22491 } 22492 class nw { 22493 get position() { 22494 return this._position; 22495 } 22496 set position(e1) { 22497 if (e1) { 22498 const t1 = e1 instanceof Mc ? e1 : new Mc(e1[0], e1[1], e1[2]); 22499 this._renderWorldCopies && (t1.x = rt(t1.x, 0, 1)), this._position = t1; 22500 } else this._position = null; 22501 } 22502 lookAtPoint(e1, t1, i) { 22503 if (this.orientation = null, !this.position) return; 22504 const n = this.position, r = i || (this._elevation ? this._elevation.getAtPointOrZero(Mc.fromLngLat(e1)) : 0), o = Mc.fromLngLat(e1, r), a = [ 22505 o.x - n.x, 22506 o.y - n.y, 22507 o.z - n.z 22508 ]; 22509 t1 || (t1 = [ 22510 0, 22511 0, 22512 1 22513 ]), t1[2] = Math.abs(t1[2]), this.orientation = iw(a, t1); 22514 } 22515 setPitchBearing(e1, t1) { 22516 this.orientation = tw(Je(e1), Je(-t1)); 22517 } 22518 constructor(e1, t1){ 22519 this.position = e1, this.orientation = t1; 22520 } 22521 } 22522 class rw { 22523 get mercatorPosition() { 22524 const e1 = this.position; 22525 return new Mc(e1[0], e1[1], e1[2]); 22526 } 22527 get position() { 22528 const e1 = It(this._transform, 3); 22529 return [ 22530 e1[0], 22531 e1[1], 22532 e1[2] 22533 ]; 22534 } 22535 set position(e1) { 22536 var t1; 22537 e1 && Mt(this._transform, 3, [ 22538 (t1 = e1)[0], 22539 t1[1], 22540 t1[2], 22541 1 22542 ]); 22543 } 22544 get orientation() { 22545 return this._orientation; 22546 } 22547 set orientation(e1) { 22548 this._orientation = e1 || ue([]), e1 && ew(this._transform, this._orientation); 22549 } 22550 getPitchBearing() { 22551 const e1 = this.forward(), t1 = this.right(); 22552 return { 22553 bearing: Math.atan2(-t1[1], t1[0]), 22554 pitch: Math.atan2(Math.sqrt(e1[0] * e1[0] + e1[1] * e1[1]), -e1[2]) 22555 }; 22556 } 22557 setPitchBearing(e1, t1) { 22558 this._orientation = tw(e1, t1), ew(this._transform, this._orientation); 22559 } 22560 forward() { 22561 const e1 = It(this._transform, 2); 22562 return [ 22563 -e1[0], 22564 -e1[1], 22565 -e1[2] 22566 ]; 22567 } 22568 up() { 22569 const e1 = It(this._transform, 1); 22570 return [ 22571 -e1[0], 22572 -e1[1], 22573 -e1[2] 22574 ]; 22575 } 22576 right() { 22577 const e1 = It(this._transform, 0); 22578 return [ 22579 e1[0], 22580 e1[1], 22581 e1[2] 22582 ]; 22583 } 22584 getCameraToWorld(e1, t1) { 22585 const i = new Float64Array(16); 22586 return p(i, this.getWorldToCamera(e1, t1)), i; 22587 } 22588 getCameraToWorldMercator() { 22589 return this._transform; 22590 } 22591 getWorldToCameraPosition(e1, t1, i) { 22592 const n = this.position; 22593 k(n, n, -e1); 22594 const r = new Float64Array(16); 22595 return w(r, [ 22596 i, 22597 i, 22598 i 22599 ]), _(r, r, n), r[10] *= t1, r; 22600 } 22601 getWorldToCamera(e1, t1) { 22602 const i = new Float64Array(16), n = new Float64Array(4), r = this.position; 22603 var o, a; 22604 return (o = n)[0] = -(a = this._orientation)[0], o[1] = -a[1], o[2] = -a[2], o[3] = a[3], k(r, r, -e1), M(i, n), _(i, i, r), i[1] *= -1, i[5] *= -1, i[9] *= -1, i[13] *= -1, i[8] *= t1, i[9] *= t1, i[10] *= t1, i[11] *= t1, i; 22605 } 22606 getCameraToClipPerspective(e1, t1, i, n) { 22607 const r = new Float64Array(16); 22608 return T(r, e1, t1, i, n), r; 22609 } 22610 getCameraToClipOrthographic(e1, t1, i, n, r, o) { 22611 const a = new Float64Array(16); 22612 return S(a, e1, t1, i, n, r, o), a; 22613 } 22614 getDistanceToElevation(e1) { 22615 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1; 22616 const i = 0 === e1 ? 0 : xc(e1, t1 ? mr(this.position[1]) : this.position[1]), n = this.forward(); 22617 return (i - this.position[2]) / n[2]; 22618 } 22619 clone() { 22620 return new rw([ 22621 ...this.position 22622 ], [ 22623 ...this.orientation 22624 ]); 22625 } 22626 constructor(e1, t1){ 22627 this._transform = d([]), this.orientation = t1, this.position = e
226271; 22628 } 22629 } 22630 const ow = Math.tan(85 * Math.PI / 180); 22631 function aw(e1, t1, i, n, r, a, s) { 22632 const l = c(); 22633 if (i) if ("globe" === a.name) { 22634 const e1 = function(e1, t1) { 22635 const { x: i, y: n } = e1.point, r = Xf(i, n, e1.worldSize / e1._pixelsPerMercatorPixel, 0, 0); 22636 return m(r, r, Zf(Of(t1))); 22637 }(r, t1); 22638 m(l, l, e1); 22639 } else { 22640 const e1 = o([], s); 22641 l[0] = e1[0], l[1] = e1[1], l[4] = e1[2], l[5] = e1[3], n || v(l, l, r.angle); 22642 } 22643 else m(l, r.labelPlaneMatrix, e1); 22644 return l; 22645 } 22646 function sw(e1, t1, i, n) { 22647 const r = [ 22648 e1, 22649 t1, 22650 i, 22651 1 22652 ]; 22653 i ? le(r, r, n) : yw(r, r, n); 22654 const o = r[3]; 22655 return r[0] /= o, r[1] /= o, r[2] /= o, r; 22656 } 22657 function lw(e1, t1) { 22658 return Math.min(.5 + e1 / t1 * .5, 1.5); 22659 } 22660 function cw(e1, t1) { 22661 const i = e1[0] / e1[3], n = e1[1] / e1[3]; 22662 return i >= -t1[0] && i <= t1[0] && n >= -t1[1] && n <= t1[1]; 22663 } 22664 function uw(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g) { 22665 const { lineStartIndex: y, glyphStartIndex: x, segment: v } = s, b = x + s.numGlyphs, w = y + s.lineLength, A = t1.getoffsetX(x), E = t1.getoffsetX(b - 1), I = _w(e1 * A, i, n, r, o, a, v, y, w, l, c, u, h, d, !0, f, p, m, _, g); 22666 if (!I) return null; 22667 const M = _w(e1 * E, i, n, r, o, a, v, y, w, l, c, u, h, d, !0, f, p, m, _, g); 22668 return M ? { 22669 first: I, 22670 last: M 22671 } : null; 22672 } 22673 function hw(e1, t1, i, n) { 22674 return e1 === Xd.horizontal && Math.abs(n) > Math.abs(i) ? { 22675 useVertical: !0 22676 } : e1 === Xd.vertical ? n > 0 ? { 22677 needsFlipping: !0 22678 } : null : 0 !== t1 && function(e1, t1) { 22679 return 0 === e1 || Math.abs(t1 / e1) > ow; 22680 }(i, n) ? 1 === t1 ? { 22681 needsFlipping: !0 22682 } : null : i < 0 ? { 22683 needsFlipping: !0 22684 } : null; 22685 } 22686 function dw(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g, y, x, v) { 22687 const b = t1 / 24, w = e1.lineOffsetX * b, A = e1.lineOffsetY * b, { lineStartIndex: E, glyphStartIndex: I, numGlyphs: M, segment: T, writingMode: S, flipState: z } = e1, R = E + e1.lineLength, P = (e1)=>{ 22688 if (u) { 22689 const [t1, i, n] = e1.up, r = c.length; 22690 Wm(u, r + 0, t1, i, n), Wm(u, r + 1, t1, i, n), Wm(u, r + 2, t1, i, n), Wm(u, r + 3, t1, i, n); 22691 } 22692 const [t1, i, n] = e1.point; 22693 qm(c, t1, i, n, e1.angle); 22694 }; 22695 if (M > 1) { 22696 const t1 = uw(b, s, w, A, i, h, d, e1, l, o, f, m, !1, _, g, y, x, v); 22697 if (!t1) return { 22698 notEnoughRoom: !0 22699 }; 22700 if (n && !i) { 22701 let [i, n, r] = t1.first.point, [o, s, l] = t1.last.point; 22702 [i, n] = sw(i, n, r, a), [o, s] = sw(o, s, l, a); 22703 const c = hw(S, z, (o - i) * p, s - n); 22704 if (e1.flipState = c && c.needsFlipping ? 1 : 2, c) return c; 22705 } 22706 P(t1.first); 22707 for(let e1 = I + 1; e1 < I + M - 1; e1++){ 22708 const t1 = _w(b * s.getoffsetX(e1), w, A, i, h, d, T, E, R, l, o, f, m, !1, !1, _, g, y, x, v); 22709 if (!t1) return c.length -= 4 * (e1 - I), { 22710 notEnoughRoom: !0 22711 }; 22712 P(t1); 22713 } 22714 P(t1.last); 22715 } else { 22716 if (n && !i) { 22717 const t1 = sw(d.x, d.y, 0, r), i = E + T + 1, n = new Pe(l.getx(i), l.gety(i)), o = sw(n.x, n.y, 0, r), a = o[3] > 0 ? o : mw(d, n, t1, 1, r, void 0, _, g.canonical), s = hw(S, z, (a[
vendor: 4,270 bytes, lines 22717-22818
227170] - t1[0]) * p, a[1] - t1[1]); 22718 if (e1.flipState = s && s.needsFlipping ? 1 : 2, s) return s; 22719 } 22720 const t1 = _w(b * s.getoffsetX(I), w, A, i, h, d, T, E, R, l, o, f, m, !1, !1, _, g, y, x, v); 22721 if (!t1) return { 22722 notEnoughRoom: !0 22723 }; 22724 P(t1); 22725 } 22726 return {}; 22727 } 22728 function fw(e1, t1, i) { 22729 const n = 1 << t1.z; 22730 let r = (e1.x / zr + t1.x) / n - i.mercCenter[0]; 22731 const o = (e1.y / zr + t1.y) / n - i.mercCenter[1]; 22732 r -= Math.round(r); 22733 const a = [ 22734 r * zr, 22735 o * zr, 22736 zr / (2 * Math.PI), 22737 1 22738 ]; 22739 return le(a, a, i.invMatrix), [ 22740 a[0], 22741 a[1], 22742 a[2] 22743 ]; 22744 } 22745 function pw(e1, t1, i, n, r, o) { 22746 let { x: a, y: s, z: l } = n.projectTilePoint(e1.x, e1.y, t1); 22747 if (o) { 22748 const [i, n, r] = fw(e1, t1, o); 22749 a += (i - a) * o.t, s += (n - s) * o.t, l += (r - l) * o.t; 22750 } 22751 if (!r) return sw(a, s, l, i); 22752 const [c, u, h] = r.getElevation(e1, r.elevation, r.elevationFeature); 22753 return sw(a + c, s + u, l + h, i); 22754 } 22755 function mw(e1, t1, i, n, r, o, a, s, l) { 22756 const c = pw(e1.sub(t1)._unit()._add(e1), s, r, a, o, l); 22757 return te(c, i, c), Z(c, c), U(c, i, c, n); 22758 } 22759 function _w(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g, y, x) { 22760 const v = n ? e1 - t1 : e1 + t1; 22761 let b = v > 0 ? 1 : -1, w = 0; 22762 n && (b *= -1, w = Math.PI), b < 0 && (w += Math.PI); 22763 let A = s + a + (b > 0 ? 0 : 1) | 0, E = r, I = r, M = 0, T = 0; 22764 const S = Math.abs(v), z = [], R = []; 22765 let P = o, D = P, F = Q([]); 22766 const C = ()=>mw(D, P, I, S - M + 1, u, d, m, _.canonical, x); 22767 for(; M + T <= S;){ 22768 if (A += b, A < s || A >= l) return null; 22769 if (I = E, D = P, z.push(I), f && R.push(D), P = new Pe(c.getx(A), c.gety(A)), E = h[A], !E) { 22770 const e1 = pw(P, _.canonical, u, m, d, x); 22771 E = e1[3] > 0 ? h[A] = e1 : C(); 22772 } 22773 M += T; 22774 const e1 = te([], E, I), t1 = j(I, E); 22775 if (i && t1 > 0 && T > 0 && W(F, e1) / (T * t1) < y) return null; 22776 T = t1, F = e1; 22777 } 22778 p && d && (h[A] && (E = C(), T = j(I, E), F = te([], E, I)), h[A] = E); 22779 const L = (S - M) / T, O = P.sub(D)._mult(L)._add(D), B = U([], I, F, L); 22780 let V = [ 22781 0, 22782 0, 22783 1 22784 ], N = F[0], k = F[1]; 22785 if (g && (V = m.upVector(_.canonical, O.x, O.y), 0 !== V[0] || 0 !== V[1] || 1 !== V[2])) { 22786 const e1 = [ 22787 V[2], 22788 0, 22789 -V[0] 22790 ], t1 = q([], V, e1); 22791 Z(e1, e1), Z(t1, t1), N = W(F, e1), k = W(F, t1); 22792 } 22793 if (i) { 22794 const e1 = q([], V, F); 22795 Z(e1, e1), U(B, B, e1, i * b); 22796 } 22797 const G = w + Math.atan2(k, N); 22798 return z.push(B), f && R.push(O), { 22799 point: B, 22800 angle: G, 22801 path: z, 22802 tilePath: R, 22803 up: V 22804 }; 22805 } 22806 function gw(e1, t1) { 22807 const i = t1.length, n = i + 4 * e1; 22808 t1.resize(n), t1.float32.fill(-1 / 0, 4 * i, 4 * n); 22809 } 22810 function yw(e1, t1, i) { 22811 const n = t1[0], r = t1[1]; 22812 return e1[0] = i[0] * n + i[4] * r + i[12], e1[1] = i[1] * n + i[5] * r + i[13], e1[3] = i[3] * n + i[7] * r + i[15], e1; 22813 } 22814 const xw = 15; 22815 class vw { 22816 clone() { 22817 const e1 = new vw(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies, this.getProjection(), this.maxBounds); 22818 return e1._elevation = this._elevation, e1._centerAltitude = this._centerAltitude, e1._centerAltitudeValidForE
22818xaggeration = this._centerAltitudeValidForExaggeration, e1.tileSize = this.tileSize, e1.mercatorFromTransition = this.mercatorFromTransition, e1.width = this.width, e1.height = this.height, e1.cameraElevationReference = this.cameraElevationReference, e1._center = this._center, e1._setZoom(this.zoom), e1._seaLevelZoom = this._seaLevelZoom, e1.angle = this.angle, e1._fov = this._fov, e1._pitch = this._pitch, e1._nearZ = this._nearZ, e1._farZ = this._farZ, e1._nearClipOffset = this._nearClipOffset, e1._averageElevation = this._averageElevation, e1._orthographicProjectionAtLowPitch = this._orthographicProjectionAtLowPitch, e1._unmodified = this._unmodified, e1._edgeInsets = this._edgeInsets.clone(), e1._camera = this._camera.clone(), e1._calcMatrices(), e1.freezeTileCoverage = this.freezeTileCoverage, e1.frustumCorners = this.frustumCorners, e1._allowWorldUnderZoom = this._allowWorldUnderZoom, e1; 22819 } 22820 get isOrthographic() { 22821 return "globe" !== this.projection.name && this._orthographicProjectionAtLowPitch && this.pitch < xw; 22822 } 22823 get elevation() { 22824 return this._elevation; 22825 } 22826 set elevation(e1) { 22827 this._elevation !== e1 && (this._elevation = e1, this._updateCameraOnTerrain(), this._calcMatrices()); 22828 } 22829 get nearClipOffset() { 22830 return this._nearClipOffset; 22831 } 22832 set nearClipOffset(e1) { 22833 this._nearClipOffset = e1, this._calcMatrices(); 22834 } 22835 get depthOcclusionForSymbolsAndCircles() { 22836 return "globe" !== this.projection.name && !this.isOrthographic; 22837 } 22838 updateElevation(e1) { 22839 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1; 22840 const i = this._elevation && this._elevation.exaggeration() !== this._centerAltitudeValidForE
22840xaggeration; 22841 (null == this._seaLevelZoom || i) && this._updateCameraOnTerrain(), (e1 || i) && this._constrainCamera(t1), this._calcMatrices(); 22842 } 22843 getProjection() { 22844 return at(this.projection, [ 22845 "name", 22846 "center", 22847 "parallels" 22848 ]); 22849 } 22850 setProjection(e1) { 22851 this.projectionOptions = e1 || { 22852 name: "mercator" 22853 }; 22854 const t1 = this.projection ? this.getProjection() : void 0; 22855 this.projection = Rp(this.projectionOptions); 22856 const i = !De(t1, this.getProjection()); 22857 return i && this._calcMatrices(), this.mercatorFromTransition = !1, i; 22858 } 22859 setOrthographicProjectionAtLowPitch(e1) { 22860 return this._orthographicProjectionAtLowPitch !== e1 && (this._orthographicProjectionAtLowPitch = e1, this._calcMatrices(), !0); 22861 } 22862 setMercatorFromTransition() { 22863 const e1 = this.projection.name; 22864 this.mercatorFromTransition = !0, this.projectionOptions = { 22865 name: "mercator" 22866 }, this.projection = Rp({ 22867 name: "mercator" 22868 }); 22869 const t1 = e1 !== this.projection.name; 22870 return t1 && this._calcMatrices(), t1; 22871 } 22872 get minZoom() { 22873 return this._minZoom; 22874 } 22875 set minZoom(e1) { 22876 this._minZoom !== e1 && (this._minZoom = e1, this.zoom = Math.max(this.zoom, e1)); 22877 } 22878 get maxZoom() { 22879 return this._maxZoom; 22880 } 22881 set maxZoom(e1) { 22882 this._maxZoom !== e1 && (this._maxZoom = e1, this.zoom = Math.min(this.zoom, e1)); 22883 } 22884 get minPitch() { 22885 return this._minPitch; 22886 } 22887 set minPitch(e1) { 22888 this._minPitch !== e1 && (this._minPitch = e1, this.pitch = Math.max(this.pitch, e1)); 22889 } 22890 get maxPitch() { 22891 return this._maxPitch; 22892 } 22893 set maxPitch(e1) { 22894 this._maxPitch !== e1 && (this._maxPitch = e1, this.pitch = Math.min(this.pitch, e1)); 22895 } 22896 get renderWorldCopies() { 22897 return this._renderWorldCopies && !0 === this.projection.supportsWorldCopies; 22898 } 22899 set renderWorldCopies(e1) { 22900 void 0 === e1 ? e1 = !0 : null === e1 && (e1 = !1), this._renderWorldCopies = e1; 22901 } 22902 get worldSize() { 22903 return this.tileSize * this.scale; 22904 } 22905 get cameraWorldSizeForFog() { 22906 const e1 = Math.max(this._camera.getDistanceToElevation(this._averageElevation), Number.EPSILON); 22907 return this._worldSizeFromZoom(this._zoomFromMercatorZ(e1)); 22908 } 22909 get cameraWorldSize() { 22910 const e1 = Math.max(this._camera.getDistanceToElevation(this._averageElevation, !0), Number.EPSILON); 22911 return this._worldSizeFromZoom(this._zoomFromMercatorZ(e1)); 22912 } 22913 get pixelsPerMeter() { 22914 return this.projection.pixelsPerMeter(this.center.lat, this.worldSize); 22915 } 22916 get cameraPixelsPerMeter() { 22917 return xc(1, this.center.lat) * this.cameraWorldSizeForFog; 22918 } 22919 get centerOffset() { 22920 return this.centerPoint._sub(this.size._div(2)); 22921 } 22922 get size() { 22923 return new Pe(this.width, this.height); 22924 } 22925 get bearing() { 22926 return rt(this.rotation, -180, 180); 22927 } 22928 set bearing(e1) {
22929 this.rotation = e1; 22930 } 22931 get rotation() { 22932 return -this.angle / Math.PI * 180; 22933 } 22934 set rotation(e1) { 22935 const t1 = -e1 * Math.PI / 180; 22936 if (this.angle === t1) return; 22937 this._unmodified = !1, this.angle = t1, this._calcMatrices(); 22938 const i = Math.sin(this.angle), n = Math.cos(this.angle); 22939 this.rotationMatrix = [ 22940 n, 22941 i, 22942 -i, 22943 n 22944 ]; 22945 } 22946 get pitch() { 22947 return this._pitch / Math.PI * 180; 22948 } 22949 set pitch(e1) { 22950 const t1 = it(e1, this.minPitch, this.maxPitch) / 180 * Math.PI; 22951 this._pitch !== t1 && (this._unmodified = !1, this._pitch = t1, this._calcMatrices()); 22952 } 22953 get aspect() { 22954 return this.width / this.height; 22955 } 22956 get fov() { 22957 return this._fov / Math.PI * 180; 22958 } 22959 set fov(e1) { 22960 e1 = Math.max(.01, Math.min(60, e1)), this._fov !== e1 && (this._unmodified = !1, this._fov = Je(e1), this._calcMatrices()); 22961 } 22962 get fovX() { 22963 return this._fov; 22964 } 22965 get fovY() { 22966 const e1 = 1 / Math.tan(.5 * this.fovX); 22967 return 2 * Math.atan(1 / this.aspect / e1); 22968 } 22969 get horizontalFov() { 22970 return Ke(2 * Math.atan(Math.tan(.5 * this._fov) * this.aspect)); 22971 } 22972 get averageElevation() { 22973 return this._averageElevation; 22974 } 22975 set averageElevation(e1) {
22976 this._averageElevation = e1, this._calcFogMatrices(), this._distanceTileDataCache = {}; 22977 } 22978 get zoom() { 22979 return this._zoom; 22980 } 22981 set zoom(e1) { 22982 const t1 = Math.min(Math.max(e1, this.minZoom), this.maxZoom); 22983 this._zoom !== t1 && (this._unmodified = !1, this._setZoom(t1), this._updateSeaLevelZoom(), this._constrain(), this._calcMatrices()); 22984 } 22985 _setZoom(e1) { 22986 this._zoom = e1, this.scale = this.zoomScale(e1), this.tileZoom = Math.floor(e1), this.zoomFraction = e1 - this.tileZoom; 22987 } 22988 get tileCoverLift() { 22989 return this._tileCoverLift; 22990 } 22991 set tileCoverLift(e1) { 22992 this._tileCoverLift !== e1 && (this._tileCoverLift = e1); 22993 } 22994 _updateCameraOnTerrain() { 22995 const e1 = this.elevation ? this.elevation.getAtPoint(this.locationCoordinate(this.center), Number.NEGATIVE_INFINITY) : Number.NEGATIVE_INFINITY, t1 = this.elevation && e1 === Number.NEGATIVE_INFINITY && this.elevation.visibleDemTiles.length > 0 && this.elevation.exaggeration() >
vendor: 16,215 bytes, lines 22995-23263
22995 0 && this._centerAltitudeValidForExaggeration; 22996 if (!this._elevation || e1 === Number.NEGATIVE_INFINITY && (!t1 || !this._centerAltitude)) return this._centerAltitude = 0, this._seaLevelZoom = null, void (this._centerAltitudeValidForExaggeration = void 0); 22997 const i = this._elevation; 22998 t1 || this._centerAltitude && this._centerAltitudeValidForExaggeration && i.exaggeration() && this._centerAltitudeValidForExaggeration !== i.exaggeration() ? (this._centerAltitude = this._centerAltitude / this._centerAltitudeValidForExaggeration * i.exaggeration(), this._centerAltitudeValidForExaggeration = i.exaggeration()) : (this._centerAltitude = e1 || 0, this._centerAltitudeValidForExaggeration = i.exaggeration()), this._updateSeaLevelZoom(); 22999 } 23000 _updateSeaLevelZoom() { 23001 if (void 0 === this._centerAltitudeValidForExaggeration) return; 23002 const e1 = Math.max(0, (this.pixelsPerMeter * this._centerAltitude + this.cameraToCenterDistance) / this.worldSize); 23003 this._seaLevelZoom = this._zoomFromMercatorZ(e1); 23004 } 23005 sampleAverageElevation() { 23006 if (!this._elevation) return 0; 23007 const e1 = this._elevation, t1 = [ 23008 [ 23009 .5, 23010 .2 23011 ], 23012 [ 23013 .3, 23014 .5 23015 ], 23016 [ 23017 .5, 23018 .5 23019 ], 23020 [ 23021 .7, 23022 .5 23023 ], 23024 [ 23025 .5, 23026 .8 23027 ] 23028 ], i = this.horizonLineFromTop(); 23029 let n = 0, r = 0; 23030 for(let o = 0; o < t1.length; o++){ 23031 const a = new Pe(t1[o][0] * this.width, i + t1[o][1] * (this.height - i)), s = e1.pointCoordinate(a); 23032 if (!s) continue; 23033 const l = 1 / Math.hypot(s[0] - this._camera.position[0], s[1] - this._camera.position[1]); 23034 n += s[3] * l, r += l; 23035 } 23036 return 0 === r ? NaN : n / r; 23037 } 23038 get center() { 23039 return this._center; 23040 } 23041 set center(e1) { 23042 e1.lat === this._center.lat && e1.lng === this._center.lng || (this._unmodified = !1, this._center = e1, this._terrainEnabled() && ("ground" === this.cameraElevationReference ? this._updateCameraOnTerrain() : this._updateZoomFromElevation()), this._constrain(), this._calcMatrices()); 23043 } 23044 _updateZoomFromElevation() { 23045 if (null == this._seaLevelZoom || !this._elevation) return; 23046 const e1 = this._seaLevelZoom, t1 = this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)), i = this.pixelsPerMeter / this.worldSize * t1, n = this._mercatorZfromZoom(e1), r = this._mercatorZfromZoom(this._maxZoom), o = Math.max(n - i, r); 23047 this._setZoom(this._zoomFromMercatorZ(o)); 23048 } 23049 get padding() { 23050 return this._edgeInsets.toJSON(); 23051 } 23052 set padding(e1) { 23053 this._edgeInsets.equals(e1) || (this._unmodified = !1, this._edgeInsets.interpolate(this._edgeInsets, e1, 1), this._calcMatrices()); 23054 } 23055 equals(e1) { 23056 const t1 = this.elevation, i = e1.elevation, n = null != t1 != (null != i) || t1 && i && t1.exaggeration() !== i.exaggeration(); 23057 return this.width === e1.width && this.height === e1.height && this.center.lng === e1.center.lng && this.center.lat === e1.center.lat && this.zoom === e1.zoom && this.bearing === e1.bearing && this.pitch === e1.pitch && this.fov === e1.fov && this.projection.name === e1.projection.name && this._edgeInsets.equals(e1.padding) && !n; 23058 } 23059 computeZoomRelativeTo(e1) { 23060 const t1 = this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint, e1.toAltitude())); 23061 let i; 23062 i = e1.z < this._camera.position[2] ? [ 23063 t1.x, 23064 t1.y, 23065 t1.z 23066 ] : [ 23067 e1.x, 23068 e1.y, 23069 e1.z 23070 ]; 23071 const n = D(te([], this._camera.position, i)); 23072 return it(this._zoomFromMercatorZ(n), this._minZoom, this._maxZoom); 23073 } 23074 setFreeCameraOptions(e1) { 23075 if (!this.height) return; 23076 if (!e1.position && !e1.orientation) return; 23077 this._updateCameraState(); 23078 let t1 = !1; 23079 if (e1.orientation && !((i = e1.orientation)[0] === (n = this._camera.orientation)[0] && i[1] === n[1] && i[2] === n[2] && i[3] === n[3]) && (t1 = this._setCameraOrientation(e1.orientation)), e1.position) { 23080 const i = [ 23081 e1.position.x, 23082 e1.position.y, 23083 e1.position.z 23084 ]; 23085 ee(i, this._camera.position) || (this._setCameraPosition(i), t1 = !0); 23086 } 23087 var i, n; 23088 t1 && (this._updateStateFromCamera(), this.recenterOnTerrain()); 23089 } 23090 getFreeCameraOptions() { 23091 this._updateCameraState(); 23092 const e1 = this._camera.position, t1 = new nw; 23093 return t1.position = new Mc(e1[0], e1[1], e1[2]), t1.orientation = this._camera.orientation, t1._elevation = this.elevation, t1._renderWorldCopies = this.renderWorldCopies, t1; 23094 } 23095 _setCameraOrientation(e1) { 23096 if (!function(e1) { 23097 var t1 = e1[0], i = e1[1], n = e1[2], r = e1[3]; 23098 return Math.sqrt(t1 * t1 + i * i + n * n + r * r); 23099 }(e1)) return !1; 23100 ye(e1, e1); 23101 const t1 = K([], [ 23102 0, 23103 0, 23104 -1 23105 ], e1), i = K([], [ 23106 0, 23107 -1, 23108 0 23109 ], e1); 23110 if (i[2] < 0) return !1; 23111 const n = iw(t1, i); 23112 return !!n && (this._camera.orientation = n, !0); 23113 } 23114 _setCameraPosition(e1) { 23115 const t1 = this.zoomScale(this.minZoom) * this.tileSize, i = this.zoomScale(this.maxZoom) * this.tileSize, n = this.cameraToCenterDistance; 23116 e1[2] = it(e1[2], n / i, n / t1), this._camera.position = e1; 23117 } 23118 get centerPoint() { 23119 return this._edgeInsets.getCenter(this.width, this.height); 23120 } 23121 get fovAboveCenter() { 23122 return this._fov * (.5 + this.centerOffset.y / this.height); 23123 } 23124 isPaddingEqual(e1) { 23125 return this._edgeInsets.equals(e1); 23126 } 23127 interpolatePadding(e1, t1, i) { 23128 this._unmodified = !1, this._edgeInsets.interpolate(e1, t1, i), this._constrain(), this._calcMatrices(); 23129 } 23130 coveringZoomLevel(e1) { 23131 const t1 = (e1.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / e1.tileSize)); 23132 return Math.max(0, t1); 23133 } 23134 getVisibleUnwrappedCoordinates(e1) { 23135 const t1 = [ 23136 new rp(0, e1) 23137 ]; 23138 if (this.renderWorldCopies) { 23139 const i = this.pointCoordinate(new Pe(0, 0)), n = this.pointCoordinate(new Pe(this.width, 0)), r = this.pointCoordinate(new Pe(this.width, this.height)), o = this.pointCoordinate(new Pe(0, this.height)), a = Math.floor(Math.min(i.x, n.x, r.x, o.x)), s = Math.floor(Math.max(i.x, n.x, r.x, o.x)), l = 1; 23140 for(let i = a - l; i <= s + l; i++)0 !== i && t1.push(new rp(i, e1)); 23141 } 23142 return t1; 23143 } 23144 isLODDisabled(e1) { 23145 return (!e1 || this.pitch <= 60) && this._edgeInsets.top <= this._edgeInsets.bottom && !this._elevation && !this.projection.isReprojectedInTileSpace; 23146 } 23147 extendTileCover(e1, t1, i, n) { 23148 let r = []; 23149 const o = null != i, a = !o; 23150 if (a && this.zoom < t1) return r; 23151 if (o && 0 === i[0] && 0 === i[1]) return r; 23152 const s = new Set, l = (e1, t1, i, n, o)=>{ 23153 const a = ap(t1, e1, i, n, o); 23154 s.has(a) || (r.push(new op(e1, t1, i, n, o)), s.add(a)); 23155 }; 23156 for(let r = 0; r < e1.length; r++){ 23157 const s = e1[r]; 23158 if (a && s.canonical.z !== t1) continue; 23159 if (o && void 0 !== n && n > s.canonical.z) continue; 23160 const c = s.canonical, u = s.overscaledZ, h = s.wrap, d = 1 << c.z, f = c.x + 1 < d, p = c.x > 0, m = c.y + 1 < d, _ = c.y > 0, g = s.wrap - (p ? 0 : 1), y = s.wrap + (f ? 0 : 1), x = p ? c.x - 1 : d - 1, v = f ? c.x + 1 : 0; 23161 if (o) i[0] < 0 ? (l(u, y, c.z, v, c.y), i[1] < 0 && m && (l(u, h, c.z, c.x, c.y + 1), l(u, y, c.z, v, c.y + 1)), i[1] > 0 && _ && (l(u, h, c.z, c.x, c.y - 1), l(u, y, c.z, v, c.y - 1))) : i[0] > 0 ? (l(u, g, c.z, x, c.y), i[1] < 0 && m && (l(u, h, c.z, c.x, c.y + 1), l(u, g, c.z, x, c.y + 1)), i[1] > 0 && _ && (l(u, h, c.z, c.x, c.y - 1), l(u, g, c.z, x, c.y - 1))) : i[1] < 0 && m ? l(u, h, c.z, c.x, c.y + 1) : _ && l(u, h, c.z, c.x, c.y - 1); 23162 else { 23163 const e1 = s.visibleQuadrants; 23164 1 & e1 && (l(u, g, c.z, x, c.y), _ && (l(u, h, c.z, c.x, c.y - 1), l(u, g, c.z, x, c.y - 1))), 2 & e1 && (l(u, y, c.z, v, c.y), _ && (l(u, h, c.z, c.x, c.y - 1), l(u, y, c.z, v, c.y - 1))), 4 & e1 && (l(u, g, c.z, x, c.y), m && (l(u, h, c.z, c.x, c.y + 1), l(u, g, c.z, x, c.y + 1))), 8 & e1 && (l(u, y, c.z, v, c.y), m && (l(u, h, c.z, c.x, c.y + 1), l(u, y, c.z, v, c.y + 1))); 23165 } 23166 } 23167 const c = []; 23168 for (const e1 of r)r.some((t1)=>e1.isChildOf(t1)) || c.push(e1); 23169 if (r = c.filter((i)=>!e1.some((e1)=>!!(i.overscaledZ < t1 && e1.isChildOf(i)) || i.equals(e1) || i.isChildOf(e1))), a) { 23170 const e1 = 1 << t1, i = "globe" === this.projection.name ? this._camera.mercatorPosition : this.pointCoordinate(this.getCameraPoint()), n = [ 23171 e1 * i.x, 23172 e1 * i.y 23173 ], o = 4, a = o * o; 23174 r = r.filter((e1)=>{ 23175 const t1 = e1.canonical.x + .5 - n[0], i = e1.canonical.y + .5 - n[1]; 23176 return t1 * t1 + i * i < a; 23177 }); 23178 } 23179 return r; 23180 } 23181 extendTileCoverToNearPlane(e1, t1, i) { 23182 const n = [], r = new Set; 23183 for (const t1 of e1)r.add(t1.key); 23184 const o = (e1, t1, i, o, a)=>{ 23185 const s = ap(t1, e1, i, o, a); 23186 r.has(s) || (n.push(new op(e1, t1, i, o, a)), r.add(s)); 23187 }, a = e1.reduce((e1, t1)=>Math.max(e1, t1.overscaledZ), i), s = 1 << i, l = [ 23188 new Pe(0, 0), 23189 new Pe(zr, 0), 23190 new Pe(zr, zr), 23191 new Pe(0, zr) 23192 ], c = new Pe(0, 0), u = new Pe(0, 0), h = (e1, t1)=>{ 23193 const n = Math.floor(e1[0]), r = Math.floor(e1[1]), h = (e1[0] - n) * zr, d = (e1[1] - r) * zr, f = Math.floor(t1[0]), p = Math.floor(t1[1]), m = (t1[0] - f) * zr, _ = (t1[1] - p) * zr; 23194 for(let e1 = -1; e1 <= 1; e1++){ 23195 const t1 = n + e1; 23196 if (!(t1 < 0 || t1 >= s)) { 23197 c.x = h - e1 * zr, u.x = m - (t1 - f) * zr; 23198 for(let e1 = -1; e1 <= 1; e1++){ 23199 const n = r + e1; 23200 c.y = d - e1 * zr, u.y = _ - (n - p) * zr, Yh(c, u, l) && o(a, 0, i, t1, n); 23201 } 23202 } 23203 } 23204 }, d = t1.points, f = d[3], p = d[2], m = this._projectToGround(f, d[7]), _ = this._projectToGround(p, d[6]); 23205 return h(f, m), h(p, _), n; 23206 } 23207 _projectToGround(e1, t1) { 23208 return X(R(), e1, t1, e1[2] / (e1[2] - t1[2])); 23209 } 23210 _projectToZ(e1, t1, i) { 23211 const n = e1[2] - t1[2]; 23212 return Math.abs(n) < 1e-6 ? P(e1) : X(R(), e1, t1, (e1[2] - i) / n); 23213 } 23214 extendTileCoverForTunnels(e1, t1, i, n) { 23215 if (i < 18) return []; 23216 const r = t1.points, o = r[0], a = r[1], s = r[4], l = r[5]; 23217 if (s[2] >= 0 && l[2] >= 0 || o[2] <= 0 || a[2] <= 0) return []; 23218 const c = s[2] < 0 ? this._projectToZ(o, s, 0) : s, u = l[2] < 0 ? this._projectToZ(a, l, 0) : l, h = -n, d = s[2] < h ? this._projectToZ(o, s, h) : s, f = l[2] < h ? this._projectToZ(a, l, h) : l, p = this._findExtensionTilesInQuad(e1, i, [ 23219 f, 23220 d, 23221 u, 23222 c 23223 ], [ 23224 .5 * (c[0] + u[0]), 23225 .5 * (c[1] + u[1]) 23226 ]); 23227 return p.length > 3 && (p.length = 3), p; 23228 } 23229 _findExtensionTilesInQuad(e1, t1, i, n) { 23230 const r = [], o = new Set; 23231 for (const t1 of e1)o.add(t1.key); 23232 const a = e1.reduce((e1, t1)=>Math.max(e1, t1.overscaledZ), t1), s = 1 << t1, l = [ 23233 new Pe(i[0][0], i[0][1]), 23234 new Pe(i[1][0], i[1][1]), 23235 new Pe(i[3][0], i[3][1]), 23236 new Pe(i[2][0], i[2][1]), 23237 new Pe(i[0][0], i[0][1]) 23238 ], c = i[0][0], u = i[1][0], h = i[2][0], d = i[3][0], f = i[0][1], p = i[1][1], m = i[2][1], _ = i[3][1], g = Math.max(0, Math.floor(Math.min(c, u, h, d))), y = Math.min(s - 1, Math.ceil(Math.max(c, u, h, d)) - 1), x = Math.max(0, Math.floor(Math.min(f, p, m, _))), v = Math.min(s - 1, Math.ceil(Math.max(f, p, m, _)) - 1); 23239 for(let e1 = x; e1 <= v; e1++)for(let i = g; i <= y; i++){ 23240 if (!Xh(l, i, e1, i + 1, e1 + 1)) continue; 23241 const n = ap(0, a, t1, i, e1); 23242 o.has(n) || (r.push(new op(a, 0, t1, i, e1)), o.add(n)); 23243 } 23244 const b = n[0], w = n[1]; 23245 return r.sort((e1, t1)=>{ 23246 const i = e1.canonical.x + .5 - b, n = e1.canonical.y + .5 - w, r = t1.canonical.x + .5 - b, o = t1.canonical.y + .5 - w; 23247 return i * i + n * n - (r * r + o * o) || e1.canonical.x - t1.canonical.x || e1.canonical.y - t1.canonical.y; 23248 }), r; 23249 } 23250 coveringTiles(e1) { 23251 let t1 = this.coveringZoomLevel(e1); 23252 const i = t1, n = this.elevation && this.elevation.exaggeration(), r = n && !e1.isTerrainDEM, o = "mercator" === this.projection.name; 23253 if (void 0 !== e1.minzoom && t1 < e1.minzoom) return []; 23254 void 0 !== e1.maxzoom && t1 > e1.maxzoom && (t1 = e1.maxzoom); 23255 const a = this.locationCoordinate(this.center), s = this.center.lat, l = 1 << t1, c = [ 23256 l * a.x, 23257 l * a.y, 23258 0 23259 ], u = "globe" === this.projection.name, h = !u, d = zf.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, t1, h), f = u ? this._camera.mercatorPosition : this.pointCoordinate(this.getCameraPoint()), p = l * xc(1, this.center.lat), m = this._camera.position[2] / xc(1, this.center.lat), _ = [ 23260 l * f.x, 23261 l * f.y, 23262 m * (h ? 1 : p) 23263 ], g = u || n, y = this.cameraToCenterDistance / e1.tileSize * (e1.roun
23263dZoom ? 1 : .502), x = this.isLODDisabled(!0) ? t1 : 0; 23264 let v; 23265 if (this._elevation && e1.isTerrainDEM) v = 1e4 * this._elevation.exaggeration(); 23266 else if (this._elevation) { 23267 const e1 = this._elevation.getMinMaxForVisibleTiles(); 23268 v = e1 ? e1.max : this._centerAltitude; 23269 } else v = this._centerAltitude; 23270 const b = e1.isTerrainDEM ? -v : this._elevation ? this._elevation.getMinElevationBelowMSL() : 0, w = this.projection.isReprojectedInTileSpace ? ey(this) : 1, A = (e1)=>{ 23271 const t1 = 1 / 4e4, i = new Mc(e1.x + t1, e1.y, e1.z), n = new Mc(e1.x, e1.y + t1, e1.z), r = e1.toLngLat(), o = i.toLngLat(), a = n.toLngLat(), s = this.locationCoordinate(r), l = this.locationCoordinate(o), c = this.locationCoordinate(a), u = Math.hypot(l.x - s.x, l.y - s.y), h = Math.hypot(c.x - s.x, c.y - s.y); 23272 return Math.sqrt(u * h) * w / t1; 23273 }, E = (e1)=>{ 23274 const t1 = v, i = b; 23275 return { 23276 aabb: cp(this, l, 0, 0, 0, e1, i, t1, this.projection), 23277 zoom: 0, 23278 x: 0, 23279 y: 0, 23280 minZ: i, 23281 maxZ: t1, 23282 wrap: e1, 23283 fullyVisible: !1 23284 }; 23285 }, I = []; 23286 let M = []; 23287 const T = t1, S = e1.reparseOverscaled ? i : t1, z = (m - this._centerAltitude) * p, R = (e1)=>{ 23288 if (!this._elevation || !e1.tileID || !o) return; 23289 const t1 = this._elevation.getMinMaxForTile(e1.tileID), i = e1.aabb; 23290 t1 ? (i.min[2] = t1.min, i.max[2] = t1.max, i.center[2] = (i.min[2] + i.max[2]) / 2) : (e1.shouldSplit = D(e1), e1.shouldSplit || (i.min[2] = i.max[2] = i.center[2] = this._centerAltitude)); 23291 }, P = (e1, t1)=>{ 23292 if (.707 * t1 < e1) return 1; 23293 const i = t1 / e1; 23294 return i / (1.4144271570014144 + (Math.pow(1.1, i - 1.4144271570014144 + 1) - 1) / (1.1 - 1) - 1); 23295 }, D = (e1)=>{ 23296 if (e1.zoom < x) return !0; 23297 if (e1.zoom === T) return !1; 23298 if (null != e1.shouldSplit) return e1.shouldSplit; 23299 const t1 = e1.aabb.distanceX(_), n = e1.aabb.distanceY(_); 23300 let a = z, l = 1; 23301 if (u) { 23302 a = e1.aabb.distanceZ(_); 23303 const t1 = Math.pow(2, e1.zoom), i = mr((e1.y + 1) / t1), n = mr(e1.y / t1), r = Math.min(Math.max(s, i), n), o = yc(r) / yc(s); 23304 if (l = r === s ? 1 / Math.max(1, this._mercatorScaleRatio - .3) : Math.min(1, o / this._mercatorScaleRatio), this.zoom <= 5 && e1.zoom === T - 1 && o >= .9) return !0; 23305 } else if (r && (a = e1.aabb.distanceZ(_) * p), this.projection.isReprojectedInTileSpace && i <= 5) { 23306 const t1 = Math.pow(2, e1.zoom), i = A(new Mc((e1.x + .5) / t1, (e1.y + .5) / t1)); 23307 l = i > .85 ? 1 : i; 23308 } 23309 if (!o && !u) { 23310 const i = Math.sqrt(t1 * t1 + n * n + a * a); 23311 let r = (1 << T - e1.zoom) * y * l; 23312 return r *= P(Math.max(a, z), i), i < r; 23313 } 23314 let h = Number.MAX_VALUE, d = 0; 23315 const f = e1.aabb.getCorners(), m = [ 23316 0, 23317 0, 23318 0 23319 ]; 23320 for (const e1 of f){ 23321 te(m, e1, _), u || (r ? m[2] *= p : m[2] = z); 23322 const t1 = W(m, this._camera.forward()); 23323 t1 < h && (h = t1, d = Math.abs(m[2])); 23324 } 23325 let g = (1 << T - e1.zoom) * y * l; 23326 if (g *= P(Math.max(d, z), h), h < g) return !0; 23327 const v = e1.aabb.closestPoint(c); 23328 return v[0] === c[0] && v[1] === c[1]; 23329 }; 23330 if (this.renderWorldCopies) for(let e1 = 1; e1 <= 3;
vendor: 12,657 bytes, lines 23330-23581
23330 e1++)I.push(E(-e1)), I.push(E(e1)); 23331 for(I.push(E(0)); I.length > 0;){ 23332 const i = I.pop(), n = i.x, a = i.y; 23333 let s = i.fullyVisible; 23334 const h = ()=>"globe" === this.projection.name && (0 === i.y || i.y === (1 << i.zoom) - 1); 23335 if (!s) { 23336 let e1 = g ? i.aabb.intersects(d) : i.aabb.intersectsFlat(d); 23337 if (0 === e1 && h()) { 23338 const t1 = new np(i.zoom, n, a); 23339 e1 = Nf(this, l, t1, !0).intersects(d); 23340 } 23341 if (0 === e1) continue; 23342 s = 2 === e1; 23343 } 23344 if (i.zoom === T || !D(i)) { 23345 const r = i.zoom === T ? S : i.zoom; 23346 if (e1.minzoom && e1.minzoom > r) continue; 23347 let o = 0; 23348 if (!s) { 23349 let t1 = g ? i.aabb.intersectsPrecise(d) : i.aabb.intersectsPreciseFlat(d); 23350 if (0 === t1 && h()) { 23351 const e1 = new np(i.zoom, n, a); 23352 t1 = Nf(this, l, e1, !0).intersectsPrecise(d); 23353 } 23354 if (0 === t1) continue; 23355 if (e1.calculateQuadrantVisibility) if (d.containsPoint(i.aabb.center)) o = 15; 23356 else for(let e1 = 0; e1 < 4; e1++)0 !== i.aabb.quadrant(e1).intersects(d) && (o |= 1 << e1); 23357 } 23358 const u = c[0] - (.5 + n + (i.wrap << i.zoom)) * (1 << t1 - i.zoom), f = c[1] - .5 - a, p = i.tileID ? i.tileID : new op(r, i.wrap, i.zoom, n, a); 23359 e1.calculateQuadrantVisibility && (p.visibleQuadrants = o), M.push({ 23360 tileID: p, 23361 distanceSq: u * u + f * f 23362 }); 23363 continue; 23364 } 23365 for(let e1 = 0; e1 < 4; e1++){ 23366 const t1 = (n << 1) + e1 % 2, c = (a << 1) + (e1 >> 1), h = { 23367 aabb: o ? i.aabb.quadrant(e1) : cp(this, l, i.zoom + 1, t1, c, i.wrap, i.minZ, i.maxZ, this.projection), 23368 zoom: i.zoom + 1, 23369 x: t1, 23370 y: c, 23371 wrap: i.wrap, 23372 fullyVisible: s, 23373 tileID: void 0, 23374 shouldSplit: void 0, 23375 minZ: i.minZ, 23376 maxZ: i.maxZ 23377 }; 23378 r && !u && (h.tileID = new op(i.zoom + 1 === T ? S : i.zoom + 1, i.wrap, i.zoom + 1, t1, c), R(h)), I.push(h); 23379 } 23380 } 23381 if (this.fogCullDistSq) { 23382 const t1 = this.fogCullDistSq, i = this.horizonLineFromTop(); 23383 M = M.filter((n)=>{ 23384 const r = [ 23385 0, 23386 0, 23387 0, 23388 1 23389 ], o = [ 23390 zr, 23391 zr, 23392 0, 23393 1 23394 ], a = this.calculateFogTileMatrix(n.tileID.toUnwrapped()); 23395 le(r, r, a), le(o, o, a); 23396 const s = (h = r, d = o, (u = [])[0] = Math.min(h[0], d[0]), u[1] = Math.min(h[1], d[1]), u[2] = Math.min(h[2], d[2]), u[3] = Math.min(h[3], d[3]), u), l = function(e1, t1, i) { 23397 return e1[0] = Math.max(t1[0], i[0]), e1[1] = Math.max(t1[1], i[1]), e1[2] = Math.max(t1[2], i[2]), e1[3] = Math.max(t1[3], i[3]), e1; 23398 }([], r, o), c = function(e1, t1) { 23399 let i = 0; 23400 for(let n = 0; n < 2; ++n){ 23401 const r = 0; 23402 e1[n] > r && (i += (e1[n] - r) * (e1[n] - r)), t1[n] < r && (i += (r - t1[n]) * (r - t1[n])); 23403 } 23404 return i; 23405 }(s, l); 23406 var u, h, d; 23407 if (0 === c) return !0; 23408 let f = !1; 23409 const p = this._elevation; 23410 if (p && c > t1 && 0 !== i) { 23411 const t1 = this.calculateProjMatrix(n.tileID.toUnwrapped()); 23412 let r; 23413 e1.isTerrainDEM || (r = p.getMinMaxForTile(n.tileID)), r || (r = { 23414 min: b, 23415 max: v 23416 }); 23417 const o = function(e1) { 23418 const t1 = Math.round((e1 + 45 + 360) % 360 / 90) % 4; 23419 return Qe[t1]; 23420 }(this.rotation), a = [ 23421 o[0] * zr, 23422 o[1] * zr, 23423 r.max 23424 ]; 23425 Y(a, a, t1), f = (1 - a[1]) * this.height * .5 < i; 23426 } 23427 return c < t1 || f; 23428 }); 23429 } 23430 return M.sort((e1, t1)=>e1.distanceSq - t1.distanceSq).map((e1)=>e1.tileID); 23431 } 23432 resize(e1, t1) { 23433 this.width = e1, this.height = t1, this.pixelsToGLUnits = [ 23434 2 / e1, 23435 -2 / t1 23436 ], this._constrain(), this._calcMatrices(); 23437 } 23438 get unmodified() { 23439 return this._unmodified; 23440 } 23441 zoomScale(e1) { 23442 return Math.pow(2, e1); 23443 } 23444 scaleZoom(e1) { 23445 return Math.log2(e1); 23446 } 23447 project(e1) { 23448 const t1 = it(e1.lat, -85.051129, bc), i = this.projection.project(e1.lng, t1); 23449 return new Pe(i.x * this.worldSize, i.y * this.worldSize); 23450 } 23451 unproject(e1) { 23452 return this.projection.unproject(e1.x / this.worldSize, e1.y / this.worldSize); 23453 } 23454 get point() { 23455 return this.project(this.center); 23456 } 23457 get pointMerc() { 23458 return this.point._div(this.worldSize); 23459 } 23460 get pixelsPerMeterRatio() { 23461 return this.pixelsPerMeter / xc(1, this.center.lat) / this.worldSize; 23462 } 23463 setLocationAtPoint(e1, t1) { 23464 let i, n; 23465 const r = this.centerPoint; 23466 if ("globe" === this.projection.name) { 23467 const e1 = this.worldSize; 23468 i = (t1.x - r.x) / e1, n = (t1.y - r.y) / e1; 23469 } else { 23470 const e1 = this.pointCoordinate(t1), o = this.pointCoordinate(r); 23471 i = e1.x - o.x, n = e1.y - o.y; 23472 } 23473 const o = this.locationCoordinate(e1); 23474 this.setLocation(new Mc(o.x - i, o.y - n)); 23475 } 23476 setLocation(e1) { 23477 this.center = this.coordinateLocation(e1), this.projection.wrap && (this.center = this.center.wrap()); 23478 } 23479 locationPoint(e1, t1) { 23480 return this.projection.locationPoint(this, e1, t1); 23481 } 23482 locationPoint3D(e1, t1) { 23483 return this.projection.locationPoint(this, e1, t1, !0); 23484 } 23485 pointLocation(e1) { 23486 return this.coordinateLocation(this.pointCoordinate(e1)); 23487 } 23488 pointLocation3D(e1, t1) { 23489 return this.coordinateLocation(this.pointCoordinate3D(e1, t1)); 23490 } 23491 locationCoordinate(e1, t1) { 23492 const i = t1 ? xc(t1, e1.lat) : void 0, n = this.projection.project(e1.lng, e1.lat); 23493 return new Mc(n.x, n.y, i); 23494 } 23495 coordinateLocation(e1) { 23496 return this.projection.unproject(e1.x, e1.y); 23497 } 23498 pointRayIntersection(e1, t1) { 23499 const i = t1 !== null && t1 !== void 0 ? t1 : this._centerAltitude, n = [ 23500 e1.x, 23501 e1.y, 23502 0, 23503 1 23504 ], r = [ 23505 e1.x, 23506 e1.y, 23507 1, 23508 1 23509 ]; 23510 le(n, n, this.pixelMatrixInverse), le(r, r, this.pixelMatrixInverse); 23511 const o = r[3]; 23512 ae(n, n, 1 / n[3]), ae(r, r, 1 / o); 23513 const a = n[2], s = r[2]; 23514 return { 23515 p0: n, 23516 p1: r, 23517 t: a === s ? 0 : (i - a) / (s - a) 23518 }; 23519 } 23520 screenPointToMercatorRay(e1) { 23521 const t1 = [ 23522 e1.x, 23523 e1.y, 23524 0, 23525 1 23526 ], i = [ 23527 e1.x, 23528 e1.y, 23529 1, 23530 1 23531 ]; 23532 return le(t1, t1, this.pixelMatrixInverse), le(i, i, this.pixelMatrixInverse), ae(t1, t1, 1 / t1[3]), ae(i, i, 1 / i[3]), t1[2] = xc(t1[2], this._center.lat) * this.worldSize, i[2] = xc(i[2], this._center.lat) * this.worldSize, ae(t1, t1, 1 / this.worldSize), ae(i, i, 1 / this.worldSize), new wf([ 23533 t1[0], 23534 t1[1], 23535 t1[2] 23536 ], Z([], te([], i, t1))); 23537 } 23538 rayIntersectionCoordinate(e1) { 23539 const { p0: t1, p1: i, t: n } = e1, r = xc(t1[2], this._center.lat), o = xc(i[2], this._center.lat); 23540 return new Mc(fn(t1[0], i[0], n) / this.worldSize, fn(t1[1], i[1], n) / this.worldSize, fn(r, o, n)); 23541 } 23542 pointCoordinate(e1) { 23543 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this._centerAltitude; 23544 return this.projection.pointCoordinate(this, e1.x, e1.y, t1); 23545 } 23546 pointCoordinate3D(e1, t1) { 23547 if (!this.elevation) return this.pointCoordinate(e1, t1); 23548 let i = this.projection.pointCoordinate3D(this, e1.x, e1.y); 23549 if (i) return new Mc(i[0], i[1], i[2]); 23550 let n = 0, r = this.horizonLineFromTop(); 23551 if (e1.y > r) return this.pointCoordinate(e1, t1); 23552 const o = .02 * r, a = e1.clone(); 23553 for(let e1 = 0; e1 < 10 && r - n > o; e1++){ 23554 a.y = fn(n, r, .66); 23555 const e1 = this.projection.pointCoordinate3D(this, a.x, a.y); 23556 e1 ? (r = a.y, i = e1) : n = a.y; 23557 } 23558 return i ? new Mc(i[0], i[1], i[2]) : this.pointCoordinate(e1); 23559 } 23560 isPointAboveHorizon(e1) { 23561 return this.projection.isPointAboveHorizon(this, e1); 23562 } 23563 isPointOnSurface(e1) { 23564 if (e1.y < 0 || e1.y > this.height || e1.x < 0 || e1.x > this.width) return !1; 23565 if (this.elevation || this.zoom >= 6) return !this.isPointAboveHorizon(e1); 23566 const t1 = this.pointCoordinate(e1); 23567 return t1.y >= 0 && t1.y <= 1; 23568 } 23569 _coordinatePoint(e1, t1) { 23570 const i = t1 && this.elevation ? this.elevation.getAtPointOrZero(e1, this._centerAltitude) : this._centerAltitude, n = [ 23571 e1.x * this.worldSize, 23572 e1.y * this.worldSize, 23573 i + e1.toAltitude(), 23574 1 23575 ]; 23576 return le(n, n, this.pixelMatrix), n[3] > 0 ? new Pe(n[0] / n[3], n[1] / n[3]) : new Pe(Number.MAX_VALUE, Number.MAX_VALUE); 23577 } 23578 _getBoundsNonRectangular() { 23579 const { top: e1, left: t1 } = this._edgeInsets, i = this.height - this._edgeInsets.bottom, n = this.width - this._edgeInsets.right, r = this.pointLocation3D(new Pe(t1, e1)), o = this.pointLocation3D(new Pe(n, e1)), a = this.pointLocation3D(new Pe(n, i)), s = this.pointLocation3D(new Pe(t1, i)); 23580 let l = Math.min(r.lng, o.lng, a.lng, s.lng), c = Math.max(r.lng, o.lng, a.lng, s.lng), u = Math.min(r.lat, o.lat, a.lat, s.lat), h = Math.max(r.lat, o.lat, a.lat, s.lat); 23581 const f = Math.pow(2, -this.zoom) / 16 * 270, p
23581= "globe" === this.projection.name ? 1 : 4, _ = (e1, t1, i, n, r)=>{ 23582 const o = (e1 + i) / 2, a = (t1 + n) / 2, s = new Pe(o, a), { lng: d, lat: m } = this.pointLocation3D(s), g = Math.max(0, l - d, u - m, d - c, m - h); 23583 l = Math.min(l, d), c = Math.max(c, d), u = Math.min(u, m), h = Math.max(h, m), (r < p || g > f) && (_(e1, t1, o, a, r + 1), _(o, a, i, n, r + 1)); 23584 }; 23585 if (_(t1, e1, n, e1, 1), _(n, e1, n, i, 1), _(n, i, t1, i, 1), _(t1, i, t1, e1, 1), "globe" === this.projection.name) { 23586 const [e1, t1] = function(e1) { 23587 const t1 = d(new Float64Array(16)); 23588 m(t1, e1.pixelMatrix, e1.globeMatrix); 23589 const i = [ 23590 0, 23591 uc, 23592 0 23593 ], n = [ 23594 0, 23595 hc, 23596 0 23597 ]; 23598 return Y(i, i, t1), Y(n, n, t1), [ 23599 i[0] > 0 && i[0] <= e1.width && i[1] > 0 && i[1] <= e1.height && !Kf(e1, new _c(e1.center.lat, 90)), 23600 n[0] > 0 && n[0] <= e1.width && n[1] > 0 && n[1] <= e1.height && !Kf(e1, new _c(e1.center.lat, -90)) 23601 ]; 23602 }(this); 23603 e1 ? (h = 90, c = 180, l = -180) : t1 && (u = -90, c = 180, l = -180); 23604 } 23605 return new gc(new _c(l, u), new _c(c, h)); 23606 } 23607 _getBoundsRectangular(e1, t1) { 23608 const { top: i, left: n } = this._edgeInsets, r = this.height - this._edgeInsets.bottom, o = this.width - this._edgeInsets.right, a = new Pe(n, i), s = new Pe(o, i), l = new Pe(o, r), c = new Pe(n, r); 23609 let u = this.pointCoordinate(a, e1), h = this.pointCoordinate(s, e1); 23610 const d = this.pointCoordinate(l, t1), f = this.pointCoordinate(c, t1), p = (e1, t1)=>(t1.y - e1.y) / (t1.x - e1.x); 23611 return u.y > 1 && h.y >= 0 ? u = new Mc((1 - f.y) / p(f, u) + f.x, 1) : u.y < 0 && h.y <= 1 && (u = new Mc(-f.y / p(f, u) + f.x, 0)), h.y > 1 && u.y >= 0 ? h = new Mc((1 - d.y) / p(d, h) + d.x, 1) : h.y < 0 && u.y <= 1 && (h = new Mc(-d.y / p(d, h) + d.x, 0)), (new gc).extend(this.coordinateLocation(u)).extend(this.coordinateLocation(h)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(d)); 23612 } 23613 _getBoundsRectangularTerrain() { 23614 const e1 = this.elevation; 23615 if (!e1.visibleDemTiles.length || e1.isUsingMockSource()) return this._getBoundsRectangular(0, 0); 23616 const t1 = e1.visibleDemTiles.reduce((e1, t1)=>{ 23617 if (t1.dem) { 23618 const i = t1.dem.tree; 23619 e1.min = Math.min(e1.min, i.minimums[0]), e1.max = Math.max(e1.max, i.maximums[0]); 23620 } 23621 return e1; 23622 }, { 23623 min: Number.MAX_VALUE, 23624 max: 0 23625 }); 23626 return this._getBoundsRectangular(t1.min * e1.exaggeration(), t1.max * e1.exaggeration()); 23627 } 23628 getBounds() { 23629 return "mercator" === this.projection.name || "equirectangular" === this.projection.name ? this._terrainEnabled() ? this._getBoundsRectangularTerrain() : this._getBoundsRectangular(0, 0) : this._getBoundsNonRectangular(); 23630 } 23631 horizonLineFromTop() { 23632 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0; 23633 const t1 = this.height / 2 / Math.tan(this._fov / 2) / Math.tan(Math.max(this._pitch, .1)) - this.centerOffset.y, i = this.height / 2 - t1 * (1 - this._horizonShift); 23634 return e1 ? Math.max(0, i) : i; 23635 } 23636 getMaxBounds() { 23637 return this.maxBounds; 23638 } 23639 setMaxBounds(e1) { 23640 this.maxBounds = e1, this.minLat = -85.051129, this.maxLat = bc, this.minLng = -180, this.maxLng = 180, e1 && (this.minLat = e1.getSouth(), this.maxLat = e1.getNorth(), this.minLng = e1.getWest(), this.maxLng = e1.getEast(), this.maxLng < this.minLng && (this.maxLng += 3
2364060)), this.worldMinX = dr(this.minLng) * this.tileSize, this.worldMaxX = dr(this.maxLng) * this.tileSize, this.worldMinY = fr(this.maxLat) * this.tileSize, this.worldMaxY = fr(this.minLat) * this.tileSize, this._constrain(); 23641 } 23642 calculatePosMatrix(e1, t1) { 23643 return this.projection.createTileMatrix(this, t1, e1); 23644 } 23645 calculateDistanceTileData(e1) { 23646 const t1 = e1.key, i = this._distanceTileDataCache; 23647 if (i[t1]) return i[t1]; 23648 const n = e1.canonical, r = 1 / this.height, o = this.cameraWorldSize, a = o / this.zoomScale(n.z), s = (n.x + Math.pow(2, n.z) * e1.wrap) * a, l = n.y * a, c = this.point; 23649 c.x *= o / this.worldSize, c.y *= o / this.worldSize; 23650 const u = this.angle, h = Math.sin(-u), d = -Math.cos(-u); 23651 return i[t1] = { 23652 bearing: [ 23653 h, 23654 d 23655 ], 23656 center: [ 23657 (c.x - s) * r, 23658 (c.y - l) * r 23659 ], 23660 scale: a / zr * r 23661 }, i[t1]; 23662 } 23663 calculateFogTileMatrix(e1) { 23664 const t1 = e1.key, i = this._fogTileMatrixCache; 23665 if (i[t1]) return i[t1]; 23666 const n = this.projection.createTileMatrix(this, this.cameraWorldSizeForFog, e1); 23667 return m(n, this.worldToFogMatrix, n), i[t1] = new Float32Array(n), i[t1]; 23668 } 23669 calculateProjMatrix(e1) { 23670 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 23671 const n = e1.key; 23672 let r; 23673 if (r = i ? this._expandedProjMatrixCache : t1 ? this._alignedProjMatrixCache : this._projMatrixCache, r[n]) return r[n]; 23674 const o = this.calculatePosMatrix(e1, this.worldSize); 23675 let a; 23676 return a = this.projection.isReprojectedInTileSpace ? this.mercatorMatrix : i ? this.expandedFarZProjMatrix : t1 ? this.alignedProjMatrix : this.projMatrix, m(o, a, o), r[n] = new Float32Array(o), r[n]; 23677 } 23678 calculatePixelsToTileUnitsMatrix(e1) { 23679 const t1 = e1.tileID.key, i = this._pixelsToTileUnitsCache; 23680 if (i[t1]) return i[t1]; 23681 const n = function(e1, t1) { 23682 const { scale: i } = e1.tileTransform, n = i * zr / (e1.tileSize * Math.pow(2, t1.zoom - e1.tileID.overscaledZ + e1.tileID.canonical.z)), r = t1.inverseAdjustmentMatrix; 23683 return new Float32Array([ 23684 r[0] * n, 23685 r[1] * n, 23686 r[2] * n, 23687 r[3] * n 23688 ]); 23689 }(e1, this); 23690 return i[t1] = n, i[t1]; 23691 } 23692 customLayerMatrix() { 23693 return this.mercatorMatrix.slice(); 23694 } 23695 globeToMercatorMatrix() { 23696 if ("globe" === this.projection.name) { 23697 const e1 = 1 / this.worldSize, t1 = w([], [ 23698 e1, 23699 e1, 23700 e1 23701 ]); 23702 return m(t1, t1, this.globeMatrix), t1; 23703 } 23704 } 23705 recenterOnTerrain() { 23706 if (!this._elevation || "globe" === this.projection.name) return; 23707 const e1 = this._elevation; 23708 this._updateCameraState(); 23709 const t1 = xc(1, this._center.lat) * this.worldSize, i = this._computeCameraPosition(t1), n = this._camera.forward(), r = xc(1, this._center.lat); 23710 i[2] /= r, n[2] /= r, Z(n, n); 23711 const o = e1.raycast(i, n, e1.exaggeration()); 23712 if (o) { 23713 const e1 = U([], i, n, o), t1 = new Mc(e1[0], e1[1], xc(e1[2], mr(e1[1]))), a = (t1.z + D([ 23714 t1.x - i[0], 23715 t1.y - i[1], 23716 t1.z - i[2] * r 23717 ])) * this._pixelsPerMercatorPixel; 23718 this._seaLevelZoom = this._zoomFromMercatorZ(a), this._centerAltitude = t1.toAltitude(), this._center = this.coordinateLocation(t1), this._updateZoomFromElevation(), this._constrain(), this._calcMatrices(); 23719 } 23720 } 23721 _constrainCamera() { 23722 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1; 23723 if (!this._elevation) return; 23724 const t1 = this._elevation, i = xc(1, this._center.lat) * this.worldSize, n = this._computeCameraPosition(i), r = t1.getAtPointOrZero(new Mc(...n)), o = this.pixelsPerMeter / this.worldSize * r, a = this._minimumHeightOverTerrain(), s = n[2] - o;
vendor: 12,427 bytes, lines 23725-23901
23725 if (s <= a) if (s < 0 || e1) { 23726 const e1 = this.locationCoordinate(this._center, this._centerAltitude), t1 = [ 23727 n[0], 23728 n[1], 23729 e1.z - n[2] 23730 ], i = D(t1); 23731 t1[2] -= (a - s) / this._pixelsPerMercatorPixel; 23732 const r = D(t1); 23733 if (0 === r) return; 23734 k(t1, t1, i / r * this._pixelsPerMercatorPixel), this._camera.position = [ 23735 n[0], 23736 n[1], 23737 e1.z * this._pixelsPerMercatorPixel - t1[2] 23738 ], this._updateStateFromCamera(); 23739 } else this._isCameraConstrained = !0; 23740 } 23741 _constrain() { 23742 if (!this.center || !this.width || !this.height || this._constraining) return; 23743 this._constraining = !0; 23744 const e1 = "globe" === this.projection.name || this.mercatorFromTransition; 23745 if (this.projection.isReprojectedInTileSpace || e1) { 23746 const t1 = this.center; 23747 return t1.lat = it(t1.lat, this.minLat, this.maxLat), (this.maxBounds || !this.renderWorldCopies && !e1) && (t1.lng = it(t1.lng, this.minLng, this.maxLng)), this.center = t1, void (this._constraining = !1); 23748 } 23749 const t1 = this._unmodified, { x: i, y: n } = this.point; 23750 let r = 0, o = i, a = n; 23751 const s = this.width / 2, l = this.height / 2, c = this.worldMinY * this.scale, u = this.worldMaxY * this.scale; 23752 if (n - l < c && (a = c + l), n + l > u && (a = u - l), u - c < this.height && (r = Math.max(r, this.height / (u - c)), a = (u + c) / 2), this.maxBounds || !this._renderWorldCopies || !this.projection.wrap) { 23753 const e1 = this.worldMinX * this.scale, t1 = this.worldMaxX * this.scale, n = this.worldSize / 2 - (e1 + t1) / 2; 23754 o = (i + n + this.worldSize) % this.worldSize - n, o - s < e1 && (o = e1 + s), o + s > t1 && (o = t1 - s), t1 - e1 < this.width && (r = Math.max(r, this.width / (t1 - e1)), o = (t1 + e1) / 2); 23755 } 23756 o === i && a === n || this._allowWorldUnderZoom || (this.center = this.unproject(new Pe(o, a))), r && !this._allowWorldUnderZoom && (this.zoom += this.scaleZoom(r)), this._constrainCamera(), this._unmodified = t1, this._constraining = !1; 23757 } 23758 _minZoomForBounds() { 23759 let e1 = Math.max(0, this.scaleZoom(Math.max(0, this.height) / (this.worldMaxY - this.worldMinY))); 23760 return this.maxBounds && (e1 = Math.max(e1, this.scaleZoom(this.width / (this.worldMaxX - this.worldMinX)))), e1; 23761 } 23762 _maxCameraBoundsDistance() { 23763 return this._mercatorZfromZoom(this._minZoomForBounds()); 23764 } 23765 _calcMatrices() { 23766 if (!this.height) return; 23767 const e1 = this.centerOffset, t1 = "globe" === this.projection.name, i = this.pixelsPerMeter; 23768 "globe" === this.projection.name && (this._mercatorScaleRatio = xc(1, this.center.lat) / xc(1, 45)); 23769 const n = ty(this.projection, this.zoom, this.width, this.height, 1024); 23770 this._pixelsPerMercatorPixel = this.projection.pixelSpaceConversion(this.center.lat, this.worldSize, n), this.cameraToCenterDistance = .5 / Math.tan(.5 * this._fov) * this.height * this._pixelsPerMercatorPixel, this._updateCameraState(), this._farZ = this.projection.farthestPixelDistance(this), this._nearZ = this.height / 50; 23771 const r = "meters" === this.projection.zAxisUnit ? i : 1, a = this._camera.getWorldToCamera(this.worldSize, r); 23772 let s; 23773 const l = this._camera.getCameraToClipPerspective(this._fov, this.width / this.height, this._nearZ, this._farZ); 23774 if (l[8] = 2 * -e1.x / this.width, l[9] = 2 * e1.y / this.height, this.isOrthographic) { 23775 let t1 = .5 * this.height / Math.tan(this._fov / 2) * 1 * Math.tan(.5 * this._fov), i = t1 * this.aspect, n = -i, r = -t1; 23776 i -= e1.x, n -= e1.x, t1 += e1.y, r += e1.y, s = this._camera.getCameraToClipOrthographic(n, i, r, t1, this._nearZ + this._nearClipOffset, this._farZ), ((e1, t1, i, n)=>{ 23777 for(let r = 0; r < 16; r++)e1[r] = fn(t1[r], i[r], n); 23778 })(s, s, l, Pt(this.pitch >= xw ? 1 : this.pitch / xw)); 23779 } else s = l; 23780 const c = z([], l, a), u = z([], s, a); 23781 if (this.projection.isReprojectedInTileSpace) { 23782 const e1 = this.locationCoordinate(this.center); 23783 d(this._mat4Scratch); 23784 const t1 = this._mat4Scratch; 23785 _(t1, t1, [ 23786 e1.x * this.worldSize, 23787 e1.y * this.worldSize, 23788 0 23789 ]), m(t1, t1, Qg(this)), _(t1, t1, [ 23790 -e1.x * this.worldSize, 23791 -e1.y * this.worldSize, 23792 0 23793 ]), m(u, u, t1), m(c, c, t1), this.inverseAdjustmentMatrix = function(e1) { 23794 const t1 = Qg(e1, !0); 23795 return o([], [ 23796 t1[0], 23797 t1[1], 23798 t1[4], 23799 t1[5] 23800 ]); 23801 }(this); 23802 } else this.inverseAdjustmentMatrix = [ 23803 1, 23804 0, 23805 0, 23806 1 23807 ]; 23808 if (g(this.mercatorMatrix, u, [ 23809 this.worldSize, 23810 this.worldSize, 23811 this.worldSize / r, 23812 1 23813 ]), this.projMatrix = u, p(this.invProjMatrix, this.projMatrix), t1) { 23814 const t1 = this._camera.getCameraToClipPerspective(this._fov, this.width / this.height, this._nearZ, 1 / 0); 23815 t1[8] = 2 * -e1.x / this.width, t1[9] = 2 * e1.y / this.height, z(this._expandedFarZProjMatrixBuf, t1, a), this.expandedFarZProjMatrix = this._expandedFarZProjMatrixBuf; 23816 } else this.expandedFarZProjMatrix = this.projMatrix; 23817 p(this._mat4Scratch, s), this.frustumCorners = Af.fromInvProjectionMatrix(this._mat4Scratch, this.horizonLineFromTop(), this.height), this.cameraFrustum = zf.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, 0, !t1), w(this.skyboxMatrix, [ 23818 1, 23819 -1, 23820 1 23821 ]), y(this.skyboxMatrix, this.skyboxMatrix, this._pitch), v(this.skyboxMatrix, this.skyboxMatrix, this.angle), T(this.starsProjMatrix, this._fov, this.width / this.height, this._nearZ, this._farZ); 23822 const f = (Math.PI / 2 - this._pitch) * (this.height / this._fov) * this._horizonShift; 23823 h(this._mat4Scratch, this.starsProjMatrix), this._mat4Scratch[8] = 2 * -e1.x / this.width, this._mat4Scratch[9] = 2 * (e1.y + f) / this.height, m(this.skyboxMatrix, this._mat4Scratch, this.skyboxMatrix); 23824 const x = this.point, b = x.x, A = x.y, E = this.width % 2 / 2, I = this.height % 2 / 2, M = Math.cos(this.angle), S = Math.sin(this.angle), R = b - Math.round(b) + M * E + S * I, P = A - Math.round(A) + M * I + S * E; 23825 if (h(this.alignedProjMatrix, u), _(this.alignedProjMatrix, this.alignedProjMatrix, [ 23826 R > .5 ? R - 1 : R, 23827 P > .5 ? P - 1 : P, 23828 0 23829 ]), w(this.labelPlaneMatrix, [ 23830 this.width / 2, 23831 -this.height / 2, 23832 1 23833 ]), _(this.labelPlaneMatrix, this.labelPlaneMatrix, [ 23834 1, 23835 -1, 23836 0 23837 ]), w(this.glCoordMatrix, [ 23838 1, 23839 -1, 23840 1 23841 ]), _(this.glCoordMatrix, this.glCoordMatrix, [ 23842 -1, 23843 -1, 23844 0 23845 ]), g(this.glCoordMatrix, this.glCoordMatrix, [ 23846 2 / this.width, 23847 2 / this.height, 23848 1 23849 ]), m(this.pixelMatrix, this.labelPlaneMatrix, c), this._calcFogMatrices(), this._distanceTileDataCache = {}, !p(this.pixelMatrixInverse, this.pixelMatrix)) throw new Error("failed to invert matrix"); 23850 if ("globe" === this.projection.name || this.mercatorFromTransition) { 23851 this.globeMatrix = function(e1) { 23852 const { x: t1, y: i } = e1.point, { lng: n, lat: r } = e1._center; 23853 return Xf(t1, i, e1.worldSize, n, r); 23854 }(this); 23855 const e1 = [ 23856 this.globeMatrix[12], 23857 this.globeMatrix[13], 23858 this.globeMatrix[14] 23859 ]; 23860 this.globeCenterInViewSpace = Y(e1, e1, a), this.globeRadius = this.worldSize / 2 / Math.PI - 1; 23861 } else this.globeMatrix = this.pixelMatrixInverse; 23862 this._projMatrixCache = {}, this._alignedProjMatrixCache = {}, this._pixelsToTileUnitsCache = {}, this._expandedProjMatrixCache = {}; 23863 } 23864 _calcFogMatrices() { 23865 this._fogTileMatrixCache = {}; 23866 const e1 = this.cameraWorldSizeForFog, t1 = this.cameraPixelsPerMeter, i = this._camera.position, n = 1 / this.height / this._pixelsPerMercatorPixel, r = [ 23867 e1, 23868 e1, 23869 t1 23870 ]; 23871 k(r, r, n), k(i, i, -1), B(i, i, r), b(this.mercatorFogMatrix, i), g(this.mercatorFogMatrix, this.mercatorFogMatrix, r), this.worldToFogMatrix = this._camera.getWorldToCameraPosition(e1, t1, n); 23872 } 23873 _computeCameraPosition(e1) { 23874 const t1 = (e1 = e1 || this.pixelsPerMeter) / this.pixelsPerMeter, i = this._camera.forward(), n = this.point, r = this._mercatorZfromZoom(this._seaLevelZoom ? this._seaLevelZoom : this._zoom) * t1 - e1 / this.worldSize * this._centerAltitude; 23875 return [ 23876 n.x / this.worldSize - i[0] * r, 23877 n.y / this.worldSize - i[1] * r, 23878 e1 / this.worldSize * this._centerAltitude - i[2] * r 23879 ]; 23880 } 23881 _updateCameraState() { 23882 this.height && (this._camera.setPitchBearing(this._pitch, this.angle), this._camera.position = this._computeCameraPosition()); 23883 } 23884 _translateCameraConstrained(e1) { 23885 const t1 = this._maxCameraBoundsDistance() * Math.cos(this._pitch), i = this._camera.position[2], n = e1[2]; 23886 let r = 1; 23887 this.projection.wrap && (this.center = this.center.wrap()), n > 0 && (r = Math.min((t1 - i) / n, 1)), this._camera.position = U([], this._camera.position, e1, r), this._updateStateFromCamera(); 23888 } 23889 _updateStateFromCamera() { 23890 const e1 = this._camera.position, t1 = this._camera.forward(), { pitch: i, bearing: n } = this._camera.getPitchBearing(), r = xc(this._centerAltitude, this.center.lat) * this._pixelsPerMercatorPixel, o = this._mercatorZfromZoom(this._maxZoom) * Math.cos(Je(this._maxPitch)), a = Math.max((e1[2] - r) / Math.cos(i), o), s = this._zoomFromMercatorZ(a); 23891 U(e1, e1, t1, a), this._pitch = it(i, Je(this.minPitch), Je(this.maxPitch)), this.angle = rt(n, -Math.PI, Math.PI), this._setZoom(it(s, this._minZoom, this._maxZoom)), this._updateSeaLevelZoom(), this._center = this.coordinateLocation(new Mc(e1[0], e1[1], e1[2])), this._unmodified = !1, this._constrain(), this._calcMatrices(); 23892 } 23893 _worldSizeFromZoom(e1) { 23894 return Math.pow(2, e1) * this.tileSize; 23895 } 23896 _mercatorZfromZoom(e1) { 23897 return this.cameraToCenterDistance / this._worldSizeFromZoom(e1); 23898 } 23899 _minimumHeightOverTerrain() { 23900 var _this__seaLevelZoom; 23901 const e1 = Math.min((_this__seaLevelZoom = this._seaLevelZoom) !== null && _this__seaLevelZoom !== void 0 ? _this__seaLevelZoom : this._zoom, this._maxZoom) + 4;
23902 return this._mercatorZfromZoom(e1); 23903 } 23904 _zoomFromMercatorZ(e1) { 23905 return this.scaleZoom(this.cameraToCenterDistance / (Math.max(0, e1) * this.tileSize)); 23906 } 23907 zoomFromMercatorZAdjusted(e1) { 23908 let t1 = 0, i = 6, n = 0, r = 1 / 0; 23909 for(; i - t1 > 1e-6 && i > t1;){ 23910 const o = t1 + .5 * (i - t1), a = this.tileSize * Math.pow(2, o), s = this.getCameraToCenterDistance(this.projection, o, a), l = this.scaleZoom(s / (Math.max(0, e1) * this.tileSize)), c = Math.abs(o - l); 23911 c < r && (r = c, n = o), o < l ? t1 = o : i = o; 23912 } 23913 return n; 23914 } 23915 _terrainEnabled() { 23916 return !(!this._elevation || !this.projection.supportsTerrain && (gt("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."), 1)); 23917 } 23918 anyCornerOffEdge(e1, t1) { 23919 const i = Math.min(e1.x, t1.x), n = Math.max(e1.x, t1.x), r = Math.min(e1.y, t1.y), o = Math.max(e1.y, t1.y); 23920 if (r < this.horizonLineFromTop(!1)) return !0; 23921 if ("mercator" !== this.projection.name) return !1; 23922 const a = [ 23923 new Pe(i, r), 23924 new Pe(n, o), 23925 new Pe(i, o), 23926 new Pe(n, r) 23927 ], s = this.renderWorldCopies ? -3 : 0, l = this.renderWorldCopies ? 4 : 1; 23928 for (const e1 of a){ 23929 const t1 = this.pointRayIntersection(e1); 23930 if (t1.t < 0) return !0; 23931 const i = this.rayIntersectionCoordinate(t1); 23932 if (i.x < s || i.y < 0 || i.x > l || i.y > 1) return !0; 23933 } 23934 return !1; 23935 } 23936 isHorizonVisible() { 23937 return this.pitch + Ke(this.fovAboveCenter) > 88 || this.anyCornerOffEdge(new Pe(0, 0), new Pe(this.width, this.height)); 23938 } 23939 zoomDeltaToMovement(e1, t1) { 23940 const i = D(te([], this._camera.position, e1)), n = this._zoomFromMercatorZ(i) + t1; 23941 return i - this._mercatorZfromZoom(n); 23942 } 23943 getCameraPoint() { 23944 if ("globe" === this.projection.name) { 23945 const e1 = function(param, n) { 23946 let [e1, t1, i] = param; 23947 const r = [ 23948 e1, 23949 t1, 23950 i, 23951 1 23952 ]; 23953 le(r, r, n); 23954 const o = r[3] = Math.max(r[3], 1e-6); 23955 return r[0] /= o, r[1] /= o, r[2] /= o, r; 23956 }([ 23957 this.globeMatrix[12], 23958 this.globeMatrix[13], 23959 this.globeMatrix[14] 23960 ], this.pixelMatrix); 23961 return new Pe(e1[0], e1[1]); 23962 } 23963 { 23964 const e1 = Math.tan(this._pitch) * (this.cameraToCenterDistance || 1); 23965 return this.centerPoint.add(new Pe(0, e1)); 23966 } 23967 } 23968 getCameraToCenterDistance(e1) { 23969 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.zoom, i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.worldSize; 23970 const n = ty(e1, t1, this.width, this.height, 1024), r = e1.pixelSpaceConversion(this.center.lat, i, n); 23971 let o = .5 / Math.tan(.5 * this._fov) * this.height * r; 23972 return this.isOrthographic && (o = fn(1, o, Pt(this.pitch >= xw ? 1 : this.pitch / xw))), o; 23973 } 23974 getWorldToCameraMatrix() { 23975 const e1 = this._camera.getWorldToCamera(this.worldSize, "meters" === this.projection.zAxisUnit ? this.pixelsPerMeter : 1); 23976 return "globe" === this.projection.name && m(e1, e1, this.globeMatrix), e1; 23977 } 23978 getFrustum(e1) { 23979 return zf.fromInvProjectionMatrix(this.invProjMatrix, this.worldSize, e1, "meters" === this.projection.zAxisUnit); 23980 } 23981 constructor(e1, t1, i, n, r, o, a){ 23982 this.tileSize = 512, this._renderWorldCopies = void 0 === r || r, this._minZoom = e1 || 0, this._maxZoom = t1 || 22, this._minPitch = i !== null && i !== void 0 ? i : 0, this._maxPitch = n !== null && n !== void 0 ? n : 60, this.setProjection(o), this.setMaxBounds(a), this.width = 0, this.height = 0, this._center = new _c(0, 0), this.zoom = 0, this.angle = 0, this._fov = .6435011087932844, this._pitch = 0, this._nearZ = 0, this._farZ = 0, this._nearClipOffset = 0, this._unmodified = !0, this._edgeInsets = new Qb, this._projMatrixCache = {}, this._alignedProjMatrixCache = {}, this._fogTileMatrixCache = {}, this._expandedProjMatrixCache = {}, this._distanceTileDataCache = {}, this._camera = new rw, this._centerAltitude = 0, this._averageElevation = 0, this.cameraElevationReference = "ground", this._pixelsPerMercatorPixel = 1, this.globeRadius = 0, this.globeCenterInViewSpace = [ 23983 0, 23984 0, 23985 0 23986 ], this._tileCoverLift = 0, this.freezeTileCoverage = !1, this._horizonShift = .1, this._orthographicProjectionAtLowPitch = !1, this._allowWorldUnderZoom = !1, this.mercatorMatrix = new Float64Array(16), this.mercatorFogMatrix = new Float32Array(16), this.invProjMatrix = new Float64Array(16), this._expandedFarZProjMatrixBuf = new Float64Array(16), this.expandedFarZProjMatrix = this._expandedFarZProjMatrixBuf, this.starsProjMatrix = new Float32Array(16), this.skyboxMatrix = new Float32Array(16), this._mat4Scratch = new Float64Array(16), this.alignedProjMatrix = new Float64Array(16), this.labelPlaneMatr
vendor: 22,838 bytes, lines 23986-24362
23986ix = new Float32Array(16), this.glCoordMatrix = new Float32Array(16), this.pixelMatrix = new Float64Array(16), this.pixelMatrixInverse = new Float64Array(16); 23987 } 23988 } 23989 const bw = (e1, t1)=>{ 23990 if (t1 <= 0 || e1.terrain) return { 23991 shouldRenderCutoff: !1, 23992 uniformValues: { 23993 u_cutoff_params: [ 23994 0, 23995 0, 23996 0, 23997 1 23998 ] 23999 } 24000 }; 24001 const i = e1.transform, n = i.pitch, r = i.isLODDisabled(!1) ? 60 : 30; 24002 if (n < r - 15) return { 24003 shouldRenderCutoff: !1, 24004 uniformValues: { 24005 u_cutoff_params: [ 24006 0, 24007 0, 24008 0, 24009 1 24010 ] 24011 } 24012 }; 24013 const o = i._farZ - i._nearZ, a = t1 * i.height * 1.3, s = Math.pow(2, .85 * Math.max(i._zoom - e1.minCutoffZoom, 0)), l = 1.4 * i.cameraToCenterDistance * s, c = nt(r - 15, r, n), u = fn(i._farZ + a, l, c), h = Math.min(a, u - i._nearZ); 24014 return { 24015 shouldRenderCutoff: c > 0, 24016 uniformValues: { 24017 u_cutoff_params: [ 24018 i._nearZ, 24019 i._farZ, 24020 (u - i._nearZ) / o, 24021 (u - h - i._nearZ) / o 24022 ] 24023 } 24024 }; 24025 }, ww = .05; 24026 function Aw(e1, t1, i) { 24027 const n = nt(45, 65, i), [r, o] = e1.range; 24028 let a = 1 - Math.min(1, Math.exp((t1 - r) / (o - r) * -6)); 24029 return a *= a * a, a = Math.min(1, 1.00747 * a), a * n * e1.alpha; 24030 } 24031 function Ew(e1, t1, i, n, r) { 24032 return Aw(e1, D(Y([], [ 24033 t1, 24034 i, 24035 n 24036 ], r.mercatorFogMatrix)), r.pitch); 24037 } 24038 function Iw(e1, t1, i, n) { 24039 const r = 1 << e1.z; 24040 t1.lat = mr((n / zr + e1.y) / r), t1.lng = pr((i / zr + e1.x) / r); 24041 } 24042 const Mw = function(e1, t1) { 24043 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; 24044 return { 24045 u_matrix: e1, 24046 u_color: t1, 24047 u_overlay: 0, 24048 u_overlay_scale: i 24049 }; 24050 }, Tw = new Float64Array(16), Sw = new Float64Array(16), zw = new Float64Array(16), Rw = new Float64Array(16), Pw = new Float64Array(16), Dw = new Float64Array(16), Fw = new Float64Array(16), Cw = [ 24051 0, 24052 0, 24053 0 24054 ], Lw = new Float32Array(16), Ow = [ 24055 0, 24056 0, 24057 0 24058 ], Bw = [ 24059 0, 24060 0, 24061 0 24062 ], Vw = []; 24063 function Nw(e1, t1, i) { 24064 const n = i.cameraWorldSizeForFog / i.worldSize; 24065 return g(e1, i.worldToFogMatrix, [ 24066 n, 24067 n, 24068 1 24069 ]), m(e1, e1, t1), e1; 24070 } 24071 function kw(e1, t1, i, n) { 24072 return _(e1, t1, i), ee(n, hy) || g(e1, e1, n), e1; 24073 } 24074 function Uw(e1, t1, i, n, r) { 24075 const o = i.material, a = n.context, { baseColorTexture: s, metallicRoughnessTexture: l } = o.pbrMetallicRoughness, { normalTexture: c, occlusionTexture: u, emissionTexture: h } = o; 24076 function d(t1, i, n) { 24077 if (t1 && (e1.push(i), a.activeTexture.set(a.gl.TEXTURE0 + n), t1.gfxTexture)) { 24078 const { minFilter: e1, magFilter: i, wrapS: n, wrapT: r } = t1.sampler; 24079 t1.gfxTexture.bindExtraParam(e1, i, n, r); 24080 } 24081 } 24082 d(s, "HAS_TEXTURE_u_baseColorTexture", Nb.BaseColor), d(l, "HAS_TEXTURE_u_metallicRoughnessTexture", Nb.MetallicRoughness), d(c, "HAS_TEXTURE_u_normalTexture", Nb.Normal), d(u, "HAS_TEXTURE_u_occlusionTexture", Nb.Occlusion), d(h, "HAS_TEXTURE_u_emissionTexture", Nb.Emission), r && (r.texture || (r.texture = new _m(n.context, r.image, [ 24083 r.image.height, 24084 r.image.height, 24085 r.image.height 24086 ], a.gl.RGBA8)), a.activeTexture.set(a.gl.TEXTURE0 + Nb.LUT), r.texture && r.texture.bind(a.gl.LINEAR, a.gl.CLAMP_TO_EDGE), e1.push("APPLY_LUT_ON_GPU")), i.texcoordBuffer && (e1.push("HAS_ATTRIBUTE_a_uv_2f"), t1.push(i.texcoordBuffer)), i.colorBuffer && (e1.push(12 === i.colorBuffer.itemSize ? "HAS_ATTRIBUTE_a_color_3f" : "HAS_ATTRIBUTE_a_color_4f"), t1.push(i.colorBuffer)), i.normalBuffer && (e1.push("HAS_ATTRIBUTE_a_normal_3f"), t1.push(i.normalBuffer)), i.pbrBuffer && (e1.push("HAS_ATTRIBUTE_a_pbr"), e1.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"), t1.push(i.pbrBuffer)), "OPAQUE" !== o.alphaMode && "MASK" !== o.alphaMode || e1.push("UNPREMULT_TEXTURE_IN_SHADER"), o.defined || e1.push("DIFFUSE_SHADED"); 24087 const f = n.shadowRenderer; 24088 f && (e1.push("RENDER_SHADOWS"), f.useNormalOffset && e1.push("NORMAL_OFFSET")); 24089 } 24090 function jw(e1, t1, i, n, r, o) { 24091 const a = e1.modelOpacity, s = t1.context, l = new Xb(t1.context.gl.LEQUAL, e1.isLightMesh ? Xb.ReadOnly : Xb.ReadWrite, t1.depthRangeFor3D), c = t1.transform, u = e1.mesh, h = u.material, d = h.pbrMetallicRoughness, _ = t1.style.fog; 24092 "pixels" === t1.transform.projection.zAxisUnit ? Tw.set(e1.nodeModelMatrix) : m(Tw, n.zScaleMatrix, e1.nodeModelMatrix), m(Tw, n.negCameraPosMatrix, Tw), p(Sw, Tw), f(Sw, Sw); 24093 const g = "none" === i.paint.get("model-color-use-theme").constantOr("default"), y = i.paint.get("model-emissive-strength").constantOr(0), x = { 24094 defines: [] 24095 }, v = [], b = t1.shadowRenderer; 24096 b && (b.useNormalOffset = !1), Uw(x.defines, v, u, t1, g ? null : i.lut); 24097 let w = null; 24098 if (_ && (w = Nw(zw, e1.nodeModelMatrix, t1.transform), "globe" !== c.projection.name)) { 24099 const e1 = u.aabb.min, t1 = u.aabb.max, [i, n] = _.getOpacityForBounds(w, e1[0], e1[1], t1[0], t1[1]); 24100 x.overrideFog = i >= ww || n >= ww; 24101 } 24102 const A = bw(t1, i.paint.get("model-cutoff-fade-range")); 24103 A.shouldRenderCutoff && x.defines.push("RENDER_CUTOFF"); 24104 const E = t1.getOrCreateProgram("model", x), I = jb(e1.worldViewProjection, Tw, Sw, null, t1, a, d.baseColorFactor, h.emissiveFactor, d.metallicFactor, d.roughnessFactor, h, y, i, void 0, void 0, e1.materialOverride, e1.modelColor, 1, E.fixedDefines.includes("LIGHTING_3D_MODE")); 24105 t1.uploadCommonUniforms(s, E, null, w, A, e1.lightOverrides), "shadow" !== t1.renderPass && b && b.setupShadowsFromMatrix(e1.nodeModelMatrix, E), E.draw(t1, s.gl.TRIANGLES, l, r, o, u.material.doubleSided ? Kb.disabled : Kb.backCCW, I, i.id, u.vertexBuffer, u.indexBuffer, u.segments, i.paint, t1.transform.zoom, void 0, v); 24106 } 24107 function Gw(e1, t1) { 24108 return e1.style._importedAsBasemap ? "basemap" : t1.scope; 24109 } 24110 function Hw(e1, t1, i, n, r, o, a, s, l, c, u) { 24111 const h = e1.transform, d = !!t1.isGeometryBloom && t1.isGeometryBloom; 24112 if (void 0 !== t1.minZoom && e1.transform.zoom < t1.minZoom) return; 24113 if (void 0 !== t1.maxZoom && e1.transform.zoom > t1.maxZoom) return; 24114 if (d && "shadow" === e1.renderPass) return; 24115 const f = "globe" === h.projection.name ? ly(i, h) : [ 24116 ...i 24117 ]; 24118 m(f, f, t1.globalMatrix); 24119 const p = m([], n, f); 24120 if (t1.meshes) for (const e1 of t1.meshes){ 24121 const n = s.get(e1.material.name); 24122 if (n && n.opacity <= 0) continue; 24123 if ("BLEND" !== e1.material.alphaMode) { 24124 a.push({ 24125 mesh: e1, 24126 depth: 0, 24127 modelIndex: r, 24128 worldViewProjection: p, 24129 nodeModelMatrix: f, 24130 isLightMesh: d, 24131 materialOverride: n, 24132 modelOpacity: l, 24133 modelColor: c, 24134 lightOverrides: u, 24135 node: t1, 24136 modelMatrix: i 24137 }); 24138 continue; 24139 } 24140 const m = Y([], e1.centroid, p); 24141 !h.isOrthographic && m[2] <= 0 || o.push({ 24142 mesh: e1, 24143 depth: m[2], 24144 modelIndex: r, 24145 worldViewProjection: p, 24146 nodeModelMatrix: f, 24147 isLightMesh: d, 24148 materialOverride: n, 24149 modelOpacity: l, 24150 modelColor: c, 24151 lightOverrides: u, 24152 node: t1, 24153 modelMatrix: i 24154 }); 24155 } 24156 if (t1.children) for (const h of t1.children)Hw(e1, h, i, n, r, o, a, s, l, c, u); 24157 } 24158 function $w(e1, t1, i, n, r) { 24159 const o = i.shadowRenderer; 24160 if (!o) return; 24161 const a = o.getShadowPassDepthMode(), s = r || o.calculateShadowPassMatrixFromMatrix(t1), l = Gb(s); 24162 i.getOrCreateProgram("modelDepth").draw(i, i.context.gl.TRIANGLES, a, $b.disabled, qb.disabled, Kb.disabled, l, n.id, e1.vertexBuffer, e1.indexBuffer, e1.segments, n.paint, i.transform.zoom, void 0, void 0); 24163 } 24164 function Zw(e1, t1, i, n) { 24165 const r = function(e1, t1) { 24166 if (t1.footprintDebugMesh) return t1.footprintDebugMesh; 24167 if (!t1.footprint) return null; 24168 const i = e1.context, n = t1.footprint.vertices, r = t1.footprint.indices, o = new jc; 24169 o.reserve(n.length); 24170 for (const e1 of n)o.emplaceBack(e1.x, e1.y); 24171 const a = new uu; 24172 a.reserve(r.length); 24173 for(let e1 = 0; e1 < r.length; e1 += 3)a.emplaceBack(r[e1], r[e1 + 1], r[e1 + 2]); 24174 const s = i.createVertexBuffer(o, vf.members), l = i.createIndexBuffer(a), c = ju.simpleSegment(0, 0, n.length, r.length), u = t1.id || t1.name || "footprint"; 24175 let h; 24176 const d = parseInt(u, 10); 24177 h = isNaN(d) ? function(e1) { 24178 let t1 = 0; 24179 for(let i = 0; i < e1.length; i++)t1 = (t1 << 5) - t1 + e1.charCodeAt(i) | 0; 24180 return t1; 24181 }(u) : d; 24182 const f = Dt(h), p = Dt(h + 1), m = Dt(h + 2); 24183 return t1.footprintDebugMesh = { 24184 vertexBuffer: s, 24185 indexBuffer: l, 24186 segments: c, 24187 color: new mn(f, p, m, .5) 24188 }, t1.footprintDebugMesh; 24189 }(e1, i); 24190 if (!r) return; 24191 const o = e1.context, a = o.gl, s = e1.getOrCreateProgram("debug"), l = r.color, c = Xb.disabled; 24192 o.activeTexture.set(a.TEXTURE0), e1.emptyTexture.bind(a.LINEAR, a.CLAMP_TO_EDGE), s.draw(e1, a.TRIANGLES, c, $b.disabled, qb.alphaBlended, Kb.disabled, Mw(n, l.toPremultipliedRenderColor(null)), "$debug", r.vertexBuffer, r.indexBuffer, r.segments); 24193 } 24194 function Ww(e1, t1, i, n, r, o) { 24195 for (const a of r){ 24196 const r = { 24197 ...n 24198 }; 24199 r.part = a; 24200 const s = { 24201 type: "Unknown", 24202 id: t1, 24203 properties: r 24204 }, l = { 24205 orientation: e1.paint.get("model-rotation").evaluate(s, i) 24206 }; 24207 o.set(a, l); 24208 } 24209 } 24210 function qw(e1, t1, i, n, r, o) { 24211 for (const a of r){ 24212 const r = { 24213 ...n 24214 }; 24215 r.part = a; 24216 const s = { 24217 type: "Unknown", 24218 id: t1, 24219 properties: r 24220 }, l = { 24221 color: e1.paint.get("model-color").evaluate(s, i), 24222 colorMix: e1.paint.get("model-color-mix-intensity").evaluate(s, i), 24223 opacity: e1.paint.get("model-opacity").evaluate(s, i), 24224 emissionStrength: e1.paint.get("model-emissive-strength").evaluate(s, i) 24225 }; 24226 o.set(a, l); 24227 } 24228 } 24229 function Xw(e1, t1, i, n, r) { 24230 let o = !1; 24231 for (const i of n)1 !== i.modelOpacity && (jw(i, e1, t1, r[i.modelIndex], $b.disabled, qb.disabled), o = !0); 24232 for (const i of n)jw(i, e1, t1, r[i.modelIndex], 1 !== i.modelOpacity ? e1.stencilModeFor3D() : $b.disabled, e1.colorModeForRenderPass()); 24233 o && e1.resetStencilClippingMasks(); 24234 const a = qb.additive; 24235 for (const n of i)jw(n, e1, t1, r[n.modelIndex], $b.disabled, n.isLightMesh ? a : e1.colorModeForRenderPass()); 24236 } 24237 function Yw(e1, t1, i) { 24238 const n = t1.updateZoomBasedPaintProperties(), r = function(e1, t1, i) { 24239 let n, r, o, a = e1.terrain ? e1.terrain.exaggeration() : 0; 24240 if (e1.terrain && a > 0) { 24241 const t1 = e1.terrain, r = t1.findDEMTileFor(i); 24242 r && r.dem ? n = bb.create(t1, i, r) : a = 0; 24243 } 24244 if (0 === a && (t1.terrainElevationMin = 0, t1.terrainElevationMax = 0), a === t1.validForExaggeration && (0 === a || n && n._demTile && n._demTile.tileID === t1.validForDEMTile.id && n._dem._timestamp === t1.validForDEMTile.timestamp)) return !1; 24245 for(const e1 in t1.instancesPerModel){ 24246 const i = t1.instancesPerModel[e1]; 24247 for(let e1 = 0; e1 < i.instancedDataArray.length; ++e1){ 24248 const s = (n ? a * n.getElevationAt(0 | i.instancedDataArray.float32[16 * e1], 0 | i.instancedDataArray.float32[16 * e1 + 1], !0, !0) : 0) + i.instancesEvaluatedElevation[e1]; 24249 i.instancedDataArray.float32[16 * e1 + 6] = s, r = r ? Math.min(t1.terrainElevationMin, s) : s, o = o ? Math.max(t1.terrainElevationMax, s) : s; 24250 } 24251 } 24252 return t1.terrainElevationMin = r || 0, t1.terrainElevationMax = o || 0, t1.validForExaggeration = a, t1.validForDEMTile = n && n._demTile ? { 24253 id: n._demTile.tileID, 24254 timestamp: n._dem._timestamp 24255 } : { 24256 id: void 0, 24257 timestamp: 0 24258 }, !0; 24259 }(e1, t1, i); 24260 (n || r) && (t1.uploaded = !1, t1.upload(e1.context)); 24261 } 24262 const Jw = { 24263 shadowUniformsInitialized: !1, 24264 useSingleShadowCascade: !1, 24265 tileMatrix: new Float64Array(16), 24266 shadowTileMatrix: new Float32Array(16), 24267 aabb: new Rf([ 24268 0, 24269 0, 24270 0 24271 ], [ 24272 zr, 24273 zr, 24274 0 24275 ]) 24276 }; 24277 function Kw(e1, t1) { 24278 const i = 1 << e1.canonical.z, n = t1.getFreeCameraOptions().position, r = t1.elevation, o = e1.canonical.x / i, a = (e1.canonical.x + 1) / i, s = e1.canonical.y / i, l = (e1.canonical.y + 1) / i; 24279 let c = t1._centerAltitude; 24280 if (r) { 24281 const t1 = r.getMinMaxForTile(e1); 24282 t1 && t1.max > c && (c = t1.max); 24283 } 24284 const u = it(n.x, o, a) - n.x, h = it(n.y, s, l) - n.y, d = xc(c, t1.center.lat) - n.z; 24285 return t1._zoomFromMercatorZ(Math.sqrt(u * u + h * h + d * d)); 24286 } 24287 function Qw(e1, t1, i, n, r, o, a) { 24288 const s = e1.context, l = "shadow" === e1.renderPass, c = e1.shadowRenderer, u = l && c ? c.getShadowPassDepthMode() : new Xb(s.gl.LEQUAL, Xb.ReadWrite, e1.depthRangeFor3D), h = e1.isTileAffectedByFog(o), d = "globe" === e1.transform.projection.name; 24289 if (i.meshes) for (const f of i.meshes){ 24290 const p = d ? [] : [ 24291 "MODEL_POSITION_ON_GPU" 24292 ], m = []; 24293 let _, g, y; 24294 const x = !d && n.instancedDataArray.length > 20; 24295 x && p.push("INSTANCED_ARRAYS"); 24296 const v = bw(e1, t1.paint.get("model-cutoff-fade-range")); 24297 if (v.shouldRenderCutoff && p.push("RENDER_CUTOFF"), l && c) _ = e1.getOrCreateProgram("modelDepth", { 24298 defines: p 24299 }), g = Gb(a.shadowTileMatrix, a.shadowTileMatrix, i.globalMatrix), y = qb.disabled; 24300 else { 24301 Uw(p, m, f, e1, "none" === t1.paint.get("model-color-use-theme").constantOr("default") ? null : t1.lut), _ = e1.getOrCreateProgram("model", { 24302 defines: p, 24303 overrideFog: h 24304 }); 24305 const n = f.material, l = n.pbrMetallicRoughness, u = t1.paint.get("model-opacity").constantOr(1), d = t1.paint.get("model-emissive-strength").constantOr(0); 24306 g = jb(o.expandedProjMatrix, i.globalMatrix, Lw, null, e1, u, l.baseColorFactor, n.emissiveFactor, l.metallicFactor, l.roughnessFactor, n, d, t1, r, void 0, void 0, void 0, 1, _.fixedDefines.includes("LIGHTING_3D_MODE")), c && (a.shadowUniformsInitialized ? _.setShadowUniformValues(s, c.getShadowUniformValues()) : (c.setupShadows(o.toUnwrapped(), _, "model-tile"), a.shadowUniformsInitialized = !0)), y = v.shouldRenderCutoff || u < 1 || "OPAQUE" !== n.alphaMode ? qb.alphaBlended : qb.unblended; 24307 } 24308 e1.uploadCommonUniforms(s, _, o.toUnwrapped(), null, v); 24309 const b = f.material.doubleSided ? Kb.disabled : Kb.backCCW; 24310 if (x) m.push(n.instancedDataBuffer), _.draw(e1, s.gl.TRIANGLES, u, $b.disabled, y, b, g, t1.id, f.vertexBuffer, f.indexBuffer, f.segments, t1.paint, e1.transform.zoom, void 0, m, n.instancedDataArray.length); 24311 else { 24312 const i = l ? "u_instance" : "u_normal_matrix"; 24313 for(let r = 0; r < n.instancedDataArray.length; ++r)g[i] = new Float32Array(n.instancedDataArray.arrayBuffer, 64 * r, 16), _.draw(e1, s.gl.TRIANGLES, u, $b.disabled, y, b, g, t1.id, f.vertexBuffer, f.indexBuffer, f.segments, t1.paint, e1.transform.zoom, void 0, m); 24314 } 24315 } 24316 if (i.children) for (const s of i.children)Qw(e1, t1, s, n, r, o, a); 24317 } 24318 function eA(e1, t1, i, n, r) { 24319 const o = e1.node; 24320 if (o.lodMeshes && o.lodMeshes.length > 0) if (e1.targetLod < 0) e1.targetLod = t1 > n ? 1 : 0; 24321 else { 24322 const o = r > 0 ? i / 1e3 / r : 1; 24323 e1.targetLod = it(t1 > n ? e1.targetLod + o : e1.targetLod - o, 0, 1); 24324 } 24325 else e1.targetLod = 0; 24326 } 24327 function tA(e1, t1, i, n) { 24328 if (!i.modelManager) return !0; 24329 const r = i.modelManager; 24330 if (!i.shadowRenderer) return !0; 24331 const o = i.shadowRenderer, a = t1.aabb; 24332 let s = !0, l = e1.maxHeight; 24333 if (0 === l) { 24334 let t1 = 0; 24335 for(const i in e1.instancesPerModel){ 24336 const e1 = r.getModel(i, n); 24337 e1 ? t1 = Math.max(t1, Math.max(Math.max(e1.aabb.max[0], e1.aabb.max[1]), e1.aabb.max[2])) : s = !1; 24338 } 24339 l = e1.maxScale * t1 * 1.41 + e1.maxVerticalOffset, s && (e1.maxHeight = l); 24340 } 24341 a.max[2] = l, a.min[2] += e1.terrainElevationMin, a.max[2] += e1.terrainElevationMax, Y(a.min, a.min, t1.tileMatrix), Y(a.max, a.max, t1.tileMatrix); 24342 const c = a.intersects(o.getCurrentCascadeFrustum()); 24343 return 0 === i.currentShadowCascade && (e1.isInsideFirstShadowMapFrustum = 2 === c), 0 === c; 24344 } 24345 function iA(e1, t1) { 24346 const i = e1.uniformValues.u_cutoff_params[0], n = e1.uniformValues.u_cutoff_params[1], r = e1.uniformValues.u_cutoff_params[2], o = e1.uniformValues.u_cutoff_params[3]; 24347 return n === i || o === r ? 1 : it(((t1 - i) / (n - i) - r) / (o - r), 0, 1); 24348 } 24349 function nA(e1, t1, i, n) { 24350 if (t1.pitch < 20) return 1; 24351 const r = t1.getWorldToCameraMatrix(); 24352 m(r, r, e1); 24353 const o = oe(i.min[0], i.min[1], i.min[2], 1); 24354 let a = le(re(), o, r), s = a, l = a; 24355 o[1] = i.max[1], a = le(re(), o, r), s = a[1] < s[1] ? a : s, l = a[1] > l[1] ? a : l, o[0] = i.max[0], a = le(re(), o, r), s = a[1] < s[1] ? a : s, l = a[1] > l[1] ? a : l, o[1] = i.min[1], a = le(re(), o, r), s = a[1] < s[1] ? a : s, l = a[1] > l[1] ? a : l; 24356 const c = it(n[0], 0, 1), u = 100 * t1.pixelsPerMeter * it(n[1], 0, 1), h = it(n[2], 0, 1), d = (_ = re(), b = (g = s)[1], w = g[2], A = g[3], _[0] = (v = g[0]) + (x = c) * ((y = l)[0] - v), _[1] = b + x * (y[1] - b), _[2] = w + x * (y[2] - w), _[3] = A + x * (y[3] - A), _), f = Math.tan(.5 * t1.fovX), p = -d[2] * f; 24357 var _, g, y, x, v, b, w, A; 24358 if (0 === u) return d[1] < -Math.abs(p) ? h : 1; 24359 const E = it(fn(1, h, (-Math.abs(p) - d[1]) / u), h, 1); 24360 return fn(1, E, it((t1.pitch - 20) / 20, 0, 1)); 24361 } 24362 var rA = "\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif", oA = "\n#define FLIP_VIEWPORT_UV_Y(uv)\n#ifdef DUAL_SOURCE_BLENDING\nlayout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;\n#elif defined(FLOAT_RENDER_TARGET)\nlayout(location=0) out highp vec4 glFragColor;\n#else\nlayout(location=0) out vec4 glFragColor;\n#endif\n#ifdef USE_MRT1\nlayout(location=1) out vec4 out_Target1;\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}const float DITHER_THRESHOLDS[16]=float[16](\n1.0/17.0, 9.0/17.0, 3.0/17.0,11.0/17.0,13.0/17.0, 5.0/17.0,15.0/17.0, 7.0/17.0,4.0/17.0,12.0/17.0, 2.0/17.0,10.0/17.0,16.0
24362/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0\n);int viewport_dither_index(vec2 fragCoordXY) {return (int(fragCoordXY.x) % 4)*4+(int(fragCoordXY.y) % 4);}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 premultiplyColor(vec3 nonPremultipliedColor,float a) {return vec4(nonPremultipliedColor*a,a);}vec3 unpremultiplyColor(vec4 premultipliedColor) {if (premultipliedColor.a > 0.0) {return premultipliedColor.rgb/premultipliedColor.a;}return premultipliedColor.rgb;}vec3 applyLUT(highp sampler3D lut,vec3 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return texture(lut,uvw).rgb;}vec4 applyLUT(highp sampler3D lut,vec4 premultipliedColor) {return premultiplyColor(applyLUT(lut,unpremultiplyColor(premultipliedColor)),premultipliedColor.a);}", aA = "\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt)\n{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib\n#define DECLARE_MATERIAL_TABLE_INFO\n", sA = "in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
24362void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}", lA = "\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;\n#endif\nvec3 elevationVector(vec2 pos) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;\n#else\nreturn vec3(0,0,1);\n#endif\n}\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#endif\nfloat elevation(vec2 apos) {\n#ifdef TERRAIN\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);\n#else\nreturn currentElevation(apos);\n#endif\n#else\nreturn 0.0;\n#endif\n}\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
24362size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif", cA = "#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif", uA = "#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;FLIP_VIEWPORT_UV_Y(uv);highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
24362vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif", hA = "\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif", dA = "#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}
24362vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif", fA = "#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif", pA = "#ifdef RENDER_SHADOWS\nprecision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp vec2 shadow_map_ndc_to_uv(highp vec2 ndc_xy) {return ndc_xy*0.5+0.5;}highp vec3 shadow_map_ndc_to_sample_space(highp vec3 ndc) {return vec3(shadow_map_ndc_to_uv(ndc.xy),ndc.z*0.5+0.5);}float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) {highp vec3 coord=vec3(shadow_map_ndc_to_uv(pos.xy),pos.z*0.5+0.5-bias);return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;\n#ifdef SHADOWS_SINGLE_CASCADE\nvec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);\n#else\nlight_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)\n{highp vec2 biasUV=vec2(\npos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=shadow_map_ndc_to_sample_space(light_view_pos0.xyz/light_view_pos0.w);highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif"; 24363 const mA = /^#include\s+"([^"]+)"\s*\r?\n/gm, _A = /#pragma mapbox: ([\
vendor: 5,319 bytes, lines 24363-24405
24363w\-]+) ([\w]+) ([\w]+) ([\w]+)/g, gA = /\b[A-Za-z_][A-Za-z0-9_]*\b/g, yA = new Set([ 24364 "ifdef", 24365 "ifndef", 24366 "elif", 24367 "if", 24368 "defined" 24369 ]), xA = new Set; 24370 zA(rA, xA), zA(aA, xA), zA(oA, xA); 24371 const vA = { 24372 "_prelude_fog.vertex.glsl": cA, 24373 "_prelude_terrain.vertex.glsl": lA, 24374 "_prelude_shadow.vertex.glsl": fA, 24375 "_prelude_material_table.vertex.glsl": "", 24376 "_prelude_fog.fragment.glsl": uA, 24377 "_prelude_shadow.fragment.glsl": pA, 24378 "_prelude_lighting.glsl": hA, 24379 "_prelude_raster_array.glsl": dA, 24380 "_prelude_indicator_cutout.fragment.glsl": "\nvec4 applyCutout(vec4 color,float height) {return color;}", 24381 "_prelude_feature_cutout.fragment.glsl": "// feature cutout (gl-native only)\n", 24382 "_prelude_feature_cutout.vertex.glsl": "// feature cutout (gl-native only)\n" 24383 }, bA = {}, wA = "precision highp float;", AA = "precision mediump float;", EA = "\n#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)\n#extension GL_EXT_blend_func_extended : require\n#endif", IA = { 24384 preludeTerrain: PA("", lA), 24385 preludeFog: PA(uA, cA), 24386 preludeShadow: PA(pA, fA), 24387 preludeRasterArray: PA(dA, ""), 24388 preludeLighting: PA(hA, hA), 24389 preludePrecisionQualifiers: PA(AA, wA), 24390 prelude: PA(oA, aA), 24391 preludeExtensions: PA(EA, "") 24392 }, MA = [ 24393 EA, 24394 AA, 24395 rA, 24396 IA.prelude.fragmentSource 24397 ].join("\n"), TA = [ 24398 wA, 24399 rA, 24400 IA.prelude.vertexSource 24401 ].join("\n"); 24402 var SA = { 24403 background: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'), 24404 backgroundPattern: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in ivec2 a_pos;out highp vec2 v_pos;void main() {vec2 pos=vec2(a_pos);gl_Position=u_matrix*vec4(pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,pos);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'), 24405 circle: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);
24405float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? \nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\n#ifdef ELEVATED_ROADS\nin float a_circle_z_offset;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1.0,-1.0),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1.0,-1.0),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1.0,1.0),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1.0,1.0),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 pos2=vec2(a_pos);vec2 extrude=vec2(mod(pos2,2.0)*2.0-1.0);vec2 circle_center=floor(pos2*0.5);float height=circle_elevation(circle_center);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nsurface_vectors=globe_mercator_surface_vectors(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*height;vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*height;vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
24405\n#else \nsurface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1);\n#endif\n#ifdef ELEVATED_ROADS\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'), 24406 clippingMask: PA("void main() {glFragColor=vec4(1.0);}", "in ivec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), 24407 heatmap: PA('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_intensity;in ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(vec2(a_pos),2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(vec2(a_pos)*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=vec3(a_pos_normal_3)/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'), 24408 heatmapTexture: PA("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);
24408\n#endif\nHANDLE_WIREFRAME_DEBUG;}", "in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"), 24409 collisionBox: PA("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}", '#include "_prelude_terrain.vertex.glsl"\nin ivec4 a_pos;in ivec2 a_anchor_pos;in ivec2 a_extrude;in uvec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;\n#endif\nout float v_placed;out float v_notUsed;void main() {vec2 anchor_pos=vec2(a_anchor_pos);float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(anchor_pos));vec3 proj_pos=vec3(a_pos)+elevationVector(anchor_pos)*(feature_elevation+terrain_elevation);\n#ifdef PROJECTION_GLOBE_VIEW\n#ifndef PROJECTED_POS_ON_VIEWPORT\nvec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);\n#endif\n#endif\nvec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(vec2(a_extrude)*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=float(a_placed.x);v_notUsed=float(a_placed.y);}'), 24410 collisionCircle: PA("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}", "in vec2 a_pos_2f;in float a_radius;in ivec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;int vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2)),mix(-1.0,1.0,float(vertexIdx >=1 && vertexIdx <=2)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=float(a_flags.x);gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"), 24411 debug: PA("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}", '#include "_prelude_terrain.vertex.glsl"\nin ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {vec2 pos=vec2(a_pos);float h=elevation(pos);v_uv=pos/8192.0;
24411\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1);\n#endif\n}'), 24412 fill: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec2 cutout_factors=vec2(0.0);vec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(opacity*u_opacity_multiplier);glFragColor=out_color;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'), 24413 fillOutline: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;vec2 cutout_factors=vec2(0.0);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity*u_opacity_multiplier);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
24413\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'), 24414 fillOutlinePattern: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nuniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity*u_opacity_multiplier);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
24414\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'), 24415 fillPattern: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(opacity*u_opacity_multiplier);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
24415\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'), 24416 lineBlendComposite: PA("uniform highp sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;uniform highp float u_max_density;in vec2 v_pos;\n#define ADDITIVE 1\nvoid main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}highp float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);highp float n=density/max(u_max_density,0.001);highp float t=sqrt(n/(n+1.0));glFragColor=vec4(avgColor*t,t);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);}\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}", "in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"), 24417 lineBlendReduce: PA("uniform highp sampler2D u_image;uniform vec2 u_texel_size;uniform bool u_first_pass;in vec2 v_pos;void main() {vec2 o=u_texel_size*0.5;vec4 s0=texture(u_image,v_pos+vec2(-o.x,-o.y));vec4 s1=texture(u_image,v_pos+vec2( o.x,-o.y));vec4 s2=texture(u_image,v_pos+vec2(-o.x, o.y));vec4 s3=texture(u_image,v_pos+vec2( o.x, o.y));float r0; float g0;float r1; float g1;float r2; float g2;float r3; float g3;if (u_first_pass) {float a0=s0.a;float a1=s1.a;float a2=s2.a;float a3=s3.a;r0=a0; g0=a0 > 0.0 ? 1.0 : 0.0;r1=a1; g1=a1 > 0.0 ? 1.0 : 0.0;r2=a2; g2=a2 > 0.0 ? 1.0 : 0.0;r3=a3; g3=a3 > 0.0 ? 1.0 : 0.0;} else {r0=s0.r; g0=s0.g;r1=s1.r; g1=s1.g;r2=s2.r; g2=s2.g;r3=s3.r; g3=s3.g;}glFragColor=vec4((r0+r1+r2+r3)*0.25,(g0+g1+g2+g3)*0.25,0.0,0.0);}", "in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"), 24418 fillExtrusion: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nin vec4 v_color;in vec4 v_flat;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nin float v_dither_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radiu
24418s;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nif (v_dither_opacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (v_dither_opacity < DITHER_THRESHOLDS[index]) {discard;}}\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}',
vendor: 9,538 bytes, line 24418
24418'#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\n#include "_prelude_feature_cutout.vertex.glsl"\nuniform mat4 u_matrix;\n#ifndef LIGHTING_3D_MODE\nuniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;\n#endif\nuniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;\n#endif\nout float v_dither_opacity;\n#endif\nout vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny_start.y==0.0 && top_up_ny_start.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny_start.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && (int(centroid_pos.y) & 7)==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;\n#else\nh=t > 0.0 ? height : base;\n#endif\npos=vec3(pos_nx.xy,h);\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nvec2 centroid_decoded=pos.xy;bool isBorderCentroid=false;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {int iy=int(centroid_pos.y);int spanYbits=iy & 7;if (spanYbits==7) {isBorderCentroid=true;int borderID=(iy >> 3) & 3;float coordAlongBorder=float(iy >> 5)*4.0;if (borderID==0) centroid_decoded=vec2(0.0,coordAlongBorder);else if (borderID==1) centroid_decoded=vec2(EXTENT,coordAlongBorder);else if (borderID==2) centroid_decoded=vec2(coordAlongBorder,0.0);else centroid_decoded=vec2(coordAlongBorder,EXTENT);} else {centroid_decoded=floor(centroid_pos/8.0);}}\n#endif\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nfloat frontCutoffOpacity=1.0;float routeFade=0.0;\n#endif\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0);\n#endif\n#ifdef RENDER_CUTOFF\ncutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_random/8.0;vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_FRONT_CUTOFF\nif (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;if (!isBorderCentroid) {hidden=max(hidden,float(ndc_y < threshold-range_ndc));}float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);frontCutoffOpacity=mix(u_front_cutoff_params.z,1.0,t);}\n#endif\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nv_dither_opacity=1.0;\n#ifdef RENDER_FRONT_CUTOFF\nv_dither_opacity=min(v_dither_opacity,frontCutoffOpacity);\n#endif\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny_start.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),
24418 24419 fillExtrusionPattern: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}',
vendor: 5,628 bytes, line 24419
24419'#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;\n#ifndef LIGHTING_3D_MODE\nuniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;\n#endif\nin ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=float(a_pos_normal_ed.w);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny_start.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);p.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;p.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),
24419 24420 hillshadePrepare: PA("precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}", "uniform mat4 u_matrix;uniform vec2 u_dimension;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(vec2(a_texture_pos)/8192.0)*scale+epsilon;}"), 24421 hillshade: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=vec2(a_texture_pos)/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'), 24422 line: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in vec2 v_tile_pos;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nin float stub_side;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;uniform highp float u_floor_width_scale;in highp vec2 v_tex;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nin vec3 v_elevation_id_col;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec3 v_uv;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef RENDER_LINE_BORDER_GRADIENT\nuniform sampler2D u_border_gradient_image;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nuniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;\n#endif\n#ifdef RENDER_SHADOWS\nuniform bool u_emissive_in_shadows;uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump uvec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\nfloat linearstep(float edge0,float edge1,float x) {return
24422clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump uvec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\nfloat dist=length(v_normal)*v_width2_dilute.x;float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nANTIALIASING*=8.0;\n#endif\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nblur=mix(blur,0.0,stub_side);\n#endif\nfloat diluted_opacity=opacity*v_width2_dilute.z;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2_dilute.y-blur2),v_width2_dilute.x-dist)/blur2,0.0,1.0);float pxStep;float delta;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\npxStep=fwidth(dist);float out_edge=v_width2_dilute.x-dist;float in_edge=dist-(v_width2_dilute.y-2.0*ANTIALIASING);delta=v_width2_dilute.y > 0.0 ? min(in_edge,out_edge) : out_edge;float edge=ANTIALIASING;alpha=delta > 0.0 ? smoothstep(edge-pxStep,u_width_scale*blur+edge+pxStep,delta) : 0.0;\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nhighp float dash_w=float(dash.w);highp float dash_len=float(dash.z)+dash_w/65535.0;float sdfgamma=ANTIALIASING/float(dash_len);float scaled_floorwidth=(floorwidth*u_floor_width_scale);float periods_per_pixel=fwidth(v_tex.x);float dash_coverage=float(dash.y >> 4u)/4095.0;float fade=linearstep(0.25,0.5,periods_per_pixel);float gamma=max(sdfgamma/scaled_floorwidth,0.5*periods_per_pixel);if (fade >=1.0) {alpha*=dash_coverage;} else if (periods_per_pixel < 0.1) {float sdfdist=texture(u_dash_image,v_tex).r;alpha*=linearstep(0.5-gamma,0.5+gamma,sdfdist);} else {float span=min(periods_per_pixel,1.0);float tap_offset=span*0.25;float sdf0=texture(u_dash_image,vec2(v_tex.x-tap_offset,v_tex.y)).r;float sdf1=texture(u_dash_image,vec2(v_tex.x+tap_offset,v_tex.y)).r;alpha*=mix(0.5*(\nlinearstep(0.5-gamma,0.5+gamma,sdf0)+linearstep(0.5-gamma,0.5+gamma,sdf1)\n),dash_coverage,fade);}\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0;\n#ifdef RENDER_LINE_GRADIENT\ngradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);\n#endif\nhighp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nfloat edge2=border_width*u_width_scale+ANTIALIASING;float alpha2=smoothstep(edge2-pxStep,edge2+pxStep,delta);if (alpha2 < 1.) {\n#ifdef RENDER_LINE_BORDER_GRADIENT\nvec4 border_gradient_color=texture(u_border_gradient_image,v_uv.xy);out_color=mix(border_gradient_color*trim_alpha,out_color,alpha2);\n#else\nif (border_color.a==0.0) {\n#ifndef RENDER_LINE_GRADIENT\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-alpha2));} else {out_color.rgb*=(0.6+0.4*alpha2);}\n#else\nout_color.rgb*=(0.6+0.4*alpha2);\n#endif\n} else {out_color=mix(border_color*trim_alpha,out_color,alpha2);}\n#endif\nout_color*=v_width2_dilute.w;}\n#endif\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);light=u_emissive_in_shadows ? mix(light,1.0,emissive_strength) : light;\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*diluted_opacity*u_opacity_multiplier);\n#ifdef LINE_BLEND_ADDITIVE\n{float cov=alpha*diluted_opacity;glFragColor=vec4(cov > 0.0 ? out_color.rgb/cov : vec3(0.0),cov);}\n#else\n#ifdef LINE_BLEND_MULTIPLY\nglFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0);\n#else\nglFragColor=out_color;\n#endif\n#endif\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissive_strength);\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n#ifdef DEBUG_ELEVATION_ID\nglFragColor=vec4(v_elevation_id_col,1.0);\n#endif\nif (u_clip_to_tile_borders) {if (v_tile_pos.x > 1.0 || v_tile_pos.y > 1.0 || v_tile_pos.x < 0.0 || v_tile_pos.y < 0.0) {discard;}}HANDLE_WIREFRAME_DEBUG;}',
vendor: 8,817 bytes, line 24422
24422'#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin ivec2 a_pos_normal;in uvec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) || defined(VARIABLE_LINE_EMISSIVE_STRENGTH)\nin vec4 a_z_offset_width;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nin vec3 a_elevation_id_col;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nout vec3 v_elevation_id_col;\n#endif\n#ifdef ELEVATION_GROUND_SCALE\nin float a_elevation_ground_scale;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\nin highp vec3 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_z_offset;uniform highp float u_road_view_depth_bias;uniform highp vec4 u_road_clip_to_view;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out vec2 v_tile_pos;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nout float stub_side;uniform float u_width_addition;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform highp float u_floor_width_scale;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out highp vec2 v_tex;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nout highp vec3 v_uv;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT)\nuniform float u_image_height;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump uvec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump uvec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\n#ifdef VARIABLE_LINE_EMISSIVE_STRENGTH\nemissive_strength=a_z_offset_width.w;\n#endif\nfloat a_z_offset=u_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset+=a_z_offset_width.x;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nv_elevation_id_col=a_elevation_id_col;\n#endif\nhighp float line_progress=0.0;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\nline_progress=a_packed[2];\n#endif\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nANTIALIASING*=8.0;\n#endif\n#endif\nvec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);mediump vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;offset=-1.0*offset*u_width_scale;bool left=normal.y==1.0;gapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;float symmetric_outset=0.0;\n#ifdef VARIABLE_LINE_WIDTH\nfloat left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;bool zero_right_width=border_width==0.0 && right_width==0.0;halfwidth=left ? left_width : right_width;halfwidth+=u_width_addition*(zero_right_width ? (left ? 1.0 : 0.0) : 0.5); \nhalfwidth*=u_width_scale;if (side_z_offset !=0.0) {float left_f=step(1.0,normal.y);float is_negative=step(side_z_offset,0.0);float apply=mix(1.0-left_f,left_f,is_negative);a_extrude*=apply;a_z_offset+=abs(side_z_offset)*apply;v_normal*=apply;}offset=border_width > 0.0 ? (left_width+right_width+u_width_addition)*u_width_scale : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;symmetric_outset=zero_right_width ? u_width_scale*(left_width+u_width_addition) : halfwidth;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\nfloat inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth > 0.0 ? ANTIALIASING : 0.0);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,a_z_offset,1.0);\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\n#ifdef ELEVATION_GROUND_SCALE\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\n#endif\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;\n#endif\n#endif\nv_tile_pos=offset_pos;gl_Position=u_matrix*vec4(v_tile_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\nv_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,0.0,1.0);\n#endif\n#endif\n#ifndef ELEVATED\n#ifndef VARIABLE_LINE_WIDTH\n#ifndef RENDER_TO_TEXTURE\nfloat base_w=gl_Position.w;vec2 screen_width=abs(projected_extrude.xy/base_w*u_units_to_pixels);float max_extrude_component=max(screen_width.x,screen_width.y);if (width >=1.0 && base_w > 0.0 && max_extrude_component > 0.0001) {float min_pixel=1.05;if (max_extrude_component < min_pixel) {vec2 abs_pos=abs(gl_Position.xy);float is_out=max(abs_pos.x,abs_pos.y)/base_w;dilute_scale=mix(max_extrude_component/min_pixel,1.0,smoothstep(2.5,4.5,is_out));projected_extrude/=dilute_scale;}else if (gapwidth > 0.0) {float visible_ratio=(halfwidth+ANTIALIASING)/outset;vec2 visible_screen_width=screen_width*visible_ratio;float max_visible_component=max(visible_screen_width.x,visible_screen_width.y);dilute_scale=min(1.0,max_visible_component/min_pixel);}else\n{\n#ifdef RENDER_LINE_BORDER\nfloat border_ratio=(border_width*u_width_scale+ANTIALIASING)/outset;screen_width*=border_ratio;float max_border_component=max(screen_width.x,screen_width.y);dilute_border_scale=min(1.0,max_border_component/min_pixel);\n#endif\n}}\n#endif\n#endif\nv_tile_pos=(v_tile_pos+extrude)/EXTENT;\n#ifdef ELEVATED_ROADS\ngl_Position=gl_Position+projected_extrude;\n#ifdef VARIABLE_LINE_WIDTH\n#ifndef ELEVATED\n
24422if (u_road_view_depth_bias > 0.0) {highp float z_in=gl_Position.z/gl_Position.w*0.5+0.5;highp float a=u_road_clip_to_view.x;highp float b=u_road_clip_to_view.y;highp float c=u_road_clip_to_view.z;highp float d=u_road_clip_to_view.w;highp float view=(a*z_in+b)/(c*z_in+d);highp float view_new=view+u_road_view_depth_bias;highp float z_new=(view_new*d-b)/(a-view_new*c);z_new=clamp(z_new,0.0,1.0);gl_Position.z=(z_new*2.0-1.0)*gl_Position.w;}\n#endif\n#endif\n#else\ngl_Position=mix(gl_Position+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT)\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nvec4 dashf=vec4(dash);highp float dash_w=float(dash.w);highp float totalLength=float(dash.z)+dash_w/65535.0;float scale=totalLength==0.0 ? 0.0 : u_tile_units_to_pixels/totalLength;float dash_half_height=float(dash.y & 15u);v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*dash_half_height+dashf.x+0.5)/u_texsize.y);\n#endif\nv_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);\n#ifdef VARIABLE_LINE_WIDTH\nv_width2_dilute.x=symmetric_outset;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'), 24423 linePattern: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nvec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity*u_opacity_multiplier);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}glFragColor=color;\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissive_strength);\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
24423\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin ivec2 a_pos_normal;in uvec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec4 a_z_offset_width;\n#endif\n#ifdef ELEVATION_GROUND_SCALE\nin float a_elevation_ground_scale;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize lowp float emissive_strength\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\n#ifdef ELEVATION_GROUND_SCALE\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\n#endif\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/(float(pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=float(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'), 24424 raster: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;uniform highp float u_color_ramp_size;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#ifdef RASTER_COLOR_SCALE_LOG\nfloat N=u_color_ramp_size;float vNorm=max((value.x-0.5/N)*N/(N-1.0),0.0);vNorm=log(vNorm*(10.0-1.0)+1.0)/log(10.0);value.x=0.5/N+vNorm*(N-1.0)/N;\n#endif\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
24424\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;\n#endif\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin ivec2 a_pos;in uvec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation;\n#ifdef ELEVATION_REFERENCE_GROUND\nele+=elevation(uv*EXTENT);\n#endif\nglobe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0);\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nvec4 world_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 texture_pos=vec2(a_texture_pos);uv=texture_pos/8192.0;vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nfloat tiles=u_grid_matrix[0][2];
24424if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}float ele=u_raster_elevation;\n#ifdef ELEVATION_REFERENCE_GROUND\nele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z;\n#endif\nvec4 merc_world_pos=vec4(0.0); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,ele,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);world_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nfloat ele=0.0;vec2 decodedPos=vec2(a_pos);\n#ifdef ELEVATION_REFERENCE_GROUND\nvec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt;\n#else\nuv=vec2(a_texture_pos)/8192.0;\n#endif\nworld_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0);\n#ifdef FOG\nv_fog_pos=fog_position(decodedPos);\n#endif\n#endif\nfloat w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w;\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef ELEVATED\nfloat z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor);gl_Position.z-=(gl_Position.w*zbias);\n#endif\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'), 24425 symbol: PA('#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;\n#ifdef RENDER_TEXT_AND_SYMBOL\nuniform sampler2D u_texture_icon;\n#endif\nuniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_sdf;uniform lowp float u_scale_factor;uniform lowp float u_opacity_multiplier;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef RENDER_SHADOWS\nin highp float v_z_offset;\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\nin lowp float v_opacity;in lowp vec4 v_fill_np_color;in lowp vec4 v_halo_np_color;in lowp float v_halo_width;in lowp float v_halo_blur;\n#ifdef LIGHTING_3D_MODE\nin lowp float v_emissive_strength;\n#endif\nvoid main() {lowp float opacity=v_opacity;lowp vec4 fill_color=vec4(0.0);lowp vec4 halo_color=vec4(0.0);lowp float halo_width=0.0;lowp float halo_blur=0.0;if (u_is_sdf) {fill_color=vec4(v_fill_np_color.rgb*v_fill_np_color.a,v_fill_np_color.a);halo_color=vec4(v_halo_np_color.rgb*v_halo_np_color.a,v_halo_np_color.a);halo_width=v_halo_width;halo_blur=v_halo_blur;}lowp float emissive_strength=0.0;\n#ifdef LIGHTING_3D_MODE\nemissive_strength=v_emissive_strength;\n#endif\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity*u_opacity_multiplier;
24425glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\nvec2 cutout_factors=vec2(0.0);if (u_is_sdf) {float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;} else {\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n}out_color*=opacity*fade_opacity*u_opacity_multiplier;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\n#ifdef TERRAIN\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#else\nout_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#endif\n#endif\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}',
vendor: 12,508 bytes, line 24425
24425'#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#define USING_APPEARANCE 1.0\nin ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin uvec2 a_texb;\n#endif\n#ifdef ELEVATED_ROADS\nin vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;\n#endif\n#ifdef RENDER_SHADOWS\nout highp float v_z_offset;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_inv_matrix;\n#endif\nuniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_up_vector;\n#endif\n#ifdef RENDER_TEXT_AND_SYMBOL\nuniform vec2 u_texsize_icon;\n#endif\nuniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#ifndef MAX_UBO_SIZE_VEC4\n#define MAX_UBO_SIZE_VEC4 1024u\n#endif\n#define SPP_HEADER_SIZE_VEC4 4u\nstruct SymbolPaintProperties {vec4 fill_np_color;vec4 halo_np_color;float opacity;float halo_width;float halo_blur;float emissive_strength;float occlusion_opacity;float z_offset;vec2 translate;};uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform highp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;uniform highp float u_spp_zoom_fraction;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float v_opacity;out lowp vec4 v_fill_np_color;out lowp vec4 v_halo_np_color;out lowp float v_halo_width;out lowp float v_halo_blur;\n#ifdef LIGHTING_3D_MODE\nout lowp float v_emissive_strength;\n#endif\nfloat zoomFactor(float zm,float zM) {if (zm==zM) return u_spp_zoom_fraction-zm >=0.0 ? 1.0 : 0.0;return clamp((u_spp_zoom_fraction-zm)/(zM-zm),0.0,1.0);}vec4 readColor(uint base,bool isDataDriven,uint offsetVec4,uint dzr,vec2 headerZoom,vec4 fallbackValue) {if (!isDataDriven) return fallbackValue;vec4 value=u_spp_properties.properties[base+offsetVec4];vec2 blockZoom=u_spp_properties.properties[base+offsetVec4+dzr].xy;vec2 zr=mix(headerZoom,blockZoom,float(dzr));return unpack_mix_color(value,zoomFactor(zr.x,zr.y));}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x :\n(index==1u) ? v.y :\n(index==2u) ? v.z : v.w;}float readScalar(uint base,bool isDataDriven,uint offsetVec4,float fallbackValue) {if (!isDataDriven) return fallbackValue;vec4 slot=u_spp_properties.properties[base+offsetVec4];return unpack_mix_vec2(slot.xy,zoomFactor(slot.z,slot.w));}vec2 readTranslate(uint base,bool isDataDriven,uint offsetVec4,uint dzr) {if (!isDataDriven) return vec2(0.0);vec4 value=u_spp_properties.properties[base+offsetVec4];vec2 blockZoom=u_spp_properties.properties[base+offsetVec4+dzr].xy;float t=zoomFactor(blockZoom.x,blockZoom.y)*float(dzr);return mix(value.xy,value.zw,t);}SymbolPaintProperties readSymbolPaintProperties() {uint dataDrivenMask=u_spp_header.header[0][0];uint dzrMask =u_spp_header.header[0][1];uint blockSizeVec4 =u_spp_header.header[0][2];uint fillColorDzr=dzrMask & 1u;uint haloColorDzr=(dzrMask >> 1u) & 1u;vec2 fillColorHeaderZoom=uintBitsToFloat(u_spp_header.header[3].xy);vec2 haloColorHeaderZoom=uintBitsToFloat(u_spp_header.header[3].zw);uint featureIndex=uint(a_feature_index);uvec4 indexSlot=u_spp_index.block_indices[featureIndex/4u];uint base=uvec4At(indexSlot,featureIndex % 4u)*blockSizeVec4;SymbolPaintProperties props;props.fill_np_color =readColor(base,(dataDrivenMask & (1u << 0u)) !=0u,u_spp_header.header[0][3],fillColorDzr,fillColorHeaderZoom,u_spp_fill_np_color);props.halo_np_color =readColor(base,(dataDrivenMask & (1u << 1u)) !=0u,u_spp_header.header[1][0],haloColorDzr,haloColorHeaderZoom,u_spp_halo_np_color);props.opacity =readScalar(base,(dataDrivenMask & (1u << 2u)) !=0u,u_spp_header.header[1][1],u_spp_opacity);props.halo_width =readScalar(base,(dataDrivenMask & (1u << 3u)) !=0u,u_spp_header.header[1][2],u_spp_halo_width);props.halo_blur =readScalar(base,(dataDrivenMask & (1u << 4u)) !=0u,u_spp_header.header[1][3],u_spp_halo_blur);props.emissive_strength=readScalar(base,(dataDrivenMask & (1u << 5u)) !=0u,u_spp_header.header[2][0],u_spp_emissive_strength);props.occlusion_opacity=readScalar(base,(dataDrivenMask & (1u << 6u)) !=0u,u_spp_header.header[2][1],u_spp_occlusion_opacity);props.z_offset =readScalar(base,(dataDrivenMask & (1u << 7u)) !=0u,u_spp_header.header[2][2],u_spp_z_offset);uint translateDzr=(dzrMask >> 8u) & 1u;props.translate =readTranslate(base,(dataDrivenMask & (1u << 8u)) !=0u,u_spp_header.header[2][3],translateDzr);return props;}vec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}void main() {SymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity;v_fill_np_color=paint_properties.fill_np_color;v_halo_np_color=paint_properties.halo_np_color;v_halo_width=paint_properties.halo_width;v_halo_blur=paint_properties.halo_blur;\n#ifdef LIGHTING_3D_MODE\nv_emissive_strength=paint_properties.emissive_strength;\n#endif\nlowp float occlusion_opacity=paint_properties.occlusion_opacity;highp float z_offset=paint_properties.z_offset;vec2 a_pos=vec2(a_pos_offset.xy);vec2 a_offset=vec2(a_pos_offset.zw);vec2 a_tex=vec2(a_tex_size.xy);vec2 a_size=vec2(a_tex_size.zw);float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=vec2(a_pixeloffset.xy);vec2 a_min_font_scale=vec2(a_pixeloffset.zw)/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=vec3(a_globe_anchor)+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(vec3(a_globe_anchor)+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\n#ifdef PROJECTED_POS_ON_VIEWPORT\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\n#else\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#endif\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;\n#else\nz+=u_pitch_with_map ? z_offset : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\n#ifdef ELEVATED_ROADS\nvec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;\n#else\npos=vec3(projected_pos.xy/projected_pos.w+offset,z);\n#endif\n#endif\ngl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2(\nu_spp_translate_rotation.x*tr.x-u_spp_translate_rotation.y*tr.y,u_spp_translate_rotation.y*tr.x+u_spp_translate_rotation.x*tr.y\n);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=vec2(a_texb)/u_texsize;\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef RENDER_SHADOWS\nv_z_offset=e;\n#endif\n}'),
24425 24426 skybox: PA('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}', sA), 24427 skyboxGradient: PA('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}', sA), 24428 skyboxCapture: PA("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}
24428float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}", "in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
24428nd-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"), 24429 globeAtmosphere: PA('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\nglFragColor=vec4(0,0,0,1);return;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);\n#endif\n}', "in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"), 24430 stars: PA("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}", "\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"), 24431 occlusion: PA("uniform vec4 u_color;void main() {glFragColor=u_color;}", '#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}') 24432 }; 24433 function zA(e1, t1) { 24434 const i = e1.split("\n"); 24435 for (let e1 of i){ 24436 if (e1 = e1.trimStart(), "#" !== e1[0]) continue; 24437 if (!e1.includes("if")) continue; 24438 if (e1.startsWith("#endif")) continue; 24439 const i = e1.match(gA); 24440 if (i) for (const e1 of i)yA.has(e1) || t1.add(e1); 24441 } 24442 } 24443 function RA(e1) { 24444 return new Set([ 24445 "uint", 24446 "int", 24447 "uvec2", 24448 "ivec2", 24449 "uvec3", 24450 "ivec3", 24451 "uvec4", 24452 "ivec4" 24453 ]).has(e1); 24454 } 24455 function PA(e1, t1) { 24456 const i = new Set, n = [], r = []; 24457 e1 = e1.replace(mA, (e1, t1)=>(r.push(t1), "")), t1 = t1.replace(mA, (e1, t1)=>(n.push(t1), "")); 24458 let o = new Set(xA); 24459 zA(e1, o), zA(t1, o); 24460 for (const e1 of [ 24461 ...n, 24462 ...r 24463 ])bA[e1] || (bA[e1] = new Set, zA(vA[e1], bA[e1])), o = new Set([ 24464 ...o, 24465 ...bA[e1] 24466 ]); 24467 return { 24468 fragmentSource: e1 = e1.replace(_A, (e1, t1, n, r, o)=>(i.add(o), "define" === t1 ? "\n#ifndef HAS_UNIFORM_u_".concat(o, "\n").concat(RA(r) ? "flat " : "", "in ").concat(n, " ").concat(r, " ").concat(o, ";\n#else\nuniform ").concat(n, " ").concat(r, " u_").concat(o, ";\n#endif\n") : "initialize" === t1 ? "\n#ifdef HAS_UNIFORM_u_".concat(o, "\n ").concat(n, " ").concat(r, " ").concat(o, " = u_").concat(o, ";\n#endif\n") : "define-attribute" === t1 ? "\n#ifdef HAS_ATTRIBUTE_a_".concat(o, "\n in ").concat(n, " ").concat(r, " ").concat(o, ";\n#endif\n") : "initialize-attribute" === t1 ? "" : void 0)), 24469 vertexSource: t1 = t1.replace(_A, (e1, t1, n, r, o)=>{ 24470 const a = "MATERIAL_ATTRIBUTE_OFFSET_".concat(o), s = "float" === r ? "vec2" : r, l = "GET_ATTRIBUTE_".concat(s, "(a_").concat(o, ", materialInfo, ").
24470concat(a, ")"), c = o.includes("color") ? "color" : s; 24471 return "define-attribute-vertex-shader-only" === t1 ? "\n#ifdef HAS_ATTRIBUTE_a_".concat(o, "\nin ").concat(n, " ").concat(r, " a_").concat(o, ";\n#endif\n") : i.has(o) ? "define" === t1 ? "\n#ifndef HAS_UNIFORM_u_".concat(o, "\nuniform lowp float u_").concat(o, "_t;\n #if !defined(").concat(a, ")\n in ").concat(n, " ").concat(s, " a_").concat(o, ";\n #endif\n").concat(RA(r) ? "flat " : "", "out ").concat(n, " ").concat(r, " ").concat(o, ";\n#else\nuniform ").concat(n, " ").concat(r, " u_").concat(o, ";\n#endif\n") : "initialize" === t1 ? "vec4" === c || "uvec4" === c ? "\n#ifndef HAS_UNIFORM_u_".concat(o, "\n ").concat(o, " = a_").concat(o, ";\n#else\n ").concat(n, " ").concat(r, " ").concat(o, " = u_").concat(o, ";\n#endif\n") : "\n#if !defined(HAS_UNIFORM_u_".concat(o, ")\n #ifdef ").concat(a, "\n ").concat(o, " = unpack_mix_").concat(c, "(").concat(l, ", u_").concat(o, "_t);\n #else\n ").concat(o, " = unpack_mix_").concat(c, "(a_").concat(o, ", u_").concat(o, "_t);\n #endif\n#else\n ").concat(n, " ").concat(r, " ").concat(o, " = u_").concat(o, ";\n#endif\n") : "define-attribute" === t1 ? "\n#ifdef HAS_ATTRIBUTE_a_".concat(o, "\n in ").concat(n, " ").concat(r, " a_").concat(o, ";\n out ").concat(n, " ").concat(r, " ").concat(o, ";\n#endif\n") : "initialize-attribute" === t1 ? "\n#ifdef HAS_ATTRIBUTE_a_".concat(o, "\n ").concat(o, " = a_").concat(o, ";\n#endif\n") : void 0 : "define" === t1 ? "\n#ifndef HAS_UNIFORM_u_".concat(o, "\nuniform lowp float u_").concat(o, "_t;\n #if !defined(").concat(a, ")\n in ").concat(n, " ").concat(s, " a_").concat(o, ";\n #endif\n#else\nuniform ").concat(n, " ").concat(r, " u_").concat(o, ";\n#endif\n") : "define-instanced" === t1 ? "mat4" === c ? "\n#ifdef INSTANCED_ARRAYS\nin vec4 a_".concat(o, "0;\nin vec4 a_").concat(o, "1;\nin vec4 a_").concat(o, "2;\nin vec4 a_").concat(o, "3;\n#else\nuniform ").concat(n, " ").concat(r, " u_").concat(o, ";\n#endif\n") : "\n#ifdef INSTANCED_ARRAYS\nin ".concat(n, " ").concat(s, " a_").concat(o, ";\n#else\nuniform ").concat(n, " ").concat(r, " u_").concat(o, ";\n#endif\n") : "initialize-attribute-custom" === t1 ? "\n#ifdef HAS_ATTRIBUTE_a_".concat(o, "\n ").concat(n, " ").concat(r, " ").concat(o, " = a_").concat(o, ";\n#endif\n") : "vec4" === c || "uvec4" === c ? "\n#ifndef HAS_UNIFORM_u_".concat(o, "\n #ifdef ").concat(a, "\n ").concat(n, " ").concat(r, " ").concat(o, " = ").concat(l, ";\n #else\n ").concat(n, " ").concat(r, " ").concat(o, " = a_").concat(o, ";\n #endif\n#else\n ").concat(n, " ").concat(r, " ").concat(o, " = u_").concat(o, ";\n#endif\n") : "\n#ifndef HAS_UNIFORM_u_".concat(o, "\n #ifdef ").concat(a, "\n ").concat(n, " ").concat(r, " ").concat(o, " = unpack_mix_").concat(c, "(").concat(l, ", u_").concat(o, "_t);\n #else\n ").concat(n, " ").concat(r, " ").concat(o, " = unpack_mix_").concat(c, "(a_").concat(o, ", u_").concat(o, "_t);\n #endif\n#else\n ").concat(n, " ").concat(r, " ").concat(o, " = u_").concat(o, ";\n#endif\n"); 24472 }), 24473 usedDefines: o, 24474 vertexIncludes: n, 24475 fragmentIncludes: r 24476 }; 24477 } 24478 var DA = { 24479 model: PA('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform float u_opacity;\n#ifdef DITHERED_DISCARD\nuniform float u_dithered_discard_threshold;\n#endif\n#ifndef LIGHTING_3D_MODE\nuniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;\n#endif\nuniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;
24479uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\ntexColor=vec4(unpremultiplyColor(texColor),1.0);\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr
vendor: 5,764 bytes, line 24479
24479\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {vec3 lightDir;vec3 lightColor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#else\nlightDir=u_lightpos;lightColor=u_lightcolor;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_
24479pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef DITHERED_DISCARD\nif (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}}\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_feature_cutout.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp uvec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(vec2(pbr.xy));vec2 e_r_m=unpack_float(float(pbr.z));vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(float(pbr.w))/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
24479\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'), 24480 modelDepth: PA("void main() {}", "in vec3 a_pos_3f;uniform mat4 u_matrix;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
24480rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\n}"), 24481 fillExtrusionDepth: PA("void main() {}", '#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 top_up_ny=vec3(a_pos_normal_ed.xyz & 1);vec3 pos_nx=vec3(a_pos_normal_ed.xyz >> 1);base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);float c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;pos.xy-=join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);}'), 24482 fillExtrusionGroundEffect: PA("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
24482\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}", '#include "_prelude_fog.vertex.glsl"\nin highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec4 pos_end=vec4(a_pos_end);vec2 p=pos_end.xy;vec2 q=floor(pos_end.zw*0.5);vec2 start_bottom=pos_end.zw-q*2.0;float fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=float(a_angular_offset_factor)/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=float(a_hidden_by_landmark);\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'), 24483 groundShadow: PA('#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\nglFragColor=vec4(shadow,1.0);}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in ivec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos);\n#endif\n}') 24484 }; 24485 const FA = (e1, t1)=>({ 24486 u_matrix: e1, 24487 u_ground_shadow_factor: t1 24488 }); 24489 function CA(e1, t1) { 24490 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
24491 const n = Math.pow(2, t1.tileID.overscaledZ), r = t1.tileSize * Math.pow(2, e1.transform.tileZoom) / n, o = r * (t1.tileID.canonical.x + t1.tileID.wrap * n), a = r * t1.tileID.canonical.y; 24492 return { 24493 u_image: 0, 24494 u_texsize: t1.imageAtlasTexture ? t1.imageAtlasTexture.size : [ 24495 0, 24496 0 24497 ], 24498 u_tile_units_to_pixels: 1 / Vv(t1, 1, e1.transform.tileZoom), 24499 u_pixel_coord_upper: [ 24500 o >> 16, 24501 a >> 16 24502 ], 24503 u_pixel_coord_lower: [ 24504 65535 & o, 24505 65535 & a 24506 ], 24507 u_pattern_transition: i 24508 }; 24509 } 24510 const LA = { 24511 terrain: 0, 24512 flat: 1 24513 }, OA = c(), BA = [ 24514 0, 24515 0, 24516 0 24517 ], VA = function(e1, t1, i, n, r, o, s, c, u, h, d, f, p, m, _, g, y, x) { 24518 let v = arguments.length > 18 && arguments[18] !== void 0 ? arguments[18] : [ 24519 0, 24520 0, 24521 1 24522 ], b = arguments.length > 19 && arguments[19] !== void 0 ? arguments[19] : !1; 24523 let w = BA, A = 0, E = BA; 24524 if (!b) { 24525 const e1 = t1.style.light, i = e1.properties.get("position"); 24526 if (w = [ 24527 i.x, 24528 i.y, 24529 i.z 24530 ], "viewport" === e1.properties.get("anchor")) { 24531 const e1 = a(); 24532 l(e1, -t1.transform.angle), J(w, w, e1); 24533 } 24534 const n = e1.properties.get("color").toPremultipliedRenderColor(null); 24535 A = e1.properties.get("intensity"), E = [ 24536 n.r, 24537 n.g, 24538 n.b 24539 ]; 24540 } 24541 const I = t1.transform, M = { 24542 u_matrix: e1, 24543 u_lightpos: w, 24544 u_lightintensity: A, 24545 u_lightcolor: E, 24546 u_vertical_gradient: +i, 24547 u_opacity: n, 24548 u_tile_id: [ 24549 0, 24550 0, 24551 0 24552 ], 24553 u_zoom_transition: 0, 24554 u_inv_rot_matrix: OA, 24555 u_merc_center: [ 24556 0, 24557 0 24558 ], 24559 u_up_dir: [ 24560 0, 24561 0, 24562 0 24563 ], 24564 u_height_lift: 0, 24565 u_height_type: LA[h], 24566 u_base_type: LA[d], 24567 u_ao: r, 24568 u_edge_radius: o, 24569 u_width_scale: s, 24570 u_flood_light_color: _, 24571 u_vertical_scale: g, 24572 u_flood_light_intensity: y, 24573 u_ground_shadow_factor: x, 24574 u_front_cutoff_params: v 24575 }; 24576 return "globe" === I.projection.name && (M.u_tile_id = [ 24577 c.canonical.x, 24578 c.canonical.y, 24579 1 << c.canonical.z 24580 ], M.u_zoom_transition = f, M.u_inv_rot_matrix = m, M.u_merc_center = p, M.u_up_dir = I.projection.upVector(new np(0, 0, 0), p[0] * zr, p[1] * zr), M.u_height_lift = u), M; 24581 }, NA = new Float32Array(16); 24582 function kA(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, g, y, x, v, b) { 24583 const w = t1.context, A = w.gl, E = t1.transform, I = t1.transform.zoom, M = [], T = e1.translate, S = e1.translateAnchor, z = e1.edgeRadius, R = bw(t1, e1.cutoffFadeRange); 24584 "clear" === u ? (M.push("CLEAR_SUBPASS"), v && (M.push("CLEAR_FROM_TEXTURE"), w.activeTexture.set(A.TEXTURE0), v.bind(A.LINEAR, A.CLAMP_TO_EDGE))) : "sdf" === u ? M.push("SDF_SUBPASS") : "emissive" === u && (M.push("USE_MRT1"), w.activeTexture.set(A.TEXTURE0), v.bind(A.LINEAR, A.CLAMP_TO_EDGE)), y && M.push("HAS_CENTROID"), R.shouldRenderCutoff && M.push("RENDER_CUTOFF"); 24585 const P = (e1, i, r, u, _)=>{ 24586 let x = M; 24587 null != i.groundRadiusBuffer && (x = M.concat("HAS_ATTRIBUTE_a_flood_light_ground_radiu
vendor: 10,310 bytes, lines 24587-24822
24587s")); 24588 const b = i.programConfigurations.get(n.id), A = t1.isTileAffectedByFog(e1), E = t1.getOrCreateProgram("fillExtrusionGroundEffect", { 24589 config: b, 24590 defines: x, 24591 overrideFog: A 24592 }), T = ((e1, t1, i, n, r, o, a, s, l, c)=>({ 24593 u_matrix: e1, 24594 u_opacity: t1, 24595 u_ao_pass: i ? 1 : 0, 24596 u_meter_to_tile: n, 24597 u_ao: r, 24598 u_flood_light_intensity: o, 24599 u_flood_light_color: a, 24600 u_attenuation: s, 24601 u_edge_radius: l, 24602 u_fb: 0, 24603 u_fb_size: c, 24604 u_dynamic_offset: 1 24605 }))(u, h, c, _, [ 24606 d, 24607 f * _ 24608 ], p, m, g, I >= 17 ? 0 : z * _, v ? v.size[0] : 0), S = []; 24609 y && S.push(i.hiddenByLandmarkVertexBuffer), null != i.groundRadiusBuffer && S.push(i.groundRadiusBuffer), t1.uploadCommonUniforms(w, E, e1.toUnwrapped(), null, R), E.draw(t1, w.gl.TRIANGLES, o, a, s, l, T, n.id, i.vertexBuffer, i.indexBuffer, r, n.paint, I, b, S); 24610 }; 24611 for (const e1 of r){ 24612 const r = i.getTile(e1), o = r.getBucket(n); 24613 if (!o || o.projection.name !== E.projection.name || !o.groundEffect || o.groundEffect && !o.groundEffect.hasData()) continue; 24614 const a = o.groundEffect, s = 1 / o.tileToMeter; 24615 { 24616 const i = t1.translatePosMatrix(e1.projMatrix, r, T, S), n = a.getDefaultSegment(); 24617 P(e1, a, n, i, s); 24618 } 24619 if (x) for(let o = 0; o < 4; o++){ 24620 const a = sp[o](e1), l = i.getTile(a); 24621 if (!l) continue; 24622 const c = l.getBucket(n); 24623 if (!c || c.projection.name !== E.projection.name || !c.groundEffect || c.groundEffect && !c.groundEffect.hasData()) continue; 24624 const u = c.groundEffect; 24625 let h, d; 24626 0 === o ? (h = [ 24627 -8192, 24628 0, 24629 0 24630 ], d = 1) : 1 === o ? (h = [ 24631 zr, 24632 0, 24633 0 24634 ], d = 0) : 2 === o ? (h = [ 24635 0, 24636 -8192, 24637 0 24638 ], d = 3) : (h = [ 24639 0, 24640 zr, 24641 0 24642 ], d = 2); 24643 const f = u.regionSegments[d]; 24644 f && (_(NA, e1.projMatrix, h), P(e1, u, f, t1.translatePosMatrix(NA, r, T, S), s)); 24645 } 24646 } 24647 } 24648 const UA = { 24649 model: (e1)=>({ 24650 u_matrix: new oh(e1), 24651 u_lighting_matrix: new oh(e1), 24652 u_normal_matrix: new oh(e1), 24653 u_node_matrix: new oh(e1), 24654 u_lightpos: new th(e1), 24655 u_lightintensity: new Qu(e1), 24656 u_lightcolor: new th(e1), 24657 u_camera_pos: new th(e1), 24658 u_opacity: new Qu(e1), 24659 u_baseColorFactor: new nh(e1), 24660 u_emissiveFactor: new nh(e1), 24661 u_metallicFactor: new Qu(e1), 24662 u_roughnessFactor: new Qu(e1), 24663 u_baseTextureIsAlpha: new Ku(e1), 24664 u_alphaMask: new Ku(e1), 24665 u_alphaCutoff: new Qu(e1), 24666 u_baseColorTexture: new Ku(e1), 24667 u_metallicRoughnessTexture: new Ku(e1), 24668 u_normalTexture: new Ku(e1), 24669 u_occlusionTexture: new Ku(e1), 24670 u_emissionTexture: new Ku(e1), 24671 u_lutTexture: new Ku(e1), 24672 u_color_mix: new nh(e1), 24673 u_aoIntensity: new Qu(e1), 24674 u_emissive_strength: new Qu(e1), 24675 u_occlusionTextureTransform: new nh(e1), 24676 u_dithered_discard_threshold: new Qu(e1) 24677 }), 24678 modelDepth: (e1)=>({ 24679 u_matrix: new oh(e1), 24680 u_instance: new oh(e1), 24681 u_node_matrix: new oh(e1) 24682 }), 24683 groundShadow: (e1)=>({ 24684 u_matrix: new oh(e1), 24685 u_ground_shadow_factor: new th(e1) 24686 }), 24687 fillExtrusionDepth: (e1)=>({ 24688 u_matrix: new oh(e1), 24689 u_edge_radius: new Qu(e1), 24690 u_width_scale: new Qu(e1), 24691 u_vertical_scale: new Qu(e1), 24692 u_height_type: new Ku(e1), 24693 u_base_type: new Ku(e1) 24694 }), 24695 fillExtrusionGroundEffect: (e1)=>({ 24696 u_matrix: new oh(e1), 24697 u_opacity: new Qu(e1), 24698 u_ao_pass: new Qu(e1), 24699 u_meter_to_tile: new Qu(e1), 24700 u_ao: new eh(e1), 24701 u_flood_light_intensity: new Qu(e1), 24702 u_flood_light_color: new th(e1), 24703 u_attenuation: new Qu(e1), 24704 u_edge_radius: new Qu(e1), 24705 u_fb: new Ku(e1), 24706 u_fb_size: new Qu(e1), 24707 u_dynamic_offset: new Qu(e1) 24708 }) 24709 }; 24710 function jA(e1) { 24711 const t1 = e1.properties.get("direction"), i = vt(t1.x, t1.y, t1.z); 24712 i[2] = it(i[2], 0, 75); 24713 const n = xt([ 24714 i[0], 24715 i[1], 24716 i[2] 24717 ]); 24718 return F(n.x, n.y, n.z); 24719 } 24720 function GA(e1, t1, i) { 24721 const n = "none" === t1.properties.get("color-use-theme"), r = t1.properties.get("color"), o = t1.properties.get("intensity"), a = t1.properties.get("direction"), s = [ 24722 a.x, 24723 a.y, 24724 a.z 24725 ], l = "none" === i.properties.get("color-use-theme"), c = i.properties.get("color"), u = i.properties.get("intensity"), h = Math.max(W([ 24726 0, 24727 0, 24728 1 24729 ], s), 0), d = [ 24730 0, 24731 0, 24732 0 24733 ]; 24734 k(d, c.toPremultipliedRenderColor(l ? null : e1.getLut(t1.scope)).toArray01Linear().slice(0, 3), u); 24735 const f = [ 24736 0, 24737 0, 24738 0 24739 ]; 24740 return k(f, r.toPremultipliedRenderColor(n ? null : e1.getLut(i.scope)).toArray01Linear().slice(0, 3), h * o), Tt([ 24741 d[0] > 0 ? d[0] / (d[0] + f[0]) : 0, 24742 d[1] > 0 ? d[1] / (d[1] + f[1]) : 0, 24743 d[2] > 0 ? d[2] / (d[2] + f[2]) : 0 24744 ]); 24745 } 24746 const HA = []; 24747 function $A(e1) { 24748 return HA[e1] = HA[e1] || new Float64Array(16); 24749 } 24750 const ZA = [], WA = new Float32Array(16); 24751 class qA { 24752 constructor(e1, t1){ 24753 this.aabb = e1, this.lastCascade = t1; 24754 } 24755 } 24756 class XA { 24757 add(e1, t1) { 24758 const i = this.receivers[e1.key]; 24759 void 0 !== i ? (i.aabb.min[0] = Math.min(i.aabb.min[0], t1.min[0]), i.aabb.min[1] = Math.min(i.aabb.min[1], t1.min[1]), i.aabb.min[2] = Math.min(i.aabb.min[2], t1.min[2]), i.aabb.max[0] = Math.max(i.aabb.max[0], t1.max[0]), i.aabb.max[1] = Math.max(i.aabb.max[1], t1.max[1]), i.aabb.max[2] = Math.max(i.aabb.max[2], t1.max[2])) : this.receivers[e1.key] = new qA(t1, null); 24760 } 24761 clear() { 24762 this.receivers = {}; 24763 } 24764 get(e1) { 24765 return this.receivers[e1.key]; 24766 } 24767 computeRequiredCascades(e1, t1, i) { 24768 const n = Rf.fromPoints(e1.points); 24769 let r = 0; 24770 for(const e1 in this.receivers){ 24771 const o = this.receivers[e1]; 24772 if (!o) continue; 24773 if (!n.intersectsAabb(o.aabb)) continue; 24774 o.aabb.min = n.closestPoint(o.aabb.min), o.aabb.max = n.closestPoint(o.aabb.max); 24775 const a = o.aabb.getCorners(); 24776 for(let e1 = 0; e1 < i.length; e1++){ 24777 let n = !0; 24778 for (const r of a){ 24779 const o = [ 24780 r[0] * t1, 24781 r[1] * t1, 24782 r[2] 24783 ]; 24784 if (Y(o, o, i[e1].matrix), o[0] < -1 || o[0] > 1 || o[1] < -1 || o[1] > 1) { 24785 n = !1; 24786 break; 24787 } 24788 } 24789 if (o.lastCascade = e1, r = Math.max(r, e1), n) break; 24790 } 24791 } 24792 return r + 1; 24793 } 24794 } 24795 function YA(e1, t1, i) { 24796 const n = q([], te([], i, t1), te([], e1, t1)), r = D(n); 24797 return 0 === r ? [ 24798 0, 24799 0, 24800 1, 24801 0 24802 ] : (k(n, n, 1 / r), [ 24803 n[0], 24804 n[1], 24805 n[2], 24806 -W(n, t1) 24807 ]); 24808 } 24809 function JA(e1, t1, i, n, r, o) { 24810 const a = e1.zoom, s = e1.scale, l = e1.worldSize, c = 1 / l, u = e1.aspect, h = Math.sqrt(1 + u * u) * Math.tan(.5 * e1.fovX), f = h * h, g = n - i, y = n + i; 24811 let x, v; 24812 f > g / y ? (x = n, v = n * h) : (x = .5 * y * (1 + f), v = .5 * Math.sqrt(g * g + 2 * (n * n + i * i) * f + y * y * f * f)); 24813 const b = e1.projection.pixelsPerMeter(e1.center.lat, l), w = [ 24814 0, 24815 0, 24816 -x * c 24817 ]; 24818 Y(w, w, e1._camera.getCameraToWorldMercator()); 24819 let A = v * c; 24820 const E = function(t1) { 24821 return t1[0] /= s, t1[1] /= s, t1[2] = xc(t1[2], e1._center.lat), t1; 24822 }
24822, I = e1._edgeInsets; 24823 if (!(0 === I.left && 0 === I.top && 0 === I.right && 0 === I.bottom || I.left === I.right && I.top === I.bottom)) { 24824 const t1 = e1._camera.getWorldToCamera(e1.worldSize, "meters" === e1.projection.zAxisUnit ? b : 1), r = e1._camera.getCameraToClipPerspective(e1._fov, e1.width / e1.height, i, n); 24825 r[8] = 2 * -e1.centerOffset.x / e1.width, r[9] = 2 * e1.centerOffset.y / e1.height; 24826 const o = new Float64Array(16); 24827 z(o, r, t1); 24828 const s = new Float64Array(16); 24829 p(s, o); 24830 const c = zf.fromInvProjectionMatrix(s, l, a, !0); 24831 for (const e1 of c.points){ 24832 const t1 = E(e1); 24833 A = Math.max(A, ne(O([], w, t1))); 24834 } 24835 } 24836 A *= r / (r - 1); 24837 const M = Math.acos(t1[2]), T = Math.atan2(-t1[0], -t1[1]), S = new rw; 24838 S.position = w, S.setPitchBearing(M, T); 24839 const R = S.getWorldToCamera(l, b), P = A * l, D = Math.min(e1._mercatorZfromZoom(17) * l * -2, -2 * P), C = S.getCameraToClipOrthographic(-P, P, -P, P, D, (P + o * b) / t1[2]), L = new Float64Array(16); 24840 m(L, C, R); 24841 const B = .5 * r, V = [ 24842 0, 24843 0, 24844 0 24845 ]; 24846 Y(V, F(Math.floor(1e6 * w[0]) / 1e6 * l, Math.floor(1e6 * w[1]) / 1e6 * l, 0), L), k(V, V, B); 24847 const N = [ 24848 Math.floor(V[0]), 24849 Math.floor(V[1]), 24850 Math.floor(V[2]) 24851 ], U = [ 24852 0, 24853 0, 24854 0 24855 ]; 24856 te(U, V, N), k(U, U, -1 / B); 24857 const j = new Float64Array(16); 24858 return d(j), _(j, j, U), m(L, j, L), [ 24859 L, 24860 P 24861 ]; 24862 } 24863 class KA extends ln { 24864 cancelModelRequests() { 24865 this._abortController && (this._abortController.abort(), this._abortController = null); 24866 } 24867 async loadGLTFFromURI(e1, t1) { 24868 return Gg((await this.map._requestManager.transformRequest(e1, si.Model, t1)).url, t1); 24869 } 24870 async loadModel(e1, t1, i) { 24871 try { 24872 const n = await this.loadGLTFFromURI(t1.uri, i); 24873 if (i.aborted) return; 24874 const r = this._modelsInfo.get(e1); 24875 if (!r) return; 24876 const o = Fy(n), a = r.modelSpec, s = new fy(e1, a.uri, a.position, a.orientation, o); 24877 KA.applyModelSpecification(s, a), s.computeBoundsAndApplyParent(), this.models.push(s), r.model = s; 24878 } catch (n) { 24879 if (i.aborted) return; 24880 this.fire(new on(new Error("Could not load model ".concat(e1, " from ").concat(t1.uri), { 24881 cause: n 24882 }))); 24883 } 24884 } 24885 async load() { 24886 this._abortController || (this._abortController = new AbortController); 24887 const e1 = this._abortController.signal, t1 = []; 24888 for(const i in this._options.models){ 24889 const n = this._options.models[i], r = this._modelsInfo.get(i); 24890 if (r && r.model) { 24891 var _n_orientation; 24892 r.modelSpec = n; 24893 const e1 = r.model; 24894 e1.position = null != n.position ? new _c(n.position[0], n.position[1]) : new _c(0, 0), e1.orientation = (_n_orientation = n.orientation) !== null && _n_orientation !== void 0 ? _n_orientation : [ 24895 0, 24896 0, 24897 0 24898 ], KA.applyModelSpecification(e1, n), e1.computeBoundsAndApplyParent(), this.models.push(e1); 24899 } else r ? r.modelSpec = n : (this._modelsInfo.set(i, { 24900 modelSpec: n, 24901 model: null 24902 }
24902), t1.push(this.loadModel(i, n, e1))); 24903 } 24904 0 !== t1.length ? (await Promise.allSettled(t1), e1.aborted || this.fire(new rn("data", { 24905 dataType: "source", 24906 sourceDataType: "metadata" 24907 }))) : this.loaded() && this.fire(new rn("data", { 24908 dataType: "source", 24909 sourceDataType: "metadata" 24910 })); 24911 } 24912 static arrayFromColorSpecification(e1) { 24913 const t1 = e1; 24914 if (void 0 === t1) return; 24915 if (Array.isArray(t1)) return [ 24916 t1[0], 24917 t1[1], 24918 t1[2] 24919 ]; 24920 const i = mn.parse(t1); 24921 return i ? [ 24922 i.r, 24923 i.g, 24924 i.b 24925 ] : void 0; 24926 } 24927 static applyModelSpecification(e1, t1) { 24928 if (t1.nodeOverrides && KA.convertNodeOverrides(e1, t1.nodeOverrides), t1.materialOverrides && KA.convertMaterialOverrides(e1, t1.materialOverrides), t1.nodeOverrideNames && (e1.nodeOverrideNames = [ 24929 ...t1.nodeOverrideNames 24930 ]), t1.materialOverrideNames && (e1.materialOverrideNames = [ 24931 ...t1.materialOverrideNames 24932 ]), t1.featureProperties && (e1.featureProperties = t1.featureProperties), t1.lightOverrides) { 24933 const i = t1.lightOverrides, n = KA.arrayFromColorSpecification(i["light-ambient-color"]), r = KA.arrayFromColorSpecification(i["light-directional-color"]); 24934 e1.lightOverrides = { 24935 ambientIntensity: i["light-ambient-intensity"], 24936 ambientColor: n, 24937 directionalIntensity: i["light-directional-intensity"], 24938 directionalColor: r 24939 }; 24940 } else e1.lightOverrides = void 0; 24941 } 24942 static convertNodeOverrides(e1, t1) { 24943 if (Array.isArray(t1) && t1.every((e1)=>"string" == typeof e1)) { 24944 e1.nodeOverrideNames = []; 24945 for (const i of t1)e1.nodeOverrideNames.push(i); 24946 } else Object.entries(t1).forEach((param)=>{ 24947 let [t1, i] = param; 24948 const n = { 24949 orientation: [ 24950 0, 24951 0, 24952 0 24953 ], 24954 minZoom: void 0, 24955 maxZoom: void 0 24956 }; 24957 if (Object.hasOwn(i, "orientation")) { 24958 const e1 = i.orientation; 24959 e1 && (n.orientation = e1); 24960 } 24961 Object.hasOwn(i, "minzoom") && (n.minZoom = i.minzoom), Object.hasOwn(i, "maxzoom") && (n.maxZoom = i.maxzoom), e1.nodeOverrides.set(t1, n); 24962 }); 24963 } 24964 static convertMaterialOverrides(e1, t1) { 24965 if (Array.isArray(t1) && t1.every((e1)=>"string" == typeof e1)) { 24966 e1.materialOverrideNames = []; 24967 for (const i of t1)e1.materialOverrideNames.push(i); 24968 } else Object.entries(t1).forEach((param)=>{ 24969 let [t1, i] = param; 24970 const n = KA.arrayFromColorSpecification(i["model-color"]), r = { 24971 color: void 0 !== n ? new mn(n[0], n[1], n[2]) : new mn(1, 1, 1), 24972 colorMix: 0, 24973 emissionStrength: 0, 24974 opacity: 1 24975 }, o = i["model-color-mix-intensity"]; 24976 void 0 !== o && (r.colorMix = o); 24977 const a = i["model-emissive-strength"]; 24978 void 0 !== a && (r.emissionStrength = a); 24979 const s = i["model-opacity"]; 24980 void 0 !== s && (r.opacity = s), e1.materialOverrides.set(t1, r); 24981 }); 24982 } 24983 onAdd(e1) { 24984 this.map = e1, this.load(); 24985 } 24986 hasTransition() { 24987 return !1; 24988 } 24989 loaded() { 24990 if (0 === this._modelsInfo.size) return !0; 24991 for (const e1 of this._modelsInfo.values())if (null == e1.model) return !1; 24992 return !0; 24993 } 24994 getModels() { 24995 return this.models; 24996 } 24997 loadTile(e1, t1) {} 24998 serialize() { 24999 return this._options; 25000 } 25001 setProperty(e1, t1) { 25002 return !1; 25003 } 25004 reload() { 25005 this.cancelModelRequests(); 25006 const e1 = bl(this.id, this.scope); 25007 this.map.style.clearSource(e1), this.models = [], this._modelsInfo.clear(), this.load(); 25008 } 25009 onRemove(e1) { 25010 this.cancelModelRequests(); 25011 } 25012 setModels(e1) { 25013 this.models = []; 25014 const t1 = new Map; 25015 for(const i in e1){ 25016 const n = e1[i], r = this._modelsInfo.get(i); 25017 r && r.modelSpec.uri === n.uri && t1.set(i, r); 25018 } 25019 if (this._modelsInfo.size !== t1.size) { 25020 this.cancelModelRequests(); 25021 for (const [e1, i] of t1)i.model || t1.delete(e1); 25022 } 25023 this._modelsInfo = t1, this._options.models = e1, this.load(); 25024 } 25025 constructor(e1, t1, i, n){ 25026 super(), this.id = e1, this.type = "model", this.models = [], this._options = t1, this._modelsInfo = new Map, this._abortController = null; 25027 } 25028 } 25029 function QA(e1, t1, i) { 25030 try { 25031 t1 = function(e1) { 25032 if (!e1.variants) return e1;
vendor: 39,293 bytes, lines 25033-25652
25033 if (!Array.isArray(e1.variants)) throw new Error("variants must be an array"); 25034 let t1 = null, i = null; 25035 for (const n of e1.variants){ 25036 if (null == n || "object" != typeof n || n.constructor !== Object) throw new Error("variant must be an object"); 25037 if (!Array.isArray(n.capabilities)) throw new Error("capabilities must be an array"); 25038 1 === n.capabilities.length && ("meshopt-v2+lod" === n.capabilities[0] ? i = n : "meshopt" === n.capabilities[0] && (t1 = n)); 25039 } 25040 const n = null !== i ? i : t1; 25041 return null !== n ? Object.assign(e1, n) : e1; 25042 }(t1); 25043 } catch (e1) { 25044 return new Error("Failed to process TileJSON variants", { 25045 cause: e1 25046 }); 25047 } 25048 const n = at({ 25049 ...t1, 25050 ...e1 25051 }, [ 25052 "tilejson", 25053 "tiles", 25054 "minzoom", 25055 "maxzoom", 25056 "attribution", 25057 "mapbox_logo", 25058 "bounds", 25059 "extra_bounds", 25060 "scheme", 25061 "tileSize", 25062 "encoding", 25063 "vector_layers", 25064 "raster_layers", 25065 "worldview_options", 25066 "worldview_default", 25067 "worldview" 25068 ]); 25069 return e1.url && t1.tiles && e1.tiles && (n.tiles = t1.tiles), n.tiles = i.canonicalizeTileset(n, e1.url), n; 25070 } 25071 function eE(e1, t1, i, n, r) { 25072 const o = function(i, n) { 25073 if (i) return r(i); 25074 if (n) { 25075 e1.url && n.tiles && e1.tiles && delete e1.tiles; 25076 const i = QA(e1, n, t1); 25077 if (i instanceof Error) return r(i); 25078 r(null, i); 25079 } 25080 }, a = function(e1, t1, i) { 25081 if (!e1) return null; 25082 if (!t1 && !i) return e1; 25083 i = i || e1.worldview_default; 25084 const n = Object.values(e1.language || {}); 25085 if (0 === n.length) return null; 25086 const r = Object.values(e1.worldview || {}); 25087 if (0 === r.length) return null; 25088 const o = n.every((e1)=>e1 === t1), a = r.every((e1)=>e1 === i); 25089 return o && a ? e1 : t1 in (e1.language_options || {}) || i in (e1.worldview_options || {}) ? null : e1.language_options && e1.worldview_options ? e1 : null; 25090 }(e1.data, i, n); 25091 if (a) return kt.frame(()=>o(null, a)); 25092 if (e1.url) { 25093 const r = new AbortController; 25094 return (async ()=>{ 25095 const a = await t1.transformRequest(t1.normalizeSourceURL(e1.url, null, i, n), si.Source, r.signal), { data: s } = await mi(a, r.signal); 25096 o(null, s); 25097 })().catch((e1)=>{ 25098 r.signal.aborted || o(e1); 25099 }), { 25100 cancel: ()=>r.abort() 25101 }; 25102 } 25103 return kt.frame(()=>{ 25104 const { data: t1, ...i } = e1; 25105 o(null, i); 25106 }); 25107 } 25108 function tE(e1, t1) { 25109 const i = Math.pow(2, t1.z), n = Math.floor(dr(e1.getWest()) * i), r = Math.floor(fr(e1.getNorth()) * i), o = Math.ceil(dr(e1.getEast()) * i), a = Math.ceil(fr(e1.getSouth()) * i); 25110 return t1.x >= n && t1.x < o && t1.y >= r && t1.y < a; 25111 } 25112 class iE { 25113 validateBounds(e1) { 25114 return Array.isArray(e1) && 4 === e1.length ? [ 25115 Math.max(-180, e1[0]), 25116 Math.max(-90, e1[1]), 25117 Math.min(180, e1[2]), 25118 Math.min(90, e1[3]) 25119 ] : [ 25120 -180, 25121 -90, 25122 180, 25123 90 25124 ]; 25125 } 25126 addExtraBounds(e1) { 25127 if (e1) { 25128 this.extraBounds || (this.extraBounds = []); 25129 for (const t1 of e1)this.extraBounds.push(gc.convert(this.validateBounds(t1))); 25130 } 25131 } 25132 contains(e1) { 25133 if (e1.z > this.maxzoom || e1.z < this.minzoom) return !1; 25134 if (this.bounds && !tE(this.bounds, e1)) return !1; 25135 if (!this.extraBounds) return !0; 25136 for (const t1 of this.extraBounds)if (tE(t1, e1)) return !0; 25137 return !1; 25138 } 25139 static fromTileJSON(e1) { 25140 if (!e1.bounds && !e1.extra_bounds) return null; 25141 const t1 = new iE(e1.bounds, e1.minzoom, e1.maxzoom); 25142 return t1.addExtraBounds(e1.extra_bounds), t1; 25143 } 25144 constructor(e1, t1, i){ 25145 this.bounds = e1 ? gc.convert(this.validateBounds(e1)) : null, this.minzoom = t1 || 0, this.maxzoom = i || 24; 25146 } 25147 } 25148 const nE = { 25149 loaded: !0, 25150 drawModels: function(e1, t1, i, n) { 25151 if ("opaque" === e1.renderPass) return; 25152 const r = i.paint.get("model-opacity").constantOr(1), o = i.paint.get("model-elevation-reference"), a = "ground" === o, s = "ground" === o; 25153 if (0 === r) return; 25154 const l = i.paint.get("model-cast-shadows"); 25155 if ("shadow" === e1.renderPass) { 25156 if (!l) return; 25157 if (e1.terrain && r < .65 && i._transitionablePaint._values["model-opacity"].value.expression instanceof Ga) return; 25158 } 25159 const u = e1.shadowRenderer, h = i.paint.get("model-receive-shadows"); 25160 u && (u.useNormalOffset = !0, h || (u.enabled = !1)); 25161 const d = ()=>{ 25162 u && (u.useNormalOffset = !0, h || (u.enabled = !0)); 25163 }, _ = t1.getSource(); 25164 if ("light-beam" === e1.renderPass && "batched-model" !== _.type) return; 25165 if ("vector" === _.type || "geojson" === _.type) return function(e1, t1, i, n, r) { 25166 const o = e1.transform, a = "globe" === o.projection.name, s = o.getFreeCameraOptions().position; 25167 if (!e1.modelManager) return; 25168 const l = e1.modelManager; 25169 i.modelManager = l; 25170 const u = e1.shadowRenderer; 25171 if (!Object.hasOwn(i._unevaluatedLayout._values, "model-id")) return; 25172 const h = i._unevaluatedLayout._values["model-id"], d = { 25173 ...i.layout.get("model-id").parameters 25174 }, f = e1.style.order.indexOf(i.fqid), p = i.paint.get("model-opacity").constantOr(1); 25175 for (const m of n){ 25176 const n = t1.getTile(m).getBucket(i); 25177 if (!n || n.projection.name !== o.projection.name) continue; 25178 const _ = n.getModelUris(); 25179 if (_ && !n.modelsRequested && (l.addModelsFromBucket(_, r), n.modelsRequested = !0), a) d.zoom = m.overscaledZ; 25180 else { 25181 const e1 = Kw(m, o); 25182 d.zoom = e1; 25183 } 25184 const g = h.possiblyEvaluate(d); 25185 if (Yw(e1, n, m), Jw.shadowUniformsInitialized = !1, Jw.useSingleShadowCascade = !!u && 0 === u.getMaxCascadeForTile(m.toUnwrapped()), "shadow" === e1.renderPass && u) { 25186 if (1 === e1.currentShadowCascade && n.isInsideFirstShadowMapFrustum) continue; 25187 const t1 = o.calculatePosMatrix(m.toUnwrapped(), o.worldSize); 25188 if (Jw.tileMatrix.set(t1), Jw.shadowTileMatrix.set(u.calculateShadowPassMatrixFromMatrix(t1)), Jw.aabb.min = [ 25189 0, 25190 0, 25191 0 25192 ], Jw.aabb.max[0] = Jw.aabb.max[1] = zr, Jw.aabb.max[2] = 0, tA(n, Jw, e1, i.scope)) continue; 25193 } 25194 const y = 1 << m.canonical.z, x = [ 25195 ((s.x - m.wrap) * y - m.canonical.x) * zr, 25196 (s.y * y - m.canonical.y) * zr, 25197 s.z * y * zr 25198 ]; 25199 e1.conflationActive && Object.keys(n.instancesPerModel).length > 0 && e1.style.isLayerClipped(i, t1.getSource()) && n.updateReplacement(m, e1.replacementSource, f, i.scope) && (n.uploaded = !1, n.upload(e1.context)); 25200 let v = 0; 25201 const A = new Array, M = new Array, T = new Array; 25202 for(let t1 in n.instancesPerModel){ 25203 const o = n.instancesPerModel[t1]; 25204 o.features.length > 0 && !a && (t1 = g.evaluate(o.features[0].feature, {})); 25205 const u = l.getModel(t1, r); 25206 if (u || l.hasURLBeenRequested(t1) || n.modelUris.includes(t1) || (n.modelUris.push(t1), n.modelsRequested = !1), u && u.uploaded) if (a) { 25207 const t1 = k([], [ 25208 s.x, 25209 s.y, 25210 s.z 25211 ], e1.transform.worldSize); 25212 $(t1, t1); 25213 for(let i = 0; i < o.instancedDataArray.length; ++i){ 25214 const r = [ 25215 0, 25216 0, 25217 0 25218 ], a = [ 25219 1, 25220 1, 25221 1 25222 ], s = ce(), l = o.tileCoordinatesForInstance(i), h = o.transformForInstance(i); 25223 E(a, h), I(s, h), he(r, s); 25224 const d = o.translationForInstance(i), f = new _c(0, 0); 25225 Iw(n.canonical, f, l.x, l.y); 25226 const m = c(); 25227 dy(m, u, e1.transform, f, r, a, d, !0, !1, !1); 25228 const _ = o.colorForInstance(i), g = b([], t1), y = w([], [ 25229 1, 25230 1, 25231 1 / Ac(f.lat, e1.transform.zoom) 25232 ]); 25233 T.push({ 25234 zScaleMatrix: y, 25235 negCameraPosMatrix: g 25236 }); 25237 for (const t1 of u.nodes)Hw(e1, t1, m, e1.transform.expandedFarZProjMatrix, v, A, M, u.materialOverrides, p, _); 25238 ++v; 25239 } 25240 } else for (const t1 of u.nodes)Qw(e1, i, t1, o, x, m, Jw); 25241 } 25242 if (a) if ("shadow" === e1.renderPass) { 25243 for (const t1 of M)$w(t1.mesh, t1.nodeModelMatrix, e1, i); 25244 for (const t1 of A)$w(t1.mesh, t1.nodeModelMatrix, e1, i); 25245 } else Xw(e1, i, A, M, T); 25246 } 25247 }(e1, t1, i, n, Gw(e1, i)), void d(); 25248 if (!_.loaded()) return; 25249 if ("batched-model" === _.type) return function(e1, t1, i, n) { 25250 i.resetLayerRenderingStats(e1); 25251 const r = e1.context, o = e1.transform, a = e1.style.fog, s = e1.shadowRenderer; 25252 if ("mercator" !== o.projection.name) return void gt("Drawing 3D landmark models for ".concat(o.projection.name, " projection is not yet implemented")); 25253 const l = e1.transform.getFreeCameraOptions().position, c = k([], [ 25254 l.x, 25255 l.y, 25256 l.z 25257 ], e1.transform.worldSize), u = b([], $([], c)), h = Ac(o.center.lat, o.zoom), d = m([], u, w([], [ 25258 1, 25259 1, 25260 1 / h 25261 ])), _ = i.paint.get("model-opacity").constantOr(1), y = new Xb(r.gl.LEQUAL, Xb.ReadWrite, e1.depthRangeFor3D), x = new Xb(r.gl.LEQUAL, Xb.ReadOnly, e1.depthRangeFor3D), v = new Rf([ 25262 1 / 0, 25263 1 / 0, 25264 1 / 0 25265 ], [ 25266 -1 / 0, 25267 -1 / 0, 25268 -1 / 0 25269 ]), A = "shadow" === e1.renderPass, E = "light-beam" === e1.renderPass, I = "none" === i.paint.get("model-color-use-theme").constantOr("default"), M = A && s ? s.getCurrentCascadeFrustum() : o.getFrustum(o.scaleZoom(o.worldSize)), T = i.paint.get("model-front-cutoff"), S = T[2] < 1, z = bw(e1, i.paint.get("model-cutoff-fade-range")), P = i.getLayerRenderingStats(); 25270 (function(e1, t1, i, n) { 25271 const r = e1.terrain ? e1.terrain.exaggeration() : 0, o = e1.transform.zoom; 25272 for (const a of n){ 25273 const n = t1.getTile(a).getBucket(i); 25274 n && (n.setFilter(i.filter), e1.conflationActive && n.updateReplacement(a, e1.replacementSource), n.evaluateTransform(e1, i), e1.terrain && r > 0 && n.elevationUpdate(e1.terrain, r, a, i.source), n.needsReEvaluation(e1, o, i) && n.evaluate(i)); 25275 } 25276 })(e1, t1, i, n), function() { 25277 const l = new Map; 25278 let u, b, w; 25279 S ? (u = n.length - 1, b = -1, w = -1) : (u = 0, b = n.length, w = 1); 25280 const D = R(), F = new Pe(0, 0); 25281 for(let R = u; R !== b; R += w){ 25282 const u = n[R], b = t1.getTile(u).getBucket(i); 25283 if (!b || !b.uploaded) continue; 25284 let w = !1; 25285 s && (w = 0 === s.getMaxCascadeForTile(u.toUnwrapped())); 25286 const C = o.calculatePosMatrix(u.toUnwrapped(), o.worldSize), L = !!(4 & b.modelTraits); 25287 m(Rw, d, C), m(Pw, o.expandedFarZProjMatrix, C), p(Dw, Rw), f(Dw, Dw); 25288 const O = !A && s && s.enabled ? s.computeCascadeTileMatrices(C) : null; 25289 !A && S && (p(Sw, C), Y(D, c, Sw), F.x = D[0], F.y = D[1]); 25290 const B = []; 25291 b.setFilter(i.filter); 25292 for (const t1 of b.getNodesInfo()){ 25293 if (t1.hiddenByReplacement) continue; 25294 if (!t1.node.meshes) continue; 25295 const i = t1.node; 25296 let n = 0; 25297 e1.terrain && i.elevation && (n = i.elevation * e1.terrain.exaggeration()); 25298 const r = ()=>{ 25299 const e1 = t1.aabb, i = v.min, r = v.max; 25300 return i[0] = e1.min[0], i[1] = e1.min[1], i[2] = e1.min[2] + n, r[0] = e1.max[0], r[1] = e1.max[1], r[2] = e1.max[2] + n, Y(i, i, C), Y(r, r, C), v; 25301 }, a = r(), s = t1.evaluatedScale; 25302 if (s[0] <= 1 && s[1] <= 1 && s[2] <= 1 && 0 === a.intersects(M)) continue; 25303 if (!A) { 25304 const i = a.min, n = a.max; 25305 Ow[0] = .5 * (i[0] + n[0]), Ow[1] = .5 * (i[1] + n[1]), Ow[2] = .5 * (i[2] + n[2]); 25306 const r = j(c, Ow) * h, o = e1._debugParams.lodSwitchDistance, l = o >= 0; 25307 if (l && o >= 9999) t1.targetLod = 0; 25308 else { 25309 let a; 25310 if (l) a = o; 25311 else { 25312 const e1 = (n[2] - i[2]) * h * s[2], t1 = Math.max(n[0] - i[0], n[1] - i[1]) * h * Math.max(s[0], s[1]); 25313 let r; 25314 r = e1 >= 30 ? 1 : t1 >= 80 ? .5 : Math.max(e1, t1) >= 20 ? .25 : 0, a = 2e3 + 3e3 * r; 25315 } 25316 eA(t1, r, Math.min(e1.frameTimeDelta, 1e3 / 30), a, e1._debugParams.lodSwitchFadeDuration); 25317 } 25318 } 25319 if (!A && S) { 25320 const e1 = 1 / 6; 25321 t1.cameraCollisionOpacity = c[0] > a.min[0] && c[0] < a.max[0] && c[1] > a.min[1] && c[1] < a.max[1] && c[2] * h < a.max[2] && i.footprint && Gp(F, i.footprint) ? Math.max(t1.cameraCollisionOpacity - e1, 0) : Math.min(1, t1.cameraCollisionOpacity + e1); 25322 } 25323 const l = 1 / Ic(u.canonical), d = i.anchor ? i.anchor[0] : 0, f = i.anchor ? i.anchor[1] : 0, p = [ 25324 d * (s[0] - 1) + t1.evaluatedTranslation[0] * l, 25325 f * (s[1] - 1) + t1.evaluatedTranslation[1] * l, 25326 n + t1.evaluatedTranslation[2] 25327 ], g = kw(new Float64Array(16), C, p, s), y = m([], g, i.globalMatrix), x = m([], o.expandedFarZProjMatrix, y), b = x[2] * d + x[6] * f + x[10] * n + x[14]; 25328 i.hidden = !1; 25329 let w = _; 25330 A || (S && (w *= t1.cameraCollisionOpacity, w *= nA(g, o, t1.aabb, T)), w *= iA(z, b)), 0 !== w ? B.push({ 25331 nodeInfo: t1, 25332 depth: b, 25333 opacity: w, 25334 wvpForNode: x, 25335 nodeModelMatrix: y, 25336 tileModelMatrix: g, 25337 tileTranslation: p 25338 }) : i.hidden = !0; 25339 } 25340 A || B.sort((e1, t1)=>!S || 1 === e1.opacity && 1 === t1.opacity ? e1.depth < t1.depth ? -1 : 1 : 1 === e1.opacity ? -1 : 1 === t1.opacity ? 1 : e1.depth > t1.depth ? -1 : 1); 25341 for (const t1 of B){ 25342 const n = t1.nodeInfo, c = n.node; 25343 let u = null; 25344 if (e1._debugParams.show3DModelFootprints && c.footprint) { 25345 const e1 = c.id || c.name || "footprint"; 25346 if (!l.has(e1)) { 25347 const i = kw(new Float64Array(16), Pw, t1.tileTranslation, t1.nodeInfo.evaluatedScale); 25348 l.set(e1, { 25349 node: c, 25350 mvp: i 25351 }); 25352 } 25353 } 25354 const h = t1.nodeInfo.evaluatedScale; 25355 kw(Tw, Rw, t1.tileTranslation, h), Cw[0] = 1 / h[0], Cw[1] = -1 / h[1], Cw[2] = 1 / h[2], g(Sw, Dw, Cw), m(Tw, Tw, c.globalMatrix); 25356 const d = L ? 0 : n.evaluatedRMEA[0][2], f = n.targetLod, p = c.lodMeshes && c.lodMeshes.length > 0, _ = p && f > 0 && f < 1; 25357 if (A && p && 1 === Math.round(f)) continue; 25358 const v = !A && a ? Nw(zw, t1.nodeModelMatrix, e1.transform) : null, b = A && s ? s.calculateShadowPassMatrixFromMatrix(t1.nodeModelMatrix) : null, M = _ ? 2 : 1, T = p && 1 === Math.round(f); 25359 for(let l = 0; l < M; ++l){ 25360 const h = _ ? 1 === l : T, p = h ? c.lodMeshes : c.meshes, m = _ ? h ? -f : 1 - f : 1; 25361 for(let l = 0; l < p.length; ++l){ 25362 const f = p[l], g = !h && l === c.lightMeshIndex; 25363 let M = t1.wvpForNode; 25364 if (g) { 25365 if (!E && !e1.terrain && e1.shadowRenderer) { 25366 e1.currentLayer < e1.firstLightBeamLayer && (e1.firstLightBeamLayer = e1.currentLayer); 25367 continue; 25368 } 25369 M = kw(Fw, Pw, t1.tileTranslation, t1.nodeInfo.evaluatedScale); 25370 } else if (E) continue; 25371 const T = { 25372 defines: [] 25373 }, S = [], z = !!f.normalBuffer; 25374 if (!A && s && (s.useNormalOffset = z), Uw(T.defines, S, f, e1, I ? null : i.lut), L || T.defines.push("DIFFUSE_SHADED"), w && T.defines.push("SHADOWS_SINGLE_CASCADE"), P && (A ? P.numRenderedVerticesInShadowPass += f.vertexArray.length : P.numRenderedVerticesInTransparentPass += f.vertexArray.length), A) { 25375 $w(f, t1.nodeModelMatrix, e1, i, b); 25376 continue; 25377 } 25378 if (a && "globe" !== o.projection.name) { 25379 const e1 = f.aabb.min, t1 = f.aabb.max, [i, n] = a.getOpacityForBounds(v, e1[0], e1[1], t1[0], t1[1]); 25380 T.overrideFog = i >= ww || n >= ww; 25381 } 25382 const R = f.material; 25383 let D; 25384 R.occlusionTexture && R.occlusionTexture.offsetScale && (D = R.occlusionTexture.offsetScale, T.defines.push("OCCLUSION_TEXTURE_TRANSFORM")), _ && T.defines.push("DITHERED_DISCARD"); 25385 const F = e1.getOrCreateProgram("model", T); 25386 if (!A && s && s.enabled) if (u !== z) { 25387 for(let e1 = 0; e1 < O.length; e1++)kw(Vw[e1] = Vw[e1] || new Float64Array(16), O[e1], t1.tileTranslation, t1.nodeInfo.evaluatedScale); 25388 s.setupShadowsFromCascadeMatrices(Vw, F, z), u = z; 25389 } else F.setShadowUniformValues(r, s.getShadowUniformValues()); 25390 e1.uploadCommonUniforms(r, F, null, v); 25391 const C = R.pbrMetallicRoughness; 25392 C.metallicFactor = .9, C.roughnessFactor = .5; 25393 const B = jb(M, Tw, Sw, c.globalMatrix, e1, t1.opacity, C.baseColorFactor, R.emissiveFactor, C.metallicFactor, C.roughnessFactor, R, d, i, Bw, D, void 0, void 0, m, F.fixedDefines.includes("LIGHTING_3D_MODE")); 25394 !g && (n.hasTranslucentParts || t1.opacity < 1) && F.draw(e1, r.gl.TRIANGLES, y, $b.disabled, qb.disabled, Kb.backCCW, B, i.id, f.vertexBuffer, f.indexBuffer, f.segments, i.paint, e1.transform.zoom, void 0, S), F.draw(e1, r.gl.TRIANGLES, g ? x : y, $b.disabled, g || t1.opacity < 1 || n.hasTranslucentParts ? qb.alphaBlended : qb.unblended, Kb.backCCW, B, i.id, f.vertexBuffer, f.indexBuffer, f.segments, i.paint, e1.transform.zoom, void 0, S); 25395 } 25396 } 25397 } 25398 } 25399 if (e1._debugParams.show3DModelFootprints && l.size > 0) { 25400 const t1 = Array.from(l.keys()).sort(); 25401 for (const i of t1){ 25402 const { node: t1, mvp: n } = l.get(i); 25403 Zw(e1, 0, t1, n); 25404 } 25405 } 25406 }(); 25407 }(e1, t1, i, n), void d(); 25408 if ("model" !== _.type) return; 25409 const y = _.getModels(), x = [], v = e1.transform.getFreeCameraOptions().position, A = k([], [ 25410 v.x, 25411 v.y, 25412 v.z 25413 ], e1.transform.worldSize); 25414 $(A, A); 25415 const M = [], T = []; 25416 let S = 0; 25417 for (const n of y){ 25418 const r = t1.getFeatureState("", n.id), o = { 25419 type: "Unknown", 25420 id: n.id, 25421 properties: n.featureProperties 25422 }, l = i.paint.get("model-rotation").evaluate(o, r), c = i.paint.get("model-scale").evaluate(o, r), u = i.paint.get("model-translation").evaluate(o, r), h = i.paint.get("model-opacity").evaluate(o, r); 25423 Ww(i, n.id, r, n.featureProperties, n.nodeOverrideNames, n.nodeOverrides), qw(i, n.id, r, n.featureProperties, n.materialOverrideNames, n.materialOverrides), n.nodeOverrides.size > 0 && n.computeBoundsAndApplyParent(), n.computeModelMatrix(e1, l, c, u, s, a, !1); 25424 const d = b([], A), f = w([], [ 25425 1, 25426 1, 25427 1 / Ac(n.position.lat, e1.transform.zoom) 25428 ]); 25429 x.push({ 25430 zScaleMatrix: f, 25431 negCameraPosMatrix: d 25432 }); 25433 for (const t1 of n.nodes)Hw(e1, t1, n.matrix, e1.transform.expandedFarZProjMatrix, S, M, T, n.materialOverrides, h, void 0, n.lightOverrides); 25434 S++; 25435 } 25436 if (M.sort((e1, t1)=>t1.depth - e1.depth), "shadow" !== e1.renderPass) { 25437 if (e1._debugParams.show3DModelFootprints) { 25438 const t1 = e1.transform.projMatrix, i = new Map, n = (e1, n)=>{ 25439 if (e1.footprint) { 25440 const r = e1.id || e1.name || "footprint"; 25441 if (!i.has(r)) { 25442 const o = m([], t1, n); 25443 i.set(r, { 25444 node: e1, 25445 mvp: o 25446 }); 25447 } 25448 } 25449 }; 25450 for (const e1 of T)n(e1.node, e1.modelMatrix); 25451 for (const e1 of M)n(e1.node, e1.modelMatrix); 25452 const r = Array.from(i.keys()).sort(); 25453 for (const t1 of r){ 25454 const { node: n, mvp: r } = i.get(t1); 25455 Zw(e1, 0, n, r); 25456 } 25457 } 25458 Xw(e1, i, M, T, x), d(); 25459 } else { 25460 for (const t1 of T)$w(t1.mesh, t1.nodeModelMatrix, e1, i); 25461 for (const t1 of M)$w(t1.mesh, t1.nodeModelMatrix, e1, i); 25462 d(); 25463 } 25464 }, 25465 prepare: function(e1, t1, i) { 25466 const n = t1.getSource(); 25467 if (!n.loaded()) return; 25468 if ("vector" === n.type || "geojson" === n.type) return void (i.modelManager && i.modelManager.upload(i, Gw(i, e1))); 25469 if ("batched-model" === n.type) return; 25470 if ("model" !== n.type) return; 25471 const r = n.getModels(); 25472 for (const e1 of r)e1.upload(i.context); 25473 }, 25474 shaders: DA, 25475 programUniforms: UA, 25476 ShadowRenderer: class { 25477 destroy() { 25478 for (const e1 of this._cascades)e1.texture.destroy(), e1.framebuffer.destroy(); 25479 this._cascades = []; 25480 } 25481 updateShadowParameters(e1, t1) { 25482 const i = this.painter; 25483 if (this._enabled = !1, this._drawShadowAfterLayer = -1, this._receivers.clear(), !t1 || !t1.properties) return; 25484 const n = t1.properties.get("shadow-intensity"), r = t1.properties.get("shadow-draw-before-layer"); 25485 if (!t1.shadowsEnabled() || n <= 0) return; 25486 let o = -1, a = 0; 25487 for (const t1 of i.style.order){ 25488 const n = i.style._mergedLayers[t1]; 25489 n.hasShadowPass() && !n.isHidden(e1.zoom) && (o = a), !r || r !== t1 && r !== n.slot || (this._drawShadowAfterLayer = a > 0 ? a - 1 : 0), a += 1; 25490 } 25491 if (this._enabled = o >= 0, !this.enabled) return; 25492 this._drawShadowAfterLayer < 0 && (this._drawShadowAfterLayer = o); 25493 const s = i.context, l = this._shadowParameters.shadowMapResolution, c = this._shadowParameters.shadowMapResolution; 25494 if (0 === this._cascades.length || this._shadowParameters.shadowMapResolution !== this._cascades[0].texture.size[0]) { 25495 this._cascades = []; 25496 for(let e1 = 0; e1 < this._shadowParameters.cascadeCount; ++e1){ 25497 const e1 = s.gl, t1 = s.createFramebuffer(l, c, 0, "texture"), i = new mm(s, { 25498 width: l, 25499 height: c, 25500 data: null 25501 }, e1.DEPTH_COMPONENT16); 25502 t1.depthAttachment.set(i.texture), this._cascades.push({ 25503 framebuffer: t1, 25504 texture: i, 25505 matrix: [], 25506 far: 0, 25507 boundingSphereRadius: 0, 25508 frustum: new zf, 25509 scale: 0 25510 }); 25511 } 25512 } 25513 this.shadowDirection = jA(t1); 25514 let u = 0; 25515 if (e1.elevation) { 25516 const t1 = e1.elevation, i = [ 25517 1e4, 25518 -1e4 25519 ]; 25520 t1.visibleDemTiles.filter((e1)=>e1.dem).forEach((e1)=>{ 25521 const t1 = e1.dem.tree; 25522 i[0] = Math.min(i[0], t1.minimums[0]), i[1] = Math.max(i[1], t1.maximums[0]); 25523 }), 1e4 !== i[0] && (u = (i[1] - i[0]) * t1.exaggeration()); 25524 } 25525 const h = 1.5 * e1.cameraToCenterDistance, d = 3 * h, f = new Float64Array(16); 25526 for(let t1 = 0; t1 < this._cascades.length; ++t1){ 25527 const i = this._cascades[t1]; 25528 let n = e1.height / 50, r = 1; 25529 1 === this._shadowParameters.cascadeCount ? r = d : 0 === t1 ? r = h : (n = h, r = d); 25530 const [o, a] = JA(e1, this.shadowDirection, n, r, this._shadowParameters.shadowMapResolution, u); 25531 i.scale = e1.scale, i.matrix = o, i.boundingSphereRadius = a, p(f, i.matrix), i.frustum = zf.fromInvProjectionMatrix(f, 1, 0, !0), i.far = r; 25532 } 25533 const m = this._cascades.length - 1; 25534 this._uniformValues.u_fade_range = [ 25535 .75 * this._cascades[m].far, 25536 this._cascades[m].far 25537 ], this._uniformValues.u_shadow_intensity = n, this._uniformValues.u_shadow_direction = [ 25538 this.shadowDirection[0], 25539 this.shadowDirection[1], 25540 this.shadowDirection[2] 25541 ], this._uniformValues.u_shadow_texel_size = 1 / this._shadowParameters.shadowMapResolution, this._uniformValues.u_shadow_map_resolution = this._shadowParameters.shadowMapResolution, this._uniformValues.u_shadowmap_0 = Nb.ShadowMap0, this._uniformValues.u_shadowmap_1 = Nb.ShadowMap0 + 1, this._groundShadowTiles = i.transform.coveringTiles({ 25542 tileSize: 512, 25543 renderWorldCopies: !0 25544 }); 25545 const _ = i.transform.elevation; 25546 for (const e1 of this._groundShadowTiles){ 25547 let t1 = { 25548 min: 0, 25549 max: 0 25550 }; 25551 if (_) { 25552 const i = _.getMinMaxForTile(e1); 25553 i && (t1 = i); 25554 } 25555 this.addShadowReceiver(e1.toUnwrapped(), t1.min, t1.max); 25556 } 25557 } 25558 get enabled() { 25559 return this._enabled && !this._forceDisable; 25560 } 25561 set enabled(e1) { 25562 this._enabled = e1; 25563 } 25564 drawShadowPass(e1, t1) { 25565 if (!this.enabled) return; 25566 const i = this.painter, n = i.context; 25567 this._numCascadesToRender = this._receivers.computeRequiredCascades(i.transform.getFrustum(0), i.transform.worldSize, this._cascades), n.viewport.set([ 25568 0, 25569 0, 25570 this._shadowParameters.shadowMapResolution, 25571 this._shadowParameters.shadowMapResolution 25572 ]); 25573 for(let r = 0; r < this._numCascadesToRender; ++r){ 25574 i.currentShadowCascade = r, n.bindFramebuffer.set(this._cascades[r].framebuffer.framebuffer), n.clear({ 25575 color: mn.white, 25576 depth: 1 25577 }); 25578 for (const n of e1.order){ 25579 const r = e1._mergedLayers[n]; 25580 if (!r.hasShadowPass() || r.isHidden(i.transform.zoom)) continue; 25581 const o = e1.getLayerSourceCache(r), a = o ? t1[o.id] : void 0; 25582 ("model" === r.type || a && a.length) && i.renderLayer(i, o, r, a); 25583 } 25584 } 25585 i.currentShadowCascade = 0; 25586 } 25587 drawGroundShadows() { 25588 if (!this.enabled) return; 25589 const e1 = this.painter, t1 = e1.style, i = e1.context, n = i.gl, r = t1.directionalLight, o = t1.ambientLight; 25590 if (!r || !o) return; 25591 const a = [], s = bw(e1, e1.longestCutoffRange); 25592 s.shouldRenderCutoff && a.push("RENDER_CUTOFF"), a.push("RENDER_SHADOWS"), this.useNormalOffset && a.push("NORMAL_OFFSET"); 25593 const l = GA(t1, r, o), c = new Xb(n.LEQUAL, Xb.ReadOnly, e1.depthRangeFor3D), u = new $b({ 25594 func: n.EQUAL, 25595 mask: 255 25596 }, 0, 255, n.KEEP, n.KEEP, n.KEEP); 25597 for (const t1 of this._groundShadowTiles){ 25598 const r = t1.toUnwrapped(), o = e1.isTileAffectedByFog(t1), h = e1.getOrCreateProgram("groundShadow", { 25599 defines: a, 25600 overrideFog: o 25601 }); 25602 this.setupShadows(r, h), e1.uploadCommonUniforms(i, h, r, null, s); 25603 const d = FA(e1.transform.calculateProjMatrix(r), l); 25604 h.draw(e1, n.TRIANGLES, c, u, qb.multiply, Kb.disabled, d, "ground_shadow", e1.tileExtentBuffer, e1.quadTriangleIndexBuffer, e1.tileExtentSegments, null, e1.transform.zoom, null, null); 25605 } 25606 } 25607 getShadowPassDepthMode() { 25608 return this._depthMode; 25609 } 25610 getGroundShadowLayerIndex() { 25611 return this._drawShadowAfterLayer; 25612 } 25613 calculateShadowPassMatrixFromTile(e1) { 25614 const t1 = this.painter.transform, i = t1.calculatePosMatrix(e1, t1.worldSize); 25615 return m(i, this._cascades[this.painter.currentShadowCascade].matrix, i), Float32Array.from(i); 25616 } 25617 calculateShadowPassMatrixFromMatrix(e1) { 25618 return m(WA, this._cascades[this.painter.currentShadowCascade].matrix, e1); 25619 } 25620 setupShadows(e1, t1, i) { 25621 if (!this.enabled) return; 25622 const n = this.painter.transform, r = this.painter.context, o = r.gl, a = this._uniformValues, s = n.calculatePosMatrix(e1, n.worldSize); 25623 for(let e1 = 0; e1 < this._cascades.length; e1++){ 25624 const t1 = $A(e1); 25625 m(t1, this._cascades[e1].matrix, s), a[0 === e1 ? "u_light_matrix_0" : "u_light_matrix_1"] = t1, r.activeTexture.set(o.TEXTURE0 + Nb.ShadowMap0 + e1), this._cascades[e1].texture.bindExtraParam(o.LINEAR, o.LINEAR, o.CLAMP_TO_EDGE, o.CLAMP_TO_EDGE, o.GREATER); 25626 } 25627 if (this.useNormalOffset = !!i, this.useNormalOffset) { 25628 const t1 = Ic(e1.canonical), r = 2 / n.tileSize * zr / this._shadowParameters.shadowMapResolution, o = r * this._cascades[0].boundingSphereRadius, s = r * this._cascades.at(-1).boundingSphereRadius, l = ("vector-tile" === i ? 1 : 3) * function(e1) { 25629 const t1 = it((e1 - 22) / -22, 0, 1); 25630 return .125 * (1 - t1) + 4 * t1; 25631 }(n.zoom); 25632 a.u_shadow_normal_offset = [ 25633 t1, 25634 o * l, 25635 s * l 25636 ], a.u_shadow_bias = [ 25637 1e-4, 25638 .0012, 25639 .012 25640 ]; 25641 } else a.u_shadow_bias = [ 25642 36e-5, 25643 .0012, 25644 .012 25645 ]; 25646 t1.setShadowUniformValues(r, a); 25647 } 25648 computeCascadeTileMatrices(e1) { 25649 const t1 = this._shadowParameters.cascadeCount; 25650 for(let i = 0; i < t1; i++)m(ZA[i] = ZA[i] || new Float64Array(16), this._cascades[i].matrix, e1); 25651 return ZA.length = t1, ZA; 25652 }
25653 setupShadowsFromMatrix(e1, t1) { 25654 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 25655 if (!this.enabled) return; 25656 const n = this._shadowParameters.cascadeCount; 25657 for(let t1 = 0; t1 < n; t1++)m($A(t1), this._cascades[t1].matrix, e1); 25658 HA.length = n, this.setupShadowsFromCascadeMatrices(HA, t1, i); 25659 } 25660 setupShadowsFromCascadeMatrices(e1, t1) { 25661 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 25662 if (!this.enabled) return; 25663 const n = this.painter.context, r = n.gl, o = this._uniformValues; 25664 for(let t1 = 0; t1 < this._shadowParameters.cascadeCount; t1++)o[0 === t1 ? "u_light_matrix_0" : "u_light_matrix_1"] = e1[t1], n.activeTexture.set(r.TEXTURE0 + Nb.ShadowMap0 + t1), this._cascades[t1].texture.bindExtraParam(r.LINEAR, r.LINEAR, r.CLAMP_TO_EDGE, r.CLAMP_TO_EDGE, r.GREATER); 25665 if (this.useNormalOffset = i, i) { 25666 const e1 = this._shadowParameters.normalOffset; 25667 o.u_shadow_normal_offset = [ 25668 1, 25669 e1, 25670 e1 25671 ], o.u_shadow_bias = [ 25672 6e-5, 25673 .0012, 25674 .012 25675 ]; 25676 } else o.u_shadow_bias = [ 25677 36e-5, 25678 .0012, 25679 .012 25680 ]; 25681 t1.setShadowUniformValues(n, o); 25682 } 25683 getShadowUniformValues() { 25684 return this._uniformValues; 25685 } 25686 getCurrentCascadeFrustum() { 25687 return this._cascades[this.painter.currentShadowCascade].frustum; 25688 } 25689 computeSimplifiedTileShadowVolume(e1, t1, i, n) { 25690 if (n[2] >= 0) return {}; 25691 const r = (function(e1, t1, i) { 25692 const n = i / (1 << e1.canonical.z); 25693 return new Rf([ 25694 e1.canonical.x * n + e1.wrap * i, 25695 e1.canonical.y * n + e1.wrap * i, 25696 0 25697 ], [ 25698 (e1.canonical.x + 1) * n + e1.wrap * i, 25699 (e1.canonical.y + 1) * n + e1.wrap * i, 25700 t1 25701 ]); 25702 })(e1, t1, i).getCorners(), o = t1 / -n[2]; 25703 n[0] < 0 ? (L(r[0], r[0], [ 25704 n[0] * o, 25705 0, 25706 0 25707 ]), L(r[3], r[3], [ 25708 n[0] * o, 25709 0, 25710 0 25711 ])) : n[0] > 0 && (L(r[1], r[1], [ 25712 n[0] * o, 25713 0, 25714 0 25715 ]), L(r[2], r[2], [ 25716 n[0] * o, 25717 0, 25718 0 25719 ])), n[1] < 0 ? (L(r[0], r[0], [ 25720 0, 25721 n[1] * o, 25722 0 25723 ]), L(r[1], r[1], [ 25724 0, 25725 n[1] * o, 25726 0 25727 ])) : n[1] > 0 && (L(r[2], r[2], [ 25728 0, 25729 n[1] * o, 25730 0 25731 ]), L(r[3], r[3], [ 25732 0, 25733 n[1] * o, 25734 0 25735 ])); 25736 const a = {}; 25737 return a.vertices = r, a.planes = [ 25738 YA(r[1], r[0], r[4]), 25739 YA(r[2], r[1], r[5]), 25740 YA(r[3], r[2], r[6]), 25741 YA(r[0], r[3], r[7]) 25742 ], a; 25743 } 25744 addShadowReceiver(e1, t1, i) { 25745 this._receivers.add(e1, Rf.fromTileIdAndHeight(e1, t1, i)); 25746 } 25747 getMaxCascadeForTile(e1) { 25748 const t1 = this._receivers.get(e1); 25749 return t1 && t1.lastCascade ? t1.lastCascade : 0; 25750 } 25751 constructor(e1){ 25752 this.painter = e1, this._enabled = !1, this._drawShadowAfterLayer = -1, this._numCascadesToRender = 0, this._cascades = [], this._groundShadowTiles = [], this._receivers = new XA, this._depthMode = new Xb(e1.context.gl.LEQUAL, Xb.ReadWrite, [ 25753 0, 25754 1 25755 ]), this._uniformValues = { 25756 u_light_matrix_0: new Float32Array(16), 25757 u_light_matrix_1: new Float32Array(16), 25758 u_shadow_intensity: 0, 25759 u_fade_range: [ 25760 0, 25761 0 25762 ], 25763 u_shadow_normal_offset: [ 25764 1, 25765 1, 25766 1 25767 ], 25768 u_shadow_texel_size: 1, 25769 u_shadow_map_resolution: 1, 25770 u_shadow_direction: [ 25771 0, 25772 0, 25773 1 25774 ], 25775 u_shadow_bias: [ 25776 36e-5, 25777 .0012, 25778 .012 25779 ], 25780 u_shadowmap_0: 0, 25781 u_shadowmap_1: 0 25782 }, this._forceDisable = !1, this._devtoolsFolder = null, this.useNormalOffset = !1, this._shadowParameters = { 25783 cascadeCount: 2, 25784 normalOffset: 3, 25785 shadowMapResolution: 2048 25786 }; 25787 } 25788 }, 25789 drawGroundEffect: kA,
vendor: 4,201 bytes, lines 25790-25857
25790 queryModelLayerRendered: function(e1, t1, i, n) { 25791 const r = i.getSource(); 25792 if (!r || "model" !== r.type) return {}; 25793 const o = r, a = {}; 25794 a[e1.id] = []; 25795 const s = a[e1.id]; 25796 let l = 0; 25797 for (const r of o.models){ 25798 const o = i.getFeatureState(e1.sourceLayer, r.id), a = { 25799 type: "Unknown", 25800 id: r.id, 25801 properties: r.featureProperties 25802 }, c = e1.paint.get("model-rotation").evaluate(a, o), u = e1.paint.get("model-scale").evaluate(a, o), h = e1.paint.get("model-translation").evaluate(a, o), d = e1.paint.get("model-elevation-reference"); 25803 let f = []; 25804 dy(f, r, n, r.position, c, u, h, "ground" === d, "ground" === d, !1), "globe" === n.projection.name && (f = ly(f, n)); 25805 const p = m([], n.projMatrix, f), _ = cy(t1.isPointQuery() ? t1.screenBounds : t1.screenGeometry, n, p, r.aabb); 25806 if (null != _) { 25807 const t1 = new Vb(void 0, 0, 0, 0, r.id); 25808 t1.layer = e1.layer, t1.properties = structuredClone(r.featureProperties), t1.properties.layer = e1.id, t1.properties.uri = r.uri, t1.properties.orientation = r.orientation, t1.sourceLayer = e1.sourceLayer, t1.geometry = { 25809 type: "Point", 25810 coordinates: [ 25811 r.position.lng, 25812 r.position.lat 25813 ] 25814 }, t1.state = o, t1.source = e1.source, s.push({ 25815 featureIndex: l, 25816 feature: t1, 25817 intersectionZ: _ 25818 }); 25819 } 25820 ++l; 25821 } 25822 return a; 25823 }, 25824 queryModelLayerIntersectsFeature: function(e1, t1, i, n, r, o) { 25825 if (!e1.modelManager) return !1; 25826 const a = e1.modelManager, s = t1.tile.getBucket(e1); 25827 if (!(s && s instanceof vb)) return !1; 25828 for(const n in s.instancesPerModel){ 25829 const l = s.instancesPerModel[n], c = void 0 !== i.id ? i.id : i.properties && Object.hasOwn(i.properties, "id") ? i.properties.id : void 0; 25830 if (Object.hasOwn(l.idToFeaturesIndex, c)) { 25831 const i = l.features[l.idToFeaturesIndex[c]], u = a.getModel(n, o || e1.scope); 25832 if (!u) return !1; 25833 let h = []; 25834 const d = new _c(0, 0), f = s.canonical; 25835 let p = Number.MAX_VALUE; 25836 for(let e1 = 0; e1 < i.instancedDataCount; ++e1){ 25837 const n = 16 * (i.instancedDataOffset + e1), o = l.instancedDataArray.float32, a = [ 25838 o[n + 4], 25839 o[n + 5], 25840 o[n + 6] 25841 ]; 25842 Iw(f, d, Math.floor(o[n]), Math.floor(o[n + 1])), dy(h, u, r, d, i.rotation, i.scale, a, !1, !1, !1), "globe" === r.projection.name && (h = ly(h, r)); 25843 const s = m([], r.projMatrix, h), c = t1.queryGeometry, _ = cy(c.isPointQuery() ? c.screenBounds : c.screenGeometry, r, s, u.aabb); 25844 null != _ && (p = Math.min(_, p)); 25845 } 25846 return p !== Number.MAX_VALUE && p; 25847 } 25848 } 25849 return !1; 25850 }, 25851 loadMatchingModelFeature: function(e1, t1, i, n) { 25852 const r = e1.getNodesInfo()[t1]; 25853 if (!r || r.hiddenByReplacement || !r.node.meshes) return; 25854 let o = Number.MAX_VALUE; 25855 const a = r.node, s = i.tile, l = n.calculatePosMatrix(s.tileID.toUnwrapped(), n.worldSize), c = r.evaluatedScale; 25856 let u = 0; 25857 n.elevation && a.elevation && (u = a.elevation * n.elevation.exaggeration()), _(l, l, [
25858 (a.anchor ? a.anchor[0] : 0) * (c[0] - 1), 25859 (a.anchor ? a.anchor[1] : 0) * (c[1] - 1), 25860 u 25861 ]), g(l, l, c); 25862 const h = i.queryGeometry, d = h.isPointQuery() ? h.screenBounds : h.screenGeometry, f = function(e1) { 25863 const t1 = m([], l, e1.globalMatrix); 25864 m(t1, n.expandedFarZProjMatrix, t1); 25865 for(let i = 0; i < e1.meshes.length; ++i){ 25866 const r = e1.meshes[i]; 25867 if (i === e1.lightMeshIndex) continue; 25868 const a = cy(d, n, t1, r.aabb); 25869 null != a && (o = Math.min(a, o)); 25870 } 25871 if (e1.children) for (const t1 of e1.children)f(t1); 25872 }; 25873 if (f(a), o === Number.MAX_VALUE) return; 25874 const p = new _c(0, 0); 25875 return Iw(s.tileID.canonical, p, r.node.anchor[0], r.node.anchor[1]), { 25876 intersectionZ: o, 25877 position: p, 25878 feature: r.feature 25879 }; 25880 }, 25881 ModelSource: KA, 25882 Tiled3dModelSource: class extends ln { 25883 onAdd(e1) { 25884 this.map = e1, this.load(); 25885 } 25886 reload() { 25887 this.cancelTileJSONRequest(); 25888 const e1 = bl(this.id, this.scope); 25889 this.load(()=>this.map.style.clearSource(e1)); 25890 } 25891 cancelTileJSONRequest() { 25892 this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null); 25893 } 25894 load(e1) { 25895 this._loaded = !1, this.fire(new rn("dataloading", { 25896 dataType: "source" 25897 })); 25898 const t1 = Array.isArray(this.map._language) ? this.map._language.join() : this.map._language, i = this.map.getWorldview(); 25899 this._tileJSONRequest = eE(this._options, this.map._requestManager, t1, i, (n, r)=>{ 25900 this._tileJSONRequest = null, this._loaded = !0, n ? (t1 && console.warn("Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ".concat(t1)), i && 2 !== i.length && console.warn("Requested worldview strings must be a valid ISO alpha-2 code. Found: ".concat(i)), this.fire(new on(n))) : r && (Object.assign(this, r), r.bounds && (this.tileBounds = new iE(r.bounds, this.minzoom, this.maxzoom)), ji(r.tiles, this.map._requestManager._customAccessToken), this.fire(new rn("data", { 25901 dataType: "source", 25902 sourceDataType: "metadata" 25903 })), this.fire(new rn("data", { 25904 dataType: "source", 25905 sourceDataType: "content" 25906 }))), e1 && e1(n); 25907 }); 25908 } 25909 hasTransition() { 25910 return !1; 25911 } 25912 hasTile(e1) { 25913 return !this.tileBounds || this.tileBounds.contains(e1.canonical); 25914 } 25915 loaded() { 25916 return this._loaded; 25917 } 25918 async loadTile(e1, t1) { 25919 const i = this.map._requestManager.normalizeTileURL(e1.tileID.canonical.url(this.tiles, this.scheme)), n = !e1.actor || "expired" === e1.state; 25920 if (n) e1.actor = this.dispatcher.getActor(); 25921 else { 25922 if ("loading" === e1.state) return void (e1.reloadCallback = t1); 25923 if (e1.buckets) { 25924 const t1 = Object.values(e1.buckets); 25925 for (const e1 of t1)e1.dirty = !0; 25926 return void (e1.state = "loaded"); 25927 } 25928 } 25929 const r = n ? "loadTile" : "reloadTile", o = new AbortController; 25930 e1.request = o; 25931 const a = (i, n)=>(delete e1.request, e1.aborted ? t1(null) : i && !ci(i) ? t1(i) : (this.map._refreshExpiredTiles && n && e1.setExpiryData(At(n.headers)), e1.loadM
25931odelData(n, this.map.painter), e1.state = "loaded", t1(null), void (e1.reloadCallback && (this.loadTile(e1, e1.reloadCallback), e1.reloadCallback = null)))); 25932 try { 25933 const n = await this.map._requestManager.transformRequest(i, si.Tile, o.signal); 25934 if (o.signal.aborted) return t1(null); 25935 const s = { 25936 request: n, 25937 data: void 0, 25938 uid: e1.uid, 25939 tileID: e1.tileID, 25940 tileZoom: e1.tileZoom, 25941 zoom: e1.tileID.overscaledZ, 25942 tileSize: this.tileSize * e1.tileID.overscaleFactor(), 25943 type: this.type, 25944 source: this.id, 25945 scope: this.scope, 25946 showCollisionBoxes: this.map.showCollisionBoxes, 25947 renderSourceType: e1.renderSourceType, 25948 brightness: this.map.style && this.map.style.getBrightness() || 0, 25949 pixelRatio: kt.devicePixelRatio, 25950 promoteId: this.promoteId 25951 }; 25952 e1.request = e1.actor.sendCancelable(r, s, {}, a); 25953 } catch (e1) { 25954 if (o.signal.aborted) return t1(null); 25955 t1(e1); 25956 } 25957 } 25958 abortTile(e1) { 25959 e1.request && (e1.request.abort(), delete e1.request), e1.actor && e1.actor.notify("abortTile", { 25960 uid: e1.uid, 25961 type: this.type, 25962 source: this.id, 25963 scope: this.scope 25964 }); 25965 } 25966 serialize() { 25967 return { 25968 ...this._options 25969 }; 25970 } 25971 constructor(e1, t1, i, n){ 25972 super(), this.type = "batched-model", this.id = e1, this.tileSize = 512, this._options = t1, this.tiles = this._options.tiles, this.maxzoom = t1.maxzoom || 19, this.minzoom = t1.minzoom || 0, this.roundZoom = !0, this.usedInConflation = !0, this.dispatcher = i, this.reparseOverscaled = !1, this.scheme = "xyz", this._loaded = !1, this.setEventedParent(n); 25973 } 25974 }, 25975 loadModel: async function(e1, t1, i) { 25976 const n = await Gg(e1), r = new fy(t1, i, void 0, void 0, Fy(n)); 25977 return r.computeBoundsAndApplyParent(), r; 25978 } 25979 }; 25980 class rE { 25981 insert(e1, t1, i, n, r) { 25982 let o = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0, a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 0; 25983 const s = this.featureIndexArray.length; 25984 this.featureIndexArray.emplaceBack(i, n, r, o); 25985 const l = this.grid; 25986 for(let e1 = 0; e1 < t1.length; e1++){ 25987 const i = t1[e1], n = [ 25988 1 / 0, 25989 1 / 0, 25990 -1 / 0, 25991 -1 / 0 25992 ]; 25993 for(let e1 = 0; e1 < i.length; e1++){ 25994 const t1 = i[e1]; 25995 n[0] = Math.min(n[0], t1.x), n[1] = Math.min(n[1], t1.y), n[2] = Math.max(n[2], t1.x), n[3] = Math.max(n[3], t1.y); 25996 } 25997 0 !== a && (n[0] -= a, n[1] -= a, n[2] += a, n[3] += a), n[0] < zr && n[1] < zr && n[2] >= 0 && n[3] >= 0 && l.insert(s, n[0], n[1], n[2], n[3]); 25998 } 25999 } 26000 loadVTLayers() { 26001 if (!this.vtLayers) { 26002 this.vtLayers = new Oh(new Wp(this.rawTileData)).layers, this.sourceLayerCoder = new Ob(this.vtLayers ? Object.keys(this.vtLayers).sort() : [ 26003 "_geojsonTileLayer" 26004 ]), this.vtFeatures = {}; 26005 for(const e1 in this.vtLayers)this.vtFeatures[e1] = []; 26006 } 26007 return this.vtLayers; 26008 } 26009 query(e1, t1) { 26010 const { tilespaceGeometry: i, transform: n, tileTransform: r, pixelPosMatrix: o, availableImages: a, worldview: s } = t1; 26011 this.loadVTLayers(), this.serializedLayersCache.clear(); 26012 const l = t1.queryRadius ? t1.queryRadius : 0, c = i.bufferedTilespaceBounds, u = this.grid.queryKeys(c.min.x, c.min.y, c.max.x, c.max.y, (e1, t1, n, r)=>
26012Xh(i.bufferedTilespaceGeometry, e1 - l, t1 - l, n + l, r + l)); 26013 u.sort(aE); 26014 let h = null; 26015 n.elevation && u.length > 0 && (h = bb.create(n.elevation, this.tileID)); 26016 const d = {}; 26017 let f; 26018 for(let l = 0; l < u.length; l++){ 26019 var _this = this; 26020 const c = u[l]; 26021 if (c === f) continue; 26022 f = c; 26023 const p = this.featureIndexArray.get(c); 26024 let m = null; 26025 this.is3DTile ? this.loadMatchingModelFeature(d, p, e1, i, n, s) : this.loadMatchingFeature(d, p, e1, a, s, function(e1, a, s) { 26026 let l = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0; 26027 return m || (m = Cc(e1, _this.tileID.canonical, r)), a.queryIntersectsFeature(i, e1, s, m, _this.z, n, o, h, l, t1.scope); 26028 }); 26029 } 26030 return d; 26031 } 26032 loadMatchingFeature(e1, t1, i, n, r, o) { 26033 const { featureIndex: a, bucketIndex: s, sourceLayerIndex: l, layoutVertexArrayOffset: c } = t1, u = this.bucketLayerIDs[s], h = i.layers, d = Object.keys(h); 26034 if (d.length && !mt(d, u)) return; 26035 const f = i.sourceCache, p = this.sourceLayerCoder.decode(l), m = this.vtLayers[p].feature(a), _ = this.getId(m, p); 26036 for(let t1 = 0; t1 < u.length; t1++){ 26037 const i = u[t1]; 26038 if (!h[i]) continue; 26039 const { styleLayer: s, targets: l } = h[i]; 26040 let d = {}; 26041 void 0 !== _ && (d = f.getFeatureState(s.sourceLayer, _)); 26042 const p = !o || o(m, s, d, c); 26043 if (!p) continue; 26044 const g = new Vb(m, this.z, this.x, this.y, _); 26045 g.tile = this.tileID.canonical, g.state = d; 26046 let y = this.serializedLayersCache.get(i); 26047 y || (y = s.serialize(), y.id = i, this.serializedLayersCache.set(i, y)), g.source = y.source, g.sourceLayer = y["source-layer"], g.layer = { 26048 ...y 26049 }, g.layer.paint = oE(y.paint, s.paint, m, d, n), g.layer.layout = oE(y.layout, s.layout, m, d, n); 26050 const x = new $s(this.tileID.overscaledZ, { 26051 worldview: r 26052 }); 26053 let v = !1; 26054 for (const e1 of l){ 26055 this.updateFeatureProperties(g, e1); 26056 const { filter: t1 } = e1; 26057 if (t1) { 26058 if (m.properties = g.properties, t1.needGeometry) { 26059 const e1 = Lc(m, !0); 26060 if (!t1.filter(x, e1, this.tileID.canonical)) continue; 26061 } else if (!t1.filter(x, m)) continue; 26062 } 26063 v = !0, e1.targetId && this.addFeatureVariant(g, e1); 26064 } 26065 v && this.appendToResult(e1, i, a, g, p); 26066 } 26067 } 26068 loadMatchingModelFeature(e1, t1, i, n, r, o) { 26069 const { featureIndex: a, bucketIndex: s } = t1, l = this.bucketLayerIDs[s], c = i.layers, u = Object.keys(c); 26070 if (!u.length || mt(u, l)) for(let t1 = 0; t1 < l.length; t1++){ 26071 const s = l[t1], { styleLayer: u, targets: h } = c[s]; 26072 if ("model" !== u.type) continue; 26073 const d = n.tile, f = d.getBucket(u); 26074 if (!f || !f.isTiled3dModelBucket) continue; 26075 if (!nE.loadMatchingModelFeature) continue; 26076 const p = nE.loadMatchingModelFeature(f, a, n, r); 26077 if (!p) continue; 26078 const { z: m, x: _, y: g } = d.tileID.canonical, { feature: y, intersectionZ: x, position: v } = p; 26079 let b = {}; 26080 void 0 !== y.id && (b = i.sourceCache.getFeatureState(u.sourceLayer, y.id)); 26081 const w = new Vb({}, m, _, g, y.id); 26082 w.tile = this.tileID.canonical, w.state = b, w.properties = y.properties, w.geometry = { 26083 type: "Point", 26084 coordinates: [ 26085 v.lng, 26086 v.lat 26087 ] 26088 }; 26089 let A = this.serializedLayersCache.get(s); 26090 A || (A = u.serialize(), A.id = s, this.serializedLayersCache.set(s, A)), w.source = A.source, w.sourceLayer = A["source-layer"], w.layer = { 26091 ...A 26092 }; 26093 const E = new $s(this.tileID.overscaledZ, { 26094 worldview: o 26095 }); 26096 let I = !1; 26097 for (const e1 of h){ 26098 this.updateFeatureProperties(w, e1); 26099 const { filter: t1 }
26099 = e1; 26100 if (t1) { 26101 if (y.properties = w.properties, t1.needGeometry) { 26102 if (!t1.filter(E, y, this.tileID.canonical)) continue; 26103 } else if (!t1.filter(E, y)) continue; 26104 } 26105 I = !0, e1.targetId && this.addFeatureVariant(w, e1); 26106 } 26107 I && this.appendToResult(e1, s, a, w, x); 26108 } 26109 } 26110 updateFeatureProperties(e1, t1, i) { 26111 if (t1.properties) { 26112 const n = {}; 26113 for(const r in t1.properties){ 26114 const o = t1.properties[r].evaluate({ 26115 zoom: this.z 26116 }, e1._vectorTileFeature, e1.state, e1.tile, i); 26117 null != o && (n[r] = o); 26118 } 26119 e1.properties = n; 26120 } 26121 } 26122 addFeatureVariant(e1, t1, i) { 26123 const n = { 26124 target: t1.target, 26125 namespace: t1.namespace, 26126 uniqueFeatureID: t1.uniqueFeatureID 26127 }; 26128 t1.properties && (n.properties = e1.properties), e1.variants = e1.variants || {}, e1.variants[t1.targetId] = e1.variants[t1.targetId] || [], e1.variants[t1.targetId].push(n); 26129 } 26130 appendToResult(e1, t1, i, n, r) { 26131 let o = e1[t1]; 26132 void 0 === o && (o = e1[t1] = []), o.push({ 26133 featureIndex: i, 26134 feature: n, 26135 intersectionZ: r 26136 }); 26137 } 26138 lookupSymbolFeatures(e1, t1, i, n, r, o) { 26139 const a = {}; 26140 this.loadVTLayers(); 26141 for (const s of e1)this.loadMatchingFeature(a, { 26142 bucketIndex: t1, 26143 sourceLayerIndex: i, 26144 featureIndex: s, 26145 layoutVertexArrayOffset: 0 26146 }, n, r, o); 26147 return a; 26148 } 26149 loadFeature(e1) { 26150 const { featureIndex: t1, sourceLayerIndex: i } = e1; 26151 this.loadVTLayers(); 26152 const n = this.sourceLayerCoder.decode(i), r = this.vtFeatures[n]; 26153 if (r[t1]) return r[t1]; 26154 const o = this.vtLayers[n].feature(t1); 26155 return r[t1] = o, o; 26156 } 26157 hasLayer(e1) { 26158 for (const t1 of this.bucketLayerIDs)for (const i of t1)if (e1 === i) return !0; 26159 return !1; 26160 } 26161 getId(e1, t1) { 26162 let i = e1.id; 26163 if (this.promoteId) { 26164 const n = Array.isArray(this.promoteId) || "object" != typeof this.promoteId ? this.promoteId : this.promoteId[t1]; 26165 if (null != n) if (Array.isArray(n)) { 26166 if (!this.promoteIdExpression) { 26167 const e1 = Ua(n); 26168 if ("success" !== e1.result) { 26169 const t1 = e1.value.map((e1)=>"".concat(e1.key, ": ").concat(e1.message)).join(", "); 26170 return void gt("Failed to create expression for promoteId: ".concat(t1)); 26171 } 26172 this.promoteIdExpression = e1.value; 26173 } 26174 i = this.promoteIdExpression.evaluate({ 26175 zoom: 0 26176 }, e1); 26177 } else i = e1.properties[n]; 26178 "boolean" == typeof i && (i = Number(i)); 26179 } 26180 return i; 26181 } 26182 constructor(e1, t1){ 26183 this.tileID = e1, this.x = e1.canonical.x, this.y = e1.canonical.y, this.z = e1.canonical.z, this.grid = new Wa(zr, zr, 512), this.featureIndexArray = new Cu, this.promoteId = t1, this.is3DTile = !1, this.serializedLayersCache = new Map; 26184 } 26185 } 26186 function oE(e1, t1, i, n, r) { 26187 return dt(e1, (e1, o)=>{ 26188 const a = t1 instanceof Qs ? t1.get(o) : null; 26189 return a && a.evaluate ? a.evaluate(i, n, void 0, r) : a; 26190 }); 26191 } 26192 function aE(e1, t1) { 26193 return t1 - e1; 26194 } 26195 async function sE() { 26196 return Promise.resolve(); 26197 } 26198 Xa(rE, "FeatureIndex", { 26199 omit: [ 26200 "rawTileData", 26201 "sourceLayerCoder" 26202 ] 26203 }); 26204 const lE = { 26205 circle: class extends Rl { 26206 createBucket(e1) { 26207 return new Ad(e1); 26208 } 26209 queryRadius(e1) { 26210 const t1 = e1; 26211 return rv("circle-radius", this, t1) + rv("circle-stroke-width", this, t1) + ov(this.paint.get("circle-translate")); 26212 } 26213 queryIntersectsFeature(e1, t1, i, n, r, o, a, s) { 26214 const l = sv(this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), o.angle, e1.pixelToTileUnitsFactor), c = this.paint.get("circle-radius").evaluate(t1, i) + this.paint.get("circle-stroke-width").evaluate(t1, i); 26215 return uv(e1, n, o, a, s, "map" === this.paint.get("circle-pitch-alignment"), "map" === this.paint.get("circle-pitch-scale"), l, c); 26216 } 26217 getProgramIds() { 26218 return [ 26219 "circle" 26220 ]; 26221 } 26222 getDefaultProgramParams(e1, t1, i) { 26223 const n = cv(this); 26224 return { 26225 config: new ph(this, { 26226 zoom: t1, 26227 lut: i 26228 }), 26229 defines: n, 26230 overrideFog: !1 26231 }; 26232 } 26233 is3D(e1) { 26234 return !e1 && !!this.layout && "none" !== this.layout.get("
26234circle-elevation-reference"); 26235 } 26236 hasElevation() { 26237 return this.layout && "none" !== this.layout.get("circle-elevation-reference"); 26238 } 26239 mayUse(e1) { 26240 return "HD" === e1 && Pl(this, "circle-elevation-reference", (e1)=>"hd-road-markup" === e1); 26241 } 26242 prepare() { 26243 return this.mayUse("HD") ? nv() : Promise.resolve(); 26244 } 26245 constructor(e1, t1, i, n){ 26246 super(e1, { 26247 layout: Zx || (Zx = new nl({ 26248 "circle-sort-key": new tl(rl.layout_circle["circle-sort-key"]), 26249 "circle-elevation-reference": new el(rl.layout_circle["circle-elevation-reference"]), 26250 visibility: new el(rl.layout_circle.visibility) 26251 })), 26252 paint: Wx || (Wx = new nl({ 26253 "circle-radius": new tl(rl.paint_circle["circle-radius"]), 26254 "circle-color": new tl(rl.paint_circle["circle-color"]), 26255 "circle-blur": new tl(rl.paint_circle["circle-blur"]), 26256 "circle-opacity": new tl(rl.paint_circle["circle-opacity"]), 26257 "circle-translate": new el(rl.paint_circle["circle-translate"]), 26258 "circle-translate-anchor": new el(rl.paint_circle["circle-translate-anchor"]), 26259 "circle-pitch-scale": new el(rl.paint_circle["circle-pitch-scale"]), 26260 "circle-pitch-alignment": new el(rl.paint_circle["circle-pitch-alignment"]), 26261 "circle-stroke-width": new tl(rl.paint_circle["circle-stroke-width"]), 26262 "circle-stroke-color": new tl(rl.paint_circle["circle-stroke-color"]), 26263 "circle-stroke-opacity": new tl(rl.paint_circle["circle-stroke-opacity"]), 26264 "circle-emissive-strength": new el(rl.paint_circle["circle-emissive-strength"]), 26265 "circle-color-use-theme": new tl({ 26266 type: "string", 26267 default: "default", 26268 "property-type": "data-driven" 26269 }), 26270 "circle-stroke-color-use-theme": new tl({ 26271 type: "string", 26272 default: "default", 26273 "property-type": "data-driven" 26274 }) 26275 })) 26276 }, t1, i, n); 26277 } 26278 }, 26279 heatmap: class extends Rl { 26280 createBucket(e1) { 26281 return new mv(e1); 26282 } 26283 _handleSpecialPaintPropertyUpdate(e1) { 26284 "heatmap-color" === e1 && this._updateColorRamp(); 26285 } 26286 _updateColorRamp() { 26287 this.colorRamp = xv({ 26288 expression: this._transitionablePaint._values["heatmap-color"].value.expression, 26289 evaluationKey: "heatmapDensity", 26290 image: this.colorRamp 26291 }), this.colorRampTexture = null; 26292 } 26293 resize() { 26294 this.heatmapFbo && (this.heatmapFbo.destroy(), this.heatmapFbo = null); 26295 } 26296 _clear() { 26297 this.heatmapFbo && (this.heatmapFbo.destroy(), this.heatmapFbo = null), this.colorRampTexture && (this.colorRampTexture.destroy(), this.colorRampTexture = null); 26298 } 26299 queryRadius(e1) { 26300 return rv("heatmap-radius", this, e1); 26301 } 26302 queryIntersectsFeature(e1, t1, i, n, r, o, a, s) { 26303 const l = this.paint.get("heatmap-radius").evaluate(t1, i); 26304 return uv(e1, n, o, a, s, !0, !0, new Pe(0, 0), l); 26305 } 26306 hasOffscreenPass() { 26307 return 0 !== this.paint.get("heatmap-opacity") && "none" !== this.visibility; 26308 } 26309 getProgramIds() { 26310 return [ 26311 "heatmap", 26312 "heatmapTexture" 26313 ]; 26314 } 26315 getDefaultProgramParams(e1, t1, i) { 26316 return "heatmap" === e1 ? { 26317 config: new ph(this, { 26318 zoom: t1, 26319 lut: i 26320 }), 26321 overrideFog: !1 26322 } : {}; 26323 } 26324 constructor(e1, t1, i, n){ 26325 super(e1, { 26326 layout: _v || (_v = new nl({ 26327 visibility: new el(rl.layout_heatmap.visibility) 26328 })), 26329 paint: gv || (gv = new nl({ 26330 "heatmap-radius": new tl(rl.paint_heatmap["heatmap-radius"]), 26331 "heatmap-weight": new tl(rl.paint_heatmap["heatmap-weight"]), 26332 "heatmap-intensity": new el(rl.paint_heatmap["heatmap-intensity"]), 26333 "heatmap-color": new il(rl.paint_heatmap["heatmap-color"]), 26334 "heatmap-opacity": new el(rl.paint_heatmap["heatmap-opacity"]), 26335 "heatmap-color-use-theme": new tl({ 26336 type: "string", 26337 default: "default", 26338 "property-type": "data-driven" 26339 }) 26340 })) 26341 }, t1, i, n), this._updateColorRamp(); 26342 } 26343 }, 26344 hillshade: class extends Rl { 26345 shouldRedrape() { 26346 return this.hasOffscreenPass() && "viewport" === this.paint.get("hillshade-illumination-anchor"); 26347 } 26348 hasOffscreenPass() { 26349 return 0 !== this.paint.get("hillshade-exaggeration") && "none" !== this.visibility; 26350 } 26351 getProgramIds() { 26352 return [ 26353 "hillshade", 26354 "hillshadePrepare" 26355 ]; 26356 } 26357 getDefaultProgramParams(e1, t1, i) { 26358 return { 26359 overrideFog: !1 26360 }; 26361 } 26362 constructor(e1, t1, i, n){ 26363 super(e1, { 26364 layout: vv || (vv = new nl({ 26365 visibility: new el(rl.layout_hillshade.visibility) 26366 })), 26367 paint: bv || (bv = new nl({ 26368 "hillshade-illumination-direction": new el(rl.paint_hillshade["hillshade-illumination-direction"]), 26369 "hillshade-illumination-anchor": new el(rl.paint_hillshade["hillshade-illumination-anchor"]), 26370 "hillshade-exaggeration": new el(rl.paint_hillshade["hillshade-exaggeration"]), 26371 "hillshade-shadow-color": new el(rl.paint_hillshade["hillshade-shadow-color"]), 26372 "hillshade-highlight-color": new el(rl.paint_hillshade["hillshade-highlight-color"]), 26373 "hillshade-accent-color": new el(rl.paint_hillshade["hillshade-accent-color"]), 26374 "hillshade-emissive-strength": new el(rl.paint_hillshade["hillshade-emissive-strength"]), 26375 "hillshade-shadow-color-use-theme": new tl({ 26376 type: "string", 26377 default: "default", 26378 "property-type": "data-driven" 26379 }), 26380 "hillshade-highlight-color-use-theme": new tl({ 26381 type: "string", 26382 default: "default", 26383 "property-type": "data-driven" 26384 }), 26385 "hillshade-accent-color-use-theme": new tl({ 26386 type: "string", 26387 default: "default", 26388 "property-type": "data-driven" 26389 }) 26390 })) 26391 }, t1, i, n); 26392 } 26393 }, 26394 fill: class extends Rl { 26395 getProgramIds() { 26396 const e1 = this.paint.get("fill-pattern"), t1 = e1 && e1.constantOr(1), i = [ 26397 t1 ? "fillPattern" : "fill" 26398 ]; 26399 return this.paint.get("fill-antialias") && i.push(t1 && !this.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline"), i; 26400 } 26401 getDefaultProgramParams(e1, t1, i) { 26402 return { 26403 config: new ph(this, { 26404 zoom: t1, 26405 lut: i 26406 }), 26407 overrideFog: !1 26408 }; 26409 } 26410 recalculate(e1, t1) { 26411 super.recalculate(e1, t1); 26412 const i = this.paint._values["fill-outline-color"]; 26413 "constant" === i.value.kind && void 0 === i.value.value && (this.paint._values["fill-outline-color"] = this.paint._values["fill-color"]); 26414 } 26415 createBucket(e1) { 26416 return new wh(e1); 26417 } 26418 queryRadius() { 26419 return ov(this.paint.get("fill-translate")); 26420 } 26421 queryIntersectsFeature(e1, t1, i, n, r, o) { 26422 return !e1.queryGeometry.isAboveHorizon && Nh(av(e1.tilespaceGeometry, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), o.angle, e1.pixelToTileUnitsFactor), n); 26423 } 26424 isTileClipped() { 26425 return 0 === this.paint.get("fill-z-offset").constantOr(1); 26426 } 26427 is3D(e1) { 26428 if (0 !== this.paint.get("fill-z-offset").constantOr(1)) return !0; 26429 const t1 = this.layout && "none" !== this.layout.get("fill-elevation-reference"); 26430 return null != e1 ? t1 && !e1 : t1; 26431 } 26432 hasElevation() { 26433 return this.layout && "none" !== this.layout.get("fill-elevation-reference"); 26434 } 26435 mayUse(e1) { 26436 return "HD" === e1 && Pl(this, "fill-elevation-reference", (e1)=>"none" !== e1); 26437 } 26438 prepare() { 26439 return this.mayUse("HD") ? nv() : Promise.resolve(); 26440 } 26441 hasShadowPass() { 26442 return this.layout && "none" !== this.layout.get("fill-elevation-reference"); 26443 } 26444 constructor(e1, t1, i, n){ 26445 super(e1, { 26446 layout: wv || (wv = new nl({ 26447 "fill-sort-key": new tl(rl.layout_fill["fill-sort-key"]), 26448 visibility: new el(rl.layout_fill.visibility), 26449 "fill-elevation-reference": new el(rl.layout_fill["fill-elevation-reference"]), 26450 "fill-construct-bridge-guard-rail": new tl(rl.layout_fill["fill-construct-bridge-guard-rail"]) 26451 })), 26452 paint: Av || (Av = new nl({ 26453 "fill-antialias": new el(rl.paint_fill["fill-antialias"]), 26454 "fill-opacity": new tl(rl.paint_fill["fill-opacity"]), 26455 "fill-color": new tl(rl.paint_fill["fill-color"]), 26456 "fill-outline-color": new tl(rl.paint_fill["fill-outline-color"]), 26457 "fill-translate": new el(rl.paint_fill["fill-translate"]), 26458 "fill-translate-anchor": new el(rl.paint_fill["fill-translate-anchor"]), 26459 "fill-pattern": new tl(rl.paint_fill["fill-pattern"]), 26460 "fill-pattern-cross-fade": new el(rl.paint_fill["fill-pattern-cross-fade"]), 26461 "fill-emissive-strength": new el(rl.paint_fill["fill-emissive-strength"]), 26462 "fill-z-offset": new tl(rl.paint_fill["fill-z-offset"]), 26463 "fill-bridge-guard-rail-color": new tl(rl.paint_fill["fill-bridge-guard-rail-color"]), 26464 "fill-tunnel-structure-color": new tl(rl.paint_fill["fill-tunnel-structure-color"]), 26465 "fill-color-use-theme": new tl({ 26466 type: "string", 26467 default: "default", 26468 "property-type": "data-driven" 26469 }), 26470 "fill-outline-color-use-theme": new tl({ 26471 type: "string", 26472 default: "default", 26473 "property-type": "data-driven" 26474 }), 26475 "fill-bridge-guard-rail-color-use-theme": new tl({ 26476 type: "string", 26477 default: "default", 26478 "property-type": "data-driven" 26479 }), 26480 "fill-tunnel-structure-color-use-theme": new tl({ 26481 type: "string", 26482 default: "default", 26483 "property-type": "data-driven" 26484 }) 26485 })) 26486 }, t1, i, n); 26487 } 26488 }, 26489 "fill-extrusion": class extends Rl { 26490 createBucket(e1) { 26491 return new Ix(e1); 26492 } 26493 queryRadius() { 26494 return ov(this.paint.get("fill-extrusion-translate")); 26495 } 26496 is3D(e1) { 26497 return !0; 26498 } 26499 hasShadowPass() { 26500 return this.paint.get("fill-extrusion-cast-shadows"); 26501 } 26502 cutoffRange() { 26503 return this.paint.get("fill-extrusion-cutoff-fade-range"); 26504 } 26505 canCastShadows() { 26506 return !0; 26507 } 26508 getProgramIds() { 26509 return [ 26510 this.paint.get("fill-extrusion-pattern").constantOr(1) ? "fillExtrusionPattern" : "fillExtrusion" 26511 ]; 26512 } 26513 queryIntersectsFeature(e1, t1, i, n, r, o, a, s, l) { 26514 const c = sv(this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), o.angle, e1.pixelToTileUnitsFactor), u = this.paint.get("fill-extrusion-height").evaluate(t1, i), h = this.paint.get("fill-extrusion-base").evaluate(t1, i), d = [ 26515 0, 26516 0
vendor: 6,162 bytes, lines 26517-26583
26517 ], f = s && o.elevation, p = o.elevation ? o.elevation.exaggeration() : 1, m = e1.tile.getBucket(this); 26518 if (m instanceof Ix) { 26519 const e1 = m.centroidData.find((e1)=>l >= e1.vertexArrayOffset && l < e1.vertexArrayOffset + e1.vertexCount); 26520 if (e1 && e1.flags & hx) return !1; 26521 if (f) { 26522 const e1 = m.centroidVertexArray, t1 = l + 1; 26523 t1 < e1.length && (d[0] = e1.geta_centroid_pos0(t1), d[1] = e1.geta_centroid_pos1(t1)); 26524 } 26525 } 26526 if (0 === d[0] && 1 === d[1]) return !1; 26527 "globe" === o.projection.name && (n = Vx([ 26528 n 26529 ], [ 26530 new Pe(0, 0), 26531 new Pe(zr, zr) 26532 ], e1.tileID.canonical).map((e1)=>e1.polygon).flat()); 26533 const _ = f ? s : null, [g, y] = Ov(o, n, h, u, c, a, _, d, p, o.center.lat, e1.tileID.canonical), x = e1.queryGeometry; 26534 return Lv(g, y, x.isPointQuery() ? x.screenBounds : x.screenGeometry); 26535 } 26536 constructor(e1, t1, i, n){ 26537 super(e1, { 26538 layout: Mv || (Mv = new nl({ 26539 visibility: new el(rl["layout_fill-extrusion"].visibility), 26540 "fill-extrusion-edge-radius": new el(rl["layout_fill-extrusion"]["fill-extrusion-edge-radius"]), 26541 "source-max-zoom": new el(rl["layout_fill-extrusion"]["source-max-zoom"]) 26542 })), 26543 paint: Tv || (Tv = new nl({ 26544 "fill-extrusion-opacity": new el(rl["paint_fill-extrusion"]["fill-extrusion-opacity"]), 26545 "fill-extrusion-color": new tl(rl["paint_fill-extrusion"]["fill-extrusion-color"]), 26546 "fill-extrusion-translate": new el(rl["paint_fill-extrusion"]["fill-extrusion-translate"]), 26547 "fill-extrusion-translate-anchor": new el(rl["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]), 26548 "fill-extrusion-pattern": new tl(rl["paint_fill-extrusion"]["fill-extrusion-pattern"]), 26549 "fill-extrusion-pattern-cross-fade": new el(rl["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]), 26550 "fill-extrusion-height": new tl(rl["paint_fill-extrusion"]["fill-extrusion-height"]), 26551 "fill-extrusion-base": new tl(rl["paint_fill-extrusion"]["fill-extrusion-base"]), 26552 "fill-extrusion-height-alignment": new el(rl["paint_fill-extrusion"]["fill-extrusion-height-alignment"]), 26553 "fill-extrusion-base-alignment": new el(rl["paint_fill-extrusion"]["fill-extrusion-base-alignment"]), 26554 "fill-extrusion-vertical-gradient": new el(rl["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]), 26555 "fill-extrusion-ambient-occlusion-intensity": new el(rl["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]), 26556 "fill-extrusion-ambient-occlusion-radius": new el(rl["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]), 26557 "fill-extrusion-ambient-occlusion-wall-radius": new el(rl["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]), 26558 "fill-extrusion-ambient-occlusion-ground-radius": new el(rl["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]), 26559 "fill-extrusion-ambient-occlusion-ground-attenuation": new el(rl["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]), 26560 "fill-extrusion-flood-light-color": new el(rl["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]), 26561 "fill-extrusion-flood-light-intensity": new el(rl["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]), 26562 "fill-extrusion-flood-light-wall-radius": new tl(rl["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]), 26563 "fill-extrusion-flood-light-ground-radius": new tl(rl["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]), 26564 "fill-extrusion-flood-light-ground-attenuation": new el(rl["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]), 26565 "fill-extrusion-vertical-scale": new el(rl["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]), 26566 "fill-extrusion-rounded-roof": new el(rl["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]), 26567 "fill-extrusion-cutoff-fade-range": new el(rl["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]), 26568 "fill-extrusion-front-cutoff": new el(rl["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]), 26569 "fill-extrusion-emissive-strength": new tl(rl["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]), 26570 "fill-extrusion-line-width": new tl(rl["paint_fill-extrusion"]["fill-extrusion-line-width"]), 26571 "fill-extrusion-cast-shadows": new el(rl["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]), 26572 "fill-extrusion-color-use-theme": new tl({ 26573 type: "string", 26574 default: "default", 26575 "property-type": "data-driven" 26576 }), 26577 "fill-extrusion-flood-light-color-use-theme": new tl({ 26578 type: "string", 26579 default: "default", 26580 "property-type": "data-driven" 26581 }) 26582 })) 26583 }, t1, i, n), this._stats = {
26584 numRenderedVerticesInShadowPass: 0, 26585 numRenderedVerticesInTransparentPass: 0 26586 }; 26587 } 26588 }, 26589 building: class extends Rl { 26590 mayUse(e1) { 26591 return "HD" === e1; 26592 } 26593 prepare() { 26594 return async function() { 26595 return function() { 26596 if (!bt(self)) return null; 26597 if (null != Yx || null != Xx) return null; 26598 if (null != qx) return qx; 26599 const e1 = fetch($t()); 26600 return qx = (function(e1) { 26601 let t1, i, n, r, o; 26602 function a() { 26603 t1 = new Uint8Array(o.buffer), i = new Int16Array(o.buffer), n = new Int32Array(o.buffer), r = new Float32Array(o.buffer); 26604 } 26605 function s() { 26606 throw new Error("Unexpected BuildingGen error."); 26607 } 26608 const l = ()=>{}, c = { 26609 a: { 26610 a: s, 26611 f: function(e1) { 26612 const i = t1.length, n = Math.max(e1 >>> 0, Math.ceil(1.2 * i)), r = Math.ceil((n - i) / 65536); 26613 try { 26614 return o.grow(r), a(), !0; 26615 } catch (e1) { 26616 return !1; 26617 } 26618 }, 26619 g: s, 26620 b: l, 26621 c: l, 26622 d: l, 26623 e: l 26624 } 26625 }; 26626 return (WebAssembly.instantiateStreaming ? WebAssembly.instantiateStreaming(e1, c) : e1.then((e1)=>e1.arrayBuffer()).then((e1)=>WebAssembly.instantiate(e1, c))).then((e1)=>{ 26627 const s = e1.instance.exports; 26628 return (0, s.g)(), o = s.f, a(), new Ux({ 26629 setStyle: s.h, 26630 setAOOptions: s.i, 26631 setMetricOptions: s.j, 26632 setStructuralOptions: s.k, 26633 setFacadeOptions: s.l, 26634 setFauxFacadeOptions: s.m, 26635 setFacadeClassifierOptions: s.n, 26636 addFeature: s.o, 26637 addFacade: s.p, 26638 generateMesh: s.q, 26639 getLastError: s.r, 26640 getOuterRingLength: s.s, 26641 getMeshCount: s.t, 26642 getPositionsPtr: s.u, 26643 getPositionsLength: s.v, 26644 getNormalsPtr: s.w, 26645 getNormalsLength: s.x, 26646 getAOPtr: s.y, 26647 getAOLength: s.z, 26648 getUVPtr: s.A, 26649 getUVLength: s.B, 26650 getFauxFacadePtr: s.C, 26651 getFauxFacadeLength: s.D, 26652 getIndicesPtr: s.E, 26653 getIndicesLength: s.F, 26654 getBuildingPart: s.G, 26655 getRingCount: s.H, 26656 getRingPtr: s.I, 26657 getRingLength: s.J, 26658 malloc: s.K, 26659 free: s.L, 26660 heapU8: t1, 26661 heap16: i, 26662 heap32: n, 26663 heapF32: r 26664 }); 26665 }); 26666 })(e1).then((e1)=>{ 26667 qx = null, Yx = e1; 26668 }).catch((e1)=>{ 26669 gt("Could not load building-gen"), qx = null, Xx = e1; 26670 }), qx; 26671 }(); 26672 }(); 26673 } 26674 createBucket(e1) { 26675 return new Qx(e1); 26676 } 26677 cutoffRange() { 26678 return this.paint.get("building-cutoff-fade-range"); 26679 } 26680 hasShadowPass() { 26681 return this.paint.get("building-cast-shadows"); 26682 } 26683 hasLightBeamPass() { 26684 return !0; 26685 } 26686 canCastShadows() { 26687 return !0; 26688 } 26689 is3D(e1) { 26690 return !0; 26691 } 26692 queryRadius(e1) { 26693 return 0; 26694 } 26695 queryIntersectsFeature(e1, t1, i, n, r, o, a, s, l, c) { 26696 let u = this.layout.get("building-height").evaluate(t1, i); 26697 const h = this.layout.get("building-base").evaluate(t1, i), d = e1.tile.getBucket(this).getFootprint(t1); 26698 if (d) { 26699 if (0 !== d.hiddenFlags) return !1; 26700 u = d.height; 26701 } 26702 const [f, p] = Ov(o, n, h, u, new Pe(0, 0), a, null, [ 26703 0, 26704 0 26705 ], 1, o.center.lat, e1.tileID.canonical), m = e1.queryGeometry; 26706 return Lv(f, p, m.isPointQuery() ? m.screenBounds : m.screenGeometry); 26707 } 26708 constructor(e1, t1, i, n){ 26709 super(e1, { 26710 layout: Sv || (Sv = new nl({ 26711 visibility: new el(rl.layout_building.visibility), 26712 "building-facade": new tl(rl.layout_building["building-facade"]), 26713 "building-facade-floors": new tl(rl.layout_building["building-facade-floors"]), 26714 "building-facade-unit-width": new tl(rl.layout_building["building-facade-unit-width"]), 26715 "building-facade-window": new tl(rl.layout_building["building-facade-window"]), 26716 "building-roof-shape": new tl(rl.layout_building["building-roof-shape"]), 26717 "building-height": new tl(rl.layout_building["building-height"]), 26718 "building-base": new tl(rl.layout_building["building-base"]), 26719 "building-flood-light-wall-radius": new tl(rl.layout_building["building-flood-light-wall-radius"]), 26720 "building-flood-light-ground-radius": new tl(rl.layout_building["building-flood-light-ground-radius"]), 26721 "building-flip-roof-orientation": new tl(rl.layout_building["building-flip-roof-orientation"]) 26722 })), 26723 paint: zv || (zv = new nl({ 26724 "building-opacity": new el(rl.paint_building["building-opacity"]), 26725 "building-ambient-occlusion-intensity": new el(rl.paint_building["building-ambient-occlusion-intensity"]), 26726 "building-ambient-occlusion-ground-intensity": new el(rl.paint_building["building-ambient-occlusion-ground-intensity"]), 26727 "building-ambient-occlusion-ground-radius": new el(rl.paint_building["building-ambient-occlusion-ground-radius"]), 26728 "building-ambient-occlusion-ground-attenuation": new el(rl.paint_building["building-ambient-occlusion-ground-attenuation"]), 26729 "building-vertical-scale": new el(rl.paint_building["building-vertical-scale"]), 26730 "building-cast-shadows": new el(rl.paint_building["building-cast-shadows"]), 26731 "building-color": new tl(rl.paint_building["building-color"]), 26732 "building-emissive-strength": new tl(rl.paint_building["building-emissive-strength"]), 26733 "building-facade-emissive-chance": new el(rl.paint_building["building-facade-emissive-chance"]), 26734 "building-cutoff-fade-range": new el(rl.paint_building["building-cutoff-fade-range"]), 26735 "building-front-cutoff": new el(rl.paint_building["building-front-cutoff"]), 26736 "building-flood-light-color": new el(rl.paint_building["building-flood-light-color"]), 26737 "building-flood-light-intensity": new el(rl.paint_building["building-flood-light-intensity"]), 26738 "building-flood-light-ground-attenuation": new el(rl.paint_building["building-flood-light-ground-attenuation"]), 26739 "building-color-use-theme": new tl({ 26740 type: "string", 26741 default: "default", 26742 "property-type": "data-driven" 26743 }), 26744 "building-flood-light-color-use-theme": new tl({ 26745 type: "string", 26746 default: "default", 26747 "property-type": "data-driven" 26748 }) 26749 })) 26750 }, t1, i, n), this._stats = {
26751 numRenderedVerticesInShadowPass: 0, 26752 numRenderedVerticesInTransparentPass: 0 26753 }; 26754 } 26755 }, 26756 line: class extends Rl { 26757 _handleSpecialPaintPropertyUpdate(e1) { 26758 if ("line-gradient" === e1) { 26759 const e1 = this._transitionablePaint._values["line-gradient"].value.expression; 26760 this.stepInterpolant = e1._styleExpression && e1._styleExpression.expression instanceof So, this.gradientVersion = (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER; 26761 } else if ("line-gradient-use-theme" === e1) this.gradientVersion = (this.gradientVersion + 1) % Number.MAX_SAFE_INTEGER; 26762 else if ("line-border-gradient" === e1) { 26763 const e1 = this._transitionablePaint._values["line-border-gradient"].value.expression; 26764 this.borderStepInterpolant = e1._styleExpression && e1._styleExpression.expression instanceof So, this.borderGradientVersion = (this.borderGradientVersion + 1) % Number.MAX_SAFE_INTEGER; 26765 } else "line-border-gradient-use-theme" === e1 && (this.borderGradientVersion = (this.borderGradientVersion + 1) % Number.MAX_SAFE_INTEGER); 26766 } 26767 gradientExpression() { 26768 return this._transitionablePaint._values["line-gradient"].value.expression; 26769 } 26770 borderGradientExpression() { 26771 return this._transitionablePaint._values["line-border-gradient"].value.expression; 26772 } 26773 widthExpression() { 26774 return this._transitionablePaint._values["line-width"].value.expression; 26775 } 26776 emissiveStrengthExpression() { 26777 return this._transitionablePaint._values["line-emissive-strength"].value.expression; 26778 } 26779 recalculate(e1, t1) { 26780 super.recalculate(e1, t1), this.paint._values["line-floorwidth"] = (()=>{ 26781 if (Zv) return Zv; 26782 const e1 = Hv(); 26783 return Zv = new $v(e1.paint.properties["line-width"].specification), Zv.useIntegerZoom = !0, Zv; 26784 })().possiblyEvaluate(this._transitioningPaint._values["line-width"].value, e1); 26785 } 26786 createBucket(e1) { 26787 return new yd(e1); 26788 } 26789 getProgramIds() { 26790 const e1 = [ 26791 this.paint.get("line-pattern").constantOr(1) ? "linePattern" : "line" 26792 ]; 26793 return "default" !== this.paint.get("line-blend-mode") && e1.push("lineBlendComposite"), e1; 26794 } 26795 getDefaultProgramParams(e1, t1, i) { 26796 if ("lineBlendComposite" === e1) return {}; 26797 const n = Uv(this); 26798 return { 26799 config: new ph(this, { 26800 zoom: t1, 26801 lut: i 26802 }), 26803 defines: n, 26804 overrideFog: !1 26805 }; 26806 } 26807 queryRadius(e1) { 26808 const t1 = e1, i = Yv(rv("line-width", this, t1), rv("line-gap-width", this, t1)), n = rv("line-offset", this, t1); 26809 return i / 2 + Math.abs(n) + ov(this.paint.get("line-translate")); 26810 } 26811 queryIntersectsFeature(e1, t1, i, n, r, o) { 26812 if (e1.queryGeometry.isAboveHorizon) return !1; 26813 const a = av(e1.tilespaceGeometry, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), o.angle, e1.pixelToTileUnitsFactor), s = e1.pixelToTileUnitsFactor / 2 * Yv(this.paint.get("line-width").evaluate(t1, i), this.paint.get("line-gap-width").evaluate(t1, i)), l = this.paint.get("line-offset").evaluate(t1, i); 26814 return l && (n = function(e1, t1) { 26815 const i = [], n = new Pe(0, 0); 26816 for(let r = 0;
26816 r < e1.length; r++){ 26817 const o = e1[r], a = []; 26818 for(let e1 = 0; e1 < o.length; e1++){ 26819 const i = o[e1], r = o[e1 + 1], s = 0 === e1 ? n : i.sub(o[e1 - 1])._unit()._perp(), l = e1 === o.length - 1 ? n : r.sub(i)._unit()._perp(), c = s._add(l)._unit(); 26820 c._mult(1 / (c.x * l.x + c.y * l.y)), a.push(c._mult(t1)._add(i)); 26821 } 26822 i.push(a); 26823 } 26824 return i; 26825 }(n, l * e1.pixelToTileUnitsFactor)), function(e1, t1, i) { 26826 for(let n = 0; n < t1.length; n++){ 26827 const r = t1[n]; 26828 if (e1.length >= 3) { 26829 for(let t1 = 0; t1 < r.length; t1++)if (qh(e1, r[t1])) return !0; 26830 } 26831 if (kh(e1, r, i)) return !0; 26832 } 26833 return !1; 26834 }(a, n, s); 26835 } 26836 isTileClipped() { 26837 return this.hasNonElevatedBuckets; 26838 } 26839 isDraped(e1) { 26840 return !this.hasElevatedBuckets || this.layout && "hd-road-markup" === this.layout.get("line-elevation-reference"); 26841 } 26842 hasElevation() { 26843 return this.layout && "none" !== this.layout.get("line-elevation-reference"); 26844 } 26845 mayUse(e1) { 26846 return "HD" === e1 ? Pl(this, "line-elevation-reference", (e1)=>"hd-road-markup" === e1) : "Lite" === e1 && function(e1) { 26847 if (!e1._unevaluatedLayout) return !1; 26848 const t1 = e1._unevaluatedLayout.getValue("line-elevation-reference"); 26849 if (void 0 !== t1 && ("string" != typeof t1 || "none" !== t1)) return !0; 26850 const i = e1._unevaluatedLayout.getValue("line-z-offset"); 26851 return void 0 !== i && ("number" != typeof i || 0 !== i); 26852 }(this); 26853 } 26854 prepare() { 26855 return this.mayUse("HD") ? nv() : Promise.resolve(); 26856 } 26857 hasOffscreenPass() { 26858 return "default" !== this.paint.get("line-blend-mode") && 0 !== this.paint.get("line-opacity").constantOr(1) && 0 !== this.paint.get("line-width").constantOr(1) && "none" !== this.visibility; 26859 } 26860 resize() { 26861 this._destroyLineBlendFbo(); 26862 } 26863 onRemove(e1) { 26864 this._destroyLineBlendFbo(e1.painter && e1.painter.context && e1.painter.context.gl || void 0); 26865 } 26866 _clear() { 26867 this._destroyLineBlendFbo(); 26868 } 26869 _destroyLineBlendFbo(e1) { 26870 this.lineBlendFbos && (this.lineBlendFbos.destroy(), this.lineBlendFbos = null), e1 && this.lineBlendDensityReadback && this.lineBlendDensityReadback.destroy(e1), this.lineBlendDensityReadback = null; 26871 } 26872 constructor(e1, t1, i, n){ 26873 const r = Hv(); 26874 super(e1, r, t1, i, n), r.layout && (this.layout = new Qs(r.layout)), this.gradientVersion = 0, this.borderGradientVersion = 0, this.hasElevatedBuckets = !1, this.hasNonElevatedBuckets = !1, this.lineBlendFbos = null, this.lineBlendDensityReadback = null; 26875 } 26876 }, 26877 symbol: eb, 26878 background: class extends Rl { 26879 getProgramIds() { 26880 return [ 26881 this.paint.get("background-pattern") ? "backgroundPattern" : "background" 26882 ]; 26883 } 26884 getDefaultProgramParams(e1, t1, i) { 26885 return { 26886 overrideFog: !1 26887 }; 26888 } 26889 is3D(e1) { 26890 return "viewport" === this.paint.get("background-pitch-alignment"); 26891 } 26892 constructor(e1, t1, i, n){ 26893 super(e1, { 26894 layout: tb || (tb = new nl({ 26895 visibility: new el(rl.layout_background.visibility) 26896 })), 26897 paint: ib || (ib = new nl({ 26898 "background-pitch-alignment": new el(rl.paint_background["background-pitch-alignment"]), 26899 "background-color": new el(rl.paint_background["background-color"]), 26900 "background-pattern": new el(rl.paint_background["background-pattern"]), 26901 "background-opacity": new el(rl.paint_background["background-opacity"]), 26902 "background-emissive-strength": new el(rl.paint_background["background-emissive-strength"]), 26903 "background-color-use-theme": new tl({ 26904 type: "string", 26905 default: "default", 26906 "property-type": "data-driven" 26907 }) 26908 })) 26909 }, t1, i, n); 26910 } 26911 }, 26912 raster: sb, 26913 "raster-particle": mb, 26914 sky: class extends Rl { 26915 _clear() { 26916 this.skyboxFbo && (this.skyboxFbo.destroy(), this.skyboxFbo = null), this.colorRampTexture && (this.colorRampTexture.destroy(), this.colorRampTexture = null), this._skyboxInvali
26916dated = !0; 26917 } 26918 _handleSpecialPaintPropertyUpdate(e1) { 26919 "sky-gradient" === e1 ? this._updateColorRamp() : "sky-atmosphere-sun" !== e1 && "sky-atmosphere-halo-color" !== e1 && "sky-atmosphere-color" !== e1 && "sky-atmosphere-sun-intensity" !== e1 || (this._skyboxInvalidated = !0); 26920 } 26921 _updateColorRamp() { 26922 this.colorRamp = xv({ 26923 expression: this._transitionablePaint._values["sky-gradient"].value.expression, 26924 evaluationKey: "skyRadialProgress" 26925 }), this.colorRampTexture && (this.colorRampTexture.destroy(), this.colorRampTexture = null); 26926 } 26927 needsSkyboxCapture(e1) { 26928 if (this._skyboxInvalidated || !this.skyboxTexture || !this.skyboxGeometry) return !0; 26929 if (!this.paint.get("sky-atmosphere-sun")) { 26930 const t1 = e1.style.light.properties.get("position"); 26931 return this._lightPosition.azimuthal !== t1.azimuthal || this._lightPosition.polar !== t1.polar; 26932 } 26933 return !1; 26934 } 26935 getCenter(e1, t1) { 26936 if ("atmosphere" === this.paint.get("sky-type")) { 26937 const i = this.paint.get("sky-atmosphere-sun"), n = !i, r = e1.style.light, o = r.properties.get("position"); 26938 return n && "viewport" === r.properties.get("anchor") && gt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."), n ? gb(o.azimuthal, 90 - o.polar, t1) : gb(i[0], 90 - i[1], t1); 26939 } 26940 const i = this.paint.get("sky-gradient-center"); 26941 return gb(i[0], 90 - i[1], t1); 26942 } 26943 isSky() { 26944 return !0; 26945 } 26946 markSkyboxValid(e1) { 26947 this._skyboxInvalidated = !1, this._lightPosition = e1.style.light.properties.get("position"); 26948 } 26949 hasOffscreenPass() { 26950 return !0; 26951 } 26952 getProgramIds() { 26953 const e1 = this.paint.get("sky-type"); 26954 return "atmosphere" === e1 ? [ 26955 "skyboxCapture", 26956 "skybox" 26957 ] : "gradient" === e1 ? [ 26958 "skyboxGradient" 26959 ] : null; 26960 } 26961 constructor(e1, t1, i, n){ 26962 super(e1, { 26963 layout: ub || (ub = new nl({ 26964 visibility: new el(rl.layout_sky.visibility) 26965 })), 26966 paint: hb || (hb = new nl({ 26967 "sky-type": new el(rl.paint_sky["sky-type"]), 26968 "sky-atmosphere-sun": new el(rl.paint_sky["sky-atmosphere-sun"]), 26969 "sky-atmosphere-sun-intensity": new el(rl.paint_sky["sky-atmosphere-sun-intensity"]), 26970 "sky-gradient-center": new el(rl.paint_sky["sky-gradient-center"]), 26971 "sky-gradient-radius": new el(rl.paint_sky["sky-gradient-radius"]), 26972 "sky-gradient": new il(rl.paint_sky["sky-gradient"]), 26973 "sky-atmosphere-halo-color": new el(rl.paint_sky["sky-atmosphere-halo-color"]), 26974 "sky-atmosphere-color": new el(rl.paint_sky["sky-atmosphere-color"]), 26975 "sky-opacity": new el(rl.paint_sky["sky-opacity"]), 26976 "sky-gradient-use-theme": new tl({ 26977 type: "string", 26978 default: "default", 26979 "property-type": "data-driven" 26980 }), 26981 "sky-atmosphere-halo-color-use-theme": new tl({ 26982 type: "string", 26983 default: "default", 26984 "property-type": "data-driven" 26985 }), 26986 "sky-atmosphere-color-use-theme": new tl({ 26987 type: "string", 26988 default: "default", 26989 "property-type": "data-driven" 26990 }) 26991 })) 26992 }, t1, i, n), this._updateColorRamp(); 26993 } 26994 }, 26995 slot: class extends Rl { 26996 constructor(e1, t1, i, n){ 26997 super(e1, { 26998 paint: db || (db = new nl({})) 26999 }, t1, null); 27000 } 27001 }, 27002 model: class extends Rl { 27003 mayUse(e1) { 27004 return "Standard" === e1; 27005 } 27006 prepare() { 27007 return sE(); 27008 } 27009 createBucket(e1) { 27010 return new vb(e1); 27011 } 27012 getProgramIds() { 27013 return [ 27014 "model" 27015 ]; 27016 } 27017 is3D(e1) { 27018 return !0; 27019 } 27020 hasShadowPass() { 27021 return !0; 27022 } 27023 canCastShadows() { 27024 return !0; 27025 } 27026 hasLightBeamPass() { 27027 return !0; 27028 } 27029 cutoffRange() { 27030 return this.paint.get("model-cutoff-fade-range"); 27031 } 27032 queryRadius(e1) { 27033 return e1.isTiled3dModelBucket ? 8191 : 0; 27034 } 27035 queryRenderedFeatures(e1, t1, i) { 27036 return nE.queryModelLayerRendered ? nE.queryModelLayerRendered(this, e1, t1, i) : {}; 27037 } 27038 queryIntersectsFeature(e1, t1, i, n, r, o, a, s, l, c) { 27039 return !!nE.queryModelLayerIntersectsFeature && nE.queryModelLayerIntersectsFeature(this, e1, t1, i, o, c); 27040 } 27041 _handleOverridablePaintPropertyUpdate(e1, t1, i) { 27042 return !(!this.layout || t1.isDataDriven() || i.isDataDriven() || "model-color" !== e1 && "model-color-mix-intensity" !== e1 && "model-rotation" !== e1 && "model-scale" !== e1 && "model-translation" !== e1 && "model-emissive-strength" !== e1); 27043 } 27044 _isPropertyZoomDependent(e1) { 27045 const t1 = this._transitionablePaint._values[e1]; 27046 return null != t1 && null != t1.value && null != t1.value.expression && t1.value.expression instanceof Ga; 27047 } 27048 isZoomDependent() { 27049 return this._isPropertyZoomDependent("model-scale") || this._isPropertyZoomDependent("model-rotation") || this._isPropertyZoomDependent("model-translation"); 27050 } 27051 constructor(e1, t1, i, n){ 27052 super(e1, { 27053 layout: fb || (fb = new nl({ 27054 visibility: new el(rl.layout_model.visibility), 27055 "model-id": new tl(rl.layout_model["model-id"]), 27056 "model-allow-density-reduction": new el(rl.layout_model["model-allow-density-reduction"]) 27057 })), 27058 paint: pb || (pb = new nl({ 27059 "model-opacity": new tl(rl.paint_model["model-opacity"]), 27060 "model-rotation": new tl(rl.paint_model["model-rotation"]), 27061 "model-scale": new tl(rl.paint_model["model-scale"]), 27062 "model-translation": new tl(rl.paint_model["model-translation"]), 27063 "model-color": new tl(rl.paint_model["model-color"]), 27064 "model-color-mix-intensity": new tl(rl.paint_model["model-color-mix-intensity"]), 27065 "model-type": new el(rl.paint_model["model-type"]), 27066 "model-cast-shadows": new el(rl.paint_model["model-cast-shadows"]), 27067 "model-receive-shadows": new el(rl.paint_model["model-receive-shadows"]), 27068 "model-ambient-occlusion-intensity": new el(rl.paint_model["model-ambient-occlusion-intensity"]), 27069 "model-emissive-strength": new tl(rl.paint_model["model-emissive-strength"]), 27070 "model-roughness": new tl(rl.paint_model["model-roughness"]), 27071 "model-height-based-emissive-strength-multiplier": new tl(rl.paint_model["model-height-based-emissive-strength-multiplier"]), 27072 "model-cutoff-fade-range": new el(rl.paint_model["model-cutoff-fade-range"]), 27073 "model-front-cutoff": new el(rl.paint_model["model-front-cutoff"]), 27074 "model-elevation-reference": new el(rl.paint_model["model-elevation-reference"]), 27075 "model-line-cutout-mode": new el(rl.paint_model["model-line-cutout-mode"]), 27076 "model-color-use-theme": new tl({ 27077 type: "string", 27078 default: "default", 27079 "property-type": "data-driven" 27080 }) 27081 })) 27082 }, t1, i, n), this.layer = e1, this._stats = {
27083 numRenderedVerticesInShadowPass: 0, 27084 numRenderedVerticesInTransparentPass: 0 27085 }; 27086 } 27087 }, 27088 clip: class extends Rl { 27089 recalculate(e1, t1) { 27090 super.recalculate(e1, t1); 27091 } 27092 createBucket(e1) { 27093 return new Dv(e1); 27094 } 27095 is3D(e1) { 27096 return !0; 27097 } 27098 constructor(e1, t1, i, n){ 27099 super(e1, { 27100 layout: Ev || (Ev = new nl({ 27101 "clip-layer-types": new el(rl.layout_clip["clip-layer-types"]), 27102 "clip-layer-scope": new el(rl.layout_clip["clip-layer-scope"]), 27103 visibility: new el(rl.layout_clip.visibility) 27104 })), 27105 paint: Iv || (Iv = new nl({})) 27106 }, t1, i, n); 27107 } 27108 } 27109 }; 27110 class cE { 27111 get(e1) { 27112 if (!this.cache.has(e1)) return; 27113 const t1 = this.cache.get(e1); 27114 return this.cache.delete(e1), this.cache.set(e1, t1), t1; 27115 } 27116 put(e1, t1) { 27117 this.cache.has(e1) ? this.cache.delete(e1) : this.cache.size === this.capacity && this.cache.delete(this.cache.keys().next().value), this.cache.set(e1, t1); 27118 } 27119 delete(e1) { 27120 this.cache.delete(e1); 27121 } 27122 constructor(e1){ 27123 this.capacity = e1, this.cache = new Map; 27124 } 27125 } 27126 Xa(cE, "LRUCache"); 27127 class uE { 27128 trigger() { 27129 this._triggered || (this._triggered = !0, this._channel ? this._channel.port1.postMessage(!0) : setTimeout(()=>{ 27130 this._triggered = !1, this._callback(); 27131 }, 0)); 27132 } 27133 remove() { 27134 this._channel && (this._channel.port1.close(), this._channel.port2.close()), this._callback = ()=>{}; 27135 } 27136 constructor(e1){ 27137 this._callback = e1, this._triggered = !1, "undefined" != typeof MessageChannel && (this._channel = new MessageChannel, this._channel.port2.onmessage = ()=>{ 27138 this._triggered = !1, this._callback(); 27139 }); 27140 } 27141 } 27142 const hE = { 27143 Other: 0, 27144 Symbol: 1, 27145 FillExtrusion: 2, 27146 HdRoadCoverage: 3, 27147 HdRoadElevation: 4 27148 }; 27149 class dE { 27150 add(e1, t1) { 27151 const i = this.nextId++, n = function(param) { 27152 let { type: e1, renderSourceType: t1, zoom: i } = param; 27153 i = i || 0; 27154 const n = t1 === hE.Symbol; 27155 return "message" === e1 ? 0 : "maybePrepare" !== e1 || n ? "parseTile" !== e1 || n ? "parseTile" === e1 && n ? 300 - i : "maybePrepare" === e1 && n ? 400 - i : 500 : 200 - i : 100 - i; 27156 }(t1); 27157 if (0 === n) { 27158 try { 27159 e1(); 27160 } finally{} 27161 return null; 27162 } 27163 return this.tasks.set(i, { 27164 fn: e1, 27165 metadata: t1, 27166 priority: n, 27167 id: i 27168 }), this.invoker.trigger(), { 27169 cancel: ()=>{ 27170 this.tasks.delete(i); 27171 } 27172 }; 27173 } 27174 process() { 27175 try { 27176 const e1 = this.pick(); 27177 if (!e1) return; 27178 this.tasks.delete(e1.id), this.tasks.size > 0 && this.invoker.trigger(), e1.fn(); 27179 } finally{} 27180 } 27181 pick() { 27182 let e1 = null, t1 = 1 / 0; 27183 for (const i of this.tasks.values())i.priority < t1 && (t1 = i.priority, e1 = i); 27184 return e1; 27185 } 27186 remove() {
27187 this.tasks.clear(), this.invoker.remove(); 27188 } 27189 constructor(){ 27190 this.tasks = new Map, ht([ 27191 "process" 27192 ], this), this.invoker = new uE(this.process), this.nextId = 0; 27193 } 27194 } 27195 const fE = { 27196 type: "message" 27197 }, pE = new Map, mE = new Map; 27198 class _E { 27199 getElevation(e1, t1) { 27200 const i = this.toIdx(e1, t1); 27201 return { 27202 min: this.minimums[i], 27203 max: this.maximums[i] 27204 }; 27205 } 27206 isLeaf(e1, t1) { 27207 return this.leaves[this.toIdx(e1, t1)]; 27208 } 27209 toIdx(e1, t1) { 27210 return t1 * this.size + e1; 27211 } 27212 constructor(e1){ 27213 this.size = e1, this.minimums = [], this.maximums = [], this.leaves = []; 27214 } 27215 } 27216 function gE(e1, t1, i, n) { 27217 let r = 0, o = Number.MAX_VALUE; 27218 for(let a = 0; a < 3; a++)if (Math.abs(n[a]) < 1e-15) { 27219 if (i[a] < e1[a] || i[a] > t1[a]) return null; 27220 } else { 27221 const s = 1 / n[a]; 27222 let l = (e1[a] - i[a]) * s, c = (t1[a] - i[a]) * s; 27223 if (l > c) { 27224 const e1 = l; 27225 l = c, c = e1; 27226 } 27227 if (l > r && (r = l), c < o && (o = c), r > o) return null; 27228 } 27229 return r; 27230 } 27231 function yE(e1, t1, i, n, r, o, a, s, l, c, u) { 27232 const h = n - e1, d = r - t1, f = o - i, p = a - e1, m = s
vendor: 7,712 bytes, lines 27232-27357
27232- t1, _ = l - i, g = u[1] * _ - u[2] * m, y = u[2] * p - u[0] * _, x = u[0] * m - u[1] * p, v = h * g + d * y + f * x; 27233 if (Math.abs(v) < 1e-15) return null; 27234 const b = 1 / v, w = c[0] - e1, A = c[1] - t1, E = c[2] - i, I = (w * g + A * y + E * x) * b; 27235 if (I < 0 || I > 1) return null; 27236 const M = A * f - E * d, T = E * h - w * f, S = w * d - A * h, z = (u[0] * M + u[1] * T + u[2] * S) * b; 27237 return z < 0 || I + z > 1 ? null : (p * M + m * T + _ * S) * b; 27238 } 27239 function xE(e1, t1, i, n, r, o, a, s, l) { 27240 const c = 1 << i, u = o - n, h = a - r, d = (e1 + 1) / c * u + n, f = (t1 + 0) / c * h + r, p = (t1 + 1) / c * h + r; 27241 s[0] = (e1 + 0) / c * u + n, s[1] = f, l[0] = d, l[1] = p; 27242 } 27243 class vE { 27244 raycastRoot(e1, t1, i, n, r, o) { 27245 let a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 1; 27246 return gE([ 27247 e1, 27248 t1, 27249 -100 27250 ], [ 27251 i, 27252 n, 27253 this.maximums[0] * a 27254 ], r, o); 27255 } 27256 raycast(e1, t1, i, n, r, o) { 27257 let a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 1; 27258 if (!this.nodeCount) return null; 27259 const s = this.raycastRoot(e1, t1, i, n, r, o, a); 27260 if (null == s) return null; 27261 const l = [], c = [], u = [], h = [], d = [ 27262 { 27263 idx: 0, 27264 t: s, 27265 nodex: 0, 27266 nodey: 0, 27267 depth: 0 27268 } 27269 ]; 27270 for(; d.length > 0;){ 27271 const { idx: s, t: f, nodex: p, nodey: m, depth: _ } = d.pop(); 27272 if (this.leaves[s]) { 27273 xE(p, m, _, e1, t1, i, n, u, h); 27274 const s = 1 << _, l = p / s, c = (p + 1) / s, d = m / s, g = (m + 1) / s, { dim: y, floatView: x, stride: v } = this.dem, b = Math.floor(l * y), w = Math.ceil(c * y), A = Math.floor(d * y), E = w - b, I = Math.ceil(g * y) - A; 27275 if (E <= 0 || I <= 0) continue; 27276 const M = u[0], T = u[1], S = (h[0] - M) / E, z = (h[1] - T) / I, R = Math.max(0, f), P = r[0] + o[0] * R, D = r[1] + o[1] * R, F = Math.abs(o[0]) > 1e-10, C = Math.abs(o[1]) > 1e-10, L = o[0] >= 0 ? 1 : -1, O = o[1] >= 0 ? 1 : -1; 27277 let B = Math.max(0, Math.min(E - 1, Math.floor((P - M) / S))), V = Math.max(0, Math.min(I - 1, Math.floor((D - T) / z))); 27278 const N = F ? Math.abs(S / o[0]) : Number.MAX_VALUE, k = C ? Math.abs(z / o[1]) : Number.MAX_VALUE; 27279 let j = F ? R + (M + (o[0] >= 0 ? B + 1 : B) * S - P) / o[0] : Number.MAX_VALUE, G = C ? R + (T + (o[1] >= 0 ? V + 1 : V) * z - D) / o[1] : Number.MAX_VALUE; 27280 const H = (e1, t1)=>x[(t1 + 1) * v + e1 + 1] * a; 27281 let $ = H(b + B, A + V), Z = H(b + B + 1, A + V), W = H(b + B, A + V + 1), q = H(b + B + 1, A + V + 1), X = null; 27282 for(let e1 = 0; e1 < E + I; e1++){ 27283 const e1 = Math.min(j, G); 27284 if (o[2] >= 0 || r[2] + o[2] * e1 <= Math.max($, Z, W, q)) { 27285 const e1 = M + B * S, t1 = e1 + S, i = T + V * z, n = i + z, a = yE(t1, i, Z, e1, i, $, e1, n, W, r, o), s = yE(e1, n, W, t1, n, q, t1, i, Z, r, o); 27286 null != a && a >= 0 && (null === X || a < X) && (X = a), null != s && s >= 0 && (null === X || s < X) && (X = s); 27287 } 27288 const t1 = j < G; 27289 if (t1 ? (B += L, j += N) : (V += O, G += k), B < 0 || B >= E || V < 0 || V >= I) break; 27290 if (null !== X && e1 > X) break; 27291 t1 ? L > 0 ? ($ = Z, W = q, Z = H(b + B + 1, A + V), q = H(b + B + 1, A + V + 1)) : (Z = $, q = W, $ = H(b + B, A + V), W = H(b + B, A + V + 1)) : O > 0 ? ($ = W, Z = q, W = H(b + B, A + V + 1), q = H(b + B + 1, A + V + 1)) : (W = $, q = Z, $ = H(b + B, A + V), Z = H(b + B + 1, A + V)); 27292 } 27293 if (null !== X) return X || 0; 27294 const Y = U([], r, o, f), J = (Y[0] - u[0]) / (h[0] - u[0]), K = (Y[1] - u[1]) / (h[1] - u[1]), Q = wE(l, d, this.dem) * a, ee = wE(c, d, this.dem) * a, te = wE(c, g, this.dem) * a; 27295 if (bE(Q, ee, wE(l, g, this.dem) * a, te, J, K) >= Y[2]) return f; 27296 continue; 27297 } 27298 let g = 0; 27299 for(let d = 0; d < this._siblingOffset.length; d++){ 27300 xE((p << 1) + this._siblingOffset[d][0], (m << 1) + this._siblingOffset[d][1], _ + 1, e1, t1, i, n, u, h), u[2] = -100, h[2] = this.maximums[this.childOffsets[s] + d] * a; 27301 const f = gE(u, h, r, o); 27302 if (null != f) { 27303 const e1 = f; 27304 l[d] = e1; 27305 let t1 = !1; 27306 for(let i = 0; i < g && !t1; i++)e1 >= l[c[i]] && (c.splice(i, 0, d), t1 = !0); 27307 t1 || (c[g] = d), g++; 27308 } 27309 } 27310 for(let e1 = 0; e1 < g; e1++){ 27311 const t1 = c[e1]; 27312 d.push({ 27313 idx: this.childOffsets[s] + t1, 27314 t: l[t1], 27315 nodex: (p << 1) + this._siblingOffset[t1][0], 27316 nodey: (m << 1) + this._siblingOffset[t1][1], 27317 depth: _ + 1 27318 }); 27319 } 27320 } 27321 return null; 27322 } 27323 _addNode(e1, t1, i) { 27324 return this.minimums.push(e1), this.maximums.push(t1), this.leaves.push(i), this.childOffsets.push(0), this.nodeCount++; 27325 } 27326 _construct(e1, t1, i, n, r) { 27327 if (1 === e1[n].isLeaf(t1, i)) return; 27328 this.childOffsets[r] || (this.childOffsets[r] = this.nodeCount); 27329 const o = n - 1, a = e1[o]; 27330 let s = 0, l = 0; 27331 for(let e1 = 0; e1 < this._siblingOffset.length; e1++){ 27332 const n = 2 * t1 + this._siblingOffset[e1][0], r = 2 * i + this._siblingOffset[e1][1], o = a.getElevation(n, r), c = a.isLeaf(n, r), u = this._addNode(o.min, o.max, c); 27333 c && (s |= 1 << e1), l || (l = u); 27334 } 27335 for(let n = 0; n < this._siblingOffset.length; n++)s & 1 << n || this._construct(e1, 2 * t1 + this._siblingOffset[n][0], 2 * i + this._siblingOffset[n][1], o, l + n); 27336 } 27337 constructor(e1){ 27338 if (this.maximums = [], this.minimums = [], this.leaves = [], this.childOffsets = [], this.nodeCount = 0, this.dem = e1, this._siblingOffset = [ 27339 [ 27340 0, 27341 0 27342 ], 27343 [ 27344 1, 27345 0 27346 ], 27347 [ 27348 0, 27349 1 27350 ], 27351 [ 27352 1, 27353 1 27354 ] 27355 ], !this.dem) return; 27356 const t1 = function(e1) { 27357 const t1 = e1.dim, i = Math.ceil(Math.log2(t1 / 8)), n = [];
27358 let r = Math.ceil(Math.pow(2, i)); 27359 const o = (e1, t1, i, n, r)=>{ 27360 const o = n ? 1 : 0, a = (e1 + 1) * i - o, s = t1 * i, l = (t1 + 1) * i - o; 27361 r[0] = e1 * i, r[1] = s, r[2] = a, r[3] = l; 27362 }; 27363 let a = new _E(r); 27364 const s = 1 / r, { floatView: l, stride: c } = e1, u = []; 27365 for(let i = 0; i < r * r; i++){ 27366 const n = Math.floor(i / r), h = i % r; 27367 o(h, n, s, !1, u); 27368 const d = wE(u[0], u[1], e1), f = wE(u[2], u[1], e1), p = wE(u[2], u[3], e1), m = wE(u[0], u[3], e1), _ = Math.min(d, f, p, m), g = Math.max(0, 8 * h - 1), y = Math.min(t1 - 1, 8 * (h + 1)), x = Math.max(0, 8 * n - 1), v = Math.min(t1 - 1, 8 * (n + 1)); 27369 let b = -1 / 0; 27370 for(let e1 = x; e1 <= v; e1++){ 27371 const t1 = (e1 + 1) * c; 27372 for(let e1 = g; e1 <= y; e1++){ 27373 const i = l[t1 + e1 + 1]; 27374 i > b && (b = i); 27375 } 27376 } 27377 a.minimums.push(_), a.maximums.push(b), a.leaves.push(1); 27378 } 27379 for(n.push(a), r /= 2; r >= 1; r /= 2){ 27380 const e1 = n.at(-1); 27381 a = new _E(r); 27382 for(let t1 = 0; t1 < r * r; t1++){ 27383 o(t1 % r, Math.floor(t1 / r), 2, !0, u); 27384 const i = e1.getElevation(u[0], u[1]), n = e1.getElevation(u[2], u[1]), s = e1.getElevation(u[2], u[3]), l = e1.getElevation(u[0], u[3]), c = e1.isLeaf(u[0], u[1]), h = e1.isLeaf(u[2], u[1]), d = e1.isLeaf(u[2], u[3]), f = e1.isLeaf(u[0], u[3]), p = Math.min(i.min, n.min, s.min, l.min), m = Math.max(i.max, n.max, s.max, l.max), _ = c && h && d && f; 27385 a.maximums.push(m), a.minimums.push(p), a.leaves.push(m - p <= 5 && _ ? 1 : 0); 27386 } 27387 n.push(a); 27388 } 27389 return n; 27390 }(this.dem), i = t1.length - 1, n = t1[i]; 27391 this._addNode(n.minimums[0], n.maximums[0], n.leaves[0]), this._construct(t1, 0, 0, i, 0); 27392 } 27393 } 27394 function bE(e1, t1, i, n, r, o) { 27395 return fn(fn(e1, i, o), fn(t1, n, o), r); 27396 } 27397 function wE(e1, t1, i) { 27398 const n = i.dim, r = it(e1 * n - .5, 0, n - 1), o = it(t1 * n - .5, 0, n - 1), a = Math.floor(r), s = Math.floor(o), l = Math.min(a + 1, n - 1), c = Math.min(s + 1, n - 1); 27399 return bE(i.get(a, s), i.get(l, s), i.get(a, c), i.get(l, c), r - a, o - s); 27400 } 27401 const AE = { 27402 mapbox: [ 27403 6553.6, 27404 25.6, 27405 .1, 27406 1e4 27407 ], 27408 terrarium: [ 27409 256, 27410 1, 27411 1 / 256, 27412 32768 27413 ] 27414 }; 27415 function EE(e1, t1, i) { 27416 return (256 * e1 * 256 + 256 * t1 + i) / 10 - 1e4; 27417 } 27418 function IE(e1, t1, i) { 27419 return 256 * e1 + t1 + i / 256 - 32768; 27420 } 27421 class ME { 27422 get tree() { 27423 return this._tree || this._buildQuadTree(), this._tree; 27424 } 27425 _buildQuadTree() { 27426 this._tree = new vE(this); 27427 } 27428 get(e1, t1) { 27429 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 27430 i && (e1 = it(e1, -1, this.dim), t1 = it(t1, -1, this.dim)); 27431 const n = this._idx(e1, t1); 27432 return this.floatView[n]; 27433 } 27434 set(e1, t1, i) { 27435 const n = this._idx(e1, t1), r = this.floatView[n]; 27436 return this.floatView[n] = i, i - r; 27437 } 27438 static getUnpackVector(e1) { 27439 return AE[e1]; 27440 } 27441 _idx(e1, t1) { 27442 if (e1 < -1 || e1 >= this.dim + 1 || t1 < -1 || t1 >= this.dim + 1) throw new RangeError("out of range source coordinates for DEM data"); 27443 return (t1 + 1) * this.stride + (e1 + 1); 27444 } 27445 static pack(e1, t1) { 27446 const i = [ 27447 0, 27448 0, 27449 0, 27450 0 27451 ], n = ME.getUnpackVector(t1); 27452 let r = Math.floor((e1 + n[3]) / n[2]); 27453 return i[2] = r % 256, r = Math.floor(r / 256), i[1] = r % 256, r = Math.floor(r / 256), i[0] = r, i; 27454 } 27455 getPixels() { 27456 return new hd({ 27457 width: this.stride, 27458 height: this.stride 27459 }, this.pixels); 27460 } 27461 backfillBorder(e1, t1, i) { 27462 if (this.dim !== e1.dim) throw new Error("dem dimension mismatch"); 27463 let n = t1 * this.dim, r = t1 * this.dim + this.dim, o = i * this.dim, a = i * this.dim + this.dim; 27464 switch(t1){ 27465 case -1: 27466 n = r - 1; 27467 break; 27468 case 1: 27469 r = n + 1; 27470 } 27471 switch(i){ 27472 case -1: 27473 o = a - 1; 27474 break; 27475 case 1: 27476 a = o + 1; 27477 }
vendor: 9,973 bytes, lines 27478-27726
27478 const s = -t1 * this.dim, l = -i * this.dim; 27479 for(let t1 = o; t1 < a; t1++)for(let i = n; i < r; i++){ 27480 const n = 4 * this._idx(i, t1), r = 4 * this._idx(i + s, t1 + l); 27481 this.pixels[n + 0] = e1.pixels[r + 0], this.pixels[n + 1] = e1.pixels[r + 1], this.pixels[n + 2] = e1.pixels[r + 2], this.pixels[n + 3] = e1.pixels[r + 3]; 27482 } 27483 } 27484 onDeserialize() { 27485 this._tree && (this._tree.dem = this); 27486 } 27487 constructor(e1, t1, i, n = !1){ 27488 if (this.uid = e1, t1.height !== t1.width) throw new RangeError("DEM tiles must be square"); 27489 if (i && "mapbox" !== i && "terrarium" !== i) return void gt('"'.concat(i, '" is not a valid encoding type. Valid types include "mapbox" and "terrarium".')); 27490 this.stride = t1.height; 27491 const r = this.dim = t1.height - 2, o = new Uint32Array(t1.data.buffer); 27492 if (this.pixels = new Uint8Array(t1.data.buffer), this.floatView = new Float32Array(t1.data.buffer), this.borderReady = n, this._modifiedForSources = {}, !n) { 27493 for(let e1 = 0; e1 < r; e1++)o[this._idx(-1, e1)] = o[this._idx(0, e1)], o[this._idx(r, e1)] = o[this._idx(r - 1, e1)], o[this._idx(e1, -1)] = o[this._idx(e1, 0)], o[this._idx(e1, r)] = o[this._idx(e1, r - 1)]; 27494 o[this._idx(-1, -1)] = o[this._idx(0, 0)], o[this._idx(r, -1)] = o[this._idx(r - 1, 0)], o[this._idx(-1, r)] = o[this._idx(0, r - 1)], o[this._idx(r, r)] = o[this._idx(r - 1, r - 1)]; 27495 } 27496 const a = "terrarium" === i ? IE : EE; 27497 for(let e1 = 0; e1 < o.length; ++e1){ 27498 const t1 = 4 * e1; 27499 this.floatView[e1] = a(this.pixels[t1], this.pixels[t1 + 1], this.pixels[t1 + 2]); 27500 } 27501 this._timestamp = kt.now(); 27502 } 27503 } 27504 function TE(e1, t1) { 27505 const i = {}; 27506 let n; 27507 for(; n = e1.nextField(t1);)1 === n ? (i.delta_filter = SE(e1, e1.readVarint() + e1.pos), i.filter = "delta_filter") : 2 === n ? (e1.readVarint(), i.filter = "zigzag_filter") : 3 === n ? (e1.readVarint(), i.filter = "bitshuffle_filter") : 4 === n && (e1.readVarint(), i.filter = "byteshuffle_filter"); 27508 return i; 27509 } 27510 function SE(e1, t1) { 27511 const i = { 27512 blockSize: 0 27513 }; 27514 let n; 27515 for(; n = e1.nextField(t1);)1 === n && (i.blockSize = e1.readVarint()); 27516 return i; 27517 } 27518 function zE(e1, t1) { 27519 const i = {}; 27520 let n; 27521 for(; n = e1.nextField(t1);)1 === n ? (e1.readVarint(), i.codec = "gzip_data") : 2 === n ? (e1.readVarint(), i.codec = "jpeg_image") : 3 === n ? (e1.readVarint(), i.codec = "webp_image") : 4 === n && (e1.readVarint(), i.codec = "png_image"); 27522 return i; 27523 } 27524 function RE(e1, t1) { 27525 const i = { 27526 firstByte: 0, 27527 lastByte: 0, 27528 filters: [], 27529 codec: null, 27530 offset: 0, 27531 scale: 0, 27532 bands: [] 27533 }; 27534 let n, r = 0, o = 0; 27535 for(; n = e1.nextField(t1);)1 === n ? i.firstByte = e1.readFixed64() : 2 === n ? i.lastByte = e1.readFixed64() : 3 === n ? i.filters.push(TE(e1, e1.readVarint() + e1.pos)) : 4 === n ? i.codec = zE(e1, e1.readVarint() + e1.pos) : 5 === n ? o = e1.readFloat() : 6 === n ? r = e1.readFloat() : 7 === n ? i.bands.push(e1.readString()) : 8 === n ? i.offset = e1.readDouble() : 9 === n && (i.scale = e1.readDouble()); 27536 return 0 === i.offset && (i.offset = o), 0 === i.scale && (i.scale = r), i; 27537 } 27538 function PE(e1, t1) { 27539 const i = { 27540 version: 0, 27541 name: "", 27542 units: "", 27543 tileSize: 0, 27544 buffer: 0, 27545 pixelFormat: 0, 27546 dataIndex: [] 27547 }; 27548 let n; 27549 for(; n = e1.nextField(t1);)1 === n ? i.version = e1.readVarint() : 2 === n ? i.name = e1.readString() : 3 === n ? i.units = e1.readString() : 4 === n ? i.tileSize = e1.readVarint() : 5 === n ? i.buffer = e1.readVarint() : 6 === n ? i.pixelFormat = e1.readVarint() : 7 === n && i.dataIndex.push(RE(e1, e1.readVarint() + e1.pos)); 27550 return i; 27551 } 27552 function DE(e1, t1, i) { 27553 let n; 27554 for(; n = e1.nextField(t1);)if (1 === n) { 27555 let t1 = 0; 27556 const n = e1.readVarint() + e1.pos; 27557 for(; e1.pos < n;)i[t1++] = e1.readVarint(); 27558 } 27559 return i; 27560 } 27561 function FE(e1, t1) { 27562 if (4 !== t1.length) throw new Error("Expected data of dimension 4 but got ".concat(t1.length, ".")); 27563 let i = t1[3]; 27564 for(let n = 2; n >= 1; n--){ 27565 const r = 1 === n ? 1 : 0, o = 2 === n ? 1 : 0; 27566 for(let n = 0; n < t1[0]; n++){ 27567 const a = t1[1] * n; 27568 for(let n = r; n < t1[1]; n++){ 27569 const r = t1[2] * (n + a); 27570 for(let n = o; n < t1[2]; n++){ 27571 const o = t1[3] * (n + r); 27572 for(let n = 0; n < t1[3]; n++){ 27573 const t1 = o + n; 27574 e1[t1] += e1[t1 - i]; 27575 } 27576 } 27577 } 27578 } 27579 i *= t1[n]; 27580 } 27581 return e1; 27582 } 27583 function CE(e1) { 27584 for(let t1 = 0, i = e1.length; t1 < i; t1++)e1[t1] = e1[t1] >>> 1 ^ -(1 & e1[t1]); 27585 return e1; 27586 } 27587 function LE(e1, t1) { 27588 switch(t1){ 27589 case "uint32": 27590 return e1; 27591 case "uint16": 27592 for(let t1 = 0; t1 < e1.length; t1 += 2){ 27593 const i = e1[t1], n = e1[t1 + 1]; 27594 e1[t1] = (240 & i) >> 4 | (61440 & i) >> 8 | (240 & n) << 4 | 61440 & n, e1[t1 + 1] = 15 & i | (3840 & i) >> 4 | (15 & n) << 8 | (3840 & n) << 4; 27595 } 27596 return e1; 27597 case "uint8": 27598 for(let t1 = 0; t1 < e1.length; t1 += 4){ 27599 const i = e1[t1], n = e1[t1 + 1], r = e1[t1 + 2], o = e1[t1 + 3]; 27600 e1[t1 + 0] = (192 & i) >> 6 | (192 & n) >> 4 | (192 & r) >> 2 | 192 & o, e1[t1 + 1] = (48 & i) >> 4 | (48 & n) >> 2 | 48 & r | (48 & o) << 2, e1[t1 + 2] = (12 & i) >> 2 | 12 & n | (12 & r) << 2 | (12 & o) << 4, e1[t1 + 3] = 3 & i | (3 & n) << 2 | (3 & r) << 4 | (3 & o) << 6; 27601 } 27602 return e1; 27603 default: 27604 throw new Error('Invalid pixel format, "'.concat(t1, '"')); 27605 } 27606 } 27607 Xa(ME, "DEMData"), Xa(vE, "DemMinMaxQuadTree", { 27608 omit: [ 27609 "dem" 27610 ] 27611 }); 27612 var OE = Uint8Array, BE = Uint16Array, VE = Int32Array, NE = new OE([ 27613 0, 27614 0, 27615 0, 27616 0, 27617 0, 27618 0, 27619 0, 27620 0, 27621 1, 27622 1, 27623 1, 27624 1, 27625 2, 27626 2, 27627 2, 27628 2, 27629 3, 27630 3, 27631 3, 27632 3, 27633 4, 27634 4, 27635 4, 27636 4, 27637 5, 27638 5, 27639 5, 27640 5, 27641 0, 27642 0, 27643 0, 27644 0 27645 ]), kE = new OE([ 27646 0, 27647 0, 27648 0, 27649 0, 27650 1, 27651 1, 27652 2, 27653 2, 27654 3, 27655 3, 27656 4, 27657 4, 27658 5, 27659 5, 27660 6, 27661 6, 27662 7, 27663 7, 27664 8, 27665 8, 27666 9, 27667 9, 27668 10, 27669 10, 27670 11, 27671 11, 27672 12, 27673 12, 27674 13, 27675 13, 27676 0, 27677 0 27678 ]), UE = new OE([ 27679 16, 27680 17, 27681 18, 27682 0, 27683 8, 27684 7, 27685 9, 27686 6, 27687 10, 27688 5, 27689 11, 27690 4, 27691 12, 27692 3, 27693 13, 27694 2, 27695 14, 27696 1, 27697 15 27698 ]), jE = function(e1, t1) { 27699 for(var i = new BE(31), n = 0; n < 31; ++n)i[n] = t1 += 1 << e1[n - 1]; 27700 var r = new VE(i[30]); 27701 for(n = 1; n < 30; ++n)for(var o = i[n]; o < i[n + 1]; ++o)r[o] = o - i[n] << 5 | n; 27702 return { 27703 b: i, 27704 r 27705 }; 27706 }, GE = jE(NE, 2), HE = GE.b, $E = GE.r; 27707 HE[28] = 258, $E[258] = 28; 27708 for(var ZE = jE(kE, 0).b, WE = new BE(32768), qE = 0; qE < 32768; ++qE){ 27709 var XE = (43690 & qE) >> 1 | (21845 & qE) << 1; 27710 WE[qE] = ((65280 & (XE = (61680 & (XE = (52428 & XE) >> 2 | (13107 & XE) << 2)) >> 4 | (3855 & XE) << 4)) >> 8 | (255 & XE) << 8) >> 1; 27711 } 27712 var YE = function(e1, t1, i) { 27713 for(var n = e1.length, r = 0, o = new BE(t1); r < n; ++r)e1[r] && ++o[e1[r] - 1]; 27714 var a, s = new BE(t1); 27715 for(r = 1; r < t1; ++r)s[r] = s[r - 1] + o[r - 1] << 1; 27716 a = new BE(1 << t1); 27717 var l = 15 - t1; 27718 for(r = 0; r < n; ++r)if (e1[r]) for(var c = r << 4 | e1[r], u = t1 - e1[r], h = s[e1[r] - 1]++ << u, d = h | (1 << u) - 1; h <= d; ++h)a[WE[h] >> l] = c; 27719 return a; 27720 }, JE = new OE(288); 27721 for(qE = 0; qE < 144; ++qE)JE[qE] = 8; 27722 for(qE = 144; qE < 256; ++qE)JE[qE] = 9; 27723 for(qE = 256; qE < 280; ++qE)JE[qE] = 7; 27724 for(qE = 280; qE < 288; ++qE)JE[qE] = 8; 27725 var KE = new OE(32); 27726 for(qE = 0; qE < 32; ++qE)KE[qE] = 5;
27727 var QE = YE(JE, 9), eI = YE(KE, 5), tI = function(e1) { 27728 for(var t1 = e1[0], i = 1; i < e1.length; ++i)e1[i] > t1 && (t1 = e1[i]); 27729 return t1; 27730 }, iI = function(e1, t1, i) { 27731 var n = t1 / 8 | 0; 27732 return (e1[n] | e1[n + 1] << 8) >> (7 & t1) & i; 27733 }, nI = function(e1, t1) { 27734 var i = t1 / 8 | 0; 27735 return (e1[i] | e1[i + 1] << 8 | e1[i + 2] << 16) >> (7 & t1); 27736 }, rI = function(e1) { 27737 return (e1 + 7) / 8 | 0; 27738 }, oI = [ 27739 "unexpected EOF", 27740 "invalid block type", 27741 "invalid length/literal", 27742 "invalid distance", 27743 "stream finished", 27744 "no stream handler", 27745 , 27746 "no callback", 27747 "invalid UTF-8 data", 27748 "extra field too long", 27749 "date not in range 1980-2099", 27750 "filename too long", 27751 "stream finishing", 27752 "invalid zip data" 27753 ], aI = function(e1, t1, i) { 27754 var n = new Error(t1 || oI[e1]); 27755 if (n.code = e1, Error.captureStackTrace && Error.captureStackTrace(n, aI), !i) throw n; 27756 return n; 27757 }, sI = new OE(0); 27758 var lI = "undefined" != typeof TextDecoder && new TextDecoder; 27759 try { 27760 lI.decode(sI, { 27761 stream: !0 27762 }); 27763 } catch (e1) {} 27764 const cI = { 27765 gzip_data: "gzip" 27766 }; 27767 class uI extends Error { 27768 constructor(e1){ 27769 super(e1), this.name = "MRTError"; 27770 } 27771 } 27772 const hI = { 27773 0: "uint32", 27774 1: "uint32", 27775 2: "uint16", 27776 3: "uint8" 27777 }, dI = { 27778 uint32: 1, 27779 uint16: 2, 27780 uint8: 4 27781 }, fI = { 27782 uint32: Uint32Array, 27783 uint16: Uint16Array, 27784 uint8: Uint8Array 27785 }; 27786 let pI; 27787 class mI { 27788 getLayer(e1) { 27789 const t1 = this.layers[e1]; 27790 if (!t1) throw new uI("Layer '".concat(e1, "' not found")); 27791 return t1; 27792 } 27793 getHeaderLength(e1) { 27794 const t1 = new Uint8Array(e1), i = new DataView(e1); 27795 if (13 !== t1[0]) throw new uI("File is not a valid MRT."); 27796 return i.getUint32(1, !0); 27797 } 27798 parseHeader(e1) { 27799 const t1 = new Uint8Array(e1), i = this.getHeaderLength(e1); 27800 if (t1.length < i) throw new uI("Expected header with length >= ".concat(i, " but got buffer of length ").concat(t1.length)); 27801 const n = function(e1) { 27802 const t1 = { 27803 headerLength: 0, 27804 x: 0, 27805 y: 0, 27806 z: 0, 27807 layers: [] 27808 }; 27809 let i; 27810 for(; i = e1.nextField(void 0);)1 === i ? t1.headerLength = e1.readFixed32() : 2 === i ? t1.x = e
278101.readVarint() : 3 === i ? t1.y = e1.readVarint() : 4 === i ? t1.z = e1.readVarint() : 5 === i && t1.layers.push(PE(e1, e1.readVarint() + e1.pos)); 27811 return t1; 27812 }(new pI(t1.subarray(0, i))); 27813 if (!isNaN(this.x) && (this.x !== n.x || this.y !== n.y || this.z !== n.z)) throw new uI("Invalid attempt to parse header ".concat(n.z, "/").concat(n.x, "/").concat(n.y, " for tile ").concat(this.z, "/").concat(this.x, "/").concat(this.y)); 27814 this.x = n.x, this.y = n.y, this.z = n.z; 27815 for (const e1 of n.layers)this.layers[e1.name] = new _I(e1, { 27816 cacheSize: this._cacheSize 27817 }); 27818 return this; 27819 } 27820 createDecodingTask(e1) { 27821 const t1 = [], i = this.getLayer(e1.layerName); 27822 for (let n of e1.blockIndices){ 27823 const r = i.dataIndex[n], o = r.firstByte - e1.firstByte, a = r.lastByte - e1.firstByte; 27824 if (i._blocksInProgress.has(n)) continue; 27825 const s = { 27826 layerName: i.name, 27827 firstByte: o, 27828 lastByte: a, 27829 pixelFormat: i.pixelFormat, 27830 blockIndex: n, 27831 blockShape: [ 27832 r.bands.length 27833 ].concat(i.bandShape), 27834 buffer: i.buffer, 27835 codec: r.codec.codec, 27836 filters: r.filters.map((e1)=>e1.filter) 27837 }; 27838 i._blocksInProgress.add(n), t1.push(s); 27839 } 27840 return new gI(t1, ()=>{ 27841 t1.forEach((e1)=>i._blocksInProgress.delete(e1.blockIndex)); 27842 }, (e1, n)=>{ 27843 if (t1.forEach((e1)=>i._blocksInProgress.delete(e1.blockIndex)), e1) throw e1; 27844 n.forEach((e1)=>{ 27845 this.getLayer(e1.layerName).processDecodedData(e1); 27846 }); 27847 }); 27848 } 27849 constructor(e1 = 5){ 27850 this.x = NaN, this.y = NaN, this.z = NaN, this.layers = {}, this._cacheSize = e1; 27851 } 27852 } 27853 class _I { 27854 get dimension() { 27855 return dI[this.pixelFormat]; 27856 } 27857 get cacheSize() { 27858 return this._decodedBlocks.capacity; 27859 } 27860 getBandList() { 27861 return this.dataIndex.map((param)=>{ 27862 let { bands: e1 } = param; 27863 return e1; 27864 }).flat(); 27865 } 27866 processDecodedData(e1) { 27867 const t1 = e1.blockIndex.toString(); 27868 this._decodedBlocks.get(t1) || this._decodedBlocks.put(t1, e1.data); 27869 } 27870 getBlockForBand(e1) { 27871 let t1 = 0; 27872 switch(typeof e1){ 27873 case "string": 27874 for (const [i, n] of this.dataIndex.entries()){ 27875 for (const [r, o] of n.bands.entries())if (o === e1) return { 27876 bandIndex: t1 + r, 27877 blockIndex: i, 27878 blockBandIndex: r 27879 }; 27880 t1 += n.bands.length; 27881 } 27882 break; 27883 case "number": 27884 for (const [i, n] of this.dataIndex.entries()){ 27885 if (e1 >= t1 && e1 < t1 + n.bands.length) return { 27886 bandIndex: e1, 27887 blockIndex: i, 27888 blockBandIndex: e1 - t1 27889 }; 27890 t1 += n.bands.length; 27891 } 27892 break; 27893 default: 27894 throw new uI("Invalid band `".concat(JSON.stringify(e1), "`. Expected string or integer.")); 27895 } 27896 return { 27897 blockIndex: -1, 27898 blockBandIndex: -1 27899 }; 27900 } 27901 getDataRange(e1) { 27902 let t1 = 1 / 0, i = -1 / 0; 27903 const n = [], r = new Set; 27904 for (const o of e1){ 27905 const { blockIndex: e1 } = this.getBlockForBand(o); 27906 if (e1 < 0) throw new uI("Invalid band: ".concat(JSON.stringify(o))); 27907 const a = this.dataIndex[e1]; 27908 n.includes(e1) || n.push(e1), r.add(e1), t1 = Math.min(t1, a.firstByte), i = Math.max(i, a.lastByte); 27909 } 27910 if (r.size > this.cacheSize) throw new uI("Number of blocks to decode (".concat(r.size, ") exceeds cache size (").concat(this.cacheSize, ").")); 27911 return { 27912 layerName: this.name, 27913 firstByte: t1, 27914 lastByte: i, 27915 blockIndices: n 27916 }; 27917 } 27918 hasBand(e1) { 27919 const { blockIndex: t1 } = this.getBlockForBand(e1); 27920 return t1 >= 0; 27921 } 27922 hasDataForBand(e1) { 27923 const { blockIndex: t1 } = this.getBlockForBand(e1); 27924 return t1 >= 0 && !!this._decodedBlocks.get(t1.toString()); 27925 } 27926 getBandView(e1) { 27927 const { blockIndex: t1, blockBandIndex: i } = this.getBlockForBand(e1); 27928 if (t1 < 0) throw new uI("Band not found: ".concat(JSON.stringify(e1))); 27929 const n = this._decodedBlocks.get(t1.toString()); 27930 if (!n) throw new uI("Data for band ".concat(JSON.stringify(e1), ' of layer "').concat(this.name, '" not decoded.')); 27931 const r = this.dataIndex[t1], o = this.bandShape.reduce((e1, t1)=>
27931e1 * t1, 1), a = i * o, s = n.subarray(a, a + o); 27932 return { 27933 data: s, 27934 bytes: new Uint8Array(s.buffer).subarray(s.byteOffset, s.byteOffset + s.byteLength), 27935 tileSize: this.tileSize, 27936 buffer: this.buffer, 27937 pixelFormat: this.pixelFormat, 27938 dimension: this.dimension, 27939 offset: r.offset, 27940 scale: r.scale 27941 }; 27942 } 27943 constructor({ version: e1, name: t1, units: i, tileSize: n, pixelFormat: r, buffer: o, dataIndex: a }, s){ 27944 if (this.version = e1, 1 !== this.version) throw new uI("Cannot parse raster layer encoded with MRT version ".concat(e1)); 27945 this.name = t1, this.units = i, this.tileSize = n, this.buffer = o, this.pixelFormat = hI[r], this.dataIndex = a, this.bandShape = [ 27946 n + 2 * o, 27947 n + 2 * o, 27948 dI[this.pixelFormat] 27949 ], this._decodedBlocks = new cE(s ? s.cacheSize : 5), this._blocksInProgress = new Set; 27950 } 27951 } 27952 mI.setPbf = function(e1) { 27953 pI = e1; 27954 }; 27955 class gI { 27956 cancel() { 27957 this._finalized || (this._onCancel(), this._finalized = !0); 27958 } 27959 complete(e1, t1) { 27960 this._finalized || (this._onComplete(e1, t1), this._finalized = !0); 27961 } 27962 constructor(e1, t1, i){ 27963 this.tasks = e1, this._onCancel = t1, this._onComplete = i, this._finalized = !1; 27964 } 27965 } 27966 mI.performDecoding = function(e1, t1) { 27967 const i = new Uint8Array(e1); 27968 return Promise.all(t1.tasks.map((e1)=>{ 27969 const { layerName: t1, firstByte: n, lastByte: r, pixelFormat: o, blockShape: a, blockIndex: s, filters: l, codec: c } = e1, u = i.subarray(n, r + 1), h = new Uint32Array(a[0] * a[1] * a[2]); 27970 let d; 27971 if ("gzip_data" !== c) throw new uI("Unhandled codec: ".concat(c)); 27972 return d = (function(e1, t1) { 27973 if (!globalThis.DecompressionStream && "gzip_data" === t1) return Promise.resolve((a = function(e1) { 27974 31 == e1[0] && 139 == e1[1] && 8 == e1[2] || aI(6, "invalid gzip data"); 27975 var t1 = e1[3], i = 10; 27976 4 & t1 && (i += 2 + (e1[10] | e1[11] << 8)); 27977 for(var n = (t1 >> 3 & 1) + (t1 >> 4 & 1); n > 0; n -= !e1[i++]); 27978 return i + (2 & t1); 27979 }(i = e1), a + 8 > i.length && aI(6, "invalid gzip data"), function(e1, t1, i, n) { 27980 var r = e1.length; 27981 if (!r || t1.f && !t1.l) return i || new OE(0); 27982 var o = !i, a = o || 2 != t1.i, s = t1.i; 27983 o && (i = new OE(3 * r)); 27984 var l = function(e1) { 27985 var t1 = i.length; 27986 if (e1 > t1) { 27987 var n = new OE(Math.max(2 * t1, e1)); 27988 n.set(i), i = n; 27989 } 27990 }, c = t1.f || 0, u = t1.p || 0, h = t1.b || 0, d = t1.l, f = t1.d, p = t1.m, m = t1.n, _ = 8 * r; 27991 do { 27992 if (!d) { 27993 c = iI(e1, u, 1); 27994 var g = iI(e1, u + 1, 3); 27995 if (u += 3, !g) { 27996 var y = e1[(z = rI(u) + 4) - 4] | e1[z - 3] << 8, x = z + y; 27997 if (x > r) { 27998 s && aI(0); 27999 break; 28000 } 28001 a && l(h + y), i.set(e1.subarray(z, x), h), t1.b = h += y, t1.p = u = 8 * x, t1.f = c; 28002 continue; 28003 } 28004 if (1 == g) d = QE, f = eI, p = 9, m = 5; 28005 else if (2 == g) { 28006 var v = iI(e1, u, 31) + 257, b = iI(e1, u + 10, 15) + 4, w = v + iI(e1, u + 5, 31) + 1; 28007 u += 14; 28008 for(var A = new OE(w), E = new OE(19), I = 0; I < b; ++I)E[UE[I]] = iI(e1, u + 3 * I, 7); 28009 u += 3 * b; 28010 var M = tI(E), T = (1 << M) - 1, S = YE(E, M); 28011 for(I = 0; I < w;){ 28012 var z, R = S[iI(e1, u, T)]; 28013 if (u += 15 & R, (z = R >> 4) < 16) A[I++] = z; 28014 else { 28015 var P = 0, D = 0; 28016 for(16 == z ? (D = 3 + iI(e1, u, 3), u += 2, P = A[I - 1]) : 17 == z ? (D = 3 + iI(e1, u, 7), u += 3) : 18 == z && (D = 11 + iI(e1, u, 127), u += 7); D--;)A[I++] = P; 28017 } 28018 } 28019 var F = A.subarray(0, v), C = A.subarray(v); 28020 p = tI(F), m = tI(C), d = YE(F, p), f = YE(C, m); 28021 } else aI(1); 28022 if (u > _) { 28023 s && aI(0); 28024 break; 28025 } 28026 } 28027 a && l(h + 131072); 28028 for(var L = (1 << p) - 1, O = (1 << m) - 1, B = u;; B = u){ 28029 var V = (P = d[nI(e1, u) & L]) >> 4; 28030 if ((u += 15 & P) > _) { 28031 s && aI(0); 28032 break; 28033 } 28034 if (P || aI(2), V < 256) i[h++] = V; 28035 else { 28036 if (256 == V) { 28037 B = u, d = null; 28038 break; 28039 } 28040 var N = V - 254; 28041 V > 264 && (N = iI(e1, u, (1 << (j = NE[I = V - 257])) - 1) + HE[I], u += j); 28042 var k = f[nI(e1, u) & O], U = k >> 4; 28043 if (k || aI(3), u += 15 & k, C = ZE[U], U > 3) { 28044 var j = kE[U]; 28045 C += nI(e1, u) & (1 << j) - 1, u += j; 28046 } 28047 if (u > _) { 28048 s && aI(0); 28049 break; 28050 } 28051 a && l(h + 131072); 28052 var G = h + N; 28053 if (h < C) { 28054 var H = 0 - C, $ = Math.min(C, G); 28055 for(H + h < 0 && aI(3); h < $; ++h)i[h] = n[H + h]; 28056 } 28057 for(; h < G; ++h)i[h] = i[h - C]; 28058 } 28059 } 28060 t1.l = d, t1.p = B, t1.b = h, t1.f = c, d && (c = 1, t1.m = p, t1.d = f, t1.n = m); 28061 }while (!c) 28062 return h != i.length && o ? function(e1, t1, i) { 28063 return (null == i || i > e1.length) && (i = e1.length), new OE(e1.subarray(0, i)); 28064 }(i, 0, h) : i.subarray(0, h); 28065 }(i.subarray(a, -8), { 28066 i: 2 28067 }, new OE(((r = i)[(o = r.length) - 4] | r[o - 3] << 8 | r[o - 2] << 16 | r[o - 1] << 24) >>> 0), n))); 28068 var i, n, r, o, a; 28069 const s = cI[t1]; 28070 if (!s) throw new Error("Unhandled codec: ".concat(t1)); 28071 const l = new globalThis.DecompressionStream(s); 28072 return new Response(new Blob([ 28073 e1 28074 ]).stream().pipeThrough(l)).arrayBuffer().then((e1)=>new Uint8Array(e1)); 28075 })(u, c).then((e1)=>((function(e1, t1) { 28076 let i; 28077 for(; i = e1.nextField();)if (2 === i) DE(e1, e1.readVarint() + e1.pos, t1); 28078 else if (3 === i) throw new Error("Not implemented"); 28079 })(new pI(e1), h), new (0, fI[o])(h.buffer))), d.then((e1)=>{ 28080 for(let t1 = l.length - 1; t1 >= 0; t1--)switch(l[t1]){ 28081 case "delta_filter": 28082 FE(e1, a); 28083 break; 28084 case "zigzag_filter": 28085 CE(e1); 28086 break; 28087 case "bitshuffle_filter": 28088 LE(e1, o); 28089 break; 28090 default: 28091 throw new uI('Unhandled filter "'.concat(l[t1], '"')); 28092 } 28093 return { 28094 layerName: t1, 28095 blockIndex: s, 28096 data: e1 28097 }; 28098 }).catch((e1)=>{ 28099 throw e1; 28100 }); 28101 })); 28102 }, Xa(gI, "MRTDecodingBatch", { 28103 omit: [ 28104 "_onCancel", 28105 "_onComplete" 28106 ] 28107 }), Xa(mI, "MapboxRasterTile"), Xa(_I, "MapboxRasterLayer", { 28108 omit: [ 28109 "_blocksInProgress" 28110 ] 28111 }); 28112 const yI = [ 28113 Int8Array, 28114 Uint8Array, 28115 Uint8ClampedArray, 28116 Int16Array, 28117 Uint16Array, 28118 Int32Array, 28119 Uint32Array, 28120 Float32Array, 28121 Float64Array 28122 ], xI = new Uint32Array(96); 28123 class vI { 28124 static from(e1) { 28125 if (!e1 || void 0 === e1.byteLength || e1.buffer) throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer."); 28126 const [t1, i] = new Uint8Array(e1, 0, 2); 28127 if (219 !== t1) throw new Error("Data does not appear to be in a KDBush format."); 28128 const n = i >> 4; 28129 if (1 !== n) throw new Error("Got v".concat(n, " data when expected v1."));
28130 const r = yI[15 & i]; 28131 if (!r) throw new Error("Unrecognized array type."); 28132 const [o] = new Uint16Array(e1, 2, 1), [a] = new Uint32Array(e1, 4, 1); 28133 return new vI(a, o, r, void 0, e1); 28134 } 28135 add(e1, t1) { 28136 const i = this._pos >> 1; 28137 return this.ids[i] = i, this.coords[this._pos++] = e1, this.coords[this._pos++] = t1, i; 28138 } 28139 finish() { 28140 const e1 = this._pos >> 1; 28141 if (e1 !== this.numItems) throw new Error("Added ".concat(e1, " items when expected ").concat(this.numItems, ".")); 28142 return bI(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this; 28143 } 28144 range(e1, t1, i, n) { 28145 if (!this._finished) throw new Error("Data not yet indexed - call index.finish()."); 28146 const { ids: r, coords: o, nodeSize: a } = this; 28147 xI[0] = 0, xI[1] = r.length - 1, xI[2] = 0; 28148 let s = 3; 28149 const l = []; 28150 for(; s > 0;){ 28151 const c = xI[--s], u = xI[--s], h = xI[--s]; 28152 if (u - h <= a) { 28153 for(let a = h; a <= u; a++){ 28154 const s = o[2 * a], c = o[2 * a + 1]; 28155 s >= e1 && s <= i && c >= t1 && c <= n && l.push(r[a]); 28156 } 28157 continue; 28158 } 28159 const d = h + u >> 1, f = o[2 * d], p = o[2 * d + 1]; 28160 f >= e1 && f <= i && p >= t1 && p <= n && l.push(r[d]), (0 === c ? e1 <= f : t1 <= p) && (xI[s++] = h, xI[s++] = d - 1, xI[s++] = 1 - c), (0 === c ? i >= f : n >= p) && (xI[s++] = d + 1, xI[s++] = u, xI[s++] = 1 - c); 28161 } 28162 return l; 28163 } 28164 within(e1, t1, i) { 28165 const n = []; 28166 return this.withinInto(e1, t1, i, n), n; 28167 } 28168 withinInto(e1, t1, i, n) { 28169 if (!this._finished) throw new Error("Data not yet indexed - call index.finish()."); 28170 const { ids: r, coords: o, nodeSize: a } = this; 28171 xI[0] = 0, xI[1] = r.length - 1, xI[2] = 0; 28172 let s = 3, l = 0; 28173 const c = i * i; 28174 for(; s > 0;){ 28175 const u = xI[--s], h = xI[--s], d = xI[--s]; 28176 if (h - d <= a) { 28177 for(let i = d; i <= h; i++)II(o[2 * i], o[2 * i + 1], e1, t1) <= c && (n[l++] = r[i]); 28178 continue; 28179 } 28180 const f = d + h >> 1, p = o[2 * f], m = o[2 * f + 1]; 28181 II(p, m, e1, t1) <= c && (n[l++] = r[f]), (0 === u ? e1 - i <= p : t1 - i <= m) && (xI[s++] = d, xI[s++] = f - 1, xI[s++] = 1 - u), (0 === u ? e1 + i >= p : t1 + i >= m) && (xI[s++] = f + 1, xI[s++] = h, xI[s++] = 1 - u); 28182 } 28183 return l; 28184 } 28185 constructor(e1, t1 = 64, i = Float64Array, n = ArrayBuffer, r){ 28186 if (isNaN(e1) || e1 < 0) throw new Error("Unexpected numItems value: ".concat(e1, ".")); 28187 this.numItems = +e1, this.nodeSize = Math.min(Math.max(+t1, 2), 65535), this.ArrayType = i, this.IndexArrayType = e1 < 65536 ? Uint16Array : Uint32Array; 28188 const o = yI.indexOf(this.ArrayType), a = 2 * e1 * this.ArrayType.BYTES_PER_ELEMENT, s = e1 * this.IndexArrayType.BYTES_PER_ELEMENT, l = (8 - s % 8) % 8; 28189 if (o < 0) throw new Error("Unexpected typed array class: ".concat(i, ".")); 28190 if (r) this.data = r, this.ids = new this.IndexArrayType(r, 8, e1), this.coords = new i(r, 8 + s + l, 2 * e1), this._pos = 2 * e1, this._finished = !0; 28191 else { 28192 const r = this.data = new n(8 + a + s + l); 28193 this.ids = new this.IndexArrayType(r, 8, e1), this.coords = new i(r, 8 + s + l, 2 * e1), this._pos = 0, this._finished = !1, new Uint8Array(r, 0, 2).set([ 28194 219, 28195 16 + o 28196 ]), new Uint16Array(r, 2, 1)[0] = t1, new Uint32Array(r, 4, 1)[0] = e1; 28197 } 28198 } 28199 } 28200 function bI(e1, t1, i, n, r, o) { 28201 if (r - n <= i) return; 28202 const a = n + r >> 1; 28203 wI(e1, t1, a, n, r, o), bI(e1, t1, i, n, a - 1, 1 - o), bI(e1, t1, i, a + 1, r, 1 - o); 28204 } 28205 function wI(e1, t1, i, n, r, o) { 28206 for(; r > n;){ 28207 if (r - n > 600) {
vendor: 4,627 bytes, lines 28208-28302
28208 const a = r - n + 1, s = i - n + 1, l = Math.log(a), c = .5 * Math.exp(2 * l / 3), u = .5 * Math.sqrt(l * c * (a - c) / a) * (s - a / 2 < 0 ? -1 : 1); 28209 wI(e1, t1, i, Math.max(n, Math.floor(i - s * c / a + u)), Math.min(r, Math.floor(i + (a - s) * c / a + u)), o); 28210 } 28211 const a = t1[2 * i + o]; 28212 let s = n, l = r; 28213 for(AI(e1, t1, n, i), t1[2 * r + o] > a && AI(e1, t1, n, r); s < l;){ 28214 for(AI(e1, t1, s, l), s++, l--; t1[2 * s + o] < a;)s++; 28215 for(; t1[2 * l + o] > a;)l--; 28216 } 28217 t1[2 * n + o] === a ? AI(e1, t1, n, l) : (l++, AI(e1, t1, l, r)), l <= i && (n = l + 1), i <= l && (r = l - 1); 28218 } 28219 } 28220 function AI(e1, t1, i, n) { 28221 EI(e1, i, n), EI(t1, 2 * i, 2 * n), EI(t1, 2 * i + 1, 2 * n + 1); 28222 } 28223 function EI(e1, t1, i) { 28224 const n = e1[t1]; 28225 e1[t1] = e1[i], e1[i] = n; 28226 } 28227 function II(e1, t1, i, n) { 28228 const r = e1 - i, o = t1 - n; 28229 return r * r + o * o; 28230 } 28231 t1.$ = Kb, t1.A = Lr, t1.B = Br, t1.C = mn, t1.D = Cr, t1.E = ln, t1.F = cr, t1.G = rr, t1.H = ir, t1.I = cn, t1.J = sl, t1.K = /^(.*)-transition$/, t1.L = cE, t1.M = Pa, t1.N = Sa, t1.O = De, t1.P = Pe, t1.Q = u, t1.R = si, t1.S = Yf, t1.T = mm, t1.U = /^(.*)-use-theme$/, t1.V = function(e1, t1) { 28232 const i = Yf(t1.zoom); 28233 if (0 === i) return Of(e1); 28234 const n = kf(e1), r = Uf(n), o = dr(n.getWest()) * t1.worldSize, a = dr(n.getEast()) * t1.worldSize, s = fr(n.getNorth()) * t1.worldSize, l = fr(n.getSouth()) * t1.worldSize, c = [ 28235 o, 28236 s, 28237 0 28238 ], u = [ 28239 a, 28240 s, 28241 0 28242 ], h = [ 28243 o, 28244 l, 28245 0 28246 ], d = [ 28247 a, 28248 l, 28249 0 28250 ], f = p([], t1.globeMatrix); 28251 return Y(c, c, f), Y(u, u, f), Y(h, h, f), Y(d, d, f), r[0] = Bf(r[0], h, i), r[1] = Bf(r[1], d, i), r[2] = Bf(r[2], u, i), r[3] = Bf(r[3], c, i), Rf.fromPoints(r); 28252 }, t1.W = Zf, t1.X = m, t1.Y = c, t1.Z = Xb, t1._ = $b, t1.a = async function(e1, t1) { 28253 e1.headers || (e1.headers = {}), e1.headers.accept = "image/webp,*/*"; 28254 const i = await function(e1) { 28255 return new Promise((t1, i)=>{ 28256 if (e1 && e1.aborted) return void i(e1.reason); 28257 const n = ()=>{ 28258 const e1 = yi.shift(); 28259 e1 ? e1() : xi--; 28260 }; 28261 if (xi < jt.MAX_PARALLEL_IMAGE_REQUESTS) return xi++, void t1(n); 28262 const r = ()=>{ 28263 e1 && e1.removeEventListener("abort", o), t1(n); 28264 }, o = ()=>{ 28265 const t1 = yi.indexOf(r); 28266 -1 !== t1 && yi.splice(t1, 1), i(e1.reason); 28267 }; 28268 e1 && e1.addEventListener("abort", o), yi.push(r); 28269 }); 28270 }(t1); 28271 try { 28272 const { data: i, headers: n } = await _i(e1, t1); 28273 let r; 28274 try { 28275 r = await createImageBitmap(new Blob([ 28276 new Uint8Array(i) 28277 ], { 28278 type: "image/png" 28279 })); 28280 } catch (e1) { 28281 throw new Error("Could not load image because of ".concat(e1.message, ". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."), { 28282 cause: e1 28283 }); 28284 } 28285 return t1 && t1.throwIfAborted(), { 28286 data: r, 28287 headers: n 28288 }; 28289 } finally{ 28290 i(); 28291 } 28292 }, t1.a$ = Au, t1.a0 = Mw, t1.a1 = qb, t1.a2 = eh, t1.a3 = Qu, t1.a4 = oh, t1.a5 = th, t1.a6 = zr, t1.a7 = dr, t1.a8 = fr, t1.a9 = z, t1.aA = Ac, t1.aB = sp, t1.aC = Ix, t1.aD = Bx, t1.aE = bw, t1.aF = GA, t1.aG = Gn, t1.aH = function(e1, t1, i, n, r, o, a, s, l, c, u, h, d, f, p, m, _, g) { 28293 let y = arguments.length > 18 && arguments[18] !== void 0 ? arguments[18] : !1; 28294 const x = VA(e1, t1, i, n, r, o, a, s, c, u, h, d, f, p, m, _, 1, [ 28295 0, 28296 0, 28297 0 28298 ], [ 28299 0, 28300 0, 28301 1 28302 ], y), v = {
28303 u_height_factor: -Math.pow(2, s.overscaledZ) / l.tileSize / 8 28304 }; 28305 return Object.assign(x, CA(t1, l, g), v); 28306 }, t1.aI = VA, t1.aJ = ux, t1.aK = 450, t1.aL = 7, t1.aM = (e1, t1, i, n, r, o)=>({ 28307 u_matrix: e1, 28308 u_edge_radius: t1, 28309 u_width_scale: i, 28310 u_vertical_scale: n, 28311 u_height_type: LA[r], 28312 u_base_type: LA[o] 28313 }), t1.aN = g, t1.aO = p, t1.aP = f, t1.aQ = kA, t1.aR = 4, t1.aS = 2, t1.aT = Bh, t1.aU = Nh, t1.aV = ht, t1.aW = class { 28314 static calculate(e1, t1, i) { 28315 const n = new Set, r = new Map, o = new Set, a = new Set; 28316 for (const i of Object.values(e1))for (const [e1, s] of Object.entries(i.floors)){ 28317 o.add(e1), s.isDefault && a.add(e1), s.conflicts && r.set(e1, s.conflicts); 28318 const i = e1 === t1, l = s.connections && t1 && s.connections.has(t1); 28319 (i || l) && n.add(e1); 28320 } 28321 const s = (e1)=>{ 28322 const t1 = r.get(e1) || new Set; 28323 for (const i of n)if ((r.get(i) || new Set).has(e1) || t1.has(i)) return !0; 28324 return !1; 28325 }; 28326 if (i) for (const e1 of i)o.has(e1) && (s(e1) || n.add(e1)); 28327 for (const e1 of a)n.has(e1) || s(e1) || n.add(e1); 28328 return n; 28329 } 28330 }, t1.aX = Ku, t1.aY = nh, t1.aZ = class extends Ju { 28331 set(e1, t1, i) { 28332 if (!this.fetchUniformLocation(e1, t1)) return; 28333 const n = this.current; 28334 for(let e1 = 0; e1 < 9; e1++)if (i[e1] !== n[e1]) { 28335 n.set(i), this.gl.uniformMatrix3fv(this.location, !1, n); 28336 break; 28337 } 28338 } 28339 constructor(e1){ 28340 super(e1), this.current = new Float32Array(9); 28341 } 28342 }, t1.a_ = kc, t1.aa = lu, t1.ab = Cd, t1.ac = ju, t1.ad = uu, t1.ae = qs, t1.af = nl, t1.ag = el, t1.ah = class { 28343 possiblyEvaluate(e1, t1) { 28344 return xt(e1.expression.evaluate(t1)); 28345 } 28346 interpolate(e1, t1, i) { 28347 return { 28348 x: fn(e1.x, t1.x, i), 28349 y: fn(e1.y, t1.y, i), 28350 z: fn(e1.z, t1.z, i), 28351 azimuthal: fn(e1.azimuthal, t1.azimuthal, i), 28352 polar: fn(e1.polar, t1.polar, i) 28353 }; 28354 } 28355 constructor(e1){ 28356 this.specification = e1; 28357 } 28358 }, t1.ai = $s, t1.aj = Ga, t1.ak = Qs, t1.al = fn, t1.am = nt, t1.an = 65, t1.ao = 45, t1.ap = function(e1, t1, i) { 28359 const n = Mc.fromLngLat(t1), r = i.elevation ? i.elevation.getAtPointOrZero(n) : 0; 28360 return Ew(e1, n.x, n.y, r, i); 28361 }, t1.aq = function(e1, t1, i, n, r, o, a) { 28362 const s = [ 28363 [ 28364 i, 28365 n, 28366 0 28367 ], 28368 [ 28369 r, 28370 n, 28371 0 28372 ], 28373 [ 28374 r, 28375 o, 28376 0 28377 ], 28378 [ 28379 i, 28380 o, 28381 0 28382 ] 28383 ]; 28384 let l = Number.MAX_VALUE, c = -Number.MAX_VALUE; 28385 for (const e1 of s){ 28386 const i = D(Y([], e1, t1)); 28387 l = Math.min(l, i), c = Math.max(c, i); 28388 } 28389 return [ 28390 Aw(e1, l, a.pitch), 28391 Aw(e1, c, a.pitch) 28392 ]; 28393 }, t1.ar = xn, t1.as = Ew, t1.at = ww, t1.au = Je, t1.av = function() { 28394 return st++; 28395 }, t1.aw = class { 28396 send(e1, t1, i) { 28397 const { signal: n, targetMapId: r, metadata: o } = i || {}, a = Math.round(1e18 * Math.random()).toString(36).substring(0, 10), s = new Set; 28398 return n && n.aborted ? Promise.reject(n.reason) : (this.target.postMessage({ 28399 id: a, 28400 type: e1, 28401 targetMapId: r, 28402 sourceMapId: this.mapId, 28403 data: Qa(t1, s) 28404 }, [ 28405 ...s 28406 ]), new Promise((e1, t1)=>{ 28407 const i = { 28408 resolve: e1, 28409 reject: t1, 28410 metadata: o || fE 28411 }; 28412 if (n) { 28413 const e1 = ()=>{ 28414 this.pendingResponses.delete(a), t1(n.reason); 28415 }; 28416 n.addEventListener("abort", e1, { 28417 once: !0 28418 }), i.detach = ()=>n.removeEventListener("abort", e1); 28419 } 28420 this.pendingResponses.set(a, i); 28421 })); 28422 } 28423 notify(e1, t1, i) { 28424 const { targetMapId: n } = i || {}, r = new Set; 28425 this.target.postMessage({ 28426 type: e1, 28427 targetMapId: n, 28428 sourceMapId: this.mapId, 28429 data: Qa(t1, r) 28430 }, [ 28431 ...r 28432 ]); 28433 } 28434 sendCancelable(e1, t1, i, n) { 28435 const r = new AbortController; 28436 return this.send(e1, t1, { 28437 ...i, 28438 signal: r.signal 28439 }).then((e1)=>n(null, e1)).catch((e1)=>{ 28440 "AbortError" !== e1.name && n(e1); 28441 }), r; 28442 } 28443 getWorkerSourceActor(e1) { 28444 return { 28445 scheduler: this.scheduler, 28446 send: (t1, i, n)=>this.send(t1, i, { 28447 ...n, 28448 targetMapId: e1 28449 }), 28450 notify: (t1, i)=>{ 28451 this.notify(t1, i, { 28452 targetMapId: e1 28453 }); 28454 }, 28455 sendCancelable: (t1, i, n, r)=>
28455this.sendCancelable(t1, i, { 28456 ...n, 28457 targetMapId: e1 28458 }, r) 28459 }; 28460 } 28461 receive(e1) { 28462 const t1 = e1.data; 28463 if (!t1) return; 28464 const i = t1.id; 28465 if (!t1.targetMapId || this.mapId === t1.targetMapId) if (bt(self)) { 28466 const e1 = this.pendingResponses.get(i); 28467 this.scheduler.add(()=>{ 28468 this.processTask(i, t1); 28469 }, e1 && e1.metadata || fE); 28470 } else this.processTask(i, t1); 28471 } 28472 async processTask(e1, t1) { 28473 if ("<response>" === t1.type) { 28474 const i = this.pendingResponses.get(e1); 28475 if (this.pendingResponses.delete(e1), i) { 28476 i.detach && i.detach(); 28477 try { 28478 t1.error ? i.reject(es(t1.error)) : i.resolve(es(t1.data)); 28479 } catch (e1) { 28480 i.reject(e1); 28481 } 28482 } 28483 return; 28484 } 28485 const i = new Set, n = es(t1.data); 28486 try { 28487 let r; 28488 if (this.parent[t1.type]) r = await this.parent[t1.type](t1.sourceMapId, n); 28489 else { 28490 if (!this.parent.getWorkerSource) throw new Error("Could not find function ".concat(t1.type)); 28491 { 28492 const e1 = t1.type.split("."), { source: i, scope: o } = n, a = this.parent.getWorkerSource(t1.sourceMapId, { 28493 type: e1[0], 28494 source: i, 28495 scope: o 28496 }); 28497 r = await a[e1[1]](n); 28498 } 28499 } 28500 if (!e1) return; 28501 this.target.postMessage({ 28502 id: e1, 28503 type: "<response>", 28504 sourceMapId: this.mapId, 28505 error: null, 28506 data: Qa(r, i) 28507 }, [ 28508 ...i 28509 ]); 28510 } catch (t1) { 28511 this.target.postMessage({ 28512 id: e1, 28513 type: "<response>", 28514 sourceMapId: this.mapId, 28515 error: Qa(t1), 28516 data: null 28517 }, []); 28518 } 28519 } 28520 remove() { 28521 for (const e1 of this.pendingResponses.values())e1.detach && e1.detach(), e1.reject(new DOMException("Actor removed", "AbortError")); 28522 this.pendingResponses.clear(), this.scheduler.remove(), this.target.removeEventListener("message", this.receive, !1); 28523 } 28524 constructor(e1, t1, i){ 28525 this.target = e1, this.parent = t1, this.mapId = i, this.pendingResponses = new Map, ht([ 28526 "receive" 28527 ], this), this.target.addEventListener("message", this.receive, !1), this.scheduler = new dE; 28528 } 28529 }, t1.ax = class { 28530 possiblyEvaluate(e1, t1) { 28531 return function(param) { 28532 let [e1, t1] = param; 28533 const i = xt([ 28534 1, 28535 e1, 28536 t1 28537 ]); 28538 return { 28539 x: i.x, 28540 y: i.y, 28541 z: i.z 28542 }; 28543 }(e1.expression.evaluate(t1)); 28544 } 28545 interpolate(e1, t1, i) { 28546 return { 28547 x: fn(e1.x, t1.x, i), 28548 y: fn(e1.y, t1.y, i), 28549 z: fn(e1.z, t1.z, i) 28550 }; 28551 } 28552 constructor(e1){ 28553 this.specification = e1; 28554 } 28555 }, t1.ay = nE, t1.az = zf, t1.b = ud, t1.b$ = vt, t1.b0 = it, t1.b1 = 6, t1.b2 = kf, t1.b3 = function(e1) { 28556 const t1 = 80.051129; 28557 e1 = it(e1, -80.051129, t1) / t1 * 90; 28558 const i = Math.pow(Math.abs(Math.sin(Je(e1))), 3); 28559 return Math.round(i * (cc.length - 1)); 28560 }, t1.b4 = $f, t1.b5 = Of, t1.b6 = function(e1) { 28561 const t1 = e1.pixelsPerMeter, i = t1 / xc(1, e1.center.lat), n = d(new Float64Array(16)); 28562 return _(n, n, [ 28563 e1.point.x, 28564 e1.point.y, 28565 0 28566 ]), g(n, n, [ 28567 i, 28568 i, 28569 t1 28570 ]), Float32Array.from(n); 28571 }, t1.b7 = function(e1, t1, i, n) { 28572 const r = t1.getNorth(), o = t1.getSouth(), a = t1.getWest(), l = t1.getEast(), c = 1 << e1.z, u = l - a, h = r - o, d = u / lc, f = -h / cc[i], p = [ 28573 0, 28574 d, 28575 0, 28576 f, 28577 0, 28578 0, 28579 r, 28580 a, 28581 0 28582 ]; 28583 if (e1.z > 0) { 28584 const e1 = 180 / n; 28585 s(p, p, [ 28586 e1 / u + 1, 28587 0, 28588 0, 28589 0, 28590 e1 / h + 1, 28591 0, 28592 -.5 * e1 / d, 28593 .5 * e1 / f, 28594 1 28595 ]); 28596 } 28597 return p[2] = c, p[5] = e1.x, p[8] = e1.y, p; 28598 }, t1.b8 = Dt, t1.b9 = 256, t1.bA = wh, t1.bB = Cc, t1.bC = jc, t1.bD = vu, t1.bE = vf, t1.bF = Dl, t1.bG = jf, t1.bH = Y, t1.bI = Bf, t1.bJ = Gc, t1.bK = xf, t1.bL = w, t1.bM = _, t1.bN = function() { 28599 Hs.isLoading() || Hs.isLoaded() || "deferred" !== js() || Gs(); 28600 }, t1.bO = ci, t1.bP = op, t1.bQ = function(e1, t1) { 28601 const i = []; 28602 for(const n in e1)n in t1 || i.push(n); 28603 return i; 28604 }, t1.bR = hE, t1.bS = Mc, t1.bT = ot, t1.bU = "hd_road_coverage", t1.bV = function(e1) { 28605 const t1 = e1.indexOf(vl); 28606 return t1 >= 0 ? e1.slice(0, t1) : e1; 28607 }, t1.bW = wl, t1.bX = np, t1.bY = rp, t1.bZ = rh, t1.b_ = S, t1.ba = vA, t1.bb = PA, t1.bc = yu, t1.bd = ue, t1.be = de, t1.bf = pe, t1.bg = M, t1.bh = F, t1.bi = pa, t1.bj = pc, t1.bk = gu, t1.bl = _u, t1.bm = vc, t1.bn = xw, t1.bo = Pt, t1.bp = lp, t1.bq = pr, t1.br = mr, t1.bs = Hc, t1.bt = Mu, t1.bu = Qm, t1.bv = ll, t1.bw = Lc, t1.bx = Vb, t1.by = wt, t1.bz = yd, t1.c = Ua, t1.c$ = mI, t1.c0 = et, t1.c1 = function(e1, t1, i) { 28608 const n = Yf(i.zoom), r = e1.style.map._antialias, o = e1.terrain && e1.terrain.exaggeration() > 0; 28609 return 0 === n && !r && !o; 28610 }, t1.c2 = function(e1, t1, i) { 28611 const n = d(new Float64Array(16)), r = (t1 / (1 << e1) - .5) * Math.PI * 2; 28612 return x(n, i.globeMatrix, r), Float32Array.from(n); 28613 }, t1.c3 = class { 28614 isDataAvailableAtPoint(e1) { 28615 const t1 = this._source(); 28616 if (this.isUsingMockSource() || !t1 || e1.y < 0 || e1.y > 1) return !1; 28617 const i = t1.getSource().maxzoom, n = 1 << i, r = Math.floor(e1.x), o = Math.floor((e1.x - r) * n), a = Math.floor(e1.y * n), s = this.findDEMTileFor(new op(i, r, i, o, a)); 28618 return !(!s || !s.dem); 28619 } 28620 getAtPointOrZero(e1) { 28621 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; 28622 return this.getAtPoint(e1, t1) || 0; 28623 } 28624 getAtPoint(e1, t1) { 28625 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0; 28626 if (this.isUsingMockSource()) return null; 28627 t1 !== null && t1 !== void 0 ? t1 : t1 = null; 28628 const n = this._source(); 28629 if (!n) return t1; 28630 if (e1.y < 0 || e1.y > 1) return t1; 28631 const r = n.getSource().maxzoom, o = 1 << r, a = Math.floor(e1.x), s = e1.x - a, l = new op(r, a, r, Math.floor(s * o), Math.floor(e1.y * o)), c = this.findDEMTileFor(l); 28632 if (!c || !c.dem) return t1; 28633 const u = c.dem, h = 1 << c.tileID.canonical.z, d = (s * h - c.tileID.canonical.x) * u.dim, f = (e1.y * h - c.tileID.canonical.y) * u.dim, p = Math.floor(d), m = Math.floor(f); 28634 return (i ? this.exaggeration() : 1) * fn(fn(u.get(p, m), u.get(p, m + 1), f - m), fn(u.get(p + 1, m), u.get(p + 1, m + 1), f - m), d - p); 28635 } 28636 static getAtTileOffset(e1, t1, i, n) { 28637 const r = 1 << e1.canonical.z; 28638 return n ? n.pointElevation(t1) : i ? i.getAtPointOrZero(new Mc(e1.wrap + (e1.canonical.x + t1.x / zr) / r, (e1.canonical.y + t1.y / zr) / r)) : 0; 28639 } 28640 static getAtTileOffsetFunc(e1, t1, i, n) { 28641 return (r, o, a)=>{ 28642 const s = this.getAtTileOffset(e1, r, o, a), l = n.upVector(e1.canonical, r.x, r.y); 28643 return k(l, l, s * n.upVectorScale(e1.canonical, t1, i).metersToTile), l; 28644 }; 28645 } 28646 getForTilePoints(e1, t1, i, n) { 28647 if (this.isUsingMockSource()) return !1; 28648 const r = bb.create(this, e1, n);
28649 return !!r && (t1.forEach((e1)=>{ 28650 e1[2] = this.exaggeration() * r.getElevationAt(e1[0], e1[1], i, !0); 28651 }), !0); 28652 } 28653 getMinMaxForTile(e1) { 28654 if (this.isUsingMockSource()) return null; 28655 const t1 = this.findDEMTileFor(e1); 28656 if (!t1 || !t1.dem) return null; 28657 const i = t1.dem.tree, n = t1.tileID, r = 1 << e1.canonical.z - n.canonical.z; 28658 let o = e1.canonical.x / r - n.canonical.x, a = e1.canonical.y / r - n.canonical.y, s = 0; 28659 for(let t1 = 0; t1 < e1.canonical.z - n.canonical.z && !i.leaves[s]; t1++){ 28660 o *= 2, a *= 2; 28661 const e1 = 2 * Math.floor(a) + Math.floor(o); 28662 s = i.childOffsets[s] + e1, o %= 1, a %= 1; 28663 } 28664 return { 28665 min: this.exaggeration() * i.minimums[s], 28666 max: this.exaggeration() * i.maximums[s] 28667 }; 28668 } 28669 getMinElevationBelowMSL() { 28670 throw new Error("Pure virtual method called."); 28671 } 28672 raycast(e1, t1, i) { 28673 throw new Error("Pure virtual method called."); 28674 } 28675 pointCoordinate(e1) { 28676 throw new Error("Pure virtual method called."); 28677 } 28678 _source() { 28679 throw new Error("Pure virtual method called."); 28680 } 28681 isUsingMockSource() { 28682 throw new Error("Pure virtual method called."); 28683 } 28684 exaggeration() { 28685 throw new Error("Pure virtual method called."); 28686 } 28687 findDEMTileFor(e1) { 28688 throw new Error("Pure virtual method called."); 28689 } 28690 get visibleDemTiles() { 28691 throw new Error("Getter must be implemented in subclass."); 28692 } 28693 getMinMaxForVisibleTiles() { 28694 const e1 = this.visibleDemTiles; 28695 if (0 === e1.length) return null; 28696 let t1 = !1, i = Number.MAX_VALUE, n = Number.MIN_VALUE; 28697 for (const r of e1){ 28698 const e1 = this.getMinMaxForTile(r.tileID); 28699 e1 && (i = Math.min(i, e1.min), n = Math.max(n, e1.max), t1 = !0); 28700 } 28701 return t1 ? { 28702 min: i, 28703 max: n 28704 } : null; 28705 } 28706 }, t1.c4 = hd, t1.c5 = xc, t1.c6 = Pf, t1.c7 = le, t1.c8 = ae, t1.c9 = O, t1.cA = qh, t1.cB = Sc, t1.cC = at, t1.cD = class { 28707 request(e1, t1, i, n) { 28708 const r = this.entries[e1] = this.entries[e1] || { 28709 callbacks: [] 28710 }; 28711 if (r.result) { 28712 const [e1, i] = r.result; 28713 return this.scheduler ? this.scheduler.add(()=>{ 28714 n(e1, i); 28715 }, t1) : n(e1, i), ()=>{}; 28716 } 28717 return r.callbacks.push(n), r.cancel || (r.cancel = i((i, n)=>{ 28718 r.result = [ 28719 i, 28720 n 28721 ]; 28722 for (const e1 of r.callbacks)this.scheduler ? this.scheduler.add(()=>{ 28723 e1(i, n); 28724 }, t1) : e1(i, n); 28725 setTimeout(()=>delete this.entries[e1], 3e3); 28726 })), ()=>{ 28727 r.result || (r.callbacks = r.callbacks.filter((e1)=>e1 !== n), r.callbacks.length || (r.cancel(), delete this.entries[e1])); 28728 }; 28729 } 28730 constructor(e1){ 28731 this.entries = {}, this.scheduler = e1; 28732 } 28733 }, t1.cE = function(e1) { 28734 if ("provider" in e1 && !e1.provider) return null; 28735 let t1 = e1.provider; 28736 if (!t1 && "url" in e1 && e1.url && (t1 = function(e1) { 28737 try { 28738 const t1 = new URL(e1).pathname.split("/").pop() || "", i = t1.lastIndexOf("."); 28739 return i >= 0 ? t1.slice(i + 1) : ""; 28740 } catch (unused) { 28741 return ""; 28742 } 28743 }(e1.url)), !t1) return null; 28744 const i = jt.TILE_PROVIDER_URLS[t1]; 28745 if (!i) return null; 28746 let n; 28747 try { 28748 n = new URL(i, jt.API_URL).href; 28749 } catch (e1) { 28750 return new Error('TileProvider "'.concat(t1, '" has an invali
28750d URL: "').concat(i, '"')); 28751 } 28752 return { 28753 name: t1, 28754 url: n 28755 }; 28756 }, t1.cF = eE, t1.cG = iE, t1.cH = ni, t1.cI = function(e1, t1, i) { 28757 const n = JSON.stringify(e1.request); 28758 return e1.data && (this.deduped.entries[n] = { 28759 result: [ 28760 null, 28761 e1.data 28762 ] 28763 }), this.deduped.request(n, { 28764 type: "parseTile", 28765 renderSourceType: e1.renderSourceType, 28766 zoom: e1.tileZoom 28767 }, (t1)=>{ 28768 const n = new AbortController; 28769 return _i(e1.request, n.signal).then((param)=>{ 28770 let { data: e1, headers: n } = param; 28771 t1(null, { 28772 rawData: e1, 28773 vectorTile: i ? void 0 : new Oh(new Wp(e1)), 28774 headers: n 28775 }); 28776 }).catch((e1)=>{ 28777 n.signal.aborted || (ci(e1) ? t1(null, null) : t1(e1)); 28778 }), ()=>{ 28779 n.abort(), t1(null, null); 28780 }; 28781 }, t1); 28782 }, t1.cJ = At, t1.cK = function(e1) { 28783 ti++, ti > Yt && (e1.getActor().notify("enforceCacheSizeLimit", Xt), ti = 0); 28784 }, t1.cL = ji, t1.cM = async function(e1, t1, i) { 28785 const n = e1.url && !e1.tiles ? await t1.transformRequest(e1.url, si.Source, i) : void 0; 28786 return { 28787 request: n, 28788 options: n ? { 28789 ...e1, 28790 url: n.url 28791 } : e1 28792 }; 28793 }, t1.cN = function(e1, t1, i) { 28794 return t1 ? QA(e1, t1, i) : e1.tiles && e1.tiles.length > 0 ? { 28795 tiles: e1.tiles 28796 } : new Error('TileJSON is missing required "tiles" property'); 28797 }, t1.cO = async function(e1, t1) { 28798 const i = mE.get(e1); 28799 if (i) return i; 28800 const n = pE.get(e1); 28801 if (void 0 !== n) return n; 28802 const r = self.__mapboxImport(/* webpackIgnore: true */ /* @vite-ignore */ t1).catch((t1)=>{ 28803 throw new Error('TileProvider "'.concat(e1, '" failed to load: ').concat(t1 instanceof Error ? t1.message : String(t1))); 28804 }).then((t1)=>{ 28805 const i = t1.default; 28806 if ("function" != typeof i) throw new Error('TileProvider "'.concat(e1, '" module must default-export a class')); 28807 if ("function" != typeof i.prototype.loadTile) throw new Error('TileProvider "'.concat(e1, '" class must have a loadTile method')); 28808 return mE.set(e1, i), i; 28809 }).finally(()=>{ 28810 pE.delete(e1); 28811 }); 28812 return pE.set(e1, r), r; 28813 }, t1.cP = class { 28814 bind(e1, t1) { 28815 const { context: i } = this, { gl: n } = i; 28816 n.bindTexture(n.TEXTURE_2D, this.texture), e1 !== this.minFilter && (n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, e1), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, e1), this.minFilter = e1), t1 !== this.wrapS && (n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, t1), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, t1), this.wrapS = t1); 28817 } 28818 constructor(e1, t1){ 28819 this.context = e1, this.texture = t1; 28820 } 28821 }, t1.cQ = bc, t1.cR = function(e1, t1, i, n) { 28822 for(; t1 < i;){ 28823 const r = t1 + i >> 1; 28824 e1[r] <= n ? t1 = r + 1 : i = r; 28825 } 28826 return t1; 28827 }, t1.cS = function(e1, t1, i, n) { 28828 for(; t1 < i;){ 28829 const r = t1 + i >> 1; 28830 e1[r] < n ? t1 = r + 1 : i = r; 28831 } 28832 return t1; 28833 }, t1.cT = lc, t1.cU = J, t1.cV = function(e1, t1) { 28834 var i = t1[0], n = t1[1], r = t1[2], o = t1[3], a = t1[4], s = t1[5], l = t1[6], c = t1[7], u = t1[8]; 28835 return e1[0] = a * u - s * c, e1[1] = r * c - n * u, e1[2] = n * s - r * a, e1[3] = s * l - o * u, e1[4] = i * u - r * l, e1[5] = r * o - i * s, e1[6] = o * c - a * l, e1[7] = n * l - i * c, e1[8] = i * a - n * o, e1; 28836 }, t1.cW = s, t1.cX = async function(e1) { 28837 const t1 = document.createElement("video"); 28838 t1.muted = !0; 28839 for (const i of e1){ 28840 const e1 = document.createElement("source"); 28841 gi(i) || (t1.crossOrigin = "Anonymous"), e1.src = i, t1.appendChild(e1); 28842 } 28843 return await new Promise((i, n)=>{ 28844 t1.onloadstart = ()=>i(), t1.onerror = ()=>n(new Error("Could not load video: ".concat(e1.join(", ")))); 28845 }), t1; 28846 }, t1.cY = sb, t1.cZ = mb, t1.c_ = _c, t1.ca = Z, t1.cb = U, t1.cc = CA, t1.cd = qf, t1.ce = Vv, t1.cf = ob, t1.cg = St, t1.ch = zt, t1.ci = function(e1, t1) { 28847 const i = [ 28848 0, 28849 0, 28850 0 28851 ]; 28852 return Y(i, i, $f(Of(t1.canonical))), Y(i, i, e1), i; 28853 }, t1.cj = Nb, t1.ck = function(e1, t1, i, n, r, o) { 28854 const { width: a, height: s } = n.imageManager.getPixelSize(t1), l = Math.pow(2, o.tileID.overscaledZ
28854), c = o.tileSize * Math.pow(2, n.transform.tileZoom) / l, u = c * (o.tileID.canonical.x + o.tileID.wrap * l), h = c * o.tileID.canonical.y; 28855 return { 28856 u_image: 0, 28857 u_pattern_tl: i.tl, 28858 u_pattern_br: i.br, 28859 u_texsize: [ 28860 a, 28861 s 28862 ], 28863 u_pattern_size: i.displaySize, 28864 u_pattern_units_to_pixels: r ? [ 28865 n.transform.width, 28866 -1 * n.transform.height 28867 ] : [ 28868 1 / Vv(o, 1, n.transform.tileZoom), 28869 1 / Vv(o, 1, n.transform.tileZoom) 28870 ], 28871 u_pixel_coord_upper: [ 28872 u >> 16, 28873 h >> 16 28874 ], 28875 u_pixel_coord_lower: [ 28876 65535 & u, 28877 65535 & h 28878 ] 28879 }; 28880 }, t1.cl = (e1)=>({ 28881 u_matrix: new oh(e1), 28882 u_texsize: new eh(e1), 28883 u_pixels_to_tile_units: new ah(e1), 28884 u_device_pixel_ratio: new Qu(e1), 28885 u_width_scale: new Qu(e1), 28886 u_floor_width_scale: new Qu(e1), 28887 u_image: new Ku(e1), 28888 u_units_to_pixels: new eh(e1), 28889 u_tile_units_to_pixels: new Qu(e1), 28890 u_alpha_discard_threshold: new Qu(e1), 28891 u_trim_offset: new eh(e1), 28892 u_trim_fade_range: new eh(e1), 28893 u_trim_gradient_mix_range: new eh(e1), 28894 u_trim_color: new nh(e1), 28895 u_zbias_factor: new Qu(e1), 28896 u_tile_to_meter: new Qu(e1), 28897 u_ground_shadow_factor: new th(e1), 28898 u_pattern_transition: new Qu(e1), 28899 u_opacity_multiplier: new Qu(e1) 28900 }), t1.cm = (e1)=>({ 28901 u_matrix: new oh(e1), 28902 u_pixels_to_tile_units: new ah(e1), 28903 u_device_pixel_ratio: new Qu(e1), 28904 u_width_scale: new Qu(e1), 28905 u_floor_width_scale: new Qu(e1), 28906 u_units_to_pixels: new eh(e1), 28907 u_dash_image: new Ku(e1), 28908 u_gradient_image: new Ku(e1), 28909 u_border_gradient_image: new Ku(e1), 28910 u_image_height: new Qu(e1), 28911 u_texsize: new eh(e1), 28912 u_tile_units_to_pixels: new Qu(e1), 28913 u_alpha_discard_threshold: new Qu(e1), 28914 u_trim_offset: new eh(e1), 28915 u_trim_fade_range: new eh(e1), 28916 u_trim_gradient_mix_range: new eh(e1), 28917 u_trim_color: new nh(e1), 28918 u_zbias_factor: new Qu(e1), 28919 u_road_view_depth_bias: new Qu(e1), 28920 u_road_clip_to_view: new nh(e1), 28921 u_tile_to_meter: new Qu(e1), 28922 u_ground_shadow_factor: new th(e1), 28923 u_opacity_multiplier: new Qu(e1) 28924 }), t1.cn = (e1)=>({ 28925 u_color: new rh(e1), 28926 u_matrix: new oh(e1), 28927 u_overlay: new Ku(e1), 28928 u_overlay_scale: new Qu(e1) 28929 }), t1.co = (e1)=>({ 28930 u_camera_to_center_distance: new Qu(e1), 28931 u_extrude_scale: new ah(e1), 28932 u_device_pixel_ratio: new Qu(e1), 28933 u_matrix: new oh(e1), 28934 u_inv_rot_matrix: new oh(e1), 28935 u_merc_center: new eh(e1), 28936 u_tile_id: new th(e1), 28937 u_zoom_transition: new Qu(e1), 28938 u_up_dir: new th(e1), 28939 u_emissive_strength: new Qu(e1) 28940 }), t1.cp = (e1)=>({ 28941 u_matrix: new oh(e1), 28942 u_lightpos: new th(e1), 28943 u_lightintensity: new Qu(e1), 28944 u_lightcolor: new th(e1), 28945 u_vertical_gradient: new Qu(e1), 28946 u_height_factor: new Qu(e1), 28947 u_edge_radius: new Qu(e1), 28948 u_width_scale: new Qu(e1), 28949 u_ao: new eh(e1), 28950 u_height_type: new Ku(e1), 28951 u_base_type: new Ku(e1), 28952 u_tile_id: new th(e1), 28953 u_zoom_transition: new Qu(e1), 28954 u_inv_rot_matrix: new oh(e1), 28955 u_merc_center: new eh(e1), 28956 u_up_dir: new th(e1), 28957 u_height_lift: new Qu(e1), 28958 u_image: new Ku(e1), 28959 u_texsize: new eh(e1), 28960 u_pixel_coord_upper: new eh(e1), 28961 u_pixel_coord_lower: new eh(e1), 28962 u_tile_units_to_pixels: new Qu(e1), 28963 u_opacity: new Qu(e1), 28964 u_pattern_transition: new Qu(e1) 28965 }), t1.cq = (e1)=>({ 28966 u_matrix: new oh(e1), 28967 u_lightpos: new th(e1), 28968 u_lightintensity: new Qu(e1), 28969 u_lightcolor: new th(e1), 28970 u_vertical_gradient: new Qu(e1), 28971 u_opacity: new Qu(e1), 28972 u_edge_radius: new Qu(e1), 28973 u_width_scale: new Qu(e1), 28974 u_ao: new eh(e1), 28975 u_height_type: new Ku(e1), 28976 u_base_type: new Ku(e1), 28977 u_tile_id: new th(e1), 28978 u_zoom_transition: new Qu(e1), 28979 u_inv_rot_matrix: new oh(e1), 28980 u_merc_center: new eh(e1), 28981 u_up_dir: new th(e1), 28982 u_height_lift: new Qu(e1), 28983 u_flood_light_color: new th(e1), 28984 u_vertical_scale: new Qu(e1), 28985 u_flood_light_intensity: new Qu(e1), 28986 u_ground_shadow_factor: new th(e1), 28987 u_front_cutoff_params: new th(e1) 28988 }), t1.cr = function(e1, t1) { 28989 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0; 28990 const r = new Pe(i, i), o = e1.sub(r), a = t1.add(r), s = [ 28991 o, 28992 new Pe(a.x, o.y), 28993 a, 28994 new Pe(o.x, a.y) 28995 ]; 28996 return n && s.push(o.clone()), s; 28997 }, t1.cs = function(e1, t1) { 28998 const i = []; 28999 for(let n = 0; n < e1.length; n++){ 29000 const r = rt(n - 1, -1, e1.length - 1), o = rt(n + 1, -1, e1.length - 1), a = e1[n], s = e1[o], l = e1[r].sub(a).unit(), c = s.sub(a).unit(), u = c.angleWithSep(l.x, l.y), h = l.add(c).unit().mult(-1 * t1 / Math.sin(u / 2)); 29001 i.push(a.add(h)); 29002 } 29003 return i; 29004 }, t1.ct = function(e1, param) {
29005 let { x: t1, y: i } = param, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; 29006 return new Pe(((t1 - n) * e1.scale - e1.x) * zr, (i * e1.scale - e1.y) * zr); 29007 }, t1.cu = Xh, t1.cv = function(e1, t1) { 29008 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; 29009 return F(((t1.x - i) * e1.scale - e1.x) * zr, (t1.y * e1.scale - e1.y) * zr, vc(t1.z, t1.y)); 29010 }, t1.cw = te, t1.cx = wf, t1.cy = function(e1) { 29011 let t1 = 1 / 0, i = 1 / 0, n = -1 / 0, r = -1 / 0; 29012 for (const o of e1)t1 = Math.min(t1, o.x), i = Math.min(i, o.y), n = Math.max(n, o.x), r = Math.max(r, o.y); 29013 return { 29014 min: new Pe(t1, i), 29015 max: new Pe(n, r) 29016 }; 29017 }, t1.cz = sc, t1.d = class { 29018 beginFrame() { 29019 this.currentFrameAtlases.clear(); 29020 } 29021 calculateTextureMemory(e1) { 29022 return e1.image ? Math.ceil(e1.image.width * e1.image.height * 4 * (e1.patternPositions.size > 0 ? 1.33 : 1)) : 0; 29023 } 29024 evictTexture(e1) { 29025 const t1 = this.textures.get(e1); 29026 if (t1) { 29027 const i = this.calculateTextureMemory(e1); 29028 t1.destroy(), this.textures.delete(e1), this.textureAccessTimes.delete(e1), this.textureMemoryUsed -= i, e1.uploaded = !1; 29029 } 29030 } 29031 evictTexturesIfNeeded(e1) { 29032 for(; this.textureMemoryUsed + e1 > this.maxTextureMemory && this.textures.size > 0;){ 29033 let e1 = null, t1 = 1 / 0; 29034 for (const [i] of this.textures.entries()){ 29035 if (this.currentFrameAtlases.has(i)) continue; 29036 const n = this.textureAccessTimes.get(i) || 0; 29037 n < t1 && (t1 = n, e1 = i); 29038 } 29039 if (!e1) break; 29040 this.evictTexture(e1); 29041 } 29042 } 29043 findCachedAtlas(e1) { 29044 const t1 = this.cache.get(e1.hash); 29045 if (t1) { 29046 const i = t1.deref(); 29047 if (i && i.contentDescriptor && this.isMipmapCompatible(e1, i.contentDescriptor)) return i; 29048 } 29049 for (const [, t1] of this.cache.entries()){ 29050 const i = t1.deref(); 29051 if (i && i.contentDescriptor) { 29052 const t1 = e1.subsetOf(i.contentDescriptor), n = this.isMipmapCompatible(e1, i.contentDescriptor); 29053 if (t1 && n) return i; 29054 } 29055 } 29056 } 29057 getTextureForAtlas(e1, t1, i) { 29058 this.textureAccessTimes.set(e1, performance.now()), this.currentFrameAtlases.add(e1); 29059 let n = this.textures.get(e1); 29060 if (n) return n; 29061 if (e1.image) { 29062 const r = this.calculateTextureMemory(e1); 29063 return this.evictTexturesIfNeeded(r), n = new mm(t1, e1.image, i, { 29064 useMipmap: !!e1.patternPositions.size 29065 }), this.textures.set(e1, n), this.textureMemoryUsed += r, n; 29066 } 29067 return null; 29068 } 29069 clearExpiredTextures() { 29070 for (const [e1] of this.textures.entries())if (!this.isAtlasCached(e1)) { 29071 const t1 = this.textures.get(e1); 29072 if (t1) { 29073 const i = this.calculateTextureMemory(e1); 29074 t1.destroy(), this.textureMemoryUsed -= i; 29075 } 29076 this.textures.delete(e1), this.textureAccessTimes.delete(e1); 29077 } 29078 } 29079 isAtlasCached(e1) { 29080 if (!e1.contentDescriptor) return !1; 29081 const t1 = this.cache.get(e1.contentDescriptor.hash); 29082 return !!t1 && t1.deref() === e1; 29083 } 29084 getOrCache(e1) { 29085 if (!("image" in e1)) { 29086 const t1 = this.cache.get(e1.sourceAtlasHash); 29087 if (t1) { 29088 const e1 = t1.deref(); 29089 if (e1) return e1; 29090 } 29091 return gt("ImageAtlasReference points to GC'd atlas - atlas may have been evicted"), null; 29092 } 29093 if (!e1.contentDescriptor) return e1; 29094 const t1 = e1.contentDescriptor, i = t1.hash, n = this.cache.get(i); 29095 if (n) { 29096 const e1 = n.deref(); 29097 if (e1 && e1.contentDescriptor && this.isMipmapCompatible(t1, e1.contentDescriptor)) return e1; 29098 } 29099 return this.cache.set(i, new WeakRef(e1)), this.finalizationRegistry.register(e1, i, e1
29099), e1; 29100 } 29101 isMipmapCompatible(e1, t1) { 29102 return !e1.requiresMipMaps || t1.requiresMipMaps; 29103 } 29104 destroyTextures() { 29105 for (const e1 of this.textures.values())e1 && e1.destroy(); 29106 this.textures.clear(), this.textureAccessTimes.clear(), this.textureMemoryUsed = 0; 29107 } 29108 clear() { 29109 for (const e1 of this.textures.values())e1 && e1.destroy(); 29110 this.cache.clear(), this.textures.clear(), this.textureAccessTimes.clear(), this.textureMemoryUsed = 0; 29111 } 29112 constructor(e1){ 29113 this.cache = new Map, this.textures = new Map, this.textureAccessTimes = new Map, this.textureMemoryUsed = 0, this.maxTextureMemory = 1024 * (e1 && e1.maxTextureMemoryMB ? e1.maxTextureMemoryMB : 256) * 1024, this.currentFrameAtlases = new Set, this.finalizationRegistry = new FinalizationRegistry((e1)=>{ 29114 this.cache.delete(e1), this.clearExpiredTextures(); 29115 }); 29116 } 29117 }, t1.d$ = qm, t1.d0 = Wp, t1.d1 = _i, t1.d2 = [ 29118 "type", 29119 "source", 29120 "source-layer", 29121 "minzoom", 29122 "maxzoom", 29123 "filter", 29124 "layout" 29125 ], t1.d3 = function(e1, t1, i, n, r, o, a) { 29126 const s = aw(e1, t1, i, n, r, o, a); 29127 return "globe" === o.name && i || (s[2] = s[6] = s[10] = s[14] = 0), s; 29128 }, t1.d4 = function(e1, t1, i, n, r, o, a) { 29129 if (i) { 29130 if ("globe" === o.name) { 29131 const s = aw(e1, t1, i, n, r, o, a); 29132 return p(s, s), m(s, e1, s), s; 29133 } 29134 { 29135 const t1 = u(e1), [i, o, s, l] = a, [c, h, d, f, p, m, _, g] = t1; 29136 return t1[0] = i * c + o * p, t1[1] = i * h + o * m, t1[2] = i * d + o * _, t1[3] = i * f + o * g, t1[4] = s * c + l * p, t1[5] = s * h + l * m, t1[6] = s * d + l * _, t1[7] = s * f + l * g, n || v(t1, t1, -r.angle), t1; 29137 } 29138 } 29139 return r.glCoordMatrix; 29140 }, t1.d5 = af, t1.d6 = Fp, t1.d7 = tx, t1.d8 = jp, t1.d9 = Gp, t1.dA = Rm, t1.dB = Ns, t1.dC = Wt, t1.dD = nn, t1.dE = pt, t1.dF = function(e1) { 29141 return e1.includes(vl); 29142 }, t1.dG = function(e1) { 29143 const t1 = e1.lastIndexOf(vl); 29144 return t1 >= 0 ? e1.slice(t1 + 1) : ""; 29145 }, t1.dH = function(e1) { 29146 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 29147 const i = t1.type && !t1.array && Array.isArray(e1) ? { 29148 type: t1.type, 29149 "property-type": "data-constant" 29150 } : void 0; 29151 return Ua(null === e1 || "object" != typeof e1 || Array.isArray(e1) ? e1 : [ 29152 "literal", 29153 e1 29154 ], i); 29155 }, t1.dI = function(e1) { 29156 const t1 = [], i = e1.id; 29157 return void 0 === i && t1.push({ 29158 message: "layers.".concat(i, ': missing required property "id"') 29159 }), void 0 === e1.render && t1.push({ 29160 message: "layers.".concat(i, ': missing required method "render"') 29161 }), e1.renderingMode && "2d" !== e1.renderingMode && "3d" !== e1.renderingMode && t1.push({ 29162 message: "layers.".concat(i, ': property "renderingMode" must be either "2d" or "3d"') 29163 }), t1; 29164 }, t1.dJ = function(e1, t1, i, n) { 29165 return "custom" === e1.type ? new _b(e1, t1) : new lE[e1.type](e1, t1, i, n); 29166 }, t1.dK = ft, t1.dL = class extends Vb { 29167 toJSON() { 29168 const e1 = super.toJSON(); 29169 return e1.target = this.target, e1.namespace = this.namespace, e1; 29170 } 29171 constructor(e1, t1){ 29172 super(e1._vectorTileFeature, e1._z, e1._x, e1._y, e1.id), e1.state && (this.state = { 29173 ...e1.state 29174 }), this.target = t1.target, this.namespace = t1.namespace, t1.properties && (this.properties = t1.properties), this.target && ("featuresetId" in this.target && !this.target.importId || "layerId" in this.target) && (this.source = e1.source, this.sourceLayer = e1.sourceLayer, this.layer = e1.layer); 29175 } 29176 }, t1.dM = Us, t1.dN = jA, t1.dO = function() { 29177 return { 29178 API_URL: jt.API_URL, 29179 DRACO_URL: jt.DRACO_URL, 29180 MESHOPT_URL: jt.MESHOPT_URL, 29181 MESHOPT_SIMD_URL: jt.MESHOPT_SIMD_URL,
29182 BUILDING_GEN_URL: jt.BUILDING_GEN_URL 29183 }; 29184 }, t1.dP = function(e1, t1) { 29185 return [ 29186 Math.pow(e1[0], 2.2) * t1, 29187 Math.pow(e1[1], 2.2) * t1, 29188 Math.pow(e1[2], 2.2) * t1 29189 ]; 29190 }, t1.dQ = k, t1.dR = L, t1.dS = Tt, t1.dT = W, t1.dU = MA, t1.dV = TA, t1.dW = (e1)=>({ 29191 u_cutoff_params: new nh(e1) 29192 }), t1.dX = (e1)=>({ 29193 u_light_matrix_0: new oh(e1), 29194 u_light_matrix_1: new oh(e1), 29195 u_fade_range: new eh(e1), 29196 u_shadow_normal_offset: new th(e1), 29197 u_shadow_intensity: new Qu(e1), 29198 u_shadow_texel_size: new Qu(e1), 29199 u_shadow_map_resolution: new Qu(e1), 29200 u_shadow_direction: new th(e1), 29201 u_shadow_bias: new th(e1), 29202 u_shadowmap_0: new Ku(e1), 29203 u_shadowmap_1: new Ku(e1) 29204 }), t1.dY = aw, t1.dZ = gw, t1.d_ = lw, t1.da = Xd, t1.db = Yd, t1.dc = function(e1, param) { 29205 let [t1, i] = param; 29206 let n = 0, r = 0; 29207 if (i === sf) { 29208 t1 < 0 && (t1 = 0); 29209 const i = t1 / lf; 29210 switch(e1){ 29211 case "top-right": 29212 case "top-left": 29213 r = i - 7; 29214 break; 29215 case "bottom-right": 29216 case "bottom-left": 29217 r = 7 - i; 29218 break; 29219 case "bottom": 29220 r = 7 - t1; 29221 break; 29222 case "top": 29223 r = t1 - 7; 29224 } 29225 switch(e1){ 29226 case "top-right": 29227 case "bottom-right": 29228 n = -i; 29229 break; 29230 case "top-left": 29231 case "bottom-left": 29232 n = i; 29233 break; 29234 case "left": 29235 n = t1; 29236 break; 29237 case "right": 29238 n = -t1; 29239 } 29240 } else { 29241 switch(t1 = Math.abs(t1), i = Math.abs(i), e1){ 29242 case "top-right": 29243 case "top-left": 29244 case "top": 29245 r = i - 7; 29246 break; 29247 case "bottom-right": 29248 case "bottom-left": 29249 case "bottom": 29250 r = 7 - i; 29251 } 29252 switch(e1){ 29253 case "top-right": 29254 case "bottom-right": 29255 case "right": 29256 n = -t1; 29257 break; 29258 case "top-left": 29259 case "bottom-left": 29260 case "left": 29261 n = t1; 29262 } 29263 } 29264 return [ 29265 n, 29266 r 29267 ]; 29268 }, t1.dd = function(e1) { 29269 switch(e1){ 29270 case "right": 29271 case "top-right": 29272 case "bottom-right": 29273 return "right"; 29274 case "left": 29275 case "top-left": 29276 case "bottom-left": 29277 return "left"; 29278 } 29279 return "center"; 29280 }, t1.de = Wa, t1.df = be, t1.dg = Ie, t1.dh = Ae, t1.di = ze, t1.dj = rt, t1.dk = oe, t1.dl = sw, t1.dm = uw, t1.dn = nd, t1.dp = function(e1, t1, i, n, r, o) { 29281 const a = [ 29282 t1, 29283 i, 29284 n 29285 ]; 29286 return Y(a, a, o.calculateFogTileMatrix(r)), Aw(e1, D(a), o.pitch); 29287 }, t1.dq = yw, t1.dr = d, t1.ds = Wd, t1.dt = .9, t1.du = re, t1.dv = of, t1.dw = vI, t1.dx = function(e1) { 29288 return e1({ 29289 pluginStatus: Bs, 29290 pluginURL: Vs 29291 }), Us.on("pluginStateChange", e1), e1; 29292 }, t1.dy = ui, t1.dz = Pm, t1.e = kt, t1.e$ = Qi, t1.e0 = function(e1, t1, i, n, r, o, a, s, l, c) { 29293 let u = arguments.length > 10 && arguments[10] !== void 0 ? arguments[10] : 1;
vendor: 5,850 bytes, lines 29294-29409
29294 const h = i.transform, d = n ? e1.textSizeData : e1.iconSizeData, f = af(d, i.transform.zoom, u), p = "globe" === h.projection.name, m = (()=>{ 29295 if (!p) return null; 29296 const e1 = Yf(h.zoom); 29297 return 0 === e1 ? null : { 29298 t: e1, 29299 invMatrix: h.projection.createInversionMatrix(h, c.canonical), 29300 mercCenter: [ 29301 dr(h.center.lng), 29302 fr(h.center.lat) 29303 ] 29304 }; 29305 })(), _ = [ 29306 256 / i.width * 2 + 1, 29307 256 / i.height * 2 + 1 29308 ], g = n ? e1.text.dynamicLayoutVertexArray : e1.icon.dynamicLayoutVertexArray; 29309 g.clear(); 29310 let y = null; 29311 p && (y = n ? e1.text.globeExtVertexArray : e1.icon.globeExtVertexArray); 29312 const x = e1.lineVertexArray, v = n ? e1.text.placedSymbolArray : e1.icon.placedSymbolArray, b = i.transform.width / i.transform.height; 29313 let w, A = !1; 29314 for(let u = 0; u < v.length; u++){ 29315 const p = v.get(u), { numGlyphs: E, writingMode: I } = p; 29316 if (I !== Xd.vertical || A || w === Xd.horizontal || (A = !0), w = I, (p.hidden || I === Xd.vertical) && !A) { 29317 gw(E, g); 29318 continue; 29319 } 29320 A = !1; 29321 const M = new Pe(p.tileAnchorX, p.tileAnchorY), T = "road" === e1.elevationType, S = !!h.elevation || T; 29322 let { x: z, y: R, z: P } = h.projection.projectTilePoint(M.x, M.y, c.canonical); 29323 if (m) { 29324 const [e1, t1, i] = fw(M, c.canonical, m); 29325 z += (e1 - z) * m.t, R += (t1 - R) * m.t, P += (i - P) * m.t; 29326 } 29327 let D = null; 29328 if (S) { 29329 D = T && e1.hdExt ? e1.hdExt.makeRoadSymbolElevationParams(e1, n ? e1.text : e1.icon, u, c, l, h.elevation, h.projection, h.center.lat, h.worldSize) : { 29330 getElevation: l, 29331 elevation: h.elevation, 29332 elevationFeature: null 29333 }; 29334 const [t1, i, r] = D.getElevation(M, h.elevation, D.elevationFeature); 29335 z += t1, R += i, P += r; 29336 } 29337 const F = [ 29338 z, 29339 R, 29340 P, 29341 1 29342 ]; 29343 if (le(F, F, t1), !cw(F, _)) { 29344 gw(E, g); 29345 continue; 29346 } 29347 const C = F[3], L = lw(i.transform.getCameraToCenterDistance(h.projection), C), O = of(d, f, p), B = a ? O / L : O * L, V = sw(z, R, P, r); 29348 if (V[3] <= 0) { 29349 gw(E, g); 29350 continue; 29351 } 29352 let N = {}; 29353 const k = Je(e1.layers[0].layout.get("text-max-angle")), U = Math.cos(k), j = a ? null : D, G = dw(p, B, !1, s, t1, r, o, e1.glyphOffsetArray, x, g, y, V, M, N, b, j, h.projection, c, a, U, m); 29354 A = G.useVertical, j && G.needsFlipping && (N = {}), (G.notEnoughRoom || A || G.needsFlipping && dw(p, B, !0, s, t1, r, o, e1.glyphOffsetArray, x, g, y, V, M, N, b, j, h.projection, c, a, U, m).notEnoughRoom) && gw(E, g); 29355 } 29356 n ? (e1.text.dynamicLayoutVertexBuffer.updateData(g), y && e1.text.globeExtVertexBuffer && e1.text.globeExtVertexBuffer.updateData(y)) : (e1.icon.dynamicLayoutVertexBuffer.updateData(g), y && e1.icon.globeExtVertexBuffer && e1.icon.globeExtVertexBuffer.updateData(y)); 29357 }, t1.e1 = _m, t1.e2 = cv, t1.e3 = (e1, t1, i, n, r, o)=>{ 29358 const a = e1.transform, s = "globe" === a.projection.name; 29359 let l; 29360 if ("map" === o.paint.get("circle-pitch-alignment")) if (s) { 29361 const e1 = qf(a.zoom, t1.canonical) * a._pixelsPerMercatorPixel; 29362 l = Float32Array.from([ 29363 e1, 29364 0, 29365 0, 29366 e1 29367 ]); 29368 } else l = a.calculatePixelsToTileUnitsMatrix(i); 29369 else l = new Float32Array([ 29370 a.pixelsToGLUnits[0], 29371 0, 29372 0, 29373 a.pixelsToGLUnits[1] 29374 ]); 29375 const c = { 29376 u_camera_to_center_distance: e1.transform.getCameraToCenterDistance(a.projection), 29377 u_matrix: e1.translatePosMatrix(t1.projMatrix, i, o.paint.get("circle-translate"), o.paint.get("circle-translate-anchor")), 29378 u_device_pixel_ratio: kt.devicePixelRatio, 29379 u_extrude_scale: l, 29380 u_inv_rot_matrix: lv, 29381 u_merc_center: [ 29382 0, 29383 0 29384 ], 29385 u_tile_id: [ 29386 0, 29387 0, 29388 0 29389 ], 29390 u_zoom_transition: 0, 29391 u_up_dir: [ 29392 0, 29393 0, 29394 0 29395 ], 29396 u_emissive_strength: o.paint.get("circle-emissive-strength") 29397 }; 29398 if (s) { 29399 c.u_inv_rot_matrix = n, c.u_merc_center = r, c.u_tile_id = [ 29400 t1.canonical.x, 29401 t1.canonical.y, 29402 1 << t1.canonical.z 29403 ], c.u_zoom_transition = Yf(a.zoom); 29404 const e1 = r[0] * zr, i = r[1] * zr; 29405 c.u_up_dir = a.projection.upVector(new np(0, 0, 0), e1, i); 29406 } 29407 return c; 29408 }, t1.e4 = Uv, t1.e5 = (e1, t1, i, n, r, o, a, s, l, c)=>{ 29409 const u = e1.transform, h = u.pitch < 15 ? fn(.07, .7, it((14 - u.zoom) / 5, 0, 1)) : .07, d = "none" === i.paint.get("line-trim-color-use-theme").
29409constantOr("default"); 29410 return { 29411 u_matrix: kv(e1, t1, i, n), 29412 u_texsize: t1.imageAtlasTexture ? t1.imageAtlasTexture.size : [ 29413 0, 29414 0 29415 ], 29416 u_pixels_to_tile_units: u.calculatePixelsToTileUnitsMatrix(t1), 29417 u_device_pixel_ratio: r, 29418 u_width_scale: o, 29419 u_floor_width_scale: a, 29420 u_image: 0, 29421 u_tile_units_to_pixels: Nv(t1, u), 29422 u_units_to_pixels: [ 29423 1 / u.pixelsToGLUnits[0], 29424 1 / u.pixelsToGLUnits[1] 29425 ], 29426 u_alpha_discard_threshold: 0, 29427 u_trim_offset: s, 29428 u_trim_fade_range: i.paint.get("line-trim-fade-range"), 29429 u_trim_gradient_mix_range: [ 29430 1, 29431 1 29432 ], 29433 u_trim_color: i.paint.get("line-trim-color").toPremultipliedRenderColor(d ? null : i.lut).toArray01(), 29434 u_zbias_factor: h, 29435 u_tile_to_meter: Ic(t1.tileID.canonical, 0), 29436 u_ground_shadow_factor: l, 29437 u_pattern_transition: c, 29438 u_opacity_multiplier: 1 29439 }; 29440 }, t1.e6 = (e1, t1, i, n, r, o, a, s, l, c)=>{ 29441 const u = e1.transform, h = u.calculatePixelsToTileUnitsMatrix(t1), d = "none" === i.paint.get("line-trim-color-use-theme").constantOr("default"), f = u.pitch < 15 ? fn(.07, .7, it((14 - u.zoom) / 5, 0, 1)) : .07; 29442 return { 29443 u_matrix: kv(e1, t1, i, n), 29444 u_pixels_to_tile_units: h, 29445 u_device_pixel_ratio: o, 29446 u_width_scale: a, 29447 u_floor_width_scale: s, 29448 u_units_to_pixels: [ 29449 1 / u.pixelsToGLUnits[0], 29450 1 / u.pixelsToGLUnits[1] 29451 ], 29452 u_dash_image: 0, 29453 u_gradient_image: 1, 29454 u_border_gradient_image: 2, 29455 u_image_height: r, 29456 u_texsize: jv(i) && t1.lineAtlasTexture ? t1.lineAtlasTexture.size : [ 29457 0, 29458 0 29459 ], 29460 u_tile_units_to_pixels: Nv(t1, e1.transform), 29461 u_alpha_discard_threshold: 0, 29462 u_trim_offset: l, 29463 u_trim_fade_range: i.paint.get("line-trim-fade-range"), 29464 u_trim_gradient_mix_range: [ 29465 1, 29466 1 29467 ], 29468 u_trim_color: i.paint.get("line-trim-color").toPremultipliedRenderColor(d ? null : i.lut).toArray01(), 29469 u_zbias_factor: f, 29470 u_road_view_depth_bias: 0, 29471 u_road_clip_to_view: [ 29472 0, 29473 0, 29474 0, 29475 0 29476 ], 29477 u_tile_to_meter: Ic(t1.tileID.canonical, 0), 29478 u_ground_shadow_factor: c, 29479 u_opacity_multiplier: 1 29480 }; 29481 }, t1.e7 = ct, t1.e8 = xv, t1.e9 = 5, t1.eA = function(e1, t1, i) { 29482 return e1[0] = t1[0] / i[0], e1[1] = t1[1] / i[1], e1[2] = t1[2] / i[2], e1; 29483 }, t1.eB = ie, t1.eC = gc, t1.eD = fc, t1.eE = q, t1.eF = Rf, t1.eG = H, t1.eH = C, t1.eI = function(param) { 29484 let [e1, t1, i] = param; 29485 const n = Math.hypot(e1, t1, i), r = Math.atan2(e1, i), o = .5 * Math.PI - Math.acos(-t1 / n); 29486 return new _c(Ke(r), Ke(o)); 29487 }, t1.eJ = j, t1.eK = se, t1.eL = ny, t1.eM = jt, t1.eN = wi, t1.eO = bi, t1.eP = vw, t1.eQ = class { 29488 _createSkuToken() { 29489 const e1 = function() { 29490 let e1 = ""; 29491 for(let t1 = 0; t1 < 10; t1++)e1 += "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62 * Math.random())]; 29492 return { 29493 token: [ 29494 "1", 29495 vi, 29496 e1 29497 ].join(""), 29498 tokenExpiresAt: Date.now() + 432e5 29499 }; 29500 }(); 29501 this._skuToken = e1.token, this._skuTokenExpiresAt = e1.tokenExpiresAt; 29502 } 29503 _isSkuTokenExpired() { 29504 return Date.now() > this._skuTokenExpiresAt; 29505 } 29506 async transformRequest(e1, t1, i) { 29507 if (!this._transformRequestFn) return { 29508 url: e1 29509 }; 29510 const n = i ? { 29511 signal: i 29512 } : {}; 29513 return await this._transformRequestFn(e1, t1, n) || { 29514 url: e1 29515 }; 29516 } 29517 normalizeStyleURL(e1, t1) { 29518 if (!ni(e1)) return e1; 29519 const n = Pi(e1); 29520 return n.params.push("sdk=js-".concat(i)), n.path = "/styles/v1".concat(n.path), this._makeAPIURL(n, this._customAccessToken || t1); 29521 } 29522 normalizeGlyphsURL(e1, t1) { 29523 if (!ni(e1)) return e1; 29524 const i = Pi(e1); 29525 return i.path = "/fonts/v1".concat(i.path), this._makeAPIURL(i, this._customAccessToken || t1); 29526 } 29527 normalizeModelURL(e1, t1) { 29528 if (!ni(e1)) return e1; 29529 const i = Pi(e1); 29530 return i.path = "/models/v1".concat(i.path), this._makeAPIURL(i, this._customAccessToken || t1); 29531 } 29532 normalizeSourceURL(e1, t1, i, n) { 29533 if (!ni(e1)) return e1; 29534 const r = Pi(e1); 29535 return r.path = "/v4/".concat(r.authority, ".json"), r.params.push("secure"), i && r.params.push("language=".concat(i)), n && r.params.push("worldview=".concat(n)), this._makeAPIURL(r, this._customAccessToken || t1); 29536 } 29537 normalizeIconsetURL(e1, t1) { 29538 const i = Pi(e1); 29539 return ni(e1) ? (i.path = "/styles/v1".concat(i.path, "/iconset.pbf"), this._makeAPIURL(i, this._customAccessToken || t1)) : Di(i); 29540 } 29541 normalizeSpriteURL(e1, t1, i, n) { 29542 const r = Pi(e1); 29543 return ni(e1) ? (r.path = "/styles/v1".concat(r.path, "/sprite").concat(t1).concat(i), this._makeAPIURL(r, this._customAccessToken || n)) : (r.path += "".concat(t1).concat(i), Di(r)); 29544 } 29545 normalizeTileURL(e1, t1, i) { 29546 if (this._isSkuTokenExpired() && this._createSkuToken(), e1 && !ni(e1)) return e1; 29547 const n = Pi(e1); 29548 n.path = n.path.replace(Ei, (t1 || i && "raster" !== n.authority && 512 === i ? "@2x" : "") + ".webp"), "raster" === n.authority ? n.path = "/".concat(jt.RASTER_URL_PREFIX).concat(n.path) : "rasterarrays" === n.authority ? n.path = "/".concat(jt.RASTERARRAYS_URL_PREFIX).concat(n.path) : "3dtiles" === n.authority ? n.path = "/".concat(jt.TILES3D_URL_PREFIX).concat(n.path) : (n.path = n.path.replace(Ii, "/"), n.path = "/".concat(jt.TILE_URL_VERSION).concat(n.path)); 29549 const r = this._customAccessToken || function(e1) { 29550 for (const t1 of e1){ 29551 const e1 = t1.match(Si); 29552 if (e1) return e1[1]; 29553 } 29554 return null; 29555 }(n.params) || jt.ACCESS_TOKEN; 29556 return jt.REQUIRE_ACCESS_TOKEN && r && this._skuToken && n.params.push("sku=".concat(this._skuToken)), this._makeAPIURL(n, r); 29557 } 29558 canonicalizeTileURL(e1, t1) { 29559 const i = Pi(e1); 29560 if (!Ti.test(i.path) || !Mi.test(i.path)) return e1; 29561 let n = "mapbox://"; 29562 i.path.startsWith("/raster/v1/") ? n += "raster/".concat(i.path.replace("/".concat(jt.RASTER_URL_PREFIX, "/"), "")) : i.path.startsWith("/rasterarrays/v1/") ? n += "rasterarrays/".concat(i.path.replace("/".concat(jt.RASTERARRAYS_URL_PREFIX, "/"), "")) : n += "tiles/".concat(i.path.replace("/".concat(jt.TILE_URL_VERSION, "/"), "")); 29563 let r = i.params; 29564 return t1 && (r = r.filter((e1)=>!e1.match(Si))), r.length && (n += "?".concat(r.join("&"))), n; 29565 } 29566 canonicalizeTileset(e1, t1) { 29567 const i = !!t1 && ni(t1), n = []; 29568 for (const t1 of e1.tiles || [])ii(t1) ? n.push(this.canonicalizeTileURL(t1, i)) : n.push(t1); 29569 return n; 29570 } 29571 _makeAPIURL(e1, t1) { 29572 const i = "See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes", n = Pi(jt.API_URL); 29573 if (e1.protocol = n.protocol, e1.authority = n.authority, "http" === e1.protocol) { 29574 const t1 = e1.params.indexOf("secure"); 29575 t1 >= 0 && e1.params.splice(t1, 1); 29576 } 29577 if ("/" !== n.path && (e1.path = "".concat(n.path).concat(e1.path)), !jt.REQUIRE_ACCESS_TOKEN) return Di(e1); 29578 if (t1 = t1 || jt.ACCESS_TOKEN, !this._silenceAuthErrors) { 29579 if (!t1) throw new Error("An API access token is required to use Mapbox GL. ".concat(i)); 29580 if ("s" === t1[0]) throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ".concat(i)); 29581 } 29582 return e1.params = e1.params.filter((e1)=>!e1.includes("access_token")), e1.params.push("access_token=".concat(t1 || "")), Di(e1); 29583 } 29584 constructor(e1, t1, i){ 29585 this._transformRequestFn = e1, this._customAccessToken = t1, this._silenceAuthErrors = !!i, this._createSkuToken(); 29586 } 29587 }, t1.eR = Ci, t1.eS = function(e1, t1) { 29588 t1 ? tn.add(e1) : tn.delete(e1); 29589 }, t1.eT = Ki, t1.eU = en, t1.eV = zi, t1.eW = Hi, t1.eX = Zi, t1.eY = qi, t1.eZ = Yi, t1.e_ = function(e1) { 29590 tn.delete(e1); 29591 }, t1.ea = ab, t1.eb = Jc, t1.ec = function(e1, t1) { 29592 var i = Math.sin(t1), n = Math.cos(t1); 29593 return e1[0] = n, e1[1] = 0, e1[2] = -i, e1[3] = 0, e1[4] = 0, e1[5] = 1, e1[6] = 0, e1[7] = 0, e1[8] = i, e1[9] = 0, e1[10] = n, e1[11] = 0, e1[12] = 0, e1[13] = 0, e1[14] = 0, e1[15] = 1, e1; 29594 }, t1.ed = function(e1, t1) { 29595 var i = Math.sin(t1), n = Math.cos(t1); 29596 return e1[0] = 1, e1[1] = 0, e1[2] = 0, e1[3] = 0, e1[4] = 0, e1[5] = n, e1[6] = i, e1[7] = 0, e1[8] = 0, e1[9] = -i, e1[10] = n, e1[11] = 0, e1[12] = 0, e1[13] = 0, e1[14] = 0, e1[15] = 1, e1; 29597 }, t1.ee = function(e1, t1) { 29598 return e1[0] = t1[0], e1[1] = t1[1], e1[2] = t1[2], e1[3] = t1[4], e1[4] = t1[5], e1[5] = t1[6], e1[6] = t1[8], e1[7] = t1[9], e1[8] = t1[10], e1; 29599 }, t1.ef = a, t1.eg = pu, t1.eh = 1, t1.ei = Wb, t1.ej = 0, t1.ek = mu, t1.el = function(e1, t1, i, n, r) { 29600 return it((e1 - t1) / (i - t1) * (r - n) + n, n, r); 29601 }, t1.em = D, t1.en = fe, t1.eo = function(e1, t1) { 29602 var i = t1[0], n = t1[1], r = t1[2], o = t1[3], a = t1[4], s = t1[5], l = t1[6], c = t1[7], u = t1[8], h = u * a - s * c, d = -u * o + s * l, f = c * o - a * l, p = i * h + n * d + r * f; 29603 return p ? (e1[0] = h * (p = 1 / p), e1[1] = (-u * n + r * c) * p, e1[2] = (s * n - r * a) * p, e1[3] = d * p, e1[4] = (u * i - r * l) * p, e1[5] = (-s * i + r * o) * p, e1[6] = f * p, e1[7] = (-c * i + n * l) * p, e1[8] = (a * i - n * o) * p, e1) : null; 29604 }, t1.ep = ou, t1.eq = class { 29605 clear() { 29606 this._activeRegions.length > 0 && ++this._updateTime, this._activeRegions = [], this._prevRegions = []; 29607 } 29608 get updateTime() { 29609 return this._updateTime; 29610 } 29611 getReplacementRegionsForTile(e1) { 29612 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
vendor: 12,364 bytes, lines 29613-29839
29613 const i = Vp(new Pe(0, 0), new Pe(zr, zr), e1), n = []; 29614 if (t1 && !Op(i, this._globalClipBounds)) return n; 29615 for (const t1 of this._activeRegions){ 29616 if (t1.hiddenByOverlap) continue; 29617 if (!Op(i, t1)) continue; 29618 const r = Np(t1.min, t1.max, e1); 29619 n.push({ 29620 min: r.min, 29621 max: r.max, 29622 sourceId: this._sourceIds[t1.priority], 29623 footprint: t1.footprint, 29624 footprintTileId: t1.tileId, 29625 order: t1.order, 29626 clipMask: t1.clipMask, 29627 clipScope: t1.clipScope 29628 }); 29629 } 29630 return n; 29631 } 29632 setSources(e1) { 29633 this._setSources(e1.map((e1)=>({ 29634 getSourceId: ()=>e1.cache.id, 29635 getFootprints: ()=>{ 29636 const t1 = []; 29637 for (const i of e1.cache.getVisibleCoordinates()){ 29638 const n = e1.cache.getTile(i).buckets[e1.layer]; 29639 n && n.updateFootprints(i.toUnwrapped(), t1); 29640 } 29641 return t1; 29642 }, 29643 getOrder: ()=>e1.order, 29644 getClipMask: ()=>e1.clipMask, 29645 getClipScope: ()=>e1.clipScope 29646 }))); 29647 } 29648 _addSource(e1) { 29649 const t1 = e1.getFootprints(); 29650 if (0 === t1.length) return; 29651 const i = e1.getOrder(), n = e1.getClipMask(), r = e1.getClipScope(); 29652 for (const e1 of t1){ 29653 if (!e1.footprint) continue; 29654 const t1 = Vp(e1.footprint.min, e1.footprint.max, e1.id); 29655 this._activeRegions.push({ 29656 min: t1.min, 29657 max: t1.max, 29658 hiddenByOverlap: !1, 29659 priority: this._sourceIds.length, 29660 tileId: e1.id, 29661 footprint: e1.footprint, 29662 order: i, 29663 clipMask: n, 29664 clipScope: r 29665 }); 29666 } 29667 this._sourceIds.push(e1.getSourceId()); 29668 } 29669 _computeReplacement() { 29670 this._activeRegions.sort((e1, t1)=>e1.priority - t1.priority || Cp(e1.min, t1.min) || Cp(e1.max, t1.max) || e1.order - t1.order || e1.clipMask - t1.clipMask || function(e1, t1) { 29671 const i = (e1, t1)=>e1 + t1; 29672 return e1.length - t1.length || e1.reduce(i, "").localeCompare(t1.reduce(i, "")); 29673 }(e1.clipScope, t1.clipScope)); 29674 let e1 = this._activeRegions.length !== this._prevRegions.length; 29675 if (!e1) { 29676 let t1 = 0; 29677 for(; !e1 && t1 !== this._activeRegions.length;){ 29678 const i = this._activeRegions[t1], n = this._prevRegions[t1]; 29679 e1 = i.priority !== n.priority || !Lp(i, n) || i.order !== n.order || i.clipMask !== n.clipMask || !De(i.clipScope, n.clipScope), this._activeRegions[t1].hiddenByOverlap = n.hiddenByOverlap, ++t1; 29680 } 29681 } 29682 if (e1) { 29683 ++this._updateTime; 29684 for (const e1 of this._activeRegions)e1.order !== Pp && (this._globalClipBounds.min.x = Math.min(this._globalClipBounds.min.x, e1.min.x), this._globalClipBounds.min.y = Math.min(this._globalClipBounds.min.y, e1.min.y), this._globalClipBounds.max.x = Math.max(this._globalClipBounds.max.x, e1.max.x), this._globalClipBounds.max.y = Math.max(this._globalClipBounds.max.y, e1.max.y)); 29685 const e1 = (e1)=>{ 29686 const t1 = this._activeRegions; 29687 if (e1 >= t1.length) return e1; 29688 const i = t1[e1].priority; 29689 for(; e1 < t1.length && t1[e1].priority === i;)++e1; 29690 return e1; 29691 }; 29692 if (this._sourceIds.length > 1) { 29693 let t1 = 0, i = e1(t1); 29694 for(; t1 !== i;){ 29695 let n = t1; 29696 const r = t1; 29697 for(; n !== i;){ 29698 const e1 = this._activeRegions[n]; 29699 e1.hiddenByOverlap = !1; 29700 for(let t1 = 0; t1 < r; t1++){ 29701 const i = this._activeRegions[t1]; 29702 if (!i.hiddenByOverlap && e1.order === Pp && Op(e1, i) && (e1.hiddenByOverlap = Up(e1.footprint, e1.tileId, i.footprint, i.tileId), e1.hiddenByOverlap)) break; 29703 } 29704 ++n; 29705 } 29706 t1 = i, i = e1(t1); 29707 } 29708 } 29709 } 29710 } 29711 _setSources(e1) { 29712 [this._prevRegions, this._activeRegions] = [ 29713 this._activeRegions, 29714 [] 29715 ], this._sourceIds = []; 29716 for(let t1 = e1.length - 1; t1 >= 0; t1--)this._addSource(e1[t1]); 29717 this._computeReplacement(); 29718 } 29719 constructor(){ 29720 this._updateTime = 0, this._sourceIds = [], this._activeRegions = [], this._prevRegions = [], this._globalClipBounds = { 29721 min: new Pe(1 / 0, 1 / 0), 29722 max: new Pe(-1 / 0, -1 / 0) 29723 }; 29724 } 29725 }, t1.er = Pp, t1.es = class { 29726 destroy() { 29727 this._poleIndexBuffer.destroy(), this._gridBuffer.destroy(), this._gridIndexBuffer.destroy(), this._poleNorthVertexBuffer.destroy(), this._poleSouthVertexBuffer.destroy(); 29728 for (const e1 of this._poleSegments)e1.destroy(); 29729 for (const e1 of this._gridSegments)e1.withSkirts.destroy(), e1.withoutSkirts.destroy(); 29730 } 29731 _fillGridMeshWithLods(e1, t1) { 29732 const i = new jc, n = new uu, r = [], o = e1 + 1 + 2, a = t1[0] + 1, s = t1[0] + 1 + (1 + t1.length), l = (e1, t1, i)=>{ 29733 let n = e1 === o - 1 ? e1 - 2 : 0 === e1 ? e1 : e1 - 1; 29734 return n += i ? 24575 : 0, [ 29735 n, 29736 t1 29737 ]; 29738 }; 29739 for(let e1 = 0; e1 < o; ++e1)i.emplaceBack(...l(e1, 0, !0)); 29740 for(let e1 = 0; e1 < a; ++e1)for(let t1 = 0; t1 < o; ++t1)i.emplaceBack(...l(t1, e1, (0 === t1 || t1 === o - 1) && !0)); 29741 for(let e1 = 0; e1 < t1.length; ++e1){ 29742 const n = t1[e1]; 29743 for(let e1 = 0; e1 < o; ++e1)i.emplaceBack(...l(e1, n, !0)); 29744 } 29745 for(let e1 = 0; e1 < t1.length; ++e1){ 29746 const a = n.length, l = t1[e1] + 1 + 2, c = new uu; 29747 for(let i = 0; i < l - 1; i++){ 29748 const r = i === l - 2, a = r ? o * (s - t1.length + e1 - i) : o; 29749 for(let e1 = 0; e1 < o - 1; e1++){ 29750 const t1 = i * o + e1; 29751 0 === i || r || 0 === e1 || e1 === o - 2 ? (c.emplaceBack(t1 + 1, t1, t1 + a), c.emplaceBack(t1 + a, t1 + a + 1, t1 + 1)) : (n.emplaceBack(t1 + 1, t1, t1 + a), n.emplaceBack(t1 + a, t1 + a + 1, t1 + 1)); 29752 } 29753 } 29754 const u = ju.simpleSegment(0, a, i.length, n.length - a); 29755 for(let e1 = 0; e1 < c.uint16.length; e1 += 3)n.emplaceBack(c.uint16[e1], c.uint16[e1 + 1], c.uint16[e1 + 2]); 29756 const h = ju.simpleSegment(0, a, i.length, n.length - a); 29757 r.push({ 29758 withoutSkirts: u, 29759 withSkirts: h 29760 }); 29761 } 29762 return { 29763 vertices: i, 29764 indices: n, 29765 segments: r 29766 }; 29767 } 29768 _createGrid(e1) { 29769 const t1 = this._fillGridMeshWithLods(lc, cc); 29770 this._gridSegments = t1.segments, this._gridBuffer = e1.createVertexBuffer(t1.vertices, vf.members), this._gridIndexBuffer = e1.createIndexBuffer(t1.indices, !0); 29771 } 29772 _createPoles(e1) { 29773 const t1 = new uu; 29774 for(let e1 = 0; e1 <= lc; e1++)t1.emplaceBack(0, e1 + 1, e1 + 2); 29775 this._poleIndexBuffer = e1.createIndexBuffer(t1, !0); 29776 const i = new pu, n = new pu, r = new pu, o = new pu; 29777 this._poleSegments = []; 29778 for(let e1 = 0, t1 = 0; e1 < 6; e1++){ 29779 const a = 360 / (1 << e1); 29780 i.emplaceBack(0, -sc, 0, .5, 0), n.emplaceBack(0, -sc, 0, .5, 1), r.emplaceBack(0, -sc, 0, .5, .5), o.emplaceBack(0, -sc, 0, .5, .5); 29781 for(let e1 = 0; e1 <= lc; e1++){ 29782 let t1 = e1 / lc, s = 0; 29783 const l = fn(0, a, t1), [c, u, h] = dc(ep, tp, l, sc); 29784 i.emplaceBack(c, u, h, t1, s), n.emplaceBack(c, u, h, t1, 1 - s); 29785 const d = Je(l); 29786 t1 = .5 + .5 * Math.sin(d), s = .5 + .5 * Math.cos(d), r.emplaceBack(c, u, h, t1, s), o.emplaceBack(c, u, h, t1, 1 - s); 29787 } 29788 this._poleSegments.push(ju.simpleSegment(t1, 0, 66, 64)), t1 += 66; 29789 } 29790 this._poleNorthVertexBuffer = e1.createVertexBuffer(i, yf, !1), this._poleSouthVertexBuffer = e1.createVertexBuffer(n, yf, !1), this._texturedPoleNorthVertexBuffer = e1.createVertexBuffer(r, yf, !1), this._texturedPoleSouthVertexBuffer = e1.createVertexBuffer(o, yf, !1); 29791 } 29792 getGridBuffers(e1, t1) { 29793 return [ 29794 this._gridBuffer, 29795 this._gridIndexBuffer, 29796 t1 ? this._gridSegments[e1].withSkirts : this._gridSegments[e1].withoutSkirts 29797 ]; 29798 } 29799 getPoleBuffers(e1, t1) { 29800 return [ 29801 t1 ? this._texturedPoleNorthVertexBuffer : this._poleNorthVertexBuffer, 29802 t1 ? this._texturedPoleSouthVertexBuffer : this._poleSouthVertexBuffer, 29803 this._poleIndexBuffer, 29804 this._poleSegments[e1] 29805 ]; 29806 } 29807 constructor(e1){ 29808 this._createGrid(e1), this._createPoles(e1); 29809 } 29810 }, t1.et = function(e1) { 29811 return tn.has(e1); 29812 }, t1.eu = SA, t1.ev = Dp, t1.ew = Re, t1.ex = function() { 29813 return !!document.fullscreenElement || !!document.webkitFullscreenElement; 29814 }, t1.ey = tt, t1.ez = Ec, t1.f = on, t1.f$ = rf, t1.f0 = Gi, t1.f1 = function(e1, t1) { 29815 Xt = e1, Yt = t1; 29816 }, t1.f2 = i, t1.f3 = Kf, t1.f4 = Ke, t1.f5 = Jf, t1.f6 = function(e1) { 29817 const t1 = [ 29818 0, 29819 0, 29820 0 29821 ], i = d(new Float64Array(16)); 29822 return m(i, e1.pixelMatrix, e1.globeMatrix), Y(t1, t1, i), new Pe(t1[0], t1[1]); 29823 }, t1.f7 = function(e1) { 29824 Vi = e1; 29825 }, t1.f8 = ri, t1.f9 = nw, t1.fA = rE, t1.fB = function(e1) { 29826 let t1 = 0; 29827 if (new Uint32Array(e1, 0, 1)[0] !== Og) { 29828 const i = new Uint32Array(e1, 0, 7), [, , n, r, o, a] = i; 29829 t1 = i.byteLength + r + o + a + o, (n !== e1.byteLength || t1 >= e1.byteLength) && gt("Invalid b3dm header information."); 29830 } 29831 return jg(e1, t1); 29832 }, t1.fC = function(e1, t1) { 29833 const i = e1.json.extensionsUsed && e1.json.extensionsUsed.includes("mbx_bvh"), n = Fy(e1); 29834 for (const e1 of n){ 29835 if (!i) for (const t1 of e1.meshes)Cy(t1); 29836 e1.lights && (e1.lightMeshIndex = e1.meshes.length, e1.meshes.push(Oy(e1.lights, t1))); 29837 } 29838 return n; 29839 }
29839, t1.fD = Ic, t1.fE = Rb, t1.fF = Xa, t1.fG = function(e1, t1) { 29840 let i = ""; 29841 for(let n = 0; n < e1.length; n++){ 29842 const r = e1.charCodeAt(n + 1) || null, o = e1.charCodeAt(n - 1) || null; 29843 i += !t1 && (r && Ps(r) && !Qd[e1[n + 1]] || o && Ps(o) && !Qd[e1[n - 1]]) || !Qd[e1[n]] ? e1[n] : Qd[e1[n]]; 29844 } 29845 return i; 29846 }, t1.fH = Hs, t1.fI = function(e1) { 29847 return !(e1 < 11904 || !(hs(e1) || us(e1) || Es(e1) || bs(e1) || ms(e1) || rs(e1) || ds(e1) || ss(e1) || _s(e1) || gs(e1) || ps(e1) || Ts(e1) || ls(e1) || as(e1) || os(e1) || fs(e1) || cs(e1) || As(e1) || xs(e1) || ys(e1))); 29848 }, t1.fJ = Rs, t1.fK = function(e1) { 29849 return ts(e1) || is(e1) || ns(e1) || ws(e1) || Ms(e1); 29850 }, t1.fL = function(e1) { 29851 return 12307 === e1 || 12312 === e1 || 12313 === e1 || 12316 === e1 || 12448 === e1 || 12540 === e1 || e1 >= 8592 && e1 <= 8595 || 8208 === e1 || 8229 === e1 || 8741 === e1 || e1 >= 9472 && e1 <= 9547 || 65294 === e1 || 65309 === e1 || 65374 === e1 || 65507 === e1; 29852 }, t1.fM = 3, t1.fN = Sr, t1.fO = Zh, t1.fP = fd, t1.fQ = function(e1) { 29853 for (const t1 of e1)if (!zs(t1.charCodeAt(0))) return !1; 29854 return !0; 29855 }, t1.fR = Ss, t1.fS = pf, t1.fT = Jd, t1.fU = mf, t1.fV = Kd, t1.fW = ym, t1.fX = 1, t1.fY = hf, t1.fZ = df, t1.f_ = Ne, t1.fa = function(e1, t1) { 29856 if (!e1 || !t1) throw new Error("TileProvider name and URL are required"); 29857 jt.TILE_PROVIDER_URLS[e1] = kt.resolveURL(t1); 29858 }, t1.fb = function(e1) { 29859 "string" != typeof e1 || e1.length > 64 || !Bi.test(e1) ? gt('Invalid SDK info "'.concat(e1, '"; expected a "Name/version" string. Ignoring.')) : Oi = e1; 29860 }, t1.fc = js, t1.fd = function(e1, t1) { 29861 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 29862 if (Bs === Ls.deferred || Bs === Ls.loading || Bs === Ls.loaded) throw new Error("setRTLTextPlugin cannot be called multiple times."); 29863 Vs = kt.resolveURL(e1), Bs = Ls.deferred, Os = t1, ks(), i || Gs(); 29864 }, t1.fe = function(e1) { 29865 jt.BUILDING_GEN_URL = kt.resolveURL(e1); 29866 }, t1.ff = $t, t1.fg = function(e1) { 29867 const t1 = kt.resolveURL(e1); 29868 jt.MESHOPT_URL = t1, jt.MESHOPT_SIMD_URL = t1; 29869 }, t1.fh = Ht, t1.fi = function(e1) { 29870 jt.DRACO_URL = kt.resolveURL(e1); 29871 }, t1.fj = Gt, t1.fk = function(e1) { 29872 const t1 = Qt(); 29873 if (!t1) return; 29874 const i = t1.delete(qt); 29875 e1 && i.then(()=>e1()).catch(e1); 29876 }, t1.fl = function(e1) { 29877 jt.MAX_PARALLEL_IMAGE_REQUESTS = e1; 29878 }, t1.fm = function(e1) { 29879 jt.API_URL = e1; 29880 }, t1.fn = function(e1) { 29881 jt.ACCESS_TOKEN = e1; 29882 }, t1.fo = "hd_road_elevation", t1.fp = class { 29883 static parseFrom(e1, t1) { 29884 const i = l_.parse(e1); 29885 if (!i) return []; 29886 let { vertices: n, features: r } = i; 29887 const o = 1 / Ic(t1); 29888 r.sort((e1, t1)=>e1.id - t1.id), n.sort((e1, t1)=>e1.id - t1.id || e1.idx - t1.idx), n = n.filter((e1, t1, i)=>t1 === i.findIndex((t1)=>t1.id === e1.id && t1.idx === e1.idx)); 29889 const a = new Array; 29890 let s = 0; 29891 const l = n.length; 29892 for (const e1 of r){ 29893 if (e1.constantHeight) { 29894 a.push(new m_(e1.id, e1.bounds, e1.constantHeight)); 29895 continue; 29896 } 29897 for(; s !== l && n[s].id < e1.id;)s++; 29898 if (s === l || n[s].id !== e1.id) continue; 29899 const t1 = new Array, i = new Array, r = s; 29900 for(; s !== l && n[s].id === e1.id;){ 29901 const e1 = n[s]; 29902 if (t1.push({ 29903 position: e1.position, 29904 height: e1.height, 29905 extent: e1.extent, 29906 index: e1.idx 29907 }), s !== r && n[s - 1].idx === e1.idx - 1) { 29908 const e1 = s - r; 29909 i.push({ 29910 a: e1 - 1, 29911 b: e1 29912 }); 29913 } 29914 s++; 29915 } 29916 a.push(new m_(e1.id, e1.bounds, void 0, t1, i, o)); 29917 } 29918 return a; 29919 } 29920 }, t1.fq = t_, t1.fr = iv, t1.fs = cg, t1.ft = He, t1.fu = Qr, t1.fv = function(e1, t1) { 29921 const i = e1.layers[0].layout.get("fill-elevation-reference"), n = "hd-road-base" === i || "hd-road-markup" === i ? i : null, r = !!t1 && t1.length > 0 && ug(t1, e1.layers[0].source, e1.sourceLayerName); 29922 (n || r) && (e1.hdExt = new hg(e1, n, r)); 29923 }, t1.fw = function(e1, t1) { 29924 const i = "hd-road-markup" === e1.layers[0].layout.get("line-elevation-reference"), n = !!t1 && t1.length > 0 && ug(t1, e1.layers[0].source, e1.sourceLayerName); 29925 (i || n) && (e1.hdExt = new pg(i, n)); 29926 }, t1.fx = Ad, t1.fy = function(e1) { 29927 const t1 = e1.layers[0]; 29928 "circle" === t1.type && "hd-road-markup" === t1.layout.get("
vendor: 4,425 bytes, lines 29928-29999
29928circle-elevation-reference") && (e1.hdExt = new mg); 29929 }, t1.fz = function(e1) { 29930 "hd-road-markup" === e1.layers[0].layout.get("symbol-elevation-reference") && (e1.hdExt = new gg); 29931 }, t1.g = mi, t1.g0 = Fm, t1.g1 = _f, t1.g2 = function(e1, t1) { 29932 const i = e1.stretchY || [ 29933 [ 29934 0, 29935 e1.paddedRect.h - 2 29936 ] 29937 ]; 29938 return e1.stretchX || e1.stretchY ? Om(e1.stretchX || [ 29939 [ 29940 0, 29941 e1.paddedRect.w - 2 29942 ] 29943 ]) * Om(i) : 1; 29944 }, t1.g3 = km, t1.g4 = cd, t1.g5 = 2, t1.g6 = Ob, t1.g7 = dd, t1.g8 = ug, t1.g9 = function(e1, t1) { 29945 const i = cg(e1); 29946 return null !== i && !!(t1 & 1 << i); 29947 }, t1.ga = dt, t1.gb = xm, t1.gc = dm, t1.gd = vm, t1.ge = bm, t1.gf = Oh, t1.gg = function(e1) { 29948 return e1 <= 1 ? 1 : Math.pow(2, Math.floor(Math.log2(e1))); 29949 }, t1.gh = ME, t1.gi = Dh, t1.gj = class { 29950 writeTag(e1, t1) { 29951 this.writeVarint(e1 << 3 | t1); 29952 } 29953 realloc(e1) { 29954 let t1 = this.length || 16; 29955 for(; t1 < this.pos + e1;)t1 *= 2; 29956 if (t1 !== this.length) { 29957 const e1 = new Uint8Array(t1); 29958 e1.set(this.buf), this.buf = e1, this.dataView = new DataView(e1.buffer), this.length = t1; 29959 } 29960 } 29961 finish() { 29962 return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length); 29963 } 29964 writeFixed32(e1) { 29965 this.realloc(4), this.dataView.setInt32(this.pos, e1, !0), this.pos += 4; 29966 } 29967 writeSFixed32(e1) { 29968 this.realloc(4), this.dataView.setInt32(this.pos, e1, !0), this.pos += 4; 29969 } 29970 writeFixed64(e1) { 29971 this.realloc(8), this.dataView.setInt32(this.pos, -1 & e1, !0), this.dataView.setInt32(this.pos + 4, Math.floor(e1 * $p), !0), this.pos += 8; 29972 } 29973 writeSFixed64(e1) { 29974 this.realloc(8), this.dataView.setInt32(this.pos, -1 & e1, !0), this.dataView.setInt32(this.pos + 4, Math.floor(e1 * $p), !0), this.pos += 8; 29975 } 29976 writeVarint(e1) { 29977 if ((e1 = +e1 || 0) >= 0 && e1 < 128) return this.pos >= this.length && this.realloc(1), void (this.buf[this.pos++] = e1); 29978 e1 > 268435455 || e1 < 0 ? function(e1, t1) { 29979 let i, n; 29980 if (e1 >= 0 ? (i = e1 % 4294967296 | 0, n = e1 / 4294967296 | 0) : (i = ~(-e1 % 4294967296), n = ~(-e1 / 4294967296), 4294967295 ^ i ? i = i + 1 | 0 : (i = 0, n = n + 1 | 0)), e1 >= 0x10000000000000000 || e1 < -0x10000000000000000) throw new Error("Given varint doesn't fit into 10 bytes"); 29981 t1.realloc(10), function(e1, t1, i) { 29982 i.buf[i.pos++] = 127 & e1 | 128, e1 >>>= 7, i.buf[i.pos++] = 127 & e1 | 128, e1 >>>= 7, i.buf[i.pos++] = 127 & e1 | 128, e1 >>>= 7, i.buf[i.pos++] = 127 & e1 | 128, i.buf[i.pos] = 127 & (e1 >>>= 7); 29983 }(i, 0, t1), function(e1, t1) { 29984 const i = (7 & e1) << 4; 29985 t1.buf[t1.pos++] |= i | ((e1 >>>= 3) ? 128 : 0), e1 && (t1.buf[t1.pos++] = 127 & e1 | ((e1 >>>= 7) ? 128 : 0), e1 && (t1.buf[t1.pos++] = 127 & e1 | ((e1 >>>= 7) ? 128 : 0), e1 && (t1.buf[t1.pos++] = 127 & e1 | ((e1 >>>= 7) ? 128 : 0), e1 && (t1.buf[t1.pos++] = 127 & e1 | ((e1 >>>= 7) ? 128 : 0), e1 && (t1.buf[t1.pos++] = 127 & e1))))); 29986 }(n, t1); 29987 }(e1, this) : (this.realloc(4), this.buf[this.pos++] = 127 & e1 | (e1 > 127 ? 128 : 0), e1 <= 127 || (this.buf[this.pos++] = 127 & (e1 >>>= 7) | (e1 > 127 ? 128 : 0), e1 <= 127 || (this.buf[this.pos++] = 127 & (e1 >>>= 7) | (e1 > 127 ? 128 : 0), e1 <= 127 || (this.buf[this.pos++] = e1 >>> 7 & 127)))); 29988 } 29989 writeSVarint(e1) { 29990 this.writeVarint(e1 < 0 ? 2 * -e1 - 1 : 2 * e1); 29991 } 29992 writeBoolean(e1) { 29993 this.writeVarint(+e1); 29994 } 29995 writeString(e1) { 29996 e1 = String(e1), this.realloc(4 * e1.length), this.pos++; 29997 const t1 = this.pos; 29998 this.pos = function(e1, t1, i) { 29999 for(let n, r, o = 0; o < t1.length; o++){
30000 if (n = t1.charCodeAt(o), n > 55295 && n < 57344) { 30001 if (!r) { 30002 n > 56319 || o + 1 === t1.length ? (e1[i++] = 239, e1[i++] = 191, e1[i++] = 189) : r = n; 30003 continue; 30004 } 30005 if (n < 56320) { 30006 e1[i++] = 239, e1[i++] = 191, e1[i++] = 189, r = n; 30007 continue; 30008 } 30009 n = r - 55296 << 10 | n - 56320 | 65536, r = null; 30010 } else r && (e1[i++] = 239, e1[i++] = 191, e1[i++] = 189, r = null); 30011 n < 128 ? e1[i++] = n : (n < 2048 ? e1[i++] = n >> 6 | 192 : (n < 65536 ? e1[i++] = n >> 12 | 224 : (e1[i++] = n >> 18 | 240, e1[i++] = n >> 12 & 63 | 128), e1[i++] = n >> 6 & 63 | 128), e1[i++] = 63 & n | 128); 30012 } 30013 return i; 30014 }(this.buf, e1, this.pos); 30015 const i = this.pos - t1; 30016 i >= 128 && Xp(t1, i, this), this.pos = t1 - 1, this.writeVarint(i), this.pos += i; 30017 } 30018 writeFloat(e1) { 30019 this.realloc(4), this.dataView.setFloat32(this.pos, e1, !0), this.pos += 4; 30020 } 30021 writeDouble(e1) { 30022 this.realloc(8), this.dataView.setFloat64(this.pos, e1, !0), this.pos += 8; 30023 } 30024 writeBytes(e1) { 30025 const t1 = e1.length; 30026 this.writeVarint(t1), this.realloc(t1), this.buf.set(e1, this.pos), this.pos += t1; 30027 } 30028 writeRawMessage(e1, t1) { 30029 this.pos++; 30030 const i = this.pos; 30031 e1(t1, this); 30032 const n = this.pos - i; 30033 n >= 128 && Xp(i, n, this), this.pos = i - 1, this.writeVarint(n), this.pos += n; 30034 } 30035 writeMessage(e1, t1, i) { 30036 this.writeTag(e1, 2), this.writeRawMessage(t1, i); 30037 } 30038 writePackedVarint(e1, t1) { 30039 t1.length && this.writeMessage(e1, Yp, t1); 30040 } 30041 writePackedSVarint(e1, t1) { 30042 t1.length && this.writeMessage(e1, Jp, t1); 30043 } 30044 writePackedBoolean(e1, t1) { 30045 t1.length && this.writeMessage(e1, em, t1); 30046 } 30047 writePackedFloat(e1, t1) { 30048 t1.length && this.writeMessage(e1, Kp, t1); 30049 } 30050 writePackedDouble(e1, t1) { 30051 t1.length && this.writeMessage(e1, Qp, t1); 30052 } 30053 writePackedFixed32(e1, t1) { 30054 t1.length && this.writeMessage(e1, tm, t1); 30055 } 30056 writePackedSFixed32(e1, t1) { 30057 t1.length && this.writeMessage(e1, im, t1); 30058 } 30059 writePackedFixed64(e1, t1) { 30060 t1.length && this.writeMessage(e1, nm, t1); 30061 } 30062 writePackedSFixed64(e1, t1) { 30063 t1.length && this.writeMessage(e1, rm, t1); 30064 } 30065 writeBytesField(e1, t1) { 30066 this.writeTag(e1, 2), this.writeBytes(t1); 30067 } 30068 writeFixed32Field(e1, t1) { 30069 this.writeTag(e1, 5), this.writeFixed32(t1); 30070 } 30071 writeSFixed32Field(e1, t1) { 30072 this.writeTag(e1, 5), this.writeSFixed32(t1); 30073 } 30074 writeFixed64Field(e1, t1) { 30075 this.writeTag(e1, 1), this.writeFixed64(t1); 30076 } 30077 writeSFixed64Field(e1, t1) { 30078 this.writeTag(e1, 1), this.writeSFixed64(t1); 30079 } 30080 writeVarintField(e1, t1) { 30081 this.writeTag(e1, 0), this.writeVarint(t1); 30082 } 30083 writeSVarintField(e1, t1) { 30084 this.writeTag(e1, 0), this.writeSVarint(t1); 30085 } 30086 writeStringField(e1, t1) { 30087 this.writeTag(e1, 2), this.writeString(t1); 30088 } 30089 writeFloatField(e1, t1) { 30090 this.writeTag(e1, 5), this.writeFloat(t1); 30091 } 30092 writeDoubleField(e1, t1) { 30093 this.writeTag(e1, 1), this.writeDouble(t1); 30094 } 30095 writeBooleanField(e1, t1) { 30096 this.writeVarintField(e1, +t1); 30097 } 30098 constructor(e1 = new Uint8Array(16)){ 30099 this.buf = ArrayBuffer.isView(e1) ? e1 : new Uint8Array(e1), this.dataView = new DataView(this.buf.buffer, this.buf.byteOffset, this.buf.byteLength), this.pos = 0, this.length = this.buf.length; 30100 } 30101 }, t1.gk = bt, t1.gl = Rp, t1.gm = Ls, t1.gn = sE, t1.go = function(e1) {
30102 ei(), null != Kt && Kt.then((t1)=>{ 30103 t1.keys().then((i)=>{ 30104 for(let n = 0; n < i.length - e1; n++)t1.delete(i[n]).catch((e1)=>gt(e1.message)); 30105 }).catch((e1)=>gt(e1.message)); 30106 }).catch((e1)=>gt(e1.message)); 30107 }, t1.h = rn, t1.i = jn, t1.j = 2, t1.k = gm, t1.l = tr, t1.m = bl, t1.n = er, t1.o = Nt, t1.p = sm, t1.q = nr, t1.r = Ra, t1.s = rl, t1.t = Ta, t1.u = ol, t1.v = za, t1.w = gt, t1.x = ka, t1.y = al, t1.z = Ha; 30108 }); 30109 define([ 30110 "require", 30111 "./shared" 30112 ], function(e1, t1) { 30113 function o(e1) { 30114 const t1 = e1 ? e1.url.toString() : void 0; 30115 return t1 ? performance.getEntriesByName(t1) : []; 30116 } 30117 function i(e1, o) { 30118 if (Object.hasOwn(e1.layers, t1.fo)) return t1.fp.parseFrom(e1.layers[t1.fo], o); 30119 } 30120 function n(param) { 30121 let { buckets: e1, data: o, sourceLayerCoder: i, canonical: n, options: s } = param; 30122 if (!s.elevationFeatures || 0 === s.elevationFeatures.length) return; 30123 const r = []; 30124 for (const o of Object.values(e1))if (o instanceof t1.bA && o.hdExt) { 30125 const e1 = o.hdExt.getUnevaluatedPortalGraph(); 30126 e1 && r.push(e1); 30127 } 30128 const a = t1.fq.evaluate(r); 30129 for (const r of Object.values(e1))if (r instanceof t1.bA && r.hdExt) { 30130 const e1 = o.layers[i.decode(r.sourceLayerIndex)]; 30131 r.hdExt.setEvaluatedPortalGraph(a, e1, n, s.availableImages, s.brightness, r.worldview); 30132 } 30133 } 30134 function s(e1) { 30135 const o = []; 30136 for(let i = 0; i < e1.length; i++){ 30137 const n = e1.feature(i), s = n.properties.frc_mask; 30138 if (null == s) continue; 30139 const r = Number(s); 30140 if (!r) continue; 30141 const a = n.loadGeometry(); 30142 if (a.length > 0) { 30143 let e1 = !1; 30144 for (const o of a[0])if (o.x < 0 || o.x > t1.a6 || o.y < 0 || o.y > t1.a6) { 30145 e1 = !0; 30146 break; 30147 } 30148 if (e1) continue; 30149 } 30150 const l = 1 === a.length && 5 === a[0].length && a[0].some((e1)=>e1.x <= 0 && e1.y <= 0) && a[0].some((e1)=>e1.x >= t1.a6 && e1.y <= 0) && a[0].some((e1)=>e1.x >= t1.a6 && e1.y >= t1.a6) && a[0].some((e1)=>e1.x <= 0 && e1.y >= t1.a6); 30151 o.push(new t1.fr(r, l ? [] : a)); 30152 } 30153 return o; 30154 } 30155 function r(e1, o, i, n, s) { 30156 const r = t1.fs(o); 30157 if (null === r) return !1; 30158 let a = i.x, l = i.y; 30159 const c = s !== null && s !== void 0 ? s : n.z; 30160 if (n.z !== c) { 30161 const e1 = 1 << n.z - c, o = t1.a6 / e1; 30162 a = n.x % e1 * o + i.x / e1, l = n.y % e1 * o + i.y / e1; 30163 } 30164 for (const o of e1){ 30165 if (!(o.hasGeometry() && o.frcMask & 1 << r)) continue; 30166 const e1 = o.rings.map((e1)=>e1.map((e1)=>[ 30167 e1.x, 30168 e1.y 30169 ])); 30170 if (t1.ft([ 30171 a, 30172 l 30173 ], e1)) return !0; 30174 } 30175 return !1; 30176 } 30177 function a(e1, o, i, n) { 30178 const s = o.indoorState.activeFloorsVisible; 30179 if (!o.sourceLayers) return s ? o.indoorState.activeFloors : void 0; 30180 const r = function(e1, o) { 30181 if (!e1) return t1.w("No source layers defined in indoor specification"), o; 30182 if (0 === e1.size) return o; 30183 const i = e1.difference(o); 30184 for (const e1 of i)t1.w("Missing source layer required in indoor specification: ".concat(e1)); 30185 return o.intersection(o); 30186 }(o.sourceLayers, new Set(Object.keys(e1.layers))), a = o.indoorState, d = function(e1, o, i, n, s) { 30187 const r = {}; 30188 for (const i of o){ 30189 const o = e1.layers[i]; 30190 if (o) for(let e1 = 0; e1 < o.length; e1++){ 30191 const t1 = o.feature(e1); 30192 if (f(t1)) { 30193 const { id: e1, center: o } = u(t1); 30194 l(r, e1, o); 30195 continue; 30196 } 30197 if (g(t1)) { 30198 const e1 = h(t1, s); 30199 c(r, e1.buildings, e1.id, e1); 30200 } 30201 } 30202 else t1.w("indoor source layer not found: ".concat(i)); 30203 } 30204 return { 30205 buildings: r, 30206 activeFloors: t1.aW.calculate(r, n, i) 30207 }; 30208 }(e1, r, a.activeFloors, a.selectedFloorId, n); 30209 return i.notify("setIndoorData", d), s ? d.activeFloors : void 0; 30210 } 30211 function l(e1, t1, o) { 30212 e1[t1] ? o && (e1[t1].center = o) : e1[t1] = { 30213 floorIds: new Set, 30214 center: o || [ 30215 0, 30216 0 30217 ], 30218 floors: {} 30219 }; 30220 } 30221 function c(e1, t1, o, i) { 30222 for (const n of t1)l(e1, n), e1[n].floors[o] = i, e1[n].floorIds.add(o); 30223 } 30224 function u(e1) { 30225 return { 30226 id: e1.properties.id.toString(), 30227 center: [ 30228 e1.properties.center_lon || 0, 30229 e1.properties.center_lat || 0 30230 ] 30231 }; 30232 } 30233 function h(e1, o) { 30234 const i = e1.properties.id.toString(), n = !!e1.properties.is_default && e1.properties.is_default, s = e1.properties.connected_floor_ids ? new Set(e1.properties.connected_floor_ids.toString().split(";")) : new Set, r = e1.properties.conflicted_floor_ids ? new Set(e1.properties.conflicted_floor_ids.toString().split(";")) : new Set, a = e1.properties.structure_ids ? new Set(e1.properties.structure_ids.toString().split(";")) : new Set, l = e1.properties.name.toString(), c = e1.properties.z_index, u = function(e1, o) { 30235 const i = e1.loadGeometry(); 30236 if (!i || 0 === i.length) return; 30237 const n = i.map((i)=>i.map((i)=>t1.fu(i, o, e1.extent))); 30238 return 0 === n.length ? void 0 : { 30239 type: "Polygon", 30240 coordinates: [ 30241 n[0] 30242 ] 30243 }; 30244 }(e1, o); 30245 return { 30246 id: i, 30247 isDefault: n, 30248 connections: s, 30249 conflicts: r, 30250 buildings: a, 30251 name: l, 30252 zIndex: c, 30253 geometry: u 30254 }; 30255 } 30256 function d(e1, t1) { 30257 return t1.every((t1)=>e1.properties && null != e1.properties[t1]); 30258 } 30259 function f(e1) { 30260 return d(e1, [ 30261 "type", 30262 "id", 30263 "name" 30264 ]) && "structure" === e1.properties.type; 30265 } 30266 function g(e1) { 30267 return d(e1, [ 30268 "type", 30269 "id", 30270 "name", 30271 "z_index" 30272 ]) && "floor" === e1.properties.type; 30273 } 30274 function p(e1, o) { 30275 e1 instanceof t1.bA ? t1.fv(e1, o) : e1 instanceof t1.bz ? t1.fw(e1, o) : e1 instanceof t1.fx ? t1.fy(e1) : e1 instanceof t1.bu && t1.fz(e1); 30276 } 30277 function m(e1) { 30278 for(const o in e1){ 30279 const i = e1[o]; 30280 if (i instanceof t1.bz && i.hdExt && i.hdExt.hasDeferredElevationFeatures) return !0; 30281 if (i instanceof t1.bu && i.hdExt && i.hdExt.hasDeferredElevationFeatures) return !0; 30282 } 30283 return !1; 30284 } 30285 class y { 30286 async parse(e1, o, i) { 30287 this.status = "parsing"; 30288 const n = new t1.bP(i.tileID.overscaledZ, i.tileID.wrap, i.tileID.canonical.z, i.tileID.canonical.x, i.tileID.canonical.y), s = [], r = o.familiesBySource[i.source], a = new t1.fA
30288(n, i.promoteId); 30289 a.bucketLayerIDs = [], a.is3DTile = !0; 30290 const l = await t1.fB(e1), c = l.json.extensionsUsed && l.json.extensionsUsed.includes("MAPBOX_mesh_features") || l.json.asset.extras && l.json.asset.extras.MAPBOX_mesh_features, u = l.json.extensionsUsed && l.json.extensionsUsed.includes("EXT_meshopt_compression"), h = new t1.ai(this.zoom, { 30291 brightness: this.brightness, 30292 worldview: this.worldview 30293 }); 30294 for(const e1 in r)for (const o of r[e1]){ 30295 const e1 = o[0]; 30296 a.bucketLayerIDs.push(o.map((e1)=>t1.m(e1.id, e1.scope))), e1.recalculate(h, []); 30297 const r = t1.fC(l, 1 / t1.fD(i.tileID.canonical)), d = new t1.fE(o, r, n, c, u, this.brightness, a, this.worldview); 30298 c || (d.needsUpload = !0), s.push(d), d.evaluate(e1); 30299 } 30300 return this.status = "done", { 30301 buckets: s, 30302 featureIndex: a, 30303 collisionBoxArray: null, 30304 glyphAtlasImage: null, 30305 lineAtlas: null, 30306 imageAtlas: null, 30307 brightness: null 30308 }; 30309 } 30310 constructor(e1, o, i){ 30311 this.tileID = new t1.bP(e1.tileID.overscaledZ, e1.tileID.wrap, e1.tileID.canonical.z, e1.tileID.canonical.x, e1.tileID.canonical.y), this.tileZoom = e1.tileZoom, this.uid = e1.uid, this.zoom = e1.zoom, this.canonical = e1.tileID.canonical, this.pixelRatio = e1.pixelRatio, this.tileSize = e1.tileSize, this.source = e1.source, this.overscaling = this.tileID.overscaleFactor(), this.projection = e1.projection, this.brightness = o, this.worldview = i; 30312 } 30313 } 30314 class x { 30315 async loadTile(e1) { 30316 const o = e1.uid, i = new AbortController, n = this.loading[o] = new y(e1, this.brightness, this.worldview); 30317 n.abort = ()=>i.abort(); 30318 const s = (e1, t1)=>{ 30319 const o = n.reloadCallback; 30320 o && (delete n.reloadCallback, o(e1, t1)); 30321 }; 30322 let r; 30323 try { 30324 r = (await t1.d1(e1.request, i.signal)).data; 30325 } catch (e1) { 30326 if (delete this.loading[o], n.status = "done", this.loaded[o] = n, i.signal.aborted) return null; 30327 throw e1; 30328 } 30329 if (delete this.loading[o], !r || 0 === r.byteLength) return n.status = "done", this.loaded[o] = n, null; 30330 try { 30331 const t1 = await n.parse(r, this.layerIndex, e1); 30332 return this.loaded[o] = n, s(null, t1), t1; 30333 } catch (e1) { 30334 throw this.loaded[o] = n, s(e1), e1; 30335 } 30336 } 30337 async reloadTile(e1) { 30338 const t1 = this.loaded && this.loaded[e1.uid]; 30339 if (t1) return t1.projection = e1.projection, t1.brightness = e1.brightness, "parsing" === t1.status && await new Promise((e1, o)=>{ 30340 t1.reloadCallback = (t1)=>{ 30341 t1 ? o(t1) : e1(); 30342 }; 30343 }), this.loadTile(e1); 30344 } 30345 abortTile(e1) { 30346 const t1 = e1.uid, o = this.loading[t1]; 30347 o && (o.abort && o.abort(), delete this.loading[t1]); 30348 } 30349 removeTile(e1) { 30350 const t1 = this.loaded, o = e1.uid; 30351 t1 && t1[o] && delete t1[o]; 30352 } 30353 constructor({ actor: e1, layerIndex: t1, availableImages: o, availableModels: i, brightness: n, worldview: s }){ 30354 this.actor = e1, this.layerIndex = t1, this.availableImages = o, this.availableModels = i, this.brightness = n, this.loading = {}, this.loaded = {}, this.worldview = s; 30355 } 30356 } 30357 function v(e1) { 30358 if ("number" == typeof e1 || "boolean" == typeof e1 || "string" == typeof e1 || null == e1) return JSON.stringify(e1); 30359 if (Array.isArray(e1)) { 30360 let t1 = "["; 30361 for (const o of e1)t1 += "".concat(v(o), ","); 30362 return "".concat(t1, "]"); 30363 } 30364 let t1 = "{"; 30365 for (const o of Object.keys(e1).sort())t1 += "".concat(o, ":").concat(v(e1[o]), ","); 30366 return "".concat(t1, "}"); 30367 } 30368 function w(e1) { 30369 let o = ""; 30370 for (const i of t1.d2)o += "/".concat(v(e1[i])); 30371 return o; 30372 } 30373 function b(e1, t1) { 30374 return function e1(o) { 30375 return "string" == typeof o && o === t1 || (Array.isArray(o) ? o.some(e1) : !(!o || "object" != typeof o) && Object.values(o).some(e1)); 30376 }(e1); 30377 } 30378 class S { 30379 replace(e1, t1) { 30380 this._layerConfigs = Object.create(null), this._layers = Object.create(null), this.update(e1, [], t1); 30381 } 30382 update(e1, o, i) { 30383 this._options = i; 30384 for (const o of e1)this._layerConfigs[o.id] = o, (this._layers[o.id] = t1.dJ(o, this.scope, null, this._options)).compileFilter(i), this.keyCache[o.id] && delete this.keyCache[o.id]; 30385 for (const e1 of o)delete this.keyCache[e1], delete this._layerConfigs[e1], delete this._layers[e1]; 30386 this.familiesBySource = Object.create(null); 30387 const n = function(e1, t1) { 30388 const o = Object.create(null); 30389 for(let i = 0; i < e1.length; i++){ 30390 const n = e1[i]; 30391 let s = t1 && t1[n.id]; 30392 s || ("symbol" === n.type ? s = n.id : (s = w(n), "line" === n.type && n.paint && (b(n.paint["line-width"], "line-progress") && (s += "/".concat(v(n.paint["line-width"]))), b(n.paint["line-emissive-strength"], "line-progress") && (s += "/".concat(v(n.paint["line-emissive-strength"])))))), t1 && (t1[n.id] = s); 30393 let r = o[s]; 30394 r || (r = o[s] = []), r.push(n); 30395 } 30396 const i = []; 30397 for(const e1 in o)i.push(o[e1]); 30398 return i; 30399 }(Object.values(this._layerConfigs), this.keyCache); 30400 for (const e1 of n){ 30401 const t1 = e1.map((e1)=>this._layers[e1.id]), o = t1[0]; 30402 if ("none" === o.visibility) continue; 30403 const i = o.source || ""; 30404 let n = this.familiesBySource[i]; 30405 n || (n = this.familiesBySource[i] = Object.create(null)); 30406 const s = o.sourceLayer || "_geojsonTileLayer"; 30407 let r = n[s]; 30408 r || (r = n[s] = []), r.push(t1); 30409 } 30410 } 30411 constructor(e1){ 30412 this.keyCache = Object.create(null), this._layers = Object.create(null), this._layerConfigs = Object.create(null), e1 && this.replace(e1); 30413 } 30414 } 30415 class I extends t1.P { 30416 clone() { 30417 return new I(this.x, this.y, this.z, this.angle, this.segment); 30418 } 30419 constructor(e1, t1, o, i, n){ 30420 super(e1, t1), this.angle = i, this.z = o, void 0 !== n && (this.segment = n); 30421 } 30422 } 30423 function P(e1, t1, o, i, n) { 30424 if (void 0 === t1.segment) return !0; 30425 let s = t1, r = t1.segment + 1, a = 0; 30426 for(; a > -o / 2;){ 30427 if (r--, r < 0) return !1; 30428 a -= e1[r].dist(s), s = e1[r]; 30429 } 30430 a += e1[r].dist(e1[r + 1]), r++; 30431 const l = []; 30432 let c = 0; 30433 for(; a < o / 2;){ 30434 const t1 = e1[r], o = e1[r + 1]; 30435 if (!o) return !1; 30436 let s = e1[r - 1].angleTo(t1) - t1.angleTo(o); 30437 for(s = Math.abs((s + 3 * Math.PI) % (2 * Math.PI) - Math.PI), l.push({ 30438 distance: a, 30439 angleDelta: s 30440 }), c += s; a - l[0].distance > i;
vendor: 48,160 bytes, lines 30440-31316
30440)c -= l.shift().angleDelta; 30441 if (c > n) return !1; 30442 r++, a += t1.dist(o); 30443 } 30444 return !0; 30445 } 30446 function M(e1) { 30447 let t1 = 0; 30448 for(let o = 0; o < e1.length - 1; o++)t1 += e1[o].dist(e1[o + 1]); 30449 return t1; 30450 } 30451 function T(e1, t1, o) { 30452 return e1 ? .6 * t1 * o : 0; 30453 } 30454 function z(e1, t1) { 30455 return Math.max(e1 ? e1.right - e1.left : 0, t1 ? t1.right - t1.left : 0); 30456 } 30457 function B(e1, o, i, n, s, r) { 30458 const a = T(i, s, r), l = z(i, n) * r; 30459 let c = 0; 30460 const u = M(e1) / 2; 30461 for(let i = 0; i < e1.length - 1; i++){ 30462 const n = e1[i], s = e1[i + 1], r = n.dist(s); 30463 if (c + r > u) { 30464 const h = (u - c) / r, d = t1.al(n.x, s.x, h), f = t1.al(n.y, s.y, h), g = new I(d, f, 0, s.angleTo(n), i); 30465 return !a || P(e1, g, l, a, o) ? g : void 0; 30466 } 30467 c += r; 30468 } 30469 } 30470 function k(e1, t1, o, i, n, s, r, a, l) { 30471 const c = T(i, s, r), u = z(i, n), h = u * r, d = 0 === e1[0].x || e1[0].x === l || 0 === e1[0].y || e1[0].y === l; 30472 return t1 - h < t1 / 4 && (t1 = h + t1 / 4), C(e1, d ? t1 / 2 * a % t1 : (u / 2 + 2 * s) * r * a % t1, t1, c, o, h, d, !1, l); 30473 } 30474 function C(e1, o, i, n, s, r, a, l, c) { 30475 const u = r / 2, h = M(e1); 30476 let d = 0, f = o - i, g = []; 30477 for(let o = 0; o < e1.length - 1; o++){ 30478 const a = e1[o], l = e1[o + 1], p = a.dist(l), m = l.angleTo(a); 30479 for(; f + i < d + p;){ 30480 f += i; 30481 const y = (f - d) / p, x = t1.al(a.x, l.x, y), v = t1.al(a.y, l.y, y); 30482 if (x >= 0 && x < c && v >= 0 && v < c && f - u >= 0 && f + u <= h) { 30483 const t1 = new I(x, v, 0, m, o); 30484 n && !P(e1, t1, r, n, s) || g.push(t1); 30485 } 30486 } 30487 d += p; 30488 } 30489 return l || g.length || a || (g = C(e1, d / 2, i, n, s, r, a, !0, c)), g; 30490 } 30491 t1.fF(I, "Anchor"); 30492 class D { 30493 static forText(e1, t1) { 30494 const o = new D; 30495 return o.scale = e1 || 1, o.fontStack = t1, o; 30496 } 30497 static forImage(e1) { 30498 const t1 = new D; 30499 return t1.image = e1, t1; 30500 } 30501 constructor(){ 30502 this.scale = 1, this.fontStack = "", this.image = null; 30503 } 30504 } 30505 class L { 30506 static fromFeature(e1, t1, o) { 30507 let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1; 30508 const n = new L; 30509 for(let s = 0; s < e1.sections.length; s++){ 30510 const r = e1.sections[s]; 30511 r.image ? n.addImageSection(r, o, i) : n.addTextSection(r, t1); 30512 } 30513 return n; 30514 } 30515 length() { 30516 return this.text.length; 30517 } 30518 getSection(e1) { 30519 return this.sections[this.sectionIndex[e1]]; 30520 } 30521 getSections() { 30522 return this.sections; 30523 } 30524 getSectionIndex(e1) { 30525 return this.sectionIndex[e1]; 30526 } 30527 getCodePoint(e1) { 30528 return this.text.codePointAt(e1); 30529 } 30530 verticalizePunctuation(e1) { 30531 this.text = t1.fG(this.text, e1); 30532 } 30533 trim() { 30534 let e1 = 0; 30535 for(let t1 = 0; t1 < this.text.length && F[this.text.charCodeAt(t1)]; t1++)e1++; 30536 let t1 = this.text.length; 30537 for(let o = this.text.length - 1; o >= 0 && o >= e1 && F[this.text.charCodeAt(o)]; o--)t1--; 30538 this.text = this.text.substring(e1, t1), this.sectionIndex = this.sectionIndex.slice(e1, t1); 30539 } 30540 substring(e1, t1) { 30541 const o = new L; 30542 return o.text = this.text.substring(e1, t1), o.sectionIndex = this.sectionIndex.slice(e1, t1), o.sections = this.sections, o; 30543 } 30544 toString() { 30545 return this.text; 30546 } 30547 getMaxScale() { 30548 return this.sectionIndex.reduce((e1, t1)=>Math.max(e1, this.sections[t1].scale), 0); 30549 } 30550 addTextSection(e1, t1) { 30551 this.text += e1.text, this.sections.push(D.forText(e1.scale, e1.fontStack || t1)); 30552 const o = this.sections.length - 1; 30553 for(let t1 = 0; t1 < e1.text.length; ++t1)this.sectionIndex.push(o); 30554 } 30555 addImageSection(e1, o) { 30556 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1; 30557 const n = e1.image ? e1.image.getPrimary() : null; 30558 if (!n) return void t1.w("Can't add FormattedSection with an empty image."); 30559 n.scaleSelf(o * i); 30560 const s = this.getNextImageSectionCharCode(); 30561 s ? (this.text += String.fromCodePoint(s), this.sections.push(D.forImage(n)), this.sectionIndex.push(this.sections.length - 1)) : t1.w("Reached maximum number of images 6401"); 30562 } 30563 getNextImageSectionCharCode() { 30564 return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID); 30565 } 30566 constructor(){ 30567 this.text = "", this.sectionIndex = [], this.sections = [], this.imageSectionID = null; 30568 } 30569 } 30570 function A(e1, o, i, n, s, r, a, l, c, u, h, d, f, g, p) { 30571 let m = arguments.length > 15 && arguments[15] !== void 0 ? arguments[15] : 1, y = arguments.length > 16 && arguments[16] !== void 0 ? arguments[16] : 1; 30572 const x = L.fromFeature(e1, s, m, y); 30573 d === t1.da.vertical && x.verticalizePunctuation(f); 30574 let v = []; 30575 const w = function(e1, o, i, n, s, r, a) { 30576 if (!e1) return []; 30577 const l = [], c = function(e1, t1, o, i, n, s, r) { 30578 let a = 0; 30579 for(let o = 0; o < e1.length(); o++){ 30580 const l = e1.getSection(o); 30581 a += E(e1.getCodePoint(o), l, i, n, t1, s, r); 30582 } 30583 return a / Math.max(1, Math.ceil(a / o)); 30584 }(e1, o, i, n, s, r, a), u = e1.text.includes("â"); 30585 let h = 0; 30586 for(let i = 0; i < e1.length(); i++){ 30587 const d = e1.getSection(i), f = e1.getCodePoint(i); 30588 if (F[f] || (h += E(f, d, n, s, o, r, a)), i < e1.length() - 1) { 30589 const o = t1.fI(f); 30590 (_[f] || o || d.image) && l.push(j(i + 1, h, c, l, R(f, e1.getCodePoint(i + 1), o && u), !1)); 30591 } 30592 } 30593 return V(j(e1.length(), h, c, l, 0, !0)); 30594 }(x, u, r, o, n, g, y), { processBidirectionalText: b, processStyledBidirectionalText: S } = t1.fH; 30595 if (b && 1 === x.sections.length) { 30596 const e1 = b(x.toString(), w); 30597 for (const t1 of e1){ 30598 const e1 = new L; 30599 e1.text = t1, e1.sections = x.sections; 30600 for(let o = 0; o < t1.length; o++)e1.sectionIndex.push(0); 30601 v.push(e1); 30602 } 30603 } else if (S) { 30604 const e1 = S(x.text, x.sectionIndex, w); 30605 for (const t1 of e1){ 30606 const e1 = new L; 30607 e1.text = t1[0], e1.sectionIndex = t1[1], e1.sections = x.sections, v.push(e1); 30608 } 30609 } else v = function(e1, t1) { 30610 const o = [], i = e1.text; 30611 let n = 0; 30612 for (const i of t1)o.push(e1.substring(n, i)), n = i; 30613 return n < i.length && o.push(e1.substring(n, i.length)), o; 30614 }(x, w); 30615 const I = [], P = { 30616 positionedLines: I, 30617 text: x.toString(), 30618 top: h[1], 30619 bottom: h[1], 30620 left: h[0], 30621 right: h[0], 30622 writingMode: d, 30623 iconsInText: !1, 30624 verticalizable: !1, 30625 hasBaseline: !1 30626 }; 30627 if (function(e1, o, i, n, s, r, a, l, c, u, h, d, f) { 30628 let g = 0, p = 0, m = 0; 30629 const y = "right" === l ? 1 : "left" === l ? 0 : .5; 30630 let x = !1; 30631 for (const e1 of s){ 30632 const t1 = e1.getSections(); 30633 for (const e1 of t1){ 30634 if (e1.image) continue; 30635 const t1 = o[e1.fontStack]; 30636 if (t1 && (x = void 0 !== t1.ascender && void 0 !== t1.descender, !x)) break; 30637 } 30638 if (!x) break; 30639 } 30640 let v = 0; 30641 for (const a of s){ 30642 a.trim(); 30643 const s = a.getMaxScale(), l = (s - 1) * t1.ds, w = { 30644 positionedGlyphs: [], 30645 lineOffset: 0 30646 }; 30647 e1.positionedLines[v] = w; 30648 const b = w.positionedGlyphs; 30649 let S = 0; 30650 if (!a.length()) { 30651 p += r, ++v; 30652 continue; 30653 } 30654 let I = 0, P = 0; 30655 for(let r = 0; r < a.length(); r++){ 30656 const l = a.getSection(r), m = a.getSectionIndex(r), y = a.getCodePoint(r); 30657 let v = l.scale, w = null, M = null, T = null, z = t1.ds, B = 0, k = c; 30658 k === t1.da.vertical && t1.fL(y) && (k = t1.da.horizontal); 30659 const C = !(k === t1.da.horizontal || !h && !t1.fJ(y) || h && (F[y] || t1.fK(y))); 30660 if (l.image) { 30661 const o = n.get(l.image.toString()); 30662 if (!o) continue; 30663 T = l.image, e1.iconsInText = !0, M = o.paddedRect; 30664 const i = o.displaySize, r = i[0] * f, a = i[1] * f; 30665 v = v * t1.ds / d, w = { 30666 width: r, 30667 height: a, 30668 left: 0, 30669 top: -t1.fM, 30670 advance: C ? a : r, 30671 localGlyph: !1 30672 }, B = x ? -w.height * v : s * t1.ds - 17 - a * v, z = w.advance; 30673 const c = (C ? r : a) * v - t1.ds * s; 30674 c > 0 && c > S && (S = c); 30675 } else { 30676 const e1 = i[l.fontStack]; 30677 if (!e1) continue; 30678 e1[y] && (M = e1[y]); 30679 const n = o[l.fontStack]; 30680 if (!n) continue; 30681 const r = n.glyphs[y]; 30682 if (!r) continue; 30683 if (w = r.metrics, z = 8203 !== y ? t1.ds : 0, x) { 30684 const e1 = void 0 !== n.ascender ? Math.abs(n.ascender) : 0, t1 = void 0 !== n.descender ? Math.abs(n.descender) : 0, o = (e1 + t1) * v; 30685 I < o && (I = o, P = (e1 - t1) / 2 * v), B = -e1 * v; 30686 } else B = (s - v) * t1.ds - 17; 30687 } 30688 b.push({ 30689 glyph: y, 30690 image: T, 30691 x: g, 30692 y: p + B, 30693 vertical: C, 30694 scale: v, 30695 localGlyph: w.localGlyph, 30696 fontStack: l.fontStack, 30697 sectionIndex: m, 30698 metrics: w, 30699 rect: M 30700 }), C ? (e1.verticalizable = !0, g += z * v + u) : g += w.advance * v + u; 30701 } 30702 0 !== b.length && (m = Math.max(g - u, m), x ? Z(b, y, S, P, r * s / 2) : Z(b, y, S, 0, r / 2)), g = 0; 30703 const M = r * s + S; 30704 w.lineOffset = Math.max(S, l), p += M, ++v; 30705 } 30706 const w = p, { horizontalAlign: b, verticalAlign: S } = t1.db(a); 30707 (function(e1, t1, o, i, n, s) { 30708 const r = (t1 - o) * n, a = -s * i; 30709 for (const t1 of e1)for (const e1 of t1.positionedGlyphs)e1.x += r, e1.y += a; 30710 })(e1.positionedLines, y, b, S, m, w), e1.top += -S * w, e1.bottom = e1.top + w, e1.left += -b * m, e1.right = e1.left + m, e1.hasBaseline = x; 30711 }(P, o, i, n, v, a, l, c, d, u, f, p, y), !function(e1) { 30712 for (const t1 of e1)if (0 !== t1.positionedGlyphs.length) return !1; 30713 return !0; 30714 }(I)) return P; 30715 } 30716 const F = { 30717 9: !0, 30718 10: !0, 30719 11: !0, 30720 12: !0, 30721 13: !0, 30722 32: !0 30723 }, _ = { 30724 10: !0, 30725 32: !0, 30726 38: !0, 30727 40: !0, 30728 41: !0, 30729 43: !0, 30730 45: !0, 30731 47: !0, 30732 173: !0, 30733 183: !0, 30734 8203: !0, 30735 8208: !0, 30736 8211: !0, 30737 8231: !0 30738 }; 30739 function E(e1, o, i, n, s, r, a) { 30740 if (o.image) { 30741 const e1 = n.get(o.image.toString()); 30742 return e1 ? e1.displaySize[0] * a * o.scale * t1.ds / r + s : 0; 30743 } 30744 { 30745 const t1 = i[o.fontStack], n = t1 && t1.glyphs[e1]; 30746 return n ? n.metrics.advance * o.scale + s : 0; 30747 } 30748 } 30749 function O(e1, t1, o, i) { 30750 const n = Math.pow(e1 - t1, 2); 30751 return i ? e1 < t1 ? n / 2 : 2 * n : n + Math.abs(o) * o; 30752 } 30753 function R(e1, t1, o) { 30754 let i = 0; 30755 return 10 === e1 && (i -= 1e4), o && (i += 150), 40 !== e1 && 65288 !== e1 || (i += 50), 41 !== t1 && 65289 !== t1 || (i += 50), i; 30756 } 30757 function j(e1, t1, o, i, n, s) { 30758 let r = null, a = O(t1, o, n, s); 30759 for (const e1 of i){ 30760 const i = O(t1 - e1.x, o, n, s) + e1.badness; 30761 i <= a && (r = e1, a = i); 30762 } 30763 return { 30764 index: e1, 30765 x: t1, 30766 priorBreak: r, 30767 badness: a 30768 }; 30769 } 30770 function V(e1) { 30771 return e1 ? V(e1.priorBreak).concat(e1.index) : []; 30772 } 30773 function Z(e1, t1, o, i, n) { 30774 if (!(t1 || o || i || n)) return; 30775 const s = e1.length - 1, r = e1[s], a = (r.x + r.metrics.advance * r.scale) * t1; 30776 for(let t1 = 0; t1 <= s; t1++)e1[t1].x -= a, e1[t1].y += o + i + n; 30777 } 30778 function N(e1) { 30779 let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1, i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 30780 let n = 1 / 0, s = 1 / 0, r = -1 / 0, a = -1 / 0; 30781 const l = e1[0]; 30782 for(let e1 = 0; e1 < l.length; e1++){ 30783 const t1 = l[e1]; 30784 (!e1 || t1.x < n) && (n = t1.x), (!e1 || t1.y < s) && (s = t1.y), (!e1 || t1.x > r) && (r = t1.x), (!e1 || t1.y > a) && (a = t1.y); 30785 } 30786 const c = Math.min(r - n, a - s); 30787 let u = c / 2; 30788 const h = new t1.fN([], U); 30789 if (0 === c) return new t1.P(n, s); 30790 for(let t1 = n; t1 < r; t1 += c)for(let o = s; o < a; o += c)h.push(new $(t1 + u, o + u, u, e1)); 30791 let d = function(e1) { 30792 let t1 = 0, o = 0, i = 0; 30793 const n = e1[0]; 30794 for(let e1 = 0, s = n.length, r = s - 1; e1 < s; r = e1++){ 30795 const s = n[e1], a = n[r], l = s.x * a.y - a.x * s.y; 30796 o += (s.x + a.x) * l, i += (s.y + a.y) * l, t1 += 3 * l; 30797 } 30798 return new $(o / t1, i / t1, 0, e1); 30799 }(e1), f = h.length; 30800 for(; h.length;){ 30801 const t1 = h.pop(); 30802 (t1.d > d.d || !d.d) && (d = t1, i && console.log("found best %d after %d probes", Math.round(1e4 * t1.d) / 1e4, f)), t1.max - d.d <= o || (u = t1.h / 2, h.push(new $(t1.p.x - u, t1.p.y - u, u, e1)), h.push(new $(t1.p.x + u, t1.p.y - u, u, e1)), h.push(new $(t1.p.x - u, t1.p.y + u, u, e1)), h.push(new $(t1.p.x + u, t1.p.y + u, u, e1)), f += 4); 30803 } 30804 return i && (console.log("num probes: ".concat(f)), console.log("best distance: ".concat(d.d))), d.p; 30805 } 30806 function U(e1, t1) { 30807 return t1.max - e1.max; 30808 } 30809 class $ { 30810 constructor(e1, o, i, n){ 30811 this.p = new t1.P(e1, o), this.h = i, this.d = function(e1, o) { 30812 let i = !1, n = 1 / 0; 30813 for(let s = 0; s < o.length; s++){ 30814 const r = o[s]; 30815 for(let o = 0, s = r.length, a = s - 1; o < s; a = o++){ 30816 const s = r[o], l = r[a]; 30817 s.y > e1.y != l.y > e1.y && e1.x < (l.x - s.x) * (e1.y - s.y) / (l.y - s.y) + s.x && (i = !i), n = Math.min(n, t1.fO(e1, s, l)); 30818 } 30819 } 30820 return (i ? 1 : -1) * Math.sqrt(n); 30821 }(this.p, n), this.max = this.d + this.h * Math.SQRT2; 30822 } 30823 } 30824 const G = Object.keys; 30825 function H(e1) { 30826 return void 0 !== e1.imagePrimary && void 0 !== e1.top && void 0 !== e1.bottom && void 0 !== e1.left && void 0 !== e1.right; 30827 } 30828 function Y(e1) { 30829 return !e1.imagePrimary.stretchX; 30830 } 30831 function X(e1) { 30832 return !e1.imagePrimary.stretchY; 30833 } 30834 function J(e1) { 30835 return { 30836 width: e1.right - e1.left, 30837 height: e1.bottom - e1.top 30838 }; 30839 } 30840 const q = Number.POSITIVE_INFINITY; 30841 function W(e1, o, i, n, s, r) { 30842 const a = H(e1) && e1.collisionPadding ? e1.collisionPadding : [ 30843 0, 30844 0, 30845 0, 30846 0 30847 ], l = { 30848 top: e1.top - a[1], 30849 bottom: e1.bottom + a[3], 30850 left: e1.left - a[0], 30851 right: e1.right + a[2], 30852 scaled: !1 30853 }; 30854 return void 0 !== n && function(e1, t1) { 30855 e1.top *= t1, e1.bottom *= t1, e1.left *= t1, e1.right *= t1, e1.scaled = !0; 30856 }(l, n), r && (l.left += r[0], l.right += r[0], l.top += r[1], l.bottom += r[1]), i && function(e1, o, i) { 30857 if (!o) return; 30858 const n = t1.au(o), s = new t1.P(i ? i[0] : 0, i ? i[1] : 0), r = new t1.P(e1.left, e1.top), a = new t1.P(e1.right, e1.top), l = new t1.P(e1.left, e1.bottom), c = new t1.P(e1.right, e1.bottom); 30859 r._rotateAround(n, s), a._rotateAround(n, s), l._rotateAround(n, s), c._rotateAround(n, s), e1.left = Math.min(r.x, a.x, l.x, c.x), e1.right = Math.max(r.x, a.x, l.x, c.x), e1.top = Math.min(r.y, a.y, l.y, c.y), e1.bottom = Math.max(r.y, a.y, l.y, c.y); 30860 }(l, i, s), o ? { 30861 top: Math.min(o.top, l.top), 30862 bottom: Math.max(o.bottom, l.bottom), 30863 left: Math.min(o.left, l.left), 30864 right: Math.max(o.right, l.right), 30865 scaled: o.scaled || l.scaled 30866 } : l; 30867 } 30868 function Q(e1, o, i, n, s, r, a) { 30869 let l = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : 1, c = arguments.length > 8 ? arguments[8] : void 0, u = arguments.length > 9 ? arguments[9] : void 0, h = arguments.length > 10 ? arguments[10] : void 0, d = arguments.length > 11 ? arguments[11] : void 0, f = arguments.length > 12 ? arguments[12] : void 0, g = arguments.length > 13 ? arguments[13] : void 0, p = arguments.length > 14 ? arguments[14] : void 0, m = arguments.length > 15 ? arguments[15] : void 0, y = arguments.length > 16 ? arguments[16] : void 0; 30870 e1.createArrays(), e1.tilePixelRatio = t1.a6 / (512 * e1.overscaling), e1.compareText = {}, e1.iconsNeedLinear = !1; 30871 const x = e1.layers[0].layout, v = e1.layers[0]._unevaluatedLayout._values, w = {}; 30872 w.scaleFactor = l, w.textSizeScaleRange = x.get("text-size-scale-range"), w.iconSizeScaleRange = x.get("icon-size-scale-range"); 30873 const [b, S] = w.textSizeScaleRange, [I, P] = w.iconSizeScaleRange; 30874 w.textScaleFactor = t1.b0(w.scaleFactor, b, S), w.iconScaleFactor = t1.b0(w.scaleFactor, I, P); 30875 const M = v["text-size"], T = v["icon-size"]; 30876 if ("composite" === e1.textSizeData.kind) { 30877 const { minZoom: o, maxZoom: i } = e1.textSizeData; 30878 w.compositeTextSizes = [ 30879 M.possiblyEvaluate(new t1.ai(o, { 30880 worldview: h 30881 }), r), 30882 M.possiblyEvaluate(new t1.ai(i, { 30883 worldview: h 30884 }), r) 30885 ]; 30886 } 30887 if ("composite" === e1.iconSizeData.kind) { 30888 const { minZoom: o, maxZoom: i } = e1.iconSizeData; 30889 w.compositeIconSizes = [ 30890 T.possiblyEvaluate(new t1.ai(o, { 30891 worldview: h 30892 }), r, d), 30893 T.possiblyEvaluate(new t1.ai(i, { 30894 worldview: h 30895 }), r, d) 30896 ]; 30897 } 30898 w.layoutTextSize = M.possiblyEvaluate(new t1.ai(a + 1, { 30899 worldview: h 30900 }), r), w.layoutIconSize = T.possiblyEvaluate(new t1.ai(a + 1, { 30901 worldview: h 30902 }), r, d), w.textMaxSize = M.possiblyEvaluate(new t1.ai(18, { 30903 worldview: h 30904 }), r); 30905 const z = x.get("symbol-placement"), B = "map" === x.get("text-rotation-alignment") && "point" !== z, k = x.get("text-size"); 30906 let C = !1; 30907 const D = [], L = null != f && 0 !== f; 30908 for (const a of e1.features){ 30909 if (L && a.properties && m && m(a.properties, f)) continue; 30910 let l = 65535; 30911 if (e1.hdExt && a.properties && Object.hasOwn(a.properties, t1.fP)) { 30912 const o = +a.properties[t1.fP]; 30913 if (!Number.isNaN(o)) { 30914 const t1 = e1.hdExt.resolveRoadElevation(a, o); 30915 if ("defer" === t1) continue; 30916 l = t1; 30917 } 30918 } 30919 const g = x.get("text-font").evaluate(a, {}, r).join(","), p = k.evaluate(a, {}, r) * w.textScaleFactor, y = w.layoutTextSize.evaluate(a, {}, r) * w.textScaleFactor, b = w.layoutIconSize.evaluate(a, {}, r, d) * w.iconScaleFactor, S = { 30920 horizontal: {}, 30921 vertical: void 0 30922 }, I = a.text; 30923 let P, M = [ 30924 0, 30925 0 30926 ]; 30927 if (I) { 30928 const n = I.toString(), l = x.get("text-letter-spacing").evaluate(a, {}, r) * t1.ds, u = x.get("text-line-height").evaluate(a, {}, r) * t1.ds, h = t1.fQ(n) ? l : 0, d = x.get("text-anchor").evaluate(a, {}, r), f = x.get("text-variable-anchor"); 30929 if (!f) { 30930 const e1 = x.get("text-radial-offset").evaluate(a, {}, r); 30931 if (e1) M = t1.dc(d, [ 30932 e1 * t1.ds, 30933 q 30934 ]); 30935 else { 30936 const e1 = x.get("text-offset").evaluate(a, {}, r); 30937 M = [ 30938 e1[0] * t1.ds, 30939 e1[1] * t1.ds 30940 ]; 30941 } 30942 } 30943 let m = B ? "center" : x.get("text-justify").evaluate(a, {}, r); 30944 const v = "point" === z, b = v ? x.get("text-max-width").evaluate(a, {}, r) * t1.ds : 1 / 0, P = (r)=>{ 30945 e1.allowVerticalPlacement && t1.fR(n) && (S.vertical = A(I, o, i, s, g, b, u, d, r, h, M, t1.da.vertical, !0, y, p, c, w.textScaleFactor)); 30946 }; 30947 if (!B && f) { 30948 const e1 = "auto" === m ? f.map((e1)=>t1.dd(e1)) : [ 30949 m 30950 ]; 30951 let n = !1; 30952 for(let r = 0; r < e1.length; r++){ 30953 const a = e1[r]; 30954 if (!S.horizontal[a]) if (n) S.horizontal[a] = S.horizontal[0]; 30955 else { 30956 const e1 = A(I, o, i, s, g, b, u, "center", a, h, M, t1.da.horizontal, !1, y, p, c, w.textScaleFactor); 30957 e1 && (S.horizontal[a] = e1, n = 1 === e1.positionedLines.length); 30958 } 30959 } 30960 P("left"); 30961 } else { 30962 if ("auto" === m && (m = t1.dd(d)), v || x.get("text-writing-mode").includes("horizontal") || !t1.fR(n)) { 30963 const e1 = A(I, o, i, s, g, b, u, d, m, h, M, t1.da.horizontal, !1, y, p, c, w.textScaleFactor); 30964 e1 && (S.horizontal[m] = e1); 30965 } 30966 P(v ? "left" : m); 30967 } 30968 } 30969 let T, F, _, E, O, R, j = !1; 30970 const V = x.get("icon-text-fit").evaluate(a, {}, r); 30971 if (a.icon && a.icon.hasPrimary()) { 30972 const o = t1.fS(a.icon, e1.iconSizeData, v["icon-size"], r, e1.zoom, a, c, w.iconScaleFactor, h, d); 30973 T = o.iconPrimary, _ = o.iconSecondary; 30974 const i = T.toString(); 30975 if (F = n.get(i), F && (O = x.get("icon-offset").evaluate(a, {}, r), R = x.get("icon-anchor").evaluate(a, {}, r), P = t1.fT(s.get(i), _ ? s.get(_.toString()) : void 0, O, R), j = F.sdf, void 0 === e1.sdfIcons ? e1.sdfIcons = F.sdf : e1.sdfIcons !== F.sdf && t1.w("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"), (F.pixelRatio !== e1.pixelRatio || 0 !== x.get("icon-rotate").constantOr(1)) && (e1.iconsNeedLinear = !0)), _) { 30976 const e1 = _.toString(); 30977 E = n.get(e1); 30978 } 30979 } 30980 C = C || !(!a.icon || !a.icon.hasSecondary()); 30981 const Z = de(S.horizontal) || S.vertical; 30982 e1.iconsInText || (e1.iconsInText = !!Z && Z.iconsInText); 30983 const N = t1.fU(y, w.textScaleFactor), { defaultShapedIcon: U, verticallyShapedIcon: $ } = ce(e1, P, x, a, r, S, N, O, V); 30984 "none" !== V && P && (Y(P) || X(P)) && (ie(F, T, P, U, V, u, n, s), ie(E, _, P, U, V, u, n, s), $ && (ie(F, T, P, $, V, u, n, s), ie(E, _, P, $, V, u, n, s))), P = U; 30985 const { iconBBox: G, iconVerticalBBox: H, textBBox: J, textVerticalBBox: W } = K(e1, P, $, x, a, r, b, O, w, s, R, S, y, M, d); 30986 D.push({ 30987 feature: a, 30988 shapedTextOrientations: S, 30989 shapedText: Z, 30990 shapedIcon: P, 30991 iconPrimary: T, 30992 iconSecondary: _, 30993 iconOffset: O, 30994 iconAnchor: R, 30995 verticallyShapedIcon: $, 30996 layoutTextSize: y, 30997 layoutIconSize: b, 30998 textOffset: M, 30999 isSDFIcon: j, 31000 iconTextFit: V, 31001 iconCollisionBounds: G, 31002 iconVerticalCollisionBounds: H, 31003 textCollisionBounds: J, 31004 textVerticalCollisionBounds: W, 31005 elevationFeatureIndex: l 31006 }); 31007 } 31008 return e1.hdExt && e1.hdExt.clearWorkerState(), { 31009 featureData: D, 31010 sizes: w, 31011 hasAnySecondaryIcon: C, 31012 textAlongLine: B, 31013 symbolPlacement: z, 31014 coverageFrcMask: f, 31015 coveragePolygons: g, 31016 coverageTileZoom: p, 31017 isFeatureCoveredByFrcMask: m, 31018 symbolAnchorInFrcCoverage: y 31019 }; 31020 } 31021 function K(e1, o, i, n, s, r, a, l, c, u, h, d, f, g, p) { 31022 const m = e1.layers[0], y = m.appearances; 31023 if (0 === y.length) return { 31024 iconBBox: null, 31025 iconVerticalBBox: null, 31026 textBBox: null, 31027 textVerticalBBox: null 31028 }; 31029 const x = { 31030 iconBBox: null, 31031 iconVerticalBBox: null 31032 }, v = { 31033 textBBox: null, 31034 textVerticalBBox: null 31035 }, { baseIconRotate: w, baseTextRotate: b, iconScaleFactor: S } = function(e1, o, i) { 31036 const n = e1.get("icon-rotate").evaluate(o, {}, i), s = e1.get("text-rotate").evaluate(o, {}, i), [r, a] = e1.get("icon-size-scale-range"); 31037 return { 31038 baseIconRotate: n, 31039 baseTextRotate: s, 31040 iconScaleFactor: t1.b0(1, r, a) 31041 }; 31042 }(n, s, r); 31043 o && (x.iconBBox = W(o, x.iconBBox, w), i) && (x.iconVerticalBBox = W(i, x.iconVerticalBBox, w + 90)); 31044 const I = de(d.horizontal); 31045 I && (v.textBBox = W(I, v.textBBox, b, 1, g)), d.vertical && (v.textVerticalBBox = W(d.vertical, v.textVerticalBBox, b + 90, 1, g)); 31046 for (const t1 of y)t1.hasIconLayoutProperties() && ee(x, e1, m, t1, s, r, l, w, a, c, o, u, S, h, p), t1.hasTextLayoutProperties() && oe(v, m, t1, s, r, g, b, f, I, d.vertical); 31047 return { 31048 iconBBox: x.iconBBox, 31049 iconVerticalBBox: x.iconVerticalBBox, 31050 textBBox: v.textBBox, 31051 textVerticalBBox: v.textVerticalBBox 31052 }; 31053 } 31054 function ee(e1, o, i, n, s, r, a, l, c, u, h, d, f, g, p) { 31055 const { appearanceIconOffset: m, appearanceIconRotate: y, appearanceIconSize: x } = t1.fY(n, i, s, r, a, l, c, u.iconScaleFactor); 31056 let v = null, w = null, b = null; 31057 n.hasLayoutProperty("icon-image") ? b = te(o, i, n, s, r, d, f, p) : h && (b = h.imagePrimary), b && (v = t1.fT(b, null, m, g), o.allowVerticalPlacement && (w = v)); 31058 const S = c > 0 ? x / c : 1; 31059 v && (e1.iconBBox = W(v, e1.iconBBox, y, 1 !== S ? S : void 0)), w && (e1.iconVerticalBBox = W(w, e1.iconVerticalBBox, y + 90, 1 !== S ? S : void 0)); 31060 } 31061 function te(e1, o, i, n, s, r, a, l) { 31062 let c = null; 31063 const u = o.getAppearanceValueAndResolveTokens(i, "icon-image", n, s, l); 31064 if (u) { 31065 const h = e1.getResolvedImageFromTokens(u), d = i.hasLayoutProperty("icon-size") ? i.getUnevaluatedLayoutProperty("icon-size") : o._unevaluatedLayout._values["icon-size"], f = t1.f$(e1.zoom, d, e1.worldview, l), g = t1.fS(h, f, d, s, e1.zoom, n, e1.pixelRatio, a, e1.worldview, l); 31066 c = r.get(g.iconPrimary.toString()); 31067 } 31068 return c; 31069 } 31070 function oe(e1, o, i, n, s, r, a, l, c, u) { 31071 const { appearanceTextOffset: h, appearanceTextRotate: d, appearanceTextSize: f } = t1.fZ(i, o, n, s, r, a, l), g = f / l, p = [ 31072 (h[0] - r[0]) * g, 31073 (h[1] - r[1]) * g 31074 ], m = 0 !== p[0] || 0 !== p[1]; 31075 c && (e1.textBBox = W(c, e1.textBBox, d, g, h, m ? p : void 0)), u && (e1.textVerticalBBox = W(u, e1.textVerticalBBox, d + 90, g, h, m ? p : void 0)); 31076 } 31077 function ie(e1, o, i, n, s, r, a, l) { 31078 if (!e1 || !e1.usvg) return; 31079 const c = J(i), u = J(n), h = "both" !== s && "width" !== s || !Y(i) ? 1 : u.width / c.width, d = "both" !== s && "height" !== s || !X(i) ? 1 : u.height / c.height; 31080 o.scaleSelf(h, d); 31081 const f = o.toString(); 31082 r.set(f, o), a.set(f, e1); 31083 const { imagePosition: g } = t1.fW(f, e1, t1.fX); 31084 l.set(f, g); 31085 } 31086 function ne(e1, o, i) { 31087 if (!o) return; 31088 const n = i.get(e1.toString()), s = i.get(o.toString()); 31089 n && s && (n.paddedRect.w === s.paddedRect.w && n.paddedRect.h === s.paddedRect.h || t1.w("Mismatch in icon variant sizes: ".concat(e1.toString(), " and ").concat(o.toString())), n.usvg !== s.usvg && t1.w("Mismatch in icon variant image types: ".concat(e1.id, " and ").concat(o.id))); 31090 } 31091 function se(e1, t1, o, i, n, s, r, a, l, c) { 31092 e1.iconAtlasPositions = c.iconPositions; 31093 const { featureData: u, sizes: h, textAlongLine: d, symbolPlacement: f, coveragePolygons: g, coverageTileZoom: p, symbolAnchorInFrcCoverage: m } = t1, y = t1.hasAnySecondaryIcon || e1.hasAnySecondaryIcon; 31094 for (const t1 of u){ 31095 const { shapedIcon: o, verticallyShapedIcon: s, feature: u, shapedTextOrientations: x, shapedText: v, layoutTextSize: w, textOffset: b, isSDFIcon: S, iconPrimary: I, iconSecondary: P, iconTextFit: M, iconOffset: T, iconCollisionBounds: z, iconVerticalCollisionBounds: B, textCollisionBounds: k, elevationFeatureIndex: C } = t1; 31096 re(o, c.iconPositions, I, P), re(s, c.iconPositions, I, P), ae(x, c.iconPositions), ne(I, P, c.iconPositions), (v || o) && ue(e1, u, x, o, s, l, h, w, 0, b, S, i, n, r, a, y, M, T, d, f, z, B, k, 0, 0, g, p, m, C); 31097 } 31098 o && e1.generateCollisionDebugBuffers(s, e1.collisionBoxArray, h.textScaleFactor), e1.text.uboBinder && e1.text.uboBinder.finalize(), e1.icon.uboBinder && e1.icon.uboBinder.finalize(); 31099 } 31100 function re(e1, t1, o, i) { 31101 if (!e1) return; 31102 const n = t1.get(o.toString()); 31103 if (n && (e1.imagePrimary = n), i) { 31104 const o = t1.get(i.toString()); 31105 e1.imageSecondary = o; 31106 } 31107 } 31108 function ae(e1, t1) { 31109 for(const o in e1.horizontal)le(e1.horizontal[o], t1); 31110 le(e1.vertical, t1); 31111 } 31112 function le(e1, t1) { 31113 if (e1) { 31114 for (const o of e1.positionedLines)for (const e1 of o.positionedGlyphs)if (null !== e1.image) { 31115 const o = e1.image.toString(); 31116 e1.rect = t1.get(o).paddedRect; 31117 } 31118 } 31119 } 31120 function ce(e1, o, i, n, s, r, a, l, c) { 31121 const u = de(r.horizontal) || r.vertical, h = i.get("icon-text-fit-padding").evaluate(n, {}, s); 31122 let d, f = o; 31123 return o && "none" !== c && (e1.allowVerticalPlacement && r.vertical && (d = t1.fV(o, r.vertical, c, h, l, a)), u && (f = t1.fV(o, u, c, h, l, a))), { 31124 defaultShapedIcon: f, 31125 verticallyShapedIcon: d 31126 }; 31127 } 31128 function ue(e1, o, i, n, s, r, a, l, c, u, h, d, f, g, p, m, y, x, v, w, b, S, P, M, T, z, C, D) { 31129 let L = arguments.length > 28 && arguments[28] !== void 0 ? arguments[28] : 65535; 31130 let A = a.textMaxSize.evaluate(o, {}, f); 31131 void 0 === A ? A = l * a.textScaleFactor : A *= a.textScaleFactor; 31132 const F = e1.layers[0].layout, _ = t1.ds, E = t1.fU(l, a.textScaleFactor), O = de(i.horizontal) || i.vertical, R = e1.hasAnyAppearanceLayoutProperty([ 31133 "text-size", 31134 "text-offset", 31135 "text-rotate" 31136 ]), j = e1.getAppearanceFeatureData(o.index); 31137 ("none" !== y || R) && j && (j.textShaping = O, j.iconTextFitPadding = F.get("icon-text-fit-padding").evaluate(o, {}, f), j.fontScale = E, j.textScaleFactor = a.textScaleFactor); 31138 const V = "globe" === g.name, Z = e1.tilePixelRatio * A / _, U = (W = e1.overscaling, e1.zoom > 18 && W > 2 && (W >>= 1), Math.max(t1.a6 / (512 * W), 1) * F.get("symbol-spacing")), $ = F.get("text-padding") * e1.tilePixelRatio, H = F.get("icon-padding") * e1.tilePixelRatio, Y = t1.au(F.get("text-max-angle")), X = "map" === F.get("icon-rotation-alignment") && "point" !== w, J = U / 2; 31139 var W; 31140 !1 === e1.hasAnyIconTextFit && "none" !== y && (e1.hasAnyIconTextFit = !0); 31141 const Q = (l, c, w)=>{ 31142 if (c.x < 0 || c.x >= t1.a6 || c.y < 0 || c.y >= t1.a6) return; 31143 if (z && z.length > 0 && o.properties && D && D(z, o.properties, c, f, C)) return; 31144 let M = null; 31145 if (V) { 31146 const { x: e1, y: t1, z: o } = g.projectTilePoint(c.x, c.y, w); 31147 M = { 31148 anchor: new I(e1, t1, o, 0, void 0), 31149 up: g.upVector(w, c.x, c.y) 31150 }; 31151 } 31152 !function(e1, o, i, n, s, r, a, l, c, u, h, d, f, g, p, m, y, x, v, w, b, S, I, P, M, T, z, B, k, C, D, L) { 31153 const A = e1.addToLineVertexArray(o, n); 31154 let F, _, E, O, R, j, V, Z = 0, N = 0, U = 0, $ = 0, H = -1, Y = -1; 31155 const X = {}; 31156 let J = t1.dD(""); 31157 const W = i ? i.anchor : o, Q = "none" !== B; 31158 let K = 0, ee = 0; 31159 if (void 0 === c._unevaluatedLayout.getValue("text-radial-offset")) { 31160 const e1 = c.layout.get("text-offset").evaluate(b, {}, M); 31161 K = e1[0] * t1.ds, ee = e1[1] * t1.ds; 31162 } else K = c.layout.get("text-radial-offset").evaluate(b, {}, M) * t1.ds, ee = q; 31163 if (e1.allowVerticalPlacement && s.vertical) { 31164 const e1 = s.vertical; 31165 if (p) j = ge(e1), l && (V = ge(l)); 31166 else { 31167 const t1 = c.layout.get("text-rotate").evaluate(b, {}, M) + 90; 31168 E = fe(u, W, o, h, d, f, e1, g, t1, m, L), l && (O = fe(u, W, o, h, d, f, l, x, t1, null, D)); 31169 } 31170 } 31171 if (r) { 31172 const n = c.layout.get("icon-rotate").evaluate(b, {}, M), s = t1.g0(r, n, I, Q, S.iconScaleFactor), a = l ? t1.g0(l, n, I, Q, S.iconScaleFactor) : void 0; 31173 _ = fe(u, W, o, h, d, f, r, x, n, null, C); 31174 const g = function(e1, o, i, n, s, r, a, l, c) { 31175 const u = e1.layers[0], h = u.appearances; 31176 let d = o.length; 31177 if (i && (d = Math.max(d, i.length)), 0 === h.length) return d; 31178 const [f, g] = n.get("icon-size-scale-range"), p = t1.b0(1, f, g); 31179 for (const o of h)if (o.hasLayoutProperty("icon-image")) { 31180 const i = te(e1, u, o, s, r, a, p, c); 31181 i && (d = Math.max(d, t1.g2(i))); 31182 } 31183 return d; 31184 }(e1, s, a, c.layout, b, M, e1.iconAtlasPositions, 0, P); 31185 Z = 4 * g; 31186 const p = c.layout.get("icon-size").evaluate(b, {}, M, P), m = S.compositeIconSizes ? S.compositeIconSizes[0].evaluate(b, {}, M, P) : 0, y = S.compositeIconSizes ? S.compositeIconSizes[1].evaluate(b, {}, M, P) : 0, B = t1.g1(e1.layerIds[0], e1.iconSizeData, p, r.imagePrimary.usvg ? 1 : S.iconScaleFactor, m, y); 31187 e1.addSymbols(e1.icon, s, B, w, v, b, void 0, i, o, A.lineStartIndex, A.lineLength, -1, P, M, T, z, e1.symbolInstances.length, g), H = e1.icon.placedSymbolArray.length - 1, a && (N = 4 * g, e1.addSymbols(e1.icon, a, B, w, v, b, t1.da.vertical, i, o, A.lineStartIndex, A.lineLength, -1, P, M, T, z, e1.symbolInstances.length, g), Y = e1.icon.placedSymbolArray.length - 1); 31188 } 31189 for(const n in s.horizontal){ 31190 const r = n, l = s.horizontal[r]; 31191 F || (J = t1.dD(l.text), p ? R = ge(l) : F = fe(u, W, o, h, d, f, l, g, c.layout.get("text-rotate").evaluate(b, {}, M), m, L)); 31192 const y = 1 === l.positionedLines.length; 31193 if (U += he(e1, i, o, l, a, c, p, b, m, A, s.vertical ? t1.da.horizontal : t1.da.horizontalOnly, y ? G(s.horizontal) : [ 31194 r 31195 ], X, H, S, P, M, e1.symbolInstances.length, T), y) break; 31196 } 31197 s.vertical && ($ += he(e1, i, o, s.vertical, a, c, p, b, m, A, t1.da.vertical, [ 31198 "vertical" 31199 ], X, Y, S, P, M, e1.symbolInstances.length, T)); 31200 let oe = -1; 31201 const ie = (e1, t1)=>e1 ? Math.max(e1, t1) : t1; 31202 oe = ie(R, oe), oe = ie(j, oe), oe = ie(V, oe); 31203 const ne = oe > -1 ? 1 : 0; 31204 e1.glyphOffsetArray.length >= 65535 && t1.w("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"), void 0 !== b.sortKey && e1.addToSortKeyRanges(e1.symbolInstances.length, b.sortKey), e1.symbolInstances.emplaceBack(o.x, o.y, W.x, W.y, W.z, X.right >= 0 ? X.right : -1, X.center >= 0 ? X.center : -1, X.left >= 0 ? X.left : -1, X.vertical >= 0 ? X.vertical : -1, H, Y, J, void 0 !== F ? F : e1.collisionBoxArray.length, void 0 !== F ? F + 1 : e1.collisionBoxArray.length, void 0 !== E ? E : e1.collisionBoxArray.length, void 0 !== E ? E + 1 : e1.collisionBoxArray.length, void 0 !== _ ? _ : e1.collisionBoxArray.length, void 0 !== _ ? _ + 1 : e1.collisionBoxArray.length, O || e1.collisionBoxArray.length, O ? O + 1 : e1.collisionBoxArray.length, h, U, $, Z, N, ne, 0, K, ee, oe, 0, Q ? 1 : 0, k); 31205 }(e1, c, M, l, i, n, r, s, e1.layers[0], e1.collisionBoxArray, o.index, o.sourceLayerIndex, e1.index, $, v, u, 0, H, X, x, o, a, h, d, f, p, m, y, L, b, S, P); 31206 }; 31207 if ("line" === w) for (const s of t1.dn(o.geometry, 0, 0, t1.a6, t1.a6)){ 31208 const o = k(s, U, Y, i.vertical || O, n, _, Z, e1.overscaling, t1.a6); 31209 for (const t1 of o)O && pe(e1, O.text, J, t1) || Q(s, t1, f); 31210 } 31211 else if ("line-center" === w) { 31212 for (const e1 of o.geometry)if (e1.length > 1) { 31213 const t1 = B(e1, Y, i.vertical || O, n, _, Z); 31214 t1 && Q(e1, t1, f); 31215 } 31216 } else if ("Polygon" === o.type) for (const e1 of t1.f_(o.geometry, 0)){ 31217 const t1 = N(e1, 16); 31218 Q(e1[0], new I(t1.x, t1.y, 0, 0, void 0), f); 31219 } 31220 else if ("LineString" === o.type) for (const e1 of o.geometry)Q(e1, new I(e1[0].x, e1[0].y, 0, 0, void 0), f); 31221 else if ("Point" === o.type) for (const e1 of o.geometry)for (const t1 of e1)Q([ 31222 t1 31223 ], new I(t1.x, t1.y, 0, 0, void 0), f); 31224 } 31225 function he(e1, o, i, n, s, r, a, l, c, u, h, d, f, g, p, m, y, x, v) { 31226 const w = t1.g3(i, n, c, r, a, l, s, e1.allowVerticalPlacement, void 0, p.textScaleFactor), b = r.layout.get("text-size").evaluate(l, {}, y), S = p.compositeTextSizes ? p.compositeTextSizes[0].evaluate(l, {}, y) : 0, I = p.compositeTextSizes ? p.compositeTextSizes[1].evaluate(l, {}, y) : 0, P = t1.g1(e1.layerIds[0], e1.textSizeData, b, p.textScaleFactor, S, I); 31227 e1.addSymbols(e1.text, w, P, c, a, l, h, o, i, u.lineStartIndex, u.lineLength, g, m, y, v, !1, x, w.length); 31228 for (const t1 of d)f[t1] = e1.text.placedSymbolArray.length - 1; 31229 return 4 * w.length; 31230 } 31231 function de(e1) { 31232 for(const t1 in e1)return e1[t1]; 31233 return null; 31234 } 31235 function fe(e1, o, i, n, s, r, a, l, c, u, h) { 31236 let d, f, g, p; 31237 if (d = h ? h.top : a.top, f = h ? h.bottom : a.bottom, g = h ? h.left : a.left, p = h ? h.right : a.right, H(a) && a.collisionPadding) { 31238 const e1 = a.collisionPadding; 31239 g -= e1[0], d -= e1[1], p += e1[2], f += e1[3]; 31240 } 31241 if (c) { 31242 const e1 = new t1.P(g, d), o = new t1.P(p, d), i = new t1.P(g, f), n = new t1.P(p, f), s = t1.au(c); 31243 let r = new t1.P(0, 0); 31244 u && (r = new t1.P(u[0], u[1])), e1._rotateAround(s, r), o._rotateAround(s, r), i._rotateAround(s, r), n._rotateAround(s, r), g = Math.min(e1.x, o.x, i.x, n.x), p = Math.max(e1.x, o.x, i.x, n.x), d = Math.min(e1.y, o.y, i.y, n.y), f = Math.max(e1.y, o.y, i.y, n.y); 31245 } 31246 return e1.emplaceBack(o.x, o.y, o.z, i.x, i.y, g, d, p, f, l, n, s, r), e1.length - 1; 31247 } 31248 function ge(e1) { 31249 H(e1) && e1.collisionPadding && (e1.top -= e1.collisionPadding[1], e1.bottom += e1.collisionPadding[3]); 31250 const t1 = e1.bottom - e1.top; 31251 return t1 > 0 ? Math.max(10, t1) : null; 31252 } 31253 function pe(e1, t1, o, i) { 31254 const n = e1.compareText; 31255 if (t1 in n) { 31256 const e1 = n[t1]; 31257 for(let t1 = e1.length - 1; t1 >= 0; t1--)if (i.dist(e1[t1]) < o) return !0; 31258 } else n[t1] = []; 31259 return n[t1].push(i), !1; 31260 } 31261 const me = 1 * t1.g5; 31262 class ye { 31263 constructor(e1){ 31264 const o = {}, i = []; 31265 for(const t1 in e1){ 31266 const n = e1[t1], s = o[t1] = {}; 31267 for(const e1 in n.glyphs){ 31268 const t1 = n.glyphs[+e1]; 31269 if (!t1 || 0 === t1.bitmap.width || 0 === t1.bitmap.height) continue; 31270 const o = t1.metrics.localGlyph ? me : 1, r = { 31271 x: 0, 31272 y: 0, 31273 w: t1.bitmap.width + 2 * o, 31274 h: t1.bitmap.height + 2 * o 31275 }; 31276 i.push(r), s[e1] = r; 31277 } 31278 } 31279 const { w: n, h: s } = t1.p(i), r = new t1.g4({ 31280 width: n || 1, 31281 height: s || 1 31282 }); 31283 for(const i in e1){ 31284 const n = e1[i]; 31285 for(const e1 in n.glyphs){ 31286 const s = n.glyphs[+e1]; 31287 if (!s || 0 === s.bitmap.width || 0 === s.bitmap.height) continue; 31288 const a = o[i][e1], l = s.metrics.localGlyph ? me : 1; 31289 t1.g4.copy(s.bitmap, r, { 31290 x: 0, 31291 y: 0 31292 }, { 31293 x: a.x + l, 31294 y: a.y + l 31295 }, s.bitmap); 31296 } 31297 } 31298 this.image = r, this.positions = o; 31299 } 31300 } 31301 function xe(e1) { 31302 for (const t1 of e1){ 31303 if (null != t1.hdExt) return !0; 31304 if (t1.requiresHDRuntime) return !0; 31305 } 31306 return !1; 31307 } 31308 function ve(e1) { 31309 for (const t1 of e1)if (t1.requiresStandardRuntime) return !0; 31310 return !1; 31311 } 31312 function we(e1, o, i) { 31313 const n = null != e1 && !!t1.g8 && t1.g8(e1.sourceLayers, o, i); 31314 return { 31315 applies: n, 31316 frcMask: n && e1 ? e1.frcMask : null,
31317 polygons: n && e1 ? e1.polygons : null, 31318 tileZoom: n && e1 ? e1.tileZoom : null 31319 }; 31320 } 31321 t1.fF(ye, "GlyphAtlas"); 31322 class be { 31323 isLayerActiveForTile(e1) { 31324 return !(this.renderSourceType === t1.bR.Symbol && "symbol" !== e1.type || this.renderSourceType === t1.bR.FillExtrusion && "fill-extrusion" !== e1.type || this.renderSourceType === t1.bR.Other && ("symbol" === e1.type || "fill-extrusion" === e1.type) || this.renderSourceType === t1.bR.HdRoadElevation || e1.minzoom && this.zoom < Math.floor(e1.minzoom) || e1.maxzoom && this.zoom >= e1.maxzoom || "none" === e1.visibility); 31325 } 31326 parse(e1, t1, o, i, n, s) { 31327 this._parseAfterHD(e1, t1, o, i, n, s); 31328 } 31329 _parseAfterHD(e1, o, l, c, u, h) { 31330 let d; 31331 if (this.status = "parsing", this.data = e1, this.renderSourceType === t1.bR.HdRoadCoverage) { 31332 const o = e1.layers[t1.bU]; 31333 d = o && s ? s(o) : []; 31334 } 31335 this.collisionBoxArray = new t1.bt; 31336 const f = new t1.g6(Object.keys(e1.layers).sort()), g = new t1.fA(this.tileID, this.promoteId); 31337 g.bucketLayerIDs = []; 31338 const y = {}, x = new t1.g7(256, 256), v = { 31339 featureIndex: g, 31340 iconDependencies: new Map, 31341 patternDependencies: new Map, 31342 glyphDependencies: {}, 31343 lineAtlas: x, 31344 availableImages: l, 31345 brightness: this.brightness, 31346 scaleFactor: this.scaleFactor, 31347 showElevationIdDebug: this.showElevationIdDebug, 31348 elevationFeatures: void 0, 31349 elevationParams: this.elevation, 31350 crossSourceElevationEnabled: this.crossSourceElevationEnabled, 31351 terrainEnabled: this.terrainEnabled, 31352 activeFloors: void 0 31353 }; 31354 this.indoor && a && (v.activeFloors = a(e1, this.indoor, u, this.canonical)); 31355 const w = [], b = o.familiesBySource[this.source]; 31356 if (this.renderSourceType === t1.bR.HdRoadElevation) { 31357 const t1 = i && i(e1, this.canonical) || [], o = new ye({}); 31358 return this.status = "done", void h(null, { 31359 buckets: [], 31360 containsHdExt: !1, 31361 containsStandardExt: !1, 31362 featureIndex: g, 31363 collisionBoxArray: this.collisionBoxArray, 31364 glyphAtlasImage: o.image, 31365 lineAtlas: x, 31366 imageAtlas: null, 31367 brightness: this.brightness, 31368 parsedElevationFeatures: t1 31369 }); 31370 } 31371 if (this.deferRoadStructure = !1, this.renderSourceType !== t1.bR.HdRoadCoverage && null != this.frcCoverage && !this.frcCoverage.resolved && null === this.frcCoverage.frcMask) { 31372 for(const e1 in b)if (t1.g8 && t1.g8(this.frcCoverage.sourceLayers, this.source, e1)) { 31373 this.deferRoadStructure = !0; 31374 break; 31375 } 31376 } 31377 for(const o in b){ 31378 const n = e1.layers[o]; 31379 if (!n) continue; 31380 let s = !1, r = !1, a = !1, u = !1; 31381 for (const e1 of b[o])"symbol" === e1[0].type ? s = !0 : "fill-extrusion" === e1[0].type ? r = !0 : a = !0, e1[0].is3D() && "model" !== e1[0].type && (u = !0); 31382 if (this.extraShadowCaster && !u) continue; 31383 if (this.renderSourceType === t1.bR.Symbol && !s) continue; 31384 if (this.renderSourceType === t1.bR.FillExtrusion && !r) continue; 31385 if ((this.renderSourceType === t1.bR.Other || this.renderSourceType === t1.bR.HdRoadCoverage) && !a) continue; 31386 const h = null != this.frcCoverage && !!t1.g8 && t1.g8(this.frcCoverage.sourceLayers, this.source, o); 31387 if (this.deferRoadStructure && h) continue; 31388 1 === n.version && t1.w('Vector tile source "'.concat(this.source, '" layer "').concat(o, '" does not use vector tile spec v2 and therefore may have some rendering errors.')); 31389 const d = f.encode(o), m = [], x = this.localizableLayerIds && this.localizableLayerIds.has(o); 31390 let S = !1; 31391 for(let e1 = 0, i = 0; e1 < n.length; e1++){ 31392 const s = n.feature(e1), r = g.getId(s, o), a = s.properties ? s.properties.worldview : null; 31393 if (x && this.worldview && "string" == typeof a) if ("all" === a) s.properties.$localized = !0; 31394 else { 31395 if (!a.split(",").includes(this.worldview)) continue; 31396 s.properties.$localized = !0, s.properties.worldview = this.worldview; 31397 } 31398 !S && s.properties && Object.hasOwn(s.properties, t1.fP) && (S = !0), h && this.frcCoverage && this.frcCoverage.frcMask && s.properties && t1.g9 && t1.g9(s.properties, this.frcCoverage.frcMask) || (m.pu
vendor: 5,553 bytes, lines 31398-31488
31398sh({ 31399 feature: s, 31400 id: r, 31401 index: i, 31402 sourceLayerIndex: d 31403 }), i++); 31404 } 31405 S && !v.elevationFeatures && i && (v.elevationFeatures = i(e1, this.canonical)); 31406 for (const e1 of b[o]){ 31407 const i = e1[0]; 31408 if (this.extraShadowCaster && (!i.is3D() || "model" === i.type)) continue; 31409 if (this.renderSourceType === t1.bR.Symbol && "symbol" !== i.type) continue; 31410 if (this.renderSourceType === t1.bR.FillExtrusion && "fill-extrusion" !== i.type) continue; 31411 if (!(this.renderSourceType !== t1.bR.Other && this.renderSourceType !== t1.bR.HdRoadCoverage || "symbol" !== i.type && "fill-extrusion" !== i.type)) continue; 31412 if (!this.isLayerActiveForTile(i)) continue; 31413 const n = g.bucketLayerIDs.length; 31414 g.bucketLayerIDs.push(e1.map((e1)=>t1.m(e1.id, e1.scope))); 31415 const s = ()=>{ 31416 Se(e1, this.zoom, v.brightness, l, this.worldview, v.activeFloors); 31417 const t1 = y[i.id] = i.createBucket({ 31418 index: n, 31419 layers: e1, 31420 zoom: this.zoom, 31421 lut: this.lut, 31422 canonical: this.canonical, 31423 pixelRatio: this.pixelRatio, 31424 overscaling: this.overscaling, 31425 collisionBoxArray: this.collisionBoxArray, 31426 sourceLayerIndex: d, 31427 sourceLayerName: o, 31428 sourceID: this.source, 31429 projection: this.projection.spec, 31430 tessellationStep: this.tessellationStep, 31431 styleDefinedModelURLs: c, 31432 worldview: this.worldview, 31433 localizable: x, 31434 availableImages: l, 31435 maxUniformBufferBindings: this.maxUniformBufferBindings, 31436 maxUniformBlockSizeDwords: this.maxUniformBlockSizeDwords 31437 }); 31438 p && p(t1, this.frcCoverage ? this.frcCoverage.sourceLayers : null), t1.populate(m, v, this.tileID.canonical, this.tileTransform); 31439 }; 31440 i.mayUse("HD") || i.mayUse("Standard") ? w.push(i.prepare().then(()=>s())) : s(); 31441 } 31442 } 31443 const S = ()=>{ 31444 x.trim(); 31445 const o = !(!v.elevationFeatures || !v.elevationFeatures.some((e1)=>e1.heightRange.min < 0)); 31446 let i, s, a, c, p, w, b; 31447 const S = { 31448 type: "maybePrepare", 31449 renderSourceType: this.renderSourceType, 31450 zoom: this.zoom 31451 }, I = ()=>{ 31452 if (i) return this.status = "done", h(i); 31453 if (this.extraShadowCaster) { 31454 this.status = "done"; 31455 const e1 = Object.values(y).filter((e1)=>!e1.isEmpty()), t1 = v.elevationFeatures; 31456 h(null, { 31457 buckets: e1, 31458 containsHdExt: xe(e1), 31459 containsStandardExt: ve(e1), 31460 featureIndex: g, 31461 collisionBoxArray: null, 31462 hasTunnelGeometry: o, 31463 glyphAtlasImage: null, 31464 lineAtlas: null, 31465 imageAtlas: null, 31466 brightness: v.brightness, 31467 hasDeferredElevationFeatures: !!m && m(y), 31468 parsedElevationFeatures: t1, 31469 glyphMap: null, 31470 iconMap: null, 31471 glyphPositions: null 31472 }); 31473 } else if (s && a && c && b) { 31474 const e1 = void 0, o = new ye(s), i = new Map; 31475 for (const [e1, o] of a.entries()){ 31476 const { imagePosition: n } = t1.fW(e1, o, t1.fX); 31477 i.set(e1, n); 31478 } 31479 const n = {}; 31480 for(const e1 in y){ 31481 const c = y[e1]; 31482 if (c instanceof t1.bu) { 31483 Se(c.layers, this.zoom, v.brightness, l, this.worldview, v.activeFloors); 31484 const u = we(this.frcCoverage, this.source, c.layers[0].sourceLayer); 31485 n[e1] = Q(c, s, o.positions, a, i, this.tileID.canonical, this.tileZoom, this.scaleFactor, this.pixelRatio, p, this.worldview, l, u.frcMask, u.polygons, u.tileZoom, t1.g9 || null, r || null); 31486 } 31487 } 31488 p.size || w.size ? this.rasterizeTask = u.
31488sendCancelable("rasterizeImages", { 31489 scope: this.scope, 31490 iconTasks: p, 31491 patternTasks: w 31492 }, {}, (t1, i)=>{ 31493 if (!t1) for (const [e1, t1] of i.entries())a.has(e1) && a.set(e1, Object.assign(a.get(e1), { 31494 data: t1 31495 })), c.has(e1) && c.set(e1, Object.assign(c.get(e1), { 31496 data: t1 31497 })); 31498 P(n, o, e1, b); 31499 }) : P(n, o, e1, b); 31500 } 31501 }, P = (e1, i, n, s)=>{ 31502 const r = a.size > 0 || c.size > 0, f = Object.keys(e1).length > 0, p = v.elevationFeatures; 31503 if (!r && !f) { 31504 this.status = "done"; 31505 const e1 = Object.values(y).filter((e1)=>!e1.isEmpty()); 31506 return void h(null, { 31507 buckets: e1, 31508 containsHdExt: xe(e1), 31509 containsStandardExt: ve(e1), 31510 featureIndex: g, 31511 collisionBoxArray: this.collisionBoxArray, 31512 hasTunnelGeometry: o, 31513 glyphAtlasImage: i.image, 31514 lineAtlas: x, 31515 imageAtlas: null, 31516 brightness: v.brightness, 31517 hasDeferredRoadStructure: this.deferRoadStructure, 31518 frcCoveragePolygons: d, 31519 hasDeferredElevationFeatures: !!m && m(y), 31520 parsedElevationFeatures: p 31521 }); 31522 } 31523 const w = (n, s)=>{ 31524 for(const o in y){ 31525 const i = y[o]; 31526 if (o in e1) se(i, e1[o], this.showCollisionBoxes, l, this.tileID.canonical, this.tileZoom, this.projection, this.brightness, a, s); 31527 else if (i.hasPattern && (i instanceof t1.bz || i instanceof t1.bA || i instanceof t1.aC)) { 31528 Se(i.layers, this.zoom, v.brightness, l, this.worldview, v.activeFloors); 31529 const e1 = Object.fromEntries(s.patternPositions); 31530 i.addFeatures(v, this.tileID.canonical, e1, l, this.tileTransform, this.brightness); 31531 } 31532 } 31533 this.status = "done"; 31534 const r = Object.values(y).filter((e1)=>!e1.isEmpty()); 31535 h(null, { 31536 buckets: r, 31537 containsHdExt: xe(r), 31538 containsStandardExt: ve(r), 31539 featureIndex: g, 31540 collisionBoxArray: this.collisionBoxArray, 31541 hasTunnelGeometry: o, 31542 glyphAtlasImage: i.image, 31543 lineAtlas: x, 31544 imageAtlas: n, 31545 brightness: v.brightness, 31546 hasDeferredRoadStructure: this.deferRoadStructure, 31547 frcCoveragePolygons: d, 31548 hasDeferredElevationFeatures: !!m && m(y), 31549 parsedElevationFeatures: p 31550 }); 31551 }; 31552 if (r) { 31553 const e1 = new Map, o = t1.gb(a, e1), i = t1.gb(c, e1), n = new t1.gc(o, i, s, this.lut, this.scope, e1); 31554 u.send("checkAtlasCache", { 31555 descriptor: n, 31556 scope: this.scope 31557 }).then((e1)=>{ 31558 let o, i; 31559 if (e1) o = new t1.gd(e1.sourceHash), i = e1; 31560 else { 31561 const e1 = new t1.ge(a, c, this.lut, s, this.scope); 31562 o = e1, i = e1; 31563 } 31564 w(o, i); 31565 }).catch((e1)=>{ 31566 "AbortError" !== e1.name && t1.w("[Worker] Error checking atlas cache: ".concat(e1.message)); 31567 const o = new t1.ge(a, c, this.lut, s, this.scope); 31568 w(o, o); 31569 }); 31570 } else w(null, { 31571 iconPositions: new Map, 31572 patternPositions: new Map 31573 }); 31574 }; 31575 if (!this.extraShadowCaster) { 31576 const e1 = t1.ga(v.glyphDependencies, (e1)=>Object.keys(e1).map(Number)); 31577 Object.keys(e1).length ? u.send("getGlyphs", { 31578 uid: this.uid, 31579 stacks: e1 31580 }, { 31581 metadata: S 31582 }).then((e1)=>{
31583 i || (s = e1, I()); 31584 }).catch((e1)=>{ 31585 i || (i = e1, I()); 31586 }) : s = {}, b = new Map; 31587 const o = Array.from(v.iconDependencies.keys()).map((e1)=>t1.I.parse(e1)), n = Array.from(v.patternDependencies.keys()).map((e1)=>t1.I.parse(e1)); 31588 o.length || n.length ? u.send("getImages", { 31589 icons: o, 31590 patterns: n, 31591 source: this.source, 31592 scope: this.scope, 31593 tileID: this.tileID 31594 }, { 31595 metadata: S 31596 }).then((e1)=>{ 31597 if (!i) { 31598 a = new Map, c = new Map, p = this.updateImageMapAndGetImageTaskQueue(a, e1.images, v.iconDependencies), w = this.updateImageMapAndGetImageTaskQueue(c, e1.images, v.patternDependencies); 31599 for (const [t1, o] of e1.versions.entries())b.set(t1, o); 31600 I(); 31601 } 31602 }).catch((e1)=>{ 31603 i || (i = e1, I()); 31604 }) : (a = new Map, c = new Map, p = new Map, w = new Map); 31605 } 31606 n && n({ 31607 buckets: y, 31608 data: e1, 31609 sourceLayerCoder: f, 31610 canonical: this.tileID.canonical, 31611 options: v 31612 }), I(); 31613 }; 31614 w.length > 0 ? Promise.allSettled(w).then(S).catch(h) : S(); 31615 } 31616 updateParameters(e1) { 31617 this.scaleFactor = e1.scaleFactor, this.showCollisionBoxes = e1.showCollisionBoxes, this.showElevationIdDebug = e1.showElevationIdDebug, this.projection = e1.projection, this.brightness = e1.brightness, this.tileTransform = t1.bp(e1.tileID.canonical, e1.projection), this.extraShadowCaster = e1.extraShadowCaster, this.lut = e1.lut, this.worldview = e1.worldview, this.indoor = e1.indoor, this.frcCoverage = e1.frcCoverage || null, this.elevation = e1.elevation || null, this.terrainEnabled = !!e1.terrainEnabled; 31618 } 31619 updateImageMapAndGetImageTaskQueue(e1, t1, o) { 31620 const i = new Map; 31621 for (const n of t1.keys()){ 31622 const s = o.get(n) || []; 31623 for (const o of s){ 31624 const n = o.toString(), s = t1.get(o.id.toString()); 31625 s.usvg ? i.has(n) || (i.set(n, o), e1.set(n, { 31626 ...s 31627 })) : e1.set(n, s); 31628 } 31629 } 31630 return i; 31631 } 31632 cancelRasterize() { 31633 this.rasterizeTask && this.rasterizeTask.abort(); 31634 } 31635 constructor(e1){ 31636 this.tileID = new t1.bP(e1.tileID.overscaledZ, e1.tileID.wrap, e1.tileID.canonical.z, e1.tileID.canonical.x, e1.tileID.canonical.y), this.tileZoom = e1.tileZoom, this.uid = e1.uid, this.zoom = e1.zoom, this.lut = e1.lut, this.canonical = e1.tileID.canonical, this.pixelRatio = e1.pixelRatio, this.tileSize = e1.tileSize, this.source = e1.source, this.scope = e1.scope, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = e1.showCollisionBoxes, this.showElevationIdDebug = e1.showElevationIdDebug, this.collectResourceTiming = !!e1.request && e1.request.collectResourceTiming, this.promoteId = e1.promoteId, this.renderSourceType = e1.renderSourceType, this.frcCoverage = e1.frcCoverage || null, this.elevation = e1.elevation || null, this.crossSourceElevationEnabled = !!e1.crossSourceElevationEnabled, this.terrainEnabled = !!e1.terrainEnabled, this.deferRoadStructure = !1, this.tileTransform = t1.bp(e1.tileID.canonical, e1.projection), this.projection = e1.projection, this.worldview = e1.worldview, this.localizableLayerIds = e1.localizableLayerIds, this.brightness = e
vendor: 11,609 bytes, lines 31636-31879
316361.brightness, this.extraShadowCaster = !!e1.extraShadowCaster, this.tessellationStep = e1.tessellationStep, this.scaleFactor = e1.scaleFactor, this.worldview = e1.worldview, this.indoor = e1.indoor; 31637 } 31638 } 31639 function Se(e1, o, i, n, s, r) { 31640 const a = new t1.ai(o, { 31641 brightness: i, 31642 worldview: s, 31643 activeFloors: r 31644 }); 31645 for (const t1 of e1)t1.recalculate(a, n); 31646 } 31647 class Ie extends t1.E { 31648 loadTileData(e1, t1) { 31649 if (!this.tileProvider) return this.loadVectorData(e1, t1); 31650 const o = new AbortController; 31651 return this.loadTileWithProvider(this.tileProvider, e1, o, t1), ()=>o.abort(); 31652 } 31653 async loadTileWithProvider(e1, t1, o, i) { 31654 const { z: n, x: s, y: r } = t1.tileID.canonical; 31655 try { 31656 const a = await e1.loadTile({ 31657 z: n, 31658 x: s, 31659 y: r 31660 }, { 31661 request: t1.request, 31662 signal: o.signal 31663 }); 31664 if (o.signal.aborted) return; 31665 if (null == a) { 31666 const e1 = new Error("Tile not found"); 31667 return e1.status = 404, i(e1); 31668 } 31669 if (null == a.data) return i(null, null); 31670 if (a.data instanceof ImageBitmap) return i(new Error("Vector tiles require ArrayBuffer data")); 31671 const l = new Headers; 31672 a.expires && l.set("expires", a.expires), a.cacheControl && l.set("cache-control", a.cacheControl), i(null, { 31673 rawData: a.data, 31674 headers: l 31675 }); 31676 } catch (e1) { 31677 if (o.signal.aborted) return; 31678 i(e1 instanceof Error ? e1 : new Error(String(e1))); 31679 } 31680 } 31681 _fetchTileData(e1, t1) { 31682 return new Promise((o, i)=>{ 31683 e1.abort = this.loadTileData(t1, (e1, t1)=>{ 31684 e1 ? i(e1) : o(t1); 31685 }); 31686 }); 31687 } 31688 async _parse(e1, t1) { 31689 const o = !this.isSpriteLoaded; 31690 return o && await this.once("isSpriteLoaded"), new Promise((i, n)=>{ 31691 const s = ()=>e1.parse(e1.vectorTile, this.layerIndex, this.availableImages, this.availableModels, this.actor, (e1, t1)=>{ 31692 e1 ? n(e1) : i(t1); 31693 }); 31694 o && this.scheduler ? this.scheduler.add(s, { 31695 type: "parseTile", 31696 renderSourceType: t1.renderSourceType, 31697 zoom: t1.tileZoom 31698 }) : s(); 31699 }); 31700 } 31701 async loadTile(e1) { 31702 const i = e1.uid, n = e1 && e1.request, s = n && n.collectResourceTiming, r = this.loading[i] = new be(e1); 31703 r.maxUniformBufferBindings = this.maxUniformBufferBindings, r.maxUniformBlockSizeDwords = this.maxUniformBlockSizeDwords; 31704 const a = (e1, t1)=>{ 31705 const o = r.reloadCallback; 31706 o && (delete r.reloadCallback, e1 || !t1 ? o(e1, null) : r.parse(r.vectorTile, this.layerIndex, this.availableImages, this.availableModels, this.actor, o)); 31707 }; 31708 let l, c; 31709 try { 31710 l = await this._fetchTileData(r, e1); 31711 } catch (e1) { 31712 c = e1; 31713 } 31714 const u = !this.loading[i]; 31715 if (delete this.loading[i], r.cancelRasterize(), c || u || !l) { 31716 if (r.status = "done", u || (this.loaded[i] = r), c) throw c; 31717 return null; 31718 } 31719 const h = l.rawData; 31720 let d; 31721 r.vectorTile = l.vectorTile || new t1.gf(new t1.d0(h)), this.loaded = this.loaded || {}, this.loaded[i] = r; 31722 try { 31723 d = await this._parse(r, e1); 31724 } catch (e1) { 31725 throw a(e1), e1; 31726 } 31727 if (!d) return a(null, null), null; 31728 const f = {}; 31729 if (s) { 31730 const e1 = o(n); 31731 e1.length > 0 && (f.resourceTiming = JSON.parse(JSON.stringify(e1))); 31732 } 31733 const g = { 31734 rawTileData: h.slice(0), 31735 headers: l.headers, 31736 ...d, 31737 ...f 31738 }; 31739 return a(null, d), g; 31740 } 31741 async reloadTile(e1) { 31742 const t1 = this.loaded, o = e1.uid; 31743 if (t1 && t1[o]) return new Promise((i, n)=>{ 31744 const s = t1[o]; 31745 s.updateParameters(e1); 31746 const r = (e1, t1)=>{ 31747 const o = s.reloadCallback; 31748 o && (delete s.reloadCallback, s.parse(s.vectorTile, this.layerIndex, this.availableImages, this.availableModels, this.actor, o)), e1 ? n(e1) : i(t1); 31749 }; 31750 "parsing" === s.status ? s.reloadCallback = r : "done" === s.status ? s.vectorTile ? s.parse(s.vectorTile, this.layerIndex, this.availableImages, this.availableModels, this.actor, r) : r() : i(void 0); 31751 }); 31752 } 31753 abortTile(e1) { 31754 const t1 = e1.uid, o = this.loading[t1]; 31755 o && (o.abort && o.abort(), delete this.loading[t1]); 31756 } 31757 removeTile(e1) { 31758 const t1 = this.loaded, o = e1.uid; 31759 t1 && t1[o] && delete t1[o]; 31760 } 31761 constructor({ actor: e1, layerIndex: o, availableImages: i, availableModels: n, isSpriteLoaded: s, tileProvider: r, brightness: a, maxUniformBufferBindings: l, maxUniformBlockSizeDwords: c }){ 31762 super(), this.actor = e1, this.layerIndex = o, this.availableImages = i, this.availableModels = n, this.loadVectorData = t1.cI, this.tileProvider = r, this.loading = {}, this.loaded = {}, this.deduped = new t1.cD(e1.scheduler), this.isSpriteLoaded = s, this.scheduler = e1.scheduler, this.brightness = a, this.maxUniformBufferBindings = l, this.maxUniformBlockSizeDwords = c; 31763 } 31764 } 31765 class Pe { 31766 async loadTile(e1) { 31767 const o = e1.uid, i = new AbortController; 31768 if (this.loading[o] = { 31769 cancel: ()=>i.abort() 31770 }, this.tileProvider) return this.loadTileWithProvider(this.tileProvider, o, e1, i); 31771 try { 31772 const { data: n, headers: s } = await t1.d1(e1.request, i.signal); 31773 if (!n) return null; 31774 const r = await this.decodeTile(o, n, e1.encoding); 31775 return r.headers = s, r; 31776 } catch (e1) { 31777 if (i.signal.aborted) return null; 31778 throw e1; 31779 } finally{ 31780 delete this.loading[o]; 31781 } 31782 } 31783 async decodeTile(e1, o, i) { 31784 const n = o instanceof ImageBitmap ? o : await createImageBitmap(new Blob([ 31785 new Uint8Array(o) 31786 ], { 31787 type: "image/png" 31788 })), s = 1 - (n.width - t1.gg(n.width)) / 2, r = s < 1, a = this.getImageData(n, s); 31789 return n.close(), { 31790 dem: new t1.gh(e1, a, i, r), 31791 borderReady: r 31792 }; 31793 } 31794 async loadTileWithProvider(e1, t1, o, i) { 31795 const { z: n, x: s, y: r } = o.tileID.canonical; 31796 try { 31797 const a = await e1.loadTile({ 31798 z: n, 31799 x: s, 31800 y: r 31801 }, { 31802 request: o.request, 31803 signal: i.signal 31804 }); 31805 if (i.signal.aborted) return null; 31806 if (null == a) { 31807 const e1 = new Error("Tile not found"); 31808 throw e1.status = 404, e1; 31809 } 31810 if (null == a.data) return null; 31811 const l = await this.decodeTile(t1, a.data, o.encoding); 31812 if (i.signal.aborted) return null; 31813 const c = new Headers; 31814 return a.expires && c.set("expires", a.expires), a.cacheControl && c.set("cache-control", a.cacheControl), l.headers = c, l; 31815 } catch (e1) { 31816 if (i.signal.aborted) return null; 31817 throw e1; 31818 } finally{ 31819 delete this.loading[t1]; 31820 } 31821 } 31822 async reloadTile(e1) {} 31823 abortTile(e1) { 31824 const t1 = e1.uid, o = this.loading[t1]; 31825 o && (o.cancel(), delete this.loading[t1]); 31826 } 31827 removeTile(e1) {} 31828 getImageData(e1, t1) { 31829 this.offscreenCanvas && this.offscreenCanvasContext || (this.offscreenCanvas = new OffscreenCanvas(e1.width, e1.height), this.offscreenCanvasContext = this.offscreenCanvas.getContext("2d", { 31830 willReadFrequently: !0 31831 })), this.offscreenCanvas.width = e1.width, this.offscreenCanvas.height = e1.height, this.offscreenCanvasContext.drawImage(e1, 0, 0, e1.width, e1.height); 31832 const o = this.offscreenCanvasContext.getImageData(-t1, -t1, e1.width + 2 * t1, e1.height + 2 * t1); 31833 return this.offscreenCanvasContext.clearRect(0, 0, this.offscreenCanvas.width, this.offscreenCanvas.height), o; 31834 } 31835 constructor(e1){ 31836 this.tileProvider = e1.tileProvider, this.loading = {}; 31837 } 31838 } 31839 const Me = t1.gi.prototype.toGeoJSON; 31840 class Te { 31841 loadGeometry() { 31842 if (1 === this._feature.type) { 31843 const e1 = []; 31844 for (const o of this._feature.geometry)e1.push([ 31845 new t1.P(o[0], o[1]) 31846 ]); 31847 return e1; 31848 } 31849 { 31850 const e1 = []; 31851 for (const o of this._feature.geometry){ 31852 const i = []; 31853 for (const e1 of o)i.push(new t1.P(e1[0], e1[1])); 31854 e1.push(i); 31855 } 31856 return e1; 31857 } 31858 } 31859 toGeoJSON(e1, t1, o) { 31860 return Me.call(this, e1, t1, o); 31861 } 31862 constructor(e1){ 31863 this._feature = e1, this.extent = t1.a6, this.type = e1.type, this.properties = e1.tags, "id" in e1 && !isNaN(e1.id) && (this.id = parseInt(e1.id, 10)); 31864 } 31865 } 31866 class ze { 31867 feature(e1) { 31868 return new Te(this._jsonFeatures[e1]); 31869 } 31870 constructor(e1, o){ 31871 this.name = e1, this.extent = t1.a6, this.length = o.length, this._jsonFeatures = o; 31872 } 31873 } 31874 class Be { 31875 constructor(e1){ 31876 this.layers = {}, this.extent = t1.a6; 31877 for (const t1 of Object.keys(e1))this.layers[t1] = new ze(t1, e1[t1]); 31878 } 31879 }
31880 const ke = 64 / 4096; 31881 class Ce { 31882 clear() { 31883 this.features.clear(); 31884 } 31885 load() { 31886 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t1 = arguments.length > 1 ? arguments[1] : void 0; 31887 for (const o of e1){ 31888 const e1 = o.id; 31889 if (null == e1) continue; 31890 let i = this.features.get(e1); 31891 i && this.updateCache(i, t1), o.geometry ? (i = Le(o), this.updateCache(i, t1), this.features.set(e1, i)) : this.features.delete(e1), this.updateCache(i, t1); 31892 } 31893 } 31894 updateCache(e1, t1) { 31895 for (const { canonical: o, uid: i } of Object.values(t1)){ 31896 const { z: n, x: s, y: r } = o; 31897 De(e1, Math.pow(2, n), s, r) && delete t1[i]; 31898 } 31899 } 31900 getTile(e1, t1, o) { 31901 const i = Math.pow(2, e1), n = []; 31902 for (const e1 of this.features.values())De(e1, i, t1, o) && n.push(Ee(e1, i, t1, o)); 31903 return { 31904 features: n 31905 }; 31906 } 31907 getFeatures() { 31908 return [ 31909 ...this.features.values() 31910 ]; 31911 } 31912 constructor(){ 31913 this.features = new Map; 31914 } 31915 } 31916 function De(param, n, s, r) { 31917 let { minX: e1, minY: t1, maxX: o, maxY: i } = param; 31918 return e1 < (s + 1 + ke) / n && t1 < (r + 1 + ke) / n && o > (s - ke) / n && i > (r - ke) / n; 31919 } 31920 function Le(e1) { 31921 const { id: t1, geometry: o, properties: i } = e1; 31922 if (!o) return; 31923 if ("GeometryCollection" === o.type) throw new Error("GeometryCollection not supported in dynamic mode."); 31924 const { type: n, coordinates: s } = o, r = { 31925 id: t1, 31926 type: 1, 31927 geometry: [], 31928 tags: i, 31929 minX: 1 / 0, 31930 minY: 1 / 0, 31931 maxX: -1 / 0, 31932 maxY: -1 / 0 31933 }, a = r.geometry; 31934 if ("Point" === n) Ae(s, a, r); 31935 else if ("MultiPoint" === n) for (const e1 of s)Ae(e1, a, r); 31936 else if ("LineString" === n) r.type = 2, Fe(s, a, r); 31937 else if ("MultiLineString" === n) r.type = 2, _e(s, a, r); 31938 else if ("Polygon" === n) r.type = 3, _e(s, a, r, !0); 31939 else { 31940 if ("MultiPolygon" !== n) throw new Error("Input data is not a valid GeoJSON object."); 31941 r.type = 3; 31942 for (const e1 of s)_e(e1, a, r, !0); 31943 } 31944 return r; 31945 } 31946 function Ae(param, i, n) { 31947 let [e1, o] = param; 31948 const s = t1.a7(e1); 31949 let r = t1.a8(o); 31950 r = r < 0 ? 0 : r > 1 ? 1 : r, i.push(s, r), n.minX = Math.min(n.minX, s), n.minY = Math.min(n.minY, r), n.maxX = Math.max(n.maxX, s), n.maxY = Math.max(n.maxY, r); 31951 } 31952 function Fe(e1, t1, o) { 31953 let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1; 31954 const s = []; 31955 for (const t1 of e1)Ae(t1, s, o); 31956 t1.push(s), i && function(e1, t1) { 31957 let o = 0; 31958 for(let t1 = 0, i = e1.length, n = i - 2; t1 < i; n = t1, t1 += 2)o += (e1[t1] - e1[n]) * (e1[t1 + 1] + e1[n + 1]); 31959 if (o > 0 === t1) for(let t1 = 0, o = e1.length; t1 < o / 2; t1 += 2){ 31960 const i = e1[t1], n = e1[t1 + 1]; 31961 e1[t1] = e1[o - 2 - t1], e1[t1 + 1] = e1[o - 1 - t1], e1[o - 2 - t1] = i, e1[o - 1 - t1] = n; 31962 } 31963 }(s, n); 31964 } 31965 function _e(e1, t1, o) { 31966 let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1; 31967 for(let n = 0; n < e1.length; n++)Fe(e1[n], t1, o, i, 0 === n); 31968 } 31969 function Ee(e1, o, i, n) { 31970 const { id: s, type: r, geometry: a, tags: l } = e1, c = []; 31971 if (1 === r) !function(e1, o, i, n, s) { 31972 for(let r = 0;
31972 r < e1.length; r += 2){ 31973 const a = Math.round(t1.a6 * (e1[r + 0] * o - i)), l = Math.round(t1.a6 * (e1[r + 1] * o - n)); 31974 s.push([ 31975 a, 31976 l 31977 ]); 31978 } 31979 }(a, o, i, n, c); 31980 else if (2 === r) for (const e1 of a)Oe(e1, o, i, n, c); 31981 else if (3 === r) for (const e1 of a)Re(e1, o, i, n, c); 31982 return { 31983 id: s, 31984 type: r, 31985 geometry: c, 31986 tags: l 31987 }; 31988 } 31989 function Oe(e1, o, i, n, s) { 31990 const r = -128, a = t1.a6 + 128; 31991 let l; 31992 for(let c = 0; c < e1.length - 2; c += 2){ 31993 let u = Math.round(t1.a6 * (e1[c + 0] * o - i)), h = Math.round(t1.a6 * (e1[c + 1] * o - n)), d = Math.round(t1.a6 * (e1[c + 2] * o - i)), f = Math.round(t1.a6 * (e1[c + 3] * o - n)); 31994 const g = d - u, p = f - h; 31995 u < r && d < r || (u < r ? (h += Math.round(p * ((r - u) / g)), u = r) : d < r && (f = h + Math.round(p * ((r - u) / g)), d = r), h < r && f < r || (h < r ? (u += Math.round(g * ((r - h) / p)), h = r) : f < r && (d = u + Math.round(g * ((r - h) / p)), f = r), u >= a && d >= a || (u >= a ? (h += Math.round(p * ((a - u) / g)), u = a) : d >= a && (f = h + Math.round(p * ((a - u) / g)), d = a), h >= a && f >= a || (h >= a ? (u += Math.round(g * ((a - h) / p)), h = a) : f >= a && (d = u + Math.round(g * ((a - h) / p)), f = a), l && u === l.at(-1)[0] && h === l.at(-1)[1] || (l = [ 31996 [ 31997 u, 31998 h 31999 ] 32000 ], s.push(l)), l.push([ 32001 d, 32002 f 32003 ]))))); 32004 } 32005 } 32006 function Re(e1, o, i, n, s) { 32007 const r = (i - ke) / o, a = (n - ke) / o, l = (i + 1 + ke) / o, c = (n + 1 + ke) / o; 32008 function u(e1, t1) { 32009 let o = 0; 32010 return e1 < r ? o |= 1 : e1 > l && (o |= 2), t1 < a ? o |= 4 : t1 > c && (o |= 8), o; 32011 } 32012 let h = []; 32013 for(let t1 = 1; t1 <= 8; t1 *= 2){ 32014 let o = e1[e1.length - 2], i = e1.at(-1), n = !(u(o, i) & t1); 32015 for(let s = 0; s < e1.length; s += 2){ 32016 const d = e1[s], f = e1[s + 1], g = !(u(d, f) & t1); 32017 g !== n && (8 & t1 ? h.push(o + (d - o) * (c - i) / (f - i), c) : 4 & t1 ? h.push(o + (d - o) * (a - i) / (f - i), a) : 2 & t1 ? h.push(l, i + (f - i) * (l - o) / (d - o)) : 1 & t1 && h.push(r, i + (f - i) * (r - o) / (d - o))), g && h.push(d, f), o = d, i = f, n = g; 32018 } 32019 if (!(e1 = h).length || 8 === t1) break; 32020 h = []; 32021 } 32022 const d = []; 32023 for(let e1 = 0; e1 < h.length; e1 += 2)d.push([ 32024 Math.round(t1.a6 * (h[e1] * o - i)), 32025 Math.round(t1.a6 * (h[e1 + 1] * o - n)) 32026 ]); 32027 d.length && s.push(d); 32028 } 32029 function je(param, i) { 32030 let { name: e1, features: o } = param; 32031 i.writeStringField(1, e1), i.writeVarintField(5, t1.a6); 32032 const n = new Map, s = new Map, r = { 32033 keys: n, 32034 values: s, 32035 feature: null 32036 }; 32037 for (const e1 of o)r.feature = e1, i.writeMessage(2, Ve, r); 32038 for (const e1 of n.keys())i.writeStringField(3, e1); 32039 for (const e1 of s.keys())i.writeMessage(4, Ge, e1); 32040 } 32041 function Ve(e1, t1) { 32042 const o = e1.feature; 32043 void 0 !== o.id && Number.isSafeInteger(+o.id) && t1.writeVarintField(1, +o.id), o.tags && t1.writeMessage(2, Ze, e1), t1.writeVarintField(3, o.type), t1.writeMessage(4, $e, o); 32044 } 32045 function Ze(param, i) { 32046 let { keys: e1, values: t1, feature: o } = param; 32047 for (const n of Object.keys(o.tags)){ 32048 let s = o.tags[n]; 32049 if (null === s) continue; 32050 let r = e1.get(n); 32051 void 0 === r && (r = e1.size, e1.set(n, r)), i.writeVarint(r); 32052 const a = typeof s; 32053 "string" !== a && "boolean" !== a && "number" !== a && (s = JSON.stringify(s)); 32054 let l = t1.get(s); 32055 void 0 === l && (l = t1.size, t1.set(s, l)), i.writeVarint(l); 32056 } 32057 } 32058 function Ne(e1, t1) { 32059 return (t1 << 3) + (7 & e1); 32060 } 32061 function Ue(e1) { 32062 return e1 << 1 ^ e1 >> 31; 32063 } 32064 function $e(e1, t1) { 32065 const { geometry: o, type: i } = e1; 32066 let n = 0, s = 0; 32067 if (1 === i) { 32068 t1.writeVarint(Ne(1, o.length)); 32069 for (const e1 of o){ 32070 const o = e1[0] - n, i = e1[1] - s;
32071 t1.writeVarint(Ue(o)), t1.writeVarint(Ue(i)), n += o, s += i; 32072 } 32073 } else for (const e1 of o){ 32074 if (0 === e1.length) continue; 32075 t1.writeVarint(Ne(1, 1)); 32076 const o = e1.length - (3 === i ? 1 : 0); 32077 for(let i = 0; i < o; i++){ 32078 1 === i && t1.writeVarint(Ne(2, o - 1)); 32079 const r = e1[i][0] - n, a = e1[i][1] - s; 32080 t1.writeVarint(Ue(r)), t1.writeVarint(Ue(a)), n += r, s += a; 32081 } 32082 3 === i && t1.writeVarint(Ne(7, 1)); 32083 } 32084 } 32085 function Ge(e1, t1) { 32086 const o = typeof e1; 32087 "string" === o ? t1.writeStringField(1, e1) : "boolean" === o ? t1.writeBooleanField(7, e1) : "number" === o && (e1 % 1 != 0 ? t1.writeDoubleField(3, e1) : e1 < 0 ? t1.writeSVarintField(6, e1) : t1.writeVarintField(5, e1)); 32088 } 32089 const He = { 32090 minZoom: 0, 32091 maxZoom: 16, 32092 minPoints: 2, 32093 radius: 40, 32094 extent: 512, 32095 nodeSize: 64, 32096 log: !1, 32097 generateId: !1, 32098 reduce: null, 32099 map: (e1)=>e1 32100 }, Ye = 1073741824, Xe = 1 / Ye, Je = (e1)=>(e1 - .5) * Ye, qe = (e1)=>e1 * Xe + .5; 32101 class We { 32102 load(e1) { 32103 const { log: t1, minZoom: o, maxZoom: i } = this.options; 32104 t1 && console.time("total time"); 32105 const n = i + 1, s = "z".concat(n, ": ").concat(e1.length, " points"); 32106 t1 && console.time(s); 32107 const r = this.stride; 32108 let a = e1.length; 32109 for (const t1 of e1){ 32110 const e1 = t1.geometry; 32111 e1 && "MultiPoint" === e1.type && (a += e1.coordinates.length - 1); 32112 } 32113 this.numPoints = a; 32114 const l = this.props = new Array(a), c = this.coords = new Float64Array(2 * a); 32115 let u = null; 32116 const h = new Int32Array(a * r); 32117 let d = 0, f = 0; 32118 for (const t1 of e1){ 32119 const e1 = t1.geometry; 32120 if (!e1) { 32121 f++; 32122 continue; 32123 } 32124 const o = e1.coordinates, i = "MultiPoint" === e1.type; 32125 for(let e1 = 0, s = i ? o.length : 1; e1 < s; e1++, f++){ 32126 const [s, g] = i ? o[e1] : o, p = Ke(s), m = et(g); 32127 c[2 * f] = p, c[2 * f + 1] = m, h[d] = Je(p), h[d + 1] = Je(m), h[d + 2] = n, h[d + 3] = f, h[d + 4] = -1, h[d + 5] = 1, l[f] = t1.properties, void 0 !== t1.id && (u || (u = new Array(a)), u[f] = t1.id), d += r; 32128 } 32129 } 32130 this.ids = u; 32131 let g = d === h.length ? h : h.subarray(0, d), p = d / r; 32132 this.trees[i + 1] = this._createTree(g, p), t1 && console.timeEnd(s); 32133 let m = null; 32134 for(let e1 = i; e1 >= o; e1--){ 32135 const o = performance.now(), i = m || new Int32Array(p * r); 32136 m = null; 32137 const n = this._cluster(g, p, e1, i); 32138 n === p ? (this.trees[e1] = this.trees[e1 + 1], m = i) : (this.trees[e1] = this._createTree(i, n), g = i, p = n), t1 && console.log("z".concat(e1, ": ").concat(this.trees[e1].numItems, " cluster
32138s in ").concat((performance.now() - o).toFixed(2), "ms")); 32139 } 32140 return t1 && console.timeEnd("total time"), this; 32141 } 32142 getClusters(e1, t1) { 32143 let o = ((e1[0] + 180) % 360 + 360) % 360 - 180; 32144 const i = Math.max(-90, Math.min(90, e1[1])); 32145 let n = 180 === e1[2] ? 180 : ((e1[2] + 180) % 360 + 360) % 360 - 180; 32146 const s = Math.max(-90, Math.min(90, e1[3])); 32147 if (e1[2] - e1[0] >= 360) o = -180, n = 180; 32148 else if (o > n) { 32149 const e1 = this.getClusters([ 32150 o, 32151 i, 32152 180, 32153 s 32154 ], t1), r = this.getClusters([ 32155 -180, 32156 i, 32157 n, 32158 s 32159 ], t1); 32160 return e1.concat(r); 32161 } 32162 const r = this.trees[this._limitZoom(t1)], a = r.range(Je(Ke(o)), Je(et(s)), Je(Ke(n)), Je(et(i))), l = r.data, c = []; 32163 for (const e1 of a)c.push(this._featureJSON(l, this.stride * e1)); 32164 return c; 32165 } 32166 getChildren(e1) { 32167 const t1 = this._getOriginId(e1), o = this._getOriginZoom(e1), i = "No cluster with the specified id.", n = this.trees[o]; 32168 if (!n) throw new Error(i); 32169 const s = n.data; 32170 if (t1 >= n.numItems) throw new Error(i); 32171 const r = this.options.radius / (this.options.extent * Math.pow(2, o - 1)), a = n.within(s[t1 * this.stride], s[t1 * this.stride + 1], r * Ye), l = []; 32172 for (const t1 of a){ 32173 const o = t1 * this.stride; 32174 s[o + 4] === e1 && l.push(this._featureJSON(s, o)); 32175 } 32176 if (0 === l.length) throw new Error(i); 32177 return l; 32178 } 32179 getLeaves(e1, t1, o) { 32180 const i = []; 32181 return this._appendLeaves(i, e1, t1 = t1 || 10, o = o || 0, 0), i; 32182 } 32183 getTile(e1, t1, o) { 32184 const i = this.trees[this._limitZoom(e1)], n = Math.pow(2, e1), { extent: s, radius: r } = this.options, a = r / s, l = Je((o - a) / n), c = Je((o + 1 + a) / n), u = { 32185 features: [] 32186 }; 32187 return this._addTileFeatures(i.range(Je((t1 - a) / n), l, Je((t1 + 1 + a) / n), c), i.data, t1, o, n, u), 0 === t1 && this._addTileFeatures(i.range(Je(1 - a / n), l, Je(1), c), i.data, n, o, n, u), t1 === n - 1 && this._addTileFeatures(i.range(Je(0), l, Je(a / n), c), i.data, -1, o, n, u), u.features.length ? u : null; 32188 } 32189 getClusterExpansionZoom(e1) { 32190 let t1 = this._getOriginZoom(e1) - 1; 32191 for(; t1 <= this.options.maxZoom;){ 32192 const o = this.getChildren(e1); 32193 if (t1++, 1 !== o.length) break; 32194 e1 = o[0].properties.cluster_id; 32195 } 32196 return t1; 32197 } 32198 _appendLeaves(e1, t1, o, i, n) { 32199 const s = this.getChildren(t1); 32200 for (const t1 of s){ 32201 const s = t1.properties; 32202 if (s && s.cluster ? n + s.point_count <= i ? n += s.point_count : n = this._appendLeaves(e1, s.cluster_id, o, i, n) : n < i ? n++ : e1.push(t1), e1.length === o) break; 32203 } 32204 return n; 32205 } 32206 _createTree(e1, o) { 32207 const i = new t1.dw(o, this.options.nodeSize, Int32Array), n = this.stride; 32208 for(let t1 = 0; t1 < o; t1++)i.add(e1[t1 * n], e1[t1 * n + 1]); 32209 return i.finish(), i.data = e1, i; 32210 } 32211 _addTileFeatures(e1, t1, o, i, n, s) { 32212 for (const r of e1){ 32213 const e1 = r * this.stride, a = t1[e1 + 5] > 1; 32214 let l, c, u; 32215 if (a) l = Qe(t1, e1, this.clusterProps), c = qe(t1[e1]), u = qe(t1[e1 + 1]); 32216 else { 32217 const o = t1[e1 + 3]; 32218 l = this.props[o], c = this.coords[2 * o], u = this.coords[2 * o + 1]; 32219 } 32220 const h = { 32221 type: 1, 32222 geometry: [ 32223 [ 32224 Math.round(this.options.extent * (c * n - o)), 32225 Math.round(this.options.extent * (u * n - i)) 32226 ] 32227 ], 32228 tags: l 32229 }, d = t1[e1 + 3], f = a || this.options.generateId ? d : this.ids ? this.ids[d] : void 0; 32230 void 0 !== f && (h.id = f), s.features.push(h); 32231 } 32232 } 32233 _limitZoom(e1) { 32234 return Math.max(this.options.minZoom, Math.min(Math.floor(+e1), this.options.maxZoom + 1)); 32235 } 32236 _cluster(e1, t1, o, i) { 32237 const { radius: n, extent: s, reduce: r, minPoints: a, maxZoom: l } = this.options, c = n / (s * (1 << o)) * Ye, u = l + 1, h = this.trees[o + 1], d = this.stride, f = t1 * d, g = new Uint32Array(t1); 32238 let p = 0; 32239 for(let t1 = 0; t1 < f; t1 += d){ 32240 if (e1[t1 + 2] <= o) continue; 32241 e1[t1 + 2] = o; 32242 const n = e1[t1], s = e1[t1 + 1], l = h.withinInto(n, s, c, g), f = e1[t1 + 5]; 32243 let m = f; 32244 for(let t1 = 0; t1 < l; t1++){ 32245 const i = g[t1] * d; 32246 e1[i + 2] > o && (m += e1[i + 5]); 32247 } 32248 if (m > f && m >= a) {
32249 let a, c = n * f, h = s * f, y = -1; 32250 const x = (t1 / d << 5) + (o + 1) + this.numPoints; 32251 for(let i = 0; i < l; i++){ 32252 const n = g[i] * d; 32253 if (e1[n + 2] <= o) continue; 32254 e1[n + 2] = o; 32255 const s = e1[n + 5]; 32256 c += e1[n] * s, h += e1[n + 1] * s, e1[n + 4] = x, r && (a || (a = this._map(e1, t1, !0), y = this.clusterProps.length, this.clusterProps.push(a)), r(a, this._map(e1, n))); 32257 } 32258 e1[t1 + 4] = x, i[p] = c / m, i[p + 1] = h / m, i[p + 2] = u, i[p + 3] = x, i[p + 4] = -1, i[p + 5] = m, r && (i[p + 6] = y), p += d; 32259 } else { 32260 for(let o = 0; o < d; o++)i[p + o] = e1[t1 + o]; 32261 if (p += d, m > 1) for(let t1 = 0; t1 < l; t1++){ 32262 const n = g[t1] * d; 32263 if (!(e1[n + 2] <= o)) { 32264 e1[n + 2] = o; 32265 for(let t1 = 0; t1 < d; t1++)i[p + t1] = e1[n + t1]; 32266 p += d; 32267 } 32268 } 32269 } 32270 } 32271 return p / d; 32272 } 32273 _getOriginId(e1) { 32274 return e1 - this.numPoints >> 5; 32275 } 32276 _getOriginZoom(e1) { 32277 return (e1 - this.numPoints) % 32; 32278 } 32279 _featureJSON(e1, t1) { 32280 const o = e1[t1 + 3], i = e1[t1 + 5] > 1, n = i ? o : this.ids ? this.ids[o] : void 0, s = { 32281 type: "Feature", 32282 properties: i ? Qe(e1, t1, this.clusterProps) : this.props[o], 32283 geometry: { 32284 type: "Point", 32285 coordinates: i ? [ 32286 tt(qe(e1[t1])), 32287 ot(qe(e1[t1 + 1])) 32288 ] : [ 32289 tt(this.coords[2 * o]), 32290 ot(this.coords[2 * o + 1]) 32291 ] 32292 } 32293 }; 32294 return void 0 !== n && (s.id = n), s; 32295 } 32296 _map(e1, t1, o) { 32297 if (e1[t1 + 5] > 1) { 32298 const i = this.clusterProps[e1[t1 + 6]]; 32299 return o ? Object.assign({}, i) : i; 32300 } 32301 const i = this.props[e1[t1 + 3]], n = this.options.map(i); 32302 return o && n === i ? Object.assign({}, n) : n; 32303 } 32304 constructor(e1){ 32305 const t1 = this.options = Object.assign(Object.create(He), e1); 32306 t1.maxZoom = Math.min(t1.maxZoom, 30), t1.minZoom = Math.min(t1.minZoom, t1.maxZoom), this.trees = new Array(t1.maxZoom + 1), this.stride = t1.reduce ? 7 : 6, this.clusterProps = []; 32307 } 32308 } 32309 function Qe(e1, t1, o) { 32310 const i = e1[t1 + 5], n = i >= 1e4 ? "".concat(Math.round(i / 1e3), "k") : i >= 1e3 ? Math.round(i / 100) / 10 + "k" : i, s = e1[t1 + 6], r = -1 === s ? {} : Object.assign({}, o[s]); 32311 return Object.assign(r, { 32312 cluster: !0, 32313 cluster_id: e1[t1 + 3], 32314 point_count: i, 32315 point_count_abbreviated: n 32316 }); 32317 } 32318 function Ke(e1) { 32319 return e1 / 360 + .5; 32320 } 32321 function et(e1) { 32322 const t1 = Math.sin(e1 * Math.PI / 180), o = .5 - .25 * Math.log((1 + t1) / (1 - t1)) / Math.PI; 32323 return o < 0 ? 0 : o > 1 ? 1 : o; 32324 } 32325 function tt(e1) { 32326 return 360 * (e1 - .5); 32327 } 32328 function ot(e1) { 32329 const t1 = (180 - 360 * e1) * Math.PI / 180; 32330 return 360 * Math.atan(Math.exp(t1)) / Math.PI - 90; 32331 } 32332 function it(e1, t1, o, i) { 32333 let n = i; 32334 const s = t1 + (o - t1 >> 1); 32335 let r, a = o - t1; 32336 const l = e1[t1], c = e1[t1 + 1], u = e1[o], h = e1[o + 1]; 32337 for(let i = t1 + 3; i < o; i += 3){ 32338 const t1 = nt(e1[i], e1[i + 1], l, c, u, h); 32339 if (t1 > n) r = i, n = t1; 32340 else if (t1 === n) { 32341 const e1 = Math.abs(i - s); 32342 e1 < a && (r = i, a = e1); 32343 } 32344 } 32345 n > i && (r - t1 > 3 && it(e1, t1, r, i), e1[r + 2] = n, o - r > 3 && it(e1, r, o, i)); 32346 } 32347 function nt(e1, t1, o, i, n, s) { 32348 let r = n - o, a = s - i; 32349 if (0 !== r || 0 !== a) { 32350 const l = ((e1 - o) * r + (t1 - i) * a) / (r * r + a * a); 32351 l > 1 ? (o = n, i = s) : l > 0 && (o += r * l, i += a * l); 32352 } 32353 return r = e1 - o, a = t1 - i, r * r + a * a; 32354 } 32355 function st(e1, t1, o, i) { 32356 const n = { 32357 id: e1 !== null && e1 !== void 0 ? e1 : null, 32358 type: t1, 32359 geometry: o, 32360 tags: i, 32361 minX: 1 / 0, 32362 minY: 1 / 0, 32363 maxX: -1 / 0, 32364 maxY: -1 / 0 32365 }; 32366 if ("Point" === t1 || "MultiPoint" === t1 || "LineString" === t1) rt(n, o); 32367 else if ("Polygon" === t1) rt(n, o[0]); 32368 else if ("MultiLineString" === t1) for (const e1 of o)rt(n, e1); 32369 else if ("MultiPolygon" === t1) for (const e1 of o)rt(n, e1[0]); 32370 return n; 32371 } 32372 function rt(e1, t1) { 32373 for(let o = 0; o < t1.length; o += 3)e1.minX = Math.min(e1.minX, t1[o]), e1.minY = Math.min(e1.minY, t1[o + 1]), e1.maxX = Math.max(e1.maxX, t1[o]), e1.maxY = Math.max(e1.maxY, t1[o + 1]); 32374 } 32375 function at(e1, t1, o, i) { 32376 if (!t1.geometry) return; 32377 const n = t1.geometry.coordinates; 32378 if (n && 0 === n.length) return; 32379 const s = t1.geometry.type, r = Math.pow(o.tolerance / ((1 << o.maxZoom) * o.extent), 2); 32380 let a = [], l = t1.id; 32381 if (o.promoteId ? l = t1.properties[o.promoteId] : o.generateId && (l = i || 0), "Point" === s) lt(n, a); 32382 else if ("MultiPoint" === s) for (const e1 of n)lt(e1, a); 32383 else if ("LineString" === s) ct(n, a, r, !1); 32384 else if ("MultiLineString" === s) { 32385 if (o.lineMetrics) {
32386 for (const o of n)a = [], ct(o, a, r, !1), e1.push(st(l, "LineString", a, t1.properties)); 32387 return; 32388 } 32389 ut(n, a, r, !1); 32390 } else if ("Polygon" === s) ut(n, a, r, !0); 32391 else { 32392 if ("MultiPolygon" !== s) { 32393 if ("GeometryCollection" === s) { 32394 for (const n of t1.geometry.geometries)at(e1, { 32395 id: l, 32396 geometry: n, 32397 properties: t1.properties 32398 }, o, i); 32399 return; 32400 } 32401 throw new Error("Input data is not a valid GeoJSON object."); 32402 } 32403 for (const e1 of n){ 32404 const t1 = []; 32405 ut(e1, t1, r, !0), a.push(t1); 32406 } 32407 } 32408 e1.push(st(l, s, a, t1.properties)); 32409 } 32410 function lt(e1, t1) { 32411 t1.push(ht(e1[0]), dt(e1[1]), 0); 32412 } 32413 function ct(e1, t1, o, i) { 32414 let n, s, r = 0; 32415 for(let o = 0; o < e1.length; o++){ 32416 const a = ht(e1[o][0]), l = dt(e1[o][1]); 32417 t1.push(a, l, 0), o > 0 && (r += i ? (n * l - a * s) / 2 : Math.sqrt(Math.pow(a - n, 2) + Math.pow(l - s, 2))), n = a, s = l; 32418 } 32419 const a = t1.length - 3; 32420 t1[2] = 1, it(t1, 0, a, o), t1[a + 2] = 1, t1.size = Math.abs(r), t1.start = 0, t1.end = t1.size; 32421 } 32422 function ut(e1, t1, o, i) { 32423 for(let n = 0; n < e1.length; n++){ 32424 const s = []; 32425 ct(e1[n], s, o, i), t1.push(s); 32426 } 32427 } 32428 function ht(e1) { 32429 return e1 / 360 + .5; 32430 } 32431 function dt(e1) { 32432 const t1 = Math.sin(e1 * Math.PI / 180), o = .5 - .25 * Math.log((1 + t1) / (1 - t1)) / Math.PI; 32433 return o < 0 ? 0 : o > 1 ? 1 : o; 32434 } 32435 function ft(e1, t1, o, i, n, s, r, a) { 32436 if (i /= t1, s >= (o /= t1) && r < i) return e1; 32437 if (r < o || s >= i) return null; 32438 const l = []; 32439 for (const t1 of e1){ 32440 const e1 = t1.geometry; 32441 let s = t1.type; 32442 const r = 0 === n ? t1.minX : t1.minY, c = 0 === n ? t1.maxX : t1.maxY; 32443 if (r >= o && c < i) { 32444 l.push(t1); 32445 continue; 32446 } 32447 if (c < o || r >= i) continue; 32448 let u = []; 32449 if ("Point" === s || "MultiPoint" === s) gt(e1, u, o, i, n); 32450 else if ("LineString" === s) pt(e1, u, o, i, n, !1, a.lineMetrics); 32451 else if ("MultiLineString" === s) yt(e1, u, o, i, n, !1); 32452 else if ("Polygon" === s) yt(e1, u, o, i, n, !0); 32453 else if ("MultiPolygon" === s) for (const t1 of e1){ 32454 const e1 = []; 32455 yt(t1, e1, o, i, n, !0), e1.length && u.push(e1); 32456 } 32457 if (u.length) { 32458 if (a.lineMetrics && "LineString" === s) { 32459 for (const e1 of u)l.push(st(t1.id, s, e1, t1.tags)); 32460 continue; 32461 } 32462 "LineString" !== s && "MultiLineString" !== s || (1 === u.length ? (s = "LineString", u = u[0]) : s = "MultiLineString"), "Point" !== s && "MultiPoint" !== s || (s = 3 === u.length ? "Point" : "MultiPoint"), l.push(st(t1.id, s, u, t1.tags)); 32463 } 32464 } 32465 return l.length ? l : null; 32466 } 32467 function gt(e1, t1, o, i, n) { 32468 for(let s = 0; s < e1.length; s += 3){ 32469 const r = e1[s + n]; 32470 r >= o && r <= i && xt(t1, e1[s], e1[s + 1], e1[s + 2]); 32471 } 32472 } 32473 function pt(e1, t1, o, i, n, s, r) { 32474 let a = mt(e1); 32475 const l = 0 === n ? vt : wt; 32476 let c, u, h = e1.start; 32477 for(let d = 0; d < e1.length - 3; d += 3){ 32478 const f = e1[d], g = e1[d + 1], p = e1[d + 2], m = e1[d + 3], y = e1[d + 4], x = 0 === n ? f : g, v = 0 === n ? m : y; 32479 let w = !1; 32480 r && (c = Math.sqrt(Math.pow(f - m, 2) + Math.pow(g - y, 2))), x < o ? v >= o && (u = l(a, f, g, m, y, o), r && (a.start = h + c * u)) : x > i ? v <= i && (u = l(a, f, g, m, y, i), r && (a.start = h + c * u)) : xt(a, f, g, p), v < o && x >= o && (u = l(a, f, g, m, y, o), w = !0), v > i && x <= i && (u = l(a, f, g, m, y, i), w = !0), !s && w && (r && (a.end = h + c * u), t1.push(a), a = mt(e1)), r && (h += c); 32481 }
32482 let d = e1.length - 3; 32483 const f = e1[d], g = e1[d + 1], p = 0 === n ? f : g; 32484 p >= o && p <= i && xt(a, f, g, e1[d + 2]), d = a.length - 3, s && d >= 3 && (a[d] !== a[0] || a[d + 1] !== a[1]) && xt(a, a[0], a[1], a[2]), a.length && t1.push(a); 32485 } 32486 function mt(e1) { 32487 const t1 = []; 32488 return t1.size = e1.size, t1.start = e1.start, t1.end = e1.end, t1; 32489 } 32490 function yt(e1, t1, o, i, n, s) { 32491 for (const r of e1)pt(r, t1, o, i, n, s, !1); 32492 } 32493 function xt(e1, t1, o, i) { 32494 e1.push(t1, o, i); 32495 } 32496 function vt(e1, t1, o, i, n, s) { 32497 const r = (s - t1) / (i - t1); 32498 return xt(e1, s, o + (n - o) * r, 1), r; 32499 } 32500 function wt(e1, t1, o, i, n, s) { 32501 const r = (s - o) / (n - o); 32502 return xt(e1, t1 + (i - t1) * r, s, 1), r; 32503 } 32504 function bt(e1, t1) { 32505 const o = []; 32506 for(let i = 0; i < e1.length; i++){ 32507 const n = e1[i], s = n.type; 32508 let r; 32509 if ("Point" === s || "MultiPoint" === s || "LineString" === s) r = St(n.geometry, t1); 32510 else if ("MultiLineString" === s || "Polygon" === s) { 32511 r = []; 32512 for (const e1 of n.geometry)r.push(St(e1, t1)); 32513 } else if ("MultiPolygon" === s) { 32514 r = []; 32515 for (const e1 of n.geometry){ 32516 const o = []; 32517 for (const i of e1)o.push(St(i, t1)); 32518 r.push(o); 32519 } 32520 } 32521 o.push(st(n.id, s, r, n.tags)); 32522 } 32523 return o; 32524 } 32525 function St(e1, t1) { 32526 const o = []; 32527 o.size = e1.size, void 0 !== e1.start && (o.start = e1.start, o.end = e1.end); 32528 for(let i = 0; i < e1.length; i += 3)o.push(e1[i] + t1, e1[i + 1], e1[i + 2]); 32529 return o; 32530 } 32531 function It(e1, t1) { 32532 if (e1.transformed) return e1; 32533 const o = 1 << e1.z, i = e1.x, n = e1.y; 32534 for (const s of e1.features){ 32535 const e1 = s.geometry, r = s.type; 32536 if (s.geometry = [], 1 === r) for(let r = 0; r < e1.length; r += 2)s.geometry.push(Pt(e1[r], e1[r + 1], t1, o, i, n)); 32537 else for(let r = 0; r < e1.length; r++){ 32538 const a = []; 32539 for(let s = 0; s < e1[r].length; s += 2)a.push(Pt(e1[r][s], e1[r][s + 1], t1, o, i, n)); 32540 s.geometry.push(a); 32541 } 32542 } 32543 return e1.transformed = !0, e1; 32544 } 32545 function Pt(e1, t1, o, i, n, s) { 32546 return [ 32547 Math.round(o * (e1 * i - n)), 32548 Math.round(o * (t1 * i - s)) 32549 ]; 32550 } 32551 function Mt(e1, t1, o, i, n) { 32552 const s = t1 === n.maxZoom ? 0 : n.tolerance / ((1 << t1) * n.extent), r = { 32553 features: [], 32554 numPoints: 0, 32555 numSimplified: 0, 32556 numFeatures: e1.length, 32557 source: null, 32558 x: o, 32559 y: i, 32560 z: t1, 32561 transformed: !1, 32562 minX: 2, 32563 minY: 1, 32564 maxX: -1, 32565 maxY: 0 32566 }; 32567 for (const t1 of e1)Tt(r, t1, s, n); 32568 return r; 32569 } 32570 function Tt(e1, t1, o, i) { 32571 const n = t1.geometry, s = t1.type, r = []; 32572 if (e1.minX = Math.min(e1.minX, t1.minX), e1.minY = Math.min(e1.minY, t1.minY), e1.maxX = Math.max(e1.maxX, t1.maxX), e1.maxY = Math.max(e1.maxY, t1.maxY), "Point" === s || "MultiPoint" === s) for(let t1 = 0; t1 < n.length; t1 += 3)r.push(n[t1], n[t1 + 1]), e1.numPoints++, e1.numSimplified++; 32573 else if ("LineString" === s) zt(r, n, e1, o, !1, !1); 32574 else if ("MultiLineString" === s || "Polygon" === s) for(let t1 = 0; t1 < n.length; t1++)zt(r, n[t1], e1, o, "Polygon" === s, 0 === t1); 32575 else if ("MultiPolygon" === s) for(let t1 = 0; t1 < n.length; t1++){ 32576 const i = n[t1]; 32577 for(let t1 = 0; t1 < i.length; t1++)zt(r, i[t1], e1, o, !0, 0 === t1); 32578 } 32579 if (r.length) { 32580 let o = t1.tags || null; 32581 if ("LineString" === s && i.lineMetrics) { 32582 o = {}; 32583 for(const e1 in t1.tags)o[e1] = t1.tags[e1]; 32584 o.mapbox_clip_start = n.start / n.size, o.mapbox_clip_end = n.end / n.size; 32585 } 32586 const a = { 32587 geometry: r, 32588 type: "Polygon" === s || "MultiPolygon" === s ? 3 : "LineString" === s || "MultiLineString" === s ? 2 : 1, 32589 tags: o 32590 }; 32591 null !== t1.id && (a.id = t1.id), e1.features.push(a); 32592 } 32593 } 32594 function zt(e1, t1, o, i, n, s) { 32595 const r = i * i; 32596 if (i > 0 && t1.size < (n ? r : i)) return void (o.numPoints += t1.length / 3); 32597 const a = []; 32598 for(let e1 = 0; e1 < t1.length; e1 += 3)(0 === i || t1[e1 + 2] > r) && (o.numSimplified++, a.push(t1[e1], t1[e1 + 1])), o.numPoints++; 32599 n && function(e1, t1) { 32600 let o = 0;
32601 for(let t1 = 0, i = e1.length, n = i - 2; t1 < i; n = t1, t1 += 2)o += (e1[t1] - e1[n]) * (e1[t1 + 1] + e1[n + 1]); 32602 if (o > 0 === t1) for(let t1 = 0, o = e1.length; t1 < o / 2; t1 += 2){ 32603 const i = e1[t1], n = e1[t1 + 1]; 32604 e1[t1] = e1[o - 2 - t1], e1[t1 + 1] = e1[o - 1 - t1], e1[o - 2 - t1] = i, e1[o - 1 - t1] = n; 32605 } 32606 }(a, s), e1.push(a); 32607 } 32608 const Bt = { 32609 maxZoom: 14, 32610 indexMaxZoom: 5, 32611 indexMaxPoints: 1e5, 32612 tolerance: 3, 32613 extent: 4096, 32614 buffer: 64, 32615 lineMetrics: !1, 32616 promoteId: null, 32617 generateId: !1, 32618 debug: 0 32619 }; 32620 class kt { 32621 splitTile(e1, t1, o, i, n, s, r) { 32622 const a = [ 32623 e1, 32624 t1, 32625 o, 32626 i 32627 ], l = this.options, c = l.debug; 32628 for(; a.length;){ 32629 i = a.pop(), o = a.pop(), t1 = a.pop(), e1 = a.pop(); 32630 const u = 1 << t1, h = Ct(t1, o, i); 32631 let d = this.tiles[h]; 32632 if (!d && (c > 1 && console.time("creation"), d = this.tiles[h] = Mt(e1, t1, o, i, l), this.tileCoords.push({ 32633 z: t1, 32634 x: o, 32635 y: i 32636 }), c)) { 32637 c > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", t1, o, i, d.numFeatures, d.numPoints, d.numSimplified), console.timeEnd("creation")); 32638 const e1 = "z".concat(t1); 32639 this.stats[e1] = (this.stats[e1] || 0) + 1, this.total++; 32640 } 32641 if (d.source = e1, null == n) { 32642 if (t1 === l.indexMaxZoom || d.numPoints <= l.indexMaxPoints) continue; 32643 } else { 32644 if (t1 === l.maxZoom || t1 === n) continue; 32645 if (null != n) { 32646 const e1 = n - t1; 32647 if (o !== s >> e1 || i !== r >> e1) continue; 32648 } 32649 } 32650 if (d.source = null, 0 === e1.length) continue; 32651 c > 1 && console.time("clipping"); 32652 const f = .5 * l.buffer / l.extent, g = .5 - f, p = .5 + f, m = 1 + f; 32653 let y = null, x = null, v = null, w = null; 32654 const b = ft(e1, u, o - f, o + p, 0, d.minX, d.maxX, l), S = ft(e1, u, o + g, o + m, 0, d.minX, d.maxX, l); 32655 b && (y = ft(b, u, i - f, i + p, 1, d.minY, d.maxY, l), x = ft(b, u, i + g, i + m, 1, d.minY, d.maxY, l)), S && (v = ft(S, u, i - f, i + p, 1, d.minY, d.maxY, l), w = ft(S, u, i + g, i + m, 1, d.minY, d.maxY, l)), c > 1 && console.timeEnd("clipping"), a.push(y || [], t1 + 1, 2 * o, 2 * i), a.push(x || [], t1 + 1, 2 * o, 2 * i + 1), a.push(v || [], t1 + 1, 2 * o + 1, 2 * i), a.push(w || [], t1 + 1, 2 * o + 1, 2 * i + 1); 32656 } 32657 } 32658 getTile(e1, t1, o) { 32659 e1 = +e1, t1 = +t1, o = +o; 32660 const i = this.options, { extent: n, debug: s } = i; 32661 if (e1 < 0 || e1 > 24) return null; 32662 const r = 1 << e1, a = Ct(e1, t1 = t1 + r & r - 1, o); 32663 if (this.tiles[a]) return It(this.tiles[a], n); 32664 s > 1 && console.log("drilling down to z%d-%d-%d", e1, t1, o); 32665 let l, c = e1, u = t1, h = o; 32666 for(; !l && c > 0;)c--, u >>= 1, h >>= 1, l = this.tiles[Ct(c, u, h)]; 32667 return l && l.source ? (s > 1 && (console.log("found parent tile z%d-%d-%d", c, u, h), console.time("drilling down")), this.splitTile(l.source, c, u, h, e1, t1, o), s > 1 && console.timeEnd("drilling down"), this.tiles[a] ? It(this.tiles[a], n) : null) : null; 32668 } 32669 constructor(e1, t1){ 32670 const o = (t1 = this.options = function(e1, t1) { 32671 for(const o in t1)e1[o] = t1[o]; 32672 return e1; 32673 }(Object.create(Bt), t1)).debug; 32674 if (o && console.time("preprocess data"), t1.maxZoom < 0 || t1.maxZoom > 24) throw new Error("maxZoom should be in the 0-24 range"); 32675 if (t1.promoteId && t1.generateId) throw new Error("promoteId and generateId cannot be used together."); 32676 let i = function(e1, t1) { 32677 const o = []; 32678 if ("FeatureCollection" === e1.type) for(let i = 0; i < e1.features.length; i++)at(o, e1.features[i], t1, i); 32679 else at(o, "Feature" === e1.type ? e1 : { 32680 geometry: e1 32681 }, t1); 32682 return o; 32683 }(e1, t1); 32684 this.tiles = {}, this.tileCoords = [], o && (console.timeEnd("preprocess data"), console.log("index: maxZoom: %d, maxPoints: %d", t1.indexMaxZoom, t1.indexMaxPoints), console.time("generate tiles"), this.stats = {}, this.total = 0), i = function(e1, t1) { 32685 const o = t1.buffer / t1.extent; 32686 let i = e1; 32687 const n = ft(e1, 1, -1 - o, o, 0, -1, 2, t1), s = ft(e1, 1, 1 - o, 2 + o, 0, -1, 2, t1); 32688 return (n || s) && (i = ft(e1, 1, -o, 1 + o, 0, -1, 2, t1) || [], n && (i = bt(n, 1).concat(i)), s && (i = i.concat(bt(s, -1)))), i; 32689 }(i, t1), i.length && this.splitTile(i, 0, 0, 0), o && (i.length && console.log("features: %d, points: %d", this.tiles[0].numFeatures, this.tiles[0].numPoints), console.timeEnd("generate tiles"), console.log("tiles generated:", this.total, JSON.stringify(this.stats))); 32690 } 32691 } 32692 function Ct(e1, t1, o) { 32693 return 32 * ((1 << e1) * o + t1) + e1; 32694 } 32695 function Dt(e1, o) { 32696 const i = e1.tileID.canonical; 32697 if (!this._geoJSONIndex) return void o(null, null); 32698 const n = this._geoJSONIndex.getTile(i.z, i.x, i.y); 32699 if (!n) return void o(null, null); 32700 const s = (e1)=>e1.tags && "3d_elevation_id" in e1.tags && "source" in e1.tags && "elevation" === e1.tags.source, r = n.features.filter((e1)=>s(e1)); 32701 let a = { 32702 _geojsonTileLayer: n.features 32703 }; 32704 r.length > 0 && (a = { 32705 _geojsonTileLayer: n.features.filter((e1)=>
32705!s(e1)), 32706 hd_road_elevation: r 32707 }); 32708 const l = new Be(a), c = function(e1) { 32709 const o = new t1.gj; 32710 for (const t1 of Object.keys(e1))o.writeMessage(3, je, { 32711 name: t1, 32712 features: e1[t1] 32713 }); 32714 return o.finish(); 32715 }(a).buffer; 32716 o(null, { 32717 vectorTile: l, 32718 rawData: c, 32719 headers: new Headers 32720 }); 32721 } 32722 class Lt extends Ie { 32723 async loadData(e1) { 32724 const i = e1 && e1.request, n = i && i.collectResourceTiming; 32725 this._geoJSONIndex = null; 32726 let s = await new Promise((t1, o)=>{ 32727 this.loadGeoJSON(e1, (e1, i)=>{ 32728 e1 ? o(e1) : t1(i); 32729 }); 32730 }); 32731 if (!s) return {}; 32732 if ("object" != typeof s) throw new Error("Input data given to '".concat(e1.source, "' is not a valid GeoJSON object.")); 32733 if (e1.filter) { 32734 const o = t1.c(e1.filter, { 32735 type: "boolean", 32736 "property-type": "data-driven", 32737 overridable: !1, 32738 transition: !1 32739 }); 32740 if ("error" === o.result) throw new Error(o.value.map((e1)=>"".concat(e1.key, ": ").concat(e1.message)).join(", ")); 32741 s.features = s.features.filter((e1)=>o.value.evaluate({ 32742 zoom: 0 32743 }, e1)); 32744 } 32745 e1.dynamic ? ("Feature" === s.type && (s = { 32746 type: "FeatureCollection", 32747 features: [ 32748 s 32749 ] 32750 }), e1.append || (this._dynamicIndex.clear(), this.loaded = {}), this._dynamicIndex.load(s.features, this.loaded), e1.cluster && (s.features = this._dynamicIndex.getFeatures())) : this.loaded = {}, this._geoJSONIndex = e1.cluster ? new We(function(param) { 32751 let { superclusterOptions: e1, clusterProperties: o } = param; 32752 if (!o || !e1) return e1; 32753 const i = {}, n = {}, s = { 32754 accumulated: null, 32755 zoom: 0 32756 }, r = { 32757 properties: null 32758 }, a = Object.keys(o); 32759 for (const e1 of a){ 32760 const [s, r] = o[e1], a = t1.c(r), l = t1.c("string" == typeof s ? [ 32761 s, 32762 [ 32763 "accumulated" 32764 ], 32765 [ 32766 "get", 32767 e1 32768 ] 32769 ] : s); 32770 i[e1] = a.value, n[e1] = l.value; 32771 } 32772 return e1.map = (e1)=>{ 32773 r.properties = e1; 32774 const t1 = {}; 32775 for (const e1 of a)t1[e1] = i[e1].evaluate(s, r); 32776 return t1; 32777 }, e1.reduce = (e1, t1)=>{ 32778 r.properties = t1; 32779 for (const t1 of a)s.accumulated = e1[t1], e1[t1] = n[t1].evaluate(s, r); 32780 }, e1; 32781 }(e1)).load(s.features) : e1.dynamic ? this._dynamicIndex : function(e1, t1) { 32782 return new kt(e1, t1); 32783 }(s, e1.geojsonVtOptions); 32784 const r = {}; 32785 if (n) { 32786 const t1 = o(i); 32787 t1 && (r.resourceTiming = {}, r.resourceTiming[e1.source] = JSON.parse(JSON.stringify(t1))); 32788 } 32789 return r; 32790 } 32791 async reloadTile(e1) { 32792 const t1 = this.loaded; 32793 if (t1 && t1[e1.uid]) { 32794 if (e1.partial) return; 32795 return super.reloadTile(e1); 32796 } 32797 return this.loadTile(e1); 32798 } 32799 loadGeoJSON(e1, o) { 32800 if (e1.request) t1.g(e1.request).then((param)=>{ 32801 let { data: e1 } = param; 32802 return o(null, e1); 32803 }).catch((e1)=>o(e1)); 32804 else { 32805 if ("string" != typeof e1.data) return o(new Error("Input data given to '".concat(e1.source, "' is not a valid GeoJSON object."))); 32806 setTimeout(()=>{ 32807 try { 32808 return o(null, JSON.parse(e1.data)); 32809 } catch (t1) { 32810 return o(new Error("Input data given to '".concat(e1.source, "' is not a valid GeoJSON object."))); 32811 } 32812 }, 0); 32813 } 32814 } 32815 getClusterExpansionZoom(e1) { 32816 return this._geoJSONIndex.getClusterExpansionZoom(e1.clusterId); 32817 } 32818 getClusterChildren(e1) { 32819 return this._geoJSONIndex.getChildren(e1.clusterId); 32820 } 32821 getClusterLeaves(e1) { 32822 return this._geoJSONIndex.getLeaves(e1.clusterId, e1.limit, e1.offset); 32823 } 32824 constructor(e1){ 32825 super(e1), this.loadVectorData = Dt, this._dynamicIndex = new Ce; 32826 } 32827 } 32828 t1.c$.setPbf(t1.d0); 32829 class At { 32830 async parse(e1) { 32831 const o = this._mrt; 32832 this.status = "parsing", this._entireBuffer = e1, o.parseHeader(e1), this._isHeaderLoaded = !0; 32833 const i = []; 32834 for(const n in o.layers){ 32835 const s = o.getLayer(n), r = s.getDataRange(s.getBandList()), a = o.createDecodingTask(r), l = e1.slice(r.firstByte, r.lastByte + 1); 32836 i.push(t1.c$.performDecoding(l, a).then((e1)=>a.complete(null, e1)).catch((e1)=>a.complete(e1, null))); 32837 } 32838 return await Promise.allSettled(i), o; 32839 } 32840 constructor(e1){ 32841 this._mrt = new t1.c$(e1.partial ? 30 : 1 / 0), this._isHeaderLoaded = !1, this.uid = e1.uid, this.tileID = e1.tileID, this.source = e1.source; 32842 } 32843 } 32844 class Ft { 32845 async loadTile(e1) { 32846 const o = e1.uid, i = new AbortController, n = this.loading[o] = new At(e1); 32847 n.abort = ()=>i.abort(); 32848 try { 32849 const { data: s, headers: r } = await t1.d1(e1.request, i.signal); 32850 return s ? (this.loaded[o] = n, { 32851 mrt: await n.parse(s), 32852 headers: r 32853 }) : (n.status = "done", this.loaded[o] = n, null); 32854 } catch (e1) { 32855 if (i.signal.aborted) return null; 32856 throw n.status = "done", this.loaded[o] = n, e1; 32857 } finally{ 32858 delete this.loading[o]; 32859 } 32860 } 32861 async reloadTile(e1) {} 32862 abortTile(e1) { 32863 const t1 = e1.uid, o = this.loading[t1]; 32864 o && (o.abort && o.abort(), delete this.loading[t1]); 32865 } 32866 removeTile(e1) { 32867 const t1 = e1.uid; 32868 this.loaded[t1] && delete this.loaded[t1]; 32869 } 32870 async decodeRasterArray(e1) { 32871 return t1.c$.performDecoding(e1.buffer, e1.task); 32872 } 32873 constructor({ actor: e1 }){ 32874 this.actor = e1, this.loading = {}, this.loaded = {}; 32875 } 32876 } 32877 class _t { 32878 clearCaches(e1, t1) { 32879 delete this.layerIndexes[e1], delete this.availableImages[e1], delete this.availableModels[e1], delete this.workerSources[e1], delete this.isSpriteLoaded[e1]; 32880 } 32881 checkIfReady(e1, t1) {} 32882 spriteLoaded(e1, o) { 32883 const { scope: i } = o; 32884 if (this.isSpriteLoaded[e1] || (this.isSpriteLoaded[e1] = {}), this.isSpriteLoaded[e1][i] = !0, this.workerSources[e1] && this.workerSources[e1][i]) for(const o in this.workerSources[e1][i]){ 32885 const n = this.workerSources[e1][i][o]; 32886 for(const e1 in n){ 32887 const o = n[e1]; 32888 o instanceof Ie && (o.isSpriteLoaded = !0, o.fire(new t1.h("isSpriteLoaded"))); 32889 } 32890 } 32891 } 32892 setImages(e1, t1) { 32893 this.availableImages[e1] || (this.availableImages[e1] = {}); 32894 const { scope: o, images: i } = t1;
32895 if (this.availableImages[e1][o] = i, t1.isSpriteLoaded && this.spriteLoaded(e1, { 32896 scope: o 32897 }), this.workerSources[e1] && this.workerSources[e1][o]) for(const t1 in this.workerSources[e1][o]){ 32898 const n = this.workerSources[e1][o][t1]; 32899 for(const e1 in n)n[e1].availableImages = i; 32900 } 32901 } 32902 setModels(e1, param) { 32903 let { scope: t1, models: o } = param; 32904 if (this.availableModels[e1] || (this.availableModels[e1] = {}), this.availableModels[e1][t1] = o, this.workerSources[e1] && this.workerSources[e1][t1]) for(const i in this.workerSources[e1][t1]){ 32905 const n = this.workerSources[e1][t1][i]; 32906 for(const e1 in n)n[e1].availableModels = o; 32907 } 32908 } 32909 setProjection(e1, o) { 32910 this.projections[e1] = t1.gl(o); 32911 } 32912 setGlobalParams(e1, o) { 32913 if (this.referrer = o.referrer, Object.assign(t1.eM, o.config), o.contextOptions) { 32914 const { maxBindingPoints: e1, maxUniformBlockSizeDwords: t1 } = o.contextOptions; 32915 this.maxUniformBufferBindings = e1, this.maxUniformBlockSizeDwords = t1; 32916 } 32917 } 32918 upsertRenderParams(e1, t1) { 32919 void 0 !== t1.brightness && (this.brightness = t1.brightness), void 0 !== t1.worldview && (this.worldview = t1.worldview); 32920 } 32921 setLayers(e1, t1) { 32922 this.getLayerIndex(e1, t1.scope).replace(t1.layers, t1.options); 32923 } 32924 updateLayers(e1, t1) { 32925 this.getLayerIndex(e1, t1.scope).update(t1.layers, t1.removedIds, t1.options); 32926 } 32927 async loadTile(e1, o) { 32928 if (o.projection = this.projections[e1] || this.defaultProjection, "batched-model" === o.type && !this.workerSourceTypes["batched-model"]) { 32929 if (await t1.gn(), !x) throw new Error('Could not load Standard module for "batched-model" source.'); 32930 this.workerSourceTypes["batched-model"] = x; 32931 } 32932 return "raster-array" === o.type && await this.ensureRasterArrayWorkerSource(), this.getWorkerSource(e1, o).loadTile(o); 32933 } 32934 async ensureRasterArraySource(e1, t1) { 32935 await this.ensureRasterArrayWorkerSource(); 32936 } 32937 async ensureRasterArrayWorkerSource() { 32938 if (!this.workerSourceTypes["raster-array"]) { 32939 if (await async function() { 32940 return Promise.resolve(); 32941 }(), !Ft) throw new Error('Could not load raster-array module for "raster-array" source.'); 32942 this.workerSourceTypes["raster-array"] = Ft; 32943 } 32944 } 32945 async decodeRasterArray(e1, t1) { 32946 return await this.ensureRasterArrayWorkerSource(), this.getWorkerSource(e1, t1).decodeRasterArray(t1); 32947 } 32948 reloadTile(e1, t1) { 32949 return t1.projection = this.projections[e1] || this.defaultProjection, this.getWorkerSource(e1, t1).reloadTile(t1); 32950 } 32951 abortTile(e1, t1) { 32952 const o = this.getExistingWorkerSource(e1, t1); 32953 return o ? o.abortTile(t1) : void 0; 32954 } 32955 removeTile(e1, t1) { 32956 const o = this.getExistingWorkerSource(e1, t1); 32957 return o ? o.removeTile(t1) : void 0; 32958 } 32959 getExistingWorkerSource(e1, t1) { 32960 const { type: o, source: i, scope: n } = t1, s = this.workerSources[e1]; 32961 if (s && s[n] && s[n][o]) return s[n][o][i]; 32962 } 32963 async removeSource(e1, t1) { 32964 const { type: o, source: i, scope: n } = t1, s = this.workerSources[e1] && this.workerSources[e1][n] && this.workerSources[e1][n][o], r = s && s[i]; 32965 r && (delete s[i], r.removeSource && await r.removeSource({ 32966 source: i 32967 })); 32968 } 32969 async loadTileProvider(e1, o) { 32970 const i = new (await t1.cO(o.name, o.url))(o.options); 32971 return this.getWorkerSource(e1, { 32972 type: o.type, 32973 source: o.source, 32974 scope: o.scope 32975 }, i), i.load && o.request ? i.load({ 32976 request: o.request 32977 }) : null; 32978 } 32979 async syncRTLPluginState(e1, o) { 32980 if (t1.fH.isParsed()) return !0; 32981 if (t1.fH.isParsing()) return new Promise((e1, t1)=>{ 32982 this.rtlPluginParsingListeners.push({ 32983 resolve: e1, 32984 reject: t1 32985 }); 32986 }); 32987 t1.fH.setState(o); 32988 const i = t1.fH.getPluginURL(); 32989 if (!t1.fH.isLoaded() || t1.fH.isParsed() || t1.fH.isParsing()) return !1; 32990 t1.fH.setState({ 32991 pluginStatus: t1.gm.parsing, 32992 pluginURL: i 32993 }); 32994 try { 32995 return await self.__mapboxImport(/* webpackIgnore: true */ /* @vite-ignore */ i), !!t1.fH.isParsed() || new Promise((e1, t1)=>{ 32996 this.rtlPluginParsingListeners.push({ 32997 resolve: e1, 32998 reject: t1 32999 }); 33000 }); 33001 } catch (e1) { 33002 t1.fH.setState({ 33003 pluginStatus: t1.gm.error, 33004 pluginURL: i 33005 }); 33006 for (const { reject: t1 } of this.rtlPluginParsingListeners)t1(e1); 33007 throw this.rtlPluginParsingListeners = [], e1; 33008 } 33009 } 33010 getAvailableImages(e1, t1) { 33011 this.availableImages[e1] || (this.availableImages[e1] = {}); 33012 let o = this.availableImages[e1][t1];
33013 return o || (o = []), o; 33014 } 33015 getAvailableModels(e1, t1) { 33016 this.availableModels[e1] || (this.availableModels[e1] = {}); 33017 let o = this.availableModels[e1][t1]; 33018 return o || (o = {}), o; 33019 } 33020 getLayerIndex(e1, t1) { 33021 this.layerIndexes[e1] || (this.layerIndexes[e1] = {}); 33022 let o = this.layerIndexes[e1][t1]; 33023 return o || (o = this.layerIndexes[e1][t1] = new S, o.scope = t1), o; 33024 } 33025 getWorkerSource(e1, t1, o) { 33026 const { type: i, source: n, scope: s } = t1, r = this.workerSources; 33027 if (r[e1] || (r[e1] = {}), r[e1][s] || (r[e1][s] = {}), r[e1][s][i] || (r[e1][s][i] = {}), this.isSpriteLoaded[e1] || (this.isSpriteLoaded[e1] = {}), this.getExistingWorkerSource(e1, t1)) o && (r[e1][s][i][n].tileProvider = o); 33028 else { 33029 const t1 = this.actor.getWorkerSourceActor(e1), a = this.workerSourceTypes[i]; 33030 if (!a) throw new Error('Unknown worker source type "'.concat(i, '".')); 33031 r[e1][s][i][n] = new a({ 33032 actor: t1, 33033 layerIndex: this.getLayerIndex(e1, s), 33034 availableImages: this.getAvailableImages(e1, s), 33035 availableModels: this.getAvailableModels(e1, s), 33036 isSpriteLoaded: this.isSpriteLoaded[e1][s], 33037 tileProvider: o, 33038 brightness: this.brightness, 33039 worldview: this.worldview, 33040 maxUniformBufferBindings: this.maxUniformBufferBindings, 33041 maxUniformBlockSizeDwords: this.maxUniformBlockSizeDwords 33042 }); 33043 } 33044 return r[e1][s][i][n]; 33045 } 33046 enforceCacheSizeLimit(e1, o) { 33047 t1.go(o); 33048 } 33049 constructor(e1){ 33050 this.self = e1, this.actor = new t1.aw(e1, this), this.layerIndexes = {}, this.availableImages = {}, this.availableModels = {}, this.isSpriteLoaded = {}, this.rtlPluginParsingListeners = [], this.projections = {}, this.defaultProjection = t1.gl({ 33051 name: "mercator" 33052 }), this.workerSourceTypes = { 33053 vector: Ie, 33054 geojson: Lt, 33055 "raster-dem": Pe 33056 }, this.workerSources = {}, this.self.registerRTLTextPlugin = (e1)=>{ 33057 if (t1.fH.isParsed()) throw new Error("RTL text plugin already registered."); 33058 t1.fH.setState({ 33059 pluginStatus: t1.gm.parsed, 33060 pluginURL: t1.fH.getPluginURL() 33061 }), t1.fH.applyArabicShaping = e1.applyArabicShaping, t1.fH.processBidirectionalText = e1.processBidirectionalText, t1.fH.processStyledBidirectionalText = e1.processStyledBidirectionalText; 33062 for (const { resolve: e1 } of this.rtlPluginParsingListeners)e1(!0); 33063 this.rtlPluginParsingListeners = []; 33064 }; 33065 } 33066 } 33067 return t1.gk(self) && (self.worker = new _t(self)), _t; 33068 }); 33069 define([ 33070 "./shared" 33071 ], function(e1) { 33072 const t1 = { 33073 antialias: !1, 33074 alpha: !0, 33075 stencil: !0, 33076 depth: !0 33077 }; 33078 let i, s; 33079 function r(e1) { 33080 const i = document.createElement("canvas"), s = Object.create(t1); 33081 s.failIfMajorPerformanceCaveat = e1; 33082 const r = i.getContext("webgl2", s); 33083 if (!r) return !1; 33084 let o; 33085 try { 33086 o = r.createShader(r.VERTEX_SHADER); 33087 } catch (e1) { 33088 return !1; 33089 } 33090 return !(!o || r.isContextLost()) && (r.shaderSource(o, "void main() {}"), r.compileShader(o), !0 === r.getShaderParameter(o, r.COMPILE_STATUS)); 33091 } 33092 const o = /firefox/i, n = /macintosh/i; 33093 function a(e1, t1, i) { 33094 const s = document.createElement(e1); 33095 return null != t1 && (s.className = t1), i && i.appendChild(s), s; 33096 } 33097 function l(e1, t1, i) { 33098 const s = document.createElementNS("http://www.w3.org/2000/svg", e1); 33099 for (const e1 of Object.keys(t1))s.setAttributeNS(null, e1, String(t1[e1])); 33100 return i && i.appendChild(s), s; 33101 } 33102 const c = "undefined" != typeof document ? document.documentElement && document.documentElement.style : null, h = c && void 0 !== c.userSelect ? "userSelect" : "WebkitUserSelect"; 33103 let d; 33104 function u() { 33105 c && h && (d = c[h], c[h] = "none"); 33106 } 33107 function p() { 33108 c && h && (c[h] = d); 33109 } 33110 function f(e1) { 33111 e1.preventDefault(), e1.stopPropagation(), window.removeEventListener("click", f, !0); 33112 } 33113 function m() { 33114 window.addEventListener("click", f, !0), window.setTimeout(()=>{ 33115 window.removeEventListener("click", f, !0); 33116 }, 0); 33117 } 33118 function _(e1, t1) { 33119 const i = e1.getBoundingClientRect(); 33120 return v(e1, i, t1); 33121 } 33122 function g(e1, t1) { 33123 const i = e1.getBoundingClientRect(), s = []; 33124 for(let r = 0; r < t1.length; r++)s.push(v(e1, i, t1[r])); 33125 return s; 33126 } 33127 function y(e1) { 33128 return o.test(navigator.userAgent) && n.test(navigator.userAgent) && 2 === e1.button && e1.ctrlKey ? 0 : e1.button; 33129 } 33130 function v(t1, i, s) { 33131 const r = t1.offsetWidth === i.width ? 1 : t1.offsetWidth / i.width; 33132 return new e1.P((s.clientX - i.left) * r, (s.clientY - i.top) * r); 33133 } 33134 class b { 33135 isDirty() { 33136 return this._changed; 33137 } 33138 setDirty() { 33139 this._changed = !0; 33140 }
33141 getUpdatedSourceCaches() { 33142 return this._updatedSourceCaches; 33143 } 33144 updateSourceCache(e1, t1) { 33145 this._updatedSourceCaches[e1] = t1, this.setDirty(); 33146 } 33147 discardSourceCacheUpdate(e1) { 33148 delete this._updatedSourceCaches[e1]; 33149 } 33150 updateLayer(e1) { 33151 const t1 = e1.scope; 33152 this._updatedLayers[t1] = this._updatedLayers[t1] || new Set, this._updatedLayers[t1].add(e1.id), this.setDirty(); 33153 } 33154 removeLayer(e1) { 33155 const t1 = e1.scope; 33156 this._removedLayers[t1] = this._removedLayers[t1] || {}, this._updatedLayers[t1] = this._updatedLayers[t1] || new Set, this._removedLayers[t1][e1.id] = e1, this._updatedLayers[t1].delete(e1.id), this._updatedPaintProps.delete(e1.fqid), this.setDirty(); 33157 } 33158 getRemovedLayer(e1) { 33159 return this._removedLayers[e1.scope] ? this._removedLayers[e1.scope][e1.id] : null; 33160 } 33161 discardLayerRemoval(e1) { 33162 this._removedLayers[e1.scope] && delete this._removedLayers[e1.scope][e1.id]; 33163 } 33164 getLayerUpdatesByScope() { 33165 const e1 = {}; 33166 for(const t1 in this._updatedLayers)e1[t1] = e1[t1] || {}, e1[t1].updatedIds = Array.from(this._updatedLayers[t1].values()); 33167 for(const t1 in this._removedLayers)e1[t1] = e1[t1] || {}, e1[t1].removedIds = Object.keys(this._removedLayers[t1]); 33168 return e1; 33169 } 33170 getUpdatedPaintProperties() { 33171 return this._updatedPaintProps; 33172 } 33173 updatePaintProperties(e1) { 33174 this._updatedPaintProps.add(e1.fqid), this.setDirty(); 33175 } 33176 getUpdatedImages(e1) { 33177 return this._updatedImages[e1] ? Array.from(this._updatedImages[e1].values()) : []; 33178 } 33179 updateImage(t1, i) { 33180 this._updatedImages[i] = this._updatedImages[i] || new Set, this._updatedImages[i].add(e1.I.toString(t1)), this.setDirty(); 33181 } 33182 resetUpdatedImages(e1) { 33183 this._updatedImages[e1] && this._updatedImages[e1].clear(); 33184 } 33185 reset() { 33186 this._changed = !1, this._updatedLayers = Object.create(null), this._removedLayers = Object.create(null), this._updatedSourceCaches = Object.create(null), this._updatedPaintProps.clear(), this._updatedImages = Object.create(null); 33187 } 33188 constructor(){ 33189 this._changed = !1, this._updatedLayers = Object.create(null), this._removedLayers = Object.create(null), this._updatedSourceCaches = Object.create(null), this._updatedPaintProps = new Set, this._updatedImages = Object.create(null); 33190 } 33191 } 33192 class x { 33193 invalidateFilter() { 33194 this._filterDependencies = void 0; 33195 } 33196 get _filterDeps() { 33197 return void 0 === this._filterDependencies && (this._filterDependencies = this._computeFilterDepen
33197dencies()), this._filterDependencies; 33198 } 33199 _computeFilterDependencies() { 33200 const t1 = this._layer; 33201 if (!t1.type || "custom" === t1.type || "background" === t1.type || "sky" === t1.type || "slot" === t1.type) return null; 33202 const i = e1.c(t1.filter, e1.s["filter_".concat(t1.type)]); 33203 return "error" === i.result ? null : { 33204 configDependencies: i.value.configDependencies, 33205 isIndoorDependent: i.value.isIndoorDependent 33206 }; 33207 } 33208 hasConfigDependency(e1) { 33209 const { _unevaluatedLayout: t1, _transitionablePaint: i } = this._layer; 33210 if (t1 && t1.configDependencies.has(e1)) return !0; 33211 if (i && i.configDependencies.has(e1)) return !0; 33212 const s = this._filterDeps; 33213 return !!s && s.configDependencies.has(e1); 33214 } 33215 get isConfigDependent() { 33216 const { _unevaluatedLayout: e1, _transitionablePaint: t1 } = this._layer; 33217 if (e1 && 0 !== e1.configDependencies.size) return !0; 33218 if (t1 && 0 !== t1.configDependencies.size) return !0; 33219 const i = this._filterDeps; 33220 return !!i && 0 !== i.configDependencies.size; 33221 } 33222 get isIndoorDependent() { 33223 const { _unevaluatedLayout: e1, _transitionablePaint: t1 } = this._layer; 33224 if (e1 && e1.isIndoorDependent()) return !0; 33225 if (t1 && t1.isIndoorDependent()) return !0; 33226 const i = this._filterDeps; 33227 return !!i && i.isIndoorDependent; 33228 } 33229 constructor(e1){ 33230 this._layer = e1, this._filterDependencies = void 0; 33231 } 33232 } 33233 function w(e1) { 33234 const { userImage: t1 } = e1; 33235 return !!(t1 && t1.render && t1.render()) && (e1.data.replace(new Uint8Array(t1.data.buffer)), !0); 33236 } 33237 const T = new e1.C(0, 0, 0); 33238 function S(e1, t1) { 33239 const i = [], s = e1["stretch_".concat(t1)]; 33240 let r = null; 33241 for(let e1 = 0; e1 < s.length; e1++)null === r ? r = 0 === i.length ? s[0] : i.at(-1)[1] + s[e1] : (i.push([ 33242 r, 33243 r + s[e1] 33244 ]), r = null); 33245 e1["stretch_".concat(t1, "_areas")] = i; 33246 } 33247 function C(e1, t1) { 33248 const i = { 33249 name: void 0 33250 }; 33251 let s; 33252 for(; s = e1.nextField(t1);)1 === s ? i.name = e1.readString() : 2 === s ? i.metadata = E(e1, e1.readVarint() + e1.pos) : 3 === s && (i.usvg_tree = P(e1, e1.readVarint() + e1.pos), i.data = "usvg_tree"); 33253 return function(e1) { 33254 if (e1.usvg_tree.height || (e1.usvg_tree.height = e1.usvg_tree.width), !e1.metadata) return e1; 33255 const { metadata: t1 } = e1; 33256 if (t1.content_area) { 33257 var _i, _left, _i1, _top, _i2, _width, _i3, _height; 33258 const { content_area: i } = t1; 33259 (_left = (_i = i).left) !== null && _left !== void 0 ? _left : _i.left = 0, (_top = (_i1 = i).top) !== null && _top !== void 0 ? _top : _i1.top = i.left, (_width = (_i2 = i).width) !== null && _width !== void 0 ? _width : _i2.width = e1.usvg_tree.width, (_height = (_i3 = i).height) !== null && _height !== void 0 ? _height : _i3.height = i.width; 33260 } 33261 if (t1.text_placeholder) { 33262 var _e, _top1, _e1, _height1; 33263 const { text_placeholder: e1 } = t1; 33264 (_top1 = (_e = e1).top) !== null && _top1 !== void 0 ? _top1 : _e.top = e1.left, (_height1 = (_e1 = e1).height) !== null && _height1 !== void 0 ? _height1 : _e1.height = e1.width; 33265 } 33266 return t1.stretch_x && t1.stretch_x.length && S(t1, "x"), t1.stretch_y && t1.stretch_y.length && S(t1, "y"), e1; 33267 }(i); 33268 } 33269 function E(e1, t1) { 33270 const i = { 33271 stretch_x: null, 33272 stretch_y: null, 33273 stretch_x_areas: null, 33274 stretch_y_areas: null, 33275 variables: [] 33276 }; 33277 let s; 33278 for(; s = e1.nextField(t1);)1 === s ? i.stretch_x = e1.readPackedVarint() : 2 === s ? i.stretch_y = e1.readPackedVarint() : 3 === s ? i.content_area = I(e1, e1.readVarint() + e1.pos) : 4 === s ? i.variables.push(D(e1, e1.readVarint() + e1.pos)) : 5 === s && (i.text_placeholder = I(e1, e1.readVarint() + e1.pos)); 33279 return i; 33280 } 33281 function I(e1, t1) { 33282 const i = {}; 33283 let s; 33284 for(; s = e1.nextField(t1);)1 === s ? i.left = e1.readVarint() : 2 === s ? i.width = e1.readVarint() : 3 === s ? i.top = e1.readVarint() : 4 === s && (i.height = e1.readVarint()); 33285 return i; 33286 } 33287 function D(e1, t1) { 33288 const i = { 33289 name: void 0 33290 }; 33291 let s; 33292 for(; s = e1.nextField(t1);)1 === s ? i.name = e1.readString() : 2 === s && (i.rgb_color = k(e1.readVarint()), i.value = "rgb_color"); 33293 return i; 33294 } 33295 function P(e1, t1) { 33296 const i = { 33297 width: 20, 33298 children: [], 33299 linear_gradients: [], 33300 radial_gradients: [], 33301 clip_paths: [], 33302 masks: [], 33303 height: 20 33304 }; 33305 let s; 33306 for(; s = e1.nextField(t1);)1 === s ? i.width = i.height = e1.readVarint() : 2 === s ? i.height = e1.readVarint() : 3 === s ? i.children.push(L(e1, e1.readVarint() + e1.pos)) : 4 === s ? i.linear_gradients.push(B(e1, e1.readVarint() + e1.pos)) : 5 === s ? i.radial_gradients.push(U(e1, e1.readVarint() + e1.pos)) : 7 === s ? i.clip_paths.push(N(e1, e1.readVarint() + e1.pos)) : 8 === s && i.masks.push(j(e1, e1.readVarint() + e1.pos)); 33307 return i; 33308 } 33309 function L(e1, t1) { 33310 const i = {}; 33311 let s; 33312 for(; s = e1.nextField(t1);)1 === s ? (i.group = R(e1, e1.readVarint() + e1.pos), i.node = "group") : 2 === s && (i.path = M(e1, e1.readVarint() + e1.pos), i.node = "path"); 33313 return i; 33314 } 33315 function R(e1, t1) { 33316 const i = { 33317 opacity: 255, 33318 children: [] 33319 }; 33320 let s; 33321 for(; s = e1.nextField(t1);)1 === s ? i.transform = A(e1, e1.readVarint() + e1.pos) : 2 === s ? i.opacity = e1.readVarint() : 5 === s ? i.clip_path_idx = e1.readVarint() : 6 === s ? i.mask_idx = e1.readVarint() : 7 === s && i.children.push(L(e1, e1.readVarint() + e1.pos)); 33322 return i; 33323 } 33324 function A(e1, t1) { 33325 const i = { 33326 sx: 1, 33327 ky: 0, 33328 kx: 0, 33329 sy: 1, 33330 tx: 0, 33331 ty: 0 33332 }; 33333 let s; 33334 for(; s = e1.nextField(t1);)1 === s ? i.sx = e1.readFloat() : 2 === s ? i.ky = e1.readFloat() : 3 === s ? i.kx = e1.readFloat() : 4 === s ? i.sy = e1.readFloat() : 5 === s ? i.tx = e1.readFloat() : 6 === s && (i.ty = e1.readFloat()); 33335 return i; 33336 } 33337 function M(e1, t1) { 33338 const i = { 33339 paint_order: 1, 33340 commands: [], 33341 step: 1, 33342 diffs: [], 33343 rule: 1 33344 }; 33345 let s; 33346 for(; s = e1.nextField(t1);)1 === s ? i.fill = O(e1, e1.readVarint() + e1.pos) : 2 === s ? i.stroke = F(e1, e1.readVarint() + e1.pos) : 3 === s ? i.paint_order = e1.readVarint() : 5 === s ? e1.readPackedVarint(i.commands) : 6 === s ? i.step = e1.readFloat() : 7 === s ? e1.readPackedSVarint(i.diffs) : 8 === s && (i.rule = e1.readVarint()); 33347 return i; 33348 } 33349 function O(e1, t1) { 33350 const i = { 33351 rgb_color: T, 33352 paint: "rgb_color", 33353 opacity: 255 33354 }; 33355 let s; 33356 for(; s = e1.nextField(t1);)1 === s ? (i.rgb_color = k(e1.readVarint()), i.paint = "rgb_color") : 2 === s ? (i.linear_gradient_idx = e1.readVarint(), i.paint = "linear_gradient_idx") : 3 === s ? (i.radial_gradient_idx = e1.readVarint(), i.paint = "radial_gradient_idx") : 5 === s && (i.op
33356acity = e1.readVarint()); 33357 return i; 33358 } 33359 function F(e1, t1) { 33360 const i = { 33361 rgb_color: T, 33362 paint: "rgb_color", 33363 dasharray: [], 33364 dashoffset: 0, 33365 miterlimit: 4, 33366 opacity: 255, 33367 width: 1, 33368 linecap: 1, 33369 linejoin: 1 33370 }; 33371 let s; 33372 for(; s = e1.nextField(t1);)1 === s ? (i.rgb_color = k(e1.readVarint()), i.paint = "rgb_color") : 2 === s ? (i.linear_gradient_idx = e1.readVarint(), i.paint = "linear_gradient_idx") : 3 === s ? (i.radial_gradient_idx = e1.readVarint(), i.paint = "radial_gradient_idx") : 5 === s ? e1.readPackedFloat(i.dasharray) : 6 === s ? i.dashoffset = e1.readFloat() : 7 === s ? i.miterlimit = e1.readFloat() : 8 === s ? i.opacity = e1.readVarint() : 9 === s ? i.width = e1.readFloat() : 10 === s ? i.linecap = e1.readVarint() : 11 === s && (i.linejoin = e1.readVarint()); 33373 return i; 33374 } 33375 function k(t1) { 33376 return new e1.C((t1 >> 16 & 255) / 255, (t1 >> 8 & 255) / 255, (255 & t1) / 255, 1); 33377 } 33378 function B(e1, t1) { 33379 const i = { 33380 spread_method: 1, 33381 stops: [], 33382 x1: 0, 33383 y1: 0, 33384 x2: 1, 33385 y2: 0 33386 }; 33387 let s; 33388 for(; s = e1.nextField(t1);)1 === s ? i.transform = A(e1, e1.readVarint() + e1.pos) : 2 === s ? i.spread_method = e1.readVarint() : 3 === s ? i.stops.push(z(e1, e1.readVarint() + e1.pos)) : 4 === s ? i.x1 = e1.readFloat() : 5 === s ? i.y1 = e1.readFloat() : 6 === s ? i.x2 = e1.readFloat() : 7 === s && (i.y2 = e1.readFloat()); 33389 return i; 33390 } 33391 function z(e1, t1) { 33392 const i = { 33393 offset: 0, 33394 opacity: 255, 33395 rgb_color: T 33396 }; 33397 let s; 33398 for(; s = e1.nextField(t1);)1 === s ? i.offset = e1.readFloat() : 2 === s ? i.opacity = e1.readVarint() : 3 === s && (i.rgb_color = k(e1.readVarint())); 33399 return i; 33400 } 33401 function U(e1, t1) { 33402 const i = { 33403 spread_method: 1, 33404 stops: [], 33405 cx: .5, 33406 cy: .5, 33407 r: .5, 33408 fx: .5, 33409 fy: .5, 33410 fr: 0 33411 }; 33412 let s; 33413 for(; s = e1.nextField(t1);)1 === s ? i.transform = A(e1, e1.readVarint() + e1.pos) : 2 === s ? i.spread_method = e1.readVarint() : 3 === s ? i.stops.push(z(e1, e1.readVarint() + e1.pos)) : 4 === s ? i.cx = e1.readFloat() : 5 === s ? i.cy = e1.readFloat() : 6 === s ? i.r = e1.readFloat() : 7 === s ? i.fx = e1.readFloat() : 8 === s ? i.fy = e1.readFloat() : 9 === s && (i.fr = e1.readFloat()); 33414 return i; 33415 } 33416 function N(e1, t1) { 33417 const i = { 33418 children: [] 33419 }; 33420 let s; 33421 for(; s = e1.nextField(t1);)1 === s ? i.transform = A(e1, e1.readVarint() + e1.pos) : 2 === s ? i.clip_path_idx = e1.readVarint() : 3 === s && i.children.push(L(e1, e1.readVarint() + e1.pos)); 33422 return i; 33423 } 33424 function j(e1, t1) { 33425 var _i, _height, _i1, _top; 33426 const i = { 33427 left: 0, 33428 width: 20, 33429 mask_type: 1, 33430 children: [] 33431 }; 33432 let s; 33433 for(; s = e1.nextField(t1);)1 === s ? i.left = i.top = e1.readFloat() : 2 === s ? i.width = i.height = e1.readFloat() : 3 === s ? i.top = e1.readFloat() : 4 === s ? i.height = e1.readFloat() : 5 === s ? i.mask_type = e1.readVarint() : 6 === s ? i.mask_idx = e1.readVarint() : 7 === s && i.children.push(L(e1, e1.readVarint() + e1.pos)); 33434 return (_height = (_i = i).height) !== null && _height !== void 0 ? _height : _i.height = i.width, (_top = (_i1 = i).top) !== null && _top !== void 0 ? _top : _i1.top = i.left, i; 33435 } 33436 class V { 33437 static calculate() { 33438 let t1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : []; 33439 const s = new Map, r = new Map; 33440 if (0 === Object.keys(t1).length) return s;
33441 i.forEach((t1)=>{ 33442 r.set(t1.name, t1.rgb_color || new e1.C(0, 0, 0)); 33443 }); 33444 for (const [e1, i] of Object.entries(t1))r.has(e1) ? s.set(r.get(e1).toString(), i) : console.warn('Ignoring unknown image variable "'.concat(e1, '"')); 33445 return s; 33446 } 33447 } 33448 function G(t1) { 33449 let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 255, s = arguments.length > 2 ? arguments[2] : void 0; 33450 const r = s.get(t1.toString()) || t1; 33451 return 255 === i ? r.toString() : new e1.C(r.r, r.g, r.b, r.a * i / 255).toString(); 33452 } 33453 const q = []; 33454 let Z = 0; 33455 function $(t1, i) { 33456 if (Z >= q.length) { 33457 const s = e1.o() ? new OffscreenCanvas(t1, i).getContext("2d", { 33458 willReadFrequently: !0 33459 }) : document.createElement("canvas").getContext("2d", { 33460 willReadFrequently: !0 33461 }); 33462 q.push(s); 33463 } 33464 const s = q[Z++]; 33465 return s.canvas.width = t1, s.canvas.height = i, s; 33466 } 33467 function H() { 33468 Z--; 33469 } 33470 function W(e1, t1, i, s, r) { 33471 for (const o of s.children)X(e1, t1, i, o, r); 33472 } 33473 function X(e1, t1, i, s, r) { 33474 s.group ? (e1.save(), function(e1, t1, i, s, r) { 33475 const o = null != s.mask_idx ? i.masks[s.mask_idx] : null, n = null != s.clip_path_idx ? i.clip_paths[s.clip_path_idx] : null; 33476 if (s.transform && (t1 = re(s.transform).preMultiplySelf(t1)), !function(e1, t1, i) { 33477 return 255 !== e1.opacity || t1 || i; 33478 }(s, null != n, null != o)) return void W(e1, t1, i, s, r); 33479 const a = $(e1.canvas.width, e1.canvas.height); 33480 W(a, t1, i, s, r), n && ie(a, t1, i, n), o && se(a, t1, i, o, r), e1.globalAlpha = s.opacity / 255, e1.drawImage(a.canvas, 0, 0), H(); 33481 }(e1, t1, i, s.group, r), e1.restore()) : s.path && (e1.save(), function(e1, t1, i, s, r) { 33482 e1.setTransform(t1), 1 === s.paint_order ? (K(e1, i, s, r), Q(e1, i, s, r)) : (Q(e1, i, s, r), K(e1, i, s, r)); 33483 }(e1, t1, i, s.path, r), e1.restore()); 33484 } 33485 function K(e1, t1, i, s) { 33486 const r = i.fill; 33487 if (!r) return; 33488 const o = r.opacity / 255; 33489 switch(e1.save(), e1.beginPath(), oe(i, e1), r.paint){ 33490 case "rgb_color": 33491 e1.fillStyle = G(r.rgb_color, r.opacity, s); 33492 break; 33493 case "linear_gradient_idx": 33494 { 33495 const i = t1.linear_gradients[r.linear_gradient_idx]; 33496 i.transform && e1.setTransform(re(i.transform).preMultiplySelf(e1.getTransform())), e1.fillStyle = J(e1, i, o, s); 33497 break; 33498 } 33499 case "radial_gradient_idx": 33500 { 33501 const i = t1.radial_gradients[r.radial_gradient_idx]; 33502 i.transform && e1.setTransform(re(i.transform).preMultiplySelf(e1.getTransform())), e1.fillStyle = ee(e1, i, o, s); 33503 } 33504 } 33505 e1.fill(Y(i)), e1.restore(); 33506 } 33507 function Y(e1) { 33508 return 1 === e1.rule ? "nonzero" : 2 === e1.rule ? "evenodd" : void 0; 33509 } 33510 function Q(e1, t1, i, s) { 33511 const r = i.stroke; 33512 if (!r) return; 33513 const o = ne(i); 33514 e1.lineWidth = r.width, e1.miterLimit = r.miterlimit, e1.setLineDash(r.dasharray), e1.lineDashOffset = r.dashoffset; 33515 const n = r.opacity / 255; 33516 switch(r.paint){ 33517 case "rgb_color": 33518 e1.strokeStyle = G(r.rgb_color, r.opacity, s); 33519 break; 33520 case "linear_gradient_idx": 33521 e1.strokeStyle = J(e1, t1.linear_gradients[r.linear_gradient_idx], n, s, !0); 33522 break; 33523 case "radial_gradient_idx": 33524 e1.strokeStyle = ee(e1, t1.radial_gradients[r.radial_gradient_idx], n, s, !0); 33525 } 33526 switch(r.linejoin){ 33527 case 2: 33528 case 1: 33529 e1.lineJoin = "miter"; 33530 break; 33531 case 3: 33532 e1.lineJoin = "round"; 33533 break; 33534 case 4: 33535 e1.lineJoin = "bevel"; 33536 } 33537 switch(r.linecap){ 33538 case 1: 33539 e1.lineCap = "butt"; 33540 break; 33541 case 2: 33542 e1.lineCap = "round"; 33543 break; 33544 case 3: 33545 e1.lineCap = "square"; 33546 } 33547 e1.stroke(o); 33548 } 33549 function J(e1, t1, i, s) { 33550 let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1; 33551 if (1 === t1.stops.length) { 33552 const e1 = t1.stops[0]; 33553 return G(e1.rgb_color, e1.opacity * i, s); 33554 } 33555 const { x1: o, y1: n, x2: a, y2: l } = t1; 33556 let c = new DOMPoint(o, n), h = new DOMPoint(a, l); 33557 if (r) { 33558 const e1 = re(t1.transform); 33559 c = e1.transformPoint(c), h = e1.transformPoint(h); 33560 } 33561 const d = e1.createLinearGradient(c.x, c.y, h.x, h.y); 33562 for (const e1 of t1.stops)d.addColorStop(e1.offset, G(e1.rgb_color, e1.opacity * i, s)); 33563 return d; 33564 } 33565 function ee(e1, t1, i, s) { 33566 let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1; 33567 if (1 === t1.stops.length) { 33568 const e1 = t1.stops[0]; 33569 return G(e1.rgb_color, e1.opacity * i, s); 33570 } 33571 const o = re(t1.transform), { fx: n, fy: a, fr: l, cx: c, cy: h, r: d } = t1; 33572 let u = new DOMPoint(n, a), p = new DOMPoint(c, h), f = l, m = d; 33573 if (r) { 33574 u = o.transformPoint(u), p = o.transformPoint(p); 33575 const e1 = (o.a + o.d) / 2; 33576 f = l * e1, m = t1.r * e1; 33577 } 33578 const _ = e1.createRadialGradient(u.x, u.y, f, p.x, p.y, m); 33579 for (const e1 of t1.stops)_.addColorStop(e1.offset, G(e1.rgb_color, e1.opacity * i, s)); 33580 return _; 33581 } 33582 function te(e1, t1, i, s) { 33583 const r = s.transform ? re(s.transform).preMultiplySelf(t1) : t1, o = $(e1.canvas.width, e1.canvas.height);
vendor: 12,618 bytes, lines 33584-33836
33584 for (const e1 of s.children)if (e1.group) te(o, r, i, e1.group); 33585 else if (e1.path) { 33586 const t1 = e1.path, i = new Path2D; 33587 i.addPath(ne(t1), r), o.fill(i, Y(t1)); 33588 } 33589 const n = null != s.clip_path_idx ? i.clip_paths[s.clip_path_idx] : null; 33590 n && ie(o, r, i, n), e1.globalCompositeOperation = "source-over", e1.drawImage(o.canvas, 0, 0), H(); 33591 } 33592 function ie(e1, t1, i, s) { 33593 const r = $(e1.canvas.width, e1.canvas.height); 33594 te(r, t1, i, s), e1.globalCompositeOperation = "destination-in", e1.drawImage(r.canvas, 0, 0), H(); 33595 } 33596 function se(e1, t1, i, s, r) { 33597 if (0 === s.children.length) return; 33598 const o = null != s.mask_idx ? i.masks[s.mask_idx] : null; 33599 o && se(e1, t1, i, o, r); 33600 const n = e1.canvas.width, a = e1.canvas.height, l = $(n, a), c = s.width, h = s.height, d = s.left, u = s.top, p = new Path2D, f = new Path2D; 33601 f.rect(d, u, c, h), p.addPath(f, t1), l.clip(p); 33602 for (const e1 of s.children)X(l, t1, i, e1, r); 33603 const m = l.getImageData(0, 0, n, a), _ = m.data; 33604 if (1 === s.mask_type) for(let e1 = 0; e1 < _.length; e1 += 4)_[e1 + 3] = _[e1 + 3] / 255 * (.2126 * _[e1] + .7152 * _[e1 + 1] + .0722 * _[e1 + 2]); 33605 l.putImageData(m, 0, 0), e1.globalCompositeOperation = "destination-in", e1.drawImage(l.canvas, 0, 0), H(); 33606 } 33607 function re(e1) { 33608 return e1 ? new DOMMatrix([ 33609 e1.sx, 33610 e1.ky, 33611 e1.kx, 33612 e1.sy, 33613 e1.tx, 33614 e1.ty 33615 ]) : new DOMMatrix; 33616 } 33617 function oe(e1, t1) { 33618 const i = e1.step; 33619 let s = e1.diffs[0] * i, r = e1.diffs[1] * i; 33620 t1.moveTo(s, r); 33621 for(let o = 0, n = 2; o < e1.commands.length; o++)switch(e1.commands[o]){ 33622 case 1: 33623 s += e1.diffs[n++] * i, r += e1.diffs[n++] * i, t1.moveTo(s, r); 33624 break; 33625 case 2: 33626 s += e1.diffs[n++] * i, r += e1.diffs[n++] * i, t1.lineTo(s, r); 33627 break; 33628 case 3: 33629 { 33630 const o = s + e1.diffs[n++] * i, a = r + e1.diffs[n++] * i; 33631 s = o + e1.diffs[n++] * i, r = a + e1.diffs[n++] * i, t1.quadraticCurveTo(o, a, s, r); 33632 break; 33633 } 33634 case 4: 33635 { 33636 const o = s + e1.diffs[n++] * i, a = r + e1.diffs[n++] * i, l = o + e1.diffs[n++] * i, c = a + e1.diffs[n++] * i; 33637 s = l + e1.diffs[n++] * i, r = c + e1.diffs[n++] * i, t1.bezierCurveTo(o, a, l, c, s, r); 33638 break; 33639 } 33640 case 5: 33641 t1.closePath(); 33642 } 33643 return t1; 33644 } 33645 function ne(e1) { 33646 return oe(e1, new Path2D); 33647 } 33648 class ae { 33649 static _getImage(t1) { 33650 return new e1.b(t1, t1.data); 33651 } 33652 getFromCache(t1, i, s) { 33653 return this.cacheMap.has(s) || this.cacheMap.set(s, new e1.L(150)), this.cacheMap.get(s).get(e1.m(t1.toString(), i)); 33654 } 33655 setInCache(t1, i, s, r) { 33656 this.cacheDependenciesMap.has(r) || this.cacheDependenciesMap.set(r, new Map), this.cacheMap.has(r) || this.cacheMap.set(r, new e1.L(150)); 33657 const o = this.cacheDependenciesMap.get(r), n = e1.m(t1.id.toString(), s); 33658 o.get(n) || o.set(n, new Set); 33659 const a = this.cacheMap.get(r), l = t1.toString(); 33660 o.get(n).add(l), a.put(e1.m(t1.toString(), s), i); 33661 } 33662 removeImagesFromCacheByIds(t1, i) { 33663 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0; 33664 if (!this.cacheMap.has(s) || !this.cacheDependenciesMap.has(s)) return; 33665 const r = this.cacheMap.get(s), o = this.cacheDependenciesMap.get(s); 33666 for (const s of t1){ 33667 const t1 = e1.m(s.toString(), i); 33668 if (o.has(t1)) { 33669 for (const e1 of o.get(t1))r.delete(e1); 33670 o.delete(t1); 33671 } 33672 } 33673 } 33674 rasterize(e1, t1, i, s) { 33675 const r = this.getFromCache(e1, i, s); 33676 if (r) return r.clone(); 33677 const o = function(e1, t1) { 33678 const i = V.calculate(t1.params, e1.metadata ? e1.metadata.variables : []), s = e1.usvg_tree, r = s.width, o = s.height, n = Math.max(1, Math.round(r * t1.sx)), a = Math.max(1, Math.round(o * t1.sy)), l = new DOMMatrix([ 33679 n / r, 33680 0, 33681 0, 33682 a / o, 33683 0, 33684 0 33685 ]), c = $(n, a); 33686 W(c, l, s, s, i); 33687 const h = c.getImageData(0, 0, n, a); 33688 return H(), h; 33689 }(t1.icon, e1), n = ae._getImage(o); 33690 return this.setInCache(e1, n, i, s), n.clone(); 33691 } 33692 constructor(){ 33693 this.cacheMap = new Map, this.cacheDependenciesMap = new Map; 33694 } 33695 } 33696 class le extends e1.E { 33697 addScope(t1) { 33698 this.loaded.set(t1, !1), this.imageProviders.set(t1, new Map), this.images.set(t1, new Map), this.updatedImages.set(t1, new Set), this.callbackDispatchedThisFrame.set(t1, new Set), this.imageVersions.set(t1, new Map), this.patterns.set(t1, new Map), this.atlasImage.set(t1, new e1.b({ 33699 width: 1, 33700 height: 1 33701 })); 33702 } 33703 removeScope(e1) { 33704 this.loaded.delete(e1), this.imageProviders.delete(e1), this.images.delete(e1), this.updatedImages.delete(e1), this.callbackDispatchedThisFrame.delete(e1), this.imageVersions.delete(e1), this.patterns.delete(e1), this.atlasImage.delete(e1); 33705 const t1 = this.atlasTexture.get(e1); 33706 t1 && (t1.destroy(), this.atlasTexture.delete(e1)); 33707 } 33708 addImageProvider(e1, t1) { 33709 this.imageProviders.has(t1) || this.imageProviders.set(t1, new Map), this.imageProviders.get(t1).set(e1.id, e1); 33710 } 33711 removeImageProvider(e1, t1) { 33712 this.imageProviders.has(t1) && this.imageProviders.get(t1).delete(e1); 33713 } 33714 getPendingImageProviders() { 33715 const e1 = []; 33716 for (const t1 of this.imageProviders.values())for (const i of t1.values())i.hasPendingRequests() && e1.push(i); 33717 return e1; 33718 } 33719 isLoaded() { 33720 for (const e1 of this.loaded.keys())if (!this.loaded.get(e1)) return !1; 33721 return !0; 33722 } 33723 setLoaded(e1, t1) { 33724 if (this.loaded.get(t1) !== e1 && (this.loaded.set(t1, e1), e1)) { 33725 for (const { ids: e1, callback: i } of this.requestors)this._notify(e1, t1, i); 33726 this.requestors = []; 33727 } 33728 } 33729 hasImage(e1, t1) { 33730 return !!this.getImage(e1, t1); 33731 } 33732 getImage(e1, t1) { 33733 return this.images.get(t1).get(e1.toString()); 33734 } 33735 addImage(e1, t1, i) { 33736 if (this._validate(e1, i)) { 33737 this.images.get(t1).set(e1.toString(), i); 33738 const s = this.imageVersions.get(t1), r = s.get(e1.toString()) || 0; 33739 s.set(e1.toString(), r + 1); 33740 } 33741 } 33742 _validate(t1, i) { 33743 let s = !0; 33744 return this._validateStretch(i.stretchX, i.data && i.data.width) || (this.fire(new e1.f(new Error('Image "'.concat(t1.name, '" has invalid "stretchX" value')))), s = !1), this._validateStretch(i.stretchY, i.data && i.data.height) || (this.fire(new e1.f(new Error('Image "'.concat(t1.name, '" has invalid "stretchY" value')))), s = !1), this._validateContent(i.content, i) || (this.fire(new e1.f(new Error('Image "'.concat(t1.name, '" has invalid "content" value')))), s = !1), s; 33745 } 33746 _validateStretch(e1, t1) { 33747 if (!e1) return !0; 33748 let i = 0; 33749 for (const s of e1){ 33750 if (s[0] < i || s[1] < s[0] || t1 < s[1]) return !1; 33751 i = s[1]; 33752 } 33753 return !0; 33754 } 33755 _validateContent(e1, t1) { 33756 if (!e1) return !0; 33757 if (4 !== e1.length) return !1; 33758 if (!t1.usvg) { 33759 if (e1[0] < 0 || t1.data.width < e1[0]) return !1; 33760 if (e1[1] < 0 || t1.data.height < e1[1]) return !1; 33761 if (e1[2] < 0 || t1.data.width < e1[2]) return !1; 33762 if (e1[3] < 0 || t1.data.height < e1[3]) return !1; 33763 } 33764 return !(e1[2] < e1[0] || e1[3] < e1[1]); 33765 } 33766 updateImage(e1, t1, i) { 33767 const s = this.images.get(t1).get(e1.toString()); 33768 i.version = s.version + 1, this.images.get(t1).set(e1.toString(), i), this.updatedImages.get(t1).add(e1); 33769 const r = this.imageVersions.get(t1), o = r.get(e1.toString()) || 0; 33770 r.set(e1.toString(), o + 1), this.removeFromImageRasterizerCache(e1, t1); 33771 } 33772 clearUpdatedImages(e1) { 33773 this.updatedImages.get(e1).clear(); 33774 } 33775 removeFromImageRasterizerCache(e1, t1) { 33776 "raster" !== this.spriteFormat && this.imageRasterizer.removeImagesFromCacheByIds([ 33777 e1 33778 ], t1); 33779 } 33780 removeImage(e1, t1) { 33781 const i = this.images.get(t1), s = i.get(e1.toString()); 33782 i.delete(e1.toString()); 33783 const r = this.imageVersions.get(t1), o = r.get(e1.toString()) || 0; 33784 r.set(e1.toString(), o + 1), this.patterns.get(t1).delete(e1.toString()), this.removeFromImageRasterizerCache(e1, t1), s.userImage && s.userImage.onRemove && s.userImage.onRemove(); 33785 } 33786 listImages(t1) { 33787 return Array.from(this.images.get(t1).keys()).map((t1)=>e1.I.from(t1)); 33788 } 33789 getImageVersions(e1) { 33790 return this.imageVersions.get(e1) || new Map; 33791 } 33792 hasImageProviderForSource(e1, t1) { 33793 const i = this.imageProviders.get(t1); 33794 if (!i) return !1; 33795 for (const t1 of i.values())if (t1.sourceCache.getSource().id === e1) return !0; 33796 return !1; 33797 } 33798 getImages(e1, t1, i) { 33799 const s = [], r = [], o = this.imageProviders.get(t1); 33800 for (const i of e1){ 33801 if (!i.iconsetId) { 33802 s.push(i); 33803 continue; 33804 } 33805 const e1 = o.get(i.iconsetId); 33806 e1 && (this.getImage(i, t1) ? r.push(i) : e1.addPendingRequest(i)); 33807 } 33808 if (0 === s.length) return void this._notify(r, t1, i); 33809 let n = !0; 33810 const a = !!this.loaded.get(t1), l = this.images.get(t1); 33811 if (!a) for (const e1 of s)l.has(e1.toString()) || (n = !1); 33812 a || n ? this._notify(s, t1, i) : this.requestors.push({ 33813 ids: s, 33814 scope: t1, 33815 callback: i 33816 }); 33817 } 33818 rasterizeImages(e1, t1) { 33819 const i = new Map, { iconTasks: s, patternTasks: r, scope: o } = e1; 33820 for (const e1 of [ 33821 s, 33822 r 33823 ])for (const [t1, s] of e1.entries()){ 33824 const e1 = this.getImage(s.id, o); 33825 e1 && i.set(t1, { 33826 image: e1, 33827 imageVariant: s 33828 }); 33829 } 33830 t1(null, this._rasterizeImages(o, i)); 33831 } 33832 _rasterizeImages(e1, t1) { 33833 const i = new Map; 33834 for (const [s, { image: r, imageVariant: o }] of t1.entries())i.set(s, this.imageRasterizer.rasterize(o, r, e1, 0)); 33835 return i; 33836 }
33837 getUpdatedImages(e1) { 33838 return this.updatedImages.get(e1) || new Set; 33839 } 33840 _notify(t1, i, s) { 33841 const r = this.images.get(i), o = new Map; 33842 for (const i of t1){ 33843 if (!r.get(i.toString())) { 33844 if (i.iconsetId) continue; 33845 this.fire(new e1.h("styleimagemissing", { 33846 id: i.name 33847 })); 33848 } 33849 const t1 = r.get(i.toString()); 33850 if (!t1) { 33851 e1.w('Image "'.concat(i.name, '" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.')); 33852 continue; 33853 } 33854 const s = { 33855 data: t1.usvg ? null : t1.data.clone(), 33856 pixelRatio: t1.pixelRatio, 33857 sdf: t1.sdf, 33858 usvg: t1.usvg, 33859 stretchX: t1.stretchX, 33860 stretchY: t1.stretchY, 33861 content: t1.content, 33862 hasRenderCallback: Boolean(t1.userImage && t1.userImage.render) 33863 }; 33864 t1.usvg && Object.assign(s, { 33865 width: t1.icon.usvg_tree.width, 33866 height: t1.icon.usvg_tree.height 33867 }), o.set(e1.I.toString(i), s); 33868 } 33869 s(null, { 33870 images: o, 33871 versions: this.getImageVersions(i) 33872 }); 33873 } 33874 getPixelSize(e1) { 33875 const { width: t1, height: i } = this.atlasImage.get(e1); 33876 return { 33877 width: t1, 33878 height: i 33879 }; 33880 } 33881 getPattern(t1, i, s) { 33882 const r = t1.toString(), o = this.patterns.get(i), n = o.get(r), a = this.getImage(t1, i); 33883 if (!a) return null; 33884 if (n) { 33885 if (n.position.version === a.version) return n.position; 33886 n.position.version = a.version; 33887 } else { 33888 if (a.usvg && !a.data) { 33889 const o = this.getPatternInFlightId(r, i); 33890 if (this.patternsInFlight.has(o)) return null; 33891 this.patternsInFlight.add(o); 33892 const n = new e1.i(t1).scaleSelf(e1.e.devicePixelRatio), l = new Map([ 33893 [ 33894 n.toString(), 33895 { 33896 image: a, 33897 imageVariant: n 33898 } 33899 ] 33900 ]), c = this._rasterizeImages(i, l); 33901 return this.storePatternImage(n, i, a, s, c), null; 33902 } 33903 this.storePattern(t1, i, a); 33904 } 33905 return this._updatePatternAtlas(i, s), o.get(r).position; 33906 } 33907 getPatternInFlightId(t1, i) { 33908 return e1.m(t1, i); 33909 } 33910 hasPatternsInFlight() { 33911 return 0 !== this.patternsInFlight.size; 33912 } 33913 storePatternImage(e1, t1, i, s, r) { 33914 const o = e1.toString(), n = r ? r.get(o) : void 0; 33915 n && (i.data = n, this.storePattern(e1.id, t1, i), this._updatePatternAtlas(t1, s), this.patternsInFlight.delete(this.getPatternInFlightId(e1.id.toString(), t1))); 33916 } 33917 storePattern(t1, i, s) { 33918 const r = { 33919 w: s.data.width + 2 * e1.j, 33920 h: s.data.height + 2 * e1.j, 33921 x: 0, 33922 y: 0 33923 }, o = new e1.k(r, s, e1.j); 33924 this.patterns.get(i).set(t1.toString(), { 33925 bin: r, 33926 position: o 33927 }); 33928 } 33929 destroyAtlasTextures() { 33930 for (const e1 of this.atlasTexture.values())e1 && e1.destroy(); 33931 this.atlasTexture.clear(); 33932 } 33933 bind(t1, i) { 33934 const s = t1.gl; 33935 let r = this.atlasTexture.get(i); 33936 r ? this.dirty && (r.update(this.atlasImage.get(i)), this.dirty = !1) : (r = new e1.T(t1, this.atlasImage.get(i), s.RGBA8), this.atlasTexture.set(i, r)), r.bind(s.LINEAR, s.CLAMP_TO_EDGE); 33937 } 33938 _updatePatternAtlas(t1, i) { 33939 const s = this.patterns.get(t1), r = Array.from(s.values()).map((param)=>{ 33940 let { bin: e1 } = param; 33941 return e1; 33942 }
33942), { w: o, h: n } = e1.p(r), a = this.atlasImage.get(t1); 33943 a.resize({ 33944 width: o || 1, 33945 height: n || 1 33946 }); 33947 const l = this.images.get(t1); 33948 for (const [t1, { bin: r, position: o }] of s.entries()){ 33949 let s = o.padding; 33950 const n = r.x + s, c = r.y + s, h = l.get(t1).data, d = h.width, u = h.height; 33951 s = s > 1 ? s - 1 : s, e1.b.copy(h, a, { 33952 x: 0, 33953 y: 0 33954 }, { 33955 x: n, 33956 y: c 33957 }, { 33958 width: d, 33959 height: u 33960 }, i), e1.b.copy(h, a, { 33961 x: 0, 33962 y: u - s 33963 }, { 33964 x: n, 33965 y: c - s 33966 }, { 33967 width: d, 33968 height: s 33969 }, i), e1.b.copy(h, a, { 33970 x: 0, 33971 y: 0 33972 }, { 33973 x: n, 33974 y: c + u 33975 }, { 33976 width: d, 33977 height: s 33978 }, i), e1.b.copy(h, a, { 33979 x: d - s, 33980 y: 0 33981 }, { 33982 x: n - s, 33983 y: c 33984 }, { 33985 width: s, 33986 height: u 33987 }, i), e1.b.copy(h, a, { 33988 x: 0, 33989 y: 0 33990 }, { 33991 x: n + d, 33992 y: c 33993 }, { 33994 width: s, 33995 height: u 33996 }, i), e1.b.copy(h, a, { 33997 x: d - s, 33998 y: u - s 33999 }, { 34000 x: n - s, 34001 y: c - s 34002 }, { 34003 width: s, 34004 height: s 34005 }, i), e1.b.copy(h, a, { 34006 x: 0, 34007 y: u - s 34008 }, { 34009 x: n + d, 34010 y: c - s 34011 }, { 34012 width: s, 34013 height: s 34014 }, i), e1.b.copy(h, a, { 34015 x: 0, 34016 y: 0 34017 }, { 34018 x: n + d, 34019 y: c + u 34020 }, { 34021 width: s, 34022 height: s 34023 }, i), e1.b.copy(h, a, { 34024 x: d - s, 34025 y: 0 34026 }, { 34027 x: n - s, 34028 y: c + u 34029 }, { 34030 width: s, 34031 height: s 34032 }, i); 34033 } 34034 this.dirty = !0; 34035 } 34036 beginFrame() { 34037 for (const e1 of this.images.keys())this.callbackDispatchedThisFrame.set(e1, new Set); 34038 this.imageAtlasCache.beginFrame(); 34039 } 34040 dispatchRenderCallbacks(e1, t1) { 34041 const i = this.images.get(t1); 34042 for (const s of e1){ 34043 if (this.callbackDispatchedThisFrame.get(t1).has(s.toString())) continue; 34044 this.callbackDispatchedThisFrame.get(t1).add(s.toString()); 34045 const e1 = i.get(s.toString()); 34046 w(e1) && this.updateImage(s, t1, e1); 34047 } 34048 } 34049 constructor(t1){ 34050 super(), this.imageProviders = new Map, this.images = new Map, this.updatedImages = new Map, this.callbackDispatchedThisFrame = new Map, this.imageVersions = new Map, this.loaded = new Map, this.requestors = [], this.patterns = new Map, this.patternsInFlight = new Set, this.atlasImage = new Map, this.atlasTexture = new Map, this.imageAtlasCache = new e1.d, this.dirty = !0, this.spriteFormat = t1, this.imageRasterizer = new ae; 34051 } 34052 } 34053 class ce { 34054 constructor(e1, t1, i, s){ 34055 this.message = (e1 ? "".concat(e1, ": ") : "") + i, s && (this.identifier = s), null != t1 && t1.__line__ && (this.line = t1.__line__); 34056 } 34057 } 34058 class he extends ce { 34059 } 34060 function de(t1) { 34061 const i = t1.value, s = t1.valueSpec, r = t1.style, o = t1.styleSpec, n = t1.key, a = t1.arrayElementValidator || ze; 34062 if (!Array.isArray(i)) return [ 34063 new ce(n, i, "array expected, ".concat(e1.n(i), " found")) 34064 ]; 34065 if (s.length && i.length !== s.length) return [ 34066 new ce(n, i, "array length ".concat(s.length, " expected, length ").concat(i.length, " found")) 34067 ]; 34068 if (s["min-length"] && i.length < s["min-length"]) return [ 34069 new ce(n, i, "array length at least ".concat(s["min-length"], " expected, length ").concat(i.length, " found")) 34070 ]; 34071 let l = { 34072 type: s.value, 34073 values: s.values, 34074 minimum: s.minimum, 34075 maximum: s.maximum, 34076 function: void 0 34077 }; 34078 o.$version < 7 && (l.function = s.function), e1.l(s.value) && (l = s.value); 34079 let c = []; 34080 for(let e1 = 0; e1 < i.length; e1++)c = c.concat(a({ 34081 array: i, 34082 arrayIndex: e1, 34083 value: i[e1], 34084 valueSpec: l, 34085 style: r, 34086 styleSpec: o, 34087 key: "".concat(n, "[").concat(e1, "]") 34088 }, !0)); 34089 return c; 34090 } 34091 function ue(t1) { 34092 const i = t1.key, s = t1.value, r = t1.valueSpec; 34093 if (!e1.q(s)) return [ 34094 new ce(i, s, "number expected, ".concat(e1.n(s), " found")) 34095 ]; 34096 if (s != s) return [ 34097 new ce(i, s, "number expected, NaN found") 34098 ]; 34099 if ("minimum" in r) { 34100 let e1 = r.minimum; 34101 if (Array.isArray(r.minimum) && (e1 = r.minimum[t1.arrayIndex]), s < e1) return [ 34102 new ce(i, s, "".concat(s, " is less than the minimum value ").concat(e1)) 34103 ]; 34104 } 34105 if ("maximum" in r) { 34106 let e1 = r.maximum; 34107 if (Array.isArray(r.maximum) && (e1 = r.maximum[t1.arrayIndex]), s > e1) return [ 34108 new ce(i, s, "".concat(s, " is greater than the maximum value ").concat(e1)) 34109 ]; 34110 } 34111 return []; 34112 } 34113 function pe(t1) { 34114 const i = t1.key, s = t1.value; 34115 if (!e1.l(s)) return [ 34116 new ce(i, s, "object expected, ".concat(e1.n(s), " found")) 34117 ]; 34118 const r = t1.valueSpec, o = e1.u(s.type); 34119 let n, a, l, c = {}; 34120 const h = "categorical" !== o && void 0 === s.property, d = !h, u = function(t1) { 34121 const i = t1.stops; 34122 return Array.isArray(i) && Array.isArray(i[0]) && e1.l(i[0][0]); 34123 }(s), p = Ue({ 34124 key: t1.key, 34125 value: t1.value, 34126 valueSpec: t1.styleSpec.function, 34127 style: t1.style, 34128 styleSpec: t1.styleSpec, 34129 objectElementValidators: { 34130 stops: function(e1) { 34131 if ("identity" === o) return [ 34132 new ce(e1.key, e1.value, 'identity function may not have a "stops" property') 34133 ]; 34134 let t1 = []; 34135 const i = e1.value; 34136 return t1 = t1.concat(de({ 34137 key: e1.key, 34138 value: i, 34139 valueSpec: e1.valueSpec, 34140 style: e1.style, 34141 styleSpec: e1.styleSpec, 34142 arrayElementValidator: f 34143 })), Array.isArray(i) && 0 === i.length && t1.push(new ce(e1.key, i, "array must have at least one stop")), t1; 34144 }, 34145 default: function(e1) { 34146 return ze({ 34147 key: e1.key, 34148 value: e1.value, 34149 valueSpec: r, 34150 style: e1.style, 34151 styleSpec: e1.styleSpec 34152 }); 34153 } 34154 } 34155 }); 34156 return "identity" === o && h && p.push(new ce(t1.key, t1.value, 'missing required property "property"')), "identity" === o || s.stops || p.push(new ce(t1.key, t1.value, 'missing required property "stops"')), "exponential" === o && r.expression && !e1.r(r) && p.push(new ce(t1.key, t1.value, "exponential functions not supported")), t1.styleSpec.$version >= 8 && (d && !e1.t(r) ? p.push(new ce(t1.key, t1.value, "property functions not supported")) : h && !e1.v(r) && p.push(new ce(t1.key, t1.value, "zoom functions not supported"))), "categorical" !== o && !u || void 0 !== s.property || p.push(new ce(t1.key, t1.value, '"property" property is required')), p; 34157 //TURBOPACK unreachable 34158 ; 34159 function f(t1) { 34160 let i = []; 34161 const s = t1.value, o = t1.key; 34162 if (!Array.isArray(s)) return [ 34163 new ce(o, s, "array expected, ".concat(e1.n(s), " found")) 34164 ]; 34165 if (2 !== s.length) return [ 34166 new ce(o, s, "array length 2 expected, length ".concat(s.length, " found")) 34167 ]; 34168 if (u) { 34169 if (!e1.l(s[0])) return [ 34170 new ce(o, s, "object expected, ".concat(e1.n(s[0]), " found")) 34171 ]; 34172 const r = s[0]; 34173 if (void 0 === r.zoom) return [ 34174 new ce(o, s, "object stop key must have zoom") 34175 ]; 34176 if (void 0 === r.value) return [ 34177 new ce(o, s, "object stop key must have value") 34178 ]; 34179 const n = e1.u(r.zoom); 34180 if ("number" != typeof n) return [ 34181 new ce(o, r.zoom, "stop zoom values must be numbers") 34182 ]; 34183 if (l && l > n) return [ 34184 new ce(o, r.zoom, "stop zoom values must appear in ascending order") 34185 ]; 34186 n !== l && (l = n, a = void 0, c = {}), i = i.concat(Ue({ 34187 key: "".concat(o, "[0]"), 34188 value: s[0], 34189 valueSpec: { 34190 zoom: {} 34191 }, 34192 style: t1.style, 34193 styleSpec: t1.styleSpec, 34194 objectElementValidators: { 34195 zoom: ue, 34196 value: m 34197 } 34198 })); 34199 } else i = i.concat(m({ 34200 key: "".concat(o, "[0]"), 34201 value: s[0], 34202 style: t1.style, 34203 styleSpec: t1.styleSpec 34204 }, s)); 34205 return e1.x(e1.y(s[1])) ? i.concat([ 34206 new ce("".concat(o, "[1]"), s[1], "expressions are not allowed in function stops.") 34207 ]) : i.concat(ze({ 34208 key: "".concat(o, "[1]"), 34209 value: s[1], 34210 valueSpec: r, 34211 style: t1.style, 34212 styleSpec: t1.styleSpec 34213 })); 34214 } 34215 function m(t1, i) { 34216 const s = e1.n(t1.value), l = e1.u(t1.value), h
34216= null !== t1.value ? t1.value : i; 34217 if (n) { 34218 if (s !== n) return [ 34219 new ce(t1.key, h, "".concat(s, " stop domain type must match previous stop domain type ").concat(n)) 34220 ]; 34221 } else n = s; 34222 if ("number" !== s && "string" !== s && "boolean" !== s && "number" != typeof l && "string" != typeof l && "boolean" != typeof l) return [ 34223 new ce(t1.key, h, "stop domain value must be a number, string, or boolean") 34224 ]; 34225 if ("number" !== s && "categorical" !== o) { 34226 let i = "number expected, ".concat(s, " found"); 34227 return e1.t(r) && void 0 === o && (i += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), [ 34228 new ce(t1.key, h, i) 34229 ]; 34230 } 34231 return "categorical" !== o || "number" !== s || "number" == typeof l && isFinite(l) && Math.floor(l) === l ? "categorical" !== o && "number" === s && "number" == typeof l && "number" == typeof a && void 0 !== a && l < a ? [ 34232 new ce(t1.key, h, "stop domain values must appear in ascending order") 34233 ] : (a = l, "categorical" === o && l in c ? [ 34234 new ce(t1.key, h, "stop domain values must be unique") 34235 ] : (c[l] = !0, [])) : [ 34236 new ce(t1.key, h, "integer expected, found ".concat(String(l))) 34237 ]; 34238 } 34239 } 34240 function fe(t1) { 34241 const i = ("property" === t1.expressionContext ? e1.z : e1.c)(e1.y(t1.value), t1.valueSpec); 34242 if ("error" === i.result) return i.value.map((e1)=>new ce("".concat(t1.key).concat(e1.key), t1.value, e1.message)); 34243 const s = i.value.expression || i.value._styleExpression.expression; 34244 if ("property" === t1.expressionContext && "text-font" === t1.propertyKey && !s.outputDefined()) return [ 34245 new ce(t1.key, t1.value, 'Invalid data expression for "'.concat(t1.propertyKey, '". Output values must be contained as literals within the expression.')) 34246 ]; 34247 if ("property" === t1.expressionContext && "layout" === t1.propertyType && !e1.A(s)) return [ 34248 new ce(t1.key, t1.value, '"feature-state" data expressions are not supported with layout properties.') 34249 ]; 34250 if ("filter" === t1.expressionContext) return me(s, t1); 34251 if ("appearance" === t1.expressionContext) return ye(s, t1); 34252 if (t1.expressionContext && 0 === t1.expressionContext.indexOf("cluster")) { 34253 if (!e1.B(s, [ 34254 "zoom", 34255 "feature-state" 34256 ])) return [ 34257 new ce(t1.key, t1.value, '"zoom" and "feature-state" expressions are not supported with cluster properties.') 34258 ]; 34259 if ("cluster-initial" === t1.expressionContext && !e1.D(s)) return [ 34260 new ce(t1.key, t1.value, "Feature data expressions are not supported with initial expression part of cluster properties.") 34261 ]; 34262 } 34263 return []; 34264 } 34265 function me(t1, i) { 34266 const s = new Set([ 34267 "zoom", 34268 "feature-state", 34269 "pitch", 34270 "distance-from-center" 34271 ]); 34272 if (i.valueSpec && i.valueSpec.expression) for (const e1 of i.valueSpec.expression.parameters)s.delete(e1); 34273 if (0 === s.size) return []; 34274 const r = []; 34275 return t1 instanceof e1.F && s.has(t1.name) ? [ 34276 new ce(i.key, i.value, '["'.concat(t1.name, '"] expression is not supported in a filter for a ').concat(i.object.type, " layer with id: ").concat(i.object.id)) 34277 ] : (t1.eachChild((e1)=>{ 34278 r.push(...me(e1, i)); 34279 }), r); 34280 } 34281 const _e = new Set([ 34282 "get", 34283 "has", 34284 "properties", 34285 "geometry-type", 34286 "id" 34287 ]), ge = new Set([ 34288 "zoom", 34289 "pitch", 34290 "distance-from-center", 34291 "feature", 34292 "feature-state", 34293 "measure-light", 34294 "heatmap-density", 34295 "line-progress", 34296 "raster-value", 34297 "raster-particle-speed", 34298 "sky-radial-progress" 34299 ]); 34300 function ye(t1, i) { 34301 if (i.valueSpec && i.valueSpec.expression) for (const e1 of i.valueSpec.expression.parameters)ge.delete(e1); 34302 if (0 === ge.size) return []; 34303 const s = []; 34304 if (t1 instanceof e1.F) { 34305 const e1 = _e.has(t1.name) ? "feature" : t1.name; 34306 if (ge.has(e1)) return [ 34307 new ce(i.key, i.value, '["'.concat(t1.name, '"] is not an allowed parameter')) 34308 ]; 34309 } 34310 return t1.eachChild((e1)=>{ 34311 s.push(...ye(e1, i)); 34312 }), s; 34313 } 34314 function ve(t1) { 34315 const i = t1.key, s = t1.value, r = t1.valueSpec, o = []; 34316 return Array.isArray(r.values) ? r.values.includes(e1.u(s)) || o.push(new ce(i, s, "expected one of [".concat(r.values.join(", "), "], ").
34316concat(JSON.stringify(s), " found"))) : Object.keys(r.values).includes(e1.u(s)) || o.push(new ce(i, s, "expected one of [".concat(Object.keys(r.values).join(", "), "], ").concat(JSON.stringify(s), " found"))), o; 34317 } 34318 function be(t1) { 34319 if (e1.J(e1.y(t1.value))) { 34320 const e1 = t1.layerType || "fill"; 34321 return fe({ 34322 ...t1, 34323 expressionContext: "filter", 34324 valueSpec: t1.styleSpec["filter_".concat(e1)] 34325 }); 34326 } 34327 return xe(t1); 34328 } 34329 function xe(t1) { 34330 const i = t1.value, s = t1.key; 34331 if (!Array.isArray(i)) return [ 34332 new ce(s, i, "array expected, ".concat(e1.n(i), " found")) 34333 ]; 34334 if (i.length < 1) return [ 34335 new ce(s, i, "filter array must have at least 1 element") 34336 ]; 34337 const r = t1.styleSpec; 34338 let o = ve({ 34339 key: "".concat(s, "[0]"), 34340 value: i[0], 34341 valueSpec: r.filter_operator 34342 }); 34343 const n = ()=>{ 34344 i.length >= 2 && (e1.H(i[1]) || o.push(new ce("".concat(s, "[1]"), i[1], "string expected, ".concat(e1.n(i[1]), " found")))); 34345 for(let t1 = 2; t1 < i.length; t1++)"$type" === e1.u(i[1]) ? o = o.concat(ve({ 34346 key: "".concat(s, "[").concat(t1, "]"), 34347 value: i[t1], 34348 valueSpec: r.geometry_type 34349 })) : e1.H(i[t1]) || e1.q(i[t1]) || e1.G(i[t1]) || o.push(new ce("".concat(s, "[").concat(t1, "]"), i[t1], "string, number, or boolean expected, ".concat(e1.n(i[t1]), " found."))); 34350 }; 34351 switch(e1.u(i[0])){ 34352 case "<": 34353 case "<=": 34354 case ">": 34355 case ">=": 34356 i.length >= 2 && "$type" === e1.u(i[1]) && o.push(new ce(s, i, '"$type" cannot be use with operator "'.concat(i[0], '"'))), 3 !== i.length && o.push(new ce(s, i, 'filter array for operator "'.concat(i[0], '" must have 3 elements'))), n(); 34357 break; 34358 case "==": 34359 case "!=": 34360 3 !== i.length && o.push(new ce(s, i, 'filter array for operator "'.concat(i[0], '" must have 3 elements'))), n(); 34361 break; 34362 case "in": 34363 case "!in": 34364 n(); 34365 break; 34366 case "any": 34367 case "all": 34368 case "none": 34369 for(let e1 = 1; e1 < i.length; e1++)o = o.concat(xe({ 34370 key: "".concat(s, "[").concat(e1, "]"), 34371 value: i[e1], 34372 style: t1.style, 34373 styleSpec: t1.styleSpec 34374 })); 34375 break; 34376 case "has": 34377 case "!has": 34378 2 !== i.length ? o.push(new ce(s, i, 'filter array for "'.concat(i[0], '" operator must have 2 elements'))) : e1.H(i[1]) || o.push(new ce("".concat(s, "[1]"), i[1], "string expected, ".concat(e1.n(i[1]), " found"))); 34379 } 34380 return o; 34381 } 34382 const we = /^{([^}]+)}$/; 34383 function Te(t1, i) { 34384 const s = t1.key, r = t1.style, o = t1.layer, n = t1.styleSpec, a = t1.value, l = t1.objectKey, c = n["".concat(i, "_").concat(t1.layerType)]; 34385 if (!c) return []; 34386 const h = l.match(e1.U); 34387 if (h && c[h[1]]) return e1.x(e1.y(a)) ? [].concat(ze({ 34388 key: s, 34389 value: a, 34390 valueSpec: { 34391 type: "string", 34392 expression: { 34393 interpolated: !1, 34394 parameters: [ 34395 "zoom", 34396 "feature" 34397 ] 34398 }, 34399 "property-type": "data-driven" 34400 }, 34401 style: r, 34402 styleSpec: n, 34403 expressionContext: "property", 34404 propertyType: i, 34405 propertyKey: l 34406 })) : ze({ 34407 key: s, 34408 value: a, 34409 valueSpec: { 34410 type: "string" 34411 }, 34412 style: r, 34413 styleSpec: n 34414 }); 34415 const d = l.match(e1.K); 34416 if ("paint" === i && d && c[d[1]] && c[d[1]].transition) return ze({ 34417 key: s, 34418 value: a, 34419 valueSpec: n.transition, 34420 style: r, 34421 styleSpec: n 34422 }); 34423 const u = t1.valueSpec || c[l]; 34424 if (!u) return [ 34425 new he(s, a, 'unknown property "'.concat(l, '"')) 34426 ]; 34427 let p; 34428 if (e1.H(a) && e1.t(u) && !u.tokens && (p = we.exec(a))) { 34429 const e1 = '`{ "type": "identity", "property": '.concat(p ? JSON.stringify(p[1]) : '"_"', " }`"); 34430 return [ 34431 new ce(s, a, '"'.concat(l, '" does not support interpolation syntax\nUse an identity property function instead: ').concat(e1, ".")) 34432 ]; 34433 } 34434 const f = []; 34435 if ("symbol" === t1.layerType) "text-field" !== l || !r || r.glyphs || r.imports || f.push(new ce(s, a, 'use of "text-field" requires a style "glyphs" property')), "text-font" === l && e1.M(e1.y(a)) && "identity" === e1.u(a.type) && f.push(new ce(s, a, '"text-font" does not support identity functions')); 34436 else if ("model" === t1.layerType && "paint" === i && o && o.layout && Object.hasOwn(o.layout, "model-id") && e1.t(u) && (e1.N(u) || e1.v(u))) { 34437 const t1 = e1.z(e1.y(a), u).value, i = "expression" in t1 && t1.expression || "_styleExpression" in t1 && t1._styleExpression && t1._styleExpression.expression; 34438 i && !e1.B(i, [ 34439 "measure-light" 34440 ]) && ("model-emissive-strength" === l && e1.D(i) && e1.A(i) || f.push(new ce(s, a, "".concat(l, " does not support measure-light expressions when the model layer source is vector tile or GeoJSON.")))); 34441 } 34442 return f.concat(ze({ 34443 key: t1.key, 34444 value: a, 34445 valueSpec: u, 34446 style: r, 34447 styleSpec: n, 34448 expressionContext: "property", 34449 propertyType: i, 34450 propertyKey: l 34451 })); 34452 } 34453 function Se(e1) { 34454 return Te(e1, "paint"); 34455 } 34456 function Ce(e1) { 34457 return Te(e1, "layout"); 34458 } 34459 function Ee(t1) { 34460 let i = []; 34461 const s = t1.value, r = t1.key, o = t1.style, n = t1.styleSpec; 34462 if (!e1.l(s)) return [ 34463 new ce(r, s, "object expected") 34464 ]; 34465 s.type || s.ref || i.push(new ce(r, s, 'either "type" or "ref" is required')); 34466 let a = e1.u(s.type); 34467 const l = e1.u(s.ref); 34468 if (s.id) { 34469 const n = e1.u(s.id); 34470 for(let a = 0; a < t1.arrayIndex; a++){ 34471 const t1 = o.layers[a]; 34472 e1.u(t1.id) === n && i.push(new ce(r, s.id, 'duplicate layer id "'.concat(n, '", previously used at line ').concat(t1.id.__line__))); 34473 } 34474 } 34475 if ("ref" in s) { 34476 let t1; 34477 [ 34478 "type", 34479 "source", 34480 "source-layer", 34481 "filter", 34482 "layout" 34483 ].forEach((e1)=>{ 34484 e1 in s && i.push(new ce(r, s[e1], '"'.concat(e1, '" is prohibited for ref layers'))); 34485 }
34485), o.layers.forEach((i)=>{ 34486 e1.u(i.id) === l && (t1 = i); 34487 }), t1 ? t1.ref ? i.push(new ce(r, s.ref, "ref cannot reference another ref layer")) : a = e1.u(t1.type) : "string" == typeof l && i.push(new ce(r, s.ref, 'ref layer "'.concat(l, '" not found'))); 34488 } else if ("background" !== a && "sky" !== a && "slot" !== a) if (s.source) if (e1.H(s.source)) { 34489 const t1 = o.sources && Object.hasOwn(o.sources, s.source) ? o.sources[s.source] : void 0, n = t1 && e1.u(t1.type); 34490 t1 ? "vector" === n && "raster" === a ? i.push(new ce(r, s.source, 'layer "'.concat(s.id, '" requires a raster source'))) : "raster" === n && "raster" !== a ? i.push(new ce(r, s.source, 'layer "'.concat(s.id, '" requires a vector source'))) : "vector" !== n || s["source-layer"] ? "raster-dem" === n && "hillshade" !== a ? i.push(new ce(r, s.source, "raster-dem source can only be used with layer type 'hillshade'.")) : "raster-array" !== n || [ 34491 "raster", 34492 "raster-particle" 34493 ].includes(a) ? "line" === a && s.paint && s.paint["line-gradient"] && "geojson" === n && !t1.lineMetrics ? i.push(new ce(r, s, 'layer "'.concat(s.id, '" specifies a line-gradient, which requires the GeoJSON source to have `lineMetrics` enabled.'))) : "line" === a && s.paint && s.paint["line-trim-offset"] && "geojson" === n && !t1.lineMetrics ? i.push(new ce(r, s, 'layer "'.concat(s.id, '" specifies a line-trim-offset, which requires the GeoJSON source to have `lineMetrics` enabled.'))) : "raster-particle" === a && "raster-array" !== n && i.push(new ce(r, s.source, 'layer "'.concat(s.id, "\" requires a 'raster-array' source."))) : i.push(new ce(r, s.source, "raster-array source can only be used with layer type 'raster'.")) : i.push(new ce(r, s, 'layer "'.concat(s.id, '" must specify a "source-layer"'))) : i.push(new ce(r, s.source, 'source "'.concat(s.source, '" not found'))); 34494 } else i.push(new ce("".concat(r, ".source"), s.source, '"source" must be a string')); 34495 else i.push(new ce(r, s, 'missing required property "source"')); 34496 return i = i.concat(Ue({ 34497 key: r, 34498 value: s, 34499 valueSpec: n.layer, 34500 style: t1.style, 34501 styleSpec: t1.styleSpec, 34502 objectElementValidators: { 34503 "*": ()=>[], 34504 type: ()=>ze({ 34505 key: "".concat(r, ".type"), 34506 value: s.type, 34507 valueSpec: n.layer.type, 34508 style: t1.style, 34509 styleSpec: t1.styleSpec, 34510 object: s, 34511 objectKey: "type" 34512 }), 34513 filter: (e1)=>be({ 34514 layerType: a, 34515 ...e1 34516 }), 34517 layout: (e1)=>Ue({ 34518 layer: s, 34519 key: e1.key, 34520 value: e1.value, 34521 valueSpec: {}, 34522 style: e1.style, 34523 styleSpec: e1.styleSpec, 34524 objectElementValidators: { 34525 "*": (e1)=>Ce({ 34526 layerType: a, 34527 ...e1 34528 }) 34529 } 34530 }), 34531 paint: (e1)=>Ue({ 34532 layer: s, 34533 key: e1.key, 34534 value: e1.value, 34535 valueSpec: {}, 34536 style: e1.style, 34537 styleSpec: e1.styleSpec, 34538 objectElementValidators: { 34539 "*": (e1)=>Se({ 34540 layerType: a, 34541 layer: s, 34542 ...e1 34543 }) 34544 } 34545 }), 34546 appearances (t1) { 34547 const i = de({ 34548 key: t1.key, 34549 value: t1.value, 34550 valueSpec: t1.valueSpec, 34551 style: t1.style, 34552 styleSpec: t1.styleSpec, 34553 arrayElementValidator: (t1)=>(function(t1) { 34554 const { key: i, layer: s, layerType: r } = t1, o = e1.u(t1.value), n = e1.u(o.name), a = e1.u(o.condition), l = Ue({ 34555 key: i, 34556 value: o, 34557 valueSpec: t1.styleSpec.appearance, 34558 style: t1.style, 34559 styleSpec: t1.styleSpec, 34560 objectElementValidators: { 34561 condition: (t1)=>(function(t1) { 34562 const i = []; 34563 return i.push(...fe({ 34564 key: t1.key, 34565 value: t1.object.condition, 34566 valueSpec: e1.s.appearance.condition, 34567 expressionContext: "appearance" 34568 })), i; 34569 })({ 34570 ...t1 34571 }), 34572 properties: (e1)=>(function(e1) { 34573 const t1 = [], { styleSpec: i, layer: s, layerType: r } = e1, o = i["paint_".concat(r)], n = i["layout_".concat(r)], a = e1.object[e1.objectKey]; 34574 for(const i in a){ 34575 const l = i in o ? "paint" : i in n ? "layout" : void 0; 34576 if (!l) { 34577 t1.push(new ce(e1.key, i, 'unknown property "'.concat(i, '" for layer type "').concat(r, '"'))); 34578 continue; 34579 } 34580 const c = { 34581 ...e1, 34582 key: "".concat(e1.key, ".").concat(i), 34583 objectKey: i, 34584 layer: s, 34585 layerType: r, 34586 value: a[i], 34587 valueSpec: "paint" === l ? o[i] : n[i] 34588 }; 34589 t1.push(...Te(c, l)); 34590 } 34591 return t1; 34592 })({ 34593 layer: s, 34594 layerType: r, 34595 ...e1 34596 }) 34597 } 34598 }); 34599 return "hidden" !== n && void 0 === a && l.push(new ce(t1.key, "name", 'Appearance with name different than "hidden" must have a condition')), l; 34600 })({ 34601 layerType: a, 34602 layer: s, 34603 ...t1 34604 }) 34605 }), r = Array.isArray(t1.value) ? t1.value : [], o = new Set; 34606 return r.forEach((r, n)=>{ 34607 const a = e1.u(r.name); 34608 if (a) if (o.has(a)) { 34609 const r = e1.u(s.id); 34610 i.push(new ce(t1.key, a, 'Duplicated appearance name "'.concat(a, '" for layer "').concat(r, '"'))); 34611 } else o.add(a); 34612 }), i; 34613 } 34614 } 34615 })), i; 34616 } 34617 function Ie(param) { 34618 let { key: t1, value: i } = param; 34619 return e1.H(i) ? [] : [ 34620 new ce(t1, i, "string expected, ".concat(e1.n(i), " found")) 34621 ]; 34622 } 34623 const De = { 34624 promoteId: function t1(param) { 34625 let { key: i, value: s } = param; 34626 if (e1.H(s)) return Ie({ 34627 key: i, 34628 value: s 34629 }); 34630 if (Array.isArray(s)) { 34631 const t1 = [], r = e1.y(s), o = e1.c(r); 34632 return "error" === o.result ? (o.value.forEach((e1)=>{
34633 t1.push(new ce("".concat(i).concat(e1.key), null, "".concat(e1.message))); 34634 }), t1) : (e1.B(o.value.expression, [ 34635 "zoom", 34636 "heatmap-density", 34637 "line-progress", 34638 "raster-value", 34639 "sky-radial-progress", 34640 "accumulated", 34641 "is-supported-script", 34642 "pitch", 34643 "distance-from-center", 34644 "measure-light", 34645 "raster-particle-speed" 34646 ]) || t1.push(new ce("".concat(i), null, "promoteId expression should be only feature dependent")), t1); 34647 } 34648 if (!e1.l(s)) return [ 34649 new ce(i, s, 'string, expression or object expected, "'.concat(e1.n(s), '" found')) 34650 ]; 34651 const r = []; 34652 for(const e1 in s)r.push(...t1({ 34653 key: "".concat(i, ".").concat(e1), 34654 value: s[e1] 34655 })); 34656 return r; 34657 } 34658 }; 34659 function Pe(t1) { 34660 const i = t1.value, s = t1.key, r = t1.styleSpec, o = t1.style; 34661 if (!e1.l(i)) return [ 34662 new ce(s, i, "object expected, ".concat(e1.n(i), " found")) 34663 ]; 34664 if (!("type" in i)) return [ 34665 new ce(s, i, '"type" is required') 34666 ]; 34667 const n = e1.u(i.type); 34668 let a = []; 34669 switch([ 34670 "vector", 34671 "raster", 34672 "raster-dem", 34673 "raster-array" 34674 ].includes(n) && ("url" in i || "tiles" in i || a.push(new he(s, i, 'Either "url" or "tiles" is required.'))), n){ 34675 case "vector": 34676 case "raster": 34677 case "raster-dem": 34678 case "raster-array": 34679 return a = a.concat(Ue({ 34680 key: s, 34681 value: i, 34682 valueSpec: r["source_".concat(n.replace("-", "_"))], 34683 style: t1.style, 34684 styleSpec: r, 34685 objectElementValidators: De 34686 })), a; 34687 case "geojson": 34688 if (a = Ue({ 34689 key: s, 34690 value: i, 34691 valueSpec: r.source_geojson, 34692 style: o, 34693 styleSpec: r, 34694 objectElementValidators: De 34695 }), "cluster" in i && "clusterProperties" in i) { 34696 if (!e1.l(i.clusterProperties)) return [ 34697 new ce("".concat(s, ".clusterProperties"), i, "object expected, ".concat(e1.n(i), " found")) 34698 ]; 34699 for(const e1 in i.clusterProperties){ 34700 const t1 = i.clusterProperties[e1]; 34701 if (!Array.isArray(t1)) return [ 34702 new ce("".concat(s, ".clusterProperties.").concat(e1), t1, "array expected") 34703 ]; 34704 const [r, o] = t1, n = "string" == typeof r ? [ 34705 r, 34706 [ 34707 "accumulated" 34708 ], 34709 [ 34710 "get", 34711 e1 34712 ] 34713 ] : r; 34714 a.push(...fe({ 34715 key: "".concat(s, ".").concat(e1, ".map"), 34716 value: o, 34717 expressionContext: "cluster-map" 34718 })), a.push(...fe({ 34719 key: "".concat(s, ".").concat(e1, ".reduce"), 34720 value: n, 34721 expressionContext: "cluster-reduce" 34722 })); 34723 } 34724 } 34725 return a; 34726 case "video": 34727 return Ue({ 34728 key: s, 34729 value: i, 34730 valueSpec: r.source_video, 34731 style: o, 34732 styleSpec: r 34733 }); 34734 case "image": 34735 return Ue({ 34736 key: s, 34737 value: i, 34738 valueSpec: r.source_image, 34739 style: o, 34740 styleSpec: r 34741 }); 34742 case "canvas": 34743 return [ 34744 new ce(s, null, "Please use runtime APIs to add canvas sources, rather than
34744including them in stylesheets.", "source.canvas") 34745 ]; 34746 default: 34747 return ve({ 34748 key: "".concat(s, ".type"), 34749 value: i.type, 34750 valueSpec: { 34751 values: Le(r) 34752 } 34753 }); 34754 } 34755 } 34756 function Le(e1) { 34757 return e1.source.reduce((t1, i)=>{ 34758 const s = e1[i]; 34759 return "enum" === s.type.type && (t1 = t1.concat(Object.keys(s.type.values || {}))), t1; 34760 }, []); 34761 } 34762 function Re(e1, t1) { 34763 const i = !e1.includes("://"); 34764 try { 34765 return new URL(e1, i && t1 ? "http://example.com" : void 0), !0; 34766 } catch (e1) { 34767 return !1; 34768 } 34769 } 34770 function Ae(t1) { 34771 const i = t1.value; 34772 return i ? e1.H(i) ? Re(i, !0) ? [] : [ 34773 new ce(t1.key, i, 'invalid url "'.concat(i, '"')) 34774 ] : [ 34775 new ce(t1.key, i, 'string expected, "'.concat(e1.n(i), '" found')) 34776 ] : []; 34777 } 34778 function Me(t1) { 34779 const i = t1.value, s = t1.styleSpec, r = s.light, o = t1.style; 34780 if (void 0 === i) return []; 34781 if (!e1.l(i)) return [ 34782 new ce("light", i, "object expected, ".concat(e1.n(i), " found")) 34783 ]; 34784 let n = []; 34785 for(const t1 in i){ 34786 const a = t1.match(e1.K), l = t1.match(e1.U); 34787 n = n.concat(l && r[l[1]] ? ze({ 34788 key: t1, 34789 value: i[t1], 34790 valueSpec: { 34791 type: "string" 34792 }, 34793 style: o, 34794 styleSpec: s 34795 }) : a && r[a[1]] && r[a[1]].transition ? ze({ 34796 key: t1, 34797 value: i[t1], 34798 valueSpec: s.transition, 34799 style: o, 34800 styleSpec: s 34801 }) : r[t1] ? ze({ 34802 key: t1, 34803 value: i[t1], 34804 valueSpec: r[t1], 34805 style: o, 34806 styleSpec: s 34807 }) : [ 34808 new ce(t1, i[t1], 'unknown property "'.concat(t1, '"')) 34809 ]); 34810 } 34811 return n; 34812 } 34813 function Oe(t1) { 34814 const i = t1.value; 34815 if (!i) return []; 34816 const s = t1.key; 34817 if (!e1.l(i)) return [ 34818 new ce(s, i, "object expected, ".concat(e1.n(i), " found")) 34819 ]; 34820 let r = []; 34821 const o = t1.styleSpec, n = o["light-3d"], a = t1.style, l = t1.style.lights; 34822 for (const e1 of [ 34823 "type", 34824 "id" 34825 ])if (!(e1 in i)) return r = r.concat([ 34826 new ce(s, i, 'missing property "'.concat(e1, '"')) 34827 ]), r; 34828 if (!e1.H(i.type)) return r = r.concat([ 34829 new ce("".concat(s, ".type"), i.type, "string expected") 34830 ]), r; 34831 if (l) for(let o = 0; o < t1.arrayIndex; o++){ 34832 const t1 = e1.u(i.type), n = l[o]; 34833 e1.u(n.type) === t1 && r.push(new ce(s, i.id, 'duplicate light type "'.concat(i.type, '", previously defined at line ').concat(n.id.__line__))); 34834 } 34835 const c = "properties_light_".concat(i.type); 34836 if (!(c in o)) return r = r.concat([ 34837 new ce("".concat(s, ".type"), i, "Invalid light type ".concat(i.type)) 34838 ]), r; 34839 const h = o[c]; 34840 for(const s in i)if ("properties" === s) { 34841 const n = i[s]; 34842 if (!e1.l(n)) return r = r.concat([ 34843 new ce("properties", n, "object expected, ".concat(e1.n(n), " found")) 34844 ]), r; 34845 for(const i in n){ 34846 const s = i.match(e1.K), l = i.match(e1.U); 34847 r = r.concat(l && h[l[1]] ? ze({ 34848 key: i, 34849 value: n[i], 34850 valueSpec: { 34851 type: "string" 34852 }, 34853 style: a, 34854 styleSpec: o 34855 }) : s && h[s[1]] && h[s[1]].transition ? ze({ 34856 key: i, 34857 value: n[i], 34858 valueSpec: o.transition, 34859 style: a, 34860 styleSpec: o 34861 }) : h[i] ? ze({ 34862 key: i, 34863 value: n[i], 34864 valueSpec: h[i], 34865 style: a, 34866 styleSpec: o 34867 }) : [ 34868 new he(t1.key, n[i], 'unknown property "'.concat(i, '"')) 34869 ]); 34870 } 34871 } else r = r.concat(n[s] ? ze({ 34872 key: s, 34873 value: i[s], 34874 valueSpec: n[s], 34875 style: a, 34876 styleSpec: o 34877 }) : [ 34878 new he(s, i[s], 'unknown property "'.concat(s, '"')) 34879 ]); 34880 return r; 34881 } 34882 function Fe(t1) { 34883 const i = t1.value, s = t1.key, r = t1.style, o = t1.styleSpec, n = o.terrain; 34884 if (null == i) return []; 34885 if (!e1.l(i)) return [ 34886 new ce("terrain", i, "object expected, ".concat(e1.n(i), " found")) 34887 ]; 34888 let a = []; 34889 for(const t1 in i){ 34890 const s = t1.match(e1.K), l = t1.match(e1.U); 34891 a = a.concat(l && n[l[1]] ? ze({ 34892 key: t1, 34893 value: i[t1], 34894 valueSpec: { 34895 type: "string" 34896 }, 34897 style: r, 34898 styleSpec: o 34899 }) : s && n[s[1]] && n[s[1]].transition ? ze({ 34900 key: t1, 34901 value: i[t1], 34902 valueSpec: o.transition, 34903 style: r, 34904 styleSpec: o 34905 }) : n[t1] ? ze({ 34906 key: t1, 34907 value: i[t1], 34908 valueSpec: n[t1], 34909 style: r, 34910 styleSpec: o 34911 }) : [ 34912 new he(t1, i[t1], 'unknown property "'.concat(t1, '"')) 34913 ]); 34914 } 34915 if (i.source) if (e1.H(i.source)) { 34916 const t1 = r.sources && Object.hasOwn(r.sources, i.source) ? r.s
34916ources[i.source] : void 0, o = t1 && e1.u(t1.type); 34917 t1 ? "raster-dem" !== o && a.push(new ce("".concat(s, ".source"), i.source, "terrain cannot be used with a source of type ".concat(o, ', it only be used with a "raster-dem" source type'))) : a.push(new ce("".concat(s, ".source"), i.source, 'source "'.concat(i.source, '" not found'))); 34918 } else a.push(new ce("".concat(s, ".source"), i.source, "source must be a string")); 34919 else a.push(new ce(s, i, 'terrain is missing required property "source"')); 34920 return a; 34921 } 34922 function ke(t1) { 34923 const i = t1.value, s = t1.style, r = t1.styleSpec, o = r.fog; 34924 if (void 0 === i) return []; 34925 if (!e1.l(i)) return [ 34926 new ce("fog", i, "object expected, ".concat(e1.n(i), " found")) 34927 ]; 34928 let n = []; 34929 for(const t1 in i){ 34930 const a = t1.match(e1.K), l = t1.match(e1.U); 34931 n = n.concat(l && o[l[1]] ? ze({ 34932 key: t1, 34933 value: i[t1], 34934 valueSpec: { 34935 type: "string" 34936 }, 34937 style: s, 34938 styleSpec: r 34939 }) : a && o[a[1]] && o[a[1]].transition ? ze({ 34940 key: t1, 34941 value: i[t1], 34942 valueSpec: r.transition, 34943 style: s, 34944 styleSpec: r 34945 }) : o[t1] ? ze({ 34946 key: t1, 34947 value: i[t1], 34948 valueSpec: o[t1], 34949 style: s, 34950 styleSpec: r 34951 }) : [ 34952 new he(t1, i[t1], 'unknown property "'.concat(t1, '"')) 34953 ]); 34954 } 34955 return n; 34956 } 34957 const Be = { 34958 "*": ()=>[], 34959 array: de, 34960 boolean: function(t1) { 34961 const i = t1.value, s = t1.key; 34962 return e1.G(i) ? [] : [ 34963 new ce(s, i, "boolean expected, ".concat(e1.n(i), " found")) 34964 ]; 34965 }, 34966 number: ue, 34967 color: function(param) { 34968 let { key: t1, value: i } = param; 34969 return e1.H(i) ? void 0 === e1.C.parse(e1.u(i)) ? [ 34970 new ce(t1, i, 'color expected, "'.concat(i, '" found')) 34971 ] : [] : [ 34972 new ce(t1, i, "color expected, ".concat(e1.n(i), " found")) 34973 ]; 34974 }, 34975 enum: ve, 34976 filter: be, 34977 function: pe, 34978 layer: Ee, 34979 object: Ue, 34980 source: Pe, 34981 model: Ae, 34982 light: Me, 34983 "light-3d": Oe, 34984 terrain: Fe, 34985 fog: ke, 34986 string: Ie, 34987 formatted: function(e1) { 34988 return 0 === Ie(e1).length ? [] : fe(e1); 34989 }, 34990 resolvedImage: function(e1) { 34991 return 0 === Ie(e1).length ? [] : fe(e1); 34992 }, 34993 projection: function(t1) { 34994 const i = t1.value, s = t1.styleSpec, r = s.projection, o = t1.style; 34995 if (e1.l(i)) { 34996 let e1 = []; 34997 for(const t1 in i)e1 = e1.concat(ze({ 34998 key: t1, 34999 value: i[t1], 35000 valueSpec: r[t1], 35001 style: o, 35002 styleSpec: s 35003 })); 35004 return e1; 35005 } 35006 return e1.H(i) ? [] : [ 35007 new ce("projection", i, "object or string expected, ".concat(e1.n(i), " found")) 35008 ]; 35009 }, 35010 import: function(t1) { 35011 const i = t1.key, { value: s, styleSpec: r } = t1; 35012 if (!e1.l(s)) return [ 35013 new ce(i, s, "import must be an object") 35014 ]; 35015 const { data: o, ...n } = s; 35016 Object.defineProperty(n, "__line__", { 35017 value: s.__line__, 35018 enumerable: !1 35019 }); 35020 let a = Ue({ 35021 ...t1, 35022 value: n, 35023 valueSpec: r.import 35024 }); 35025 "" === e1.u(n.id) && a.push(new ce("".concat(t1.key, ".id"), n, "import id can't be an empty string")); 35026 const l = e1.u(n.id); 35027 return "__proto__" !== l && "constructor" !== l && "prototype" !== l || a.push(new ce("".concat(t1.key, ".id"), n, "import id can't be \"".concat(String(l), '"'))), o && (a = a.concat(je(o, r, { 35028 key: "".concat(t1.key, ".data") 35029 }))), a; 35030 }, 35031 iconset: function(t1) { 35032 const i = t1.value, s = t1.key, r = t1.styleSpec, o = t1.style; 35033 if (!e1.l(i)) return [ 35034 new ce(s, i, "object expected") 35035 ]; 35036 if (!i.type) return [ 35037 new ce(s, i, '"type" is required') 35038 ]; 35039 const n = e1.u(i.type); 35040 let a = []; 35041 if (a = a.concat(Ue({ 35042 key: s, 35043 value: i, 35044 valueSpec: r["iconset_".concat(n)], 35045 style: o, 35046 styleSpec: r 35047 })), function(e1, t1) { 35048 return !("source" !== e1 || !t1.source); 35049 }(n, i)) { 35050 const t1 = o.sources && Object.hasOwn(o.sources, i.source) ? o.sources[i.source] : void 0, r = t1 && e1.u(t1.type); 35051 t1 ? "raster-array" !== r && a.push(new ce(s, i.source, "iconset cannot be used with a source of type ".concat(String(r), ', it only be used with a "raster-array" source type'))) : a.push(new ce(s, i.source, 'source "'.concat(i.source, '" not found'))); 35052 } 35053 return a; 35054 }, 35055 option: function(t1) { 35056 const i = t1.styleSpec, s = t1.value, r = e1.l(s) && !0 === e1.u(s.array) || !e1.l(s) ? void 0 : e1.u(s.type); 35057 return Ue({ 35058 ...t1, 35059 valueSpec: i.option, 35060 objectElementValidators: { 35061 default: (t1)=>{ 35062 const i = t1.value; 35063 return e1.l(i) ? ze({ 35064 ...t1, 35065 valueSpec: { 35066 ...t1.valueSpec, 35067 type: "*", 35068 expression: void 0 35069 } 35070 }) : r && Array.isArray(i) ? ze({ 35071 ...t1, 35072 valueSpec: { 35073 ...t1.valueSpec, 35074 type: r 35075 } 35076 }) : ze(t1); 35077 } 35078 } 35079 }); 35080 } 35081 }; 35082 function ze(t1) { 35083 let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1; 35084 const s = t1.value, r = t1.valueSpec, o = t1.styleSpec; 35085 if (r.expression) { 35086 if (e1.M(e1.u(s))) return pe(t1); 35087 if (e1.x(e1.y(s))) return fe(t1); 35088 } 35089 if (r.type && Be[r.type]) { 35090 const e1 = Be[r.type](t1); 35091 return !0 === i && e1.length > 0 && Array.isArray(t1.value) ? fe(t1) : e1; 35092 } 35093 return Ue({ 35094 ...t1, 35095 valueSpec: r.type ? o[r.type] : r 35096 }); 35097 } 35098 function Ue(t1) { 35099 const i = t1.key, s = t1.value, r = t1.valueSpec || {}, o = t1.objectElementValidators || {}, n = t1.style, a = t1.styleSpec; 35100 if (!e1.l(s)) return [ 35101 new ce(i, s, "object expected, ".concat(e1.n(s), " found")) 35102 ]; 35103 let l = []; 35104 for(const e1 in s){ 35105 if (!Object.hasOwn(s, e1)) continue; 35106 const t1 = e1.split(".")[0], c = Object.hasOwn(r, t1), h = Object.hasOwn(r, "*"), d = c ? r[t1] : h ? r["*"] : void 0; 35107 let u; 35108 Object.hasOwn(o, t1) ? u = o[t1] : c ? u = ze : Object.hasOwn(o, "*") ? u = o["*"] : h && (u = ze), u ? l = l.concat(u({ 35109 key: (i ? "".concat(i, ".") : i) + e1, 35110 value: s[e1], 35111 valueSpec: d, 35112 style: n, 35113 styleSpec: a, 35114 object: s, 35115 objectKey: e1 35116 }, s)) : l.push(new he(i, s[e1], 'unknown property "'.concat(e1, '"'))); 35117 } 35118 for(const e1 in r){ 35119 if (!Object.hasOwn(r, e1)) continue; 35120 if (Object.hasOwn(o, e1)) continue; 35121 const t1 = r[e1]; 35122 !t1.required || void 0 !== t1.default || Object.hasOwn(s, e1) && void 0 !== s[e1] || l.push(new ce(i, s, 'missing required property "'.concat(e1, '"'))); 35123 } 35124 return l; 35125 } 35126 function Ne(param) { 35127 let { key: e1, value: t1 } = param; 35128 const i = Ie({ 35129 key: e1, 35130 value: t1 35131 }); 35132 if (i.length) return i; 35133 const s = t1; 35134 return s.includes("{fontstack}") || i.push(new ce(e1, t1, '"glyphs" url must include a "{fontstack}" token')), s.includes("{range}") || i.push(new ce(e1, t1, '"glyphs" url must include a "{range}" token')), i; 35135 } 35136 function je(t1) { 35137 let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : e1.s, s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 35138 return Ue({ 35139 key: s.key || "", 35140 value: t1, 35141 valueSpec: { 35142 ...i.$root, 35143 "*": { 35144 type: "*" 35145 } 35146 }, 35147 styleSpec: i, 35148 style: t1, 35149 objectElementValidators: { 35150 glyphs: Ne 35151 } 35152 }); 35153 } 35154 function Ve(e1) { 35155 return e1.slice().sort((e1, t1)=>e1.line && t1.line ? e1.line - t1.line : 0); 35156 } 35157 const Ge = "setStyle", qe = "addLayer", Ze = "removeLayer", $e = "setPaintProperty", He = "setLayerProperty", We = "setTerrain", Xe = "removeImport", Ke = "addIconset", Ye = "removeIconset"; 35158 function Qe(e1, t1, i) { 35159 i.push({ 35160 command: "addSource", 35161 args: [ 35162 e1, 35163 t1[e1] 35164 ] 35165 }); 35166 } 35167 function Je(e1, t1, i) { 35168 t1.push({ 35169 command: "removeSource", 35170 args: [ 35171 e1 35172 ] 35173 }), i[e1] = !0; 35174 } 35175 function et(e1, t1, i, s) { 35176 Je(e1, i, s), Qe(e1, t1, i); 35177 } 35178 function tt(t1, i, s) { 35179 let r; 35180 for(r in t1[s])if (Object.hasOwn(t1[s], r) && "data" !== r && !e1.O(t1[s][r], i[s][r])) return !1; 35181 for(r in i[s])if (Object.hasOwn(i[s], r) && "data" !== r && !e1.O(t1[s][r], i[s][r])) return !1; 35182 return !0; 35183 } 35184 function it(t1, i, s, r, o, n) { 35185 let a; 35186 for(a in i = i || {}, t1 = t1 || {})Object.hasOwn(t1, a) && (e1.O(t1[a], i[a]) || s.push({ 35187 command: n, 35188 args: [ 35189 r, 35190 a, 35191 i[a], 35192 o 35193 ] 35194 })); 35195 for(a in i)Object.hasOwn(i, a) && !Object.hasOwn(t1, a) && (e1.O(t1[a], i[a]) || s.push({ 35196 command: n, 35197 args: [ 35198 r, 35199 a, 35200 i[a], 35201 o 35202 ] 35203 })); 35204 } 35205 function st(e1) { 35206 return e1.id; 35207 } 35208 function rt(e1, t1) { 35209 return e1[t1.id] = t1, e1; 35210 } 35211 const ot = new e1.C(1, 0, 0, 1), nt = new e1.C(0, 1, 0, 1), at = new e1.C(0, 0, 1, 1), lt = new e1.C(1, 0, 1, 1), ct = new e1.C(0, 1, 1, 1); 35212 function ht(t1, i, s, r, o, n, a) { 35213 const l = t1.context, c = t1.transform, h = l.gl, d = "globe" === c.projection.name, u = d ? [ 35214 "PROJECTION_GLOBE_VIEW" 35215 ] : []; 35216 let p = e1.Q(s.projMatrix); 35217 if (d && e1.S(c.zoom) > 0) { 35218 const t1 = e1.V(s.canonical, c), i = e1.W(t1); 35219 p = e1.X(new Float32Array(16), c.globeMatrix, i), e1.X(p, c.projMatrix, p); 35220 } 35221 const f = e1.Y(); 35222 f[12] += 2 * o / (e1.e.devicePixelRatio * c.width), f[13] += 2 * n / (e1.e.devicePixelRatio * c.height), e1.X(p, f, p); 35223 const m = t1.getOrCreateProgram("debug", { 35224 defines: u 35225 }), _ = i.getTileByID(s.key); 35226 t1.terrain && t1.terrain.setupElevationDraw(_, m); 35227 const g = e1.Z.disabled, y = e1._.disabled, v = t1.colorModeForRenderPass(), b = "$debug"; 35228 l.activeTexture.set(h.TEXTURE0), t1.emptyTexture.bind(h.LINEAR, h.CLAMP_TO_EDGE), d ? _._makeGlobeTileDebugBuffers(t1.context, c) : _._makeDebugTileBoundsBuffers(t1.context, c.projection); 35229 const x = _._tileDebugBuffer || t1.debugBuffer, w = _._tileDebugIndexBuffer || t1.debugIndexBuffer, T = _._tileDebugSegments || t1.debugSegments; 35230 if (m.draw(t1, h.LINE_STRIP, g, y, v, e1.$.disabled, e1.a0(p, r.toPremultipliedRenderColor(null)), b, x, w, T, null, null, null, [ 35231 _._globeTileDebugBorderBuffer 35232 ]), a) { 35233 const e1 = _.latestRawTileData, i = Math.floor((e1 && e1.byteLength || 0) / 1024); 35234 let r = s.canonical.toString(); 35235 s.overscaledZ !== s.canonical.z && (r += " =>
vendor: 25,814 bytes, lines 35235-35740
35235 ".concat(s.overscaledZ)), r += " ".concat(_.state), r += " ".concat(i, "kb"), function(e1, t1) { 35236 e1.initDebugOverlayCanvas(); 35237 const i = e1.debugOverlayCanvas, s = e1.context.gl, r = e1.debugOverlayCanvas.getContext("2d"); 35238 r.clearRect(0, 0, i.width, i.height), r.shadowColor = "white", r.shadowBlur = 2, r.lineWidth = 1.5, r.strokeStyle = "white", r.textBaseline = "top", r.font = "bold 36px Open Sans, sans-serif", r.fillText(t1, 5, 5), r.strokeText(t1, 5, 5), e1.debugOverlayTexture.update(i), e1.debugOverlayTexture.bind(s.LINEAR, s.CLAMP_TO_EDGE); 35239 }(t1, r); 35240 } 35241 const S = i.getTile(s).tileSize, C = 512 / Math.min(S, 512) * (s.overscaledZ / c.zoom) * .5, E = _._tileDebugTextBuffer || t1.debugBuffer, I = _._tileDebugTextIndexBuffer || t1.quadTriangleIndexBuffer, D = _._tileDebugTextSegments || t1.debugSegments; 35242 m.draw(t1, h.TRIANGLES, g, y, e1.a1.alphaBlended, e1.$.disabled, e1.a0(p, e1.C.transparent.toPremultipliedRenderColor(null), C), b, E, I, D, null, null, null, [ 35243 _._globeTileDebugTextBuffer 35244 ]); 35245 } 35246 function dt(e1, t1, i, s) { 35247 pt(e1, 0, t1 + i / 2, e1.transform.width, i, s); 35248 } 35249 function ut(e1, t1, i, s) { 35250 pt(e1, t1 - i / 2, 0, i, e1.transform.height, s); 35251 } 35252 function pt(t1, i, s, r, o, n) { 35253 const a = t1.context, l = a.gl; 35254 l.enable(l.SCISSOR_TEST), l.scissor(i * e1.e.devicePixelRatio, s * e1.e.devicePixelRatio, r * e1.e.devicePixelRatio, o * e1.e.devicePixelRatio), a.clear({ 35255 color: n 35256 }), l.disable(l.SCISSOR_TEST); 35257 } 35258 function ft(t1, i, s) { 35259 const r = t1.context, o = r.gl, n = s.projMatrix, a = t1.getOrCreateProgram("debug"), l = i.getTileByID(s.key); 35260 t1.terrain && t1.terrain.setupElevationDraw(l, a); 35261 const c = e1.Z.disabled, h = e1._.disabled, d = t1.colorModeForRenderPass(), u = "$debug"; 35262 r.activeTexture.set(o.TEXTURE0), t1.emptyTexture.bind(o.LINEAR, o.CLAMP_TO_EDGE); 35263 const p = l.queryGeometryDebugViz, f = l.queryBoundsDebugViz; 35264 if (p && p.vertices.length > 0) { 35265 p.lazyUpload(r); 35266 const i = p.vertexBuffer, s = p.indexBuffer, l = p.segments; 35267 null != i && null != s && null != l && a.draw(t1, o.LINE_STRIP, c, h, d, e1.$.disabled, e1.a0(n, p.color.toPremultipliedRenderColor(null)), u, i, s, l); 35268 } 35269 if (f && f.vertices.length > 0) { 35270 f.lazyUpload(r); 35271 const i = f.vertexBuffer, s = f.indexBuffer, l = f.segments; 35272 null != i && null != s && null != l && a.draw(t1, o.LINE_STRIP, c, h, d, e1.$.disabled, e1.a0(n, f.color.toPremultipliedRenderColor(null)), u, i, s, l); 35273 } 35274 } 35275 const mt = (t1, i, s, r, o, n, a, l)=>{ 35276 const c = e1.a6 / n.tileSize; 35277 return { 35278 u_matrix: t1, 35279 u_inv_rot_matrix: i, 35280 u_camera_to_center_distance: s.getCameraToCenterDistance(l), 35281 u_extrude_scale: [ 35282 s.pixelsToGLUnits[0] / c, 35283 s.pixelsToGLUnits[1] / c 35284 ], 35285 u_zoom_transition: r, 35286 u_tile_id: a, 35287 u_merc_center: o 35288 }; 35289 }, _t = (e1, t1, i, s)=>({ 35290 u_matrix: e1, 35291 u_inv_matrix: t1, 35292 u_camera_to_center_distance: i.getCameraToCenterDistance(s), 35293 u_viewport_size: [ 35294 i.width, 35295 i.height 35296 ] 35297 }); 35298 function gt(t1, i, s) { 35299 const r = i.createTileMatrix(t1, t1.worldSize, s.toUnwrapped()); 35300 return e1.X(new Float32Array(16), t1.projMatrix, r); 35301 } 35302 function yt(e1, t1, i) { 35303 if (t1.projection.name === i.projection.name) return e1.projMatrix; 35304 const s = i.clone(); 35305 return s.setProjection(t1.projection), gt(s, t1.getProjection(), e1); 35306 } 35307 function vt(e1, t1, i) { 35308 return t1.name === i.projection.name ? e1.projMatrix : gt(i, t1, e1); 35309 } 35310 let bt; 35311 const xt = { 35312 loaded: !0, 35313 validateStyle: function(t1) { 35314 let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : e1.s; 35315 return Ve(je(t1, i)); 35316 }, 35317 validateSource: (e1)=>Ve(Pe(e1)), 35318 validateLight: (e1)=>Ve(Me(e1)), 35319 validateLights: (e1)=>Ve(Oe(e1)), 35320 validateTerrain: (e1)=>Ve(Fe(e1)), 35321 validateFog: (e1)=>Ve(ke(e1)), 35322 validateSnow: (t1)=>Ve(function(t1) { 35323 const i = t1.value, s = t1.style, r = t1.styleSpec, o = r.snow; 35324 if (void 0 === i) return []; 35325 if (!e1.l(i)) return [ 35326 new ce("snow", i, "object expected, ".concat(e1.n(i), " found")) 35327 ]; 35328 let n = []; 35329 for(const t1 in i){ 35330 const a = t1.match(e1.K); 35331 n = n.concat(a && o[a[1]] && o[a[1]].transition ? ze({ 35332 key: t1, 35333 value: i[t1], 35334 valueSpec: r.transition, 35335 style: s, 35336 styleSpec: r 35337 }) : o[t1] ? ze({ 35338 key: t1, 35339 value: i[t1], 35340 valueSpec: o[t1], 35341 style: s, 35342 styleSpec: r 35343 }) : [ 35344 new he(t1, i[t1], 'unknown property "'.concat(t1, '"')) 35345 ]); 35346 } 35347 return n; 35348 }(t1)), 35349 validateRain: (t1)=>Ve(function(t1) { 35350 const i = t1.value, s = t1.style, r = t1.styleSpec, o = r.rain; 35351 if (void 0 === i) return []; 35352 if (!e1.l(i)) return [ 35353 new ce("rain", i, "object expected, ".concat(e1.n(i), " found")) 35354 ]; 35355 let n = []; 35356 for(const t1 in i){ 35357 const a = t1.match(e1.K); 35358 n = n.concat(a && o[a[1]] && o[a[1]].transition ? ze({ 35359 key: t1, 35360 value: i[t1], 35361 valueSpec: r.transition, 35362 style: s, 35363 styleSpec: r 35364 }) : o[t1] ? ze({ 35365 key: t1, 35366 value: i[t1], 35367 valueSpec: o[t1], 35368 style: s, 35369 styleSpec: r 35370 }) : [ 35371 new he(t1, i[t1], 'unknown property "'.concat(t1, '"')) 35372 ]); 35373 } 35374 return n; 35375 }(t1)), 35376 validateLayer: (e1)=>Ve(Ee(e1)), 35377 validateFilter: (e1)=>Ve(be(e1)), 35378 validatePaintProperty: (e1)=>Ve(Se(e1)), 35379 validateLayoutProperty: (e1)=>Ve(Ce(e1)), 35380 validateModel: (e1)=>Ve(Ae(e1)), 35381 diffStyles: function(t1, i) { 35382 if (!t1) return [ 35383 { 35384 command: Ge, 35385 args: [ 35386 i 35387 ] 35388 } 35389 ]; 35390 let s = []; 35391 try { 35392 if (!e1.O(t1.version, i.version)) return [ 35393 { 35394 command: Ge, 35395 args: [ 35396 i 35397 ] 35398 } 35399 ]; 35400 if (e1.O(t1.center, i.center) || s.push({ 35401 command: "setCenter", 35402 args: [ 35403 i.center 35404 ] 35405 }), e1.O(t1.zoom, i.zoom) || s.push({ 35406 command: "setZoom", 35407 args: [ 35408 i.zoom 35409 ] 35410 }), e1.O(t1.bearing, i.bearing) || s.push({ 35411 command: "setBearing", 35412 args: [ 35413 i.bearing 35414 ] 35415 }), e1.O(t1.pitch, i.pitch) || s.push({ 35416 command: "setPitch", 35417 args: [ 35418 i.pitch 35419 ] 35420 }), e1.O(t1.sprite, i.sprite) || s.push({ 35421 command: "setSprite", 35422 args: [ 35423 i.sprite 35424 ] 35425 }), e1.O(t1.glyphs, i.glyphs) || s.push({ 35426 command: "setGlyphs", 35427 args: [ 35428 i.glyphs 35429 ] 35430 }), e1.O(t1.imports, i.imports) || function() { 35431 let t1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], s = arguments.length > 2 ? arguments[2] : void 0; 35432 i = i || []; 35433 const r = (t1 = t1 || []).map(st), o = i.map(st), n = t1.reduce(rt, {}), a = i.reduce(rt, {}), l = r.slice(); 35434 let c, h, d, u; 35435 for(c = 0, h = 0; c < r.length; c++)d = r[c], Object.hasOwn(a, d) ? h++ : (s.push({ 35436 command: Xe, 35437 args: [ 35438 d 35439 ] 35440 }), l.splice(l.indexOf(d, h), 1)); 35441 for(c = 0, h = 0; c < o.length; c++)d = o[o.length - 1 - c], l[l.length - 1 - c] !== d && (Object.hasOwn(n, d) ? (s.push({ 35442 command: Xe, 35443 args: [ 35444 d 35445 ] 35446 }), l.splice(l.lastIndexOf(d, l.length - h), 1)) : h++, u = l[l.length - c], s.push({ 35447 command: "addImport", 35448 args: [ 35449 a[d], 35450 u 35451 ] 35452 }), l.splice(l.length - c, 0, d)); 35453 for (const t1 of i){ 35454 const i = n[t1.id]; 35455 i && (delete i.data, e1.O(i, t1) || s.push({ 35456 command: "updateImport", 35457 args: [ 35458 t1.id, 35459 t1 35460 ] 35461 })); 35462 } 35463 }(t1.imports, i.imports, s), e1.O(t1.transition, i.transition) || s.push({ 35464 command: "setTransition", 35465 args: [ 35466 i.transition 35467 ] 35468 }), e1.O(t1.light, i.light) || s.push({ 35469 command: "setLight", 35470 args: [ 35471 i.light 35472 ] 35473 }), e1.O(t1.fog, i.fog) || s.push({ 35474 command: "setFog", 35475 args: [ 35476 i.fog 35477 ] 35478 }), e1.O(t1.snow, i.snow) || s.push({ 35479 command: "setSnow", 35480 args: [ 35481 i.snow 35482 ] 35483 }), e1.O(t1.rain, i.rain) || s.push({ 35484 command: "setRain", 35485 args: [ 35486 i.rain 35487 ] 35488 }), e1.O(t1.projection, i.projection) || s.push({ 35489 command: "setProjection", 35490 args: [ 35491 i.projection 35492 ] 35493 }), e1.O(t1.lights, i.lights) || s.push({ 35494 command: "setLights", 35495 args: [ 35496 i.lights 35497 ] 35498 }), e1.O(t1.camera, i.camera) || s.push({ 35499 command: "setCamera", 35500 args: [ 35501 i.camera 35502 ] 35503 }), e1.O(t1.iconsets, i.iconsets) || function(t1, i, s) { 35504 let r; 35505 for(r in i = i || {}, t1 = t1 || {})Object.hasOwn(t1, r) && (Object.hasOwn(i, r) || s.push({ 35506 command: Ye, 35507 args: [ 35508 r 35509 ] 35510 })); 35511 for(r in i){ 35512 if (!Object.hasOwn(i, r)) continue; 35513 const o = i[r]; 35514 Object.hasOwn(t1, r) ? e1.O(t1[r], o) || (s.push({ 35515 command: Ye, 35516 args: [ 35517 r 35518 ] 35519 }), s.push({ 35520 command: Ke, 35521 args: [ 35522 r, 35523 o 35524 ] 35525 })) : s.push({ 35526 command: Ke, 35527 args: [ 35528 r, 35529 o 35530 ] 35531 }); 35532 } 35533 }(t1.iconsets, i.iconsets, s), !e1.O(t1["color-theme"], i["color-theme"])) return [ 35534 { 35535 command: Ge, 35536 args: [ 35537 i 35538 ] 35539 } 35540 ]; 35541 const r = {}, o = []; 35542 !function(t1, i, s, r) { 35543 let o; 35544 for(o in i = i || {}, t1 = t1 || {})Object.hasOwn(t1, o) && (Object.hasOwn(i, o) || Je(o, s, r)); 35545 for(o in i){ 35546 if (!Object.hasOwn(i, o)) continue; 35547 const n = i[o]; 35548 Object.hasOwn(t1, o) ? e1.O(t1[o], n) || ("geojson" === t1[o].type && "geojson" === n.type && tt(t1, i, o) ? s.push({ 35549 command: "setGeoJSONSourceData", 35550 args: [ 35551 o, 35552 n.data 35553 ] 35554 }) : et(o, i, s, r)) : Qe(o, i, s); 35555 } 35556 }(t1.sources, i.sources, o, r); 35557 const n = []; 35558 t1.layers && t1.layers.forEach((e1)=>{ 35559 e1.source && r[e1.source] ? s.push({ 35560 command: Ze, 35561 args: [ 35562 e1.id 35563 ] 35564 }) : n.push(e1); 35565 }); 35566 let a = t1.terrain; 35567 a && r[a.source] && (s.push({ 35568 command: We, 35569 args: [ 35570 void 0 35571 ] 35572 }), a = void 0), s = s.concat(o), e1.O(a, i.terrain) || s.push({ 35573 command: We, 35574 args: [ 35575 i.terrain 35576 ] 35577 }), function(t1, i, s) { 35578 i = i || []; 35579 const r = (t1 = t1 || []).map(st), o = i.map(st), n = t1.reduce(rt, {}), a = i.reduce(rt, {}), l = r.slice(), c = Object.create(null); 35580 let h, d, u, p, f, m, _; 35581 for(h = 0, d = 0; h < r.length; h++)u = r[h], Object.hasOwn(a, u) ? d++ : (s.push({ 35582 command: Ze, 35583 args: [ 35584 u 35585 ] 35586 }), l.splice(l.indexOf(u, d), 1)); 35587 for(h = 0, d = 0; h < o.length; h++)u = o[o.length - 1 - h], l[l.length - 1 - h] !== u && (Object.hasOwn(n, u) ? (s.push({ 35588 command: Ze, 35589 args: [ 35590 u 35591 ] 35592 }), l.splice(l.lastIndexOf(u, l.length - d), 1)) : d++, m = l[l.length - h], s.push({ 35593 command: qe, 35594 args: [ 35595 a[u], 35596 m 35597 ] 35598 }), l.splice(l.length - h, 0, u), c[u] = !0); 35599 for(h = 0; h < o.length; h++)if (u = o[h], p = n[u], f = a[u], !c[u] && !e1.O(p, f)) if (e1.O(p.source, f.source) && e1.O(p["source-layer"], f["source-layer"]) && e1.O(p.type, f.type)) { 35600 for(_ in it(p.layout, f.layout, s, u, null, "setLayoutProperty"), it(p.paint, f.paint, s, u, null, $e), e1.O(p.slot, f.slot) || s.push({ 35601 command: "setSlot", 35602 args: [ 35603 u, 35604 f.slot 35605 ] 35606 }), e1.O(p.filter, f.filter) || s.push({ 35607 command: "setFilter", 35608 args: [ 35609 u, 35610 f.filter 35611 ] 35612 }), e1.O(p.minzoom, f.minzoom) && e1.O(p.maxzoom, f.maxzoom) || s.push({ 35613 command: "setLayerZoomRange", 35614 args: [ 35615 u, 35616 f.minzoom, 35617 f.maxzoom 35618 ] 35619 }), p)Object.hasOwn(p, _) && "layout" !== _ && "paint" !== _ && "filter" !== _ && "metadata" !== _ && "minzoom" !== _ && "maxzoom" !== _ && "slot" !== _ && (0 === _.indexOf("paint.") ? it(p[_], f[_], s, u, _.slice(6), $e) : e1.O(p[_], f[_]) || s.push({ 35620 command: He, 35621 args: [ 35622 u, 35623 _, 35624 f[_] 35625 ] 35626 })); 35627 for(_ in f)Object.hasOwn(f, _) && !Object.hasOwn(p, _) && "layout" !== _ && "paint" !== _ && "filter" !== _ && "metadata" !== _ && "minzoom" !== _ && "maxzoom" !== _ && "slot" !== _ && (0 === _.indexOf("paint.") ? it(p[_], f[_], s, u, _.slice(6), $e) : e1.O(p[_], f[_]) || s.push({ 35628 command: He, 35629 args: [ 35630 u, 35631 _, 35632 f[_] 35633 ] 35634 })); 35635 } else s.push({ 35636 command: Ze, 35637 args: [ 35638 u 35639 ] 35640 }), m = l[l.lastIndexOf(u) + 1], s.push({ 35641 command: qe, 35642 args: [ 35643 f, 35644 m 35645 ] 35646 }); 35647 }(n, i.layers, s); 35648 } catch (e1) { 35649 console.warn("Unable to compute style diff:", e1), s = [ 35650 { 35651 command: Ge, 35652 args: [ 35653 i 35654 ] 35655 } 35656 ]; 35657 } 35658 return s; 35659 }, 35660 drawDebug: function(t1, i, s, r, o, n) { 35661 for(let a = 0; a < s.length; a++)if (o) { 35662 const o = 1, l = .8, c = new e1.C(r.r * l, r.g * l, r.b * l, 1); 35663 ht(t1, i, s[a], r, -o, -o, n), ht(t1, i, s[a], r, -o, o, n), ht(t1, i, s[a], r, o, o, n), ht(t1, i, s[a], r, o, -o, n), ht(t1, i, s[a], c, 0, 0, n); 35664 } else ht(t1, i, s[a], r, 0, 0, n); 35665 }, 35666 drawDebugPadding: function(e1) { 35667 const t1 = e1.transform.padding; 35668 dt(e1, e1.transform.height - (t1.top || 0), 3, ot), dt(e1, t1.bottom || 0, 3, nt), ut(e1, t1.left || 0, 3, at), ut(e1, e1.transform.width - (t1.right || 0), 3, lt); 35669 const i = e1.transform.centerPoint; 35670 !function(e1, t1, i, s) { 35671 pt(e1, t1 - 1, i - 10, 2, 20, s), pt(e1, t1 - 10, i - 1, 20, 2, s); 35672 }(e1, i.x, e1.transform.height - i.y, ct); 35673 }, 35674 drawDebugQueryGeometry: function(e1, t1, i) { 35675 for(let s = 0; s < i.length; s++)ft(e1, t1, i[s]); 35676 }, 35677 drawCollisionDebug: function(t1, i, s, r, o, n, a) { 35678 const l = t1.context, c = l.gl, h = t1.transform, d = [ 35679 e1.a7(h.center.lng), 35680 e1.a8(h.center.lat) 35681 ], u = s.layout.get("symbol-placement"), p = s.layout.get("text-variable-anchor"), f = "map" === s.layout.get("icon-rotation-alignment"), m = "map" === s.layout.get("text-rotation-alignment"), _ = "point" !== u, g = []; 35682 let y = 0, v = 0; 35683 for(let l = 0; l < r.length; l++){ 35684 const u = r[l], b = i.getTile(u), x = b.getBucket(s); 35685 if (!x) continue; 35686 const w = x.getProjection().createInversionMatrix(h, u.canonical), T = [], S = yt(u, x, h), C = !a && f && _, E = a && m && _, I = p && x.hasTextData(), D = x.hasIconTextFit() && I && x.hasIconData(), P = C || E || a && I || D, L = "globe" === x.projection.name, R = L ? e1.S(h.zoom) : 0; 35687 L && (T.push("PROJECTION_GLOBE_VIEW"), P && T.push("PROJECTED_POS_ON_VIEWPORT")); 35688 const A = t1.getOrCreateProgram("collisionBox", { 35689 defines: T 35690 }); 35691 let M = S; 35692 0 === o[0] && 0 === o[1] || (M = t1.translatePosMatrix(S, b, o, n)); 35693 const O = a ? x.textCollisionBox : x.iconCollisionBox, F = x.collisionCircleArray; 35694 if (F.length > 0) { 35695 const t1 = e1.Y(), i = M; 35696 e1.a9(t1, x.placementInvProjMatrix, h.glCoordMatrix), e1.a9(t1, t1, x.placementViewportMatrix), g.push({ 35697 circleArray: F, 35698 circleOffset: v, 35699 transform: i, 35700 invTransform: t1, 35701 projection: x.getProjection() 35702 }), y += F.length / 4, v = y; 35703 } 35704 if (!O) continue; 35705 t1.terrain && t1.terrain.setupElevationDraw(b, A); 35706 const k = L ? [ 35707 u.canonical.x, 35708 u.canonical.y, 35709 1 << u.canonical.z 35710 ] : [ 35711 0, 35712 0, 35713 0 35714 ]; 35715 A.draw(t1, c.LINES, e1.Z.disabled, e1._.disabled, t1.colorModeForRenderPass(), e1.$.disabled, mt(M, w, h, R, d, b, k, x.getProjection()), s.id, O.layoutVertexBuffer, O.indexBuffer, O.segments, null, h.zoom, null, [ 35716 O.collisionVertexBuffer, 35717 O.collisionVertexBufferExt 35718 ]); 35719 } 35720 if (!a || !g.length) return; 35721 const b = t1.getOrCreateProgram("collisionCircle"), x = new e1.aa; 35722 x.resize(4 * y), x._trim(); 35723 let w = 0; 35724 for (const e1 of g)for(let t1 = 0; t1 < e1.circleArray.length / 4; t1++){ 35725 const i = 4 * t1, s = e1.circleArray[i + 0], r = e1.circleArray[i + 1], o = e1.circleArray[i + 2], n = e1.circleArray[i + 3]; 35726 x.emplace(w++, s, r, o, n, 0), x.emplace(w++, s, r, o, n, 1), x.emplace(w++, s, r, o, n, 2), x.emplace(w++, s, r, o, n, 3); 35727 } 35728 (!bt || bt.length < 2 * y) && (bt = function(t1) { 35729 const i = 2 * t1, s = new e1.ad; 35730 s.resize(i), s._trim(); 35731 for(let e1 = 0; e1 < i; e1++){ 35732 const t1 = 6 * e1; 35733 s.uint16[t1 + 0] = 4 * e1 + 0, s.uint16[t1 + 1] = 4 * e1 + 1, s.uint16[t1 + 2] = 4 * e1 + 2, s.uint16[t1 + 3] = 4 * e1 + 2, s.uint16[t1 + 4] = 4 * e1 + 3, s.uint16[t1 + 5] = 4 * e1 + 0; 35734 } 35735 return s; 35736 }(y)); 35737 const T = l.createIndexBuffer(bt, !0), S = l.createVertexBuffer(x, e1.ab.members, !0); 35738 for (const i of g){ 35739 const r = _t(i.transform, i.invTransform, h, i.projection); 35740 b.draw(t1, c.TRIANGLES, e1.Z.disabled, e1._.disabled, t1.c
35740olorModeForRenderPass(), e1.$.disabled, r, s.id, S, T, e1.ac.simpleSegment(0, 2 * i.circleOffset, i.circleArray.length, i.circleArray.length / 2), null, h.zoom); 35741 } 35742 S.destroy(), T.destroy(); 35743 } 35744 }; 35745 async function wt() { 35746 return Promise.resolve(); 35747 } 35748 function Tt(t1, i) { 35749 let s = !1; 35750 if (i && i.length) for (const r of i)r instanceof he ? e1.w(r.message) : (t1.fire(new e1.f(new Error(r.message))), s = !0); 35751 return s; 35752 } 35753 function St(e1) { 35754 return function() { 35755 for(var _len = arguments.length, t1 = new Array(_len), _key = 0; _key < _len; _key++){ 35756 t1[_key] = arguments[_key]; 35757 } 35758 const i = xt[e1]; 35759 return i ? i(...t1) : []; 35760 }; 35761 } 35762 const Ct = St("validateStyle"), Et = St("validateSource"), It = St("validateLight"), Dt = St("validateLights"), Pt = St("validateTerrain"), Lt = St("validateFog"), Rt = St("validateSnow"), At = St("validateRain"), Mt = St("validateLayer"), Ot = St("validateFilter"), Ft = St("validatePaintProperty"), kt = St("validateLayoutProperty"), Bt = St("validateModel"), zt = e1.s.light; 35763 let Ut; 35764 class Nt extends e1.E { 35765 getLight() { 35766 return this._transitionable.serialize(); 35767 } 35768 setLight(e1, t1) { 35769 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 35770 this._validate(It, e1, i) || (this._transitionable.setTransitionOrValue(e1), this.id = t1); 35771 } 35772 updateTransitions(e1) { 35773 this._transitioning = this._transitionable.transitioned(e1, this._transitioning); 35774 } 35775 hasTransition() { 35776 return this._transitioning.hasTransition(); 35777 } 35778 recalculate(e1) { 35779 this.properties = this._transitioning.possiblyEvaluate(e1); 35780 } 35781 _validate(t1, i, s) { 35782 return (!s || !1 !== s.validate) && Tt(this, t1.call(Ct, { 35783 value: i, 35784 style: { 35785 glyphs: !0, 35786 sprite: !0 35787 }, 35788 styleSpec: e1.s 35789 })); 35790 } 35791 constructor(t1, i = "flat"){ 35792 super(), this._transitionable = new e1.ae(Ut || (Ut = new e1.af({ 35793 anchor: new e1.ag(zt.anchor), 35794 position: new e1.ah(zt.position), 35795 color: new e1.ag(zt.color), 35796 intensity: new e1.ag(zt.intensity) 35797 }))), this.setLight(t1, i), this._transitioning = this._transitionable.untransitioned(); 35798 } 35799 } 35800 const jt = e1.s.terrain; 35801 let Vt = class extends e1.E { 35802 get() { 35803 return this._transitionable.serialize(); 35804 } 35805 set(e1, t1) { 35806 this._transitionable.setTransitionOrValue(e1, t1); 35807 } 35808 updateTransitions(e1) { 35809 this._transitioning = this._transitionable.transitioned(e1, this._transitioning); 35810 } 35811 hasTransition() { 35812 return this._transitioning.hasTransition(); 35813 } 35814 recalculate(e1) { 35815 this.properties = this._transitioning.possiblyEvaluate(e1); 35816 } 35817 getExaggeration(t1) { 35818 return this._transitioning.possiblyEvaluate(new e1.ai(t1, { 35819 worldview: this.worldview 35820 })).get("exaggeration"); 35821 } 35822 getAttenuationRange() { 35823 if (!this.isZoomDependent()) return null; 35824 const t1 = this._transitionable._values.exaggeration; 35825 if (!t1) return null; 35826 const i = t1.value.expression; 35827 if (!i) return null; 35828 let s = -1, r = -1, o = 1; 35829 for (const t1 of i.zoomStops)o = i.evaluate(new e1.ai(t1, { 35830 worldview: this.worldview 35831 })), o > .01 ? (s = t1, r = -1) : r = t1; 35832 return o < .01 && s > 0 && r > s ? [ 35833 s, 35834 r 35835 ] : null; 35836 } 35837 isZoomDependent() { 35838 const t1 = this._transitionable._values.exaggeration; 35839 return null != t1 && null != t1.value && null != t1.value.expression && t1.value.expression instanceof e1.aj; 35840 } 35841 constructor(t1, i, s, r, o){ 35842 super(), this.scope = s, this._transitionable = new e1.ae(new e1.af({ 35843 source: new e1.ag(jt.source), 35844 exaggeration: new e1.ag(jt.exaggeration) 35845 }), s, r), this._transitionable.setTransitionOrValue(t1, r), this._transitioning = this._transitionable.untransitioned(), this.drapeRenderMode = i, this.worldview = o; 35846 } 35847 }; 35848 function Gt(e1, t1) { 35849 const i = e1 ? e1.terrain : null; 35850 return !!i && (!t1 || !!t1.projection.requiresDraping || !i.isZoomDependent() || i.getExaggeration(t1.zoom) > 0); 35851 } 35852 const qt = e1.s.fog; 35853 class Zt extends e1.E { 35854 get state() { 35855 const t1 = this._transform, i = "globe" === t1.projection.name, s = e1.S(t1.zoom), r = this.properties.get("range"), o = [ 35856 2, 35857 4.5 35858 ], n = .5 / Math.tan(.5 * t1._fov), a = [ 35859 r[0] + n, 35860 r[1] + n 35861 ]; 35862 return { 35863 range: i ? [ 35864 e1.al(o[0], a[0], s), 35865 e1.al(o[1], a[1], s) 35866 ] : a, 35867 horizonBlend: this.properties.get("horizon-blend"), 35868 alpha: this.properties.get("color").a 35869 }; 35870 } 35871 get() { 35872 return this._transitionable.serialize(); 35873 } 35874 set(e1, t1) { 35875 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
35876 if (this._validate(Lt, e1, i)) return; 35877 const s = { 35878 ...e1 35879 }; 35880 for (const e1 of Object.keys(qt))void 0 === s[e1] && (s[e1] = qt[e1].default); 35881 this._options = s, this._transitionable.setTransitionOrValue(this._options, t1); 35882 } 35883 getOpacity(t1) { 35884 if (!this._transform.projection.supportsFog) return 0; 35885 const i = this.properties && this.properties.get("color") || 1; 35886 return ("globe" === this._transform.projection.name ? 1 : e1.am(e1.ao, e1.an, t1)) * i.a; 35887 } 35888 getOpacityAtLatLng(t1, i) { 35889 return this._transform.projection.supportsFog ? e1.ap(this.state, t1, i) : 0; 35890 } 35891 getOpacityForTile(t1) { 35892 if (!this._transform.projection.supportsFog) return [ 35893 1, 35894 1 35895 ]; 35896 const i = this._transform.calculateFogTileMatrix(t1.toUnwrapped()); 35897 return e1.aq(this.state, i, 0, 0, e1.a6, e1.a6, this._transform); 35898 } 35899 getOpacityForBounds(t1, i, s, r, o) { 35900 return this._transform.projection.supportsFog ? e1.aq(this.state, t1, i, s, r, o, this._transform) : [ 35901 1, 35902 1 35903 ]; 35904 } 35905 getRangeForProjection() { 35906 return this._transform.projection.supportsFog ? this.state.range : [ 35907 0, 35908 1 35909 ]; 35910 } 35911 isVisibleOnFrustum(t1) { 35912 if (!this._transform.projection.supportsFog) return !1; 35913 const i = [ 35914 4, 35915 5, 35916 6, 35917 7 35918 ]; 35919 for (const s of i){ 35920 const i = t1.points[s]; 35921 let r; 35922 if (i[2] >= 0) r = i; 35923 else { 35924 const o = t1.points[s - 4]; 35925 r = e1.ar(o, i, o[2] / (o[2] - i[2])); 35926 } 35927 if (e1.as(this.state, r[0], r[1], 0, this._transform) >= e1.at) return !0; 35928 } 35929 return !1; 35930 } 35931 updateConfig(e1) { 35932 this._transitionable.setTransitionOrValue(this._options, e1); 35933 } 35934 updateTransitions(e1) { 35935 this._transitioning = this._transitionable.transitioned(e1, this._transitioning); 35936 } 35937 hasTransition() { 35938 return this._transitioning.hasTransition(); 35939 } 35940 recalculate(e1) { 35941 this.properties = this._transitioning.possiblyEvaluate(e1); 35942 } 35943 _validate(t1, i, s) { 35944 return (!s || !1 !== s.validate) && Tt(this, t1.call(Ct, { 35945 value: i, 35946 style: { 35947 glyphs: !0, 35948 sprite: !0 35949 }, 35950 styleSpec: e1.s 35951 })); 35952 } 35953 constructor(t1, i, s, r){ 35954 super(); 35955 const o = new e1.af({ 35956 range: new e1.ag(qt.range), 35957 color: new e1.ag(qt.color), 35958 "color-use-theme": new e1.ag({ 35959 type: "string", 35960 "property-type": "data-constant", 35961 default: "default" 35962 }), 35963 "high-color": new e1.ag(qt["high-color"]), 35964 "high-color-use-theme": new e1.ag({ 35965 type: "string", 35966 "property-type": "data-constant", 35967 default: "default" 35968 }), 35969 "space-color": new e1.ag(qt["space-color"]), 35970 "space-color-use-theme": new e1.ag({ 35971 type: "string", 35972 "property-type": "data-constant", 35973 default: "default" 35974 }), 35975 "horizon-blend": new e1.ag(qt["horizon-blend"]), 35976 "star-intensity": new e1.ag(qt["star-intensity"]), 35977 "vertical-range": new e1.ag(qt["vertical-range"]) 35978 }); 35979 this._transitionable = new e1.ae(o, s, r), this.set(t1, r), this._transitioning = this._transitionable.untransitioned(), this._transform = i, this.properties = new e1.ak(o), this.scope = s; 35980 } 35981 } 35982 let $t, Ht, Wt = class extends e1.E { 35983 get state() { 35984 const t1 = this.properties.get("opacity"), i = this.properties.get("color"), s = this.properties.get("direction"), r = e1.au(s[0]), o = -Math.max(e1.au(s[1]), .01), n = [ 35985 Math.cos(r) * Math.cos(o), 35986 Math.sin(r) * Math.cos(o), 35987 Math.sin(o) 35988 ], a = this.properties.get("vignette"), l = this.properties.get("vignette-color"), c = new e1.C(l.r, l.g, l.b, a); 35989 return { 35990 density: this.properties.get("density"), 35991 intensity: this.properties.get("intensity"), 35992 color: new e1.C(i.r, i.g, i.b, i.a * t1), 35993 direction: n, 35994 centerThinning: this.properties.get("center-thinning"), 35995 flakeSize: this.properties.get("flake-size"), 35996 vignetteColor: c 35997 }; 35998 } 35999 get() { 36000 return this._transitionable.serialize(); 36001 } 36002 set(t1, i) { 36003 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
36004 if (this._validate(Rt, t1, s)) return; 36005 const r = { 36006 ...t1 36007 }, o = e1.s.snow; 36008 for (const e1 of Object.keys(o))void 0 === r[e1] && (r[e1] = o[e1].default); 36009 this._options = r, this._transitionable.setTransitionOrValue(this._options, i); 36010 } 36011 updateConfig(e1) { 36012 this._transitionable.setTransitionOrValue(this._options, e1); 36013 } 36014 updateTransitions(e1) { 36015 this._transitioning = this._transitionable.transitioned(e1, this._transitioning); 36016 } 36017 hasTransition() { 36018 return this._transitioning.hasTransition(); 36019 } 36020 recalculate(e1) { 36021 this.properties = this._transitioning.possiblyEvaluate(e1); 36022 } 36023 _validate(t1, i, s) { 36024 return (!s || !1 !== s.validate) && Tt(this, t1.call(Ct, { 36025 value: i, 36026 style: { 36027 glyphs: !0, 36028 sprite: !0 36029 }, 36030 styleSpec: e1.s 36031 })); 36032 } 36033 constructor(t1, i, s, r){ 36034 super(); 36035 const o = $t || ($t = new e1.af({ 36036 density: new e1.ag(e1.s.snow.density), 36037 intensity: new e1.ag(e1.s.snow.intensity), 36038 color: new e1.ag(e1.s.snow.color), 36039 opacity: new e1.ag(e1.s.snow.opacity), 36040 vignette: new e1.ag(e1.s.snow.vignette), 36041 "vignette-color": new e1.ag(e1.s.snow["vignette-color"]), 36042 "center-thinning": new e1.ag(e1.s.snow["center-thinning"]), 36043 direction: new e1.ag(e1.s.snow.direction), 36044 "flake-size": new e1.ag(e1.s.snow["flake-size"]) 36045 })); 36046 this._transitionable = new e1.ae(o, s, r), this.set(t1, r), this._transitioning = this._transitionable.untransitioned(), this.properties = new e1.ak(o), this.scope = s; 36047 } 36048 }, Xt = class extends e1.E { 36049 get state() { 36050 const t1 = this.properties.get("opacity"), i = this.properties.get("color"), s = this.properties.get("direction"), r = e1.au(s[0]), o = -Math.max(e1.au(s[1]), .01), n = [ 36051 Math.cos(r) * Math.cos(o), 36052 Math.sin(r) * Math.cos(o), 36053 Math.sin(o) 36054 ], a = this.properties.get("vignette-color"), l = new e1.C(a.r, a.g, a.b, this.properties.get("vignette")); 36055 return { 36056 density: this.properties.get("density"), 36057 intensity: this.properties.get("intensity"), 36058 color: new e1.C(i.r, i.g, i.b, i.a * t1), 36059 direction: n, 36060 centerThinning: this.properties.get("center-thinning"), 36061 dropletSize: this.properties.get("droplet-size"), 36062 distortionStrength: this.properties.get("distortion-strength"), 36063 vignetteColor: l 36064 }; 36065 } 36066 get() { 36067 return this._transitionable.serialize(); 36068 } 36069 set(t1, i) { 36070 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 36071 if (this._validate(At, t1, s)) return; 36072 const r = { 36073 ...t1 36074 }, o = e1.s.rain; 36075 for (const e1 of Object.keys(o))void 0 === r[e1] && (r[e1] = o[e1].default); 36076 this._options = r, this._transitionable.setTransitionOrValue(this._options, i); 36077 } 36078 updateConfig(e1) { 36079 this._transitionable.setTransitionOrValue(this._options, e1); 36080 } 36081 updateTransitions(e1) { 36082 this._transitioning = this._transitionable.transitioned(e1, this._transitioning); 36083 } 36084 hasTransition() { 36085 return this._transitioning.hasTransition(); 36086 } 36087 recalculate(e1) { 36088 this.properties = this._transitioning.possiblyEvaluate(e1); 36089 } 36090 _validate(t1, i, s) { 36091 return (!s || !1 !== s.validate) && Tt(this, t1.call(Ct, { 36092 value: i, 36093 style: { 36094 glyphs: !0, 36095 sprite: !0 36096 }, 36097 styleSpec: e1.s 36098 })); 36099 } 36100 constructor(t1, i, s, r){ 36101 super(); 36102 const o = Ht || (Ht = new e1.af({ 36103 density: new e1.ag(e1.s.rain.density), 36104 intensity: new e1.ag(e1.s.rain.intensity), 36105 color: new e1.ag(e1.s.rain.color), 36106 opacity: new e1.ag(e1.s.rain.opacity), 36107 vignette: new e1.ag(e1.s.rain.vignette), 36108 "vignette-color": new e1.ag(e1.s.rain["vignette-color"]), 36109 "center-thinning": new e1.ag(e1.s.rain["center-thinning"]), 36110 direction: new e1.ag(e1.s.rain.direction), 36111 "droplet-size": new e1.ag(e1.s.rain["droplet-size"]), 36112 "distortion-strength": new e1.ag(e1.s.rain["distortion-strength"]) 36113 })); 36114 this._transitionable = new e1.ae(o, s, r), this.set(t1, r), this._transitioning = this._transitionable.untransitioned(), this.properties = new e1.ak(o), this.scope = s; 36115 } 36116 }; 36117 const Kt = { 36118 workerUrl: "", 36119 workerClass: null, 36120 workerParams: void 0 36121 }; 36122 function Yt(e1) { 36123 return null != Kt.workerClass ? new Kt.workerClass : new self.Worker(Kt.workerUrl, { 36124 name: e1, 36125 type: "module", 36126 ...Kt.workerParams 36127 }); 36128 } 36129 const Qt = "mapboxgl_preloaded_worker_pool"; 36130 class Jt { 36131 acquire(e1) { 36132 let t1 = arguments.length >
36132 1 && arguments[1] !== void 0 ? arguments[1] : Jt.workerCount; 36133 if (!this.workers) for(this.workers = []; this.workers.length < t1;){ 36134 const t1 = Yt("".concat(this.name || "", "WorkerPool: ").concat(e1, "-").concat(this.workers.length)); 36135 this.workers.push(t1); 36136 } 36137 return this.active[e1] = !0, this.workers.slice(); 36138 } 36139 release(e1) { 36140 delete this.active[e1], this.workers && 0 === this.numActive() && (this.workers.forEach((e1)=>{ 36141 e1.terminate(); 36142 }), this.workers = null); 36143 } 36144 isPreloaded() { 36145 return !!this.active[Qt]; 36146 } 36147 numActive() { 36148 return Object.keys(this.active).length; 36149 } 36150 constructor(e1){ 36151 this.active = {}, this.workers = null, this.name = e1; 36152 } 36153 } 36154 Jt.workerCount = 2; 36155 class ei { 36156 send(e1, t1, i) { 36157 return Promise.all(this.actors.map((s)=>s.send(e1, t1, i))); 36158 } 36159 broadcast(e1, t1) { 36160 for (const i of this.actors)i.notify(e1, t1); 36161 } 36162 getActor() { 36163 return this.currentActor = (this.currentActor + 1) % this.actors.length, this.actors[this.currentActor]; 36164 } 36165 remove() { 36166 this.actors.forEach((e1)=>{ 36167 e1.remove(); 36168 }), this.actors = [], this.workerPool.release(this.id); 36169 } 36170 constructor(t1, i, s = "Worker", r = Jt.workerCount){ 36171 this.workerPool = t1, this.actors = [], this.currentActor = 0, this.id = e1.av(); 36172 const o = this.workerPool.acquire(this.id, r); 36173 for(let e1 = 0; e1 < o.length; e1++){ 36174 const t1 = new ei.Actor(o[e1], i, this.id); 36175 t1.name = "".concat(s, " ").concat(e1), this.actors.push(t1); 36176 } 36177 this.ready = !1, this.send("checkIfReady", null).then(()=>{ 36178 this.ready = !0; 36179 }).catch(()=>{}); 36180 } 36181 } 36182 ei.Actor = e1.aw; 36183 class ti extends e1.E { 36184 updateConfig(e1) { 36185 this._transitionable.setTransitionOrValue(this._options.properties, e1); 36186 } 36187 updateTransitions(e1) { 36188 this._transitioning = this._transitionable.transitioned(e1, this._transitioning); 36189 } 36190 hasTransition() { 36191 return this._transitioning.hasTransition(); 36192 } 36193 recalculate(e1) { 36194 this.properties = this._transitioning.possiblyEvaluate(e1); 36195 } 36196 get() { 36197 return this._options.properties = this._transitionable.serialize(), this._options; 36198 } 36199 set(e1, t1) { 36200 this._options = e1, this._transitionable.setTransitionOrValue(e1.properties, t1); 36201 } 36202 shadowsEnabled() { 36203 return !!this.properties && !0 === this.properties.get("cast-shadows"); 36204 } 36205 constructor(t1, i, s, r){ 36206 super(), this.scope = s, this._options = t1, this.properties = new e1.ak(i), this._transitionable = new e1.ae(i, s, r), this._transitionable.setTransitionOrValue(t1.properties), this._transitioning = this._transitionable.untransitioned(); 36207 } 36208 } 36209 let ii; 36210 const si = ()=>ii || (ii = new e1.af({ 36211 color: new e1.ag(e1.s.properties_light_ambient.color), 36212 "color-use-theme": new e1.ag({ 36213 type: "string", 36214 default: "default", 36215 "property-type": "data-constant" 36216 }), 36217 intensity: new e1.ag(e1.s.properties_light_ambient.intensity) 36218 })); 36219 let ri; 36220 const oi = ()=>ri || (ri = new e1.af({ 36221 direction: new e1.ax(e1.s.properties_light_directional.direction), 36222 color: new e1.ag(e1.s.properties_light_directional.color), 36223 "color-use-theme": new e1.ag({ 36224 type: "string", 36225 default: "default", 36226 "property-type": "data-constant" 36227 }), 36228 intensity: new e1.ag(e1.s.properties_light_directional.intensity), 36229 "cast-shadows": new e1.ag(e1.s.properties_light_directional["cast-shadows"]), 36230 "shadow-quality": new e1.ag(e1.s.properties_light_directional["shadow-quality"]), 36231 "shadow-intensity": new e1.ag(e1.s.properties_light_directional["shadow-intensity"]), 36232 "shadow-draw-before-layer": new e1.ag(e1.s.properties_light_directional["shadow-draw-before-layer"]) 36233 })), ni = function(e1, t1, i, s, r, o, n, a, l) { 36234 let c = arguments.length > 9 && arguments[9] !== void 0 ? arguments[9] : [ 36235 0, 36236 0, 36237 1 36238 ]; 36239 return { 36240 u_matrix: e1, 36241 u_normal_matrix: t1, 36242 u_opacity: i, 36243 u_faux_facade_ao_intensity: s, 36244 u_camera_pos: r, 36245 u_tile_to_meter: o, 36246 u_facade_emissive_chance: n, 36247 u_flood_light_color: a, 36248 u_flood_light_intensity: l, 36249 u_front_cutoff_params: c 36250 }; 36251 }, ai = (e1)=>({ 36252 u_matrix: e1 36253 }), li = (e1)=>({ 36254 u_matrix: e1 36255 }), ci = e1.ay; 36256 async function hi() { 36257 return Promise.resolve(); 36258 } 36259 function di(t1, i, s, r, o, n, a, l) { 36260 s.resetLayerRenderingStats(t1); 36261 const c = t1.context, h = c.gl, d = t1.transform, u = s.paint.get("fill-extrusion-pattern"), p
vendor: 27,546 bytes, lines 36261-36756
36261= s.paint.get("fill-extrusion-pattern-cross-fade"), f = u.constantOr(null), m = u.constantOr(1), _ = s.paint.get("fill-extrusion-opacity"), g = t1.style.enable3dLights(), y = s.paint.get(g && !m ? "fill-extrusion-ambient-occlusion-wall-radius" : "fill-extrusion-ambient-occlusion-radius"), v = [ 36262 s.paint.get("fill-extrusion-ambient-occlusion-intensity"), 36263 y 36264 ], b = s.layout.get("fill-extrusion-edge-radius"), x = b > 0 && !s.paint.get("fill-extrusion-rounded-roof"), w = x ? 0 : b, T = "globe" === d.projection.name ? e1.aD() : 0, S = "globe" === d.projection.name, C = S ? e1.S(d.zoom) : 0, E = [ 36265 e1.a7(d.center.lng), 36266 e1.a8(d.center.lat) 36267 ], I = "none" === s.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"), D = s.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(I ? null : s.lut).toArray01().slice(0, 3), P = s.paint.get("fill-extrusion-flood-light-intensity"), L = s.paint.get("fill-extrusion-vertical-scale"), R = 0 !== s.paint.get("fill-extrusion-line-width").constantOr(1), A = s.paint.get("fill-extrusion-height-alignment"), M = s.paint.get("fill-extrusion-base-alignment"), O = e1.aE(t1, s.paint.get("fill-extrusion-cutoff-fade-range")), F = s.paint.get("fill-extrusion-front-cutoff"), k = pi(d.pitch, F, !!t1.terrain), B = k[2] < 1; 36268 B && (t1.maxFrontCutoffRawStart = Math.max(t1.maxFrontCutoffRawStart, F[0])); 36269 const z = []; 36270 let U; 36271 S && z.push("PROJECTION_GLOBE_VIEW"), v[0] > 0 && z.push("FAUX_AO"), x && z.push("ZERO_ROOF_RADIUS"), l && z.push("HAS_CENTROID"), P > 0 && z.push("FLOOD_LIGHT"), O.shouldRenderCutoff && z.push("RENDER_CUTOFF"), B && z.push("RENDER_FRONT_CUTOFF"), R && z.push("RENDER_WALL_MODE"); 36272 const N = "shadow" === t1.renderPass, j = t1.shadowRenderer, V = N && !!j, G = N ? e1.$.disabled : e1.$.backCCW; 36273 t1.shadowRenderer && (t1.shadowRenderer.useNormalOffset = !0); 36274 let q = [ 36275 0, 36276 0, 36277 0 36278 ]; 36279 if (j) { 36280 const i = t1.style.directionalLight, s = t1.style.ambientLight; 36281 i && s && (q = e1.aF(t1.style, i, s)), N || (z.push("RENDER_SHADOWS"), j.useNormalOffset && z.push("NORMAL_OFFSET")), U = z.concat([ 36282 "SHADOWS_SINGLE_CASCADE" 36283 ]); 36284 } 36285 const Z = V ? "fillExtrusionDepth" : m ? "fillExtrusionPattern" : "fillExtrusion", $ = s.getLayerRenderingStats(); 36286 for (const u of r){ 36287 const r = i.getTile(u), g = r.getBucket(s); 36288 if (!g || g.projection.name !== d.projection.name) continue; 36289 let y = !1; 36290 j && (y = 0 === j.getMaxCascadeForTile(u.toUnwrapped())); 36291 const b = t1.isTileAffectedByFog(u), x = g.programConfigurations.get(s.id); 36292 let I = !1; 36293 if (f && r.imageAtlas) { 36294 const t1 = r.imageAtlas, i = e1.aG.from(f), s = i.getPrimary().scaleSelf(e1.e.devicePixelRatio).toString(), o = i.getSecondary(), n = t1.patternPositions.get(s), a = o ? t1.patternPositions.get(o.scaleSelf(e1.e.devicePixelRatio).toString()) : null; 36295 I = !!n && !!a, n && x.setConstantPatternPositions(n, a); 36296 } 36297 p > 0 && (I || x.getPatternTransitionVertexBuffer("fill-extrusion-pattern")) && z.push("FILL_EXTRUSION_PATTERN_TRANSITION"); 36298 const F = t1.getOrCreateProgram(Z, { 36299 config: x, 36300 defines: y ? U : z, 36301 overrideFog: b 36302 }); 36303 if (t1.terrain && t1.terrain.setupElevationDraw(r, F, { 36304 useMeterToDem: !0 36305 }), !g.centroidVertexBuffer) { 36306 const e1 = F.getAttributeLocation(h, "a_centroid_pos"); 36307 -1 !== e1 && h.vertexAttribI4ui(e1, 0, 0, 0, 0); 36308 } 36309 !N && j && j.setupShadows(r.tileID.toUnwrapped(), F, "vector-tile"), m && (t1.context.activeTexture.set(h.TEXTURE0), r.imageAtlasTexture && r.imageAtlasTexture.bind(h.LINEAR, h.CLAMP_TO_EDGE), x.updatePaintBuffers()); 36310 const B = s.paint.get("fill-extrusion-vertical-gradient"), V = 1 / g.tileToMeter; 36311 let H; 36312 if (N && j) { 36313 if (yi(r.tileID, g.maxHeight, t1)) continue; 36314 const i = j.calculateShadowPassMatrixFromTile(r.tileID.toUnwrapped()); 36315 H = e1.aM(i, w, V, L, A, M); 36316 } else { 36317 const i = t1.translatePosMatrix(u.expandedProjMatrix, r, s.paint.get("fill-extrusion-translate"), s.paint.get("fill-extrusion-translate-anchor")), o = d.projection.createInversionMatrix(d, u.canonical), n = F.fixedDefines.includes("LIGHTING_3D_MODE"); 36318 H = m ? e1.aH(i, t1, B, _, v, w, V, u, r, T, A, M, C, E, o, D, L, p, n) : e1.aI(i, t1, B, _, v, w, V, u, T, A, M, C, E, o, D, L, P, q, k, n); 36319 } 36320 t1.uploadCommonUniforms(c, F, u.toUnwrapped(), null, O); 36321 let W = g.segments; 36322 if ("mercator" === d.projection.name && !N && (W = g.getVisibleSegments(r.tileID, t1.terrain, t1.transform.getFrustum(0)), !W.get().length)) continue; 36323 if ($) if (N) for (const e1 of W.get())$.numRenderedVerticesInShadowPass += e1.primitiveLength; 36324 else for (const e1 of W.get())$.numRenderedVerticesInTransparentPass += e1.primitiveLength; 36325 const X = []; 36326 (t1.terrain || l) && X.push(g.centroidVertexBuffer), S && X.push(g.layoutVertexExtBuffer), R && X.push(g.wallVertexBuffer), F.draw(t1, c.gl.TRIANGLES, o, n, a, G, H, s.id, g.layoutVertexBuffer, g.indexBuffer, W, s.paint, t1.transform.zoom, x, X); 36327 } 36328 t1.shadowRenderer && (t1.shadowRenderer.useNormalOffset = !1); 36329 } 36330 class ui { 36331 constructor(){ 36332 this.translate = [ 36333 0, 36334 0 36335 ], this.translateAnchor = "map", this.edgeRadius = 0, this.cutoffFadeRange = 0; 36336 } 36337 } 36338 function pi(e1, t1, i) { 36339 if (!(t1[2] < 1) || i) return [ 36340 0, 36341 0, 36342 1 36343 ]; 36344 const s = 180 * e1 / Math.PI; 36345 if (s < 15) return [ 36346 -.5, 36347 t1[1], 36348 t1[2] 36349 ]; 36350 const r = Math.min(1, Math.max(0, (s - 15) / 5)), o = r * r * (3 - 2 * r); 36351 return [ 36352 -.5 * (1 - o) + t1[0] * o, 36353 t1[1], 36354 t1[2] 36355 ]; 36356 } 36357 function fi(t1, i, s, r, o, n, a) { 36358 0 === r.centroidVertexArray.length && r.createCentroidsBuffer(); 36359 const l = n ? n.findDEMTileFor(s) : null; 36360 if (!(l && l.dem || a)) return; 36361 n && l && l.dem && r.selfDEMTileTimestamp !== l.dem._timestamp && (r.borderDoneWithNeighborZ = [ 36362 -1, 36363 -1, 36364 -1, 36365 -1 36366 ], r.selfDEMTileTimestamp = l.dem._timestamp); 36367 const c = (t1, i)=>{ 36368 (t1.flags | i.flags) & e1.aJ ? (t1.flags |= e1.aJ, i.flags |= e1.aJ) : (t1.flags &= ~e1.aJ, i.flags &= ~e1.aJ); 36369 }, h = (t1)=>new e1.P(Math.ceil((t1 + e1.aK) * e1.aL), 0), d = (t1, i, s)=>{ 36370 const r = Math.ceil((t1 + e1.aK) * e1.aL), o = Math.floor(Math.max(0, Math.min(e1.a6 - 1, s)) / 4); 36371 return new e1.P(r, o << 5 | (3 & i) << 3 | 7); 36372 }, u = (t1, i)=>{ 36373 const s = Number.MAX_VALUE, r = i[0][0] !== s, o = i[1][0] !== s, n = i[2][0] !== s, a = i[3][0] !== s; 36374 if (!((r ? 1 : 0) + (o ? 1 : 0) + (n ? 1 : 0) + (a ? 1 : 0) > 2)) return t1 < 2 ? n === a ? void 0 : n ? 0 : e1.a6 - 1 : r === o ? void 0 : r ? 0 : e1.a6 - 1; 36375 }, p = (e1, t1, i, s)=>{ 36376 var _ref; 36377 return (_ref = t1 ? u(e1, t1) : void 0) !== null && _ref !== void 0 ? _ref : s ? u(i, s) : void 0; 36378 }, f = (e1)=>{ 36379 const t1 = i.getSource().minzoom, s = (e1)=>{ 36380 const t1 = i.getTileByID(e1); 36381 if (t1 && t1.hasData()) return t1.getBucket(o); 36382 }, r = [ 36383 0, 36384 -1, 36385 1 36386 ]; 36387 for (const i of r){ 36388 if (e1.overscaledZ + i < t1) continue; 36389 const r = s(e1.calculateScaledKey(e1.overscaledZ + i)); 36390 if (r) return r; 36391 } 36392 }, m = [ 36393 0, 36394 0, 36395 0 36396 ], _ = (t1, i)=>(m[0] = Math.min(t1.min.y, i.min.y), m[1] = Math.max(t1.max.y, i.max.y), m[2] = e1.a6 - i.min.x > t1.max.x ? i.min.x - e1.a6 : t1.max.x, m), g = (t1, i)=>(m[0] = Math.min(t1.min.x, i.min.x), m[1] = Math.max(t1.max.x, i.max.x), m[2] = e1.a6 - i.min.y > t1.max.y ? i.min.y - e1.a6 : t1.max.y, m), y = [ 36397 (e1, t1)=>_(e1, t1), 36398 (e1, t1)=>_(t1, e1), 36399 (e1, t1)=>g(e1, t1), 36400 (e1, t1)=>g(t1, e1) 36401 ], v = (t1, i, r, o, a, c, h)=>{ 36402 if (!n) return 0; 36403 const d = [ 36404 [ 36405 c ? r : t1, 36406 c ? t1 : r, 36407 0 36408 ], 36409 [ 36410 c ? r : i, 36411 c ? i : r, 36412 0 36413 ] 36414 ], u = h < 0 ? e1.a6 + h : h, p = [ 36415 c ? u : (t1 + i) / 2, 36416 c ? (t1 + i) / 2 : u, 36417 0 36418 ]; 36419 return 0 === r && h < 0 || 0 !== r && h > 0 ? n.getForTilePoints(a, [ 36420 p 36421 ], !0, o) : d.push(p), n.getForTilePoints(s, d, !0, l), Math.max(d[0][2], d[1][2], p[2]) / n.exaggeration(); 36422 }; 36423 for(let t1 = 0; t1 < 4; t1++){ 36424 const i = r.borderFeatureIndices[t1]; 36425 if (0 === i.length) continue; 36426 const o = e1.aB[t1](s), l = f(o); 36427 if (!(l && l instanceof e1.aC)) continue; 36428 const u = n ? n.findDEMTileFor(o) : null; 36429 if (!(u && u.dem || a)) continue; 36430 if (n && u && u.dem && r.borderDEMTileTimestamp[t1] !== u.dem._timestamp && (r.borderDoneWithNeighborZ[t1] = -1, r.borderDEMTileTimestamp[t1] = u.dem._timestamp), r.borderDoneWithNeighborZ[t1] === l.canonical.z) continue; 36431 0 === l.centroidVertexArray.length && l.createCentroidsBuffer(); 36432 const m = (t1 < 2 ? 1 : 5) - t1, _ = l.borderDoneWithNeighborZ[m] !== r.canonical.z, g = l.borderFeatureIndices[m]; 36433 let b = 0; 36434 if (r.canonical.z !== l.canonical.z) { 36435 for (const e1 of i)r.showCentroid(r.featuresOnBorder[e1], "discard"); 36436 if (_) for (const e1 of g)l.showCentroid(l.featuresOnBorder[e1], "discard"); 36437 r.borderDoneWithNeighborZ[t1] = l.canonical.z, l.borderDoneWithNeighborZ[m] = r.canonical.z; 36438 continue; 36439 } 36440 const x = new Map, w = new Set, T = new Set; 36441 for(let e1 = 0; e1 < g.length; e1++){ 36442 const t1 = l.featuresOnBorder[g[e1]]; 36443 void 0 !== t1.buildingId && x.set(t1.buildingId, e1); 36444 } 36445 for (const s of i){ 36446 const i = r.featuresOnBorder[s], h = r.centroidData.get(i.centroidDataIndex); 36447 if (void 0 === i.buildingId) continue; 36448 const f = x.get(i.buildingId); 36449 if (void 0 === f) continue; 36450 const _ = l.featuresOnBorder[g[f]], b = l.centroidData.get(_.centroidDataIndex); 36451 w.add(s), T.add(f), a && c(h, b); 36452 const S = 0 !== h.groupCentroidPos.x || 0 !== h.groupCentroidPos.y ? h.groupCentroidPos : i.centroid(), C = 0 !== b.groupCentroidPos.x || 0 !== b.groupCentroidPos.y ? b.groupCentroidPos : _.centroid(), E = n ? void 0 : p(t1, i.borders, m, _.borders), I = void 0 !== E ? E : t1 < 2 ? Math.round((S.y + C.y) / 2) : Math.round((S.x + C.x) / 2), D = i.intersectsCount() > 1 || _.intersectsCount() > 1; 36453 { 36454 let i = 0; 36455 if (u && u.dem && !D) { 36456 const s = y[t1](h, b), r = t1 % 2 ? e1.a6 - 1 : 0; 36457 i = v(s[0], Math.min(e1.a6 - 1, s[1]), r, u, o, t1 < 2, s[2]); 36458 } 36459 h.centroidXY = d(i, t1, I), b.centroidXY = d(i, m, I); 36460 } 36461 if (r.writeCentroidToBuffer(h), l.writeCentroidToBuffer(b), void 0 !== i.buildingId) { 36462 for (const e1 of r.centroidData)e1.buildingId === i.buildingId && e1 !== h && (e1.centroidXY = h.centroidXY, r.writeCentroidToBuffer(e1)); 36463 for (const e1 of l.centroidData)e1.buildingId === i.buildingId && e1 !== b && (e1.centroidXY = b.centroidXY, l.writeCentroidToBuffer(e1)); 36464 } 36465 } 36466 for (const s of i){ 36467 if (w.has(s)) continue; 36468 const i = r.featuresOnBorder[s], f = r.centroidData.get(i.centroidDataIndex), _ = i.borders[t1]; 36469 let x; 36470 for(; b < g.length;){ 36471 if (T.has(b)) { 36472 b++; 36473 continue; 36474 } 36475 x = l.featuresOnBorder[g[b]]; 36476 const e1 = x.borders[m]; 36477 if (e1[1] > _[0] + 3 || e1[0] > _[0] - 3) break; 36478 l.showCentroid(x, "keep"), b++; 36479 } 36480 if (x && b < g.length) { 36481 let s = b, w = 0; 36482 for(;;)if (T.has(b)) { 36483 if (++b === g.length) break; 36484 x = l.featuresOnBorder[g[b]]; 36485 } else { 36486 if (x.borders[m][0] > _[1] - 3) break; 36487 if (w++, ++b === g.length) break; 36488 x = l.featuresOnBorder[g[b]]; 36489 } 36490 for(; s < g.length && T.has(s);)s++; 36491 if (s >= g.length) { 36492 r.showCentroid(i, "keep"); 36493 continue; 36494 } 36495 x = l.featuresOnBorder[g[s]]; 36496 let S = !1; 36497 if (w >= 1) { 36498 const e1 = x.borders[m]; 36499 Math.abs(_[0] - e1[0]) < 3 && Math.abs(_[1] - e1[1]) < 3 && (w = 1, S = !0, b = s + 1); 36500 } else if (0 === w) { 36501 r.showCentroid(i, "keep"); 36502 continue; 36503 } 36504 const C = l.centroidData.get(x.centroidDataIndex); 36505 a && S && c(f, C); 36506 const E = i.intersectsCount() > 1 || x.intersectsCount() > 1; 36507 if (w > 1) b = s, f.centroidXY = C.centroidXY = new e1.P(0, 0); 36508 else if (u && u.dem && !E) { 36509 const i = y[t1](f, C), s = t1 % 2 ? e1.a6 - 1 : 0, r = v(i[0], Math.min(e1.a6 - 1, i[1]), s, u, o, t1 < 2, i[2]); 36510 f.centroidXY = C.centroidXY = h(r); 36511 } else if (E) { 36512 const s = n ? void 0 : p(t1, i.borders, m, x.borders); 36513 void 0 !== s ? (f.centroidXY = d(0, t1, s), C.centroidXY = d(0, m, s)) : f.centroidXY = C.centroidXY = new e1.P(0, 0); 36514 } else f.centroidXY = r.encodeBorderCentroid(i), C.centroidXY = l.encodeBorderCentroid(x); 36515 r.writeCentroidToBuffer(f), l.writeCentroidToBuffer(C); 36516 } else r.showCentroid(i, "keep"); 36517 } 36518 r.borderDoneWithNeighborZ[t1] = l.canonical.z, l.borderDoneWithNeighborZ[m] = r.canonical.z; 36519 } 36520 (r.needsCentroidUpdate || !r.centroidVertexBuffer && 0 !== r.centroidVertexArray.length) && r.uploadCentroid(t1); 36521 } 36522 const mi = [ 36523 1, 36524 0, 36525 0 36526 ], _i = [ 36527 0, 36528 1, 36529 0 36530 ], gi = [ 36531 0, 36532 0, 36533 1 36534 ]; 36535 function yi(t1, i, s) { 36536 const r = s.transform, o = s.shadowRenderer; 36537 if (!o) return !0; 36538 const n = s.frameCounter, a = s.currentShadowCascade; 36539 let l = s._shadowCullCache; 36540 if (!l || l.frame !== n || l.cascade !== a) { 36541 const t1 = r.tileSize * o._cascades[a].scale, i = r.scaleZoom(t1), c = o.shadowDirection, h = [ 36542 c[0], 36543 c[1], 36544 -c[2] 36545 ], d = [ 36546 mi, 36547 _i, 36548 gi, 36549 h, 36550 [ 36551 h[0], 36552 0, 36553 h[2] 36554 ], 36555 [ 36556 0, 36557 h[1], 36558 h[2] 36559 ] 36560 ]; 36561 l = { 36562 frame: n, 36563 cascade: a, 36564 cameraFrustum: e1.az.fromInvProjectionMatrix(r.invProjMatrix, r.worldSize, i, !("globe" === r.projection.name)), 36565 edges: d, 36566 shadowDir: h, 36567 ws: t1, 36568 zoom: i 36569 }, s._shadowCullCache = l; 36570 } 36571 const { cameraFrustum: c, edges: h, shadowDir: d, ws: u, zoom: p } = l; 36572 let f = i; 36573 if (r.elevation) { 36574 const e1 = r.elevation.getMinMaxForTile(t1); 36575 e1 && (f += e1.max); 36576 } 36577 f /= e1.aA(r.center.lat, p); 36578 const m = o.computeSimplifiedTileShadowVolume(t1.toUnwrapped(), f, u, d); 36579 if (!m) return !1; 36580 const { vertices: _, planes: g } = m; 36581 return 0 === c.intersectsPrecise(_, g, h) || 0 === o.getCurrentCascadeFrustum().intersectsPrecise(_, g, h); 36582 } 36583 const vi = new Float32Array(16), bi = new Float32Array(16); 36584 function xi(t1) { 36585 const { painter: i, source: s, layer: r, coords: o } = t1; 36586 let n = t1.defines; 36587 const a = i.context, l = "shadow" === i.renderPass, c = "light-beam" === i.renderPass, h = i.shadowRenderer, d = e1.aA(i.transform.center.lat, i.transform.zoom), u = e1.aE(i, r.paint.get("building-cutoff-fade-range")); 36588 u.shouldRenderCutoff && (n = n.concat("RENDER_CUTOFF")); 36589 const p = r.paint.get("building-front-cutoff"), f = p[2] < 1 && !i.terrain, m = pi(i.transform.pitch, p, !!i.terrain); 36590 f && (n = n.concat("RENDER_FRONT_CUTOFF"), i.maxFrontCutoffRawStart = Math.max(i.maxFrontCutoffRawStart, p[0])), t1.floodLightIntensity > 0 && (n = n.concat("FLOOD_LIGHT")); 36591 for (const p of o){ 36592 const o = s.getTile(p), f = o.getBucket(r); 36593 if (!f) continue; 36594 h && 0 === h.getMaxCascadeForTile(p.toUnwrapped()) && (n = n.concat("SHADOWS_SINGLE_CASCADE")); 36595 const _ = f.programConfigurations.get(r.id); 36596 let g, y; 36597 const v = i.translatePosMatrix(p.expandedProjMatrix, o, [ 36598 0, 36599 0 36600 ], "map"); 36601 e1.aN(vi, v, [ 36602 1, 36603 1, 36604 t1.verticalScale 36605 ]); 36606 const b = vi; 36607 let x; 36608 if (l && h) { 36609 if (yi(o.tileID, f.maxHeight * d, i)) continue; 36610 const s = h.calculateShadowPassMatrixFromTile(o.tileID.toUnwrapped()); 36611 e1.aN(s, s, [ 36612 1, 36613 1, 36614 t1.verticalScale 36615 ]), x = li(s), g = y = i.getOrCreateProgram("buildingDepth", { 36616 config: _, 36617 defines: n, 36618 overrideFog: !1 36619 }); 36620 } else if (c) g = y = i.getOrCreateProgram("buildingBloom", { 36621 config: _, 36622 defines: n, 36623 overrideFog: !1 36624 }), x = ai(b); 36625 else { 36626 const s = i.transform.calculatePosMatrix(p.toUnwrapped(), i.transform.worldSize); 36627 e1.aN(s, s, [ 36628 1, 36629 1, 36630 t1.verticalScale 36631 ]), e1.aN(bi, s, [ 36632 1, 36633 -1, 36634 1 / d 36635 ]), e1.aO(bi, bi), e1.aP(bi, bi); 36636 const r = bi, o = i.transform.getFreeCameraOptions().position, l = 1 << p.canonical.z; 36637 if (x = ni(b, r, t1.opacity, t1.facadeAOIntensity, [ 36638 ((o.x - p.wrap) * l - p.canonical.x) * e1.a6, 36639 (o.y * l - p.canonical.y) * e1.a6, 36640 o.z * l * e1.a6 36641 ], f.tileToMeter, t1.facadeEmissiveChance, t1.floodLightColor, t1.floodLightIntensity, m), y = i.getOrCreateProgram("building", { 36642 config: _, 36643 defines: n, 36644 overrideFog: !1 36645 }), !0 === t1.depthOnly) g = y; 36646 else { 36647 const e1 = n.concat([ 36648 "BUILDING_FAUX_FACADE", 36649 "HAS_ATTRIBUTE_a_faux_facade_color_emissive" 36650 ]); 36651 g = i.getOrCreateProgram("building", { 36652 config: _, 36653 defines: e1, 36654 overrideFog: !1 36655 }); 36656 } 36657 h && (h.setupShadowsFromMatrix(s, y, !0), g !== y && g.setShadowUniformValues(a, h.getShadowUniformValues())); 36658 } 36659 const w = (s, o)=>{ 36660 if (c) { 36661 const n = s.entranceBloom; 36662 o.draw(i, a.gl.TRIANGLES, t1.depthMode, e1._.disabled, t1.blendMode, e1.$.disabled, x, r.id, n.layoutVertexBuffer, n.indexBuffer, n.segmentsBucket, r.paint, i.transform.zoom, _, [ 36663 n.layoutAttenuationBuffer, 36664 n.layoutColorBuffer 36665 ]); 36666 } else { 36667 const n = s.segmentsBucket; 36668 let c = [ 36669 s.layoutNormalBuffer, 36670 s.layoutCentroidBuffer, 36671 s.layoutColorBuffer, 36672 s.layoutFloodLightDataBuffer 36673 ]; 36674 s.layoutFacadePaintBuffer && (c = c.concat([ 36675 s.layoutFacadeDataBuffer, 36676 s.layoutFacadeVerticalRangeBuffer, 36677 s.layoutFacadePaintBuffer 36678 ])), o.draw(i, a.gl.TRIANGLES, t1.depthMode, e1._.disabled, t1.blendMode, l ? e1.$.disabled : e1.$.backCW, x, r.id, s.layoutVertexBuffer, s.indexBuffer, n, r.paint, i.transform.zoom, _, c); 36679 } 36680 }; 36681 i.uploadCommonUniforms(a, y, p.toUnwrapped(), null, u), f.buildingWithoutFacade && w(f.buildingWithoutFacade, y), f.buildingWithFacade && (g !== y && i.uploadCommonUniforms(a, g, p.toUnwrapped(), null, u), w(f.buildingWithFacade, g)); 36682 } 36683 } 36684 function wi(t1, i, s, r, o, n, a, l, c, h, d, u, p, f) { 36685 const m = t1.context.gl, _ = t1.depthModeForSublayer(1, e1.Z.ReadOnly, m.LEQUAL, !0), g = e1.al(.1, 3, d), y = t1._showOverdrawInspector, v = u, b = new ui; 36686 if (!y) { 36687 const d = new e1._({ 36688 func: m.ALWAYS, 36689 mask: 255 36690 }, 255, 255, m.KEEP, m.KEEP, m.REPLACE), u = new e1.a1([ 36691 m.ONE, 36692 m.ONE, 36693 m.ONE, 36694 m.ONE 36695 ], e1.C.transparent, [ 36696 !1, 36697 !1, 36698 !1, 36699 !0 36700 ], m.MIN); 36701 e1.aQ(b, t1, i, s, r, _, d, u, e1.$.disabled, o, "sdf", n, a, l, c, h, g, v, !1, void 0); 36702 } 36703 { 36704 const d = y ? e1._.disabled : new e1._({ 36705 func: m.EQUAL, 36706 mask: 255 36707 }, 255, 255, m.KEEP, m.DECR, m.DECR), u = y ? t1.colorModeForRenderPass() : new e1.a1([ 36708 m.ONE_MINUS_DST_ALPHA, 36709 m.DST_ALPHA, 36710 m.ONE, 36711 m.ONE 36712 ], e1.C.transparent, [ 36713 !0, 36714 !0, 36715 !0, 36716 !0 36717 ]); 36718 e1.aQ(b, t1, i, s, r, _, d, u, e1.$.disabled, o, "color", n, a, l, c, h, g, v, !1, void 0); 36719 } 36720 } 36721 class Ti { 36722 findClosestBuilding(e1, t1, i, s, r) { 36723 if (i < this._indoorMinimumZoom) return this._previousClosestBuildingId = null, null; 36724 let o = null, n = Number.MAX_VALUE, a = Number.MAX_VALUE, l = !1; 36725 const c = this._previousClosestBuildingId ? e1[this._previousClosestBuildingId] : null; 36726 this._previousClosestBuildingId && c && this._isBuildingVisible(c, s, r) && (l = !0, a = this._calculateDistance(t1, c)); 36727 for (const [i, a] of Object.entries(e1)){ 36728 if (!this._isBuildingVisible(a, s, r)) continue; 36729 const e1 = this._calculateDistance(t1, a); 36730 e1 < n && (n = e1, o = i); 36731 } 36732 return l && o && this._previousClosestBuildingId && o !== this._previousClosestBuildingId ? n > a * this._hysteresisRatio && (o = this._previousClosestBuildingId) : l && !o && (o = this._previousClosestBuildingId), this._previousClosestBuildingId = o, o; 36733 } 36734 _calculateDistance(e1, t1) { 36735 if (!t1.center) return Number.MAX_VALUE; 36736 const i = e1.lat - t1.center[1], s = e1.lng - t1.center[0]; 36737 return i * i + s * s; 36738 } 36739 _isBuildingVisible(t1, i, s) { 36740 if (!s) return !1; 36741 for (const i of t1.floorIds){ 36742 const r = t1.floors[i]; 36743 if (!r.geometry) continue; 36744 const o = r.geometry; 36745 if ("Polygon" === o.type) { 36746 const t1 = this._convertRingToPoints(o.coordinates[0]); 36747 if (e1.aT(t1, s)) return !0; 36748 } else if ("MultiPolygon" === o.type) { 36749 const t1 = this._convertMultiPolygonToPoints(o.coordinates); 36750 if (e1.aU(s, t1)) return !0; 36751 } 36752 } 36753 return !1; 36754 } 36755 _convertRingToPoints(t1) { 36756 return t1.map((t1)=>
36756new e1.P(t1[0], t1[1])); 36757 } 36758 _convertMultiPolygonToPoints(t1) { 36759 return t1.map((t1)=>0 === t1.length ? [] : t1[0].map((t1)=>new e1.P(t1[0], t1[1]))); 36760 } 36761 constructor(){ 36762 this._previousClosestBuildingId = null, this._hysteresisRatio = .8, this._indoorMinimumZoom = 16; 36763 } 36764 } 36765 const Si = .05, Ci = (e1, t1, i, s, r, o, n, a, l, c, h, d)=>({ 36766 u_matrix: e1, 36767 u_normalize_matrix: t1, 36768 u_globe_matrix: i, 36769 u_merc_matrix: s, 36770 u_grid_matrix: r, 36771 u_tl_parent: o, 36772 u_scale_parent: c, 36773 u_fade_t: h.mix, 36774 u_opacity: h.opacity, 36775 u_image0: 0, 36776 u_image1: 1, 36777 u_raster_elevation: d, 36778 u_zoom_transition: n, 36779 u_merc_center: a, 36780 u_cutoff_params: l 36781 }), Ei = (e1, t1, i, s, r, o, n, a, l, c)=>({ 36782 u_particle_texture: e1, 36783 u_particle_texture_side_len: t1, 36784 u_tile_offset: i, 36785 u_velocity: s, 36786 u_color_ramp: o, 36787 u_velocity_res: r, 36788 u_max_speed: n, 36789 u_uv_offset: a, 36790 u_data_scale: [ 36791 255 * l[0], 36792 255 * l[1] 36793 ], 36794 u_data_offset: c, 36795 u_particle_pos_scale: 1.1, 36796 u_particle_pos_offset: [ 36797 Si, 36798 Si 36799 ] 36800 }), Ii = (e1, t1, i, s, r, o, n, a, l, c)=>({ 36801 u_particle_texture: e1, 36802 u_particle_texture_side_len: t1, 36803 u_velocity: i, 36804 u_velocity_res: s, 36805 u_max_speed: r, 36806 u_speed_factor: o, 36807 u_reset_rate: n, 36808 u_rand_seed: Math.random(), 36809 u_uv_offset: a, 36810 u_data_scale: [ 36811 255 * l[0], 36812 255 * l[1] 36813 ], 36814 u_data_offset: c, 36815 u_particle_pos_scale: 1.1, 36816 u_particle_pos_offset: [ 36817 Si, 36818 Si 36819 ] 36820 }); 36821 function Di(e1, param, param1) { 36822 let [t1, i, s, r] = param, [o, n] = param1; 36823 if (o === n) return [ 36824 0, 36825 0, 36826 0, 36827 0 36828 ]; 36829 const a = 255 * (e1 - 1) / (e1 * (n - o)); 36830 return [ 36831 t1 * a, 36832 i * a, 36833 s * a, 36834 r * a 36835 ]; 36836 } 36837 function Pi(e1, t1, param) { 36838 let [i, s] = param; 36839 return i === s ? 0 : .5 / e1 + (t1 - i) * (e1 - 1) / (e1 * (s - i)); 36840 } 36841 var Li = e1.a_([ 36842 { 36843 name: "a_index", 36844 type: "Int16", 36845 components: 1 36846 } 36847 ]); 36848 class Ri { 36849 updateParticleTexture(t1, i) { 36850 if (this.particleTextureDimension === i.width) return; 36851 (this.particleTexture0 || this.particleTexture1 || this.particleIndexBuffer || this.particleSegment) && (this.particleTexture0.destroy(), this.particleTexture1.destroy(), this.particleIndexBuffer.destroy(), this.particleSegment.destroy()); 36852 const s = this.context.gl, r = i.width * i.height; 36853 this.particleTexture0 = new e1.T(this.context, i, s.RGBA8, { 36854 premultiply: !1, 36855 useMipmap: !1 36856 }), this.particleTexture1 = new e1.T(this.context, i, s.RGBA8, { 36857 premultiply: !1, 36858 useMipmap: !1 36859 }); 36860 const o = new e1.a$; 36861 o.reserve(r); 36862 for(let e1 = 0; e1 < r; e1++)o.emplaceBack(e1); 36863 this.particleIndexBuffer = this.context.createVertexBuffer(o, Li.members, !0), this.particleSegment = e1.ac.simpleSegment(0, 0, this.particleIndexBuffer.length, 0), this.particleTextureDimension = i.width; 36864 } 36865 update(t1) { 36866 return !(this.lastInvalidatedAt < t1 && (this.lastInvalidatedAt = e1.e.now(), 1)); 36867 } 36868 destroy() { 36869 this.targetColorTexture.destroy(), this.backgroundColorTexture.destroy(), this.particleIndexBuffer.destroy(), this.particleTexture0.destroy(), this.particleTexture1.destroy(), this.particleSegment.destroy(); 36870 } 36871 constructor(t1, i, s, r){ 36872 const o = { 36873 width: s[0], 36874 height: s[1], 36875 data: null 36876 }, n = t1.gl; 36877 this.targetColorTexture = new e1.T(t1, o, n.RGBA8, { 36878 useMipmap: !1 36879 }), this.backgroundColorTexture = new e1.T(t1, o, n.RGBA8, { 36880 useMipmap: !1 36881 }), this.context = t1, this.updateParticleTexture(i, r), this.lastInvalidatedAt = 0; 36882 } 36883 } 36884 function Ai(t1, i, s, r, o) { 36885 if (o > 0) { 36886 const n = e1.e.now(), a = (n - t1.timeAdded) / o, l = i ? (n - i.timeAdded) / o : -1, c = s.getSource(), h = r.coveringZoomLevel({ 36887 tileSize: c.tileSize,
36888 roundZoom: c.roundZoom 36889 }), d = !i || Math.abs(i.tileID.overscaledZ - h) > Math.abs(t1.tileID.overscaledZ - h), u = d && t1.refreshedUponExpiration ? 1 : e1.b0(d ? a : 1 - l, 0, 1); 36890 return i ? { 36891 opacity: 1, 36892 mix: 1 - u, 36893 isFading: a < 1 36894 } : { 36895 opacity: u, 36896 mix: 0, 36897 isFading: a < 1 36898 }; 36899 } 36900 return { 36901 opacity: 1, 36902 mix: 0, 36903 isFading: !1 36904 }; 36905 } 36906 function Mi(t1, i, s) { 36907 if (!t1) return null; 36908 const r = i.getTextureDescriptor(t1, s, !0); 36909 if (!r) return null; 36910 let { texture: o, mix: n, offset: a, tileSize: l, buffer: c, format: h } = r; 36911 if (!o || !h) return null; 36912 let d = !1; 36913 return "uint32" === h && (d = !0, n[3] = 0, n = Di(e1.b9, n, [ 36914 0, 36915 s.paint.get("raster-particle-max-speed") 36916 ]), a = Pi(e1.b9, a, [ 36917 0, 36918 s.paint.get("raster-particle-max-speed") 36919 ])), { 36920 texture: o, 36921 textureOffset: [ 36922 c / (l + 2 * c), 36923 l / (l + 2 * c) 36924 ], 36925 tileSize: l, 36926 scalarData: d, 36927 scale: n, 36928 offset: a, 36929 defines: [ 36930 "RASTER_ARRAY", 36931 { 36932 uint8: "DATA_FORMAT_UINT8", 36933 uint16: "DATA_FORMAT_UINT16", 36934 uint32: "DATA_FORMAT_UINT32" 36935 }[h] 36936 ] 36937 }; 36938 } 36939 function Oi(e1) { 36940 const t1 = e1._nearZ, i = e1.projection.farthestPixelDistance(e1), s = i - t1, r = .2 * e1.height, o = t1 + r; 36941 return [ 36942 t1, 36943 i, 36944 (o - r - t1) / s, 36945 (o - t1) / s 36946 ]; 36947 } 36948 var Fi = "#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}"; 36949 e1.ba["_prelude_raster_particle.glsl"] || (e1.ba["_prelude_raster_particle.glsl"] = Fi); 36950 var ki = { 36951 building: e1.bb('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nconst float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nin float v_dither_opacity;\n#endif\n#ifdef BUILDING_FAUX_FACADE\nin lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;\n#endif\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
36951\n#endif\n#ifdef FLOOD_LIGHT\nin highp float v_flood_radius;in float v_has_flood_light;\n#endif\nuniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}\n#ifdef BUILDING_FAUX_FACADE\nhighp float hash12(in highp vec2 p) {highp vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}highp vec2 get_uv_mask_id(in highp vec2 q,out highp float mask,out highp vec2 id) {highp vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;highp vec2 uv=modf(p/v_faux_facade_floor,id);highp vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;highp vec4 edge=d/v_faux_facade_floor.xyxy;highp vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}highp float ray_unit_box(in highp vec3 ray_o,in highp vec3 ray_d,in highp vec3 bmin,in highp vec3 bmax) {highp vec3 planes=mix(bmin,bmax,step(0.0,ray_d));highp vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in highp vec3 v,in highp vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;highp vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;if (x_major) {out_normal=-sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;return out_color;}\n#endif\nvec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;\n#ifdef BUILDING_FAUX_FACADE\nif (v_faux_facade > 0.0) {highp mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);highp vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;highp vec3 view_tangent=transpose(tbn)*v;highp vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);highp vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;highp vec3 bmin=vec3(0.0,0.0,-window_depth);highp vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);highp vec3 ray_o=vec3(uv,0.0);highp vec3 ray_d=normalize(view_tangent);highp float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);highp vec3 hit=ray_o+t_min*ray_d;highp vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;highp vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}\n#endif\nvec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;\n#ifdef RENDER_SHADOWS\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\n#else\nshadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir));\n#endif\ncolor.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);\n#ifdef FLOOD_LIGHT\nfloat flood_radiance=(1.0-min(v_pos.z/v_flood_radiu
36951s,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance);\n#endif\ncolor.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));\n#endif\ncolor*=u_opacity;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nif (v_dither_opacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (v_dither_opacity < DITHER_THRESHOLDS[index]) {discard;}}\n#endif\nglFragColor=color;\n#ifdef DEBUG_SHOW_NORMALS\ncolor.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_feature_cutout.vertex.glsl"\nin vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3;\n#ifdef FLOOD_LIGHT\nin int a_flood_light_wall_radius_1i16;\n#endif\n#ifdef BUILDING_FAUX_FACADE\nin uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range;\n#endif\nuniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;\n#endif\nout float v_dither_opacity;\n#endif\nout vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nout lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#ifdef FLOOD_LIGHT\nout highp float v_flood_radius;out float v_has_flood_light;\n#endif\nconst float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#ifdef BUILDING_FAUX_FACADE\nmat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}\n#endif\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive\nvoid main() {\n#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive\n#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive\n#ifdef FLOOD_LIGHT\nv_flood_radius=(float(a_flood_light_wall_radius_1i16)/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);\n#endif\nvec4 color_emissive=decode_color(vec2(part_color_emissive));v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=vec3(a_normal_3)/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;float frontCutoffOpacity=1.0;float routeFade=0.0;vec2 centroid_xy=vec2(a_centroid_3.xy >> 2);vec2 spanBits=vec2(a_centroid_3.xy & 3);\n#ifdef BUILDING_FAUX_FACADE\nvec4 faux_facade_data=vec4(a_faux_facade_data);v_faux_facade=faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(faux_facade_data.y/TWO_POW_8);float window_y_perc=faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(vec2(a_faux_facade_vertical_range)/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(vec2(faux_facade_color_emissive));v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);depth_offset=min(1000.0,float(a_centroid_3.z))*0.0000002;}\n#endif\nv_pos=a_pos_3f;\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nfloat halfSpanX=spanBits.x*10.0/u_tile_to_meter;float halfSpanY=spanBits.y*10.0/u_tile_to_meter;
36951vec2 screenUpInTile=vec2(u_matrix[0][1],u_matrix[1][1]);vec2 spanOffset=vec2(halfSpanX,halfSpanY)*sign(screenUpInTile);vec2 cutoff_highestCorner=centroid_xy+spanOffset;vec2 cutoff_lowestCorner=centroid_xy-spanOffset;\n#endif\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shadow_pos=v_pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(v_pos);\n#endif\n#ifdef RENDER_FRONT_CUTOFF\n{hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;hidden=max(hidden,float(ndc_y < threshold-range_ndc));float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);frontCutoffOpacity=mix(u_front_cutoff_params.z,1.0,t);}\n#endif\ngl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nv_dither_opacity=1.0;\n#ifdef RENDER_FRONT_CUTOFF\nv_dither_opacity=min(v_dither_opacity,frontCutoffOpacity);\n#endif\n#endif\n}'), 36952 buildingBloom: e1.bb("in vec4 v_color_emissive;\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nfloat saturate(float val) {return clamp(val,0.0,1.0);}void main() {\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\nfloat emission=v_color_emissive.a;float opacity=1.0;\n#ifdef HAS_ATTRIBUTE_a_bloom_attenuation\nfloat distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance);\n#endif\n#ifdef RENDER_CUTOFF\nopacity*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}", "in vec3 a_pos_3f;\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nout vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\n#ifdef HAS_ATTRIBUTE_a_part_color_emissive\nvec4 color_emissive=decode_color(vec2(part_color_emissive));float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);\n#else\nv_color_emissive=vec4(1.0);\n#endif\ngl_Position=u_matrix*vec4(a_pos_3f,1.0);\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}"), 36953 buildingDepth: e1.bb("void main() {}", "in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"), 36954 rasterParticle: e1.bb('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
36954\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=vec2(a_texture_pos)/8192.0;gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'), 36955 rasterParticleDraw: e1.bb("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}", '#include "_prelude_raster_particle.glsl"\nin int a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(float(a_index),u_particle_texture_side_len),float(a_index)/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'), 36956 rasterParticleTexture: e1.bb("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}", "in ivec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*vec2(a_pos)+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"), 36957 rasterParticleUpdate: e1.bb('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}', "in ivec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*vec2(a_pos+ivec2(1));gl_Position=vec4(a_pos,0.0,1.0);}"), 36958 snowParticle: e1.bb("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}", "\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);
36958simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"), 36959 rainParticle: e1.bb("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}", "\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"), 36960 vignette: e1.bb("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}", "in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"), 36961 elevatedStructuresDepth: e1.bb("void main() {}", "in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"), 36962 elevatedStructures: e1.bb('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
36962vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)\n{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;uniform float u_opacity_multiplier;\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nvec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0);\n#ifdef LIGHTING_3D_MODE\nvec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);color.rgb=apply_lighting(color.rgb,transformed_normal,light);\n#else\ncolor=apply_lighting(color,transformed_normal);\n#endif\ncolor=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);out_color*=u_opacity_multiplier;glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;in float a_height;in ivec4 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;\n#endif\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nv_normal=vec3(a_pos_normal_3)/16384.0;v_height=a_height;vec3 pos=vec3(vec2(a_pos),a_height);gl_Position=u_matrix*vec4(pos,1);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'), 36963 elevatedStructuresDepthReconstruct: e1.bb('#include "_prelude_feature_cutout.fragment.glsl"\n#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#else\n#endif\nglFragColor=vec4(1.0,0.0,0.0,1.0);}', "in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}") 36964 }; 36965 e1.bb(Fi, ""); 36966 const Bi = e1.a_([ 36967 { 36968 type: "Float32", 36969 name: "a_pos_3f", 36970 components: 3 36971 }, 36972 { 36973 type: "Float32", 36974 name: "a_uv", 36975 components: 2 36976 }, 36977 { 36978 type: "Float32", 36979 name: "a_rainParticleData", 36980 components: 4 36981 } 36982 ]), zi = e1.a_([ 36983 { 36984 type: "Float32", 36985 name: "a_pos_2f", 36986 components: 2 36987 } 36988 ]); 36989 class Ui { 36990 destroy() { 36991 this.vignetteVx && this.vignetteVx.destroy(), this.vignetteIdx && this.vignetteIdx.destroy(); 36992 } 36993 draw(t1, i) { 36994 const s = t1.getOrCreateProgram("vignette"); 36995 if (!this.vignetteVx || !this.vignetteIdx) { 36996 const i = new e1.bc, s = new e1.ad; 36997 i.emplaceBack(-1, -1), i.emplaceBack(1, -1), i.emplaceBack(1, 1), i.emplaceBack(-1, 1), s.emplaceBack(0, 1, 2), s.emplaceBack(0, 2, 3), this.vignetteVx = t1.context.createVertexBuffer(i, zi.members), this.vignetteIdx = t1.context.createIndexBuffer(s); 36998 } 36999 const r = e1.ac.simpleSegment(0, 0, 4, 6); 37000 if (this.vignetteVx && this.vignetteIdx) { 37001 t1.uploadCommonUniforms(t1.context, s); 37002 const n = { 37003 u_vignetteShape: (o = { 37004 vignetteShape: [ 37005 i.start, 37006 i.range, 37007 Math.pow(10, i.fadePower) 37008 ], 37009 vignetteColor: [ 37010 i.color.r, 37011 i.color.g, 37012 i.color.b, 37013 i.color.a * i.strength 37014 ] 37015 }).vignetteShape, 37016 u_vignetteColor: o.vignetteColor 37017 }; 37018 s.draw(t1, t1.context.gl.TRIANGLES, e1.Z.disabled, e1._.disabled, e1.a1.alphaBlended, e1.$.disabled, n, "vignette", this.vignetteVx, this.vignetteIdx, r); 37019 } 37020 var o; 37021 } 37022 } 37023 class Ni { 37024 update(t1, i) { 37025 const s = t1.getFreeCameraOptions().position, r = s.toAltitude(), o = s.toLngLat(), n = e1.au(o.lng), a = e1.au(o.lat), l = t1.pixelsPerMeter / i, c = n * e1.bj, h = e1.bj * Math.log(Math.tan(Math.PI / 4 + a / 2)); 37026 if (void 0 === this._offsetXPrev) this._offsetXPrev = 0, this._offsetYPrev = 0, this._elevationPrev = 0, this._accumulatedOffsetX = 0, this._accumulatedOffsetY = 0, this._accumulatedElevation = 0; 37027 else { 37028 const e1 = -this._offsetYPrev + h, t1 = -this._elevationPrev + r; 37029 this._accumulatedOffsetX += (-this._offsetXPrev + c) * l, this._accumulatedOffsetY += e1 * l, this._accumulatedElevation += t1 * l, this._offsetXPrev = c, this._offsetYPrev = h, this._elevationPrev = r; 37030 } 37031 } 37032 getPosition() { 37033 return [ 37034 this._accumulatedOffsetX, 37035 this._accumulatedOffsetY, 37036 this._accumulatedElevation 37037 ]; 37038 } 37039 constructor(){ 37040 this._accumulatedOffsetX = 0, this._accumulatedOffsetY = 0, this._accumulatedElevation = 0; 37041 } 37042 } 37043 function ji(e1, t1) { 37044 return [ 37045 -(e1[0] - Math.floor(e1[0] / t1) * t1), 37046 -(e1[1] - Math.floor(e1[1] / t1) * t1), 37047 -(e1[2] - Math.floor(e1[2] / t1) * t1) 37048 ]; 37049 } 37050 function Vi(t1) { 37051 const i = e1.bi(1323123451230), s = []; 37052 for(let r = 0; r < t1; ++r){ 37053 const t1 = 2 * i() - 1, r = 2 * i() - 1, o = 2 * i() - 1; 37054 s.push(e1.bh(t1, r, o)); 37055 } 37056 return s; 37057 } 37058 function Gi(t1, i, s, r, o) { 37059 const n = e1.b0((o - s) / (r - s), 0, 1); 37060 return e1.al(t1, i, n); 37061 } 37062 class qi { 37063 destroy() { 37064 this.particlesVx && this.particlesVx.destroy(), this.particlesIdx && this.particlesIdx.destroy(), this._vignette && this._vignette.destroy(); 37065 } 37066 updateOnRender(t1, i) { 37067 const s = t1.transform; 37068 this._movement.update(s, this._ppmScaleFactor); 37069 const r = s.starsProjMatrix, o = e1.bd([]); 37070 e1.be(o, o, e1.au(90) - s._pitch), e1.bf(o, o, -s.angle); 37071 const n = e1.bg(new Float32Array(16), o), a = new Float32Array([ 37072 1, 37073 0, 37074 0, 37075 0, 37076 0, 37077 0, 37078 1, 37079 0, 37080 0, 37081 -1, 37082 0, 37083 0, 37084 0, 37085 0, 37086 0, 37087 1 37088 ]), l = e1.aP([], a), c = e1.X([], l, n), h = Date.now() / 1e3; 37089 return this._accumulatedTimeFromStart += (h - this._prevTime) * i, this._prevTime = h, { 37090 projectionMatrix: r, 37091 modelviewMatrix: c 37092 }; 37093 } 37094 constructor(e1){
37095 this._movement = new Ni, this._accumulatedTimeFromStart = 0, this._prevTime = Date.now() / 1e3, this._vignette = new Ui, this._ppmScaleFactor = e1; 37096 } 37097 } 37098 const Zi = e1.a_([ 37099 { 37100 type: "Float32", 37101 name: "a_pos_3f", 37102 components: 3 37103 }, 37104 { 37105 type: "Float32", 37106 name: "a_uv", 37107 components: 2 37108 }, 37109 { 37110 type: "Float32", 37111 name: "a_snowParticleData", 37112 components: 4 37113 }, 37114 { 37115 type: "Float32", 37116 name: "a_snowParticleDataHorizontalOscillation", 37117 components: 2 37118 } 37119 ]), $i = (e1, t1)=>({ 37120 u_matrix: e1, 37121 u_depth_bias: t1 37122 }), Hi = (e1, t1)=>({ 37123 u_matrix: e1, 37124 u_ground_shadow_factor: t1, 37125 u_opacity_multiplier: 1 37126 }), Wi = (e1, t1, i, s, r)=>({ 37127 u_matrix: e1, 37128 u_camera_pos: [ 37129 t1[0], 37130 t1[1], 37131 t1[2] 37132 ], 37133 u_depth_bias: i, 37134 u_height_scale: s, 37135 u_reset_depth: r 37136 }), Xi = { 37137 building: (t1)=>({ 37138 u_matrix: new e1.a4(t1), 37139 u_normal_matrix: new e1.a4(t1), 37140 u_opacity: new e1.a3(t1), 37141 u_faux_facade_ao_intensity: new e1.a3(t1), 37142 u_camera_pos: new e1.a5(t1), 37143 u_tile_to_meter: new e1.a3(t1), 37144 u_facade_emissive_chance: new e1.a3(t1), 37145 u_flood_light_color: new e1.a5(t1), 37146 u_flood_light_intensity: new e1.a3(t1), 37147 u_front_cutoff_params: new e1.a5(t1) 37148 }), 37149 buildingBloom: (t1)=>({ 37150 u_matrix: new e1.a4(t1) 37151 }), 37152 buildingDepth: (t1)=>({ 37153 u_matrix: new e1.a4(t1) 37154 }), 37155 elevatedStructuresDepth: (t1)=>({ 37156 u_matrix: new e1.a4(t1), 37157 u_depth_bias: new e1.a3(t1) 37158 }), 37159 elevatedStructures: (t1)=>({ 37160 u_matrix: new e1.a4(t1), 37161 u_ground_shadow_factor: new e1.a5(t1), 37162 u_opacity_multiplier: new e1.a3(t1) 37163 }), 37164 elevatedStructuresDepthReconstruct: (t1)=>({ 37165 u_matrix: new e1.a4(t1), 37166 u_camera_pos: new e1.a5(t1), 37167 u_depth_bias: new e1.a3(t1), 37168 u_height_scale: new e1.a3(t1), 37169 u_reset_depth: new e1.a3(t1) 37170 }), 37171 rasterParticle: (t1)=>({ 37172 u_matrix: new e1.a4(t1), 37173 u_normalize_matrix: new e1.a4(t1), 37174 u_globe_matrix: new e1.a4(t1), 37175 u_merc_matrix: new e1.a4(t1), 37176 u_grid_matrix: new e1.aZ(t1), 37177 u_tl_parent: new e1.a2(t1), 37178 u_scale_parent: new e1.a3(t1), 37179 u_fade_t: new e1.a3(t1), 37180 u_opacity: new e1.a3(t1), 37181 u_image0: new e1.aX(t1), 37182 u_image1: new e1.aX(t1), 37183 u_raster_elevation: new e1.a3(t1), 37184 u_zoom_transition: new e1.a3(t1), 37185 u_merc_center: new e1.a2(t1), 37186 u_cutoff_params: new e1.aY(t1) 37187 }), 37188 rasterParticleTexture: (t1)=>({ 37189 u_texture: new e1.aX(t1), 37190 u_opacity: new e1.a3(t1) 37191 }), 37192 rasterParticleDraw: (t1)=>({ 37193 u_particle_texture: new e1.aX(t1), 37194 u_particle_texture_side_len: new e1.a3(t1), 37195 u_tile_offset: new e1.a2(t1), 37196 u_velocity: new e1.aX(t1), 37197 u_color_ramp: new e1.aX(t1), 37198 u_velocity_res: new e1.a2(t1), 37199 u_max_speed: new e1.a3(t1), 37200 u_uv_offset: new e1.a2(t1), 37201 u_data_scale: new e1.a2(t1), 37202 u_data_offset: new e1.a3(t1), 37203 u_particle_pos_scale: new e1.a3(t1), 37204 u_particle_pos_offset: new e1.a2(t1) 37205 }), 37206 rasterParticleUpdate: (t1)=>({ 37207 u_particle_texture: new e1.aX(t1), 37208 u_particle_texture_side_len: new e1.a3(t1), 37209 u_velocity: new e1.aX(t1), 37210 u_velocity_res: new e1.a2(t1), 37211 u_max_speed: new e1.a3(t1), 37212 u_speed_factor: new e1.a3(t1), 37213 u_reset_rate: new e1.a3(t1), 37214 u_rand_seed: new e1.a3(t1), 37215 u_uv_offset: new e1.a2(t1), 37216 u_data_scale: new e1.a2(t1), 37217 u_data_offset: new e1.a3(t1), 37218 u_particle_pos_scale: new e1.a3(t1), 37219 u_particle_pos_offset: new e1.a2(t1) 37220 }), 37221 snowParticle: (t1)=>({ 37222 u_modelview: new e1.a4(t1), 37223 u_projection: new e1.a4(t1), 37224 u_time: new e1.a3(t1), 37225 u_cam_pos: new e1.a5(t1), 37226 u_velocityConeAperture: new e1.a3(t1), 37227 u_velocity: new e1.a3(t1), 37228 u_horizontalOscillationRadius: new e1.a3(t1), 37229 u_horizontalOscillationRate: new e1.a3(t1), 37230 u_boxSize: new e1.a3(t1), 37231 u_billboardSize: new e1.a3(t1), 37232 u_simpleShapeParameters: new e1.a2(t1), 37233 u_screenSize: new e1.a2(t1), 37234 u_thinningCenterPos: new e1.a2(t1), 37235 u_thinningShape: new e1.a5(t1), 37236 u_thinningAffectedRatio: new e1.a3(t1), 37237 u_thinningParticleOffset: new e1.a3(t1), 37238 u_particleColor: new e1.aY(t1), 37239 u_direction: new e1.a5(t1) 37240 }), 37241 rainParticle: (t1)=>({ 37242 u_modelview: new e1.a4(t1), 37243 u_projection: new e1.a4(t1), 37244 u_time: new e1.a3(t1), 37245 u_cam_pos: new e1.a5(t1), 37246 u_texScreen: new e1.aX(t1), 37247 u_velocityConeAperture: new e1.a3(t1), 37248 u_velocity: new e1.a3(t1), 37249 u_boxSize: new e1.a3(t1), 37250 u_rainDropletSize: new e1.a2(t1), 37251 u_distortionStrength: new e1.a3(t1), 37252 u_rainDirection: new e1.a5(t1), 37253 u_color: new e1.aY(t1), 37254 u_screenSize: new e1.a2(t1), 37255 u_thinningCenterPos: new e1.a2(t1), 37256 u_thinningShape: new e1.a5(t1), 37257 u_thinningAffectedRatio: new e1.a3(t1), 37258 u_thinningParticleOffset: new e1.a3(t1), 37259 u_shapeDirectionalPower: new e1.a3(t1), 37260 u_shapeNormalPower: new e1.a3(t1), 37261 u_mode: new e1.a3(t1) 37262 }), 37263 vignette: (t1)=>({ 37264 u_vignetteShape: new e1.a5(t1), 37265 u_vignetteColor: new e1.aY(t1) 37266 }) 37267 }; 37268 function Ki(t1, i) { 37269 const s = 1 << t1.canonical.z, r = (i.x * s - t1.canonical.x - t1.wrap * s) * e1.a6, o = (i.y * s - t1.canonical.y) * e1.a6, n = e1.bm(i.z, i.y); 37270 return e1.bh(r, o, n); 37271 } 37272 function Yi(e1) { 37273 let t1 = 0; 37274 for (const i of e1)t1 |= i.frcMask; 37275 return t1; 37276 } 37277 class Qi { 37278 getTile(e1) { 37279 for (const t1 of this.tiles)if (t1.tileId.z === e1.z && t1.tileId.x === e1.x && t1.tileId.y === e1.y) return t1; 37280 return null; 37281 } 37282 getTileOrParent(e1) { 37283 for(let t1 = e1.z; t1 > 0; --t1){ 37284 const i = Math.floor(e1.x / (1 << e1.z - t1)), s = Math.floor(e1.y / (1 << e1.z - t1)); 37285 for (const e1 of this.tiles)if (e1.tileId.z === t1 && e1.tileId.x === i && e1.tileId.y === s && 0 !== e1.frcMask) return e1; 37286 } 37287 return null; 37288 } 37289 getFullCoverageMask(t1) { 37290 let i = null, s = 0; 37291 for(let e1 = t1.z; e1 > 0; --e1){ 37292 const r = Math.floor(t1.x / (1 << t1.z - e1)), o = Math.floor(t1.y / (1 << t1.z - e1)); 37293 for (const t1 of this.tiles)if (t1.tileId.z === e1 && t1.tileId.x === r && t1.tileId.y === o) { 37294 i = t1, s = e1; 37295 break; 37296 } 37297 if (i) break; 37298 } 37299 if (!i || 0 === i.frcMask) return null; 37300 const r = 1 << t1.z - s, o = e1.a6 / r, n = t1.x % r * o, a = t1.y % r * o, l = n + o, c = a + o; 37301 let h = 0; 37302 for (const e1 of i.polygons)0 !== e1.frcMask && (e1.hasGeometry() ? 0 === e1.rings.length || t1.z <= s || Ji(e1.rings, n, a, l, c) && (h |= e1.frcMask) : h |= e1.frcMask);
vendor: 40,100 bytes, lines 37303-37943
37303 return 0 !== h ? h : null; 37304 } 37305 equals(e1) { 37306 if (this.tiles.length !== e1.length) return !1; 37307 for(let t1 = 0; t1 < this.tiles.length; ++t1){ 37308 const i = this.tiles[t1], s = e1[t1]; 37309 if (i.tileId.z !== s.tileId.z || i.tileId.x !== s.tileId.x || i.tileId.y !== s.tileId.y || i.frcMask !== s.frcMask || i.polygons.length !== s.polygons.length) return !1; 37310 } 37311 return !0; 37312 } 37313 empty() { 37314 return 0 === this.tiles.length; 37315 } 37316 constructor(e1 = []){ 37317 this.tiles = e1; 37318 } 37319 } 37320 function Ji(e1, t1, i, s, r) { 37321 const o = [ 37322 0, 37323 0, 37324 0, 37325 0 37326 ], n = [ 37327 t1, 37328 s, 37329 s, 37330 t1 37331 ], a = [ 37332 i, 37333 i, 37334 r, 37335 r 37336 ]; 37337 for (const l of e1){ 37338 const e1 = l.length; 37339 if (!(e1 < 2)) for(let c = 0, h = e1 - 1; c < e1; h = c++){ 37340 const e1 = l[h].x, d = l[h].y, u = l[c].x, p = l[c].y; 37341 for(let t1 = 0; t1 < 4; ++t1)d > a[t1] != p > a[t1] && n[t1] < e1 + (u - e1) * (a[t1] - d) / (p - d) && o[t1]++; 37342 let f = 0, m = 0; 37343 if (e1 < t1 ? f |= 1 : e1 > s && (f |= 2), d < i ? f |= 4 : d > r && (f |= 8), u < t1 ? m |= 1 : u > s && (m |= 2), p < i ? m |= 4 : p > r && (m |= 8), !(f & m)) { 37344 if (0 === f || 0 === m) return !1; 37345 if (es(e1, d, u, p, t1, i, s, r)) return !1; 37346 } 37347 } 37348 } 37349 for(let e1 = 0; e1 < 4; ++e1)if (!(1 & o[e1])) return !1; 37350 return !0; 37351 } 37352 function es(e1, t1, i, s, r, o, n, a) { 37353 const l = (e1, t1, i, s, r, o, n, a)=>{ 37354 const l = (i - e1) * (o - t1) - (s - t1) * (r - e1), c = (i - e1) * (a - t1) - (s - t1) * (n - e1); 37355 if (l > 0 && c > 0 || l < 0 && c < 0) return !1; 37356 const h = (n - r) * (t1 - o) - (a - o) * (e1 - r), d = (n - r) * (s - o) - (a - o) * (i - r); 37357 return !(h > 0 && d > 0 || h < 0 && d < 0); 37358 }; 37359 return !!(l(e1, t1, i, s, r, o, n, o) || l(e1, t1, i, s, n, o, n, a) || l(e1, t1, i, s, r, a, n, a) || l(e1, t1, i, s, r, o, r, a)); 37360 } 37361 class ts { 37362 clear() { 37363 this._tileCoverages = []; 37364 } 37365 addTileCoverage(e1, t1) { 37366 this._tileCoverages.push({ 37367 tileId: e1, 37368 polygons: t1, 37369 frcMask: Yi(t1) 37370 }); 37371 } 37372 empty() { 37373 return 0 === this._tileCoverages.length; 37374 } 37375 updateSnapshotIfNeeded() { 37376 if (this._snapshot.equals(this._tileCoverages)) return this._snapshot; 37377 const e1 = this._tileCoverages.map((e1)=>({ 37378 tileId: e1.tileId, 37379 polygons: e1.polygons, 37380 frcMask: e1.frcMask 37381 })); 37382 return this._snapshot = new Qi(e1), this._snapshot; 37383 } 37384 constructor(){ 37385 this._tileCoverages = [], this._snapshot = new Qi; 37386 } 37387 } 37388 function is(e1, t1) { 37389 const i = {}; 37390 if (!t1) return i; 37391 for (const s of e1){ 37392 const e1 = s.layerIds.map((e1)=>t1.getLayer(e1)).filter(Boolean); 37393 if (0 !== e1.length) { 37394 s.layers = e1, s.stateDependentLayerIds && (s.stateDependentLayers = s.stateDependentLayerIds.map((t1)=>e1.filter((e1)=>e1.id === t1)[0])), s.updateExpressions && s.updateExpressions(e1); 37395 for (const t1 of e1)i[t1.fqid] = s; 37396 } 37397 } 37398 return i; 37399 } 37400 const ss = 32, rs = 33, os = new Uint16Array(8184); 37401 for(let e1 = 0; e1 < 2046; e1++){ 37402 let t1 = e1 + 2, i = 0, s = 0, r = 0, o = 0, n = 0, a = 0; 37403 for(1 & t1 ? r = o = n = ss : i = s = a = ss; (t1 >>= 1) > 1;){ 37404 const e1 = i + r >> 1, l = s + o >> 1; 37405 1 & t1 ? (r = i, o = s, i = n, s = a) : (i = r, s = o, r = n, o = a), n = e1, a = l; 37406 } 37407 const l = 4 * e1; 37408 os[l + 0] = i, os[l + 1] = s, os[l + 2] = r, os[l + 3] = o; 37409 } 37410 const ns = new Uint16Array(2178), as = new Uint8Array(1089), ls = new Uint16Array(1089); 37411 function cs(e1) { 37412 return 0 === e1 ? -.03125 : 32 === e1 ? .03125 : 0; 37413 } 37414 var hs = e1.a_([ 37415 { 37416 name: "a_pos", 37417 type: "Int16", 37418 components: 2 37419 }, 37420 { 37421 name: "a_texture_pos", 37422 type: "Uint16", 37423 components: 2 37424 } 37425 ]); 37426 const ds = (()=>({ 37427 type: 2, 37428 extent: e1.a6, 37429 loadGeometry: ()=>[ 37430 [ 37431 new e1.P(0, 0), 37432 new e1.P(e1.a6 + 1, 0), 37433 new e1.P(e1.a6 + 1, e1.a6 + 1), 37434 new e1.P(0, e1.a6 + 1), 37435 new e1.P(0, 0) 37436 ] 37437 ] 37438 }))(); 37439 let us, ps = 0; 37440 class fs { 37441 registerFadeDuration(t1) { 37442 const i = t1 + this.timeAdded; 37443 i < e1.e.now() || void 0 !== this.fadeEndTime && i < this.fadeEndTime || (this.fadeEndTime = i); 37444 } 37445 wasRequested() { 37446 return "errored" === this.state || "loaded" === this.state || "reloading" === this.state; 37447 } 37448 get tileTransform() { 37449 return this._tileTransform || (this._tileTransform = e1.bp(this.tileID.canonical, this.projection)), this._tileTransform; 37450 } 37451 loadVectorData(t1, i, s) { 37452 if (this.unloadVectorData(), this.state = "loaded", t1) { 37453 t1.featureIndex && (this.latestFeatureIndex = t1.featureIndex, t1.rawTileData ? (this.latestRawTileData = t1.rawTileData, this.latestFeatureIndex.rawTileData = t1.rawTileData) : this.latestRawTileData && (this.latestFeatureIndex.rawTileData = this.latestRawTileData)), this.collisionBoxArray = t1.collisionBoxArray, this.buckets = is(t1.buckets, i.style), t1.frcCoveragePolygons && t1.frcCoveragePolygons.length > 0 && (this.frcCoveragePolygons = t1.frcCoveragePolygons), this.hasDeferredRoadStructure = !!t1.hasDeferredRoadStructure, void 0 !== t1.parsedElevationFeatures && (this.parsedElevationFeatures = t1.parsedElevationFeatures, this.parsedElevationGeneration = ++ps), this.hasDeferredElevationFeatures = !!t1.hasDeferredElevationFeatures, this.hasSymbolBuckets = !1, this.hasTunnelGeometry = !!t1.hasTunnelGeometry; 37454 for(const t1 in this.buckets){ 37455 const i = this.buckets[t1]; 37456 if (i instanceof e1.bu) { 37457 if (this.hasSymbolBuckets = !0, !s) break; 37458 i.justReloaded = !0; 37459 } 37460 } 37461 if (this.hasRTLText = !1, this.hasSymbolBuckets) for(const t1 in this.buckets){ 37462 const i = this.buckets[t1]; 37463 if (i instanceof e1.bu && i.hasRTLText) { 37464 this.hasRTLText = !0, e1.bN(); 37465 break; 37466 } 37467 } 37468 this.queryPadding = 0; 37469 for(const e1 in this.buckets){ 37470 const t1 = this.buckets[e1], s = i.style.getOwnLayer(e1); 37471 if (!s) continue; 37472 const r = s.queryRadius(t1) || 0; 37473 this.queryPadding = Math.max(this.queryPadding, r); 37474 } 37475 t1.imageAtlas && (this.imageAtlas = i.style.imageManager.imageAtlasCache.getOrCache(t1.imageAtlas)), t1.glyphAtlasImage && (this.glyphAtlasImage = t1.glyphAtlasImage), t1.lineAtlas && (this.lineAtlas = t1.lineAtlas), this._lastUpdatedBrightness = t1.brightness; 37476 } else this.collisionBoxArray = new e1.bt; 37477 } 37478 unloadVectorData() { 37479 if (this.hasData()) { 37480 for(const e1 in this.buckets)this.buckets[e1].destroy(); 37481 this.buckets = {}, this.imageAtlas && (this.imageAtlas = null), this.lineAtlas && (this.lineAtlas = null), this.imageAtlasTexture && (this.imageAtlasTexture = null), this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(), this.lineAtlasTexture && this.lineAtlasTexture.destroy(), this._tileBoundsBuffer && (this._tileBoundsBuffer.destroy(), this._tileBoundsIndexBuffer.destroy(), this._tileBoundsSegments.destroy(), this._tileBoundsBuffer = null), this._tileDebugBuffer && (this._tileDebugBuffer.destroy(), this._tileDebugSegments.destroy(), this._tileDebugBuffer = null), this._tileDebugIndexBuffer && (this._tileDebugIndexBuffer.destroy(), this._tileDebugIndexBuffer = null), this._globeTileDebugBorderBuffer && (this._globeTileDebugBorderBuffer.destroy(), this._globeTileDebugBorderBuffer = null), this._tileDebugTextBuffer && (this._tileDebugTextBuffer.destroy(), this._tileDebugTextSegments.destroy(), this._tileDebugTextIndexBuffer.destroy(), this._tileDebugTextBuffer = null), this._globeTileDebugTextBuffer && (this._globeTileDebugTextBuffer.destroy(), this._globeTileDebugTextBuffer = null), this.latestFeatureIndex = null, this.state = "unloaded"; 37482 } 37483 } 37484 loadModelData(e1, t1, i) { 37485 e1 && (e1.resourceTiming && (this.resourceTiming = e1.resourceTiming), this.buckets = { 37486 ...this.buckets, 37487 ...is(e1.buckets, t1.style) 37488 }, e1.featureIndex && (this.latestFeatureIndex = e1.featureIndex)); 37489 } 37490 getBucket(e1) { 37491 return this.buckets[e1.fqid]; 37492 } 37493 upload(t1, i) { 37494 for(const e1 in this.buckets){ 37495 const s = this.buckets[e1]; 37496 if (s.uploadPending()) { 37497 let e1 = {}, r = [], o = { 37498 zoom: 0, 37499 pitch: 0, 37500 brightness: 0, 37501 worldview: "" 37502 }; 37503 if (i) { 37504 if (i.style) { 37505 r = i.style.listImages(); 37506 const t1 = s.layers[0], o = t1.sourceLayer || "_geojsonTileLayer", n = i.style.getLayerSourceCache(t1); 37507 n && (e1 = n._state.getState(o, void 0)); 37508 } 37509 o = { 37510 zoom: i.transform.zoom || 0, 37511 pitch: i.transform.pitch || 0, 37512 brightness: i.style.getBrightness() || 0, 37513 worldview: i.worldview || "" 37514 }; 37515 } 37516 s.upload(t1, this.tileID.canonical, e1, r, o); 37517 } 37518 } 37519 const s = t1.gl, r = this.imageAtlas; 37520 r && i && (this.imageAtlasTexture = i.style.imageManager.imageAtlasCache.getTextureForAtlas(r, t1, s.RGBA8), r.uploaded = !0), this.glyphAtlasImage && (this.glyphAtlasTexture = new e1.T(t1, this.glyphAtlasImage, s.R8), this.glyphAtlasImage = null), this.lineAtlas && !this.lineAtlas.uploaded && (this.lineAtlasTexture = new e1.T(t1, this.lineAtlas.image, s.R8), this.lineAtlas.uploaded = !0); 37521 } 37522 prepare(e1, t1, i) { 37523 if (this.imageAtlas && this.imageAtlasTexture && t1) { 37524 const s = t1.style.getLut(i); 37525 this.imageAtlas.patchUpdatedImages(e1, this.imageAtlasTexture, i, s); 37526 } 37527 if (!t1 || !this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData) return; 37528 const s = t1.style.getBrightness(), r = t1.style.listImages(), o = r.length, n = t1.style._changes.getUpdatedPaintProperties(), a = Object.keys(this.buckets).some((e1)=>this.buckets[e1].layers.some((e1)=>n.has(e1.fqid))), l = Object.keys(this.buckets).some((e1)=>this.buckets[e1].layers.some((e1)=>e1.hasTransition && e1.hasTransition())), c = this._firstPrepareComplete && o !== this._lastAvailableImagesCount; 37529 null === this._hasAppearances && (this._hasAppearances = this.hasAppearances(t1)); 37530 const h = this._lastUpdatedBrightness !== s; 37531 this._lastAvailableImagesCount = o, this._firstPrepareComplete = !0, (this._lastUpdatedBrightness || s || this._hasAppearances || a || l || c) && (!(this._hasAppearances || a || l || c) && this._lastUpdatedBrightness && s && Math.abs(this._lastUpdatedBrightness - s) < .001 || (this.updateBuckets(t1, h, void 0, c || a || l, n, r), this._lastUpdatedBrightness = s)); 37532 } 37533 evaluateQueryRenderedFeaturePadding() { 37534 let e1 = 0; 37535 for(const t1 in this.buckets){ 37536 const i = this.buckets[t1]; 37537 i.evaluateQueryRenderedFeaturePadding && (e1 = Math.max(e1, i.evaluateQueryRenderedFeaturePadding())); 37538 } 37539 return e1; 37540 } 37541 queryRenderedFeatures(t1, i, s, r, o, n, a) { 37542 if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData && !this.latestFeatureIndex.is3DTile) return {}; 37543 const l = this.evaluateQueryRenderedFeaturePadding(), c = function(t1, i) { 37544 const s = e1.bL([], [ 37545 .5 * t1.width, 37546 .5 * -t1.height, 37547 1 37548 ]); 37549 return e1.bM(s, s, [ 37550 1, 37551 -1, 37552 0 37553 ]), e1.X(s, s, t1.calculateProjMatrix(i.toUnwrapped())), Float32Array.from(s); 37554 }(o, this.tileID); 37555 return this.latestFeatureIndex.query(t1, { 37556 tilespaceGeometry: i, 37557 pixelPosMatrix: c, 37558 transform: r, 37559 availableImages: s, 37560 tileTransform: this.tileTransform, 37561 worldview: this.worldview, 37562 queryRadius: l, 37563 scope: a 37564 }); 37565 } 37566 querySourceFeatures(t1, i) { 37567 const s = this.latestFeatureIndex; 37568 if (!s || !s.rawTileData) return; 37569 const r = s.loadVTLayers(), o = i ? i.sourceLayer : "", n = r._geojsonTileLayer || r[o]; 37570 if (!n) return; 37571 const a = e1.bv(i && i.filter), { z: l, x: c, y: h } = this.tileID.canonical, d = { 37572 z: l, 37573 x: c, 37574 y: h 37575 }; 37576 for(let i = 0; i < n.length; i++){ 37577 const r = n.feature(i); 37578 if (a.needGeometry) { 37579 const t1 = e1.bw(r, !0); 37580 if (!a.filter(new e1.ai(this.tileID.overscaledZ, { 37581 worldview: this.worldview 37582 }), t1, this.tileID.canonical)) continue; 37583 } else if (!a.filter(new e1.ai(this.tileID.overscaledZ, { 37584 worldview: this.worldview 37585 }), r)) continue; 37586 const u = s.getId(r, o), p = new e1.bx(r, l, c, h, u); 37587 p.tile = d, t1.push(p); 37588 } 37589 } 37590 loaded() { 37591 return "loaded" === this.state || "errored" === this.state; 37592 } 37593 hasData() { 37594 return "loaded" === this.state || "reloading" === this.state || "expired" === this.state; 37595 } 37596 patternsLoaded() { 37597 return !!this.imageAtlas && !!this.imageAtlas.patternPositions.size; 37598 } 37599 setExpiryData(t1) { 37600 const i = this.expirationTime; 37601 if (t1.cacheControl) { 37602 const i = e1.by(t1.cacheControl); 37603 i["max-age"] && (this.expirationTime = Date.now() + 1e3 * i["max-age"]); 37604 } else t1.expires && (this.expirationTime = new Date(t1.expires).getTime()); 37605 if (this.expirationTime) { 37606 const e1 = Date.now(); 37607 let t1 = !1; 37608 if (this.expirationTime > e1) t1 = !1; 37609 else if (i) if (this.expirationTime < i) t1 = !0; 37610 else { 37611 const s = this.expirationTime - i; 37612 s ? this.expirationTime = e1 + Math.max(s, 3e4) : t1 = !0; 37613 } 37614 else t1 = !0; 37615 t1 ? (this.expiredRequestCount++, this.state = "expired") : this.expiredRequestCount = 0; 37616 } 37617 } 37618 getExpiryTimeout() { 37619 if (this.expirationTime) return this.expiredRequestCount ? 1e3 * (1 << Math.min(this.expiredRequestCount - 1, 31)) : Math.min(this.expirationTime - Date.now(), Math.pow(2, 31) - 1); 37620 } 37621 refreshFeatureState(e1, t1) { 37622 if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData && !this.latestFeatureIndex.is3DTile || !e1) return; 37623 const i = e1.style.listImages(); 37624 this.updateBuckets(e1, !1, t1, void 0, void 0, i); 37625 } 37626 hasAppearances(e1) { 37627 for(const t1 in this.buckets)if (e1.style.hasLayer(t1) && this.buckets[t1].layers.some((e1)=>e1.appearances && e1.appearances.length > 0)) return !0; 37628 return !1; 37629 } 37630 updateBuckets(t1, i, s, r, o, n) { 37631 if (!this.latestFeatureIndex) return; 37632 if (!t1.style) return; 37633 const a = n || t1.style.listImages(), l = t1.style.getBrightness(), c = o || new Set; 37634 for(const o in this.buckets){ 37635 if (!t1.style.hasLayer(o)) continue; 37636 const n = this.buckets[o], h = n.layers[0], d = h.sourceLayer || "_geojsonTileLayer", u = t1.style.getLayerSourceCache(h), p = n.layers.some((e1)=>c.has(e1.fqid)), f = (r || p) && n instanceof e1.bu ? t1.style.getOwnLayer(o) : void 0; 37637 let m = s && s[d] || {}; 37638 u && !s && (m = u._state.getState(d, void 0)); 37639 const _ = this.imageAtlas ? Object.fromEntries(this.imageAtlas.patternPositions) : {}, g = Object.keys(m).length > 0 && !i; 37640 n.hasAppearances = n.layers.some((e1)=>e1.appearances && e1.appearances.length > 0); 37641 const y = g ? n.stateDependentLayers : n.layers; 37642 if (g && 0 !== n.stateDependentLayers.length || i || p || r) { 37643 const s = this.latestFeatureIndex.loadVTLayers()[d]; 37644 if (n.update(m, s, a, _, y, i, l, this.tileID.canonical), (r || p) && (!i || i && n instanceof e1.bu && (!n.text.uboBinder || n.text.uboBinder.isLightConstant || !n.icon.uboBinder || n.icon.uboBinder.isLightConstant)) && n instanceof e1.bu && f && "symbol" === f.type) { 37645 const e1 = n; 37646 e1.text && e1.text.uboBinder && e1.text.uboBinder.updateDynamicExpressions(f, s, this.tileID.canonical, a, m, l), e1.icon && e1.icon.uboBinder && e1.icon.uboBinder.updateDynamicExpressions(f, s, this.tileID.canonical, a, m, l); 37647 } 37648 if (n instanceof e1.bu) { 37649 const e1 = n, i = t1.context; 37650 e1.text && e1.text.uboBinder && e1.text.uboBinder.upload(i), e1.icon && e1.icon.uboBinder && e1.icon.uboBinder.upload(i); 37651 } 37652 } 37653 if (g && 0 !== n.stateDependentLayers.length || i || n.hasAppearances) { 37654 const i = { 37655 zoom: t1.transform.zoom, 37656 pitch: t1.transform.pitch, 37657 brightness: t1.style.getBrightness() || 0, 37658 worldview: t1.worldview 37659 }, s = n.updateAppearances(this.tileID.canonical, m, a, i, t1.imageManager, g && 0 !== n.stateDependentLayers.length); 37660 if (s && s.hasUboChanges) { 37661 const i = t1.context; 37662 n instanceof e1.bu && n.text && n.text.uboBinder && n.text.uboBinder.upload(i), n instanceof e1.bu && n.icon && n.icon.uboBinder && n.icon.uboBinder.upload(i); 37663 } 37664 } 37665 (n instanceof e1.bz || n instanceof e1.bA) && t1._terrain && t1._terrain.enabled && u && n.uploadPending() && t1._terrain._clearRenderCacheForTile(u.id, this.tileID); 37666 const v = t1 && t1.style && t1.style.getOwnLayer(o); 37667 v && (this.queryPadding = Math.max(this.queryPadding, v.queryRadius(n) || 0)); 37668 } 37669 } 37670 holdingForFade() { 37671 return void 0 !== this.symbolFadeHoldUntil; 37672 } 37673 symbolFadeFinished() { 37674 return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < e1.e.now(); 37675 } 37676 clearFadeHold() { 37677 this.symbolFadeHoldUntil = void 0; 37678 } 37679 setHoldDuration(t1) { 37680 this.symbolFadeHoldUntil = e1.e.now() + t1; 37681 } 37682 setTexture(t1, i) { 37683 const s = i.context, r = s.gl; 37684 this.texture = this.texture || i.getTileTexture(t1.width), this.texture && this.texture instanceof e1.T ? this.texture.update(t1) : (this.texture = new e1.T(s, t1, r.RGBA8, { 37685 useMipmap: !0 37686 }), this.texture.bind(r.LINEAR, r.CLAMP_TO_EDGE)); 37687 } 37688 setDependencies(e1, t1) { 37689 const i = {}; 37690 for (const e1 of t1)i[e1] = !0; 37691 this.dependencies[e1] = i; 37692 } 37693 hasDependency(e1, t1) { 37694 for (const i of e1){ 37695 const e1 = this.dependencies[i]; 37696 if (e1) { 37697 for (const i of t1)if (e1[i]) return !0; 37698 } 37699 } 37700 return !1; 37701 } 37702 clearQueryDebugViz() {} 37703 _makeDebugTileBoundsBuffers(t1, i) { 37704 if (!i || "mercator" === i.name || this._tileDebugBuffer) return; 37705 const s = e1.bB(ds, this.tileID.canonical, this.tileTransform)[0], r = new e1.bC, o = new e1.bD; 37706 for(let e1 = 0; e1 < s.length; e1++){ 37707 const { x: t1, y: i } = s[e1]; 37708 r.emplaceBack(t1, i), o.emplaceBack(e1); 37709 } 37710 o.emplaceBack(0), this._tileDebugIndexBuffer = t1.createIndexBuffer(o), this._tileDebugBuffer = t1.createVertexBuffer(r, e1.bE.members), this._tileDebugSegments = e1.ac.simpleSegment(0, 0, r.length, o.length); 37711 } 37712 _makeTileBoundsBuffers(t1, i) { 37713 if (this._tileBoundsBuffer || !i || "mercator" === i.name) return; 37714 const s = e1.bB(ds, this.tileID.canonical, this.tileTransform)[0]; 37715 let r, o; 37716 if (this.isRaster) { 37717 const t1 = function(t1, i) { 37718 const s = e1.bp(t1, i), r = Math.pow(2, t1.z); 37719 for(let o = 0; o < rs; o++)for(let n = 0; n < rs; n++){ 37720 const a = e1.bq((t1.x + (n + cs(n)) / ss) / r), l = e1.br((t1.y + (o + cs(o)) / ss) / r), c = i.project(a, l), h = o * rs + n; 37721 ns[2 * h + 0] = Math.round((c.x * s.scale - s.x) * e1.a6), ns[2 * h + 1] = Math.round((c.y * s.scale - s.y) * e1.a6); 37722 } 37723 as.fill(0), ls.fill(0); 37724 for(let e1 = 2045; e1 >= 0; e1--){ 37725 const t1 = 4 * e1, i = os[t1 + 0], s = os[t1 + 1], r = os[t1 + 2], o = os[t1 + 3], n = i + r >> 1, a = s + o >> 1, l = n + a - s, c = a + i - n, h = s * rs + i, d = o * rs + r, u = a * rs + n, p = Math.hypot((ns[2 * h + 0] + ns[2 * d + 0]) / 2 - ns[2 * u + 0], (ns[2 * h + 1] + ns[2 * d + 1]) / 2 - ns[2 * u + 1]) >= 16; 37726 as[u] = as[u] || (p ? 1 : 0), e1 < 1022 && (as[u] = as[u] || as[(s + c >> 1) * rs + (i + l >> 1)] || as[(o + c >> 1) * rs + (r + l >> 1)]); 37727 } 37728 const o = new e1.bs, n = new e1.ad; 37729 let a = 0; 37730 function l(t1, i) { 37731 const s = i * rs + t1; 37732 return 0 === ls[s] && (o.emplaceBack(ns[2 * s + 0], ns[2 * s + 1], t1 * e1.a6 / ss, i * e1.a6 / ss), ls[s] = ++a), ls[s] - 1; 37733 } 37734 function c(e1, t1, i, s, r, o) { 37735 const a = e1 + i >> 1, h = t1 + s >> 1; 37736 if (Math.abs(e1 - r) + Math.abs(t1 - o) > 1 && as[h * rs + a]) c(r, o, e1, t1, a, h), c(i, s, r, o, a, h); 37737 else { 37738 const a = l(e1, t1), c = l(i, s), h = l(r, o); 37739 n.emplaceBack(a, c, h); 37740 } 37741 } 37742 return c(0, 0, ss, ss, ss, 0), c(ss, ss, 0, 0, 0, ss), { 37743 vertices: o, 37744 indices: n 37745 }; 37746 }(this.tileID.canonical, i); 37747 r = t1.vertices, o = t1.indices; 37748 } else { 37749 r = new e1.bs, o = new e1.ad; 37750 for (const { x: e1, y: t1 } of s)r.emplaceBack(e1, t1, 0, 0); 37751 const t1 = e1.bF(r.int16.subarray(0, 4 * r.length), void 0, 4); 37752 for(let e1 = 0; e1 < t1.length; e1 += 3)o.emplaceBack(t1[e1], t1[e1 + 1], t1[e1 + 2]); 37753 } 37754 this._tileBoundsBuffer = t1.createVertexBuffer(r, hs.members), this._tileBoundsIndexBuffer = t1.createIndexBuffer(o), this._tileBoundsSegments = e1.ac.simpleSegment(0, 0, r.length, o.length); 37755 } 37756 _makeGlobeTileDebugBuffers(t1, i) { 37757 const s = i.projection; 37758 if (!s || "globe" !== s.name || i.freezeTileCoverage) return; 37759 const r = this.tileID.canonical, o = e1.V(r, i), n = e1.b4(o), a = e1.S(i.zoom); 37760 let l; 37761 a > 0 && (l = e1.aO(new Float64Array(16), i.globeMatrix)), this._makeGlobeTileDebugBorderBuffer(t1, r, i, n, l, a), this._makeGlobeTileDebugTextBuffer(t1, r, i, n, l, a); 37762 } 37763 _globePoint(t1, i, s, r, o, n, a) { 37764 let l = e1.bG(t1, i, s); 37765 if (n) { 37766 const o = 1 << s.z, c = e1.a7(r.center.lng), h = e1.a8(r.center.lat), d = (s.x + .5) / o - c; 37767 let u = 0; 37768 d > .5 ? u = -1 : d < -.5 && (u = 1); 37769 let p = (t1 / e1.a6 + s.x) / o + u, f = (i / e1.a6 + s.y) / o; 37770 p = (p - c) * r._pixelsPerMercatorPixel + c, f = (f - h) * r._pixelsPerMercatorPixel + h; 37771 const m = [ 37772 p * r.worldSize, 37773 f * r.worldSize, 37774 0 37775 ]; 37776 e1.bH(m, m, n), l = e1.bI(l, m, a); 37777 } 37778 return e1.bH(l, l, o); 37779 } 37780 _makeGlobeTileDebugBorderBuffer(t1, i, s, r, o, n) { 37781 const a = new e1.bC, l = new e1.bD, c = new e1.bJ, h = (e1, t1, h, d, u)=>{ 37782 const p = (h - e1) / (u - 1), f = (d - t1) / (u - 1), m = a.length; 37783 for(let h = 0; h < u; h++){ 37784 const d = e1 + h * p, u = t1 + h * f; 37785 a.emplaceBack(d, u); 37786 const _ = this._globePoint(d, u, i, s, r, o, n); 37787 c.emplaceBack(_[0], _[1], _[2]), l.emplaceBack(m + h); 37788 } 37789 }, d = e1.a6; 37790 h(0, 0, d, 0, 16), h(d, 0, d, d, 16), h(d, d, 0, d, 16), h(0, d, 0, 0, 16), this._tileDebugIndexBuffer = t1.createIndexBuffer(l), this._tileDebugBuffer = t1.createVertexBuffer(a, e1.bE.members), this._globeTileDebugBorderBuffer = t1.createVertexBuffer(c, e1.bK.members), this._tileDebugSegments = e1.ac.simpleSegment(0, 0, a.length, l.length); 37791 } 37792 _makeGlobeTileDebugTextBuffer(t1, i, s, r, o, n) { 37793 const a = e1.a6 / 4, l = new e1.bC, c = new e1.ad, h = new e1.bJ, d = 25; 37794 c.reserve(32), l.reserve(d), h.reserve(d); 37795 const u = (e1, t1)=>d * e1 + t1; 37796 for(let e1 = 0; e1 < d; e1++){ 37797 const t1 = e1 * a; 37798 for(let e1 = 0; e1 < d; e1++){ 37799 const c = e1 * a; 37800 l.emplaceBack(c, t1); 37801 const d = this._globePoint(c, t1, i, s, r, o, n); 37802 h.emplaceBack(d[0], d[1], d[2]); 37803 } 37804 } 37805 for(let e1 = 0; e1 < 4; e1++)for(let t1 = 0; t1 < 4; t1++){ 37806 const i = u(e1, t1), s = u(e1, t1 + 1), r = u(e1 + 1, t1), o = u(e1 + 1, t1 + 1); 37807 c.emplaceBack(i, s, r), c.emplaceBack(r, s, o); 37808 } 37809 this._tileDebugTextIndexBuffer = t1.createIndexBuffer(c), this._tileDebugTextBuffer = t1.createVertexBuffer(l, e1.bE.members), this._globeTileDebugTextBuffer = t1.createVertexBuffer(h, e1.bK.members), this._tileDebugTextSegments = e1.ac.simpleSegment(0, 0, d, 32); 37810 } 37811 destroy() { 37812 let t1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0; 37813 for(const e1 in this.buckets)this.buckets[e1].destroy(t1); 37814 this.buckets = {}, this.imageAtlas && (this.imageAtlas = null), this.lineAtlas && (this.lineAtlas = null), this.imageAtlasTexture && delete this.imageAtlasTexture, this.glyphAtlasTexture && (this.glyphAtlasTexture.destroy(), delete this.glyphAtlasTexture), this.lineAtlasTexture && (this.lineAtlasTexture.destroy(), delete this.lineAtlasTexture), this._tileBoundsBuffer && (this._tileBoundsBuffer.destroy(), this._tileBoundsIndexBuffer.destroy(), this._tileBoundsSegments.destroy(), this._tileBoundsBuffer = null), this._tileDebugBuffer && (this._tileDebugBuffer.destroy(), this._tileDebugSegments.destroy(), this._tileDebugBuffer = null), this._tileDebugIndexBuffer && (this._tileDebugIndexBuffer.destroy(), this._tileDebugIndexBuffer = null), this._globeTileDebugBorderBuffer && (this._globeTileDebugBorderBuffer.destroy(), this._globeTileDebugBorderBuffer = null), this._tileDebugTextBuffer && (this._tileDebugTextBuffer.destroy(), this._tileDebugTextSegments.destroy(), this._tileDebugTextIndexBuffer.destroy(), this._tileDebugTextBuffer = null), this._globeTileDebugTextBuffer && (this._globeTileDebugTextBuffer.destroy(), this._globeTileDebugTextBuffer = null), t1 && this.texture && this.texture instanceof e1.T && (this.texture.destroy(), delete this.texture), this.emissiveTexture && this.emissiveTexture instanceof e1.T && (this.emissiveTexture.destroy(), delete this.emissiveTexture), this.hillshadeFBO && (this.hillshadeFBO.destroy(), delete this.hillshadeFBO), this.dem && delete this.dem, this.neighboringTiles && delete this.neighboringTiles, this.demTexture && (this.demTexture.destroy(), delete this.demTexture), this.rasterParticleState && (this.rasterParticleState.destroy(), delete this.rasterParticleState), this.latestFeatureIndex = null, this.state = "unloaded"; 37815 } 37816 constructor(t1, i, s, r, o, n){ 37817 this.tileID = t1, this.uid = e1.av(), this.uses = 0, this.tileSize = i, this.tileZoom = s, this.dashIdealZ = t1.overscaledZ, this.buckets = {}, this.expirationTime = null, this.queryPadding = 0, this.hasSymbolBuckets = !1, this.hasTunnelGeometry = !1, this.hasRTLText = !1, this.dependencies = {}, this.isRaster = o, r && r.style && (this._lastUpdatedBrightness = r.style.getBrightness()), this._lastAvailableImagesCount = 0, this._firstPrepareComplete = !1, this.expiredRequestCount = 0, this.state = "loading", r && r.transform && (this.projection = r.transform.projection), this.worldview = n, this._hasAppearances = null; 37818 } 37819 } 37820 class ms { 37821 reset() { 37822 for(const e1 in this.data)for (const t1 of this.data[e1])t1.timeout && clearTimeout(t1.timeout), this.onRemove(t1.value); 37823 return this.data = {}, this.order = [], this; 37824 } 37825 add(e1, t1, i) { 37826 const s = e1.wrapped().key; 37827 void 0 === this.data[s] && (this.data[s] = []); 37828 const r = { 37829 value: t1, 37830 timeout: void 0 37831 }; 37832 if (void 0 !== i && (r.timeout = setTimeout(()=>{ 37833 this.remove(e1, r); 37834 }, i)), this.data[s].push(r), this.order.push(s), this.order.length > this.max) { 37835 const e1 = this._getAndRemoveByKey(this.order[0]); 37836 e1 && this.onRemove(e1); 37837 } 37838 return this; 37839 } 37840 has(e1) { 37841 return e1.wrapped().key in this.data; 37842 } 37843 getAndRemove(e1) { 37844 return this.has(e1) ? this._getAndRemoveByKey(e1.wrapped().key) : null; 37845 } 37846 _getAndRemoveByKey(e1) { 37847 const t1 = this.data[e1].shift(); 37848 return t1.timeout && clearTimeout(t1.timeout), 0 === this.data[e1].length && delete this.data[e1], this.order.splice(this.order.indexOf(e1), 1), t1.value; 37849 } 37850 getByKey(e1) { 37851 const t1 = this.data[e1]; 37852 return t1 ? t1[0].value : null; 37853 } 37854 get(e1) { 37855 return this.has(e1) ? this.data[e1.wrapped().key][0].value : null; 37856 } 37857 remove(e1, t1) { 37858 if (!this.has(e1)) return this; 37859 const i = e1.wrapped().key, s = void 0 === t1 ? 0 : this.data[i].indexOf(t1), r = this.data[i][s]; 37860 return this.data[i].splice(s, 1), r.timeout && clearTimeout(r.timeout), 0 === this.data[i].length && delete this.data[i], this.onRemove(r.value), this.order.splice(this.order.indexOf(i), 1), this; 37861 } 37862 setMaxSize(e1) { 37863 for(this.max = e1; this.order.length > this.max;){ 37864 const e1 = this._getAndRemoveByKey(this.order[0]); 37865 e1 && this.onRemove(e1); 37866 } 37867 return this; 37868 } 37869 filter(e1) { 37870 const t1 = []; 37871 for(const i in this.data)for (const s of this.data[i])e1(s.value) || t1.push(s); 37872 for (const e1 of t1)this.remove(e1.value.tileID, e1); 37873 } 37874 constructor(e1, t1){ 37875 this.max = e1, this.onRemove = t1, this.reset(); 37876 } 37877 } 37878 class _s { 37879 updateState(e1, t1, i) { 37880 const s = String(t1); 37881 if (this.stateChanges[e1] = this.stateChanges[e1] || Object.create(null), this.stateChanges[e1][s] = this.stateChanges[e1][s] || Object.create(null), Object.assign(this.stateChanges[e1][s], i), null === this.deletedStates[e1]) { 37882 this.deletedStates[e1] = Object.create(null); 37883 for(const t1 in this.state[e1])t1 !== s && (this.deletedStates[e1][t1] = null); 37884 } else if (this.deletedStates[e1] && null === this.deletedStates[e1][s]) { 37885 this.deletedStates[e1][s] = Object.create(null); 37886 for(const t1 in this.state[e1][s])i[t1] || (this.deletedStates[e1][s][t1] = null); 37887 } else for(const t1 in i)this.deletedStates[e1] && this.deletedStates[e1][s] && null === this.deletedStates[e1][s][t1] && delete this.deletedStates[e1][s][t1]; 37888 } 37889 removeFeatureState(e1, t1, i) { 37890 if (null === this.deletedStates[e1]) return; 37891 const s = String(t1); 37892 if (this.deletedStates[e1] = this.deletedStates[e1] || Object.create(null), i && void 0 !== t1) null !== this.deletedStates[e1][s] && (this.deletedStates[e1][s] = this.deletedStates[e1][s] || Object.create(null), this.deletedStates[e1][s][i] = null); 37893 else if (void 0 !== t1) if (this.stateChanges[e1] && this.stateChanges[e1][s]) for(i in this.deletedStates[e1][s] = Object.create(null), this.stateChanges[e1][s])this.deletedStates[e1][s][i] = null; 37894 else this.deletedStates[e1][s] = null; 37895 else this.deletedStates[e1] = null; 37896 } 37897 getState(e1, t1) { 37898 const i = this.state[e1] || Object.create(null), s = this.stateChanges[e1] || Object.create(null), r = this.deletedStates[e1]; 37899 if (null === r) return Object.create(null); 37900 if (void 0 !== t1) { 37901 const e1 = String(t1), o = Object.assign(Object.create(null), i[e1], s[e1]); 37902 if (r) { 37903 const e1 = r[t1]; 37904 if (null === e1) return Object.create(null); 37905 for(const t1 in e1)delete o[t1]; 37906 } 37907 return o; 37908 } 37909 const o = Object.assign(Object.create(null), i, s); 37910 if (r) for(const e1 in r)delete o[e1]; 37911 return o; 37912 } 37913 initializeTileState(e1, t1) { 37914 e1.refreshFeatureState(t1); 37915 } 37916 coalesceChanges(e1, t1) { 37917 const i = Object.create(null); 37918 for(const e1 in this.stateChanges){ 37919 this.state[e1] = this.state[e1] || Object.create(null); 37920 const t1 = Object.create(null); 37921 for(const i in this.stateChanges[e1])this.state[e1][i] || (this.state[e1][i] = Object.create(null)), Object.assign(this.state[e1][i], this.stateChanges[e1][i]), t1[i] = this.state[e1][i]; 37922 i[e1] = t1; 37923 } 37924 for(const e1 in this.deletedStates){ 37925 this.state[e1] = this.state[e1] || Object.create(null); 37926 const t1 = Object.create(null); 37927 if (null === this.deletedStates[e1]) for(const i in this.state[e1])t1[i] = Object.create(null), this.state[e1][i] = Object.create(null); 37928 else for(const i in this.deletedStates[e1]){ 37929 if (null === this.deletedStates[e1][i]) this.state[e1][i] = Object.create(null); 37930 else if (this.state[e1][i]) for (const t1 of Object.keys(this.deletedStates[e1][i]))delete this.state[e1][i][t1]; 37931 t1[i] = this.state[e1][i]; 37932 } 37933 i[e1] = i[e1] || Object.create(null), Object.assign(i[e1], t1); 37934 } 37935 if (this.stateChanges = Object.create(null), this.deletedStates = Object.create(null), 0 !== Object.keys(i).length) for(const s in e1)e1[s].refreshFeatureState(t1, i); 37936 } 37937 constructor(){ 37938 this.state = Object.create(null), this.stateChanges = Object.create(null), this.deletedStates = Object.create(null); 37939 } 37940 } 37941 class gs extends e1.E { 37942 onAdd(e1) { 37943 this.map = e1, this._minTileCacheSize = void 0 === this._minTileCacheSize && e1 ? e1._minTileCacheSize : this._minTileCacheSize, this._maxTileC
37943acheSize = void 0 === this._maxTileCacheSize && e1 ? e1._maxTileCacheSize : this._maxTileCacheSize; 37944 } 37945 setSource(e1) { 37946 e1.on("data", (e1)=>{ 37947 "source" === e1.dataType && "metadata" === e1.sourceDataType && (this._sourceLoaded = !0), this._sourceLoaded && !this._paused && "source" === e1.dataType && "content" === e1.sourceDataType && (this.reload(), this.transform && this.update(this.transform)); 37948 }), e1.on("error", ()=>{ 37949 this._sourceErrored = !0; 37950 }), this._source = e1; 37951 } 37952 loaded() { 37953 if (this._sourceErrored) return !0; 37954 if (!this._sourceLoaded) return !1; 37955 if (!this._source.loaded()) return !1; 37956 for(const e1 in this._tiles)if (!this._tiles[e1].loaded()) return !1; 37957 return !0; 37958 } 37959 getSource() { 37960 return this._source; 37961 } 37962 pause() { 37963 this._paused = !0; 37964 } 37965 resume() { 37966 if (!this._paused) return; 37967 const e1 = this._shouldReloadOnResume; 37968 this._paused = !1, this._shouldReloadOnResume = !1, e1 && this.reload(), this.transform && this.update(this.transform); 37969 } 37970 setMaxzoomOverride(e1) { 37971 this._maxzoomOverride = e1; 37972 } 37973 _loadTile(e1, t1) { 37974 return e1.renderSourceType = this._renderSourceType, e1.isExtraShadowCaster = this._shadowCasterTiles[e1.tileID.key], this._source.loadTile(e1, t1); 37975 } 37976 _unloadTile(e1) { 37977 if (this._source.unloadTile) return this._source.unloadTile(e1); 37978 } 37979 _abortTile(e1) { 37980 if (this._source.abortTile) return this._source.abortTile(e1); 37981 } 37982 serialize() { 37983 return this._source.serialize(); 37984 } 37985 prepare(e1) { 37986 this._source.prepare && this._source.prepare(), this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null); 37987 for(const t1 in this._tiles){ 37988 const i = this._tiles[t1]; 37989 i.upload(e1, this.map ? this.map.painter : void 0), i.prepare(this.map.style.imageManager, this.map ? this.map.painter : null, this._source.scope); 37990 } 37991 } 37992 getIds() { 37993 return Object.values(this._tiles).map((e1)=>e1.tileID).sort(ys).map((e1)=>e1.key); 37994 } 37995 getRenderableIds(t1, i) { 37996 const s = []; 37997 for(const e1 in this._tiles)this._isIdRenderable(+e1, t1, i) && s.push(this._tiles[e1]); 37998 return t1 ? s.sort((t1, i)=>{ 37999 const s = t1.tileID, r = i.tileID, o = new e1.P(s.canonical.x, s.canonical.y)._rotate(this.transform.angle), n = new e1.P(r.canonical.x, r.canonical.y)._rotate(this.transform.angle); 38000 return s.overscaledZ - r.overscaledZ || n.y - o.y || n.x - o.x; 38001 }).map((e1)=>e1.tileID.key) : s.map((e1)=>e1.tileID).sort(ys).map((e1)=>e1.key); 38002 } 38003 hasRenderableParent(e1) { 38004 const t1 = this.findLoadedParent(e1, 0); 38005 return !!t1 && this._isIdRenderable(t1.tileID.key); 38006 } 38007 _isIdRenderable(e1, t1, i) { 38008 return this._tiles[e1] && this._tiles[e1].hasData() && !this._coveredTiles[e1] && (t1 || !this._tiles[e1].holdingForFade()) && (i || !this._shadowCasterTiles[e1]); 38009 } 38010 reload() { 38011 if (this._paused) this._shouldReloadOnResume = !0; 38012 else { 38013 this._cache.reset(); 38014 for(const e1 in this._tiles)"errored" !== this._tiles[e1].state && this._reloadTile(+e1, "reloading"); 38015 } 38016 } 38017 _reloadTile(e1, t1) { 38018 const i = this._tiles[e1]; 38019 i && ("loading" !== i.state && (i.state = t1), this._loadTile(i, this._tileLoaded.bind(this, i, e1, t1))); 38020 } 38021 _tileLoaded(t1, i, s, r, o) { 38022 if (r) { 38023 if (t1.state = "errored", e1.bO(r)) { 38024 if (this._source.fire(new e1.h("data", { 38025 dataType: "source", 38026 sourceDataType: "error", 38027 sourceId: this._source.id, 38028 tile: t1 38029 })), !(t1.tileID.key in this._loadedParentTiles)) return; 38030 if ("raster-dem" === this._source.type && this.usedForTerrain && this.map.painter.terrain) { 38031 const e1 = this.map.painter.terrain; 38032 this.update(this.transform, e1.getScaledDemTileSize(), !0), e1.resetTileLookupCache(this.id
vendor: 22,643 bytes, lines 38032-38428
38032); 38033 } else this.update(this.transform); 38034 } else this._source.fire(new e1.f(r, { 38035 tile: t1 38036 })); 38037 return; 38038 } 38039 t1.timeAdded = e1.e.now(), "expired" === s && (t1.refreshedUponExpiration = !0), this._setTileReloadTimer(i, t1), "raster-dem" === this._source.type && t1.dem && this._backfillDEM(t1), this._state.initializeTileState(t1, this.map ? this.map.painter : null); 38040 let n = new Headers; 38041 o && o.headers && (n = o.headers), this._source.fire(new e1.h("data", { 38042 dataType: "source", 38043 tile: t1, 38044 coord: t1.tileID, 38045 sourceCacheId: this.id, 38046 responseHeaders: n 38047 })); 38048 } 38049 _hasTunnelGeometry() { 38050 for(const e1 in this._tiles){ 38051 const t1 = this._tiles[e1]; 38052 if (t1 && t1.hasTunnelGeometry) return !0; 38053 } 38054 return !1; 38055 } 38056 _backfillDEM(e1) { 38057 const t1 = this.getRenderableIds(); 38058 for(let s = 0; s < t1.length; s++){ 38059 const r = t1[s]; 38060 if (e1.neighboringTiles && e1.neighboringTiles[r]) { 38061 const t1 = this.getTileByID(r); 38062 i(e1, t1), i(t1, e1); 38063 } 38064 } 38065 function i(e1, t1) { 38066 if (!e1.dem || e1.dem.borderReady) return; 38067 e1.needsHillshadePrepare = !0, e1.needsDEMTextureUpload = !0; 38068 let i = t1.tileID.canonical.x - e1.tileID.canonical.x; 38069 const s = t1.tileID.canonical.y - e1.tileID.canonical.y, r = Math.pow(2, e1.tileID.canonical.z), o = t1.tileID.key; 38070 0 === i && 0 === s || Math.abs(s) > 1 || (Math.abs(i) > 1 && (1 === Math.abs(i + r) ? i += r : 1 === Math.abs(i - r) && (i -= r)), t1.dem && e1.dem && (e1.dem.backfillBorder(t1.dem, i, s), e1.neighboringTiles && e1.neighboringTiles[o] && (e1.neighboringTiles[o].backfilled = !0))); 38071 } 38072 } 38073 getTile(e1) { 38074 return this.getTileByID(e1.key); 38075 } 38076 getTileByID(e1) { 38077 return this._tiles[e1]; 38078 } 38079 _retainLoadedChildren(e1, t1, i, s) { 38080 const r = "raster-array" === this._source.type; 38081 for(const o in this._tiles){ 38082 let n = this._tiles[o]; 38083 if (s[o] || !n.hasData() || n.tileID.overscaledZ <= t1 || n.tileID.overscaledZ > i) continue; 38084 if (r && n.parentTile) continue; 38085 let a = n.tileID; 38086 for(; n && n.tileID.overscaledZ > t1 + 1;){ 38087 const e1 = n.tileID.scaledTo(n.tileID.overscaledZ - 1); 38088 n = this._tiles[e1.key], n && n.hasData() && (a = e1); 38089 } 38090 let l = a; 38091 for(; l.overscaledZ > t1;)if (l = l.scaledTo(l.overscaledZ - 1), e1[l.key]) { 38092 s[a.key] = a; 38093 const e1 = this._tiles[a.key]; 38094 e1 && (e1.dashIdealZ = l.overscaledZ); 38095 break; 38096 } 38097 } 38098 } 38099 findLoadedParent(e1, t1) { 38100 if (e1.key in this._loadedParentTiles) { 38101 const i = this._loadedParentTiles[e1.key]; 38102 return i && i.tileID.overscaledZ >= t1 ? i : null; 38103 } 38104 for(let i = e1.overscaledZ - 1; i >= t1; i--){ 38105 const t1 = e1.scaledTo(i), s = this._getLoadedTile(t1); 38106 if (s) return s; 38107 } 38108 } 38109 _getLoadedTile(e1) { 38110 const t1 = this._tiles[e1.key]; 38111 return t1 && t1.hasData() ? t1 : this._cache.getByKey(this._source.reparseOverscaled ? e1.wrapped().key : e1.canonical.key); 38112 } 38113 updateCacheSize(e1, t1) { 38114 t1 = t1 || this._source.tileSize; 38115 const i = Math.ceil(e1.width / t1) + 1, s = Math.ceil(e1.height / t1) + 1, r = Math.floor(i * s * 5), o = "number" == typeof this._minTileCacheSize ? Math.max(this._minTileCacheSize, r) : r, n = "number" == typeof this._maxTileCacheSize ? Math.min(this._maxTileCacheSize, o) : o; 38116 this._cache.setMaxSize(n); 38117 } 38118 handleWrapJump(e1) { 38119 const t1 = Math.round((e1 - (void 0 === this._prevLng ? e1 : this._prevLng)) / 360); 38120 if (this._prevLng = e1, t1) { 38121 const e1 = {}; 38122 for(const i in this._tiles){ 38123 const s = this._tiles[i]; 38124 s.tileID = s.tileID.unwrapTo(s.tileID.wrap + t1), e1[s.tileID.key] = s; 38125 } 38126 this._tiles = e1; 38127 for(const e1 in this._timers)clearTimeout(this._timers[e1]), delete this._timers[e1]; 38128 for(const e1 in this._tiles)this._setTileReloadTimer(+e1, this._tiles[e1]); 38129 } 38130 } 38131 update(t1, i, s, r, o) { 38132 if (this.transform = t1, !this._sourceLoaded || this._paused || this.transform.freezeTileCoverage) return; 38133 if (this.usedForTerrain && !s) return; 38134 this.updateCacheSize(t1, i), "globe" !== this.transform.projection.name && this.handleWrapJump(this.transform.center.lng), this._shadowCasterTiles = {}, this._coveredTiles = {}; 38135 const n = "batched-model" === this._source.type; 38136 let a, l = this._source.maxzoom; 38137 null !== this._maxzoomOverride && (l = Math.min(l, this._maxzoomOverride)); 38138 const c = this.map && this.map.painter ? this.map.painter._terrain : null; 38139 if (c && c.sourceCache === this && c.attenuationRange()) { 38140 const e1 = c.attenuationRange()[0], t1 = Math.floor(e1) - Math.log2(c.getDemUpscale()); 38141 l > t1 && (l = t1); 38142 } 38143 const h = null === this._maxzoomOverride && this._source.reparseOverscaled; 38144 if (this.used || this.usedForTerrain) { 38145 if (this._source.tileID) a = t1.getVisibleUnwrappedCoordinates(this._source.tileID).map((t1)=>new e1.bP(t1.canonical.z, t1.wrap, t1.canonical.z, t1.canonical.x, t1.canonical.y)); 38146 else if (0 !== this.tileCoverLift) { 38147 const r = t1.clone(); 38148 r.tileCoverLift = this.tileCoverLift, a = r.coveringTiles({ 38149 tileSize: i || this._source.tileSize, 38150 minzoom: this._source.minzoom, 38151 maxzoom: l, 38152 roundZoom: this._source.roundZoom && !s, 38153 reparseOverscaled: h, 38154 isTerrainDEM: this.usedForTerrain, 38155 calculateQuadrantVisibility: n 38156 }), this._source.minzoom <= 1 && "globe" === t1.projection.name && (a.push(new e1.bP(1, 0, 1, 0, 0)), a.push(new e1.bP(1, 0, 1, 1, 0)), a.push(new e1.bP(1, 0, 1, 0, 1)), a.push(new e1.bP(1, 0, 1, 1, 1))); 38157 } else if (a = t1.coveringTiles({ 38158 tileSize: i || this._source.tileSize, 38159 minzoom: this._source.minzoom, 38160 maxzoom: l, 38161 roundZoom: this._source.roundZoom && !s, 38162 reparseOverscaled: h, 38163 isTerrainDEM: this.usedForTerrain, 38164 calculateQuadrantVisibility: n 38165 }), this._source.hasTile) { 38166 const e1 = this._source.hasTile.bind(this._source); 38167 a = a.filter((t1)=>e1(t1)); 38168 } 38169 } else a = []; 38170 if (a.length > 0 && "globe" !== this.transform.projection.name && !this.usedForTerrain && !this._supportsFading) { 38171 const e1 = t1.coveringZoomLevel({ 38172 tileSize: i || this._source.tileSize, 38173 roundZoom: this._source.roundZoom && !s 38174 }), c = Math.min(e1, l); 38175 if (n) { 38176 const e1 = t1.extendTileCover(a, c); 38177 for (const t1 of e1)a.push(t1); 38178 } else if (o) { 38179 const e1 = this.transform.getFrustum(c), i = t1.extendTileCoverToNearPlane(a, e1, c); 38180 for (const e1 of i)a.push(e1); 38181 if (c >= 18 && this._hasTunnelGeometry()) { 38182 const i = t1.extendTileCoverForTunnels(a, e1, c, 20); 38183 for (const e1 of i)a.push(e1); 38184 } 38185 } else if (this.castsShadows && r) { 38186 const e1 = t1.extendTileCover(a, c, r, 16); 38187 for (const t1 of e1)this._shadowCasterTiles[t1.key] = !0, a.push(t1); 38188 } 38189 } 38190 for(const e1 in this._tiles){ 38191 const t1 = this._tiles[e1]; 38192 t1.dashIdealZ = t1.tileID.overscaledZ; 38193 } 38194 const d = this._updateRetainedTiles(a); 38195 if (this._supportsFading && 0 !== a.length) { 38196 const t1 = {}, i = {}, s = e1.e.now(), r = Object.keys(d); 38197 for (const e1 of r){ 38198 const r = d[e1], o = this._tiles[e1]; 38199 if (!o || void 0 !== o.fadeEndTime && o.fadeEndTime <= s) continue; 38200 const n = this.findLoadedParent(r, Math.max(r.overscaledZ - gs.maxOverzooming, this._source.minzoom)); 38201 n && (this._addTile(n.tileID), t1[n.tileID.key] = n.tileID), i[e1] = r; 38202 } 38203 const o = a.at(-1).overscaledZ; 38204 for(const e1 in this._tiles){ 38205 const t1 = this._tiles[e1]; 38206 if (d[e1] || !t1.hasData()) continue; 38207 let s = t1.tileID; 38208 for(; s.overscaledZ > o;){ 38209 s = s.scaledTo(s.overscaledZ - 1); 38210 const r = this._tiles[s.key]; 38211 if (r && r.hasData() && i[s.key]) { 38212 d[e1] = t1.tileID; 38213 break; 38214 } 38215 } 38216 } 38217 for(const e1 in t1)d[e1] || (this._coveredTiles[e1] = !0, d[e1] = t1[e1]); 38218 } 38219 for(const e1 in d)this._tiles[e1].clearFadeHold(); 38220 const u = e1.bQ(this._tiles, d); 38221 for (const e1 of u){ 38222 const t1 = this._tiles[e1]; 38223 t1.hasSymbolBuckets && !t1.holdingForFade() ? t1.setHoldDuration(this.map._fadeDuration) : t1.hasSymbolBuckets && !t1.symbolFadeFinished() || this._removeTile(+e1); 38224 } 38225 this._updateLoadedParentTileCache(), this._renderSourceType === e1.bR.Symbol && this._source.afterUpdate && this._source.afterUpdate(); 38226 } 38227 releaseSymbolFadeTiles() { 38228 for(const e1 in this._tiles)this._tiles[e1].holdingForFade() && this._removeTile(+e1); 38229 } 38230 _updateRetainedTiles(e1) { 38231 const t1 = {}; 38232 if (0 === e1.length) return t1; 38233 const i = {}, s = e1.reduce((e1, t1)=>Math.min(e1, t1.overscaledZ), 1 / 0), r = e1[0].overscaledZ, o = Math.max(r - gs.maxOverzooming, this._source.minzoom), n = Math.max(r + gs.maxUnderzooming, this._source.minzoom), a = {}; 38234 for (const i of e1){ 38235 const e1 = this._addTile(i); 38236 t1[i.key] = i, e1.hasData() || s < this._source.maxzoom && (a[i.key] = i); 38237 } 38238 if (this._retainLoadedChildren(a, s, n, t1), "raster-array" === this._source.type) { 38239 const i = this._source, s = this._tiles; 38240 for (const r of i.collectOverzoomParentTileIDs(s, e1))t1[r.key] = r; 38241 } 38242 for (const s of e1){ 38243 let e1 = this._tiles[s.key]; 38244 if (e1.hasData()) continue; 38245 if (s.canonical.z >= this._source.maxzoom) { 38246 const e1 = s.children(this._source.maxzoom)[0], i = this.getTile(e1); 38247 if (i && i.hasData()) { 38248 t1[e1.key] = e1, i.dashIdealZ = s.overscaledZ; 38249 continue; 38250 } 38251 } else { 38252 const e1 = s.children(this._source.maxzoom); 38253 if (t1[e1[0].key] && t1[e1[1].key] && t1[e1[2].key] && t1[e1[3].key]) continue; 38254 } 38255 let r = e1.wasRequested(); 38256 for(let n = s.overscaledZ - 1; n >= o; --n){ 38257 const o = s.scaledTo(n); 38258 if (i[o.key]) break; 38259 if (i[o.key] = !0, e1 = this.getTile(o), !e1 && r && (e1 = this._addTile(o)), e1 && (t1[o.key] = o, e1.dashIdealZ = s.overscaledZ, r = e1.wasRequested(), e1.hasData())) break; 38260 } 38261 } 38262 return t1; 38263 } 38264 _updateLoadedParentTileCache() { 38265 this._loadedParentTiles = {}; 38266 for(const e1 in this._tiles){ 38267 const t1 = []; 38268 let i, s = this._tiles[e1].tileID; 38269 for(; s.overscaledZ > 0;){ 38270 if (s.key in this._loadedParentTiles) { 38271 i = this._loadedParentTiles[s.key]; 38272 break; 38273 } 38274 t1.push(s.key); 38275 const e1 = s.scaledTo(s.overscaledZ - 1); 38276 if (i = this._getLoadedTile(e1), i) break; 38277 s = e1; 38278 } 38279 for (const e1 of t1)this._loadedParentTiles[e1] = i; 38280 } 38281 } 38282 _addTile(t1) { 38283 let i = this._tiles[t1.key]; 38284 if (i) return !0 !== i.isExtraShadowCaster || !!this._shadowCasterTiles[t1.key] || this._reloadTile(t1.key, "reloading"), i; 38285 i = this._cache.getAndRemove(t1), i && (this._setTileReloadTimer(t1.key, i), i.tileID = t1, this._state.initializeTileState(i, this.map ? this.map.painter : null), this._cacheTimers[t1.key] && (clearTimeout(this._cacheTimers[t1.key]), delete this._cacheTimers[t1.key], this._setTileReloadTimer(t1.key, i))); 38286 const s = Boolean(i); 38287 if (!s) { 38288 const e1 = this.map ? this.map.painter : null, s = this._source.tileSize * t1.overscaleFactor(); 38289 i = "raster-array" === this._source.type ? function(e1, t1, i, s, r) { 38290 if (!us) throw new Error("Raster-array module is not loaded."); 38291 return us(e1, t1, i, s, r); 38292 }(t1, s, this.transform.tileZoom, e1, this._isRaster) : new fs(t1, s, this.transform.tileZoom, e1, this._isRaster, this._source.worldview), this._loadTile(i, this._tileLoaded.bind(this, i, t1.key, i.state)); 38293 } 38294 return i.uses++, this._tiles[t1.key] = i, s || this._source.fire(new e1.h("dataloading", { 38295 tile: i, 38296 coord: i.tileID, 38297 dataType: "source" 38298 })), i; 38299 } 38300 _setTileReloadTimer(e1, t1) { 38301 e1 in this._timers && (clearTimeout(this._timers[e1]), delete this._timers[e1]); 38302 const i = t1.getExpiryTimeout(); 38303 i && (this._timers[e1] = setTimeout(()=>{ 38304 this._reloadTile(e1, "expired"), delete this._timers[e1]; 38305 }, i)); 38306 } 38307 _removeTile(e1) { 38308 const t1 = this._tiles[e1]; 38309 t1 && (t1.uses--, delete this._tiles[e1], this._timers[e1] && (clearTimeout(this._timers[e1]), delete this._timers[e1]), t1.uses > 0 || (t1.hasData() && "reloading" !== t1.state || "empty" === t1.state ? this._cache.add(t1.tileID, t1, t1.getExpiryTimeout()) : (t1.aborted = !0, this._abortTile(t1), this._unloadTile(t1)))); 38310 } 38311 clearTiles() { 38312 this._shouldReloadOnResume = !1, this._paused = !1; 38313 for(const e1 in this._tiles)this._removeTile(+e1); 38314 this._source._clear && this._source._clear(), this._cache.reset(), this.map && this.usedForTerrain && this.map.painter.terrain && this.map.painter.terrain.resetTileLookupCache(this.id); 38315 } 38316 tilesIn(t1, i, s) { 38317 const r = [], o = this.transform; 38318 if (!o) return r; 38319 const n = "globe" === o.projection.name, a = e1.a7(o.center.lng), l = o.getFreeCameraOptions().position || new e1.bS(0, 0, 0); 38320 for(const c in this._tiles){ 38321 const h = this._tiles[c]; 38322 if (s && h.clearQueryDebugViz(), h.holdingForFade()) continue; 38323 let d; 38324 if (n) { 38325 const t1 = h.tileID.canonical; 38326 if (0 === t1.z) { 38327 const i = [ 38328 Math.abs(e1.b0(a, ...vs(t1, -1)) - a), 38329 Math.abs(e1.b0(a, ...vs(t1, 1)) - a) 38330 ]; 38331 d = [ 38332 0, 38333 2 * i.indexOf(Math.min(...i)) - 1 38334 ]; 38335 } else { 38336 const i = [ 38337 Math.abs(e1.b0(a, ...vs(t1, -1)) - a), 38338 Math.abs(e1.b0(a, ...vs(t1, 0)) - a), 38339 Math.abs(e1.b0(a, ...vs(t1, 1)) - a) 38340 ]; 38341 d = [ 38342 i.indexOf(Math.min(...i)) - 1 38343 ]; 38344 } 38345 } else d = [ 38346 0 38347 ]; 38348 for (const e1 of d){ 38349 const s = t1.containsTile(h, o, i, e1, l); 38350 s && r.push(s); 38351 } 38352 } 38353 return r; 38354 } 38355 getShadowCasterCoordinates() { 38356 return this._getRenderableCoordinates(!1, !0); 38357 } 38358 getVisibleCoordinates(e1) { 38359 return this._getRenderableCoordinates(e1); 38360 } 38361 _getRenderableCoordinates(e1, t1) { 38362 if (!this.transform) return []; 38363 const i = this.getRenderableIds(e1, t1).map((e1)=>this._tiles[e1].tileID), s = "globe" === this.transform.projection.name; 38364 for (const e1 of i)e1.projMatrix = this.transform.calculateProjMatrix(e1.toUnwrapped()), e1.expandedProjMatrix = s ? this.transform.calculateProjMatrix(e1.toUnwrapped(), !1, !0) : e1.projMatrix; 38365 return i; 38366 } 38367 sortCoordinatesByDistance(e1) { 38368 if (!this.transform) return e1.slice(); 38369 const t1 = e1.slice(), i = this.transform._camera.position, s = this.transform._camera.forward(), r = {}; 38370 for (const e1 of t1){ 38371 const t1 = 1 / (1 << e1.canonical.z); 38372 r[e1.key] = ((e1.canonical.x + .5) * t1 + e1.wrap - i[0]) * s[0] + ((e1.canonical.y + .5) * t1 - i[1]) * s[1] - i[2] * s[2]; 38373 } 38374 return t1.sort((e1, t1)=>r[e1.key] - r[t1.key]), t1; 38375 } 38376 hasTransition() { 38377 if (this._source.hasTransition()) return !0; 38378 if (this._supportsFading) { 38379 const t1 = e1.e.now(); 38380 for(const e1 in this._tiles){ 38381 const i = this._tiles[e1]; 38382 if (void 0 !== i.fadeEndTime && i.fadeEndTime >= t1) return !0; 38383 } 38384 } 38385 return !1; 38386 } 38387 setFeatureState(e1, t1, i) { 38388 this._state.updateState(e1 = e1 || "_geojsonTileLayer", t1, i); 38389 } 38390 removeFeatureState(e1, t1, i) { 38391 this._state.removeFeatureState(e1 = e1 || "_geojsonTileLayer", t1, i); 38392 } 38393 getFeatureState(e1, t1) { 38394 return this._state.getState(e1 = e1 || "_geojsonTileLayer", t1); 38395 } 38396 setDependencies(e1, t1, i) { 38397 const s = this._tiles[e1]; 38398 s && s.setDependencies(t1, i); 38399 } 38400 reloadTilesForDependencies(e1, t1) { 38401 for(const i in this._tiles)this._tiles[i].hasDependency(e1, t1) && this._reloadTile(+i, "reloading"); 38402 this._cache.filter((i)=>!i.hasDependency(e1, t1)); 38403 } 38404 _preloadTiles(t1, i) { 38405 if (!this._sourceLoaded) { 38406 const e1 = ()=>{ 38407 this._sourceLoaded && (this._source.off("data", e1), this._preloadTiles(t1, i)); 38408 }; 38409 return void this._source.on("data", e1); 38410 } 38411 const s = new Map, r = Array.isArray(t1) ? t1 : [ 38412 t1 38413 ], o = this.map.painter.terrain, n = this.usedForTerrain && o ? o.getScaledDemTileSize() : this._source.tileSize; 38414 for (const e1 of r){ 38415 const t1 = e1.coveringTiles({ 38416 tileSize: n, 38417 minzoom: this._source.minzoom, 38418 maxzoom: this._source.maxzoom, 38419 roundZoom: this._source.roundZoom && !this.usedForTerrain, 38420 reparseOverscaled: this._source.reparseOverscaled, 38421 isTerrainDEM: this.usedForTerrain 38422 }); 38423 for (const e1 of t1)s.set(e1.key, e1); 38424 this.usedForTerrain && e1.updateElevation(!1); 38425 } 38426 const a = Array.from(s.values()); 38427 e1.bT(a, (e1, t1)=>{ 38428 const i = new fs(e1, this._source.tileSize * e1.overscaleFactor(), this.transform.tileZoom, this.map.painter, this._isRaster, this._source.w
38428orldview); 38429 this._loadTile(i, (e1)=>{ 38430 "raster-dem" === this._source.type && i.dem && this._backfillDEM(i), t1(e1, i); 38431 }); 38432 }, i); 38433 } 38434 constructor(e1, t1, i){ 38435 super(), this.id = e1, this._renderSourceType = i, this._maxzoomOverride = null, this.setSource(t1), this._tiles = {}, this._cache = new ms(0, this._unloadTile.bind(this)), this._timers = {}, this._cacheTimers = {}, this._minTileCacheSize = t1.minTileCacheSize, this._maxTileCacheSize = t1.maxTileCacheSize, this._loadedParentTiles = {}, this.castsShadows = !1, this.tileCoverLift = 0, this._coveredTiles = {}, this._shadowCasterTiles = {}, this._state = new _s, this._isRaster = "raster" === this._source.type || "raster-dem" === this._source.type || "raster-array" === this._source.type || "custom" === this._source.type && "_dataType" in this._source && "raster" === this._source._dataType, this._supportsFading = "raster" === this._source.type || "raster-array" === this._source.type || "image" === this._source.type || "video" === this._source.type || "custom" === this._source.type, this._isRasterElevatedOverTerrain = !1; 38436 } 38437 } 38438 function ys(e1, t1) { 38439 const i = Math.abs(2 * e1.wrap) - +(e1.wrap < 0), s = Math.abs(2 * t1.wrap) - +(t1.wrap < 0); 38440 return e1.overscaledZ - t1.overscaledZ || s - i || t1.canonical.y - e1.canonical.y || t1.canonical.x - e1.canonical.x; 38441 } 38442 function vs(e1, t1) { 38443 const i = 1 << e1.z; 38444 return [ 38445 e1.x / i + t1, 38446 (e1.x + 1) / i + t1 38447 ]; 38448 } 38449 function bs(e1, t1) { 38450 if (e1.z <= t1.z) { 38451 const i = t1.z - e1.z; 38452 return t1.x >> i === e1.x && t1.y >> i === e1.y; 38453 } 38454 const i = e1.z - t1.z; 38455 return e1.x >> i === t1.x && e1.y >> i === t1.y; 38456 } 38457 function xs(e1, t1) { 38458 return e1.sourceFQID !== t1.sourceFQID ? e1.sourceFQID < t1.sourceFQID ? -1 : 1 : e1.tileId.z !== t1.tileId.z ? e1.tileId.z - t1.tileId.z : e1.tileId.x !== t1.tileId.x ? e1.tileId.x - t1.tileId.x : e1.tileId.y - t1.tileId.y; 38459 } 38460 gs.maxOverzooming = 10, gs.maxUnderzooming = 3; 38461 class ws { 38462 getTilesIntersecting(e1) { 38463 const t1 = []; 38464 for (const i of this.tiles)bs(i.tileId, e1) && t1.push(i); 38465 return t1; 38466 } 38467 equals(e1) { 38468 if (this.tiles.length !== e1.length) return !1; 38469 for(let t1 = 0; t1 < this.tiles.length; ++t1){ 38470 const i = this.tiles[t1], s = e1[t1]; 38471 if (i.sourceFQID !== s.sourceFQID || i.tileId.z !== s.tileId.z || i.tileId.x !== s.tileId.x || i.tileId.y !== s.tileId.y || i.generation !== s.generation) return !1; 38472 } 38473 return !0; 38474 } 38475 empty() { 38476 return 0 === this.tiles.length; 38477 } 38478 constructor(e1 = []){ 38479 this.tiles = e1; 38480 } 38481 } 38482 class Ts { 38483 clear() { 38484 this._tiles.length = 0; 38485 } 38486 consumeSnapshotChanged() { 38487 const e1 = this._snapshotChanged; 38488 return this._snapshotChanged = !1, e1; 38489 } 38490 addTileElevation(e1, t1, i, s) { 38491 this._tiles.push({ 38492 sourceFQID: e1, 38493 tileId: t1,
38494 features: i, 38495 generation: s 38496 }); 38497 } 38498 updateSnapshotIfNeeded() { 38499 return this._tiles.sort(xs), this._snapshot.equals(this._tiles) || (this._snapshot = new ws(this._tiles.slice()), this._snapshotChanged = !0), this._snapshot; 38500 } 38501 constructor(){ 38502 this._tiles = [], this._snapshot = new ws, this._snapshotChanged = !1; 38503 } 38504 } 38505 function Ss(e1, t1) { 38506 const i = []; 38507 for (const s of e1.getTilesIntersecting(t1))i.push("".concat(s.tileId.z, "/").concat(s.tileId.x, "/").concat(s.tileId.y, ":").concat(s.generation)); 38508 return i.sort(), i.join("|"); 38509 } 38510 function Cs(t1, i) { 38511 const s = e1.bW(t1); 38512 return s === i || !s && !i; 38513 } 38514 function Es(e1, t1) { 38515 return e1._mergedOtherSourceCaches[t1] || e1._mergedSymbolSourceCaches[t1] || e1._mergedHdRoadElevationSourceCaches[t1]; 38516 } 38517 function Is(e1) { 38518 const t1 = e1.sourceLayer; 38519 return !!t1 && t1.startsWith("hd_road_"); 38520 } 38521 function Ds(e1) { 38522 return !!e1.layout && ("line" === e1.type && "hd-road-markup" === e1.layout.get("line-elevation-reference") || "circle" === e1.type && "hd-road-markup" === e1.layout.get("circle-elevation-reference") || "symbol" === e1.type && "hd-road-markup" === e1.layout.get("symbol-elevation-reference") || "fill" === e1.type && "hd-road-markup" === e1.layout.get("fill-elevation-reference")); 38523 } 38524 function Ps(t1) { 38525 const i = new Set; 38526 for(const s in t1._mergedLayers){ 38527 const r = t1._mergedLayers[s]; 38528 Ds(r) && i.add(e1.m(r.source, r.scope)); 38529 } 38530 return i; 38531 } 38532 function Ls(t1) { 38533 const i = Ps(t1), s = new Set; 38534 for(const r in t1._mergedLayers){ 38535 const o = t1._mergedLayers[r]; 38536 if (!o.source || !Is(o)) continue; 38537 const n = e1.m(o.source, o.scope); 38538 i.has(n) || s.add(n); 38539 } 38540 return s; 38541 } 38542 function Rs(e1) { 38543 const t1 = Ps(e1); 38544 if (0 === t1.size) return !1; 38545 const i = As(e1); 38546 for (const e1 of t1)for (const t1 of i)if (e1 !== t1) return !0; 38547 return !1; 38548 } 38549 function As(t1) { 38550 const i = new Set; 38551 for(const s in t1._mergedLayers){ 38552 const r = t1._mergedLayers[s]; 38553 r.source && Is(r) && i.add(e1.m(r.source, r.scope)); 38554 } 38555 return i; 38556 } 38557 function Ms(e1, t1, i) { 38558 const s = Ps(e1); 38559 if (0 === s.size) return; 38560 if (!i) { 38561 const t1 = As(e1); 38562 for (const e1 of t1)s.delete(e1); 38563 } 38564 if (0 === s.size) return; 38565 const r = [ 38566 e1._mergedOtherSourceCaches, 38567 e1._mergedSymbolSourceCaches 38568 ]; 38569 for (const e1 of r)for(const i in e1){ 38570 if (!s.has(i)) continue; 38571 const r = e1[i]; 38572 for(const e1 in r._tiles){ 38573 const i = r._tiles[e1]; 38574 i && (t1 && !t1(i) || (i.hasDeferredElevationFeatures = !1, r._reloadTile(+e1, "reloading"))); 38575 } 38576 } 38577 } 38578 class Os { 38579 constructor(){ 38580 this.elevationSourceCaches = {}, this.manager = new Ts, this._needsCrossSourceElevation = !1, this._ingestFQIDs = new Set, this._terrainActiveLast = void 0; 38581 } 38582 } 38583 function Fs(e1) { 38584 e1.map && e1.map.painter && (e1.map.painter.elevationCoverageSnapshot = null, e1.map.painter.elevationProvidersReady = void 0); 38585 } 38586 function ks(e1) { 38587 e1._crossSourceElevationActive = !1, function(e1) { 38588 const t1 = e1._hdElevation, i = !!(e1.map && e1.map.painter && e1.map.painter.elevationCoverageSnapshot); 38589 return t1 ? !t1._needsCrossSourceElevation && 0 === t1._ingestFQIDs.size && 0 === t1.manager._tiles.length && !i : !i; 38590 }(e1) || (Fs(e1), e1._hdElevation && (e1._hdElevation._needsCrossSourceElevation = !1, e1._hdElevation._ingestFQIDs.clear(), e1._hdElevation.manager.clear(), e1._hdElevation._terrainActiveLast = void 0)); 38591 } 38592 function Bs(t1, i, s) { 38593 const r = e1.m(s.id, t1.scope); 38594 if (i.elevationSourceCaches[r]) return; 38595 const o = "hd-road-elevation:".concat(s.id), n = e1.m(o, t1.scope), a = t1._sourceCaches[o] = new gs(n, s, e1.bR.HdRoadElevation); 38596 i.elevationSourceCaches[r] = a, a.onAdd(t1.map); 38597 const l = t1._otherSourceCaches[s.id]; 38598 l && l._sourceLoaded && (a._sourceLoaded = !0); 38599 } 38600 function zs(e1, t1) { 38601 if (Gt(e1, e1.map && e1.map.transform)) return t1.manager.clear(), void (e1.map.painter && (e1.map.painter.elevationCoverageSnapshot = null)); 38602 if (!t1._needsCrossSourceElevation) return void Fs(e1); 38603 for (const i of t1._ingestFQIDs){ 38604 const t1 = Es(e1, i); 38605 t1 && (t1.used = !0); 38606 } 38607 t1.manager.clear(); 38608 let i = !0; 38609 for (const s of t1._ingestFQIDs){ 38610 const r = Es(e1, s); 38611 if (!r) continue; 38612 const o = r._tiles; 38613 for(const e1 in o){ 38614 const r = o[e1]; 38615 if (!r || !r.loaded()) continue; 38616 const n = r.parsedElevationFeatures; 38617 void 0 !== n ? t1.manager.addTileElevation(s, r.tileID.canonical, n, r.parsedElevationGeneration) : i = !1; 38618 } 38619 } 38620 const s = t1.manager._snapshot, r = t1.manager.updateSnapshotIfNeeded(); 38621 e1.map.painter && (e1.map.painter.elevationCoverageSnapshot = r.empty() ? null : r); 38622 const o = i && function(e1, t1) { 38623 for (const i of t1){ 38624 const t1 = Es(e1, i); 38625 if (!t1) return !1; 38626 if (!t1._sourceLoaded) return !1; 38627 for(const e1 in t1._tiles){ 38628 const i = t1._tiles[e1]; 38629 if (i && ("loading" === i.state || "reloading" === i.state)) return !1; 38630 } 38631 } 38632 return !0; 38633 }(e1, Ls(e1)); 38634 e1.map.painter && (e1.map.painter.elevationProvidersReady = o); 38635 const n = t1.manager.consumeSnapshotChanged(); 38636 (n || o) && Ms(e1, (e1)=>{ 38637 return !!e1.hasDeferredElevationFeatures || n && (t1 = r, Ss(s, i = e1.tileID.canonical) !== Ss(t1, i)); 38638 //TURBOPACK unreachable 38639 ; 38640 var t1, i; 38641 }); 38642 } 38643 const Us = (e1)=>({ 38644 u_matrix: e1 38645 }); 38646 function Ns(t1, i) { 38647 const s = t1.context.gl; 38648 return new e1._({ 38649 func: s.EQUAL, 38650 mask: 255 38651 }, t1._tileClippingMaskIDs[i.key] || 0, 0, s.KEEP, s.KEEP, s.KEEP); 38652 } 38653 function js(t1, i) { 38654 const s = t1.context.gl; 38655 return new e1._({ 38656 func: s.EQUAL, 38657 mask: 255 38658 }, 255 & ~(t1._tileClippingMaskIDs[i.key] || 0), 0, s.KEEP, s.KEEP, s.KEEP); 38659 } 38660 function Vs(t1, i) { 38661 if (!t1.frcCoverageSnapshot || !t1.frcCoverageRenderer) return null; 38662 const s = t1.frcCoverageSnapshot.getTileOrParent(i.canonical); 38663 if (!s || 0 === s.frcMask) return null; 38664 const r = t1.frcCoverageRenderer.getBuffers(s.tileId); 38665 if (!r) return null; 38666 const o = new e1.bX(s.tileId.z, s.tileId.x, s.tileId.y), n = new e1.bY(i.wrap, o); 38667 return { 38668 buffers: r, 38669 projMatrix: t1.transform.calculateProjMatrix(n), 38670 coverageTile: s 38671 }; 38672 } 38673 function Gs(t1, i, s) { 38674 if (!t1.frcCoverageSnapshot) return; 38675 const r = t1.context, o = r.gl, n = t1.getOrCreateProgram("clippingMask"); 38676 r.setColorMode(e1.a1.disabled), r.setDepthMode(e1.Z.disabled); 38677 for (const r of i){ 38678 const i = Vs(t1, r); 38679 if (!i) continue; 38680 const a = i.buffers.frcLevelSegments[s]; 38681 a && n.draw(t1, o.TRIANGLES, e1.Z.disabled, new e1._({ 38682 func: o.EQUAL, 38683 mask: 255 38684 }, t1._tileClippingMaskIDs[r.key] || 0, 255, o.KEEP, o.KEEP, o.INVERT), e1.a1.disabled, e1.$.disabled, Us(i.projMatrix), "$frc_coverage_".concat(s), i.buffers.vertexBuffer, i.buffers.indexBuffer, a); 38685 } 38686 } 38687 function qs(t1, i, s) { 38688 if (!t1.frcCoverageSnapshot) return; 38689 const r = t1.context, o = r.gl, n = t1.getOrCreateProgram("clippingMask"); 38690 r.setColorMode(e1.a1.disabled), r.setDepthMode(e1.Z.disabled); 38691 for (const r of i){ 38692 const i = Vs(t1, r); 38693 if (!i) continue; 38694 const a = i.buffers.frcLevelSegments[s]; 38695 a && n.draw(t1, o.TRIANGLES, e1.Z.disabled, new e1._({ 38696 func: o.EQUAL, 38697 mask: 255 38698 }, 255 & ~(t1._tileClippingMaskIDs[r.key] || 0), 255, o.KEEP, o.KEEP, o.INVERT), e1.a1.disabled, e1.$.disabled, Us(i.projMatrix), "$frc_coverage_restore_".concat(s), i.buffers.vertexBuffer, i.buffers.indexBuffer, a); 38699 } 38700 } 38701 function Zs(e1, t1, i, s, r) { 38702 if (0 === t1.length) return; 38703 let o = 0; 38704 for (const e1 of t1)o |= e1.frcMask; 38705 const n = t1.map((e1)=>e1.coord); 38706 for(let a = 0; a < 9; ++a)if (o & 1 << a) { 38707 if (Gs(e1, n, a), s) for (const i of t1)i.frcMask & 1 << a && s(i, a, Ns(e1, i.coord)); 38708 if (i > 0 && r) for (const i of t1)i.frcMask & 1 << a && r(i, a, js(e1, i.coord)); 38709 qs(e1, n, a); 38710 } 38711 } 38712 function $s(e1) { 38713 for (const t1 of e1)if (t1.rings.length > 0 && t1.rings[0].length > 0) return !0; 38714 return !1; 38715 } 38716 function Hs(e1) { 38717 const t1 = e1.frcCoverageFadeRange; 38718 return !t1 || t1[1] <= t1[0] ? 0 : 1 - Math.max(0, Math.min(1, (e1.transform.zoom - t1[0]) / (t1[1] - t1[0]))); 38719 } 38720 const Ws = { 38721 loaded: !0, 38722 drawBuilding: function(t1, i, s, r) { 38723 t1.currentLayer < t1.firstLightBeamLayer && (t1.firstLightBeamLayer = t1.currentLayer); 38724 const o = s.paint.get("building-ambient-occlusion-ground-intensity"), n = s.paint.get("building-ambient-occlusion-ground-radius"), a = s.paint.get("building-ambient-occlusion-ground-attenuation"), l = s.paint.get("building-opacity"); 38725 if (l <= 0) return; 38726 let c = o > 0 && n > 0, h = !0; 38727 const d = s.paint.get("building-vertical-scale"); 38728 if (d <= 0) return; 38729 t1.shadowRenderer || (h = !1); 38730 const u = t1.conflationActive && t1.style.isLayerClipped(s, i.getSource()), p = t1.style.order.indexOf(s.fqid); 38731 if (function(e1, t1, i, s, r, o) { 38732 for (const n of o){ 38733 const o = t1.getTile(n).getBucket(i); 38734 o && (r && o.updateReplacement(n, e1.replacementSource, s), o.uploadUpdatedIndexBuffer(e1.context)); 38735 } 38736 }(t1, i, s, p, u, r), function(e1, t1, i, s) { 38737 for (const r of s){ 38738 const s = t1.getTile(r).getBucket(i); 38739 s && s.needsEvaluation() && s.uploadUpdatedColorBuffer(e1.context); 38740 } 38741 }(t1, i, s, r), s.resetLayerRenderingStats(t1), t1.shadowRenderer && (t1.shadowRenderer.useNormalOffset = !0), "shadow" === t1.renderPass && t1.shadowRenderer) { 38742 const o = [], n = t1.shadowRenderer.getShadowPassDepthMode(); 38743 xi({ 38744 painter: t1, 38745 source: i, 38746 layer: s, 38747 coords: r, 38748 defines: o, 38749 blendMode: e1.a1.disabled, 38750 depthMode: n, 38751 opacity: l, 38752 verticalScale: d, 38753 facadeEmissiveChance: 0, 38754 facadeAOIntensity: 0, 38755 floodLightIntensity: 0, 38756 floodLightColor: [ 38757 0, 38758 0, 38759 0 38760 ] 38761 }); 38762 } else if ("translucent" === t1.renderPass) { 38763 let p = [ 38764 "HAS_ATTRIBUTE_a_part_color_emissive", 38765 "LIGHTING_3D_MODE" 38766 ]; 38767 h && (p = p.concat("RENDER_SHADOWS")), t1.shadowRenderer && t1.shadowRenderer.useNormalOffset && (p = p.concat("NORMAL_OFFSET")); 38768 const f = s.paint.get("building-facade-emissive-chance"), m = s.paint.get("building-ambient-occlusion-intensity"), _ = s.paint.get("building-flood-light-intensity"), g = "none" === s.paint.get("building-flood-light-color-use-theme").
vendor: 51,828 bytes, lines 38768-39637
38768constantOr("default"), y = s.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(g ? null : s.lut).toArray01().slice(0, 3), v = s.paint.get("building-flood-light-ground-attenuation"), b = _ > 0, x = new e1.Z(t1.context.gl.LEQUAL, e1.Z.ReadWrite, t1.depthRangeFor3D); 38769 l < 1 && xi({ 38770 painter: t1, 38771 source: i, 38772 layer: s, 38773 coords: r, 38774 defines: p, 38775 blendMode: e1.a1.disabled, 38776 depthMode: x, 38777 opacity: l, 38778 verticalScale: d, 38779 facadeEmissiveChance: f, 38780 facadeAOIntensity: m, 38781 floodLightIntensity: _, 38782 floodLightColor: y, 38783 depthOnly: !0 38784 }); 38785 const w = t1.colorModeForRenderPass(); 38786 xi({ 38787 painter: t1, 38788 source: i, 38789 layer: s, 38790 coords: r, 38791 defines: p, 38792 blendMode: w, 38793 depthMode: x, 38794 opacity: l, 38795 verticalScale: d, 38796 facadeEmissiveChance: f, 38797 facadeAOIntensity: m, 38798 floodLightIntensity: _, 38799 floodLightColor: y 38800 }); 38801 const T = s.paint.get("building-front-cutoff"); 38802 pi(t1.transform.pitch, T, !!t1.terrain), c && wi(t1, i, s, r, !0, l, o, n, _, y, a, u), b && wi(t1, i, s, r, !1, l, o, n, _, y, v, u); 38803 } else if ("light-beam" === t1.renderPass) { 38804 const o = [ 38805 "HAS_ATTRIBUTE_a_part_color_emissive", 38806 "HAS_ATTRIBUTE_a_bloom_attenuation" 38807 ], n = new e1.Z(t1.context.gl.LEQUAL, e1.Z.ReadOnly, t1.depthRangeFor3D); 38808 xi({ 38809 painter: t1, 38810 source: i, 38811 layer: s, 38812 coords: r, 38813 defines: o, 38814 blendMode: e1.a1.alphaBlended, 38815 depthMode: n, 38816 opacity: l, 38817 verticalScale: d, 38818 facadeEmissiveChance: 0, 38819 facadeAOIntensity: 0, 38820 floodLightIntensity: 0, 38821 floodLightColor: [ 38822 0, 38823 0, 38824 0 38825 ] 38826 }); 38827 } 38828 t1.shadowRenderer && (t1.shadowRenderer.useNormalOffset = !1), t1.resetStencilClippingMasks(); 38829 }, 38830 BuildingTileBorderManager: class { 38831 updateBorders(t1, i) { 38832 const s = [], r = [], o = t1._getRenderableCoordinates(!1, !0); 38833 for (const e1 of o){ 38834 const o = t1.getTile(e1); 38835 if (!o.hasData()) continue; 38836 const n = o.getBucket(i); 38837 n && (n.isEmpty() || (s.push(e1.key), r.push({ 38838 bucket: n, 38839 tileID: e1.canonical 38840 }))); 38841 } 38842 let n = s.length !== this.visibleTiles.length; 38843 if (!n) { 38844 s.sort(); 38845 for(let e1 = 0; e1 < s.length; e1++)if (s[e1] !== this.visibleTiles[e1]) { 38846 n = !0; 38847 break; 38848 } 38849 } 38850 if (!n) return; 38851 const a = new Set; 38852 this.visibleTiles = s, r.sort((e1, t1)=>e1.tileID.z - t1.tileID.z || e1.tileID.x - t1.tileID.x || e1.tileID.y - t1.tileID.y); 38853 for (const t1 of r){ 38854 const i = new Array, s = new Array, r = t1.bucket; 38855 for (const t1 of r.featuresOnBorder)r.footprints[t1.footprintIndex].hiddenFlags & e1.aR || (a.has(t1.featureId) ? s.push(t1.footprintIndex) : (a.add(t1.featureId), i.push(t1.footprintIndex))); 38856 r.updateFootprintHiddenFlags(i, e1.aS, !1), r.updateFootprintHiddenFlags(s, e1.aS, !0); 38857 } 38858 } 38859 constructor(){ 38860 this.visibleTiles = []; 38861 } 38862 }, 38863 drawRasterParticle: function(t1, i, s, r, o, n) { 38864 "offscreen" === t1.renderPass && function(t1, i, s, r) { 38865 if (!r.length) return; 38866 const o = t1.context, n = o.gl, a = i.getSource(); 38867 if ("raster-array" !== a.type) return; 38868 const l = Math.ceil(Math.sqrt(s.paint.get("raster-particle-count"))); 38869 let c = s.particlePositionRGBAImage; 38870 if (!c || c.width !== l) { 38871 const t1 = function(t1) { 38872 const i = t1 * t1, s = new Uint8Array(4 * i), r = .9090909090909091; 38873 for(let t1 = 0; t1 < i; t1++){ 38874 const i = r * (e1.b8(2 * t1 + 0) + Si), o = r * (e1.b8(2 * t1 + 1) + Si), n = 255 * i % 1, a = 255 * o % 1, l = n, c = o - a / 255, h = a; 38875 s[4 * t1 + 0] = 255 * (i - n / 255), s[4 * t1 + 1] = 255 * l, s[4 * t1 + 2] = 255 * c, s[4 * t1 + 3] = 255 * h; 38876 } 38877 return s; 38878 }(l); 38879 c = s.particlePositionRGBAImage = new e1.b({ 38880 width: l, 38881 height: l 38882 }, t1); 38883 } 38884 let h = s.particleFramebuffer; 38885 h ? h.width !== l && (h.destroy(), h = s.particleFramebuffer = o.createFramebuffer(l, l, 1, null)) : h = s.particleFramebuffer = o.createFramebuffer(l, l, 1, null); 38886 const d = []; 38887 for (const e1 of r){ 38888 const t1 = i.getTile(e1); 38889 if (!t1) continue; 38890 const r = Mi(t1, a, s); 38891 if (!r) continue; 38892 const n = [ 38893 t1.tileSize, 38894 t1.tileSize 38895 ]; 38896 let h = s.tileFramebuffer; 38897 h || (h = s.tileFramebuffer = o.createFramebuffer(n[0], n[1], 1, null)); 38898 let u = t1.rasterParticleState; 38899 u || (u = t1.rasterParticleState = new Ri(o, e1, n, c)); 38900 const p = u.update(s.lastInvalidatedAt); 38901 u.particleTextureDimension !== l && u.updateParticleTexture(e1, c); 38902 const f = u.targetColorTexture; 38903 u.targetColorTexture = u.backgroundColorTexture, u.backgroundColorTexture = f; 38904 const m = u.particleTexture0; 38905 u.particleTexture0 = u.particleTexture1, u.particleTexture1 = m, d.push([ 38906 e1, 38907 r, 38908 u, 38909 p 38910 ]); 38911 } 38912 if (0 === d.length) return; 38913 const u = e1.e.now(), p = s.previousDrawTimestamp ? .001 * (u - s.previousDrawTimestamp) : .0167; 38914 if (s.previousDrawTimestamp = u, s.hasColorMap()) { 38915 o.activeTexture.set(n.TEXTURE0 + 2); 38916 let t1 = s.colorRampTexture; 38917 t1 || (t1 = s.colorRampTexture = new e1.T(o, s.colorRamp, n.RGBA8)), t1.bind(n.LINEAR, n.CLAMP_TO_EDGE); 38918 } 38919 o.bindFramebuffer.set(s.tileFramebuffer.framebuffer), function(t1, i, s) { 38920 const r = t1.context, o = r.gl, n = i.tileFramebuffer; 38921 r.activeTexture.set(o.TEXTURE0); 38922 const a = { 38923 u_texture: 0, 38924 u_opacity: 1.05 * (c = i.paint.get("raster-particle-fade-opacity-factor")) / (c + .05) 38925 }, l = t1.getOrCreateProgram("rasterParticleTexture", { 38926 defines: [], 38927 overrideFog: !1 38928 }); 38929 var c; 38930 for (const c of s){ 38931 const [, , s, h] = c; 38932 n.colorAttachment0.set(s.targetColorTexture.texture), r.viewport.set([ 38933 0, 38934 0, 38935 n.width, 38936 n.height 38937 ]), r.clear({ 38938 color: e1.C.transparent 38939 }), h && (s.backgroundColorTexture.bind(o.NEAREST, o.CLAMP_TO_EDGE), l.draw(t1, o.TRIANGLES, e1.Z.disabled, e1._.disabled, e1.a1.alphaBlended, e1.$.disabled, a, i.id, t1.viewportBuffer, t1.quadTriangleIndexBuffer, t1.viewportSegments)); 38940 } 38941 }(t1, s, d), function(t1, i, s, r) { 38942 const o = t1.context, n = o.gl, a = s.tileFramebuffer, l = "globe" === t1.transform.projection.name, c = s.paint.get("raster-particle-max-speed"); 38943 for (const h of r){ 38944 const [r, d, u] = h; 38945 o.activeTexture.set(n.TEXTURE0 + 0), d.texture.bind(n.LINEAR, n.CLAMP_TO_EDGE), a.colorAttachment0.set(u.targetColorTexture.texture); 38946 const p = t1.getOrCreateProgram("rasterParticleDraw", { 38947 defines: d.defines, 38948 overrideFog: !1 38949 }); 38950 o.activeTexture.set(n.TEXTURE0 + 1); 38951 const f = d.scalarData ? [] : [ 38952 0, 38953 1, 38954 2, 38955 3 38956 ].map((t1)=>e1.aB[t1](r)); 38957 f.push(r); 38958 const m = r.canonical.x, _ = r.canonical.y; 38959 for (const o of f){ 38960 const a = i.getTile(l ? o.wrapped() : o); 38961 if (!a) continue; 38962 const h = a.rasterParticleState; 38963 if (!h) continue; 38964 const u = o.canonical.x + (1 << o.canonical.z) * (o.wrap - r.wrap), f = o.canonical.y; 38965 h.particleTexture0.bind(n.NEAREST, n.CLAMP_TO_EDGE); 38966 const g = Ei(1, h.particleTexture0.size[0], [ 38967 u - m, 38968 f - _ 38969 ], 0, d.texture.size, 2, c, d.textureOffset, d.scale, d.offset); 38970 p.draw(t1, n.POINTS, e1.Z.disabled, e1._.disabled, e1.a1.alphaBlended, e1.$.disabled, g, s.id, h.particleIndexBuffer, void 0, h.particleSegment); 38971 } 38972 } 38973 }(t1, i, s, d), o.bindFramebuffer.set(s.particleFramebuffer.framebuffer), function(t1, i, s, r) { 38974 const o = t1.context, n = o.gl, a = i.paint.get("raster-particle-max-speed"), l = r * i.paint.get("raster-particle-speed-factor") * .15, c = function(e1) { 38975 return Math.pow(e1, 6); 38976 }(.01 + 1 * i.paint.get("raster-particle-reset-rate-factor")), h = i.particleFramebuffer; 38977 o.viewport.set([ 38978 0, 38979 0, 38980 h.width, 38981 h.height 38982 ]); 38983 for (const r of s){ 38984 const [, s, d] = r; 38985 o.activeTexture.set(n.TEXTURE0 + 0), s.texture.bind(n.LINEAR, n.CLAMP_TO_EDGE), o.activeTexture.set(n.TEXTURE0 + 1); 38986 const u = d.particleTexture0; 38987 u.bind(n.NEAREST, n.CLAMP_TO_EDGE); 38988 const p = Ii(1, u.size[0], 0, s.texture.size, a, l, c, s.textureOffset, s.scale, s.offset); 38989 h.colorAttachment0.set(d.particleTexture1.texture), o.clear({ 38990 color: e1.C.transparent 38991 }), t1.getOrCreateProgram("rasterParticleUpdate", { 38992 defines: s.defines 38993 }).draw(t1, n.TRIANGLES, e1.Z.disabled, e1._.disabled, e1.a1.unblended, e1.$.disabled, p, i.id, t1.viewportBuffer, t1.quadTriangleIndexBuffer, t1.viewportSegments); 38994 } 38995 }(t1, s, d, p); 38996 }(t1, i, s, r), "translucent" === t1.renderPass && (function(t1, i, s, r) { 38997 const o = t1.context, n = o.gl, a = i.getSource().tileSize, l = 5 * (1 - e1.am(e1.b1, e1.b1 + 1, t1.transform.zoom)) * a + s.paint.get("raster-particle-elevation"), c = !t1.options.moving, h = "globe" === t1.transform.projection.name; 38998 if (!r.length) return; 38999 const [d, u] = t1.stencilConfigForOverlap(r), p = []; 39000 h && p.push("PROJECTION_GLOBE_VIEW"); 39001 const f = t1.stencilModeFor3D(); 39002 for (const r of u){ 39003 const a = r.toUnwrapped(), u = i.getTile(r); 39004 if (!u.rasterParticleState) continue; 39005 const m = u.rasterParticleState, _ = 100; 39006 u.registerFadeDuration(_); 39007 const g = i.findLoadedParent(r, 0), y = Ai(u, g, i, t1.transform, _); 39008 let v, b; 39009 t1.terrain && t1.terrain.prepareDrawTile(), o.activeTexture.set(n.TEXTURE0), m.targetColorTexture.bind(n.LINEAR, n.CLAMP_TO_EDGE), o.activeTexture.set(n.TEXTURE1), g && g.rasterParticleState ? (g.rasterParticleState.targetColorTexture.bind(n.LINEAR, n.CLAMP_TO_EDGE), v = Math.pow(2, g.tileID.overscaledZ - u.tileID.overscaledZ), b = [ 39010 u.tileID.canonical.x * v % 1, 39011 u.tileID.canonical.y * v % 1 39012 ]) : m.targetColorTexture.bind(n.LINEAR, n.CLAMP_TO_EDGE); 39013 const x = h ? t1.transform.expandedFarZProjMatrix : t1.transform.calculateProjMatrix(a, c), w = t1.transform, T = Oi(w), S = e1.b2(r.canonical), C = e1.b3(S.getCenter().lat); 39014 let E, I, D, P, L; 39015 h ? (E = Float32Array.from(e1.b4(e1.b5(r.canonical))), I = Float32Array.from(w.globeMatrix), D = Float32Array.from(e1.b6(w)), P = [ 39016 e1.a7(w.center.lng), 39017 e1.a8(w.center.lat) 39018 ], L = Float32Array.from(e1.b7(r.canonical, S, C, w.worldSize / w._pixelsPerMercatorPixel))) : (E = new Float32Array(16), I = new Float32Array(9), D = new Float32Array(16), P = [ 39019 0, 39020 0 39021 ], L = new Float32Array(9)); 39022 const R = Ci(x, E, I, D, L, b || [ 39023 0, 39024 0 39025 ], e1.S(t1.transform.zoom), P, T, v || 1, y, l), A = t1.isTileAffectedByFog(r), M = t1.getOrCreateProgram("rasterParticle", { 39026 defines: p, 39027 overrideFog: A 39028 }); 39029 if (t1.uploadCommonUniforms(o, M, a), h) { 39030 const i = new e1.Z(n.LEQUAL, e1.Z.ReadOnly, t1.depthRangeFor3D), r = 0, o = t1.globeSharedBuffers; 39031 if (o) { 39032 const [a, l, c] = o.getGridBuffers(C, 0 !== r); 39033 M.draw(t1, n.TRIANGLES, i, f, e1.a1.alphaBlended, t1.renderElevatedRasterBackface ? e1.$.frontCCW : e1.$.backCCW, R, s.id, a, l, c); 39034 } 39035 } else { 39036 const i = t1.depthModeForSublayer(0, e1.Z.ReadOnly), o = d[r.overscaledZ], { tileBoundsBuffer: a, tileBoundsIndexBuffer: l, tileBoundsSegments: c } = t1.getTileBoundsBuffers(u); 39037 M.draw(t1, n.TRIANGLES, i, o, e1.a1.alphaBlended, e1.$.disabled, R, s.id, a, l, c); 39038 } 39039 } 39040 t1.resetStencilClippingMasks(); 39041 }(t1, i, s, r), t1.style.map.triggerRepaint()); 39042 }, 39043 prepareRasterParticle: function(e1, t1, i) { 39044 const s = t1.getSource(); 39045 if ("raster-array" !== s.type || !s.loaded()) return; 39046 const r = e1.sourceLayer || s.rasterLayerIds && s.rasterLayerIds[0]; 39047 if (!r) return; 39048 const o = e1.paint.get("raster-particle-array-band") || s.getInitialBand(r); 39049 if (null == o) return; 39050 const n = t1.getIds().map((e1)=>t1.getTileByID(e1)); 39051 for (const t1 of n)t1.updateNeeded(e1.id, o) && (t1._isHeaderLoaded || t1.parentTile) && s.prepareTile(t1, r, e1.id, o); 39052 }, 39053 Rain: class extends qi { 39054 destroy() { 39055 super.destroy(); 39056 } 39057 update(t1) { 39058 const i = t1.context; 39059 if (!this.particlesVx) { 39060 const t1 = Vi(this.particlesCount), s = new e1.bk, r = new e1.ad; 39061 let o = 0; 39062 const n = e1.bi(1323123451230); 39063 for(let e1 = 0; e1 < t1.length; ++e1){ 39064 const i = t1[e1], a = [ 39065 2 * n() - 1, 39066 n(), 39067 n(), 39068 n() 39069 ]; 39070 s.emplaceBack(i[0], i[1], i[2], -1, -1, ...a), s.emplaceBack(i[0], i[1], i[2], 1, -1, ...a), s.emplaceBack(i[0], i[1], i[2], 1, 1, ...a), s.emplaceBack(i[0], i[1], i[2], -1, 1, ...a), r.emplaceBack(o + 0, o + 1, o + 2), r.emplaceBack(o + 0, o + 2, o + 3), o += 4; 39071 } 39072 this.particlesVx = i.createVertexBuffer(s, Bi.members), this.particlesIdx = i.createIndexBuffer(r); 39073 } 39074 } 39075 getDrawParams(e1) { 39076 if (!e1.style.rain) return null; 39077 const t1 = e1.style.rain.state, i = structuredClone(this._params); 39078 i.intensity = t1.density, i.timeFactor = t1.intensity, i.color = structuredClone(t1.color), i.screenThinning.intensity = t1.centerThinning, i.dropletSizeX = t1.dropletSize[0], i.dropletSizeYScale = t1.dropletSize[1] / t1.dropletSize[0], i.distortionStrength = 100 * t1.distortionStrength; 39079 const s = structuredClone(this._vignetteParams); 39080 return s.strength = 1, s.color = structuredClone(t1.vignetteColor), { 39081 params: i, 39082 vignetteParams: s, 39083 revealParams: { 39084 revealStart: 0, 39085 revealRange: .01 39086 }, 39087 direction: structuredClone(t1.direction) 39088 }; 39089 } 39090 draw(t1) { 39091 const i = this.getDrawParams(t1); 39092 if (!i) return; 39093 const { params: s, revealParams: r, direction: o, vignetteParams: n } = i, a = t1.transform.zoom; 39094 if (r.revealStart > a) return; 39095 const l = Gi(0, 1, r.revealStart, r.revealStart + r.revealRange, a); 39096 if (!this.particlesVx || !this.particlesIdx) return; 39097 n.strength *= l; 39098 const c = this.updateOnRender(t1, s.timeFactor), h = t1.context, d = h.gl, u = t1.transform; 39099 this.screenTexture && this.screenTexture.size[0] === t1.width && this.screenTexture.size[1] === t1.height || (this.screenTexture = new e1.T(h, { 39100 width: t1.width, 39101 height: t1.height, 39102 data: null 39103 }, d.RGBA8)), s.distortionStrength > 0 && (h.activeTexture.set(d.TEXTURE0), this.screenTexture.bind(d.LINEAR, d.CLAMP_TO_EDGE), d.copyTexSubImage2D(d.TEXTURE_2D, 0, 0, 0, 0, 0, t1.width, t1.height)); 39104 const p = t1.getOrCreateProgram("rainParticle"); 39105 t1.uploadCommonUniforms(h, p), h.activeTexture.set(d.TEXTURE0), this.screenTexture.bind(d.LINEAR, d.CLAMP_TO_EDGE); 39106 const f = [ 39107 s.color.r, 39108 s.color.g, 39109 s.color.b, 39110 s.color.a 39111 ], m = (i, r)=>{ 39112 const n = ji(this._movement.getPosition(), i), a = s.dropletSizeX, l = s.dropletSizeX * s.dropletSizeYScale, h = t1.width / 2, m = t1.height / 2, _ = Gi(0, s.screenThinning.start, 0, 1, s.screenThinning.intensity), g = Gi(.001, s.screenThinning.range, 0, 1, s.screenThinning.intensity), y = Gi(0, s.screenThinning.particleOffset, 0, 1, s.screenThinning.intensity), v = (b = { 39113 modelview: c.modelviewMatrix, 39114 projection: c.projectionMatrix, 39115 time: this._accumulatedTimeFromStart, 39116 camPos: n, 39117 velocityConeAperture: s.velocityConeAperture, 39118 velocity: s.velocity, 39119 boxSize: i, 39120 rainDropletSize: [ 39121 a, 39122 l 39123 ], 39124 distortionStrength: s.distortionStrength, 39125 rainDirection: o, 39126 color: f, 39127 screenSize: [ 39128 u.width, 39129 u.height 39130 ], 39131 thinningCenterPos: [ 39132 h, 39133 m 39134 ], 39135 thinningShape: [ 39136 _, 39137 g, 39138 Math.pow(10, s.screenThinning.fadePower) 39139 ], 39140 thinningAffectedRatio: s.screenThinning.affectedRatio, 39141 thinningParticleOffset: y, 39142 shapeDirectionalPower: s.shapeDirPower, 39143 shapeNormalPower: s.shapeNormalPower, 39144 mode: r ? 0 : 1 39145 }, { 39146 u_modelview: Float32Array.from(b.modelview), 39147 u_projection: Float32Array.from(b.projection), 39148 u_time: b.time, 39149 u_cam_pos: b.camPos, 39150 u_texScreen: 0, 39151 u_velocityConeAperture: b.velocityConeAperture, 39152 u_velocity: b.velocity, 39153 u_boxSize: b.boxSize, 39154 u_rainDropletSize: b.rainDropletSize, 39155 u_distortionStrength: b.distortionStrength, 39156 u_rainDirection: b.rainDirection, 39157 u_color: b.color, 39158 u_screenSize: b.screenSize, 39159 u_thinningCenterPos: b.thinningCenterPos, 39160 u_thinningShape: b.thinningShape, 39161 u_thinningAffectedRatio: b.thinningAffectedRatio, 39162 u_thinningParticleOffset: b.thinningParticleOffset, 39163 u_shapeDirectionalPower: b.shapeDirectionalPower, 39164 u_shapeNormalPower: b.shapeNormalPower, 39165 u_mode: b.mode 39166 }); 39167 var b; 39168 const x = Math.round(s.intensity * this.particlesCount), w = e1.ac.simpleSegment(0, 0, 4 * x, 2 * x); 39169 p.draw(t1, d.TRIANGLES, e1.Z.disabled, e1._.disabled, e1.a1.alphaBlended, e1.$.disabled, v, "rain_particles", this.particlesVx, this.particlesIdx, w); 39170 }; 39171 s.distortionStrength > 0 && m(s.boxSize, !0), m(s.boxSize, !1), this._vignette.draw(t1, n); 39172 } 39173 constructor(){ 39174 super(4.25), this._params = { 39175 intensity: .5, 39176 timeFactor: 1, 39177 velocityConeAperture: 0, 39178 velocity: 300, 39179 boxSize: 2500, 39180 dropletSizeX: 1, 39181 dropletSizeYScale: 10, 39182 distortionStrength: 70, 39183 screenThinning: { 39184 intensity: .57, 39185 start: .46, 39186 range: 1.17, 39187 fadePower: .17, 39188 affectedRatio: 1, 39189 particleOffset: -.2 39190 }, 39191 color: { 39192 r: .66, 39193 g: .68, 39194 b: .74, 39195 a: .7 39196 }, 39197 direction: { 39198 x: -50, 39199 y: -35 39200 }, 39201 shapeDirPower: 2, 39202 shapeNormalPower: 1 39203 }, this._vignetteParams = { 39204 strength: 1, 39205 start: .7, 39206 range: 1, 39207 fadePower: .4, 39208 color: { 39209 r: .27, 39210 g: .27, 39211 b: .27, 39212 a: 1 39213 } 39214 }, this.particlesCount = 16e3, this._devtoolsFolder = null, this._painter = null; 39215 } 39216 }, 39217 Snow: class extends qi { 39218 destroy() { 39219 super.destroy(); 39220 } 39221 update(t1) { 39222 const i = t1.context; 39223 if (!this.particlesVx) { 39224 const t1 = Vi(this.particlesCount), s = new e1.bl, r = new e1.ad; 39225 let o = 0; 39226 const n = e1.bi(1323123451230); 39227 for(let e1 = 0; e1 < t1.length; ++e1){ 39228 const i = t1[e1], a = n(), l = n(), c = n(), h = [ 39229 e1 / t1.length, 39230 a, 39231 l, 39232 c 39233 ], d = [ 39234 n(), 39235 n() 39236 ]; 39237 s.emplaceBack(i[0], i[1], i[2], -1, -1, ...h, ...d), s.emplaceBack(i[0], i[1], i[2], 1, -1, ...h, ...d), s.emplaceBack(i[0], i[1], i[2], 1, 1, ...h, ...d), s.emplaceBack(i[0], i[1], i[2], -1, 1, ...h, ...d), r.emplaceBack(o + 0, o + 1, o + 2), r.emplaceBack(o + 0, o + 2, o + 3), o += 4; 39238 } 39239 this.particlesVx = i.createVertexBuffer(s, Zi.members), this.particlesIdx = i.createIndexBuffer(r); 39240 } 39241 } 39242 getDrawParams(e1) { 39243 if (!e1.style.snow) return null; 39244 const t1 = e1.style.snow.state, i = structuredClone(this._params); 39245 i.intensity = t1.density, i.timeFactor = t1.intensity, i.color = structuredClone(t1.color), i.screenThinning.intensity = t1.centerThinning, i.billboardSize = 2.79 * t1.flakeSize; 39246 const s = structuredClone(this._vignetteParams); 39247 return s.strength = 1, s.color = structuredClone(t1.vignetteColor), { 39248 params: i, 39249 vignetteParams: s, 39250 revealParams: { 39251 revealStart: 0, 39252 revealRange: .01 39253 }, 39254 direction: structuredClone(t1.direction) 39255 }; 39256 } 39257 draw(t1) { 39258 const i = this.getDrawParams(t1); 39259 if (!i) return; 39260 const { params: s, revealParams: r, direction: o, vignetteParams: n } = i, a = t1.transform.zoom; 39261 if (r.revealStart > a) return; 39262 const l = Gi(0, 1, r.revealStart, r.revealStart + r.revealRange, a); 39263 n.strength *= l; 39264 const c = this.updateOnRender(t1, s.timeFactor); 39265 if (!this.particlesVx || !this.particlesIdx) return; 39266 const h = t1.context, d = h.gl, u = t1.transform, p = t1.getOrCreateProgram("snowParticle"); 39267 t1.uploadCommonUniforms(h, p), ((i, s, r)=>{ 39268 const n = ji(this._movement.getPosition(), i), a = u.width / 2, l = u.height / 2, h = Gi(0, r.screenThinning.start, 0, 1, r.screenThinning.intensity), f = Gi(.001, r.screenThinning.range, 0, 1, r.screenThinning.intensity), m = Gi(0, r.screenThinning.particleOffset, 0, 1, r.screenThinning.intensity), _ = (g = { 39269 modelview: c.modelviewMatrix, 39270 projection: c.projectionMatrix, 39271 time: this._accumulatedTimeFromStart, 39272 camPos: n, 39273 velocityConeAperture: r.velocityConeAperture, 39274 velocity: r.velocity, 39275 horizontalOscillationRadius: r.horizontalOscillationRadius, 39276 horizontalOscillationRate: r.horizontalOscillationRate, 39277 boxSize: i, 39278 billboardSize: 1 * r.billboardSize, 39279 simpleShapeParameters: [ 39280 r.shapeFadeStart, 39281 r.shapeFadePower 39282 ], 39283 screenSize: [ 39284 u.width, 39285 u.height 39286 ], 39287 thinningCenterPos: [ 39288 a, 39289 l 39290 ], 39291 thinningShape: [ 39292 h, 39293 f, 39294 Math.pow(10, r.screenThinning.fadePower) 39295 ], 39296 thinningAffectedRatio: r.screenThinning.affectedRatio, 39297 thinningParticleOffset: m, 39298 color: [ 39299 r.color.r, 39300 r.color.g, 39301 r.color.b, 39302 r.color.a 39303 ], 39304 direction: o 39305 }, { 39306 u_modelview: Float32Array.from(g.modelview), 39307 u_projection: Float32Array.from(g.projection), 39308 u_time: g.time, 39309 u_cam_pos: g.camPos, 39310 u_velocityConeAperture: g.velocityConeAperture, 39311 u_velocity: g.velocity, 39312 u_horizontalOscillationRadius: g.horizontalOscillationRadius, 39313 u_horizontalOscillationRate: g.horizontalOscillationRate, 39314 u_boxSize: g.boxSize, 39315 u_billboardSize: g.billboardSize, 39316 u_simpleShapeParameters: g.simpleShapeParameters, 39317 u_screenSize: g.screenSize, 39318 u_thinningCenterPos: g.thinningCenterPos, 39319 u_thinningShape: g.thinningShape, 39320 u_thinningAffectedRatio: g.thinningAffectedRatio, 39321 u_thinningParticleOffset: g.thinningParticleOffset, 39322 u_particleColor: g.color, 39323 u_direction: g.direction 39324 }); 39325 var g; 39326 const y = Math.round(r.intensity * this.particlesCount), v = e1.ac.simpleSegment(0, 0, 4 * y, 2 * y); 39327 this.particlesVx && this.particlesIdx && p.draw(t1, d.TRIANGLES, e1.Z.disabled, e1._.disabled, e1.a1.alphaBlended, e1.$.disabled, _, "snow_particles", this.particlesVx, this.particlesIdx, v); 39328 })(s.boxSize, 0, s), this._vignette.draw(t1, n); 39329 } 39330 constructor(){ 39331 super(2.25), this._params = { 39332 intensity: .85, 39333 timeFactor: .75, 39334 velocityConeAperture: 70, 39335 velocity: 40, 39336 horizontalOscillationRadius: 4, 39337 horizontalOscillationRate: 1.5, 39338 boxSize: 2e3, 39339 billboardSize: 2, 39340 shapeFadeStart: .27, 39341 shapeFadePower: .21, 39342 screenThinning: { 39343 intensity: .4, 39344 start: .15, 39345 range: 1.4, 39346 fadePower: .24, 39347 affectedRatio: 1, 39348 particleOffset: -.2 39349 }, 39350 color: { 39351 r: 1, 39352 g: 1, 39353 b: 1, 39354 a: 1 39355 }, 39356 direction: { 39357 x: -50, 39358 y: -35 39359 } 39360 }, this._vignetteParams = { 39361 strength: .3, 39362 start: .78, 39363 range: .46, 39364 fadePower: .2, 39365 color: { 39366 r: 1, 39367 g: 1, 39368 b: 1, 39369 a: 1 39370 } 39371 }, this.particlesCount = 16e3, this._devtoolsFolder = null, this._painter = null; 39372 } 39373 }, 39374 shaders: ki, 39375 programUniforms: Xi, 39376 drawElevatedStructures: function(t1) { 39377 const { painter: i, sourceCache: s, layer: r, coords: o, colorMode: n } = t1, a = i.context.gl, l = t1.painter.shadowRenderer, c = !!l && l.enabled, h = new e1.Z(i.context.gl.LEQUAL, e1.Z.ReadOnly, i.depthRangeFor3D); 39378 let d = [ 39379 0, 39380 0, 39381 0 39382 ]; 39383 if (c) { 39384 const t1 = i.style.directionalLight, s = i.style.ambientLight; 39385 t1 && s && (d = e1.aF(i.style, t1, s)); 39386 } 39387 const u = (t1)=>{ 39388 for (const u of o){ 39389 const o = s.getTile(u), p = o.getBucket(r); 39390 if (!p) continue; 39391 const f = p.hdExt ? p.hdExt.elevatedStructures : void 0; 39392 if (!f) continue; 39393 let m, _; 39394 if (t1 ? (m = f.renderableBridgeSegments, _ = f.bridgeProgramConfigurations.get(r.id)) : (m = f.renderableTunnelSegments, _ = f.tunnelProgramConfigurations.get(r.id)), !m || 0 === m.segments[0].primitiveLength) continue; 39395 _.updatePaintBuffers(), i.prepareDrawTile(); 39396 const g = i.isTileAffectedByFog(u), y = []; 39397 c && y.push("RENDER_SHADOWS", "NORMAL_OFFSET"); 39398 const v = i.getOrCreateProgram("elevatedStructures", { 39399 config: _, 39400 overrideFog: g, 39401 defines: y 39402 }), b = i.translatePosMatrix(u.projMatrix, o, r.paint.get("fill-translate"), r.paint.get("fill-translate-anchor")); 39403 c && l.setupShadows(o.tileID.toUnwrapped(), v, "vector-tile"); 39404 const x = Hi(b, d); 39405 i.uploadCommonUniforms(i.context, v, u.toUnwrapped()), v.draw(i, a.TRIANGLES, h, e1._.disabled, n, e1.$.backCCW, x, r.id, f.vertexBuffer, f.indexBuffer, m, r.paint, i.transform.zoom, _, [ 39406 f.vertexBufferNormal 39407 ]); 39408 } 39409 }; 39410 u(!0), u(!1); 39411 }, 39412 drawElevatedFillShadows: function(t1) { 39413 const { painter: i, sourceCache: s, layer: r, coords: o } = t1, n = i.context.gl, a = t1.painter.shadowRenderer; 39414 for (const t1 of o){ 39415 const o = s.getTile(t1), l = o.getBucket(r); 39416 if (!l) continue; 39417 const c = l.hdExt ? l.hdExt.elevatedStructures : void 0; 39418 if (!c) continue; 39419 if (!c.shadowCasterSegments || 0 === c.shadowCasterSegments.segments[0].primitiveLength) continue; 39420 i.prepareDrawTile(); 39421 const h = l.bufferData.programConfigurations.get(r.id), d = i.isTileAffectedByFog(t1), u = i.getOrCreateProgram("elevatedStructuresDepth", { 39422 config: h, 39423 overrideFog: d 39424 }), p = a.calculateShadowPassMatrixFromTile(o.tileID.toUnwrapped()); 39425 i.uploadCommonUniforms(i.context, u, t1.toUnwrapped()); 39426 const f = $i(p, 0); 39427 u.draw(i, n.TRIANGLES, a.getShadowPassDepthMode(), e1._.disabled, e1.a1.disabled, e1.$.disabled, f, r.id, c.vertexBuffer, c.indexBuffer, c.shadowCasterSegments, r.paint, i.transform.zoom, h); 39428 } 39429 }, 39430 drawDepthPrepass: function(t1, i, s, r, o) { 39431 if (!i) return; 39432 if (!s.layout || "none" === s.layout.get("fill-elevation-reference") || 0 === s.paint.get("fill-opacity").constantOr(1)) return; 39433 const n = t1.context.gl, a = new e1.Z(t1.context.gl.LEQUAL, e1.Z.ReadWrite, t1.depthRangeFor3D), l = new e1.Z(t1.context.gl.GREATER, e1.Z.ReadWrite, t1.depthRangeFor3D), c = function(t1) { 39434 let i = .01; 39435 return t1.isOrthographic && (i = e1.al(1e-4, i, e1.bo(t1.pitch >= e1.bn ? 1 : t1.pitch / e1.bn))), 2 * i; 39436 }(t1.transform), h = t1.transform.getFreeCameraOptions().position, d = "elevatedStructuresDepthReconstruct", u = t1.getOrCreateProgram(d, { 39437 defines: [ 39438 "DEPTH_RECONSTRUCTION" 39439 ] 39440 }), p = t1.getOrCreateProgram(d); 39441 for (const d of r){ 39442 const r = i.getTile(d), f = r.getBucket(s); 39443 if (!f) continue; 39444 if (!f.hdExt) continue; 39445 const m = f.hdExt.elevatedStructures, _ = f.hdExt.elevationBufferData; 39446 if (!m || !m.depthSegments || !_) continue; 39447 const g = _.heightRange, y = Ki(d.toUnwrapped(), h), v = t1.translatePosMatrix(d.projMatrix, r, s.paint.get("fill-translate"), s.paint.get("fill-translate-anchor")); 39448 let b, x, w, T; 39449 if ("initialize" === o) { 39450 if (!g || g.min >= 1 || 0 === m.depthSegments.segments[0].primitiveLength) continue; 39451 b = Wi(v, y, c, 1, 0), x = a, w = m.depthSegments, T = u; 39452 } else if ("reset" === o) { 39453 if (!g || g.min >= 0 || 0 === m.maskSegments.segments[0].primitiveLength) continue; 39454 b = Wi(v, y, 0, 0, 1), x = l, w = m.maskSegments, T = u; 39455 } else if ("geometry" === o) { 39456 if (0 === m.depthSegments.segments[0].primitiveLength) continue; 39457 b = Wi(v, y, c, 1, 0), x = a, w = m.depthSegments, T = p; 39458 } 39459 T.draw(t1, n.TRIANGLES, x, e1._.disabled, e1.a1.disabled, e1.$.disabled, b, s.id, m.vertexBuffer, m.indexBuffer, w, s.paint, t1.transform.zoom); 39460 } 39461 }, 39462 drawGroundShadowMask: function(t1, i, s, r) { 39463 if (!i) return; 39464 if (!s.layout || "none" === s.layout.get("fill-elevation-reference") || 0 === s.paint.get("fill-opacity").constantOr(1)) return; 39465 const o = t1.context.gl, n = new e1.Z(o.LEQUAL, e1.Z.ReadOnly, t1.depthRangeFor3D), a = new e1._({ 39466 func: o.ALWAYS, 39467 mask: 255 39468 }, 255, 255, o.KEEP, o.KEEP, o.REPLACE), l = t1.transform.getFreeCameraOptions().position, c = t1.getOrCreateProgram("elevatedStructuresDepthReconstruct"); 39469 for (const h of r){ 39470 const r = i.getTile(h), d = r.getBucket(s); 39471 if (!d) continue; 39472 const u = d.hdExt ? d.hdExt.elevatedStructures : void 0; 39473 if (!u || !u.depthSegments || 0 === u.depthSegments.segments[0].primitiveLength) continue; 39474 const p = Ki(h.toUnwrapped(), l), f = t1.translatePosMatrix(h.projMatrix, r, s.paint.get("fill-translate"), s.paint.get("fill-translate-anchor")), m = Wi(f, p, 0, 1, 0); 39475 c.draw(t1, o.TRIANGLES, n, a, e1.a1.disabled, e1.$.disabled, m, s.id, u.vertexBuffer, u.indexBuffer, u.depthSegments, s.paint, t1.transform.zoom); 39476 } 39477 }, 39478 IndoorManager: class extends e1.E { 39479 destroy() { 39480 this._buildings = {}, this._activeFloors = new Set, this._indoorState = null; 39481 } 39482 selectFloor(e1) { 39483 e1 === this._selectedFloorId && this._indoorState && this._indoorState.activeFloorsVisible || (this._selectedFloorId = e1, this._recalculateActiveFloors()); 39484 } 39485 setActiveFloorsVisibility(e1) { 39486 this._updateActiveFloors(e1), this._updateIndoorSelector(); 39487 } 39488 setIndoorData(e1) { 39489 let t1 = !1; 39490 for (const [i, s] of Object.entries(e1.buildings))if (this._buildings[i]) for (const e1 of s.floorIds)this._buildings[i].floorIds.add(e1), this._buildings[i].floors[e1] ? this._mergeFloors(this._buildings[i].floors[e1], s.floors[e1]) : (this._buildings[i].floors[e1] = s.floors[e1], t1 = !0); 39491 else this._buildings[i] = s, t1 = !0; 39492 t1 && this._recalculateActiveFloors(); 39493 } 39494 getIndoorTileOptions(e1, t1) { 39495 return this._indoorState ? { 39496 sourceLayers: this._style.getIndoorSourceLayers(e1, t1), 39497 indoorState: this._indoorState 39498 } : null; 39499 } 39500 getControlState() { 39501 const e1 = this._buildings, t1 = this._closestBuildingId, i = t1 && e1 ? e1[t1] : void 0; 39502 if (!i) return { 39503 selectedFloorId: null, 39504 activeFloorsVisible: !!this._indoorState && this._indoorState.activeFloorsVisible, 39505 floors: [] 39506 }; 39507 let s = null; 39508 for (const e1 of i.floorIds)if (this._activeFloors && this._activeFloors.has(e1)) { 39509 s = e1; 39510 break; 39511 } 39512 const r = Array.from(i.floorIds).map((e1)=>({ 39513 id: e1, 39514 name: i.floors[e1].name, 39515 zIndex: i.floors[e1].zIndex 39516 })).sort((e1, t1)=>t1.zIndex - e1.zIndex).filter((e1, t1, i)=>0 === t1 || e1.zIndex !== i[t1 - 1].zIndex); 39517 return { 39518 selectedFloorId: s, 39519 activeFloorsVisible: !!this._indoorState && this._indoorState.activeFloorsVisible, 39520 floors: r 39521 }; 39522 } 39523 _updateUI() { 39524 this._initialLoadDone = !0; 39525 const e1 = this._style.map.transform, t1 = this._buildingDetectionStrategy.findClosestBuilding(this._buildings, e1.center, e1.zoom, e1.getBounds(), this._makeViewportPolygon()); 39526 if (t1 !== this._closestBuildingId) { 39527 const e1 = this._closestBuildingId; 39528 this._closestBuildingId = t1, this._onBuildingTransition(e1, t1), this._updateIndoorSelector(); 39529 } 39530 } 39531 _onBuildingTransition(e1, t1) { 39532 if (!this._indoorState) return; 39533 const i = !!t1 && !e1; 39534 !t1 && e1 ? (this._indoorState.activeFloors = new Set, this._indoorState.activeFloorsVisible = !1, this._style.updateIndoorDependentLayers()) : i && (this._recalculateActiveFloors(), this._updateActiveFloors(!0)); 39535 } 39536 _updateIndoorSelector() { 39537 this.fire(new e1.h("selector-update", this.getControlState())); 39538 } 39539 _updateActiveFloors(e1) { 39540 this._indoorState = { 39541 selectedFloorId: this._selectedFloorId, 39542 activeFloorsVisible: e1, 39543 activeFloors: this._activeFloors 39544 }, this._initialLoadDone ? this._style.updateIndoorDependentLayers() : this._indoorState.needsUpdate = !0; 39545 } 39546 _recalculateActiveFloors() { 39547 if (!this._buildings) return; 39548 const t1 = e1.aW.calculate(this._buildings, this._selectedFloorId, this._activeFloors); 39549 (function(e1, t1) { 39550 if (e1 === t1) return !0; 39551 if (!e1 || !t1) return !1; 39552 if (e1.size !== t1.size) return !1; 39553 for (const i of e1)if (!t1.has(i)) return !1; 39554 return !0; 39555 })(t1, this._activeFloors) || (this._activeFloors = t1, this._updateActiveFloors(!!this._indoorState && this._indoorState.activeFloorsVisible), this._updateIndoorSelector()); 39556 } 39557 _mergeFloors(e1, t1) { 39558 t1.geometry && (e1.geometry ? ("Polygon" === e1.geometry.type && (e1.geometry = { 39559 type: "MultiPolygon", 39560 coordinates: [ 39561 e1.geometry.coordinates 39562 ] 39563 }), "Polygon" === t1.geometry.type ? e1.geometry.coordinates.push(t1.geometry.coordinates) : "MultiPolygon" === t1.geometry.type && e1.geometry.coordinates.push(...t1.geometry.coordinates)) : e1.geometry = t1.geometry); 39564 } 39565 _makeViewportPolygon() { 39566 const t1 = this._style.map.transform, i = t1.width, s = t1.height; 39567 return [ 39568 t1.pointLocation(new e1.P(0, 0)), 39569 t1.pointLocation(new e1.P(i, 0)), 39570 t1.pointLocation(new e1.P(i, s)), 39571 t1.pointLocation(new e1.P(0, s)) 39572 ].map((t1)=>new e1.P(t1.lng, t1.lat)); 39573 } 39574 constructor(t1, i = !1){ 39575 super(), this._style = t1, this._buildings = {}, this._activeFloors = new Set, this._closestBuildingId = null, this._indoorState = { 39576 selectedFloorId: null, 39577 activeFloorsVisible: !0, 39578 activeFloors: this._activeFloors 39579 }, this._buildingDetectionStrategy = new Ti, this._initialLoadDone = !1, e1.aV([ 39580 "_updateUI" 39581 ], this); 39582 const s = ()=>{ 39583 this._style.isIndoorEnabled() && (this._style.map.on("load", ()=>{ 39584 this._initialLoadDone = !0, this._indoorState && this._indoorState.needsUpdate && (this._indoorState.needsUpdate = !1, this._style.updateIndoorDependentLayers()), this._updateUI(); 39585 }), this._style.map.on("move", this._updateUI), this._style.map.on("idle", this._updateUI)); 39586 }; 39587 i ? (this._initialLoadDone = !0, s()) : this._style.on("style.load", s); 39588 } 39589 }, 39590 HdCoverageState: class { 39591 constructor(){ 39592 this.coverageSourceCaches = {}, this.manager = new ts; 39593 } 39594 }, 39595 updateFrcCoverage: function(e1, t1) { 39596 t1.manager.clear(); 39597 for(const i in e1._mergedHdRoadCoverageSourceCaches){ 39598 const s = e1._mergedHdRoadCoverageSourceCaches[i]._tiles; 39599 for(const e1 in s){ 39600 const i = s[e1]; 39601 if (!i || !i.loaded()) continue; 39602 const r = i.frcCoveragePolygons; 39603 t1.manager.addTileCoverage(i.tileID.canonical, r && r.length > 0 ? r : []); 39604 } 39605 } 39606 const i = t1.manager.updateSnapshotIfNeeded(); 39607 if (e1.map.painter && (e1.map.painter.frcCoverageSnapshot = i.empty() ? null : i), !i.empty()) { 39608 const t1 = [ 39609 e1._mergedOtherSourceCaches, 39610 e1._mergedSymbolSourceCaches 39611 ]; 39612 for (const e1 of t1)for(const t1 in e1){ 39613 const i = e1[t1]; 39614 for(const e1 in i._tiles){ 39615 const t1 = i._tiles[e1]; 39616 t1 && t1.hasDeferredRoadStructure && (t1.hasDeferredRoadStructure = !1, i._reloadTile(+e1, "reloading")); 39617 } 39618 } 39619 } 39620 }, 39621 updateHdCoverageSourceCache: function(t1, i, s) { 39622 if ("fill" !== s.type || s.sourceLayer !== e1.bU) return; 39623 if (i.coverageSourceCaches[s.source]) return; 39624 const r = t1.getOwnSource(s.source); 39625 if (!r || "vector" !== r.type) return; 39626 const o = "hd-road-coverage:".concat(s.source), n = e1.m(o, t1.scope), a = t1._sourceCaches[o] = new gs(n, r, e1.bR.HdRoadCoverage); 39627 i.coverageSourceCaches[s.source] = a, a.setMaxzoomOverride(14), a.onAdd(t1.map); 39628 const l = t1._otherSourceCaches[s.source]; 39629 l && l._sourceLoaded && (a._sourceLoaded = !0); 39630 }, 39631 updateFrcCoverageFadeRange: function(t1, i) { 39632 let s = null, r = null; 39633 const o = { 39634 globals: { 39635 zoom: 0 39636 } 39637 };
39638 t1.forEachFragmentStyle((i)=>{ 39639 if (s) return; 39640 const n = i.stylesheet ? i.stylesheet.schema : null; 39641 if (!n || !n.sdCoverageFadeRange) return; 39642 const a = e1.m("sdCoverageFadeRange", i.scope), l = i.options ? i.options.get(a) : void 0, c = l ? l.value || l.default : null; 39643 if (c) { 39644 const e1 = c.evaluate(o); 39645 Array.isArray(e1) && 2 === e1.length && (e1[0] > 0 || e1[1] > 0) && (s = [ 39646 e1[0], 39647 e1[1] 39648 ]); 39649 } 39650 const h = e1.m("sdCoverageSourceLayers", i.scope), d = i.options ? i.options.get(h) : void 0, u = d ? d.value || d.default : null; 39651 if (u) { 39652 const e1 = u.evaluate(o); 39653 Array.isArray(e1) && e1.length > 0 && (r = e1); 39654 } else { 39655 const e1 = t1.stylesheet && t1.stylesheet.imports || []; 39656 for (const t1 of e1)if (t1.id === i.scope) { 39657 const e1 = t1.config ? t1.config.sdCoverageSourceLayers : void 0; 39658 Array.isArray(e1) && e1.length > 0 && (r = e1); 39659 break; 39660 } 39661 } 39662 }), i.frcCoverageFadeRange = s, i.frcCoverageSourceLayers = null != s ? r || [ 39663 "road", 39664 "structure" 39665 ] : []; 39666 }, 39667 HdElevationState: Os, 39668 setupAndUpdateElevationCoverage: function(t1) { 39669 if (!function(e1) { 39670 for(const t1 in e1._mergedLayers)if (Ds(e1._mergedLayers[t1])) return !0; 39671 return !1; 39672 }(t1)) return void ks(t1); 39673 const i = Gt(t1, t1.map && t1.map.transform); 39674 t1._hdElevation || (t1._hdElevation = new Os); 39675 const s = t1._hdElevation._terrainActiveLast; 39676 if (t1._hdElevation._terrainActiveLast = i, void 0 !== s && s !== i && Ms(t1, void 0, !0), i) return void (t1.map.painter && (t1.map.painter.elevationCoverageSnapshot = null)); 39677 if (!Rs(t1)) return void ks(t1); 39678 void 0 === s && Ms(t1, void 0, !0); 39679 const r = t1._hdElevation; 39680 r._needsCrossSourceElevation = !0, t1._crossSourceElevationActive = !0, r._ingestFQIDs = As(t1); 39681 const o = Ls(t1); 39682 t1.forEachFragmentStyle((t1)=>{ 39683 for (const i of o){ 39684 if (!Cs(i, t1.scope)) continue; 39685 const s = e1.bV(i); 39686 if (t1._otherSourceCaches[s] || t1._symbolSourceCaches[s]) continue; 39687 const r = t1.getOwnSource(s); 39688 r && "vector" === r.type && (t1._hdElevation || (t1._hdElevation = new Os), Bs(t1, t1._hdElevation, r)); 39689 } 39690 }), t1.mergeSources(), zs(t1, r); 39691 }, 39692 updateElevationCoverage: zs, 39693 updateHdElevationSourceCache: Bs, 39694 markElevationIngestSourceCachesUsed: function(e1) { 39695 if (!e1._hdElevation || !e1._hdElevation._needsCrossSourceElevation) return; 39696 const t1 = e1._hdElevation._ingestFQIDs; 39697 if (t1) for (const i of t1){ 39698 const t1 = Es(e1, i); 39699 t1 && (t1.used = !0); 39700 } 39701 }, 39702 updateCrossSourceElevationGate: function(e1) { 39703 e1._crossSourceElevationActive = Rs(e1); 39704 const t1 = e1._mergedHdRoadElevationSourceCaches; 39705 t1 && 0 !== Object.keys(t1).length && (e1._hdElevation || (e1._hdElevation = new Os), e1._hdElevation._needsCrossSourceElevation = e
vendor: 12,490 bytes, lines 39705-39932
397051._crossSourceElevationActive); 39706 }, 39707 buildElevationRequestParams: function(t1, i, s) { 39708 if (i.renderSourceType === e1.bR.HdRoadElevation) return null; 39709 if (Gt(t1.style, t1.transform)) return null; 39710 if (!s) return null; 39711 const r = t1.painter ? t1.painter.elevationCoverageSnapshot : null, o = !(!t1.painter || !t1.painter.elevationProvidersReady); 39712 return r ? function(e1, t1, i) { 39713 const s = e1.getTilesIntersecting(t1); 39714 if (0 === s.length) return { 39715 registry: [], 39716 hasCoveringTile: !1, 39717 allProvidersReady: i 39718 }; 39719 const r = []; 39720 for (const e1 of s)for (const t1 of e1.features)r.push({ 39721 tileId: e1.tileId, 39722 feature: t1 39723 }); 39724 return r.sort((e1, t1)=>e1.feature.id - t1.feature.id), { 39725 registry: r, 39726 hasCoveringTile: !0, 39727 allProvidersReady: i 39728 }; 39729 }(r, i.tileID.canonical, o) : { 39730 registry: [], 39731 hasCoveringTile: !1, 39732 allProvidersReady: o 39733 }; 39734 }, 39735 FrcCoverageRenderer: class { 39736 update(e1, t1) { 39737 this._context = e1; 39738 const i = new Set; 39739 for (const s of t1){ 39740 if (0 === s.frcMask) continue; 39741 let t1 = !1; 39742 for (const e1 of s.polygons)if (e1.hasGeometry()) { 39743 t1 = !0; 39744 break; 39745 } 39746 if (!t1) continue; 39747 const r = "".concat(s.tileId.z, "/").concat(s.tileId.x, "/").concat(s.tileId.y); 39748 if (i.add(r), !this.tileBuffers.has(r)) { 39749 const t1 = this._createBuffers(e1, s); 39750 t1 && this.tileBuffers.set(r, t1); 39751 } 39752 } 39753 for (const e1 of this.tileBuffers.keys())if (!i.has(e1)) { 39754 const t1 = this.tileBuffers.get(e1); 39755 t1.vertexBuffer.destroy(), t1.indexBuffer.destroy(); 39756 for (const e1 of t1.frcLevelSegments)e1 && e1.destroy(); 39757 this.tileBuffers.delete(e1); 39758 } 39759 } 39760 getBuffers(e1) { 39761 return this.tileBuffers.get("".concat(e1.z, "/").concat(e1.x, "/").concat(e1.y)) || null; 39762 } 39763 destroy() { 39764 for (const e1 of this.tileBuffers.values()){ 39765 e1.vertexBuffer.destroy(), e1.indexBuffer.destroy(); 39766 for (const t1 of e1.frcLevelSegments)t1 && t1.destroy(); 39767 } 39768 this.tileBuffers.clear(); 39769 } 39770 _createBuffers(t1, i) { 39771 const s = new e1.bC, r = new e1.ad, o = []; 39772 for (const t1 of i.polygons){ 39773 if (!t1.hasGeometry() || 0 === t1.rings.length) continue; 39774 const i = s.length, n = r.length, a = s.length, l = [], c = []; 39775 let h = 0; 39776 for(let e1 = 0; e1 < t1.rings.length; e1++){ 39777 const i = t1.rings[e1]; 39778 if (!(i.length < 3)) { 39779 e1 > 0 && c.push(h); 39780 for (const e1 of i)s.emplaceBack(e1.x, e1.y), l.push(e1.x, e1.y), h++; 39781 } 39782 } 39783 const d = e1.bF(l, c.length > 0 ? c : void 0); 39784 for(let e1 = 0; e1 < d.length; e1 += 3)r.emplaceBack(a + d[e1], a + d[e1 + 1], a + d[e1 + 2]); 39785 o.push({ 39786 vertexOffset: i, 39787 indexOffset: n, 39788 vertexCount: s.length - i, 39789 indexCount: r.length - n, 39790 frcMask: t1.frcMask 39791 }); 39792 } 39793 if (0 === s.length) return null; 39794 const n = new Array(9).fill(null); 39795 for(let t1 = 0; t1 < 9; ++t1){ 39796 const s = 1 << t1; 39797 if (0 === (i.frcMask & s)) continue; 39798 let r = 1 / 0, a = 0, l = 0, c = !1; 39799 for (const e1 of o)0 !== (e1.frcMask & s) && (r = Math.min(r, e1.indexOffset), a = Math.max(a, e1.indexOffset + e1.indexCount), l = Math.max(l, e1.vertexOffset + e1.vertexCount), c = !0); 39800 c && (n[t1] = e1.ac.simpleSegment(0, r, l, a - r)); 39801 } 39802 return { 39803 vertexBuffer: t1.createVertexBuffer(s, e1.bE.members), 39804 indexBuffer: t1.createIndexBuffer(r), 39805 frcLevelSegments: n 39806 }; 39807 } 39808 constructor(){ 39809 this.tileBuffers = new Map, this._context = null; 39810 } 39811 }, 39812 drawFillFrcCoverageFirstPass: function(t1) { 39813 const { painter: i, bucket: s, coord: r, elevatedGeometry: o } = t1, n = "road" === s.sourceLayerName, a = "structure" === s.sourceLayerName; 39814 if (!n && !a) return "fallthrough"; 39815 if (!i.frcCoverageSnapshot || o) return "fallthrough"; 39816 const l = i.frcCoverageSnapshot.getTileOrParent(r.canonical); 39817 if (!l || 0 === l.frcMask) return "fallthrough"; 39818 const c = s.hdExt && s.hdExt.frcData, h = !!c && !c.empty(), d = $s(l.polygons); 39819 if (a && !d) return "skip"; 39820 if (a && d) return t1.polygonCoverageTiles.push({ 39821 coord: t1.coord, 39822 bufferData: t1.bufferData, 39823 program: t1.program, 39824 programConfiguration: t1.programConfiguration, 39825 uniformValues: t1.uniformValues, 39826 depthMode: t1.depthMode, 39827 dynamicBuffers: t1.dynamicBuffers, 39828 indexBuffer: t1.indexBuffer, 39829 segments: t1.segments, 39830 frcMask: l.frcMask 39831 }), "deferred"; 39832 if (n && h && c) { 39833 const s = l.frcMask, r = i.transform.zoom; 39834 for (const [o, n] of c.frcPerLevel)s & 1 << o || 0 !== n.segments.length && t1.program.draw(i, t1.drawMode, t1.depthMode, t1.stencilMode, t1.colorMode, e1.$.disabled, t1.uniformValues, t1.layer.id, t1.bufferData.layoutVertexBuffer, t1.indexBuffer, n, t1.layer.paint, r, t1.programConfiguration, t1.dynamicBuffers); 39835 return c.frcNonRoadSegments.segments.length > 0 && t1.program.draw(i, t1.drawMode, t1.depthMode, t1.stencilMode, t1.colorMode, e1.$.disabled, t1.uniformValues, t1.layer.id, t1.bufferData.layoutVertexBuffer, t1.indexBuffer, c.frcNonRoadSegments, t1.layer.paint, r, t1.programConfiguration, t1.dynamicBuffers), "drawn"; 39836 } 39837 return "fallthrough"; 39838 }, 39839 drawFillFrcCoverageSecondPass: function(t1, i, s, r, o) { 39840 if (0 === s.length) return; 39841 const n = Hs(t1), a = t1.transform.zoom, l = (s, n, l)=>{ 39842 1 !== l && (s.uniformValues.u_opacity_multiplier = l), s.program.draw(t1, r, s.depthMode, n, o, e1.$.disabled, s.uniformValues, i.id, s.bufferData.layoutVertexBuffer, s.indexBuffer, s.segments, i.paint, a, s.programConfiguration, s.dynamicBuffers), 1 !== l && (s.uniformValues.u_opacity_multiplier = 1); 39843 }; 39844 Zs(t1, s, n, (e1, t1, i)=>l(e1, i, 1), (e1, t1, i)=>l(e1, i, n)); 39845 }, 39846 drawLineFrcCoverageDetect: function(e1, t1, i, s, r, o, n, a, l, c) { 39847 const h = t1.hdExt && t1.hdExt.frcData; 39848 if (!h || 0 === h.frcPerLevel.size) return null; 39849 if (!e1.frcCoverageSnapshot || s) return null; 39850 const d = e1.frcCoverageSnapshot.getTileOrParent(i.canonical); 39851 if (!d || 0 === d.frcMask) return null; 39852 const u = $s(d.polygons), p = e1.frcCoverageFadeRange, f = null != p && e1.transform.zoom >= p[0]; 39853 if (u && f) { 39854 let e1 = !1; 39855 for (const t1 of h.frcPerLevel.keys())if (d.frcMask & 1 << t1) { 39856 e1 = !0; 39857 break; 39858 } 39859 e1 && c.push({ 39860 coord: i, 39861 bucket: t1, 39862 uniformValues: r, 39863 programConfiguration: o, 39864 program: n, 39865 depthMode: a, 39866 colorMode: l, 39867 frcMask: d.frcMask 39868 }); 39869 } 39870 return { 39871 coverageTile: d, 39872 frcMask: d.frcMask, 39873 active: f, 39874 hasPolygonGeometry: u 39875 }; 39876 }, 39877 drawLineFrcRenderLine: function(e1, t1, i, s) { 39878 const r = e1.hdExt && e1.hdExt.frcData; 39879 if (!r) return; 39880 const o = t1.frcMask; 39881 for (const [e1, t1] of r.frcPerLevel)o & 1 << e1 || s(i, t1); 39882 const n = r.frcNonRoadSegments; 39883 n.segments.length > 0 && s(i, n); 39884 }, 39885 drawLineFrcFadePass: function(e1, t1, i, s, r, o, n) { 39886 if (s.hasPolygonGeometry) return; 39887 const a = t1.hdExt && t1.hdExt.frcData; 39888 if (!a || !e1.frcCoverageFadeRange) return; 39889 const [l, c] = e1.frcCoverageFadeRange; 39890 if (l >= c) return; 39891 const h = 1 - Math.max(0, Math.min(1, (e1.transform.zoom - l) / (c - l))); 39892 if (h <= 0) return; 39893 const d = r ? o : e1.stencilModeForClipping(i), u = s.frcMask; 39894 for (const [e1, t1] of a.frcPerLevel)u & 1 << e1 && n(d, t1, h); 39895 }, 39896 drawLineFrcCoverageSecondPass: function(t1, i, s) { 39897 if (0 === s.length) return; 39898 const r = t1.context.gl, o = Hs(t1), n = t1.transform.zoom, a = (s, o, a, l)=>{ 39899 const c = s.bucket.hdExt && s.bucket.hdExt.frcData, h = c && c.frcPerLevel.get(o); 39900 h && 0 !== h.segments.length && (1 !== l && (s.uniformValues.u_opacity_multiplier = l), s.program.draw(t1, r.TRIANGLES, s.depthMode, a, s.colorMode, e1.$.disabled, s.uniformValues, i.id, s.bucket.layoutVertexBuffer, s.bucket.indexBuffer, h, i.paint, n, s.programConfiguration, [ 39901 s.bucket.layoutVertexBuffer2, 39902 s.bucket.patternVertexBuffer, 39903 s.bucket.zOffsetVertexBuffer, 39904 s.bucket.elevationIdColVertexBuffer, 39905 s.bucket.elevationGroundScaleVertexBuffer 39906 ]), 1 !== l && (s.uniformValues.u_opacity_multiplier = 1)); 39907 }; 39908 Zs(t1, s, o, (e1, t1, i)=>a(e1, t1, i, 1), (e1, t1, i)=>a(e1, t1, i, o)); 39909 } 39910 }, Xs = Ws; 39911 async function Ks() { 39912 return Promise.resolve(); 39913 } 39914 function Ys(t1, i) { 39915 const s = Math.pow(2, i.canonical.z), r = i.canonical.y; 39916 return [ 39917 new e1.bS(0, r / s).toLngLat().lat, 39918 new e1.bS(0, (r + 1) / s).toLngLat().lat 39919 ]; 39920 } 39921 function Qs(t1, i, s, r, o, n, a) { 39922 const l = t1.context, c = l.gl, h = s.hillshadeFBO; 39923 if (!h) return; 39924 t1.prepareDrawTile(); 39925 const d = t1.isTileAffectedByFog(i), u = []; 39926 t1.terrain && t1.terrain.renderingToTexture && "mrt-fallback" === t1.emissiveMode && u.push("USE_MRT1"); 39927 const p = t1.getOrCreateProgram("hillshade", { 39928 overrideFog: d, 39929 defines: u 39930 }); 39931 l.activeTexture.set(c.TEXTURE0), c.bindTexture(c.TEXTURE_2D, h.colorAttachment0.get()); 39932 const f = ((t1, i, s, r)=>
39932{ 39933 const o = s.paint.get("hillshade-shadow-color"), n = "none" === s.paint.get("hillshade-shadow-color-use-theme").constantOr("default"), a = s.paint.get("hillshade-highlight-color"), l = "none" === s.paint.get("hillshade-highlight-color-use-theme").constantOr("default"), c = s.paint.get("hillshade-accent-color"), h = "none" === s.paint.get("hillshade-accent-color-use-theme").constantOr("default"), d = s.paint.get("hillshade-emissive-strength"); 39934 let u = e1.au(s.paint.get("hillshade-illumination-direction")); 39935 if ("viewport" === s.paint.get("hillshade-illumination-anchor")) u -= t1.transform.angle; 39936 else if (t1.style && t1.style.enable3dLights() && t1.style.directionalLight) { 39937 const i = t1.style.directionalLight.properties.get("direction"), s = e1.b$(i.x, i.y, i.z); 39938 u = e1.au(s[1]); 39939 } 39940 const p = !t1.options.moving; 39941 return { 39942 u_matrix: r || t1.transform.calculateProjMatrix(i.tileID.toUnwrapped(), p), 39943 u_image: 0, 39944 u_latrange: Ys(0, i.tileID), 39945 u_light: [ 39946 s.paint.get("hillshade-exaggeration"), 39947 u 39948 ], 39949 u_shadow: o.toPremultipliedRenderColor(n ? null : s.lut), 39950 u_highlight: a.toPremultipliedRenderColor(l ? null : s.lut), 39951 u_emissive_strength: d, 39952 u_accent: c.toPremultipliedRenderColor(h ? null : s.lut) 39953 }; 39954 })(t1, s, r, t1.terrain ? i.projMatrix : null); 39955 t1.uploadCommonUniforms(l, p, i.toUnwrapped()); 39956 const { tileBoundsBuffer: m, tileBoundsIndexBuffer: _, tileBoundsSegments: g } = t1.getTileBoundsBuffers(s); 39957 p.draw(t1, c.TRIANGLES, o, n, a, e1.$.disabled, f, r.id, m, _, g); 39958 } 39959 function Js(t1, i, s) { 39960 if (!i.needsDEMTextureUpload) return; 39961 const r = t1.context, o = r.gl; 39962 r.pixelStoreUnpackPremultiplyAlpha.set(!1), i.demTexture = i.demTexture || t1.getTileTexture(s.stride); 39963 const n = s.getPixels(); 39964 i.demTexture ? i.demTexture.update(n, { 39965 premultiply: !1 39966 }) : i.demTexture = new e1.T(r, n, o.R32F, { 39967 premultiply: !1 39968 }), i.needsDEMTextureUpload = !1; 39969 } 39970 function er(t1, i, s) { 39971 const r = t1.context, o = r.gl; 39972 if (!i.dem) return; 39973 const n = i.dem; 39974 if (r.activeTexture.set(o.TEXTURE1), Js(t1, i, n), !i.demTexture) return; 39975 i.demTexture.bind(o.NEAREST, o.CLAMP_TO_EDGE); 39976 const a = n.dim; 39977 r.activeTexture.set(o.TEXTURE0); 39978 let l = i.hillshadeFBO; 39979 if (!l) { 39980 const t1 = new e1.T(r, { 39981 width: a, 39982 height: a, 39983 data: null 39984 }, o.RGBA8); 39985 t1.bind(o.LINEAR, o.CLAMP_TO_EDGE), l = i.hillshadeFBO = r.createFramebuffer(a, a, 1, "renderbuffer"), l.colorAttachment0.set(t1.texture); 39986 } 39987 r.bindFramebuffer.set(l.framebuffer), r.viewport.set([ 39988 0, 39989 0, 39990 a, 39991 a 39992 ]); 39993 const { tileBoundsBuffer: c, tileBoundsIndexBuffer: h, tileBoundsSegments: d } = t1.getMercatorTileBoundsBuffers(), u = []; 39994 t1.linearFloatFilteringSupported() && u.push("TERRAIN_DEM_FLOAT_FORMAT"), t1.terrain && t1.terrain.renderingToTexture && "mrt-fallback" === t1.emissiveMode && u.push("USE_MRT1"), t1.getOrCreateProgram("hillshadePrepare", { 39995 defines: u 39996 }).draw(t1, o.TRIANGLES, e1.Z.disabled, e1._.disabled, e1.a1.unblended, e1.$.disabled, ((t1, i)=>{ 39997 const s = i.stride, r = e1.Y(); 39998 return e1.b_(r, 0, e1.a6, -e1.a6, 0, 0, 1), e1.bM(r, r, [ 39999 0, 40000 -e1.a6, 40001 0 40002 ]), { 40003 u_matrix: r, 40004 u_image: 1, 40005 u_dimension: [ 40006 s, 40007 s 40008 ], 40009 u_zoom: t1.overscaledZ 40010 }; 40011 })(i.tileID, n), s.id, c, h, d), i.needsHillshadePrepare = !1; 40012 } 40013 class tr { 40014 get() { 40015 return this.current; 40016 } 40017 set(e1) {} 40018 getDefault() { 40019 return this.default; 40020 } 40021 setDefault() { 40022 this.set(this.default); 40023 } 40024 constructor(e1){ 40025 this.gl = e1.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = !1; 40026 } 40027 } 40028 class ir extends tr { 40029 getDefault() { 40030 return e1.C.transparent.toNonPremultipliedRenderColor(null); 40031 } 40032 set(e1) { 40033 const t1 = this.current; 40034 (e1.r !== t1.r || e1.g !== t1.g || e1.b !== t1.b || e1.a !== t1.a || this.dirty) && (this.gl.clearColor(e1.r, e1.g, e1.b, e1.a), this.current = e1, this.dirty = !1); 40035 } 40036 } 40037 class sr extends tr { 40038 getDefault() { 40039 return 1; 40040 } 40041 set(e1) { 40042 (e1 !== this.current || this.dirty) && (this.gl.clearDepth(e1), this.current = e1, this.dirty = !1); 40043 } 40044 } 40045 class rr extends tr { 40046 getDefault() { 40047 return 0; 40048 } 40049 set(e1) { 40050 (e1 !== this.current || this.dirty) && (this.gl.clearStencil(e1), this.current = e1, this.dirty = !1); 40051 } 40052 } 40053 class or extends tr { 40054 getDefault() { 40055 return [ 40056 !0, 40057 !0, 40058 !0, 40059 !0 40060 ]; 40061 } 40062 set(e1) { 40063 const t1 = this.current;
40064 (e1[0] !== t1[0] || e1[1] !== t1[1] || e1[2] !== t1[2] || e1[3] !== t1[3] || this.dirty) && (this.gl.colorMask(e1[0], e1[1], e1[2], e1[3]), this.current = e1, this.dirty = !1); 40065 } 40066 } 40067 class nr extends tr { 40068 getDefault() { 40069 return !0; 40070 } 40071 set(e1) { 40072 (e1 !== this.current || this.dirty) && (this.gl.depthMask(e1), this.current = e1, this.dirty = !1); 40073 } 40074 } 40075 class ar extends tr { 40076 getDefault() { 40077 return 255; 40078 } 40079 set(e1) { 40080 (e1 !== this.current || this.dirty) && (this.gl.stencilMask(e1), this.current = e1, this.dirty = !1); 40081 } 40082 } 40083 class lr extends tr { 40084 getDefault() { 40085 return { 40086 func: this.gl.ALWAYS, 40087 ref: 0, 40088 mask: 255 40089 }; 40090 } 40091 set(e1) { 40092 const t1 = this.current; 40093 (e1.func !== t1.func || e1.ref !== t1.ref || e1.mask !== t1.mask || this.dirty) && (this.gl.stencilFunc(e1.func, e1.ref, e1.mask), this.current = e1, this.dirty = !1); 40094 } 40095 } 40096 class cr extends tr { 40097 getDefault() { 40098 const e1 = this.gl; 40099 return [ 40100 e1.KEEP, 40101 e1.KEEP, 40102 e1.KEEP 40103 ]; 40104 } 40105 set(e1) { 40106 const t1 = this.current; 40107 (e1[0] !== t1[0] || e1[1] !== t1[1] || e1[2] !== t1[2] || this.dirty) && (this.gl.stencilOp(e1[0], e1[1], e1[2]), this.current = e1, this.dirty = !1); 40108 } 40109 } 40110 class hr extends tr { 40111 getDefault() { 40112 return !1; 40113 } 40114 set(e1) { 40115 if (e1 === this.current && !this.dirty) return; 40116 const t1 = this.gl;
40117 e1 ? t1.enable(t1.STENCIL_TEST) : t1.disable(t1.STENCIL_TEST), this.current = e1, this.dirty = !1; 40118 } 40119 } 40120 class dr extends tr { 40121 getDefault() { 40122 return [ 40123 0, 40124 1 40125 ]; 40126 } 40127 set(e1) { 40128 const t1 = this.current; 40129 (e1[0] !== t1[0] || e1[1] !== t1[1] || this.dirty) && (this.gl.depthRange(e1[0], e1[1]), this.current = e1, this.dirty = !1); 40130 } 40131 } 40132 class ur extends tr { 40133 getDefault() { 40134 return !1; 40135 } 40136 set(e1) { 40137 if (e1 === this.current && !this.dirty) return; 40138 const t1 = this.gl; 40139 e1 ? t1.enable(t1.DEPTH_TEST) : t1.disable(t1.DEPTH_TEST), this.current = e1, this.dirty = !1; 40140 } 40141 } 40142 class pr extends tr { 40143 getDefault() { 40144 return this.gl.LESS; 40145 } 40146 set(e1) { 40147 (e1 !== this.current || this.dirty) && (this.gl.depthFunc(e1), this.current = e1, this.dirty = !1); 40148 } 40149 } 40150 class fr extends tr { 40151 getDefault() { 40152 return !1; 40153 } 40154 set(e1) { 40155 if (e1 === this.current && !this.dirty) return; 40156 const t1 = this.gl; 40157 e1 ? t1.enable(t1.BLEND) : t1.disable(t1.BLEND), this.current = e1, this.dirty = !1; 40158 } 40159 } 40160 class mr extends tr { 40161 getDefault() { 40162 const e1 = this.gl; 40163 return [ 40164 e1.ONE, 40165 e1.ZERO, 40166 e1.ONE, 40167 e1.ZERO 40168 ]; 40169 } 40170 set(e1) { 40171 const t1 = this.current; 40172 (e1[0] !== t1[0] || e1[1] !== t1[1] || e1[2] !== t1[2] || e1[3] !== t1[3] || this.dirty) && (this.gl.blendFuncSeparate(e1[0], e1[1], e1[2], e1[3]), this.current = e1, this.dirty = !1); 40173 } 40174 } 40175 class _r extends tr { 40176 getDefault() { 40177 return e1.C.transparent.toNonPremultipliedRenderColor(null); 40178 } 40179 set(e1) { 40180 const t1 = this.current; 40181 (e1.r !== t1.r || e1.g !== t1.g || e1.b !== t1.b || e1.a !== t1.a || this.dirty) && (this.gl.blendColor(e1.r, e1.g, e1.b, e1.a), this.current = e1, this.dirty = !1); 40182 } 40183 } 40184 class gr extends tr { 40185 getDefault() { 40186 return this.gl.FUNC_ADD; 40187 } 40188 set(e1) { 40189 (e1 !== this.current || this.dirty) && (this.gl.blendEquationSeparate(e1, e1), this.current = e1, this.dirty = !1); 40190 } 40191 } 40192 class yr extends tr { 40193 getDefault() { 40194 return !1; 40195 } 40196 set(e1) { 40197 if (e1 === this.current && !this.dirty) return; 40198 const t1 = this.gl; 40199 e1 ? t1.enable(t1.CULL_FACE) : t1.disable(t1.CULL_FACE), this.current = e1, this.dirty = !1; 40200 } 40201 } 40202 class vr extends tr { 40203 getDefault() { 40204 return this.gl.BACK; 40205 } 40206 set(e1) { 40207 (e1 !== this.current || this.dirty) && (this.gl.cullFace(e1), this.current = e1, this.dirty = !1); 40208 } 40209 } 40210 class br extends tr { 40211 getDefault() { 40212 return this.gl.CCW; 40213 } 40214 set(e1) { 40215 (e1 !== this.current || this.dirty) && (this.gl.frontFace(e1), this.current = e1, this.dirty = !1); 40216 } 40217 } 40218 let xr = class extends tr { 40219 getDefault() { 40220 return null; 40221 } 40222 set(e1) { 40223 (e1 !== this.current || this.dirty) && (this.gl.useProgram(e1), this.current = e1, this.dirty = !1); 40224 } 40225 }; 40226 class wr extends tr { 40227 getDefault() { 40228 return this.gl.TEXTURE0; 40229 } 40230 set(e1) { 40231 (e1 !== this.current || this.dirty) && (this.gl.activeTexture(e1), this.current = e1, this.dirty = !1); 40232 } 40233 } 40234 class Tr extends tr { 40235 getDefault() { 40236 const e1 = this.gl; 40237 return [ 40238 0, 40239 0, 40240 e1.drawingBufferWidth, 40241 e1.drawingBufferHeight 40242 ]; 40243 } 40244 set(e1) { 40245 const t1 = this.current;
40246 (e1[0] !== t1[0] || e1[1] !== t1[1] || e1[2] !== t1[2] || e1[3] !== t1[3] || this.dirty) && (this.gl.viewport(e1[0], e1[1], e1[2], e1[3]), this.current = e1, this.dirty = !1); 40247 } 40248 } 40249 class Sr extends tr { 40250 getDefault() { 40251 return null; 40252 } 40253 set(e1) { 40254 if (e1 === this.current && !this.dirty) return; 40255 const t1 = this.gl; 40256 t1.bindFramebuffer(t1.FRAMEBUFFER, e1), this.current = e1, this.dirty = !1; 40257 } 40258 } 40259 class Cr extends tr { 40260 getDefault() { 40261 return null; 40262 } 40263 set(e1) { 40264 if (e1 === this.current && !this.dirty) return; 40265 const t1 = this.gl; 40266 t1.bindRenderbuffer(t1.RENDERBUFFER, e1), this.current = e1, this.dirty = !1; 40267 } 40268 } 40269 class Er extends tr { 40270 getDefault() { 40271 return null; 40272 } 40273 set(e1) { 40274 if (e1 === this.current && !this.dirty) return; 40275 const t1 = this.gl; 40276 t1.bindTexture(t1.TEXTURE_2D, e1), this.current = e1, this.dirty = !1; 40277 } 40278 } 40279 class Ir extends tr { 40280 getDefault() { 40281 return null; 40282 } 40283 set(e1) { 40284 if (e1 === this.current && !this.dirty) return; 40285 const t1 = this.gl; 40286 t1.bindBuffer(t1.ARRAY_BUFFER, e1), this.current = e1, this.dirty = !1; 40287 } 40288 } 40289 class Dr extends tr { 40290 getDefault() { 40291 return null; 40292 } 40293 set(e1) { 40294 const t1 = this.gl; 40295 t1.bindBuffer(t1.ELEMENT_ARRAY_BUFFER, e1), this.current = e1, this.dirty = !1; 40296 } 40297 } 40298 class Pr extends tr { 40299 getDefault() { 40300 return null; 40301 } 40302 set(e1) { 40303 this.gl && (e1 !== this.current || this.dirty) && (this.gl.bindVertexArray(e1), this.current = e1, this.dirty = !1); 40304 } 40305 } 40306 class Lr extends tr { 40307 getDefault() { 40308 return 4; 40309 } 40310 set(e1) { 40311 if (e1 === this.current && !this.dirty) return; 40312 const t1 = this.gl; 40313 t1.pixelStorei(t1.UNPACK_ALIGNMENT, e1), this.current = e1, this.dirty = !1; 40314 } 40315 } 40316 class Rr extends tr { 40317 getDefault() { 40318 return !1; 40319 } 40320 set(e1) { 40321 if (e1 === this.current && !this.dirty) return; 40322 const t1 = this.gl; 40323 t1.pixelStorei(t1.UNPACK_PREMULTIPLY_ALPHA_WEBGL, e1), this.current = e1, this.dirty = !1; 40324 } 40325 } 40326 class Ar extends tr { 40327 getDefault() { 40328 return !1; 40329 } 40330 set(e1) { 40331 if (e1 === this.current && !this.dirty) return; 40332 const t1 = this.gl; 40333 t1.pixelStorei(t1.UNPACK_FLIP_Y_WEBGL, e1), this.current = e1, this.dirty = !1; 40334 } 40335 } 40336 class Mr extends tr { 40337 getDefault() { 40338 return null; 40339 } 40340 constructor(e1, t1){ 40341 super(e1), this.context = e1, this.parent = t1; 40342 } 40343 } 40344 class Or extends Mr { 40345 setDirty() { 40346 this.dirty = !0; 40347 } 40348 set(e1) { 40349 if (e1 === this.current && !this.dirty) return; 40350 this.context.bindFramebuffer.set(this.parent); 40351 const t1 = this.gl; 40352 t1.framebufferTexture2D(t1.FRAMEBUFFER, this.attachmentPoint, t1.TEXTURE_2D, e1, 0), this.current = e1, this.dirty = !1; 40353 } 40354 constructor(e1, t1, i = 0){ 40355 super(e1, t1), this.attachmentPoint = e1.gl.COLOR_ATTACHMENT0 + i; 40356 } 40357 } 40358 class Fr extends Mr { 40359 attachment() { 40360 return this.gl.DEPTH_ATTACHMENT; 40361 } 40362 set(e1) { 40363 if (e1 === this.current && !this.dirty) return; 40364 this.context.bindFramebuffer.set(this.parent); 40365 const t1 = this.gl; 40366 t1.framebufferRenderbuffer(t1.FRAMEBUFFER, this.attachment(), t1.RENDERBUFFER, e1), this.current = e1, this.dirty = !1; 40367 } 40368 } 40369 class kr extends Mr {
40370 attachment() { 40371 return this.gl.DEPTH_ATTACHMENT; 40372 } 40373 set(e1) { 40374 if (e1 === this.current && !this.dirty) return; 40375 this.context.bindFramebuffer.set(this.parent); 40376 const t1 = this.gl; 40377 t1.framebufferTexture2D(t1.FRAMEBUFFER, this.attachment(), t1.TEXTURE_2D, e1, 0), this.current = e1, this.dirty = !1; 40378 } 40379 } 40380 class Br extends Fr { 40381 attachment() { 40382 return this.gl.DEPTH_STENCIL_ATTACHMENT; 40383 } 40384 } 40385 const zr = (e1, t1, i, s)=>({ 40386 u_matrix: e1, 40387 u_image0: 0, 40388 u_image1: 1, 40389 u_skirt_height: t1, 40390 u_ground_shadow_factor: i, 40391 u_emissive_texture_available: s 40392 }), Ur = (e1, t1, i, s, r, o, n, a, l, c, h, d, u, p, f, m, _)=>({ 40393 u_proj_matrix: Float32Array.from(e1), 40394 u_globe_matrix: t1, 40395 u_normalize_matrix: Float32Array.from(s), 40396 u_merc_matrix: i, 40397 u_zoom_transition: r, 40398 u_merc_center: o, 40399 u_image0: 0, 40400 u_image1: 1, 40401 u_frustum_tl: n, 40402 u_frustum_tr: a, 40403 u_frustum_br: l, 40404 u_frustum_bl: c, 40405 u_globe_pos: h, 40406 u_globe_radius: d, 40407 u_viewport: u, 40408 u_grid_matrix: _ ? Float32Array.from(_) : new Float32Array(9), 40409 u_skirt_height: p, 40410 u_far_z_cutoff: f, 40411 u_emissive_texture_available: m 40412 }); 40413 function Nr(e1, t1) { 40414 return null != e1 && null != t1 && !(!e1.hasData() || !t1.hasData()) && null != e1.demTexture && null != t1.demTexture && e1.tileID.key !== t1.tileID.key; 40415 } 40416 const jr = new class { 40417 newMorphing(e1, t1, i, s, r) { 40418 if (e1 in this.operations) { 40419 const t1 = this.operations[e1]; 40420 t1.to.tileID.key !== i.tileID.key && (t1.queued = i); 40421 } else this.operations[e1] = { 40422 startTime: s, 40423 phase: 0, 40424 duration: r, 40425 from: t1, 40426 to: i, 40427 queued: null 40428 }; 40429 } 40430 getMorphValuesForProxy(e1) { 40431 if (!(e1 in this.operations)) return null; 40432 const t1 = this.operations[e1]; 40433 return { 40434 from: t1.from, 40435 to: t1.to, 40436 phase: t1.phase 40437 }; 40438 } 40439 update(e1) { 40440 for(const t1 in this.operations){ 40441 const i = this.operations[t1]; 40442 for(i.phase = (e1 - i.startTime) / i.duration; i.phase >= 1 || !this._validOp(i);)if (!this._nextOp(i, e1)) { 40443 delete this.operations[t1]; 40444 break; 40445 } 40446 } 40447 } 40448 _nextOp(e1, t1) { 40449 return !!e1.queued && (e1.from = e1.to, e1.to = e1.queued, e1.queued = null, e1.phase = 0, e1.startTime = t1, !0); 40450 } 40451 _validOp(e1) { 40452 return e1.from.hasData() && e1.to.hasData(); 40453 } 40454 constructor(){ 40455 this.operations = {}; 40456 } 40457 }; 40458 function Vr(e1, t1, i) { 40459 if (0 === t1) return 0; 40460 const s = t1 < 1 && 514 === i ? .25 / t1 : 1; 40461 return 6 * Math.pow(1.5, 22 - e1) * Math.max(t1, 1) * s; 40462 } 40463 function Gr(e1, t1) { 40464 const i = 1 << e1.z; 40465 return !t1 && (0 === e1.x || e1.x === i - 1) || 0 === e1.y || e1.y === i - 1; 40466 } 40467 function qr(e1, t1) { 40468 if (!e1.style || !e1.style.enable3dLights()) return; 40469 const i = e1.context, s = i.gl; 40470 i.activeTexture.set(s.TEXTURE1), t1 ? t1.bind(s.LINEAR, s.CLAMP_TO_EDGE) : e1.emptyTexture.bind(s.LINEAR, s.CLAMP_TO_EDGE); 40471 } 40472 class Zr extends e1.E { 40473 loaded() { 40474 return !0; 40475 } 40476 loadTile(e1, t1) { 40477 t1(null); 40478 } 40479 serialize() { 40480 return { 40481 type: this.type 40482 }; 40483 } 40484 constructor(e1, t1, i, s, r, o){ 40485 super(), this.id = e1, this.type = t1, this.tileSize = i, this.minzoom = s, this.maxzoom = r, this.roundZoom = !1, this.reparseOverscaled = o; 40486 } 40487 } 40488 class $r extends gs { 40489 _loadTile(e1, t1) { 40490 e1.state = "loaded", t1(null); 40491 } 40492 constructor(e1){ 40493 const t1 = new Zr("mock-dem", "raster-dem", 512, 0, Math.ceil(e1.transform.maxZoom), !1); 40494 super("mock-dem", t1, null), t1.setEventedParent(this), this._sourceLoaded = !0; 40495 } 40496 } 40497 class Hr extends gs { 40498 update(e1, t1, i) { 40499 if (e1.freezeTileCoverage) return; 40500 this.transform = e1; 40501 const s = e1.coveringTiles({ 40502 tileSize: this._source.tileSize, 40503 minzoom: this._source.minzoom, 40504 maxzoom: this._source.maxzoom, 40505 roundZoom: this._source.roundZoom, 40506 reparseOverscaled: this._source.reparseOverscaled 40507 }).reduce((t1, i)=>{ 40508 if (t1[i.key] = "", !this._tiles[i.key]) { 40509 const t1 = new fs(i, this._source.tileSize * i.overscaleFactor(), e1.tileZoom, void 0, void 0, this._source.w
vendor: 6,577 bytes, lines 40509-40601
40509orldview); 40510 t1.state = "loaded", this._tiles[i.key] = t1; 40511 } 40512 return t1; 40513 }, {}); 40514 for(const e1 in this._tiles)e1 in s || (this.freeFBO(e1), this._tiles[e1].unloadVectorData(), delete this._tiles[e1]); 40515 } 40516 freeFBO(e1) { 40517 const t1 = this.proxyCachedFBO[e1]; 40518 if (void 0 !== t1) { 40519 const i = Object.values(t1); 40520 this.renderCachePool.push(...i), delete this.proxyCachedFBO[e1]; 40521 } 40522 } 40523 deallocRenderCache() { 40524 this.renderCache.forEach((e1)=>e1.fb.destroy()), this.renderCache = [], this.renderCachePool = [], this.proxyCachedFBO = {}; 40525 } 40526 constructor(e1){ 40527 const t1 = new Zr("proxy", "geojson", 512, 0, Math.ceil(e1.transform.maxZoom), !0); 40528 super("proxy", t1, null), t1.setEventedParent(this), this.map = this.getSource().map = e1, this.used = this._sourceLoaded = !0, this.renderCache = [], this.renderCachePool = [], this.proxyCachedFBO = {}; 40529 } 40530 } 40531 class Wr extends e1.bP { 40532 constructor(e1, t1, i){ 40533 super(e1.overscaledZ, e1.wrap, e1.canonical.z, e1.canonical.x, e1.canonical.y), this.proxyTileKey = t1, this.projMatrix = i; 40534 } 40535 } 40536 class Xr extends e1.c3 { 40537 set style(e1) { 40538 e1.on("data", this._onStyleDataEvent.bind(this)), this._style = e1, this._style.map.on("moveend", ()=>{ 40539 this._clearLineLayersFromRenderCache(); 40540 }); 40541 } 40542 update(t1, i, s) { 40543 if (t1 && t1.terrain) { 40544 this._style !== t1 && (this.style = t1, this._evaluationZoom = void 0); 40545 const r = t1.terrain.properties, o = 0 === t1.terrain.drapeRenderMode, n = t1.terrain.isZoomDependent(); 40546 this._previousUpdateTimestamp = this.enabled ? this._updateTimestamp : void 0, this._updateTimestamp = e1.e.now(); 40547 const a = t1.terrain && t1.terrain.scope, l = r.get("source"), c = o ? this._mockSourceCache : t1.getSourceCache(l, a); 40548 if (!c) return void e1.w("Couldn't find terrain source \"".concat(l, '".')); 40549 if (this.sourceCache = c, this._attenuationRange = t1.terrain.getAttenuationRange(), this._exaggeration = n ? this.calculateExaggeration(i) : r.get("exaggeration"), !i.projection.requiresDraping && n && 0 === this._exaggeration) return void this._disable(); 40550 this.enabled = !0; 40551 const h = ()=>{ 40552 this.sourceCache.used && e1.w("Raster DEM source '".concat(this.sourceCache.id, "' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.")); 40553 const t1 = this.getScaledDemTileSize(); 40554 this.sourceCache.update(i, t1, !0), this.resetTileLookupCache(this.sourceCache.id); 40555 }; 40556 this.sourceCache.usedForTerrain || (this.resetTileLookupCache(this.sourceCache.id), this.sourceCache.usedForTerrain = !0, h(), this._initializing = !0), h(), i.updateElevation(!0, s), this.resetTileLookupCache(this.proxySourceCache.id), this.proxySourceCache.update(i), this._emptyDEMTextureDirty = !0, this._previousZoom = i.zoom; 40557 } else this._disable(); 40558 } 40559 calculateExaggeration(t1) { 40560 if (this._attenuationRange && t1.zoom >= Math.ceil(this._attenuationRange[1])) return this._style.terrain.getExaggeration(t1.zoom); 40561 const i = this._previousCameraAltitude, s = t1.getFreeCameraOptions().position.z / t1.pixelsPerMeter * t1.worldSize; 40562 this._previousCameraAltitude = s; 40563 const r = null != i ? s - i : Number.MAX_VALUE; 40564 if (Math.abs(r) < 2) return this._exaggeration; 40565 const o = t1.zoom, n = this._style.terrain; 40566 if (!this._previousUpdateTimestamp) return n.getExaggeration(o); 40567 let a = o - this._previousZoom; 40568 const l = this._previousUpdateTimestamp; 40569 let c = o; 40570 null != this._evaluationZoom && (c = this._evaluationZoom, Math.abs(o - c) > .5 && (a = .5 * (o - c + a)), a * r < 0 && (c += a)), this._evaluationZoom = c; 40571 const h = n.getExaggeration(c), d = h === n.getExaggeration(Math.max(0, c - .1)); 40572 if (d && Math.abs(h - this._exaggeration) < .01) return h; 40573 let u = Math.min(.1, .00375 * (this._updateTimestamp - l)); 40574 return (d || h < .1 || Math.abs(a) < 1e-4) && (u = Math.min(.2, 4 * u)), e1.al(this._exaggeration, h, u); 40575 } 40576 resetTileLookupCache(e1) { 40577 this._findCoveringTileCache[e1] = {}; 40578 } 40579 attenuationRange() { 40580 return this._attenuationRange; 40581 } 40582 getDemUpscale() { 40583 return this.proxySourceCache.getSource().tileSize / 128; 40584 } 40585 getScaledDemTileSize() { 40586 return this.sourceCache.getSource().tileSize / 128 * this.proxySourceCache.getSource().tileSize; 40587 } 40588 _onStyleDataEvent(e1) { 40589 "source" === e1.dataType && e1.coord ? this._clearRenderCacheForTile(e1.sourceCacheId, e1.coord) : "style" === e1.dataType && (this.invalidateRenderCache = !0, this._evaluationZoom = void 0, this._previousUpdateTimestamp = void 0, this._previousCameraAltitude = void 0); 40590 } 40591 _disable() { 40592 if (this.enabled && (this.enabled = !1, this._emptyDEMTextureDirty = !0, this._sharedDepthStencil = void 0, this._evaluationZoom = void 0, this._previousUpdateTimestamp = void 0, this.proxySourceCache.deallocRenderCache(), this._style)) for(const e1 in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e1].usedForTerrain = !1; 40593 } 40594 destroy() { 40595 this._disable(), this._emptyDEMTexture && this._emptyDEMTexture.destroy(), this.pool.forEach((e1)=>e1.fb.destroy()), this.pool = [], this.framebufferCopyTexture && this.framebufferCopyTexture.destroy(); 40596 } 40597 _source() { 40598 return this.enabled ? this.sourceCache : null; 40599 } 40600 isUsingMockSource() { 40601 return this.sourceCache === this._mockSourceCache;
40602 } 40603 exaggeration() { 40604 return this.enabled ? this._exaggeration : 0; 40605 } 40606 get visibleDemTiles() { 40607 return this._visibleDemTiles; 40608 } 40609 get drapeBufferSize() { 40610 const e1 = 2 * this.proxySourceCache.getSource().tileSize; 40611 return [ 40612 e1, 40613 e1 40614 ]; 40615 } 40616 set useVertexMorphing(e1) { 40617 this._useVertexMorphing = e1; 40618 } 40619 updateTileBinding(t1) { 40620 if (!this.enabled) return; 40621 this.prevTerrainTileForTile = this.terrainTileForTile; 40622 const i = this.proxySourceCache, s = this.painter.transform; 40623 this._initializing && (this._initializing = 0 === s._centerAltitude && -1 === this.getAtPointOrZero(e1.bS.fromLngLat(s.center), -1), this._emptyDEMTextureDirty = !this._initializing); 40624 const r = this.proxyCoords = i.getIds().map((e1)=>{ 40625 const t1 = i.getTileByID(e1).tileID; 40626 return t1.projMatrix = s.calculateProjMatrix(t1.toUnwrapped()), t1; 40627 }); 40628 !function(t1, i) { 40629 const s = i.transform.pointCoordinate(i.transform.getCameraPoint()), r = new e1.P(s.x, s.y); 40630 t1.sort((t1, i)=>{ 40631 if (i.overscaledZ - t1.overscaledZ) return i.overscaledZ - t1.overscaledZ; 40632 const s = new e1.P(t1.canonical.x + (1 << t1.canonical.z) * t1.wrap, t1.canonical.y), o = new e1.P(i.canonical.x + (1 << i.canonical.z) * i.wrap, i.canonical.y), n = r.mult(1 << t1.canonical.z); 40633 return n.x -= .5, n.y -= .5, n.distSqr(s) - n.distSqr(o); 40634 }); 40635 }(r, this.painter); 40636 const o = this.proxyToSource || {}; 40637 this.proxyToSource = {}, r.forEach((e1)=>{ 40638 this.proxyToSource[e1.key] = {}; 40639 }), this.terrainTileForTile = {}; 40640 const n = this._style._mergedSourceCaches; 40641 for(const e1 in n){ 40642 const i = n[e1]; 40643 if (!i.used) continue; 40644 if (!i.transform) continue; 40645 if (i !== this.sourceCache && this.resetTileLookupCache(i.id), this._setupProxiedCoordsForOrtho(i, t1[e1], o), i.usedForTerrain) continue; 40646 const s = t1[e1]; 40647 (i.getSource().reparseOverscaled || i._isRasterElevatedOverTerrain) && this._assignTerrainTiles(s); 40648 } 40649 this.proxiedCoords[i.id] = r.map((e1)=>new Wr(e1, e1.key, this.orthoMatrix)), this._assignTerrainTiles(r), this._prepareDEMTextures(), this._setupDrapedRenderBatches(), this._initFBOPool(), this._setupRenderCache(o), this.renderingToTexture = !1; 40650 const a = {}; 40651 this._visibleDemTiles = []; 40652 for (const e1 of this.proxyCoords){ 40653 const t1 = this.terrainTileForTile[e1.key]; 40654 if (!t1) continue; 40655 const i = t1.tileID.key; 40656 i in a || (this._visibleDemTiles.push(t1), a[i] = i); 40657 } 40658 } 40659 _assignTerrainTiles(e1) { 40660 this._initializing || e1.forEach((e1)=>{ 40661 if (this.terrainTileForTile[e1.key]) return; 40662 const t1 = this._findTileCoveringTileID(e1, this.sourceCache); 40663 t1 && (this.terrainTileForTile[e1.key] = t1); 40664 }); 40665 } 40666 _prepareDEMTextures() { 40667 const e1 = this.painter.context, t1 = e1.gl; 40668 for(const i in this.terrainTileForTile){ 40669 const s = this.terrainTileForTile[i], r = s.dem; 40670 !r || s.demTexture && !s.needsDEMTextureUpload || (e1.activeTexture.set(t1.TEXTURE1), Js(this.painter, s, r)); 40671 } 40672 } 40673 _prepareDemTileUniforms(e1, t1, i, s) { 40674 if (!t1 || null == t1.demTexture) return !1; 40675 const r = e1.tileID.canonical, o = Math.pow(2, t1.tileID.canonical.z - r.z), n = s || ""; 40676 return i["u_dem_tl".concat(n)] = [ 40677 r.x * o % 1, 40678 r.y * o % 1 40679 ], i["u_dem_scale".concat(n)] = o, !0; 40680 }
vendor: 38,273 bytes, lines 40681-41338
40681 get emptyDEMTexture() { 40682 return !this._emptyDEMTextureDirty && this._emptyDEMTexture ? this._emptyDEMTexture : this._updateEmptyDEMTexture(); 40683 } 40684 _getLoadedAreaMinimum() { 40685 if (!this.enabled) return 0; 40686 let e1 = 0; 40687 const t1 = this._visibleDemTiles.reduce((t1, i)=>{ 40688 if (!i.dem) return t1; 40689 const s = i.dem.tree.minimums[0]; 40690 return s > 0 && e1++, t1 + s; 40691 }, 0); 40692 return e1 ? t1 / e1 : 0; 40693 } 40694 _updateEmptyDEMTexture() { 40695 const t1 = this.painter.context, i = t1.gl; 40696 t1.activeTexture.set(i.TEXTURE2); 40697 const s = this._getLoadedAreaMinimum(), r = new e1.c4({ 40698 width: 1, 40699 height: 1 40700 }, new Float32Array([ 40701 s 40702 ])); 40703 this._emptyDEMTextureDirty = !1; 40704 let o = this._emptyDEMTexture; 40705 return o ? o.update(r, { 40706 premultiply: !1 40707 }) : o = this._emptyDEMTexture = new e1.T(t1, r, i.R32F, { 40708 premultiply: !1 40709 }), o; 40710 } 40711 setupElevationDraw(t1, i, s) { 40712 const r = this.painter.context, o = r.gl, n = { 40713 u_dem: 2, 40714 u_dem_prev: 4, 40715 u_dem_tl: [ 40716 0, 40717 0 40718 ], 40719 u_dem_tl_prev: [ 40720 0, 40721 0 40722 ], 40723 u_dem_scale: 0, 40724 u_dem_scale_prev: 0, 40725 u_dem_size: 0, 40726 u_dem_lerp: 1, 40727 u_depth: 3, 40728 u_depth_size_inv: [ 40729 0, 40730 0 40731 ], 40732 u_depth_range_unpack: [ 40733 0, 40734 1 40735 ], 40736 u_occluder_half_size: 16, 40737 u_occlusion_depth_offset: -1e-4, 40738 u_exaggeration: 0 40739 }; 40740 n.u_exaggeration = this.exaggeration(); 40741 let a = null, l = null, c = 1; 40742 if (s && s.morphing && this._useVertexMorphing) { 40743 const e1 = s.morphing.srcDemTile, i = s.morphing.dstDemTile; 40744 c = s.morphing.phase, e1 && i && (this._prepareDemTileUniforms(t1, e1, n, "_prev") && (l = e1), this._prepareDemTileUniforms(t1, i, n) && (a = i)); 40745 } 40746 const h = (e1)=>e1 && e1.demTexture && this.painter.linearFloatFilteringSupported() ? o.LINEAR : o.NEAREST; 40747 let d = null; 40748 var u; 40749 if (this.enabled ? l && a ? (d = a.demTexture, r.activeTexture.set(o.TEXTURE4), l.demTexture.bind(h(l), o.CLAMP_TO_EDGE), n.u_dem_lerp = c) : (a = this.terrainTileForTile[t1.tileID.key], d = this._prepareDemTileUniforms(t1, a, n) ? a.demTexture : this.emptyDEMTexture) : d = this.emptyDEMTexture, r.activeTexture.set(o.TEXTURE2), d && (n.u_dem_size = 1 === (u = d).size[0] ? 1 : u.size[0] - 2, d.bind(h(a), o.CLAMP_TO_EDGE)), this.painter.setupDepthForOcclusion(s && s.useDepthForOcclusion, i, n), s && s.useMeterToDem && a) { 40750 const t1 = (1 << a.tileID.canonical.z) * e1.c5(1, this.painter.transform.center.lat) * this.sourceCache.getSource().tileSize; 40751 n.u_meter_to_dem = t1; 40752 } 40753 if (s && s.labelPlaneMatrixInv && (n.u_label_plane_matrix_inv = s.labelPlaneMatrixInv), i.setTerrainUniformValues(r, n), "globe" === this.painter.transform.projection.name) { 40754 const e1 = this.globeUniformValues(this.painter.transform, t1.tileID.canonical, s && s.useDenormalizedUpVectorScale); 40755 i.setGlobeUniformValues(r, e1); 40756 } 40757 } 40758 globeUniformValues(t1, i, s) { 40759 const r = t1.projection; 40760 return { 40761 u_tile_tl_up: r.upVector(i, 0, 0), 40762 u_tile_tr_up: r.upVector(i, e1.a6, 0), 40763 u_tile_br_up: r.upVector(i, e1.a6, e1.a6), 40764 u_tile_bl_up: r.upVector(i, 0, e1.a6), 40765 u_tile_up_scale: s ? e1.c6(1) : r.upVectorScale(i, t1.center.lat, t1.worldSize).metersToTile 40766 }; 40767 } 40768 renderToBackBuffer(t1) { 40769 const i = this.painter, s = this.painter.context; 40770 0 !== t1.length && (s.bindFramebuffer.set(null), s.viewport.set([ 40771 0, 40772 0, 40773 i.width, 40774 i.height 40775 ]), i.gpuTimingDeferredRenderStart(), this.renderingToTexture = !1, function(t1, i, s, r, o) { 40776 if ("globe" === t1.transform.projection.name) !function(t1, i, s, r, o) { 40777 const n = t1.context, a = n.gl; 40778 let l, c; 40779 const h = t1.transform, d = e1.c1(t1, n, h), u = (e1, i)=>{ 40780 if (c === i) return; 40781 const s = []; 40782 1 === i && s.push("TERRAIN_VERTEX_MORPHING"), s.push("PROJECTION_GLOBE_VIEW"), d && s.push("CUSTOM_ANTIALIASING"); 40783 const r = t1.isTileAffectedByFog(e1); 40784 l = t1.getOrCreateProgram("globeRaster", { 40785 defines: s, 40786 overrideFog: r 40787 }), c = i; 40788 }, p = t1.colorModeForRenderPass(), f = new e1.Z(a.LEQUAL, e1.Z.ReadWrite, t1.depthRangeFor3D); 40789 jr.update(o); 40790 const m = e1.b6(h), _ = [ 40791 e1.a7(h.center.lng), 40792 e1.a8(h.center.lat) 40793 ], g = t1.globeSharedBuffers, y = [ 40794 h.width * e1.e.devicePixelRatio, 40795 h.height * e1.e.devicePixelRatio 40796 ], v = Float32Array.from(h.globeMatrix), b = { 40797 useDenormalizedUpVectorScale: !0 40798 }; 40799 { 40800 const h = t1.transform, d = Vr(h.zoom, i.exaggeration(), i.sourceCache._source.tileSize); 40801 c = -1; 40802 const x = a.TRIANGLES; 40803 for (const c of r){ 40804 const r = s.getTile(c), w = e1._.disabled, T = i.prevTerrainTileForTile[c.key], S = i.terrainTileForTile[c.key]; 40805 Nr(T, S) && jr.newMorphing(c.key, T, S, o, 250), qr(t1, r.emissiveTexture), n.activeTexture.set(a.TEXTURE0), r.texture && r.texture.bind(a.LINEAR, a.CLAMP_TO_EDGE); 40806 const C = jr.getMorphValuesForProxy(c.key), E = C ? 1 : 0; 40807 C && Object.assign(b, { 40808 morphing: { 40809 srcDemTile: C.from, 40810 dstDemTile: C.to, 40811 phase: e1.c0(C.phase) 40812 } 40813 }); 40814 const I = e1.b2(c.canonical), D = e1.b3(I.getCenter().lat), P = e1.b7(c.canonical, I, D, h.worldSize / h._pixelsPerMercatorPixel), L = e1.b4(e1.b5(c.canonical)), R = "mrt-fallback" === t1.emissiveMode ? 1 : 0, A = Ur(h.expandedFarZProjMatrix, v, m, L, e1.S(h.zoom), _, h.frustumCorners.TL, h.frustumCorners.TR, h.frustumCorners.BR, h.frustumCorners.BL, h.globeCenterInViewSpace, h.globeRadius, y, d, h._farZ, R, P); 40815 if (u(c, E), l && (i.setupElevationDraw(r, l, b), t1.uploadCommonUniforms(n, l, c.toUnwrapped()), g)) { 40816 const [i, s, r] = g.getGridBuffers(D, 0 !== d); 40817 l.draw(t1, x, f, w, p, e1.$.backCCW, A, "globe_raster", i, s, r); 40818 } 40819 } 40820 } 40821 if (g && (t1.renderDefaultNorthPole || t1.renderDefaultSouthPole)) { 40822 const o = [ 40823 "GLOBE_POLES", 40824 "PROJECTION_GLOBE_VIEW" 40825 ]; 40826 d && o.push("CUSTOM_ANTIALIASING"), l = t1.getOrCreateProgram("globeRaster", { 40827 defines: o 40828 }); 40829 for (const o of r){ 40830 const { x: r, y: c, z: d } = o.canonical, u = 0 === c, m = c === (1 << d) - 1, [v, x, w, T] = g.getPoleBuffers(d, !1); 40831 if (T && (u || m)) { 40832 const c = s.getTile(o); 40833 qr(t1, c.emissiveTexture), n.activeTexture.set(a.TEXTURE0), c.texture && c.texture.bind(a.LINEAR, a.CLAMP_TO_EDGE); 40834 let g = e1.c2(d, r, h); 40835 const S = e1.b4(e1.b5(o.canonical)), C = "mrt-fallback" === t1.emissiveMode ? 1 : 0, E = (i, s)=>i.draw(t1, a.TRIANGLES, f, e1._.disabled, p, e1.$.disabled, Ur(h.expandedFarZProjMatrix, g, g, S, 0, _, h.frustumCorners.TL, h.frustumCorners.TR, h.frustumCorners.BR, h.frustumCorners.BL, h.globeCenterInViewSpace, h.globeRadius, y, 0, h._farZ, C), "globe_pole_raster", s, w, T); 40836 i.setupElevationDraw(c, l, b), t1.uploadCommonUniforms(n, l, o.toUnwrapped()), u && t1.renderDefaultNorthPole && E(l, v), m && t1.renderDefaultSouthPole && (g = e1.aN(e1.Y(), g, [ 40837 1, 40838 -1, 40839 1 40840 ]), E(l, x)); 40841 } 40842 } 40843 } 40844 }(t1, i, s, r, o); 40845 else { 40846 const n = t1.context, a = n.gl; 40847 let l, c; 40848 const h = t1.shadowRenderer, d = e1.aE(t1, t1.longestCutoffRange), u = (e1)=>{ 40849 if (c === e1) return; 40850 const i = []; 40851 1 === e1 && i.push("TERRAIN_VERTEX_MORPHING"), d.shouldRenderCutoff && i.push("RENDER_CUTOFF"), h && (i.push("RENDER_SHADOWS"), h.useNormalOffset && i.push("NORMAL_OFFSET")), l = t1.getOrCreateProgram("terrainRaster", { 40852 defines: i 40853 }), c = e1; 40854 }, p = t1.colorModeForRenderPass(), f = new e1.Z(a.LEQUAL, e1.Z.ReadWrite, t1.depthRangeFor3D); 40855 jr.update(o); 40856 const m = t1.transform, _ = Vr(m.zoom, i.exaggeration(), i.sourceCache._source.tileSize); 40857 let g = [ 40858 0, 40859 0, 40860 0 40861 ]; 40862 if (h) { 40863 const i = t1.style.directionalLight, s = t1.style.ambientLight; 40864 i && s && (g = e1.aF(t1.style, i, s)); 40865 } 40866 { 40867 c = -1; 40868 const y = a.TRIANGLES, [v, b] = [ 40869 i.gridIndexBuffer, 40870 i.gridSegments 40871 ]; 40872 for (const c of r){ 40873 const r = s.getTile(c), x = e1._.disabled, w = i.prevTerrainTileForTile[c.key], T = i.terrainTileForTile[c.key]; 40874 Nr(w, T) && jr.newMorphing(c.key, w, T, o, 250), qr(t1, r.emissiveTexture), n.activeTexture.set(a.TEXTURE0), r.texture && r.texture.bind(a.LINEAR, a.CLAMP_TO_EDGE); 40875 const S = jr.getMorphValuesForProxy(c.key), C = S ? 1 : 0; 40876 let E; 40877 S && (E = { 40878 morphing: { 40879 srcDemTile: S.from, 40880 dstDemTile: S.to, 40881 phase: e1.c0(S.phase) 40882 } 40883 }); 40884 const I = "mrt-fallback" === t1.emissiveMode ? 1 : 0, D = zr(c.projMatrix, Gr(c.canonical, m.renderWorldCopies) ? _ / 10 : _, g, I); 40885 if (u(C), !l) continue; 40886 i.setupElevationDraw(r, l, E); 40887 const P = c.toUnwrapped(); 40888 h && h.setupShadows(P, l), t1.uploadCommonUniforms(n, l, P, null, d), l.draw(t1, y, f, x, p, e1.$.backCCW, D, "terrain_raster", i.gridBuffer, v, b); 40889 } 40890 } 40891 } 40892 }(i, this, this.proxySourceCache, t1, this._updateTimestamp), this.renderingToTexture = !0, i.gpuTimingDeferredRenderEnd(), t1.splice(0, t1.length)); 40893 } 40894 renderBatch(t1) { 40895 if (0 === this._drapedRenderBatches.length) return t1 + 1; 40896 this.renderingToTexture = !0; 40897 const i = this.painter, s = this.painter.context, r = this.proxySourceCache, o = this.proxiedCoords[r.id], n = this._drapedRenderBatches.shift(), a = i.style.order, l = []; 40898 this._updateFBOs("mrt-fallback" === i.emissiveMode); 40899 let c = 0; 40900 for (const h of o){ 40901 const o = r.getTileByID(h.proxyTileKey), d = r.proxyCachedFBO[h.key] ? r.proxyCachedFBO[h.key][t1] : void 0, u = void 0 !== d ? r.renderCache[d] : this.pool[c++], p = void 0 !== d; 40902 if (o.texture = u.tex, o.emissiveTexture = u.emissiveTex, p && !u.dirty) { 40903 l.push(o.tileID); 40904 continue; 40905 } 40906 s.bindFramebuffer.set(u.fb.framebuffer); 40907 const f = s.gl; 40908 let m; 40909 f.drawBuffers("mrt-fallback" === i.emissiveMode ? [ 40910 f.COLOR_ATTACHMENT0, 40911 f.COLOR_ATTACHMENT1 40912 ] : [ 40913 f.COLOR_ATTACHMENT0 40914 ]), this.renderedToTile = !1, u.dirty && (s.clear({ 40915 color: e1.C.transparent, 40916 stencil: 0 40917 }), u.dirty = !1); 40918 for(let e1 = n.start; e1 <= n.end; ++e1){ 40919 const t1 = i.style._mergedLayers[a[e1]]; 40920 if (t1.isHidden(i.transform.zoom)) continue; 40921 const r = i.style.getLayerSourceCache(t1), o = r ? this.proxyToSource[h.key][r.id] : [ 40922 h 40923 ]; 40924 if (!o) continue; 40925 const n = o; 40926 s.viewport.set([ 40927 0, 40928 0, 40929 u.fb.width, 40930 u.fb.height 40931 ]), m !== (r ? r.id : null) && (this._setupStencil(u, o, t1, r), m = r ? r.id : null), i.renderLayer(i, r, t1, n); 40932 } 40933 if (f.drawBuffers([ 40934 f.COLOR_ATTACHMENT0 40935 ]), 0 === this._drapedRenderBatches.length) for (const e1 of this._pendingGroundEffectLayers){ 40936 const t1 = i.style._mergedLayers[a[e1]]; 40937 if (t1.isHidden(i.transform.zoom)) continue; 40938 const r = i.style.getLayerSourceCache(t1), o = r ? this.proxyToSource[h.key][r.id] : [ 40939 h 40940 ]; 40941 if (!o) continue; 40942 const n = o; 40943 s.viewport.set([ 40944 0, 40945 0, 40946 u.fb.width, 40947 u.fb.height 40948 ]), m !== (r ? r.id : null) && (this._setupStencil(u, o, t1, r), m = r ? r.id : null), i.renderLayer(i, r, t1, n); 40949 } 40950 this.renderedToTile ? (u.dirty = !0, l.push(o.tileID)) : p || --c, 5 === c && (c = 0, this.renderToBackBuffer(l)); 40951 } 40952 return this.renderToBackBuffer(l), this.renderingToTexture = !1, s.bindFramebuffer.set(null), s.viewport.set([ 40953 0, 40954 0, 40955 i.width, 40956 i.height 40957 ]), n.end + 1; 40958 } 40959 postRender() {} 40960 isLayerOrderingCorrect(e1) { 40961 const t1 = e1.order.length; 40962 let i = -1, s = t1; 40963 for(let r = 0; r < t1; ++r)this._style.isLayerDraped(e1._mergedLayers[e1.order[r]]) ? i = Math.max(i, r) : s = Math.min(s, r); 40964 return s > i; 40965 } 40966 getMinElevationBelowMSL() { 40967 let e1 = 0; 40968 return this._visibleDemTiles.filter((e1)=>e1.dem).forEach((t1)=>{ 40969 e1 = Math.min(e1, t1.dem.tree.minimums[0]); 40970 }), 0 === e1 ? e1 : (e1 - 30) * this._exaggeration; 40971 } 40972 raycast(e1, t1, i) { 40973 if (!this._visibleDemTiles) return null; 40974 const s = this._visibleDemTiles.filter((e1)=>e1.dem).map((s)=>{ 40975 const r = s.tileID, o = 1 << r.overscaledZ, { x: n, y: a } = r.canonical, l = n / o, c = (n + 1) / o, h = a / o, d = (a + 1) / o; 40976 return { 40977 minx: l, 40978 miny: h, 40979 maxx: c, 40980 maxy: d, 40981 t: s.dem.tree.raycastRoot(l, h, c, d, e1, t1, i), 40982 tile: s 40983 }; 40984 }); 40985 s.sort((e1, t1)=>(null !== e1.t ? e1.t : Number.MAX_VALUE) - (null !== t1.t ? t1.t : Number.MAX_VALUE)); 40986 for (const r of s){ 40987 if (null == r.t) return null; 40988 const s = r.tile.dem.tree.raycast(r.minx, r.miny, r.maxx, r.maxy, e1, t1, i); 40989 if (null != s) return s; 40990 } 40991 return null; 40992 } 40993 _createFBO() { 40994 const t1 = this.painter.context, i = t1.gl, s = this.drapeBufferSize; 40995 t1.activeTexture.set(i.TEXTURE0); 40996 const r = new e1.T(t1, { 40997 width: s[0], 40998 height: s[1], 40999 data: null 41000 }, i.RGBA8); 41001 r.bind(i.LINEAR, i.CLAMP_TO_EDGE); 41002 const o = t1.createFramebuffer(s[0], s[1], 1, null); 41003 let n; 41004 return o.colorAttachment0.set(r.texture), this._emissiveTexture && (n = new e1.T(t1, { 41005 width: s[0], 41006 height: s[1], 41007 data: null 41008 }, i.R8), n.bind(i.LINEAR, i.CLAMP_TO_EDGE), o.createColorAttachment(t1, 1), o.colorAttachment1.set(n.texture)), o.depthAttachment = new Br(t1, o.framebuffer), void 0 === this._sharedDepthStencil ? (this._sharedDepthStencil = t1.createRenderbuffer(t1.gl.DEPTH_STENCIL, s[0], s[1]), this._stencilRef = 0, o.depthAttachment.set(this._sharedDepthStencil), t1.clear({ 41009 stencil: 0 41010 })) : o.depthAttachment.set(this._sharedDepthStencil), t1.extTextureFilterAnisotropic && i.texParameterf(i.TEXTURE_2D, t1.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, t1.extTextureFilterAnisotropicMax), { 41011 fb: o, 41012 tex: r, 41013 emissiveTex: n, 41014 dirty: !1 41015 }; 41016 } 41017 _updateFBOs(e1) { 41018 if (this._emissiveTexture !== e1) { 41019 for (const t1 of this.pool)this._updateFBO(t1, e1); 41020 for (const t1 of this.proxySourceCache.renderCache)this._updateFBO(t1, e1); 41021 this._emissiveTexture = e1; 41022 } 41023 } 41024 _updateFBO(t1, i) { 41025 const s = t1.fb, r = this.painter.context, o = r.gl, n = this.drapeBufferSize; 41026 if (i) { 41027 const i = new e1.T(r, { 41028 width: n[0], 41029 height: n[1], 41030 data: null 41031 }, o.R8); 41032 i.bind(o.LINEAR, o.CLAMP_TO_EDGE), t1.emissiveTex = i, s.createColorAttachment(r, 1), s.colorAttachment1.set(i.texture); 41033 } else t1.emissiveTex = void 0, s.removeColorAttachment(r, 1); 41034 t1.dirty = !0; 41035 } 41036 _initFBOPool() { 41037 for(; this.pool.length < Math.min(5, this.proxyCoords.length);)this.pool.push(this._createFBO()); 41038 } 41039 _shouldDisableRenderCache() { 41040 if (this._style.hasLightTransitions()) return !0; 41041 for(const e1 in this._style._mergedSourceCaches)if (this._style._mergedSourceCaches[e1].hasTransition()) return !0; 41042 return this._style.order.some((e1)=>{ 41043 const t1 = this._style._mergedLayers[e1], i = t1.isHidden(this.painter.transform.zoom); 41044 return "hillshade" === t1.type || "custom" === t1.type ? !i && t1.shouldRedrape() : !i && t1.hasTransition(); 41045 }); 41046 } 41047 _clearLineLayersFromRenderCache() { 41048 let t1 = !1; 41049 for (const e1 of this._style.getSources())if ("vector" === e1.type) { 41050 t1 = !0; 41051 break; 41052 } 41053 if (!t1) return; 41054 const i = {}; 41055 for(let t1 = 0; t1 < this._style.order.length; ++t1){ 41056 const s = this._style._mergedLayers[this._style.order[t1]], r = this._style.getLayerSourceCache(s); 41057 if (!r || i[r.id]) continue; 41058 if (s.isHidden(this.painter.transform.zoom) || "line" !== s.type) continue; 41059 const o = s.widthExpression(), n = s.emissiveStrengthExpression(); 41060 if (o instanceof e1.aj || n instanceof e1.aj) { 41061 i[r.id] = !0; 41062 for (const e1 of this.proxyCoords){ 41063 const t1 = this.proxyToSource[e1.key][r.id]; 41064 if (t1) for (const e1 of t1)this._clearRenderCacheForTile(r.id, e1); 41065 } 41066 } 41067 } 41068 } 41069 _clearRasterLayersFromRenderCache() { 41070 let e1 = !1; 41071 for(const t1 in this._style._mergedSourceCaches){ 41072 const i = this._style._mergedSourceCaches[t1]._source.type; 41073 if ("raster" === i || "raster-dem" === i || "raster-array" === i) { 41074 e1 = !0; 41075 break; 41076 } 41077 } 41078 if (!e1) return; 41079 const t1 = {}; 41080 for(let e1 = 0; e1 < this._style.order.length; ++e1){ 41081 const i = this._style._mergedLayers[this._style.order[e1]], s = this._style.getLayerSourceCache(i); 41082 if (!s || t1[s.id]) continue; 41083 if (i.isHidden(this.painter.transform.zoom) || "raster" !== i.type) continue; 41084 const r = i.paint.get("raster-fade-duration"); 41085 for (const e1 of this.proxyCoords){ 41086 const t1 = this.proxyToSource[e1.key][s.id]; 41087 if (t1) for (const e1 of t1){ 41088 const t1 = Ai(s.getTile(e1), s.findLoadedParent(e1, 0), s, this.painter.transform, r); 41089 (1 !== t1.opacity || 0 !== t1.mix) && this._clearRenderCacheForTile(s.id, e1); 41090 } 41091 } 41092 } 41093 } 41094 _setupDrapedRenderBatches() { 41095 this._style.updateDrapeFirstLayers(); 41096 const t1 = this._style.order, i = t1.length; 41097 if (0 === i) return; 41098 const s = []; 41099 this._pendingGroundEffectLayers = []; 41100 let r, o = 0, n = this._style._mergedLayers[t1[o]]; 41101 for(; !this._style.isLayerDraped(n) && n.isHidden(this.painter.transform.zoom) && ++o < i;)n = this._style._mergedLayers[t1[o]]; 41102 for(; o < i; ++o){ 41103 const e1 = this._style._mergedLayers[t1[o]]; 41104 e1.isHidden(this.painter.transform.zoom) || (this._style.isLayerDraped(e1) ? void 0 === r && (r = o) : ("fill-extrusion" === e1.type && this._pendingGroundEffectLayers.push(o), void 0 !== r && (s.push({ 41105 start: r, 41106 end: o - 1 41107 }), r = void 0))); 41108 } 41109 if (void 0 !== r && s.push({ 41110 start: r, 41111 end: o - 1 41112 }), 0 !== s.length) { 41113 const t1 = s.at(-1); 41114 this._pendingGroundEffectLayers.every((e1)=>e1 > t1.end) || e1.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers."); 41115 } 41116 this._drapedRenderBatches = s; 41117 } 41118 _setupRenderCache(e1) { 41119 const t1 = this.proxySourceCache; 41120 if (this._shouldDisableRenderCache() || this.invalidateRenderCache) { 41121 if (this.invalidateRenderCache = !1, t1.renderCache.length > t1.renderCachePool.length) { 41122 const e1 = Object.values(t1.proxyCachedFBO); 41123 t1.proxyCachedFBO = {}; 41124 for(let i = 0; i < e1.length; ++i){ 41125 const s = Object.values(e1[i]); 41126 t1.renderCachePool.push(...s); 41127 } 41128 } 41129 return; 41130 } 41131 this._clearRasterLayersFromRenderCache(); 41132 const i = this.proxyCoords, s = this._tilesDirty; 41133 for(let r = i.length - 1; r >= 0; r--){ 41134 const o = i[r]; 41135 if (t1.getTileByID(o.key), void 0 !== t1.proxyCachedFBO[o.key]) { 41136 const i = e1[o.key], r = this.proxyToSource[o.key]; 41137 let n = 0; 41138 for(const e1 in r){ 41139 const t1 = r[e1], o = i[e1]; 41140 if (!o || o.length !== t1.length || t1.some((t1, i)=>t1 !== o[i] || s[e1] && Object.hasOwn(s[e1], t1.key))) { 41141 n = -1; 41142 break; 41143 } 41144 ++n; 41145 } 41146 for(const e1 in t1.proxyCachedFBO[o.key])t1.renderCache[t1.proxyCachedFBO[o.key][e1]].dirty = n < 0 || n !== Object.values(i).length; 41147 } 41148 } 41149 const r = [ 41150 ...this._drapedRenderBatches 41151 ]; 41152 r.sort((e1, t1)=>t1.end - t1.start - (e1.end - e1.start)); 41153 for (const e1 of r)for (const s of i){ 41154 if (t1.proxyCachedFBO[s.key]) continue; 41155 let i = t1.renderCachePool.pop(); 41156 void 0 === i && t1.renderCache.length < 50 && (i = t1.renderCache.length, t1.renderCache.push(this._createFBO())), void 0 !== i && (t1.proxyCachedFBO[s.key] = {}, t1.proxyCachedFBO[s.key][e1.start] = i, t1.renderCache[i].dirty = !0); 41157 } 41158 this._tilesDirty = {}; 41159 } 41160 _setupStencil(e1, t1, i, s) { 41161 if (!s || !this._sourceTilesOverlap[s.id]) return void (this._overlapStencilType && (this._overlapStencilType = !1)); 41162 const r = this.painter.context, o = r.gl; 41163 if (t1.length <= 1) return void (this._overlapStencilType = !1); 41164 let n; 41165 if (i.isTileClipped()) n = t1.length, this._overlapStencilMode.test = { 41166 func: o.EQUAL, 41167 mask: 255 41168 }, this._overlapStencilType = "Clip"; 41169 else { 41170 if (!(t1[0].overscaledZ > t1.at(-1).overscaledZ)) return void (this._overlapStencilType = !1); 41171 n = 1, this._overlapStencilMode.test = { 41172 func: o.GREATER, 41173 mask: 255 41174 }, this._overlapStencilType = "Mask"; 41175 } 41176 this._stencilRef + n > 255 && (r.clear({ 41177 stencil: 0 41178 }), this._stencilRef = 0), this._stencilRef += n, this._overlapStencilMode.ref = this._stencilRef, i.isTileClipped() && this._renderTileClippingMasks(t1, this._overlapStencilMode.ref); 41179 } 41180 clipOrMaskOverlapStencilType() { 41181 return "Clip" === this._overlapStencilType || "Mask" === this._overlapStencilType; 41182 } 41183 stencilModeForRTTOverlap(t1) { 41184 return this.renderingToTexture && this._overlapStencilType ? ("Clip" === this._overlapStencilType && (this._overlapStencilMode.ref = this.painter._tileClippingMaskIDs[t1.key]), this._overlapStencilMode) : e1._.disabled; 41185 } 41186 _renderTileClippingMasks(t1, i) { 41187 const s = this.painter, r = this.painter.context, o = r.gl; 41188 s._tileClippingMaskIDs = {}, r.setColorMode(e1.a1.disabled), r.setDepthMode(e1.Z.disabled); 41189 const n = s.getOrCreateProgram("clippingMask"); 41190 for (const r of t1){ 41191 const t1 = s._tileClippingMaskIDs[r.key] = --i; 41192 n.draw(s, o.TRIANGLES, e1.Z.disabled, new e1._({ 41193 func: o.ALWAYS, 41194 mask: 0 41195 }, t1, 255, o.KEEP, o.KEEP, o.REPLACE), e1.a1.disabled, e1.$.disabled, Us(r.projMatrix), "$clipping", s.tileExtentBuffer, s.quadTriangleIndexBuffer, s.tileExtentSegments); 41196 } 41197 } 41198 pointCoordinate(t1) { 41199 const i = this.painter.transform; 41200 if (t1.x < 0 || t1.x > i.width || t1.y < 0 || t1.y > i.height) return null; 41201 const s = [ 41202 t1.x, 41203 t1.y, 41204 1, 41205 1 41206 ]; 41207 e1.c7(s, s, i.pixelMatrixInverse), e1.c8(s, s, 1 / s[3]), s[0] /= i.worldSize, s[1] /= i.worldSize; 41208 const r = i._camera.position, o = e1.c5(1, i.center.lat), n = [ 41209 r[0], 41210 r[1], 41211 r[2] / o, 41212 0 41213 ], a = e1.c9([], s.slice(0, 3), n); 41214 e1.ca(a, a); 41215 const l = this.raycast(n, a, this._exaggeration); 41216 return null !== l && l ? (e1.cb(n, n, a, l), n[3] = n[2], n[2] *= o, n) : null; 41217 } 41218 _setupProxiedCoordsForOrtho(e1, t1, i) { 41219 if ([ 41220 "image", 41221 "video", 41222 "canvas" 41223 ].includes(e1.getSource().type)) return this._setupProxiedCoordsForImageSource(e1, t1, i); 41224 this._findCoveringTileCache[e1.id] = this._findCoveringTileCache[e1.id] || {}; 41225 const s = this.proxiedCoords[e1.id] = [], r = this.proxyCoords; 41226 for(let t1 = 0; t1 < r.length; t1++){ 41227 const o = r[t1], n = this._findTileCoveringTileID(o, e1); 41228 if (n) { 41229 const t1 = this._createProxiedId(o, n, i[o.key] && i[o.key][e1.id]); 41230 s.push(t1), this.proxyToSource[o.key][e1.id] = [ 41231 t1 41232 ]; 41233 } 41234 } 41235 let o = !1; 41236 const n = new Set; 41237 for(let r = 0; r < t1.length; r++){ 41238 const a = e1.getTile(t1[r]); 41239 if (!a || !a.hasData()) continue; 41240 const l = this._findTileCoveringTileID(a.tileID, this.proxySourceCache); 41241 if (l && l.tileID.canonical.z !== a.tileID.canonical.z) { 41242 const t1 = this.proxyToSource[l.tileID.key][e1.id], r = this._createProxiedId(l.tileID, a, i[l.tileID.key] && i[l.tileID.key][e1.id]); 41243 t1 ? t1.splice(t1.length - 1, 0, r) : this.proxyToSource[l.tileID.key][e1.id] = [ 41244 r 41245 ]; 41246 const c = this.proxyToSource[l.tileID.key][e1.id]; 41247 n.has(c) || n.add(c), s.push(r), o = !0; 41248 } 41249 } 41250 if (this._sourceTilesOverlap[e1.id] = o, o) for (const e1 of n)e1.sort((e1, t1)=>t1.overscaledZ - e1.overscaledZ); 41251 } 41252 _setupProxiedCoordsForImageSource(t1, i, s) { 41253 if (!t1.getSource().loaded()) return; 41254 const r = this.proxiedCoords[t1.id] = [], o = this.proxyCoords, n = t1.getSource(), a = n.tileID; 41255 if (!a) return; 41256 const l = new e1.P(a.x, a.y)._div(1 << a.z), c = n.coordinates.map(e1.bS.fromLngLat).reduce((e1, t1)=>(e1.min.x = Math.min(e1.min.x, t1.x - l.x), e1.min.y = Math.min(e1.min.y, t1.y - l.y), e1.max.x = Math.max(e1.max.x, t1.x - l.x), e1.max.y = Math.max(e1.max.y, t1.y - l.y), e1), { 41257 min: new e1.P(Number.MAX_VALUE, Number.MAX_VALUE), 41258 max: new e1.P(-Number.MAX_VALUE, -Number.MAX_VALUE) 41259 }), h = (t1, i)=>{ 41260 const s = t1.wrap + t1.canonical.x / (1 << t1.canonical.z), r = t1.canonical.y / (1 << t1.canonical.z), o = e1.a6 / (1 << t1.canonical.z), n = i.wrap + i.canonical.x / (1 << i.canonical.z), a = i.canonical.y / (1 << i.canonical.z); 41261 return s + o < n + c.min.x || s > n + c.max.x || r + o < a + c.min.y || r > a + c.max.y; 41262 }; 41263 for(let e1 = 0; e1 < o.length; e1++){ 41264 const n = o[e1]; 41265 for(let e1 = 0; e1 < i.length; e1++){ 41266 const o = t1.getTile(i[e1]); 41267 if (!o || !o.hasData()) continue; 41268 if (h(n, o.tileID)) continue; 41269 const a = this._createProxiedId(n, o, s[n.key] && s[n.key][t1.id]), l = this.proxyToSource[n.key][t1.id]; 41270 l ? l.push(a) : this.proxyToSource[n.key][t1.id] = [ 41271 a 41272 ], r.push(a); 41273 } 41274 } 41275 } 41276 _createProxiedId(t1, i, s) { 41277 let r = this.orthoMatrix; 41278 if (s) { 41279 const e1 = s.find((e1)=>e1.key === i.tileID.key); 41280 if (e1) return e1; 41281 } 41282 if (i.tileID.key !== t1.key) { 41283 const s = t1.canonical.z - i.tileID.canonical.z; 41284 let o, n, a; 41285 r = e1.Y(); 41286 const l = i.tileID.wrap - t1.wrap << t1.overscaledZ; 41287 s > 0 ? (o = e1.a6 >> s, n = o * ((i.tileID.canonical.x << s) - t1.canonical.x + l), a = o * ((i.tileID.canonical.y << s) - t1.canonical.y)) : (o = e1.a6 << -s, n = e1.a6 * (i.tileID.canonical.x - (t1.canonical.x + l << -s)), a = e1.a6 * (i.tileID.canonical.y - (t1.canonical.y << -s))), e1.b_(r, 0, o, 0, o, 0, 1), e1.bM(r, r, [ 41288 n, 41289 a, 41290 0 41291 ]); 41292 } 41293 return new Wr(i.tileID, t1.key, r); 41294 } 41295 _findTileCoveringTileID(t1, i) { 41296 let s = i.getTile(t1); 41297 if (s && s.hasData()) return s; 41298 const r = this._findCoveringTileCache[i.id], o = r[t1.key]; 41299 if (s = o ? i.getTileByID(o) : null, s && s.hasData() || null === o) return s; 41300 let n = s ? s.tileID : t1, a = n.overscaledZ; 41301 const l = i.getSource().minzoom, c = []; 41302 if (!o) { 41303 const r = i.getSource().maxzoom; 41304 if (t1.canonical.z >= r) { 41305 const s = t1.canonical.z - r; 41306 i.getSource().reparseOverscaled ? (a = Math.max(t1.canonical.z + 2, i.transform.tileZoom), n = new e1.bP(a, t1.wrap, r, t1.canonical.x >> s, t1.canonical.y >> s)) : 0 !== s && (a = r, n = new e1.bP(a, t1.wrap, r, t1.canonical.x >> s, t1.canonical.y >> s)); 41307 } 41308 n.key !== t1.key && (c.push(n.key), s = i.getTile(n)); 41309 } 41310 const h = (e1)=>{ 41311 c.forEach((t1)=>{ 41312 r[t1] = e1; 41313 }), c.length = 0; 41314 }; 41315 for(a -= 1; a >= l && (!s || !s.hasData()); a--){ 41316 s && h(s.tileID.key); 41317 const e1 = n.calculateScaledKey(a); 41318 if (s = i.getTileByID(e1), s && s.hasData()) break; 41319 const t1 = r[e1]; 41320 if (null === t1) break; 41321 void 0 === t1 ? c.push(e1) : s = i.getTileByID(t1); 41322 } 41323 return h(s ? s.tileID.key : null), s && s.hasData() ? s : null; 41324 } 41325 findDEMTileFor(e1) { 41326 return this.enabled ? this._findTileCoveringTileID(e1, this.sourceCache) : null; 41327 } 41328 prepareDrawTile() { 41329 this.renderedToTile = !0; 41330 } 41331 _clearRenderCacheForTile(e1, t1) { 41332 let i = this._tilesDirty[e1]; 41333 i || (i = this._tilesDirty[e1] = {}), i[t1.key] = !0; 41334 } 41335 constructor(t1, i){ 41336 super(), this.painter = t1, this.terrainTileForTile = {}, this.prevTerrainTileForTile = {}; 41337 const [s, r, o] = function() { 41338 const t1 = new e1.bC, i = new e1.ad, s = 131;
41339 t1.reserve(17161), i.reserve(33800); 41340 const r = e1.a6 / 128, o = e1.a6 + r / 2, n = o + r; 41341 for(let i = -r; i < n; i += r)for(let s = -r; s < n; s += r){ 41342 const r = s < 0 || s > o || i < 0 || i > o ? 24575 : 0, n = e1.b0(Math.round(s), 0, e1.a6), a = e1.b0(Math.round(i), 0, e1.a6); 41343 t1.emplaceBack(n + r, a); 41344 } 41345 const a = (e1, t1)=>{ 41346 const r = t1 * s + e1; 41347 i.emplaceBack(r + 1, r, r + s), i.emplaceBack(r + s, r + s + 1, r + 1); 41348 }; 41349 for(let e1 = 1; e1 < 129; e1++)for(let t1 = 1; t1 < 129; t1++)a(t1, e1); 41350 return [ 41351 0, 41352 129 41353 ].forEach((e1)=>{ 41354 for(let t1 = 0; t1 < 130; t1++)a(t1, e1), a(e1, t1); 41355 }), [ 41356 t1, 41357 i, 41358 32768 41359 ]; 41360 }(), n = t1.context; 41361 this.gridBuffer = n.createVertexBuffer(s, e1.bE.members), this.gridIndexBuffer = n.createIndexBuffer(r), this.gridSegments = e1.ac.simpleSegment(0, 0, s.length, r.length), this.gridNoSkirtSegments = e1.ac.simpleSegment(0, 0, s.length, o), this.proxyCoords = [], this.proxiedCoords = {}, this._visibleDemTiles = [], this._drapedRenderBatches = [], this._sourceTilesOverlap = {}, this.proxySourceCache = new Hr(i.map), this.orthoMatrix = e1.Y(), e1.b_(this.orthoMatrix, "globe" === this.painter.transform.projection.name ? .015 : 0, e1.a6, 0, e1.a6, 0, 1); 41362 const a = n.gl; 41363 this._overlapStencilMode = new e1._({ 41364 func: a.GEQUAL, 41365 mask: 255 41366 }, 0, 255, a.KEEP, a.KEEP, a.REPLACE), this._previousZoom = t1.transform.zoom, this.pool = [], this._findCoveringTileCache = {}, this._tilesDirty = {}, this.style = i, this._useVertexMorphing = !0, this._exaggeration = 1, this._mockSourceCache = new $r(i.map), this._pendingGroundEffectLayers = [], this._emissiveTexture = !1, this._devtoolsFolder = null; 41367 } 41368 } 41369 let Kr = null; 41370 const Yr = []; 41371 function Qr(e1, t1) { 41372 return Kr ? Kr.create(e1, t1) : null; 41373 } 41374 const Jr = (e1, t1, i)=>({ 41375 u_matrix: e1, 41376 u_emissive_strength: t1, 41377 u_ground_shadow_factor: i, 41378 u_opacity_multiplier: 1 41379 }), eo = function(t1, i, s, r, o) { 41380 let n = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0; 41381 return Object.assign(Jr(t1, i, o), e1.cc(s, r, n)); 41382 }, to = (e1, t1, i, s)=>({ 41383 u_matrix: e1, 41384 u_world: i, 41385 u_emissive_strength: t1, 41386 u_ground_shadow_factor: s, 41387 u_opacity_multiplier: 1 41388 }), io = function(e1, t1, i, s, r, o) { 41389 let n = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 0; 41390 return Object.assign(eo(e1, t1, i, s, o, n), { 41391 u_world: r 41392 }); 41393 }, so = (e1, t1, i)=>({ 41394 u_image: e1, 41395 u_texel_size: t1, 41396 u_first_pass: i ? 1 : 0 41397 }), ro = e1.Y(), oo = (t1, i, s, r, o, n, a)=>{ 41398 const l = t1.transform, c = "globe" === l.projection.name, h = c ? e1.cd(l.zoom, i.canonical) * l._pixelsPerMercatorPixel : e1.ce(s, 1, n), d = { 41399 u_matrix: i.projMatrix, 41400 u_extrude_scale: h, 41401 u_intensity: a, 41402 u_inv_rot_matrix: ro, 41403 u_merc_center: [ 41404 0, 41405 0 41406 ], 41407 u_tile_id: [ 41408 0, 41409 0, 41410 0 41411 ], 41412 u_zoom_transition: 0, 41413 u_up_dir: [ 41414 0, 41415 0, 41416 0 41417 ] 41418 }; 41419 if (c) { 41420 d.u_inv_rot_matrix = r, d.u_merc_center = o, d.u_tile_id = [ 41421 i.canonical.x, 41422 i.canonical.y, 41423 1 << i.canonical.z
vendor: 16,384 bytes, lines 41424-41801
41424 ], d.u_zoom_transition = e1.S(l.zoom); 41425 const t1 = o[0] * e1.a6, s = o[1] * e1.a6; 41426 d.u_up_dir = l.projection.upVector(new e1.bX(0, 0, 0), t1, s); 41427 } 41428 return d; 41429 }; 41430 function no(t1) { 41431 const i = t1.terrain ? t1.terrain.exaggeration() : 1; 41432 return (t1.transform.pitch < 15 ? e1.al(.07, .7, e1.b0((14 - t1.transform.zoom) / 5, 0, 1)) : .07) * i; 41433 } 41434 const ao = (t1, i, s, r, o, n, a, l, c, h, d, u, p, f, m, _, g, y, v, b, x, w)=>({ 41435 u_matrix: i, 41436 u_normalize_matrix: s, 41437 u_globe_matrix: r, 41438 u_merc_matrix: o, 41439 u_grid_matrix: n, 41440 u_tl_parent: a, 41441 u_scale_parent: d, 41442 u_fade_t: u.mix, 41443 u_opacity: u.opacity * p.paint.get("raster-opacity"), 41444 u_image0: 0, 41445 u_image1: 1, 41446 u_brightness_low: p.paint.get("raster-brightness-min"), 41447 u_brightness_high: p.paint.get("raster-brightness-max"), 41448 u_saturation_factor: e1.ch(p.paint.get("raster-saturation")), 41449 u_contrast_factor: e1.cg(p.paint.get("raster-contrast")), 41450 u_spin_weights: lo(p.paint.get("raster-hue-rotate")), 41451 u_perspective_transform: f, 41452 u_raster_elevation: m, 41453 u_zoom_transition: l, 41454 u_merc_center: c, 41455 u_cutoff_params: h, 41456 u_colorization_mix: Di(e1.cf, g, v), 41457 u_colorization_offset: Pi(e1.cf, y, v), 41458 u_color_ramp: _, 41459 u_color_ramp_size: e1.cf, 41460 u_texture_offset: [ 41461 x / (b + 2 * x), 41462 b / (b + 2 * x) 41463 ], 41464 u_texture_res: [ 41465 b + 2 * x, 41466 b + 2 * x 41467 ], 41468 u_emissive_strength: w, 41469 u_zbias_factor: no(t1) 41470 }); 41471 function lo(e1) { 41472 e1 *= Math.PI / 180; 41473 const t1 = Math.sin(e1), i = Math.cos(e1); 41474 return [ 41475 (2 * i + 1) / 3, 41476 (-Math.sqrt(3) * t1 - i + 1) / 3, 41477 (Math.sqrt(3) * t1 - i + 1) / 3 41478 ]; 41479 } 41480 const co = e1.Y(), ho = (t1, i, s, r, o, n, a, l, c, h, d, u, p, f, m, _, g, y, v, b, x, w, T, S, C)=>{ 41481 const E = o.transform, I = { 41482 u_is_size_zoom_constant: +("constant" === t1 || "source" === t1), 41483 u_is_size_feature_constant: +("constant" === t1 || "camera" === t1), 41484 u_size_t: i ? i.uSizeT : 0, 41485 u_size: i ? i.uSize : 0, 41486 u_camera_to_center_distance: E.getCameraToCenterDistance(b), 41487 u_rotate_symbol: +s, 41488 u_aspect_ratio: E.width / E.height, 41489 u_fade_change: o.options.fadeDuration ? o.symbolFadeChange : 1, 41490 u_matrix: n, 41491 u_label_plane_matrix: a, 41492 u_coord_matrix: l, 41493 u_is_text: +h, 41494 u_is_sdf: +d, 41495 u_elevation_from_sea: c ? 1 : 0, 41496 u_pitch_with_map: +r, 41497 u_texsize: u, 41498 u_texsize_icon: p, 41499 u_texture: 0, 41500 u_texture_icon: 1, 41501 u_tile_id: [ 41502 0, 41503 0, 41504 0 41505 ], 41506 u_zoom_transition: 0, 41507 u_inv_rot_matrix: co, 41508 u_merc_center: [ 41509 0, 41510 0 41511 ], 41512 u_camera_forward: [ 41513 0, 41514 0, 41515 0 41516 ], 41517 u_ecef_origin: [ 41518 0, 41519 0, 41520 0 41521 ], 41522 u_tile_matrix: co, 41523 u_up_vector: [ 41524 0, 41525 -1, 41526 0 41527 ], 41528 u_color_adj_mat: T, 41529 u_icon_transition: S || 0, 41530 u_gamma_scale: d ? r ? o.transform.getCameraToCenterDistance(b) * Math.cos(o.terrain ? 0 : o.transform._pitch) : 1 : 0, 41531 u_device_pixel_ratio: e1.e.devicePixelRatio, 41532 u_is_halo: 1, 41533 u_scale_factor: C || 1, 41534 u_ground_shadow_factor: x, 41535 u_inv_matrix: e1.aO(e1.Y(), a), 41536 u_normal_scale: w, 41537 u_lutTexture: e1.cj.LUT, 41538 u_spp_fill_np_color: [ 41539 0, 41540 0, 41541 0, 41542 1 41543 ], 41544 u_spp_halo_np_color: [ 41545 0, 41546 0, 41547 0, 41548 0 41549 ], 41550 u_spp_opacity: 1, 41551 u_spp_halo_width: 0, 41552 u_spp_halo_blur: 0, 41553 u_spp_emissive_strength: 0, 41554 u_spp_occlusion_opacity: 1, 41555 u_spp_z_offset: 0, 41556 u_spp_translate_rotation: [ 41557 1, 41558 0 41559 ], 41560 u_spp_zoom_fraction: 0, 41561 u_opacity_multiplier: 1 41562 }; 41563 return "globe" === b.name && (I.u_tile_id = [ 41564 m.canonical.x, 41565 m.canonical.y, 41566 1 << m.canonical.z 41567 ], I.u_zoom_transition = _, I.u_inv_rot_matrix = y, I.u_merc_center = g, I.u_camera_forward = E._camera.forward(), I.u_ecef_origin = e1.ci(E.globeMatrix, m.toUnwrapped()), I.u_tile_matrix = E.globeMatrix, I.u_up_vector = v), I; 41568 }, uo = (e1, t1, i, s)=>({ 41569 u_matrix: e1, 41570 u_emissive_strength: t1, 41571 u_opacity: i, 41572 u_color: s 41573 }), po = (t1, i, s, r, o, n, a, l, c)=>Object.assign(e1.ck(o, n, a, r, l, c), { 41574 u_matrix: t1, 41575 u_emissive_strength: i, 41576 u_opacity: s 41577 }), fo = { 41578 fillExtrusion: e1.cq, 41579 fillExtrusionPattern: e1.cp, 41580 fill: (t1)=>({ 41581 u_matrix: new e1.a4(t1), 41582 u_emissive_strength: new e1.a3(t1), 41583 u_ground_shadow_factor: new e1.a5(t1), 41584 u_opacity_multiplier: new e1.a3(t1) 41585 }), 41586 fillPattern: (t1)=>({ 41587 u_matrix: new e1.a4(t1), 41588 u_emissive_strength: new e1.a3(t1), 41589 u_image: new e1.aX(t1), 41590 u_texsize: new e1.a2(t1), 41591 u_pixel_coord_upper: new e1.a2(t1), 41592 u_pixel_coord_lower: new e1.a2(t1), 41593 u_tile_units_to_pixels: new e1.a3(t1), 41594 u_ground_shadow_factor: new e1.a5(t1), 41595 u_pattern_transition: new e1.a3(t1), 41596 u_opacity_multiplier: new e1.a3(t1) 41597 }), 41598 fillOutline: (t1)=>({ 41599 u_matrix: new e1.a4(t1), 41600 u_emissive_strength: new e1.a3(t1), 41601 u_world: new e1.a2(t1), 41602 u_ground_shadow_factor: new e1.a5(t1), 41603 u_opacity_multiplier: new e1.a3(t1) 41604 }), 41605 fillOutlinePattern: (t1)=>({ 41606 u_matrix: new e1.a4(t1), 41607 u_emissive_strength: new e1.a3(t1), 41608 u_world: new e1.a2(t1), 41609 u_image: new e1.aX(t1), 41610 u_texsize: new e1.a2(t1), 41611 u_pixel_coord_upper: new e1.a2(t1), 41612 u_pixel_coord_lower: new e1.a2(t1), 41613 u_tile_units_to_pixels: new e1.a3(t1), 41614 u_ground_shadow_factor: new e1.a5(t1), 41615 u_pattern_transition: new e1.a3(t1), 41616 u_opacity_multiplier: new e1.a3(t1) 41617 }), 41618 lineBlendComposite: (t1)=>({ 41619 u_image: new e1.aX(t1), 41620 u_opacity: new e1.a3(t1), 41621 u_blend_mode: new e1.aX(t1), 41622 u_max_density: new e1.a3(t1) 41623 }), 41624 lineBlendReduce: (t1)=>({ 41625 u_image: new e1.aX(t1), 41626 u_texel_size: new e1.a2(t1), 41627 u_first_pass: new e1.aX(t1) 41628 }), 41629 circle: e1.co, 41630 collisionBox: (t1)=>({ 41631 u_matrix: new e1.a4(t1), 41632 u_inv_rot_matrix: new e1.a4(t1), 41633 u_camera_to_center_distance: new e1.a3(t1), 41634 u_extrude_scale: new e1.a2(t1), 41635 u_zoom_transition: new e1.a3(t1), 41636 u_merc_center: new e1.a2(t1), 41637 u_tile_id: new e1.a5(t1) 41638 }), 41639 collisionCircle: (t1)=>({ 41640 u_matrix: new e1.a4(t1), 41641 u_inv_matrix: new e1.a4(t1), 41642 u_camera_to_center_distance: new e1.a3(t1), 41643 u_viewport_size: new e1.a2(t1) 41644 }), 41645 debug: e1.cn, 41646 clippingMask: (t1)=>({ 41647 u_matrix: new e1.a4(t1) 41648 }), 41649 heatmap: (t1)=>({ 41650 u_extrude_scale: new e1.a3(t1), 41651 u_intensity: new e1.a3(t1), 41652 u_matrix: new e1.a4(t1), 41653 u_inv_rot_matrix: new e1.a4(t1), 41654 u_merc_center: new e1.a2(t1), 41655 u_tile_id: new e1.a5(t1), 41656 u_zoom_transition: new e1.a3(t1), 41657 u_up_dir: new e1.a5(t1) 41658 }), 41659 heatmapTexture: (t1)=>({ 41660 u_image: new e1.aX(t1), 41661 u_color_ramp: new e1.aX(t1), 41662 u_opacity: new e1.a3(t1) 41663 }), 41664 hillshade: (t1)=>({ 41665 u_matrix: new e1.a4(t1), 41666 u_image: new e1.aX(t1), 41667 u_latrange: new e1.a2(t1), 41668 u_light: new e1.a2(t1), 41669 u_shadow: new e1.bZ(t1), 41670 u_highlight: new e1.bZ(t1), 41671 u_emissive_strength: new e1.a3(t1), 41672 u_accent: new e1.bZ(t1) 41673 }), 41674 hillshadePrepare: (t1)=>({ 41675 u_matrix: new e1.a4(t1), 41676 u_image: new e1.aX(t1), 41677 u_dimension: new e1.a2(t1), 41678 u_zoom: new e1.a3(t1) 41679 }), 41680 line: e1.cm, 41681 linePattern: e1.cl, 41682 raster: (t1)=>({ 41683 u_matrix: new e1.a4(t1), 41684 u_normalize_matrix: new e1.a4(t1), 41685 u_globe_matrix: new e1.a4(t1), 41686 u_merc_matrix: new e1.a4(t1), 41687 u_grid_matrix: new e1.aZ(t1), 41688 u_tl_parent: new e1.a2(t1), 41689 u_scale_parent: new e1.a3(t1), 41690 u_fade_t: new e1.a3(t1), 41691 u_opacity: new e1.a3(t1), 41692 u_image0: new e1.aX(t1), 41693 u_image1: new e1.aX(t1), 41694 u_brightness_low: new e1.a3(t1), 41695 u_brightness_high: new e1.a3(t1), 41696 u_saturation_factor: new e1.a3(t1), 41697 u_contrast_factor: new e1.a3(t1), 41698 u_spin_weights: new e1.a5(t1), 41699 u_perspective_transform: new e1.a2(t1), 41700 u_raster_elevation: new e1.a3(t1), 41701 u_zoom_transition: new e1.a3(t1), 41702 u_merc_center: new e1.a2(t1), 41703 u_cutoff_params: new e1.aY(t1), 41704 u_colorization_mix: new e1.aY(t1), 41705 u_colorization_offset: new e1.a3(t1), 41706 u_color_ramp: new e1.aX(t1), 41707 u_color_ramp_size: new e1.a3(t1), 41708 u_texture_offset: new e1.a2(t1), 41709 u_texture_res: new e1.a2(t1), 41710 u_emissive_strength: new e1.a3(t1), 41711 u_zbias_factor: new e1.a3(t1) 41712 }), 41713 symbol: (t1)=>({ 41714 u_is_size_zoom_constant: new e1.aX(t1), 41715 u_is_size_feature_constant: new e1.aX(t1), 41716 u_size_t: new e1.a3(t1), 41717 u_size: new e1.a3(t1), 41718 u_camera_to_center_distance: new e1.a3(t1), 41719 u_rotate_symbol: new e1.aX(t1), 41720 u_aspect_ratio: new e1.a3(t1), 41721 u_fade_change: new e1.a3(t1), 41722 u_matrix: new e1.a4(t1), 41723 u_label_plane_matrix: new e1.a4(t1), 41724 u_coord_matrix: new e1.a4(t1), 41725 u_is_text: new e1.aX(t1), 41726 u_is_sdf: new e1.aX(t1), 41727 u_elevation_from_sea: new e1.aX(t1), 41728 u_pitch_with_map: new e1.aX(t1), 41729 u_texsize: new e1.a2(t1), 41730 u_texsize_icon: new e1.a2(t1), 41731 u_texture: new e1.aX(t1), 41732 u_texture_icon: new e1.aX(t1), 41733 u_gamma_scale: new e1.a3(t1), 41734 u_device_pixel_ratio: new e1.a3(t1), 41735 u_tile_id: new e1.a5(t1), 41736 u_zoom_transition: new e1.a3(t1), 41737 u_inv_rot_matrix: new e1.a4(t1), 41738 u_merc_center: new e1.a2(t1), 41739 u_camera_forward: new e1.a5(t1), 41740 u_tile_matrix: new e1.a4(t1), 41741 u_up_vector: new e1.a5(t1), 41742 u_ecef_origin: new e1.a5(t1), 41743 u_is_halo: new e1.aX(t1), 41744 u_icon_transition: new e1.a3(t1), 41745 u_color_adj_mat: new e1.a4(t1), 41746 u_scale_factor: new e1.a3(t1), 41747 u_ground_shadow_factor: new e1.a5(t1), 41748 u_inv_matrix: new e1.a4(t1), 41749 u_normal_scale: new e1.a3(t1), 41750 u_lutTexture: new e1.aX(t1), 41751 u_spp_fill_np_color: new e1.aY(t1), 41752 u_spp_halo_np_color: new e1.aY(t1), 41753 u_spp_opacity: new e1.a3(t1), 41754 u_spp_halo_width: new e1.a3(t1), 41755 u_spp_halo_blur: new e1.a3(t1), 41756 u_spp_emissive_strength: new e1.a3(t1), 41757 u_spp_occlusion_opacity: new e1.a3(t1), 41758 u_spp_z_offset: new e1.a3(t1), 41759 u_spp_translate_rotation: new e1.a2(t1), 41760 u_spp_zoom_fraction: new e1.a3(t1), 41761 u_opacity_multiplier: new e1.a3(t1) 41762 }), 41763 background: (t1)=>({ 41764 u_matrix: new e1.a4(t1), 41765 u_emissive_strength: new e1.a3(t1), 41766 u_opacity: new e1.a3(t1), 41767 u_color: new e1.bZ(t1) 41768 }), 41769 backgroundPattern: (t1)=>({ 41770 u_matrix: new e1.a4(t1), 41771 u_emissive_strength: new e1.a3(t1), 41772 u_opacity: new e1.a3(t1), 41773 u_image: new e1.aX(t1), 41774 u_pattern_tl: new e1.a2(t1), 41775 u_pattern_br: new e1.a2(t1), 41776 u_texsize: new e1.a2(t1), 41777 u_pattern_size: new e1.a2(t1), 41778 u_pixel_coord_upper: new e1.a2(t1), 41779 u_pixel_coord_lower: new e1.a2(t1), 41780 u_pattern_units_to_pixels: new e1.a2(t1) 41781 }), 41782 skybox: (t1)=>({ 41783 u_matrix: new e1.a4(t1), 41784 u_sun_direction: new e1.a5(t1), 41785 u_cubemap: new e1.aX(t1), 41786 u_opacity: new e1.a3(t1), 41787 u_temporal_offset: new e1.a3(t1) 41788 }), 41789 skyboxGradient: (t1)=>({ 41790 u_matrix: new e1.a4(t1), 41791 u_color_ramp: new e1.aX(t1), 41792 u_center_direction: new e1.a5(t1), 41793 u_radius: new e1.a3(t1), 41794 u_opacity: new e1.a3(t1), 41795 u_temporal_offset: new e1.a3(t1) 41796 }), 41797 skyboxCapture: (t1)=>({ 41798 u_matrix_3f: new e1.aZ(t1), 41799 u_sun_direction: new e1.a5(t1), 41800 u_sun_intensity: new e1.a3(t1), 41801
41801 u_color_tint_r: new e1.aY(t1), 41802 u_color_tint_m: new e1.aY(t1), 41803 u_luminance: new e1.a3(t1) 41804 }), 41805 globeAtmosphere: (t1)=>({ 41806 u_frustum_tl: new e1.a5(t1), 41807 u_frustum_tr: new e1.a5(t1), 41808 u_frustum_br: new e1.a5(t1), 41809 u_frustum_bl: new e1.a5(t1), 41810 u_horizon: new e1.a3(t1), 41811 u_transition: new e1.a3(t1), 41812 u_fadeout_range: new e1.a3(t1), 41813 u_atmosphere_fog_color: new e1.aY(t1), 41814 u_high_color: new e1.aY(t1), 41815 u_space_color: new e1.aY(t1), 41816 u_temporal_offset: new e1.a3(t1), 41817 u_horizon_angle: new e1.a3(t1) 41818 }), 41819 stars: (t1)=>({ 41820 u_matrix: new e1.a4(t1), 41821 u_up: new e1.a5(t1), 41822 u_right: new e1.a5(t1), 41823 u_intensity_multiplier: new e1.a3(t1) 41824 }), 41825 occlusion: (t1)=>({ 41826 u_matrix: new e1.a4(t1), 41827 u_anchorPos: new e1.a5(t1), 41828 u_screenSizePx: new e1.a2(t1), 41829 u_occluderSizePx: new e1.a2(t1), 41830 u_color: new e1.aY(t1) 41831 }) 41832 }; 41833 var mo = { 41834 terrainRaster: e1.bb('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nin vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'), 41835 terrainDepth: e1.bb("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}", '#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in ivec2 a_pos;out float v_depth;void main() {float elevation=elevation(vec2(a_pos));gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'), 41836 globeRaster: e1.bb('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nuniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nhighp vec2 uv=gl_FragCoord.xy/u_viewport;FLIP_VIEWPORT_UV_Y(uv);
41836highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}', '#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;\n#ifndef GLOBE_POLES\nuniform mat4 u_merc_matrix;\n#endif\nuniform float u_zoom_transition;uniform vec2 u_merc_center;\n#ifndef GLOBE_POLES\nuniform mat3 u_grid_matrix;\n#endif\nuniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin ivec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}') 41837 }; 41838 !function(e1) { 41839 Kr = e1; 41840 for (const e1 of Yr.splice(0))e1(); 41841 }({ 41842 create: (e1, t1)=>new Xr(e1, t1) 41843 }), Object.assign(fo, { 41844 terrainRaster: (t1)=>({ 41845 u_matrix: new e1.a4(t1), 41846 u_image0: new e1.aX(t1), 41847 u_image1: new e1.aX(t1), 41848 u_skirt_height: new e1.a3(t1), 41849 u_ground_shadow_factor: new e1.a5(t1), 41850 u_emissive_texture_available: new e1.a3(t1) 41851 }), 41852 globeRaster: (t1)=>({ 41853 u_proj_matrix: new e1.a4(t1), 41854 u_globe_matrix: new e1.a4(t1), 41855 u_normalize_matrix: new e1.a4(t1), 41856 u_merc_matrix: new e1.a4(t1), 41857 u_zoom_transition: new e1.a3(t1), 41858 u_merc_center: new e1.a2(t1), 41859 u_image0: new e1.aX(t1), 41860 u_image1: new e1.aX(t1), 41861 u_grid_matrix: new e1.aZ(t1), 41862 u_skirt_height: new e1.a3(t1), 41863 u_far_z_cutoff: new e1.a3(t1), 41864 u_frustum_tl: new e1.a5(t1), 41865 u_frustum_tr: new e1.a5(t1), 41866 u_frustum_br: new e1.a5(t1), 41867 u_frustum_bl: new e1.a5(t1), 41868 u_globe_pos: new e1.a5(t1), 41869 u_globe_radius: new e1.a3(t1), 41870 u_viewport: new e1.a2(t1), 41871 u_emissive_texture_available: new e1.a3(t1) 41872 }) 41873 }); 41874 const _o = { 41875 shaders: mo 41876 }; 41877 class go { 41878 static createFromScreenPoints(t1, i) { 41879 let s, r; 41880 if (t1 instanceof e1.P || "number" == typeof t1[0]) { 41881 const o = e1.P.convert(t1); 41882 s = [ 41883 o 41884 ], r = i.isPointAboveHorizon(o); 41885 } else { 41886 const o = e1.P.convert(t1[0]), n = e1.P.convert(t1[1]), a = o.add(n)._div(2); 41887 s = [ 41888 o, 41889 n 41890 ], r = e1.cr(o, n).every((e1)=>i.isPointAboveHorizon(e1)) && i.isPointAboveHorizon(a); 41891 } 41892 return new go(s, r, i); 41893 } 41894 isPointQuery() { 41895 return 1 === this.screenBounds.length; 41896 } 41897 bufferedScreenGeometry(t1) { 41898 return e1.cr(this.screenBounds[0], 1 === this.screenBounds.length ? this.screenBounds[0] : this.screenBounds[1], t1); 41899 } 41900 bufferedCameraGeometry(t1) { 41901 const i = this.screenBounds[0], s = 1 === this.screenBounds.length ? this.screenBounds[0].add(new e1.P(1, 1)) : this.screenBounds[1], r = e1.cr(i, s, 0, !1); 41902 return this.cameraPoint.y > s.y && (this.cameraPoint.x > i.x && this.cameraPoint.x < s.x ? r.splice(3, 0, this.cameraPoint) : this.cameraPoint.x >= s.x ? r[2] = this.cameraPoint : this.cameraPoint.x <= i.x && (r[3] = this.cameraPoint)), e1.cs(r, t1); 41903 } 41904 bufferedCameraGeometryGlobe(t1) { 41905 const i = this.screenBounds[0], s = 1 === this.screenBounds.length ? this.screenBounds[0].add(new e1.P(1, 1)) : this.screenBounds[1], r = e1.cr(i, s, t1), o = this.cameraPoint.clone(), n =
41905Number(o.x > i.x) + Number(o.x > s.x); 41906 switch(3 * (Number(o.y > i.y) + Number(o.y > s.y)) + n){ 41907 case 0: 41908 r[0] = o, r[4] = o.clone(); 41909 break; 41910 case 1: 41911 r.splice(1, 0, o); 41912 break; 41913 case 2: 41914 r[1] = o; 41915 break; 41916 case 3: 41917 r.splice(4, 0, o); 41918 break; 41919 case 5: 41920 r.splice(2, 0, o); 41921 break; 41922 case 6: 41923 r[3] = o; 41924 break; 41925 case 7: 41926 r.splice(3, 0, o); 41927 break; 41928 case 8: 41929 r[2] = o; 41930 } 41931 return r; 41932 } 41933 containsTile(t1, i, s) { 41934 let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, o = arguments.length > 4 ? arguments[4] : void 0; 41935 const n = Math.max(t1.queryPadding, t1.evaluateQueryRenderedFeaturePadding()) / i._pixelsPerMercatorPixel + 1, a = s ? this._bufferedCameraMercator(n, i) : this._bufferedScreenMercator(n, i); 41936 let l = t1.tileID.wrap + (a.unwrapped ? r : 0); 41937 const c = a.polygon.map((i)=>e1.ct(t1.tileTransform, i, l)); 41938 if (!e1.cu(c, 0, 0, e1.a6, e1.a6)) return; 41939 l = t1.tileID.wrap + (this.screenGeometryMercator.unwrapped ? r : 0); 41940 const h = this.screenGeometryMercator.polygon.map((i)=>e1.cv(t1.tileTransform, i, l)), d = h.map((t1)=>new e1.P(t1[0], t1[1])), u = e1.cv(t1.tileTransform, o, l), p = h.map((t1)=>{ 41941 const i = e1.cw(t1, t1, u); 41942 return e1.ca(i, i), new e1.cx(u, i); 41943 }), f = e1.ce(t1, 1, i.zoom) * i._pixelsPerMercatorPixel; 41944 return { 41945 queryGeometry: this, 41946 tilespaceGeometry: d, 41947 tilespaceRays: p, 41948 bufferedTilespaceGeometry: c, 41949 bufferedTilespaceBounds: (m = e1.cy(c), m.min.x = e1.b0(m.min.x, 0, e1.a6), m.min.y = e1.b0(m.min.y, 0, e1.a6), m.max.x = e1.b0(m.max.x, 0, e1.a6), m.max.y = e1.b0(m.max.y, 0, e1.a6), m), 41950 tile: t1, 41951 tileID: t1.tileID, 41952 pixelToTileUnitsFactor: f 41953 }; 41954 //TURBOPACK unreachable 41955 ; 41956 var m; 41957 } 41958 _bufferedScreenMercator(e1, t1) { 41959 const i = bo(e1); 41960 if (this._screenRaycastCache[i]) return this._screenRaycastCache[i]; 41961 { 41962 let s; 41963 return s = "globe" === t1.projection.name ? this._projectAndResample(this.bufferedScreenGeometry(e1), t1) : { 41964 polygon: this.bufferedScreenGeometry(e1).map((e1)=>t1.pointCoordinate3D(e1)), 41965 unwrapped: !0 41966 }, this._screenRaycastCache[i] = s, s; 41967 } 41968 } 41969 _bufferedCameraMercator(e1, t1) { 41970 const i = bo(e1); 41971 if (this._cameraRaycastCache[i]) return this._cameraRaycastCache[i]; 41972 { 41973 let s; 41974 return s = "globe" === t1.projection.name ? this._projectAndResample(this.bufferedCameraGeometryGlobe(e1), t1) : { 41975 polygon: this.bufferedCameraGeometry(e1).map((e1)=>t1.pointCoordinate3D(e1)), 41976 unwrapped: !0 41977 }, this._cameraRaycastCache[i] = s, s; 41978 } 41979 } 41980 _projectAndResample(t1, i) { 41981 const s = function(t1, i) { 41982 const s = e1.X([], i.pixelMatrix, i.globeMatrix), r = [ 41983 0, 41984 -e1.cz, 41985 0, 41986 1 41987 ], o = [ 41988 0, 41989 e1.cz, 41990 0, 41991 1 41992 ], n = [ 41993 0, 41994 0, 41995 0, 41996 1 41997 ]; 41998 e1.c7(r, r, s), e1.c7(o, o, s), e1.c7(n, n, s); 41999 const a = new e1.P(r[0] / r[3], r[1] / r[3]), l = new e1.P(o[0] / o[3], o[1] / o[3]), c = e1.cA(t1, a) && r[3] < n[3], h = e1.cA(t1, l) && o[3] < n[3]; 42000 if (!c && !h) return null; 42001 const d = function(e1, t1, i) { 42002 for(let s = 1; s < e1.length; s++){ 42003 const r = vo(t1.pointCoordinate3D(e1[s - 1]).x), o = vo(t1.pointCoordinate3D(e1[s]).x); 42004 if (i < 0) { 42005 if (r < o) return { 42006 idx: s, 42007 t: -r / (o - 1 - r) 42008 }; 42009 } else if (o < r) return { 42010 idx: s, 42011 t: (1 - r) / (o + 1 - r) 42012 }; 42013 } 42014 return null; 42015 }(t1, i, c ? -1 : 1); 42016 if (!d) return null; 42017 const { idx: u, t: p } = d; 42018 let f = u > 1 ? yo(t1.slice(0, u), i) : [], m = u < t1.length ? yo(t1.slice(u), i) : []; 42019 f = f.map((t1)=>new e1.P(vo(t1.x), t1.y)), m = m.map((t1)=>new e1.P(vo(t1.x), t1.y)); 42020 const _ = [ 42021 ...f 42022 ]; 42023 0 === _.length && _.push(m.at(-1)); 42024 const g = _.at(-1), y = e1.al(g.y, (0 === m.length ? f[0] : m[0]).y, p); 42025 let v; 42026 return v = c ? [ 42027 new e1.P(0, y), 42028 new e1.P(0, 0), 42029 new e1.P(1, 0), 42030 new e1.P(1, y) 42031 ] : [ 42032 new e1.P(1, y), 42033 new e1.P(1, 1), 42034 new e1.P(0, 1), 42035 new e1.P(0, y) 42036 ], _.push(...v), 0 === m.length ? _.push(f[0]) : _.push(...m), { 42037 polygon: _.map((t1)=>new e1.bS(t1.x, t1.y)), 42038 unwrapped: !1 42039 }; 42040 }(t1, i); 42041 if (s) return s; 42042 const r = function(t1, i) { 42043 let s = !1, r = -1 / 0, o = 0; 42044 for(let e1 = 0; e1 < t1.length - 1; e1++)t1[e1].x > r && (r = t1[e1].x, o = e1); 42045 for(let e1 = 0; e1 < t1.length - 1; e1++){ 42046 const i = (o + e1) % (t1.length - 1), r = t1[i], n = t1[i + 1]; 42047 Math.abs(r.x - n.x) >
vendor: 31,672 bytes, lines 42047-42623
42047 .5 && (r.x < n.x ? (r.x += 1, 0 === i && (t1.at(-1).x += 1)) : (n.x += 1, i + 1 === t1.length - 1 && (t1[0].x += 1)), s = !0); 42048 } 42049 const n = e1.a7(i.center.lng); 42050 return s && n < Math.abs(n - 1) && t1.forEach((e1)=>{ 42051 e1.x -= 1; 42052 }), { 42053 polygon: t1, 42054 unwrapped: s 42055 }; 42056 }(yo(t1, i).map((t1)=>new e1.P(vo(t1.x), t1.y)), i); 42057 return { 42058 polygon: r.polygon.map((t1)=>new e1.bS(t1.x, t1.y)), 42059 unwrapped: r.unwrapped 42060 }; 42061 } 42062 constructor(e1, t1, i){ 42063 this.screenBounds = e1, this.cameraPoint = i.getCameraPoint(), this._screenRaycastCache = {}, this._cameraRaycastCache = {}, this.isAboveHorizon = t1, this.screenGeometry = this.bufferedScreenGeometry(0), this.screenGeometryMercator = this._bufferedScreenMercator(0, i); 42064 } 42065 } 42066 function yo(t1, i) { 42067 return e1.cB(t1, (e1)=>{ 42068 const t1 = i.pointCoordinate3D(e1); 42069 e1.x = t1.x, e1.y = t1.y; 42070 }, 1 / 256); 42071 } 42072 function vo(e1) { 42073 return e1 < 0 ? 1 + e1 % 1 : e1 % 1; 42074 } 42075 function bo(e1) { 42076 return 100 * e1 | 0; 42077 } 42078 class xo extends e1.E { 42079 load(t1) { 42080 this._loaded = !1, this.fire(new e1.h("dataloading", { 42081 dataType: "source" 42082 })); 42083 const i = this.map.getWorldview(), s = (i, s)=>{ 42084 this._tileJSONRequest = null, this._loaded = !0, i ? this.fire(new e1.f(i)) : s && (Object.assign(this, s), s.raster_layers && (this.rasterLayers = s.raster_layers, this.rasterLayerIds = this.rasterLayers.map((e1)=>e1.id)), this.tileBounds = e1.cG.fromTileJSON(s), e1.cL(s.tiles), this.fire(new e1.h("data", { 42085 dataType: "source", 42086 sourceDataType: "metadata" 42087 })), this.fire(new e1.h("data", { 42088 dataType: "source", 42089 sourceDataType: "content" 42090 }))), t1 && t1(i); 42091 }; 42092 this.provider = "string" == typeof this._options.provider ? this._options.provider : void 0, this._tileProvider = void 0; 42093 const r = e1.cE(this._options); 42094 return r instanceof Error ? (this._loaded = !0, this.fire(new e1.f(r)), void (t1 && t1())) : this.provider && !r ? (this._loaded = !0, this.fire(new e1.f(new Error('TileProvider "'.concat(this.provider, '" is not registered')))), void (t1 && t1())) : void (this._tileJSONRequest = r ? this.loadTileJSONWithProvider(r, s) : e1.cF(this._options, this.map._requestManager, null, i, s)); 42095 } 42096 loadTileJSONWithProvider(t1, i) { 42097 this.provider = t1.name; 42098 const s = new AbortController; 42099 return (async ()=>{ 42100 const { request: r, options: o } = await e1.cM(this._options, this.map._requestManager, s.signal); 42101 if (s.signal.aborted) return; 42102 const n = await e1.cO(t1.name, t1.url); 42103 if (s.signal.aborted) return; 42104 const a = new n(o); 42105 let l = null; 42106 if (a.load && r && (l = await a.load({ 42107 request: r 42108 }), s.signal.aborted)) return; 42109 this._tileProvider = a; 42110 const c = e1.cN(this._options, l, this.map._requestManager); 42111 c instanceof Error ? i(c) : i(null, c); 42112 })().catch((e1)=>{ 42113 s.signal.aborted || i(new Error("Could not load tile provider ".concat(t1.name), { 42114 cause: e1 42115 })); 42116 }), { 42117 cancel: ()=>s.abort() 42118 }; 42119 } 42120 loaded() { 42121 return this._loaded; 42122 } 42123 onAdd(e1) { 42124 this.map = e1, this.load(); 42125 } 42126 reload() { 42127 this.cancelTileJSONRequest(); 42128 const t1 = e1.m(this.id, this.scope); 42129 this.load(()=>this.map.style.clearSource(t1)); 42130 } 42131 setTiles(e1) { 42132 return this._options.tiles = e1, this.reload(), this; 42133 } 42134 setUrl(e1) { 42135 return this.url = e1, this._options.url = e1, this.reload(), this; 42136 } 42137 onRemove(e1) { 42138 this.cancelTileJSONRequest(); 42139 } 42140 serialize() { 42141 return { 42142 ...this._options 42143 }; 42144 } 42145 hasTile(e1) { 42146 return !this.tileBounds || this.tileBounds.contains(e1.canonical); 42147 } 42148 async loadTile(t1, i) { 42149 const s = e1.e.devicePixelRatio >= 2, r = this.map._requestManager.normalizeTileURL(t1.tileID.canonical.url(this.tiles, this.scheme), s, this.tileSize), o = new AbortController; 42150 if (t1.request = o, this._tileProvider) this.loadTileWithProvider(t1, this._tileProvider, r, o, i); 42151 else try { 42152 const s = await this.map._requestManager.transformRequest(r, e1.R.Tile, o.signal); 42153 if (o.signal.aborted) return delete t1.request, i(null); 42154 const { data: n, headers: a } = await e1.a(s, o.signal); 42155 if (delete t1.request, t1.aborted) return i(null); 42156 const l = e1.cJ(a); 42157 this.map._refreshExpiredTiles && t1.setExpiryData(l), t1.setTexture(n, this.map.painter), t1.state = "loaded", e1.cK(this.dispatcher), i(null); 42158 } catch (e1) { 42159 if (delete t1.request, o.signal.aborted) return i(null); 42160 t1.state = "errored", i(e1); 42161 } 42162 } 42163 async loadTileWithProvider(t1, i, s, r, o) { 42164 const { z: n, x: a, y: l } = t1.tileID.canonical; 42165 try { 42166 const c = await this.map._requestManager.transformRequest(s, e1.R.Tile, r.signal); 42167 if (r.signal.aborted) return o(null); 42168 const h = await i.loadTile({ 42169 z: n, 42170 x: a, 42171 y: l 42172 }, { 42173 request: c, 42174 signal: r.signal 42175 }); 42176 if (r.signal.aborted) return o(null); 42177 if (null == h) { 42178 const e1 = new Error("Tile not found"); 42179 return e1.status = 404, t1.state = "errored", o(e1); 42180 } 42181 if (null == h.data) return t1.state = "loaded", o(null); 42182 const d = h.data instanceof ImageBitmap ? h.data : await createImageBitmap(new Blob([ 42183 h.data 42184 ])); 42185 if (r.signal.aborted) return o(null); 42186 t1.setTexture(d, this.map.painter), t1.state = "loaded", this.map._refreshExpiredTiles && t1.setExpiryData({ 42187 cacheControl: h.cacheControl, 42188 expires: h.expires 42189 }), o(null); 42190 } catch (e1) { 42191 if (r.signal.aborted) return o(null); 42192 t1.state = "errored", o(new Error("Could not load tile from ".concat(s), { 42193 cause: e1 42194 })); 42195 } finally{ 42196 delete t1.request; 42197 } 42198 } 42199 abortTile(e1, t1) { 42200 e1.request && (e1.request.abort(), delete e1.request), t1 && t1(); 42201 } 42202 unloadTile(t1, i) { 42203 t1.texture && t1.texture instanceof e1.T ? (t1.destroy(!1), t1.texture && t1.texture instanceof e1.T && this.map.painter.saveTileTexture(t1.texture)) : t1.destroy(), i && i(); 42204 } 42205 hasTransition() { 42206 return !1; 42207 } 42208 cancelTileJSONRequest() { 42209 this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null); 42210 } 42211 constructor(t1, i, s, r){ 42212 super(), this.id = t1, this.dispatcher = s, this.setEventedParent(r), this.type = "raster", this.minzoom = 0, this.maxzoom = 22, this.roundZoom = !0, this.scheme = "xyz", this.tileSize = 512, this._loaded = !1, this._options = { 42213 type: "raster", 42214 ...i 42215 }, Object.assign(this, e1.cC(i, [ 42216 "url", 42217 "scheme", 42218 "tileSize" 42219 ])); 42220 } 42221 } 42222 function wo(t1, i, s, r, o, n, a, l) { 42223 const c = [ 42224 t1, 42225 i, 42226 1, 42227 s, 42228 r, 42229 1, 42230 o, 42231 n, 42232 1 42233 ], h = [ 42234 a, 42235 l, 42236 1 42237 ], d = e1.cV([], c), [u, p, f] = e1.cU(h, h, d); 42238 return e1.cW(c, c, [ 42239 u, 42240 0, 42241 0, 42242 0, 42243 p, 42244 0, 42245 0, 42246 0, 42247 f 42248 ]); 42249 } 42250 function To(t1, i, s, r, o, n, a, l) { 42251 const c = function(t1, i, s, r, o, n, a, l) { 42252 const c = wo(0, 0, 1, 0, 1, 1, 0, 1), h = wo(t1, i, s, r, o, n, a, l), d = e1.cV([], c); 42253 return e1.cW(h, h, d); 42254 }(t1, i, s, r, o, n, a, l); 42255 return [ 42256 c[2] / c[8] / e1.a6, 42257 c[5] / c[8] / e1.a6 42258 ]; 42259 } 42260 function So(t1) { 42261 return [ 42262 t1[0], 42263 Math.min(Math.max(t1[1], -e1.cQ), e1.cQ) 42264 ]; 42265 } 42266 class Co extends e1.E { 42267 async load(t1, i) { 42268 if (this._loaded = i || !1, this.fire(new e1.h("dataloading", { 42269 dataType: "source" 42270 })), this.url = this.options.url, !this.url) return t1 && (this.coordinates = t1), this._loaded = !0, void this._finishLoading(); 42271 const s = new AbortController; 42272 this._imageRequest = s; 42273 try { 42274 const i = await this.map._requestManager.transformRequest(this.url, e1.R.Image, s.signal), { data: r } = await e1.a(i, s.signal); 42275 this._imageRequest = null, this._loaded = !0, this.image = r, this._dirty = !0, this.width = this.image.width, this.height = this.image.height, t1 && (this.coordinates = t1), this._finishLoading(); 42276 } catch (t1) { 42277 if (s.signal.aborted) return; 42278 this._imageRequest = null, this._loaded = !0, this.fire(new e1.f(t1)); 42279 } 42280 } 42281 loaded() { 42282 return this._loaded; 42283 } 42284 updateImage(e1) { 42285 return e1.url ? (this._imageRequest && e1.url !== this.options.url && (this._imageRequest.abort(), this._imageRequest = null), this.options.url = e1.url, this.load(e1.coordinates, this._loaded), this) : this; 42286 } 42287 setTexture(t1) { 42288 if (!(t1.handle instanceof WebGLTexture)) throw new Error("The provided handle is not a WebGLTexture instance"); 42289 return this.texture = new e1.cP(this.map.painter.context, t1.handle), this.width = t1.dimensions[0], this.height = t1.dimensions[1], this._dirty = !1, this._loaded = !0, this._finishLoading(), this; 42290 } 42291 _finishLoading() { 42292 this.map && (this.setCoordinates(this.coordinates), this.fire(new e1.h("data", { 42293 dataType: "source", 42294 sourceDataType: "metadata" 42295 }))); 42296 } 42297 onAdd(e1) { 42298 this.map = e1, this.load(); 42299 } 42300 onRemove(t1) { 42301 this._imageRequest && (this._imageRequest.abort(), this._imageRequest = null), !this.texture || this.texture instanceof e1.cP || this.texture.destroy(), this.boundsBuffer && (this.boundsBuffer.destroy(), this.elevatedGlobeVertexBuffer && this.elevatedGlobeVertexBuffer.destroy(), this.elevatedGlobeIndexBuffer && this.elevatedGlobeIndexBuffer.destroy()); 42302 } 42303 setCoordinates(t1) { 42304 if (this.coordinates = t1, this._boundsArray = void 0, this._unsupportedCoords = !1, !t1.length) return this; 42305 this.onNorthPole = !1, this.onSouthPole = !1; 42306 let i = t1[0][1], s = t1[0][1]; 42307 for (const e1 of t1)e1[1] > s && (s = e1[1]), e1[1] < i && (i = e1[1]); 42308 const r = (s + i) / 2; 42309 if (r > e1.cQ ? this.onNorthPole = !0 : r < -e1.cQ && (this.onSouthPole = !0), !this.onNorthPole && !this.onSouthPole) { 42310 const i = t1.map(e1.bS.fromLngLat); 42311 this.tileID = function(t1) { 42312 let i = 1 / 0, s = 1 / 0, r = -1 / 0, o = -1 / 0; 42313 for (const e1 of t1)i = Math.min(i, e1.x), s = Math.min(s, e1.y), r = Math.max(r, e1.x), o = Math.max(o, e1.y); 42314 const n = Math.max(r - i, o - s), a = Math.max(0, Math.floor(-Math.log2(n))), l = Math.pow(2, a); 42315 let c = Math.floor((i + r) / 2 * l); 42316 return c > 1 && (c -= 1), new e1.bX(a, c, Math.floor((s + o) / 2 * l)); 42317 }(i), this.minzoom = this.maxzoom = this.tileID.z; 42318 } 42319 return this.fire(new e1.h("data", { 42320 dataType: "source", 42321 sourceDataType: "content" 42322 })), this; 42323 } 42324 _clear() { 42325 !this.texture || this.texture instanceof e1.cP || (this.texture.destroy(), this._dirty = !0), this.texture = null, this._boundsArray = void 0, this._unsupportedCoords = !1; 42326 } 42327 _prepareData(t1) { 42328 for(const e1 in this.tiles){ 42329 const t1 = this.tiles[e1]; 42330 "loaded" !== t1.state && (t1.state = "loaded", t1.texture = this.texture); 42331 } 42332 if (this._boundsArray || this.onNorthPole || this.onSouthPole || this._unsupportedCoords) return; 42333 const i = e1.bp(new e1.bX(0, 0, 0), this.map.transform.projection), s = [ 42334 i.projection.project(this.coordinates[0][0], this.coordinates[0][1]), 42335 i.projection.project(this.coordinates[1][0], this.coordinates[1][1]), 42336 i.projection.project(this.coordinates[2][0], this.coordinates[2][1]), 42337 i.projection.project(this.coordinates[3][0], this.coordinates[3][1]) 42338 ]; 42339 if (!function(e1) { 42340 const t1 = e1[1].x - e1[0].x, i = e1[1].y - e1[0].y, s = e1[2].x - e1[1].x, r = e1[2].y - e1[1].y, o = e1[3].x - e1[2].x, n = e1[3].y - e1[2].y, a = e1[0].x - e1[3].x, l = e1[0].y - e1[3].y, c = t1 * r - s * i, h = s * n - o * r, d = o * l - a * n, u = a * i - t1 * l; 42341 return c > 0 && h > 0 && d > 0 && u > 0 || c < 0 && h < 0 && d < 0 && u < 0; 42342 }(s)) return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"), void (this._unsupportedCoords = !0); 42343 const r = e1.bp(this.tileID, this.map.transform.projection), [o, n, a, l] = this.coordinates.map((t1)=>{ 42344 const i = r.projection.project(t1[0], t1[1]); 42345 return e1.ct(r, i)._round(); 42346 }); 42347 this.perspectiveTransform = To(o.x, o.y, n.x, n.y, a.x, a.y, l.x, l.y); 42348 const c = this._boundsArray = new e1.bs; 42349 c.emplaceBack(o.x, o.y, 0, 0), c.emplaceBack(n.x, n.y, e1.a6, 0), c.emplaceBack(l.x, l.y, 0, e1.a6), c.emplaceBack(a.x, a.y, e1.a6, e1.a6), this.boundsBuffer && (this.boundsBuffer.destroy(), this.elevatedGlobeVertexBuffer && this.elevatedGlobeVertexBuffer.destroy(), this.elevatedGlobeIndexBuffer && this.elevatedGlobeIndexBuffer.destroy()), this.boundsBuffer = t1.createVertexBuffer(c, hs.members), this.boundsSegments = e1.ac.simpleSegment(0, 0, 4, 2); 42350 const h = e1.cT, d = h + 1, u = h + 1, p = d * u, f = h * h * 2, m = [], _ = function(e1) { 42351 return [ 42352 So(e1[0]), 42353 So(e1[1]), 42354 So(e1[2]), 42355 So(e1[3]) 42356 ]; 42357 }(this.coordinates), [g, y, v, b] = function(e1) { 42358 let t1 = e1[0][0], i = t1, s = e1[0][1], r = s; 42359 for(let o = 1; o < e1.length; o++)e1[o][0] < t1 ? t1 = e1[o][0] : e1[o][0] > i && (i = e1[o][0]), e1[o][1] < s ? s = e1[o][1] : e1[o][1] > r && (r = e1[o][1]); 42360 return [ 42361 t1, 42362 s, 42363 i - t1, 42364 r - s 42365 ]; 42366 }(_); 42367 { 42368 const r = new e1.bs, [o, n, a, l] = function(e1) { 42369 let t1 = e1[0].x, i = t1, s = e1[0].y, r = s; 42370 for(let o = 1; o < e1.length; o++)e1[o].x < t1 ? t1 = e1[o].x : e1[o].x > i && (i = e1[o].x), e1[o].y < s ? s = e1[o].y : e1[o].y > r && (r = e1[o].y); 42371 return [ 42372 t1, 42373 s, 42374 i - t1, 42375 r - s 42376 ]; 42377 }(s), c = (e1)=>[ 42378 (e1.x - o) / a, 42379 (e1.y - n) / l 42380 ], [p, f, _, x] = s.map(c), w = function(t1, i, s, r, o, n, a, l) { 42381 const c = wo(0, 0, 1, 0, 1, 1, 0, 1), h = wo(t1, i, s, r, o, n, a, l), d = e1.cV([], h); 42382 return e1.cW(c, c, d); 42383 }(p[0], p[1], f[0], f[1], _[0], _[1], x[0], x[1]); 42384 this.elevatedGlobePerspectiveTransform = To(p[0], p[1], f[0], f[1], _[0], _[1], x[0], x[1]); 42385 const T = (t1, i)=>{ 42386 m.push(t1.lng); 42387 const s = Math.round((t1.lng - g) / v * e1.a6), o = Math.round((t1.lat - y) / b * e1.a6), n = c(i), a = e1.cU([], [ 42388 n[0], 42389 n[1], 42390 1 42391 ], w), l = Math.round(a[0] / a[2] * e1.a6), h = Math.round(a[1] / a[2] * e1.a6); 42392 r.emplaceBack(s, o, l, h); 42393 }, S = s[3].x - s[0].x, C = s[3].y - s[0].y, E = s[2].x - s[1].x, I = s[2].y - s[1].y; 42394 for(let e1 = 0; e1 < u; e1++){ 42395 const t1 = e1 / h, r = [ 42396 s[0].x + t1 * S, 42397 s[0].y + t1 * C 42398 ], o = [ 42399 s[1].x + t1 * E, 42400 s[1].y + t1 * I 42401 ], n = o[0] - r[0], a = o[1] - r[1]; 42402 for(let e1 = 0; e1 < d; e1++){ 42403 const t1 = e1 / h, s = { 42404 x: r[0] + n * t1, 42405 y: r[1] + a * t1 42406 }; 42407 T(i.projection.unproject(s.x, s.y), s); 42408 } 42409 } 42410 this.elevatedGlobeVertexBuffer = t1.createVertexBuffer(r, hs.members); 42411 } 42412 { 42413 this.maxLongitudeTriangleSize = 0; 42414 let i = [], s = new e1.ad; 42415 const r = (e1, t1, r)=>{ 42416 s.emplaceBack(e1, t1, r); 42417 const o = m[e1], n = m[t1], a = m[r], l = Math.min(Math.min(o, n), a), c = Math.max(Math.max(o, n), a) - l; 42418 c > this.maxLongitudeTriangleSize && (this.maxLongitudeTriangleSize = c), i.push(l + c / 2); 42419 }; 42420 for(let e1 = 0; e1 < h; e1++)for(let t1 = 0; t1 < h; t1++){ 42421 const i = e1 * d + t1, s = i + 1, o = i + d, n = o + 1; 42422 r(i, o, s), r(s, o, n); 42423 } 42424 [i, s] = function(t1, i) { 42425 const s = Array.from({ 42426 length: t1.length 42427 }, (e1, t1)=>t1); 42428 s.sort((e1, i)=>t1[e1] - t1[i]); 42429 const r = [], o = new e1.ad; 42430 for(let e1 = 0; e1 < s.length; e1++){ 42431 const n = s[e1]; 42432 r.push(t1[n]); 42433 const a = 3 * n, l = a + 1; 42434 o.emplaceBack(i.uint16[a], i.uint16[l], i.uint16[l + 1]); 42435 } 42436 return [ 42437 r, 42438 o 42439 ]; 42440 }(i, s), this.elevatedGlobeTrianglesCenterLongitudes = i, this.elevatedGlobeIndexBuffer = t1.createIndexBuffer(s); 42441 } 42442 this.elevatedGlobeSegments = e1.ac.simpleSegment(0, 0, p, f), this.elevatedGlobeGridMatrix = new Float32Array([ 42443 0, 42444 v / e1.a6, 42445 0, 42446 b / e1.a6, 42447 0, 42448 0, 42449 y, 42450 g, 42451 0 42452 ]); 42453 } 42454 prepare() { 42455 const t1 = 0 !== Object.keys(this.tiles).length; 42456 if (this.tileID && !t1) return; 42457 const i = this.map.painter.context, s = i.gl; 42458 !this._dirty || this.texture instanceof e1.cP || (this.texture ? this.texture.update(this.image) : (this.texture = new e1.T(i, this.image, s.RGBA8), this.texture.bind(s.LINEAR, s.CLAMP_TO_EDGE)), this._dirty = !1), t1 && this._prepareData(i); 42459 } 42460 loadTile(e1, t1) { 42461 this.tileID && this.tileID.equals(e1.tileID.canonical) ? (this.tiles[String(e1.tileID.wrap)] = e1, e1.buckets = {}, t1(null)) : (e1.state = "errored", t1(null)); 42462 } 42463 serialize() { 42464 return { 42465 type: "image", 42466 url: this.options.url, 42467 coordinates: this.coordinates 42468 }; 42469 } 42470 hasTransition() { 42471 return !1; 42472 } 42473 getSegmentsForLongitude(t1) { 42474 const i = this.elevatedGlobeSegments; 42475 if (!this.elevatedGlobeTrianglesCenterLongitudes || !i) return null; 42476 const s = this.elevatedGlobeTrianglesCenterLongitudes; 42477 let r = (o = t1 + 180) + 360 * Math.round((s[0] - o) / 360); 42478 var o; 42479 const n = new e1.ac, a = (e1, t1)=>{ 42480 n.segments.push({ 42481 vertexOffset: 0, 42482 primitiveOffset: e1, 42483 vertexLength: i.segments[0].vertexLength, 42484 primitiveLength: t1, 42485 sortKey: void 0, 42486 vaos: {} 42487 }); 42488 }, l = .51 * this.maxLongitudeTriangleSize; 42489 if (Math.abs(s[0] - r) <= l) { 42490 const t1 = e1.cR(s, 0, s.length, r + l); 42491 return t1 === s.length || a(t1, e1.cS(s, t1 + 1, s.length, r + 360 - l) - t1), n; 42492 } 42493 r < s[0] && (r += 360); 42494 const c = e1.cS(s, 0, s.length, r - l); 42495 if (c === s.length) return a(0, s.length), n; 42496 a(0, c - 0); 42497 const h = e1.cR(s, c + 1, s.length, r + l); 42498 return h !== s.length && a(h, s.length - h), n; 42499 } 42500 constructor(e1, t1, i, s){ 42501 super(), this.id = e1, this.dispatcher = i, this.coordinates = t1.coordinates, this.type = "image", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.tiles = {}, this._loaded = !1, this.onNorthPole = !1, this.onSouthPole = !1, this.setEventedParent(s), this.options = t1, this._dirty = !1; 42502 } 42503 } 42504 const Eo = { 42505 vector: class extends e1.E { 42506 load(t1) { 42507 this._loaded = !1, this.fire(new e1.h("dataloading", { 42508 dataType: "source" 42509 })); 42510 const i = Array.isArray(this.map._language) ? this.map._language.join() : this.map._language, s = this.map.getWorldview(), r = (r, o)=>{ 42511 this._tileJSONRequest = null, this._loaded = !0, r ? (i && console.warn("Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ".concat(i)), s && console.warn("Requested worldview strings must be a valid ISO alpha-2 code. Found: ".concat(s)), this.fire(new e1.f(r))) : o && (this._setTileJSON(o), Xs.updateCrossSourceElevationGate && this.map.style && Xs.updateCrossSourceElevationGate(this.map.style), e1.cL(o.tiles, this.map._requestManager._customAccessToken), this.fire(new e1.h("data", { 42512 dataType: "source", 42513 sourceDataType: "metadata" 42514 })), this.fire(new e1.h("data", { 42515 dataType: "source", 42516 sourceDataType: "content" 42517 }))), t1 && t1(r); 42518 }; 42519 this.provider = this._options.provider; 42520 const o = e1.cE(this._options); 42521 return o instanceof Error ? (this._loaded = !0, this.fire(new e1.f(o)), void (t1 && t1())) : this.provider && !o ? (this._loaded = !0, this.fire(new e1.f(new Error('TileProvider "'.concat(this.provider, '" is not registered')))), void (t1 && t1())) : void (this._tileJSONRequest = o ? this.loadTileJSONWithProvider(o, r) : e1.cF(this._options, this.map._requestManager, i, s, r)); 42522 } 42523 loadTileJSONWithProvider(t1, i) { 42524 this.provider = t1.name; 42525 const s = new AbortController; 42526 return (async ()=>{ 42527 const { request: r, options: o } = await e1.cM(this._options, this.map._requestManager, s.signal); 42528 if (s.signal.aborted) return; 42529 const n = await this.dispatcher.send("loadTileProvider", { 42530 name: t1.name, 42531 url: t1.url, 42532 source: this.id, 42533 scope: this.scope, 42534 type: this.type, 42535 options: o, 42536 request: r 42537 }, { 42538 signal: s.signal 42539 }); 42540 if (s.signal.aborted) return; 42541 const a = n ? n.find((e1)=>null != e1) : null, l = e1.cN(this._options, a, this.map._requestManager); 42542 l instanceof Error ? i(l) : i(null, l); 42543 })().catch((e1)=>{ 42544 s.signal.aborted || i(e1); 42545 }), { 42546 cancel: ()=>s.abort() 42547 }; 42548 } 42549 _setTileJSON(t1) { 42550 if (Object.assign(this, t1), this.hasWorldviews = !!t1.worldview_options, t1.worldview_default && (this.worldviewDefault = t1.worldview_default), t1.vector_layers) { 42551 this.vectorLayers = t1.vector_layers, this.vectorLayerIds = [], this.localizableLayerIds = new Set; 42552 for (const e1 of t1.vector_layers)this.vectorLayerIds.push(e1.id), t1.worldview && t1.worldview[e1.source] && this.localizableLayerIds.add(e1.id); 42553 } 42554 this.tileBounds = e1.cG.fromTileJSON(t1); 42555 } 42556 loaded() { 42557 return this._loaded; 42558 } 42559 hasTile(e1) { 42560 return !this.tileBounds || this.tileBounds.contains(e1.canonical); 42561 } 42562 onAdd(e1) { 42563 this.map = e1, this.load(); 42564 } 42565 reload() { 42566 this.cancelTileJSONRequest(); 42567 const t1 = e1.m(this.id, this.scope); 42568 this.load(()=>this.map.style.clearSource(t1)); 42569 } 42570 setTiles(e1) { 42571 return this._options.tiles = e1, this.reload(), this; 42572 } 42573 setUrl(e1) { 42574 return this.url = e1, this._options.url = e1, this.reload(), this; 42575 } 42576 onRemove(e1) { 42577 this.cancelTileJSONRequest(); 42578 } 42579 serialize() { 42580 return { 42581 ...this._options 42582 }; 42583 } 42584 async loadTile(t1, i) { 42585 const s = t1.tileID.canonical.url(this.tiles, this.scheme), r = this.map._requestManager.normalizeTileURL(s), o = !t1.actor || "expired" === t1.state; 42586 if (!o && "loading" === t1.state) return void (t1.reloadCallback = i); 42587 o && (t1.actor = this._tileWorkers[r] = this._tileWorkers[r] || this.dispatcher.getActor()); 42588 const n = new AbortController; 42589 t1.request = n; 42590 try { 42591 const a = await this.map._requestManager.transformRequest(r, e1.R.Tile, n.signal); 42592 if (n.signal.aborted) return i(null); 42593 this.dispatchTile(t1, r, s, a, n, o, i); 42594 } catch (e1) { 42595 if (n.signal.aborted) return i(null); 42596 i(e1); 42597 } 42598 } 42599 dispatchTile(t1, i, s, r, o, n, a) { 42600 const l = this.map.style ? this.map.style.getLut(this.scope) : null, c = l ? { 42601 image: l.image.clone() 42602 } : null, h = !(!this.map.style || !this.map.style._crossSourceElevationActive), d = !(!this.map.style || !h), u = { 42603 request: r, 42604 data: void 0, 42605 uid: t1.uid, 42606 tileID: t1.tileID, 42607 tileZoom: t1.tileZoom, 42608 zoom: t1.tileID.overscaledZ, 42609 maxZoom: this.maxzoom, 42610 lut: c, 42611 tileSize: this.tileSize * t1.tileID.overscaleFactor(), 42612 type: this.type, 42613 source: this.id, 42614 scope: this.scope, 42615 pixelRatio: e1.e.devicePixelRatio, 42616 showCollisionBoxes: this.map.showCollisionBoxes, 42617 showElevationIdDebug: !!this.map.painter && this.map.painter._debugParams.showElevationIdDebug, 42618 promoteId: this.promoteId, 42619 renderSourceType: t1.renderSourceType, 42620 frcCoverage: (()=>{ 42621 const e1 = this.map.painter, i = e1 ? e1.frcCoverageFadeRange : null; 42622 if (null == i) return null; 42623 const s = e1 ? e1.frcCoverageSnapshot : null, r = this.map.transform.zoom < i[0], o = s ? s.getTileOrParent(t
426231.tileID.canonical) : null, n = t1.tileID.overscaledZ >= Math.ceil(i[1]), a = s && n ? s.getFullCoverageMask(t1.tileID.canonical) : null; 42624 return { 42625 frcMask: n ? a !== null && a !== void 0 ? a : null : null, 42626 resolved: r || null != s, 42627 polygons: o && 0 !== o.frcMask ? o.polygons : null, 42628 tileZoom: o && 0 !== o.frcMask ? o.tileId.z : null, 42629 sourceLayers: e1 ? e1.frcCoverageSourceLayers : [ 42630 "road", 42631 "structure" 42632 ] 42633 }; 42634 })(), 42635 terrainEnabled: Gt(this.map.style, this.map.transform), 42636 crossSourceElevationEnabled: d, 42637 elevation: Xs.buildElevationRequestParams ? Xs.buildElevationRequestParams(this.map, t1, h) : null, 42638 brightness: this.map.style && this.map.style.getBrightness() || 0, 42639 extraShadowCaster: t1.isExtraShadowCaster, 42640 tessellationStep: this.map._tessellationStep, 42641 scaleFactor: this.map.getScaleFactor(), 42642 worldview: this.map.getWorldview() || this.worldviewDefault, 42643 indoor: this.map.getIndoorTileOptions(this.id, this.scope) 42644 }; 42645 if (this.hasWorldviews && e1.cH(s) && (u.localizableLayerIds = this.localizableLayerIds), u.request.collectResourceTiming = this._collectResourceTiming, n) if (this.dispatcher.ready || this.provider) t1.request = t1.actor.sendCancelable("loadTile", u, {}, p.bind(this)); 42646 else { 42647 const i = e1.cI.call({ 42648 deduped: this._deduped 42649 }, u, (e1, i)=>{ 42650 t1.aborted || (e1 || !i ? p.call(this, e1) : (u.data = { 42651 rawData: i.rawData.slice(0), 42652 headers: i.headers 42653 }, t1.actor && (t1.request = t1.actor.sendCancelable("loadTile", u, {}, p.bind(this))))); 42654 }, !0); 42655 o.signal.addEventListener("abort", i, { 42656 once: !0 42657 }); 42658 } 42659 else t1.request = t1.actor.sendCancelable("reloadTile", u, {}, p.bind(this)); 42660 function p(i, s) { 42661 return delete t1.request, t1.aborted ? a(null) : i ? a(i) : (s && s.resourceTiming && (t1.resourceTiming = s.resourceTiming), this.map._refreshExpiredTiles && s && t1.setExpiryData(e1.cJ(s.headers)), void (function() { 42662 if (t1.aborted) return a(null); 42663 t1.loadVectorData(s, this.map.painter), e1.cK(this.dispatcher), a(null, s), t1.reloadCallback && (this.loadTile(t1, t1.reloadCallback), t1.reloadCallback = null); 42664 }).call(this)); 42665 } 42666 } 42667 abortTile(e1) { 42668 e1.request && (e1.request.abort(), delete e1.request), e1.actor && e1.actor.notify("abortTile", { 42669 uid: e1.uid, 42670 type: this.type, 42671 source: this.id, 42672 scope: this.scope 42673 }); 42674 } 42675 unloadTile(e1, t1) { 42676 e1.actor && e1.actor.notify("removeTile", { 42677 uid: e1.uid, 42678 type: this.type, 42679 source: this.id, 42680 scope: this.scope 42681 }), e1.destroy(); 42682 } 42683 hasTransition() { 42684 return !1; 42685 } 42686 afterUpdate() { 42687 this._tileWorkers = {}; 42688 } 42689 cancelTileJSONRequest() { 42690 this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null); 42691 } 42692 constructor(t1, i, s, r){ 42693 if (super(), this.id = t1, this.dispatcher = s, this.type = "vector", this.provider = i.provider, this.minzoom = 0, this.maxzoom = 22, this.scheme = "xyz", this.tileSize = 512, this.reparseOverscaled = !0, this.isTileClipped = !0, this._loaded = !1, Object.assign(this, e1.cC(i, [ 42694 "url", 42695 "scheme", 42696 "tileSize", 42697 "promoteId" 42698 ])), this._options = { 42699 type: "vector", 42700 ...i 42701 }, this._collectResourceTiming = !!i.collectResourceTiming, 512 !== this.tileSize) throw new Error("vector tile sources must have a tileSize of 512"); 42702 this.setEventedParent(r), this._tileWorkers = {}, this._deduped = new e1.cD; 42703 } 42704 }, 42705 raster: xo, 42706 "raster-dem": class extends xo { 42707 loadTileJSONWithProvider(t1, i) { 42708 this.provider = t1.name; 42709 const s = new AbortController; 42710 return (async ()=>{ 42711 const { request: r, options: o } = await e1.cM(this._options, this.map._requestManager, s.signal); 42712 if (s.signal.aborted) return; 42713 const n = await this.dispatcher.send("loadTileProvider", { 42714 name: t1.name, 42715 url: t1.url, 42716 source: this.id, 42717 scope: this.scope, 42718 type: this.type, 42719 options: o, 42720 request: r 42721 }, { 42722 signal: s.signal 42723 }); 42724 if (s.signal.aborted) return; 42725 const a = n ? n.find((e1)=>null != e1) : null, l = e1.cN(this._options, a, this.map._requestManager);
42726 l instanceof Error ? i(l) : i(null, l); 42727 })().catch((e1)=>{ 42728 s.signal.aborted || i(e1); 42729 }), { 42730 cancel: ()=>s.abort() 42731 }; 42732 } 42733 async loadTile(t1, i) { 42734 if (t1.actor && "expired" !== t1.state) return; 42735 const s = this.map._requestManager.normalizeTileURL(t1.tileID.canonical.url(this.tiles, this.scheme), !1, this.tileSize); 42736 t1.actor = this.dispatcher.getActor(); 42737 const r = new AbortController; 42738 t1.request = r; 42739 try { 42740 const o = await this.map._requestManager.transformRequest(s, e1.R.Tile, r.signal); 42741 if (r.signal.aborted) return i(null); 42742 t1.request = t1.actor.sendCancelable("loadTile", { 42743 uid: t1.uid, 42744 tileID: t1.tileID, 42745 source: this.id, 42746 type: this.type, 42747 scope: this.scope, 42748 request: o, 42749 encoding: this.encoding 42750 }, {}, (function(s, r) { 42751 return delete t1.request, t1.aborted ? i(null) : s ? (t1.state = "errored", i(s)) : (r && (this.map._refreshExpiredTiles && t1.setExpiryData(e1.cJ(r.headers)), r.borderReady || t1.neighboringTiles || (t1.neighboringTiles = this._getNeighboringTiles(t1.tileID)), t1.dem = r.dem, t1.dem.onDeserialize(), t1.needsHillshadePrepare = !0, t1.needsDEMTextureUpload = !0), t1.state = "loaded", void i(null)); 42752 }).bind(this)); 42753 } catch (e1) { 42754 if (r.signal.aborted) return i(null); 42755 t1.state = "errored", i(e1); 42756 } 42757 } 42758 abortTile(e1, t1) { 42759 e1.request && (e1.request.abort(), delete e1.request), e1.actor && e1.actor.notify("abortTile", { 42760 uid: e1.uid, 42761 type: this.type, 42762 source: this.id, 42763 scope: this.scope 42764 }), t1 && t1(); 42765 } 42766 _getNeighboringTiles(t1) { 42767 const i = t1.canonical, s = Math.pow(2, i.z), r = (i.x - 1 + s) % s, o = 0 === i.x ? t1.wrap - 1 : t1.wrap, n = (i.x + 1 + s) % s, a = i.x + 1 === s ? t1.wrap + 1 : t1.wrap, l = {}; 42768 return l[new e1.bP(t1.overscaledZ, o, i.z, r, i.y).key] = { 42769 backfilled: !1 42770 }, l[new e1.bP(t1.overscaledZ, a, i.z, n, i.y).key] = { 42771 backfilled: !1 42772 }, i.y > 0 && (l[new e1.bP(t1.overscaledZ, o, i.z, r, i.y - 1).key] = { 42773 backfilled: !1 42774 }, l[new e1.bP(t1.overscaledZ, t1.wrap, i.z, i.x, i.y - 1).key] = { 42775 backfilled: !1 42776 }, l[new e1.bP(t1.overscaledZ, a, i.z, n, i.y - 1).key] = { 42777 backfilled: !1 42778 }), i.y + 1 < s && (l[new e1.bP(t1.overscaledZ, o, i.z, r, i.y + 1).key] = { 42779 backfilled: !1 42780 }, l[new e1.bP(t1.overscaledZ, t1.wrap, i.z, i.x, i.y + 1).key] = { 42781 backfilled: !1 42782 }, l[new e1.bP(t1.overscaledZ, a, i.z, n, i.y + 1).key] = { 42783 backfilled: !1 42784 }), l; 42785 } 42786 constructor(e1, t1, i, s){ 42787 super(e1, t1, i, s), this.type = "raster-dem", this.maxzoom = 22, this._options = { 42788 type: "raster-dem", 42789 ...t1 42790 }, this.encoding = t1.encoding || "mapbox"; 42791 } 42792 }, 42793 geojson: class extends e1.E { 42794 onAdd(e1) { 42795 this.map = e1, this.setData(this._data); 42796 } 42797 setData(e1) {
vendor: 8,009 bytes, lines 42798-42937
42798 return this._data = e1, this._updateWorkerData(), this; 42799 } 42800 updateData(t1) { 42801 if (!this._options.dynamic) return this.fire(new e1.f(new Error("Can't call updateData on a GeoJSON source with dynamic set to false."))); 42802 if ("string" != typeof t1 && ("Feature" === t1.type && (t1 = { 42803 type: "FeatureCollection", 42804 features: [ 42805 t1 42806 ] 42807 }), "FeatureCollection" !== t1.type)) return this.fire(new e1.f(new Error("Data to update should be a feature or a feature collection."))); 42808 if (this._coalesce && "string" != typeof t1 && "string" != typeof this._data && "FeatureCollection" === this._data.type) { 42809 const e1 = new Map; 42810 for (const t1 of this._data.features)e1.set(t1.id, t1); 42811 for (const i of t1.features)e1.set(i.id, i); 42812 this._data.features = [ 42813 ...e1.values() 42814 ]; 42815 } else this._data = t1; 42816 return this._updateWorkerData(!0), this; 42817 } 42818 getClusterExpansionZoom(e1, t1) { 42819 return this.actor.send("geojson.getClusterExpansionZoom", { 42820 clusterId: e1, 42821 source: this.id, 42822 scope: this.scope 42823 }).then((e1)=>t1(null, e1)).catch((e1)=>t1(e1)), this; 42824 } 42825 getClusterChildren(e1, t1) { 42826 return this.actor.send("geojson.getClusterChildren", { 42827 clusterId: e1, 42828 source: this.id, 42829 scope: this.scope 42830 }).then((e1)=>t1(null, e1)).catch((e1)=>t1(e1)), this; 42831 } 42832 getClusterLeaves(e1, t1, i, s) { 42833 return this.actor.send("geojson.getClusterLeaves", { 42834 source: this.id, 42835 scope: this.scope, 42836 clusterId: e1, 42837 limit: t1, 42838 offset: i 42839 }).then((e1)=>s(null, e1)).catch((e1)=>s(e1)), this; 42840 } 42841 async _updateWorkerData() { 42842 let t1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1; 42843 if (this._pendingLoad) return void (this._coalesce = !0); 42844 this.fire(new e1.h("dataloading", { 42845 dataType: "source" 42846 })), this._loaded = !1; 42847 const i = { 42848 append: t1, 42849 ...this.workerOptions 42850 }; 42851 i.scope = this.scope; 42852 const s = this._data, r = new AbortController; 42853 this._pendingLoad = r; 42854 try { 42855 if ("string" == typeof s) { 42856 if (i.request = await this.map._requestManager.transformRequest(e1.e.resolveURL(s), e1.R.Source, r.signal), r.signal.aborted) return this._pendingLoad = null, void (this._coalesce = !1); 42857 i.request.collectResourceTiming = this._collectResourceTiming; 42858 } else i.data = JSON.stringify(s); 42859 const o = await this.actor.send("".concat(this.type, ".loadData"), i, { 42860 signal: r.signal 42861 }); 42862 this._loaded = !0, this._pendingLoad = null; 42863 const n = { 42864 dataType: "source", 42865 sourceDataType: this._metadataFired ? "content" : "metadata" 42866 }; 42867 this._collectResourceTiming && o && o.resourceTiming && o.resourceTiming[this.id] && (n.resourceTiming = o.resourceTiming[this.id]), t1 && (this._partialReload = !0), this.fire(new e1.h("data", n)), this._partialReload = !1, this._metadataFired = !0; 42868 } catch (t1) { 42869 if (r.signal.aborted) return this._pendingLoad = null, void (this._coalesce = !1); 42870 this._loaded = !0, this._pendingLoad = null, this.fire(new e1.f(t1)); 42871 } 42872 this._coalesce && (this._updateWorkerData(t1), this._coalesce = !1); 42873 } 42874 loaded() { 42875 return this._loaded; 42876 } 42877 reload() { 42878 const t1 = e1.m(this.id, this.scope); 42879 this.map.style.clearSource(t1), this._updateWorkerData(); 42880 } 42881 loadTile(t1, i) { 42882 const s = t1.actor ? "reloadTile" : "loadTile"; 42883 t1.actor = this.actor; 42884 const r = this.map.style ? this.map.style.getLut(this.scope) : null, o = r ? { 42885 image: r.image.clone() 42886 } : null, n = this._partialReload, a = { 42887 type: this.type, 42888 uid: t1.uid, 42889 tileID: t1.tileID, 42890 tileZoom: t1.tileZoom, 42891 zoom: t1.tileID.overscaledZ, 42892 maxZoom: this.maxzoom, 42893 tileSize: this.tileSize, 42894 source: this.id, 42895 lut: o, 42896 scope: this.scope, 42897 pixelRatio: e1.e.devicePixelRatio, 42898 showCollisionBoxes: this.map.showCollisionBoxes, 42899 showElevationIdDebug: !!this.map.painter && this.map.painter._debugParams.showElevationIdDebug, 42900 promoteId: this.promoteId, 42901 brightness: this.map.style && this.map.style.getBrightness() || 0, 42902 extraShadowCaster: t1.isExtraShadowCaster, 42903 scaleFactor: this.map.getScaleFactor(), 42904 partial: n, 42905 worldview: this.map.getWorldview(), 42906 indoor: this.map.getIndoorTileOptions(this.id, this.scope) 42907 }; 42908 t1.request = this.actor.sendCancelable(s, a, {}, (e1, r)=>n && !r ? (t1.state = "loaded", i(null)) : (delete t1.request, t1.destroy(!1), t1.aborted ? i(null) : e1 ? i(e1) : (t1.loadVectorData(r, this.map.painter, "reloadTile" === s), void i(null)))); 42909 } 42910 abortTile(e1) { 42911 e1.request && (e1.request.abort(), delete e1.request), e1.aborted = !0; 42912 } 42913 unloadTile(e1, t1) { 42914 this.actor.notify("removeTile", { 42915 uid: e1.uid, 42916 type: this.type, 42917 source: this.id, 42918 scope: this.scope 42919 }), e1.destroy(); 42920 } 42921 onRemove(e1) { 42922 this._pendingLoad && this._pendingLoad.abort(); 42923 } 42924 serialize() { 42925 return { 42926 ...this._options, 42927 type: this.type, 42928 data: this._data 42929 }; 42930 } 42931 hasTransition() { 42932 return !1; 42933 } 42934 constructor(t1, i, s, r){ 42935 super(), this.id = t1, this.type = "geojson", this.minzoom = 0, this.maxzoom = 18, this.tileSize = 512, this.isTileClipped = !0, this.reparseOverscaled = !0, this._loaded = !1, this.actor = s.getActor(), this.setEventedParent(r), this._data = i.data, this._options = { 42936 ...i 42937 }, this._collectResourceTiming = i.collectResourceTiming, void 0 !== i.maxzoom && (this.maxzoom = i.maxzoom), void 0 !== i.minzoom && (this.minzoom = i.minzoom), i.type && (this.t
42937ype = i.type), i.attribution && (this.attribution = i.attribution), this.promoteId = i.promoteId; 42938 const o = e1.a6 / this.tileSize; 42939 this.workerOptions = { 42940 source: this.id, 42941 scope: this.scope, 42942 cluster: i.cluster || !1, 42943 geojsonVtOptions: { 42944 buffer: (void 0 !== i.buffer ? i.buffer : 128) * o, 42945 tolerance: (void 0 !== i.tolerance ? i.tolerance : .375) * o, 42946 extent: e1.a6, 42947 maxZoom: this.maxzoom, 42948 lineMetrics: i.lineMetrics || !1, 42949 generateId: i.generateId || !1 42950 }, 42951 superclusterOptions: { 42952 maxZoom: void 0 !== i.clusterMaxZoom ? i.clusterMaxZoom : this.maxzoom - 1, 42953 minPoints: Math.max(2, i.clusterMinPoints || 2), 42954 extent: e1.a6, 42955 radius: (void 0 !== i.clusterRadius ? i.clusterRadius : 50) * o, 42956 log: !1, 42957 generateId: i.generateId || !1 42958 }, 42959 clusterProperties: i.clusterProperties, 42960 filter: i.filter, 42961 dynamic: i.dynamic, 42962 ...i.workerOptions 42963 }; 42964 } 42965 }, 42966 video: class extends Co { 42967 async load() { 42968 this._loaded = !1; 42969 const t1 = this.options, i = new AbortController; 42970 this._imageRequest = i; 42971 try { 42972 const s = await Promise.all(t1.urls.map(async (t1)=>(await this.map._requestManager.transformRequest(t1, e1.R.Source, i.signal)).url)); 42973 if (i.signal.aborted) return; 42974 this.urls = s; 42975 const r = await e1.cX(s); 42976 if (i.signal.aborted) return; 42977 this._imageRequest = null, this.video = r, this.video.loop = !0, this.video.setAttribute("playsinline", ""), this.video.addEventListener("playing", ()=>{ 42978 this.map.triggerRepaint(); 42979 }), this.map && this.video.play(), this._finishLoading(); 42980 } catch (t1) { 42981 if (i.signal.aborted) return; 42982 this.fire(new e1.f(t1)); 42983 } finally{ 42984 this._loaded = !0; 42985 } 42986 } 42987 pause() { 42988 this.video && this.video.pause(); 42989 } 42990 play() { 42991 this.video && this.video.play(); 42992 } 42993 seek(t1) { 42994 if (this.video) { 42995 const i = this.video.seekable; 42996 t1 < i.start(0) || t1 > i.end(0) ? this.fire(new e1.f(new ce("sources.".concat(this.id), null, "Playback for this video can be set only between the ".concat(i.start(0), " and ").concat(i.end(0), "-second mark.")))) : this.video.currentTime = t1; 42997 } 42998 } 42999 getVideo() { 43000 return this.video; 43001 } 43002 onAdd(e1) { 43003 this.map || (this.map = e1, this.load(), this.video && (this.video.play(), this.setCoordinates(this.coordinates))); 43004 } 43005 prepare() { 43006 if (0 === Object.keys(this.tiles).length || this.video.readyState < 2) return; 43007 const t1 = this.map.painter.context, i = t1.gl; 43008 this.texture ? this.video.paused || (this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE), i.texSubImage2D(i.TEXTURE_2D, 0, 0, 0, i.RGBA, i.UNSIGNED_BYTE, this.video)) : (this.texture = new e1.T(t1, this.video, i.RGBA8), this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE), this.width = this.video.videoWidth, this.height = this.video.videoHeight), this._prepareData(t1); 43009 } 43010 serialize() { 43011 return { 43012 type: "video", 43013 urls: this.options.urls, 43014 coordinates: this.coordinates 43015 }; 43016 } 43017 hasTransition() { 43018 return this.video && !this.video.paused; 43019 } 43020 constructor(e1, t1, i, s){ 43021 super(e1, t1, i, s), this.roundZoom = !0, this.type = "video", this.options = t1; 43022 } 43023 }, 43024 image: Co, 43025 canvas: class extends Co { 43026 async load() { 43027 this._loaded = !0, this.canvas || (this.canvas = this.options.canvas instanceof HTMLCanvasElement ? this.options.canvas : document.getElementById(this.options.canvas)), this.width = this.canvas.width, this.height = this.canvas.height, this._hasInvalidDimensions() ? this.fire(new e1.f(new Error("Canvas dimensions cannot be less than or equal to zero."))) : (this.play = function() { 43028 this._playing = !0, this.map.triggerRepaint(); 43029 }, this.pause = function() { 43030 this._playing && (this.prepare(), this._playing = !1); 43031 }, this._finishLoading()); 43032 } 43033 getCanvas() { 43034 return this.canvas; 43035 } 43036 onAdd(e1) { 43037 this.map = e1, this.load(), this.canvas && this.animate && this.play(); 43038 } 43039 onRemove(e1) { 43040 this.pause(); 43041 } 43042 prepare() { 43043 let t1 = !1; 43044 if (this.canvas.width !== this.width && (this.width = this.canvas.width, t1 = !0), this.canvas.height !== this.height && (this.height = this.canvas.height, t1 = !0), this._hasInvalidDimensions()) return; 43045 if (0 === Object.keys(this.tiles).length) return; 43046 const i = this.map.painter.context; 43047 this.texture ? !t1 && !this._playing || this.texture instanceof e1.cP || this.texture.update(this.canvas, { 43048 premultiply: !0 43049 }) : this.texture = new e1.T(i, this.canvas, i.gl.RGBA8, { 43050 premultiply: !0 43051 }), this._prepareData(i); 43052 } 43053 serialize() { 43054 return { 43055 type: "canvas", 43056 coordinates: this.coordinates 43057 }; 43058 } 43059 hasTransition() { 43060 return this._playing; 43061 } 43062 _hasInvalidDimensions() { 43063 for (const e1 of [ 43064 this.canvas.width, 43065 this.canvas.height 43066 ])if (isNaN(e1) || e1 <= 0) return !0; 43067 return !1; 43068 } 43069 constructor(t1, i, s, r){ 43070 super(t1, i, s, r), i.coordinates ? Array.isArray(i.coordinates) && 4 === i.coordinates.length && !i.coordinates.some((e1)=>!Array.isArray(e1) || 2 !== e1.length || e1.some((e1)=>"number" != typeof e1)) || this.fire(new e1.f(new ce("sources.".concat(t1), null, '"coordinates" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new e1.f(new ce("sources.".concat(t1), null, 'missing required property "coordinates"'))), i.animate && "boolean" != typeof i.animate && this.fire(new e1.f(new ce("sources.".concat(t1), null, 'optional "animate" property must be a boolean value'))), i.canvas ? "string" == typeof i.canvas || i.canvas instanceof HTMLCanvasElement || this.fire(new e1.f(new ce("sources.".concat(t1), null, '"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))) : this.fire(new e1.f(new ce("sources.".concat(t1), null, 'missing required property "canvas"'))), this.options = i, this.animate = void 0 === i.animate || i.animate; 43071 } 43072 }, 43073 custom: class extends e1.E { 43074 serialize() { 43075 return e1.cC(this, [ 43076 "type", 43077 "scheme", 43078 "minzoom", 43079 "maxzoom", 43080 "tileSize", 43081 "attribution" 43082 ]); 43083 } 43084 load() { 43085 this._loaded = !0, this.fire(new e1.h("data", { 43086 dataType: "source", 43087 sourceDataType: "metadata" 43088 })), this.fire(new e1.h("data", { 43089 dataType: "source", 43090 sourceDataType: "content" 43091 })); 43092 } 43093 loaded() { 43094 return this._loaded; 43095 } 43096 onAdd(t1) { 43097 this.map = t1, this._loaded = !1, this.fire(new e1.h("dataloading", { 43098 dataType: "source" 43099 })), this._implementation.onAdd && this._implementation.onAdd(t1), this.load(); 43100 } 43101 onRemove(e1) { 43102 this._implementation.onRemove && this._implementation.onRemove(e1); 43103 } 43104 hasTile(e1) { 43105 if (this._implementation.hasTile) {
43106 const { x: t1, y: i, z: s } = e1.canonical; 43107 return this._implementation.hasTile({ 43108 x: t1, 43109 y: i, 43110 z: s 43111 }); 43112 } 43113 return !this.tileBounds || this.tileBounds.contains(e1.canonical); 43114 } 43115 async loadTile(e1, t1) { 43116 const { x: i, y: s, z: r } = e1.tileID.canonical, o = new AbortController; 43117 e1.request = o; 43118 try { 43119 const n = await this._implementation.loadTile({ 43120 x: i, 43121 y: s, 43122 z: r 43123 }, { 43124 signal: o.signal 43125 }); 43126 if (delete e1.request, e1.aborted) return e1.state = "unloaded", t1(null); 43127 if (void 0 === n) return e1.state = "errored", t1(null); 43128 if (null === n) return this.loadTileData(e1, { 43129 width: this.tileSize, 43130 height: this.tileSize, 43131 data: null 43132 }), e1.state = "loaded", t1(null); 43133 if (!function(e1) { 43134 return e1 instanceof ImageData || e1 instanceof HTMLCanvasElement || e1 instanceof ImageBitmap || e1 instanceof HTMLImageElement; 43135 }(n)) return e1.state = "errored", t1(new Error("Can't infer data type for ".concat(this.id, ", only raster data supported at the moment"))); 43136 this.loadTileData(e1, n), e1.state = "loaded", t1(null); 43137 } catch (i) { 43138 if (o.signal.aborted) return; 43139 e1.state = "errored", t1(i); 43140 } 43141 } 43142 loadTileData(e1, t1) { 43143 e1.setTexture(t1, this.map.painter); 43144 } 43145 unloadTile(t1, i) { 43146 if (t1.texture && t1.texture instanceof e1.T ? (t1.destroy(!1), t1.texture && t1.texture instanceof e1.T && this.map.painter.saveTileTexture(t1.texture)) : t1.destroy(), this._implementation.unloadTile) { 43147 const { x: e1, y: i, z: s } = t1.tileID.canonical; 43148 this._implementation.unloadTile({ 43149 x: e1, 43150 y: i, 43151 z: s 43152 }); 43153 } 43154 i && i(); 43155 } 43156 abortTile(e1, t1) { 43157 e1.request && (e1.request.abort(), delete e1.request), t1 && t1(); 43158 } 43159 hasTransition() { 43160 return !1; 43161 } 43162 _coveringTiles() { 43163 return this.map.transform.coveringTiles({ 43164 tileSize: this.tileSize, 43165 minzoom: this.minzoom, 43166 maxzoom: this.maxzoom, 43167 roundZoom: this.roundZoom 43168 }).map((e1)=>({ 43169 x: e1.canonical.x, 43170 y: e1.canonical.y, 43171 z: e1.canonical.z 43172 })); 43173 } 43174 _clearTiles() { 43175 const t1 = e1.m(this.id, this.scope); 43176 this.map.style.clearSource(t1); 43177 } 43178 _update() { 43179 this.fire(new e1.h("data", { 43180 dataType: "source", 43181 sourceDataType: "content" 43182 })); 43183 } 43184 constructor(t1, i, s, r){ 43185 super(), this.id = t1, this.type = "custom", this._dataType = "raster", this._dispatcher = s, this._implementation = i, this.setEventedParent(r), this.scheme = "xyz", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this._loaded = !1, this.roundZoom = !0, this._implementation || this.fire(new e1.f(new Error("Missing implementation for ".concat(this.id, " custom source")))), this._implementation.loadTile || this.fire(new e1.f(new Error("Missing loadTile implementation for ".concat(this.id, " custom source")))), this._implementation.bounds && (this.tileBounds = new e1.cG(this._implementation.bounds, this.minzoom, this.maxzoom)); 43186 const o = i; 43187 o.update = this._update.bind(this), o.clearTiles = this._clearTiles.bind(this), o.coveringTiles = this._coveringTiles.bind(this), Object.assign(this, e1.cC(i, [ 43188 "dataType", 43189 "scheme", 43190 "minzoom", 43191 "maxzoom", 43192 "tileSize", 43193 "attribution", 43194 "minTileCacheSize",
43195 "maxTileCacheSize" 43196 ])); 43197 } 43198 } 43199 }, Io = function(t1, i, s, r) { 43200 const o = Do(i.type); 43201 if (!o) throw new Error('Unknown source type "'.concat(i.type, '"')); 43202 const n = new o(t1, i, s, r); 43203 if (n.id !== t1) throw new Error("Expected Source id to be ".concat(t1, " instead of ").concat(n.id)); 43204 return e1.aV([ 43205 "load", 43206 "abort", 43207 "unload", 43208 "serialize", 43209 "prepare" 43210 ], n), n; 43211 }, Do = function(e1) { 43212 return Object.hasOwn(Eo, e1) ? Eo[e1] : void 0; 43213 }; 43214 function Po(param, s, r) { 43215 let [t1, i] = param, { scaled: o = !0 } = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; 43216 const { tileSize: n, buffer: a } = r, { x: l, y: c, z: h } = s; 43217 if (!isFinite(l) || !isFinite(c) || !isFinite(h)) throw new Error("Invalid MRT header"); 43218 const d = 2 ** h, u = d * e1.a7(t1), p = d * e1.a8(i); 43219 return function(param, i) { 43220 let [e1, t1] = param, { scaled: s = !0 } = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 43221 if (!i) throw new Error("bandView is undefined"); 43222 const { data: r, tileSize: o, buffer: n, offset: a, scale: l, dimension: c } = i; 43223 if (e1 < -n || e1 > o + n || t1 < -n || t1 > o + n) throw new Error("Point (".concat(e1, ", ").concat(t1, ") out of bounds for tileSize=").concat(o, ", buffer=").concat(n)); 43224 const h = (t1 + n) * (o + 2 * n) + (e1 + n); 43225 if (4294967295 === new Uint32Array(r.buffer)[h]) return null; 43226 let d = []; 43227 d = s ? [] : new (0, i.data.constructor)(c); 43228 for(let e1 = 0; e1 < c; e1++)d[e1] = Math.round(1e12 * (r[c * h + e1] * l + a)) / 1e12; 43229 return d; 43230 }([ 43231 Math.min(Math.max(-a, Math.floor((u - l) * n)), n - 1 + a), 43232 Math.min(Math.max(-a, Math.floor((p - c) * n)), n - 1 + a) 43233 ], r, { 43234 scaled: o 43235 }); 43236 } 43237 class Lo extends Error { 43238 constructor(e1){ 43239 super(e1), this.name = "MRTOverzoomError"; 43240 } 43241 } 43242 const Ro = { 43243 uint8: Uint8Array, 43244 uint16: Uint16Array, 43245 uint32: Uint32Array 43246 }; 43247 function Ao(e1, t1, i) { 43248 const { x: s, y: r, z: o } = t1, { x: n, y: a, z: l } = i, c = l - o; 43249 if (c < 0) throw new Lo("Invalid overzoom, source (z=".concat(o, ") is higher zoom than destination (z=").concat(l, ").")); 43250 const h = n - (s << c), d = a - (r << c), u = 1 << c; 43251 if (h < 0 || h >= u || d < 0 || d >= u) throw new Lo("Invalid overzoom, ".concat(l, "/").concat(n, "/").concat(a, " is not a child of ").concat(o, "/").concat(s, "/").concat(r, ".")); 43252 const p = 0 | Math.log2(e1), f = Math.min(c, p), m = c - f, _ = e1 >> f; 43253 return { 43254 offset: [ 43255 (h >> m) * _, 43256 (d >> m) * _ 43257 ], 43258 tileSize: _, 43259 deltaZ: c 43260 }; 43261 } 43262 e1.c$.setPbf(e1.d0); 43263 class Mo extends fs { 43264 getLayers() { 43265 return this._mrt ? Object.values(this._mrt.layers) : []; 43266 } 43267 getLayer(e1) { 43268 return this._mrt && this._mrt.getLayer(e1); 43269 } 43270 setTexturePerLayer(t1, i, s) { 43271 const r = s.context, o = r.gl; 43272 let n = this.texturePerLayer.get(t1) || s.getTileTexture(i.width); 43273 n && n instanceof e1.T ? n.update(i, { 43274 premultiply: !1 43275 }) : (n = new e1.T(r, i, o.RGBA8, { 43276 premultiply: !1 43277 }), n.bind(o.LINEAR, o.CLAMP_TO_EDGE)), this.texturePerLayer.has(t1) || this.texturePerLayer.set(t1, n); 43278 } 43279 flushQueues(e1) { 43280 const t1 = this._workQueuePerLayer.get(e1) || [], i = this._fetchQueuePerLayer.get(e1) || []; 43281 for(; t1.length;)t1.pop()(); 43282 for(; i.length;)i.pop()(); 43283 } 43284 flushAllQueues() { 43285 for (const e1 of this._workQueuePerLayer.keys()){ 43286 const t1 = this._workQueuePerLayer.get(e1) || []; 43287 for(; t1.length;)t1.pop()(); 43288 } 43289 for (const e1 of this._fetchQueuePerLayer.keys()){ 43290 const t1 = this._fetchQueuePerLayer.get(e1) || []; 43291 for(; t1.length;)t1.pop()(); 43292 } 43293 } 43294 fetchHeader() { 43295 let t1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 16384, i = arguments.length > 1 ? arguments[1] : void 0; 43296 const s = this._mrt = new e1.c$(30), r = {
43297 ...this.requestParams, 43298 headers: { 43299 Range: "bytes=0-" + (t1 - 1) 43300 } 43301 }; 43302 this.entireBuffer = null; 43303 const o = new AbortController; 43304 return this.request = o, e1.d1(r, o.signal).then((param)=>{ 43305 let { data: e1, headers: r } = param; 43306 try { 43307 const o = s.getHeaderLength(e1); 43308 if (o > t1) return void (this.request = this.fetchHeader(o, i)); 43309 s.parseHeader(e1), this._isHeaderLoaded = !0; 43310 let n = 0; 43311 for (const e1 of Object.values(s.layers))n = Math.max(n, e1.dataIndex.at(-1).lastByte); 43312 e1.byteLength >= n && (this.entireBuffer = e1), i(null, this.entireBuffer || e1, r); 43313 } catch (e1) { 43314 i(e1); 43315 } 43316 }).catch((e1)=>{ 43317 o.signal.aborted || i(e1); 43318 }), this.request; 43319 } 43320 fetchBandForRender(e1, t1, i, s) { 43321 this.fetchBand(e1, t1, i, (r)=>{ 43322 if (r) return void s(r); 43323 this.updateTextureDescriptor(e1, t1, i); 43324 const o = this.textureDescriptorPerLayer.get(t1); 43325 s(null, o ? o.img : null); 43326 }); 43327 } 43328 fetchBand(t1, i, s, r) { 43329 const o = this._mrt; 43330 if (!this._isHeaderLoaded || !o) return void r(new Error("Tile header is not ready")); 43331 if (this.parentTile && this.overzoomCoordsPerLayer) return void r(null, null); 43332 const n = this.actor; 43333 if (!n) return void r(new Error("Can't fetch tile band without an actor")); 43334 let a; 43335 const l = e1.m(String(s), e1.m(this.tileID.key, t1)); 43336 let c = this._taskQueue.get(l); 43337 c ? c.add(r) : (c = new Set, c.add(r), this._taskQueue.set(l, c)); 43338 const h = (e1, t1)=>{ 43339 a.complete(e1, t1), e1 ? r(e1) : (c.forEach((e1)=>e1(null, t1)), this._taskQueue.delete(l)); 43340 }, d = (e1, t1)=>{ 43341 if (e1) return r(e1); 43342 let s, o = !1; 43343 if (null !== i) { 43344 const e1 = this._workQueuePerLayer.get(i) || []; 43345 e1.push(()=>{ 43346 o = !0, s && s.abort(), a.cancel(); 43347 }), this._workQueuePerLayer.has(i) || this._workQueuePerLayer.set(i, e1); 43348 } 43349 const l = ()=>{ 43350 o || (s = n.sendCancelable("decodeRasterArray", { 43351 type: "raster-array", 43352 source: this.source, 43353 scope: this.scope, 43354 tileID: this.tileID, 43355 uid: this.uid, 43356 buffer: t1, 43357 task: a 43358 }, {}, h)); 43359 }; 43360 void 0 !== this.workerReady ? this.workerReady.then(l).catch((e1)=>r(e1)) : l(); 43361 }; 43362 let u; 43363 try { 43364 u = o.getLayer(t1); 43365 } catch (e1) { 43366 if (this.parentTile && this.overzoomCoordsPerLayer) return void r(new Error("Layer '".concat(t1, "' not found in parent tile MRT"))); 43367 if ("reloading" === this.state) return; 43368 throw e1; 43369 } 43370 if (!u) return void r(new Error('Unknown sourceLayer "'.concat(t1, '"'))); 43371 if (u.hasDataForBand(s)) return c.forEach((e1)=>e1(null, null)), void this._taskQueue.delete(l); 43372 const p = u.getDataRange([ 43373 s 43374 ]); 43375 if (a = o.createDecodingTask(p), !a || a.tasks.length) if (null !== i && this.flushQueues(i), this.entireBuffer) d(null, this.entireBuffer.slice(p.firstByte, p.lastByte + 1)); 43376 else { 43377 const t1 = {
43378 ...this.requestParams, 43379 headers: { 43380 Range: "bytes=".concat(p.firstByte, "-").concat(p.lastByte) 43381 } 43382 }, s = new AbortController; 43383 if (e1.d1(t1, s.signal).then((param)=>{ 43384 let { data: e1 } = param; 43385 return d(null, e1); 43386 }).catch((e1)=>{ 43387 s.signal.aborted || d(e1); 43388 }), null !== i) { 43389 const e1 = this._fetchQueuePerLayer.get(i) || []; 43390 e1.push(()=>{ 43391 s.abort(), a.cancel(); 43392 }), this._fetchQueuePerLayer.has(i) || this._fetchQueuePerLayer.set(i, e1); 43393 } 43394 } 43395 } 43396 updateNeeded(e1, t1) { 43397 return (!this.textureDescriptorPerLayer.get(e1) || this.textureDescriptorPerLayer.get(e1).band !== t1 || this.refreshedUponExpiration) && "errored" !== this.state; 43398 } 43399 updateTextureDescriptor(t1, i, s) { 43400 if (!this._mrt) return; 43401 let r; 43402 try { 43403 r = this._mrt.getLayer(t1); 43404 } catch (e1) { 43405 return; 43406 } 43407 if (!r || !r.hasBand(s) || !r.hasDataForBand(s)) return; 43408 let { bytes: o, tileSize: n, buffer: a, offset: l, scale: c } = r.getBandView(s); 43409 if (this.parentTile && this.overzoomCoordsPerLayer) { 43410 const e1 = this.overzoomCoordsPerLayer.get(t1); 43411 e1 && (o = this.cropBandData(o, n, a, e1), n = e1.tileSize); 43412 } 43413 const h = n + 2 * a, d = new e1.b({ 43414 width: h, 43415 height: h 43416 }, o), u = this.texturePerLayer.get(i); 43417 u && u instanceof e1.T && u.update(d, { 43418 premultiply: !1 43419 }), this.textureDescriptorPerLayer.set(i, { 43420 layer: t1, 43421 band: s, 43422 img: d, 43423 buffer: a, 43424 offset: l, 43425 tileSize: n, 43426 format: r.pixelFormat, 43427 mix: [ 43428 c, 43429 256 * c, 43430 65536 * c, 43431 16777216 * c 43432 ] 43433 }); 43434 } 43435 cropBandData(e1, t1, i, s) { 43436 const { offset: r, tileSize: o } = s, n = t1 + 2 * i, a = o + 2 * i; 43437 return function(e1, t1, i, s) { 43438 const r = function(e1) { 43439 if (e1 instanceof Uint8Array) return "uint8"; 43440 if (e1 instanceof Uint16Array) return "uint16"; 43441 if (e1 instanceof Uint32Array) return "uint32"; 43442 throw new Error("Invalid array type"); 43443 }(e1), o = Ro[r]; 43444 if (!o) throw new Error('Invalid data type "'.concat(r, '"')); 43445 const n = t1[2] * t1[3], a = t1[1] * n, l = i[2] * i[3], c = i[1] * l, h = new o(c * i[0]); 43446 for(let r = 0; r < i[0]; r++){ 43447 let o = r * a; 43448 o += i[3] * (s[1] * t1[2] + s[0]); 43449 let d = r * c; 43450 for(let t1 = 0; t1 < i[1]; t1++)h.subarray(d, d + l).set(e1.subarray(o, o + l)), o += n, d += l; 43451 } 43452 return h; 43453 }(e1, [ 43454 1, 43455 n, 43456 n, 43457 4 43458 ], [ 43459 1, 43460 a, 43461 a, 43462 4 43463 ], r); 43464 } 43465 setupOverzoom(e1) { 43466 let t1 = e1; 43467 for(; t1.parentTile;)t1 = t1.parentTile; 43468 const i = t1._mrt; 43469 if (!i || !i.layers) return !1; 43470 const s = Object.values(i.layers); 43471 if (0 === s.length) return !1; 43472 const r = { 43473 x: t1.tileID.canonical.x, 43474 y: t1.tileID.canonical.y, 43475 z: t1.tileID.canonical.z 43476 }, o = { 43477 x: this.tileID.canonical.x, 43478 y: this.tileID.canonical.y, 43479 z: this.tileID.canonical.z 43480 }, n = new Map; 43481 for (const e1 of s)try { 43482 n.set(e1.name, Ao(e1.tileSize, r, o)); 43483 } catch (e1) { 43484 return !1; 43485 } 43486 return this.parentTile = t1, this._mrt = i, this._isHeaderLoaded = !0, this.overzoomCoordsPerLayer = n, !0; 43487 } 43488 destroy() { 43489 let t1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1; 43490 if (super.destroy(t1), delete this._mrt, !t1) for (const t1 of this.texturePerLayer.values())t1 && t1 instanceof e1.T && t1.destroy(); 43491 this.texturePerLayer.clear(), this.textureDescriptorPerLayer.clear(), this.fbo && (this.fbo.destroy(), delete this.fbo), delete this.request, delete this.requestParam
vendor: 11,324 bytes, lines 43491-43685
43491s, this._isHeaderLoaded = !1; 43492 } 43493 constructor(e1, t1, i, s, r){ 43494 super(e1, t1, i, s, r), this._workQueuePerLayer = new Map, this._fetchQueuePerLayer = new Map, this._taskQueue = new Map, this._isHeaderLoaded = !1, this._isLoadInProgress = !1, this.textureDescriptorPerLayer = new Map, this.texturePerLayer = new Map, this.parentTile = null, this.overzoomCoordsPerLayer = null; 43495 } 43496 } 43497 us = (e1, t1, i, s, r)=>new Mo(e1, t1, i, s, r); 43498 const Oo = { 43499 RasterArrayTileSource: class extends xo { 43500 get partial() { 43501 return !this.map.style.imageManager.hasImageProviderForSource(this.id, this.scope); 43502 } 43503 onAdd(e1) { 43504 super.onAdd(e1); 43505 const t1 = (e1)=>{ 43506 "source" === e1.dataType && "metadata" === e1.sourceDataType && (this.off("data", t1), void 0 === this._dataMaxzoom && (this._dataMaxzoom = this.maxzoom)); 43507 }; 43508 this.on("data", t1); 43509 } 43510 getDataMaxzoom() { 43511 return this._dataMaxzoom; 43512 } 43513 collectOverzoomParentTileIDs(e1, t1) { 43514 const i = []; 43515 for(const t1 in e1){ 43516 const s = e1[t1]; 43517 if (!s) continue; 43518 const r = s.parentTile; 43519 r && e1[r.tileID.key] && i.push(r.tileID); 43520 } 43521 const s = this._dataMaxzoom; 43522 if (void 0 !== s) for (const r of t1){ 43523 if (r.canonical.z <= s) continue; 43524 const t1 = r.scaledTo(s); 43525 e1[t1.key] && i.push(t1); 43526 } 43527 return i; 43528 } 43529 _narrowDataMaxzoom(e1) { 43530 const t1 = Math.max(this.minzoom, e1 - 1); 43531 (void 0 === this._dataMaxzoom || t1 < this._dataMaxzoom) && (this._dataMaxzoom = t1); 43532 } 43533 _isParentReady(e1) { 43534 const t1 = e1._mrt; 43535 return e1._isHeaderLoaded && !!t1 && !!t1.layers && Object.keys(t1.layers).length > 0; 43536 } 43537 _waitForParent(e1, t1) { 43538 if (this._isParentReady(e1)) return void t1(null); 43539 if ("errored" === e1.state) return void t1(new Error("Parent tile failed to load")); 43540 const i = this._pendingParentWaiters.get(e1.uid); 43541 if (i) return void i.push(t1); 43542 this._pendingParentWaiters.set(e1.uid, [ 43543 t1 43544 ]); 43545 const s = (t1)=>{ 43546 if ("source" !== t1.dataType || t1.tile !== e1) return; 43547 const i = this._isParentReady(e1); 43548 if (!i && "errored" !== e1.state) return; 43549 this.off("data", s); 43550 const r = this._pendingParentWaiters.get(e1.uid) || []; 43551 this._pendingParentWaiters.delete(e1.uid); 43552 const o = i ? null : new Error("Parent tile failed to load"); 43553 for (const e1 of r)e1(o); 43554 }; 43555 this.on("data", s); 43556 } 43557 triggerRepaint(e1) { 43558 const t1 = this.map.painter._terrain, i = this.map.style.getSourceCache(this.id); 43559 t1 && t1.enabled && i && t1._clearRenderCacheForTile(i.id, e1.tileID), this.map.triggerRepaint(); 43560 } 43561 _setupOverzoomTile(e1, t1) { 43562 const i = void 0 !== this._dataMaxzoom ? this._dataMaxzoom : this.maxzoom, s = this.map.style.getSourceCache(this.id); 43563 if (!s) return void t1(new Error("Source cache not found")); 43564 e1._isLoadInProgress = !0; 43565 const r = e1.tileID.scaledTo(i); 43566 let o = s.getTile(r); 43567 for(; o && o.parentTile;)o = o.parentTile; 43568 o || (o = s._addTile(r)); 43569 const n = (i)=>{ 43570 e1._isLoadInProgress = !1, t1(i); 43571 }; 43572 this._waitForParent(o, (t1)=>{ 43573 if (t1 || !e1.setupOverzoom(o)) return e1.state = "errored", void n(t1 || new Error("Parent tile setup failed")); 43574 e1.state = "loaded", n(null); 43575 }); 43576 } 43577 async loadTile(t1, i) { 43578 const s = t1.tileID.canonical.z > (void 0 !== this._dataMaxzoom ? this._dataMaxzoom : this.maxzoom); 43579 if ("loaded" === t1.state) return void i(null); 43580 if (t1._isLoadInProgress) return void i(null); 43581 if (s) return void this._setupOverzoomTile(t1, i); 43582 const r = this.map._requestManager.normalizeTileURL(t1.tileID.canonical.url(this.tiles, this.scheme), !1, this.tileSize); 43583 t1.source = this.id, t1.scope = this.scope, void 0 === this._workerReady && (this._workerReady = this.dispatcher.send("ensureRasterArraySource", void 0).then(()=>{}), this._workerReady.catch(()=>{})), t1.workerReady = this._workerReady, t1.actor || (t1.actor = this.dispatcher.getActor()); 43584 const o = new AbortController; 43585 t1.request = o; 43586 const n = (s, r, o)=>{ 43587 if (delete t1.request, t1.aborted) return i(null); 43588 if (s) return (404 === s.status || "string" == typeof s.message && s.message.includes("Not Found")) && (this._narrowDataMaxzoom(t1.tileID.canonical.z), void 0 !== this._dataMaxzoom && t1.tileID.canonical.z > this._dataMaxzoom) ? void this._setupOverzoomTile(t1, i) : (t1.state = "errored", i(s)); 43589 if (this.map._refreshExpiredTiles && r && t1.setExpiryData(e1.cJ(o)), this.partial && "expired" !== t1.state) t1.state = "empty"; 43590 else if (!this.partial) { 43591 if (!r) return i(null); 43592 t1.state = "loaded", t1._isHeaderLoaded = !0, t1._mrt = r; 43593 } 43594 i(null); 43595 }; 43596 try { 43597 const s = await this.map._requestManager.transformRequest(r, e1.R.Tile, o.signal); 43598 if (o.signal.aborted) return i(null); 43599 t1.requestParams = s; 43600 const a = { 43601 request: s, 43602 uid: t1.uid, 43603 tileID: t1.tileID, 43604 type: this.type, 43605 source: this.id, 43606 scope: this.scope, 43607 partial: this.partial 43608 }; 43609 t1.request = this.partial ? t1.fetchHeader(void 0, (e1, t1, i)=>{ 43610 n(e1, t1, i); 43611 }) : t1.actor.sendCancelable("loadTile", a, {}, (e1, t1)=>e1 ? n(e1) : t1 ? void n(null, t1.mrt, t1.headers) : n(null, null)); 43612 } catch (e1) { 43613 if (o.signal.aborted) return i(null); 43614 t1.state = "errored", i(e1); 43615 } 43616 } 43617 abortTile(e1) { 43618 e1.request && (e1.request.abort(), delete e1.request), e1.actor && e1.actor.notify("abortTile", { 43619 uid: e1.uid, 43620 type: this.type, 43621 source: this.id, 43622 scope: this.scope 43623 }); 43624 } 43625 unloadTile(e1, t1) { 43626 const i = e1.texturePerLayer; 43627 if (e1.flushAllQueues(), i.size) { 43628 e1.destroy(!1); 43629 for (const e1 of i.values())this.map.painter.saveTileTexture(e1); 43630 } else e1.destroy(); 43631 } 43632 prepareTile(t1, i, s, r) { 43633 t1.tileID.canonical.z > (void 0 !== this._dataMaxzoom ? this._dataMaxzoom : this.maxzoom) && (!t1.parentTile || !t1.overzoomCoordsPerLayer) || t1._isHeaderLoaded && ("empty" !== t1.state && (t1.state = "reloading"), t1.fetchBandForRender(i, s, r, (i, r)=>{ 43634 i ? (t1.state = "errored", this.fire(new e1.f(i))) : r && (t1._isHeaderLoaded = !0, t1.setTexturePerLayer(s, r, this.map.painter), t1.state = "loaded"), this.triggerRepaint(t1); 43635 })); 43636 } 43637 getInitialBand(e1) { 43638 if (!this.rasterLayers) return 0; 43639 const t1 = this.rasterLayers.find((param)=>{ 43640 let { id: t1 } = param; 43641 return t1 === e1; 43642 }), i = t1 && t1.fields, s = i && i.bands && i.bands; 43643 return s ? s[0] : 0; 43644 } 43645 getTextureDescriptor(t1, i, s) { 43646 if (!t1) return; 43647 const r = i.sourceLayer || this.rasterLayerIds && this.rasterLayerIds[0]; 43648 if (!r) return; 43649 let o = null; 43650 i instanceof e1.cY ? o = i.paint.get("raster-array-band") : i instanceof e1.cZ && (o = i.paint.get("raster-particle-array-band")); 43651 const n = o || this.getInitialBand(r); 43652 return null == n || !t1.textureDescriptorPerLayer.get(i.id) || t1.updateNeeded(i.id, n) && !s ? void 0 : { 43653 ...t1.textureDescriptorPerLayer.get(i.id), 43654 texture: t1.texturePerLayer.get(i.id) 43655 }; 43656 } 43657 getImages(t1, i) { 43658 const s = new Map; 43659 for (const r of t1)for (const t1 of i){ 43660 const [i, o] = t1.split("/"), n = r.getLayer(i); 43661 if (!n) continue; 43662 if (!n.hasBand(o) || !n.hasDataForBand(o)) continue; 43663 const { bytes: a, tileSize: l, buffer: c } = n.getBandView(o), h = l + 2 * c, d = { 43664 data: new e1.b({ 43665 width: h, 43666 height: h 43667 }, a), 43668 pixelRatio: 2, 43669 sdf: !1, 43670 usvg: !1, 43671 version: 0 43672 }; 43673 s.set(t1, d); 43674 } 43675 return s; 43676 } 43677 queryRasterArrayValueByBandId(t1, i, s) { 43678 const r = i._mrt; 43679 return new Promise((o)=>{ 43680 const n = {}, a = new Set; 43681 for (const [l, c] of Object.entries(r.layers)){ 43682 if (s.layerName && l !== s.layerName) continue; 43683 const h = {}; 43684 n[l] = h; 43685 for (const { bands: d } of c.dataIndex)for (const u of d)s.bands && !s.bands.includes(u) || (a.add(e1.m(l, u)), i.fetchBand(l, null, u,
43685(i)=>{ 43686 e1.e.frame(()=>{ 43687 h[u] = i ? null : Po([ 43688 t1.lng, 43689 t1.lat 43690 ], r, c.getBandView(u)), a.delete(e1.m(l, u)), 0 === a.size && o(n); 43691 }); 43692 })); 43693 } 43694 0 === a.size && o(n); 43695 }); 43696 } 43697 _loadTileForQuery(e1) { 43698 if (this._loadTileLoaded[e1.uid]) return Promise.resolve(e1._mrt); 43699 if (e1.uid in this._loadTilePending) return this._loadTilePending[e1.uid]; 43700 const t1 = this._fetchTileForQuery(e1); 43701 return this._loadTilePending[e1.uid] = t1, t1; 43702 } 43703 async _fetchTileForQuery(t1) { 43704 const i = this.map._requestManager.normalizeTileURL(t1.tileID.canonical.url(this.tiles, this.scheme), !1, this.tileSize); 43705 try { 43706 const s = { 43707 request: await this.map._requestManager.transformRequest(i, e1.R.Tile), 43708 uid: t1.uid, 43709 tileID: t1.tileID, 43710 type: this.type, 43711 source: this.id, 43712 scope: this.scope, 43713 partial: !1 43714 }, r = await t1.actor.send("loadTile", s); 43715 if (!r) return null; 43716 const o = r.mrt; 43717 return this.map._refreshExpiredTiles && t1.setExpiryData(e1.cJ(r.headers)), t1._mrt = o, t1._isHeaderLoaded = !0, t1.state = "loaded", this._loadTileLoaded[t1.uid] = !0, o; 43718 } finally{ 43719 delete this._loadTilePending[t1.uid]; 43720 } 43721 } 43722 async queryRasterArrayValueByAllBands(e1, t1, i) { 43723 return await this._loadTileForQuery(t1) ? this.queryRasterArrayValueByBandId(e1, t1, i) : null; 43724 } 43725 queryRasterArrayValue(t1, i) { 43726 const s = e1.c_.convert(t1), r = this.findLoadedParent(s); 43727 return r && r._mrt ? i.bands || !this.partial ? this.queryRasterArrayValueByBandId(s, r, i) : this.queryRasterArrayValueByAllBands(s, r, i) : Promise.resolve(null); 43728 } 43729 findLoadedParent(t1) { 43730 const i = e1.bS.fromLngLat(t1, this.map.transform.tileSize), s = this.maxzoom + 1, r = 1 << s, o = Math.floor(i.x), n = Math.floor((i.x - o) * r), a = Math.floor(i.y * r); 43731 if (n < 0 || n >= r || a < 0 || a >= r) return null; 43732 const l = this.map.style.getSourceCache(this.id), c = new e1.bP(s, o, s, n, a); 43733 return l.findLoadedParent(c, this.minzoom); 43734 } 43735 constructor(e1, t1, i, s){ 43736 super(e1, t1, i, s), this.type = "raster-array", this.maxzoom = void 0 !== t1.maxzoom ? t1.maxzoom : 22, this._loadTilePending = {}, this._loadTileLoaded = {}, this._pendingParentWaiters = new Map, this._options = { 43737 type: "raster-array", 43738 ...t1 43739 }; 43740 } 43741 } 43742 }, Fo = Oo, ko = { 43743 model: ()=>hi().then(()=>ci.ModelSource), 43744 "batched-model": ()=>hi().then(()=>ci.Tiled3dModelSource), 43745 "raster-array": ()=>(async function() { 43746 return Promise.resolve(); 43747 })().then(()=>Fo.RasterArrayTileSource) 43748 }; 43749 class Bo extends e1.E { 43750 hasTransition() { 43751 return !1; 43752 } 43753 loaded() { 43754 return !1; 43755 } 43756 onAdd(e1) {} 43757 onRemove(e1) {} 43758 loadTile(e1, t1) {} 43759 serialize() { 43760 return this._options; 43761 } 43762 constructor(e1, t1, i, s){ 43763 super(), this.id = e1, this.type = t1.type, this._options = t1, this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.setEventedParent(s); 43764 } 43765 } 43766 function zo(e1, t1) { 43767 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ""; 43768 return "".concat(i, ":").concat(t1.id || "", ":").concat(t1.layer.id, ":").concat(function(e1) { 43769 if ("layerId" in e1) return "layer:".concat(e1.layerId); 43770 { 43771 const { featuresetId: t1, importId: i } = e1; 43772 return "featureset:".concat(t1).concat(i ? ":import:".concat(i) : ""); 43773 } 43774 }(e1.target)); 43775 } 43776 function Uo(e1, t1, i) { 43777 let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ""; 43778 if (e1.uniqueFeatureID) { 43779 const r = zo(e1, t1, s); 43780 if (i.has(r)) return !0; 43781 i.add(r); 43782 } 43783 return !1; 43784 } 43785 function No(e1, t1, i, s) { 43786 let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1, o = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : void 0; 43787 const n = t1.sourceCache.transform, a = t1.sourceCache.tilesIn(e1, t1.has3DLayers, r); 43788 a.sort(Go); 43789 const l = []; 43790 for (const e1 of a){ 43791 const a = e1.tile.queryRenderedFeatures(t1, e1, i, s, n, r, o); 43792 Object.keys(a).length && l.push({ 43793 wrappedTileID: e1.tile.tileID.wrapped().key, 43794 queryResults: a 43795 }); 43796 } 43797 for(const i in t1.layers){ 43798 const r = t1.layers[i]; 43799 if (r.styleLayer) { 43800 const i = r.styleLayer.queryRenderedFeatures(e1, t1.sourceCache, s); 43801 Object.keys(i).length && l.push({ 43802 wrappedTileID: 0, 43803 queryResults: i 43804 }); 43805 } 43806 } 43807 return 0 === l.length ? {} : function(e1) { 43808 const t1 = {}, i = {}; 43809 for (const s of e1){ 43810 const e1 = s.queryResults, r = s.wrappedTileID, o = i[r] = i[r] || {}; 43811 for(const i in e1){ 43812 const s = e1[i], r = o[i] = o[i] || {}, n = t1[i] = t1[i] || [];
vendor: 6,234 bytes, lines 43813-43935
43813 for (const e1 of s)r[e1.featureIndex] || (r[e1.featureIndex] = !0, n.push(e1)); 43814 } 43815 } 43816 return t1; 43817 }(l); 43818 } 43819 function jo(e1, t1, i, s, r, o) { 43820 const n = {}, a = s.queryRenderedSymbols(e1), l = []; 43821 for (const e1 of Object.keys(a).map(Number))l.push(r[e1]); 43822 l.sort(Go); 43823 for (const e1 of l){ 43824 const s = e1.featureIndex.lookupSymbolFeatures(a[e1.bucketInstanceId], e1.bucketIndex, e1.sourceLayerIndex, t1, i, o); 43825 for(const t1 in s){ 43826 const i = n[t1] = n[t1] || [], r = s[t1]; 43827 r.sort((t1, i)=>{ 43828 const s = e1.featureSortOrder; 43829 if (s) { 43830 const e1 = s.indexOf(t1.featureIndex); 43831 return s.indexOf(i.featureIndex) - e1; 43832 } 43833 return i.featureIndex - t1.featureIndex; 43834 }); 43835 for (const e1 of r)i.push(e1); 43836 } 43837 } 43838 return n; 43839 } 43840 function Vo(e1, t1) { 43841 const i = e1.getRenderableIds().map((t1)=>e1.getTileByID(t1)), s = [], r = {}; 43842 for(let e1 = 0; e1 < i.length; e1++){ 43843 const o = i[e1], n = o.tileID.canonical.key; 43844 r[n] || (r[n] = !0, o.querySourceFeatures(s, t1)); 43845 } 43846 return s; 43847 } 43848 function Go(e1, t1) { 43849 const i = e1.tileID, s = t1.tileID; 43850 return i.overscaledZ - s.overscaledZ || i.canonical.y - s.canonical.y || i.wrap - s.wrap || i.canonical.x - s.canonical.x; 43851 } 43852 class qo { 43853 processLayersChanged() { 43854 this.layers = []; 43855 const e1 = !1, t1 = !1; 43856 for(const i in this.style._mergedLayers){ 43857 const s = this.style._mergedLayers[i]; 43858 if ("fill-extrusion" === s.type || "building" === s.type) this.layers.push({ 43859 layer: s, 43860 visible: e1, 43861 visibilityChanged: t1 43862 }); 43863 else if ("model" === s.type) { 43864 const i = this.style.getLayerSource(s); 43865 i && "batched-model" === i.type && this.layers.push({ 43866 layer: s, 43867 visible: e1, 43868 visibilityChanged: t1 43869 }); 43870 } 43871 } 43872 } 43873 onNewFrame(e1) { 43874 this.layersGotHidden = !1; 43875 for (const t1 of this.layers){ 43876 const i = t1.layer; 43877 let s = !1; 43878 "fill-extrusion" === i.type ? s = !i.isHidden(e1) && i.paint.get("fill-extrusion-opacity") > 0 : "building" === i.type ? s = !i.isHidden(e1) && i.paint.get("building-opacity") > 0 : "model" === i.type && (s = !i.isHidden(e1) && i.paint.get("model-opacity").constantOr(1) > 0), this.layersGotHidden = this.layersGotHidden || !s && t1.visible, t1.visible = s; 43879 } 43880 } 43881 updateZOffset(e1, t1) { 43882 this.currentBuildingBuckets = []; 43883 for (const e1 of this.layers){ 43884 const i = e1.layer, s = this.style.getLayerSourceCache(i); 43885 let r = 1; 43886 "fill-extrusion" === i.type ? r = e1.visible ? i.paint.get("fill-extrusion-vertical-scale") : 0 : "building" === i.type && (r = e1.visible ? i.paint.get("building-vertical-scale") : 0); 43887 let o = s ? s.getTile(t1) : null; 43888 if (!o && s) for(const e1 in s._tiles){ 43889 const i = s._tiles[e1]; 43890 if (t1.canonical.isChildOf(i.tileID.canonical)) { 43891 o = i; 43892 break; 43893 } 43894 } 43895 this.currentBuildingBuckets.push({ 43896 bucket: o ? o.getBucket(i) : null, 43897 tileID: o ? o.tileID : t1, 43898 verticalScale: r 43899 }); 43900 } 43901 e1.hasAnyZOffset = !1; 43902 let i = !1; 43903 for(let s = 0; s < e1.symbolInstances.length; s++){ 43904 const r = e1.symbolInstances.get(s), o = r.zOffset, n = this._getHeightAtTileOffset(t1, r.tileAnchorX, r.tileAnchorY); 43905 r.zOffset = n !== Number.NEGATIVE_INFINITY ? n : o, i || o === r.zOffset || (i = !0), e1.hasAnyZOffset || 0 === r.zOffset || (e1.hasAnyZOffset = !0); 43906 } 43907 i && (e1.zOffsetBuffersNeedUpload = !0, e1.zOffsetSortDirty = !0); 43908 } 43909 hasLayerForSourceCache(e1) { 43910 for (const { layer: t1 } of this.layers){ 43911 const i = this.style.getLayerSourceCache(t1); 43912 if (i && i.id === e1) return !0; 43913 } 43914 return !1; 43915 } 43916 _mapCoordToOverlappingTile(t1, i, s, r) { 43917 let o = i, n = s; 43918 if (t1.canonical.z !== r.canonical.z) { 43919 const a = r.canonical, l = 1 / (1 << t1.canonical.z - a.z); 43920 o = (i + t1.canonical.x * e1.a6) * l - a.x * e1.a6 | 0, n = (s + t1.canonical.y * e1.a6) * l - a.y * e1.a6 | 0; 43921 } 43922 return { 43923 tileX: o, 43924 tileY: n 43925 }; 43926 } 43927 _getHeightAtTileOffset(e1, t1, i) { 43928 let s, r; 43929 for(let o = 0; o < this.layers.length; ++o){ 43930 const n = this.layers[o].layer; 43931 if ("fill-extrusion" !== n.type && "building" !== n.type) continue; 43932 const { bucket: a, tileID: l, verticalScale: c } = this.currentBuildingBuckets[o]; 43933 if (!a) continue; 43934 const { tileX: h, tileY: d } = this._mapCoordToOverlappingTile(e1, t1, i, l), u = a.getHeightAtTileCoord(h, d); 43935 u && void 0 !== u.height && (u.hidden ? s = u.height : r = Math.max(u.he
43935ight * c, r || 0)); 43936 } 43937 if (void 0 !== r) return r; 43938 for(let r = 0; r < this.layers.length; ++r){ 43939 const o = this.layers[r]; 43940 if ("model" !== o.layer.type || !o.visible) continue; 43941 const { bucket: n, tileID: a } = this.currentBuildingBuckets[r]; 43942 if (!n) continue; 43943 const { tileX: l, tileY: c } = this._mapCoordToOverlappingTile(e1, t1, i, a), h = n.getHeightAtTileCoord(l, c); 43944 if (h && !h.hidden) return void 0 === h.height && void 0 !== s ? Math.min(h.maxHeight, s) * h.verticalScale : h.height ? h.height * h.verticalScale : Number.NEGATIVE_INFINITY; 43945 } 43946 return this.layersGotHidden ? 0 : Number.NEGATIVE_INFINITY; 43947 } 43948 constructor(e1){ 43949 this.style = e1, this.layersGotHidden = !1, this.layers = []; 43950 } 43951 } 43952 let Zo; 43953 function $o() { 43954 return Zo || (Zo = new Jt), Zo; 43955 } 43956 function Ho(t1, i) { 43957 const s = {}, r = t1, o = i, n = s; 43958 for(const e1 in r)"ref" !== e1 && (n[e1] = r[e1]); 43959 return e1.d2.forEach((e1)=>{ 43960 e1 in o && (n[e1] = o[e1]); 43961 }), s; 43962 } 43963 function Wo(e1) { 43964 e1 = e1.slice(); 43965 const t1 = Object.create(null); 43966 for (const i of e1)t1[i.id] = i; 43967 for(let i = 0; i < e1.length; i++){ 43968 const s = e1[i]; 43969 if (s && "ref" in s) { 43970 const r = t1[s.ref]; 43971 r && (e1[i] = Ho(s, r)); 43972 } 43973 } 43974 return e1; 43975 } 43976 class Xo { 43977 isHidden() { 43978 return 0 === this.opacity && !this.placed; 43979 } 43980 constructor(e1, t1, i, s){ 43981 this.opacity = e1 ? Math.max(0, Math.min(1, e1.opacity + (e1.placed ? t1 : -t1))) : s && i ? 1 : 0, this.placed = i; 43982 } 43983 } 43984 class Ko { 43985 isHidden() { 43986 return this.text.isHidden() && this.icon.isHidden(); 43987 } 43988 constructor(e1, t1, i, s, r, o = !1){ 43989 this.text = new Xo(e1 ? e1.text : null, t1, i, r), this.icon = new Xo(e1 ? e1.icon : null, t1, s, r), this.clipped = o; 43990 } 43991 } 43992 class Yo { 43993 constructor(e1, t1, i, s = !1){ 43994 this.text = e1, this.icon = t1, this.skipFade = i, this.clipped = s; 43995 } 43996 } 43997 class Qo { 43998 constructor(){ 43999 this.invProjMatrix = e1.Y(), this.viewportMatrix = e1.Y(), this.circles = []; 44000 } 44001 } 44002 class Jo { 44003 constructor(e1, t1, i, s, r){ 44004 this.bucketInstanceId = e1, this.featureIndex = t1, this.sourceLayerIndex = i, this.bucketIndex = s, this.tileID = r; 44005 } 44006 } 44007 class en { 44008 get(e1) { 44009 if (this.crossSourceCollisions) return { 44010 ID: 0, 44011 predicate: null 44012 }; 44013 if (!this.collisionGroups[e1]) { 44014 const t1 = ++this.maxGroupID; 44015 this.collisionGroups[e1] = { 44016 ID: t1, 44017 predicate: (e1)=>e1.collisionGroupID === t1 44018 }; 44019 } 44020 return this.collisionGroups[e1]; 44021 } 44022 constructor(e1){ 44023 this.crossSourceCollisions = e1, this.maxGroupID = 0, this.collisionGroups = {}; 44024 } 44025 } 44026 function tn(t1, i, s, r, o) { 44027 const { horizontalAlign: n, verticalAlign: a } = e1.db(t1), l = -(n - .5) * i, c = -(a - .5) * s, h = e1.dc(t1, r); 44028 return new e1.P(l + h[0] * o, c + h[1] * o); 44029 } 44030 function sn(t1, i, s, r, o) { 44031 const n = new e1.P(t1, i); 44032 return s && n._rotate(r ? o : -o), n; 44033 } 44034 function rn(t1, i, s, r) { 44035 const { leftJustifiedTextSymbolIndex: o, centerJustifiedTextSymbolIndex: n, rightJustifiedTextSymbolIndex: a, verticalPlacedTextSymbolIndex: l, crossTileID: c } = s, h = e1.dd(i), d = r === e1.da.vertical ? l : "left" === h ? o : "center" === h ? n : "right" === h ? a : -1; 44036 o >= 0 && (t1.text.placedSymbolArray.get(o).crossTileID = d >= 0 && o !== d ? 0 : c), n >= 0 && (t1.text.placedSymbolArray.get(n).crossTileID = d >= 0 && n !== d ? 0 : c), a >= 0 && (t1.text.placedSymbolArray.get(a).crossTileID = d >= 0 && a !== d ? 0 : c), l >= 0 && (t1.text.placedSymbolArray.get(l).crossTileID = d >= 0 && l !== d ? 0 : c); 44037 } 44038 function on(t1, i, s) { 44039 const r = i === e1.da.horizontal || i === e1.da.horizontalOnly ? i : 0, o = i === e1.da.vertical ? i : 0, { leftJustifiedTextSymbolIndex: n, centerJustifiedTextSymbolIndex: a, rightJustifiedTextSymbolIndex: l, verticalPlacedTextSymbolIndex: c } = s, h = t1.text.placedSymbolArray; 44040 n >= 0 && (h.get(n).placedOrientation = r), a >= 0 && (h.get(a).placedOrientation = r), l >= 0 && (h.get(l).placedOrientation = r), c >= 0 && (h.get(c).placedOrientation = o); 44041 } 44042 class nn { 44043 getBucketParts(t1, i, s, r) { 44044 let o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1; 44045 const n = s.getBucket(i), a = s.latestFeatureIndex; 44046 if (!n || !a || i.fqid !== n.layerIds[0]) return; 44047 const l = n.layers[0].layout, c = n.layers[0].paint, h = s.collisionBoxArray, d = Math.pow(2, this.transform.zoom - s.tileID.overscaledZ
vendor: 25,681 bytes, lines 44047-44398
44047), u = s.tileSize / e1.a6, p = s.tileID.toUnwrapped(); 44048 this.transform.setProjection(n.projection); 44049 const f = (m = s.tileID, _ = n.getProjection(), g = this.transform, _.name === this.projection ? g.calculateProjMatrix(m.toUnwrapped()) : gt(g, _, m)); 44050 var m, _, g; 44051 const y = "map" === l.get("text-pitch-alignment"), v = "map" === l.get("text-rotation-alignment"); 44052 i.compileFilter(i.options); 44053 const b = i.dynamicFilter(), x = i.dynamicFilterNeedsFeature(), w = i.dynamicFilterNeedsGeometry(), T = this.transform.calculatePixelsToTileUnitsMatrix(s), S = e1.d3(f, s.tileID.canonical, y, v, this.transform, n.getProjection(), T); 44054 let C = null; 44055 const E = n.getProjection().createInversionMatrix(this.transform, s.tileID.canonical); 44056 if (y) { 44057 const t1 = e1.d4(f, s.tileID.canonical, y, v, this.transform, n.getProjection(), T); 44058 C = e1.X([], this.transform.labelPlaneMatrix, t1); 44059 } 44060 let I = null; 44061 b && s.latestFeatureIndex && (I = { 44062 unwrappedTileID: p, 44063 dynamicFilter: b, 44064 dynamicFilterNeedsFeature: x, 44065 needGeometry: w 44066 }), this.retainedQueryData[n.bucketInstanceId] = new Jo(n.bucketInstanceId, a, n.sourceLayerIndex, n.index, s.tileID); 44067 const [D, P] = n.layers[0].layout.get("text-size-scale-range"), L = e1.b0(o, D, P), [R, A] = l.get("icon-size-scale-range"), M = e1.b0(o, R, A), O = { 44068 bucket: n, 44069 layout: l, 44070 paint: c, 44071 posMatrix: f, 44072 invMatrix: E, 44073 mercatorCenter: [ 44074 e1.a7(this.transform.center.lng), 44075 e1.a8(this.transform.center.lat) 44076 ], 44077 textLabelPlaneMatrix: S, 44078 labelToScreenMatrix: C, 44079 clippingData: I, 44080 scale: d, 44081 textPixelRatio: u, 44082 holdingForFade: s.holdingForFade(), 44083 collisionBoxArray: h, 44084 partiallyEvaluatedTextSize: e1.d5(n.textSizeData, this.transform.zoom, L), 44085 partiallyEvaluatedIconSize: e1.d5(n.iconSizeData, this.transform.zoom, M), 44086 collisionGroup: this.collisionGroups.get(n.sourceID), 44087 latestFeatureIndex: s.latestFeatureIndex 44088 }; 44089 if (r) for (const e1 of n.sortKeyRanges){ 44090 const { sortKey: i, symbolInstanceStart: s, symbolInstanceEnd: r } = e1; 44091 t1.push({ 44092 sortKey: i, 44093 symbolInstanceStart: s, 44094 symbolInstanceEnd: r, 44095 parameters: O 44096 }); 44097 } 44098 else t1.push({ 44099 symbolInstanceStart: 0, 44100 symbolInstanceEnd: n.symbolInstances.length, 44101 parameters: O 44102 }); 44103 } 44104 placeLayerBucketPart(e1, t1, i) { 44105 let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1; 44106 this.algorithm.placeLayerBucketPart(this, e1, t1, i, s); 44107 } 44108 commit(e1) { 44109 this.commitTime = e1, this.zoomAtLastRecencyCheck = this.transform.zoom; 44110 const t1 = this.prevPlacement; 44111 let i = !1; 44112 this.prevZoomAdjustment = t1 ? t1.zoomAdjustment(this.transform.zoom) : 0; 44113 const s = t1 ? t1.symbolFadeChange(e1) : 1, r = t1 ? t1.opacities : {}, o = t1 ? t1.variableOffsets : {}, n = t1 ? t1.placedOrientations : {}; 44114 for(const e1 in this.placements){ 44115 const t1 = this.placements[e1], o = r[e1]; 44116 o ? (this.opacities[e1] = new Ko(o, s, t1.text, t1.icon, null, t1.clipped), i = i || t1.text !== o.text.placed || t1.icon !== o.icon.placed) : (this.opacities[e1] = new Ko(null, s, t1.text, t1.icon, t1.skipFade, t1.clipped), i = i || t1.text || t1.icon); 44117 } 44118 for(const e1 in r){ 44119 const t1 = r[e1]; 44120 if (!this.opacities[e1]) { 44121 const r = new Ko(t1, s, !1, !1); 44122 r.isHidden() || (this.opacities[e1] = r, i = i || t1.text.placed || t1.icon.placed); 44123 } 44124 } 44125 for(const e1 in o)this.variableOffsets[e1] || !this.opacities[e1] || this.opacities[e1].isHidden() || (this.variableOffsets[e1] = o[e1]); 44126 for(const e1 in n)this.placedOrientations[e1] || !this.opacities[e1] || this.opacities[e1].isHidden() || (this.placedOrientations[e1] = n[e1]); 44127 i ? this.lastPlacementChangeTime = e1 : "number" != typeof this.lastPlacementChangeTime && (this.lastPlacementChangeTime = t1 ? t1.lastPlacementChangeTime : e1); 44128 } 44129 updateLayerOpacities(t1, i, s, r) { 44130 let o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1, n = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 1; 44131 r && (this.lastReplacementSourceUpdateTime = r.updateTime); 44132 const a = new Set; 44133 for (const l of i){ 44134 const i = l.getBucket(t1); 44135 if (i && l.latestFeatureIndex && t1.fqid === i.layerIds[0] && (this.updateBucketOpacities(i, a, l, l.collisionBoxArray, s, r, l.tileID, t1.scope), "offset" === i.elevationType && this.buildingIndex && this.buildingIndex.updateZOffset(i, l.tileID), "road" === i.elevationType && i.hdExt && i.hdExt.updateRoadElevation(i, l.tileID.canonical), i.updateZOffset(), o && l.collisionBoxArray)) { 44136 const t1 = i.layers[0].layout, [s, r] = t1.get("text-size-scale-range"), [o, a] = t1.get("icon-size-scale-range"), c = e1.b0(n, s, r), h = e1.b0(n, o, a); 44137 i.updateCollisionDebugBuffers(this.transform.zoom, l.collisionBoxArray, c, h); 44138 } 44139 } 44140 } 44141 updateBucketOpacities(t1, i, s, r, o, n, a, l) { 44142 t1.hasTextData() && t1.text.opacityVertexArray.clear(), t1.hasIconData() && t1.icon.opacityVertexArray.clear(), t1.hasIconCollisionBoxData() && t1.iconCollisionBox.collisionVertexArray.clear(), t1.hasTextCollisionBoxData() && t1.textCollisionBox.collisionVertexArray.clear(); 44143 const c = t1.layers[0].layout, h = t1.layers[0].paint, d = !!t1.layers[0].dynamicFilter(), u = new Ko(null, 0, !1, !1, !0), p = c.get("text-allow-overlap"), f = c.get("icon-allow-overlap"), m = c.get("text-variable-anchor"), _ = "map" === c.get("text-rotation-alignment"), g = "map" === c.get("text-pitch-alignment"), y = h.get("symbol-z-offset"), v = "sea" === c.get("symbol-elevation-reference"), b = !y.isConstant(), x = new Ko(null, 0, p && (f || !t1.hasIconData() || c.get("icon-optional")), f && (p || !t1.hasTextData() || c.get("text-optional")), !0); 44144 !t1.collisionArrays && r && (t1.hasIconCollisionBoxData() || t1.hasTextCollisionBoxData()) && t1.deserializeCollisionBoxes(r); 44145 const w = (e1, t1, i)=>{ 44146 for(let s = 0; s < t1 / 4; s++)e1.opacityVertexArray.emplaceBack(i); 44147 }; 44148 let T = 0; 44149 n && t1.updateReplacement(a, n), this.collisionIndex.clearClippedSymbolsForBucket(t1.bucketInstanceId); 44150 for(let r = 0; r < t1.symbolInstances.length; r++){ 44151 const c = t1.symbolInstances.get(r), { numHorizontalGlyphVertices: h, numVerticalGlyphVertices: p, crossTileID: f, numIconVertices: S, tileAnchorX: C, tileAnchorY: E } = c; 44152 let I = null; 44153 const D = this.retainedQueryData[t1.bucketInstanceId]; 44154 b && c && D && (I = s.latestFeatureIndex.loadFeature({ 44155 featureIndex: c.featureIndex, 44156 bucketIndex: D.bucketIndex, 44157 sourceLayerIndex: D.sourceLayerIndex, 44158 layoutVertexArrayOffset: 0 44159 })); 44160 const P = y.evaluate(I, {}), L = i.has(f); 44161 let R = this.opacities[f]; 44162 L ? R = u : R || (R = x, this.opacities[f] = R), i.add(f); 44163 const A = h > 0 || p > 0, M = S > 0, O = this.placedOrientations[f], F = O === e1.da.vertical, k = O === e1.da.horizontal || O === e1.da.horizontalOnly; 44164 !A && !M || R.isHidden() || T++; 44165 let B = !1; 44166 if ((A || M) && n) for (const i of t1.activeReplacements){ 44167 if (e1.d6(i, o, e1.d7.Symbol, l)) continue; 44168 if (i.min.x > C || C > i.max.x || i.min.y > E || E > i.max.y) continue; 44169 const t1 = e1.d8(C, E, a.canonical, i.footprintTileId.canonical); 44170 if (B = e1.d9(t1, i.footprint), B) break; 44171 } 44172 if (B && this.collisionIndex.markSymbolAsClipped(t1.bucketInstanceId, c.featureIndex), A) { 44173 const e1 = B ? _n : mn(R.text); 44174 w(t1.text, h, F ? _n : e1), w(t1.text, p, k ? _n : e1); 44175 const i = R.text.isHidden(), { leftJustifiedTextSymbolIndex: s, centerJustifiedTextSymbolIndex: r, rightJustifiedTextSymbolIndex: o, verticalPlacedTextSymbolIndex: n } = c, a = t1.text.placedSymbolArray, l = i || F ? 1 : 0; 44176 s >= 0 && (a.get(s).hidden = l), r >= 0 && (a.get(r).hidden = l), o >= 0 && (a.get(o).hidden = l), n >= 0 && (a.get(n).hidden = i || k ? 1 : 0); 44177 const d = this.variableOffsets[f]; 44178 d && rn(t1, d.anchor, c, O); 44179 const u = this.placedOrientations[f]; 44180 u && (rn(t1, "left", c, u), on(t1, u, c)); 44181 } 44182 if (M) { 44183 const e1 = B ? _n : mn(R.icon), { placedIconSymbolIndex: i, verticalPlacedIconSymbolIndex: s } = c, r = t1.icon.placedSymbolArray, o = R.icon.isHidden() ? 1 : 0; 44184 i >= 0 && (w(t1.icon, S, F ? _n : e1), r.get(i).hidden = o), s >= 0 && (w(t1.icon, c.numVerticalIconVertices, k ? _n : e1), r.get(s).hidden = o); 44185 } 44186 if (t1.hasIconCollisionBoxData() || t1.hasTextCollisionBoxData()) { 44187 const i = t1.collisionArrays[r]; 44188 if (i) { 44189 let s = new e1.P(0, 0), r = !0; 44190 if (i.textBox || i.verticalTextBox) { 44191 if (m) { 44192 const e1 = this.variableOffsets[f]; 44193 e1 ? (s = tn(e1.anchor, e1.width, e1.height, e1.textOffset, e1.textScale), _ && s._rotate(g ? this.transform.angle : -this.transform.angle)) : r = !1; 44194 } 44195 d && (r = !R.clipped), i.textBox && an(t1.textCollisionBox.collisionVertexArray, R.text.placed, !r || F, P, v, s.x, s.y), i.verticalTextBox && an(t1.textCollisionBox.collisionVertexArray, R.text.placed, !r || k, P, v, s.x, s.y); 44196 } 44197 const o = r && Boolean(!k && i.verticalIconBox); 44198 i.iconBox && an(t1.iconCollisionBox.collisionVertexArray, R.icon.placed, o, P, v, c.hasIconTextFit ? s.x : 0, c.hasIconTextFit ? s.y : 0), i.verticalIconBox && an(t1.iconCollisionBox.collisionVertexArray, R.icon.placed, !o, P, v, c.hasIconTextFit ? s.x : 0, c.hasIconTextFit ? s.y : 0); 44199 } 44200 } 44201 } 44202 if (t1.fullyClipped = 0 === T, t1.sortFeatures(this.transform.angle), this.retainedQueryData[t1.bucketInstanceId] && (this.retainedQueryData[t1.bucketInstanceId].featureSortOrder = t1.featureSortOrder), t1.hasTextData() && t1.text.opacityVertexBuffer && t1.text.opacityVertexBuffer.updateData(t1.text.opacityVertexArray), t1.hasIconData() && t1.icon.opacityVertexBuffer && t1.icon.opacityVertexBuffer.updateData(t1.icon.opacityVertexArray), t1.hasIconCollisionBoxData() && t1.iconCollisionBox.collisionVertexBuffer && t1.iconCollisionBox.collisionVertexBuffer.updateData(t1.iconCollisionBox.collisionVertexArray), t1.hasTextCollisionBoxData() && t1.textCollisionBox.collisionVertexBuffer && t1.textCollisionBox.collisionVertexBuffer.updateData(t1.textCollisionBox.collisionVertexArray), t1.bucketInstanceId in this.collisionCircleArrays) { 44203 const e1 = this.collisionCircleArrays[t1.bucketInstanceId]; 44204 t1.placementInvProjMatrix = e1.invProjMatrix, t1.placementViewportMatrix = e1.viewportMatrix, t1.collisionCircleArray = e1.circles, delete this.collisionCircleArrays[t1.bucketInstanceId]; 44205 } 44206 } 44207 symbolFadeChange(e1) { 44208 return 0 === this.fadeDuration ? 1 : (e1 - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment; 44209 } 44210 zoomAdjustment(e1) { 44211 return Math.max(0, (this.transform.zoom - e1) / 1.5); 44212 } 44213 hasTransitions(e1) { 44214 return e1 - this.lastPlacementChangeTime < this.fadeDuration; 44215 } 44216 stillRecent(e1, t1) { 44217 const i = this.zoomAtLastRecencyCheck === t1 ? 1 - this.zoomAdjustment(t1) : 1; 44218 return this.zoomAtLastRecencyCheck = t1, this.commitTime + this.fadeDuration * i > e1; 44219 } 44220 isStale() { 44221 return this.stale; 44222 } 44223 setStale() { 44224 this.stale = !0; 44225 } 44226 constructor(e1, t1, i, s, r, o, n, a){ 44227 this.transform = e1.clone(), this.projection = e1.projection.name, this.algorithm = s, this.collisionIndex = this.algorithm.createCollisionDetector(this.transform, o, a), this.buildingIndex = n, this.frontCutoffStart = 0, this.placements = {}, this.opacities = {}, this.variableOffsets = {}, this.stale = !1, this.commitTime = 0, this.fadeDuration = t1, this.retainedQueryData = {}, this.collisionGroups = new en(i), this.collisionCircleArrays = {}, this.prevPlacement = r, r && (r.prevPlacement = void 0), this.placedOrientations = {}, this.lastReplacementSourceUpdateTime = 0; 44228 } 44229 } 44230 function an(e1, t1, i, s, r, o, n) { 44231 e1.emplaceBack(t1 ? 1 : 0, i ? 1 : 0, o || 0, n || 0, s, r ? 1 : 0), e1.emplaceBack(t1 ? 1 : 0, i ? 1 : 0, o || 0, n || 0, s, r ? 1 : 0), e1.emplaceBack(t1 ? 1 : 0, i ? 1 : 0, o || 0, n || 0, s, r ? 1 : 0), e1.emplaceBack(t1 ? 1 : 0, i ? 1 : 0, o || 0, n || 0, s, r ? 1 : 0); 44232 } 44233 const ln = Math.pow(2, 25), cn = Math.pow(2, 24), hn = Math.pow(2, 17), dn = Math.pow(2, 16), un = Math.pow(2, 9), pn = Math.pow(2, 8), fn = Math.pow(2, 1); 44234 function mn(e1) { 44235 if (0 === e1.opacity && !e1.placed) return 0; 44236 if (1 === e1.opacity && e1.placed) return 4294967295; 44237 const t1 = e1.placed ? 1 : 0, i = Math.floor(127 * e1.opacity); 44238 return i * ln + t1 * cn + i * hn + t1 * dn + i * un + t1 * pn + i * fn + t1; 44239 } 44240 const _n = 0; 44241 class gn { 44242 reset(e1, t1) { 44243 this.points = e1 || [], this._distances = [ 44244 0 44245 ]; 44246 for(let e1 = 1; e1 < this.points.length; e1++)this._distances[e1] = this._distances[e1 - 1] + this.points[e1].dist(this.points[e1 - 1]); 44247 this.length = this._distances.at(-1), this.padding = Math.min(t1 || 0, .5 * this.length), this.paddedLength = this.length - 2 * this.padding; 44248 } 44249 lerp(t1) { 44250 if (1 === this.points.length) return this.points[0]; 44251 t1 = e1.b0(t1, 0, 1); 44252 let i = 1, s = this._distances[i]; 44253 const r = t1 * this.paddedLength + this.padding; 44254 for(; s < r && i < this._distances.length;)s = this._distances[++i]; 44255 const o = i - 1, n = this._distances[o], a = s - n, l = a > 0 ? (r - n) / a : 0; 44256 return this.points[o].mult(1 - l).add(this.points[i].mult(l)); 44257 } 44258 constructor(e1, t1){ 44259 this.reset(e1, t1); 44260 } 44261 } 44262 const yn = 100; 44263 class vn { 44264 reset(t1, i) { 44265 const s = t1.width + 200, r = t1.height + 200; 44266 s !== this.gridRightBoundary || r !== this.gridBottomBoundary ? (this.grid = new e1.de(s, r, 25), this.ignoredGrid = new e1.de(s, r, 25)) : (this.grid.clear(), this.ignoredGrid.clear()), this.transform = t1, this.fogState = i, this.pitchfactor = Math.cos(t1._pitch) * t1.cameraToCenterDistance, this.screenRightBoundary = t1.width + yn, this.screenBottomBoundary = t1.height + yn, this.gridRightBoundary = s, this.gridBottomBoundary = r, this.clippedSymbols.clear(); 44267 } 44268 clearClippedSymbolsForBucket(e1) { 44269 this.clippedSymbols.delete(e1); 44270 } 44271 markSymbolAsClipped(e1, t1) { 44272 let i = this.clippedSymbols.get(e1); 44273 i || (i = new Set, this.clippedSymbols.set(e1, i)), i.add(t1); 44274 } 44275 placeCollisionBox(t1, i, s, r, o, n, a, l, c, h, d) { 44276 let u = s.projectedAnchorX, p = s.projectedAnchorY, f = s.projectedAnchorZ; 44277 const m = s.tileAnchorX, _ = s.tileAnchorY, g = s.elevation, y = s.tileID, v = t1.getProjection(); 44278 if (g && y) { 44279 const [e1, t1, i] = v.upVector(y.canonical, s.tileAnchorX, s.tileAnchorY), r = v.upVectorScale(y.canonical, this.transform.center.lat, this.transform.worldSize).metersToTile; 44280 u += e1 * g * r, p += t1 * g * r, f += i * g * r; 44281 } 44282 const b = "globe" === t1.projection.name, x = "globe" === t1.projection.name ? e1.S(this.transform.zoom) : 0; 44283 if (y && b && x < 1 && !n) { 44284 const t1 = 1 << y.canonical.z, i = e1.df(m, _); 44285 e1.dg(i, i, 1 / e1.a6), e1.dh(i, i, e1.df(y.canonical.x, y.canonical.y)), e1.dg(i, i, 1 / t1), e1.di(i, i, e1.df(r[0], r[1])), i[0] = e1.dj(i[0], -.5, .5), e1.dg(i, i, e1.a6); 44286 const s = e1.dk(i[0], i[1], e1.a6 / (2 * Math.PI), 1); 44287 e1.c7(s, s, o), u = e1.al(u, s[0], x), p = e1.al(p, s[1], x), f = e1.al(f, s[2], x); 44288 } 44289 const w = this.projectAndGetPerspectiveRatio(h, u, p, f, s.tileID, "globe" === v.name || !!g || this.transform.pitch > 0, v), T = c * w.perspectiveRatio, S = (s.x1 * i + a.x - s.padding) * T + w.point.x, C = (s.y1 * i + a.y - s.padding) * T + w.point.y, E = (s.x2 * i + a.x + s.padding) * T + w.point.x, I = (s.y2 * i + a.y + s.padding) * T + w.point.y, D = w.perspectiveRatio <= .55 || w.occluded; 44290 return !this.isInsideGrid(S, C, E, I) || !l && this.grid.hitTest(S, C, E, I, d) || D ? { 44291 box: [], 44292 offscreen: !1, 44293 occluded: w.occluded 44294 } : { 44295 box: [ 44296 S, 44297 C, 44298 E, 44299 I 44300 ], 44301 offscreen: this.isOffscreen(S, C, E, I), 44302 occluded: !1 44303 }; 44304 } 44305 placeCollisionCircles(t1, i, s, r, o, n, a, l, c, h, d, u, p, f, m, _) { 44306 const g = [], y = this.transform.elevation, v = t1.getProjection(), b = "road" === t1.elevationType, x = !!y || b, w = e1.c3.getAtTileOffsetFunc(_, this.transform.center.lat, this.transform.worldSize, v), T = new e1.P(s.tileAnchorX, s.tileAnchorY), S = new e1.P(s.tileAnchorX, s.tileAnchorY); 44307 let { x: C, y: E, z: I } = v.projectTilePoint(S.x, S.y, _.canonical), D = null; 44308 if (x) { 44309 D = b && t1.hdExt ? t1.hdExt.makeRoadSymbolElevationParams(t1, t1.text, r, _, w, y, v, this.transform.center.lat, this.transform.worldSize) : { 44310 getElevation: w, 44311 elevation: y, 44312 elevationFeature: null 44313 }; 44314 const [e1, i, s] = D.getElevation(T, y, D.elevationFeature); 44315 C += e1, E += i, I += s; 44316 } 44317 const P = "globe" === v.name, L = this.projectAndGetPerspectiveRatio(l, C, E, I, _, P || !!y || this.transform.pitch > 0, v), { perspectiveRatio: R } = L, A = (u ? a / R : a * R) / e1.ds, M = e1.dl(C, E, I, c), O = s.lineOffsetX * A, F = s.lineOffsetY * A, k = e1.au(t1.layers[0].layout.get("text-max-angle")), B = Math.cos(k), z = L.signedDistanceFromCamera > 0 ? e1.dm(A, n, O, F, b && 1 === s.flipState, M, S, s, o, c, {}, x && !u ? D : null, u && x, v, _, u, B) : null; 44318 let U = !1, N = !1, j = !0; 44319 if (z && !L.occluded) { 44320 const t1 = .5 * f * R + m, s = new e1.P(-100, -100), r = new e1.P(this.screenRightBoundary, this.screenBottomBoundary), o = new gn, { first: n, last: a } = z, l = n.path.length; 44321 let c = []; 44322 for(let e1 = l - 1; e1 >= 1; e1--)c.push(n.path[e1]); 44323 for(let e1 = 1; e1 < a.path.length; e1++)c.push(a.path[e1]); 44324 const u = 2.5 * t1; 44325 h && (c = c.map((param, r)=>{ 44326 let [t1, i, s] = param; 44327 return x && !P && (s = D.getElevation(r < l - 1 ? n.tilePath[l - 1 - r] : a.tilePath[r - l + 2], y, D.elevationFeature)[2]), e1.dl(t1, i, s, h); 44328 }), c.some((e1)=>e1[3] <= 0) && (c = [])); 44329 let _ = []; 44330 if (c.length > 0) { 44331 let t1 = 1 / 0, i = -1 / 0, o = 1 / 0, n = -1 / 0; 44332 for (const e1 of c)t1 = Math.min(t1, e1[0]), o = Math.min(o, e1[1]), i = Math.max(i, e1[0]), n = Math.max(n, e1[1]); 44333 i >= s.x && t1 <= r.x && n >= s.y && o <= r.y && (_ = [ 44334 c.map((t1)=>new e1.P(t1[0], t1[1])) 44335 ], (t1 < s.x || i > r.x || o < s.y || n > r.y) && (_ = e1.dn(_, s.x, s.y, r.x, r.y))); 44336 } 44337 for (const e1 of _){ 44338 o.reset(e1, .25 * t1); 44339 let s = 0; 44340 s = o.length <= .5 * t1 ? 1 : Math.ceil(o.paddedLength / u) + 1; 44341 for(let e1 = 0; e1 < s; e1++){ 44342 const r = e1 / Math.max(s - 1, 1), n = o.lerp(r), a = n.x + yn, l = n.y + yn; 44343 g.push(a, l, t1, 0); 44344 const c = a - t1, h = l - t1, u = a + t1, f = l + t1; 44345 if (j = j && this.isOffscreen(c, h, u, f), N = N || this.isInsideGrid(c, h, u, f), !i && this.grid.hitTestCircle(a, l, t1, p) && (U = !0, !d)) return { 44346 circles: [], 44347 offscreen: !1, 44348 collisionDetected: U, 44349 occluded: !1 44350 }; 44351 } 44352 } 44353 } 44354 return { 44355 circles: !d && U || !N ? [] : g, 44356 offscreen: j, 44357 collisionDetected: U, 44358 occluded: L.occluded 44359 }; 44360 } 44361 queryRenderedSymbols(t1) { 44362 if (0 === t1.length || 0 === this.grid.keysLength() && 0 === this.ignoredGrid.keysLength()) return {}; 44363 const i = []; 44364 let s = 1 / 0, r = 1 / 0, o = -1 / 0, n = -1 / 0; 44365 for (const a of t1){ 44366 const t1 = new e1.P(a.x + yn, a.y + yn); 44367 s = Math.min(s, t1.x), r = Math.min(r, t1.y), o = Math.max(o, t1.x), n = Math.max(n, t1.y), i.push(t1); 44368 } 44369 const a = this.grid.query(s, r, o, n).concat(this.ignoredGrid.query(s, r, o, n)), l = {}, c = {}; 44370 for (const t1 of a){ 44371 const s = t1.key; 44372 if (void 0 === l[s.bucketInstanceId] && (l[s.bucketInstanceId] = {}), l[s.bucketInstanceId][s.featureIndex]) continue; 44373 const r = this.clippedSymbols.get(s.bucketInstanceId); 44374 if (r && r.has(s.featureIndex)) continue; 44375 const o = [ 44376 new e1.P(t1.x1, t1.y1), 44377 new e1.P(t1.x2, t1.y1), 44378 new e1.P(t1.x2, t1.y2), 44379 new e1.P(t1.x1, t1.y2) 44380 ]; 44381 e1.aT(i, o) && (l[s.bucketInstanceId][s.featureIndex] = !0, void 0 === c[s.bucketInstanceId] && (c[s.bucketInstanceId] = []), c[s.bucketInstanceId].push(s.featureIndex)); 44382 } 44383 return c; 44384 } 44385 insertCollisionBox(e1, t1, i, s, r) { 44386 (t1 ? this.ignoredGrid : this.grid).insert({ 44387 bucketInstanceId: i, 44388 featureIndex: s, 44389 collisionGroupID: r 44390 }, e1[0], e1[1], e1[2], e1[3]); 44391 } 44392 insertCollisionCircles(e1, t1, i, s, r) { 44393 const o = t1 ? this.ignoredGrid : this.grid, n = { 44394 bucketInstanceId: i, 44395 featureIndex: s, 44396 collisionGroupID: r 44397 }; 44398 for(let t1 = 0; t1 < e1.length;
44398 t1 += 4)o.insertCircle(n, e1[t1], e1[t1 + 1], e1[t1 + 2]); 44399 } 44400 projectAndGetPerspectiveRatio(t1, i, s, r, o, n, a) { 44401 const l = [ 44402 i, 44403 s, 44404 r, 44405 1 44406 ]; 44407 let c = !1; 44408 r || this.transform.pitch > 0 ? (e1.c7(l, l, t1), this.fogState && o && "globe" !== a.name && (c = e1.dp(this.fogState, i, s, r, o.toUnwrapped(), this.transform) > e1.dt)) : e1.dq(l, l, t1); 44409 const h = l[3]; 44410 return { 44411 point: new e1.P((l[0] / h + 1) / 2 * this.transform.width + yn, (-l[1] / h + 1) / 2 * this.transform.height + yn), 44412 perspectiveRatio: Math.min(.5 + this.transform.getCameraToCenterDistance(a) / h * .5, 1.5), 44413 signedDistanceFromCamera: h, 44414 occluded: n && l[2] > h || c 44415 }; 44416 } 44417 isOffscreen(e1, t1, i, s) { 44418 return i < yn || e1 >= this.screenRightBoundary || s < yn || t1 > this.screenBottomBoundary; 44419 } 44420 isInsideGrid(e1, t1, i, s) { 44421 return i >= 0 && e1 < this.gridRightBoundary && s >= 0 && t1 < this.gridBottomBoundary; 44422 } 44423 getViewportMatrix() { 44424 const t1 = e1.dr([]); 44425 return e1.bM(t1, t1, [ 44426 -100, 44427 -100, 44428 0 44429 ]), t1; 44430 } 44431 constructor(e1, t1){ 44432 this.gridRightBoundary = 0, this.gridBottomBoundary = 0, this.clippedSymbols = new Map, this.reset(e1, t1); 44433 } 44434 } 44435 const bn = { 44436 default: new class { 44437 createCollisionDetector(e1, t1, i) { 44438 return i instanceof vn ? (i.reset(e1, t1), i) : new vn(e1, t1); 44439 } 44440 shouldPause(e1) { 44441 return e1 > 2; 44442 } 44443 placeLayerBucketPart(t1, i, s, r) { 44444 let o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 1; 44445 const { bucket: n, layout: a, paint: l, posMatrix: c, textLabelPlaneMatrix: h, labelToScreenMatrix: d, clippingData: u, textPixelRatio: p, mercatorCenter: f, invMatrix: m, holdingForFade: _, collisionBoxArray: g, partiallyEvaluatedTextSize: y, partiallyEvaluatedIconSize: v, collisionGroup: b, latestFeatureIndex: x } = i.parameters, w = a.get("text-optional"), T = a.get("icon-optional"), S = a.get("text-allow-overlap"), C = a.get("icon-allow-overlap"), E = "map" === a.get("text-rotation-alignment"), I = "map" === a.get("icon-rotation-alignment"), D = "map" === a.get("text-pitch-alignment"), P = l.get("symbol-z-offset"), L = "sea" === a.get("symbol-elevation-reference"), R = a.get("symbol-placement"), A = a.get("text-variable-anchor"), M = E && "point" !== R, O = I && "point" !== R, F = A && n.hasTextData(), k = n.hasIconTextFit() && F && n.hasIconData(); 44446 t1.transform.setProjection(n.projection); 44447 const B = F || M, z = O || k; 44448 let U = S && (C || !n.hasIconData() || T), N = C && (S || !n.hasTextData() || w); 44449 const j = !P.isConstant(); 44450 !n.collisionArrays && g && n.deserializeCollisionBoxes(g); 44451 const V = (i, o, l)=>{ 44452 const { crossTileID: g, numVerticalGlyphVertices: I } = i; 44453 let R = null; 44454 if (u && u.dynamicFilterNeedsFeature || j) { 44455 const s = t1.retainedQueryData[n.bucketInstanceId], r = x.loadFeature({ 44456 featureIndex: i.featureIndex, 44457 bucketIndex: s.bucketIndex, 44458 sourceLayerIndex: s.sourceLayerIndex, 44459 layoutVertexArrayOffset: 0 44460 }), o = r.properties ? r.properties.worldview : null; 44461 if (n.localizable && n.worldview && "string" == typeof o) if ("all" === o) r.properties.$localized = !0; 44462 else { 44463 if (!o.split(",").includes(n.worldview)) return; 44464 r.properties.$localized = !0, r.properties.worldview = n.worldview; 44465 } 44466 R = u && u.needGeometry ? e1.bw(r, !0) : r; 44467 } 44468 if (u && !(0, u.dynamicFilter)({ 44469 zoom: t1.transform.zoom, 44470 pitch: t1.transform.pitch, 44471 worldview: n.worldview 44472 }, R, t1.retainedQueryData[n.bucketInstanceId].tileID.canonical, new e1.P(i.tileAnchorX, i.tileAnchorY), t1.transform.calculateDistanceTileData(u.unwrappedTileID))) return t1.placements[g] = new Yo(!1, !1, !1, !0), void s.add(g); 44473 const M = P.evaluate(R, {}); 44474 if ((i.zOffset || 0) + (M || 0) >
44474 0 && t1.frontCutoffStart > 0) { 44475 const r = 2 * t1.frontCutoffStart - 1, o = [ 44476 i.tileAnchorX, 44477 i.tileAnchorY, 44478 0, 44479 1 44480 ], n = e1.c7(e1.du(), o, c); 44481 if (n[1] / n[3] < r) return t1.placements[g] = new Yo(!1, !1, !1, !0), void s.add(g); 44482 } 44483 if (s.has(g)) return; 44484 if (_) return void (t1.placements[g] = new Yo(!1, !1, !1)); 44485 let O = !1, F = !1, k = !0, V = !1, G = !1, q = null, Z = { 44486 box: null, 44487 offscreen: null, 44488 occluded: null 44489 }, $ = { 44490 box: null 44491 }, H = null, W = null, X = null, K = 0, Y = 0, Q = 0; 44492 l.textFeatureIndex ? K = l.textFeatureIndex : i.useRuntimeCollisionCircles && (K = i.featureIndex), l.verticalTextFeatureIndex && (Y = l.verticalTextFeatureIndex); 44493 const J = (s)=>{ 44494 s.tileID = t1.retainedQueryData[n.bucketInstanceId].tileID; 44495 const r = t1.transform.elevation; 44496 if ("road" === n.elevationType) s.elevation = L ? M : M + e1.c3.getAtTileOffset(s.tileID, new e1.P(s.tileAnchorX, s.tileAnchorY), r, null); 44497 else { 44498 const t1 = n.hdExt ? n.hdExt.elevationFeatures[i.elevationFeatureIndex] : void 0; 44499 s.elevation = L ? M : M + e1.c3.getAtTileOffset(s.tileID, new e1.P(s.tileAnchorX, s.tileAnchorY), r, t1); 44500 } 44501 s.elevation += i.zOffset; 44502 }, ee = l.textBox; 44503 if (ee) { 44504 J(ee); 44505 const s = (s)=>{ 44506 let r = e1.da.horizontal; 44507 if (n.allowVerticalPlacement && !s && t1.prevPlacement) { 44508 const e1 = t1.prevPlacement.placedOrientations[g]; 44509 e1 && (t1.placedOrientations[g] = e1, r = e1, on(n, r, i)); 44510 } 44511 return r; 44512 }, r = (t1, i)=>{ 44513 if (n.allowVerticalPlacement && I > 0 && l.verticalTextBox) { 44514 for (const s of n.writingModes)if (s === e1.da.vertical ? (Z = i(), $ = Z) : Z = t1(), Z && Z.box && Z.box.length) break; 44515 } else Z = t1(); 44516 }; 44517 if (A) { 44518 let a = A; 44519 if (t1.prevPlacement && t1.prevPlacement.variableOffsets[g]) { 44520 const e1 = t1.prevPlacement.variableOffsets[g]; 44521 a.indexOf(e1.anchor) > 0 && (a = a.filter((t1)=>t1 !== e1.anchor), a.unshift(e1.anchor)); 44522 } 44523 const h = (e1, s, r)=>{ 44524 const l = n.getSymbolInstanceTextSize(y, i, t1.transform.zoom, o), h = (e1.x2 - e1.x1) * l + 2 * e1.padding, d = (e1.y2 - e1.y1) * l + 2 * e1.padding, u = i.hasIconTextFit && !C ? s : null; 44525 u && J(u); 44526 let _ = { 44527 box: [], 44528 offscreen: !1, 44529 occluded: !1 44530 }; 44531 const g = S ? 2 * a.length : a.length; 44532 for(let s = 0; s < g; ++s){ 44533 const g = this.attemptAnchorPlacement(t1, a[s % a.length], e1, f, m, B, h, d, l, E, D, p, c, b, s >= a.length, i, o, n, r, u, y, v); 44534 if (g && (_ = g.placedGlyphBoxes, _ && _.box && _.box.length)) { 44535 O = !0, q = g.shift; 44536 break; 44537 } 44538 } 44539 return _; 44540 }; 44541 r(()=>h(ee, l.iconBox, e1.da.horizontal), ()=>{ 44542 const t1 = l.verticalTextBox; 44543 return t1 && J(t1), n.allowVerticalPlacement && !(Z && Z.box && Z.box.length) && I > 0 && t1 ? h(t1, l.verticalIconBox, e1.da.vertical) : { 44544 box: null, 44545 offscreen: null, 44546 occluded: null 44547 }; 44548 }), Z && (O = Z.box, k = Z.offscreen, V = Z.occluded); 44549 const d = s(!(!Z || !Z.box)); 44550 if (!O && t1.prevPlacement) { 44551 const e1 = t1.prevPlacement.variableOffsets[g]; 44552 e1 && (t1.variableOffsets[g] = e1, rn(n, e1.anchor, i, d)); 44553 } 44554 } else { 44555 const a = (s, r)=>{ 44556 const a = n.getSymbolInstanceTextSize(y, i, t1.transform.zoom, o), l = t1.collisionIndex.placeCollisionBox(n, a, s, f, m, B, new e1.P(0, 0), S, p, c, b.predicate); 44557 return l && l.box && l.box.length && (on(n, r, i), t1.placedOrientations[g] = r), l; 44558 }; 44559 r(()=>a(ee, e1.da.horizontal), ()=>{ 44560 const t1 = l.verticalTextBox; 44561 return n.allowVerticalPlacement && I > 0 && t1 ? (J(t1), a(t1, e1.da.vertical)) : { 44562 box: null, 44563 offscreen: null, 44564 occluded: null 44565 }; 44566 }), s(!!(Z && Z.box && Z.box.length)); 44567 } 44568 } 44569 if (H = Z, O = H && H.box && H.box.length > 0, k = H && H.offscreen, V = H && H.occluded, i.useRuntimeCollisionCircles) { 44570 const s = i.centerJustifiedTextSymbolIndex >= 0 ? i.centerJustifiedTextSymbolIndex : i.verticalPlacedTextSymbolIndex, o = n.text.placedSymbolArray.get(s), l = e1.dv(n.textSizeData, y, o), u = a.get("text-padding"); 44571 W = t1.collisionIndex.placeCollisionCircles(n, S, o, s, n.lineVertexArray, n.glyphOffsetArray, l, c, h, d, r, D, b.predicate, i.c
44571ollisionCircleDiameter * l / e1.ds, u, t1.retainedQueryData[n.bucketInstanceId].tileID), O = S || W.circles.length > 0 && !W.collisionDetected, k = k && W.offscreen, V = W.occluded; 44572 } 44573 if (l.iconFeatureIndex && (Q = l.iconFeatureIndex), l.iconBox) { 44574 const s = (s)=>{ 44575 J(s); 44576 const r = i.hasIconTextFit && q ? sn(q.x, q.y, E, D, t1.transform.angle) : new e1.P(0, 0), o = n.getSymbolInstanceIconSize(v, t1.transform.zoom, i.placedIconSymbolIndex); 44577 return t1.collisionIndex.placeCollisionBox(n, o, s, f, m, z, r, C, p, c, b.predicate); 44578 }; 44579 $ && $.box && $.box.length && l.verticalIconBox ? (X = s(l.verticalIconBox), F = X.box.length > 0) : (X = s(l.iconBox), F = X.box.length > 0), k = k && X.offscreen, G = X.occluded; 44580 } 44581 const te = w || 0 === i.numHorizontalGlyphVertices && 0 === I, ie = T || 0 === i.numIconVertices; 44582 if (te || ie ? ie ? te || (F = F && O) : O = F && O : F = O = F && O, O && H && H.box && t1.collisionIndex.insertCollisionBox(H.box, a.get("text-ignore-placement"), n.bucketInstanceId, $ && $.box && Y ? Y : K, b.ID), F && X && t1.collisionIndex.insertCollisionBox(X.box, a.get("icon-ignore-placement"), n.bucketInstanceId, Q, b.ID), W && (O && t1.collisionIndex.insertCollisionCircles(W.circles, a.get("text-ignore-placement"), n.bucketInstanceId, K, b.ID), r)) { 44583 const e1 = n.bucketInstanceId; 44584 let i = t1.collisionCircleArrays[e1]; 44585 void 0 === i && (i = t1.collisionCircleArrays[e1] = new Qo); 44586 for(let e1 = 0; e1 < W.circles.length; e1 += 4)i.circles.push(W.circles[e1 + 0]), i.circles.push(W.circles[e1 + 1]), i.circles.push(W.circles[e1 + 2]), i.circles.push(W.collisionDetected ? 1 : 0); 44587 } 44588 const se = "globe" !== n.projection.name; 44589 U = U && (se || !V), N = N && (se || !G), t1.placements[g] = new Yo(O || U, F || N, k || n.justReloaded), s.add(g); 44590 }, G = t1.retainedQueryData[n.bucketInstanceId].tileID; 44591 if ("offset" === n.elevationType && t1.buildingIndex && t1.buildingIndex.updateZOffset(n, G), "road" === n.elevationType && n.hdExt && n.hdExt.updateRoadElevation(n, G.canonical), n.updateZOffset(), n.sortFeaturesByY) { 44592 const i = n.getSortedSymbolIndexes(t1.transform.angle); 44593 for(let e1 = i.length - 1; e1 >= 0; --e1){ 44594 const t1 = i[e1]; 44595 V(n.symbolInstances.get(t1), t1, n.collisionArrays[t1]); 44596 } 44597 n.hasAnyZOffset && e1.w("".concat(n.layerIds[0], " layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y")); 44598 } else if (n.hasAnyZOffset) { 44599 const e1 = n.getSortedIndexesByZOffset(); 44600 for(let t1 = 0; t1 < e1.length; ++t1){ 44601 const i = e1[t1]; 44602 V(n.symbolInstances.get(i), i, n.collisionArrays[i]); 44603 } 44604 } else for(let e1 = i.symbolInstanceStart; e1 < i.symbolInstanceEnd; e1++)V(n.symbolInstances.get(e1), e1, n.collisionArrays[e1]); 44605 if (r && n.bucketInstanceId in t1.collisionCircleArrays) { 44606 const i = t1.collisionCircleArrays[n.bucketInstanceId]; 44607 e1.aO(i.invProjMatrix, c), i.viewportMatrix = t1.collisionIndex.getViewportMatrix(); 44608 } 44609 n.justReloaded = !1; 44610 } 44611 attemptAnchorPlacement(e1, t1, i, s, r, o, n, a, l, c, h, d, u, p, f, m, _, g, y, v, b, x) { 44612 const { textOffset0: w, textOffset1: T, crossTileID: S } = m, C = [ 44613 w, 44614 T
44615 ], E = tn(t1, n, a, C, l), I = e1.collisionIndex.placeCollisionBox(g, l, i, s, r, o, sn(E.x, E.y, c, h, e1.transform.angle), f, d, u, p.predicate); 44616 if (v) { 44617 const t1 = g.getSymbolInstanceIconSize(x, e1.transform.zoom, m.placedIconSymbolIndex); 44618 if (0 === e1.collisionIndex.placeCollisionBox(g, t1, v, s, r, o, sn(E.x, E.y, c, h, e1.transform.angle), f, d, u, p.predicate).box.length) return; 44619 } 44620 if (I.box.length > 0) { 44621 let i; 44622 return e1.prevPlacement && e1.prevPlacement.variableOffsets[S] && e1.prevPlacement.placements[S] && e1.prevPlacement.placements[S].text && (i = e1.prevPlacement.variableOffsets[S].anchor), e1.variableOffsets[S] = { 44623 textOffset: C, 44624 width: n, 44625 height: a, 44626 anchor: t1, 44627 textScale: l, 44628 prevAnchor: i 44629 }, rn(g, t1, m, y), g.allowVerticalPlacement && (on(g, y, m), e1.placedOrientations[S] = y), { 44630 shift: E, 44631 placedGlyphBoxes: I 44632 }; 44633 } 44634 } 44635 } 44636 }; 44637 class xn { 44638 continuePlacement(e1, t1, i, s, r, o) { 44639 const n = this._bucketParts; 44640 for(; this._currentTileIndex < e1.length;)if (t1.getBucketParts(n, s, e1[this._currentTileIndex], this._sortAcrossTiles, o), this._currentTileIndex++, r()) return !0; 44641 for(this._sortAcrossTiles && (this._sortAcrossTiles = !1, n.sort((e1, t1)=>e1.sortKey - t1.sortKey)); this._currentPartIndex < n.length;)if (t1.placeLayerBucketPart(n[this._currentPartIndex], this._seenCrossTileIDs, i, o), this._currentPartIndex++, r()) return !0; 44642 return !1; 44643 } 44644 constructor(e1){ 44645 this._sortAcrossTiles = "viewport-y" !== e1.layout.get("symbol-z-order") && void 0 !== e1.layout.get("symbol-sort-key").constantOr(1), this._currentTileIndex = 0, this._currentPartIndex = 0, this._seenCrossTileIDs = new Set, this._bucketParts = []; 44646 } 44647 } 44648 class wn { 44649 startNewPlacement(e1, t1, i, s, r, o, n, a, l) { 44650 return this.placement = new nn(e1, s, r, bn[l || "default"], o, n, a, this._retiredCI), this._retiredCI = null, this._currentPlacementIndex = t1.length - 1, this._forceFullPlacement = !1, this._showCollisionBoxes = i, this._fadeDuration = s, this._done = !1, this._inProgressLayer = null, this; 44651 } 44652 requestFullPlacement() { 44653 this._forceFullPlacement = !0; 44654 } 44655 isFullPlacementRequested() { 44656 return this._forceFullPlacement; 44657 } 44658 setStale() { 44659 this.placement && (this.placement.stale = !0); 44660 } 44661 isStale() { 44662 return !!this.placement && this.placement.stale; 44663 } 44664 isDone() { 44665 return this._done; 44666 } 44667 continuePlacement(t1, i, s, r, o) { 44668 const n = e1.e.now(), a = ()=>!this.isFullPlacementRequested() && 0 !== this._fadeDuration && this.placement.algorithm.shouldPause(e1.e.now() - n); 44669 for(; this._currentPlacementIndex >= 0;){ 44670 const n = i[t1[this._currentPlacementIndex]], l = this.placement.collisionIndex.transform.zoom; 44671 if ("symbol" === n.type && "none" !== n.visibility && (!n.minzoom || n.minzoom <= l) && (!n.maxzoom || n.maxzoom > l)) { 44672 const t1 = n, i = t1.layout.get("symbol-z-elevate"), l = void 0 !== t1.layout.get("symbol-sort-key").constantOr(1), c = t1.layout.get("symbol-z-order"), h = "viewport-y" === c || "auto" === c && !("viewport-y" !== c && l), d = t1.layout.get("text-allow-overlap") || t1.layout.get("icon-allow-overlap") || t1.layout.get("text-ignore-placement") || t1.layout.get("icon-ignore-placement"), u = h && d, p = this._inProgressLayer = this._inProgressLayer || new xn(t1
vendor: 22,476 bytes, lines 44672-45107
44672), f = e1.m(n.source, n.scope); 44673 if (p.continuePlacement(i || u ? r[f] : s[f], this.placement, this._showCollisionBoxes, n, a, o)) return; 44674 delete this._inProgressLayer; 44675 } 44676 this._currentPlacementIndex--; 44677 } 44678 this._forceFullPlacement = !1, this._done = !0; 44679 } 44680 commit(e1) { 44681 return this._retiredCI = this.placement.prevPlacement ? this.placement.prevPlacement.collisionIndex : null, this.placement.commit(e1), this.placement; 44682 } 44683 constructor(){ 44684 this._retiredCI = null; 44685 } 44686 } 44687 const Tn = 512 / e1.a6 / 2; 44688 class Sn { 44689 findMatches(t1, i, s) { 44690 const r = this.tileID.canonical.z < i.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - i.canonical.z), o = Tn / Math.pow(2, i.canonical.z - this.tileID.canonical.z), n = i.canonical.x * e1.a6, a = i.canonical.y * e1.a6; 44691 for(let e1 = 0; e1 < t1.length; e1++){ 44692 const i = t1.get(e1); 44693 if (i.crossTileID) continue; 44694 const { key: l, tileAnchorX: c, tileAnchorY: h } = i, d = Math.floor((n + c) * o), u = Math.floor((a + h) * o), p = this.index.range(d - r, u - r, d + r, u + r).sort((e1, t1)=>e1 - t1); 44695 for (const e1 of p){ 44696 const t1 = this.crossTileIDs[e1]; 44697 if (this.keys[e1] === l && !s.has(t1)) { 44698 s.add(t1), i.crossTileID = t1; 44699 break; 44700 } 44701 } 44702 } 44703 } 44704 constructor(t1, i, s){ 44705 this.tileID = t1, this.bucketInstanceId = s, this.index = new e1.dw(i.length, 16, Int32Array), this.keys = [], this.crossTileIDs = []; 44706 const r = t1.canonical.x * e1.a6, o = t1.canonical.y * e1.a6; 44707 for(let e1 = 0; e1 < i.length; e1++){ 44708 const { key: t1, crossTileID: s, tileAnchorX: n, tileAnchorY: a } = i.get(e1), l = Math.floor((r + n) * Tn), c = Math.floor((o + a) * Tn); 44709 this.index.add(l, c), this.keys.push(t1), this.crossTileIDs.push(s); 44710 } 44711 this.index.finish(); 44712 } 44713 } 44714 class Cn { 44715 generate() { 44716 return ++this.maxCrossTileID; 44717 } 44718 constructor(){ 44719 this.maxCrossTileID = 0; 44720 } 44721 } 44722 class En { 44723 handleWrapJump(e1) { 44724 const t1 = Math.round((e1 - this.lng) / 360); 44725 if (0 !== t1) for(const e1 in this.indexes){ 44726 const i = this.indexes[e1], s = {}; 44727 for(const e1 in i){ 44728 const r = i[e1]; 44729 r.tileID = r.tileID.unwrapTo(r.tileID.wrap + t1), s[r.tileID.key] = r; 44730 } 44731 this.indexes[e1] = s; 44732 } 44733 this.lng = e1; 44734 } 44735 addBucket(e1, t1, i) { 44736 if (this.indexes[e1.overscaledZ] && this.indexes[e1.overscaledZ][e1.key]) { 44737 if (this.indexes[e1.overscaledZ][e1.key].bucketInstanceId === t1.bucketInstanceId) return !1; 44738 this.removeBucketCrossTileIDs(e1.overscaledZ, this.indexes[e1.overscaledZ][e1.key]); 44739 } 44740 for(let e1 = 0; e1 < t1.symbolInstances.length; e1++)t1.symbolInstances.get(e1).crossTileID = 0; 44741 this.usedCrossTileIDs[e1.overscaledZ] || (this.usedCrossTileIDs[e1.overscaledZ] = new Set); 44742 const s = this.usedCrossTileIDs[e1.overscaledZ]; 44743 for(const i in this.indexes){ 44744 const r = this.indexes[i]; 44745 if (Number(i) > e1.overscaledZ) for(const i in r){ 44746 const o = r[i]; 44747 o.tileID.isChildOf(e1) && o.findMatches(t1.symbolInstances, e1, s); 44748 } 44749 else { 44750 const o = r[e1.scaledTo(Number(i)).key]; 44751 o && o.findMatches(t1.symbolInstances, e1, s); 44752 } 44753 } 44754 for(let e1 = 0; e1 < t1.symbolInstances.length; e1++){ 44755 const r = t1.symbolInstances.get(e1); 44756 r.crossTileID || (r.crossTileID = i.generate(), s.add(r.crossTileID)); 44757 } 44758 return void 0 === this.indexes[e1.overscaledZ] && (this.indexes[e1.overscaledZ] = {}), this.indexes[e1.overscaledZ][e1.key] = new Sn(e1, t1.symbolInstances, t1.bucketInstanceId), !0; 44759 } 44760 removeBucketCrossTileIDs(e1, t1) { 44761 for (const i of t1.crossTileIDs)this.usedCrossTileIDs[e1].delete(i); 44762 } 44763 removeStaleBuckets(e1) { 44764 let t1 = !1; 44765 for(const i in this.indexes){ 44766 const s = this.indexes[i]; 44767 for(const r in s)e1[s[r].bucketInstanceId] || (this.removeBucketCrossTileIDs(i, s[r]), delete s[r], t1 = !0); 44768 } 44769 return t1; 44770 } 44771 constructor(){ 44772 this.indexes = {}, this.usedCrossTileIDs = {}, this.lng = 0; 44773 } 44774 } 44775 class In { 44776 addLayer(e1, t1, i, s) { 44777 let r = this.layerIndexes[e1.fqid]; 44778 void 0 === r && (r = this.layerIndexes[e1.fqid] = new En); 44779 let o = !1; 44780 const n = {}; 44781 "globe" !== s.name && r.handleWrapJump(i); 44782 for (const i of t1){ 44783 const t1 = i.getBucket(e1); 44784 t1 && e1.fqid === t1.layerIds[0] && (t1.bucketInstanceId || (t1.bucketInstanceId = ++this.maxBucketInstanceId), r.addBucket(i.tileID, t1, this.crossTileIDs) && (o = !0), n[t1.bucketInstanceId] = !0); 44785 } 44786 return r.removeStaleBuckets(n) && (o = !0), o; 44787 } 44788 pruneUnusedLayers(e1) { 44789 const t1 = {}; 44790 e1.forEach((e1)=>{ 44791 t1[e1] = !0; 44792 }); 44793 for(const e1 in this.layerIndexes)t1[e1] || delete this.layerIndexes[e1]; 44794 } 44795 constructor(){ 44796 this.layerIndexes = {}, this.crossTileIDs = new Cn, this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {}; 44797 } 44798 } 44799 class Dn extends e1.E { 44800 async loadModel(t1, i) { 44801 try { 44802 const s = await this.requestManager.transformRequest(i, e1.R.Model); 44803 return this.modelByURL[i] ? (await hi(), ci.loadModel ? await ci.loadModel(s.url, t1, i) : null) : null; 44804 } catch (s) { 44805 if (404 === s.status) return null; 44806 this.fire(new e1.f(new Error("Could not load model ".concat(t1, " from ").concat(i), { 44807 cause: s 44808 }))); 44809 } 44810 } 44811 load(t1, i) { 44812 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : { 44813 forceReload: !1 44814 }; 44815 this.models[i] || (this.models[i] = Object.create(null)); 44816 const r = Object.keys(t1), o = [], n = []; 44817 for (const e1 of r){ 44818 const r = t1[e1]; 44819 this.hasURLBeenRequested(r) && !s.forceReload || (this.modelByURL[r] = { 44820 modelId: e1, 44821 scope: i 44822 }, o.push(this.loadModel(e1, r)), n.push(e1)), this.models[i][e1] || (this.models[i][e1] = { 44823 model: null, 44824 numReferences: 1 44825 }); 44826 } 44827 this.numModelsLoading[i] = (this.numModelsLoading[i] || 0) + n.length, Promise.allSettled(o).then((t1)=>{ 44828 for(let e1 = 0; e1 < t1.length; e1++){ 44829 const { status: s } = t1[e1]; 44830 if ("rejected" === s) continue; 44831 const { value: r } = t1[e1]; 44832 this.models[i][n[e1]] || (this.models[i][n[e1]] = { 44833 model: null, 44834 numReferences: 1 44835 }), this.models[i][n[e1]].model = r; 44836 } 44837 this.numModelsLoading[i] -= n.length, this.fire(new e1.h("data", { 44838 dataType: "style" 44839 })); 44840 }).catch((t1)=>{ 44841 this.fire(new e1.f(new Error("Could not load models: ".concat(t1.message)))); 44842 }); 44843 } 44844 isLoaded() { 44845 for(const e1 in this.numModelsLoading)if (this.numModelsLoading[e1] > 0) return !1; 44846 return !0; 44847 } 44848 hasModel(e1, t1) { 44849 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : { 44850 exactIdMatch: !1 44851 }; 44852 return !!(i.exactIdMatch ? this.getModel(e1, t1) : this.getModelByURL(this.modelUris[t1][e1])); 44853 } 44854 getModel(e1, t1) { 44855 return this.models[t1] || (this.models[t1] = Object.create(null)), this.models[t1][e1] ? this.models[t1][e1].model : void 0; 44856 } 44857 getModelByURL(e1) { 44858 if (!e1) return null; 44859 const t1 = this.modelByURL[e1]; 44860 return t1 ? this.models[t1.scope][t1.modelId].model : null; 44861 } 44862 hasModelBeenAdded(e1, t1) { 44863 return this.models[t1] && void 0 !== this.models[t1][e1]; 44864 } 44865 getModelURIs(e1) { 44866 return this.modelUris[e1] || Object.create(null); 44867 } 44868 addModel(e1, t1, i) { 44869 this.models[i] || (this.models[i] = Object.create(null)), this.modelUris[i] || (this.modelUris[i] = Object.create(null)); 44870 const s = this.requestManager.normalizeModelURL(t1); 44871 if ((this.hasModel(e1, i, { 44872 exactIdMatch: !0 44873 }) || this.hasModelBeenAdded(e1, i)) && this.modelUris[i][e1] === s) this.models[i][e1].numReferences++; 44874 else if (this.hasURLBeenRequested(s)) { 44875 const { scope: e1, modelId: t1 } = this.modelByURL[s]; 44876 this.models[e1][t1].numReferences++; 44877 } else this.modelUris[i][e1] = s, this.load({ 44878 [e1]: this.modelUris[i][e1] 44879 }, i); 44880 } 44881 addModelURLs(e1, t1) { 44882 this.models[t1] || (this.models[t1] = Object.create(null)), this.modelUris[t1] || (this.modelUris[t1] = Object.create(null)); 44883 const i = this.modelUris[t1]; 44884 for (const t1 of Object.keys(e1))i[t1] = this.requestManager.normalizeModelURL(e1[t1]); 44885 } 44886 reloadModels(e1) { 44887 this.load(this.modelUris[e1], e1, { 44888 forceReload: !0 44889 }); 44890 } 44891 addModelsFromBucket(e1, t1) { 44892 this.models[t1] || (this.models[t1] = Object.create(null)), this.modelUris[t1] || (this.modelUris[t1] = Object.create(null)); 44893 const i = Object.create(null); 44894 for (const s of e1)this.hasModel(s, t1, { 44895 exactIdMatch: !0 44896 }) || this.hasURLBeenRequested(s) ? this.models[t1][s].numReferences++ : this.modelUris[t1][s] && !this.hasURLBeenRequested(s) ? i[s] = this.modelUris[t1][s] : !this.hasURLBeenRequested(s) && Re(s, !1) && (this.modelUris[t1][s] = this.requestManager.normalizeModelURL(s), i[s] = this.modelUris[t1][s]); 44897 this.load(i, t1); 44898 } 44899 hasURLBeenRequested(e1) { 44900 return void 0 !== this.modelByURL[e1]; 44901 } 44902 removeModel(e1, t1) { 44903 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1; 44904 if (this.models[t1] && this.models[t1][e1] && (this.models[t1][e1].numReferences--, 0 === this.models[t1][e1].numReferences || s)) { 44905 const s = this.modelUris[t1][e1]; 44906 i || delete this.modelUris[t1][e1], delete this.modelByURL[s]; 44907 const r = this.models[t1][e1].model; 44908 if (!r) return; 44909 delete this.models[t1][e1], r.destroy(); 44910 } 44911 } 44912 destroy() { 44913 for (const e1 of Object.keys(this.models))for (const t1 of Object.keys(this.models[e1])){ 44914 const i = this.models[e1][t1].model; 44915 delete this.models[e1][t1], i && i.destroy(); 44916 } 44917 this.models = Object.create(null), this.models[""] = Object.create(null), this.modelUris = Object.create(null), this.modelUris[""] = Object.create(null), this.modelByURL = Object.create(null), this.numModelsLoading = Object.create(null); 44918 } 44919 listModels(e1) { 44920 return this.models[e1] || (this.models[e1] = Object.create(null)), Object.keys(this.models[e1]); 44921 } 44922 upload(e1, t1) { 44923 this.models[t1] || (this.models[t1] = Object.create(null)); 44924 for(const i in this.models[t1])this.models[t1][i].model && this.models[t1][i].model.upload(e1.context); 44925 } 44926 constructor(e1){ 44927 super(), this.requestManager = e1, this.models = Object.create(null), this.models[""] = Object.create(null), this.modelUris = Object.create(null), this.modelUris[""] = Object.create(null), this.modelByURL = Object.create(null), this.numModelsLoading = Object.create(null); 44928 } 44929 } 44930 const Pn = [ 44931 "RENDER_SHADOWS", 44932 "NORMAL_OFFSET" 44933 ], Ln = new Set([ 44934 "symbol", 44935 "circle" 44936 ]), Rn = class t1 { 44937 needsBuild() { 44938 return this._needsBuild; 44939 } 44940 buildQueue(e1, t1, i) { 44941 var _this = this; 44942 null != this._idleHandle && "undefined" != typeof cancelIdleCallback && cancelIdleCallback(this._idleHandle), this._idleHandle = null, this._queue = [], this._needsBuild = !1; 44943 const s = !!i.fog, r = i.hasTerrain(), o = !(!i.projection || "globe" !== i.projection.name), n = r || o, a = !(!i.directionalLight || !i.directionalLight.shadowsEnabled()), l = i.map && i.map.painter, c = !l || !l.context.extParallelShaderCompile, h = !!l && "mrt-fallback" === l.emissiveMode, d = function(e1) { 44944 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 44945 _this._queue.push({ 44946 programId: e1, 44947 params: { 44948 ...i.params, 44949 defines: t1, 44950 overrideFog: !!i.fog, 44951 overrideTerrain: !!i.terrain, 44952 overrideGlobe: !!i.globe, 44953 overrideRtt: !!i.rtt, 44954 precompiled: !0 44955 } 44956 }); 44957 }; 44958 for (const u of e1){ 44959 if ("none" === u.visibility) continue; 44960 const e1 = u.getProgramIds(); 44961 if (e1) for (const p of e1){ 44962 if (Ln.has(p)) continue; 44963 const e1 = u.getDefaultProgramParams(p, t1.zoom, i._styleColorTheme.lut); 44964 if (!e1) continue; 44965 const f = l ? l.getShaderSource(p) : null, m = n && (!f || f.usedDefines.has("RENDER_TO_TEXTURE")), _ = h && m ? (e1.defines || []).concat("USE_MRT1") : e1.defines; 44966 if (c) { 44967 d(p, e1.defines, { 44968 params: e1 44969 }), m && d(p, _, { 44970 params: e1, 44971 rtt: !0 44972 }); 44973 continue; 44974 } 44975 const g = s && (!f || f.usedDefines.has("FOG")), y = r && !u.isDraped() && (!f || f.usedDefines.has("TERRAIN")), v = o && (!f || f.usedDefines.has("GLOBE")), b = a && u.hasElevation() && (!f || f.usedDefines.has("RENDER_SHADOWS")); 44976 for (const t1 of b ? [ 44977 !1, 44978 !0 44979 ] : [ 44980 !1 44981 ]){ 44982 const i = t1 ? (e1.defines || []).concat(Pn) : e1.defines || []; 44983 for (const t1 of y ? [ 44984 !1, 44985 !0 44986 ] : [ 44987 !1 44988 ])for (const s of v ? [ 44989 !1, 44990 !0 44991 ] : [ 44992 !1 44993 ])for (const r of g ? [ 44994 !1, 44995 !0 44996 ] : [ 44997 !1 44998 ])d(p, i, { 44999 params: e1, 45000 fog: r, 45001 terrain: t1, 45002 globe: s 45003 }); 45004 } 45005 m && d(p, _, { 45006 params: e1, 45007 rtt: !0 45008 }); 45009 } 45010 } 45011 if (d("clippingMask"), r) for (const e1 of [ 45012 !1, 45013 !0 45014 ])d("terrainRaster", e1 ? [ 45015 "TERRAIN_VERTEX_MORPHING" 45016 ] : [], { 45017 terrain: !0, 45018 fog: s 45019 }); 45020 if (!c) { 45021 if (e1.some((e1)=>"hillshade" === e1.type) && d("hillshadePrepare"), a) for (const e1 of [ 45022 !1, 45023 !0 45024 ])for (const t1 of [ 45025 !1, 45026 !0 45027 ]){ 45028 const i = []; 45029 e1 && i.push("RENDER_CUTOFF"), i.push("RENDER_SHADOWS"), t1 && i.push("NORMAL_OFFSET"), d("groundShadow", i), s && d("groundShadow", i, { 45030 fog: !0 45031 }); 45032 } 45033 if (o) { 45034 for (const e1 of [ 45035 [], 45036 [ 45037 "TERRAIN_VERTEX_MORPHING" 45038 ], 45039 [ 45040 "GLOBE_POLES" 45041 ] 45042 ])for (const t1 of [ 45043 !1, 45044 !0 45045 ]){ 45046 const i = [ 45047 ...e1, 45048 "PROJECTION_GLOBE_VIEW" 45049 ]; 45050 t1 && i.push("CUSTOM_ANTIALIASING"), d("globeRaster", i, { 45051 terrain: r, 45052 globe: !0, 45053 fog: s 45054 }); 45055 } 45056 for (const e1 of [ 45057 !1, 45058 !0 45059 ]){ 45060 const t1 = e1 ? [ 45061 "PROJECTION_GLOBE_VIEW", 45062 "FOG" 45063 ] : [ 45064 "FOG" 45065 ]; 45066 d("globeAtmosphere", t1, { 45067 fog: !0, 45068 terrain: r, 45069 globe: e1 45070 }), d("globeAtmosphere", [ 45071 ...t1, 45072 "ALPHA_PASS" 45073 ], { 45074 fog: !0, 45075 terrain: r, 45076 globe: e1 45077 }); 45078 } 45079 d("stars", [], { 45080 fog: s, 45081 terrain: r, 45082 globe: !0 45083 }); 45084 } 45085 } 45086 } 45087 _executeBatch(i, s, r) { 45088 if (r.map && r.map.isMoving()) return void (this._idleHandle = e1.e.requestIdleCallback((e1)=>this._executeBatch(e1, s, r))); 45089 s.context.sweepPendingPrograms(); 45090 const o = s.context.extParallelShaderCompile ? t1.DEADLINE_MARGIN_KHR_MS : t1.DEADLINE_MARGIN_SYNC_MS; 45091 let n = 0; 45092 for(; this._queue.length > 0;){ 45093 const e1 = this._queue.shift(); 45094 if (!e1) break; 45095 if (e1.programId in fo && (s.style = r, s._fogVisible = !!e1.params.overrideFog, s.getOrCreateProgram(e1.programId, e1.params), n++, i.timeRemaining() <= o)) break; 45096 } 45097 const a = 0 === this._queue.length || i.timeRemaining() > o; 45098 n > 0 && a && s.context.gl.flush(), this._idleHandle = this._queue.length > 0 || s.context._pendingPrograms.size > 0 ? e1.e.requestIdleCallback((e1)=>this._executeBatch(e1, s, r)) : null; 45099 } 45100 processQueue(t1, i) { 45101 0 !== this._queue.length && (null != this._idleHandle && "undefined" != typeof cancelIdleCallback && cancelIdleCallback(this._idleHandle), this._idleHandle = e1.e.requestIdleCallback((e1)=>this._executeBatch(e1, t1, i))); 45102 } 45103 reset() { 45104 null != this._idleHandle && "undefined" != typeof cancelIdleCallback && cancelIdleCallback(this._idleHandle), this._queue = [], this._idleHandle = null, this._needsBuild = !0; 45105 } 45106 constructor(){ 45107 this._queue = [], this._needsBuild = !0, this._i
45107dleHandle = null; 45108 } 45109 }; 45110 Rn.DEADLINE_MARGIN_KHR_MS = 5, Rn.DEADLINE_MARGIN_SYNC_MS = 25; 45111 let An = Rn; 45112 const Mn = e1.s.colorTheme, On = new e1.af({ 45113 data: new e1.ag(Mn.data) 45114 }); 45115 function Fn(t1) { 45116 if (!t1.metadata || !t1.metadata.content_area) return; 45117 const i = e1.e.devicePixelRatio, { left: s, top: r, width: o, height: n } = t1.metadata.content_area, a = s * i, l = r * i; 45118 return [ 45119 a, 45120 l, 45121 a + o * i, 45122 l + n * i 45123 ]; 45124 } 45125 function kn(t1) { 45126 if (t1) return t1.map((param)=>{ 45127 let [t1, i] = param; 45128 return [ 45129 t1 * e1.e.devicePixelRatio, 45130 i * e1.e.devicePixelRatio 45131 ]; 45132 }); 45133 } 45134 class Bn { 45135 addPendingRequest(e1) { 45136 this.missingRequests.has(e1.name) || this.pendingRequests.has(e1.name) || this.pendingRequests.add(e1.name); 45137 } 45138 hasPendingRequests() { 45139 return this.pendingRequests.size > 0; 45140 } 45141 resolvePendingRequests() { 45142 const t1 = new Map; 45143 if (!this.sourceCache.loaded()) return t1; 45144 const i = this.sourceCache.getVisibleCoordinates(); 45145 if (0 === i.length) return t1; 45146 const s = this.sourceCache.getSource(); 45147 if ("raster-array" !== s.type) return t1; 45148 const r = i.map((e1)=>this.sourceCache.getTile(e1)), o = s.getImages(r, Array.from(this.pendingRequests)); 45149 for (const [i, s] of o)t1.set(e1.I.from({ 45150 name: i, 45151 iconsetId: this.id 45152 }), s), this.pendingRequests.delete(i); 45153 for (const e1 of this.pendingRequests)this.missingRequests.add(e1); 45154 return this.pendingRequests.clear(), t1; 45155 } 45156 constructor(e1, t1, i){ 45157 this.id = e1, this.scope = t1, this.sourceCache = i, this.pendingRequests = new Set, this.missingRequests = new Set; 45158 } 45159 } 45160 const zn = (e1, t1)=>Tt(e1, t1 && t1.filter((e1)=>"source.canvas" !== e1.identifier)), Un = new Set([ 45161 "addLayer", 45162 "removeLayer", 45163 "setLights", 45164 "setPaintProperty", 45165 "setLayoutProperty", 45166 "setLayerProperty", 45167 "setSlot", 45168 "setFilter", 45169 "addSource", 45170 "removeSource", 45171 "setLayerZoomRange", 45172 "setLight", 45173 "setTransition", 45174 "setGeoJSONSourceData", 45175 "setTerrain", 45176 "setFog", 45177 "setSnow", 45178 "setRain", 45179 "setProjection", 45180 "setCamera", 45181 "addImport", 45182 "removeImport", 45183 "updateImport", 45184 "addIconset", 45185 "removeIconset" 45186 ]), Nn = new Set([ 45187 "setCenter", 45188 "setZoom", 45189 "setBearing", 45190 "setPitch" 45191 ]), jn = new Set([ 45192 "background", 45193 "sky", 45194 "slot", 45195 "custom" 45196 ]), Vn = { 45197 version: 8, 45198 layers: [], 45199 sources: {} 45200 }, Gn = { 45201 duration: 300, 45202 delay: 0 45203 }; 45204 class qn extends e1.E { 45205 load(e1) { 45206 return e1 ? ("string" == typeof e1 ? this.loadURL(e1) : this.loadJSON(e1), this) : this; 45207 } 45208 _getGlobalId(t1) { 45209 if (!t1) return null; 45210 if ("string" == typeof t1) { 45211 if (e1.cH(t1)) return t1; 45212 const i = e1.dC(t1); 45213 if (!i.startsWith("http")) try { 45214 return new URL(i, location.href).toString(); 45215 } catch (e1) { 45216 return i; 45217 } 45218 return i; 45219 } 45220 return "json://".concat(e1.dD(JSON.stringify(t1))); 45221 } 45222 _diffStyle(t1, i, s) { 45223 this.globalId = this._getGlobalId(t1), wt(); 45224 const r = (e1, t1)=>{ 45225 try { 45226 t1(null, this.setState(e1, s)); 45227 } catch (e1) { 45228 t1(e1, !1); 45229 } 45230 }; 45231 if ("string" == typeof t1) { 45232 const s = this.map._requestManager.normalizeStyleURL(t1), o = new AbortController; 45233 this._request = { 45234 cancel: ()=>o.abort() 45235 }, (async ()=>{ 45236 const t1 = await this.map._requestManager.transformRequest(s, e1.R.Style, o.signal), { data: n } = await e1.g(t1, o.signal); 45237 this._request = null, r(n, i); 45238 })().catch((t1)=>{ 45239 this._request = null, o.signal.aborted || this.fire(new e1.f(t1)); 45240 }); 45241 } else "object" == typeof t1 && r(t1, i); 45242 } 45243 loadURL(t1) { 45244 let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 45245 this.fire(new e1.h("dataloading", { 45246 dataType: "style" 45247 }));
45248 const s = "boolean" == typeof i.validate ? i.validate : !e1.cH(t1); 45249 s && wt(), this.globalId = this._getGlobalId(t1), t1 = this.map._requestManager.normalizeStyleURL(t1, i.accessToken), this.resolvedImports.add(t1); 45250 const r = this.importsCache.get(t1); 45251 if (r) return void this._load(r, s); 45252 const o = new AbortController; 45253 this._request = { 45254 cancel: ()=>o.abort() 45255 }, (async ()=>{ 45256 const i = await this.map._requestManager.transformRequest(t1, e1.R.Style, o.signal), { data: r } = await e1.g(i, o.signal); 45257 this._request = null, this.importsCache.set(t1, r), this._load(r, s); 45258 })().catch((t1)=>{ 45259 this._request = null, o.signal.aborted || this.fire(new e1.f(t1)); 45260 }); 45261 } 45262 loadJSON(t1) { 45263 let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 45264 this.fire(new e1.h("dataloading", { 45265 dataType: "style" 45266 })); 45267 const s = !1 !== i.validate; 45268 s && wt(), this.globalId = this._getGlobalId(t1), this._request = e1.e.frame(()=>{ 45269 this._request = null, this._load(t1, s); 45270 }); 45271 } 45272 loadEmpty() { 45273 this.fire(new e1.h("dataloading", { 45274 dataType: "style" 45275 })), this._load(Vn, !1); 45276 } 45277 _loadImports(t1, i, s) { 45278 if (this.importDepth >= 4) return e1.w("Style doesn't support nesting deeper than 5"), Promise.resolve(); 45279 const r = []; 45280 for (const o of t1){ 45281 const t1 = this._createFragmentStyle(o), n = new Promise((e1)=>{ 45282 t1.once("style.import.load", e1), t1.once("error", e1); 45283 }).then(()=>{ 45284 this.mergeAll(), this.fire(new e1.h("data", { 45285 dataType: "style" 45286 })); 45287 }); 45288 if (r.push(n), this.resolvedImports.has(o.url)) { 45289 t1.loadEmpty(); 45290 continue; 45291 } 45292 const a = o.data || this.importsCache.get(o.url); 45293 a ? (o.data ? (t1.fire(new e1.h("dataloading", { 45294 dataType: "style" 45295 })), t1.globalId = t1._getGlobalId(a), i && wt(), queueMicrotask(()=>{ 45296 t1._load(a, i); 45297 })) : t1.loadJSON(a, { 45298 validate: i 45299 }), this._isInternalStyle(a) && (t1.globalId = null)) : o.url ? t1.loadURL(o.url, { 45300 validate: i 45301 }) : t1.loadEmpty(); 45302 const l = { 45303 style: t1, 45304 id: o.id, 45305 config: o.config 45306 }; 45307 if (s) { 45308 const e1 = this.fragments.findIndex((param)=>{ 45309 let { id: e1 } = param; 45310 return e1 === s; 45311 }); 45312 this.fragments = this.fragments.slice(0, e1).concat(l).concat(this.fragments.slice(e1)); 45313 } else this.fragments.push(l); 45314 } 45315 return Promise.allSettled(r); 45316 } 45317 getImportGlobalIds() { 45318 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this, t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Set; 45319 for (const i of e1.fragments)i.style.globalId && t1.add(i.style.globalId), this.getImportGlobalIds(i.style, t1); 45320 return [ 45321 ...t1.values() 45322 ]; 45323 } 45324 _createFragmentStyle(t1) { 45325 const i = this.scope ? e1.m(t1.id, this.scope) : t1.id; 45326 let s; 45327 const r = this._initialConfig && this._initialConfig[i]; 45328 (t1.config || r) && (s = { 45329 ...t1.config, 45330 ...r 45331 }); 45332 const o = new qn(this.map, { 45333 scope: i, 45334 styleChanges: this._changes, 45335 importDepth: this.importDepth + 1, 45336 importsCache: this.importsCache, 45337 resolvedImports: new Set(this.resolvedImports), 45338 dispatcher: this.dispatcher, 45339 imageManager: this.imageManager, 45340 glyphManager: this.glyphManager, 45341 modelManager: this.modelManager, 45342 config: s, 45343 configOptions: this.options, 45344 colorThemeOverride: t1["color-theme"], 45345 layerExpressionDependencies: this._layerExpressionDependencies 45346 }); 45347 return o.setEventedParent(this.map, { 45348 style: o 45349 }), o; 45350 } 45351 _reloadImports() { 45352 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1; 45353 this.mergeAll(), this._updateMapProjection(), e1 || this.updateConfigDependencies(), this._updateLayers(this._dependentLayerIds((e1)=>e1.isIndoorDependent)), this.map._triggerCameraUpdate(this.camera), (!e1 || this.isRootStyle() || this.map.style._initialBroadcastDone) && (e1 && this.isRootStyle() ? (this.forEachFragmentStyle((e1)=>{ 45354 this.dispatcher.broadcast("setLayers", { 45355 layers: e1._serializeLayers(e1._order), 45356 scope: e1.scope, 45357 options: e1.options 45358 }); 45359 }), this._initialBroadcastDone = !0) : this.dispatcher.broadcast("setLayers", { 45360 layers: this._serializeLayers(this._order), 45361 scope: this.scope, 45362 options: this.options 45363 })); 45364 } 45365 _isInternalStyle(e1) { 45366 return this.isRootStyle() && (e1.fragment || !!e1.schema && !1 !== e1.fragment); 45367 } 45368 async _load(t1, i) { 45369 if (this._isInternalStyle(t1)) { 45370 const e1 = { 45371 id: "basemap", 45372 data: t1, 45373 url: "" 45374 }, s = { 45375 ...Vn, 45376 imports: [ 45377 e1 45378 ], 45379 ...t1.center ? { 45380 center: t1.center 45381 } : {}, 45382 ...t1.bearing ? { 45383 bearing: t1.bearing 45384 } : {}, 45385 ...t1.pitch ? { 45386 pitch: t1.pitch 45387 } : {}, 45388 ...t1.zoom ? { 45389 zoom: t1.zoom 45390 } : {}, 45391 ...t1.light ? { 45392 light: t1.light 45393 } : {} 45394 }; 45395 return this._importedAsBasemap = !0, void this._load(s, i); 45396 } 45397 if (this.updateConfig(this._config, t1.schema), i) { 45398 if (await wt(), !this.dispatcher.actors.length) return; 45399 if (zn(this, Ct(t1))) return; 45400 } 45401 this._loaded = !0; 45402 for(const e1 in t1.sources)this.addSource(e1, t1.sources[e1], { 45403 validate: !1, 45404 isInitialLoad: !0 45405 }); 45406 this.stylesheet = e1.dE(t1); 45407 const s = ()=>{ 45408 if (t1.iconsets) for(const e1 in t1.iconsets)this.addIconset(e1, t1.iconsets[e1]); 45409 t1.sprite ? this._loadIconset(t1.sprite) : (this.imageManager.setLoaded(!0, this.scope), this.dispatcher.broadcast("spriteLoaded", { 45410 scope: this.scope 45411 })), !this.glyphManager.url && t1.glyphs && this.glyphManager.setURL(t1.glyphs);
vendor: 6,643 bytes, lines 45412-45495
45412 const s = Wo(this.stylesheet.layers); 45413 if (this._order = s.map((e1)=>e1.id), this.stylesheet.light && e1.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."), this.stylesheet.lights) if (1 === this.stylesheet.lights.length && "flat" === this.stylesheet.lights[0].type) { 45414 const e1 = this.stylesheet.lights[0]; 45415 this.light = new Nt(e1.properties, e1.id); 45416 } else this.setLights(this.stylesheet.lights); 45417 this.light || (this.light = new Nt(this.stylesheet.light)), this._layers = Object.create(null); 45418 let r = !1; 45419 for (const t1 of s){ 45420 const i = e1.dJ(t1, this.scope, this._styleColorTheme.lut, this.options); 45421 this._layerExpressionDependencies.set(i.fqid, new x(i)), this._hasAppearances = this._hasAppearances || 0 !== i.getAppearances().length, i.setEventedParent(this, { 45422 layer: { 45423 id: i.id 45424 } 45425 }), this._layers[i.id] = i, this._updateHdCoverageSourceCache(i) && (r = !0); 45426 const s = this.getOwnLayerSourceCache(i), o = !!this.directionalLight && this.directionalLight.shadowsEnabled(); 45427 s && i.canCastShadows() && o && (s.castsShadows = !0); 45428 } 45429 if (r && Ks().then(()=>{ 45430 if (!this.map) return; 45431 for(const e1 in this._layers)this._updateHdCoverageSourceCache(this._layers[e1]); 45432 this.map.style.mergeAll(); 45433 const e1 = this.map.transform; 45434 for(const t1 in this.map.style._mergedHdRoadCoverageSourceCaches){ 45435 const i = this.map.style._mergedHdRoadCoverageSourceCaches[t1]; 45436 i.used = !0, e1 && i.update(e1); 45437 } 45438 this.map._update(); 45439 }), this.glyphManager.url) { 45440 const e1 = new Set; 45441 for(const t1 in this._layers){ 45442 const i = this._layers[t1]; 45443 if ("symbol" === i.type && i.layout) { 45444 const t1 = i.layout.get("text-font"); 45445 t1 && t1.value && "constant" === t1.value.kind && e1.add(t1.value.value.join(",")); 45446 } 45447 } 45448 for (const t1 of e1)this.glyphManager.prefetchRange(t1, 0); 45449 } 45450 this.stylesheet.featuresets && this.setFeaturesetSelectors(this.stylesheet.featuresets), this.stylesheet.models && this.addModelURLs(this.stylesheet.models); 45451 const o = this.stylesheet.terrain; 45452 o && (this.checkCanvasFingerprintNoise(), this.disableElevatedTerrain || this.terrainSetForDrapingOnly() || (this._startLiteLoad(), this._createTerrain(o, 1))), this.stylesheet.fog && this._createFog(this.stylesheet.fog), this.stylesheet.snow && this._createSnow(this.stylesheet.snow), this.stylesheet.rain && this._createRain(this.stylesheet.rain), this.stylesheet.transition && this.setTransition(this.stylesheet.transition), this.fire(new e1.h("data", { 45453 dataType: "style" 45454 })); 45455 const n = this.isRootStyle(); 45456 t1.imports ? this._loadImports(t1.imports, i).then(()=>{ 45457 this._reloadImports(!0), this.fire(new e1.h(n ? "style.load" : "style.import.load")); 45458 }).catch((t1)=>{ 45459 this.fire(new e1.f(new Error("Failed to load imports", t1))), this.fire(new e1.h(n ? "style.load" : "style.import.load")); 45460 }) : (this._reloadImports(!0), this.fire(new e1.h(n ? "style.load" : "style.import.load"))); 45461 }; 45462 this._styleColorTheme.colorTheme = this.stylesheet["color-theme"]; 45463 const r = this._styleColorTheme.colorThemeOverride ? this._styleColorTheme.colorThemeOverride : this._styleColorTheme.colorTheme; 45464 if (r) { 45465 const t1 = this._evaluateColorThemeData(r); 45466 this._loadColorTheme(t1).then(()=>{ 45467 s(); 45468 }).catch((t1)=>{ 45469 e1.w("Couldn't load color theme from the stylesheet: ".concat(t1)), s(); 45470 }); 45471 } else this._styleColorTheme.lut = null, s(); 45472 } 45473 isRootStyle() { 45474 return 0 === this.importDepth; 45475 } 45476 hasAppearances() { 45477 return this._hasAppearances || this.fragments.some((e1)=>e1.style.hasAppearances()); 45478 } 45479 mergeAll() { 45480 let e1, t1, i, s, r, o, n, a, l, c; 45481 const h = {}; 45482 this.terrain && this.terrain.scope !== this.scope && delete this.terrain, this.forEachFragmentStyle((d)=>{ 45483 if (d.stylesheet) { 45484 if (d.disableElevatedTerrain && (this.disableElevatedTerrain = !0), null != d.light && (e1 = d.light), d.stylesheet.lights) for (const e1 of d.stylesheet.lights)"ambient" === e1.type && null != d.ambientLight && (t1 = d.ambientLight), "directional" === e1.type && null != d.directionalLight && (i = d.directionalLight); 45485 s = this._prioritizeTerrain(s, d.terrain, d.stylesheet.terrain), d.stylesheet.fog && null != d.fog && (r = d.fog), d.stylesheet.snow && null != d.snow && (o = d.snow), d.stylesheet.rain && null != d.rain && (n = d.rain), null != d.stylesheet.camera && (c = d.stylesheet.camera), null != d.stylesheet.projection && (a = d.stylesheet.projection), null != d.stylesheet.transition && (l = d.stylesheet.transition), h[d.scope] = d._styleColorTheme; 45486 } 45487 }), this.light = e1, this.ambientLight = t1, this.directionalLight = i, this.fog = r, this.snow = o, this.rain = n, this._styleColorThemeForScope = h, null === s ? delete this.terrain : this.terrain = s, this.camera = c || { 45488 "camera-projection": "perspective" 45489 }, this.projection = a || { 45490 name: "mercator" 45491 }, this.transition = { 45492 ...Gn, 45493 ...l 45494 }, this.mergeSources(), this.mergeLayers(), this.mergeIndoor(), this._programPrecompiler && this._programPrecompiler.reset(); 45495 }
45496 forEachFragmentStyle(e1) { 45497 const t1 = (i)=>{ 45498 for (const e1 of i.fragments)t1(e1.style); 45499 e1(i); 45500 }; 45501 t1(this); 45502 } 45503 _prioritizeTerrain(e1, t1, i) { 45504 const s = e1 && 0 === e1.drapeRenderMode; 45505 return null === i ? t1 && 0 === t1.drapeRenderMode ? t1 : s ? e1 : null : null != t1 && (!e1 || s || t1 && 1 === t1.drapeRenderMode) ? t1 : e1; 45506 } 45507 mergeTerrain() { 45508 let e1; 45509 this.terrain && this.terrain.scope !== this.scope && delete this.terrain, this.forEachFragmentStyle((t1)=>{ 45510 e1 = this._prioritizeTerrain(e1, t1.terrain, t1.stylesheet.terrain); 45511 }), null === e1 ? delete this.terrain : this.terrain = e1, this._programPrecompiler && this._programPrecompiler.reset(); 45512 } 45513 mergeProjection() { 45514 let e1; 45515 this.forEachFragmentStyle((t1)=>{ 45516 null != t1.stylesheet.projection && (e1 = t1.stylesheet.projection); 45517 }), this.projection = e1 || { 45518 name: "mercator" 45519 }, this._programPrecompiler && this._programPrecompiler.reset(); 45520 } 45521 mergeSources() { 45522 const t1 = {}, i = Object.create(null), s = Object.create(null), r = Object.create(null), o = Object.create(null), n = Object.create(null); 45523 this.forEachFragmentStyle((a)=>{ 45524 for(const i in a._sourceCaches){ 45525 const s = e1.m(i, a.scope); 45526 t1[s] = a._sourceCaches[i]; 45527 } 45528 for(const t1 in a._otherSourceCaches){ 45529 const s = e1.m(t1, a.scope); 45530 i[s] = a._otherSourceCaches[t1]; 45531 } 45532 for(const t1 in a._symbolSourceCaches){ 45533 const i = e1.m(t1, a.scope); 45534 s[i] = a._symbolSourceCaches[t1]; 45535 } 45536 for(const t1 in a._fillExtrusionSourceCaches){ 45537 const i = e1.m(t1, a.scope); 45538 r[i] = a._fillExtrusionSourceCaches[t1]; 45539 } 45540 if (a._hdCoverage) { 45541 const t1 = a._hdCoverage.coverageSourceCaches; 45542 for(const i in t1)o[e1.m(i, a.scope)] = t1[i]; 45543 } 45544 if (a._hdElevation) { 45545 const e1 = a._hdElevation.elevationSourceCaches; 45546 for(const t1 in e1)n[t1] = e1[t1]; 45547 } 45548 }), this._mergedSourceCaches = t1, this._mergedOtherSourceCaches = i, this._mergedSymbolSourceCaches = s, this._mergedFillExtrusionSourceCaches = r, this._mergedHdRoadCoverageSourceCaches = o, this._mergedHdRoadElevationSourceCaches = n, Object.keys(o).length > 0 && !this._hdCoverage && Xs.HdCoverageState && (this._hdCoverage = new Xs.HdCoverageState), Xs.updateCrossSourceElevationGate && Xs.updateCrossSourceElevationGate(this); 45549 } 45550 mergeIndoor() { 45551 this._mergedIndoor = {}, this.forEachFragmentStyle((t1)=>{ 45552 if (t1.stylesheet && t1.stylesheet.indoor) for (const i of Object.values(t1.stylesheet.indoor)){ 45553 const s = i, r = e1.m(s.sourceId, t1.scope); 45554 this._mergedIndoor[r] = new Set(s.sourceLayers || []); 45555 } 45556 }), this._updateIndoorEnabled(); 45557 } 45558 _updateIndoorEnabled() { 45559 const t1 = this._indoorEnabled; 45560 if (this._indoorEnabled = !1, Object.keys(this._mergedIndoor).length > 0) for (const t1 of this._mergedOrder){ 45561 const i = this._mergedLayers[t1]; 45562 if ("none" !== i.visibility && this._mergedIndoor[e1.m(i.source, i.scope)]) { 45563 this._indoorEnabled = !0; 45564 break; 45565 } 45566 }
45567 !this._indoorEnabled || t1 || this.indoorManager || Ks().then(()=>{ 45568 this._initIndoorManager(); 45569 }); 45570 } 45571 _initIndoorManager() { 45572 if (!this.indoorManager && Xs.IndoorManager && this.isRootStyle() && 0 !== Object.keys(this._mergedIndoor).length && (this.indoorManager = new Xs.IndoorManager(this, this._loaded), this._loaded)) for (const e1 of Object.keys(this._mergedIndoor)){ 45573 const t1 = this._mergedSourceCaches[e1] || this._mergedOtherSourceCaches[e1]; 45574 t1 && t1.reload(); 45575 } 45576 } 45577 mergeLayers() { 45578 var _this = this; 45579 const t1 = {}, i = [], s = Object.create(null); 45580 this._mergedSlots = [], this._has3DLayers = !1, this._hasCircleLayers = !1, this._hasSymbolLayers = !1, this.forEachFragmentStyle((s)=>{ 45581 for (const r of s._order){ 45582 const o = s._layers[r]; 45583 if ("slot" === o.type) { 45584 const i = e1.bV(r); 45585 if (t1[i]) continue; 45586 t1[i] = []; 45587 } 45588 o.slot && t1[o.slot] ? t1[o.slot].push(o) : i.push(o); 45589 } 45590 }), this._mergedOrder = []; 45591 let r = -1; 45592 const o = function() { 45593 let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; 45594 for (const n of i)if ("slot" === n.type) { 45595 const i = e1.bV(n.id); 45596 t1[i] && o(t1[i]), _this._mergedSlots.push(i); 45597 } else { 45598 const t1 = e1.m(n.id, n.scope); 45599 _this._mergedOrder.push(t1), s[t1] = n, n.is3D(!!_this.terrain) && (_this._has3DLayers = !0, r = _this._mergedOrder.length - 1), "circle" === n.type && (_this._hasCircleLayers = !0), "symbol" === n.type && (_this._hasSymbolLayers = !0), "clip" === n.type && (_this._clipLayerPresent = !0); 45600 } 45601 }; 45602 if (o(i), this._has3DLayers) { 45603 const e1 = {}; 45604 for(let t1 = 0; t1 < this._mergedOrder.length; ++t1){ 45605 const i = this._mergedOrder[t1]; 45606 e1[i] = t1 === r ? 1 : t1 < r ? s[i].hasOcclusionOpacityProperties ? 2 : 0 : 4; 45607 } 45608 this._mergedOrder.sort((t1, i)=>e1[t1] - e1[i]); 45609 } 45610 this._mergedLayers = s, this.updateDrapeFirstLayers(), this._buildingIndex.processLayersChanged(), this._updateDataDrivenEmissiveStrength(); 45611 } 45612 terrainSetForDrapingOnly() { 45613 return !!this.terrain && 0 === this.terrain.drapeRenderMode; 45614 } 45615 getCamera() { 45616 return this.stylesheet.camera; 45617 } 45618 setCamera(e1) { 45619 return this.stylesheet.camera = { 45620 ...this.stylesheet.camera, 45621 ...e1 45622 }, this.camera = this.stylesheet.camera, this; 45623 } 45624 _evaluateColorThemeData(t1) { 45625 return t1.data ? (function(t1, i, s) { 45626 const r = { 45627 ...i 45628 }; 45629 for (const e1 of Object.keys(Mn))void 0 === r[e1] && (r[e1] = Mn[e1].default); 45630 const o = new e1.ae(On, t1, new Map(s)); 45631 return o.setTransitionOrValue(r, s), o.untransitioned().possiblyEvaluate(new e1.ai(0, { 45632 worldview: void 0 45633 })); 45634 })(this.scope, t1, this.options).get("data") : null; 45635 } 45636 _loadColorTheme(t1) { 45637 this._styleColorTheme.lutLoading = !0, this._styleColorTheme.lutLoadingCorrelationID += 1; 45638 const i = this._styleColorTheme.lutLoadingCorrelationID; 45639 return new Promise((s, r)=>{ 45640 const o = "data:image/png;base64,"; 45641 if (!t1 || 0 === t1.length) return this._styleColorTheme.lut = null, this._styleColorTheme.lutLoading = !1, void s(); 45642 let n = t1; 45643 n.startsWith(o) || (n = o + n); 45644 const a = e1.I.from("mapbox-reserved-lut"), l = new Image; 45645 l.src = n, l.onerror = ()=>{ 45646 this._styleColorTheme.lutLoading = !1, r(new Error("Failed to load image data")); 45647 }, l.onload = ()=>{ 45648 if (this._styleColorTheme.lutLoadingCorrelationID !== i) return void s(); 45649 this._styleColorTheme.lutLoading = !1; 45650 const { width: o, height: n, data: c }
vendor: 4,347 bytes, lines 45650-45726
45650 = e1.e.getImageData(l); 45651 if (n > 32) return void r(new Error("The height of the image must be less than or equal to 32 pixels.")); 45652 if (o !== n * n) return void r(new Error("The width of the image must be equal to the height squared.")); 45653 this.getImage(a) && this.removeImage(a), this.addImage(a, { 45654 data: new e1.b({ 45655 width: o, 45656 height: n 45657 }, c), 45658 pixelRatio: 1, 45659 sdf: !1, 45660 usvg: !1, 45661 version: 0 45662 }); 45663 const h = this.imageManager.getImage(a, this.scope); 45664 h ? (this._styleColorTheme.lut = { 45665 image: h.data, 45666 data: t1 45667 }, s()) : r(new Error("Missing LUT image.")); 45668 }; 45669 }); 45670 } 45671 getLut(e1) { 45672 const t1 = this._styleColorThemeForScope[e1]; 45673 return t1 ? t1.lut : null; 45674 } 45675 setProjection(e1) { 45676 e1 ? this.stylesheet.projection = e1 : delete this.stylesheet.projection, this.mergeProjection(), this._updateMapProjection(); 45677 } 45678 applyProjectionUpdate() { 45679 this.map.transform.projection.requiresDraping && this._startLiteLoad(), this._loaded && (this.dispatcher.broadcast("setProjection", this.map.transform.projectionOptions), this.map.transform.projection.requiresDraping ? (this.getTerrain() || this.stylesheet.terrain) && !this.disableElevatedTerrain || this.setTerrainForDraping() : this.terrainSetForDrapingOnly() && this.setTerrain(null, 0)); 45680 } 45681 _updateMapProjection() { 45682 this.isRootStyle() && (this.map._useExplicitProjection ? this.applyProjectionUpdate() : this.map._prioritizeAndUpdateProjection(null, this.projection)); 45683 } 45684 _loadSprite(t1) { 45685 const i = new AbortController; 45686 this._spriteRequest = i, function(t1, i, s, r) { 45687 let o, n, a; 45688 const l = e1.e.devicePixelRatio > 1 ? "@2x" : ""; 45689 function c(t1) { 45690 a || t1 && s.aborted || (t1 && (a = t1), function() { 45691 if (a) r(a); 45692 else if (o && n) { 45693 const t1 = e1.e.getImageData(n), i = {}; 45694 for(const s in o){ 45695 const { width: r, height: n, x: a, y: l, sdf: c, pixelRatio: h, stretchX: d, stretchY: u, content: p } = o[s], f = new e1.b({ 45696 width: r, 45697 height: n 45698 }); 45699 e1.b.copy(t1, f, { 45700 x: a, 45701 y: l 45702 }, { 45703 x: 0, 45704 y: 0 45705 }, { 45706 width: r, 45707 height: n 45708 }, null), i[s] = { 45709 data: f, 45710 pixelRatio: void 0 !== h ? h : 1, 45711 sdf: void 0 !== c && c, 45712 stretchX: d, 45713 stretchY: u, 45714 content: p, 45715 usvg: !1, 45716 version: 0 45717 }; 45718 } 45719 r(null, i); 45720 } 45721 }()); 45722 } 45723 (async function() { 45724 const r = await i.transformRequest(i.normalizeSpriteURL(t1, l, ".json"), e1.R.SpriteJSON, s), { data: n } = await e1.g(r, s); 45725 a || (o = n); 45726 })().then(()=>c(void 0), (e1)=>
45726c(e1)), (async function() { 45727 const r = await i.transformRequest(i.normalizeSpriteURL(t1, l, ".png"), e1.R.SpriteImage, s), { data: o } = await e1.a(r, s); 45728 a || (n = o); 45729 })().then(()=>c(void 0), (e1)=>c(e1)); 45730 }(t1, this.map._requestManager, i.signal, (t1, i)=>{ 45731 if (this._spriteRequest = null, t1) this.dispatcher.broadcast("spriteLoaded", { 45732 scope: this.scope 45733 }), this.fire(new e1.f(t1)); 45734 else if (i) { 45735 const t1 = new Map; 45736 for(const s in i)t1.set(e1.I.from(s), i[s]); 45737 this.addImages(t1, !0); 45738 } 45739 this.imageManager.setLoaded(!0, this.scope), this.fire(new e1.h("data", { 45740 dataType: "style" 45741 })); 45742 }); 45743 } 45744 addIconset(t1, i) { 45745 if ("sprite" === i.type) return void this._loadSprite(i.url); 45746 const s = this.getOwnSourceCache(i.source); 45747 if (!s) return void this.fire(new e1.f(new Error('Source "'.concat(i.source, '" as specified by iconset "').concat(t1, '" does not exist and cannot be used as an iconset source')))); 45748 if ("raster-array" !== s.getSource().type) return void this.fire(new e1.f(new Error('Source "'.concat(i.source, '" as specified by iconset "').concat(t1, '" is not a "raster-array" source and cannot be used as an iconset source')))); 45749 const r = new Bn(t1, this.scope, s); 45750 this.imageManager.addImageProvider(r, this.scope); 45751 } 45752 removeIconset(e1) { 45753 this.imageManager.removeImageProvider(e1, this.scope); 45754 } 45755 _loadIconset(t1) { 45756 if (!e1.cH(t1) && "icon_set" !== this.map._spriteFormat || "raster" === this.map._spriteFormat) return void this._loadSprite(t1); 45757 const i = "auto" === this.map._spriteFormat, s = new AbortController; 45758 this._spriteRequest = s, async function(t1, i, s, r) { 45759 try { 45760 const o = await i.transformRequest(i.normalizeIconsetURL(t1), e1.R.Iconset, s), { data: n } = await e1.d1(o, s), a = {}, l = function(e1) { 45761 const t1 = { 45762 icons: [] 45763 }; 45764 let i; 45765 for(; i = e1.nextField(void 0);)1 === i && t1.icons.push(C(e1, e1.readVarint() + e1.pos)); 45766 return t1; 45767 }(new e1.d0(n)); 45768 for (const t1 of l.icons){ 45769 const i = { 45770 version: 1, 45771 pixelRatio: e1.e.devicePixelRatio, 45772 content: Fn(t1), 45773 stretchX: t1.metadata ? kn(t1.metadata.stretch_x_areas) : void 0, 45774 stretchY: t1.metadata ? kn(t1.metadata.stretch_y_areas) : void 0, 45775 sdf: !1, 45776 usvg: !0, 45777 icon: t1 45778 }; 45779 a[t1.name] = i; 45780 } 45781 r(null, a); 45782 } catch (e1) { 45783 s.aborted || r(e1); 45784 } 45785 }(t1, this.map._requestManager, s.signal, (s, r)=>{ 45786 if (this._spriteRequest = null, s) i ? this._loadSprite(t1) : (this.dispatcher.broadcast("spriteLoaded", { 45787 scope: this.scope 45788 }), this.fire(new e1.f(s))); 45789 else if (r) { 45790 const t1 = new Map; 45791 for(const i in r)t1.set(e1.I.from(i), r[i]); 45792 this.addImages(t1, !0); 45793 } 45794 this.imageManager.setLoaded(!0, this.scope), this.fire(new e1.h("data", { 45795 dataType: "style" 45796 })); 45797 }); 45798 } 45799 _validateLayer(t1) { 45800 const i = this.getOwnSource(t1.source); 45801 if (!i) return; 45802 const s = t1.sourceLayer; 45803 s && ("geojson" === i.type || i.vectorLayerIds && !i.vectorLayerIds.includes(s)) && this.fire(new e1.f(new Error('Source layer "'.concat(s, '" does not exist on source "').concat(i.id, '" as specified by style layer "').concat(t1.id, '"')))); 45804 } 45805 loaded() { 45806 if (!this._loaded) return !1;
45807 if (Object.keys(this._changes.getUpdatedSourceCaches()).length) return !1; 45808 for(const e1 in this._sourceCaches)if (!this._sourceCaches[e1].loaded()) return !1; 45809 if (!this.imageManager.isLoaded()) return !1; 45810 if (this.imageManager.hasPatternsInFlight()) return !1; 45811 if (!this.modelManager.isLoaded()) return !1; 45812 if (this._styleColorTheme.lutLoading) return !1; 45813 if (!1 === this._drapingLoaded) return !1; 45814 for (const { style: e1 } of this.fragments)if (!e1.loaded()) return !1; 45815 return !0; 45816 } 45817 _serializeImports() { 45818 if (this.stylesheet.imports) return this.stylesheet.imports.map((e1, t1)=>{ 45819 const i = this.fragments[t1]; 45820 return i && i.style && (e1.data = i.style.serialize()), e1; 45821 }); 45822 } 45823 _serializeSources() { 45824 const e1 = {}; 45825 for(const t1 in this._sourceCaches){ 45826 const i = this._sourceCaches[t1].getSource(); 45827 e1[i.id] || (e1[i.id] = i.serialize()); 45828 } 45829 return e1; 45830 } 45831 _serializeLayers(e1) { 45832 const t1 = []; 45833 for (const i of e1){ 45834 const e1 = this._layers[i]; 45835 e1 && "custom" !== e1.type && t1.push(e1.serialize()); 45836 } 45837 return t1; 45838 } 45839 hasLightTransitions() { 45840 return !(!this.light || !this.light.hasTransition()) || !(!this.ambientLight || !this.ambientLight.hasTransition()) || !(!this.directionalLight || !this.directionalLight.hasTransition()); 45841 } 45842 hasFogTransition() { 45843 return !!this.fog && this.fog.hasTransition(); 45844 } 45845 hasSnowTransition() { 45846 return !!this.snow && this.snow.hasTransition(); 45847 } 45848 hasRainTransition() { 45849 return !!this.rain && this.rain.hasTransition(); 45850 } 45851 hasTransitions() { 45852 if (this.hasLightTransitions()) return !0; 45853 if (this.hasFogTransition()) return !0; 45854 if (this.hasSnowTransition()) return !0; 45855 if (this.hasRainTransition()) return !0; 45856 for(const e1 in this._sourceCaches)if (this._sourceCaches[e1].hasTransition()) return !0; 45857 for(const e1 in this._layers)if (this._layers[e1].hasTransition()) return !0; 45858 return !1; 45859 } 45860 _updateDataDrivenEmissiveStrength() { 45861 for(const e1 in this._mergedLayers){ 45862 const t1 = this._mergedLayers[e1]; 45863 if (t1._transitionablePaint && t1._transitionablePaint._values) { 45864 const e1 = t1._transitionablePaint._values["line-emissive-strength"]; 45865 if (e1 && e1.value && e1.value.isDataDriven()) return void (this._hasDataDrivenEmissive = !0); 45866 } 45867 } 45868 this._hasDataDrivenEmissive = !1; 45869 } 45870 hasDataDrivenEmissiveStrength() { 45871 return this._hasDataDrivenEmissive; 45872 } 45873 get order() { 45874 return this.terrain ? this._drapedFirstOrder : this._mergedOrder; 45875 } 45876 _getOrder(e1) { 45877 return e1 ? this.order : this._mergedOrder; 45878 } 45879 isLayerDraped(e1) { 45880 return !!this.terrain && e1.isDraped(this.getLayerSourceCache(e1)); 45881 } 45882 _checkLoaded() { 45883 if (!this._loaded) throw new Error("Style is not done loading"); 45884 } 45885 _checkLayer(t1) { 45886 const i = this.getOwnLayer(t1); 45887 if (i) return i; 45888 this.fire(new e1.f(new Error("The layer '".concat(t1, "' does not exist in the map's style.")))); 45889 } 45890 _checkSource(t1) { 45891 const i = this.getOwnSource(t1); 45892 if (i) return i; 45893 this.fire(new e1.f(new Error("The source '".concat(t1, "' does not exist in the map's style.")))); 45894 } 45895 _resolveLayerFragment(t1) { 45896 const i = this.getLayer(t1); 45897 if (!i) return void this.fire(new e1.f(new Error("The layer '".concat(t1, "' does not exist in the map's style.")))); 45898 const s = this.getFragmentStyle(i.scope); 45899 return s ? { 45900 layer: i, 45901 fragment: s 45902 } : void 0; 45903 } 45904 handleIdle() { 45905 const e1 = this.map.painter;
vendor: 4,797 bytes, lines 45906-45976
45906 e1 && (e1.context.sweepPendingPrograms(), this._programPrecompiler && this._programPrecompiler.processQueue(e1, this)); 45907 } 45908 handleContextLost() { 45909 this._programPrecompiler && this._programPrecompiler.reset(); 45910 } 45911 update(t1) { 45912 var _a_e; 45913 if (!this._loaded) return; 45914 this.ambientLight && this.ambientLight.recalculate(t1), this.directionalLight && this.directionalLight.recalculate(t1); 45915 const i = this.calculateLightsBrightness(); 45916 t1.brightness = i || 0; 45917 let s = !1; 45918 i !== this._brightness && (this._brightness = i, s = !0), t1.worldview !== this._worldview && (this._worldview = t1.worldview, s = !0), s && this.dispatcher.broadcast("upsertRenderParams", { 45919 brightness: this._brightness, 45920 worldview: this._worldview 45921 }); 45922 const r = this._changes.isDirty(); 45923 let o = !1; 45924 if (this._changes.isDirty()) { 45925 const e1 = this._changes.getLayerUpdatesByScope(); 45926 for(const t1 in e1){ 45927 const { updatedIds: i, removedIds: s } = e1[t1]; 45928 (i || s) && (this._updateWorkerLayers(t1, i, s), o = !0); 45929 } 45930 this.updateSourceCaches(), this._updateTilesForChangedImages(), this.updateLayers(t1), this.light && this.light.updateTransitions(t1), this.ambientLight && this.ambientLight.updateTransitions(t1), this.directionalLight && this.directionalLight.updateTransitions(t1), this.fog && this.fog.updateTransitions(t1), this.snow && this.snow.updateTransitions(t1), this.rain && this.rain.updateTransitions(t1), this._changes.reset(); 45931 } 45932 const n = {}; 45933 for(const e1 in this._mergedSourceCaches){ 45934 const t1 = this._mergedSourceCaches[e1]; 45935 n[e1] = t1.used, t1.used = !1, t1.tileCoverLift = 0; 45936 } 45937 const a = {}; 45938 for (const i of this._mergedOrder){ 45939 const s = this._mergedLayers[i]; 45940 if (("none" !== s.visibility || s.hasTransition()) && s.recalculate(t1, this._availableImages), !s.isHidden(t1.zoom)) { 45941 s.mayUse("HD") && (s.prepare(), Ks()), s.mayUse("Standard") && (s.prepare(), hi()), s.mayUse("Lite") && (this.checkCanvasFingerprintNoise(), this.disableElevatedTerrain || this._startLiteLoad()); 45942 const e1 = this.getLayerSourceCache(s); 45943 e1 && (e1.used = !0, e1.tileCoverLift = Math.max(e1.tileCoverLift, s.tileCoverLift())); 45944 } 45945 if (s.source) { 45946 const t1 = e1.m(s.source, s.scope), i = this._mergedHdRoadCoverageSourceCaches[t1]; 45947 i && !i.used && (i.used = !0); 45948 } 45949 if ("fill-extrusion" === s.type) { 45950 const t1 = e1.m(s.source, s.scope); 45951 if (t1 in this._mergedFillExtrusionSourceCaches) { 45952 const e1 = s.layout && s.layout.get("source-max-zoom"); 45953 if (null != e1) { 45954 const i = a[t1]; 45955 a[t1] = null == i ? e1 : Math.min(i, e1); 45956 } 45957 } 45958 } 45959 } 45960 if (this._programPrecompiler && this._programPrecompiler.needsBuild()) { 45961 const e1 = this._mergedOrder.map((e1)=>this._mergedLayers[e1]); 45962 this._programPrecompiler.buildQueue(e1, t1, this); 45963 } 45964 for(const e1 in this._mergedFillExtrusionSourceCaches)this._mergedFillExtrusionSourceCaches[e1].setMaxzoomOverride((_a_e = a[e1]) !== null && _a_e !== void 0 ? _a_e : null); 45965 this.terrain && o && this.mergeLayers(); 45966 const l = this.imageManager.getPendingImageProviders(); 45967 for (const e1 of l)e1.sourceCache.used = !0; 45968 for(const t1 in n){ 45969 const i = this._mergedSourceCaches[t1]; 45970 n[t1] !== i.used && i.getSource().fire(new e1.h("data", { 45971 sourceDataType: "visibility", 45972 dataType: "source", 45973 sourceId: i.getSource().id 45974 })); 45975 } 45976 this.light && this.light.recalculate(t1), this.terrain && this.terrain.recalculate(t1), this.fog && this.fog.recalculate(t1), this.snow && this.snow.recalculate(t1), this.rain && this.rain.recalculate(t1), this.z = t1.zoom, this._markersNeedU
45976pdate && (this._updateMarkersOpacity(), this._markersNeedUpdate = !1), this.imageManager.clearUpdatedImages(this.scope), r && this.fire(new e1.h("data", { 45977 dataType: "style" 45978 })); 45979 } 45980 updateImageProviders() { 45981 const e1 = this.imageManager.getPendingImageProviders(); 45982 for (const t1 of e1){ 45983 const e1 = t1.resolvePendingRequests(), i = this.getFragmentStyle(t1.scope); 45984 i && i.addImages(e1); 45985 } 45986 } 45987 _updateTilesForChangedImages() { 45988 const e1 = {}; 45989 for(const t1 in this._mergedSourceCaches){ 45990 const i = this._mergedSourceCaches[t1].getSource().scope; 45991 e1[i] = e1[i] || this._changes.getUpdatedImages(i), 0 !== e1[i].length && this._mergedSourceCaches[t1].reloadTilesForDependencies([ 45992 "icons", 45993 "patterns" 45994 ], e1[i]); 45995 } 45996 for(const t1 in e1)this._changes.resetUpdatedImages(t1); 45997 } 45998 _updateWorkerLayers(e1, t1, i) { 45999 const s = this.getFragmentStyle(e1); 46000 s && this.dispatcher.broadcast("updateLayers", { 46001 layers: t1 ? s._serializeLayers(t1) : [], 46002 scope: e1, 46003 removedIds: i || [], 46004 options: s.options 46005 }); 46006 } 46007 setState(t1, i) { 46008 if (this._checkLoaded(), zn(this, Ct(t1))) return !1; 46009 if ((t1 = e1.dE(t1)).layers = Wo(t1.layers), !xt.diffStyles) throw new Error("Debug module not loaded; cannot diff style."); 46010 const s = xt.diffStyles(this.serialize(), t1).filter((e1)=>!Nn.has(e1.command)); 46011 if (0 === s.length) return !1; 46012 const r = s.filter((e1)=>!Un.has(e1.command)); 46013 if (r.length > 0) throw new Error("Unimplemented: ".concat(r.map((e1)=>e1.command).join(", "), ".")); 46014 const o = []; 46015 return s.forEach((e1)=>{ 46016 o.push(this[e1.command](...e1.args)); 46017 }), i && Promise.all(o).then(i).catch(i), this.stylesheet = t1, this.mergeAll(), this.dispatcher.broadcast("setLayers", { 46018 layers: this._serializeLayers(this._order), 46019 scope: this.scope, 46020 options: this.options 46021 }), !0; 46022 } 46023 _updateWorkerImages() { 46024 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1; 46025 this._availableImages = this.imageManager.listImages(this.scope); 46026 const t1 = { 46027 scope: this.scope, 46028 images: this._availableImages 46029 }; 46030 e1 && (t1.isSpriteLoaded = !0), this.dispatcher.broadcast("setImages", t1); 46031 } 46032 _updateWorkerModels() { 46033 this._availableModels = this.modelManager.getModelURIs(this.scope), this.dispatcher.broadcast("setModels", { 46034 scope: this.scope, 46035 models: this._availableModels 46036 }); 46037 } 46038 addImages(t1, i) { 46039 if (0 === t1.size) return i && this.dispatcher.broadcast("spriteLoaded", { 46040 scope: this.scope 46041 }), this; 46042 for (const [i, s] of t1.entries()){ 46043 if (this.getImage(i)) return this.fire(new e1.f(new Error('An image with the name "'.concat(i.name, '" already exists.')))); 46044 this.imageManager.addImage(i, this.scope, s), this._changes.updateImage(i, this.scope); 46045 } 46046 return this._updateWorkerImages(i), this.fire(new e1.h("data", { 46047 dataType: "style" 46048 })), this; 46049 } 46050 addImage(t1, i) { 46051 return this.getImage(t1) ? this.fire(new e1.f(new Error('An image with the name "'.concat(t1.name, '" already exists.')))) : (this.imageManager.addImage(t1, this.scope, i), this._changes.updateImage(t1, this.scope), this._updateWorkerImages(), this.fire(new e1.h("data", { 46052 dataType: "style" 46053 })), this); 46054 } 46055 updateImage(t1, i) { 46056 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 46057 this.imageManager.updateImage(t1, this.scope, i), s && (this._changes.updateImage(t1, this.scope), this._updateWorkerImages(), this.fire(new e1.h("data", { 46058 dataType: "style" 46059 }))); 46060 } 46061 getImage(e1) { 46062 return this.imageManager.getImage(e1, this.scope); 46063 } 46064 removeImage(t1) { 46065 return this.getImage(t1) ? (this.imageManager.removeImage(t1, this.scope), this._changes.updateImage(t1, this.scope), this._updateWorkerImages(), this.fire(new e1.h("data", { 46066 dataType: "style" 46067 })), this) : this.fire(new e1.f(new Error("No image with this name exists."))); 46068 } 46069 listImages() { 46070 return this._checkLoaded(), this._availableImages.slice(); 46071 } 46072 getActualScope() { 46073 return this._importedAsBasemap ? "basemap" : this.scope; 46074 } 46075 addModelURLs(t1) { 46076 return this.modelManager.addModelURLs(t1, this.getActualScope()), this._updateWorkerModels(), this.fire(new e1.h("data", { 46077 dataType: "style" 46078 })), this; 46079 } 46080 addModel(t1, i) { 46081 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
46082 return this._checkLoaded(), this._validate(Bt, "models.".concat(t1), i, null, s) || (this.modelManager.addModel(t1, i, this.getActualScope()), this.fire(new e1.h("data", { 46083 dataType: "style" 46084 }))), this; 46085 } 46086 hasModel(e1) { 46087 return this.modelManager.hasModel(e1, this.getActualScope()); 46088 } 46089 removeModel(t1) { 46090 return this.hasModel(t1) ? (this.modelManager.removeModel(t1, this.getActualScope(), !1, !0), this.fire(new e1.h("data", { 46091 dataType: "style" 46092 })), this) : this.fire(new e1.f(new Error("No model with this ID exists."))); 46093 } 46094 listModels() { 46095 return this._checkLoaded(), this.modelManager.listModels(this.getActualScope()); 46096 } 46097 addSource(t1, i) { 46098 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 46099 if (this._checkLoaded(), void 0 !== this.getOwnSource(t1)) throw new Error('There is already a source with ID "'.concat(t1, '".')); 46100 if (!i.type) throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(i).join(", "), ".")); 46101 if ([ 46102 "vector", 46103 "raster", 46104 "geojson", 46105 "video", 46106 "image" 46107 ].includes(i.type) && this._validate(Et, "sources.".concat(t1), i, null, s)) return; 46108 this.map && this.map._collectResourceTiming && (i.collectResourceTiming = !0); 46109 const r = Object.hasOwn(ko, i.type) && !Do(i.type), o = r ? new Bo(t1, i, this.dispatcher, this) : Io(t1, i, this.dispatcher, this); 46110 o.scope = this.scope; 46111 const n = (e1)=>{ 46112 e1.setEventedParent(this, ()=>({ 46113 isSourceLoaded: this._isSourceCacheLoaded(e1.id), 46114 source: e1.serialize(), 46115 sourceId: e1.id 46116 })); 46117 }; 46118 n(o); 46119 const a = (t1)=>{ 46120 const i = (t1 === e1.bR.Symbol ? "symbol:" : t1 === e1.bR.FillExtrusion ? "fill-extrusion:" : "other:") + o.id, s = e1.m(i, this.scope), r = this._sourceCaches[i] = new gs(s, o, t1); 46121 t1 === e1.bR.Symbol ? this._symbolSourceCaches[o.id] = r : t1 === e1.bR.FillExtrusion ? this._fillExtrusionSourceCaches[o.id] = r : this._otherSourceCaches[o.id] = r, r.onAdd(this.map); 46122 }; 46123 a(e1.bR.Other), "vector" !== i.type && "geojson" !== i.type || (a(e1.bR.Symbol), "vector" === i.type && a(e1.bR.FillExtrusion)), o.onAdd && o.onAdd(this.map), r && (async function(e1) { 46124 if (Do(e1)) return; 46125 const t1 = ko[e1]; 46126 if (!t1) throw new Error('Unknown source type "'.concat(e1, '"')); 46127 const i = await t1(); 46128 i && !Do(e1) && function(e1, t1) { 46129 Eo[e1] = t1; 46130 }(e1, i); 46131 }
46131)(i.type).then(()=>{ 46132 const s = Do(i.type), r = this._otherSourceCaches[t1]; 46133 if (!r || r.getSource() !== o) return; 46134 if (!s) return void this.fire(new e1.f(new Error('Could not load module for source type "'.concat(i.type, '".')))); 46135 const a = Io(t1, i, this.dispatcher, this); 46136 a.scope = this.scope, n(a), r.setSource(a), a.onAdd && a.onAdd(this.map), this._changes.setDirty(); 46137 }), s.isInitialLoad || (this.mergeSources(), this._changes.setDirty()); 46138 } 46139 removeSource(t1) { 46140 this._checkLoaded(); 46141 const i = this.getOwnSource(t1); 46142 if (!i) throw new Error("There is no source with this ID"); 46143 for(const i in this._layers)if (this._layers[i].source === t1) return this.fire(new e1.f(new Error('Source "'.concat(t1, '" cannot be removed while layer "').concat(i, '" is using it.')))); 46144 if (this.terrain && this.terrain.scope === this.scope && this.terrain.get().source === t1) return this.fire(new e1.f(new Error('Source "'.concat(t1, '" cannot be removed while terrain is using it.')))); 46145 if (this.stylesheet.iconsets) { 46146 const i = Object.entries(this.stylesheet.iconsets).find((param)=>{ 46147 let [e1, i] = param; 46148 return "source" === i.type && i.source === t1; 46149 }); 46150 if (i) return this.fire(new e1.f(new Error('Source "'.concat(t1, '" cannot be removed while iconset "').concat(i[0], '" is using it.')))); 46151 } 46152 const s = this.getOwnSourceCaches(t1); 46153 for (const t1 of s){ 46154 const i = e1.bV(t1.id); 46155 delete this._sourceCaches[i], this._changes.discardSourceCacheUpdate(t1.id), t1.fire(new e1.h("data", { 46156 sourceDataType: "metadata", 46157 dataType: "source", 46158 sourceId: t1.getSource().id 46159 })), t1.setEventedParent(null), t1.clearTiles(); 46160 } 46161 return delete this._otherSourceCaches[t1], delete this._symbolSourceCaches[t1], delete this._fillExtrusionSourceCaches[t1], this._hdCoverage && delete this._hdCoverage.coverageSourceCaches[t1], this._hdElevation && delete this._hdElevation.elevationSourceCaches[e1.m(t1, this.scope)], this.mergeSources(), i.setEventedParent(null), i.onRemove && i.onRemove(this.map), this.dispatcher.broadcast("removeSource", { 46162 type: i.type, 46163 source: t1, 46164 scope: i.scope 46165 }), this._changes.setDirty(), this; 46166 } 46167 setGeoJSONSourceData(e1, t1) { 46168 this._checkLoaded(), this.getOwnSource(e1).setData(t1), this._changes.setDirty(); 46169 } 46170 getOwnSource(e1) { 46171 const t1 = this.getOwnSourceCache(e1); 46172 return t1 && t1.getSource(); 46173 } 46174 getOwnSources() { 46175 const e1 = []; 46176 for(const t1 in this._otherSourceCaches){ 46177 const i = this.getOwnSourceCache(t1); 46178 i && e1.push(i.getSource()); 46179 } 46180 return e1; 46181 } 46182 areTilesLoaded() { 46183 const e1 = this._mergedSourceCaches; 46184 for(const t1 in e1){ 46185 const i = e1[t1]._tiles; 46186 for(const e1 in i){ 46187 const t1 = i[e1]; 46188 if ("loaded" !== t1.state && "errored" !== t1.state) return !1; 46189 } 46190 } 46191 return !0; 46192 } 46193 setLights(t1) { 46194 if (this._checkLoaded(), this._programPrecompiler && this._programPrecompiler.reset(), !t1) return delete this.ambientLight, void delete this.directionalLight; 46195 const i = this._getTransitionParameters(); 46196 for (const e1 of t1){ 46197 if (this._validate(Dt, "lights", e1)) return; 46198 switch(e1.type){ 46199 case "ambient": 46200 if (this.ambientLight) { 46201 const t1 = this.ambientLight; 46202 t1.set(e1), t1.updateTransitions(i); 46203 } else this.ambientLight = new ti(e1, si(), this.scope, this.options); 46204 break; 46205 case "directional": 46206 if (this.directionalLight) { 46207 const t1 = this.directionalLight; 46208 t1.set(e1), t1.updateTransitions(i); 46209 } else this.directionalLight = new ti(e1, oi(), this.scope, this.options); 46210 } 46211 } 46212 const s = Object.assign(i, { 46213 worldview: this.map.getWorldview() 46214 }), r = new e1.ai(this.z || 0, s); 46215 this.ambientLight && this.ambientLight.recalculate(r), this.directionalLight && this.directionalLight.recalculate(r), this._brightness = this.calculateLightsBrightness(), this.dispatcher.broadcast("upsertRenderParams", { 46216 brightness: this._brightness 46217 }); 46218 } 46219 calculateLightsBrightness() { 46220 const t1 = this.directionalLight, i = this.ambientLight; 46221 if (!t1 || !i) return; 46222 const s = (e1)=>.2126 * (e1[0] <= .03928 ? e1[0] / 12.92 : Math.pow((e1[0] + .055) / 1.055, 2.4)) + .7152 * (e1[1] <= .03928 ? e1[
462221] / 12.92 : Math.pow((e1[1] + .055) / 1.055, 2.4)) + .0722 * (e1[2] <= .03928 ? e1[2] / 12.92 : Math.pow((e1[2] + .055) / 1.055, 2.4)), r = t1.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(), o = t1.properties.get("intensity"), n = t1.properties.get("direction"), a = 1 - e1.b$(n.x, n.y, n.z)[2] / 90, l = s(r) * o * a, c = i.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(), h = i.properties.get("intensity"), d = s(c) * h; 46223 return Number(((l + d) / 2).toFixed(6)); 46224 } 46225 getBrightness() { 46226 return this._brightness; 46227 } 46228 getLights() { 46229 if (!this.enable3dLights()) return null; 46230 const e1 = []; 46231 return this.directionalLight && e1.push(this.directionalLight.get()), this.ambientLight && e1.push(this.ambientLight.get()), e1; 46232 } 46233 enable3dLights() { 46234 return !!this.ambientLight && !!this.directionalLight; 46235 } 46236 getFragmentStyle(t1) { 46237 if (null == t1 || "" === t1 && this.isRootStyle()) return this; 46238 if (e1.dF(t1)) { 46239 const i = e1.dG(t1), s = this.fragments.find((param)=>{ 46240 let { id: e1 } = param; 46241 return e1 === i; 46242 }); 46243 if (!s) return; 46244 const r = e1.bV(t1); 46245 return s.style.getFragmentStyle(r); 46246 } 46247 { 46248 const e1 = this.fragments.find((param)=>{ 46249 let { id: e1 } = param; 46250 return e1 === t1; 46251 }); 46252 return e1 ? e1.style : void 0; 46253 } 46254 } 46255 setFeaturesetSelectors(t1) { 46256 if (!t1) return; 46257 const i = function(e1) { 46258 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""; 46259 return "".concat(e1, "::").concat(t1); 46260 }; 46261 this._featuresetSelectors = {}; 46262 for(const s in t1){ 46263 const r = {}, o = this._featuresetSelectors[s] = []; 46264 for (const n of t1[s].selectors){ 46265 if (n.featureNamespace) { 46266 const t1 = this.getOwnLayer(n.layer); 46267 if (!t1) { 46268 e1.w("Layer is undefined for selector: ".concat(n.layer)); 46269 continue; 46270 } 46271 const o = i(t1.source, t1.sourceLayer); 46272 if (o in r && r[o] !== n.featureNamespace) { 46273 e1.w('"featureNamespace '.concat(n.featureNamespace, " of featureset ").concat(s, "'s selector is not associated to the same source, skip this selector")); 46274 continue; 46275 } 46276 r[o] = n.featureNamespace; 46277 } 46278 let t1; 46279 if (n.properties) for(const i in n.properties){ 46280 const s = e1.c(n.properties[i]); 46281 "success" === s.result && (t1 = t1 || {}, t1[i] = s.value); 46282 } 46283 o.push({ 46284 layerId: n.layer, 46285 namespace: n.featureNamespace, 46286 properties: t1, 46287 uniqueFeatureID: n._uniqueFeatureID 46288 }); 46289 } 46290 } 46291 } 46292 getFeaturesetDescriptors(e1) { 46293 const t1 = this.getFragmentStyle(e1); 46294 if (!t1 || !t1.stylesheet.featuresets) return []; 46295 const i = []; 46296 for(const e1 in t1.stylesheet.featuresets)i.push({ 46297 featuresetId: e1, 46298 importId: t1.scope ? t1.scope : void 0 46299 }); 46300 return i; 46301 } 46302 getFeaturesetLayers(t1, i) { 46303 const s = this.getFragmentStyle(i), r = s.stylesheet.featuresets; 46304 if (!r || !r[t1]) return this.fire(new e1.f(new Error("The featureset '".concat(t1, "' does not exist in the map's style and cannot be queried.")))
46304), []; 46305 const o = []; 46306 for (const e1 of r[t1].selectors){ 46307 const t1 = s.getOwnLayer(e1.layer); 46308 t1 && o.push(t1); 46309 } 46310 return o; 46311 } 46312 getConfigProperty(t1, i) { 46313 const s = this.getFragmentStyle(t1); 46314 if (!s) return null; 46315 const r = e1.m(i, s.scope), o = s.options.get(r), n = o ? o.value || o.default : null; 46316 return n ? n.serialize() : null; 46317 } 46318 isIndoorEnabled() { 46319 return this._indoorEnabled; 46320 } 46321 getIndoorSourceLayers(t1, i) { 46322 const s = e1.m(t1, i); 46323 return this._mergedIndoor[s]; 46324 } 46325 setIndoorData(e1, t1) { 46326 this.indoorManager && this.indoorManager.setIndoorData(t1); 46327 } 46328 updateIndoorDependentLayers() { 46329 this._updateLayers(this._dependentLayerIds((e1)=>e1.isIndoorDependent)), this.map._styleDirty = !0, this.map.triggerRepaint(); 46330 } 46331 setConfigProperty(t1, i, s) { 46332 const r = this.getFragmentStyle(t1); 46333 if (!r) return; 46334 const o = r.stylesheet.schema; 46335 if (!o || !o[i]) return; 46336 const n = e1.dH(s, o[i]); 46337 if ("success" !== n.result) return void zn(this, n.value); 46338 const a = n.value.expression, l = e1.m(i, r.scope), c = r.options.get(l); 46339 if (!c) return; 46340 let h; 46341 const { minValue: d, maxValue: u, stepValue: p, type: f, values: m } = o[i], _ = e1.dH(o[i].default, o[i]); 46342 "success" === _.result && (h = _.value.expression), h ? (this.options.set(l, { 46343 ...c, 46344 value: a, 46345 default: h, 46346 minValue: d, 46347 maxValue: u, 46348 stepValue: p, 46349 type: f, 46350 values: m 46351 }), this.updateConfigDependencies(i)) : this.fire(new e1.f(new Error('No schema defined for the config option "'.concat(i, '" in the "').concat(t1, '" fragment.')))); 46352 } 46353 getConfig(t1) { 46354 const i = this.getFragmentStyle(t1); 46355 if (!i) return null; 46356 const s = i.stylesheet.schema; 46357 if (!s) return null; 46358 const r = {}; 46359 for(const t1 in s){ 46360 const s = e1.m(t1, i.scope), o = i.options.get(s), n = o ? o.value || o.default : null; 46361 r[t1] = n ? n.serialize() : null; 46362 } 46363 return r; 46364 } 46365 setConfig(e1, t1) { 46366 const i = this.getFragmentStyle(e1); 46367 i && (i.updateConfig(t1, i.stylesheet.schema), this.updateConfigDependencies()); 46368 } 46369 getSchema(e1) { 46370 const t1 = this.getFragmentStyle(e1); 46371 return t1 ? t1.stylesheet.schema : null; 46372 } 46373 setSchema(e1, t1) { 46374 const i = this.getFragmentStyle(e1); 46375 i && (i.stylesheet.schema = t1, i.updateConfig(i._config, t1), this.updateConfigDependencies()); 46376 } 46377 updateConfig(t1, i) { 46378 if (this._config = t1, t1 || i) if (i) for(const s in i){ 46379 let r, o; 46380 const n = e1.dH(i[s].default, i[s]); 46381 if ("success" === n.result && (r = n.value.expression), t1 && void 0 !== t1[s]) { 46382 const r = e1.dH(t1[s], i[s]); 46383 "success" === r.result && (o = r.value.expression); 46384 } 46385 const { minValue: a, maxValue: l, stepValue: c, type: h, values: d } = i[s]; 46386 if (r) { 46387 const t1 = e1.m(s, this.scope); 46388 this.options.set(t1, { 46389 default: r, 46390 value: o, 46391 minValue: a, 46392 maxValue: l, 46393 stepValue: c, 46394 type: h, 46395 values: d 46396 }); 46397 }
46397 else this.fire(new e1.f(new Error('No schema defined for config option "'.concat(s, '".')))); 46398 } 46399 else this.fire(new e1.f(new Error("Attempting to set config for a style without schema."))); 46400 } 46401 _updateLayers(e1) { 46402 for (const t1 of e1){ 46403 const e1 = this.getLayer(t1); 46404 e1 && (e1.possiblyEvaluateVisibility(), this._updateLayer(e1), this._changes.setDirty()); 46405 } 46406 } 46407 _dependentLayerIds(e1) { 46408 const t1 = []; 46409 for (const [i, s] of this._layerExpressionDependencies)e1(s) && t1.push(i); 46410 return t1; 46411 } 46412 updateConfigDependencies(e1) { 46413 this._updateLayers(this._dependentLayerIds((t1)=>e1 ? t1.hasConfigDependency(e1) : t1.isConfigDependent)), this.ambientLight && this.ambientLight.updateConfig(this.options), this.directionalLight && this.directionalLight.updateConfig(this.options), this.fog && this.fog.updateConfig(this.options), this.snow && this.snow.updateConfig(this.options), this.rain && this.rain.updateConfig(this.options), this.forEachFragmentStyle((e1)=>{ 46414 const t1 = e1._styleColorTheme.colorThemeOverride ? e1._styleColorTheme.colorThemeOverride : e1._styleColorTheme.colorTheme; 46415 if (t1) { 46416 const i = e1._evaluateColorThemeData(t1); 46417 (!e1._styleColorTheme.lut && "" !== i || e1._styleColorTheme.lut && i !== e1._styleColorTheme.lut.data) && e1.setColorTheme(t1); 46418 } 46419 }), this._updateIndoorEnabled(), this._changes.setDirty(); 46420 } 46421 addLayer(t1, i) { 46422 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 46423 this._checkLoaded(); 46424 const r = t1.id; 46425 if (this._layers[r]) return void this.fire(new e1.f(new Error('Layer with i
46425d "'.concat(r, '" already exists on this map')))); 46426 let o; 46427 if ("custom" === t1.type) { 46428 if (zn(this, e1.dI(t1))) return; 46429 o = e1.dJ(t1, this.scope, this._styleColorTheme.lut, this.options); 46430 } else { 46431 if ("object" == typeof t1.source && (this.addSource(r, t1.source), t1 = e1.dE(t1), t1 = Object.assign(t1, { 46432 source: r 46433 })), this._validate(Mt, "layers.".concat(r), t1, { 46434 arrayIndex: -1 46435 }, s)) return; 46436 o = e1.dJ(t1, this.scope, this._styleColorTheme.lut, this.options), this._validateLayer(o), o.setEventedParent(this, { 46437 layer: { 46438 id: r 46439 } 46440 }); 46441 } 46442 this._layerExpressionDependencies.set(o.fqid, new x(o)); 46443 let n = this._order.length; 46444 if (i) { 46445 const t1 = this._order.indexOf(i); 46446 if (-1 === t1) return void this.fire(new e1.f(new Error('Layer with i
46446d "'.concat(i, '" does not exist on this map.')))); 46447 o.slot && o.slot !== this._layers[i].slot ? e1.w('Layer with id "'.concat(i, '" has a different slot. Layers can only be rearranged within the same slot.')) : n = t1; 46448 } 46449 this._order.splice(n, 0, r), this._handleLayerOrderChange(), this._layers[r] = o; 46450 const a = this.getOwnLayerSourceCache(o), l = !!this.directionalLight && this.directionalLight.shadowsEnabled(); 46451 a && o.canCastShadows() && l && (a.castsShadows = !0); 46452 const c = this._changes.getRemovedLayer(o); 46453 if (c && o.source && a && "custom" !== o.type) { 46454 this._changes.discardLayerRemoval(o); 46455 const t1 = e1.m(o.source, o.scope); 46456 c.type !== o.type ? this._changes.updateSourceCache(t1, "clear") : (this._changes.updateSourceCache(t1, "reload"), a.pause()); 46457 } 46458 this._updateLayer(o), o.onAdd && o.onAdd(this.map), o.scope = this.scope, this.mergeLayers(); 46459 } 46460 moveLayer(t1, i) { 46461 this._checkLoaded(); 46462 const s = this._checkLayer(t1); 46463 if (!s) return; 46464 if (t1 === i) return; 46465 const r = this._order.indexOf(t1); 46466 this._order.splice(r, 1); 46467 let o = this._order.length; 46468 if (i) { 46469 const t1 = this._order.indexOf(i); 46470 if (-1 === t1) return void this.fire(new e1.f(new Error('Layer with i
vendor: 15,544 bytes, lines 46470-46765
46470d "'.concat(i, '" does not exist on this map.')))); 46471 s.slot && s.slot !== this._layers[i].slot ? e1.w('Layer with id "'.concat(i, '" has a different slot. Layers can only be rearranged within the same slot.')) : o = t1; 46472 } 46473 this._order.splice(o, 0, t1), this._changes.setDirty(), this._handleLayerOrderChange(), this.mergeLayers(); 46474 } 46475 removeLayer(e1) { 46476 this._checkLoaded(); 46477 const t1 = this._checkLayer(e1); 46478 if (!t1) return; 46479 t1.setEventedParent(null); 46480 const i = this._order.indexOf(e1); 46481 this._order.splice(i, 1), delete this._layers[e1], this._changes.setDirty(), this._handleLayerOrderChange(), this._layerExpressionDependencies.delete(t1.fqid), this._changes.removeLayer(t1); 46482 const s = this.getOwnLayerSourceCache(t1); 46483 if (s && s.castsShadows) { 46484 let e1 = !1; 46485 for(const i in this._layers)if (this._layers[i].source === t1.source && this._layers[i].canCastShadows()) { 46486 e1 = !0; 46487 break; 46488 } 46489 s.castsShadows = e1; 46490 } 46491 t1.onRemove && t1.onRemove(this.map), this.mergeLayers(); 46492 } 46493 getOwnLayer(e1) { 46494 return this._layers[e1]; 46495 } 46496 hasLayer(e1) { 46497 return e1 in this._mergedLayers; 46498 } 46499 hasLayerType(e1) { 46500 for(const t1 in this._layers)if (this._layers[t1].type === e1) return !0; 46501 return !1; 46502 } 46503 setLayerZoomRange(e1, t1, i) { 46504 this._checkLoaded(); 46505 const s = this._checkLayer(e1); 46506 s && (s.minzoom === t1 && s.maxzoom === i || (null != t1 && (s.minzoom = t1), null != i && (s.maxzoom = i), this._updateLayer(s))); 46507 } 46508 getSlots() { 46509 return this._checkLoaded(), this._mergedSlots; 46510 } 46511 setSlot(e1, t1) { 46512 this._checkLoaded(); 46513 const i = this._checkLayer(e1); 46514 i && i.slot !== t1 && (i.slot = t1, this._updateLayer(i)); 46515 } 46516 setFilter(t1, i) { 46517 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 46518 this._checkLoaded(); 46519 const r = this._checkLayer(t1); 46520 if (!r) return; 46521 if (e1.O(r.filter, i)) return; 46522 const o = this._layerExpressionDependencies.get(r.fqid); 46523 if (null == i) return r.filter = void 0, o && o.invalidateFilter(), void this._updateLayer(r); 46524 this._validate(Ot, "layers.".concat(r.id, ".filter"), i, { 46525 layerType: r.type 46526 }, s) || (r.filter = e1.dE(i), o && o.invalidateFilter(), this._updateLayer(r)); 46527 } 46528 getFilter(t1) { 46529 const i = this._checkLayer(t1); 46530 if (i) return e1.dE(i.filter); 46531 } 46532 setLayoutProperty(t1, i, s) { 46533 let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; 46534 this._checkLoaded(); 46535 const o = this._checkLayer(t1); 46536 if (o && !e1.O(o.getLayoutProperty(i), s)) { 46537 if (null != s && (!r || !1 !== r.validate) && zn(o, kt.call(Ct, { 46538 key: "layers.".concat(t1, ".layout.").concat(i), 46539 layerType: o.type, 46540 objectKey: i, 46541 value: s, 46542 styleSpec: e1.s, 46543 style: { 46544 glyphs: !0, 46545 sprite: !0 46546 } 46547 }))) return; 46548 o.setLayoutProperty(i, s), this._updateLayer(o); 46549 } 46550 } 46551 getLayerProperty(e1, t1) { 46552 const i = this._checkLayer(e1); 46553 if (i) { 46554 switch(t1){ 46555 case "minzoom": 46556 return i.minzoom; 46557 case "maxzoom": 46558 return i.maxzoom; 46559 case "filter": 46560 return this.getFilter(e1); 46561 case "slot": 46562 return i.slot; 46563 case "appearances": 46564 return i.getAppearances().map((e1)=>e1.serialize()); 46565 } 46566 return i.isPaintProperty(t1) ? this.getPaintProperty(e1, t1) : this.getLayoutProperty(e1, t1); 46567 } 46568 } 46569 setLayerProperty(e1, t1, i) { 46570 let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; 46571 this._checkLoaded(); 46572 const r = this._checkLayer(e1); 46573 if (r) { 46574 switch(t1){ 46575 case "appearances": 46576 return r.setAppearances(i), void this._updateLayer(r); 46577 case "minzoom": 46578 return this.setLayerZoomRange(e1, i); 46579 case "maxzoom": 46580 return this.setLayerZoomRange(e1, null, i); 46581 case "filter": 46582 return this.setFilter(e1, i, s); 46583 case "slot": 46584 return this.setSlot(e1, i); 46585 } 46586 r.isPaintProperty(t1) ? this.setPaintProperty(e1, t1, i, s) : this.setLayoutProperty(e1, t1, i, s); 46587 } 46588 } 46589 getLayoutProperty(e1, t1) { 46590 const i = this._checkLayer(e1); 46591 if (i) return i.getLayoutProperty(t1); 46592 } 46593 setPaintProperty(t1, i, s) { 46594 let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; 46595 this._checkLoaded(); 46596 const o = this._checkLayer(t1); 46597 o && (e1.O(o.getPaintProperty(i), s) || (null == s || r && !1 === r.validate || !zn(o, Ft.call(Ct, { 46598 key: "layers.".concat(t1, ".paint.").concat(i), 46599 layerType: o.type, 46600 objectKey: i, 46601 value: s, 46602 styleSpec: e1.s 46603 }))) && (o.setPaintProperty(i, s) && this._updateLayer(o), this._changes.updatePaintProperties(o))); 46604 } 46605 getPaintProperty(e1, t1) { 46606 const i = this._checkLayer(e1); 46607 if (i) return i.getPaintProperty(t1); 46608 } 46609 setFeatureState(t1, i) { 46610 if (this._checkLoaded(), "target" in t1) { 46611 if ("featuresetId" in t1.target) { 46612 const { featuresetId: e1, importId: s } = t1.target, r = this.getFragmentStyle(s), o = r.getFeaturesetLayers(e1); 46613 for (const { source: e1, sourceLayer: s } of o)r.setFeatureState({ 46614 id: t1.id, 46615 source: e1, 46616 sourceLayer: s 46617 }, i); 46618 } else if ("layerId" in t1.target) { 46619 const e1 = this._resolveLayerFragment(t1.target.layerId); 46620 e1 === null || e1 === void 0 ? void 0 : e1.fragment.setFeatureState({ 46621 id: t1.id, 46622 source: e1.layer.source, 46623 sourceLayer: e1.layer.sourceLayer 46624 }, i); 46625 } 46626 return; 46627 } 46628 const s = t1.source, r = t1.sourceLayer, o = this._checkSource(s); 46629 if (!o) return; 46630 const n = o.type; 46631 if ("geojson" === n && r) return void this.fire(new e1.f(new Error("GeoJSON sources cannot have a sourceLayer parameter."))); 46632 if ("vector" === n && !r) return void this.fire(new e1.f(new Error("The sourceLayer parameter must be provided for vector source types."))); 46633 void 0 === t1.id && this.fire(new e1.f(new Error("The feature id parameter must be provided."))); 46634 const a = this.getOwnSourceCaches(s); 46635 for (const e1 of a)e1.setFeatureState(r, t1.id, i); 46636 } 46637 removeFeatureState(t1, i) { 46638 if (this._checkLoaded(), "target" in t1) { 46639 if ("featuresetId" in t1.target) { 46640 const { featuresetId: e1, importId: s } = t1.target, r = this.getFragmentStyle(s), o = r.getFeaturesetLayers(e1); 46641 for (const { source: e1, sourceLayer: s } of o)r.removeFeatureState({ 46642 id: t1.id, 46643 source: e1, 46644 sourceLayer: s 46645 }, i); 46646 } else if ("layerId" in t1.target) { 46647 const e1 = this._resolveLayerFragment(t1.target.layerId); 46648 e1 === null || e1 === void 0 ? void 0 : e1.fragment.removeFeatureState({ 46649 id: t1.id, 46650 source: e1.layer.source, 46651 sourceLayer: e1.layer.sourceLayer 46652 }, i); 46653 } 46654 return; 46655 } 46656 const s = t1.source, r = this._checkSource(s); 46657 if (!r) return; 46658 const o = r.type, n = "vector" === o ? t1.sourceLayer : void 0; 46659 if ("vector" === o && !n) return void this.fire(new e1.f(new Error("The sourceLayer parameter must be provided for vector source types."))); 46660 if (i && "string" != typeof t1.id && "number" != typeof t1.id) return void this.fire(new e1.f(new Error("A feature id is required to remove its specific state property."))); 46661 const a = this.getOwnSourceCaches(s); 46662 for (const e1 of a)e1.removeFeatureState(n, t1.id, i); 46663 } 46664 getFeatureState(t1) { 46665 if (this._checkLoaded(), "target" in t1) { 46666 let i; 46667 if ("featuresetId" in t1.target) { 46668 const { featuresetId: s, importId: r } = t1.target, o = this.getFragmentStyle(r), n = o.getFeaturesetLayers(s); 46669 for (const { source: s, sourceLayer: r } of n){ 46670 const n = o.getFeatureState({ 46671 id: t1.id, 46672 source: s, 46673 sourceLayer: r 46674 }); 46675 if (n && !i) i = n; 46676 else if (!e1.O(i, n)) return void this.fire(new e1.f(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources."))); 46677 } 46678 } else if ("layerId" in t1.target) { 46679 const e1 = this._resolveLayerFragment(t1.target.layerId); 46680 i = e1 === null || e1 === void 0 ? void 0 : e1.fragment.getFeatureState({ 46681 id: t1.id, 46682 source: e1.layer.source, 46683 sourceLayer: e1.layer.sourceLayer 46684 }); 46685 } 46686 return i; 46687 } 46688 const i = t1.source, s = t1.sourceLayer, r = this._checkSource(i); 46689 if (r) { 46690 if ("vector" !== r.type || s) return void 0 === t1.id && this.fire(new e1.f(new Error("The feature id parameter must be provided."))), this.getOwnSourceCaches(i)[0].getFeatureState(s, t1.id); 46691 this.fire(new e1.f(new Error("The sourceLayer parameter must be provided for vector source types."))); 46692 } 46693 } 46694 resetFeatureStates(e1) { 46695 if (this._checkLoaded(), "featuresetId" in e1) { 46696 const { featuresetId: t1, importId: i } = e1, s = this.getFragmentStyle(i); 46697 if (!s) return; 46698 const r = s.getFeaturesetLayers(t1); 46699 for (const { source: e1, sourceLayer: t1 } of r)s.removeFeatureState({ 46700 source: e1, 46701 sourceLayer: t1 46702 }); 46703 } else { 46704 const t1 = this._resolveLayerFragment(e1.layerId); 46705 t1 === null || t1 === void 0 ? void 0 : t1.fragment.removeFeatureState({ 46706 source: t1.layer.source, 46707 sourceLayer: t1.layer.sourceLayer 46708 }); 46709 } 46710 } 46711 setTransition(e1) { 46712 return this.stylesheet.transition = { 46713 ...this.stylesheet.transition, 46714 ...e1 46715 }, this.transition = this.stylesheet.transition, this; 46716 } 46717 getTransition() { 46718 return { 46719 ...this.stylesheet.transition 46720 }; 46721 } 46722 setWorldview(e1) { 46723 e1 !== this._worldview && (this._worldview = e1, this.dispatcher.broadcast("upsertRenderParams", { 46724 worldview: this._worldview 46725 }), this.reloadSources()); 46726 } 46727 serialize() { 46728 this._checkLoaded(); 46729 const t1 = this.getTerrain(), i = t1 && this.terrain && this.terrain.scope === this.scope ? t1 : this.stylesheet.terrain; 46730 return e1.dK({ 46731 version: this.stylesheet.version, 46732 name: this.stylesheet.name, 46733 metadata: this.stylesheet.metadata, 46734 fragment: this.stylesheet.fragment, 46735 iconsets: this.stylesheet.iconsets, 46736 featuresets: this.stylesheet.featuresets, 46737 imports: this._serializeImports(), 46738 schema: this.stylesheet.schema, 46739 camera: this.stylesheet.camera, 46740 light: this.stylesheet.light, 46741 lights: this.stylesheet.lights, 46742 terrain: i, 46743 fog: this.stylesheet.fog, 46744 snow: this.stylesheet.snow, 46745 rain: this.stylesheet.rain, 46746 indoor: this.stylesheet.indoor, 46747 center: this.stylesheet.center, 46748 "color-theme": this.stylesheet["color-theme"], 46749 zoom: this.stylesheet.zoom, 46750 bearing: this.stylesheet.bearing, 46751 pitch: this.stylesheet.pitch, 46752 sprite: this.stylesheet.sprite, 46753 glyphs: this.stylesheet.glyphs, 46754 transition: this.stylesheet.transition, 46755 projection: this.stylesheet.projection, 46756 sources: this._serializeSources(), 46757 layers: this._serializeLayers(this._order) 46758 }, (e1)=>void 0 !== e1); 46759 } 46760 _updateFilteredLayers(e1) { 46761 for (const t1 of Object.values(this._mergedLayers))e1(t1) && this._updateLayer(t1); 46762 } 46763 _updateLayer(t1) { 46764 this._changes.updateLayer(t1); 46765 const i = this.getLayerSourceCache(t1), s = e1.m(t1.source, t1.scope), r = this._changes.getUpd
46765atedSourceCaches(); 46766 t1.source && !r[s] && i && "raster" !== i.getSource().type && (this._changes.updateSourceCache(s, "reload"), i.pause()), t1.invalidateCompiledFilter(); 46767 } 46768 _flattenAndSortRenderedFeatures(e1) { 46769 const t1 = (e1)=>this._mergedLayers[e1].is3D(!!this.terrain), i = this.order, s = {}, r = []; 46770 for(let o = i.length - 1; o >= 0; o--){ 46771 const n = i[o]; 46772 if (t1(n)) { 46773 s[n] = o; 46774 for (const t1 of e1){ 46775 const e1 = t1[n]; 46776 if (e1) for (const t1 of e1)r.push(t1); 46777 } 46778 } 46779 } 46780 r.sort((e1, t1)=>t1.intersectionZ - e1.intersectionZ); 46781 const o = []; 46782 for(let n = i.length - 1; n >= 0; n--){ 46783 const a = i[n]; 46784 if (t1(a)) for(let e1 = r.length - 1; e1 >= 0; e1--){ 46785 const t1 = r[e1].feature; 46786 if (t1.layer && s[t1.layer.id] < n) break; 46787 o.push(t1), r.pop(); 46788 } 46789 else for (const t1 of e1){ 46790 const e1 = t1[a]; 46791 if (e1) for (const t1 of e1)o.push(t1.feature); 46792 } 46793 } 46794 return o; 46795 } 46796 queryRasterValue(t1, i, s) { 46797 const r = this.getOwnSource(t1); 46798 return r ? "raster-array" !== r.type ? (this.fire(new e1.f(new Error('queryRasterValue support only "raster-array" sources.'))), Promise.resolve(null)) : r.queryRasterArrayValue(i, s) : (this.fire(new e1.f(new Error('Source with id "'.concat(t1, '" does not exist in the style.')))), Promise.resolve(null)); 46799 } 46800 queryRenderedFeatures(t1, i, s) { 46801 let r; 46802 i && !Array.isArray(i) && i.filter && (this._validate(Ot, "queryRenderedFeatures.filter", i.filter, null, i), r = e1.bv(i.filter)); 46803 const o = {}, n = (e1)=>{ 46804 if (jn.has(e1.type)) return; 46805 const t1 = this.getOwnLayerSourceCache(e1), i = o[t1.id] = o[t1.id] || { 46806 sourceCache: t1, 46807 layers: {}, 46808 has3DLayers: !1 46809 }; 46810 e1.is3D(!!this.terrain) && (i.has3DLayers = !0), i.layers[e1.fqid] = i.layers[e1.fqid] || { 46811 styleLayer: e1, 46812 targets: [] 46813 }, i.layers[e1.fqid].targets.push({ 46814 filter: r 46815 }); 46816 }; 46817 if (i && i.layers) { 46818 if (!Array.isArray(i.layers)) return this.fire(new e1.f(new Error("parameters.layers must be an Array."))), []; 46819 for (const t1 of i.layers){ 46820 const i = this._layers[t1]; 46821 if (!i) return this.fire(new e1.f(new Error("The layer '".concat(t1, "' does not exist in the map's style and cannot be queried for features.")))), []; 46822 n(i); 46823 } 46824 } else for(const e1 in this._layers)n(this._layers[e1]); 46825 const a = this._queryRenderedFeatures(t1, o, s), l = this._flattenAndSortRenderedFeatures(a), c = []; 46826 for (const t1 of l)e1.bW(t1.layer.id) === this.scope && c.push(t1); 46827 return c; 46828 } 46829 queryRenderedFeatureset(t1, i, s) { 46830 let r; 46831 i && !Array.isArray(i) && i.filter && (this._validate(Ot, "queryRenderedFeatures.filter", i.filter, null, i), r = e1.bv(i.filter)); 46832 const o = "mock", n = []; 46833 if (i && i.target) n.push({ 46834 ...i, 46835 targetId: o, 46836 filter: r 46837 }); 46838 else { 46839 const e1 = this.getFeaturesetDescriptors(); 46840 for (const t1 of e1)n.push({ 46841 targetId: o, 46842 filter: r, 46843 target: t1 46844 }); 46845 for (const { style: e1 } of this.fragments){ 46846 const t1 = e1.getFeaturesetDescriptors(); 46847 for (const e1 of t1)n.push({ 46848 targetId: o, 46849 filter: r, 46850 target: e1 46851 }); 46852 } 46853 } 46854 const a = this.queryRenderedTargets(t1, n, s), l = [], c = new Set; 46855 for (const t1 of a)for (const i of t1.variants[o])Uo(i, t1, c) || l.push(new e
468551.dL(t1, i)); 46856 return l; 46857 } 46858 queryRenderedTargets(t1, i, s) { 46859 const r = {}, o = (e1, t1, i, s)=>{ 46860 const o = r[t1.id] = r[t1.id] || { 46861 sourceCache: t1, 46862 layers: {}, 46863 has3DLayers: !1 46864 }; 46865 if (o.layers[e1.fqid] = o.layers[e1.fqid] || { 46866 styleLayer: e1, 46867 targets: [] 46868 }, e1.is3D(!!this.terrain) && (o.has3DLayers = !0), !s) return i.uniqueFeatureID = !1, void o.layers[e1.fqid].targets.push(i); 46869 o.layers[e1.fqid].targets.push({ 46870 ...i, 46871 namespace: s.namespace, 46872 properties: s.properties, 46873 uniqueFeatureID: s.uniqueFeatureID 46874 }); 46875 }; 46876 for (const t1 of i)if ("featuresetId" in t1.target) { 46877 const { featuresetId: i, importId: s } = t1.target, r = this.getFragmentStyle(s); 46878 if (!r || !r._featuresetSelectors) continue; 46879 const n = r._featuresetSelectors[i]; 46880 if (!n) { 46881 this.fire(new e1.f(new Error("The featureset '".concat(i, "' does not exist in the map's style and cannot be queried for features.")))); 46882 continue; 46883 } 46884 for (const e1 of n){ 46885 const i = r.getOwnLayer(e1.layerId); 46886 i && !jn.has(i.type) && o(i, r.getOwnLayerSourceCache(i), t1, e1); 46887 } 46888 } else if ("layerId" in t1.target) { 46889 const { layerId: e1 } = t1.target, i = this.getLayer(e1); 46890 if (!i || jn.has(i.type)) continue; 46891 o(i, this.getLayerSourceCache(i), t1); 46892 } 46893 const n = this._queryRenderedFeatures(t1, r, s); 46894 return this._flattenAndSortRenderedFeatures(n); 46895 } 46896 _queryRenderedFeatures(t1, i, s) { 46897 const r = [], o = !!this.map._showQueryGeometry, n = go.createFromScreenPoints(t1, s); 46898 for(const e1 in i){ 46899 const t1 = No(n, i[e1], this._availableImages, s, o, this.getActualScope()); 46900 Object.keys(t1).length && r.push(t1); 46901 } 46902 if (this.placement) for(const t1 in i){ 46903 if (i[t1].sourceCache._renderSourceType !== e1.bR.Symbol) continue; 46904 const s = jo(n.screenGeometry, i[t1], this._availableImages, this.placement.collisionIndex, this.placement.retainedQueryData, this.map.getWorldview()); 46905 Object.keys(s).length && r.push(s); 46906 } 46907 return r; 46908 } 46909 querySourceFeatures(e1, t1) { 46910 const i = t1 && t1.filter; 46911 i && this._validate(Ot, "querySourceFeatures.filter", i, null, t1); 46912 let s = []; 46913 const r = this.getOwnSourceCaches(e1); 46914 for (const e1 of r)s = s.concat(Vo(e1, t1)); 46915 return s; 46916 } 46917 getFlatLight() { 46918 return this.light.getLight(); 46919 } 46920 setFlatLight(t1, i) { 46921 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 46922 this._checkLoaded(); 46923 const r = this.light.getLight(); 46924 let o = !1; 46925 for(const i in t1)if (!e1.O(t1[i], r[i])) { 46926 o = !0; 46927 break; 46928 } 46929 if (!o) return; 46930 const n = this._getTransitionParameters(); 46931 this.light.setLight(t1, i, s), this.light.updateTransitions(n); 46932 } 46933 hasTerrain() { 46934 return !!this.terrain && 1 === this.terrain.drapeRenderMode; 46935 } 46936 getTerrain() { 46937 return this.hasTerrain() ? this.terrain.get() : null; 46938 } 46939 _startLiteLoad() { 46940 void 0 === this._drapingLoaded && (this._drapingLoaded = !1, (async function() { 46941 return Promise.resolve(); 46942 })().then(()=>{ 46943 this._drapingLoaded = !0, this.map._removed || 0 === this.dispatcher.actors.length || this.map.triggerRepaint(); 46944 })); 46945 } 46946 setTerrainForDraping() { 46947 this._startLiteLoad(), this.setTerrain({ 46948 source: "", 46949 exaggeration: 0 46950 }, 0); 46951 } 46952 checkCanvasFingerprintNoise() { 46953 void 0 === this.disableElevatedTerrain && (this.disableElevatedTerrain = e1.e.hasCanvasFingerprintNoise(), this.disableElevatedTerrain && e1.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode).")); 46954 } 46955 setTerrain(t1) { 46956 let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1; 46957 if (this._checkLoaded(), !t1) return this.terrainSetForDrapingOnly() || (delete this.terrain, this.map.transform.projection.requiresDraping && this.setTerrainForDraping()), 0 === i && delete this.terrain, null === t1 ? this.stylesheet.terrain = null : delete this.stylesheet.terrain, this._force3DLayerUpdate(), void (this._markersNeedU
vendor: 8,284 bytes, lines 46957-47125
46957pdate = !0); 46958 this.checkCanvasFingerprintNoise(); 46959 let s = t1; 46960 const r = !("source" in t1) || null == t1.source; 46961 if (1 === i) { 46962 if (this._startLiteLoad(), this.disableElevatedTerrain) return; 46963 if ("source" in s && "object" == typeof s.source) { 46964 const t1 = "terrain-dem-src"; 46965 this.addSource(t1, s.source), s = e1.dE(s), s = Object.assign(s, { 46966 source: t1 46967 }); 46968 } 46969 const t1 = { 46970 ...s 46971 }, i = {}; 46972 if (this.terrain && r) { 46973 t1.source = this.terrain.get().source; 46974 const e1 = this.terrain ? this.getFragmentStyle(this.terrain.scope) : null; 46975 e1 && (i.style = e1.serialize()); 46976 } 46977 if (this._validate(Pt, "terrain", t1, i)) return; 46978 } 46979 if (!this.terrain || this.terrain.scope !== this.scope && !r || this.terrain && i !== this.terrain.drapeRenderMode) { 46980 if (!s) return; 46981 this._createTerrain(s, i), this.fire(new e1.h("data", { 46982 dataType: "style" 46983 })); 46984 } else { 46985 const i = this.terrain, r = i.get(); 46986 for (const t1 of Object.keys(e1.s.terrain))!Object.hasOwn(s, t1) && e1.s.terrain[t1].default && (s[t1] = e1.s.terrain[t1].default); 46987 for(const s in t1)if (!e1.O(t1[s], r[s])) { 46988 i.set(t1, this.options), this.stylesheet.terrain = t1; 46989 const s = this._getTransitionParameters({ 46990 duration: 0 46991 }); 46992 i.updateTransitions(s), this.fire(new e1.h("data", { 46993 dataType: "style" 46994 })); 46995 break; 46996 } 46997 } 46998 this.mergeTerrain(), this.updateDrapeFirstLayers(), this._markersNeedUpdate = !0; 46999 } 47000 _createFog(e1) { 47001 const t1 = this.fog = new Zt(e1, this.map.transform, this.scope, this.options); 47002 this.stylesheet.fog = t1.get(); 47003 const i = this._getTransitionParameters({ 47004 duration: 0 47005 }); 47006 t1.updateTransitions(i); 47007 } 47008 _createSnow(e1) { 47009 const t1 = this.snow = new Wt(e1, this.map.transform, this.scope, this.options); 47010 this.stylesheet.snow = t1.get(); 47011 const i = this._getTransitionParameters({ 47012 duration: 0 47013 }); 47014 t1.updateTransitions(i); 47015 } 47016 _createRain(e1) { 47017 const t1 = this.rain = new Xt(e1, this.map.transform, this.scope, this.options); 47018 this.stylesheet.rain = t1.get(); 47019 const i = this._getTransitionParameters({ 47020 duration: 0 47021 }); 47022 t1.updateTransitions(i); 47023 } 47024 _updateMarkersOpacity() { 47025 0 !== this.map._markers.length && this.map._requestDomTask(()=>{ 47026 for (const e1 of this.map._markers)e1._evaluateOpacity(); 47027 }); 47028 } 47029 getFog() { 47030 return this.fog ? this.fog.get() : null; 47031 } 47032 setFog(t1) { 47033 if (this._checkLoaded(), t1) if (this.fog) { 47034 const i = this.fog; 47035 if (!e1.O(i.get(), t1)) { 47036 i.set(t1, this.options), this.stylesheet.fog = i.get(); 47037 const e1 = this._getTransitionParameters({ 47038 duration: 0 47039 }); 47040 i.updateTransitions(e1); 47041 } 47042 } else this._createFog(t1); 47043 else delete this.fog, delete this.stylesheet.fog; 47044 this._markersNeedUpdate = !0, this._programPrecompiler && this._programPrecompiler.reset(); 47045 } 47046 getSnow() { 47047 return this.snow ? this.snow.get() : null; 47048 } 47049 setSnow(t1) { 47050 if (this._checkLoaded(), !t1) return delete this.snow, void delete this.stylesheet.snow; 47051 if (this.snow) { 47052 const i = this.snow; 47053 if (!e1.O(i.get(), t1)) { 47054 i.set(t1, this.options), this.stylesheet.snow = i.get(); 47055 const e1 = this._getTransitionParameters({ 47056 duration: 0 47057 }); 47058 i.updateTransitions(e1); 47059 } 47060 } else this._createSnow(t1); 47061 this._markersNeedUpdate = !0; 47062 } 47063 getRain() { 47064 return this.rain ? this.rain.get() : null; 47065 } 47066 setRain(t1) { 47067 if (this._checkLoaded(), !t1) return delete this.rain, void delete this.stylesheet.rain; 47068 if (this.rain) { 47069 const i = this.rain; 47070 if (!e1.O(i.get(), t1)) { 47071 i.set(t1, this.options), this.stylesheet.rain = i.get(); 47072 const e1 = this._getTransitionParameters({ 47073 duration: 0 47074 }); 47075 i.updateTransitions(e1); 47076 } 47077 } else this._createRain(t1); 47078 this._markersNeedUpdate = !0; 47079 } 47080 _reloadColorTheme() { 47081 const t1 = ()=>{ 47082 for(const e1 in this._layers)this._layers[e1].lut = this._styleColorTheme.lut; 47083 for(const e1 in this._sourceCaches)this._sourceCaches[e1].clearTiles(); 47084 }, i = this._styleColorTheme.colorThemeOverride ? this._styleColorTheme.colorThemeOverride : this._styleColorTheme.colorTheme; 47085 if (!i) return this._styleColorTheme.lut = null, void t1(); 47086 const s = this._evaluateColorThemeData(i); 47087 this._loadColorTheme(s).then(()=>{ 47088 this.fire(new e1.h("colorthemeset")), t1(); 47089 }).catch((t1)=>{ 47090 e1.w("Couldn't set color theme: ".concat(t1)); 47091 }); 47092 } 47093 setColorTheme(t1) { 47094 this._checkLoaded(), this._styleColorTheme.colorThemeOverride && e1.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."), this._styleColorTheme.colorTheme = t1, this._reloadColorTheme(); 47095 } 47096 setImportColorTheme(e1, t1) { 47097 const i = this.getFragmentStyle(e1); 47098 i && (i._styleColorTheme.colorThemeOverride = t1, i._reloadColorTheme()); 47099 } 47100 _getTransitionParameters(t1) { 47101 return { 47102 now: e1.e.now(), 47103 transition: Object.assign(this.transition, t1) 47104 }; 47105 } 47106 updateDrapeFirstLayers() { 47107 if (!this.terrain) return; 47108 const e1 = [], t1 = []; 47109 for (const i of this._mergedOrder)this.isLayerDraped(this._mergedLayers[i]) ? e1.push(i) : t1.push(i); 47110 this._drapedFirstOrder = [], this._drapedFirstOrder.push(...e1), this._drapedFirstOrder.push(...t1); 47111 } 47112 _createTerrain(e1, t1) { 47113 const i = this.terrain = new Vt(e1, t1, this.scope, this.options, this.map.getWorldview()); 47114 1 === t1 && (this.stylesheet.terrain = e1), this.mergeTerrain(), this.updateDrapeFirstLayers(), this._force3DLayerUpdate(); 47115 const s = this._getTransitionParameters({ 47116 duration: 0 47117 }); 47118 i.updateTransitions(s); 47119 } 47120 _force3DLayerUpdate() { 47121 for(const e1 in this._layers){ 47122 const t1 = this._layers[e1]; 47123 "fill-extrusion" === t1.type && this._updateLayer(t1); 47124 } 47125 }
47126 _forceSymbolLayerUpdate() { 47127 for(const e1 in this._layers){ 47128 const t1 = this._layers[e1]; 47129 "symbol" === t1.type && this._updateLayer(t1); 47130 } 47131 } 47132 _validate(t1, i, s, r) { 47133 let o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {}; 47134 if (o && !1 === o.validate) return !1; 47135 const n = { 47136 ...this.serialize() 47137 }; 47138 return zn(this, t1.call(Ct, { 47139 key: i, 47140 style: n, 47141 value: s, 47142 styleSpec: e1.s, 47143 ...r 47144 })); 47145 } 47146 _remove() { 47147 this._programPrecompiler && (this._programPrecompiler.reset(), this._programPrecompiler = null), this._request && (this._request.cancel(), this._request = null), this._spriteRequest && (this._spriteRequest.abort(), this._spriteRequest = null), e1.dM.off("pluginStateChange", this._rtlTextPluginCallback); 47148 for(const e1 in this._mergedLayers)this._mergedLayers[e1].setEventedParent(null); 47149 for(const e1 in this._mergedSourceCaches){ 47150 const t1 = this._mergedSourceCaches[e1]; 47151 t1.clearTiles(), t1.setEventedParent(null); 47152 const i = t1.getSource(); 47153 i && i.onRemove && i.onRemove(this.map); 47154 } 47155 this.imageManager.removeScope(this.scope), this.imageManager.imageAtlasCache.clear(), this.setEventedParent(null), delete this.fog, delete this.snow, delete this.rain, delete this.terrain, delete this.ambientLight, delete this.directionalLight, this.indoorManager && this.indoorManager.destroy(), this.isRootStyle() && (this.imageManager.setEventedParent(null), this.modelManager.setEventedParent(null), this.modelManager.destroy(), this.dispatcher.remove()); 47156 } 47157 clearSource(e1) { 47158 const t1 = this.getSourceCaches(e1); 47159 for (const e1 of t1)e1.clearTiles(); 47160 } 47161 clearSources() { 47162 for(const e1 in this._mergedSourceCaches)this._mergedSourceCaches[e1].clearTiles(); 47163 } 47164 clearLayers() { 47165 for(const e1 in this._mergedLayers){ 47166 const t1 = this._mergedLayers[e1]; 47167 t1._clear && t1._clear(); 47168 } 47169 } 47170 reloadSource(e1) { 47171 const t1 = this.getSourceCaches(e1); 47172 for (const e1 of t1)e1.resume(), e1.reload(); 47173 } 47174 reloadSources() {
vendor: 4,883 bytes, lines 47175-47247
47175 for (const e1 of this.getSources())e1.reload && e1.reload(); 47176 } 47177 reloadModels() { 47178 this.modelManager.reloadModels(""), this.forEachFragmentStyle((e1)=>{ 47179 e1.modelManager.reloadModels(e1.scope); 47180 }); 47181 } 47182 updateSources(t1) { 47183 let i; 47184 this.directionalLight && (i = e1.dN(this.directionalLight)); 47185 const s = new Set, r = new Set, o = new Set; 47186 for(const e1 in this._mergedLayers){ 47187 const t1 = this._mergedLayers[e1]; 47188 "building" === t1.type ? s.add(t1.source) : "raster" !== t1.type || !t1.paint || "ground" !== t1.paint.get("raster-elevation-reference") && !1 !== t1.paint.get("raster-allow-draping") || o.add(t1.source), t1.hasElevation() && !r.has(t1.source) && r.add(t1.source); 47189 } 47190 this.updateFrcCoverageFadeRange(); 47191 for(const e1 in this._mergedSourceCaches){ 47192 const n = this._mergedSourceCaches[e1], a = r.has(n._source.id); 47193 n._isRasterElevatedOverTerrain = o.has(n._source.id), s.has(n._source.id) && (n._source.reparseOverscaled = !1), n.update(t1, void 0, void 0, i, a); 47194 } 47195 this.updateFrcCoverage(), this.updateElevationCoverage(), Xs.markElevationIngestSourceCachesUsed && Xs.markElevationIngestSourceCachesUsed(this); 47196 } 47197 _reloadSources() { 47198 for(const e1 in this._sourceCaches){ 47199 const t1 = this._sourceCaches[e1]; 47200 t1.resume(), t1.reload(); 47201 } 47202 } 47203 updateFrcCoverageFadeRange() { 47204 this.map.painter && Xs.updateFrcCoverageFadeRange && Xs.updateFrcCoverageFadeRange(this, this.map.painter); 47205 } 47206 updateFrcCoverage() { 47207 this._hdCoverage && Xs.updateFrcCoverage && Xs.updateFrcCoverage(this, this._hdCoverage); 47208 } 47209 updateElevationCoverage() { 47210 this.isRootStyle() && Xs.setupAndUpdateElevationCoverage && Xs.setupAndUpdateElevationCoverage(this); 47211 } 47212 _handleLayerOrderChange() { 47213 this._requestFullLabelPlacement(), this.fire(new e1.h("neworder")); 47214 } 47215 _requestFullLabelPlacement() { 47216 this.pauseablePlacement || (this.pauseablePlacement = new wn), this.pauseablePlacement.requestFullPlacement(); 47217 } 47218 _setLabelPlacementStale() { 47219 this.placement && this.placement.setStale(); 47220 } 47221 _updatePlacement(t1, i, s, r, o, n) { 47222 this.pauseablePlacement || (this.pauseablePlacement = new wn); 47223 let a = !1, l = !1; 47224 const c = {}, h = {}; 47225 for (const i of this._mergedOrder){ 47226 const s = this._mergedLayers[i]; 47227 if ("symbol" !== s.type) continue; 47228 const r = e1.m(s.source, s.scope); 47229 let o = c[r]; 47230 if (!o) { 47231 const e1 = this.getLayerSourceCache(s); 47232 if (!e1) continue; 47233 const t1 = e1.getRenderableIds(!0).map((t1)=>e1.getTileByID(t1)); 47234 h[r] = t1.slice(), o = c[r] = t1.sort((e1, t1)=>t1.tileID.overscaledZ - e1.tileID.overscaledZ || (e1.tileID.isLessThan(t1.tileID) ? -1 : 1)); 47235 } 47236 const n = this.crossTileSymbolIndex.addLayer(s, o, t1.center.lng, t1.projection); 47237 a = a || n; 47238 } 47239 this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder); 47240 const d = Boolean(this.placement && !t1.equals(this.placement.transform)), u = Boolean(this.placement && (0 !== this.placement.lastReplacementSourceUpdateTime && !o || this.placement.lastReplacementSourceUpdateTime !== o.updateTime)), p = d || u || a, f = (p || this.pauseablePlacement.isStale()) && 0 === s, m = this.pauseablePlacement.isDone() && !this.placement.stillRecent(e1.e.now(), t1.zoom) && 0 !== s; 47241 if ((this.pauseablePlacement.isFullPlacementRequested() || !this.pauseablePlacement.placement || f || m) && (this.pauseablePlacement = this.pauseablePlacement.startNewPlacement(t1, this._mergedOrder, i, s, r, this.placement, this.fog && t1.projection.supportsFog ? this.fog.state : null, this._buildingIndex, n), this.map.painter)) { 47242 const e1 = this.map.painter.maxFrontCutoffRawStart; 47243 if (e1 > 0) { 47244 const i = 180 * t1.pitch / Math.PI; 47245 if (i >= 15) { 47246 const t1 = Math.min(1, Math.max(0, (i - 15) / 5)), s = t1 * t1 * (3 - 2 * t1); 47247 this.pauseablePlacement.placement.frontCutoff
47247Start = -.5 * (1 - s) + e1 * s; 47248 } 47249 } 47250 } 47251 if (this.pauseablePlacement.isDone() ? p && 0 !== s && this.pauseablePlacement.setStale() : (this.pauseablePlacement.continuePlacement(this._mergedOrder, this._mergedLayers, c, h, this.map.painter.scaleFactor), this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(e1.e.now()), l = !0), a && this.pauseablePlacement.setStale()), l || a) { 47252 this._buildingIndex.onNewFrame(t1.zoom); 47253 for(let t1 = 0; t1 < this._mergedOrder.length; t1++){ 47254 const s = this._mergedLayers[this._mergedOrder[t1]]; 47255 if ("symbol" !== s.type) continue; 47256 if ("none" === s.visibility) continue; 47257 const r = this.isLayerClipped(s); 47258 this.placement.updateLayerOpacities(s, c[e1.m(s.source, s.scope)], t1, r ? o : null, i, this.map.painter.scaleFactor); 47259 } 47260 } 47261 return !this.pauseablePlacement.isDone() || this.placement.isStale() || this.placement.hasTransitions(e1.e.now()); 47262 } 47263 _releaseSymbolFadeTiles() { 47264 for(const e1 in this._sourceCaches)this._sourceCaches[e1].releaseSymbolFadeTiles(); 47265 } 47266 addImport(t1, i) { 47267 if (this._checkLoaded(), new Set([ 47268 "__proto__", 47269 "constructor", 47270 "prototype" 47271 ]).has(t1.id)) return void this.fire(new e1.f(new Error("Import id can't be \"".concat(t1.id, '".')))); 47272 const s = this.stylesheet.imports = this.stylesheet.imports || []; 47273 if (-1 !== s.findIndex((param)=>{ 47274 let { id: e1 } = param; 47275 return e1 === t1.id; 47276 })) return void this.fire(new e1.f(new Error("Import with id '".concat(t1.id, "' already exists in the map's style.")))); 47277 if (!i) return s.push(t1), this._loadImports([ 47278 t1 47279 ], !0); 47280 const r = s.findIndex((param)=>{ 47281 let { id: e1 } = param; 47282 return e1 === i; 47283 }); 47284 return -1 === r && this.fire(new e1.f(new Error('Import with id "'.concat(i, '" does not exist on this map.')))), this.stylesheet.imports = s.slice(0, r).concat(t1).concat(s.slice(r)), this._loadImports([ 47285 t1 47286 ], !0, i); 47287 } 47288 updateImport(t1, i) { 47289 this._checkLoaded(); 47290 const s = this.stylesheet.imports || [], r = this.getImportIndex(t1); 47291 return -1 === r ? this : "string" == typeof i ? (this.setImportUrl(t1, i), this) : (i.url && i.url !== s[r].url && this.setImportUrl(t1, i.url), e1.O(i.config, s[r].config) || this.setImportConfig(t1, i.config, i.data.schema), e1.O(i.data, s[r].data) || this.setImportData(t1, i.data), this); 47292 } 47293 moveImport(e1, t1) { 47294 this._checkLoaded(); 47295 let i = this.stylesheet.imports || []; 47296 const s = this.getImportIndex(e1); 47297 if (-1 === s) return this; 47298 const r = this.getImportIndex(t1); 47299 if (-1 === r) return this; 47300 const o = i[s], n = this.fragments[s]; 47301 return i = i.filter((param)=>{ 47302 let { id: t1 } = param; 47303 return t1 !== e1; 47304 }), this.fragments = this.fragments.filter((param)=>{ 47305 let { id: t1 } = param; 47306 return t1 !== e1; 47307 }), this.stylesheet.imports = i.slice(0, r).concat(o).concat(i.slice(r)), this.fragments = this.fragments.slice(0, r).concat(n).concat(this.fragments.slice(r)), this.mergeLayers(), this; 47308 } 47309 setImportUrl(e1, t1) { 47310 this._checkLoaded(); 47311 const i = this.stylesheet.imports || [], s = this.getImportIndex(e1); 47312 if (-1 === s) return this; 47313 i[s].url = t1; 47314 const r = this.fragments[s]; 47315 return r.style = this._createFragmentStyle(i[s]), r.style.on("style.import.load", ()=>this.mergeAll()), r.style.loadURL(t1), this; 47316 } 47317 setImportData(e1, t1) { 47318 this._checkLoaded(); 47319 const i = this.getImportIndex(e1), s = this.stylesheet.imports || [];
47320 return -1 === i ? this : t1 ? (this.fragments[i].style.setState(t1), this._reloadImports(), this) : (delete s[i].data, this.setImportUrl(e1, s[i].url)); 47321 } 47322 setImportConfig(e1, t1, i) { 47323 this._checkLoaded(); 47324 const s = this.getImportIndex(e1), r = this.stylesheet.imports || []; 47325 if (-1 === s) return this; 47326 t1 ? r[s].config = t1 : delete r[s].config; 47327 const o = this.fragments[s]; 47328 i && o.style.stylesheet && (o.style.stylesheet.schema = i); 47329 const n = o.style.stylesheet && o.style.stylesheet.schema; 47330 return o.config = t1, o.style.updateConfig(t1, n), this.updateConfigDependencies(), this; 47331 } 47332 removeImport(e1) { 47333 this._checkLoaded(); 47334 const t1 = this.stylesheet.imports || [], i = this.getImportIndex(e1); 47335 -1 !== i && (t1.splice(i, 1), this.fragments[i].style._remove(), this.fragments.splice(i, 1), this._reloadImports()); 47336 } 47337 getImportIndex(t1) { 47338 const i = (this.stylesheet.imports || []).findIndex((e1)=>e1.id === t1); 47339 return -1 === i && this.fire(new e1.f(new Error("Import '".concat(t1, "' does not exist in the map's style and cannot be updated.")))), i; 47340 } 47341 getLayer(e1) { 47342 return this._mergedLayers[e1]; 47343 } 47344 getSources() { 47345 const e1 = []; 47346 for(const t1 in this._mergedOtherSourceCaches){ 47347 const i = this._mergedOtherSourceCaches[t1]; 47348 i && e1.push(i.getSource()); 47349 } 47350 return e1; 47351 } 47352 getSource(e1, t1) { 47353 const i = this.getSourceCache(e1, t1); 47354 return i && i.getSource(); 47355 } 47356 getLayerSource(e1) { 47357 const t1 = this.getLayerSourceCache(e1); 47358 return t1 && t1.getSource(); 47359 } 47360 getSourceCache(t1, i) { 47361 const s = e1.m(t1, i); 47362 return this._mergedOtherSourceCaches[s]; 47363 } 47364 getLayerSourceCache(t1) { 47365 const i = e1.m(t1.source, t1.scope); 47366 return "symbol" === t1.type ? this._mergedSymbolSourceCaches[i] : "fill-extrusion" === t1.type ? this._mergedFillExtrusionSourceCaches[i] || this._mergedOtherSourceCaches[i] : "fill" === t1.type && t1.sourceLayer === e1.bU && this._mergedHdRoadCoverageSourceCaches[i] ? this._mergedHdRoadCoverageSourceCaches[i] : this._mergedOtherSourceCaches[i]; 47367 } 47368 getSourceCaches(e1) { 47369 return null == e1 ? Object.values(this._mergedSourceCaches) : [ 47370 this._mergedOtherSourceCaches[e1], 47371 this._mergedSymbolSourceCaches[e1], 47372 this._mergedFillExtrusionSourceCaches[e1], 47373 this._mergedHdRoadCoverageSourceCaches[e1], 47374 this._mergedHdRoadElevationSourceCaches[e1] 47375 ].filter(Boolean); 47376 } 47377 updateSourceCaches() { 47378 const e1 = this._changes.getUpdatedSourceCaches(); 47379 for(const t1 in e1){ 47380 const i = e1[t1]; 47381 "reload" === i ? this.reloadSource(t1) : "clear" === i && this.clearSource(t1); 47382 } 47383 } 47384 updateLayers(e1) { 47385 const t1 = this._changes.getUpdatedPaintProperties(); 47386 for (const i of t1){ 47387 const t1 = this.getLayer(i); 47388 t1 && t1.updateTransitions(e1); 47389 } 47390 } 47391 getGlyphsUrl() { 47392 return this.stylesheet.glyphs; 47393 } 47394 setGlyphsUrl(e1) { 47395 this.stylesheet.glyphs = e1, this.glyphManager.setURL(e1); 47396 } 47397 getOwnSourceCache(e1) { 47398 return this._otherSourceCaches[e1]; 47399 } 47400 getOwnLayerSourceCache(e1) { 47401 return "symbol" === e1.type ? this._symbolSourceCaches[e1.source] : "fill-extrusion" === e1.type && this._fillExtrusionSourceCaches[e1.source] || this._otherSourceCaches[e1.source]; 47402 } 47403 getOwnSourceCaches(t1) { 47404 return [ 47405 this._otherSourceCaches[t1], 47406 this._symbolSourceCaches[t1], 47407 this._fillExtrusionSourceCaches[t1], 47408 this._hdCoverage && this._hdCoverage.coverageSourceCaches[t1], 47409 this._hdElevation && this._hdElevation.elevationSourceCaches[e1.m(t1, this.scope)]
47410 ].filter(Boolean); 47411 } 47412 _updateHdCoverageSourceCache(t1) { 47413 return Xs.HdCoverageState && Xs.updateHdCoverageSourceCache ? (this._hdCoverage || (this._hdCoverage = new Xs.HdCoverageState), Xs.updateHdCoverageSourceCache(this, this._hdCoverage, t1), !1) : "fill" === t1.type && t1.sourceLayer === e1.bU; 47414 } 47415 _isSourceCacheLoaded(t1) { 47416 const i = this.getOwnSourceCaches(t1); 47417 return 0 === i.length ? (this.fire(new e1.f(new Error("There is no source with ID '".concat(t1, "'")))), !1) : i.every((e1)=>e1.loaded()); 47418 } 47419 has3DLayers() { 47420 return this._has3DLayers; 47421 } 47422 hasSymbolLayers() { 47423 return this._hasSymbolLayers; 47424 } 47425 hasCircleLayers() { 47426 return this._hasCircleLayers; 47427 } 47428 isLayerClipped(e1, t1) { 47429 if (!this._clipLayerPresent && "fill-extrusion" !== e1.type && "building" !== e1.type) return !1; 47430 const i = "fill-extrusion" === e1.type && ("building" === e1.sourceLayer || "procedural_buildings" === e1.sourceLayer), s = "building" === e1.type; 47431 if (e1.is3D(!!this.terrain)) { 47432 if (i || s || t1 && "batched-model" === t1.type) return !0; 47433 if ("model" === e1.type) return !0; 47434 } else if ("symbol" === e1.type) return !0; 47435 return !1; 47436 } 47437 _clearWorkerCaches() { 47438 this.dispatcher.broadcast("clearCaches"); 47439 } 47440 getBOMObject() {} 47441 destroy() { 47442 this._clearWorkerCaches(), this.imageManager.imageAtlasCache.clear(), this.fragments.forEach((e1)=>{ 47443 e1.style._remove(); 47444 }), this.terrainSetForDrapingOnly() && (delete this.terrain, delete this.stylesheet.terrain); 47445 } 47446 async getImages(t1, i) { 47447 const s = new Promise((e1, t1)=>{ 47448 this.imageManager.getImages(i.icons.concat(i.patterns), i.scope, (i, s)=>{ 47449 i ? t1(i) : e1(s); 47450 }); 47451 }); 47452 this._updateTilesForChangedImages(); 47453 const r = i.icons.map((t1)=>e1.I.toString(t1)), o = i.patterns.map((t1)=>e1.I.toString(t1)), n = (e1)=>{ 47454 e1 && (e1.setDependencies(i.tileID.key, "icons", r), e1.setDependencies(i.tileID.key, "patterns", o)); 47455 }, a = e1.m(i.source, i.scope); 47456 return n(this._mergedOtherSourceCaches[a]), n(this._mergedSymbolSourceCaches[a]), (i.icons.some((e1)=>e1.iconsetId) || i.patterns.some((e1)=>e1.iconsetId)) && this.fire(new e1.h("data", { 47457 dataType: "style" 47458 })), s; 47459 } 47460 async rasterizeImages(e1, t1) { 47461 return new Promise((e1, i)=>{ 47462 this.imageManager.rasterizeImages(t1, (t1, s)=>{ 47463 t1 ? i(t1) : e1(s); 47464 }); 47465 }); 47466 } 47467 async checkAtlasCache(e1, t1) { 47468 const i = this.imageManager.imageAtlasCache.findCachedAtlas(t1.descriptor); 47469 return i && i.contentDescriptor ? { 47470 iconPositions: i.iconPositions, 47471 patternPositions: i.patternPositions, 47472 sourceHash: i.contentDescriptor.hash 47473 } : null; 47474 } 47475 async getGlyphs(e1, t1) { 47476 return new Promise((e1, i)=>{ 47477 this.glyphManager.getGlyphs(t1.stacks, (t1, s)=>{ 47478 t1 ? i(t1) : e1(s); 47479 }); 47480 }); 47481 } 47482 constructor(t1, i = {}){ 47483 super(), this.map = t1, this.scope = i.scope || "", this.globalId = null, this.fragments = [], this.importDepth = i.importDepth || 0, this.importsCache = i.importsCache || new Map, this.resolvedImports = i.resolvedImports || new Set, this.transition = { 47484 ...Gn 47485 }, this._buildingIndex = new qo(this), this.crossTileSymbolIndex = new In, this._mergedOrder = [], this._drapedFirstOrder = [], this._mergedLayers = Object.create(null), this._mergedIndoor = {}
47485, this._indoorEnabled = !1, this._mergedSourceCaches = {}, this._mergedOtherSourceCaches = Object.create(null), this._mergedSymbolSourceCaches = Object.create(null), this._mergedFillExtrusionSourceCaches = Object.create(null), this._mergedHdRoadCoverageSourceCaches = Object.create(null), this._mergedHdRoadElevationSourceCaches = Object.create(null), this._hdCoverage = null, this._hdElevation = null, this._crossSourceElevationActive = !1, this._clipLayerPresent = !1, this._hasAppearances = !1, this._has3DLayers = !1, this._hasCircleLayers = !1, this._hasSymbolLayers = !1, this._importedAsBasemap = !1, this._changes = i.styleChanges || new b, this._hasDataDrivenEmissive = !1, this.indoorManager = null, this.dispatcher = i.dispatcher ? i.dispatcher : new ei($o(), this); 47486 const s = { 47487 referrer: e1.dy(), 47488 config: e1.dO() 47489 }; 47490 if (this.map.painter && this.map.painter.context) { 47491 const e1 = this.map.painter.context.maxUniformBufferBindings, t1 = Math.floor(this.map.painter.context.maxUniformBlockSize / 4); 47492 s.contextOptions = { 47493 maxBindingPoints: e1, 47494 maxUniformBlockSizeDwords: t1 47495 }; 47496 } 47497 this.isRootStyle() && this.dispatcher.broadcast("setGlobalParams", s), i.imageManager ? this.imageManager = i.imageManager : (this.imageManager = new le(this.map._spriteFormat), this.imageManager.setEventedParent(this)), this.imageManager.addScope(this.scope), this.glyphManager = i.glyphManager ? i.glyphManager : new e1.dz(t1._requestManager, i.localFontFamily ? e1.dA.all : i.localIdeographFontFamily ? e1.dA.ideographs : e1.dA.none, i.localFontFamily || i.localIdeographFontFamily, i.fontstackCompositing), i.modelManager ? this.modelManager = i.modelManager : (this.modelManager = new Dn(t1._requestManager), this.modelManager.setEventedParent(this)), this._layers = Object.create(null), this._sourceCaches = {}, this._otherSourceCaches = Object.create(null), this._symbolSourceCaches = Object.create(null), this._fillExtrusionSourceCaches = Object.create(null), this._hdCoverage = null, this._hdElevation = null, this._crossSourceElevationActive = !1, this._loaded = !1, this._drapingLoaded = void 0, this._initialBroadcastDone = !1, this._programPrecompiler = this.map._precompilePrograms && this.isRootStyle() ? new An : null, this._availableImages = [], this._availableModels = {}, this._order = [], this._markersNeedUpdate = !1, this.options = i.configOptions ? i.configOptions : new Map, this._layerExpressionDependencies = i.layerExpressionDependencies ? i.layerExpressionDependencies : new Map, this._config = i.config, this._styleColorTheme = { 47498 lut: null, 47499 lutLoading: !1, 47500 lutLoadingCorrelationID: 0, 47501 colorTheme: null, 47502 colorThemeOverride: i.colorThemeOverride 47503 }, this._styleColorThemeForScope = {}, this._initialConfig = i.initialConfig; 47504 const r = this; 47505 this._rtlTextPluginCallback = qn.registerForPluginStateChange((t1)=>{ 47506 r.dispatcher.send("syncRTLPluginState", { 47507 pluginStatus: t1.pluginStatus, 47508 pluginURL: t1.pluginURL 47509 }).then((t1)=>{ 47510 if (e1.dB(null), t1.every((e1)=>e1)) for(const e1 in r._sourceCaches){ 47511 const t1 = r._sourceCaches[e1], i = t1.getSource().type; 47512 "vector" !== i && "geojson" !== i || t1.reload(); 47513 } 47514 }).catch((t1)=>{ 47515 e1.dB(t1); 47516 }); 47517 }), this.on("data", (e1)=>{ 47518 if ("source" !== e1.dataType || "metadata" !== e1.sourceDataType) return; 47519 const t1 = this.getOwnSource(e1.sourceId); 47520 if (t1 && t1.vectorLayerIds) for(const e1 in this._layers){ 47521 const i = this._layers[e1];
vendor: 4,186 bytes, lines 47522-47618
47522 i.source === t1.id && this._validateLayer(i); 47523 } 47524 }); 47525 } 47526 } 47527 qn.registerForPluginStateChange = e1.dx; 47528 class Zn { 47529 bind(e1, t1, i, s, r, o, n, a) { 47530 this.context = e1; 47531 let l = this.boundPaintVertexBuffers.length !== s.length; 47532 for(let e1 = 0; !l && e1 < s.length; e1++)this.boundPaintVertexBuffers[e1] !== s[e1] && (l = !0); 47533 let c = this.boundDynamicVertexBuffers.length !== n.length; 47534 for(let e1 = 0; !c && e1 < n.length; e1++)this.boundDynamicVertexBuffers[e1] !== n[e1] && (c = !0); 47535 if (!this.vao || this.boundProgram !== t1 || this.boundLayoutVertexBuffer !== i || l || c || this.boundIndexBuffer !== r || this.boundVertexOffset !== o) this.freshBind(t1, i, s, r, o, n, a); 47536 else { 47537 e1.bindVertexArrayOES.set(this.vao); 47538 for (const i of n)i && (i.bind(), a && i.instanceCount && i.setVertexAttribDivisor(e1.gl, t1, a)); 47539 r && r.dynamicDraw && r.bind(); 47540 } 47541 } 47542 freshBind(e1, t1, i, s, r, o, n) { 47543 const a = this.context, l = a.gl; 47544 this.vao && this.destroy(), this.vao = a.gl.createVertexArray(), a.bindVertexArrayOES.set(this.vao), this.boundProgram = e1, this.boundLayoutVertexBuffer = t1, this.boundPaintVertexBuffers = i, this.boundIndexBuffer = s, this.boundVertexOffset = r, this.boundDynamicVertexBuffers = o, t1.enableAttributes(l, e1), t1.bind(), t1.setVertexAttribPointers(l, e1, r); 47545 for (const t1 of i)t1.enableAttributes(l, e1), t1.bind(), t1.setVertexAttribPointers(l, e1, r); 47546 for (const t1 of o)t1 && (t1.enableAttributes(l, e1), t1.bind(), t1.setVertexAttribPointers(l, e1, r), n && t1.instanceCount && t1.setVertexAttribDivisor(l, e1, n)); 47547 s && s.bind(); 47548 } 47549 destroy() { 47550 this.vao && (this.context.gl.deleteVertexArray(this.vao), this.vao = null); 47551 } 47552 constructor(){ 47553 this.boundProgram = null, this.boundLayoutVertexBuffer = null, this.boundPaintVertexBuffers = [], this.boundIndexBuffer = null, this.boundVertexOffset = null, this.boundDynamicVertexBuffers = [], this.vao = null; 47554 } 47555 } 47556 function $n(t1, i, s) { 47557 const r = function(t1, i, s) { 47558 const r = e1.dT(i, t1), o = e1.dT(s, [ 47559 .2126, 47560 .7152, 47561 .0722 47562 ]), n = 1 - .3 * Math.min(o, 1), a = e1.al(n, 1, Math.min(r + 1, 1)); 47563 return e1.al(.92, 1, Math.asin(e1.b0(i[2], -1, 1)) / Math.PI + .5) * a; 47564 }(t1, [ 47565 0, 47566 0, 47567 1 47568 ], i), o = [ 47569 0, 47570 0, 47571 0 47572 ]; 47573 e1.dQ(o, s.slice(0, 3), r); 47574 const n = [ 47575 0, 47576 0, 47577 0 47578 ]; 47579 e1.dQ(n, i.slice(0, 3), t1[2]); 47580 const a = [ 47581 0, 47582 0, 47583 0 47584 ]; 47585 return e1.dR(a, o, n), e1.dS(a); 47586 } 47587 const Hn = [ 47588 "fill", 47589 "fillOutline", 47590 "fillPattern", 47591 "line", 47592 "linePattern", 47593 "background", 47594 "backgroundPattern", 47595 "hillshade", 47596 "raster" 47597 ], Wn = [ 47598 "stars", 47599 "rainParticle", 47600 "snowParticle", 47601 "fillExtrusion", 47602 "fillExtrusionGroundEffect", 47603 "building", 47604 "buildingBloom", 47605 "elevatedStructures", 47606 "model", 47607 "symbol" 47608 ]; 47609 class Xn { 47610 static cacheKey(e1, t1, i, s) { 47611 const r = [ 47612 t1 47613 ]; 47614 s && r.push(s.cacheKey); 47615 for (const t1 of i)("string" == typeof t1 && t1.includes(" ") || e1.usedDefines.has(t1)) && r.push(t1); 47616 return r.join("/"); 47617 } 47618 _finalize() {
47619 if (!this._pending) return; 47620 this._pending = !1; 47621 const t1 = this._context, i = t1.gl; 47622 t1._pendingPrograms.delete(this); 47623 const s = e1.e.now(), r = i.getProgramParameter(this.program, i.LINK_STATUS), o = e1.e.now() - s, n = t1._compileStats; 47624 if (n.totalStallMs += o, o > n.maxStallMs && (n.maxStallMs = o), o > 1) { 47625 n.framesMissed += Math.floor(60 * o / 1e3); 47626 const e1 = this.fixedDefines.join(","); 47627 n.stalls.push({ 47628 name: "".concat(this.name).concat(e1 ? "/" : "").concat(e1), 47629 ms: o, 47630 timestamp: s 47631 }); 47632 } 47633 if (this._fragmentShader && (r || e1.w("Fragment shader '".concat(this.name, "': ").concat(i.getShaderInfoLog(this._fragmentShader))), i.deleteShader(this._fragmentShader), this._fragmentShader = null), this._vertexShader && (r || e1.w("Vertex shader '".concat(this.name, "': ").concat(i.getShaderInfoLog(this._vertexShader))), i.deleteShader(this._vertexShader), this._vertexShader = null), !r) return e1.w("Failed to link program '".concat(this.name, "': ").concat(i.getProgramInfoLog(this.program))), void (this.failedToCreate = !0); 47634 this.fixedUniforms = this._fixedUniformsFn(t1), this.fixedUniformsEntries = Object.entries(this.fixedUniforms), this.binderUniforms = this.configuration ? this.configuration.getUniforms(t1) : [], this.forceManualRenderingForInstanceIDShaders && (this.instancingUniforms = ((t1)=>({ 47635 u_instanceID: new e1.aX(t1) 47636 }))(t1)); 47637 const a = this.fixedDefines, l = this.name; 47638 (a.includes("TERRAIN") || a.includes("ELEVATED") || l.includes("symbol") || l.includes("circle")) && (this.terrainUniforms = ((t1)=>({ 47639 u_dem: new e1.aX(t1), 47640 u_dem_prev: new e1.aX(t1), 47641 u_dem_tl: new e1.a2(t1), 47642 u_dem_scale: new e1.a3(t1), 47643 u_dem_tl_prev: new e1.a2(t1), 47644 u_dem_scale_prev: new e1.a3(t1), 47645 u_dem_size: new e1.a3(t1), 47646 u_dem_lerp: new e1.a3(t1), 47647 u_exaggeration: new e1.a3(t1), 47648 u_depth: new e1.aX(t1), 47649 u_depth_size_inv: new e1.a2(t1), 47650 u_depth_range_unpack: new e1.a2(t1), 47651 u_occluder_half_size: new e1.a3(t1), 47652 u_occlusion_depth_offset: new e1.a3(t1), 47653 u_meter_to_dem: new e1.a3(t1), 47654 u_label_plane_matrix_inv: new e1.a4(t1) 47655 }))(t1)), a.includes("GLOBE") && (this.globeUniforms = ((t1)=>({ 47656 u_tile_tl_up: new e1.a5(t1), 47657 u_tile_tr_up: new e1.a5(t1), 47658 u_tile_br_up: new e1.a5(t1), 47659 u_tile_bl_up: new e1.a5(t1), 47660 u_tile_up_scale: new e1.a3(t1) 47661 }))(t1)), a.includes("FOG") && (this.fogUniforms = ((t1)=>({ 47662 u_fog_matrix: new e1.a4(t1), 47663 u_fog_range: new e1.a2(t1), 47664 u_fog_color: new e1.aY(t1), 47665 u_fog_horizon_blend: new e1.a3(t1), 47666 u_fog_vertical_limit: new e1.a2(t1), 47667 u_fog_temporal_offset: new e1.a3(t1), 47668 u_frustum_tl: new e1.a5(t1), 47669 u_frustum_tr: new e1.a5(t1), 47670 u_frustum_br: new e1.a5(t1), 47671 u_frustum_bl: new e1.a5(t1), 47672 u_globe_pos: new e1.a5(t1), 47673 u_globe_radius: new e1.a3(t1), 47674 u_globe_transition: new e1.a3(t1), 47675 u_is_globe: new e1.aX(t1), 47676 u_viewport: new e1.a2(t1) 47677 }))(t1)), a.includes("RENDER_CUTOFF") && (this.cutoffUniforms = e1.dW(t1)), a.includes("LIGHTING_3D_MODE") && (this.lightsUniforms = ((t1)=>({ 47678 u_lighting_ambient_color: new e1.a5(t1), 47679 u_lighting_directional_dir: new e1.a5(t1), 47680 u_lighting_directional_color: new e1.a5(t1), 47681 u_ground_radiance: new e1.a5(t1) 47682 }))(t1)), a.includes("RENDER_SHADOWS") && (this.shadowUniforms = e1.dX(t1)); 47683 } 47684 maybeFinalize() {
vendor: 25,562 bytes, lines 47685-48062
47685 if (!this._pending) return; 47686 const e1 = this._context.extParallelShaderCompile; 47687 e1 && !this._context.gl.getProgramParameter(this.program, e1.COMPLETION_STATUS_KHR) || this._finalize(); 47688 } 47689 _ensureReady() { 47690 this._pending && (this._finalize(), this._context.sweepPendingPrograms()); 47691 } 47692 getAttributeLocation(e1, t1) { 47693 this._ensureReady(); 47694 let i = this.attributes[t1]; 47695 return void 0 === i && (i = this.attributes[t1] = e1.getAttribLocation(this.program, t1)), i; 47696 } 47697 _setUniformGroup(e1, t1, i) { 47698 this._ensureReady(); 47699 const s = this[t1]; 47700 if (!this.failedToCreate && s) { 47701 e1.program.set(this.program); 47702 for(const e1 in i){ 47703 const t1 = s[e1]; 47704 t1 && t1.set(this.program, e1, i[e1]); 47705 } 47706 } 47707 } 47708 setTerrainUniformValues(e1, t1) { 47709 this._setUniformGroup(e1, "terrainUniforms", t1); 47710 } 47711 setGlobeUniformValues(e1, t1) { 47712 this._setUniformGroup(e1, "globeUniforms", t1); 47713 } 47714 setFogUniformValues(e1, t1) { 47715 this._setUniformGroup(e1, "fogUniforms", t1); 47716 } 47717 setCutoffUniformValues(e1, t1) { 47718 this._setUniformGroup(e1, "cutoffUniforms", t1); 47719 } 47720 setLightsUniformValues(e1, t1) { 47721 this._setUniformGroup(e1, "lightsUniforms", t1); 47722 } 47723 setShadowUniformValues(e1, t1) { 47724 this._setUniformGroup(e1, "shadowUniforms", t1); 47725 } 47726 _drawDebugWireframe(t1, i, s, r, o, n, a, l, c, h) { 47727 const d = t1.options.wireframe; 47728 if (!1 === d.terrain && !1 === d.layers2D && !1 === d.layers3D) return; 47729 const u = t1.context; 47730 if (!(()=>!(!d.terrain || "terrainRaster" !== this.name && "globeRaster" !== this.name) || !(!d.layers2D || t1._terrain && t1._terrain.renderingToTexture || !Hn.includes(this.name)) || !(!d.layers3D || !Wn.includes(this.name)))()) return; 47731 const p = u.gl, f = t1.wireframeDebugCache.getLinesFromTrianglesBuffer(t1.frameCounter, o, u); 47732 if (!f) return; 47733 const m = [ 47734 ...this.fixedDefines, 47735 "DEBUG_WIREFRAME" 47736 ], _ = t1.getOrCreateProgram(this.name, { 47737 config: this.configuration, 47738 defines: m 47739 }); 47740 _._ensureReady(), u.program.set(_.program); 47741 const g = (e1, t1, i)=>{ 47742 if (t1[e1] && i[e1]) for(const s in t1[e1])i[e1][s] && i[e1][s].set(i.program, s, t1[e1][s].current); 47743 }; 47744 c && c.setUniforms(_.program, u, _.binderUniforms, a, { 47745 zoom: l 47746 }), g("fixedUniforms", this, _), g("terrainUniforms", this, _), g("globeUniforms", this, _), g("fogUniforms", this, _), g("lightsUniforms", this, _), g("shadowUniforms", this, _), f.bind(), u.setColorMode(new e1.a1([ 47747 p.ONE, 47748 p.ONE_MINUS_SRC_ALPHA, 47749 p.ZERO, 47750 p.ONE 47751 ], e1.C.transparent, [ 47752 !0, 47753 !0, 47754 !0, 47755 !1 47756 ])), u.setDepthMode(new e1.Z(i.func === p.LESS ? p.LEQUAL : i.func, e1.Z.ReadOnly, i.range)), u.setStencilMode(e1._.disabled); 47757 const y = 3 * n.primitiveLength * 2, v = 3 * n.primitiveOffset * 2 * 2; 47758 if (this.forceManualRenderingForInstanceIDShaders) { 47759 const e1 = h || 1; 47760 for(let t1 = 0; t1 < e1; ++t1)_.instancingUniforms.u_instanceID.set(this.program, "u_instanceID", t1), p.drawElements(p.LINES, y, p.UNSIGNED_SHORT, v); 47761 } else h && h > 1 ? p.drawElementsInstanced(p.LINES, y, p.UNSIGNED_SHORT, v, h) : p.drawElements(p.LINES, y, p.UNSIGNED_SHORT, v); 47762 o.bind(), u.program.set(this.program), u.setDepthMode(i), u.setStencilMode(s), u.setColorMode(r); 47763 } 47764 checkUniforms(e1, t1, i) { 47765 if (this.fixedDefines.includes(t1)) { 47766 for (const s of Object.keys(i))if (!i[s].initialized) throw new Error("Program '".concat(this.name, "', from draw '").concat(e1, "': uniform ").concat(s, " not set but required by ").concat(t1, " being defined")); 47767 } 47768 } 47769 draw(e1, t1, i, s, r, o, n, a, l, c, h, d, u, p, f, m) { 47770 const _ = e1.context, g = _.gl; 47771 if (this._ensureReady(), this.failedToCreate) return; 47772 _.program.set(this.program), _.setDepthMode(i), _.setStencilMode(s), _.setColorMode(r), _.setCullFace(o); 47773 for (const [e1, t1] of this.fixedUniformsEntries)t1.set(this.program, e1, n[e1]); 47774 p && p.setUniforms(this.program, _, this.binderUniforms, d, { 47775 zoom: u 47776 }); 47777 const y = { 47778 [g.POINTS]: 1, 47779 [g.LINES]: 2, 47780 [g.TRIANGLES]: 3, 47781 [g.LINE_STRIP]: 1 47782 }[t1]; 47783 this.checkUniforms(a, "RENDER_SHADOWS", this.shadowUniforms); 47784 const v = f || [], b = p ? p.getPaintVertexBuffers() : [], x = t1 === g.TRIANGLES && c, w = m && m > 0 ? 1 : void 0; 47785 for (const o of h.get()){ 47786 const n = o.vaos || (o.vaos = {}); 47787 if ((n[a] || (n[a] = new Zn)).bind(_, this, l, b, c, o.vertexOffset, v, w), this.forceManualRenderingForInstanceIDShaders) { 47788 const e1 = m || 1; 47789 for(let i = 0; i < e1; ++i)this.instancingUniforms.u_instanceID.set(this.program, "u_instanceID", i), c ? g.drawElements(t1, o.primitiveLength * y, g.UNSIGNED_SHORT, o.primitiveOffset * y * 2) : g.drawArrays(t1, o.vertexOffset, o.vertexLength); 47790 } else m && m > 1 ? g.drawElementsInstanced(t1, o.primitiveLength * y, g.UNSIGNED_SHORT, o.primitiveOffset * y * 2, m) : c ? g.drawElements(t1, o.primitiveLength * y, g.UNSIGNED_SHORT, o.primitiveOffset * y * 2) : g.drawArrays(t1, o.vertexOffset, o.vertexLength); 47791 x && this._drawDebugWireframe(e1, i, s, r, c, o, d, u, p, m); 47792 } 47793 } 47794 constructor(t1, i, s, r, o, n, a = !1){ 47795 const l = t1.gl; 47796 this.program = l.createProgram(), this._context = t1, this._fixedUniformsFn = o, this._pending = !0, this._precompiled = a, this.attributes = {}, this.configuration = r, this.name = i, this.fixedDefines = [ 47797 ...n 47798 ], a ? t1._compileStats.precompiled++ : t1._compileStats.onDemand++; 47799 const c = "#version 300 es\n".concat((r ? r.defines() : []).concat(n.map((e1)=>"#define ".concat(e1))).join("\n")), h = [ 47800 c, 47801 e1.dU 47802 ]; 47803 for (const t1 of s.fragmentIncludes)h.push(e1.ba[t1]); 47804 h.push(s.fragmentSource); 47805 const d = h.join("\n"), u = [ 47806 c, 47807 e1.dV 47808 ]; 47809 for (const t1 of s.vertexIncludes)u.push(e1.ba[t1]); 47810 this.forceManualRenderingForInstanceIDShaders = t1.forceManualRenderingForInstanceIDShaders && s.vertexSource.includes("gl_InstanceID"), this.forceManualRenderingForInstanceIDShaders && u.push("uniform int u_instanceID;"), u.push(s.vertexSource); 47811 let p = u.join("\n"); 47812 this.forceManualRenderingForInstanceIDShaders && (p = p.replaceAll("gl_InstanceID", "u_instanceID")); 47813 const f = l.createShader(l.FRAGMENT_SHADER); 47814 if (l.isContextLost()) return this.failedToCreate = !0, void (this._pending = !1); 47815 l.shaderSource(f, d), l.compileShader(f), l.attachShader(this.program, f); 47816 const m = l.createShader(l.VERTEX_SHADER); 47817 if (l.isContextLost()) return this.failedToCreate = !0, void (this._pending = !1); 47818 l.shaderSource(m, p), l.compileShader(m), l.attachShader(this.program, m), l.linkProgram(this.program), this._fragmentShader = f, this._vertexShader = m, t1.extParallelShaderCompile ? t1._pendingPrograms.add(this) : this._finalize(); 47819 } 47820 } 47821 class Kn { 47822 bind() { 47823 this.context.bindElementBuffer.set(this.buffer); 47824 } 47825 updateData(e1) { 47826 this.id = Kn.uniqueIdxCounter, Kn.uniqueIdxCounter++; 47827 const t1 = this.context.gl; 47828 this.context.unbindVAO(), this.bind(), t1.bufferSubData(t1.ELEMENT_ARRAY_BUFFER, 0, e1.arrayBuffer); 47829 } 47830 destroy() { 47831 this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer); 47832 } 47833 constructor(e1, t1, i, s){ 47834 this.id = Kn.uniqueIdxCounter, Kn.uniqueIdxCounter++, this.context = e1; 47835 const r = e1.gl; 47836 this.buffer = r.createBuffer(), this.dynamicDraw = Boolean(i), this.context.unbindVAO(), e1.bindElementBuffer.set(this.buffer), r.bufferData(r.ELEMENT_ARRAY_BUFFER, t1.arrayBuffer, this.dynamicDraw ? r.DYNAMIC_DRAW : r.STATIC_DRAW), this.dynamicDraw || s || t1.destroy(); 47837 } 47838 } 47839 Kn.uniqueIdxCounter = 0; 47840 const Yn = { 47841 Int8: "BYTE", 47842 Uint8: "UNSIGNED_BYTE", 47843 Int16: "SHORT", 47844 Uint16: "UNSIGNED_SHORT", 47845 Int32: "INT", 47846 Uint32: "UNSIGNED_INT", 47847 Float32: "FLOAT" 47848 }; 47849 class Qn { 47850 bind() { 47851 this.context.bindVertexBuffer.set(this.buffer); 47852 } 47853 updateData(e1) { 47854 const t1 = this.context.gl; 47855 this.bind(), t1.bufferSubData(t1.ARRAY_BUFFER, 0, e1.arrayBuffer); 47856 } 47857 enableAttributes(e1, t1) { 47858 for (const i of this.attributes){ 47859 const s = t1.getAttributeLocation(e1, i.name); 47860 -1 !== s && e1.enableVertexAttribArray(s); 47861 } 47862 } 47863 setVertexAttribPointers(e1, t1, i) { 47864 for (const s of this.attributes){ 47865 const r = t1.getAttributeLocation(e1, s.name); 47866 if (-1 !== r) { 47867 const t1 = s.offset + this.itemSize * (i || 0); 47868 "Float32" === s.type ? e1.vertexAttribPointer(r, s.components, e1.FLOAT, !1, this.itemSize, t1) : e1.vertexAttribIPointer(r, s.components, e1[Yn[s.type]], this.itemSize, t1); 47869 } 47870 } 47871 } 47872 setVertexAttribDivisor(e1, t1, i) { 47873 for(let s = 0; s < this.attributes.length; s++){ 47874 const r = t1.getAttributeLocation(e1, this.attributes[s].name); 47875 -1 !== r && this.instanceCount && this.instanceCount > 0 && e1.vertexAttribDivisor(r, i); 47876 } 47877 } 47878 destroy() { 47879 this.buffer && (this.context.gl.deleteBuffer(this.buffer), delete this.buffer); 47880 } 47881 constructor(e1, t1, i, s, r, o){ 47882 this.length = t1.length, this.attributes = i, this.itemSize = t1.bytesPerElement, this.dynamicDraw = s, this.instanceCount = o, this.context = e1; 47883 const n = e1.gl; 47884 this.buffer = n.createBuffer(), e1.bindVertexBuffer.set(this.buffer), n.bufferData(n.ARRAY_BUFFER, t1.arrayBuffer, this.dynamicDraw ? n.DYNAMIC_DRAW : n.STATIC_DRAW), this.dynamicDraw || r || t1.destroy(); 47885 } 47886 } 47887 class Jn { 47888 static createWithTexture(t1, i, s, r, o) { 47889 const n = t1.gl; 47890 if (t1.activeTexture.set(n.TEXTURE1), t1.viewport.set([ 47891 0, 47892 0, 47893 s, 47894 r 47895 ]), i && i.width === s && i.height === r) return n.bindTexture(n.TEXTURE_2D, i.colorAttachment0.get()), t1.bindFramebuffer.set(i.framebuffer), i; 47896 i && i.destroy(); 47897 const a = t1.extRenderToTextureHalfFloat || t1.extColorBufferFloat ? t1.gl.RGBA16F : t1.gl.RGBA8, l = new e1.T(t1, { 47898 width: s, 47899 height: r, 47900 data: null 47901 }, a); 47902 l.bind(n.LINEAR, n.CLAMP_TO_EDGE); 47903 const c = t1.createFramebuffer(s, r, 1, null); 47904 if (c.format = a, c.colorAttachment0.set(l.texture), o) { 47905 const e1 = t1.createRenderbuffer(n.DEPTH24_STENCIL8, s, r); 47906 t1.bindFramebuffer.set(c.framebuffer), n.framebufferRenderbuffer(n.FRAMEBUFFER, n.DEPTH_STENCIL_ATTACHMENT, n.RENDERBUFFER, e1), c._stencilRbo = e1; 47907 } 47908 return c; 47909 } 47910 createColorAttachment(e1, t1) { 47911 0 === t1 ? this.colorAttachment0 = new Or(e1, this.framebuffer, 0) : 1 === t1 && (this.colorAttachment1 = new Or(e1, this.framebuffer, 1)); 47912 } 47913 removeColorAttachment(e1, t1) { 47914 const i = this.context.gl; 47915 let s; 47916 0 === t1 ? (s = this.colorAttachment0.get(), this.colorAttachment0 = void 0) : 1 === t1 && (s = this.colorAttachment1.get(), this.colorAttachment1 = void 0), s && i.deleteTexture(s); 47917 } 47918 destroy() { 47919 const e1 = this.context.gl; 47920 if (this.colorAttachment0) { 47921 const t1 = this.colorAttachment0.get(); 47922 t1 && e1.deleteTexture(t1); 47923 } 47924 if (this.colorAttachment1) { 47925 const t1 = this.colorAttachment1.get(); 47926 t1 && e1.deleteTexture(t1); 47927 } 47928 if (this.depthAttachment && this.depthAttachmentType) if ("renderbuffer" === this.depthAttachmentType) { 47929 const t1 = this.depthAttachment.get(); 47930 t1 && e1.deleteRenderbuffer(t1); 47931 } else { 47932 const t1 = this.depthAttachment.get(); 47933 t1 && e1.deleteTexture(t1); 47934 } 47935 this._stencilRbo && (e1.deleteRenderbuffer(this._stencilRbo), this._stencilRbo = null), e1.deleteFramebuffer(this.framebuffer); 47936 } 47937 constructor(e1, t1, i, s, r){ 47938 this.context = e1, this.width = t1, this.height = i; 47939 const o = this.framebuffer = e1.gl.createFramebuffer(); 47940 s > 0 && (this.colorAttachment0 = new Or(e1, o, 0)), s > 1 && (this.colorAttachment1 = new Or(e1, o, 1)), r && (this.depthAttachmentType = r, this.depthAttachment = "renderbuffer" === r ? new Fr(e1, o) : new kr(e1, o)); 47941 } 47942 } 47943 class ea { 47944 sweepPendingPrograms() { 47945 if (0 !== this._pendingPrograms.size) for (const e1 of this._pendingPrograms)e1.maybeFinalize(); 47946 } 47947 setDefault() { 47948 this.unbindVAO(), this.clearColor.setDefault(), this.clearDepth.setDefault(), this.clearStencil.setDefault(), this.colorMask.setDefault(), this.depthMask.setDefault(), this.stencilMask.setDefault(), this.stencilFunc.setDefault(), this.stencilOp.setDefault(), this.stencilTest.setDefault(), this.depthRange.setDefault(), this.depthTest.setDefault(), this.depthFunc.setDefault(), this.blend.setDefault(), this.blendFunc.setDefault(), this.blendColor.setDefault(), this.blendEquation.setDefault(), this.cullFace.setDefault(), this.cullFaceSide.setDefault(), this.frontFace.setDefault(), this.program.setDefault(), this.activeTexture.setDefault(), this.bindFramebuffer.setDefault(), this.pixelStoreUnpack.setDefault(), this.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.pixelStoreUnpackFlipY.setDefault(); 47949 } 47950 setDirty() { 47951 this.clearColor.dirty = !0, this.clearDepth.dirty = !0, this.clearStencil.dirty = !0, this.colorMask.dirty = !0, this.depthMask.dirty = !0, this.stencilMask.dirty = !0, this.stencilFunc.dirty = !0, this.stencilOp.dirty = !0, this.stencilTest.dirty = !0, this.depthRange.dirty = !0, this.depthTest.dirty = !0, this.depthFunc.dirty = !0, this.blend.dirty = !0, this.blendFunc.dirty = !0, this.blendColor.dirty = !0, this.blendEquation.dirty = !0, this.cullFace.dirty = !0, this.cullFaceSide.dirty = !0, this.frontFace.dirty = !0, this.program.dirty = !0, this.activeTexture.dirty = !0, this.viewport.dirty = !0, this.bindFramebuffer.dirty = !0, this.bindRenderbuffer.dirty = !0, this.bindTexture.dirty = !0, this.bindVertexBuffer.dirty = !0, this.bindElementBuffer.dirty = !0, this.bindVertexArrayOES.dirty = !0, this.pixelStoreUnpack.dirty = !0, this.pixelStoreUnpackPremultiplyAlpha.dirty = !0, this.pixelStoreUnpackFlipY.dirty = !0; 47952 } 47953 createIndexBuffer(e1, t1, i) { 47954 return new Kn(this, e1, t1, i); 47955 } 47956 createVertexBuffer(e1, t1, i, s, r) { 47957 return new Qn(this, e1, t1, i, s, r); 47958 } 47959 createRenderbuffer(e1, t1, i) { 47960 const s = this.gl, r = s.createRenderbuffer(); 47961 return this.bindRenderbuffer.set(r), s.renderbufferStorage(s.RENDERBUFFER, e1, t1, i), this.bindRenderbuffer.set(null), r; 47962 } 47963 createFramebuffer(e1, t1, i, s) { 47964 return new Jn(this, e1, t1, i, s); 47965 } 47966 clear(param) { 47967 let { color: e1, depth: t1, stencil: i, colorMask: s } = param; 47968 const r = this.gl; 47969 let o = 0; 47970 e1 && (o |= r.COLOR_BUFFER_BIT, this.clearColor.set(e1.toNonPremultipliedRenderColor(null)), this.colorMask.set(s || [ 47971 !0, 47972 !0, 47973 !0, 47974 !0 47975 ])), void 0 !== t1 && (o |= r.DEPTH_BUFFER_BIT, this.depthRange.set([ 47976 0, 47977 1 47978 ]), this.clearDepth.set(t1), this.depthMask.set(!0)), void 0 !== i && (o |= r.STENCIL_BUFFER_BIT, this.clearStencil.set(i), this.stencilMask.set(255)), r.clear(o); 47979 } 47980 setCullFace(e1) { 47981 !1 === e1.enable ? this.cullFace.set(!1) : (this.cullFace.set(!0), this.cullFaceSide.set(e1.mode), this.frontFace.set(e1.frontFace)); 47982 } 47983 setDepthMode(e1) { 47984 e1.func !== this.gl.ALWAYS || e1.mask ? (this.depthTest.set(!0), this.depthFunc.set(e1.func), this.depthMask.set(e1.mask), this.depthRange.set(e1.range)) : this.depthTest.set(!1); 47985 } 47986 setStencilMode(e1) { 47987 e1.test.func !== this.gl.ALWAYS || e1.mask ? (this.stencilTest.set(!0), this.stencilMask.set(e1.mask), this.stencilOp.set([ 47988 e1.fail, 47989 e1.depthFail, 47990 e1.pass 47991 ]), this.stencilFunc.set({ 47992 func: e1.test.func, 47993 ref: e1.ref, 47994 mask: e1.test.mask 47995 })) : this.stencilTest.set(!1); 47996 } 47997 setColorMode(t1) { 47998 e1.O(t1.blendFunction, e1.a1.Replace) ? this.blend.set(!1) : (this.blend.set(!0), this.blendFunc.set(t1.blendFunction), this.blendColor.set(t1.blendColor), t1.blendEquation ? this.blendEquation.set(t1.blendEquation) : this.blendEquation.setDefault()), this.colorMask.set(t1.mask); 47999 } 48000 unbindVAO() { 48001 this.bindVertexArrayOES.set(null); 48002 } 48003 constructor(e1, t1){ 48004 this.gl = e1, this._pendingPrograms = new Set, this._compileStats = { 48005 precompiled: 0, 48006 onDemand: 0, 48007 totalStallMs: 0, 48008 maxStallMs: 0, 48009 framesMissed: 0, 48010 stalls: [] 48011 }, this.clearColor = new ir(this), this.clearDepth = new sr(this), this.clearStencil = new rr(this), this.colorMask = new or(this), this.depthMask = new nr(this), this.stencilMask = new ar(this), this.stencilFunc = new lr(this), this.stencilOp = new cr(this), this.stencilTest = new hr(this), this.depthRange = new dr(this), this.depthTest = new ur(this), this.depthFunc = new pr(this), this.blend = new fr(this), this.blendFunc = new mr(this), this.blendColor = new _r(this), this.blendEquation = new gr(this), this.cullFace = new yr(this), this.cullFaceSide = new vr(this), this.frontFace = new br(this), this.program = new xr(this), this.activeTexture = new wr(this), this.viewport = new Tr(this), this.bindFramebuffer = new Sr(this), this.bindRenderbuffer = new Cr(this), this.bindTexture = new Er(this), this.bindVertexBuffer = new Ir(this), this.bindElementBuffer = new Dr(this), this.bindVertexArrayOES = new Pr(this), this.pixelStoreUnpack = new Lr(this), this.pixelStoreUnpackPremultiplyAlpha = new Rr(this), this.pixelStoreUnpackFlipY = new Ar(this), this.options = t1 ? { 48012 ...t1 48013 } : {}, this.options.extTextureFilterAnisotropicForceOff || (this.extTextureFilterAnisotropic = e1.getExtension("EXT_texture_filter_anisotropic") || e1.getExtension("MOZ_EXT_texture_filter_anisotropic") || e1.getExtension("WEBKIT_EXT_texture_filter_anisotropic"), this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = e1.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))), this.extDebugRendererInfo = e1.getExtension("WEBGL_debug_renderer_info"), this.extDebugRendererInfo && (this.renderer = e1.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL), this.vendor = e1.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)), this.forceManualRenderingForInstanceIDShaders = t1 && !!t1.forceManualRenderingForInstanceIDShaders || this.renderer && this.renderer.includes("PowerVR"), this.options.extTextureFloatLinearForceOff || (this.extTextureFloatLinear = e1.getExtension("OES_texture_float_linear")), this.extRenderToTextureHalfFloat = e1.getExtension("EXT_color_buffer_half_float"), this.extColorBufferFloat = e1.getExtension("EXT_color_buffer_float"), this.extTimerQuery = e1.getExtension("EXT_disjoint_timer_query_webgl2"), this.maxTextureSize = e1.getParameter(e1.MAX_TEXTURE_SIZE), this.maxUniformBlockSize = Math.min(e1.getParameter(e1.MAX_UNIFORM_BLOCK_SIZE), 32768), this.maxUniformBufferBindings = e1.getParameter(e1.MAX_UNIFORM_BUFFER_BINDINGS), this.extBlendFuncExtended = e1.getExtension("WEBGL_blend_func_extended"), this.extParallelShaderCompile = e1.getExtension("KHR_parallel_shader_compile"); 48014 } 48015 } 48016 const ta = e1.Y(); 48017 function ia(t1) { 48018 const i = t1._camera.getWorldToCamera(t1.worldSize, 1), s = e1.X([], i, t1.globeMatrix); 48019 e1.aO(s, s); 48020 const r = [ 48021 0, 48022 0, 48023 0 48024 ], o = [ 48025 0, 48026 1, 48027 0, 48028 0 48029 ]; 48030 return e1.c7(o, o, s), r[0] = o[0], r[1] = o[1], r[2] = o[2], e1.ca(r, r), r; 48031 } 48032 function sa(param, n) { 48033 let { width: t1, height: i, anchor: s, textOffset: r, textScale: o } = param; 48034 const { horizontalAlign: a, verticalAlign: l } = e1.db(s), c = -(a - .5) * t1, h = -(l - .5) * i, d = e1.dc(s, r); 48035 return new e1.P((c / o + d[0]) * n, (h / o + d[1]) * n); 48036 } 48037 function ra(t1, i, s, r, o, n, a, l, c, h) { 48038 const d = t1.text.placedSymbolArray, u = t1.text.dynamicLayoutVertexArray, p = t1.icon.dynamicLayoutVertexArray, f = {}, m = t1.getProjection(), _ = vt(a, m, o), g = o.elevation, y = m.upVectorScale(a.canonical, o.center.lat, o.worldSize).metersToTile; 48039 u.clear(); 48040 for(let p = 0; p < d.length; p++){ 48041 const v = d.get(p), { tileAnchorX: b, tileAnchorY: x, numGlyphs: w } = v, T = v.hidden || !v.crossTileID || t1.allowVerticalPlacement && !v.placedOrientation ? null : r[v.crossTileID]; 48042 if (T) { 48043 let r = 0, d = 0, S = 0; 48044 const C = "road" === t1.elevationType; 48045 if (g || C) { 48046 const i = new e1.P(b, x); 48047 let s = 0; 48048 if (C && t1.hdExt) { 48049 const r = t1.symbolInstances.get(t1.text.symbolInstanceIndices[p]); 48050 if (t1.hdExt.isCrossTileRoadElevation(r.elevationFeatureIndex, a.canonical)) { 48051 const e1 = t1.hdExt.getRoadFeatureHeightForPlacedSymbol(t1, t1.text, p, i, a.canonical); 48052 s = null !== e1 ? e1 : 0; 48053 } else { 48054 const r = t1.hdExt.getElevationFeatureForPlacedSymbol(t1, t1.text, p); 48055 s = e1.c3.getAtTileOffset(a, i, g, void 0 !== r ? r : null); 48056 } 48057 } else s = e1.c3.getAtTileOffset(a, i, g, null); 48058 const [o, n, l] = m.upVector(a.canonical, b, x); 48059 r = s * o * y, d = s * n * y, S = s * l * y; 48060 } 48061 let [E, I, D, P] = e1.dl(v.projectedAnchorX + r, v.projectedAnchorY + d, v.projectedAnchorZ + S, s ? _ : n); 48062 const L = e1.d_(o.getCameraToCenterDistance(m), P);
48063 let R = e1.dv(t1.textSizeData, c, v) * L / e1.ds; 48064 s && (R *= t1.tilePixelRatio / l); 48065 const A = sa(T, R); 48066 s ? ({ x: E, y: I, z: D } = m.projectTilePoint(b + A.x, x + A.y, a.canonical), [E, I, D] = e1.dl(E + r, I + d, D + S, n)) : (i && A._rotate(-o.angle), E += A.x, I += A.y, D = 0); 48067 const M = t1.allowVerticalPlacement && v.placedOrientation === e1.da.vertical ? Math.PI / 2 : 0; 48068 for(let t1 = 0; t1 < w; t1++)e1.d$(u, E, I, D, M); 48069 h && v.associatedIconIndex >= 0 && (f[v.associatedIconIndex] = { 48070 x: E, 48071 y: I, 48072 z: D, 48073 angle: M 48074 }); 48075 } else e1.dZ(w, u); 48076 } 48077 if (h) { 48078 p.clear(); 48079 const i = t1.icon.placedSymbolArray; 48080 for(let t1 = 0; t1 < i.length; t1++){ 48081 const s = i.get(t1), { numGlyphs: r } = s, o = f[t1]; 48082 if (s.hidden || !o) e1.dZ(r, p); 48083 else { 48084 const { x: t1, y: i, z: s, angle: n } = o; 48085 for(let o = 0; o < r; o++)e1.d$(p, t1, i, s, n); 48086 } 48087 } 48088 t1.icon.dynamicLayoutVertexBuffer.updateData(p); 48089 } 48090 t1.text.dynamicLayoutVertexBuffer.updateData(u); 48091 } 48092 function oa(t1, i, s, r, o, n) { 48093 let a = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : {}; 48094 const l = s.paint.get("icon-translate"), c = s.paint.get("text-translate"), h = s.paint.get("icon-translate-anchor"), d = s.paint.get("text-translate-anchor"), u = s.layout.get("icon-rotation-alignment"), p = s.layout.get("text-rotation-alignment"), f = s.layout.get("icon-pitch-alignment"), m = s.layout.get("text-pitch-alignment"), _ = s.layout.get("icon-keep-upright"), g = s.layout.get("text-keep-upright"), y = s.paint.get("icon-color-saturation"), v = s.paint.get("icon-color-contrast"), b = s.paint.get("icon-color-brightness-min"), x = s.paint.get("icon-color-brightness-max"), w = "sea" === s.layout.get("symbol-elevation-reference"), T = "none" === s.layout.get("icon-image-use-theme"), S = t1.context, C = S.gl, E = t1.transform, I = "map" === u, D = "map" === p, P = "map" === f, L = "map" === m, R = void 0 !== s.layout.get("symbol-sort-key").constantOr(1); 48095 let A = !1; 48096 const M = t1.depthModeForSublayer(0, e1.Z.ReadOnly), O = new e1.Z(t1.context.gl.LEQUAL, e1.Z.ReadOnly, t1.depthRangeFor3D), F = [ 48097 e1.a7(E.center.lng), 48098 e1.a8(E.center.lat) 48099 ], k = s.layout.get("text-variable-anchor"), B = "globe" === E.projection.name, z = [], U = [ 48100 0, 48101 -1, 48102 0 48103 ]; 48104 for (const o of r){ 48105 const r = i.getTile(o), n = r.getBucket(s); 48106 if (!n) continue; 48107 if ("mercator" === n.projection.name && B) continue; 48108 if (n.fullyClipped) continue; 48109 const u = "globe" === n.projection.name, p = u ? e1.S(E.zoom) : 0, f = vt(o, n.getProjection(), E), m = E.calculatePixelsToTileUnitsMatrix(r), N = k && n.hasTextData(), j = n.hasIconTextFit() && N && n.hasIconData(), V = n.getProjection().createInversionMatrix(E, o.canonical), G = (1 << r.tileID.canonical.z) * e1.a6 / t1.transform.worldSize, q = (i)=>{ 48110 let s = [ 48111 0, 48112 0, 48113 0 48114 ]; 48115 if (i) { 48116 const i = t1.style.directionalLight, r = t1.style.ambientLight; 48117 i && r && (s = e1.aF(t1.style, i, r)); 48118 } 48119 return s; 48120 }, Z = (e1)=>{ 48121 const i = Math.floor(t1.context.maxUniformBlockSize / 4), s = Math.floor(i / 4); 48122 e1.push("MAX_UBO_SIZE_VEC4 ".concat(s, "u")); 48123 }, $ = (e1)=>{ 48124 E.depthOcclusionForSymbolsAndCircles && (s.hasOcclusionOpacityProperties || t1.terrain) && (e1.push("DEPTH_D24"), e1.push("DEPTH_OCCLUSION")); 48125 }, H = (i)=>{ 48126 s.lut && !T && (s.lut.texture || (s.lut.texture = new e1.e1(t1.context, s.lut.image, [ 48127 s.lut.image.height, 48128 s.lut.image.height, 48129 s.lut.image.height 48130 ], S.gl.RGBA8)), S.activeTexture.set(S.gl.TEXTURE0 + e1.cj.LUT), s.lut.texture && s.lut.texture.bind(S.gl.LINEAR, S.gl.CLAMP_TO_EDGE), i.push("APPLY_LUT_ON_GPU")); 48131 }, W = ()=>{ 48132 const i = I && "point" !== s.layout.get("symbol-placement"), a = []; 48133 $(a), H(a); 48134 const c = i || j, d = "road" === n.elevationType, g = t1.shadowRenderer, T = d && P && !!g && g.enabled, S = q(T), D = d && P && !t1.terrain ? O : M, L = s.paint.get("icon-image-cross-fade"); 48135 t1.terrainRenderModeElevated() && P && a.push("PITCH_WITH_MAP_TERRAIN"), u && (a.push("PROJECTION_GLOBE_VIEW"), c && a.push("PROJECTED_POS_ON_VIEWPORT")), L >
vendor: 105,262 bytes, lines 48135-49732
48135 0 && n.hasAnySecondaryIcon && a.push("ICON_TRANSITION"), !n.icon.zOffsetVertexBuffer || d && t1.terrain || a.push("Z_OFFSET"), 0 === y && 0 === v && 0 === b && 1 === x || a.push("COLOR_ADJUSTMENT"), T && a.push("RENDER_SHADOWS", "NORMAL_OFFSET"), d && P && !t1.terrain && n.icon.orientationVertexBuffer && a.push("ELEVATED_ROADS"), Z(a); 48136 const R = t1.getOrCreateProgram("symbol", { 48137 defines: a 48138 }), A = r.imageAtlasTexture ? r.imageAtlasTexture.size : [ 48139 0, 48140 0 48141 ], k = n.iconSizeData, z = e1.d5(k, E.zoom), N = P || !E.isOrthographic, W = e1.dY(f, r.tileID.canonical, P, I, E, n.getProjection(), m), X = e1.d4(f, r.tileID.canonical, P, I, E, n.getProjection(), m), K = n.icon.uboBinder && n.icon.uboBinder.hasPerFeatureTranslate() ? [ 48142 0, 48143 0 48144 ] : l, Y = t1.translatePosMatrix(X, r, K, h, !0), Q = t1.translatePosMatrix(f, r, K, h), J = c ? ta : W, ee = I && !P && !i; 48145 let te = U; 48146 !B && !E.mercatorFromTransition || I || (te = ia(E)); 48147 const ie = u ? te : U, se = s.getColorAdjustmentMatrix(y, v, b, x), re = ho(k.kind, z, ee, P, t1, Q, J, Y, w, !1, n.sdfIcons, A, [ 48148 0, 48149 0 48150 ], 0, o, p, F, V, ie, n.getProjection(), S, G, se, L, null), oe = r.imageAtlasTexture ? r.imageAtlasTexture : null, ne = 1 !== s.layout.get("icon-size").constantOr(0) || n.iconsNeedLinear, ae = n.sdfIcons || t1.options.rotating || t1.options.zooming || ne || N ? C.LINEAR : C.NEAREST, le = n.sdfIcons && 0 !== s.paint.get("icon-halo-width").constantOr(1), ce = t1.terrain && P && i ? e1.aO(e1.Y(), W) : ta; 48151 if (i && n.icon) { 48152 const i = e1.c3.getAtTileOffsetFunc(o, E.center.lat, E.worldSize, n.getProjection()), a = e1.d3(f, r.tileID.canonical, P, I, E, n.getProjection(), m), l = s.layout.get("icon-size-scale-range"), c = e1.b0(t1.scaleFactor, l[0], l[1]); 48153 e1.e0(n, f, t1, !1, a, X, P, _, i, o, c); 48154 } 48155 return { 48156 program: R, 48157 buffers: n.icon, 48158 uniformValues: re, 48159 atlasTexture: oe, 48160 atlasTextureIcon: null, 48161 atlasInterpolation: ae, 48162 atlasInterpolationIcon: null, 48163 isSDF: n.sdfIcons, 48164 hasHalo: le, 48165 depthMode: D, 48166 tile: r, 48167 renderWithShadows: T, 48168 labelPlaneMatrixInv: ce 48169 }; 48170 }, X = ()=>{ 48171 const i = D && "point" !== s.layout.get("symbol-placement"), a = [], l = i || k || j, h = "road" === n.elevationType, _ = t1.shadowRenderer, y = h && L && !!_ && _.enabled, v = q(y), b = h && L && !t1.terrain ? O : M; 48172 t1.terrainRenderModeElevated() && L && a.push("PITCH_WITH_MAP_TERRAIN"), u && (a.push("PROJECTION_GLOBE_VIEW"), l && a.push("PROJECTED_POS_ON_VIEWPORT")), !n.text.zOffsetVertexBuffer || h && t1.terrain || a.push("Z_OFFSET"), n.iconsInText && a.push("RENDER_TEXT_AND_SYMBOL"), y && a.push("RENDER_SHADOWS", "NORMAL_OFFSET"), h && L && !t1.terrain && n.text.orientationVertexBuffer && a.push("ELEVATED_ROADS"), $(a), Z(a); 48173 const x = t1.getOrCreateProgram("symbol", { 48174 defines: a 48175 }); 48176 let T, S = [ 48177 0, 48178 0 48179 ], I = null; 48180 const P = n.textSizeData; 48181 n.iconsInText && (S = r.imageAtlasTexture ? r.imageAtlasTexture.size : [ 48182 0, 48183 0 48184 ], I = r.imageAtlasTexture ? r.imageAtlasTexture : null, T = L || !E.isOrthographic || t1.options.rotating || t1.options.zooming || "composite" === P.kind || "camera" === P.kind ? C.LINEAR : C.NEAREST); 48185 const R = r.glyphAtlasTexture ? r.glyphAtlasTexture.size : [ 48186 0, 48187 0 48188 ], A = s.layout.get("text-size-scale-range"), z = e1.b0(t1.scaleFactor, A[0], A[1]), N = e1.d5(P, E.zoom, z), H = e1.dY(f, r.tileID.canonical, L, D, E, n.getProjection(), m), W = e1.d4(f, r.tileID.canonical, L, D, E, n.getProjection(), m), X = n.text.uboBinder && n.text.uboBinder.hasPerFeatureTranslate() ? [ 48189 0, 48190 0 48191 ] : c, K = t1.translatePosMatrix(W, r, X, d, !0), Y = t1.translatePosMatrix(f, r, X, d), Q = l ? ta : H, J = D && !L && !i; 48192 let ee = U; 48193 !B && !E.mercatorFromTransition || D || (ee = ia(E)); 48194 const te = ho(P.kind, N, J, L, t1, Y, Q, K, w, !0, !0, R, S, 0, o, p, F, V, u ? ee : U, n.getProjection(), v, G, null, null, z), ie = r.glyphAtlasTexture ? r.glyphAtlasTexture : null, se = C.LINEAR, re = 0 !== s.paint.get("text-halo-width").constantOr(1), oe = t1.terrain && L && i ? e1.aO(e1.Y(), H) : ta; 48195 if (i && n.text) { 48196 const i = e1.c3.getAtTileOffsetFunc(o, E.center.lat, E.worldSize, n.getProjection()), s = e1.d3(f, r.tileID.canonical, L, D, E, n.getProjection(), m); 48197 e1.e0(n, f, t1, !0, s, W, L, g, i, o, z); 48198 } 48199 return { 48200 program: x, 48201 buffers: n.text, 48202 uniformValues: te, 48203 atlasTexture: ie, 48204 atlasTextureIcon: I, 48205 atlasInterpolation: se, 48206 atlasInterpolationIcon: T, 48207 isSDF: !0, 48208 hasHalo: re, 48209 depthMode: b, 48210 tile: r, 48211 renderWithShadows: y, 48212 labelPlaneMatrixInv: oe 48213 }; 48214 }, K = n.icon.segments.get().length, Y = n.text.segments.get().length, Q = K && !a.onlyText ? W() : null, J = Y && !a.onlyIcons ? X() : null, ee = s.paint.get("icon-opacity").constantOr(1), te = s.paint.get("text-opacity").constantOr(1); 48215 if (R && n.canOverlap) { 48216 A = !0; 48217 const t1 = ee && !a.onlyText ? n.icon.segments.get() : [], i = te && !a.onlyIcons ? n.text.segments.get() : []; 48218 for (const i of t1)z.push({ 48219 segments: new e1.ac([ 48220 i 48221 ]), 48222 sortKey: i.sortKey, 48223 state: Q 48224 }); 48225 for (const t1 of i)z.push({ 48226 segments: new e1.ac([ 48227 t1 48228 ]), 48229 sortKey: t1.sortKey, 48230 state: J 48231 }); 48232 } else a.onlyText || z.push({ 48233 segments: ee ? n.icon.segments : new e1.ac([]), 48234 sortKey: 0, 48235 state: Q 48236 }), a.onlyIcons || z.push({ 48237 segments: te ? n.text.segments : new e1.ac([]), 48238 sortKey: 0, 48239 state: J 48240 }); 48241 } 48242 A && z.sort((e1, t1)=>e1.sortKey - t1.sortKey); 48243 for (const e1 of z){ 48244 const i = e1.state; 48245 if (i) if (t1.terrain ? t1.terrain.setupElevationDraw(i.tile, i.program, { 48246 useDepthForOcclusion: E.depthOcclusionForSymbolsAndCircles, 48247 labelPlaneMatrixInv: i.labelPlaneMatrixInv 48248 }) : t1.setupDepthForOcclusion(E.depthOcclusionForSymbolsAndCircles, i.program), S.activeTexture.set(C.TEXTURE0), i.atlasTexture && i.atlasTexture.bind(i.atlasInterpolation, C.CLAMP_TO_EDGE, !0), i.atlasTextureIcon && (S.activeTexture.set(C.TEXTURE1), i.atlasTextureIcon && i.atlasTextureIcon.bind(i.atlasInterpolationIcon, C.CLAMP_TO_EDGE, !0)), i.renderWithShadows && t1.shadowRenderer.setupShadows(i.tile.tileID.toUnwrapped(), i.program, "vector-tile"), t1.uploadCommonLightUniforms(t1.context, i.program), i.hasHalo) { 48249 const r = i.uniformValues; 48250 r.u_is_halo = 1, na(i.buffers, e1.segments, s, t1, i.program, i.depthMode, o, n, r, 2), r.u_is_halo = 0; 48251 } else { 48252 if (i.isSDF) { 48253 const r = i.uniformValues; 48254 i.hasHalo && (r.u_is_halo = 1, na(i.buffers, e1.segments, s, t1, i.program, i.depthMode, o, n, r, 1)), r.u_is_halo = 0; 48255 } 48256 na(i.buffers, e1.segments, s, t1, i.program, i.depthMode, o, n, i.uniformValues, 1); 48257 } 48258 } 48259 } 48260 function na(t1, i, s, r, o, n, a, l, c, h) { 48261 const d = r.context, u = d.gl, p = [ 48262 t1.dynamicLayoutVertexBuffer, 48263 t1.opacityVertexBuffer, 48264 t1.iconTransitioningVertexBuffer, 48265 t1.globeExtVertexBuffer, 48266 t1.zOffsetVertexBuffer, 48267 t1.orientationVertexBuffer 48268 ]; 48269 t1.featureIdBuffer && p.push(t1.featureIdBuffer); 48270 const f = t1.uboBinder ? null : t1.programConfigurations.get(s.id); 48271 if (t1.uboBinder) { 48272 t1.uboBinder.layer = s; 48273 const e1 = r.transform.zoom, i = r.style.getBrightness ? r.style.getBrightness() : null, o = t1.uboBinder.getConstantUniformValues(e1, i); 48274 c.u_spp_fill_np_color = o.fill_np_color, c.u_spp_halo_np_color = o.halo_np_color, c.u_spp_opacity = o.opacity, c.u_spp_halo_width = o.halo_width, c.u_spp_halo_blur = o.halo_blur, c.u_spp_emissive_strength = o.emissive_strength, c.u_spp_occlusion_opacity = o.occlusion_opacity, c.u_spp_z_offset = o.z_offset, c.u_spp_zoom_fraction = e1 - t1.uboBinder._floorZoom; 48275 const n = s.paint.get(t1.uboBinder.isText ? "text-translate-anchor" : "icon-translate-anchor"), a = t1.uboBinder.hasPerFeatureTranslate() && "map" === n ? r.transform.angle : 0; 48276 c.u_spp_translate_rotation = [ 48277 Math.cos(a), 48278 Math.sin(a) 48279 ]; 48280 } 48281 const { batchIndices: m, batchSegments: _ } = t1.getBatchGrouping(i); 48282 for (const i of m){ 48283 const m = _.get(i); 48284 t1.uboBinder && t1.uboBinder.bind(d, o.program, i), o.draw(r, u.TRIANGLES, n, a, l, e1.$.disabled, c, s.id, t1.layoutVertexBuffer, t1.indexBuffer, m, s.paint, r.transform.zoom, f, p, h); 48285 } 48286 } 48287 function aa(t1, i, s, r, o, n) { 48288 const a = s.paint.get("line-width"), l = s.paint.get("line-emissive-strength").isConstant(), c = s.paint.get("line-emissive-strength").constantOr(0), h = s.paint.get("line-occlusion-opacity"), d = s.layout.get("line-elevation-reference"), u = "meters" === s.layout.get("line-width-unit"), p = "sea" === d, f = !(!t1.terrain || !t1.terrain.enabled), m = t1.context, _ = m.gl; 48289 if (s.hasElevatedBuckets && "globe" === t1.transform.projection.name) return; 48290 const g = s.layout.get("line-cross-slope"), y = void 0 !== g, v = g < 1, b = o || t1.colorModeForDrapableLayerRenderPass(l ? c : null), x = t1.terrain && t1.terrain.renderingToTexture || n, w = x ? 1 : e1.e.devicePixelRatio, T = s.paint.get("line-dasharray"), S = T.constantOr(1), C = s.layout.get("line-cap"), E = T.constantOr(null), I = C.constantOr(null), D = s.paint.get("line-pattern"), P = D.constantOr(1), L = s.paint.get("line-pattern-cross-fade"), R = D.constantOr(null), A = s.paint.get("line-opacity").constantOr(1); 48291 let M = !P && 1 !== A || t1.depthOcclusion && h > 0 && h < 1; 48292 const O = s.paint.get("line-gradient"), F = 0 !== s.paint.get("line-border-width").constantOr(1) ? s.paint.get("line-border-gradient") : null, k = P ? "linePattern" : "line", B = e1.e4(s); 48293 let z; 48294 if (x && t1.terrain && t1.terrain.clipOrMaskOverlapStencilType() && (M = !1), 0 !== h && t1.depthOcclusion) { 48295 const t1 = s.paint._values["line-opacity"]; 48296 t1 && t1.value && "constant" === t1.value.kind ? z = t1.value : e1.w("Occlusion opacity for layer ".concat(s.id, " is supported only when line-opacity isn't data-driven.")); 48297 } 48298 "constant" !== a.value.kind && !1 === a.value.isLineProgressConstant && B.push("VARIABLE_LINE_WIDTH"); 48299 const U = s.paint.get("line-emissive-strength"); 48300 P || "constant" === U.value.kind || !1 !== U.value.isLineProgressConstant || B.push("VARIABLE_LINE_EMISSIVE_STRENGTH"), t1._debugParams.showElevationIdDebug && B.push("DEBUG_ELEVATION_ID"), x && ("dual-source-blending" !== t1.emissiveMode || l ? "mrt-fallback" === t1.emissiveMode && B.push("USE_MRT1") : B.push("DUAL_SOURCE_BLENDING")); 48301 const N = {}, j = [], V = (r, o, n, a, l, c)=>{ 48302 for (const d of r){ 48303 const r = i.getTile(d); 48304 if (P && !r.patternsLoaded()) continue; 48305 const p = r.getBucket(s); 48306 if (!p) continue; 48307 if ("none" !== p.elevationType && !l || "none" === p.elevationType && l) continue; 48308 t1.prepareDrawTile(); 48309 const f = [ 48310 ...o 48311 ], g = "road" === p.elevationType, y = t1.shadowRenderer, v = g && !!y && y.enabled; 48312 let T = [ 48313 0, 48314 0, 48315 0 48316 ]; 48317 if (v) { 48318 const i = t1.style.directionalLight, s = t1.style.ambientLight; 48319 i && s && (T = e1.aF(t1.style, i, s)), f.push("RENDER_SHADOWS", "NORMAL_OFFSET"); 48320 } 48321 const C = p.programConfigurations.get(s.id); 48322 let D = !1; 48323 if (R && r.imageAtlas) { 48324 const t1 = e1.aG.from(R), i = t1.getPrimary().scaleSelf(w).toString(), s = r.imageAtlas.patternPositions.get(i), o = t1.getSecondary(), n = o ? r.imageAtlas.patternPositions.get(o.scaleSelf(w).toString()) : null; 48325 D = !!s && !!n, s && C.setConstantPatternPositions(s, n); 48326 } 48327 L > 0 && (D || C.getPatternTransitionVertexBuffer("line-pattern")) && f.push("LINE_PATTERN_TRANSITION"), p.elevationGroundScaleVertexBuffer && f.push("ELEVATION_GROUND_SCALE"); 48328 const B = t1.isTileAffectedByFog(d), U = t1.getOrCreateProgram(k, { 48329 config: C, 48330 defines: f, 48331 overrideFog: B 48332 }); 48333 if (!P && E && I && r.lineAtlas) { 48334 const e1 = r.lineAtlas.getDash(E, I); 48335 e1 && C.setConstantPatternPositions(e1); 48336 } 48337 v && y.setupShadows(r.tileID.toUnwrapped(), U, "vector-tile"); 48338 let [V, G] = s.paint.get("line-trim-offset"); 48339 if ("round" === I || "square" === I) { 48340 const e1 = 1; 48341 V !== G && (0 === V && (V -= e1), 1 === G && (G += e1)); 48342 } 48343 const q = x ? d.projMatrix : null, Z = u ? 1 / p.tileToMeter / e1.ce(r, 1, t1.transform.zoom) : 1, $ = u ? 1 / p.tileToMeter / e1.ce(r, 1, Math.floor(t1.transform.zoom)) : 1, H = S ? s.paint._values["line-floorwidth"] : null; 48344 let W; 48345 const X = r.dashIdealZ; 48346 if (H && "constant" === H.value.kind && X !== r.tileID.overscaledZ) { 48347 const e1 = p.zoom; 48348 e1 in N || (N[e1] = Math.max(.01, s.widthExpression().evaluate({ 48349 zoom: e1 48350 }))), W = H.value.value, H.value.value = N[e1] * Math.pow(2, X - e1); 48351 } 48352 const K = P ? e1.e5(t1, r, s, q, w, Z, $, [ 48353 V, 48354 G 48355 ], T, L) : e1.e6(t1, r, s, q, p.lineClipsArray.length, w, Z, $, [ 48356 V, 48357 G 48358 ], T), Y = (r, o, n, a, l, c)=>{ 48359 let h = r.texture; 48360 if (o !== r.version) { 48361 let c = 256; 48362 if (n) { 48363 const s = i.getSource().maxzoom, r = d.canonical.z === s ? Math.ceil(1 << t1.transform.maxZoom - d.canonical.z) : 1; 48364 c = e1.b0(e1.e7(p.maxLineLength / e1.a6 * 1024 * r), 256, m.maxTextureSize); 48365 } 48366 r.gradient = e1.e8({ 48367 expression: a, 48368 evaluationKey: "lineProgress", 48369 resolution: c, 48370 image: r.gradient || void 0, 48371 clips: p.lineClipsArray, 48372 lut: l ? null : s.lut 48373 }), r.texture ? r.texture.update(r.gradient) : r.texture = new e1.T(m, r.gradient, _.RGBA8), r.version = o, h = r.texture; 48374 } 48375 m.activeTexture.set(c), h.bind(n ? _.NEAREST : _.LINEAR, _.CLAMP_TO_EDGE); 48376 }; 48377 O && Y(p.gradients[s.id], s.gradientVersion, s.stepInterpolant, s.gradientExpression(), "none" === s.paint.get("line-gradient-use-theme").constantOr("default"), _.TEXTURE1), F && Y(p.borderGradients[s.id], s.borderGradientVersion, s.borderStepInterpolant, s.borderGradientExpression(), "none" === s.paint.get("line-border-gradient-use-theme").constantOr("default"), _.TEXTURE2), S && (m.activeTexture.set(_.TEXTURE0), r.lineAtlasTexture && r.lineAtlasTexture.bind(_.LINEAR, _.REPEAT), C.updatePaintBuffers()), P && (m.activeTexture.set(_.TEXTURE0), r.imageAtlasTexture && r.imageAtlasTexture.bind(_.LINEAR, _.CLAMP_TO_EDGE), C.updatePaintBuffers()), l && !g && t1.terrain.setupElevationDraw(r, U), t1.uploadCommonUniforms(m, U, d.toUnwrapped()); 48378 const Q = Xs.drawLineFrcCoverageDetect ? Xs.drawLineFrcCoverageDetect(t1, p, d, l, K, C, U, n, b, j) : null, J = (i, r, o)=>{ 48379 r && 0 !== r.get().length && (null != z && (z.value = A * h), void 0 !== o && (K.u_opacity_multiplier = o), U.draw(t1, _.TRIANGLES, n, i, b, e1.$.disabled, K, s.id, p.layoutVertexBuffer, p.indexBuffer, r, s.paint, t1.transform.zoom, C, [ 48380 p.layoutVertexBuffer2, 48381 p.patternVertexBuffer, 48382 p.zOffsetVertexBuffer, 48383 p.elevationIdColVertexBuffer, 48384 p.elevationGroundScaleVertexBuffer 48385 ]), void 0 !== o && (K.u_opacity_multiplier = 1), null != z && (z.value = A)); 48386 }, ee = (e1)=>{ 48387 Q && Q.active && Xs.drawLineFrcRenderLine ? Xs.drawLineFrcRenderLine(p, Q, e1, J) : J(e1, p.segments); 48388 }; 48389 if (M && !l) { 48390 const i = t1.stencilModeForClipping(d).ref; 48391 0 === i && x && m.clear({ 48392 stencil: 0 48393 }); 48394 const s = { 48395 func: _.EQUAL, 48396 mask: 255 48397 }; 48398 K.u_alpha_discard_threshold = .8, ee(new e1._(s, i, 255, _.KEEP, _.KEEP, _.INVERT)), K.u_alpha_discard_threshold = 0, ee(new e1._(s, i, 255, _.KEEP, _.KEEP, _.KEEP)); 48399 } else K.u_alpha_discard_threshold = M && l && c ? .8 : 0, ee(l ? a : t1.stencilModeForClipping(d)); 48400 Q && Xs.drawLineFrcFadePass && Xs.drawLineFrcFadePass(t1, p, d, Q, l, a, J), void 0 !== W && (H.value.value = W); 48401 } 48402 }; 48403 let G = t1.depthModeForSublayer(0, e1.Z.ReadOnly); 48404 const q = new e1.Z(t1.depthOcclusion ? _.GREATER : _.LEQUAL, e1.Z.ReadOnly, t1.depthRangeFor3D); 48405 if (s.hasNonElevatedBuckets) { 48406 const i = !x && t1.terrain; 48407 0 !== h && i ? e1.w("Occlusion opacity for layer ".concat(s.id, " is supported on terrain only if the layer has line-z-offset enabled.")) : i ? e1.w("Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ".concat(s.id, ".")) : V(r, B, G, e1._.disabled, !1, !0); 48408 } 48409 if (s.hasElevatedBuckets) { 48410 "hd-road-markup" === d ? f || (G = q, B.push("ELEVATED_ROADS")) : (B.push("ELEVATED"), G = q, y && B.push(v ? "CROSS_SLOPE_HORIZONTAL" : "CROSS_SLOPE_VERTICAL"), p && B.push("ELEVATION_REFERENCE_SEA")); 48411 const i = M ? t1.stencilModeFor3D() : e1._.disabled; 48412 "hd-road-markup" !== d && (t1.forceTerrainMode = !0), V(r, B, G, i, !0, !0), M && V(r, B, G, i, !0, !1), "hd-road-markup" !== d && (t1.forceTerrainMode = !1); 48413 } 48414 Xs.drawLineFrcCoverageSecondPass && Xs.drawLineFrcCoverageSecondPass(t1, s, j), M && (t1.resetStencilClippingMasks(), x && m.clear({ 48415 stencil: 0 48416 })), 0 === h || t1.depthOcclusion || x || t1.layersWithOcclusionOpacity.push(t1.currentLayer); 48417 } 48418 class la { 48419 destroy() { 48420 this.fbo && (this.fbo.destroy(), this.fbo = null), this.drapeFbo && (this.drapeFbo.destroy(), this.drapeFbo = null); 48421 } 48422 } 48423 class ca { 48424 destroy(e1) { 48425 this.sync && (e1.deleteSync(this.sync), this.sync = null), e1.deleteBuffer(this.pbo), this.fboA && (this.fboA.destroy(), this.fboA = null), this.fboB && (this.fboB.destroy(), this.fboB = null); 48426 } 48427 constructor(e1){ 48428 this.pbo = e1.createBuffer(), this.sync = null, this.fboA = null, this.fboB = null, this.maxDensity = 0; 48429 } 48430 } 48431 const ha = { 48432 additive: { 48433 clearColor: new e1.C(0, 0, 0, 0), 48434 colorMode: e1.a1.additiveAlphaWeighted, 48435 compositeUniformValue: 1 48436 }, 48437 multiply: { 48438 clearColor: new e1.C(1, 1, 1, 1), 48439 colorMode: e1.a1.multiply, 48440 compositeUniformValue: 0 48441 } 48442 }; 48443 function da(e1) { 48444 return !(!e1.extRenderToTextureHalfFloat && !e1.extColorBufferFloat); 48445 } 48446 function ua(t1, i) { 48447 return "additive" === t1 && da(i) ? e1.a1.additiveAlphaWeightedUnboundedAlpha : ha[t1].colorMode; 48448 } 48449 function pa(t1, i, s) { 48450 const r = t1.context, o = r.gl; 48451 let n = s.width, a = s.height, l = s.colorAttachment0.get(); 48452 i.lineBlendDensityReadback || (i.lineBlendDensityReadback = new ca(o)); 48453 const c = i.lineBlendDensityReadback; 48454 let h = 0, d = !0; 48455 for(; n > 1 || a > 1;){ 48456 const s = Math.max(1, Math.floor(n / 2)), u = Math.max(1, Math.floor(a / 2)), p = 0 === h ? "fboA" : "fboB"; 48457 c[p] = Jn.createWithTexture(r, c[p], s, u, !1); 48458 const f = c[p]; 48459 r.bindFramebuffer.set(f.framebuffer), r.viewport.set([ 48460 0, 48461 0, 48462 s, 48463 u 48464 ]), r.activeTexture.set(o.TEXTURE0), o.bindTexture(o.TEXTURE_2D, l), t1.getOrCreateProgram("lineBlendReduce").draw(t1, o.TRIANGLES, e1.Z.disabled, e1._.disabled, e1.a1.unblended, e1.$.disabled, so(0, [ 48465 1 / n, 48466 1 / a 48467 ], d), i.id, t1.viewportBuffer, t1.quadTriangleIndexBuffer, t1.viewportSegments, i.paint, t1.transform.zoom), n = s, a = u, l = f.colorAttachment0.get(), h = 1 - h, d = !1; 48468 } 48469 const u = da(r), p = u ? 16 : 4; 48470 c.sync && (o.deleteSync(c.sync), c.sync = null), o.bindBuffer(o.PIXEL_PACK_BUFFER, c.pbo), o.bufferData(o.PIXEL_PACK_BUFFER, p, o.STREAM_READ), o.readPixels(0, 0, 1, 1, o.RGBA, u ? o.FLOAT : o.UNSIGNED_BYTE, 0), o.bindBuffer(o.PIXEL_PACK_BUFFER, null), c.sync = o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE, 0), r.viewport.set([ 48471 0, 48472 0, 48473 t1.width, 48474 t1.height 48475 ]); 48476 } 48477 function fa(e1, t1, i) { 48478 if (!da(e1.context)) return; 48479 const s = t1.lineBlendDensityReadback; 48480 s && s.sync ? (function(e1, t1, i) { 48481 if (e1.sync && t1.getSyncParameter(e1.sync, t1.SYNC_STATUS) === t1.SIGNALED) { 48482 if (t1.deleteSync(e1.sync), e1.sync = null, t1.bindBuffer(t1.PIXEL_PACK_BUFFER, e1.pbo), da(i)) { 48483 const i = new Float32Array(4); 48484 t1.getBufferSubData(t1.PIXEL_PACK_BUFFER, 0, i); 48485 const s = i[1]; 48486 e1.maxDensity = Math.max(2 * (s > 0 ? i[0] / s : 0), 1); 48487 } else e1.maxDensity = 1; 48488 t1.bindBuffer(t1.PIXEL_PACK_BUFFER, null); 48489 } 48490 }(s, e1.context.gl, e1.context), s.sync || (pa(e1, t1, i), e1.style.map.triggerRepaint())) : (pa(e1, t1, i), e1.style.map.triggerRepaint()); 48491 } 48492 function ma(t1, i, s, r, o, n) { 48493 const a = t1.context, l = a.gl, c = "additive" === s ? 1 : i.paint.get("line-opacity").constantOr(1), h = "additive" === s ? function(e1, t1) { 48494 const i = t1.paint.get("line-blend-additive-clamp"); 48495 if (i > 0) return i; 48496 const s = t1.lineBlendDensityReadback; 48497 return s && 0 !== s.maxDensity ? s.maxDensity : null; 48498 }(0, i) : 1; 48499 if (null === h) return; 48500 a.bindFramebuffer.set(o), n && a.viewport.set([ 48501 0, 48502 0, 48503 n[0], 48504 n[1] 48505 ]), a.activeTexture.set(l.TEXTURE0), l.bindTexture(l.TEXTURE_2D, r.colorAttachment0.get()); 48506 const d = ua(s, t1.context); 48507 t1.getOrCreateProgram("lineBlendComposite").draw(t1, l.TRIANGLES, e1.Z.disabled, e1._.disabled, d, e1.$.disabled, ((e1, t1, i, s)=>({ 48508 u_image: 0, 48509 u_opacity: t1, 48510 u_blend_mode: i, 48511 u_max_density: s 48512 }))(0, c, ha[s].compositeUniformValue, h), i.id, t1.viewportBuffer, t1.quadTriangleIndexBuffer, t1.viewportSegments, i.paint, t1.transform.zoom); 48513 } 48514 function _a(t1, i, s, r) { 48515 const { painter: o, sourceCache: n, layer: a, coords: l, colorMode: c, elevationType: h, terrainEnabled: d, pass: u } = t1, p = o.context.gl, f = a.paint.get("fill-pattern"), m = a.paint.get("fill-pattern-cross-fade"), _ = f.constantOr(null); 48516 let g = h; 48517 "road" !== h || i && !d || (g = "none"); 48518 const y = "road" === g, v = t1.painter.shadowRenderer, b = y && !!v && v.enabled, x = new e1.Z(o.context.gl.LEQUAL, e1.Z.ReadOnly, o.depthRangeFor3D); 48519 let w = [ 48520 0, 48521 0, 48522 0 48523 ]; 48524 if (b) { 48525 const t1 = o.style.directionalLight, i = o.style.ambientLight; 48526 t1 && i && (w = e1.aF(o.style, t1, i)); 48527 } 48528 const T = f && f.constantOr(1), S = o.terrain && o.terrain.renderingToTexture, C = (t1, u)=>{ 48529 let f, g, C, E, I; 48530 u ? (f = T && !a.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline", C = p.LINES) : (f = T ? "fillPattern" : "fill", C = p.TRIANGLES); 48531 const D = []; 48532 for (const P of l){ 48533 const l = n.getTile(P); 48534 if (T && !l.patternsLoaded()) continue; 48535 const L = l.getBucket(a); 48536 if (!L) continue; 48537 const R = i ? L.hdExt && L.hdExt.elevationBufferData : L.bufferData; 48538 if (!R || R.isEmpty()) continue; 48539 o.prepareDrawTile(); 48540 const A = R.programConfigurations.get(a.id), M = o.isTileAffectedByFog(P), O = [], F = []; 48541 y && (O.push("ELEVATED_ROADS"), F.push(R.elevatedLayoutVertexBuffer)), b && O.push("RENDER_SHADOWS", "NORMAL_OFFSET"), S && s && O.push("USE_MRT1"), T && (o.context.activeTexture.set(p.TEXTURE0), l.imageAtlasTexture && l.imageAtlasTexture.bind(p.LINEAR, p.CLAMP_TO_EDGE), A.updatePaintBuffers()); 48542 let k = !1; 48543 if (_ && l.imageAtlas) { 48544 const t1 = l.imageAtlas, i = e1.aG.from(_), s = i.getPrimary().scaleSelf(e1.e.devicePixelRatio).toString(), r = i.getSecondary(), o = t1.patternPositions.get(s), n = r ? t1.patternPositions.get(r.scaleSelf(e1.e.devicePixelRatio).toString()) : null; 48545 k = !!o && !!n, o && A.setConstantPatternPositions(o, n); 48546 } 48547 m > 0 && (k || A.getPatternTransitionVertexBuffer("fill-pattern")) && O.push("FILL_PATTERN_TRANSITION"); 48548 const B = o.getOrCreateProgram(f, { 48549 config: A, 48550 overrideFog: M, 48551 defines: O 48552 }), z = o.translatePosMatrix(P.projMatrix, l, a.paint.get("fill-translate"), a.paint.get("fill-translate-anchor")); 48553 b && v.setupShadows(l.tileID.toUnwrapped(), B, "vector-tile"); 48554 const U = a.paint.get("fill-emissive-strength"); 48555 if (u) { 48556 E = R.lineIndexBuffer, I = R.lineSegments; 48557 const e1 = o.terrain && o.terrain.renderingToTexture ? o.terrain.drapeBufferSize : [ 48558 p.drawingBufferWidth, 48559 p.drawingBufferHeight 48560 ]; 48561 g = "fillOutlinePattern" === f && T ? io(z, U, o, l, e1, w, m) : to(z, U, e1, w); 48562 } else E = R.indexBuffer, I = R.triangleSegments, g = T ? eo(z, U, o, l, w, m) : Jr(z, U, w); 48563 o.uploadCommonUniforms(o.context, B, P.toUnwrapped()); 48564 let N = t1; 48565 if (("road" === h && !d || "offset" === h) && (N = x), !I || I.get && 0 === I.get().length) continue; 48566 const j = r || o.stencilModeForClipping(P); 48567 let V = "fallthrough"; 48568 !u && Xs.drawFillFrcCoverageFirstPass && (V = Xs.drawFillFrcCoverageFirstPass({ 48569 painter: o, 48570 layer: a, 48571 bucket: L, 48572 coord: P, 48573 elevatedGeometry: i, 48574 program: B, 48575 programConfiguration: A, 48576 uniformValues: g, 48577 drawMode: C, 48578 depthMode: N, 48579 stencilMode: j, 48580 colorMode: c, 48581 bufferData: R, 48582 indexBuffer: E, 48583 segments: I, 48584 dynamicBuffers: F, 48585 polygonCoverageTiles: D 48586 })), "fallthrough" === V && B.draw(o, C, N, j, c, e1.$.disabled, g, a.id, R.layoutVertexBuffer, E, I, a.paint, o.transform.zoom, A, F); 48587 } 48588 !u && Xs.drawFillFrcCoverageSecondPass && Xs.drawFillFrcCoverageSecondPass(o, a, D, C, c); 48589 }; 48590 o.renderPass === u && C(o.depthModeForSublayer(1, "opaque" === o.renderPass ? e1.Z.ReadWrite : e1.Z.ReadOnly), !1), "none" === g && "translucent" === o.renderPass && a.paint.get("fill-antialias") && C(o.depthModeForSublayer(a.getPaintProperty("fill-outline-color") ? 2 : 0, e1.Z.ReadOnly), !0); 48591 } 48592 function ga(t1) { 48593 return [ 48594 t1[0] * e1.ea, 48595 t1[1] * e1.ea, 48596 t1[2] * e1.ea, 48597 0 48598 ]; 48599 } 48600 function ya(t1, i, s, r, o, n, a, l, c, h) { 48601 const d = o.getSource(), u = r.globeSharedBuffers; 48602 if (!u) return; 48603 let p, f, m; 48604 if (s && (p = o.getTile(s)), d instanceof Co ? (f = d.texture, m = e1.c2(0, 0, r.transform)) : p && s && (f = p.texture, m = e1.c2(s.canonical.z, s.canonical.x, r.transform)), !f || !m) return; 48605 i || (m = e1.aN(e1.Y(), m, [ 48606 1, 48607 -1, 48608 1 48609 ])); 48610 const _ = r.context, g = _.gl, y = "nearest" === n.paint.get("raster-resampling") ? g.NEAREST : g.LINEAR, v = r.colorModeForDrapableLayerRenderPass(a), b = l.defines; 48611 b.push("GLOBE_POLES"); 48612 const x = new e1.Z(g.LEQUAL, e1.Z.ReadWrite, r.depthRangeFor3D), w = r.transform.expandedFarZProjMatrix, T = Float32Array.from(e1.b4(e1.b5(new e1.bX(0, 0, 0)))); 48613 r.terrain && r.terrain.prepareDrawTile(), _.activeTexture.set(g.TEXTURE0), f.bind(y, g.CLAMP_TO_EDGE), _.activeTexture.set(g.TEXTURE1), f.bind(y, g.CLAMP_TO_EDGE), "useMipmap" in f && _.extTextureFilterAnisotropic && r.transform.pitch > 20 && g.texParameterf(g.TEXTURE_2D, _.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, _.extTextureFilterAnisotropicMax); 48614 const [S, C, E, I] = s ? u.getPoleBuffers(s.canonical.z, !1) : u.getPoleBuffers(0, !0), D = t1; 48615 let P; 48616 i ? (P = S, r.renderDefaultNorthPole = 0 !== D) : (P = C, r.renderDefaultSouthPole = 0 !== D); 48617 const L = ga(l.mix), R = ((e1, t1, i, s, r, o, n, a, l, c, h, d, u, p)=>ao(e1, t1, i, s, new Float32Array(16), new Float32Array(9), [ 48618 0, 48619 0 48620 ], r, [ 48621 0, 48622 0 48623 ], [ 48624 0, 48625 0, 48626 0, 48627 0 48628 ], 1, { 48629 opacity: 1, 48630 mix: 0 48631 }, n, [ 48632 0, 48633 0 48634 ] || [ 48635 0, 48636 0 48637 ], l, 2, h, d, u, 1, 0, p))(r, w, T, m, e1.S(r.transform.zoom), 0, n, 0, D, 0, L, l.offset, l.range, a), A = r.getOrCreateProgram("raster", { 48638 defines: b 48639 }); 48640 r.uploadCommonUniforms(_, A, null), A.draw(r, g.TRIANGLES, x, h, v, c, R, n.id, P, E, I); 48641 } 48642 function va(e1) { 48643 if (e1.isOrthographic) return [ 48644 0, 48645 0, 48646 0, 48647 0 48648 ]; 48649 const t1 = e1._nearZ, i = e1.projection.farthestPixelDistance(e1), s = i - t1, r = .2 * e1.height, o = t1 + r; 48650 return [ 48651 t1, 48652 i, 48653 (o - r - t1) / s, 48654 (o - t1) / s 48655 ]; 48656 } 48657 function ba(e1, t1, i, s) { 48658 if (e1) return "raster-array" === t1.type ? t1.getTextureDescriptor(e1, i, !0) : { 48659 texture: e1.texture, 48660 mix: ga(s.mix), 48661 offset: s.offset, 48662 buffer: 0, 48663 tileSize: 1 48664 }; 48665 } 48666 const xa = e1.dr(new Float32Array(16)), wa = e1.a_([ 48667 { 48668 name: "a_pos_3f", 48669 components: 3, 48670 type: "Float32" 48671 } 48672 ]), { members: Ta } = wa; 48673 function Sa(e1, t1, i, s) { 48674 e1.emplaceBack(t1, i, s); 48675 } 48676 class Ca { 48677 constructor(t1){ 48678 this.vertexArray = new e1.eb, this.indices = new e1.ad, Sa(this.vertexArray, -1, -1, 1), Sa(this.vertexArray, 1, -1, 1), Sa(this.vertexArray, -1, 1, 1), Sa(this.vertexArray, 1, 1, 1), Sa(this.vertexArray, -1, -1, -1), Sa(this.vertexArray, 1, -1, -1), Sa(this.vertexArray, -1, 1, -1), Sa(this.vertexArray, 1, 1, -1), this.indices.emplaceBack(5, 1, 3), this.indices.emplaceBack(3, 7, 5), this.indices.emplaceBack(6, 2, 0), this.indices.emplaceBack(0, 4, 6), this.indices.emplaceBack(2, 6, 7), this.indices.emplaceBack(7, 3, 2), this.indices.emplaceBack(5, 4, 0), this.indices.emplaceBack(0, 1, 5), this.indices.emplaceBack(0, 2, 3), this.indices.emplaceBack(3, 1, 0), this.indices.emplaceBack(7, 6, 4), this.indices.emplaceBack(4, 5, 7), this.vertexBuffer = t1.createVertexBuffer(this.vertexArray, Ta), this.indexBuffer = t1.createIndexBuffer(this.indices), this.segment = e1.ac.simpleSegment(0, 0, 36, 12); 48679 } 48680 } 48681 function Ea(t1, i, s, r, o, n) { 48682 const a = t1.context.gl, l = i.paint.get("sky-atmosphere-color"), c = i.paint.get("sky-atmosphere-halo-color"), h = i.paint.get("sky-atmosphere-sun-intensity"), d = ((e1, t1, i, s, r)=>({ 48683 u_matrix_3f: e1, 48684 u_sun_direction: t1, 48685 u_sun_intensity: i, 48686 u_color_tint_r: [ 48687 s.r, 48688 s.g, 48689 s.b, 48690 s.a 48691 ], 48692 u_color_tint_m: [ 48693 r.r, 48694 r.g, 48695 r.b, 48696 r.a 48697 ], 48698 u_luminance: 5e-5 48699 }))(e1.ee(e1.ef(), r), o, h, l.toPremultipliedRenderColor(null), c.toPremultipliedRenderColor(null)); 48700 a.framebufferTexture2D(a.FRAMEBUFFER, a.COLOR_ATTACHMENT0, a.TEXTURE_CUBE_MAP_POSITIVE_X + n, i.skyboxTexture, 0), s.draw(t1, a.TRIANGLES, e1.Z.disabled, e1._.disabled, e1.a1.unblended, e1.$.frontCW, d, "skyboxCapture", i.skyboxGeometry.vertexBuffer, i.skyboxGeometry.indexBuffer, i.skyboxGeometry.segment); 48701 } 48702 const Ia = e1.a_([ 48703 { 48704 type: "Float32", 48705 name: "a_pos", 48706 components: 3 48707 }, 48708 { 48709 type: "Float32", 48710 name: "a_uv", 48711 components: 2 48712 } 48713 ]); 48714 class Da { 48715 destroy() { 48716 this.vertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(); 48717 } 48718 constructor(t1){ 48719 const i = new e1.eg; 48720 i.emplaceBack(-1, 1, 1, 0, 0), i.emplaceBack(1, 1, 1, 1, 0), i.emplaceBack(1, -1, 1, 1, 1), i.emplaceBack(-1, -1, 1, 0, 1); 48721 const s = new e1.ad; 48722 s.emplaceBack(0, 1, 2), s.emplaceBack(2, 3, 0), this.vertexBuffer = t1.createVertexBuffer(i, Ia.members), this.indexBuffer = t1.createIndexBuffer(s), this.segments = e1.ac.simpleSegment(0, 0, 4, 2); 48723 } 48724 } 48725 const Pa = e1.a_([ 48726 { 48727 type: "Float32", 48728 name: "a_pos_3f", 48729 components: 3 48730 }, 48731 { 48732 type: "Float32", 48733 name: "a_uv", 48734 components: 2 48735 }, 48736 { 48737 type: "Float32", 48738 name: "a_size_scale", 48739 components: 1 48740 }, 48741 { 48742 type: "Float32", 48743 name: "a_opacity", 48744 components: 1 48745 } 48746 ]); 48747 class La { 48748 update(t1) { 48749 this._painter = t1; 48750 const i = t1.context; 48751 if (!this.atmosphereBuffer || this.updateNeeded) { 48752 this.updateNeeded = !1, this.atmosphereBuffer = new Da(i); 48753 let t1 = this.params; 48754 const s = t1.sizeRange, r = t1.intensityRange, o = function(t1) { 48755 const i = e1.bi(30), s = []; 48756 for(let r = 0; r < t1; ++r){ 48757 const t1 = 2 * Math.PI * i(), r = Math.acos(1 - 2 * i()) - .5 * Math.PI; 48758 s.push(e1.bh(Math.cos(r) * Math.cos(t1), Math.cos(r) * Math.sin(t1), Math.sin(r))); 48759 } 48760 return s; 48761 }(t1.starsCount), n = e1.bi(300), a = new e1.ek, l = new e1.ad; 48762 let c = 0; 48763 for(let t1 = 0; t1 < o.length; ++t1){ 48764 const i = e1.dQ([], o[t1], 200), h = Math.max(0, 1 + .01 * s * (1 * n() - .5)), d = Math.max(0, 1 + .01 * r * (1 * n() - .5)); 48765 a.emplaceBack(i[0], i[1], i[2], -1, -1, h, d), a.emplaceBack(i[0], i[1], i[2], 1, -1, h, d), a.emplaceBack(i[0], i[1], i[2], 1, 1, h, d), a.emplaceBack(i[0], i[1], i[2], -1, 1, h, d), l.emplaceBack(c + 0, c + 1, c + 2), l.emplaceBack(c + 0, c + 2, c + 3), c += 4; 48766 } 48767 this.starsVx = i.createVertexBuffer(a, Pa.members), this.starsIdx = i.createIndexBuffer(l), this.starsSegments = e1.ac.simpleSegment(0, 0, a.length, l.length); 48768 } 48769 } 48770 destroy() { 48771 this.atmosphereBuffer && this.atmosphereBuffer.destroy(), this.starsVx && this.starsVx.destroy(), this.starsIdx && this.starsIdx.destroy(), this._painter = null; 48772 } 48773 drawAtmosphereGlow(t1, i) { 48774 const s = t1.context, r = s.gl, o = t1.transform, n = new e1.Z(r.LEQUAL, e1.Z.ReadOnly, [ 48775 0, 48776 1 48777 ]), a = e1.S(o.zoom), l = t1.style.getLut(i.scope), c = "none" === i.properties.get("color-use-theme"), h = i.properties.get("color").toNonPremultipliedRenderColor(c ? null : l), d = "none" === i.properties.get("high-color-use-theme"), u = i.properties.get("high-color").toNonPremultipliedRenderColor(d ? null : l), p = "none" === i.properties.get("space-color-use-theme"), f = i.properties.get("space-color").toNonPremultipliedRenderColor(p ? null : l), m = 5e-4, _ = e1.el(i.properties.get("horizon-blend"), 0, 1, m, .25), g = e1.c1(t1, s, o) && _ === m ? o.worldSize / (2 * Math.PI * 1.025) - 1 : o.globeRadius, y = t1.frameCounter / 1e3 % 1, v = e1.em(o.globeCenterInViewSpace), b = Math.sqrt(Math.pow(v, 2) - Math.pow(g, 2)), x = Math.acos(b / v), w = (i)=>{ 48778 const l = "globe" === o.projection.name ? [ 48779 "PROJECTION_GLOBE_VIEW", 48780 "FOG" 48781 ] : [ 48782 "FOG" 48783 ]; 48784 i && l.push("ALPHA_PASS"); 48785 const c = t1.getOrCreateProgram("globeAtmosphere", { 48786 defines: l 48787 }), d = ((e1, t1, i, s, r, o, n, a, l, c, h, d)=>({ 48788 u_frustum_tl: e1, 48789 u_frustum_tr: t1, 48790 u_frustum_br: i, 48791 u_frustum_bl: s, 48792 u_horizon: r, 48793 u_transition: o, 48794 u_fadeout_range: n, 48795 u_atmosphere_fog_color: a.toArray01(), 48796 u_high_color: l.toArray01(), 48797 u_space_color: c.toArray01(), 48798 u_temporal_offset: h, 48799 u_horizon_angle: d 48800 }))(o.frustumCorners.TL, o.frustumCorners.TR, o.frustumCorners.BR, o.frustumCorners.BL, o.frustumCorners.horizon, a, _, h, u, f, y, x); 48801 t1.uploadCommonUniforms(s, c); 48802 const p = this.atmosphereBuffer; 48803 p && c.draw(t1, r.TRIANGLES, n, e1._.disabled, i ? this.colorModeWriteAlpha : this.colorModeAlphaBlendedWriteRGB, e1.$.backCW, d, i ? "atmosphere_glow_alpha" : "atmosphere_glow", p.vertexBuffer, p.indexBuffer, p.segments); 48804 }; 48805 w(!1), w(!0); 48806 } 48807 drawStars(t1, i) { 48808 const s = e1.b0(i.properties.get("star-intensity"), 0, 1); 48809 if (0 === s) return; 48810 const r = t1.context, o = r.gl, n = t1.transform, a = t1.getOrCreateProgram("stars"), l = e1.bd([]); 48811 e1.be(l, l, -n._pitch), e1.bf(l, l, -n.angle), e1.be(l, l, e1.au(n._center.lat)), e1.en(l, l, -e1.au(n._center.lng)); 48812 const c = e1.bg(new Float32Array(16), l), h = e1.X([], n.starsProjMatrix, c), d = e1.ee([], c), u = e1.eo([], d); 48813 let p = this.params.sizeMultiplier; 48814 const f = [ 48815 0, 48816 1, 48817 0 48818 ]; 48819 e1.cU(f, f, u), e1.dQ(f, f, p); 48820 const m = [ 48821 1, 48822 0, 48823 0 48824 ]; 48825 e1.cU(m, m, u), e1.dQ(m, m, p); 48826 const _ = (g = f, y = m, v = s, { 48827 u_matrix: Float32Array.from(h), 48828 u_up: g, 48829 u_right: y, 48830 u_intensity_multiplier: v 48831 }); 48832 var g, y, v; 48833 t1.uploadCommonUniforms(r, a), this.starsVx && this.starsIdx && a.draw(t1, o.TRIANGLES, e1.Z.disabled, e1._.disabled, this.colorModeAlphaBlendedWriteRGB, e1.$.disabled, _, "atmosphere_stars", this.starsVx, this.starsIdx, this.starsSegments); 48834 } 48835 constructor(){ 48836 this.colorModeAlphaBlendedWriteRGB = new e1.a1([ 48837 e1.eh, 48838 e1.ei, 48839 e1.eh, 48840 e1.ei 48841 ], e1.C.transparent, [ 48842 !0, 48843 !0, 48844 !0, 48845 !1 48846 ]), this.colorModeWriteAlpha = new e1.a1([ 48847 e1.eh, 48848 e1.ej, 48849 e1.eh, 48850 e1.ej 48851 ], e1.C.transparent, [ 48852 !1, 48853 !1, 48854 !1, 48855 !0 48856 ]), this.params = { 48857 starsCount: 16e3, 48858 sizeMultiplier: .15, 48859 sizeRange: 100, 48860 intensityRange: 200 48861 }, this.updateNeeded = !0, this._painter = null, this._devtoolsFolder = null; 48862 } 48863 } 48864 class Ra { 48865 } 48866 class Aa { 48867 getLinesFromTrianglesBuffer(t1, i, s) { 48868 { 48869 const e1 = this._storage.get(i.id); 48870 if (e1) return e1.lastUsedFrameIdx = t1, e1.buf; 48871 } 48872 const r = s.gl, o = r.getBufferParameter(r.ELEMENT_ARRAY_BUFFER, r.BUFFER_SIZE), n = new ArrayBuffer(o), a = new Int16Array(n); 48873 r.getBufferSubData(r.ELEMENT_ARRAY_BUFFER, 0, new Int16Array(n)); 48874 const l = new e1.ep; 48875 for(let e1 = 0; e1 < o / 2; e1 += 3){ 48876 const t1 = a[e1], i = a[e1 + 1], s = a[e1 + 2]; 48877 l.emplaceBack(t1, i), l.emplaceBack(i, s), l.emplaceBack(s, t1); 48878 } 48879 const c = s.bindVertexArrayOES.current, h = new Ra; 48880 return h.buf = new Kn(s, l), h.lastUsedFrameIdx = t1, this._storage.set(i.id, h), s.bindVertexArrayOES.set(c), h.buf; 48881 } 48882 update(e1) { 48883 for (const [t1, i] of this._storage)e1 - i.lastUsedFrameIdx > 30 && (i.buf.destroy(), this._storage.delete(t1)); 48884 } 48885 destroy() { 48886 for (const [e1, t1] of this._storage)t1.buf.destroy(), this._storage.delete(e1); 48887 } 48888 constructor(){ 48889 this._storage = new Map; 48890 } 48891 } 48892 class Ma { 48893 constructor(){ 48894 this.occluderSize = 30, this.depthOffset = -1e-4; 48895 } 48896 } 48897 const Oa = { 48898 symbol: function(t1, i, s, r, o) { 48899 if ("translucent" !== t1.renderPass) return; 48900 const n = e1._.disabled, a = t1.colorModeForRenderPass(), l = s.layout.get("text-variable-anchor"), c = s.layout.get("text-size-scale-range"), h = e1.b0(t1.scaleFactor, c[0], c[1]); 48901 l && function(t1, i, s, r, o, n, a, l) { 48902 const c = i.transform, h = "map" === o, d = "map" === n; 48903 for (const i of t1){ 48904 const t1 = r.getTile(i), o = t1.getBucket(s); 48905 if (!o || !o.text || !o.text.segments.get().length) continue; 48906 const n = e1.d5(o.textSizeData, c.zoom, l), u = vt(i, o.getProjection(), c), p = c.calculatePixelsToTileUnitsMatrix(t1), f = e1.dY(u, t1.tileID.canonical, d, h, c, o.getProjection(), p), m = o.hasIconTextFit() && o.hasIconData(); 48907 n && ra(o, h, d, a, c, f, i, Math.pow(2, c.zoom - t1.tileID.overscaledZ), n, m); 48908 } 48909 }(r, t1, s, i, s.layout.get("text-rotation-alignment"), s.layout.get("text-pitch-alignment"), o, h); 48910 const d = 0 !== s.paint.get("icon-opacity").constantOr(1), u = 0 !== s.paint.get("text-opacity").constantOr(1); 48911 void 0 !== s.layout.get("symbol-sort-key").constantOr(1) && (d || u) ? oa(t1, i, s, r, n, a) : (d && oa(t1, i, s, r, n, a, { 48912 onlyIcons: !0 48913 }), u && oa(t1, i, s, r, n, a, { 48914 onlyText: !0 48915 })), i.map.showCollisionBoxes && xt.drawCollisionDebug && (xt.drawCollisionDebug(t1, i, s, r, s.paint.get("text-translate"), s.paint.get("text-translate-anchor"), !0), xt.drawCollisionDebug(t1, i, s, r, s.paint.get("icon-translate"), s.paint.get("icon-translate-anchor"), !1)); 48916 }, 48917 circle: function(t1, i, s, r) { 48918 if ("translucent" !== t1.renderPass) return; 48919 const o = s.paint.get("circle-opacity"), n = s.paint.get("circle-stroke-width"), a = s.paint.get("circle-stroke-opacity"), l = void 0 !== s.layout.get("circle-sort-key").constantOr(1), c = s.paint.get("circle-emissive-strength"); 48920 if (0 === o.constantOr(1) && (0 === n.constantOr(1) || 0 === a.constantOr(1))) return; 48921 const h = t1.context, d = h.gl, u = t1.transform, p = !(!t1.terrain || !t1.terrain.enabled), f = s.layout.get("circle-elevation-reference"), m = t1.depthModeForSublayer(0, e1.Z.ReadOnly), _ = new e1.Z(t1.context.gl.LEQUAL, e1.Z.ReadOnly, t1.depthRangeFor3D), g = "none" === f || p ? m : _, y = e1._.disabled, v = t1.colorModeForDrapableLayerRenderPass(c), b = "globe" === u.projection.name, x = [ 48922 e1.a7(u.center.lng), 48923 e1.a8(u.center.lat) 48924 ], w = []; 48925 for(let o = 0; o < r.length; o++){ 48926 const n = r[o], a = i.getTile(n), c = a.getBucket(s); 48927 if (!c || c.projection.name !== u.projection.name) continue; 48928 const h = c.programConfigurations.get(s.id), d = c.layoutVertexBuffer, p = c.globeExtVertexBuffer, f = c.indexBuffer, m = e1.e2(s), _ = [ 48929 p 48930 ], g = t1.isTileAffectedByFog(n); 48931 b && m.push("PROJECTION_GLOBE_VIEW"), m.push("DEPTH_D24"), t1.terrain && u.depthOcclusionForSymbolsAndCircles && m.push("DEPTH_OCCLUSION"), c.hdExt && c.hdExt.hasElevation && !t1.terrain && (m.push("ELEVATED_ROADS"), _.push(c.hdExt.elevatedLayoutVertexBuffer)); 48932 const y = t1.getOrCreateProgram("circle", { 48933 config: h, 48934 defines: m, 48935 overrideFog: g 48936 }), v = u.projection.createInversionMatrix(u, n.canonical), T = { 48937 programConfiguration: h, 48938 program: y, 48939 layoutVertexBuffer: d, 48940 dynamicBuffers: _, 48941 indexBuffer: f, 48942 uniformValues: e1.e3(t1, n, a, v, x, s), 48943 tile: a 48944 }; 48945 if (l) { 48946 const t1 = c.segments.get(); 48947 for (const i of t1)w.push({ 48948 segments: new e1.ac([ 48949 i 48950 ]), 48951 sortKey: i.sortKey, 48952 state: T 48953 }); 48954 } else w.push({ 48955 segments: c.segments, 48956 sortKey: 0, 48957 state: T 48958 }); 48959 } 48960 l && w.sort((e1, t1)=>e1.sortKey - t1.sortKey); 48961 const T = { 48962 useDepthForOcclusion: u.depthOcclusionForSymbolsAndCircles 48963 }; 48964 for (const i of w){ 48965 const { programConfiguration: r, program: o, layoutVertexBuffer: n, dynamicBuffers: a, indexBuffer: l, uniformValues: c, tile: p } = i.state, f = i.segments; 48966 t1.terrain && t1.terrain.setupElevationDraw(p, o, T), t1.uploadCommonUniforms(h, o, p.tileID.toUnwrapped()), o.draw(t1, d.TRIANGLES, g, y, v, e1.$.disabled, c, s.id, n, l, f, s.paint, u.zoom, r, a); 48967 } 48968 }, 48969 heatmap: function(t1, i, s, r) { 48970 if (0 !== s.paint.get("heatmap-opacity")) if ("offscreen" === t1.renderPass) { 48971 const o = t1.context, n = o.gl, a = e1._.disabled, l = new e1.a1([ 48972 n.ONE, 48973 n.ONE, 48974 n.ONE, 48975 n.ONE 48976 ], e1.C.transparent, [ 48977 !0, 48978 !0, 48979 !0, 48980 !0 48981 ]), c = "globe" === t1.transform.projection.name ? .5 : .25; 48982 s.heatmapFbo = Jn.createWithTexture(o, s.heatmapFbo, t1.width * c, t1.height * c), o.clear({ 48983 color: e1.C.transparent 48984 }); 48985 const h = t1.transform, d = "globe" === h.projection.name, u = d ? [ 48986 "PROJECTION_GLOBE_VIEW" 48987 ] : [], p = d ? e1.$.frontCCW : e1.$.disabled, f = [ 48988 e1.a7(h.center.lng), 48989 e1.a8(h.center.lat) 48990 ]; 48991 for(let c = 0; c < r.length; c++){ 48992 const m = r[c]; 48993 if (i.hasRenderableParent(m)) continue; 48994 const _ = i.getTile(m), g = _.getBucket(s); 48995 if (!g || g.projection.name !== h.projection.name) continue; 48996 const y = t1.isTileAffectedByFog(m), v = g.programConfigurations.get(s.id), b = t1.getOrCreateProgram("heatmap", { 48997 config: v, 48998 defines: u, 48999 overrideFog: y 49000 }), { zoom: x } = t1.transform; 49001 t1.terrain && t1.terrain.setupElevationDraw(_, b), t1.uploadCommonUniforms(o, b, m.toUnwrapped()); 49002 const w = h.projection.createInversionMatrix(h, m.canonical); 49003 b.draw(t1, n.TRIANGLES, e1.Z.disabled, a, l, p, oo(t1, m, _, w, f, x, s.paint.get("heatmap-intensity")), s.id, g.layoutVertexBuffer, g.indexBuffer, g.segments, s.paint, t1.transform.zoom, v, d ? [ 49004 g.globeExtVertexBuffer 49005 ] : null); 49006 } 49007 o.viewport.set([ 49008 0, 49009 0, 49010 t1.width, 49011 t1.height 49012 ]); 49013 } else "translucent" === t1.renderPass && (t1.context.setColorMode(t1.colorModeForRenderPass()), function(t1, i) { 49014 const s = t1.context, r = s.gl, o = i.heatmapFbo; 49015 if (!o) return; 49016 s.activeTexture.set(r.TEXTURE0), r.bindTexture(r.TEXTURE_2D, o.colorAttachment0.get()), s.activeTexture.set(r.TEXTURE1); 49017 let n = i.colorRampTexture; 49018 n || (n = i.colorRampTexture = new e1.T(s, i.colorRamp, r.RGBA8)), n.bind(r.LINEAR, r.CLAMP_TO_EDGE), t1.getOrCreateProgram("heatmapTexture").draw(t1, r.TRIANGLES, e1.Z.disabled, e1._.disabled, t1.colorModeForRenderPass(), e1.$.disabled, ((e1, t1)=>({ 49019 u_image: 0, 49020 u_color_ramp: 1, 49021 u_opacity: t1.paint.get("heatmap-opacity") 49022 }))(0, i), i.id, t1.viewportBuffer, t1.quadTriangleIndexBuffer, t1.viewportSegments, i.paint, t1.transform.zoom); 49023 }(t1, s)); 49024 }, 49025 line: function(e1, t1, i, s) { 49026 const r = i.paint.get("line-opacity"), o = i.paint.get("line-width"); 49027 if (0 === r.constantOr(1) || 0 === o.constantOr(1)) return; 49028 const n = i.paint.get("line-blend-mode"), a = e1.terrain && e1.terrain.renderingToTexture; 49029 if ("default" === n || "globe" === e1.transform.projection.name) "translucent" === e1.renderPass && aa(e1, t1, i, s); 49030 else { 49031 if (a) return void function(e1, t1, i, s, r) { 49032 if ("translucent" !== e1.renderPass) return; 49033 const o = e1.context, n = o.gl, a = e1.terrain; 49034 if (!a) return; 49035 const l = o.bindFramebuffer.current, c = "mrt-fallback" === e1.emissiveMode, h = a.drapeBufferSize[0], d = a.drapeBufferSize[1]; 49036 i.lineBlendFbos || (i.lineBlendFbos = new la), i.lineBlendFbos.drapeFbo = Jn.createWithTexture(o, i.lineBlendFbos.drapeFbo, h, d, !0), c && n.drawBuffers([ 49037 n.COLOR_ATTACHMENT0 49038 ]), o.clear({ 49039 color: ha[r].clearColor, 49040 depth: 1, 49041 stencil: 0 49042 }); 49043 const u = e1.currentStencilSource, p = e1._tileClippingMaskIDs, f = e1.nextStencilID; 49044 e1.currentStencilSource = void 0, e1._tileClippingMaskIDs = {}, e1.nextStencilID = 1; 49045 const m = e1._terrain; 49046 e1._terrain = null, e1._renderTileClippingMasks(i, t1, s), aa(e1, t1, i, s, ua(r, e1.context), !0), e1._terrain = m, e1.currentStencilSource = u, e1._tileClippingMaskIDs = p, e1.nextStencilID = f, c && n.drawBuffers([ 49047 n.COLOR_ATTACHMENT0, 49048 n.COLOR_ATTACHMENT1 49049 ]); 49050 const _ = a.drapeBufferSize, g = i.lineBlendFbos && i.lineBlendFbos.drapeFbo; 49051 g && ("additive" === r && fa(e1, i, g), ma(e1, i, r, g, l, _)); 49052 }(e1, t1, i, s, n); 49053 if ("offscreen" === e1.renderPass) return void function(e1, t1, i, s, r) { 49054 const o = e1.context, n = Math.ceil(e1.width), a = Math.ceil(e1.height); 49055 i.lineBlendFbos || (i.lineBlendFbos = new la), i.lineBlendFbos.fbo = Jn.createWithTexture(o, i.lineBlendFbos.fbo, n, a, !0), o.clear({ 49056 color: ha[r].clearColor, 49057 depth: 1, 49058 stencil: 0 49059 }); 49060 const l = e1.currentStencilSource, c = e1._tileClippingMaskIDs, h = e1.nextStencilID; 49061 e1.currentStencilSource = void 0, e1._tileClippingMaskIDs = {}, e1.nextStencilID = 1, e1._renderTileClippingMasks(i, t1, s); 49062 const d = e1.renderPass; 49063 e1.renderPass = "translucent", aa(e1, t1, i, s, ua(r, e1.context)), e1.renderPass = d, e1.currentStencilSource = l, e1._tileClippingMaskIDs = c, e1.nextStencilID = h, o.viewport.set([ 49064 0, 49065 0, 49066 e1.width, 49067 e1.height 49068 ]), "additive" === r && fa(e1, i, i.lineBlendFbos.fbo); 49069 }(e1, t1, i, s, n); 49070 if ("translucent" === e1.renderPass) { 49071 const t1 = i.lineBlendFbos && i.lineBlendFbos.fbo; 49072 return void (t1 && ma(e1, i, n, t1, null)); 49073 } 49074 } 49075 }, 49076 fill: function(t1, i, s, r) { 49077 const o = s.paint.get("fill-color"), n = s.paint.get("fill-opacity"); 49078 if (0 === n.constantOr(1)) return; 49079 const a = s.paint.get("fill-emissive-strength"), l = t1.colorModeForDrapableLayerRenderPass(a), c = s.paint.get("fill-pattern"), h = t1.opaquePassEnabledForLayer() && !c.constantOr(1) && 1 === o.constantOr(e1.C.transparent).a && 1 === n.constantOr(0) ? "opaque" : "translucent"; 49080 let d = "none"; 49081 "none" !== s.layout.get("fill-elevation-reference") ? d = "road" : 0 !== s.paint.get("fill-z-offset").constantOr(1) && (d = "offset"); 49082 const u = !(!t1.terrain || !t1.terrain.enabled), p = { 49083 painter: t1, 49084 sourceCache: i, 49085 layer: s, 49086 coords: r, 49087 colorMode: l, 49088 elevationType: d, 49089 terrainEnabled: u, 49090 pass: h 49091 }; 49092 if ("shadow" === t1.renderPass) return void (t1.shadowRenderer && "road" === d && !u && Xs.drawElevatedFillShadows && Xs.drawElevatedFillShadows(p)); 49093 const f = "mrt-fallback" === t1.emissiveMode; 49094 if ("offset" !== d) { 49095 if (_a(p, !1, f), "road" === d) { 49096 const o = !u && "translucent" === t1.renderPass; 49097 o && Xs.drawDepthPrepass && Xs.drawDepthPrepass(t1, i, s, r, "geometry"), _a(p, !0, f, e1._.disabled), o && Xs.drawElevatedStructures && Xs.drawElevatedStructures(p); 49098 } 49099 } else _a(p, !1, f, t1.stencilModeFor3D()); 49100 }, 49101 "fill-extrusion": function(t1, i, s, r) { 49102 const o = s.paint.get("fill-extrusion-opacity"), n = t1.context, a = n.gl, l = t1.terrain, c = l && l.renderingToTexture; 49103 if (0 === o) return; 49104 const h = "mrt-fallback" === t1.emissiveMode, d = t1.conflationActive && t1.style.isLayerClipped(s, i.getSource()), u = t1.style.order.indexOf(s.fqid); 49105 if (d && function(e1, t1, i, s, r) { 49106 for (const o of s){ 49107 const s = t1.getTile(o).getBucket(i); 49108 s && (s.updateReplacement(o, e1.replacementSource, r), s.uploadCentroid(e1.context)); 49109 } 49110 }(t1, i, s, r, u), l || d) for (const e1 of r){ 49111 const r = i.getTile(e1).getBucket(s); 49112 r && fi(t1.context, i, e1, r, s, l, d); 49113 } 49114 if ("shadow" === t1.renderPass && t1.shadowRenderer) { 49115 if (l && o < .65 && s._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e1.aj) return; 49116 const n = t1.shadowRenderer.getShadowPassDepthMode(); 49117 di(t1, i, s, r, n, e1._.disabled, e1.a1.disabled, d); 49118 } else if ("translucent" === t1.renderPass) { 49119 const u = !s.paint.get("fill-extrusion-pattern").constantOr(1), p = s.paint.get("fill-extrusion-color").constantOr(e1.C.white); 49120 if (!c && 0 !== p.a) { 49121 const n = new e1.Z(t1.context.gl.LEQUAL, e1.Z.ReadWrite, t1.depthRangeFor3D); 49122 1 === o && u ? di(t1, i, s, r, n, e1._.disabled, e1.a1.unblended, d) : (di(t1, i, s, r, n, e1._.disabled, e1.a1.disabled, d), di(t1, i, s, r, n, t1.stencilModeFor3D(), t1.colorModeForRenderPass(), d), t1.resetStencilClippingMasks()); 49123 } 49124 const f = t1.style.enable3dLights() && u && (!l && "globe" !== t1.transform.projection.name || c); 49125 if (f && !ci.drawGroundEffect && hi(), f && ci.drawGroundEffect) { 49126 const o = s.paint.get("fill-extrusion-opacity"), u = s.paint.get("fill-extrusion-ambient-occlusion-intensity"), p = s.paint.get("fill-extrusion-ambient-occlusion-ground-radius"), f = s.paint.get("fill-extrusion-flood-light-intensity"), m = "none" === s.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default"), _ = s.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(m ? null : s.lut).toArray01().slice(0, 3), g = u > 0 && p > 0, y = f > 0, v = new ui; 49127 v.translate = s.paint.get("fill-extrusion-translate"), v.translateAnchor = s.paint.get("fill-extrusion-translate-anchor"), v.edgeRadius = s.layout.get("fill-extrusion-edge-radius"), v.cutoffFadeRange = s.paint.get("fill-extrusion-cutoff-fade-range"); 49128 const b = (n)=>{ 49129 const l = t1.depthModeForSublayer(1, e1.Z.ReadOnly, a.LEQUAL, !0), c = s.paint.get(n ? "fill-extrusion-ambient-occlusion-ground-attenuation" : "fill-extrusion-flood-light-ground-attenuation"), h = e1.al(.1, 3, c), m = t1._showOverdrawInspector; 49130 if (!m) { 49131 const c = new e1._({ 49132 func: a.ALWAYS, 49133 mask: 255 49134 }, 255, 255, a.KEEP, a.KEEP, a.REPLACE), m = new e1.a1([ 49135 a.ONE, 49136 a.ONE, 49137 a.ONE, 49138 a.ONE 49139 ], e1.C.transparent, [ 49140 !1, 49141 !1, 49142 !1, 49143 !0 49144 ], a.MIN); 49145 ci.drawGroundEffect(v, t1, i, s, r, l, c, m, e1.$.disabled, n, "sdf", o, u, p, f, _, h, d, !1); 49146 } 49147 { 49148 const c = m ? e1._.disabled : new e1._({ 49149 func: a.EQUAL, 49150 mask: 255 49151 }, 255, 255, a.KEEP, a.DECR, a.DECR), g = m ? t1.colorModeForRenderPass() : new e1.a1([ 49152 a.ONE_MINUS_DST_ALPHA, 49153 a.DST_ALPHA, 49154 a.ONE, 49155 a.ONE 49156 ], e1.C.transparent, [ 49157 !0, 49158 !0, 49159 !0, 49160 !0 49161 ]); 49162 ci.drawGroundEffect(v, t1, i, s, r, l, c, g, e1.$.disabled, n, "color", o, u, p, f, _, h, d, !1); 49163 } 49164 }; 49165 if (c) { 49166 const c = ()=>{ 49167 const t1 = l.drapeBufferSize[0], i = l.drapeBufferSize[1]; 49168 let s = l.framebufferCopyTexture; 49169 return s && (!s || s.size[0] === t1 && s.size[1] === i) || (s && s.destroy(), s = l.framebufferCopyTexture = new e1.T(n, new e1.b({ 49170 width: t1, 49171 height: i 49172 }), a.RGBA8)), s.bind(a.LINEAR, a.CLAMP_TO_EDGE), a.copyTexSubImage2D(a.TEXTURE_2D, 0, 0, 0, 0, 0, t1, i), s; 49173 }, m = (n, l, m)=>{ 49174 const g = t1.depthModeForSublayer(1, e1.Z.ReadOnly, a.LEQUAL, !1), y = s.paint.get(n ? "fill-extrusion-ambient-occlusion-ground-attenuation" : "fill-extrusion-flood-light-ground-attenuation"), b = e1.al(.1, 3, y); 49175 { 49176 const c = new e1.a1([ 49177 a.ONE, 49178 a.ONE, 49179 a.ONE, 49180 a.ONE 49181 ], e1.C.transparent, [ 49182 !1, 49183 !1, 49184 !1, 49185 !0 49186 ]); 49187 ci.drawGroundEffect(v, t1, i, s, r, g, e1._.disabled, c, e1.$.disabled, n, "clear", o, u, p, f, _, b, d, l); 49188 } 49189 { 49190 const c = new e1._({ 49191 func: a.ALWAYS, 49192 mask: 255 49193 }, 255, 255, a.KEEP, a.KEEP, a.REPLACE), h = new e1.a1([ 49194 a.ONE, 49195 a.ONE, 49196 a.ONE, 49197 a.ONE 49198 ], e1.C.transparent, [ 49199 !1, 49200 !1, 49201 !1, 49202 !0 49203 ], a.MIN); 49204 ci.drawGroundEffect(v, t1, i, s, r, g, c, h, e1.$.disabled, n, "sdf", o, u, p, f, _, b, d, l); 49205 } 49206 h && !n && (m = c()); 49207 { 49208 const c = n ? a.ZERO : a.ONE_MINUS_DST_ALPHA, h = new e1._({ 49209 func: a.EQUAL, 49210 mask: 255 49211 }, 255, 255, a.KEEP, a.DECR, a.DECR), m = new e1.a1([ 49212 c, 49213 a.DST_ALPHA, 49214 a.ONE_MINUS_DST_ALPHA, 49215 a.ZERO 49216 ], e1.C.transparent, [ 49217 !0, 49218 !0, 49219 !0, 49220 !0 49221 ]); 49222 ci.drawGroundEffect(v, t1, i, s, r, g, h, m, e1.$.disabled, n, "color", o, u, p, f, _, b, d, l); 49223 } 49224 if (!h || n) { 49225 const c = new e1.a1([ 49226 a.ONE, 49227 a.ONE, 49228 a.ONE, 49229 n ? a.ZERO : a.ONE 49230 ], e1.C.transparent, [ 49231 !1, 49232 !1, 49233 !1, 49234 !0 49235 ], n ? a.FUNC_ADD : a.MAX); 49236 ci.drawGroundEffect(v, t1, i, s, r, g, e1._.disabled, c, e1.$.disabled, n, "clear", o, u, p, f, _, b, d, l, m); 49237 } else { 49238 a.drawBuffers([ 49239 a.NONE, 49240 a.COLOR_ATTACHMENT1 49241 ]); 49242 const c = new e1._({ 49243 func: a.EQUAL, 49244 mask: 255 49245 }, 254, 255, a.KEEP, a.DECR, a.DECR), h = new e1.a1([ 49246 a.ONE, 49247 a.ONE, 49248 a.ONE, 49249 a.ONE 49250 ], e1.C.transparent, [ 49251 !0, 49252 !1, 49253 !1, 49254 !1 49255 ], a.MAX); 49256 ci.drawGroundEffect(v, t1, i, s, r, g, c, h, e1.$.disabled, n, "emissive", o, u, p, f, _, b, d, l, m), a.drawBuffers([ 49257 a.COLOR_ATTACHMENT0 49258 ]); 49259 } 49260 }; 49261 if (g || y) { 49262 let e1; 49263 t1.prepareDrawTile(), h && !g || (e1 = c()), g && m(!0, !1, e1), y && m(!1, !0, e1); 49264 } 49265 } else g && b(!0), y && b(!1), (g || y) && t1.resetStencilClippingMasks(); 49266 } 49267 } 49268 }, 49269 hillshade: function(t1, i, s, r) { 49270 if ("offscreen" !== t1.renderPass && "translucent" !== t1.renderPass) return; 49271 if (t1.style.disableElevatedTerrain) return; 49272 const o = t1.context, n = t1.terrain && t1.terrain.renderingToTexture, [a, l] = "translucent" !== t1.renderPass || n ? [ 49273 {}, 49274 r 49275 ] : t1.stencilConfigForOverlap(r); 49276 for (const r of l){ 49277 const o = i.getTile(r); 49278 if (o.needsHillshadePrepare && "offscreen" === t1.renderPass) er(t1, o, s); 49279 else if ("translucent" === t1.renderPass) { 49280 const i = t1.depthModeForSublayer(0, e1.Z.ReadOnly), l = s.paint.get("hillshade-emissive-strength"), c = t1.colorModeForDrapableLayerRenderPass(l), h = n && t1.terrain ? t1.terrain.stencilModeForRTTOverlap(r) : a[r.overscaledZ]; 49281 Qs(t1, r, o, s, i, h, c); 49282 } 49283 } 49284 o.viewport.set([ 49285 0, 49286 0, 49287 t1.width, 49288 t1.height 49289 ]), t1.resetStencilClippingMasks(); 49290 }, 49291 raster: function(t1, i, s, r, o, n) { 49292 if ("translucent" !== t1.renderPass) return; 49293 const a = s.paint.get("raster-opacity"); 49294 if (0 === a) return; 49295 const l = s.paint.get("raster-allow-draping"), c = "globe" === t1.transform.projection.name; 49296 let h = s.paint.get("raster-elevation"), d = "ground" === s.paint.get("raster-elevation-reference"); 49297 l || 0 !== h || (h = .001, d = !0); 49298 const u = h > 0, p = t1.terrain && t1.terrain.exaggeration() > 0 && u && d, f = u && c, m = !c && p; 49299 if (t1.renderElevatedRasterBackface && !f) return; 49300 const _ = t1.context, g = _.gl, y = i.getSource(), v = function(t1, i, s, r, o) { 49301 const n = i.paint.get("raster-color"), a = "raster-array" === t1.type, l = [], c = i.paint.get("raster-resampling"), h = i.paint.get("raster-color-mix"); 49302 let d = i.paint.get("raster-color-range"); 49303 const u = [ 49304 h[0], 49305 h[1], 49306 h[2], 49307 0 49308 ], p = h[3]; 49309 let f = "nearest" === c ? r.NEAREST : r.LINEAR; 49310 if (a && (l.push("RASTER_ARRAY"), n || l.push("RASTER_COLOR"), "linear" === c && l.push("RASTER_ARRAY_LINEAR"), f = r.NEAREST, n && "log" === i.paint.get("raster-color-scale") && l.push("RASTER_COLOR_SCALE_LOG"), !d && t1.rasterLayers)) { 49311 const e1 = t1.rasterLayers.find((param)=>{ 49312 let { id: e1 } = param; 49313 return e1 === i.sourceLayer; 49314 }); 49315 e1 && e1.fields && e1.fields.range && (d = e1.fields.range); 49316 } 49317 if (d = d || [ 49318 0, 49319 1 49320 ], n) { 49321 l.push("RASTER_COLOR"), s.activeTexture.set(r.TEXTURE2), i.updateColorRamp(d); 49322 let t1 = i.colorRampTexture; 49323 t1 || (t1 = i.colorRampTexture = new e1.T(s, i.colorRamp, r.RGBA8)), t1.bind(f, r.CLAMP_TO_EDGE); 49324 } 49325 return o && l.push("USE_MRT1"), { 49326 mix: u, 49327 range: d, 49328 offset: p, 49329 defines: l, 49330 resampling: f 49331 }; 49332 }(y, s, _, g, t1.terrain && t1.terrain.renderingToTexture && "mrt-fallback" === t1.emissiveMode); 49333 if (y instanceof Co && !r.length && !c) return; 49334 const b = s.paint.get("raster-emissive-strength"), x = t1.colorModeForDrapableLayerRenderPass(b), w = t1.terrain && t1.terrain.renderingToTexture, T = !t1.options.moving, S = "nearest" === s.paint.get("raster-resampling") ? g.NEAREST : g.LINEAR; 49335 if (y instanceof Co && !r.length && (y.onNorthPole || y.onSouthPole)) { 49336 const r = u ? t1.stencilModeFor3D() : e1._.disabled; 49337 return void ya(h, !!y.onNorthPole, null, t1, i, s, b, v, e1.$.disabled, r); 49338 } 49339 if (!r.length) return; 49340 const [C, E] = y instanceof Co || w ? [ 49341 {}, 49342 r 49343 ] : t1.stencilConfigForOverlap(r), I = E.at(-1).overscaledZ; 49344 f && v.defines.push("PROJECTION_GLOBE_VIEW"), u && v.defines.push("RENDER_CUTOFF", "ELEVATED"), p && v.defines.push("ELEVATION_REFERENCE_GROUND"); 49345 const D = (r, o, l)=>{ 49346 for (const d of r){ 49347 const r = d.toUnwrapped(), E = i.getTile(d); 49348 if (w && (!E || !E.hasData())) continue; 49349 _.activeTexture.set(g.TEXTURE0); 49350 const D = ba(E, y, s, v); 49351 if (!D || !D.texture) continue; 49352 const { texture: P, mix: L, offset: R, tileSize: A, buffer: M } = D; 49353 let O, F; 49354 w ? (O = e1.Z.disabled, F = d.projMatrix) : u ? (O = new e1.Z(g.LEQUAL, e1.Z.ReadWrite, t1.depthRangeFor3D), F = c ? t1.transform.expandedFarZProjMatrix : t1.transform.calculateProjMatrix(r, T)) : (O = t1.depthModeForSublayer(d.overscaledZ - I, 1 === a ? e1.Z.ReadWrite : e1.Z.ReadOnly, g.LESS), F = t1.transform.calculateProjMatrix(r, T)); 49355 const k = t1.terrain && w ? t1.terrain.stencilModeForRTTOverlap(d) : C[d.overscaledZ], B = n ? 0 : s.paint.get("raster-fade-duration"); 49356 E.registerFadeDuration(B); 49357 const z = i.findLoadedParent(d, 0), U = Ai(E, z, i, t1.transform, B); 49358 let N, j; 49359 !U.isFading && E.refreshedUponExpiration && (E.refreshedUponExpiration = !1), t1.terrain && t1.terrain.prepareDrawTile(), _.activeTexture.set(g.TEXTURE0), P.bind(S, g.CLAMP_TO_EDGE), _.activeTexture.set(g.TEXTURE1), z ? (z.texture && z.texture.bind(S, g.CLAMP_TO_EDGE), N = Math.pow(2, z.tileID.overscaledZ - E.tileID.overscaledZ), j = [ 49360 E.tileID.canonical.x * N % 1, 49361 E.tileID.canonical.y * N % 1 49362 ]) : P.bind(S, g.CLAMP_TO_EDGE), "useMipmap" in P && _.extTextureFilterAnisotropic && t1.transform.pitch > 20 && g.texParameterf(g.TEXTURE_2D, _.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, _.extTextureFilterAnisotropicMax); 49363 const V = t1.transform; 49364 let G; 49365 const q = u ? va(V) : [ 49366 0, 49367 0, 49368 0, 49369 0 49370 ]; 49371 let Z, $, H, W, X, K = 0; 49372 if (f && y instanceof Co && y.coordinates.length > 3) Z = Float32Array.from(e1.b4(e1.b5(new e1.bX(0, 0, 0)))), $ = Float32Array.from(V.globeMatrix), H = Float32Array.from(e1.b6(V)), W = [ 49373 e1.a7(V.center.lng), 49374 e1.a8(V.center.lat) 49375 ], G = y.elevatedGlobePerspectiveTransform, X = y.elevatedGlobeGridMatrix || new Float32Array(9); 49376 else if (f) { 49377 const t1 = e1.b2(d.canonical); 49378 K = e1.b3(t1.getCenter().lat), Z = Float32Array.from(e1.b4(e1.b5(d.canonical))), $ = Float32Array.from(V.globeMatrix), H = Float32Array.from(e1.b6(V)), W = [ 49379 e1.a7(V.center.lng), 49380 e1.a8(V.center.lat) 49381 ], G = [ 49382 0, 49383 0 49384 ], X = Float32Array.from(e1.b7(d.canonical, t1, K, V.worldSize / V._pixelsPerMercatorPixel)); 49385 } else G = y instanceof Co ? y.perspectiveTransform : [ 49386 0, 49387 0 49388 ], Z = new Float32Array(16), $ = new Float32Array(9), H = new Float32Array(16), W = [ 49389 0, 49390 0 49391 ], X = new Float32Array(9); 49392 const Y = ao(t1, F, Z, $, H, X, j || [ 49393 0, 49394 0 49395 ], e1.S(t1.transform.zoom), W, q, N || 1, U, s, G, h, 2, L, R, v.range, A, M, b), Q = t1.isTileAffectedByFog(d), J = t1.getOrCreateProgram("raster", { 49396 defines: v.defines, 49397 overrideFog: Q 49398 }); 49399 if (t1.uploadCommonUniforms(_, J, r), y instanceof Co) { 49400 const i = y.elevatedGlobeVertexBuffer, r = y.elevatedGlobeIndexBuffer; 49401 if (w || !c) y.boundsBuffer && y.boundsSegments && J.draw(t1, g.TRIANGLES, O, e1._.disabled, x, e1.$.disabled, Y, s.id, y.boundsBuffer, t1.quadTriangleIndexBuffer, y.boundsSegments); 49402 else if (i && r) { 49403 const n = V.zoom <= e1.e9 ? y.elevatedGlobeSegments : y.getSegmentsForLongitude(V.center.lng); 49404 n && J.draw(t1, g.TRIANGLES, O, e1._.disabled, x, o, Y, s.id, i, r, n); 49405 } 49406 } else if (f) { 49407 O = new e1.Z(g.LEQUAL, e1.Z.ReadOnly, t1.depthRangeFor3D); 49408 const i = t1.globeSharedBuffers; 49409 if (i) { 49410 p && (t1.terrain.setupElevationDraw(E, J), t1.uploadCommonUniforms(_, J, E.tileID.toUnwrapped())); 49411 const [e1, r, n] = i.getGridBuffers(K, !1), a = J.getAttributeLocation(g, "a_texture_pos"); 49412 -1 !== a && g.vertexAttribI4ui(a, 0, 0, 0, 0), J.draw(t1, g.TRIANGLES, O, l || k, t1.colorModeForRenderPass(), o, Y, s.id, e1, r, n); 49413 } 49414 } else if (m) O = new e1.Z(g.LEQUAL, e1.Z.ReadOnly, t1.depthRangeFor3D), t1.terrain.setupElevationDraw(E, J), t1.uploadCommonUniforms(_, J, E.tileID.toUnwrapped()), V.pitch > 20 && J.draw(t1, g.TRIANGLES, O, e1._.disabled, e1.a1.disabled, e1.$.frontCCW, Y, s.id, t1.terrain.gridBuffer, t1.terrain.gridIndexBuffer, t1.terrain.gridSegments), J.draw(t1, g.TRIANGLES, O, k, x, e1.$.backCCW, Y, s.id, t1.terrain.gridBuffer, t1.terrain.gridIndexBuffer, t1.terrain.gridSegments); 49415 else { 49416 const { tileBoundsBuffer: i, tileBoundsIndexBuffer: r, tileBoundsSegments: o } = t1.getTileBoundsBuffers(E); 49417 J.draw(t1, g.TRIANGLES, O, k, x, e1.$.disabled, Y, s.id, i, r, o); 49418 } 49419 } 49420 if (!(y instanceof Co) && f) for (const n of r){ 49421 const r = n.canonical.y === (1 << n.canonical.z) - 1; 49422 0 === n.canonical.y && ya(h, !0, n, t1, i, s, b, v, o, l || e1._.disabled), r && ya(h, !1, n, t1, i, s, b, v, o === e1.$.frontCW ? e1.$.backCW : e1.$.frontCW, l || e1._.disabled); 49423 } 49424 }; 49425 f ? D(E, t1.renderElevatedRasterBackface ? e1.$.backCW : e1.$.frontCW, t1.stencilModeFor3D()) : D(E, e1.$.disabled, void 0), t1.resetStencilClippingMasks(); 49426 }, 49427 background: function(t1, i, s, r) { 49428 const o = s.paint.get("background-color"), n = "none" === s.paint.get("background-color-use-theme").constantOr("default"), a = s.paint.get("background-opacity"), l = s.paint.get("background-emissive-strength"), c = "viewport" === s.paint.get("background-pitch-alignment"); 49429 if (0 === a) return; 49430 const h = t1.context, d = h.gl, u = t1.transform, p = u.tileSize, f = s.paint.get("background-pattern"); 49431 let m; 49432 if (void 0 !== f) { 49433 if (null === f) return; 49434 if (m = t1.imageManager.getPattern(e1.I.from(f.toString()), s.scope, t1.style.getLut(s.scope)), !m) return; 49435 } 49436 const _ = !f && 1 === o.a && 1 === a && t1.opaquePassEnabledForLayer() ? "opaque" : "translucent"; 49437 if (t1.renderPass !== _) return; 49438 const g = e1._.disabled, y = t1.depthModeForSublayer(0, "opaque" === _ ? e1.Z.ReadWrite : e1.Z.ReadOnly), v = t1.colorModeForDrapableLayerRenderPass(l), b = f ? "backgroundPattern" : "background"; 49439 let x, w = r; 49440 w || (x = t1.getBackgroundTiles(), w = Object.values(x).map((e1)=>e1.tileID)), f && (h.activeTexture.set(d.TEXTURE0), t1.imageManager.bind(t1.context, s.scope)); 49441 const T = []; 49442 if (t1.terrain && t1.terrain.renderingToTexture && "mrt-fallback" === t1.emissiveMode && T.push("USE_MRT1"), c) { 49443 const i = t1.getOrCreateProgram(b, { 49444 overrideFog: !1, 49445 overrideRtt: !0, 49446 defines: T 49447 }), r = xa, h = new e1.bP(0, 0, 0, 0, 0), u = f ? po(r, l, a, t1, f, s.scope, m, c, { 49448 tileID: h, 49449 tileSize: p 49450 }) : uo(r, l, a, o.toPremultipliedRenderColor(n ? null : s.lut)); 49451 return void i.draw(t1, d.TRIANGLES, y, g, v, e1.$.disabled, u, s.id, t1.viewportBuffer, t1.quadTriangleIndexBuffer, t1.viewportSegments); 49452 } 49453 for (const _ of w){ 49454 const w = t1.isTileAffectedByFog(_), S = t1.getOrCreateProgram(b, { 49455 overrideFog: w, 49456 defines: T 49457 }), C = _.toUnwrapped(), E = r ? _.projMatrix : t1.transform.calculateProjMatrix(C); 49458 t1.prepareDrawTile(); 49459 const I = i ? i.getTile(_) : x ? x[_.key] : new fs(_, p, u.zoom, t1), D = f ? po(E, l, a, t1, f, s.scope, m, c, { 49460 tileID: _, 49461 tileSize: p 49462 }) : uo(E, l, a, o.toPremultipliedRenderColor(n ? null : s.lut)); 49463 t1.uploadCommonUniforms(h, S, C); 49464 const { tileBoundsBuffer: P, tileBoundsIndexBuffer: L, tileBoundsSegments: R } = t1.getTileBoundsBuffers(I); 49465 S.draw(t1, d.TRIANGLES, y, g, v, e1.$.disabled, D, s.id, P, L, R); 49466 } 49467 }, 49468 sky: function(t1, i, s) { 49469 const r = t1._atmosphere ? e1.S(t1.transform.zoom) : 1, o = s.paint.get("sky-opacity") * r; 49470 if (0 === o) return; 49471 const n = t1.context, a = s.paint.get("sky-type"), l = new e1.Z(n.gl.LEQUAL, e1.Z.ReadOnly, [ 49472 0, 49473 1 49474 ]), c = t1.frameCounter / 1e3 % 1; 49475 "atmosphere" === a ? "offscreen" === t1.renderPass ? s.needsSkyboxCapture(t1) && (function(t1, i) { 49476 const s = t1.context, r = s.gl; 49477 let o = i.skyboxFbo; 49478 if (!o) { 49479 o = i.skyboxFbo = s.createFramebuffer(32, 32, 1, null), i.skyboxGeometry = new Ca(s), i.skyboxTexture = s.gl.createTexture(), r.bindTexture(r.TEXTURE_CUBE_MAP, i.skyboxTexture), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_MIN_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_CUBE_MAP, r.TEXTURE_MAG_FILTER, r.LINEAR); 49480 for(let e1 = 0; e1 < 6; ++e1)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X + e1, 0, r.RGBA, 32, 32, 0, r.RGBA, r.UNSIGNED_BYTE, null); 49481 } 49482 s.bindFramebuffer.set(o.framebuffer), s.viewport.set([ 49483 0, 49484 0, 49485 32, 49486 32 49487 ]); 49488 const n = i.getCenter(t1, !0), a = t1.getOrCreateProgram("skyboxCapture"), l = new Float64Array(16); 49489 e1.ec(l, .5 * -Math.PI), Ea(t1, i, a, l, n, 0), e1.ec(l, .5 * Math.PI), Ea(t1, i, a, l, n, 1), e1.ed(l, .5 * -Math.PI), Ea(t1, i, a, l, n, 2), e1.ed(l, .5 * Math.PI), Ea(t1, i, a, l, n, 3), e1.dr(l), Ea(t1, i, a, l, n, 4), e1.ec(l, Math.PI), Ea(t1, i, a, l, n, 5), s.viewport.set([ 49490 0, 49491 0, 49492 t1.width, 49493 t1.height 49494 ]); 49495 }(t1, s), s.markSkyboxValid(t1)) : "sky" === t1.renderPass && function(t1, i, s, r, o) { 49496 const n = t1.context, a = n.gl, l = t1.transform, c = t1.getOrCreateProgram("skybox"); 49497 n.activeTexture.set(a.TEXTURE0), a.bindTexture(a.TEXTURE_CUBE_MAP, i.skyboxTexture); 49498 const h = ((e1, t1, i, s, r)=>({ 49499 u_matrix: e1, 49500 u_sun_direction: t1, 49501 u_cubemap: 0, 49502 u_opacity: s, 49503 u_temporal_offset: r 49504 }))(l.skyboxMatrix, i.getCenter(t1, !1), 0, r, o); 49505 t1.uploadCommonUniforms(n, c), c.draw(t1, a.TRIANGLES, s, e1._.disabled, t1.colorModeForRenderPass(), e1.$.backCW, h, "skybox", i.skyboxGeometry.vertexBuffer, i.skyboxGeometry.indexBuffer, i.skyboxGeometry.segment); 49506 }(t1, s, l, o, c) : "gradient" === a && "sky" === t1.renderPass && function(t1, i, s, r, o) { 49507 const n = t1.context, a = n.gl, l = t1.transform, c = t1.getOrCreateProgram("skyboxGradient"); 49508 i.skyboxGeometry || (i.skyboxGeometry = new Ca(n)), n.activeTexture.set(a.TEXTURE0); 49509 let h = i.colorRampTexture; 49510 h || (h = i.colorRampTexture = new e1.T(n, i.colorRamp, a.RGBA8)), h.bind(a.LINEAR, a.CLAMP_TO_EDGE); 49511 const d = ((t1, i, s, r, o)=>({ 49512 u_matrix: t1, 49513 u_color_ramp: 0, 49514 u_center_direction: i, 49515 u_radius: e1.au(s), 49516 u_opacity: r, 49517 u_temporal_offset: o 49518 }))(l.skyboxMatrix, i.getCenter(t1, !1), i.paint.get("sky-gradient-radius"), r, o); 49519 t1.uploadCommonUniforms(n, c), c.draw(t1, a.TRIANGLES, s, e1._.disabled, t1.colorModeForRenderPass(), e1.$.backCW, d, "skyboxGradient", i.skyboxGeometry.vertexBuffer, i.skyboxGeometry.indexBuffer, i.skyboxGeometry.segment); 49520 }(t1, s, l, o, c); 49521 }, 49522 custom: function(t1, i, s, r) { 49523 const o = t1.context, n = s.implementation; 49524 if (!t1.transform.projection.unsupportedLayers || !t1.transform.projection.unsupportedLayers.includes("custom") || t1.terrain && (t1.terrain.renderingToTexture || "offscreen" === t1.renderPass) && s.isDraped(i)) { 49525 if ("offscreen" === t1.renderPass) { 49526 const i = n.prerender; 49527 if (i) { 49528 if (t1.setCustomLayerDefaults(), o.setColorMode(t1.colorModeForRenderPass()), "globe" === t1.transform.projection.name) { 49529 const s = t1.transform.pointMerc; 49530 i.call(n, o.gl, t1.transform.customLayerMatrix(), t1.transform.getProjection(), t1.transform.globeToMercatorMatrix(), e1.S(t1.transform.zoom), [ 49531 s.x, 49532 s.y 49533 ], t1.transform.pixelsPerMeterRatio); 49534 } else i.call(n, o.gl, t1.transform.customLayerMatrix()); 49535 o.setDirty(), t1.setBaseState(); 49536 } 49537 } else if ("translucent" === t1.renderPass) { 49538 if (t1.terrain && t1.terrain.renderingToTexture) { 49539 const i = n.renderToTile; 49540 if (i) { 49541 const s = r[0].canonical, a = { 49542 x: s.x + r[0].wrap * (n.wrapTileId ? 0 : 1 << s.z), 49543 y: s.y, 49544 z: s.z 49545 }; 49546 o.setDepthMode(e1.Z.disabled), o.setStencilMode(e1._.disabled), o.setColorMode(t1.colorModeForRenderPass()), t1.setCustomLayerDefaults(); 49547 const l = o.gl; 49548 "mrt-fallback" === t1.emissiveMode && l.drawBuffers([ 49549 l.COLOR_ATTACHMENT0 49550 ]), i.call(n, o.gl, a), "mrt-fallback" === t1.emissiveMode && l.drawBuffers([ 49551 l.COLOR_ATTACHMENT0, 49552 l.COLOR_ATTACHMENT1 49553 ]), o.setDirty(), t1.setBaseState(); 49554 } 49555 return; 49556 } 49557 t1.setCustomLayerDefaults(), o.setColorMode(t1.colorModeForRenderPass()), o.setStencilMode(e1._.disabled); 49558 const i = "3d" === n.renderingMode ? new e1.Z(t1.context.gl.LEQUAL, e1.Z.ReadWrite, t1.depthRangeFor3D) : t1.depthModeForSublayer(0, e1.Z.ReadOnly); 49559 if (o.setDepthMode(i), "globe" === t1.transform.projection.name) { 49560 const i = t1.transform.pointMerc; 49561 n.render(o.gl, t1.transform.customLayerMatrix(), t1.transform.getProjection(), t1.transform.globeToMercatorMatrix(), e1.S(t1.transform.zoom), [ 49562 i.x, 49563 i.y 49564 ], t1.transform.pixelsPerMeterRatio); 49565 } else n.render(o.gl, t1.transform.customLayerMatrix()); 49566 o.setDirty(), t1.setBaseState(), o.bindFramebuffer.set(null); 49567 } 49568 } else e1.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers."); 49569 } 49570 }, Fa = { 49571 line: function(e1, t1, i) { 49572 if (e1.hasElevatedBuckets = !1, e1.hasNonElevatedBuckets = !1, void 0 !== e1._unevaluatedLayout.getValue("line-elevation-reference") || void 0 !== e1._unevaluatedLayout.getValue("line-z-offset")) { 49573 if (t1) { 49574 const i = t1.getVisibleCoordinates(); 49575 for (const s of i){ 49576 const i = t1.getTile(s).getBucket(e1); 49577 if (i && ("none" !== i.elevationType ? e1.hasElevatedBuckets = !0 : e1.hasNonElevatedBuckets = !0, e1.hasElevatedBuckets && e1.hasNonElevatedBuckets)) break; 49578 } 49579 } 49580 } else e1.hasNonElevatedBuckets = !0; 49581 }, 49582 raster: function(e1, t1, i) { 49583 const s = t1.getSource(); 49584 if ("raster-array" !== s.type || !s.loaded()) return; 49585 const r = e1.sourceLayer || s.rasterLayerIds && s.rasterLayerIds[0]; 49586 if (!r) return; 49587 const o = e1.paint.get("raster-array-band") || s.getInitialBand(r); 49588 if (null == o) return; 49589 const n = t1.getIds().map((e1)=>t1.getTileByID(e1)); 49590 for (const t1 of n)t1.updateNeeded(e1.id, o) && s.prepareTile(t1, r, e1.id, o); 49591 } 49592 }; 49593 async function ka(e1) { 49594 if (await hi(), Object.assign(Oa, { 49595 model: ci.drawModels 49596 }), Object.assign(Fa, { 49597 model: ci.prepare 49598 }), e1 && !e1._destroyed && !e1._shadowRenderer) { 49599 const t1 = ci.ShadowRenderer; 49600 t1 && (e1._shadowRenderer = new t1(e1)); 49601 } 49602 } 49603 class Ba { 49604 updateTerrain(e1, t1) { 49605 const i = !!e1 && !!e1.terrain && this.transform.projection.supportsTerrain; 49606 var s; 49607 (i || this._terrain && this._terrain.enabled) && (this._terrain || (this._terrain = Qr(this, e1), this._terrain) ? (this.transform.elevation = i ? this._terrain : null, this._terrain.update(e1, this.transform, t1), this.transform.elevation && !this._terrain.enabled && (this.transform.elevation = null)) : this._terrainRendererRetryPending || (this._terrainRendererRetryPending = !0, s = ()=>{ 49608 this._terrainRendererRetryPending = !1, this.style && this.style.map && this.style.map._update(!1); 49609 }, Kr ? s() : Yr.push(s))); 49610 } 49611 _updateFog(e1) { 49612 const t1 = e1.fog; 49613 if (!t1 || "globe" === this.transform.projection.name || t1.getOpacity(this.transform.pitch) < 1 || t1.properties.get("horizon-blend") < .03) return void (this.transform.fogCullDistSq = null); 49614 const [i, s] = t1.getRangeForProjection(); 49615 if (i > s) return void (this.transform.fogCullDistSq = null); 49616 const r = i + .78 * (s - i); 49617 this.transform.fogCullDistSq = r * r; 49618 } 49619 get terrain() { 49620 return this.transform._terrainEnabled() && this._terrain && this._terrain.enabled || this._forceTerrainMode ? this._terrain : null; 49621 } 49622 get forceTerrainMode() { 49623 return this._forceTerrainMode; 49624 } 49625 set forceTerrainMode(e1) { 49626 e1 && !this._terrain && (this._terrain = Qr(this, this.style), this._terrain || console.warn("forceTerrainMode: Lite module not loaded yet, terrain renderer unavailable")), this._forceTerrainMode = e1; 49627 } 49628 get shadowRenderer() { 49629 return this._shadowRenderer && this._shadowRenderer.enabled ? this._shadowRenderer : null; 49630 } 49631 get wireframeDebugCache() { 49632 return this._wireframeDebugCache; 49633 } 49634 resize(t1, i) { 49635 if (this.width = t1 * e1.e.devicePixelRatio, this.height = i * e1.e.devicePixelRatio, this.context.viewport.set([ 49636 0, 49637 0, 49638 this.width, 49639 this.height 49640 ]), this.style) for (const e1 of this.style.order)this.style._mergedLayers[e1].resize(); 49641 } 49642 setup() { 49643 const t1 = this.context, i = new e1.bC; 49644 i.emplaceBack(0, 0), i.emplaceBack(e1.a6, 0), i.emplaceBack(0, e1.a6), i.emplaceBack(e1.a6, e1.a6), this.tileExtentBuffer = t1.createVertexBuffer(i, e1.bE.members), this.tileExtentSegments = e1.ac.simpleSegment(0, 0, 4, 2); 49645 const s = new e1.bC; 49646 s.emplaceBack(0, 0), s.emplaceBack(e1.a6, 0), s.emplaceBack(0, e1.a6), s.emplaceBack(e1.a6, e1.a6), this.debugBuffer = t1.createVertexBuffer(s, e1.bE.members), this.debugSegments = e1.ac.simpleSegment(0, 0, 4, 5); 49647 const r = new e1.bC; 49648 r.emplaceBack(-1, -1), r.emplaceBack(1, -1), r.emplaceBack(-1, 1), r.emplaceBack(1, 1), this.viewportBuffer = t1.createVertexBuffer(r, e1.bE.members), this.viewportSegments = e1.ac.simpleSegment(0, 0, 4, 2); 49649 const o = new e1.bs; 49650 o.emplaceBack(0, 0, 0, 0), o.emplaceBack(e1.a6, 0, e1.a6, 0), o.emplaceBack(0, e1.a6, 0, e1.a6), o.emplaceBack(e1.a6, e1.a6, e1.a6, e1.a6), this.mercatorBoundsBuffer = t1.createVertexBuffer(o, hs.members), this.mercatorBoundsSegments = e1.ac.simpleSegment(0, 0, 4, 2); 49651 const n = new e1.ad; 49652 n.emplaceBack(0, 1, 2), n.emplaceBack(2, 1, 3), this.quadTriangleIndexBuffer = t1.createIndexBuffer(n); 49653 const a = new e1.bD; 49654 for (const e1 of [ 49655 0, 49656 1, 49657 3, 49658 2, 49659 0 49660 ])a.emplaceBack(e1); 49661 this.debugIndexBuffer = t1.createIndexBuffer(a), this.emptyTexture = new e1.T(t1, new e1.b({ 49662 width: 1, 49663 height: 1 49664 }, Uint8Array.of(0, 0, 0, 0)), t1.gl.RGBA8), this.identityMat = e1.Y(); 49665 const l = this.context.gl; 49666 this.stencilClearMode = new e1._({ 49667 func: l.ALWAYS, 49668 mask: 0 49669 }, 0, 255, l.ZERO, l.ZERO, l.ZERO), this.loadTimeStamps.push(performance.now()); 49670 } 49671 getMercatorTileBoundsBuffers() { 49672 return { 49673 tileBoundsBuffer: this.mercatorBoundsBuffer, 49674 tileBoundsIndexBuffer: this.quadTriangleIndexBuffer, 49675 tileBoundsSegments: this.mercatorBoundsSegments 49676 }; 49677 } 49678 getTileBoundsBuffers(e1) { 49679 return e1._makeTileBoundsBuffers(this.context, this.transform.projection), e1._tileBoundsBuffer ? { 49680 tileBoundsBuffer: e1._tileBoundsBuffer, 49681 tileBoundsIndexBuffer: e1._tileBoundsIndexBuffer, 49682 tileBoundsSegments: e1._tileBoundsSegments 49683 } : this.getMercatorTileBoundsBuffers(); 49684 } 49685 clearStencil() { 49686 const t1 = this.context.gl; 49687 this.nextStencilID = 1, this.currentStencilSource = void 0, this._tileClippingMaskIDs = {}, this.getOrCreateProgram("clippingMask").draw(this, t1.TRIANGLES, e1.Z.disabled, this.stencilClearMode, e1.a1.disabled, e1.$.disabled, Us(this.identityMat), "$clipping", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments); 49688 } 49689 resetStencilClippingMasks() { 49690 this.terrain || (this.currentStencilSource = void 0, this._tileClippingMaskIDs = {}); 49691 } 49692 _renderTileClippingMasks(t1, i, s) { 49693 if (!i || this.currentStencilSource === i.id || !t1.isTileClipped() || !s || 0 === s.length) return; 49694 if (this._tileClippingMaskIDs && !this.terrain) { 49695 let e1 = !1; 49696 for (const t1 of s)if (void 0 === this._tileClippingMaskIDs[t1.key]) { 49697 e1 = !0; 49698 break; 49699 } 49700 if (!e1) return; 49701 } 49702 this.currentStencilSource = i.id; 49703 const r = this.context, o = r.gl; 49704 this.nextStencilID + s.length > 256 && this.clearStencil(), r.setColorMode(e1.a1.disabled), r.setDepthMode(e1.Z.disabled); 49705 const n = this.getOrCreateProgram("clippingMask"); 49706 this._tileClippingMaskIDs = {}; 49707 for (const t1 of s){ 49708 const s = i.getTile(t1), r = this._tileClippingMaskIDs[t1.key] = this.nextStencilID++, { tileBoundsBuffer: a, tileBoundsIndexBuffer: l, tileBoundsSegments: c } = this.getTileBoundsBuffers(s); 49709 n.draw(this, o.TRIANGLES, e1.Z.disabled, new e1._({ 49710 func: o.ALWAYS, 49711 mask: 0 49712 }, r, 255, o.KEEP, o.KEEP, o.REPLACE), e1.a1.disabled, e1.$.disabled, Us(t1.projMatrix), "$clipping", a, l, c); 49713 } 49714 } 49715 stencilModeFor3D() { 49716 this.currentStencilSource = void 0, this.nextStencilID + 1 > 256 && this.clearStencil(); 49717 const t1 = this.nextStencilID++, i = this.context.gl; 49718 return new e1._({ 49719 func: i.NOTEQUAL, 49720 mask: 255 49721 }, t1, 255, i.KEEP, i.KEEP, i.REPLACE); 49722 } 49723 stencilModeForClipping(t1) { 49724 if (this.terrain) return this.terrain.stencilModeForRTTOverlap(t1); 49725 const i = this.context.gl; 49726 return new e1._({ 49727 func: i.EQUAL, 49728 mask: 255 49729 }, this._tileClippingMaskIDs[t1.key], 0, i.KEEP, i.KEEP, i.REPLACE); 49730 } 49731 stencilConfigForOverlap(t1) { 49732 const i = this.context.gl, s = t1.sort((e1, t1)=>
49732t1.overscaledZ - e1.overscaledZ), r = s.at(-1).overscaledZ, o = s[0].overscaledZ - r + 1; 49733 if (o > 1) { 49734 this.currentStencilSource = void 0, this.nextStencilID + o > 256 && this.clearStencil(); 49735 const t1 = {}; 49736 for(let s = 0; s < o; s++)t1[s + r] = new e1._({ 49737 func: i.GEQUAL, 49738 mask: 255 49739 }, s + this.nextStencilID, 255, i.KEEP, i.KEEP, i.REPLACE); 49740 return this.nextStencilID += o, [ 49741 t1, 49742 s 49743 ]; 49744 } 49745 return [ 49746 { 49747 [r]: e1._.disabled 49748 }, 49749 s 49750 ]; 49751 } 49752 colorModeForRenderPass() { 49753 const t1 = this.context.gl; 49754 if (this._showOverdrawInspector) { 49755 const i = 1 / 8; 49756 return new e1.a1([ 49757 t1.CONSTANT_COLOR, 49758 t1.ONE, 49759 t1.CONSTANT_COLOR, 49760 t1.ONE 49761 ], new e1.C(i, i, i, 0), [ 49762 !0, 49763 !0, 49764 !0, 49765 !0 49766 ]); 49767 } 49768 return "opaque" === this.renderPass ? e1.a1.unblended : e1.a1.alphaBlended; 49769 } 49770 colorModeForDrapableLayerRenderPass(t1) { 49771 const i = this.context.gl; 49772 return (()=>this.style && this.style.enable3dLights() && !!this._terrain && this._terrain.renderingToTexture)() && "translucent" === this.renderPass ? null != t1 && "mrt-fallback" !== this.emissiveMode || "constant" === this.emissiveMode ? new e1.a1([ 49773 i.ONE, 49774 i.ONE_MINUS_SRC_ALPHA, 49775 i.CONSTANT_ALPHA, 49776 i.ONE_MINUS_SRC_ALPHA 49777 ], new e1.C(0, 0, 0, t1 !== null && t1 !== void 0 ? t1 : 0), [ 49778 !0, 49779 !0, 49780 !0, 49781 !0 49782 ]) : "dual-source-blending" === this.emissiveMode ? new e1.a1([ 49783 i.ONE, 49784 i.ONE_MINUS_SRC_ALPHA, 49785 this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL, 49786 i.ONE_MINUS_SRC_ALPHA 49787 ], e1.C.transparent, [ 49788 !0, 49789 !0, 49790 !0, 49791 !0 49792 ]) : this.colorModeForRenderPass() : this.colorModeForRenderPass(); 49793 } 49794 depthModeForSublayer(t1, i, s) { 49795 let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1; 49796 if (this.depthOcclusion) return new e1.Z(this.context.gl.GREATER, e1.Z.ReadOnly, this.depthRangeFor3D); 49797 if (!this.opaquePassEnabledForLayer() && !r) return e1.Z.disabled; 49798 const o = 1 - ((1 + this.currentLayer) * this.numSublayers + t1) * this.depthEpsilon; 49799 return new e1.Z(s || this.context.gl.LEQUAL, i, [ 49800 o, 49801 o 49802 ]); 49803 } 49804 opaquePassEnabledForLayer() { 49805 return this.currentLayer < this.opaquePassCutoff; 49806 } 49807 blitDepth() { 49808 const t1 = this.context.gl, i = Math.ceil(this.width), s = Math.ceil(this.height), r = this.context.bindFramebuffer.get(), o = t1.getParameter(t1.TEXTURE_BINDING_2D); 49809 this.depthFBO && this.depthFBO.width === i && this.depthFBO.height === s || (this.depthFBO && (this.depthFBO.destroy(), this.depthFBO = void 0, this.depthTexture = void 0), 0 !== i && 0 !== s && (this.depthFBO = new Jn(this.context, i, s, 0, "texture"), this.depthTexture = new e1.T(this.context, { 49810 width: i, 49811 height: s, 49812 data: null 49813 }, t1.DEPTH24_STENCIL8), this.depthFBO.depthAttachment.set(this.depthTexture.texture))), this.context.bindFramebuffer.set(r), t1.bindTexture(t1.TEXTURE_2D, o), this.depthFBO && (t1.bindFramebuffer(t1.READ_FRAMEBUFFER, null), t1.bindFramebuffer(t1.DRAW_FRAMEBUFFER, this.depthFBO.framebuffer), t1.blitFramebuffer(0, 0, i, s, 0, 0, i, s, t1.DEPTH_BUFFER_BIT, t1.NEAREST), t1.bindFramebuffer(t1.FRAMEBUFFER, this.context.bindFramebuffer.current)); 49814 } 49815 render(t1, i) { 49816 this.context.sweepPendingPrograms(), this.frameTimeDelta = 0 === this.lastPaintStartTimeStamp ? 0 : i.paintStartTimeStamp - this.lastPaintStartTimeStamp, this.lastPaintStartTimeStamp = i.paintStartTimeStamp, this._wireframeDebugCache.update(this.frameCounter), this.style = t1, this.options = i, this.frcCoverageSnapshot && !this.frcCoverageSnapshot.empty() && (!this.frcCoverageRenderer && Xs.FrcCoverageRenderer && (this.frcCoverageRenderer = new Xs.FrcCoverageRenderer), this.frcCoverageRenderer && this.frcCoverageRenderer.update(this.context, this.frcCoverageSnapshot.tiles)); 49817 const s = this.style._mergedLayers, r = !(!this.terrain || !this.terrain.enabled), o = ()=>this.style._getOrder(r); 49818 let n = o(), a = !1, l = !1, c = null, h = 0, d = !1; 49819 for (const e1 of n){ 49820 const t1 = s[e1]; 49821 "none" !== t1.visibility && ("circle" === t1.type ? a = !0 : "building" === t1.type ? (c = t1, ++h) : "symbol" === t1.type && (t1.hasOcclusionOpacityProperties ? l = !0 : a = !0)); 49822 } 49823 this.updateEmissiveMode(); 49824 let u = n.map((e1)=>s[e1]); 49825 const p = this.style._mergedSourceCaches; 49826 this.imageManager = t1.imageManager, this.modelManager = t1.modelManager, this.symbolFadeChange = t1.placement.symbolFadeChange(e1.e.now()), this.imageManager.beginFrame(); 49827 for(const e1 in p){ 49828 const t1 = p[e1]; 49829 t1.used && (t1.prepare(this.context), t1.getSource().usedInConflation &&
vendor: 34,269 bytes, lines 49829-50341
49829++h); 49830 } 49831 let f = !1; 49832 for (const e1 of u)e1.isHidden(this.transform.zoom) || ("clip" === e1.type && (f = !0), this.prepareLayer(e1)); 49833 const m = {}, _ = {}, g = {}, y = {}, v = {}; 49834 for(const e1 in p){ 49835 const t1 = p[e1]; 49836 m[e1] = t1.getVisibleCoordinates(), _[e1] = m[e1].slice().reverse(), g[e1] = t1.getVisibleCoordinates(!0).reverse(), y[e1] = t1.getShadowCasterCoordinates(), v[e1] = t1.sortCoordinatesByDistance(m[e1]); 49837 } 49838 const b = (e1)=>{ 49839 const t1 = this.style.getLayerSourceCache(e1); 49840 return t1 && t1.used ? t1.getSource() : null; 49841 }; 49842 if (h || f || this._clippingActiveLastFrame) { 49843 const t1 = [], i = []; 49844 let s = 0; 49845 for (const e1 of u)this.isSourceForClippingOrConflation(e1, b(e1)) && (t1.push(e1), i.push(s)), s++; 49846 if (t1 && (f || t1.length > 1) || this._clippingActiveLastFrame) { 49847 f = !1; 49848 const s = []; 49849 for(let r = 0; r < t1.length; r++){ 49850 const o = t1[r], n = i[r], a = this.style.getLayerSourceCache(o); 49851 if (!a || !a.used || !a.getSource().usedInConflation && "clip" !== o.type && "building" !== o.type) continue; 49852 let l = e1.er, c = e1.d7.None; 49853 const h = []; 49854 let d = !0; 49855 if ("building" === o.type) l = e1.ev; 49856 else if ("clip" === o.type) if (l = n, o.isHidden(this.transform.zoom)) d = !1; 49857 else { 49858 if (!o.layout) { 49859 d = !1; 49860 continue; 49861 } 49862 for (const t1 of o.layout.get("clip-layer-types"))c |= "model" === t1 ? e1.d7.Model : "symbol" === t1 ? e1.d7.Symbol : e1.d7.FillExtrusion; 49863 for (const t1 of o.layout.get("clip-layer-scope"))h.push(e1.m(t1, o.scope)); 49864 f = !0; 49865 } 49866 d && s.push({ 49867 layer: o.fqid, 49868 cache: a, 49869 order: l, 49870 clipMask: c, 49871 clipScope: h 49872 }); 49873 } 49874 this.replacementSource.setSources(s), d = !0; 49875 } 49876 } 49877 this._clippingActiveLastFrame = f, d || this.replacementSource.clear(), this.conflationActive = d, this.minCutoffZoom = 0, this.longestCutoffRange = 0, this.maxFrontCutoffRawStart = 0, this.opaquePassCutoff = 1 / 0, this._lastOcclusionLayer = -1, this.layersWithOcclusionOpacity = []; 49878 for(let e1 = 0; e1 < u.length; e1++){ 49879 const t1 = u[e1]; 49880 if ("none" === t1.visibility) continue; 49881 const i = t1.cutoffRange(); 49882 if (this.longestCutoffRange = Math.max(i, this.longestCutoffRange), i > 0) { 49883 const e1 = b(t1); 49884 e1 && (this.minCutoffZoom = Math.max(e1.minzoom, this.minCutoffZoom)), t1.minzoom && (this.minCutoffZoom = Math.max(t1.minzoom, this.minCutoffZoom)); 49885 } 49886 t1.is3D(r) && (this.opaquePassCutoff === 1 / 0 && (this.opaquePassCutoff = e1), this._lastOcclusionLayer = e1); 49887 } 49888 const x = this.style && this.style.fog; 49889 x ? (this._fogVisible = 0 !== x.getOpacity(this.transform.pitch), this._fogVisible && "globe" !== this.transform.projection.name && (this._fogVisible = x.isVisibleOnFrustum(this.transform.cameraFrustum))) : this._fogVisible = !1, this._cachedTileFogOpacities = {}, this.terrain && (this.terrain.updateTileBinding(g), this.opaquePassCutoff = 0, n = o(), u = n.map((e1)=>s[e1])), this.style.enable3dLights() && !this._shadowRenderer && ka(this); 49890 const w = this._shadowRenderer; 49891 if (w) { 49892 w.updateShadowParameters(this.transform, this.style.directionalLight); 49893 for(const e1 in p)for (const t1 of m[e1]){ 49894 let e1 = { 49895 min: 0, 49896 max: 0 49897 }; 49898 this.terrain && (e1 = this.terrain.getMinMaxForTile(t1) || e1), w.addShadowReceiver(t1.toUnwrapped(), e1.min, e1.max); 49899 } 49900 } 49901 "globe" !== this.transform.projection.name || this.globeSharedBuffers || (this.globeSharedBuffers = new e1.es(this.context)), this.style.fog && this.transform.projection.supportsFog ? (this._atmosphere || (this._atmosphere = new La), this._atmosphere.update(this)) : this._atmosphere && (this._atmosphere.destroy(), this._atmosphere = void 0); 49902 let T = !(!this.style || !this.style.snow), S = !(!this.style || !this.style.rain); 49903 if (T && !this._snow && Xs.Snow && (this._snow = new Xs.Snow), !T && this._snow && (this._snow.destroy(), delete this._snow), S && !this._rain && Xs.Rain && (this._rain = new Xs.Rain), !S && this._rain && (this._rain.destroy(), delete this._rain), this._snow && this._snow.update(this), this._rain && this._rain.update(this), c && (!this.buildingTileBorderManager && Xs.BuildingTileBorderManager && (this.buildingTileBorderManager = new Xs.BuildingTileBorderManager), this.buildingTileBorderManager)) { 49904 const e1 = this.style.getLayerSourceCache(c); 49905 this.buildingTileBorderManager.updateBorders(e1, c); 49906 } 49907 if (!e1.et(this.context.gl)) return; 49908 this.renderPass = "offscreen"; 49909 for (const e1 of u){ 49910 const i = t1.getLayerSourceCache(e1); 49911 if (!e1.hasOffscreenPass() || e1.isHidden(this.transform.zoom)) continue; 49912 const s = i ? _[i.id] : void 0; 49913 ("custom" === e1.type || "raster" === e1.type || "raster-particle" === e1.type || e1.isSky() || s && s.length) && this.renderLayer(this, i, e1, s); 49914 } 49915 this.depthRangeFor3D = [ 49916 0, 49917 1 - (u.length + 2) * this.numSublayers * this.depthEpsilon 49918 ], this._shadowRenderer && (this.renderPass = "shadow", this._shadowRenderer.drawShadowPass(this.style, y)), this.context.bindFramebuffer.set(null), this.context.viewport.set([ 49919 0, 49920 0, 49921 this.width, 49922 this.height 49923 ]); 49924 const C = "globe" === this.transform.projection.name || this.transform.isHorizonVisible(), E = (()=>{ 49925 if (i.showOverdrawInspector) return e1.C.black; 49926 const t1 = this.style.fog; 49927 if (t1 && this.transform.projection.supportsFog) { 49928 const i = this.style.getLut(t1.scope); 49929 if (!C) { 49930 const s = "none" === t1.properties.get("color-use-theme"), r = t1.properties.get("color").toNonPremultipliedRenderColor(s ? null : i).toArray01(); 49931 return new e1.C(...r); 49932 } 49933 if (C) { 49934 const s = "none" === t1.properties.get("space-color-use-theme"), r = t1.properties.get("space-color").toNonPremultipliedRenderColor(s ? null : i).toArray01(); 49935 return new e1.C(...r); 49936 } 49937 } 49938 return e1.C.transparent; 49939 })(); 49940 if (this.context.clear({ 49941 color: E, 49942 depth: 1 49943 }), this.clearStencil(), this._showOverdrawInspector = i.showOverdrawInspector, this.renderPass = "opaque", this.style.fog && this.transform.projection.supportsFog && this._atmosphere && !this._showOverdrawInspector && C && this._atmosphere.drawStars(this, this.style.fog), !this.terrain) for(this.currentLayer = n.length - 1; this.currentLayer >= 0; this.currentLayer--){ 49944 const e1 = u[this.currentLayer], i = t1.getLayerSourceCache(e1); 49945 if (e1.isSky()) continue; 49946 const s = i ? (e1.is3D(r) ? v : _)[i.id] : void 0; 49947 this._renderTileClippingMasks(e1, i, s), this.renderLayer(this, i, e1, s); 49948 } 49949 if (this.style.fog && this.transform.projection.supportsFog && this._atmosphere && !this._showOverdrawInspector && C && this._atmosphere.drawAtmosphereGlow(this, this.style.fog), this.renderPass = "sky", (!this._atmosphere || e1.S(this.transform.zoom) > 0) && ("globe" === this.transform.projection.name || this.transform.isHorizonVisible())) for(this.currentLayer = 0; this.currentLayer < n.length; this.currentLayer++){ 49950 const e1 = u[this.currentLayer], i = t1.getLayerSourceCache(e1); 49951 e1.isSky() && this.renderLayer(this, i, e1, i ? _[i.id] : void 0); 49952 } 49953 function I(e1, t1) { 49954 let i; 49955 return t1 && (i = ("symbol" === e1.type ? g : e1.is3D(r) ? v : _)[t1.id]), i; 49956 } 49957 if (this.renderPass = "translucent", "globe" === this.transform.projection.name) { 49958 for(this.renderElevatedRasterBackface = !0, this.currentLayer = 0; this.currentLayer < n.length;){ 49959 const e1 = u[this.currentLayer]; 49960 if ("raster" === e1.type || "raster-particle" === e1.type) { 49961 const i = t1.getLayerSourceCache(e1); 49962 this.renderLayer(this, i, e1, I(e1, i)); 49963 } 49964 ++this.currentLayer; 49965 } 49966 this.renderElevatedRasterBackface = !1; 49967 } 49968 this.currentLayer = 0, this.firstLightBeamLayer = Number.MAX_SAFE_INTEGER; 49969 const D = w ? w.getGroundShadowLayerIndex() : -1; 49970 let P = !1, L = -1; 49971 for(let e1 = 0; e1 < n.length; ++e1){ 49972 const t1 = u[e1]; 49973 t1.isHidden(this.transform.zoom) || t1.is3D(r) && (L = e1); 49974 } 49975 l && -1 === L && (a = !0); 49976 let R = !1; 49977 for(; this.currentLayer < n.length;){ 49978 const e1 = u[this.currentLayer], i = t1.getLayerSourceCache(e1); 49979 if (e1.isSky()) ++this.currentLayer; 49980 else if (this.terrain && this.style.isLayerDraped(e1)) { 49981 if (e1.isHidden(this.transform.zoom)) { 49982 ++this.currentLayer; 49983 continue; 49984 } 49985 this.currentLayer = this.terrain.renderBatch(this.currentLayer), this._lastOcclusionLayer = Math.max(this.currentLayer, this._lastOcclusionLayer); 49986 } else { 49987 if (!R && e1.is3D(r) && !r) { 49988 const e1 = this.currentLayer, t1 = (e1)=>{ 49989 for(this.currentLayer = 0; this.currentLayer < u.length; this.currentLayer++){ 49990 const t1 = u[this.currentLayer]; 49991 if ("fill" === t1.type && Xs.drawDepthPrepass) { 49992 const i = this.style.getLayerSourceCache(t1); 49993 Xs.drawDepthPrepass(this, i, t1, I(t1, i), e1); 49994 } 49995 } 49996 }; 49997 t1("initialize"), t1("reset"), this.currentLayer = e1, R = !0; 49998 } 49999 if (a && !P && this.terrain && !this.transform.isOrthographic && (P = !0, this.blitDepth()), l && -1 !== L && this.currentLayer === L + 1 && !this.transform.isOrthographic && this.blitDepth(), this.terrain || this._renderTileClippingMasks(e1, i, i ? m[i.id] : void 0), this.renderLayer(this, i, e1, I(e1, i)), !this.terrain && w && this.currentLayer === D) { 50000 { 50001 this.clearStencil(), this.resetStencilClippingMasks(); 50002 const e1 = this.currentLayer; 50003 for(this.currentLayer = 0; this.currentLayer < u.length; this.currentLayer++){ 50004 const e1 = u[this.currentLayer]; 50005 if ("fill" === e1.type && Xs.drawGroundShadowMask) { 50006 const t1 = this.style.getLayerSourceCache(e1); 50007 Xs.drawGroundShadowMask(this, t1, e1, I(e1, t1)); 50008 } 50009 } 50010 this.currentLayer = e1; 50011 } 50012 if (w.drawGroundShadows(), this.firstLightBeamLayer <= this.currentLayer) { 50013 const e1 = this.currentLayer; 50014 for(this.renderPass = "light-beam", this.currentLayer = this.firstLightBeamLayer; this.currentLayer <= e1; this.currentLayer++){ 50015 const e1 = u[this.currentLayer]; 50016 if (!e1.hasLightBeamPass()) continue; 50017 const i = t1.getLayerSourceCache(e1); 50018 this.renderLayer(this, i, e1, i ? _[i.id] : void 0); 50019 } 50020 this.currentLayer = e1, this.renderPass = "translucent"; 50021 } 50022 } 50023 if (this.currentLayer >= this._lastOcclusionLayer && this.layersWithOcclusionOpacity.length > 0) { 50024 const e1 = this.currentLayer; 50025 this.depthOcclusion = !0; 50026 for (const e1 of this.layersWithOcclusionOpacity){ 50027 this.currentLayer = e1; 50028 const i = u[this.currentLayer], s = t1.getLayerSourceCache(i), r = s ? _[s.id] : void 0; 50029 this.terrain || this._renderTileClippingMasks(i, s, s ? m[s.id] : void 0), this.renderLayer(this, s, i, r); 50030 } 50031 this.depthOcclusion = !1, this.currentLayer = e1, this.renderPass = "translucent", this.layersWithOcclusionOpacity = []; 50032 } 50033 ++this.currentLayer; 50034 } 50035 } 50036 if (this.terrain && this.terrain.postRender(), this._snow && this._snow.draw(this), this._rain && this._rain.draw(this), this.options.showTileBoundaries || this.options.showQueryGeometry || this.options.showTileAABBs) { 50037 let i = null; 50038 u.forEach((e1)=>{ 50039 const s = t1.getLayerSourceCache(e1); 50040 s && !e1.isHidden(this.transform.zoom) && s.getVisibleCoordinates().length && (!i || i.getSource().maxzoom < s.getSource().maxzoom) && (i = s); 50041 }), i && this.options.showTileBoundaries && xt.drawDebug && xt.drawDebug(this, i, i.getVisibleCoordinates(), e1.C.red, !1, this.options.showParseStatus); 50042 } 50043 this.options.showPadding && xt.drawDebugPadding && xt.drawDebugPadding(this), this.context.setDefault(), this.frameCounter = (this.frameCounter + 1) % Number.MAX_SAFE_INTEGER, this.tileLoaded && this.options.speedIndexTiming && (this.loadTimeStamps.push(performance.now()), this.saveCanvasCopy()), d || (this.conflationActive = !1); 50044 } 50045 prepareLayer(e1) { 50046 this.gpuTimingStart(e1); 50047 const { unsupportedLayers: t1 } = this.transform.projection, i = !t1 || !t1.includes(e1.type); 50048 if (Fa[e1.type] && (i || this.terrain && "custom" === e1.type)) { 50049 const t1 = this.style.getLayerSourceCache(e1); 50050 Fa[e1.type](e1, t1, this); 50051 } 50052 this.gpuTimingEnd(); 50053 } 50054 renderLayer(e1, t1, i, s) { 50055 i.isHidden(this.transform.zoom) || ("background" === i.type || "sky" === i.type || "custom" === i.type || "model" === i.type || "raster" === i.type || "raster-particle" === i.type || s && s.length) && (this.id = i.id, this.gpuTimingStart(i), (!e1.transform.projection.unsupportedLayers || !e1.transform.projection.unsupportedLayers.includes(i.type) || e1.terrain && "custom" === i.type) && "clip" !== i.type && "slot" !== i.type && Oa[i.type] && Oa[i.type](e1, t1, i, s, this.style.placement.variableOffsets, this.options.isInitialLoad), Oa[i.type] || (i.mayUse("HD") && async function() { 50056 await Ks(), Object.assign(Oa, { 50057 building: Xs.drawBuilding, 50058 "raster-particle": Xs.drawRasterParticle 50059 }), Object.assign(Fa, { 50060 "raster-particle": Xs.prepareRasterParticle 50061 }); 50062 }(), i.mayUse("Standard") && ka(e1)), this.gpuTimingEnd()); 50063 } 50064 gpuTimingStart(e1) { 50065 if (!this.options.gpuTiming) return; 50066 const t1 = this.context.extTimerQuery, i = this.context.gl; 50067 let s = this.gpuTimers[e1.id]; 50068 s || (s = this.gpuTimers[e1.id] = { 50069 calls: 0, 50070 cpuTime: 0, 50071 query: i.createQuery() 50072 }), s.calls++, i.beginQuery(t1.TIME_ELAPSED_EXT, s.query); 50073 } 50074 gpuTimingDeferredRenderStart() { 50075 if (this.options.gpuTimingDeferredRender) { 50076 const e1 = this.context.extTimerQuery, t1 = this.context.gl, i = t1.createQuery(); 50077 this.deferredRenderGpuTimeQueries.push(i), t1.beginQuery(e1.TIME_ELAPSED_EXT, i); 50078 } 50079 } 50080 gpuTimingDeferredRenderEnd() { 50081 this.options.gpuTimingDeferredRender && this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT); 50082 } 50083 gpuTimingEnd() { 50084 this.options.gpuTiming && this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT); 50085 } 50086 collectGpuTimers() { 50087 const e1 = this.gpuTimers; 50088 return this.gpuTimers = {}, e1; 50089 } 50090 collectDeferredRenderGpuQueries() { 50091 const e1 = this.deferredRenderGpuTimeQueries; 50092 return this.deferredRenderGpuTimeQueries = [], e1; 50093 } 50094 queryGpuTimers(e1) { 50095 const t1 = {}; 50096 for(const i in e1){ 50097 const s = e1[i], r = this.context.extTimerQuery, o = r.getQueryParameter(s.query, this.context.gl.QUERY_RESULT) / 1e6; 50098 r.deleteQueryEXT(s.query), t1[i] = o; 50099 } 50100 return t1; 50101 } 50102 queryGpuTimeDeferredRender(e1) { 50103 if (!this.options.gpuTimingDeferredRender) return 0; 50104 const t1 = this.context.gl; 50105 let i = 0; 50106 for (const s of e1)i += t1.getQueryParameter(s, t1.QUERY_RESULT) / 1e6, t1.deleteQuery(s); 50107 return i; 50108 } 50109 translatePosMatrix(t1, i, s, r, o) { 50110 if (!s[0] && !s[1]) return t1; 50111 const n = o ? "map" === r ? this.transform.angle : 0 : "viewport" === r ? -this.transform.angle : 0; 50112 if (n) { 50113 const e1 = Math.sin(n), t1 = Math.cos(n); 50114 s = [ 50115 s[0] * t1 - s[1] * e1, 50116 s[0] * e1 + s[1] * t1 50117 ]; 50118 } 50119 const a = [ 50120 o ? s[0] : e1.ce(i, s[0], this.transform.zoom), 50121 o ? s[1] : e1.ce(i, s[1], this.transform.zoom), 50122 0 50123 ], l = new Float32Array(16); 50124 return e1.bM(l, t1, a), l; 50125 } 50126 saveTileTexture(e1) { 50127 if (e1.context !== this.context) return; 50128 const t1 = e1.size[0], i = this._tileTextures[t1]; 50129 i ? i.push(e1) : this._tileTextures[t1] = [ 50130 e1 50131 ]; 50132 } 50133 getTileTexture(e1) { 50134 const t1 = this._tileTextures[e1]; 50135 return t1 && t1.length > 0 ? t1.pop() : null; 50136 } 50137 terrainRenderModeElevated() { 50138 return this.style && this.style.hasTerrain() && !!this.terrain && !this.terrain.renderingToTexture || this.forceTerrainMode; 50139 } 50140 linearFloatFilteringSupported() { 50141 return null != this.context.extTextureFloatLinear; 50142 } 50143 currentGlobalDefines(e1, t1, i, s, r) { 50144 const o = void 0 === i ? !!this._terrain && this._terrain.renderingToTexture : i, n = void 0 === s ? this.terrainRenderModeElevated() : s, a = void 0 === r ? "globe" === this.transform.projection.name : r, l = []; 50145 return this.style && this.style.enable3dLights() && ("globeRaster" === e1 || "terrainRaster" === e1 ? (l.push("LIGHTING_3D_MODE"), l.push("LIGHTING_3D_ALPHA_EMISSIVENESS")) : o || l.push("LIGHTING_3D_MODE")), n && (l.push("TERRAIN"), this.linearFloatFilteringSupported() && l.push("TERRAIN_DEM_FLOAT_FORMAT")), a && l.push("GLOBE"), !this._fogVisible || o || void 0 !== t1 && !t1 || l.push("FOG"), o && l.push("RENDER_TO_TEXTURE"), this._showOverdrawInspector && l.push("OVERDRAW_INSPECTOR"), l; 50146 } 50147 getOrCreateProgram(e1, t1) { 50148 this.cache = this.cache || {}; 50149 const { defines: i, config: s, overrideFog: r, overrideRtt: o, overrideTerrain: n, overrideGlobe: a, precompiled: l } = t1 || {}, c = this.currentGlobalDefines(e1, r, o, n, a).concat(i || []), h = this.getShaderSource(e1), d = Xs.programUniforms, u = ci.programUniforms, p = fo[e1] || d && d[e1] || u && u[e1], f = Xn.cacheKey(h, e1, c, s); 50150 return this.cache[f] || (this.cache[f] = new Xn(this.context, e1, h, s, p, c, l)), this.cache[f]; 50151 } 50152 getShaderSource(t1) { 50153 const i = Xs.shaders, s = ci.shaders, r = _o.shaders; 50154 return e1.eu[t1] || i && i[t1] || s && s[t1] || r && r[t1]; 50155 } 50156 setCustomLayerDefaults() { 50157 this.context.unbindVAO(), this.context.cullFace.setDefault(), this.context.frontFace.setDefault(), this.context.cullFaceSide.setDefault(), this.context.activeTexture.setDefault(), this.context.pixelStoreUnpack.setDefault(), this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.context.pixelStoreUnpackFlipY.setDefault(); 50158 } 50159 setBaseState() { 50160 const e1 = this.context.gl; 50161 this.context.cullFace.set(!1), this.context.viewport.set([ 50162 0, 50163 0, 50164 this.width, 50165 this.height 50166 ]), this.context.blendEquation.set(e1.FUNC_ADD); 50167 } 50168 initDebugOverlayCanvas() { 50169 null == this.debugOverlayCanvas && (this.debugOverlayCanvas = document.createElement("canvas"), this.debugOverlayCanvas.width = 512, this.debugOverlayCanvas.height = 512, this.debugOverlayTexture = new e1.T(this.context, this.debugOverlayCanvas, this.context.gl.RGBA8)); 50170 } 50171 destroy() { 50172 this._terrain && this._terrain.destroy(), this._atmosphere && (this._atmosphere.destroy(), this._atmosphere = void 0), this.globeSharedBuffers && this.globeSharedBuffers.destroy(), this.emptyTexture.destroy(), this.debugOverlayTexture && this.debugOverlayTexture.destroy(), this._wireframeDebugCache.destroy(), this.depthFBO && (this.depthFBO.destroy(), this.depthFBO = void 0, this.depthTexture = void 0), this.emptyDepthTexture && this.emptyDepthTexture.destroy(), this._destroyed = !0; 50173 } 50174 prepareDrawTile() { 50175 this.terrain && this.terrain.prepareDrawTile(); 50176 } 50177 uploadCommonLightUniforms(t1, i, s) { 50178 if (this.style.enable3dLights()) { 50179 const r = this.style.directionalLight, o = this.style.ambientLight; 50180 if (r && o) { 50181 const n = ((t1, i, s, r)=>{ 50182 const o = t1.properties.get("direction"), n = "none" === t1.properties.get("color-use-theme"), a = t1.properties.get("color").toNonPremultipliedRenderColor(n ? null : s.getLut(t1.scope)).toArray01(); 50183 let l = t1.properties.get("intensity"); 50184 const c = "none" === i.properties.get("color-use-theme"), h = i.properties.get("color").toNonPremultipliedRenderColor(c ? null : s.getLut(i.scope)).toArray01(); 50185 let d = i.properties.get("intensity"); 50186 const u = [ 50187 o.x, 50188 o.y, 50189 o.z 50190 ]; 50191 r && (void 0 !== r.ambientIntensity && (d = r.ambientIntensity), void 0 !== r.directionalIntensity && (l = r.directionalIntensity), void 0 !== r.ambientColor && (h[0] = r.ambientColor[0], h[1] = r.ambientColor[1], h[2] = r.ambientColor[2]), void 0 !== r.directionalColor && (a[0] = r.directionalColor[0], a[1] = r.directionalColor[1], a[2] = r.directionalColor[2])); 50192 const p = e1.dP(h, d), f = e1.dP(a, l); 50193 return { 50194 u_lighting_ambient_color: p, 50195 u_lighting_directional_dir: u, 50196 u_lighting_directional_color: f, 50197 u_ground_radiance: $n(u, f, p) 50198 }; 50199 })(r, o, this.style, s); 50200 i.setLightsUniformValues(t1, n); 50201 } 50202 } 50203 } 50204 uploadCommonUniforms(t1, i, s, r, o, n) { 50205 if (this.uploadCommonLightUniforms(t1, i, n), this.terrain && this.terrain.renderingToTexture) return; 50206 const a = this.style.fog; 50207 if (a) { 50208 const o = a.getOpacity(this.transform.pitch), n = ((t1, i, s, r, o, n, a, l, c, h, d, u)=>{ 50209 const p = t1.transform, f = "none" === i.properties.get("color-use-theme"), m = i.properties.get("color").toNonPremultipliedRenderColor(f ? null : t1.style.getLut(i.scope)).toArray01(); 50210 m[3] = r; 50211 const _ = t1.frameCounter / 1e3 % 1, [g, y] = i.properties.get("vertical-range"); 50212 return { 50213 u_fog_matrix: s ? p.calculateFogTileMatrix(s) : u || t1.identityMat, 50214 u_fog_range: i.getRangeForProjection(), 50215 u_fog_color: m, 50216 u_fog_horizon_blend: i.properties.get("horizon-blend"), 50217 u_fog_vertical_limit: [ 50218 Math.min(g, y), 50219 y 50220 ], 50221 u_fog_temporal_offset: _, 50222 u_frustum_tl: o, 50223 u_frustum_tr: n, 50224 u_frustum_br: a, 50225 u_frustum_bl: l, 50226 u_globe_pos: c, 50227 u_globe_radius: h, 50228 u_viewport: d, 50229 u_globe_transition: e1.S(p.zoom), 50230 u_is_globe: +("globe" === p.projection.name) 50231 }; 50232 })(this, a, s, o, this.transform.frustumCorners.TL, this.transform.frustumCorners.TR, this.transform.frustumCorners.BR, this.transform.frustumCorners.BL, this.transform.globeCenterInViewSpace, this.transform.globeRadius, [ 50233 this.transform.width * e1.e.devicePixelRatio, 50234 this.transform.height * e1.e.devicePixelRatio 50235 ], r); 50236 i.setFogUniformValues(t1, n); 50237 } 50238 o && i.setCutoffUniformValues(t1, o.uniformValues); 50239 } 50240 setTileLoadedFlag(e1) { 50241 this.tileLoaded = e1; 50242 } 50243 saveCanvasCopy() { 50244 const e1 = this.canvasCopy(); 50245 e1 && (this.frameCopies.push(e1), this.tileLoaded = !1); 50246 } 50247 canvasCopy() { 50248 const e1 = this.context.gl, t1 = e1.createTexture(); 50249 return e1.bindTexture(e1.TEXTURE_2D, t1), e1.copyTexImage2D(e1.TEXTURE_2D, 0, e1.RGBA, 0, 0, e1.drawingBufferWidth, e1.drawingBufferHeight, 0), t1; 50250 } 50251 getCanvasCopiesAndTimestamps() { 50252 return { 50253 canvasCopies: this.frameCopies, 50254 timeStamps: this.loadTimeStamps 50255 }; 50256 } 50257 averageElevationNeedsEasing() { 50258 if (!this.transform._elevation) return !1; 50259 const e1 = this.style && this.style.fog; 50260 return !!e1 && 0 !== e1.getOpacity(this.transform.pitch); 50261 } 50262 getBackgroundTiles() { 50263 const e1 = this._backgroundTiles, t1 = this._backgroundTiles = {}, i = this.transform.coveringTiles({ 50264 tileSize: 512 50265 }); 50266 for (const s of i)t1[s.key] = e1[s.key] || new fs(s, 512, this.transform.tileZoom, this, void 0, this.worldview); 50267 return t1; 50268 } 50269 clearBackgroundTiles() { 50270 this._backgroundTiles = {}; 50271 } 50272 isSourceForClippingOrConflation(e1, t1) { 50273 return !(!e1.is3D(!(!this.terrain || !this.terrain.enabled)) || "clip" !== e1.type && "building" !== e1.type && (e1.minzoom && e1.minzoom > this.transform.zoom || (this.style._clipLayerPresent || "building" !== e1.sourceLayer && "procedural_buildings" !== e1.sourceLayer) && (!t1 || "batched-model" !== t1.type))); 50274 } 50275 isTileAffectedByFog(t1) { 50276 if (!this.style || !this.style.fog) return !1; 50277 if ("globe" === this.transform.projection.name) return !0; 50278 let i = this._cachedTileFogOpacities[t1.key]; 50279 return i || (this._cachedTileFogOpacities[t1.key] = i = this.style.fog.getOpacityForTile(t1)), i[0] >= e1.at || i[1] >= e1.at; 50280 } 50281 setupDepthForOcclusion(e1, t1, i) { 50282 const s = this.context, r = s.gl, o = !!i; 50283 var n; 50284 i || (i = { 50285 u_dem: 2, 50286 u_dem_prev: 4, 50287 u_dem_tl: [ 50288 0, 50289 0 50290 ], 50291 u_dem_tl_prev: [ 50292 0, 50293 0 50294 ], 50295 u_dem_scale: 0, 50296 u_dem_scale_prev: 0, 50297 u_dem_size: 0, 50298 u_dem_lerp: 1, 50299 u_depth: 3, 50300 u_depth_size_inv: [ 50301 0, 50302 0 50303 ], 50304 u_depth_range_unpack: [ 50305 0, 50306 1 50307 ], 50308 u_occluder_half_size: 16, 50309 u_occlusion_depth_offset: -1e-4, 50310 u_exaggeration: 0 50311 }), s.activeTexture.set(r.TEXTURE3), e1 && this.depthFBO && this.depthTexture ? (this.depthTexture.bind(r.NEAREST, r.CLAMP_TO_EDGE), i.u_depth_size_inv = [ 50312 1 / this.depthFBO.width, 50313 1 / this.depthFBO.height 50314 ], i.u_depth_range_unpack = [ 50315 2 / ((n = this.depthRangeFor3D)[1] - n[0]), 50316 -1 - 2 * n[0] / (n[1] - n[0]) 50317 ], i.u_occluder_half_size = .5 * this.occlusionParams.occluderSize, i.u_occlusion_depth_offset = this.occlusionParams.depthOffset) : this.emptyDepthTexture.bind(r.NEAREST, r.CLAMP_TO_EDGE), s.activeTexture.set(r.TEXTURE0), o || t1.setTerrainUniformValues(s, i); 50318 } 50319 updateEmissiveMode() { 50320 if (this._forceEmissiveMode) return; 50321 const e1 = this.style.hasDataDrivenEmissiveStrength(); 50322 this.emissiveMode = e1 ? this.context.extBlendFuncExtended ? "dual-source-blending" : "mrt-fallback" : "constant"; 50323 } 50324 constructor(t1, i, s, r, o){ 50325 this.context = new ea(t1, i), this.transform = s, this._tileTextures = {}, this.frameCopies = [], this.loadTimeStamps = [], this.frcCoverageSnapshot = null, this.elevationCoverageSnapshot = null, this.elevationProvidersReady = void 0, this.frcCoverageFadeRange = null, this.frcCoverageSourceLayers = [], this.frcCoverageRenderer = Xs.FrcCoverageRenderer ? new Xs.FrcCoverageRenderer : null, this._debugParams = { 50326 averageFPS: 0, 50327 fpsHistory: [], 50328 fpsWindow: 30, 50329 continousRedraw: !1, 50330 enabledLayers: {}, 50331 buildingsShowNormals: !1, 50332 buildingsDrawGroundAO: !0, 50333 buildingsDrawShadowPass: !0, 50334 buildingsDrawTranslucentPass: !0, 50335 showTerrainProxyTiles: !1, 50336 terrainSortTilesHiZFirst: !0, 50337 terrainDisableRenderCache: !1, 50338 forceEnablePrecipitation: !1, 50339 overrideSnowParams: !1, 50340 snowParamsOverride: null, 50341 snowRevealParamsOverride: null,
50342 snowVignetteParamsOverride: null, 50343 overrideRainParams: !1, 50344 rainParamsOverride: null, 50345 rainRevealParamsOverride: null, 50346 rainVignetteParamsOverride: null, 50347 overrideStarsParams: !1, 50348 starsParamsOverride: null, 50349 show3DModelFootprints: !1, 50350 showElevationIdDebug: !1, 50351 lodSwitchDistance: -1, 50352 lodSwitchFadeDuration: .5 50353 }, this.occlusionParams = new Ma, this.setup(), this.numSublayers = gs.maxUnderzooming + gs.maxOverzooming + 1, this.depthEpsilon = 1 / Math.pow(2, 16), this.deferredRenderGpuTimeQueries = [], this.gpuTimers = {}, this.frameCounter = 0, this.frameTimeDelta = 0, this.lastPaintStartTimeStamp = 0, this._shadowCullCache = null, this._backgroundTiles = {}, this.conflationActive = !1, this.replacementSource = new e1.eq, this.longestCutoffRange = 0, this.minCutoffZoom = 0, this._fogVisible = !1, this._cachedTileFogOpacities = {}, this._wireframeDebugCache = new Aa, this.renderDefaultNorthPole = !0, this.renderDefaultSouthPole = !0, this.layersWithOcclusionOpacity = []; 50354 const n = new e1.b({ 50355 width: 1, 50356 height: 1 50357 }, Uint8Array.of(0, 0, 0, 0)); 50358 this.emptyDepthTexture = new e1.T(this.context, n, t1.RGBA8), this._clippingActiveLastFrame = !1, this.scaleFactor = r, this.maxFrontCutoffRawStart = 0, this.worldview = o, this._forceEmissiveMode = !1, this.emissiveMode = "constant"; 50359 } 50360 } 50361 function za(e1, t1) { 50362 let i = !1, s = null; 50363 const r = ()=>{ 50364 s = null, i && (e1(), s = setTimeout(r, t1), i = !1); 50365 }; 50366 return ()=>(i = !0, s || r(), s); 50367 } 50368 const Ua = /(#.+)?$/; 50369 class Na { 50370 addTo(e1) { 50371 return this._map = e1, window.addEventListener("hashchange", this._onHashChange, !1), e1.on("moveend", this._updateHash), this; 50372 } 50373 remove() { 50374 return this._map ? (this._map.off("moveend", this._updateHash), window.removeEventListener("hashchange", this._onHashChange, !1), clearTimeout(this._updateHash()), this._map = void 0, this) : this; 50375 } 50376 getHashString() { 50377 const e1 = this._map; 50378 if (!e1) return ""; 50379 const t1 = ja(e1); 50380 if (this._hashName) { 50381 const e1 = this._hashName; 50382 let i = !1; 50383 const s = location.hash.slice(1).split("&").map((s)=>{ 50384 const r = s.split("=")[0]; 50385 return r === e1 ? (i = !0, "".concat(r, "=").concat(t1)) : s; 50386 }).filter((e1)=>e1); 50387 return i || s.push("".concat(e1, "=").concat(t1)), "#".concat(s.join("&")); 50388 } 50389 return "#".concat(t1); 50390 } 50391 _getCurrentHash() { 50392 const e1 = location.hash.replace("#", ""); 50393 if (this._hashName) { 50394 let t1; 50395 return e1.split("&").map((e1)=>e1.split("=")).forEach((e1)=>{ 50396 e1[0] === this._hashName && (t1 = e1); 50397 }), (t1 && t1[1] || "").split("/"); 50398 } 50399 return e1.split("/"); 50400 } 50401 _onHashChange() { 50402 const e1 = this._map; 50403 if (!e1) return !1; 50404 const t1 = this._getCurrentHash(); 50405 if (t1.length >= 3 && !t1.some((e1)=>isNaN(Number(e1)))) { 50406 const i = e1.dragRotate.isEnabled() && e1.touchZoomRotate.isEnabled() ? +(t1[3] || 0) : e1.getBearing(); 50407 return e1.jumpTo({ 50408 center: [ 50409 +t1[2], 50410 +t1[1] 50411 ], 50412 zoom: +t1[0], 50413 bearing: i, 50414 pitch: +(t1[4] || 0) 50415 }), !0; 50416 } 50417 return !1; 50418 } 50419 _updateHashUnthrottled() { 50420 history.replaceState(history.state, "", location.href.replace(Ua, this.getHashString())); 50421 } 50422 constructor(t1){ 50423 this._hashName = t1 && encodeURIComponent(t1), e1.aV([ 50424 "_getCurrentHash", 50425 "_onHashChange", 50426 "_updateHash" 50427 ], this), this._updateHash = za(this._updateHashUnthrottled.bind(this), 300); 50428 } 50429 } 50430 function ja(e1, t1) { 50431 const i = e1.getCenter(), s = Math.round(100 * e1.getZoom()) / 100, r = Math.
vendor: 13,928 bytes, lines 50431-50763
50431ceil((s * Math.LN2 + Math.log(512 / 360 / .5)) / Math.LN10), o = Math.pow(10, r), n = Math.round(i.lng * o) / o, a = Math.round(i.lat * o) / o, l = e1.getBearing(), c = e1.getPitch(); 50432 let h = t1 ? "/".concat(n, "/").concat(a, "/").concat(s) : "".concat(s, "/").concat(a, "/").concat(n); 50433 return (l || c) && (h += "/" + Math.round(10 * l) / 10), c && (h += "/".concat(Math.round(c))), h; 50434 } 50435 const Va = { 50436 linearity: .3, 50437 easing: e1.ew(0, 0, .3, 1) 50438 }, Ga = { 50439 deceleration: 2500, 50440 maxSpeed: 1400, 50441 ...Va 50442 }, qa = { 50443 deceleration: 20, 50444 maxSpeed: 1400, 50445 ...Va 50446 }, Za = { 50447 deceleration: 1e3, 50448 maxSpeed: 360, 50449 ...Va 50450 }, $a = { 50451 deceleration: 1e3, 50452 maxSpeed: 90, 50453 ...Va 50454 }; 50455 class Ha { 50456 clear() { 50457 this._inertiaBuffer = []; 50458 } 50459 record(t1) { 50460 this._drainInertiaBuffer(), this._inertiaBuffer.push({ 50461 time: e1.e.now(), 50462 settings: t1 50463 }); 50464 } 50465 _drainInertiaBuffer() { 50466 const t1 = this._inertiaBuffer, i = e1.e.now(); 50467 for(; t1.length > 0 && i - t1[0].time > 160;)t1.shift(); 50468 } 50469 _onMoveEnd(t1) { 50470 if (this._map._prefersReducedMotion()) return; 50471 if (this._drainInertiaBuffer(), this._inertiaBuffer.length < 2) return; 50472 const i = { 50473 zoom: 0, 50474 bearing: 0, 50475 pitch: 0, 50476 pan: new e1.P(0, 0), 50477 pinchAround: void 0, 50478 around: void 0 50479 }; 50480 for (const { settings: e1 } of this._inertiaBuffer)i.zoom += e1.zoomDelta || 0, i.bearing += e1.bearingDelta || 0, i.pitch += e1.pitchDelta || 0, e1.panDelta && i.pan._add(e1.panDelta), e1.around && (i.around = e1.around), e1.pinchAround && (i.pinchAround = e1.pinchAround); 50481 const s = this._inertiaBuffer.at(-1).time - this._inertiaBuffer[0].time, r = {}; 50482 if (i.pan.mag()) { 50483 const e1 = Xa(i.pan.mag(), s, { 50484 ...Ga, 50485 ...t1 || {} 50486 }); 50487 r.offset = i.pan.mult(e1.amount / i.pan.mag()), r.center = this._map.transform.center, Wa(r, e1); 50488 } 50489 if (i.zoom) { 50490 const e1 = Xa(i.zoom, s, qa); 50491 r.zoom = this._map.transform.zoom + e1.amount, Wa(r, e1); 50492 } 50493 if (i.bearing) { 50494 const t1 = Xa(i.bearing, s, Za); 50495 r.bearing = this._map.transform.bearing + e1.b0(t1.amount, -179, 179), Wa(r, t1); 50496 } 50497 if (i.pitch) { 50498 const e1 = Xa(i.pitch, s, $a); 50499 r.pitch = this._map.transform.pitch + e1.amount, Wa(r, e1); 50500 } 50501 if (r.zoom || r.bearing) { 50502 const e1 = void 0 === i.pinchAround ? i.around : i.pinchAround; 50503 r.around = e1 ? this._map.unproject(e1) : this._map.getCenter(); 50504 } 50505 return this.clear(), r.noMoveStart = !0, r; 50506 } 50507 constructor(e1){ 50508 this._map = e1, this.clear(); 50509 } 50510 } 50511 function Wa(e1, t1) { 50512 (!e1.duration || e1.duration < t1.duration) && (e1.duration = t1.duration, e1.easing = t1.easing); 50513 } 50514 function Xa(t1, i, s) { 50515 const { maxSpeed: r, linearity: o, deceleration: n } = s, a = e1.b0(t1 * o / (i / 1e3), -r, r), l = Math.abs(a) / (n * o); 50516 return { 50517 easing: s.easing, 50518 duration: 1e3 * l, 50519 amount: a * (l / 2) 50520 }; 50521 } 50522 class Ka extends e1.h { 50523 preventDefault() { 50524 this._defaultPrevented = !0; 50525 } 50526 get defaultPrevented() { 50527 return this._defaultPrevented; 50528 } 50529 constructor(e1, t1, i, s = {}){ 50530 const r = _(t1.getCanvasContainer(), i); 50531 super(e1, { 50532 point: r, 50533 lngLat: t1.unproject(r), 50534 originalEvent: i, 50535 ...s 50536 }), this._defaultPrevented = !1, this.target = t1; 50537 } 50538 } 50539 class Ya extends e1.h { 50540 preventDefault() { 50541 this._defaultPrevented = !0; 50542 } 50543 get defaultPrevented() { 50544 return this._defaultPrevented; 50545 } 50546 constructor(t1, i, s){ 50547 const r = "touchend" === t1 ? s.changedTouches : s.touches, o = g(i.getCanvasContainer(), r), n = o.map((e1)=>i.unproject(e1)), a = o.reduce((e1, t1, i, s)=>e1.add(t1.div(s.length)), new e1.P(0, 0)); 50548 super(t1, { 50549 points: o, 50550 point: a, 50551 lngLats: n, 50552 lngLat: i.unproject(a), 50553 originalEvent: s 50554 }), this._defaultPrevented = !1; 50555 } 50556 } 50557 class Qa extends e1.h { 50558 preventDefault() { 50559 this._defaultPrevented = !0; 50560 } 50561 get defaultPrevented() { 50562 return this._defaultPrevented; 50563 } 50564 constructor(e1, t1){ 50565 super("wheel", { 50566 originalEvent: t1 50567 }), this._defaultPrevented = !1; 50568 } 50569 } 50570 class Ja { 50571 reset() { 50572 this._mousedownPos = void 0; 50573 } 50574 wheel(e1) { 50575 return this._firePreventable(new Qa(this._map, e1)); 50576 } 50577 mousedown(e1, t1) { 50578 return this._mousedownPos = t1, this._firePreventable(new Ka(e1.type, this._map, e1)); 50579 } 50580 mouseup(e1) { 50581 this._map.fire(new Ka(e1.type, this._map, e1)); 50582 } 50583 preclick(e1) { 50584 const t1 = new MouseEvent("preclick", e1); 50585 this._map.fire(new Ka(t1.type, this._map, t1)); 50586 } 50587 click(e1, t1) { 50588 this._mousedownPos && this._mousedownPos.dist(t1) >= this._clickTolerance || (this.preclick(e1), this._map.fire(new Ka(e1.type, this._map, e1))); 50589 } 50590 dblclick(e1) { 50591 return this._firePreventable(new Ka(e1.type, this._map, e1)); 50592 } 50593 mouseover(e1) { 50594 this._map.fire(new Ka(e1.type, this._map, e1)); 50595 } 50596 mouseout(e1) { 50597 this._map.fire(new Ka(e1.type, this._map, e1)); 50598 } 50599 touchstart(e1) { 50600 return this._firePreventable(new Ya(e1.type, this._map, e1)); 50601 } 50602 touchmove(e1) { 50603 this._map.fire(new Ya(e1.type, this._map, e1)); 50604 } 50605 touchend(e1) { 50606 this._map.fire(new Ya(e1.type, this._map, e1)); 50607 } 50608 touchcancel(e1) { 50609 this._map.fire(new Ya(e1.type, this._map, e1)); 50610 } 50611 _firePreventable(e1) { 50612 if (this._map.fire(e1), e1.defaultPrevented) return {}; 50613 } 50614 isEnabled() { 50615 return !0; 50616 } 50617 isActive() { 50618 return !1; 50619 } 50620 enable() {} 50621 disable() {} 50622 constructor(e1, t1){ 50623 this._map = e1, this._clickTolerance = t1.clickTolerance; 50624 } 50625 } 50626 class el { 50627 reset() { 50628 this._delayContextMenu = !1, this._contextMenuEvent = void 0; 50629 } 50630 mousemove(e1) { 50631 this._map.fire(new Ka(e1.type, this._map, e1)); 50632 } 50633 mousedown() { 50634 this._delayContextMenu = !0; 50635 } 50636 mouseup() { 50637 this._delayContextMenu = !1, this._contextMenuEvent && (this._map.fire(new Ka("contextmenu", this._map, this._contextMenuEvent)), delete this._contextMenuEvent); 50638 } 50639 contextmenu(e1) { 50640 this._delayContextMenu ? this._contextMenuEvent = e1 : this._map.fire(new Ka(e1.type, this._map, e1)), this._map.listens("contextmenu") && e1.preventDefault(); 50641 } 50642 isEnabled() { 50643 return !0; 50644 } 50645 isActive() { 50646 return !1; 50647 } 50648 enable() {} 50649 disable() {} 50650 constructor(e1){ 50651 this._map = e1; 50652 } 50653 } 50654 class tl { 50655 isEnabled() { 50656 return !!this._enabled; 50657 } 50658 isActive() { 50659 return !!this._active; 50660 } 50661 enable() { 50662 this.isEnabled() || (this._enabled = !0); 50663 } 50664 disable() { 50665 this.isEnabled() && (this._enabled = !1); 50666 } 50667 mousedown(e1, t1) { 50668 this.isEnabled() && e1.shiftKey && 0 === e1.button && (u(), this._startPos = this._lastPos = t1, this._active = !0); 50669 } 50670 mousemoveWindow(e1, t1) { 50671 if (!this._active) return; 50672 const i = t1, s = this._startPos, r = this._lastPos; 50673 if (!s || !r || r.equals(i) || !this._box && i.dist(s) < this._clickTolerance) return; 50674 this._lastPos = i, this._box || (this._box = a("div", "mapboxgl-boxzoom", this._container), this._container.classList.add("mapboxgl-crosshair"), this._fireEvent("boxzoomstart", e1)); 50675 const o = Math.min(s.x, i.x), n = Math.max(s.x, i.x), l = Math.min(s.y, i.y), c = Math.max(s.y, i.y); 50676 this._map._requestDomTask(()=>{ 50677 this._box && (this._box.style.transform = "translate(".concat(o, "px,").concat(l, "px)"), this._box.style.width = n - o + "px", this._box.style.height = c - l + "px"); 50678 }); 50679 } 50680 mouseupWindow(t1, i) { 50681 if (!this._active) return; 50682 const s = this._startPos, r = i; 50683 if (s && 0 === t1.button) { 50684 if (this.reset(), m(), s.x !== r.x || s.y !== r.y) return this._map.fire(new e1.h("boxzoomend", { 50685 originalEvent: t1 50686 })), { 50687 cameraAnimation: (e1)=>e1.fitScreenCoordinates(s, r, this._map.getBearing(), { 50688 linear: !1 50689 }) 50690 }; 50691 this._fireEvent("boxzoomcancel", t1); 50692 } 50693 } 50694 keydown(e1) { 50695 this._active && 27 === e1.keyCode && (this.reset(), this._fireEvent("boxzoomcancel", e1)); 50696 } 50697 blur() { 50698 this.reset(); 50699 } 50700 reset() { 50701 this._active = !1, this._container.classList.remove("mapboxgl-crosshair"), this._box && (this._box.remove(), this._box = null), p(), delete this._startPos, delete this._lastPos; 50702 } 50703 _fireEvent(t1, i) { 50704 return this._map.fire(new e1.h(t1, { 50705 originalEvent: i 50706 })); 50707 } 50708 constructor(e1, t1){ 50709 this._map = e1, this._el = e1.getCanvasContainer(), this._container = e1.getContainer(), this._clickTolerance = t1.clickTolerance || 1; 50710 } 50711 } 50712 function il(e1, t1) { 50713 const i = {}; 50714 for(let s = 0; s < e1.length; s++)i[e1[s].identifier] = t1[s]; 50715 return i; 50716 } 50717 class sl { 50718 reset() { 50719 this.centroid = void 0, this.startTime = 0, this.touches = {}, this.aborted = !1; 50720 } 50721 touchstart(t1, i, s) { 50722 (this.centroid || s.length > this.numTouches) && (this.aborted = !0), this.aborted || (0 === this.startTime && (this.startTime = t1.timeStamp), s.length === this.numTouches && (this.centroid = function(t1) { 50723 const i = new e1.P(0, 0); 50724 for (const e1 of t1)i._add(e1); 50725 return i.div(t1.length); 50726 }(i), this.touches = il(s, i))); 50727 } 50728 touchmove(e1, t1, i) { 50729 if (this.aborted || !this.centroid) return; 50730 const s = il(i, t1); 50731 for(const e1 in this.touches){ 50732 const t1 = s[e1]; 50733 (!t1 || t1.dist(this.touches[e1]) > 30) && (this.aborted = !0); 50734 } 50735 } 50736 touchend(e1, t1, i) { 50737 if ((!this.centroid || e1.timeStamp - this.startTime > 500) && (this.aborted = !0), 0 === i.length) { 50738 const e1 = !this.aborted && this.centroid; 50739 if (this.reset(), e1) return e1; 50740 } 50741 } 50742 constructor(e1){ 50743 this.reset(), this.numTouches = e1.numTouches; 50744 } 50745 } 50746 class rl { 50747 reset() { 50748 this.lastTime = 1 / 0, this.lastTap = void 0, this.count = 0, this.singleTap.reset(); 50749 } 50750 touchstart(e1, t1, i) { 50751 this.singleTap.touchstart(e1, t1, i); 50752 } 50753 touchmove(e1, t1, i) { 50754 this.singleTap.touchmove(e1, t1, i); 50755 } 50756 touchend(e1, t1, i) { 50757 const s = this.singleTap.touchend(e1, t1, i); 50758 if (s) { 50759 const t1 = e1.timeStamp - this.lastTime < 500, i = !this.lastTap || this.lastTap.dist(s) < 30; 50760 if (t1 && i || this.reset(), this.count++, this.lastTime = e1.timeStamp, this.lastTap = s, this.count === this.numTaps) return this.reset(), s; 50761 } 50762 } 50763 constructor(e1){
50764 this.singleTap = new sl(e1), this.numTaps = e1.numTaps, this.reset(); 50765 } 50766 } 50767 class ol { 50768 reset() { 50769 this._active = !1, this._zoomIn.reset(), this._zoomOut.reset(); 50770 } 50771 touchstart(e1, t1, i) { 50772 this._zoomIn.touchstart(e1, t1, i), this._zoomOut.touchstart(e1, t1, i); 50773 } 50774 touchmove(e1, t1, i) { 50775 this._zoomIn.touchmove(e1, t1, i), this._zoomOut.touchmove(e1, t1, i); 50776 } 50777 touchend(e1, t1, i) { 50778 const s = this._zoomIn.touchend(e1, t1, i), r = this._zoomOut.touchend(e1, t1, i); 50779 return s ? (this._active = !0, e1.preventDefault(), setTimeout(()=>this.reset(), 0), { 50780 cameraAnimation: (t1)=>t1.easeTo({ 50781 duration: 300, 50782 zoom: t1.getZoom() + 1, 50783 around: t1.unproject(s) 50784 }, { 50785 originalEvent: e1 50786 }) 50787 }) : r ? (this._active = !0, e1.preventDefault(), setTimeout(()=>this.reset(), 0), { 50788 cameraAnimation: (t1)=>t1.easeTo({ 50789 duration: 300, 50790 zoom: t1.getZoom() - 1, 50791 around: t1.unproject(r) 50792 }, { 50793 originalEvent: e1 50794 }) 50795 }) : void 0; 50796 } 50797 touchcancel() { 50798 this.reset(); 50799 } 50800 enable() { 50801 this._enabled = !0; 50802 } 50803 disable() { 50804 this._enabled = !1, this.reset(); 50805 } 50806 isEnabled() { 50807 return this._enabled; 50808 } 50809 isActive() { 50810 return this._active; 50811 } 50812 constructor(){ 50813 this._zoomIn = new rl({ 50814 numTouches: 1, 50815 numTaps: 2 50816 }), this._zoomOut = new rl({ 50817 numTouches: 2, 50818 numTaps: 1 50819 }), this.reset(); 50820 } 50821 } 50822 const nl = 0, al = 2, ll = { 50823 [nl]: 1, 50824 [al]: 2 50825 }, cl = { 50826 Control: "ctrlKey", 50827 Alt: "altKey", 50828 Shift: "shiftKey", 50829 Meta: "metaKey" 50830 }; 50831 class hl { 50832 blur() { 50833 this.reset(); 50834 } 50835 reset() { 50836 this._active = !1, this._moved = !1, this._lastPoint = void 0, this._eventButton = void 0; 50837 } 50838 _correctButton(e1, t1) { 50839 return !1; 50840 } 50841 _move(e1, t1) { 50842 return {}; 50843 } 50844 mousedown(e1, t1) { 50845 if (this._lastPoint) return; 50846 const i = y(e1); 50847 this._correctButton(e1, i) && (this._lastPoint = t1, this._eventButton = i); 50848 } 50849 mousemoveWindow(e1, t1) { 50850 const i = this._lastPoint; 50851 if (i) { 50852 if (e1.preventDefault(), null != this._eventButton && function(e1, t1) { 50853 const i = ll[t1]; 50854 return void 0 === e1.buttons || (e1.buttons & i) !== i; 50855 }(e1, this._eventButton)) this.reset(); 50856 else if (this._moved || !(t1.dist(i) < this._clickTolerance)) return this._moved = !0, this._lastPoint = t1, this._move(i, t1); 50857 } 50858 } 50859 mouseupWindow(e1) { 50860 this._lastPoint && y(e1) === this._eventButton && (this._moved && m(), this.reset()); 50861 } 50862 enable() { 50863 this._enabled = !0; 50864 } 50865 disable() { 50866 this._enabled = !1, this.reset(); 50867 } 50868 isEnabled() { 50869 return this._enabled; 50870 } 50871 isActive() { 50872 return this._active; 50873 } 50874 constructor(e1){ 50875 this.reset(), this._clickTolerance = e1.clickTolerance || 1; 50876 } 50877 } 50878 class dl extends hl { 50879 mousedown(e1, t1) { 50880 super.mousedown(e1, t1), this._lastPoint && (this._active = !0); 50881 } 50882 _correctButton(e1, t1) { 50883 return 0 === t1 && !e1.ctrlKey; 50884 } 50885 _move(e1, t1) { 50886 return { 50887 around: t1, 50888 panDelta: t1.sub(e1) 50889 }; 50890 } 50891 } 50892 class ul extends hl { 50893 _correctButton(e1, t1) { 50894 return this._pitchRotateKey ? 0 === t1 && e1[this._pitchRotateKey] : 0 === t1 && e1.ctrlKey || 2 === t1; 50895 } 50896 _move(e1, t1) { 50897 const i = .8 * (t1.x - e1.x); 50898 if (i) return this._active = !0, { 50899 bearingDelta: i 50900 }; 50901 } 50902 contextmenu(e1) { 50903 this._pitchRotateKey || e1.preventDefault(); 50904 } 50905 constructor(e1){ 50906 super(e1), this._pitchRotateKey = e1.pitchRotateKey ? cl[e1.pitchRotateKey] : void 0; 50907 } 50908 } 50909 class pl extends hl { 50910 _correctButton(e1, t1) { 50911 return this._pitchRotateKey ? 0 === t1 && e1[this._pitchRotateKey] : 0 === t1 && e1.ctrlKey || 2 === t1; 50912 } 50913 _move(e1, t1) { 50914 const i = -.5 * (t1.y - e1.y); 50915 if (i) return this._active = !0, { 50916 pitchDelta: i 50917 }; 50918 } 50919 contextmenu(e1) { 50920 this._pitchRotateKey || e1.preventDefault(); 50921 } 50922 constructor(e1){ 50923 super(e1), this._pitchRotateKey = e1.pitchRotateKey ? cl[e1.pitchRotateKey] : void 0; 50924 } 50925 } 50926 class fl { 50927 reset() { 50928 this._active = !1, this._touches = {}, this._sum = new e1.P(0, 0); 50929 } 50930 touchstart(e1, t1, i) { 50931 return this._calculateTransform(e1, t1, i); 50932 }
vendor: 4,592 bytes, lines 50933-51021
50933 touchmove(t1, i, s) { 50934 if (this._active && !(s.length < this._minTouches)) { 50935 if (this._map._cooperativeGestures && !this._map.isMoving()) { 50936 if (1 === s.length && !e1.ex()) return void this._showTouchPanBlockerAlert(); 50937 "hidden" !== this._alertContainer.style.visibility && (this._alertContainer.style.visibility = "hidden", clearTimeout(this._alertTimer)); 50938 } 50939 return t1.cancelable && t1.preventDefault(), this._calculateTransform(t1, i, s); 50940 } 50941 } 50942 touchend(e1, t1, i) { 50943 this._calculateTransform(e1, t1, i), this._active && i.length < this._minTouches && this.reset(); 50944 } 50945 touchcancel() { 50946 this.reset(); 50947 } 50948 _calculateTransform(t1, i, s) { 50949 s.length > 0 && (this._active = !0); 50950 const r = il(s, i), o = new e1.P(0, 0), n = new e1.P(0, 0); 50951 let a = 0; 50952 for(const e1 in r){ 50953 const t1 = r[e1], i = this._touches[e1]; 50954 i && (o._add(t1), n._add(t1.sub(i)), a++, r[e1] = t1); 50955 } 50956 if (this._touches = r, a < this._minTouches || !n.mag()) return; 50957 const l = n.div(a); 50958 return this._sum._add(l), this._sum.mag() < this._clickTolerance ? void 0 : { 50959 around: o.div(a), 50960 panDelta: l 50961 }; 50962 } 50963 enable() { 50964 this._enabled = !0, this._map._cooperativeGestures && (this._addTouchPanBlocker(), this._el.classList.add("mapboxgl-touch-pan-blocker-override", "mapboxgl-scrollable-page")); 50965 } 50966 disable() { 50967 this._enabled = !1, this._map._cooperativeGestures && (clearTimeout(this._alertTimer), this._alertContainer.remove(), this._el.classList.remove("mapboxgl-touch-pan-blocker-override", "mapboxgl-scrollable-page")), this.reset(); 50968 } 50969 isEnabled() { 50970 return !!this._enabled; 50971 } 50972 isActive() { 50973 return !!this._active; 50974 } 50975 _addTouchPanBlocker() { 50976 this._map && !this._alertContainer && (this._alertContainer = a("div", "mapboxgl-touch-pan-blocker", this._map._container), this._alertContainer.textContent = this._map._getUIString("TouchPanBlocker.Message"), this._alertContainer.style.fontSize = "".concat(Math.max(10, Math.min(24, Math.floor(.05 * this._el.clientWidth))), "px")); 50977 } 50978 _showTouchPanBlockerAlert() { 50979 this._alertContainer.style.visibility = "visible", this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"), this._alertContainer.setAttribute("role", "alert"), clearTimeout(this._alertTimer), this._alertTimer = window.setTimeout(()=>{ 50980 this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"), this._alertContainer.removeAttribute("role"); 50981 }, 500); 50982 } 50983 constructor(t1, i){ 50984 this._map = t1, this._el = t1.getCanvasContainer(), this._minTouches = 1, this._clickTolerance = i.clickTolerance || 1, this.reset(), e1.aV([ 50985 "_addTouchPanBlocker", 50986 "_showTouchPanBlockerAlert" 50987 ], this); 50988 } 50989 } 50990 class ml { 50991 reset() { 50992 this._active = !1, this._firstTwoTouches = void 0; 50993 } 50994 _start(e1) {} 50995 _move(e1, t1, i) { 50996 return {}; 50997 } 50998 touchstart(e1, t1, i) { 50999 this._firstTwoTouches || i.length < 2 || (this._firstTwoTouches = [ 51000 i[0].identifier, 51001 i[1].identifier 51002 ], this._start([ 51003 t1[0], 51004 t1[1] 51005 ])); 51006 } 51007 touchmove(e1, t1, i) { 51008 const s = this._firstTwoTouches; 51009 if (!s) return; 51010 e1.preventDefault(); 51011 const [r, o] = s, n = _l(i, t1, r), a = _l(i, t1, o); 51012 if (!n || !a) return; 51013 const l = this._aroundCenter ? null : n.add(a).div(2); 51014 return this._move([ 51015 n, 51016 a 51017 ], l, e1); 51018 } 51019 touchend(e1, t1, i) { 51020 if (!this._firstTwoTouches) return; 51021 const [s, r] = this._firstTwoTouches, o = _l(i, t1, s), n = _l(i, t1, r);
51022 o && n || (this._active && m(), this.reset()); 51023 } 51024 touchcancel() { 51025 this.reset(); 51026 } 51027 enable(e1) { 51028 this._enabled = !0, this._aroundCenter = !!e1 && "center" === e1.around; 51029 } 51030 disable() { 51031 this._enabled = !1, this.reset(); 51032 } 51033 isEnabled() { 51034 return this._enabled; 51035 } 51036 isActive() { 51037 return this._active; 51038 } 51039 constructor(){ 51040 this.reset(); 51041 } 51042 } 51043 function _l(e1, t1, i) { 51044 for(let s = 0; s < e1.length; s++)if (e1[s].identifier === i) return t1[s]; 51045 } 51046 function gl(e1, t1) { 51047 return Math.log2(e1 / t1); 51048 } 51049 class yl extends ml { 51050 reset() { 51051 super.reset(), this._distance = 0, this._startDistance = 0; 51052 } 51053 _start(e1) { 51054 this._startDistance = this._distance = e1[0].dist(e1[1]); 51055 } 51056 _move(e1, t1) { 51057 const i = this._distance; 51058 if (this._distance = e1[0].dist(e1[1]), this._active || !(Math.abs(gl(this._distance, this._startDistance)) < .1)) return this._active = !0, { 51059 zoomDelta: gl(this._distance, i), 51060 pinchAround: t1 51061 }; 51062 } 51063 } 51064 function vl(e1, t1) { 51065 return 180 * e1.angleWith(t1) / Math.PI; 51066 } 51067 class bl extends ml { 51068 reset() { 51069 super.reset(), this._minDiameter = 0, this._startVector = void 0, this._vector = void 0; 51070 } 51071 _start(e1) { 51072 this._startVector = this._vector = e1[0].sub(e1[1]), this._minDiameter = e1[0].dist(e1[1]); 51073 } 51074 _move(e1, t1) { 51075 const i = this._vector; 51076 if (this._vector = e1[0].sub(e1[1]), i && (this._active || !this._isBelowThreshold(this._vector))) return this._active = !0, { 51077 bearingDelta: vl(this._vector, i), 51078 pinchAround: t1 51079 }; 51080 } 51081 _isBelowThreshold(e1) { 51082 this._minDiameter = Math.min(this._minDiameter, e1.mag()); 51083 const t1 = 25 / (Math.PI * this._minDiameter) * 360, i = this._startVector; 51084 if (!i) return !1; 51085 const s = vl(e1, i); 51086 return Math.abs(s) < t1; 51087 } 51088 } 51089 function xl(e1) { 51090 return Math.abs(e1.y) > Math.abs(e1.x); 51091 } 51092 class wl extends ml { 51093 reset() { 51094 super.reset(), this._valid = void 0, this._firstMove = void 0, this._lastPoints = void 0; 51095 } 51096 _start(e1) { 51097 this._lastPoints = e1, xl(e1[0].sub(e1[1])) && (this._valid = !1); 51098 } 51099 _move(t1, i, s) { 51100 const r = this._lastPoints; 51101 if (!r) return; 51102 const o = t1[0].sub(r[0]), n = t1[1].sub(r[1]); 51103 return this._map._cooperativeGestures && !e1.ex() && s.touches.length < 3 || (this._valid = this.gestureBeginsVertically(o, n, s.timeStamp), !this._valid) ? void 0 : (this._lastPoints = t1, this._active = !0, { 51104 pitchDelta: (o.y + n.y) / 2 * -.5 51105 }); 51106 } 51107 gestureBeginsVertically(e1, t1, i) { 51108 var _this__firstMove; 51109 if (void 0 !== this._valid) return this._valid; 51110 const s = e1.mag() >= 2, r = t1.mag() >= 2; 51111 if (!s && !r) return; 51112 if (!s || !r) return (_this__firstMove = this._firstMove) !== null && _this__firstMove !== void 0 ? _this__firstMove : this._firstMove = i, i - this._firstMove < 100 && void 0; 51113 const o = e1.y > 0 == t1.y > 0; 51114 return xl(e1) && xl(t1) && o; 51115 } 51116 constructor(e1){ 51117 super(), this._map = e1; 51118 } 51119 } 51120 const Tl = { 51121 panStep: 100, 51122 bearingStep: 15, 51123 pitchStep: 10 51124 }; 51125 class Sl { 51126 blur() { 51127 this.reset(); 51128 } 51129 reset() { 51130 this._active = !1; 51131 } 51132 keydown(e1) { 51133 if (e1.altKey || e1.ctrlKey || e1.metaKey) return; 51134 if (!this.isEnabled()) return; 51135 let t1 = 0, i = 0, s = 0, r = 0, o = 0; 51136 switch(e1.keyCode){ 51137 case 61: 51138 case 107: 51139 case 171: 51140 case 187: 51141 t1 = 1; 51142 break; 51143 case 189: 51144 case 109: 51145 case 173: 51146 t1 = -1; 51147 break; 51148 case 37:
vendor: 12,093 bytes, lines 51149-51386
51149 e1.shiftKey ? i = -1 : (e1.preventDefault(), r = -1); 51150 break; 51151 case 39: 51152 e1.shiftKey ? i = 1 : (e1.preventDefault(), r = 1); 51153 break; 51154 case 38: 51155 e1.shiftKey ? s = 1 : (e1.preventDefault(), o = -1); 51156 break; 51157 case 40: 51158 e1.shiftKey ? s = -1 : (e1.preventDefault(), o = 1); 51159 break; 51160 default: 51161 return; 51162 } 51163 return this._bearingDisabled && (i = 0), this._pitchDisabled && (s = 0), this._panDisabled && (r = 0, o = 0), this._zoomDisabled && (t1 = 0), { 51164 cameraAnimation: (n)=>{ 51165 const a = n.getZoom(); 51166 n.easeTo({ 51167 duration: 300, 51168 easeId: "keyboardHandler", 51169 easing: Cl, 51170 zoom: t1 ? Math.round(a) + t1 * (e1.shiftKey ? 2 : 1) : a, 51171 bearing: n.getBearing() + i * this._bearingStep, 51172 pitch: n.getPitch() + s * this._pitchStep, 51173 offset: [ 51174 -r * this._panStep, 51175 -o * this._panStep 51176 ], 51177 center: n.getCenter() 51178 }, { 51179 originalEvent: e1 51180 }); 51181 } 51182 }; 51183 } 51184 enable() { 51185 this._enabled = !0; 51186 } 51187 disable() { 51188 this._enabled = !1, this.reset(); 51189 } 51190 isEnabled() { 51191 return this._enabled && !(this._bearingDisabled && this._pitchDisabled && this._panDisabled && this._zoomDisabled); 51192 } 51193 isActive() { 51194 return this._active; 51195 } 51196 disableRotation() { 51197 this._pitchDisabled = !0, this._bearingDisabled = !0; 51198 } 51199 enableRotation() { 51200 this._pitchDisabled = !1, this._bearingDisabled = !1; 51201 } 51202 isRotationEnabled() { 51203 return !this._pitchDisabled && !this._bearingDisabled; 51204 } 51205 disablePan() { 51206 this._panDisabled = !0; 51207 } 51208 enablePan() { 51209 this._panDisabled = !1; 51210 } 51211 isPanEnabled() { 51212 return !this._panDisabled; 51213 } 51214 disableZoom() { 51215 this._zoomDisabled = !0; 51216 } 51217 enableZoom() { 51218 this._zoomDisabled = !1; 51219 } 51220 isZoomEnabled() { 51221 return !this._zoomDisabled; 51222 } 51223 disablePitch() { 51224 this._pitchDisabled = !0; 51225 } 51226 enablePitch() { 51227 this._pitchDisabled = !1; 51228 } 51229 isPitchEnabled() { 51230 return !this._pitchDisabled; 51231 } 51232 disableBearing() { 51233 this._bearingDisabled = !0; 51234 } 51235 enableBearing() { 51236 this._bearingDisabled = !1; 51237 } 51238 isBearingEnabled() { 51239 return !this._bearingDisabled; 51240 } 51241 constructor(){ 51242 const e1 = Tl; 51243 this._panStep = e1.panStep, this._bearingStep = e1.bearingStep, this._pitchStep = e1.pitchStep, this._bearingDisabled = !1, this._pitchDisabled = !1, this._panDisabled = !1, this._zoomDisabled = !1; 51244 } 51245 } 51246 function Cl(e1) { 51247 return e1 * (2 - e1); 51248 } 51249 const El = 4.000244140625, Il = 1 / 450, Dl = /(Mac|iPad)/i; 51250 class Pl { 51251 setZoomRate(e1) { 51252 this._defaultZoomRate = e1; 51253 } 51254 setWheelZoomRate(e1) { 51255 this._wheelZoomRate = e1; 51256 } 51257 isEnabled() { 51258 return !!this._enabled; 51259 } 51260 isActive() { 51261 return this._active || void 0 !== this._finishTimeout; 51262 } 51263 isZooming() { 51264 return !!this._zooming; 51265 } 51266 enable(e1) { 51267 this.isEnabled() || (this._enabled = !0, this._aroundCenter = !!e1 && "center" === e1.around, this._map._cooperativeGestures && this._addScrollZoomBlocker()); 51268 } 51269 disable() { 51270 this.isEnabled() && (this._enabled = !1, this._map._cooperativeGestures && (clearTimeout(this._alertTimer), this._alertContainer.remove())); 51271 } 51272 wheel(t1) { 51273 if (!this.isEnabled()) return; 51274 if (this._map._cooperativeGestures) { 51275 if (!(t1.ctrlKey || t1.metaKey || this.isZooming() || e1.ex())) return void this._showBlockerAlert(); 51276 "hidden" !== this._alertContainer.style.visibility && (this._alertContainer.style.visibility = "hidden", clearTimeout(this._alertTimer)); 51277 } 51278 let i = t1.deltaMode === WheelEvent.DOM_DELTA_LINE ? 40 * t1.deltaY : t1.deltaY; 51279 const s = e1.e.now(), r = s - (this._lastWheelEventTime || 0); 51280 this._lastWheelEventTime = s, 0 !== i && i % El === 0 ? this._type = "wheel" : 0 !== i && Math.abs(i) < 4 ? this._type = "trackpad" : r > 400 ? (this._type = null, this._lastValue = i, this._timeout = window.setTimeout(this._onTimeout, 40, t1)) : this._type || (this._type = Math.abs(r * i) < 200 ? "trackpad" : "wheel", this._timeout && (clearTimeout(this._timeout), this._timeout = null, i += this._lastValue)), t1.shiftKey && i && (i /= 4), this._type && (this._lastWheelEvent = t1, this._delta -= i, this._active || this._start(t1)), t1.preventDefault(); 51281 } 51282 _onTimeout(e1) { 51283 this._type = "wheel", this._delta -= this._lastValue, this._active || this._start(e1); 51284 } 51285 _start(e1) { 51286 if (!this._delta) return; 51287 this._frameId && (this._frameId = null), this._active = !0, this.isZooming() || (this._zooming = !0), this._finishTimeout && (clearTimeout(this._finishTimeout), delete this._finishTimeout); 51288 const t1 = _(this._el, e1); 51289 this._aroundPoint = this._aroundCenter ? this._map.transform.centerPoint : t1, this._aroundCoord = this._map.transform.pointCoordinate3D(this._aroundPoint), this._targetZoom = void 0, this._frameId || (this._frameId = !0, this._handler._triggerRenderFrame()); 51290 } 51291 renderFrame() { 51292 if (!this._frameId) return; 51293 if (this._frameId = null, !this.isActive()) return; 51294 const t1 = this._map.transform; 51295 "wheel" === this._type && t1.projection.wrap && (t1._center.lng >= 180 || t1._center.lng <= -180) && (this._prevEase = null, this._easing = null, this._lastWheelEvent = null, this._lastWheelEventTime = 0); 51296 const i = ()=>t1._terrainEnabled() && this._aroundCoord ? t1.computeZoomRelativeTo(this._aroundCoord) : t1.zoom; 51297 if (0 !== this._delta) { 51298 const e1 = "wheel" === this._type && Math.abs(this._delta) > El ? this._wheelZoomRate : this._defaultZoomRate; 51299 let s = 2 / (1 + Math.exp(-Math.abs(this._delta * e1))); 51300 this._delta < 0 && 0 !== s && (s = 1 / s); 51301 const r = i(), o = Math.pow(2, r), n = "number" == typeof this._targetZoom ? t1.zoomScale(this._targetZoom) : o; 51302 this._targetZoom = Math.min(t1.maxZoom, Math.max(t1.minZoom, t1.scaleZoom(n * s))), "wheel" === this._type && (this._startZoom = r, this._easing = this._smoothOutEasing(200)), this._lastDelta = this._delta, this._delta = 0; 51303 } 51304 const s = "number" == typeof this._targetZoom ? this._targetZoom : i(), r = this._startZoom, o = this._easing; 51305 let n, a = !1; 51306 if ("wheel" === this._type && r && o) { 51307 const t1 = Math.min((e1.e.now() - this._lastWheelEventTime) / 200, 1), i = o(t1); 51308 n = e1.al(r, s, i), t1 < 1 ? this._frameId || (this._frameId = !0) : a = !0; 51309 } else n = s, a = !0; 51310 this._active = !0, a && (this._active = !1, this._finishTimeout = window.setTimeout(()=>{ 51311 this._zooming = !1, this._handler._triggerRenderFrame(), delete this._targetZoom, delete this._finishTimeout; 51312 }, 200)); 51313 let l = n - i(); 51314 return l * this._lastDelta < 0 && (l = 0), { 51315 noInertia: !0, 51316 needsRenderFrame: !a, 51317 zoomDelta: l, 51318 around: this._aroundPoint, 51319 aroundCoord: this._aroundCoord, 51320 originalEvent: this._lastWheelEvent 51321 }; 51322 } 51323 _smoothOutEasing(t1) { 51324 let i = e1.ey; 51325 if (this._prevEase) { 51326 const t1 = this._prevEase, s = (e1.e.now() - t1.start) / t1.duration, r = t1.easing(s + .01) - t1.easing(s), o = .27 / Math.sqrt(r * r + 1e-4) * .01, n = Math.sqrt(.0729 - o * o); 51327 i = e1.ew(o, n, .25, 1); 51328 } 51329 return this._prevEase = { 51330 start: e1.e.now(), 51331 duration: t1, 51332 easing: i 51333 }, i; 51334 } 51335 blur() { 51336 this.reset(); 51337 } 51338 reset() { 51339 this._active = !1; 51340 } 51341 _addScrollZoomBlocker() { 51342 this._map && !this._alertContainer && (this._alertContainer = a("div", "mapboxgl-scroll-zoom-blocker", this._map._container), this._alertContainer.textContent = Dl.test(navigator.userAgent) ? this._map._getUIString("ScrollZoomBlocker.CmdMessage") : this._map._getUIString("ScrollZoomBlocker.CtrlMessage"), this._alertContainer.style.fontSize = "".concat(Math.max(10, Math.min(24, Math.floor(.05 * this._el.clientWidth))), "px")); 51343 } 51344 _showBlockerAlert() { 51345 this._alertContainer.style.visibility = "visible", this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"), this._alertContainer.setAttribute("role", "alert"), clearTimeout(this._alertTimer), this._alertTimer = window.setTimeout(()=>{ 51346 this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"), this._alertContainer.removeAttribute("role"); 51347 }, 200); 51348 } 51349 constructor(t1, i){ 51350 this._map = t1, this._el = t1.getCanvasContainer(), this._handler = i, this._delta = 0, this._lastDelta = 0, this._defaultZoomRate = .01, this._wheelZoomRate = Il, e1.aV([ 51351 "_onTimeout", 51352 "_addScrollZoomBlocker", 51353 "_showBlockerAlert" 51354 ], this); 51355 } 51356 } 51357 class Ll { 51358 enable() { 51359 this._clickZoom.enable(), this._tapZoom.enable(); 51360 } 51361 disable() { 51362 this._clickZoom.disable(), this._tapZoom.disable(); 51363 } 51364 isEnabled() { 51365 return this._clickZoom.isEnabled() && this._tapZoom.isEnabled(); 51366 } 51367 isActive() { 51368 return this._clickZoom.isActive() || this._tapZoom.isActive(); 51369 } 51370 constructor(e1, t1){ 51371 this._clickZoom = e1, this._tapZoom = t1; 51372 } 51373 } 51374 class Rl { 51375 reset() { 51376 this._active = !1; 51377 } 51378 blur() { 51379 this.reset(); 51380 } 51381 dblclick(e1, t1) { 51382 return e1.preventDefault(), { 51383 cameraAnimation: (i)=>{ 51384 i.easeTo({ 51385 duration: 300, 51386 zoom: i.getZoom() + (e1.shiftKey ? -1 : 1),
51387 around: i.unproject(t1) 51388 }, { 51389 originalEvent: e1 51390 }); 51391 } 51392 }; 51393 } 51394 enable() { 51395 this._enabled = !0; 51396 } 51397 disable() { 51398 this._enabled = !1, this.reset(); 51399 } 51400 isEnabled() { 51401 return this._enabled; 51402 } 51403 isActive() { 51404 return this._active; 51405 } 51406 constructor(){ 51407 this.reset(); 51408 } 51409 } 51410 class Al { 51411 reset() { 51412 this._active = !1, this._swipePoint = void 0, this._swipeTouch = 0, this._tapTime = 0, this._tap.reset(); 51413 } 51414 touchstart(e1, t1, i) { 51415 this._swipePoint || (this._tapTime && e1.timeStamp - this._tapTime > 500 && this.reset(), this._tapTime ? i.length > 0 && (this._swipePoint = t1[0], this._swipeTouch = i[0].identifier) : this._tap.touchstart(e1, t1, i)); 51416 } 51417 touchmove(e1, t1, i) { 51418 if (this._tapTime) { 51419 if (this._swipePoint) { 51420 if (i[0].identifier !== this._swipeTouch) return; 51421 const s = t1[0], r = s.y - this._swipePoint.y; 51422 return this._swipePoint = s, e1.preventDefault(), this._active = !0, { 51423 zoomDelta: r / 128 51424 }; 51425 } 51426 } else this._tap.touchmove(e1, t1, i); 51427 } 51428 touchend(e1, t1, i) { 51429 this._tapTime ? this._swipePoint && 0 === i.length && this.reset() : this._tap.touchend(e1, t1, i) && (this._tapTime = e1.timeStamp); 51430 } 51431 touchcancel() { 51432 this.reset(); 51433 } 51434 enable() { 51435 this._enabled = !0; 51436 } 51437 disable() { 51438 this._enabled = !1, this.reset(); 51439 } 51440 isEnabled() { 51441 return this._enabled; 51442 } 51443 isActive() { 51444 return this._active; 51445 } 51446 constructor(){ 51447 this._tap = new rl({ 51448 numTouches: 1, 51449 numTaps: 1 51450 }), this.reset(); 51451 } 51452 } 51453 class Ml { 51454 enable(e1) { 51455 this._inertiaOptions = e1 || {}, this._mousePan.enable(), this._touchPan.enable(), this._el.classList.add("mapboxgl-touch-drag-pan"); 51456 } 51457 disable() { 51458 this._mousePan.disable(), this._touchPan.disable(), this._el.classList.remove("mapboxgl-touch-drag-pan"); 51459 } 51460 isEnabled() { 51461 return this._mousePan.isEnabled() && this._touchPan.isEnabled(); 51462 } 51463 isActive() { 51464 return this._mousePan.isActive() || this._touchPan.isActive(); 51465 } 51466 constructor(e1, t1, i){ 51467 this._el = e1, this._mousePan = t1, this._touchPan = i; 51468 } 51469 } 51470 class Ol { 51471 enable() { 51472 this._rotationDisabled || this._mouseRotate.enable(), this._pitchWithRotate && !this._pitchDisabled && this._mousePitch.enable(); 51473 } 51474 disable() { 51475 this._mouseRotate.disable(), this._mousePitch.disable(); 51476 } 51477 isEnabled() { 51478 return this._pitchWithRotate ? !this._rotationDisabled && this._mouseRotate.isEnabled() || !this._pitchDisabled && this._mousePitch.isEnabled() : !this._rotationDisabled && this._mouseRotate.isEnabled(); 51479 } 51480 isActive() { 51481 return this._mouseRotate.isActive() || this._mousePitch.isActive(); 51482 } 51483 disablePitch() { 51484 this._pitchDisabled = !0, this._mousePitch.disable(); 51485 } 51486 enablePitch() { 51487 this._pitchDisabled = !1, this._pitchWithRotate && this._mousePitch.enable(); 51488 } 51489 isPitchEnabled() { 51490 return !this._pitchDisabled && this._mousePitch.isEnabled(); 51491 } 51492 disableRotation() { 51493 this._rotationDisabled = !0, this._mouseRotate.disable(); 51494 } 51495 enableRotation() { 51496 this._rotationDisabled = !1, this._mouseRotate.enable(); 51497 } 51498 isRotationEnabled() { 51499 return !this._rotationDisabled && this._mouseRotate.isEnabled(); 51500 } 51501 constructor(e1, t1, i){ 51502 this._pitchWithRotate = e1.pitchWithRotate, this._mouseRotate = t1, this._mousePitch = i, this._pitchDisabled = !1, this._rotationDisabled = !1; 51503 } 51504 } 51505 class Fl { 51506 enable(e1) { 51507 this._touchZoom.enable(e1), this._rotationDisabled || this._touchRotate.enable(e1), this._tapDragZoomDisabled || this._tapDragZoom.enable(), this._el.classList.add("mapboxgl-touch-zoom-rotate"); 51508 } 51509 disable() { 51510 this._touchZoom.disable(), this._touchRotate.disable(), this._tapDragZoom.disable(), this._el.classList.remove("mapboxgl-touch-zoom-rotate"); 51511 } 51512 isEnabled() { 51513 return this._touchZoom.isEnabled() || !this._rotationDisabled && this._touchRotate.isEnabled() || !this._tapDragZoomDisabled && this._tapDragZoom.isEnabled(); 51514 } 51515 isActive() { 51516 return this._touchZoom.isActive() || this._touchRotate.isActive() || this._tapDragZoom.isActive(); 51517 } 51518 disableRotation() { 51519 this._rotationDisabled = !0, this._touchRotate.disable(); 51520 } 51521 enableRotation() { 51522 this._rotationDisabled = !1, this._touchZoom.isEnabled() && this._touchRotate.enable(); 51523 } 51524 isRotationEnabled() { 51525 return !this._rotationDisabled; 51526 } 51527 disableTapDragZoom() { 51528 this._tapDragZoomDisabled = !0, this._tapDragZoom.disable(); 51529 } 51530 enableTapDragZoom() { 51531 this._tapDragZoomDisabled = !1, this._touchZoom.isEnabled() && this._tapDragZoom.enable(); 51532 } 51533 isTapDragZoomEnabled() { 51534 return !this._tapDragZoomDisabled; 51535 } 51536 constructor(e1, t1, i, s){ 51537 this._el = e1, this._touchZoom = t1, this._touchRotate = i, this._tapDragZoom = s, this._rotationDisabled = !1, this._tapDragZoomDisabled = !1, this._enabled = !0; 51538 } 51539 }
vendor: 2,933 bytes, lines 51540-51613
51540 const kl = (e1)=>e1.zoom || e1.drag || e1.pitch || e1.rotate; 51541 class Bl extends e1.h { 51542 } 51543 class zl { 51544 setup(t1, i) { 51545 const s = e1.cw([], i, t1); 51546 this.radius = e1.em(s[2] < 0 ? e1.eA([], s, this.constants) : [ 51547 s[0], 51548 s[1], 51549 0 51550 ]); 51551 } 51552 projectRay(t1) { 51553 e1.eA(t1, t1, this.constants), e1.ca(t1, t1), e1.eB(t1, t1, this.constants); 51554 const i = e1.dQ([], t1, this.radius); 51555 if (i[2] > 0) { 51556 const t1 = e1.dQ([], [ 51557 0, 51558 0, 51559 1 51560 ], e1.dT(i, [ 51561 0, 51562 0, 51563 1 51564 ])), s = e1.dQ([], e1.ca([], [ 51565 i[0], 51566 i[1], 51567 0 51568 ]), this.radius), r = e1.dR([], i, e1.dQ([], e1.cw([], e1.dR([], s, t1), i), 2)); 51569 i[0] = r[0], i[1] = r[1]; 51570 } 51571 return i; 51572 } 51573 constructor(){ 51574 this.constants = [ 51575 1, 51576 1, 51577 .01 51578 ], this.radius = 0; 51579 } 51580 } 51581 function Ul(e1) { 51582 return e1.panDelta && e1.panDelta.mag() || e1.zoomDelta || e1.bearingDelta || e1.pitchDelta; 51583 } 51584 class Nl { 51585 destroy() { 51586 for (const [e1, t1, i] of this._listeners){ 51587 const s = e1 === document ? this.handleWindowEvent : this.handleEvent; 51588 e1.removeEventListener(t1, s, i); 51589 } 51590 } 51591 _addDefaultHandlers(e1) { 51592 const t1 = this._map, i = t1.getCanvasContainer(); 51593 this._add("mapEvent", new Ja(t1, e1)); 51594 const s = t1.boxZoom = new tl(t1, e1); 51595 this._add("boxZoom", s); 51596 const r = new ol, o = new Rl; 51597 t1.doubleClickZoom = new Ll(o, r), this._add("tapZoom", r), this._add("clickZoom", o); 51598 const n = new Al; 51599 this._add("tapDragZoom", n); 51600 const a = t1.touchPitch = new wl(t1); 51601 this._add("touchPitch", a); 51602 const l = new ul(e1), c = new pl(e1); 51603 t1.dragRotate = new Ol(e1, l, c), this._add("mouseRotate", l, [ 51604 "mousePitch" 51605 ]), this._add("mousePitch", c, [ 51606 "mouseRotate" 51607 ]); 51608 const h = new dl(e1), d = new fl(t1, e1); 51609 t1.dragPan = new Ml(i, h, d), this._add("mousePan", h), this._add("touchPan", d, [ 51610 "touchZoom", 51611 "touchRotate" 51612 ]); 51613 const u = new bl, p = new yl;
51614 t1.touchZoomRotate = new Fl(i, p, u, n), this._add("touchRotate", u, [ 51615 "touchPan", 51616 "touchZoom" 51617 ]), this._add("touchZoom", p, [ 51618 "touchPan", 51619 "touchRotate" 51620 ]), this._add("blockableMapEvent", new el(t1)); 51621 const f = t1.scrollZoom = new Pl(t1, this); 51622 this._add("scrollZoom", f, [ 51623 "mousePan" 51624 ]); 51625 const m = t1.keyboard = new Sl; 51626 this._add("keyboard", m); 51627 for (const i of [ 51628 "boxZoom", 51629 "doubleClickZoom", 51630 "tapDragZoom", 51631 "touchPitch", 51632 "dragRotate", 51633 "dragPan", 51634 "touchZoomRotate", 51635 "scrollZoom", 51636 "keyboard" 51637 ])e1.interactive && e1[i] && t1[i].enable(e1[i]); 51638 } 51639 _add(e1, t1, i) { 51640 this._handlers.push({ 51641 handlerName: e1, 51642 handler: t1, 51643 allowed: i 51644 }), this._handlersById[e1] = t1; 51645 } 51646 stop() { 51647 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "never"; 51648 if (!this._updatingCamera && !("always" === e1 || "ifPointerDown" === e1 && this._isPointerDown())) { 51649 for (const { handler: e1 } of this._handlers)e1.reset(); 51650 this._inertia.clear(), this._fireEvents({}, {}, !1), this._changes = [], this._originalZoom = void 0; 51651 } 51652 } 51653 isActive() { 51654 for (const { handler: e1 } of this._handlers)if (e1.isActive()) return !0; 51655 return !1; 51656 } 51657 isZooming() { 51658 return !!this._eventsInProgress.zoom || this._map.scrollZoom.isZooming(); 51659 } 51660 isRotating() { 51661 return !!this._eventsInProgress.rotate; 51662 } 51663 isMoving() { 51664 return !!kl(this._eventsInProgress) || this.isZooming(); 51665 } 51666 _isDragging() { 51667 return !!this._eventsInProgress.drag; 51668 } 51669 _blockedByActive(e1, t1, i) { 51670 for(const s in e1)if (!(s === i || t1 && t1.includes(s))) return !0; 51671 return !1; 51672 } 51673 handleWindowEvent(e1) { 51674 this.handleEvent(e1, "".concat(e1.type, "Window")); 51675 } 51676 _getMapTouches(e1) { 51677 const t1 = []; 51678 for (const i of e1)this._el.contains(i.target) && t1.push(i); 51679 return t1; 51680 } 51681 _updatePointerLiveness(e1) { 51682 switch(e1.type){ 51683 case "mousedown": 51684 this._mouseBeingPressed = !0; 51685 break; 51686 case "mousemove": 51687 0 === e1.buttons && (this._mouseBeingPressed = !1); 51688 break; 51689 case "mouseup": 51690 this._mouseBeingPressed = !1; 51691 break; 51692 case "touchstart": 51693 case "touchmove": 51694 case "touchend": 51695 case "touchcancel": 51696 this._activeTouchCount = e1.touches ? e1.touches.length : 0; 51697 break; 51698 case "blur": 51699 this._mouseBeingPressed = !1, this._activeTouchCount = 0; 51700 } 51701 } 51702 _isPointerDown() { 51703 return this._mouseBeingPressed || this._activeTouchCount > 0; 51704 } 51705 handleEvent(e1, t1) { 51706 this._updatePointerLiveness(e1), this._updatingCamera = !0; 51707 const i = "renderFrame" === e1.type, s = i ? void 0 : e1, r = { 51708 needsRenderFrame: !1 51709 }, o = {}, n = {}, a = e1.touches ? this._getMapTouches(e1.touches) : void 0, l = a ? g(this._el, a) : i ? void 0 : _(this._el, e1); 51710 for (const { handlerName: i, handler: c, allowed: h } of this._handlers){ 51711 if (!c.isEnabled()) continue; 51712 let d; 51713 this._blockedByActive(n, h, i) ? c.reset() : c[t1 || e1.type] && (d = c[t1 || e1.type](e1, l, a), this.mergeHandlerResult(r, o, d, i, s), d && d.needsRenderFrame && this._triggerRe
vendor: 7,726 bytes, lines 51713-51839
51713nderFrame()), (d || c.isActive()) && (n[i] = c); 51714 } 51715 const c = {}; 51716 for(const e1 in this._previousActiveHandlers)n[e1] || (c[e1] = s); 51717 this._previousActiveHandlers = n, (Object.keys(c).length || Ul(r)) && (this._changes.push([ 51718 r, 51719 o, 51720 c 51721 ]), this._triggerRenderFrame()), (Object.keys(n).length || Ul(r)) && this._map._stop({ 51722 keepGesture: "always" 51723 }), this._updatingCamera = !1; 51724 const { cameraAnimation: h } = r; 51725 h && (this._inertia.clear(), this._fireEvents({}, {}, !0), this._changes = [], h(this._map)); 51726 } 51727 mergeHandlerResult(e1, t1, i, s, r) { 51728 if (!i) return; 51729 Object.assign(e1, i); 51730 const o = { 51731 handlerName: s, 51732 originalEvent: i.originalEvent || r 51733 }; 51734 void 0 !== i.zoomDelta && (t1.zoom = o), void 0 !== i.panDelta && (t1.drag = o), void 0 !== i.pitchDelta && (t1.pitch = o), void 0 !== i.bearingDelta && (t1.rotate = o); 51735 } 51736 _applyChanges() { 51737 const t1 = {}, i = {}, s = {}; 51738 for (const [r, o, n] of this._changes)r.panDelta && (t1.panDelta = (t1.panDelta || new e1.P(0, 0))._add(r.panDelta)), r.zoomDelta && (t1.zoomDelta = (t1.zoomDelta || 0) + r.zoomDelta), r.bearingDelta && (t1.bearingDelta = (t1.bearingDelta || 0) + r.bearingDelta), r.pitchDelta && (t1.pitchDelta = (t1.pitchDelta || 0) + r.pitchDelta), void 0 !== r.around && (t1.around = r.around), void 0 !== r.aroundCoord && (t1.aroundCoord = r.aroundCoord), void 0 !== r.pinchAround && (t1.pinchAround = r.pinchAround), r.noInertia && (t1.noInertia = r.noInertia), Object.assign(i, o), Object.assign(s, n); 51739 this._updateMapTransform(t1, i, s), this._changes = []; 51740 } 51741 _updateMapTransform(t1, i, s) { 51742 const r = this._map, o = r.transform, n = (e1)=>[ 51743 e1.x, 51744 e1.y, 51745 e1.z 51746 ]; 51747 if ((()=>{ 51748 const e1 = this._eventsInProgress.drag; 51749 return e1 && !this._handlersById[e1.handlerName].isActive(); 51750 })() && !Ul(t1)) { 51751 const e1 = o.zoom; 51752 o.cameraElevationReference = "sea", null != this._originalZoom && o._orthographicProjectionAtLowPitch && "globe" !== o.projection.name && 0 === o.pitch ? (o.cameraElevationReference = "ground", o.zoom = this._originalZoom) : (o.recenterOnTerrain(), o.cameraElevationReference = "ground"), e1 !== o.zoom && this._map._update(!0); 51753 } 51754 if (o._isCameraConstrained && r._stop({ 51755 keepGesture: "always" 51756 }), !Ul(t1)) return void this._fireEvents(i, s, !0); 51757 let { panDelta: a, zoomDelta: l, bearingDelta: c, pitchDelta: h, around: d, aroundCoord: u, pinchAround: p } = t1; 51758 o._isCameraConstrained && (l > 0 && (l = 0), o._isCameraConstrained = !1), void 0 !== p && (d = p), (l || ((e1)=>i[e1] && !this._eventsInProgress[e1])("drag")) && d && (this._dragOrigin = n(o.pointCoordinate3D(d)), this._originalZoom = o.zoom, this._trackingEllipsoid.setup(o._camera.position, this._dragOrigin)), o.cameraElevationReference = "sea", r._stop({ 51759 keepGesture: "always" 51760 }), d = d || r.transform.centerPoint, c && (o.bearing += c), h && (o.pitch += h), o._updateCameraState(); 51761 const f = [ 51762 0, 51763 0, 51764 0 51765 ]; 51766 if (a) if ("mercator" === o.projection.name) { 51767 const e1 = this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(d).dir), t1 = this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(d.sub(a)).dir); 51768 f[0] = t1[0] - e1[0], f[1] = t1[1] - e1[1]; 51769 } else { 51770 const t1 = o.pointCoordinate(d); 51771 if ("globe" === o.projection.name) { 51772 a = a.rotate(-o.angle); 51773 const i = o._pixelsPerMercatorPixel / o.worldSize; 51774 f[0] = -a.x * e1.ez(e1.br(t1.y)) * i, f[1] = -a.y * e1.ez(o.center.lat) * i; 51775 } else { 51776 const e1 = o.pointCoordinate(d.sub(a)); 51777 t1 && e1 && (f[0] = e1.x - t1.x, f[1] = e1.y - t1.y); 51778 } 51779 } 51780 const m = o.zoom, _ = [ 51781 0, 51782 0, 51783 0 51784 ]; 51785 if (l) { 51786 const t1 = n(u || o.pointCoordinate3D(d)), i = { 51787 dir: e1.ca([], e1.cw([], t1, o._camera.position)) 51788 }; 51789 if (i.dir[2] < 0) { 51790 const s = o.zoomDeltaToMovement(t1, l); 51791 e1.dQ(_, i.dir, s); 51792 } 51793 } 51794 const g = e1.dR(f, f, _); 51795 o._translateCameraConstrained(g), l && Math.abs(o.zoom - m) > 1e-4 && o.recenterOnTerrain(), o.cameraElevationReference = "ground", this._map._update(), t1.noInertia || this._inertia.record(t1), this._fireEvents(i, s, !0); 51796 } 51797 _fireEvents(t1, i, s) { 51798 const r = kl(this._eventsInProgress), o = kl(t1), n = {}; 51799 for(const e1 in t1){ 51800 const { originalEvent: i } = t1[e1]; 51801 this._eventsInProgress[e1] || (n["".concat(e1, "start")] = i), this._eventsInProgress[e1] = t1[e1]; 51802 } 51803 !r && o && this._fireEvent("movestart", o.originalEvent); 51804 for(const e1 in n)this._fireEvent(e1, n[e1]); 51805 o && this._fireEvent("move", o.originalEvent); 51806 for(const e1 in t1){ 51807 const { originalEvent: i } = t1[e1]; 51808 this._fireEvent(e1, i); 51809 } 51810 const a = {}; 51811 let l; 51812 for(const e1 in this._eventsInProgress){ 51813 const { handlerName: t1, originalEvent: s } = this._eventsInProgress[e1]; 51814 this._handlersById[t1].isActive() || (delete this._eventsInProgress[e1], l = i[t1] || s, a["".concat(e1, "end")] = l); 51815 } 51816 for(const e1 in a)this._fireEvent(e1, a[e1]); 51817 const c = kl(this._eventsInProgress); 51818 if (s && (r || o) && !c) { 51819 this._updatingCamera = !0; 51820 const t1 = this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions), i = (e1)=>0 !== e1 && -this._bearingSnap < e1 && e1 < this._bearingSnap; 51821 t1 ? (i(t1.bearing || this._map.getBearing()) && (t1.bearing = 0), this._map.easeTo(t1, { 51822 originalEvent: l 51823 })) : (this._map.fire(new e1.h("moveend", { 51824 originalEvent: l 51825 })), i(this._map.getBearing()) && this._map.resetNorth()), this._updatingCamera = !1; 51826 } 51827 } 51828 _fireEvent(t1, i) { 51829 this._map.fire(new e1.h(t1, i ? { 51830 originalEvent: i 51831 } : {})); 51832 } 51833 _requestFrame() { 51834 return this._map.triggerRepaint(), this._map._renderTaskQueue.add((e1)=>{ 51835 this._frameId = void 0, this.handleEvent(new Bl("renderFrame", { 51836 timeStamp: e1 51837 })), this._applyChanges(); 51838 }); 51839 }
51840 _triggerRenderFrame() { 51841 void 0 === this._frameId && (this._frameId = this._requestFrame()); 51842 } 51843 constructor(t1, i){ 51844 this._map = t1, this._el = this._map.getCanvasContainer(), this._handlers = [], this._handlersById = {}, this._changes = [], this._inertia = new Ha(t1), this._bearingSnap = i.bearingSnap, this._previousActiveHandlers = {}, this._trackingEllipsoid = new zl, this._dragOrigin = null, this._mouseBeingPressed = !1, this._activeTouchCount = 0, this._eventsInProgress = {}, this._addDefaultHandlers(i), e1.aV([ 51845 "handleEvent", 51846 "handleWindowEvent" 51847 ], this); 51848 const s = this._el; 51849 this._listeners = [ 51850 [ 51851 s, 51852 "touchstart", 51853 { 51854 passive: !0 51855 } 51856 ], 51857 [ 51858 s, 51859 "touchmove", 51860 { 51861 passive: !1 51862 } 51863 ], 51864 [ 51865 s, 51866 "touchend", 51867 void 0 51868 ], 51869 [ 51870 s, 51871 "touchcancel", 51872 void 0 51873 ], 51874 [ 51875 s, 51876 "mousedown", 51877 void 0 51878 ], 51879 [ 51880 s, 51881 "mousemove", 51882 void 0 51883 ], 51884 [ 51885 s, 51886 "mouseup", 51887 void 0 51888 ], 51889 [ 51890 document, 51891 "mousemove", 51892 { 51893 capture: !0 51894 } 51895 ], 51896 [ 51897 document, 51898 "mouseup", 51899 void 0 51900 ], 51901 [ 51902 s, 51903 "mouseover", 51904 void 0 51905 ], 51906 [ 51907 s, 51908 "mouseout", 51909 void 0 51910 ], 51911 [ 51912 s, 51913 "dblclick", 51914 void 0 51915 ], 51916 [ 51917 s, 51918 "click", 51919 void 0 51920 ], 51921 [ 51922 s, 51923 "keydown", 51924 { 51925 capture: !1 51926 } 51927 ], 51928 [ 51929 s, 51930 "keyup", 51931 void 0 51932 ], 51933 [ 51934 s, 51935 "wheel", 51936 { 51937 passive: !1 51938 } 51939 ], 51940 [ 51941 s, 51942 "contextmenu", 51943 void 0 51944 ], 51945 [ 51946 window, 51947 "blur", 51948 void 0 51949 ] 51950 ]; 51951 for (const [e1, t1, i] of this._listeners){ 51952 const s = e1 === document ? this.handleWindowEvent : this.handleEvent; 51953 e1.addEventListener(t1, s, i); 51954 } 51955 } 51956 } 51957 const jl = "map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections."; 51958 class Vl extends e1.E { 51959 getCenter() { 51960 return new e1.c_(this.transform.center.lng, this.transform.center.lat); 51961 } 51962 setCenter(e1, t1) { 51963 return this.jumpTo({ 51964 center: e1 51965 }, t1); 51966 } 51967 panBy(t1, i, s) { 51968 return t1 = e1.P.convert(t1).mult(-1), this.panTo(this.transform.center, { 51969 offset: t1, 51970 ...i 51971 }, s); 51972 } 51973 panTo(e1, t1, i) { 51974 return this.easeTo({ 51975 center: e1, 51976 ...t1 51977 }, i); 51978 } 51979 getZoom() { 51980 return this.transform.zoom; 51981 } 51982 setZoom(e1, t1) { 51983 return this.jumpTo({ 51984 zoom: e1 51985 }, t1), this; 51986 } 51987 zoomTo(e1, t1, i) { 51988 return this.easeTo({ 51989 zoom: e1, 51990 ...t1 51991 }, i); 51992 } 51993 zoomIn(e1, t1) { 51994 return this.zoomTo(this.getZoom() + 1, e1, t1), this; 51995 } 51996 zoomOut(e1, t1) { 51997 return this.zoomTo(this.getZoom() - 1, e1, t1), this; 51998 } 51999 getBearing() { 52000 return this.transform.bearing; 52001 } 52002 setBearing(e1, t1) { 52003 return this.jumpTo({ 52004 bearing: e1 52005 }, t1), this; 52006 } 52007 getPadding() { 52008 return this.transform.padding; 52009 } 52010 setPadding(e1, t1) { 52011 return this.jumpTo({ 52012 padding: e1 52013 }, t1), this; 52014 } 52015 rotateTo(e1, t1, i) { 52016 return this.easeTo({ 52017 bearing: e1, 52018 ...t1 52019 }, i); 52020 } 52021 resetNorth(e1, t1) { 52022 return this.rotateTo(0, { 52023 duration: 1e3, 52024 ...e1 52025 }, t1), this; 52026 } 52027 resetNorthPitch(e1, t1) { 52028 return this.easeTo({ 52029 bearing: 0, 52030 pitch: 0, 52031 duration: 1e3, 52032 ...e1 52033 }, t1), this; 52034 } 52035 snapToNorth(e1, t1) { 52036 return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(e1, t1) : this; 52037 } 52038 getPitch() { 52039 return this.transform.pitch; 52040 } 52041 setPitch(e1, t1) { 52042 return this.jumpTo({ 52043 pitch: e1 52044 }, t1), this; 52045 } 52046 getVerticalFieldOfView() { 52047 return this.transform.fov; 52048 } 52049 setVerticalFieldOfView(e1, t1) { 52050 return this.jumpTo({ 52051 fov: e1 52052 }, t1); 52053 } 52054 getHorizontalFieldOfView() { 52055 return this.transform.horizontalFov; 52056 } 52057 cameraForBounds(t1, i) { 52058 t1 = e1.eC.convert(t1); 52059 const s = i && i.bearing || 0, r = i && i.pitch || 0, o = t1.getNorthWest(), n = t1.getSouthEast(); 52060 return this._cameraForBounds(this.transform, o, n, s, r, i); 52061 } 52062 _extendPadding(e1) { 52063 const t1 = { 52064 top: 0, 52065 right: 0, 52066 bottom: 0, 52067 left: 0 52068 }; 52069 return null == e1 ? { 52070 ...t1, 52071 ...this.transform.padding 52072 } : "number" == typeof e1 ? { 52073 top: e1,
vendor: 16,970 bytes, lines 52074-52358
52074 bottom: e1, 52075 right: e1, 52076 left: e1 52077 } : { 52078 ...t1, 52079 ...e1 52080 }; 52081 } 52082 _extendCameraOptions(e1) { 52083 return (e1 = { 52084 offset: [ 52085 0, 52086 0 52087 ], 52088 maxZoom: this.transform.maxZoom, 52089 ...e1 52090 }).padding = this._extendPadding(e1.padding), e1; 52091 } 52092 _minimumAABBFrustumDistance(e1, t1) { 52093 const i = t1.max[0] - t1.min[0], s = t1.max[1] - t1.min[1]; 52094 return i / s > e1.aspect ? i / (2 * Math.tan(.5 * e1.fovX) * e1.aspect) : s / (2 * Math.tan(.5 * e1.fovY) * e1.aspect); 52095 } 52096 _cameraForBoundsOnGlobe(t1, i, s, r, o, n) { 52097 const a = t1.clone(), l = this._extendCameraOptions(n); 52098 a.bearing = r, a.pitch = o; 52099 const c = e1.c_.convert(i), h = e1.c_.convert(s), d = .5 * (c.lat + h.lat), u = .5 * (c.lng + h.lng), p = e1.eD(d, u), f = e1.ca([], p), m = e1.ca([], e1.eE([], f, [ 52100 0, 52101 1, 52102 0 52103 ])), _ = e1.eE([], m, f), g = [ 52104 m[0], 52105 m[1], 52106 m[2], 52107 0, 52108 _[0], 52109 _[1], 52110 _[2], 52111 0, 52112 f[0], 52113 f[1], 52114 f[2], 52115 0, 52116 0, 52117 0, 52118 0, 52119 1 52120 ], y = [ 52121 p, 52122 e1.eD(c.lat, c.lng), 52123 e1.eD(h.lat, c.lng), 52124 e1.eD(h.lat, h.lng), 52125 e1.eD(c.lat, h.lng), 52126 e1.eD(d, c.lng), 52127 e1.eD(d, h.lng), 52128 e1.eD(c.lat, u), 52129 e1.eD(h.lat, u) 52130 ]; 52131 let v = e1.eF.fromPoints(y.map((t1)=>[ 52132 e1.dT(m, t1), 52133 e1.dT(_, t1), 52134 e1.dT(f, t1) 52135 ])); 52136 const b = e1.bH([], v.center, g); 52137 0 === e1.eG(b) && e1.eH(b, 0, 0, 1), e1.ca(b, b), e1.dQ(b, b, e1.cz), a.center = e1.eI(b); 52138 const x = a.getWorldToCameraMatrix(), w = e1.aO(new Float64Array(16), x); 52139 v = e1.eF.applyTransform(v, e1.X([], x, g)); 52140 const T = this._extendAABB(v, a, l, r); 52141 if (!T) return void e1.w("Map cannot fit within canvas with the given bounds, padding, and/or offset."); 52142 v = T, e1.bH(b, b, x); 52143 const S = .5 * (v.max[2] - v.min[2]), C = this._minimumAABBFrustumDistance(a, v), E = e1.dQ([], [ 52144 0, 52145 0, 52146 1 52147 ], S), I = e1.dR(E, b, E), D = C + (0 === a.pitch ? 0 : e1.eJ(b, I)), P = a.globeCenterInViewSpace, L = e1.cw([], b, [ 52148 P[0], 52149 P[1], 52150 P[2] 52151 ]); 52152 e1.ca(L, L), e1.dQ(L, L, D); 52153 const R = e1.dR([], b, L); 52154 e1.bH(R, R, w); 52155 const A = e1.bj / e1.cz, M = e1.em(R), O = e1.c5(Math.max(M * A - e1.bj, Number.EPSILON), 0), F = Math.min(a.zoomFromMercatorZAdjusted(O), l.maxZoom); 52156 return F > .5 * (e1.e9 + e1.b1) ? (a.setProjection({ 52157 name: "mercator" 52158 }), a.zoom = F, this._cameraForBounds(a, i, s, r, o, n)) : { 52159 center: a.center, 52160 zoom: F, 52161 bearing: r, 52162 pitch: o 52163 }; 52164 } 52165 _extendAABB(t1, i, s, r) { 52166 const o = .5 * ((s.padding.left || 0) + (s.padding.right || 0)), n = .5 * ((s.padding.top || 0) + (s.padding.bottom || 0)), a = n, l = o, c = o, h = n, d = i.width - (l + c), u = i.height - (a + h), p = e1.cw([], t1.max, t1.min), f = Math.min(d / p[0], u / p[1]), m = Math.min(i.scaleZoom(i.scale * f), s.maxZoom); 52167 if (isNaN(m)) return null; 52168 const _ = i.scale / i.zoomScale(m), g = new e1.eF([ 52169 t1.min[0] - l * _, 52170 t1.min[1] - h * _, 52171 t1.min[2] 52172 ], [ 52173 t1.max[0] + c * _, 52174 t1.max[1] + a * _, 52175 t1.max[2] 52176 ]), y = ("number" == typeof s.offset.x && "number" == typeof s.offset.y ? new e1.P(s.offset.x, s.offset.y) : e1.P.convert(s.offset)).rotate(-e1.au(r)); 52177 return g.center[0] -= y.x * _, g.center[1] += y.y * _, g; 52178 } 52179 queryTerrainElevation(t1, i) { 52180 const s = this.transform.elevation; 52181 return s ? (i = { 52182 exaggerated: !0, 52183 ...i 52184 }, s.getAtPoint(e1.bS.fromLngLat(t1), null, i.exaggerated)) : null; 52185 } 52186 _cameraForBounds(t1, i, s, r, o, n) { 52187 if ("globe" === t1.projection.name) return this._cameraForBoundsOnGlobe(t1, i, s, r, o, n); 52188 const a = t1.clone(), l = this._extendCameraOptions(n); 52189 a.bearing = r, a.pitch = o; 52190 const c = e1.c_.convert(i), h = e1.c_.convert(s), d = new e1.c_(c.lng, h.lat), u = new e1.c_(h.lng, c.lat), p = a.project(c), f = a.project(h), m = this.queryTerrainElevation(c), _ = this.queryTerrainElevation(h), g = this.queryTerrainElevation(d), y = this.queryTerrainElevation(u), v = [ 52191 [ 52192 p.x, 52193 p.y, 52194 Math.min(m || 0, _ || 0, g || 0, y || 0) 52195 ], 52196 [ 52197 f.x, 52198 f.y, 52199 Math.max(m || 0, _ || 0, g || 0, y || 0) 52200 ] 52201 ]; 52202 let b = e1.eF.fromPoints(v); 52203 const x = a.getWorldToCameraMatrix(), w = e1.aO(new Float64Array(16), x); 52204 b = e1.eF.applyTransform(b, x); 52205 const T = this._extendAABB(b, a, l, r); 52206 if (!T) return void e1.w("Map cannot fit within canvas with the given bounds, padding, and/or offset."); 52207 b = T; 52208 const S = .5 * e1.cw([], b.max, b.min)[2], C = this._minimumAABBFrustumDistance(a, b), E = [ 52209 0, 52210 0, 52211 1, 52212 0 52213 ]; 52214 e1.c7(E, E, x), e1.eK(E, E); 52215 const I = e1.dQ([], E, C + S), D = e1.dR([], b.center, I); 52216 e1.bH(b.center, b.center, w), e1.bH(D, D, w); 52217 const P = a.unproject(new e1.P(b.center[0], b.center[1])), L = e1.eL(a.projection, P), R = Math.pow(2, L), A = Math.min(a._zoomFromMercatorZ(D[2] * a.pixelsPerMeter * R / a.worldSize), l.maxZoom); 52218 return a.mercatorFromTransition && A < .5 * (e1.e9 + e1.b1) ? (a.setProjection({ 52219 name: "globe" 52220 }), a.zoom = A, this._cameraForBounds(a, i, s, r, o, n)) : { 52221 center: P, 52222 zoom: A, 52223 bearing: r, 52224 pitch: o 52225 }; 52226 } 52227 fitBounds(e1, t1, i) { 52228 const s = this.cameraForBounds(e1, t1); 52229 return this._fitInternal(s, t1, i); 52230 } 52231 fitScreenCoordinates(t1, i, s, r, o) { 52232 const n = e1.P.convert(t1), a = e1.P.convert(i), l = new e1.P(Math.min(n.x, a.x), Math.min(n.y, a.y)), c = new e1.P(Math.max(n.x, a.x), Math.max(n.y, a.y)); 52233 if ("mercator" === this.transform.projection.name && this.transform.anyCornerOffEdge(n, a)) return this; 52234 const h = this.transform.pointLocation3D(l), d = this.transform.pointLocation3D(c), u = this.transform.pointLocation3D(new e1.P(l.x, c.y)), p = this.transform.pointLocation3D(new e1.P(c.x, l.y)), f = [ 52235 Math.min(h.lng, d.lng, u.lng, p.lng), 52236 Math.min(h.lat, d.lat, u.lat, p.lat) 52237 ], m = [ 52238 Math.max(h.lng, d.lng, u.lng, p.lng), 52239 Math.max(h.lat, d.lat, u.lat, p.lat) 52240 ], _ = r && r.pitch ? r.pitch : this.getPitch(), g = this._cameraForBounds(this.transform, f, m, s, _, r); 52241 return this._fitInternal(g, r, o); 52242 } 52243 _fitInternal(e1, t1, i) { 52244 return e1 ? (t1 = Object.assign(e1, t1)).linear ? this.easeTo(t1, i) : this.flyTo(t1, i) : this; 52245 } 52246 jumpTo(t1, i) { 52247 this._stop({ 52248 keepGesture: "ifPointerDown" 52249 }); 52250 const s = t1.preloadOnly ? this.transform.clone() : this.transform; 52251 let r = !1, o = !1, n = !1; 52252 "zoom" in t1 && s.zoom !== +t1.zoom && (r = !0, s.zoom = +t1.zoom), void 0 !== t1.center && (s.center = e1.c_.convert(t1.center)), "bearing" in t1 && s.bearing !== +t1.bearing && (o = !0, s.bearing = +t1.bearing), "pitch" in t1 && s.pitch !== +t1.pitch && (n = !0, s.pitch = +t1.pitch), "fov" in t1 && (s.fov = +t1.fov); 52253 const a = "number" == typeof t1.padding ? this._extendPadding(t1.padding) : t1.padding; 52254 if (null != t1.padding && !s.isPaddingEqual(a)) if (!1 === t1.retainPadding) { 52255 const e1 = s.clone(); 52256 e1.padding = a, s.setLocationAtPoint(s.center, e1.centerPoint); 52257 } else s.padding = a; 52258 return t1.preloadOnly ? (this._preloadTiles(s), this) : (this.fire(new e1.h("movestart", i)).fire(new e1.h("move", i)), r && this.fire(new e1.h("zoomstart", i)).fire(new e1.h("zoom", i)).fire(new e1.h("zoomend", i)), o && this.fire(new e1.h("rotatestart", i)).fire(new e1.h("rotate", i)).fire(new e1.h("rotateend", i)), n && this.fire(new e1.h("pitchstart", i)).fire(new e1.h("pitch", i)).fire(new e1.h("pitchend", i)), this.fire(new e1.h("moveend", i))); 52259 } 52260 getFreeCameraOptions() { 52261 return this.transform.projection.supportsFreeCamera || e1.w(jl), this.transform.getFreeCameraOptions(); 52262 } 52263 setFreeCameraOptions(t1, i) { 52264 const s = this.transform; 52265 if (!s.projection.supportsFreeCamera) return e1.w(jl), this; 52266 this.stop(); 52267 const r = s.zoom, o = s.pitch, n = s.bearing; 52268 s.setFreeCameraOptions(t1); 52269 const a = r !== s.zoom, l = o !== s.pitch, c = n !== s.bearing; 52270 return this.fire(new e1.h("movestart", i)).fire(new e1.h("move", i)), a && this.fire(new e1.h("zoomstart", i)).fire(new e1.h("zoom", i)).fire(new e1.h("zoomend", i)), c && this.fire(new e1.h("rotatestart", i)).fire(new e1.h("rotate", i)).fire(new e1.h("rotateend", i)), l && this.fire(new e1.h("pitchstart", i)).fire(new e1.h("pitch", i)).fire(new e1.h("pitchend", i)), this.fire(new e1.h("moveend", i)), this; 52271 } 52272 easeTo(t1, i) { 52273 this._stop({ 52274 easeId: t1.easeId 52275 }), (!1 === (t1 = { 52276 offset: [ 52277 0, 52278 0 52279 ], 52280 duration: 500, 52281 easing: e1.ey, 52282 ...t1 52283 }).animate || this._prefersReducedMotion(t1)) && (t1.duration = 0); 52284 const s = this.transform, r = this.getZoom(), o = this.getBearing(), n = this.getPitch(), a = this.getPadding(), l = this.getVerticalFieldOfView(), c = "zoom" in t1 ? +t1.zoom : r, h = "bearing" in t1 ? this._normalizeBearing(t1.bearing, o) : o, d = "pitch" in t1 ? +t1.pitch : n, u = "fov" in t1 ? +t1.fov : l, p = this._extendPadding(t1.padding), f = e1.P.convert(t1.offset); 52285 let m, _, g; 52286 if ("globe" === s.projection.name) { 52287 const i = e1.bS.fromLngLat(s.center), r = f.rotate(-s.angle); 52288 i.x += r.x / s.worldSize, i.y += r.y / s.worldSize; 52289 const o = i.toLngLat(), n = e1.c_.convert(t1.center || o); 52290 this._normalizeCenter(n), m = s.centerPoint.add(r), _ = new e1.P(i.x, i.y).mult(s.worldSize), g = new e1.P(e1.a7(n.lng), e1.a8(n.lat)).mult(s.worldSize).sub(_); 52291 } else { 52292 m = s.centerPoint.add(f); 52293 const i = s.pointLocation(m), r = e1.c_.convert(t1.center || i); 52294 this._normalizeCenter(r), _ = s.project(i), g = s.project(r).sub(_); 52295 } 52296 const y = s.zoomScale(c - r); 52297 let v, b; 52298 t1.around && (v = e1.c_.convert(t1.around), b = s.locationPoint(v)); 52299 const x = this._zooming || c !== r, w = this._rotating || o !== h, T = this._pitching || d !== n, S = u !== l, C = !s.isPaddingEqual(p), E = !1 === t1.retainPadding ? s.clone() : s, I = (s)=>(I)=>{ 52300 if (x && (s.zoom = e1.al(r, c, I)), w && (s.bearing = e1.al(o, h, I)), T && (s.pitch = e1.al(n, d, I)), S && (s.fov = e1.al(l, u, I)), C && (E.interpolatePadding(a, p, I), m = E.centerPoint.add(f)), v) s.setLocationAtPoint(v, b); 52301 else { 52302 const e1 = s.zoomScale(s.zoom - r), t1 = c > r ? Math.min(2, y) : Math.max(.5, y), i = Math.pow(t1, 1 - I), o = s.unproject(_.add(g.mult(I * i)).mult(e1)); 52303 s.setLocationAtPoint(s.renderWorldCopies ? o.wrap() : o, m); 52304 } 52305 return t1.preloadOnly || this._fireMoveEvents(i), s; 52306 }; 52307 if (t1.preloadOnly) { 52308 const e1 = this._emulate(I, t1.duration, s); 52309 return this._preloadTiles(e1), this; 52310 } 52311 const D = { 52312 moving: this._moving, 52313 zooming: this._zooming, 52314 rotating: this._rotating, 52315 pitching: this._pitching 52316 }; 52317 return this._zooming = x, this._rotating = w, this._pitching = T, this._padding = C, this._easeId = t1.easeId, this._prepareEase(i, t1.noMoveStart, D), this._ease(I(s), (e1)=>{ 52318 "sea" === s.cameraElevationReference && s.recenterOnTerrain(), this._afterEase(i, e1); 52319 }, t1), this; 52320 } 52321 _prepareEase(t1, i) { 52322 let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 52323 this._moving = !0, this.transform.cameraElevationReference = "sea", this.transform._orthographicProjectionAtLowPitch && 0 === this.transform.pitch && "globe" !== this.transform.projection.name && (this.transform.cameraElevationReference = "ground"), i || s.moving || this.fire(new e1.h("movestart", t1)), this._zooming && !s.zooming && this.fire(new e1.h("zoomstart", t1)), this._rotating && !s.rotating && this.fire(new e1.h("rotatestart", t1)), this._pitching && !s.pitching && this.fire(new e1.h("pitchstart", t1)); 52324 } 52325 _fireMoveEvents(t1) { 52326 this.fire(new e1.h("move", t1)), this._zooming && this.fire(new e1.h("zoom", t1)), this._rotating && this.fire(new e1.h("rotate", t1)), this._pitching && this.fire(new e1.h("pitch", t1)); 52327 } 52328 _afterEase(t1, i) { 52329 if (this._easeId && i && this._easeId === i) return; 52330 this._easeId = void 0, this.transform.cameraElevationReference = "ground"; 52331 const s = this._zooming, r = this._rotating, o = this._pitching; 52332 this._moving = !1, this._zooming = !1, this._rotating = !1, this._pitching = !1, this._padding = !1, s && this.fire(new e1.h("zoomend", t1)), r && this.fire(new e1.h("rotateend", t1)), o && this.fire(new e1.h("pitchend", t1)), this.fire(new e1.h("moveend", t1)); 52333 } 52334 flyTo(t1, i) { 52335 if (this._prefersReducedMotion(t1)) { 52336 const s = e1.cC(t1, [ 52337 "center", 52338 "zoom", 52339 "bearing", 52340 "pitch", 52341 "fov", 52342 "around", 52343 "padding", 52344 "retainPadding" 52345 ]); 52346 return this.jumpTo(s, i); 52347 } 52348 this.stop(), t1 = { 52349 offset: [ 52350 0, 52351 0 52352 ], 52353 speed: 1.2, 52354 curve: 1.42, 52355 easing: e1.ey, 52356 ...t1 52357 }; 52358 const s = this.transform, r = this.getZoom(), o = this.getBearing(), n = this.getPitch(), a = this.getPadding(), l = this.getVerticalFieldOfView(), c = "zoom" in t1 ? e1.b0(+t1.zoom, s.minZ
52358oom, s.maxZoom) : r, h = "bearing" in t1 ? this._normalizeBearing(t1.bearing, o) : o, d = "pitch" in t1 ? +t1.pitch : n, u = "fov" in t1 ? +t1.fov : l, p = u !== l, f = this._extendPadding(t1.padding), m = s.zoomScale(c - r), _ = e1.P.convert(t1.offset); 52359 let g = s.centerPoint.add(_); 52360 const y = s.pointLocation(g), v = e1.c_.convert(t1.center || y); 52361 this._normalizeCenter(v); 52362 const b = s.project(y), x = s.project(v).sub(b); 52363 let w = t1.curve; 52364 const T = Math.max(s.width, s.height), S = T / m, C = x.mag(); 52365 if ("minZoom" in t1) { 52366 const i = e1.b0(Math.min(t1.minZoom, r, c), s.minZoom, s.maxZoom), o = T / s.zoomScale(i - r); 52367 w = Math.sqrt(o / C * 2); 52368 } 52369 const E = w * w; 52370 function I(e1) { 52371 const t1 = (S * S - T * T + (e1 ? -1 : 1) * E * E * C * C) / (2 * (e1 ? S : T) * E * C); 52372 return Math.log(Math.sqrt(t1 * t1 + 1) - t1); 52373 } 52374 function D(e1) { 52375 return (Math.exp(e1) - Math.exp(-e1)) / 2; 52376 } 52377 function P(e1) { 52378 return (Math.exp(e1) + Math.exp(-e1)) / 2; 52379 } 52380 const L = I(0); 52381 let R = function(e1) { 52382 return P(L) / P(L + w * e1); 52383 }, A = function(e1) { 52384 return T * ((P(L) * (D(t1 = L + w * e1) / P(t1)) - D(L)) / E) / C; 52385 //TURBOPACK unreachable 52386 ; 52387 var t1; 52388 }, M = (I(1) - L) / w; 52389 if (Math.abs(C) < 1e-6 || !isFinite(M)) { 52390 if (Math.abs(T - S) < 1e-6) return this.easeTo(t1, i); 52391 const e1 = S < T ? -1 : 1; 52392 M = Math.abs(Math.log(S / T)) / w, A = function() { 52393 return 0; 52394 }, R = function(t1) { 52395 return Math.exp(e1 * w * t1); 52396 }; 52397 } 52398 t1.duration = "duration" in t1 ? +t1.duration : 1e3 * M / ("screenSpeed" in t1 ? +t1.screenSpeed / w : +t1.speed), t1.maxDuration && t1.duration > t1.maxDuration && (t1.duration = 0); 52399 const O = o !== h, F = d !== n, k = !s.isPaddingEqual(f), B = !1 === t1.retainPadding ? s.clone() : s, z = (s)=>(m)=>{ 52400 const y = m * M, w = 1 / R(y); 52401 s.zoom = 1 === m ? c : r + s.scaleZoom(w), O && (s.bearing = e1.al(o, h, m)), F && (s.pitch = e1.al(n, d, m)), p && (s.fov = e1.al(l, u, m)), k && (B.interpolatePadding(a, f, m), g = B.centerPoint.add(_)); 52402 const T = 1 === m ? v : s.unproject(b.add(x.mult(A(y))).mult(w)); 52403 return s.setLocationAtPoint(s.renderWorldCopies ? T.wrap() : T, g), s._updateCameraOnTerrain(), t1.preloadOnly || this._fireMoveEvents(i), s; 52404 }; 52405 if (t1.preloadOnly) { 52406 const e1 = this._emulate(z, t1.duration, s); 52407 return this._preloadTiles(e1), this; 52408 } 52409 return this._zooming = !0, this._rotating = O, this._pitching = F, this._padding = k, this._prepareEase(i, !1), this._ease(z(s), ()=>this._afterEase(i), t1), this; 52410 } 52411 isEasing() { 52412 return !!this._easeFrameId; 52413 } 52414 stop() { 52415 return this._stop(); 52416 } 52417 _requestRenderFrame(e1) {} 52418 _cancelRenderFrame(e1) {} 52419 _stop() { 52420 let { easeId: e1, keepGesture: t1 } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 52421 if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId), this._easeFrameId = void 0, this._onEaseFrame = void 0), this._onEaseEnd) { 52422 const t1 = this._onEaseEnd; 52423 this._onEaseEnd = void 0, t1.call(this, e1); 52424 } 52425 const i = this.handlers; 52426 return i && i.stop(t1), this; 52427 } 52428 _ease(t1, i, s) { 52429 !1 === s.animate || 0 === s.duration ? (t1(1), i()) : (this._easeStart = e1.e.now(), this._easeOptions = s, this._onEaseFrame = t1, this._onEaseEnd = i, this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback)); 52430 } 52431 _renderFrameCallback() { 52432 const t1 = Math.min((e1.e.now() - this._easeStart) / this._easeOptions.duration, 1), i = this._onEaseFrame; 52433 i && i(this._easeOptions.easing(t1)), t1 < 1 ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop(); 52434 } 52435 _normalizeBearing(t1, i) { 52436 t1 = e1.dj(t1, -180, 180); 52437 const s = Math.abs(t1 - i); 52438 return Math.abs(t1 - 360 - i) < s && (t1 -= 360), Math.abs(t1 + 360 - i) < s && (t1 += 360), t1; 52439 } 52440 _normalizeCenter(e1) { 52441 const t1 = this.transform; 52442 if (t1.maxBounds) return; 52443 if ("globe" !== t1.projection.name && !t1.renderWorldCopies) return; 52444 const i = e1.lng - t1.center.lng; 52445 e1.lng += i > 180 ? -360 : i < -180 ? 360 : 0; 52446 } 52447 _prefersReducedMotion(t1) { 52448 return this._respectPrefersReducedMotion && e1.e.prefersReducedMotion && !(t1 && t1.essential); 52449 } 52450 _emulate(e1, t1, i) { 52451 const s = Math.ceil(15 * t1 / 1e3), r = [], o = e1(i.clone()); 52452 for(let e1 = 0; e1 <= s; e1++){ 52453 const t1 = o(e1 / s); 52454 r.push(t1.clone()); 52455 } 52456 return r; 52457 } 52458 _preloadTiles(e1, t1) {} 52459 constructor(t1, i){ 52460 super(), this._moving = !1, this._zooming = !1, this.transform = t1, this._bearingSnap = i.bearingSnap, this._respectPrefersReducedMotion = !1 !== i.respectPrefersReducedMotion, e1.aV([ 52461 "_renderFrameCallback" 52462 ], this); 52463 } 52464 } 52465 const Gl = /^(https?:|mailto:)/i; 52466 class ql { 52467 getDefaultPosition() { 52468 return "bottom-right"; 52469 } 52470 onAdd(e1) { 52471 const t1 = this.options && this.options.compact, i = e1._getUIString("AttributionControl.ToggleAttribution"); 52472 this._map = e1, this._container = a("div", "mapboxgl-ctrl mapboxgl-ctrl-attrib"), this._compactButton = a("button", "mapboxgl-ctrl-attrib-button", this._container), this._compactButton.type = "button", this._compactButton.addEventListener("click", this._toggleAttribution), this._compactButton.setAttribute("aria-label", i); 52473 const s = a("span", "mapboxgl-ctrl-icon", this._compactButton); 52474 return s.setAttribute("aria-hidden", "true"), s.setAttribute("title", i), this._innerContainer = a("div", "mapboxgl-ctrl-attrib-inner", this._container), t1 && this._container.classList.add("mapboxgl-compact"), this._updateAttributions(), this._updateEditLink(), this._map.on("styledata", this._updateData), this._map.on("sourcedata", this._updateData), this._map.on("moveend", this._updateEditLink), void 0 === t1 && (this._map.on("resize", this._updateCompact), this._updateCompact()), this._container; 52475 } 52476 onRemove() { 52477 this._container.remove(), this._map.off("styledata", this._updateData), this._map.off("sourcedata", this._updateData), this._map.off("moveend", this._updateEditLink), this._map.off("resize", this._updateCompact), this._map = void 0, this._attribHTML
52477= void 0; 52478 } 52479 _toggleAttribution() { 52480 this._container.classList.contains("mapboxgl-compact-show") ? (this._container.classList.remove("mapboxgl-compact-show"), this._compactButton.setAttribute("aria-expanded", "false")) : (this._container.classList.add("mapboxgl-compact-show"), this._compactButton.setAttribute("aria-expanded", "true")); 52481 } 52482 _updateEditLink() { 52483 let t1 = this._editLink; 52484 t1 || (t1 = this._editLink = this._container.querySelector(".mapbox-improve-map")); 52485 const i = [ 52486 { 52487 key: "owner", 52488 value: this.styleOwner 52489 }, 52490 { 52491 key: "id", 52492 value: this.styleId 52493 }, 52494 { 52495 key: "access_token", 52496 value: this._map._requestManager._customAccessToken || e1.eM.ACCESS_TOKEN 52497 } 52498 ]; 52499 if (t1) { 52500 const s = i.reduce((e1, t1, s)=>(t1.value && (e1 += "".concat(t1.key, "=").concat(t1.value).concat(s < i.length - 1 ? "&" : "")), e1), "?"); 52501 t1.href = "".concat(e1.eM.FEEDBACK_URL, "/").concat(s, "#").concat(ja(this._map, !0)), t1.rel = "noopener nofollow"; 52502 } 52503 } 52504 _updateData(e1) { 52505 !e1 || ("source" !== e1.dataType || "metadata" !== e1.sourceDataType && "visibility" !== e1.sourceDataType) && "style" !== e1.dataType || (this._updateAttributions(), this._updateEditLink()); 52506 } 52507 _updateAttributions() { 52508 if (!this._map.style) return; 52509 let e1 = []; 52510 if (this._map.style.stylesheet) { 52511 const e1 = this._map.style.stylesheet; 52512 this.styleOwner = e1.owner, this.styleId = e1.id; 52513 } 52514 const t1 = this._map.style._mergedSourceCaches; 52515 for(const i in t1){ 52516 const s = t1[i]; 52517 if (s.used) { 52518 const t1 = s.getSource(); 52519 t1.attribution && !e1.includes(t1.attribution) && e1.push(t1.attribution); 52520 } 52521 } 52522 e1.sort((e1, t1)=>e1.length - t1.length), e1 = e1.filter((t1, i)=>{ 52523 for(let s = i + 1; s < e1.length; s++)if (e1[s].includes(t1)) return !1; 52524 return !0; 52525 }), this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? e1 = [ 52526 ...this.options.customAttribution, 52527 ...e1 52528 ] : e1.unshift(this.options.customAttribution)); 52529 const i = e1.map((e1)=>(function(e1) { 52530 const t1 = (new DOMParser).parseFromString(e1, "text/html"); 52531 return Array.from(t1.body.querySelectorAll("*")).reverse().forEach((e1)=>{ 52532 const i = e1.textContent || ""; 52533 if ("A" !== e1.tagName) return void e1.replaceWith(...e1.childNodes); 52534 const s = e1.getAttribute("href"); 52535 if (!s || !Gl.test(s)) return void e1.replaceWith(t1.createTextNode(i)); 52536 const r = t1.createElement("a"); 52537 r.href = s, r.textContent = i, r.rel = "noopener nofollow"; 52538 const o = e1.getAttribute("class"); 52539 o && (r.className = o), e1.replaceWith(r); 52540 }), t1.body.innerHTML; 52541 })(e1)).join(" | "); 52542 i !== this._attribHTML && (this._attribHTML = i, e1.length ? (this._innerContainer.innerHTML = i, this._container.classList.remove("mapboxgl-attrib-empty")) : this._container.classList.add("mapboxgl-attrib-empty"), this._editLink = null); 52543 } 52544 _updateCompact() { 52545 this._map.getCanvasContainer().offsetWidth <= 640 ? this._container.classList.add("mapboxgl-compact") : this._container.classList.remove("mapboxgl-compact", "mapboxgl-compact-show"); 52546 } 52547 constructor(t1 = {}){ 52548 this.options = t1, e1.aV([ 52549 "_toggleAttribution", 52550 "_updateEditLink", 52551 "_updateData", 52552 "_updateCompact" 52553 ], this); 52554 } 52555 } 52556 class Zl { 52557 onAdd(e1) { 52558 this._map = e1, this._container = a("div", "mapboxgl-ctrl"); 52559 const t1 = a("a", "mapboxgl-ctrl-logo"); 52560 return t1.target = "_blank", t1.rel = "noopener nofollow", t1.href = "https://www.mapbox.com/", t1.setAttribute("aria-label", this._map._getUIString("LogoControl.Title")), t1.setAttribute("rel", "noopener nofollow"), this._container.appendChild(t1), this._container.style.display = "none", this._map.on("sourcedata", this._updateLogo), this._updateLogo(), this._map.on("resize", this._updateCompact), this._updateCompact(), this._container; 52561 } 52562 onRemove() { 52563 this._container.remove(), this._map.off("sourcedata", this._updateLogo), this._map.off("resize", this._updateCompact); 52564 } 52565 getDefaultPosition() { 52566 return "bottom-left"; 52567 } 52568 _updateLogo(e1) { 52569 e1 && "metadata" !== e1.sourceDataType || (this._container.style.display = this._logoRequired() ? "block" : "none"); 52570 } 52571 _logoRequired() { 52572 if (!this._map.style) return !0; 52573 const e1 = this._map.style._sourceCaches; 52574 if (0 === Object.entries(e1).length) return !0; 52575 for(const t1 in e1){ 52576 const i = e1[t1].getSource(); 52577 if (Object.hasOwn(i, "mapbox_logo") && !i.mapbox_logo) return !1; 52578 } 52579 return !0; 52580 } 52581 _updateCompact() { 52582 const e1 = this._container.children; 52583 if (e1.length) { 52584 const t1 = e1[0]; 52585 this._map.getCanvasContainer().offsetWidth < 250 ? t1.classList.add("mapboxgl-compact") : t1.classList.remove("mapboxgl-compact"); 52586 } 52587 } 52588 constructor(){ 52589 e1.aV([ 52590 "_updateLogo", 52591 "_updateCompact" 52592 ], this); 52593 } 52594 } 52595 class $l { 52596 add(e1) { 52597 const t1 = ++this._id; 52598 return this._queue.push({ 52599 callback: e1, 52600 id: t1, 52601 cancelled: !1 52602 }), t1; 52603 } 52604 remove(e1) { 52605 const t1 = this._currentlyRunning, i = t1 ? this._queue.concat(t1) : this._queue; 52606 for (const t1 of i)if (t1.id === e1) return void (t1.cancelled = !0); 52607 } 52608 run() { 52609 let e1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0; 52610 const t1 = this._currentlyRunning = this._queue; 52611 this._queue = []; 52612 for (const i of t1)if (!i.cancelled && (i.callback(e1), this._cleared)) break; 52613 this._cleared = !1, this._currentlyRunning = !1; 52614 } 52615 clear() { 52616 this._currentlyRunning && (this._cleared = !0), this._queue = []; 52617 } 52618 constructor(){ 52619 this._queue = [], this._id = 0, this._cleared = !1, this._currentlyRunning = !1; 52620 } 52621 } 52622 class Hl { 52623 getValue(t1) { 52624 if (t1 <= this._startTime) return this._start; 52625 if (t1 >= this._endTime) return this._end; 52626 const i = e1.c0((t1 - this._startTime) / (this._endTime - this._startTime)); 52627 return this._start * (1 - i) + this._end * i; 52628 } 52629 isEasing(e1) { 52630 return e1 >= this._startTime && e1 <= this._endTime; 52631 } 52632 jumpTo(e1) { 52633 this._startTime = -1 / 0, this._endTime = -1 / 0, this._start = e1, this._end = e1; 52634 } 52635 easeTo(e1, t1, i) { 52636 this._start = this.getValue(t1), this._end = e1, this._startTime = t1, this._endTime = t1 + i; 52637 } 52638 constructor(e1){ 52639 this.jumpTo(e1); 52640 } 52641 } 52642 const Wl = { 52643 "AttributionControl.ToggleAttribution": "Toggle attribution", 52644 "FullscreenControl.Enter": "Enter fullscreen", 52645 "FullscreenControl.Exit": "Exit fullscreen", 52646 "GeolocateControl.FindMyLocation": "Find my location", 52647 "GeolocateControl.LocationNotAvailable": "Location not available", 52648 "LogoControl.Title": "Mapbox homepage", 52649 "Map.Title": "Map", 52650 "NavigationControl.ResetBearing": "Reset bearing to north", 52651 "NavigationControl.ZoomIn": "Zoom in", 52652 "NavigationControl.ZoomOut": "Zoom out", 52653 "ScrollZoomBlocker.CtrlMessage": "Use ctrl + scroll to zoom the map", 52654 "ScrollZoomBlocker.CmdMessage": "Use â + scroll to zoom the map", 52655 "TouchPanBlocker.Message": "Use two fingers to move the map" 52656 }; 52657 class Xl extends e1.h { 52658 constructor(e1, t1, i, s){ 52659 const { point: r, lngLat: o, originalEvent: n, target: a } = e1; 52660 super(e1.type, { 52661 point: r, 52662 lngLat: o, 52663 originalEvent: n, 52664 target: a 52665 }), this.preventDefault = ()=>{ 52666 e1.preventDefault(); 52667 }, this.id = t1, this.interaction = i, this.feature = s; 52668 } 52669 } 52670 class Kl { 52671 add(t1, i) {
52672 if (this.typeById.has(t1)) throw new Error('Interaction id "'.concat(t1, '" already exists.')); 52673 const s = i.filter; 52674 let r = i.type; 52675 s && this.filters.set(t1, e1.bv(s)), "mouseover" === r && (r = "mouseenter"), "mouseout" === r && (r = "mouseleave"); 52676 const o = this.interactionsByType.get(r) || new Map; 52677 "mouseenter" === r || "mouseleave" === r ? (0 === this.delegatedInteractions.size && (this.map.on("mousemove", this.handleMove), this.map.on("mouseout", this.handleOut)), this.delegatedInteractions.set(t1, i)) : 0 === o.size && this.map.on(r, this.handleType), 0 === o.size && this.interactionsByType.set(r, o), o.set(t1, i), this.typeById.set(t1, r); 52678 } 52679 get(e1) { 52680 const t1 = this.typeById.get(e1); 52681 if (!t1) return; 52682 const i = this.interactionsByType.get(t1); 52683 return i ? i.get(e1) : void 0; 52684 } 52685 remove(e1) { 52686 const t1 = this.typeById.get(e1); 52687 if (!t1) return; 52688 this.typeById.delete(e1), this.filters.delete(e1); 52689 const i = this.interactionsByType.get(t1); 52690 i && (i.delete(e1), "mouseenter" === t1 || "mouseleave" === t1 ? (this.delegatedInteractions.delete(e1), 0 === this.delegatedInteractions.size && (this.map.off("mousemove", this.handleMove), this.map.off("mouseout", this.handleOut))) : 0 === i.size && this.map.off(t1, this.handleType)); 52691 } 52692 queryTargets(e1, t1) { 52693 const i = []; 52694 for (const [e1, s] of t1)s.target && i.push({ 52695 targetId: e1, 52696 target: s.target, 52697 filter: this.filters.get(e1) 52698 }); 52699 return this.map.style.queryRenderedTargets(e1, i, this.map.transform); 52700 } 52701 handleMove(e1) { 52702 this.prevHoveredFeatures = this.hoveredFeatures, this.hoveredFeatures = new Map; 52703 const t1 = this.queryTargets(e1.point, Array.from(this.delegatedInteractions).reverse()); 52704 t1.length && (e1.type = "mouseenter", this.handleType(e1, t1)); 52705 const i = new Map; 52706 for (const [e1, { feature: t1 }] of this.prevHoveredFeatures)this.hoveredFeatures.has(e1) || i.set(t1.id, t1); 52707 i.size && (e1.type = "mouseleave", this.handleType(e1, Array.from(i.values()))); 52708 } 52709 handleOut(e1) { 52710 const t1 = Array.from(this.hoveredFeatures.values()).map((param)=>{ 52711 let { feature: e1 } = param; 52712 return e1; 52713 }); 52714 t1.length && (e1.type = "mouseleave", this.handleType(e1, t1)), this.hoveredFeatures.clear(); 52715 } 52716 handleType(t1, i) { 52717 const s = "mouseenter" === t1.type; 52718 if (s && !this.interactionsByType.has(t1.type)) return void e1.w("mouseenter interaction required for mouseleave to work."); 52719 const r = Array.from(this.interactionsByType.get(t1.type)).reverse(), o = !!i; 52720 i = i || this.queryTargets(t1.point, r); 52721 let n = !1; 52722 const a = new Set; 52723 for (const l of i){ 52724 for (const [i, c] of r){ 52725 if (!c.target) continue; 52726 const r = l.variants ? l.variants[i] : null; 52727 if (r) { 52728 for (const h of r){ 52729 if (Uo(h, l, a, i)) continue; 52730 const r = new e1.dL(l, h), d = zo(h, l, i); 52731 o && void 0 !== r.id && (r.state = this.map.getFeatureState(r)); 52732 const u = s ? this.prevHoveredFeatures.get(d) : null, p = new Xl(t1, i, c, r), f = u ? u.stop : c.handler(p); 52733 if (s && this.hoveredFeatures.set(d, { 52734 feature: l, 52735 stop: f 52736 }), !1 !== f) { 52737 n = !0; 52738 break; 52739 } 52740 } 52741 if (n) break; 52742 } 52743 } 52744 if (n) break; 52745 } 52746 if (!n) for (const [e1, i] of r){ 52747 const { handler: s, target: r } = i; 52748 if (!r && !1 !== s(new Xl(t1, e1, i, null))) break; 52749 } 52750 } 52751 constructor(e1){ 52752 this.map = e1, this.interactionsByType = new Map, this.delegatedInteractions = new Map, this.typeById = new Map, this.filters = new Map, this.handleType = this.handleType.bind(this), this.handleMove = this.handleMove.bind(this), this.handleOut = this.handleOut.bind(this), this.hoveredFeatures = new Map, this.prevHoveredFeatures = new Map; 52753 } 52754 } 52755 function Yl(t1, i) { 52756 if (Array.isArray(t1) && Array.isArray(i)) { 52757 const e1 = new Set(t1), s = new Set(i); 52758 return e1.size === s.size && t1.every((e1)=>s.has(e1)); 52759 } 52760 return e1.O(t1, i); 52761 } 52762 const Ql = /matrix.*\((.+)\)/, Jl = { 52763 center: [ 52764 0, 52765 0 52766 ], 52767 zoom: 0, 52768 bearing: 0, 52769 pitch: 0, 52770 minZoom: -2, 52771 maxZoom: 22, 52772 minPitch: 0, 52773 maxPitch: 85, 52774 interactive: !0, 52775 scrollZoom: !0, 52776 boxZoom: !0, 52777 dragRotate: !0, 52778 dragPan: !0, 52779 keyboard: !0, 52780 doubleClickZoom: !0, 52781 touchZoomRotate: !0, 52782 touchPitch: !0, 52783 cooperativeGestures: !1, 52784 performanceMetricsCollection: !0, 52785 bearingSnap: 7, 52786 clickTolerance: 3, 52787 pitchWithRotate: !0, 52788 hash: !1, 52789 attributionControl: !0, 52790 antialias: !1, 52791 failIfMajorPerformanceCaveat: !1, 52792 preserveDrawingBuffer: !1, 52793 trackResize: !0, 52794 renderWorldCopies: !0, 52795 refreshExpiredTiles: !0, 52796 minTileCacheSize: null,
vendor: 5,185 bytes, lines 52797-52894
52797 maxTileCacheSize: null, 52798 localIdeographFontFamily: "sans-serif", 52799 localFontFamily: null, 52800 fontstackCompositing: "client", 52801 transformRequest: null, 52802 accessToken: null, 52803 fadeDuration: 300, 52804 respectPrefersReducedMotion: !0, 52805 crossSourceCollisions: !0, 52806 collectResourceTiming: !1, 52807 testMode: !1, 52808 precompilePrograms: !0, 52809 scaleFactor: 1 52810 }, ec = { 52811 showCompass: !0, 52812 showZoom: !0, 52813 visualizePitch: !1 52814 }; 52815 class tc { 52816 down(e1, t1) { 52817 this.mouseRotate.mousedown(e1, t1), this.mousePitch && this.mousePitch.mousedown(e1, t1), u(); 52818 } 52819 move(e1, t1) { 52820 const i = this.map, s = this.mouseRotate.mousemoveWindow(e1, t1), r = s && s.bearingDelta; 52821 if (r && i.setBearing(i.getBearing() + r), this.mousePitch) { 52822 const s = this.mousePitch.mousemoveWindow(e1, t1), r = s && s.pitchDelta; 52823 r && i.setPitch(i.getPitch() + r); 52824 } 52825 } 52826 off() { 52827 const e1 = this.element; 52828 e1.removeEventListener("mousedown", this.mousedown), e1.removeEventListener("touchstart", this.touchstart), e1.removeEventListener("touchmove", this.touchmove), e1.removeEventListener("touchend", this.touchend), e1.removeEventListener("touchcancel", this.reset), this.offTemp(); 52829 } 52830 offTemp() { 52831 p(), window.removeEventListener("mousemove", this.mousemove), window.removeEventListener("mouseup", this.mouseup); 52832 } 52833 mousedown(e1) { 52834 this.down({ 52835 ...e1, 52836 button: e1.button, 52837 type: e1.type, 52838 ctrlKey: !0, 52839 preventDefault: ()=>e1.preventDefault() 52840 }, _(this.element, e1)), window.addEventListener("mousemove", this.mousemove), window.addEventListener("mouseup", this.mouseup); 52841 } 52842 mousemove(e1) { 52843 this.move(e1, _(this.element, e1)); 52844 } 52845 mouseup(e1) { 52846 this.mouseRotate.mouseupWindow(e1), this.mousePitch && this.mousePitch.mouseupWindow(e1), this.offTemp(); 52847 } 52848 touchstart(e1) { 52849 1 !== e1.targetTouches.length ? this.reset() : (this._startPos = this._lastPos = g(this.element, e1.targetTouches)[0], this.down({ 52850 type: "mousedown", 52851 button: 0, 52852 ctrlKey: !0, 52853 preventDefault: ()=>e1.preventDefault() 52854 }, this._startPos)); 52855 } 52856 touchmove(e1) { 52857 1 !== e1.targetTouches.length ? this.reset() : (this._lastPos = g(this.element, e1.targetTouches)[0], this.move({ 52858 buttons: 1, 52859 preventDefault: ()=>e1.preventDefault() 52860 }, this._lastPos)); 52861 } 52862 touchend(e1) { 52863 0 === e1.targetTouches.length && this._startPos && this._lastPos && this._startPos.dist(this._lastPos) < this._clickTolerance && this.element.click(), this.reset(); 52864 } 52865 reset() { 52866 this.mouseRotate.reset(), this.mousePitch && this.mousePitch.reset(), delete this._startPos, delete this._lastPos, this.offTemp(); 52867 } 52868 constructor(t1, i, s = !1){ 52869 this._clickTolerance = 10, this.element = i, this.mouseRotate = new ul({ 52870 clickTolerance: t1.dragRotate._mouseRotate._clickTolerance 52871 }), this.map = t1, s && (this.mousePitch = new pl({ 52872 clickTolerance: t1.dragRotate._mousePitch._clickTolerance 52873 })), e1.aV([ 52874 "mousedown", 52875 "mousemove", 52876 "mouseup", 52877 "touchstart", 52878 "touchmove", 52879 "touchend", 52880 "reset" 52881 ], this), i.addEventListener("mousedown", this.mousedown), i.addEventListener("touchstart", this.touchstart, { 52882 passive: !1 52883 }), i.addEventListener("touchmove", this.touchmove), i.addEventListener("touchend", this.touchend), i.addEventListener("touchcancel", this.reset); 52884 } 52885 } 52886 function ic(t1, i, s) { 52887 if (t1 = new e1.c_(t1.lng, t1.lat), i) { 52888 const r = new e1.c_(t1.lng - 360, t1.lat), o = new e1.c_(t1.lng + 360, t1.lat), n = 360 * Math.ceil(Math.abs(t1.lng - s.center.lng) / 360), a = s.locationPoint3D(t1).distSqr(i), l = i.x < 0 || i.y < 0 || i.x > s.width || i.y > s.height; 52889 s.locationPoint3D(r).distSqr(i) < a && (l || Math.abs(r.lng - s.center.lng) < n) ? t1 = r : s.locationPoint3D(o).distSqr(i) < a && (l || Math.abs(o.lng - s.center.lng) < n) && (t1 = o); 52890 } 52891 for(; Math.abs(t1.lng - s.center.lng) > 180;){ 52892 const e1 = s.locationPoint3D(t1); 52893 if (e1.x >= 0 && e1.y >= 0 && e1.x <= s.width && e1.y <= s.height) break; 52894 t1.lng >
52894 s.center.lng ? t1.lng -= 360 : t1.lng += 360; 52895 } 52896 return t1; 52897 } 52898 const sc = { 52899 center: "translate(-50%,-50%)", 52900 top: "translate(-50%,0)", 52901 "top-left": "translate(0,0)", 52902 "top-right": "translate(-100%,0)", 52903 bottom: "translate(-50%,-100%)", 52904 "bottom-left": "translate(0,-100%)", 52905 "bottom-right": "translate(-100%,-100%)", 52906 left: "translate(0,-50%)", 52907 right: "translate(-100%,-50%)" 52908 }, rc = /\s+/, oc = { 52909 rotation: 0, 52910 rotationAlignment: "auto", 52911 pitchAlignment: "auto", 52912 occludedOpacity: .2, 52913 altitude: 0 52914 }; 52915 class nc extends e1.E { 52916 _createDefaultMarker() { 52917 const e1 = a("div"), t1 = l("svg", { 52918 display: "block", 52919 height: 41 * this._scale + "px", 52920 width: 27 * this._scale + "px", 52921 viewBox: "0 0 27 41" 52922 }, e1); 52923 this._svgElement = t1; 52924 const i = l("radialGradient", { 52925 id: "shadowGradient" 52926 }, l("defs", {}, t1)); 52927 l("stop", { 52928 offset: "10%", 52929 "stop-opacity": .4 52930 }, i), l("stop", { 52931 offset: "100%", 52932 "stop-opacity": .05 52933 }, i); 52934 const s = l("ellipse", { 52935 cx: 13.5, 52936 cy: 34.8, 52937 rx: 10.5, 52938 ry: 5.25, 52939 fill: "url(#shadowGradient)" 52940 }); 52941 return this._shadowElement = s, 0 === this._altitude && t1.insertBefore(s, t1.firstChild), l("path", { 52942 fill: this._color, 52943 d: "M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z" 52944 }, t1), l("path", { 52945 opacity: .25, 52946 d: "M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z" 52947 }, t1), l("circle", { 52948 fill: "white", 52949 cx: 13.5, 52950 cy: 13.5, 52951 r: 5.5 52952 }, t1), e1; 52953 } 52954 addTo(e1) { 52955 return e1 === this._map || (this.remove(), this._map = e1, e1.getCanvasContainer().appendChild(this._element), e1.on("move", this._updateMoving), e1.on("moveend", this._update), e1.on("remove", this._clearFadeTimer), e1._addMarker(this), this.setDraggable(this._draggable), this._update(), e1.on("click", this._onMapClick)), this; 52956 } 52957 remove() { 52958 const e1 = this._map; 52959 return e1 && (e1.off("click", this._onMapClick), e1.off("move", this._updateMoving), e1.off("moveend", this._update), e1.off("mousedown", this._addDragHandler), e1.off("touchstart", this._addDragHandler), e1.off("mouseup", this._onUp), e1.off("touchend", this._onUp), e1.off("mousemove", this._onMove), e1.off("touchmove", this._onMove), e1.off("remove", this._clearFadeTimer), e1._removeMarker(this), this._map = void 0), this._clearFadeTimer(), this._element.remove(), this._popup && this._popup.remove(), this; 52960 } 52961 getLngLat() { 52962 return this._lngLat; 52963 } 52964 setLngLat(t1) { 52965 return this._lngLat = e1.c_.convert(t1), this._pos = null, this._popup && this._popup.setLngLat(this._lngLat), this._update(!0), this; 52966 } 52967 setAltitude(e1) { 52968 if (e1 === this._altitude) return this; 52969 const t1 = this._altitude; 52970 return this._altitude = e1 || oc.altitude, this._defaultMarker && 0 === t1 != (0 === this._altitude) && (0 === this._altitude ? this._svgElement.insertBefore(this._shadowElement, this._svgElement.firstChild) : this._shadowElement.remove()), this._update(), this; 52971 } 52972 getAltitude() { 52973 return this._altitude; 52974 } 52975 getElement() { 52976 return this._element; 52977 } 52978 setPopup(e1) { 52979 if (this._popup && (this._popup.remove(), this._popup = null, this._element.removeAttribute("role"), this._element.removeEventListener("keypress", this._onKeyPress), this._originalTabIndex || this._element.removeAttribute("tabindex")), e1) { 52980 if (!("offset" in e1.options)) { 52981 const t1 = 38.1, i = 13.5, s = Math.sqrt(Math.pow(i, 2) / 2); 52982 e1.options.offset = this._defaultMarker ? { 52983 top: [ 52984 0, 52985 0 52986 ], 52987 "top-left": [ 52988 0, 52989 0 52990 ], 52991 "top-right": [ 52992 0, 52993 0 52994 ], 52995 bottom: [ 52996 0, 52997 -t1 52998 ], 52999 "bottom-left": [ 53000 s, 53001 -1 * (t1 - i + s) 53002 ], 53003 "bottom-right": [ 53004 -s, 53005 -1 * (t1 - i + s) 53006 ], 53007 left: [ 53008 i, 53009 -1 * (t1 - i) 53010 ], 53011 right: [ 53012 -i, 53013 -1 * (t1 - i) 53014 ] 53015 } : this._offset; 53016 } 53017 this._popup = e1, e1._marker = this, e1._altitude = this._altitude, this._lngLat && this._popup.setLngLat(this._lngLat), this._element.setAttribute("role", "button"), this._originalTabIndex = this._element.getAttribute("tabindex"), this._originalTabIndex || this._element.setAttribute("tabindex", "0"), this._element.addEventListener("keypress", this._onKeyPress), this._element.setAttribute("aria-expanded", "false"); 53018 } 53019 return this; 53020 } 53021 _onKeyPress(e1) {
53022 const t1 = e1.code, i = e1.charCode || e1.keyCode; 53023 "Space" !== t1 && "Enter" !== t1 && 32 !== i && 13 !== i || this.togglePopup(); 53024 } 53025 _onMapClick(e1) { 53026 const t1 = e1.originalEvent.target, i = this._element; 53027 this._popup && (t1 === i || i.contains(t1)) && this.togglePopup(); 53028 } 53029 getPopup() { 53030 return this._popup; 53031 } 53032 togglePopup() { 53033 const e1 = this._popup; 53034 return e1 ? (e1.isOpen() ? (e1.remove(), this._element.setAttribute("aria-expanded", "false")) : this._map && (e1.addTo(this._map), this._element.setAttribute("aria-expanded", "true")), this) : this; 53035 } 53036 _behindTerrain() { 53037 const e1 = this._map, t1 = this._pos; 53038 if (!e1 || !t1) return !1; 53039 const i = e1.unproject(t1, this._altitude), s = e1.getFreeCameraOptions(); 53040 if (!s.position) return !1; 53041 const r = s.position.toLngLat(); 53042 return r.distanceTo(i) < .9 * r.distanceTo(this._lngLat); 53043 } 53044 _evaluateOpacity() { 53045 const t1 = this._map; 53046 if (!t1) return; 53047 const i = this._pos; 53048 if (!i || i.x < 0 || i.x > t1.transform.width || i.y < 0 || i.y > t1.transform.height) return void this._clearFadeTimer(); 53049 const s = t1.unproject(i, this._altitude); 53050 let r; 53051 t1._showingGlobe() && e1.f3(t1.transform, this._lngLat) ? r = 0 : (r = 1 - t1._queryFogOpacity(s), t1.transform._terrainEnabled() && t1.style && t1.style.hasTerrain() && this._behindTerrain() && (r *= this._occludedOpacity)), this._element.style.opacity = "".concat(r); 53052 const o = this._element.style.pointerEvents; 53053 (null === this._pointerEvents ? "" === o : o === this._pointerEvents) && (this._pointerEvents = r > 0 ? "auto" : "none", this._element.style.pointerEvents = this._pointerEvents), this._popup && this._popup._setOpacity(r), this._fadeTimer = null; 53054 } 53055 _clearFadeTimer() { 53056 this._fadeTimer && (clearTimeout(this._fadeTimer), this._fadeTimer = null); 53057 } 53058 _updateDOM() { 53059 const e1 = this._pos; 53060 if (!e1 || !this._map) return; 53061 const t1 = this._offset.mult(this._scale); 53062 this._element.style.transform = "\n translate(".concat(e1.x, "px,").concat(e1.y, "px)\n ").concat(sc[this._anchor], "\n ").concat(this._calculateXYTransform(), " ").concat(this._calculateZTransform(), "\n translate(").concat(t1.x, "px,").concat(t1.y, "px)\n "); 53063 } 53064 _calculateXYTransform() { 53065 const t1 = this._pos, i = this._map, s = this.getPitchAlignment(); 53066 if (!i || !t1 || "map" !== s) return ""; 53067 if (!i._showingGlobe()) { 53068 const e1 = i.getPitch(); 53069 return e1 ? "rotateX(".concat(e1, "deg)") : ""; 53070 } 53071 const r = e1.f4(e1.f5(i.transform, this._lngLat)), o = t1.sub(e1.f6(i.transform)), n = Math.abs(o.x) + Math.abs(o.y); 53072 if (0 === n) return ""; 53073 const a = r / n; 53074 return "rotateX(".concat(-o.y * a, "deg) rotateY(").concat(o.x * a, "deg)"); 53075 } 53076 _calculateZTransform() { 53077 const t1 = this._pos, i = this._map; 53078 if (!i || !t1) return ""; 53079 let s = 0; 53080 const r = this.getRotationAlignment(); 53081 if ("map" === r) if (i._showingGlobe()) { 53082 const t1 = i.project(new e1.c_(this._lngLat.lng, this._lngLat.lat + .001), this._altitude), r = i.project(new e1.c_(this._lngLat.lng, this._lngLat.lat - .001), this._altitude).sub(t1); 53083 s = e1.f4(Math.atan2(r.y, r.x)) - 90; 53084 } else s = -i.getBearing(); 53085 else if ("horizon" === r) { 53086 const r = e1.am(4, 6, i.getZoom()), o = e1.f6(i.transform); 53087 o.y += r * i.transform.height; 53088 const n = t1.sub(o), a = e1.f4(Math.atan2(n.y, n.x)); 53089 s = (a > 90 ? a - 270 : a + 90) * (1 - r); 53090 } 53091 return s += this._rotation, s ? "rotateZ(".concat(s, "deg)") : ""; 53092 } 53093 _update(e1) { 53094 cancelAnimationFrame(this._updateFrameId); 53095 const t1 = this._map; 53096 t1 && (t1.transform.renderWorldCopies && (this._lngLat = ic(this._lngLat, this._pos, t1.transform)), this._pos = t1.project(this._lngLat, this._altitude), !0 === e1 ? this._updateFrameId = requestAnimationFrame(()=>{ 53097 this._element && this._pos && this._anchor && (this._pos = this._pos.round(), this._updateDOM()); 53098 }) : this._pos = this._pos.round(), t1._requestDomTask(()=>{ 53099 this._map && (this._element && this._pos && this._anchor && this._updateDOM(), (t1._showingGlobe() || t1.style && t1.style.hasTerrain() || t1.getFog()) && !this._fadeTimer && (this._fadeTimer = window.setTimeout(this._evaluateOpacity.bind(this), 60))); 53100 })); 53101 } 53102 getOffset() { 53103 return this._offset; 53104 } 53105 setOffset(t1) { 53106 return this._offset = e1.P.convert(t1), this._update(), this; 53107 } 53108 addClassName(e1) { 53109 return this._element.classList.add(e1), this; 53110 } 53111 removeClassName(e1) { 53112 return this._element.classList.remove(e1), this; 53113 } 53114 toggleClassName(e1) { 53115 return this._element.classList.toggle(e1); 53116 } 53117 _onMove(t1) { 53118 const i = this._map; 53119 if (!i) return; 53120 const s = this._pointerdownPos, r = this._positionDelta; 53121 if (s && r) { 53122 if (!this._isDragging) { 53123 const e1 = this._clickTolerance || i._clickTolerance; 53124 if (t1.point.dist(s) < e1) return; 53125 this._isDragging = !0; 53126 } 53127 this._pos = t1.point.sub(r), this._lngLat = i.unproject(this._pos, this._altitude), this.setLngLat(this._lngLat), this._element.style.pointerEvents = "none", "pending" === this._state && (this._state = "active", this.fire(new e1.h("dragstart"))), this.fire(new e1.h("drag")); 53128 } 53129 } 53130 _onUp() { 53131 this._element.style.pointerEvents = "auto", this._positionDelta = null, this._pointerdownPos = null, this._isDragging = !1; 53132 const t1 = this._map; 53133 t1 && (t1.off("mousemove", this._onMove), t1.off("touchmove", this._onMove)), "active" === this._state && this.fire(new e1.h("dragend")), this._state = "inactive"; 53134 } 53135 _addDragHandler(e1) { 53136 const t1 = this._map, i = this._pos; 53137 t1 && i && this._element.contains(e1.originalEvent.target) && (e1.preventDefault(), this._positionDelta = e1.point.sub(i), this._pointerdownPos = e1.point, this._state = "pending", t1.on("mousemove", this._onMove), t1.on("touchmove", this._onMove), t1.once("mouseup", this._onUp), t1.once("touchend", this._onUp)); 53138 } 53139 setDraggable(e1) { 53140 this._draggable = !!e1; 53141 const t1 = this._map; 53142 return t1 && (e1 ? (t1.on("mousedown", this._addDragHandler), t1.on("touchstart", this._addDragHandler)) : (t1.off("mousedown", this._addDragHandler), t1.off("touchstart", this._addDragHandler))), this; 53143 } 53144 isDraggable() { 53145 return this._draggable; 53146 } 53147 setRotation(e1) {
53148 return this._rotation = e1 || oc.rotation, this._update(), this; 53149 } 53150 getRotation() { 53151 return this._rotation; 53152 } 53153 setRotationAlignment(e1) { 53154 return this._rotationAlignment = e1 || oc.rotationAlignment, this._update(), this; 53155 } 53156 getRotationAlignment() { 53157 return "auto" === this._rotationAlignment || "horizon" === this._rotationAlignment && this._map && !this._map._showingGlobe() ? "viewport" : this._rotationAlignment; 53158 } 53159 setPitchAlignment(e1) { 53160 return this._pitchAlignment = e1 || oc.pitchAlignment, this._update(), this; 53161 } 53162 getPitchAlignment() { 53163 return "auto" === this._pitchAlignment ? this.getRotationAlignment() : this._pitchAlignment; 53164 } 53165 setOccludedOpacity(e1) { 53166 return this._occludedOpacity = e1 || oc.occludedOpacity, this._update(), this; 53167 } 53168 getOccludedOpacity() { 53169 return this._occludedOpacity; 53170 } 53171 constructor(t1, i){ 53172 super(), (t1 instanceof HTMLElement || i) && (t1 = { 53173 element: t1, 53174 ...i 53175 }), e1.aV([ 53176 "_update", 53177 "_onMove", 53178 "_onUp", 53179 "_addDragHandler", 53180 "_onMapClick", 53181 "_onKeyPress", 53182 "_clearFadeTimer" 53183 ], this); 53184 const { anchor: s = "center", color: r = "#3FB1CE", scale: o = 1, draggable: n = !1, clickTolerance: a = 0, rotation: l = oc.rotation, rotationAlignment: c = oc.rotationAlignment, pitchAlignment: h = oc.pitchAlignment, occludedOpacity: d = oc.occludedOpacity, altitude: u = oc.altitude } = t1 || {}; 53185 this._anchor = s, this._color = r, this._scale = o, this._draggable = n, this._clickTolerance = a, this._rotation = l, this._rotationAlignment = c, this._pitchAlignment = h, this._occludedOpacity = d, this._altitude = u, this._state = "inactive", this._isDragging = !1, this._pointerEvents = null, this._updateMoving = ()=>this._update(!0), t1 && t1.element ? (this._element = t1.element, this._offset = e1.P.convert(t1 && t1.offset || [ 53186 0, 53187 0 53188 ])) : (this._defaultMarker = !0, this._element = this._createDefaultMarker(), this._offset = e1.P.convert(t1 && t1.offset || [ 53189 0, 53190 -14 53191 ])), this._element.hasAttribute("aria-label") || this._element.setAttribute("aria-label", "Map marker"), this._element.hasAttribute("role") || this._element.setAttribute("role", "img"), this._element.classList.add("mapboxgl-marker"), this._element.addEventListener("dragstart", (e1)=>{ 53192 e1.preventDefault(); 53193 }), this._element.addEventListener("mousedown", (e1)=>{ 53194 e1.preventDefault(); 53195 }); 53196 const p = this._element.classList; 53197 for(const e1 in sc)p.remove("mapboxgl-marker-anchor-".concat(e1)); 53198 p.add("mapboxgl-marker-anchor-".concat(this._anchor)), t1 && t1.className && p.add(...t1.className.trim().split(rc)), this._popup = null; 53199 } 53200 } 53201 const ac = { 53202 OFF: [], 53203 WAITING_ACTIVE: [ 53204 "waiting", 53205 "active" 53206 ], 53207 ACTIVE_LOCK: [ 53208 "active" 53209 ],
53210 ACTIVE_ERROR: [ 53211 "waiting", 53212 "active-error" 53213 ], 53214 BACKGROUND: [ 53215 "background" 53216 ], 53217 BACKGROUND_ERROR: [ 53218 "waiting", 53219 "background-error" 53220 ] 53221 }, lc = (e1)=>"mapboxgl-ctrl-geolocate-".concat(e1), cc = [ 53222 "waiting", 53223 "active", 53224 "active-error", 53225 "background", 53226 "background-error" 53227 ].map(lc), hc = { 53228 positionOptions: { 53229 enableHighAccuracy: !1, 53230 maximumAge: 0, 53231 timeout: 6e3 53232 }, 53233 fitBoundsOptions: { 53234 maxZoom: 15 53235 }, 53236 trackUserLocation: !1, 53237 showAccuracyCircle: !0, 53238 showUserLocation: !0, 53239 showUserHeading: !1, 53240 showButton: !0, 53241 followUserLocation: !0 53242 }, dc = { 53243 maxWidth: 100, 53244 unit: "metric" 53245 }, uc = { 53246 kilometer: "km", 53247 meter: "m", 53248 mile: "mi", 53249 foot: "ft", 53250 "nautical-mile": "nm" 53251 }, pc = /\s+/, fc = { 53252 closeButton: !0, 53253 closeOnClick: !0, 53254 focusAfterOpen: !0, 53255 className: "", 53256 maxWidth: "240px", 53257 altitude: 0 53258 }, mc = [ 53259 "a[href]", 53260 "[tabindex]:not([tabindex='-1'])", 53261 "[contenteditable]:not([contenteditable='false'])", 53262 "button:not([disabled])", 53263 "input:not([disabled])", 53264 "select:not([disabled])", 53265 "textarea:not([disabled])" 53266 ].join(", "); 53267 function _c() { 53268 let t1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : new e1.P(0, 0), i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "bottom"; 53269 if ("number" == typeof t1) { 53270 const s = Math.round(Math.sqrt(.5 * Math.pow(t1, 2))); 53271 switch(i){ 53272 case "top": 53273 return new e1.P(0, t1); 53274 case "top-left": 53275 return new e1.P(s, s); 53276 case "top-right": 53277 return new e1.P(-s, s); 53278 case "bottom": 53279 return new e1.P(0, -t1); 53280 case "bottom-left": 53281 return new e1.P(s, -s); 53282 case "bottom-right": 53283 return new e1.P(-s, -s); 53284 case "left": 53285 return new e1.P(t1, 0); 53286 case "right": 53287 return new e1.P(-t1, 0); 53288 } 53289 return new e1.P(0, 0); 53290 } 53291 return t1 instanceof e1.P || Array.isArray(t1) ? e1.P.convert(t1) : e1.P.convert(t1[i] || [ 53292 0, 53293 0 53294 ]); 53295 } 53296 const gc = "undefined" != typeof document ? document.currentScript : null; 53297 e1.f7(gc && gc.src && e1.f8(gc.src) ? "cdn" : "other"); 53298 const yc = { 53299 version: e1.f2, 53300 supported: function(e1) { 53301 return !function(e1) { 53302 return "undefined" != typeof window && "undefined" != typeof document ? Object.hasOwn ? function() { 53303 const e1 = document.createElement("canvas"); 53304 e1.width = e1.height = 1; 53305 const t1 = e1.getContext("2d"); 53306 return !!t1 && t1.getImageData(0, 0, 1, 1).width === e1.width; 53307 }() ? function(e1) { 53308 return e1 ? (void 0 === s && (s = r(!0)), s) : (void 0 === i && (i = r(!1)), i); 53309 }(e1) ? "" : "insufficient WebGL2 support" : "insufficient Canvas/getImageData support" : "Object.hasOwn not supported" : "not a browser"; 53310 }(e1); 53311 }, 53312 setRTLTextPlugin: e1.fd, 53313 getRTLTextPluginStatus: e1.fc, 53314 setSdkInfo: e1.fb, 53315 addTileProvider: e1.fa, 53316 Map: class extends Vl { 53317 _getMapId() { 53318 return this._mapId; 53319 } 53320 addControl(t1, i) { 53321 if (void 0 === i && (i = t1.getDefaultPosition ? t1.getDefaultPosition() : "top-right"), !t1 || !t1.onAdd) return this.fire(new e1.f(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods."))); 53322 const s = t1.onAdd(this); 53323 this._controls.push(t1); 53324 const r = this._controlPositions[i]; 53325 return i.includes("bottom") ? r.insertBefore(s, r.firstChild) : r.appendChild(s), this; 53326 } 53327 removeControl(t1) { 53328 if (!t1 || !t1.onRemove) return this.fire(new e1.f(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods."))); 53329 const i = this._controls.indexOf(t1); 53330 return i > -1 && this._controls.splice(i, 1), t1.onRemove(this), this; 53331 } 53332 hasControl(e1) { 53333 return this._controls.includes(e1); 53334 } 53335 getContainer() { 53336 return this._container; 53337 } 53338 getCanvasContainer() { 53339 return this._canvasContainer; 53340 } 53341 getCanvas() { 53342 return this._canvas; 53343 } 53344 resize(t1) { 53345 if (this._updateContainerDimensions(), this._containerWidth === this.transform.width && this._containerHeight === this.transform.height) return this; 53346 this._resizeCanvas(this._containerWidth, this._containerHeight), this.transform.resize(this._containerWidth, this._containerHeight), this.painter.resize(Math.ceil(this._containerWidth), Math.ceil(this._containerHeight)); 53347 const i = !this._moving; 53348 return i && this.fire(new e1.h("movestart", t1)).fire(new e1.h("move", t1)), this.fire(new e1.h("resize", t1)), i && this.fire(new e1.h("moveend", t1)), this; 53349 } 53350 getBounds() { 53351 return this.transform.getBounds(); 53352 } 53353 getMaxBounds() { 53354 return this.transform.getMaxBounds() || null; 53355 }
53356 setMaxBounds(t1) { 53357 return this.transform.setMaxBounds(e1.eC.convert(t1)), this._update(); 53358 } 53359 setMinZoom(t1) { 53360 if ((t1 = t1 !== null && t1 !== void 0 ? t1 : -2) >= -2 && t1 <= this.transform.maxZoom) return this.transform.minZoom = t1, this._update(), this.getZoom() < t1 ? this.setZoom(t1) : this.fire(new e1.h("zoomstart")).fire(new e1.h("zoom")).fire(new e1.h("zoomend")), this; 53361 throw new Error("minZoom must be between -2 and the current maxZoom, inclusive"); 53362 } 53363 getMinZoom() { 53364 return this.transform.minZoom; 53365 } 53366 setMaxZoom(t1) { 53367 if ((t1 = t1 !== null && t1 !== void 0 ? t1 : 22) >= this.transform.minZoom) return this.transform.maxZoom = t1, this._update(), this.getZoom() > t1 ? this.setZoom(t1) : this.fire(new e1.h("zoomstart")).fire(new e1.h("zoom")).fire(new e1.h("zoomend")), this; 53368 throw new Error("maxZoom must be greater than the current minZoom"); 53369 } 53370 getMaxZoom() { 53371 return this.transform.maxZoom; 53372 } 53373 setMinPitch(t1) { 53374 if ((t1 = t1 !== null && t1 !== void 0 ? t1 : 0) < 0) throw new Error("minPitch must be greater than or equal to 0"); 53375 if (t1 >= 0 && t1 <= this.transform.maxPitch) return this.transform.minPitch = t1, this._update(), this.getPitch() < t1 ? this.setPitch(t1) : this.fire(new e1.h("pitchstart")).fire(new e1.h("pitch")).fire(new e1.h("pitchend")), this; 53376 throw new Error("minPitch must be between 0 and the current maxPitch, inclusive"); 53377 } 53378 getMinPitch() { 53379 return this.transform.minPitch; 53380 } 53381 setMaxPitch(t1) { 53382 if ((t1 = t1 !== null && t1 !== void 0 ? t1 : 85) > 85) throw new Error("maxPitch must be less than or equal to 85"); 53383 if (t1 >= this.transform.minPitch) return this.transform.maxPitch = t1, this._update(), this.getPitch() > t1 ? this.setPitch(t1) : this.fire(new e1.h("pitchstart")).fire(new e1.h("pitch")).fire(new e1.h("pitchend")), this; 53384 throw new Error("maxPitch must be greater than or equal to minPitch"); 53385 } 53386 getMaxPitch() { 53387 return this.transform.maxPitch; 53388 } 53389 getScaleFactor() { 53390 return this._scaleFactor; 53391 } 53392 setScaleFactor(e1) { 53393 return this._scaleFactor = e1, this.painter.scaleFactor = e1, this.style && this.style._setLabelPlacementStale(), this.style._updateFilteredLayers((e1)=>"symbol" === e1.type), this._update(!0), this; 53394 } 53395 getRenderWorldCopies() { 53396 return this.transform.renderWorldCopies; 53397 } 53398 setRenderWorldCopies(e1) { 53399 return this.transform.renderWorldCopies = e1, this.transform.renderWorldCopies || this._forceMarkerAndPopupUpdate(!0), this._update(); 53400 } 53401 getLanguage() { 53402 return this._language; 53403 } 53404 _parseLanguage(e1) { 53405 return "auto" === e1 ? navigator.language : Array.isArray(e1) ? 0 === e1.length ? void 0 : e1.map((e1)=>"auto" === e1 ? navigator.language : e1) : e1; 53406 } 53407 setLanguage(e1) { 53408 const t1 = this._parseLanguage(e1); 53409 if (!this.style || t1 === this._language) return this; 53410 this._language = t1, this.style.reloadSources(); 53411 for (const e1 of this._controls)e1._setLanguage && e1._setLanguage(this._language); 53412 return this; 53413 } 53414 getWorldview() { 53415 return this._worldview; 53416 } 53417 setWorldview(e1) { 53418 return this.style && e1 !== this._worldview ? (this._worldview = e1, this._styleDirty = !0, this.style.setWorldview(e1), this) : this; 53419 } 53420 getProjection() { 53421 return this.transform.mercatorFromTransition ? { 53422 name: "globe", 53423 center: [ 53424 0, 53425 0 53426 ] 53427 } : this.transform.getProjection(); 53428 } 53429 _showingGlobe() { 53430 return "globe" === this.transform.projection.name; 53431 } 53432 setProjection(e1) { 53433 return this._lazyInitEmptyStyle(), e1 ? "string" == typeof e1 && (e1 = { 53434 name: e1 53435 }) : e1 = null, this._useExplicitProjection = !!e1, this._prioritizeAndUpdateProjection(e1, this.style.projection); 53436 } 53437 _updateProjectionTransition() { 53438 if ("globe" !== this.getProjection().name) return; 53439 const t1 = this.transform, i = t1.projection.name; 53440 let s; 53441 "globe" === i && t1.zoom >= e1.b1 ? (t1.setMercatorFromTransition(), s = !0) : "mercator" === i && t1.zoom < e1.b1 && (t1.setProjection({ 53442 name: "globe" 53443 }), s = !0), s && (this.style.applyProjectionUpdate(), this.style._forceSymbolLayer
53443Update(), this._update(!0)); 53444 } 53445 _prioritizeAndUpdateProjection(e1, t1) { 53446 return this._updateProjection(e1 || t1 || { 53447 name: "mercator" 53448 }); 53449 } 53450 _updateProjection(t1) { 53451 let i; 53452 const s = this.transform.mercatorFromTransition; 53453 i = "globe" === t1.name && this.transform.zoom >= e1.b1 ? this.transform.setMercatorFromTransition() : this.transform.setProjection(t1), this.style.applyProjectionUpdate(); 53454 const r = "mercator" === this.transform.getProjection().name && s !== this.transform.mercatorFromTransition; 53455 return (i || r) && (this.painter.clearBackgroundTiles(), this.style.clearSources(), this._update(!0), this._forceMarkerAndPopupUpdate(!0)), this; 53456 } 53457 project(t1, i) { 53458 return this.transform.locationPoint3D(e1.c_.convert(t1), i); 53459 } 53460 unproject(t1, i) { 53461 return this.transform.pointLocation3D(e1.P.convert(t1), i); 53462 } 53463 isMoving() { 53464 return this._moving || this.handlers && this.handlers.isMoving() || !1; 53465 } 53466 isZooming() { 53467 return this._zooming || this.handlers && this.handlers.isZooming() || !1; 53468 } 53469 isRotating() { 53470 return this._rotating || this.handlers && this.handlers.isRotating() || !1; 53471 } 53472 _isDragging() { 53473 return this.handlers && this.handlers._isDragging() || !1; 53474 } 53475 _createDelegatedListener(e1, t1, i) { 53476 const s = (e1)=>{ 53477 let i = []; 53478 if (Array.isArray(t1)) { 53479 const s = t1.filter((e1)=>this.getLayer(e1)); 53480 i = s.length ? this.queryRenderedFeatures(e1, { 53481 layers: s 53482 }) : []; 53483 } else i = this.queryRenderedFeatures(e1, { 53484 target: t1 53485 }); 53486 return i; 53487 }; 53488 if ("mouseenter" === e1 || "mouseover" === e1) { 53489 let r = !1; 53490 const o = (t1)=>{ 53491 const o = s(t1.point); 53492 o.length ? r || (r = !0, i.call(this, new Ka(e1, this, t1.originalEvent, { 53493 features: o 53494 }))) : r = !1; 53495 }; 53496 return { 53497 listener: i, 53498 targets: t1, 53499 delegates: { 53500 mousemove: o, 53501 mouseout: ()=>{ 53502 r = !1; 53503 } 53504 } 53505 }; 53506 } 53507 if ("mouseleave" === e1 || "mouseout" === e1) { 53508 let r = !1; 53509 const o = (t1)=>{ 53510 s(t1.point).length ? r = !0 : r && (r = !1, i.call(this, new Ka(e1, this, t1.originalEvent))); 53511 }, n = (t1)=>{ 53512 r && (r = !1, i.call(this, new Ka(e1, this, t1.originalEvent))); 53513 }; 53514 return { 53515 listener: i, 53516 targets: t1, 53517 delegates: { 53518 mousemove: o, 53519 mouseout: n 53520 } 53521 }; 53522 } 53523 { 53524 const r = (e1)=>{ 53525 const t1 = s(e1.point); 53526 t1.length && (e1.features = t1, i.call(this, e1), delete e1.features); 53527 }; 53528 return { 53529 listener: i, 53530 targets: t1, 53531 delegates: { 53532 [e1]: r 53533 } 53534 }; 53535 } 53536 } 53537 on(e1, t1, i) { 53538 if ("function" == typeof t1 || void 0 === i) return super.on(e1, t1); 53539 if ("string" == typeof t1 && (t1 = [ 53540 t1 53541 ]), !this._areTargetsValid(t1)) return this; 53542 const s = this._createDelegatedListener(e1, t1, i); 53543 this._delegatedListeners = this._delegatedListeners || {}, this._delegatedListeners[e1] = this._delegatedListeners[e1] || [], this._delegatedListeners[e1].push(s); 53544 for(const e1 in s.delegates)this.on(e1, s.delegates[e1]); 53545 return this; 53546 } 53547 once(e1, t1, i) { 53548 if ("function" == typeof t1 || void 0 === i) return super.once(e1, t1); 53549 if ("string" == typeof t1 && (t1 = [ 53550 t1 53551 ]), !this._areTargetsValid(t1)) return this; 53552 const s = this._createDelegatedListener(e1, t1, i); 53553 for(const e1 in s.delegates)this.once(e1, s.delegates[e1]); 53554 return this; 53555 } 53556 off(e1, t1, i) { 53557 if ("function" == typeof t1 || void 0 === i) return super.off(e1, t1); 53558 if ("string" == typeof t1 && (t1 = [ 53559 t1 53560 ]), !this._areTargetsValid(t1)) return this; 53561 const s = this._delegatedListeners ? this._delegatedListeners[e1] : void 0; 53562 return s && ((e1)=>{ 53563 for(let s = 0; s < e1.length; s++){ 53564 const r = e1[s]; 53565 if (r.listener === i && Yl(r.targets, t1)) { 53566 for(const e1 in r.delegates)this.off(e1, r.delegates[e1]); 53567 return e1.splice(s, 1), this; 53568 } 53569 } 53570 })(s), this; 53571 } 53572 queryRenderedFeatures(t1, i) { 53573 if (!this.style) return []; 53574 if (void 0 === t1 || t1 instanceof e1.P || Array.isArray(t1) || void 0 !== i || (i = t1, t1 = void 0), t1 = t1 || [ 53575 [ 53576 0, 53577 0 53578 ], 53579 [ 53580 this.transform.width, 53581 this.transform.height 53582 ] 53583 ], !i) { 53584 const e1 = this.style.queryRenderedFeatures(t1, void 0, this.transform), i = this.style.queryRenderedFeatureset(t1, void 0, this.transform); 53585 return e1.concat(i); 53586 } 53587 let s = !0; 53588 if (i.target && (s = this._isTargetValid(i.target), s && !i.layers)) return this.style.queryRenderedFeatureset(t1, i, this.transform); 53589 let r = !0; 53590 if (i.layers && Array.isArray(i.layers)) { 53591 for (const e1 of i.layers)if (!this._isValidId(e1)) { 53592 r = !1; 53593 break; 53594 } 53595 if (r && !i.target) return this.style.queryRenderedFeatures(t1, i, this.transform); 53596 } 53597 let o = []; 53598 return r && (o = o.concat(this.style.queryRenderedFeatures(t1, i, this.transform))), s && (o = o.concat(this.style.queryRenderedFeatureset(t1, i, this.transform))), o; 53599 } 53600 querySourceFeatures(e1, t1) { 53601 return !e1 || "string" == typeof e1 && !this._isValidId(e1) ? [] : this.style.querySourceFeatures(e1, t1); 53602 } 53603 queryRasterValue(e1, t1, i) { 53604 return this._isValidId(e1) ? this.style.queryRasterValue(e1, t1, i) : Promise.resolve(null); 53605 } 53606 isPointOnSurface(t1) { 53607 const { name: i } = this.transform.projection; 53608 return "globe" !== i && "mercator" !== i && e1.w("".concat(i, " projection does not support isPointOnSurface, this API may behave unex
53608pectedly.")), this.transform.isPointOnSurface(e1.P.convert(t1)); 53609 } 53610 addInteraction(e1, t1) { 53611 return this._interactions.add(e1, t1), this; 53612 } 53613 removeInteraction(e1) { 53614 return this._interactions.remove(e1), this; 53615 } 53616 getCooperativeGestures() { 53617 return this._cooperativeGestures; 53618 } 53619 setCooperativeGestures(e1) { 53620 return this._cooperativeGestures = e1, this; 53621 } 53622 setStyle(t1, i) { 53623 return i = { 53624 localIdeographFontFamily: this._localIdeographFontFamily, 53625 localFontFamily: this._localFontFamily, 53626 fontstackCompositing: this._fontstackCompositing, 53627 ...i 53628 }, this.style && t1 && !1 !== i.diff && i.localFontFamily === this._localFontFamily && i.localIdeographFontFamily === this._localIdeographFontFamily && i.fontstackCompositing === this._fontstackCompositing && !i.config ? (this.style._diffStyle(t1, (s, r)=>{ 53629 if (s) { 53630 const r = "string" == typeof s ? s : s instanceof Error ? s.message : s.error; 53631 e1.w("Unable to perform style diff: ".concat(r, ". Rebuilding the style from scratch.")), this._updateStyle(t1, i); 53632 } else r && this._update(!0); 53633 }, ()=>this._postStyleLoadEvent()), this) : (this._localIdeographFontFamily = i.localIdeographFontFamily, this._localFontFamily = i.localFontFamily, this._fontstackCompositing = i.fontstackCompositing, this._updateStyle(t1, i)); 53634 } 53635 _getUIString(e1) { 53636 const t1 = this._locale[e1]; 53637 if (null == t1) throw new Error("Missing UI string '".concat(e1, "'")); 53638 return t1; 53639 } 53640 _updateStyle(e1, t1) { 53641 if (this.style && (this.style.setEventedParent(null), this.style._remove(), this.style = void 0), e1) { 53642 const i = { 53643 ...t1 53644 }; 53645 t1 && t1.config && (i.initialConfig = t1.config, delete i.config), this.style = new qn(this, i).load(e1), this.style.setEventedParent(this, { 53646 style: this.style 53647 }); 53648 } 53649 return this._updateTerrain(), this; 53650 } 53651 _lazyInitEmptyStyle() { 53652 this.style || (this.style = new qn(this, {}), this.style.setEventedParent(this, { 53653 style: this.style 53654 }), this.style.loadEmpty()); 53655 } 53656 getStyle() { 53657 if (this.style) return this.style.serialize(); 53658 } 53659 isStyleLoaded() { 53660 return this.style ? this.style.loaded() : (e1.w("There is no style added to the map."), !1); 53661 } 53662 _isValidId(t1) { 53663 return null == t1 ? (this.fire(new e1.f(new Error("IDs can't be empty."))), !1) : e1.dF(t1) ? (this.fire(new e1.f(new Error("IDs can't contain special symbols: \"".concat(t1, '".')))), !1) : "__proto__" !== t1 && "constructor" !== t1 && "prototype" !== t1 || (this.fire(new e1.f(new Error("IDs can't be \"".concat(t1, '".')))), !1); 53664 } 53665 _isTargetValid(e1) { 53666 return "featuresetId" in e1 ? this._isValidId("importId" in e1 ? e1.importId : e1.featuresetId) : "layerId" in e1 && this._isValidId(e1.layerId); 53667 } 53668 _areTargetsValid(e1) { 53669 if (Array.isArray(e1)) { 53670 for (const t1 of e1)if (!this._isValidId(t1)) return !1; 53671 return !0; 53672 } 53673 return this._isTargetValid(e1); 53674 } 53675 addSource(e1, t1) { 53676 return this._isValidId(e1) ? (this._lazyInitEmptyStyle(), this.style.addSource(e1, t1), this._update(!0)) : this; 53677 } 53678 isSourceLoaded(e1) { 53679 return !!this._isValidId(e1) && !!this.style && this.style._isSourceCacheLoaded(e1); 53680 } 53681 areTilesLoaded() { 53682 return this.style.areTilesLoaded(); 53683 } 53684 removeSource(e1) { 53685 return this._isValidId(e1) ? (this.style.removeSource(e1), this._updateTerrain(), this._update(!0)) : this; 53686 } 53687 getSource(e1) { 53688 return this._isValidId(e1) ? this.style.getOwnSource(e1) : null; 53689 } 53690 addImage(t1, i) { 53691 let { pixelRatio: s = 1, sdf: r = !1, stretchX: o, stretchY: n, content: a } = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 53692 this._lazyInitEmptyStyle(); 53693 const l = e1.I.from(t1); 53694 if (i instanceof HTMLImageElement || ImageBitmap && i instanceof ImageBitmap) { 53695 const { width: t1, height: c, data: h } = e1.e.getImageData(i); 53696 this.style.addImage(l, { 53697 data: new e1.b({ 53698 width: t1, 53699 height: c 53700 }, h), 53701 pixelRatio: s, 53702 stretchX: o, 53703 stretchY: n, 53704 content: a, 53705 sdf: r, 53706 version: 0, 53707 usvg: !1 53708 }); 53709 } else if (void 0 === i.width || void 0 === i.height) this.fire(new e1.f(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))); 53710 else { 53711 const { width: c, height: h } = i, d = i; 53712 this.style.addImage(l, { 53713 data: new e1.b({ 53714 width: c, 53715 height: h 53716 }, new Uint8Array(d.data)), 53717 pixelRatio: s, 53718 stretchX: o, 53719 stretchY: n, 53720 content: a, 53721 sdf: r, 53722 usvg: !1, 53723 version: 0, 53724 userImage: d 53725 }), d.onAdd && d.onAdd(this, t1); 53726 } 53727 } 53728 updateImage(t1, i) { 53729 this._lazyInitEmptyStyle(); 53730 const s = e1.I.from(t1), r = this.style.getImage(s); 53731 if (!r) return void this.fire(new e1.f(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead."))); 53732 const o = i instanceof HTMLImageElement || ImageBitmap && i instanceof ImageBitmap ? e1.e.getImageData(i) : i, { width: n, height: a, data: l } = o; 53733 if (void 0 === n || void 0 === a) return void this.fire(new e1.f(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))); 53734 if (n !== (r.usvg ? r.icon.usvg_tree.width : r.data.width) || a !== (r.usvg ? r.icon.usvg_tree.height : r.data.height)) return void this.fire(new e1.f(new Error("The width and height of the updated image (".concat(n, ", ").concat(a, ")\n must be that same as the previous version of the image\n (").concat(r.data.width, ", ").concat(r.data.height, ")")))); 53735 const c = !(i instanceof HTMLImageElement || ImageBitmap && i instanceof ImageBitmap); 53736 let h = !1; 53737 r.usvg ? (r.data = new e1.b({ 53738 width: n, 53739 height: a 53740 }, new Uint8Array(l)), r.usvg = !1, r.icon = void 0, h = !0) : r.data.replace(l, c), this.style.updateImage(s, r, h); 53741 } 53742 hasImage(t1) { 53743 return t1 ? !!this.style && !!this.style.getImage(e1.I.from(t1)) : (this.fire(new e1.f(new Error("Missing required image id"))), !1); 53744 } 53745 removeImage(t1) { 53746 this.style.removeImage(e1.I.from(t1)); 53747 } 53748 loadImage(t1, i) { 53749 (async ()=>{ 53750 const i = await this._requestManager.transformRequest(t1, e1.R.Image), { data: s } = await e1.a(i); 53751 return s; 53752 })().then((e1)=>i(null, e1)).catch(i); 53753 } 53754 listImages() { 53755 return this.style.listImages().map((e1)=>e1.name); 53756 } 53757 addModel(e1, t1) { 53758 this._lazyInitEmptyStyle(), this.style.addModel(e1, t1); 53759 } 53760 hasModel(t1) { 53761 return t1 ? this.style.hasModel(t1) : (this.fire(new e1.f(new Error("Missing required model id"))), !1); 53762 } 53763 removeModel(e1) { 53764 this.style.removeModel(e1); 53765 } 53766 listModels() { 53767 return this.style.listModels(); 53768 } 53769 addLayer(e1, t1) { 53770 return this._isValidId(e1.id) ? (this._lazyInitEmptyStyle(), this.style.addLayer(e1, t1), this._update(!0)) : this; 53771 } 53772 getSlot(e1) { 53773 const t1 = this.getLayer(e1); 53774 return t1 && t1.slot || null; 53775 } 53776 setSlot(e1, t1) { 53777 return this.style.setSlot(e1, t1), this.style.mergeLayers(), this._update(!0); 53778 } 53779 addImport(t1, i) { 53780 return this._isValidId(t1.id) ? (this.style.addImport(t1, i).catch((t1)=>this.fire(new e1.f(new Error("Failed to add import", t1)))), this) : this; 53781 } 53782 updateImport(e1, t1) { 53783 return "string" != typeof t1 && t1.id !== e1 ? (this.removeImport(e1), this.addImport(t1)) : (this.style.updateImport(e1, t1), this._update(!0)); 53784 } 53785 removeImport(e1) { 53786 return this.style.removeImport(e1), this; 53787 } 53788 moveImport(e1, t1) { 53789 return this.style.moveImport(e1, t1), this._update(!0); 53790 } 53791 moveLayer(e1, t1) { 53792 return this._isValidId(e1) ? (this.style.moveLayer(e1, t1), this._update(!0)) : this; 53793 } 53794 removeLayer(e1) { 53795 return this._isValidId(e1) ? (this.style.removeLayer(e1), this._update(!0)) : this; 53796 } 53797 getLayer(e1) { 53798 if (!this._isValidId(e1)) return null; 53799 const t1 = this.style.getOwnLayer(e1); 53800 return t1 ? "custom" === t1.type ? t1.implementation : t1.serialize() : void 0; 53801 } 53802 getSlots() { 53803 return this.style.getSlots(); 53804 } 53805 setLayerZoomRange(e1, t1, i) { 53806 return this._isValidId(e1) ? (this.style.setLayerZoomRange(e1, t1, i), this._update(!0)) : this; 53807 } 53808 setFilter(e1, t1) { 53809 let i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; 53810 return this._isValidId(e1) ? (this.style.setFilter(e1, t1, i), this._update(!0)) : this; 53811 } 53812 getFilter(e1) { 53813 return this._isValidId(e1) ? this.style.getFilter(e1) : null; 53814 } 53815 setPaintProperty(e1, t1, i) { 53816 let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; 53817 return this._isValidId(e1) ? (this.style.setPaintProperty(e1, t1, i, s), this._update(!0)) : this; 53818 } 53819 getPaintProperty(e1, t1) { 53820 return this._isValidId(e1) ? this.style.getPaintProperty(e1, t1) : null; 53821 } 53822 setLayoutProperty(e1, t1, i) { 53823 let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; 53824 return this._isValidId(e1) ? (this.style.setLayoutProperty(e1, t1, i, s), this._update(!0)) : this; 53825 } 53826 getLayoutProperty(e1, t1) { 53827 return this._isValidId(e1) ? this.style.getLayoutProperty(e1, t1) : null; 53828 } 53829 getLayerProperty(e1, t1) { 53830 return this._isValidId(e1) ? this.style.getLayerProperty(e1, t1) : null; 53831 } 53832 setLayerProperty(e1, t1, i) { 53833 let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; 53834 return this._isValidId(e1) ? ("appearances" === t1 && this._postAddingAppearancesToStyleEvent(), this.style.setLayerProperty(e1, t1, i, s), this._update(!0)) : this; 53835 } 53836 getGlyphsUrl() { 53837 return this.style.getGlyphsUrl(); 53838 } 53839 setGlyphsUrl(e1) { 53840 return this.style.setGlyphsUrl(e1), this._update(!0); 53841 } 53842 getSchema(e1) { 53843 return this.style.getSchema(e1); 53844 } 53845 setSchema(e1, t1) { 53846 return this.style.setSchema(e1, t1), this._update(!0); 53847 } 53848 getConfig(e1) { 53849 return this.style.getConfig(e1); 53850 } 53851 setConfig(e1, t1) { 53852 return this.style.setConfig(e1, t1), this._update(!0); 53853 } 53854 getConfigProperty(e1, t1) { 53855 return this.style.getConfigProperty(e1, t1); 53856 } 53857 setConfigProperty(e1, t1, i) { 53858 return this.style.setConfigProperty(e1, t1, i), this._update(!0); 53859 } 53860 getFeaturesetDescriptors(e1) { 53861 return this.style.getFeaturesetDescriptors(e1); 53862 } 53863 setLights(e1) { 53864 if (this._lazyInitEmptyStyle(), e1 && 1 === e1.length && "flat" === e1[0].type) { 53865 const t1 = e1[0]; 53866 t1.properties ? this.style.setFlatLight(t1.properties, t1.id, {}) : this.style.setFlatLight({}, "flat"); 53867 } else this.style.setLights(e1), this.painter.terrain && (this.painter.terrain.invalidateRenderCache = !0); 53868 return this._update(!0); 53869 } 53870 getLights() { 53871 const e1 = this.style.getLights() || []; 53872 return 0 === e1.length && e1.push({ 53873 id: this.style.light.id, 53874 type: "flat", 53875 properties: this.style.getFlatLight() 53876 }), e1; 53877 } 53878 setLight(e1) { 53879 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
53880 return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."), this.setLights([ 53881 { 53882 id: "flat", 53883 type: "flat", 53884 properties: e1 53885 } 53886 ]); 53887 } 53888 getLight() { 53889 return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."), this.style.getFlatLight(); 53890 } 53891 setTerrain(e1) { 53892 return this._lazyInitEmptyStyle(), !e1 && this.transform.projection.requiresDraping ? this.style.setTerrainForDraping() : this.style.setTerrain(e1), this._averageElevationLastSampledAt = -1 / 0, this._update(!0); 53893 } 53894 getTerrain() { 53895 return this.style ? this.style.getTerrain() : null; 53896 } 53897 setFog(e1) { 53898 return this._lazyInitEmptyStyle(), this.style.setFog(e1), this._update(!0); 53899 } 53900 getFog() { 53901 return this.style ? this.style.getFog() : null; 53902 } 53903 setSnow(e1) { 53904 return this._lazyInitEmptyStyle(), this.style.setSnow(e1), this._update(!0); 53905 } 53906 getSnow() { 53907 return this.style ? this.style.getSnow() : null; 53908 } 53909 setRain(e1) { 53910 return this._lazyInitEmptyStyle(), this.style.setRain(e1), this._update(!0); 53911 } 53912 getRain() { 53913 return this.style ? this.style.getRain() : null; 53914 } 53915 setColorTheme(e1) { 53916 return this._lazyInitEmptyStyle(), this.style.setColorTheme(e1), this._update(!0); 53917 } 53918 setImportColorTheme(e1, t1) { 53919 return this._lazyInitEmptyStyle(), this.style.setImportColorTheme(e1, t1), this._update(!0); 53920 } 53921 setCamera(e1) { 53922 return this.style.setCamera(e1), this._triggerCameraUpdate(e1); 53923 } 53924 getNearClipOffset() { 53925 return this.transform.nearClipOffset; 53926 } 53927 setNearClipOffset(e1) { 53928 const t1 = this.transform.nearClipOffset !== e1; 53929 return this.transform.nearClipOffset = e1, this._update(t1); 53930 } 53931 _triggerCameraUpdate(e1) { 53932 return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic" === e1["camera-projection"])); 53933 } 53934 getCamera() { 53935 return this.style.camera; 53936 } 53937 _queryFogOpacity(t1) { 53938 return this.style && this.style.fog ? this.style.fog.getOpacityAtLatLng(e1.c_.convert(t1), this.transform) : 0; 53939 } 53940 setFeatureState(e1, t1) { 53941 return e1.source && !this._isValidId(e1.source) ? this : (this.style.setFeatureState(e1, t1), this._update()); 53942 } 53943 removeFeatureState(e1, t1) { 53944 return e1.source && !this._isValidId(e1.source) ? this : (this.style.removeFeatureState(e1, t1), this._update()); 53945 } 53946 getFeatureState(e1) { 53947 return e1.source && !this._isValidId(e1.source) ? null : this.style.getFeatureState(e1); 53948 } 53949 resetFeatureStates(e1) { 53950 return this.style.resetFeatureStates(e1), this._update(); 53951 } 53952 _selectIndoorFloor(e1) { 53953 this.style.indoorManager && this.style.indoorManager.selectFloor(e1); 53954 } 53955 _setIndoorActiveFloorsVisibility(e1) { 53956 this.style.indoorManager && this.style.indoorManager.setActiveFloorsVisibility(e1); 53957 } 53958 getIndoorTileOptions(e1, t1) { 53959 return this.style && this.style.isIndoorEnabled() && this.style.indoorManager ? this.style.indoorManager.getIndoorTileOptions(e1, t1) : null; 53960 } 53961 _updateContainerDimensions() { 53962 if (!this._container) return; 53963 const e1 = this._container.getBoundingClientRect().width || 400, t1 = this._container.getBoundingClientRect().height || 300; 53964 let i, s, r, o = this._container; 53965 for(; o && (!s || !r);){ 53966 const e1 = window.getComputedStyle(o).transform;
vendor: 30,124 bytes, lines 53967-54385
53967 e1 && "none" !== e1 && (i = e1.match(Ql)[1].split(", "), i[0] && "0" !== i[0] && "1" !== i[0] && (s = i[0]), i[3] && "0" !== i[3] && "1" !== i[3] && (r = i[3])), o = o.parentElement; 53968 } 53969 this._containerWidth = s ? Math.abs(e1 / s) : e1, this._containerHeight = r ? Math.abs(t1 / r) : t1; 53970 } 53971 _detectMissingCSS() { 53972 "rgb(250, 128, 114)" !== window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color") && e1.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/."); 53973 } 53974 _setupContainer() { 53975 const e1 = this._container; 53976 e1.classList.add("mapboxgl-map"), (this._missingCSSCanary = a("div", "mapboxgl-canary", e1)).style.visibility = "hidden", this._detectMissingCSS(); 53977 const t1 = this._canvasContainer = a("div", "mapboxgl-canvas-container", e1); 53978 this._canvas = a("canvas", "mapboxgl-canvas", t1), this._interactive && (t1.classList.add("mapboxgl-interactive"), this._canvas.setAttribute("tabindex", "0")), this._canvas.addEventListener("webglcontextlost", this._contextLost, !1), this._canvas.addEventListener("webglcontextrestored", this._contextRestored, !1), this._canvas.setAttribute("aria-label", this._getUIString("Map.Title")), this._canvas.setAttribute("role", "region"), this._updateContainerDimensions(), this._resizeCanvas(this._containerWidth, this._containerHeight); 53979 const i = this._controlContainer = a("div", "mapboxgl-control-container", e1), s = this._controlPositions = {}; 53980 [ 53981 "top-left", 53982 "top", 53983 "top-right", 53984 "right", 53985 "bottom-right", 53986 "bottom", 53987 "bottom-left", 53988 "left" 53989 ].forEach((e1)=>{ 53990 s[e1] = a("div", "mapboxgl-ctrl-".concat(e1), i); 53991 }), this._container.addEventListener("scroll", this._onMapScroll, !1); 53992 } 53993 _resizeCanvas(t1, i) { 53994 const s = e1.e.devicePixelRatio || 1; 53995 this._canvas.width = s * Math.ceil(t1), this._canvas.height = s * Math.ceil(i), this._canvas.style.width = "".concat(t1, "px"), this._canvas.style.height = "".concat(i, "px"); 53996 } 53997 _addMarker(e1) { 53998 this._markers.push(e1); 53999 } 54000 _removeMarker(e1) { 54001 const t1 = this._markers.indexOf(e1); 54002 -1 !== t1 && this._markers.splice(t1, 1); 54003 } 54004 _addPopup(e1) { 54005 this._popups.push(e1); 54006 } 54007 _removePopup(e1) { 54008 const t1 = this._popups.indexOf(e1); 54009 -1 !== t1 && this._popups.splice(t1, 1); 54010 } 54011 _setupPainter() { 54012 const i = { 54013 ...t1, 54014 failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, 54015 preserveDrawingBuffer: this._preserveDrawingBuffer, 54016 antialias: this._antialias || !1 54017 }, s = this._canvas.getContext("webgl2", i); 54018 s ? (e1.eS(s, !0), this.painter = new Ba(s, this._contextCreateOptions, this.transform, this._scaleFactor, this._worldview), this.on("data", (e1)=>{ 54019 if ("source" === e1.dataType) { 54020 const t1 = this.transform.elevation ? this.transform.elevation._source() : null; 54021 t1 && e1.sourceCacheId === t1.id && this.style && this.style._setLabelPlacementStale(), this.style && e1.sourceCacheId && this.style._buildingIndex.hasLayerForSourceCache(e1.sourceCacheId) && this.style._requestFullLabelPlacement(), this.painter.setTileLoadedFlag(!0); 54022 } 54023 })) : this.fire(new e1.f(new Error("Failed to initialize WebGL"))); 54024 } 54025 _contextLost(t1) { 54026 t1.preventDefault(), this._frame && (this._frame.cancel(), this._frame = null), this.style && this.style.handleContextLost(), this.fire(new e1.h("webglcontextlost", { 54027 originalEvent: t1 54028 })); 54029 } 54030 _contextRestored(t1) { 54031 this._setupPainter(), this.painter.resize(Math.ceil(this._containerWidth), Math.ceil(this._containerHeight)), this._updateTerrain(), this.style && (this.style.clearLayers(), this.style.imageManager.destroyAtlasTextures(), this.style.imageManager.imageAtlasCache.destroyTextures(), this.style.reloadModels(), this.style.clearSources()), this._update(), this.fire(new e1.h("webglcontextrestored", { 54032 originalEvent: t1 54033 })); 54034 } 54035 _onMapScroll(e1) { 54036 if (e1.target === this._container) return this._container.scrollTop = 0, this._container.scrollLeft = 0, !1; 54037 } 54038 idle() { 54039 return !this.isMoving() && this.loaded(); 54040 } 54041 loaded() { 54042 return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded(); 54043 } 54044 frameReady() { 54045 return this.loaded() && !this._placementDirty; 54046 } 54047 _update(e1) { 54048 return this.style ? (this._styleDirty = this._styleDirty || e1, this._sourcesDirty = !0, this.triggerRepaint(), this) : this; 54049 } 54050 _requestRenderFrame(e1) { 54051 return this._update(), this._renderTaskQueue.add(e1); 54052 } 54053 _cancelRenderFrame(e1) { 54054 this._renderTaskQueue.remove(e1); 54055 } 54056 _requestDomTask(e1) { 54057 !this.loaded() || this.loaded() && !this.isMoving() ? e1() : this._domRenderTaskQueue.add(e1); 54058 } 54059 _render(t1) { 54060 let i; 54061 this.fire(new e1.h("renderstart")), ++this._frameId; 54062 const s = this.painter.context.extTimerQuery, r = e1.e.now(), o = this.painter.context.gl; 54063 if (this.listens("gpu-timing-frame") && (i = o.createQuery(), o.beginQuery(s.TIME_ELAPSED_EXT, i)), this.painter.context.setDirty(), this.painter.setBaseState(), (this.isMoving() || this.isRotating() || this.isZooming()) && (this._interactionRange[0] = Math.min(this._interactionRange[0], performance.now()), this._interactionRange[1] = Math.max(this._interactionRange[1], performance.now())), this._renderTaskQueue.run(t1), this._domRenderTaskQueue.run(t1), this._removed) return; 54064 this._updateProjectionTransition(); 54065 const n = this._isInitialLoad ? 0 : this._fadeDuration; 54066 if (this.style && this._styleDirty) { 54067 this._styleDirty = !1; 54068 const t1 = this.transform.zoom, i = this.transform.pitch, s = e1.e.now(), r = new e1.ai(t1, { 54069 now: s, 54070 fadeDuration: n, 54071 pitch: i, 54072 transition: this._loaded ? this.style.transition : { 54073 duration: 0, 54074 delay: 0 54075 }, 54076 worldview: this._worldview 54077 }); 54078 this.style.update(r); 54079 } 54080 this.style && this.style.hasFogTransition() && (this.style._markersNeedUpdate = !0, this._sourcesDirty = !0); 54081 let a = !1; 54082 if (this.style && this._sourcesDirty ? (this._sourcesDirty = !1, this.painter._updateFog(this.style), this._updateTerrain(), a = this._updateAverageElevation(r), this.style.updateSources(this.transform), this.style.updateImageProviders(), this.isMoving() || this._forceMarkerAndPopupUpdate()) : a = this._updateAverageElevation(r), this.style && (this._placementDirty = this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, n, this._crossSourceCollisions, this.painter.replacementSource, this._placementAlgorithm)), this.style && this.painter.render(this.style, { 54083 showTileBoundaries: this.showTileBoundaries, 54084 showParseStatus: this.showParseStatus, 54085 wireframe: { 54086 terrain: this.showTerrainWireframe, 54087 layers2D: this.showLayers2DWireframe, 54088 layers3D: this.showLayers3DWireframe 54089 }, 54090 showOverdrawInspector: this._showOverdrawInspector, 54091 showQueryGeometry: !!this._showQueryGeometry, 54092 showTileAABBs: this.showTileAABBs, 54093 rotating: this.isRotating(), 54094 zooming: this.isZooming(), 54095 moving: this.isMoving(), 54096 fadeDuration: n, 54097 isInitialLoad: this._isInitialLoad, 54098 showPadding: this.showPadding, 54099 gpuTiming: !!this.listens("gpu-timing-layer"), 54100 gpuTimingDeferredRender: !!this.listens("gpu-timing-deferred-render"), 54101 speedIndexTiming: this.speedIndexTiming, 54102 paintStartTimeStamp: t1 54103 }), this.fire(new e1.h("render")), this.loaded() && !this._loaded && (this._loaded = !0, e1.eN.mark(e1.eO.load), this.fire(new e1.h("load"))), this.style && this.style.hasTransitions() && (this._styleDirty = !0), this.style && (this.style.snow || this.style.rain) && (this._styleDirty = !0), this.style && this.style.imageManager.hasPatternsInFlight() && (this._styleDirty = !0), this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles(), i) { 54104 const t1 = e1.e.now() - r; 54105 o.endQuery(s.TIME_ELAPSED_EXT), setTimeout(()=>{ 54106 const s = o.getQueryParameter(i, o.QUERY_RESULT) / 1e6; 54107 o.deleteQuery(i), this.fire(new e1.h("gpu-timing-frame", { 54108 cpuTime: t1, 54109 gpuTime: s 54110 })); 54111 }, 50); 54112 } 54113 if (this.listens("gpu-timing-layer")) { 54114 const t1 = this.painter.collectGpuTimers(); 54115 setTimeout(()=>{ 54116 const i = this.painter.queryGpuTimers(t1); 54117 this.fire(new e1.h("gpu-timing-layer", { 54118 layerTimes: i 54119 })); 54120 }, 50); 54121 } 54122 if (this.listens("gpu-timing-deferred-render")) { 54123 const t1 = this.painter.collectDeferredRenderGpuQueries(); 54124 setTimeout(()=>{ 54125 const i = this.painter.queryGpuTimeDeferredRender(t1); 54126 this.fire(new e1.h("gpu-timing-deferred-render", { 54127 gpuTime: i 54128 })); 54129 }, 50); 54130 } 54131 const l = this._sourcesDirty || this._styleDirty || this._placementDirty || a; 54132 if (l || this._repaint) this.triggerRepaint(); 54133 else { 54134 const t1 = this.idle(); 54135 if (t1 && (a = this._updateAverageElevation(r, !0)), a) this.triggerRepaint(); 54136 else { 54137 if (this._triggerFrame(!1), t1 && (this.fire(new e1.h("idle")), this._isInitialLoad = !1, this.speedIndexTiming)) { 54138 const t1 = this._calculateSpeedIndex(); 54139 this.fire(new e1.h("speedindexcompleted", { 54140 speedIndex: t1 54141 })), this.speedIndexTiming = !1; 54142 } 54143 t1 && this.style && this.style.handleIdle(); 54144 } 54145 } 54146 !this._loaded || this._fullyLoaded || l || (this._fullyLoaded = !0, e1.eN.mark(e1.eO.fullLoad), this._performanceMetricsCollection && e1.eT(this._requestManager._customAccessToken, { 54147 width: this.painter.width, 54148 height: this.painter.height, 54149 interactionRange: this._interactionRange, 54150 visibilityHidden: this._visibilityHidden, 54151 terrainEnabled: this.painter.style.hasTerrain(), 54152 fogEnabled: !!this.painter.style.getFog(), 54153 projection: this.getProjection().name, 54154 zoom: this.transform.zoom, 54155 renderer: this.painter.context.renderer, 54156 vendor: this.painter.context.vendor 54157 }), this._authenticate()); 54158 } 54159 _forceMarkerAndPopupUpdate(e1) { 54160 for (const t1 of this._markers)e1 && !this.getRenderWorldCopies() && (t1._lngLat = t1._lngLat.wrap()), t1._update(); 54161 for (const t1 of this._popups)!e1 || this.getRenderWorldCopies() || t1._trackPointer || (t1._lngLat = t1._lngLat.wrap()), t1._update(); 54162 } 54163 _updateAverageElevation(e1) { 54164 let t1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1; 54165 const i = (e1)=>(this.transform.averageElevation = e1, this._update(!1), !0); 54166 if (!this.painter.averageElevationNeedsEasing()) return 0 !== this.transform.averageElevation && i(0); 54167 const s = this.transform.elevation && this.transform.elevation.exaggeration() !== this._averageElevationExaggeration; 54168 if (s || (t1 || e1 - this._averageElevationLastSampledAt > 500) && !this._averageElevation.isEasing(e1)) { 54169 const t1 = this.transform.averageElevation; 54170 let r = this.transform.sampleAverageElevation(); 54171 null != this.transform.elevation && (this._averageElevationExaggeration = this.transform.elevation.exaggeration()), isNaN(r) ? r = 0 : this._averageElevationLastSampledAt = e1; 54172 const o = Math.abs(t1 - r); 54173 if (o > 1) { 54174 if (this._isInitialLoad || s) return this._averageElevation.jumpTo(r), i(r); 54175 this._averageElevation.easeTo(r, e1, 300); 54176 } else if (o > 1e-4) return this._averageElevation.jumpTo(r), i(r); 54177 } 54178 return !!this._averageElevation.isEasing(e1) && i(this._averageElevation.getValue(e1)); 54179 } 54180 _isTokenExpired() { 54181 return null != this._tokenExpiration && Date.now() > this._tokenExpiration; 54182 } 54183 _revokeAuth() { 54184 const t1 = this.painter.context.gl; 54185 e1.eS(t1, !1), this._logoControl instanceof Zl && this._logoControl._updateLogo(), t1 && t1.clear(t1.DEPTH_BUFFER_BIT | t1.COLOR_BUFFER_BIT | t1.STENCIL_BUFFER_BIT), this._silenceAuthErrors || this.fire(new e1.f(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/"))); 54186 } 54187 _authenticate() { 54188 e1.eU(this._getMapId(), this._requestManager._skuToken, this._requestManager._customAccessToken, (t1)=>{ 54189 t1 && (t1.message !== e1.eV && 401 !== t1.status || this._revokeAuth()); 54190 }), this._isTokenExpired() && this._revokeAuth(), e1.eW(this._getMapId(), this._requestManager._skuToken, this._requestManager._customAccessToken, ()=>{}); 54191 } 54192 _postStyleLoadEvent() { 54193 this.style.globalId && e1.eX(this._requestManager._customAccessToken, { 54194 map: this, 54195 style: this.style.globalId, 54196 importedStyles: this.style.getImportGlobalIds() 54197 }); 54198 } 54199 _postStyleWithAppearanceEvent() { 54200 this.style.globalId && this.style.hasAppearances() && e1.eY(this._requestManager._customAccessToken); 54201 } 54202 _postAddingAppearancesToStyleEvent() { 54203 e1.eZ(this._requestManager._customAccessToken); 54204 } 54205 _updateTerrain() { 54206 const e1 = this._isDragging(); 54207 this.painter.updateTerrain(this.style, e1); 54208 } 54209 _calculateSpeedIndex() { 54210 const e1 = this.painter.canvasCopy(), t1 = this.painter.getCanvasCopiesAndTimestamps(); 54211 t1.timeStamps.push(performance.now()); 54212 const i = this.painter.context.gl, s = i.createFramebuffer(); 54213 function r(e1) { 54214 i.framebufferTexture2D(i.FRAMEBUFFER, i.COLOR_ATTACHMENT0, i.TEXTURE_2D, e1, 0); 54215 const t1 = new Uint8Array(i.drawingBufferWidth * i.drawingBufferHeight * 4); 54216 return i.readPixels(0, 0, i.drawingBufferWidth, i.drawingBufferHeight, i.RGBA, i.UNSIGNED_BYTE, t1), t1; 54217 } 54218 return i.bindFramebuffer(i.FRAMEBUFFER, s), this._canvasPixelComparison(r(e1), t1.canvasCopies.map(r), t1.timeStamps); 54219 } 54220 _canvasPixelComparison(e1, t1, i) { 54221 let s = i[1] - i[0]; 54222 const r = e1.length / 4; 54223 for(let o = 0; o < t1.length; o++){ 54224 const n = t1[o]; 54225 let a = 0; 54226 for(let t1 = 0; t1 < n.length; t1 += 4)n[t1] === e1[t1] && n[t1 + 1] === e1[t1 + 1] && n[t1 + 2] === e1[t1 + 2] && n[t1 + 3] === e1[t1 + 3] && (a += 1); 54227 s += (i[o + 2] - i[o + 1]) * (1 - a / r); 54228 } 54229 return s; 54230 } 54231 remove() { 54232 if (this._removed) return; 54233 this._hash && this._hash.remove(); 54234 for (const e1 of this._controls)e1.onRemove(this); 54235 this._controls = [], this._frame && (this._frame.cancel(), this._frame = null), this._renderTaskQueue.clear(), this._domRenderTaskQueue.clear(), this.style && this.style.destroy(), this.painter.destroy(), this.handlers && this.handlers.destroy(), this.handlers = void 0, this.setStyle(null), window.removeEventListener("resize", this._onWindowResize, !1), window.removeEventListener("orientationchange", this._onWindowResize, !1), window.removeEventListener(this._fullscreenchangeEvent, this._onWindowResize, !1), window.removeEventListener("online", this._onWindowOnline, !1), window.removeEventListener("visibilitychange", this._onVisibilityChange, !1); 54236 const t1 = this.painter.context.gl.getExtension("WEBGL_lose_context"); 54237 t1 && t1.loseContext(), this._canvas.removeEventListener("webglcontextlost", this._contextLost, !1), this._canvas.removeEventListener("webglcontextrestored", this._contextRestored, !1), this._canvasContainer.remove(), this._controlContainer.remove(), this._missingCSSCanary.remove(), this._canvas = void 0, this._canvasContainer = void 0, this._controlContainer = void 0, this._missingCSSCanary = void 0, this._container.classList.remove("mapboxgl-map"), this._container.removeEventListener("scroll", this._onMapScroll, !1), e1.e_(this.painter.context.gl), e1.e$.remove(), e1.f0.remove(), this._removed = !0, this.fire(new e1.h("remove")); 54238 } 54239 triggerRepaint() { 54240 this._triggerFrame(!0); 54241 } 54242 _triggerFrame(t1) { 54243 this._renderNextFrame = this._renderNextFrame || t1, this.style && !this._frame && (this._frame = e1.e.frame((e1)=>{ 54244 const t1 = !!this._renderNextFrame; 54245 this._frame = null, this._renderNextFrame = null, t1 && this._render(e1); 54246 })); 54247 } 54248 _preloadTiles(t1) { 54249 const i = this.style ? this.style.getSourceCaches() : []; 54250 return e1.bT(i, (e1, i)=>e1._preloadTiles(t1, i), ()=>{ 54251 this.triggerRepaint(); 54252 }), this; 54253 } 54254 _onWindowOnline() { 54255 this._update(); 54256 } 54257 _onWindowResize(e1) { 54258 this._trackResize && this.resize({ 54259 originalEvent: e1 54260 })._update(); 54261 } 54262 _onVisibilityChange() { 54263 "hidden" === document.visibilityState && this._visibilityHidden++; 54264 } 54265 get showTileBoundaries() { 54266 return !!this._showTileBoundaries; 54267 } 54268 set showTileBoundaries(e1) { 54269 this._showTileBoundaries !== e1 && (this._showTileBoundaries = e1, e1 && wt(), this._update()); 54270 } 54271 get showParseStatus() { 54272 return !!this._showParseStatus; 54273 } 54274 set showParseStatus(e1) { 54275 this._showParseStatus !== e1 && (this._showParseStatus = e1, this._update()); 54276 } 54277 get showTerrainWireframe() { 54278 return !!this._showTerrainWireframe; 54279 } 54280 set showTerrainWireframe(e1) { 54281 this._showTerrainWireframe !== e1 && (this._showTerrainWireframe = e1, this._update()); 54282 } 54283 get showLayers2DWireframe() { 54284 return !!this._showLayers2DWireframe; 54285 } 54286 set showLayers2DWireframe(e1) { 54287 this._showLayers2DWireframe !== e1 && (this._showLayers2DWireframe = e1, this._update()); 54288 } 54289 get showLayers3DWireframe() { 54290 return !!this._showLayers3DWireframe; 54291 } 54292 set showLayers3DWireframe(e1) { 54293 this._showLayers3DWireframe !== e1 && (this._showLayers3DWireframe = e1, this._update()); 54294 } 54295 get showElevationIdDebug() { 54296 return !!this.painter && this.painter._debugParams.showElevationIdDebug; 54297 } 54298 set showElevationIdDebug(e1) { 54299 this.painter && this.painter._debugParams.showElevationIdDebug !== e1 && (this.painter._debugParams.showElevationIdDebug = e1, this.style && e1 ? this.style._reloadSources() : this._update()); 54300 } 54301 get speedIndexTiming() { 54302 return !!this._speedIndexTiming; 54303 } 54304 set speedIndexTiming(e1) { 54305 this._speedIndexTiming !== e1 && (this._speedIndexTiming = e1, this._update()); 54306 } 54307 get showPadding() { 54308 return !!this._showPadding; 54309 } 54310 set showPadding(e1) { 54311 this._showPadding !== e1 && (this._showPadding = e1, e1 && wt(), this._update()); 54312 } 54313 get showCollisionBoxes() { 54314 return !!this._showCollisionBoxes; 54315 } 54316 set showCollisionBoxes(e1) { 54317 this._showCollisionBoxes !== e1 && (this._showCollisionBoxes = e1, e1 && wt(), this.style && e1 ? this.style._reloadSources() : this._update()); 54318 } 54319 get showOverdrawInspector() { 54320 return !!this._showOverdrawInspector; 54321 } 54322 set showOverdrawInspector(e1) { 54323 this._showOverdrawInspector !== e1 && (this._showOverdrawInspector = e1, this._update()); 54324 } 54325 get repaint() { 54326 return !!this._repaint; 54327 } 54328 set repaint(e1) { 54329 this._repaint !== e1 && (this._repaint = e1, this.triggerRepaint()); 54330 } 54331 get vertices() { 54332 return !!this._vertices; 54333 } 54334 set vertices(e1) { 54335 this._vertices = e1, this._update(); 54336 } 54337 get showTileAABBs() { 54338 return !!this._showTileAABBs; 54339 } 54340 set showTileAABBs(e1) { 54341 this._showTileAABBs !== e1 && (this._showTileAABBs = e1, e1 && this._update()); 54342 } 54343 _setCacheLimits(t1, i) { 54344 e1.f1(t1, i); 54345 } 54346 get version() { 54347 return e1.f2; 54348 } 54349 constructor(t1){ 54350 e1.eN.mark(e1.eO.create); 54351 const i = t1; 54352 if (null != (t1 = { 54353 ...Jl, 54354 ...t1 54355 }).minZoom && null != t1.maxZoom && t1.minZoom > t1.maxZoom) throw new Error("maxZoom must be greater than or equal to minZoom"); 54356 if (null != t1.minPitch && null != t1.maxPitch && t1.minPitch > t1.maxPitch) throw new Error("maxPitch must be greater than or equal to minPitch"); 54357 if (null != t1.minPitch && t1.minPitch < 0) throw new Error("minPitch must be greater than or equal to 0"); 54358 if (null != t1.maxPitch && t1.maxPitch > 85) throw new Error("maxPitch must be less than or equal to 85"); 54359 super(new e1.eP(t1.minZoom, t1.maxZoom, t1.minPitch, t1.maxPitch, t1.renderWorldCopies, null, null), t1), this._repaint = !!t1.repaint, this._interactive = t1.interactive, this._minTileCacheSize = t1.minTileCacheSize, this._maxTileCacheSize = t1.maxTileCacheSize, this._failIfMajorPerformanceCaveat = t1.failIfMajorPerformanceCaveat, this._preserveDrawingBuffer = t1.preserveDrawingBuffer, this._antialias = t1.antialias, this._trackResize = t1.trackResize, this._bearingSnap = t1.bearingSnap, this._refreshExpiredTiles = t1.refreshExpiredTiles, this._fadeDuration = t1.fadeDuration, this._placementAlgorithm = t1.placementAlgorithm || "default", this._isInitialLoad = !0, this._crossSourceCollisions = t1.crossSourceCollisions, this._collectResourceTiming = t1.collectResourceTiming, this._language = this._parseLanguage(t1.language), this._worldview = t1.worldview, this._renderTaskQueue = new $l, this._domRenderTaskQueue = new $l, this._controls = [], this._markers = [], this._popups = [], this._mapId = e1.av(), this._locale = { 54360 ...Wl, 54361 ...t1.locale 54362 }, this._clickTolerance = t1.clickTolerance, this._cooperativeGestures = t1.cooperativeGestures, this._performanceMetricsCollection = t1.performanceMetricsCollection, this._tessellationStep = t1.tessellationStep, this._containerWidth = 0, this._containerHeight = 0, this._showParseStatus = !0, this._precompilePrograms = t1.precompilePrograms, this._averageElevationLastSampledAt = -1 / 0, this._averageElevationExaggeration = 0, this._averageElevation = new Hl(0), this._interactionRange = [ 54363 1 / 0, 54364 -1 / 0 54365 ], this._visibilityHidden = 0, this._useExplicitProjection = !1, this._frameId = 0, this._scaleFactor = t1.scaleFactor, this._requestManager = new e1.eQ(t1.transformRequest, t1.accessToken, t1.testMode); 54366 const s = e1.eR(t1.accessToken || e1.eM.ACCESS_TOKEN); 54367 if (s && "atlas" in s && "number" == typeof s.atlas && (this._tokenExpiration = s.atlas), this._silenceAuthErrors = !!t1.testMode, this._contextCreateOptions = t1.contextCreateOptions ? { 54368 ...t1.contextCreateOptions 54369 } : {}, "string" == typeof t1.container) { 54370 const e1 = document.getElementById(t1.container); 54371 if (!e1) throw new Error("Container '".concat(t1.container.toString(), "' not found.")); 54372 this._container = e1; 54373 } else { 54374 if (!(t1.container instanceof HTMLElement)) throw new Error("Invalid type: 'container' must be a String or HTMLElement."); 54375 this._container = t1.container; 54376 } 54377 if (this._container.childNodes.length > 0 && e1.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."), t1.maxBounds && this.setMaxBounds(t1.maxBounds), this._spriteFormat = "auto", e1.aV([ 54378 "_onWindowOnline", 54379 "_onWindowResize", 54380 "_onVisibilityChange", 54381 "_onMapScroll", 54382 "_contextLost", 54383 "_contextRestored" 54384 ], this), this._setupContainer(), this._setupPainter(), void 0 === this.painter) throw new Error("Failed to initialize WebGL."); 54385 if (this.on("move", ()=>this._update(!1)), this.on("moveend", ()=>this._update(!1)), this.on("zoom", ()=>this._update(!0)), this._fullscreenchangeEvent = "onfullscreenchange" in document ? "fullscreenchange" : "
54385webkitfullscreenchange", window.addEventListener("online", this._onWindowOnline, !1), window.addEventListener("resize", this._onWindowResize, !1), window.addEventListener("orientationchange", this._onWindowResize, !1), window.addEventListener(this._fullscreenchangeEvent, this._onWindowResize, !1), window.addEventListener("visibilitychange", this._onVisibilityChange, !1), this.handlers = new Nl(this, t1), this._localFontFamily = t1.localFontFamily, this._localIdeographFontFamily = t1.localIdeographFontFamily, this._fontstackCompositing = t1.fontstackCompositing, (t1.style || !t1.testMode) && this.setStyle(t1.style || e1.eM.DEFAULT_STYLE, { 54386 config: t1.config, 54387 localFontFamily: this._localFontFamily, 54388 localIdeographFontFamily: this._localIdeographFontFamily, 54389 fontstackCompositing: this._fontstackCompositing 54390 }), t1.projection && this.setProjection(t1.projection), t1.hash && (this._hash = new Na("string" == typeof t1.hash && t1.hash || void 0).addTo(this)), !this._hash || !this._hash._onHashChange()) { 54391 null == i.center && null == i.zoom || (this.transform._unmodified = !1), this.jumpTo({ 54392 center: t1.center, 54393 zoom: t1.zoom, 54394 bearing: t1.bearing, 54395 pitch: t1.pitch 54396 }); 54397 const e1 = t1.bounds; 54398 e1 && (this.resize(), this.fitBounds(e1, { 54399 ...t1.fitBoundsOptions, 54400 duration: 0 54401 })); 54402 } 54403 this.resize(), t1.attributionControl && this.addControl(new ql({ 54404 customAttribution: t1.customAttribution 54405 })), this._logoControl = new Zl, this.addControl(this._logoControl, t1.logoPosition), this.on("style.load", ()=>{ 54406 this.transform.unmodified && this.jumpTo(this.style.stylesheet), this._postStyleLoadEvent(), this._postStyleWithAppearanceEvent(); 54407 }), this.on("data", (t1)=>{ 54408 this._update("style" === t1.dataType), this.fire(new e1.h("".concat(t1.dataType, "data"), t1)); 54409 }), this.on("dataloading", (t1)=>{ 54410 this.fire(new e1.h("".concat(t1.dataType, "dataloading"), t1)); 54411 }), this._interactions = new Kl(this); 54412 } 54413 }, 54414 NavigationControl: class { 54415 _updateZoomButtons() { 54416 const e1 = this._map; 54417 if (!e1) return; 54418 const t1 = e1.getZoom(), i = t1 === e1.getMaxZoom(), s = t1 === e1.getMinZoom(); 54419 this._zoomInButton.disabled = i, this._zoomOutButton.disabled = s, this._zoomInButton.setAttribute("aria-disabled", i.toString()), this._zoomOutButton.setAttribute("aria-disabled", s.toString()); 54420 } 54421 _rotateCompassArrow() { 54422 const e1 = this._map; 54423 if (!e1) return; 54424 const t1 = this.options.visualizePitch ? "scale(".concat(1 / Math.pow(Math.cos(e1.transform.pitch * (Math.PI / 180)), .5), ") rotateX(").concat(e1.transform.pitch, "deg) rotateZ(").concat(e1.transform.angle * (180 / Math.PI), "deg)") : "rotate(".concat(e1.transform.angle * (180 / Math.PI), "deg)"); 54425 e1._requestDomTask(()=>{ 54426 this._compassIcon && (this._compassIcon.style.transform = t1); 54427 }); 54428 } 54429 onAdd(e1) { 54430 return this._map = e1, this.options.showZoom && (this._setButtonTitle(this._zoomInButton, "ZoomIn"), this._setButtonTitle(this._zoomOutButton, "ZoomOut"), e1.on("zoom", this._updateZoomButtons), this._updateZoomButtons()), this.options.showCompass && (this._setButtonTitle(this._compass, "ResetBearing"), this.options.visualizePitch && e1.on("pitch", this._rotateCompassArrow), e1.on("rotate", this._rotateCompassArrow), this._rotateCompassArrow(), this._handler = new tc(e1, this._compass, this.options.visualizePitch)), this._container; 54431 } 54432 onRemove() { 54433 const e1 = this._map; 54434 e1 && (this._container.remove(), this.options.showZoom && e1.off("zoom", this._updateZoomButtons), this.options.showCompass && (this.options.visualizePitch && e1.off("pitch", this._rotateCompassArrow), e1.off("rotate", this._rotateCompassArrow), this._handler && this._handler.off(), this._handler = void 0), this._map = void 0); 54435 } 54436 _createButton(e1, t1) { 54437 const i = a("button", e1, this._container); 54438 return i.type = "button", i.addEventListener("click", t1), i; 54439 } 54440 _setButtonTitle(e1, t1) { 54441 if (!this._map) return; 54442 const i = this._map._getUIString("NavigationControl.".concat(t1)); 54443 e1.setAttribute("aria-label", i), e1.firstElementChild && e1.firstElementChild.setAttribute("title", i); 54444 } 54445 constructor(t1 = {}){ 54446 this.options = { 54447 ...ec, 54448 ...t1 54449 }, this._container = a("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._container.addEventListener("contextmenu", (e1)=>e1.preventDefault()), this.options.showZoom && (e1.aV([ 54450 "_setButtonTitle", 54451 "_updateZoomButtons" 54452 ], this), this._zoomInButton = this._createButton("mapboxgl-ctrl-zoom-in", (e1)=>{ 54453 this._map && this._map.zoomIn({}, { 54454 originalEvent: e1 54455 }); 54456 }), a("span", "mapboxgl-ctrl-icon", this._zoomInButton).setAttribute("aria-hidden", "true"), this._zoomOutButton = this._createButton("mapboxgl-ctrl-zoom-out", (e1)=>{ 54457 this._map && this._map.zoomOut({}, { 54458 originalEvent: e1 54459 }); 54460 }), a("span", "mapboxgl-ctrl-icon", this._zoomOutButton).setAttribute("aria-hidden", "true")), this.options.showCompass && (e1.aV([ 54461 "_rotateCompassArrow" 54462 ], this), this._compass = this._createButton("mapboxgl-ctrl-compass", (e1)=>{ 54463 const t1 = this._map; 54464 t1 && (this.options.visualizePitch ? t1.resetNorthPitch({}, { 54465 originalEvent: e1 54466 }) : t1.resetNorth({}, { 54467 originalEvent: e1 54468 })); 54469 }), this._compassIcon = a("span", "mapboxgl-ctrl-icon", this._compass), this._compassIcon.setAttribute("aria-hidden", "true")); 54470 } 54471 }, 54472 GeolocateControl: class extends e1.E { 54473 onAdd(e1) { 54474 return this._map = e1, this._container = a("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._checkGeolocationSupport(this._setupUI), this._container; 54475 } 54476 onRemove() { 54477 this._clearRequestTimeout(), void 0 !== this._geolocationWatchID && (this.options.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0), this.options.showUserLocation && this._userLocationDotMarker && this._userLocationDotMarker.remove(), this.options.showAccuracyCircle && this._accuracyCircleMarker && this._accuracyCircleMarker.remove(), this._container.remove(), this._map.off("zoom", this._onZoom), this._map = void 0, this._numberOfWatches = 0, this._noTimeout = !1; 54478 } 54479 _checkGeolocationSupport(e1) { 54480 var _this = this; 54481 const t1 = function() { 54482 let t1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !!_this.options.geolocation; 54483 _this._supportsGeolocation = t1, e1(t1); 54484 }; 54485 void 0 !== this._supportsGeolocation ? e1(this._supportsGeolocation) : void 0 !== navigator.permissions ? navigator.permissions.query({ 54486 name: "geolocation" 54487 }).then((e1)=>t1("denied" !== e1.state)).catch(()=>t1()) : t1(); 54488 } 54489 _isOutOfMapMaxBounds(e1) { 54490 const t1 = this._map.getMaxBounds(), i = e1.coords; 54491 return !!t1 && (i.longitude < t1.getWest() || i.longitude > t1.getEast() || i.latitude < t1.getSouth() || i.latitude > t1.getNorth()); 54492 } 54493 _setWatchState(e1) { 54494 this._watchState = e1; 54495 const t1 = this._geolocateButton.classList; 54496 t1.remove(...cc); 54497 for (const i of ac[e1])t1.add(lc(i)); 54498 } 54499 _setButtonTitle(e1) { 54500 const t1 = this._map._getUIString(e1); 54501 this._geolocateButton.setAttribute("aria-label", t1), this._geolocateButton.firstElementChild && this._geolocateButton.firstElementChild.setAttribute("title", t1); 54502 } 54503 _setErrorState() { 54504 switch(this._watchState){ 54505 case "WAITING_ACTIVE": 54506 case "ACTIVE_LOCK":
vendor: 7,959 bytes, lines 54507-54608
54507 this._setWatchState("ACTIVE_ERROR"); 54508 break; 54509 case "BACKGROUND": 54510 this._setWatchState("BACKGROUND_ERROR"); 54511 } 54512 } 54513 _onSuccess(t1) { 54514 if (this._map) { 54515 if (this._clearRequestTimeout(), this._isOutOfMapMaxBounds(t1)) return this._setErrorState(), this.fire(new e1.h("outofmaxbounds", t1)), this._updateMarker(), void this._finish(); 54516 if (this._lastKnownPosition = t1, this.options.trackUserLocation) switch(this._watchState){ 54517 case "WAITING_ACTIVE": 54518 case "ACTIVE_LOCK": 54519 case "ACTIVE_ERROR": 54520 this._setWatchState(this.options.followUserLocation ? "ACTIVE_LOCK" : "BACKGROUND"); 54521 break; 54522 case "BACKGROUND": 54523 case "BACKGROUND_ERROR": 54524 this._setWatchState("BACKGROUND"); 54525 } 54526 this.options.showUserLocation && "OFF" !== this._watchState && this._updateMarker(t1), this.options.followUserLocation && (!this.options.trackUserLocation || "ACTIVE_LOCK" === this._watchState) && this._updateCamera(t1), this.options.showUserLocation && this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"), this.fire(new e1.h("geolocate", { 54527 coords: t1.coords, 54528 timestamp: t1.timestamp, 54529 ...t1.toJSON ? { 54530 toJSON: t1.toJSON.bind(t1) 54531 } : {} 54532 })), this._finish(); 54533 } 54534 } 54535 _updateCamera(t1) { 54536 const i = new e1.c_(t1.coords.longitude, t1.coords.latitude), s = t1.coords.accuracy, r = { 54537 bearing: this._map.getBearing(), 54538 ...this.options.fitBoundsOptions 54539 }; 54540 this._map.fitBounds(i.toBounds(s), r, { 54541 geolocateSource: !0 54542 }); 54543 } 54544 _updateMarker(t1) { 54545 if (t1) { 54546 const i = new e1.c_(t1.coords.longitude, t1.coords.latitude); 54547 this.options.showAccuracyCircle ? this._accuracyCircleMarker.setLngLat(i).addTo(this._map) : this._accuracyCircleMarker.remove(), this._userLocationDotMarker.setLngLat(i).addTo(this._map), this._accuracy = t1.coords.accuracy, this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius(); 54548 } else this._userLocationDotMarker.remove(), this._accuracyCircleMarker.remove(); 54549 } 54550 _updateCircleRadius() { 54551 const t1 = this._map.transform, i = e1.c5(1, t1._center.lat) * t1.worldSize, s = Math.ceil(2 * this._accuracy * i); 54552 this._circleElement.style.width = "".concat(s, "px"), this._circleElement.style.height = "".concat(s, "px"); 54553 } 54554 _onZoom() { 54555 this.options.showUserLocation && this.options.showAccuracyCircle && this._updateCircleRadius(); 54556 } 54557 _updateMarkerRotation() { 54558 this._userLocationDotMarker && "number" == typeof this._heading ? (this._userLocationDotMarker.setRotation(this._heading), this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")) : (this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"), this._userLocationDotMarker.setRotation(0)); 54559 } 54560 _onError(t1) { 54561 if (this._map) { 54562 if (this._clearRequestTimeout(), this.options.trackUserLocation) if (1 === t1.code) this._setWatchState("OFF"), this._geolocateButton.disabled = !0, this._setButtonTitle("GeolocateControl.LocationNotAvailable"), void 0 !== this._geolocationWatchID && this._clearWatch(); 54563 else { 54564 if (3 === t1.code && this._noTimeout) return; 54565 this._setErrorState(); 54566 } 54567 "OFF" !== this._watchState && this.options.showUserLocation && this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"), this.fire(new e1.h("error", { 54568 code: t1.code, 54569 message: t1.message, 54570 PERMISSION_DENIED: t1.PERMISSION_DENIED, 54571 POSITION_UNAVAILABLE: t1.POSITION_UNAVAILABLE, 54572 TIMEOUT: t1.TIMEOUT 54573 })), this._finish(); 54574 } 54575 } 54576 _finish() { 54577 this._timeoutId && clearTimeout(this._timeoutId), this._timeoutId = void 0; 54578 } 54579 _startRequestTimeout() { 54580 this._clearRequestTimeout(); 54581 const e1 = this.options.positionOptions.timeout; 54582 e1 && (this._requestTimeoutId = window.setTimeout(()=>{ 54583 this._onError({ 54584 code: 3, 54585 message: "Geolocation request timed out" 54586 }); 54587 }, e1)); 54588 } 54589 _clearRequestTimeout() { 54590 void 0 !== this._requestTimeoutId && (clearTimeout(this._requestTimeoutId), this._requestTimeoutId = void 0); 54591 } 54592 _setupUI(t1) { 54593 void 0 !== this._map && (this._container.addEventListener("contextmenu", (e1)=>e1.preventDefault()), this._geolocateButton = a("button", "mapboxgl-ctrl-geolocate", this._container), a("span", "mapboxgl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", "true"), this._geolocateButton.type = "button", !1 === t1 ? (e1.w("Geolocation support is not available so the GeolocateControl will be disabled."), this._geolocateButton.disabled = !0, this._setButtonTitle("GeolocateControl.LocationNotAvailable")) : this._setButtonTitle("GeolocateControl.FindMyLocation"), this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._createUserLocationMarkers(), this.options.trackUserLocation && (this._watchState = "OFF"), this._map.on("zoom", this._onZoom)), this._geolocateButton.addEventListener("click", this.trigger.bind(this)), this._setup = !0, this.options.showButton || (this._container.style.display = "none"), this.options.trackUserLocation && this._map.on("movestart", (t1)=>{ 54594 t1.geolocateSource || "ACTIVE_LOCK" !== this._watchState || t1.originalEvent && "resize" === t1.originalEvent.type || (this._setWatchState("BACKGROUND"), this.fire(new e1.h("trackuserlocationend"))); 54595 }), this.fire(new e1.h("ready"))); 54596 } 54597 _onDeviceOrientation(e1) { 54598 this._userLocationDotMarker && (e1.webkitCompassHeading ? this._heading = e1.webkitCompassHeading : !0 === e1.absolute && (this._heading = -1 * e1.alpha), this._updateMarkerRotationThrottled()); 54599 } 54600 trigger() { 54601 if (!this._setup) return e1.w("Geolocate control triggered before added to a map"), !1; 54602 if (this.options.trackUserLocation) { 54603 switch(this._watchState){ 54604 case "OFF": 54605 this._setWatchState("WAITING_ACTIVE"), this.fire(new e1.h("trackuserlocationstart")); 54606 break; 54607 case "WAITING_ACTIVE": 54608 case "ACTIVE_LOCK":
54609 case "ACTIVE_ERROR": 54610 case "BACKGROUND_ERROR": 54611 this._numberOfWatches--, this._noTimeout = !1, this._setWatchState("OFF"), this.fire(new e1.h("trackuserlocationend")); 54612 break; 54613 case "BACKGROUND": 54614 this._setWatchState("ACTIVE_LOCK"), this._lastKnownPosition && this._updateCamera(this._lastKnownPosition), this.fire(new e1.h("trackuserlocationstart")); 54615 } 54616 if ("OFF" === this._watchState && void 0 !== this._geolocationWatchID) this._clearWatch(); 54617 else if (void 0 === this._geolocationWatchID) { 54618 let e1; 54619 this._geolocateButton.classList.add(lc("waiting")), this._geolocateButton.setAttribute("aria-pressed", "true"), this._numberOfWatches++, this._numberOfWatches > 1 ? (e1 = { 54620 maximumAge: 6e5, 54621 timeout: 0 54622 }, this._noTimeout = !0) : (e1 = this.options.positionOptions, this._noTimeout = !1), this._geolocationWatchID = this.options.geolocation.watchPosition(this._onSuccess, this._onError, e1), this._startRequestTimeout(), this.options.showUserHeading && this._addDeviceOrientationListener(); 54623 } 54624 } else this.options.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._startRequestTimeout(), this._timeoutId = window.setTimeout(this._finish, 1e4); 54625 return !0; 54626 } 54627 setFollowUserLocation(t1) { 54628 return this.options.followUserLocation = t1 !== null && t1 !== void 0 ? t1 : hc.followUserLocation, this.options.trackUserLocation && "OFF" !== this._watchState && (this.options.followUserLocation ? "BACKGROUND" !== this._watchState && "BACKGROUND_ERROR" !== this._watchState || (this._setWatchState("ACTIVE_LOCK"), this._lastKnownPosition && this._updateCamera(this._lastKnownPosition), this.fire(new e1.h("trackuserlocationstart"))) : "ACTIVE_LOCK" !== this._watchState && "ACTIVE_ERROR" !== this._watchState || (this._setWatchState("BACKGROUND"), this.fire(new e1.h("trackuserlocationend")))), this; 54629 } 54630 setShowAccuracyCircle(t1) { 54631 if (this.options.showAccuracyCircle = t1 !== null && t1 !== void 0 ? t1 : hc.showAccuracyCircle, !this._accuracyCircleMarker) return this; 54632 if (this.options.showAccuracyCircle) { 54633 if (this.options.showUserLocation && this._lastKnownPosition) { 54634 const { longitude: t1, latitude: i, accuracy: s } = this._lastKnownPosition.coords; 54635 this._accuracy = s, this._accuracyCircleMarker.setLngLat(new e1.c_(t1, i)).addTo(this._map), this._updateCircleRadius(); 54636 } 54637 } else this._accuracyCircleMarker.remove(); 54638 return this; 54639 } 54640 setShowUserHeading(e1) { 54641 return this.options.showUserHeading = e1 !== null && e1 !== void 0 ? e1 : hc.showUserHeading, this._setup ? (this.options.showUserHeading ? void 0 !== this._geolocationWatchID && this._addDeviceOrientationListener() : (this._removeDeviceOrientationListener(), this._heading = void 0, this._userLocationDotMarker && this._updateMarkerRotation()), this) : this; 54642 } 54643 setFitBoundsOptions(e1) { 54644 return this.options.fitBoundsOptions = e1 !== null && e1 !== void 0 ? e1 : hc.fitBoundsOptions, this; 54645 } 54646 setShowUserLocation(e1) { 54647 return this.options.showUserLocation = e1 !== null && e1 !== void 0 ? e1 : hc.showUserLocation, this._setup ? (this.options.showUserLocation ? (this._userLocationDotMarker || (this._createUserLocationMarkers(), this._map.on("zoom", this._onZoom)), !this._lastKnownPosition || void 0 !== this._watchState && "OFF" === this._watchState || this._updateMarker(this._lastKnownPosition)) : (this._userLocationDotMarker && this._userLocationDotMarker.remove(), this._accuracyCircleMarker && this._accuracyCircleMarker.remove()), this) : this; 54648 } 54649 _addDeviceOrientationListener() { 54650 const e1 = ()=>{ 54651 const e1 = "ondeviceorientationabsolute" in window ? "deviceorientationabsolute" : "deviceorientation"; 54652 window.addEventListener(e1, this._onDeviceOrientation); 54653 }; 54654 "function" == typeof DeviceOrientationEvent.requestPermission ? DeviceOrientationEvent.requestPermission().then((t1
vendor: 18,996 bytes, lines 54654-54935
54654)=>{ 54655 "granted" === t1 && e1(); 54656 }).catch(console.error) : e1(); 54657 } 54658 _removeDeviceOrientationListener() { 54659 window.removeEventListener("deviceorientation", this._onDeviceOrientation), window.removeEventListener("deviceorientationabsolute", this._onDeviceOrientation); 54660 } 54661 _createUserLocationMarkers() { 54662 this._dotElement = a("div", "mapboxgl-user-location"), this._dotElement.appendChild(a("div", "mapboxgl-user-location-dot")), this._dotElement.appendChild(a("div", "mapboxgl-user-location-heading")), this._userLocationDotMarker = new nc({ 54663 element: this._dotElement, 54664 rotationAlignment: "map", 54665 pitchAlignment: "map" 54666 }), this._circleElement = a("div", "mapboxgl-user-location-accuracy-circle"), this._accuracyCircleMarker = new nc({ 54667 element: this._circleElement, 54668 pitchAlignment: "map" 54669 }); 54670 } 54671 _clearWatch() { 54672 this._clearRequestTimeout(), this.options.geolocation.clearWatch(this._geolocationWatchID), this._removeDeviceOrientationListener(), this._geolocationWatchID = void 0, this._geolocateButton.classList.remove(lc("waiting")), this._geolocateButton.setAttribute("aria-pressed", "false"), this.options.showUserLocation && this._updateMarker(null); 54673 } 54674 constructor(t1 = {}){ 54675 super(); 54676 const i = navigator.geolocation; 54677 this.options = { 54678 geolocation: i, 54679 ...hc, 54680 ...t1 54681 }, e1.aV([ 54682 "_onSuccess", 54683 "_onError", 54684 "_onZoom", 54685 "_finish", 54686 "_setupUI", 54687 "_updateCamera", 54688 "_updateMarker", 54689 "_updateMarkerRotation", 54690 "_onDeviceOrientation" 54691 ], this), this._updateMarkerRotationThrottled = za(this._updateMarkerRotation, 20), this._numberOfWatches = 0; 54692 } 54693 }, 54694 AttributionControl: ql, 54695 ScaleControl: class { 54696 getDefaultPosition() { 54697 return "bottom-left"; 54698 } 54699 _update() { 54700 const e1 = this.options.maxWidth || 100, t1 = this._map, i = t1._containerHeight / 2, s = t1._containerWidth / 2 - e1 / 2, r = t1.unproject([ 54701 s, 54702 i 54703 ]), o = t1.unproject([ 54704 s + e1, 54705 i 54706 ]), n = r.distanceTo(o); 54707 if ("imperial" === this.options.unit) { 54708 const t1 = 3.2808 * n; 54709 t1 > 5280 ? this._setScale(e1, t1 / 5280, "mile") : this._setScale(e1, t1, "foot"); 54710 } else "nautical" === this.options.unit ? this._setScale(e1, n / 1852, "nautical-mile") : n >= 1e3 ? this._setScale(e1, n / 1e3, "kilometer") : this._setScale(e1, n, "meter"); 54711 } 54712 _setScale(e1, t1, i) { 54713 this._map._requestDomTask(()=>{ 54714 const s = function(e1) { 54715 const t1 = Math.pow(10, "".concat(Math.floor(e1)).length - 1); 54716 let i = e1 / t1; 54717 return i = i >= 10 ? 10 : i >= 5 ? 5 : i >= 3 ? 3 : i >= 2 ? 2 : i >= 1 ? 1 : function(e1) { 54718 const t1 = Math.pow(10, Math.ceil(-Math.log(e1) / Math.LN10)); 54719 return Math.round(e1 * t1) / t1; 54720 }(i), t1 * i; 54721 }(t1), r = s / t1; 54722 this._container.innerHTML = "nautical-mile" !== i ? new Intl.NumberFormat(this._language, { 54723 style: "unit", 54724 unitDisplay: "short", 54725 unit: i 54726 }).format(s) : "".concat(s, " ").concat(uc[i]), this._container.style.width = e1 * r + "px"; 54727 }); 54728 } 54729 onAdd(e1) { 54730 return this._map = e1, this._language = e1.getLanguage(), this._container = a("div", "mapboxgl-ctrl mapboxgl-ctrl-scale", e1.getContainer()), this._container.dir = "auto", this._map.on("move", this._update), this._update(), this._container; 54731 } 54732 onRemove() { 54733 this._container.remove(), this._map.off("move", this._update), this._map = void 0; 54734 } 54735 _setLanguage(e1) { 54736 this._language = e1, this._update(); 54737 } 54738 setUnit(e1) { 54739 this.options.unit = e1, this._update(); 54740 } 54741 constructor(t1 = {}){ 54742 this.options = { 54743 ...dc, 54744 ...t1 54745 }, e1.aV([ 54746 "_update", 54747 "_setScale", 54748 "setUnit" 54749 ], this); 54750 } 54751 }, 54752 FullscreenControl: class { 54753 onAdd(t1) { 54754 return this._map = t1, this._container || (this._container = this._map.getContainer()), this._controlContainer = a("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._checkFullscreenSupport() ? this._setupUI() : (this._controlContainer.style.display = "none", e1.w("This device does not support fullscreen mode.")), this._controlContainer; 54755 } 54756 onRemove() { 54757 this._controlContainer.remove(), this._map = null, document.removeEventListener(this._fullscreenchange, this._changeIcon); 54758 } 54759 _checkFullscreenSupport() { 54760 return !(!document.fullscreenEnabled && !document.webkitFullscreenEnabled); 54761 } 54762 _setupUI() { 54763 const e1 = this._fullscreenButton = a("button", "mapboxgl-ctrl-fullscreen", this._controlContainer); 54764 a("span", "mapboxgl-ctrl-icon", e1).setAttribute("aria-hidden", "true"), e1.type = "button", this._updateTitle(), this._fullscreenButton.addEventListener("click", this._onClickFullscreen), document.addEventListener(this._fullscreenchange, this._changeIcon); 54765 } 54766 _updateTitle() { 54767 const e1 = this._getTitle(); 54768 this._fullscreenButton.setAttribute("aria-label", e1), this._fullscreenButton.firstElementChild && this._fullscreenButton.firstElementChild.setAttribute("title", e1); 54769 } 54770 _getTitle() { 54771 return this._map._getUIString(this._isFullscreen() ? "FullscreenControl.Exit" : "FullscreenControl.Enter"); 54772 } 54773 _isFullscreen() { 54774 return this._fullscreen; 54775 } 54776 _changeIcon() { 54777 (document.fullscreenElement || document.webkitFullscreenElement) === this._container !== this._fullscreen && (this._fullscreen = !this._fullscreen, this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"), this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"), this._updateTitle()); 54778 } 54779 _onClickFullscreen() { 54780 this._isFullscreen() ? document.exitFullscreen ? document.exitFullscreen() : document.webkitCancelFullScreen && document.webkitCancelFullScreen() : this._container.requestFullscreen ? this._container.requestFullscreen() : this._container.webkitRequestFullscreen && this._container.webkitRequestFullscreen(); 54781 } 54782 constructor(t1 = {}){ 54783 this._fullscreen = !1, t1 && t1.container && (t1.container instanceof HTMLElement ? this._container = t1.container : e1.w("Full screen control 'container' must be a DOM element.")), e1.aV([ 54784 "_onClickFullscreen", 54785 "_changeIcon" 54786 ], this), "onfullscreenchange" in document ? this._fullscreenchange = "fullscreenchange" : "onwebkitfullscreenchange" in document && (this._fullscreenchange = "webkitfullscreenchange"); 54787 } 54788 }, 54789 IndoorControl: class { 54790 onAdd(e1) { 54791 return this._map = e1, this._container = a("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._container.style.display = "none", this._map.on("styledata", this._onStyleData), this._map.on("idle", this._onStyleData), this._updateConnection(), this._container; 54792 } 54793 _onStyleData() { 54794 this._updateConnection(); 54795 } 54796 _updateConnection() { 54797 if (this._map && this._map.style && this._map.style.indoorManager) { 54798 const e1 = this._map.style.indoorManager; 54799 e1.off("selector-update", this._onIndoorUpdate), e1.on("selector-update", this._onIndoorUpdate), this._onIndoorUpdate(e1.getControlState()), this._map.off("idle", this._onStyleData); 54800 } 54801 } 54802 _createButton(e1, t1) { 54803 const i = a("button", e1, this._container); 54804 return i.type = "button", i.addEventListener("click", t1), i; 54805 } 54806 _setButtonTitle(e1, t1) { 54807 e1.setAttribute("aria-label", t1), e1.textContent = t1; 54808 } 54809 onRemove() { 54810 this._container && this._container.remove(), this._map && (this._map.off("styledata", this._onStyleData), this._map.off("idle", this._onStyleData), this._map.style && this._map.style.indoorManager && this._map.style.indoorManager.off("selector-update", this._onIndoorUpdate), this._map = null); 54811 } 54812 getDefaultPosition() { 54813 return "top-right"; 54814 } 54815 _onIndoorUpdate(e1) { 54816 if (!e1 || !e1.floors || 0 === e1.floors.length) return this._model = e1, void (this._container.style.display = "none"); 54817 const t1 = this._model; 54818 this._model = e1, this._container.style.display = "inline-block"; 54819 const i = !t1 || t1.floors.length !== e1.floors.length || t1.floors.some((t1, i)=>t1.id !== e1.floors[i].id); 54820 if (i && (this._visibleFloorStart = 0, this._lastSelectedFloorId = null), e1.selectedFloorId) { 54821 if (e1.selectedFloorId !== this._lastSelectedFloorId || i) { 54822 const t1 = e1.floors.findIndex((t1)=>t1.id === e1.selectedFloorId); 54823 if (-1 !== t1) { 54824 const i = e1.floors.length; 54825 let s, r; 54826 i <= 5 ? (s = 0, r = i - 1) : 0 === this._visibleFloorStart ? (s = 0, r = 3) : this._visibleFloorStart >= i - 3 ? (s = i - 3 - 1, r = i - 1) : (s = this._visibleFloorStart, r = this._visibleFloorStart + 3 - 1), t1 < s ? this._visibleFloorStart = t1 : t1 > r && (this._visibleFloorStart = t1 - 2); 54827 } 54828 } 54829 this._lastSelectedFloorId = e1.selectedFloorId; 54830 } 54831 this._render(); 54832 } 54833 _render() { 54834 if (!this._container || !this._model || !this._model.floors) return; 54835 this._container.innerHTML = ""; 54836 const e1 = this._createButton("mapboxgl-ctrl-indoor-toggle", this._toggleIndoor); 54837 a("span", "mapboxgl-ctrl-icon", e1).setAttribute("aria-hidden", "true"), this._model.activeFloorsVisible || e1.classList.add("mapboxgl-ctrl-level-button-selected"), this._container.appendChild(e1); 54838 const t1 = this._model.floors, i = t1.length; 54839 if (i <= 5) return void t1.forEach((e1)=>this._createFloorButton(e1)); 54840 const s = 0 === this._visibleFloorStart, r = this._visibleFloorStart >= i - 3; 54841 if (s) this._createFloorButton(t1[0]); 54842 else { 54843 const e1 = this._createButton("mapboxgl-ctrl-arrow-up", this._scrollUp); 54844 a("span", "mapboxgl-ctrl-icon", e1).setAttribute("aria-hidden", "true"), this._container.appendChild(e1); 54845 } 54846 let o = []; 54847 if (o = s ? t1.slice(1, 4) : r ? t1.slice(this._visibleFloorStart - 1, this._visibleFloorStart + 3 - 1) : t1.slice(this._visibleFloorStart, this._visibleFloorStart + 3), o.forEach((e1)=>this._createFloorButton(e1)), r) this._createFloorButton(t1[i - 1]); 54848 else { 54849 const e1 = this._createButton("mapboxgl-ctrl-arrow-down", this._scrollDown); 54850 a("span", "mapboxgl-ctrl-icon", e1).setAttribute("aria-hidden", "true"), this._container.appendChild(e1); 54851 } 54852 } 54853 _createFloorButton(e1) { 54854 const t1 = this._createButton("mapboxgl-ctrl-level-button", ()=>{ 54855 const t1 = e1.id; 54856 this._model && this._model.selectedFloorId === t1 && this._model.activeFloorsVisible || this._map && (this._model && !this._model.activeFloorsVisible && this._map.style && this._map.style.indoorManager && this._map.style.indoorManager.setActiveFloorsVisibility(!0), this._map._selectIndoorFloor(t1)); 54857 }), i = (e1.name || "").trim(), s = e1.zIndex.toString(), r = i ? Array.from(i).slice(0, 3).join("") : s; 54858 this._setButtonTitle(t1, r), this._model && this._model.activeFloorsVisible && e1.id === this._model.selectedFloorId && t1.classList.add("mapboxgl-ctrl-level-button-selected"), this._container && this._container.appendChild(t1); 54859 } 54860 _toggleIndoor() { 54861 this._map && this._map.style && this._map.style.indoorManager && this._model && this._model.activeFloorsVisible && this._map.style.indoorManager.setActiveFloorsVisibility(!1); 54862 } 54863 _scrollUp() { 54864 if (this._visibleFloorStart > 0) { 54865 this._visibleFloorStart--, 1 === this._visibleFloorStart && (this._visibleFloorStart = 0); 54866 const e1 = this._model && this._model.floors || []; 54867 if (e1.length > 3) { 54868 const t1 = e1.length - 3; 54869 this._visibleFloorStart === t1 - 1 && (this._visibleFloorStart = t1 - 2); 54870 } 54871 this._render(); 54872 } 54873 } 54874 _scrollDown() { 54875 if (this._model && this._model.floors) { 54876 const e1 = this._model.floors.length - 3; 54877 this._visibleFloorStart < e1 && (this._visibleFloorStart++, 1 === this._visibleFloorStart && (this._visibleFloorStart = 2), this._visibleFloorStart === e1 - 1 && (this._visibleFloorStart = e1), this._visibleFloorStart > e1 && (this._visibleFloorStart = e1), this._render()); 54878 } 54879 } 54880 constructor(){ 54881 e1.aV([ 54882 "_onIndoorUpdate", 54883 "_onStyleData", 54884 "_scrollUp", 54885 "_scrollDown", 54886 "_toggleIndoor" 54887 ], this), this._visibleFloorStart = 0, this._lastSelectedFloorId = null; 54888 } 54889 }, 54890 Popup: class extends e1.E { 54891 addTo(t1) { 54892 return this._map && this.remove(), this._map = t1, this.options.closeOnClick && t1.on("preclick", this._onClose), this.options.closeOnMove && t1.on("move", this._onClose), t1.on("remove", this.remove), this._update(), t1._addPopup(this), this._focusFirstElement(), this._trackPointer ? (t1.on("mousemove", this._onMouseEvent), t1.on("mouseup", this._onMouseEvent), t1._canvasContainer.classList.add("mapboxgl-track-pointer")) : t1.on("move", this._update), this.fire(new e1.h("open")), this; 54893 } 54894 isOpen() { 54895 return !!this._map; 54896 } 54897 remove() { 54898 this._content && this._content.remove(), this._container && (this._container.remove(), this._container = void 0); 54899 const t1 = this._map; 54900 return t1 && (t1.off("move", this._update), t1.off("move", this._onClose), t1.off("preclick", this._onClose), t1.off("click", this._onClose), t1.off("remove", this.remove), t1.off("mousemove", this._onMouseEvent), t1.off("mouseup", this._onMouseEvent), t1.off("drag", this._onMouseEvent), t1._canvasContainer && t1._canvasContainer.classList.remove("mapboxgl-track-pointer"), t1._removePopup(this), this._map = void 0), this.fire(new e1.h("close")), this; 54901 } 54902 getLngLat() { 54903 return this._lngLat; 54904 } 54905 setLngLat(t1) { 54906 this._lngLat = e1.c_.convert(t1), this._pos = null, this._trackPointer = !1, this._update(); 54907 const i = this._map; 54908 return i && (i.on("move", this._update), i.off("mousemove", this._onMouseEvent), i._canvasContainer.classList.remove("mapboxgl-track-pointer")), this; 54909 } 54910 getAltitude() { 54911 return this._altitude; 54912 } 54913 setAltitude(e1) { 54914 return this._altitude = e1, this._update(), this; 54915 } 54916 trackPointer() { 54917 this._trackPointer = !0, this._pos = null, this._update(); 54918 const e1 = this._map; 54919 return e1 && (e1.off("move", this._update), e1.on("mousemove", this._onMouseEvent), e1.on("drag", this._onMouseEvent), e1._canvasContainer.classList.add("mapboxgl-track-pointer")), this; 54920 } 54921 getElement() { 54922 return this._container; 54923 } 54924 setText(e1) { 54925 return this.setDOMContent(document.createTextNode(e1)); 54926 } 54927 setHTML(e1) { 54928 const t1 = document.createDocumentFragment(), i = document.createElement("body"); 54929 let s; 54930 for(i.innerHTML = e1; s = i.firstChild, s;)t1.appendChild(s); 54931 return this.setDOMContent(t1); 54932 } 54933 getMaxWidth() { 54934 return this._container && this._container.style.maxWidth; 54935 }
54936 setMaxWidth(e1) { 54937 return this.options.maxWidth = e1, this._update(), this; 54938 } 54939 setDOMContent(e1) { 54940 let t1 = this._content; 54941 if (t1) for(; t1.hasChildNodes();)t1.firstChild && t1.removeChild(t1.firstChild); 54942 else t1 = this._content = a("div", "mapboxgl-popup-content", this._container || void 0); 54943 if (t1.appendChild(e1), this.options.closeButton) { 54944 const e1 = this._closeButton = a("button", "mapboxgl-popup-close-button", t1); 54945 e1.type = "button", e1.setAttribute("aria-label", "Close popup"), e1.innerHTML = '<span aria-hidden="true">×</span>', e1.addEventListener("click", this._onClose); 54946 } 54947 return this._update(), this._focusFirstElement(), this; 54948 } 54949 addClassName(e1) { 54950 return this._classList.add(e1), this._updateClassList(), this; 54951 } 54952 removeClassName(e1) { 54953 return this._classList.delete(e1), this._updateClassList(), this; 54954 } 54955 setOffset(e1) { 54956 return this.options.offset = e1, this._update(), this; 54957 } 54958 toggleClassName(e1) { 54959 let t1; 54960 return this._classList.delete(e1) ? t1 = !1 : (this._classList.add(e1), t1 = !0), this._updateClassList(), t1; 54961 } 54962 _onMouseEvent(e1) { 54963 this._update(e1.point); 54964 } 54965 _getAnchor(e1) { 54966 if (this.options.anchor) return this.options.anchor; 54967 const t1 = this._map, i = this._container, s = this._pos; 54968 if (!t1 || !i || !s) return "bottom"; 54969 const r = i.offsetWidth, o = i.offsetHeight, n = s.x < r / 2, a = s.x > t1.transform.width - r / 2; 54970 if (s.y + e1 < o) return n ? "top-left" : a ? "top-right" : "top"; 54971 if (s.y > t1.transform.height - o) { 54972 if (n) return "bottom-left"; 54973 if (a) return "bottom-right"; 54974 } 54975 return n ? "left" : a ? "right" : "bottom"; 54976 } 54977 _updateClassList() { 54978 const e1 = this._container; 54979 if (!e1) return; 54980 const t1 = [ 54981 ...this._classList 54982 ]; 54983 t1.push("mapboxgl-popup"), this._anchor && t1.push("mapboxgl-popup-anchor-".concat(this._anchor)), this._trackPointer && t1.push("mapboxgl-popup-track-pointer"), e1.className = t1.join(" "); 54984 } 54985 _update(t1) { 54986 const i = this._map, s = this._content; 54987 if (!i || !this._lngLat && !this._trackPointer || !s) return; 54988 let r = this._container; 54989 if (r || (r = this._container = a("div", "mapboxgl-popup", i.getContainer()), this._tip = a("div", "mapboxgl-popup-tip", r), r.appendChild(s)), this.options.maxWidth && r.style.maxWidth !== this.options.maxWidth && (r.style.maxWidth = this.options.maxWidth), i.transform.renderWorldCopies && !this._trackPointer && (this._lngLat = ic(this._lngLat, this._pos, i.transform)), !this._trackPointer || t1) { 54990 const s = this._pos = this._trackPointer && t1 instanceof e1.P ? t1 : i.project(this._lngLat, this._altitude), r = _c(this.options.offset), o = this._anchor = this._getAnchor(r.y), n = _c(this.options.offset, o), a = s.add(n).round(); 54991 i._requestDomTask(()=>{ 54992 this._container && o && (this._container.style.transform = "".concat(sc[o], " translate(").concat(a.x, "px,").concat(a.y, "px)")); 54993 }); 54994 } 54995 if (!this._marker && i._showingGlobe()) { 54996 const t1 = e1.f3(i.transform, this._lngLat) ? 0 : 1; 54997 this._setOpacity(t1); 54998 } 54999 this._updateClassList(); 55000 } 55001 _focusFirstElement() { 55002 if (!this.options.focusAfterOpen || !this._container) return; 55003 const e1 = this._container.querySelector(mc); 55004 e1 && e1.focus(); 55005 } 55006 _onClose() { 55007 this.remove(); 55008 } 55009 _setOpacity(e1) { 55010 this._container && (this._container.style.opacity = "".concat(e1)), this._content && (this._content.style.pointerEvents = e1 ? "auto" : "none"); 55011 } 55012 constructor(t1){ 55013 super(), this.options = Object.assign(Object.create(fc), t1), this._altitude = this.options.altitude, e1.aV([ 55014 "_update", 55015 "_onClose", 55016 "remove", 55017 "_onMouseEvent" 55018 ], this), this._classList = new Set(t1 && t1.className ? t1.className.trim().split(pc) : []); 55019 } 55020 }, 55021 Marker: nc, 55022 Style: qn, 55023 LngLat: e1.c_, 55024 LngLatBounds: e1.eC, 55025 Point: e1.P,
55026 MercatorCoordinate: e1.bS, 55027 FreeCameraOptions: e1.f9, 55028 Evented: e1.E, 55029 config: e1.eM, 55030 prewarm: function() { 55031 $o().acquire(Qt); 55032 }, 55033 clearPrewarmedResources: function() { 55034 const e1 = Zo; 55035 e1 && (e1.isPreloaded() && 1 === e1.numActive() ? (e1.release(Qt), Zo = null) : console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()")); 55036 }, 55037 get accessToken () { 55038 return e1.eM.ACCESS_TOKEN; 55039 }, 55040 set accessToken (t){ 55041 e1.fn(t); 55042 }, 55043 get baseApiUrl () { 55044 return e1.eM.API_URL; 55045 }, 55046 set baseApiUrl (t){ 55047 e1.fm(t); 55048 }, 55049 get workerCount () { 55050 return Jt.workerCount; 55051 }, 55052 set workerCount (e){ 55053 !function(e1) { 55054 Jt.workerCount = e1; 55055 }(e); 55056 }, 55057 get maxParallelImageRequests () { 55058 return e1.eM.MAX_PARALLEL_IMAGE_REQUESTS; 55059 }, 55060 set maxParallelImageRequests (t){ 55061 e1.fl(t); 55062 }, 55063 clearStorage (t1) { 55064 e1.fk(t1); 55065 }, 55066 get workerUrl () { 55067 return Kt.workerUrl; 55068 }, 55069 set workerUrl (e){ 55070 Kt.workerUrl = e; 55071 }, 55072 get workerClass () { 55073 return Kt.workerClass; 55074 }, 55075 set workerClass (e){ 55076 Kt.workerClass = e; 55077 }, 55078 get dracoUrl () { 55079 return e1.fj(); 55080 }, 55081 set dracoUrl (t){ 55082 e1.fi(t); 55083 }, 55084 get meshoptUrl () { 55085 return e1.fh(); 55086 }, 55087 set meshoptUrl (t){ 55088 e1.fg(t); 55089 }, 55090 get buildingGenUrl () { 55091 return e1.ff(); 55092 }, 55093 set buildingGenUrl (t){ 55094 e1.fe(t); 55095 }, 55096 setNow: e1.e.setNow, 55097 restoreNow: e1.e.restoreNow 55098 }; 55099 return yc; 55100 }); 55101 var mapboxgl$1 = mapboxgl; 55102 return mapboxgl$1; 55103}); 55104}), 55105]); 55106 55107//# debugId=005e33b2-6a1a-bb06-76af-30edd551edef
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.