/* @preserve * Leaflet 1.6.0, a JS library for interactive maps. http://leafletjs.com * (c) 2010-2019 Vladimir Agafonkin, (c) 2010-2011 CloudMade */ !function (t, i) { "object" == typeof exports && "undefined" != typeof module ? i(exports) : "function" == typeof define && define.amd ? define(["exports"], i) : i(t.L = {}) }(this, function (t) { "use strict"; var i = Object.freeze; function h(t) { var i, e, n, o; for (e = 1, n = arguments.length; e < n; e++)for (i in o = arguments[e]) t[i] = o[i]; return t } Object.freeze = function (t) { return t }; var s = Object.create || function (t) { return e.prototype = t, new e }; function e() { } function a(t, i) { var e = Array.prototype.slice; if (t.bind) return t.bind.apply(t, e.call(arguments, 1)); var n = e.call(arguments, 2); return function () { return t.apply(i, n.length ? n.concat(e.call(arguments)) : arguments) } } var n = 0; function u(t) { return t._leaflet_id = t._leaflet_id || ++n, t._leaflet_id } function o(t, i, e) { var n, o, s, r; return r = function () { n = !1, o && (s.apply(e, o), o = !1) }, s = function () { n ? o = arguments : (t.apply(e, arguments), setTimeout(r, i), n = !0) } } function r(t, i, e) { var n = i[1], o = i[0], s = n - o; return t === n && e ? t : ((t - o) % s + s) % s + o } function l() { return !1 } function c(t, i) { var e = Math.pow(10, void 0 === i ? 6 : i); return Math.round(t * e) / e } function _(t) { return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, "") } function d(t) { return _(t).split(/\s+/) } function p(t, i) { for (var e in t.hasOwnProperty("options") || (t.options = t.options ? s(t.options) : {}), i) t.options[e] = i[e]; return t.options } function m(t, i, e) { var n = []; for (var o in t) n.push(encodeURIComponent(e ? o.toUpperCase() : o) + "=" + encodeURIComponent(t[o])); return (i && -1 !== i.indexOf("?") ? "&" : "?") + n.join("&") } var f = /\{ *([\w_-]+) *\}/g; function g(t, n) { return t.replace(f, function (t, i) { var e = n[i]; if (void 0 === e) throw new Error("No value provided for variable " + t); return "function" == typeof e && (e = e(n)), e }) } var v = Array.isArray || function (t) { return "[object Array]" === Object.prototype.toString.call(t) }; function y(t, i) { for (var e = 0; e < t.length; e++)if (t[e] === i) return e; return -1 } var x = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="; function w(t) { return window["webkit" + t] || window["moz" + t] || window["ms" + t] } var P = 0; function b(t) { var i = +new Date, e = Math.max(0, 16 - (i - P)); return P = i + e, window.setTimeout(t, e) } var T = window.requestAnimationFrame || w("RequestAnimationFrame") || b, z = window.cancelAnimationFrame || w("CancelAnimationFrame") || w("CancelRequestAnimationFrame") || function (t) { window.clearTimeout(t) }; function M(t, i, e) { if (!e || T !== b) return T.call(window, a(t, i)); t.call(i) } function C(t) { t && z.call(window, t) } var S = (Object.freeze || Object)({ freeze: i, extend: h, create: s, bind: a, lastId: n, stamp: u, throttle: o, wrapNum: r, falseFn: l, formatNum: c, trim: _, splitWords: d, setOptions: p, getParamString: m, template: g, isArray: v, indexOf: y, emptyImageUrl: x, requestFn: T, cancelFn: z, requestAnimFrame: M, cancelAnimFrame: C }); function E() { } E.extend = function (t) { function i() { this.initialize && this.initialize.apply(this, arguments), this.callInitHooks() } var e = i.__super__ = this.prototype, n = s(e); for (var o in (n.constructor = i).prototype = n, this) this.hasOwnProperty(o) && "prototype" !== o && "__super__" !== o && (i[o] = this[o]); return t.statics && (h(i, t.statics), delete t.statics), t.includes && (function (t) { if ("undefined" == typeof L || !L || !L.Mixin) return; t = v(t) ? t : [t]; for (var i = 0; i < t.length; i++)t[i] === L.Mixin.Events && console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.", (new Error).stack) }(t.includes), h.apply(null, [n].concat(t.includes)), delete t.includes), n.options && (t.options = h(s(n.options), t.options)), h(n, t), n._initHooks = [], n.callInitHooks = function () { if (!this._initHooksCalled) { e.callInitHooks && e.callInitHooks.call(this), this._initHooksCalled = !0; for (var t = 0, i = n._initHooks.length; t < i; t++)n._initHooks[t].call(this) } }, i }, E.include = function (t) { return h(this.prototype, t), this }, E.mergeOptions = function (t) { return h(this.prototype.options, t), this }, E.addInitHook = function (t) { var i = Array.prototype.slice.call(arguments, 1), e = "function" == typeof t ? t : function () { this[t].apply(this, i) }; return this.prototype._initHooks = this.prototype._initHooks || [], this.prototype._initHooks.push(e), this }; var Z = { on: function (t, i, e) { if ("object" == typeof t) for (var n in t) this._on(n, t[n], i); else for (var o = 0, s = (t = d(t)).length; o < s; o++)this._on(t[o], i, e); return this }, off: function (t, i, e) { if (t) if ("object" == typeof t) for (var n in t) this._off(n, t[n], i); else for (var o = 0, s = (t = d(t)).length; o < s; o++)this._off(t[o], i, e); else delete this._events; return this }, _on: function (t, i, e) { this._events = this._events || {}; var n = this._events[t]; n || (n = [], this._events[t] = n), e === this && (e = void 0); for (var o = { fn: i, ctx: e }, s = n, r = 0, a = s.length; r < a; r++)if (s[r].fn === i && s[r].ctx === e) return; s.push(o) }, _off: function (t, i, e) { var n, o, s; if (this._events && (n = this._events[t])) if (i) { if (e === this && (e = void 0), n) for (o = 0, s = n.length; o < s; o++) { var r = n[o]; if (r.ctx === e && r.fn === i) return r.fn = l, this._firingCount && (this._events[t] = n = n.slice()), void n.splice(o, 1) } } else { for (o = 0, s = n.length; o < s; o++)n[o].fn = l; delete this._events[t] } }, fire: function (t, i, e) { if (!this.listens(t, e)) return this; var n = h({}, i, { type: t, target: this, sourceTarget: i && i.sourceTarget || this }); if (this._events) { var o = this._events[t]; if (o) { this._firingCount = this._firingCount + 1 || 1; for (var s = 0, r = o.length; s < r; s++) { var a = o[s]; a.fn.call(a.ctx || this, n) } this._firingCount-- } } return e && this._propagateEvent(n), this }, listens: function (t, i) { var e = this._events && this._events[t]; if (e && e.length) return !0; if (i) for (var n in this._eventParents) if (this._eventParents[n].listens(t, i)) return !0; return !1 }, once: function (t, i, e) { if ("object" == typeof t) { for (var n in t) this.once(n, t[n], i); return this } var o = a(function () { this.off(t, i, e).off(t, o, e) }, this); return this.on(t, i, e).on(t, o, e) }, addEventParent: function (t) { return this._eventParents = this._eventParents || {}, this._eventParents[u(t)] = t, this }, removeEventParent: function (t) { return this._eventParents && delete this._eventParents[u(t)], this }, _propagateEvent: function (t) { for (var i in this._eventParents) this._eventParents[i].fire(t.type, h({ layer: t.target, propagatedFrom: t.target }, t), !0) } }; Z.addEventListener = Z.on, Z.removeEventListener = Z.clearAllEventListeners = Z.off, Z.addOneTimeEventListener = Z.once, Z.fireEvent = Z.fire, Z.hasEventListeners = Z.listens; var k = E.extend(Z); function B(t, i, e) { this.x = e ? Math.round(t) : t, this.y = e ? Math.round(i) : i } var A = Math.trunc || function (t) { return 0 < t ? Math.floor(t) : Math.ceil(t) }; function I(t, i, e) { return t instanceof B ? t : v(t) ? new B(t[0], t[1]) : null == t ? t : "object" == typeof t && "x" in t && "y" in t ? new B(t.x, t.y) : new B(t, i, e) } function O(t, i) { if (t) for (var e = i ? [t, i] : t, n = 0, o = e.length; n < o; n++)this.extend(e[n]) } function R(t, i) { return !t || t instanceof O ? t : new O(t, i) } function N(t, i) { if (t) for (var e = i ? [t, i] : t, n = 0, o = e.length; n < o; n++)this.extend(e[n]) } function D(t, i) { return t instanceof N ? t : new N(t, i) } function j(t, i, e) { if (isNaN(t) || isNaN(i)) throw new Error("Invalid LatLng object: (" + t + ", " + i + ")"); this.lat = +t, this.lng = +i, void 0 !== e && (this.alt = +e) } function W(t, i, e) { return t instanceof j ? t : v(t) && "object" != typeof t[0] ? 3 === t.length ? new j(t[0], t[1], t[2]) : 2 === t.length ? new j(t[0], t[1]) : null : null == t ? t : "object" == typeof t && "lat" in t ? new j(t.lat, "lng" in t ? t.lng : t.lon, t.alt) : void 0 === i ? null : new j(t, i, e) } B.prototype = { clone: function () { return new B(this.x, this.y) }, add: function (t) { return this.clone()._add(I(t)) }, _add: function (t) { return this.x += t.x, this.y += t.y, this }, subtract: function (t) { return this.clone()._subtract(I(t)) }, _subtract: function (t) { return this.x -= t.x, this.y -= t.y, this }, divideBy: function (t) { return this.clone()._divideBy(t) }, _divideBy: function (t) { return this.x /= t, this.y /= t, this }, multiplyBy: function (t) { return this.clone()._multiplyBy(t) }, _multiplyBy: function (t) { return this.x *= t, this.y *= t, this }, scaleBy: function (t) { return new B(this.x * t.x, this.y * t.y) }, unscaleBy: function (t) { return new B(this.x / t.x, this.y / t.y) }, round: function () { return this.clone()._round() }, _round: function () { return this.x = Math.round(this.x), this.y = Math.round(this.y), this }, floor: function () { return this.clone()._floor() }, _floor: function () { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this }, ceil: function () { return this.clone()._ceil() }, _ceil: function () { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this }, trunc: function () { return this.clone()._trunc() }, _trunc: function () { return this.x = A(this.x), this.y = A(this.y), this }, distanceTo: function (t) { var i = (t = I(t)).x - this.x, e = t.y - this.y; return Math.sqrt(i * i + e * e) }, equals: function (t) { return (t = I(t)).x === this.x && t.y === this.y }, contains: function (t) { return t = I(t), Math.abs(t.x) <= Math.abs(this.x) && Math.abs(t.y) <= Math.abs(this.y) }, toString: function () { return "Point(" + c(this.x) + ", " + c(this.y) + ")" } }, O.prototype = { extend: function (t) { return t = I(t), this.min || this.max ? (this.min.x = Math.min(t.x, this.min.x), this.max.x = Math.max(t.x, this.max.x), this.min.y = Math.min(t.y, this.min.y), this.max.y = Math.max(t.y, this.max.y)) : (this.min = t.clone(), this.max = t.clone()), this }, getCenter: function (t) { return new B((this.min.x + this.max.x) / 2, (this.min.y + this.max.y) / 2, t) }, getBottomLeft: function () { return new B(this.min.x, this.max.y) }, getTopRight: function () { return new B(this.max.x, this.min.y) }, getTopLeft: function () { return this.min }, getBottomRight: function () { return this.max }, getSize: function () { return this.max.subtract(this.min) }, contains: function (t) { var i, e; return (t = "number" == typeof t[0] || t instanceof B ? I(t) : R(t)) instanceof O ? (i = t.min, e = t.max) : i = e = t, i.x >= this.min.x && e.x <= this.max.x && i.y >= this.min.y && e.y <= this.max.y }, intersects: function (t) { t = R(t); var i = this.min, e = this.max, n = t.min, o = t.max, s = o.x >= i.x && n.x <= e.x, r = o.y >= i.y && n.y <= e.y; return s && r }, overlaps: function (t) { t = R(t); var i = this.min, e = this.max, n = t.min, o = t.max, s = o.x > i.x && n.x < e.x, r = o.y > i.y && n.y < e.y; return s && r }, isValid: function () { return !(!this.min || !this.max) } }, N.prototype = { extend: function (t) { var i, e, n = this._southWest, o = this._northEast; if (t instanceof j) e = i = t; else { if (!(t instanceof N)) return t ? this.extend(W(t) || D(t)) : this; if (i = t._southWest, e = t._northEast, !i || !e) return this } return n || o ? (n.lat = Math.min(i.lat, n.lat), n.lng = Math.min(i.lng, n.lng), o.lat = Math.max(e.lat, o.lat), o.lng = Math.max(e.lng, o.lng)) : (this._southWest = new j(i.lat, i.lng), this._northEast = new j(e.lat, e.lng)), this }, pad: function (t) { var i = this._southWest, e = this._northEast, n = Math.abs(i.lat - e.lat) * t, o = Math.abs(i.lng - e.lng) * t; return new N(new j(i.lat - n, i.lng - o), new j(e.lat + n, e.lng + o)) }, getCenter: function () { return new j((this._southWest.lat + this._northEast.lat) / 2, (this._southWest.lng + this._northEast.lng) / 2) }, getSouthWest: function () { return this._southWest }, getNorthEast: function () { return this._northEast }, getNorthWest: function () { return new j(this.getNorth(), this.getWest()) }, getSouthEast: function () { return new j(this.getSouth(), this.getEast()) }, getWest: function () { return this._southWest.lng }, getSouth: function () { return this._southWest.lat }, getEast: function () { return this._northEast.lng }, getNorth: function () { return this._northEast.lat }, contains: function (t) { t = "number" == typeof t[0] || t instanceof j || "lat" in t ? W(t) : D(t); var i, e, n = this._southWest, o = this._northEast; return t instanceof N ? (i = t.getSouthWest(), e = t.getNorthEast()) : i = e = t, i.lat >= n.lat && e.lat <= o.lat && i.lng >= n.lng && e.lng <= o.lng }, intersects: function (t) { t = D(t); var i = this._southWest, e = this._northEast, n = t.getSouthWest(), o = t.getNorthEast(), s = o.lat >= i.lat && n.lat <= e.lat, r = o.lng >= i.lng && n.lng <= e.lng; return s && r }, overlaps: function (t) { t = D(t); var i = this._southWest, e = this._northEast, n = t.getSouthWest(), o = t.getNorthEast(), s = o.lat > i.lat && n.lat < e.lat, r = o.lng > i.lng && n.lng < e.lng; return s && r }, toBBoxString: function () { return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(",") }, equals: function (t, i) { return !!t && (t = D(t), this._southWest.equals(t.getSouthWest(), i) && this._northEast.equals(t.getNorthEast(), i)) }, isValid: function () { return !(!this._southWest || !this._northEast) } }; var H, F = { latLngToPoint: function (t, i) { var e = this.projection.project(t), n = this.scale(i); return this.transformation._transform(e, n) }, pointToLatLng: function (t, i) { var e = this.scale(i), n = this.transformation.untransform(t, e); return this.projection.unproject(n) }, project: function (t) { return this.projection.project(t) }, unproject: function (t) { return this.projection.unproject(t) }, scale: function (t) { return 256 * Math.pow(2, t) }, zoom: function (t) { return Math.log(t / 256) / Math.LN2 }, getProjectedBounds: function (t) { if (this.infinite) return null; var i = this.projection.bounds, e = this.scale(t); return new O(this.transformation.transform(i.min, e), this.transformation.transform(i.max, e)) }, infinite: !(j.prototype = { equals: function (t, i) { return !!t && (t = W(t), Math.max(Math.abs(this.lat - t.lat), Math.abs(this.lng - t.lng)) <= (void 0 === i ? 1e-9 : i)) }, toString: function (t) { return "LatLng(" + c(this.lat, t) + ", " + c(this.lng, t) + ")" }, distanceTo: function (t) { return U.distance(this, W(t)) }, wrap: function () { return U.wrapLatLng(this) }, toBounds: function (t) { var i = 180 * t / 40075017, e = i / Math.cos(Math.PI / 180 * this.lat); return D([this.lat - i, this.lng - e], [this.lat + i, this.lng + e]) }, clone: function () { return new j(this.lat, this.lng, this.alt) } }), wrapLatLng: function (t) { var i = this.wrapLng ? r(t.lng, this.wrapLng, !0) : t.lng; return new j(this.wrapLat ? r(t.lat, this.wrapLat, !0) : t.lat, i, t.alt) }, wrapLatLngBounds: function (t) { var i = t.getCenter(), e = this.wrapLatLng(i), n = i.lat - e.lat, o = i.lng - e.lng; if (0 == n && 0 == o) return t; var s = t.getSouthWest(), r = t.getNorthEast(); return new N(new j(s.lat - n, s.lng - o), new j(r.lat - n, r.lng - o)) } }, U = h({}, F, { wrapLng: [-180, 180], R: 6371e3, distance: function (t, i) { var e = Math.PI / 180, n = t.lat * e, o = i.lat * e, s = Math.sin((i.lat - t.lat) * e / 2), r = Math.sin((i.lng - t.lng) * e / 2), a = s * s + Math.cos(n) * Math.cos(o) * r * r, h = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); return this.R * h } }), V = 6378137, q = { R: V, MAX_LATITUDE: 85.0511287798, project: function (t) { var i = Math.PI / 180, e = this.MAX_LATITUDE, n = Math.max(Math.min(e, t.lat), -e), o = Math.sin(n * i); return new B(this.R * t.lng * i, this.R * Math.log((1 + o) / (1 - o)) / 2) }, unproject: function (t) { var i = 180 / Math.PI; return new j((2 * Math.atan(Math.exp(t.y / this.R)) - Math.PI / 2) * i, t.x * i / this.R) }, bounds: (H = V * Math.PI, new O([-H, -H], [H, H])) }; function G(t, i, e, n) { if (v(t)) return this._a = t[0], this._b = t[1], this._c = t[2], void (this._d = t[3]); this._a = t, this._b = i, this._c = e, this._d = n } function K(t, i, e, n) { return new G(t, i, e, n) } G.prototype = { transform: function (t, i) { return this._transform(t.clone(), i) }, _transform: function (t, i) { return i = i || 1, t.x = i * (this._a * t.x + this._b), t.y = i * (this._c * t.y + this._d), t }, untransform: function (t, i) { return i = i || 1, new B((t.x / i - this._b) / this._a, (t.y / i - this._d) / this._c) } }; var Y, X = h({}, U, { code: "EPSG:3857", projection: q, transformation: (Y = .5 / (Math.PI * q.R), K(Y, .5, -Y, .5)) }), J = h({}, X, { code: "EPSG:900913" }); function $(t) { return document.createElementNS("http://www.w3.org/2000/svg", t) } function Q(t, i) { var e, n, o, s, r, a, h = ""; for (e = 0, o = t.length; e < o; e++) { for (n = 0, s = (r = t[e]).length; n < s; n++)h += (n ? "L" : "M") + (a = r[n]).x + " " + a.y; h += i ? Zt ? "z" : "x" : "" } return h || "M0 0" } var tt = document.documentElement.style, it = "ActiveXObject" in window, et = it && !document.addEventListener, nt = "msLaunchUri" in navigator && !("documentMode" in document), ot = Bt("webkit"), st = Bt("android"), rt = Bt("android 2") || Bt("android 3"), at = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10), ht = st && Bt("Google") && at < 537 && !("AudioNode" in window), ut = !!window.opera, lt = Bt("chrome"), ct = Bt("gecko") && !ot && !ut && !it, _t = !lt && Bt("safari"), dt = Bt("phantom"), pt = "OTransition" in tt, mt = 0 === navigator.platform.indexOf("Win"), ft = it && "transition" in tt, gt = "WebKitCSSMatrix" in window && "m11" in new window.WebKitCSSMatrix && !rt, vt = "MozPerspective" in tt, yt = !window.L_DISABLE_3D && (ft || gt || vt) && !pt && !dt, xt = "undefined" != typeof orientation || Bt("mobile"), wt = xt && ot, Pt = xt && gt, Lt = !window.PointerEvent && window.MSPointerEvent, bt = !(ot || !window.PointerEvent && !Lt), Tt = !window.L_NO_TOUCH && (bt || "ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch), zt = xt && ut, Mt = xt && ct, Ct = 1 < (window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI), St = function () { var t = !1; try { var i = Object.defineProperty({}, "passive", { get: function () { t = !0 } }); window.addEventListener("testPassiveEventSupport", l, i), window.removeEventListener("testPassiveEventSupport", l, i) } catch (t) { } return t }, Et = !!document.createElement("canvas").getContext, Zt = !(!document.createElementNS || !$("svg").createSVGRect), kt = !Zt && function () { try { var t = document.createElement("div"); t.innerHTML = ''; var i = t.firstChild; return i.style.behavior = "url(#default#VML)", i && "object" == typeof i.adj } catch (t) { return !1 } }(); function Bt(t) { return 0 <= navigator.userAgent.toLowerCase().indexOf(t) } var At = (Object.freeze || Object)({ ie: it, ielt9: et, edge: nt, webkit: ot, android: st, android23: rt, androidStock: ht, opera: ut, chrome: lt, gecko: ct, safari: _t, phantom: dt, opera12: pt, win: mt, ie3d: ft, webkit3d: gt, gecko3d: vt, any3d: yt, mobile: xt, mobileWebkit: wt, mobileWebkit3d: Pt, msPointer: Lt, pointer: bt, touch: Tt, mobileOpera: zt, mobileGecko: Mt, retina: Ct, passiveEvents: St, canvas: Et, svg: Zt, vml: kt }), It = Lt ? "MSPointerDown" : "pointerdown", Ot = Lt ? "MSPointerMove" : "pointermove", Rt = Lt ? "MSPointerUp" : "pointerup", Nt = Lt ? "MSPointerCancel" : "pointercancel", Dt = ["INPUT", "SELECT", "OPTION"], jt = {}, Wt = !1, Ht = 0; function Ft(t, i, e, n) { return "touchstart" === i ? function (t, i, e) { var n = a(function (t) { if ("mouse" !== t.pointerType && t.MSPOINTER_TYPE_MOUSE && t.pointerType !== t.MSPOINTER_TYPE_MOUSE) { if (!(Dt.indexOf(t.target.tagName) < 0)) return; ji(t) } Gt(t, i) }); t["_leaflet_touchstart" + e] = n, t.addEventListener(It, n, !1), Wt || (document.documentElement.addEventListener(It, Ut, !0), document.documentElement.addEventListener(Ot, Vt, !0), document.documentElement.addEventListener(Rt, qt, !0), document.documentElement.addEventListener(Nt, qt, !0), Wt = !0) }(t, e, n) : "touchmove" === i ? function (t, i, e) { function n(t) { (t.pointerType !== t.MSPOINTER_TYPE_MOUSE && "mouse" !== t.pointerType || 0 !== t.buttons) && Gt(t, i) } t["_leaflet_touchmove" + e] = n, t.addEventListener(Ot, n, !1) }(t, e, n) : "touchend" === i && function (t, i, e) { function n(t) { Gt(t, i) } t["_leaflet_touchend" + e] = n, t.addEventListener(Rt, n, !1), t.addEventListener(Nt, n, !1) }(t, e, n), this } function Ut(t) { jt[t.pointerId] = t, Ht++ } function Vt(t) { jt[t.pointerId] && (jt[t.pointerId] = t) } function qt(t) { delete jt[t.pointerId], Ht-- } function Gt(t, i) { for (var e in t.touches = [], jt) t.touches.push(jt[e]); t.changedTouches = [t], i(t) } var Kt = Lt ? "MSPointerDown" : bt ? "pointerdown" : "touchstart", Yt = Lt ? "MSPointerUp" : bt ? "pointerup" : "touchend", Xt = "_leaflet_"; function Jt(t, o, i) { var s, r, a = !1; function e(t) { var i; if (bt) { if (!nt || "mouse" === t.pointerType) return; i = Ht } else i = t.touches.length; if (!(1 < i)) { var e = Date.now(), n = e - (s || e); r = t.touches ? t.touches[0] : t, a = 0 < n && n <= 250, s = e } } function n(t) { if (a && !r.cancelBubble) { if (bt) { if (!nt || "mouse" === t.pointerType) return; var i, e, n = {}; for (e in r) i = r[e], n[e] = i && i.bind ? i.bind(r) : i; r = n } r.type = "dblclick", r.button = 0, o(r), s = null } } return t[Xt + Kt + i] = e, t[Xt + Yt + i] = n, t[Xt + "dblclick" + i] = o, t.addEventListener(Kt, e, !!St && { passive: !1 }), t.addEventListener(Yt, n, !!St && { passive: !1 }), t.addEventListener("dblclick", o, !1), this } function $t(t, i) { var e = t[Xt + Kt + i], n = t[Xt + Yt + i], o = t[Xt + "dblclick" + i]; return t.removeEventListener(Kt, e, !!St && { passive: !1 }), t.removeEventListener(Yt, n, !!St && { passive: !1 }), nt || t.removeEventListener("dblclick", o, !1), this } var Qt, ti, ii, ei, ni, oi = xi(["transform", "webkitTransform", "OTransform", "MozTransform", "msTransform"]), si = xi(["webkitTransition", "transition", "OTransition", "MozTransition", "msTransition"]), ri = "webkitTransition" === si || "OTransition" === si ? si + "End" : "transitionend"; function ai(t) { return "string" == typeof t ? document.getElementById(t) : t } function hi(t, i) { var e = t.style[i] || t.currentStyle && t.currentStyle[i]; if ((!e || "auto" === e) && document.defaultView) { var n = document.defaultView.getComputedStyle(t, null); e = n ? n[i] : null } return "auto" === e ? null : e } function ui(t, i, e) { var n = document.createElement(t); return n.className = i || "", e && e.appendChild(n), n } function li(t) { var i = t.parentNode; i && i.removeChild(t) } function ci(t) { for (; t.firstChild;)t.removeChild(t.firstChild) } function _i(t) { var i = t.parentNode; i && i.lastChild !== t && i.appendChild(t) } function di(t) { var i = t.parentNode; i && i.firstChild !== t && i.insertBefore(t, i.firstChild) } function pi(t, i) { if (void 0 !== t.classList) return t.classList.contains(i); var e = vi(t); return 0 < e.length && new RegExp("(^|\\s)" + i + "(\\s|$)").test(e) } function mi(t, i) { if (void 0 !== t.classList) for (var e = d(i), n = 0, o = e.length; n < o; n++)t.classList.add(e[n]); else if (!pi(t, i)) { var s = vi(t); gi(t, (s ? s + " " : "") + i) } } function fi(t, i) { void 0 !== t.classList ? t.classList.remove(i) : gi(t, _((" " + vi(t) + " ").replace(" " + i + " ", " "))) } function gi(t, i) { void 0 === t.className.baseVal ? t.className = i : t.className.baseVal = i } function vi(t) { return t.correspondingElement && (t = t.correspondingElement), void 0 === t.className.baseVal ? t.className : t.className.baseVal } function yi(t, i) { "opacity" in t.style ? t.style.opacity = i : "filter" in t.style && function (t, i) { var e = !1, n = "DXImageTransform.Microsoft.Alpha"; try { e = t.filters.item(n) } catch (t) { if (1 === i) return } i = Math.round(100 * i), e ? (e.Enabled = 100 !== i, e.Opacity = i) : t.style.filter += " progid:" + n + "(opacity=" + i + ")" }(t, i) } function xi(t) { for (var i = document.documentElement.style, e = 0; e < t.length; e++)if (t[e] in i) return t[e]; return !1 } function wi(t, i, e) { var n = i || new B(0, 0); t.style[oi] = (ft ? "translate(" + n.x + "px," + n.y + "px)" : "translate3d(" + n.x + "px," + n.y + "px,0)") + (e ? " scale(" + e + ")" : "") } function Pi(t, i) { t._leaflet_pos = i, yt ? wi(t, i) : (t.style.left = i.x + "px", t.style.top = i.y + "px") } function Li(t) { return t._leaflet_pos || new B(0, 0) } if ("onselectstart" in document) Qt = function () { ki(window, "selectstart", ji) }, ti = function () { Ai(window, "selectstart", ji) }; else { var bi = xi(["userSelect", "WebkitUserSelect", "OUserSelect", "MozUserSelect", "msUserSelect"]); Qt = function () { if (bi) { var t = document.documentElement.style; ii = t[bi], t[bi] = "none" } }, ti = function () { bi && (document.documentElement.style[bi] = ii, ii = void 0) } } function Ti() { ki(window, "dragstart", ji) } function zi() { Ai(window, "dragstart", ji) } function Mi(t) { for (; -1 === t.tabIndex;)t = t.parentNode; t.style && (Ci(), ni = (ei = t).style.outline, t.style.outline = "none", ki(window, "keydown", Ci)) } function Ci() { ei && (ei.style.outline = ni, ni = ei = void 0, Ai(window, "keydown", Ci)) } function Si(t) { for (; !((t = t.parentNode).offsetWidth && t.offsetHeight || t === document.body);); return t } function Ei(t) { var i = t.getBoundingClientRect(); return { x: i.width / t.offsetWidth || 1, y: i.height / t.offsetHeight || 1, boundingClientRect: i } } var Zi = (Object.freeze || Object)({ TRANSFORM: oi, TRANSITION: si, TRANSITION_END: ri, get: ai, getStyle: hi, create: ui, remove: li, empty: ci, toFront: _i, toBack: di, hasClass: pi, addClass: mi, removeClass: fi, setClass: gi, getClass: vi, setOpacity: yi, testProp: xi, setTransform: wi, setPosition: Pi, getPosition: Li, disableTextSelection: Qt, enableTextSelection: ti, disableImageDrag: Ti, enableImageDrag: zi, preventOutline: Mi, restoreOutline: Ci, getSizedParentNode: Si, getScale: Ei }); function ki(t, i, e, n) { if ("object" == typeof i) for (var o in i) Ii(t, o, i[o], e); else for (var s = 0, r = (i = d(i)).length; s < r; s++)Ii(t, i[s], e, n); return this } var Bi = "_leaflet_events"; function Ai(t, i, e, n) { if ("object" == typeof i) for (var o in i) Oi(t, o, i[o], e); else if (i) for (var s = 0, r = (i = d(i)).length; s < r; s++)Oi(t, i[s], e, n); else { for (var a in t[Bi]) Oi(t, a, t[Bi][a]); delete t[Bi] } return this } function Ii(i, t, e, n) { var o = t + u(e) + (n ? "_" + u(n) : ""); if (i[Bi] && i[Bi][o]) return this; var s = function (t) { return e.call(n || i, t || window.event) }, r = s; bt && 0 === t.indexOf("touch") ? Ft(i, t, s, o) : !Tt || "dblclick" !== t || bt && lt ? "addEventListener" in i ? "mousewheel" === t ? i.addEventListener("onwheel" in i ? "wheel" : "mousewheel", s, !!St && { passive: !1 }) : "mouseenter" === t || "mouseleave" === t ? (s = function (t) { t = t || window.event, Yi(i, t) && r(t) }, i.addEventListener("mouseenter" === t ? "mouseover" : "mouseout", s, !1)) : ("click" === t && st && (s = function (t) { !function (t, i) { var e = t.timeStamp || t.originalEvent && t.originalEvent.timeStamp, n = Vi && e - Vi; if (n && 100 < n && n < 500 || t.target._simulatedClick && !t._simulated) return Wi(t); Vi = e, i(t) }(t, r) }), i.addEventListener(t, s, !1)) : "attachEvent" in i && i.attachEvent("on" + t, s) : Jt(i, s, o), i[Bi] = i[Bi] || {}, i[Bi][o] = s } function Oi(t, i, e, n) { var o = i + u(e) + (n ? "_" + u(n) : ""), s = t[Bi] && t[Bi][o]; if (!s) return this; bt && 0 === i.indexOf("touch") ? function (t, i, e) { var n = t["_leaflet_" + i + e]; "touchstart" === i ? t.removeEventListener(It, n, !1) : "touchmove" === i ? t.removeEventListener(Ot, n, !1) : "touchend" === i && (t.removeEventListener(Rt, n, !1), t.removeEventListener(Nt, n, !1)) }(t, i, o) : !Tt || "dblclick" !== i || bt && lt ? "removeEventListener" in t ? "mousewheel" === i ? t.removeEventListener("onwheel" in t ? "wheel" : "mousewheel", s, !!St && { passive: !1 }) : t.removeEventListener("mouseenter" === i ? "mouseover" : "mouseleave" === i ? "mouseout" : i, s, !1) : "detachEvent" in t && t.detachEvent("on" + i, s) : $t(t, o), t[Bi][o] = null } function Ri(t) { return t.stopPropagation ? t.stopPropagation() : t.originalEvent ? t.originalEvent._stopped = !0 : t.cancelBubble = !0, Ki(t), this } function Ni(t) { return Ii(t, "mousewheel", Ri), this } function Di(t) { return ki(t, "mousedown touchstart dblclick", Ri), Ii(t, "click", Gi), this } function ji(t) { return t.preventDefault ? t.preventDefault() : t.returnValue = !1, this } function Wi(t) { return ji(t), Ri(t), this } function Hi(t, i) { if (!i) return new B(t.clientX, t.clientY); var e = Ei(i), n = e.boundingClientRect; return new B((t.clientX - n.left) / e.x - i.clientLeft, (t.clientY - n.top) / e.y - i.clientTop) } var Fi = mt && lt ? 2 * window.devicePixelRatio : ct ? window.devicePixelRatio : 1; function Ui(t) { return nt ? t.wheelDeltaY / 2 : t.deltaY && 0 === t.deltaMode ? -t.deltaY / Fi : t.deltaY && 1 === t.deltaMode ? 20 * -t.deltaY : t.deltaY && 2 === t.deltaMode ? 60 * -t.deltaY : t.deltaX || t.deltaZ ? 0 : t.wheelDelta ? (t.wheelDeltaY || t.wheelDelta) / 2 : t.detail && Math.abs(t.detail) < 32765 ? 20 * -t.detail : t.detail ? t.detail / -32765 * 60 : 0 } var Vi, qi = {}; function Gi(t) { qi[t.type] = !0 } function Ki(t) { var i = qi[t.type]; return qi[t.type] = !1, i } function Yi(t, i) { var e = i.relatedTarget; if (!e) return !0; try { for (; e && e !== t;)e = e.parentNode } catch (t) { return !1 } return e !== t } var Xi = (Object.freeze || Object)({ on: ki, off: Ai, stopPropagation: Ri, disableScrollPropagation: Ni, disableClickPropagation: Di, preventDefault: ji, stop: Wi, getMousePosition: Hi, getWheelDelta: Ui, fakeStop: Gi, skipped: Ki, isExternalTarget: Yi, addListener: ki, removeListener: Ai }), Ji = k.extend({ run: function (t, i, e, n) { this.stop(), this._el = t, this._inProgress = !0, this._duration = e || .25, this._easeOutPower = 1 / Math.max(n || .5, .2), this._startPos = Li(t), this._offset = i.subtract(this._startPos), this._startTime = +new Date, this.fire("start"), this._animate() }, stop: function () { this._inProgress && (this._step(!0), this._complete()) }, _animate: function () { this._animId = M(this._animate, this), this._step() }, _step: function (t) { var i = +new Date - this._startTime, e = 1e3 * this._duration; i < e ? this._runFrame(this._easeOut(i / e), t) : (this._runFrame(1), this._complete()) }, _runFrame: function (t, i) { var e = this._startPos.add(this._offset.multiplyBy(t)); i && e._round(), Pi(this._el, e), this.fire("step") }, _complete: function () { C(this._animId), this._inProgress = !1, this.fire("end") }, _easeOut: function (t) { return 1 - Math.pow(1 - t, this._easeOutPower) } }), $i = k.extend({ options: { crs: X, center: void 0, zoom: void 0, minZoom: void 0, maxZoom: void 0, layers: [], maxBounds: void 0, renderer: void 0, zoomAnimation: !0, zoomAnimationThreshold: 4, fadeAnimation: !0, markerZoomAnimation: !0, transform3DLimit: 8388608, zoomSnap: 1, zoomDelta: 1, trackResize: !0 }, initialize: function (t, i) { i = p(this, i), this._handlers = [], this._layers = {}, this._zoomBoundLayers = {}, this._sizeChanged = !0, this._initContainer(t), this._initLayout(), this._onResize = a(this._onResize, this), this._initEvents(), i.maxBounds && this.setMaxBounds(i.maxBounds), void 0 !== i.zoom && (this._zoom = this._limitZoom(i.zoom)), i.center && void 0 !== i.zoom && this.setView(W(i.center), i.zoom, { reset: !0 }), this.callInitHooks(), this._zoomAnimated = si && yt && !zt && this.options.zoomAnimation, this._zoomAnimated && (this._createAnimProxy(), ki(this._proxy, ri, this._catchTransitionEnd, this)), this._addLayers(this.options.layers) }, setView: function (t, i, e) { if ((i = void 0 === i ? this._zoom : this._limitZoom(i), t = this._limitCenter(W(t), i, this.options.maxBounds), e = e || {}, this._stop(), this._loaded && !e.reset && !0 !== e) && (void 0 !== e.animate && (e.zoom = h({ animate: e.animate }, e.zoom), e.pan = h({ animate: e.animate, duration: e.duration }, e.pan)), this._zoom !== i ? this._tryAnimatedZoom && this._tryAnimatedZoom(t, i, e.zoom) : this._tryAnimatedPan(t, e.pan))) return clearTimeout(this._sizeTimer), this; return this._resetView(t, i), this }, setZoom: function (t, i) { return this._loaded ? this.setView(this.getCenter(), t, { zoom: i }) : (this._zoom = t, this) }, zoomIn: function (t, i) { return t = t || (yt ? this.options.zoomDelta : 1), this.setZoom(this._zoom + t, i) }, zoomOut: function (t, i) { return t = t || (yt ? this.options.zoomDelta : 1), this.setZoom(this._zoom - t, i) }, setZoomAround: function (t, i, e) { var n = this.getZoomScale(i), o = this.getSize().divideBy(2), s = (t instanceof B ? t : this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1 - 1 / n), r = this.containerPointToLatLng(o.add(s)); return this.setView(r, i, { zoom: e }) }, _getBoundsCenterZoom: function (t, i) { i = i || {}, t = t.getBounds ? t.getBounds() : D(t); var e = I(i.paddingTopLeft || i.padding || [0, 0]), n = I(i.paddingBottomRight || i.padding || [0, 0]), o = this.getBoundsZoom(t, !1, e.add(n)); if ((o = "number" == typeof i.maxZoom ? Math.min(i.maxZoom, o) : o) === 1 / 0) return { center: t.getCenter(), zoom: o }; var s = n.subtract(e).divideBy(2), r = this.project(t.getSouthWest(), o), a = this.project(t.getNorthEast(), o); return { center: this.unproject(r.add(a).divideBy(2).add(s), o), zoom: o } }, fitBounds: function (t, i) { if (!(t = D(t)).isValid()) throw new Error("Bounds are not valid."); var e = this._getBoundsCenterZoom(t, i); return this.setView(e.center, e.zoom, i) }, fitWorld: function (t) { return this.fitBounds([[-90, -180], [90, 180]], t) }, panTo: function (t, i) { return this.setView(t, this._zoom, { pan: i }) }, panBy: function (t, i) { if (i = i || {}, !(t = I(t).round()).x && !t.y) return this.fire("moveend"); if (!0 !== i.animate && !this.getSize().contains(t)) return this._resetView(this.unproject(this.project(this.getCenter()).add(t)), this.getZoom()), this; if (this._panAnim || (this._panAnim = new Ji, this._panAnim.on({ step: this._onPanTransitionStep, end: this._onPanTransitionEnd }, this)), i.noMoveStart || this.fire("movestart"), !1 !== i.animate) { mi(this._mapPane, "leaflet-pan-anim"); var e = this._getMapPanePos().subtract(t).round(); this._panAnim.run(this._mapPane, e, i.duration || .25, i.easeLinearity) } else this._rawPanBy(t), this.fire("move").fire("moveend"); return this }, flyTo: function (n, o, t) { if (!1 === (t = t || {}).animate || !yt) return this.setView(n, o, t); this._stop(); var s = this.project(this.getCenter()), r = this.project(n), i = this.getSize(), a = this._zoom; n = W(n), o = void 0 === o ? a : o; var h = Math.max(i.x, i.y), u = h * this.getZoomScale(a, o), l = r.distanceTo(s) || 1, c = 1.42, _ = c * c; function e(t) { var i = (u * u - h * h + (t ? -1 : 1) * _ * _ * l * l) / (2 * (t ? u : h) * _ * l), e = Math.sqrt(i * i + 1) - i; return e < 1e-9 ? -18 : Math.log(e) } function d(t) { return (Math.exp(t) - Math.exp(-t)) / 2 } function p(t) { return (Math.exp(t) + Math.exp(-t)) / 2 } var m = e(0); function f(t) { return h * (p(m) * function (t) { return d(t) / p(t) }(m + c * t) - d(m)) / _ } var g = Date.now(), v = (e(1) - m) / c, y = t.duration ? 1e3 * t.duration : 1e3 * v * .8; return this._moveStart(!0, t.noMoveStart), function t() { var i = (Date.now() - g) / y, e = function (t) { return 1 - Math.pow(1 - t, 1.5) }(i) * v; i <= 1 ? (this._flyToFrame = M(t, this), this._move(this.unproject(s.add(r.subtract(s).multiplyBy(f(e) / l)), a), this.getScaleZoom(h / function (t) { return h * (p(m) / p(m + c * t)) }(e), a), { flyTo: !0 })) : this._move(n, o)._moveEnd(!0) }.call(this), this }, flyToBounds: function (t, i) { var e = this._getBoundsCenterZoom(t, i); return this.flyTo(e.center, e.zoom, i) }, setMaxBounds: function (t) { return (t = D(t)).isValid() ? (this.options.maxBounds && this.off("moveend", this._panInsideMaxBounds), this.options.maxBounds = t, this._loaded && this._panInsideMaxBounds(), this.on("moveend", this._panInsideMaxBounds)) : (this.options.maxBounds = null, this.off("moveend", this._panInsideMaxBounds)) }, setMinZoom: function (t) { var i = this.options.minZoom; return this.options.minZoom = t, this._loaded && i !== t && (this.fire("zoomlevelschange"), this.getZoom() < this.options.minZoom) ? this.setZoom(t) : this }, setMaxZoom: function (t) { var i = this.options.maxZoom; return this.options.maxZoom = t, this._loaded && i !== t && (this.fire("zoomlevelschange"), this.getZoom() > this.options.maxZoom) ? this.setZoom(t) : this }, panInsideBounds: function (t, i) { this._enforcingBounds = !0; var e = this.getCenter(), n = this._limitCenter(e, this._zoom, D(t)); return e.equals(n) || this.panTo(n, i), this._enforcingBounds = !1, this }, panInside: function (t, i) { var e = I((i = i || {}).paddingTopLeft || i.padding || [0, 0]), n = I(i.paddingBottomRight || i.padding || [0, 0]), o = this.getCenter(), s = this.project(o), r = this.project(t), a = this.getPixelBounds(), h = a.getSize().divideBy(2), u = R([a.min.add(e), a.max.subtract(n)]); if (!u.contains(r)) { this._enforcingBounds = !0; var l = s.subtract(r), c = I(r.x + l.x, r.y + l.y); (r.x < u.min.x || r.x > u.max.x) && (c.x = s.x - l.x, 0 < l.x ? c.x += h.x - e.x : c.x -= h.x - n.x), (r.y < u.min.y || r.y > u.max.y) && (c.y = s.y - l.y, 0 < l.y ? c.y += h.y - e.y : c.y -= h.y - n.y), this.panTo(this.unproject(c), i), this._enforcingBounds = !1 } return this }, invalidateSize: function (t) { if (!this._loaded) return this; t = h({ animate: !1, pan: !0 }, !0 === t ? { animate: !0 } : t); var i = this.getSize(); this._sizeChanged = !0, this._lastCenter = null; var e = this.getSize(), n = i.divideBy(2).round(), o = e.divideBy(2).round(), s = n.subtract(o); return s.x || s.y ? (t.animate && t.pan ? this.panBy(s) : (t.pan && this._rawPanBy(s), this.fire("move"), t.debounceMoveend ? (clearTimeout(this._sizeTimer), this._sizeTimer = setTimeout(a(this.fire, this, "moveend"), 200)) : this.fire("moveend")), this.fire("resize", { oldSize: i, newSize: e })) : this }, stop: function () { return this.setZoom(this._limitZoom(this._zoom)), this.options.zoomSnap || this.fire("viewreset"), this._stop() }, locate: function (t) { if (t = this._locateOptions = h({ timeout: 1e4, watch: !1 }, t), !("geolocation" in navigator)) return this._handleGeolocationError({ code: 0, message: "Geolocation not supported." }), this; var i = a(this._handleGeolocationResponse, this), e = a(this._handleGeolocationError, this); return t.watch ? this._locationWatchId = navigator.geolocation.watchPosition(i, e, t) : navigator.geolocation.getCurrentPosition(i, e, t), this }, stopLocate: function () { return navigator.geolocation && navigator.geolocation.clearWatch && navigator.geolocation.clearWatch(this._locationWatchId), this._locateOptions && (this._locateOptions.setView = !1), this }, _handleGeolocationError: function (t) { var i = t.code, e = t.message || (1 === i ? "permission denied" : 2 === i ? "position unavailable" : "timeout"); this._locateOptions.setView && !this._loaded && this.fitWorld(), this.fire("locationerror", { code: i, message: "Geolocation error: " + e + "." }) }, _handleGeolocationResponse: function (t) { var i = new j(t.coords.latitude, t.coords.longitude), e = i.toBounds(2 * t.coords.accuracy), n = this._locateOptions; if (n.setView) { var o = this.getBoundsZoom(e); this.setView(i, n.maxZoom ? Math.min(o, n.maxZoom) : o) } var s = { latlng: i, bounds: e, timestamp: t.timestamp }; for (var r in t.coords) "number" == typeof t.coords[r] && (s[r] = t.coords[r]); this.fire("locationfound", s) }, addHandler: function (t, i) { if (!i) return this; var e = this[t] = new i(this); return this._handlers.push(e), this.options[t] && e.enable(), this }, remove: function () { if (this._initEvents(!0), this._containerId !== this._container._leaflet_id) throw new Error("Map container is being reused by another instance"); try { delete this._container._leaflet_id, delete this._containerId } catch (t) { this._container._leaflet_id = void 0, this._containerId = void 0 } var t; for (t in void 0 !== this._locationWatchId && this.stopLocate(), this._stop(), li(this._mapPane), this._clearControlPos && this._clearControlPos(), this._resizeRequest && (C(this._resizeRequest), this._resizeRequest = null), this._clearHandlers(), this._loaded && this.fire("unload"), this._layers) this._layers[t].remove(); for (t in this._panes) li(this._panes[t]); return this._layers = [], this._panes = [], delete this._mapPane, delete this._renderer, this }, createPane: function (t, i) { var e = ui("div", "leaflet-pane" + (t ? " leaflet-" + t.replace("Pane", "") + "-pane" : ""), i || this._mapPane); return t && (this._panes[t] = e), e }, getCenter: function () { return this._checkIfLoaded(), this._lastCenter && !this._moved() ? this._lastCenter : this.layerPointToLatLng(this._getCenterLayerPoint()) }, getZoom: function () { return this._zoom }, getBounds: function () { var t = this.getPixelBounds(); return new N(this.unproject(t.getBottomLeft()), this.unproject(t.getTopRight())) }, getMinZoom: function () { return void 0 === this.options.minZoom ? this._layersMinZoom || 0 : this.options.minZoom }, getMaxZoom: function () { return void 0 === this.options.maxZoom ? void 0 === this._layersMaxZoom ? 1 / 0 : this._layersMaxZoom : this.options.maxZoom }, getBoundsZoom: function (t, i, e) { t = D(t), e = I(e || [0, 0]); var n = this.getZoom() || 0, o = this.getMinZoom(), s = this.getMaxZoom(), r = t.getNorthWest(), a = t.getSouthEast(), h = this.getSize().subtract(e), u = R(this.project(a, n), this.project(r, n)).getSize(), l = yt ? this.options.zoomSnap : 1, c = h.x / u.x, _ = h.y / u.y, d = i ? Math.max(c, _) : Math.min(c, _); return n = this.getScaleZoom(d, n), l && (n = Math.round(n / (l / 100)) * (l / 100), n = i ? Math.ceil(n / l) * l : Math.floor(n / l) * l), Math.max(o, Math.min(s, n)) }, getSize: function () { return this._size && !this._sizeChanged || (this._size = new B(this._container.clientWidth || 0, this._container.clientHeight || 0), this._sizeChanged = !1), this._size.clone() }, getPixelBounds: function (t, i) { var e = this._getTopLeftPoint(t, i); return new O(e, e.add(this.getSize())) }, getPixelOrigin: function () { return this._checkIfLoaded(), this._pixelOrigin }, getPixelWorldBounds: function (t) { return this.options.crs.getProjectedBounds(void 0 === t ? this.getZoom() : t) }, getPane: function (t) { return "string" == typeof t ? this._panes[t] : t }, getPanes: function () { return this._panes }, getContainer: function () { return this._container }, getZoomScale: function (t, i) { var e = this.options.crs; return i = void 0 === i ? this._zoom : i, e.scale(t) / e.scale(i) }, getScaleZoom: function (t, i) { var e = this.options.crs; i = void 0 === i ? this._zoom : i; var n = e.zoom(t * e.scale(i)); return isNaN(n) ? 1 / 0 : n }, project: function (t, i) { return i = void 0 === i ? this._zoom : i, this.options.crs.latLngToPoint(W(t), i) }, unproject: function (t, i) { return i = void 0 === i ? this._zoom : i, this.options.crs.pointToLatLng(I(t), i) }, layerPointToLatLng: function (t) { var i = I(t).add(this.getPixelOrigin()); return this.unproject(i) }, latLngToLayerPoint: function (t) { return this.project(W(t))._round()._subtract(this.getPixelOrigin()) }, wrapLatLng: function (t) { return this.options.crs.wrapLatLng(W(t)) }, wrapLatLngBounds: function (t) { return this.options.crs.wrapLatLngBounds(D(t)) }, distance: function (t, i) { return this.options.crs.distance(W(t), W(i)) }, containerPointToLayerPoint: function (t) { return I(t).subtract(this._getMapPanePos()) }, layerPointToContainerPoint: function (t) { return I(t).add(this._getMapPanePos()) }, containerPointToLatLng: function (t) { var i = this.containerPointToLayerPoint(I(t)); return this.layerPointToLatLng(i) }, latLngToContainerPoint: function (t) { return this.layerPointToContainerPoint(this.latLngToLayerPoint(W(t))) }, mouseEventToContainerPoint: function (t) { return Hi(t, this._container) }, mouseEventToLayerPoint: function (t) { return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t)) }, mouseEventToLatLng: function (t) { return this.layerPointToLatLng(this.mouseEventToLayerPoint(t)) }, _initContainer: function (t) { var i = this._container = ai(t); if (!i) throw new Error("Map container not found."); if (i._leaflet_id) throw new Error("Map container is already initialized."); ki(i, "scroll", this._onScroll, this), this._containerId = u(i) }, _initLayout: function () { var t = this._container; this._fadeAnimated = this.options.fadeAnimation && yt, mi(t, "leaflet-container" + (Tt ? " leaflet-touch" : "") + (Ct ? " leaflet-retina" : "") + (et ? " leaflet-oldie" : "") + (_t ? " leaflet-safari" : "") + (this._fadeAnimated ? " leaflet-fade-anim" : "")); var i = hi(t, "position"); "absolute" !== i && "relative" !== i && "fixed" !== i && (t.style.position = "relative"), this._initPanes(), this._initControlPos && this._initControlPos() }, _initPanes: function () { var t = this._panes = {}; this._paneRenderers = {}, this._mapPane = this.createPane("mapPane", this._container), Pi(this._mapPane, new B(0, 0)), this.createPane("tilePane"), this.createPane("shadowPane"), this.createPane("overlayPane"), this.createPane("markerPane"), this.createPane("tooltipPane"), this.createPane("popupPane"), this.options.markerZoomAnimation || (mi(t.markerPane, "leaflet-zoom-hide"), mi(t.shadowPane, "leaflet-zoom-hide")) }, _resetView: function (t, i) { Pi(this._mapPane, new B(0, 0)); var e = !this._loaded; this._loaded = !0, i = this._limitZoom(i), this.fire("viewprereset"); var n = this._zoom !== i; this._moveStart(n, !1)._move(t, i)._moveEnd(n), this.fire("viewreset"), e && this.fire("load") }, _moveStart: function (t, i) { return t && this.fire("zoomstart"), i || this.fire("movestart"), this }, _move: function (t, i, e) { void 0 === i && (i = this._zoom); var n = this._zoom !== i; return this._zoom = i, this._lastCenter = t, this._pixelOrigin = this._getNewPixelOrigin(t), (n || e && e.pinch) && this.fire("zoom", e), this.fire("move", e) }, _moveEnd: function (t) { return t && this.fire("zoomend"), this.fire("moveend") }, _stop: function () { return C(this._flyToFrame), this._panAnim && this._panAnim.stop(), this }, _rawPanBy: function (t) { Pi(this._mapPane, this._getMapPanePos().subtract(t)) }, _getZoomSpan: function () { return this.getMaxZoom() - this.getMinZoom() }, _panInsideMaxBounds: function () { this._enforcingBounds || this.panInsideBounds(this.options.maxBounds) }, _checkIfLoaded: function () { if (!this._loaded) throw new Error("Set map center and zoom first.") }, _initEvents: function (t) { this._targets = {}; var i = t ? Ai : ki; i((this._targets[u(this._container)] = this)._container, "click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup", this._handleDOMEvent, this), this.options.trackResize && i(window, "resize", this._onResize, this), yt && this.options.transform3DLimit && (t ? this.off : this.on).call(this, "moveend", this._onMoveEnd) }, _onResize: function () { C(this._resizeRequest), this._resizeRequest = M(function () { this.invalidateSize({ debounceMoveend: !0 }) }, this) }, _onScroll: function () { this._container.scrollTop = 0, this._container.scrollLeft = 0 }, _onMoveEnd: function () { var t = this._getMapPanePos(); Math.max(Math.abs(t.x), Math.abs(t.y)) >= this.options.transform3DLimit && this._resetView(this.getCenter(), this.getZoom()) }, _findEventTargets: function (t, i) { for (var e, n = [], o = "mouseout" === i || "mouseover" === i, s = t.target || t.srcElement, r = !1; s;) { if ((e = this._targets[u(s)]) && ("click" === i || "preclick" === i) && !t._simulated && this._draggableMoved(e)) { r = !0; break } if (e && e.listens(i, !0)) { if (o && !Yi(s, t)) break; if (n.push(e), o) break } if (s === this._container) break; s = s.parentNode } return n.length || r || o || !Yi(s, t) || (n = [this]), n }, _handleDOMEvent: function (t) { if (this._loaded && !Ki(t)) { var i = t.type; "mousedown" !== i && "keypress" !== i && "keyup" !== i && "keydown" !== i || Mi(t.target || t.srcElement), this._fireDOMEvent(t, i) } }, _mouseEvents: ["click", "dblclick", "mouseover", "mouseout", "contextmenu"], _fireDOMEvent: function (t, i, e) { if ("click" === t.type) { var n = h({}, t); n.type = "preclick", this._fireDOMEvent(n, n.type, e) } if (!t._stopped && (e = (e || []).concat(this._findEventTargets(t, i))).length) { var o = e[0]; "contextmenu" === i && o.listens(i, !0) && ji(t); var s = { originalEvent: t }; if ("keypress" !== t.type && "keydown" !== t.type && "keyup" !== t.type) { var r = o.getLatLng && (!o._radius || o._radius <= 10); s.containerPoint = r ? this.latLngToContainerPoint(o.getLatLng()) : this.mouseEventToContainerPoint(t), s.layerPoint = this.containerPointToLayerPoint(s.containerPoint), s.latlng = r ? o.getLatLng() : this.layerPointToLatLng(s.layerPoint) } for (var a = 0; a < e.length; a++)if (e[a].fire(i, s, !0), s.originalEvent._stopped || !1 === e[a].options.bubblingMouseEvents && -1 !== y(this._mouseEvents, i)) return } }, _draggableMoved: function (t) { return (t = t.dragging && t.dragging.enabled() ? t : this).dragging && t.dragging.moved() || this.boxZoom && this.boxZoom.moved() }, _clearHandlers: function () { for (var t = 0, i = this._handlers.length; t < i; t++)this._handlers[t].disable() }, whenReady: function (t, i) { return this._loaded ? t.call(i || this, { target: this }) : this.on("load", t, i), this }, _getMapPanePos: function () { return Li(this._mapPane) || new B(0, 0) }, _moved: function () { var t = this._getMapPanePos(); return t && !t.equals([0, 0]) }, _getTopLeftPoint: function (t, i) { return (t && void 0 !== i ? this._getNewPixelOrigin(t, i) : this.getPixelOrigin()).subtract(this._getMapPanePos()) }, _getNewPixelOrigin: function (t, i) { var e = this.getSize()._divideBy(2); return this.project(t, i)._subtract(e)._add(this._getMapPanePos())._round() }, _latLngToNewLayerPoint: function (t, i, e) { var n = this._getNewPixelOrigin(e, i); return this.project(t, i)._subtract(n) }, _latLngBoundsToNewLayerBounds: function (t, i, e) { var n = this._getNewPixelOrigin(e, i); return R([this.project(t.getSouthWest(), i)._subtract(n), this.project(t.getNorthWest(), i)._subtract(n), this.project(t.getSouthEast(), i)._subtract(n), this.project(t.getNorthEast(), i)._subtract(n)]) }, _getCenterLayerPoint: function () { return this.containerPointToLayerPoint(this.getSize()._divideBy(2)) }, _getCenterOffset: function (t) { return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint()) }, _limitCenter: function (t, i, e) { if (!e) return t; var n = this.project(t, i), o = this.getSize().divideBy(2), s = new O(n.subtract(o), n.add(o)), r = this._getBoundsOffset(s, e, i); return r.round().equals([0, 0]) ? t : this.unproject(n.add(r), i) }, _limitOffset: function (t, i) { if (!i) return t; var e = this.getPixelBounds(), n = new O(e.min.add(t), e.max.add(t)); return t.add(this._getBoundsOffset(n, i)) }, _getBoundsOffset: function (t, i, e) { var n = R(this.project(i.getNorthEast(), e), this.project(i.getSouthWest(), e)), o = n.min.subtract(t.min), s = n.max.subtract(t.max); return new B(this._rebound(o.x, -s.x), this._rebound(o.y, -s.y)) }, _rebound: function (t, i) { return 0 < t + i ? Math.round(t - i) / 2 : Math.max(0, Math.ceil(t)) - Math.max(0, Math.floor(i)) }, _limitZoom: function (t) { var i = this.getMinZoom(), e = this.getMaxZoom(), n = yt ? this.options.zoomSnap : 1; return n && (t = Math.round(t / n) * n), Math.max(i, Math.min(e, t)) }, _onPanTransitionStep: function () { this.fire("move") }, _onPanTransitionEnd: function () { fi(this._mapPane, "leaflet-pan-anim"), this.fire("moveend") }, _tryAnimatedPan: function (t, i) { var e = this._getCenterOffset(t)._trunc(); return !(!0 !== (i && i.animate) && !this.getSize().contains(e)) && (this.panBy(e, i), !0) }, _createAnimProxy: function () { var t = this._proxy = ui("div", "leaflet-proxy leaflet-zoom-animated"); this._panes.mapPane.appendChild(t), this.on("zoomanim", function (t) { var i = oi, e = this._proxy.style[i]; wi(this._proxy, this.project(t.center, t.zoom), this.getZoomScale(t.zoom, 1)), e === this._proxy.style[i] && this._animatingZoom && this._onZoomTransitionEnd() }, this), this.on("load moveend", this._animMoveEnd, this), this._on("unload", this._destroyAnimProxy, this) }, _destroyAnimProxy: function () { li(this._proxy), this.off("load moveend", this._animMoveEnd, this), delete this._proxy }, _animMoveEnd: function () { var t = this.getCenter(), i = this.getZoom(); wi(this._proxy, this.project(t, i), this.getZoomScale(i, 1)) }, _catchTransitionEnd: function (t) { this._animatingZoom && 0 <= t.propertyName.indexOf("transform") && this._onZoomTransitionEnd() }, _nothingToAnimate: function () { return !this._container.getElementsByClassName("leaflet-zoom-animated").length }, _tryAnimatedZoom: function (t, i, e) { if (this._animatingZoom) return !0; if (e = e || {}, !this._zoomAnimated || !1 === e.animate || this._nothingToAnimate() || Math.abs(i - this._zoom) > this.options.zoomAnimationThreshold) return !1; var n = this.getZoomScale(i), o = this._getCenterOffset(t)._divideBy(1 - 1 / n); return !(!0 !== e.animate && !this.getSize().contains(o)) && (M(function () { this._moveStart(!0, !1)._animateZoom(t, i, !0) }, this), !0) }, _animateZoom: function (t, i, e, n) { this._mapPane && (e && (this._animatingZoom = !0, this._animateToCenter = t, this._animateToZoom = i, mi(this._mapPane, "leaflet-zoom-anim")), this.fire("zoomanim", { center: t, zoom: i, noUpdate: n }), setTimeout(a(this._onZoomTransitionEnd, this), 250)) }, _onZoomTransitionEnd: function () { this._animatingZoom && (this._mapPane && fi(this._mapPane, "leaflet-zoom-anim"), this._animatingZoom = !1, this._move(this._animateToCenter, this._animateToZoom), M(function () { this._moveEnd(!0) }, this)) } }); function Qi(t) { return new te(t) } var te = E.extend({ options: { position: "topright" }, initialize: function (t) { p(this, t) }, getPosition: function () { return this.options.position }, setPosition: function (t) { var i = this._map; return i && i.removeControl(this), this.options.position = t, i && i.addControl(this), this }, getContainer: function () { return this._container }, addTo: function (t) { this.remove(), this._map = t; var i = this._container = this.onAdd(t), e = this.getPosition(), n = t._controlCorners[e]; return mi(i, "leaflet-control"), -1 !== e.indexOf("bottom") ? n.insertBefore(i, n.firstChild) : n.appendChild(i), this._map.on("unload", this.remove, this), this }, remove: function () { return this._map && (li(this._container), this.onRemove && this.onRemove(this._map), this._map.off("unload", this.remove, this), this._map = null), this }, _refocusOnMap: function (t) { this._map && t && 0 < t.screenX && 0 < t.screenY && this._map.getContainer().focus() } }); $i.include({ addControl: function (t) { return t.addTo(this), this }, removeControl: function (t) { return t.remove(), this }, _initControlPos: function () { var n = this._controlCorners = {}, o = "leaflet-", s = this._controlContainer = ui("div", o + "control-container", this._container); function t(t, i) { var e = o + t + " " + o + i; n[t + i] = ui("div", e, s) } t("top", "left"), t("top", "right"), t("bottom", "left"), t("bottom", "right") }, _clearControlPos: function () { for (var t in this._controlCorners) li(this._controlCorners[t]); li(this._controlContainer), delete this._controlCorners, delete this._controlContainer } }); var ie = te.extend({ options: { collapsed: !0, position: "topright", autoZIndex: !0, hideSingleBase: !1, sortLayers: !1, sortFunction: function (t, i, e, n) { return e < n ? -1 : n < e ? 1 : 0 } }, initialize: function (t, i, e) { for (var n in p(this, e), this._layerControlInputs = [], this._layers = [], this._lastZIndex = 0, this._handlingClick = !1, t) this._addLayer(t[n], n); for (n in i) this._addLayer(i[n], n, !0) }, onAdd: function (t) { this._initLayout(), this._update(), (this._map = t).on("zoomend", this._checkDisabledLayers, this); for (var i = 0; i < this._layers.length; i++)this._layers[i].layer.on("add remove", this._onLayerChange, this); return this._container }, addTo: function (t) { return te.prototype.addTo.call(this, t), this._expandIfNotCollapsed() }, onRemove: function () { this._map.off("zoomend", this._checkDisabledLayers, this); for (var t = 0; t < this._layers.length; t++)this._layers[t].layer.off("add remove", this._onLayerChange, this) }, addBaseLayer: function (t, i) { return this._addLayer(t, i), this._map ? this._update() : this }, addOverlay: function (t, i) { return this._addLayer(t, i, !0), this._map ? this._update() : this }, removeLayer: function (t) { t.off("add remove", this._onLayerChange, this); var i = this._getLayer(u(t)); return i && this._layers.splice(this._layers.indexOf(i), 1), this._map ? this._update() : this }, expand: function () { mi(this._container, "leaflet-control-layers-expanded"), this._section.style.height = null; var t = this._map.getSize().y - (this._container.offsetTop + 50); return t < this._section.clientHeight ? (mi(this._section, "leaflet-control-layers-scrollbar"), this._section.style.height = t + "px") : fi(this._section, "leaflet-control-layers-scrollbar"), this._checkDisabledLayers(), this }, collapse: function () { return fi(this._container, "leaflet-control-layers-expanded"), this }, _initLayout: function () { var t = "leaflet-control-layers", i = this._container = ui("div", t), e = this.options.collapsed; i.setAttribute("aria-haspopup", !0), Di(i), Ni(i); var n = this._section = ui("section", t + "-list"); e && (this._map.on("click", this.collapse, this), st || ki(i, { mouseenter: this.expand, mouseleave: this.collapse }, this)); var o = this._layersLink = ui("a", t + "-toggle", i); o.href = "#", o.title = "Layers", Tt ? (ki(o, "click", Wi), ki(o, "click", this.expand, this)) : ki(o, "focus", this.expand, this), e || this.expand(), this._baseLayersList = ui("div", t + "-base", n), this._separator = ui("div", t + "-separator", n), this._overlaysList = ui("div", t + "-overlays", n), i.appendChild(n) }, _getLayer: function (t) { for (var i = 0; i < this._layers.length; i++)if (this._layers[i] && u(this._layers[i].layer) === t) return this._layers[i] }, _addLayer: function (t, i, e) { this._map && t.on("add remove", this._onLayerChange, this), this._layers.push({ layer: t, name: i, overlay: e }), this.options.sortLayers && this._layers.sort(a(function (t, i) { return this.options.sortFunction(t.layer, i.layer, t.name, i.name) }, this)), this.options.autoZIndex && t.setZIndex && (this._lastZIndex++ , t.setZIndex(this._lastZIndex)), this._expandIfNotCollapsed() }, _update: function () { if (!this._container) return this; ci(this._baseLayersList), ci(this._overlaysList), this._layerControlInputs = []; var t, i, e, n, o = 0; for (e = 0; e < this._layers.length; e++)n = this._layers[e], this._addItem(n), i = i || n.overlay, t = t || !n.overlay, o += n.overlay ? 0 : 1; return this.options.hideSingleBase && (t = t && 1 < o, this._baseLayersList.style.display = t ? "" : "none"), this._separator.style.display = i && t ? "" : "none", this }, _onLayerChange: function (t) { this._handlingClick || this._update(); var i = this._getLayer(u(t.target)), e = i.overlay ? "add" === t.type ? "overlayadd" : "overlayremove" : "add" === t.type ? "baselayerchange" : null; e && this._map.fire(e, i) }, _createRadioElement: function (t, i) { var e = '", n = document.createElement("div"); return n.innerHTML = e, n.firstChild }, _addItem: function (t) { var i, e = document.createElement("label"), n = this._map.hasLayer(t.layer); t.overlay ? ((i = document.createElement("input")).type = "checkbox", i.className = "leaflet-control-layers-selector", i.defaultChecked = n) : i = this._createRadioElement("leaflet-base-layers_" + u(this), n), this._layerControlInputs.push(i), i.layerId = u(t.layer), ki(i, "click", this._onInputClick, this); var o = document.createElement("span"); o.innerHTML = " " + t.name; var s = document.createElement("div"); return e.appendChild(s), s.appendChild(i), s.appendChild(o), (t.overlay ? this._overlaysList : this._baseLayersList).appendChild(e), this._checkDisabledLayers(), e }, _onInputClick: function () { var t, i, e = this._layerControlInputs, n = [], o = []; this._handlingClick = !0; for (var s = e.length - 1; 0 <= s; s--)t = e[s], i = this._getLayer(t.layerId).layer, t.checked ? n.push(i) : t.checked || o.push(i); for (s = 0; s < o.length; s++)this._map.hasLayer(o[s]) && this._map.removeLayer(o[s]); for (s = 0; s < n.length; s++)this._map.hasLayer(n[s]) || this._map.addLayer(n[s]); this._handlingClick = !1, this._refocusOnMap() }, _checkDisabledLayers: function () { for (var t, i, e = this._layerControlInputs, n = this._map.getZoom(), o = e.length - 1; 0 <= o; o--)t = e[o], i = this._getLayer(t.layerId).layer, t.disabled = void 0 !== i.options.minZoom && n < i.options.minZoom || void 0 !== i.options.maxZoom && n > i.options.maxZoom }, _expandIfNotCollapsed: function () { return this._map && !this.options.collapsed && this.expand(), this }, _expand: function () { return this.expand() }, _collapse: function () { return this.collapse() } }), ee = te.extend({ options: { position: "topleft", zoomInText: "+", zoomInTitle: "Zoom in", zoomOutText: "−", zoomOutTitle: "Zoom out" }, onAdd: function (t) { var i = "leaflet-control-zoom", e = ui("div", i + " leaflet-bar"), n = this.options; return this._zoomInButton = this._createButton(n.zoomInText, n.zoomInTitle, i + "-in", e, this._zoomIn), this._zoomOutButton = this._createButton(n.zoomOutText, n.zoomOutTitle, i + "-out", e, this._zoomOut), this._updateDisabled(), t.on("zoomend zoomlevelschange", this._updateDisabled, this), e }, onRemove: function (t) { t.off("zoomend zoomlevelschange", this._updateDisabled, this) }, disable: function () { return this._disabled = !0, this._updateDisabled(), this }, enable: function () { return this._disabled = !1, this._updateDisabled(), this }, _zoomIn: function (t) { !this._disabled && this._map._zoom < this._map.getMaxZoom() && this._map.zoomIn(this._map.options.zoomDelta * (t.shiftKey ? 3 : 1)) }, _zoomOut: function (t) { !this._disabled && this._map._zoom > this._map.getMinZoom() && this._map.zoomOut(this._map.options.zoomDelta * (t.shiftKey ? 3 : 1)) }, _createButton: function (t, i, e, n, o) { var s = ui("a", e, n); return s.innerHTML = t, s.href = "#", s.title = i, s.setAttribute("role", "button"), s.setAttribute("aria-label", i), Di(s), ki(s, "click", Wi), ki(s, "click", o, this), ki(s, "click", this._refocusOnMap, this), s }, _updateDisabled: function () { var t = this._map, i = "leaflet-disabled"; fi(this._zoomInButton, i), fi(this._zoomOutButton, i), !this._disabled && t._zoom !== t.getMinZoom() || mi(this._zoomOutButton, i), !this._disabled && t._zoom !== t.getMaxZoom() || mi(this._zoomInButton, i) } }); $i.mergeOptions({ zoomControl: !0 }), $i.addInitHook(function () { this.options.zoomControl && (this.zoomControl = new ee, this.addControl(this.zoomControl)) }); var ne = te.extend({ options: { position: "bottomleft", maxWidth: 100, metric: !0, imperial: !0 }, onAdd: function (t) { var i = "leaflet-control-scale", e = ui("div", i), n = this.options; return this._addScales(n, i + "-line", e), t.on(n.updateWhenIdle ? "moveend" : "move", this._update, this), t.whenReady(this._update, this), e }, onRemove: function (t) { t.off(this.options.updateWhenIdle ? "moveend" : "move", this._update, this) }, _addScales: function (t, i, e) { t.metric && (this._mScale = ui("div", i, e)), t.imperial && (this._iScale = ui("div", i, e)) }, _update: function () { var t = this._map, i = t.getSize().y / 2, e = t.distance(t.containerPointToLatLng([0, i]), t.containerPointToLatLng([this.options.maxWidth, i])); this._updateScales(e) }, _updateScales: function (t) { this.options.metric && t && this._updateMetric(t), this.options.imperial && t && this._updateImperial(t) }, _updateMetric: function (t) { var i = this._getRoundNum(t), e = i < 1e3 ? i + " m" : i / 1e3 + " km"; this._updateScale(this._mScale, e, i / t) }, _updateImperial: function (t) { var i, e, n, o = 3.2808399 * t; 5280 < o ? (i = o / 5280, e = this._getRoundNum(i), this._updateScale(this._iScale, e + " mi", e / i)) : (n = this._getRoundNum(o), this._updateScale(this._iScale, n + " ft", n / o)) }, _updateScale: function (t, i, e) { t.style.width = Math.round(this.options.maxWidth * e) + "px", t.innerHTML = i }, _getRoundNum: function (t) { var i = Math.pow(10, (Math.floor(t) + "").length - 1), e = t / i; return i * (e = 10 <= e ? 10 : 5 <= e ? 5 : 3 <= e ? 3 : 2 <= e ? 2 : 1) } }), oe = te.extend({ options: { position: "bottomright", prefix: '© PlanPlus' }, initialize: function (t) { p(this, t), this._attributions = {} }, onAdd: function (t) { for (var i in (t.attributionControl = this)._container = ui("div", "leaflet-control-attribution"), Di(this._container), t._layers) t._layers[i].getAttribution && this.addAttribution(t._layers[i].getAttribution()); return this._update(), this._container }, setPrefix: function (t) { return this.options.prefix = t, this._update(), this }, addAttribution: function (t) { return t && (this._attributions[t] || (this._attributions[t] = 0), this._attributions[t]++ , this._update()), this }, removeAttribution: function (t) { return t && this._attributions[t] && (this._attributions[t]-- , this._update()), this }, _update: function () { if (this._map) { var t = []; for (var i in this._attributions) this._attributions[i] && t.push(i); var e = []; this.options.prefix && e.push(this.options.prefix), t.length && e.push(t.join(", ")), this._container.innerHTML = e.join(" | ") } } }); $i.mergeOptions({ attributionControl: !0 }), $i.addInitHook(function () { this.options.attributionControl && (new oe).addTo(this) }); te.Layers = ie, te.Zoom = ee, te.Scale = ne, te.Attribution = oe, Qi.layers = function (t, i, e) { return new ie(t, i, e) }, Qi.zoom = function (t) { return new ee(t) }, Qi.scale = function (t) { return new ne(t) }, Qi.attribution = function (t) { return new oe(t) }; var se = E.extend({ initialize: function (t) { this._map = t }, enable: function () { return this._enabled || (this._enabled = !0, this.addHooks()), this }, disable: function () { return this._enabled && (this._enabled = !1, this.removeHooks()), this }, enabled: function () { return !!this._enabled } }); se.addTo = function (t, i) { return t.addHandler(i, this), this }; var re, ae = { Events: Z }, he = Tt ? "touchstart mousedown" : "mousedown", ue = { mousedown: "mouseup", touchstart: "touchend", pointerdown: "touchend", MSPointerDown: "touchend" }, le = { mousedown: "mousemove", touchstart: "touchmove", pointerdown: "touchmove", MSPointerDown: "touchmove" }, ce = k.extend({ options: { clickTolerance: 3 }, initialize: function (t, i, e, n) { p(this, n), this._element = t, this._dragStartTarget = i || t, this._preventOutline = e }, enable: function () { this._enabled || (ki(this._dragStartTarget, he, this._onDown, this), this._enabled = !0) }, disable: function () { this._enabled && (ce._dragging === this && this.finishDrag(), Ai(this._dragStartTarget, he, this._onDown, this), this._enabled = !1, this._moved = !1) }, _onDown: function (t) { if (!t._simulated && this._enabled && (this._moved = !1, !pi(this._element, "leaflet-zoom-anim") && !(ce._dragging || t.shiftKey || 1 !== t.which && 1 !== t.button && !t.touches || ((ce._dragging = this)._preventOutline && Mi(this._element), Ti(), Qt(), this._moving)))) { this.fire("down"); var i = t.touches ? t.touches[0] : t, e = Si(this._element); this._startPoint = new B(i.clientX, i.clientY), this._parentScale = Ei(e), ki(document, le[t.type], this._onMove, this), ki(document, ue[t.type], this._onUp, this) } }, _onMove: function (t) { if (!t._simulated && this._enabled) if (t.touches && 1 < t.touches.length) this._moved = !0; else { var i = t.touches && 1 === t.touches.length ? t.touches[0] : t, e = new B(i.clientX, i.clientY)._subtract(this._startPoint); (e.x || e.y) && (Math.abs(e.x) + Math.abs(e.y) < this.options.clickTolerance || (e.x /= this._parentScale.x, e.y /= this._parentScale.y, ji(t), this._moved || (this.fire("dragstart"), this._moved = !0, this._startPos = Li(this._element).subtract(e), mi(document.body, "leaflet-dragging"), this._lastTarget = t.target || t.srcElement, window.SVGElementInstance && this._lastTarget instanceof SVGElementInstance && (this._lastTarget = this._lastTarget.correspondingUseElement), mi(this._lastTarget, "leaflet-drag-target")), this._newPos = this._startPos.add(e), this._moving = !0, C(this._animRequest), this._lastEvent = t, this._animRequest = M(this._updatePosition, this, !0))) } }, _updatePosition: function () { var t = { originalEvent: this._lastEvent }; this.fire("predrag", t), Pi(this._element, this._newPos), this.fire("drag", t) }, _onUp: function (t) { !t._simulated && this._enabled && this.finishDrag() }, finishDrag: function () { for (var t in fi(document.body, "leaflet-dragging"), this._lastTarget && (fi(this._lastTarget, "leaflet-drag-target"), this._lastTarget = null), le) Ai(document, le[t], this._onMove, this), Ai(document, ue[t], this._onUp, this); zi(), ti(), this._moved && this._moving && (C(this._animRequest), this.fire("dragend", { distance: this._newPos.distanceTo(this._startPos) })), this._moving = !1, ce._dragging = !1 } }); function _e(t, i) { if (!i || !t.length) return t.slice(); var e = i * i; return t = function (t, i) { var e = t.length, n = new (typeof Uint8Array != void 0 + "" ? Uint8Array : Array)(e); n[0] = n[e - 1] = 1, function t(i, e, n, o, s) { var r, a, h, u = 0; for (a = o + 1; a <= s - 1; a++)h = ge(i[a], i[o], i[s], !0), u < h && (r = a, u = h); n < u && (e[r] = 1, t(i, e, n, o, r), t(i, e, n, r, s)) }(t, n, i, 0, e - 1); var o, s = []; for (o = 0; o < e; o++)n[o] && s.push(t[o]); return s }(t = function (t, i) { for (var e = [t[0]], n = 1, o = 0, s = t.length; n < s; n++)r = t[n], a = t[o], void 0, h = a.x - r.x, u = a.y - r.y, i < h * h + u * u && (e.push(t[n]), o = n); var r, a, h, u; o < s - 1 && e.push(t[s - 1]); return e }(t, e), e) } function de(t, i, e) { return Math.sqrt(ge(t, i, e, !0)) } function pe(t, i, e, n, o) { var s, r, a, h = n ? re : fe(t, e), u = fe(i, e); for (re = u; ;) { if (!(h | u)) return [t, i]; if (h & u) return !1; a = fe(r = me(t, i, s = h || u, e, o), e), s === h ? (t = r, h = a) : (i = r, u = a) } } function me(t, i, e, n, o) { var s, r, a = i.x - t.x, h = i.y - t.y, u = n.min, l = n.max; return 8 & e ? (s = t.x + a * (l.y - t.y) / h, r = l.y) : 4 & e ? (s = t.x + a * (u.y - t.y) / h, r = u.y) : 2 & e ? (s = l.x, r = t.y + h * (l.x - t.x) / a) : 1 & e && (s = u.x, r = t.y + h * (u.x - t.x) / a), new B(s, r, o) } function fe(t, i) { var e = 0; return t.x < i.min.x ? e |= 1 : t.x > i.max.x && (e |= 2), t.y < i.min.y ? e |= 4 : t.y > i.max.y && (e |= 8), e } function ge(t, i, e, n) { var o, s = i.x, r = i.y, a = e.x - s, h = e.y - r, u = a * a + h * h; return 0 < u && (1 < (o = ((t.x - s) * a + (t.y - r) * h) / u) ? (s = e.x, r = e.y) : 0 < o && (s += a * o, r += h * o)), a = t.x - s, h = t.y - r, n ? a * a + h * h : new B(s, r) } function ve(t) { return !v(t[0]) || "object" != typeof t[0][0] && void 0 !== t[0][0] } function ye(t) { return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."), ve(t) } var xe = (Object.freeze || Object)({ simplify: _e, pointToSegmentDistance: de, closestPointOnSegment: function (t, i, e) { return ge(t, i, e) }, clipSegment: pe, _getEdgeIntersection: me, _getBitCode: fe, _sqClosestPointOnSegment: ge, isFlat: ve, _flat: ye }); function we(t, i, e) { var n, o, s, r, a, h, u, l, c, _ = [1, 4, 2, 8]; for (o = 0, u = t.length; o < u; o++)t[o]._code = fe(t[o], i); for (r = 0; r < 4; r++) { for (l = _[r], n = [], o = 0, s = (u = t.length) - 1; o < u; s = o++)a = t[o], h = t[s], a._code & l ? h._code & l || ((c = me(h, a, l, i, e))._code = fe(c, i), n.push(c)) : (h._code & l && ((c = me(h, a, l, i, e))._code = fe(c, i), n.push(c)), n.push(a)); t = n } return t } var Pe, Le = (Object.freeze || Object)({ clipPolygon: we }), be = { project: function (t) { return new B(t.lng, t.lat) }, unproject: function (t) { return new j(t.y, t.x) }, bounds: new O([-180, -90], [180, 90]) }, Te = { R: 6378137, R_MINOR: 6356752.314245179, bounds: new O([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]), project: function (t) { var i = Math.PI / 180, e = this.R, n = t.lat * i, o = this.R_MINOR / e, s = Math.sqrt(1 - o * o), r = s * Math.sin(n), a = Math.tan(Math.PI / 4 - n / 2) / Math.pow((1 - r) / (1 + r), s / 2); return n = -e * Math.log(Math.max(a, 1e-10)), new B(t.lng * i * e, n) }, unproject: function (t) { for (var i, e = 180 / Math.PI, n = this.R, o = this.R_MINOR / n, s = Math.sqrt(1 - o * o), r = Math.exp(-t.y / n), a = Math.PI / 2 - 2 * Math.atan(r), h = 0, u = .1; h < 15 && 1e-7 < Math.abs(u); h++)i = s * Math.sin(a), i = Math.pow((1 - i) / (1 + i), s / 2), a += u = Math.PI / 2 - 2 * Math.atan(r * i) - a; return new j(a * e, t.x * e / n) } }, ze = (Object.freeze || Object)({ LonLat: be, Mercator: Te, SphericalMercator: q }), Me = h({}, U, { code: "EPSG:3395", projection: Te, transformation: (Pe = .5 / (Math.PI * Te.R), K(Pe, .5, -Pe, .5)) }), Ce = h({}, U, { code: "EPSG:4326", projection: be, transformation: K(1 / 180, 1, -1 / 180, .5) }), Se = h({}, F, { projection: be, transformation: K(1, 0, -1, 0), scale: function (t) { return Math.pow(2, t) }, zoom: function (t) { return Math.log(t) / Math.LN2 }, distance: function (t, i) { var e = i.lng - t.lng, n = i.lat - t.lat; return Math.sqrt(e * e + n * n) }, infinite: !0 }); F.Earth = U, F.EPSG3395 = Me, F.EPSG3857 = X, F.EPSG900913 = J, F.EPSG4326 = Ce, F.Simple = Se; var Ee = k.extend({ options: { pane: "overlayPane", attribution: null, bubblingMouseEvents: !0 }, addTo: function (t) { return t.addLayer(this), this }, remove: function () { return this.removeFrom(this._map || this._mapToAdd) }, removeFrom: function (t) { return t && t.removeLayer(this), this }, getPane: function (t) { return this._map.getPane(t ? this.options[t] || t : this.options.pane) }, addInteractiveTarget: function (t) { return this._map._targets[u(t)] = this }, removeInteractiveTarget: function (t) { return delete this._map._targets[u(t)], this }, getAttribution: function () { return this.options.attribution }, _layerAdd: function (t) { var i = t.target; if (i.hasLayer(this)) { if (this._map = i, this._zoomAnimated = i._zoomAnimated, this.getEvents) { var e = this.getEvents(); i.on(e, this), this.once("remove", function () { i.off(e, this) }, this) } this.onAdd(i), this.getAttribution && i.attributionControl && i.attributionControl.addAttribution(this.getAttribution()), this.fire("add"), i.fire("layeradd", { layer: this }) } } }); $i.include({ addLayer: function (t) { if (!t._layerAdd) throw new Error("The provided object is not a Layer."); var i = u(t); return this._layers[i] || ((this._layers[i] = t)._mapToAdd = this, t.beforeAdd && t.beforeAdd(this), this.whenReady(t._layerAdd, t)), this }, removeLayer: function (t) { var i = u(t); return this._layers[i] && (this._loaded && t.onRemove(this), t.getAttribution && this.attributionControl && this.attributionControl.removeAttribution(t.getAttribution()), delete this._layers[i], this._loaded && (this.fire("layerremove", { layer: t }), t.fire("remove")), t._map = t._mapToAdd = null), this }, hasLayer: function (t) { return !!t && u(t) in this._layers }, eachLayer: function (t, i) { for (var e in this._layers) t.call(i, this._layers[e]); return this }, _addLayers: function (t) { for (var i = 0, e = (t = t ? v(t) ? t : [t] : []).length; i < e; i++)this.addLayer(t[i]) }, _addZoomLimit: function (t) { !isNaN(t.options.maxZoom) && isNaN(t.options.minZoom) || (this._zoomBoundLayers[u(t)] = t, this._updateZoomLevels()) }, _removeZoomLimit: function (t) { var i = u(t); this._zoomBoundLayers[i] && (delete this._zoomBoundLayers[i], this._updateZoomLevels()) }, _updateZoomLevels: function () { var t = 1 / 0, i = -1 / 0, e = this._getZoomSpan(); for (var n in this._zoomBoundLayers) { var o = this._zoomBoundLayers[n].options; t = void 0 === o.minZoom ? t : Math.min(t, o.minZoom), i = void 0 === o.maxZoom ? i : Math.max(i, o.maxZoom) } this._layersMaxZoom = i === -1 / 0 ? void 0 : i, this._layersMinZoom = t === 1 / 0 ? void 0 : t, e !== this._getZoomSpan() && this.fire("zoomlevelschange"), void 0 === this.options.maxZoom && this._layersMaxZoom && this.getZoom() > this._layersMaxZoom && this.setZoom(this._layersMaxZoom), void 0 === this.options.minZoom && this._layersMinZoom && this.getZoom() < this._layersMinZoom && this.setZoom(this._layersMinZoom) } }); var Ze = Ee.extend({ initialize: function (t, i) { var e, n; if (p(this, i), this._layers = {}, t) for (e = 0, n = t.length; e < n; e++)this.addLayer(t[e]) }, addLayer: function (t) { var i = this.getLayerId(t); return this._layers[i] = t, this._map && this._map.addLayer(t), this }, removeLayer: function (t) { var i = t in this._layers ? t : this.getLayerId(t); return this._map && this._layers[i] && this._map.removeLayer(this._layers[i]), delete this._layers[i], this }, hasLayer: function (t) { return !!t && (t in this._layers || this.getLayerId(t) in this._layers) }, clearLayers: function () { return this.eachLayer(this.removeLayer, this) }, invoke: function (t) { var i, e, n = Array.prototype.slice.call(arguments, 1); for (i in this._layers) (e = this._layers[i])[t] && e[t].apply(e, n); return this }, onAdd: function (t) { this.eachLayer(t.addLayer, t) }, onRemove: function (t) { this.eachLayer(t.removeLayer, t) }, eachLayer: function (t, i) { for (var e in this._layers) t.call(i, this._layers[e]); return this }, getLayer: function (t) { return this._layers[t] }, getLayers: function () { var t = []; return this.eachLayer(t.push, t), t }, setZIndex: function (t) { return this.invoke("setZIndex", t) }, getLayerId: function (t) { return u(t) } }), ke = Ze.extend({ addLayer: function (t) { return this.hasLayer(t) ? this : (t.addEventParent(this), Ze.prototype.addLayer.call(this, t), this.fire("layeradd", { layer: t })) }, removeLayer: function (t) { return this.hasLayer(t) ? (t in this._layers && (t = this._layers[t]), t.removeEventParent(this), Ze.prototype.removeLayer.call(this, t), this.fire("layerremove", { layer: t })) : this }, setStyle: function (t) { return this.invoke("setStyle", t) }, bringToFront: function () { return this.invoke("bringToFront") }, bringToBack: function () { return this.invoke("bringToBack") }, getBounds: function () { var t = new N; for (var i in this._layers) { var e = this._layers[i]; t.extend(e.getBounds ? e.getBounds() : e.getLatLng()) } return t } }), Be = E.extend({ options: { popupAnchor: [0, 0], tooltipAnchor: [0, 0] }, initialize: function (t) { p(this, t) }, createIcon: function (t) { return this._createIcon("icon", t) }, createShadow: function (t) { return this._createIcon("shadow", t) }, _createIcon: function (t, i) { var e = this._getIconUrl(t); if (!e) { if ("icon" === t) throw new Error("iconUrl not set in Icon options (see the docs)."); return null } var n = this._createImg(e, i && "IMG" === i.tagName ? i : null); return this._setIconStyles(n, t), n }, _setIconStyles: function (t, i) { var e = this.options, n = e[i + "Size"]; "number" == typeof n && (n = [n, n]); var o = I(n), s = I("shadow" === i && e.shadowAnchor || e.iconAnchor || o && o.divideBy(2, !0)); t.className = "leaflet-marker-" + i + " " + (e.className || ""), s && (t.style.marginLeft = -s.x + "px", t.style.marginTop = -s.y + "px"), o && (t.style.width = o.x + "px", t.style.height = o.y + "px") }, _createImg: function (t, i) { return (i = i || document.createElement("img")).src = t, i }, _getIconUrl: function (t) { return Ct && this.options[t + "RetinaUrl"] || this.options[t + "Url"] } }); var Ae = Be.extend({ options: { iconUrl: "marker-icon.png", iconRetinaUrl: "marker-icon-2x.png", shadowUrl: "marker-shadow.png", iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], tooltipAnchor: [16, -28], shadowSize: [41, 41] }, _getIconUrl: function (t) { return Ae.imagePath || (Ae.imagePath = this._detectIconPath()), (this.options.imagePath || Ae.imagePath) + Be.prototype._getIconUrl.call(this, t) }, _detectIconPath: function () { var t = ui("div", "leaflet-default-icon-path", document.body), i = hi(t, "background-image") || hi(t, "backgroundImage"); return document.body.removeChild(t), i = null === i || 0 !== i.indexOf("url") ? "" : i.replace(/^url\(["']?/, "").replace(/marker-icon\.png["']?\)$/, "") } }), Ie = se.extend({ initialize: function (t) { this._marker = t }, addHooks: function () { var t = this._marker._icon; this._draggable || (this._draggable = new ce(t, t, !0)), this._draggable.on({ dragstart: this._onDragStart, predrag: this._onPreDrag, drag: this._onDrag, dragend: this._onDragEnd }, this).enable(), mi(t, "leaflet-marker-draggable") }, removeHooks: function () { this._draggable.off({ dragstart: this._onDragStart, predrag: this._onPreDrag, drag: this._onDrag, dragend: this._onDragEnd }, this).disable(), this._marker._icon && fi(this._marker._icon, "leaflet-marker-draggable") }, moved: function () { return this._draggable && this._draggable._moved }, _adjustPan: function (t) { var i = this._marker, e = i._map, n = this._marker.options.autoPanSpeed, o = this._marker.options.autoPanPadding, s = Li(i._icon), r = e.getPixelBounds(), a = e.getPixelOrigin(), h = R(r.min._subtract(a).add(o), r.max._subtract(a).subtract(o)); if (!h.contains(s)) { var u = I((Math.max(h.max.x, s.x) - h.max.x) / (r.max.x - h.max.x) - (Math.min(h.min.x, s.x) - h.min.x) / (r.min.x - h.min.x), (Math.max(h.max.y, s.y) - h.max.y) / (r.max.y - h.max.y) - (Math.min(h.min.y, s.y) - h.min.y) / (r.min.y - h.min.y)).multiplyBy(n); e.panBy(u, { animate: !1 }), this._draggable._newPos._add(u), this._draggable._startPos._add(u), Pi(i._icon, this._draggable._newPos), this._onDrag(t), this._panRequest = M(this._adjustPan.bind(this, t)) } }, _onDragStart: function () { this._oldLatLng = this._marker.getLatLng(), this._marker.closePopup().fire("movestart").fire("dragstart") }, _onPreDrag: function (t) { this._marker.options.autoPan && (C(this._panRequest), this._panRequest = M(this._adjustPan.bind(this, t))) }, _onDrag: function (t) { var i = this._marker, e = i._shadow, n = Li(i._icon), o = i._map.layerPointToLatLng(n); e && Pi(e, n), i._latlng = o, t.latlng = o, t.oldLatLng = this._oldLatLng, i.fire("move", t).fire("drag", t) }, _onDragEnd: function (t) { C(this._panRequest), delete this._oldLatLng, this._marker.fire("moveend").fire("dragend", t) } }), Oe = Ee.extend({ options: { icon: new Ae, interactive: !0, keyboard: !0, title: "", alt: "", zIndexOffset: 0, opacity: 1, riseOnHover: !1, riseOffset: 250, pane: "markerPane", shadowPane: "shadowPane", bubblingMouseEvents: !1, draggable: !1, autoPan: !1, autoPanPadding: [50, 50], autoPanSpeed: 10 }, initialize: function (t, i) { p(this, i), this._latlng = W(t) }, onAdd: function (t) { this._zoomAnimated = this._zoomAnimated && t.options.markerZoomAnimation, this._zoomAnimated && t.on("zoomanim", this._animateZoom, this), this._initIcon(), this.update() }, onRemove: function (t) { this.dragging && this.dragging.enabled() && (this.options.draggable = !0, this.dragging.removeHooks()), delete this.dragging, this._zoomAnimated && t.off("zoomanim", this._animateZoom, this), this._removeIcon(), this._removeShadow() }, getEvents: function () { return { zoom: this.update, viewreset: this.update } }, getLatLng: function () { return this._latlng }, setLatLng: function (t) { var i = this._latlng; return this._latlng = W(t), this.update(), this.fire("move", { oldLatLng: i, latlng: this._latlng }) }, setZIndexOffset: function (t) { return this.options.zIndexOffset = t, this.update() }, getIcon: function () { return this.options.icon }, setIcon: function (t) { return this.options.icon = t, this._map && (this._initIcon(), this.update()), this._popup && this.bindPopup(this._popup, this._popup.options), this }, getElement: function () { return this._icon }, update: function () { if (this._icon && this._map) { var t = this._map.latLngToLayerPoint(this._latlng).round(); this._setPos(t) } return this }, _initIcon: function () { var t = this.options, i = "leaflet-zoom-" + (this._zoomAnimated ? "animated" : "hide"), e = t.icon.createIcon(this._icon), n = !1; e !== this._icon && (this._icon && this._removeIcon(), n = !0, t.title && (e.title = t.title), "IMG" === e.tagName && (e.alt = t.alt || "")), mi(e, i), t.keyboard && (e.tabIndex = "0"), this._icon = e, t.riseOnHover && this.on({ mouseover: this._bringToFront, mouseout: this._resetZIndex }); var o = t.icon.createShadow(this._shadow), s = !1; o !== this._shadow && (this._removeShadow(), s = !0), o && (mi(o, i), o.alt = ""), this._shadow = o, t.opacity < 1 && this._updateOpacity(), n && this.getPane().appendChild(this._icon), this._initInteraction(), o && s && this.getPane(t.shadowPane).appendChild(this._shadow) }, _removeIcon: function () { this.options.riseOnHover && this.off({ mouseover: this._bringToFront, mouseout: this._resetZIndex }), li(this._icon), this.removeInteractiveTarget(this._icon), this._icon = null }, _removeShadow: function () { this._shadow && li(this._shadow), this._shadow = null }, _setPos: function (t) { this._icon && Pi(this._icon, t), this._shadow && Pi(this._shadow, t), this._zIndex = t.y + this.options.zIndexOffset, this._resetZIndex() }, _updateZIndex: function (t) { this._icon && (this._icon.style.zIndex = this._zIndex + t) }, _animateZoom: function (t) { var i = this._map._latLngToNewLayerPoint(this._latlng, t.zoom, t.center).round(); this._setPos(i) }, _initInteraction: function () { if (this.options.interactive && (mi(this._icon, "leaflet-interactive"), this.addInteractiveTarget(this._icon), Ie)) { var t = this.options.draggable; this.dragging && (t = this.dragging.enabled(), this.dragging.disable()), this.dragging = new Ie(this), t && this.dragging.enable() } }, setOpacity: function (t) { return this.options.opacity = t, this._map && this._updateOpacity(), this }, _updateOpacity: function () { var t = this.options.opacity; this._icon && yi(this._icon, t), this._shadow && yi(this._shadow, t) }, _bringToFront: function () { this._updateZIndex(this.options.riseOffset) }, _resetZIndex: function () { this._updateZIndex(0) }, _getPopupAnchor: function () { return this.options.icon.options.popupAnchor }, _getTooltipAnchor: function () { return this.options.icon.options.tooltipAnchor } }); var Re = Ee.extend({ options: { stroke: !0, color: "#3388ff", weight: 3, opacity: 1, lineCap: "round", lineJoin: "round", dashArray: null, dashOffset: null, fill: !1, fillColor: null, fillOpacity: .2, fillRule: "evenodd", interactive: !0, bubblingMouseEvents: !0 }, beforeAdd: function (t) { this._renderer = t.getRenderer(this) }, onAdd: function () { this._renderer._initPath(this), this._reset(), this._renderer._addPath(this) }, onRemove: function () { this._renderer._removePath(this) }, redraw: function () { return this._map && this._renderer._updatePath(this), this }, setStyle: function (t) { return p(this, t), this._renderer && (this._renderer._updateStyle(this), this.options.stroke && t && t.hasOwnProperty("weight") && this._updateBounds()), this }, bringToFront: function () { return this._renderer && this._renderer._bringToFront(this), this }, bringToBack: function () { return this._renderer && this._renderer._bringToBack(this), this }, getElement: function () { return this._path }, _reset: function () { this._project(), this._update() }, _clickTolerance: function () { return (this.options.stroke ? this.options.weight / 2 : 0) + this._renderer.options.tolerance } }), Ne = Re.extend({ options: { fill: !0, radius: 10 }, initialize: function (t, i) { p(this, i), this._latlng = W(t), this._radius = this.options.radius }, setLatLng: function (t) { var i = this._latlng; return this._latlng = W(t), this.redraw(), this.fire("move", { oldLatLng: i, latlng: this._latlng }) }, getLatLng: function () { return this._latlng }, setRadius: function (t) { return this.options.radius = this._radius = t, this.redraw() }, getRadius: function () { return this._radius }, setStyle: function (t) { var i = t && t.radius || this._radius; return Re.prototype.setStyle.call(this, t), this.setRadius(i), this }, _project: function () { this._point = this._map.latLngToLayerPoint(this._latlng), this._updateBounds() }, _updateBounds: function () { var t = this._radius, i = this._radiusY || t, e = this._clickTolerance(), n = [t + e, i + e]; this._pxBounds = new O(this._point.subtract(n), this._point.add(n)) }, _update: function () { this._map && this._updatePath() }, _updatePath: function () { this._renderer._updateCircle(this) }, _empty: function () { return this._radius && !this._renderer._bounds.intersects(this._pxBounds) }, _containsPoint: function (t) { return t.distanceTo(this._point) <= this._radius + this._clickTolerance() } }); var De = Ne.extend({ initialize: function (t, i, e) { if ("number" == typeof i && (i = h({}, e, { radius: i })), p(this, i), this._latlng = W(t), isNaN(this.options.radius)) throw new Error("Circle radius cannot be NaN"); this._mRadius = this.options.radius }, setRadius: function (t) { return this._mRadius = t, this.redraw() }, getRadius: function () { return this._mRadius }, getBounds: function () { var t = [this._radius, this._radiusY || this._radius]; return new N(this._map.layerPointToLatLng(this._point.subtract(t)), this._map.layerPointToLatLng(this._point.add(t))) }, setStyle: Re.prototype.setStyle, _project: function () { var t = this._latlng.lng, i = this._latlng.lat, e = this._map, n = e.options.crs; if (n.distance === U.distance) { var o = Math.PI / 180, s = this._mRadius / U.R / o, r = e.project([i + s, t]), a = e.project([i - s, t]), h = r.add(a).divideBy(2), u = e.unproject(h).lat, l = Math.acos((Math.cos(s * o) - Math.sin(i * o) * Math.sin(u * o)) / (Math.cos(i * o) * Math.cos(u * o))) / o; !isNaN(l) && 0 !== l || (l = s / Math.cos(Math.PI / 180 * i)), this._point = h.subtract(e.getPixelOrigin()), this._radius = isNaN(l) ? 0 : h.x - e.project([u, t - l]).x, this._radiusY = h.y - r.y } else { var c = n.unproject(n.project(this._latlng).subtract([this._mRadius, 0])); this._point = e.latLngToLayerPoint(this._latlng), this._radius = this._point.x - e.latLngToLayerPoint(c).x } this._updateBounds() } }); var je = Re.extend({ options: { smoothFactor: 1, noClip: !1 }, initialize: function (t, i) { p(this, i), this._setLatLngs(t) }, getLatLngs: function () { return this._latlngs }, setLatLngs: function (t) { return this._setLatLngs(t), this.redraw() }, isEmpty: function () { return !this._latlngs.length }, closestLayerPoint: function (t) { for (var i, e, n = 1 / 0, o = null, s = ge, r = 0, a = this._parts.length; r < a; r++)for (var h = this._parts[r], u = 1, l = h.length; u < l; u++) { var c = s(t, i = h[u - 1], e = h[u], !0); c < n && (n = c, o = s(t, i, e)) } return o && (o.distance = Math.sqrt(n)), o }, getCenter: function () { if (!this._map) throw new Error("Must add layer to map before using getCenter()"); var t, i, e, n, o, s, r, a = this._rings[0], h = a.length; if (!h) return null; for (i = t = 0; t < h - 1; t++)i += a[t].distanceTo(a[t + 1]) / 2; if (0 === i) return this._map.layerPointToLatLng(a[0]); for (n = t = 0; t < h - 1; t++)if (o = a[t], s = a[t + 1], i < (n += e = o.distanceTo(s))) return r = (n - i) / e, this._map.layerPointToLatLng([s.x - r * (s.x - o.x), s.y - r * (s.y - o.y)]) }, getBounds: function () { return this._bounds }, addLatLng: function (t, i) { return i = i || this._defaultShape(), t = W(t), i.push(t), this._bounds.extend(t), this.redraw() }, _setLatLngs: function (t) { this._bounds = new N, this._latlngs = this._convertLatLngs(t) }, _defaultShape: function () { return ve(this._latlngs) ? this._latlngs : this._latlngs[0] }, _convertLatLngs: function (t) { for (var i = [], e = ve(t), n = 0, o = t.length; n < o; n++)e ? (i[n] = W(t[n]), this._bounds.extend(i[n])) : i[n] = this._convertLatLngs(t[n]); return i }, _project: function () { var t = new O; this._rings = [], this._projectLatlngs(this._latlngs, this._rings, t), this._bounds.isValid() && t.isValid() && (this._rawPxBounds = t, this._updateBounds()) }, _updateBounds: function () { var t = this._clickTolerance(), i = new B(t, t); this._pxBounds = new O([this._rawPxBounds.min.subtract(i), this._rawPxBounds.max.add(i)]) }, _projectLatlngs: function (t, i, e) { var n, o, s = t[0] instanceof j, r = t.length; if (s) { for (o = [], n = 0; n < r; n++)o[n] = this._map.latLngToLayerPoint(t[n]), e.extend(o[n]); i.push(o) } else for (n = 0; n < r; n++)this._projectLatlngs(t[n], i, e) }, _clipPoints: function () { var t = this._renderer._bounds; if (this._parts = [], this._pxBounds && this._pxBounds.intersects(t)) if (this.options.noClip) this._parts = this._rings; else { var i, e, n, o, s, r, a, h = this._parts; for (n = i = 0, o = this._rings.length; i < o; i++)for (e = 0, s = (a = this._rings[i]).length; e < s - 1; e++)(r = pe(a[e], a[e + 1], t, e, !0)) && (h[n] = h[n] || [], h[n].push(r[0]), r[1] === a[e + 1] && e !== s - 2 || (h[n].push(r[1]), n++)) } }, _simplifyPoints: function () { for (var t = this._parts, i = this.options.smoothFactor, e = 0, n = t.length; e < n; e++)t[e] = _e(t[e], i) }, _update: function () { this._map && (this._clipPoints(), this._simplifyPoints(), this._updatePath()) }, _updatePath: function () { this._renderer._updatePoly(this) }, _containsPoint: function (t, i) { var e, n, o, s, r, a, h = this._clickTolerance(); if (!this._pxBounds || !this._pxBounds.contains(t)) return !1; for (e = 0, s = this._parts.length; e < s; e++)for (n = 0, o = (r = (a = this._parts[e]).length) - 1; n < r; o = n++)if ((i || 0 !== n) && de(t, a[o], a[n]) <= h) return !0; return !1 } }); je._flat = ye; var We = je.extend({ options: { fill: !0 }, isEmpty: function () { return !this._latlngs.length || !this._latlngs[0].length }, getCenter: function () { if (!this._map) throw new Error("Must add layer to map before using getCenter()"); var t, i, e, n, o, s, r, a, h, u = this._rings[0], l = u.length; if (!l) return null; for (s = r = a = 0, t = 0, i = l - 1; t < l; i = t++)e = u[t], n = u[i], o = e.y * n.x - n.y * e.x, r += (e.x + n.x) * o, a += (e.y + n.y) * o, s += 3 * o; return h = 0 === s ? u[0] : [r / s, a / s], this._map.layerPointToLatLng(h) }, _convertLatLngs: function (t) { var i = je.prototype._convertLatLngs.call(this, t), e = i.length; return 2 <= e && i[0] instanceof j && i[0].equals(i[e - 1]) && i.pop(), i }, _setLatLngs: function (t) { je.prototype._setLatLngs.call(this, t), ve(this._latlngs) && (this._latlngs = [this._latlngs]) }, _defaultShape: function () { return ve(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0] }, _clipPoints: function () { var t = this._renderer._bounds, i = this.options.weight, e = new B(i, i); if (t = new O(t.min.subtract(e), t.max.add(e)), this._parts = [], this._pxBounds && this._pxBounds.intersects(t)) if (this.options.noClip) this._parts = this._rings; else for (var n, o = 0, s = this._rings.length; o < s; o++)(n = we(this._rings[o], t, !0)).length && this._parts.push(n) }, _updatePath: function () { this._renderer._updatePoly(this, !0) }, _containsPoint: function (t) { var i, e, n, o, s, r, a, h, u = !1; if (!this._pxBounds || !this._pxBounds.contains(t)) return !1; for (o = 0, a = this._parts.length; o < a; o++)for (s = 0, r = (h = (i = this._parts[o]).length) - 1; s < h; r = s++)e = i[s], n = i[r], e.y > t.y != n.y > t.y && t.x < (n.x - e.x) * (t.y - e.y) / (n.y - e.y) + e.x && (u = !u); return u || je.prototype._containsPoint.call(this, t, !0) } }); var He = ke.extend({ initialize: function (t, i) { p(this, i), this._layers = {}, t && this.addData(t) }, addData: function (t) { var i, e, n, o = v(t) ? t : t.features; if (o) { for (i = 0, e = o.length; i < e; i++)((n = o[i]).geometries || n.geometry || n.features || n.coordinates) && this.addData(n); return this } var s = this.options; if (s.filter && !s.filter(t)) return this; var r = Fe(t, s); return r ? (r.feature = Xe(t), r.defaultOptions = r.options, this.resetStyle(r), s.onEachFeature && s.onEachFeature(t, r), this.addLayer(r)) : this }, resetStyle: function (t) { return void 0 === t ? this.eachLayer(this.resetStyle, this) : (t.options = h({}, t.defaultOptions), this._setLayerStyle(t, this.options.style), this) }, setStyle: function (i) { return this.eachLayer(function (t) { this._setLayerStyle(t, i) }, this) }, _setLayerStyle: function (t, i) { t.setStyle && ("function" == typeof i && (i = i(t.feature)), t.setStyle(i)) } }); function Fe(t, i) { var e, n, o, s, r = "Feature" === t.type ? t.geometry : t, a = r ? r.coordinates : null, h = [], u = i && i.pointToLayer, l = i && i.coordsToLatLng || Ve; if (!a && !r) return null; switch (r.type) { case "Point": return Ue(u, t, e = l(a), i); case "MultiPoint": for (o = 0, s = a.length; o < s; o++)e = l(a[o]), h.push(Ue(u, t, e, i)); return new ke(h); case "LineString": case "MultiLineString": return n = qe(a, "LineString" === r.type ? 0 : 1, l), new je(n, i); case "Polygon": case "MultiPolygon": return n = qe(a, "Polygon" === r.type ? 1 : 2, l), new We(n, i); case "GeometryCollection": for (o = 0, s = r.geometries.length; o < s; o++) { var c = Fe({ geometry: r.geometries[o], type: "Feature", properties: t.properties }, i); c && h.push(c) } return new ke(h); default: throw new Error("Invalid GeoJSON object.") } } function Ue(t, i, e, n) { return t ? t(i, e) : new Oe(e, n && n.markersInheritOptions && n) } function Ve(t) { return new j(t[1], t[0], t[2]) } function qe(t, i, e) { for (var n, o = [], s = 0, r = t.length; s < r; s++)n = i ? qe(t[s], i - 1, e) : (e || Ve)(t[s]), o.push(n); return o } function Ge(t, i) { return i = "number" == typeof i ? i : 6, void 0 !== t.alt ? [c(t.lng, i), c(t.lat, i), c(t.alt, i)] : [c(t.lng, i), c(t.lat, i)] } function Ke(t, i, e, n) { for (var o = [], s = 0, r = t.length; s < r; s++)o.push(i ? Ke(t[s], i - 1, e, n) : Ge(t[s], n)); return !i && e && o.push(o[0]), o } function Ye(t, i) { return t.feature ? h({}, t.feature, { geometry: i }) : Xe(i) } function Xe(t) { return "Feature" === t.type || "FeatureCollection" === t.type ? t : { type: "Feature", properties: {}, geometry: t } } var Je = { toGeoJSON: function (t) { return Ye(this, { type: "Point", coordinates: Ge(this.getLatLng(), t) }) } }; function $e(t, i) { return new He(t, i) } Oe.include(Je), De.include(Je), Ne.include(Je), je.include({ toGeoJSON: function (t) { var i = !ve(this._latlngs); return Ye(this, { type: (i ? "Multi" : "") + "LineString", coordinates: Ke(this._latlngs, i ? 1 : 0, !1, t) }) } }), We.include({ toGeoJSON: function (t) { var i = !ve(this._latlngs), e = i && !ve(this._latlngs[0]), n = Ke(this._latlngs, e ? 2 : i ? 1 : 0, !0, t); return i || (n = [n]), Ye(this, { type: (e ? "Multi" : "") + "Polygon", coordinates: n }) } }), Ze.include({ toMultiPoint: function (i) { var e = []; return this.eachLayer(function (t) { e.push(t.toGeoJSON(i).geometry.coordinates) }), Ye(this, { type: "MultiPoint", coordinates: e }) }, toGeoJSON: function (n) { var t = this.feature && this.feature.geometry && this.feature.geometry.type; if ("MultiPoint" === t) return this.toMultiPoint(n); var o = "GeometryCollection" === t, s = []; return this.eachLayer(function (t) { if (t.toGeoJSON) { var i = t.toGeoJSON(n); if (o) s.push(i.geometry); else { var e = Xe(i); "FeatureCollection" === e.type ? s.push.apply(s, e.features) : s.push(e) } } }), o ? Ye(this, { geometries: s, type: "GeometryCollection" }) : { type: "FeatureCollection", features: s } } }); var Qe = $e, tn = Ee.extend({ options: { opacity: 1, alt: "", interactive: !1, crossOrigin: !1, errorOverlayUrl: "", zIndex: 1, className: "" }, initialize: function (t, i, e) { this._url = t, this._bounds = D(i), p(this, e) }, onAdd: function () { this._image || (this._initImage(), this.options.opacity < 1 && this._updateOpacity()), this.options.interactive && (mi(this._image, "leaflet-interactive"), this.addInteractiveTarget(this._image)), this.getPane().appendChild(this._image), this._reset() }, onRemove: function () { li(this._image), this.options.interactive && this.removeInteractiveTarget(this._image) }, setOpacity: function (t) { return this.options.opacity = t, this._image && this._updateOpacity(), this }, setStyle: function (t) { return t.opacity && this.setOpacity(t.opacity), this }, bringToFront: function () { return this._map && _i(this._image), this }, bringToBack: function () { return this._map && di(this._image), this }, setUrl: function (t) { return this._url = t, this._image && (this._image.src = t), this }, setBounds: function (t) { return this._bounds = D(t), this._map && this._reset(), this }, getEvents: function () { var t = { zoom: this._reset, viewreset: this._reset }; return this._zoomAnimated && (t.zoomanim = this._animateZoom), t }, setZIndex: function (t) { return this.options.zIndex = t, this._updateZIndex(), this }, getBounds: function () { return this._bounds }, getElement: function () { return this._image }, _initImage: function () { var t = "IMG" === this._url.tagName, i = this._image = t ? this._url : ui("img"); mi(i, "leaflet-image-layer"), this._zoomAnimated && mi(i, "leaflet-zoom-animated"), this.options.className && mi(i, this.options.className), i.onselectstart = l, i.onmousemove = l, i.onload = a(this.fire, this, "load"), i.onerror = a(this._overlayOnError, this, "error"), !this.options.crossOrigin && "" !== this.options.crossOrigin || (i.crossOrigin = !0 === this.options.crossOrigin ? "" : this.options.crossOrigin), this.options.zIndex && this._updateZIndex(), t ? this._url = i.src : (i.src = this._url, i.alt = this.options.alt) }, _animateZoom: function (t) { var i = this._map.getZoomScale(t.zoom), e = this._map._latLngBoundsToNewLayerBounds(this._bounds, t.zoom, t.center).min; wi(this._image, e, i) }, _reset: function () { var t = this._image, i = new O(this._map.latLngToLayerPoint(this._bounds.getNorthWest()), this._map.latLngToLayerPoint(this._bounds.getSouthEast())), e = i.getSize(); Pi(t, i.min), t.style.width = e.x + "px", t.style.height = e.y + "px" }, _updateOpacity: function () { yi(this._image, this.options.opacity) }, _updateZIndex: function () { this._image && void 0 !== this.options.zIndex && null !== this.options.zIndex && (this._image.style.zIndex = this.options.zIndex) }, _overlayOnError: function () { this.fire("error"); var t = this.options.errorOverlayUrl; t && this._url !== t && (this._url = t, this._image.src = t) } }), en = tn.extend({ options: { autoplay: !0, loop: !0, keepAspectRatio: !0 }, _initImage: function () { var t = "VIDEO" === this._url.tagName, i = this._image = t ? this._url : ui("video"); if (mi(i, "leaflet-image-layer"), this._zoomAnimated && mi(i, "leaflet-zoom-animated"), this.options.className && mi(i, this.options.className), i.onselectstart = l, i.onmousemove = l, i.onloadeddata = a(this.fire, this, "load"), t) { for (var e = i.getElementsByTagName("source"), n = [], o = 0; o < e.length; o++)n.push(e[o].src); this._url = 0 < e.length ? n : [i.src] } else { v(this._url) || (this._url = [this._url]), !this.options.keepAspectRatio && i.style.hasOwnProperty("objectFit") && (i.style.objectFit = "fill"), i.autoplay = !!this.options.autoplay, i.loop = !!this.options.loop; for (var s = 0; s < this._url.length; s++) { var r = ui("source"); r.src = this._url[s], i.appendChild(r) } } } }); var nn = tn.extend({ _initImage: function () { var t = this._image = this._url; mi(t, "leaflet-image-layer"), this._zoomAnimated && mi(t, "leaflet-zoom-animated"), this.options.className && mi(t, this.options.className), t.onselectstart = l, t.onmousemove = l } }); var on = Ee.extend({ options: { offset: [0, 7], className: "", pane: "popupPane" }, initialize: function (t, i) { p(this, t), this._source = i }, onAdd: function (t) { this._zoomAnimated = t._zoomAnimated, this._container || this._initLayout(), t._fadeAnimated && yi(this._container, 0), clearTimeout(this._removeTimeout), this.getPane().appendChild(this._container), this.update(), t._fadeAnimated && yi(this._container, 1), this.bringToFront() }, onRemove: function (t) { t._fadeAnimated ? (yi(this._container, 0), this._removeTimeout = setTimeout(a(li, void 0, this._container), 200)) : li(this._container) }, getLatLng: function () { return this._latlng }, setLatLng: function (t) { return this._latlng = W(t), this._map && (this._updatePosition(), this._adjustPan()), this }, getContent: function () { return this._content }, setContent: function (t) { return this._content = t, this.update(), this }, getElement: function () { return this._container }, update: function () { this._map && (this._container.style.visibility = "hidden", this._updateContent(), this._updateLayout(), this._updatePosition(), this._container.style.visibility = "", this._adjustPan()) }, getEvents: function () { var t = { zoom: this._updatePosition, viewreset: this._updatePosition }; return this._zoomAnimated && (t.zoomanim = this._animateZoom), t }, isOpen: function () { return !!this._map && this._map.hasLayer(this) }, bringToFront: function () { return this._map && _i(this._container), this }, bringToBack: function () { return this._map && di(this._container), this }, _prepareOpen: function (t, i, e) { if (i instanceof Ee || (e = i, i = t), i instanceof ke) for (var n in t._layers) { i = t._layers[n]; break } if (!e) if (i.getCenter) e = i.getCenter(); else { if (!i.getLatLng) throw new Error("Unable to get source layer LatLng."); e = i.getLatLng() } return this._source = i, this.update(), e }, _updateContent: function () { if (this._content) { var t = this._contentNode, i = "function" == typeof this._content ? this._content(this._source || this) : this._content; if ("string" == typeof i) t.innerHTML = i; else { for (; t.hasChildNodes();)t.removeChild(t.firstChild); t.appendChild(i) } this.fire("contentupdate") } }, _updatePosition: function () { if (this._map) { var t = this._map.latLngToLayerPoint(this._latlng), i = I(this.options.offset), e = this._getAnchor(); this._zoomAnimated ? Pi(this._container, t.add(e)) : i = i.add(t).add(e); var n = this._containerBottom = -i.y, o = this._containerLeft = -Math.round(this._containerWidth / 2) + i.x; this._container.style.bottom = n + "px", this._container.style.left = o + "px" } }, _getAnchor: function () { return [0, 0] } }), sn = on.extend({ options: { maxWidth: 300, minWidth: 50, maxHeight: null, autoPan: !0, autoPanPaddingTopLeft: null, autoPanPaddingBottomRight: null, autoPanPadding: [5, 5], keepInView: !1, closeButton: !0, autoClose: !0, closeOnEscapeKey: !0, className: "" }, openOn: function (t) { return t.openPopup(this), this }, onAdd: function (t) { on.prototype.onAdd.call(this, t), t.fire("popupopen", { popup: this }), this._source && (this._source.fire("popupopen", { popup: this }, !0), this._source instanceof Re || this._source.on("preclick", Ri)) }, onRemove: function (t) { on.prototype.onRemove.call(this, t), t.fire("popupclose", { popup: this }), this._source && (this._source.fire("popupclose", { popup: this }, !0), this._source instanceof Re || this._source.off("preclick", Ri)) }, getEvents: function () { var t = on.prototype.getEvents.call(this); return (void 0 !== this.options.closeOnClick ? this.options.closeOnClick : this._map.options.closePopupOnClick) && (t.preclick = this._close), this.options.keepInView && (t.moveend = this._adjustPan), t }, _close: function () { this._map && this._map.closePopup(this) }, _initLayout: function () { var t = "leaflet-popup", i = this._container = ui("div", t + " " + (this.options.className || "") + " leaflet-zoom-animated"), e = this._wrapper = ui("div", t + "-content-wrapper", i); if (this._contentNode = ui("div", t + "-content", e), Di(e), Ni(this._contentNode), ki(e, "contextmenu", Ri), this._tipContainer = ui("div", t + "-tip-container", i), this._tip = ui("div", t + "-tip", this._tipContainer), this.options.closeButton) { var n = this._closeButton = ui("a", t + "-close-button", i); n.href = "#close", n.innerHTML = "×", ki(n, "click", this._onCloseButtonClick, this) } }, _updateLayout: function () { var t = this._contentNode, i = t.style; i.width = "", i.whiteSpace = "nowrap"; var e = t.offsetWidth; e = Math.min(e, this.options.maxWidth), e = Math.max(e, this.options.minWidth), i.width = e + 1 + "px", i.whiteSpace = "", i.height = ""; var n = t.offsetHeight, o = this.options.maxHeight, s = "leaflet-popup-scrolled"; o && o < n ? (i.height = o + "px", mi(t, s)) : fi(t, s), this._containerWidth = this._container.offsetWidth }, _animateZoom: function (t) { var i = this._map._latLngToNewLayerPoint(this._latlng, t.zoom, t.center), e = this._getAnchor(); Pi(this._container, i.add(e)) }, _adjustPan: function () { if (this.options.autoPan) { this._map._panAnim && this._map._panAnim.stop(); var t = this._map, i = parseInt(hi(this._container, "marginBottom"), 10) || 0, e = this._container.offsetHeight + i, n = this._containerWidth, o = new B(this._containerLeft, -e - this._containerBottom); o._add(Li(this._container)); var s = t.layerPointToContainerPoint(o), r = I(this.options.autoPanPadding), a = I(this.options.autoPanPaddingTopLeft || r), h = I(this.options.autoPanPaddingBottomRight || r), u = t.getSize(), l = 0, c = 0; s.x + n + h.x > u.x && (l = s.x + n - u.x + h.x), s.x - l - a.x < 0 && (l = s.x - a.x), s.y + e + h.y > u.y && (c = s.y + e - u.y + h.y), s.y - c - a.y < 0 && (c = s.y - a.y), (l || c) && t.fire("autopanstart").panBy([l, c]) } }, _onCloseButtonClick: function (t) { this._close(), Wi(t) }, _getAnchor: function () { return I(this._source && this._source._getPopupAnchor ? this._source._getPopupAnchor() : [0, 0]) } }); $i.mergeOptions({ closePopupOnClick: !0 }), $i.include({ openPopup: function (t, i, e) { return t instanceof sn || (t = new sn(e).setContent(t)), i && t.setLatLng(i), this.hasLayer(t) ? this : (this._popup && this._popup.options.autoClose && this.closePopup(), this._popup = t, this.addLayer(t)) }, closePopup: function (t) { return t && t !== this._popup || (t = this._popup, this._popup = null), t && this.removeLayer(t), this } }), Ee.include({ bindPopup: function (t, i) { return t instanceof sn ? (p(t, i), (this._popup = t)._source = this) : (this._popup && !i || (this._popup = new sn(i, this)), this._popup.setContent(t)), this._popupHandlersAdded || (this.on({ click: this._openPopup, keypress: this._onKeyPress, remove: this.closePopup, move: this._movePopup }), this._popupHandlersAdded = !0), this }, unbindPopup: function () { return this._popup && (this.off({ click: this._openPopup, keypress: this._onKeyPress, remove: this.closePopup, move: this._movePopup }), this._popupHandlersAdded = !1, this._popup = null), this }, openPopup: function (t, i) { return this._popup && this._map && (i = this._popup._prepareOpen(this, t, i), this._map.openPopup(this._popup, i)), this }, closePopup: function () { return this._popup && this._popup._close(), this }, togglePopup: function (t) { return this._popup && (this._popup._map ? this.closePopup() : this.openPopup(t)), this }, isPopupOpen: function () { return !!this._popup && this._popup.isOpen() }, setPopupContent: function (t) { return this._popup && this._popup.setContent(t), this }, getPopup: function () { return this._popup }, _openPopup: function (t) { var i = t.layer || t.target; this._popup && this._map && (Wi(t), i instanceof Re ? this.openPopup(t.layer || t.target, t.latlng) : this._map.hasLayer(this._popup) && this._popup._source === i ? this.closePopup() : this.openPopup(i, t.latlng)) }, _movePopup: function (t) { this._popup.setLatLng(t.latlng) }, _onKeyPress: function (t) { 13 === t.originalEvent.keyCode && this._openPopup(t) } }); var rn = on.extend({ options: { pane: "tooltipPane", offset: [0, 0], direction: "auto", permanent: !1, sticky: !1, interactive: !1, opacity: .9 }, onAdd: function (t) { on.prototype.onAdd.call(this, t), this.setOpacity(this.options.opacity), t.fire("tooltipopen", { tooltip: this }), this._source && this._source.fire("tooltipopen", { tooltip: this }, !0) }, onRemove: function (t) { on.prototype.onRemove.call(this, t), t.fire("tooltipclose", { tooltip: this }), this._source && this._source.fire("tooltipclose", { tooltip: this }, !0) }, getEvents: function () { var t = on.prototype.getEvents.call(this); return Tt && !this.options.permanent && (t.preclick = this._close), t }, _close: function () { this._map && this._map.closeTooltip(this) }, _initLayout: function () { var t = "leaflet-tooltip " + (this.options.className || "") + " leaflet-zoom-" + (this._zoomAnimated ? "animated" : "hide"); this._contentNode = this._container = ui("div", t) }, _updateLayout: function () { }, _adjustPan: function () { }, _setPosition: function (t) { var i = this._map, e = this._container, n = i.latLngToContainerPoint(i.getCenter()), o = i.layerPointToContainerPoint(t), s = this.options.direction, r = e.offsetWidth, a = e.offsetHeight, h = I(this.options.offset), u = this._getAnchor(); t = "top" === s ? t.add(I(-r / 2 + h.x, -a + h.y + u.y, !0)) : "bottom" === s ? t.subtract(I(r / 2 - h.x, -h.y, !0)) : "center" === s ? t.subtract(I(r / 2 + h.x, a / 2 - u.y + h.y, !0)) : "right" === s || "auto" === s && o.x < n.x ? (s = "right", t.add(I(h.x + u.x, u.y - a / 2 + h.y, !0))) : (s = "left", t.subtract(I(r + u.x - h.x, a / 2 - u.y - h.y, !0))), fi(e, "leaflet-tooltip-right"), fi(e, "leaflet-tooltip-left"), fi(e, "leaflet-tooltip-top"), fi(e, "leaflet-tooltip-bottom"), mi(e, "leaflet-tooltip-" + s), Pi(e, t) }, _updatePosition: function () { var t = this._map.latLngToLayerPoint(this._latlng); this._setPosition(t) }, setOpacity: function (t) { this.options.opacity = t, this._container && yi(this._container, t) }, _animateZoom: function (t) { var i = this._map._latLngToNewLayerPoint(this._latlng, t.zoom, t.center); this._setPosition(i) }, _getAnchor: function () { return I(this._source && this._source._getTooltipAnchor && !this.options.sticky ? this._source._getTooltipAnchor() : [0, 0]) } }); $i.include({ openTooltip: function (t, i, e) { return t instanceof rn || (t = new rn(e).setContent(t)), i && t.setLatLng(i), this.hasLayer(t) ? this : this.addLayer(t) }, closeTooltip: function (t) { return t && this.removeLayer(t), this } }), Ee.include({ bindTooltip: function (t, i) { return t instanceof rn ? (p(t, i), (this._tooltip = t)._source = this) : (this._tooltip && !i || (this._tooltip = new rn(i, this)), this._tooltip.setContent(t)), this._initTooltipInteractions(), this._tooltip.options.permanent && this._map && this._map.hasLayer(this) && this.openTooltip(), this }, unbindTooltip: function () { return this._tooltip && (this._initTooltipInteractions(!0), this.closeTooltip(), this._tooltip = null), this }, _initTooltipInteractions: function (t) { if (t || !this._tooltipHandlersAdded) { var i = t ? "off" : "on", e = { remove: this.closeTooltip, move: this._moveTooltip }; this._tooltip.options.permanent ? e.add = this._openTooltip : (e.mouseover = this._openTooltip, e.mouseout = this.closeTooltip, this._tooltip.options.sticky && (e.mousemove = this._moveTooltip), Tt && (e.click = this._openTooltip)), this[i](e), this._tooltipHandlersAdded = !t } }, openTooltip: function (t, i) { return this._tooltip && this._map && (i = this._tooltip._prepareOpen(this, t, i), this._map.openTooltip(this._tooltip, i), this._tooltip.options.interactive && this._tooltip._container && (mi(this._tooltip._container, "leaflet-clickable"), this.addInteractiveTarget(this._tooltip._container))), this }, closeTooltip: function () { return this._tooltip && (this._tooltip._close(), this._tooltip.options.interactive && this._tooltip._container && (fi(this._tooltip._container, "leaflet-clickable"), this.removeInteractiveTarget(this._tooltip._container))), this }, toggleTooltip: function (t) { return this._tooltip && (this._tooltip._map ? this.closeTooltip() : this.openTooltip(t)), this }, isTooltipOpen: function () { return this._tooltip.isOpen() }, setTooltipContent: function (t) { return this._tooltip && this._tooltip.setContent(t), this }, getTooltip: function () { return this._tooltip }, _openTooltip: function (t) { var i = t.layer || t.target; this._tooltip && this._map && this.openTooltip(i, this._tooltip.options.sticky ? t.latlng : void 0) }, _moveTooltip: function (t) { var i, e, n = t.latlng; this._tooltip.options.sticky && t.originalEvent && (i = this._map.mouseEventToContainerPoint(t.originalEvent), e = this._map.containerPointToLayerPoint(i), n = this._map.layerPointToLatLng(e)), this._tooltip.setLatLng(n) } }); var an = Be.extend({ options: { iconSize: [12, 12], html: !1, bgPos: null, className: "leaflet-div-icon" }, createIcon: function (t) { var i = t && "DIV" === t.tagName ? t : document.createElement("div"), e = this.options; if (e.html instanceof Element ? (ci(i), i.appendChild(e.html)) : i.innerHTML = !1 !== e.html ? e.html : "", e.bgPos) { var n = I(e.bgPos); i.style.backgroundPosition = -n.x + "px " + -n.y + "px" } return this._setIconStyles(i, "icon"), i }, createShadow: function () { return null } }); Be.Default = Ae; var hn = Ee.extend({ options: { tileSize: 256, opacity: 1, updateWhenIdle: xt, updateWhenZooming: !0, updateInterval: 200, zIndex: 1, bounds: null, minZoom: 0, maxZoom: void 0, maxNativeZoom: void 0, minNativeZoom: void 0, noWrap: !1, pane: "tilePane", className: "", keepBuffer: 2 }, initialize: function (t) { p(this, t) }, onAdd: function () { this._initContainer(), this._levels = {}, this._tiles = {}, this._resetView(), this._update() }, beforeAdd: function (t) { t._addZoomLimit(this) }, onRemove: function (t) { this._removeAllTiles(), li(this._container), t._removeZoomLimit(this), this._container = null, this._tileZoom = void 0 }, bringToFront: function () { return this._map && (_i(this._container), this._setAutoZIndex(Math.max)), this }, bringToBack: function () { return this._map && (di(this._container), this._setAutoZIndex(Math.min)), this }, getContainer: function () { return this._container }, setOpacity: function (t) { return this.options.opacity = t, this._updateOpacity(), this }, setZIndex: function (t) { return this.options.zIndex = t, this._updateZIndex(), this }, isLoading: function () { return this._loading }, redraw: function () { return this._map && (this._removeAllTiles(), this._update()), this }, getEvents: function () { var t = { viewprereset: this._invalidateAll, viewreset: this._resetView, zoom: this._resetView, moveend: this._onMoveEnd }; return this.options.updateWhenIdle || (this._onMove || (this._onMove = o(this._onMoveEnd, this.options.updateInterval, this)), t.move = this._onMove), this._zoomAnimated && (t.zoomanim = this._animateZoom), t }, createTile: function () { return document.createElement("div") }, getTileSize: function () { var t = this.options.tileSize; return t instanceof B ? t : new B(t, t) }, _updateZIndex: function () { this._container && void 0 !== this.options.zIndex && null !== this.options.zIndex && (this._container.style.zIndex = this.options.zIndex) }, _setAutoZIndex: function (t) { for (var i, e = this.getPane().children, n = -t(-1 / 0, 1 / 0), o = 0, s = e.length; o < s; o++)i = e[o].style.zIndex, e[o] !== this._container && i && (n = t(n, +i)); isFinite(n) && (this.options.zIndex = n + t(-1, 1), this._updateZIndex()) }, _updateOpacity: function () { if (this._map && !et) { yi(this._container, this.options.opacity); var t = +new Date, i = !1, e = !1; for (var n in this._tiles) { var o = this._tiles[n]; if (o.current && o.loaded) { var s = Math.min(1, (t - o.loaded) / 200); yi(o.el, s), s < 1 ? i = !0 : (o.active ? e = !0 : this._onOpaqueTile(o), o.active = !0) } } e && !this._noPrune && this._pruneTiles(), i && (C(this._fadeFrame), this._fadeFrame = M(this._updateOpacity, this)) } }, _onOpaqueTile: l, _initContainer: function () { this._container || (this._container = ui("div", "leaflet-layer " + (this.options.className || "")), this._updateZIndex(), this.options.opacity < 1 && this._updateOpacity(), this.getPane().appendChild(this._container)) }, _updateLevels: function () { var t = this._tileZoom, i = this.options.maxZoom; if (void 0 !== t) { for (var e in this._levels) this._levels[e].el.children.length || e === t ? (this._levels[e].el.style.zIndex = i - Math.abs(t - e), this._onUpdateLevel(e)) : (li(this._levels[e].el), this._removeTilesAtZoom(e), this._onRemoveLevel(e), delete this._levels[e]); var n = this._levels[t], o = this._map; return n || ((n = this._levels[t] = {}).el = ui("div", "leaflet-tile-container leaflet-zoom-animated", this._container), n.el.style.zIndex = i, n.origin = o.project(o.unproject(o.getPixelOrigin()), t).round(), n.zoom = t, this._setZoomTransform(n, o.getCenter(), o.getZoom()), n.el.offsetWidth, this._onCreateLevel(n)), this._level = n } }, _onUpdateLevel: l, _onRemoveLevel: l, _onCreateLevel: l, _pruneTiles: function () { if (this._map) { var t, i, e = this._map.getZoom(); if (e > this.options.maxZoom || e < this.options.minZoom) this._removeAllTiles(); else { for (t in this._tiles) (i = this._tiles[t]).retain = i.current; for (t in this._tiles) if ((i = this._tiles[t]).current && !i.active) { var n = i.coords; this._retainParent(n.x, n.y, n.z, n.z - 5) || this._retainChildren(n.x, n.y, n.z, n.z + 2) } for (t in this._tiles) this._tiles[t].retain || this._removeTile(t) } } }, _removeTilesAtZoom: function (t) { for (var i in this._tiles) this._tiles[i].coords.z === t && this._removeTile(i) }, _removeAllTiles: function () { for (var t in this._tiles) this._removeTile(t) }, _invalidateAll: function () { for (var t in this._levels) li(this._levels[t].el), this._onRemoveLevel(t), delete this._levels[t]; this._removeAllTiles(), this._tileZoom = void 0 }, _retainParent: function (t, i, e, n) { var o = Math.floor(t / 2), s = Math.floor(i / 2), r = e - 1, a = new B(+o, +s); a.z = +r; var h = this._tileCoordsToKey(a), u = this._tiles[h]; return u && u.active ? u.retain = !0 : (u && u.loaded && (u.retain = !0), n < r && this._retainParent(o, s, r, n)) }, _retainChildren: function (t, i, e, n) { for (var o = 2 * t; o < 2 * t + 2; o++)for (var s = 2 * i; s < 2 * i + 2; s++) { var r = new B(o, s); r.z = e + 1; var a = this._tileCoordsToKey(r), h = this._tiles[a]; h && h.active ? h.retain = !0 : (h && h.loaded && (h.retain = !0), e + 1 < n && this._retainChildren(o, s, e + 1, n)) } }, _resetView: function (t) { var i = t && (t.pinch || t.flyTo); this._setView(this._map.getCenter(), this._map.getZoom(), i, i) }, _animateZoom: function (t) { this._setView(t.center, t.zoom, !0, t.noUpdate) }, _clampZoom: function (t) { var i = this.options; return void 0 !== i.minNativeZoom && t < i.minNativeZoom ? i.minNativeZoom : void 0 !== i.maxNativeZoom && i.maxNativeZoom < t ? i.maxNativeZoom : t }, _setView: function (t, i, e, n) { var o = this._clampZoom(Math.round(i)); (void 0 !== this.options.maxZoom && o > this.options.maxZoom || void 0 !== this.options.minZoom && o < this.options.minZoom) && (o = void 0); var s = this.options.updateWhenZooming && o !== this._tileZoom; n && !s || (this._tileZoom = o, this._abortLoading && this._abortLoading(), this._updateLevels(), this._resetGrid(), void 0 !== o && this._update(t), e || this._pruneTiles(), this._noPrune = !!e), this._setZoomTransforms(t, i) }, _setZoomTransforms: function (t, i) { for (var e in this._levels) this._setZoomTransform(this._levels[e], t, i) }, _setZoomTransform: function (t, i, e) { var n = this._map.getZoomScale(e, t.zoom), o = t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(i, e)).round(); yt ? wi(t.el, o, n) : Pi(t.el, o) }, _resetGrid: function () { var t = this._map, i = t.options.crs, e = this._tileSize = this.getTileSize(), n = this._tileZoom, o = this._map.getPixelWorldBounds(this._tileZoom); o && (this._globalTileRange = this._pxBoundsToTileRange(o)), this._wrapX = i.wrapLng && !this.options.noWrap && [Math.floor(t.project([0, i.wrapLng[0]], n).x / e.x), Math.ceil(t.project([0, i.wrapLng[1]], n).x / e.y)], this._wrapY = i.wrapLat && !this.options.noWrap && [Math.floor(t.project([i.wrapLat[0], 0], n).y / e.x), Math.ceil(t.project([i.wrapLat[1], 0], n).y / e.y)] }, _onMoveEnd: function () { this._map && !this._map._animatingZoom && this._update() }, _getTiledPixelBounds: function (t) { var i = this._map, e = i._animatingZoom ? Math.max(i._animateToZoom, i.getZoom()) : i.getZoom(), n = i.getZoomScale(e, this._tileZoom), o = i.project(t, this._tileZoom).floor(), s = i.getSize().divideBy(2 * n); return new O(o.subtract(s), o.add(s)) }, _update: function (t) { var i = this._map; if (i) { var e = this._clampZoom(i.getZoom()); if (void 0 === t && (t = i.getCenter()), void 0 !== this._tileZoom) { var n = this._getTiledPixelBounds(t), o = this._pxBoundsToTileRange(n), s = o.getCenter(), r = [], a = this.options.keepBuffer, h = new O(o.getBottomLeft().subtract([a, -a]), o.getTopRight().add([a, -a])); if (!(isFinite(o.min.x) && isFinite(o.min.y) && isFinite(o.max.x) && isFinite(o.max.y))) throw new Error("Attempted to load an infinite number of tiles"); for (var u in this._tiles) { var l = this._tiles[u].coords; l.z === this._tileZoom && h.contains(new B(l.x, l.y)) || (this._tiles[u].current = !1) } if (1 < Math.abs(e - this._tileZoom)) this._setView(t, e); else { for (var c = o.min.y; c <= o.max.y; c++)for (var _ = o.min.x; _ <= o.max.x; _++) { var d = new B(_, c); if (d.z = this._tileZoom, this._isValidTile(d)) { var p = this._tiles[this._tileCoordsToKey(d)]; p ? p.current = !0 : r.push(d) } } if (r.sort(function (t, i) { return t.distanceTo(s) - i.distanceTo(s) }), 0 !== r.length) { this._loading || (this._loading = !0, this.fire("loading")); var m = document.createDocumentFragment(); for (_ = 0; _ < r.length; _++)this._addTile(r[_], m); this._level.el.appendChild(m) } } } } }, _isValidTile: function (t) { var i = this._map.options.crs; if (!i.infinite) { var e = this._globalTileRange; if (!i.wrapLng && (t.x < e.min.x || t.x > e.max.x) || !i.wrapLat && (t.y < e.min.y || t.y > e.max.y)) return !1 } if (!this.options.bounds) return !0; var n = this._tileCoordsToBounds(t); return D(this.options.bounds).overlaps(n) }, _keyToBounds: function (t) { return this._tileCoordsToBounds(this._keyToTileCoords(t)) }, _tileCoordsToNwSe: function (t) { var i = this._map, e = this.getTileSize(), n = t.scaleBy(e), o = n.add(e); return [i.unproject(n, t.z), i.unproject(o, t.z)] }, _tileCoordsToBounds: function (t) { var i = this._tileCoordsToNwSe(t), e = new N(i[0], i[1]); return this.options.noWrap || (e = this._map.wrapLatLngBounds(e)), e }, _tileCoordsToKey: function (t) { return t.x + ":" + t.y + ":" + t.z }, _keyToTileCoords: function (t) { var i = t.split(":"), e = new B(+i[0], +i[1]); return e.z = +i[2], e }, _removeTile: function (t) { var i = this._tiles[t]; i && (li(i.el), delete this._tiles[t], this.fire("tileunload", { tile: i.el, coords: this._keyToTileCoords(t) })) }, _initTile: function (t) { mi(t, "leaflet-tile"); var i = this.getTileSize(); t.style.width = i.x + "px", t.style.height = i.y + "px", t.onselectstart = l, t.onmousemove = l, et && this.options.opacity < 1 && yi(t, this.options.opacity), st && !rt && (t.style.WebkitBackfaceVisibility = "hidden") }, _addTile: function (t, i) { var e = this._getTilePos(t), n = this._tileCoordsToKey(t), o = this.createTile(this._wrapCoords(t), a(this._tileReady, this, t)); this._initTile(o), this.createTile.length < 2 && M(a(this._tileReady, this, t, null, o)), Pi(o, e), this._tiles[n] = { el: o, coords: t, current: !0 }, i.appendChild(o), this.fire("tileloadstart", { tile: o, coords: t }) }, _tileReady: function (t, i, e) { i && this.fire("tileerror", { error: i, tile: e, coords: t }); var n = this._tileCoordsToKey(t); (e = this._tiles[n]) && (e.loaded = +new Date, this._map._fadeAnimated ? (yi(e.el, 0), C(this._fadeFrame), this._fadeFrame = M(this._updateOpacity, this)) : (e.active = !0, this._pruneTiles()), i || (mi(e.el, "leaflet-tile-loaded"), this.fire("tileload", { tile: e.el, coords: t })), this._noTilesToLoad() && (this._loading = !1, this.fire("load"), et || !this._map._fadeAnimated ? M(this._pruneTiles, this) : setTimeout(a(this._pruneTiles, this), 250))) }, _getTilePos: function (t) { return t.scaleBy(this.getTileSize()).subtract(this._level.origin) }, _wrapCoords: function (t) { var i = new B(this._wrapX ? r(t.x, this._wrapX) : t.x, this._wrapY ? r(t.y, this._wrapY) : t.y); return i.z = t.z, i }, _pxBoundsToTileRange: function (t) { var i = this.getTileSize(); return new O(t.min.unscaleBy(i).floor(), t.max.unscaleBy(i).ceil().subtract([1, 1])) }, _noTilesToLoad: function () { for (var t in this._tiles) if (!this._tiles[t].loaded) return !1; return !0 } }); var un = hn.extend({ options: { minZoom: 0, maxZoom: 18, subdomains: "abc", errorTileUrl: "", zoomOffset: 0, tms: !1, zoomReverse: !1, detectRetina: !1, crossOrigin: !1 }, initialize: function (t, i) { this._url = t, (i = p(this, i)).detectRetina && Ct && 0 < i.maxZoom && (i.tileSize = Math.floor(i.tileSize / 2), i.zoomReverse ? (i.zoomOffset-- , i.minZoom++) : (i.zoomOffset++ , i.maxZoom--), i.minZoom = Math.max(0, i.minZoom)), "string" == typeof i.subdomains && (i.subdomains = i.subdomains.split("")), st || this.on("tileunload", this._onTileRemove) }, setUrl: function (t, i) { return this._url === t && void 0 === i && (i = !0), this._url = t, i || this.redraw(), this }, createTile: function (t, i) { var e = document.createElement("img"); return ki(e, "load", a(this._tileOnLoad, this, i, e)), ki(e, "error", a(this._tileOnError, this, i, e)), !this.options.crossOrigin && "" !== this.options.crossOrigin || (e.crossOrigin = !0 === this.options.crossOrigin ? "" : this.options.crossOrigin), e.alt = "", e.setAttribute("role", "presentation"), e.src = this.getTileUrl(t), e }, getTileUrl: function (t) { var i = { r: Ct ? "@2x" : "", s: this._getSubdomain(t), x: t.x, y: t.y, z: this._getZoomForUrl() }; if (this._map && !this._map.options.crs.infinite) { var e = this._globalTileRange.max.y - t.y; this.options.tms && (i.y = e), i["-y"] = e } return g(this._url, h(i, this.options)) }, _tileOnLoad: function (t, i) { et ? setTimeout(a(t, this, null, i), 0) : t(null, i) }, _tileOnError: function (t, i, e) { var n = this.options.errorTileUrl; n && i.getAttribute("src") !== n && (i.src = n), t(e, i) }, _onTileRemove: function (t) { t.tile.onload = null }, _getZoomForUrl: function () { var t = this._tileZoom, i = this.options.maxZoom; return this.options.zoomReverse && (t = i - t), t + this.options.zoomOffset }, _getSubdomain: function (t) { var i = Math.abs(t.x + t.y) % this.options.subdomains.length; return this.options.subdomains[i] }, _abortLoading: function () { var t, i; for (t in this._tiles) this._tiles[t].coords.z !== this._tileZoom && ((i = this._tiles[t].el).onload = l, i.onerror = l, i.complete || (i.src = x, li(i), delete this._tiles[t])) }, _removeTile: function (t) { var i = this._tiles[t]; if (i) return ht || i.el.setAttribute("src", x), hn.prototype._removeTile.call(this, t) }, _tileReady: function (t, i, e) { if (this._map && (!e || e.getAttribute("src") !== x)) return hn.prototype._tileReady.call(this, t, i, e) } }); function ln(t, i) { return new un(t, i) } var cn = un.extend({ defaultWmsParams: { service: "WMS", request: "GetMap", layers: "", styles: "", format: "image/jpeg", transparent: !1, version: "1.1.1" }, options: { crs: null, uppercase: !1 }, initialize: function (t, i) { this._url = t; var e = h({}, this.defaultWmsParams); for (var n in i) n in this.options || (e[n] = i[n]); var o = (i = p(this, i)).detectRetina && Ct ? 2 : 1, s = this.getTileSize(); e.width = s.x * o, e.height = s.y * o, this.wmsParams = e }, onAdd: function (t) { this._crs = this.options.crs || t.options.crs, this._wmsVersion = parseFloat(this.wmsParams.version); var i = 1.3 <= this._wmsVersion ? "crs" : "srs"; this.wmsParams[i] = this._crs.code, un.prototype.onAdd.call(this, t) }, getTileUrl: function (t) { var i = this._tileCoordsToNwSe(t), e = this._crs, n = R(e.project(i[0]), e.project(i[1])), o = n.min, s = n.max, r = (1.3 <= this._wmsVersion && this._crs === Ce ? [o.y, o.x, s.y, s.x] : [o.x, o.y, s.x, s.y]).join(","), a = un.prototype.getTileUrl.call(this, t); return a + m(this.wmsParams, a, this.options.uppercase) + (this.options.uppercase ? "&BBOX=" : "&bbox=") + r }, setParams: function (t, i) { return h(this.wmsParams, t), i || this.redraw(), this } }); un.WMS = cn, ln.wms = function (t, i) { return new cn(t, i) }; var _n = Ee.extend({ options: { padding: .1, tolerance: 0 }, initialize: function (t) { p(this, t), u(this), this._layers = this._layers || {} }, onAdd: function () { this._container || (this._initContainer(), this._zoomAnimated && mi(this._container, "leaflet-zoom-animated")), this.getPane().appendChild(this._container), this._update(), this.on("update", this._updatePaths, this) }, onRemove: function () { this.off("update", this._updatePaths, this), this._destroyContainer() }, getEvents: function () { var t = { viewreset: this._reset, zoom: this._onZoom, moveend: this._update, zoomend: this._onZoomEnd }; return this._zoomAnimated && (t.zoomanim = this._onAnimZoom), t }, _onAnimZoom: function (t) { this._updateTransform(t.center, t.zoom) }, _onZoom: function () { this._updateTransform(this._map.getCenter(), this._map.getZoom()) }, _updateTransform: function (t, i) { var e = this._map.getZoomScale(i, this._zoom), n = Li(this._container), o = this._map.getSize().multiplyBy(.5 + this.options.padding), s = this._map.project(this._center, i), r = this._map.project(t, i).subtract(s), a = o.multiplyBy(-e).add(n).add(o).subtract(r); yt ? wi(this._container, a, e) : Pi(this._container, a) }, _reset: function () { for (var t in this._update(), this._updateTransform(this._center, this._zoom), this._layers) this._layers[t]._reset() }, _onZoomEnd: function () { for (var t in this._layers) this._layers[t]._project() }, _updatePaths: function () { for (var t in this._layers) this._layers[t]._update() }, _update: function () { var t = this.options.padding, i = this._map.getSize(), e = this._map.containerPointToLayerPoint(i.multiplyBy(-t)).round(); this._bounds = new O(e, e.add(i.multiplyBy(1 + 2 * t)).round()), this._center = this._map.getCenter(), this._zoom = this._map.getZoom() } }), dn = _n.extend({ getEvents: function () { var t = _n.prototype.getEvents.call(this); return t.viewprereset = this._onViewPreReset, t }, _onViewPreReset: function () { this._postponeUpdatePaths = !0 }, onAdd: function () { _n.prototype.onAdd.call(this), this._draw() }, _initContainer: function () { var t = this._container = document.createElement("canvas"); ki(t, "mousemove", this._onMouseMove, this), ki(t, "click dblclick mousedown mouseup contextmenu", this._onClick, this), ki(t, "mouseout", this._handleMouseOut, this), this._ctx = t.getContext("2d") }, _destroyContainer: function () { C(this._redrawRequest), delete this._ctx, li(this._container), Ai(this._container), delete this._container }, _updatePaths: function () { if (!this._postponeUpdatePaths) { for (var t in this._redrawBounds = null, this._layers) this._layers[t]._update(); this._redraw() } }, _update: function () { if (!this._map._animatingZoom || !this._bounds) { _n.prototype._update.call(this); var t = this._bounds, i = this._container, e = t.getSize(), n = Ct ? 2 : 1; Pi(i, t.min), i.width = n * e.x, i.height = n * e.y, i.style.width = e.x + "px", i.style.height = e.y + "px", Ct && this._ctx.scale(2, 2), this._ctx.translate(-t.min.x, -t.min.y), this.fire("update") } }, _reset: function () { _n.prototype._reset.call(this), this._postponeUpdatePaths && (this._postponeUpdatePaths = !1, this._updatePaths()) }, _initPath: function (t) { this._updateDashArray(t); var i = (this._layers[u(t)] = t)._order = { layer: t, prev: this._drawLast, next: null }; this._drawLast && (this._drawLast.next = i), this._drawLast = i, this._drawFirst = this._drawFirst || this._drawLast }, _addPath: function (t) { this._requestRedraw(t) }, _removePath: function (t) { var i = t._order, e = i.next, n = i.prev; e ? e.prev = n : this._drawLast = n, n ? n.next = e : this._drawFirst = e, delete t._order, delete this._layers[u(t)], this._requestRedraw(t) }, _updatePath: function (t) { this._extendRedrawBounds(t), t._project(), t._update(), this._requestRedraw(t) }, _updateStyle: function (t) { this._updateDashArray(t), this._requestRedraw(t) }, _updateDashArray: function (t) { if ("string" == typeof t.options.dashArray) { var i, e, n = t.options.dashArray.split(/[, ]+/), o = []; for (e = 0; e < n.length; e++) { if (i = Number(n[e]), isNaN(i)) return; o.push(i) } t.options._dashArray = o } else t.options._dashArray = t.options.dashArray }, _requestRedraw: function (t) { this._map && (this._extendRedrawBounds(t), this._redrawRequest = this._redrawRequest || M(this._redraw, this)) }, _extendRedrawBounds: function (t) { if (t._pxBounds) { var i = (t.options.weight || 0) + 1; this._redrawBounds = this._redrawBounds || new O, this._redrawBounds.extend(t._pxBounds.min.subtract([i, i])), this._redrawBounds.extend(t._pxBounds.max.add([i, i])) } }, _redraw: function () { this._redrawRequest = null, this._redrawBounds && (this._redrawBounds.min._floor(), this._redrawBounds.max._ceil()), this._clear(), this._draw(), this._redrawBounds = null }, _clear: function () { var t = this._redrawBounds; if (t) { var i = t.getSize(); this._ctx.clearRect(t.min.x, t.min.y, i.x, i.y) } else this._ctx.clearRect(0, 0, this._container.width, this._container.height) }, _draw: function () { var t, i = this._redrawBounds; if (this._ctx.save(), i) { var e = i.getSize(); this._ctx.beginPath(), this._ctx.rect(i.min.x, i.min.y, e.x, e.y), this._ctx.clip() } this._drawing = !0; for (var n = this._drawFirst; n; n = n.next)t = n.layer, (!i || t._pxBounds && t._pxBounds.intersects(i)) && t._updatePath(); this._drawing = !1, this._ctx.restore() }, _updatePoly: function (t, i) { if (this._drawing) { var e, n, o, s, r = t._parts, a = r.length, h = this._ctx; if (a) { for (h.beginPath(), e = 0; e < a; e++) { for (n = 0, o = r[e].length; n < o; n++)s = r[e][n], h[n ? "lineTo" : "moveTo"](s.x, s.y); i && h.closePath() } this._fillStroke(h, t) } } }, _updateCircle: function (t) { if (this._drawing && !t._empty()) { var i = t._point, e = this._ctx, n = Math.max(Math.round(t._radius), 1), o = (Math.max(Math.round(t._radiusY), 1) || n) / n; 1 != o && (e.save(), e.scale(1, o)), e.beginPath(), e.arc(i.x, i.y / o, n, 0, 2 * Math.PI, !1), 1 != o && e.restore(), this._fillStroke(e, t) } }, _fillStroke: function (t, i) { var e = i.options; e.fill && (t.globalAlpha = e.fillOpacity, t.fillStyle = e.fillColor || e.color, t.fill(e.fillRule || "evenodd")), e.stroke && 0 !== e.weight && (t.setLineDash && t.setLineDash(i.options && i.options._dashArray || []), t.globalAlpha = e.opacity, t.lineWidth = e.weight, t.strokeStyle = e.color, t.lineCap = e.lineCap, t.lineJoin = e.lineJoin, t.stroke()) }, _onClick: function (t) { for (var i, e, n = this._map.mouseEventToLayerPoint(t), o = this._drawFirst; o; o = o.next)(i = o.layer).options.interactive && i._containsPoint(n) && !this._map._draggableMoved(i) && (e = i); e && (Gi(t), this._fireEvent([e], t)) }, _onMouseMove: function (t) { if (this._map && !this._map.dragging.moving() && !this._map._animatingZoom) { var i = this._map.mouseEventToLayerPoint(t); this._handleMouseHover(t, i) } }, _handleMouseOut: function (t) { var i = this._hoveredLayer; i && (fi(this._container, "leaflet-interactive"), this._fireEvent([i], t, "mouseout"), this._hoveredLayer = null, this._mouseHoverThrottled = !1) }, _handleMouseHover: function (t, i) { if (!this._mouseHoverThrottled) { for (var e, n, o = this._drawFirst; o; o = o.next)(e = o.layer).options.interactive && e._containsPoint(i) && (n = e); n !== this._hoveredLayer && (this._handleMouseOut(t), n && (mi(this._container, "leaflet-interactive"), this._fireEvent([n], t, "mouseover"), this._hoveredLayer = n)), this._hoveredLayer && this._fireEvent([this._hoveredLayer], t), this._mouseHoverThrottled = !0, setTimeout(L.bind(function () { this._mouseHoverThrottled = !1 }, this), 32) } }, _fireEvent: function (t, i, e) { this._map._fireDOMEvent(i, e || i.type, t) }, _bringToFront: function (t) { var i = t._order; if (i) { var e = i.next, n = i.prev; e && ((e.prev = n) ? n.next = e : e && (this._drawFirst = e), i.prev = this._drawLast, (this._drawLast.next = i).next = null, this._drawLast = i, this._requestRedraw(t)) } }, _bringToBack: function (t) { var i = t._order; if (i) { var e = i.next, n = i.prev; n && ((n.next = e) ? e.prev = n : n && (this._drawLast = n), i.prev = null, i.next = this._drawFirst, this._drawFirst.prev = i, this._drawFirst = i, this._requestRedraw(t)) } } }); function pn(t) { return Et ? new dn(t) : null } var mn = function () { try { return document.namespaces.add("lvml", "urn:schemas-microsoft-com:vml"), function (t) { return document.createElement("') } } catch (t) { return function (t) { return document.createElement("<" + t + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">') } } }(), fn = { _initContainer: function () { this._container = ui("div", "leaflet-vml-container") }, _update: function () { this._map._animatingZoom || (_n.prototype._update.call(this), this.fire("update")) }, _initPath: function (t) { var i = t._container = mn("shape"); mi(i, "leaflet-vml-shape " + (this.options.className || "")), i.coordsize = "1 1", t._path = mn("path"), i.appendChild(t._path), this._updateStyle(t), this._layers[u(t)] = t }, _addPath: function (t) { var i = t._container; this._container.appendChild(i), t.options.interactive && t.addInteractiveTarget(i) }, _removePath: function (t) { var i = t._container; li(i), t.removeInteractiveTarget(i), delete this._layers[u(t)] }, _updateStyle: function (t) { var i = t._stroke, e = t._fill, n = t.options, o = t._container; o.stroked = !!n.stroke, o.filled = !!n.fill, n.stroke ? (i || (i = t._stroke = mn("stroke")), o.appendChild(i), i.weight = n.weight + "px", i.color = n.color, i.opacity = n.opacity, n.dashArray ? i.dashStyle = v(n.dashArray) ? n.dashArray.join(" ") : n.dashArray.replace(/( *, *)/g, " ") : i.dashStyle = "", i.endcap = n.lineCap.replace("butt", "flat"), i.joinstyle = n.lineJoin) : i && (o.removeChild(i), t._stroke = null), n.fill ? (e || (e = t._fill = mn("fill")), o.appendChild(e), e.color = n.fillColor || n.color, e.opacity = n.fillOpacity) : e && (o.removeChild(e), t._fill = null) }, _updateCircle: function (t) { var i = t._point.round(), e = Math.round(t._radius), n = Math.round(t._radiusY || e); this._setPath(t, t._empty() ? "M0 0" : "AL " + i.x + "," + i.y + " " + e + "," + n + " 0,23592600") }, _setPath: function (t, i) { t._path.v = i }, _bringToFront: function (t) { _i(t._container) }, _bringToBack: function (t) { di(t._container) } }, gn = kt ? mn : $, vn = _n.extend({ getEvents: function () { var t = _n.prototype.getEvents.call(this); return t.zoomstart = this._onZoomStart, t }, _initContainer: function () { this._container = gn("svg"), this._container.setAttribute("pointer-events", "none"), this._rootGroup = gn("g"), this._container.appendChild(this._rootGroup) }, _destroyContainer: function () { li(this._container), Ai(this._container), delete this._container, delete this._rootGroup, delete this._svgSize }, _onZoomStart: function () { this._update() }, _update: function () { if (!this._map._animatingZoom || !this._bounds) { _n.prototype._update.call(this); var t = this._bounds, i = t.getSize(), e = this._container; this._svgSize && this._svgSize.equals(i) || (this._svgSize = i, e.setAttribute("width", i.x), e.setAttribute("height", i.y)), Pi(e, t.min), e.setAttribute("viewBox", [t.min.x, t.min.y, i.x, i.y].join(" ")), this.fire("update") } }, _initPath: function (t) { var i = t._path = gn("path"); t.options.className && mi(i, t.options.className), t.options.interactive && mi(i, "leaflet-interactive"), this._updateStyle(t), this._layers[u(t)] = t }, _addPath: function (t) { this._rootGroup || this._initContainer(), this._rootGroup.appendChild(t._path), t.addInteractiveTarget(t._path) }, _removePath: function (t) { li(t._path), t.removeInteractiveTarget(t._path), delete this._layers[u(t)] }, _updatePath: function (t) { t._project(), t._update() }, _updateStyle: function (t) { var i = t._path, e = t.options; i && (e.stroke ? (i.setAttribute("stroke", e.color), i.setAttribute("stroke-opacity", e.opacity), i.setAttribute("stroke-width", e.weight), i.setAttribute("stroke-linecap", e.lineCap), i.setAttribute("stroke-linejoin", e.lineJoin), e.dashArray ? i.setAttribute("stroke-dasharray", e.dashArray) : i.removeAttribute("stroke-dasharray"), e.dashOffset ? i.setAttribute("stroke-dashoffset", e.dashOffset) : i.removeAttribute("stroke-dashoffset")) : i.setAttribute("stroke", "none"), e.fill ? (i.setAttribute("fill", e.fillColor || e.color), i.setAttribute("fill-opacity", e.fillOpacity), i.setAttribute("fill-rule", e.fillRule || "evenodd")) : i.setAttribute("fill", "none")) }, _updatePoly: function (t, i) { this._setPath(t, Q(t._parts, i)) }, _updateCircle: function (t) { var i = t._point, e = Math.max(Math.round(t._radius), 1), n = "a" + e + "," + (Math.max(Math.round(t._radiusY), 1) || e) + " 0 1,0 ", o = t._empty() ? "M0 0" : "M" + (i.x - e) + "," + i.y + n + 2 * e + ",0 " + n + 2 * -e + ",0 "; this._setPath(t, o) }, _setPath: function (t, i) { t._path.setAttribute("d", i) }, _bringToFront: function (t) { _i(t._path) }, _bringToBack: function (t) { di(t._path) } }); function yn(t) { return Zt || kt ? new vn(t) : null } kt && vn.include(fn), $i.include({ getRenderer: function (t) { var i = t.options.renderer || this._getPaneRenderer(t.options.pane) || this.options.renderer || this._renderer; return i || (i = this._renderer = this._createRenderer()), this.hasLayer(i) || this.addLayer(i), i }, _getPaneRenderer: function (t) { if ("overlayPane" === t || void 0 === t) return !1; var i = this._paneRenderers[t]; return void 0 === i && (i = this._createRenderer({ pane: t }), this._paneRenderers[t] = i), i }, _createRenderer: function (t) { return this.options.preferCanvas && pn(t) || yn(t) } }); var xn = We.extend({ initialize: function (t, i) { We.prototype.initialize.call(this, this._boundsToLatLngs(t), i) }, setBounds: function (t) { return this.setLatLngs(this._boundsToLatLngs(t)) }, _boundsToLatLngs: function (t) { return [(t = D(t)).getSouthWest(), t.getNorthWest(), t.getNorthEast(), t.getSouthEast()] } }); vn.create = gn, vn.pointsToPath = Q, He.geometryToLayer = Fe, He.coordsToLatLng = Ve, He.coordsToLatLngs = qe, He.latLngToCoords = Ge, He.latLngsToCoords = Ke, He.getFeature = Ye, He.asFeature = Xe, $i.mergeOptions({ boxZoom: !0 }); var wn = se.extend({ initialize: function (t) { this._map = t, this._container = t._container, this._pane = t._panes.overlayPane, this._resetStateTimeout = 0, t.on("unload", this._destroy, this) }, addHooks: function () { ki(this._container, "mousedown", this._onMouseDown, this) }, removeHooks: function () { Ai(this._container, "mousedown", this._onMouseDown, this) }, moved: function () { return this._moved }, _destroy: function () { li(this._pane), delete this._pane }, _resetState: function () { this._resetStateTimeout = 0, this._moved = !1 }, _clearDeferredResetState: function () { 0 !== this._resetStateTimeout && (clearTimeout(this._resetStateTimeout), this._resetStateTimeout = 0) }, _onMouseDown: function (t) { if (!t.shiftKey || 1 !== t.which && 1 !== t.button) return !1; this._clearDeferredResetState(), this._resetState(), Qt(), Ti(), this._startPoint = this._map.mouseEventToContainerPoint(t), ki(document, { contextmenu: Wi, mousemove: this._onMouseMove, mouseup: this._onMouseUp, keydown: this._onKeyDown }, this) }, _onMouseMove: function (t) { this._moved || (this._moved = !0, this._box = ui("div", "leaflet-zoom-box", this._container), mi(this._container, "leaflet-crosshair"), this._map.fire("boxzoomstart")), this._point = this._map.mouseEventToContainerPoint(t); var i = new O(this._point, this._startPoint), e = i.getSize(); Pi(this._box, i.min), this._box.style.width = e.x + "px", this._box.style.height = e.y + "px" }, _finish: function () { this._moved && (li(this._box), fi(this._container, "leaflet-crosshair")), ti(), zi(), Ai(document, { contextmenu: Wi, mousemove: this._onMouseMove, mouseup: this._onMouseUp, keydown: this._onKeyDown }, this) }, _onMouseUp: function (t) { if ((1 === t.which || 1 === t.button) && (this._finish(), this._moved)) { this._clearDeferredResetState(), this._resetStateTimeout = setTimeout(a(this._resetState, this), 0); var i = new N(this._map.containerPointToLatLng(this._startPoint), this._map.containerPointToLatLng(this._point)); this._map.fitBounds(i).fire("boxzoomend", { boxZoomBounds: i }) } }, _onKeyDown: function (t) { 27 === t.keyCode && this._finish() } }); $i.addInitHook("addHandler", "boxZoom", wn), $i.mergeOptions({ doubleClickZoom: !0 }); var Pn = se.extend({ addHooks: function () { this._map.on("dblclick", this._onDoubleClick, this) }, removeHooks: function () { this._map.off("dblclick", this._onDoubleClick, this) }, _onDoubleClick: function (t) { var i = this._map, e = i.getZoom(), n = i.options.zoomDelta, o = t.originalEvent.shiftKey ? e - n : e + n; "center" === i.options.doubleClickZoom ? i.setZoom(o) : i.setZoomAround(t.containerPoint, o) } }); $i.addInitHook("addHandler", "doubleClickZoom", Pn), $i.mergeOptions({ dragging: !0, inertia: !rt, inertiaDeceleration: 3400, inertiaMaxSpeed: 1 / 0, easeLinearity: .2, worldCopyJump: !1, maxBoundsViscosity: 0 }); var Ln = se.extend({ addHooks: function () { if (!this._draggable) { var t = this._map; this._draggable = new ce(t._mapPane, t._container), this._draggable.on({ dragstart: this._onDragStart, drag: this._onDrag, dragend: this._onDragEnd }, this), this._draggable.on("predrag", this._onPreDragLimit, this), t.options.worldCopyJump && (this._draggable.on("predrag", this._onPreDragWrap, this), t.on("zoomend", this._onZoomEnd, this), t.whenReady(this._onZoomEnd, this)) } mi(this._map._container, "leaflet-grab leaflet-touch-drag"), this._draggable.enable(), this._positions = [], this._times = [] }, removeHooks: function () { fi(this._map._container, "leaflet-grab"), fi(this._map._container, "leaflet-touch-drag"), this._draggable.disable() }, moved: function () { return this._draggable && this._draggable._moved }, moving: function () { return this._draggable && this._draggable._moving }, _onDragStart: function () { var t = this._map; if (t._stop(), this._map.options.maxBounds && this._map.options.maxBoundsViscosity) { var i = D(this._map.options.maxBounds); this._offsetLimit = R(this._map.latLngToContainerPoint(i.getNorthWest()).multiplyBy(-1), this._map.latLngToContainerPoint(i.getSouthEast()).multiplyBy(-1).add(this._map.getSize())), this._viscosity = Math.min(1, Math.max(0, this._map.options.maxBoundsViscosity)) } else this._offsetLimit = null; t.fire("movestart").fire("dragstart"), t.options.inertia && (this._positions = [], this._times = []) }, _onDrag: function (t) { if (this._map.options.inertia) { var i = this._lastTime = +new Date, e = this._lastPos = this._draggable._absPos || this._draggable._newPos; this._positions.push(e), this._times.push(i), this._prunePositions(i) } this._map.fire("move", t).fire("drag", t) }, _prunePositions: function (t) { for (; 1 < this._positions.length && 50 < t - this._times[0];)this._positions.shift(), this._times.shift() }, _onZoomEnd: function () { var t = this._map.getSize().divideBy(2), i = this._map.latLngToLayerPoint([0, 0]); this._initialWorldOffset = i.subtract(t).x, this._worldWidth = this._map.getPixelWorldBounds().getSize().x }, _viscousLimit: function (t, i) { return t - (t - i) * this._viscosity }, _onPreDragLimit: function () { if (this._viscosity && this._offsetLimit) { var t = this._draggable._newPos.subtract(this._draggable._startPos), i = this._offsetLimit; t.x < i.min.x && (t.x = this._viscousLimit(t.x, i.min.x)), t.y < i.min.y && (t.y = this._viscousLimit(t.y, i.min.y)), t.x > i.max.x && (t.x = this._viscousLimit(t.x, i.max.x)), t.y > i.max.y && (t.y = this._viscousLimit(t.y, i.max.y)), this._draggable._newPos = this._draggable._startPos.add(t) } }, _onPreDragWrap: function () { var t = this._worldWidth, i = Math.round(t / 2), e = this._initialWorldOffset, n = this._draggable._newPos.x, o = (n - i + e) % t + i - e, s = (n + i + e) % t - i - e, r = Math.abs(o + e) < Math.abs(s + e) ? o : s; this._draggable._absPos = this._draggable._newPos.clone(), this._draggable._newPos.x = r }, _onDragEnd: function (t) { var i = this._map, e = i.options, n = !e.inertia || this._times.length < 2; if (i.fire("dragend", t), n) i.fire("moveend"); else { this._prunePositions(+new Date); var o = this._lastPos.subtract(this._positions[0]), s = (this._lastTime - this._times[0]) / 1e3, r = e.easeLinearity, a = o.multiplyBy(r / s), h = a.distanceTo([0, 0]), u = Math.min(e.inertiaMaxSpeed, h), l = a.multiplyBy(u / h), c = u / (e.inertiaDeceleration * r), _ = l.multiplyBy(-c / 2).round(); _.x || _.y ? (_ = i._limitOffset(_, i.options.maxBounds), M(function () { i.panBy(_, { duration: c, easeLinearity: r, noMoveStart: !0, animate: !0 }) })) : i.fire("moveend") } } }); $i.addInitHook("addHandler", "dragging", Ln), $i.mergeOptions({ keyboard: !0, keyboardPanDelta: 80 }); var bn = se.extend({ keyCodes: { left: [37], right: [39], down: [40], up: [38], zoomIn: [187, 107, 61, 171], zoomOut: [189, 109, 54, 173] }, initialize: function (t) { this._map = t, this._setPanDelta(t.options.keyboardPanDelta), this._setZoomDelta(t.options.zoomDelta) }, addHooks: function () { var t = this._map._container; t.tabIndex <= 0 && (t.tabIndex = "0"), ki(t, { focus: this._onFocus, blur: this._onBlur, mousedown: this._onMouseDown }, this), this._map.on({ focus: this._addHooks, blur: this._removeHooks }, this) }, removeHooks: function () { this._removeHooks(), Ai(this._map._container, { focus: this._onFocus, blur: this._onBlur, mousedown: this._onMouseDown }, this), this._map.off({ focus: this._addHooks, blur: this._removeHooks }, this) }, _onMouseDown: function () { if (!this._focused) { var t = document.body, i = document.documentElement, e = t.scrollTop || i.scrollTop, n = t.scrollLeft || i.scrollLeft; this._map._container.focus(), window.scrollTo(n, e) } }, _onFocus: function () { this._focused = !0, this._map.fire("focus") }, _onBlur: function () { this._focused = !1, this._map.fire("blur") }, _setPanDelta: function (t) { var i, e, n = this._panKeys = {}, o = this.keyCodes; for (i = 0, e = o.left.length; i < e; i++)n[o.left[i]] = [-1 * t, 0]; for (i = 0, e = o.right.length; i < e; i++)n[o.right[i]] = [t, 0]; for (i = 0, e = o.down.length; i < e; i++)n[o.down[i]] = [0, t]; for (i = 0, e = o.up.length; i < e; i++)n[o.up[i]] = [0, -1 * t] }, _setZoomDelta: function (t) { var i, e, n = this._zoomKeys = {}, o = this.keyCodes; for (i = 0, e = o.zoomIn.length; i < e; i++)n[o.zoomIn[i]] = t; for (i = 0, e = o.zoomOut.length; i < e; i++)n[o.zoomOut[i]] = -t }, _addHooks: function () { ki(document, "keydown", this._onKeyDown, this) }, _removeHooks: function () { Ai(document, "keydown", this._onKeyDown, this) }, _onKeyDown: function (t) { if (!(t.altKey || t.ctrlKey || t.metaKey)) { var i, e = t.keyCode, n = this._map; if (e in this._panKeys) n._panAnim && n._panAnim._inProgress || (i = this._panKeys[e], t.shiftKey && (i = I(i).multiplyBy(3)), n.panBy(i), n.options.maxBounds && n.panInsideBounds(n.options.maxBounds)); else if (e in this._zoomKeys) n.setZoom(n.getZoom() + (t.shiftKey ? 3 : 1) * this._zoomKeys[e]); else { if (27 !== e || !n._popup || !n._popup.options.closeOnEscapeKey) return; n.closePopup() } Wi(t) } } }); $i.addInitHook("addHandler", "keyboard", bn), $i.mergeOptions({ scrollWheelZoom: !0, wheelDebounceTime: 40, wheelPxPerZoomLevel: 60 }); var Tn = se.extend({ addHooks: function () { ki(this._map._container, "mousewheel", this._onWheelScroll, this), this._delta = 0 }, removeHooks: function () { Ai(this._map._container, "mousewheel", this._onWheelScroll, this) }, _onWheelScroll: function (t) { var i = Ui(t), e = this._map.options.wheelDebounceTime; this._delta += i, this._lastMousePos = this._map.mouseEventToContainerPoint(t), this._startTime || (this._startTime = +new Date); var n = Math.max(e - (+new Date - this._startTime), 0); clearTimeout(this._timer), this._timer = setTimeout(a(this._performZoom, this), n), Wi(t) }, _performZoom: function () { var t = this._map, i = t.getZoom(), e = this._map.options.zoomSnap || 0; t._stop(); var n = this._delta / (4 * this._map.options.wheelPxPerZoomLevel), o = 4 * Math.log(2 / (1 + Math.exp(-Math.abs(n)))) / Math.LN2, s = e ? Math.ceil(o / e) * e : o, r = t._limitZoom(i + (0 < this._delta ? s : -s)) - i; this._delta = 0, this._startTime = null, r && ("center" === t.options.scrollWheelZoom ? t.setZoom(i + r) : t.setZoomAround(this._lastMousePos, i + r)) } }); $i.addInitHook("addHandler", "scrollWheelZoom", Tn), $i.mergeOptions({ tap: !0, tapTolerance: 15 }); var zn = se.extend({ addHooks: function () { ki(this._map._container, "touchstart", this._onDown, this) }, removeHooks: function () { Ai(this._map._container, "touchstart", this._onDown, this) }, _onDown: function (t) { if (t.touches) { if (ji(t), this._fireClick = !0, 1 < t.touches.length) return this._fireClick = !1, void clearTimeout(this._holdTimeout); var i = t.touches[0], e = i.target; this._startPos = this._newPos = new B(i.clientX, i.clientY), e.tagName && "a" === e.tagName.toLowerCase() && mi(e, "leaflet-active"), this._holdTimeout = setTimeout(a(function () { this._isTapValid() && (this._fireClick = !1, this._onUp(), this._simulateEvent("contextmenu", i)) }, this), 1e3), this._simulateEvent("mousedown", i), ki(document, { touchmove: this._onMove, touchend: this._onUp }, this) } }, _onUp: function (t) { if (clearTimeout(this._holdTimeout), Ai(document, { touchmove: this._onMove, touchend: this._onUp }, this), this._fireClick && t && t.changedTouches) { var i = t.changedTouches[0], e = i.target; e && e.tagName && "a" === e.tagName.toLowerCase() && fi(e, "leaflet-active"), this._simulateEvent("mouseup", i), this._isTapValid() && this._simulateEvent("click", i) } }, _isTapValid: function () { return this._newPos.distanceTo(this._startPos) <= this._map.options.tapTolerance }, _onMove: function (t) { var i = t.touches[0]; this._newPos = new B(i.clientX, i.clientY), this._simulateEvent("mousemove", i) }, _simulateEvent: function (t, i) { var e = document.createEvent("MouseEvents"); e._simulated = !0, i.target._simulatedClick = !0, e.initMouseEvent(t, !0, !0, window, 1, i.screenX, i.screenY, i.clientX, i.clientY, !1, !1, !1, !1, 0, null), i.target.dispatchEvent(e) } }); Tt && !bt && $i.addInitHook("addHandler", "tap", zn), $i.mergeOptions({ touchZoom: Tt && !rt, bounceAtZoomLimits: !0 }); var Mn = se.extend({ addHooks: function () { mi(this._map._container, "leaflet-touch-zoom"), ki(this._map._container, "touchstart", this._onTouchStart, this) }, removeHooks: function () { fi(this._map._container, "leaflet-touch-zoom"), Ai(this._map._container, "touchstart", this._onTouchStart, this) }, _onTouchStart: function (t) { var i = this._map; if (t.touches && 2 === t.touches.length && !i._animatingZoom && !this._zooming) { var e = i.mouseEventToContainerPoint(t.touches[0]), n = i.mouseEventToContainerPoint(t.touches[1]); this._centerPoint = i.getSize()._divideBy(2), this._startLatLng = i.containerPointToLatLng(this._centerPoint), "center" !== i.options.touchZoom && (this._pinchStartLatLng = i.containerPointToLatLng(e.add(n)._divideBy(2))), this._startDist = e.distanceTo(n), this._startZoom = i.getZoom(), this._moved = !1, this._zooming = !0, i._stop(), ki(document, "touchmove", this._onTouchMove, this), ki(document, "touchend", this._onTouchEnd, this), ji(t) } }, _onTouchMove: function (t) { if (t.touches && 2 === t.touches.length && this._zooming) { var i = this._map, e = i.mouseEventToContainerPoint(t.touches[0]), n = i.mouseEventToContainerPoint(t.touches[1]), o = e.distanceTo(n) / this._startDist; if (this._zoom = i.getScaleZoom(o, this._startZoom), !i.options.bounceAtZoomLimits && (this._zoom < i.getMinZoom() && o < 1 || this._zoom > i.getMaxZoom() && 1 < o) && (this._zoom = i._limitZoom(this._zoom)), "center" === i.options.touchZoom) { if (this._center = this._startLatLng, 1 == o) return } else { var s = e._add(n)._divideBy(2)._subtract(this._centerPoint); if (1 == o && 0 === s.x && 0 === s.y) return; this._center = i.unproject(i.project(this._pinchStartLatLng, this._zoom).subtract(s), this._zoom) } this._moved || (i._moveStart(!0, !1), this._moved = !0), C(this._animRequest); var r = a(i._move, i, this._center, this._zoom, { pinch: !0, round: !1 }); this._animRequest = M(r, this, !0), ji(t) } }, _onTouchEnd: function () { this._moved && this._zooming ? (this._zooming = !1, C(this._animRequest), Ai(document, "touchmove", this._onTouchMove), Ai(document, "touchend", this._onTouchEnd), this._map.options.zoomAnimation ? this._map._animateZoom(this._center, this._map._limitZoom(this._zoom), !0, this._map.options.zoomSnap) : this._map._resetView(this._center, this._map._limitZoom(this._zoom))) : this._zooming = !1 } }); $i.addInitHook("addHandler", "touchZoom", Mn), $i.BoxZoom = wn, $i.DoubleClickZoom = Pn, $i.Drag = Ln, $i.Keyboard = bn, $i.ScrollWheelZoom = Tn, $i.Tap = zn, $i.TouchZoom = Mn, Object.freeze = i, t.version = "1.6.0", t.Control = te, t.control = Qi, t.Browser = At, t.Evented = k, t.Mixin = ae, t.Util = S, t.Class = E, t.Handler = se, t.extend = h, t.bind = a, t.stamp = u, t.setOptions = p, t.DomEvent = Xi, t.DomUtil = Zi, t.PosAnimation = Ji, t.Draggable = ce, t.LineUtil = xe, t.PolyUtil = Le, t.Point = B, t.point = I, t.Bounds = O, t.bounds = R, t.Transformation = G, t.transformation = K, t.Projection = ze, t.LatLng = j, t.latLng = W, t.LatLngBounds = N, t.latLngBounds = D, t.CRS = F, t.GeoJSON = He, t.geoJSON = $e, t.geoJson = Qe, t.Layer = Ee, t.LayerGroup = Ze, t.layerGroup = function (t, i) { return new Ze(t, i) }, t.FeatureGroup = ke, t.featureGroup = function (t) { return new ke(t) }, t.ImageOverlay = tn, t.imageOverlay = function (t, i, e) { return new tn(t, i, e) }, t.VideoOverlay = en, t.videoOverlay = function (t, i, e) { return new en(t, i, e) }, t.SVGOverlay = nn, t.svgOverlay = function (t, i, e) { return new nn(t, i, e) }, t.DivOverlay = on, t.Popup = sn, t.popup = function (t, i) { return new sn(t, i) }, t.Tooltip = rn, t.tooltip = function (t, i) { return new rn(t, i) }, t.Icon = Be, t.icon = function (t) { return new Be(t) }, t.DivIcon = an, t.divIcon = function (t) { return new an(t) }, t.Marker = Oe, t.marker = function (t, i) { return new Oe(t, i) }, t.TileLayer = un, t.tileLayer = ln, t.GridLayer = hn, t.gridLayer = function (t) { return new hn(t) }, t.SVG = vn, t.svg = yn, t.Renderer = _n, t.Canvas = dn, t.canvas = pn, t.Path = Re, t.CircleMarker = Ne, t.circleMarker = function (t, i) { return new Ne(t, i) }, t.Circle = De, t.circle = function (t, i, e) { return new De(t, i, e) }, t.Polyline = je, t.polyline = function (t, i) { return new je(t, i) }, t.Polygon = We, t.polygon = function (t, i) { return new We(t, i) }, t.Rectangle = xn, t.rectangle = function (t, i) { return new xn(t, i) }, t.Map = $i, t.map = function (t, i) { return new $i(t, i) }; var Cn = window.L; t.noConflict = function () { return window.L = Cn, this }, window.L = t });; /* Leaflet.draw 1.0.4, a plugin that adds drawing and editing tools to Leaflet powered maps. (c) 2012-2017, Jacob Toye, Jon West, Smartrak, Leaflet https://github.com/Leaflet/Leaflet.draw http://leafletjs.com */ !function (t, e, i) { function o(t, e) { for (; (t = t.parentElement) && !t.classList.contains(e);); return t } L.drawVersion = "1.0.4", L.Draw = {}, L.drawLocal = { draw: { toolbar: { actions: { title: "Cancel drawing", text: "Cancel" }, finish: { title: "Finish drawing", text: "Finish" }, undo: { title: "Delete last point drawn", text: "Delete last point" }, buttons: { polyline: "Draw a polyline", polygon: "Draw a polygon", rectangle: "Draw a rectangle", circle: "Draw a circle", marker: "Draw a marker", circlemarker: "Draw a circlemarker" } }, handlers: { circle: { tooltip: { start: "Click and drag to draw circle." }, radius: "Radius" }, circlemarker: { tooltip: { start: "Click map to place circle marker." } }, marker: { tooltip: { start: "Click map to place marker." } }, polygon: { tooltip: { start: "Click to start drawing shape.", cont: "Click to continue drawing shape.", end: "Click first point to close this shape." } }, polyline: { error: "Error: shape edges cannot cross!", tooltip: { start: "Click to start drawing line.", cont: "Click to continue drawing line.", end: "Click last point to finish line." } }, rectangle: { tooltip: { start: "Click and drag to draw rectangle." } }, simpleshape: { tooltip: { end: "Release mouse to finish drawing." } } } }, edit: { toolbar: { actions: { save: { title: "Save changes", text: "Save" }, cancel: { title: "Cancel editing, discards all changes", text: "Cancel" }, clearAll: { title: "Clear all layers", text: "Clear All" } }, buttons: { edit: "Edit layers", editDisabled: "No layers to edit", remove: "Delete layers", removeDisabled: "No layers to delete" } }, handlers: { edit: { tooltip: { text: "Drag handles or markers to edit features.", subtext: "Click cancel to undo changes." } }, remove: { tooltip: { text: "Click on a feature to remove." } } } } }, L.Draw.Event = {}, L.Draw.Event.CREATED = "draw:created", L.Draw.Event.EDITED = "draw:edited", L.Draw.Event.DELETED = "draw:deleted", L.Draw.Event.DRAWSTART = "draw:drawstart", L.Draw.Event.DRAWSTOP = "draw:drawstop", L.Draw.Event.DRAWVERTEX = "draw:drawvertex", L.Draw.Event.EDITSTART = "draw:editstart", L.Draw.Event.EDITMOVE = "draw:editmove", L.Draw.Event.EDITRESIZE = "draw:editresize", L.Draw.Event.EDITVERTEX = "draw:editvertex", L.Draw.Event.EDITSTOP = "draw:editstop", L.Draw.Event.DELETESTART = "draw:deletestart", L.Draw.Event.DELETESTOP = "draw:deletestop", L.Draw.Event.TOOLBAROPENED = "draw:toolbaropened", L.Draw.Event.TOOLBARCLOSED = "draw:toolbarclosed", L.Draw.Event.MARKERCONTEXT = "draw:markercontext", L.Draw = L.Draw || {}, L.Draw.Feature = L.Handler.extend({ initialize: function (t, e) { this._map = t, this._container = t._container, this._overlayPane = t._panes.overlayPane, this._popupPane = t._panes.popupPane, e && e.shapeOptions && (e.shapeOptions = L.Util.extend({}, this.options.shapeOptions, e.shapeOptions)), L.setOptions(this, e); var i = L.version.split("."); 1 === parseInt(i[0], 10) && parseInt(i[1], 10) >= 2 ? L.Draw.Feature.include(L.Evented.prototype) : L.Draw.Feature.include(L.Mixin.Events) }, enable: function () { this._enabled || (L.Handler.prototype.enable.call(this), this.fire("enabled", { handler: this.type }), this._map.fire(L.Draw.Event.DRAWSTART, { layerType: this.type })) }, disable: function () { this._enabled && (L.Handler.prototype.disable.call(this), this._map.fire(L.Draw.Event.DRAWSTOP, { layerType: this.type }), this.fire("disabled", { handler: this.type })) }, addHooks: function () { var t = this._map; t && (L.DomUtil.disableTextSelection(), t.getContainer().focus(), this._tooltip = new L.Draw.Tooltip(this._map), L.DomEvent.on(this._container, "keyup", this._cancelDrawing, this)) }, removeHooks: function () { this._map && (L.DomUtil.enableTextSelection(), this._tooltip.dispose(), this._tooltip = null, L.DomEvent.off(this._container, "keyup", this._cancelDrawing, this)) }, setOptions: function (t) { L.setOptions(this, t) }, _fireCreatedEvent: function (t) { this._map.fire(L.Draw.Event.CREATED, { layer: t, layerType: this.type }) }, _cancelDrawing: function (t) { 27 === t.keyCode && (this._map.fire("draw:canceled", { layerType: this.type }), this.disable()) } }), L.Draw.Polyline = L.Draw.Feature.extend({ statics: { TYPE: "polyline" }, Poly: L.Polyline, options: { allowIntersection: !0, repeatMode: !1, drawError: { color: "#b00b00", timeout: 2500 }, icon: new L.DivIcon({ iconSize: new L.Point(8, 8), className: "leaflet-div-icon leaflet-editing-icon" }), touchIcon: new L.DivIcon({ iconSize: new L.Point(20, 20), className: "leaflet-div-icon leaflet-editing-icon leaflet-touch-icon" }), guidelineDistance: 20, maxGuideLineLength: 4e3, shapeOptions: { stroke: !0, color: "#3388ff", weight: 4, opacity: .5, fill: !1, clickable: !0 }, metric: !0, feet: !0, nautic: !1, showLength: !0, zIndexOffset: 2e3, factor: 1, maxPoints: 0 }, initialize: function (t, e) { L.Browser.touch && L.Browser.mobile && (this.options.icon = this.options.touchIcon), this.options.drawError.message = L.drawLocal.draw.handlers.polyline.error, e && e.drawError && (e.drawError = L.Util.extend({}, this.options.drawError, e.drawError)), this.type = L.Draw.Polyline.TYPE, L.Draw.Feature.prototype.initialize.call(this, t, e) }, addHooks: function () { L.Draw.Feature.prototype.addHooks.call(this), this._map && (this._markers = [], this._markerGroup = new L.LayerGroup, this._map.addLayer(this._markerGroup), this._poly = new L.Polyline([], this.options.shapeOptions), this._tooltip.updateContent(this._getTooltipText()), this._mouseMarker || (this._mouseMarker = L.marker(this._map.getCenter(), { icon: L.divIcon({ className: "leaflet-mouse-marker", iconAnchor: [20, 20], iconSize: [40, 40] }), opacity: 0, zIndexOffset: this.options.zIndexOffset })), this._mouseMarker.on("mouseout", this._onMouseOut, this).on("mousemove", this._onMouseMove, this).on("mousedown", this._onMouseDown, this).on("mouseup", this._onMouseUp, this).addTo(this._map), this._map.on("mouseup", this._onMouseUp, this).on("mousemove", this._onMouseMove, this).on("zoomlevelschange", this._onZoomEnd, this).on("touchstart", this._onTouch, this).on("zoomend", this._onZoomEnd, this)) }, removeHooks: function () { L.Draw.Feature.prototype.removeHooks.call(this), this._clearHideErrorTimeout(), this._cleanUpShape(), this._map.removeLayer(this._markerGroup), delete this._markerGroup, delete this._markers, this._map.removeLayer(this._poly), delete this._poly, this._mouseMarker.off("mousedown", this._onMouseDown, this).off("mouseout", this._onMouseOut, this).off("mouseup", this._onMouseUp, this).off("mousemove", this._onMouseMove, this), this._map.removeLayer(this._mouseMarker), delete this._mouseMarker, this._clearGuides(), this._map.off("mouseup", this._onMouseUp, this).off("mousemove", this._onMouseMove, this).off("zoomlevelschange", this._onZoomEnd, this).off("zoomend", this._onZoomEnd, this).off("touchstart", this._onTouch, this).off("click", this._onTouch, this) }, deleteLastVertex: function () { if (!(this._markers.length <= 1)) { var t = this._markers.pop(), e = this._poly, i = e.getLatLngs(), o = i.splice(-1, 1)[0]; this._poly.setLatLngs(i), this._markerGroup.removeLayer(t), e.getLatLngs().length < 2 && this._map.removeLayer(e), this._vertexChanged(o, !1) } }, addVertex: function (t) { if (this._markers.length >= 2 && !this.options.allowIntersection && this._poly.newLatLngIntersects(t)) return void this._showErrorTooltip(); this._errorShown && this._hideErrorTooltip(), this._markers.push(this._createMarker(t)), this._poly.addLatLng(t), 2 === this._poly.getLatLngs().length && this._map.addLayer(this._poly), this._vertexChanged(t, !0) }, completeShape: function () { this._markers.length <= 1 || !this._shapeIsValid() || (this._fireCreatedEvent(), this.disable(), this.options.repeatMode && this.enable()) }, _finishShape: function () { var t = this._poly._defaultShape ? this._poly._defaultShape() : this._poly.getLatLngs(), e = this._poly.newLatLngIntersects(t[t.length - 1]); if (!this.options.allowIntersection && e || !this._shapeIsValid()) return void this._showErrorTooltip(); this._fireCreatedEvent(), this.disable(), this.options.repeatMode && this.enable() }, _shapeIsValid: function () { return !0 }, _onZoomEnd: function () { null !== this._markers && this._updateGuide() }, _onMouseMove: function (t) { var e = this._map.mouseEventToLayerPoint(t.originalEvent), i = this._map.layerPointToLatLng(e); this._currentLatLng = i, this._updateTooltip(i), this._updateGuide(e), this._mouseMarker.setLatLng(i), L.DomEvent.preventDefault(t.originalEvent) }, _vertexChanged: function (t, e) { this._map.fire(L.Draw.Event.DRAWVERTEX, { layers: this._markerGroup }), this._updateFinishHandler(), this._updateRunningMeasure(t, e), this._clearGuides(), this._updateTooltip() }, _onMouseDown: function (t) { if (!this._clickHandled && !this._touchHandled && !this._disableMarkers) { this._onMouseMove(t), this._clickHandled = !0, this._disableNewMarkers(); var e = t.originalEvent, i = e.clientX, o = e.clientY; this._startPoint.call(this, i, o) } }, _startPoint: function (t, e) { this._mouseDownOrigin = L.point(t, e) }, _onMouseUp: function (t) { var e = t.originalEvent, i = e.clientX, o = e.clientY; this._endPoint.call(this, i, o, t), this._clickHandled = null }, _endPoint: function (e, i, o) { if (this._mouseDownOrigin) { var a = L.point(e, i).distanceTo(this._mouseDownOrigin), n = this._calculateFinishDistance(o.latlng); this.options.maxPoints > 1 && this.options.maxPoints == this._markers.length + 1 ? (this.addVertex(o.latlng), this._finishShape()) : n < 10 && L.Browser.touch ? this._finishShape() : Math.abs(a) < 9 * (t.devicePixelRatio || 1) && this.addVertex(o.latlng), this._enableNewMarkers() } this._mouseDownOrigin = null }, _onTouch: function (t) { var e, i, o = t.originalEvent; !o.touches || !o.touches[0] || this._clickHandled || this._touchHandled || this._disableMarkers || (e = o.touches[0].clientX, i = o.touches[0].clientY, this._disableNewMarkers(), this._touchHandled = !0, this._startPoint.call(this, e, i), this._endPoint.call(this, e, i, t), this._touchHandled = null), this._clickHandled = null }, _onMouseOut: function () { this._tooltip && this._tooltip._onMouseOut.call(this._tooltip) }, _calculateFinishDistance: function (t) { var e; if (this._markers.length > 0) { var i; if (this.type === L.Draw.Polyline.TYPE) i = this._markers[this._markers.length - 1]; else { if (this.type !== L.Draw.Polygon.TYPE) return 1 / 0; i = this._markers[0] } var o = this._map.latLngToContainerPoint(i.getLatLng()), a = new L.Marker(t, { icon: this.options.icon, zIndexOffset: 2 * this.options.zIndexOffset }), n = this._map.latLngToContainerPoint(a.getLatLng()); e = o.distanceTo(n) } else e = 1 / 0; return e }, _updateFinishHandler: function () { var t = this._markers.length; t > 1 && this._markers[t - 1].on("click", this._finishShape, this), t > 2 && this._markers[t - 2].off("click", this._finishShape, this) }, _createMarker: function (t) { var e = new L.Marker(t, { icon: this.options.icon, zIndexOffset: 2 * this.options.zIndexOffset }); return this._markerGroup.addLayer(e), e }, _updateGuide: function (t) { var e = this._markers ? this._markers.length : 0; e > 0 && (t = t || this._map.latLngToLayerPoint(this._currentLatLng), this._clearGuides(), this._drawGuide(this._map.latLngToLayerPoint(this._markers[e - 1].getLatLng()), t)) }, _updateTooltip: function (t) { var e = this._getTooltipText(); t && this._tooltip.updatePosition(t), this._errorShown || this._tooltip.updateContent(e) }, _drawGuide: function (t, e) { var i, o, a, n = Math.floor(Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2))), s = this.options.guidelineDistance, r = this.options.maxGuideLineLength, l = n > r ? n - r : s; for (this._guidesContainer || (this._guidesContainer = L.DomUtil.create("div", "leaflet-draw-guides", this._overlayPane)); l < n; l += this.options.guidelineDistance)i = l / n, o = { x: Math.floor(t.x * (1 - i) + i * e.x), y: Math.floor(t.y * (1 - i) + i * e.y) }, a = L.DomUtil.create("div", "leaflet-draw-guide-dash", this._guidesContainer), a.style.backgroundColor = this._errorShown ? this.options.drawError.color : this.options.shapeOptions.color, L.DomUtil.setPosition(a, o) }, _updateGuideColor: function (t) { if (this._guidesContainer) for (var e = 0, i = this._guidesContainer.childNodes.length; e < i; e++)this._guidesContainer.childNodes[e].style.backgroundColor = t }, _clearGuides: function () { if (this._guidesContainer) for (; this._guidesContainer.firstChild;)this._guidesContainer.removeChild(this._guidesContainer.firstChild) }, _getTooltipText: function () { var t, e, i = this.options.showLength; return 0 === this._markers.length ? t = { text: L.drawLocal.draw.handlers.polyline.tooltip.start } : (e = i ? this._getMeasurementString() : "", t = 1 === this._markers.length ? { text: L.drawLocal.draw.handlers.polyline.tooltip.cont, subtext: e } : { text: L.drawLocal.draw.handlers.polyline.tooltip.end, subtext: e }), t }, _updateRunningMeasure: function (t, e) { var i, o, a = this._markers.length; 1 === this._markers.length ? this._measurementRunningTotal = 0 : (i = a - (e ? 2 : 1), o = L.GeometryUtil.isVersion07x() ? t.distanceTo(this._markers[i].getLatLng()) * (this.options.factor || 1) : this._map.distance(t, this._markers[i].getLatLng()) * (this.options.factor || 1), this._measurementRunningTotal += o * (e ? 1 : -1)) }, _getMeasurementString: function () { var t, e = this._currentLatLng, i = this._markers[this._markers.length - 1].getLatLng(); return t = L.GeometryUtil.isVersion07x() ? i && e && e.distanceTo ? this._measurementRunningTotal + e.distanceTo(i) * (this.options.factor || 1) : this._measurementRunningTotal || 0 : i && e ? this._measurementRunningTotal + this._map.distance(e, i) * (this.options.factor || 1) : this._measurementRunningTotal || 0, L.GeometryUtil.readableDistance(t, this.options.metric, this.options.feet, this.options.nautic, this.options.precision) }, _showErrorTooltip: function () { this._errorShown = !0, this._tooltip.showAsError().updateContent({ text: this.options.drawError.message }), this._updateGuideColor(this.options.drawError.color), this._poly.setStyle({ color: this.options.drawError.color }), this._clearHideErrorTimeout(), this._hideErrorTimeout = setTimeout(L.Util.bind(this._hideErrorTooltip, this), this.options.drawError.timeout) }, _hideErrorTooltip: function () { this._errorShown = !1, this._clearHideErrorTimeout(), this._tooltip.removeError().updateContent(this._getTooltipText()), this._updateGuideColor(this.options.shapeOptions.color), this._poly.setStyle({ color: this.options.shapeOptions.color }) }, _clearHideErrorTimeout: function () { this._hideErrorTimeout && (clearTimeout(this._hideErrorTimeout), this._hideErrorTimeout = null) }, _disableNewMarkers: function () { this._disableMarkers = !0 }, _enableNewMarkers: function () { setTimeout(function () { this._disableMarkers = !1 }.bind(this), 50) }, _cleanUpShape: function () { this._markers.length > 1 && this._markers[this._markers.length - 1].off("click", this._finishShape, this) }, _fireCreatedEvent: function () { var t = new this.Poly(this._poly.getLatLngs(), this.options.shapeOptions); L.Draw.Feature.prototype._fireCreatedEvent.call(this, t) } }), L.Draw.Polygon = L.Draw.Polyline.extend({ statics: { TYPE: "polygon" }, Poly: L.Polygon, options: { showArea: !1, showLength: !1, shapeOptions: { stroke: !0, color: "#3388ff", weight: 4, opacity: .5, fill: !0, fillColor: null, fillOpacity: .2, clickable: !0 }, metric: !0, feet: !0, nautic: !1, precision: {} }, initialize: function (t, e) { L.Draw.Polyline.prototype.initialize.call(this, t, e), this.type = L.Draw.Polygon.TYPE }, _updateFinishHandler: function () { var t = this._markers.length; 1 === t && this._markers[0].on("click", this._finishShape, this), t > 2 && (this._markers[t - 1].on("dblclick", this._finishShape, this), t > 3 && this._markers[t - 2].off("dblclick", this._finishShape, this)) }, _getTooltipText: function () { var t, e; return 0 === this._markers.length ? t = L.drawLocal.draw.handlers.polygon.tooltip.start : this._markers.length < 3 ? (t = L.drawLocal.draw.handlers.polygon.tooltip.cont, e = this._getMeasurementString()) : (t = L.drawLocal.draw.handlers.polygon.tooltip.end, e = this._getMeasurementString()), { text: t, subtext: e } }, _getMeasurementString: function () { var t = this._area, e = ""; return t || this.options.showLength ? (this.options.showLength && (e = L.Draw.Polyline.prototype._getMeasurementString.call(this)), t && (e += "
" + L.GeometryUtil.readableArea(t, this.options.metric, this.options.precision)), e) : null }, _shapeIsValid: function () { return this._markers.length >= 3 }, _vertexChanged: function (t, e) { var i; !this.options.allowIntersection && this.options.showArea && (i = this._poly.getLatLngs(), this._area = L.GeometryUtil.geodesicArea(i)), L.Draw.Polyline.prototype._vertexChanged.call(this, t, e) }, _cleanUpShape: function () { var t = this._markers.length; t > 0 && (this._markers[0].off("click", this._finishShape, this), t > 2 && this._markers[t - 1].off("dblclick", this._finishShape, this)) } }), L.SimpleShape = {}, L.Draw.SimpleShape = L.Draw.Feature.extend({ options: { repeatMode: !1 }, initialize: function (t, e) { this._endLabelText = L.drawLocal.draw.handlers.simpleshape.tooltip.end, L.Draw.Feature.prototype.initialize.call(this, t, e) }, addHooks: function () { L.Draw.Feature.prototype.addHooks.call(this), this._map && (this._mapDraggable = this._map.dragging.enabled(), this._mapDraggable && this._map.dragging.disable(), this._container.style.cursor = "crosshair", this._tooltip.updateContent({ text: this._initialLabelText }), this._map.on("mousedown", this._onMouseDown, this).on("mousemove", this._onMouseMove, this).on("touchstart", this._onMouseDown, this).on("touchmove", this._onMouseMove, this), e.addEventListener("touchstart", L.DomEvent.preventDefault, { passive: !1 })) }, removeHooks: function () { L.Draw.Feature.prototype.removeHooks.call(this), this._map && (this._mapDraggable && this._map.dragging.enable(), this._container.style.cursor = "", this._map.off("mousedown", this._onMouseDown, this).off("mousemove", this._onMouseMove, this).off("touchstart", this._onMouseDown, this).off("touchmove", this._onMouseMove, this), L.DomEvent.off(e, "mouseup", this._onMouseUp, this), L.DomEvent.off(e, "touchend", this._onMouseUp, this), e.removeEventListener("touchstart", L.DomEvent.preventDefault), this._shape && (this._map.removeLayer(this._shape), delete this._shape)), this._isDrawing = !1 }, _getTooltipText: function () { return { text: this._endLabelText } }, _onMouseDown: function (t) { this._isDrawing = !0, this._startLatLng = t.latlng, L.DomEvent.on(e, "mouseup", this._onMouseUp, this).on(e, "touchend", this._onMouseUp, this).preventDefault(t.originalEvent) }, _onMouseMove: function (t) { var e = t.latlng; this._tooltip.updatePosition(e), this._isDrawing && (this._tooltip.updateContent(this._getTooltipText()), this._drawShape(e)) }, _onMouseUp: function () { this._shape && this._fireCreatedEvent(), this.disable(), this.options.repeatMode && this.enable() } }), L.Draw.Rectangle = L.Draw.SimpleShape.extend({ statics: { TYPE: "rectangle" }, options: { shapeOptions: { stroke: !0, color: "#3388ff", weight: 4, opacity: .5, fill: !0, fillColor: null, fillOpacity: .2, clickable: !0 }, showArea: !0, metric: !0 }, initialize: function (t, e) { this.type = L.Draw.Rectangle.TYPE, this._initialLabelText = L.drawLocal.draw.handlers.rectangle.tooltip.start, L.Draw.SimpleShape.prototype.initialize.call(this, t, e) }, disable: function () { this._enabled && (this._isCurrentlyTwoClickDrawing = !1, L.Draw.SimpleShape.prototype.disable.call(this)) }, _onMouseUp: function (t) { if (!this._shape && !this._isCurrentlyTwoClickDrawing) return void (this._isCurrentlyTwoClickDrawing = !0); this._isCurrentlyTwoClickDrawing && !o(t.target, "leaflet-pane") || L.Draw.SimpleShape.prototype._onMouseUp.call(this) }, _drawShape: function (t) { this._shape ? this._shape.setBounds(new L.LatLngBounds(this._startLatLng, t)) : (this._shape = new L.Rectangle(new L.LatLngBounds(this._startLatLng, t), this.options.shapeOptions), this._map.addLayer(this._shape)) }, _fireCreatedEvent: function () { var t = new L.Rectangle(this._shape.getBounds(), this.options.shapeOptions); L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this, t) }, _getTooltipText: function () { var t, e, i, o = L.Draw.SimpleShape.prototype._getTooltipText.call(this), a = this._shape, n = this.options.showArea; return a && (t = this._shape._defaultShape ? this._shape._defaultShape() : this._shape.getLatLngs(), e = L.GeometryUtil.geodesicArea(t), i = n ? L.GeometryUtil.readableArea(e, this.options.metric) : ""), { text: o.text, subtext: i } } }), L.Draw.Marker = L.Draw.Feature.extend({ statics: { TYPE: "marker" }, options: { icon: new L.Icon.Default, repeatMode: !1, zIndexOffset: 2e3 }, initialize: function (t, e) { this.type = L.Draw.Marker.TYPE, this._initialLabelText = L.drawLocal.draw.handlers.marker.tooltip.start, L.Draw.Feature.prototype.initialize.call(this, t, e) }, addHooks: function () { L.Draw.Feature.prototype.addHooks.call(this), this._map && (this._tooltip.updateContent({ text: this._initialLabelText }), this._mouseMarker || (this._mouseMarker = L.marker(this._map.getCenter(), { icon: L.divIcon({ className: "leaflet-mouse-marker", iconAnchor: [20, 20], iconSize: [40, 40] }), opacity: 0, zIndexOffset: this.options.zIndexOffset })), this._mouseMarker.on("click", this._onClick, this).addTo(this._map), this._map.on("mousemove", this._onMouseMove, this), this._map.on("click", this._onTouch, this)) }, removeHooks: function () { L.Draw.Feature.prototype.removeHooks.call(this), this._map && (this._map.off("click", this._onClick, this).off("click", this._onTouch, this), this._marker && (this._marker.off("click", this._onClick, this), this._map.removeLayer(this._marker), delete this._marker), this._mouseMarker.off("click", this._onClick, this), this._map.removeLayer(this._mouseMarker), delete this._mouseMarker, this._map.off("mousemove", this._onMouseMove, this)) }, _onMouseMove: function (t) { var e = t.latlng; this._tooltip.updatePosition(e), this._mouseMarker.setLatLng(e), this._marker ? (e = this._mouseMarker.getLatLng(), this._marker.setLatLng(e)) : (this._marker = this._createMarker(e), this._marker.on("click", this._onClick, this), this._map.on("click", this._onClick, this).addLayer(this._marker)) }, _createMarker: function (t) { return new L.Marker(t, { icon: this.options.icon, zIndexOffset: this.options.zIndexOffset }) }, _onClick: function () { this._fireCreatedEvent(), this.disable(), this.options.repeatMode && this.enable() }, _onTouch: function (t) { this._onMouseMove(t), this._onClick() }, _fireCreatedEvent: function () { var t = new L.Marker.Touch(this._marker.getLatLng(), { icon: this.options.icon }); L.Draw.Feature.prototype._fireCreatedEvent.call(this, t) } }), L.Draw.CircleMarker = L.Draw.Marker.extend({ statics: { TYPE: "circlemarker" }, options: { stroke: !0, color: "#3388ff", weight: 4, opacity: .5, fill: !0, fillColor: null, fillOpacity: .2, clickable: !0, zIndexOffset: 2e3 }, initialize: function (t, e) { this.type = L.Draw.CircleMarker.TYPE, this._initialLabelText = L.drawLocal.draw.handlers.circlemarker.tooltip.start, L.Draw.Feature.prototype.initialize.call(this, t, e) }, _fireCreatedEvent: function () { var t = new L.CircleMarker(this._marker.getLatLng(), this.options); L.Draw.Feature.prototype._fireCreatedEvent.call(this, t) }, _createMarker: function (t) { return new L.CircleMarker(t, this.options) } }), L.Draw.Circle = L.Draw.SimpleShape.extend({ statics: { TYPE: "circle" }, options: { shapeOptions: { stroke: !0, color: "#3388ff", weight: 4, opacity: .5, fill: !0, fillColor: null, fillOpacity: .2, clickable: !0 }, showRadius: !0, metric: !0, feet: !0, nautic: !1 }, initialize: function (t, e) { this.type = L.Draw.Circle.TYPE, this._initialLabelText = L.drawLocal.draw.handlers.circle.tooltip.start, L.Draw.SimpleShape.prototype.initialize.call(this, t, e) }, _drawShape: function (t) { if (L.GeometryUtil.isVersion07x()) var e = this._startLatLng.distanceTo(t); else var e = this._map.distance(this._startLatLng, t); this._shape ? this._shape.setRadius(e) : (this._shape = new L.Circle(this._startLatLng, e, this.options.shapeOptions), this._map.addLayer(this._shape)) }, _fireCreatedEvent: function () { var t = new L.Circle(this._startLatLng, this._shape.getRadius(), this.options.shapeOptions); L.Draw.SimpleShape.prototype._fireCreatedEvent.call(this, t) }, _onMouseMove: function (t) { var e, i = t.latlng, o = this.options.showRadius, a = this.options.metric; if (this._tooltip.updatePosition(i), this._isDrawing) { this._drawShape(i), e = this._shape.getRadius().toFixed(1); var n = ""; o && (n = L.drawLocal.draw.handlers.circle.radius + ": " + L.GeometryUtil.readableDistance(e, a, this.options.feet, this.options.nautic)), this._tooltip.updateContent({ text: this._endLabelText, subtext: n }) } } }), L.Edit = L.Edit || {}, L.Edit.Marker = L.Handler.extend({ initialize: function (t, e) { this._marker = t, L.setOptions(this, e) }, addHooks: function () { var t = this._marker; t.dragging.enable(), t.on("dragend", this._onDragEnd, t), this._toggleMarkerHighlight() }, removeHooks: function () { var t = this._marker; t.dragging.disable(), t.off("dragend", this._onDragEnd, t), this._toggleMarkerHighlight() }, _onDragEnd: function (t) { var e = t.target; e.edited = !0, this._map.fire(L.Draw.Event.EDITMOVE, { layer: e }) }, _toggleMarkerHighlight: function () { var t = this._marker._icon; t && (t.style.display = "none", L.DomUtil.hasClass(t, "leaflet-edit-marker-selected") ? (L.DomUtil.removeClass(t, "leaflet-edit-marker-selected"), this._offsetMarker(t, -4)) : (L.DomUtil.addClass(t, "leaflet-edit-marker-selected"), this._offsetMarker(t, 4)), t.style.display = "") }, _offsetMarker: function (t, e) { var i = parseInt(t.style.marginTop, 10) - e, o = parseInt(t.style.marginLeft, 10) - e; t.style.marginTop = i + "px", t.style.marginLeft = o + "px" } }), L.Marker.addInitHook(function () { L.Edit.Marker && (this.editing = new L.Edit.Marker(this), this.options.editable && this.editing.enable()) }), L.Edit = L.Edit || {}, L.Edit.Poly = L.Handler.extend({ initialize: function (t) { this.latlngs = [t._latlngs], t._holes && (this.latlngs = this.latlngs.concat(t._holes)), this._poly = t, this._poly.on("revert-edited", this._updateLatLngs, this) }, _defaultShape: function () { return L.Polyline._flat ? L.Polyline._flat(this._poly._latlngs) ? this._poly._latlngs : this._poly._latlngs[0] : this._poly._latlngs }, _eachVertexHandler: function (t) { for (var e = 0; e < this._verticesHandlers.length; e++)t(this._verticesHandlers[e]) }, addHooks: function () { this._initHandlers(), this._eachVertexHandler(function (t) { t.addHooks() }) }, removeHooks: function () { this._eachVertexHandler(function (t) { t.removeHooks() }) }, updateMarkers: function () { this._eachVertexHandler(function (t) { t.updateMarkers() }) }, _initHandlers: function () { this._verticesHandlers = []; for (var t = 0; t < this.latlngs.length; t++)this._verticesHandlers.push(new L.Edit.PolyVerticesEdit(this._poly, this.latlngs[t], this._poly.options.poly)) }, _updateLatLngs: function (t) { this.latlngs = [t.layer._latlngs], t.layer._holes && (this.latlngs = this.latlngs.concat(t.layer._holes)) } }), L.Edit.PolyVerticesEdit = L.Handler.extend({ options: { icon: new L.DivIcon({ iconSize: new L.Point(8, 8), className: "leaflet-div-icon leaflet-editing-icon" }), touchIcon: new L.DivIcon({ iconSize: new L.Point(20, 20), className: "leaflet-div-icon leaflet-editing-icon leaflet-touch-icon" }), drawError: { color: "#b00b00", timeout: 1e3 } }, initialize: function (t, e, i) { L.Browser.touch && L.Browser.mobile && (this.options.icon = this.options.touchIcon), this._poly = t, i && i.drawError && (i.drawError = L.Util.extend({}, this.options.drawError, i.drawError)), this._latlngs = e, L.setOptions(this, i) }, _defaultShape: function () { return L.Polyline._flat ? L.Polyline._flat(this._latlngs) ? this._latlngs : this._latlngs[0] : this._latlngs }, addHooks: function () { var t = this._poly, e = t._path; t instanceof L.Polygon || (t.options.fill = !1, t.options.editing && (t.options.editing.fill = !1)), e && t.options.editing && t.options.editing.className && (t.options.original.className && t.options.original.className.split(" ").forEach(function (t) { L.DomUtil.removeClass(e, t) }), t.options.editing.className.split(" ").forEach(function (t) { L.DomUtil.addClass(e, t) })), t.setStyle(t.options.editing), this._poly._map && (this._map = this._poly._map, this._markerGroup || this._initMarkers(), this._poly._map.addLayer(this._markerGroup)) }, removeHooks: function () { var t = this._poly, e = t._path; e && t.options.editing && t.options.editing.className && (t.options.editing.className.split(" ").forEach(function (t) { L.DomUtil.removeClass(e, t) }), t.options.original.className && t.options.original.className.split(" ").forEach(function (t) { L.DomUtil.addClass(e, t) })), t.setStyle(t.options.original), t._map && (t._map.removeLayer(this._markerGroup), delete this._markerGroup, delete this._markers) }, updateMarkers: function () { this._markerGroup.clearLayers(), this._initMarkers() }, _initMarkers: function () { this._markerGroup || (this._markerGroup = new L.LayerGroup), this._markers = []; var t, e, i, o, a = this._defaultShape(); for (t = 0, i = a.length; t < i; t++)o = this._createMarker(a[t], t), o.on("click", this._onMarkerClick, this), o.on("contextmenu", this._onContextMenu, this), this._markers.push(o); var n, s; for (t = 0, e = i - 1; t < i; e = t++)(0 !== t || L.Polygon && this._poly instanceof L.Polygon) && (n = this._markers[e], s = this._markers[t], this._createMiddleMarker(n, s), this._updatePrevNext(n, s)) }, _createMarker: function (t, e) { var i = new L.Marker.Touch(t, { draggable: !0, icon: this.options.icon }); return i._origLatLng = t, i._index = e, i.on("dragstart", this._onMarkerDragStart, this).on("drag", this._onMarkerDrag, this).on("dragend", this._fireEdit, this).on("touchmove", this._onTouchMove, this).on("touchend", this._fireEdit, this).on("MSPointerMove", this._onTouchMove, this).on("MSPointerUp", this._fireEdit, this), this._markerGroup.addLayer(i), i }, _onMarkerDragStart: function () { this._poly.fire("editstart") }, _spliceLatLngs: function () { var t = this._defaultShape(), e = [].splice.apply(t, arguments); return this._poly._convertLatLngs(t, !0), this._poly.redraw(), e }, _removeMarker: function (t) { var e = t._index; this._markerGroup.removeLayer(t), this._markers.splice(e, 1), this._spliceLatLngs(e, 1), this._updateIndexes(e, -1), t.off("dragstart", this._onMarkerDragStart, this).off("drag", this._onMarkerDrag, this).off("dragend", this._fireEdit, this).off("touchmove", this._onMarkerDrag, this).off("touchend", this._fireEdit, this).off("click", this._onMarkerClick, this).off("MSPointerMove", this._onTouchMove, this).off("MSPointerUp", this._fireEdit, this) }, _fireEdit: function () { this._poly.edited = !0, this._poly.fire("edit"), this._poly._map.fire(L.Draw.Event.EDITVERTEX, { layers: this._markerGroup, poly: this._poly }) }, _onMarkerDrag: function (t) { var e = t.target, i = this._poly, o = L.LatLngUtil.cloneLatLng(e._origLatLng); if (L.extend(e._origLatLng, e._latlng), i.options.poly) { var a = i._map._editTooltip; if (!i.options.poly.allowIntersection && i.intersects()) { L.extend(e._origLatLng, o), e.setLatLng(o); var n = i.options.color; i.setStyle({ color: this.options.drawError.color }), a && a.updateContent({ text: L.drawLocal.draw.handlers.polyline.error }), setTimeout(function () { i.setStyle({ color: n }), a && a.updateContent({ text: L.drawLocal.edit.handlers.edit.tooltip.text, subtext: L.drawLocal.edit.handlers.edit.tooltip.subtext }) }, 1e3) } } e._middleLeft && e._middleLeft.setLatLng(this._getMiddleLatLng(e._prev, e)), e._middleRight && e._middleRight.setLatLng(this._getMiddleLatLng(e, e._next)), this._poly._bounds._southWest = L.latLng(1 / 0, 1 / 0), this._poly._bounds._northEast = L.latLng(-1 / 0, -1 / 0); var s = this._poly.getLatLngs(); this._poly._convertLatLngs(s, !0), this._poly.redraw(), this._poly.fire("editdrag") }, _onMarkerClick: function (t) { var e = L.Polygon && this._poly instanceof L.Polygon ? 4 : 3, i = t.target; this._defaultShape().length < e || (this._removeMarker(i), this._updatePrevNext(i._prev, i._next), i._middleLeft && this._markerGroup.removeLayer(i._middleLeft), i._middleRight && this._markerGroup.removeLayer(i._middleRight), i._prev && i._next ? this._createMiddleMarker(i._prev, i._next) : i._prev ? i._next || (i._prev._middleRight = null) : i._next._middleLeft = null, this._fireEdit()) }, _onContextMenu: function (t) { var e = t.target; this._poly; this._poly._map.fire(L.Draw.Event.MARKERCONTEXT, { marker: e, layers: this._markerGroup, poly: this._poly }), L.DomEvent.stopPropagation }, _onTouchMove: function (t) { var e = this._map.mouseEventToLayerPoint(t.originalEvent.touches[0]), i = this._map.layerPointToLatLng(e), o = t.target; L.extend(o._origLatLng, i), o._middleLeft && o._middleLeft.setLatLng(this._getMiddleLatLng(o._prev, o)), o._middleRight && o._middleRight.setLatLng(this._getMiddleLatLng(o, o._next)), this._poly.redraw(), this.updateMarkers() }, _updateIndexes: function (t, e) { this._markerGroup.eachLayer(function (i) { i._index > t && (i._index += e) }) }, _createMiddleMarker: function (t, e) { var i, o, a, n = this._getMiddleLatLng(t, e), s = this._createMarker(n); s.setOpacity(.6), t._middleRight = e._middleLeft = s, o = function () { s.off("touchmove", o, this); var a = e._index; s._index = a, s.off("click", i, this).on("click", this._onMarkerClick, this), n.lat = s.getLatLng().lat, n.lng = s.getLatLng().lng, this._spliceLatLngs(a, 0, n), this._markers.splice(a, 0, s), s.setOpacity(1), this._updateIndexes(a, 1), e._index++ , this._updatePrevNext(t, s), this._updatePrevNext(s, e), this._poly.fire("editstart") }, a = function () { s.off("dragstart", o, this), s.off("dragend", a, this), s.off("touchmove", o, this), this._createMiddleMarker(t, s), this._createMiddleMarker(s, e) }, i = function () { o.call(this), a.call(this), this._fireEdit() }, s.on("click", i, this).on("dragstart", o, this).on("dragend", a, this).on("touchmove", o, this), this._markerGroup.addLayer(s) }, _updatePrevNext: function (t, e) { t && (t._next = e), e && (e._prev = t) }, _getMiddleLatLng: function (t, e) { var i = this._poly._map, o = i.project(t.getLatLng()), a = i.project(e.getLatLng()); return i.unproject(o._add(a)._divideBy(2)) } }), L.Polyline.addInitHook(function () { this.editing || (L.Edit.Poly && (this.editing = new L.Edit.Poly(this), this.options.editable && this.editing.enable()), this.on("add", function () { this.editing && this.editing.enabled() && this.editing.addHooks() }), this.on("remove", function () { this.editing && this.editing.enabled() && this.editing.removeHooks() })) }), L.Edit = L.Edit || {}, L.Edit.SimpleShape = L.Handler.extend({ options: { moveIcon: new L.DivIcon({ iconSize: new L.Point(8, 8), className: "leaflet-div-icon leaflet-editing-icon leaflet-edit-move" }), resizeIcon: new L.DivIcon({ iconSize: new L.Point(8, 8), className: "leaflet-div-icon leaflet-editing-icon leaflet-edit-resize" }), touchMoveIcon: new L.DivIcon({ iconSize: new L.Point(20, 20), className: "leaflet-div-icon leaflet-editing-icon leaflet-edit-move leaflet-touch-icon" }), touchResizeIcon: new L.DivIcon({ iconSize: new L.Point(20, 20), className: "leaflet-div-icon leaflet-editing-icon leaflet-edit-resize leaflet-touch-icon" }) }, initialize: function (t, e) { L.Browser.touch && (this.options.moveIcon = this.options.touchMoveIcon, this.options.resizeIcon = this.options.touchResizeIcon), this._shape = t, L.Util.setOptions(this, e) }, addHooks: function () { var t = this._shape; this._shape._map && (this._map = this._shape._map, t.setStyle(t.options.editing), t._map && (this._map = t._map, this._markerGroup || this._initMarkers(), this._map.addLayer(this._markerGroup))) }, removeHooks: function () { var t = this._shape; if (t.setStyle(t.options.original), t._map) { this._unbindMarker(this._moveMarker); for (var e = 0, i = this._resizeMarkers.length; e < i; e++)this._unbindMarker(this._resizeMarkers[e]); this._resizeMarkers = null, this._map.removeLayer(this._markerGroup), delete this._markerGroup } this._map = null }, updateMarkers: function () { this._markerGroup.clearLayers(), this._initMarkers() }, _initMarkers: function () { this._markerGroup || (this._markerGroup = new L.LayerGroup), this._createMoveMarker(), this._createResizeMarker() }, _createMoveMarker: function () { }, _createResizeMarker: function () { }, _createMarker: function (t, e) { var i = new L.Marker.Touch(t, { draggable: !0, icon: e, zIndexOffset: 10 }); return this._bindMarker(i), this._markerGroup.addLayer(i), i }, _bindMarker: function (t) { t.on("dragstart", this._onMarkerDragStart, this).on("drag", this._onMarkerDrag, this).on("dragend", this._onMarkerDragEnd, this).on("touchstart", this._onTouchStart, this).on("touchmove", this._onTouchMove, this).on("MSPointerMove", this._onTouchMove, this).on("touchend", this._onTouchEnd, this).on("MSPointerUp", this._onTouchEnd, this) }, _unbindMarker: function (t) { t.off("dragstart", this._onMarkerDragStart, this).off("drag", this._onMarkerDrag, this).off("dragend", this._onMarkerDragEnd, this).off("touchstart", this._onTouchStart, this).off("touchmove", this._onTouchMove, this).off("MSPointerMove", this._onTouchMove, this).off("touchend", this._onTouchEnd, this).off("MSPointerUp", this._onTouchEnd, this) }, _onMarkerDragStart: function (t) { t.target.setOpacity(0), this._shape.fire("editstart") }, _fireEdit: function () { this._shape.edited = !0, this._shape.fire("edit") }, _onMarkerDrag: function (t) { var e = t.target, i = e.getLatLng(); e === this._moveMarker ? this._move(i) : this._resize(i), this._shape.redraw(), this._shape.fire("editdrag") }, _onMarkerDragEnd: function (t) { t.target.setOpacity(1), this._fireEdit() }, _onTouchStart: function (t) { if (L.Edit.SimpleShape.prototype._onMarkerDragStart.call(this, t), "function" == typeof this._getCorners) { var e = this._getCorners(), i = t.target, o = i._cornerIndex; i.setOpacity(0), this._oppositeCorner = e[(o + 2) % 4], this._toggleCornerMarkers(0, o) } this._shape.fire("editstart") }, _onTouchMove: function (t) { var e = this._map.mouseEventToLayerPoint(t.originalEvent.touches[0]), i = this._map.layerPointToLatLng(e); return t.target === this._moveMarker ? this._move(i) : this._resize(i), this._shape.redraw(), !1 }, _onTouchEnd: function (t) { t.target.setOpacity(1), this.updateMarkers(), this._fireEdit() }, _move: function () { }, _resize: function () { } }), L.Edit = L.Edit || {}, L.Edit.Rectangle = L.Edit.SimpleShape.extend({ _createMoveMarker: function () { var t = this._shape.getBounds(), e = t.getCenter(); this._moveMarker = this._createMarker(e, this.options.moveIcon) }, _createResizeMarker: function () { var t = this._getCorners(); this._resizeMarkers = []; for (var e = 0, i = t.length; e < i; e++)this._resizeMarkers.push(this._createMarker(t[e], this.options.resizeIcon)), this._resizeMarkers[e]._cornerIndex = e }, _onMarkerDragStart: function (t) { L.Edit.SimpleShape.prototype._onMarkerDragStart.call(this, t); var e = this._getCorners(), i = t.target, o = i._cornerIndex; this._oppositeCorner = e[(o + 2) % 4], this._toggleCornerMarkers(0, o) }, _onMarkerDragEnd: function (t) { var e, i, o = t.target; o === this._moveMarker && (e = this._shape.getBounds(), i = e.getCenter(), o.setLatLng(i)), this._toggleCornerMarkers(1), this._repositionCornerMarkers(), L.Edit.SimpleShape.prototype._onMarkerDragEnd.call(this, t) }, _move: function (t) { for (var e, i = this._shape._defaultShape ? this._shape._defaultShape() : this._shape.getLatLngs(), o = this._shape.getBounds(), a = o.getCenter(), n = [], s = 0, r = i.length; s < r; s++)e = [i[s].lat - a.lat, i[s].lng - a.lng], n.push([t.lat + e[0], t.lng + e[1]]); this._shape.setLatLngs(n), this._repositionCornerMarkers(), this._map.fire(L.Draw.Event.EDITMOVE, { layer: this._shape }) }, _resize: function (t) { var e; this._shape.setBounds(L.latLngBounds(t, this._oppositeCorner)), e = this._shape.getBounds(), this._moveMarker.setLatLng(e.getCenter()), this._map.fire(L.Draw.Event.EDITRESIZE, { layer: this._shape }) }, _getCorners: function () { var t = this._shape.getBounds(); return [t.getNorthWest(), t.getNorthEast(), t.getSouthEast(), t.getSouthWest()] }, _toggleCornerMarkers: function (t) { for (var e = 0, i = this._resizeMarkers.length; e < i; e++)this._resizeMarkers[e].setOpacity(t) }, _repositionCornerMarkers: function () { for (var t = this._getCorners(), e = 0, i = this._resizeMarkers.length; e < i; e++)this._resizeMarkers[e].setLatLng(t[e]) } }), L.Rectangle.addInitHook(function () { L.Edit.Rectangle && (this.editing = new L.Edit.Rectangle(this), this.options.editable && this.editing.enable()) }), L.Edit = L.Edit || {}, L.Edit.CircleMarker = L.Edit.SimpleShape.extend({ _createMoveMarker: function () { var t = this._shape.getLatLng(); this._moveMarker = this._createMarker(t, this.options.moveIcon) }, _createResizeMarker: function () { this._resizeMarkers = [] }, _move: function (t) { if (this._resizeMarkers.length) { var e = this._getResizeMarkerPoint(t); this._resizeMarkers[0].setLatLng(e) } this._shape.setLatLng(t), this._map.fire(L.Draw.Event.EDITMOVE, { layer: this._shape }) } }), L.CircleMarker.addInitHook(function () { L.Edit.CircleMarker && (this.editing = new L.Edit.CircleMarker(this), this.options.editable && this.editing.enable()), this.on("add", function () { this.editing && this.editing.enabled() && this.editing.addHooks() }), this.on("remove", function () { this.editing && this.editing.enabled() && this.editing.removeHooks() }) }), L.Edit = L.Edit || {}, L.Edit.Circle = L.Edit.CircleMarker.extend({ _createResizeMarker: function () { var t = this._shape.getLatLng(), e = this._getResizeMarkerPoint(t); this._resizeMarkers = [], this._resizeMarkers.push(this._createMarker(e, this.options.resizeIcon)) }, _getResizeMarkerPoint: function (t) { var e = this._shape._radius * Math.cos(Math.PI / 4), i = this._map.project(t); return this._map.unproject([i.x + e, i.y - e]) }, _resize: function (t) { var e = this._moveMarker.getLatLng(); L.GeometryUtil.isVersion07x() ? radius = e.distanceTo(t) : radius = this._map.distance(e, t), this._shape.setRadius(radius), this._map.editTooltip && this._map._editTooltip.updateContent({ text: L.drawLocal.edit.handlers.edit.tooltip.subtext + "
" + L.drawLocal.edit.handlers.edit.tooltip.text, subtext: L.drawLocal.draw.handlers.circle.radius + ": " + L.GeometryUtil.readableDistance(radius, !0, this.options.feet, this.options.nautic) }), this._shape.setRadius(radius), this._map.fire(L.Draw.Event.EDITRESIZE, { layer: this._shape }) } }), L.Circle.addInitHook(function () { L.Edit.Circle && (this.editing = new L.Edit.Circle(this), this.options.editable && this.editing.enable()) }), L.Map.mergeOptions({ touchExtend: !0 }), L.Map.TouchExtend = L.Handler.extend({ initialize: function (t) { this._map = t, this._container = t._container, this._pane = t._panes.overlayPane }, addHooks: function () { L.DomEvent.on(this._container, "touchstart", this._onTouchStart, this), L.DomEvent.on(this._container, "touchend", this._onTouchEnd, this), L.DomEvent.on(this._container, "touchmove", this._onTouchMove, this), this._detectIE() ? (L.DomEvent.on(this._container, "MSPointerDown", this._onTouchStart, this), L.DomEvent.on(this._container, "MSPointerUp", this._onTouchEnd, this), L.DomEvent.on(this._container, "MSPointerMove", this._onTouchMove, this), L.DomEvent.on(this._container, "MSPointerCancel", this._onTouchCancel, this)) : (L.DomEvent.on(this._container, "touchcancel", this._onTouchCancel, this), L.DomEvent.on(this._container, "touchleave", this._onTouchLeave, this)) }, removeHooks: function () { L.DomEvent.off(this._container, "touchstart", this._onTouchStart, this), L.DomEvent.off(this._container, "touchend", this._onTouchEnd, this), L.DomEvent.off(this._container, "touchmove", this._onTouchMove, this), this._detectIE() ? (L.DomEvent.off(this._container, "MSPointerDown", this._onTouchStart, this), L.DomEvent.off(this._container, "MSPointerUp", this._onTouchEnd, this), L.DomEvent.off(this._container, "MSPointerMove", this._onTouchMove, this), L.DomEvent.off(this._container, "MSPointerCancel", this._onTouchCancel, this)) : (L.DomEvent.off(this._container, "touchcancel", this._onTouchCancel, this), L.DomEvent.off(this._container, "touchleave", this._onTouchLeave, this)) }, _touchEvent: function (t, e) { var i = {}; if (void 0 !== t.touches) { if (!t.touches.length) return; i = t.touches[0] } else { if ("touch" !== t.pointerType) return; if (i = t, !this._filterClick(t)) return } var o = this._map.mouseEventToContainerPoint(i), a = this._map.mouseEventToLayerPoint(i), n = this._map.layerPointToLatLng(a); this._map.fire(e, { latlng: n, layerPoint: a, containerPoint: o, pageX: i.pageX, pageY: i.pageY, originalEvent: t }) }, _filterClick: function (t) { var e = t.timeStamp || t.originalEvent.timeStamp, i = L.DomEvent._lastClick && e - L.DomEvent._lastClick; return i && i > 100 && i < 500 || t.target._simulatedClick && !t._simulated ? (L.DomEvent.stop(t), !1) : (L.DomEvent._lastClick = e, !0) }, _onTouchStart: function (t) { if (this._map._loaded) { this._touchEvent(t, "touchstart") } }, _onTouchEnd: function (t) { if (this._map._loaded) { this._touchEvent(t, "touchend") } }, _onTouchCancel: function (t) { if (this._map._loaded) { var e = "touchcancel"; this._detectIE() && (e = "pointercancel"), this._touchEvent(t, e) } }, _onTouchLeave: function (t) { if (this._map._loaded) { this._touchEvent(t, "touchleave") } }, _onTouchMove: function (t) { if (this._map._loaded) { this._touchEvent(t, "touchmove") } }, _detectIE: function () { var e = t.navigator.userAgent, i = e.indexOf("MSIE "); if (i > 0) return parseInt(e.substring(i + 5, e.indexOf(".", i)), 10); if (e.indexOf("Trident/") > 0) { var o = e.indexOf("rv:"); return parseInt(e.substring(o + 3, e.indexOf(".", o)), 10) } var a = e.indexOf("Edge/"); return a > 0 && parseInt(e.substring(a + 5, e.indexOf(".", a)), 10) } }), L.Map.addInitHook("addHandler", "touchExtend", L.Map.TouchExtend), L.Marker.Touch = L.Marker.extend({ _initInteraction: function () { return this.addInteractiveTarget ? L.Marker.prototype._initInteraction.apply(this) : this._initInteractionLegacy() }, _initInteractionLegacy: function () { if (this.options.clickable) { var t = this._icon, e = ["dblclick", "mousedown", "mouseover", "mouseout", "contextmenu", "touchstart", "touchend", "touchmove"]; this._detectIE ? e.concat(["MSPointerDown", "MSPointerUp", "MSPointerMove", "MSPointerCancel"]) : e.concat(["touchcancel"]), L.DomUtil.addClass(t, "leaflet-clickable"), L.DomEvent.on(t, "click", this._onMouseClick, this), L.DomEvent.on(t, "keypress", this._onKeyPress, this); for (var i = 0; i < e.length; i++)L.DomEvent.on(t, e[i], this._fireMouseEvent, this); L.Handler.MarkerDrag && (this.dragging = new L.Handler.MarkerDrag(this), this.options.draggable && this.dragging.enable()) } }, _detectIE: function () { var e = t.navigator.userAgent, i = e.indexOf("MSIE "); if (i > 0) return parseInt(e.substring(i + 5, e.indexOf(".", i)), 10); if (e.indexOf("Trident/") > 0) { var o = e.indexOf("rv:"); return parseInt(e.substring(o + 3, e.indexOf(".", o)), 10) } var a = e.indexOf("Edge/"); return a > 0 && parseInt(e.substring(a + 5, e.indexOf(".", a)), 10) } }), L.LatLngUtil = { cloneLatLngs: function (t) { for (var e = [], i = 0, o = t.length; i < o; i++)Array.isArray(t[i]) ? e.push(L.LatLngUtil.cloneLatLngs(t[i])) : e.push(this.cloneLatLng(t[i])); return e }, cloneLatLng: function (t) { return L.latLng(t.lat, t.lng) } }, function () { var t = { km: 2, ha: 2, m: 0, mi: 2, ac: 2, yd: 0, ft: 0, nm: 2 }; L.GeometryUtil = L.extend(L.GeometryUtil || {}, { geodesicArea: function (t) { var e, i, o = t.length, a = 0, n = Math.PI / 180; if (o > 2) { for (var s = 0; s < o; s++)e = t[s], i = t[(s + 1) % o], a += (i.lng - e.lng) * n * (2 + Math.sin(e.lat * n) + Math.sin(i.lat * n)); a = 6378137 * a * 6378137 / 2 } return Math.abs(a) }, formattedNumber: function (t, e) { var i = parseFloat(t).toFixed(e), o = L.drawLocal.format && L.drawLocal.format.numeric, a = o && o.delimiters, n = a && a.thousands, s = a && a.decimal; if (n || s) { var r = i.split("."); i = n ? r[0].replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1" + n) : r[0], s = s || ".", r.length > 1 && (i = i + s + r[1]) } return i }, readableArea: function (e, i, o) { var a, n, o = L.Util.extend({}, t, o); return i ? (n = ["ha", "m"], type = typeof i, "string" === type ? n = [i] : "boolean" !== type && (n = i), a = e >= 1e6 && -1 !== n.indexOf("km") ? L.GeometryUtil.formattedNumber(1e-6 * e, o.km) + " km�" : e >= 1e4 && -1 !== n.indexOf("ha") ? L.GeometryUtil.formattedNumber(1e-4 * e, o.ha) + " ha" : L.GeometryUtil.formattedNumber(e, o.m) + " m�") : (e /= .836127, a = e >= 3097600 ? L.GeometryUtil.formattedNumber(e / 3097600, o.mi) + " mi�" : e >= 4840 ? L.GeometryUtil.formattedNumber(e / 4840, o.ac) + " acres" : L.GeometryUtil.formattedNumber(e, o.yd) + " yd�"), a }, readableDistance: function (e, i, o, a, n) { var s, n = L.Util.extend({}, t, n); switch (i ? "string" == typeof i ? i : "metric" : o ? "feet" : a ? "nauticalMile" : "yards") { case "metric": s = e > 1e3 ? L.GeometryUtil.formattedNumber(e / 1e3, n.km) + " km" : L.GeometryUtil.formattedNumber(e, n.m) + " m"; break; case "feet": e *= 3.28083, s = L.GeometryUtil.formattedNumber(e, n.ft) + " ft"; break; case "nauticalMile": e *= .53996, s = L.GeometryUtil.formattedNumber(e / 1e3, n.nm) + " nm"; break; case "yards": default: e *= 1.09361, s = e > 1760 ? L.GeometryUtil.formattedNumber(e / 1760, n.mi) + " miles" : L.GeometryUtil.formattedNumber(e, n.yd) + " yd" }return s }, isVersion07x: function () { var t = L.version.split("."); return 0 === parseInt(t[0], 10) && 7 === parseInt(t[1], 10) } }) }(), L.Util.extend(L.LineUtil, { segmentsIntersect: function (t, e, i, o) { return this._checkCounterclockwise(t, i, o) !== this._checkCounterclockwise(e, i, o) && this._checkCounterclockwise(t, e, i) !== this._checkCounterclockwise(t, e, o) }, _checkCounterclockwise: function (t, e, i) { return (i.y - t.y) * (e.x - t.x) > (e.y - t.y) * (i.x - t.x) } }), L.Polyline.include({ intersects: function () { var t, e, i, o = this._getProjectedPoints(), a = o ? o.length : 0; if (this._tooFewPointsForIntersection()) return !1; for (t = a - 1; t >= 3; t--)if (e = o[t - 1], i = o[t], this._lineSegmentsIntersectsRange(e, i, t - 2)) return !0; return !1 }, newLatLngIntersects: function (t, e) { return !!this._map && this.newPointIntersects(this._map.latLngToLayerPoint(t), e) }, newPointIntersects: function (t, e) { var i = this._getProjectedPoints(), o = i ? i.length : 0, a = i ? i[o - 1] : null, n = o - 2; return !this._tooFewPointsForIntersection(1) && this._lineSegmentsIntersectsRange(a, t, n, e ? 1 : 0) }, _tooFewPointsForIntersection: function (t) { var e = this._getProjectedPoints(), i = e ? e.length : 0; return i += t || 0, !e || i <= 3 }, _lineSegmentsIntersectsRange: function (t, e, i, o) { var a, n, s = this._getProjectedPoints(); o = o || 0; for (var r = i; r > o; r--)if (a = s[r - 1], n = s[r], L.LineUtil.segmentsIntersect(t, e, a, n)) return !0; return !1 }, _getProjectedPoints: function () { if (!this._defaultShape) return this._originalPoints; for (var t = [], e = this._defaultShape(), i = 0; i < e.length; i++)t.push(this._map.latLngToLayerPoint(e[i])); return t } }), L.Polygon.include({ intersects: function () { var t, e, i, o, a = this._getProjectedPoints(); return !this._tooFewPointsForIntersection() && (!!L.Polyline.prototype.intersects.call(this) || (t = a.length, e = a[0], i = a[t - 1], o = t - 2, this._lineSegmentsIntersectsRange(i, e, o, 1))) } }), L.Control.Draw = L.Control.extend({ options: { position: "topleft", draw: {}, edit: !1 }, initialize: function (t) { if (L.version < "0.7") throw new Error("Leaflet.draw 0.2.3+ requires Leaflet 0.7.0+. Download latest from https://github.com/Leaflet/Leaflet/"); L.Control.prototype.initialize.call(this, t); var e; this._toolbars = {}, L.DrawToolbar && this.options.draw && (e = new L.DrawToolbar(this.options.draw), this._toolbars[L.DrawToolbar.TYPE] = e, this._toolbars[L.DrawToolbar.TYPE].on("enable", this._toolbarEnabled, this)), L.EditToolbar && this.options.edit && (e = new L.EditToolbar(this.options.edit), this._toolbars[L.EditToolbar.TYPE] = e, this._toolbars[L.EditToolbar.TYPE].on("enable", this._toolbarEnabled, this)), L.toolbar = this }, onAdd: function (t) { var e, i = L.DomUtil.create("div", "leaflet-draw"), o = !1; for (var a in this._toolbars) this._toolbars.hasOwnProperty(a) && (e = this._toolbars[a].addToolbar(t)) && (o || (L.DomUtil.hasClass(e, "leaflet-draw-toolbar-top") || L.DomUtil.addClass(e.childNodes[0], "leaflet-draw-toolbar-top"), o = !0), i.appendChild(e)); return i }, onRemove: function () { for (var t in this._toolbars) this._toolbars.hasOwnProperty(t) && this._toolbars[t].removeToolbar() }, setDrawingOptions: function (t) { for (var e in this._toolbars) this._toolbars[e] instanceof L.DrawToolbar && this._toolbars[e].setOptions(t) }, _toolbarEnabled: function (t) { var e = t.target; for (var i in this._toolbars) this._toolbars[i] !== e && this._toolbars[i].disable() } }), L.Map.mergeOptions({ drawControlTooltips: !0, drawControl: !1 }), L.Map.addInitHook(function () { this.options.drawControl && (this.drawControl = new L.Control.Draw, this.addControl(this.drawControl)) }), L.Toolbar = L.Class.extend({ initialize: function (t) { L.setOptions(this, t), this._modes = {}, this._actionButtons = [], this._activeMode = null; var e = L.version.split("."); 1 === parseInt(e[0], 10) && parseInt(e[1], 10) >= 2 ? L.Toolbar.include(L.Evented.prototype) : L.Toolbar.include(L.Mixin.Events) }, enabled: function () { return null !== this._activeMode }, disable: function () { this.enabled() && this._activeMode.handler.disable() }, addToolbar: function (t) { var e, i = L.DomUtil.create("div", "leaflet-draw-section"), o = 0, a = this._toolbarClass || "", n = this.getModeHandlers(t); for (this._toolbarContainer = L.DomUtil.create("div", "leaflet-draw-toolbar leaflet-bar"), this._map = t, e = 0; e < n.length; e++)n[e].enabled && this._initModeHandler(n[e].handler, this._toolbarContainer, o++, a, n[e].title); if (o) return this._lastButtonIndex = --o, this._actionsContainer = L.DomUtil.create("ul", "leaflet-draw-actions"), i.appendChild(this._toolbarContainer), i.appendChild(this._actionsContainer), i }, removeToolbar: function () { for (var t in this._modes) this._modes.hasOwnProperty(t) && (this._disposeButton(this._modes[t].button, this._modes[t].handler.enable, this._modes[t].handler), this._modes[t].handler.disable(), this._modes[t].handler.off("enabled", this._handlerActivated, this).off("disabled", this._handlerDeactivated, this)); this._modes = {}; for (var e = 0, i = this._actionButtons.length; e < i; e++)this._disposeButton(this._actionButtons[e].button, this._actionButtons[e].callback, this); this._actionButtons = [], this._actionsContainer = null }, _initModeHandler: function (t, e, i, o, a) { var n = t.type; this._modes[n] = {}, this._modes[n].handler = t, this._modes[n].button = this._createButton({ type: n, title: a, className: o + "-" + n, container: e, callback: this._modes[n].handler.enable, context: this._modes[n].handler }), this._modes[n].buttonIndex = i, this._modes[n].handler.on("enabled", this._handlerActivated, this).on("disabled", this._handlerDeactivated, this) }, _detectIOS: function () { return /iPad|iPhone|iPod/.test(navigator.userAgent) && !t.MSStream }, _createButton: function (t) { var e = L.DomUtil.create("a", t.className || "", t.container), i = L.DomUtil.create("span", "sr-only", t.container); e.href = "#", e.appendChild(i), t.title && (e.title = t.title, i.innerHTML = t.title), t.text && (e.innerHTML = t.text, i.innerHTML = t.text); var o = this._detectIOS() ? "touchstart" : "click"; return L.DomEvent.on(e, "click", L.DomEvent.stopPropagation).on(e, "mousedown", L.DomEvent.stopPropagation).on(e, "dblclick", L.DomEvent.stopPropagation).on(e, "touchstart", L.DomEvent.stopPropagation).on(e, "click", L.DomEvent.preventDefault).on(e, o, t.callback, t.context), e }, _disposeButton: function (t, e) { var i = this._detectIOS() ? "touchstart" : "click"; L.DomEvent.off(t, "click", L.DomEvent.stopPropagation).off(t, "mousedown", L.DomEvent.stopPropagation).off(t, "dblclick", L.DomEvent.stopPropagation).off(t, "touchstart", L.DomEvent.stopPropagation).off(t, "click", L.DomEvent.preventDefault).off(t, i, e) }, _handlerActivated: function (t) { this.disable(), this._activeMode = this._modes[t.handler], L.DomUtil.addClass(this._activeMode.button, "leaflet-draw-toolbar-button-enabled"), this._showActionsToolbar(), this.fire("enable") }, _handlerDeactivated: function () { this._hideActionsToolbar(), L.DomUtil.removeClass(this._activeMode.button, "leaflet-draw-toolbar-button-enabled"), this._activeMode = null, this.fire("disable") }, _createActions: function (t) { var e, i, o, a, n = this._actionsContainer, s = this.getActions(t), r = s.length; for (i = 0, o = this._actionButtons.length; i < o; i++)this._disposeButton(this._actionButtons[i].button, this._actionButtons[i].callback); for (this._actionButtons = []; n.firstChild;)n.removeChild(n.firstChild); for (var l = 0; l < r; l++)"enabled" in s[l] && !s[l].enabled || (e = L.DomUtil.create("li", "", n), a = this._createButton({ title: s[l].title, text: s[l].text, container: e, callback: s[l].callback, context: s[l].context }), this._actionButtons.push({ button: a, callback: s[l].callback })) }, _showActionsToolbar: function () { var t = this._activeMode.buttonIndex, e = this._lastButtonIndex, i = this._activeMode.button.offsetTop - 1; this._createActions(this._activeMode.handler), this._actionsContainer.style.top = i + "px", 0 === t && (L.DomUtil.addClass(this._toolbarContainer, "leaflet-draw-toolbar-notop"), L.DomUtil.addClass(this._actionsContainer, "leaflet-draw-actions-top")), t === e && (L.DomUtil.addClass(this._toolbarContainer, "leaflet-draw-toolbar-nobottom"), L.DomUtil.addClass(this._actionsContainer, "leaflet-draw-actions-bottom")), this._actionsContainer.style.display = "block", this._map.fire(L.Draw.Event.TOOLBAROPENED) }, _hideActionsToolbar: function () { this._actionsContainer.style.display = "none", L.DomUtil.removeClass(this._toolbarContainer, "leaflet-draw-toolbar-notop"), L.DomUtil.removeClass(this._toolbarContainer, "leaflet-draw-toolbar-nobottom"), L.DomUtil.removeClass(this._actionsContainer, "leaflet-draw-actions-top"), L.DomUtil.removeClass(this._actionsContainer, "leaflet-draw-actions-bottom"), this._map.fire(L.Draw.Event.TOOLBARCLOSED) } }), L.Draw = L.Draw || {}, L.Draw.Tooltip = L.Class.extend({ initialize: function (t) { this._map = t, this._popupPane = t._panes.popupPane, this._visible = !1, this._container = t.options.drawControlTooltips ? L.DomUtil.create("div", "leaflet-draw-tooltip", this._popupPane) : null, this._singleLineLabel = !1, this._map.on("mouseout", this._onMouseOut, this) }, dispose: function () { this._map.off("mouseout", this._onMouseOut, this), this._container && (this._popupPane.removeChild(this._container), this._container = null) }, updateContent: function (t) { return this._container ? (t.subtext = t.subtext || "", 0 !== t.subtext.length || this._singleLineLabel ? t.subtext.length > 0 && this._singleLineLabel && (L.DomUtil.removeClass(this._container, "leaflet-draw-tooltip-single"), this._singleLineLabel = !1) : (L.DomUtil.addClass(this._container, "leaflet-draw-tooltip-single"), this._singleLineLabel = !0), this._container.innerHTML = (t.subtext.length > 0 ? '' + t.subtext + "
" : "") + "" + t.text + "", t.text || t.subtext ? (this._visible = !0, this._container.style.visibility = "inherit") : (this._visible = !1, this._container.style.visibility = "hidden"), this) : this }, updatePosition: function (t) { var e = this._map.latLngToLayerPoint(t), i = this._container; return this._container && (this._visible && (i.style.visibility = "inherit"), L.DomUtil.setPosition(i, e)), this }, showAsError: function () { return this._container && L.DomUtil.addClass(this._container, "leaflet-error-draw-tooltip"), this }, removeError: function () { return this._container && L.DomUtil.removeClass(this._container, "leaflet-error-draw-tooltip"), this }, _onMouseOut: function () { this._container && (this._container.style.visibility = "hidden") } }), L.DrawToolbar = L.Toolbar.extend({ statics: { TYPE: "draw" }, options: { polyline: {}, polygon: {}, rectangle: {}, circle: {}, marker: {}, circlemarker: {} }, initialize: function (t) { for (var e in this.options) this.options.hasOwnProperty(e) && t[e] && (t[e] = L.extend({}, this.options[e], t[e])); this._toolbarClass = "leaflet-draw-draw", L.Toolbar.prototype.initialize.call(this, t) }, getModeHandlers: function (t) { return [{ enabled: this.options.polyline, handler: new L.Draw.Polyline(t, this.options.polyline), title: L.drawLocal.draw.toolbar.buttons.polyline }, { enabled: this.options.polygon, handler: new L.Draw.Polygon(t, this.options.polygon), title: L.drawLocal.draw.toolbar.buttons.polygon }, { enabled: this.options.rectangle, handler: new L.Draw.Rectangle(t, this.options.rectangle), title: L.drawLocal.draw.toolbar.buttons.rectangle }, { enabled: this.options.circle, handler: new L.Draw.Circle(t, this.options.circle), title: L.drawLocal.draw.toolbar.buttons.circle }, { enabled: this.options.marker, handler: new L.Draw.Marker(t, this.options.marker), title: L.drawLocal.draw.toolbar.buttons.marker }, { enabled: this.options.circlemarker, handler: new L.Draw.CircleMarker(t, this.options.circlemarker), title: L.drawLocal.draw.toolbar.buttons.circlemarker }] }, getActions: function (t) { return [{ enabled: t.completeShape, title: L.drawLocal.draw.toolbar.finish.title, text: L.drawLocal.draw.toolbar.finish.text, callback: t.completeShape, context: t }, { enabled: t.deleteLastVertex, title: L.drawLocal.draw.toolbar.undo.title, text: L.drawLocal.draw.toolbar.undo.text, callback: t.deleteLastVertex, context: t }, { title: L.drawLocal.draw.toolbar.actions.title, text: L.drawLocal.draw.toolbar.actions.text, callback: this.disable, context: this }] }, setOptions: function (t) { L.setOptions(this, t); for (var e in this._modes) this._modes.hasOwnProperty(e) && t.hasOwnProperty(e) && this._modes[e].handler.setOptions(t[e]) } }), L.EditToolbar = L.Toolbar.extend({ statics: { TYPE: "edit" }, options: { edit: { selectedPathOptions: { dashArray: "10, 10", fill: !0, fillColor: "#fe57a1", fillOpacity: .1, maintainColor: !1 } }, remove: {}, poly: null, featureGroup: null }, initialize: function (t) { t.edit && (void 0 === t.edit.selectedPathOptions && (t.edit.selectedPathOptions = this.options.edit.selectedPathOptions), t.edit.selectedPathOptions = L.extend({}, this.options.edit.selectedPathOptions, t.edit.selectedPathOptions)), t.remove && (t.remove = L.extend({}, this.options.remove, t.remove)), t.poly && (t.poly = L.extend({}, this.options.poly, t.poly)), this._toolbarClass = "leaflet-draw-edit", L.Toolbar.prototype.initialize.call(this, t), this._selectedFeatureCount = 0 }, getModeHandlers: function (t) { var e = this.options.featureGroup; return [{ enabled: this.options.edit, handler: new L.EditToolbar.Edit(t, { featureGroup: e, selectedPathOptions: this.options.edit.selectedPathOptions, poly: this.options.poly }), title: L.drawLocal.edit.toolbar.buttons.edit }, { enabled: this.options.remove, handler: new L.EditToolbar.Delete(t, { featureGroup: e }), title: L.drawLocal.edit.toolbar.buttons.remove }] }, getActions: function (t) { var e = [{ title: L.drawLocal.edit.toolbar.actions.save.title, text: L.drawLocal.edit.toolbar.actions.save.text, callback: this._save, context: this }, { title: L.drawLocal.edit.toolbar.actions.cancel.title, text: L.drawLocal.edit.toolbar.actions.cancel.text, callback: this.disable, context: this }]; return t.removeAllLayers && e.push({ title: L.drawLocal.edit.toolbar.actions.clearAll.title, text: L.drawLocal.edit.toolbar.actions.clearAll.text, callback: this._clearAllLayers, context: this }), e }, addToolbar: function (t) { var e = L.Toolbar.prototype.addToolbar.call(this, t); return this._checkDisabled(), this.options.featureGroup.on("layeradd layerremove", this._checkDisabled, this), e }, removeToolbar: function () { this.options.featureGroup.off("layeradd layerremove", this._checkDisabled, this), L.Toolbar.prototype.removeToolbar.call(this) }, disable: function () { this.enabled() && (this._activeMode.handler.revertLayers(), L.Toolbar.prototype.disable.call(this)) }, _save: function () { this._activeMode.handler.save(), this._activeMode && this._activeMode.handler.disable() }, _clearAllLayers: function () { this._activeMode.handler.removeAllLayers(), this._activeMode && this._activeMode.handler.disable() }, _checkDisabled: function () { var t, e = this.options.featureGroup, i = 0 !== e.getLayers().length; this.options.edit && (t = this._modes[L.EditToolbar.Edit.TYPE].button, i ? L.DomUtil.removeClass(t, "leaflet-disabled") : L.DomUtil.addClass(t, "leaflet-disabled"), t.setAttribute("title", i ? L.drawLocal.edit.toolbar.buttons.edit : L.drawLocal.edit.toolbar.buttons.editDisabled)), this.options.remove && (t = this._modes[L.EditToolbar.Delete.TYPE].button, i ? L.DomUtil.removeClass(t, "leaflet-disabled") : L.DomUtil.addClass(t, "leaflet-disabled"), t.setAttribute("title", i ? L.drawLocal.edit.toolbar.buttons.remove : L.drawLocal.edit.toolbar.buttons.removeDisabled)) } }), L.EditToolbar.Edit = L.Handler.extend({ statics: { TYPE: "edit" }, initialize: function (t, e) { if (L.Handler.prototype.initialize.call(this, t), L.setOptions(this, e), this._featureGroup = e.featureGroup, !(this._featureGroup instanceof L.FeatureGroup)) throw new Error("options.featureGroup must be a L.FeatureGroup"); this._uneditedLayerProps = {}, this.type = L.EditToolbar.Edit.TYPE; var i = L.version.split("."); 1 === parseInt(i[0], 10) && parseInt(i[1], 10) >= 2 ? L.EditToolbar.Edit.include(L.Evented.prototype) : L.EditToolbar.Edit.include(L.Mixin.Events) }, enable: function () { !this._enabled && this._hasAvailableLayers() && (this.fire("enabled", { handler: this.type }), this._map.fire(L.Draw.Event.EDITSTART, { handler: this.type }), L.Handler.prototype.enable.call(this), this._featureGroup.on("layeradd", this._enableLayerEdit, this).on("layerremove", this._disableLayerEdit, this)) }, disable: function () { this._enabled && (this._featureGroup.off("layeradd", this._enableLayerEdit, this).off("layerremove", this._disableLayerEdit, this), L.Handler.prototype.disable.call(this), this._map.fire(L.Draw.Event.EDITSTOP, { handler: this.type }), this.fire("disabled", { handler: this.type })) }, addHooks: function () { var t = this._map; t && (t.getContainer().focus(), this._featureGroup.eachLayer(this._enableLayerEdit, this), this._tooltip = new L.Draw.Tooltip(this._map), this._tooltip.updateContent({ text: L.drawLocal.edit.handlers.edit.tooltip.text, subtext: L.drawLocal.edit.handlers.edit.tooltip.subtext }), t._editTooltip = this._tooltip, this._updateTooltip(), this._map.on("mousemove", this._onMouseMove, this).on("touchmove", this._onMouseMove, this).on("MSPointerMove", this._onMouseMove, this).on(L.Draw.Event.EDITVERTEX, this._updateTooltip, this)) }, removeHooks: function () { this._map && (this._featureGroup.eachLayer(this._disableLayerEdit, this), this._uneditedLayerProps = {}, this._tooltip.dispose(), this._tooltip = null, this._map.off("mousemove", this._onMouseMove, this).off("touchmove", this._onMouseMove, this).off("MSPointerMove", this._onMouseMove, this).off(L.Draw.Event.EDITVERTEX, this._updateTooltip, this)) }, revertLayers: function () { this._featureGroup.eachLayer(function (t) { this._revertLayer(t) }, this) }, save: function () { var t = new L.LayerGroup; this._featureGroup.eachLayer(function (e) { e.edited && (t.addLayer(e), e.edited = !1) }), this._map.fire(L.Draw.Event.EDITED, { layers: t }) }, _backupLayer: function (t) { var e = L.Util.stamp(t); this._uneditedLayerProps[e] || (t instanceof L.Polyline || t instanceof L.Polygon || t instanceof L.Rectangle ? this._uneditedLayerProps[e] = { latlngs: L.LatLngUtil.cloneLatLngs(t.getLatLngs()) } : t instanceof L.Circle ? this._uneditedLayerProps[e] = { latlng: L.LatLngUtil.cloneLatLng(t.getLatLng()), radius: t.getRadius() } : (t instanceof L.Marker || t instanceof L.CircleMarker) && (this._uneditedLayerProps[e] = { latlng: L.LatLngUtil.cloneLatLng(t.getLatLng()) })) }, _getTooltipText: function () { return { text: L.drawLocal.edit.handlers.edit.tooltip.text, subtext: L.drawLocal.edit.handlers.edit.tooltip.subtext } }, _updateTooltip: function () { this._tooltip.updateContent(this._getTooltipText()) }, _revertLayer: function (t) { var e = L.Util.stamp(t); t.edited = !1, this._uneditedLayerProps.hasOwnProperty(e) && (t instanceof L.Polyline || t instanceof L.Polygon || t instanceof L.Rectangle ? t.setLatLngs(this._uneditedLayerProps[e].latlngs) : t instanceof L.Circle ? (t.setLatLng(this._uneditedLayerProps[e].latlng), t.setRadius(this._uneditedLayerProps[e].radius)) : (t instanceof L.Marker || t instanceof L.CircleMarker) && t.setLatLng(this._uneditedLayerProps[e].latlng), t.fire("revert-edited", { layer: t })) }, _enableLayerEdit: function (t) { var e, i, o = t.layer || t.target || t; this._backupLayer(o), this.options.poly && (i = L.Util.extend({}, this.options.poly), o.options.poly = i), this.options.selectedPathOptions && (e = L.Util.extend({}, this.options.selectedPathOptions), e.maintainColor && (e.color = o.options.color, e.fillColor = o.options.fillColor), o.options.original = L.extend({}, o.options), o.options.editing = e), o instanceof L.Marker ? (o.editing && o.editing.enable(), o.dragging.enable(), o.on("dragend", this._onMarkerDragEnd).on("touchmove", this._onTouchMove, this).on("MSPointerMove", this._onTouchMove, this).on("touchend", this._onMarkerDragEnd, this).on("MSPointerUp", this._onMarkerDragEnd, this)) : o.editing.enable() }, _disableLayerEdit: function (t) { var e = t.layer || t.target || t; e.edited = !1, e.editing && e.editing.disable(), delete e.options.editing, delete e.options.original, this._selectedPathOptions && (e instanceof L.Marker ? this._toggleMarkerHighlight(e) : (e.setStyle(e.options.previousOptions), delete e.options.previousOptions)), e instanceof L.Marker ? (e.dragging.disable(), e.off("dragend", this._onMarkerDragEnd, this).off("touchmove", this._onTouchMove, this).off("MSPointerMove", this._onTouchMove, this).off("touchend", this._onMarkerDragEnd, this).off("MSPointerUp", this._onMarkerDragEnd, this)) : e.editing.disable() }, _onMouseMove: function (t) { this._tooltip.updatePosition(t.latlng) }, _onMarkerDragEnd: function (t) { var e = t.target; e.edited = !0, this._map.fire(L.Draw.Event.EDITMOVE, { layer: e }) }, _onTouchMove: function (t) { var e = t.originalEvent.changedTouches[0], i = this._map.mouseEventToLayerPoint(e), o = this._map.layerPointToLatLng(i); t.target.setLatLng(o) }, _hasAvailableLayers: function () { return 0 !== this._featureGroup.getLayers().length } }), L.EditToolbar.Delete = L.Handler.extend({ statics: { TYPE: "remove" }, initialize: function (t, e) { if (L.Handler.prototype.initialize.call(this, t), L.Util.setOptions(this, e), this._deletableLayers = this.options.featureGroup, !(this._deletableLayers instanceof L.FeatureGroup)) throw new Error("options.featureGroup must be a L.FeatureGroup"); this.type = L.EditToolbar.Delete.TYPE; var i = L.version.split("."); 1 === parseInt(i[0], 10) && parseInt(i[1], 10) >= 2 ? L.EditToolbar.Delete.include(L.Evented.prototype) : L.EditToolbar.Delete.include(L.Mixin.Events) }, enable: function () { !this._enabled && this._hasAvailableLayers() && (this.fire("enabled", { handler: this.type }), this._map.fire(L.Draw.Event.DELETESTART, { handler: this.type }), L.Handler.prototype.enable.call(this), this._deletableLayers.on("layeradd", this._enableLayerDelete, this).on("layerremove", this._disableLayerDelete, this)) }, disable: function () { this._enabled && (this._deletableLayers.off("layeradd", this._enableLayerDelete, this).off("layerremove", this._disableLayerDelete, this), L.Handler.prototype.disable.call(this), this._map.fire(L.Draw.Event.DELETESTOP, { handler: this.type }), this.fire("disabled", { handler: this.type })) }, addHooks: function () { var t = this._map; t && (t.getContainer().focus(), this._deletableLayers.eachLayer(this._enableLayerDelete, this), this._deletedLayers = new L.LayerGroup, this._tooltip = new L.Draw.Tooltip(this._map), this._tooltip.updateContent({ text: L.drawLocal.edit.handlers.remove.tooltip.text }), this._map.on("mousemove", this._onMouseMove, this)) }, removeHooks: function () { this._map && (this._deletableLayers.eachLayer(this._disableLayerDelete, this), this._deletedLayers = null, this._tooltip.dispose(), this._tooltip = null, this._map.off("mousemove", this._onMouseMove, this)) }, revertLayers: function () { this._deletedLayers.eachLayer(function (t) { this._deletableLayers.addLayer(t), t.fire("revert-deleted", { layer: t }) }, this) }, save: function () { this._map.fire(L.Draw.Event.DELETED, { layers: this._deletedLayers }) }, removeAllLayers: function () { this._deletableLayers.eachLayer(function (t) { this._removeLayer({ layer: t }) }, this), this.save() }, _enableLayerDelete: function (t) { (t.layer || t.target || t).on("click", this._removeLayer, this) }, _disableLayerDelete: function (t) { var e = t.layer || t.target || t; e.off("click", this._removeLayer, this), this._deletedLayers.removeLayer(e) }, _removeLayer: function (t) { var e = t.layer || t.target || t; this._deletableLayers.removeLayer(e), this._deletedLayers.addLayer(e), e.fire("deleted") }, _onMouseMove: function (t) { this._tooltip.updatePosition(t.latlng) }, _hasAvailableLayers: function () { return 0 !== this._deletableLayers.getLayers().length } }) }(window, document);; /* * Leaflet.markercluster 1.4.1+master.37ab9a2, * Provides Beautiful Animated Marker Clustering functionality for Leaflet, a JS library for interactive maps. * https://github.com/Leaflet/Leaflet.markercluster * (c) 2012-2017, Dave Leaver, smartrak */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.Leaflet = global.Leaflet || {}, global.Leaflet.markercluster = global.Leaflet.markercluster || {}))); }(this, (function (exports) { 'use strict'; /* * L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within */ var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ options: { maxClusterRadius: 80, //A cluster will cover at most this many pixels from its center iconCreateFunction: null, clusterPane: L.Marker.prototype.options.pane, spiderfyOnMaxZoom: true, showCoverageOnHover: true, zoomToBoundsOnClick: true, singleMarkerMode: false, disableClusteringAtZoom: null, // Setting this to false prevents the removal of any clusters outside of the viewpoint, which // is the default behaviour for performance reasons. removeOutsideVisibleBounds: true, // Set to false to disable all animations (zoom and spiderfy). // If false, option animateAddingMarkers below has no effect. // If L.DomUtil.TRANSITION is falsy, this option has no effect. animate: true, //Whether to animate adding markers after adding the MarkerClusterGroup to the map // If you are adding individual markers set to true, if adding bulk markers leave false for massive performance gains. animateAddingMarkers: false, //Increase to increase the distance away that spiderfied markers appear from the center spiderfyDistanceMultiplier: 1, // Make it possible to specify a polyline options on a spider leg spiderLegPolylineOptions: { weight: 1.5, color: '#222', opacity: 0.5 }, // When bulk adding layers, adds markers in chunks. Means addLayers may not add all the layers in the call, others will be loaded during setTimeouts chunkedLoading: false, chunkInterval: 200, // process markers for a maximum of ~ n milliseconds (then trigger the chunkProgress callback) chunkDelay: 50, // at the end of each interval, give n milliseconds back to system/browser chunkProgress: null, // progress callback: function(processed, total, elapsed) (e.g. for a progress indicator) //Options to pass to the L.Polygon constructor polygonOptions: {} }, initialize: function (options) { L.Util.setOptions(this, options); if (!this.options.iconCreateFunction) { this.options.iconCreateFunction = this._defaultIconCreateFunction; } this._featureGroup = L.featureGroup(); this._featureGroup.addEventParent(this); this._nonPointGroup = L.featureGroup(); this._nonPointGroup.addEventParent(this); this._inZoomAnimation = 0; this._needsClustering = []; this._needsRemoving = []; //Markers removed while we aren't on the map need to be kept track of //The bounds of the currently shown area (from _getExpandedVisibleBounds) Updated on zoom/move this._currentShownBounds = null; this._queue = []; this._childMarkerEventHandlers = { 'dragstart': this._childMarkerDragStart, 'move': this._childMarkerMoved, 'dragend': this._childMarkerDragEnd, }; // Hook the appropriate animation methods. var animate = L.DomUtil.TRANSITION && this.options.animate; L.extend(this, animate ? this._withAnimation : this._noAnimation); // Remember which MarkerCluster class to instantiate (animated or not). this._markerCluster = animate ? L.MarkerCluster : L.MarkerClusterNonAnimated; }, addLayer: function (layer) { if (layer instanceof L.LayerGroup) { return this.addLayers([layer]); } //Don't cluster non point data if (!layer.getLatLng) { this._nonPointGroup.addLayer(layer); this.fire('layeradd', { layer: layer }); return this; } if (!this._map) { this._needsClustering.push(layer); this.fire('layeradd', { layer: layer }); return this; } if (this.hasLayer(layer)) { return this; } //If we have already clustered we'll need to add this one to a cluster if (this._unspiderfy) { this._unspiderfy(); } this._addLayer(layer, this._maxZoom); this.fire('layeradd', { layer: layer }); // Refresh bounds and weighted positions. this._topClusterLevel._recalculateBounds(); this._refreshClustersIcons(); //Work out what is visible var visibleLayer = layer, currentZoom = this._zoom; if (layer.__parent) { while (visibleLayer.__parent._zoom >= currentZoom) { visibleLayer = visibleLayer.__parent; } } if (this._currentShownBounds.contains(visibleLayer.getLatLng())) { if (this.options.animateAddingMarkers) { this._animationAddLayer(layer, visibleLayer); } else { this._animationAddLayerNonAnimated(layer, visibleLayer); } } return this; }, removeLayer: function (layer) { if (layer instanceof L.LayerGroup) { return this.removeLayers([layer]); } //Non point layers if (!layer.getLatLng) { this._nonPointGroup.removeLayer(layer); this.fire('layerremove', { layer: layer }); return this; } if (!this._map) { if (!this._arraySplice(this._needsClustering, layer) && this.hasLayer(layer)) { this._needsRemoving.push({ layer: layer, latlng: layer._latlng }); } this.fire('layerremove', { layer: layer }); return this; } if (!layer.__parent) { return this; } if (this._unspiderfy) { this._unspiderfy(); this._unspiderfyLayer(layer); } //Remove the marker from clusters this._removeLayer(layer, true); this.fire('layerremove', { layer: layer }); // Refresh bounds and weighted positions. this._topClusterLevel._recalculateBounds(); this._refreshClustersIcons(); layer.off(this._childMarkerEventHandlers, this); if (this._featureGroup.hasLayer(layer)) { this._featureGroup.removeLayer(layer); if (layer.clusterShow) { layer.clusterShow(); } } return this; }, //Takes an array of markers and adds them in bulk addLayers: function (layersArray, skipLayerAddEvent) { if (!L.Util.isArray(layersArray)) { return this.addLayer(layersArray); } var fg = this._featureGroup, npg = this._nonPointGroup, chunked = this.options.chunkedLoading, chunkInterval = this.options.chunkInterval, chunkProgress = this.options.chunkProgress, l = layersArray.length, offset = 0, originalArray = true, m; if (this._map) { var started = (new Date()).getTime(); var process = L.bind(function () { var start = (new Date()).getTime(); for (; offset < l; offset++) { if (chunked && offset % 200 === 0) { // every couple hundred markers, instrument the time elapsed since processing started: var elapsed = (new Date()).getTime() - start; if (elapsed > chunkInterval) { break; // been working too hard, time to take a break :-) } } m = layersArray[offset]; // Group of layers, append children to layersArray and skip. // Side effects: // - Total increases, so chunkProgress ratio jumps backward. // - Groups are not included in this group, only their non-group child layers (hasLayer). // Changing array length while looping does not affect performance in current browsers: // http://jsperf.com/for-loop-changing-length/6 if (m instanceof L.LayerGroup) { if (originalArray) { layersArray = layersArray.slice(); originalArray = false; } this._extractNonGroupLayers(m, layersArray); l = layersArray.length; continue; } //Not point data, can't be clustered if (!m.getLatLng) { npg.addLayer(m); if (!skipLayerAddEvent) { this.fire('layeradd', { layer: m }); } continue; } if (this.hasLayer(m)) { continue; } this._addLayer(m, this._maxZoom); if (!skipLayerAddEvent) { this.fire('layeradd', { layer: m }); } //If we just made a cluster of size 2 then we need to remove the other marker from the map (if it is) or we never will if (m.__parent) { if (m.__parent.getChildCount() === 2) { var markers = m.__parent.getAllChildMarkers(), otherMarker = markers[0] === m ? markers[1] : markers[0]; fg.removeLayer(otherMarker); } } } if (chunkProgress) { // report progress and time elapsed: chunkProgress(offset, l, (new Date()).getTime() - started); } // Completed processing all markers. if (offset === l) { // Refresh bounds and weighted positions. this._topClusterLevel._recalculateBounds(); this._refreshClustersIcons(); this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds); } else { setTimeout(process, this.options.chunkDelay); } }, this); process(); } else { var needsClustering = this._needsClustering; for (; offset < l; offset++) { m = layersArray[offset]; // Group of layers, append children to layersArray and skip. if (m instanceof L.LayerGroup) { if (originalArray) { layersArray = layersArray.slice(); originalArray = false; } this._extractNonGroupLayers(m, layersArray); l = layersArray.length; continue; } //Not point data, can't be clustered if (!m.getLatLng) { npg.addLayer(m); continue; } if (this.hasLayer(m)) { continue; } needsClustering.push(m); } } return this; }, //Takes an array of markers and removes them in bulk removeLayers: function (layersArray) { var i, m, l = layersArray.length, fg = this._featureGroup, npg = this._nonPointGroup, originalArray = true; if (!this._map) { for (i = 0; i < l; i++) { m = layersArray[i]; // Group of layers, append children to layersArray and skip. if (m instanceof L.LayerGroup) { if (originalArray) { layersArray = layersArray.slice(); originalArray = false; } this._extractNonGroupLayers(m, layersArray); l = layersArray.length; continue; } this._arraySplice(this._needsClustering, m); npg.removeLayer(m); if (this.hasLayer(m)) { this._needsRemoving.push({ layer: m, latlng: m._latlng }); } this.fire('layerremove', { layer: m }); } return this; } if (this._unspiderfy) { this._unspiderfy(); // Work on a copy of the array, so that next loop is not affected. var layersArray2 = layersArray.slice(), l2 = l; for (i = 0; i < l2; i++) { m = layersArray2[i]; // Group of layers, append children to layersArray and skip. if (m instanceof L.LayerGroup) { this._extractNonGroupLayers(m, layersArray2); l2 = layersArray2.length; continue; } this._unspiderfyLayer(m); } } for (i = 0; i < l; i++) { m = layersArray[i]; // Group of layers, append children to layersArray and skip. if (m instanceof L.LayerGroup) { if (originalArray) { layersArray = layersArray.slice(); originalArray = false; } this._extractNonGroupLayers(m, layersArray); l = layersArray.length; continue; } if (!m.__parent) { npg.removeLayer(m); this.fire('layerremove', { layer: m }); continue; } this._removeLayer(m, true, true); this.fire('layerremove', { layer: m }); if (fg.hasLayer(m)) { fg.removeLayer(m); if (m.clusterShow) { m.clusterShow(); } } } // Refresh bounds and weighted positions. this._topClusterLevel._recalculateBounds(); this._refreshClustersIcons(); //Fix up the clusters and markers on the map this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds); return this; }, //Removes all layers from the MarkerClusterGroup clearLayers: function () { //Need our own special implementation as the LayerGroup one doesn't work for us //If we aren't on the map (yet), blow away the markers we know of if (!this._map) { this._needsClustering = []; this._needsRemoving = []; delete this._gridClusters; delete this._gridUnclustered; } if (this._noanimationUnspiderfy) { this._noanimationUnspiderfy(); } //Remove all the visible layers this._featureGroup.clearLayers(); this._nonPointGroup.clearLayers(); this.eachLayer(function (marker) { marker.off(this._childMarkerEventHandlers, this); delete marker.__parent; }, this); if (this._map) { //Reset _topClusterLevel and the DistanceGrids this._generateInitialClusters(); } return this; }, //Override FeatureGroup.getBounds as it doesn't work getBounds: function () { var bounds = new L.LatLngBounds(); if (this._topClusterLevel) { bounds.extend(this._topClusterLevel._bounds); } for (var i = this._needsClustering.length - 1; i >= 0; i--) { bounds.extend(this._needsClustering[i].getLatLng()); } bounds.extend(this._nonPointGroup.getBounds()); return bounds; }, //Overrides LayerGroup.eachLayer eachLayer: function (method, context) { var markers = this._needsClustering.slice(), needsRemoving = this._needsRemoving, thisNeedsRemoving, i, j; if (this._topClusterLevel) { this._topClusterLevel.getAllChildMarkers(markers); } for (i = markers.length - 1; i >= 0; i--) { thisNeedsRemoving = true; for (j = needsRemoving.length - 1; j >= 0; j--) { if (needsRemoving[j].layer === markers[i]) { thisNeedsRemoving = false; break; } } if (thisNeedsRemoving) { method.call(context, markers[i]); } } this._nonPointGroup.eachLayer(method, context); }, //Overrides LayerGroup.getLayers getLayers: function () { var layers = []; this.eachLayer(function (l) { layers.push(l); }); return layers; }, //Overrides LayerGroup.getLayer, WARNING: Really bad performance getLayer: function (id) { var result = null; id = parseInt(id, 10); this.eachLayer(function (l) { if (L.stamp(l) === id) { result = l; } }); return result; }, //Returns true if the given layer is in this MarkerClusterGroup hasLayer: function (layer) { if (!layer) { return false; } var i, anArray = this._needsClustering; for (i = anArray.length - 1; i >= 0; i--) { if (anArray[i] === layer) { return true; } } anArray = this._needsRemoving; for (i = anArray.length - 1; i >= 0; i--) { if (anArray[i].layer === layer) { return false; } } return !!(layer.__parent && layer.__parent._group === this) || this._nonPointGroup.hasLayer(layer); }, //Zoom down to show the given layer (spiderfying if necessary) then calls the callback zoomToShowLayer: function (layer, callback) { if (typeof callback !== 'function') { callback = function () {}; } var showMarker = function () { if ((layer._icon || layer.__parent._icon) && !this._inZoomAnimation) { this._map.off('moveend', showMarker, this); this.off('animationend', showMarker, this); if (layer._icon) { callback(); } else if (layer.__parent._icon) { this.once('spiderfied', callback, this); layer.__parent.spiderfy(); } } }; if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) { //Layer is visible ond on screen, immediate return callback(); } else if (layer.__parent._zoom < Math.round(this._map._zoom)) { //Layer should be visible at this zoom level. It must not be on screen so just pan over to it this._map.on('moveend', showMarker, this); this._map.panTo(layer.getLatLng()); } else { this._map.on('moveend', showMarker, this); this.on('animationend', showMarker, this); layer.__parent.zoomToBounds(); } }, //Overrides FeatureGroup.onAdd onAdd: function (map) { this._map = map; var i, l, layer; if (!isFinite(this._map.getMaxZoom())) { throw "Map has no maxZoom specified"; } this._featureGroup.addTo(map); this._nonPointGroup.addTo(map); if (!this._gridClusters) { this._generateInitialClusters(); } this._maxLat = map.options.crs.projection.MAX_LATITUDE; //Restore all the positions as they are in the MCG before removing them for (i = 0, l = this._needsRemoving.length; i < l; i++) { layer = this._needsRemoving[i]; layer.newlatlng = layer.layer._latlng; layer.layer._latlng = layer.latlng; } //Remove them, then restore their new positions for (i = 0, l = this._needsRemoving.length; i < l; i++) { layer = this._needsRemoving[i]; this._removeLayer(layer.layer, true); layer.layer._latlng = layer.newlatlng; } this._needsRemoving = []; //Remember the current zoom level and bounds this._zoom = Math.round(this._map._zoom); this._currentShownBounds = this._getExpandedVisibleBounds(); this._map.on('zoomend', this._zoomEnd, this); this._map.on('moveend', this._moveEnd, this); if (this._spiderfierOnAdd) { //TODO FIXME: Not sure how to have spiderfier add something on here nicely this._spiderfierOnAdd(); } this._bindEvents(); //Actually add our markers to the map: l = this._needsClustering; this._needsClustering = []; this.addLayers(l, true); }, //Overrides FeatureGroup.onRemove onRemove: function (map) { map.off('zoomend', this._zoomEnd, this); map.off('moveend', this._moveEnd, this); this._unbindEvents(); //In case we are in a cluster animation this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', ''); if (this._spiderfierOnRemove) { //TODO FIXME: Not sure how to have spiderfier add something on here nicely this._spiderfierOnRemove(); } delete this._maxLat; //Clean up all the layers we added to the map this._hideCoverage(); this._featureGroup.remove(); this._nonPointGroup.remove(); this._featureGroup.clearLayers(); this._map = null; }, getVisibleParent: function (marker) { var vMarker = marker; while (vMarker && !vMarker._icon) { vMarker = vMarker.__parent; } return vMarker || null; }, //Remove the given object from the given array _arraySplice: function (anArray, obj) { for (var i = anArray.length - 1; i >= 0; i--) { if (anArray[i] === obj) { anArray.splice(i, 1); return true; } } }, /** * Removes a marker from all _gridUnclustered zoom levels, starting at the supplied zoom. * @param marker to be removed from _gridUnclustered. * @param z integer bottom start zoom level (included) * @private */ _removeFromGridUnclustered: function (marker, z) { var map = this._map, gridUnclustered = this._gridUnclustered, minZoom = Math.floor(this._map.getMinZoom()); for (; z >= minZoom; z--) { if (!gridUnclustered[z].removeObject(marker, map.project(marker.getLatLng(), z))) { break; } } }, _childMarkerDragStart: function (e) { e.target.__dragStart = e.target._latlng; }, _childMarkerMoved: function (e) { if (!this._ignoreMove && !e.target.__dragStart) { var isPopupOpen = e.target._popup && e.target._popup.isOpen(); this._moveChild(e.target, e.oldLatLng, e.latlng); if (isPopupOpen) { e.target.openPopup(); } } }, _moveChild: function (layer, from, to) { layer._latlng = from; this.removeLayer(layer); layer._latlng = to; this.addLayer(layer); }, _childMarkerDragEnd: function (e) { var dragStart = e.target.__dragStart; delete e.target.__dragStart; if (dragStart) { this._moveChild(e.target, dragStart, e.target._latlng); } }, //Internal function for removing a marker from everything. //dontUpdateMap: set to true if you will handle updating the map manually (for bulk functions) _removeLayer: function (marker, removeFromDistanceGrid, dontUpdateMap) { var gridClusters = this._gridClusters, gridUnclustered = this._gridUnclustered, fg = this._featureGroup, map = this._map, minZoom = Math.floor(this._map.getMinZoom()); //Remove the marker from distance clusters it might be in if (removeFromDistanceGrid) { this._removeFromGridUnclustered(marker, this._maxZoom); } //Work our way up the clusters removing them as we go if required var cluster = marker.__parent, markers = cluster._markers, otherMarker; //Remove the marker from the immediate parents marker list this._arraySplice(markers, marker); while (cluster) { cluster._childCount--; cluster._boundsNeedUpdate = true; if (cluster._zoom < minZoom) { //Top level, do nothing break; } else if (removeFromDistanceGrid && cluster._childCount <= 1) { //Cluster no longer required //We need to push the other marker up to the parent otherMarker = cluster._markers[0] === marker ? cluster._markers[1] : cluster._markers[0]; //Update distance grid gridClusters[cluster._zoom].removeObject(cluster, map.project(cluster._cLatLng, cluster._zoom)); gridUnclustered[cluster._zoom].addObject(otherMarker, map.project(otherMarker.getLatLng(), cluster._zoom)); //Move otherMarker up to parent this._arraySplice(cluster.__parent._childClusters, cluster); cluster.__parent._markers.push(otherMarker); otherMarker.__parent = cluster.__parent; if (cluster._icon) { //Cluster is currently on the map, need to put the marker on the map instead fg.removeLayer(cluster); if (!dontUpdateMap) { fg.addLayer(otherMarker); } } } else { cluster._iconNeedsUpdate = true; } cluster = cluster.__parent; } delete marker.__parent; }, _isOrIsParent: function (el, oel) { while (oel) { if (el === oel) { return true; } oel = oel.parentNode; } return false; }, //Override L.Evented.fire fire: function (type, data, propagate) { if (data && data.layer instanceof L.MarkerCluster) { //Prevent multiple clustermouseover/off events if the icon is made up of stacked divs (Doesn't work in ie <= 8, no relatedTarget) if (data.originalEvent && this._isOrIsParent(data.layer._icon, data.originalEvent.relatedTarget)) { return; } type = 'cluster' + type; } L.FeatureGroup.prototype.fire.call(this, type, data, propagate); }, //Override L.Evented.listens listens: function (type, propagate) { return L.FeatureGroup.prototype.listens.call(this, type, propagate) || L.FeatureGroup.prototype.listens.call(this, 'cluster' + type, propagate); }, //Default functionality _defaultIconCreateFunction: function (cluster) { var childCount = cluster.getChildCount(); var c = ' marker-cluster-'; if (childCount < 10) { c += 'small'; } else if (childCount < 100) { c += 'medium'; } else { c += 'large'; } return new L.DivIcon({ html: '
' + childCount + '
', className: 'marker-cluster' + c, iconSize: new L.Point(40, 40) }); }, _bindEvents: function () { var map = this._map, spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom, showCoverageOnHover = this.options.showCoverageOnHover, zoomToBoundsOnClick = this.options.zoomToBoundsOnClick; //Zoom on cluster click or spiderfy if we are at the lowest level if (spiderfyOnMaxZoom || zoomToBoundsOnClick) { this.on('clusterclick', this._zoomOrSpiderfy, this); } //Show convex hull (boundary) polygon on mouse over if (showCoverageOnHover) { this.on('clustermouseover', this._showCoverage, this); this.on('clustermouseout', this._hideCoverage, this); map.on('zoomend', this._hideCoverage, this); } }, _zoomOrSpiderfy: function (e) { var cluster = e.layer, bottomCluster = cluster; while (bottomCluster._childClusters.length === 1) { bottomCluster = bottomCluster._childClusters[0]; } if (bottomCluster._zoom === this._maxZoom && bottomCluster._childCount === cluster._childCount && this.options.spiderfyOnMaxZoom) { // All child markers are contained in a single cluster from this._maxZoom to this cluster. cluster.spiderfy(); } else if (this.options.zoomToBoundsOnClick) { cluster.zoomToBounds(); } // Focus the map again for keyboard users. if (e.originalEvent && e.originalEvent.keyCode === 13) { this._map._container.focus(); } }, _showCoverage: function (e) { var map = this._map; if (this._inZoomAnimation) { return; } if (this._shownPolygon) { map.removeLayer(this._shownPolygon); } if (e.layer.getChildCount() > 2 && e.layer !== this._spiderfied) { this._shownPolygon = new L.Polygon(e.layer.getConvexHull(), this.options.polygonOptions); map.addLayer(this._shownPolygon); } }, _hideCoverage: function () { if (this._shownPolygon) { this._map.removeLayer(this._shownPolygon); this._shownPolygon = null; } }, _unbindEvents: function () { var spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom, showCoverageOnHover = this.options.showCoverageOnHover, zoomToBoundsOnClick = this.options.zoomToBoundsOnClick, map = this._map; if (spiderfyOnMaxZoom || zoomToBoundsOnClick) { this.off('clusterclick', this._zoomOrSpiderfy, this); } if (showCoverageOnHover) { this.off('clustermouseover', this._showCoverage, this); this.off('clustermouseout', this._hideCoverage, this); map.off('zoomend', this._hideCoverage, this); } }, _zoomEnd: function () { if (!this._map) { //May have been removed from the map by a zoomEnd handler return; } this._mergeSplitClusters(); this._zoom = Math.round(this._map._zoom); this._currentShownBounds = this._getExpandedVisibleBounds(); }, _moveEnd: function () { if (this._inZoomAnimation) { return; } var newBounds = this._getExpandedVisibleBounds(); this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, newBounds); this._topClusterLevel._recursivelyAddChildrenToMap(null, Math.round(this._map._zoom), newBounds); this._currentShownBounds = newBounds; return; }, _generateInitialClusters: function () { var maxZoom = Math.ceil(this._map.getMaxZoom()), minZoom = Math.floor(this._map.getMinZoom()), radius = this.options.maxClusterRadius, radiusFn = radius; //If we just set maxClusterRadius to a single number, we need to create //a simple function to return that number. Otherwise, we just have to //use the function we've passed in. if (typeof radius !== "function") { radiusFn = function () { return radius; }; } if (this.options.disableClusteringAtZoom !== null) { maxZoom = this.options.disableClusteringAtZoom - 1; } this._maxZoom = maxZoom; this._gridClusters = {}; this._gridUnclustered = {}; //Set up DistanceGrids for each zoom for (var zoom = maxZoom; zoom >= minZoom; zoom--) { this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom)); this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom)); } // Instantiate the appropriate L.MarkerCluster class (animated or not). this._topClusterLevel = new this._markerCluster(this, minZoom - 1); }, //Zoom: Zoom to start adding at (Pass this._maxZoom to start at the bottom) _addLayer: function (layer, zoom) { var gridClusters = this._gridClusters, gridUnclustered = this._gridUnclustered, minZoom = Math.floor(this._map.getMinZoom()), markerPoint, z; if (this.options.singleMarkerMode) { this._overrideMarkerIcon(layer); } layer.on(this._childMarkerEventHandlers, this); //Find the lowest zoom level to slot this one in for (; zoom >= minZoom; zoom--) { markerPoint = this._map.project(layer.getLatLng(), zoom); // calculate pixel position //Try find a cluster close by var closest = gridClusters[zoom].getNearObject(markerPoint); if (closest) { closest._addChild(layer); layer.__parent = closest; return; } //Try find a marker close by to form a new cluster with closest = gridUnclustered[zoom].getNearObject(markerPoint); if (closest) { var parent = closest.__parent; if (parent) { this._removeLayer(closest, false); } //Create new cluster with these 2 in it var newCluster = new this._markerCluster(this, zoom, closest, layer); gridClusters[zoom].addObject(newCluster, this._map.project(newCluster._cLatLng, zoom)); closest.__parent = newCluster; layer.__parent = newCluster; //First create any new intermediate parent clusters that don't exist var lastParent = newCluster; for (z = zoom - 1; z > parent._zoom; z--) { lastParent = new this._markerCluster(this, z, lastParent); gridClusters[z].addObject(lastParent, this._map.project(closest.getLatLng(), z)); } parent._addChild(lastParent); //Remove closest from this zoom level and any above that it is in, replace with newCluster this._removeFromGridUnclustered(closest, zoom); return; } //Didn't manage to cluster in at this zoom, record us as a marker here and continue upwards gridUnclustered[zoom].addObject(layer, markerPoint); } //Didn't get in anything, add us to the top this._topClusterLevel._addChild(layer); layer.__parent = this._topClusterLevel; return; }, /** * Refreshes the icon of all "dirty" visible clusters. * Non-visible "dirty" clusters will be updated when they are added to the map. * @private */ _refreshClustersIcons: function () { this._featureGroup.eachLayer(function (c) { if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) { c._updateIcon(); } }); }, //Enqueue code to fire after the marker expand/contract has happened _enqueue: function (fn) { this._queue.push(fn); if (!this._queueTimeout) { this._queueTimeout = setTimeout(L.bind(this._processQueue, this), 300); } }, _processQueue: function () { for (var i = 0; i < this._queue.length; i++) { this._queue[i].call(this); } this._queue.length = 0; clearTimeout(this._queueTimeout); this._queueTimeout = null; }, //Merge and split any existing clusters that are too big or small _mergeSplitClusters: function () { var mapZoom = Math.round(this._map._zoom); //In case we are starting to split before the animation finished this._processQueue(); if (this._zoom < mapZoom && this._currentShownBounds.intersects(this._getExpandedVisibleBounds())) { //Zoom in, split this._animationStart(); //Remove clusters now off screen this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, this._getExpandedVisibleBounds()); this._animationZoomIn(this._zoom, mapZoom); } else if (this._zoom > mapZoom) { //Zoom out, merge this._animationStart(); this._animationZoomOut(this._zoom, mapZoom); } else { this._moveEnd(); } }, //Gets the maps visible bounds expanded in each direction by the size of the screen (so the user cannot see an area we do not cover in one pan) _getExpandedVisibleBounds: function () { if (!this.options.removeOutsideVisibleBounds) { return this._mapBoundsInfinite; } else if (L.Browser.mobile) { return this._checkBoundsMaxLat(this._map.getBounds()); } return this._checkBoundsMaxLat(this._map.getBounds().pad(1)); // Padding expands the bounds by its own dimensions but scaled with the given factor. }, /** * Expands the latitude to Infinity (or -Infinity) if the input bounds reach the map projection maximum defined latitude * (in the case of Web/Spherical Mercator, it is 85.0511287798 / see https://en.wikipedia.org/wiki/Web_Mercator#Formulas). * Otherwise, the removeOutsideVisibleBounds option will remove markers beyond that limit, whereas the same markers without * this option (or outside MCG) will have their position floored (ceiled) by the projection and rendered at that limit, * making the user think that MCG "eats" them and never displays them again. * @param bounds L.LatLngBounds * @returns {L.LatLngBounds} * @private */ _checkBoundsMaxLat: function (bounds) { var maxLat = this._maxLat; if (maxLat !== undefined) { if (bounds.getNorth() >= maxLat) { bounds._northEast.lat = Infinity; } if (bounds.getSouth() <= -maxLat) { bounds._southWest.lat = -Infinity; } } return bounds; }, //Shared animation code _animationAddLayerNonAnimated: function (layer, newCluster) { if (newCluster === layer) { this._featureGroup.addLayer(layer); } else if (newCluster._childCount === 2) { newCluster._addToMap(); var markers = newCluster.getAllChildMarkers(); this._featureGroup.removeLayer(markers[0]); this._featureGroup.removeLayer(markers[1]); } else { newCluster._updateIcon(); } }, /** * Extracts individual (i.e. non-group) layers from a Layer Group. * @param group to extract layers from. * @param output {Array} in which to store the extracted layers. * @returns {*|Array} * @private */ _extractNonGroupLayers: function (group, output) { var layers = group.getLayers(), i = 0, layer; output = output || []; for (; i < layers.length; i++) { layer = layers[i]; if (layer instanceof L.LayerGroup) { this._extractNonGroupLayers(layer, output); continue; } output.push(layer); } return output; }, /** * Implements the singleMarkerMode option. * @param layer Marker to re-style using the Clusters iconCreateFunction. * @returns {L.Icon} The newly created icon. * @private */ _overrideMarkerIcon: function (layer) { var icon = layer.options.icon = this.options.iconCreateFunction({ getChildCount: function () { return 1; }, getAllChildMarkers: function () { return [layer]; } }); return icon; } }); // Constant bounds used in case option "removeOutsideVisibleBounds" is set to false. L.MarkerClusterGroup.include({ _mapBoundsInfinite: new L.LatLngBounds(new L.LatLng(-Infinity, -Infinity), new L.LatLng(Infinity, Infinity)) }); L.MarkerClusterGroup.include({ _noAnimation: { //Non Animated versions of everything _animationStart: function () { //Do nothing... }, _animationZoomIn: function (previousZoomLevel, newZoomLevel) { this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel); this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds()); //We didn't actually animate, but we use this event to mean "clustering animations have finished" this.fire('animationend'); }, _animationZoomOut: function (previousZoomLevel, newZoomLevel) { this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel); this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds()); //We didn't actually animate, but we use this event to mean "clustering animations have finished" this.fire('animationend'); }, _animationAddLayer: function (layer, newCluster) { this._animationAddLayerNonAnimated(layer, newCluster); } }, _withAnimation: { //Animated versions here _animationStart: function () { this._map._mapPane.className += ' leaflet-cluster-anim'; this._inZoomAnimation++; }, _animationZoomIn: function (previousZoomLevel, newZoomLevel) { var bounds = this._getExpandedVisibleBounds(), fg = this._featureGroup, minZoom = Math.floor(this._map.getMinZoom()), i; this._ignoreMove = true; //Add all children of current clusters to map and remove those clusters from map this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function (c) { var startPos = c._latlng, markers = c._markers, m; if (!bounds.contains(startPos)) { startPos = null; } if (c._isSingleParent() && previousZoomLevel + 1 === newZoomLevel) { //Immediately add the new child and remove us fg.removeLayer(c); c._recursivelyAddChildrenToMap(null, newZoomLevel, bounds); } else { //Fade out old cluster c.clusterHide(); c._recursivelyAddChildrenToMap(startPos, newZoomLevel, bounds); } //Remove all markers that aren't visible any more //TODO: Do we actually need to do this on the higher levels too? for (i = markers.length - 1; i >= 0; i--) { m = markers[i]; if (!bounds.contains(m._latlng)) { fg.removeLayer(m); } } }); this._forceLayout(); //Update opacities this._topClusterLevel._recursivelyBecomeVisible(bounds, newZoomLevel); //TODO Maybe? Update markers in _recursivelyBecomeVisible fg.eachLayer(function (n) { if (!(n instanceof L.MarkerCluster) && n._icon) { n.clusterShow(); } }); //update the positions of the just added clusters/markers this._topClusterLevel._recursively(bounds, previousZoomLevel, newZoomLevel, function (c) { c._recursivelyRestoreChildPositions(newZoomLevel); }); this._ignoreMove = false; //Remove the old clusters and close the zoom animation this._enqueue(function () { //update the positions of the just added clusters/markers this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function (c) { fg.removeLayer(c); c.clusterShow(); }); this._animationEnd(); }); }, _animationZoomOut: function (previousZoomLevel, newZoomLevel) { this._animationZoomOutSingle(this._topClusterLevel, previousZoomLevel - 1, newZoomLevel); //Need to add markers for those that weren't on the map before but are now this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds()); //Remove markers that were on the map before but won't be now this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel, this._getExpandedVisibleBounds()); }, _animationAddLayer: function (layer, newCluster) { var me = this, fg = this._featureGroup; fg.addLayer(layer); if (newCluster !== layer) { if (newCluster._childCount > 2) { //Was already a cluster newCluster._updateIcon(); this._forceLayout(); this._animationStart(); layer._setPos(this._map.latLngToLayerPoint(newCluster.getLatLng())); layer.clusterHide(); this._enqueue(function () { fg.removeLayer(layer); layer.clusterShow(); me._animationEnd(); }); } else { //Just became a cluster this._forceLayout(); me._animationStart(); me._animationZoomOutSingle(newCluster, this._map.getMaxZoom(), this._zoom); } } } }, // Private methods for animated versions. _animationZoomOutSingle: function (cluster, previousZoomLevel, newZoomLevel) { var bounds = this._getExpandedVisibleBounds(), minZoom = Math.floor(this._map.getMinZoom()); //Animate all of the markers in the clusters to move to their cluster center point cluster._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, minZoom, previousZoomLevel + 1, newZoomLevel); var me = this; //Update the opacity (If we immediately set it they won't animate) this._forceLayout(); cluster._recursivelyBecomeVisible(bounds, newZoomLevel); //TODO: Maybe use the transition timing stuff to make this more reliable //When the animations are done, tidy up this._enqueue(function () { //This cluster stopped being a cluster before the timeout fired if (cluster._childCount === 1) { var m = cluster._markers[0]; //If we were in a cluster animation at the time then the opacity and position of our child could be wrong now, so fix it this._ignoreMove = true; m.setLatLng(m.getLatLng()); this._ignoreMove = false; if (m.clusterShow) { m.clusterShow(); } } else { cluster._recursively(bounds, newZoomLevel, minZoom, function (c) { c._recursivelyRemoveChildrenFromMap(bounds, minZoom, previousZoomLevel + 1); }); } me._animationEnd(); }); }, _animationEnd: function () { if (this._map) { this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', ''); } this._inZoomAnimation--; this.fire('animationend'); }, //Force a browser layout of stuff in the map // Should apply the current opacity and location to all elements so we can update them again for an animation _forceLayout: function () { //In my testing this works, infact offsetWidth of any element seems to work. //Could loop all this._layers and do this for each _icon if it stops working L.Util.falseFn(document.body.offsetWidth); } }); L.markerClusterGroup = function (options) { return new L.MarkerClusterGroup(options); }; var MarkerCluster = L.MarkerCluster = L.Marker.extend({ options: L.Icon.prototype.options, initialize: function (group, zoom, a, b) { L.Marker.prototype.initialize.call(this, a ? (a._cLatLng || a.getLatLng()) : new L.LatLng(0, 0), { icon: this, pane: group.options.clusterPane }); this._group = group; this._zoom = zoom; this._markers = []; this._childClusters = []; this._childCount = 0; this._iconNeedsUpdate = true; this._boundsNeedUpdate = true; this._bounds = new L.LatLngBounds(); if (a) { this._addChild(a); } if (b) { this._addChild(b); } }, //Recursively retrieve all child markers of this cluster getAllChildMarkers: function (storageArray, ignoreDraggedMarker) { storageArray = storageArray || []; for (var i = this._childClusters.length - 1; i >= 0; i--) { this._childClusters[i].getAllChildMarkers(storageArray); } for (var j = this._markers.length - 1; j >= 0; j--) { if (ignoreDraggedMarker && this._markers[j].__dragStart) { continue; } storageArray.push(this._markers[j]); } return storageArray; }, //Returns the count of how many child markers we have getChildCount: function () { return this._childCount; }, //Zoom to the minimum of showing all of the child markers, or the extents of this cluster zoomToBounds: function (fitBoundsOptions) { var childClusters = this._childClusters.slice(), map = this._group._map, boundsZoom = map.getBoundsZoom(this._bounds), zoom = this._zoom + 1, mapZoom = map.getZoom(), i; //calculate how far we need to zoom down to see all of the markers while (childClusters.length > 0 && boundsZoom > zoom) { zoom++; var newClusters = []; for (i = 0; i < childClusters.length; i++) { newClusters = newClusters.concat(childClusters[i]._childClusters); } childClusters = newClusters; } if (boundsZoom > zoom) { this._group._map.setView(this._latlng, zoom); } else if (boundsZoom <= mapZoom) { //If fitBounds wouldn't zoom us down, zoom us down instead this._group._map.setView(this._latlng, mapZoom + 1); } else { this._group._map.fitBounds(this._bounds, fitBoundsOptions); } }, getBounds: function () { var bounds = new L.LatLngBounds(); bounds.extend(this._bounds); return bounds; }, _updateIcon: function () { this._iconNeedsUpdate = true; if (this._icon) { this.setIcon(this); } }, //Cludge for Icon, we pretend to be an icon for performance createIcon: function () { if (this._iconNeedsUpdate) { this._iconObj = this._group.options.iconCreateFunction(this); this._iconNeedsUpdate = false; } return this._iconObj.createIcon(); }, createShadow: function () { return this._iconObj.createShadow(); }, _addChild: function (new1, isNotificationFromChild) { this._iconNeedsUpdate = true; this._boundsNeedUpdate = true; this._setClusterCenter(new1); if (new1 instanceof L.MarkerCluster) { if (!isNotificationFromChild) { this._childClusters.push(new1); new1.__parent = this; } this._childCount += new1._childCount; } else { if (!isNotificationFromChild) { this._markers.push(new1); } this._childCount++; } if (this.__parent) { this.__parent._addChild(new1, true); } }, /** * Makes sure the cluster center is set. If not, uses the child center if it is a cluster, or the marker position. * @param child L.MarkerCluster|L.Marker that will be used as cluster center if not defined yet. * @private */ _setClusterCenter: function (child) { if (!this._cLatLng) { // when clustering, take position of the first point as the cluster center this._cLatLng = child._cLatLng || child._latlng; } }, /** * Assigns impossible bounding values so that the next extend entirely determines the new bounds. * This method avoids having to trash the previous L.LatLngBounds object and to create a new one, which is much slower for this class. * As long as the bounds are not extended, most other methods would probably fail, as they would with bounds initialized but not extended. * @private */ _resetBounds: function () { var bounds = this._bounds; if (bounds._southWest) { bounds._southWest.lat = Infinity; bounds._southWest.lng = Infinity; } if (bounds._northEast) { bounds._northEast.lat = -Infinity; bounds._northEast.lng = -Infinity; } }, _recalculateBounds: function () { var markers = this._markers, childClusters = this._childClusters, latSum = 0, lngSum = 0, totalCount = this._childCount, i, child, childLatLng, childCount; // Case where all markers are removed from the map and we are left with just an empty _topClusterLevel. if (totalCount === 0) { return; } // Reset rather than creating a new object, for performance. this._resetBounds(); // Child markers. for (i = 0; i < markers.length; i++) { childLatLng = markers[i]._latlng; this._bounds.extend(childLatLng); latSum += childLatLng.lat; lngSum += childLatLng.lng; } // Child clusters. for (i = 0; i < childClusters.length; i++) { child = childClusters[i]; // Re-compute child bounds and weighted position first if necessary. if (child._boundsNeedUpdate) { child._recalculateBounds(); } this._bounds.extend(child._bounds); childLatLng = child._wLatLng; childCount = child._childCount; latSum += childLatLng.lat * childCount; lngSum += childLatLng.lng * childCount; } this._latlng = this._wLatLng = new L.LatLng(latSum / totalCount, lngSum / totalCount); // Reset dirty flag. this._boundsNeedUpdate = false; }, //Set our markers position as given and add it to the map _addToMap: function (startPos) { if (startPos) { this._backupLatlng = this._latlng; this.setLatLng(startPos); } this._group._featureGroup.addLayer(this); }, _recursivelyAnimateChildrenIn: function (bounds, center, maxZoom) { this._recursively(bounds, this._group._map.getMinZoom(), maxZoom - 1, function (c) { var markers = c._markers, i, m; for (i = markers.length - 1; i >= 0; i--) { m = markers[i]; //Only do it if the icon is still on the map if (m._icon) { m._setPos(center); m.clusterHide(); } } }, function (c) { var childClusters = c._childClusters, j, cm; for (j = childClusters.length - 1; j >= 0; j--) { cm = childClusters[j]; if (cm._icon) { cm._setPos(center); cm.clusterHide(); } } } ); }, _recursivelyAnimateChildrenInAndAddSelfToMap: function (bounds, mapMinZoom, previousZoomLevel, newZoomLevel) { this._recursively(bounds, newZoomLevel, mapMinZoom, function (c) { c._recursivelyAnimateChildrenIn(bounds, c._group._map.latLngToLayerPoint(c.getLatLng()).round(), previousZoomLevel); //TODO: depthToAnimateIn affects _isSingleParent, if there is a multizoom we may/may not be. //As a hack we only do a animation free zoom on a single level zoom, if someone does multiple levels then we always animate if (c._isSingleParent() && previousZoomLevel - 1 === newZoomLevel) { c.clusterShow(); c._recursivelyRemoveChildrenFromMap(bounds, mapMinZoom, previousZoomLevel); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds } else { c.clusterHide(); } c._addToMap(); } ); }, _recursivelyBecomeVisible: function (bounds, zoomLevel) { this._recursively(bounds, this._group._map.getMinZoom(), zoomLevel, null, function (c) { c.clusterShow(); }); }, _recursivelyAddChildrenToMap: function (startPos, zoomLevel, bounds) { this._recursively(bounds, this._group._map.getMinZoom() - 1, zoomLevel, function (c) { if (zoomLevel === c._zoom) { return; } //Add our child markers at startPos (so they can be animated out) for (var i = c._markers.length - 1; i >= 0; i--) { var nm = c._markers[i]; if (!bounds.contains(nm._latlng)) { continue; } if (startPos) { nm._backupLatlng = nm.getLatLng(); nm.setLatLng(startPos); if (nm.clusterHide) { nm.clusterHide(); } } c._group._featureGroup.addLayer(nm); } }, function (c) { c._addToMap(startPos); } ); }, _recursivelyRestoreChildPositions: function (zoomLevel) { //Fix positions of child markers for (var i = this._markers.length - 1; i >= 0; i--) { var nm = this._markers[i]; if (nm._backupLatlng) { nm.setLatLng(nm._backupLatlng); delete nm._backupLatlng; } } if (zoomLevel - 1 === this._zoom) { //Reposition child clusters for (var j = this._childClusters.length - 1; j >= 0; j--) { this._childClusters[j]._restorePosition(); } } else { for (var k = this._childClusters.length - 1; k >= 0; k--) { this._childClusters[k]._recursivelyRestoreChildPositions(zoomLevel); } } }, _restorePosition: function () { if (this._backupLatlng) { this.setLatLng(this._backupLatlng); delete this._backupLatlng; } }, //exceptBounds: If set, don't remove any markers/clusters in it _recursivelyRemoveChildrenFromMap: function (previousBounds, mapMinZoom, zoomLevel, exceptBounds) { var m, i; this._recursively(previousBounds, mapMinZoom - 1, zoomLevel - 1, function (c) { //Remove markers at every level for (i = c._markers.length - 1; i >= 0; i--) { m = c._markers[i]; if (!exceptBounds || !exceptBounds.contains(m._latlng)) { c._group._featureGroup.removeLayer(m); if (m.clusterShow) { m.clusterShow(); } } } }, function (c) { //Remove child clusters at just the bottom level for (i = c._childClusters.length - 1; i >= 0; i--) { m = c._childClusters[i]; if (!exceptBounds || !exceptBounds.contains(m._latlng)) { c._group._featureGroup.removeLayer(m); if (m.clusterShow) { m.clusterShow(); } } } } ); }, //Run the given functions recursively to this and child clusters // boundsToApplyTo: a L.LatLngBounds representing the bounds of what clusters to recurse in to // zoomLevelToStart: zoom level to start running functions (inclusive) // zoomLevelToStop: zoom level to stop running functions (inclusive) // runAtEveryLevel: function that takes an L.MarkerCluster as an argument that should be applied on every level // runAtBottomLevel: function that takes an L.MarkerCluster as an argument that should be applied at only the bottom level _recursively: function (boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel) { var childClusters = this._childClusters, zoom = this._zoom, i, c; if (zoomLevelToStart <= zoom) { if (runAtEveryLevel) { runAtEveryLevel(this); } if (runAtBottomLevel && zoom === zoomLevelToStop) { runAtBottomLevel(this); } } if (zoom < zoomLevelToStart || zoom < zoomLevelToStop) { for (i = childClusters.length - 1; i >= 0; i--) { c = childClusters[i]; if (c._boundsNeedUpdate) { c._recalculateBounds(); } if (boundsToApplyTo.intersects(c._bounds)) { c._recursively(boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel); } } } }, //Returns true if we are the parent of only one cluster and that cluster is the same as us _isSingleParent: function () { //Don't need to check this._markers as the rest won't work if there are any return this._childClusters.length > 0 && this._childClusters[0]._childCount === this._childCount; } }); /* * Extends L.Marker to include two extra methods: clusterHide and clusterShow. * * They work as setOpacity(0) and setOpacity(1) respectively, but * don't overwrite the options.opacity * */ L.Marker.include({ clusterHide: function () { var backup = this.options.opacity; this.setOpacity(0); this.options.opacity = backup; return this; }, clusterShow: function () { return this.setOpacity(this.options.opacity); } }); L.DistanceGrid = function (cellSize) { this._cellSize = cellSize; this._sqCellSize = cellSize * cellSize; this._grid = {}; this._objectPoint = { }; }; L.DistanceGrid.prototype = { addObject: function (obj, point) { var x = this._getCoord(point.x), y = this._getCoord(point.y), grid = this._grid, row = grid[y] = grid[y] || {}, cell = row[x] = row[x] || [], stamp = L.Util.stamp(obj); this._objectPoint[stamp] = point; cell.push(obj); }, updateObject: function (obj, point) { this.removeObject(obj); this.addObject(obj, point); }, //Returns true if the object was found removeObject: function (obj, point) { var x = this._getCoord(point.x), y = this._getCoord(point.y), grid = this._grid, row = grid[y] = grid[y] || {}, cell = row[x] = row[x] || [], i, len; delete this._objectPoint[L.Util.stamp(obj)]; for (i = 0, len = cell.length; i < len; i++) { if (cell[i] === obj) { cell.splice(i, 1); if (len === 1) { delete row[x]; } return true; } } }, eachObject: function (fn, context) { var i, j, k, len, row, cell, removed, grid = this._grid; for (i in grid) { row = grid[i]; for (j in row) { cell = row[j]; for (k = 0, len = cell.length; k < len; k++) { removed = fn.call(context, cell[k]); if (removed) { k--; len--; } } } } }, getNearObject: function (point) { var x = this._getCoord(point.x), y = this._getCoord(point.y), i, j, k, row, cell, len, obj, dist, objectPoint = this._objectPoint, closestDistSq = this._sqCellSize, closest = null; for (i = y - 1; i <= y + 1; i++) { row = this._grid[i]; if (row) { for (j = x - 1; j <= x + 1; j++) { cell = row[j]; if (cell) { for (k = 0, len = cell.length; k < len; k++) { obj = cell[k]; dist = this._sqDist(objectPoint[L.Util.stamp(obj)], point); if (dist < closestDistSq || dist <= closestDistSq && closest === null) { closestDistSq = dist; closest = obj; } } } } } } return closest; }, _getCoord: function (x) { var coord = Math.floor(x / this._cellSize); return isFinite(coord) ? coord : x; }, _sqDist: function (p, p2) { var dx = p2.x - p.x, dy = p2.y - p.y; return dx * dx + dy * dy; } }; /* Copyright (c) 2012 the authors listed at the following URL, and/or the authors of referenced articles or incorporated external code: http://en.literateprograms.org/Quickhull_(Javascript)?action=history&offset=20120410175256 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=18434 */ (function () { L.QuickHull = { /* * @param {Object} cpt a point to be measured from the baseline * @param {Array} bl the baseline, as represented by a two-element * array of latlng objects. * @returns {Number} an approximate distance measure */ getDistant: function (cpt, bl) { var vY = bl[1].lat - bl[0].lat, vX = bl[0].lng - bl[1].lng; return (vX * (cpt.lat - bl[0].lat) + vY * (cpt.lng - bl[0].lng)); }, /* * @param {Array} baseLine a two-element array of latlng objects * representing the baseline to project from * @param {Array} latLngs an array of latlng objects * @returns {Object} the maximum point and all new points to stay * in consideration for the hull. */ findMostDistantPointFromBaseLine: function (baseLine, latLngs) { var maxD = 0, maxPt = null, newPoints = [], i, pt, d; for (i = latLngs.length - 1; i >= 0; i--) { pt = latLngs[i]; d = this.getDistant(pt, baseLine); if (d > 0) { newPoints.push(pt); } else { continue; } if (d > maxD) { maxD = d; maxPt = pt; } } return { maxPoint: maxPt, newPoints: newPoints }; }, /* * Given a baseline, compute the convex hull of latLngs as an array * of latLngs. * * @param {Array} latLngs * @returns {Array} */ buildConvexHull: function (baseLine, latLngs) { var convexHullBaseLines = [], t = this.findMostDistantPointFromBaseLine(baseLine, latLngs); if (t.maxPoint) { // if there is still a point "outside" the base line convexHullBaseLines = convexHullBaseLines.concat( this.buildConvexHull([baseLine[0], t.maxPoint], t.newPoints) ); convexHullBaseLines = convexHullBaseLines.concat( this.buildConvexHull([t.maxPoint, baseLine[1]], t.newPoints) ); return convexHullBaseLines; } else { // if there is no more point "outside" the base line, the current base line is part of the convex hull return [baseLine[0]]; } }, /* * Given an array of latlngs, compute a convex hull as an array * of latlngs * * @param {Array} latLngs * @returns {Array} */ getConvexHull: function (latLngs) { // find first baseline var maxLat = false, minLat = false, maxLng = false, minLng = false, maxLatPt = null, minLatPt = null, maxLngPt = null, minLngPt = null, maxPt = null, minPt = null, i; for (i = latLngs.length - 1; i >= 0; i--) { var pt = latLngs[i]; if (maxLat === false || pt.lat > maxLat) { maxLatPt = pt; maxLat = pt.lat; } if (minLat === false || pt.lat < minLat) { minLatPt = pt; minLat = pt.lat; } if (maxLng === false || pt.lng > maxLng) { maxLngPt = pt; maxLng = pt.lng; } if (minLng === false || pt.lng < minLng) { minLngPt = pt; minLng = pt.lng; } } if (minLat !== maxLat) { minPt = minLatPt; maxPt = maxLatPt; } else { minPt = minLngPt; maxPt = maxLngPt; } var ch = [].concat(this.buildConvexHull([minPt, maxPt], latLngs), this.buildConvexHull([maxPt, minPt], latLngs)); return ch; } }; }()); L.MarkerCluster.include({ getConvexHull: function () { var childMarkers = this.getAllChildMarkers(), points = [], p, i; for (i = childMarkers.length - 1; i >= 0; i--) { p = childMarkers[i].getLatLng(); points.push(p); } return L.QuickHull.getConvexHull(points); } }); //This code is 100% based on https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet //Huge thanks to jawj for implementing it first to make my job easy :-) L.MarkerCluster.include({ _2PI: Math.PI * 2, _circleFootSeparation: 25, //related to circumference of circle _circleStartAngle: 0, _spiralFootSeparation: 28, //related to size of spiral (experiment!) _spiralLengthStart: 11, _spiralLengthFactor: 5, _circleSpiralSwitchover: 9, //show spiral instead of circle from this marker count upwards. // 0 -> always spiral; Infinity -> always circle spiderfy: function () { if (this._group._spiderfied === this || this._group._inZoomAnimation) { return; } var childMarkers = this.getAllChildMarkers(null, true), group = this._group, map = group._map, center = map.latLngToLayerPoint(this._latlng), positions; this._group._unspiderfy(); this._group._spiderfied = this; //TODO Maybe: childMarkers order by distance to center if (childMarkers.length >= this._circleSpiralSwitchover) { positions = this._generatePointsSpiral(childMarkers.length, center); } else { center.y += 10; // Otherwise circles look wrong => hack for standard blue icon, renders differently for other icons. positions = this._generatePointsCircle(childMarkers.length, center); } this._animationSpiderfy(childMarkers, positions); }, unspiderfy: function (zoomDetails) { /// Argument from zoomanim if being called in a zoom animation or null otherwise if (this._group._inZoomAnimation) { return; } this._animationUnspiderfy(zoomDetails); this._group._spiderfied = null; }, _generatePointsCircle: function (count, centerPt) { var circumference = this._group.options.spiderfyDistanceMultiplier * this._circleFootSeparation * (2 + count), legLength = circumference / this._2PI, //radius from circumference angleStep = this._2PI / count, res = [], i, angle; legLength = Math.max(legLength, 35); // Minimum distance to get outside the cluster icon. res.length = count; for (i = 0; i < count; i++) { // Clockwise, like spiral. angle = this._circleStartAngle + i * angleStep; res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round(); } return res; }, _generatePointsSpiral: function (count, centerPt) { var spiderfyDistanceMultiplier = this._group.options.spiderfyDistanceMultiplier, legLength = spiderfyDistanceMultiplier * this._spiralLengthStart, separation = spiderfyDistanceMultiplier * this._spiralFootSeparation, lengthFactor = spiderfyDistanceMultiplier * this._spiralLengthFactor * this._2PI, angle = 0, res = [], i; res.length = count; // Higher index, closer position to cluster center. for (i = count; i >= 0; i--) { // Skip the first position, so that we are already farther from center and we avoid // being under the default cluster icon (especially important for Circle Markers). if (i < count) { res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round(); } angle += separation / legLength + i * 0.0005; legLength += lengthFactor / angle; } return res; }, _noanimationUnspiderfy: function () { var group = this._group, map = group._map, fg = group._featureGroup, childMarkers = this.getAllChildMarkers(null, true), m, i; group._ignoreMove = true; this.setOpacity(1); for (i = childMarkers.length - 1; i >= 0; i--) { m = childMarkers[i]; fg.removeLayer(m); if (m._preSpiderfyLatlng) { m.setLatLng(m._preSpiderfyLatlng); delete m._preSpiderfyLatlng; } if (m.setZIndexOffset) { m.setZIndexOffset(0); } if (m._spiderLeg) { map.removeLayer(m._spiderLeg); delete m._spiderLeg; } } group.fire('unspiderfied', { cluster: this, markers: childMarkers }); group._ignoreMove = false; group._spiderfied = null; } }); //Non Animated versions of everything L.MarkerClusterNonAnimated = L.MarkerCluster.extend({ _animationSpiderfy: function (childMarkers, positions) { var group = this._group, map = group._map, fg = group._featureGroup, legOptions = this._group.options.spiderLegPolylineOptions, i, m, leg, newPos; group._ignoreMove = true; // Traverse in ascending order to make sure that inner circleMarkers are on top of further legs. Normal markers are re-ordered by newPosition. // The reverse order trick no longer improves performance on modern browsers. for (i = 0; i < childMarkers.length; i++) { newPos = map.layerPointToLatLng(positions[i]); m = childMarkers[i]; // Add the leg before the marker, so that in case the latter is a circleMarker, the leg is behind it. leg = new L.Polyline([this._latlng, newPos], legOptions); map.addLayer(leg); m._spiderLeg = leg; // Now add the marker. m._preSpiderfyLatlng = m._latlng; m.setLatLng(newPos); if (m.setZIndexOffset) { m.setZIndexOffset(1000000); //Make these appear on top of EVERYTHING } fg.addLayer(m); } this.setOpacity(0.3); group._ignoreMove = false; group.fire('spiderfied', { cluster: this, markers: childMarkers }); }, _animationUnspiderfy: function () { this._noanimationUnspiderfy(); } }); //Animated versions here L.MarkerCluster.include({ _animationSpiderfy: function (childMarkers, positions) { var me = this, group = this._group, map = group._map, fg = group._featureGroup, thisLayerLatLng = this._latlng, thisLayerPos = map.latLngToLayerPoint(thisLayerLatLng), svg = L.Path.SVG, legOptions = L.extend({}, this._group.options.spiderLegPolylineOptions), // Copy the options so that we can modify them for animation. finalLegOpacity = legOptions.opacity, i, m, leg, legPath, legLength, newPos; if (finalLegOpacity === undefined) { finalLegOpacity = L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity; } if (svg) { // If the initial opacity of the spider leg is not 0 then it appears before the animation starts. legOptions.opacity = 0; // Add the class for CSS transitions. legOptions.className = (legOptions.className || '') + ' leaflet-cluster-spider-leg'; } else { // Make sure we have a defined opacity. legOptions.opacity = finalLegOpacity; } group._ignoreMove = true; // Add markers and spider legs to map, hidden at our center point. // Traverse in ascending order to make sure that inner circleMarkers are on top of further legs. Normal markers are re-ordered by newPosition. // The reverse order trick no longer improves performance on modern browsers. for (i = 0; i < childMarkers.length; i++) { m = childMarkers[i]; newPos = map.layerPointToLatLng(positions[i]); // Add the leg before the marker, so that in case the latter is a circleMarker, the leg is behind it. leg = new L.Polyline([thisLayerLatLng, newPos], legOptions); map.addLayer(leg); m._spiderLeg = leg; // Explanations: https://jakearchibald.com/2013/animated-line-drawing-svg/ // In our case the transition property is declared in the CSS file. if (svg) { legPath = leg._path; legLength = legPath.getTotalLength() + 0.1; // Need a small extra length to avoid remaining dot in Firefox. legPath.style.strokeDasharray = legLength; // Just 1 length is enough, it will be duplicated. legPath.style.strokeDashoffset = legLength; } // If it is a marker, add it now and we'll animate it out if (m.setZIndexOffset) { m.setZIndexOffset(1000000); // Make normal markers appear on top of EVERYTHING } if (m.clusterHide) { m.clusterHide(); } // Vectors just get immediately added fg.addLayer(m); if (m._setPos) { m._setPos(thisLayerPos); } } group._forceLayout(); group._animationStart(); // Reveal markers and spider legs. for (i = childMarkers.length - 1; i >= 0; i--) { newPos = map.layerPointToLatLng(positions[i]); m = childMarkers[i]; //Move marker to new position m._preSpiderfyLatlng = m._latlng; m.setLatLng(newPos); if (m.clusterShow) { m.clusterShow(); } // Animate leg (animation is actually delegated to CSS transition). if (svg) { leg = m._spiderLeg; legPath = leg._path; legPath.style.strokeDashoffset = 0; //legPath.style.strokeOpacity = finalLegOpacity; leg.setStyle({opacity: finalLegOpacity}); } } this.setOpacity(0.3); group._ignoreMove = false; setTimeout(function () { group._animationEnd(); group.fire('spiderfied', { cluster: me, markers: childMarkers }); }, 200); }, _animationUnspiderfy: function (zoomDetails) { var me = this, group = this._group, map = group._map, fg = group._featureGroup, thisLayerPos = zoomDetails ? map._latLngToNewLayerPoint(this._latlng, zoomDetails.zoom, zoomDetails.center) : map.latLngToLayerPoint(this._latlng), childMarkers = this.getAllChildMarkers(null, true), svg = L.Path.SVG, m, i, leg, legPath, legLength, nonAnimatable; group._ignoreMove = true; group._animationStart(); //Make us visible and bring the child markers back in this.setOpacity(1); for (i = childMarkers.length - 1; i >= 0; i--) { m = childMarkers[i]; //Marker was added to us after we were spiderfied if (!m._preSpiderfyLatlng) { continue; } //Close any popup on the marker first, otherwise setting the location of the marker will make the map scroll m.closePopup(); //Fix up the location to the real one m.setLatLng(m._preSpiderfyLatlng); delete m._preSpiderfyLatlng; //Hack override the location to be our center nonAnimatable = true; if (m._setPos) { m._setPos(thisLayerPos); nonAnimatable = false; } if (m.clusterHide) { m.clusterHide(); nonAnimatable = false; } if (nonAnimatable) { fg.removeLayer(m); } // Animate the spider leg back in (animation is actually delegated to CSS transition). if (svg) { leg = m._spiderLeg; legPath = leg._path; legLength = legPath.getTotalLength() + 0.1; legPath.style.strokeDashoffset = legLength; leg.setStyle({opacity: 0}); } } group._ignoreMove = false; setTimeout(function () { //If we have only <= one child left then that marker will be shown on the map so don't remove it! var stillThereChildCount = 0; for (i = childMarkers.length - 1; i >= 0; i--) { m = childMarkers[i]; if (m._spiderLeg) { stillThereChildCount++; } } for (i = childMarkers.length - 1; i >= 0; i--) { m = childMarkers[i]; if (!m._spiderLeg) { //Has already been unspiderfied continue; } if (m.clusterShow) { m.clusterShow(); } if (m.setZIndexOffset) { m.setZIndexOffset(0); } if (stillThereChildCount > 1) { fg.removeLayer(m); } map.removeLayer(m._spiderLeg); delete m._spiderLeg; } group._animationEnd(); group.fire('unspiderfied', { cluster: me, markers: childMarkers }); }, 200); } }); L.MarkerClusterGroup.include({ //The MarkerCluster currently spiderfied (if any) _spiderfied: null, unspiderfy: function () { this._unspiderfy.apply(this, arguments); }, _spiderfierOnAdd: function () { this._map.on('click', this._unspiderfyWrapper, this); if (this._map.options.zoomAnimation) { this._map.on('zoomstart', this._unspiderfyZoomStart, this); } //Browsers without zoomAnimation or a big zoom don't fire zoomstart this._map.on('zoomend', this._noanimationUnspiderfy, this); if (!L.Browser.touch) { this._map.getRenderer(this); //Needs to happen in the pageload, not after, or animations don't work in webkit // http://stackoverflow.com/questions/8455200/svg-animate-with-dynamically-added-elements //Disable on touch browsers as the animation messes up on a touch zoom and isn't very noticable } }, _spiderfierOnRemove: function () { this._map.off('click', this._unspiderfyWrapper, this); this._map.off('zoomstart', this._unspiderfyZoomStart, this); this._map.off('zoomanim', this._unspiderfyZoomAnim, this); this._map.off('zoomend', this._noanimationUnspiderfy, this); //Ensure that markers are back where they should be // Use no animation to avoid a sticky leaflet-cluster-anim class on mapPane this._noanimationUnspiderfy(); }, //On zoom start we add a zoomanim handler so that we are guaranteed to be last (after markers are animated) //This means we can define the animation they do rather than Markers doing an animation to their actual location _unspiderfyZoomStart: function () { if (!this._map) { //May have been removed from the map by a zoomEnd handler return; } this._map.on('zoomanim', this._unspiderfyZoomAnim, this); }, _unspiderfyZoomAnim: function (zoomDetails) { //Wait until the first zoomanim after the user has finished touch-zooming before running the animation if (L.DomUtil.hasClass(this._map._mapPane, 'leaflet-touching')) { return; } this._map.off('zoomanim', this._unspiderfyZoomAnim, this); this._unspiderfy(zoomDetails); }, _unspiderfyWrapper: function () { /// _unspiderfy but passes no arguments this._unspiderfy(); }, _unspiderfy: function (zoomDetails) { if (this._spiderfied) { this._spiderfied.unspiderfy(zoomDetails); } }, _noanimationUnspiderfy: function () { if (this._spiderfied) { this._spiderfied._noanimationUnspiderfy(); } }, //If the given layer is currently being spiderfied then we unspiderfy it so it isn't on the map anymore etc _unspiderfyLayer: function (layer) { if (layer._spiderLeg) { this._featureGroup.removeLayer(layer); if (layer.clusterShow) { layer.clusterShow(); } //Position will be fixed up immediately in _animationUnspiderfy if (layer.setZIndexOffset) { layer.setZIndexOffset(0); } this._map.removeLayer(layer._spiderLeg); delete layer._spiderLeg; } } }); /** * Adds 1 public method to MCG and 1 to L.Marker to facilitate changing * markers' icon options and refreshing their icon and their parent clusters * accordingly (case where their iconCreateFunction uses data of childMarkers * to make up the cluster icon). */ L.MarkerClusterGroup.include({ /** * Updates the icon of all clusters which are parents of the given marker(s). * In singleMarkerMode, also updates the given marker(s) icon. * @param layers L.MarkerClusterGroup|L.LayerGroup|Array(L.Marker)|Map(L.Marker)| * L.MarkerCluster|L.Marker (optional) list of markers (or single marker) whose parent * clusters need to be updated. If not provided, retrieves all child markers of this. * @returns {L.MarkerClusterGroup} */ refreshClusters: function (layers) { if (!layers) { layers = this._topClusterLevel.getAllChildMarkers(); } else if (layers instanceof L.MarkerClusterGroup) { layers = layers._topClusterLevel.getAllChildMarkers(); } else if (layers instanceof L.LayerGroup) { layers = layers._layers; } else if (layers instanceof L.MarkerCluster) { layers = layers.getAllChildMarkers(); } else if (layers instanceof L.Marker) { layers = [layers]; } // else: must be an Array(L.Marker)|Map(L.Marker) this._flagParentsIconsNeedUpdate(layers); this._refreshClustersIcons(); // In case of singleMarkerMode, also re-draw the markers. if (this.options.singleMarkerMode) { this._refreshSingleMarkerModeMarkers(layers); } return this; }, /** * Simply flags all parent clusters of the given markers as having a "dirty" icon. * @param layers Array(L.Marker)|Map(L.Marker) list of markers. * @private */ _flagParentsIconsNeedUpdate: function (layers) { var id, parent; // Assumes layers is an Array or an Object whose prototype is non-enumerable. for (id in layers) { // Flag parent clusters' icon as "dirty", all the way up. // Dumb process that flags multiple times upper parents, but still // much more efficient than trying to be smart and make short lists, // at least in the case of a hierarchy following a power law: // http://jsperf.com/flag-nodes-in-power-hierarchy/2 parent = layers[id].__parent; while (parent) { parent._iconNeedsUpdate = true; parent = parent.__parent; } } }, /** * Re-draws the icon of the supplied markers. * To be used in singleMarkerMode only. * @param layers Array(L.Marker)|Map(L.Marker) list of markers. * @private */ _refreshSingleMarkerModeMarkers: function (layers) { var id, layer; for (id in layers) { layer = layers[id]; // Make sure we do not override markers that do not belong to THIS group. if (this.hasLayer(layer)) { // Need to re-create the icon first, then re-draw the marker. layer.setIcon(this._overrideMarkerIcon(layer)); } } } }); L.Marker.include({ /** * Updates the given options in the marker's icon and refreshes the marker. * @param options map object of icon options. * @param directlyRefreshClusters boolean (optional) true to trigger * MCG.refreshClustersOf() right away with this single marker. * @returns {L.Marker} */ refreshIconOptions: function (options, directlyRefreshClusters) { var icon = this.options.icon; L.setOptions(icon, options); this.setIcon(icon); // Shortcut to refresh the associated MCG clusters right away. // To be used when refreshing a single marker. // Otherwise, better use MCG.refreshClusters() once at the end with // the list of modified markers. if (directlyRefreshClusters && this.__parent) { this.__parent._group.refreshClusters(this); } return this; } }); exports.MarkerClusterGroup = MarkerClusterGroup; exports.MarkerCluster = MarkerCluster; }))); ; /* Mapbox GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/mapbox/mapbox-gl-js/blob/v1.6.1/LICENSE.txt */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.mapboxgl = factory()); }(this, (function () { 'use strict'; /* eslint-disable */ var shared, worker, mapboxgl; // define gets called three times: one for each chunk. we rely on the order // they're imported to know which is which function define(_, chunk) { if (!shared) { shared = chunk; } else if (!worker) { worker = chunk; } else { var workerBundleString = 'var sharedChunk = {}; (' + shared + ')(sharedChunk); (' + worker + ')(sharedChunk);' var sharedChunk = {}; shared(sharedChunk); mapboxgl = chunk(sharedChunk); mapboxgl.workerUrl = window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })); } } define(["exports"], (function (t) { "use strict"; function e(t, e) { return t(e = { exports: {} }, e.exports), e.exports } var r = n; function n(t, e, r, n) { this.cx = 3 * t, this.bx = 3 * (r - t) - this.cx, this.ax = 1 - this.cx - this.bx, this.cy = 3 * e, this.by = 3 * (n - e) - this.cy, this.ay = 1 - this.cy - this.by, this.p1x = t, this.p1y = n, this.p2x = r, this.p2y = n; } n.prototype.sampleCurveX = function (t) { return ((this.ax * t + this.bx) * t + this.cx) * t }, n.prototype.sampleCurveY = function (t) { return ((this.ay * t + this.by) * t + this.cy) * t }, n.prototype.sampleCurveDerivativeX = function (t) { return (3 * this.ax * t + 2 * this.bx) * t + this.cx }, n.prototype.solveCurveX = function (t, e) { var r, n, i, a, o; for (void 0 === e && (e = 1e-6), i = t, o = 0; o < 8; o++) { if (a = this.sampleCurveX(i) - t, Math.abs(a) < e) return i; var s = this.sampleCurveDerivativeX(i); if (Math.abs(s) < 1e-6) break; i -= a / s; } if ((i = t) < (r = 0)) return r; if (i > (n = 1)) return n; for (; r < n;) { if (a = this.sampleCurveX(i), Math.abs(a - t) < e) return i; t > a ? r = i : n = i, i = .5 * (n - r) + r; } return i }, n.prototype.solve = function (t, e) { return this.sampleCurveY(this.solveCurveX(t, e)) }; var i = a; function a(t, e) { this.x = t, this.y = e; } function o(t, e) { if (Array.isArray(t)) { if (!Array.isArray(e) || t.length !== e.length) return !1; for (var r = 0; r < t.length; r++)if (!o(t[r], e[r])) return !1; return !0 } if ("object" == typeof t && null !== t && null !== e) { if ("object" != typeof e) return !1; if (Object.keys(t).length !== Object.keys(e).length) return !1; for (var n in t) if (!o(t[n], e[n])) return !1; return !0 } return t === e } function s(t, e, n, i) { var a = new r(t, e, n, i); return function (t) { return a.solve(t) } } a.prototype = { clone: function () { return new a(this.x, this.y) }, add: function (t) { return this.clone()._add(t) }, sub: function (t) { return this.clone()._sub(t) }, multByPoint: function (t) { return this.clone()._multByPoint(t) }, divByPoint: function (t) { return this.clone()._divByPoint(t) }, mult: function (t) { return this.clone()._mult(t) }, div: function (t) { return this.clone()._div(t) }, rotate: function (t) { return this.clone()._rotate(t) }, rotateAround: function (t, e) { return this.clone()._rotateAround(t, e) }, matMult: function (t) { return this.clone()._matMult(t) }, unit: function () { return this.clone()._unit() }, perp: function () { return this.clone()._perp() }, round: function () { return this.clone()._round() }, mag: function () { return Math.sqrt(this.x * this.x + this.y * this.y) }, equals: function (t) { return this.x === t.x && this.y === t.y }, dist: function (t) { return Math.sqrt(this.distSqr(t)) }, distSqr: function (t) { var e = t.x - this.x, r = t.y - this.y; return e * e + r * r }, angle: function () { return Math.atan2(this.y, this.x) }, angleTo: function (t) { return Math.atan2(this.y - t.y, this.x - t.x) }, angleWith: function (t) { return this.angleWithSep(t.x, t.y) }, angleWithSep: function (t, e) { return Math.atan2(this.x * e - this.y * t, this.x * t + this.y * e) }, _matMult: function (t) { var e = t[0] * this.x + t[1] * this.y, r = t[2] * this.x + t[3] * this.y; return this.x = e, this.y = r, this }, _add: function (t) { return this.x += t.x, this.y += t.y, this }, _sub: function (t) { return this.x -= t.x, this.y -= t.y, this }, _mult: function (t) { return this.x *= t, this.y *= t, this }, _div: function (t) { return this.x /= t, this.y /= t, this }, _multByPoint: function (t) { return this.x *= t.x, this.y *= t.y, this }, _divByPoint: function (t) { return this.x /= t.x, this.y /= t.y, this }, _unit: function () { return this._div(this.mag()), this }, _perp: function () { var t = this.y; return this.y = this.x, this.x = -t, this }, _rotate: function (t) { var e = Math.cos(t), r = Math.sin(t), n = e * this.x - r * this.y, i = r * this.x + e * this.y; return this.x = n, this.y = i, this }, _rotateAround: function (t, e) { var r = Math.cos(t), n = Math.sin(t), i = e.x + r * (this.x - e.x) - n * (this.y - e.y), a = e.y + n * (this.x - e.x) + r * (this.y - e.y); return this.x = i, this.y = a, this }, _round: function () { return this.x = Math.round(this.x), this.y = Math.round(this.y), this } }, a.convert = function (t) { return t instanceof a ? t : Array.isArray(t) ? new a(t[0], t[1]) : t }; var u = s(.25, .1, .25, 1); function l(t, e, r) { return Math.min(r, Math.max(e, t)) } function p(t, e, r) { var n = r - e, i = ((t - e) % n + n) % n + e; return i === e ? r : i } function c(t) { for (var e = [], r = arguments.length - 1; r-- > 0;)e[r] = arguments[r + 1]; for (var n = 0, i = e; n < i.length; n += 1) { var a = i[n]; for (var o in a) t[o] = a[o]; } return t } var h = 1; function f() { return h++ } function y() { return function t(e) { return e ? (e ^ 16 * Math.random() >> e / 4).toString(16) : ([1e7] + -[1e3] + -4e3 + -8e3 + -1e11).replace(/[018]/g, t) }() } function d(t) { return !!t && /^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t) } function m(t, e) { t.forEach((function (t) { e[t] && (e[t] = e[t].bind(e)); })); } function v(t, e) { return -1 !== t.indexOf(e, t.length - e.length) } function g(t, e, r) { var n = {}; for (var i in t) n[i] = e.call(r || this, t[i], i, t); return n } function x(t, e, r) { var n = {}; for (var i in t) e.call(r || this, t[i], i, t) && (n[i] = t[i]); return n } function b(t) { return Array.isArray(t) ? t.map(b) : "object" == typeof t && t ? g(t, b) : t } var _ = {}; function w(t) { _[t] || ("undefined" != typeof console && console.warn(t), _[t] = !0); } function A(t, e, r) { return (r.y - t.y) * (e.x - t.x) > (e.y - t.y) * (r.x - t.x) } function S(t) { for (var e = 0, r = 0, n = t.length, i = n - 1, a = void 0, o = void 0; r < n; i = r++)a = t[r], e += ((o = t[i]).x - a.x) * (a.y + o.y); return e } function k() { return "undefined" != typeof WorkerGlobalScope && "undefined" != typeof self && self instanceof WorkerGlobalScope } function I(t) { var e = {}; if (t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g, (function (t, r, n, i) { var a = n || i; return e[r] = !a || a.toLowerCase(), "" })), e["max-age"]) { var r = parseInt(e["max-age"], 10); isNaN(r) ? delete e["max-age"] : e["max-age"] = r; } return e } var z = null; function C(t) { if (null == z) { var e = t.navigator ? t.navigator.userAgent : null; z = !!t.safari || !(!e || !(/\b(iPad|iPhone|iPod)\b/.test(e) || e.match("Safari") && !e.match("Chrome"))); } return z } function B(t) { try { var e = self[t]; return e.setItem("_mapbox_test_", 1), e.removeItem("_mapbox_test_"), !0 } catch (t) { return !1 } } var T, P, E, M, V = self.performance && self.performance.now ? self.performance.now.bind(self.performance) : Date.now.bind(Date), F = self.requestAnimationFrame || self.mozRequestAnimationFrame || self.webkitRequestAnimationFrame || self.msRequestAnimationFrame, L = self.cancelAnimationFrame || self.mozCancelAnimationFrame || self.webkitCancelAnimationFrame || self.msCancelAnimationFrame, O = { now: V, frame: function (t) { var e = F(t); return { cancel: function () { return L(e) } } }, getImageData: function (t, e) { void 0 === e && (e = 0); var r = self.document.createElement("canvas"), n = r.getContext("2d"); if (!n) throw new Error("failed to create canvas 2d context"); return r.width = t.width, r.height = t.height, n.drawImage(t, 0, 0, t.width, t.height), n.getImageData(-e, -e, t.width + 2 * e, t.height + 2 * e) }, resolveURL: function (t) { return T || (T = self.document.createElement("a")), T.href = t, T.href }, hardwareConcurrency: self.navigator.hardwareConcurrency || 4, get devicePixelRatio() { return self.devicePixelRatio }, get prefersReducedMotion() { return !!self.matchMedia && (null == P && (P = self.matchMedia("(prefers-reduced-motion: reduce)")), P.matches) } }, D = { API_URL: "https://api.mapbox.com", get EVENTS_URL() { return null/*this.API_URL ? 0 === this.API_URL.indexOf("https://api.mapbox.cn") ? "https://events.mapbox.cn/events/v2" : 0 === this.API_URL.indexOf("https://api.mapbox.com") ? "https://events.mapbox.com/events/v2" : null : null*/ }, FEEDBACK_URL: "https://apps.mapbox.com/feedback", REQUIRE_ACCESS_TOKEN: !0, ACCESS_TOKEN: null, MAX_PARALLEL_IMAGE_REQUESTS: 16 }, R = { supported: !1, testSupport: function (t) { if (U || !M) return; j ? q(t) : E = t; } }, U = !1, j = !1; function q(t) { var e = t.createTexture(); t.bindTexture(t.TEXTURE_2D, e); try { if (t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, t.RGBA, t.UNSIGNED_BYTE, M), t.isContextLost()) return; R.supported = !0; } catch (t) { } t.deleteTexture(e), U = !0; } self.document && ((M = self.document.createElement("img")).onload = function () { E && q(E), E = null, j = !0; }, M.onerror = function () { U = !0, E = null; }, M.src = "data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="); var N = "01"; var K = function (t, e) { this._transformRequestFn = t, this._customAccessToken = e, this._createSkuToken(); }; function X(t) { return 0 === t.indexOf("mapbox:") } K.prototype._createSkuToken = function () { var t = function () { for (var t = "", e = 0; e < 10; e++)t += "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62 * Math.random())]; return { token: ["1", N, t].join(""), tokenExpiresAt: Date.now() + 432e5 } }(); this._skuToken = t.token, this._skuTokenExpiresAt = t.tokenExpiresAt; }, K.prototype._isSkuTokenExpired = function () { return Date.now() > this._skuTokenExpiresAt }, K.prototype.transformRequest = function (t, e) { return this._transformRequestFn && this._transformRequestFn(t, e) || { url: t } }, K.prototype.normalizeStyleURL = function (t, e) { if (!X(t)) return t; var r = H(t); return r.path = "/styles/v1" + r.path, this._makeAPIURL(r, this._customAccessToken || e) }, K.prototype.normalizeGlyphsURL = function (t, e) { if (!X(t)) return t; var r = H(t); return r.path = "/fonts/v1" + r.path, this._makeAPIURL(r, this._customAccessToken || e) }, K.prototype.normalizeSourceURL = function (t, e) { if (!X(t)) return t; var r = H(t); return r.path = "/v4/" + r.authority + ".json", r.params.push("secure"), this._makeAPIURL(r, this._customAccessToken || e) }, K.prototype.normalizeSpriteURL = function (t, e, r, n) { var i = H(t); return X(t) ? (i.path = "/styles/v1" + i.path + "/sprite" + e + r, this._makeAPIURL(i, this._customAccessToken || n)) : (i.path += "" + e + r, Y(i)) }, K.prototype.normalizeTileURL = function (t, e, r) { if (/lid=/.test(t) && window.PP != 'undefined') { return t + '&sid=' + window.PP.sid } if (this._customAccessToken.startsWith('?lid=')) { return t + this._customAccessToken } if (this._isSkuTokenExpired() && this._createSkuToken(), !e || !X(e)) return t; var n = H(t), i = O.devicePixelRatio >= 2 || 512 === r ? "@2x" : "", a = R.supported ? ".webp" : "$1"; return n.path = n.path.replace(/(\.(png|jpg)\d*)(?=$)/, "" + i + a), n.path = n.path.replace(/^.+\/v4\//, "/"), n.path = "/v4" + n.path, D.REQUIRE_ACCESS_TOKEN && (D.ACCESS_TOKEN || this._customAccessToken) && this._skuToken && n.params.push("sku=" + this._skuToken), this._makeAPIURL(n, this._customAccessToken) }, K.prototype.canonicalizeTileURL = function (t) { var e = H(t); if (!e.path.match(/(^\/v4\/)/) || !e.path.match(/\.[\w]+$/)) return t; var r = "mapbox://tiles/"; r += e.path.replace("/v4/", ""); var n = e.params.filter((function (t) { return !t.match(/^access_token=/) })); return n.length && (r += "?" + n.join("&")), r }, K.prototype.canonicalizeTileset = function (t, e) { if (!X(e)) return t.tiles || []; for (var r = [], n = 0, i = t.tiles; n < i.length; n += 1) { var a = i[n], o = this.canonicalizeTileURL(a); r.push(o); } return r }, K.prototype._makeAPIURL = function (t, e) { var r = "See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes", n = H(D.API_URL); if (t.protocol = n.protocol, t.authority = n.authority, "/" !== n.path && (t.path = "" + n.path + t.path), !D.REQUIRE_ACCESS_TOKEN) return Y(t); if (!(e = e || D.ACCESS_TOKEN)) throw new Error("An API access token is required to use Mapbox GL. " + r); if ("s" === e[0]) throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). " + r); return t.params = t.params.filter((function (t) { return -1 === t.indexOf("access_token") })), t.params.push("access_token=" + e), Y(t) }; var Z = /^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i; function G(t) { return Z.test(t) } var J = /^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/; function H(t) { var e = t.match(J); if (!e) throw new Error("Unable to parse URL object"); return { protocol: e[1], authority: e[2], path: e[3] || "/", params: e[4] ? e[4].split("&") : [] } } function Y(t) { var e = t.params.length ? "?" + t.params.join("&") : ""; return t.protocol + "://" + t.authority + t.path + e } function $(t) { if (!t) return null; var e, r = t.split("."); if (!r || 3 !== r.length) return null; try { return JSON.parse((e = r[1], decodeURIComponent(self.atob(e).split("").map((function (t) { return "%" + ("00" + t.charCodeAt(0).toString(16)).slice(-2) })).join("")))) } catch (t) { return null } } var W = function (t) { this.type = t, this.anonId = null, this.eventData = {}, this.queue = [], this.pendingRequest = null; }; W.prototype.getStorageKey = function (t) { var e, r = $(D.ACCESS_TOKEN), n = ""; return r && r.u ? (e = r.u, n = self.btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, (function (t, e) { return String.fromCharCode(Number("0x" + e)) })))) : n = D.ACCESS_TOKEN || "", t ? "mapbox.eventData." + t + ":" + n : "mapbox.eventData:" + n }, W.prototype.fetchEventData = function () { var t = B("localStorage"), e = this.getStorageKey(), r = this.getStorageKey("uuid"); if (t) try { var n = self.localStorage.getItem(e); n && (this.eventData = JSON.parse(n)); var i = self.localStorage.getItem(r); i && (this.anonId = i); } catch (t) { w("Unable to read from LocalStorage"); } }, W.prototype.saveEventData = function () { var t = B("localStorage"), e = this.getStorageKey(), r = this.getStorageKey("uuid"); if (t) try { self.localStorage.setItem(r, this.anonId), Object.keys(this.eventData).length >= 1 && self.localStorage.setItem(e, JSON.stringify(this.eventData)); } catch (t) { w("Unable to write to LocalStorage"); } }, W.prototype.processRequests = function (t) { }, W.prototype.postEvent = function (t, e, r, n) { var i = this; if (D.EVENTS_URL) { var a = H(D.EVENTS_URL); a.params.push("access_token=" + (n || D.ACCESS_TOKEN || "")); var o = { event: this.type, created: new Date(t).toISOString(), sdkIdentifier: "mapbox-gl-js", sdkVersion: "1.6.1", skuId: N, userId: this.anonId }, s = e ? c(o, e) : o, u = { url: Y(a), headers: { "Content-Type": "text/plain" }, body: JSON.stringify([s]) }; this.pendingRequest = _t(u, (function (t) { i.pendingRequest = null, r(t), i.saveEventData(), i.processRequests(n); })); } }, W.prototype.queueRequest = function (t, e) { this.queue.push(t), this.processRequests(e); }; var Q, tt, et = function (t) { function e() { t.call(this, "map.load"), this.success = {}, this.skuToken = ""; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.postMapLoadEvent = function (t, e, r, n) { this.skuToken = r, (D.EVENTS_URL && n || D.ACCESS_TOKEN && Array.isArray(t) && t.some((function (t) { return X(t) || G(t) }))) && this.queueRequest({ id: e, timestamp: Date.now() }, n); }, e.prototype.processRequests = function (t) { var e = this; if (!this.pendingRequest && 0 !== this.queue.length) { var r = this.queue.shift(), n = r.id, i = r.timestamp; n && this.success[n] || (this.anonId || this.fetchEventData(), d(this.anonId) || (this.anonId = y()), this.postEvent(i, { skuToken: this.skuToken }, (function (t) { t || n && (e.success[n] = !0); }), t)); } }, e }(W), rt = new (function (t) { function e(e) { t.call(this, "appUserTurnstile"), this._customAccessToken = e; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.postTurnstileEvent = function (t, e) { D.EVENTS_URL && D.ACCESS_TOKEN && Array.isArray(t) && t.some((function (t) { return X(t) || G(t) })) && this.queueRequest(Date.now(), e); }, e.prototype.processRequests = function (t) { var e = this; if (!this.pendingRequest && 0 !== this.queue.length) { this.anonId && this.eventData.lastSuccess && this.eventData.tokenU || this.fetchEventData(); var r = $(D.ACCESS_TOKEN), n = r ? r.u : D.ACCESS_TOKEN, i = n !== this.eventData.tokenU; d(this.anonId) || (this.anonId = y(), i = !0); var a = this.queue.shift(); if (this.eventData.lastSuccess) { var o = new Date(this.eventData.lastSuccess), s = new Date(a), u = (a - this.eventData.lastSuccess) / 864e5; i = i || u >= 1 || u < -1 || o.getDate() !== s.getDate(); } else i = !0; if (!i) return this.processRequests(); this.postEvent(a, { "enabled.telemetry": !1 }, (function (t) { t || (e.eventData.lastSuccess = a, e.eventData.tokenU = n); }), t); } }, e }(W)), nt = rt.postTurnstileEvent.bind(rt), it = new et, at = it.postMapLoadEvent.bind(it), ot = "mapbox-tiles", st = 500, ut = 50, lt = 42e4; function pt() { self.caches && !Q && (Q = self.caches.open(ot)); } function ct(t, e, r) { if (pt(), Q) { var n = { status: e.status, statusText: e.statusText, headers: new self.Headers }; e.headers.forEach((function (t, e) { return n.headers.set(e, t) })); var i = I(e.headers.get("Cache-Control") || ""); if (!i["no-store"]) i["max-age"] && n.headers.set("Expires", new Date(r + 1e3 * i["max-age"]).toUTCString()), new Date(n.headers.get("Expires")).getTime() - r < lt || function (t, e) { if (void 0 === tt) try { new Response(new ReadableStream), tt = !0; } catch (t) { tt = !1; } tt ? e(t.body) : t.blob().then(e); }(e, (function (e) { var r = new self.Response(e, n); pt(), Q && Q.then((function (e) { return e.put(ht(t.url), r) })).catch((function (t) { return w(t.message) })); })); } } function ht(t) { var e = t.indexOf("?"); return e < 0 ? t : t.slice(0, e) } function ft(t, e) { if (pt(), !Q) return e(null); var r = ht(t.url); Q.then((function (t) { t.match(r).then((function (n) { var i = function (t) { if (!t) return !1; var e = new Date(t.headers.get("Expires") || 0), r = I(t.headers.get("Cache-Control") || ""); return e > Date.now() && !r["no-cache"] }(n); t.delete(r), i && t.put(r, n.clone()), e(null, n, i); })).catch(e); })).catch(e); } var yt = 1 / 0; var dt = { Unknown: "Unknown", Style: "Style", Source: "Source", Tile: "Tile", Glyphs: "Glyphs", SpriteImage: "SpriteImage", SpriteJSON: "SpriteJSON", Image: "Image" }; "function" == typeof Object.freeze && Object.freeze(dt); var mt = function (t) { function e(e, r, n) { 401 === r && G(n) && (e += ": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"), t.call(this, e), this.status = r, this.url = n, this.name = this.constructor.name, this.message = e; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.toString = function () { return this.name + ": " + this.message + " (" + this.status + "): " + this.url }, e }(Error), vt = k() ? function () { return self.worker && self.worker.referrer } : function () { return ("blob:" === self.location.protocol ? self.parent : self).location.href }; function gt(t, e) { var r, n = new self.AbortController, i = new self.Request(t.url, { method: t.method || "GET", body: t.body, credentials: t.credentials, headers: t.headers, referrer: vt(), signal: n.signal }), a = !1, o = !1, s = (r = i.url).indexOf("sku=") > 0 && G(r); "json" === t.type && i.headers.set("Accept", "application/json"); var u = function (r, n, a) { if (!o) { if (r && "SecurityError" !== r.message && w(r), n && a) return l(n); var u = Date.now(); self.fetch(i).then((function (r) { if (r.ok) { var n = s ? r.clone() : null; return l(r, n, u) } return e(new mt(r.statusText, r.status, t.url)) })).catch((function (t) { 20 !== t.code && e(new Error(t.message)); })); } }, l = function (r, n, s) { ("arrayBuffer" === t.type ? r.arrayBuffer() : "json" === t.type ? r.json() : r.text()).then((function (t) { o || (n && s && ct(i, n, s), a = !0, e(null, t, r.headers.get("Cache-Control"), r.headers.get("Expires"))); })).catch((function (t) { o || e(new Error(t.message)); })); }; return s ? ft(i, u) : u(null, null), { cancel: function () { o = !0, a || n.abort(); } } } var xt = function (t, e) { if (r = t.url, !(/^file:/.test(r) || /^file:/.test(vt()) && !/^\w+:/.test(r))) { if (self.fetch && self.Request && self.AbortController && self.Request.prototype.hasOwnProperty("signal")) return gt(t, e); if (k() && self.worker && self.worker.actor) { return self.worker.actor.send("getResource", t, e, void 0, !0) } } var r; return function (t, e) { var r = new self.XMLHttpRequest; for (var n in r.open(t.method || "GET", t.url, !0), "arrayBuffer" === t.type && (r.responseType = "arraybuffer"), t.headers) r.setRequestHeader(n, t.headers[n]); return "json" === t.type && (r.responseType = "text", r.setRequestHeader("Accept", "application/json")), r.withCredentials = "include" === t.credentials, r.onerror = function () { e(new Error(r.statusText)); }, r.onload = function () { if ((r.status >= 200 && r.status < 300 || 0 === r.status) && null !== r.response) { var n = r.response; if ("json" === t.type) try { n = JSON.parse(r.response); } catch (t) { return e(t) } e(null, n, r.getResponseHeader("Cache-Control"), r.getResponseHeader("Expires")); } else e(new mt(r.statusText, r.status, t.url)); }, r.send(t.body), { cancel: function () { return r.abort() } } }(t, e) }, bt = function (t, e) { return xt(c(t, { type: "arrayBuffer" }), e) }, _t = function (t, e) { return xt(c(t, { method: "POST" }), e) }; var wt, At; wt = [], At = 0; var St = function (t, e) { if (R.supported && (t.headers || (t.headers = {}), t.headers.accept = "image/webp,*/*"), At >= D.MAX_PARALLEL_IMAGE_REQUESTS) { var r = { requestParameters: t, callback: e, cancelled: !1, cancel: function () { this.cancelled = !0; } }; return wt.push(r), r } At++; var n = !1, i = function () { if (!n) for (n = !0, At--; wt.length && At < D.MAX_PARALLEL_IMAGE_REQUESTS;) { var t = wt.shift(), e = t.requestParameters, r = t.callback; t.cancelled || (t.cancel = St(e, r).cancel); } }, a = bt(t, (function (t, r, n, a) { if (i(), t) e(t); else if (r) { var o = new self.Image; o.onload = function () { e(null, o), self.URL.revokeObjectURL(o.src); }, o.onerror = function () { return e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")) }; var s = new self.Blob([new Uint8Array(r)], { type: "image/png" }); o.cacheControl = n, o.expires = a, o.src = r.byteLength ? self.URL.createObjectURL(s) : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="; } })); return { cancel: function () { a.cancel(), i(); } } }; function kt(t, e, r) { r[t] && -1 !== r[t].indexOf(e) || (r[t] = r[t] || [], r[t].push(e)); } function It(t, e, r) { if (r && r[t]) { var n = r[t].indexOf(e); -1 !== n && r[t].splice(n, 1); } } var zt = function (t, e) { void 0 === e && (e = {}), c(this, e), this.type = t; }, Ct = function (t) { function e(e, r) { void 0 === r && (r = {}), t.call(this, "error", c({ error: e }, r)); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e }(zt), Bt = function () { }; Bt.prototype.on = function (t, e) { return this._listeners = this._listeners || {}, kt(t, e, this._listeners), this }, Bt.prototype.off = function (t, e) { return It(t, e, this._listeners), It(t, e, this._oneTimeListeners), this }, Bt.prototype.once = function (t, e) { return this._oneTimeListeners = this._oneTimeListeners || {}, kt(t, e, this._oneTimeListeners), this }, Bt.prototype.fire = function (t, e) { "string" == typeof t && (t = new zt(t, e || {})); var r = t.type; if (this.listens(r)) { t.target = this; for (var n = 0, i = this._listeners && this._listeners[r] ? this._listeners[r].slice() : []; n < i.length; n += 1) { i[n].call(this, t); } for (var a = 0, o = this._oneTimeListeners && this._oneTimeListeners[r] ? this._oneTimeListeners[r].slice() : []; a < o.length; a += 1) { var s = o[a]; It(r, s, this._oneTimeListeners), s.call(this, t); } var u = this._eventedParent; u && (c(t, "function" == typeof this._eventedParentData ? this._eventedParentData() : this._eventedParentData), u.fire(t)); } else t instanceof Ct && console.error(t.error); return this }, Bt.prototype.listens = function (t) { return this._listeners && this._listeners[t] && this._listeners[t].length > 0 || this._oneTimeListeners && this._oneTimeListeners[t] && this._oneTimeListeners[t].length > 0 || this._eventedParent && this._eventedParent.listens(t) }, Bt.prototype.setEventedParent = function (t, e) { return this._eventedParent = t, this._eventedParentData = e, this }; var Tt = { $version: 8, $root: { version: { required: !0, type: "enum", values: [8] }, name: { type: "string" }, metadata: { type: "*" }, center: { type: "array", value: "number" }, zoom: { type: "number" }, bearing: { type: "number", default: 0, period: 360, units: "degrees" }, pitch: { type: "number", default: 0, units: "degrees" }, light: { type: "light" }, sources: { required: !0, type: "sources" }, sprite: { type: "string" }, glyphs: { type: "string" }, transition: { type: "transition" }, layers: { required: !0, type: "array", value: "layer" } }, sources: { "*": { type: "source" } }, source: ["source_vector", "source_raster", "source_raster_dem", "source_geojson", "source_video", "source_image"], source_vector: { type: { required: !0, type: "enum", values: { vector: {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, scheme: { type: "enum", values: { xyz: {}, tms: {} }, default: "xyz" }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, attribution: { type: "string" }, "*": { type: "*" } }, source_raster: { type: { required: !0, type: "enum", values: { raster: {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, tileSize: { type: "number", default: 512, units: "pixels" }, scheme: { type: "enum", values: { xyz: {}, tms: {} }, default: "xyz" }, attribution: { type: "string" }, "*": { type: "*" } }, source_raster_dem: { type: { required: !0, type: "enum", values: { "raster-dem": {} } }, url: { type: "string" }, tiles: { type: "array", value: "string" }, bounds: { type: "array", value: "number", length: 4, default: [-180, -85.051129, 180, 85.051129] }, minzoom: { type: "number", default: 0 }, maxzoom: { type: "number", default: 22 }, tileSize: { type: "number", default: 512, units: "pixels" }, attribution: { type: "string" }, encoding: { type: "enum", values: { terrarium: {}, mapbox: {} }, default: "mapbox" }, "*": { type: "*" } }, source_geojson: { type: { required: !0, type: "enum", values: { geojson: {} } }, data: { type: "*" }, maxzoom: { type: "number", default: 18 }, attribution: { type: "string" }, buffer: { type: "number", default: 128, maximum: 512, minimum: 0 }, tolerance: { type: "number", default: .375 }, cluster: { type: "boolean", default: !1 }, clusterRadius: { type: "number", default: 50, minimum: 0 }, clusterMaxZoom: { type: "number" }, clusterProperties: { type: "*" }, lineMetrics: { type: "boolean", default: !1 }, generateId: { type: "boolean", default: !1 } }, source_video: { type: { required: !0, type: "enum", values: { video: {} } }, urls: { required: !0, type: "array", value: "string" }, coordinates: { required: !0, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, source_image: { type: { required: !0, type: "enum", values: { image: {} } }, url: { required: !0, type: "string" }, coordinates: { required: !0, type: "array", length: 4, value: { type: "array", length: 2, value: "number" } } }, layer: { id: { type: "string", required: !0 }, type: { type: "enum", values: { fill: {}, line: {}, symbol: {}, circle: {}, heatmap: {}, "fill-extrusion": {}, raster: {}, hillshade: {}, background: {} }, required: !0 }, metadata: { type: "*" }, source: { type: "string" }, "source-layer": { type: "string" }, minzoom: { type: "number", minimum: 0, maximum: 24 }, maxzoom: { type: "number", minimum: 0, maximum: 24 }, filter: { type: "filter" }, layout: { type: "layout" }, paint: { type: "paint" } }, layout: ["layout_fill", "layout_line", "layout_circle", "layout_heatmap", "layout_fill-extrusion", "layout_symbol", "layout_raster", "layout_hillshade", "layout_background"], layout_background: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_fill: { "fill-sort-key": { type: "number", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_circle: { "circle-sort-key": { type: "number", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_heatmap: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, "layout_fill-extrusion": { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_line: { "line-cap": { type: "enum", values: { butt: {}, round: {}, square: {} }, default: "butt", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-join": { type: "enum", values: { bevel: {}, round: {}, miter: {} }, default: "miter", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "line-miter-limit": { type: "number", default: 2, requires: [{ "line-join": "miter" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-round-limit": { type: "number", default: 1.05, requires: [{ "line-join": "round" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-sort-key": { type: "number", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_symbol: { "symbol-placement": { type: "enum", values: { point: {}, line: {}, "line-center": {} }, default: "point", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-spacing": { type: "number", default: 250, minimum: 1, units: "pixels", requires: [{ "symbol-placement": "line" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-avoid-edges": { type: "boolean", default: !1, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "symbol-sort-key": { type: "number", expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "symbol-z-order": { type: "enum", values: { auto: {}, "viewport-y": {}, source: {} }, default: "auto", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-allow-overlap": { type: "boolean", default: !1, requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-ignore-placement": { type: "boolean", default: !1, requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-optional": { type: "boolean", default: !1, requires: ["icon-image", "text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-size": { type: "number", default: 1, minimum: 0, units: "factor of the original icon size", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-text-fit": { type: "enum", values: { none: {}, width: {}, height: {}, both: {} }, default: "none", requires: ["icon-image", "text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-text-fit-padding": { type: "array", value: "number", length: 4, default: [0, 0, 0, 0], units: "pixels", requires: ["icon-image", "text-field", { "icon-text-fit": ["both", "width", "height"] }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-image": { type: "resolvedImage", tokens: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-padding": { type: "number", default: 2, minimum: 0, units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-keep-upright": { type: "boolean", default: !1, requires: ["icon-image", { "icon-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-offset": { type: "array", value: "number", length: 2, default: [0, 0], requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-anchor": { type: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, default: "center", requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "icon-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-pitch-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotation-alignment": { type: "enum", values: { map: {}, viewport: {}, auto: {} }, default: "auto", requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-field": { type: "formatted", default: "", tokens: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-font": { type: "array", value: "string", default: ["Open Sans Regular", "Arial Unicode MS Regular"], requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-size": { type: "number", default: 16, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-width": { type: "number", default: 10, minimum: 0, units: "ems", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-line-height": { type: "number", default: 1.2, units: "ems", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-letter-spacing": { type: "number", default: 0, units: "ems", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-justify": { type: "enum", values: { auto: {}, left: {}, center: {}, right: {} }, default: "center", requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-radial-offset": { type: "number", units: "ems", default: 0, requires: ["text-field"], "property-type": "data-driven", expression: { interpolated: !0, parameters: ["zoom", "feature"] } }, "text-variable-anchor": { type: "array", value: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-anchor": { type: "enum", values: { center: {}, left: {}, right: {}, top: {}, bottom: {}, "top-left": {}, "top-right": {}, "bottom-left": {}, "bottom-right": {} }, default: "center", requires: ["text-field", { "!": "text-variable-anchor" }], expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-max-angle": { type: "number", default: 45, units: "degrees", requires: ["text-field", { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-writing-mode": { type: "array", value: "enum", values: { horizontal: {}, vertical: {} }, requires: ["text-field", { "symbol-placement": ["point"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-rotate": { type: "number", default: 0, period: 360, units: "degrees", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-padding": { type: "number", default: 2, minimum: 0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-keep-upright": { type: "boolean", default: !0, requires: ["text-field", { "text-rotation-alignment": "map" }, { "symbol-placement": ["line", "line-center"] }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-transform": { type: "enum", values: { none: {}, uppercase: {}, lowercase: {} }, default: "none", requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-offset": { type: "array", value: "number", units: "ems", length: 2, default: [0, 0], requires: ["text-field", { "!": "text-radial-offset" }], expression: { interpolated: !0, parameters: ["zoom", "feature"] }, "property-type": "data-driven" }, "text-allow-overlap": { type: "boolean", default: !1, requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-ignore-placement": { type: "boolean", default: !1, requires: ["text-field"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-optional": { type: "boolean", default: !1, requires: ["text-field", "icon-image"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_raster: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, layout_hillshade: { visibility: { type: "enum", values: { visible: {}, none: {} }, default: "visible", "property-type": "constant" } }, filter: { type: "array", value: "*" }, filter_operator: { type: "enum", values: { "==": {}, "!=": {}, ">": {}, ">=": {}, "<": {}, "<=": {}, in: {}, "!in": {}, all: {}, any: {}, none: {}, has: {}, "!has": {} } }, geometry_type: { type: "enum", values: { Point: {}, LineString: {}, Polygon: {} } }, function: { expression: { type: "expression" }, stops: { type: "array", value: "function_stop" }, base: { type: "number", default: 1, minimum: 0 }, property: { type: "string", default: "$zoom" }, type: { type: "enum", values: { identity: {}, exponential: {}, interval: {}, categorical: {} }, default: "exponential" }, colorSpace: { type: "enum", values: { rgb: {}, lab: {}, hcl: {} }, default: "rgb" }, default: { type: "*", required: !1 } }, function_stop: { type: "array", minimum: 0, maximum: 24, value: ["number", "color"], length: 2 }, expression: { type: "array", value: "*", minimum: 1 }, expression_name: { type: "enum", values: { let: { group: "Variable binding" }, var: { group: "Variable binding" }, literal: { group: "Types" }, array: { group: "Types" }, at: { group: "Lookup" }, in: { group: "Lookup" }, case: { group: "Decision" }, match: { group: "Decision" }, coalesce: { group: "Decision" }, step: { group: "Ramps, scales, curves" }, interpolate: { group: "Ramps, scales, curves" }, "interpolate-hcl": { group: "Ramps, scales, curves" }, "interpolate-lab": { group: "Ramps, scales, curves" }, ln2: { group: "Math" }, pi: { group: "Math" }, e: { group: "Math" }, typeof: { group: "Types" }, string: { group: "Types" }, number: { group: "Types" }, boolean: { group: "Types" }, object: { group: "Types" }, collator: { group: "Types" }, format: { group: "Types" }, image: { group: "Types" }, "number-format": { group: "Types" }, "to-string": { group: "Types" }, "to-number": { group: "Types" }, "to-boolean": { group: "Types" }, "to-rgba": { group: "Color" }, "to-color": { group: "Types" }, rgb: { group: "Color" }, rgba: { group: "Color" }, get: { group: "Lookup" }, has: { group: "Lookup" }, length: { group: "Lookup" }, properties: { group: "Feature data" }, "feature-state": { group: "Feature data" }, "geometry-type": { group: "Feature data" }, id: { group: "Feature data" }, zoom: { group: "Zoom" }, "heatmap-density": { group: "Heatmap" }, "line-progress": { group: "Feature data" }, accumulated: { group: "Feature data" }, "+": { group: "Math" }, "*": { group: "Math" }, "-": { group: "Math" }, "/": { group: "Math" }, "%": { group: "Math" }, "^": { group: "Math" }, sqrt: { group: "Math" }, log10: { group: "Math" }, ln: { group: "Math" }, log2: { group: "Math" }, sin: { group: "Math" }, cos: { group: "Math" }, tan: { group: "Math" }, asin: { group: "Math" }, acos: { group: "Math" }, atan: { group: "Math" }, min: { group: "Math" }, max: { group: "Math" }, round: { group: "Math" }, abs: { group: "Math" }, ceil: { group: "Math" }, floor: { group: "Math" }, "==": { group: "Decision" }, "!=": { group: "Decision" }, ">": { group: "Decision" }, "<": { group: "Decision" }, ">=": { group: "Decision" }, "<=": { group: "Decision" }, all: { group: "Decision" }, any: { group: "Decision" }, "!": { group: "Decision" }, "is-supported-script": { group: "String" }, upcase: { group: "String" }, downcase: { group: "String" }, concat: { group: "String" }, "resolved-locale": { group: "String" } } }, light: { anchor: { type: "enum", default: "viewport", values: { map: {}, viewport: {} }, "property-type": "data-constant", transition: !1, expression: { interpolated: !1, parameters: ["zoom"] } }, position: { type: "array", default: [1.15, 210, 30], length: 3, value: "number", "property-type": "data-constant", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] } }, color: { type: "color", "property-type": "data-constant", default: "#ffffff", expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 }, intensity: { type: "number", "property-type": "data-constant", default: .5, minimum: 0, maximum: 1, expression: { interpolated: !0, parameters: ["zoom"] }, transition: !0 } }, paint: ["paint_fill", "paint_line", "paint_circle", "paint_heatmap", "paint_fill-extrusion", "paint_symbol", "paint_raster", "paint_hillshade", "paint_background"], paint_fill: { "fill-antialias": { type: "boolean", default: !0, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "fill-pattern" }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-outline-color": { type: "color", transition: !0, requires: [{ "!": "fill-pattern" }, { "fill-antialias": !0 }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" } }, "paint_fill-extrusion": { "fill-extrusion-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "fill-extrusion-pattern" }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["fill-extrusion-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "fill-extrusion-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "fill-extrusion-height": { type: "number", default: 0, minimum: 0, units: "meters", transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-base": { type: "number", default: 0, minimum: 0, units: "meters", transition: !0, requires: ["fill-extrusion-height"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "fill-extrusion-vertical-gradient": { type: "boolean", default: !0, transition: !1, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_line: { "line-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "line-pattern" }], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["line-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "line-width": { type: "number", default: 1, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-gap-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-offset": { type: "number", default: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-blur": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "line-dasharray": { type: "array", value: "number", minimum: 0, transition: !0, units: "line widths", requires: [{ "!": "line-pattern" }], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "cross-faded" }, "line-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom", "feature"] }, "property-type": "cross-faded-data-driven" }, "line-gradient": { type: "color", transition: !1, requires: [{ "!": "line-dasharray" }, { "!": "line-pattern" }, { source: "geojson", has: { lineMetrics: !0 } }], expression: { interpolated: !0, parameters: ["line-progress"] }, "property-type": "color-ramp" } }, paint_circle: { "circle-radius": { type: "number", default: 5, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-blur": { type: "number", default: 0, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["circle-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-scale": { type: "enum", values: { map: {}, viewport: {} }, default: "map", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-pitch-alignment": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "circle-stroke-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "circle-stroke-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" } }, paint_heatmap: { "heatmap-radius": { type: "number", default: 30, minimum: 1, transition: !0, units: "pixels", expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-weight": { type: "number", default: 1, minimum: 0, transition: !1, expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "heatmap-intensity": { type: "number", default: 1, minimum: 0, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "heatmap-color": { type: "color", default: ["interpolate", ["linear"], ["heatmap-density"], 0, "rgba(0, 0, 255, 0)", .1, "royalblue", .3, "cyan", .5, "lime", .7, "yellow", 1, "red"], transition: !1, expression: { interpolated: !0, parameters: ["heatmap-density"] }, "property-type": "color-ramp" }, "heatmap-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_symbol: { "icon-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-color": { type: "color", default: "#000000", transition: !0, requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: !0, requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-halo-blur": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "icon-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", requires: ["icon-image"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "icon-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["icon-image", "icon-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-color": { type: "color", default: "#000000", transition: !0, overridable: !0, requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-color": { type: "color", default: "rgba(0, 0, 0, 0)", transition: !0, requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-width": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-halo-blur": { type: "number", default: 0, minimum: 0, transition: !0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom", "feature", "feature-state"] }, "property-type": "data-driven" }, "text-translate": { type: "array", value: "number", length: 2, default: [0, 0], transition: !0, units: "pixels", requires: ["text-field"], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "text-translate-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "map", requires: ["text-field", "text-translate"], expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_raster: { "raster-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-hue-rotate": { type: "number", default: 0, period: 360, transition: !0, units: "degrees", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-min": { type: "number", default: 0, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-brightness-max": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-saturation": { type: "number", default: 0, minimum: -1, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-contrast": { type: "number", default: 0, minimum: -1, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-resampling": { type: "enum", values: { linear: {}, nearest: {} }, default: "linear", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "raster-fade-duration": { type: "number", default: 300, minimum: 0, transition: !1, units: "milliseconds", expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_hillshade: { "hillshade-illumination-direction": { type: "number", default: 335, minimum: 0, maximum: 359, transition: !1, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-illumination-anchor": { type: "enum", values: { map: {}, viewport: {} }, default: "viewport", expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-exaggeration": { type: "number", default: .5, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-shadow-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-highlight-color": { type: "color", default: "#FFFFFF", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "hillshade-accent-color": { type: "color", default: "#000000", transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, paint_background: { "background-color": { type: "color", default: "#000000", transition: !0, requires: [{ "!": "background-pattern" }], expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" }, "background-pattern": { type: "resolvedImage", transition: !0, expression: { interpolated: !1, parameters: ["zoom"] }, "property-type": "cross-faded" }, "background-opacity": { type: "number", default: 1, minimum: 0, maximum: 1, transition: !0, expression: { interpolated: !0, parameters: ["zoom"] }, "property-type": "data-constant" } }, transition: { duration: { type: "number", default: 300, minimum: 0, units: "milliseconds" }, delay: { type: "number", default: 0, minimum: 0, units: "milliseconds" } }, "property-type": { "data-driven": { type: "property-type" }, "cross-faded": { type: "property-type" }, "cross-faded-data-driven": { type: "property-type" }, "color-ramp": { type: "property-type" }, "data-constant": { type: "property-type" }, constant: { type: "property-type" } } }, Pt = function (t, e, r, n) { this.message = (t ? t + ": " : "") + r, n && (this.identifier = n), null != e && e.__line__ && (this.line = e.__line__); }; function Et(t) { var e = t.key, r = t.value; return r ? [new Pt(e, r, "constants have been deprecated as of v8")] : [] } function Mt(t) { for (var e = [], r = arguments.length - 1; r-- > 0;)e[r] = arguments[r + 1]; for (var n = 0, i = e; n < i.length; n += 1) { var a = i[n]; for (var o in a) t[o] = a[o]; } return t } function Vt(t) { return t instanceof Number || t instanceof String || t instanceof Boolean ? t.valueOf() : t } function Ft(t) { if (Array.isArray(t)) return t.map(Ft); if (t instanceof Object && !(t instanceof Number || t instanceof String || t instanceof Boolean)) { var e = {}; for (var r in t) e[r] = Ft(t[r]); return e } return Vt(t) } var Lt = function (t) { function e(e, r) { t.call(this, r), this.message = r, this.key = e; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e }(Error), Ot = function (t, e) { void 0 === e && (e = []), this.parent = t, this.bindings = {}; for (var r = 0, n = e; r < n.length; r += 1) { var i = n[r], a = i[0], o = i[1]; this.bindings[a] = o; } }; Ot.prototype.concat = function (t) { return new Ot(this, t) }, Ot.prototype.get = function (t) { if (this.bindings[t]) return this.bindings[t]; if (this.parent) return this.parent.get(t); throw new Error(t + " not found in scope.") }, Ot.prototype.has = function (t) { return !!this.bindings[t] || !!this.parent && this.parent.has(t) }; var Dt = { kind: "null" }, Rt = { kind: "number" }, Ut = { kind: "string" }, jt = { kind: "boolean" }, qt = { kind: "color" }, Nt = { kind: "object" }, Kt = { kind: "value" }, Xt = { kind: "collator" }, Zt = { kind: "formatted" }, Gt = { kind: "resolvedImage" }; function Jt(t, e) { return { kind: "array", itemType: t, N: e } } function Ht(t) { if ("array" === t.kind) { var e = Ht(t.itemType); return "number" == typeof t.N ? "array<" + e + ", " + t.N + ">" : "value" === t.itemType.kind ? "array" : "array<" + e + ">" } return t.kind } var Yt = [Dt, Rt, Ut, jt, qt, Zt, Nt, Jt(Kt), Gt]; function $t(t, e) { if ("error" === e.kind) return null; if ("array" === t.kind) { if ("array" === e.kind && (0 === e.N && "value" === e.itemType.kind || !$t(t.itemType, e.itemType)) && ("number" != typeof t.N || t.N === e.N)) return null } else { if (t.kind === e.kind) return null; if ("value" === t.kind) for (var r = 0, n = Yt; r < n.length; r += 1) { if (!$t(n[r], e)) return null } } return "Expected " + Ht(t) + " but found " + Ht(e) + " instead." } var Wt = e((function (t, e) { var r = { transparent: [0, 0, 0, 0], aliceblue: [240, 248, 255, 1], antiquewhite: [250, 235, 215, 1], aqua: [0, 255, 255, 1], aquamarine: [127, 255, 212, 1], azure: [240, 255, 255, 1], beige: [245, 245, 220, 1], bisque: [255, 228, 196, 1], black: [0, 0, 0, 1], blanchedalmond: [255, 235, 205, 1], blue: [0, 0, 255, 1], blueviolet: [138, 43, 226, 1], brown: [165, 42, 42, 1], burlywood: [222, 184, 135, 1], cadetblue: [95, 158, 160, 1], chartreuse: [127, 255, 0, 1], chocolate: [210, 105, 30, 1], coral: [255, 127, 80, 1], cornflowerblue: [100, 149, 237, 1], cornsilk: [255, 248, 220, 1], crimson: [220, 20, 60, 1], cyan: [0, 255, 255, 1], darkblue: [0, 0, 139, 1], darkcyan: [0, 139, 139, 1], darkgoldenrod: [184, 134, 11, 1], darkgray: [169, 169, 169, 1], darkgreen: [0, 100, 0, 1], darkgrey: [169, 169, 169, 1], darkkhaki: [189, 183, 107, 1], darkmagenta: [139, 0, 139, 1], darkolivegreen: [85, 107, 47, 1], darkorange: [255, 140, 0, 1], darkorchid: [153, 50, 204, 1], darkred: [139, 0, 0, 1], darksalmon: [233, 150, 122, 1], darkseagreen: [143, 188, 143, 1], darkslateblue: [72, 61, 139, 1], darkslategray: [47, 79, 79, 1], darkslategrey: [47, 79, 79, 1], darkturquoise: [0, 206, 209, 1], darkviolet: [148, 0, 211, 1], deeppink: [255, 20, 147, 1], deepskyblue: [0, 191, 255, 1], dimgray: [105, 105, 105, 1], dimgrey: [105, 105, 105, 1], dodgerblue: [30, 144, 255, 1], firebrick: [178, 34, 34, 1], floralwhite: [255, 250, 240, 1], forestgreen: [34, 139, 34, 1], fuchsia: [255, 0, 255, 1], gainsboro: [220, 220, 220, 1], ghostwhite: [248, 248, 255, 1], gold: [255, 215, 0, 1], goldenrod: [218, 165, 32, 1], gray: [128, 128, 128, 1], green: [0, 128, 0, 1], greenyellow: [173, 255, 47, 1], grey: [128, 128, 128, 1], honeydew: [240, 255, 240, 1], hotpink: [255, 105, 180, 1], indianred: [205, 92, 92, 1], indigo: [75, 0, 130, 1], ivory: [255, 255, 240, 1], khaki: [240, 230, 140, 1], lavender: [230, 230, 250, 1], lavenderblush: [255, 240, 245, 1], lawngreen: [124, 252, 0, 1], lemonchiffon: [255, 250, 205, 1], lightblue: [173, 216, 230, 1], lightcoral: [240, 128, 128, 1], lightcyan: [224, 255, 255, 1], lightgoldenrodyellow: [250, 250, 210, 1], lightgray: [211, 211, 211, 1], lightgreen: [144, 238, 144, 1], lightgrey: [211, 211, 211, 1], lightpink: [255, 182, 193, 1], lightsalmon: [255, 160, 122, 1], lightseagreen: [32, 178, 170, 1], lightskyblue: [135, 206, 250, 1], lightslategray: [119, 136, 153, 1], lightslategrey: [119, 136, 153, 1], lightsteelblue: [176, 196, 222, 1], lightyellow: [255, 255, 224, 1], lime: [0, 255, 0, 1], limegreen: [50, 205, 50, 1], linen: [250, 240, 230, 1], magenta: [255, 0, 255, 1], maroon: [128, 0, 0, 1], mediumaquamarine: [102, 205, 170, 1], mediumblue: [0, 0, 205, 1], mediumorchid: [186, 85, 211, 1], mediumpurple: [147, 112, 219, 1], mediumseagreen: [60, 179, 113, 1], mediumslateblue: [123, 104, 238, 1], mediumspringgreen: [0, 250, 154, 1], mediumturquoise: [72, 209, 204, 1], mediumvioletred: [199, 21, 133, 1], midnightblue: [25, 25, 112, 1], mintcream: [245, 255, 250, 1], mistyrose: [255, 228, 225, 1], moccasin: [255, 228, 181, 1], navajowhite: [255, 222, 173, 1], navy: [0, 0, 128, 1], oldlace: [253, 245, 230, 1], olive: [128, 128, 0, 1], olivedrab: [107, 142, 35, 1], orange: [255, 165, 0, 1], orangered: [255, 69, 0, 1], orchid: [218, 112, 214, 1], palegoldenrod: [238, 232, 170, 1], palegreen: [152, 251, 152, 1], paleturquoise: [175, 238, 238, 1], palevioletred: [219, 112, 147, 1], papayawhip: [255, 239, 213, 1], peachpuff: [255, 218, 185, 1], peru: [205, 133, 63, 1], pink: [255, 192, 203, 1], plum: [221, 160, 221, 1], powderblue: [176, 224, 230, 1], purple: [128, 0, 128, 1], rebeccapurple: [102, 51, 153, 1], red: [255, 0, 0, 1], rosybrown: [188, 143, 143, 1], royalblue: [65, 105, 225, 1], saddlebrown: [139, 69, 19, 1], salmon: [250, 128, 114, 1], sandybrown: [244, 164, 96, 1], seagreen: [46, 139, 87, 1], seashell: [255, 245, 238, 1], sienna: [160, 82, 45, 1], silver: [192, 192, 192, 1], skyblue: [135, 206, 235, 1], slateblue: [106, 90, 205, 1], slategray: [112, 128, 144, 1], slategrey: [112, 128, 144, 1], snow: [255, 250, 250, 1], springgreen: [0, 255, 127, 1], steelblue: [70, 130, 180, 1], tan: [210, 180, 140, 1], teal: [0, 128, 128, 1], thistle: [216, 191, 216, 1], tomato: [255, 99, 71, 1], turquoise: [64, 224, 208, 1], violet: [238, 130, 238, 1], wheat: [245, 222, 179, 1], white: [255, 255, 255, 1], whitesmoke: [245, 245, 245, 1], yellow: [255, 255, 0, 1], yellowgreen: [154, 205, 50, 1] }; function n(t) { return (t = Math.round(t)) < 0 ? 0 : t > 255 ? 255 : t } function i(t) { return t < 0 ? 0 : t > 1 ? 1 : t } function a(t) { return "%" === t[t.length - 1] ? n(parseFloat(t) / 100 * 255) : n(parseInt(t)) } function o(t) { return "%" === t[t.length - 1] ? i(parseFloat(t) / 100) : i(parseFloat(t)) } function s(t, e, r) { return r < 0 ? r += 1 : r > 1 && (r -= 1), 6 * r < 1 ? t + (e - t) * r * 6 : 2 * r < 1 ? e : 3 * r < 2 ? t + (e - t) * (2 / 3 - r) * 6 : t } try { e.parseCSSColor = function (t) { var e, i = t.replace(/ /g, "").toLowerCase(); if (i in r) return r[i].slice(); if ("#" === i[0]) return 4 === i.length ? (e = parseInt(i.substr(1), 16)) >= 0 && e <= 4095 ? [(3840 & e) >> 4 | (3840 & e) >> 8, 240 & e | (240 & e) >> 4, 15 & e | (15 & e) << 4, 1] : null : 7 === i.length && (e = parseInt(i.substr(1), 16)) >= 0 && e <= 16777215 ? [(16711680 & e) >> 16, (65280 & e) >> 8, 255 & e, 1] : null; var u = i.indexOf("("), l = i.indexOf(")"); if (-1 !== u && l + 1 === i.length) { var p = i.substr(0, u), c = i.substr(u + 1, l - (u + 1)).split(","), h = 1; switch (p) { case "rgba": if (4 !== c.length) return null; h = o(c.pop()); case "rgb": return 3 !== c.length ? null : [a(c[0]), a(c[1]), a(c[2]), h]; case "hsla": if (4 !== c.length) return null; h = o(c.pop()); case "hsl": if (3 !== c.length) return null; var f = (parseFloat(c[0]) % 360 + 360) % 360 / 360, y = o(c[1]), d = o(c[2]), m = d <= .5 ? d * (y + 1) : d + y - d * y, v = 2 * d - m; return [n(255 * s(v, m, f + 1 / 3)), n(255 * s(v, m, f)), n(255 * s(v, m, f - 1 / 3)), h]; default: return null } } return null }; } catch (t) { } })).parseCSSColor, Qt = function (t, e, r, n) { void 0 === n && (n = 1), this.r = t, this.g = e, this.b = r, this.a = n; }; Qt.parse = function (t) { if (t) { if (t instanceof Qt) return t; if ("string" == typeof t) { var e = Wt(t); if (e) return new Qt(e[0] / 255 * e[3], e[1] / 255 * e[3], e[2] / 255 * e[3], e[3]) } } }, Qt.prototype.toString = function () { var t = this.toArray(), e = t[0], r = t[1], n = t[2], i = t[3]; return "rgba(" + Math.round(e) + "," + Math.round(r) + "," + Math.round(n) + "," + i + ")" }, Qt.prototype.toArray = function () { var t = this.r, e = this.g, r = this.b, n = this.a; return 0 === n ? [0, 0, 0, 0] : [255 * t / n, 255 * e / n, 255 * r / n, n] }, Qt.black = new Qt(0, 0, 0, 1), Qt.white = new Qt(1, 1, 1, 1), Qt.transparent = new Qt(0, 0, 0, 0), Qt.red = new Qt(1, 0, 0, 1); var te = function (t, e, r) { this.sensitivity = t ? e ? "variant" : "case" : e ? "accent" : "base", this.locale = r, this.collator = new Intl.Collator(this.locale ? this.locale : [], { sensitivity: this.sensitivity, usage: "search" }); }; te.prototype.compare = function (t, e) { return this.collator.compare(t, e) }, te.prototype.resolvedLocale = function () { return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale }; var ee = function (t, e, r, n, i) { this.text = t, this.image = e, this.scale = r, this.fontStack = n, this.textColor = i; }, re = function (t) { this.sections = t; }; re.fromString = function (t) { return new re([new ee(t, null, null, null, null)]) }, re.prototype.isEmpty = function () { return 0 === this.sections.length || !this.sections.some((function (t) { return 0 !== t.text.length || t.image && 0 !== t.image.name.length })) }, re.factory = function (t) { return t instanceof re ? t : re.fromString(t) }, re.prototype.toString = function () { return 0 === this.sections.length ? "" : this.sections.map((function (t) { return t.text })).join("") }, re.prototype.serialize = function () { for (var t = ["format"], e = 0, r = this.sections; e < r.length; e += 1) { var n = r[e]; if (n.image) t.push(["image", n.image.name]); else { t.push(n.text); var i = {}; n.fontStack && (i["text-font"] = ["literal", n.fontStack.split(",")]), n.scale && (i["font-scale"] = n.scale), n.textColor && (i["text-color"] = ["rgba"].concat(n.textColor.toArray())), t.push(i); } } return t }; var ne = function (t) { this.name = t.name, this.available = t.available; }; function ie(t, e, r, n) { return "number" == typeof t && t >= 0 && t <= 255 && "number" == typeof e && e >= 0 && e <= 255 && "number" == typeof r && r >= 0 && r <= 255 ? void 0 === n || "number" == typeof n && n >= 0 && n <= 1 ? null : "Invalid rgba value [" + [t, e, r, n].join(", ") + "]: 'a' must be between 0 and 1." : "Invalid rgba value [" + ("number" == typeof n ? [t, e, r, n] : [t, e, r]).join(", ") + "]: 'r', 'g', and 'b' must be between 0 and 255." } function ae(t) { if (null === t) return Dt; if ("string" == typeof t) return Ut; if ("boolean" == typeof t) return jt; if ("number" == typeof t) return Rt; if (t instanceof Qt) return qt; if (t instanceof te) return Xt; if (t instanceof re) return Zt; if (t instanceof ne) return Gt; if (Array.isArray(t)) { for (var e, r = t.length, n = 0, i = t; n < i.length; n += 1) { var a = ae(i[n]); if (e) { if (e === a) continue; e = Kt; break } e = a; } return Jt(e || Kt, r) } return Nt } function oe(t) { var e = typeof t; return null === t ? "" : "string" === e || "number" === e || "boolean" === e ? String(t) : t instanceof Qt || t instanceof re || t instanceof ne ? t.toString() : JSON.stringify(t) } ne.prototype.toString = function () { return this.name }, ne.fromString = function (t) { return new ne({ name: t, available: !1 }) }, ne.prototype.serialize = function () { return ["image", this.name] }; var se = function (t, e) { this.type = t, this.value = e; }; se.parse = function (t, e) { if (2 !== t.length) return e.error("'literal' expression requires exactly one argument, but found " + (t.length - 1) + " instead."); if (!function t(e) { if (null === e) return !0; if ("string" == typeof e) return !0; if ("boolean" == typeof e) return !0; if ("number" == typeof e) return !0; if (e instanceof Qt) return !0; if (e instanceof te) return !0; if (e instanceof re) return !0; if (e instanceof ne) return !0; if (Array.isArray(e)) { for (var r = 0, n = e; r < n.length; r += 1) { if (!t(n[r])) return !1 } return !0 } if ("object" == typeof e) { for (var i in e) if (!t(e[i])) return !1; return !0 } return !1 }(t[1])) return e.error("invalid value"); var r = t[1], n = ae(r), i = e.expectedType; return "array" !== n.kind || 0 !== n.N || !i || "array" !== i.kind || "number" == typeof i.N && 0 !== i.N || (n = i), new se(n, r) }, se.prototype.evaluate = function () { return this.value }, se.prototype.eachChild = function () { }, se.prototype.possibleOutputs = function () { return [this.value] }, se.prototype.serialize = function () { return "array" === this.type.kind || "object" === this.type.kind ? ["literal", this.value] : this.value instanceof Qt ? ["rgba"].concat(this.value.toArray()) : this.value instanceof re ? this.value.serialize() : this.value }; var ue = function (t) { this.name = "ExpressionEvaluationError", this.message = t; }; ue.prototype.toJSON = function () { return this.message }; var le = { string: Ut, number: Rt, boolean: jt, object: Nt }, pe = function (t, e) { this.type = t, this.args = e; }; pe.parse = function (t, e) { if (t.length < 2) return e.error("Expected at least one argument."); var r, n = 1, i = t[0]; if ("array" === i) { var a, o; if (t.length > 2) { var s = t[1]; if ("string" != typeof s || !(s in le) || "object" === s) return e.error('The item type argument of "array" must be one of string, number, boolean', 1); a = le[s], n++; } else a = Kt; if (t.length > 3) { if (null !== t[2] && ("number" != typeof t[2] || t[2] < 0 || t[2] !== Math.floor(t[2]))) return e.error('The length argument to "array" must be a positive integer literal', 2); o = t[2], n++; } r = Jt(a, o); } else r = le[i]; for (var u = []; n < t.length; n++) { var l = e.parse(t[n], n, Kt); if (!l) return null; u.push(l); } return new pe(r, u) }, pe.prototype.evaluate = function (t) { for (var e = 0; e < this.args.length; e++) { var r = this.args[e].evaluate(t); if (!$t(this.type, ae(r))) return r; if (e === this.args.length - 1) throw new ue("Expected value to be of type " + Ht(this.type) + ", but found " + Ht(ae(r)) + " instead.") } return null }, pe.prototype.eachChild = function (t) { this.args.forEach(t); }, pe.prototype.possibleOutputs = function () { var t; return (t = []).concat.apply(t, this.args.map((function (t) { return t.possibleOutputs() }))) }, pe.prototype.serialize = function () { var t = this.type, e = [t.kind]; if ("array" === t.kind) { var r = t.itemType; if ("string" === r.kind || "number" === r.kind || "boolean" === r.kind) { e.push(r.kind); var n = t.N; ("number" == typeof n || this.args.length > 1) && e.push(n); } } return e.concat(this.args.map((function (t) { return t.serialize() }))) }; var ce = function (t) { this.type = Zt, this.sections = t; }; ce.parse = function (t, e) { if (t.length < 2) return e.error("Expected at least one argument."); var r = t[1]; if (!Array.isArray(r) && "object" == typeof r) return e.error("First argument must be an image or text section."); for (var n = [], i = !1, a = 1; a <= t.length - 1; ++a) { var o = t[a]; if (i && "object" == typeof o && !Array.isArray(o)) { i = !1; var s = null; if (o["font-scale"] && !(s = e.parse(o["font-scale"], 1, Rt))) return null; var u = null; if (o["text-font"] && !(u = e.parse(o["text-font"], 1, Jt(Ut)))) return null; var l = null; if (o["text-color"] && !(l = e.parse(o["text-color"], 1, qt))) return null; var p = n[n.length - 1]; p.scale = s, p.font = u, p.textColor = l; } else { var c = e.parse(t[a], 1, Kt); if (!c) return null; var h = c.type.kind; if ("string" !== h && "value" !== h && "null" !== h && "resolvedImage" !== h) return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'."); i = !0, n.push({ content: c, scale: null, font: null, textColor: null }); } } return new ce(n) }, ce.prototype.evaluate = function (t) { return new re(this.sections.map((function (e) { var r = e.content.evaluate(t); return ae(r) === Gt ? new ee("", r, null, null, null) : new ee(oe(r), null, e.scale ? e.scale.evaluate(t) : null, e.font ? e.font.evaluate(t).join(",") : null, e.textColor ? e.textColor.evaluate(t) : null) }))) }, ce.prototype.eachChild = function (t) { for (var e = 0, r = this.sections; e < r.length; e += 1) { var n = r[e]; t(n.content), n.scale && t(n.scale), n.font && t(n.font), n.textColor && t(n.textColor); } }, ce.prototype.possibleOutputs = function () { return [void 0] }, ce.prototype.serialize = function () { for (var t = ["format"], e = 0, r = this.sections; e < r.length; e += 1) { var n = r[e]; t.push(n.content.serialize()); var i = {}; n.scale && (i["font-scale"] = n.scale.serialize()), n.font && (i["text-font"] = n.font.serialize()), n.textColor && (i["text-color"] = n.textColor.serialize()), t.push(i); } return t }; var he = function (t) { this.type = Gt, this.input = t; }; he.parse = function (t, e) { if (2 !== t.length) return e.error("Expected two arguments."); var r = e.parse(t[1], 1, Ut); return r ? new he(r) : e.error("No image name provided.") }, he.prototype.evaluate = function (t) { var e = this.input.evaluate(t), r = !1; return t.availableImages && t.availableImages.indexOf(e) > -1 && (r = !0), new ne({ name: e, available: r }) }, he.prototype.eachChild = function (t) { t(this.input); }, he.prototype.possibleOutputs = function () { return [void 0] }, he.prototype.serialize = function () { return ["image", this.input.serialize()] }; var fe = { "to-boolean": jt, "to-color": qt, "to-number": Rt, "to-string": Ut }, ye = function (t, e) { this.type = t, this.args = e; }; ye.parse = function (t, e) { if (t.length < 2) return e.error("Expected at least one argument."); var r = t[0]; if (("to-boolean" === r || "to-string" === r) && 2 !== t.length) return e.error("Expected one argument."); for (var n = fe[r], i = [], a = 1; a < t.length; a++) { var o = e.parse(t[a], a, Kt); if (!o) return null; i.push(o); } return new ye(n, i) }, ye.prototype.evaluate = function (t) { if ("boolean" === this.type.kind) return Boolean(this.args[0].evaluate(t)); if ("color" === this.type.kind) { for (var e, r, n = 0, i = this.args; n < i.length; n += 1) { if (r = null, (e = i[n].evaluate(t)) instanceof Qt) return e; if ("string" == typeof e) { var a = t.parseColor(e); if (a) return a } else if (Array.isArray(e) && !(r = e.length < 3 || e.length > 4 ? "Invalid rbga value " + JSON.stringify(e) + ": expected an array containing either three or four numeric values." : ie(e[0], e[1], e[2], e[3]))) return new Qt(e[0] / 255, e[1] / 255, e[2] / 255, e[3]) } throw new ue(r || "Could not parse color from value '" + ("string" == typeof e ? e : String(JSON.stringify(e))) + "'") } if ("number" === this.type.kind) { for (var o = null, s = 0, u = this.args; s < u.length; s += 1) { if (null === (o = u[s].evaluate(t))) return 0; var l = Number(o); if (!isNaN(l)) return l } throw new ue("Could not convert " + JSON.stringify(o) + " to number.") } return "formatted" === this.type.kind ? re.fromString(oe(this.args[0].evaluate(t))) : "resolvedImage" === this.type.kind ? ne.fromString(oe(this.args[0].evaluate(t))) : oe(this.args[0].evaluate(t)) }, ye.prototype.eachChild = function (t) { this.args.forEach(t); }, ye.prototype.possibleOutputs = function () { var t; return (t = []).concat.apply(t, this.args.map((function (t) { return t.possibleOutputs() }))) }, ye.prototype.serialize = function () { if ("formatted" === this.type.kind) return new ce([{ content: this.args[0], scale: null, font: null, textColor: null }]).serialize(); if ("resolvedImage" === this.type.kind) return new he(this.args[0]).serialize(); var t = ["to-" + this.type.kind]; return this.eachChild((function (e) { t.push(e.serialize()); })), t }; var de = ["Unknown", "Point", "LineString", "Polygon"], me = function () { this.globals = null, this.feature = null, this.featureState = null, this.formattedSection = null, this._parseColorCache = {}, this.availableImages = null; }; me.prototype.id = function () { return this.feature && "id" in this.feature ? this.feature.id : null }, me.prototype.geometryType = function () { return this.feature ? "number" == typeof this.feature.type ? de[this.feature.type] : this.feature.type : null }, me.prototype.properties = function () { return this.feature && this.feature.properties || {} }, me.prototype.parseColor = function (t) { var e = this._parseColorCache[t]; return e || (e = this._parseColorCache[t] = Qt.parse(t)), e }; var ve = function (t, e, r, n) { this.name = t, this.type = e, this._evaluate = r, this.args = n; }; ve.prototype.evaluate = function (t) { return this._evaluate(t, this.args) }, ve.prototype.eachChild = function (t) { this.args.forEach(t); }, ve.prototype.possibleOutputs = function () { return [void 0] }, ve.prototype.serialize = function () { return [this.name].concat(this.args.map((function (t) { return t.serialize() }))) }, ve.parse = function (t, e) { var r, n = t[0], i = ve.definitions[n]; if (!i) return e.error('Unknown expression "' + n + '". If you wanted a literal array, use ["literal", [...]].', 0); for (var a = Array.isArray(i) ? i[0] : i.type, o = Array.isArray(i) ? [[i[1], i[2]]] : i.overloads, s = o.filter((function (e) { var r = e[0]; return !Array.isArray(r) || r.length === t.length - 1 })), u = null, l = 0, p = s; l < p.length; l += 1) { var c = p[l], h = c[0], f = c[1]; u = new Ae(e.registry, e.path, null, e.scope); for (var y = [], d = !1, m = 1; m < t.length; m++) { var v = t[m], g = Array.isArray(h) ? h[m - 1] : h.type, x = u.parse(v, 1 + y.length, g); if (!x) { d = !0; break } y.push(x); } if (!d) if (Array.isArray(h) && h.length !== y.length) u.error("Expected " + h.length + " arguments, but found " + y.length + " instead."); else { for (var b = 0; b < y.length; b++) { var _ = Array.isArray(h) ? h[b] : h.type, w = y[b]; u.concat(b + 1).checkSubtype(_, w.type); } if (0 === u.errors.length) return new ve(n, a, f, y) } } if (1 === s.length) (r = e.errors).push.apply(r, u.errors); else { for (var A = (s.length ? s : o).map((function (t) { var e, r = t[0]; return e = r, Array.isArray(e) ? "(" + e.map(Ht).join(", ") + ")" : "(" + Ht(e.type) + "...)" })).join(" | "), S = [], k = 1; k < t.length; k++) { var I = e.parse(t[k], 1 + S.length); if (!I) return null; S.push(Ht(I.type)); } e.error("Expected arguments of type " + A + ", but found (" + S.join(", ") + ") instead."); } return null }, ve.register = function (t, e) { for (var r in ve.definitions = e, e) t[r] = ve; }; var ge = function (t, e, r) { this.type = Xt, this.locale = r, this.caseSensitive = t, this.diacriticSensitive = e; }; function xe(t) { if (t instanceof ve) { if ("get" === t.name && 1 === t.args.length) return !1; if ("feature-state" === t.name) return !1; if ("has" === t.name && 1 === t.args.length) return !1; if ("properties" === t.name || "geometry-type" === t.name || "id" === t.name) return !1; if (/^filter-/.test(t.name)) return !1 } var e = !0; return t.eachChild((function (t) { e && !xe(t) && (e = !1); })), e } function be(t) { if (t instanceof ve && "feature-state" === t.name) return !1; var e = !0; return t.eachChild((function (t) { e && !be(t) && (e = !1); })), e } function _e(t, e) { if (t instanceof ve && e.indexOf(t.name) >= 0) return !1; var r = !0; return t.eachChild((function (t) { r && !_e(t, e) && (r = !1); })), r } ge.parse = function (t, e) { if (2 !== t.length) return e.error("Expected one argument."); var r = t[1]; if ("object" != typeof r || Array.isArray(r)) return e.error("Collator options argument must be an object."); var n = e.parse(void 0 !== r["case-sensitive"] && r["case-sensitive"], 1, jt); if (!n) return null; var i = e.parse(void 0 !== r["diacritic-sensitive"] && r["diacritic-sensitive"], 1, jt); if (!i) return null; var a = null; return r.locale && !(a = e.parse(r.locale, 1, Ut)) ? null : new ge(n, i, a) }, ge.prototype.evaluate = function (t) { return new te(this.caseSensitive.evaluate(t), this.diacriticSensitive.evaluate(t), this.locale ? this.locale.evaluate(t) : null) }, ge.prototype.eachChild = function (t) { t(this.caseSensitive), t(this.diacriticSensitive), this.locale && t(this.locale); }, ge.prototype.possibleOutputs = function () { return [void 0] }, ge.prototype.serialize = function () { var t = {}; return t["case-sensitive"] = this.caseSensitive.serialize(), t["diacritic-sensitive"] = this.diacriticSensitive.serialize(), this.locale && (t.locale = this.locale.serialize()), ["collator", t] }; var we = function (t, e) { this.type = e.type, this.name = t, this.boundExpression = e; }; we.parse = function (t, e) { if (2 !== t.length || "string" != typeof t[1]) return e.error("'var' expression requires exactly one string literal argument."); var r = t[1]; return e.scope.has(r) ? new we(r, e.scope.get(r)) : e.error('Unknown variable "' + r + '". Make sure "' + r + '" has been bound in an enclosing "let" expression before using it.', 1) }, we.prototype.evaluate = function (t) { return this.boundExpression.evaluate(t) }, we.prototype.eachChild = function () { }, we.prototype.possibleOutputs = function () { return [void 0] }, we.prototype.serialize = function () { return ["var", this.name] }; var Ae = function (t, e, r, n, i) { void 0 === e && (e = []), void 0 === n && (n = new Ot), void 0 === i && (i = []), this.registry = t, this.path = e, this.key = e.map((function (t) { return "[" + t + "]" })).join(""), this.scope = n, this.errors = i, this.expectedType = r; }; function Se(t, e) { for (var r, n, i = t.length - 1, a = 0, o = i, s = 0; a <= o;)if (r = t[s = Math.floor((a + o) / 2)], n = t[s + 1], r <= e) { if (s === i || e < n) return s; a = s + 1; } else { if (!(r > e)) throw new ue("Input is not a number."); o = s - 1; } return 0 } Ae.prototype.parse = function (t, e, r, n, i) { return void 0 === i && (i = {}), e ? this.concat(e, r, n)._parse(t, i) : this._parse(t, i) }, Ae.prototype._parse = function (t, e) { function r(t, e, r) { return "assert" === r ? new pe(e, [t]) : "coerce" === r ? new ye(e, [t]) : t } if (null !== t && "string" != typeof t && "boolean" != typeof t && "number" != typeof t || (t = ["literal", t]), Array.isArray(t)) { if (0 === t.length) return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].'); var n = t[0]; if ("string" != typeof n) return this.error("Expression name must be a string, but found " + typeof n + ' instead. If you wanted a literal array, use ["literal", [...]].', 0), null; var i = this.registry[n]; if (i) { var a = i.parse(t, this); if (!a) return null; if (this.expectedType) { var o = this.expectedType, s = a.type; if ("string" !== o.kind && "number" !== o.kind && "boolean" !== o.kind && "object" !== o.kind && "array" !== o.kind || "value" !== s.kind) if ("color" !== o.kind && "formatted" !== o.kind && "resolvedImage" !== o.kind || "value" !== s.kind && "string" !== s.kind) { if (this.checkSubtype(o, s)) return null } else a = r(a, o, e.typeAnnotation || "coerce"); else a = r(a, o, e.typeAnnotation || "assert"); } if (!(a instanceof se) && "resolvedImage" !== a.type.kind && function t(e) { if (e instanceof we) return t(e.boundExpression); if (e instanceof ve && "error" === e.name) return !1; if (e instanceof ge) return !1; var r = e instanceof ye || e instanceof pe; var n = !0; e.eachChild((function (e) { n = r ? n && t(e) : n && e instanceof se; })); if (!n) return !1; return xe(e) && _e(e, ["zoom", "heatmap-density", "line-progress", "accumulated", "is-supported-script"]) }(a)) { var u = new me; try { a = new se(a.type, a.evaluate(u)); } catch (t) { return this.error(t.message), null } } return a } return this.error('Unknown expression "' + n + '". If you wanted a literal array, use ["literal", [...]].', 0) } return void 0 === t ? this.error("'undefined' value invalid. Use null instead.") : "object" == typeof t ? this.error('Bare objects invalid. Use ["literal", {...}] instead.') : this.error("Expected an array, but found " + typeof t + " instead.") }, Ae.prototype.concat = function (t, e, r) { var n = "number" == typeof t ? this.path.concat(t) : this.path, i = r ? this.scope.concat(r) : this.scope; return new Ae(this.registry, n, e || null, i, this.errors) }, Ae.prototype.error = function (t) { for (var e = [], r = arguments.length - 1; r-- > 0;)e[r] = arguments[r + 1]; var n = "" + this.key + e.map((function (t) { return "[" + t + "]" })).join(""); this.errors.push(new Lt(n, t)); }, Ae.prototype.checkSubtype = function (t, e) { var r = $t(t, e); return r && this.error(r), r }; var ke = function (t, e, r) { this.type = t, this.input = e, this.labels = [], this.outputs = []; for (var n = 0, i = r; n < i.length; n += 1) { var a = i[n], o = a[0], s = a[1]; this.labels.push(o), this.outputs.push(s); } }; function Ie(t, e, r) { return t * (1 - r) + e * r } ke.parse = function (t, e) { if (t.length - 1 < 4) return e.error("Expected at least 4 arguments, but found only " + (t.length - 1) + "."); if ((t.length - 1) % 2 != 0) return e.error("Expected an even number of arguments."); var r = e.parse(t[1], 1, Rt); if (!r) return null; var n = [], i = null; e.expectedType && "value" !== e.expectedType.kind && (i = e.expectedType); for (var a = 1; a < t.length; a += 2) { var o = 1 === a ? -1 / 0 : t[a], s = t[a + 1], u = a, l = a + 1; if ("number" != typeof o) return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', u); if (n.length && n[n.length - 1][0] >= o) return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.', u); var p = e.parse(s, l, i); if (!p) return null; i = i || p.type, n.push([o, p]); } return new ke(i, r, n) }, ke.prototype.evaluate = function (t) { var e = this.labels, r = this.outputs; if (1 === e.length) return r[0].evaluate(t); var n = this.input.evaluate(t); if (n <= e[0]) return r[0].evaluate(t); var i = e.length; return n >= e[i - 1] ? r[i - 1].evaluate(t) : r[Se(e, n)].evaluate(t) }, ke.prototype.eachChild = function (t) { t(this.input); for (var e = 0, r = this.outputs; e < r.length; e += 1) { t(r[e]); } }, ke.prototype.possibleOutputs = function () { var t; return (t = []).concat.apply(t, this.outputs.map((function (t) { return t.possibleOutputs() }))) }, ke.prototype.serialize = function () { for (var t = ["step", this.input.serialize()], e = 0; e < this.labels.length; e++)e > 0 && t.push(this.labels[e]), t.push(this.outputs[e].serialize()); return t }; var ze = Object.freeze({ __proto__: null, number: Ie, color: function (t, e, r) { return new Qt(Ie(t.r, e.r, r), Ie(t.g, e.g, r), Ie(t.b, e.b, r), Ie(t.a, e.a, r)) }, array: function (t, e, r) { return t.map((function (t, n) { return Ie(t, e[n], r) })) } }), Ce = .95047, Be = 1, Te = 1.08883, Pe = 4 / 29, Ee = 6 / 29, Me = 3 * Ee * Ee, Ve = Ee * Ee * Ee, Fe = Math.PI / 180, Le = 180 / Math.PI; function Oe(t) { return t > Ve ? Math.pow(t, 1 / 3) : t / Me + Pe } function De(t) { return t > Ee ? t * t * t : Me * (t - Pe) } function Re(t) { return 255 * (t <= .0031308 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - .055) } function Ue(t) { return (t /= 255) <= .04045 ? t / 12.92 : Math.pow((t + .055) / 1.055, 2.4) } function je(t) { var e = Ue(t.r), r = Ue(t.g), n = Ue(t.b), i = Oe((.4124564 * e + .3575761 * r + .1804375 * n) / Ce), a = Oe((.2126729 * e + .7151522 * r + .072175 * n) / Be); return { l: 116 * a - 16, a: 500 * (i - a), b: 200 * (a - Oe((.0193339 * e + .119192 * r + .9503041 * n) / Te)), alpha: t.a } } function qe(t) { var e = (t.l + 16) / 116, r = isNaN(t.a) ? e : e + t.a / 500, n = isNaN(t.b) ? e : e - t.b / 200; return e = Be * De(e), r = Ce * De(r), n = Te * De(n), new Qt(Re(3.2404542 * r - 1.5371385 * e - .4985314 * n), Re(-.969266 * r + 1.8760108 * e + .041556 * n), Re(.0556434 * r - .2040259 * e + 1.0572252 * n), t.alpha) } function Ne(t, e, r) { var n = e - t; return t + r * (n > 180 || n < -180 ? n - 360 * Math.round(n / 360) : n) } var Ke = { forward: je, reverse: qe, interpolate: function (t, e, r) { return { l: Ie(t.l, e.l, r), a: Ie(t.a, e.a, r), b: Ie(t.b, e.b, r), alpha: Ie(t.alpha, e.alpha, r) } } }, Xe = { forward: function (t) { var e = je(t), r = e.l, n = e.a, i = e.b, a = Math.atan2(i, n) * Le; return { h: a < 0 ? a + 360 : a, c: Math.sqrt(n * n + i * i), l: r, alpha: t.a } }, reverse: function (t) { var e = t.h * Fe, r = t.c; return qe({ l: t.l, a: Math.cos(e) * r, b: Math.sin(e) * r, alpha: t.alpha }) }, interpolate: function (t, e, r) { return { h: Ne(t.h, e.h, r), c: Ie(t.c, e.c, r), l: Ie(t.l, e.l, r), alpha: Ie(t.alpha, e.alpha, r) } } }, Ze = Object.freeze({ __proto__: null, lab: Ke, hcl: Xe }), Ge = function (t, e, r, n, i) { this.type = t, this.operator = e, this.interpolation = r, this.input = n, this.labels = [], this.outputs = []; for (var a = 0, o = i; a < o.length; a += 1) { var s = o[a], u = s[0], l = s[1]; this.labels.push(u), this.outputs.push(l); } }; function Je(t, e, r, n) { var i = n - r, a = t - r; return 0 === i ? 0 : 1 === e ? a / i : (Math.pow(e, a) - 1) / (Math.pow(e, i) - 1) } Ge.interpolationFactor = function (t, e, n, i) { var a = 0; if ("exponential" === t.name) a = Je(e, t.base, n, i); else if ("linear" === t.name) a = Je(e, 1, n, i); else if ("cubic-bezier" === t.name) { var o = t.controlPoints; a = new r(o[0], o[1], o[2], o[3]).solve(Je(e, 1, n, i)); } return a }, Ge.parse = function (t, e) { var r = t[0], n = t[1], i = t[2], a = t.slice(3); if (!Array.isArray(n) || 0 === n.length) return e.error("Expected an interpolation type expression.", 1); if ("linear" === n[0]) n = { name: "linear" }; else if ("exponential" === n[0]) { var o = n[1]; if ("number" != typeof o) return e.error("Exponential interpolation requires a numeric base.", 1, 1); n = { name: "exponential", base: o }; } else { if ("cubic-bezier" !== n[0]) return e.error("Unknown interpolation type " + String(n[0]), 1, 0); var s = n.slice(1); if (4 !== s.length || s.some((function (t) { return "number" != typeof t || t < 0 || t > 1 }))) return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.", 1); n = { name: "cubic-bezier", controlPoints: s }; } if (t.length - 1 < 4) return e.error("Expected at least 4 arguments, but found only " + (t.length - 1) + "."); if ((t.length - 1) % 2 != 0) return e.error("Expected an even number of arguments."); if (!(i = e.parse(i, 2, Rt))) return null; var u = [], l = null; "interpolate-hcl" === r || "interpolate-lab" === r ? l = qt : e.expectedType && "value" !== e.expectedType.kind && (l = e.expectedType); for (var p = 0; p < a.length; p += 2) { var c = a[p], h = a[p + 1], f = p + 3, y = p + 4; if ("number" != typeof c) return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.', f); if (u.length && u[u.length - 1][0] >= c) return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.', f); var d = e.parse(h, y, l); if (!d) return null; l = l || d.type, u.push([c, d]); } return "number" === l.kind || "color" === l.kind || "array" === l.kind && "number" === l.itemType.kind && "number" == typeof l.N ? new Ge(l, r, n, i, u) : e.error("Type " + Ht(l) + " is not interpolatable.") }, Ge.prototype.evaluate = function (t) { var e = this.labels, r = this.outputs; if (1 === e.length) return r[0].evaluate(t); var n = this.input.evaluate(t); if (n <= e[0]) return r[0].evaluate(t); var i = e.length; if (n >= e[i - 1]) return r[i - 1].evaluate(t); var a = Se(e, n), o = e[a], s = e[a + 1], u = Ge.interpolationFactor(this.interpolation, n, o, s), l = r[a].evaluate(t), p = r[a + 1].evaluate(t); return "interpolate" === this.operator ? ze[this.type.kind.toLowerCase()](l, p, u) : "interpolate-hcl" === this.operator ? Xe.reverse(Xe.interpolate(Xe.forward(l), Xe.forward(p), u)) : Ke.reverse(Ke.interpolate(Ke.forward(l), Ke.forward(p), u)) }, Ge.prototype.eachChild = function (t) { t(this.input); for (var e = 0, r = this.outputs; e < r.length; e += 1) { t(r[e]); } }, Ge.prototype.possibleOutputs = function () { var t; return (t = []).concat.apply(t, this.outputs.map((function (t) { return t.possibleOutputs() }))) }, Ge.prototype.serialize = function () { var t; t = "linear" === this.interpolation.name ? ["linear"] : "exponential" === this.interpolation.name ? 1 === this.interpolation.base ? ["linear"] : ["exponential", this.interpolation.base] : ["cubic-bezier"].concat(this.interpolation.controlPoints); for (var e = [this.operator, t, this.input.serialize()], r = 0; r < this.labels.length; r++)e.push(this.labels[r], this.outputs[r].serialize()); return e }; var He = function (t, e) { this.type = t, this.args = e; }; He.parse = function (t, e) { if (t.length < 2) return e.error("Expectected at least one argument."); var r = null, n = e.expectedType; n && "value" !== n.kind && (r = n); for (var i = [], a = 0, o = t.slice(1); a < o.length; a += 1) { var s = o[a], u = e.parse(s, 1 + i.length, r, void 0, { typeAnnotation: "omit" }); if (!u) return null; r = r || u.type, i.push(u); } var l = n && i.some((function (t) { return $t(n, t.type) })); return new He(l ? Kt : r, i) }, He.prototype.evaluate = function (t) { for (var e, r = null, n = 0, i = 0, a = this.args; i < a.length; i += 1) { if (n++ , (r = a[i].evaluate(t)) && r instanceof ne && !r.available && (e || (e = r.name), r = null, n === this.args.length && (r = e)), null !== r) break } return r }, He.prototype.eachChild = function (t) { this.args.forEach(t); }, He.prototype.possibleOutputs = function () { var t; return (t = []).concat.apply(t, this.args.map((function (t) { return t.possibleOutputs() }))) }, He.prototype.serialize = function () { var t = ["coalesce"]; return this.eachChild((function (e) { t.push(e.serialize()); })), t }; var Ye = function (t, e) { this.type = e.type, this.bindings = [].concat(t), this.result = e; }; Ye.prototype.evaluate = function (t) { return this.result.evaluate(t) }, Ye.prototype.eachChild = function (t) { for (var e = 0, r = this.bindings; e < r.length; e += 1) { t(r[e][1]); } t(this.result); }, Ye.parse = function (t, e) { if (t.length < 4) return e.error("Expected at least 3 arguments, but found " + (t.length - 1) + " instead."); for (var r = [], n = 1; n < t.length - 1; n += 2) { var i = t[n]; if ("string" != typeof i) return e.error("Expected string, but found " + typeof i + " instead.", n); if (/[^a-zA-Z0-9_]/.test(i)) return e.error("Variable names must contain only alphanumeric characters or '_'.", n); var a = e.parse(t[n + 1], n + 1); if (!a) return null; r.push([i, a]); } var o = e.parse(t[t.length - 1], t.length - 1, e.expectedType, r); return o ? new Ye(r, o) : null }, Ye.prototype.possibleOutputs = function () { return this.result.possibleOutputs() }, Ye.prototype.serialize = function () { for (var t = ["let"], e = 0, r = this.bindings; e < r.length; e += 1) { var n = r[e], i = n[0], a = n[1]; t.push(i, a.serialize()); } return t.push(this.result.serialize()), t }; var $e = function (t, e, r) { this.type = t, this.index = e, this.input = r; }; $e.parse = function (t, e) { if (3 !== t.length) return e.error("Expected 2 arguments, but found " + (t.length - 1) + " instead."); var r = e.parse(t[1], 1, Rt), n = e.parse(t[2], 2, Jt(e.expectedType || Kt)); if (!r || !n) return null; var i = n.type; return new $e(i.itemType, r, n) }, $e.prototype.evaluate = function (t) { var e = this.index.evaluate(t), r = this.input.evaluate(t); if (e < 0) throw new ue("Array index out of bounds: " + e + " < 0."); if (e >= r.length) throw new ue("Array index out of bounds: " + e + " > " + (r.length - 1) + "."); if (e !== Math.floor(e)) throw new ue("Array index must be an integer, but found " + e + " instead."); return r[e] }, $e.prototype.eachChild = function (t) { t(this.index), t(this.input); }, $e.prototype.possibleOutputs = function () { return [void 0] }, $e.prototype.serialize = function () { return ["at", this.index.serialize(), this.input.serialize()] }; var We = function (t, e) { this.type = jt, this.needle = t, this.haystack = e; }; We.parse = function (t, e) { if (3 !== t.length) return e.error("Expected 2 arguments, but found " + (t.length - 1) + " instead."); var r, n = e.parse(t[1], 1, Kt), i = e.parse(t[2], 2, Kt); return n && i ? "boolean" !== (r = n.type).kind && "string" !== r.kind && "number" !== r.kind && "null" !== r.kind && "value" !== r.kind ? e.error("Expected first argument to be of type boolean, string, number or null, but found " + Ht(n.type) + " instead") : new We(n, i) : null }, We.prototype.evaluate = function (t) { var e = this.needle.evaluate(t), r = this.haystack.evaluate(t); if (!e || !r) return !1; if (!function (t) { return "boolean" == typeof t || "string" == typeof t || "number" == typeof t }(e)) throw new ue("Expected first argument to be of type boolean, string or number, but found " + Ht(ae(e)) + " instead."); if (!function (t) { return Array.isArray(t) || "string" == typeof t }(r)) throw new ue("Expected second argument to be of type array or string, but found " + Ht(ae(r)) + " instead."); return r.indexOf(e) >= 0 }, We.prototype.eachChild = function (t) { t(this.needle), t(this.haystack); }, We.prototype.possibleOutputs = function () { return [!0, !1] }, We.prototype.serialize = function () { return ["in", this.needle.serialize(), this.haystack.serialize()] }; var Qe = function (t, e, r, n, i, a) { this.inputType = t, this.type = e, this.input = r, this.cases = n, this.outputs = i, this.otherwise = a; }; Qe.parse = function (t, e) { if (t.length < 5) return e.error("Expected at least 4 arguments, but found only " + (t.length - 1) + "."); if (t.length % 2 != 1) return e.error("Expected an even number of arguments."); var r, n; e.expectedType && "value" !== e.expectedType.kind && (n = e.expectedType); for (var i = {}, a = [], o = 2; o < t.length - 1; o += 2) { var s = t[o], u = t[o + 1]; Array.isArray(s) || (s = [s]); var l = e.concat(o); if (0 === s.length) return l.error("Expected at least one branch label."); for (var p = 0, c = s; p < c.length; p += 1) { var h = c[p]; if ("number" != typeof h && "string" != typeof h) return l.error("Branch labels must be numbers or strings."); if ("number" == typeof h && Math.abs(h) > Number.MAX_SAFE_INTEGER) return l.error("Branch labels must be integers no larger than " + Number.MAX_SAFE_INTEGER + "."); if ("number" == typeof h && Math.floor(h) !== h) return l.error("Numeric branch labels must be integer values."); if (r) { if (l.checkSubtype(r, ae(h))) return null } else r = ae(h); if (void 0 !== i[String(h)]) return l.error("Branch labels must be unique."); i[String(h)] = a.length; } var f = e.parse(u, o, n); if (!f) return null; n = n || f.type, a.push(f); } var y = e.parse(t[1], 1, Kt); if (!y) return null; var d = e.parse(t[t.length - 1], t.length - 1, n); return d ? "value" !== y.type.kind && e.concat(1).checkSubtype(r, y.type) ? null : new Qe(r, n, y, i, a, d) : null }, Qe.prototype.evaluate = function (t) { var e = this.input.evaluate(t); return (ae(e) === this.inputType && this.outputs[this.cases[e]] || this.otherwise).evaluate(t) }, Qe.prototype.eachChild = function (t) { t(this.input), this.outputs.forEach(t), t(this.otherwise); }, Qe.prototype.possibleOutputs = function () { var t; return (t = []).concat.apply(t, this.outputs.map((function (t) { return t.possibleOutputs() }))).concat(this.otherwise.possibleOutputs()) }, Qe.prototype.serialize = function () { for (var t = this, e = ["match", this.input.serialize()], r = [], n = {}, i = 0, a = Object.keys(this.cases).sort(); i < a.length; i += 1) { var o = a[i]; void 0 === (c = n[this.cases[o]]) ? (n[this.cases[o]] = r.length, r.push([this.cases[o], [o]])) : r[c][1].push(o); } for (var s = function (e) { return "number" === t.inputType.kind ? Number(e) : e }, u = 0, l = r; u < l.length; u += 1) { var p = l[u], c = p[0], h = p[1]; 1 === h.length ? e.push(s(h[0])) : e.push(h.map(s)), e.push(this.outputs[outputIndex$1].serialize()); } return e.push(this.otherwise.serialize()), e }; var tr = function (t, e, r) { this.type = t, this.branches = e, this.otherwise = r; }; function er(t, e) { return "==" === t || "!=" === t ? "boolean" === e.kind || "string" === e.kind || "number" === e.kind || "null" === e.kind || "value" === e.kind : "string" === e.kind || "number" === e.kind || "value" === e.kind } function rr(t, e, r, n) { return 0 === n.compare(e, r) } function nr(t, e, r) { var n = "==" !== t && "!=" !== t; return function () { function i(t, e, r) { this.type = jt, this.lhs = t, this.rhs = e, this.collator = r, this.hasUntypedArgument = "value" === t.type.kind || "value" === e.type.kind; } return i.parse = function (t, e) { if (3 !== t.length && 4 !== t.length) return e.error("Expected two or three arguments."); var r = t[0], a = e.parse(t[1], 1, Kt); if (!a) return null; if (!er(r, a.type)) return e.concat(1).error('"' + r + "\" comparisons are not supported for type '" + Ht(a.type) + "'."); var o = e.parse(t[2], 2, Kt); if (!o) return null; if (!er(r, o.type)) return e.concat(2).error('"' + r + "\" comparisons are not supported for type '" + Ht(o.type) + "'."); if (a.type.kind !== o.type.kind && "value" !== a.type.kind && "value" !== o.type.kind) return e.error("Cannot compare types '" + Ht(a.type) + "' and '" + Ht(o.type) + "'."); n && ("value" === a.type.kind && "value" !== o.type.kind ? a = new pe(o.type, [a]) : "value" !== a.type.kind && "value" === o.type.kind && (o = new pe(a.type, [o]))); var s = null; if (4 === t.length) { if ("string" !== a.type.kind && "string" !== o.type.kind && "value" !== a.type.kind && "value" !== o.type.kind) return e.error("Cannot use collator to compare non-string types."); if (!(s = e.parse(t[3], 3, Xt))) return null } return new i(a, o, s) }, i.prototype.evaluate = function (i) { var a = this.lhs.evaluate(i), o = this.rhs.evaluate(i); if (n && this.hasUntypedArgument) { var s = ae(a), u = ae(o); if (s.kind !== u.kind || "string" !== s.kind && "number" !== s.kind) throw new ue('Expected arguments for "' + t + '" to be (string, string) or (number, number), but found (' + s.kind + ", " + u.kind + ") instead.") } if (this.collator && !n && this.hasUntypedArgument) { var l = ae(a), p = ae(o); if ("string" !== l.kind || "string" !== p.kind) return e(i, a, o) } return this.collator ? r(i, a, o, this.collator.evaluate(i)) : e(i, a, o) }, i.prototype.eachChild = function (t) { t(this.lhs), t(this.rhs), this.collator && t(this.collator); }, i.prototype.possibleOutputs = function () { return [!0, !1] }, i.prototype.serialize = function () { var e = [t]; return this.eachChild((function (t) { e.push(t.serialize()); })), e }, i }() } tr.parse = function (t, e) { if (t.length < 4) return e.error("Expected at least 3 arguments, but found only " + (t.length - 1) + "."); if (t.length % 2 != 0) return e.error("Expected an odd number of arguments."); var r; e.expectedType && "value" !== e.expectedType.kind && (r = e.expectedType); for (var n = [], i = 1; i < t.length - 1; i += 2) { var a = e.parse(t[i], i, jt); if (!a) return null; var o = e.parse(t[i + 1], i + 1, r); if (!o) return null; n.push([a, o]), r = r || o.type; } var s = e.parse(t[t.length - 1], t.length - 1, r); return s ? new tr(r, n, s) : null }, tr.prototype.evaluate = function (t) { for (var e = 0, r = this.branches; e < r.length; e += 1) { var n = r[e], i = n[0], a = n[1]; if (i.evaluate(t)) return a.evaluate(t) } return this.otherwise.evaluate(t) }, tr.prototype.eachChild = function (t) { for (var e = 0, r = this.branches; e < r.length; e += 1) { var n = r[e], i = n[0], a = n[1]; t(i), t(a); } t(this.otherwise); }, tr.prototype.possibleOutputs = function () { var t; return (t = []).concat.apply(t, this.branches.map((function (t) { t[0]; return t[1].possibleOutputs() }))).concat(this.otherwise.possibleOutputs()) }, tr.prototype.serialize = function () { var t = ["case"]; return this.eachChild((function (e) { t.push(e.serialize()); })), t }; var ir = nr("==", (function (t, e, r) { return e === r }), rr), ar = nr("!=", (function (t, e, r) { return e !== r }), (function (t, e, r, n) { return !rr(0, e, r, n) })), or = nr("<", (function (t, e, r) { return e < r }), (function (t, e, r, n) { return n.compare(e, r) < 0 })), sr = nr(">", (function (t, e, r) { return e > r }), (function (t, e, r, n) { return n.compare(e, r) > 0 })), ur = nr("<=", (function (t, e, r) { return e <= r }), (function (t, e, r, n) { return n.compare(e, r) <= 0 })), lr = nr(">=", (function (t, e, r) { return e >= r }), (function (t, e, r, n) { return n.compare(e, r) >= 0 })), pr = function (t, e, r, n, i) { this.type = Ut, this.number = t, this.locale = e, this.currency = r, this.minFractionDigits = n, this.maxFractionDigits = i; }; pr.parse = function (t, e) { if (3 !== t.length) return e.error("Expected two arguments."); var r = e.parse(t[1], 1, Rt); if (!r) return null; var n = t[2]; if ("object" != typeof n || Array.isArray(n)) return e.error("NumberFormat options argument must be an object."); var i = null; if (n.locale && !(i = e.parse(n.locale, 1, Ut))) return null; var a = null; if (n.currency && !(a = e.parse(n.currency, 1, Ut))) return null; var o = null; if (n["min-fraction-digits"] && !(o = e.parse(n["min-fraction-digits"], 1, Rt))) return null; var s = null; return n["max-fraction-digits"] && !(s = e.parse(n["max-fraction-digits"], 1, Rt)) ? null : new pr(r, i, a, o, s) }, pr.prototype.evaluate = function (t) { return new Intl.NumberFormat(this.locale ? this.locale.evaluate(t) : [], { style: this.currency ? "currency" : "decimal", currency: this.currency ? this.currency.evaluate(t) : void 0, minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(t) : void 0, maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(t) : void 0 }).format(this.number.evaluate(t)) }, pr.prototype.eachChild = function (t) { t(this.number), this.locale && t(this.locale), this.currency && t(this.currency), this.minFractionDigits && t(this.minFractionDigits), this.maxFractionDigits && t(this.maxFractionDigits); }, pr.prototype.possibleOutputs = function () { return [void 0] }, pr.prototype.serialize = function () { var t = {}; return this.locale && (t.locale = this.locale.serialize()), this.currency && (t.currency = this.currency.serialize()), this.minFractionDigits && (t["min-fraction-digits"] = this.minFractionDigits.serialize()), this.maxFractionDigits && (t["max-fraction-digits"] = this.maxFractionDigits.serialize()), ["number-format", this.number.serialize(), t] }; var cr = function (t) { this.type = Rt, this.input = t; }; cr.parse = function (t, e) { if (2 !== t.length) return e.error("Expected 1 argument, but found " + (t.length - 1) + " instead."); var r = e.parse(t[1], 1); return r ? "array" !== r.type.kind && "string" !== r.type.kind && "value" !== r.type.kind ? e.error("Expected argument of type string or array, but found " + Ht(r.type) + " instead.") : new cr(r) : null }, cr.prototype.evaluate = function (t) { var e = this.input.evaluate(t); if ("string" == typeof e) return e.length; if (Array.isArray(e)) return e.length; throw new ue("Expected value to be of type string or array, but found " + Ht(ae(e)) + " instead.") }, cr.prototype.eachChild = function (t) { t(this.input); }, cr.prototype.possibleOutputs = function () { return [void 0] }, cr.prototype.serialize = function () { var t = ["length"]; return this.eachChild((function (e) { t.push(e.serialize()); })), t }; var hr = { "==": ir, "!=": ar, ">": sr, "<": or, ">=": lr, "<=": ur, array: pe, at: $e, boolean: pe, case: tr, coalesce: He, collator: ge, format: ce, image: he, in: We, interpolate: Ge, "interpolate-hcl": Ge, "interpolate-lab": Ge, length: cr, let: Ye, literal: se, match: Qe, number: pe, "number-format": pr, object: pe, step: ke, string: pe, "to-boolean": ye, "to-color": ye, "to-number": ye, "to-string": ye, var: we }; function fr(t, e) { var r = e[0], n = e[1], i = e[2], a = e[3]; r = r.evaluate(t), n = n.evaluate(t), i = i.evaluate(t); var o = a ? a.evaluate(t) : 1, s = ie(r, n, i, o); if (s) throw new ue(s); return new Qt(r / 255 * o, n / 255 * o, i / 255 * o, o) } function yr(t, e) { return t in e } function dr(t, e) { var r = e[t]; return void 0 === r ? null : r } function mr(t) { return { type: t } } function vr(t) { return { result: "success", value: t } } function gr(t) { return { result: "error", value: t } } function xr(t) { return "data-driven" === t["property-type"] || "cross-faded-data-driven" === t["property-type"] } function br(t) { return !!t.expression && t.expression.parameters.indexOf("zoom") > -1 } function _r(t) { return !!t.expression && t.expression.interpolated } function wr(t) { return t instanceof Number ? "number" : t instanceof String ? "string" : t instanceof Boolean ? "boolean" : Array.isArray(t) ? "array" : null === t ? "null" : typeof t } function Ar(t) { return "object" == typeof t && null !== t && !Array.isArray(t) } function Sr(t) { return t } function kr(t, e, r) { return void 0 !== t ? t : void 0 !== e ? e : void 0 !== r ? r : void 0 } function Ir(t, e, r, n, i) { return kr(typeof r === i ? n[r] : void 0, t.default, e.default) } function zr(t, e, r) { if ("number" !== wr(r)) return kr(t.default, e.default); var n = t.stops.length; if (1 === n) return t.stops[0][1]; if (r <= t.stops[0][0]) return t.stops[0][1]; if (r >= t.stops[n - 1][0]) return t.stops[n - 1][1]; var i = Se(t.stops.map((function (t) { return t[0] })), r); return t.stops[i][1] } function Cr(t, e, r) { var n = void 0 !== t.base ? t.base : 1; if ("number" !== wr(r)) return kr(t.default, e.default); var i = t.stops.length; if (1 === i) return t.stops[0][1]; if (r <= t.stops[0][0]) return t.stops[0][1]; if (r >= t.stops[i - 1][0]) return t.stops[i - 1][1]; var a = Se(t.stops.map((function (t) { return t[0] })), r), o = function (t, e, r, n) { var i = n - r, a = t - r; return 0 === i ? 0 : 1 === e ? a / i : (Math.pow(e, a) - 1) / (Math.pow(e, i) - 1) }(r, n, t.stops[a][0], t.stops[a + 1][0]), s = t.stops[a][1], u = t.stops[a + 1][1], l = ze[e.type] || Sr; if (t.colorSpace && "rgb" !== t.colorSpace) { var p = Ze[t.colorSpace]; l = function (t, e) { return p.reverse(p.interpolate(p.forward(t), p.forward(e), o)) }; } return "function" == typeof s.evaluate ? { evaluate: function () { for (var t = [], e = arguments.length; e--;)t[e] = arguments[e]; var r = s.evaluate.apply(void 0, t), n = u.evaluate.apply(void 0, t); if (void 0 !== r && void 0 !== n) return l(r, n, o) } } : l(s, u, o) } function Br(t, e, r) { return "color" === e.type ? r = Qt.parse(r) : "formatted" === e.type ? r = re.fromString(r.toString()) : "resolvedImage" === e.type ? r = ne.fromString(r.toString()) : wr(r) === e.type || "enum" === e.type && e.values[r] || (r = void 0), kr(r, t.default, e.default) } ve.register(hr, { error: [{ kind: "error" }, [Ut], function (t, e) { var r = e[0]; throw new ue(r.evaluate(t)) }], typeof: [Ut, [Kt], function (t, e) { return Ht(ae(e[0].evaluate(t))) }], "to-rgba": [Jt(Rt, 4), [qt], function (t, e) { return e[0].evaluate(t).toArray() }], rgb: [qt, [Rt, Rt, Rt], fr], rgba: [qt, [Rt, Rt, Rt, Rt], fr], has: { type: jt, overloads: [[[Ut], function (t, e) { return yr(e[0].evaluate(t), t.properties()) }], [[Ut, Nt], function (t, e) { var r = e[0], n = e[1]; return yr(r.evaluate(t), n.evaluate(t)) }]] }, get: { type: Kt, overloads: [[[Ut], function (t, e) { return dr(e[0].evaluate(t), t.properties()) }], [[Ut, Nt], function (t, e) { var r = e[0], n = e[1]; return dr(r.evaluate(t), n.evaluate(t)) }]] }, "feature-state": [Kt, [Ut], function (t, e) { return dr(e[0].evaluate(t), t.featureState || {}) }], properties: [Nt, [], function (t) { return t.properties() }], "geometry-type": [Ut, [], function (t) { return t.geometryType() }], id: [Kt, [], function (t) { return t.id() }], zoom: [Rt, [], function (t) { return t.globals.zoom }], "heatmap-density": [Rt, [], function (t) { return t.globals.heatmapDensity || 0 }], "line-progress": [Rt, [], function (t) { return t.globals.lineProgress || 0 }], accumulated: [Kt, [], function (t) { return void 0 === t.globals.accumulated ? null : t.globals.accumulated }], "+": [Rt, mr(Rt), function (t, e) { for (var r = 0, n = 0, i = e; n < i.length; n += 1) { r += i[n].evaluate(t); } return r }], "*": [Rt, mr(Rt), function (t, e) { for (var r = 1, n = 0, i = e; n < i.length; n += 1) { r *= i[n].evaluate(t); } return r }], "-": { type: Rt, overloads: [[[Rt, Rt], function (t, e) { var r = e[0], n = e[1]; return r.evaluate(t) - n.evaluate(t) }], [[Rt], function (t, e) { return -e[0].evaluate(t) }]] }, "/": [Rt, [Rt, Rt], function (t, e) { var r = e[0], n = e[1]; return r.evaluate(t) / n.evaluate(t) }], "%": [Rt, [Rt, Rt], function (t, e) { var r = e[0], n = e[1]; return r.evaluate(t) % n.evaluate(t) }], ln2: [Rt, [], function () { return Math.LN2 }], pi: [Rt, [], function () { return Math.PI }], e: [Rt, [], function () { return Math.E }], "^": [Rt, [Rt, Rt], function (t, e) { var r = e[0], n = e[1]; return Math.pow(r.evaluate(t), n.evaluate(t)) }], sqrt: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.sqrt(r.evaluate(t)) }], log10: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.log(r.evaluate(t)) / Math.LN10 }], ln: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.log(r.evaluate(t)) }], log2: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.log(r.evaluate(t)) / Math.LN2 }], sin: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.sin(r.evaluate(t)) }], cos: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.cos(r.evaluate(t)) }], tan: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.tan(r.evaluate(t)) }], asin: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.asin(r.evaluate(t)) }], acos: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.acos(r.evaluate(t)) }], atan: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.atan(r.evaluate(t)) }], min: [Rt, mr(Rt), function (t, e) { return Math.min.apply(Math, e.map((function (e) { return e.evaluate(t) }))) }], max: [Rt, mr(Rt), function (t, e) { return Math.max.apply(Math, e.map((function (e) { return e.evaluate(t) }))) }], abs: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.abs(r.evaluate(t)) }], round: [Rt, [Rt], function (t, e) { var r = e[0].evaluate(t); return r < 0 ? -Math.round(-r) : Math.round(r) }], floor: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.floor(r.evaluate(t)) }], ceil: [Rt, [Rt], function (t, e) { var r = e[0]; return Math.ceil(r.evaluate(t)) }], "filter-==": [jt, [Ut, Kt], function (t, e) { var r = e[0], n = e[1]; return t.properties()[r.value] === n.value }], "filter-id-==": [jt, [Kt], function (t, e) { var r = e[0]; return t.id() === r.value }], "filter-type-==": [jt, [Ut], function (t, e) { var r = e[0]; return t.geometryType() === r.value }], "filter-<": [jt, [Ut, Kt], function (t, e) { var r = e[0], n = e[1], i = t.properties()[r.value], a = n.value; return typeof i == typeof a && i < a }], "filter-id-<": [jt, [Kt], function (t, e) { var r = e[0], n = t.id(), i = r.value; return typeof n == typeof i && n < i }], "filter->": [jt, [Ut, Kt], function (t, e) { var r = e[0], n = e[1], i = t.properties()[r.value], a = n.value; return typeof i == typeof a && i > a }], "filter-id->": [jt, [Kt], function (t, e) { var r = e[0], n = t.id(), i = r.value; return typeof n == typeof i && n > i }], "filter-<=": [jt, [Ut, Kt], function (t, e) { var r = e[0], n = e[1], i = t.properties()[r.value], a = n.value; return typeof i == typeof a && i <= a }], "filter-id-<=": [jt, [Kt], function (t, e) { var r = e[0], n = t.id(), i = r.value; return typeof n == typeof i && n <= i }], "filter->=": [jt, [Ut, Kt], function (t, e) { var r = e[0], n = e[1], i = t.properties()[r.value], a = n.value; return typeof i == typeof a && i >= a }], "filter-id->=": [jt, [Kt], function (t, e) { var r = e[0], n = t.id(), i = r.value; return typeof n == typeof i && n >= i }], "filter-has": [jt, [Kt], function (t, e) { return e[0].value in t.properties() }], "filter-has-id": [jt, [], function (t) { return null !== t.id() }], "filter-type-in": [jt, [Jt(Ut)], function (t, e) { return e[0].value.indexOf(t.geometryType()) >= 0 }], "filter-id-in": [jt, [Jt(Kt)], function (t, e) { return e[0].value.indexOf(t.id()) >= 0 }], "filter-in-small": [jt, [Ut, Jt(Kt)], function (t, e) { var r = e[0]; return e[1].value.indexOf(t.properties()[r.value]) >= 0 }], "filter-in-large": [jt, [Ut, Jt(Kt)], function (t, e) { var r = e[0], n = e[1]; return function (t, e, r, n) { for (; r <= n;) { var i = r + n >> 1; if (e[i] === t) return !0; e[i] > t ? n = i - 1 : r = i + 1; } return !1 }(t.properties()[r.value], n.value, 0, n.value.length - 1) }], all: { type: jt, overloads: [[[jt, jt], function (t, e) { var r = e[0], n = e[1]; return r.evaluate(t) && n.evaluate(t) }], [mr(jt), function (t, e) { for (var r = 0, n = e; r < n.length; r += 1) { if (!n[r].evaluate(t)) return !1 } return !0 }]] }, any: { type: jt, overloads: [[[jt, jt], function (t, e) { var r = e[0], n = e[1]; return r.evaluate(t) || n.evaluate(t) }], [mr(jt), function (t, e) { for (var r = 0, n = e; r < n.length; r += 1) { if (n[r].evaluate(t)) return !0 } return !1 }]] }, "!": [jt, [jt], function (t, e) { return !e[0].evaluate(t) }], "is-supported-script": [jt, [Ut], function (t, e) { var r = e[0], n = t.globals && t.globals.isSupportedScript; return !n || n(r.evaluate(t)) }], upcase: [Ut, [Ut], function (t, e) { return e[0].evaluate(t).toUpperCase() }], downcase: [Ut, [Ut], function (t, e) { return e[0].evaluate(t).toLowerCase() }], concat: [Ut, mr(Kt), function (t, e) { return e.map((function (e) { return oe(e.evaluate(t)) })).join("") }], "resolved-locale": [Ut, [Xt], function (t, e) { return e[0].evaluate(t).resolvedLocale() }] }); var Tr = function (t, e) { this.expression = t, this._warningHistory = {}, this._evaluator = new me, this._defaultValue = e ? function (t) { return "color" === t.type && Ar(t.default) ? new Qt(0, 0, 0, 0) : "color" === t.type ? Qt.parse(t.default) || null : void 0 === t.default ? null : t.default }(e) : null, this._enumValues = e && "enum" === e.type ? e.values : null; }; function Pr(t) { return Array.isArray(t) && t.length > 0 && "string" == typeof t[0] && t[0] in hr } function Er(t, e) { var r = new Ae(hr, [], e ? function (t) { var e = { color: qt, string: Ut, number: Rt, enum: Ut, boolean: jt, formatted: Zt, resolvedImage: Gt }; if ("array" === t.type) return Jt(e[t.value] || Kt, t.length); return e[t.type] }(e) : void 0), n = r.parse(t, void 0, void 0, void 0, e && "string" === e.type ? { typeAnnotation: "coerce" } : void 0); return n ? vr(new Tr(n, e)) : gr(r.errors) } Tr.prototype.evaluateWithoutErrorHandling = function (t, e, r, n, i) { return this._evaluator.globals = t, this._evaluator.feature = e, this._evaluator.featureState = r, this._evaluator.availableImages = n || null, this._evaluator.formattedSection = i, this.expression.evaluate(this._evaluator) }, Tr.prototype.evaluate = function (t, e, r, n, i) { this._evaluator.globals = t, this._evaluator.feature = e || null, this._evaluator.featureState = r || null, this._evaluator.availableImages = n || null, this._evaluator.formattedSection = i || null; try { var a = this.expression.evaluate(this._evaluator); if (null == a || "number" == typeof a && a != a) return this._defaultValue; if (this._enumValues && !(a in this._enumValues)) throw new ue("Expected value to be one of " + Object.keys(this._enumValues).map((function (t) { return JSON.stringify(t) })).join(", ") + ", but found " + JSON.stringify(a) + " instead."); return a } catch (t) { return this._warningHistory[t.message] || (this._warningHistory[t.message] = !0, "undefined" != typeof console && console.warn(t.message)), this._defaultValue } }; var Mr = function (t, e) { this.kind = t, this._styleExpression = e, this.isStateDependent = "constant" !== t && !be(e.expression); }; Mr.prototype.evaluateWithoutErrorHandling = function (t, e, r, n, i) { return this._styleExpression.evaluateWithoutErrorHandling(t, e, r, n, i) }, Mr.prototype.evaluate = function (t, e, r, n, i) { return this._styleExpression.evaluate(t, e, r, n, i) }; var Vr = function (t, e, r, n) { this.kind = t, this.zoomStops = r, this._styleExpression = e, this.isStateDependent = "camera" !== t && !be(e.expression), this.interpolationType = n; }; function Fr(t, e) { if ("error" === (t = Er(t, e)).result) return t; var r = t.value.expression, n = xe(r); if (!n && !xr(e)) return gr([new Lt("", "data expressions not supported")]); var i = _e(r, ["zoom"]); if (!i && !br(e)) return gr([new Lt("", "zoom expressions not supported")]); var a = function t(e) { var r = null; if (e instanceof Ye) r = t(e.result); else if (e instanceof He) for (var n = 0, i = e.args; n < i.length; n += 1) { var a = i[n]; if (r = t(a)) break } else (e instanceof ke || e instanceof Ge) && e.input instanceof ve && "zoom" === e.input.name && (r = e); if (r instanceof Lt) return r; e.eachChild((function (e) { var n = t(e); n instanceof Lt ? r = n : !r && n ? r = new Lt("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.') : r && n && r !== n && (r = new Lt("", 'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.')); })); return r }(r); if (!a && !i) return gr([new Lt("", '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]); if (a instanceof Lt) return gr([a]); if (a instanceof Ge && !_r(e)) return gr([new Lt("", '"interpolate" expressions cannot be used with this property')]); if (!a) return vr(new Mr(n ? "constant" : "source", t.value)); var o = a instanceof Ge ? a.interpolation : void 0; return vr(new Vr(n ? "camera" : "composite", t.value, a.labels, o)) } Vr.prototype.evaluateWithoutErrorHandling = function (t, e, r, n, i) { return this._styleExpression.evaluateWithoutErrorHandling(t, e, r, n, i) }, Vr.prototype.evaluate = function (t, e, r, n, i) { return this._styleExpression.evaluate(t, e, r, n, i) }, Vr.prototype.interpolationFactor = function (t, e, r) { return this.interpolationType ? Ge.interpolationFactor(this.interpolationType, t, e, r) : 0 }; var Lr = function (t, e) { this._parameters = t, this._specification = e, Mt(this, function t(e, r) { var n, i, a, o = "color" === r.type, s = e.stops && "object" == typeof e.stops[0][0], u = s || void 0 !== e.property, l = s || !u, p = e.type || (_r(r) ? "exponential" : "interval"); if (o && ((e = Mt({}, e)).stops && (e.stops = e.stops.map((function (t) { return [t[0], Qt.parse(t[1])] }))), e.default ? e.default = Qt.parse(e.default) : e.default = Qt.parse(r.default)), e.colorSpace && "rgb" !== e.colorSpace && !Ze[e.colorSpace]) throw new Error("Unknown color space: " + e.colorSpace); if ("exponential" === p) n = Cr; else if ("interval" === p) n = zr; else if ("categorical" === p) { n = Ir, i = Object.create(null); for (var c = 0, h = e.stops; c < h.length; c += 1) { var f = h[c]; i[f[0]] = f[1]; } a = typeof e.stops[0][0]; } else { if ("identity" !== p) throw new Error('Unknown function type "' + p + '"'); n = Br; } if (s) { for (var y = {}, d = [], m = 0; m < e.stops.length; m++) { var v = e.stops[m], g = v[0].zoom; void 0 === y[g] && (y[g] = { zoom: g, type: e.type, property: e.property, default: e.default, stops: [] }, d.push(g)), y[g].stops.push([v[0].value, v[1]]); } for (var x = [], b = 0, _ = d; b < _.length; b += 1) { var w = _[b]; x.push([y[w].zoom, t(y[w], r)]); } var A = { name: "linear" }; return { kind: "composite", interpolationType: A, interpolationFactor: Ge.interpolationFactor.bind(void 0, A), zoomStops: x.map((function (t) { return t[0] })), evaluate: function (t, n) { var i = t.zoom; return Cr({ stops: x, base: e.base }, r, i).evaluate(i, n) } } } if (l) { var S = "exponential" === p ? { name: "exponential", base: void 0 !== e.base ? e.base : 1 } : null; return { kind: "camera", interpolationType: S, interpolationFactor: Ge.interpolationFactor.bind(void 0, S), zoomStops: e.stops.map((function (t) { return t[0] })), evaluate: function (t) { var o = t.zoom; return n(e, r, o, i, a) } } } return { kind: "source", evaluate: function (t, o) { var s = o && o.properties ? o.properties[e.property] : void 0; return void 0 === s ? kr(e.default, r.default) : n(e, r, s, i, a) } } }(this._parameters, this._specification)); }; function Or(t) { var e = t.key, r = t.value, n = t.valueSpec || {}, i = t.objectElementValidators || {}, a = t.style, o = t.styleSpec, s = [], u = wr(r); if ("object" !== u) return [new Pt(e, r, "object expected, " + u + " found")]; for (var l in r) { var p = l.split(".")[0], c = n[p] || n["*"], h = void 0; if (i[p]) h = i[p]; else if (n[p]) h = un; else if (i["*"]) h = i["*"]; else { if (!n["*"]) { s.push(new Pt(e, r[l], 'unknown property "' + l + '"')); continue } h = un; } s = s.concat(h({ key: (e ? e + "." : e) + l, value: r[l], valueSpec: c, style: a, styleSpec: o, object: r, objectKey: l }, r)); } for (var f in n) i[f] || n[f].required && void 0 === n[f].default && void 0 === r[f] && s.push(new Pt(e, r, 'missing required property "' + f + '"')); return s } function Dr(t) { var e = t.value, r = t.valueSpec, n = t.style, i = t.styleSpec, a = t.key, o = t.arrayElementValidator || un; if ("array" !== wr(e)) return [new Pt(a, e, "array expected, " + wr(e) + " found")]; if (r.length && e.length !== r.length) return [new Pt(a, e, "array length " + r.length + " expected, length " + e.length + " found")]; if (r["min-length"] && e.length < r["min-length"]) return [new Pt(a, e, "array length at least " + r["min-length"] + " expected, length " + e.length + " found")]; var s = { type: r.value, values: r.values }; i.$version < 7 && (s.function = r.function), "object" === wr(r.value) && (s = r.value); for (var u = [], l = 0; l < e.length; l++)u = u.concat(o({ array: e, arrayIndex: l, value: e[l], valueSpec: s, style: n, styleSpec: i, key: a + "[" + l + "]" })); return u } function Rr(t) { var e = t.key, r = t.value, n = t.valueSpec, i = wr(r); return "number" === i && r != r && (i = "NaN"), "number" !== i ? [new Pt(e, r, "number expected, " + i + " found")] : "minimum" in n && r < n.minimum ? [new Pt(e, r, r + " is less than the minimum value " + n.minimum)] : "maximum" in n && r > n.maximum ? [new Pt(e, r, r + " is greater than the maximum value " + n.maximum)] : [] } function Ur(t) { var e, r, n, i = t.valueSpec, a = Vt(t.value.type), o = {}, s = "categorical" !== a && void 0 === t.value.property, u = !s, l = "array" === wr(t.value.stops) && "array" === wr(t.value.stops[0]) && "object" === wr(t.value.stops[0][0]), p = Or({ key: t.key, value: t.value, valueSpec: t.styleSpec.function, style: t.style, styleSpec: t.styleSpec, objectElementValidators: { stops: function (t) { if ("identity" === a) return [new Pt(t.key, t.value, 'identity function may not have a "stops" property')]; var e = [], r = t.value; e = e.concat(Dr({ key: t.key, value: r, valueSpec: t.valueSpec, style: t.style, styleSpec: t.styleSpec, arrayElementValidator: c })), "array" === wr(r) && 0 === r.length && e.push(new Pt(t.key, r, "array must have at least one stop")); return e }, default: function (t) { return un({ key: t.key, value: t.value, valueSpec: i, style: t.style, styleSpec: t.styleSpec }) } } }); return "identity" === a && s && p.push(new Pt(t.key, t.value, 'missing required property "property"')), "identity" === a || t.value.stops || p.push(new Pt(t.key, t.value, 'missing required property "stops"')), "exponential" === a && t.valueSpec.expression && !_r(t.valueSpec) && p.push(new Pt(t.key, t.value, "exponential functions not supported")), t.styleSpec.$version >= 8 && (u && !xr(t.valueSpec) ? p.push(new Pt(t.key, t.value, "property functions not supported")) : s && !br(t.valueSpec) && p.push(new Pt(t.key, t.value, "zoom functions not supported"))), "categorical" !== a && !l || void 0 !== t.value.property || p.push(new Pt(t.key, t.value, '"property" property is required')), p; function c(t) { var e = [], a = t.value, s = t.key; if ("array" !== wr(a)) return [new Pt(s, a, "array expected, " + wr(a) + " found")]; if (2 !== a.length) return [new Pt(s, a, "array length 2 expected, length " + a.length + " found")]; if (l) { if ("object" !== wr(a[0])) return [new Pt(s, a, "object expected, " + wr(a[0]) + " found")]; if (void 0 === a[0].zoom) return [new Pt(s, a, "object stop key must have zoom")]; if (void 0 === a[0].value) return [new Pt(s, a, "object stop key must have value")]; if (n && n > Vt(a[0].zoom)) return [new Pt(s, a[0].zoom, "stop zoom values must appear in ascending order")]; Vt(a[0].zoom) !== n && (n = Vt(a[0].zoom), r = void 0, o = {}), e = e.concat(Or({ key: s + "[0]", value: a[0], valueSpec: { zoom: {} }, style: t.style, styleSpec: t.styleSpec, objectElementValidators: { zoom: Rr, value: h } })); } else e = e.concat(h({ key: s + "[0]", value: a[0], valueSpec: {}, style: t.style, styleSpec: t.styleSpec }, a)); return Pr(Ft(a[1])) ? e.concat([new Pt(s + "[1]", a[1], "expressions are not allowed in function stops.")]) : e.concat(un({ key: s + "[1]", value: a[1], valueSpec: i, style: t.style, styleSpec: t.styleSpec })) } function h(t, n) { var s = wr(t.value), u = Vt(t.value), l = null !== t.value ? t.value : n; if (e) { if (s !== e) return [new Pt(t.key, l, s + " stop domain type must match previous stop domain type " + e)] } else e = s; if ("number" !== s && "string" !== s && "boolean" !== s) return [new Pt(t.key, l, "stop domain value must be a number, string, or boolean")]; if ("number" !== s && "categorical" !== a) { var p = "number expected, " + s + " found"; return xr(i) && void 0 === a && (p += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'), [new Pt(t.key, l, p)] } return "categorical" !== a || "number" !== s || isFinite(u) && Math.floor(u) === u ? "categorical" !== a && "number" === s && void 0 !== r && u < r ? [new Pt(t.key, l, "stop domain values must appear in ascending order")] : (r = u, "categorical" === a && u in o ? [new Pt(t.key, l, "stop domain values must be unique")] : (o[u] = !0, [])) : [new Pt(t.key, l, "integer expected, found " + u)] } } function jr(t) { var e = ("property" === t.expressionContext ? Fr : Er)(Ft(t.value), t.valueSpec); if ("error" === e.result) return e.value.map((function (e) { return new Pt("" + t.key + e.key, t.value, e.message) })); var r = e.value.expression || e.value._styleExpression.expression; if ("property" === t.expressionContext && "text-font" === t.propertyKey && -1 !== r.possibleOutputs().indexOf(void 0)) return [new Pt(t.key, t.value, 'Invalid data expression for "' + t.propertyKey + '". Output values must be contained as literals within the expression.')]; if ("property" === t.expressionContext && "layout" === t.propertyType && !be(r)) return [new Pt(t.key, t.value, '"feature-state" data expressions are not supported with layout properties.')]; if ("filter" === t.expressionContext && !be(r)) return [new Pt(t.key, t.value, '"feature-state" data expressions are not supported with filters.')]; if (t.expressionContext && 0 === t.expressionContext.indexOf("cluster")) { if (!_e(r, ["zoom", "feature-state"])) return [new Pt(t.key, t.value, '"zoom" and "feature-state" expressions are not supported with cluster properties.')]; if ("cluster-initial" === t.expressionContext && !xe(r)) return [new Pt(t.key, t.value, "Feature data expressions are not supported with initial expression part of cluster properties.")] } return [] } function qr(t) { var e = t.key, r = t.value, n = t.valueSpec, i = []; return Array.isArray(n.values) ? -1 === n.values.indexOf(Vt(r)) && i.push(new Pt(e, r, "expected one of [" + n.values.join(", ") + "], " + JSON.stringify(r) + " found")) : -1 === Object.keys(n.values).indexOf(Vt(r)) && i.push(new Pt(e, r, "expected one of [" + Object.keys(n.values).join(", ") + "], " + JSON.stringify(r) + " found")), i } function Nr(t) { if (!0 === t || !1 === t) return !0; if (!Array.isArray(t) || 0 === t.length) return !1; switch (t[0]) { case "has": return t.length >= 2 && "$id" !== t[1] && "$type" !== t[1]; case "in": return t.length >= 3 && Array.isArray(t[2]); case "!in": case "!has": case "none": return !1; case "==": case "!=": case ">": case ">=": case "<": case "<=": return 3 !== t.length || Array.isArray(t[1]) || Array.isArray(t[2]); case "any": case "all": for (var e = 0, r = t.slice(1); e < r.length; e += 1) { var n = r[e]; if (!Nr(n) && "boolean" != typeof n) return !1 } return !0; default: return !0 } } Lr.deserialize = function (t) { return new Lr(t._parameters, t._specification) }, Lr.serialize = function (t) { return { _parameters: t._parameters, _specification: t._specification } }; var Kr = { type: "boolean", default: !1, transition: !1, "property-type": "data-driven", expression: { interpolated: !1, parameters: ["zoom", "feature"] } }; function Xr(t) { if (null == t) return function () { return !0 }; Nr(t) || (t = Gr(t)); var e = Er(t, Kr); if ("error" === e.result) throw new Error(e.value.map((function (t) { return t.key + ": " + t.message })).join(", ")); return function (t, r) { return e.value.evaluate(t, r) } } function Zr(t, e) { return t < e ? -1 : t > e ? 1 : 0 } function Gr(t) { if (!t) return !0; var e, r = t[0]; return t.length <= 1 ? "any" !== r : "==" === r ? Jr(t[1], t[2], "==") : "!=" === r ? $r(Jr(t[1], t[2], "==")) : "<" === r || ">" === r || "<=" === r || ">=" === r ? Jr(t[1], t[2], r) : "any" === r ? (e = t.slice(1), ["any"].concat(e.map(Gr))) : "all" === r ? ["all"].concat(t.slice(1).map(Gr)) : "none" === r ? ["all"].concat(t.slice(1).map(Gr).map($r)) : "in" === r ? Hr(t[1], t.slice(2)) : "!in" === r ? $r(Hr(t[1], t.slice(2))) : "has" === r ? Yr(t[1]) : "!has" !== r || $r(Yr(t[1])) } function Jr(t, e, r) { switch (t) { case "$type": return ["filter-type-" + r, e]; case "$id": return ["filter-id-" + r, e]; default: return ["filter-" + r, t, e] } } function Hr(t, e) { if (0 === e.length) return !1; switch (t) { case "$type": return ["filter-type-in", ["literal", e]]; case "$id": return ["filter-id-in", ["literal", e]]; default: return e.length > 200 && !e.some((function (t) { return typeof t != typeof e[0] })) ? ["filter-in-large", t, ["literal", e.sort(Zr)]] : ["filter-in-small", t, ["literal", e]] } } function Yr(t) { switch (t) { case "$type": return !0; case "$id": return ["filter-has-id"]; default: return ["filter-has", t] } } function $r(t) { return ["!", t] } function Wr(t) { return Nr(Ft(t.value)) ? jr(Mt({}, t, { expressionContext: "filter", valueSpec: { value: "boolean" } })) : function t(e) { var r = e.value; var n = e.key; if ("array" !== wr(r)) return [new Pt(n, r, "array expected, " + wr(r) + " found")]; var i = e.styleSpec; var a; var o = []; if (r.length < 1) return [new Pt(n, r, "filter array must have at least 1 element")]; o = o.concat(qr({ key: n + "[0]", value: r[0], valueSpec: i.filter_operator, style: e.style, styleSpec: e.styleSpec })); switch (Vt(r[0])) { case "<": case "<=": case ">": case ">=": r.length >= 2 && "$type" === Vt(r[1]) && o.push(new Pt(n, r, '"$type" cannot be use with operator "' + r[0] + '"')); case "==": case "!=": 3 !== r.length && o.push(new Pt(n, r, 'filter array for operator "' + r[0] + '" must have 3 elements')); case "in": case "!in": r.length >= 2 && "string" !== (a = wr(r[1])) && o.push(new Pt(n + "[1]", r[1], "string expected, " + a + " found")); for (var s = 2; s < r.length; s++)a = wr(r[s]), "$type" === Vt(r[1]) ? o = o.concat(qr({ key: n + "[" + s + "]", value: r[s], valueSpec: i.geometry_type, style: e.style, styleSpec: e.styleSpec })) : "string" !== a && "number" !== a && "boolean" !== a && o.push(new Pt(n + "[" + s + "]", r[s], "string, number, or boolean expected, " + a + " found")); break; case "any": case "all": case "none": for (var u = 1; u < r.length; u++)o = o.concat(t({ key: n + "[" + u + "]", value: r[u], style: e.style, styleSpec: e.styleSpec })); break; case "has": case "!has": a = wr(r[1]), 2 !== r.length ? o.push(new Pt(n, r, 'filter array for "' + r[0] + '" operator must have 2 elements')) : "string" !== a && o.push(new Pt(n + "[1]", r[1], "string expected, " + a + " found")); }return o }(t) } function Qr(t, e) { var r = t.key, n = t.style, i = t.styleSpec, a = t.value, o = t.objectKey, s = i[e + "_" + t.layerType]; if (!s) return []; var u = o.match(/^(.*)-transition$/); if ("paint" === e && u && s[u[1]] && s[u[1]].transition) return un({ key: r, value: a, valueSpec: i.transition, style: n, styleSpec: i }); var l, p = t.valueSpec || s[o]; if (!p) return [new Pt(r, a, 'unknown property "' + o + '"')]; if ("string" === wr(a) && xr(p) && !p.tokens && (l = /^{([^}]+)}$/.exec(a))) return [new Pt(r, a, '"' + o + '" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": ' + JSON.stringify(l[1]) + " }`.")]; var c = []; return "symbol" === t.layerType && ("text-field" === o && n && !n.glyphs && c.push(new Pt(r, a, 'use of "text-field" requires a style "glyphs" property')), "text-font" === o && Ar(Ft(a)) && "identity" === Vt(a.type) && c.push(new Pt(r, a, '"text-font" does not support identity functions'))), c.concat(un({ key: t.key, value: a, valueSpec: p, style: n, styleSpec: i, expressionContext: "property", propertyType: e, propertyKey: o })) } function tn(t) { return Qr(t, "paint") } function en(t) { return Qr(t, "layout") } function rn(t) { var e = [], r = t.value, n = t.key, i = t.style, a = t.styleSpec; r.type || r.ref || e.push(new Pt(n, r, 'either "type" or "ref" is required')); var o, s = Vt(r.type), u = Vt(r.ref); if (r.id) for (var l = Vt(r.id), p = 0; p < t.arrayIndex; p++) { var c = i.layers[p]; Vt(c.id) === l && e.push(new Pt(n, r.id, 'duplicate layer id "' + r.id + '", previously used at line ' + c.id.__line__)); } if ("ref" in r) ["type", "source", "source-layer", "filter", "layout"].forEach((function (t) { t in r && e.push(new Pt(n, r[t], '"' + t + '" is prohibited for ref layers')); })), i.layers.forEach((function (t) { Vt(t.id) === u && (o = t); })), o ? o.ref ? e.push(new Pt(n, r.ref, "ref cannot reference another ref layer")) : s = Vt(o.type) : e.push(new Pt(n, r.ref, 'ref layer "' + u + '" not found')); else if ("background" !== s) if (r.source) { var h = i.sources && i.sources[r.source], f = h && Vt(h.type); h ? "vector" === f && "raster" === s ? e.push(new Pt(n, r.source, 'layer "' + r.id + '" requires a raster source')) : "raster" === f && "raster" !== s ? e.push(new Pt(n, r.source, 'layer "' + r.id + '" requires a vector source')) : "vector" !== f || r["source-layer"] ? "raster-dem" === f && "hillshade" !== s ? e.push(new Pt(n, r.source, "raster-dem source can only be used with layer type 'hillshade'.")) : "line" !== s || !r.paint || !r.paint["line-gradient"] || "geojson" === f && h.lineMetrics || e.push(new Pt(n, r, 'layer "' + r.id + '" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')) : e.push(new Pt(n, r, 'layer "' + r.id + '" must specify a "source-layer"')) : e.push(new Pt(n, r.source, 'source "' + r.source + '" not found')); } else e.push(new Pt(n, r, 'missing required property "source"')); return e = e.concat(Or({ key: n, value: r, valueSpec: a.layer, style: t.style, styleSpec: t.styleSpec, objectElementValidators: { "*": function () { return [] }, type: function () { return un({ key: n + ".type", value: r.type, valueSpec: a.layer.type, style: t.style, styleSpec: t.styleSpec, object: r, objectKey: "type" }) }, filter: Wr, layout: function (t) { return Or({ layer: r, key: t.key, value: t.value, style: t.style, styleSpec: t.styleSpec, objectElementValidators: { "*": function (t) { return en(Mt({ layerType: s }, t)) } } }) }, paint: function (t) { return Or({ layer: r, key: t.key, value: t.value, style: t.style, styleSpec: t.styleSpec, objectElementValidators: { "*": function (t) { return tn(Mt({ layerType: s }, t)) } } }) } } })) } function nn(t) { var e = t.value, r = t.key, n = t.styleSpec, i = t.style; if (!e.type) return [new Pt(r, e, '"type" is required')]; var a, o = Vt(e.type); switch (o) { case "vector": case "raster": case "raster-dem": return a = Or({ key: r, value: e, valueSpec: n["source_" + o.replace("-", "_")], style: t.style, styleSpec: n }); case "geojson": if (a = Or({ key: r, value: e, valueSpec: n.source_geojson, style: i, styleSpec: n }), e.cluster) for (var s in e.clusterProperties) { var u = e.clusterProperties[s], l = u[0], p = u[1], c = "string" == typeof l ? [l, ["accumulated"], ["get", s]] : l; a.push.apply(a, jr({ key: r + "." + s + ".map", value: p, expressionContext: "cluster-map" })), a.push.apply(a, jr({ key: r + "." + s + ".reduce", value: c, expressionContext: "cluster-reduce" })); } return a; case "video": return Or({ key: r, value: e, valueSpec: n.source_video, style: i, styleSpec: n }); case "image": return Or({ key: r, value: e, valueSpec: n.source_image, style: i, styleSpec: n }); case "canvas": return [new Pt(r, null, "Please use runtime APIs to add canvas sources, rather than including them in stylesheets.", "source.canvas")]; default: return qr({ key: r + ".type", value: e.type, valueSpec: { values: ["vector", "raster", "raster-dem", "geojson", "video", "image"] }, style: i, styleSpec: n }) } } function an(t) { var e = t.value, r = t.styleSpec, n = r.light, i = t.style, a = [], o = wr(e); if (void 0 === e) return a; if ("object" !== o) return a = a.concat([new Pt("light", e, "object expected, " + o + " found")]); for (var s in e) { var u = s.match(/^(.*)-transition$/); a = u && n[u[1]] && n[u[1]].transition ? a.concat(un({ key: s, value: e[s], valueSpec: r.transition, style: i, styleSpec: r })) : n[s] ? a.concat(un({ key: s, value: e[s], valueSpec: n[s], style: i, styleSpec: r })) : a.concat([new Pt(s, e[s], 'unknown property "' + s + '"')]); } return a } function on(t) { var e = t.value, r = t.key, n = wr(e); return "string" !== n ? [new Pt(r, e, "string expected, " + n + " found")] : [] } var sn = { "*": function () { return [] }, array: Dr, boolean: function (t) { var e = t.value, r = t.key, n = wr(e); return "boolean" !== n ? [new Pt(r, e, "boolean expected, " + n + " found")] : [] }, number: Rr, color: function (t) { var e = t.key, r = t.value, n = wr(r); return "string" !== n ? [new Pt(e, r, "color expected, " + n + " found")] : null === Wt(r) ? [new Pt(e, r, 'color expected, "' + r + '" found')] : [] }, constants: Et, enum: qr, filter: Wr, function: Ur, layer: rn, object: Or, source: nn, light: an, string: on, formatted: function (t) { return 0 === on(t).length ? [] : jr(t) }, resolvedImage: function (t) { return 0 === on(t).length ? [] : jr(t) } }; function un(t) { var e = t.value, r = t.valueSpec, n = t.styleSpec; return r.expression && Ar(Vt(e)) ? Ur(t) : r.expression && Pr(Ft(e)) ? jr(t) : r.type && sn[r.type] ? sn[r.type](t) : Or(Mt({}, t, { valueSpec: r.type ? n[r.type] : r })) } function ln(t) { var e = t.value, r = t.key, n = on(t); return n.length ? n : (-1 === e.indexOf("{fontstack}") && n.push(new Pt(r, e, '"glyphs" url must include a "{fontstack}" token')), -1 === e.indexOf("{range}") && n.push(new Pt(r, e, '"glyphs" url must include a "{range}" token')), n) } function pn(t, e) { void 0 === e && (e = Tt); var r = []; return r = r.concat(un({ key: "", value: t, valueSpec: e.$root, styleSpec: e, style: t, objectElementValidators: { glyphs: ln, "*": function () { return [] } } })), t.constants && (r = r.concat(Et({ key: "constants", value: t.constants, style: t, styleSpec: e }))), cn(r) } function cn(t) { return [].concat(t).sort((function (t, e) { return t.line - e.line })) } function hn(t) { return function () { for (var e = [], r = arguments.length; r--;)e[r] = arguments[r]; return cn(t.apply(this, e)) } } pn.source = hn(nn), pn.light = hn(an), pn.layer = hn(rn), pn.filter = hn(Wr), pn.paintProperty = hn(tn), pn.layoutProperty = hn(en); var fn = pn, yn = fn.light, dn = fn.paintProperty, mn = fn.layoutProperty; function vn(t, e) { var r = !1; if (e && e.length) for (var n = 0, i = e; n < i.length; n += 1) { var a = i[n]; t.fire(new Ct(new Error(a.message))), r = !0; } return r } var gn = bn, xn = 3; function bn(t, e, r) { var n = this.cells = []; if (t instanceof ArrayBuffer) { this.arrayBuffer = t; var i = new Int32Array(this.arrayBuffer); t = i[0], e = i[1], r = i[2], this.d = e + 2 * r; for (var a = 0; a < this.d * this.d; a++) { var o = i[xn + a], s = i[xn + a + 1]; n.push(o === s ? null : i.subarray(o, s)); } var u = i[xn + n.length], l = i[xn + n.length + 1]; this.keys = i.subarray(u, l), this.bboxes = i.subarray(l), this.insert = this._insertReadonly; } else { this.d = e + 2 * r; for (var p = 0; p < this.d * this.d; p++)n.push([]); this.keys = [], this.bboxes = []; } this.n = e, this.extent = t, this.padding = r, this.scale = e / t, this.uid = 0; var c = r / e * t; this.min = -c, this.max = t + c; } bn.prototype.insert = function (t, e, r, n, i) { this._forEachCell(e, r, n, i, this._insertCell, this.uid++), this.keys.push(t), this.bboxes.push(e), this.bboxes.push(r), this.bboxes.push(n), this.bboxes.push(i); }, bn.prototype._insertReadonly = function () { throw "Cannot insert into a GridIndex created from an ArrayBuffer." }, bn.prototype._insertCell = function (t, e, r, n, i, a) { this.cells[i].push(a); }, bn.prototype.query = function (t, e, r, n, i) { var a = this.min, o = this.max; if (t <= a && e <= a && o <= r && o <= n && !i) return Array.prototype.slice.call(this.keys); var s = []; return this._forEachCell(t, e, r, n, this._queryCell, s, {}, i), s }, bn.prototype._queryCell = function (t, e, r, n, i, a, o, s) { var u = this.cells[i]; if (null !== u) for (var l = this.keys, p = this.bboxes, c = 0; c < u.length; c++) { var h = u[c]; if (void 0 === o[h]) { var f = 4 * h; (s ? s(p[f + 0], p[f + 1], p[f + 2], p[f + 3]) : t <= p[f + 2] && e <= p[f + 3] && r >= p[f + 0] && n >= p[f + 1]) ? (o[h] = !0, a.push(l[h])) : o[h] = !1; } } }, bn.prototype._forEachCell = function (t, e, r, n, i, a, o, s) { for (var u = this._convertToCellCoord(t), l = this._convertToCellCoord(e), p = this._convertToCellCoord(r), c = this._convertToCellCoord(n), h = u; h <= p; h++)for (var f = l; f <= c; f++) { var y = this.d * f + h; if ((!s || s(this._convertFromCellCoord(h), this._convertFromCellCoord(f), this._convertFromCellCoord(h + 1), this._convertFromCellCoord(f + 1))) && i.call(this, t, e, r, n, y, a, o, s)) return } }, bn.prototype._convertFromCellCoord = function (t) { return (t - this.padding) / this.scale }, bn.prototype._convertToCellCoord = function (t) { return Math.max(0, Math.min(this.d - 1, Math.floor(t * this.scale) + this.padding)) }, bn.prototype.toArrayBuffer = function () { if (this.arrayBuffer) return this.arrayBuffer; for (var t = this.cells, e = xn + this.cells.length + 1 + 1, r = 0, n = 0; n < this.cells.length; n++)r += this.cells[n].length; var i = new Int32Array(e + r + this.keys.length + this.bboxes.length); i[0] = this.extent, i[1] = this.n, i[2] = this.padding; for (var a = e, o = 0; o < t.length; o++) { var s = t[o]; i[xn + o] = a, i.set(s, a), a += s.length; } return i[xn + t.length] = a, i.set(this.keys, a), a += this.keys.length, i[xn + t.length + 1] = a, i.set(this.bboxes, a), a += this.bboxes.length, i.buffer }; var _n = self.ImageData, wn = {}; function An(t, e, r) { void 0 === r && (r = {}), Object.defineProperty(e, "_classRegistryKey", { value: t, writeable: !1 }), wn[t] = { klass: e, omit: r.omit || [], shallow: r.shallow || [] }; } for (var Sn in An("Object", Object), gn.serialize = function (t, e) { var r = t.toArrayBuffer(); return e && e.push(r), { buffer: r } }, gn.deserialize = function (t) { return new gn(t.buffer) }, An("Grid", gn), An("Color", Qt), An("Error", Error), An("ResolvedImage", ne), An("StylePropertyFunction", Lr), An("StyleExpression", Tr, { omit: ["_evaluator"] }), An("ZoomDependentExpression", Vr), An("ZoomConstantExpression", Mr), An("CompoundExpression", ve, { omit: ["_evaluate"] }), hr) hr[Sn]._classRegistryKey || An("Expression_" + Sn, hr[Sn]); function kn(t) { return t && "undefined" != typeof ArrayBuffer && (t instanceof ArrayBuffer || t.constructor && "ArrayBuffer" === t.constructor.name) } function In(t, e) { if (null == t || "boolean" == typeof t || "number" == typeof t || "string" == typeof t || t instanceof Boolean || t instanceof Number || t instanceof String || t instanceof Date || t instanceof RegExp) return t; if (kn(t)) return e && e.push(t), t; if (ArrayBuffer.isView(t)) { var r = t; return e && e.push(r.buffer), r } if (t instanceof _n) return e && e.push(t.data.buffer), t; if (Array.isArray(t)) { for (var n = [], i = 0, a = t; i < a.length; i += 1) { var o = a[i]; n.push(In(o, e)); } return n } if ("object" == typeof t) { var s = t.constructor, u = s._classRegistryKey; if (!u) throw new Error("can't serialize object of unregistered class"); var l = s.serialize ? s.serialize(t, e) : {}; if (!s.serialize) { for (var p in t) if (t.hasOwnProperty(p) && !(wn[u].omit.indexOf(p) >= 0)) { var c = t[p]; l[p] = wn[u].shallow.indexOf(p) >= 0 ? c : In(c, e); } t instanceof Error && (l.message = t.message); } if (l.$name) throw new Error("$name property is reserved for worker serialization logic."); return "Object" !== u && (l.$name = u), l } throw new Error("can't serialize object of type " + typeof t) } function zn(t) { if (null == t || "boolean" == typeof t || "number" == typeof t || "string" == typeof t || t instanceof Boolean || t instanceof Number || t instanceof String || t instanceof Date || t instanceof RegExp || kn(t) || ArrayBuffer.isView(t) || t instanceof _n) return t; if (Array.isArray(t)) return t.map(zn); if ("object" == typeof t) { var e = t.$name || "Object", r = wn[e].klass; if (!r) throw new Error("can't deserialize unregistered class " + e); if (r.deserialize) return r.deserialize(t); for (var n = Object.create(r.prototype), i = 0, a = Object.keys(t); i < a.length; i += 1) { var o = a[i]; if ("$name" !== o) { var s = t[o]; n[o] = wn[e].shallow.indexOf(o) >= 0 ? s : zn(s); } } return n } throw new Error("can't deserialize object of type " + typeof t) } var Cn = function () { this.first = !0; }; Cn.prototype.update = function (t, e) { var r = Math.floor(t); return this.first ? (this.first = !1, this.lastIntegerZoom = r, this.lastIntegerZoomTime = 0, this.lastZoom = t, this.lastFloorZoom = r, !0) : (this.lastFloorZoom > r ? (this.lastIntegerZoom = r + 1, this.lastIntegerZoomTime = e) : this.lastFloorZoom < r && (this.lastIntegerZoom = r, this.lastIntegerZoomTime = e), t !== this.lastZoom && (this.lastZoom = t, this.lastFloorZoom = r, !0)) }; var Bn = { "Latin-1 Supplement": function (t) { return t >= 128 && t <= 255 }, Arabic: function (t) { return t >= 1536 && t <= 1791 }, "Arabic Supplement": function (t) { return t >= 1872 && t <= 1919 }, "Arabic Extended-A": function (t) { return t >= 2208 && t <= 2303 }, "Hangul Jamo": function (t) { return t >= 4352 && t <= 4607 }, "Unified Canadian Aboriginal Syllabics": function (t) { return t >= 5120 && t <= 5759 }, Khmer: function (t) { return t >= 6016 && t <= 6143 }, "Unified Canadian Aboriginal Syllabics Extended": function (t) { return t >= 6320 && t <= 6399 }, "General Punctuation": function (t) { return t >= 8192 && t <= 8303 }, "Letterlike Symbols": function (t) { return t >= 8448 && t <= 8527 }, "Number Forms": function (t) { return t >= 8528 && t <= 8591 }, "Miscellaneous Technical": function (t) { return t >= 8960 && t <= 9215 }, "Control Pictures": function (t) { return t >= 9216 && t <= 9279 }, "Optical Character Recognition": function (t) { return t >= 9280 && t <= 9311 }, "Enclosed Alphanumerics": function (t) { return t >= 9312 && t <= 9471 }, "Geometric Shapes": function (t) { return t >= 9632 && t <= 9727 }, "Miscellaneous Symbols": function (t) { return t >= 9728 && t <= 9983 }, "Miscellaneous Symbols and Arrows": function (t) { return t >= 11008 && t <= 11263 }, "CJK Radicals Supplement": function (t) { return t >= 11904 && t <= 12031 }, "Kangxi Radicals": function (t) { return t >= 12032 && t <= 12255 }, "Ideographic Description Characters": function (t) { return t >= 12272 && t <= 12287 }, "CJK Symbols and Punctuation": function (t) { return t >= 12288 && t <= 12351 }, Hiragana: function (t) { return t >= 12352 && t <= 12447 }, Katakana: function (t) { return t >= 12448 && t <= 12543 }, Bopomofo: function (t) { return t >= 12544 && t <= 12591 }, "Hangul Compatibility Jamo": function (t) { return t >= 12592 && t <= 12687 }, Kanbun: function (t) { return t >= 12688 && t <= 12703 }, "Bopomofo Extended": function (t) { return t >= 12704 && t <= 12735 }, "CJK Strokes": function (t) { return t >= 12736 && t <= 12783 }, "Katakana Phonetic Extensions": function (t) { return t >= 12784 && t <= 12799 }, "Enclosed CJK Letters and Months": function (t) { return t >= 12800 && t <= 13055 }, "CJK Compatibility": function (t) { return t >= 13056 && t <= 13311 }, "CJK Unified Ideographs Extension A": function (t) { return t >= 13312 && t <= 19903 }, "Yijing Hexagram Symbols": function (t) { return t >= 19904 && t <= 19967 }, "CJK Unified Ideographs": function (t) { return t >= 19968 && t <= 40959 }, "Yi Syllables": function (t) { return t >= 40960 && t <= 42127 }, "Yi Radicals": function (t) { return t >= 42128 && t <= 42191 }, "Hangul Jamo Extended-A": function (t) { return t >= 43360 && t <= 43391 }, "Hangul Syllables": function (t) { return t >= 44032 && t <= 55215 }, "Hangul Jamo Extended-B": function (t) { return t >= 55216 && t <= 55295 }, "Private Use Area": function (t) { return t >= 57344 && t <= 63743 }, "CJK Compatibility Ideographs": function (t) { return t >= 63744 && t <= 64255 }, "Arabic Presentation Forms-A": function (t) { return t >= 64336 && t <= 65023 }, "Vertical Forms": function (t) { return t >= 65040 && t <= 65055 }, "CJK Compatibility Forms": function (t) { return t >= 65072 && t <= 65103 }, "Small Form Variants": function (t) { return t >= 65104 && t <= 65135 }, "Arabic Presentation Forms-B": function (t) { return t >= 65136 && t <= 65279 }, "Halfwidth and Fullwidth Forms": function (t) { return t >= 65280 && t <= 65519 } }; function Tn(t) { for (var e = 0, r = t; e < r.length; e += 1) { if (En(r[e].charCodeAt(0))) return !0 } return !1 } function Pn(t) { return !Bn.Arabic(t) && (!Bn["Arabic Supplement"](t) && (!Bn["Arabic Extended-A"](t) && (!Bn["Arabic Presentation Forms-A"](t) && !Bn["Arabic Presentation Forms-B"](t)))) } function En(t) { return 746 === t || 747 === t || !(t < 4352) && (!!Bn["Bopomofo Extended"](t) || (!!Bn.Bopomofo(t) || (!(!Bn["CJK Compatibility Forms"](t) || t >= 65097 && t <= 65103) || (!!Bn["CJK Compatibility Ideographs"](t) || (!!Bn["CJK Compatibility"](t) || (!!Bn["CJK Radicals Supplement"](t) || (!!Bn["CJK Strokes"](t) || (!(!Bn["CJK Symbols and Punctuation"](t) || t >= 12296 && t <= 12305 || t >= 12308 && t <= 12319 || 12336 === t) || (!!Bn["CJK Unified Ideographs Extension A"](t) || (!!Bn["CJK Unified Ideographs"](t) || (!!Bn["Enclosed CJK Letters and Months"](t) || (!!Bn["Hangul Compatibility Jamo"](t) || (!!Bn["Hangul Jamo Extended-A"](t) || (!!Bn["Hangul Jamo Extended-B"](t) || (!!Bn["Hangul Jamo"](t) || (!!Bn["Hangul Syllables"](t) || (!!Bn.Hiragana(t) || (!!Bn["Ideographic Description Characters"](t) || (!!Bn.Kanbun(t) || (!!Bn["Kangxi Radicals"](t) || (!!Bn["Katakana Phonetic Extensions"](t) || (!(!Bn.Katakana(t) || 12540 === t) || (!(!Bn["Halfwidth and Fullwidth Forms"](t) || 65288 === t || 65289 === t || 65293 === t || t >= 65306 && t <= 65310 || 65339 === t || 65341 === t || 65343 === t || t >= 65371 && t <= 65503 || 65507 === t || t >= 65512 && t <= 65519) || (!(!Bn["Small Form Variants"](t) || t >= 65112 && t <= 65118 || t >= 65123 && t <= 65126) || (!!Bn["Unified Canadian Aboriginal Syllabics"](t) || (!!Bn["Unified Canadian Aboriginal Syllabics Extended"](t) || (!!Bn["Vertical Forms"](t) || (!!Bn["Yijing Hexagram Symbols"](t) || (!!Bn["Yi Syllables"](t) || !!Bn["Yi Radicals"](t)))))))))))))))))))))))))))))) } function Mn(t) { return !(En(t) || function (t) { return !(!Bn["Latin-1 Supplement"](t) || 167 !== t && 169 !== t && 174 !== t && 177 !== t && 188 !== t && 189 !== t && 190 !== t && 215 !== t && 247 !== t) || (!(!Bn["General Punctuation"](t) || 8214 !== t && 8224 !== t && 8225 !== t && 8240 !== t && 8241 !== t && 8251 !== t && 8252 !== t && 8258 !== t && 8263 !== t && 8264 !== t && 8265 !== t && 8273 !== t) || (!!Bn["Letterlike Symbols"](t) || (!!Bn["Number Forms"](t) || (!(!Bn["Miscellaneous Technical"](t) || !(t >= 8960 && t <= 8967 || t >= 8972 && t <= 8991 || t >= 8996 && t <= 9e3 || 9003 === t || t >= 9085 && t <= 9114 || t >= 9150 && t <= 9165 || 9167 === t || t >= 9169 && t <= 9179 || t >= 9186 && t <= 9215)) || (!(!Bn["Control Pictures"](t) || 9251 === t) || (!!Bn["Optical Character Recognition"](t) || (!!Bn["Enclosed Alphanumerics"](t) || (!!Bn["Geometric Shapes"](t) || (!(!Bn["Miscellaneous Symbols"](t) || t >= 9754 && t <= 9759) || (!(!Bn["Miscellaneous Symbols and Arrows"](t) || !(t >= 11026 && t <= 11055 || t >= 11088 && t <= 11097 || t >= 11192 && t <= 11243)) || (!!Bn["CJK Symbols and Punctuation"](t) || (!!Bn.Katakana(t) || (!!Bn["Private Use Area"](t) || (!!Bn["CJK Compatibility Forms"](t) || (!!Bn["Small Form Variants"](t) || (!!Bn["Halfwidth and Fullwidth Forms"](t) || (8734 === t || 8756 === t || 8757 === t || t >= 9984 && t <= 10087 || t >= 10102 && t <= 10131 || 65532 === t || 65533 === t))))))))))))))))) }(t)) } function Vn(t) { return t >= 1424 && t <= 2303 || Bn["Arabic Presentation Forms-A"](t) || Bn["Arabic Presentation Forms-B"](t) } function Fn(t, e) { return !(!e && Vn(t)) && !(t >= 2304 && t <= 3583 || t >= 3840 && t <= 4255 || Bn.Khmer(t)) } function Ln(t) { for (var e = 0, r = t; e < r.length; e += 1) { if (Vn(r[e].charCodeAt(0))) return !0 } return !1 } var On = "deferred", Dn = "loading", Rn = "loaded", Un = null, jn = "unavailable", qn = null, Nn = function (t) { Un && Un(t); }; function Kn() { Xn.fire(new zt("pluginStateChange", { pluginStatus: jn, pluginURL: qn })); } var Xn = new Bt, Zn = function () { return jn }, Gn = function () { if (jn !== On || !qn) throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified"); jn = Dn, Kn(), qn && bt({ url: qn }, (function (t) { t ? Nn(t) : (jn = Rn, Kn()); })); }, Jn = { applyArabicShaping: null, processBidirectionalText: null, processStyledBidirectionalText: null, isLoaded: function () { return jn === Rn || null != Jn.applyArabicShaping }, isLoading: function () { return jn === Dn }, setState: function (t) { jn = t.pluginStatus, qn = t.pluginURL; }, isParsed: function () { return null != Jn.applyArabicShaping && null != Jn.processBidirectionalText && null != Jn.processStyledBidirectionalText }, getPluginURL: function () { return qn } }, Hn = function (t, e) { this.zoom = t, e ? (this.now = e.now, this.fadeDuration = e.fadeDuration, this.zoomHistory = e.zoomHistory, this.transition = e.transition) : (this.now = 0, this.fadeDuration = 0, this.zoomHistory = new Cn, this.transition = {}); }; Hn.prototype.isSupportedScript = function (t) { return function (t, e) { for (var r = 0, n = t; r < n.length; r += 1) { if (!Fn(n[r].charCodeAt(0), e)) return !1 } return !0 }(t, Jn.isLoaded()) }, Hn.prototype.crossFadingFactor = function () { return 0 === this.fadeDuration ? 1 : Math.min((this.now - this.zoomHistory.lastIntegerZoomTime) / this.fadeDuration, 1) }, Hn.prototype.getCrossfadeParameters = function () { var t = this.zoom, e = t - Math.floor(t), r = this.crossFadingFactor(); return t > this.zoomHistory.lastIntegerZoom ? { fromScale: 2, toScale: 1, t: e + (1 - e) * r } : { fromScale: .5, toScale: 1, t: 1 - (1 - r) * e } }; var Yn = function (t, e) { this.property = t, this.value = e, this.expression = function (t, e) { if (Ar(t)) return new Lr(t, e); if (Pr(t)) { var r = Fr(t, e); if ("error" === r.result) throw new Error(r.value.map((function (t) { return t.key + ": " + t.message })).join(", ")); return r.value } var n = t; return "string" == typeof t && "color" === e.type && (n = Qt.parse(t)), { kind: "constant", evaluate: function () { return n } } }(void 0 === e ? t.specification.default : e, t.specification); }; Yn.prototype.isDataDriven = function () { return "source" === this.expression.kind || "composite" === this.expression.kind }, Yn.prototype.possiblyEvaluate = function (t, e) { return this.property.possiblyEvaluate(this, t, e) }; var $n = function (t) { this.property = t, this.value = new Yn(t, void 0); }; $n.prototype.transitioned = function (t, e) { return new Qn(this.property, this.value, e, c({}, t.transition, this.transition), t.now) }, $n.prototype.untransitioned = function () { return new Qn(this.property, this.value, null, {}, 0) }; var Wn = function (t) { this._properties = t, this._values = Object.create(t.defaultTransitionablePropertyValues); }; Wn.prototype.getValue = function (t) { return b(this._values[t].value.value) }, Wn.prototype.setValue = function (t, e) { this._values.hasOwnProperty(t) || (this._values[t] = new $n(this._values[t].property)), this._values[t].value = new Yn(this._values[t].property, null === e ? void 0 : b(e)); }, Wn.prototype.getTransition = function (t) { return b(this._values[t].transition) }, Wn.prototype.setTransition = function (t, e) { this._values.hasOwnProperty(t) || (this._values[t] = new $n(this._values[t].property)), this._values[t].transition = b(e) || void 0; }, Wn.prototype.serialize = function () { for (var t = {}, e = 0, r = Object.keys(this._values); e < r.length; e += 1) { var n = r[e], i = this.getValue(n); void 0 !== i && (t[n] = i); var a = this.getTransition(n); void 0 !== a && (t[n + "-transition"] = a); } return t }, Wn.prototype.transitioned = function (t, e) { for (var r = new ti(this._properties), n = 0, i = Object.keys(this._values); n < i.length; n += 1) { var a = i[n]; r._values[a] = this._values[a].transitioned(t, e._values[a]); } return r }, Wn.prototype.untransitioned = function () { for (var t = new ti(this._properties), e = 0, r = Object.keys(this._values); e < r.length; e += 1) { var n = r[e]; t._values[n] = this._values[n].untransitioned(); } return t }; var Qn = function (t, e, r, n, i) { this.property = t, this.value = e, this.begin = i + n.delay || 0, this.end = this.begin + n.duration || 0, t.specification.transition && (n.delay || n.duration) && (this.prior = r); }; Qn.prototype.possiblyEvaluate = function (t, e) { var r = t.now || 0, n = this.value.possiblyEvaluate(t, e), i = this.prior; if (i) { if (r > this.end) return this.prior = null, n; if (this.value.isDataDriven()) return this.prior = null, n; if (r < this.begin) return i.possiblyEvaluate(t, e); var a = (r - this.begin) / (this.end - this.begin); return this.property.interpolate(i.possiblyEvaluate(t, e), n, function (t) { if (t <= 0) return 0; if (t >= 1) return 1; var e = t * t, r = e * t; return 4 * (t < .5 ? r : 3 * (t - e) + r - .75) }(a)) } return n }; var ti = function (t) { this._properties = t, this._values = Object.create(t.defaultTransitioningPropertyValues); }; ti.prototype.possiblyEvaluate = function (t, e) { for (var r = new ni(this._properties), n = 0, i = Object.keys(this._values); n < i.length; n += 1) { var a = i[n]; r._values[a] = this._values[a].possiblyEvaluate(t, e); } return r }, ti.prototype.hasTransition = function () { for (var t = 0, e = Object.keys(this._values); t < e.length; t += 1) { var r = e[t]; if (this._values[r].prior) return !0 } return !1 }; var ei = function (t) { this._properties = t, this._values = Object.create(t.defaultPropertyValues); }; ei.prototype.getValue = function (t) { return b(this._values[t].value) }, ei.prototype.setValue = function (t, e) { this._values[t] = new Yn(this._values[t].property, null === e ? void 0 : b(e)); }, ei.prototype.serialize = function () { for (var t = {}, e = 0, r = Object.keys(this._values); e < r.length; e += 1) { var n = r[e], i = this.getValue(n); void 0 !== i && (t[n] = i); } return t }, ei.prototype.possiblyEvaluate = function (t, e) { for (var r = new ni(this._properties), n = 0, i = Object.keys(this._values); n < i.length; n += 1) { var a = i[n]; r._values[a] = this._values[a].possiblyEvaluate(t, e); } return r }; var ri = function (t, e, r) { this.property = t, this.value = e, this.parameters = r; }; ri.prototype.isConstant = function () { return "constant" === this.value.kind }, ri.prototype.constantOr = function (t) { return "constant" === this.value.kind ? this.value.value : t }, ri.prototype.evaluate = function (t, e, r) { return this.property.evaluate(this.value, this.parameters, t, e, r) }; var ni = function (t) { this._properties = t, this._values = Object.create(t.defaultPossiblyEvaluatedValues); }; ni.prototype.get = function (t) { return this._values[t] }; var ii = function (t) { this.specification = t; }; ii.prototype.possiblyEvaluate = function (t, e) { return t.expression.evaluate(e) }, ii.prototype.interpolate = function (t, e, r) { var n = ze[this.specification.type]; return n ? n(t, e, r) : t }; var ai = function (t, e) { this.specification = t, this.overrides = e; }; ai.prototype.possiblyEvaluate = function (t, e, r) { return "constant" === t.expression.kind || "camera" === t.expression.kind ? new ri(this, { kind: "constant", value: t.expression.evaluate(e, null, {}, r) }, e) : new ri(this, t.expression, e) }, ai.prototype.interpolate = function (t, e, r) { if ("constant" !== t.value.kind || "constant" !== e.value.kind) return t; if (void 0 === t.value.value || void 0 === e.value.value) return new ri(this, { kind: "constant", value: void 0 }, t.parameters); var n = ze[this.specification.type]; return n ? new ri(this, { kind: "constant", value: n(t.value.value, e.value.value, r) }, t.parameters) : t }, ai.prototype.evaluate = function (t, e, r, n, i) { return "constant" === t.kind ? t.value : t.evaluate(e, r, n, i) }; var oi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.possiblyEvaluate = function (t, e, r) { if (void 0 === t.value) return new ri(this, { kind: "constant", value: void 0 }, e); if ("constant" === t.expression.kind) { var n = t.expression.evaluate(e, null, {}, r), i = "resolvedImage" === t.property.specification.type && "string" != typeof n ? n.name : n, a = this._calculate(i, i, i, e); return new ri(this, { kind: "constant", value: a }, e) } if ("camera" === t.expression.kind) { var o = this._calculate(t.expression.evaluate({ zoom: e.zoom - 1 }), t.expression.evaluate({ zoom: e.zoom }), t.expression.evaluate({ zoom: e.zoom + 1 }), e); return new ri(this, { kind: "constant", value: o }, e) } return new ri(this, t.expression, e) }, e.prototype.evaluate = function (t, e, r, n, i) { if ("source" === t.kind) { var a = t.evaluate(e, r, n, i); return this._calculate(a, a, a, e) } return "composite" === t.kind ? this._calculate(t.evaluate({ zoom: Math.floor(e.zoom) - 1 }, r, n), t.evaluate({ zoom: Math.floor(e.zoom) }, r, n), t.evaluate({ zoom: Math.floor(e.zoom) + 1 }, r, n), e) : t.value }, e.prototype._calculate = function (t, e, r, n) { return n.zoom > n.zoomHistory.lastIntegerZoom ? { from: t, to: e } : { from: r, to: e } }, e.prototype.interpolate = function (t) { return t }, e }(ai), si = function (t) { this.specification = t; }; si.prototype.possiblyEvaluate = function (t, e, r) { if (void 0 !== t.value) { if ("constant" === t.expression.kind) { var n = t.expression.evaluate(e, null, {}, r); return this._calculate(n, n, n, e) } return this._calculate(t.expression.evaluate(new Hn(Math.floor(e.zoom - 1), e)), t.expression.evaluate(new Hn(Math.floor(e.zoom), e)), t.expression.evaluate(new Hn(Math.floor(e.zoom + 1), e)), e) } }, si.prototype._calculate = function (t, e, r, n) { return n.zoom > n.zoomHistory.lastIntegerZoom ? { from: t, to: e } : { from: r, to: e } }, si.prototype.interpolate = function (t) { return t }; var ui = function (t) { this.specification = t; }; ui.prototype.possiblyEvaluate = function (t, e, r) { return !!t.expression.evaluate(e, null, {}, r) }, ui.prototype.interpolate = function () { return !1 }; var li = function (t) { for (var e in this.properties = t, this.defaultPropertyValues = {}, this.defaultTransitionablePropertyValues = {}, this.defaultTransitioningPropertyValues = {}, this.defaultPossiblyEvaluatedValues = {}, this.overridableProperties = [], t) { var r = t[e]; r.specification.overridable && this.overridableProperties.push(e); var n = this.defaultPropertyValues[e] = new Yn(r, void 0), i = this.defaultTransitionablePropertyValues[e] = new $n(r); this.defaultTransitioningPropertyValues[e] = i.untransitioned(), this.defaultPossiblyEvaluatedValues[e] = n.possiblyEvaluate({}); } }; An("DataDrivenProperty", ai), An("DataConstantProperty", ii), An("CrossFadedDataDrivenProperty", oi), An("CrossFadedProperty", si), An("ColorRampProperty", ui); var pi = function (t) { function e(e, r) { if (t.call(this), this.id = e.id, this.type = e.type, this._featureFilter = function () { return !0 }, "custom" !== e.type && (e = e, this.metadata = e.metadata, this.minzoom = e.minzoom, this.maxzoom = e.maxzoom, "background" !== e.type && (this.source = e.source, this.sourceLayer = e["source-layer"], this.filter = e.filter), r.layout && (this._unevaluatedLayout = new ei(r.layout)), r.paint)) { for (var n in this._transitionablePaint = new Wn(r.paint), e.paint) this.setPaintProperty(n, e.paint[n], { validate: !1 }); for (var i in e.layout) this.setLayoutProperty(i, e.layout[i], { validate: !1 }); this._transitioningPaint = this._transitionablePaint.untransitioned(); } } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getCrossfadeParameters = function () { return this._crossfadeParameters }, e.prototype.getLayoutProperty = function (t) { return "visibility" === t ? this.visibility : this._unevaluatedLayout.getValue(t) }, e.prototype.setLayoutProperty = function (t, e, r) { if (void 0 === r && (r = {}), null != e) { var n = "layers." + this.id + ".layout." + t; if (this._validate(mn, n, t, e, r)) return } "visibility" !== t ? this._unevaluatedLayout.setValue(t, e) : this.visibility = e; }, e.prototype.getPaintProperty = function (t) { return v(t, "-transition") ? this._transitionablePaint.getTransition(t.slice(0, -"-transition".length)) : this._transitionablePaint.getValue(t) }, e.prototype.setPaintProperty = function (t, e, r) { if (void 0 === r && (r = {}), null != e) { var n = "layers." + this.id + ".paint." + t; if (this._validate(dn, n, t, e, r)) return !1 } if (v(t, "-transition")) return this._transitionablePaint.setTransition(t.slice(0, -"-transition".length), e || void 0), !1; var i = this._transitionablePaint._values[t], a = "cross-faded-data-driven" === i.property.specification["property-type"], o = i.value.isDataDriven(), s = i.value; this._transitionablePaint.setValue(t, e), this._handleSpecialPaintPropertyUpdate(t); var u = this._transitionablePaint._values[t].value; return u.isDataDriven() || o || a || this._handleOverridablePaintPropertyUpdate(t, s, u) }, e.prototype._handleSpecialPaintPropertyUpdate = function (t) { }, e.prototype._handleOverridablePaintPropertyUpdate = function (t, e, r) { return !1 }, e.prototype.isHidden = function (t) { return !!(this.minzoom && t < this.minzoom) || (!!(this.maxzoom && t >= this.maxzoom) || "none" === this.visibility) }, e.prototype.updateTransitions = function (t) { this._transitioningPaint = this._transitionablePaint.transitioned(t, this._transitioningPaint); }, e.prototype.hasTransition = function () { return this._transitioningPaint.hasTransition() }, e.prototype.recalculate = function (t, e) { t.getCrossfadeParameters && (this._crossfadeParameters = t.getCrossfadeParameters()), this._unevaluatedLayout && (this.layout = this._unevaluatedLayout.possiblyEvaluate(t, e)), this.paint = this._transitioningPaint.possiblyEvaluate(t, e); }, e.prototype.serialize = function () { var t = { id: this.id, type: this.type, source: this.source, "source-layer": this.sourceLayer, metadata: this.metadata, minzoom: this.minzoom, maxzoom: this.maxzoom, filter: this.filter, layout: this._unevaluatedLayout && this._unevaluatedLayout.serialize(), paint: this._transitionablePaint && this._transitionablePaint.serialize() }; return this.visibility && (t.layout = t.layout || {}, t.layout.visibility = this.visibility), x(t, (function (t, e) { return !(void 0 === t || "layout" === e && !Object.keys(t).length || "paint" === e && !Object.keys(t).length) })) }, e.prototype._validate = function (t, e, r, n, i) { return void 0 === i && (i = {}), (!i || !1 !== i.validate) && vn(this, t.call(fn, { key: e, layerType: this.type, objectKey: r, value: n, styleSpec: Tt, style: { glyphs: !0, sprite: !0 } })) }, e.prototype.is3D = function () { return !1 }, e.prototype.isTileClipped = function () { return !1 }, e.prototype.hasOffscreenPass = function () { return !1 }, e.prototype.resize = function () { }, e.prototype.isStateDependent = function () { for (var t in this.paint._values) { var e = this.paint.get(t); if (e instanceof ri && xr(e.property.specification) && (("source" === e.value.kind || "composite" === e.value.kind) && e.value.isStateDependent)) return !0 } return !1 }, e }(Bt), ci = { Int8: Int8Array, Uint8: Uint8Array, Int16: Int16Array, Uint16: Uint16Array, Int32: Int32Array, Uint32: Uint32Array, Float32: Float32Array }, hi = function (t, e) { this._structArray = t, this._pos1 = e * this.size, this._pos2 = this._pos1 / 2, this._pos4 = this._pos1 / 4, this._pos8 = this._pos1 / 8; }, fi = function () { this.isTransferred = !1, this.capacity = -1, this.resize(0); }; function yi(t, e) { void 0 === e && (e = 1); var r = 0, n = 0; return { members: t.map((function (t) { var i, a = (i = t.type, ci[i].BYTES_PER_ELEMENT), o = r = di(r, Math.max(e, a)), s = t.components || 1; return n = Math.max(n, a), r += a * s, { name: t.name, type: t.type, components: s, offset: o } })), size: di(r, Math.max(n, e)), alignment: e } } function di(t, e) { return Math.ceil(t / e) * e } fi.serialize = function (t, e) { return t._trim(), e && (t.isTransferred = !0, e.push(t.arrayBuffer)), { length: t.length, arrayBuffer: t.arrayBuffer } }, fi.deserialize = function (t) { var e = Object.create(this.prototype); return e.arrayBuffer = t.arrayBuffer, e.length = t.length, e.capacity = t.arrayBuffer.byteLength / e.bytesPerElement, e._refreshViews(), e }, fi.prototype._trim = function () { this.length !== this.capacity && (this.capacity = this.length, this.arrayBuffer = this.arrayBuffer.slice(0, this.length * this.bytesPerElement), this._refreshViews()); }, fi.prototype.clear = function () { this.length = 0; }, fi.prototype.resize = function (t) { this.reserve(t), this.length = t; }, fi.prototype.reserve = function (t) { if (t > this.capacity) { this.capacity = Math.max(t, Math.floor(5 * this.capacity), 128), this.arrayBuffer = new ArrayBuffer(this.capacity * this.bytesPerElement); var e = this.uint8; this._refreshViews(), e && this.uint8.set(e); } }, fi.prototype._refreshViews = function () { throw new Error("_refreshViews() must be implemented by each concrete StructArray layout") }; var mi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e) { var r = this.length; return this.resize(r + 1), this.emplace(r, t, e) }, e.prototype.emplace = function (t, e, r) { var n = 2 * t; return this.int16[n + 0] = e, this.int16[n + 1] = r, t }, e }(fi); mi.prototype.bytesPerElement = 4, An("StructArrayLayout2i4", mi); var vi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n) { var i = this.length; return this.resize(i + 1), this.emplace(i, t, e, r, n) }, e.prototype.emplace = function (t, e, r, n, i) { var a = 4 * t; return this.int16[a + 0] = e, this.int16[a + 1] = r, this.int16[a + 2] = n, this.int16[a + 3] = i, t }, e }(fi); vi.prototype.bytesPerElement = 8, An("StructArrayLayout4i8", vi); var gi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n, i, a) { var o = this.length; return this.resize(o + 1), this.emplace(o, t, e, r, n, i, a) }, e.prototype.emplace = function (t, e, r, n, i, a, o) { var s = 6 * t; return this.int16[s + 0] = e, this.int16[s + 1] = r, this.int16[s + 2] = n, this.int16[s + 3] = i, this.int16[s + 4] = a, this.int16[s + 5] = o, t }, e }(fi); gi.prototype.bytesPerElement = 12, An("StructArrayLayout2i4i12", gi); var xi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n, i, a) { var o = this.length; return this.resize(o + 1), this.emplace(o, t, e, r, n, i, a) }, e.prototype.emplace = function (t, e, r, n, i, a, o) { var s = 4 * t, u = 8 * t; return this.int16[s + 0] = e, this.int16[s + 1] = r, this.uint8[u + 4] = n, this.uint8[u + 5] = i, this.uint8[u + 6] = a, this.uint8[u + 7] = o, t }, e }(fi); xi.prototype.bytesPerElement = 8, An("StructArrayLayout2i4ub8", xi); var bi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n, i, a, o, s) { var u = this.length; return this.resize(u + 1), this.emplace(u, t, e, r, n, i, a, o, s) }, e.prototype.emplace = function (t, e, r, n, i, a, o, s, u) { var l = 8 * t; return this.uint16[l + 0] = e, this.uint16[l + 1] = r, this.uint16[l + 2] = n, this.uint16[l + 3] = i, this.uint16[l + 4] = a, this.uint16[l + 5] = o, this.uint16[l + 6] = s, this.uint16[l + 7] = u, t }, e }(fi); bi.prototype.bytesPerElement = 16, An("StructArrayLayout8ui16", bi); var _i = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n, i, a, o, s, u, l, p, c) { var h = this.length; return this.resize(h + 1), this.emplace(h, t, e, r, n, i, a, o, s, u, l, p, c) }, e.prototype.emplace = function (t, e, r, n, i, a, o, s, u, l, p, c, h) { var f = 12 * t; return this.int16[f + 0] = e, this.int16[f + 1] = r, this.int16[f + 2] = n, this.int16[f + 3] = i, this.uint16[f + 4] = a, this.uint16[f + 5] = o, this.uint16[f + 6] = s, this.uint16[f + 7] = u, this.int16[f + 8] = l, this.int16[f + 9] = p, this.int16[f + 10] = c, this.int16[f + 11] = h, t }, e }(fi); _i.prototype.bytesPerElement = 24, An("StructArrayLayout4i4ui4i24", _i); var wi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r) { var n = this.length; return this.resize(n + 1), this.emplace(n, t, e, r) }, e.prototype.emplace = function (t, e, r, n) { var i = 3 * t; return this.float32[i + 0] = e, this.float32[i + 1] = r, this.float32[i + 2] = n, t }, e }(fi); wi.prototype.bytesPerElement = 12, An("StructArrayLayout3f12", wi); var Ai = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t) { var e = this.length; return this.resize(e + 1), this.emplace(e, t) }, e.prototype.emplace = function (t, e) { var r = 1 * t; return this.uint32[r + 0] = e, t }, e }(fi); Ai.prototype.bytesPerElement = 4, An("StructArrayLayout1ul4", Ai); var Si = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n, i, a, o, s, u, l, p) { var c = this.length; return this.resize(c + 1), this.emplace(c, t, e, r, n, i, a, o, s, u, l, p) }, e.prototype.emplace = function (t, e, r, n, i, a, o, s, u, l, p, c) { var h = 12 * t, f = 6 * t; return this.int16[h + 0] = e, this.int16[h + 1] = r, this.int16[h + 2] = n, this.int16[h + 3] = i, this.int16[h + 4] = a, this.int16[h + 5] = o, this.uint32[f + 3] = s, this.uint16[h + 8] = u, this.uint16[h + 9] = l, this.int16[h + 10] = p, this.int16[h + 11] = c, t }, e }(fi); Si.prototype.bytesPerElement = 24, An("StructArrayLayout6i1ul2ui2i24", Si); var ki = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n, i, a) { var o = this.length; return this.resize(o + 1), this.emplace(o, t, e, r, n, i, a) }, e.prototype.emplace = function (t, e, r, n, i, a, o) { var s = 6 * t; return this.int16[s + 0] = e, this.int16[s + 1] = r, this.int16[s + 2] = n, this.int16[s + 3] = i, this.int16[s + 4] = a, this.int16[s + 5] = o, t }, e }(fi); ki.prototype.bytesPerElement = 12, An("StructArrayLayout2i2i2i12", ki); var Ii = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n) { var i = this.length; return this.resize(i + 1), this.emplace(i, t, e, r, n) }, e.prototype.emplace = function (t, e, r, n, i) { var a = 12 * t, o = 3 * t; return this.uint8[a + 0] = e, this.uint8[a + 1] = r, this.float32[o + 1] = n, this.float32[o + 2] = i, t }, e }(fi); Ii.prototype.bytesPerElement = 12, An("StructArrayLayout2ub2f12", Ii); var zi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n, i, a, o, s, u, l, p, c, h, f, y, d, m) { var v = this.length; return this.resize(v + 1), this.emplace(v, t, e, r, n, i, a, o, s, u, l, p, c, h, f, y, d, m) }, e.prototype.emplace = function (t, e, r, n, i, a, o, s, u, l, p, c, h, f, y, d, m, v) { var g = 24 * t, x = 12 * t, b = 48 * t; return this.int16[g + 0] = e, this.int16[g + 1] = r, this.uint16[g + 2] = n, this.uint16[g + 3] = i, this.uint32[x + 2] = a, this.uint32[x + 3] = o, this.uint32[x + 4] = s, this.uint16[g + 10] = u, this.uint16[g + 11] = l, this.uint16[g + 12] = p, this.float32[x + 7] = c, this.float32[x + 8] = h, this.uint8[b + 36] = f, this.uint8[b + 37] = y, this.uint8[b + 38] = d, this.uint32[x + 10] = m, this.int16[g + 22] = v, t }, e }(fi); zi.prototype.bytesPerElement = 48, An("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48", zi); var Ci = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n, i, a, o, s, u, l, p, c, h, f, y, d, m, v, g, x, b, _, w, A, S, k) { var I = this.length; return this.resize(I + 1), this.emplace(I, t, e, r, n, i, a, o, s, u, l, p, c, h, f, y, d, m, v, g, x, b, _, w, A, S, k) }, e.prototype.emplace = function (t, e, r, n, i, a, o, s, u, l, p, c, h, f, y, d, m, v, g, x, b, _, w, A, S, k, I) { var z = 30 * t, C = 15 * t; return this.int16[z + 0] = e, this.int16[z + 1] = r, this.int16[z + 2] = n, this.int16[z + 3] = i, this.int16[z + 4] = a, this.int16[z + 5] = o, this.int16[z + 6] = s, this.int16[z + 7] = u, this.uint16[z + 8] = l, this.uint16[z + 9] = p, this.uint16[z + 10] = c, this.uint16[z + 11] = h, this.uint16[z + 12] = f, this.uint16[z + 13] = y, this.uint16[z + 14] = d, this.uint16[z + 15] = m, this.uint16[z + 16] = v, this.uint16[z + 17] = g, this.uint16[z + 18] = x, this.uint16[z + 19] = b, this.uint16[z + 20] = _, this.uint16[z + 21] = w, this.uint32[C + 11] = A, this.float32[C + 12] = S, this.float32[C + 13] = k, this.float32[C + 14] = I, t }, e }(fi); Ci.prototype.bytesPerElement = 60, An("StructArrayLayout8i14ui1ul3f60", Ci); var Bi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t) { var e = this.length; return this.resize(e + 1), this.emplace(e, t) }, e.prototype.emplace = function (t, e) { var r = 1 * t; return this.float32[r + 0] = e, t }, e }(fi); Bi.prototype.bytesPerElement = 4, An("StructArrayLayout1f4", Bi); var Ti = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.int16 = new Int16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r) { var n = this.length; return this.resize(n + 1), this.emplace(n, t, e, r) }, e.prototype.emplace = function (t, e, r, n) { var i = 3 * t; return this.int16[i + 0] = e, this.int16[i + 1] = r, this.int16[i + 2] = n, t }, e }(fi); Ti.prototype.bytesPerElement = 6, An("StructArrayLayout3i6", Ti); var Pi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint32 = new Uint32Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r) { var n = this.length; return this.resize(n + 1), this.emplace(n, t, e, r) }, e.prototype.emplace = function (t, e, r, n) { var i = 2 * t, a = 4 * t; return this.uint32[i + 0] = e, this.uint16[a + 2] = r, this.uint16[a + 3] = n, t }, e }(fi); Pi.prototype.bytesPerElement = 8, An("StructArrayLayout1ul2ui8", Pi); var Ei = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r) { var n = this.length; return this.resize(n + 1), this.emplace(n, t, e, r) }, e.prototype.emplace = function (t, e, r, n) { var i = 3 * t; return this.uint16[i + 0] = e, this.uint16[i + 1] = r, this.uint16[i + 2] = n, t }, e }(fi); Ei.prototype.bytesPerElement = 6, An("StructArrayLayout3ui6", Ei); var Mi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e) { var r = this.length; return this.resize(r + 1), this.emplace(r, t, e) }, e.prototype.emplace = function (t, e, r) { var n = 2 * t; return this.uint16[n + 0] = e, this.uint16[n + 1] = r, t }, e }(fi); Mi.prototype.bytesPerElement = 4, An("StructArrayLayout2ui4", Mi); var Vi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.uint16 = new Uint16Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t) { var e = this.length; return this.resize(e + 1), this.emplace(e, t) }, e.prototype.emplace = function (t, e) { var r = 1 * t; return this.uint16[r + 0] = e, t }, e }(fi); Vi.prototype.bytesPerElement = 2, An("StructArrayLayout1ui2", Vi); var Fi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e) { var r = this.length; return this.resize(r + 1), this.emplace(r, t, e) }, e.prototype.emplace = function (t, e, r) { var n = 2 * t; return this.float32[n + 0] = e, this.float32[n + 1] = r, t }, e }(fi); Fi.prototype.bytesPerElement = 8, An("StructArrayLayout2f8", Fi); var Li = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._refreshViews = function () { this.uint8 = new Uint8Array(this.arrayBuffer), this.float32 = new Float32Array(this.arrayBuffer); }, e.prototype.emplaceBack = function (t, e, r, n) { var i = this.length; return this.resize(i + 1), this.emplace(i, t, e, r, n) }, e.prototype.emplace = function (t, e, r, n, i) { var a = 4 * t; return this.float32[a + 0] = e, this.float32[a + 1] = r, this.float32[a + 2] = n, this.float32[a + 3] = i, t }, e }(fi); Li.prototype.bytesPerElement = 16, An("StructArrayLayout4f16", Li); var Oi = function (t) { function e() { t.apply(this, arguments); } t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e; var r = { anchorPointX: { configurable: !0 }, anchorPointY: { configurable: !0 }, x1: { configurable: !0 }, y1: { configurable: !0 }, x2: { configurable: !0 }, y2: { configurable: !0 }, featureIndex: { configurable: !0 }, sourceLayerIndex: { configurable: !0 }, bucketIndex: { configurable: !0 }, radius: { configurable: !0 }, signedDistanceFromAnchor: { configurable: !0 }, anchorPoint: { configurable: !0 } }; return r.anchorPointX.get = function () { return this._structArray.int16[this._pos2 + 0] }, r.anchorPointX.set = function (t) { this._structArray.int16[this._pos2 + 0] = t; }, r.anchorPointY.get = function () { return this._structArray.int16[this._pos2 + 1] }, r.anchorPointY.set = function (t) { this._structArray.int16[this._pos2 + 1] = t; }, r.x1.get = function () { return this._structArray.int16[this._pos2 + 2] }, r.x1.set = function (t) { this._structArray.int16[this._pos2 + 2] = t; }, r.y1.get = function () { return this._structArray.int16[this._pos2 + 3] }, r.y1.set = function (t) { this._structArray.int16[this._pos2 + 3] = t; }, r.x2.get = function () { return this._structArray.int16[this._pos2 + 4] }, r.x2.set = function (t) { this._structArray.int16[this._pos2 + 4] = t; }, r.y2.get = function () { return this._structArray.int16[this._pos2 + 5] }, r.y2.set = function (t) { this._structArray.int16[this._pos2 + 5] = t; }, r.featureIndex.get = function () { return this._structArray.uint32[this._pos4 + 3] }, r.featureIndex.set = function (t) { this._structArray.uint32[this._pos4 + 3] = t; }, r.sourceLayerIndex.get = function () { return this._structArray.uint16[this._pos2 + 8] }, r.sourceLayerIndex.set = function (t) { this._structArray.uint16[this._pos2 + 8] = t; }, r.bucketIndex.get = function () { return this._structArray.uint16[this._pos2 + 9] }, r.bucketIndex.set = function (t) { this._structArray.uint16[this._pos2 + 9] = t; }, r.radius.get = function () { return this._structArray.int16[this._pos2 + 10] }, r.radius.set = function (t) { this._structArray.int16[this._pos2 + 10] = t; }, r.signedDistanceFromAnchor.get = function () { return this._structArray.int16[this._pos2 + 11] }, r.signedDistanceFromAnchor.set = function (t) { this._structArray.int16[this._pos2 + 11] = t; }, r.anchorPoint.get = function () { return new i(this.anchorPointX, this.anchorPointY) }, Object.defineProperties(e.prototype, r), e }(hi); Oi.prototype.size = 24; var Di = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.get = function (t) { return new Oi(this, t) }, e }(Si); An("CollisionBoxArray", Di); var Ri = function (t) { function e() { t.apply(this, arguments); } t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e; var r = { anchorX: { configurable: !0 }, anchorY: { configurable: !0 }, glyphStartIndex: { configurable: !0 }, numGlyphs: { configurable: !0 }, vertexStartIndex: { configurable: !0 }, lineStartIndex: { configurable: !0 }, lineLength: { configurable: !0 }, segment: { configurable: !0 }, lowerSize: { configurable: !0 }, upperSize: { configurable: !0 }, lineOffsetX: { configurable: !0 }, lineOffsetY: { configurable: !0 }, writingMode: { configurable: !0 }, placedOrientation: { configurable: !0 }, hidden: { configurable: !0 }, crossTileID: { configurable: !0 }, associatedIconIndex: { configurable: !0 } }; return r.anchorX.get = function () { return this._structArray.int16[this._pos2 + 0] }, r.anchorX.set = function (t) { this._structArray.int16[this._pos2 + 0] = t; }, r.anchorY.get = function () { return this._structArray.int16[this._pos2 + 1] }, r.anchorY.set = function (t) { this._structArray.int16[this._pos2 + 1] = t; }, r.glyphStartIndex.get = function () { return this._structArray.uint16[this._pos2 + 2] }, r.glyphStartIndex.set = function (t) { this._structArray.uint16[this._pos2 + 2] = t; }, r.numGlyphs.get = function () { return this._structArray.uint16[this._pos2 + 3] }, r.numGlyphs.set = function (t) { this._structArray.uint16[this._pos2 + 3] = t; }, r.vertexStartIndex.get = function () { return this._structArray.uint32[this._pos4 + 2] }, r.vertexStartIndex.set = function (t) { this._structArray.uint32[this._pos4 + 2] = t; }, r.lineStartIndex.get = function () { return this._structArray.uint32[this._pos4 + 3] }, r.lineStartIndex.set = function (t) { this._structArray.uint32[this._pos4 + 3] = t; }, r.lineLength.get = function () { return this._structArray.uint32[this._pos4 + 4] }, r.lineLength.set = function (t) { this._structArray.uint32[this._pos4 + 4] = t; }, r.segment.get = function () { return this._structArray.uint16[this._pos2 + 10] }, r.segment.set = function (t) { this._structArray.uint16[this._pos2 + 10] = t; }, r.lowerSize.get = function () { return this._structArray.uint16[this._pos2 + 11] }, r.lowerSize.set = function (t) { this._structArray.uint16[this._pos2 + 11] = t; }, r.upperSize.get = function () { return this._structArray.uint16[this._pos2 + 12] }, r.upperSize.set = function (t) { this._structArray.uint16[this._pos2 + 12] = t; }, r.lineOffsetX.get = function () { return this._structArray.float32[this._pos4 + 7] }, r.lineOffsetX.set = function (t) { this._structArray.float32[this._pos4 + 7] = t; }, r.lineOffsetY.get = function () { return this._structArray.float32[this._pos4 + 8] }, r.lineOffsetY.set = function (t) { this._structArray.float32[this._pos4 + 8] = t; }, r.writingMode.get = function () { return this._structArray.uint8[this._pos1 + 36] }, r.writingMode.set = function (t) { this._structArray.uint8[this._pos1 + 36] = t; }, r.placedOrientation.get = function () { return this._structArray.uint8[this._pos1 + 37] }, r.placedOrientation.set = function (t) { this._structArray.uint8[this._pos1 + 37] = t; }, r.hidden.get = function () { return this._structArray.uint8[this._pos1 + 38] }, r.hidden.set = function (t) { this._structArray.uint8[this._pos1 + 38] = t; }, r.crossTileID.get = function () { return this._structArray.uint32[this._pos4 + 10] }, r.crossTileID.set = function (t) { this._structArray.uint32[this._pos4 + 10] = t; }, r.associatedIconIndex.get = function () { return this._structArray.int16[this._pos2 + 22] }, r.associatedIconIndex.set = function (t) { this._structArray.int16[this._pos2 + 22] = t; }, Object.defineProperties(e.prototype, r), e }(hi); Ri.prototype.size = 48; var Ui = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.get = function (t) { return new Ri(this, t) }, e }(zi); An("PlacedSymbolArray", Ui); var ji = function (t) { function e() { t.apply(this, arguments); } t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e; var r = { anchorX: { configurable: !0 }, anchorY: { configurable: !0 }, rightJustifiedTextSymbolIndex: { configurable: !0 }, centerJustifiedTextSymbolIndex: { configurable: !0 }, leftJustifiedTextSymbolIndex: { configurable: !0 }, verticalPlacedTextSymbolIndex: { configurable: !0 }, placedIconSymbolIndex: { configurable: !0 }, verticalPlacedIconSymbolIndex: { configurable: !0 }, key: { configurable: !0 }, textBoxStartIndex: { configurable: !0 }, textBoxEndIndex: { configurable: !0 }, verticalTextBoxStartIndex: { configurable: !0 }, verticalTextBoxEndIndex: { configurable: !0 }, iconBoxStartIndex: { configurable: !0 }, iconBoxEndIndex: { configurable: !0 }, verticalIconBoxStartIndex: { configurable: !0 }, verticalIconBoxEndIndex: { configurable: !0 }, featureIndex: { configurable: !0 }, numHorizontalGlyphVertices: { configurable: !0 }, numVerticalGlyphVertices: { configurable: !0 }, numIconVertices: { configurable: !0 }, numVerticalIconVertices: { configurable: !0 }, crossTileID: { configurable: !0 }, textBoxScale: { configurable: !0 }, textOffset0: { configurable: !0 }, textOffset1: { configurable: !0 } }; return r.anchorX.get = function () { return this._structArray.int16[this._pos2 + 0] }, r.anchorX.set = function (t) { this._structArray.int16[this._pos2 + 0] = t; }, r.anchorY.get = function () { return this._structArray.int16[this._pos2 + 1] }, r.anchorY.set = function (t) { this._structArray.int16[this._pos2 + 1] = t; }, r.rightJustifiedTextSymbolIndex.get = function () { return this._structArray.int16[this._pos2 + 2] }, r.rightJustifiedTextSymbolIndex.set = function (t) { this._structArray.int16[this._pos2 + 2] = t; }, r.centerJustifiedTextSymbolIndex.get = function () { return this._structArray.int16[this._pos2 + 3] }, r.centerJustifiedTextSymbolIndex.set = function (t) { this._structArray.int16[this._pos2 + 3] = t; }, r.leftJustifiedTextSymbolIndex.get = function () { return this._structArray.int16[this._pos2 + 4] }, r.leftJustifiedTextSymbolIndex.set = function (t) { this._structArray.int16[this._pos2 + 4] = t; }, r.verticalPlacedTextSymbolIndex.get = function () { return this._structArray.int16[this._pos2 + 5] }, r.verticalPlacedTextSymbolIndex.set = function (t) { this._structArray.int16[this._pos2 + 5] = t; }, r.placedIconSymbolIndex.get = function () { return this._structArray.int16[this._pos2 + 6] }, r.placedIconSymbolIndex.set = function (t) { this._structArray.int16[this._pos2 + 6] = t; }, r.verticalPlacedIconSymbolIndex.get = function () { return this._structArray.int16[this._pos2 + 7] }, r.verticalPlacedIconSymbolIndex.set = function (t) { this._structArray.int16[this._pos2 + 7] = t; }, r.key.get = function () { return this._structArray.uint16[this._pos2 + 8] }, r.key.set = function (t) { this._structArray.uint16[this._pos2 + 8] = t; }, r.textBoxStartIndex.get = function () { return this._structArray.uint16[this._pos2 + 9] }, r.textBoxStartIndex.set = function (t) { this._structArray.uint16[this._pos2 + 9] = t; }, r.textBoxEndIndex.get = function () { return this._structArray.uint16[this._pos2 + 10] }, r.textBoxEndIndex.set = function (t) { this._structArray.uint16[this._pos2 + 10] = t; }, r.verticalTextBoxStartIndex.get = function () { return this._structArray.uint16[this._pos2 + 11] }, r.verticalTextBoxStartIndex.set = function (t) { this._structArray.uint16[this._pos2 + 11] = t; }, r.verticalTextBoxEndIndex.get = function () { return this._structArray.uint16[this._pos2 + 12] }, r.verticalTextBoxEndIndex.set = function (t) { this._structArray.uint16[this._pos2 + 12] = t; }, r.iconBoxStartIndex.get = function () { return this._structArray.uint16[this._pos2 + 13] }, r.iconBoxStartIndex.set = function (t) { this._structArray.uint16[this._pos2 + 13] = t; }, r.iconBoxEndIndex.get = function () { return this._structArray.uint16[this._pos2 + 14] }, r.iconBoxEndIndex.set = function (t) { this._structArray.uint16[this._pos2 + 14] = t; }, r.verticalIconBoxStartIndex.get = function () { return this._structArray.uint16[this._pos2 + 15] }, r.verticalIconBoxStartIndex.set = function (t) { this._structArray.uint16[this._pos2 + 15] = t; }, r.verticalIconBoxEndIndex.get = function () { return this._structArray.uint16[this._pos2 + 16] }, r.verticalIconBoxEndIndex.set = function (t) { this._structArray.uint16[this._pos2 + 16] = t; }, r.featureIndex.get = function () { return this._structArray.uint16[this._pos2 + 17] }, r.featureIndex.set = function (t) { this._structArray.uint16[this._pos2 + 17] = t; }, r.numHorizontalGlyphVertices.get = function () { return this._structArray.uint16[this._pos2 + 18] }, r.numHorizontalGlyphVertices.set = function (t) { this._structArray.uint16[this._pos2 + 18] = t; }, r.numVerticalGlyphVertices.get = function () { return this._structArray.uint16[this._pos2 + 19] }, r.numVerticalGlyphVertices.set = function (t) { this._structArray.uint16[this._pos2 + 19] = t; }, r.numIconVertices.get = function () { return this._structArray.uint16[this._pos2 + 20] }, r.numIconVertices.set = function (t) { this._structArray.uint16[this._pos2 + 20] = t; }, r.numVerticalIconVertices.get = function () { return this._structArray.uint16[this._pos2 + 21] }, r.numVerticalIconVertices.set = function (t) { this._structArray.uint16[this._pos2 + 21] = t; }, r.crossTileID.get = function () { return this._structArray.uint32[this._pos4 + 11] }, r.crossTileID.set = function (t) { this._structArray.uint32[this._pos4 + 11] = t; }, r.textBoxScale.get = function () { return this._structArray.float32[this._pos4 + 12] }, r.textBoxScale.set = function (t) { this._structArray.float32[this._pos4 + 12] = t; }, r.textOffset0.get = function () { return this._structArray.float32[this._pos4 + 13] }, r.textOffset0.set = function (t) { this._structArray.float32[this._pos4 + 13] = t; }, r.textOffset1.get = function () { return this._structArray.float32[this._pos4 + 14] }, r.textOffset1.set = function (t) { this._structArray.float32[this._pos4 + 14] = t; }, Object.defineProperties(e.prototype, r), e }(hi); ji.prototype.size = 60; var qi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.get = function (t) { return new ji(this, t) }, e }(Ci); An("SymbolInstanceArray", qi); var Ni = function (t) { function e() { t.apply(this, arguments); } t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e; var r = { offsetX: { configurable: !0 } }; return r.offsetX.get = function () { return this._structArray.float32[this._pos4 + 0] }, r.offsetX.set = function (t) { this._structArray.float32[this._pos4 + 0] = t; }, Object.defineProperties(e.prototype, r), e }(hi); Ni.prototype.size = 4; var Ki = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getoffsetX = function (t) { return this.float32[1 * t + 0] }, e.prototype.get = function (t) { return new Ni(this, t) }, e }(Bi); An("GlyphOffsetArray", Ki); var Xi = function (t) { function e() { t.apply(this, arguments); } t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e; var r = { x: { configurable: !0 }, y: { configurable: !0 }, tileUnitDistanceFromAnchor: { configurable: !0 } }; return r.x.get = function () { return this._structArray.int16[this._pos2 + 0] }, r.x.set = function (t) { this._structArray.int16[this._pos2 + 0] = t; }, r.y.get = function () { return this._structArray.int16[this._pos2 + 1] }, r.y.set = function (t) { this._structArray.int16[this._pos2 + 1] = t; }, r.tileUnitDistanceFromAnchor.get = function () { return this._structArray.int16[this._pos2 + 2] }, r.tileUnitDistanceFromAnchor.set = function (t) { this._structArray.int16[this._pos2 + 2] = t; }, Object.defineProperties(e.prototype, r), e }(hi); Xi.prototype.size = 6; var Zi = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getx = function (t) { return this.int16[3 * t + 0] }, e.prototype.gety = function (t) { return this.int16[3 * t + 1] }, e.prototype.gettileUnitDistanceFromAnchor = function (t) { return this.int16[3 * t + 2] }, e.prototype.get = function (t) { return new Xi(this, t) }, e }(Ti); An("SymbolLineVertexArray", Zi); var Gi = function (t) { function e() { t.apply(this, arguments); } t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e; var r = { featureIndex: { configurable: !0 }, sourceLayerIndex: { configurable: !0 }, bucketIndex: { configurable: !0 } }; return r.featureIndex.get = function () { return this._structArray.uint32[this._pos4 + 0] }, r.featureIndex.set = function (t) { this._structArray.uint32[this._pos4 + 0] = t; }, r.sourceLayerIndex.get = function () { return this._structArray.uint16[this._pos2 + 2] }, r.sourceLayerIndex.set = function (t) { this._structArray.uint16[this._pos2 + 2] = t; }, r.bucketIndex.get = function () { return this._structArray.uint16[this._pos2 + 3] }, r.bucketIndex.set = function (t) { this._structArray.uint16[this._pos2 + 3] = t; }, Object.defineProperties(e.prototype, r), e }(hi); Gi.prototype.size = 8; var Ji = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.get = function (t) { return new Gi(this, t) }, e }(Pi); An("FeatureIndexArray", Ji); var Hi = yi([{ name: "a_pos", components: 2, type: "Int16" }], 4).members, Yi = function (t) { void 0 === t && (t = []), this.segments = t; }; function $i(t, e) { return 256 * (t = l(Math.floor(t), 0, 255)) + (e = l(Math.floor(e), 0, 255)) } Yi.prototype.prepareSegment = function (t, e, r, n) { var i = this.segments[this.segments.length - 1]; return t > Yi.MAX_VERTEX_ARRAY_LENGTH && w("Max vertices per segment is " + Yi.MAX_VERTEX_ARRAY_LENGTH + ": bucket requested " + t), (!i || i.vertexLength + t > Yi.MAX_VERTEX_ARRAY_LENGTH || i.sortKey !== n) && (i = { vertexOffset: e.length, primitiveOffset: r.length, vertexLength: 0, primitiveLength: 0 }, void 0 !== n && (i.sortKey = n), this.segments.push(i)), i }, Yi.prototype.get = function () { return this.segments }, Yi.prototype.destroy = function () { for (var t = 0, e = this.segments; t < e.length; t += 1) { var r = e[t]; for (var n in r.vaos) r.vaos[n].destroy(); } }, Yi.simpleSegment = function (t, e, r, n) { return new Yi([{ vertexOffset: t, primitiveOffset: e, vertexLength: r, primitiveLength: n, vaos: {}, sortKey: 0 }]) }, Yi.MAX_VERTEX_ARRAY_LENGTH = Math.pow(2, 16) - 1, An("SegmentVector", Yi); var Wi = function () { this.ids = [], this.positions = [], this.indexed = !1; }; function Qi(t, e, r) { var n = t[e]; t[e] = t[r], t[r] = n; } Wi.prototype.add = function (t, e, r, n) { this.ids.push(t), this.positions.push(e, r, n); }, Wi.prototype.getPositions = function (t) { for (var e = 0, r = this.ids.length - 1; e < r;) { var n = e + r >> 1; this.ids[n] >= t ? r = n : e = n + 1; } for (var i = []; this.ids[e] === t;) { var a = this.positions[3 * e], o = this.positions[3 * e + 1], s = this.positions[3 * e + 2]; i.push({ index: a, start: o, end: s }), e++; } return i }, Wi.serialize = function (t, e) { var r = new Float64Array(t.ids), n = new Uint32Array(t.positions); return function t(e, r, n, i) { if (n >= i) return; var a = e[n + i >> 1]; var o = n - 1; var s = i + 1; for (; ;) { do { o++; } while (e[o] < a); do { s--; } while (e[s] > a); if (o >= s) break; Qi(e, o, s), Qi(r, 3 * o, 3 * s), Qi(r, 3 * o + 1, 3 * s + 1), Qi(r, 3 * o + 2, 3 * s + 2); } t(e, r, n, s); t(e, r, s + 1, i); }(r, n, 0, r.length - 1), e && e.push(r.buffer, n.buffer), { ids: r, positions: n } }, Wi.deserialize = function (t) { var e = new Wi; return e.ids = t.ids, e.positions = t.positions, e.indexed = !0, e }, An("FeaturePositionMap", Wi); var ta = function (t, e) { this.gl = t.gl, this.location = e; }, ea = function (t) { function e(e, r) { t.call(this, e, r), this.current = 0; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.set = function (t) { this.current !== t && (this.current = t, this.gl.uniform1i(this.location, t)); }, e }(ta), ra = function (t) { function e(e, r) { t.call(this, e, r), this.current = 0; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.set = function (t) { this.current !== t && (this.current = t, this.gl.uniform1f(this.location, t)); }, e }(ta), na = function (t) { function e(e, r) { t.call(this, e, r), this.current = [0, 0]; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.set = function (t) { t[0] === this.current[0] && t[1] === this.current[1] || (this.current = t, this.gl.uniform2f(this.location, t[0], t[1])); }, e }(ta), ia = function (t) { function e(e, r) { t.call(this, e, r), this.current = [0, 0, 0]; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.set = function (t) { t[0] === this.current[0] && t[1] === this.current[1] && t[2] === this.current[2] || (this.current = t, this.gl.uniform3f(this.location, t[0], t[1], t[2])); }, e }(ta), aa = function (t) { function e(e, r) { t.call(this, e, r), this.current = [0, 0, 0, 0]; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.set = function (t) { t[0] === this.current[0] && t[1] === this.current[1] && t[2] === this.current[2] && t[3] === this.current[3] || (this.current = t, this.gl.uniform4f(this.location, t[0], t[1], t[2], t[3])); }, e }(ta), oa = function (t) { function e(e, r) { t.call(this, e, r), this.current = Qt.transparent; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.set = function (t) { t.r === this.current.r && t.g === this.current.g && t.b === this.current.b && t.a === this.current.a || (this.current = t, this.gl.uniform4f(this.location, t.r, t.g, t.b, t.a)); }, e }(ta), sa = new Float32Array(16), ua = function (t) { function e(e, r) { t.call(this, e, r), this.current = sa; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.set = function (t) { if (t[12] !== this.current[12] || t[0] !== this.current[0]) return this.current = t, void this.gl.uniformMatrix4fv(this.location, !1, t); for (var e = 1; e < 16; e++)if (t[e] !== this.current[e]) { this.current = t, this.gl.uniformMatrix4fv(this.location, !1, t); break } }, e }(ta); function la(t) { return [$i(255 * t.r, 255 * t.g), $i(255 * t.b, 255 * t.a)] } var pa = function (t, e, r) { this.value = t, this.names = e, this.uniformNames = this.names.map((function (t) { return "u_" + t })), this.type = r, this.maxValue = -1 / 0; }; pa.prototype.defines = function () { return this.names.map((function (t) { return "#define HAS_UNIFORM_u_" + t })) }, pa.prototype.setConstantPatternPositions = function () { }, pa.prototype.populatePaintArray = function () { }, pa.prototype.updatePaintArray = function () { }, pa.prototype.upload = function () { }, pa.prototype.destroy = function () { }, pa.prototype.setUniforms = function (t, e, r, n) { e.set(n.constantOr(this.value)); }, pa.prototype.getBinding = function (t, e) { return "color" === this.type ? new oa(t, e) : new ra(t, e) }, pa.serialize = function (t) { var e = t.value, r = t.names, n = t.type; return { value: In(e), names: r, type: n } }, pa.deserialize = function (t) { var e = t.value, r = t.names, n = t.type; return new pa(zn(e), r, n) }; var ca = function (t, e, r) { this.value = t, this.names = e, this.uniformNames = this.names.map((function (t) { return "u_" + t })), this.type = r, this.maxValue = -1 / 0, this.patternPositions = { patternTo: null, patternFrom: null }; }; ca.prototype.defines = function () { return this.names.map((function (t) { return "#define HAS_UNIFORM_u_" + t })) }, ca.prototype.populatePaintArray = function () { }, ca.prototype.updatePaintArray = function () { }, ca.prototype.upload = function () { }, ca.prototype.destroy = function () { }, ca.prototype.setConstantPatternPositions = function (t, e) { this.patternPositions.patternTo = t.tlbr, this.patternPositions.patternFrom = e.tlbr; }, ca.prototype.setUniforms = function (t, e, r, n, i) { var a = this.patternPositions; "u_pattern_to" === i && a.patternTo && e.set(a.patternTo), "u_pattern_from" === i && a.patternFrom && e.set(a.patternFrom); }, ca.prototype.getBinding = function (t, e) { return new aa(t, e) }; var ha = function (t, e, r, n) { this.expression = t, this.names = e, this.type = r, this.uniformNames = this.names.map((function (t) { return "a_" + t })), this.maxValue = -1 / 0, this.paintVertexAttributes = e.map((function (t) { return { name: "a_" + t, type: "Float32", components: "color" === r ? 2 : 1, offset: 0 } })), this.paintVertexArray = new n; }; ha.prototype.defines = function () { return [] }, ha.prototype.setConstantPatternPositions = function () { }, ha.prototype.populatePaintArray = function (t, e, r, n) { var i = this.paintVertexArray, a = i.length; i.reserve(t); var o = this.expression.evaluate(new Hn(0), e, {}, [], n); if ("color" === this.type) for (var s = la(o), u = a; u < t; u++)i.emplaceBack(s[0], s[1]); else { for (var l = a; l < t; l++)i.emplaceBack(o); this.maxValue = Math.max(this.maxValue, o); } }, ha.prototype.updatePaintArray = function (t, e, r, n) { var i = this.paintVertexArray, a = this.expression.evaluate({ zoom: 0 }, r, n); if ("color" === this.type) for (var o = la(a), s = t; s < e; s++)i.emplace(s, o[0], o[1]); else { for (var u = t; u < e; u++)i.emplace(u, a); this.maxValue = Math.max(this.maxValue, a); } }, ha.prototype.upload = function (t) { this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = t.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent)); }, ha.prototype.destroy = function () { this.paintVertexBuffer && this.paintVertexBuffer.destroy(); }, ha.prototype.setUniforms = function (t, e) { e.set(0); }, ha.prototype.getBinding = function (t, e) { return new ra(t, e) }; var fa = function (t, e, r, n, i, a) { this.expression = t, this.names = e, this.uniformNames = this.names.map((function (t) { return "u_" + t + "_t" })), this.type = r, this.useIntegerZoom = n, this.zoom = i, this.maxValue = -1 / 0; var o = a; this.paintVertexAttributes = e.map((function (t) { return { name: "a_" + t, type: "Float32", components: "color" === r ? 4 : 2, offset: 0 } })), this.paintVertexArray = new o; }; fa.prototype.defines = function () { return [] }, fa.prototype.setConstantPatternPositions = function () { }, fa.prototype.populatePaintArray = function (t, e, r, n) { var i = this.paintVertexArray, a = i.length; i.reserve(t); var o = this.expression.evaluate(new Hn(this.zoom), e, {}, [], n), s = this.expression.evaluate(new Hn(this.zoom + 1), e, {}, [], n); if ("color" === this.type) for (var u = la(o), l = la(s), p = a; p < t; p++)i.emplaceBack(u[0], u[1], l[0], l[1]); else { for (var c = a; c < t; c++)i.emplaceBack(o, s); this.maxValue = Math.max(this.maxValue, o, s); } }, fa.prototype.updatePaintArray = function (t, e, r, n) { var i = this.paintVertexArray, a = this.expression.evaluate({ zoom: this.zoom }, r, n), o = this.expression.evaluate({ zoom: this.zoom + 1 }, r, n); if ("color" === this.type) for (var s = la(a), u = la(o), l = t; l < e; l++)i.emplace(l, s[0], s[1], u[0], u[1]); else { for (var p = t; p < e; p++)i.emplace(p, a, o); this.maxValue = Math.max(this.maxValue, a, o); } }, fa.prototype.upload = function (t) { this.paintVertexArray && this.paintVertexArray.arrayBuffer && (this.paintVertexBuffer && this.paintVertexBuffer.buffer ? this.paintVertexBuffer.updateData(this.paintVertexArray) : this.paintVertexBuffer = t.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent)); }, fa.prototype.destroy = function () { this.paintVertexBuffer && this.paintVertexBuffer.destroy(); }, fa.prototype.interpolationFactor = function (t) { return this.useIntegerZoom && (t = Math.floor(t)), l(this.expression.interpolationFactor(t, this.zoom, this.zoom + 1), 0, 1) }, fa.prototype.setUniforms = function (t, e, r) { e.set(this.interpolationFactor(r.zoom)); }, fa.prototype.getBinding = function (t, e) { return new ra(t, e) }; var ya = function (t, e, r, n, i, a, o) { this.expression = t, this.names = e, this.type = r, this.uniformNames = this.names.map((function (t) { return "u_" + t + "_t" })), this.useIntegerZoom = n, this.zoom = i, this.maxValue = -1 / 0, this.layerId = o, this.paintVertexAttributes = e.map((function (t) { return { name: "a_" + t, type: "Uint16", components: 4, offset: 0 } })), this.zoomInPaintVertexArray = new a, this.zoomOutPaintVertexArray = new a; }; ya.prototype.defines = function () { return [] }, ya.prototype.setConstantPatternPositions = function () { }, ya.prototype.populatePaintArray = function (t, e, r) { var n = this.zoomInPaintVertexArray, i = this.zoomOutPaintVertexArray, a = this.layerId, o = n.length; if (n.reserve(t), i.reserve(t), r && e.patterns && e.patterns[a]) { var s = e.patterns[a], u = s.min, l = s.mid, p = s.max, c = r[u], h = r[l], f = r[p]; if (!c || !h || !f) return; for (var y = o; y < t; y++)n.emplaceBack(h.tl[0], h.tl[1], h.br[0], h.br[1], c.tl[0], c.tl[1], c.br[0], c.br[1]), i.emplaceBack(h.tl[0], h.tl[1], h.br[0], h.br[1], f.tl[0], f.tl[1], f.br[0], f.br[1]); } }, ya.prototype.updatePaintArray = function (t, e, r, n, i) { var a = this.zoomInPaintVertexArray, o = this.zoomOutPaintVertexArray, s = this.layerId; if (i && r.patterns && r.patterns[s]) { var u = r.patterns[s], l = u.min, p = u.mid, c = u.max, h = i[l], f = i[p], y = i[c]; if (!h || !f || !y) return; for (var d = t; d < e; d++)a.emplace(d, f.tl[0], f.tl[1], f.br[0], f.br[1], h.tl[0], h.tl[1], h.br[0], h.br[1]), o.emplace(d, f.tl[0], f.tl[1], f.br[0], f.br[1], y.tl[0], y.tl[1], y.br[0], y.br[1]); } }, ya.prototype.upload = function (t) { this.zoomInPaintVertexArray && this.zoomInPaintVertexArray.arrayBuffer && this.zoomOutPaintVertexArray && this.zoomOutPaintVertexArray.arrayBuffer && (this.zoomInPaintVertexBuffer = t.createVertexBuffer(this.zoomInPaintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent), this.zoomOutPaintVertexBuffer = t.createVertexBuffer(this.zoomOutPaintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent)); }, ya.prototype.destroy = function () { this.zoomOutPaintVertexBuffer && this.zoomOutPaintVertexBuffer.destroy(), this.zoomInPaintVertexBuffer && this.zoomInPaintVertexBuffer.destroy(); }, ya.prototype.setUniforms = function (t, e) { e.set(0); }, ya.prototype.getBinding = function (t, e) { return new ra(t, e) }; var da = function () { this.binders = {}, this.cacheKey = "", this._buffers = []; }; da.createDynamic = function (t, e, r) { var n = new da, i = []; for (var a in t.paint._values) if (r(a)) { var o = t.paint.get(a); if (o instanceof ri && xr(o.property.specification)) { var s = va(a, t.type), u = o.property.specification.type, l = o.property.useIntegerZoom; if ("cross-faded" === o.property.specification["property-type"] || "cross-faded-data-driven" === o.property.specification["property-type"]) if ("constant" === o.value.kind) n.binders[a] = new ca(o.value.value, s, u), i.push("/u_" + a); else { var p = ga(a, u, "source"); n.binders[a] = new ya(o.value, s, u, l, e, p, t.id), i.push("/a_" + a); } else if ("constant" === o.value.kind) n.binders[a] = new pa(o.value.value, s, u), i.push("/u_" + a); else if ("source" === o.value.kind) { var c = ga(a, u, "source"); n.binders[a] = new ha(o.value, s, u, c), i.push("/a_" + a); } else { var h = ga(a, u, "composite"); n.binders[a] = new fa(o.value, s, u, l, e, h), i.push("/z_" + a); } } } return n.cacheKey = i.sort().join(""), n }, da.prototype.populatePaintArrays = function (t, e, r, n, i) { for (var a in this.binders) { this.binders[a].populatePaintArray(t, e, n, i); } }, da.prototype.setConstantPatternPositions = function (t, e) { for (var r in this.binders) { this.binders[r].setConstantPatternPositions(t, e); } }, da.prototype.updatePaintArrays = function (t, e, r, n, i) { var a = !1; for (var o in t) for (var s = 0, u = e.getPositions(+o); s < u.length; s += 1) { var l = u[s], p = r.feature(l.index); for (var c in this.binders) { var h = this.binders[c]; if (!(h instanceof pa || h instanceof ca) && !0 === h.expression.isStateDependent) { var f = n.paint.get(c); h.expression = f.value, h.updatePaintArray(l.start, l.end, p, t[o], i), a = !0; } } } return a }, da.prototype.defines = function () { var t = []; for (var e in this.binders) t.push.apply(t, this.binders[e].defines()); return t }, da.prototype.getPaintVertexBuffers = function () { return this._buffers }, da.prototype.getUniforms = function (t, e) { var r = []; for (var n in this.binders) for (var i = this.binders[n], a = 0, o = i.uniformNames; a < o.length; a += 1) { var s = o[a]; if (e[s]) { var u = i.getBinding(t, e[s]); r.push({ name: s, property: n, binding: u }); } } return r }, da.prototype.setUniforms = function (t, e, r, n) { for (var i = 0, a = e; i < a.length; i += 1) { var o = a[i], s = o.name, u = o.property, l = o.binding; this.binders[u].setUniforms(t, l, n, r.get(u), s); } }, da.prototype.updatePatternPaintBuffers = function (t) { var e = []; for (var r in this.binders) { var n = this.binders[r]; if (n instanceof ya) { var i = 2 === t.fromScale ? n.zoomInPaintVertexBuffer : n.zoomOutPaintVertexBuffer; i && e.push(i); } else (n instanceof ha || n instanceof fa) && n.paintVertexBuffer && e.push(n.paintVertexBuffer); } this._buffers = e; }, da.prototype.upload = function (t) { for (var e in this.binders) this.binders[e].upload(t); var r = []; for (var n in this.binders) { var i = this.binders[n]; (i instanceof ha || i instanceof fa) && i.paintVertexBuffer && r.push(i.paintVertexBuffer); } this._buffers = r; }, da.prototype.destroy = function () { for (var t in this.binders) this.binders[t].destroy(); }; var ma = function (t, e, r, n) { void 0 === n && (n = function () { return !0 }), this.programConfigurations = {}; for (var i = 0, a = e; i < a.length; i += 1) { var o = a[i]; this.programConfigurations[o.id] = da.createDynamic(o, r, n), this.programConfigurations[o.id].layoutAttributes = t; } this.needsUpload = !1, this._featureMap = new Wi, this._bufferOffset = 0; }; function va(t, e) { return { "text-opacity": ["opacity"], "icon-opacity": ["opacity"], "text-color": ["fill_color"], "icon-color": ["fill_color"], "text-halo-color": ["halo_color"], "icon-halo-color": ["halo_color"], "text-halo-blur": ["halo_blur"], "icon-halo-blur": ["halo_blur"], "text-halo-width": ["halo_width"], "icon-halo-width": ["halo_width"], "line-gap-width": ["gapwidth"], "line-pattern": ["pattern_to", "pattern_from"], "fill-pattern": ["pattern_to", "pattern_from"], "fill-extrusion-pattern": ["pattern_to", "pattern_from"] }[t] || [t.replace(e + "-", "").replace(/-/g, "_")] } function ga(t, e, r) { var n = { color: { source: Fi, composite: Li }, number: { source: Bi, composite: Fi } }, i = function (t) { return { "line-pattern": { source: bi, composite: bi }, "fill-pattern": { source: bi, composite: bi }, "fill-extrusion-pattern": { source: bi, composite: bi } }[t] }(t); return i && i[r] || n[e][r] } ma.prototype.populatePaintArrays = function (t, e, r, n, i) { for (var a in this.programConfigurations) this.programConfigurations[a].populatePaintArrays(t, e, r, n, i); void 0 !== e.id && this._featureMap.add(+e.id, r, this._bufferOffset, t), this._bufferOffset = t, this.needsUpload = !0; }, ma.prototype.updatePaintArrays = function (t, e, r, n) { for (var i = 0, a = r; i < a.length; i += 1) { var o = a[i]; this.needsUpload = this.programConfigurations[o.id].updatePaintArrays(t, this._featureMap, e, o, n) || this.needsUpload; } }, ma.prototype.get = function (t) { return this.programConfigurations[t] }, ma.prototype.upload = function (t) { if (this.needsUpload) { for (var e in this.programConfigurations) this.programConfigurations[e].upload(t); this.needsUpload = !1; } }, ma.prototype.destroy = function () { for (var t in this.programConfigurations) this.programConfigurations[t].destroy(); }, An("ConstantBinder", pa), An("CrossFadedConstantBinder", ca), An("SourceExpressionBinder", ha), An("CrossFadedCompositeBinder", ya), An("CompositeExpressionBinder", fa), An("ProgramConfiguration", da, { omit: ["_buffers"] }), An("ProgramConfigurationSet", ma); var xa = 8192; var ba, _a = (ba = 15, { min: -1 * Math.pow(2, ba - 1), max: Math.pow(2, ba - 1) - 1 }); function wa(t) { for (var e = xa / t.extent, r = t.loadGeometry(), n = 0; n < r.length; n++)for (var i = r[n], a = 0; a < i.length; a++) { var o = i[a]; o.x = Math.round(o.x * e), o.y = Math.round(o.y * e), (o.x < _a.min || o.x > _a.max || o.y < _a.min || o.y > _a.max) && (w("Geometry exceeds allowed extent, reduce your vector tile buffer size"), o.x = l(o.x, _a.min, _a.max), o.y = l(o.y, _a.min, _a.max)); } return r } function Aa(t, e, r, n, i) { t.emplaceBack(2 * e + (n + 1) / 2, 2 * r + (i + 1) / 2); } var Sa = function (t) { this.zoom = t.zoom, this.overscaling = t.overscaling, this.layers = t.layers, this.layerIds = this.layers.map((function (t) { return t.id })), this.index = t.index, this.hasPattern = !1, this.layoutVertexArray = new mi, this.indexArray = new Ei, this.segments = new Yi, this.programConfigurations = new ma(Hi, t.layers, t.zoom), this.stateDependentLayerIds = this.layers.filter((function (t) { return t.isStateDependent() })).map((function (t) { return t.id })); }; function ka(t, e) { for (var r = 0; r < t.length; r++)if (Va(e, t[r])) return !0; for (var n = 0; n < e.length; n++)if (Va(t, e[n])) return !0; return !!Ba(t, e) } function Ia(t, e, r) { return !!Va(t, e) || !!Pa(e, t, r) } function za(t, e) { if (1 === t.length) return Ma(e, t[0]); for (var r = 0; r < e.length; r++)for (var n = e[r], i = 0; i < n.length; i++)if (Va(t, n[i])) return !0; for (var a = 0; a < t.length; a++)if (Ma(e, t[a])) return !0; for (var o = 0; o < e.length; o++)if (Ba(t, e[o])) return !0; return !1 } function Ca(t, e, r) { if (t.length > 1) { if (Ba(t, e)) return !0; for (var n = 0; n < e.length; n++)if (Pa(e[n], t, r)) return !0 } for (var i = 0; i < t.length; i++)if (Pa(t[i], e, r)) return !0; return !1 } function Ba(t, e) { if (0 === t.length || 0 === e.length) return !1; for (var r = 0; r < t.length - 1; r++)for (var n = t[r], i = t[r + 1], a = 0; a < e.length - 1; a++) { if (Ta(n, i, e[a], e[a + 1])) return !0 } return !1 } function Ta(t, e, r, n) { return A(t, r, n) !== A(e, r, n) && A(t, e, r) !== A(t, e, n) } function Pa(t, e, r) { var n = r * r; if (1 === e.length) return t.distSqr(e[0]) < n; for (var i = 1; i < e.length; i++) { if (Ea(t, e[i - 1], e[i]) < n) return !0 } return !1 } function Ea(t, e, r) { var n = e.distSqr(r); if (0 === n) return t.distSqr(e); var i = ((t.x - e.x) * (r.x - e.x) + (t.y - e.y) * (r.y - e.y)) / n; return i < 0 ? t.distSqr(e) : i > 1 ? t.distSqr(r) : t.distSqr(r.sub(e)._mult(i)._add(e)) } function Ma(t, e) { for (var r, n, i, a = !1, o = 0; o < t.length; o++)for (var s = 0, u = (r = t[o]).length - 1; s < r.length; u = s++)n = r[s], i = r[u], n.y > e.y != i.y > e.y && e.x < (i.x - n.x) * (e.y - n.y) / (i.y - n.y) + n.x && (a = !a); return a } function Va(t, e) { for (var r = !1, n = 0, i = t.length - 1; n < t.length; i = n++) { var a = t[n], o = t[i]; a.y > e.y != o.y > e.y && e.x < (o.x - a.x) * (e.y - a.y) / (o.y - a.y) + a.x && (r = !r); } return r } function Fa(t, e, r) { var n = r[0], i = r[2]; if (t.x < n.x && e.x < n.x || t.x > i.x && e.x > i.x || t.y < n.y && e.y < n.y || t.y > i.y && e.y > i.y) return !1; var a = A(t, e, r[0]); return a !== A(t, e, r[1]) || a !== A(t, e, r[2]) || a !== A(t, e, r[3]) } function La(t, e, r) { var n = e.paint.get(t).value; return "constant" === n.kind ? n.value : r.programConfigurations.get(e.id).binders[t].maxValue } function Oa(t) { return Math.sqrt(t[0] * t[0] + t[1] * t[1]) } function Da(t, e, r, n, a) { if (!e[0] && !e[1]) return t; var o = i.convert(e)._mult(a); "viewport" === r && o._rotate(-n); for (var s = [], u = 0; u < t.length; u++) { var l = t[u]; s.push(l.sub(o)); } return s } Sa.prototype.populate = function (t, e) { var r = this.layers[0], n = [], i = null; "circle" === r.type && (i = r.layout.get("circle-sort-key")); for (var a = 0, o = t; a < o.length; a += 1) { var s = o[a], u = s.feature, l = s.index, p = s.sourceLayerIndex; if (this.layers[0]._featureFilter(new Hn(this.zoom), u)) { var c = wa(u), h = i ? i.evaluate(u, {}) : void 0, f = { id: u.id, properties: u.properties, type: u.type, sourceLayerIndex: p, index: l, geometry: c, patterns: {}, sortKey: h }; n.push(f); } } i && n.sort((function (t, e) { return t.sortKey - e.sortKey })); for (var y = 0, d = n; y < d.length; y += 1) { var m = d[y], v = m, g = v.geometry, x = v.index, b = v.sourceLayerIndex, _ = t[x].feature; this.addFeature(m, g, x), e.featureIndex.insert(_, g, x, b, this.index); } }, Sa.prototype.update = function (t, e, r) { this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t, e, this.stateDependentLayers, r); }, Sa.prototype.isEmpty = function () { return 0 === this.layoutVertexArray.length }, Sa.prototype.uploadPending = function () { return !this.uploaded || this.programConfigurations.needsUpload }, Sa.prototype.upload = function (t) { this.uploaded || (this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, Hi), this.indexBuffer = t.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t), this.uploaded = !0; }, Sa.prototype.destroy = function () { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy()); }, Sa.prototype.addFeature = function (t, e, r) { for (var n = 0, i = e; n < i.length; n += 1)for (var a = 0, o = i[n]; a < o.length; a += 1) { var s = o[a], u = s.x, l = s.y; if (!(u < 0 || u >= xa || l < 0 || l >= xa)) { var p = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray, t.sortKey), c = p.vertexLength; Aa(this.layoutVertexArray, u, l, -1, -1), Aa(this.layoutVertexArray, u, l, 1, -1), Aa(this.layoutVertexArray, u, l, 1, 1), Aa(this.layoutVertexArray, u, l, -1, 1), this.indexArray.emplaceBack(c, c + 1, c + 2), this.indexArray.emplaceBack(c, c + 3, c + 2), p.vertexLength += 4, p.primitiveLength += 2; } } this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t, r, {}); }, An("CircleBucket", Sa, { omit: ["layers"] }); var Ra = new li({ "circle-sort-key": new ai(Tt.layout_circle["circle-sort-key"]) }), Ua = { paint: new li({ "circle-radius": new ai(Tt.paint_circle["circle-radius"]), "circle-color": new ai(Tt.paint_circle["circle-color"]), "circle-blur": new ai(Tt.paint_circle["circle-blur"]), "circle-opacity": new ai(Tt.paint_circle["circle-opacity"]), "circle-translate": new ii(Tt.paint_circle["circle-translate"]), "circle-translate-anchor": new ii(Tt.paint_circle["circle-translate-anchor"]), "circle-pitch-scale": new ii(Tt.paint_circle["circle-pitch-scale"]), "circle-pitch-alignment": new ii(Tt.paint_circle["circle-pitch-alignment"]), "circle-stroke-width": new ai(Tt.paint_circle["circle-stroke-width"]), "circle-stroke-color": new ai(Tt.paint_circle["circle-stroke-color"]), "circle-stroke-opacity": new ai(Tt.paint_circle["circle-stroke-opacity"]) }), layout: Ra }, ja = "undefined" != typeof Float32Array ? Float32Array : Array; Math.hypot || (Math.hypot = function () { for (var t = arguments, e = 0, r = arguments.length; r--;)e += t[r] * t[r]; return Math.sqrt(e) }); var qa, Na; qa = new ja(3), ja != Float32Array && (qa[0] = 0, qa[1] = 0, qa[2] = 0), Na = qa; function Ka(t, e, r) { var n = e[0], i = e[1], a = e[2], o = e[3]; return t[0] = r[0] * n + r[4] * i + r[8] * a + r[12] * o, t[1] = r[1] * n + r[5] * i + r[9] * a + r[13] * o, t[2] = r[2] * n + r[6] * i + r[10] * a + r[14] * o, t[3] = r[3] * n + r[7] * i + r[11] * a + r[15] * o, t } !function () { var t = function () { var t = new ja(4); return ja != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0), t }(); }(); var Xa = function (t) { function e(e) { t.call(this, e, Ua); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.createBucket = function (t) { return new Sa(t) }, e.prototype.queryRadius = function (t) { var e = t; return La("circle-radius", this, e) + La("circle-stroke-width", this, e) + Oa(this.paint.get("circle-translate")) }, e.prototype.queryIntersectsFeature = function (t, e, r, n, i, a, o, s) { for (var u = Da(t, this.paint.get("circle-translate"), this.paint.get("circle-translate-anchor"), a.angle, o), l = this.paint.get("circle-radius").evaluate(e, r) + this.paint.get("circle-stroke-width").evaluate(e, r), p = "map" === this.paint.get("circle-pitch-alignment"), c = p ? u : function (t, e) { return t.map((function (t) { return Za(t, e) })) }(u, s), h = p ? l * o : l, f = 0, y = n; f < y.length; f += 1)for (var d = 0, m = y[f]; d < m.length; d += 1) { var v = m[d], g = p ? v : Za(v, s), x = h, b = Ka([], [v.x, v.y, 0, 1], s); if ("viewport" === this.paint.get("circle-pitch-scale") && "map" === this.paint.get("circle-pitch-alignment") ? x *= b[3] / a.cameraToCenterDistance : "map" === this.paint.get("circle-pitch-scale") && "viewport" === this.paint.get("circle-pitch-alignment") && (x *= a.cameraToCenterDistance / b[3]), Ia(c, g, x)) return !0 } return !1 }, e }(pi); function Za(t, e) { var r = Ka([], [t.x, t.y, 0, 1], e); return new i(r[0] / r[3], r[1] / r[3]) } var Ga = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e }(Sa); function Ja(t, e, r, n) { var i = e.width, a = e.height; if (n) { if (n instanceof Uint8ClampedArray) n = new Uint8Array(n.buffer); else if (n.length !== i * a * r) throw new RangeError("mismatched image size") } else n = new Uint8Array(i * a * r); return t.width = i, t.height = a, t.data = n, t } function Ha(t, e, r) { var n = e.width, i = e.height; if (n !== t.width || i !== t.height) { var a = Ja({}, { width: n, height: i }, r); Ya(t, a, { x: 0, y: 0 }, { x: 0, y: 0 }, { width: Math.min(t.width, n), height: Math.min(t.height, i) }, r), t.width = n, t.height = i, t.data = a.data; } } function Ya(t, e, r, n, i, a) { if (0 === i.width || 0 === i.height) return e; if (i.width > t.width || i.height > t.height || r.x > t.width - i.width || r.y > t.height - i.height) throw new RangeError("out of range source coordinates for image copy"); if (i.width > e.width || i.height > e.height || n.x > e.width - i.width || n.y > e.height - i.height) throw new RangeError("out of range destination coordinates for image copy"); for (var o = t.data, s = e.data, u = 0; u < i.height; u++)for (var l = ((r.y + u) * t.width + r.x) * a, p = ((n.y + u) * e.width + n.x) * a, c = 0; c < i.width * a; c++)s[p + c] = o[l + c]; return e } An("HeatmapBucket", Ga, { omit: ["layers"] }); var $a = function (t, e) { Ja(this, t, 1, e); }; $a.prototype.resize = function (t) { Ha(this, t, 1); }, $a.prototype.clone = function () { return new $a({ width: this.width, height: this.height }, new Uint8Array(this.data)) }, $a.copy = function (t, e, r, n, i) { Ya(t, e, r, n, i, 1); }; var Wa = function (t, e) { Ja(this, t, 4, e); }; Wa.prototype.resize = function (t) { Ha(this, t, 4); }, Wa.prototype.replace = function (t, e) { e ? this.data.set(t) : t instanceof Uint8ClampedArray ? this.data = new Uint8Array(t.buffer) : this.data = t; }, Wa.prototype.clone = function () { return new Wa({ width: this.width, height: this.height }, new Uint8Array(this.data)) }, Wa.copy = function (t, e, r, n, i) { Ya(t, e, r, n, i, 4); }, An("AlphaImage", $a), An("RGBAImage", Wa); var Qa = { paint: new li({ "heatmap-radius": new ai(Tt.paint_heatmap["heatmap-radius"]), "heatmap-weight": new ai(Tt.paint_heatmap["heatmap-weight"]), "heatmap-intensity": new ii(Tt.paint_heatmap["heatmap-intensity"]), "heatmap-color": new ui(Tt.paint_heatmap["heatmap-color"]), "heatmap-opacity": new ii(Tt.paint_heatmap["heatmap-opacity"]) }) }; function to(t, e) { for (var r = new Uint8Array(1024), n = {}, i = 0, a = 0; i < 256; i++ , a += 4) { n[e] = i / 255; var o = t.evaluate(n); r[a + 0] = Math.floor(255 * o.r / o.a), r[a + 1] = Math.floor(255 * o.g / o.a), r[a + 2] = Math.floor(255 * o.b / o.a), r[a + 3] = Math.floor(255 * o.a); } return new Wa({ width: 256, height: 1 }, r) } var eo = function (t) { function e(e) { t.call(this, e, Qa), this._updateColorRamp(); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.createBucket = function (t) { return new Ga(t) }, e.prototype._handleSpecialPaintPropertyUpdate = function (t) { "heatmap-color" === t && this._updateColorRamp(); }, e.prototype._updateColorRamp = function () { var t = this._transitionablePaint._values["heatmap-color"].value.expression; this.colorRamp = to(t, "heatmapDensity"), this.colorRampTexture = null; }, e.prototype.resize = function () { this.heatmapFbo && (this.heatmapFbo.destroy(), this.heatmapFbo = null); }, e.prototype.queryRadius = function () { return 0 }, e.prototype.queryIntersectsFeature = function () { return !1 }, e.prototype.hasOffscreenPass = function () { return 0 !== this.paint.get("heatmap-opacity") && "none" !== this.visibility }, e }(pi), ro = { paint: new li({ "hillshade-illumination-direction": new ii(Tt.paint_hillshade["hillshade-illumination-direction"]), "hillshade-illumination-anchor": new ii(Tt.paint_hillshade["hillshade-illumination-anchor"]), "hillshade-exaggeration": new ii(Tt.paint_hillshade["hillshade-exaggeration"]), "hillshade-shadow-color": new ii(Tt.paint_hillshade["hillshade-shadow-color"]), "hillshade-highlight-color": new ii(Tt.paint_hillshade["hillshade-highlight-color"]), "hillshade-accent-color": new ii(Tt.paint_hillshade["hillshade-accent-color"]) }) }, no = function (t) { function e(e) { t.call(this, e, ro); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.hasOffscreenPass = function () { return 0 !== this.paint.get("hillshade-exaggeration") && "none" !== this.visibility }, e }(pi), io = yi([{ name: "a_pos", components: 2, type: "Int16" }], 4).members, ao = so, oo = so; function so(t, e, r) { r = r || 2; var n, i, a, o, s, u, l, p = e && e.length, c = p ? e[0] * r : t.length, h = uo(t, 0, c, r, !0), f = []; if (!h || h.next === h.prev) return f; if (p && (h = function (t, e, r, n) { var i, a, o, s, u, l = []; for (i = 0, a = e.length; i < a; i++)o = e[i] * n, s = i < a - 1 ? e[i + 1] * n : t.length, (u = uo(t, o, s, n, !1)) === u.next && (u.steiner = !0), l.push(bo(u)); for (l.sort(mo), i = 0; i < l.length; i++)vo(l[i], r), r = lo(r, r.next); return r }(t, e, h, r)), t.length > 80 * r) { n = a = t[0], i = o = t[1]; for (var y = r; y < c; y += r)(s = t[y]) < n && (n = s), (u = t[y + 1]) < i && (i = u), s > a && (a = s), u > o && (o = u); l = 0 !== (l = Math.max(a - n, o - i)) ? 1 / l : 0; } return po(h, f, r, n, i, l), f } function uo(t, e, r, n, i) { var a, o; if (i === Mo(t, e, r, n) > 0) for (a = e; a < r; a += n)o = To(a, t[a], t[a + 1], o); else for (a = r - n; a >= e; a -= n)o = To(a, t[a], t[a + 1], o); return o && So(o, o.next) && (Po(o), o = o.next), o } function lo(t, e) { if (!t) return t; e || (e = t); var r, n = t; do { if (r = !1, n.steiner || !So(n, n.next) && 0 !== Ao(n.prev, n, n.next)) n = n.next; else { if (Po(n), (n = e = n.prev) === n.next) break; r = !0; } } while (r || n !== e); return e } function po(t, e, r, n, i, a, o) { if (t) { !o && a && function (t, e, r, n) { var i = t; do { null === i.z && (i.z = xo(i.x, i.y, e, r, n)), i.prevZ = i.prev, i.nextZ = i.next, i = i.next; } while (i !== t); i.prevZ.nextZ = null, i.prevZ = null, function (t) { var e, r, n, i, a, o, s, u, l = 1; do { for (r = t, t = null, a = null, o = 0; r;) { for (o++ , n = r, s = 0, e = 0; e < l && (s++ , n = n.nextZ); e++); for (u = l; s > 0 || u > 0 && n;)0 !== s && (0 === u || !n || r.z <= n.z) ? (i = r, r = r.nextZ, s--) : (i = n, n = n.nextZ, u--), a ? a.nextZ = i : t = i, i.prevZ = a, a = i; r = n; } a.nextZ = null, l *= 2; } while (o > 1) }(i); }(t, n, i, a); for (var s, u, l = t; t.prev !== t.next;)if (s = t.prev, u = t.next, a ? ho(t, n, i, a) : co(t)) e.push(s.i / r), e.push(t.i / r), e.push(u.i / r), Po(t), t = u.next, l = u.next; else if ((t = u) === l) { o ? 1 === o ? po(t = fo(lo(t), e, r), e, r, n, i, a, 2) : 2 === o && yo(t, e, r, n, i, a) : po(lo(t), e, r, n, i, a, 1); break } } } function co(t) { var e = t.prev, r = t, n = t.next; if (Ao(e, r, n) >= 0) return !1; for (var i = t.next.next; i !== t.prev;) { if (_o(e.x, e.y, r.x, r.y, n.x, n.y, i.x, i.y) && Ao(i.prev, i, i.next) >= 0) return !1; i = i.next; } return !0 } function ho(t, e, r, n) { var i = t.prev, a = t, o = t.next; if (Ao(i, a, o) >= 0) return !1; for (var s = i.x < a.x ? i.x < o.x ? i.x : o.x : a.x < o.x ? a.x : o.x, u = i.y < a.y ? i.y < o.y ? i.y : o.y : a.y < o.y ? a.y : o.y, l = i.x > a.x ? i.x > o.x ? i.x : o.x : a.x > o.x ? a.x : o.x, p = i.y > a.y ? i.y > o.y ? i.y : o.y : a.y > o.y ? a.y : o.y, c = xo(s, u, e, r, n), h = xo(l, p, e, r, n), f = t.prevZ, y = t.nextZ; f && f.z >= c && y && y.z <= h;) { if (f !== t.prev && f !== t.next && _o(i.x, i.y, a.x, a.y, o.x, o.y, f.x, f.y) && Ao(f.prev, f, f.next) >= 0) return !1; if (f = f.prevZ, y !== t.prev && y !== t.next && _o(i.x, i.y, a.x, a.y, o.x, o.y, y.x, y.y) && Ao(y.prev, y, y.next) >= 0) return !1; y = y.nextZ; } for (; f && f.z >= c;) { if (f !== t.prev && f !== t.next && _o(i.x, i.y, a.x, a.y, o.x, o.y, f.x, f.y) && Ao(f.prev, f, f.next) >= 0) return !1; f = f.prevZ; } for (; y && y.z <= h;) { if (y !== t.prev && y !== t.next && _o(i.x, i.y, a.x, a.y, o.x, o.y, y.x, y.y) && Ao(y.prev, y, y.next) >= 0) return !1; y = y.nextZ; } return !0 } function fo(t, e, r) { var n = t; do { var i = n.prev, a = n.next.next; !So(i, a) && ko(i, n, n.next, a) && Co(i, a) && Co(a, i) && (e.push(i.i / r), e.push(n.i / r), e.push(a.i / r), Po(n), Po(n.next), n = t = a), n = n.next; } while (n !== t); return lo(n) } function yo(t, e, r, n, i, a) { var o = t; do { for (var s = o.next.next; s !== o.prev;) { if (o.i !== s.i && wo(o, s)) { var u = Bo(o, s); return o = lo(o, o.next), u = lo(u, u.next), po(o, e, r, n, i, a), void po(u, e, r, n, i, a) } s = s.next; } o = o.next; } while (o !== t) } function mo(t, e) { return t.x - e.x } function vo(t, e) { if (e = function (t, e) { var r, n = e, i = t.x, a = t.y, o = -1 / 0; do { if (a <= n.y && a >= n.next.y && n.next.y !== n.y) { var s = n.x + (a - n.y) * (n.next.x - n.x) / (n.next.y - n.y); if (s <= i && s > o) { if (o = s, s === i) { if (a === n.y) return n; if (a === n.next.y) return n.next } r = n.x < n.next.x ? n : n.next; } } n = n.next; } while (n !== e); if (!r) return null; if (i === o) return r; var u, l = r, p = r.x, c = r.y, h = 1 / 0; n = r; do { i >= n.x && n.x >= p && i !== n.x && _o(a < c ? i : o, a, p, c, a < c ? o : i, a, n.x, n.y) && (u = Math.abs(a - n.y) / (i - n.x), Co(n, t) && (u < h || u === h && (n.x > r.x || n.x === r.x && go(r, n))) && (r = n, h = u)), n = n.next; } while (n !== l); return r }(t, e)) { var r = Bo(e, t); lo(r, r.next); } } function go(t, e) { return Ao(t.prev, t, e.prev) < 0 && Ao(e.next, t, t.next) < 0 } function xo(t, e, r, n, i) { return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - r) * i) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - n) * i) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1 } function bo(t) { var e = t, r = t; do { (e.x < r.x || e.x === r.x && e.y < r.y) && (r = e), e = e.next; } while (e !== t); return r } function _o(t, e, r, n, i, a, o, s) { return (i - o) * (e - s) - (t - o) * (a - s) >= 0 && (t - o) * (n - s) - (r - o) * (e - s) >= 0 && (r - o) * (a - s) - (i - o) * (n - s) >= 0 } function wo(t, e) { return t.next.i !== e.i && t.prev.i !== e.i && !function (t, e) { var r = t; do { if (r.i !== t.i && r.next.i !== t.i && r.i !== e.i && r.next.i !== e.i && ko(r, r.next, t, e)) return !0; r = r.next; } while (r !== t); return !1 }(t, e) && (Co(t, e) && Co(e, t) && function (t, e) { var r = t, n = !1, i = (t.x + e.x) / 2, a = (t.y + e.y) / 2; do { r.y > a != r.next.y > a && r.next.y !== r.y && i < (r.next.x - r.x) * (a - r.y) / (r.next.y - r.y) + r.x && (n = !n), r = r.next; } while (r !== t); return n }(t, e) && (Ao(t.prev, t, e.prev) || Ao(t, e.prev, e)) || So(t, e) && Ao(t.prev, t, t.next) > 0 && Ao(e.prev, e, e.next) > 0) } function Ao(t, e, r) { return (e.y - t.y) * (r.x - e.x) - (e.x - t.x) * (r.y - e.y) } function So(t, e) { return t.x === e.x && t.y === e.y } function ko(t, e, r, n) { var i = zo(Ao(t, e, r)), a = zo(Ao(t, e, n)), o = zo(Ao(r, n, t)), s = zo(Ao(r, n, e)); return i !== a && o !== s || (!(0 !== i || !Io(t, r, e)) || (!(0 !== a || !Io(t, n, e)) || (!(0 !== o || !Io(r, t, n)) || !(0 !== s || !Io(r, e, n))))) } function Io(t, e, r) { return e.x <= Math.max(t.x, r.x) && e.x >= Math.min(t.x, r.x) && e.y <= Math.max(t.y, r.y) && e.y >= Math.min(t.y, r.y) } function zo(t) { return t > 0 ? 1 : t < 0 ? -1 : 0 } function Co(t, e) { return Ao(t.prev, t, t.next) < 0 ? Ao(t, e, t.next) >= 0 && Ao(t, t.prev, e) >= 0 : Ao(t, e, t.prev) < 0 || Ao(t, t.next, e) < 0 } function Bo(t, e) { var r = new Eo(t.i, t.x, t.y), n = new Eo(e.i, e.x, e.y), i = t.next, a = e.prev; return t.next = e, e.prev = t, r.next = i, i.prev = r, n.next = r, r.prev = n, a.next = n, n.prev = a, n } function To(t, e, r, n) { var i = new Eo(t, e, r); return n ? (i.next = n.next, i.prev = n, n.next.prev = i, n.next = i) : (i.prev = i, i.next = i), i } function Po(t) { t.next.prev = t.prev, t.prev.next = t.next, t.prevZ && (t.prevZ.nextZ = t.nextZ), t.nextZ && (t.nextZ.prevZ = t.prevZ); } function Eo(t, e, r) { this.i = t, this.x = e, this.y = r, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1; } function Mo(t, e, r, n) { for (var i = 0, a = e, o = r - n; a < r; a += n)i += (t[o] - t[a]) * (t[a + 1] + t[o + 1]), o = a; return i } function Vo(t, e, r, n, i) { !function t(e, r, n, i, a) { for (; i > n;) { if (i - n > 600) { var o = i - n + 1, s = r - n + 1, u = Math.log(o), l = .5 * Math.exp(2 * u / 3), p = .5 * Math.sqrt(u * l * (o - l) / o) * (s - o / 2 < 0 ? -1 : 1), c = Math.max(n, Math.floor(r - s * l / o + p)), h = Math.min(i, Math.floor(r + (o - s) * l / o + p)); t(e, r, c, h, a); } var f = e[r], y = n, d = i; for (Fo(e, n, r), a(e[i], f) > 0 && Fo(e, n, i); y < d;) { for (Fo(e, y, d), y++ , d--; a(e[y], f) < 0;)y++; for (; a(e[d], f) > 0;)d--; } 0 === a(e[n], f) ? Fo(e, n, d) : Fo(e, ++d, i), d <= r && (n = d + 1), r <= d && (i = d - 1); } }(t, e, r || 0, n || t.length - 1, i || Lo); } function Fo(t, e, r) { var n = t[e]; t[e] = t[r], t[r] = n; } function Lo(t, e) { return t < e ? -1 : t > e ? 1 : 0 } function Oo(t, e) { var r = t.length; if (r <= 1) return [t]; for (var n, i, a = [], o = 0; o < r; o++) { var s = S(t[o]); 0 !== s && (t[o].area = Math.abs(s), void 0 === i && (i = s < 0), i === s < 0 ? (n && a.push(n), n = [t[o]]) : n.push(t[o])); } if (n && a.push(n), e > 1) for (var u = 0; u < a.length; u++)a[u].length <= e || (Vo(a[u], e, 1, a[u].length - 1, Do), a[u] = a[u].slice(0, e)); return a } function Do(t, e) { return e.area - t.area } function Ro(t, e, r) { for (var n = r.patternDependencies, i = !1, a = 0, o = e; a < o.length; a += 1) { var s = o[a].paint.get(t + "-pattern"); s.isConstant() || (i = !0); var u = s.constantOr(null); u && (i = !0, n[u.to] = !0, n[u.from] = !0); } return i } function Uo(t, e, r, n, i) { for (var a = i.patternDependencies, o = 0, s = e; o < s.length; o += 1) { var u = s[o], l = u.paint.get(t + "-pattern").value; if ("constant" !== l.kind) { var p = l.evaluate({ zoom: n - 1 }, r, {}, i.availableImages), c = l.evaluate({ zoom: n }, r, {}, i.availableImages), h = l.evaluate({ zoom: n + 1 }, r, {}, i.availableImages); p = p && p.name ? p.name : p, c = c && c.name ? c.name : c, h = h && h.name ? h.name : h, a[p] = !0, a[c] = !0, a[h] = !0, r.patterns[u.id] = { min: p, mid: c, max: h }; } } return r } so.deviation = function (t, e, r, n) { var i = e && e.length, a = i ? e[0] * r : t.length, o = Math.abs(Mo(t, 0, a, r)); if (i) for (var s = 0, u = e.length; s < u; s++) { var l = e[s] * r, p = s < u - 1 ? e[s + 1] * r : t.length; o -= Math.abs(Mo(t, l, p, r)); } var c = 0; for (s = 0; s < n.length; s += 3) { var h = n[s] * r, f = n[s + 1] * r, y = n[s + 2] * r; c += Math.abs((t[h] - t[y]) * (t[f + 1] - t[h + 1]) - (t[h] - t[f]) * (t[y + 1] - t[h + 1])); } return 0 === o && 0 === c ? 0 : Math.abs((c - o) / o) }, so.flatten = function (t) { for (var e = t[0][0].length, r = { vertices: [], holes: [], dimensions: e }, n = 0, i = 0; i < t.length; i++) { for (var a = 0; a < t[i].length; a++)for (var o = 0; o < e; o++)r.vertices.push(t[i][a][o]); i > 0 && (n += t[i - 1].length, r.holes.push(n)); } return r }, ao.default = oo; var jo = function (t) { this.zoom = t.zoom, this.overscaling = t.overscaling, this.layers = t.layers, this.layerIds = this.layers.map((function (t) { return t.id })), this.index = t.index, this.hasPattern = !1, this.patternFeatures = [], this.layoutVertexArray = new mi, this.indexArray = new Ei, this.indexArray2 = new Mi, this.programConfigurations = new ma(io, t.layers, t.zoom), this.segments = new Yi, this.segments2 = new Yi, this.stateDependentLayerIds = this.layers.filter((function (t) { return t.isStateDependent() })).map((function (t) { return t.id })); }; jo.prototype.populate = function (t, e) { this.hasPattern = Ro("fill", this.layers, e); for (var r = this.layers[0].layout.get("fill-sort-key"), n = [], i = 0, a = t; i < a.length; i += 1) { var o = a[i], s = o.feature, u = o.index, l = o.sourceLayerIndex; if (this.layers[0]._featureFilter(new Hn(this.zoom), s)) { var p = wa(s), c = r ? r.evaluate(s, {}, e.availableImages) : void 0, h = { id: s.id, properties: s.properties, type: s.type, sourceLayerIndex: l, index: u, geometry: p, patterns: {}, sortKey: c }; n.push(h); } } r && n.sort((function (t, e) { return t.sortKey - e.sortKey })); for (var f = 0, y = n; f < y.length; f += 1) { var d = y[f], m = d, v = m.geometry, g = m.index, x = m.sourceLayerIndex; if (this.hasPattern) { var b = Uo("fill", this.layers, d, this.zoom, e); this.patternFeatures.push(b); } else this.addFeature(d, v, g, {}); var _ = t[g].feature; e.featureIndex.insert(_, v, g, x, this.index); } }, jo.prototype.update = function (t, e, r) { this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t, e, this.stateDependentLayers, r); }, jo.prototype.addFeatures = function (t, e) { for (var r = 0, n = this.patternFeatures; r < n.length; r += 1) { var i = n[r]; this.addFeature(i, i.geometry, i.index, e); } }, jo.prototype.isEmpty = function () { return 0 === this.layoutVertexArray.length }, jo.prototype.uploadPending = function () { return !this.uploaded || this.programConfigurations.needsUpload }, jo.prototype.upload = function (t) { this.uploaded || (this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, io), this.indexBuffer = t.createIndexBuffer(this.indexArray), this.indexBuffer2 = t.createIndexBuffer(this.indexArray2)), this.programConfigurations.upload(t), this.uploaded = !0; }, jo.prototype.destroy = function () { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.indexBuffer2.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.segments2.destroy()); }, jo.prototype.addFeature = function (t, e, r, n) { for (var i = 0, a = Oo(e, 500); i < a.length; i += 1) { for (var o = a[i], s = 0, u = 0, l = o; u < l.length; u += 1) { s += l[u].length; } for (var p = this.segments.prepareSegment(s, this.layoutVertexArray, this.indexArray), c = p.vertexLength, h = [], f = [], y = 0, d = o; y < d.length; y += 1) { var m = d[y]; if (0 !== m.length) { m !== o[0] && f.push(h.length / 2); var v = this.segments2.prepareSegment(m.length, this.layoutVertexArray, this.indexArray2), g = v.vertexLength; this.layoutVertexArray.emplaceBack(m[0].x, m[0].y), this.indexArray2.emplaceBack(g + m.length - 1, g), h.push(m[0].x), h.push(m[0].y); for (var x = 1; x < m.length; x++)this.layoutVertexArray.emplaceBack(m[x].x, m[x].y), this.indexArray2.emplaceBack(g + x - 1, g + x), h.push(m[x].x), h.push(m[x].y); v.vertexLength += m.length, v.primitiveLength += m.length; } } for (var b = ao(h, f), _ = 0; _ < b.length; _ += 3)this.indexArray.emplaceBack(c + b[_], c + b[_ + 1], c + b[_ + 2]); p.vertexLength += s, p.primitiveLength += b.length / 3; } this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t, r, n); }, An("FillBucket", jo, { omit: ["layers", "patternFeatures"] }); var qo = new li({ "fill-sort-key": new ai(Tt.layout_fill["fill-sort-key"]) }), No = { paint: new li({ "fill-antialias": new ii(Tt.paint_fill["fill-antialias"]), "fill-opacity": new ai(Tt.paint_fill["fill-opacity"]), "fill-color": new ai(Tt.paint_fill["fill-color"]), "fill-outline-color": new ai(Tt.paint_fill["fill-outline-color"]), "fill-translate": new ii(Tt.paint_fill["fill-translate"]), "fill-translate-anchor": new ii(Tt.paint_fill["fill-translate-anchor"]), "fill-pattern": new oi(Tt.paint_fill["fill-pattern"]) }), layout: qo }, Ko = function (t) { function e(e) { t.call(this, e, No); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.recalculate = function (e, r) { t.prototype.recalculate.call(this, e, r); var n = this.paint._values["fill-outline-color"]; "constant" === n.value.kind && void 0 === n.value.value && (this.paint._values["fill-outline-color"] = this.paint._values["fill-color"]); }, e.prototype.createBucket = function (t) { return new jo(t) }, e.prototype.queryRadius = function () { return Oa(this.paint.get("fill-translate")) }, e.prototype.queryIntersectsFeature = function (t, e, r, n, i, a, o) { return za(Da(t, this.paint.get("fill-translate"), this.paint.get("fill-translate-anchor"), a.angle, o), n) }, e.prototype.isTileClipped = function () { return !0 }, e }(pi), Xo = yi([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_normal_ed", components: 4, type: "Int16" }], 4).members, Zo = Go; function Go(t, e, r, n, i) { this.properties = {}, this.extent = r, this.type = 0, this._pbf = t, this._geometry = -1, this._keys = n, this._values = i, t.readFields(Jo, this, e); } function Jo(t, e, r) { 1 == t ? e.id = r.readVarint() : 2 == t ? function (t, e) { var r = t.readVarint() + t.pos; for (; t.pos < r;) { var n = e._keys[t.readVarint()], i = e._values[t.readVarint()]; e.properties[n] = i; } }(r, e) : 3 == t ? e.type = r.readVarint() : 4 == t && (e._geometry = r.pos); } function Ho(t) { for (var e, r, n = 0, i = 0, a = t.length, o = a - 1; i < a; o = i++)e = t[i], n += ((r = t[o]).x - e.x) * (e.y + r.y); return n } Go.types = ["Unknown", "Point", "LineString", "Polygon"], Go.prototype.loadGeometry = function () { var t = this._pbf; t.pos = this._geometry; for (var e, r = t.readVarint() + t.pos, n = 1, a = 0, o = 0, s = 0, u = []; t.pos < r;) { if (a <= 0) { var l = t.readVarint(); n = 7 & l, a = l >> 3; } if (a-- , 1 === n || 2 === n) o += t.readSVarint(), s += t.readSVarint(), 1 === n && (e && u.push(e), e = []), e.push(new i(o, s)); else { if (7 !== n) throw new Error("unknown command " + n); e && e.push(e[0].clone()); } } return e && u.push(e), u }, Go.prototype.bbox = function () { var t = this._pbf; t.pos = this._geometry; for (var e = t.readVarint() + t.pos, r = 1, n = 0, i = 0, a = 0, o = 1 / 0, s = -1 / 0, u = 1 / 0, l = -1 / 0; t.pos < e;) { if (n <= 0) { var p = t.readVarint(); r = 7 & p, n = p >> 3; } if (n-- , 1 === r || 2 === r) (i += t.readSVarint()) < o && (o = i), i > s && (s = i), (a += t.readSVarint()) < u && (u = a), a > l && (l = a); else if (7 !== r) throw new Error("unknown command " + r) } return [o, u, s, l] }, Go.prototype.toGeoJSON = function (t, e, r) { var n, i, a = this.extent * Math.pow(2, r), o = this.extent * t, s = this.extent * e, u = this.loadGeometry(), l = Go.types[this.type]; function p(t) { for (var e = 0; e < t.length; e++) { var r = t[e], n = 180 - 360 * (r.y + s) / a; t[e] = [360 * (r.x + o) / a - 180, 360 / Math.PI * Math.atan(Math.exp(n * Math.PI / 180)) - 90]; } } switch (this.type) { case 1: var c = []; for (n = 0; n < u.length; n++)c[n] = u[n][0]; p(u = c); break; case 2: for (n = 0; n < u.length; n++)p(u[n]); break; case 3: for (u = function (t) { var e = t.length; if (e <= 1) return [t]; for (var r, n, i = [], a = 0; a < e; a++) { var o = Ho(t[a]); 0 !== o && (void 0 === n && (n = o < 0), n === o < 0 ? (r && i.push(r), r = [t[a]]) : r.push(t[a])); } r && i.push(r); return i }(u), n = 0; n < u.length; n++)for (i = 0; i < u[n].length; i++)p(u[n][i]); }1 === u.length ? u = u[0] : l = "Multi" + l; var h = { type: "Feature", geometry: { type: l, coordinates: u }, properties: this.properties }; return "id" in this && (h.id = this.id), h }; var Yo = $o; function $o(t, e) { this.version = 1, this.name = null, this.extent = 4096, this.length = 0, this._pbf = t, this._keys = [], this._values = [], this._features = [], t.readFields(Wo, this, e), this.length = this._features.length; } function Wo(t, e, r) { 15 === t ? e.version = r.readVarint() : 1 === t ? e.name = r.readString() : 5 === t ? e.extent = r.readVarint() : 2 === t ? e._features.push(r.pos) : 3 === t ? e._keys.push(r.readString()) : 4 === t && e._values.push(function (t) { var e = null, r = t.readVarint() + t.pos; for (; t.pos < r;) { var n = t.readVarint() >> 3; e = 1 === n ? t.readString() : 2 === n ? t.readFloat() : 3 === n ? t.readDouble() : 4 === n ? t.readVarint64() : 5 === n ? t.readVarint() : 6 === n ? t.readSVarint() : 7 === n ? t.readBoolean() : null; } return e }(r)); } function Qo(t, e, r) { if (3 === t) { var n = new Yo(r, r.readVarint() + r.pos); n.length && (e[n.name] = n); } } $o.prototype.feature = function (t) { if (t < 0 || t >= this._features.length) throw new Error("feature index out of bounds"); this._pbf.pos = this._features[t]; var e = this._pbf.readVarint() + this._pbf.pos; return new Zo(this._pbf, e, this.extent, this._keys, this._values) }; var ts = { VectorTile: function (t, e) { this.layers = t.readFields(Qo, {}, e); }, VectorTileFeature: Zo, VectorTileLayer: Yo }, es = ts.VectorTileFeature.types, rs = Math.pow(2, 13); function ns(t, e, r, n, i, a, o, s) { t.emplaceBack(e, r, 2 * Math.floor(n * rs) + o, i * rs * 2, a * rs * 2, Math.round(s)); } var is = function (t) { this.zoom = t.zoom, this.overscaling = t.overscaling, this.layers = t.layers, this.layerIds = this.layers.map((function (t) { return t.id })), this.index = t.index, this.hasPattern = !1, this.layoutVertexArray = new gi, this.indexArray = new Ei, this.programConfigurations = new ma(Xo, t.layers, t.zoom), this.segments = new Yi, this.stateDependentLayerIds = this.layers.filter((function (t) { return t.isStateDependent() })).map((function (t) { return t.id })); }; function as(t, e) { return t.x === e.x && (t.x < 0 || t.x > xa) || t.y === e.y && (t.y < 0 || t.y > xa) } function os(t) { return t.every((function (t) { return t.x < 0 })) || t.every((function (t) { return t.x > xa })) || t.every((function (t) { return t.y < 0 })) || t.every((function (t) { return t.y > xa })) } is.prototype.populate = function (t, e) { this.features = [], this.hasPattern = Ro("fill-extrusion", this.layers, e); for (var r = 0, n = t; r < n.length; r += 1) { var i = n[r], a = i.feature, o = i.index, s = i.sourceLayerIndex; if (this.layers[0]._featureFilter(new Hn(this.zoom), a)) { var u = wa(a), l = { sourceLayerIndex: s, index: o, geometry: u, properties: a.properties, type: a.type, patterns: {} }; void 0 !== a.id && (l.id = a.id), this.hasPattern ? this.features.push(Uo("fill-extrusion", this.layers, l, this.zoom, e)) : this.addFeature(l, u, o, {}), e.featureIndex.insert(a, u, o, s, this.index, !0); } } }, is.prototype.addFeatures = function (t, e) { for (var r = 0, n = this.features; r < n.length; r += 1) { var i = n[r], a = i.geometry; this.addFeature(i, a, i.index, e); } }, is.prototype.update = function (t, e, r) { this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t, e, this.stateDependentLayers, r); }, is.prototype.isEmpty = function () { return 0 === this.layoutVertexArray.length }, is.prototype.uploadPending = function () { return !this.uploaded || this.programConfigurations.needsUpload }, is.prototype.upload = function (t) { this.uploaded || (this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, Xo), this.indexBuffer = t.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t), this.uploaded = !0; }, is.prototype.destroy = function () { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy()); }, is.prototype.addFeature = function (t, e, r, n) { for (var i = 0, a = Oo(e, 500); i < a.length; i += 1) { for (var o = a[i], s = 0, u = 0, l = o; u < l.length; u += 1) { s += l[u].length; } for (var p = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray), c = 0, h = o; c < h.length; c += 1) { var f = h[c]; if (0 !== f.length && !os(f)) for (var y = 0, d = 0; d < f.length; d++) { var m = f[d]; if (d >= 1) { var v = f[d - 1]; if (!as(m, v)) { p.vertexLength + 4 > Yi.MAX_VERTEX_ARRAY_LENGTH && (p = this.segments.prepareSegment(4, this.layoutVertexArray, this.indexArray)); var g = m.sub(v)._perp()._unit(), x = v.dist(m); y + x > 32768 && (y = 0), ns(this.layoutVertexArray, m.x, m.y, g.x, g.y, 0, 0, y), ns(this.layoutVertexArray, m.x, m.y, g.x, g.y, 0, 1, y), y += x, ns(this.layoutVertexArray, v.x, v.y, g.x, g.y, 0, 0, y), ns(this.layoutVertexArray, v.x, v.y, g.x, g.y, 0, 1, y); var b = p.vertexLength; this.indexArray.emplaceBack(b, b + 2, b + 1), this.indexArray.emplaceBack(b + 1, b + 2, b + 3), p.vertexLength += 4, p.primitiveLength += 2; } } } } if (p.vertexLength + s > Yi.MAX_VERTEX_ARRAY_LENGTH && (p = this.segments.prepareSegment(s, this.layoutVertexArray, this.indexArray)), "Polygon" === es[t.type]) { for (var _ = [], w = [], A = p.vertexLength, S = 0, k = o; S < k.length; S += 1) { var I = k[S]; if (0 !== I.length) { I !== o[0] && w.push(_.length / 2); for (var z = 0; z < I.length; z++) { var C = I[z]; ns(this.layoutVertexArray, C.x, C.y, 0, 0, 1, 1, 0), _.push(C.x), _.push(C.y); } } } for (var B = ao(_, w), T = 0; T < B.length; T += 3)this.indexArray.emplaceBack(A + B[T], A + B[T + 2], A + B[T + 1]); p.primitiveLength += B.length / 3, p.vertexLength += s; } } this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, t, r, n); }, An("FillExtrusionBucket", is, { omit: ["layers", "features"] }); var ss = { paint: new li({ "fill-extrusion-opacity": new ii(Tt["paint_fill-extrusion"]["fill-extrusion-opacity"]), "fill-extrusion-color": new ai(Tt["paint_fill-extrusion"]["fill-extrusion-color"]), "fill-extrusion-translate": new ii(Tt["paint_fill-extrusion"]["fill-extrusion-translate"]), "fill-extrusion-translate-anchor": new ii(Tt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]), "fill-extrusion-pattern": new oi(Tt["paint_fill-extrusion"]["fill-extrusion-pattern"]), "fill-extrusion-height": new ai(Tt["paint_fill-extrusion"]["fill-extrusion-height"]), "fill-extrusion-base": new ai(Tt["paint_fill-extrusion"]["fill-extrusion-base"]), "fill-extrusion-vertical-gradient": new ii(Tt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]) }) }, us = function (t) { function e(e) { t.call(this, e, ss); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.createBucket = function (t) { return new is(t) }, e.prototype.queryRadius = function () { return Oa(this.paint.get("fill-extrusion-translate")) }, e.prototype.is3D = function () { return !0 }, e.prototype.queryIntersectsFeature = function (t, e, r, n, a, o, s, u) { var l = Da(t, this.paint.get("fill-extrusion-translate"), this.paint.get("fill-extrusion-translate-anchor"), o.angle, s), p = this.paint.get("fill-extrusion-height").evaluate(e, r), c = this.paint.get("fill-extrusion-base").evaluate(e, r), h = function (t, e, r, n) { for (var a = [], o = 0, s = t; o < s.length; o += 1) { var u = s[o], l = [u.x, u.y, n, 1]; Ka(l, l, e), a.push(new i(l[0] / l[3], l[1] / l[3])); } return a }(l, u, 0, 0), f = function (t, e, r, n) { for (var a = [], o = [], s = n[8] * e, u = n[9] * e, l = n[10] * e, p = n[11] * e, c = n[8] * r, h = n[9] * r, f = n[10] * r, y = n[11] * r, d = 0, m = t; d < m.length; d += 1) { for (var v = m[d], g = [], x = [], b = 0, _ = v; b < _.length; b += 1) { var w = _[b], A = w.x, S = w.y, k = n[0] * A + n[4] * S + n[12], I = n[1] * A + n[5] * S + n[13], z = n[2] * A + n[6] * S + n[14], C = n[3] * A + n[7] * S + n[15], B = z + l, T = C + p, P = k + c, E = I + h, M = z + f, V = C + y, F = new i((k + s) / T, (I + u) / T); F.z = B / T, g.push(F); var L = new i(P / V, E / V); L.z = M / V, x.push(L); } a.push(g), o.push(x); } return [a, o] }(n, c, p, u); return function (t, e, r) { var n = 1 / 0; za(r, e) && (n = ps(r, e[0])); for (var i = 0; i < e.length; i++)for (var a = e[i], o = t[i], s = 0; s < a.length - 1; s++) { var u = a[s], l = a[s + 1], p = o[s], c = o[s + 1], h = [u, l, c, p, u]; ka(r, h) && (n = Math.min(n, ps(r, h))); } return n !== 1 / 0 && n }(f[0], f[1], h) }, e }(pi); function ls(t, e) { return t.x * e.x + t.y * e.y } function ps(t, e) { if (1 === t.length) { var r = e[0], n = e[1], i = e[3], a = t[0], o = n.sub(r), s = i.sub(r), u = a.sub(r), l = ls(o, o), p = ls(o, s), c = ls(s, s), h = ls(u, o), f = ls(u, s), y = l * c - p * p, d = (c * h - p * f) / y, m = (l * f - p * h) / y, v = 1 - d - m; return r.z * v + n.z * d + i.z * m } for (var g = 1 / 0, x = 0, b = e; x < b.length; x += 1) { var _ = b[x]; g = Math.min(g, _.z); } return g } var cs = yi([{ name: "a_pos_normal", components: 2, type: "Int16" }, { name: "a_data", components: 4, type: "Uint8" }], 4).members, hs = ts.VectorTileFeature.types, fs = Math.cos(Math.PI / 180 * 37.5), ys = Math.pow(2, 14) / .5, ds = function (t) { this.zoom = t.zoom, this.overscaling = t.overscaling, this.layers = t.layers, this.layerIds = this.layers.map((function (t) { return t.id })), this.index = t.index, this.hasPattern = !1, this.patternFeatures = [], this.layoutVertexArray = new xi, this.indexArray = new Ei, this.programConfigurations = new ma(cs, t.layers, t.zoom), this.segments = new Yi, this.stateDependentLayerIds = this.layers.filter((function (t) { return t.isStateDependent() })).map((function (t) { return t.id })); }; ds.prototype.populate = function (t, e) { this.hasPattern = Ro("line", this.layers, e); for (var r = this.layers[0].layout.get("line-sort-key"), n = [], i = 0, a = t; i < a.length; i += 1) { var o = a[i], s = o.feature, u = o.index, l = o.sourceLayerIndex; if (this.layers[0]._featureFilter(new Hn(this.zoom), s)) { var p = wa(s), c = r ? r.evaluate(s, {}) : void 0, h = { id: s.id, properties: s.properties, type: s.type, sourceLayerIndex: l, index: u, geometry: p, patterns: {}, sortKey: c }; n.push(h); } } r && n.sort((function (t, e) { return t.sortKey - e.sortKey })); for (var f = 0, y = n; f < y.length; f += 1) { var d = y[f], m = d, v = m.geometry, g = m.index, x = m.sourceLayerIndex; if (this.hasPattern) { var b = Uo("line", this.layers, d, this.zoom, e); this.patternFeatures.push(b); } else this.addFeature(d, v, g, {}); var _ = t[g].feature; e.featureIndex.insert(_, v, g, x, this.index); } }, ds.prototype.update = function (t, e, r) { this.stateDependentLayers.length && this.programConfigurations.updatePaintArrays(t, e, this.stateDependentLayers, r); }, ds.prototype.addFeatures = function (t, e) { for (var r = 0, n = this.patternFeatures; r < n.length; r += 1) { var i = n[r]; this.addFeature(i, i.geometry, i.index, e); } }, ds.prototype.isEmpty = function () { return 0 === this.layoutVertexArray.length }, ds.prototype.uploadPending = function () { return !this.uploaded || this.programConfigurations.needsUpload }, ds.prototype.upload = function (t) { this.uploaded || (this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, cs), this.indexBuffer = t.createIndexBuffer(this.indexArray)), this.programConfigurations.upload(t), this.uploaded = !0; }, ds.prototype.destroy = function () { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy()); }, ds.prototype.addFeature = function (t, e, r, n) { for (var i = this.layers[0].layout, a = i.get("line-join").evaluate(t, {}), o = i.get("line-cap"), s = i.get("line-miter-limit"), u = i.get("line-round-limit"), l = 0, p = e; l < p.length; l += 1) { var c = p[l]; this.addLine(c, t, a, o, s, u, r, n); } }, ds.prototype.addLine = function (t, e, r, n, i, a, o, s) { if (this.distance = 0, this.scaledDistance = 0, this.totalDistance = 0, e.properties && e.properties.hasOwnProperty("mapbox_clip_start") && e.properties.hasOwnProperty("mapbox_clip_end")) { this.clipStart = +e.properties.mapbox_clip_start, this.clipEnd = +e.properties.mapbox_clip_end; for (var u = 0; u < t.length - 1; u++)this.totalDistance += t[u].dist(t[u + 1]); } for (var l = "Polygon" === hs[e.type], p = t.length; p >= 2 && t[p - 1].equals(t[p - 2]);)p--; for (var c = 0; c < p - 1 && t[c].equals(t[c + 1]);)c++; if (!(p < (l ? 3 : 2))) { "bevel" === r && (i = 1.05); var h, f = this.overscaling <= 16 ? 15 * xa / (512 * this.overscaling) : 0, y = this.segments.prepareSegment(10 * p, this.layoutVertexArray, this.indexArray), d = void 0, m = void 0, v = void 0, g = void 0; this.e1 = this.e2 = -1, l && (h = t[p - 2], g = t[c].sub(h)._unit()._perp()); for (var x = c; x < p; x++)if (!(m = l && x === p - 1 ? t[c + 1] : t[x + 1]) || !t[x].equals(m)) { g && (v = g), h && (d = h), h = t[x], g = m ? m.sub(h)._unit()._perp() : v; var b = (v = v || g).add(g); 0 === b.x && 0 === b.y || b._unit(); var _ = v.x * g.x + v.y * g.y, w = b.x * g.x + b.y * g.y, A = 0 !== w ? 1 / w : 1 / 0, S = 2 * Math.sqrt(2 - 2 * w), k = w < fs && d && m, I = v.x * g.y - v.y * g.x > 0; if (k && x > c) { var z = h.dist(d); if (z > 2 * f) { var C = h.sub(h.sub(d)._mult(f / z)._round()); this.updateDistance(d, C), this.addCurrentVertex(C, v, 0, 0, y), d = C; } } var B = d && m, T = B ? r : l ? "butt" : n; if (B && "round" === T && (A < a ? T = "miter" : A <= 2 && (T = "fakeround")), "miter" === T && A > i && (T = "bevel"), "bevel" === T && (A > 2 && (T = "flipbevel"), A < i && (T = "miter")), d && this.updateDistance(d, h), "miter" === T) b._mult(A), this.addCurrentVertex(h, b, 0, 0, y); else if ("flipbevel" === T) { if (A > 100) b = g.mult(-1); else { var P = A * v.add(g).mag() / v.sub(g).mag(); b._perp()._mult(P * (I ? -1 : 1)); } this.addCurrentVertex(h, b, 0, 0, y), this.addCurrentVertex(h, b.mult(-1), 0, 0, y); } else if ("bevel" === T || "fakeround" === T) { var E = -Math.sqrt(A * A - 1), M = I ? E : 0, V = I ? 0 : E; if (d && this.addCurrentVertex(h, v, M, V, y), "fakeround" === T) for (var F = Math.round(180 * S / Math.PI / 20), L = 1; L < F; L++) { var O = L / F; if (.5 !== O) { var D = O - .5; O += O * D * (O - 1) * ((1.0904 + _ * (_ * (3.55645 - 1.43519 * _) - 3.2452)) * D * D + (.848013 + _ * (.215638 * _ - 1.06021))); } var R = g.sub(v)._mult(O)._add(v)._unit()._mult(I ? -1 : 1); this.addHalfVertex(h, R.x, R.y, !1, I, 0, y); } m && this.addCurrentVertex(h, g, -M, -V, y); } else if ("butt" === T) this.addCurrentVertex(h, b, 0, 0, y); else if ("square" === T) { var U = d ? 1 : -1; this.addCurrentVertex(h, b, U, U, y); } else "round" === T && (d && (this.addCurrentVertex(h, v, 0, 0, y), this.addCurrentVertex(h, v, 1, 1, y, !0)), m && (this.addCurrentVertex(h, g, -1, -1, y, !0), this.addCurrentVertex(h, g, 0, 0, y))); if (k && x < p - 1) { var j = h.dist(m); if (j > 2 * f) { var q = h.add(m.sub(h)._mult(f / j)._round()); this.updateDistance(h, q), this.addCurrentVertex(q, g, 0, 0, y), h = q; } } } this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length, e, o, s); } }, ds.prototype.addCurrentVertex = function (t, e, r, n, i, a) { void 0 === a && (a = !1); var o = e.x + e.y * r, s = e.y - e.x * r, u = -e.x + e.y * n, l = -e.y - e.x * n; this.addHalfVertex(t, o, s, a, !1, r, i), this.addHalfVertex(t, u, l, a, !0, -n, i), this.distance > ys / 2 && 0 === this.totalDistance && (this.distance = 0, this.addCurrentVertex(t, e, r, n, i, a)); }, ds.prototype.addHalfVertex = function (t, e, r, n, i, a, o) { var s = t.x, u = t.y, l = .5 * this.scaledDistance; this.layoutVertexArray.emplaceBack((s << 1) + (n ? 1 : 0), (u << 1) + (i ? 1 : 0), Math.round(63 * e) + 128, Math.round(63 * r) + 128, 1 + (0 === a ? 0 : a < 0 ? -1 : 1) | (63 & l) << 2, l >> 6); var p = o.vertexLength++; this.e1 >= 0 && this.e2 >= 0 && (this.indexArray.emplaceBack(this.e1, this.e2, p), o.primitiveLength++), i ? this.e2 = p : this.e1 = p; }, ds.prototype.updateDistance = function (t, e) { this.distance += t.dist(e), this.scaledDistance = this.totalDistance > 0 ? (this.clipStart + (this.clipEnd - this.clipStart) * this.distance / this.totalDistance) * (ys - 1) : this.distance; }, An("LineBucket", ds, { omit: ["layers", "patternFeatures"] }); var ms = new li({ "line-cap": new ii(Tt.layout_line["line-cap"]), "line-join": new ai(Tt.layout_line["line-join"]), "line-miter-limit": new ii(Tt.layout_line["line-miter-limit"]), "line-round-limit": new ii(Tt.layout_line["line-round-limit"]), "line-sort-key": new ai(Tt.layout_line["line-sort-key"]) }), vs = { paint: new li({ "line-opacity": new ai(Tt.paint_line["line-opacity"]), "line-color": new ai(Tt.paint_line["line-color"]), "line-translate": new ii(Tt.paint_line["line-translate"]), "line-translate-anchor": new ii(Tt.paint_line["line-translate-anchor"]), "line-width": new ai(Tt.paint_line["line-width"]), "line-gap-width": new ai(Tt.paint_line["line-gap-width"]), "line-offset": new ai(Tt.paint_line["line-offset"]), "line-blur": new ai(Tt.paint_line["line-blur"]), "line-dasharray": new si(Tt.paint_line["line-dasharray"]), "line-pattern": new oi(Tt.paint_line["line-pattern"]), "line-gradient": new ui(Tt.paint_line["line-gradient"]) }), layout: ms }, gs = new (function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.possiblyEvaluate = function (e, r) { return r = new Hn(Math.floor(r.zoom), { now: r.now, fadeDuration: r.fadeDuration, zoomHistory: r.zoomHistory, transition: r.transition }), t.prototype.possiblyEvaluate.call(this, e, r) }, e.prototype.evaluate = function (e, r, n, i) { return r = c({}, r, { zoom: Math.floor(r.zoom) }), t.prototype.evaluate.call(this, e, r, n, i) }, e }(ai))(vs.paint.properties["line-width"].specification); gs.useIntegerZoom = !0; var xs = function (t) { function e(e) { t.call(this, e, vs); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype._handleSpecialPaintPropertyUpdate = function (t) { "line-gradient" === t && this._updateGradient(); }, e.prototype._updateGradient = function () { var t = this._transitionablePaint._values["line-gradient"].value.expression; this.gradient = to(t, "lineProgress"), this.gradientTexture = null; }, e.prototype.recalculate = function (e, r) { t.prototype.recalculate.call(this, e, r), this.paint._values["line-floorwidth"] = gs.possiblyEvaluate(this._transitioningPaint._values["line-width"].value, e); }, e.prototype.createBucket = function (t) { return new ds(t) }, e.prototype.queryRadius = function (t) { var e = t, r = bs(La("line-width", this, e), La("line-gap-width", this, e)), n = La("line-offset", this, e); return r / 2 + Math.abs(n) + Oa(this.paint.get("line-translate")) }, e.prototype.queryIntersectsFeature = function (t, e, r, n, a, o, s) { var u = Da(t, this.paint.get("line-translate"), this.paint.get("line-translate-anchor"), o.angle, s), l = s / 2 * bs(this.paint.get("line-width").evaluate(e, r), this.paint.get("line-gap-width").evaluate(e, r)), p = this.paint.get("line-offset").evaluate(e, r); return p && (n = function (t, e) { for (var r = [], n = new i(0, 0), a = 0; a < t.length; a++) { for (var o = t[a], s = [], u = 0; u < o.length; u++) { var l = o[u - 1], p = o[u], c = o[u + 1], h = 0 === u ? n : p.sub(l)._unit()._perp(), f = u === o.length - 1 ? n : c.sub(p)._unit()._perp(), y = h._add(f)._unit(), d = y.x * f.x + y.y * f.y; y._mult(1 / d), s.push(y._mult(e)._add(p)); } r.push(s); } return r }(n, p * s)), function (t, e, r) { for (var n = 0; n < e.length; n++) { var i = e[n]; if (t.length >= 3) for (var a = 0; a < i.length; a++)if (Va(t, i[a])) return !0; if (Ca(t, i, r)) return !0 } return !1 }(u, n, l) }, e.prototype.isTileClipped = function () { return !0 }, e }(pi); function bs(t, e) { return e > 0 ? e + 2 * t : t } var _s = yi([{ name: "a_pos_offset", components: 4, type: "Int16" }, { name: "a_data", components: 4, type: "Uint16" }, { name: "a_pixeloffset", components: 4, type: "Int16" }], 4), ws = yi([{ name: "a_projected_pos", components: 3, type: "Float32" }], 4), As = (yi([{ name: "a_fade_opacity", components: 1, type: "Uint32" }], 4), yi([{ name: "a_placed", components: 2, type: "Uint8" }, { name: "a_shift", components: 2, type: "Float32" }])), Ss = (yi([{ type: "Int16", name: "anchorPointX" }, { type: "Int16", name: "anchorPointY" }, { type: "Int16", name: "x1" }, { type: "Int16", name: "y1" }, { type: "Int16", name: "x2" }, { type: "Int16", name: "y2" }, { type: "Uint32", name: "featureIndex" }, { type: "Uint16", name: "sourceLayerIndex" }, { type: "Uint16", name: "bucketIndex" }, { type: "Int16", name: "radius" }, { type: "Int16", name: "signedDistanceFromAnchor" }]), yi([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4)), ks = yi([{ name: "a_pos", components: 2, type: "Int16" }, { name: "a_anchor_pos", components: 2, type: "Int16" }, { name: "a_extrude", components: 2, type: "Int16" }], 4); yi([{ type: "Int16", name: "anchorX" }, { type: "Int16", name: "anchorY" }, { type: "Uint16", name: "glyphStartIndex" }, { type: "Uint16", name: "numGlyphs" }, { type: "Uint32", name: "vertexStartIndex" }, { type: "Uint32", name: "lineStartIndex" }, { type: "Uint32", name: "lineLength" }, { type: "Uint16", name: "segment" }, { type: "Uint16", name: "lowerSize" }, { type: "Uint16", name: "upperSize" }, { type: "Float32", name: "lineOffsetX" }, { type: "Float32", name: "lineOffsetY" }, { type: "Uint8", name: "writingMode" }, { type: "Uint8", name: "placedOrientation" }, { type: "Uint8", name: "hidden" }, { type: "Uint32", name: "crossTileID" }, { type: "Int16", name: "associatedIconIndex" }]), yi([{ type: "Int16", name: "anchorX" }, { type: "Int16", name: "anchorY" }, { type: "Int16", name: "rightJustifiedTextSymbolIndex" }, { type: "Int16", name: "centerJustifiedTextSymbolIndex" }, { type: "Int16", name: "leftJustifiedTextSymbolIndex" }, { type: "Int16", name: "verticalPlacedTextSymbolIndex" }, { type: "Int16", name: "placedIconSymbolIndex" }, { type: "Int16", name: "verticalPlacedIconSymbolIndex" }, { type: "Uint16", name: "key" }, { type: "Uint16", name: "textBoxStartIndex" }, { type: "Uint16", name: "textBoxEndIndex" }, { type: "Uint16", name: "verticalTextBoxStartIndex" }, { type: "Uint16", name: "verticalTextBoxEndIndex" }, { type: "Uint16", name: "iconBoxStartIndex" }, { type: "Uint16", name: "iconBoxEndIndex" }, { type: "Uint16", name: "verticalIconBoxStartIndex" }, { type: "Uint16", name: "verticalIconBoxEndIndex" }, { type: "Uint16", name: "featureIndex" }, { type: "Uint16", name: "numHorizontalGlyphVertices" }, { type: "Uint16", name: "numVerticalGlyphVertices" }, { type: "Uint16", name: "numIconVertices" }, { type: "Uint16", name: "numVerticalIconVertices" }, { type: "Uint32", name: "crossTileID" }, { type: "Float32", name: "textBoxScale" }, { type: "Float32", components: 2, name: "textOffset" }]), yi([{ type: "Float32", name: "offsetX" }]), yi([{ type: "Int16", name: "x" }, { type: "Int16", name: "y" }, { type: "Int16", name: "tileUnitDistanceFromAnchor" }]); function Is(t, e, r) { return t.sections.forEach((function (t) { t.text = function (t, e, r) { var n = e.layout.get("text-transform").evaluate(r, {}); return "uppercase" === n ? t = t.toLocaleUpperCase() : "lowercase" === n && (t = t.toLocaleLowerCase()), Jn.applyArabicShaping && (t = Jn.applyArabicShaping(t)), t }(t.text, e, r); })), t } var zs = { "!": "︕", "#": "#", $: "$", "%": "%", "&": "&", "(": "︵", ")": "︶", "*": "*", "+": "+", ",": "︐", "-": "︲", ".": "・", "/": "/", ":": "︓", ";": "︔", "<": "︿", "=": "=", ">": "﹀", "?": "︖", "@": "@", "[": "﹇", "\\": "\", "]": "﹈", "^": "^", _: "︳", "`": "`", "{": "︷", "|": "―", "}": "︸", "~": "~", "¢": "¢", "£": "£", "¥": "¥", "¦": "¦", "¬": "¬", "¯": " ̄", "–": "︲", "—": "︱", "‘": "﹃", "’": "﹄", "“": "﹁", "”": "﹂", "…": "︙", "‧": "・", "₩": "₩", "、": "︑", "。": "︒", "〈": "︿", "〉": "﹀", "《": "︽", "》": "︾", "「": "﹁", "」": "﹂", "『": "﹃", "』": "﹄", "【": "︻", "】": "︼", "〔": "︹", "〕": "︺", "〖": "︗", "〗": "︘", "!": "︕", "(": "︵", ")": "︶", ",": "︐", "-": "︲", ".": "・", ":": "︓", ";": "︔", "<": "︿", ">": "﹀", "?": "︖", "[": "﹇", "]": "﹈", "_": "︳", "{": "︷", "|": "―", "}": "︸", "⦅": "︵", "⦆": "︶", "。": "︒", "「": "﹁", "」": "﹂" }; var Cs = 24, Bs = function (t, e, r, n, i) { var a, o, s = 8 * i - n - 1, u = (1 << s) - 1, l = u >> 1, p = -7, c = r ? i - 1 : 0, h = r ? -1 : 1, f = t[e + c]; for (c += h, a = f & (1 << -p) - 1, f >>= -p, p += s; p > 0; a = 256 * a + t[e + c], c += h, p -= 8); for (o = a & (1 << -p) - 1, a >>= -p, p += n; p > 0; o = 256 * o + t[e + c], c += h, p -= 8); if (0 === a) a = 1 - l; else { if (a === u) return o ? NaN : 1 / 0 * (f ? -1 : 1); o += Math.pow(2, n), a -= l; } return (f ? -1 : 1) * o * Math.pow(2, a - n) }, Ts = function (t, e, r, n, i, a) { var o, s, u, l = 8 * a - i - 1, p = (1 << l) - 1, c = p >> 1, h = 23 === i ? Math.pow(2, -24) - Math.pow(2, -77) : 0, f = n ? 0 : a - 1, y = n ? 1 : -1, d = e < 0 || 0 === e && 1 / e < 0 ? 1 : 0; for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (s = isNaN(e) ? 1 : 0, o = p) : (o = Math.floor(Math.log(e) / Math.LN2), e * (u = Math.pow(2, -o)) < 1 && (o-- , u *= 2), (e += o + c >= 1 ? h / u : h * Math.pow(2, 1 - c)) * u >= 2 && (o++ , u /= 2), o + c >= p ? (s = 0, o = p) : o + c >= 1 ? (s = (e * u - 1) * Math.pow(2, i), o += c) : (s = e * Math.pow(2, c - 1) * Math.pow(2, i), o = 0)); i >= 8; t[r + f] = 255 & s, f += y, s /= 256, i -= 8); for (o = o << i | s, l += i; l > 0; t[r + f] = 255 & o, f += y, o /= 256, l -= 8); t[r + f - y] |= 128 * d; }, Ps = Es; function Es(t) { this.buf = ArrayBuffer.isView && ArrayBuffer.isView(t) ? t : new Uint8Array(t || 0), this.pos = 0, this.type = 0, this.length = this.buf.length; } Es.Varint = 0, Es.Fixed64 = 1, Es.Bytes = 2, Es.Fixed32 = 5; var Ms = "undefined" == typeof TextDecoder ? null : new TextDecoder("utf8"); function Vs(t) { return t.type === Es.Bytes ? t.readVarint() + t.pos : t.pos + 1 } function Fs(t, e, r) { return r ? 4294967296 * e + (t >>> 0) : 4294967296 * (e >>> 0) + (t >>> 0) } function Ls(t, e, r) { var n = e <= 16383 ? 1 : e <= 2097151 ? 2 : e <= 268435455 ? 3 : Math.floor(Math.log(e) / (7 * Math.LN2)); r.realloc(n); for (var i = r.pos - 1; i >= t; i--)r.buf[i + n] = r.buf[i]; } function Os(t, e) { for (var r = 0; r < t.length; r++)e.writeVarint(t[r]); } function Ds(t, e) { for (var r = 0; r < t.length; r++)e.writeSVarint(t[r]); } function Rs(t, e) { for (var r = 0; r < t.length; r++)e.writeFloat(t[r]); } function Us(t, e) { for (var r = 0; r < t.length; r++)e.writeDouble(t[r]); } function js(t, e) { for (var r = 0; r < t.length; r++)e.writeBoolean(t[r]); } function qs(t, e) { for (var r = 0; r < t.length; r++)e.writeFixed32(t[r]); } function Ns(t, e) { for (var r = 0; r < t.length; r++)e.writeSFixed32(t[r]); } function Ks(t, e) { for (var r = 0; r < t.length; r++)e.writeFixed64(t[r]); } function Xs(t, e) { for (var r = 0; r < t.length; r++)e.writeSFixed64(t[r]); } function Zs(t, e) { return (t[e] | t[e + 1] << 8 | t[e + 2] << 16) + 16777216 * t[e + 3] } function Gs(t, e, r) { t[r] = e, t[r + 1] = e >>> 8, t[r + 2] = e >>> 16, t[r + 3] = e >>> 24; } function Js(t, e) { return (t[e] | t[e + 1] << 8 | t[e + 2] << 16) + (t[e + 3] << 24) } Es.prototype = { destroy: function () { this.buf = null; }, readFields: function (t, e, r) { for (r = r || this.length; this.pos < r;) { var n = this.readVarint(), i = n >> 3, a = this.pos; this.type = 7 & n, t(i, e, this), this.pos === a && this.skip(n); } return e }, readMessage: function (t, e) { return this.readFields(t, e, this.readVarint() + this.pos) }, readFixed32: function () { var t = Zs(this.buf, this.pos); return this.pos += 4, t }, readSFixed32: function () { var t = Js(this.buf, this.pos); return this.pos += 4, t }, readFixed64: function () { var t = Zs(this.buf, this.pos) + 4294967296 * Zs(this.buf, this.pos + 4); return this.pos += 8, t }, readSFixed64: function () { var t = Zs(this.buf, this.pos) + 4294967296 * Js(this.buf, this.pos + 4); return this.pos += 8, t }, readFloat: function () { var t = Bs(this.buf, this.pos, !0, 23, 4); return this.pos += 4, t }, readDouble: function () { var t = Bs(this.buf, this.pos, !0, 52, 8); return this.pos += 8, t }, readVarint: function (t) { var e, r, n = this.buf; return e = 127 & (r = n[this.pos++]), r < 128 ? e : (e |= (127 & (r = n[this.pos++])) << 7, r < 128 ? e : (e |= (127 & (r = n[this.pos++])) << 14, r < 128 ? e : (e |= (127 & (r = n[this.pos++])) << 21, r < 128 ? e : function (t, e, r) { var n, i, a = r.buf; if (i = a[r.pos++], n = (112 & i) >> 4, i < 128) return Fs(t, n, e); if (i = a[r.pos++], n |= (127 & i) << 3, i < 128) return Fs(t, n, e); if (i = a[r.pos++], n |= (127 & i) << 10, i < 128) return Fs(t, n, e); if (i = a[r.pos++], n |= (127 & i) << 17, i < 128) return Fs(t, n, e); if (i = a[r.pos++], n |= (127 & i) << 24, i < 128) return Fs(t, n, e); if (i = a[r.pos++], n |= (1 & i) << 31, i < 128) return Fs(t, n, e); throw new Error("Expected varint not more than 10 bytes") }(e |= (15 & (r = n[this.pos])) << 28, t, this)))) }, readVarint64: function () { return this.readVarint(!0) }, readSVarint: function () { var t = this.readVarint(); return t % 2 == 1 ? (t + 1) / -2 : t / 2 }, readBoolean: function () { return Boolean(this.readVarint()) }, readString: function () { var t = this.readVarint() + this.pos, e = this.pos; return this.pos = t, t - e >= 12 && Ms ? function (t, e, r) { return Ms.decode(t.subarray(e, r)) }(this.buf, e, t) : function (t, e, r) { var n = "", i = e; for (; i < r;) { var a, o, s, u = t[i], l = null, p = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1; if (i + p > r) break; 1 === p ? u < 128 && (l = u) : 2 === p ? 128 == (192 & (a = t[i + 1])) && (l = (31 & u) << 6 | 63 & a) <= 127 && (l = null) : 3 === p ? (a = t[i + 1], o = t[i + 2], 128 == (192 & a) && 128 == (192 & o) && ((l = (15 & u) << 12 | (63 & a) << 6 | 63 & o) <= 2047 || l >= 55296 && l <= 57343) && (l = null)) : 4 === p && (a = t[i + 1], o = t[i + 2], s = t[i + 3], 128 == (192 & a) && 128 == (192 & o) && 128 == (192 & s) && ((l = (15 & u) << 18 | (63 & a) << 12 | (63 & o) << 6 | 63 & s) <= 65535 || l >= 1114112) && (l = null)), null === l ? (l = 65533, p = 1) : l > 65535 && (l -= 65536, n += String.fromCharCode(l >>> 10 & 1023 | 55296), l = 56320 | 1023 & l), n += String.fromCharCode(l), i += p; } return n }(this.buf, e, t) }, readBytes: function () { var t = this.readVarint() + this.pos, e = this.buf.subarray(this.pos, t); return this.pos = t, e }, readPackedVarint: function (t, e) { if (this.type !== Es.Bytes) return t.push(this.readVarint(e)); var r = Vs(this); for (t = t || []; this.pos < r;)t.push(this.readVarint(e)); return t }, readPackedSVarint: function (t) { if (this.type !== Es.Bytes) return t.push(this.readSVarint()); var e = Vs(this); for (t = t || []; this.pos < e;)t.push(this.readSVarint()); return t }, readPackedBoolean: function (t) { if (this.type !== Es.Bytes) return t.push(this.readBoolean()); var e = Vs(this); for (t = t || []; this.pos < e;)t.push(this.readBoolean()); return t }, readPackedFloat: function (t) { if (this.type !== Es.Bytes) return t.push(this.readFloat()); var e = Vs(this); for (t = t || []; this.pos < e;)t.push(this.readFloat()); return t }, readPackedDouble: function (t) { if (this.type !== Es.Bytes) return t.push(this.readDouble()); var e = Vs(this); for (t = t || []; this.pos < e;)t.push(this.readDouble()); return t }, readPackedFixed32: function (t) { if (this.type !== Es.Bytes) return t.push(this.readFixed32()); var e = Vs(this); for (t = t || []; this.pos < e;)t.push(this.readFixed32()); return t }, readPackedSFixed32: function (t) { if (this.type !== Es.Bytes) return t.push(this.readSFixed32()); var e = Vs(this); for (t = t || []; this.pos < e;)t.push(this.readSFixed32()); return t }, readPackedFixed64: function (t) { if (this.type !== Es.Bytes) return t.push(this.readFixed64()); var e = Vs(this); for (t = t || []; this.pos < e;)t.push(this.readFixed64()); return t }, readPackedSFixed64: function (t) { if (this.type !== Es.Bytes) return t.push(this.readSFixed64()); var e = Vs(this); for (t = t || []; this.pos < e;)t.push(this.readSFixed64()); return t }, skip: function (t) { var e = 7 & t; if (e === Es.Varint) for (; this.buf[this.pos++] > 127;); else if (e === Es.Bytes) this.pos = this.readVarint() + this.pos; else if (e === Es.Fixed32) this.pos += 4; else { if (e !== Es.Fixed64) throw new Error("Unimplemented type: " + e); this.pos += 8; } }, writeTag: function (t, e) { this.writeVarint(t << 3 | e); }, realloc: function (t) { for (var e = this.length || 16; e < this.pos + t;)e *= 2; if (e !== this.length) { var r = new Uint8Array(e); r.set(this.buf), this.buf = r, this.length = e; } }, finish: function () { return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length) }, writeFixed32: function (t) { this.realloc(4), Gs(this.buf, t, this.pos), this.pos += 4; }, writeSFixed32: function (t) { this.realloc(4), Gs(this.buf, t, this.pos), this.pos += 4; }, writeFixed64: function (t) { this.realloc(8), Gs(this.buf, -1 & t, this.pos), Gs(this.buf, Math.floor(t * (1 / 4294967296)), this.pos + 4), this.pos += 8; }, writeSFixed64: function (t) { this.realloc(8), Gs(this.buf, -1 & t, this.pos), Gs(this.buf, Math.floor(t * (1 / 4294967296)), this.pos + 4), this.pos += 8; }, writeVarint: function (t) { (t = +t || 0) > 268435455 || t < 0 ? function (t, e) { var r, n; t >= 0 ? (r = t % 4294967296 | 0, n = t / 4294967296 | 0) : (n = ~(-t / 4294967296), 4294967295 ^ (r = ~(-t % 4294967296)) ? r = r + 1 | 0 : (r = 0, n = n + 1 | 0)); if (t >= 0x10000000000000000 || t < -0x10000000000000000) throw new Error("Given varint doesn't fit into 10 bytes"); e.realloc(10), function (t, e, r) { r.buf[r.pos++] = 127 & t | 128, t >>>= 7, r.buf[r.pos++] = 127 & t | 128, t >>>= 7, r.buf[r.pos++] = 127 & t | 128, t >>>= 7, r.buf[r.pos++] = 127 & t | 128, t >>>= 7, r.buf[r.pos] = 127 & t; }(r, 0, e), function (t, e) { var r = (7 & t) << 4; if (e.buf[e.pos++] |= r | ((t >>>= 3) ? 128 : 0), !t) return; if (e.buf[e.pos++] = 127 & t | ((t >>>= 7) ? 128 : 0), !t) return; if (e.buf[e.pos++] = 127 & t | ((t >>>= 7) ? 128 : 0), !t) return; if (e.buf[e.pos++] = 127 & t | ((t >>>= 7) ? 128 : 0), !t) return; if (e.buf[e.pos++] = 127 & t | ((t >>>= 7) ? 128 : 0), !t) return; e.buf[e.pos++] = 127 & t; }(n, e); }(t, this) : (this.realloc(4), this.buf[this.pos++] = 127 & t | (t > 127 ? 128 : 0), t <= 127 || (this.buf[this.pos++] = 127 & (t >>>= 7) | (t > 127 ? 128 : 0), t <= 127 || (this.buf[this.pos++] = 127 & (t >>>= 7) | (t > 127 ? 128 : 0), t <= 127 || (this.buf[this.pos++] = t >>> 7 & 127)))); }, writeSVarint: function (t) { this.writeVarint(t < 0 ? 2 * -t - 1 : 2 * t); }, writeBoolean: function (t) { this.writeVarint(Boolean(t)); }, writeString: function (t) { t = String(t), this.realloc(4 * t.length), this.pos++; var e = this.pos; this.pos = function (t, e, r) { for (var n, i, a = 0; a < e.length; a++) { if ((n = e.charCodeAt(a)) > 55295 && n < 57344) { if (!i) { n > 56319 || a + 1 === e.length ? (t[r++] = 239, t[r++] = 191, t[r++] = 189) : i = n; continue } if (n < 56320) { t[r++] = 239, t[r++] = 191, t[r++] = 189, i = n; continue } n = i - 55296 << 10 | n - 56320 | 65536, i = null; } else i && (t[r++] = 239, t[r++] = 191, t[r++] = 189, i = null); n < 128 ? t[r++] = n : (n < 2048 ? t[r++] = n >> 6 | 192 : (n < 65536 ? t[r++] = n >> 12 | 224 : (t[r++] = n >> 18 | 240, t[r++] = n >> 12 & 63 | 128), t[r++] = n >> 6 & 63 | 128), t[r++] = 63 & n | 128); } return r }(this.buf, t, this.pos); var r = this.pos - e; r >= 128 && Ls(e, r, this), this.pos = e - 1, this.writeVarint(r), this.pos += r; }, writeFloat: function (t) { this.realloc(4), Ts(this.buf, t, this.pos, !0, 23, 4), this.pos += 4; }, writeDouble: function (t) { this.realloc(8), Ts(this.buf, t, this.pos, !0, 52, 8), this.pos += 8; }, writeBytes: function (t) { var e = t.length; this.writeVarint(e), this.realloc(e); for (var r = 0; r < e; r++)this.buf[this.pos++] = t[r]; }, writeRawMessage: function (t, e) { this.pos++; var r = this.pos; t(e, this); var n = this.pos - r; n >= 128 && Ls(r, n, this), this.pos = r - 1, this.writeVarint(n), this.pos += n; }, writeMessage: function (t, e, r) { this.writeTag(t, Es.Bytes), this.writeRawMessage(e, r); }, writePackedVarint: function (t, e) { e.length && this.writeMessage(t, Os, e); }, writePackedSVarint: function (t, e) { e.length && this.writeMessage(t, Ds, e); }, writePackedBoolean: function (t, e) { e.length && this.writeMessage(t, js, e); }, writePackedFloat: function (t, e) { e.length && this.writeMessage(t, Rs, e); }, writePackedDouble: function (t, e) { e.length && this.writeMessage(t, Us, e); }, writePackedFixed32: function (t, e) { e.length && this.writeMessage(t, qs, e); }, writePackedSFixed32: function (t, e) { e.length && this.writeMessage(t, Ns, e); }, writePackedFixed64: function (t, e) { e.length && this.writeMessage(t, Ks, e); }, writePackedSFixed64: function (t, e) { e.length && this.writeMessage(t, Xs, e); }, writeBytesField: function (t, e) { this.writeTag(t, Es.Bytes), this.writeBytes(e); }, writeFixed32Field: function (t, e) { this.writeTag(t, Es.Fixed32), this.writeFixed32(e); }, writeSFixed32Field: function (t, e) { this.writeTag(t, Es.Fixed32), this.writeSFixed32(e); }, writeFixed64Field: function (t, e) { this.writeTag(t, Es.Fixed64), this.writeFixed64(e); }, writeSFixed64Field: function (t, e) { this.writeTag(t, Es.Fixed64), this.writeSFixed64(e); }, writeVarintField: function (t, e) { this.writeTag(t, Es.Varint), this.writeVarint(e); }, writeSVarintField: function (t, e) { this.writeTag(t, Es.Varint), this.writeSVarint(e); }, writeStringField: function (t, e) { this.writeTag(t, Es.Bytes), this.writeString(e); }, writeFloatField: function (t, e) { this.writeTag(t, Es.Fixed32), this.writeFloat(e); }, writeDoubleField: function (t, e) { this.writeTag(t, Es.Fixed64), this.writeDouble(e); }, writeBooleanField: function (t, e) { this.writeVarintField(t, Boolean(e)); } }; var Hs = 3; function Ys(t, e, r) { 1 === t && r.readMessage($s, e); } function $s(t, e, r) { if (3 === t) { var n = r.readMessage(Ws, {}), i = n.id, a = n.bitmap, o = n.width, s = n.height, u = n.left, l = n.top, p = n.advance; e.push({ id: i, bitmap: new $a({ width: o + 2 * Hs, height: s + 2 * Hs }, a), metrics: { width: o, height: s, left: u, top: l, advance: p } }); } } function Ws(t, e, r) { 1 === t ? e.id = r.readVarint() : 2 === t ? e.bitmap = r.readBytes() : 3 === t ? e.width = r.readVarint() : 4 === t ? e.height = r.readVarint() : 5 === t ? e.left = r.readSVarint() : 6 === t ? e.top = r.readSVarint() : 7 === t && (e.advance = r.readVarint()); } var Qs = Hs; function tu(t) { for (var e = 0, r = 0, n = 0, i = t; n < i.length; n += 1) { var a = i[n]; e += a.w * a.h, r = Math.max(r, a.w); } t.sort((function (t, e) { return e.h - t.h })); for (var o = [{ x: 0, y: 0, w: Math.max(Math.ceil(Math.sqrt(e / .95)), r), h: 1 / 0 }], s = 0, u = 0, l = 0, p = t; l < p.length; l += 1)for (var c = p[l], h = o.length - 1; h >= 0; h--) { var f = o[h]; if (!(c.w > f.w || c.h > f.h)) { if (c.x = f.x, c.y = f.y, u = Math.max(u, c.y + c.h), s = Math.max(s, c.x + c.w), c.w === f.w && c.h === f.h) { var y = o.pop(); h < o.length && (o[h] = y); } else c.h === f.h ? (f.x += c.w, f.w -= c.w) : c.w === f.w ? (f.y += c.h, f.h -= c.h) : (o.push({ x: f.x + c.w, y: f.y, w: f.w - c.w, h: c.h }), f.y += c.h, f.h -= c.h); break } } return { w: s, h: u, fill: e / (s * u) || 0 } } var eu = 1, ru = function (t, e) { var r = e.pixelRatio, n = e.version, i = e.stretchX, a = e.stretchY, o = e.content; this.paddedRect = t, this.pixelRatio = r, this.stretchX = i, this.stretchY = a, this.content = o, this.version = n; }, nu = { tl: { configurable: !0 }, br: { configurable: !0 }, tlbr: { configurable: !0 }, displaySize: { configurable: !0 } }; nu.tl.get = function () { return [this.paddedRect.x + eu, this.paddedRect.y + eu] }, nu.br.get = function () { return [this.paddedRect.x + this.paddedRect.w - eu, this.paddedRect.y + this.paddedRect.h - eu] }, nu.tlbr.get = function () { return this.tl.concat(this.br) }, nu.displaySize.get = function () { return [(this.paddedRect.w - 2 * eu) / this.pixelRatio, (this.paddedRect.h - 2 * eu) / this.pixelRatio] }, Object.defineProperties(ru.prototype, nu); var iu = function (t, e) { var r = {}, n = {}; this.haveRenderCallbacks = []; var i = []; this.addImages(t, r, i), this.addImages(e, n, i); var a = tu(i), o = a.w, s = a.h, u = new Wa({ width: o || 1, height: s || 1 }); for (var l in t) { var p = t[l], c = r[l].paddedRect; Wa.copy(p.data, u, { x: 0, y: 0 }, { x: c.x + eu, y: c.y + eu }, p.data); } for (var h in e) { var f = e[h], y = n[h].paddedRect, d = y.x + eu, m = y.y + eu, v = f.data.width, g = f.data.height; Wa.copy(f.data, u, { x: 0, y: 0 }, { x: d, y: m }, f.data), Wa.copy(f.data, u, { x: 0, y: g - 1 }, { x: d, y: m - 1 }, { width: v, height: 1 }), Wa.copy(f.data, u, { x: 0, y: 0 }, { x: d, y: m + g }, { width: v, height: 1 }), Wa.copy(f.data, u, { x: v - 1, y: 0 }, { x: d - 1, y: m }, { width: 1, height: g }), Wa.copy(f.data, u, { x: 0, y: 0 }, { x: d + v, y: m }, { width: 1, height: g }); } this.image = u, this.iconPositions = r, this.patternPositions = n; }; iu.prototype.addImages = function (t, e, r) { for (var n in t) { var i = t[n], a = { x: 0, y: 0, w: i.data.width + 2 * eu, h: i.data.height + 2 * eu }; r.push(a), e[n] = new ru(a, i), i.hasRenderCallback && this.haveRenderCallbacks.push(n); } }, iu.prototype.patchUpdatedImages = function (t, e) { for (var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks), t.updatedImages) this.patchUpdatedImage(this.iconPositions[r], t.getImage(r), e), this.patchUpdatedImage(this.patternPositions[r], t.getImage(r), e); }, iu.prototype.patchUpdatedImage = function (t, e, r) { if (t && e && t.version !== e.version) { t.version = e.version; var n = t.tl, i = n[0], a = n[1]; r.update(e.data, void 0, { x: i, y: a }); } }, An("ImagePosition", ru), An("ImageAtlas", iu); var au = { horizontal: 1, vertical: 2, horizontalOnly: 3 }, ou = -17; var su = function () { this.scale = 1, this.fontStack = "", this.imageName = null; }; su.forText = function (t, e) { var r = new su; return r.scale = t || 1, r.fontStack = e, r }, su.forImage = function (t) { var e = new su; return e.imageName = t, e }; var uu = function () { this.text = "", this.sectionIndex = [], this.sections = [], this.imageSectionID = null; }; function lu(t, e, r, n, i, a, o, s, u, l, p, c, h, f, y, d) { var m, v = uu.fromFeature(t, i); c === au.vertical && v.verticalizePunctuation(); var g = Jn.processBidirectionalText, x = Jn.processStyledBidirectionalText; if (g && 1 === v.sections.length) { m = []; for (var b = 0, _ = g(v.toString(), mu(v, l, a, e, n, f, y)); b < _.length; b += 1) { var w = _[b], A = new uu; A.text = w, A.sections = v.sections; for (var S = 0; S < w.length; S++)A.sectionIndex.push(0); m.push(A); } } else if (x) { m = []; for (var k = 0, I = x(v.text, v.sectionIndex, mu(v, l, a, e, n, f, y)); k < I.length; k += 1) { var z = I[k], C = new uu; C.text = z[0], C.sectionIndex = z[1], C.sections = v.sections, m.push(C); } } else m = function (t, e) { for (var r = [], n = t.text, i = 0, a = 0, o = e; a < o.length; a += 1) { var s = o[a]; r.push(t.substring(i, s)), i = s; } return i < n.length && r.push(t.substring(i, n.length)), r }(v, mu(v, l, a, e, n, f, y)); var B = [], T = { positionedLines: B, text: v.toString(), top: p[1], bottom: p[1], left: p[0], right: p[0], writingMode: c, iconsInText: !1, verticalizable: !1 }; return function (t, e, r, n, i, a, o, s, u, l, p, c) { for (var h = 0, f = ou, y = 0, d = 0, m = "right" === s ? 1 : "left" === s ? 0 : .5, v = 0, g = 0, x = i; g < x.length; g += 1) { var b = x[g]; b.trim(); var _ = b.getMaxScale(), w = (_ - 1) * Cs, A = { positionedGlyphs: [], lineOffset: 0 }; t.positionedLines[v] = A; var S = A.positionedGlyphs, k = 0; if (b.length()) { for (var I = 0; I < b.length(); I++) { var z = b.getSection(I), C = b.getSectionIndex(I), B = b.getCharCode(I), T = 0, P = null, E = null, M = null, V = Cs, F = !(u === au.horizontal || !p && !En(B) || p && (pu[B] || (Z = B, Bn.Arabic(Z) || Bn["Arabic Supplement"](Z) || Bn["Arabic Extended-A"](Z) || Bn["Arabic Presentation Forms-A"](Z) || Bn["Arabic Presentation Forms-B"](Z)))); if (z.imageName) { var L = n[z.imageName]; if (!L) continue; M = z.imageName, t.iconsInText = t.iconsInText || !0, E = L.paddedRect; var O = L.displaySize; z.scale = z.scale * Cs / c, P = { width: O[0], height: O[1], left: eu, top: -Qs, advance: F ? O[1] : O[0] }; var D = Cs - O[1] * z.scale; T = w + D, V = P.advance; var R = F ? O[0] * z.scale - Cs * _ : O[1] * z.scale - Cs * _; R > 0 && R > k && (k = R); } else { var U = r[z.fontStack], j = U && U[B]; if (j && j.rect) E = j.rect, P = j.metrics; else { var q = e[z.fontStack], N = q && q[B]; if (!N) continue; P = N.metrics; } T = (_ - z.scale) * Cs; } F ? (t.verticalizable = !0, S.push({ glyph: B, imageName: M, x: h, y: f + T, vertical: F, scale: z.scale, fontStack: z.fontStack, sectionIndex: C, metrics: P, rect: E }), h += V * z.scale + l) : (S.push({ glyph: B, imageName: M, x: h, y: f + T, vertical: F, scale: z.scale, fontStack: z.fontStack, sectionIndex: C, metrics: P, rect: E }), h += P.advance * z.scale + l); } if (0 !== S.length) { var K = h - l; y = Math.max(K, y), gu(S, 0, S.length - 1, m, k); } h = 0; var X = a * _ + k; A.lineOffset = Math.max(k, w), f += X, d = Math.max(X, d), ++v; } else f += a, ++v; } var Z; var G = f - ou, J = vu(o), H = J.horizontalAlign, Y = J.verticalAlign; (function (t, e, r, n, i, a, o, s, u) { var l = (e - r) * i, p = 0; p = a !== o ? -s * n - ou : (-n * u + .5) * o; for (var c = 0, h = t; c < h.length; c += 1)for (var f = h[c], y = 0, d = f.positionedGlyphs; y < d.length; y += 1) { var m = d[y]; m.x += l, m.y += p; } })(t.positionedLines, m, H, Y, y, d, a, G, i.length), t.top += -Y * G, t.bottom = t.top + G, t.left += -H * y, t.right = t.left + y; }(T, e, r, n, m, o, s, u, c, l, h, d), !function (t) { for (var e = 0, r = t; e < r.length; e += 1) { if (0 !== r[e].positionedGlyphs.length) return !1 } return !0 }(B) && T } uu.fromFeature = function (t, e) { for (var r = new uu, n = 0; n < t.sections.length; n++) { var i = t.sections[n]; i.image ? r.addImageSection(i) : r.addTextSection(i, e); } return r }, uu.prototype.length = function () { return this.text.length }, uu.prototype.getSection = function (t) { return this.sections[this.sectionIndex[t]] }, uu.prototype.getSectionIndex = function (t) { return this.sectionIndex[t] }, uu.prototype.getCharCode = function (t) { return this.text.charCodeAt(t) }, uu.prototype.verticalizePunctuation = function () { this.text = function (t) { for (var e = "", r = 0; r < t.length; r++) { var n = t.charCodeAt(r + 1) || null, i = t.charCodeAt(r - 1) || null; (!n || !Mn(n) || zs[t[r + 1]]) && (!i || !Mn(i) || zs[t[r - 1]]) && zs[t[r]] ? e += zs[t[r]] : e += t[r]; } return e }(this.text); }, uu.prototype.trim = function () { for (var t = 0, e = 0; e < this.text.length && pu[this.text.charCodeAt(e)]; e++)t++; for (var r = this.text.length, n = this.text.length - 1; n >= 0 && n >= t && pu[this.text.charCodeAt(n)]; n--)r--; this.text = this.text.substring(t, r), this.sectionIndex = this.sectionIndex.slice(t, r); }, uu.prototype.substring = function (t, e) { var r = new uu; return r.text = this.text.substring(t, e), r.sectionIndex = this.sectionIndex.slice(t, e), r.sections = this.sections, r }, uu.prototype.toString = function () { return this.text }, uu.prototype.getMaxScale = function () { var t = this; return this.sectionIndex.reduce((function (e, r) { return Math.max(e, t.sections[r].scale) }), 0) }, uu.prototype.addTextSection = function (t, e) { this.text += t.text, this.sections.push(su.forText(t.scale, t.fontStack || e)); for (var r = this.sections.length - 1, n = 0; n < t.text.length; ++n)this.sectionIndex.push(r); }, uu.prototype.addImageSection = function (t) { var e = t.image ? t.image.name : ""; if (0 !== e.length) { var r = this.getNextImageSectionCharCode(); r ? (this.text += String.fromCharCode(r), this.sections.push(su.forImage(e)), this.sectionIndex.push(this.sections.length - 1)) : w("Reached maximum number of images 6401"); } else w("Can't add FormattedSection with an empty image."); }, uu.prototype.getNextImageSectionCharCode = function () { return this.imageSectionID ? this.imageSectionID >= 63743 ? null : ++this.imageSectionID : (this.imageSectionID = 57344, this.imageSectionID) }; var pu = { 9: !0, 10: !0, 11: !0, 12: !0, 13: !0, 32: !0 }, cu = {}; function hu(t, e, r, n, i, a) { if (e.imageName) { var o = n[e.imageName]; return o ? o.displaySize[0] * e.scale * Cs / a + i : 0 } var s = r[e.fontStack], u = s && s[t]; return u ? u.metrics.advance * e.scale + i : 0 } function fu(t, e, r, n) { var i = Math.pow(t - e, 2); return n ? t < e ? i / 2 : 2 * i : i + Math.abs(r) * r } function yu(t, e, r) { var n = 0; return 10 === t && (n -= 1e4), r && (n += 150), 40 !== t && 65288 !== t || (n += 50), 41 !== e && 65289 !== e || (n += 50), n } function du(t, e, r, n, i, a) { for (var o = null, s = fu(e, r, i, a), u = 0, l = n; u < l.length; u += 1) { var p = l[u], c = fu(e - p.x, r, i, a) + p.badness; c <= s && (o = p, s = c); } return { index: t, x: e, priorBreak: o, badness: s } } function mu(t, e, r, n, i, a, o) { if ("point" !== a) return []; if (!t) return []; for (var s, u = [], l = function (t, e, r, n, i, a) { for (var o = 0, s = 0; s < t.length(); s++) { var u = t.getSection(s); o += hu(t.getCharCode(s), u, n, i, e, a); } return o / Math.max(1, Math.ceil(o / r)) }(t, e, r, n, i, o), p = t.text.indexOf("​") >= 0, c = 0, h = 0; h < t.length(); h++) { var f = t.getSection(h), y = t.getCharCode(h); if (pu[y] || (c += hu(y, f, n, i, e, o)), h < t.length() - 1) { var d = !!(!((s = y) < 11904) && (Bn["Bopomofo Extended"](s) || Bn.Bopomofo(s) || Bn["CJK Compatibility Forms"](s) || Bn["CJK Compatibility Ideographs"](s) || Bn["CJK Compatibility"](s) || Bn["CJK Radicals Supplement"](s) || Bn["CJK Strokes"](s) || Bn["CJK Symbols and Punctuation"](s) || Bn["CJK Unified Ideographs Extension A"](s) || Bn["CJK Unified Ideographs"](s) || Bn["Enclosed CJK Letters and Months"](s) || Bn["Halfwidth and Fullwidth Forms"](s) || Bn.Hiragana(s) || Bn["Ideographic Description Characters"](s) || Bn["Kangxi Radicals"](s) || Bn["Katakana Phonetic Extensions"](s) || Bn.Katakana(s) || Bn["Vertical Forms"](s) || Bn["Yi Radicals"](s) || Bn["Yi Syllables"](s))); (cu[y] || d || f.imageName) && u.push(du(h + 1, c, l, u, yu(y, t.getCharCode(h + 1), d && p), !1)); } } return function t(e) { return e ? t(e.priorBreak).concat(e.index) : [] }(du(t.length(), c, l, u, 0, !0)) } function vu(t) { var e = .5, r = .5; switch (t) { case "right": case "top-right": case "bottom-right": e = 1; break; case "left": case "top-left": case "bottom-left": e = 0; }switch (t) { case "bottom": case "bottom-right": case "bottom-left": r = 1; break; case "top": case "top-right": case "top-left": r = 0; }return { horizontalAlign: e, verticalAlign: r } } function gu(t, e, r, n, i) { if (n || i) for (var a = t[r], o = a.metrics.advance * a.scale, s = (t[r].x + o) * n, u = e; u <= r; u++)t[u].x -= s, t[u].y += i; } function xu(t, e, r, n, i, a) { var o, s = t.image; if (s.content) { var u = s.content, l = s.pixelRatio || 1; o = [u[0] / l, u[1] / l, s.displaySize[0] - u[2] / l, s.displaySize[1] - u[3] / l]; } var p, c, h, f, y = e.left * a, d = e.right * a; "width" === r || "both" === r ? (f = i[0] + y - n[3], c = i[0] + d + n[1]) : c = (f = i[0] + (y + d - s.displaySize[0]) / 2) + s.displaySize[0]; var m = e.top * a, v = e.bottom * a; return "height" === r || "both" === r ? (p = i[1] + m - n[0], h = i[1] + v + n[2]) : h = (p = i[1] + (m + v - s.displaySize[1]) / 2) + s.displaySize[1], { image: s, top: p, right: c, bottom: h, left: f, collisionPadding: o } } cu[10] = !0, cu[32] = !0, cu[38] = !0, cu[40] = !0, cu[41] = !0, cu[43] = !0, cu[45] = !0, cu[47] = !0, cu[173] = !0, cu[183] = !0, cu[8203] = !0, cu[8208] = !0, cu[8211] = !0, cu[8231] = !0; var bu = function (t) { function e(e, r, n, i) { t.call(this, e, r), this.angle = n, void 0 !== i && (this.segment = i); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.clone = function () { return new e(this.x, this.y, this.angle, this.segment) }, e }(i); An("Anchor", bu); var _u = 128; function wu(t, e) { var r = e.expression; if ("constant" === r.kind) return { kind: "constant", layoutSize: r.evaluate(new Hn(t + 1)) }; if ("source" === r.kind) return { kind: "source" }; for (var n = r.zoomStops, i = r.interpolationType, a = 0; a < n.length && n[a] <= t;)a++; for (var o = a = Math.max(0, a - 1); o < n.length && n[o] < t + 1;)o++; o = Math.min(n.length - 1, o); var s = n[a], u = n[o]; return "composite" === r.kind ? { kind: "composite", minZoom: s, maxZoom: u, interpolationType: i } : { kind: "camera", minZoom: s, maxZoom: u, minSize: r.evaluate(new Hn(s)), maxSize: r.evaluate(new Hn(u)), interpolationType: i } } function Au(t, e, r) { var n = e.uSize, i = e.uSizeT, a = r.lowerSize, o = r.upperSize; return "source" === t.kind ? a / _u : "composite" === t.kind ? Ie(a / _u, o / _u, i) : n } function Su(t, e) { var r = 0, n = 0; if ("constant" === t.kind) n = t.layoutSize; else if ("source" !== t.kind) { var i = t.interpolationType, a = t.minZoom, o = t.maxZoom, s = i ? l(Ge.interpolationFactor(i, e, a, o), 0, 1) : 0; "camera" === t.kind ? n = Ie(t.minSize, t.maxSize, s) : r = s; } return { uSizeT: r, uSize: n } } var ku = Object.freeze({ __proto__: null, getSizeData: wu, evaluateSizeForFeature: Au, evaluateSizeForZoom: Su, SIZE_PACK_FACTOR: _u }); function Iu(t, e, r, n, i) { if (void 0 === e.segment) return !0; for (var a = e, o = e.segment + 1, s = 0; s > -r / 2;) { if (--o < 0) return !1; s -= t[o].dist(a), a = t[o]; } s += t[o].dist(t[o + 1]), o++; for (var u = [], l = 0; s < r / 2;) { var p = t[o - 1], c = t[o], h = t[o + 1]; if (!h) return !1; var f = p.angleTo(c) - c.angleTo(h); for (f = Math.abs((f + 3 * Math.PI) % (2 * Math.PI) - Math.PI), u.push({ distance: s, angleDelta: f }), l += f; s - u[0].distance > n;)l -= u.shift().angleDelta; if (l > i) return !1; o++ , s += c.dist(h); } return !0 } function zu(t) { for (var e = 0, r = 0; r < t.length - 1; r++)e += t[r].dist(t[r + 1]); return e } function Cu(t, e, r) { return t ? .6 * e * r : 0 } function Bu(t, e) { return Math.max(t ? t.right - t.left : 0, e ? e.right - e.left : 0) } function Tu(t, e, r, n, i, a) { for (var o = Cu(r, i, a), s = Bu(r, n) * a, u = 0, l = zu(t) / 2, p = 0; p < t.length - 1; p++) { var c = t[p], h = t[p + 1], f = c.dist(h); if (u + f > l) { var y = (l - u) / f, d = Ie(c.x, h.x, y), m = Ie(c.y, h.y, y), v = new bu(d, m, h.angleTo(c), p); return v._round(), !o || Iu(t, v, s, o, e) ? v : void 0 } u += f; } } function Pu(t, e, r, n, i, a, o, s, u) { var l = Cu(n, a, o), p = Bu(n, i), c = p * o, h = 0 === t[0].x || t[0].x === u || 0 === t[0].y || t[0].y === u; return e - c < e / 4 && (e = c + e / 4), function t(e, r, n, i, a, o, s, u, l) { var p = o / 2; var c = zu(e); var h = 0, f = r - n; var y = []; for (var d = 0; d < e.length - 1; d++) { for (var m = e[d], v = e[d + 1], g = m.dist(v), x = v.angleTo(m); f + n < h + g;) { var b = ((f += n) - h) / g, _ = Ie(m.x, v.x, b), w = Ie(m.y, v.y, b); if (_ >= 0 && _ < l && w >= 0 && w < l && f - p >= 0 && f + p <= c) { var A = new bu(_, w, x, d); A._round(), i && !Iu(e, A, o, i, a) || y.push(A); } } h += g; } u || y.length || s || (y = t(e, h / 2, n, i, a, o, s, !0, l)); return y }(t, h ? e / 2 * s % e : (p / 2 + 2 * a) * o * s % e, e, l, r, c, h, !1, u) } var Eu = eu; function Mu(t, e, r, n) { var a = [], o = t.image, s = o.pixelRatio, u = o.paddedRect.w - 2 * Eu, l = o.paddedRect.h - 2 * Eu, p = t.right - t.left, c = t.bottom - t.top, h = o.stretchX || [[0, u]], f = o.stretchY || [[0, l]], y = function (t, e) { return t + e[1] - e[0] }, d = h.reduce(y, 0), m = f.reduce(y, 0), v = u - d, g = l - m, x = 0, b = d, _ = 0, w = m, A = 0, S = v, k = 0, I = g; if (o.content && n) { var z = o.content; x = Vu(h, 0, z[0]), _ = Vu(f, 0, z[1]), b = Vu(h, z[0], z[2]), w = Vu(f, z[1], z[3]), A = z[0] - x, k = z[1] - _, S = z[2] - z[0] - b, I = z[3] - z[1] - w; } var C = function (n, a, u, l) { var h = Lu(n.stretch - x, b, p, t.left), f = Ou(n.fixed - A, S, n.stretch, d), y = Lu(a.stretch - _, w, c, t.top), v = Ou(a.fixed - k, I, a.stretch, m), g = Lu(u.stretch - x, b, p, t.left), z = Ou(u.fixed - A, S, u.stretch, d), C = Lu(l.stretch - _, w, c, t.top), B = Ou(l.fixed - k, I, l.stretch, m), T = new i(h, y), P = new i(g, y), E = new i(g, C), M = new i(h, C), V = new i(f / s, v / s), F = new i(z / s, B / s), L = e * Math.PI / 180; if (L) { var O = Math.sin(L), D = Math.cos(L), R = [D, -O, O, D]; T._matMult(R), P._matMult(R), M._matMult(R), E._matMult(R); } var U = n.stretch + n.fixed, j = u.stretch + u.fixed, q = a.stretch + a.fixed, N = l.stretch + l.fixed; return { tl: T, tr: P, bl: M, br: E, tex: { x: o.paddedRect.x + Eu + U, y: o.paddedRect.y + Eu + q, w: j - U, h: N - q }, writingMode: void 0, glyphOffset: [0, 0], sectionIndex: 0, pixelOffsetTL: V, pixelOffsetBR: F, minFontScaleX: S / s / p, minFontScaleY: I / s / c, isSDF: r } }; if (n && (o.stretchX || o.stretchY)) for (var B = Fu(h, v, d), T = Fu(f, g, m), P = 0; P < B.length - 1; P++)for (var E = B[P], M = B[P + 1], V = 0; V < T.length - 1; V++) { var F = T[V], L = T[V + 1]; a.push(C(E, F, M, L)); } else a.push(C({ fixed: 0, stretch: -1 }, { fixed: 0, stretch: -1 }, { fixed: 0, stretch: u + 1 }, { fixed: 0, stretch: l + 1 })); return a } function Vu(t, e, r) { for (var n = 0, i = 0, a = t; i < a.length; i += 1) { var o = a[i]; n += Math.max(e, Math.min(r, o[1])) - Math.max(e, Math.min(r, o[0])); } return n } function Fu(t, e, r) { for (var n = [{ fixed: -Eu, stretch: 0 }], i = 0, a = t; i < a.length; i += 1) { var o = a[i], s = o[0], u = o[1], l = n[n.length - 1]; n.push({ fixed: s - l.stretch, stretch: l.stretch }), n.push({ fixed: s - l.stretch, stretch: l.stretch + (u - s) }); } return n.push({ fixed: e + Eu, stretch: r }), n } function Lu(t, e, r, n) { return t / e * r + n } function Ou(t, e, r, n) { return t - e * r / n } var Du = function (t, e, r, n, a, o, s, u, l, p, c, h) { var f = s.top * u - l, y = s.bottom * u + l, d = s.left * u - l, m = s.right * u + l, v = s.collisionPadding; if (v && (d -= v[0] * u, f -= v[1] * u, m += v[2] * u, y += v[3] * u), this.boxStartIndex = t.length, p) { var g = y - f, x = m - d; g > 0 && (g = Math.max(10 * u, g), this._addLineCollisionCircles(t, e, r, r.segment, x, g, n, a, o, c)); } else { if (h) { var b = new i(d, f), _ = new i(m, f), w = new i(d, y), A = new i(m, y), S = h * Math.PI / 180; b._rotate(S), _._rotate(S), w._rotate(S), A._rotate(S), d = Math.min(b.x, _.x, w.x, A.x), m = Math.max(b.x, _.x, w.x, A.x), f = Math.min(b.y, _.y, w.y, A.y), y = Math.max(b.y, _.y, w.y, A.y); } t.emplaceBack(r.x, r.y, d, f, m, y, n, a, o, 0, 0); } this.boxEndIndex = t.length; }; Du.prototype._addLineCollisionCircles = function (t, e, r, n, i, a, o, s, u, l) { var p = a / 2, c = Math.floor(i / p) || 1, h = 1 + .4 * Math.log(l) / Math.LN2, f = Math.floor(c * h / 2), y = -a / 2, d = r, m = n + 1, v = y, g = -i / 2, x = g - i / 4; do { if (--m < 0) { if (v > g) return; m = 0; break } v -= e[m].dist(d), d = e[m]; } while (v > x); for (var b = e[m].dist(e[m + 1]), _ = -f; _ < c + f; _++) { var w = _ * p, A = g + w; if (w < 0 && (A += w), w > i && (A += w - i), !(A < v)) { for (; v + b < A;) { if (v += b, ++m + 1 >= e.length) return; b = e[m].dist(e[m + 1]); } var S = A - v, k = e[m], I = e[m + 1].sub(k)._unit()._mult(S)._add(k)._round(), z = Math.abs(A - y) < p ? 0 : .8 * (A - y); t.emplaceBack(I.x, I.y, -a / 2, -a / 2, a / 2, a / 2, o, s, u, a / 2, z); } } }; var Ru = function (t, e) { if (void 0 === t && (t = []), void 0 === e && (e = Uu), this.data = t, this.length = this.data.length, this.compare = e, this.length > 0) for (var r = (this.length >> 1) - 1; r >= 0; r--)this._down(r); }; function Uu(t, e) { return t < e ? -1 : t > e ? 1 : 0 } function ju(t, e, r) { void 0 === e && (e = 1), void 0 === r && (r = !1); for (var n = 1 / 0, a = 1 / 0, o = -1 / 0, s = -1 / 0, u = t[0], l = 0; l < u.length; l++) { var p = u[l]; (!l || p.x < n) && (n = p.x), (!l || p.y < a) && (a = p.y), (!l || p.x > o) && (o = p.x), (!l || p.y > s) && (s = p.y); } var c = o - n, h = s - a, f = Math.min(c, h), y = f / 2, d = new Ru([], qu); if (0 === f) return new i(n, a); for (var m = n; m < o; m += f)for (var v = a; v < s; v += f)d.push(new Nu(m + y, v + y, y, t)); for (var g = function (t) { for (var e = 0, r = 0, n = 0, i = t[0], a = 0, o = i.length, s = o - 1; a < o; s = a++) { var u = i[a], l = i[s], p = u.x * l.y - l.x * u.y; r += (u.x + l.x) * p, n += (u.y + l.y) * p, e += 3 * p; } return new Nu(r / e, n / e, 0, t) }(t), x = d.length; d.length;) { var b = d.pop(); (b.d > g.d || !g.d) && (g = b, r && console.log("found best %d after %d probes", Math.round(1e4 * b.d) / 1e4, x)), b.max - g.d <= e || (y = b.h / 2, d.push(new Nu(b.p.x - y, b.p.y - y, y, t)), d.push(new Nu(b.p.x + y, b.p.y - y, y, t)), d.push(new Nu(b.p.x - y, b.p.y + y, y, t)), d.push(new Nu(b.p.x + y, b.p.y + y, y, t)), x += 4); } return r && (console.log("num probes: " + x), console.log("best distance: " + g.d)), g.p } function qu(t, e) { return e.max - t.max } function Nu(t, e, r, n) { this.p = new i(t, e), this.h = r, this.d = function (t, e) { for (var r = !1, n = 1 / 0, i = 0; i < e.length; i++)for (var a = e[i], o = 0, s = a.length, u = s - 1; o < s; u = o++) { var l = a[o], p = a[u]; l.y > t.y != p.y > t.y && t.x < (p.x - l.x) * (t.y - l.y) / (p.y - l.y) + l.x && (r = !r), n = Math.min(n, Ea(t, l, p)); } return (r ? 1 : -1) * Math.sqrt(n) }(this.p, n), this.max = this.d + this.h * Math.SQRT2; } Ru.prototype.push = function (t) { this.data.push(t), this.length++ , this._up(this.length - 1); }, Ru.prototype.pop = function () { if (0 !== this.length) { var t = this.data[0], e = this.data.pop(); return this.length-- , this.length > 0 && (this.data[0] = e, this._down(0)), t } }, Ru.prototype.peek = function () { return this.data[0] }, Ru.prototype._up = function (t) { for (var e = this.data, r = this.compare, n = e[t]; t > 0;) { var i = t - 1 >> 1, a = e[i]; if (r(n, a) >= 0) break; e[t] = a, t = i; } e[t] = n; }, Ru.prototype._down = function (t) { for (var e = this.data, r = this.compare, n = this.length >> 1, i = e[t]; t < n;) { var a = 1 + (t << 1), o = e[a], s = a + 1; if (s < this.length && r(e[s], o) < 0 && (a = s, o = e[s]), r(o, i) >= 0) break; e[t] = o, t = a; } e[t] = i; }; var Ku = e((function (t) { t.exports = function (t, e) { var r, n, i, a, o, s, u, l; for (r = 3 & t.length, n = t.length - r, i = e, o = 3432918353, s = 461845907, l = 0; l < n;)u = 255 & t.charCodeAt(l) | (255 & t.charCodeAt(++l)) << 8 | (255 & t.charCodeAt(++l)) << 16 | (255 & t.charCodeAt(++l)) << 24, ++l, i = 27492 + (65535 & (a = 5 * (65535 & (i = (i ^= u = (65535 & (u = (u = (65535 & u) * o + (((u >>> 16) * o & 65535) << 16) & 4294967295) << 15 | u >>> 17)) * s + (((u >>> 16) * s & 65535) << 16) & 4294967295) << 13 | i >>> 19)) + ((5 * (i >>> 16) & 65535) << 16) & 4294967295)) + ((58964 + (a >>> 16) & 65535) << 16); switch (u = 0, r) { case 3: u ^= (255 & t.charCodeAt(l + 2)) << 16; case 2: u ^= (255 & t.charCodeAt(l + 1)) << 8; case 1: i ^= u = (65535 & (u = (u = (65535 & (u ^= 255 & t.charCodeAt(l))) * o + (((u >>> 16) * o & 65535) << 16) & 4294967295) << 15 | u >>> 17)) * s + (((u >>> 16) * s & 65535) << 16) & 4294967295; }return i ^= t.length, i = 2246822507 * (65535 & (i ^= i >>> 16)) + ((2246822507 * (i >>> 16) & 65535) << 16) & 4294967295, i = 3266489909 * (65535 & (i ^= i >>> 13)) + ((3266489909 * (i >>> 16) & 65535) << 16) & 4294967295, (i ^= i >>> 16) >>> 0 }; })), Xu = e((function (t) { t.exports = function (t, e) { for (var r, n = t.length, i = e ^ n, a = 0; n >= 4;)r = 1540483477 * (65535 & (r = 255 & t.charCodeAt(a) | (255 & t.charCodeAt(++a)) << 8 | (255 & t.charCodeAt(++a)) << 16 | (255 & t.charCodeAt(++a)) << 24)) + ((1540483477 * (r >>> 16) & 65535) << 16), i = 1540483477 * (65535 & i) + ((1540483477 * (i >>> 16) & 65535) << 16) ^ (r = 1540483477 * (65535 & (r ^= r >>> 24)) + ((1540483477 * (r >>> 16) & 65535) << 16)), n -= 4, ++a; switch (n) { case 3: i ^= (255 & t.charCodeAt(a + 2)) << 16; case 2: i ^= (255 & t.charCodeAt(a + 1)) << 8; case 1: i = 1540483477 * (65535 & (i ^= 255 & t.charCodeAt(a))) + ((1540483477 * (i >>> 16) & 65535) << 16); }return i = 1540483477 * (65535 & (i ^= i >>> 13)) + ((1540483477 * (i >>> 16) & 65535) << 16), (i ^= i >>> 15) >>> 0 }; })), Zu = Ku, Gu = Ku, Ju = Xu; Zu.murmur3 = Gu, Zu.murmur2 = Ju; var Hu = 7, Yu = Number.POSITIVE_INFINITY; function $u(t, e) { return e[1] !== Yu ? function (t, e, r) { var n = 0, i = 0; switch (e = Math.abs(e), r = Math.abs(r), t) { case "top-right": case "top-left": case "top": i = r - Hu; break; case "bottom-right": case "bottom-left": case "bottom": i = -r + Hu; }switch (t) { case "top-right": case "bottom-right": case "right": n = -e; break; case "top-left": case "bottom-left": case "left": n = e; }return [n, i] }(t, e[0], e[1]) : function (t, e) { var r = 0, n = 0; e < 0 && (e = 0); var i = e / Math.sqrt(2); switch (t) { case "top-right": case "top-left": n = i - Hu; break; case "bottom-right": case "bottom-left": n = -i + Hu; break; case "bottom": n = -e + Hu; break; case "top": n = e - Hu; }switch (t) { case "top-right": case "bottom-right": r = -i; break; case "top-left": case "bottom-left": r = i; break; case "left": r = e; break; case "right": r = -e; }return [r, n] }(t, e[0]) } function Wu(t) { switch (t) { case "right": case "top-right": case "bottom-right": return "right"; case "left": case "top-left": case "bottom-left": return "left" }return "center" } var Qu = 255, tl = Qu * _u; function el(t, e, r, n, a, o, s, u, l, p, c, h, f, y) { var d = function (t, e, r, n, a, o, s, u) { for (var l = n.layout.get("text-rotate").evaluate(o, {}) * Math.PI / 180, p = [], c = 0, h = e.positionedLines; c < h.length; c += 1)for (var f = h[c], y = 0, d = f.positionedGlyphs; y < d.length; y += 1) { var m = d[y]; if (m.rect) { var v = m.rect || {}, g = Qs + 1, x = !0, b = 1, _ = 0, w = (a || u) && m.vertical, A = m.metrics.advance * m.scale / 2; if (u && e.verticalizable) { var S = (m.scale - 1) * Cs, k = (Cs - m.metrics.width * m.scale) / 2; _ = f.lineOffset / 2 - (m.imageName ? -k : S); } if (m.imageName) { var I = s[m.imageName]; x = I.sdf, b = I.pixelRatio, g = eu / b; } var z = a ? [m.x + A, m.y] : [0, 0], C = a ? [0, 0] : [m.x + A + r[0], m.y + r[1] - _], B = [0, 0]; w && (B = C, C = [0, 0]); var T = (m.metrics.left - g) * m.scale - A + C[0], P = (-m.metrics.top - g) * m.scale + C[1], E = T + v.w * m.scale / b, M = P + v.h * m.scale / b, V = new i(T, P), F = new i(E, P), L = new i(T, M), O = new i(E, M); if (w) { var D = new i(-A, A - ou), R = -Math.PI / 2, U = Cs / 2 - A, j = m.imageName ? U : 0, q = new i(5 - ou - U, -j), N = new (Function.prototype.bind.apply(i, [null].concat(B))); V._rotateAround(R, D)._add(q)._add(N), F._rotateAround(R, D)._add(q)._add(N), L._rotateAround(R, D)._add(q)._add(N), O._rotateAround(R, D)._add(q)._add(N); } if (l) { var K = Math.sin(l), X = Math.cos(l), Z = [X, -K, K, X]; V._matMult(Z), F._matMult(Z), L._matMult(Z), O._matMult(Z); } var G = new i(0, 0), J = new i(0, 0); p.push({ tl: V, tr: F, bl: L, br: O, tex: v, writingMode: e.writingMode, glyphOffset: z, sectionIndex: m.sectionIndex, isSDF: x, pixelOffsetTL: G, pixelOffsetBR: J, minFontScaleX: 0, minFontScaleY: 0 }); } } return p }(0, r, u, a, o, s, n, t.allowVerticalPlacement), m = t.textSizeData, v = null; "source" === m.kind ? (v = [_u * a.layout.get("text-size").evaluate(s, {})])[0] > tl && w(t.layerIds[0] + ': Value for "text-size" is >= ' + Qu + '. Reduce your "text-size".') : "composite" === m.kind && ((v = [_u * y.compositeTextSizes[0].evaluate(s, {}), _u * y.compositeTextSizes[1].evaluate(s, {})])[0] > tl || v[1] > tl) && w(t.layerIds[0] + ': Value for "text-size" is >= ' + Qu + '. Reduce your "text-size".'), t.addSymbols(t.text, d, v, u, o, s, p, e, l.lineStartIndex, l.lineLength, f); for (var g = 0, x = c; g < x.length; g += 1) { h[x[g]] = t.text.placedSymbolArray.length - 1; } return 4 * d.length } function rl(t) { for (var e in t) return t[e]; return null } function nl(t, e, r, n) { var i = t.compareText; if (e in i) { for (var a = i[e], o = a.length - 1; o >= 0; o--)if (n.dist(a[o]) < r) return !0 } else i[e] = []; return i[e].push(n), !1 } var il = ts.VectorTileFeature.types, al = [{ name: "a_fade_opacity", components: 1, type: "Uint8", offset: 0 }]; function ol(t, e, r, n, i, a, o, s, u, l, p, c, h) { var f = s ? Math.min(tl, Math.round(s[0])) : 0, y = s ? Math.min(tl, Math.round(s[1])) : 0; t.emplaceBack(e, r, Math.round(32 * n), Math.round(32 * i), a, o, (f << 1) + (u ? 1 : 0), y, 16 * l, 16 * p, 256 * c, 256 * h); } function sl(t, e, r) { t.emplaceBack(e.x, e.y, r), t.emplaceBack(e.x, e.y, r), t.emplaceBack(e.x, e.y, r), t.emplaceBack(e.x, e.y, r); } function ul(t) { for (var e = 0, r = t.sections; e < r.length; e += 1) { if (Ln(r[e].text)) return !0 } return !1 } var ll = function (t) { this.layoutVertexArray = new _i, this.indexArray = new Ei, this.programConfigurations = t, this.segments = new Yi, this.dynamicLayoutVertexArray = new wi, this.opacityVertexArray = new Ai, this.placedSymbolArray = new Ui; }; ll.prototype.upload = function (t, e, r, n) { r && (this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, _s.members), this.indexBuffer = t.createIndexBuffer(this.indexArray, e), this.dynamicLayoutVertexBuffer = t.createVertexBuffer(this.dynamicLayoutVertexArray, ws.members, !0), this.opacityVertexBuffer = t.createVertexBuffer(this.opacityVertexArray, al, !0), this.opacityVertexBuffer.itemSize = 1), (r || n) && this.programConfigurations.upload(t); }, ll.prototype.destroy = function () { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.programConfigurations.destroy(), this.segments.destroy(), this.dynamicLayoutVertexBuffer.destroy(), this.opacityVertexBuffer.destroy()); }, An("SymbolBuffers", ll); var pl = function (t, e, r) { this.layoutVertexArray = new t, this.layoutAttributes = e, this.indexArray = new r, this.segments = new Yi, this.collisionVertexArray = new Ii; }; pl.prototype.upload = function (t) { this.layoutVertexBuffer = t.createVertexBuffer(this.layoutVertexArray, this.layoutAttributes), this.indexBuffer = t.createIndexBuffer(this.indexArray), this.collisionVertexBuffer = t.createVertexBuffer(this.collisionVertexArray, As.members, !0); }, pl.prototype.destroy = function () { this.layoutVertexBuffer && (this.layoutVertexBuffer.destroy(), this.indexBuffer.destroy(), this.segments.destroy(), this.collisionVertexBuffer.destroy()); }, An("CollisionBuffers", pl); var cl = function (t) { this.collisionBoxArray = t.collisionBoxArray, this.zoom = t.zoom, this.overscaling = t.overscaling, this.layers = t.layers, this.layerIds = this.layers.map((function (t) { return t.id })), this.index = t.index, this.pixelRatio = t.pixelRatio, this.sourceLayerIndex = t.sourceLayerIndex, this.hasPattern = !1, this.hasPaintOverrides = !1, this.hasRTLText = !1; var e = this.layers[0]._unevaluatedLayout._values; this.textSizeData = wu(this.zoom, e["text-size"]), this.iconSizeData = wu(this.zoom, e["icon-size"]); var r = this.layers[0].layout, n = r.get("symbol-sort-key"), i = r.get("symbol-z-order"); this.sortFeaturesByKey = "viewport-y" !== i && void 0 !== n.constantOr(1); var a = "viewport-y" === i || "auto" === i && !this.sortFeaturesByKey; this.sortFeaturesByY = a && (r.get("text-allow-overlap") || r.get("icon-allow-overlap") || r.get("text-ignore-placement") || r.get("icon-ignore-placement")), "point" === r.get("symbol-placement") && (this.writingModes = r.get("text-writing-mode").map((function (t) { return au[t] }))), this.stateDependentLayerIds = this.layers.filter((function (t) { return t.isStateDependent() })).map((function (t) { return t.id })), this.sourceID = t.sourceID; }; cl.prototype.createArrays = function () { var t = this.layers[0].layout; this.hasPaintOverrides = dl.hasPaintOverrides(t), this.text = new ll(new ma(_s.members, this.layers, this.zoom, (function (t) { return /^text/.test(t) }))), this.icon = new ll(new ma(_s.members, this.layers, this.zoom, (function (t) { return /^icon/.test(t) }))), this.textCollisionBox = new pl(ki, Ss.members, Mi), this.iconCollisionBox = new pl(ki, Ss.members, Mi), this.textCollisionCircle = new pl(ki, ks.members, Ei), this.iconCollisionCircle = new pl(ki, ks.members, Ei), this.glyphOffsetArray = new Ki, this.lineVertexArray = new Zi, this.symbolInstances = new qi; }, cl.prototype.calculateGlyphDependencies = function (t, e, r, n, i) { for (var a = 0; a < t.length; a++)if (e[t.charCodeAt(a)] = !0, (r || n) && i) { var o = zs[t.charAt(a)]; o && (e[o.charCodeAt(0)] = !0); } }, cl.prototype.populate = function (t, e) { var r = this.layers[0], n = r.layout, i = n.get("text-font"), a = n.get("text-field"), o = n.get("icon-image"), s = ("constant" !== a.value.kind || a.value.value instanceof re && !a.value.value.isEmpty() || a.value.value.toString().length > 0) && ("constant" !== i.value.kind || i.value.value.length > 0), u = ("constant" !== o.value.kind || !!o.value.value) && Object.keys(o.parameters).length > 0, l = n.get("symbol-sort-key"); if (this.features = [], s || u) { for (var p = e.iconDependencies, c = e.glyphDependencies, h = e.availableImages, f = new Hn(this.zoom), y = 0, d = t; y < d.length; y += 1) { var m = d[y], v = m.feature, g = m.index, x = m.sourceLayerIndex; if (r._featureFilter(f, v)) { var b = void 0; if (s) { var _ = r.getValueAndResolveTokens("text-field", v, h), w = re.factory(_); ul(w) && (this.hasRTLText = !0), (!this.hasRTLText || "unavailable" === Zn() || this.hasRTLText && Jn.isParsed()) && (b = Is(w, r, v)); } var A = void 0; if (u) { var S = r.getValueAndResolveTokens("icon-image", v, h); A = S instanceof ne ? S : ne.fromString(S); } if (b || A) { var k = this.sortFeaturesByKey ? l.evaluate(v, {}) : void 0, I = { text: b, icon: A, index: g, sourceLayerIndex: x, geometry: wa(v), properties: v.properties, type: il[v.type], sortKey: k }; if (void 0 !== v.id && (I.id = v.id), this.features.push(I), A && (p[A.name] = !0), b) { var z = i.evaluate(v, {}).join(","), C = "map" === n.get("text-rotation-alignment") && "point" !== n.get("symbol-placement"); this.allowVerticalPlacement = this.writingModes && this.writingModes.indexOf(au.vertical) >= 0; for (var B = 0, T = b.sections; B < T.length; B += 1) { var P = T[B]; if (P.image) p[P.image.name] = !0; else { var E = Tn(b.toString()), M = P.fontStack || z, V = c[M] = c[M] || {}; this.calculateGlyphDependencies(P.text, V, C, this.allowVerticalPlacement, E); } } } } } } "line" === n.get("symbol-placement") && (this.features = function (t) { var e = {}, r = {}, n = [], i = 0; function a(e) { n.push(t[e]), i++; } function o(t, e, i) { var a = r[t]; return delete r[t], r[e] = a, n[a].geometry[0].pop(), n[a].geometry[0] = n[a].geometry[0].concat(i[0]), a } function s(t, r, i) { var a = e[r]; return delete e[r], e[t] = a, n[a].geometry[0].shift(), n[a].geometry[0] = i[0].concat(n[a].geometry[0]), a } function u(t, e, r) { var n = r ? e[0][e[0].length - 1] : e[0][0]; return t + ":" + n.x + ":" + n.y } for (var l = 0; l < t.length; l++) { var p = t[l], c = p.geometry, h = p.text ? p.text.toString() : null; if (h) { var f = u(h, c), y = u(h, c, !0); if (f in r && y in e && r[f] !== e[y]) { var d = s(f, y, c), m = o(f, y, n[d].geometry); delete e[f], delete r[y], r[u(h, n[m].geometry, !0)] = m, n[d].geometry = null; } else f in r ? o(f, y, c) : y in e ? s(f, y, c) : (a(l), e[f] = i - 1, r[y] = i - 1); } else a(l); } return n.filter((function (t) { return t.geometry })) }(this.features)), this.sortFeaturesByKey && this.features.sort((function (t, e) { return t.sortKey - e.sortKey })); } }, cl.prototype.update = function (t, e, r) { this.stateDependentLayers.length && (this.text.programConfigurations.updatePaintArrays(t, e, this.layers, r), this.icon.programConfigurations.updatePaintArrays(t, e, this.layers, r)); }, cl.prototype.isEmpty = function () { return 0 === this.symbolInstances.length && !this.hasRTLText }, cl.prototype.uploadPending = function () { return !this.uploaded || this.text.programConfigurations.needsUpload || this.icon.programConfigurations.needsUpload }, cl.prototype.upload = function (t) { this.uploaded || (this.textCollisionBox.upload(t), this.iconCollisionBox.upload(t), this.textCollisionCircle.upload(t), this.iconCollisionCircle.upload(t)), this.text.upload(t, this.sortFeaturesByY, !this.uploaded, this.text.programConfigurations.needsUpload), this.icon.upload(t, this.sortFeaturesByY, !this.uploaded, this.icon.programConfigurations.needsUpload), this.uploaded = !0; }, cl.prototype.destroy = function () { this.text.destroy(), this.icon.destroy(), this.textCollisionBox.destroy(), this.iconCollisionBox.destroy(), this.textCollisionCircle.destroy(), this.iconCollisionCircle.destroy(); }, cl.prototype.addToLineVertexArray = function (t, e) { var r = this.lineVertexArray.length; if (void 0 !== t.segment) { for (var n = t.dist(e[t.segment + 1]), i = t.dist(e[t.segment]), a = {}, o = t.segment + 1; o < e.length; o++)a[o] = { x: e[o].x, y: e[o].y, tileUnitDistanceFromAnchor: n }, o < e.length - 1 && (n += e[o + 1].dist(e[o])); for (var s = t.segment || 0; s >= 0; s--)a[s] = { x: e[s].x, y: e[s].y, tileUnitDistanceFromAnchor: i }, s > 0 && (i += e[s - 1].dist(e[s])); for (var u = 0; u < e.length; u++) { var l = a[u]; this.lineVertexArray.emplaceBack(l.x, l.y, l.tileUnitDistanceFromAnchor); } } return { lineStartIndex: r, lineLength: this.lineVertexArray.length - r } }, cl.prototype.addSymbols = function (t, e, r, n, i, a, o, s, u, l, p) { var c = this, h = t.indexArray, f = t.layoutVertexArray, y = t.dynamicLayoutVertexArray, d = t.segments.prepareSegment(4 * e.length, t.layoutVertexArray, t.indexArray, a.sortKey), m = this.glyphOffsetArray.length, v = d.vertexLength, g = this.allowVerticalPlacement && o === au.vertical ? Math.PI / 2 : 0, x = function (t) { var e = t.tl, n = t.tr, i = t.bl, a = t.br, o = t.tex, u = t.pixelOffsetTL, l = t.pixelOffsetBR, p = t.minFontScaleX, m = t.minFontScaleY, v = d.vertexLength, x = t.glyphOffset[1]; ol(f, s.x, s.y, e.x, x + e.y, o.x, o.y, r, t.isSDF, u.x, u.y, p, m), ol(f, s.x, s.y, n.x, x + n.y, o.x + o.w, o.y, r, t.isSDF, l.x, u.y, p, m), ol(f, s.x, s.y, i.x, x + i.y, o.x, o.y + o.h, r, t.isSDF, u.x, l.y, p, m), ol(f, s.x, s.y, a.x, x + a.y, o.x + o.w, o.y + o.h, r, t.isSDF, l.x, l.y, p, m), sl(y, s, g), h.emplaceBack(v, v + 1, v + 2), h.emplaceBack(v + 1, v + 2, v + 3), d.vertexLength += 4, d.primitiveLength += 2, c.glyphOffsetArray.emplaceBack(t.glyphOffset[0]); }; if (a.text && a.text.sections) { var b = a.text.sections; if (this.hasPaintOverrides) { for (var _, w = function (e, r) { void 0 === _ || _ === e && !r || t.programConfigurations.populatePaintArrays(t.layoutVertexArray.length, a, a.index, {}, b[_]), _ = e; }, A = 0, S = e; A < S.length; A += 1) { var k = S[A]; w(k.sectionIndex, !1), x(k); } w(_, !0); } else { for (var I = 0, z = e; I < z.length; I += 1) { x(z[I]); } t.programConfigurations.populatePaintArrays(t.layoutVertexArray.length, a, a.index, {}, b[0]); } } else { for (var C = 0, B = e; C < B.length; C += 1) { x(B[C]); } t.programConfigurations.populatePaintArrays(t.layoutVertexArray.length, a, a.index, {}); } t.placedSymbolArray.emplaceBack(s.x, s.y, m, this.glyphOffsetArray.length - m, v, u, l, s.segment, r ? r[0] : 0, r ? r[1] : 0, n[0], n[1], o, 0, !1, 0, p); }, cl.prototype._addCollisionDebugVertex = function (t, e, r, n, i, a) { return e.emplaceBack(0, 0), t.emplaceBack(r.x, r.y, n, i, Math.round(a.x), Math.round(a.y)) }, cl.prototype.addCollisionDebugVertices = function (t, e, r, n, a, o, s, u) { var l = a.segments.prepareSegment(4, a.layoutVertexArray, a.indexArray), p = l.vertexLength, c = a.layoutVertexArray, h = a.collisionVertexArray, f = s.anchorX, y = s.anchorY; if (this._addCollisionDebugVertex(c, h, o, f, y, new i(t, e)), this._addCollisionDebugVertex(c, h, o, f, y, new i(r, e)), this._addCollisionDebugVertex(c, h, o, f, y, new i(r, n)), this._addCollisionDebugVertex(c, h, o, f, y, new i(t, n)), l.vertexLength += 4, u) { var d = a.indexArray; d.emplaceBack(p, p + 1, p + 2), d.emplaceBack(p, p + 2, p + 3), l.primitiveLength += 2; } else { var m = a.indexArray; m.emplaceBack(p, p + 1), m.emplaceBack(p + 1, p + 2), m.emplaceBack(p + 2, p + 3), m.emplaceBack(p + 3, p), l.primitiveLength += 4; } }, cl.prototype.addDebugCollisionBoxes = function (t, e, r, n) { for (var i = t; i < e; i++) { var a = this.collisionBoxArray.get(i), o = a.x1, s = a.y1, u = a.x2, l = a.y2, p = a.radius > 0; this.addCollisionDebugVertices(o, s, u, l, p ? n ? this.textCollisionCircle : this.iconCollisionCircle : n ? this.textCollisionBox : this.iconCollisionBox, a.anchorPoint, r, p); } }, cl.prototype.generateCollisionDebugBuffers = function () { for (var t = 0; t < this.symbolInstances.length; t++) { var e = this.symbolInstances.get(t); this.addDebugCollisionBoxes(e.textBoxStartIndex, e.textBoxEndIndex, e, !0), this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex, e.verticalTextBoxEndIndex, e, !0), this.addDebugCollisionBoxes(e.iconBoxStartIndex, e.iconBoxEndIndex, e, !1), this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex, e.verticalIconBoxEndIndex, e, !1); } }, cl.prototype._deserializeCollisionBoxesForSymbol = function (t, e, r, n, i, a, o, s, u) { for (var l = {}, p = e; p < r; p++) { var c = t.get(p); if (0 === c.radius) { l.textBox = { x1: c.x1, y1: c.y1, x2: c.x2, y2: c.y2, anchorPointX: c.anchorPointX, anchorPointY: c.anchorPointY }, l.textFeatureIndex = c.featureIndex; break } l.textCircles || (l.textCircles = [], l.textFeatureIndex = c.featureIndex); l.textCircles.push(c.anchorPointX, c.anchorPointY, c.radius, c.signedDistanceFromAnchor, 1); } for (var h = n; h < i; h++) { var f = t.get(h); if (0 === f.radius) { l.verticalTextBox = { x1: f.x1, y1: f.y1, x2: f.x2, y2: f.y2, anchorPointX: f.anchorPointX, anchorPointY: f.anchorPointY }, l.verticalTextFeatureIndex = f.featureIndex; break } } for (var y = a; y < o; y++) { var d = t.get(y); if (0 === d.radius) { l.iconBox = { x1: d.x1, y1: d.y1, x2: d.x2, y2: d.y2, anchorPointX: d.anchorPointX, anchorPointY: d.anchorPointY }, l.iconFeatureIndex = d.featureIndex; break } } for (var m = s; m < u; m++) { var v = t.get(m); if (0 === v.radius) { l.verticalIconBox = { x1: v.x1, y1: v.y1, x2: v.x2, y2: v.y2, anchorPointX: v.anchorPointX, anchorPointY: v.anchorPointY }, l.verticalIconFeatureIndex = v.featureIndex; break } } return l }, cl.prototype.deserializeCollisionBoxes = function (t) { this.collisionArrays = []; for (var e = 0; e < this.symbolInstances.length; e++) { var r = this.symbolInstances.get(e); this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t, r.textBoxStartIndex, r.textBoxEndIndex, r.verticalTextBoxStartIndex, r.verticalTextBoxEndIndex, r.iconBoxStartIndex, r.iconBoxEndIndex, r.verticalIconBoxStartIndex, r.verticalIconBoxEndIndex)); } }, cl.prototype.hasTextData = function () { return this.text.segments.get().length > 0 }, cl.prototype.hasIconData = function () { return this.icon.segments.get().length > 0 }, cl.prototype.hasTextCollisionBoxData = function () { return this.textCollisionBox.segments.get().length > 0 }, cl.prototype.hasIconCollisionBoxData = function () { return this.iconCollisionBox.segments.get().length > 0 }, cl.prototype.hasTextCollisionCircleData = function () { return this.textCollisionCircle.segments.get().length > 0 }, cl.prototype.hasIconCollisionCircleData = function () { return this.iconCollisionCircle.segments.get().length > 0 }, cl.prototype.addIndicesForPlacedSymbol = function (t, e) { for (var r = t.placedSymbolArray.get(e), n = r.vertexStartIndex + 4 * r.numGlyphs, i = r.vertexStartIndex; i < n; i += 4)t.indexArray.emplaceBack(i, i + 1, i + 2), t.indexArray.emplaceBack(i + 1, i + 2, i + 3); }, cl.prototype.getSortedSymbolIndexes = function (t) { if (this.sortedAngle === t && void 0 !== this.symbolInstanceIndexes) return this.symbolInstanceIndexes; for (var e = Math.sin(t), r = Math.cos(t), n = [], i = [], a = [], o = 0; o < this.symbolInstances.length; ++o) { a.push(o); var s = this.symbolInstances.get(o); n.push(0 | Math.round(e * s.anchorX + r * s.anchorY)), i.push(s.featureIndex); } return a.sort((function (t, e) { return n[t] - n[e] || i[e] - i[t] })), a }, cl.prototype.sortFeatures = function (t) { var e = this; if (this.sortFeaturesByY && this.sortedAngle !== t && !(this.text.segments.get().length > 1 || this.icon.segments.get().length > 1)) { this.symbolInstanceIndexes = this.getSortedSymbolIndexes(t), this.sortedAngle = t, this.text.indexArray.clear(), this.icon.indexArray.clear(), this.featureSortOrder = []; for (var r = 0, n = this.symbolInstanceIndexes; r < n.length; r += 1) { var i = n[r], a = this.symbolInstances.get(i); this.featureSortOrder.push(a.featureIndex), [a.rightJustifiedTextSymbolIndex, a.centerJustifiedTextSymbolIndex, a.leftJustifiedTextSymbolIndex].forEach((function (t, r, n) { t >= 0 && n.indexOf(t) === r && e.addIndicesForPlacedSymbol(e.text, t); })), a.verticalPlacedTextSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.text, a.verticalPlacedTextSymbolIndex), a.placedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, a.placedIconSymbolIndex), a.verticalPlacedIconSymbolIndex >= 0 && this.addIndicesForPlacedSymbol(this.icon, a.verticalPlacedIconSymbolIndex); } this.text.indexBuffer && this.text.indexBuffer.updateData(this.text.indexArray), this.icon.indexBuffer && this.icon.indexBuffer.updateData(this.icon.indexArray); } }, An("SymbolBucket", cl, { omit: ["layers", "collisionBoxArray", "features", "compareText"] }), cl.MAX_GLYPHS = 65535, cl.addDynamicAttributes = sl; var hl = new li({ "symbol-placement": new ii(Tt.layout_symbol["symbol-placement"]), "symbol-spacing": new ii(Tt.layout_symbol["symbol-spacing"]), "symbol-avoid-edges": new ii(Tt.layout_symbol["symbol-avoid-edges"]), "symbol-sort-key": new ai(Tt.layout_symbol["symbol-sort-key"]), "symbol-z-order": new ii(Tt.layout_symbol["symbol-z-order"]), "icon-allow-overlap": new ii(Tt.layout_symbol["icon-allow-overlap"]), "icon-ignore-placement": new ii(Tt.layout_symbol["icon-ignore-placement"]), "icon-optional": new ii(Tt.layout_symbol["icon-optional"]), "icon-rotation-alignment": new ii(Tt.layout_symbol["icon-rotation-alignment"]), "icon-size": new ai(Tt.layout_symbol["icon-size"]), "icon-text-fit": new ii(Tt.layout_symbol["icon-text-fit"]), "icon-text-fit-padding": new ii(Tt.layout_symbol["icon-text-fit-padding"]), "icon-image": new ai(Tt.layout_symbol["icon-image"]), "icon-rotate": new ai(Tt.layout_symbol["icon-rotate"]), "icon-padding": new ii(Tt.layout_symbol["icon-padding"]), "icon-keep-upright": new ii(Tt.layout_symbol["icon-keep-upright"]), "icon-offset": new ai(Tt.layout_symbol["icon-offset"]), "icon-anchor": new ai(Tt.layout_symbol["icon-anchor"]), "icon-pitch-alignment": new ii(Tt.layout_symbol["icon-pitch-alignment"]), "text-pitch-alignment": new ii(Tt.layout_symbol["text-pitch-alignment"]), "text-rotation-alignment": new ii(Tt.layout_symbol["text-rotation-alignment"]), "text-field": new ai(Tt.layout_symbol["text-field"]), "text-font": new ai(Tt.layout_symbol["text-font"]), "text-size": new ai(Tt.layout_symbol["text-size"]), "text-max-width": new ai(Tt.layout_symbol["text-max-width"]), "text-line-height": new ii(Tt.layout_symbol["text-line-height"]), "text-letter-spacing": new ai(Tt.layout_symbol["text-letter-spacing"]), "text-justify": new ai(Tt.layout_symbol["text-justify"]), "text-radial-offset": new ai(Tt.layout_symbol["text-radial-offset"]), "text-variable-anchor": new ii(Tt.layout_symbol["text-variable-anchor"]), "text-anchor": new ai(Tt.layout_symbol["text-anchor"]), "text-max-angle": new ii(Tt.layout_symbol["text-max-angle"]), "text-writing-mode": new ii(Tt.layout_symbol["text-writing-mode"]), "text-rotate": new ai(Tt.layout_symbol["text-rotate"]), "text-padding": new ii(Tt.layout_symbol["text-padding"]), "text-keep-upright": new ii(Tt.layout_symbol["text-keep-upright"]), "text-transform": new ai(Tt.layout_symbol["text-transform"]), "text-offset": new ai(Tt.layout_symbol["text-offset"]), "text-allow-overlap": new ii(Tt.layout_symbol["text-allow-overlap"]), "text-ignore-placement": new ii(Tt.layout_symbol["text-ignore-placement"]), "text-optional": new ii(Tt.layout_symbol["text-optional"]) }), fl = { paint: new li({ "icon-opacity": new ai(Tt.paint_symbol["icon-opacity"]), "icon-color": new ai(Tt.paint_symbol["icon-color"]), "icon-halo-color": new ai(Tt.paint_symbol["icon-halo-color"]), "icon-halo-width": new ai(Tt.paint_symbol["icon-halo-width"]), "icon-halo-blur": new ai(Tt.paint_symbol["icon-halo-blur"]), "icon-translate": new ii(Tt.paint_symbol["icon-translate"]), "icon-translate-anchor": new ii(Tt.paint_symbol["icon-translate-anchor"]), "text-opacity": new ai(Tt.paint_symbol["text-opacity"]), "text-color": new ai(Tt.paint_symbol["text-color"], { runtimeType: qt, getOverride: function (t) { return t.textColor }, hasOverride: function (t) { return !!t.textColor } }), "text-halo-color": new ai(Tt.paint_symbol["text-halo-color"]), "text-halo-width": new ai(Tt.paint_symbol["text-halo-width"]), "text-halo-blur": new ai(Tt.paint_symbol["text-halo-blur"]), "text-translate": new ii(Tt.paint_symbol["text-translate"]), "text-translate-anchor": new ii(Tt.paint_symbol["text-translate-anchor"]) }), layout: hl }, yl = function (t) { this.type = t.property.overrides ? t.property.overrides.runtimeType : Dt, this.defaultValue = t; }; yl.prototype.evaluate = function (t) { if (t.formattedSection) { var e = this.defaultValue.property.overrides; if (e && e.hasOverride(t.formattedSection)) return e.getOverride(t.formattedSection) } return t.feature && t.featureState ? this.defaultValue.evaluate(t.feature, t.featureState) : this.defaultValue.property.specification.default }, yl.prototype.eachChild = function (t) { this.defaultValue.isConstant() || t(this.defaultValue.value._styleExpression.expression); }, yl.prototype.possibleOutputs = function () { return [void 0] }, yl.prototype.serialize = function () { return null }, An("FormatSectionOverride", yl, { omit: ["defaultValue"] }); var dl = function (t) { function e(e) { t.call(this, e, fl); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.recalculate = function (e, r) { if (t.prototype.recalculate.call(this, e, r), "auto" === this.layout.get("icon-rotation-alignment") && ("point" !== this.layout.get("symbol-placement") ? this.layout._values["icon-rotation-alignment"] = "map" : this.layout._values["icon-rotation-alignment"] = "viewport"), "auto" === this.layout.get("text-rotation-alignment") && ("point" !== this.layout.get("symbol-placement") ? this.layout._values["text-rotation-alignment"] = "map" : this.layout._values["text-rotation-alignment"] = "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")), "point" === this.layout.get("symbol-placement")) { var n = this.layout.get("text-writing-mode"); if (n) { for (var i = [], a = 0, o = n; a < o.length; a += 1) { var s = o[a]; i.indexOf(s) < 0 && i.push(s); } this.layout._values["text-writing-mode"] = i; } else this.layout._values["text-writing-mode"] = ["horizontal"]; } this._setPaintOverrides(); }, e.prototype.getValueAndResolveTokens = function (t, e, r) { var n = this.layout.get(t).evaluate(e, {}, r), i = this._unevaluatedLayout._values[t]; return i.isDataDriven() || Pr(i.value) || !n ? n : function (t, e) { return e.replace(/{([^{}]+)}/g, (function (e, r) { return r in t ? String(t[r]) : "" })) }(e.properties, n) }, e.prototype.createBucket = function (t) { return new cl(t) }, e.prototype.queryRadius = function () { return 0 }, e.prototype.queryIntersectsFeature = function () { return !1 }, e.prototype._setPaintOverrides = function () { for (var t = 0, r = fl.paint.overridableProperties; t < r.length; t += 1) { var n = r[t]; if (e.hasPaintOverride(this.layout, n)) { var i = this.paint.get(n), a = new yl(i), o = new Tr(a, i.property.specification), s = null; s = "constant" === i.value.kind || "source" === i.value.kind ? new Mr("source", o) : new Vr("composite", o, i.value.zoomStops, i.value._interpolationType), this.paint._values[n] = new ri(i.property, s, i.parameters); } } }, e.prototype._handleOverridablePaintPropertyUpdate = function (t, r, n) { return !(!this.layout || r.isDataDriven() || n.isDataDriven()) && e.hasPaintOverride(this.layout, t) }, e.hasPaintOverride = function (t, e) { var r = t.get("text-field"), n = fl.paint.properties[e], i = !1, a = function (t) { for (var e = 0, r = t; e < r.length; e += 1) { var a = r[e]; if (n.overrides && n.overrides.hasOverride(a)) return void (i = !0) } }; if ("constant" === r.value.kind && r.value.value instanceof re) a(r.value.value.sections); else if ("source" === r.value.kind) { var o = function (t) { if (!i) if (t instanceof se && ae(t.value) === Zt) { var e = t.value; a(e.sections); } else t instanceof ce ? a(t.sections) : t.eachChild(o); }, s = r.value; s._styleExpression && o(s._styleExpression.expression); } return i }, e.hasPaintOverrides = function (t) { for (var r = 0, n = fl.paint.overridableProperties; r < n.length; r += 1) { var i = n[r]; if (e.hasPaintOverride(t, i)) return !0 } return !1 }, e }(pi), ml = { paint: new li({ "background-color": new ii(Tt.paint_background["background-color"]), "background-pattern": new si(Tt.paint_background["background-pattern"]), "background-opacity": new ii(Tt.paint_background["background-opacity"]) }) }, vl = function (t) { function e(e) { t.call(this, e, ml); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e }(pi), gl = { paint: new li({ "raster-opacity": new ii(Tt.paint_raster["raster-opacity"]), "raster-hue-rotate": new ii(Tt.paint_raster["raster-hue-rotate"]), "raster-brightness-min": new ii(Tt.paint_raster["raster-brightness-min"]), "raster-brightness-max": new ii(Tt.paint_raster["raster-brightness-max"]), "raster-saturation": new ii(Tt.paint_raster["raster-saturation"]), "raster-contrast": new ii(Tt.paint_raster["raster-contrast"]), "raster-resampling": new ii(Tt.paint_raster["raster-resampling"]), "raster-fade-duration": new ii(Tt.paint_raster["raster-fade-duration"]) }) }, xl = function (t) { function e(e) { t.call(this, e, gl); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e }(pi); var bl = function (t) { function e(e) { t.call(this, e, {}), this.implementation = e; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.is3D = function () { return "3d" === this.implementation.renderingMode }, e.prototype.hasOffscreenPass = function () { return void 0 !== this.implementation.prerender }, e.prototype.recalculate = function () { }, e.prototype.updateTransitions = function () { }, e.prototype.hasTransition = function () { }, e.prototype.serialize = function () { }, e.prototype.onAdd = function (t) { this.implementation.onAdd && this.implementation.onAdd(t, t.painter.context.gl); }, e.prototype.onRemove = function (t) { this.implementation.onRemove && this.implementation.onRemove(t, t.painter.context.gl); }, e }(pi), _l = { circle: Xa, heatmap: eo, hillshade: no, fill: Ko, "fill-extrusion": us, line: xs, symbol: dl, background: vl, raster: xl }; var wl = self.HTMLImageElement, Al = self.HTMLCanvasElement, Sl = self.HTMLVideoElement, kl = self.ImageData, Il = function (t, e, r, n) { this.context = t, this.format = r, this.texture = t.gl.createTexture(), this.update(e, n); }; Il.prototype.update = function (t, e, r) { var n = t.width, i = t.height, a = !(this.size && this.size[0] === n && this.size[1] === i || r), o = this.context, s = o.gl; if (this.useMipmap = Boolean(e && e.useMipmap), s.bindTexture(s.TEXTURE_2D, this.texture), o.pixelStoreUnpackFlipY.set(!1), o.pixelStoreUnpack.set(1), o.pixelStoreUnpackPremultiplyAlpha.set(this.format === s.RGBA && (!e || !1 !== e.premultiply)), a) this.size = [n, i], t instanceof wl || t instanceof Al || t instanceof Sl || t instanceof kl ? s.texImage2D(s.TEXTURE_2D, 0, this.format, this.format, s.UNSIGNED_BYTE, t) : s.texImage2D(s.TEXTURE_2D, 0, this.format, n, i, 0, this.format, s.UNSIGNED_BYTE, t.data); else { var u = r || { x: 0, y: 0 }, l = u.x, p = u.y; t instanceof wl || t instanceof Al || t instanceof Sl || t instanceof kl ? s.texSubImage2D(s.TEXTURE_2D, 0, l, p, s.RGBA, s.UNSIGNED_BYTE, t) : s.texSubImage2D(s.TEXTURE_2D, 0, l, p, n, i, s.RGBA, s.UNSIGNED_BYTE, t.data); } this.useMipmap && this.isSizePowerOfTwo() && s.generateMipmap(s.TEXTURE_2D); }, Il.prototype.bind = function (t, e, r) { var n = this.context.gl; n.bindTexture(n.TEXTURE_2D, this.texture), r !== n.LINEAR_MIPMAP_NEAREST || this.isSizePowerOfTwo() || (r = n.LINEAR), t !== this.filter && (n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, t), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, r || t), this.filter = t), e !== this.wrap && (n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, e), this.wrap = e); }, Il.prototype.isSizePowerOfTwo = function () { return this.size[0] === this.size[1] && Math.log(this.size[0]) / Math.LN2 % 1 == 0 }, Il.prototype.destroy = function () { this.context.gl.deleteTexture(this.texture), this.texture = null; }; var zl = function (t) { var e = this; this._callback = t, this._triggered = !1, "undefined" != typeof MessageChannel && (this._channel = new MessageChannel, this._channel.port2.onmessage = function () { e._triggered = !1, e._callback(); }); }; zl.prototype.trigger = function () { var t = this; this._triggered || (this._triggered = !0, this._channel ? this._channel.port1.postMessage(!0) : setTimeout((function () { t._triggered = !1, t._callback(); }), 0)); }, zl.prototype.remove = function () { delete this._channel, this._callback = function () { }; }; var Cl = function (t, e, r) { this.target = t, this.parent = e, this.mapId = r, this.callbacks = {}, this.tasks = {}, this.taskQueue = [], this.cancelCallbacks = {}, m(["receive", "process"], this), this.invoker = new zl(this.process), this.target.addEventListener("message", this.receive, !1), this.globalScope = k() ? t : self; }; function Bl(t, e, r) { var n = 2 * Math.PI * 6378137 / 256 / Math.pow(2, r); return [t * n - 2 * Math.PI * 6378137 / 2, e * n - 2 * Math.PI * 6378137 / 2] } Cl.prototype.send = function (t, e, r, n, i) { var a = this; void 0 === i && (i = !1); var o = Math.round(1e18 * Math.random()).toString(36).substring(0, 10); r && (this.callbacks[o] = r); var s = C(this.globalScope) ? void 0 : []; return this.target.postMessage({ id: o, type: t, hasCallback: !!r, targetMapId: n, mustQueue: i, sourceMapId: this.mapId, data: In(e, s) }, s), { cancel: function () { r && delete a.callbacks[o], a.target.postMessage({ id: o, type: "", targetMapId: n, sourceMapId: a.mapId }); } } }, Cl.prototype.receive = function (t) { var e = t.data, r = e.id; if (r && (!e.targetMapId || this.mapId === e.targetMapId)) if ("" === e.type) { delete this.tasks[r]; var n = this.cancelCallbacks[r]; delete this.cancelCallbacks[r], n && n(); } else k() || e.mustQueue ? (this.tasks[r] = e, this.taskQueue.push(r), this.invoker.trigger()) : this.processTask(r, e); }, Cl.prototype.process = function () { if (this.taskQueue.length) { var t = this.taskQueue.shift(), e = this.tasks[t]; delete this.tasks[t], this.taskQueue.length && this.invoker.trigger(), e && this.processTask(t, e); } }, Cl.prototype.processTask = function (t, e) { var r = this; if ("" === e.type) { var n = this.callbacks[t]; delete this.callbacks[t], n && (e.error ? n(zn(e.error)) : n(null, zn(e.data))); } else { var i = !1, a = C(this.globalScope) ? void 0 : [], o = e.hasCallback ? function (e, n) { i = !0, delete r.cancelCallbacks[t], r.target.postMessage({ id: t, type: "", sourceMapId: r.mapId, error: e ? In(e) : null, data: In(n, a) }, a); } : function (t) { i = !0; }, s = null, u = zn(e.data); if (this.parent[e.type]) s = this.parent[e.type](e.sourceMapId, u, o); else if (this.parent.getWorkerSource) { var l = e.type.split("."); s = this.parent.getWorkerSource(e.sourceMapId, l[0], u.source)[l[1]](u, o); } else o(new Error("Could not find function " + e.type)); !i && s && s.cancel && (this.cancelCallbacks[t] = s.cancel); } }, Cl.prototype.remove = function () { this.invoker.remove(), this.target.removeEventListener("message", this.receive, !1); }; var Tl = function (t, e) { t && (e ? this.setSouthWest(t).setNorthEast(e) : 4 === t.length ? this.setSouthWest([t[0], t[1]]).setNorthEast([t[2], t[3]]) : this.setSouthWest(t[0]).setNorthEast(t[1])); }; Tl.prototype.setNorthEast = function (t) { return this._ne = t instanceof Pl ? new Pl(t.lng, t.lat) : Pl.convert(t), this }, Tl.prototype.setSouthWest = function (t) { return this._sw = t instanceof Pl ? new Pl(t.lng, t.lat) : Pl.convert(t), this }, Tl.prototype.extend = function (t) { var e, r, n = this._sw, i = this._ne; if (t instanceof Pl) e = t, r = t; else { if (!(t instanceof Tl)) return Array.isArray(t) ? t.every(Array.isArray) ? this.extend(Tl.convert(t)) : this.extend(Pl.convert(t)) : this; if (e = t._sw, r = t._ne, !e || !r) return this } return n || i ? (n.lng = Math.min(e.lng, n.lng), n.lat = Math.min(e.lat, n.lat), i.lng = Math.max(r.lng, i.lng), i.lat = Math.max(r.lat, i.lat)) : (this._sw = new Pl(e.lng, e.lat), this._ne = new Pl(r.lng, r.lat)), this }, Tl.prototype.getCenter = function () { return new Pl((this._sw.lng + this._ne.lng) / 2, (this._sw.lat + this._ne.lat) / 2) }, Tl.prototype.getSouthWest = function () { return this._sw }, Tl.prototype.getNorthEast = function () { return this._ne }, Tl.prototype.getNorthWest = function () { return new Pl(this.getWest(), this.getNorth()) }, Tl.prototype.getSouthEast = function () { return new Pl(this.getEast(), this.getSouth()) }, Tl.prototype.getWest = function () { return this._sw.lng }, Tl.prototype.getSouth = function () { return this._sw.lat }, Tl.prototype.getEast = function () { return this._ne.lng }, Tl.prototype.getNorth = function () { return this._ne.lat }, Tl.prototype.toArray = function () { return [this._sw.toArray(), this._ne.toArray()] }, Tl.prototype.toString = function () { return "LngLatBounds(" + this._sw.toString() + ", " + this._ne.toString() + ")" }, Tl.prototype.isEmpty = function () { return !(this._sw && this._ne) }, Tl.prototype.contains = function (t) { var e = Pl.convert(t), r = e.lng, n = e.lat, i = this._sw.lat <= n && n <= this._ne.lat, a = this._sw.lng <= r && r <= this._ne.lng; return this._sw.lng > this._ne.lng && (a = this._sw.lng >= r && r >= this._ne.lng), i && a }, Tl.convert = function (t) { return !t || t instanceof Tl ? t : new Tl(t) }; var Pl = function (t, e) { if (isNaN(t) || isNaN(e)) throw new Error("Invalid LngLat object: (" + t + ", " + e + ")"); if (this.lng = +t, this.lat = +e, this.lat > 90 || this.lat < -90) throw new Error("Invalid LngLat latitude value: must be between -90 and 90") }; Pl.prototype.wrap = function () { return new Pl(p(this.lng, -180, 180), this.lat) }, Pl.prototype.toArray = function () { return [this.lng, this.lat] }, Pl.prototype.toString = function () { return "LngLat(" + this.lng + ", " + this.lat + ")" }, Pl.prototype.toBounds = function (t) { void 0 === t && (t = 0); var e = 360 * t / 40075017, r = e / Math.cos(Math.PI / 180 * this.lat); return new Tl(new Pl(this.lng - r, this.lat - e), new Pl(this.lng + r, this.lat + e)) }, Pl.convert = function (t) { if (t instanceof Pl) return t; if (Array.isArray(t) && (2 === t.length || 3 === t.length)) return new Pl(Number(t[0]), Number(t[1])); if (!Array.isArray(t) && "object" == typeof t && null !== t) return new Pl(Number("lng" in t ? t.lng : t.lon), Number(t.lat)); throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]") }; var El = 2 * Math.PI * 6378137; function Ml(t) { return El * Math.cos(t * Math.PI / 180) } function Vl(t) { return (180 + t) / 360 } function Fl(t) { return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + t * Math.PI / 360))) / 360 } function Ll(t, e) { return t / Ml(e) } function Ol(t) { var e = 180 - 360 * t; return 360 / Math.PI * Math.atan(Math.exp(e * Math.PI / 180)) - 90 } var Dl = function (t, e, r) { void 0 === r && (r = 0), this.x = +t, this.y = +e, this.z = +r; }; Dl.fromLngLat = function (t, e) { void 0 === e && (e = 0); var r = Pl.convert(t); return new Dl(Vl(r.lng), Fl(r.lat), Ll(e, r.lat)) }, Dl.prototype.toLngLat = function () { return new Pl(360 * this.x - 180, Ol(this.y)) }, Dl.prototype.toAltitude = function () { return t = this.z, e = this.y, t * Ml(Ol(e)); var t, e; }, Dl.prototype.meterInMercatorCoordinateUnits = function () { return 1 / El * (t = Ol(this.y), 1 / Math.cos(t * Math.PI / 180)); var t; }; var Rl = function (t, e, r) { this.z = t, this.x = e, this.y = r, this.key = ql(0, t, e, r); }; Rl.prototype.equals = function (t) { return this.z === t.z && this.x === t.x && this.y === t.y }, Rl.prototype.url = function (t, e) { var r, n, i, a, o, s = (r = this.x, n = this.y, i = this.z, a = Bl(256 * r, 256 * (n = Math.pow(2, i) - n - 1), i), o = Bl(256 * (r + 1), 256 * (n + 1), i), a[0] + "," + a[1] + "," + o[0] + "," + o[1]), u = function (t, e, r) { for (var n, i = "", a = t; a > 0; a--)i += (e & (n = 1 << a - 1) ? 1 : 0) + (r & n ? 2 : 0); return i }(this.z, this.x, this.y); return t[(this.x + this.y) % t.length].replace("{prefix}", (this.x % 16).toString(16) + (this.y % 16).toString(16)).replace("{z}", String(this.z)).replace("{x}", String(this.x)).replace("{y}", String("tms" === e ? Math.pow(2, this.z) - this.y - 1 : this.y)).replace("{quadkey}", u).replace("{bbox-epsg-3857}", s) }, Rl.prototype.getTilePoint = function (t) { var e = Math.pow(2, this.z); return new i((t.x * e - this.x) * xa, (t.y * e - this.y) * xa) }, Rl.prototype.toString = function () { return this.z + "/" + this.x + "/" + this.y }; var Ul = function (t, e) { this.wrap = t, this.canonical = e, this.key = ql(t, e.z, e.x, e.y); }, jl = function (t, e, r, n, i) { this.overscaledZ = t, this.wrap = e, this.canonical = new Rl(r, +n, +i), this.key = ql(e, t, n, i); }; function ql(t, e, r, n) { (t *= 2) < 0 && (t = -1 * t - 1); var i = 1 << e; return 32 * (i * i * t + i * n + r) + e } jl.prototype.equals = function (t) { return this.overscaledZ === t.overscaledZ && this.wrap === t.wrap && this.canonical.equals(t.canonical) }, jl.prototype.scaledTo = function (t) { var e = this.canonical.z - t; return t > this.canonical.z ? new jl(t, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y) : new jl(t, this.wrap, t, this.canonical.x >> e, this.canonical.y >> e) }, jl.prototype.isChildOf = function (t) { if (t.wrap !== this.wrap) return !1; var e = this.canonical.z - t.canonical.z; return 0 === t.overscaledZ || t.overscaledZ < this.overscaledZ && t.canonical.x === this.canonical.x >> e && t.canonical.y === this.canonical.y >> e }, jl.prototype.children = function (t) { if (this.overscaledZ >= t) return [new jl(this.overscaledZ + 1, this.wrap, this.canonical.z, this.canonical.x, this.canonical.y)]; var e = this.canonical.z + 1, r = 2 * this.canonical.x, n = 2 * this.canonical.y; return [new jl(e, this.wrap, e, r, n), new jl(e, this.wrap, e, r + 1, n), new jl(e, this.wrap, e, r, n + 1), new jl(e, this.wrap, e, r + 1, n + 1)] }, jl.prototype.isLessThan = function (t) { return this.wrap < t.wrap || !(this.wrap > t.wrap) && (this.overscaledZ < t.overscaledZ || !(this.overscaledZ > t.overscaledZ) && (this.canonical.x < t.canonical.x || !(this.canonical.x > t.canonical.x) && this.canonical.y < t.canonical.y)) }, jl.prototype.wrapped = function () { return new jl(this.overscaledZ, 0, this.canonical.z, this.canonical.x, this.canonical.y) }, jl.prototype.unwrapTo = function (t) { return new jl(this.overscaledZ, t, this.canonical.z, this.canonical.x, this.canonical.y) }, jl.prototype.overscaleFactor = function () { return Math.pow(2, this.overscaledZ - this.canonical.z) }, jl.prototype.toUnwrapped = function () { return new Ul(this.wrap, this.canonical) }, jl.prototype.toString = function () { return this.overscaledZ + "/" + this.canonical.x + "/" + this.canonical.y }, jl.prototype.getTilePoint = function (t) { return this.canonical.getTilePoint(new Dl(t.x - this.wrap, t.y)) }, An("CanonicalTileID", Rl), An("OverscaledTileID", jl, { omit: ["posMatrix"] }); var Nl = function (t, e, r) { if (this.uid = t, e.height !== e.width) throw new RangeError("DEM tiles must be square"); if (r && "mapbox" !== r && "terrarium" !== r) return w('"' + r + '" is not a valid encoding type. Valid types include "mapbox" and "terrarium".'); this.stride = e.height; var n = this.dim = e.height - 2; this.data = new Uint32Array(e.data.buffer), this.encoding = r || "mapbox"; for (var i = 0; i < n; i++)this.data[this._idx(-1, i)] = this.data[this._idx(0, i)], this.data[this._idx(n, i)] = this.data[this._idx(n - 1, i)], this.data[this._idx(i, -1)] = this.data[this._idx(i, 0)], this.data[this._idx(i, n)] = this.data[this._idx(i, n - 1)]; this.data[this._idx(-1, -1)] = this.data[this._idx(0, 0)], this.data[this._idx(n, -1)] = this.data[this._idx(n - 1, 0)], this.data[this._idx(-1, n)] = this.data[this._idx(0, n - 1)], this.data[this._idx(n, n)] = this.data[this._idx(n - 1, n - 1)]; }; Nl.prototype.get = function (t, e) { var r = new Uint8Array(this.data.buffer), n = 4 * this._idx(t, e); return ("terrarium" === this.encoding ? this._unpackTerrarium : this._unpackMapbox)(r[n], r[n + 1], r[n + 2]) }, Nl.prototype.getUnpackVector = function () { return "terrarium" === this.encoding ? [256, 1, 1 / 256, 32768] : [6553.6, 25.6, .1, 1e4] }, Nl.prototype._idx = function (t, e) { if (t < -1 || t >= this.dim + 1 || e < -1 || e >= this.dim + 1) throw new RangeError("out of range source coordinates for DEM data"); return (e + 1) * this.stride + (t + 1) }, Nl.prototype._unpackMapbox = function (t, e, r) { return (256 * t * 256 + 256 * e + r) / 10 - 1e4 }, Nl.prototype._unpackTerrarium = function (t, e, r) { return 256 * t + e + r / 256 - 32768 }, Nl.prototype.getPixels = function () { return new Wa({ width: this.stride, height: this.stride }, new Uint8Array(this.data.buffer)) }, Nl.prototype.backfillBorder = function (t, e, r) { if (this.dim !== t.dim) throw new Error("dem dimension mismatch"); var n = e * this.dim, i = e * this.dim + this.dim, a = r * this.dim, o = r * this.dim + this.dim; switch (e) { case -1: n = i - 1; break; case 1: i = n + 1; }switch (r) { case -1: a = o - 1; break; case 1: o = a + 1; }for (var s = -e * this.dim, u = -r * this.dim, l = a; l < o; l++)for (var p = n; p < i; p++)this.data[this._idx(p, l)] = t.data[this._idx(p + s, l + u)]; }, An("DEMData", Nl); var Kl = yi([{ name: "a_pos", type: "Int16", components: 2 }, { name: "a_texture_pos", type: "Int16", components: 2 }]); var Xl = function (t) { this._stringToNumber = {}, this._numberToString = []; for (var e = 0; e < t.length; e++) { var r = t[e]; this._stringToNumber[r] = e, this._numberToString[e] = r; } }; Xl.prototype.encode = function (t) { return this._stringToNumber[t] }, Xl.prototype.decode = function (t) { return this._numberToString[t] }; var Zl = function (t, e, r, n) { this.type = "Feature", this._vectorTileFeature = t, t._z = e, t._x = r, t._y = n, this.properties = t.properties, null != t.id && (this.id = t.id); }, Gl = { geometry: { configurable: !0 } }; Gl.geometry.get = function () { return void 0 === this._geometry && (this._geometry = this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x, this._vectorTileFeature._y, this._vectorTileFeature._z).geometry), this._geometry }, Gl.geometry.set = function (t) { this._geometry = t; }, Zl.prototype.toJSON = function () { var t = { geometry: this.geometry }; for (var e in this) "_geometry" !== e && "_vectorTileFeature" !== e && (t[e] = this[e]); return t }, Object.defineProperties(Zl.prototype, Gl); var Jl = function () { this.state = {}, this.stateChanges = {}, this.deletedStates = {}; }; Jl.prototype.updateState = function (t, e, r) { var n = String(e); if (this.stateChanges[t] = this.stateChanges[t] || {}, this.stateChanges[t][n] = this.stateChanges[t][n] || {}, c(this.stateChanges[t][n], r), null === this.deletedStates[t]) for (var i in this.deletedStates[t] = {}, this.state[t]) i !== n && (this.deletedStates[t][i] = null); else if (this.deletedStates[t] && null === this.deletedStates[t][n]) for (var a in this.deletedStates[t][n] = {}, this.state[t][n]) r[a] || (this.deletedStates[t][n][a] = null); else for (var o in r) { this.deletedStates[t] && this.deletedStates[t][n] && null === this.deletedStates[t][n][o] && delete this.deletedStates[t][n][o]; } }, Jl.prototype.removeFeatureState = function (t, e, r) { if (!(null === this.deletedStates[t])) { var n = String(e); if (this.deletedStates[t] = this.deletedStates[t] || {}, r && void 0 !== e && e >= 0) null !== this.deletedStates[t][n] && (this.deletedStates[t][n] = this.deletedStates[t][n] || {}, this.deletedStates[t][n][r] = null); else if (void 0 !== e && e >= 0) { if (this.stateChanges[t] && this.stateChanges[t][n]) for (r in this.deletedStates[t][n] = {}, this.stateChanges[t][n]) this.deletedStates[t][n][r] = null; else this.deletedStates[t][n] = null; } else this.deletedStates[t] = null; } }, Jl.prototype.getState = function (t, e) { var r = String(e), n = this.state[t] || {}, i = this.stateChanges[t] || {}, a = c({}, n[r], i[r]); if (null === this.deletedStates[t]) return {}; if (this.deletedStates[t]) { var o = this.deletedStates[t][e]; if (null === o) return {}; for (var s in o) delete a[s]; } return a }, Jl.prototype.initializeTileState = function (t, e) { t.setFeatureState(this.state, e); }, Jl.prototype.coalesceChanges = function (t, e) { var r = {}; for (var n in this.stateChanges) { this.state[n] = this.state[n] || {}; var i = {}; for (var a in this.stateChanges[n]) this.state[n][a] || (this.state[n][a] = {}), c(this.state[n][a], this.stateChanges[n][a]), i[a] = this.state[n][a]; r[n] = i; } for (var o in this.deletedStates) { this.state[o] = this.state[o] || {}; var s = {}; if (null === this.deletedStates[o]) for (var u in this.state[o]) s[u] = {}, this.state[o][u] = {}; else for (var l in this.deletedStates[o]) { if (null === this.deletedStates[o][l]) this.state[o][l] = {}; else for (var p = 0, h = Object.keys(this.deletedStates[o][l]); p < h.length; p += 1) { var f = h[p]; delete this.state[o][l][f]; } s[l] = this.state[o][l]; } r[o] = r[o] || {}, c(r[o], s); } if (this.stateChanges = {}, this.deletedStates = {}, 0 !== Object.keys(r).length) for (var y in t) { t[y].setFeatureState(r, e); } }; var Hl = function (t, e, r) { this.tileID = t, this.x = t.canonical.x, this.y = t.canonical.y, this.z = t.canonical.z, this.grid = e || new gn(xa, 16, 0), this.grid3D = new gn(xa, 16, 0), this.featureIndexArray = r || new Ji; }; function Yl(t) { for (var e = 1 / 0, r = 1 / 0, n = -1 / 0, i = -1 / 0, a = 0, o = t; a < o.length; a += 1) { var s = o[a]; e = Math.min(e, s.x), r = Math.min(r, s.y), n = Math.max(n, s.x), i = Math.max(i, s.y); } return { minX: e, minY: r, maxX: n, maxY: i } } function $l(t, e) { return e - t } Hl.prototype.insert = function (t, e, r, n, i, a) { var o = this.featureIndexArray.length; this.featureIndexArray.emplaceBack(r, n, i); for (var s = a ? this.grid3D : this.grid, u = 0; u < e.length; u++) { for (var l = e[u], p = [1 / 0, 1 / 0, -1 / 0, -1 / 0], c = 0; c < l.length; c++) { var h = l[c]; p[0] = Math.min(p[0], h.x), p[1] = Math.min(p[1], h.y), p[2] = Math.max(p[2], h.x), p[3] = Math.max(p[3], h.y); } p[0] < xa && p[1] < xa && p[2] >= 0 && p[3] >= 0 && s.insert(o, p[0], p[1], p[2], p[3]); } }, Hl.prototype.loadVTLayers = function () { return this.vtLayers || (this.vtLayers = new ts.VectorTile(new Ps(this.rawTileData)).layers, this.sourceLayerCoder = new Xl(this.vtLayers ? Object.keys(this.vtLayers).sort() : ["_geojsonTileLayer"])), this.vtLayers }, Hl.prototype.query = function (t, e, r) { var n = this; this.loadVTLayers(); for (var a = t.params || {}, o = xa / t.tileSize / t.scale, s = Xr(a.filter), u = t.queryGeometry, l = t.queryPadding * o, p = Yl(u), c = this.grid.query(p.minX - l, p.minY - l, p.maxX + l, p.maxY + l), h = Yl(t.cameraQueryGeometry), f = this.grid3D.query(h.minX - l, h.minY - l, h.maxX + l, h.maxY + l, (function (e, r, n, a) { return function (t, e, r, n, a) { for (var o = 0, s = t; o < s.length; o += 1) { var u = s[o]; if (e <= u.x && r <= u.y && n >= u.x && a >= u.y) return !0 } var l = [new i(e, r), new i(e, a), new i(n, a), new i(n, r)]; if (t.length > 2) for (var p = 0, c = l; p < c.length; p += 1) { if (Va(t, c[p])) return !0 } for (var h = 0; h < t.length - 1; h++) { if (Fa(t[h], t[h + 1], l)) return !0 } return !1 }(t.cameraQueryGeometry, e - l, r - l, n + l, a + l) })), y = 0, d = f; y < d.length; y += 1) { var m = d[y]; c.push(m); } c.sort($l); for (var v, g = {}, x = function (i) { var l = c[i]; if (l !== v) { v = l; var p = n.featureIndexArray.get(l), h = null; n.loadMatchingFeature(g, p.bucketIndex, p.sourceLayerIndex, p.featureIndex, s, a.layers, e, (function (e, i) { h || (h = wa(e)); var a = {}; return e.id && (a = r.getState(i.sourceLayer || "_geojsonTileLayer", e.id)), i.queryIntersectsFeature(u, e, a, h, n.z, t.transform, o, t.pixelPosMatrix) })); } }, b = 0; b < c.length; b++)x(b); return g }, Hl.prototype.loadMatchingFeature = function (t, e, r, n, i, a, o, s) { var u = this.bucketLayerIDs[e]; if (!a || function (t, e) { for (var r = 0; r < t.length; r++)if (e.indexOf(t[r]) >= 0) return !0; return !1 }(a, u)) { var l = this.sourceLayerCoder.decode(r), p = this.vtLayers[l].feature(n); if (i(new Hn(this.tileID.overscaledZ), p)) for (var c = 0; c < u.length; c++) { var h = u[c]; if (!(a && a.indexOf(h) < 0)) { var f = o[h]; if (f) { var y = !s || s(p, f); if (y) { var d = new Zl(p, this.z, this.x, this.y); d.layer = f.serialize(); var m = t[h]; void 0 === m && (m = t[h] = []), m.push({ featureIndex: n, feature: d, intersectionZ: y }); } } } } } }, Hl.prototype.lookupSymbolFeatures = function (t, e, r, n, i, a) { var o = {}; this.loadVTLayers(); for (var s = Xr(n), u = 0, l = t; u < l.length; u += 1) { var p = l[u]; this.loadMatchingFeature(o, e, r, p, s, i, a); } return o }, Hl.prototype.hasLayer = function (t) { for (var e = 0, r = this.bucketLayerIDs; e < r.length; e += 1)for (var n = 0, i = r[e]; n < i.length; n += 1) { if (t === i[n]) return !0 } return !1 }, An("FeatureIndex", Hl, { omit: ["rawTileData", "sourceLayerCoder"] }); var Wl = function (t, e) { this.tileID = t, this.uid = f(), this.uses = 0, this.tileSize = e, this.buckets = {}, this.expirationTime = null, this.queryPadding = 0, this.hasSymbolBuckets = !1, this.hasRTLText = !1, this.dependencies = {}, this.expiredRequestCount = 0, this.state = "loading"; }; Wl.prototype.registerFadeDuration = function (t) { var e = t + this.timeAdded; e < O.now() || this.fadeEndTime && e < this.fadeEndTime || (this.fadeEndTime = e); }, Wl.prototype.wasRequested = function () { return "errored" === this.state || "loaded" === this.state || "reloading" === this.state }, Wl.prototype.loadVectorData = function (t, e, r) { if (this.hasData() && this.unloadVectorData(), this.state = "loaded", t) { for (var n in t.featureIndex && (this.latestFeatureIndex = t.featureIndex, t.rawTileData ? (this.latestRawTileData = t.rawTileData, this.latestFeatureIndex.rawTileData = t.rawTileData) : this.latestRawTileData && (this.latestFeatureIndex.rawTileData = this.latestRawTileData)), this.collisionBoxArray = t.collisionBoxArray, this.buckets = function (t, e) { var r = {}; if (!e) return r; for (var n = function () { var t = a[i], n = t.layerIds.map((function (t) { return e.getLayer(t) })).filter(Boolean); if (0 !== n.length) { t.layers = n, t.stateDependentLayerIds && (t.stateDependentLayers = t.stateDependentLayerIds.map((function (t) { return n.filter((function (e) { return e.id === t }))[0] }))); for (var o = 0, s = n; o < s.length; o += 1) { var u = s[o]; r[u.id] = t; } } }, i = 0, a = t; i < a.length; i += 1)n(); return r }(t.buckets, e.style), this.hasSymbolBuckets = !1, this.buckets) { var i = this.buckets[n]; if (i instanceof cl) { if (this.hasSymbolBuckets = !0, !r) break; i.justReloaded = !0; } } if (this.hasRTLText = !1, this.hasSymbolBuckets) for (var a in this.buckets) { var o = this.buckets[a]; if (o instanceof cl && o.hasRTLText) { this.hasRTLText = !0, Jn.isLoading() || Jn.isLoaded() || "deferred" !== Zn() || Gn(); break } } for (var s in this.queryPadding = 0, this.buckets) { var u = this.buckets[s]; this.queryPadding = Math.max(this.queryPadding, e.style.getLayer(s).queryRadius(u)); } t.imageAtlas && (this.imageAtlas = t.imageAtlas), t.glyphAtlasImage && (this.glyphAtlasImage = t.glyphAtlasImage); } else this.collisionBoxArray = new Di; }, Wl.prototype.unloadVectorData = function () { for (var t in this.buckets) this.buckets[t].destroy(); this.buckets = {}, this.imageAtlasTexture && this.imageAtlasTexture.destroy(), this.imageAtlas && (this.imageAtlas = null), this.glyphAtlasTexture && this.glyphAtlasTexture.destroy(), this.latestFeatureIndex = null, this.state = "unloaded"; }, Wl.prototype.getBucket = function (t) { return this.buckets[t.id] }, Wl.prototype.upload = function (t) { for (var e in this.buckets) { var r = this.buckets[e]; r.uploadPending() && r.upload(t); } var n = t.gl; this.imageAtlas && !this.imageAtlas.uploaded && (this.imageAtlasTexture = new Il(t, this.imageAtlas.image, n.RGBA), this.imageAtlas.uploaded = !0), this.glyphAtlasImage && (this.glyphAtlasTexture = new Il(t, this.glyphAtlasImage, n.ALPHA), this.glyphAtlasImage = null); }, Wl.prototype.prepare = function (t) { this.imageAtlas && this.imageAtlas.patchUpdatedImages(t, this.imageAtlasTexture); }, Wl.prototype.queryRenderedFeatures = function (t, e, r, n, i, a, o, s, u) { return this.latestFeatureIndex && this.latestFeatureIndex.rawTileData ? this.latestFeatureIndex.query({ queryGeometry: r, cameraQueryGeometry: n, scale: i, tileSize: this.tileSize, pixelPosMatrix: u, transform: o, params: a, queryPadding: this.queryPadding * s }, t, e) : {} }, Wl.prototype.querySourceFeatures = function (t, e) { if (this.latestFeatureIndex && this.latestFeatureIndex.rawTileData) { var r = this.latestFeatureIndex.loadVTLayers(), n = e ? e.sourceLayer : "", i = r._geojsonTileLayer || r[n]; if (i) for (var a = Xr(e && e.filter), o = this.tileID.canonical, s = o.z, u = o.x, l = o.y, p = { z: s, x: u, y: l }, c = 0; c < i.length; c++) { var h = i.feature(c); if (a(new Hn(this.tileID.overscaledZ), h)) { var f = new Zl(h, s, u, l); f.tile = p, t.push(f); } } } }, Wl.prototype.clearMask = function () { this.segments && (this.segments.destroy(), delete this.segments), this.maskedBoundsBuffer && (this.maskedBoundsBuffer.destroy(), delete this.maskedBoundsBuffer), this.maskedIndexBuffer && (this.maskedIndexBuffer.destroy(), delete this.maskedIndexBuffer), delete this.mask; }, Wl.prototype.setMask = function (t, e) { if (!o(this.mask, t) && (this.clearMask(), this.mask = t, !o(t, { 0: !0 }))) { var r = new vi, n = new Ei; this.segments = new Yi, this.segments.prepareSegment(0, r, n); for (var a = Object.keys(t), s = 0; s < a.length; s++) { var u = t[+a[s]], l = xa >> u.z, p = new i(u.x * l, u.y * l), c = new i(p.x + l, p.y + l), h = this.segments.prepareSegment(4, r, n); r.emplaceBack(p.x, p.y, p.x, p.y), r.emplaceBack(c.x, p.y, c.x, p.y), r.emplaceBack(p.x, c.y, p.x, c.y), r.emplaceBack(c.x, c.y, c.x, c.y); var f = h.vertexLength; n.emplaceBack(f, f + 1, f + 2), n.emplaceBack(f + 1, f + 2, f + 3), h.vertexLength += 4, h.primitiveLength += 2; } this.maskedBoundsBuffer = e.createVertexBuffer(r, Kl.members), this.maskedIndexBuffer = e.createIndexBuffer(n); } }, Wl.prototype.hasData = function () { return "loaded" === this.state || "reloading" === this.state || "expired" === this.state }, Wl.prototype.patternsLoaded = function () { return this.imageAtlas && !!Object.keys(this.imageAtlas.patternPositions).length }, Wl.prototype.setExpiryData = function (t) { var e = this.expirationTime; if (t.cacheControl) { var r = I(t.cacheControl); r["max-age"] && (this.expirationTime = Date.now() + 1e3 * r["max-age"]); } else t.expires && (this.expirationTime = new Date(t.expires).getTime()); if (this.expirationTime) { var n = Date.now(), i = !1; if (this.expirationTime > n) i = !1; else if (e) if (this.expirationTime < e) i = !0; else { var a = this.expirationTime - e; a ? this.expirationTime = n + Math.max(a, 3e4) : i = !0; } else i = !0; i ? (this.expiredRequestCount++ , this.state = "expired") : this.expiredRequestCount = 0; } }, Wl.prototype.getExpiryTimeout = function () { if (this.expirationTime) return this.expiredRequestCount ? 1e3 * (1 << Math.min(this.expiredRequestCount - 1, 31)) : Math.min(this.expirationTime - (new Date).getTime(), Math.pow(2, 31) - 1) }, Wl.prototype.setFeatureState = function (t, e) { if (this.latestFeatureIndex && this.latestFeatureIndex.rawTileData && 0 !== Object.keys(t).length) { var r = this.latestFeatureIndex.loadVTLayers(); for (var n in this.buckets) { var i = this.buckets[n], a = i.layers[0].sourceLayer || "_geojsonTileLayer", o = r[a], s = t[a]; o && s && 0 !== Object.keys(s).length && (i.update(s, o, this.imageAtlas && this.imageAtlas.patternPositions || {}), e && e.style && (this.queryPadding = Math.max(this.queryPadding, e.style.getLayer(n).queryRadius(i)))); } } }, Wl.prototype.holdingForFade = function () { return void 0 !== this.symbolFadeHoldUntil }, Wl.prototype.symbolFadeFinished = function () { return !this.symbolFadeHoldUntil || this.symbolFadeHoldUntil < O.now() }, Wl.prototype.clearFadeHold = function () { this.symbolFadeHoldUntil = void 0; }, Wl.prototype.setHoldDuration = function (t) { this.symbolFadeHoldUntil = O.now() + t; }, Wl.prototype.setDependencies = function (t, e) { for (var r = {}, n = 0, i = e; n < i.length; n += 1) { r[i[n]] = !0; } this.dependencies[t] = r; }, Wl.prototype.hasDependency = function (t, e) { for (var r = 0, n = t; r < n.length; r += 1) { var i = n[r], a = this.dependencies[i]; if (a) for (var o = 0, s = e; o < s.length; o += 1) { if (a[s[o]]) return !0 } } return !1 }; t.Actor = Cl, t.AlphaImage = $a, t.CanonicalTileID = Rl, t.CollisionBoxArray = Di, t.Color = Qt, t.DEMData = Nl, t.DataConstantProperty = ii, t.DictionaryCoder = Xl, t.EXTENT = xa, t.ErrorEvent = Ct, t.EvaluationParameters = Hn, t.Event = zt, t.Evented = Bt, t.FeatureIndex = Hl, t.FillBucket = jo, t.FillExtrusionBucket = is, t.ImageAtlas = iu, t.ImagePosition = ru, t.LineBucket = ds, t.LngLat = Pl, t.LngLatBounds = Tl, t.MercatorCoordinate = Dl, t.ONE_EM = Cs, t.OverscaledTileID = jl, t.Point = i, t.Point$1 = i, t.ProgramConfiguration = da, t.Properties = li, t.Protobuf = Ps, t.RGBAImage = Wa, t.RequestManager = K, t.ResourceType = dt, t.SegmentVector = Yi, t.SourceFeatureState = Jl, t.StructArrayLayout1ui2 = Vi, t.StructArrayLayout2i4 = mi, t.StructArrayLayout2ui4 = Mi, t.StructArrayLayout3ui6 = Ei, t.StructArrayLayout4i8 = vi, t.SymbolBucket = cl, t.Texture = Il, t.Tile = Wl, t.Transitionable = Wn, t.Uniform1f = ra, t.Uniform1i = ea, t.Uniform2f = na, t.Uniform3f = ia, t.Uniform4f = aa, t.UniformColor = oa, t.UniformMatrix4f = ua, t.UnwrappedTileID = Ul, t.ValidationError = Pt, t.WritingMode = au, t.ZoomHistory = Cn, t.addDynamicAttributes = sl, t.asyncAll = function (t, e, r) { if (!t.length) return r(null, []); var n = t.length, i = new Array(t.length), a = null; t.forEach((function (t, o) { e(t, (function (t, e) { t && (a = t), i[o] = e, 0 == --n && r(a, i); })); })); }, t.bezier = s, t.bindAll = m, t.browser = O, t.cacheEntryPossiblyAdded = function (t) { ++yt > ut && (t.getActor().send("enforceCacheSizeLimit", st), yt = 0); }, t.clamp = l, t.clearTileCache = function (t) { var e = self.caches.delete(ot); t && e.catch(t).then((function () { return t() })); }, t.clone = function (t) { var e = new ja(16); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e }, t.clone$1 = b, t.config = D, t.create = function () { var t = new ja(16); return ja != Float32Array && (t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0), t[0] = 1, t[5] = 1, t[10] = 1, t[15] = 1, t }, t.create$1 = function () { var t = new ja(9); return ja != Float32Array && (t[1] = 0, t[2] = 0, t[3] = 0, t[5] = 0, t[6] = 0, t[7] = 0), t[0] = 1, t[4] = 1, t[8] = 1, t }, t.create$2 = function () { var t = new ja(4); return ja != Float32Array && (t[1] = 0, t[2] = 0), t[0] = 1, t[3] = 1, t }, t.createCommonjsModule = e, t.createExpression = Er, t.createLayout = yi, t.createStyleLayer = function (t) { return "custom" === t.type ? new bl(t) : new _l[t.type](t) }, t.deepEqual = o, t.ease = u, t.emitValidationErrors = vn, t.endsWith = v, t.enforceCacheSizeLimit = function (t) { pt(), Q && Q.then((function (e) { e.keys().then((function (r) { for (var n = 0; n < r.length - t; n++)e.delete(r[n]); })); })); }, t.evaluateSizeForFeature = Au, t.evaluateSizeForZoom = Su, t.evaluateVariableOffset = $u, t.evented = Xn, t.extend = c, t.featureFilter = Xr, t.filterObject = x, t.fromRotation = function (t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = r, t[2] = 0, t[3] = -r, t[4] = n, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t }, t.getAnchorAlignment = vu, t.getAnchorJustification = Wu, t.getArrayBuffer = bt, t.getImage = St, t.getJSON = function (t, e) { return xt(c(t, { type: "json" }), e) }, t.getRTLTextPluginStatus = Zn, t.getReferrer = vt, t.getVideo = function (t, e) { var r, n, i = self.document.createElement("video"); i.muted = !0, i.onloadstart = function () { e(null, i); }; for (var a = 0; a < t.length; a++) { var o = self.document.createElement("source"); r = t[a], n = void 0, (n = self.document.createElement("a")).href = r, (n.protocol !== self.document.location.protocol || n.host !== self.document.location.host) && (i.crossOrigin = "Anonymous"), o.src = t[a], i.appendChild(o); } return { cancel: function () { } } }, t.identity = function (t) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t }, t.invert = function (t, e) { var r = e[0], n = e[1], i = e[2], a = e[3], o = e[4], s = e[5], u = e[6], l = e[7], p = e[8], c = e[9], h = e[10], f = e[11], y = e[12], d = e[13], m = e[14], v = e[15], g = r * s - n * o, x = r * u - i * o, b = r * l - a * o, _ = n * u - i * s, w = n * l - a * s, A = i * l - a * u, S = p * d - c * y, k = p * m - h * y, I = p * v - f * y, z = c * m - h * d, C = c * v - f * d, B = h * v - f * m, T = g * B - x * C + b * z + _ * I - w * k + A * S; return T ? (T = 1 / T, t[0] = (s * B - u * C + l * z) * T, t[1] = (i * C - n * B - a * z) * T, t[2] = (d * A - m * w + v * _) * T, t[3] = (h * w - c * A - f * _) * T, t[4] = (u * I - o * B - l * k) * T, t[5] = (r * B - i * I + a * k) * T, t[6] = (m * b - y * A - v * x) * T, t[7] = (p * A - h * b + f * x) * T, t[8] = (o * C - s * I + l * S) * T, t[9] = (n * I - r * C - a * S) * T, t[10] = (y * w - d * b + v * g) * T, t[11] = (c * b - p * w - f * g) * T, t[12] = (s * k - o * z - u * S) * T, t[13] = (r * z - n * k + i * S) * T, t[14] = (d * x - y * _ - m * g) * T, t[15] = (p * _ - c * x + h * g) * T, t) : null }, t.isChar = Bn, t.isMapboxURL = X, t.keysDifference = function (t, e) { var r = []; for (var n in t) n in e || r.push(n); return r }, t.makeRequest = xt, t.mapObject = g, t.mercatorXfromLng = Vl, t.mercatorYfromLat = Fl, t.mercatorZfromAltitude = Ll, t.multiply = function (t, e, r) { var n = e[0], i = e[1], a = e[2], o = e[3], s = e[4], u = e[5], l = e[6], p = e[7], c = e[8], h = e[9], f = e[10], y = e[11], d = e[12], m = e[13], v = e[14], g = e[15], x = r[0], b = r[1], _ = r[2], w = r[3]; return t[0] = x * n + b * s + _ * c + w * d, t[1] = x * i + b * u + _ * h + w * m, t[2] = x * a + b * l + _ * f + w * v, t[3] = x * o + b * p + _ * y + w * g, x = r[4], b = r[5], _ = r[6], w = r[7], t[4] = x * n + b * s + _ * c + w * d, t[5] = x * i + b * u + _ * h + w * m, t[6] = x * a + b * l + _ * f + w * v, t[7] = x * o + b * p + _ * y + w * g, x = r[8], b = r[9], _ = r[10], w = r[11], t[8] = x * n + b * s + _ * c + w * d, t[9] = x * i + b * u + _ * h + w * m, t[10] = x * a + b * l + _ * f + w * v, t[11] = x * o + b * p + _ * y + w * g, x = r[12], b = r[13], _ = r[14], w = r[15], t[12] = x * n + b * s + _ * c + w * d, t[13] = x * i + b * u + _ * h + w * m, t[14] = x * a + b * l + _ * f + w * v, t[15] = x * o + b * p + _ * y + w * g, t }, t.mvt = ts, t.number = Ie, t.ortho = function (t, e, r, n, i, a, o) { var s = 1 / (e - r), u = 1 / (n - i), l = 1 / (a - o); return t[0] = -2 * s, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * u, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 2 * l, t[11] = 0, t[12] = (e + r) * s, t[13] = (i + n) * u, t[14] = (o + a) * l, t[15] = 1, t }, t.parseGlyphPBF = function (t) { return new Ps(t).readFields(Ys, []) }, t.pbf = Ps, t.performSymbolLayout = function (t, e, r, n, a, o) { t.createArrays(); var s = 512 * t.overscaling; t.tilePixelRatio = xa / s, t.compareText = {}, t.iconsNeedLinear = !1; var u = t.layers[0].layout, l = t.layers[0]._unevaluatedLayout._values, p = {}; if ("composite" === t.textSizeData.kind) { var c = t.textSizeData, h = c.minZoom, f = c.maxZoom; p.compositeTextSizes = [l["text-size"].possiblyEvaluate(new Hn(h)), l["text-size"].possiblyEvaluate(new Hn(f))]; } if ("composite" === t.iconSizeData.kind) { var y = t.iconSizeData, d = y.minZoom, m = y.maxZoom; p.compositeIconSizes = [l["icon-size"].possiblyEvaluate(new Hn(d)), l["icon-size"].possiblyEvaluate(new Hn(m))]; } p.layoutTextSize = l["text-size"].possiblyEvaluate(new Hn(t.zoom + 1)), p.layoutIconSize = l["icon-size"].possiblyEvaluate(new Hn(t.zoom + 1)), p.textMaxSize = l["text-size"].possiblyEvaluate(new Hn(18)); for (var v = u.get("text-line-height") * Cs, g = "map" === u.get("text-rotation-alignment") && "point" !== u.get("symbol-placement"), x = u.get("text-keep-upright"), b = u.get("text-size"), _ = function () { var o = S[A], s = u.get("text-font").evaluate(o, {}).join(","), l = b.evaluate(o, {}), c = p.layoutTextSize.evaluate(o, {}), h = p.layoutIconSize.evaluate(o, {}), f = { horizontal: {}, vertical: void 0 }, y = o.text, d = [0, 0]; if (y) { var m = y.toString(), _ = u.get("text-letter-spacing").evaluate(o, {}) * Cs, k = function (t) { for (var e = 0, r = t; e < r.length; e += 1) { if (!Pn(r[e].charCodeAt(0))) return !1 } return !0 }(m) ? _ : 0, I = u.get("text-anchor").evaluate(o, {}), z = u.get("text-variable-anchor"); if (!z) { var C = u.get("text-radial-offset").evaluate(o, {}); d = C ? $u(I, [C * Cs, Yu]) : u.get("text-offset").evaluate(o, {}).map((function (t) { return t * Cs })); } var B = g ? "center" : u.get("text-justify").evaluate(o, {}), T = u.get("symbol-placement"), P = "point" === T ? u.get("text-max-width").evaluate(o, {}) * Cs : 0, E = function () { t.allowVerticalPlacement && Tn(m) && (f.vertical = lu(y, e, r, a, s, P, v, I, "left", k, d, au.vertical, !0, T, c, l)); }; if (!g && z) { for (var M = "auto" === B ? z.map((function (t) { return Wu(t) })) : [B], V = !1, F = 0; F < M.length; F++) { var L = M[F]; if (!f.horizontal[L]) if (V) f.horizontal[L] = f.horizontal[0]; else { var O = lu(y, e, r, a, s, P, v, "center", L, k, d, au.horizontal, !1, T, c, l); O && (f.horizontal[L] = O, V = 1 === O.positionedLines.length); } } E(); } else { "auto" === B && (B = Wu(I)); var D = lu(y, e, r, a, s, P, v, I, B, k, d, au.horizontal, !1, T, c, l); D && (f.horizontal[B] = D), E(), Tn(m) && g && x && (f.vertical = lu(y, e, r, a, s, P, v, I, B, k, d, au.vertical, !1, T, c, l)); } } var R = void 0, U = !1; if (o.icon && o.icon.name) { var j = n[o.icon.name]; j && (R = function (t, e, r) { var n = vu(r), i = n.horizontalAlign, a = n.verticalAlign, o = e[0], s = e[1], u = o - t.displaySize[0] * i, l = u + t.displaySize[0], p = s - t.displaySize[1] * a; return { image: t, top: p, bottom: p + t.displaySize[1], left: u, right: l } }(a[o.icon.name], u.get("icon-offset").evaluate(o, {}), u.get("icon-anchor").evaluate(o, {})), U = j.sdf, void 0 === t.sdfIcons ? t.sdfIcons = j.sdf : t.sdfIcons !== j.sdf && w("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"), j.pixelRatio !== t.pixelRatio ? t.iconsNeedLinear = !0 : 0 !== u.get("icon-rotate").constantOr(1) && (t.iconsNeedLinear = !0)); } var q = rl(f.horizontal) || f.vertical; t.iconsInText = !!q && q.iconsInText, (q || R) && function (t, e, r, n, a, o, s, u, l, p) { var c = o.textMaxSize.evaluate(e, {}); void 0 === c && (c = s); var h, f = t.layers[0].layout, y = f.get("icon-offset").evaluate(e, {}), d = rl(r.horizontal), m = s / 24, v = t.tilePixelRatio * m, g = t.tilePixelRatio * c / 24, x = t.tilePixelRatio * u, b = t.tilePixelRatio * f.get("symbol-spacing"), _ = f.get("text-padding") * t.tilePixelRatio, A = f.get("icon-padding") * t.tilePixelRatio, S = f.get("text-max-angle") / 180 * Math.PI, k = "map" === f.get("text-rotation-alignment") && "point" !== f.get("symbol-placement"), I = "map" === f.get("icon-rotation-alignment") && "point" !== f.get("symbol-placement"), z = f.get("symbol-placement"), C = b / 2, B = f.get("icon-text-fit"); n && "none" !== B && (t.allowVerticalPlacement && r.vertical && (h = xu(n, r.vertical, B, f.get("icon-text-fit-padding"), y, m)), d && (n = xu(n, d, B, f.get("icon-text-fit-padding"), y, m))); var T = function (i, s) { s.x < 0 || s.x >= xa || s.y < 0 || s.y >= xa || function (t, e, r, n, i, a, o, s, u, l, p, c, h, f, y, d, m, v, g, x, b, _, A) { var S, k, I, z, C, B = t.addToLineVertexArray(e, r), T = 0, P = 0, E = 0, M = 0, V = -1, F = -1, L = {}, O = Zu(""), D = 0, R = 0; void 0 === s._unevaluatedLayout.getValue("text-radial-offset") ? (S = s.layout.get("text-offset").evaluate(b, {}).map((function (t) { return t * Cs })), D = S[0], R = S[1]) : (D = s.layout.get("text-radial-offset").evaluate(b, {}) * Cs, R = Yu); if (t.allowVerticalPlacement && n.vertical) { var U = s.layout.get("text-rotate").evaluate(b, {}) + 90, j = n.vertical; z = new Du(u, r, e, l, p, c, j, h, f, y, t.overscaling, U), o && (C = new Du(u, r, e, l, p, c, o, m, v, y, t.overscaling, U)); } if (i) { var q = s.layout.get("icon-rotate").evaluate(b, {}), N = "none" !== s.layout.get("icon-text-fit"), K = Mu(i, q, A, N), X = o ? Mu(o, q, A, N) : void 0; I = new Du(u, r, e, l, p, c, i, m, v, !1, t.overscaling, q), T = 4 * K.length; var Z = t.iconSizeData, G = null; "source" === Z.kind ? (G = [_u * s.layout.get("icon-size").evaluate(b, {})])[0] > tl && w(t.layerIds[0] + ': Value for "icon-size" is >= ' + Qu + '. Reduce your "icon-size".') : "composite" === Z.kind && ((G = [_u * _.compositeIconSizes[0].evaluate(b, {}), _u * _.compositeIconSizes[1].evaluate(b, {})])[0] > tl || G[1] > tl) && w(t.layerIds[0] + ': Value for "icon-size" is >= ' + Qu + '. Reduce your "icon-size".'), t.addSymbols(t.icon, K, G, x, g, b, !1, e, B.lineStartIndex, B.lineLength, -1), V = t.icon.placedSymbolArray.length - 1, X && (P = 4 * X.length, t.addSymbols(t.icon, X, G, x, g, b, au.vertical, e, B.lineStartIndex, B.lineLength, -1), F = t.icon.placedSymbolArray.length - 1); } for (var J in n.horizontal) { var H = n.horizontal[J]; if (!k) { O = Zu(H.text); var Y = s.layout.get("text-rotate").evaluate(b, {}); k = new Du(u, r, e, l, p, c, H, h, f, y, t.overscaling, Y); } var $ = 1 === H.positionedLines.length; if (E += el(t, e, H, a, s, y, b, d, B, n.vertical ? au.horizontal : au.horizontalOnly, $ ? Object.keys(n.horizontal) : [J], L, V, _), $) break } n.vertical && (M += el(t, e, n.vertical, a, s, y, b, d, B, au.vertical, ["vertical"], L, F, _)); var W = k ? k.boxStartIndex : t.collisionBoxArray.length, Q = k ? k.boxEndIndex : t.collisionBoxArray.length, tt = z ? z.boxStartIndex : t.collisionBoxArray.length, et = z ? z.boxEndIndex : t.collisionBoxArray.length, rt = I ? I.boxStartIndex : t.collisionBoxArray.length, nt = I ? I.boxEndIndex : t.collisionBoxArray.length, it = C ? C.boxStartIndex : t.collisionBoxArray.length, at = C ? C.boxEndIndex : t.collisionBoxArray.length; t.glyphOffsetArray.length >= cl.MAX_GLYPHS && w("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"); t.symbolInstances.emplaceBack(e.x, e.y, L.right >= 0 ? L.right : -1, L.center >= 0 ? L.center : -1, L.left >= 0 ? L.left : -1, L.vertical || -1, V, F, O, W, Q, tt, et, rt, nt, it, at, l, E, M, T, P, 0, h, D, R); }(t, s, i, r, n, a, h, t.layers[0], t.collisionBoxArray, e.index, e.sourceLayerIndex, t.index, v, _, k, l, x, A, I, y, e, o, p); }; if ("line" === z) for (var P = 0, E = function (t, e, r, n, a) { for (var o = [], s = 0; s < t.length; s++)for (var u = t[s], l = void 0, p = 0; p < u.length - 1; p++) { var c = u[p], h = u[p + 1]; c.x < e && h.x < e || (c.x < e ? c = new i(e, c.y + (h.y - c.y) * ((e - c.x) / (h.x - c.x)))._round() : h.x < e && (h = new i(e, c.y + (h.y - c.y) * ((e - c.x) / (h.x - c.x)))._round()), c.y < r && h.y < r || (c.y < r ? c = new i(c.x + (h.x - c.x) * ((r - c.y) / (h.y - c.y)), r)._round() : h.y < r && (h = new i(c.x + (h.x - c.x) * ((r - c.y) / (h.y - c.y)), r)._round()), c.x >= n && h.x >= n || (c.x >= n ? c = new i(n, c.y + (h.y - c.y) * ((n - c.x) / (h.x - c.x)))._round() : h.x >= n && (h = new i(n, c.y + (h.y - c.y) * ((n - c.x) / (h.x - c.x)))._round()), c.y >= a && h.y >= a || (c.y >= a ? c = new i(c.x + (h.x - c.x) * ((a - c.y) / (h.y - c.y)), a)._round() : h.y >= a && (h = new i(c.x + (h.x - c.x) * ((a - c.y) / (h.y - c.y)), a)._round()), l && c.equals(l[l.length - 1]) || (l = [c], o.push(l)), l.push(h))))); } return o }(e.geometry, 0, 0, xa, xa); P < E.length; P += 1)for (var M = E[P], V = Pu(M, b, S, r.vertical || d, n, 24, g, t.overscaling, xa), F = 0, L = V; F < L.length; F += 1) { var O = L[F], D = d; D && nl(t, D.text, C, O) || T(M, O); } else if ("line-center" === z) for (var R = 0, U = e.geometry; R < U.length; R += 1) { var j = U[R]; if (j.length > 1) { var q = Tu(j, S, r.vertical || d, n, 24, g); q && T(j, q); } } else if ("Polygon" === e.type) for (var N = 0, K = Oo(e.geometry, 0); N < K.length; N += 1) { var X = K[N], Z = ju(X, 16); T(X[0], new bu(Z.x, Z.y, 0)); } else if ("LineString" === e.type) for (var G = 0, J = e.geometry; G < J.length; G += 1) { var H = J[G]; T(H, new bu(H[0].x, H[0].y, 0)); } else if ("Point" === e.type) for (var Y = 0, $ = e.geometry; Y < $.length; Y += 1)for (var W = $[Y], Q = 0, tt = W; Q < tt.length; Q += 1) { var et = tt[Q]; T([et], new bu(et.x, et.y, 0)); } }(t, o, f, R, n, p, c, h, d, U); }, A = 0, S = t.features; A < S.length; A += 1)_(); o && t.generateCollisionDebugBuffers(); }, t.perspective = function (t, e, r, n, i) { var a, o = 1 / Math.tan(e / 2); return t[0] = o / r, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = o, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[11] = -1, t[12] = 0, t[13] = 0, t[15] = 0, null != i && i !== 1 / 0 ? (a = 1 / (n - i), t[10] = (i + n) * a, t[14] = 2 * i * n * a) : (t[10] = -1, t[14] = -2 * n), t }, t.pick = function (t, e) { for (var r = {}, n = 0; n < e.length; n++) { var i = e[n]; i in t && (r[i] = t[i]); } return r }, t.plugin = Jn, t.polygonIntersectsPolygon = ka, t.postMapLoadEvent = at, t.postTurnstileEvent = nt, t.potpack = tu, t.rasterBoundsAttributes = Kl, t.refProperties = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"], t.register = An, t.registerForPluginStateChange = function (t) { return t({ pluginStatus: jn, pluginURL: qn }), Xn.on("pluginStateChange", t), t }, t.rotate = function (t, e, r) { var n = e[0], i = e[1], a = e[2], o = e[3], s = Math.sin(r), u = Math.cos(r); return t[0] = n * u + a * s, t[1] = i * u + o * s, t[2] = n * -s + a * u, t[3] = i * -s + o * u, t }, t.rotateX = function (t, e, r) { var n = Math.sin(r), i = Math.cos(r), a = e[4], o = e[5], s = e[6], u = e[7], l = e[8], p = e[9], c = e[10], h = e[11]; return e !== t && (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[4] = a * i + l * n, t[5] = o * i + p * n, t[6] = s * i + c * n, t[7] = u * i + h * n, t[8] = l * i - a * n, t[9] = p * i - o * n, t[10] = c * i - s * n, t[11] = h * i - u * n, t }, t.rotateZ = function (t, e, r) { var n = Math.sin(r), i = Math.cos(r), a = e[0], o = e[1], s = e[2], u = e[3], l = e[4], p = e[5], c = e[6], h = e[7]; return e !== t && (t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = a * i + l * n, t[1] = o * i + p * n, t[2] = s * i + c * n, t[3] = u * i + h * n, t[4] = l * i - a * n, t[5] = p * i - o * n, t[6] = c * i - s * n, t[7] = h * i - u * n, t }, t.scale = function (t, e, r) { var n = r[0], i = r[1], a = r[2]; return t[0] = e[0] * n, t[1] = e[1] * n, t[2] = e[2] * n, t[3] = e[3] * n, t[4] = e[4] * i, t[5] = e[5] * i, t[6] = e[6] * i, t[7] = e[7] * i, t[8] = e[8] * a, t[9] = e[9] * a, t[10] = e[10] * a, t[11] = e[11] * a, t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], t }, t.setCacheLimits = function (t, e) { st = t, ut = e; }, t.setRTLTextPlugin = function (t, e, r) { if (void 0 === r && (r = !1), jn === On || jn === Dn || jn === Rn) throw new Error("setRTLTextPlugin cannot be called multiple times."); qn = O.resolveURL(t), jn = On, Un = e, Kn(), r || Gn(); }, t.sphericalToCartesian = function (t) { var e = t[0], r = t[1], n = t[2]; return r += 90, r *= Math.PI / 180, n *= Math.PI / 180, { x: e * Math.cos(r) * Math.sin(n), y: e * Math.sin(r) * Math.sin(n), z: e * Math.cos(n) } }, t.styleSpec = Tt, t.symbolSize = ku, t.transformMat3 = function (t, e, r) { var n = e[0], i = e[1], a = e[2]; return t[0] = n * r[0] + i * r[3] + a * r[6], t[1] = n * r[1] + i * r[4] + a * r[7], t[2] = n * r[2] + i * r[5] + a * r[8], t }, t.transformMat4 = Ka, t.translate = function (t, e, r) { var n, i, a, o, s, u, l, p, c, h, f, y, d = r[0], m = r[1], v = r[2]; return e === t ? (t[12] = e[0] * d + e[4] * m + e[8] * v + e[12], t[13] = e[1] * d + e[5] * m + e[9] * v + e[13], t[14] = e[2] * d + e[6] * m + e[10] * v + e[14], t[15] = e[3] * d + e[7] * m + e[11] * v + e[15]) : (n = e[0], i = e[1], a = e[2], o = e[3], s = e[4], u = e[5], l = e[6], p = e[7], c = e[8], h = e[9], f = e[10], y = e[11], t[0] = n, t[1] = i, t[2] = a, t[3] = o, t[4] = s, t[5] = u, t[6] = l, t[7] = p, t[8] = c, t[9] = h, t[10] = f, t[11] = y, t[12] = n * d + s * m + c * v + e[12], t[13] = i * d + u * m + h * v + e[13], t[14] = a * d + l * m + f * v + e[14], t[15] = o * d + p * m + y * v + e[15]), t }, t.triggerPluginCompletionEvent = Nn, t.uniqueId = f, t.validateCustomStyleLayer = function (t) { var e = [], r = t.id; return void 0 === r && e.push({ message: "layers." + r + ': missing required property "id"' }), void 0 === t.render && e.push({ message: "layers." + r + ': missing required method "render"' }), t.renderingMode && "2d" !== t.renderingMode && "3d" !== t.renderingMode && e.push({ message: "layers." + r + ': property "renderingMode" must be either "2d" or "3d"' }), e }, t.validateLight = yn, t.validateStyle = fn, t.values = function (t) { var e = []; for (var r in t) e.push(t[r]); return e }, t.vectorTile = ts, t.version = "1.6.1", t.warnOnce = w, t.webpSupported = R, t.window = self, t.wrap = p; })); define(["./shared"], (function (e) { "use strict"; function t(e) { var r = typeof e; if ("number" === r || "boolean" === r || "string" === r || null == e) return JSON.stringify(e); if (Array.isArray(e)) { for (var i = "[", o = 0, n = e; o < n.length; o += 1) { i += t(n[o]) + ","; } return i + "]" } for (var a = Object.keys(e).sort(), s = "{", l = 0; l < a.length; l++)s += JSON.stringify(a[l]) + ":" + t(e[a[l]]) + ","; return s + "}" } function r(r) { for (var i = "", o = 0, n = e.refProperties; o < n.length; o += 1) { i += "/" + t(r[n[o]]); } return i } var i = function (e) { this.keyCache = {}, e && this.replace(e); }; i.prototype.replace = function (e) { this._layerConfigs = {}, this._layers = {}, this.update(e, []); }, i.prototype.update = function (t, i) { for (var o = this, n = 0, a = t; n < a.length; n += 1) { var s = a[n]; this._layerConfigs[s.id] = s; var l = this._layers[s.id] = e.createStyleLayer(s); l._featureFilter = e.featureFilter(l.filter), this.keyCache[s.id] && delete this.keyCache[s.id]; } for (var u = 0, h = i; u < h.length; u += 1) { var c = h[u]; delete this.keyCache[c], delete this._layerConfigs[c], delete this._layers[c]; } this.familiesBySource = {}; for (var p = 0, f = function (e, t) { for (var i = {}, o = 0; o < e.length; o++) { var n = t && t[e[o].id] || r(e[o]); t && (t[e[o].id] = n); var a = i[n]; a || (a = i[n] = []), a.push(e[o]); } var s = []; for (var l in i) s.push(i[l]); return s }(e.values(this._layerConfigs), this.keyCache); p < f.length; p += 1) { var d = f[p].map((function (e) { return o._layers[e.id] })), g = d[0]; if ("none" !== g.visibility) { var m = g.source || "", v = this.familiesBySource[m]; v || (v = this.familiesBySource[m] = {}); var y = g.sourceLayer || "_geojsonTileLayer", x = v[y]; x || (x = v[y] = []), x.push(d); } } }; var o = function (t) { var r = {}, i = []; for (var o in t) { var n = t[o], a = r[o] = {}; for (var s in n) { var l = n[+s]; if (l && 0 !== l.bitmap.width && 0 !== l.bitmap.height) { var u = { x: 0, y: 0, w: l.bitmap.width + 2, h: l.bitmap.height + 2 }; i.push(u), a[s] = { rect: u, metrics: l.metrics }; } } } var h = e.potpack(i), c = h.w, p = h.h, f = new e.AlphaImage({ width: c || 1, height: p || 1 }); for (var d in t) { var g = t[d]; for (var m in g) { var v = g[+m]; if (v && 0 !== v.bitmap.width && 0 !== v.bitmap.height) { var y = r[d][m].rect; e.AlphaImage.copy(v.bitmap, f, { x: 0, y: 0 }, { x: y.x + 1, y: y.y + 1 }, v.bitmap); } } } this.image = f, this.positions = r; }; e.register("GlyphAtlas", o); var n = function (t) { this.tileID = new e.OverscaledTileID(t.tileID.overscaledZ, t.tileID.wrap, t.tileID.canonical.z, t.tileID.canonical.x, t.tileID.canonical.y), this.uid = t.uid, this.zoom = t.zoom, this.pixelRatio = t.pixelRatio, this.tileSize = t.tileSize, this.source = t.source, this.overscaling = this.tileID.overscaleFactor(), this.showCollisionBoxes = t.showCollisionBoxes, this.collectResourceTiming = !!t.collectResourceTiming, this.returnDependencies = !!t.returnDependencies; }; function a(t, r, i) { for (var o = new e.EvaluationParameters(r), n = 0, a = t; n < a.length; n += 1) { a[n].recalculate(o, i); } } n.prototype.parse = function (t, r, i, n, s) { var l = this; this.status = "parsing", this.data = t, this.collisionBoxArray = new e.CollisionBoxArray; var u = new e.DictionaryCoder(Object.keys(t.layers).sort()), h = new e.FeatureIndex(this.tileID); h.bucketLayerIDs = []; var c, p, f, d, g = {}, m = { featureIndex: h, iconDependencies: {}, patternDependencies: {}, glyphDependencies: {}, availableImages: i }, v = r.familiesBySource[this.source]; for (var y in v) { var x = t.layers[y]; if (x) { 1 === x.version && e.warnOnce('Vector tile source "' + this.source + '" layer "' + y + '" does not use vector tile spec v2 and therefore may have some rendering errors.'); for (var w = u.encode(y), S = [], M = 0; M < x.length; M++) { var b = x.feature(M); S.push({ feature: b, index: M, sourceLayerIndex: w }); } for (var k = 0, I = v[y]; k < I.length; k += 1) { var _ = I[k], P = _[0]; if (!(P.minzoom && this.zoom < Math.floor(P.minzoom))) if (!(P.maxzoom && this.zoom >= P.maxzoom)) if ("none" !== P.visibility) a(_, this.zoom, i), (g[P.id] = P.createBucket({ index: h.bucketLayerIDs.length, layers: _, zoom: this.zoom, pixelRatio: this.pixelRatio, overscaling: this.overscaling, collisionBoxArray: this.collisionBoxArray, sourceLayerIndex: w, sourceID: this.source })).populate(S, m), h.bucketLayerIDs.push(_.map((function (e) { return e.id }))); } } } var T = e.mapObject(m.glyphDependencies, (function (e) { return Object.keys(e).map(Number) })); Object.keys(T).length ? n.send("getGlyphs", { uid: this.uid, stacks: T }, (function (e, t) { c || (c = e, p = t, C.call(l)); })) : p = {}; var L = Object.keys(m.iconDependencies); L.length ? n.send("getImages", { icons: L, source: this.source, tileID: this.tileID, type: "icons" }, (function (e, t) { c || (c = e, f = t, C.call(l)); })) : f = {}; var D = Object.keys(m.patternDependencies); function C() { if (c) return s(c); if (p && f && d) { var t = new o(p), r = new e.ImageAtlas(f, d); for (var n in g) { var l = g[n]; l instanceof e.SymbolBucket ? (a(l.layers, this.zoom, i), e.performSymbolLayout(l, p, t.positions, f, r.iconPositions, this.showCollisionBoxes)) : l.hasPattern && (l instanceof e.LineBucket || l instanceof e.FillBucket || l instanceof e.FillExtrusionBucket) && (a(l.layers, this.zoom, i), l.addFeatures(m, r.patternPositions)); } this.status = "done", s(null, { buckets: e.values(g).filter((function (e) { return !e.isEmpty() })), featureIndex: h, collisionBoxArray: this.collisionBoxArray, glyphAtlasImage: t.image, imageAtlas: r, glyphMap: this.returnDependencies ? p : null, iconMap: this.returnDependencies ? f : null, glyphPositions: this.returnDependencies ? t.positions : null }); } } D.length ? n.send("getImages", { icons: D, source: this.source, tileID: this.tileID, type: "patterns" }, (function (e, t) { c || (c = e, d = t, C.call(l)); })) : d = {}, C.call(this); }; var s = "undefined" != typeof performance, l = { getEntriesByName: function (e) { return !!(s && performance && performance.getEntriesByName) && performance.getEntriesByName(e) }, mark: function (e) { return !!(s && performance && performance.mark) && performance.mark(e) }, measure: function (e, t, r) { return !!(s && performance && performance.measure) && performance.measure(e, t, r) }, clearMarks: function (e) { return !!(s && performance && performance.clearMarks) && performance.clearMarks(e) }, clearMeasures: function (e) { return !!(s && performance && performance.clearMeasures) && performance.clearMeasures(e) } }, u = function (e) { this._marks = { start: [e.url, "start"].join("#"), end: [e.url, "end"].join("#"), measure: e.url.toString() }, l.mark(this._marks.start); }; function h(t, r) { var i = e.getArrayBuffer(t.request, (function (t, i, o, n) { t ? r(t) : i && r(null, { vectorTile: new e.vectorTile.VectorTile(new e.pbf(i)), rawData: i, cacheControl: o, expires: n }); })); return function () { i.cancel(), r(); } } u.prototype.finish = function () { l.mark(this._marks.end); var e = l.getEntriesByName(this._marks.measure); return 0 === e.length && (l.measure(this._marks.measure, this._marks.start, this._marks.end), e = l.getEntriesByName(this._marks.measure), l.clearMarks(this._marks.start), l.clearMarks(this._marks.end), l.clearMeasures(this._marks.measure)), e }, l.Performance = u; var c = function (e, t, r, i) { this.actor = e, this.layerIndex = t, this.availableImages = r, this.loadVectorData = i || h, this.loading = {}, this.loaded = {}; }; c.prototype.loadTile = function (t, r) { var i = this, o = t.uid; this.loading || (this.loading = {}); var a = !!(t && t.request && t.request.collectResourceTiming) && new l.Performance(t.request), s = this.loading[o] = new n(t); s.abort = this.loadVectorData(t, (function (t, n) { if (delete i.loading[o], t || !n) return s.status = "done", i.loaded[o] = s, r(t); var l = n.rawData, u = {}; n.expires && (u.expires = n.expires), n.cacheControl && (u.cacheControl = n.cacheControl); var h = {}; if (a) { var c = a.finish(); c && (h.resourceTiming = JSON.parse(JSON.stringify(c))); } s.vectorTile = n.vectorTile, s.parse(n.vectorTile, i.layerIndex, i.availableImages, i.actor, (function (t, i) { if (t || !i) return r(t); r(null, e.extend({ rawTileData: l.slice(0) }, i, u, h)); })), i.loaded = i.loaded || {}, i.loaded[o] = s; })); }, c.prototype.reloadTile = function (e, t) { var r = this, i = this.loaded, o = e.uid, n = this; if (i && i[o]) { var a = i[o]; a.showCollisionBoxes = e.showCollisionBoxes; var s = function (e, i) { var o = a.reloadCallback; o && (delete a.reloadCallback, a.parse(a.vectorTile, n.layerIndex, r.availableImages, n.actor, o)), t(e, i); }; "parsing" === a.status ? a.reloadCallback = s : "done" === a.status && (a.vectorTile ? a.parse(a.vectorTile, this.layerIndex, this.availableImages, this.actor, s) : s()); } }, c.prototype.abortTile = function (e, t) { var r = this.loading, i = e.uid; r && r[i] && r[i].abort && (r[i].abort(), delete r[i]), t(); }, c.prototype.removeTile = function (e, t) { var r = this.loaded, i = e.uid; r && r[i] && delete r[i], t(); }; var p = function () { this.loaded = {}; }; p.prototype.loadTile = function (t, r) { var i = t.uid, o = t.encoding, n = t.rawImageData, a = new e.DEMData(i, n, o); this.loaded = this.loaded || {}, this.loaded[i] = a, r(null, a); }, p.prototype.removeTile = function (e) { var t = this.loaded, r = e.uid; t && t[r] && delete t[r]; }; var f = { RADIUS: 6378137, FLATTENING: 1 / 298.257223563, POLAR_RADIUS: 6356752.3142 }; function d(e) { var t = 0; if (e && e.length > 0) { t += Math.abs(g(e[0])); for (var r = 1; r < e.length; r++)t -= Math.abs(g(e[r])); } return t } function g(e) { var t, r, i, o, n, a, s = 0, l = e.length; if (l > 2) { for (a = 0; a < l; a++)a === l - 2 ? (i = l - 2, o = l - 1, n = 0) : a === l - 1 ? (i = l - 1, o = 0, n = 1) : (i = a, o = a + 1, n = a + 2), t = e[i], r = e[o], s += (m(e[n][0]) - m(t[0])) * Math.sin(m(r[1])); s = s * f.RADIUS * f.RADIUS / 2; } return s } function m(e) { return e * Math.PI / 180 } var v = { geometry: function e(t) { var r, i = 0; switch (t.type) { case "Polygon": return d(t.coordinates); case "MultiPolygon": for (r = 0; r < t.coordinates.length; r++)i += d(t.coordinates[r]); return i; case "Point": case "MultiPoint": case "LineString": case "MultiLineString": return 0; case "GeometryCollection": for (r = 0; r < t.geometries.length; r++)i += e(t.geometries[r]); return i } }, ring: g }, y = function e(t, r) { switch (t && t.type || null) { case "FeatureCollection": return t.features = t.features.map(x(e, r)), t; case "GeometryCollection": return t.geometries = t.geometries.map(x(e, r)), t; case "Feature": return t.geometry = e(t.geometry, r), t; case "Polygon": case "MultiPolygon": return function (e, t) { "Polygon" === e.type ? e.coordinates = w(e.coordinates, t) : "MultiPolygon" === e.type && (e.coordinates = e.coordinates.map(x(w, t))); return e }(t, r); default: return t } }; function x(e, t) { return function (r) { return e(r, t) } } function w(e, t) { t = !!t, e[0] = S(e[0], t); for (var r = 1; r < e.length; r++)e[r] = S(e[r], !t); return e } function S(e, t) { return function (e) { return v.ring(e) >= 0 }(e) === t ? e : e.reverse() } var M = e.vectorTile.VectorTileFeature.prototype.toGeoJSON, b = function (t) { this._feature = t, this.extent = e.EXTENT, this.type = t.type, this.properties = t.tags, "id" in t && !isNaN(t.id) && (this.id = parseInt(t.id, 10)); }; b.prototype.loadGeometry = function () { if (1 === this._feature.type) { for (var t = [], r = 0, i = this._feature.geometry; r < i.length; r += 1) { var o = i[r]; t.push([new e.Point$1(o[0], o[1])]); } return t } for (var n = [], a = 0, s = this._feature.geometry; a < s.length; a += 1) { for (var l = [], u = 0, h = s[a]; u < h.length; u += 1) { var c = h[u]; l.push(new e.Point$1(c[0], c[1])); } n.push(l); } return n }, b.prototype.toGeoJSON = function (e, t, r) { return M.call(this, e, t, r) }; var k = function (t) { this.layers = { _geojsonTileLayer: this }, this.name = "_geojsonTileLayer", this.extent = e.EXTENT, this.length = t.length, this._features = t; }; k.prototype.feature = function (e) { return new b(this._features[e]) }; var I = e.vectorTile.VectorTileFeature, _ = P; function P(e, t) { this.options = t || {}, this.features = e, this.length = e.length; } function T(e, t) { this.id = "number" == typeof e.id ? e.id : void 0, this.type = e.type, this.rawGeometry = 1 === e.type ? [e.geometry] : e.geometry, this.properties = e.tags, this.extent = t || 4096; } P.prototype.feature = function (e) { return new T(this.features[e], this.options.extent) }, T.prototype.loadGeometry = function () { var t = this.rawGeometry; this.geometry = []; for (var r = 0; r < t.length; r++) { for (var i = t[r], o = [], n = 0; n < i.length; n++)o.push(new e.Point$1(i[n][0], i[n][1])); this.geometry.push(o); } return this.geometry }, T.prototype.bbox = function () { this.geometry || this.loadGeometry(); for (var e = this.geometry, t = 1 / 0, r = -1 / 0, i = 1 / 0, o = -1 / 0, n = 0; n < e.length; n++)for (var a = e[n], s = 0; s < a.length; s++) { var l = a[s]; t = Math.min(t, l.x), r = Math.max(r, l.x), i = Math.min(i, l.y), o = Math.max(o, l.y); } return [t, i, r, o] }, T.prototype.toGeoJSON = I.prototype.toGeoJSON; var L = z, D = z, C = function (e, t) { t = t || {}; var r = {}; for (var i in e) r[i] = new _(e[i].features, t), r[i].name = i, r[i].version = t.version, r[i].extent = t.extent; return z({ layers: r }) }, O = _; function z(t) { var r = new e.pbf; return function (e, t) { for (var r in e.layers) t.writeMessage(3, E, e.layers[r]); }(t, r), r.finish() } function E(e, t) { var r; t.writeVarintField(15, e.version || 1), t.writeStringField(1, e.name || ""), t.writeVarintField(5, e.extent || 4096); var i = { keys: [], values: [], keycache: {}, valuecache: {} }; for (r = 0; r < e.length; r++)i.feature = e.feature(r), t.writeMessage(2, N, i); var o = i.keys; for (r = 0; r < o.length; r++)t.writeStringField(3, o[r]); var n = i.values; for (r = 0; r < n.length; r++)t.writeMessage(4, Z, n[r]); } function N(e, t) { var r = e.feature; void 0 !== r.id && t.writeVarintField(1, r.id), t.writeMessage(2, F, e), t.writeVarintField(3, r.type), t.writeMessage(4, J, r); } function F(e, t) { var r = e.feature, i = e.keys, o = e.values, n = e.keycache, a = e.valuecache; for (var s in r.properties) { var l = n[s]; void 0 === l && (i.push(s), l = i.length - 1, n[s] = l), t.writeVarint(l); var u = r.properties[s], h = typeof u; "string" !== h && "boolean" !== h && "number" !== h && (u = JSON.stringify(u)); var c = h + ":" + u, p = a[c]; void 0 === p && (o.push(u), p = o.length - 1, a[c] = p), t.writeVarint(p); } } function A(e, t) { return (t << 3) + (7 & e) } function B(e) { return e << 1 ^ e >> 31 } function J(e, t) { for (var r = e.loadGeometry(), i = e.type, o = 0, n = 0, a = r.length, s = 0; s < a; s++) { var l = r[s], u = 1; 1 === i && (u = l.length), t.writeVarint(A(1, u)); for (var h = 3 === i ? l.length - 1 : l.length, c = 0; c < h; c++) { 1 === c && 1 !== i && t.writeVarint(A(2, h - 1)); var p = l[c].x - o, f = l[c].y - n; t.writeVarint(B(p)), t.writeVarint(B(f)), o += p, n += f; } 3 === i && t.writeVarint(A(7, 1)); } } function Z(e, t) { var r = typeof e; "string" === r ? t.writeStringField(1, e) : "boolean" === r ? t.writeBooleanField(7, e) : "number" === r && (e % 1 != 0 ? t.writeDoubleField(3, e) : e < 0 ? t.writeSVarintField(6, e) : t.writeVarintField(5, e)); } function G(e, t, r, i, o, n) { if (!(o - i <= r)) { var a = i + o >> 1; !function e(t, r, i, o, n, a) { for (; n > o;) { if (n - o > 600) { var s = n - o + 1, l = i - o + 1, u = Math.log(s), h = .5 * Math.exp(2 * u / 3), c = .5 * Math.sqrt(u * h * (s - h) / s) * (l - s / 2 < 0 ? -1 : 1), p = Math.max(o, Math.floor(i - l * h / s + c)), f = Math.min(n, Math.floor(i + (s - l) * h / s + c)); e(t, r, i, p, f, a); } var d = r[2 * i + a], g = o, m = n; for (j(t, r, o, i), r[2 * n + a] > d && j(t, r, o, n); g < m;) { for (j(t, r, g, m), g++ , m--; r[2 * g + a] < d;)g++; for (; r[2 * m + a] > d;)m--; } r[2 * o + a] === d ? j(t, r, o, m) : j(t, r, ++m, n), m <= i && (o = m + 1), i <= m && (n = m - 1); } }(e, t, a, i, o, n % 2), G(e, t, r, i, a - 1, n + 1), G(e, t, r, a + 1, o, n + 1); } } function j(e, t, r, i) { Y(e, r, i), Y(t, 2 * r, 2 * i), Y(t, 2 * r + 1, 2 * i + 1); } function Y(e, t, r) { var i = e[t]; e[t] = e[r], e[r] = i; } function V(e, t, r, i) { var o = e - r, n = t - i; return o * o + n * n } L.fromVectorTileJs = D, L.fromGeojsonVt = C, L.GeoJSONWrapper = O; var X = function (e) { return e[0] }, W = function (e) { return e[1] }, R = function (e, t, r, i, o) { void 0 === t && (t = X), void 0 === r && (r = W), void 0 === i && (i = 64), void 0 === o && (o = Float64Array), this.nodeSize = i, this.points = e; for (var n = e.length < 65536 ? Uint16Array : Uint32Array, a = this.ids = new n(e.length), s = this.coords = new o(2 * e.length), l = 0; l < e.length; l++)a[l] = l, s[2 * l] = t(e[l]), s[2 * l + 1] = r(e[l]); G(a, s, i, 0, a.length - 1, 0); }; R.prototype.range = function (e, t, r, i) { return function (e, t, r, i, o, n, a) { for (var s, l, u = [0, e.length - 1, 0], h = []; u.length;) { var c = u.pop(), p = u.pop(), f = u.pop(); if (p - f <= a) for (var d = f; d <= p; d++)s = t[2 * d], l = t[2 * d + 1], s >= r && s <= o && l >= i && l <= n && h.push(e[d]); else { var g = Math.floor((f + p) / 2); s = t[2 * g], l = t[2 * g + 1], s >= r && s <= o && l >= i && l <= n && h.push(e[g]); var m = (c + 1) % 2; (0 === c ? r <= s : i <= l) && (u.push(f), u.push(g - 1), u.push(m)), (0 === c ? o >= s : n >= l) && (u.push(g + 1), u.push(p), u.push(m)); } } return h }(this.ids, this.coords, e, t, r, i, this.nodeSize) }, R.prototype.within = function (e, t, r) { return function (e, t, r, i, o, n) { for (var a = [0, e.length - 1, 0], s = [], l = o * o; a.length;) { var u = a.pop(), h = a.pop(), c = a.pop(); if (h - c <= n) for (var p = c; p <= h; p++)V(t[2 * p], t[2 * p + 1], r, i) <= l && s.push(e[p]); else { var f = Math.floor((c + h) / 2), d = t[2 * f], g = t[2 * f + 1]; V(d, g, r, i) <= l && s.push(e[f]); var m = (u + 1) % 2; (0 === u ? r - o <= d : i - o <= g) && (a.push(c), a.push(f - 1), a.push(m)), (0 === u ? r + o >= d : i + o >= g) && (a.push(f + 1), a.push(h), a.push(m)); } } return s }(this.ids, this.coords, e, t, r, this.nodeSize) }; var q = { minZoom: 0, maxZoom: 16, radius: 40, extent: 512, nodeSize: 64, log: !1, generateId: !1, reduce: null, map: function (e) { return e } }, U = function (e) { this.options = re(Object.create(q), e), this.trees = new Array(this.options.maxZoom + 1); }; function $(e, t, r, i, o) { return { x: e, y: t, zoom: 1 / 0, id: r, parentId: -1, numPoints: i, properties: o } } function H(e, t) { var r = e.geometry.coordinates, i = r[0], o = r[1]; return { x: ee(i), y: te(o), zoom: 1 / 0, index: t, parentId: -1 } } function K(e) { return { type: "Feature", id: e.id, properties: Q(e), geometry: { type: "Point", coordinates: [(i = e.x, 360 * (i - .5)), (t = e.y, r = (180 - 360 * t) * Math.PI / 180, 360 * Math.atan(Math.exp(r)) / Math.PI - 90)] } }; var t, r, i; } function Q(e) { var t = e.numPoints, r = t >= 1e4 ? Math.round(t / 1e3) + "k" : t >= 1e3 ? Math.round(t / 100) / 10 + "k" : t; return re(re({}, e.properties), { cluster: !0, cluster_id: e.id, point_count: t, point_count_abbreviated: r }) } function ee(e) { return e / 360 + .5 } function te(e) { var t = Math.sin(e * Math.PI / 180), r = .5 - .25 * Math.log((1 + t) / (1 - t)) / Math.PI; return r < 0 ? 0 : r > 1 ? 1 : r } function re(e, t) { for (var r in t) e[r] = t[r]; return e } function ie(e) { return e.x } function oe(e) { return e.y } function ne(e, t, r, i, o, n) { var a = o - r, s = n - i; if (0 !== a || 0 !== s) { var l = ((e - r) * a + (t - i) * s) / (a * a + s * s); l > 1 ? (r = o, i = n) : l > 0 && (r += a * l, i += s * l); } return (a = e - r) * a + (s = t - i) * s } function ae(e, t, r, i) { var o = { id: void 0 === e ? null : e, type: t, geometry: r, tags: i, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 }; return function (e) { var t = e.geometry, r = e.type; if ("Point" === r || "MultiPoint" === r || "LineString" === r) se(e, t); else if ("Polygon" === r || "MultiLineString" === r) for (var i = 0; i < t.length; i++)se(e, t[i]); else if ("MultiPolygon" === r) for (i = 0; i < t.length; i++)for (var o = 0; o < t[i].length; o++)se(e, t[i][o]); }(o), o } function se(e, t) { for (var r = 0; r < t.length; r += 3)e.minX = Math.min(e.minX, t[r]), e.minY = Math.min(e.minY, t[r + 1]), e.maxX = Math.max(e.maxX, t[r]), e.maxY = Math.max(e.maxY, t[r + 1]); } function le(e, t, r, i) { if (t.geometry) { var o = t.geometry.coordinates, n = t.geometry.type, a = Math.pow(r.tolerance / ((1 << r.maxZoom) * r.extent), 2), s = [], l = t.id; if (r.promoteId ? l = t.properties[r.promoteId] : r.generateId && (l = i || 0), "Point" === n) ue(o, s); else if ("MultiPoint" === n) for (var u = 0; u < o.length; u++)ue(o[u], s); else if ("LineString" === n) he(o, s, a, !1); else if ("MultiLineString" === n) { if (r.lineMetrics) { for (u = 0; u < o.length; u++)s = [], he(o[u], s, a, !1), e.push(ae(l, "LineString", s, t.properties)); return } ce(o, s, a, !1); } else if ("Polygon" === n) ce(o, s, a, !0); else { if ("MultiPolygon" !== n) { if ("GeometryCollection" === n) { for (u = 0; u < t.geometry.geometries.length; u++)le(e, { id: l, geometry: t.geometry.geometries[u], properties: t.properties }, r, i); return } throw new Error("Input data is not a valid GeoJSON object.") } for (u = 0; u < o.length; u++) { var h = []; ce(o[u], h, a, !0), s.push(h); } } e.push(ae(l, n, s, t.properties)); } } function ue(e, t) { t.push(pe(e[0])), t.push(fe(e[1])), t.push(0); } function he(e, t, r, i) { for (var o, n, a = 0, s = 0; s < e.length; s++) { var l = pe(e[s][0]), u = fe(e[s][1]); t.push(l), t.push(u), t.push(0), s > 0 && (a += i ? (o * u - l * n) / 2 : Math.sqrt(Math.pow(l - o, 2) + Math.pow(u - n, 2))), o = l, n = u; } var h = t.length - 3; t[2] = 1, function e(t, r, i, o) { for (var n, a = o, s = i - r >> 1, l = i - r, u = t[r], h = t[r + 1], c = t[i], p = t[i + 1], f = r + 3; f < i; f += 3) { var d = ne(t[f], t[f + 1], u, h, c, p); if (d > a) n = f, a = d; else if (d === a) { var g = Math.abs(f - s); g < l && (n = f, l = g); } } a > o && (n - r > 3 && e(t, r, n, o), t[n + 2] = a, i - n > 3 && e(t, n, i, o)); }(t, 0, h, r), t[h + 2] = 1, t.size = Math.abs(a), t.start = 0, t.end = t.size; } function ce(e, t, r, i) { for (var o = 0; o < e.length; o++) { var n = []; he(e[o], n, r, i), t.push(n); } } function pe(e) { return e / 360 + .5 } function fe(e) { var t = Math.sin(e * Math.PI / 180), r = .5 - .25 * Math.log((1 + t) / (1 - t)) / Math.PI; return r < 0 ? 0 : r > 1 ? 1 : r } function de(e, t, r, i, o, n, a, s) { if (i /= t, n >= (r /= t) && a < i) return e; if (a < r || n >= i) return null; for (var l = [], u = 0; u < e.length; u++) { var h = e[u], c = h.geometry, p = h.type, f = 0 === o ? h.minX : h.minY, d = 0 === o ? h.maxX : h.maxY; if (f >= r && d < i) l.push(h); else if (!(d < r || f >= i)) { var g = []; if ("Point" === p || "MultiPoint" === p) ge(c, g, r, i, o); else if ("LineString" === p) me(c, g, r, i, o, !1, s.lineMetrics); else if ("MultiLineString" === p) ye(c, g, r, i, o, !1); else if ("Polygon" === p) ye(c, g, r, i, o, !0); else if ("MultiPolygon" === p) for (var m = 0; m < c.length; m++) { var v = []; ye(c[m], v, r, i, o, !0), v.length && g.push(v); } if (g.length) { if (s.lineMetrics && "LineString" === p) { for (m = 0; m < g.length; m++)l.push(ae(h.id, p, g[m], h.tags)); continue } "LineString" !== p && "MultiLineString" !== p || (1 === g.length ? (p = "LineString", g = g[0]) : p = "MultiLineString"), "Point" !== p && "MultiPoint" !== p || (p = 3 === g.length ? "Point" : "MultiPoint"), l.push(ae(h.id, p, g, h.tags)); } } } return l.length ? l : null } function ge(e, t, r, i, o) { for (var n = 0; n < e.length; n += 3) { var a = e[n + o]; a >= r && a <= i && (t.push(e[n]), t.push(e[n + 1]), t.push(e[n + 2])); } } function me(e, t, r, i, o, n, a) { for (var s, l, u = ve(e), h = 0 === o ? we : Se, c = e.start, p = 0; p < e.length - 3; p += 3) { var f = e[p], d = e[p + 1], g = e[p + 2], m = e[p + 3], v = e[p + 4], y = 0 === o ? f : d, x = 0 === o ? m : v, w = !1; a && (s = Math.sqrt(Math.pow(f - m, 2) + Math.pow(d - v, 2))), y < r ? x > r && (l = h(u, f, d, m, v, r), a && (u.start = c + s * l)) : y > i ? x < i && (l = h(u, f, d, m, v, i), a && (u.start = c + s * l)) : xe(u, f, d, g), x < r && y >= r && (l = h(u, f, d, m, v, r), w = !0), x > i && y <= i && (l = h(u, f, d, m, v, i), w = !0), !n && w && (a && (u.end = c + s * l), t.push(u), u = ve(e)), a && (c += s); } var S = e.length - 3; f = e[S], d = e[S + 1], g = e[S + 2], (y = 0 === o ? f : d) >= r && y <= i && xe(u, f, d, g), S = u.length - 3, n && S >= 3 && (u[S] !== u[0] || u[S + 1] !== u[1]) && xe(u, u[0], u[1], u[2]), u.length && t.push(u); } function ve(e) { var t = []; return t.size = e.size, t.start = e.start, t.end = e.end, t } function ye(e, t, r, i, o, n) { for (var a = 0; a < e.length; a++)me(e[a], t, r, i, o, n, !1); } function xe(e, t, r, i) { e.push(t), e.push(r), e.push(i); } function we(e, t, r, i, o, n) { var a = (n - t) / (i - t); return e.push(n), e.push(r + (o - r) * a), e.push(1), a } function Se(e, t, r, i, o, n) { var a = (n - r) / (o - r); return e.push(t + (i - t) * a), e.push(n), e.push(1), a } function Me(e, t) { for (var r = [], i = 0; i < e.length; i++) { var o, n = e[i], a = n.type; if ("Point" === a || "MultiPoint" === a || "LineString" === a) o = be(n.geometry, t); else if ("MultiLineString" === a || "Polygon" === a) { o = []; for (var s = 0; s < n.geometry.length; s++)o.push(be(n.geometry[s], t)); } else if ("MultiPolygon" === a) for (o = [], s = 0; s < n.geometry.length; s++) { for (var l = [], u = 0; u < n.geometry[s].length; u++)l.push(be(n.geometry[s][u], t)); o.push(l); } r.push(ae(n.id, a, o, n.tags)); } return r } function be(e, t) { var r = []; r.size = e.size, void 0 !== e.start && (r.start = e.start, r.end = e.end); for (var i = 0; i < e.length; i += 3)r.push(e[i] + t, e[i + 1], e[i + 2]); return r } function ke(e, t) { if (e.transformed) return e; var r, i, o, n = 1 << e.z, a = e.x, s = e.y; for (r = 0; r < e.features.length; r++) { var l = e.features[r], u = l.geometry, h = l.type; if (l.geometry = [], 1 === h) for (i = 0; i < u.length; i += 2)l.geometry.push(Ie(u[i], u[i + 1], t, n, a, s)); else for (i = 0; i < u.length; i++) { var c = []; for (o = 0; o < u[i].length; o += 2)c.push(Ie(u[i][o], u[i][o + 1], t, n, a, s)); l.geometry.push(c); } } return e.transformed = !0, e } function Ie(e, t, r, i, o, n) { return [Math.round(r * (e * i - o)), Math.round(r * (t * i - n))] } function _e(e, t, r, i, o) { for (var n = t === o.maxZoom ? 0 : o.tolerance / ((1 << t) * o.extent), a = { features: [], numPoints: 0, numSimplified: 0, numFeatures: 0, source: null, x: r, y: i, z: t, transformed: !1, minX: 2, minY: 1, maxX: -1, maxY: 0 }, s = 0; s < e.length; s++) { a.numFeatures++ , Pe(a, e[s], n, o); var l = e[s].minX, u = e[s].minY, h = e[s].maxX, c = e[s].maxY; l < a.minX && (a.minX = l), u < a.minY && (a.minY = u), h > a.maxX && (a.maxX = h), c > a.maxY && (a.maxY = c); } return a } function Pe(e, t, r, i) { var o = t.geometry, n = t.type, a = []; if ("Point" === n || "MultiPoint" === n) for (var s = 0; s < o.length; s += 3)a.push(o[s]), a.push(o[s + 1]), e.numPoints++ , e.numSimplified++; else if ("LineString" === n) Te(a, o, e, r, !1, !1); else if ("MultiLineString" === n || "Polygon" === n) for (s = 0; s < o.length; s++)Te(a, o[s], e, r, "Polygon" === n, 0 === s); else if ("MultiPolygon" === n) for (var l = 0; l < o.length; l++) { var u = o[l]; for (s = 0; s < u.length; s++)Te(a, u[s], e, r, !0, 0 === s); } if (a.length) { var h = t.tags || null; if ("LineString" === n && i.lineMetrics) { for (var c in h = {}, t.tags) h[c] = t.tags[c]; h.mapbox_clip_start = o.start / o.size, h.mapbox_clip_end = o.end / o.size; } var p = { geometry: a, type: "Polygon" === n || "MultiPolygon" === n ? 3 : "LineString" === n || "MultiLineString" === n ? 2 : 1, tags: h }; null !== t.id && (p.id = t.id), e.features.push(p); } } function Te(e, t, r, i, o, n) { var a = i * i; if (i > 0 && t.size < (o ? a : i)) r.numPoints += t.length / 3; else { for (var s = [], l = 0; l < t.length; l += 3)(0 === i || t[l + 2] > a) && (r.numSimplified++ , s.push(t[l]), s.push(t[l + 1])), r.numPoints++; o && function (e, t) { for (var r = 0, i = 0, o = e.length, n = o - 2; i < o; n = i, i += 2)r += (e[i] - e[n]) * (e[i + 1] + e[n + 1]); if (r > 0 === t) for (i = 0, o = e.length; i < o / 2; i += 2) { var a = e[i], s = e[i + 1]; e[i] = e[o - 2 - i], e[i + 1] = e[o - 1 - i], e[o - 2 - i] = a, e[o - 1 - i] = s; } }(s, n), e.push(s); } } function Le(e, t) { var r = (t = this.options = function (e, t) { for (var r in t) e[r] = t[r]; return e }(Object.create(this.options), t)).debug; if (r && console.time("preprocess data"), t.maxZoom < 0 || t.maxZoom > 24) throw new Error("maxZoom should be in the 0-24 range"); if (t.promoteId && t.generateId) throw new Error("promoteId and generateId cannot be used together."); var i = function (e, t) { var r = []; if ("FeatureCollection" === e.type) for (var i = 0; i < e.features.length; i++)le(r, e.features[i], t, i); else "Feature" === e.type ? le(r, e, t) : le(r, { geometry: e }, t); return r }(e, t); this.tiles = {}, this.tileCoords = [], r && (console.timeEnd("preprocess data"), console.log("index: maxZoom: %d, maxPoints: %d", t.indexMaxZoom, t.indexMaxPoints), console.time("generate tiles"), this.stats = {}, this.total = 0), (i = function (e, t) { var r = t.buffer / t.extent, i = e, o = de(e, 1, -1 - r, r, 0, -1, 2, t), n = de(e, 1, 1 - r, 2 + r, 0, -1, 2, t); return (o || n) && (i = de(e, 1, -r, 1 + r, 0, -1, 2, t) || [], o && (i = Me(o, 1).concat(i)), n && (i = i.concat(Me(n, -1)))), i }(i, t)).length && this.splitTile(i, 0, 0, 0), r && (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))); } function De(e, t, r) { return 32 * ((1 << e) * r + t) + e } function Ce(e, t) { var r = e.tileID.canonical; if (!this._geoJSONIndex) return t(null, null); var i = this._geoJSONIndex.getTile(r.z, r.x, r.y); if (!i) return t(null, null); var o = new k(i.features), n = L(o); 0 === n.byteOffset && n.byteLength === n.buffer.byteLength || (n = new Uint8Array(n)), t(null, { vectorTile: o, rawData: n.buffer }); } U.prototype.load = function (e) { var t = this.options, r = t.log, i = t.minZoom, o = t.maxZoom, n = t.nodeSize; r && console.time("total time"); var a = "prepare " + e.length + " points"; r && console.time(a), this.points = e; for (var s = [], l = 0; l < e.length; l++)e[l].geometry && s.push(H(e[l], l)); this.trees[o + 1] = new R(s, ie, oe, n, Float32Array), r && console.timeEnd(a); for (var u = o; u >= i; u--) { var h = +Date.now(); s = this._cluster(s, u), this.trees[u] = new R(s, ie, oe, n, Float32Array), r && console.log("z%d: %d clusters in %dms", u, s.length, +Date.now() - h); } return r && console.timeEnd("total time"), this }, U.prototype.getClusters = function (e, t) { var r = ((e[0] + 180) % 360 + 360) % 360 - 180, i = Math.max(-90, Math.min(90, e[1])), o = 180 === e[2] ? 180 : ((e[2] + 180) % 360 + 360) % 360 - 180, n = Math.max(-90, Math.min(90, e[3])); if (e[2] - e[0] >= 360) r = -180, o = 180; else if (r > o) { var a = this.getClusters([r, i, 180, n], t), s = this.getClusters([-180, i, o, n], t); return a.concat(s) } for (var l = this.trees[this._limitZoom(t)], u = [], h = 0, c = l.range(ee(r), te(n), ee(o), te(i)); h < c.length; h += 1) { var p = c[h], f = l.points[p]; u.push(f.numPoints ? K(f) : this.points[f.index]); } return u }, U.prototype.getChildren = function (e) { var t = this._getOriginId(e), r = this._getOriginZoom(e), i = "No cluster with the specified id.", o = this.trees[r]; if (!o) throw new Error(i); var n = o.points[t]; if (!n) throw new Error(i); for (var a = this.options.radius / (this.options.extent * Math.pow(2, r - 1)), s = [], l = 0, u = o.within(n.x, n.y, a); l < u.length; l += 1) { var h = u[l], c = o.points[h]; c.parentId === e && s.push(c.numPoints ? K(c) : this.points[c.index]); } if (0 === s.length) throw new Error(i); return s }, U.prototype.getLeaves = function (e, t, r) { t = t || 10, r = r || 0; var i = []; return this._appendLeaves(i, e, t, r, 0), i }, U.prototype.getTile = function (e, t, r) { var i = this.trees[this._limitZoom(e)], o = Math.pow(2, e), n = this.options, a = n.extent, s = n.radius / a, l = (r - s) / o, u = (r + 1 + s) / o, h = { features: [] }; return this._addTileFeatures(i.range((t - s) / o, l, (t + 1 + s) / o, u), i.points, t, r, o, h), 0 === t && this._addTileFeatures(i.range(1 - s / o, l, 1, u), i.points, o, r, o, h), t === o - 1 && this._addTileFeatures(i.range(0, l, s / o, u), i.points, -1, r, o, h), h.features.length ? h : null }, U.prototype.getClusterExpansionZoom = function (e) { for (var t = this._getOriginZoom(e) - 1; t <= this.options.maxZoom;) { var r = this.getChildren(e); if (t++ , 1 !== r.length) break; e = r[0].properties.cluster_id; } return t }, U.prototype._appendLeaves = function (e, t, r, i, o) { for (var n = 0, a = this.getChildren(t); n < a.length; n += 1) { var s = a[n], l = s.properties; if (l && l.cluster ? o + l.point_count <= i ? o += l.point_count : o = this._appendLeaves(e, l.cluster_id, r, i, o) : o < i ? o++ : e.push(s), e.length === r) break } return o }, U.prototype._addTileFeatures = function (e, t, r, i, o, n) { for (var a = 0, s = e; a < s.length; a += 1) { var l = t[s[a]], u = l.numPoints, h = { type: 1, geometry: [[Math.round(this.options.extent * (l.x * o - r)), Math.round(this.options.extent * (l.y * o - i))]], tags: u ? Q(l) : this.points[l.index].properties }, c = void 0; u ? c = l.id : this.options.generateId ? c = l.index : this.points[l.index].id && (c = this.points[l.index].id), void 0 !== c && (h.id = c), n.features.push(h); } }, U.prototype._limitZoom = function (e) { return Math.max(this.options.minZoom, Math.min(e, this.options.maxZoom + 1)) }, U.prototype._cluster = function (e, t) { for (var r = [], i = this.options, o = i.radius, n = i.extent, a = i.reduce, s = o / (n * Math.pow(2, t)), l = 0; l < e.length; l++) { var u = e[l]; if (!(u.zoom <= t)) { u.zoom = t; for (var h = this.trees[t + 1], c = h.within(u.x, u.y, s), p = u.numPoints || 1, f = u.x * p, d = u.y * p, g = a && p > 1 ? this._map(u, !0) : null, m = (l << 5) + (t + 1) + this.points.length, v = 0, y = c; v < y.length; v += 1) { var x = y[v], w = h.points[x]; if (!(w.zoom <= t)) { w.zoom = t; var S = w.numPoints || 1; f += w.x * S, d += w.y * S, p += S, w.parentId = m, a && (g || (g = this._map(u, !0)), a(g, this._map(w))); } } 1 === p ? r.push(u) : (u.parentId = m, r.push($(f / p, d / p, m, p, g))); } } return r }, U.prototype._getOriginId = function (e) { return e - this.points.length >> 5 }, U.prototype._getOriginZoom = function (e) { return (e - this.points.length) % 32 }, U.prototype._map = function (e, t) { if (e.numPoints) return t ? re({}, e.properties) : e.properties; var r = this.points[e.index].properties, i = this.options.map(r); return t && i === r ? re({}, i) : i }, Le.prototype.options = { maxZoom: 14, indexMaxZoom: 5, indexMaxPoints: 1e5, tolerance: 3, extent: 4096, buffer: 64, lineMetrics: !1, promoteId: null, generateId: !1, debug: 0 }, Le.prototype.splitTile = function (e, t, r, i, o, n, a) { for (var s = [e, t, r, i], l = this.options, u = l.debug; s.length;) { i = s.pop(), r = s.pop(), t = s.pop(), e = s.pop(); var h = 1 << t, c = De(t, r, i), p = this.tiles[c]; if (!p && (u > 1 && console.time("creation"), p = this.tiles[c] = _e(e, t, r, i, l), this.tileCoords.push({ z: t, x: r, y: i }), u)) { u > 1 && (console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)", t, r, i, p.numFeatures, p.numPoints, p.numSimplified), console.timeEnd("creation")); var f = "z" + t; this.stats[f] = (this.stats[f] || 0) + 1, this.total++; } if (p.source = e, o) { if (t === l.maxZoom || t === o) continue; var d = 1 << o - t; if (r !== Math.floor(n / d) || i !== Math.floor(a / d)) continue } else if (t === l.indexMaxZoom || p.numPoints <= l.indexMaxPoints) continue; if (p.source = null, 0 !== e.length) { u > 1 && console.time("clipping"); var g, m, v, y, x, w, S = .5 * l.buffer / l.extent, M = .5 - S, b = .5 + S, k = 1 + S; g = m = v = y = null, x = de(e, h, r - S, r + b, 0, p.minX, p.maxX, l), w = de(e, h, r + M, r + k, 0, p.minX, p.maxX, l), e = null, x && (g = de(x, h, i - S, i + b, 1, p.minY, p.maxY, l), m = de(x, h, i + M, i + k, 1, p.minY, p.maxY, l), x = null), w && (v = de(w, h, i - S, i + b, 1, p.minY, p.maxY, l), y = de(w, h, i + M, i + k, 1, p.minY, p.maxY, l), w = null), u > 1 && console.timeEnd("clipping"), s.push(g || [], t + 1, 2 * r, 2 * i), s.push(m || [], t + 1, 2 * r, 2 * i + 1), s.push(v || [], t + 1, 2 * r + 1, 2 * i), s.push(y || [], t + 1, 2 * r + 1, 2 * i + 1); } } }, Le.prototype.getTile = function (e, t, r) { var i = this.options, o = i.extent, n = i.debug; if (e < 0 || e > 24) return null; var a = 1 << e, s = De(e, t = (t % a + a) % a, r); if (this.tiles[s]) return ke(this.tiles[s], o); n > 1 && console.log("drilling down to z%d-%d-%d", e, t, r); for (var l, u = e, h = t, c = r; !l && u > 0;)u-- , h = Math.floor(h / 2), c = Math.floor(c / 2), l = this.tiles[De(u, h, c)]; return l && l.source ? (n > 1 && console.log("found parent tile z%d-%d-%d", u, h, c), n > 1 && console.time("drilling down"), this.splitTile(l.source, u, h, c, e, t, r), n > 1 && console.timeEnd("drilling down"), this.tiles[s] ? ke(this.tiles[s], o) : null) : null }; var Oe = function (t) { function r(e, r, i, o) { t.call(this, e, r, i, Ce), o && (this.loadGeoJSON = o); } return t && (r.__proto__ = t), r.prototype = Object.create(t && t.prototype), r.prototype.constructor = r, r.prototype.loadData = function (e, t) { this._pendingCallback && this._pendingCallback(null, { abandoned: !0 }), this._pendingCallback = t, this._pendingLoadDataParams = e, this._state && "Idle" !== this._state ? this._state = "NeedsLoadData" : (this._state = "Coalescing", this._loadData()); }, r.prototype._loadData = function () { var t = this; if (this._pendingCallback && this._pendingLoadDataParams) { var r = this._pendingCallback, i = this._pendingLoadDataParams; delete this._pendingCallback, delete this._pendingLoadDataParams; var o = !!(i && i.request && i.request.collectResourceTiming) && new l.Performance(i.request); this.loadGeoJSON(i, (function (n, a) { if (n || !a) return r(n); if ("object" != typeof a) return r(new Error("Input data given to '" + i.source + "' is not a valid GeoJSON object.")); y(a, !0); try { t._geoJSONIndex = i.cluster ? new U(function (t) { var r = t.superclusterOptions, i = t.clusterProperties; if (!i || !r) return r; for (var o = {}, n = {}, a = { accumulated: null, zoom: 0 }, s = { properties: null }, l = Object.keys(i), u = 0, h = l; u < h.length; u += 1) { var c = h[u], p = i[c], f = p[0], d = p[1], g = e.createExpression(d), m = e.createExpression("string" == typeof f ? [f, ["accumulated"], ["get", c]] : f); o[c] = g.value, n[c] = m.value; } return r.map = function (e) { s.properties = e; for (var t = {}, r = 0, i = l; r < i.length; r += 1) { var n = i[r]; t[n] = o[n].evaluate(a, s); } return t }, r.reduce = function (e, t) { s.properties = t; for (var r = 0, i = l; r < i.length; r += 1) { var o = i[r]; a.accumulated = e[o], e[o] = n[o].evaluate(a, s); } }, r }(i)).load(a.features) : function (e, t) { return new Le(e, t) }(a, i.geojsonVtOptions); } catch (n) { return r(n) } t.loaded = {}; var s = {}; if (o) { var l = o.finish(); l && (s.resourceTiming = {}, s.resourceTiming[i.source] = JSON.parse(JSON.stringify(l))); } r(null, s); })); } }, r.prototype.coalesce = function () { "Coalescing" === this._state ? this._state = "Idle" : "NeedsLoadData" === this._state && (this._state = "Coalescing", this._loadData()); }, r.prototype.reloadTile = function (e, r) { var i = this.loaded, o = e.uid; return i && i[o] ? t.prototype.reloadTile.call(this, e, r) : this.loadTile(e, r) }, r.prototype.loadGeoJSON = function (t, r) { if (t.request) e.getJSON(t.request, r); else { if ("string" != typeof t.data) return r(new Error("Input data given to '" + t.source + "' is not a valid GeoJSON object.")); try { return r(null, JSON.parse(t.data)) } catch (e) { return r(new Error("Input data given to '" + t.source + "' is not a valid GeoJSON object.")) } } }, r.prototype.removeSource = function (e, t) { this._pendingCallback && this._pendingCallback(null, { abandoned: !0 }), t(); }, r.prototype.getClusterExpansionZoom = function (e, t) { t(null, this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)); }, r.prototype.getClusterChildren = function (e, t) { t(null, this._geoJSONIndex.getChildren(e.clusterId)); }, r.prototype.getClusterLeaves = function (e, t) { t(null, this._geoJSONIndex.getLeaves(e.clusterId, e.limit, e.offset)); }, r }(c); var ze = function (t) { var r = this; this.self = t, this.actor = new e.Actor(t, this), this.layerIndexes = {}, this.availableImages = {}, this.workerSourceTypes = { vector: c, geojson: Oe }, this.workerSources = {}, this.demWorkerSources = {}, this.self.registerWorkerSource = function (e, t) { if (r.workerSourceTypes[e]) throw new Error('Worker source with name "' + e + '" already registered.'); r.workerSourceTypes[e] = t; }, this.self.registerRTLTextPlugin = function (t) { if (e.plugin.isParsed()) throw new Error("RTL text plugin already registered."); e.plugin.applyArabicShaping = t.applyArabicShaping, e.plugin.processBidirectionalText = t.processBidirectionalText, e.plugin.processStyledBidirectionalText = t.processStyledBidirectionalText; }; }; return ze.prototype.setReferrer = function (e, t) { this.referrer = t; }, ze.prototype.setImages = function (e, t, r) { this.availableImages[e] = t, r(); }, ze.prototype.setLayers = function (e, t, r) { this.getLayerIndex(e).replace(t), r(); }, ze.prototype.updateLayers = function (e, t, r) { this.getLayerIndex(e).update(t.layers, t.removedIds), r(); }, ze.prototype.loadTile = function (e, t, r) { this.getWorkerSource(e, t.type, t.source).loadTile(t, r); }, ze.prototype.loadDEMTile = function (e, t, r) { this.getDEMWorkerSource(e, t.source).loadTile(t, r); }, ze.prototype.reloadTile = function (e, t, r) { this.getWorkerSource(e, t.type, t.source).reloadTile(t, r); }, ze.prototype.abortTile = function (e, t, r) { this.getWorkerSource(e, t.type, t.source).abortTile(t, r); }, ze.prototype.removeTile = function (e, t, r) { this.getWorkerSource(e, t.type, t.source).removeTile(t, r); }, ze.prototype.removeDEMTile = function (e, t) { this.getDEMWorkerSource(e, t.source).removeTile(t); }, ze.prototype.removeSource = function (e, t, r) { if (this.workerSources[e] && this.workerSources[e][t.type] && this.workerSources[e][t.type][t.source]) { var i = this.workerSources[e][t.type][t.source]; delete this.workerSources[e][t.type][t.source], void 0 !== i.removeSource ? i.removeSource(t, r) : r(); } }, ze.prototype.loadWorkerSource = function (e, t, r) { try { this.self.importScripts(t.url), r(); } catch (e) { r(e.toString()); } }, ze.prototype.syncRTLPluginState = function (t, r, i) { try { e.plugin.setState(r); var o = e.plugin.getPluginURL(); if (e.plugin.isLoaded() && !e.plugin.isParsed() && null != o) { this.self.importScripts(o); var n = e.plugin.isParsed(); i(n ? void 0 : new Error("RTL Text Plugin failed to import scripts from " + o), n); } } catch (e) { i(e.toString()); } }, ze.prototype.getAvailableImages = function (e) { var t = this.availableImages[e]; return t || (t = []), t }, ze.prototype.getLayerIndex = function (e) { var t = this.layerIndexes[e]; return t || (t = this.layerIndexes[e] = new i), t }, ze.prototype.getWorkerSource = function (e, t, r) { var i = this; if (this.workerSources[e] || (this.workerSources[e] = {}), this.workerSources[e][t] || (this.workerSources[e][t] = {}), !this.workerSources[e][t][r]) { var o = { send: function (t, r, o) { i.actor.send(t, r, o, e); } }; this.workerSources[e][t][r] = new this.workerSourceTypes[t](o, this.getLayerIndex(e), this.getAvailableImages(e)); } return this.workerSources[e][t][r] }, ze.prototype.getDEMWorkerSource = function (e, t) { return this.demWorkerSources[e] || (this.demWorkerSources[e] = {}), this.demWorkerSources[e][t] || (this.demWorkerSources[e][t] = new p), this.demWorkerSources[e][t] }, ze.prototype.enforceCacheSizeLimit = function (t, r) { e.enforceCacheSizeLimit(r); }, "undefined" != typeof WorkerGlobalScope && void 0 !== e.window && e.window instanceof WorkerGlobalScope && (e.window.worker = new ze(e.window)), ze })); define(["./shared"], (function (t) { "use strict"; var e = t.createCommonjsModule((function (t) { function e(t) { return !!("undefined" != typeof window && "undefined" != typeof document && Array.prototype && Array.prototype.every && Array.prototype.filter && Array.prototype.forEach && Array.prototype.indexOf && Array.prototype.lastIndexOf && Array.prototype.map && Array.prototype.some && Array.prototype.reduce && Array.prototype.reduceRight && Array.isArray && Function.prototype && Function.prototype.bind && Object.keys && Object.create && Object.getPrototypeOf && Object.getOwnPropertyNames && Object.isSealed && Object.isFrozen && Object.isExtensible && Object.getOwnPropertyDescriptor && Object.defineProperty && Object.defineProperties && Object.seal && Object.freeze && Object.preventExtensions && "JSON" in window && "parse" in JSON && "stringify" in JSON && function () { if (!("Worker" in window && "Blob" in window && "URL" in window)) return !1; var t, e, i = new Blob([""], { type: "text/javascript" }), o = URL.createObjectURL(i); try { e = new Worker(o), t = !0; } catch (e) { t = !1; } e && e.terminate(); return URL.revokeObjectURL(o), t }() && "Uint8ClampedArray" in window && ArrayBuffer.isView && function (t) { void 0 === i[t] && (i[t] = function (t) { var i = document.createElement("canvas"), o = Object.create(e.webGLContextAttributes); return o.failIfMajorPerformanceCaveat = t, i.probablySupportsContext ? i.probablySupportsContext("webgl", o) || i.probablySupportsContext("experimental-webgl", o) : i.supportsContext ? i.supportsContext("webgl", o) || i.supportsContext("experimental-webgl", o) : i.getContext("webgl", o) || i.getContext("experimental-webgl", o) }(t)); return i[t] }(t && t.failIfMajorPerformanceCaveat)) } t.exports ? t.exports = e : window && (window.mapboxgl = window.mapboxgl || {}, window.mapboxgl.supported = e); var i = {}; e.webGLContextAttributes = { antialias: !1, alpha: !0, stencil: !0, depth: !0 }; })), i = { create: function (e, i, o) { var r = t.window.document.createElement(e); return void 0 !== i && (r.className = i), o && o.appendChild(r), r }, createNS: function (e, i) { return t.window.document.createElementNS(e, i) } }, o = t.window.document.documentElement.style; function r(t) { if (!o) return t[0]; for (var e = 0; e < t.length; e++)if (t[e] in o) return t[e]; return t[0] } var a, n = r(["userSelect", "MozUserSelect", "WebkitUserSelect", "msUserSelect"]); i.disableDrag = function () { o && n && (a = o[n], o[n] = "none"); }, i.enableDrag = function () { o && n && (o[n] = a); }; var s = r(["transform", "WebkitTransform"]); i.setTransform = function (t, e) { t.style[s] = e; }; var l = !1; try { var c = Object.defineProperty({}, "passive", { get: function () { l = !0; } }); t.window.addEventListener("test", c, c), t.window.removeEventListener("test", c, c); } catch (t) { l = !1; } i.addEventListener = function (t, e, i, o) { void 0 === o && (o = {}), "passive" in o && l ? t.addEventListener(e, i, o) : t.addEventListener(e, i, o.capture); }, i.removeEventListener = function (t, e, i, o) { void 0 === o && (o = {}), "passive" in o && l ? t.removeEventListener(e, i, o) : t.removeEventListener(e, i, o.capture); }; var u = function (e) { e.preventDefault(), e.stopPropagation(), t.window.removeEventListener("click", u, !0); }; function h(t) { var e = t.userImage; if (e && e.render && e.render()) return t.data.replace(new Uint8Array(e.data.buffer)), !0; return !1 } i.suppressClick = function () { t.window.addEventListener("click", u, !0), t.window.setTimeout((function () { t.window.removeEventListener("click", u, !0); }), 0); }, i.mousePos = function (e, i) { var o = e.getBoundingClientRect(), r = t.window.TouchEvent && i instanceof t.window.TouchEvent ? i.touches[0] : i; return new t.Point(r.clientX - o.left - e.clientLeft, r.clientY - o.top - e.clientTop) }, i.touchPos = function (e, i) { for (var o = e.getBoundingClientRect(), r = [], a = "touchend" === i.type ? i.changedTouches : i.touches, n = 0; n < a.length; n++)r.push(new t.Point(a[n].clientX - o.left - e.clientLeft, a[n].clientY - o.top - e.clientTop)); return r }, i.mouseButton = function (e) { return void 0 !== t.window.InstallTrigger && 2 === e.button && e.ctrlKey && t.window.navigator.platform.toUpperCase().indexOf("MAC") >= 0 ? 0 : e.button }, i.remove = function (t) { t.parentNode && t.parentNode.removeChild(t); }; var p = function (e) { function i() { e.call(this), this.images = {}, this.updatedImages = {}, this.callbackDispatchedThisFrame = {}, this.loaded = !1, this.requestors = [], this.patterns = {}, this.atlasImage = new t.RGBAImage({ width: 1, height: 1 }), this.dirty = !0; } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.isLoaded = function () { return this.loaded }, i.prototype.setLoaded = function (t) { if (this.loaded !== t && (this.loaded = t, t)) { for (var e = 0, i = this.requestors; e < i.length; e += 1) { var o = i[e], r = o.ids, a = o.callback; this._notify(r, a); } this.requestors = []; } }, i.prototype.getImage = function (t) { return this.images[t] }, i.prototype.addImage = function (t, e) { this._validate(t, e) && (this.images[t] = e); }, i.prototype._validate = function (e, i) { var o = !0; return this._validateStretch(i.stretchX, i.data && i.data.width) || (this.fire(new t.ErrorEvent(new Error('Image "' + e + '" has invalid "stretchX" value'))), o = !1), this._validateStretch(i.stretchY, i.data && i.data.height) || (this.fire(new t.ErrorEvent(new Error('Image "' + e + '" has invalid "stretchY" value'))), o = !1), this._validateContent(i.content, i) || (this.fire(new t.ErrorEvent(new Error('Image "' + e + '" has invalid "content" value'))), o = !1), o }, i.prototype._validateStretch = function (t, e) { if (!t) return !0; for (var i = 0, o = 0, r = t; o < r.length; o += 1) { var a = r[o]; if (a[0] < i || a[1] < a[0] || e < a[1]) return !1; i = a[1]; } return !0 }, i.prototype._validateContent = function (t, e) { return !t || 4 === t.length && (!(t[0] < 0 || e.data.width < t[0]) && (!(t[1] < 0 || e.data.height < t[1]) && (!(t[2] < 0 || e.data.width < t[2]) && (!(t[3] < 0 || e.data.height < t[3]) && (!(t[2] < t[0]) && !(t[3] < t[1])))))) }, i.prototype.updateImage = function (t, e) { var i = this.images[t]; e.version = i.version + 1, this.images[t] = e, this.updatedImages[t] = !0; }, i.prototype.removeImage = function (t) { var e = this.images[t]; delete this.images[t], delete this.patterns[t], e.userImage && e.userImage.onRemove && e.userImage.onRemove(); }, i.prototype.listImages = function () { return Object.keys(this.images) }, i.prototype.getImages = function (t, e) { var i = !0; if (!this.isLoaded()) for (var o = 0, r = t; o < r.length; o += 1) { var a = r[o]; this.images[a] || (i = !1); } this.isLoaded() || i ? this._notify(t, e) : this.requestors.push({ ids: t, callback: e }); }, i.prototype._notify = function (e, i) { for (var o = {}, r = 0, a = e; r < a.length; r += 1) { var n = a[r]; this.images[n] || this.fire(new t.Event("styleimagemissing", { id: n })); var s = this.images[n]; s ? o[n] = { data: s.data.clone(), pixelRatio: s.pixelRatio, sdf: s.sdf, version: s.version, stretchX: s.stretchX, stretchY: s.stretchY, content: s.content, hasRenderCallback: Boolean(s.userImage && s.userImage.render) } : t.warnOnce('Image "' + n + '" 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.'); } i(null, o); }, i.prototype.getPixelSize = function () { var t = this.atlasImage; return { width: t.width, height: t.height } }, i.prototype.getPattern = function (e) { var i = this.patterns[e], o = this.getImage(e); if (!o) return null; if (i && i.position.version === o.version) return i.position; if (i) i.position.version = o.version; else { var r = { w: o.data.width + 2, h: o.data.height + 2, x: 0, y: 0 }, a = new t.ImagePosition(r, o); this.patterns[e] = { bin: r, position: a }; } return this._updatePatternAtlas(), this.patterns[e].position }, i.prototype.bind = function (e) { var i = e.gl; this.atlasTexture ? this.dirty && (this.atlasTexture.update(this.atlasImage), this.dirty = !1) : this.atlasTexture = new t.Texture(e, this.atlasImage, i.RGBA), this.atlasTexture.bind(i.LINEAR, i.CLAMP_TO_EDGE); }, i.prototype._updatePatternAtlas = function () { var e = []; for (var i in this.patterns) e.push(this.patterns[i].bin); var o = t.potpack(e), r = o.w, a = o.h, n = this.atlasImage; for (var s in n.resize({ width: r || 1, height: a || 1 }), this.patterns) { var l = this.patterns[s].bin, c = l.x + 1, u = l.y + 1, h = this.images[s].data, p = h.width, d = h.height; t.RGBAImage.copy(h, n, { x: 0, y: 0 }, { x: c, y: u }, { width: p, height: d }), t.RGBAImage.copy(h, n, { x: 0, y: d - 1 }, { x: c, y: u - 1 }, { width: p, height: 1 }), t.RGBAImage.copy(h, n, { x: 0, y: 0 }, { x: c, y: u + d }, { width: p, height: 1 }), t.RGBAImage.copy(h, n, { x: p - 1, y: 0 }, { x: c - 1, y: u }, { width: 1, height: d }), t.RGBAImage.copy(h, n, { x: 0, y: 0 }, { x: c + p, y: u }, { width: 1, height: d }); } this.dirty = !0; }, i.prototype.beginFrame = function () { this.callbackDispatchedThisFrame = {}; }, i.prototype.dispatchRenderCallbacks = function (t) { for (var e = 0, i = t; e < i.length; e += 1) { var o = i[e]; if (!this.callbackDispatchedThisFrame[o]) { this.callbackDispatchedThisFrame[o] = !0; var r = this.images[o]; h(r) && this.updateImage(o, r); } } }, i }(t.Evented); var d = m, _ = m, f = 1e20; function m(t, e, i, o, r, a) { this.fontSize = t || 24, this.buffer = void 0 === e ? 3 : e, this.cutoff = o || .25, this.fontFamily = r || "sans-serif", this.fontWeight = a || "normal", this.radius = i || 8; var n = this.size = this.fontSize + 2 * this.buffer; this.canvas = document.createElement("canvas"), this.canvas.width = this.canvas.height = n, this.ctx = this.canvas.getContext("2d"), this.ctx.font = this.fontWeight + " " + this.fontSize + "px " + this.fontFamily, this.ctx.textBaseline = "middle", this.ctx.fillStyle = "black", this.gridOuter = new Float64Array(n * n), this.gridInner = new Float64Array(n * n), this.f = new Float64Array(n), this.d = new Float64Array(n), this.z = new Float64Array(n + 1), this.v = new Int16Array(n), this.middle = Math.round(n / 2 * (navigator.userAgent.indexOf("Gecko/") >= 0 ? 1.2 : 1)); } function g(t, e, i, o, r, a, n) { for (var s = 0; s < e; s++) { for (var l = 0; l < i; l++)o[l] = t[l * e + s]; for (v(o, r, a, n, i), l = 0; l < i; l++)t[l * e + s] = r[l]; } for (l = 0; l < i; l++) { for (s = 0; s < e; s++)o[s] = t[l * e + s]; for (v(o, r, a, n, e), s = 0; s < e; s++)t[l * e + s] = Math.sqrt(r[s]); } } function v(t, e, i, o, r) { i[0] = 0, o[0] = -f, o[1] = +f; for (var a = 1, n = 0; a < r; a++) { for (var s = (t[a] + a * a - (t[i[n]] + i[n] * i[n])) / (2 * a - 2 * i[n]); s <= o[n];)n-- , s = (t[a] + a * a - (t[i[n]] + i[n] * i[n])) / (2 * a - 2 * i[n]); i[++n] = a, o[n] = s, o[n + 1] = +f; } for (a = 0, n = 0; a < r; a++) { for (; o[n + 1] < a;)n++; e[a] = (a - i[n]) * (a - i[n]) + t[i[n]]; } } m.prototype.draw = function (t) { this.ctx.clearRect(0, 0, this.size, this.size), this.ctx.fillText(t, this.buffer, this.middle); for (var e = this.ctx.getImageData(0, 0, this.size, this.size), i = new Uint8ClampedArray(this.size * this.size), o = 0; o < this.size * this.size; o++) { var r = e.data[4 * o + 3] / 255; this.gridOuter[o] = 1 === r ? 0 : 0 === r ? f : Math.pow(Math.max(0, .5 - r), 2), this.gridInner[o] = 1 === r ? f : 0 === r ? 0 : Math.pow(Math.max(0, r - .5), 2); } for (g(this.gridOuter, this.size, this.size, this.f, this.d, this.v, this.z), g(this.gridInner, this.size, this.size, this.f, this.d, this.v, this.z), o = 0; o < this.size * this.size; o++) { var a = this.gridOuter[o] - this.gridInner[o]; i[o] = Math.max(0, Math.min(255, Math.round(255 - 255 * (a / this.radius + this.cutoff)))); } return i }, d.default = _; var y = function (t, e) { this.requestManager = t, this.localIdeographFontFamily = e, this.entries = {}; }; y.prototype.setURL = function (t) { this.url = t; }, y.prototype.getGlyphs = function (e, i) { var o = this, r = []; for (var a in e) for (var n = 0, s = e[a]; n < s.length; n += 1) { var l = s[n]; r.push({ stack: a, id: l }); } t.asyncAll(r, (function (t, e) { var i = t.stack, r = t.id, a = o.entries[i]; a || (a = o.entries[i] = { glyphs: {}, requests: {} }); var n = a.glyphs[r]; if (void 0 === n) { if (n = o._tinySDF(a, i, r)) return a.glyphs[r] = n, void e(null, { stack: i, id: r, glyph: n }); var s = Math.floor(r / 256); if (256 * s > 65535) e(new Error("glyphs > 65535 not supported")); else { var l = a.requests[s]; l || (l = a.requests[s] = [], y.loadGlyphRange(i, s, o.url, o.requestManager, (function (t, e) { if (e) for (var i in e) o._doesCharSupportLocalGlyph(+i) || (a.glyphs[+i] = e[+i]); for (var r = 0, n = l; r < n.length; r += 1) { (0, n[r])(t, e); } delete a.requests[s]; }))), l.push((function (t, o) { t ? e(t) : o && e(null, { stack: i, id: r, glyph: o[r] || null }); })); } } else e(null, { stack: i, id: r, glyph: n }); }), (function (t, e) { if (t) i(t); else if (e) { for (var o = {}, r = 0, a = e; r < a.length; r += 1) { var n = a[r], s = n.stack, l = n.id, c = n.glyph; (o[s] || (o[s] = {}))[l] = c && { id: c.id, bitmap: c.bitmap.clone(), metrics: c.metrics }; } i(null, o); } })); }, y.prototype._doesCharSupportLocalGlyph = function (e) { return !!this.localIdeographFontFamily && (t.isChar["CJK Unified Ideographs"](e) || t.isChar["Hangul Syllables"](e) || t.isChar.Hiragana(e) || t.isChar.Katakana(e)) }, y.prototype._tinySDF = function (e, i, o) { var r = this.localIdeographFontFamily; if (r && this._doesCharSupportLocalGlyph(o)) { var a = e.tinySDF; if (!a) { var n = "400"; /bold/i.test(i) ? n = "900" : /medium/i.test(i) ? n = "500" : /light/i.test(i) && (n = "200"), a = e.tinySDF = new y.TinySDF(24, 3, 8, .25, r, n); } return { id: o, bitmap: new t.AlphaImage({ width: 30, height: 30 }, a.draw(String.fromCharCode(o))), metrics: { width: 24, height: 24, left: 0, top: -8, advance: 24 } } } }, y.loadGlyphRange = function (e, i, o, r, a) { var n = 256 * i, s = n + 255, l = r.transformRequest(r.normalizeGlyphsURL(o).replace("{fontstack}", e).replace("{range}", n + "-" + s), t.ResourceType.Glyphs); t.getArrayBuffer(l, (function (e, i) { if (e) a(e); else if (i) { for (var o = {}, r = 0, n = t.parseGlyphPBF(i); r < n.length; r += 1) { var s = n[r]; o[s.id] = s; } a(null, o); } })); }, y.TinySDF = d; var x = function () { this.specification = t.styleSpec.light.position; }; x.prototype.possiblyEvaluate = function (e, i) { return t.sphericalToCartesian(e.expression.evaluate(i)) }, x.prototype.interpolate = function (e, i, o) { return { x: t.number(e.x, i.x, o), y: t.number(e.y, i.y, o), z: t.number(e.z, i.z, o) } }; var b = new t.Properties({ anchor: new t.DataConstantProperty(t.styleSpec.light.anchor), position: new x, color: new t.DataConstantProperty(t.styleSpec.light.color), intensity: new t.DataConstantProperty(t.styleSpec.light.intensity) }), w = function (e) { function i(i) { e.call(this), this._transitionable = new t.Transitionable(b), this.setLight(i), this._transitioning = this._transitionable.untransitioned(); } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.getLight = function () { return this._transitionable.serialize() }, i.prototype.setLight = function (e, i) { if (void 0 === i && (i = {}), !this._validate(t.validateLight, e, i)) for (var o in e) { var r = e[o]; t.endsWith(o, "-transition") ? this._transitionable.setTransition(o.slice(0, -"-transition".length), r) : this._transitionable.setValue(o, r); } }, i.prototype.updateTransitions = function (t) { this._transitioning = this._transitionable.transitioned(t, this._transitioning); }, i.prototype.hasTransition = function () { return this._transitioning.hasTransition() }, i.prototype.recalculate = function (t) { this.properties = this._transitioning.possiblyEvaluate(t); }, i.prototype._validate = function (e, i, o) { return (!o || !1 !== o.validate) && t.emitValidationErrors(this, e.call(t.validateStyle, t.extend({ value: i, style: { glyphs: !0, sprite: !0 }, styleSpec: t.styleSpec }))) }, i }(t.Evented), E = function (t, e) { this.width = t, this.height = e, this.nextRow = 0, this.bytes = 4, this.data = new Uint8Array(this.width * this.height * this.bytes), this.positions = {}; }; E.prototype.getDash = function (t, e) { var i = t.join(",") + String(e); return this.positions[i] || (this.positions[i] = this.addDash(t, e)), this.positions[i] }, E.prototype.addDash = function (e, i) { var o = i ? 7 : 0, r = 2 * o + 1; if (this.nextRow + r > this.height) return t.warnOnce("LineAtlas out of space"), null; for (var a = 0, n = 0; n < e.length; n++)a += e[n]; for (var s = this.width / a, l = s / 2, c = e.length % 2 == 1, u = -o; u <= o; u++)for (var h = this.nextRow + o + u, p = this.width * h, d = c ? -e[e.length - 1] : 0, _ = e[0], f = 1, m = 0; m < this.width; m++) { for (; _ < m / s;)d = _, _ += e[f], c && f === e.length - 1 && (_ += e[0]), f++; var g = Math.abs(m - d * s), v = Math.abs(m - _ * s), y = Math.min(g, v), x = f % 2 == 1, b = void 0; if (i) { var w = o ? u / o * (l + 1) : 0; if (x) { var E = l - Math.abs(w); b = Math.sqrt(y * y + E * E); } else b = l - Math.sqrt(y * y + w * w); } else b = (x ? 1 : -1) * y; this.data[3 + 4 * (p + m)] = Math.max(0, Math.min(255, b + 128)); } var T = { y: (this.nextRow + o + .5) / this.height, height: 2 * o / this.height, width: a }; return this.nextRow += r, this.dirty = !0, T }, E.prototype.bind = function (t) { var e = t.gl; this.texture ? (e.bindTexture(e.TEXTURE_2D, this.texture), this.dirty && (this.dirty = !1, e.texSubImage2D(e.TEXTURE_2D, 0, 0, 0, this.width, this.height, e.RGBA, e.UNSIGNED_BYTE, this.data))) : (this.texture = e.createTexture(), e.bindTexture(e.TEXTURE_2D, this.texture), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.REPEAT), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.REPEAT), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.LINEAR), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, this.width, this.height, 0, e.RGBA, e.UNSIGNED_BYTE, this.data)); }; var T = function e(i, o) { this.workerPool = i, this.actors = [], this.currentActor = 0, this.id = t.uniqueId(); for (var r = this.workerPool.acquire(this.id), a = 0; a < r.length; a++) { var n = r[a], s = new e.Actor(n, o, this.id); s.name = "Worker " + a, this.actors.push(s); } }; function I(e, i, o) { var r = function (r, a) { if (r) return o(r); if (a) { var n = t.pick(t.extend(a, e), ["tiles", "minzoom", "maxzoom", "attribution", "mapbox_logo", "bounds", "scheme", "tileSize", "encoding"]); a.vector_layers && (n.vectorLayers = a.vector_layers, n.vectorLayerIds = n.vectorLayers.map((function (t) { return t.id }))), e.url && (n.tiles = i.canonicalizeTileset(n, e.url)), o(null, n); } }; return e.url ? t.getJSON(i.transformRequest(i.normalizeSourceURL(e.url), t.ResourceType.Source), r) : t.browser.frame((function () { return r(null, e) })) } T.prototype.broadcast = function (e, i, o) { o = o || function () { }, t.asyncAll(this.actors, (function (t, o) { t.send(e, i, o); }), o); }, T.prototype.getActor = function () { return this.currentActor = (this.currentActor + 1) % this.actors.length, this.actors[this.currentActor] }, T.prototype.remove = function () { this.actors.forEach((function (t) { t.remove(); })), this.actors = [], this.workerPool.release(this.id); }, T.Actor = t.Actor; var C = function (e, i, o) { this.bounds = t.LngLatBounds.convert(this.validateBounds(e)), this.minzoom = i || 0, this.maxzoom = o || 24; }; C.prototype.validateBounds = function (t) { return Array.isArray(t) && 4 === t.length ? [Math.max(-180, t[0]), Math.max(-90, t[1]), Math.min(180, t[2]), Math.min(90, t[3])] : [-180, -90, 180, 90] }, C.prototype.contains = function (e) { var i = Math.pow(2, e.z), o = Math.floor(t.mercatorXfromLng(this.bounds.getWest()) * i), r = Math.floor(t.mercatorYfromLat(this.bounds.getNorth()) * i), a = Math.ceil(t.mercatorXfromLng(this.bounds.getEast()) * i), n = Math.ceil(t.mercatorYfromLat(this.bounds.getSouth()) * i); return e.x >= o && e.x < a && e.y >= r && e.y < n }; var S = function (e) { function i(i, o, r, a) { if (e.call(this), this.id = i, this.dispatcher = r, this.type = "vector", this.minzoom = 0, this.maxzoom = 22, this.scheme = "xyz", this.tileSize = 512, this.reparseOverscaled = !0, this.isTileClipped = !0, this._loaded = !1, t.extend(this, t.pick(o, ["url", "scheme", "tileSize"])), this._options = t.extend({ type: "vector" }, o), this._collectResourceTiming = o.collectResourceTiming, 512 !== this.tileSize) throw new Error("vector tile sources must have a tileSize of 512"); this.setEventedParent(a); } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.load = function () { var e = this; this._loaded = !1, this.fire(new t.Event("dataloading", { dataType: "source" })), this._tileJSONRequest = I(this._options, this.map._requestManager, (function (i, o) { e._tileJSONRequest = null, e._loaded = !0, i ? e.fire(new t.ErrorEvent(i)) : o && (t.extend(e, o), o.bounds && (e.tileBounds = new C(o.bounds, e.minzoom, e.maxzoom)), t.postTurnstileEvent(o.tiles, e.map._requestManager._customAccessToken), t.postMapLoadEvent(o.tiles, e.map._getMapId(), e.map._requestManager._skuToken, e.map._requestManager._customAccessToken), e.fire(new t.Event("data", { dataType: "source", sourceDataType: "metadata" })), e.fire(new t.Event("data", { dataType: "source", sourceDataType: "content" }))); })); }, i.prototype.loaded = function () { return this._loaded }, i.prototype.hasTile = function (t) { return !this.tileBounds || this.tileBounds.contains(t.canonical) }, i.prototype.onAdd = function (t) { this.map = t, this.load(); }, i.prototype.onRemove = function () { this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null); }, i.prototype.serialize = function () { return t.extend({}, this._options) }, i.prototype.loadTile = function (e, i) { var o = this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles, this.scheme), this.url, null), r = { request: this.map._requestManager.transformRequest(o, t.ResourceType.Tile), uid: e.uid, tileID: e.tileID, zoom: e.tileID.overscaledZ, tileSize: this.tileSize * e.tileID.overscaleFactor(), type: this.type, source: this.id, pixelRatio: t.browser.devicePixelRatio, showCollisionBoxes: this.map.showCollisionBoxes }; function a(o, r) { return delete e.request, e.aborted ? i(null) : o && 404 !== o.status ? i(o) : (r && r.resourceTiming && (e.resourceTiming = r.resourceTiming), this.map._refreshExpiredTiles && r && e.setExpiryData(r), e.loadVectorData(r, this.map.painter), t.cacheEntryPossiblyAdded(this.dispatcher), i(null), void (e.reloadCallback && (this.loadTile(e, e.reloadCallback), e.reloadCallback = null))) } r.request.collectResourceTiming = this._collectResourceTiming, e.actor && "expired" !== e.state ? "loading" === e.state ? e.reloadCallback = i : e.request = e.actor.send("reloadTile", r, a.bind(this)) : (e.actor = this.dispatcher.getActor(), e.request = e.actor.send("loadTile", r, a.bind(this))); }, i.prototype.abortTile = function (t) { t.request && (t.request.cancel(), delete t.request), t.actor && t.actor.send("abortTile", { uid: t.uid, type: this.type, source: this.id }, void 0); }, i.prototype.unloadTile = function (t) { t.unloadVectorData(), t.clearMask(), t.actor && t.actor.send("removeTile", { uid: t.uid, type: this.type, source: this.id }, void 0); }, i.prototype.hasTransition = function () { return !1 }, i }(t.Evented), P = function (e) { function i(i, o, r, a) { e.call(this), this.id = i, this.dispatcher = r, this.setEventedParent(a), this.type = "raster", this.minzoom = 0, this.maxzoom = 22, this.roundZoom = !0, this.scheme = "xyz", this.tileSize = 512, this._loaded = !1, this._options = t.extend({ type: "raster" }, o), t.extend(this, t.pick(o, ["url", "scheme", "tileSize"])); } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.load = function () { var e = this; this._loaded = !1, this.fire(new t.Event("dataloading", { dataType: "source" })), this._tileJSONRequest = I(this._options, this.map._requestManager, (function (i, o) { e._tileJSONRequest = null, e._loaded = !0, i ? e.fire(new t.ErrorEvent(i)) : o && (t.extend(e, o), o.bounds && (e.tileBounds = new C(o.bounds, e.minzoom, e.maxzoom)), t.postTurnstileEvent(o.tiles), t.postMapLoadEvent(o.tiles, e.map._getMapId(), e.map._requestManager._skuToken), e.fire(new t.Event("data", { dataType: "source", sourceDataType: "metadata" })), e.fire(new t.Event("data", { dataType: "source", sourceDataType: "content" }))); })); }, i.prototype.loaded = function () { return this._loaded }, i.prototype.onAdd = function (t) { this.map = t, this.load(); }, i.prototype.onRemove = function () { this._tileJSONRequest && (this._tileJSONRequest.cancel(), this._tileJSONRequest = null); }, i.prototype.serialize = function () { return t.extend({}, this._options) }, i.prototype.hasTile = function (t) { return !this.tileBounds || this.tileBounds.contains(t.canonical) }, i.prototype.loadTile = function (e, i) { var o = this, r = this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles, this.scheme), this.url, this.tileSize); e.request = t.getImage(this.map._requestManager.transformRequest(r, t.ResourceType.Tile), (function (r, a) { if (delete e.request, e.aborted) e.state = "unloaded", i(null); else if (r) e.state = "errored", i(r); else if (a) { o.map._refreshExpiredTiles && e.setExpiryData(a), delete a.cacheControl, delete a.expires; var n = o.map.painter.context, s = n.gl; e.texture = o.map.painter.getTileTexture(a.width), e.texture ? e.texture.update(a, { useMipmap: !0 }) : (e.texture = new t.Texture(n, a, s.RGBA, { useMipmap: !0 }), e.texture.bind(s.LINEAR, s.CLAMP_TO_EDGE, s.LINEAR_MIPMAP_NEAREST), n.extTextureFilterAnisotropic && s.texParameterf(s.TEXTURE_2D, n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT, n.extTextureFilterAnisotropicMax)), e.state = "loaded", t.cacheEntryPossiblyAdded(o.dispatcher), i(null); } })); }, i.prototype.abortTile = function (t, e) { t.request && (t.request.cancel(), delete t.request), e(); }, i.prototype.unloadTile = function (t, e) { t.texture && this.map.painter.saveTileTexture(t.texture), t.clearMask(), e(); }, i.prototype.hasTransition = function () { return !1 }, i }(t.Evented), z = function (e) { function i(i, o, r, a) { e.call(this, i, o, r, a), this.type = "raster-dem", this.maxzoom = 22, this._options = t.extend({ type: "raster-dem" }, o), this.encoding = o.encoding || "mapbox"; } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.serialize = function () { return { type: "raster-dem", url: this.url, tileSize: this.tileSize, tiles: this.tiles, bounds: this.bounds, encoding: this.encoding } }, i.prototype.loadTile = function (e, i) { var o = this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles, this.scheme), this.url, this.tileSize); function r(t, o) { t && (e.state = "errored", i(t)), o && (e.dem = o, e.needsHillshadePrepare = !0, e.state = "loaded", i(null)); } e.request = t.getImage(this.map._requestManager.transformRequest(o, t.ResourceType.Tile), function (o, a) { if (delete e.request, e.aborted) e.state = "unloaded", i(null); else if (o) e.state = "errored", i(o); else if (a) { this.map._refreshExpiredTiles && e.setExpiryData(a), delete a.cacheControl, delete a.expires; var n = t.browser.getImageData(a, 1), s = { uid: e.uid, coord: e.tileID, source: this.id, rawImageData: n, encoding: this.encoding }; e.actor && "expired" !== e.state || (e.actor = this.dispatcher.getActor(), e.actor.send("loadDEMTile", s, r.bind(this))); } }.bind(this)), e.neighboringTiles = this._getNeighboringTiles(e.tileID); }, i.prototype._getNeighboringTiles = function (e) { var i = e.canonical, o = Math.pow(2, i.z), r = (i.x - 1 + o) % o, a = 0 === i.x ? e.wrap - 1 : e.wrap, n = (i.x + 1 + o) % o, s = i.x + 1 === o ? e.wrap + 1 : e.wrap, l = {}; return l[new t.OverscaledTileID(e.overscaledZ, a, i.z, r, i.y).key] = { backfilled: !1 }, l[new t.OverscaledTileID(e.overscaledZ, s, i.z, n, i.y).key] = { backfilled: !1 }, i.y > 0 && (l[new t.OverscaledTileID(e.overscaledZ, a, i.z, r, i.y - 1).key] = { backfilled: !1 }, l[new t.OverscaledTileID(e.overscaledZ, e.wrap, i.z, i.x, i.y - 1).key] = { backfilled: !1 }, l[new t.OverscaledTileID(e.overscaledZ, s, i.z, n, i.y - 1).key] = { backfilled: !1 }), i.y + 1 < o && (l[new t.OverscaledTileID(e.overscaledZ, a, i.z, r, i.y + 1).key] = { backfilled: !1 }, l[new t.OverscaledTileID(e.overscaledZ, e.wrap, i.z, i.x, i.y + 1).key] = { backfilled: !1 }, l[new t.OverscaledTileID(e.overscaledZ, s, i.z, n, i.y + 1).key] = { backfilled: !1 }), l }, i.prototype.unloadTile = function (t) { t.demTexture && this.map.painter.saveTileTexture(t.demTexture), t.fbo && (t.fbo.destroy(), delete t.fbo), t.dem && delete t.dem, delete t.neighboringTiles, t.clearMask(), t.state = "unloaded", t.actor && t.actor.send("removeDEMTile", { uid: t.uid, source: this.id }); }, i }(P), L = function (e) { function i(i, o, r, a) { e.call(this), this.id = i, this.type = "geojson", this.minzoom = 0, this.maxzoom = 18, this.tileSize = 512, this.isTileClipped = !0, this.reparseOverscaled = !0, this._removed = !1, this._loaded = !1, this.actor = r.getActor(), this.setEventedParent(a), this._data = o.data, this._options = t.extend({}, o), this._collectResourceTiming = o.collectResourceTiming, this._resourceTiming = [], void 0 !== o.maxzoom && (this.maxzoom = o.maxzoom), o.type && (this.type = o.type), o.attribution && (this.attribution = o.attribution); var n = t.EXTENT / this.tileSize; this.workerOptions = t.extend({ source: this.id, cluster: o.cluster || !1, geojsonVtOptions: { buffer: (void 0 !== o.buffer ? o.buffer : 128) * n, tolerance: (void 0 !== o.tolerance ? o.tolerance : .375) * n, extent: t.EXTENT, maxZoom: this.maxzoom, lineMetrics: o.lineMetrics || !1, generateId: o.generateId || !1 }, superclusterOptions: { maxZoom: void 0 !== o.clusterMaxZoom ? Math.min(o.clusterMaxZoom, this.maxzoom - 1) : this.maxzoom - 1, extent: t.EXTENT, radius: (o.clusterRadius || 50) * n, log: !1, generateId: o.generateId || !1 }, clusterProperties: o.clusterProperties }, o.workerOptions); } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.load = function () { var e = this; this.fire(new t.Event("dataloading", { dataType: "source" })), this._updateWorkerData((function (i) { if (i) e.fire(new t.ErrorEvent(i)); else { var o = { dataType: "source", sourceDataType: "metadata" }; e._collectResourceTiming && e._resourceTiming && e._resourceTiming.length > 0 && (o.resourceTiming = e._resourceTiming, e._resourceTiming = []), e.fire(new t.Event("data", o)); } })); }, i.prototype.onAdd = function (t) { this.map = t, this.load(); }, i.prototype.setData = function (e) { var i = this; return this._data = e, this.fire(new t.Event("dataloading", { dataType: "source" })), this._updateWorkerData((function (e) { if (e) i.fire(new t.ErrorEvent(e)); else { var o = { dataType: "source", sourceDataType: "content" }; i._collectResourceTiming && i._resourceTiming && i._resourceTiming.length > 0 && (o.resourceTiming = i._resourceTiming, i._resourceTiming = []), i.fire(new t.Event("data", o)); } })), this }, i.prototype.getClusterExpansionZoom = function (t, e) { return this.actor.send("geojson.getClusterExpansionZoom", { clusterId: t, source: this.id }, e), this }, i.prototype.getClusterChildren = function (t, e) { return this.actor.send("geojson.getClusterChildren", { clusterId: t, source: this.id }, e), this }, i.prototype.getClusterLeaves = function (t, e, i, o) { return this.actor.send("geojson.getClusterLeaves", { source: this.id, clusterId: t, limit: e, offset: i }, o), this }, i.prototype._updateWorkerData = function (e) { var i = this; this._loaded = !1; var o = t.extend({}, this.workerOptions), r = this._data; "string" == typeof r ? (o.request = this.map._requestManager.transformRequest(t.browser.resolveURL(r), t.ResourceType.Source), o.request.collectResourceTiming = this._collectResourceTiming) : o.data = JSON.stringify(r), this.actor.send(this.type + ".loadData", o, (function (t, r) { i._removed || r && r.abandoned || (i._loaded = !0, r && r.resourceTiming && r.resourceTiming[i.id] && (i._resourceTiming = r.resourceTiming[i.id].slice(0)), i.actor.send(i.type + ".coalesce", { source: o.source }, null), e(t)); })); }, i.prototype.loaded = function () { return this._loaded }, i.prototype.loadTile = function (e, i) { var o = this, r = e.actor ? "reloadTile" : "loadTile"; e.actor = this.actor; var a = { type: this.type, uid: e.uid, tileID: e.tileID, zoom: e.tileID.overscaledZ, maxZoom: this.maxzoom, tileSize: this.tileSize, source: this.id, pixelRatio: t.browser.devicePixelRatio, showCollisionBoxes: this.map.showCollisionBoxes }; e.request = this.actor.send(r, a, (function (t, a) { return delete e.request, e.unloadVectorData(), e.aborted ? i(null) : t ? i(t) : (e.loadVectorData(a, o.map.painter, "reloadTile" === r), i(null)) })); }, i.prototype.abortTile = function (t) { t.request && (t.request.cancel(), delete t.request), t.aborted = !0; }, i.prototype.unloadTile = function (t) { t.unloadVectorData(), t.clearMask(), this.actor.send("removeTile", { uid: t.uid, type: this.type, source: this.id }); }, i.prototype.onRemove = function () { this._removed = !0, this.actor.send("removeSource", { type: this.type, source: this.id }); }, i.prototype.serialize = function () { return t.extend({}, this._options, { type: this.type, data: this._data }) }, i.prototype.hasTransition = function () { return !1 }, i }(t.Evented), M = function (e) { function i(t, i, o, r) { e.call(this), this.id = t, this.dispatcher = o, this.coordinates = i.coordinates, this.type = "image", this.minzoom = 0, this.maxzoom = 22, this.tileSize = 512, this.tiles = {}, this._loaded = !1, this.setEventedParent(r), this.options = i; } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.load = function (e, i) { var o = this; this._loaded = !1, this.fire(new t.Event("dataloading", { dataType: "source" })), this.url = this.options.url, t.getImage(this.map._requestManager.transformRequest(this.url, t.ResourceType.Image), (function (r, a) { o._loaded = !0, r ? o.fire(new t.ErrorEvent(r)) : a && (o.image = a, e && (o.coordinates = e), i && i(), o._finishLoading()); })); }, i.prototype.loaded = function () { return this._loaded }, i.prototype.updateImage = function (t) { var e = this; return this.image && t.url ? (this.options.url = t.url, this.load(t.coordinates, (function () { e.texture = null; })), this) : this }, i.prototype._finishLoading = function () { this.map && (this.setCoordinates(this.coordinates), this.fire(new t.Event("data", { dataType: "source", sourceDataType: "metadata" }))); }, i.prototype.onAdd = function (t) { this.map = t, this.load(); }, i.prototype.setCoordinates = function (e) { var i = this; this.coordinates = e; var o = e.map(t.MercatorCoordinate.fromLngLat); this.tileID = function (e) { for (var i = 1 / 0, o = 1 / 0, r = -1 / 0, a = -1 / 0, n = 0, s = e; n < s.length; n += 1) { var l = s[n]; i = Math.min(i, l.x), o = Math.min(o, l.y), r = Math.max(r, l.x), a = Math.max(a, l.y); } var c = r - i, u = a - o, h = Math.max(c, u), p = Math.max(0, Math.floor(-Math.log(h) / Math.LN2)), d = Math.pow(2, p); return new t.CanonicalTileID(p, Math.floor((i + r) / 2 * d), Math.floor((o + a) / 2 * d)) }(o), this.minzoom = this.maxzoom = this.tileID.z; var r = o.map((function (t) { return i.tileID.getTilePoint(t)._round() })); return this._boundsArray = new t.StructArrayLayout4i8, this._boundsArray.emplaceBack(r[0].x, r[0].y, 0, 0), this._boundsArray.emplaceBack(r[1].x, r[1].y, t.EXTENT, 0), this._boundsArray.emplaceBack(r[3].x, r[3].y, 0, t.EXTENT), this._boundsArray.emplaceBack(r[2].x, r[2].y, t.EXTENT, t.EXTENT), this.boundsBuffer && (this.boundsBuffer.destroy(), delete this.boundsBuffer), this.fire(new t.Event("data", { dataType: "source", sourceDataType: "content" })), this }, i.prototype.prepare = function () { if (0 !== Object.keys(this.tiles).length && this.image) { var e = this.map.painter.context, i = e.gl; for (var o in this.boundsBuffer || (this.boundsBuffer = e.createVertexBuffer(this._boundsArray, t.rasterBoundsAttributes.members)), this.boundsSegments || (this.boundsSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2)), this.texture || (this.texture = new t.Texture(e, this.image, i.RGBA), this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE)), this.tiles) { var r = this.tiles[o]; "loaded" !== r.state && (r.state = "loaded", r.texture = this.texture); } } }, i.prototype.loadTile = function (t, e) { this.tileID && this.tileID.equals(t.tileID.canonical) ? (this.tiles[String(t.tileID.wrap)] = t, t.buckets = {}, e(null)) : (t.state = "errored", e(null)); }, i.prototype.serialize = function () { return { type: "image", url: this.options.url, coordinates: this.coordinates } }, i.prototype.hasTransition = function () { return !1 }, i }(t.Evented); var D = function (e) { function i(t, i, o, r) { e.call(this, t, i, o, r), this.roundZoom = !0, this.type = "video", this.options = i; } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.load = function () { var e = this; this._loaded = !1; var i = this.options; this.urls = []; for (var o = 0, r = i.urls; o < r.length; o += 1) { var a = r[o]; this.urls.push(this.map._requestManager.transformRequest(a, t.ResourceType.Source).url); } t.getVideo(this.urls, (function (i, o) { e._loaded = !0, i ? e.fire(new t.ErrorEvent(i)) : o && (e.video = o, e.video.loop = !0, e.video.addEventListener("playing", (function () { e.map.triggerRepaint(); })), e.map && e.video.play(), e._finishLoading()); })); }, i.prototype.pause = function () { this.video && this.video.pause(); }, i.prototype.play = function () { this.video && this.video.play(); }, i.prototype.seek = function (e) { if (this.video) { var i = this.video.seekable; e < i.start(0) || e > i.end(0) ? this.fire(new t.ErrorEvent(new t.ValidationError("sources." + this.id, null, "Playback for this video can be set only between the " + i.start(0) + " and " + i.end(0) + "-second mark."))) : this.video.currentTime = e; } }, i.prototype.getVideo = function () { return this.video }, i.prototype.onAdd = function (t) { this.map || (this.map = t, this.load(), this.video && (this.video.play(), this.setCoordinates(this.coordinates))); }, i.prototype.prepare = function () { if (!(0 === Object.keys(this.tiles).length || this.video.readyState < 2)) { var e = this.map.painter.context, i = e.gl; for (var o in this.boundsBuffer || (this.boundsBuffer = e.createVertexBuffer(this._boundsArray, t.rasterBoundsAttributes.members)), this.boundsSegments || (this.boundsSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2)), 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 t.Texture(e, this.video, i.RGBA), this.texture.bind(i.LINEAR, i.CLAMP_TO_EDGE)), this.tiles) { var r = this.tiles[o]; "loaded" !== r.state && (r.state = "loaded", r.texture = this.texture); } } }, i.prototype.serialize = function () { return { type: "video", urls: this.urls, coordinates: this.coordinates } }, i.prototype.hasTransition = function () { return this.video && !this.video.paused }, i }(M), A = function (e) { function i(i, o, r, a) { e.call(this, i, o, r, a), o.coordinates ? Array.isArray(o.coordinates) && 4 === o.coordinates.length && !o.coordinates.some((function (t) { return !Array.isArray(t) || 2 !== t.length || t.some((function (t) { return "number" != typeof t })) })) || this.fire(new t.ErrorEvent(new t.ValidationError("sources." + i, null, '"coordinates" property must be an array of 4 longitude/latitude array pairs'))) : this.fire(new t.ErrorEvent(new t.ValidationError("sources." + i, null, 'missing required property "coordinates"'))), o.animate && "boolean" != typeof o.animate && this.fire(new t.ErrorEvent(new t.ValidationError("sources." + i, null, 'optional "animate" property must be a boolean value'))), o.canvas ? "string" == typeof o.canvas || o.canvas instanceof t.window.HTMLCanvasElement || this.fire(new t.ErrorEvent(new t.ValidationError("sources." + i, 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 t.ErrorEvent(new t.ValidationError("sources." + i, null, 'missing required property "canvas"'))), this.options = o, this.animate = void 0 === o.animate || o.animate; } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.load = function () { this._loaded = !0, this.canvas || (this.canvas = this.options.canvas instanceof t.window.HTMLCanvasElement ? this.options.canvas : t.window.document.getElementById(this.options.canvas)), this.width = this.canvas.width, this.height = this.canvas.height, this._hasInvalidDimensions() ? this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))) : (this.play = function () { this._playing = !0, this.map.triggerRepaint(); }, this.pause = function () { this._playing && (this.prepare(), this._playing = !1); }, this._finishLoading()); }, i.prototype.getCanvas = function () { return this.canvas }, i.prototype.onAdd = function (t) { this.map = t, this.load(), this.canvas && this.animate && this.play(); }, i.prototype.onRemove = function () { this.pause(); }, i.prototype.prepare = function () { var e = !1; if (this.canvas.width !== this.width && (this.width = this.canvas.width, e = !0), this.canvas.height !== this.height && (this.height = this.canvas.height, e = !0), !this._hasInvalidDimensions() && 0 !== Object.keys(this.tiles).length) { var i = this.map.painter.context, o = i.gl; for (var r in this.boundsBuffer || (this.boundsBuffer = i.createVertexBuffer(this._boundsArray, t.rasterBoundsAttributes.members)), this.boundsSegments || (this.boundsSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2)), this.texture ? (e || this._playing) && this.texture.update(this.canvas, { premultiply: !0 }) : this.texture = new t.Texture(i, this.canvas, o.RGBA, { premultiply: !0 }), this.tiles) { var a = this.tiles[r]; "loaded" !== a.state && (a.state = "loaded", a.texture = this.texture); } } }, i.prototype.serialize = function () { return { type: "canvas", coordinates: this.coordinates } }, i.prototype.hasTransition = function () { return this._playing }, i.prototype._hasInvalidDimensions = function () { for (var t = 0, e = [this.canvas.width, this.canvas.height]; t < e.length; t += 1) { var i = e[t]; if (isNaN(i) || i <= 0) return !0 } return !1 }, i }(M), R = { vector: S, raster: P, "raster-dem": z, geojson: L, video: D, image: M, canvas: A }, k = function (e, i, o, r) { var a = new R[i.type](e, i, o, r); if (a.id !== e) throw new Error("Expected Source id to be " + e + " instead of " + a.id); return t.bindAll(["load", "abort", "unload", "serialize", "prepare"], a), a }; function B(e, i) { var o = t.identity([]); return t.translate(o, o, [1, 1, 0]), t.scale(o, o, [.5 * e.width, .5 * e.height, 1]), t.multiply(o, o, e.calculatePosMatrix(i.toUnwrapped())) } function O(t, e, i, o, r) { var a = function (t, e, i) { if (t) for (var o = 0, r = t; o < r.length; o += 1) { var a = e[r[o]]; if (a && a.source === i && "fill-extrusion" === a.type) return !0 } else for (var n in e) { var s = e[n]; if (s.source === i && "fill-extrusion" === s.type) return !0 } return !1 }(o && o.layers, e, t.id), n = r.maxPitchScaleFactor(), s = t.tilesIn(i, n, a); s.sort(F); for (var l = [], c = 0, u = s; c < u.length; c += 1) { var h = u[c]; l.push({ wrappedTileID: h.tileID.wrapped().key, queryResults: h.tile.queryRenderedFeatures(e, t._state, h.queryGeometry, h.cameraQueryGeometry, h.scale, o, r, n, B(t.transform, h.tileID)) }); } var p = function (t) { for (var e = {}, i = {}, o = 0, r = t; o < r.length; o += 1) { var a = r[o], n = a.queryResults, s = a.wrappedTileID, l = i[s] = i[s] || {}; for (var c in n) for (var u = n[c], h = l[c] = l[c] || {}, p = e[c] = e[c] || [], d = 0, _ = u; d < _.length; d += 1) { var f = _[d]; h[f.featureIndex] || (h[f.featureIndex] = !0, p.push(f)); } } return e }(l); for (var d in p) p[d].forEach((function (e) { var i = e.feature, o = t.getFeatureState(i.layer["source-layer"], i.id); i.source = i.layer.source, i.layer["source-layer"] && (i.sourceLayer = i.layer["source-layer"]), i.state = o; })); return p } function F(t, e) { var i = t.tileID, o = e.tileID; return i.overscaledZ - o.overscaledZ || i.canonical.y - o.canonical.y || i.wrap - o.wrap || i.canonical.x - o.canonical.x } var U = function (t, e) { this.max = t, this.onRemove = e, this.reset(); }; U.prototype.reset = function () { for (var t in this.data) for (var e = 0, i = this.data[t]; e < i.length; e += 1) { var o = i[e]; o.timeout && clearTimeout(o.timeout), this.onRemove(o.value); } return this.data = {}, this.order = [], this }, U.prototype.add = function (t, e, i) { var o = this, r = t.wrapped().key; void 0 === this.data[r] && (this.data[r] = []); var a = { value: e, timeout: void 0 }; if (void 0 !== i && (a.timeout = setTimeout((function () { o.remove(t, a); }), i)), this.data[r].push(a), this.order.push(r), this.order.length > this.max) { var n = this._getAndRemoveByKey(this.order[0]); n && this.onRemove(n); } return this }, U.prototype.has = function (t) { return t.wrapped().key in this.data }, U.prototype.getAndRemove = function (t) { return this.has(t) ? this._getAndRemoveByKey(t.wrapped().key) : null }, U.prototype._getAndRemoveByKey = function (t) { var e = this.data[t].shift(); return e.timeout && clearTimeout(e.timeout), 0 === this.data[t].length && delete this.data[t], this.order.splice(this.order.indexOf(t), 1), e.value }, U.prototype.get = function (t) { return this.has(t) ? this.data[t.wrapped().key][0].value : null }, U.prototype.remove = function (t, e) { if (!this.has(t)) return this; var i = t.wrapped().key, o = void 0 === e ? 0 : this.data[i].indexOf(e), r = this.data[i][o]; return this.data[i].splice(o, 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 }, U.prototype.setMaxSize = function (t) { for (this.max = t; this.order.length > this.max;) { var e = this._getAndRemoveByKey(this.order[0]); e && this.onRemove(e); } return this }, U.prototype.filter = function (t) { var e = []; for (var i in this.data) for (var o = 0, r = this.data[i]; o < r.length; o += 1) { var a = r[o]; t(a.value) || e.push(a); } for (var n = 0, s = e; n < s.length; n += 1) { var l = s[n]; this.remove(l.value.tileID, l); } }; var N = function (t, e, i) { this.context = t; var o = t.gl; this.buffer = o.createBuffer(), this.dynamicDraw = Boolean(i), this.context.unbindVAO(), t.bindElementBuffer.set(this.buffer), o.bufferData(o.ELEMENT_ARRAY_BUFFER, e.arrayBuffer, this.dynamicDraw ? o.DYNAMIC_DRAW : o.STATIC_DRAW), this.dynamicDraw || delete e.arrayBuffer; }; N.prototype.bind = function () { this.context.bindElementBuffer.set(this.buffer); }, N.prototype.updateData = function (t) { var e = this.context.gl; this.context.unbindVAO(), this.bind(), e.bufferSubData(e.ELEMENT_ARRAY_BUFFER, 0, t.arrayBuffer); }, N.prototype.destroy = function () { var t = this.context.gl; this.buffer && (t.deleteBuffer(this.buffer), delete this.buffer); }; var Z = { Int8: "BYTE", Uint8: "UNSIGNED_BYTE", Int16: "SHORT", Uint16: "UNSIGNED_SHORT", Int32: "INT", Uint32: "UNSIGNED_INT", Float32: "FLOAT" }, q = function (t, e, i, o) { this.length = e.length, this.attributes = i, this.itemSize = e.bytesPerElement, this.dynamicDraw = o, this.context = t; var r = t.gl; this.buffer = r.createBuffer(), t.bindVertexBuffer.set(this.buffer), r.bufferData(r.ARRAY_BUFFER, e.arrayBuffer, this.dynamicDraw ? r.DYNAMIC_DRAW : r.STATIC_DRAW), this.dynamicDraw || delete e.arrayBuffer; }; q.prototype.bind = function () { this.context.bindVertexBuffer.set(this.buffer); }, q.prototype.updateData = function (t) { var e = this.context.gl; this.bind(), e.bufferSubData(e.ARRAY_BUFFER, 0, t.arrayBuffer); }, q.prototype.enableAttributes = function (t, e) { for (var i = 0; i < this.attributes.length; i++) { var o = this.attributes[i], r = e.attributes[o.name]; void 0 !== r && t.enableVertexAttribArray(r); } }, q.prototype.setVertexAttribPointers = function (t, e, i) { for (var o = 0; o < this.attributes.length; o++) { var r = this.attributes[o], a = e.attributes[r.name]; void 0 !== a && t.vertexAttribPointer(a, r.components, t[Z[r.type]], !1, this.itemSize, r.offset + this.itemSize * (i || 0)); } }, q.prototype.destroy = function () { var t = this.context.gl; this.buffer && (t.deleteBuffer(this.buffer), delete this.buffer); }; var j = function (t) { this.gl = t.gl, this.default = this.getDefault(), this.current = this.default, this.dirty = !1; }; j.prototype.get = function () { return this.current }, j.prototype.set = function (t) { }, j.prototype.getDefault = function () { return this.default }, j.prototype.setDefault = function () { this.set(this.default); }; var V = function (e) { function i() { e.apply(this, arguments); } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.getDefault = function () { return t.Color.transparent }, i.prototype.set = function (t) { var e = this.current; (t.r !== e.r || t.g !== e.g || t.b !== e.b || t.a !== e.a || this.dirty) && (this.gl.clearColor(t.r, t.g, t.b, t.a), this.current = t, this.dirty = !1); }, i }(j), G = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return 1 }, e.prototype.set = function (t) { (t !== this.current || this.dirty) && (this.gl.clearDepth(t), this.current = t, this.dirty = !1); }, e }(j), W = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return 0 }, e.prototype.set = function (t) { (t !== this.current || this.dirty) && (this.gl.clearStencil(t), this.current = t, this.dirty = !1); }, e }(j), X = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return [!0, !0, !0, !0] }, e.prototype.set = function (t) { var e = this.current; (t[0] !== e[0] || t[1] !== e[1] || t[2] !== e[2] || t[3] !== e[3] || this.dirty) && (this.gl.colorMask(t[0], t[1], t[2], t[3]), this.current = t, this.dirty = !1); }, e }(j), H = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return !0 }, e.prototype.set = function (t) { (t !== this.current || this.dirty) && (this.gl.depthMask(t), this.current = t, this.dirty = !1); }, e }(j), K = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return 255 }, e.prototype.set = function (t) { (t !== this.current || this.dirty) && (this.gl.stencilMask(t), this.current = t, this.dirty = !1); }, e }(j), Y = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return { func: this.gl.ALWAYS, ref: 0, mask: 255 } }, e.prototype.set = function (t) { var e = this.current; (t.func !== e.func || t.ref !== e.ref || t.mask !== e.mask || this.dirty) && (this.gl.stencilFunc(t.func, t.ref, t.mask), this.current = t, this.dirty = !1); }, e }(j), J = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { var t = this.gl; return [t.KEEP, t.KEEP, t.KEEP] }, e.prototype.set = function (t) { var e = this.current; (t[0] !== e[0] || t[1] !== e[1] || t[2] !== e[2] || this.dirty) && (this.gl.stencilOp(t[0], t[1], t[2]), this.current = t, this.dirty = !1); }, e }(j), Q = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return !1 }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; t ? e.enable(e.STENCIL_TEST) : e.disable(e.STENCIL_TEST), this.current = t, this.dirty = !1; } }, e }(j), $ = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return [0, 1] }, e.prototype.set = function (t) { var e = this.current; (t[0] !== e[0] || t[1] !== e[1] || this.dirty) && (this.gl.depthRange(t[0], t[1]), this.current = t, this.dirty = !1); }, e }(j), tt = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return !1 }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; t ? e.enable(e.DEPTH_TEST) : e.disable(e.DEPTH_TEST), this.current = t, this.dirty = !1; } }, e }(j), et = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return this.gl.LESS }, e.prototype.set = function (t) { (t !== this.current || this.dirty) && (this.gl.depthFunc(t), this.current = t, this.dirty = !1); }, e }(j), it = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return !1 }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; t ? e.enable(e.BLEND) : e.disable(e.BLEND), this.current = t, this.dirty = !1; } }, e }(j), ot = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { var t = this.gl; return [t.ONE, t.ZERO] }, e.prototype.set = function (t) { var e = this.current; (t[0] !== e[0] || t[1] !== e[1] || this.dirty) && (this.gl.blendFunc(t[0], t[1]), this.current = t, this.dirty = !1); }, e }(j), rt = function (e) { function i() { e.apply(this, arguments); } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.getDefault = function () { return t.Color.transparent }, i.prototype.set = function (t) { var e = this.current; (t.r !== e.r || t.g !== e.g || t.b !== e.b || t.a !== e.a || this.dirty) && (this.gl.blendColor(t.r, t.g, t.b, t.a), this.current = t, this.dirty = !1); }, i }(j), at = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return this.gl.FUNC_ADD }, e.prototype.set = function (t) { (t !== this.current || this.dirty) && (this.gl.blendEquation(t), this.current = t, this.dirty = !1); }, e }(j), nt = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return !1 }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; t ? e.enable(e.CULL_FACE) : e.disable(e.CULL_FACE), this.current = t, this.dirty = !1; } }, e }(j), st = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return this.gl.BACK }, e.prototype.set = function (t) { (t !== this.current || this.dirty) && (this.gl.cullFace(t), this.current = t, this.dirty = !1); }, e }(j), lt = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return this.gl.CCW }, e.prototype.set = function (t) { (t !== this.current || this.dirty) && (this.gl.frontFace(t), this.current = t, this.dirty = !1); }, e }(j), ct = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return null }, e.prototype.set = function (t) { (t !== this.current || this.dirty) && (this.gl.useProgram(t), this.current = t, this.dirty = !1); }, e }(j), ut = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return this.gl.TEXTURE0 }, e.prototype.set = function (t) { (t !== this.current || this.dirty) && (this.gl.activeTexture(t), this.current = t, this.dirty = !1); }, e }(j), ht = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { var t = this.gl; return [0, 0, t.drawingBufferWidth, t.drawingBufferHeight] }, e.prototype.set = function (t) { var e = this.current; (t[0] !== e[0] || t[1] !== e[1] || t[2] !== e[2] || t[3] !== e[3] || this.dirty) && (this.gl.viewport(t[0], t[1], t[2], t[3]), this.current = t, this.dirty = !1); }, e }(j), pt = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return null }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; e.bindFramebuffer(e.FRAMEBUFFER, t), this.current = t, this.dirty = !1; } }, e }(j), dt = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return null }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; e.bindRenderbuffer(e.RENDERBUFFER, t), this.current = t, this.dirty = !1; } }, e }(j), _t = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return null }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; e.bindTexture(e.TEXTURE_2D, t), this.current = t, this.dirty = !1; } }, e }(j), ft = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return null }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; e.bindBuffer(e.ARRAY_BUFFER, t), this.current = t, this.dirty = !1; } }, e }(j), mt = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return null }, e.prototype.set = function (t) { var e = this.gl; e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, t), this.current = t, this.dirty = !1; }, e }(j), gt = function (t) { function e(e) { t.call(this, e), this.vao = e.extVertexArrayObject; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return null }, e.prototype.set = function (t) { this.vao && (t !== this.current || this.dirty) && (this.vao.bindVertexArrayOES(t), this.current = t, this.dirty = !1); }, e }(j), vt = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return 4 }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; e.pixelStorei(e.UNPACK_ALIGNMENT, t), this.current = t, this.dirty = !1; } }, e }(j), yt = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return !1 }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t), this.current = t, this.dirty = !1; } }, e }(j), xt = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return !1 }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { var e = this.gl; e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, t), this.current = t, this.dirty = !1; } }, e }(j), bt = function (t) { function e(e, i) { t.call(this, e), this.context = e, this.parent = i; } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDefault = function () { return null }, e }(j), wt = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.setDirty = function () { this.dirty = !0; }, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { this.context.bindFramebuffer.set(this.parent); var e = this.gl; e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, t, 0), this.current = t, this.dirty = !1; } }, e }(bt), Et = function (t) { function e() { t.apply(this, arguments); } return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.set = function (t) { if (t !== this.current || this.dirty) { this.context.bindFramebuffer.set(this.parent); var e = this.gl; e.framebufferRenderbuffer(e.FRAMEBUFFER, e.DEPTH_ATTACHMENT, e.RENDERBUFFER, t), this.current = t, this.dirty = !1; } }, e }(bt), Tt = function (t, e, i) { this.context = t, this.width = e, this.height = i; var o = t.gl, r = this.framebuffer = o.createFramebuffer(); this.colorAttachment = new wt(t, r), this.depthAttachment = new Et(t, r); }; Tt.prototype.destroy = function () { var t = this.context.gl, e = this.colorAttachment.get(); e && t.deleteTexture(e); var i = this.depthAttachment.get(); i && t.deleteRenderbuffer(i), t.deleteFramebuffer(this.framebuffer); }; var It = function (t, e, i) { this.func = t, this.mask = e, this.range = i; }; It.ReadOnly = !1, It.ReadWrite = !0, It.disabled = new It(519, It.ReadOnly, [0, 1]); var Ct = function (t, e, i, o, r, a) { this.test = t, this.ref = e, this.mask = i, this.fail = o, this.depthFail = r, this.pass = a; }; Ct.disabled = new Ct({ func: 519, mask: 0 }, 0, 0, 7680, 7680, 7680); var St = function (t, e, i) { this.blendFunction = t, this.blendColor = e, this.mask = i; }; St.Replace = [1, 0], St.disabled = new St(St.Replace, t.Color.transparent, [!1, !1, !1, !1]), St.unblended = new St(St.Replace, t.Color.transparent, [!0, !0, !0, !0]), St.alphaBlended = new St([1, 771], t.Color.transparent, [!0, !0, !0, !0]); var Pt = function (t, e, i) { this.enable = t, this.mode = e, this.frontFace = i; }; Pt.disabled = new Pt(!1, 1029, 2305), Pt.backCCW = new Pt(!0, 1029, 2305); var zt = function (t) { this.gl = t, this.extVertexArrayObject = this.gl.getExtension("OES_vertex_array_object"), this.clearColor = new V(this), this.clearDepth = new G(this), this.clearStencil = new W(this), this.colorMask = new X(this), this.depthMask = new H(this), this.stencilMask = new K(this), this.stencilFunc = new Y(this), this.stencilOp = new J(this), this.stencilTest = new Q(this), this.depthRange = new $(this), this.depthTest = new tt(this), this.depthFunc = new et(this), this.blend = new it(this), this.blendFunc = new ot(this), this.blendColor = new rt(this), this.blendEquation = new at(this), this.cullFace = new nt(this), this.cullFaceSide = new st(this), this.frontFace = new lt(this), this.program = new ct(this), this.activeTexture = new ut(this), this.viewport = new ht(this), this.bindFramebuffer = new pt(this), this.bindRenderbuffer = new dt(this), this.bindTexture = new _t(this), this.bindVertexBuffer = new ft(this), this.bindElementBuffer = new mt(this), this.bindVertexArrayOES = this.extVertexArrayObject && new gt(this), this.pixelStoreUnpack = new vt(this), this.pixelStoreUnpackPremultiplyAlpha = new yt(this), this.pixelStoreUnpackFlipY = new xt(this), this.extTextureFilterAnisotropic = t.getExtension("EXT_texture_filter_anisotropic") || t.getExtension("MOZ_EXT_texture_filter_anisotropic") || t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"), this.extTextureFilterAnisotropic && (this.extTextureFilterAnisotropicMax = t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)), this.extTextureHalfFloat = t.getExtension("OES_texture_half_float"), this.extTextureHalfFloat && t.getExtension("OES_texture_half_float_linear"), this.extTimerQuery = t.getExtension("EXT_disjoint_timer_query"); }; zt.prototype.setDefault = function () { 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(); }, zt.prototype.setDirty = function () { 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.extVertexArrayObject && (this.bindVertexArrayOES.dirty = !0), this.pixelStoreUnpack.dirty = !0, this.pixelStoreUnpackPremultiplyAlpha.dirty = !0, this.pixelStoreUnpackFlipY.dirty = !0; }, zt.prototype.createIndexBuffer = function (t, e) { return new N(this, t, e) }, zt.prototype.createVertexBuffer = function (t, e, i) { return new q(this, t, e, i) }, zt.prototype.createRenderbuffer = function (t, e, i) { var o = this.gl, r = o.createRenderbuffer(); return this.bindRenderbuffer.set(r), o.renderbufferStorage(o.RENDERBUFFER, t, e, i), this.bindRenderbuffer.set(null), r }, zt.prototype.createFramebuffer = function (t, e) { return new Tt(this, t, e) }, zt.prototype.clear = function (t) { var e = t.color, i = t.depth, o = this.gl, r = 0; e && (r |= o.COLOR_BUFFER_BIT, this.clearColor.set(e), this.colorMask.set([!0, !0, !0, !0])), void 0 !== i && (r |= o.DEPTH_BUFFER_BIT, this.depthRange.set([0, 1]), this.clearDepth.set(i), this.depthMask.set(!0)), o.clear(r); }, zt.prototype.setCullFace = function (t) { !1 === t.enable ? this.cullFace.set(!1) : (this.cullFace.set(!0), this.cullFaceSide.set(t.mode), this.frontFace.set(t.frontFace)); }, zt.prototype.setDepthMode = function (t) { t.func !== this.gl.ALWAYS || t.mask ? (this.depthTest.set(!0), this.depthFunc.set(t.func), this.depthMask.set(t.mask), this.depthRange.set(t.range)) : this.depthTest.set(!1); }, zt.prototype.setStencilMode = function (t) { t.test.func !== this.gl.ALWAYS || t.mask ? (this.stencilTest.set(!0), this.stencilMask.set(t.mask), this.stencilOp.set([t.fail, t.depthFail, t.pass]), this.stencilFunc.set({ func: t.test.func, ref: t.ref, mask: t.test.mask })) : this.stencilTest.set(!1); }, zt.prototype.setColorMode = function (e) { t.deepEqual(e.blendFunction, St.Replace) ? this.blend.set(!1) : (this.blend.set(!0), this.blendFunc.set(e.blendFunction), this.blendColor.set(e.blendColor)), this.colorMask.set(e.mask); }, zt.prototype.unbindVAO = function () { this.extVertexArrayObject && this.bindVertexArrayOES.set(null); }; var Lt = function (e) { function i(i, o, r) { var a = this; e.call(this), this.id = i, this.dispatcher = r, this.on("data", (function (t) { "source" === t.dataType && "metadata" === t.sourceDataType && (a._sourceLoaded = !0), a._sourceLoaded && !a._paused && "source" === t.dataType && "content" === t.sourceDataType && (a.reload(), a.transform && a.update(a.transform)); })), this.on("error", (function () { a._sourceErrored = !0; })), this._source = k(i, o, r, this), this._tiles = {}, this._cache = new U(0, this._unloadTile.bind(this)), this._timers = {}, this._cacheTimers = {}, this._maxTileCacheSize = null, this._coveredTiles = {}, this._state = new t.SourceFeatureState; } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.onAdd = function (t) { this.map = t, this._maxTileCacheSize = t ? t._maxTileCacheSize : null, this._source && this._source.onAdd && this._source.onAdd(t); }, i.prototype.onRemove = function (t) { this._source && this._source.onRemove && this._source.onRemove(t); }, i.prototype.loaded = function () { if (this._sourceErrored) return !0; if (!this._sourceLoaded) return !1; if (!this._source.loaded()) return !1; for (var t in this._tiles) { var e = this._tiles[t]; if ("loaded" !== e.state && "errored" !== e.state) return !1 } return !0 }, i.prototype.getSource = function () { return this._source }, i.prototype.pause = function () { this._paused = !0; }, i.prototype.resume = function () { if (this._paused) { var t = this._shouldReloadOnResume; this._paused = !1, this._shouldReloadOnResume = !1, t && this.reload(), this.transform && this.update(this.transform); } }, i.prototype._loadTile = function (t, e) { return this._source.loadTile(t, e) }, i.prototype._unloadTile = function (t) { if (this._source.unloadTile) return this._source.unloadTile(t, (function () { })) }, i.prototype._abortTile = function (t) { if (this._source.abortTile) return this._source.abortTile(t, (function () { })) }, i.prototype.serialize = function () { return this._source.serialize() }, i.prototype.prepare = function (t) { for (var e in this._source.prepare && this._source.prepare(), this._state.coalesceChanges(this._tiles, this.map ? this.map.painter : null), this._tiles) { var i = this._tiles[e]; i.upload(t), i.prepare(this.map.style.imageManager); } }, i.prototype.getIds = function () { return Object.keys(this._tiles).map(Number).sort(Mt) }, i.prototype.getRenderableIds = function (e) { var i = this, o = []; for (var r in this._tiles) this._isIdRenderable(+r, e) && o.push(+r); return e ? o.sort((function (e, o) { var r = i._tiles[e].tileID, a = i._tiles[o].tileID, n = new t.Point(r.canonical.x, r.canonical.y)._rotate(i.transform.angle), s = new t.Point(a.canonical.x, a.canonical.y)._rotate(i.transform.angle); return r.overscaledZ - a.overscaledZ || s.y - n.y || s.x - n.x })) : o.sort(Mt) }, i.prototype.hasRenderableParent = function (t) { var e = this.findLoadedParent(t, 0); return !!e && this._isIdRenderable(e.tileID.key) }, i.prototype._isIdRenderable = function (t, e) { return this._tiles[t] && this._tiles[t].hasData() && !this._coveredTiles[t] && (e || !this._tiles[t].holdingForFade()) }, i.prototype.reload = function () { if (this._paused) this._shouldReloadOnResume = !0; else for (var t in this._cache.reset(), this._tiles) "errored" !== this._tiles[t].state && this._reloadTile(t, "reloading"); }, i.prototype._reloadTile = function (t, e) { var i = this._tiles[t]; i && ("loading" !== i.state && (i.state = e), this._loadTile(i, this._tileLoaded.bind(this, i, t, e))); }, i.prototype._tileLoaded = function (e, i, o, r) { if (r) return e.state = "errored", void (404 !== r.status ? this._source.fire(new t.ErrorEvent(r, { tile: e })) : this.update(this.transform)); e.timeAdded = t.browser.now(), "expired" === o && (e.refreshedUponExpiration = !0), this._setTileReloadTimer(i, e), "raster-dem" === this.getSource().type && e.dem && this._backfillDEM(e), this._state.initializeTileState(e, this.map ? this.map.painter : null), this._source.fire(new t.Event("data", { dataType: "source", tile: e, coord: e.tileID })); }, i.prototype._backfillDEM = function (t) { for (var e = this.getRenderableIds(), i = 0; i < e.length; i++) { var o = e[i]; if (t.neighboringTiles && t.neighboringTiles[o]) { var r = this.getTileByID(o); a(t, r), a(r, t); } } function a(t, e) { t.needsHillshadePrepare = !0; var i = e.tileID.canonical.x - t.tileID.canonical.x, o = e.tileID.canonical.y - t.tileID.canonical.y, r = Math.pow(2, t.tileID.canonical.z), a = e.tileID.key; 0 === i && 0 === o || Math.abs(o) > 1 || (Math.abs(i) > 1 && (1 === Math.abs(i + r) ? i += r : 1 === Math.abs(i - r) && (i -= r)), e.dem && t.dem && (t.dem.backfillBorder(e.dem, i, o), t.neighboringTiles && t.neighboringTiles[a] && (t.neighboringTiles[a].backfilled = !0))); } }, i.prototype.getTile = function (t) { return this.getTileByID(t.key) }, i.prototype.getTileByID = function (t) { return this._tiles[t] }, i.prototype._retainLoadedChildren = function (t, e, i, o) { for (var r in this._tiles) { var a = this._tiles[r]; if (!(o[r] || !a.hasData() || a.tileID.overscaledZ <= e || a.tileID.overscaledZ > i)) { for (var n = a.tileID; a && a.tileID.overscaledZ > e + 1;) { var s = a.tileID.scaledTo(a.tileID.overscaledZ - 1); (a = this._tiles[s.key]) && a.hasData() && (n = s); } for (var l = n; l.overscaledZ > e;)if (t[(l = l.scaledTo(l.overscaledZ - 1)).key]) { o[n.key] = n; break } } } }, i.prototype.findLoadedParent = function (t, e) { for (var i = t.overscaledZ - 1; i >= e; i--) { var o = t.scaledTo(i); if (!o) return; var r = String(o.key), a = this._tiles[r]; if (a && a.hasData()) return a; if (this._cache.has(o)) return this._cache.get(o) } }, i.prototype.updateCacheSize = function (t) { var e = (Math.ceil(t.width / this._source.tileSize) + 1) * (Math.ceil(t.height / this._source.tileSize) + 1), i = Math.floor(5 * e), o = "number" == typeof this._maxTileCacheSize ? Math.min(this._maxTileCacheSize, i) : i; this._cache.setMaxSize(o); }, i.prototype.handleWrapJump = function (t) { var e = (t - (void 0 === this._prevLng ? t : this._prevLng)) / 360, i = Math.round(e); if (this._prevLng = t, i) { var o = {}; for (var r in this._tiles) { var a = this._tiles[r]; a.tileID = a.tileID.unwrapTo(a.tileID.wrap + i), o[a.tileID.key] = a; } for (var n in this._tiles = o, this._timers) clearTimeout(this._timers[n]), delete this._timers[n]; for (var s in this._tiles) { var l = this._tiles[s]; this._setTileReloadTimer(s, l); } } }, i.prototype.update = function (e) { var o = this; if (this.transform = e, this._sourceLoaded && !this._paused) { var r; this.updateCacheSize(e), this.handleWrapJump(this.transform.center.lng), this._coveredTiles = {}, this.used ? this._source.tileID ? r = e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function (e) { return new t.OverscaledTileID(e.canonical.z, e.wrap, e.canonical.z, e.canonical.x, e.canonical.y) })) : (r = e.coveringTiles({ tileSize: this._source.tileSize, minzoom: this._source.minzoom, maxzoom: this._source.maxzoom, roundZoom: this._source.roundZoom, reparseOverscaled: this._source.reparseOverscaled }), this._source.hasTile && (r = r.filter((function (t) { return o._source.hasTile(t) })))) : r = []; var a = e.coveringZoomLevel(this._source), n = Math.max(a - i.maxOverzooming, this._source.minzoom), s = Math.max(a + i.maxUnderzooming, this._source.minzoom), l = this._updateRetainedTiles(r, a); if (Dt(this._source.type)) { for (var c = {}, u = {}, h = 0, p = Object.keys(l); h < p.length; h += 1) { var d = p[h], _ = l[d], f = this._tiles[d]; if (f && !(f.fadeEndTime && f.fadeEndTime <= t.browser.now())) { var m = this.findLoadedParent(_, n); m && (this._addTile(m.tileID), c[m.tileID.key] = m.tileID), u[d] = _; } } for (var g in this._retainLoadedChildren(u, a, s, l), c) l[g] || (this._coveredTiles[g] = !0, l[g] = c[g]); } for (var v in l) this._tiles[v].clearFadeHold(); for (var y = 0, x = t.keysDifference(this._tiles, l); y < x.length; y += 1) { var b = x[y], w = this._tiles[b]; w.hasSymbolBuckets && !w.holdingForFade() ? w.setHoldDuration(this.map._fadeDuration) : w.hasSymbolBuckets && !w.symbolFadeFinished() || this._removeTile(b); } } }, i.prototype.releaseSymbolFadeTiles = function () { for (var t in this._tiles) this._tiles[t].holdingForFade() && this._removeTile(t); }, i.prototype._updateRetainedTiles = function (t, e) { for (var o = {}, r = {}, a = Math.max(e - i.maxOverzooming, this._source.minzoom), n = Math.max(e + i.maxUnderzooming, this._source.minzoom), s = {}, l = 0, c = t; l < c.length; l += 1) { var u = c[l], h = this._addTile(u); o[u.key] = u, h.hasData() || e < this._source.maxzoom && (s[u.key] = u); } this._retainLoadedChildren(s, e, n, o); for (var p = 0, d = t; p < d.length; p += 1) { var _ = d[p], f = this._tiles[_.key]; if (!f.hasData()) { if (e + 1 > this._source.maxzoom) { var m = _.children(this._source.maxzoom)[0], g = this.getTile(m); if (g && g.hasData()) { o[m.key] = m; continue } } else { var v = _.children(this._source.maxzoom); if (o[v[0].key] && o[v[1].key] && o[v[2].key] && o[v[3].key]) continue } for (var y = f.wasRequested(), x = _.overscaledZ - 1; x >= a; --x) { var b = _.scaledTo(x); if (r[b.key]) break; if (r[b.key] = !0, !(f = this.getTile(b)) && y && (f = this._addTile(b)), f && (o[b.key] = b, y = f.wasRequested(), f.hasData())) break } } } return o }, i.prototype._addTile = function (e) { var i = this._tiles[e.key]; if (i) return i; (i = this._cache.getAndRemove(e)) && (this._setTileReloadTimer(e.key, i), i.tileID = e, this._state.initializeTileState(i, this.map ? this.map.painter : null), this._cacheTimers[e.key] && (clearTimeout(this._cacheTimers[e.key]), delete this._cacheTimers[e.key], this._setTileReloadTimer(e.key, i))); var o = Boolean(i); return o || (i = new t.Tile(e, this._source.tileSize * e.overscaleFactor()), this._loadTile(i, this._tileLoaded.bind(this, i, e.key, i.state))), i ? (i.uses++ , this._tiles[e.key] = i, o || this._source.fire(new t.Event("dataloading", { tile: i, coord: i.tileID, dataType: "source" })), i) : null }, i.prototype._setTileReloadTimer = function (t, e) { var i = this; t in this._timers && (clearTimeout(this._timers[t]), delete this._timers[t]); var o = e.getExpiryTimeout(); o && (this._timers[t] = setTimeout((function () { i._reloadTile(t, "expired"), delete i._timers[t]; }), o)); }, i.prototype._removeTile = function (t) { var e = this._tiles[t]; e && (e.uses-- , delete this._tiles[t], this._timers[t] && (clearTimeout(this._timers[t]), delete this._timers[t]), e.uses > 0 || (e.hasData() && "reloading" !== e.state ? this._cache.add(e.tileID, e, e.getExpiryTimeout()) : (e.aborted = !0, this._abortTile(e), this._unloadTile(e)))); }, i.prototype.clearTiles = function () { for (var t in this._shouldReloadOnResume = !1, this._paused = !1, this._tiles) this._removeTile(t); this._cache.reset(); }, i.prototype.tilesIn = function (e, i, o) { var r = this, a = [], n = this.transform; if (!n) return a; for (var s = o ? n.getCameraQueryGeometry(e) : e, l = e.map((function (t) { return n.pointCoordinate(t) })), c = s.map((function (t) { return n.pointCoordinate(t) })), u = this.getIds(), h = 1 / 0, p = 1 / 0, d = -1 / 0, _ = -1 / 0, f = 0, m = c; f < m.length; f += 1) { var g = m[f]; h = Math.min(h, g.x), p = Math.min(p, g.y), d = Math.max(d, g.x), _ = Math.max(_, g.y); } for (var v = function (e) { var o = r._tiles[u[e]]; if (!o.holdingForFade()) { var s = o.tileID, f = Math.pow(2, n.zoom - o.tileID.overscaledZ), m = i * o.queryPadding * t.EXTENT / o.tileSize / f, g = [s.getTilePoint(new t.MercatorCoordinate(h, p)), s.getTilePoint(new t.MercatorCoordinate(d, _))]; if (g[0].x - m < t.EXTENT && g[0].y - m < t.EXTENT && g[1].x + m >= 0 && g[1].y + m >= 0) { var v = l.map((function (t) { return s.getTilePoint(t) })), y = c.map((function (t) { return s.getTilePoint(t) })); a.push({ tile: o, tileID: s, queryGeometry: v, cameraQueryGeometry: y, scale: f }); } } }, y = 0; y < u.length; y++)v(y); return a }, i.prototype.getVisibleCoordinates = function (t) { for (var e = this, i = this.getRenderableIds(t).map((function (t) { return e._tiles[t].tileID })), o = 0, r = i; o < r.length; o += 1) { var a = r[o]; a.posMatrix = this.transform.calculatePosMatrix(a.toUnwrapped()); } return i }, i.prototype.hasTransition = function () { if (this._source.hasTransition()) return !0; if (Dt(this._source.type)) for (var e in this._tiles) { var i = this._tiles[e]; if (void 0 !== i.fadeEndTime && i.fadeEndTime >= t.browser.now()) return !0 } return !1 }, i.prototype.setFeatureState = function (t, e, i) { t = t || "_geojsonTileLayer", this._state.updateState(t, e, i); }, i.prototype.removeFeatureState = function (t, e, i) { t = t || "_geojsonTileLayer", this._state.removeFeatureState(t, e, i); }, i.prototype.getFeatureState = function (t, e) { return t = t || "_geojsonTileLayer", this._state.getState(t, e) }, i.prototype.setDependencies = function (t, e, i) { var o = this._tiles[t]; o && o.setDependencies(e, i); }, i.prototype.reloadTilesForDependencies = function (t, e) { for (var i in this._tiles) { this._tiles[i].hasDependency(t, e) && this._reloadTile(i, "reloading"); } this._cache.filter((function (i) { return !i.hasDependency(t, e) })); }, i }(t.Evented); function Mt(t, e) { return t % 32 - e % 32 || e - t } function Dt(t) { return "raster" === t || "image" === t || "video" === t } function At() { return new t.window.Worker(cr.workerUrl) } Lt.maxOverzooming = 10, Lt.maxUnderzooming = 3; var Rt = function () { this.active = {}; }; Rt.prototype.acquire = function (t) { if (!this.workers) for (this.workers = []; this.workers.length < Rt.workerCount;)this.workers.push(new At); return this.active[t] = !0, this.workers.slice() }, Rt.prototype.release = function (t) { delete this.active[t], 0 === Object.keys(this.active).length && (this.workers.forEach((function (t) { t.terminate(); })), this.workers = null); }; var kt, Bt = Math.floor(t.browser.hardwareConcurrency / 2); function Ot(e, i) { var o = {}; for (var r in e) "ref" !== r && (o[r] = e[r]); return t.refProperties.forEach((function (t) { t in i && (o[t] = i[t]); })), o } function Ft(t) { t = t.slice(); for (var e = Object.create(null), i = 0; i < t.length; i++)e[t[i].id] = t[i]; for (var o = 0; o < t.length; o++)"ref" in t[o] && (t[o] = Ot(t[o], e[t[o].ref])); return t } Rt.workerCount = Math.max(Math.min(Bt, 6), 1); var Ut = { setStyle: "setStyle", addLayer: "addLayer", removeLayer: "removeLayer", setPaintProperty: "setPaintProperty", setLayoutProperty: "setLayoutProperty", setFilter: "setFilter", addSource: "addSource", removeSource: "removeSource", setGeoJSONSourceData: "setGeoJSONSourceData", setLayerZoomRange: "setLayerZoomRange", setLayerProperty: "setLayerProperty", setCenter: "setCenter", setZoom: "setZoom", setBearing: "setBearing", setPitch: "setPitch", setSprite: "setSprite", setGlyphs: "setGlyphs", setTransition: "setTransition", setLight: "setLight" }; function Nt(t, e, i) { i.push({ command: Ut.addSource, args: [t, e[t]] }); } function Zt(t, e, i) { e.push({ command: Ut.removeSource, args: [t] }), i[t] = !0; } function qt(t, e, i, o) { Zt(t, i, o), Nt(t, e, i); } function jt(e, i, o) { var r; for (r in e[o]) if (e[o].hasOwnProperty(r) && "data" !== r && !t.deepEqual(e[o][r], i[o][r])) return !1; for (r in i[o]) if (i[o].hasOwnProperty(r) && "data" !== r && !t.deepEqual(e[o][r], i[o][r])) return !1; return !0 } function Vt(e, i, o, r, a, n) { var s; for (s in i = i || {}, e = e || {}) e.hasOwnProperty(s) && (t.deepEqual(e[s], i[s]) || o.push({ command: n, args: [r, s, i[s], a] })); for (s in i) i.hasOwnProperty(s) && !e.hasOwnProperty(s) && (t.deepEqual(e[s], i[s]) || o.push({ command: n, args: [r, s, i[s], a] })); } function Gt(t) { return t.id } function Wt(t, e) { return t[e.id] = e, t } function Xt(e, i) { if (!e) return [{ command: Ut.setStyle, args: [i] }]; var o = []; try { if (!t.deepEqual(e.version, i.version)) return [{ command: Ut.setStyle, args: [i] }]; t.deepEqual(e.center, i.center) || o.push({ command: Ut.setCenter, args: [i.center] }), t.deepEqual(e.zoom, i.zoom) || o.push({ command: Ut.setZoom, args: [i.zoom] }), t.deepEqual(e.bearing, i.bearing) || o.push({ command: Ut.setBearing, args: [i.bearing] }), t.deepEqual(e.pitch, i.pitch) || o.push({ command: Ut.setPitch, args: [i.pitch] }), t.deepEqual(e.sprite, i.sprite) || o.push({ command: Ut.setSprite, args: [i.sprite] }), t.deepEqual(e.glyphs, i.glyphs) || o.push({ command: Ut.setGlyphs, args: [i.glyphs] }), t.deepEqual(e.transition, i.transition) || o.push({ command: Ut.setTransition, args: [i.transition] }), t.deepEqual(e.light, i.light) || o.push({ command: Ut.setLight, args: [i.light] }); var r = {}, a = []; !function (e, i, o, r) { var a; for (a in i = i || {}, e = e || {}) e.hasOwnProperty(a) && (i.hasOwnProperty(a) || Zt(a, o, r)); for (a in i) i.hasOwnProperty(a) && (e.hasOwnProperty(a) ? t.deepEqual(e[a], i[a]) || ("geojson" === e[a].type && "geojson" === i[a].type && jt(e, i, a) ? o.push({ command: Ut.setGeoJSONSourceData, args: [a, i[a].data] }) : qt(a, i, o, r)) : Nt(a, i, o)); }(e.sources, i.sources, a, r); var n = []; e.layers && e.layers.forEach((function (t) { r[t.source] ? o.push({ command: Ut.removeLayer, args: [t.id] }) : n.push(t); })), o = o.concat(a), function (e, i, o) { i = i || []; var r, a, n, s, l, c, u, h = (e = e || []).map(Gt), p = i.map(Gt), d = e.reduce(Wt, {}), _ = i.reduce(Wt, {}), f = h.slice(), m = Object.create(null); for (r = 0, a = 0; r < h.length; r++)n = h[r], _.hasOwnProperty(n) ? a++ : (o.push({ command: Ut.removeLayer, args: [n] }), f.splice(f.indexOf(n, a), 1)); for (r = 0, a = 0; r < p.length; r++)n = p[p.length - 1 - r], f[f.length - 1 - r] !== n && (d.hasOwnProperty(n) ? (o.push({ command: Ut.removeLayer, args: [n] }), f.splice(f.lastIndexOf(n, f.length - a), 1)) : a++ , c = f[f.length - r], o.push({ command: Ut.addLayer, args: [_[n], c] }), f.splice(f.length - r, 0, n), m[n] = !0); for (r = 0; r < p.length; r++)if (s = d[n = p[r]], l = _[n], !m[n] && !t.deepEqual(s, l)) if (t.deepEqual(s.source, l.source) && t.deepEqual(s["source-layer"], l["source-layer"]) && t.deepEqual(s.type, l.type)) { for (u in Vt(s.layout, l.layout, o, n, null, Ut.setLayoutProperty), Vt(s.paint, l.paint, o, n, null, Ut.setPaintProperty), t.deepEqual(s.filter, l.filter) || o.push({ command: Ut.setFilter, args: [n, l.filter] }), t.deepEqual(s.minzoom, l.minzoom) && t.deepEqual(s.maxzoom, l.maxzoom) || o.push({ command: Ut.setLayerZoomRange, args: [n, l.minzoom, l.maxzoom] }), s) s.hasOwnProperty(u) && "layout" !== u && "paint" !== u && "filter" !== u && "metadata" !== u && "minzoom" !== u && "maxzoom" !== u && (0 === u.indexOf("paint.") ? Vt(s[u], l[u], o, n, u.slice(6), Ut.setPaintProperty) : t.deepEqual(s[u], l[u]) || o.push({ command: Ut.setLayerProperty, args: [n, u, l[u]] })); for (u in l) l.hasOwnProperty(u) && !s.hasOwnProperty(u) && "layout" !== u && "paint" !== u && "filter" !== u && "metadata" !== u && "minzoom" !== u && "maxzoom" !== u && (0 === u.indexOf("paint.") ? Vt(s[u], l[u], o, n, u.slice(6), Ut.setPaintProperty) : t.deepEqual(s[u], l[u]) || o.push({ command: Ut.setLayerProperty, args: [n, u, l[u]] })); } else o.push({ command: Ut.removeLayer, args: [n] }), c = f[f.lastIndexOf(n) + 1], o.push({ command: Ut.addLayer, args: [l, c] }); }(n, i.layers, o); } catch (t) { console.warn("Unable to compute style diff:", t), o = [{ command: Ut.setStyle, args: [i] }]; } return o } var Ht = function (t, e, i) { var o = this.boxCells = [], r = this.circleCells = []; this.xCellCount = Math.ceil(t / i), this.yCellCount = Math.ceil(e / i); for (var a = 0; a < this.xCellCount * this.yCellCount; a++)o.push([]), r.push([]); this.circleKeys = [], this.boxKeys = [], this.bboxes = [], this.circles = [], this.width = t, this.height = e, this.xScale = this.xCellCount / t, this.yScale = this.yCellCount / e, this.boxUid = 0, this.circleUid = 0; }; function Kt(e, i, o, r, a) { var n = t.create(); return i ? (t.scale(n, n, [1 / a, 1 / a, 1]), o || t.rotateZ(n, n, r.angle)) : t.multiply(n, r.labelPlaneMatrix, e), n } function Yt(e, i, o, r, a) { if (i) { var n = t.clone(e); return t.scale(n, n, [a, a, 1]), o || t.rotateZ(n, n, -r.angle), n } return r.glCoordMatrix } function Jt(e, i) { var o = [e.x, e.y, 0, 1]; se(o, o, i); var r = o[3]; return { point: new t.Point(o[0] / r, o[1] / r), signedDistanceFromCamera: r } } function Qt(t, e) { var i = t[0] / t[3], o = t[1] / t[3]; return i >= -e[0] && i <= e[0] && o >= -e[1] && o <= e[1] } function $t(e, i, o, r, a, n, s, l) { var c = r ? e.textSizeData : e.iconSizeData, u = t.evaluateSizeForZoom(c, o.transform.zoom), h = [256 / o.width * 2 + 1, 256 / o.height * 2 + 1], p = r ? e.text.dynamicLayoutVertexArray : e.icon.dynamicLayoutVertexArray; p.clear(); for (var d = e.lineVertexArray, _ = r ? e.text.placedSymbolArray : e.icon.placedSymbolArray, f = o.transform.width / o.transform.height, m = !1, g = 0; g < _.length; g++) { var v = _.get(g); if (v.hidden || v.writingMode === t.WritingMode.vertical && !m) ne(v.numGlyphs, p); else { m = !1; var y = [v.anchorX, v.anchorY, 0, 1]; if (t.transformMat4(y, y, i), Qt(y, h)) { var x = .5 + y[3] / o.transform.cameraToCenterDistance * .5, b = t.evaluateSizeForFeature(c, u, v), w = s ? b * x : b / x, E = new t.Point(v.anchorX, v.anchorY), T = Jt(E, a).point, I = {}, C = ie(v, w, !1, l, i, a, n, e.glyphOffsetArray, d, p, T, E, I, f); m = C.useVertical, (C.notEnoughRoom || m || C.needsFlipping && ie(v, w, !0, l, i, a, n, e.glyphOffsetArray, d, p, T, E, I, f).notEnoughRoom) && ne(v.numGlyphs, p); } else ne(v.numGlyphs, p); } } r ? e.text.dynamicLayoutVertexBuffer.updateData(p) : e.icon.dynamicLayoutVertexBuffer.updateData(p); } function te(t, e, i, o, r, a, n, s, l, c, u, h) { var p = s.glyphStartIndex + s.numGlyphs, d = s.lineStartIndex, _ = s.lineStartIndex + s.lineLength, f = e.getoffsetX(s.glyphStartIndex), m = e.getoffsetX(p - 1), g = re(t * f, i, o, r, a, n, s.segment, d, _, l, c, u, h); if (!g) return null; var v = re(t * m, i, o, r, a, n, s.segment, d, _, l, c, u, h); return v ? { first: g, last: v } : null } function ee(e, i, o, r) { if (e === t.WritingMode.horizontal && Math.abs(o.y - i.y) > Math.abs(o.x - i.x) * r) return { useVertical: !0 }; return (e === t.WritingMode.vertical ? i.y < o.y : i.x > o.x) ? { needsFlipping: !0 } : null } function ie(e, i, o, r, a, n, s, l, c, u, h, p, d, _) { var f, m = i / 24, g = e.lineOffsetX * m, v = e.lineOffsetY * m; if (e.numGlyphs > 1) { var y = e.glyphStartIndex + e.numGlyphs, x = e.lineStartIndex, b = e.lineStartIndex + e.lineLength, w = te(m, l, g, v, o, h, p, e, c, n, d, !1); if (!w) return { notEnoughRoom: !0 }; var E = Jt(w.first.point, s).point, T = Jt(w.last.point, s).point; if (r && !o) { var I = ee(e.writingMode, E, T, _); if (I) return I } f = [w.first]; for (var C = e.glyphStartIndex + 1; C < y - 1; C++)f.push(re(m * l.getoffsetX(C), g, v, o, h, p, e.segment, x, b, c, n, d, !1)); f.push(w.last); } else { if (r && !o) { var S = Jt(p, a).point, P = e.lineStartIndex + e.segment + 1, z = new t.Point(c.getx(P), c.gety(P)), L = Jt(z, a), M = L.signedDistanceFromCamera > 0 ? L.point : oe(p, z, S, 1, a), D = ee(e.writingMode, S, M, _); if (D) return D } var A = re(m * l.getoffsetX(e.glyphStartIndex), g, v, o, h, p, e.segment, e.lineStartIndex, e.lineStartIndex + e.lineLength, c, n, d, !1); if (!A) return { notEnoughRoom: !0 }; f = [A]; } for (var R = 0, k = f; R < k.length; R += 1) { var B = k[R]; t.addDynamicAttributes(u, B.point, B.angle); } return {} } function oe(t, e, i, o, r) { var a = Jt(t.add(t.sub(e)._unit()), r).point, n = i.sub(a); return i.add(n._mult(o / n.mag())) } function re(e, i, o, r, a, n, s, l, c, u, h, p, d) { var _ = r ? e - i : e + i, f = _ > 0 ? 1 : -1, m = 0; r && (f *= -1, m = Math.PI), f < 0 && (m += Math.PI); for (var g = f > 0 ? l + s : l + s + 1, v = g, y = a, x = a, b = 0, w = 0, E = Math.abs(_); b + w <= E;) { if ((g += f) < l || g >= c) return null; if (x = y, void 0 === (y = p[g])) { var T = new t.Point(u.getx(g), u.gety(g)), I = Jt(T, h); if (I.signedDistanceFromCamera > 0) y = p[g] = I.point; else { var C = g - f; y = oe(0 === b ? n : new t.Point(u.getx(C), u.gety(C)), T, x, E - b + 1, h); } } b += w, w = x.dist(y); } var S = (E - b) / w, P = y.sub(x), z = P.mult(S)._add(x); return z._add(P._unit()._perp()._mult(o * f)), { point: z, angle: m + Math.atan2(y.y - x.y, y.x - x.x), tileDistance: d ? { prevTileDistance: g - f === v ? 0 : u.gettileUnitDistanceFromAnchor(g - f), lastSegmentViewportDistance: E - b } : null } } Ht.prototype.keysLength = function () { return this.boxKeys.length + this.circleKeys.length }, Ht.prototype.insert = function (t, e, i, o, r) { this._forEachCell(e, i, o, r, this._insertBoxCell, this.boxUid++), this.boxKeys.push(t), this.bboxes.push(e), this.bboxes.push(i), this.bboxes.push(o), this.bboxes.push(r); }, Ht.prototype.insertCircle = function (t, e, i, o) { this._forEachCell(e - o, i - o, e + o, i + o, this._insertCircleCell, this.circleUid++), this.circleKeys.push(t), this.circles.push(e), this.circles.push(i), this.circles.push(o); }, Ht.prototype._insertBoxCell = function (t, e, i, o, r, a) { this.boxCells[r].push(a); }, Ht.prototype._insertCircleCell = function (t, e, i, o, r, a) { this.circleCells[r].push(a); }, Ht.prototype._query = function (t, e, i, o, r, a) { if (i < 0 || t > this.width || o < 0 || e > this.height) return !r && []; var n = []; if (t <= 0 && e <= 0 && this.width <= i && this.height <= o) { if (r) return !0; for (var s = 0; s < this.boxKeys.length; s++)n.push({ key: this.boxKeys[s], x1: this.bboxes[4 * s], y1: this.bboxes[4 * s + 1], x2: this.bboxes[4 * s + 2], y2: this.bboxes[4 * s + 3] }); for (var l = 0; l < this.circleKeys.length; l++) { var c = this.circles[3 * l], u = this.circles[3 * l + 1], h = this.circles[3 * l + 2]; n.push({ key: this.circleKeys[l], x1: c - h, y1: u - h, x2: c + h, y2: u + h }); } return a ? n.filter(a) : n } var p = { hitTest: r, seenUids: { box: {}, circle: {} } }; return this._forEachCell(t, e, i, o, this._queryCell, n, p, a), r ? n.length > 0 : n }, Ht.prototype._queryCircle = function (t, e, i, o, r) { var a = t - i, n = t + i, s = e - i, l = e + i; if (n < 0 || a > this.width || l < 0 || s > this.height) return !o && []; var c = [], u = { hitTest: o, circle: { x: t, y: e, radius: i }, seenUids: { box: {}, circle: {} } }; return this._forEachCell(a, s, n, l, this._queryCellCircle, c, u, r), o ? c.length > 0 : c }, Ht.prototype.query = function (t, e, i, o, r) { return this._query(t, e, i, o, !1, r) }, Ht.prototype.hitTest = function (t, e, i, o, r) { return this._query(t, e, i, o, !0, r) }, Ht.prototype.hitTestCircle = function (t, e, i, o) { return this._queryCircle(t, e, i, !0, o) }, Ht.prototype._queryCell = function (t, e, i, o, r, a, n, s) { var l = n.seenUids, c = this.boxCells[r]; if (null !== c) for (var u = this.bboxes, h = 0, p = c; h < p.length; h += 1) { var d = p[h]; if (!l.box[d]) { l.box[d] = !0; var _ = 4 * d; if (t <= u[_ + 2] && e <= u[_ + 3] && i >= u[_ + 0] && o >= u[_ + 1] && (!s || s(this.boxKeys[d]))) { if (n.hitTest) return a.push(!0), !0; a.push({ key: this.boxKeys[d], x1: u[_], y1: u[_ + 1], x2: u[_ + 2], y2: u[_ + 3] }); } } } var f = this.circleCells[r]; if (null !== f) for (var m = this.circles, g = 0, v = f; g < v.length; g += 1) { var y = v[g]; if (!l.circle[y]) { l.circle[y] = !0; var x = 3 * y; if (this._circleAndRectCollide(m[x], m[x + 1], m[x + 2], t, e, i, o) && (!s || s(this.circleKeys[y]))) { if (n.hitTest) return a.push(!0), !0; var b = m[x], w = m[x + 1], E = m[x + 2]; a.push({ key: this.circleKeys[y], x1: b - E, y1: w - E, x2: b + E, y2: w + E }); } } } }, Ht.prototype._queryCellCircle = function (t, e, i, o, r, a, n, s) { var l = n.circle, c = n.seenUids, u = this.boxCells[r]; if (null !== u) for (var h = this.bboxes, p = 0, d = u; p < d.length; p += 1) { var _ = d[p]; if (!c.box[_]) { c.box[_] = !0; var f = 4 * _; if (this._circleAndRectCollide(l.x, l.y, l.radius, h[f + 0], h[f + 1], h[f + 2], h[f + 3]) && (!s || s(this.boxKeys[_]))) return a.push(!0), !0 } } var m = this.circleCells[r]; if (null !== m) for (var g = this.circles, v = 0, y = m; v < y.length; v += 1) { var x = y[v]; if (!c.circle[x]) { c.circle[x] = !0; var b = 3 * x; if (this._circlesCollide(g[b], g[b + 1], g[b + 2], l.x, l.y, l.radius) && (!s || s(this.circleKeys[x]))) return a.push(!0), !0 } } }, Ht.prototype._forEachCell = function (t, e, i, o, r, a, n, s) { for (var l = this._convertToXCellCoord(t), c = this._convertToYCellCoord(e), u = this._convertToXCellCoord(i), h = this._convertToYCellCoord(o), p = l; p <= u; p++)for (var d = c; d <= h; d++) { var _ = this.xCellCount * d + p; if (r.call(this, t, e, i, o, _, a, n, s)) return } }, Ht.prototype._convertToXCellCoord = function (t) { return Math.max(0, Math.min(this.xCellCount - 1, Math.floor(t * this.xScale))) }, Ht.prototype._convertToYCellCoord = function (t) { return Math.max(0, Math.min(this.yCellCount - 1, Math.floor(t * this.yScale))) }, Ht.prototype._circlesCollide = function (t, e, i, o, r, a) { var n = o - t, s = r - e, l = i + a; return l * l > n * n + s * s }, Ht.prototype._circleAndRectCollide = function (t, e, i, o, r, a, n) { var s = (a - o) / 2, l = Math.abs(t - (o + s)); if (l > s + i) return !1; var c = (n - r) / 2, u = Math.abs(e - (r + c)); if (u > c + i) return !1; if (l <= s || u <= c) return !0; var h = l - s, p = u - c; return h * h + p * p <= i * i }; var ae = new Float32Array([-1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0, -1 / 0, -1 / 0, 0]); function ne(t, e) { for (var i = 0; i < t; i++) { var o = e.length; e.resize(o + 4), e.float32.set(ae, 3 * o); } } function se(t, e, i) { var o = e[0], r = e[1]; return t[0] = i[0] * o + i[4] * r + i[12], t[1] = i[1] * o + i[5] * r + i[13], t[3] = i[3] * o + i[7] * r + i[15], t } var le = function (t, e, i) { void 0 === e && (e = new Ht(t.width + 200, t.height + 200, 25)), void 0 === i && (i = new Ht(t.width + 200, t.height + 200, 25)), this.transform = t, this.grid = e, this.ignoredGrid = i, this.pitchfactor = Math.cos(t._pitch) * t.cameraToCenterDistance, this.screenRightBoundary = t.width + 100, this.screenBottomBoundary = t.height + 100, this.gridRightBoundary = t.width + 200, this.gridBottomBoundary = t.height + 200; }; function ce(t, e, i) { t[e + 4] = i ? 1 : 0; } function ue(e, i, o) { return i * (t.EXTENT / (e.tileSize * Math.pow(2, o - e.tileID.overscaledZ))) } le.prototype.placeCollisionBox = function (t, e, i, o, r) { var a = this.projectAndGetPerspectiveRatio(o, t.anchorPointX, t.anchorPointY), n = i * a.perspectiveRatio, s = t.x1 * n + a.point.x, l = t.y1 * n + a.point.y, c = t.x2 * n + a.point.x, u = t.y2 * n + a.point.y; return !this.isInsideGrid(s, l, c, u) || !e && this.grid.hitTest(s, l, c, u, r) ? { box: [], offscreen: !1 } : { box: [s, l, c, u], offscreen: this.isOffscreen(s, l, c, u) } }, le.prototype.approximateTileDistance = function (t, e, i, o, r) { var a = r ? 1 : o / this.pitchfactor, n = t.lastSegmentViewportDistance * i; return t.prevTileDistance + n + (a - 1) * n * Math.abs(Math.sin(e)) }, le.prototype.placeCollisionCircles = function (e, i, o, r, a, n, s, l, c, u, h, p, d) { var _ = [], f = this.projectAnchor(c, a.anchorX, a.anchorY), m = l / 24, g = a.lineOffsetX * l, v = a.lineOffsetY * l, y = new t.Point(a.anchorX, a.anchorY), x = te(m, s, g, v, !1, Jt(y, u).point, y, a, n, u, {}, !0), b = !1, w = !1, E = !0, T = f.perspectiveRatio * r, I = 1 / (r * o), C = 0, S = 0; x && (C = this.approximateTileDistance(x.first.tileDistance, x.first.angle, I, f.cameraDistance, p), S = this.approximateTileDistance(x.last.tileDistance, x.last.angle, I, f.cameraDistance, p)); for (var P = 0; P < e.length; P += 5) { var z = e[P], L = e[P + 1], M = e[P + 2], D = e[P + 3]; if (!x || D < -C || D > S) ce(e, P, !1); else { var A = this.projectPoint(c, z, L), R = M * T; if (_.length > 0) { var k = A.x - _[_.length - 4], B = A.y - _[_.length - 3]; if (R * R * 2 > k * k + B * B) if (P + 8 < e.length) { var O = e[P + 8]; if (O > -C && O < S) { ce(e, P, !1); continue } } } var F = P / 5; _.push(A.x, A.y, R, F), ce(e, P, !0); var U = A.x - R, N = A.y - R, Z = A.x + R, q = A.y + R; if (E = E && this.isOffscreen(U, N, Z, q), w = w || this.isInsideGrid(U, N, Z, q), !i && this.grid.hitTestCircle(A.x, A.y, R, d)) { if (!h) return { circles: [], offscreen: !1 }; b = !0; } } } return { circles: b || !w ? [] : _, offscreen: E } }, le.prototype.queryRenderedSymbols = function (e) { if (0 === e.length || 0 === this.grid.keysLength() && 0 === this.ignoredGrid.keysLength()) return {}; for (var i = [], o = 1 / 0, r = 1 / 0, a = -1 / 0, n = -1 / 0, s = 0, l = e; s < l.length; s += 1) { var c = l[s], u = new t.Point(c.x + 100, c.y + 100); o = Math.min(o, u.x), r = Math.min(r, u.y), a = Math.max(a, u.x), n = Math.max(n, u.y), i.push(u); } for (var h = {}, p = {}, d = 0, _ = this.grid.query(o, r, a, n).concat(this.ignoredGrid.query(o, r, a, n)); d < _.length; d += 1) { var f = _[d], m = f.key; if (void 0 === h[m.bucketInstanceId] && (h[m.bucketInstanceId] = {}), !h[m.bucketInstanceId][m.featureIndex]) { var g = [new t.Point(f.x1, f.y1), new t.Point(f.x2, f.y1), new t.Point(f.x2, f.y2), new t.Point(f.x1, f.y2)]; t.polygonIntersectsPolygon(i, g) && (h[m.bucketInstanceId][m.featureIndex] = !0, void 0 === p[m.bucketInstanceId] && (p[m.bucketInstanceId] = []), p[m.bucketInstanceId].push(m.featureIndex)); } } return p }, le.prototype.insertCollisionBox = function (t, e, i, o, r) { var a = { bucketInstanceId: i, featureIndex: o, collisionGroupID: r }; (e ? this.ignoredGrid : this.grid).insert(a, t[0], t[1], t[2], t[3]); }, le.prototype.insertCollisionCircles = function (t, e, i, o, r) { for (var a = e ? this.ignoredGrid : this.grid, n = { bucketInstanceId: i, featureIndex: o, collisionGroupID: r }, s = 0; s < t.length; s += 4)a.insertCircle(n, t[s], t[s + 1], t[s + 2]); }, le.prototype.projectAnchor = function (t, e, i) { var o = [e, i, 0, 1]; return se(o, o, t), { perspectiveRatio: .5 + this.transform.cameraToCenterDistance / o[3] * .5, cameraDistance: o[3] } }, le.prototype.projectPoint = function (e, i, o) { var r = [i, o, 0, 1]; return se(r, r, e), new t.Point((r[0] / r[3] + 1) / 2 * this.transform.width + 100, (-r[1] / r[3] + 1) / 2 * this.transform.height + 100) }, le.prototype.projectAndGetPerspectiveRatio = function (e, i, o) { var r = [i, o, 0, 1]; return se(r, r, e), { point: new t.Point((r[0] / r[3] + 1) / 2 * this.transform.width + 100, (-r[1] / r[3] + 1) / 2 * this.transform.height + 100), perspectiveRatio: .5 + this.transform.cameraToCenterDistance / r[3] * .5 } }, le.prototype.isOffscreen = function (t, e, i, o) { return i < 100 || t >= this.screenRightBoundary || o < 100 || e > this.screenBottomBoundary }, le.prototype.isInsideGrid = function (t, e, i, o) { return i >= 0 && t < this.gridRightBoundary && o >= 0 && e < this.gridBottomBoundary }; var he = function (t, e, i, o) { this.opacity = t ? Math.max(0, Math.min(1, t.opacity + (t.placed ? e : -e))) : o && i ? 1 : 0, this.placed = i; }; he.prototype.isHidden = function () { return 0 === this.opacity && !this.placed }; var pe = function (t, e, i, o, r) { this.text = new he(t ? t.text : null, e, i, r), this.icon = new he(t ? t.icon : null, e, o, r); }; pe.prototype.isHidden = function () { return this.text.isHidden() && this.icon.isHidden() }; var de = function (t, e, i) { this.text = t, this.icon = e, this.skipFade = i; }, _e = function (t, e, i, o, r) { this.bucketInstanceId = t, this.featureIndex = e, this.sourceLayerIndex = i, this.bucketIndex = o, this.tileID = r; }, fe = function (t) { this.crossSourceCollisions = t, this.maxGroupID = 0, this.collisionGroups = {}; }; function me(e, i, o, r, a) { var n = t.getAnchorAlignment(e), s = -(n.horizontalAlign - .5) * i, l = -(n.verticalAlign - .5) * o, c = t.evaluateVariableOffset(e, r); return new t.Point(s + c[0] * a, l + c[1] * a) } function ge(e, i, o, r, a, n) { var s = e.x1, l = e.x2, c = e.y1, u = e.y2, h = e.anchorPointX, p = e.anchorPointY, d = new t.Point(i, o); return r && d._rotate(a ? n : -n), { x1: s + d.x, y1: c + d.y, x2: l + d.x, y2: u + d.y, anchorPointX: h, anchorPointY: p } } fe.prototype.get = function (t) { if (this.crossSourceCollisions) return { ID: 0, predicate: null }; if (!this.collisionGroups[t]) { var e = ++this.maxGroupID; this.collisionGroups[t] = { ID: e, predicate: function (t) { return t.collisionGroupID === e } }; } return this.collisionGroups[t] }; var ve = function (t, e, i, o) { this.transform = t.clone(), this.collisionIndex = new le(this.transform), this.placements = {}, this.opacities = {}, this.variableOffsets = {}, this.stale = !1, this.commitTime = 0, this.fadeDuration = e, this.retainedQueryData = {}, this.collisionGroups = new fe(i), this.prevPlacement = o, o && (o.prevPlacement = void 0), this.placedOrientations = {}; }; function ye(t, e, i, o, r) { t.emplaceBack(e ? 1 : 0, i ? 1 : 0, o || 0, r || 0), t.emplaceBack(e ? 1 : 0, i ? 1 : 0, o || 0, r || 0), t.emplaceBack(e ? 1 : 0, i ? 1 : 0, o || 0, r || 0), t.emplaceBack(e ? 1 : 0, i ? 1 : 0, o || 0, r || 0); } ve.prototype.placeLayerTile = function (e, i, o, r) { var a = i.getBucket(e), n = i.latestFeatureIndex; if (a && n && e.id === a.layerIds[0]) { var s = i.collisionBoxArray, l = a.layers[0].layout, c = Math.pow(2, this.transform.zoom - i.tileID.overscaledZ), u = i.tileSize / t.EXTENT, h = this.transform.calculatePosMatrix(i.tileID.toUnwrapped()), p = Kt(h, "map" === l.get("text-pitch-alignment"), "map" === l.get("text-rotation-alignment"), this.transform, ue(i, 1, this.transform.zoom)), d = Kt(h, "map" === l.get("icon-pitch-alignment"), "map" === l.get("icon-rotation-alignment"), this.transform, ue(i, 1, this.transform.zoom)); this.retainedQueryData[a.bucketInstanceId] = new _e(a.bucketInstanceId, n, a.sourceLayerIndex, a.index, i.tileID), this.placeLayerBucket(a, h, p, d, c, u, o, i.holdingForFade(), r, s); } }, ve.prototype.attemptAnchorPlacement = function (t, e, i, o, r, a, n, s, l, c, u, h, p, d, _) { var f, m = [h.textOffset0, h.textOffset1], g = me(t, i, o, m, r), v = this.collisionIndex.placeCollisionBox(ge(e, g.x, g.y, a, n, this.transform.angle), u, s, l, c.predicate); if (_ && 0 === this.collisionIndex.placeCollisionBox(ge(_, g.x, g.y, a, n, this.transform.angle), u, s, l, c.predicate).box.length) return; if (v.box.length > 0) return this.prevPlacement && this.prevPlacement.variableOffsets[h.crossTileID] && this.prevPlacement.placements[h.crossTileID] && this.prevPlacement.placements[h.crossTileID].text && (f = this.prevPlacement.variableOffsets[h.crossTileID].anchor), this.variableOffsets[h.crossTileID] = { textOffset: m, width: i, height: o, anchor: t, textBoxScale: r, prevAnchor: f }, this.markUsedJustification(p, t, h, d), p.allowVerticalPlacement && (this.markUsedOrientation(p, d, h), this.placedOrientations[h.crossTileID] = d), { shift: g, placedGlyphBoxes: v } }, ve.prototype.placeLayerBucket = function (e, i, o, r, a, n, s, l, c, u) { var h = this, p = e.layers[0].layout, d = t.evaluateSizeForZoom(e.textSizeData, this.transform.zoom), _ = p.get("text-optional"), f = p.get("icon-optional"), m = p.get("text-allow-overlap"), g = p.get("icon-allow-overlap"), v = m && (g || !e.hasIconData() || f), y = g && (m || !e.hasTextData() || _), x = this.collisionGroups.get(e.sourceID), b = "map" === p.get("text-rotation-alignment"), w = "map" === p.get("text-pitch-alignment"), E = "none" !== p.get("icon-text-fit"), T = "viewport-y" === p.get("symbol-z-order"); !e.collisionArrays && u && e.deserializeCollisionBoxes(u); var I = function (r, u) { if (!c[r.crossTileID]) if (l) h.placements[r.crossTileID] = new de(!1, !1, !1); else { var T, I = !1, C = !1, S = !0, P = null, z = { box: null, offscreen: null }, L = { box: null, offscreen: null }, M = null, D = null, A = 0, R = 0, k = 0; u.textFeatureIndex && (A = u.textFeatureIndex), u.verticalTextFeatureIndex && (R = u.verticalTextFeatureIndex); var B = u.textBox; if (B) { var O = function (i) { var o = t.WritingMode.horizontal; if (e.allowVerticalPlacement && !i && h.prevPlacement) { var a = h.prevPlacement.placedOrientations[r.crossTileID]; a && (h.placedOrientations[r.crossTileID] = a, o = a, h.markUsedOrientation(e, o, r)); } return o }, F = function (i, o) { if (e.allowVerticalPlacement && r.numVerticalGlyphVertices > 0 && u.verticalTextBox) for (var a = 0, n = e.writingModes; a < n.length; a += 1) { if (n[a] === t.WritingMode.vertical ? (z = o(), L = z) : z = i(), z && z.box && z.box.length) break } else z = i(); }; if (p.get("text-variable-anchor")) { var U = p.get("text-variable-anchor"); if (h.prevPlacement && h.prevPlacement.variableOffsets[r.crossTileID]) { var N = h.prevPlacement.variableOffsets[r.crossTileID]; U.indexOf(N.anchor) > 0 && (U = U.filter((function (t) { return t !== N.anchor }))).unshift(N.anchor); } var Z = function (t, o, a) { for (var s = t.x2 - t.x1, l = t.y2 - t.y1, c = r.textBoxScale, u = E && !g ? o : null, p = { box: [], offscreen: !1 }, d = m ? 2 * U.length : U.length, _ = 0; _ < d; ++_) { var f = U[_ % U.length], v = _ >= U.length, y = h.attemptAnchorPlacement(f, t, s, l, c, b, w, n, i, x, v, r, e, a, u); if (y && (p = y.placedGlyphBoxes) && p.box && p.box.length) { I = !0, P = y.shift; break } } return p }; F((function () { return Z(B, u.iconBox, t.WritingMode.horizontal) }), (function () { var i = u.verticalTextBox, o = z && z.box && z.box.length; return e.allowVerticalPlacement && !o && r.numVerticalGlyphVertices > 0 && i ? Z(i, u.verticalIconBox, t.WritingMode.vertical) : { box: null, offscreen: null } })), z && (I = z.box, S = z.offscreen); var q = O(z && z.box); if (!I && h.prevPlacement) { var j = h.prevPlacement.variableOffsets[r.crossTileID]; j && (h.variableOffsets[r.crossTileID] = j, h.markUsedJustification(e, j.anchor, r, q)); } } else { var V = function (t, o) { var a = h.collisionIndex.placeCollisionBox(t, p.get("text-allow-overlap"), n, i, x.predicate); return a && a.box && a.box.length && (h.markUsedOrientation(e, o, r), h.placedOrientations[r.crossTileID] = o), a }; F((function () { return V(B, t.WritingMode.horizontal) }), (function () { var i = u.verticalTextBox; return e.allowVerticalPlacement && r.numVerticalGlyphVertices > 0 && i ? V(i, t.WritingMode.vertical) : { box: null, offscreen: null } })), O(z && z.box && z.box.length); } } I = (T = z) && T.box && T.box.length > 0, S = T && T.offscreen; var G = u.textCircles; if (G) { var W = e.text.placedSymbolArray.get(r.centerJustifiedTextSymbolIndex), X = t.evaluateSizeForFeature(e.textSizeData, d, W); M = h.collisionIndex.placeCollisionCircles(G, p.get("text-allow-overlap"), a, n, W, e.lineVertexArray, e.glyphOffsetArray, X, i, o, s, w, x.predicate), I = p.get("text-allow-overlap") || M.circles.length > 0, S = S && M.offscreen; } if (u.iconFeatureIndex && (k = u.iconFeatureIndex), u.iconBox) { var H = function (t) { var e = E && P ? ge(t, P.x, P.y, b, w, h.transform.angle) : t; return h.collisionIndex.placeCollisionBox(e, p.get("icon-allow-overlap"), n, i, x.predicate) }; C = L && L.box && L.box.length && u.verticalIconBox ? (D = H(u.verticalIconBox)).box.length > 0 : (D = H(u.iconBox)).box.length > 0, S = S && D.offscreen; } var K = _ || 0 === r.numHorizontalGlyphVertices && 0 === r.numVerticalGlyphVertices, Y = f || 0 === r.numIconVertices; K || Y ? Y ? K || (C = C && I) : I = C && I : C = I = C && I, I && T && T.box && (L && L.box && R ? h.collisionIndex.insertCollisionBox(T.box, p.get("text-ignore-placement"), e.bucketInstanceId, R, x.ID) : h.collisionIndex.insertCollisionBox(T.box, p.get("text-ignore-placement"), e.bucketInstanceId, A, x.ID)), C && D && h.collisionIndex.insertCollisionBox(D.box, p.get("icon-ignore-placement"), e.bucketInstanceId, k, x.ID), I && M && h.collisionIndex.insertCollisionCircles(M.circles, p.get("text-ignore-placement"), e.bucketInstanceId, A, x.ID), h.placements[r.crossTileID] = new de(I || v, C || y, S || e.justReloaded), c[r.crossTileID] = !0; } }; if (T) for (var C = e.getSortedSymbolIndexes(this.transform.angle), S = C.length - 1; S >= 0; --S) { var P = C[S]; I(e.symbolInstances.get(P), e.collisionArrays[P]); } else for (var z = 0; z < e.symbolInstances.length; ++z)I(e.symbolInstances.get(z), e.collisionArrays[z]); e.justReloaded = !1; }, ve.prototype.markUsedJustification = function (e, i, o, r) { var a, n = { left: o.leftJustifiedTextSymbolIndex, center: o.centerJustifiedTextSymbolIndex, right: o.rightJustifiedTextSymbolIndex }; a = r === t.WritingMode.vertical ? o.verticalPlacedTextSymbolIndex : n[t.getAnchorJustification(i)]; for (var s = 0, l = [o.leftJustifiedTextSymbolIndex, o.centerJustifiedTextSymbolIndex, o.rightJustifiedTextSymbolIndex, o.verticalPlacedTextSymbolIndex]; s < l.length; s += 1) { var c = l[s]; c >= 0 && (e.text.placedSymbolArray.get(c).crossTileID = a >= 0 && c !== a ? 0 : o.crossTileID); } }, ve.prototype.markUsedOrientation = function (e, i, o) { for (var r = i === t.WritingMode.horizontal || i === t.WritingMode.horizontalOnly ? i : 0, a = i === t.WritingMode.vertical ? i : 0, n = 0, s = [o.leftJustifiedTextSymbolIndex, o.centerJustifiedTextSymbolIndex, o.rightJustifiedTextSymbolIndex]; n < s.length; n += 1) { var l = s[n]; e.text.placedSymbolArray.get(l).placedOrientation = r; } o.verticalPlacedTextSymbolIndex && (e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).placedOrientation = a); }, ve.prototype.commit = function (t) { this.commitTime = t, this.zoomAtLastRecencyCheck = this.transform.zoom; var e = this.prevPlacement, i = !1; this.prevZoomAdjustment = e ? e.zoomAdjustment(this.transform.zoom) : 0; var o = e ? e.symbolFadeChange(t) : 1, r = e ? e.opacities : {}, a = e ? e.variableOffsets : {}, n = e ? e.placedOrientations : {}; for (var s in this.placements) { var l = this.placements[s], c = r[s]; c ? (this.opacities[s] = new pe(c, o, l.text, l.icon), i = i || l.text !== c.text.placed || l.icon !== c.icon.placed) : (this.opacities[s] = new pe(null, o, l.text, l.icon, l.skipFade), i = i || l.text || l.icon); } for (var u in r) { var h = r[u]; if (!this.opacities[u]) { var p = new pe(h, o, !1, !1); p.isHidden() || (this.opacities[u] = p, i = i || h.text.placed || h.icon.placed); } } for (var d in a) this.variableOffsets[d] || !this.opacities[d] || this.opacities[d].isHidden() || (this.variableOffsets[d] = a[d]); for (var _ in n) this.placedOrientations[_] || !this.opacities[_] || this.opacities[_].isHidden() || (this.placedOrientations[_] = n[_]); i ? this.lastPlacementChangeTime = t : "number" != typeof this.lastPlacementChangeTime && (this.lastPlacementChangeTime = e ? e.lastPlacementChangeTime : t); }, ve.prototype.updateLayerOpacities = function (t, e) { for (var i = {}, o = 0, r = e; o < r.length; o += 1) { var a = r[o], n = a.getBucket(t); n && a.latestFeatureIndex && t.id === n.layerIds[0] && this.updateBucketOpacities(n, i, a.collisionBoxArray); } }, ve.prototype.updateBucketOpacities = function (e, i, o) { var r = this; e.hasTextData() && e.text.opacityVertexArray.clear(), e.hasIconData() && e.icon.opacityVertexArray.clear(), e.hasIconCollisionBoxData() && e.iconCollisionBox.collisionVertexArray.clear(), e.hasTextCollisionBoxData() && e.textCollisionBox.collisionVertexArray.clear(), e.hasIconCollisionCircleData() && e.iconCollisionCircle.collisionVertexArray.clear(), e.hasTextCollisionCircleData() && e.textCollisionCircle.collisionVertexArray.clear(); var a = e.layers[0].layout, n = new pe(null, 0, !1, !1, !0), s = a.get("text-allow-overlap"), l = a.get("icon-allow-overlap"), c = a.get("text-variable-anchor"), u = "map" === a.get("text-rotation-alignment"), h = "map" === a.get("text-pitch-alignment"), p = "none" !== a.get("icon-text-fit"), d = new pe(null, 0, s && (l || !e.hasIconData() || a.get("icon-optional")), l && (s || !e.hasTextData() || a.get("text-optional")), !0); !e.collisionArrays && o && (e.hasIconCollisionBoxData() || e.hasIconCollisionCircleData() || e.hasTextCollisionBoxData() || e.hasTextCollisionCircleData()) && e.deserializeCollisionBoxes(o); for (var _ = function (t, e, i) { for (var o = 0; o < e / 4; o++)t.opacityVertexArray.emplaceBack(i); }, f = function (o) { var a = e.symbolInstances.get(o), s = a.numHorizontalGlyphVertices, l = a.numVerticalGlyphVertices, f = a.crossTileID, m = i[f], g = r.opacities[f]; m ? g = n : g || (g = d, r.opacities[f] = g), i[f] = !0; var v = s > 0 || l > 0, y = a.numIconVertices > 0, x = r.placedOrientations[a.crossTileID], b = x === t.WritingMode.vertical, w = x === t.WritingMode.horizontal || x === t.WritingMode.horizontalOnly; if (v) { var E = Se(g.text), T = b ? Pe : E; _(e.text, s, T); var I = w ? Pe : E; _(e.text, l, I); var C = g.text.isHidden();[a.rightJustifiedTextSymbolIndex, a.centerJustifiedTextSymbolIndex, a.leftJustifiedTextSymbolIndex].forEach((function (t) { t >= 0 && (e.text.placedSymbolArray.get(t).hidden = C || b ? 1 : 0); })), a.verticalPlacedTextSymbolIndex >= 0 && (e.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden = C || w ? 1 : 0); var S = r.variableOffsets[a.crossTileID]; S && r.markUsedJustification(e, S.anchor, a, x); var P = r.placedOrientations[a.crossTileID]; P && (r.markUsedJustification(e, "left", a, P), r.markUsedOrientation(e, P, a)); } if (y) { var z = Se(g.icon), L = !(p && a.verticalPlacedIconSymbolIndex && b); if (a.placedIconSymbolIndex >= 0) { var M = L ? z : Pe; _(e.icon, a.numIconVertices, M), e.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden = g.icon.isHidden(); } if (a.verticalPlacedIconSymbolIndex >= 0) { var D = L ? Pe : z; _(e.icon, a.numVerticalIconVertices, D), e.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden = g.icon.isHidden(); } } if (e.hasIconCollisionBoxData() || e.hasIconCollisionCircleData() || e.hasTextCollisionBoxData() || e.hasTextCollisionCircleData()) { var A = e.collisionArrays[o]; if (A) { var R = new t.Point(0, 0); if (A.textBox || A.verticalTextBox) { var k = !0; if (c) { var B = r.variableOffsets[f]; B ? (R = me(B.anchor, B.width, B.height, B.textOffset, B.textBoxScale), u && R._rotate(h ? r.transform.angle : -r.transform.angle)) : k = !1; } A.textBox && ye(e.textCollisionBox.collisionVertexArray, g.text.placed, !k || b, R.x, R.y), A.verticalTextBox && ye(e.textCollisionBox.collisionVertexArray, g.text.placed, !k || w, R.x, R.y); } var O = Boolean(!w && A.verticalIconBox); A.iconBox && ye(e.iconCollisionBox.collisionVertexArray, g.icon.placed, O, p ? R.x : 0, p ? R.y : 0), A.verticalIconBox && ye(e.iconCollisionBox.collisionVertexArray, g.icon.placed, !O, p ? R.x : 0, p ? R.y : 0); var F = A.textCircles; if (F && e.hasTextCollisionCircleData()) for (var U = 0; U < F.length; U += 5) { var N = m || 0 === F[U + 4]; ye(e.textCollisionCircle.collisionVertexArray, g.text.placed, N); } } } }, m = 0; m < e.symbolInstances.length; m++)f(m); e.sortFeatures(this.transform.angle), this.retainedQueryData[e.bucketInstanceId] && (this.retainedQueryData[e.bucketInstanceId].featureSortOrder = e.featureSortOrder), e.hasTextData() && e.text.opacityVertexBuffer && e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray), e.hasIconData() && e.icon.opacityVertexBuffer && e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray), e.hasIconCollisionBoxData() && e.iconCollisionBox.collisionVertexBuffer && e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray), e.hasTextCollisionBoxData() && e.textCollisionBox.collisionVertexBuffer && e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray), e.hasIconCollisionCircleData() && e.iconCollisionCircle.collisionVertexBuffer && e.iconCollisionCircle.collisionVertexBuffer.updateData(e.iconCollisionCircle.collisionVertexArray), e.hasTextCollisionCircleData() && e.textCollisionCircle.collisionVertexBuffer && e.textCollisionCircle.collisionVertexBuffer.updateData(e.textCollisionCircle.collisionVertexArray); }, ve.prototype.symbolFadeChange = function (t) { return 0 === this.fadeDuration ? 1 : (t - this.commitTime) / this.fadeDuration + this.prevZoomAdjustment }, ve.prototype.zoomAdjustment = function (t) { return Math.max(0, (this.transform.zoom - t) / 1.5) }, ve.prototype.hasTransitions = function (t) { return this.stale || t - this.lastPlacementChangeTime < this.fadeDuration }, ve.prototype.stillRecent = function (t, e) { var i = this.zoomAtLastRecencyCheck === e ? 1 - this.zoomAdjustment(e) : 1; return this.zoomAtLastRecencyCheck = e, this.commitTime + this.fadeDuration * i > t }, ve.prototype.setStale = function () { this.stale = !0; }; var xe = Math.pow(2, 25), be = Math.pow(2, 24), we = Math.pow(2, 17), Ee = Math.pow(2, 16), Te = Math.pow(2, 9), Ie = Math.pow(2, 8), Ce = Math.pow(2, 1); function Se(t) { if (0 === t.opacity && !t.placed) return 0; if (1 === t.opacity && t.placed) return 4294967295; var e = t.placed ? 1 : 0, i = Math.floor(127 * t.opacity); return i * xe + e * be + i * we + e * Ee + i * Te + e * Ie + i * Ce + e } var Pe = 0, ze = function () { this._currentTileIndex = 0, this._seenCrossTileIDs = {}; }; ze.prototype.continuePlacement = function (t, e, i, o, r) { for (; this._currentTileIndex < t.length;) { var a = t[this._currentTileIndex]; if (e.placeLayerTile(o, a, i, this._seenCrossTileIDs), this._currentTileIndex++ , r()) return !0 } }; var Le = function (t, e, i, o, r, a, n) { this.placement = new ve(t, r, a, n), this._currentPlacementIndex = e.length - 1, this._forceFullPlacement = i, this._showCollisionBoxes = o, this._done = !1; }; Le.prototype.isDone = function () { return this._done }, Le.prototype.continuePlacement = function (e, i, o) { for (var r = this, a = t.browser.now(), n = function () { var e = t.browser.now() - a; return !r._forceFullPlacement && e > 2 }; this._currentPlacementIndex >= 0;) { var s = i[e[this._currentPlacementIndex]], l = this.placement.collisionIndex.transform.zoom; if ("symbol" === s.type && (!s.minzoom || s.minzoom <= l) && (!s.maxzoom || s.maxzoom > l)) { if (this._inProgressLayer || (this._inProgressLayer = new ze), this._inProgressLayer.continuePlacement(o[s.source], this.placement, this._showCollisionBoxes, s, n)) return; delete this._inProgressLayer; } this._currentPlacementIndex--; } this._done = !0; }, Le.prototype.commit = function (t) { return this.placement.commit(t), this.placement }; var Me = 512 / t.EXTENT / 2, De = function (t, e, i) { this.tileID = t, this.indexedSymbolInstances = {}, this.bucketInstanceId = i; for (var o = 0; o < e.length; o++) { var r = e.get(o), a = r.key; this.indexedSymbolInstances[a] || (this.indexedSymbolInstances[a] = []), this.indexedSymbolInstances[a].push({ crossTileID: r.crossTileID, coord: this.getScaledCoordinates(r, t) }); } }; De.prototype.getScaledCoordinates = function (e, i) { var o = i.canonical.z - this.tileID.canonical.z, r = Me / Math.pow(2, o); return { x: Math.floor((i.canonical.x * t.EXTENT + e.anchorX) * r), y: Math.floor((i.canonical.y * t.EXTENT + e.anchorY) * r) } }, De.prototype.findMatches = function (t, e, i) { for (var o = this.tileID.canonical.z < e.canonical.z ? 1 : Math.pow(2, this.tileID.canonical.z - e.canonical.z), r = 0; r < t.length; r++) { var a = t.get(r); if (!a.crossTileID) { var n = this.indexedSymbolInstances[a.key]; if (n) for (var s = this.getScaledCoordinates(a, e), l = 0, c = n; l < c.length; l += 1) { var u = c[l]; if (Math.abs(u.coord.x - s.x) <= o && Math.abs(u.coord.y - s.y) <= o && !i[u.crossTileID]) { i[u.crossTileID] = !0, a.crossTileID = u.crossTileID; break } } } } }; var Ae = function () { this.maxCrossTileID = 0; }; Ae.prototype.generate = function () { return ++this.maxCrossTileID }; var Re = function () { this.indexes = {}, this.usedCrossTileIDs = {}, this.lng = 0; }; Re.prototype.handleWrapJump = function (t) { var e = Math.round((t - this.lng) / 360); if (0 !== e) for (var i in this.indexes) { var o = this.indexes[i], r = {}; for (var a in o) { var n = o[a]; n.tileID = n.tileID.unwrapTo(n.tileID.wrap + e), r[n.tileID.key] = n; } this.indexes[i] = r; } this.lng = t; }, Re.prototype.addBucket = function (t, e, i) { if (this.indexes[t.overscaledZ] && this.indexes[t.overscaledZ][t.key]) { if (this.indexes[t.overscaledZ][t.key].bucketInstanceId === e.bucketInstanceId) return !1; this.removeBucketCrossTileIDs(t.overscaledZ, this.indexes[t.overscaledZ][t.key]); } for (var o = 0; o < e.symbolInstances.length; o++) { e.symbolInstances.get(o).crossTileID = 0; } this.usedCrossTileIDs[t.overscaledZ] || (this.usedCrossTileIDs[t.overscaledZ] = {}); var r = this.usedCrossTileIDs[t.overscaledZ]; for (var a in this.indexes) { var n = this.indexes[a]; if (Number(a) > t.overscaledZ) for (var s in n) { var l = n[s]; l.tileID.isChildOf(t) && l.findMatches(e.symbolInstances, t, r); } else { var c = n[t.scaledTo(Number(a)).key]; c && c.findMatches(e.symbolInstances, t, r); } } for (var u = 0; u < e.symbolInstances.length; u++) { var h = e.symbolInstances.get(u); h.crossTileID || (h.crossTileID = i.generate(), r[h.crossTileID] = !0); } return void 0 === this.indexes[t.overscaledZ] && (this.indexes[t.overscaledZ] = {}), this.indexes[t.overscaledZ][t.key] = new De(t, e.symbolInstances, e.bucketInstanceId), !0 }, Re.prototype.removeBucketCrossTileIDs = function (t, e) { for (var i in e.indexedSymbolInstances) for (var o = 0, r = e.indexedSymbolInstances[i]; o < r.length; o += 1) { var a = r[o]; delete this.usedCrossTileIDs[t][a.crossTileID]; } }, Re.prototype.removeStaleBuckets = function (t) { var e = !1; for (var i in this.indexes) { var o = this.indexes[i]; for (var r in o) t[o[r].bucketInstanceId] || (this.removeBucketCrossTileIDs(i, o[r]), delete o[r], e = !0); } return e }; var ke = function () { this.layerIndexes = {}, this.crossTileIDs = new Ae, this.maxBucketInstanceId = 0, this.bucketsInCurrentPlacement = {}; }; ke.prototype.addLayer = function (t, e, i) { var o = this.layerIndexes[t.id]; void 0 === o && (o = this.layerIndexes[t.id] = new Re); var r = !1, a = {}; o.handleWrapJump(i); for (var n = 0, s = e; n < s.length; n += 1) { var l = s[n], c = l.getBucket(t); c && t.id === c.layerIds[0] && (c.bucketInstanceId || (c.bucketInstanceId = ++this.maxBucketInstanceId), o.addBucket(l.tileID, c, this.crossTileIDs) && (r = !0), a[c.bucketInstanceId] = !0); } return o.removeStaleBuckets(a) && (r = !0), r }, ke.prototype.pruneUnusedLayers = function (t) { var e = {}; for (var i in t.forEach((function (t) { e[t] = !0; })), this.layerIndexes) e[i] || delete this.layerIndexes[i]; }; var Be = function (e, i) { return t.emitValidationErrors(e, i && i.filter((function (t) { return "source.canvas" !== t.identifier }))) }, Oe = t.pick(Ut, ["addLayer", "removeLayer", "setPaintProperty", "setLayoutProperty", "setFilter", "addSource", "removeSource", "setLayerZoomRange", "setLight", "setTransition", "setGeoJSONSourceData"]), Fe = t.pick(Ut, ["setCenter", "setZoom", "setBearing", "setPitch"]), Ue = function (e) { function i(o, r) { var a = this; void 0 === r && (r = {}), e.call(this), this.map = o, this.dispatcher = new T((kt || (kt = new Rt), kt), this), this.imageManager = new p, this.imageManager.setEventedParent(this), this.glyphManager = new y(o._requestManager, r.localIdeographFontFamily), this.lineAtlas = new E(256, 512), this.crossTileSymbolIndex = new ke, this._layers = {}, this._order = [], this.sourceCaches = {}, this.zoomHistory = new t.ZoomHistory, this._loaded = !1, this._resetUpdates(), this.dispatcher.broadcast("setReferrer", t.getReferrer()); var n = this; this._rtlTextPluginCallback = i.registerForPluginStateChange((function (e) { var i = { pluginStatus: e.pluginStatus, pluginURL: e.pluginURL }; n.dispatcher.broadcast("syncRTLPluginState", i, (function (e, i) { if ((t.triggerPluginCompletionEvent(e), i) && i.every((function (t) { return t }))) for (var o in n.sourceCaches) n.sourceCaches[o].reload(); })); })), this.on("data", (function (t) { if ("source" === t.dataType && "metadata" === t.sourceDataType) { var e = a.sourceCaches[t.sourceId]; if (e) { var i = e.getSource(); if (i && i.vectorLayerIds) for (var o in a._layers) { var r = a._layers[o]; r.source === i.id && a._validateLayer(r); } } } })); } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.loadURL = function (e, i) { var o = this; void 0 === i && (i = {}), this.fire(new t.Event("dataloading", { dataType: "style" })); var r = "boolean" == typeof i.validate ? i.validate : !t.isMapboxURL(e); e = this.map._requestManager.normalizeStyleURL(e, i.accessToken); var a = this.map._requestManager.transformRequest(e, t.ResourceType.Style); this._request = t.getJSON(a, (function (e, i) { o._request = null, e ? o.fire(new t.ErrorEvent(e)) : i && o._load(i, r); })); }, i.prototype.loadJSON = function (e, i) { var o = this; void 0 === i && (i = {}), this.fire(new t.Event("dataloading", { dataType: "style" })), this._request = t.browser.frame((function () { o._request = null, o._load(e, !1 !== i.validate); })); }, i.prototype._load = function (e, i) { var o = this; if (!i || !Be(this, t.validateStyle(e))) { for (var r in this._loaded = !0, this.stylesheet = e, e.sources) this.addSource(r, e.sources[r], { validate: !1 }); e.sprite ? this._spriteRequest = function (e, i, o) { var r, a, n, s = t.browser.devicePixelRatio > 1 ? "@2x" : "", l = t.getJSON(i.transformRequest(i.normalizeSpriteURL(e, s, ".json"), t.ResourceType.SpriteJSON), (function (t, e) { l = null, n || (n = t, r = e, u()); })), c = t.getImage(i.transformRequest(i.normalizeSpriteURL(e, s, ".png"), t.ResourceType.SpriteImage), (function (t, e) { c = null, n || (n = t, a = e, u()); })); function u() { if (n) o(n); else if (r && a) { var e = t.browser.getImageData(a), i = {}; for (var s in r) { var l = r[s], c = l.width, u = l.height, h = l.x, p = l.y, d = l.sdf, _ = l.pixelRatio, f = l.stretchX, m = l.stretchY, g = l.content, v = new t.RGBAImage({ width: c, height: u }); t.RGBAImage.copy(e, v, { x: h, y: p }, { x: 0, y: 0 }, { width: c, height: u }), i[s] = { data: v, pixelRatio: _, sdf: d, stretchX: f, stretchY: m, content: g }; } o(null, i); } } return { cancel: function () { l && (l.cancel(), l = null), c && (c.cancel(), c = null); } } }(e.sprite, this.map._requestManager, (function (e, i) { if (o._spriteRequest = null, e) o.fire(new t.ErrorEvent(e)); else if (i) for (var r in i) o.imageManager.addImage(r, i[r]); o.imageManager.setLoaded(!0), o.dispatcher.broadcast("setImages", o.imageManager.listImages()), o.fire(new t.Event("data", { dataType: "style" })); })) : this.imageManager.setLoaded(!0), this.glyphManager.setURL(e.glyphs); var a = Ft(this.stylesheet.layers); this._order = a.map((function (t) { return t.id })), this._layers = {}; for (var n = 0, s = a; n < s.length; n += 1) { var l = s[n]; (l = t.createStyleLayer(l)).setEventedParent(this, { layer: { id: l.id } }), this._layers[l.id] = l; } this.dispatcher.broadcast("setLayers", this._serializeLayers(this._order)), this.light = new w(this.stylesheet.light), this.fire(new t.Event("data", { dataType: "style" })), this.fire(new t.Event("style.load")); } }, i.prototype._validateLayer = function (e) { var i = this.sourceCaches[e.source]; if (i) { var o = e.sourceLayer; if (o) { var r = i.getSource(); ("geojson" === r.type || r.vectorLayerIds && -1 === r.vectorLayerIds.indexOf(o)) && this.fire(new t.ErrorEvent(new Error('Source layer "' + o + '" does not exist on source "' + r.id + '" as specified by style layer "' + e.id + '"'))); } } }, i.prototype.loaded = function () { if (!this._loaded) return !1; if (Object.keys(this._updatedSources).length) return !1; for (var t in this.sourceCaches) if (!this.sourceCaches[t].loaded()) return !1; return !!this.imageManager.isLoaded() }, i.prototype._serializeLayers = function (t) { for (var e = [], i = 0, o = t; i < o.length; i += 1) { var r = o[i], a = this._layers[r]; "custom" !== a.type && e.push(a.serialize()); } return e }, i.prototype.hasTransitions = function () { if (this.light && this.light.hasTransition()) return !0; for (var t in this.sourceCaches) if (this.sourceCaches[t].hasTransition()) return !0; for (var e in this._layers) if (this._layers[e].hasTransition()) return !0; return !1 }, i.prototype._checkLoaded = function () { if (!this._loaded) throw new Error("Style is not done loading") }, i.prototype.update = function (e) { if (this._loaded) { var i = this._changed; if (this._changed) { var o = Object.keys(this._updatedLayers), r = Object.keys(this._removedLayers); for (var a in (o.length || r.length) && this._updateWorkerLayers(o, r), this._updatedSources) { var n = this._updatedSources[a]; "reload" === n ? this._reloadSource(a) : "clear" === n && this._clearSource(a); } for (var s in this._updateTilesForChangedImages(), this._updatedPaintProps) this._layers[s].updateTransitions(e); this.light.updateTransitions(e), this._resetUpdates(); } for (var l in this.sourceCaches) this.sourceCaches[l].used = !1; for (var c = 0, u = this._order; c < u.length; c += 1) { var h = u[c], p = this._layers[h]; p.recalculate(e, this.imageManager.listImages()), !p.isHidden(e.zoom) && p.source && (this.sourceCaches[p.source].used = !0); } this.light.recalculate(e), this.z = e.zoom, i && this.fire(new t.Event("data", { dataType: "style" })); } }, i.prototype._updateTilesForChangedImages = function () { var t = Object.keys(this._changedImages); if (t.length) { for (var e in this.sourceCaches) this.sourceCaches[e].reloadTilesForDependencies(["icons", "patterns"], t); this._changedImages = {}; } }, i.prototype._updateWorkerLayers = function (t, e) { this.dispatcher.broadcast("updateLayers", { layers: this._serializeLayers(t), removedIds: e }); }, i.prototype._resetUpdates = function () { this._changed = !1, this._updatedLayers = {}, this._removedLayers = {}, this._updatedSources = {}, this._updatedPaintProps = {}, this._changedImages = {}; }, i.prototype.setState = function (e) { var i = this; if (this._checkLoaded(), Be(this, t.validateStyle(e))) return !1; (e = t.clone$1(e)).layers = Ft(e.layers); var o = Xt(this.serialize(), e).filter((function (t) { return !(t.command in Fe) })); if (0 === o.length) return !1; var r = o.filter((function (t) { return !(t.command in Oe) })); if (r.length > 0) throw new Error("Unimplemented: " + r.map((function (t) { return t.command })).join(", ") + "."); return o.forEach((function (t) { "setTransition" !== t.command && i[t.command].apply(i, t.args); })), this.stylesheet = e, !0 }, i.prototype.addImage = function (e, i) { if (this.getImage(e)) return this.fire(new t.ErrorEvent(new Error("An image with this name already exists."))); this.imageManager.addImage(e, i), this._changedImages[e] = !0, this._changed = !0, this.fire(new t.Event("data", { dataType: "style" })); }, i.prototype.updateImage = function (t, e) { this.imageManager.updateImage(t, e); }, i.prototype.getImage = function (t) { return this.imageManager.getImage(t) }, i.prototype.removeImage = function (e) { if (!this.getImage(e)) return this.fire(new t.ErrorEvent(new Error("No image with this name exists."))); this.imageManager.removeImage(e), this._changedImages[e] = !0, this._changed = !0, this.fire(new t.Event("data", { dataType: "style" })); }, i.prototype.listImages = function () { return this._checkLoaded(), this.imageManager.listImages() }, i.prototype.addSource = function (e, i, o) { var r = this; if (void 0 === o && (o = {}), this._checkLoaded(), void 0 !== this.sourceCaches[e]) throw new Error("There is already a source with this ID"); if (!i.type) throw new Error("The type property must be defined, but the only the following properties were given: " + Object.keys(i).join(", ") + "."); if (!(["vector", "raster", "geojson", "video", "image"].indexOf(i.type) >= 0) || !this._validate(t.validateStyle.source, "sources." + e, i, null, o)) { this.map && this.map._collectResourceTiming && (i.collectResourceTiming = !0); var a = this.sourceCaches[e] = new Lt(e, i, this.dispatcher); a.style = this, a.setEventedParent(this, (function () { return { isSourceLoaded: r.loaded(), source: a.serialize(), sourceId: e } })), a.onAdd(this.map), this._changed = !0; } }, i.prototype.removeSource = function (e) { if (this._checkLoaded(), void 0 === this.sourceCaches[e]) throw new Error("There is no source with this ID"); for (var i in this._layers) if (this._layers[i].source === e) return this.fire(new t.ErrorEvent(new Error('Source "' + e + '" cannot be removed while layer "' + i + '" is using it.'))); var o = this.sourceCaches[e]; delete this.sourceCaches[e], delete this._updatedSources[e], o.fire(new t.Event("data", { sourceDataType: "metadata", dataType: "source", sourceId: e })), o.setEventedParent(null), o.clearTiles(), o.onRemove && o.onRemove(this.map), this._changed = !0; }, i.prototype.setGeoJSONSourceData = function (t, e) { this._checkLoaded(), this.sourceCaches[t].getSource().setData(e), this._changed = !0; }, i.prototype.getSource = function (t) { return this.sourceCaches[t] && this.sourceCaches[t].getSource() }, i.prototype.addLayer = function (e, i, o) { void 0 === o && (o = {}), this._checkLoaded(); var r = e.id; if (this.getLayer(r)) this.fire(new t.ErrorEvent(new Error('Layer with id "' + r + '" already exists on this map'))); else { var a; if ("custom" === e.type) { if (Be(this, t.validateCustomStyleLayer(e))) return; a = t.createStyleLayer(e); } else { if ("object" == typeof e.source && (this.addSource(r, e.source), e = t.clone$1(e), e = t.extend(e, { source: r })), this._validate(t.validateStyle.layer, "layers." + r, e, { arrayIndex: -1 }, o)) return; a = t.createStyleLayer(e), this._validateLayer(a), a.setEventedParent(this, { layer: { id: r } }); } var n = i ? this._order.indexOf(i) : this._order.length; if (i && -1 === n) this.fire(new t.ErrorEvent(new Error('Layer with id "' + i + '" does not exist on this map.'))); else { if (this._order.splice(n, 0, r), this._layerOrderChanged = !0, this._layers[r] = a, this._removedLayers[r] && a.source && "custom" !== a.type) { var s = this._removedLayers[r]; delete this._removedLayers[r], s.type !== a.type ? this._updatedSources[a.source] = "clear" : (this._updatedSources[a.source] = "reload", this.sourceCaches[a.source].pause()); } this._updateLayer(a), a.onAdd && a.onAdd(this.map); } } }, i.prototype.moveLayer = function (e, i) { if (this._checkLoaded(), this._changed = !0, this._layers[e]) { if (e !== i) { var o = this._order.indexOf(e); this._order.splice(o, 1); var r = i ? this._order.indexOf(i) : this._order.length; i && -1 === r ? this.fire(new t.ErrorEvent(new Error('Layer with id "' + i + '" does not exist on this map.'))) : (this._order.splice(r, 0, e), this._layerOrderChanged = !0); } } else this.fire(new t.ErrorEvent(new Error("The layer '" + e + "' does not exist in the map's style and cannot be moved."))); }, i.prototype.removeLayer = function (e) { this._checkLoaded(); var i = this._layers[e]; if (i) { i.setEventedParent(null); var o = this._order.indexOf(e); this._order.splice(o, 1), this._layerOrderChanged = !0, this._changed = !0, this._removedLayers[e] = i, delete this._layers[e], delete this._updatedLayers[e], delete this._updatedPaintProps[e], i.onRemove && i.onRemove(this.map); } else this.fire(new t.ErrorEvent(new Error("The layer '" + e + "' does not exist in the map's style and cannot be removed."))); }, i.prototype.getLayer = function (t) { return this._layers[t] }, i.prototype.setLayerZoomRange = function (e, i, o) { this._checkLoaded(); var r = this.getLayer(e); r ? r.minzoom === i && r.maxzoom === o || (null != i && (r.minzoom = i), null != o && (r.maxzoom = o), this._updateLayer(r)) : this.fire(new t.ErrorEvent(new Error("The layer '" + e + "' does not exist in the map's style and cannot have zoom extent."))); }, i.prototype.setFilter = function (e, i, o) { void 0 === o && (o = {}), this._checkLoaded(); var r = this.getLayer(e); if (r) { if (!t.deepEqual(r.filter, i)) return null == i ? (r.filter = void 0, void this._updateLayer(r)) : void (this._validate(t.validateStyle.filter, "layers." + r.id + ".filter", i, null, o) || (r.filter = t.clone$1(i), this._updateLayer(r))) } else this.fire(new t.ErrorEvent(new Error("The layer '" + e + "' does not exist in the map's style and cannot be filtered."))); }, i.prototype.getFilter = function (e) { return t.clone$1(this.getLayer(e).filter) }, i.prototype.setLayoutProperty = function (e, i, o, r) { void 0 === r && (r = {}), this._checkLoaded(); var a = this.getLayer(e); a ? t.deepEqual(a.getLayoutProperty(i), o) || (a.setLayoutProperty(i, o, r), this._updateLayer(a)) : this.fire(new t.ErrorEvent(new Error("The layer '" + e + "' does not exist in the map's style and cannot be styled."))); }, i.prototype.getLayoutProperty = function (e, i) { var o = this.getLayer(e); if (o) return o.getLayoutProperty(i); this.fire(new t.ErrorEvent(new Error("The layer '" + e + "' does not exist in the map's style."))); }, i.prototype.setPaintProperty = function (e, i, o, r) { void 0 === r && (r = {}), this._checkLoaded(); var a = this.getLayer(e); a ? t.deepEqual(a.getPaintProperty(i), o) || (a.setPaintProperty(i, o, r) && this._updateLayer(a), this._changed = !0, this._updatedPaintProps[e] = !0) : this.fire(new t.ErrorEvent(new Error("The layer '" + e + "' does not exist in the map's style and cannot be styled."))); }, i.prototype.getPaintProperty = function (t, e) { return this.getLayer(t).getPaintProperty(e) }, i.prototype.setFeatureState = function (e, i) { this._checkLoaded(); var o = e.source, r = e.sourceLayer, a = this.sourceCaches[o], n = parseInt(e.id, 10); if (void 0 !== a) { var s = a.getSource().type; "geojson" === s && r ? this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))) : "vector" !== s || r ? isNaN(n) || n < 0 ? this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided and non-negative."))) : a.setFeatureState(r, n, i) : this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types."))); } else this.fire(new t.ErrorEvent(new Error("The source '" + o + "' does not exist in the map's style."))); }, i.prototype.removeFeatureState = function (e, i) { this._checkLoaded(); var o = e.source, r = this.sourceCaches[o]; if (void 0 !== r) { var a = r.getSource().type, n = "vector" === a ? e.sourceLayer : void 0, s = parseInt(e.id, 10); "vector" !== a || n ? void 0 !== e.id && isNaN(s) || s < 0 ? this.fire(new t.ErrorEvent(new Error("The feature id parameter must be non-negative."))) : i && "string" != typeof e.id && "number" != typeof e.id ? this.fire(new t.ErrorEvent(new Error("A feature id is requred to remove its specific state property."))) : r.removeFeatureState(n, s, i) : this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types."))); } else this.fire(new t.ErrorEvent(new Error("The source '" + o + "' does not exist in the map's style."))); }, i.prototype.getFeatureState = function (e) { this._checkLoaded(); var i = e.source, o = e.sourceLayer, r = this.sourceCaches[i], a = parseInt(e.id, 10); if (void 0 !== r) if ("vector" !== r.getSource().type || o) { if (!(isNaN(a) || a < 0)) return r.getFeatureState(o, a); this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided and non-negative."))); } else this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types."))); else this.fire(new t.ErrorEvent(new Error("The source '" + i + "' does not exist in the map's style."))); }, i.prototype.getTransition = function () { return t.extend({ duration: 300, delay: 0 }, this.stylesheet && this.stylesheet.transition) }, i.prototype.serialize = function () { return t.filterObject({ version: this.stylesheet.version, name: this.stylesheet.name, metadata: this.stylesheet.metadata, light: this.stylesheet.light, center: this.stylesheet.center, zoom: this.stylesheet.zoom, bearing: this.stylesheet.bearing, pitch: this.stylesheet.pitch, sprite: this.stylesheet.sprite, glyphs: this.stylesheet.glyphs, transition: this.stylesheet.transition, sources: t.mapObject(this.sourceCaches, (function (t) { return t.serialize() })), layers: this._serializeLayers(this._order) }, (function (t) { return void 0 !== t })) }, i.prototype._updateLayer = function (t) { this._updatedLayers[t.id] = !0, t.source && !this._updatedSources[t.source] && "raster" !== this.sourceCaches[t.source].getSource().type && (this._updatedSources[t.source] = "reload", this.sourceCaches[t.source].pause()), this._changed = !0; }, i.prototype._flattenAndSortRenderedFeatures = function (t) { for (var e = this, i = function (t) { return "fill-extrusion" === e._layers[t].type }, o = {}, r = [], a = this._order.length - 1; a >= 0; a--) { var n = this._order[a]; if (i(n)) { o[n] = a; for (var s = 0, l = t; s < l.length; s += 1) { var c = l[s][n]; if (c) for (var u = 0, h = c; u < h.length; u += 1) { var p = h[u]; r.push(p); } } } } r.sort((function (t, e) { return e.intersectionZ - t.intersectionZ })); for (var d = [], _ = this._order.length - 1; _ >= 0; _--) { var f = this._order[_]; if (i(f)) for (var m = r.length - 1; m >= 0; m--) { var g = r[m].feature; if (o[g.layer.id] < _) break; d.push(g), r.pop(); } else for (var v = 0, y = t; v < y.length; v += 1) { var x = y[v][f]; if (x) for (var b = 0, w = x; b < w.length; b += 1) { var E = w[b]; d.push(E.feature); } } } return d }, i.prototype.queryRenderedFeatures = function (e, i, o) { i && i.filter && this._validate(t.validateStyle.filter, "queryRenderedFeatures.filter", i.filter, null, i); var r = {}; if (i && i.layers) { if (!Array.isArray(i.layers)) return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))), []; for (var a = 0, n = i.layers; a < n.length; a += 1) { var s = n[a], l = this._layers[s]; if (!l) return this.fire(new t.ErrorEvent(new Error("The layer '" + s + "' does not exist in the map's style and cannot be queried for features."))), []; r[l.source] = !0; } } var c = []; for (var u in this.sourceCaches) i.layers && !r[u] || c.push(O(this.sourceCaches[u], this._layers, e, i, o)); return this.placement && c.push(function (t, e, i, o, r, a) { for (var n = {}, s = r.queryRenderedSymbols(i), l = [], c = 0, u = Object.keys(s).map(Number); c < u.length; c += 1) { var h = u[c]; l.push(a[h]); } l.sort(F); for (var p = function () { var e = _[d], i = e.featureIndex.lookupSymbolFeatures(s[e.bucketInstanceId], e.bucketIndex, e.sourceLayerIndex, o.filter, o.layers, t); for (var r in i) { var a = n[r] = n[r] || [], l = i[r]; l.sort((function (t, i) { var o = e.featureSortOrder; if (o) { var r = o.indexOf(t.featureIndex); return o.indexOf(i.featureIndex) - r } return i.featureIndex - t.featureIndex })); for (var c = 0, u = l; c < u.length; c += 1) { var h = u[c]; a.push(h); } } }, d = 0, _ = l; d < _.length; d += 1)p(); var f = function (i) { n[i].forEach((function (o) { var r = o.feature, a = t[i], n = e[a.source].getFeatureState(r.layer["source-layer"], r.id); r.source = r.layer.source, r.layer["source-layer"] && (r.sourceLayer = r.layer["source-layer"]), r.state = n; })); }; for (var m in n) f(m); return n }(this._layers, this.sourceCaches, e, i, this.placement.collisionIndex, this.placement.retainedQueryData)), this._flattenAndSortRenderedFeatures(c) }, i.prototype.querySourceFeatures = function (e, i) { i && i.filter && this._validate(t.validateStyle.filter, "querySourceFeatures.filter", i.filter, null, i); var o = this.sourceCaches[e]; return o ? function (t, e) { for (var i = t.getRenderableIds().map((function (e) { return t.getTileByID(e) })), o = [], r = {}, a = 0; a < i.length; a++) { var n = i[a], s = n.tileID.canonical.key; r[s] || (r[s] = !0, n.querySourceFeatures(o, e)); } return o }(o, i) : [] }, i.prototype.addSourceType = function (t, e, o) { return i.getSourceType(t) ? o(new Error('A source type called "' + t + '" already exists.')) : (i.setSourceType(t, e), e.workerSourceURL ? void this.dispatcher.broadcast("loadWorkerSource", { name: t, url: e.workerSourceURL }, o) : o(null, null)) }, i.prototype.getLight = function () { return this.light.getLight() }, i.prototype.setLight = function (e, i) { void 0 === i && (i = {}), this._checkLoaded(); var o = this.light.getLight(), r = !1; for (var a in e) if (!t.deepEqual(e[a], o[a])) { r = !0; break } if (r) { var n = { now: t.browser.now(), transition: t.extend({ duration: 300, delay: 0 }, this.stylesheet.transition) }; this.light.setLight(e, i), this.light.updateTransitions(n); } }, i.prototype._validate = function (e, i, o, r, a) { return void 0 === a && (a = {}), (!a || !1 !== a.validate) && Be(this, e.call(t.validateStyle, t.extend({ key: i, style: this.serialize(), value: o, styleSpec: t.styleSpec }, r))) }, i.prototype._remove = function () { for (var e in this._request && (this._request.cancel(), this._request = null), this._spriteRequest && (this._spriteRequest.cancel(), this._spriteRequest = null), t.evented.off("pluginStateChange", this._rtlTextPluginCallback), this._layers) { this._layers[e].setEventedParent(null); } for (var i in this.sourceCaches) this.sourceCaches[i].clearTiles(), this.sourceCaches[i].setEventedParent(null); this.imageManager.setEventedParent(null), this.setEventedParent(null), this.dispatcher.remove(); }, i.prototype._clearSource = function (t) { this.sourceCaches[t].clearTiles(); }, i.prototype._reloadSource = function (t) { this.sourceCaches[t].resume(), this.sourceCaches[t].reload(); }, i.prototype._updateSources = function (t) { for (var e in this.sourceCaches) this.sourceCaches[e].update(t); }, i.prototype._generateCollisionBoxes = function () { for (var t in this.sourceCaches) this._reloadSource(t); }, i.prototype._updatePlacement = function (e, i, o, r) { for (var a = !1, n = !1, s = {}, l = 0, c = this._order; l < c.length; l += 1) { var u = c[l], h = this._layers[u]; if ("symbol" === h.type) { if (!s[h.source]) { var p = this.sourceCaches[h.source]; s[h.source] = p.getRenderableIds(!0).map((function (t) { return p.getTileByID(t) })).sort((function (t, e) { return e.tileID.overscaledZ - t.tileID.overscaledZ || (t.tileID.isLessThan(e.tileID) ? -1 : 1) })); } var d = this.crossTileSymbolIndex.addLayer(h, s[h.source], e.center.lng); a = a || d; } } this.crossTileSymbolIndex.pruneUnusedLayers(this._order); var _ = this._layerOrderChanged || 0 === o; if ((_ || !this.pauseablePlacement || this.pauseablePlacement.isDone() && !this.placement.stillRecent(t.browser.now(), e.zoom)) && (this.pauseablePlacement = new Le(e, this._order, _, i, o, r, this.placement), this._layerOrderChanged = !1), this.pauseablePlacement.isDone() ? this.placement.setStale() : (this.pauseablePlacement.continuePlacement(this._order, this._layers, s), this.pauseablePlacement.isDone() && (this.placement = this.pauseablePlacement.commit(t.browser.now()), n = !0), a && this.pauseablePlacement.placement.setStale()), n || a) for (var f = 0, m = this._order; f < m.length; f += 1) { var g = m[f], v = this._layers[g]; "symbol" === v.type && this.placement.updateLayerOpacities(v, s[v.source]); } return !this.pauseablePlacement.isDone() || this.placement.hasTransitions(t.browser.now()) }, i.prototype._releaseSymbolFadeTiles = function () { for (var t in this.sourceCaches) this.sourceCaches[t].releaseSymbolFadeTiles(); }, i.prototype.getImages = function (t, e, i) { this.imageManager.getImages(e.icons, i), this._updateTilesForChangedImages(); var o = this.sourceCaches[e.source]; o && o.setDependencies(e.tileID.key, e.type, e.icons); }, i.prototype.getGlyphs = function (t, e, i) { this.glyphManager.getGlyphs(e.stacks, i); }, i.prototype.getResource = function (e, i, o) { return t.makeRequest(i, o) }, i }(t.Evented); Ue.getSourceType = function (t) { return R[t] }, Ue.setSourceType = function (t, e) { R[t] = e; }, Ue.registerForPluginStateChange = t.registerForPluginStateChange; var Ne = t.createLayout([{ name: "a_pos", type: "Int16", components: 2 }]), Ze = di("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif", "#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}"), qe = di("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), je = di("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"), Ve = di("varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"), Ge = di("void main() {gl_FragColor=vec4(1.0);}", "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), We = di("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"), Xe = di("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"), He = di("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}", "attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"), Ke = di("uniform float u_overscale_factor;varying float v_placed;varying float v_notUsed;varying float v_radius;varying vec2 v_extrude;varying vec2 v_extrude_scale;void main() {float alpha=0.5;vec4 color=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {color=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {color*=.2;}float extrude_scale_length=length(v_extrude_scale);float extrude_length=length(v_extrude)*extrude_scale_length;float stroke_width=15.0*extrude_scale_length/u_overscale_factor;float radius=v_radius*extrude_scale_length;float distance_to_edge=abs(extrude_length-radius);float opacity_t=smoothstep(-stroke_width,0.0,-distance_to_edge);gl_FragColor=opacity_t*color;}", "attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;varying float v_radius;varying vec2 v_extrude;varying vec2 v_extrude_scale;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);highp float padding_factor=1.2;gl_Position.xy+=a_extrude*u_extrude_scale*padding_factor*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;v_radius=abs(a_extrude.y);v_extrude=a_extrude*padding_factor;v_extrude_scale=u_extrude_scale*u_camera_to_center_distance*collision_perspective_ratio;}"), Ye = di("uniform highp vec4 u_color;void main() {gl_FragColor=u_color;}", "attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"), Je = di("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"), Qe = di("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"), $e = di("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec4 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"), ti = di("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec4 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileZoomRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"), ei = di("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"), ii = di("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec4 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"), oi = di("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform float u_maxzoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggeration=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/ pow(2.0,(u_zoom-u_maxzoom)*exaggeration+19.2562-u_zoom);gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"), ri = di("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"), ai = di("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"), ni = di("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,vec2(v_lineprogress,0.5));gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "\n#define MAX_LINE_DISTANCE 32767.0\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_lineprogress=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0/MAX_LINE_DISTANCE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"), si = di("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec4 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileZoomRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x,1.0);float x_b=mod(v_linesofar/pattern_size_b.x,1.0);float y_a=0.5+(v_normal.y*clamp(v_width2.s,0.0,(pattern_size_a.y+2.0)/2.0)/pattern_size_a.y);float y_b=0.5+(v_normal.y*clamp(v_width2.s,0.0,(pattern_size_b.y+2.0)/2.0)/pattern_size_b.y);vec2 pos_a=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,vec2(x_a,y_a));vec2 pos_b=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,vec2(x_b,y_b));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);}"), li = di("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\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 lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\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 lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"), ci = di("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"), ui = di("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"), hi = di("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"), pi = di("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}", "const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"); function di(t, e) { var i = /#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g, o = {}; return { fragmentSource: t = t.replace(i, (function (t, e, i, r, a) { return o[a] = !0, "define" === e ? "\n#ifndef HAS_UNIFORM_u_" + a + "\nvarying " + i + " " + r + " " + a + ";\n#else\nuniform " + i + " " + r + " u_" + a + ";\n#endif\n" : "\n#ifdef HAS_UNIFORM_u_" + a + "\n " + i + " " + r + " " + a + " = u_" + a + ";\n#endif\n" })), vertexSource: e = e.replace(i, (function (t, e, i, r, a) { var n = "float" === r ? "vec2" : "vec4", s = a.match(/color/) ? "color" : n; return o[a] ? "define" === e ? "\n#ifndef HAS_UNIFORM_u_" + a + "\nuniform lowp float u_" + a + "_t;\nattribute " + i + " " + n + " a_" + a + ";\nvarying " + i + " " + r + " " + a + ";\n#else\nuniform " + i + " " + r + " u_" + a + ";\n#endif\n" : "vec4" === s ? "\n#ifndef HAS_UNIFORM_u_" + a + "\n " + a + " = a_" + a + ";\n#else\n " + i + " " + r + " " + a + " = u_" + a + ";\n#endif\n" : "\n#ifndef HAS_UNIFORM_u_" + a + "\n " + a + " = unpack_mix_" + s + "(a_" + a + ", u_" + a + "_t);\n#else\n " + i + " " + r + " " + a + " = u_" + a + ";\n#endif\n" : "define" === e ? "\n#ifndef HAS_UNIFORM_u_" + a + "\nuniform lowp float u_" + a + "_t;\nattribute " + i + " " + n + " a_" + a + ";\n#else\nuniform " + i + " " + r + " u_" + a + ";\n#endif\n" : "vec4" === s ? "\n#ifndef HAS_UNIFORM_u_" + a + "\n " + i + " " + r + " " + a + " = a_" + a + ";\n#else\n " + i + " " + r + " " + a + " = u_" + a + ";\n#endif\n" : "\n#ifndef HAS_UNIFORM_u_" + a + "\n " + i + " " + r + " " + a + " = unpack_mix_" + s + "(a_" + a + ", u_" + a + "_t);\n#else\n " + i + " " + r + " " + a + " = u_" + a + ";\n#endif\n" })) } } var _i = Object.freeze({ __proto__: null, prelude: Ze, background: qe, backgroundPattern: je, circle: Ve, clippingMask: Ge, heatmap: We, heatmapTexture: Xe, collisionBox: He, collisionCircle: Ke, debug: Ye, fill: Je, fillOutline: Qe, fillOutlinePattern: $e, fillPattern: ti, fillExtrusion: ei, fillExtrusionPattern: ii, hillshadePrepare: oi, hillshade: ri, line: ai, lineGradient: ni, linePattern: si, lineSDF: li, raster: ci, symbolIcon: ui, symbolSDF: hi, symbolTextAndIcon: pi }), fi = function () { this.boundProgram = null, this.boundLayoutVertexBuffer = null, this.boundPaintVertexBuffers = [], this.boundIndexBuffer = null, this.boundVertexOffset = null, this.boundDynamicVertexBuffer = null, this.vao = null; }; fi.prototype.bind = function (t, e, i, o, r, a, n, s) { this.context = t; for (var l = this.boundPaintVertexBuffers.length !== o.length, c = 0; !l && c < o.length; c++)this.boundPaintVertexBuffers[c] !== o[c] && (l = !0); var u = !this.vao || this.boundProgram !== e || this.boundLayoutVertexBuffer !== i || l || this.boundIndexBuffer !== r || this.boundVertexOffset !== a || this.boundDynamicVertexBuffer !== n || this.boundDynamicVertexBuffer2 !== s; !t.extVertexArrayObject || u ? this.freshBind(e, i, o, r, a, n, s) : (t.bindVertexArrayOES.set(this.vao), n && n.bind(), r && r.dynamicDraw && r.bind(), s && s.bind()); }, fi.prototype.freshBind = function (t, e, i, o, r, a, n) { var s, l = t.numAttributes, c = this.context, u = c.gl; if (c.extVertexArrayObject) this.vao && this.destroy(), this.vao = c.extVertexArrayObject.createVertexArrayOES(), c.bindVertexArrayOES.set(this.vao), s = 0, this.boundProgram = t, this.boundLayoutVertexBuffer = e, this.boundPaintVertexBuffers = i, this.boundIndexBuffer = o, this.boundVertexOffset = r, this.boundDynamicVertexBuffer = a, this.boundDynamicVertexBuffer2 = n; else { s = c.currentNumAttributes || 0; for (var h = l; h < s; h++)u.disableVertexAttribArray(h); } e.enableAttributes(u, t); for (var p = 0, d = i; p < d.length; p += 1) { d[p].enableAttributes(u, t); } a && a.enableAttributes(u, t), n && n.enableAttributes(u, t), e.bind(), e.setVertexAttribPointers(u, t, r); for (var _ = 0, f = i; _ < f.length; _ += 1) { var m = f[_]; m.bind(), m.setVertexAttribPointers(u, t, r); } a && (a.bind(), a.setVertexAttribPointers(u, t, r)), o && o.bind(), n && (n.bind(), n.setVertexAttribPointers(u, t, r)), c.currentNumAttributes = l; }, fi.prototype.destroy = function () { this.vao && (this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao), this.vao = null); }; var mi = function (t, e, i, o, r) { var a = t.gl; this.program = a.createProgram(); var n = i.defines(); r && n.push("#define OVERDRAW_INSPECTOR;"); var s = n.concat(Ze.fragmentSource, e.fragmentSource).join("\n"), l = n.concat(Ze.vertexSource, e.vertexSource).join("\n"), c = a.createShader(a.FRAGMENT_SHADER); if (a.isContextLost()) this.failedToCreate = !0; else { a.shaderSource(c, s), a.compileShader(c), a.attachShader(this.program, c); var u = a.createShader(a.VERTEX_SHADER); if (a.isContextLost()) this.failedToCreate = !0; else { a.shaderSource(u, l), a.compileShader(u), a.attachShader(this.program, u); for (var h = i.layoutAttributes || [], p = 0; p < h.length; p++)a.bindAttribLocation(this.program, p, h[p].name); a.linkProgram(this.program), this.numAttributes = a.getProgramParameter(this.program, a.ACTIVE_ATTRIBUTES), this.attributes = {}; for (var d = {}, _ = 0; _ < this.numAttributes; _++) { var f = a.getActiveAttrib(this.program, _); f && (this.attributes[f.name] = a.getAttribLocation(this.program, f.name)); } for (var m = a.getProgramParameter(this.program, a.ACTIVE_UNIFORMS), g = 0; g < m; g++) { var v = a.getActiveUniform(this.program, g); v && (d[v.name] = a.getUniformLocation(this.program, v.name)); } this.fixedUniforms = o(t, d), this.binderUniforms = i.getUniforms(t, d); } } }; function gi(e, i, o) { var r = 1 / ue(o, 1, i.transform.tileZoom), a = Math.pow(2, o.tileID.overscaledZ), n = o.tileSize * Math.pow(2, i.transform.tileZoom) / a, s = n * (o.tileID.canonical.x + o.tileID.wrap * a), l = n * o.tileID.canonical.y; return { u_image: 0, u_texsize: o.imageAtlasTexture.size, u_scale: [t.browser.devicePixelRatio, r, e.fromScale, e.toScale], u_fade: e.t, u_pixel_coord_upper: [s >> 16, l >> 16], u_pixel_coord_lower: [65535 & s, 65535 & l] } } mi.prototype.draw = function (t, e, i, o, r, a, n, s, l, c, u, h, p, d, _, f) { var m, g = t.gl; if (!this.failedToCreate) { for (var v in t.program.set(this.program), t.setDepthMode(i), t.setStencilMode(o), t.setColorMode(r), t.setCullFace(a), this.fixedUniforms) this.fixedUniforms[v].set(n[v]); d && d.setUniforms(t, this.binderUniforms, h, { zoom: p }); for (var y = (m = {}, m[g.LINES] = 2, m[g.TRIANGLES] = 3, m[g.LINE_STRIP] = 1, m)[e], x = 0, b = u.get(); x < b.length; x += 1) { var w = b[x], E = w.vaos || (w.vaos = {}); (E[s] || (E[s] = new fi)).bind(t, this, l, d ? d.getPaintVertexBuffers() : [], c, w.vertexOffset, _, f), g.drawElements(e, w.primitiveLength * y, g.UNSIGNED_SHORT, w.primitiveOffset * y * 2); } } }; var vi = function (e, i, o, r) { var a = i.style.light, n = a.properties.get("position"), s = [n.x, n.y, n.z], l = t.create$1(); "viewport" === a.properties.get("anchor") && t.fromRotation(l, -i.transform.angle), t.transformMat3(s, s, l); var c = a.properties.get("color"); return { u_matrix: e, u_lightpos: s, u_lightintensity: a.properties.get("intensity"), u_lightcolor: [c.r, c.g, c.b], u_vertical_gradient: +o, u_opacity: r } }, yi = function (e, i, o, r, a, n, s) { return t.extend(vi(e, i, o, r), gi(n, i, s), { u_height_factor: -Math.pow(2, a.overscaledZ) / s.tileSize / 8 }) }, xi = function (t) { return { u_matrix: t } }, bi = function (e, i, o, r) { return t.extend(xi(e), gi(o, i, r)) }, wi = function (t, e) { return { u_matrix: t, u_world: e } }, Ei = function (e, i, o, r, a) { return t.extend(bi(e, i, o, r), { u_world: a }) }, Ti = function (e, i, o, r) { var a, n, s = e.transform; if ("map" === r.paint.get("circle-pitch-alignment")) { var l = ue(o, 1, s.zoom); a = !0, n = [l, l]; } else a = !1, n = s.pixelsToGLUnits; return { u_camera_to_center_distance: s.cameraToCenterDistance, u_scale_with_map: +("map" === r.paint.get("circle-pitch-scale")), u_matrix: e.translatePosMatrix(i.posMatrix, o, r.paint.get("circle-translate"), r.paint.get("circle-translate-anchor")), u_pitch_with_map: +a, u_device_pixel_ratio: t.browser.devicePixelRatio, u_extrude_scale: n } }, Ii = function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_camera_to_center_distance: new t.Uniform1f(e, i.u_camera_to_center_distance), u_pixels_to_tile_units: new t.Uniform1f(e, i.u_pixels_to_tile_units), u_extrude_scale: new t.Uniform2f(e, i.u_extrude_scale), u_overscale_factor: new t.Uniform1f(e, i.u_overscale_factor) } }, Ci = function (t, e, i) { var o = ue(i, 1, e.zoom), r = Math.pow(2, e.zoom - i.tileID.overscaledZ), a = i.tileID.overscaleFactor(); return { u_matrix: t, u_camera_to_center_distance: e.cameraToCenterDistance, u_pixels_to_tile_units: o, u_extrude_scale: [e.pixelsToGLUnits[0] / (o * r), e.pixelsToGLUnits[1] / (o * r)], u_overscale_factor: a } }, Si = function (t, e) { return { u_matrix: t, u_color: e } }, Pi = function (t) { return { u_matrix: t } }, zi = function (t, e, i, o) { return { u_matrix: t, u_extrude_scale: ue(e, 1, i), u_intensity: o } }, Li = function (e, i, o, r) { var a = t.create(); t.ortho(a, 0, e.width, e.height, 0, 0, 1); var n = e.context.gl; return { u_matrix: a, u_world: [n.drawingBufferWidth, n.drawingBufferHeight], u_image: o, u_color_ramp: r, u_opacity: i.paint.get("heatmap-opacity") } }, Mi = function (t, e, i) { var o = i.paint.get("hillshade-shadow-color"), r = i.paint.get("hillshade-highlight-color"), a = i.paint.get("hillshade-accent-color"), n = i.paint.get("hillshade-illumination-direction") * (Math.PI / 180); "viewport" === i.paint.get("hillshade-illumination-anchor") && (n -= t.transform.angle); var s = !t.options.moving; return { u_matrix: t.transform.calculatePosMatrix(e.tileID.toUnwrapped(), s), u_image: 0, u_latrange: Ai(t, e.tileID), u_light: [i.paint.get("hillshade-exaggeration"), n], u_shadow: o, u_highlight: r, u_accent: a } }, Di = function (e, i, o) { var r = i.stride, a = t.create(); return t.ortho(a, 0, t.EXTENT, -t.EXTENT, 0, 0, 1), t.translate(a, a, [0, -t.EXTENT, 0]), { u_matrix: a, u_image: 1, u_dimension: [r, r], u_zoom: e.overscaledZ, u_maxzoom: o, u_unpack: i.getUnpackVector() } }; function Ai(e, i) { var o = Math.pow(2, i.canonical.z), r = i.canonical.y; return [new t.MercatorCoordinate(0, r / o).toLngLat().lat, new t.MercatorCoordinate(0, (r + 1) / o).toLngLat().lat] } var Ri = function (e, i, o) { var r = e.transform; return { u_matrix: Ui(e, i, o), u_ratio: 1 / ue(i, 1, r.zoom), u_device_pixel_ratio: t.browser.devicePixelRatio, u_units_to_pixels: [1 / r.pixelsToGLUnits[0], 1 / r.pixelsToGLUnits[1]] } }, ki = function (e, i, o) { return t.extend(Ri(e, i, o), { u_image: 0 }) }, Bi = function (e, i, o, r) { var a = e.transform, n = Fi(i, a); return { u_matrix: Ui(e, i, o), u_texsize: i.imageAtlasTexture.size, u_ratio: 1 / ue(i, 1, a.zoom), u_device_pixel_ratio: t.browser.devicePixelRatio, u_image: 0, u_scale: [t.browser.devicePixelRatio, n, r.fromScale, r.toScale], u_fade: r.t, u_units_to_pixels: [1 / a.pixelsToGLUnits[0], 1 / a.pixelsToGLUnits[1]] } }, Oi = function (e, i, o, r, a) { var n = e.transform, s = e.lineAtlas, l = Fi(i, n), c = "round" === o.layout.get("line-cap"), u = s.getDash(r.from, c), h = s.getDash(r.to, c), p = u.width * a.fromScale, d = h.width * a.toScale; return t.extend(Ri(e, i, o), { u_patternscale_a: [l / p, -u.height / 2], u_patternscale_b: [l / d, -h.height / 2], u_sdfgamma: s.width / (256 * Math.min(p, d) * t.browser.devicePixelRatio) / 2, u_image: 0, u_tex_y_a: u.y, u_tex_y_b: h.y, u_mix: a.t }) }; function Fi(t, e) { return 1 / ue(t, 1, e.tileZoom) } function Ui(t, e, i) { return t.translatePosMatrix(e.tileID.posMatrix, e, i.paint.get("line-translate"), i.paint.get("line-translate-anchor")) } var Ni = function (t, e, i, o, r) { return { u_matrix: t, u_tl_parent: e, u_scale_parent: i, u_buffer_scale: 1, u_fade_t: o.mix, u_opacity: o.opacity * r.paint.get("raster-opacity"), u_image0: 0, u_image1: 1, u_brightness_low: r.paint.get("raster-brightness-min"), u_brightness_high: r.paint.get("raster-brightness-max"), u_saturation_factor: (n = r.paint.get("raster-saturation"), n > 0 ? 1 - 1 / (1.001 - n) : -n), u_contrast_factor: (a = r.paint.get("raster-contrast"), a > 0 ? 1 / (1 - a) : 1 + a), u_spin_weights: Zi(r.paint.get("raster-hue-rotate")) }; var a, n; }; function Zi(t) { t *= Math.PI / 180; var e = Math.sin(t), i = Math.cos(t); return [(2 * i + 1) / 3, (-Math.sqrt(3) * e - i + 1) / 3, (Math.sqrt(3) * e - i + 1) / 3] } var qi = function (t, e, i, o, r, a, n, s, l, c) { var u = r.transform; return { u_is_size_zoom_constant: +("constant" === t || "source" === t), u_is_size_feature_constant: +("constant" === t || "camera" === t), u_size_t: e ? e.uSizeT : 0, u_size: e ? e.uSize : 0, u_camera_to_center_distance: u.cameraToCenterDistance, u_pitch: u.pitch / 360 * 2 * Math.PI, u_rotate_symbol: +i, u_aspect_ratio: u.width / u.height, u_fade_change: r.options.fadeDuration ? r.symbolFadeChange : 1, u_matrix: a, u_label_plane_matrix: n, u_coord_matrix: s, u_is_text: +l, u_pitch_with_map: +o, u_texsize: c, u_texture: 0 } }, ji = function (e, i, o, r, a, n, s, l, c, u, h) { var p = a.transform; return t.extend(qi(e, i, o, r, a, n, s, l, c, u), { u_gamma_scale: r ? Math.cos(p._pitch) * p.cameraToCenterDistance : 1, u_device_pixel_ratio: t.browser.devicePixelRatio, u_is_halo: +h }) }, Vi = function (e, i, o, r, a, n, s, l, c, u) { return t.extend(ji(e, i, o, r, a, n, s, l, !0, c, !0), { u_texsize_icon: u, u_texture_icon: 1 }) }, Gi = function (t, e, i) { return { u_matrix: t, u_opacity: e, u_color: i } }, Wi = function (e, i, o, r, a, n) { return t.extend(function (t, e, i, o) { var r = i.imageManager.getPattern(t.from.toString()), a = i.imageManager.getPattern(t.to.toString()), n = i.imageManager.getPixelSize(), s = n.width, l = n.height, c = Math.pow(2, o.tileID.overscaledZ), u = o.tileSize * Math.pow(2, i.transform.tileZoom) / c, h = u * (o.tileID.canonical.x + o.tileID.wrap * c), p = u * o.tileID.canonical.y; return { u_image: 0, u_pattern_tl_a: r.tl, u_pattern_br_a: r.br, u_pattern_tl_b: a.tl, u_pattern_br_b: a.br, u_texsize: [s, l], u_mix: e.t, u_pattern_size_a: r.displaySize, u_pattern_size_b: a.displaySize, u_scale_a: e.fromScale, u_scale_b: e.toScale, u_tile_units_to_pixels: 1 / ue(o, 1, i.transform.tileZoom), u_pixel_coord_upper: [h >> 16, p >> 16], u_pixel_coord_lower: [65535 & h, 65535 & p] } }(r, n, o, a), { u_matrix: e, u_opacity: i }) }, Xi = { fillExtrusion: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_lightpos: new t.Uniform3f(e, i.u_lightpos), u_lightintensity: new t.Uniform1f(e, i.u_lightintensity), u_lightcolor: new t.Uniform3f(e, i.u_lightcolor), u_vertical_gradient: new t.Uniform1f(e, i.u_vertical_gradient), u_opacity: new t.Uniform1f(e, i.u_opacity) } }, fillExtrusionPattern: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_lightpos: new t.Uniform3f(e, i.u_lightpos), u_lightintensity: new t.Uniform1f(e, i.u_lightintensity), u_lightcolor: new t.Uniform3f(e, i.u_lightcolor), u_vertical_gradient: new t.Uniform1f(e, i.u_vertical_gradient), u_height_factor: new t.Uniform1f(e, i.u_height_factor), u_image: new t.Uniform1i(e, i.u_image), u_texsize: new t.Uniform2f(e, i.u_texsize), u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), u_scale: new t.Uniform4f(e, i.u_scale), u_fade: new t.Uniform1f(e, i.u_fade), u_opacity: new t.Uniform1f(e, i.u_opacity) } }, fill: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix) } }, fillPattern: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_image: new t.Uniform1i(e, i.u_image), u_texsize: new t.Uniform2f(e, i.u_texsize), u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), u_scale: new t.Uniform4f(e, i.u_scale), u_fade: new t.Uniform1f(e, i.u_fade) } }, fillOutline: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_world: new t.Uniform2f(e, i.u_world) } }, fillOutlinePattern: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_world: new t.Uniform2f(e, i.u_world), u_image: new t.Uniform1i(e, i.u_image), u_texsize: new t.Uniform2f(e, i.u_texsize), u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), u_scale: new t.Uniform4f(e, i.u_scale), u_fade: new t.Uniform1f(e, i.u_fade) } }, circle: function (e, i) { return { u_camera_to_center_distance: new t.Uniform1f(e, i.u_camera_to_center_distance), u_scale_with_map: new t.Uniform1i(e, i.u_scale_with_map), u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), u_extrude_scale: new t.Uniform2f(e, i.u_extrude_scale), u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), u_matrix: new t.UniformMatrix4f(e, i.u_matrix) } }, collisionBox: Ii, collisionCircle: Ii, debug: function (e, i) { return { u_color: new t.UniformColor(e, i.u_color), u_matrix: new t.UniformMatrix4f(e, i.u_matrix) } }, clippingMask: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix) } }, heatmap: function (e, i) { return { u_extrude_scale: new t.Uniform1f(e, i.u_extrude_scale), u_intensity: new t.Uniform1f(e, i.u_intensity), u_matrix: new t.UniformMatrix4f(e, i.u_matrix) } }, heatmapTexture: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_world: new t.Uniform2f(e, i.u_world), u_image: new t.Uniform1i(e, i.u_image), u_color_ramp: new t.Uniform1i(e, i.u_color_ramp), u_opacity: new t.Uniform1f(e, i.u_opacity) } }, hillshade: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_image: new t.Uniform1i(e, i.u_image), u_latrange: new t.Uniform2f(e, i.u_latrange), u_light: new t.Uniform2f(e, i.u_light), u_shadow: new t.UniformColor(e, i.u_shadow), u_highlight: new t.UniformColor(e, i.u_highlight), u_accent: new t.UniformColor(e, i.u_accent) } }, hillshadePrepare: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_image: new t.Uniform1i(e, i.u_image), u_dimension: new t.Uniform2f(e, i.u_dimension), u_zoom: new t.Uniform1f(e, i.u_zoom), u_maxzoom: new t.Uniform1f(e, i.u_maxzoom), u_unpack: new t.Uniform4f(e, i.u_unpack) } }, line: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_ratio: new t.Uniform1f(e, i.u_ratio), u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels) } }, lineGradient: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_ratio: new t.Uniform1f(e, i.u_ratio), u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), u_image: new t.Uniform1i(e, i.u_image) } }, linePattern: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_texsize: new t.Uniform2f(e, i.u_texsize), u_ratio: new t.Uniform1f(e, i.u_ratio), u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), u_image: new t.Uniform1i(e, i.u_image), u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), u_scale: new t.Uniform4f(e, i.u_scale), u_fade: new t.Uniform1f(e, i.u_fade) } }, lineSDF: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_ratio: new t.Uniform1f(e, i.u_ratio), u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), u_units_to_pixels: new t.Uniform2f(e, i.u_units_to_pixels), u_patternscale_a: new t.Uniform2f(e, i.u_patternscale_a), u_patternscale_b: new t.Uniform2f(e, i.u_patternscale_b), u_sdfgamma: new t.Uniform1f(e, i.u_sdfgamma), u_image: new t.Uniform1i(e, i.u_image), u_tex_y_a: new t.Uniform1f(e, i.u_tex_y_a), u_tex_y_b: new t.Uniform1f(e, i.u_tex_y_b), u_mix: new t.Uniform1f(e, i.u_mix) } }, raster: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_tl_parent: new t.Uniform2f(e, i.u_tl_parent), u_scale_parent: new t.Uniform1f(e, i.u_scale_parent), u_buffer_scale: new t.Uniform1f(e, i.u_buffer_scale), u_fade_t: new t.Uniform1f(e, i.u_fade_t), u_opacity: new t.Uniform1f(e, i.u_opacity), u_image0: new t.Uniform1i(e, i.u_image0), u_image1: new t.Uniform1i(e, i.u_image1), u_brightness_low: new t.Uniform1f(e, i.u_brightness_low), u_brightness_high: new t.Uniform1f(e, i.u_brightness_high), u_saturation_factor: new t.Uniform1f(e, i.u_saturation_factor), u_contrast_factor: new t.Uniform1f(e, i.u_contrast_factor), u_spin_weights: new t.Uniform3f(e, i.u_spin_weights) } }, symbolIcon: function (e, i) { return { u_is_size_zoom_constant: new t.Uniform1i(e, i.u_is_size_zoom_constant), u_is_size_feature_constant: new t.Uniform1i(e, i.u_is_size_feature_constant), u_size_t: new t.Uniform1f(e, i.u_size_t), u_size: new t.Uniform1f(e, i.u_size), u_camera_to_center_distance: new t.Uniform1f(e, i.u_camera_to_center_distance), u_pitch: new t.Uniform1f(e, i.u_pitch), u_rotate_symbol: new t.Uniform1i(e, i.u_rotate_symbol), u_aspect_ratio: new t.Uniform1f(e, i.u_aspect_ratio), u_fade_change: new t.Uniform1f(e, i.u_fade_change), u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_label_plane_matrix: new t.UniformMatrix4f(e, i.u_label_plane_matrix), u_coord_matrix: new t.UniformMatrix4f(e, i.u_coord_matrix), u_is_text: new t.Uniform1f(e, i.u_is_text), u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), u_texsize: new t.Uniform2f(e, i.u_texsize), u_texture: new t.Uniform1i(e, i.u_texture) } }, symbolSDF: function (e, i) { return { u_is_size_zoom_constant: new t.Uniform1i(e, i.u_is_size_zoom_constant), u_is_size_feature_constant: new t.Uniform1i(e, i.u_is_size_feature_constant), u_size_t: new t.Uniform1f(e, i.u_size_t), u_size: new t.Uniform1f(e, i.u_size), u_camera_to_center_distance: new t.Uniform1f(e, i.u_camera_to_center_distance), u_pitch: new t.Uniform1f(e, i.u_pitch), u_rotate_symbol: new t.Uniform1i(e, i.u_rotate_symbol), u_aspect_ratio: new t.Uniform1f(e, i.u_aspect_ratio), u_fade_change: new t.Uniform1f(e, i.u_fade_change), u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_label_plane_matrix: new t.UniformMatrix4f(e, i.u_label_plane_matrix), u_coord_matrix: new t.UniformMatrix4f(e, i.u_coord_matrix), u_is_text: new t.Uniform1f(e, i.u_is_text), u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), u_texsize: new t.Uniform2f(e, i.u_texsize), u_texture: new t.Uniform1i(e, i.u_texture), u_gamma_scale: new t.Uniform1f(e, i.u_gamma_scale), u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), u_is_halo: new t.Uniform1f(e, i.u_is_halo) } }, symbolTextAndIcon: function (e, i) { return { u_is_size_zoom_constant: new t.Uniform1i(e, i.u_is_size_zoom_constant), u_is_size_feature_constant: new t.Uniform1i(e, i.u_is_size_feature_constant), u_size_t: new t.Uniform1f(e, i.u_size_t), u_size: new t.Uniform1f(e, i.u_size), u_camera_to_center_distance: new t.Uniform1f(e, i.u_camera_to_center_distance), u_pitch: new t.Uniform1f(e, i.u_pitch), u_rotate_symbol: new t.Uniform1i(e, i.u_rotate_symbol), u_aspect_ratio: new t.Uniform1f(e, i.u_aspect_ratio), u_fade_change: new t.Uniform1f(e, i.u_fade_change), u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_label_plane_matrix: new t.UniformMatrix4f(e, i.u_label_plane_matrix), u_coord_matrix: new t.UniformMatrix4f(e, i.u_coord_matrix), u_is_text: new t.Uniform1f(e, i.u_is_text), u_pitch_with_map: new t.Uniform1i(e, i.u_pitch_with_map), u_texsize: new t.Uniform2f(e, i.u_texsize), u_texsize_icon: new t.Uniform2f(e, i.u_texsize_icon), u_texture: new t.Uniform1i(e, i.u_texture), u_texture_icon: new t.Uniform1i(e, i.u_texture_icon), u_gamma_scale: new t.Uniform1f(e, i.u_gamma_scale), u_device_pixel_ratio: new t.Uniform1f(e, i.u_device_pixel_ratio), u_is_halo: new t.Uniform1f(e, i.u_is_halo) } }, background: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_opacity: new t.Uniform1f(e, i.u_opacity), u_color: new t.UniformColor(e, i.u_color) } }, backgroundPattern: function (e, i) { return { u_matrix: new t.UniformMatrix4f(e, i.u_matrix), u_opacity: new t.Uniform1f(e, i.u_opacity), u_image: new t.Uniform1i(e, i.u_image), u_pattern_tl_a: new t.Uniform2f(e, i.u_pattern_tl_a), u_pattern_br_a: new t.Uniform2f(e, i.u_pattern_br_a), u_pattern_tl_b: new t.Uniform2f(e, i.u_pattern_tl_b), u_pattern_br_b: new t.Uniform2f(e, i.u_pattern_br_b), u_texsize: new t.Uniform2f(e, i.u_texsize), u_mix: new t.Uniform1f(e, i.u_mix), u_pattern_size_a: new t.Uniform2f(e, i.u_pattern_size_a), u_pattern_size_b: new t.Uniform2f(e, i.u_pattern_size_b), u_scale_a: new t.Uniform1f(e, i.u_scale_a), u_scale_b: new t.Uniform1f(e, i.u_scale_b), u_pixel_coord_upper: new t.Uniform2f(e, i.u_pixel_coord_upper), u_pixel_coord_lower: new t.Uniform2f(e, i.u_pixel_coord_lower), u_tile_units_to_pixels: new t.Uniform1f(e, i.u_tile_units_to_pixels) } } }; function Hi(e, i) { for (var o = e.sort((function (t, e) { return t.tileID.isLessThan(e.tileID) ? -1 : e.tileID.isLessThan(t.tileID) ? 1 : 0 })), r = 0; r < o.length; r++) { var a = {}, n = o[r], s = o.slice(r + 1); Ki(n.tileID.wrapped(), n.tileID, s, new t.OverscaledTileID(0, n.tileID.wrap + 1, 0, 0, 0), a), n.setMask(a, i); } } function Ki(e, i, o, r, a) { for (var n = 0; n < o.length; n++) { var s = o[n]; if (r.isLessThan(s.tileID)) break; if (i.key === s.tileID.key) return; if (s.tileID.isChildOf(i)) { for (var l = i.children(1 / 0), c = 0; c < l.length; c++) { Ki(e, l[c], o.slice(n), r, a); } return } } var u = i.overscaledZ - e.overscaledZ, h = new t.CanonicalTileID(u, i.canonical.x - (e.canonical.x << u), i.canonical.y - (e.canonical.y << u)); a[h.key] = a[h.key] || h; } function Yi(t, e, i, o, r, a, n, s) { for (var l = t.context, c = l.gl, u = r ? t.useProgram("collisionCircle") : t.useProgram("collisionBox"), h = 0; h < o.length; h++) { var p = o[h], d = e.getTile(p), _ = d.getBucket(i); if (_) { var f = r ? s ? _.textCollisionCircle : _.iconCollisionCircle : s ? _.textCollisionBox : _.iconCollisionBox; if (f) { var m = p.posMatrix; 0 === a[0] && 0 === a[1] || (m = t.translatePosMatrix(p.posMatrix, d, a, n)), u.draw(l, r ? c.TRIANGLES : c.LINES, It.disabled, Ct.disabled, t.colorModeForRenderPass(), Pt.disabled, Ci(m, t.transform, d), i.id, f.layoutVertexBuffer, f.indexBuffer, f.segments, null, t.transform.zoom, null, null, f.collisionVertexBuffer); } } } } function Ji(t, e, i, o, r, a, n) { Yi(t, e, i, o, !1, r, a, n), Yi(t, e, i, o, !0, r, a, n); } var Qi = t.identity(new Float32Array(16)); function $i(e, i, o, r, a, n) { var s = t.getAnchorAlignment(e), l = -(s.horizontalAlign - .5) * i, c = -(s.verticalAlign - .5) * o, u = t.evaluateVariableOffset(e, r); return new t.Point((l / a + u[0]) * n, (c / a + u[1]) * n) } function to(e, i, o, r, a, n, s, l, c, u, h) { var p = e.text.placedSymbolArray, d = e.text.dynamicLayoutVertexArray, _ = e.icon.dynamicLayoutVertexArray, f = {}; d.clear(); for (var m = 0; m < p.length; m++) { var g = p.get(m), v = e.allowVerticalPlacement && !g.placedOrientation, y = g.hidden || !g.crossTileID || v ? null : r[g.crossTileID]; if (y) { var x = new t.Point(g.anchorX, g.anchorY), b = Jt(x, o ? l : s), w = .5 + n.cameraToCenterDistance / b.signedDistanceFromCamera * .5, E = a.evaluateSizeForFeature(e.textSizeData, u, g) * w / t.ONE_EM; o && (E *= e.tilePixelRatio / c); for (var T = y.width, I = y.height, C = $i(y.anchor, T, I, y.textOffset, y.textBoxScale, E), S = o ? Jt(x.add(C), s).point : b.point.add(i ? C.rotate(-n.angle) : C), P = e.allowVerticalPlacement && g.placedOrientation === t.WritingMode.vertical ? Math.PI / 2 : 0, z = 0; z < g.numGlyphs; z++)t.addDynamicAttributes(d, S, P); h && g.associatedIconIndex >= 0 && (f[g.associatedIconIndex] = { shiftedAnchor: S, angle: P }); } else ne(g.numGlyphs, d); } if (h) { _.clear(); for (var L = e.icon.placedSymbolArray, M = 0; M < L.length; M++) { var D = L.get(M); if (D.hidden) ne(D.numGlyphs, _); else { var A = f[M]; if (A) for (var R = 0; R < D.numGlyphs; R++)t.addDynamicAttributes(_, A.shiftedAnchor, A.angle); else ne(D.numGlyphs, _); } } e.icon.dynamicLayoutVertexBuffer.updateData(_); } e.text.dynamicLayoutVertexBuffer.updateData(d); } function eo(t, e, i) { return i.iconsInText && e ? "symbolTextAndIcon" : t ? "symbolSDF" : "symbolIcon" } function io(e, i, o, r, a, n, s, l, c, u, h, p) { for (var d, _, f = e.context, m = f.gl, g = e.transform, v = "map" === l, y = "map" === c, x = v && "point" !== o.layout.get("symbol-placement"), b = v && !y && !x, w = void 0 !== o.layout.get("symbol-sort-key").constantOr(1), E = e.depthModeForSublayer(0, It.ReadOnly), T = o.layout.get("text-variable-anchor"), I = [], C = 0, S = r; C < S.length; C += 1) { var P = S[C], z = i.getTile(P), L = z.getBucket(o); if (L) { var M = a ? L.text : L.icon; if (M && M.segments.get().length) { var D = M.programConfigurations.get(o.id), A = a || L.sdfIcons, R = a ? L.textSizeData : L.iconSizeData, k = y || 0 !== g.pitch; d || (d = e.useProgram(eo(A, a, L), D), _ = t.evaluateSizeForZoom(R, g.zoom)); var B = void 0, O = [0, 0], F = void 0, U = void 0, N = null, Z = void 0; if (a) { if (F = z.glyphAtlasTexture, U = m.LINEAR, B = z.glyphAtlasTexture.size, L.iconsInText) { O = z.imageAtlasTexture.size, N = z.imageAtlasTexture; var q = "composite" === R.kind || "camera" === R.kind; Z = k || e.options.rotating || e.options.zooming || q ? m.LINEAR : m.NEAREST; } } else { var j = 1 !== o.layout.get("icon-size").constantOr(0) || L.iconsNeedLinear; F = z.imageAtlasTexture, U = A || e.options.rotating || e.options.zooming || j || k ? m.LINEAR : m.NEAREST, B = z.imageAtlasTexture.size; } var V = ue(z, 1, e.transform.zoom), G = Kt(P.posMatrix, y, v, e.transform, V), W = Yt(P.posMatrix, y, v, e.transform, V), X = T && L.hasTextData(), H = "none" !== o.layout.get("icon-text-fit") && X && L.hasIconData(); x && $t(L, P.posMatrix, e, a, G, W, y, u); var K = e.translatePosMatrix(P.posMatrix, z, n, s), Y = x || a && T || H ? Qi : G, J = e.translatePosMatrix(W, z, n, s, !0), Q = A && 0 !== o.paint.get(a ? "text-halo-width" : "icon-halo-width").constantOr(1), $ = { program: d, buffers: M, uniformValues: A ? L.iconsInText ? Vi(R.kind, _, b, y, e, K, Y, J, B, O) : ji(R.kind, _, b, y, e, K, Y, J, a, B, !0) : qi(R.kind, _, b, y, e, K, Y, J, a, B), atlasTexture: F, atlasTextureIcon: N, atlasInterpolation: U, atlasInterpolationIcon: Z, isSDF: A, hasHalo: Q }; if (w) for (var tt = 0, et = M.segments.get(); tt < et.length; tt += 1) { var it = et[tt]; I.push({ segments: new t.SegmentVector([it]), sortKey: it.sortKey, state: $ }); } else I.push({ segments: M.segments, sortKey: 0, state: $ }); } } } w && I.sort((function (t, e) { return t.sortKey - e.sortKey })); for (var ot = 0, rt = I; ot < rt.length; ot += 1) { var at = rt[ot], nt = at.state; if (f.activeTexture.set(m.TEXTURE0), nt.atlasTexture.bind(nt.atlasInterpolation, m.CLAMP_TO_EDGE), nt.atlasTextureIcon && (f.activeTexture.set(m.TEXTURE1), nt.atlasTextureIcon && nt.atlasTextureIcon.bind(nt.atlasInterpolationIcon, m.CLAMP_TO_EDGE)), nt.isSDF) { var st = nt.uniformValues; nt.hasHalo && (st.u_is_halo = 1, oo(nt.buffers, at.segments, o, e, nt.program, E, h, p, st)), st.u_is_halo = 0; } oo(nt.buffers, at.segments, o, e, nt.program, E, h, p, nt.uniformValues); } } function oo(t, e, i, o, r, a, n, s, l) { var c = o.context, u = c.gl; r.draw(c, u.TRIANGLES, a, n, s, Pt.disabled, l, i.id, t.layoutVertexBuffer, t.indexBuffer, e, i.paint, o.transform.zoom, t.programConfigurations.get(i.id), t.dynamicLayoutVertexBuffer, t.opacityVertexBuffer); } function ro(t, e, i, o, r, a, n) { var s, l, c, u, h, p = t.context.gl, d = i.paint.get("fill-pattern"), _ = d && d.constantOr(1), f = i.getCrossfadeParameters(); n ? (l = _ && !i.getPaintProperty("fill-outline-color") ? "fillOutlinePattern" : "fillOutline", s = p.LINES) : (l = _ ? "fillPattern" : "fill", s = p.TRIANGLES); for (var m = 0, g = o; m < g.length; m += 1) { var v = g[m], y = e.getTile(v); if (!_ || y.patternsLoaded()) { var x = y.getBucket(i); if (x) { var b = x.programConfigurations.get(i.id), w = t.useProgram(l, b); _ && (t.context.activeTexture.set(p.TEXTURE0), y.imageAtlasTexture.bind(p.LINEAR, p.CLAMP_TO_EDGE), b.updatePatternPaintBuffers(f)); var E = d.constantOr(null); if (E && y.imageAtlas) { var T = y.imageAtlas, I = T.patternPositions[E.to.toString()], C = T.patternPositions[E.from.toString()]; I && C && b.setConstantPatternPositions(I, C); } var S = t.translatePosMatrix(v.posMatrix, y, i.paint.get("fill-translate"), i.paint.get("fill-translate-anchor")); if (n) { u = x.indexBuffer2, h = x.segments2; var P = [p.drawingBufferWidth, p.drawingBufferHeight]; c = "fillOutlinePattern" === l && _ ? Ei(S, t, f, y, P) : wi(S, P); } else u = x.indexBuffer, h = x.segments, c = _ ? bi(S, t, f, y) : xi(S); w.draw(t.context, s, r, t.stencilModeForClipping(v), a, Pt.disabled, c, i.id, x.layoutVertexBuffer, u, h, i.paint, t.transform.zoom, b); } } } } function ao(t, e, i, o, r, a, n) { for (var s = t.context, l = s.gl, c = i.paint.get("fill-extrusion-pattern"), u = c.constantOr(1), h = i.getCrossfadeParameters(), p = i.paint.get("fill-extrusion-opacity"), d = 0, _ = o; d < _.length; d += 1) { var f = _[d], m = e.getTile(f), g = m.getBucket(i); if (g) { var v = g.programConfigurations.get(i.id), y = t.useProgram(u ? "fillExtrusionPattern" : "fillExtrusion", v); u && (t.context.activeTexture.set(l.TEXTURE0), m.imageAtlasTexture.bind(l.LINEAR, l.CLAMP_TO_EDGE), v.updatePatternPaintBuffers(h)); var x = c.constantOr(null); if (x && m.imageAtlas) { var b = m.imageAtlas, w = b.patternPositions[x.to.toString()], E = b.patternPositions[x.from.toString()]; w && E && v.setConstantPatternPositions(w, E); } var T = t.translatePosMatrix(f.posMatrix, m, i.paint.get("fill-extrusion-translate"), i.paint.get("fill-extrusion-translate-anchor")), I = i.paint.get("fill-extrusion-vertical-gradient"), C = u ? yi(T, t, I, p, f, h, m) : vi(T, t, I, p); y.draw(s, s.gl.TRIANGLES, r, a, n, Pt.backCCW, C, i.id, g.layoutVertexBuffer, g.indexBuffer, g.segments, i.paint, t.transform.zoom, v); } } } function no(t, e, i, o, r, a) { var n = t.context, s = n.gl, l = e.fbo; if (l) { var c = t.useProgram("hillshade"); n.activeTexture.set(s.TEXTURE0), s.bindTexture(s.TEXTURE_2D, l.colorAttachment.get()); var u = Mi(t, e, i); e.maskedBoundsBuffer && e.maskedIndexBuffer && e.segments ? c.draw(n, s.TRIANGLES, o, r, a, Pt.disabled, u, i.id, e.maskedBoundsBuffer, e.maskedIndexBuffer, e.segments) : c.draw(n, s.TRIANGLES, o, r, a, Pt.disabled, u, i.id, t.rasterBoundsBuffer, t.quadTriangleIndexBuffer, t.rasterBoundsSegments); } } function so(e, i, o, r, a, n, s) { var l = e.context, c = l.gl, u = i.dem; if (u && u.data) { var h = u.dim, p = u.stride, d = u.getPixels(); if (l.activeTexture.set(c.TEXTURE1), l.pixelStoreUnpackPremultiplyAlpha.set(!1), i.demTexture = i.demTexture || e.getTileTexture(p), i.demTexture) { var _ = i.demTexture; _.update(d, { premultiply: !1 }), _.bind(c.NEAREST, c.CLAMP_TO_EDGE); } else i.demTexture = new t.Texture(l, d, c.RGBA, { premultiply: !1 }), i.demTexture.bind(c.NEAREST, c.CLAMP_TO_EDGE); l.activeTexture.set(c.TEXTURE0); var f = i.fbo; if (!f) { var m = new t.Texture(l, { width: h, height: h, data: null }, c.RGBA); m.bind(c.LINEAR, c.CLAMP_TO_EDGE), (f = i.fbo = l.createFramebuffer(h, h)).colorAttachment.set(m.texture); } l.bindFramebuffer.set(f.framebuffer), l.viewport.set([0, 0, h, h]), e.useProgram("hillshadePrepare").draw(l, c.TRIANGLES, a, n, s, Pt.disabled, Di(i.tileID, u, r), o.id, e.rasterBoundsBuffer, e.quadTriangleIndexBuffer, e.rasterBoundsSegments), i.needsHillshadePrepare = !1; } } function lo(e, i, o, r, a) { var n = r.paint.get("raster-fade-duration"); if (n > 0) { var s = t.browser.now(), l = (s - e.timeAdded) / n, c = i ? (s - i.timeAdded) / n : -1, u = o.getSource(), h = a.coveringZoomLevel({ tileSize: u.tileSize, roundZoom: u.roundZoom }), p = !i || Math.abs(i.tileID.overscaledZ - h) > Math.abs(e.tileID.overscaledZ - h), d = p && e.refreshedUponExpiration ? 1 : t.clamp(p ? l : 1 - c, 0, 1); return e.refreshedUponExpiration && l >= 1 && (e.refreshedUponExpiration = !1), i ? { opacity: 1, mix: 1 - d } : { opacity: d, mix: 0 } } return { opacity: 1, mix: 0 } } function co(e, i, o) { var r = e.context, a = r.gl, n = o.posMatrix, s = e.useProgram("debug"), l = It.disabled, c = Ct.disabled, u = e.colorModeForRenderPass(), h = "$debug"; s.draw(r, a.LINE_STRIP, l, c, u, Pt.disabled, Si(n, t.Color.red), h, e.debugBuffer, e.tileBorderIndexBuffer, e.debugSegments); var p = i.getTileByID(o.key).latestRawTileData, d = p && p.byteLength || 0, _ = Math.floor(d / 1024), f = i.getTile(o).tileSize, m = 512 / Math.min(f, 512), g = o.canonical.toString(); o.overscaledZ !== o.canonical.z && (g += " => " + o.overscaledZ); for (var v = function (t, e, i, o) { o = o || 1; var r, a, n, s, l, c, u, h, p = []; for (r = 0, a = t.length; r < a; r++)if (l = uo[t[r]]) { for (h = null, n = 0, s = l[1].length; n < s; n += 2)-1 === l[1][n] && -1 === l[1][n + 1] ? h = null : (c = e + l[1][n] * o, u = i - l[1][n + 1] * o, h && p.push(h.x, h.y, c, u), h = { x: c, y: u }); e += l[0] * o; } return p }(g + " " + _ + "kb", 50, 200 * m, 5 * m), y = new t.StructArrayLayout2i4, x = new t.StructArrayLayout2ui4, b = 0; b < v.length; b += 2)y.emplaceBack(v[b], v[b + 1]), x.emplaceBack(b, b + 1); for (var w = r.createVertexBuffer(y, Ne.members), E = r.createIndexBuffer(x), T = t.SegmentVector.simpleSegment(0, 0, y.length / 2, y.length / 2), I = t.EXTENT / (Math.pow(2, e.transform.zoom - o.overscaledZ) * f * m), C = [], S = -1; S <= 1; S++)for (var P = -1; P <= 1 && (0 !== S || 0 !== P); P++)C.push([S, P]); for (var z = 0; z < C.length; z++) { var L = C[z]; s.draw(r, a.LINES, l, c, u, Pt.disabled, Si(t.translate([], n, [I * L[0], I * L[1], 0]), t.Color.white), h, w, E, T); } s.draw(r, a.LINES, l, c, u, Pt.disabled, Si(n, t.Color.black), h, w, E, T), w.destroy(), E.destroy(), T.destroy(); } var uo = { " ": [16, []], "!": [10, [5, 21, 5, 7, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], '"': [16, [4, 21, 4, 14, -1, -1, 12, 21, 12, 14]], "#": [21, [11, 25, 4, -7, -1, -1, 17, 25, 10, -7, -1, -1, 4, 12, 18, 12, -1, -1, 3, 6, 17, 6]], $: [20, [8, 25, 8, -4, -1, -1, 12, 25, 12, -4, -1, -1, 17, 18, 15, 20, 12, 21, 8, 21, 5, 20, 3, 18, 3, 16, 4, 14, 5, 13, 7, 12, 13, 10, 15, 9, 16, 8, 17, 6, 17, 3, 15, 1, 12, 0, 8, 0, 5, 1, 3, 3]], "%": [24, [21, 21, 3, 0, -1, -1, 8, 21, 10, 19, 10, 17, 9, 15, 7, 14, 5, 14, 3, 16, 3, 18, 4, 20, 6, 21, 8, 21, 10, 20, 13, 19, 16, 19, 19, 20, 21, 21, -1, -1, 17, 7, 15, 6, 14, 4, 14, 2, 16, 0, 18, 0, 20, 1, 21, 3, 21, 5, 19, 7, 17, 7]], "&": [26, [23, 12, 23, 13, 22, 14, 21, 14, 20, 13, 19, 11, 17, 6, 15, 3, 13, 1, 11, 0, 7, 0, 5, 1, 4, 2, 3, 4, 3, 6, 4, 8, 5, 9, 12, 13, 13, 14, 14, 16, 14, 18, 13, 20, 11, 21, 9, 20, 8, 18, 8, 16, 9, 13, 11, 10, 16, 3, 18, 1, 20, 0, 22, 0, 23, 1, 23, 2]], "'": [10, [5, 19, 4, 20, 5, 21, 6, 20, 6, 18, 5, 16, 4, 15]], "(": [14, [11, 25, 9, 23, 7, 20, 5, 16, 4, 11, 4, 7, 5, 2, 7, -2, 9, -5, 11, -7]], ")": [14, [3, 25, 5, 23, 7, 20, 9, 16, 10, 11, 10, 7, 9, 2, 7, -2, 5, -5, 3, -7]], "*": [16, [8, 21, 8, 9, -1, -1, 3, 18, 13, 12, -1, -1, 13, 18, 3, 12]], "+": [26, [13, 18, 13, 0, -1, -1, 4, 9, 22, 9]], ",": [10, [6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5, -3, 4, -4]], "-": [26, [4, 9, 22, 9]], ".": [10, [5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], "/": [22, [20, 25, 2, -7]], 0: [20, [9, 21, 6, 20, 4, 17, 3, 12, 3, 9, 4, 4, 6, 1, 9, 0, 11, 0, 14, 1, 16, 4, 17, 9, 17, 12, 16, 17, 14, 20, 11, 21, 9, 21]], 1: [20, [6, 17, 8, 18, 11, 21, 11, 0]], 2: [20, [4, 16, 4, 17, 5, 19, 6, 20, 8, 21, 12, 21, 14, 20, 15, 19, 16, 17, 16, 15, 15, 13, 13, 10, 3, 0, 17, 0]], 3: [20, [5, 21, 16, 21, 10, 13, 13, 13, 15, 12, 16, 11, 17, 8, 17, 6, 16, 3, 14, 1, 11, 0, 8, 0, 5, 1, 4, 2, 3, 4]], 4: [20, [13, 21, 3, 7, 18, 7, -1, -1, 13, 21, 13, 0]], 5: [20, [15, 21, 5, 21, 4, 12, 5, 13, 8, 14, 11, 14, 14, 13, 16, 11, 17, 8, 17, 6, 16, 3, 14, 1, 11, 0, 8, 0, 5, 1, 4, 2, 3, 4]], 6: [20, [16, 18, 15, 20, 12, 21, 10, 21, 7, 20, 5, 17, 4, 12, 4, 7, 5, 3, 7, 1, 10, 0, 11, 0, 14, 1, 16, 3, 17, 6, 17, 7, 16, 10, 14, 12, 11, 13, 10, 13, 7, 12, 5, 10, 4, 7]], 7: [20, [17, 21, 7, 0, -1, -1, 3, 21, 17, 21]], 8: [20, [8, 21, 5, 20, 4, 18, 4, 16, 5, 14, 7, 13, 11, 12, 14, 11, 16, 9, 17, 7, 17, 4, 16, 2, 15, 1, 12, 0, 8, 0, 5, 1, 4, 2, 3, 4, 3, 7, 4, 9, 6, 11, 9, 12, 13, 13, 15, 14, 16, 16, 16, 18, 15, 20, 12, 21, 8, 21]], 9: [20, [16, 14, 15, 11, 13, 9, 10, 8, 9, 8, 6, 9, 4, 11, 3, 14, 3, 15, 4, 18, 6, 20, 9, 21, 10, 21, 13, 20, 15, 18, 16, 14, 16, 9, 15, 4, 13, 1, 10, 0, 8, 0, 5, 1, 4, 3]], ":": [10, [5, 14, 4, 13, 5, 12, 6, 13, 5, 14, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2]], ";": [10, [5, 14, 4, 13, 5, 12, 6, 13, 5, 14, -1, -1, 6, 1, 5, 0, 4, 1, 5, 2, 6, 1, 6, -1, 5, -3, 4, -4]], "<": [24, [20, 18, 4, 9, 20, 0]], "=": [26, [4, 12, 22, 12, -1, -1, 4, 6, 22, 6]], ">": [24, [4, 18, 20, 9, 4, 0]], "?": [18, [3, 16, 3, 17, 4, 19, 5, 20, 7, 21, 11, 21, 13, 20, 14, 19, 15, 17, 15, 15, 14, 13, 13, 12, 9, 10, 9, 7, -1, -1, 9, 2, 8, 1, 9, 0, 10, 1, 9, 2]], "@": [27, [18, 13, 17, 15, 15, 16, 12, 16, 10, 15, 9, 14, 8, 11, 8, 8, 9, 6, 11, 5, 14, 5, 16, 6, 17, 8, -1, -1, 12, 16, 10, 14, 9, 11, 9, 8, 10, 6, 11, 5, -1, -1, 18, 16, 17, 8, 17, 6, 19, 5, 21, 5, 23, 7, 24, 10, 24, 12, 23, 15, 22, 17, 20, 19, 18, 20, 15, 21, 12, 21, 9, 20, 7, 19, 5, 17, 4, 15, 3, 12, 3, 9, 4, 6, 5, 4, 7, 2, 9, 1, 12, 0, 15, 0, 18, 1, 20, 2, 21, 3, -1, -1, 19, 16, 18, 8, 18, 6, 19, 5]], A: [18, [9, 21, 1, 0, -1, -1, 9, 21, 17, 0, -1, -1, 4, 7, 14, 7]], B: [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 15, 17, 13, 16, 12, 13, 11, -1, -1, 4, 11, 13, 11, 16, 10, 17, 9, 18, 7, 18, 4, 17, 2, 16, 1, 13, 0, 4, 0]], C: [21, [18, 16, 17, 18, 15, 20, 13, 21, 9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5]], D: [21, [4, 21, 4, 0, -1, -1, 4, 21, 11, 21, 14, 20, 16, 18, 17, 16, 18, 13, 18, 8, 17, 5, 16, 3, 14, 1, 11, 0, 4, 0]], E: [19, [4, 21, 4, 0, -1, -1, 4, 21, 17, 21, -1, -1, 4, 11, 12, 11, -1, -1, 4, 0, 17, 0]], F: [18, [4, 21, 4, 0, -1, -1, 4, 21, 17, 21, -1, -1, 4, 11, 12, 11]], G: [21, [18, 16, 17, 18, 15, 20, 13, 21, 9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 18, 8, -1, -1, 13, 8, 18, 8]], H: [22, [4, 21, 4, 0, -1, -1, 18, 21, 18, 0, -1, -1, 4, 11, 18, 11]], I: [8, [4, 21, 4, 0]], J: [16, [12, 21, 12, 5, 11, 2, 10, 1, 8, 0, 6, 0, 4, 1, 3, 2, 2, 5, 2, 7]], K: [21, [4, 21, 4, 0, -1, -1, 18, 21, 4, 7, -1, -1, 9, 12, 18, 0]], L: [17, [4, 21, 4, 0, -1, -1, 4, 0, 16, 0]], M: [24, [4, 21, 4, 0, -1, -1, 4, 21, 12, 0, -1, -1, 20, 21, 12, 0, -1, -1, 20, 21, 20, 0]], N: [22, [4, 21, 4, 0, -1, -1, 4, 21, 18, 0, -1, -1, 18, 21, 18, 0]], O: [22, [9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 19, 8, 19, 13, 18, 16, 17, 18, 15, 20, 13, 21, 9, 21]], P: [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 14, 17, 12, 16, 11, 13, 10, 4, 10]], Q: [22, [9, 21, 7, 20, 5, 18, 4, 16, 3, 13, 3, 8, 4, 5, 5, 3, 7, 1, 9, 0, 13, 0, 15, 1, 17, 3, 18, 5, 19, 8, 19, 13, 18, 16, 17, 18, 15, 20, 13, 21, 9, 21, -1, -1, 12, 4, 18, -2]], R: [21, [4, 21, 4, 0, -1, -1, 4, 21, 13, 21, 16, 20, 17, 19, 18, 17, 18, 15, 17, 13, 16, 12, 13, 11, 4, 11, -1, -1, 11, 11, 18, 0]], S: [20, [17, 18, 15, 20, 12, 21, 8, 21, 5, 20, 3, 18, 3, 16, 4, 14, 5, 13, 7, 12, 13, 10, 15, 9, 16, 8, 17, 6, 17, 3, 15, 1, 12, 0, 8, 0, 5, 1, 3, 3]], T: [16, [8, 21, 8, 0, -1, -1, 1, 21, 15, 21]], U: [22, [4, 21, 4, 6, 5, 3, 7, 1, 10, 0, 12, 0, 15, 1, 17, 3, 18, 6, 18, 21]], V: [18, [1, 21, 9, 0, -1, -1, 17, 21, 9, 0]], W: [24, [2, 21, 7, 0, -1, -1, 12, 21, 7, 0, -1, -1, 12, 21, 17, 0, -1, -1, 22, 21, 17, 0]], X: [20, [3, 21, 17, 0, -1, -1, 17, 21, 3, 0]], Y: [18, [1, 21, 9, 11, 9, 0, -1, -1, 17, 21, 9, 11]], Z: [20, [17, 21, 3, 0, -1, -1, 3, 21, 17, 21, -1, -1, 3, 0, 17, 0]], "[": [14, [4, 25, 4, -7, -1, -1, 5, 25, 5, -7, -1, -1, 4, 25, 11, 25, -1, -1, 4, -7, 11, -7]], "\\": [14, [0, 21, 14, -3]], "]": [14, [9, 25, 9, -7, -1, -1, 10, 25, 10, -7, -1, -1, 3, 25, 10, 25, -1, -1, 3, -7, 10, -7]], "^": [16, [6, 15, 8, 18, 10, 15, -1, -1, 3, 12, 8, 17, 13, 12, -1, -1, 8, 17, 8, 0]], _: [16, [0, -2, 16, -2]], "`": [10, [6, 21, 5, 20, 4, 18, 4, 16, 5, 15, 6, 16, 5, 17]], a: [19, [15, 14, 15, 0, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], b: [19, [4, 21, 4, 0, -1, -1, 4, 11, 6, 13, 8, 14, 11, 14, 13, 13, 15, 11, 16, 8, 16, 6, 15, 3, 13, 1, 11, 0, 8, 0, 6, 1, 4, 3]], c: [18, [15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], d: [19, [15, 21, 15, 0, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], e: [18, [3, 8, 15, 8, 15, 10, 14, 12, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], f: [12, [10, 21, 8, 21, 6, 20, 5, 17, 5, 0, -1, -1, 2, 14, 9, 14]], g: [19, [15, 14, 15, -2, 14, -5, 13, -6, 11, -7, 8, -7, 6, -6, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], h: [19, [4, 21, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0]], i: [8, [3, 21, 4, 20, 5, 21, 4, 22, 3, 21, -1, -1, 4, 14, 4, 0]], j: [10, [5, 21, 6, 20, 7, 21, 6, 22, 5, 21, -1, -1, 6, 14, 6, -3, 5, -6, 3, -7, 1, -7]], k: [17, [4, 21, 4, 0, -1, -1, 14, 14, 4, 4, -1, -1, 8, 8, 15, 0]], l: [8, [4, 21, 4, 0]], m: [30, [4, 14, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0, -1, -1, 15, 10, 18, 13, 20, 14, 23, 14, 25, 13, 26, 10, 26, 0]], n: [19, [4, 14, 4, 0, -1, -1, 4, 10, 7, 13, 9, 14, 12, 14, 14, 13, 15, 10, 15, 0]], o: [19, [8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3, 16, 6, 16, 8, 15, 11, 13, 13, 11, 14, 8, 14]], p: [19, [4, 14, 4, -7, -1, -1, 4, 11, 6, 13, 8, 14, 11, 14, 13, 13, 15, 11, 16, 8, 16, 6, 15, 3, 13, 1, 11, 0, 8, 0, 6, 1, 4, 3]], q: [19, [15, 14, 15, -7, -1, -1, 15, 11, 13, 13, 11, 14, 8, 14, 6, 13, 4, 11, 3, 8, 3, 6, 4, 3, 6, 1, 8, 0, 11, 0, 13, 1, 15, 3]], r: [13, [4, 14, 4, 0, -1, -1, 4, 8, 5, 11, 7, 13, 9, 14, 12, 14]], s: [17, [14, 11, 13, 13, 10, 14, 7, 14, 4, 13, 3, 11, 4, 9, 6, 8, 11, 7, 13, 6, 14, 4, 14, 3, 13, 1, 10, 0, 7, 0, 4, 1, 3, 3]], t: [12, [5, 21, 5, 4, 6, 1, 8, 0, 10, 0, -1, -1, 2, 14, 9, 14]], u: [19, [4, 14, 4, 4, 5, 1, 7, 0, 10, 0, 12, 1, 15, 4, -1, -1, 15, 14, 15, 0]], v: [16, [2, 14, 8, 0, -1, -1, 14, 14, 8, 0]], w: [22, [3, 14, 7, 0, -1, -1, 11, 14, 7, 0, -1, -1, 11, 14, 15, 0, -1, -1, 19, 14, 15, 0]], x: [17, [3, 14, 14, 0, -1, -1, 14, 14, 3, 0]], y: [16, [2, 14, 8, 0, -1, -1, 14, 14, 8, 0, 6, -4, 4, -6, 2, -7, 1, -7]], z: [17, [14, 14, 3, 0, -1, -1, 3, 14, 14, 14, -1, -1, 3, 0, 14, 0]], "{": [14, [9, 25, 7, 24, 6, 23, 5, 21, 5, 19, 6, 17, 7, 16, 8, 14, 8, 12, 6, 10, -1, -1, 7, 24, 6, 22, 6, 20, 7, 18, 8, 17, 9, 15, 9, 13, 8, 11, 4, 9, 8, 7, 9, 5, 9, 3, 8, 1, 7, 0, 6, -2, 6, -4, 7, -6, -1, -1, 6, 8, 8, 6, 8, 4, 7, 2, 6, 1, 5, -1, 5, -3, 6, -5, 7, -6, 9, -7]], "|": [8, [4, 25, 4, -7]], "}": [14, [5, 25, 7, 24, 8, 23, 9, 21, 9, 19, 8, 17, 7, 16, 6, 14, 6, 12, 8, 10, -1, -1, 7, 24, 8, 22, 8, 20, 7, 18, 6, 17, 5, 15, 5, 13, 6, 11, 10, 9, 6, 7, 5, 5, 5, 3, 6, 1, 7, 0, 8, -2, 8, -4, 7, -6, -1, -1, 8, 8, 6, 6, 6, 4, 7, 2, 8, 1, 9, -1, 9, -3, 8, -5, 7, -6, 5, -7]], "~": [24, [3, 6, 3, 8, 4, 11, 6, 12, 8, 12, 10, 11, 14, 8, 16, 7, 18, 7, 20, 8, 21, 10, -1, -1, 3, 8, 4, 10, 6, 11, 8, 11, 10, 10, 14, 7, 16, 6, 18, 6, 20, 7, 21, 10, 21, 12]] }; var ho = { symbol: function (e, i, o, r, a) { if ("translucent" === e.renderPass) { var n = Ct.disabled, s = e.colorModeForRenderPass(); o.layout.get("text-variable-anchor") && function (e, i, o, r, a, n, s) { for (var l = i.transform, c = "map" === a, u = "map" === n, h = 0, p = e; h < p.length; h += 1) { var d = p[h], _ = r.getTile(d), f = _.getBucket(o); if (f && f.text && f.text.segments.get().length) { var m = f.textSizeData, g = t.evaluateSizeForZoom(m, l.zoom), v = ue(_, 1, i.transform.zoom), y = Kt(d.posMatrix, u, c, i.transform, v), x = "none" !== o.layout.get("icon-text-fit") && f.hasIconData(); if (g) { var b = Math.pow(2, l.zoom - _.tileID.overscaledZ); to(f, c, u, s, t.symbolSize, l, y, d.posMatrix, b, g, x); } } } }(r, e, o, i, o.layout.get("text-rotation-alignment"), o.layout.get("text-pitch-alignment"), a), 0 !== o.paint.get("icon-opacity").constantOr(1) && io(e, i, o, r, !1, o.paint.get("icon-translate"), o.paint.get("icon-translate-anchor"), o.layout.get("icon-rotation-alignment"), o.layout.get("icon-pitch-alignment"), o.layout.get("icon-keep-upright"), n, s), 0 !== o.paint.get("text-opacity").constantOr(1) && io(e, i, o, r, !0, o.paint.get("text-translate"), o.paint.get("text-translate-anchor"), o.layout.get("text-rotation-alignment"), o.layout.get("text-pitch-alignment"), o.layout.get("text-keep-upright"), n, s), i.map.showCollisionBoxes && (Ji(e, i, o, r, o.paint.get("text-translate"), o.paint.get("text-translate-anchor"), !0), Ji(e, i, o, r, o.paint.get("icon-translate"), o.paint.get("icon-translate-anchor"), !1)); } }, circle: function (e, i, o, r) { if ("translucent" === e.renderPass) { var a = o.paint.get("circle-opacity"), n = o.paint.get("circle-stroke-width"), s = o.paint.get("circle-stroke-opacity"), l = void 0 !== o.layout.get("circle-sort-key").constantOr(1); if (0 !== a.constantOr(1) || 0 !== n.constantOr(1) && 0 !== s.constantOr(1)) { for (var c = e.context, u = c.gl, h = e.depthModeForSublayer(0, It.ReadOnly), p = Ct.disabled, d = e.colorModeForRenderPass(), _ = [], f = 0; f < r.length; f++) { var m = r[f], g = i.getTile(m), v = g.getBucket(o); if (v) { var y = v.programConfigurations.get(o.id), x = { programConfiguration: y, program: e.useProgram("circle", y), layoutVertexBuffer: v.layoutVertexBuffer, indexBuffer: v.indexBuffer, uniformValues: Ti(e, m, g, o) }; if (l) for (var b = 0, w = v.segments.get(); b < w.length; b += 1) { var E = w[b]; _.push({ segments: new t.SegmentVector([E]), sortKey: E.sortKey, state: x }); } else _.push({ segments: v.segments, sortKey: 0, state: x }); } } l && _.sort((function (t, e) { return t.sortKey - e.sortKey })); for (var T = 0, I = _; T < I.length; T += 1) { var C = I[T], S = C.state, P = S.programConfiguration, z = S.program, L = S.layoutVertexBuffer, M = S.indexBuffer, D = S.uniformValues, A = C.segments; z.draw(c, u.TRIANGLES, h, p, d, Pt.disabled, D, o.id, L, M, A, o.paint, e.transform.zoom, P); } } } }, heatmap: function (e, i, o, r) { if (0 !== o.paint.get("heatmap-opacity")) if ("offscreen" === e.renderPass) { var a = e.context, n = a.gl, s = e.depthModeForSublayer(0, It.ReadOnly), l = Ct.disabled, c = new St([n.ONE, n.ONE], t.Color.transparent, [!0, !0, !0, !0]); !function (t, e, i) { var o = t.gl; t.activeTexture.set(o.TEXTURE1), t.viewport.set([0, 0, e.width / 4, e.height / 4]); var r = i.heatmapFbo; if (r) o.bindTexture(o.TEXTURE_2D, r.colorAttachment.get()), t.bindFramebuffer.set(r.framebuffer); else { var a = o.createTexture(); o.bindTexture(o.TEXTURE_2D, a), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_WRAP_S, o.CLAMP_TO_EDGE), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_WRAP_T, o.CLAMP_TO_EDGE), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MIN_FILTER, o.LINEAR), o.texParameteri(o.TEXTURE_2D, o.TEXTURE_MAG_FILTER, o.LINEAR), r = i.heatmapFbo = t.createFramebuffer(e.width / 4, e.height / 4), function t(e, i, o, r) { var a = e.gl; a.texImage2D(a.TEXTURE_2D, 0, a.RGBA, i.width / 4, i.height / 4, 0, a.RGBA, e.extTextureHalfFloat ? e.extTextureHalfFloat.HALF_FLOAT_OES : a.UNSIGNED_BYTE, null); r.colorAttachment.set(o); e.extTextureHalfFloat && a.checkFramebufferStatus(a.FRAMEBUFFER) !== a.FRAMEBUFFER_COMPLETE && (e.extTextureHalfFloat = null, r.colorAttachment.setDirty(), t(e, i, o, r)); }(t, e, a, r); } }(a, e, o), a.clear({ color: t.Color.transparent }); for (var u = 0; u < r.length; u++) { var h = r[u]; if (!i.hasRenderableParent(h)) { var p = i.getTile(h), d = p.getBucket(o); if (d) { var _ = d.programConfigurations.get(o.id), f = e.useProgram("heatmap", _), m = e.transform.zoom; f.draw(a, n.TRIANGLES, s, l, c, Pt.disabled, zi(h.posMatrix, p, m, o.paint.get("heatmap-intensity")), o.id, d.layoutVertexBuffer, d.indexBuffer, d.segments, o.paint, e.transform.zoom, _); } } } a.viewport.set([0, 0, e.width, e.height]); } else "translucent" === e.renderPass && (e.context.setColorMode(e.colorModeForRenderPass()), function (e, i) { var o = e.context, r = o.gl, a = i.heatmapFbo; if (!a) return; o.activeTexture.set(r.TEXTURE0), r.bindTexture(r.TEXTURE_2D, a.colorAttachment.get()), o.activeTexture.set(r.TEXTURE1); var n = i.colorRampTexture; n || (n = i.colorRampTexture = new t.Texture(o, i.colorRamp, r.RGBA)); n.bind(r.LINEAR, r.CLAMP_TO_EDGE), e.useProgram("heatmapTexture").draw(o, r.TRIANGLES, It.disabled, Ct.disabled, e.colorModeForRenderPass(), Pt.disabled, Li(e, i, 0, 1), i.id, e.viewportBuffer, e.quadTriangleIndexBuffer, e.viewportSegments, i.paint, e.transform.zoom); }(e, o)); }, line: function (e, i, o, r) { if ("translucent" === e.renderPass) { var a = o.paint.get("line-opacity"), n = o.paint.get("line-width"); if (0 !== a.constantOr(1) && 0 !== n.constantOr(1)) { var s = e.depthModeForSublayer(0, It.ReadOnly), l = e.colorModeForRenderPass(), c = o.paint.get("line-dasharray"), u = o.paint.get("line-pattern"), h = u.constantOr(1), p = o.paint.get("line-gradient"), d = o.getCrossfadeParameters(), _ = c ? "lineSDF" : h ? "linePattern" : p ? "lineGradient" : "line", f = e.context, m = f.gl, g = !0; if (p) { f.activeTexture.set(m.TEXTURE0); var v = o.gradientTexture; if (!o.gradient) return; v || (v = o.gradientTexture = new t.Texture(f, o.gradient, m.RGBA)), v.bind(m.LINEAR, m.CLAMP_TO_EDGE); } for (var y = 0, x = r; y < x.length; y += 1) { var b = x[y], w = i.getTile(b); if (!h || w.patternsLoaded()) { var E = w.getBucket(o); if (E) { var T = E.programConfigurations.get(o.id), I = e.context.program.get(), C = e.useProgram(_, T), S = g || C.program !== I, P = u.constantOr(null); if (P && w.imageAtlas) { var z = w.imageAtlas, L = z.patternPositions[P.to.toString()], M = z.patternPositions[P.from.toString()]; L && M && T.setConstantPatternPositions(L, M); } var D = c ? Oi(e, w, o, c, d) : h ? Bi(e, w, o, d) : p ? ki(e, w, o) : Ri(e, w, o); c && (S || e.lineAtlas.dirty) ? (f.activeTexture.set(m.TEXTURE0), e.lineAtlas.bind(f)) : h && (f.activeTexture.set(m.TEXTURE0), w.imageAtlasTexture.bind(m.LINEAR, m.CLAMP_TO_EDGE), T.updatePatternPaintBuffers(d)), C.draw(f, m.TRIANGLES, s, e.stencilModeForClipping(b), l, Pt.disabled, D, o.id, E.layoutVertexBuffer, E.indexBuffer, E.segments, o.paint, e.transform.zoom, T), g = !1; } } } } } }, fill: function (e, i, o, r) { var a = o.paint.get("fill-color"), n = o.paint.get("fill-opacity"); if (0 !== n.constantOr(1)) { var s = e.colorModeForRenderPass(), l = o.paint.get("fill-pattern"), c = e.opaquePassEnabledForLayer() && !l.constantOr(1) && 1 === a.constantOr(t.Color.transparent).a && 1 === n.constantOr(0) ? "opaque" : "translucent"; if (e.renderPass === c) { var u = e.depthModeForSublayer(1, "opaque" === e.renderPass ? It.ReadWrite : It.ReadOnly); ro(e, i, o, r, u, s, !1); } if ("translucent" === e.renderPass && o.paint.get("fill-antialias")) { var h = e.depthModeForSublayer(o.getPaintProperty("fill-outline-color") ? 2 : 0, It.ReadOnly); ro(e, i, o, r, h, s, !0); } } }, "fill-extrusion": function (t, e, i, o) { var r = i.paint.get("fill-extrusion-opacity"); if (0 !== r && "translucent" === t.renderPass) { var a = new It(t.context.gl.LEQUAL, It.ReadWrite, t.depthRangeFor3D); if (1 !== r || i.paint.get("fill-extrusion-pattern").constantOr(1)) ao(t, e, i, o, a, Ct.disabled, St.disabled), ao(t, e, i, o, a, t.stencilModeFor3D(), t.colorModeForRenderPass()); else { var n = t.colorModeForRenderPass(); ao(t, e, i, o, a, Ct.disabled, n); } } }, hillshade: function (t, e, i, o) { if ("offscreen" === t.renderPass || "translucent" === t.renderPass) { for (var r = t.context, a = e.getSource().maxzoom, n = t.depthModeForSublayer(0, It.ReadOnly), s = Ct.disabled, l = t.colorModeForRenderPass(), c = 0, u = o; c < u.length; c += 1) { var h = u[c], p = e.getTile(h); p.needsHillshadePrepare && "offscreen" === t.renderPass ? so(t, p, i, a, n, s, l) : "translucent" === t.renderPass && no(t, p, i, n, s, l); } r.viewport.set([0, 0, t.width, t.height]); } }, raster: function (t, e, i, o) { if ("translucent" === t.renderPass && 0 !== i.paint.get("raster-opacity")) for (var r = t.context, a = r.gl, n = e.getSource(), s = t.useProgram("raster"), l = Ct.disabled, c = t.colorModeForRenderPass(), u = o.length && o[0].overscaledZ, h = !t.options.moving, p = 0, d = o; p < d.length; p += 1) { var _ = d[p], f = t.depthModeForSublayer(_.overscaledZ - u, 1 === i.paint.get("raster-opacity") ? It.ReadWrite : It.ReadOnly, a.LESS), m = e.getTile(_), g = t.transform.calculatePosMatrix(_.toUnwrapped(), h); m.registerFadeDuration(i.paint.get("raster-fade-duration")); var v = e.findLoadedParent(_, 0), y = lo(m, v, e, i, t.transform), x = void 0, b = void 0, w = "nearest" === i.paint.get("raster-resampling") ? a.NEAREST : a.LINEAR; r.activeTexture.set(a.TEXTURE0), m.texture.bind(w, a.CLAMP_TO_EDGE, a.LINEAR_MIPMAP_NEAREST), r.activeTexture.set(a.TEXTURE1), v ? (v.texture.bind(w, a.CLAMP_TO_EDGE, a.LINEAR_MIPMAP_NEAREST), x = Math.pow(2, v.tileID.overscaledZ - m.tileID.overscaledZ), b = [m.tileID.canonical.x * x % 1, m.tileID.canonical.y * x % 1]) : m.texture.bind(w, a.CLAMP_TO_EDGE, a.LINEAR_MIPMAP_NEAREST); var E = Ni(g, b || [0, 0], x || 1, y, i); n instanceof M ? s.draw(r, a.TRIANGLES, f, l, c, Pt.disabled, E, i.id, n.boundsBuffer, t.quadTriangleIndexBuffer, n.boundsSegments) : m.maskedBoundsBuffer && m.maskedIndexBuffer && m.segments ? s.draw(r, a.TRIANGLES, f, l, c, Pt.disabled, E, i.id, m.maskedBoundsBuffer, m.maskedIndexBuffer, m.segments, i.paint, t.transform.zoom) : s.draw(r, a.TRIANGLES, f, l, c, Pt.disabled, E, i.id, t.rasterBoundsBuffer, t.quadTriangleIndexBuffer, t.rasterBoundsSegments); } }, background: function (t, e, i) { var o = i.paint.get("background-color"), r = i.paint.get("background-opacity"); if (0 !== r) { var a = t.context, n = a.gl, s = t.transform, l = s.tileSize, c = i.paint.get("background-pattern"); if (!t.isPatternMissing(c)) { var u = !c && 1 === o.a && 1 === r && t.opaquePassEnabledForLayer() ? "opaque" : "translucent"; if (t.renderPass === u) { var h = Ct.disabled, p = t.depthModeForSublayer(0, "opaque" === u ? It.ReadWrite : It.ReadOnly), d = t.colorModeForRenderPass(), _ = t.useProgram(c ? "backgroundPattern" : "background"), f = s.coveringTiles({ tileSize: l }); c && (a.activeTexture.set(n.TEXTURE0), t.imageManager.bind(t.context)); for (var m = i.getCrossfadeParameters(), g = 0, v = f; g < v.length; g += 1) { var y = v[g], x = t.transform.calculatePosMatrix(y.toUnwrapped()), b = c ? Wi(x, r, t, c, { tileID: y, tileSize: l }, m) : Gi(x, r, o); _.draw(a, n.TRIANGLES, p, h, d, Pt.disabled, b, i.id, t.tileExtentBuffer, t.quadTriangleIndexBuffer, t.tileExtentSegments); } } } } }, debug: function (t, e, i) { for (var o = 0; o < i.length; o++)co(t, e, i[o]); }, custom: function (t, e, i) { var o = t.context, r = i.implementation; if ("offscreen" === t.renderPass) { var a = r.prerender; a && (t.setCustomLayerDefaults(), o.setColorMode(t.colorModeForRenderPass()), a.call(r, o.gl, t.transform.customLayerMatrix()), o.setDirty(), t.setBaseState()); } else if ("translucent" === t.renderPass) { t.setCustomLayerDefaults(), o.setColorMode(t.colorModeForRenderPass()), o.setStencilMode(Ct.disabled); var n = "3d" === r.renderingMode ? new It(t.context.gl.LEQUAL, It.ReadWrite, t.depthRangeFor3D) : t.depthModeForSublayer(0, It.ReadOnly); o.setDepthMode(n), r.render(o.gl, t.transform.customLayerMatrix()), o.setDirty(), t.setBaseState(), o.bindFramebuffer.set(null); } } }, po = function (e, i) { this.context = new zt(e), this.transform = i, this._tileTextures = {}, this.setup(), this.numSublayers = Lt.maxUnderzooming + Lt.maxOverzooming + 1, this.depthEpsilon = 1 / Math.pow(2, 16), this.depthRboNeedsClear = !0, this.emptyProgramConfiguration = new t.ProgramConfiguration, this.crossTileSymbolIndex = new ke, this.gpuTimers = {}; }; function _o(t, e) { if (t.y > e.y) { var i = t; t = e, e = i; } return { x0: t.x, y0: t.y, x1: e.x, y1: e.y, dx: e.x - t.x, dy: e.y - t.y } } function fo(t, e, i, o, r) { var a = Math.max(i, Math.floor(e.y0)), n = Math.min(o, Math.ceil(e.y1)); if (t.x0 === e.x0 && t.y0 === e.y0 ? t.x0 + e.dy / t.dy * t.dx < e.x1 : t.x1 - e.dy / t.dy * t.dx < e.x0) { var s = t; t = e, e = s; } for (var l = t.dx / t.dy, c = e.dx / e.dy, u = t.dx > 0, h = e.dx < 0, p = a; p < n; p++) { var d = l * Math.max(0, Math.min(t.dy, p + u - t.y0)) + t.x0, _ = c * Math.max(0, Math.min(e.dy, p + h - e.y0)) + e.x0; r(Math.floor(_), Math.ceil(d), p); } } function mo(t, e, i, o, r, a) { var n, s = _o(t, e), l = _o(e, i), c = _o(i, t); s.dy > l.dy && (n = s, s = l, l = n), s.dy > c.dy && (n = s, s = c, c = n), l.dy > c.dy && (n = l, l = c, c = n), s.dy && fo(c, s, o, r, a), l.dy && fo(c, l, o, r, a); } po.prototype.resize = function (e, i) { var o = this.context.gl; if (this.width = e * t.browser.devicePixelRatio, this.height = i * t.browser.devicePixelRatio, this.context.viewport.set([0, 0, this.width, this.height]), this.style) for (var r = 0, a = this.style._order; r < a.length; r += 1) { var n = a[r]; this.style._layers[n].resize(); } this.depthRbo && (o.deleteRenderbuffer(this.depthRbo), this.depthRbo = null); }, po.prototype.setup = function () { var e = this.context, i = new t.StructArrayLayout2i4; i.emplaceBack(0, 0), i.emplaceBack(t.EXTENT, 0), i.emplaceBack(0, t.EXTENT), i.emplaceBack(t.EXTENT, t.EXTENT), this.tileExtentBuffer = e.createVertexBuffer(i, Ne.members), this.tileExtentSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2); var o = new t.StructArrayLayout2i4; o.emplaceBack(0, 0), o.emplaceBack(t.EXTENT, 0), o.emplaceBack(0, t.EXTENT), o.emplaceBack(t.EXTENT, t.EXTENT), this.debugBuffer = e.createVertexBuffer(o, Ne.members), this.debugSegments = t.SegmentVector.simpleSegment(0, 0, 4, 5); var r = new t.StructArrayLayout4i8; r.emplaceBack(0, 0, 0, 0), r.emplaceBack(t.EXTENT, 0, t.EXTENT, 0), r.emplaceBack(0, t.EXTENT, 0, t.EXTENT), r.emplaceBack(t.EXTENT, t.EXTENT, t.EXTENT, t.EXTENT), this.rasterBoundsBuffer = e.createVertexBuffer(r, t.rasterBoundsAttributes.members), this.rasterBoundsSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2); var a = new t.StructArrayLayout2i4; a.emplaceBack(0, 0), a.emplaceBack(1, 0), a.emplaceBack(0, 1), a.emplaceBack(1, 1), this.viewportBuffer = e.createVertexBuffer(a, Ne.members), this.viewportSegments = t.SegmentVector.simpleSegment(0, 0, 4, 2); var n = new t.StructArrayLayout1ui2; n.emplaceBack(0), n.emplaceBack(1), n.emplaceBack(3), n.emplaceBack(2), n.emplaceBack(0), this.tileBorderIndexBuffer = e.createIndexBuffer(n); var s = new t.StructArrayLayout3ui6; s.emplaceBack(0, 1, 2), s.emplaceBack(2, 1, 3), this.quadTriangleIndexBuffer = e.createIndexBuffer(s); var l = this.context.gl; this.stencilClearMode = new Ct({ func: l.ALWAYS, mask: 0 }, 0, 255, l.ZERO, l.ZERO, l.ZERO); }, po.prototype.clearStencil = function () { var e = this.context, i = e.gl; this.nextStencilID = 1, this.currentStencilSource = void 0; var o = t.create(); t.ortho(o, 0, this.width, this.height, 0, 0, 1), t.scale(o, o, [i.drawingBufferWidth, i.drawingBufferHeight, 0]), this.useProgram("clippingMask").draw(e, i.TRIANGLES, It.disabled, this.stencilClearMode, St.disabled, Pt.disabled, Pi(o), "$clipping", this.viewportBuffer, this.quadTriangleIndexBuffer, this.viewportSegments); }, po.prototype._renderTileClippingMasks = function (t, e) { if (this.currentStencilSource !== t.source && t.isTileClipped() && e && e.length) { this.currentStencilSource = t.source; var i = this.context, o = i.gl; this.nextStencilID + e.length > 256 && this.clearStencil(), i.setColorMode(St.disabled), i.setDepthMode(It.disabled); var r = this.useProgram("clippingMask"); this._tileClippingMaskIDs = {}; for (var a = 0, n = e; a < n.length; a += 1) { var s = n[a], l = this._tileClippingMaskIDs[s.key] = this.nextStencilID++; r.draw(i, o.TRIANGLES, It.disabled, new Ct({ func: o.ALWAYS, mask: 0 }, l, 255, o.KEEP, o.KEEP, o.REPLACE), St.disabled, Pt.disabled, Pi(s.posMatrix), "$clipping", this.tileExtentBuffer, this.quadTriangleIndexBuffer, this.tileExtentSegments); } } }, po.prototype.stencilModeFor3D = function () { this.currentStencilSource = void 0, this.nextStencilID + 1 > 256 && this.clearStencil(); var t = this.nextStencilID++, e = this.context.gl; return new Ct({ func: e.NOTEQUAL, mask: 255 }, t, 255, e.KEEP, e.KEEP, e.REPLACE) }, po.prototype.stencilModeForClipping = function (t) { var e = this.context.gl; return new Ct({ func: e.EQUAL, mask: 255 }, this._tileClippingMaskIDs[t.key], 0, e.KEEP, e.KEEP, e.REPLACE) }, po.prototype.colorModeForRenderPass = function () { var e = this.context.gl; if (this._showOverdrawInspector) { return new St([e.CONSTANT_COLOR, e.ONE], new t.Color(1 / 8, 1 / 8, 1 / 8, 0), [!0, !0, !0, !0]) } return "opaque" === this.renderPass ? St.unblended : St.alphaBlended }, po.prototype.depthModeForSublayer = function (t, e, i) { if (!this.opaquePassEnabledForLayer()) return It.disabled; var o = 1 - ((1 + this.currentLayer) * this.numSublayers + t) * this.depthEpsilon; return new It(i || this.context.gl.LEQUAL, e, [o, o]) }, po.prototype.opaquePassEnabledForLayer = function () { return this.currentLayer < this.opaquePassCutoff }, po.prototype.render = function (e, i) { var o = this; this.style = e, this.options = i, this.lineAtlas = e.lineAtlas, this.imageManager = e.imageManager, this.glyphManager = e.glyphManager, this.symbolFadeChange = e.placement.symbolFadeChange(t.browser.now()), this.imageManager.beginFrame(); var r = this.style._order, a = this.style.sourceCaches; for (var n in a) { var s = a[n]; s.used && s.prepare(this.context); } var l, c, u = {}, h = {}, p = {}; for (var d in a) { var _ = a[d]; u[d] = _.getVisibleCoordinates(), h[d] = u[d].slice().reverse(), p[d] = _.getVisibleCoordinates(!0).reverse(); } for (var f in a) { var m = a[f], g = m.getSource(); if ("raster" === g.type || "raster-dem" === g.type) { for (var v = [], y = 0, x = u[f]; y < x.length; y += 1) { var b = x[y]; v.push(m.getTile(b)); } Hi(v, this.context); } } this.opaquePassCutoff = 1 / 0; for (var w = 0; w < r.length; w++) { var E = r[w]; if (this.style._layers[E].is3D()) { this.opaquePassCutoff = w; break } } this.renderPass = "offscreen", this.depthRboNeedsClear = !0; for (var T = 0, I = r; T < I.length; T += 1) { var C = I[T], S = this.style._layers[C]; if (S.hasOffscreenPass() && !S.isHidden(this.transform.zoom)) { var P = h[S.source]; ("custom" === S.type || P.length) && this.renderLayer(this, a[S.source], S, P); } } for (this.context.bindFramebuffer.set(null), this.context.clear({ color: i.showOverdrawInspector ? t.Color.black : t.Color.transparent, depth: 1 }), this.clearStencil(), this._showOverdrawInspector = i.showOverdrawInspector, this.depthRangeFor3D = [0, 1 - (e._order.length + 2) * this.numSublayers * this.depthEpsilon], this.renderPass = "opaque", this.currentLayer = r.length - 1; this.currentLayer >= 0; this.currentLayer--) { var z = this.style._layers[r[this.currentLayer]], L = a[z.source], M = u[z.source]; this._renderTileClippingMasks(z, M), this.renderLayer(this, L, z, M); } for (this.renderPass = "translucent", this.currentLayer = 0; this.currentLayer < r.length; this.currentLayer++) { var D = this.style._layers[r[this.currentLayer]], A = a[D.source], R = ("symbol" === D.type ? p : h)[D.source]; this._renderTileClippingMasks(D, u[D.source]), this.renderLayer(this, A, D, R); } this.options.showTileBoundaries && (t.values(this.style._layers).forEach((function (t) { t.source && !t.isHidden(o.transform.zoom) && (t.source !== (c && c.id) && (c = o.style.sourceCaches[t.source]), (!l || l.getSource().maxzoom < c.getSource().maxzoom) && (l = c)); })), l && ho.debug(this, l, l.getVisibleCoordinates())); this.context.setDefault(); }, po.prototype.setupOffscreenDepthRenderbuffer = function () { var t = this.context; this.depthRbo || (this.depthRbo = t.createRenderbuffer(t.gl.DEPTH_COMPONENT16, this.width, this.height)); }, po.prototype.renderLayer = function (t, e, i, o) { i.isHidden(this.transform.zoom) || ("background" === i.type || "custom" === i.type || o.length) && (this.id = i.id, this.gpuTimingStart(i), ho[i.type](t, e, i, o, this.style.placement.variableOffsets), this.gpuTimingEnd()); }, po.prototype.gpuTimingStart = function (t) { if (this.options.gpuTiming) { var e = this.context.extTimerQuery, i = this.gpuTimers[t.id]; i || (i = this.gpuTimers[t.id] = { calls: 0, cpuTime: 0, query: e.createQueryEXT() }), i.calls++ , e.beginQueryEXT(e.TIME_ELAPSED_EXT, i.query); } }, po.prototype.gpuTimingEnd = function () { if (this.options.gpuTiming) { var t = this.context.extTimerQuery; t.endQueryEXT(t.TIME_ELAPSED_EXT); } }, po.prototype.collectGpuTimers = function () { var t = this.gpuTimers; return this.gpuTimers = {}, t }, po.prototype.queryGpuTimers = function (t) { var e = {}; for (var i in t) { var o = t[i], r = this.context.extTimerQuery, a = r.getQueryObjectEXT(o.query, r.QUERY_RESULT_EXT) / 1e6; r.deleteQueryEXT(o.query), e[i] = a; } return e }, po.prototype.translatePosMatrix = function (e, i, o, r, a) { if (!o[0] && !o[1]) return e; var n = a ? "map" === r ? this.transform.angle : 0 : "viewport" === r ? -this.transform.angle : 0; if (n) { var s = Math.sin(n), l = Math.cos(n); o = [o[0] * l - o[1] * s, o[0] * s + o[1] * l]; } var c = [a ? o[0] : ue(i, o[0], this.transform.zoom), a ? o[1] : ue(i, o[1], this.transform.zoom), 0], u = new Float32Array(16); return t.translate(u, e, c), u }, po.prototype.saveTileTexture = function (t) { var e = this._tileTextures[t.size[0]]; e ? e.push(t) : this._tileTextures[t.size[0]] = [t]; }, po.prototype.getTileTexture = function (t) { var e = this._tileTextures[t]; return e && e.length > 0 ? e.pop() : null }, po.prototype.isPatternMissing = function (t) { if (!t) return !1; var e = this.imageManager.getPattern(t.from.toString()), i = this.imageManager.getPattern(t.to.toString()); return !e || !i }, po.prototype.useProgram = function (t, e) { void 0 === e && (e = this.emptyProgramConfiguration), this.cache = this.cache || {}; var i = "" + t + (e.cacheKey || "") + (this._showOverdrawInspector ? "/overdraw" : ""); return this.cache[i] || (this.cache[i] = new mi(this.context, _i[t], e, Xi[t], this._showOverdrawInspector)), this.cache[i] }, po.prototype.setCustomLayerDefaults = function () { this.context.unbindVAO(), this.context.cullFace.setDefault(), this.context.activeTexture.setDefault(), this.context.pixelStoreUnpack.setDefault(), this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(), this.context.pixelStoreUnpackFlipY.setDefault(); }, po.prototype.setBaseState = function () { var t = this.context.gl; this.context.cullFace.set(!1), this.context.viewport.set([0, 0, this.width, this.height]), this.context.blendEquation.set(t.FUNC_ADD); }; var go = function (e, i, o, r, a) { this.tileSize = 512, this.maxValidLatitude = 85.051129, this._renderWorldCopies = void 0 === a || a, this._minZoom = e || 0, this._maxZoom = i || 22, this._minPitch = null == o ? 0 : o, this._maxPitch = null == r ? 60 : r, this.setMaxBounds(), this.width = 0, this.height = 0, this._center = new t.LngLat(0, 0), this.zoom = 0, this.angle = 0, this._fov = .6435011087932844, this._pitch = 0, this._unmodified = !0, this._posMatrixCache = {}, this._alignedPosMatrixCache = {}; }, vo = { minZoom: { configurable: !0 }, maxZoom: { configurable: !0 }, minPitch: { configurable: !0 }, maxPitch: { configurable: !0 }, renderWorldCopies: { configurable: !0 }, worldSize: { configurable: !0 }, centerPoint: { configurable: !0 }, size: { configurable: !0 }, bearing: { configurable: !0 }, pitch: { configurable: !0 }, fov: { configurable: !0 }, zoom: { configurable: !0 }, center: { configurable: !0 }, unmodified: { configurable: !0 }, point: { configurable: !0 } }; go.prototype.clone = function () { var t = new go(this._minZoom, this._maxZoom, this._minPitch, this.maxPitch, this._renderWorldCopies); return t.tileSize = this.tileSize, t.latRange = this.latRange, t.width = this.width, t.height = this.height, t._center = this._center, t.zoom = this.zoom, t.angle = this.angle, t._fov = this._fov, t._pitch = this._pitch, t._unmodified = this._unmodified, t._calcMatrices(), t }, vo.minZoom.get = function () { return this._minZoom }, vo.minZoom.set = function (t) { this._minZoom !== t && (this._minZoom = t, this.zoom = Math.max(this.zoom, t)); }, vo.maxZoom.get = function () { return this._maxZoom }, vo.maxZoom.set = function (t) { this._maxZoom !== t && (this._maxZoom = t, this.zoom = Math.min(this.zoom, t)); }, vo.minPitch.get = function () { return this._minPitch }, vo.minPitch.set = function (t) { this._minPitch !== t && (this._minPitch = t, this.pitch = Math.max(this.pitch, t)); }, vo.maxPitch.get = function () { return this._maxPitch }, vo.maxPitch.set = function (t) { this._maxPitch !== t && (this._maxPitch = t, this.pitch = Math.min(this.pitch, t)); }, vo.renderWorldCopies.get = function () { return this._renderWorldCopies }, vo.renderWorldCopies.set = function (t) { void 0 === t ? t = !0 : null === t && (t = !1), this._renderWorldCopies = t; }, vo.worldSize.get = function () { return this.tileSize * this.scale }, vo.centerPoint.get = function () { return this.size._div(2) }, vo.size.get = function () { return new t.Point(this.width, this.height) }, vo.bearing.get = function () { return -this.angle / Math.PI * 180 }, vo.bearing.set = function (e) { var i = -t.wrap(e, -180, 180) * Math.PI / 180; this.angle !== i && (this._unmodified = !1, this.angle = i, this._calcMatrices(), this.rotationMatrix = t.create$2(), t.rotate(this.rotationMatrix, this.rotationMatrix, this.angle)); }, vo.pitch.get = function () { return this._pitch / Math.PI * 180 }, vo.pitch.set = function (e) { var i = t.clamp(e, this.minPitch, this.maxPitch) / 180 * Math.PI; this._pitch !== i && (this._unmodified = !1, this._pitch = i, this._calcMatrices()); }, vo.fov.get = function () { return this._fov / Math.PI * 180 }, vo.fov.set = function (t) { t = Math.max(.01, Math.min(60, t)), this._fov !== t && (this._unmodified = !1, this._fov = t / 180 * Math.PI, this._calcMatrices()); }, vo.zoom.get = function () { return this._zoom }, vo.zoom.set = function (t) { var e = Math.min(Math.max(t, this.minZoom), this.maxZoom); this._zoom !== e && (this._unmodified = !1, this._zoom = e, this.scale = this.zoomScale(e), this.tileZoom = Math.floor(e), this.zoomFraction = e - this.tileZoom, this._constrain(), this._calcMatrices()); }, vo.center.get = function () { return this._center }, vo.center.set = function (t) { t.lat === this._center.lat && t.lng === this._center.lng || (this._unmodified = !1, this._center = t, this._constrain(), this._calcMatrices()); }, go.prototype.coveringZoomLevel = function (t) { var e = (t.roundZoom ? Math.round : Math.floor)(this.zoom + this.scaleZoom(this.tileSize / t.tileSize)); return Math.max(0, e) }, go.prototype.getVisibleUnwrappedCoordinates = function (e) { var i = [new t.UnwrappedTileID(0, e)]; if (this._renderWorldCopies) for (var o = this.pointCoordinate(new t.Point(0, 0)), r = this.pointCoordinate(new t.Point(this.width, 0)), a = this.pointCoordinate(new t.Point(this.width, this.height)), n = this.pointCoordinate(new t.Point(0, this.height)), s = Math.floor(Math.min(o.x, r.x, a.x, n.x)), l = Math.floor(Math.max(o.x, r.x, a.x, n.x)), c = s - 1; c <= l + 1; c++)0 !== c && i.push(new t.UnwrappedTileID(c, e)); return i }, go.prototype.coveringTiles = function (e) { var i = this.coveringZoomLevel(e), o = i; if (void 0 !== e.minzoom && i < e.minzoom) return []; void 0 !== e.maxzoom && i > e.maxzoom && (i = e.maxzoom); var r = t.MercatorCoordinate.fromLngLat(this.center), a = Math.pow(2, i), n = new t.Point(a * r.x - .5, a * r.y - .5); return function (e, i, o, r) { void 0 === r && (r = !0); var a = 1 << e, n = {}; function s(i, s, l) { var c, u, h, p; if (l >= 0 && l <= a) for (c = i; c < s; c++)u = Math.floor(c / a), h = (c % a + a) % a, 0 !== u && !0 !== r || (p = new t.OverscaledTileID(o, u, e, h, l), n[p.key] = p); } var l = i.map((function (e) { return new t.Point(e.x, e.y)._mult(a) })); return mo(l[0], l[1], l[2], 0, a, s), mo(l[2], l[3], l[0], 0, a, s), Object.keys(n).map((function (t) { return n[t] })) }(i, [this.pointCoordinate(new t.Point(0, 0)), this.pointCoordinate(new t.Point(this.width, 0)), this.pointCoordinate(new t.Point(this.width, this.height)), this.pointCoordinate(new t.Point(0, this.height))], e.reparseOverscaled ? o : i, this._renderWorldCopies).sort((function (t, e) { return n.dist(t.canonical) - n.dist(e.canonical) })) }, go.prototype.resize = function (t, e) { this.width = t, this.height = e, this.pixelsToGLUnits = [2 / t, -2 / e], this._constrain(), this._calcMatrices(); }, vo.unmodified.get = function () { return this._unmodified }, go.prototype.zoomScale = function (t) { return Math.pow(2, t) }, go.prototype.scaleZoom = function (t) { return Math.log(t) / Math.LN2 }, go.prototype.project = function (e) { var i = t.clamp(e.lat, -this.maxValidLatitude, this.maxValidLatitude); return new t.Point(t.mercatorXfromLng(e.lng) * this.worldSize, t.mercatorYfromLat(i) * this.worldSize) }, go.prototype.unproject = function (e) { return new t.MercatorCoordinate(e.x / this.worldSize, e.y / this.worldSize).toLngLat() }, vo.point.get = function () { return this.project(this.center) }, go.prototype.setLocationAtPoint = function (e, i) { var o = this.pointCoordinate(i), r = this.pointCoordinate(this.centerPoint), a = this.locationCoordinate(e), n = new t.MercatorCoordinate(a.x - (o.x - r.x), a.y - (o.y - r.y)); this.center = this.coordinateLocation(n), this._renderWorldCopies && (this.center = this.center.wrap()); }, go.prototype.locationPoint = function (t) { return this.coordinatePoint(this.locationCoordinate(t)) }, go.prototype.pointLocation = function (t) { return this.coordinateLocation(this.pointCoordinate(t)) }, go.prototype.locationCoordinate = function (e) { return t.MercatorCoordinate.fromLngLat(e) }, go.prototype.coordinateLocation = function (t) { return t.toLngLat() }, go.prototype.pointCoordinate = function (e) { var i = [e.x, e.y, 0, 1], o = [e.x, e.y, 1, 1]; t.transformMat4(i, i, this.pixelMatrixInverse), t.transformMat4(o, o, this.pixelMatrixInverse); var r = i[3], a = o[3], n = i[0] / r, s = o[0] / a, l = i[1] / r, c = o[1] / a, u = i[2] / r, h = o[2] / a, p = u === h ? 0 : (0 - u) / (h - u); return new t.MercatorCoordinate(t.number(n, s, p) / this.worldSize, t.number(l, c, p) / this.worldSize) }, go.prototype.coordinatePoint = function (e) { var i = [e.x * this.worldSize, e.y * this.worldSize, 0, 1]; return t.transformMat4(i, i, this.pixelMatrix), new t.Point(i[0] / i[3], i[1] / i[3]) }, go.prototype.getBounds = function () { return (new t.LngLatBounds).extend(this.pointLocation(new t.Point(0, 0))).extend(this.pointLocation(new t.Point(this.width, 0))).extend(this.pointLocation(new t.Point(this.width, this.height))).extend(this.pointLocation(new t.Point(0, this.height))) }, go.prototype.getMaxBounds = function () { return this.latRange && 2 === this.latRange.length && this.lngRange && 2 === this.lngRange.length ? new t.LngLatBounds([this.lngRange[0], this.latRange[0]], [this.lngRange[1], this.latRange[1]]) : null }, go.prototype.setMaxBounds = function (t) { t ? (this.lngRange = [t.getWest(), t.getEast()], this.latRange = [t.getSouth(), t.getNorth()], this._constrain()) : (this.lngRange = null, this.latRange = [-this.maxValidLatitude, this.maxValidLatitude]); }, go.prototype.calculatePosMatrix = function (e, i) { void 0 === i && (i = !1); var o = e.key, r = i ? this._alignedPosMatrixCache : this._posMatrixCache; if (r[o]) return r[o]; var a = e.canonical, n = this.worldSize / this.zoomScale(a.z), s = a.x + Math.pow(2, a.z) * e.wrap, l = t.identity(new Float64Array(16)); return t.translate(l, l, [s * n, a.y * n, 0]), t.scale(l, l, [n / t.EXTENT, n / t.EXTENT, 1]), t.multiply(l, i ? this.alignedProjMatrix : this.projMatrix, l), r[o] = new Float32Array(l), r[o] }, go.prototype.customLayerMatrix = function () { return this.mercatorMatrix.slice() }, go.prototype._constrain = function () { if (this.center && this.width && this.height && !this._constraining) { this._constraining = !0; var e, i, o, r, a = -90, n = 90, s = -180, l = 180, c = this.size, u = this._unmodified; if (this.latRange) { var h = this.latRange; a = t.mercatorYfromLat(h[1]) * this.worldSize, e = (n = t.mercatorYfromLat(h[0]) * this.worldSize) - a < c.y ? c.y / (n - a) : 0; } if (this.lngRange) { var p = this.lngRange; s = t.mercatorXfromLng(p[0]) * this.worldSize, i = (l = t.mercatorXfromLng(p[1]) * this.worldSize) - s < c.x ? c.x / (l - s) : 0; } var d = this.point, _ = Math.max(i || 0, e || 0); if (_) return this.center = this.unproject(new t.Point(i ? (l + s) / 2 : d.x, e ? (n + a) / 2 : d.y)), this.zoom += this.scaleZoom(_), this._unmodified = u, void (this._constraining = !1); if (this.latRange) { var f = d.y, m = c.y / 2; f - m < a && (r = a + m), f + m > n && (r = n - m); } if (this.lngRange) { var g = d.x, v = c.x / 2; g - v < s && (o = s + v), g + v > l && (o = l - v); } void 0 === o && void 0 === r || (this.center = this.unproject(new t.Point(void 0 !== o ? o : d.x, void 0 !== r ? r : d.y))), this._unmodified = u, this._constraining = !1; } }, go.prototype._calcMatrices = function () { if (this.height) { this.cameraToCenterDistance = .5 / Math.tan(this._fov / 2) * this.height; var e = this._fov / 2, i = Math.PI / 2 + this._pitch, o = Math.sin(e) * this.cameraToCenterDistance / Math.sin(Math.PI - i - e), r = this.point, a = r.x, n = r.y, s = 1.01 * (Math.cos(Math.PI / 2 - this._pitch) * o + this.cameraToCenterDistance), l = this.height / 50, c = new Float64Array(16); t.perspective(c, this._fov, this.width / this.height, l, s), t.scale(c, c, [1, -1, 1]), t.translate(c, c, [0, 0, -this.cameraToCenterDistance]), t.rotateX(c, c, this._pitch), t.rotateZ(c, c, this.angle), t.translate(c, c, [-a, -n, 0]), this.mercatorMatrix = t.scale([], c, [this.worldSize, this.worldSize, this.worldSize]), t.scale(c, c, [1, 1, t.mercatorZfromAltitude(1, this.center.lat) * this.worldSize, 1]), this.projMatrix = c; var u = this.width % 2 / 2, h = this.height % 2 / 2, p = Math.cos(this.angle), d = Math.sin(this.angle), _ = a - Math.round(a) + p * u + d * h, f = n - Math.round(n) + p * h + d * u, m = new Float64Array(c); if (t.translate(m, m, [_ > .5 ? _ - 1 : _, f > .5 ? f - 1 : f, 0]), this.alignedProjMatrix = m, c = t.create(), t.scale(c, c, [this.width / 2, -this.height / 2, 1]), t.translate(c, c, [1, -1, 0]), this.labelPlaneMatrix = c, c = t.create(), t.scale(c, c, [1, -1, 1]), t.translate(c, c, [-1, -1, 0]), t.scale(c, c, [2 / this.width, 2 / this.height, 1]), this.glCoordMatrix = c, this.pixelMatrix = t.multiply(new Float64Array(16), this.labelPlaneMatrix, this.projMatrix), !(c = t.invert(new Float64Array(16), this.pixelMatrix))) throw new Error("failed to invert matrix"); this.pixelMatrixInverse = c, this._posMatrixCache = {}, this._alignedPosMatrixCache = {}; } }, go.prototype.maxPitchScaleFactor = function () { if (!this.pixelMatrixInverse) return 1; var e = this.pointCoordinate(new t.Point(0, 0)), i = [e.x * this.worldSize, e.y * this.worldSize, 0, 1]; return t.transformMat4(i, i, this.pixelMatrix)[3] / this.cameraToCenterDistance }, go.prototype.getCameraPoint = function () { var e = this._pitch, i = Math.tan(e) * (this.cameraToCenterDistance || 1); return this.centerPoint.add(new t.Point(0, i)) }, go.prototype.getCameraQueryGeometry = function (e) { var i = this.getCameraPoint(); if (1 === e.length) return [e[0], i]; for (var o = i.x, r = i.y, a = i.x, n = i.y, s = 0, l = e; s < l.length; s += 1) { var c = l[s]; o = Math.min(o, c.x), r = Math.min(r, c.y), a = Math.max(a, c.x), n = Math.max(n, c.y); } return [new t.Point(o, r), new t.Point(a, r), new t.Point(a, n), new t.Point(o, n), new t.Point(o, r)] }, Object.defineProperties(go.prototype, vo); var yo = function (e) { var i, o, r, a, n; this._hashName = e && encodeURIComponent(e), t.bindAll(["_getCurrentHash", "_onHashChange", "_updateHash"], this), this._updateHash = (i = this._updateHashUnthrottled.bind(this), o = 300, r = !1, a = null, n = function () { a = null, r && (i(), a = setTimeout(n, o), r = !1); }, function () { return r = !0, a || n(), a }); }; yo.prototype.addTo = function (e) { return this._map = e, t.window.addEventListener("hashchange", this._onHashChange, !1), this._map.on("moveend", this._updateHash), this }, yo.prototype.remove = function () { return t.window.removeEventListener("hashchange", this._onHashChange, !1), this._map.off("moveend", this._updateHash), clearTimeout(this._updateHash()), delete this._map, this }, yo.prototype.getHashString = function (e) { var i = this._map.getCenter(), o = Math.round(100 * this._map.getZoom()) / 100, r = Math.ceil((o * Math.LN2 + Math.log(512 / 360 / .5)) / Math.LN10), a = Math.pow(10, r), n = Math.round(i.lng * a) / a, s = Math.round(i.lat * a) / a, l = this._map.getBearing(), c = this._map.getPitch(), u = ""; if (u += e ? "/" + n + "/" + s + "/" + o : o + "/" + s + "/" + n, (l || c) && (u += "/" + Math.round(10 * l) / 10), c && (u += "/" + Math.round(c)), this._hashName) { var h = this._hashName, p = !1, d = t.window.location.hash.slice(1).split("&").map((function (t) { var e = t.split("=")[0]; return e === h ? (p = !0, e + "=" + u) : t })).filter((function (t) { return t })); return p || d.push(h + "=" + u), "#" + d.join("&") } return "#" + u }, yo.prototype._getCurrentHash = function () { var e, i = this, o = t.window.location.hash.replace("#", ""); return this._hashName ? (o.split("&").map((function (t) { return t.split("=") })).forEach((function (t) { t[0] === i._hashName && (e = t); })), (e && e[1] || "").split("/")) : o.split("/") }, yo.prototype._onHashChange = function () { var t = this._getCurrentHash(); return t.length >= 3 && !t.some((function (t) { return isNaN(t) })) && (this._map.jumpTo({ center: [+t[2], +t[1]], zoom: +t[0], bearing: +(t[3] || 0), pitch: +(t[4] || 0) }), !0) }, yo.prototype._updateHashUnthrottled = function () { var e = this.getHashString(); try { t.window.history.replaceState(t.window.history.state, "", e); } catch (t) { } }; var xo = function (e) { function o(o, r, a, n) { void 0 === n && (n = {}); var s = i.mousePos(r.getCanvasContainer(), a), l = r.unproject(s); e.call(this, o, t.extend({ point: s, lngLat: l, originalEvent: a }, n)), this._defaultPrevented = !1, this.target = r; } e && (o.__proto__ = e), o.prototype = Object.create(e && e.prototype), o.prototype.constructor = o; var r = { defaultPrevented: { configurable: !0 } }; return o.prototype.preventDefault = function () { this._defaultPrevented = !0; }, r.defaultPrevented.get = function () { return this._defaultPrevented }, Object.defineProperties(o.prototype, r), o }(t.Event), bo = function (e) { function o(o, r, a) { var n = i.touchPos(r.getCanvasContainer(), a), s = n.map((function (t) { return r.unproject(t) })), l = n.reduce((function (t, e, i, o) { return t.add(e.div(o.length)) }), new t.Point(0, 0)), c = r.unproject(l); e.call(this, o, { points: n, point: l, lngLats: s, lngLat: c, originalEvent: a }), this._defaultPrevented = !1; } e && (o.__proto__ = e), o.prototype = Object.create(e && e.prototype), o.prototype.constructor = o; var r = { defaultPrevented: { configurable: !0 } }; return o.prototype.preventDefault = function () { this._defaultPrevented = !0; }, r.defaultPrevented.get = function () { return this._defaultPrevented }, Object.defineProperties(o.prototype, r), o }(t.Event), wo = function (t) { function e(e, i, o) { t.call(this, e, { originalEvent: o }), this._defaultPrevented = !1; } t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e; var i = { defaultPrevented: { configurable: !0 } }; return e.prototype.preventDefault = function () { this._defaultPrevented = !0; }, i.defaultPrevented.get = function () { return this._defaultPrevented }, Object.defineProperties(e.prototype, i), e }(t.Event), Eo = function (e) { this._map = e, this._el = e.getCanvasContainer(), this._delta = 0, this._defaultZoomRate = .01, this._wheelZoomRate = 1 / 450, t.bindAll(["_onWheel", "_onTimeout", "_onScrollFrame", "_onScrollFinished"], this); }; Eo.prototype.setZoomRate = function (t) { this._defaultZoomRate = t; }, Eo.prototype.setWheelZoomRate = function (t) { this._wheelZoomRate = t; }, Eo.prototype.isEnabled = function () { return !!this._enabled }, Eo.prototype.isActive = function () { return !!this._active }, Eo.prototype.isZooming = function () { return !!this._zooming }, Eo.prototype.enable = function (t) { this.isEnabled() || (this._enabled = !0, this._aroundCenter = t && "center" === t.around); }, Eo.prototype.disable = function () { this.isEnabled() && (this._enabled = !1); }, Eo.prototype.onWheel = function (e) { if (this.isEnabled()) { var i = e.deltaMode === t.window.WheelEvent.DOM_DELTA_LINE ? 40 * e.deltaY : e.deltaY, o = t.browser.now(), r = o - (this._lastWheelEventTime || 0); this._lastWheelEventTime = o, 0 !== i && i % 4.000244140625 == 0 ? this._type = "wheel" : 0 !== i && Math.abs(i) < 4 ? this._type = "trackpad" : r > 400 ? (this._type = null, this._lastValue = i, this._timeout = setTimeout(this._onTimeout, 40, e)) : this._type || (this._type = Math.abs(r * i) < 200 ? "trackpad" : "wheel", this._timeout && (clearTimeout(this._timeout), this._timeout = null, i += this._lastValue)), e.shiftKey && i && (i /= 4), this._type && (this._lastWheelEvent = e, this._delta -= i, this.isActive() || this._start(e)), e.preventDefault(); } }, Eo.prototype._onTimeout = function (t) { this._type = "wheel", this._delta -= this._lastValue, this.isActive() || this._start(t); }, Eo.prototype._start = function (e) { if (this._delta) { this._frameId && (this._map._cancelRenderFrame(this._frameId), this._frameId = null), this._active = !0, this.isZooming() || (this._zooming = !0, this._map.fire(new t.Event("movestart", { originalEvent: e })), this._map.fire(new t.Event("zoomstart", { originalEvent: e }))), this._finishTimeout && clearTimeout(this._finishTimeout); var o = i.mousePos(this._el, e); this._around = t.LngLat.convert(this._aroundCenter ? this._map.getCenter() : this._map.unproject(o)), this._aroundPoint = this._map.transform.locationPoint(this._around), this._frameId || (this._frameId = this._map._requestRenderFrame(this._onScrollFrame)); } }, Eo.prototype._onScrollFrame = function () { var e = this; if (this._frameId = null, this.isActive()) { var i = this._map.transform; if (0 !== this._delta) { var o = "wheel" === this._type && Math.abs(this._delta) > 4.000244140625 ? this._wheelZoomRate : this._defaultZoomRate, r = 2 / (1 + Math.exp(-Math.abs(this._delta * o))); this._delta < 0 && 0 !== r && (r = 1 / r); var a = "number" == typeof this._targetZoom ? i.zoomScale(this._targetZoom) : i.scale; this._targetZoom = Math.min(i.maxZoom, Math.max(i.minZoom, i.scaleZoom(a * r))), "wheel" === this._type && (this._startZoom = i.zoom, this._easing = this._smoothOutEasing(200)), this._delta = 0; } var n = "number" == typeof this._targetZoom ? this._targetZoom : i.zoom, s = this._startZoom, l = this._easing, c = !1; if ("wheel" === this._type && s && l) { var u = Math.min((t.browser.now() - this._lastWheelEventTime) / 200, 1), h = l(u); i.zoom = t.number(s, n, h), u < 1 ? this._frameId || (this._frameId = this._map._requestRenderFrame(this._onScrollFrame)) : c = !0; } else i.zoom = n, c = !0; i.setLocationAtPoint(this._around, this._aroundPoint), this._map.fire(new t.Event("move", { originalEvent: this._lastWheelEvent })), this._map.fire(new t.Event("zoom", { originalEvent: this._lastWheelEvent })), c && (this._active = !1, this._finishTimeout = setTimeout((function () { e._zooming = !1, e._map.fire(new t.Event("zoomend", { originalEvent: e._lastWheelEvent })), e._map.fire(new t.Event("moveend", { originalEvent: e._lastWheelEvent })), delete e._targetZoom; }), 200)); } }, Eo.prototype._smoothOutEasing = function (e) { var i = t.ease; if (this._prevEase) { var o = this._prevEase, r = (t.browser.now() - o.start) / o.duration, a = o.easing(r + .01) - o.easing(r), n = .27 / Math.sqrt(a * a + 1e-4) * .01, s = Math.sqrt(.0729 - n * n); i = t.bezier(n, s, .25, 1); } return this._prevEase = { start: t.browser.now(), duration: e, easing: i }, i }; var To = function (e, i) { this._map = e, this._el = e.getCanvasContainer(), this._container = e.getContainer(), this._clickTolerance = i.clickTolerance || 1, t.bindAll(["_onMouseMove", "_onMouseUp", "_onKeyDown"], this); }; To.prototype.isEnabled = function () { return !!this._enabled }, To.prototype.isActive = function () { return !!this._active }, To.prototype.enable = function () { this.isEnabled() || (this._enabled = !0); }, To.prototype.disable = function () { this.isEnabled() && (this._enabled = !1); }, To.prototype.onMouseDown = function (e) { this.isEnabled() && e.shiftKey && 0 === e.button && (t.window.document.addEventListener("mousemove", this._onMouseMove, !1), t.window.document.addEventListener("keydown", this._onKeyDown, !1), t.window.document.addEventListener("mouseup", this._onMouseUp, !1), i.disableDrag(), this._startPos = this._lastPos = i.mousePos(this._el, e), this._active = !0); }, To.prototype._onMouseMove = function (t) { var e = i.mousePos(this._el, t); if (!(this._lastPos.equals(e) || !this._box && e.dist(this._startPos) < this._clickTolerance)) { var o = this._startPos; this._lastPos = e, this._box || (this._box = i.create("div", "mapboxgl-boxzoom", this._container), this._container.classList.add("mapboxgl-crosshair"), this._fireEvent("boxzoomstart", t)); var r = Math.min(o.x, e.x), a = Math.max(o.x, e.x), n = Math.min(o.y, e.y), s = Math.max(o.y, e.y); i.setTransform(this._box, "translate(" + r + "px," + n + "px)"), this._box.style.width = a - r + "px", this._box.style.height = s - n + "px"; } }, To.prototype._onMouseUp = function (e) { if (0 === e.button) { var o = this._startPos, r = i.mousePos(this._el, e); this._finish(), i.suppressClick(), o.x === r.x && o.y === r.y ? this._fireEvent("boxzoomcancel", e) : this._map.fitScreenCoordinates(o, r, this._map.getBearing(), { linear: !0 }).fire(new t.Event("boxzoomend", { originalEvent: e })); } }, To.prototype._onKeyDown = function (t) { 27 === t.keyCode && (this._finish(), this._fireEvent("boxzoomcancel", t)); }, To.prototype._finish = function () { this._active = !1, t.window.document.removeEventListener("mousemove", this._onMouseMove, !1), t.window.document.removeEventListener("keydown", this._onKeyDown, !1), t.window.document.removeEventListener("mouseup", this._onMouseUp, !1), this._container.classList.remove("mapboxgl-crosshair"), this._box && (i.remove(this._box), this._box = null), i.enableDrag(), delete this._startPos, delete this._lastPos; }, To.prototype._fireEvent = function (e, i) { return this._map.fire(new t.Event(e, { originalEvent: i })) }; var Io = t.bezier(0, 0, .25, 1), Co = function (e, i) { this._map = e, this._el = i.element || e.getCanvasContainer(), this._state = "disabled", this._button = i.button || "right", this._bearingSnap = i.bearingSnap || 0, this._pitchWithRotate = !1 !== i.pitchWithRotate, t.bindAll(["onMouseDown", "_onMouseMove", "_onMouseUp", "_onBlur", "_onDragFrame"], this); }; Co.prototype.isEnabled = function () { return "disabled" !== this._state }, Co.prototype.isActive = function () { return "active" === this._state }, Co.prototype.enable = function () { this.isEnabled() || (this._state = "enabled"); }, Co.prototype.disable = function () { if (this.isEnabled()) switch (this._state) { case "active": this._state = "disabled", this._unbind(), this._deactivate(), this._fireEvent("rotateend"), this._pitchWithRotate && this._fireEvent("pitchend"), this._fireEvent("moveend"); break; case "pending": this._state = "disabled", this._unbind(); break; default: this._state = "disabled"; } }, Co.prototype.onMouseDown = function (e) { if ("enabled" === this._state) { var o = "touchstart" === e.type; if (o) this._startTime = Date.now(); else if ("right" === this._button) { if (this._eventButton = i.mouseButton(e), this._eventButton !== (e.ctrlKey ? 0 : 2)) return } else { if (e.ctrlKey || 0 !== i.mouseButton(e)) return; this._eventButton = 0; } i.disableDrag(), o ? (t.window.document.addEventListener("touchmove", this._onMouseMove, { capture: !0 }), t.window.document.addEventListener("touchend", this._onMouseUp)) : (t.window.document.addEventListener("mousemove", this._onMouseMove, { capture: !0 }), t.window.document.addEventListener("mouseup", this._onMouseUp)), t.window.addEventListener("blur", this._onBlur), this._state = "pending", this._inertia = [[t.browser.now(), this._map.getBearing()]], this._startPos = this._prevPos = this._lastPos = i.mousePos(this._el, e), this._center = this._map.transform.centerPoint, e.preventDefault(); } }, Co.prototype._onMouseMove = function (t) { var e = i.mousePos(this._el, t); this._lastPos.equals(e) || (this._lastMoveEvent = t, this._lastPos = e, "pending" === this._state && (this._state = "active", this._fireEvent("rotatestart", t), this._fireEvent("movestart", t), this._pitchWithRotate && this._fireEvent("pitchstart", t)), this._frameId || (this._frameId = this._map._requestRenderFrame(this._onDragFrame))); }, Co.prototype._onDragFrame = function () { this._frameId = null; var e = this._lastMoveEvent; if (e) { var i = this._map.transform, o = this._prevPos, r = this._lastPos, a = .8 * (o.x - r.x), n = -.5 * (o.y - r.y), s = i.bearing - a, l = i.pitch - n, c = this._inertia, u = c[c.length - 1]; this._drainInertiaBuffer(), c.push([t.browser.now(), this._map._normalizeBearing(s, u[1])]); var h = i.bearing; if (i.bearing = s, this._pitchWithRotate) { var p = i.pitch; i.pitch = l, i.pitch !== p && this._fireEvent("pitch", e); } i.bearing !== h && this._fireEvent("rotate", e), this._fireEvent("move", e), delete this._lastMoveEvent, this._prevPos = this._lastPos; } }, Co.prototype._onMouseUp = function (t) { if ("touchend" === t.type && this._startPos === this._lastPos && Date.now() - this._startTime < 300 && this._el.click(), i.mouseButton(t) === this._eventButton) switch (this._state) { case "active": this._state = "enabled", i.suppressClick(), this._unbind(), this._deactivate(), this._inertialRotate(t); break; case "pending": this._state = "enabled", this._unbind(); } }, Co.prototype._onBlur = function (t) { switch (this._state) { case "active": this._state = "enabled", this._unbind(), this._deactivate(), this._fireEvent("rotateend", t), this._pitchWithRotate && this._fireEvent("pitchend", t), this._fireEvent("moveend", t); break; case "pending": this._state = "enabled", this._unbind(); } }, Co.prototype._unbind = function () { t.window.document.removeEventListener("mousemove", this._onMouseMove, { capture: !0 }), t.window.document.removeEventListener("mouseup", this._onMouseUp), t.window.document.removeEventListener("touchmove", this._onMouseMove, { capture: !0 }), t.window.document.removeEventListener("touchend", this._onMouseUp), t.window.removeEventListener("blur", this._onBlur), i.enableDrag(); }, Co.prototype._deactivate = function () { this._frameId && (this._map._cancelRenderFrame(this._frameId), this._frameId = null), delete this._lastMoveEvent, delete this._startPos, delete this._prevPos, delete this._lastPos; }, Co.prototype._inertialRotate = function (t) { var e = this; this._fireEvent("rotateend", t), this._drainInertiaBuffer(); var i = this._map, o = i.getBearing(), r = this._inertia, a = function () { Math.abs(o) < e._bearingSnap ? i.resetNorth({ noMoveStart: !0 }, { originalEvent: t }) : e._fireEvent("moveend", t), e._pitchWithRotate && e._fireEvent("pitchend", t); }; if (r.length < 2) a(); else { var n = r[0], s = r[r.length - 1], l = r[r.length - 2], c = i._normalizeBearing(o, l[1]), u = s[1] - n[1], h = u < 0 ? -1 : 1, p = (s[0] - n[0]) / 1e3; if (0 !== u && 0 !== p) { var d = Math.abs(u * (.25 / p)); d > 180 && (d = 180); var _ = d / 180; c += h * d * (_ / 2), Math.abs(i._normalizeBearing(c, 0)) < this._bearingSnap && (c = i._normalizeBearing(0, c)), i.rotateTo(c, { duration: 1e3 * _, easing: Io, noMoveStart: !0 }, { originalEvent: t }); } else a(); } }, Co.prototype._fireEvent = function (e, i) { return this._map.fire(new t.Event(e, i ? { originalEvent: i } : {})) }, Co.prototype._drainInertiaBuffer = function () { for (var e = this._inertia, i = t.browser.now(); e.length > 0 && i - e[0][0] > 160;)e.shift(); }; var So = { linearity: .3, easing: t.bezier(0, 0, .3, 1), maxSpeed: 1400, deceleration: 2500 }, Po = function (e, i) { this._map = e, this._el = e.getCanvasContainer(), this._state = "disabled", this._clickTolerance = i.clickTolerance || 1, this._inertiaOptions = So, t.bindAll(["_onMove", "_onMouseUp", "_onTouchEnd", "_onBlur", "_onDragFrame"], this); }; Po.prototype.isEnabled = function () { return "disabled" !== this._state }, Po.prototype.isActive = function () { return "active" === this._state }, Po.prototype.enable = function (e) { this.isEnabled() || (this._el.classList.add("mapboxgl-touch-drag-pan"), this._state = "enabled", this._inertiaOptions = t.extend(So, e)); }, Po.prototype.disable = function () { if (this.isEnabled()) switch (this._el.classList.remove("mapboxgl-touch-drag-pan"), this._state) { case "active": this._state = "disabled", this._unbind(), this._deactivate(), this._fireEvent("dragend"), this._fireEvent("moveend"); break; case "pending": this._state = "disabled", this._unbind(); break; default: this._state = "disabled"; } }, Po.prototype.onMouseDown = function (e) { "enabled" === this._state && (e.ctrlKey || 0 !== i.mouseButton(e) || (i.addEventListener(t.window.document, "mousemove", this._onMove, { capture: !0 }), i.addEventListener(t.window.document, "mouseup", this._onMouseUp), this._start(e))); }, Po.prototype.onTouchStart = function (e) { this.isEnabled() && (e.touches && e.touches.length > 1 && ("pending" === this._state || "active" === this._state) || (i.addEventListener(t.window.document, "touchmove", this._onMove, { capture: !0, passive: !1 }), i.addEventListener(t.window.document, "touchend", this._onTouchEnd), this._start(e))); }, Po.prototype._start = function (e) { t.window.addEventListener("blur", this._onBlur), this._state = "pending", this._startPos = this._mouseDownPos = this._prevPos = this._lastPos = i.mousePos(this._el, e), this._startTouch = this._lastTouch = t.window.TouchEvent && e instanceof t.window.TouchEvent ? i.touchPos(this._el, e) : null, this._inertia = [[t.browser.now(), this._startPos]]; }, Po.prototype._touchesMatch = function (t, e) { return !(!t || !e || t.length !== e.length) && t.every((function (t, i) { return e[i] === t })) }, Po.prototype._onMove = function (e) { e.preventDefault(); var o = t.window.TouchEvent && e instanceof t.window.TouchEvent ? i.touchPos(this._el, e) : null, r = i.mousePos(this._el, e); (o ? this._touchesMatch(this._lastTouch, o) : this._lastPos.equals(r)) || "pending" === this._state && r.dist(this._mouseDownPos) < this._clickTolerance || (this._lastMoveEvent = e, this._lastPos = r, this._lastTouch = o, this._drainInertiaBuffer(), this._inertia.push([t.browser.now(), this._lastPos]), "pending" === this._state && (this._state = "active", this._shouldStart = !0), this._frameId || (this._frameId = this._map._requestRenderFrame(this._onDragFrame))); }, Po.prototype._onDragFrame = function () { this._frameId = null; var t = this._lastMoveEvent; if (t) if (this._map.touchZoomRotate.isActive()) this._abort(t); else if (this._shouldStart && (this._fireEvent("dragstart", t), this._fireEvent("movestart", t), this._shouldStart = !1), this.isActive()) { var e = this._map.transform; e.setLocationAtPoint(e.pointLocation(this._prevPos), this._lastPos), this._fireEvent("drag", t), this._fireEvent("move", t), this._prevPos = this._lastPos, delete this._lastMoveEvent; } }, Po.prototype._onMouseUp = function (t) { if (0 === i.mouseButton(t)) switch (this._state) { case "active": this._state = "enabled", i.suppressClick(), this._unbind(), this._deactivate(), this._inertialPan(t); break; case "pending": this._state = "enabled", this._unbind(); } }, Po.prototype._onTouchEnd = function (t) { if (t.touches && 0 !== t.touches.length) switch (this._state) { case "pending": case "active": break; case "enabled": this.onTouchStart(t); } else switch (this._state) { case "active": this._state = "enabled", this._unbind(), this._deactivate(), this._inertialPan(t); break; case "pending": this._state = "enabled", this._unbind(); break; case "enabled": this._unbind(); } }, Po.prototype._abort = function (e) { switch (this._state) { case "active": this._state = "enabled", this._shouldStart || (this._fireEvent("dragend", e), this._fireEvent("moveend", e)), this._unbind(), this._deactivate(), t.window.TouchEvent && e instanceof t.window.TouchEvent && e.touches.length > 1 && i.addEventListener(t.window.document, "touchend", this._onTouchEnd); break; case "pending": this._state = "enabled", this._unbind(); break; case "enabled": this._unbind(); } }, Po.prototype._onBlur = function (t) { this._abort(t); }, Po.prototype._unbind = function () { i.removeEventListener(t.window.document, "touchmove", this._onMove, { capture: !0, passive: !1 }), i.removeEventListener(t.window.document, "touchend", this._onTouchEnd), i.removeEventListener(t.window.document, "mousemove", this._onMove, { capture: !0 }), i.removeEventListener(t.window.document, "mouseup", this._onMouseUp), i.removeEventListener(t.window, "blur", this._onBlur); }, Po.prototype._deactivate = function () { this._frameId && (this._map._cancelRenderFrame(this._frameId), this._frameId = null), delete this._lastMoveEvent, delete this._startPos, delete this._prevPos, delete this._mouseDownPos, delete this._lastPos, delete this._startTouch, delete this._lastTouch, delete this._shouldStart; }, Po.prototype._inertialPan = function (t) { this._fireEvent("dragend", t), this._drainInertiaBuffer(); var e = this._inertia; if (e.length < 2) this._fireEvent("moveend", t); else { var i = e[e.length - 1], o = e[0], r = i[1].sub(o[1]), a = (i[0] - o[0]) / 1e3; if (0 === a || i[1].equals(o[1])) this._fireEvent("moveend", t); else { var n = this._inertiaOptions, s = n.linearity, l = n.easing, c = n.maxSpeed, u = n.deceleration, h = r.mult(s / a), p = h.mag(); p > c && (p = c, h._unit()._mult(p)); var d = p / (u * s), _ = h.mult(-d / 2); this._map.panBy(_, { duration: 1e3 * d, easing: l, noMoveStart: !0 }, { originalEvent: t }); } } }, Po.prototype._fireEvent = function (e, i) { return this._map.fire(new t.Event(e, i ? { originalEvent: i } : {})) }, Po.prototype._drainInertiaBuffer = function () { for (var e = this._inertia, i = t.browser.now(); e.length > 0 && i - e[0][0] > 160;)e.shift(); }; var zo = function (e) { this._map = e, this._el = e.getCanvasContainer(), t.bindAll(["_onKeyDown"], this); }; function Lo(t) { return t * (2 - t) } zo.prototype.isEnabled = function () { return !!this._enabled }, zo.prototype.enable = function () { this.isEnabled() || (this._el.addEventListener("keydown", this._onKeyDown, !1), this._enabled = !0); }, zo.prototype.disable = function () { this.isEnabled() && (this._el.removeEventListener("keydown", this._onKeyDown), this._enabled = !1); }, zo.prototype._onKeyDown = function (t) { if (!(t.altKey || t.ctrlKey || t.metaKey)) { var e = 0, i = 0, o = 0, r = 0, a = 0; switch (t.keyCode) { case 61: case 107: case 171: case 187: e = 1; break; case 189: case 109: case 173: e = -1; break; case 37: t.shiftKey ? i = -1 : (t.preventDefault(), r = -1); break; case 39: t.shiftKey ? i = 1 : (t.preventDefault(), r = 1); break; case 38: t.shiftKey ? o = 1 : (t.preventDefault(), a = -1); break; case 40: t.shiftKey ? o = -1 : (a = 1, t.preventDefault()); break; default: return }var n = this._map, s = n.getZoom(), l = { duration: 300, delayEndEvents: 500, easing: Lo, zoom: e ? Math.round(s) + e * (t.shiftKey ? 2 : 1) : s, bearing: n.getBearing() + 15 * i, pitch: n.getPitch() + 10 * o, offset: [100 * -r, 100 * -a], center: n.getCenter() }; n.easeTo(l, { originalEvent: t }); } }; var Mo = function (e) { this._map = e, t.bindAll(["_onDblClick", "_onZoomEnd"], this); }; Mo.prototype.isEnabled = function () { return !!this._enabled }, Mo.prototype.isActive = function () { return !!this._active }, Mo.prototype.enable = function () { this.isEnabled() || (this._enabled = !0); }, Mo.prototype.disable = function () { this.isEnabled() && (this._enabled = !1); }, Mo.prototype.onTouchStart = function (t) { var e = this; if (this.isEnabled() && !(t.points.length > 1)) if (this._tapped) { var i = t.points[0], o = this._tappedPoint; if (o && o.dist(i) <= 30) { t.originalEvent.preventDefault(); var r = function () { e._tapped && e._zoom(t), e._map.off("touchcancel", a), e._resetTapped(); }, a = function () { e._map.off("touchend", r), e._resetTapped(); }; this._map.once("touchend", r), this._map.once("touchcancel", a); } else this._resetTapped(); } else this._tappedPoint = t.points[0], this._tapped = setTimeout((function () { e._tapped = null, e._tappedPoint = null; }), 300); }, Mo.prototype._resetTapped = function () { clearTimeout(this._tapped), this._tapped = null, this._tappedPoint = null; }, Mo.prototype.onDblClick = function (t) { this.isEnabled() && (t.originalEvent.preventDefault(), this._zoom(t)); }, Mo.prototype._zoom = function (t) { this._active = !0, this._map.on("zoomend", this._onZoomEnd), this._map.zoomTo(this._map.getZoom() + (t.originalEvent.shiftKey ? -1 : 1), { around: t.lngLat }, t); }, Mo.prototype._onZoomEnd = function () { this._active = !1, this._map.off("zoomend", this._onZoomEnd); }; var Do = t.bezier(0, 0, .15, 1), Ao = function (e) { this._map = e, this._el = e.getCanvasContainer(), t.bindAll(["_onMove", "_onEnd", "_onTouchFrame"], this); }; Ao.prototype.isEnabled = function () { return !!this._enabled }, Ao.prototype.enable = function (t) { this.isEnabled() || (this._el.classList.add("mapboxgl-touch-zoom-rotate"), this._enabled = !0, this._aroundCenter = !!t && "center" === t.around); }, Ao.prototype.disable = function () { this.isEnabled() && (this._el.classList.remove("mapboxgl-touch-zoom-rotate"), this._enabled = !1); }, Ao.prototype.disableRotation = function () { this._rotationDisabled = !0; }, Ao.prototype.enableRotation = function () { this._rotationDisabled = !1; }, Ao.prototype.isActive = function () { return this.isEnabled() && !!this._gestureIntent }, Ao.prototype.onStart = function (e) { if (this.isEnabled() && 2 === e.touches.length) { var o = i.mousePos(this._el, e.touches[0]), r = i.mousePos(this._el, e.touches[1]), a = o.add(r).div(2); this._startVec = o.sub(r), this._startAround = this._map.transform.pointLocation(a), this._gestureIntent = void 0, this._inertia = [], i.addEventListener(t.window.document, "touchmove", this._onMove, { passive: !1 }), i.addEventListener(t.window.document, "touchend", this._onEnd); } }, Ao.prototype._getTouchEventData = function (t) { var e = i.mousePos(this._el, t.touches[0]), o = i.mousePos(this._el, t.touches[1]), r = e.sub(o); return { vec: r, center: e.add(o).div(2), scale: r.mag() / this._startVec.mag(), bearing: this._rotationDisabled ? 0 : 180 * r.angleWith(this._startVec) / Math.PI } }, Ao.prototype._onMove = function (e) { if (2 === e.touches.length) { var i = this._getTouchEventData(e), o = i.vec, r = i.scale, a = i.bearing; if (!this._gestureIntent) { var n = this._rotationDisabled && 1 !== r || Math.abs(1 - r) > .15; Math.abs(a) > 10 ? this._gestureIntent = "rotate" : n && (this._gestureIntent = "zoom"), this._gestureIntent && (this._map.fire(new t.Event(this._gestureIntent + "start", { originalEvent: e })), this._map.fire(new t.Event("movestart", { originalEvent: e })), this._startVec = o); } this._lastTouchEvent = e, this._frameId || (this._frameId = this._map._requestRenderFrame(this._onTouchFrame)), e.preventDefault(); } }, Ao.prototype._onTouchFrame = function () { this._frameId = null; var e = this._gestureIntent; if (e) { var i = this._map.transform; this._startScale || (this._startScale = i.scale, this._startBearing = i.bearing); var o = this._getTouchEventData(this._lastTouchEvent), r = o.center, a = o.bearing, n = o.scale, s = i.pointLocation(r), l = i.locationPoint(s); "rotate" === e && (i.bearing = this._startBearing + a), i.zoom = i.scaleZoom(this._startScale * n), i.setLocationAtPoint(this._startAround, l), this._map.fire(new t.Event(e, { originalEvent: this._lastTouchEvent })), this._map.fire(new t.Event("move", { originalEvent: this._lastTouchEvent })), this._drainInertiaBuffer(), this._inertia.push([t.browser.now(), n, r]); } }, Ao.prototype._onEnd = function (e) { i.removeEventListener(t.window.document, "touchmove", this._onMove, { passive: !1 }), i.removeEventListener(t.window.document, "touchend", this._onEnd); var o = this._gestureIntent, r = this._startScale; if (this._frameId && (this._map._cancelRenderFrame(this._frameId), this._frameId = null), delete this._gestureIntent, delete this._startScale, delete this._startBearing, delete this._lastTouchEvent, o) { this._map.fire(new t.Event(o + "end", { originalEvent: e })), this._drainInertiaBuffer(); var a = this._inertia, n = this._map; if (a.length < 2) n.snapToNorth({}, { originalEvent: e }); else { var s = a[a.length - 1], l = a[0], c = n.transform.scaleZoom(r * s[1]), u = n.transform.scaleZoom(r * l[1]), h = c - u, p = (s[0] - l[0]) / 1e3, d = s[2]; if (0 !== p && c !== u) { var _ = .15 * h / p; Math.abs(_) > 2.5 && (_ = _ > 0 ? 2.5 : -2.5); var f = 1e3 * Math.abs(_ / (12 * .15)), m = c + _ * f / 2e3; n.easeTo({ zoom: m, duration: f, easing: Do, around: this._aroundCenter ? n.getCenter() : n.unproject(d), noMoveStart: !0 }, { originalEvent: e }); } else n.snapToNorth({}, { originalEvent: e }); } } }, Ao.prototype._drainInertiaBuffer = function () { for (var e = this._inertia, i = t.browser.now(); e.length > 2 && i - e[0][0] > 160;)e.shift(); }; var Ro = { scrollZoom: Eo, boxZoom: To, dragRotate: Co, dragPan: Po, keyboard: zo, doubleClickZoom: Mo, touchZoomRotate: Ao }; var ko = function (e) { function i(i, o) { e.call(this), this._moving = !1, this._zooming = !1, this.transform = i, this._bearingSnap = o.bearingSnap, t.bindAll(["_renderFrameCallback"], this); } return e && (i.__proto__ = e), i.prototype = Object.create(e && e.prototype), i.prototype.constructor = i, i.prototype.getCenter = function () { return new t.LngLat(this.transform.center.lng, this.transform.center.lat) }, i.prototype.setCenter = function (t, e) { return this.jumpTo({ center: t }, e) }, i.prototype.panBy = function (e, i, o) { return e = t.Point.convert(e).mult(-1), this.panTo(this.transform.center, t.extend({ offset: e }, i), o) }, i.prototype.panTo = function (e, i, o) { return this.easeTo(t.extend({ center: e }, i), o) }, i.prototype.getZoom = function () { return this.transform.zoom }, i.prototype.setZoom = function (t, e) { return this.jumpTo({ zoom: t }, e), this }, i.prototype.zoomTo = function (e, i, o) { return this.easeTo(t.extend({ zoom: e }, i), o) }, i.prototype.zoomIn = function (t, e) { return this.zoomTo(this.getZoom() + 1, t, e), this }, i.prototype.zoomOut = function (t, e) { return this.zoomTo(this.getZoom() - 1, t, e), this }, i.prototype.getBearing = function () { return this.transform.bearing }, i.prototype.setBearing = function (t, e) { return this.jumpTo({ bearing: t }, e), this }, i.prototype.rotateTo = function (e, i, o) { return this.easeTo(t.extend({ bearing: e }, i), o) }, i.prototype.resetNorth = function (e, i) { return this.rotateTo(0, t.extend({ duration: 1e3 }, e), i), this }, i.prototype.resetNorthPitch = function (e, i) { return this.easeTo(t.extend({ bearing: 0, pitch: 0, duration: 1e3 }, e), i), this }, i.prototype.snapToNorth = function (t, e) { return Math.abs(this.getBearing()) < this._bearingSnap ? this.resetNorth(t, e) : this }, i.prototype.getPitch = function () { return this.transform.pitch }, i.prototype.setPitch = function (t, e) { return this.jumpTo({ pitch: t }, e), this }, i.prototype.cameraForBounds = function (e, i) { return e = t.LngLatBounds.convert(e), this._cameraForBoxAndBearing(e.getNorthWest(), e.getSouthEast(), 0, i) }, i.prototype._cameraForBoxAndBearing = function (e, i, o, r) { if ("number" == typeof (r = t.extend({ padding: { top: 0, bottom: 0, right: 0, left: 0 }, offset: [0, 0], maxZoom: this.transform.maxZoom }, r)).padding) { var a = r.padding; r.padding = { top: a, bottom: a, right: a, left: a }; } if (t.deepEqual(Object.keys(r.padding).sort((function (t, e) { return t < e ? -1 : t > e ? 1 : 0 })), ["bottom", "left", "right", "top"])) { var n = this.transform, s = n.project(t.LngLat.convert(e)), l = n.project(t.LngLat.convert(i)), c = s.rotate(-o * Math.PI / 180), u = l.rotate(-o * Math.PI / 180), h = new t.Point(Math.max(c.x, u.x), Math.max(c.y, u.y)), p = new t.Point(Math.min(c.x, u.x), Math.min(c.y, u.y)), d = h.sub(p), _ = (n.width - r.padding.left - r.padding.right) / d.x, f = (n.height - r.padding.top - r.padding.bottom) / d.y; if (!(f < 0 || _ < 0)) { var m = Math.min(n.scaleZoom(n.scale * Math.min(_, f)), r.maxZoom), g = t.Point.convert(r.offset), v = (r.padding.left - r.padding.right) / 2, y = (r.padding.top - r.padding.bottom) / 2, x = new t.Point(g.x + v, g.y + y).mult(n.scale / n.zoomScale(m)); return { center: n.unproject(s.add(l).div(2).sub(x)), zoom: m, bearing: o } } t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset."); } else t.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'"); }, i.prototype.fitBounds = function (t, e, i) { return this._fitInternal(this.cameraForBounds(t, e), e, i) }, i.prototype.fitScreenCoordinates = function (e, i, o, r, a) { return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)), this.transform.pointLocation(t.Point.convert(i)), o, r), r, a) }, i.prototype._fitInternal = function (e, i, o) { return e ? (i = t.extend(e, i)).linear ? this.easeTo(i, o) : this.flyTo(i, o) : this }, i.prototype.jumpTo = function (e, i) { this.stop(); var o = this.transform, r = !1, a = !1, n = !1; return "zoom" in e && o.zoom !== +e.zoom && (r = !0, o.zoom = +e.zoom), void 0 !== e.center && (o.center = t.LngLat.convert(e.center)), "bearing" in e && o.bearing !== +e.bearing && (a = !0, o.bearing = +e.bearing), "pitch" in e && o.pitch !== +e.pitch && (n = !0, o.pitch = +e.pitch), this.fire(new t.Event("movestart", i)).fire(new t.Event("move", i)), r && this.fire(new t.Event("zoomstart", i)).fire(new t.Event("zoom", i)).fire(new t.Event("zoomend", i)), a && this.fire(new t.Event("rotatestart", i)).fire(new t.Event("rotate", i)).fire(new t.Event("rotateend", i)), n && this.fire(new t.Event("pitchstart", i)).fire(new t.Event("pitch", i)).fire(new t.Event("pitchend", i)), this.fire(new t.Event("moveend", i)) }, i.prototype.easeTo = function (e, i) { var o = this; this.stop(), (!1 === (e = t.extend({ offset: [0, 0], duration: 500, easing: t.ease }, e)).animate || !e.essential && t.browser.prefersReducedMotion) && (e.duration = 0); var r = this.transform, a = this.getZoom(), n = this.getBearing(), s = this.getPitch(), l = "zoom" in e ? +e.zoom : a, c = "bearing" in e ? this._normalizeBearing(e.bearing, n) : n, u = "pitch" in e ? +e.pitch : s, h = r.centerPoint.add(t.Point.convert(e.offset)), p = r.pointLocation(h), d = t.LngLat.convert(e.center || p); this._normalizeCenter(d); var _, f, m = r.project(p), g = r.project(d).sub(m), v = r.zoomScale(l - a); return e.around && (_ = t.LngLat.convert(e.around), f = r.locationPoint(_)), this._zooming = l !== a, this._rotating = n !== c, this._pitching = u !== s, this._prepareEase(i, e.noMoveStart), clearTimeout(this._easeEndTimeoutID), this._ease((function (e) { if (o._zooming && (r.zoom = t.number(a, l, e)), o._rotating && (r.bearing = t.number(n, c, e)), o._pitching && (r.pitch = t.number(s, u, e)), _) r.setLocationAtPoint(_, f); else { var p = r.zoomScale(r.zoom - a), d = l > a ? Math.min(2, v) : Math.max(.5, v), y = Math.pow(d, 1 - e), x = r.unproject(m.add(g.mult(e * y)).mult(p)); r.setLocationAtPoint(r.renderWorldCopies ? x.wrap() : x, h); } o._fireMoveEvents(i); }), (function () { e.delayEndEvents ? o._easeEndTimeoutID = setTimeout((function () { return o._afterEase(i) }), e.delayEndEvents) : o._afterEase(i); }), e), this }, i.prototype._prepareEase = function (e, i) { this._moving = !0, i || this.fire(new t.Event("movestart", e)), this._zooming && this.fire(new t.Event("zoomstart", e)), this._rotating && this.fire(new t.Event("rotatestart", e)), this._pitching && this.fire(new t.Event("pitchstart", e)); }, i.prototype._fireMoveEvents = function (e) { this.fire(new t.Event("move", e)), this._zooming && this.fire(new t.Event("zoom", e)), this._rotating && this.fire(new t.Event("rotate", e)), this._pitching && this.fire(new t.Event("pitch", e)); }, i.prototype._afterEase = function (e) { var i = this._zooming, o = this._rotating, r = this._pitching; this._moving = !1, this._zooming = !1, this._rotating = !1, this._pitching = !1, i && this.fire(new t.Event("zoomend", e)), o && this.fire(new t.Event("rotateend", e)), r && this.fire(new t.Event("pitchend", e)), this.fire(new t.Event("moveend", e)); }, i.prototype.flyTo = function (e, i) { var o = this; if (!e.essential && t.browser.prefersReducedMotion) { var r = t.pick(e, ["center", "zoom", "bearing", "pitch", "around"]); return this.jumpTo(r, i) } this.stop(), e = t.extend({ offset: [0, 0], speed: 1.2, curve: 1.42, easing: t.ease }, e); var a = this.transform, n = this.getZoom(), s = this.getBearing(), l = this.getPitch(), c = "zoom" in e ? t.clamp(+e.zoom, a.minZoom, a.maxZoom) : n, u = "bearing" in e ? this._normalizeBearing(e.bearing, s) : s, h = "pitch" in e ? +e.pitch : l, p = a.zoomScale(c - n), d = a.centerPoint.add(t.Point.convert(e.offset)), _ = a.pointLocation(d), f = t.LngLat.convert(e.center || _); this._normalizeCenter(f); var m = a.project(_), g = a.project(f).sub(m), v = e.curve, y = Math.max(a.width, a.height), x = y / p, b = g.mag(); if ("minZoom" in e) { var w = t.clamp(Math.min(e.minZoom, n, c), a.minZoom, a.maxZoom), E = y / a.zoomScale(w - n); v = Math.sqrt(E / b * 2); } var T = v * v; function I(t) { var e = (x * x - y * y + (t ? -1 : 1) * T * T * b * b) / (2 * (t ? x : y) * T * b); return Math.log(Math.sqrt(e * e + 1) - e) } function C(t) { return (Math.exp(t) - Math.exp(-t)) / 2 } function S(t) { return (Math.exp(t) + Math.exp(-t)) / 2 } var P = I(0), z = function (t) { return S(P) / S(P + v * t) }, L = function (t) { return y * ((S(P) * (C(e = P + v * t) / S(e)) - C(P)) / T) / b; var e; }, M = (I(1) - P) / v; if (Math.abs(b) < 1e-6 || !isFinite(M)) { if (Math.abs(y - x) < 1e-6) return this.easeTo(e, i); var D = x < y ? -1 : 1; M = Math.abs(Math.log(x / y)) / v, L = function () { return 0 }, z = function (t) { return Math.exp(D * v * t) }; } if ("duration" in e) e.duration = +e.duration; else { var A = "screenSpeed" in e ? +e.screenSpeed / v : +e.speed; e.duration = 1e3 * M / A; } return e.maxDuration && e.duration > e.maxDuration && (e.duration = 0), this._zooming = !0, this._rotating = s !== u, this._pitching = h !== l, this._prepareEase(i, !1), this._ease((function (e) { var r = e * M, p = 1 / z(r); a.zoom = 1 === e ? c : n + a.scaleZoom(p), o._rotating && (a.bearing = t.number(s, u, e)), o._pitching && (a.pitch = t.number(l, h, e)); var _ = 1 === e ? f : a.unproject(m.add(g.mult(L(r))).mult(p)); a.setLocationAtPoint(a.renderWorldCopies ? _.wrap() : _, d), o._fireMoveEvents(i); }), (function () { return o._afterEase(i) }), e), this }, i.prototype.isEasing = function () { return !!this._easeFrameId }, i.prototype.stop = function () { if (this._easeFrameId && (this._cancelRenderFrame(this._easeFrameId), delete this._easeFrameId, delete this._onEaseFrame), this._onEaseEnd) { var t = this._onEaseEnd; delete this._onEaseEnd, t.call(this); } return this }, i.prototype._ease = function (e, i, o) { !1 === o.animate || 0 === o.duration ? (e(1), i()) : (this._easeStart = t.browser.now(), this._easeOptions = o, this._onEaseFrame = e, this._onEaseEnd = i, this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback)); }, i.prototype._renderFrameCallback = function () { var e = Math.min((t.browser.now() - this._easeStart) / this._easeOptions.duration, 1); this._onEaseFrame(this._easeOptions.easing(e)), e < 1 ? this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback) : this.stop(); }, i.prototype._normalizeBearing = function (e, i) { e = t.wrap(e, -180, 180); var o = Math.abs(e - i); return Math.abs(e - 360 - i) < o && (e -= 360), Math.abs(e + 360 - i) < o && (e += 360), e }, i.prototype._normalizeCenter = function (t) { var e = this.transform; if (e.renderWorldCopies && !e.lngRange) { var i = t.lng - e.center.lng; t.lng += i > 180 ? -360 : i < -180 ? 360 : 0; } }, i }(t.Evented), Bo = function (e) { void 0 === e && (e = {}), this.options = e, t.bindAll(["_updateEditLink", "_updateData", "_updateCompact"], this); }; Bo.prototype.getDefaultPosition = function () { return "bottom-right" }, Bo.prototype.onAdd = function (t) { var e = this.options && this.options.compact; return this._map = t, this._container = i.create("div", "mapboxgl-ctrl mapboxgl-ctrl-attrib"), this._innerContainer = i.create("div", "mapboxgl-ctrl-attrib-inner", this._container), e && 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 === e && (this._map.on("resize", this._updateCompact), this._updateCompact()), this._container }, Bo.prototype.onRemove = function () { i.remove(this._container), this._map.off("styledata", this._updateData), this._map.off("sourcedata", this._updateData), this._map.off("moveend", this._updateEditLink), this._map.off("resize", this._updateCompact), this._map = void 0, this._attribHTML = void 0; }, Bo.prototype._updateEditLink = function () { var e = this._editLink; e || (e = this._editLink = this._container.querySelector(".mapbox-improve-map")); var i = [{ key: "owner", value: this.styleOwner }, { key: "id", value: this.styleId }, { key: "access_token", value: this._map._requestManager._customAccessToken || t.config.ACCESS_TOKEN }]; if (e) { var o = i.reduce((function (t, e, o) { return e.value && (t += e.key + "=" + e.value + (o < i.length - 1 ? "&" : "")), t }), "?"); e.href = t.config.FEEDBACK_URL + "/" + o + (this._map._hash ? this._map._hash.getHashString(!0) : ""), e.rel = "noopener nofollow"; } }, Bo.prototype._updateData = function (t) { !t || "metadata" !== t.sourceDataType && "style" !== t.dataType || (this._updateAttributions(), this._updateEditLink()); }, Bo.prototype._updateAttributions = function () { if (this._map.style) { var t = []; if (this.options.customAttribution && (Array.isArray(this.options.customAttribution) ? t = t.concat(this.options.customAttribution.map((function (t) { return "string" != typeof t ? "" : t }))) : "string" == typeof this.options.customAttribution && t.push(this.options.customAttribution)), this._map.style.stylesheet) { var e = this._map.style.stylesheet; this.styleOwner = e.owner, this.styleId = e.id; } var i = this._map.style.sourceCaches; for (var o in i) { var r = i[o]; if (r.used) { var a = r.getSource(); a.attribution && t.indexOf(a.attribution) < 0 && t.push(a.attribution); } } t.sort((function (t, e) { return t.length - e.length })); var n = (t = t.filter((function (e, i) { for (var o = i + 1; o < t.length; o++)if (t[o].indexOf(e) >= 0) return !1; return !0 }))).join(" | "); n !== this._attribHTML && (this._attribHTML = n, t.length ? (this._innerContainer.innerHTML = n, this._container.classList.remove("mapboxgl-attrib-empty")) : this._container.classList.add("mapboxgl-attrib-empty"), this._editLink = null); } }, Bo.prototype._updateCompact = function () { this._map.getCanvasContainer().offsetWidth <= 640 ? this._container.classList.add("mapboxgl-compact") : this._container.classList.remove("mapboxgl-compact"); }; var Oo = function () { t.bindAll(["_updateLogo"], this), t.bindAll(["_updateCompact"], this); }; Oo.prototype.onAdd = function (t) { this._map = t, this._container = i.create("div", "mapboxgl-ctrl"); var e = i.create("a", "mapboxgl-ctrl-logo"); return e.target = "_blank", e.rel = "noopener nofollow", e.href = "https://www.mapbox.com/", e.setAttribute("aria-label", this._map._getUIString("LogoControl.Title")), e.setAttribute("rel", "noopener nofollow"), this._container.appendChild(e), this._container.style.display = "none", this._map.on("sourcedata", this._updateLogo), this._updateLogo(), this._map.on("resize", this._updateCompact), this._updateCompact(), this._container }, Oo.prototype.onRemove = function () { i.remove(this._container), this._map.off("sourcedata", this._updateLogo), this._map.off("resize", this._updateCompact); }, Oo.prototype.getDefaultPosition = function () { return "bottom-left" }, Oo.prototype._updateLogo = function (t) { t && "metadata" !== t.sourceDataType || (this._container.style.display = this._logoRequired() ? "block" : "none"); }, Oo.prototype._logoRequired = function () { if (this._map.style) { var t = this._map.style.sourceCaches; for (var e in t) { if (t[e].getSource().mapbox_logo) return !0 } return !1 } }, Oo.prototype._updateCompact = function () { var t = this._container.children; if (t.length) { var e = t[0]; this._map.getCanvasContainer().offsetWidth < 250 ? e.classList.add("mapboxgl-compact") : e.classList.remove("mapboxgl-compact"); } }; var Fo = function () { this._queue = [], this._id = 0, this._cleared = !1, this._currentlyRunning = !1; }; Fo.prototype.add = function (t) { var e = ++this._id; return this._queue.push({ callback: t, id: e, cancelled: !1 }), e }, Fo.prototype.remove = function (t) { for (var e = this._currentlyRunning, i = 0, o = e ? this._queue.concat(e) : this._queue; i < o.length; i += 1) { var r = o[i]; if (r.id === t) return void (r.cancelled = !0) } }, Fo.prototype.run = function () { var t = this._currentlyRunning = this._queue; this._queue = []; for (var e = 0, i = t; e < i.length; e += 1) { var o = i[e]; if (!o.cancelled && (o.callback(), this._cleared)) break } this._cleared = !1, this._currentlyRunning = !1; }, Fo.prototype.clear = function () { this._currentlyRunning && (this._cleared = !0), this._queue = []; }; var Uo = { "FullscreenControl.Enter": "Enter fullscreen", "FullscreenControl.Exit": "Exit fullscreen", "GeolocateControl.FindMyLocation": "Find my location", "GeolocateControl.LocationNotAvailable": "Location not available", "LogoControl.Title": "Mapbox logo", "NavigationControl.ResetBearing": "Reset bearing to north", "NavigationControl.ZoomIn": "Zoom in", "NavigationControl.ZoomOut": "Zoom out", "ScaleControl.Feet": "ft", "ScaleControl.Meters": "m", "ScaleControl.Kilometers": "km", "ScaleControl.Miles": "mi", "ScaleControl.NauticalMiles": "nm" }, No = t.window.HTMLImageElement, Zo = t.window.HTMLElement, qo = 0, jo = 60, Vo = { center: [0, 0], zoom: 0, bearing: 0, pitch: 0, minZoom: -2, maxZoom: 22, minPitch: qo, maxPitch: jo, interactive: !0, scrollZoom: !0, boxZoom: !0, dragRotate: !0, dragPan: !0, keyboard: !0, doubleClickZoom: !0, touchZoomRotate: !0, bearingSnap: 7, clickTolerance: 3, hash: !1, attributionControl: !0, failIfMajorPerformanceCaveat: !1, preserveDrawingBuffer: !0, trackResize: !0, renderWorldCopies: !0, refreshExpiredTiles: !0, maxTileCacheSize: null, localIdeographFontFamily: "sans-serif", transformRequest: null, accessToken: null, fadeDuration: 300, crossSourceCollisions: !0 }, Go = function (o) { function r(e) { var r = this; if (null != (e = t.extend({}, Vo, e)).minZoom && null != e.maxZoom && e.minZoom > e.maxZoom) throw new Error("maxZoom must be greater than or equal to minZoom"); if (null != e.minPitch && null != e.maxPitch && e.minPitch > e.maxPitch) throw new Error("maxPitch must be greater than or equal to minPitch"); if (null != e.minPitch && e.minPitch < qo) throw new Error("minPitch must be greater than or equal to " + qo); if (null != e.maxPitch && e.maxPitch > jo) throw new Error("maxPitch must be less than or equal to " + jo); var a = new go(e.minZoom, e.maxZoom, e.minPitch, e.maxPitch, e.renderWorldCopies); if (o.call(this, a, e), this._interactive = e.interactive, this._maxTileCacheSize = e.maxTileCacheSize, this._failIfMajorPerformanceCaveat = e.failIfMajorPerformanceCaveat, this._preserveDrawingBuffer = e.preserveDrawingBuffer, this._antialias = e.antialias, this._trackResize = e.trackResize, this._bearingSnap = e.bearingSnap, this._refreshExpiredTiles = e.refreshExpiredTiles, this._fadeDuration = e.fadeDuration, this._crossSourceCollisions = e.crossSourceCollisions, this._crossFadingFactor = 1, this._collectResourceTiming = e.collectResourceTiming, this._renderTaskQueue = new Fo, this._controls = [], this._mapId = t.uniqueId(), this._locale = t.extend({}, Uo, e.locale), this._requestManager = new t.RequestManager(e.transformRequest, e.accessToken), "string" == typeof e.container) { if (this._container = t.window.document.getElementById(e.container), !this._container) throw new Error("Container '" + e.container + "' not found.") } else { if (!(e.container instanceof Zo)) throw new Error("Invalid type: 'container' must be a String or HTMLElement."); this._container = e.container; } if (e.maxBounds && this.setMaxBounds(e.maxBounds), t.bindAll(["_onWindowOnline", "_onWindowResize", "_contextLost", "_contextRestored"], this), this._setupContainer(), this._setupPainter(), void 0 === this.painter) throw new Error("Failed to initialize WebGL."); this.on("move", (function () { return r._update(!1) })), this.on("moveend", (function () { return r._update(!1) })), this.on("zoom", (function () { return r._update(!0) })), void 0 !== t.window && (t.window.addEventListener("online", this._onWindowOnline, !1), t.window.addEventListener("resize", this._onWindowResize, !1)), function (t, e) { var o = t.getCanvasContainer(), r = null, a = !1, n = null; for (var s in Ro) t[s] = new Ro[s](t, e), e.interactive && e[s] && t[s].enable(e[s]); i.addEventListener(o, "mouseout", (function (e) { t.fire(new xo("mouseout", t, e)); })), i.addEventListener(o, "mousedown", (function (r) { a = !0, n = i.mousePos(o, r); var s = new xo("mousedown", t, r); if (t.fire(s), s.defaultPrevented) return; e.interactive && !t.doubleClickZoom.isActive() && t.stop(); t.boxZoom.onMouseDown(r), t.boxZoom.isActive() || t.dragPan.isActive() || t.dragRotate.onMouseDown(r); t.boxZoom.isActive() || t.dragRotate.isActive() || t.dragPan.onMouseDown(r); })), i.addEventListener(o, "mouseup", (function (e) { var i = t.dragRotate.isActive(); r && !i && t.fire(new xo("contextmenu", t, r)); r = null, a = !1, t.fire(new xo("mouseup", t, e)); })), i.addEventListener(o, "mousemove", (function (e) { if (t.dragPan.isActive()) return; if (t.dragRotate.isActive()) return; var i = e.target; for (; i && i !== o;)i = i.parentNode; if (i !== o) return; t.fire(new xo("mousemove", t, e)); })), i.addEventListener(o, "mouseover", (function (e) { var i = e.target; for (; i && i !== o;)i = i.parentNode; if (i !== o) return; t.fire(new xo("mouseover", t, e)); })), i.addEventListener(o, "touchstart", (function (i) { var o = new bo("touchstart", t, i); if (t.fire(o), o.defaultPrevented) return; e.interactive && t.stop(); t.boxZoom.isActive() || t.dragRotate.isActive() || t.dragPan.onTouchStart(i); t.touchZoomRotate.onStart(i), t.doubleClickZoom.onTouchStart(o); }), { passive: !1 }), i.addEventListener(o, "touchmove", (function (e) { t.fire(new bo("touchmove", t, e)); }), { passive: !1 }), i.addEventListener(o, "touchend", (function (e) { t.fire(new bo("touchend", t, e)); })), i.addEventListener(o, "touchcancel", (function (e) { t.fire(new bo("touchcancel", t, e)); })), i.addEventListener(o, "click", (function (r) { var a = i.mousePos(o, r); (!n || a.equals(n) || a.dist(n) < e.clickTolerance) && t.fire(new xo("click", t, r)); })), i.addEventListener(o, "dblclick", (function (e) { var i = new xo("dblclick", t, e); if (t.fire(i), i.defaultPrevented) return; t.doubleClickZoom.onDblClick(i); })), i.addEventListener(o, "contextmenu", (function (e) { var i = t.dragRotate.isActive(); a || i ? a && (r = e) : t.fire(new xo("contextmenu", t, e)); (t.dragRotate.isEnabled() || t.listens("contextmenu")) && e.preventDefault(); })), i.addEventListener(o, "wheel", (function (i) { e.interactive && t.stop(); var o = new wo("wheel", t, i); if (t.fire(o), o.defaultPrevented) return; t.scrollZoom.onWheel(i); }), { passive: !1 }); }(this, e); var n = "string" == typeof e.hash && e.hash || void 0; this._hash = e.hash && new yo(n).addTo(this), this._hash && this._hash._onHashChange() || (this.jumpTo({ center: e.center, zoom: e.zoom, bearing: e.bearing, pitch: e.pitch }), e.bounds && (this.resize(), this.fitBounds(e.bounds, t.extend({}, e.fitBoundsOptions, { duration: 0 })))), this.resize(), this._localIdeographFontFamily = e.localIdeographFontFamily, e.style && this.setStyle(e.style, { localIdeographFontFamily: e.localIdeographFontFamily }), e.attributionControl && this.addControl(new Bo({ customAttribution: e.customAttribution })), this.addControl(new Oo, e.logoPosition), this.on("style.load", (function () { r.transform.unmodified && r.jumpTo(r.style.stylesheet); })), this.on("data", (function (e) { r._update("style" === e.dataType), r.fire(new t.Event(e.dataType + "data", e)); })), this.on("dataloading", (function (e) { r.fire(new t.Event(e.dataType + "dataloading", e)); })); } o && (r.__proto__ = o), r.prototype = Object.create(o && o.prototype), r.prototype.constructor = r; var a = { showTileBoundaries: { configurable: !0 }, showCollisionBoxes: { configurable: !0 }, showOverdrawInspector: { configurable: !0 }, repaint: { configurable: !0 }, vertices: { configurable: !0 }, version: { configurable: !0 } }; return r.prototype._getMapId = function () { return this._mapId }, r.prototype.addControl = function (e, i) { if (void 0 === i && e.getDefaultPosition && (i = e.getDefaultPosition()), void 0 === i && (i = "top-right"), !e || !e.onAdd) return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods."))); var o = e.onAdd(this); this._controls.push(e); var r = this._controlPositions[i]; return -1 !== i.indexOf("bottom") ? r.insertBefore(o, r.firstChild) : r.appendChild(o), this }, r.prototype.removeControl = function (e) { if (!e || !e.onRemove) return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods."))); var i = this._controls.indexOf(e); return i > -1 && this._controls.splice(i, 1), e.onRemove(this), this }, r.prototype.resize = function (e) { var i = this._containerDimensions(), o = i[0], r = i[1]; return this._resizeCanvas(o, r), this.transform.resize(o, r), this.painter.resize(o, r), this.fire(new t.Event("movestart", e)).fire(new t.Event("move", e)).fire(new t.Event("resize", e)).fire(new t.Event("moveend", e)), this }, r.prototype.getBounds = function () { return this.transform.getBounds() }, r.prototype.getMaxBounds = function () { return this.transform.getMaxBounds() }, r.prototype.setMaxBounds = function (e) { return this.transform.setMaxBounds(t.LngLatBounds.convert(e)), this._update() }, r.prototype.setMinZoom = function (t) { if ((t = null == t ? -2 : t) >= -2 && t <= this.transform.maxZoom) return this.transform.minZoom = t, this._update(), this.getZoom() < t && this.setZoom(t), this; throw new Error("minZoom must be between -2 and the current maxZoom, inclusive") }, r.prototype.getMinZoom = function () { return this.transform.minZoom }, r.prototype.setMaxZoom = function (t) { if ((t = null == t ? 22 : t) >= this.transform.minZoom) return this.transform.maxZoom = t, this._update(), this.getZoom() > t && this.setZoom(t), this; throw new Error("maxZoom must be greater than the current minZoom") }, r.prototype.getMaxZoom = function () { return this.transform.maxZoom }, r.prototype.setMinPitch = function (t) { if ((t = null == t ? qo : t) < qo) throw new Error("minPitch must be greater than or equal to " + qo); if (t >= qo && t <= this.transform.maxPitch) return this.transform.minPitch = t, this._update(), this.getPitch() < t && this.setPitch(t), this; throw new Error("minPitch must be between " + qo + " and the current maxPitch, inclusive") }, r.prototype.getMinPitch = function () { return this.transform.minPitch }, r.prototype.setMaxPitch = function (t) { if ((t = null == t ? jo : t) > jo) throw new Error("maxPitch must be less than or equal to " + jo); if (t >= this.transform.minPitch) return this.transform.maxPitch = t, this._update(), this.getPitch() > t && this.setPitch(t), this; throw new Error("maxPitch must be greater than the current minPitch") }, r.prototype.getMaxPitch = function () { return this.transform.maxPitch }, r.prototype.getRenderWorldCopies = function () { return this.transform.renderWorldCopies }, r.prototype.setRenderWorldCopies = function (t) { return this.transform.renderWorldCopies = t, this._update() }, r.prototype.project = function (e) { return this.transform.locationPoint(t.LngLat.convert(e)) }, r.prototype.unproject = function (e) { return this.transform.pointLocation(t.Point.convert(e)) }, r.prototype.isMoving = function () { return this._moving || this.dragPan.isActive() || this.dragRotate.isActive() || this.scrollZoom.isActive() }, r.prototype.isZooming = function () { return this._zooming || this.scrollZoom.isZooming() }, r.prototype.isRotating = function () { return this._rotating || this.dragRotate.isActive() }, r.prototype.on = function (t, e, i) { var r = this; if (void 0 === i) return o.prototype.on.call(this, t, e); var a = function () { var o; if ("mouseenter" === t || "mouseover" === t) { var a = !1; return { layer: e, listener: i, delegates: { mousemove: function (o) { var n = r.getLayer(e) ? r.queryRenderedFeatures(o.point, { layers: [e] }) : []; n.length ? a || (a = !0, i.call(r, new xo(t, r, o.originalEvent, { features: n }))) : a = !1; }, mouseout: function () { a = !1; } } } } if ("mouseleave" === t || "mouseout" === t) { var n = !1; return { layer: e, listener: i, delegates: { mousemove: function (o) { (r.getLayer(e) ? r.queryRenderedFeatures(o.point, { layers: [e] }) : []).length ? n = !0 : n && (n = !1, i.call(r, new xo(t, r, o.originalEvent))); }, mouseout: function (e) { n && (n = !1, i.call(r, new xo(t, r, e.originalEvent))); } } } } return { layer: e, listener: i, delegates: (o = {}, o[t] = function (t) { var o = r.getLayer(e) ? r.queryRenderedFeatures(t.point, { layers: [e] }) : []; o.length && (t.features = o, i.call(r, t), delete t.features); }, o) } }(); for (var n in this._delegatedListeners = this._delegatedListeners || {}, this._delegatedListeners[t] = this._delegatedListeners[t] || [], this._delegatedListeners[t].push(a), a.delegates) this.on(n, a.delegates[n]); return this }, r.prototype.off = function (t, e, i) { if (void 0 === i) return o.prototype.off.call(this, t, e); if (this._delegatedListeners && this._delegatedListeners[t]) for (var r = this._delegatedListeners[t], a = 0; a < r.length; a++) { var n = r[a]; if (n.layer === e && n.listener === i) { for (var s in n.delegates) this.off(s, n.delegates[s]); return r.splice(a, 1), this } } return this }, r.prototype.queryRenderedFeatures = function (e, i) { if (!this.style) return []; var o; if (void 0 !== i || void 0 === e || e instanceof t.Point || Array.isArray(e) || (i = e, e = void 0), i = i || {}, (e = e || [[0, 0], [this.transform.width, this.transform.height]]) instanceof t.Point || "number" == typeof e[0]) o = [t.Point.convert(e)]; else { var r = t.Point.convert(e[0]), a = t.Point.convert(e[1]); o = [r, new t.Point(a.x, r.y), a, new t.Point(r.x, a.y), r]; } return this.style.queryRenderedFeatures(o, i, this.transform) }, r.prototype.querySourceFeatures = function (t, e) { return this.style.querySourceFeatures(t, e) }, r.prototype.setStyle = function (e, i) { return !1 !== (i = t.extend({}, { localIdeographFontFamily: this._localIdeographFontFamily }, i)).diff && i.localIdeographFontFamily === this._localIdeographFontFamily && this.style && e ? (this._diffStyle(e, i), this) : (this._localIdeographFontFamily = i.localIdeographFontFamily, this._updateStyle(e, i)) }, r.prototype._getUIString = function (t) { var e = this._locale[t]; if (null == e) throw new Error("Missing UI string '" + t + "'"); return e }, r.prototype._updateStyle = function (t, e) { return this.style && (this.style.setEventedParent(null), this.style._remove()), t ? (this.style = new Ue(this, e || {}), this.style.setEventedParent(this, { style: this.style }), "string" == typeof t ? this.style.loadURL(t) : this.style.loadJSON(t), this) : (delete this.style, this) }, r.prototype._diffStyle = function (e, i) { var o = this; if ("string" == typeof e) { var r = this._requestManager.normalizeStyleURL(e), a = this._requestManager.transformRequest(r, t.ResourceType.Style); t.getJSON(a, (function (e, r) { e ? o.fire(new t.ErrorEvent(e)) : r && o._updateDiff(r, i); })); } else "object" == typeof e && this._updateDiff(e, i); }, r.prototype._updateDiff = function (e, i) { try { this.style.setState(e) && this._update(!0); } catch (o) { t.warnOnce("Unable to perform style diff: " + (o.message || o.error || o) + ". Rebuilding the style from scratch."), this._updateStyle(e, i); } }, r.prototype.getStyle = function () { if (this.style) return this.style.serialize() }, r.prototype.isStyleLoaded = function () { return this.style ? this.style.loaded() : t.warnOnce("There is no style added to the map.") }, r.prototype.addSource = function (t, e) { return this.style.addSource(t, e), this._update(!0) }, r.prototype.isSourceLoaded = function (e) { var i = this.style && this.style.sourceCaches[e]; if (void 0 !== i) return i.loaded(); this.fire(new t.ErrorEvent(new Error("There is no source with ID '" + e + "'"))); }, r.prototype.areTilesLoaded = function () { var t = this.style && this.style.sourceCaches; for (var e in t) { var i = t[e]._tiles; for (var o in i) { var r = i[o]; if ("loaded" !== r.state && "errored" !== r.state) return !1 } } return !0 }, r.prototype.addSourceType = function (t, e, i) { return this.style.addSourceType(t, e, i) }, r.prototype.removeSource = function (t) { return this.style.removeSource(t), this._update(!0) }, r.prototype.getSource = function (t) { return this.style.getSource(t) }, r.prototype.addImage = function (e, i, o) { void 0 === o && (o = {}); var r = o.pixelRatio; void 0 === r && (r = 1); var a = o.sdf; void 0 === a && (a = !1); var n = o.stretchX, s = o.stretchY, l = o.content; if (i instanceof No) { var c = t.browser.getImageData(i), u = c.width, h = c.height, p = c.data; this.style.addImage(e, { data: new t.RGBAImage({ width: u, height: h }, p), pixelRatio: r, stretchX: n, stretchY: s, content: l, sdf: a, version: 0 }); } else { if (void 0 === i.width || void 0 === i.height) return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))); var d = i.width, _ = i.height, f = i.data, m = i; this.style.addImage(e, { data: new t.RGBAImage({ width: d, height: _ }, new Uint8Array(f)), pixelRatio: r, stretchX: n, stretchY: s, content: l, sdf: a, version: 0, userImage: m }), m.onAdd && m.onAdd(this, e); } }, r.prototype.updateImage = function (e, i) { var o = this.style.getImage(e); if (!o) return this.fire(new t.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead."))); var r = i instanceof No ? t.browser.getImageData(i) : i, a = r.width, n = r.height, s = r.data; if (void 0 === a || void 0 === n) return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))); if (a !== o.data.width || n !== o.data.height) return this.fire(new t.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))); var l = !(i instanceof No); o.data.replace(s, l), this.style.updateImage(e, o); }, r.prototype.hasImage = function (e) { return e ? !!this.style.getImage(e) : (this.fire(new t.ErrorEvent(new Error("Missing required image id"))), !1) }, r.prototype.removeImage = function (t) { this.style.removeImage(t); }, r.prototype.loadImage = function (e, i) { t.getImage(this._requestManager.transformRequest(e, t.ResourceType.Image), i); }, r.prototype.listImages = function () { return this.style.listImages() }, r.prototype.addLayer = function (t, e) { return this.style.addLayer(t, e), this._update(!0) }, r.prototype.moveLayer = function (t, e) { return this.style.moveLayer(t, e), this._update(!0) }, r.prototype.removeLayer = function (t) { return this.style.removeLayer(t), this._update(!0) }, r.prototype.getLayer = function (t) { return this.style.getLayer(t) }, r.prototype.setLayerZoomRange = function (t, e, i) { return this.style.setLayerZoomRange(t, e, i), this._update(!0) }, r.prototype.setFilter = function (t, e, i) { return void 0 === i && (i = {}), this.style.setFilter(t, e, i), this._update(!0) }, r.prototype.getFilter = function (t) { return this.style.getFilter(t) }, r.prototype.setPaintProperty = function (t, e, i, o) { return void 0 === o && (o = {}), this.style.setPaintProperty(t, e, i, o), this._update(!0) }, r.prototype.getPaintProperty = function (t, e) { return this.style.getPaintProperty(t, e) }, r.prototype.setLayoutProperty = function (t, e, i, o) { return void 0 === o && (o = {}), this.style.setLayoutProperty(t, e, i, o), this._update(!0) }, r.prototype.getLayoutProperty = function (t, e) { return this.style.getLayoutProperty(t, e) }, r.prototype.setLight = function (t, e) { return void 0 === e && (e = {}), this.style.setLight(t, e), this._update(!0) }, r.prototype.getLight = function () { return this.style.getLight() }, r.prototype.setFeatureState = function (t, e) { return this.style.setFeatureState(t, e), this._update() }, r.prototype.removeFeatureState = function (t, e) { return this.style.removeFeatureState(t, e), this._update() }, r.prototype.getFeatureState = function (t) { return this.style.getFeatureState(t) }, r.prototype.getContainer = function () { return this._container }, r.prototype.getCanvasContainer = function () { return this._canvasContainer }, r.prototype.getCanvas = function () { return this._canvas }, r.prototype._containerDimensions = function () { var t = 0, e = 0; return this._container && (t = this._container.clientWidth || 400, e = this._container.clientHeight || 300), [t, e] }, r.prototype._detectMissingCSS = function () { "rgb(250, 128, 114)" !== t.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color") && t.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/."); }, r.prototype._setupContainer = function () { var t = this._container; t.classList.add("mapboxgl-map"), (this._missingCSSCanary = i.create("div", "mapboxgl-canary", t)).style.visibility = "hidden", this._detectMissingCSS(); var e = this._canvasContainer = i.create("div", "mapboxgl-canvas-container", t); this._interactive && e.classList.add("mapboxgl-interactive"), this._canvas = i.create("canvas", "mapboxgl-canvas", e), this._canvas.style.position = "absolute", this._canvas.addEventListener("webglcontextlost", this._contextLost, !1), this._canvas.addEventListener("webglcontextrestored", this._contextRestored, !1), this._canvas.setAttribute("tabindex", "0"), this._canvas.setAttribute("aria-label", "Map"); var o = this._containerDimensions(); this._resizeCanvas(o[0], o[1]); var r = this._controlContainer = i.create("div", "mapboxgl-control-container", t), a = this._controlPositions = {};["top-left", "top-right", "bottom-left", "bottom-right"].forEach((function (t) { a[t] = i.create("div", "mapboxgl-ctrl-" + t, r); })); }, r.prototype._resizeCanvas = function (e, i) { var o = t.window.devicePixelRatio || 1; this._canvas.width = o * e, this._canvas.height = o * i, this._canvas.style.width = e + "px", this._canvas.style.height = i + "px"; }, r.prototype._setupPainter = function () { var i = t.extend({}, e.webGLContextAttributes, { failIfMajorPerformanceCaveat: this._failIfMajorPerformanceCaveat, preserveDrawingBuffer: this._preserveDrawingBuffer, antialias: this._antialias || !1 }), o = this._canvas.getContext("webgl", i) || this._canvas.getContext("experimental-webgl", i); o ? (this.painter = new po(o, this.transform), t.webpSupported.testSupport(o)) : this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL"))); }, r.prototype._contextLost = function (e) { e.preventDefault(), this._frame && (this._frame.cancel(), this._frame = null), this.fire(new t.Event("webglcontextlost", { originalEvent: e })); }, r.prototype._contextRestored = function (e) { this._setupPainter(), this.resize(), this._update(), this.fire(new t.Event("webglcontextrestored", { originalEvent: e })); }, r.prototype.loaded = function () { return !this._styleDirty && !this._sourcesDirty && !!this.style && this.style.loaded() }, r.prototype._update = function (t) { return this.style ? (this._styleDirty = this._styleDirty || t, this._sourcesDirty = !0, this.triggerRepaint(), this) : this }, r.prototype._requestRenderFrame = function (t) { return this._update(), this._renderTaskQueue.add(t) }, r.prototype._cancelRenderFrame = function (t) { this._renderTaskQueue.remove(t); }, r.prototype._render = function () { var e, i = this, o = 0, r = this.painter.context.extTimerQuery; this.listens("gpu-timing-frame") && (e = r.createQueryEXT(), r.beginQueryEXT(r.TIME_ELAPSED_EXT, e), o = t.browser.now()), this.painter.context.setDirty(), this.painter.setBaseState(), this._renderTaskQueue.run(); var a = !1; if (this.style && this._styleDirty) { this._styleDirty = !1; var n = this.transform.zoom, s = t.browser.now(); this.style.zoomHistory.update(n, s); var l = new t.EvaluationParameters(n, { now: s, fadeDuration: this._fadeDuration, zoomHistory: this.style.zoomHistory, transition: this.style.getTransition() }), c = l.crossFadingFactor(); 1 === c && c === this._crossFadingFactor || (a = !0, this._crossFadingFactor = c), this.style.update(l); } if (this.style && this._sourcesDirty && (this._sourcesDirty = !1, this.style._updateSources(this.transform)), this._placementDirty = this.style && this.style._updatePlacement(this.painter.transform, this.showCollisionBoxes, this._fadeDuration, this._crossSourceCollisions), this.painter.render(this.style, { showTileBoundaries: this.showTileBoundaries, showOverdrawInspector: this._showOverdrawInspector, rotating: this.isRotating(), zooming: this.isZooming(), moving: this.isMoving(), gpuTiming: !!this.listens("gpu-timing-layer"), fadeDuration: this._fadeDuration }), this.fire(new t.Event("render")), this.loaded() && !this._loaded && (this._loaded = !0, this.fire(new t.Event("load"))), this.style && (this.style.hasTransitions() || a) && (this._styleDirty = !0), this.style && !this._placementDirty && this.style._releaseSymbolFadeTiles(), this.listens("gpu-timing-frame")) { var u = t.browser.now() - o; r.endQueryEXT(r.TIME_ELAPSED_EXT, e), setTimeout((function () { var o = r.getQueryObjectEXT(e, r.QUERY_RESULT_EXT) / 1e6; r.deleteQueryEXT(e), i.fire(new t.Event("gpu-timing-frame", { cpuTime: u, gpuTime: o })); }), 50); } if (this.listens("gpu-timing-layer")) { var h = this.painter.collectGpuTimers(); setTimeout((function () { var e = i.painter.queryGpuTimers(h); i.fire(new t.Event("gpu-timing-layer", { layerTimes: e })); }), 50); } return this._sourcesDirty || this._repaint || this._styleDirty || this._placementDirty ? this.triggerRepaint() : !this.isMoving() && this.loaded() && this.fire(new t.Event("idle")), this }, r.prototype.remove = function () { this._hash && this._hash.remove(); for (var e = 0, i = this._controls; e < i.length; e += 1) { i[e].onRemove(this); } this._controls = [], this._frame && (this._frame.cancel(), this._frame = null), this._renderTaskQueue.clear(), this.setStyle(null), void 0 !== t.window && (t.window.removeEventListener("resize", this._onWindowResize, !1), t.window.removeEventListener("online", this._onWindowOnline, !1)); var o = this.painter.context.gl.getExtension("WEBGL_lose_context"); o && o.loseContext(), Wo(this._canvasContainer), Wo(this._controlContainer), Wo(this._missingCSSCanary), this._container.classList.remove("mapboxgl-map"), this.fire(new t.Event("remove")); }, r.prototype.triggerRepaint = function () { var e = this; this.style && !this._frame && (this._frame = t.browser.frame((function () { e._frame = null, e._render(); }))); }, r.prototype._onWindowOnline = function () { this._update(); }, r.prototype._onWindowResize = function (t) { this._trackResize && this.resize({ originalEvent: t })._update(); }, a.showTileBoundaries.get = function () { return !!this._showTileBoundaries }, a.showTileBoundaries.set = function (t) { this._showTileBoundaries !== t && (this._showTileBoundaries = t, this._update()); }, a.showCollisionBoxes.get = function () { return !!this._showCollisionBoxes }, a.showCollisionBoxes.set = function (t) { this._showCollisionBoxes !== t && (this._showCollisionBoxes = t, t ? this.style._generateCollisionBoxes() : this._update()); }, a.showOverdrawInspector.get = function () { return !!this._showOverdrawInspector }, a.showOverdrawInspector.set = function (t) { this._showOverdrawInspector !== t && (this._showOverdrawInspector = t, this._update()); }, a.repaint.get = function () { return !!this._repaint }, a.repaint.set = function (t) { this._repaint !== t && (this._repaint = t, this.triggerRepaint()); }, a.vertices.get = function () { return !!this._vertices }, a.vertices.set = function (t) { this._vertices = t, this._update(); }, r.prototype._setCacheLimits = function (e, i) { t.setCacheLimits(e, i); }, a.version.get = function () { return t.version }, Object.defineProperties(r.prototype, a), r }(ko); function Wo(t) { t.parentNode && t.parentNode.removeChild(t); } var Xo = { showCompass: !0, showZoom: !0, visualizePitch: !1 }, Ho = function (e) { var o = this; this.options = t.extend({}, Xo, e), this._container = i.create("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._container.addEventListener("contextmenu", (function (t) { return t.preventDefault() })), this.options.showZoom && (t.bindAll(["_setButtonTitle", "_updateZoomButtons"], this), this._zoomInButton = this._createButton("mapboxgl-ctrl-zoom-in", (function (t) { return o._map.zoomIn({}, { originalEvent: t }) })), i.create("span", "mapboxgl-ctrl-icon", this._zoomInButton).setAttribute("aria-hidden", !0), this._zoomOutButton = this._createButton("mapboxgl-ctrl-zoom-out", (function (t) { return o._map.zoomOut({}, { originalEvent: t }) })), i.create("span", "mapboxgl-ctrl-icon", this._zoomOutButton).setAttribute("aria-hidden", !0)), this.options.showCompass && (t.bindAll(["_rotateCompassArrow"], this), this._compass = this._createButton("mapboxgl-ctrl-compass", (function (t) { o.options.visualizePitch ? o._map.resetNorthPitch({}, { originalEvent: t }) : o._map.resetNorth({}, { originalEvent: t }); })), this._compassIcon = i.create("span", "mapboxgl-ctrl-icon", this._compass), this._compassIcon.setAttribute("aria-hidden", !0)); }; function Ko(e, i, o) { if (e = new t.LngLat(e.lng, e.lat), i) { var r = new t.LngLat(e.lng - 360, e.lat), a = new t.LngLat(e.lng + 360, e.lat), n = o.locationPoint(e).distSqr(i); o.locationPoint(r).distSqr(i) < n ? e = r : o.locationPoint(a).distSqr(i) < n && (e = a); } for (; Math.abs(e.lng - o.center.lng) > 180;) { var s = o.locationPoint(e); if (s.x >= 0 && s.y >= 0 && s.x <= o.width && s.y <= o.height) break; e.lng > o.center.lng ? e.lng -= 360 : e.lng += 360; } return e } Ho.prototype._updateZoomButtons = function () { var t = this._map.getZoom(); this._zoomInButton.disabled = t === this._map.getMaxZoom(), this._zoomOutButton.disabled = t === this._map.getMinZoom(); }, Ho.prototype._rotateCompassArrow = function () { var t = this.options.visualizePitch ? "scale(" + 1 / Math.pow(Math.cos(this._map.transform.pitch * (Math.PI / 180)), .5) + ") rotateX(" + this._map.transform.pitch + "deg) rotateZ(" + this._map.transform.angle * (180 / Math.PI) + "deg)" : "rotate(" + this._map.transform.angle * (180 / Math.PI) + "deg)"; this._compassIcon.style.transform = t; }, Ho.prototype.onAdd = function (t) { return this._map = t, this.options.showZoom && (this._setButtonTitle(this._zoomInButton, "ZoomIn"), this._setButtonTitle(this._zoomOutButton, "ZoomOut"), this._map.on("zoom", this._updateZoomButtons), this._updateZoomButtons()), this.options.showCompass && (this._setButtonTitle(this._compass, "ResetBearing"), this.options.visualizePitch && this._map.on("pitch", this._rotateCompassArrow), this._map.on("rotate", this._rotateCompassArrow), this._rotateCompassArrow(), this._handler = new Co(t, { button: "left", element: this._compass }), i.addEventListener(this._compass, "mousedown", this._handler.onMouseDown), i.addEventListener(this._compass, "touchstart", this._handler.onMouseDown, { passive: !1 }), this._handler.enable()), this._container }, Ho.prototype.onRemove = function () { i.remove(this._container), this.options.showZoom && this._map.off("zoom", this._updateZoomButtons), this.options.showCompass && (this.options.visualizePitch && this._map.off("pitch", this._rotateCompassArrow), this._map.off("rotate", this._rotateCompassArrow), i.removeEventListener(this._compass, "mousedown", this._handler.onMouseDown), i.removeEventListener(this._compass, "touchstart", this._handler.onMouseDown, { passive: !1 }), this._handler.disable(), delete this._handler), delete this._map; }, Ho.prototype._createButton = function (t, e) { var o = i.create("button", t, this._container); return o.type = "button", o.addEventListener("click", e), o }, Ho.prototype._setButtonTitle = function (t, e) { var i = this._map._getUIString("NavigationControl." + e); t.title = i, t.setAttribute("aria-label", i); }; var Yo = { center: "translate(-50%,-50%)", top: "translate(-50%,0)", "top-left": "translate(0,0)", "top-right": "translate(-100%,0)", bottom: "translate(-50%,-100%)", "bottom-left": "translate(0,-100%)", "bottom-right": "translate(-100%,-100%)", left: "translate(0,-50%)", right: "translate(-100%,-50%)" }; function Jo(t, e, i) { var o = t.classList; for (var r in Yo) o.remove("mapboxgl-" + i + "-anchor-" + r); o.add("mapboxgl-" + i + "-anchor-" + e); } var Qo, $o = function (e) { function o(o, r) { var a = this; if (e.call(this), (o instanceof t.window.HTMLElement || r) && (o = t.extend({ element: o }, r)), t.bindAll(["_update", "_onMove", "_onUp", "_addDragHandler", "_onMapClick", "_onKeyPress"], this), this._anchor = o && o.anchor || "center", this._color = o && o.color || "#3FB1CE", this._draggable = o && o.draggable || !1, this._state = "inactive", this._rotation = o && o.rotation || 0, this._rotationAlignment = o && o.rotationAlignment || "auto", this._pitchAlignment = o && o.pitchAlignment && "auto" !== o.pitchAlignment ? o.pitchAlignment : this._rotationAlignment, o && o.element) this._element = o.element, this._offset = t.Point.convert(o && o.offset || [0, 0]); else { this._defaultMarker = !0, this._element = i.create("div"), this._element.setAttribute("aria-label", "Map marker"); var n = i.createNS("http://www.w3.org/2000/svg", "svg"); n.setAttributeNS(null, "display", "block"), n.setAttributeNS(null, "height", "41px"), n.setAttributeNS(null, "width", "27px"), n.setAttributeNS(null, "viewBox", "0 0 27 41"); var s = i.createNS("http://www.w3.org/2000/svg", "g"); s.setAttributeNS(null, "stroke", "none"), s.setAttributeNS(null, "stroke-width", "1"), s.setAttributeNS(null, "fill", "none"), s.setAttributeNS(null, "fill-rule", "evenodd"); var l = i.createNS("http://www.w3.org/2000/svg", "g"); l.setAttributeNS(null, "fill-rule", "nonzero"); var c = i.createNS("http://www.w3.org/2000/svg", "g"); c.setAttributeNS(null, "transform", "translate(3.0, 29.0)"), c.setAttributeNS(null, "fill", "#000000"); for (var u = 0, h = [{ rx: "10.5", ry: "5.25002273" }, { rx: "10.5", ry: "5.25002273" }, { rx: "9.5", ry: "4.77275007" }, { rx: "8.5", ry: "4.29549936" }, { rx: "7.5", ry: "3.81822308" }, { rx: "6.5", ry: "3.34094679" }, { rx: "5.5", ry: "2.86367051" }, { rx: "4.5", ry: "2.38636864" }]; u < h.length; u += 1) { var p = h[u], d = i.createNS("http://www.w3.org/2000/svg", "ellipse"); d.setAttributeNS(null, "opacity", "0.04"), d.setAttributeNS(null, "cx", "10.5"), d.setAttributeNS(null, "cy", "5.80029008"), d.setAttributeNS(null, "rx", p.rx), d.setAttributeNS(null, "ry", p.ry), c.appendChild(d); } var _ = i.createNS("http://www.w3.org/2000/svg", "g"); _.setAttributeNS(null, "fill", this._color); var f = i.createNS("http://www.w3.org/2000/svg", "path"); f.setAttributeNS(null, "d", "M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"), _.appendChild(f); var m = i.createNS("http://www.w3.org/2000/svg", "g"); m.setAttributeNS(null, "opacity", "0.25"), m.setAttributeNS(null, "fill", "#000000"); var g = i.createNS("http://www.w3.org/2000/svg", "path"); g.setAttributeNS(null, "d", "M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"), m.appendChild(g); var v = i.createNS("http://www.w3.org/2000/svg", "g"); v.setAttributeNS(null, "transform", "translate(6.0, 7.0)"), v.setAttributeNS(null, "fill", "#FFFFFF"); var y = i.createNS("http://www.w3.org/2000/svg", "g"); y.setAttributeNS(null, "transform", "translate(8.0, 8.0)"); var x = i.createNS("http://www.w3.org/2000/svg", "circle"); x.setAttributeNS(null, "fill", "#000000"), x.setAttributeNS(null, "opacity", "0.25"), x.setAttributeNS(null, "cx", "5.5"), x.setAttributeNS(null, "cy", "5.5"), x.setAttributeNS(null, "r", "5.4999962"); var b = i.createNS("http://www.w3.org/2000/svg", "circle"); b.setAttributeNS(null, "fill", "#FFFFFF"), b.setAttributeNS(null, "cx", "5.5"), b.setAttributeNS(null, "cy", "5.5"), b.setAttributeNS(null, "r", "5.4999962"), y.appendChild(x), y.appendChild(b), l.appendChild(c), l.appendChild(_), l.appendChild(m), l.appendChild(v), l.appendChild(y), n.appendChild(l), this._element.appendChild(n), this._offset = t.Point.convert(o && o.offset || [0, -14]); } this._element.classList.add("mapboxgl-marker"), this._element.addEventListener("dragstart", (function (t) { t.preventDefault(); })), this._element.addEventListener("mousedown", (function (t) { t.preventDefault(); })), this._element.addEventListener("focus", (function () { var t = a._map.getContainer(); t.scrollTop = 0, t.scrollLeft = 0; })), Jo(this._element, this._anchor, "marker"), this._popup = null; } return e && (o.__proto__ = e), o.prototype = Object.create(e && e.prototype), o.prototype.constructor = o, o.prototype.addTo = function (t) { return this.remove(), this._map = t, t.getCanvasContainer().appendChild(this._element), t.on("move", this._update), t.on("moveend", this._update), this.setDraggable(this._draggable), this._update(), this._map.on("click", this._onMapClick), this }, o.prototype.remove = function () { return this._map && (this._map.off("click", this._onMapClick), this._map.off("move", this._update), this._map.off("moveend", this._update), this._map.off("mousedown", this._addDragHandler), this._map.off("touchstart", this._addDragHandler), this._map.off("mouseup", this._onUp), this._map.off("touchend", this._onUp), this._map.off("mousemove", this._onMove), this._map.off("touchmove", this._onMove), delete this._map), i.remove(this._element), this._popup && this._popup.remove(), this }, o.prototype.getLngLat = function () { return this._lngLat }, o.prototype.setLngLat = function (e) { return this._lngLat = t.LngLat.convert(e), this._pos = null, this._popup && this._popup.setLngLat(this._lngLat), this._update(), this }, o.prototype.getElement = function () { return this._element }, o.prototype.setPopup = function (t) { if (this._popup && (this._popup.remove(), this._popup = null, this._element.removeEventListener("keypress", this._onKeyPress), this._originalTabIndex || this._element.removeAttribute("tabindex")), t) { if (!("offset" in t.options)) { var e = Math.sqrt(Math.pow(13.5, 2) / 2); t.options.offset = this._defaultMarker ? { top: [0, 0], "top-left": [0, 0], "top-right": [0, 0], bottom: [0, -38.1], "bottom-left": [e, -1 * (24.6 + e)], "bottom-right": [-e, -1 * (24.6 + e)], left: [13.5, -24.6], right: [-13.5, -24.6] } : this._offset; } this._popup = t, this._lngLat && this._popup.setLngLat(this._lngLat), this._originalTabIndex = this._element.getAttribute("tabindex"), this._originalTabIndex || this._element.setAttribute("tabindex", "0"), this._element.addEventListener("keypress", this._onKeyPress); } return this }, o.prototype._onKeyPress = function (t) { var e = t.code, i = t.charCode || t.keyCode; "Space" !== e && "Enter" !== e && 32 !== i && 13 !== i || this.togglePopup(); }, o.prototype._onMapClick = function (t) { var e = t.originalEvent.target, i = this._element; this._popup && (e === i || i.contains(e)) && this.togglePopup(); }, o.prototype.getPopup = function () { return this._popup }, o.prototype.togglePopup = function () { var t = this._popup; return t ? (t.isOpen() ? t.remove() : t.addTo(this._map), this) : this }, o.prototype._update = function (t) { if (this._map) { this._map.transform.renderWorldCopies && (this._lngLat = Ko(this._lngLat, this._pos, this._map.transform)), this._pos = this._map.project(this._lngLat)._add(this._offset); var e = ""; "viewport" === this._rotationAlignment || "auto" === this._rotationAlignment ? e = "rotateZ(" + this._rotation + "deg)" : "map" === this._rotationAlignment && (e = "rotateZ(" + (this._rotation - this._map.getBearing()) + "deg)"); var o = ""; "viewport" === this._pitchAlignment || "auto" === this._pitchAlignment ? o = "rotateX(0deg)" : "map" === this._pitchAlignment && (o = "rotateX(" + this._map.getPitch() + "deg)"), t && "moveend" !== t.type || (this._pos = this._pos.round()), i.setTransform(this._element, Yo[this._anchor] + " translate(" + this._pos.x + "px, " + this._pos.y + "px) " + o + " " + e); } }, o.prototype.getOffset = function () { return this._offset }, o.prototype.setOffset = function (e) { return this._offset = t.Point.convert(e), this._update(), this }, o.prototype._onMove = function (e) { this._pos = e.point.sub(this._positionDelta), this._lngLat = this._map.unproject(this._pos), this.setLngLat(this._lngLat), this._element.style.pointerEvents = "none", "pending" === this._state && (this._state = "active", this.fire(new t.Event("dragstart"))), this.fire(new t.Event("drag")); }, o.prototype._onUp = function () { this._element.style.pointerEvents = "auto", this._positionDelta = null, this._map.off("mousemove", this._onMove), this._map.off("touchmove", this._onMove), "active" === this._state && this.fire(new t.Event("dragend")), this._state = "inactive"; }, o.prototype._addDragHandler = function (t) { this._element.contains(t.originalEvent.target) && (t.preventDefault(), this._positionDelta = t.point.sub(this._pos).add(this._offset), this._state = "pending", this._map.on("mousemove", this._onMove), this._map.on("touchmove", this._onMove), this._map.once("mouseup", this._onUp), this._map.once("touchend", this._onUp)); }, o.prototype.setDraggable = function (t) { return this._draggable = !!t, this._map && (t ? (this._map.on("mousedown", this._addDragHandler), this._map.on("touchstart", this._addDragHandler)) : (this._map.off("mousedown", this._addDragHandler), this._map.off("touchstart", this._addDragHandler))), this }, o.prototype.isDraggable = function () { return this._draggable }, o.prototype.setRotation = function (t) { return this._rotation = t || 0, this._update(), this }, o.prototype.getRotation = function () { return this._rotation }, o.prototype.setRotationAlignment = function (t) { return this._rotationAlignment = t || "auto", this._update(), this }, o.prototype.getRotationAlignment = function () { return this._rotationAlignment }, o.prototype.setPitchAlignment = function (t) { return this._pitchAlignment = t && "auto" !== t ? t : this._rotationAlignment, this._update(), this }, o.prototype.getPitchAlignment = function () { return this._pitchAlignment }, o }(t.Evented), tr = { positionOptions: { enableHighAccuracy: !1, maximumAge: 0, timeout: 6e3 }, fitBoundsOptions: { maxZoom: 15 }, trackUserLocation: !1, showUserLocation: !0 }; var er = function (e) { function o(i) { e.call(this), this.options = t.extend({}, tr, i), t.bindAll(["_onSuccess", "_onError", "_finish", "_setupUI", "_updateCamera", "_updateMarker"], this); } return e && (o.__proto__ = e), o.prototype = Object.create(e && e.prototype), o.prototype.constructor = o, o.prototype.onAdd = function (e) { var o; return this._map = e, this._container = i.create("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), o = this._setupUI, void 0 !== Qo ? o(Qo) : void 0 !== t.window.navigator.permissions ? t.window.navigator.permissions.query({ name: "geolocation" }).then((function (t) { Qo = "denied" !== t.state, o(Qo); })) : (Qo = !!t.window.navigator.geolocation, o(Qo)), this._container }, o.prototype.onRemove = function () { void 0 !== this._geolocationWatchID && (t.window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0), this.options.showUserLocation && this._userLocationDotMarker && this._userLocationDotMarker.remove(), i.remove(this._container), this._map = void 0; }, o.prototype._isOutOfMapMaxBounds = function (t) { var e = this._map.getMaxBounds(), i = t.coords; return e && (i.longitude < e.getWest() || i.longitude > e.getEast() || i.latitude < e.getSouth() || i.latitude > e.getNorth()) }, o.prototype._setErrorState = function () { switch (this._watchState) { case "WAITING_ACTIVE": this._watchState = "ACTIVE_ERROR", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"); break; case "ACTIVE_LOCK": this._watchState = "ACTIVE_ERROR", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"); break; case "BACKGROUND": this._watchState = "BACKGROUND_ERROR", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"); } }, o.prototype._onSuccess = function (e) { if (this._isOutOfMapMaxBounds(e)) return this._setErrorState(), this.fire(new t.Event("outofmaxbounds", e)), this._updateMarker(), void this._finish(); if (this.options.trackUserLocation) switch (this._lastKnownPosition = e, this._watchState) { case "WAITING_ACTIVE": case "ACTIVE_LOCK": case "ACTIVE_ERROR": this._watchState = "ACTIVE_LOCK", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"); break; case "BACKGROUND": case "BACKGROUND_ERROR": this._watchState = "BACKGROUND", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"); }this.options.showUserLocation && "OFF" !== this._watchState && this._updateMarker(e), this.options.trackUserLocation && "ACTIVE_LOCK" !== this._watchState || this._updateCamera(e), this.options.showUserLocation && this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"), this.fire(new t.Event("geolocate", e)), this._finish(); }, o.prototype._updateCamera = function (e) { var i = new t.LngLat(e.coords.longitude, e.coords.latitude), o = e.coords.accuracy, r = this._map.getBearing(), a = t.extend({ bearing: r }, this.options.fitBoundsOptions); this._map.fitBounds(i.toBounds(o), a, { geolocateSource: !0 }); }, o.prototype._updateMarker = function (t) { t ? this._userLocationDotMarker.setLngLat([t.coords.longitude, t.coords.latitude]).addTo(this._map) : this._userLocationDotMarker.remove(); }, o.prototype._onError = function (e) { if (this.options.trackUserLocation) if (1 === e.code) { this._watchState = "OFF", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"), this._geolocateButton.disabled = !0; var i = this._map._getUIString("GeolocateControl.LocationNotAvailable"); this._geolocateButton.title = i, this._geolocateButton.setAttribute("aria-label", i), void 0 !== this._geolocationWatchID && this._clearWatch(); } else this._setErrorState(); "OFF" !== this._watchState && this.options.showUserLocation && this._dotElement.classList.add("mapboxgl-user-location-dot-stale"), this.fire(new t.Event("error", e)), this._finish(); }, o.prototype._finish = function () { this._timeoutId && clearTimeout(this._timeoutId), this._timeoutId = void 0; }, o.prototype._setupUI = function (e) { var o = this; if (this._container.addEventListener("contextmenu", (function (t) { return t.preventDefault() })), this._geolocateButton = i.create("button", "mapboxgl-ctrl-geolocate", this._container), i.create("span", "mapboxgl-ctrl-icon", this._geolocateButton).setAttribute("aria-hidden", !0), this._geolocateButton.type = "button", !1 === e) { t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled."); var r = this._map._getUIString("GeolocateControl.LocationNotAvailable"); this._geolocateButton.disabled = !0, this._geolocateButton.title = r, this._geolocateButton.setAttribute("aria-label", r); } else { var a = this._map._getUIString("GeolocateControl.FindMyLocation"); this._geolocateButton.title = a, this._geolocateButton.setAttribute("aria-label", a); } this.options.trackUserLocation && (this._geolocateButton.setAttribute("aria-pressed", "false"), this._watchState = "OFF"), this.options.showUserLocation && (this._dotElement = i.create("div", "mapboxgl-user-location-dot"), this._userLocationDotMarker = new $o(this._dotElement), this.options.trackUserLocation && (this._watchState = "OFF")), this._geolocateButton.addEventListener("click", this.trigger.bind(this)), this._setup = !0, this.options.trackUserLocation && this._map.on("movestart", (function (e) { var i = e.originalEvent && "resize" === e.originalEvent.type; e.geolocateSource || "ACTIVE_LOCK" !== o._watchState || i || (o._watchState = "BACKGROUND", o._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"), o._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), o.fire(new t.Event("trackuserlocationend"))); })); }, o.prototype.trigger = function () { if (!this._setup) return t.warnOnce("Geolocate control triggered before added to a map"), !1; if (this.options.trackUserLocation) { switch (this._watchState) { case "OFF": this._watchState = "WAITING_ACTIVE", this.fire(new t.Event("trackuserlocationstart")); break; case "WAITING_ACTIVE": case "ACTIVE_LOCK": case "ACTIVE_ERROR": case "BACKGROUND_ERROR": this._watchState = "OFF", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"), this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"), this.fire(new t.Event("trackuserlocationend")); break; case "BACKGROUND": this._watchState = "ACTIVE_LOCK", this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"), this._lastKnownPosition && this._updateCamera(this._lastKnownPosition), this.fire(new t.Event("trackuserlocationstart")); }switch (this._watchState) { case "WAITING_ACTIVE": this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"); break; case "ACTIVE_LOCK": this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"); break; case "ACTIVE_ERROR": this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"); break; case "BACKGROUND": this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"); break; case "BACKGROUND_ERROR": this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"); }"OFF" === this._watchState && void 0 !== this._geolocationWatchID ? this._clearWatch() : void 0 === this._geolocationWatchID && (this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "true"), this._geolocationWatchID = t.window.navigator.geolocation.watchPosition(this._onSuccess, this._onError, this.options.positionOptions)); } else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess, this._onError, this.options.positionOptions), this._timeoutId = setTimeout(this._finish, 1e4); return !0 }, o.prototype._clearWatch = function () { t.window.navigator.geolocation.clearWatch(this._geolocationWatchID), this._geolocationWatchID = void 0, this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"), this._geolocateButton.setAttribute("aria-pressed", "false"), this.options.showUserLocation && this._updateMarker(null); }, o }(t.Evented), ir = { maxWidth: 100, unit: "metric" }, or = function (e) { this.options = t.extend({}, ir, e), t.bindAll(["_onMove", "setUnit"], this); }; function rr(t, e, i) { var o, r, a, n, s, l, c = i && i.maxWidth || 100, u = t._container.clientHeight / 2, h = (o = t.unproject([0, u]), r = t.unproject([c, u]), a = Math.PI / 180, n = o.lat * a, s = r.lat * a, l = Math.sin(n) * Math.sin(s) + Math.cos(n) * Math.cos(s) * Math.cos((r.lng - o.lng) * a), 6371e3 * Math.acos(Math.min(l, 1))); if (i && "imperial" === i.unit) { var p = 3.2808 * h; if (p > 5280) ar(e, c, p / 5280, t._getUIString("ScaleControl.Miles")); else ar(e, c, p, t._getUIString("ScaleControl.Feet")); } else if (i && "nautical" === i.unit) { ar(e, c, h / 1852, t._getUIString("ScaleControl.NauticalMiles")); } else h >= 1e3 ? ar(e, c, h / 1e3, t._getUIString("ScaleControl.Kilometers")) : ar(e, c, h, t._getUIString("ScaleControl.Meters")); } function ar(t, e, i, o) { var r, a, n, s = (r = i, a = Math.pow(10, ("" + Math.floor(r)).length - 1), n = (n = r / a) >= 10 ? 10 : n >= 5 ? 5 : n >= 3 ? 3 : n >= 2 ? 2 : n >= 1 ? 1 : function (t) { var e = Math.pow(10, Math.ceil(-Math.log(t) / Math.LN10)); return Math.round(t * e) / e }(n), a * n), l = s / i; t.style.width = e * l + "px", t.innerHTML = s + o; } or.prototype.getDefaultPosition = function () { return "bottom-left" }, or.prototype._onMove = function () { rr(this._map, this._container, this.options); }, or.prototype.onAdd = function (t) { return this._map = t, this._container = i.create("div", "mapboxgl-ctrl mapboxgl-ctrl-scale", t.getContainer()), this._map.on("move", this._onMove), this._onMove(), this._container }, or.prototype.onRemove = function () { i.remove(this._container), this._map.off("move", this._onMove), this._map = void 0; }, or.prototype.setUnit = function (t) { this.options.unit = t, rr(this._map, this._container, this.options); }; var nr = function (e) { this._fullscreen = !1, e && e.container && (e.container instanceof t.window.HTMLElement ? this._container = e.container : t.warnOnce("Full screen control 'container' must be a DOM element.")), t.bindAll(["_onClickFullscreen", "_changeIcon"], this), "onfullscreenchange" in t.window.document ? this._fullscreenchange = "fullscreenchange" : "onmozfullscreenchange" in t.window.document ? this._fullscreenchange = "mozfullscreenchange" : "onwebkitfullscreenchange" in t.window.document ? this._fullscreenchange = "webkitfullscreenchange" : "onmsfullscreenchange" in t.window.document && (this._fullscreenchange = "MSFullscreenChange"); }; nr.prototype.onAdd = function (e) { return this._map = e, this._container || (this._container = this._map.getContainer()), this._controlContainer = i.create("div", "mapboxgl-ctrl mapboxgl-ctrl-group"), this._checkFullscreenSupport() ? this._setupUI() : (this._controlContainer.style.display = "none", t.warnOnce("This device does not support fullscreen mode.")), this._controlContainer }, nr.prototype.onRemove = function () { i.remove(this._controlContainer), this._map = null, t.window.document.removeEventListener(this._fullscreenchange, this._changeIcon); }, nr.prototype._checkFullscreenSupport = function () { return !!(t.window.document.fullscreenEnabled || t.window.document.mozFullScreenEnabled || t.window.document.msFullscreenEnabled || t.window.document.webkitFullscreenEnabled) }, nr.prototype._setupUI = function () { var e = this._fullscreenButton = i.create("button", "mapboxgl-ctrl-fullscreen", this._controlContainer); i.create("span", "mapboxgl-ctrl-icon", e).setAttribute("aria-hidden", !0), e.type = "button", this._updateTitle(), this._fullscreenButton.addEventListener("click", this._onClickFullscreen), t.window.document.addEventListener(this._fullscreenchange, this._changeIcon); }, nr.prototype._updateTitle = function () { var t = this._getTitle(); this._fullscreenButton.setAttribute("aria-label", t), this._fullscreenButton.title = t; }, nr.prototype._getTitle = function () { return this._map._getUIString(this._isFullscreen() ? "FullscreenControl.Exit" : "FullscreenControl.Enter") }, nr.prototype._isFullscreen = function () { return this._fullscreen }, nr.prototype._changeIcon = function () { (t.window.document.fullscreenElement || t.window.document.mozFullScreenElement || t.window.document.webkitFullscreenElement || t.window.document.msFullscreenElement) === this._container !== this._fullscreen && (this._fullscreen = !this._fullscreen, this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"), this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"), this._updateTitle()); }, nr.prototype._onClickFullscreen = function () { this._isFullscreen() ? t.window.document.exitFullscreen ? t.window.document.exitFullscreen() : t.window.document.mozCancelFullScreen ? t.window.document.mozCancelFullScreen() : t.window.document.msExitFullscreen ? t.window.document.msExitFullscreen() : t.window.document.webkitCancelFullScreen && t.window.document.webkitCancelFullScreen() : this._container.requestFullscreen ? this._container.requestFullscreen() : this._container.mozRequestFullScreen ? this._container.mozRequestFullScreen() : this._container.msRequestFullscreen ? this._container.msRequestFullscreen() : this._container.webkitRequestFullscreen && this._container.webkitRequestFullscreen(); }; var sr = { closeButton: !0, closeOnClick: !0, className: "", maxWidth: "240px" }, lr = function (e) { function o(i) { e.call(this), this.options = t.extend(Object.create(sr), i), t.bindAll(["_update", "_onClickClose", "remove"], this); } return e && (o.__proto__ = e), o.prototype = Object.create(e && e.prototype), o.prototype.constructor = o, o.prototype.addTo = function (e) { var i = this; return this._map = e, this.options.closeOnClick && this._map.on("click", this._onClickClose), this._map.on("remove", this.remove), this._update(), this._trackPointer ? (this._map.on("mousemove", (function (t) { i._update(t.point); })), this._map.on("mouseup", (function (t) { i._update(t.point); })), this._container && this._container.classList.add("mapboxgl-popup-track-pointer"), this._map._canvasContainer.classList.add("mapboxgl-track-pointer")) : this._map.on("move", this._update), this.fire(new t.Event("open")), this }, o.prototype.isOpen = function () { return !!this._map }, o.prototype.remove = function () { return this._content && i.remove(this._content), this._container && (i.remove(this._container), delete this._container), this._map && (this._map.off("move", this._update), this._map.off("click", this._onClickClose), this._map.off("remove", this.remove), this._map.off("mousemove"), delete this._map), this.fire(new t.Event("close")), this }, o.prototype.getLngLat = function () { return this._lngLat }, o.prototype.setLngLat = function (e) { return this._lngLat = t.LngLat.convert(e), this._pos = null, this._trackPointer = !1, this._update(), this._map && (this._map.on("move", this._update), this._map.off("mousemove"), this._container && this._container.classList.remove("mapboxgl-popup-track-pointer"), this._map._canvasContainer.classList.remove("mapboxgl-track-pointer")), this }, o.prototype.trackPointer = function () { var t = this; return this._trackPointer = !0, this._pos = null, this._update(), this._map && (this._map.off("move", this._update), this._map.on("mousemove", (function (e) { t._update(e.point); })), this._map.on("drag", (function (e) { t._update(e.point); })), this._container && this._container.classList.add("mapboxgl-popup-track-pointer"), this._map._canvasContainer.classList.add("mapboxgl-track-pointer")), this }, o.prototype.getElement = function () { return this._container }, o.prototype.setText = function (e) { return this.setDOMContent(t.window.document.createTextNode(e)) }, o.prototype.setHTML = function (e) { var i, o = t.window.document.createDocumentFragment(), r = t.window.document.createElement("body"); for (r.innerHTML = e; i = r.firstChild;)o.appendChild(i); return this.setDOMContent(o) }, o.prototype.getMaxWidth = function () { return this._container.style.maxWidth }, o.prototype.setMaxWidth = function (t) { return this.options.maxWidth = t, this._update(), this }, o.prototype.setDOMContent = function (t) { return this._createContent(), this._content.appendChild(t), this._update(), this }, o.prototype.addClassName = function (t) { this._container.classList.add(t); }, o.prototype.removeClassName = function (t) { this._container.classList.remove(t); }, o.prototype.toggleClassName = function (t) { return this._container.classList.toggle(t) }, o.prototype._createContent = function () { this._content && i.remove(this._content), this._content = i.create("div", "mapboxgl-popup-content", this._container), this.options.closeButton && (this._closeButton = i.create("button", "mapboxgl-popup-close-button", this._content), this._closeButton.type = "button", this._closeButton.setAttribute("aria-label", "Close popup"), this._closeButton.innerHTML = "×", this._closeButton.addEventListener("click", this._onClickClose)); }, o.prototype._update = function (e) { var o = this, r = this._lngLat || this._trackPointer; if (this._map && r && this._content && (this._container || (this._container = i.create("div", "mapboxgl-popup", this._map.getContainer()), this._tip = i.create("div", "mapboxgl-popup-tip", this._container), this._container.appendChild(this._content), this.options.className && this.options.className.split(" ").forEach((function (t) { return o._container.classList.add(t) })), this._trackPointer && this._container.classList.add("mapboxgl-popup-track-pointer")), this.options.maxWidth && this._container.style.maxWidth !== this.options.maxWidth && (this._container.style.maxWidth = this.options.maxWidth), this._map.transform.renderWorldCopies && !this._trackPointer && (this._lngLat = Ko(this._lngLat, this._pos, this._map.transform)), !this._trackPointer || e)) { var a = this._pos = this._trackPointer && e ? e : this._map.project(this._lngLat), n = this.options.anchor, s = function e(i) { if (i) { if ("number" == typeof i) { var o = Math.round(Math.sqrt(.5 * Math.pow(i, 2))); return { center: new t.Point(0, 0), top: new t.Point(0, i), "top-left": new t.Point(o, o), "top-right": new t.Point(-o, o), bottom: new t.Point(0, -i), "bottom-left": new t.Point(o, -o), "bottom-right": new t.Point(-o, -o), left: new t.Point(i, 0), right: new t.Point(-i, 0) } } if (i instanceof t.Point || Array.isArray(i)) { var r = t.Point.convert(i); return { center: r, top: r, "top-left": r, "top-right": r, bottom: r, "bottom-left": r, "bottom-right": r, left: r, right: r } } return { center: t.Point.convert(i.center || [0, 0]), top: t.Point.convert(i.top || [0, 0]), "top-left": t.Point.convert(i["top-left"] || [0, 0]), "top-right": t.Point.convert(i["top-right"] || [0, 0]), bottom: t.Point.convert(i.bottom || [0, 0]), "bottom-left": t.Point.convert(i["bottom-left"] || [0, 0]), "bottom-right": t.Point.convert(i["bottom-right"] || [0, 0]), left: t.Point.convert(i.left || [0, 0]), right: t.Point.convert(i.right || [0, 0]) } } return e(new t.Point(0, 0)) }(this.options.offset); if (!n) { var l, c = this._container.offsetWidth, u = this._container.offsetHeight; l = a.y + s.bottom.y < u ? ["top"] : a.y > this._map.transform.height - u ? ["bottom"] : [], a.x < c / 2 ? l.push("left") : a.x > this._map.transform.width - c / 2 && l.push("right"), n = 0 === l.length ? "bottom" : l.join("-"); } var h = a.add(s[n]).round(); i.setTransform(this._container, Yo[n] + " translate(" + h.x + "px," + h.y + "px)"), Jo(this._container, n, "popup"); } }, o.prototype._onClickClose = function () { this.remove(); }, o }(t.Evented); var cr = { version: t.version, supported: e, setRTLTextPlugin: t.setRTLTextPlugin, getRTLTextPluginStatus: t.getRTLTextPluginStatus, Map: Go, NavigationControl: Ho, GeolocateControl: er, AttributionControl: Bo, ScaleControl: or, FullscreenControl: nr, Popup: lr, Marker: $o, Style: Ue, LngLat: t.LngLat, LngLatBounds: t.LngLatBounds, Point: t.Point, MercatorCoordinate: t.MercatorCoordinate, Evented: t.Evented, config: t.config, get accessToken() { return t.config.ACCESS_TOKEN }, set accessToken(e) { t.config.ACCESS_TOKEN = e; }, get baseApiUrl() { return t.config.API_URL }, set baseApiUrl(e) { t.config.API_URL = e; }, get workerCount() { return Rt.workerCount }, set workerCount(t) { Rt.workerCount = t; }, get maxParallelImageRequests() { return t.config.MAX_PARALLEL_IMAGE_REQUESTS }, set maxParallelImageRequests(e) { t.config.MAX_PARALLEL_IMAGE_REQUESTS = e; }, clearStorage: function (e) { t.clearTileCache(e); }, workerUrl: "" }; return cr })); // return mapboxgl; })));; /*v0.0.11*/ (function (root, factory) { if (typeof define === 'function' && define.amd) { // AMD define(['leaflet', 'mapbox-gl'], factory); } else if (typeof exports === 'object') { // Node, CommonJS-like module.exports = factory(require('leaflet'), require('mapbox-gl')); } else { // Browser globals (root is window) root.returnExports = factory(window.L, window.mapboxgl); } }(this, function (L, mapboxgl) { L.MapboxGL = L.Layer.extend({ options: { updateInterval: 32, // How much to extend the overlay view (relative to map size) // e.g. 0.1 would be 10% of map view in each direction padding: 0.1, // whether or not to register the mouse and keyboard // events on the mapbox overlay interactive: false }, initialize: function (options) { L.setOptions(this, options); if (options.accessToken) { mapboxgl.accessToken = options.accessToken; } else { throw new Error('You should provide a Mapbox GL access token as a token option.'); } // setup throttling the update event when panning this._throttledUpdate = L.Util.throttle(this._update, this.options.updateInterval, this); }, onAdd: function (map) { if (!this._container) { this._initContainer(); } map.getPanes().tilePane.appendChild(this._container); this._initGL(); this._offset = this._map.containerPointToLayerPoint([0, 0]); // work around https://github.com/mapbox/mapbox-gl-leaflet/issues/47 if (map.options.zoomAnimation) { L.DomEvent.on(map._proxy, L.DomUtil.TRANSITION_END, this._transitionEnd, this); } }, onRemove: function (map) { if (this._map._proxy && this._map.options.zoomAnimation) { L.DomEvent.off(this._map._proxy, L.DomUtil.TRANSITION_END, this._transitionEnd, this); } map.getPanes().tilePane.removeChild(this._container); this._glMap.remove(); this._glMap = null; }, getEvents: function () { return { move: this._throttledUpdate, // sensibly throttle updating while panning zoomanim: this._animateZoom, // applys the zoom animation to the zoom: this._pinchZoom, // animate every zoom event for smoother pinch-zooming zoomstart: this._zoomStart, // flag starting a zoom to disable panning zoomend: this._zoomEnd }; }, getMapboxMap: function () { return this._glMap; }, getCanvas: function () { return this._glMap.getCanvas(); }, getSize: function () { return this._map.getSize().multiplyBy(1 + this.options.padding * 2); }, getBounds: function () { var halfSize = this.getSize().multiplyBy(0.5); var center = this._map.latLngToContainerPoint(this._map.getCenter()); return L.latLngBounds( this._map.containerPointToLatLng(center.subtract(halfSize)), this._map.containerPointToLatLng(center.add(halfSize)) ); }, getContainer: function () { return this._container; }, _initContainer: function () { var container = this._container = L.DomUtil.create('div', 'leaflet-gl-layer'); var size = this.getSize(); var offset = this._map.getSize().multiplyBy(this.options.padding); container.style.width = size.x + 'px'; container.style.height = size.y + 'px'; var topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset); L.DomUtil.setPosition(container, topLeft); }, _initGL: function () { var center = this._map.getCenter(); var options = L.extend({}, this.options, { container: this._container, center: [center.lng, center.lat], zoom: this._map.getZoom() - 1, attributionControl: false }); this._glMap = new mapboxgl.Map(options); // allow GL base map to pan beyond min/max latitudes this._glMap.transform.latRange = null; if (this._glMap._canvas.canvas) { // older versions of mapbox-gl surfaced the canvas differently this._glMap._actualCanvas = this._glMap._canvas.canvas; } else { this._glMap._actualCanvas = this._glMap._canvas; } // treat child element like L.ImageOverlay var canvas = this._glMap._actualCanvas; L.DomUtil.addClass(canvas, 'leaflet-image-layer'); L.DomUtil.addClass(canvas, 'leaflet-zoom-animated'); if (this.options.interactive) { L.DomUtil.addClass(canvas, 'leaflet-interactive'); } if (this.options.className) { L.DomUtil.addClass(canvas, this.options.className); } }, _update: function (e) { // update the offset so we can correct for it later when we zoom this._offset = this._map.containerPointToLayerPoint([0, 0]); if (this._zooming) { return; } var size = this.getSize(), container = this._container, gl = this._glMap, offset = this._map.getSize().multiplyBy(this.options.padding), topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset); L.DomUtil.setPosition(container, topLeft); var center = this._map.getCenter(); // gl.setView([center.lat, center.lng], this._map.getZoom() - 1, 0); // calling setView directly causes sync issues because it uses requestAnimFrame var tr = gl.transform; tr.center = mapboxgl.LngLat.convert([center.lng, center.lat]); tr.zoom = this._map.getZoom() - 1; if (gl.transform.width !== size.x || gl.transform.height !== size.y) { container.style.width = size.x + 'px'; container.style.height = size.y + 'px'; if (gl._resize !== null && gl._resize !== undefined) { gl._resize(); } else { gl.resize(); } } else { // older versions of mapbox-gl surfaced update publicly if (gl._update !== null && gl._update !== undefined) { gl._update(); } else { gl.update(); } } }, // update the map constantly during a pinch zoom _pinchZoom: function (e) { this._glMap.jumpTo({ zoom: this._map.getZoom() - 1, center: this._map.getCenter() }); }, // borrowed from L.ImageOverlay // https://github.com/Leaflet/Leaflet/blob/master/src/layer/ImageOverlay.js#L139-L144 _animateZoom: function (e) { var scale = this._map.getZoomScale(e.zoom); var padding = this._map.getSize().multiplyBy(this.options.padding * scale); var viewHalf = this.getSize()._divideBy(2); // corrections for padding (scaled), adapted from // https://github.com/Leaflet/Leaflet/blob/master/src/map/Map.js#L1490-L1508 var topLeft = this._map.project(e.center, e.zoom) ._subtract(viewHalf) ._add(this._map._getMapPanePos() .add(padding))._round(); var offset = this._map.project(this._map.getBounds().getNorthWest(), e.zoom) ._subtract(topLeft); L.DomUtil.setTransform( this._glMap._actualCanvas, offset.subtract(this._offset), scale ); }, _zoomStart: function (e) { this._zooming = true; }, _zoomEnd: function () { var scale = this._map.getZoomScale(this._map.getZoom()), offset = this._map._latLngToNewLayerPoint( this._map.getBounds().getNorthWest(), this._map.getZoom(), this._map.getCenter() ); L.DomUtil.setTransform( this._glMap._actualCanvas, offset.subtract(this._offset), scale ); this._zooming = false; this._update(); }, _transitionEnd: function (e) { L.Util.requestAnimFrame(function () { var zoom = this._map.getZoom(); var center = this._map.getCenter(); var offset = this._map.latLngToContainerPoint( this._map.getBounds().getNorthWest() ); // reset the scale and offset L.DomUtil.setTransform(this._glMap._actualCanvas, offset, 1); // enable panning once the gl map is ready again this._glMap.once('moveend', L.Util.bind(function () { this._zoomEnd(); }, this)); // update the map position this._glMap.jumpTo({ center: center, zoom: zoom - 1 }); }, this); } }); L.mapboxGL = function (options) { return new L.MapboxGL(options); }; })); ; /** * PlanPlus vector layer * @param { string } lid - PlanPlus Licence ID * @param { object } options - Default { poiLayer: false, poiTooltip: false } */ L.planplusVectorLayer = function (lid, options) { options = Object.assign({ poiLayer: false, poiTooltip: false, style: 'https://vt.planplus.rs/mapstyle/PPMapaStyle.json?lid=' + lid, accessToken: 'no_token' }, options || {}) if (options.interactive) { options.poiTooltip = true options.interactive = false } if (!lid) { throw Error('Parameter "lid" is required.') } return new L.PlanplusVectorLayer(options) }; L.PlanplusVectorLayer = L.MapboxGL.extend({ onAdd: function (map) { L.MapboxGL.prototype.onAdd.call(this, map); if (this.options.poiLayer) { map.on('resize zoomend moveend load', function () { this._updateMapObjects(map) }, this).fire('load') } }, _mapObjectPopupTimeout: null, _mapObjectsLayer: L.layerGroup(), _mapObjectsCache: {}, _mapObjects: L.featureGroup().toGeoJSON(), _updateMapObjects: function (map) { this._updateMapObjectsOverlay(map) if (map.getZoom() < 16) return var mb = map.getBounds(), zoom = 15 var xmin = this.lng2tileX(mb.getWest(), zoom), xmax = this.lng2tileX(mb.getEast(), zoom), ymin = this.lat2tileY(mb.getNorth(), zoom), ymax = this.lat2tileY(mb.getSouth(), zoom) var safeCounter = 0 for (var i = xmin; i <= xmax && safeCounter < 100; i++) { for (var j = ymin; j <= ymax && safeCounter < 100; j++) { if (!this._mapObjectsCache[i + ':' + j]) { this._mapObjectsCache[i + ':' + j] = 1 this._getMapObjects(i, j) } safeCounter++ } } }, _getMapObjects: function(tileX, tileY) { var zoom = 15 var url = PP.settings.rootUrl + '/Ajax/GetMapObjects?' + 'South=' + this.tileY2lat(tileY + 1, zoom) + '&West=' + this.tileX2lng(tileX, zoom) + '&North=' + this.tileY2lat(tileY, zoom) + '&East=' + this.tileX2lng(tileX + 1, zoom) var oReq = new XMLHttpRequest(); var _self = this oReq.addEventListener('load', function () { var data = JSON.parse(this.responseText) _self._mapObjectsProcess(data, _self) }) oReq.open('GET', url) oReq.send() }, _mapObjectsProcess: function (data, self) { data.objects && data.objects.forEach(o => { o.coordinates.forEach((lla, i) => { if (lla[0].length) { self._mapObjects.features.push(self._geoJsonFeature(o, lla, 16 + i)); } }) }) data.stops && data.stops.forEach(s => { var gjfeature = L.marker([s.lat, s.lon]).toGeoJSON() gjfeature.properties = Object.assign({}, s) gjfeature.properties.type = 'stop' self._mapObjects.features.push(gjfeature); }) if (self._glMap.loaded() || self._glMap.getSource('map-objects')) { self._glMap.getSource('map-objects').setData(self._mapObjects) } else { self._glMap.on('load', () => self._glMap.getSource('map-objects').setData(self._mapObjects)) } self._updateMapObjectsOverlay() }, _geoJsonFeature: function(feature, latLngAnchor, zoom) { var gjfeature = L.marker([latLngAnchor[0], latLngAnchor[1]]).toGeoJSON() //gjfeature.properties = Object.assign({}, feature) gjfeature.properties.label = latLngAnchor[2].length ? feature.label : latLngAnchor[2] gjfeature.properties.labelWidth = feature.labelWidth gjfeature.properties.id = feature.id gjfeature.properties.name = feature.name gjfeature.properties.iconClass = feature.iconClass gjfeature.properties.iconID = feature.iconID gjfeature.properties.textAnchor = latLngAnchor[2] gjfeature.properties.zoom = zoom gjfeature.properties.type = 'poi' return gjfeature }, _updateMapObjectsOverlay: function(map) { this._mapObjectsLayer.remove().clearLayers() var bounds = this._map.getBounds(), zoom = this._map.getZoom() if (zoom <= 15) return this._mapObjects.features .filter(x => { return (x.properties.zoom == zoom || x.properties.type == 'stop') && bounds.contains(L.latLng([x.geometry.coordinates[1], x.geometry.coordinates[0]])) }) .forEach(x => { var m = L.marker([x.geometry.coordinates[1], x.geometry.coordinates[0]], { icon: L.divIcon({ className: 'marker-overlay', iconSize: [20, 20] }), zIndexOffset: -10 } ) this._mapObjectsLayer.addLayer(m) if (this.options.poiTooltip) { var self = this if (x.properties.type == 'stop') { m.on('mouseover click', function () { self._stopOnMouseover(x) }) } else if (x.properties.type == 'poi') { m.on('mouseover click', function () { self._poiOnMouseover(x) }) } m.on('mouseout', this._mapObjectOnMouseout, this) } }) this._mapObjectsLayer.addTo(this._map) }, _stopOnMouseover: function (feature) { function getStopContent(feature, routes, layer) { var content = `
` + feature.properties.name + '' if (routes.length) { content += '' } content += '
' return content; } function getRouteMapLink(route, layer) { var type = route.type == 0 ? 'tramvaj' : route.type == 3 ? 'autobus' : 'trolejbus', title = layer._toUrlString(route.shortName + ' ' + route.longName) return `https://www.planplus.rs/mapa#!${type}/${title}/${route.id}` } function getStopMapLink(stop, layer) { var title = layer._toUrlString(stop.name) return `https://www.planplus.rs/mapa#!stajaliste/${title}/${stop.id}` } var self = this var p = L.popup({ offset: L.point(0, -7), maxWidth: 200 }) .setLatLng([feature.geometry.coordinates[1], feature.geometry.coordinates[0]]) var url = PP.settings.rootUrl + '/Ajax/GetRoutes?' + 'stopId=' + feature.properties.id var oReq = new XMLHttpRequest(); oReq.addEventListener('load', function () { var data = JSON.parse(this.responseText) var content = getStopContent(feature, data.routes || [], self) p.setContent(content) }) oReq.open('GET', url) oReq.send() this._mapObjectPopupTimeout = setTimeout(function () { p.openOn(self._map); }, 500) }, _poiOnMouseover: function (feature) { var content = '' var self = this var p = L.popup({ offset: L.point(0, -7), maxWidth: 200 }) .setLatLng([feature.geometry.coordinates[1], feature.geometry.coordinates[0]]) .setContent(content) this._mapObjectPopupTimeout = setTimeout(function () { p.openOn(self._map); }, 500) }, _mapObjectOnMouseout: function () { clearTimeout(this._mapObjectPopupTimeout) }, /** * Get tile X coordinate for given lon and zoom * @param {float} lng * @param {int} zoom */ lng2tileX: function(lng, zoom) { return(Math.floor((lng + 180) / 360 * Math.pow(2, zoom))); }, /** * Get tile Y coordinate for given lon and zoom * @param {float} lat * @param {int} zoom */ lat2tileY: function(lat, zoom) { return (Math.floor((1 - Math.log(Math.tan(lat * Math.PI / 180) + 1 / Math.cos(lat * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, zoom))); }, /** * Get lng for given tile X coordinate and zoom * @param {any} x * @param {any} z */ tileX2lng: function(x, z) { return (x / Math.pow(2, z) * 360 - 180); }, /** * Get lat for given tile Y coordinate and zoom * @param {any} y * @param {any} z */ tileY2lat: function(y, z) { var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z); return (180 / Math.PI * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)))); }, _toClassicLatin: function (string) { return string.toLowerCase().split('').map(function (char) { switch (char.charCodeAt()) { case 262: case 263: case 268: case 269: return 'c'; break; case 352: case 353: return 's'; break; case 381: case 382: return 'z'; break; case 272: case 273: return 'dj'; break; case 38: return 'an132'; break; case 43: return '%2B'; break; default: return char; break; } }).join('') }, _toUrlString: function(string) { var urlString = this._toClassicLatin(string).replace(new RegExp(" ", "gm"), "-").replace(new RegExp("---", "gm"), "-").replace(new RegExp(",", "gm"), "").replace(new RegExp(":", "gm"), "").replace(new RegExp("%", "gm"), "").replace(new RegExp("&", "gm"), "").replace(new RegExp("/", "gm"), "").replace(new RegExp("\\.", "gm"), "-").replace(/\+/g, "").replace(/\(/g, "").replace(/\)/g, "") return encodeURIComponent(urlString) } });; var PP = { settings: { rootUrl: '//maps-api.planplus.rs' }, sid: '81d0bdda-6c5e-66f2-c165-298963e277gf-h12ade894' }; (function(){ setInterval(function(){ var httpRequest = new XMLHttpRequest(); httpRequest.onreadystatechange = function () { if (httpRequest.readyState === XMLHttpRequest.DONE) { if (httpRequest.status == 200) { var data = JSON.parse(httpRequest.responseText); if (data.sid) { window.PP.sid = data.sid; } } } }; httpRequest.open('GET', '//maps-api.planplus.rs/Ajax/GetSID?lid=6b11d0d3-a9fb-47c1-8850-9057719d8139', true); httpRequest.send(); }, 1000 * 60 * 2); })();