Files
torebki-fabiola.pl/wp-content/plugins/mapster-wp-maps/includes/acf-mapster-map/assets/dist/acf-mapster-map.js
2026-03-05 13:07:40 +01:00

9 lines
1.4 MiB
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).turf={})}(this,(function(t){"use strict";var e=6371008.8,r={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*e,kilometers:6371.0088,kilometres:6371.0088,meters:e,metres:e,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:e/1852,radians:1,yards:6967335.223679999},n={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e,yards:1.0936133},i={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function o(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function a(t,e,r){switch(t){case"Point":return s(e).geometry;case"LineString":return h(e).geometry;case"Polygon":return l(e).geometry;case"MultiPoint":return g(e).geometry;case"MultiLineString":return d(e).geometry;case"MultiPolygon":return y(e).geometry;default:throw new Error(t+" is invalid")}}function s(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!P(t[0])||!P(t[1]))throw new Error("coordinates must contain numbers");return o({type:"Point",coordinates:t},e,r)}function u(t,e,r){return void 0===r&&(r={}),f(t.map((function(t){return s(t,e)})),r)}function l(t,e,r){void 0===r&&(r={});for(var n=0,i=t;n<i.length;n++){var a=i[n];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return o({type:"Polygon",coordinates:t},e,r)}function c(t,e,r){return void 0===r&&(r={}),f(t.map((function(t){return l(t,e)})),r)}function h(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return o({type:"LineString",coordinates:t},e,r)}function p(t,e,r){return void 0===r&&(r={}),f(t.map((function(t){return h(t,e)})),r)}function f(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function d(t,e,r){return void 0===r&&(r={}),o({type:"MultiLineString",coordinates:t},e,r)}function g(t,e,r){return void 0===r&&(r={}),o({type:"MultiPoint",coordinates:t},e,r)}function y(t,e,r){return void 0===r&&(r={}),o({type:"MultiPolygon",coordinates:t},e,r)}function m(t,e,r){return void 0===r&&(r={}),o({type:"GeometryCollection",geometries:t},e,r)}function v(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r}function _(t,e){void 0===e&&(e="kilometers");var n=r[e];if(!n)throw new Error(e+" units is invalid");return t*n}function x(t,e){void 0===e&&(e="kilometers");var n=r[e];if(!n)throw new Error(e+" units is invalid");return t/n}function b(t,e){return E(x(t,e))}function w(t){var e=t%360;return e<0&&(e+=360),e}function E(t){return t%(2*Math.PI)*180/Math.PI}function I(t){return t%360*Math.PI/180}function S(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return _(x(t,e),r)}function C(t,e,r){if(void 0===e&&(e="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var n=i[e];if(!n)throw new Error("invalid original units");var o=i[r];if(!o)throw new Error("invalid final units");return t/n*o}function P(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function M(t){return!!t&&t.constructor===Object}function T(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!P(t))throw new Error("bbox must only contain numbers")}))}function L(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}var A=Object.freeze({__proto__:null,earthRadius:e,factors:r,unitsFactors:n,areaFactors:i,feature:o,geometry:a,point:s,points:u,polygon:l,polygons:c,lineString:h,lineStrings:p,featureCollection:f,multiLineString:d,multiPoint:g,multiPolygon:y,geometryCollection:m,round:v,radiansToLength:_,lengthToRadians:x,lengthToDegrees:b,bearingToAzimuth:w,radiansToDegrees:E,degreesToRadians:I,convertLength:S,convertArea:C,isNumber:P,isObject:M,validateBBox:T,validateId:L});function k(t,e,r){if(null!==t)for(var n,i,o,a,s,u,l,c,h=0,p=0,f=t.type,d="FeatureCollection"===f,g="Feature"===f,y=d?t.features.length:1,m=0;m<y;m++){s=(c=!!(l=d?t.features[m].geometry:g?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var v=0;v<s;v++){var _=0,x=0;if(null!==(a=c?l.geometries[v]:l)){u=a.coordinates;var b=a.type;switch(h=!r||"Polygon"!==b&&"MultiPolygon"!==b?0:1,b){case null:break;case"Point":if(!1===e(u,p,m,_,x))return!1;p++,_++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],p,m,_,x))return!1;p++,"MultiPoint"===b&&_++}"LineString"===b&&_++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-h;i++){if(!1===e(u[n][i],p,m,_,x))return!1;p++}"MultiLineString"===b&&_++,"Polygon"===b&&x++}"Polygon"===b&&_++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(x=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-h;o++){if(!1===e(u[n][i][o],p,m,_,x))return!1;p++}x++}_++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(!1===k(a.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function N(t,e,r,n){var i=r;return k(t,(function(t,n,o,a,s){i=0===n&&void 0===r?t:e(i,t,n,o,a,s)}),n),i}function D(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&!1!==e(t.features[r].properties,r);r++);break;case"Feature":e(t.properties,0)}}function R(t,e,r){var n=r;return D(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function O(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length&&!1!==e(t.features[r],r);r++);}function z(t,e,r){var n=r;return O(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function F(t){var e=[];return k(t,(function(t){e.push(t)})),e}function B(t,e){var r,n,i,o,a,s,u,l,c,h,p=0,f="FeatureCollection"===t.type,d="Feature"===t.type,g=f?t.features.length:1;for(r=0;r<g;r++){for(s=f?t.features[r].geometry:d?t.geometry:t,l=f?t.features[r].properties:d?t.properties:{},c=f?t.features[r].bbox:d?t.bbox:void 0,h=f?t.features[r].id:d?t.id:void 0,a=(u=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1,i=0;i<a;i++)if(null!==(o=u?s.geometries[i]:s))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,p,l,c,h))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===e(o.geometries[n],p,l,c,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,p,l,c,h))return!1;p++}}function U(t,e,r){var n=r;return B(t,(function(t,i,o,a,s){n=0===i&&void 0===r?t:e(n,t,i,o,a,s)})),n}function j(t,e){B(t,(function(t,r,n,i,a){var s,u=null===t?null:t.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return!1!==e(o(t,n,{bbox:i,id:a}),r,0)&&void 0}switch(u){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<t.coordinates.length;l++){var c=t.coordinates[l];if(!1===e(o({type:s,coordinates:c},n),r,l))return!1}}))}function V(t,e,r){var n=r;return j(t,(function(t,i,o){n=0===i&&0===o&&void 0===r?t:e(n,t,i,o)})),n}function q(t,e){j(t,(function(t,r,n){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var a,s=0,u=0,l=0;return!1!==k(t,(function(o,c,p,f,d){if(void 0===a||r>s||f>u||d>l)return a=o,s=r,u=f,l=d,void(i=0);var g=h([a,o],t.properties);if(!1===e(g,r,n,d,i))return!1;i++,a=o}))&&void 0}}}))}function G(t,e,r){var n=r,i=!1;return q(t,(function(t,o,a,s,u){n=!1===i&&void 0===r?t:e(n,t,o,a,s,u),i=!0})),n}function X(t,e){if(!t)throw new Error("geojson is required");j(t,(function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var a=0;a<o.length;a++)if(!1===e(h(o[a],t.properties),r,n,a))return!1}}}))}function Z(t,e,r){var n=r;return X(t,(function(t,i,o,a){n=0===i&&void 0===r?t:e(n,t,i,o,a)})),n}function Y(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,a=e.segmentIndex||0,s=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),s=s||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":s=s||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return a<0&&(a=u.length+a-1),h([u[a],u[a+1]],s,e);case"Polygon":return o<0&&(o=u.length+o),a<0&&(a=u[o].length+a-1),h([u[o][a],u[o][a+1]],s,e);case"MultiLineString":return i<0&&(i=u.length+i),a<0&&(a=u[i].length+a-1),h([u[i][a],u[i][a+1]],s,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),a<0&&(a=u[i][o].length-a-1),h([u[i][o][a],u[i][o][a+1]],s,e)}throw new Error("geojson is invalid")}function W(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,a=e.coordIndex||0,u=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),u=u||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":u=u||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var l=r.coordinates;switch(r.type){case"Point":return s(l,u,e);case"MultiPoint":return i<0&&(i=l.length+i),s(l[i],u,e);case"LineString":return a<0&&(a=l.length+a),s(l[a],u,e);case"Polygon":return o<0&&(o=l.length+o),a<0&&(a=l[o].length+a),s(l[o][a],u,e);case"MultiLineString":return i<0&&(i=l.length+i),a<0&&(a=l[i].length+a),s(l[i][a],u,e);case"MultiPolygon":return i<0&&(i=l.length+i),o<0&&(o=l[i].length+o),a<0&&(a=l[i][o].length-a),s(l[i][o][a],u,e)}throw new Error("geojson is invalid")}var H=Object.freeze({__proto__:null,coordAll:F,coordEach:k,coordReduce:N,featureEach:O,featureReduce:z,findPoint:W,findSegment:Y,flattenEach:j,flattenReduce:V,geomEach:B,geomReduce:U,lineEach:X,lineReduce:Z,propEach:D,propReduce:R,segmentEach:q,segmentReduce:G});function J(t){var e=[1/0,1/0,-1/0,-1/0];return k(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}function K(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function $(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Q(t){if(t.length>1&&P(t[0])&&P(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Q(t[0]);throw new Error("coordinates must only contain numbers")}function tt(t,e,r){if(!e||!r)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.type)}function et(t,e,r){if(!t)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.geometry.type)}function rt(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=t.features;n<i.length;n++){var o=i[n];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}}function nt(t){return"Feature"===t.type?t.geometry:t}function it(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}J.default=J;var ot=Object.freeze({__proto__:null,getCoord:K,getCoords:$,containsNumber:Q,geojsonType:tt,featureOf:et,collectionOf:rt,getGeom:nt,getType:it}),at=Object.getOwnPropertySymbols,st=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable;var lt=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,n,i=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),o=1;o<arguments.length;o++){for(var a in r=Object(arguments[o]))st.call(r,a)&&(i[a]=r[a]);if(at){n=at(r);for(var s=0;s<n.length;s++)ut.call(r,n[s])&&(i[n[s]]=r[n[s]])}}return i},ct={successCallback:null,verbose:!1},ht={};function pt(t,e,r){r=r||{};for(var n=Object.keys(ct),i=0;i<n.length;i++){var o=n[i],a=r[o];a=null!=a?a:ct[o],ht[o]=a}ht.verbose&&console.log("MarchingSquaresJS-isoContours: computing isocontour for "+e);var s=function(t){var e=[],r=0;return t.cells.forEach((function(n,i){n.forEach((function(n,o){if(void 0!==n&&5!==(p=n).cval&&10!==p.cval&&!dt(n)){var a=function(t,e,r){var n,i,o=t.length,a=[],s=[0,0,1,1,0,0,0,0,-1,0,1,1,-1,0,-1,0],u=[0,-1,0,0,1,1,1,1,0,-1,0,0,0,-1,0,0],l=["none","bottom","right","right","top","top","top","top","left","bottom","right","right","left","bottom","left","none"],c=t[e][r],h=c.cval,p=["none","left","bottom","left","right","none","bottom","left","top","top","none","top","right","right","bottom","none"][h],f=yt(c,p);a.push([r+f[0],e+f[1]]),f=yt(c,p=l[h]),a.push([r+f[0],e+f[1]]),gt(c);for(var d=r+s[h],g=e+u[h],y=h;d>=0&&g>=0&&g<o&&(d!=r||g!=e)&&void 0!==(c=t[g][d]);){if(0===(h=c.cval)||15===h)return{path:a,info:"mergeable"};p=l[h],n=s[h],i=u[h],5!==h&&10!==h||(5===h?c.flipped?-1===u[y]?(p="left",n=-1,i=0):(p="right",n=1,i=0):-1===s[y]&&(p="bottom",n=0,i=-1):10===h&&(c.flipped?-1===s[y]?(p="top",n=0,i=1):(p="bottom",n=0,i=-1):1===u[y]&&(p="left",n=-1,i=0))),f=yt(c,p),a.push([d+f[0],g+f[1]]),gt(c),d+=n,g+=i,y=h}return{path:a,info:"closed"}}(t.cells,i,o),s=!1;if("mergeable"===a.info)for(var u=a.path[a.path.length-1][0],l=a.path[a.path.length-1][1],c=r-1;c>=0;c--)if(Math.abs(e[c][0][0]-u)<=1e-7&&Math.abs(e[c][0][1]-l)<=1e-7){for(var h=a.path.length-2;h>=0;--h)e[c].unshift(a.path[h]);s=!0;break}s||(e[r++]=a.path)}var p}))})),e}(function(t,e){for(var r=t.length-1,n=t[0].length-1,i={rows:r,cols:n,cells:[]},o=0;o<r;++o){i.cells[o]=[];for(var a=0;a<n;++a){var s=0,u=t[o+1][a],l=t[o+1][a+1],c=t[o][a+1],h=t[o][a];if(!(isNaN(u)||isNaN(l)||isNaN(c)||isNaN(h))){s|=u>=e?8:0,s|=l>=e?4:0,s|=c>=e?2:0;var p,f,d,g,y=!1;if(5==(s|=h>=e?1:0)||10===s){var m=(u+l+c+h)/4;5===s&&m<e?(s=10,y=!0):10===s&&m<e&&(s=5,y=!0)}0!==s&&15!==s&&(p=f=d=g=.5,1===s?(d=1-ft(e,u,h),f=1-ft(e,c,h)):2===s?(f=ft(e,h,c),g=1-ft(e,l,c)):3===s?(d=1-ft(e,u,h),g=1-ft(e,l,c)):4===s?(p=ft(e,u,l),g=ft(e,c,l)):5===s?(p=ft(e,u,l),g=ft(e,c,l),f=1-ft(e,c,h),d=1-ft(e,u,h)):6===s?(f=ft(e,h,c),p=ft(e,u,l)):7===s?(d=1-ft(e,u,h),p=ft(e,u,l)):8===s?(d=ft(e,h,u),p=1-ft(e,l,u)):9===s?(f=1-ft(e,c,h),p=1-ft(e,l,u)):10===s?(p=1-ft(e,l,u),g=1-ft(e,l,c),f=ft(e,h,c),d=ft(e,h,u)):11===s?(p=1-ft(e,l,u),g=1-ft(e,l,c)):12===s?(d=ft(e,h,u),g=ft(e,c,l)):13===s?(f=1-ft(e,c,h),g=ft(e,c,l)):14===s?(d=ft(e,h,u),f=ft(e,h,c)):console.log("MarchingSquaresJS-isoContours: Illegal cval detected: "+s),i.cells[o][a]={cval:s,flipped:y,top:p,right:g,bottom:f,left:d})}}}return i}(t,e));return"function"==typeof ht.successCallback&&ht.successCallback(s),s}function ft(t,e,r){return(t-e)/(r-e)}function dt(t){return 0===t.cval||15===t.cval}function gt(t){dt(t)||5===t.cval||10===t.cval||(t.cval=15)}function yt(t,e){return"top"===e?[t.top,1]:"bottom"===e?[t.bottom,0]:"right"===e?[1,t.right]:"left"===e?[0,t.left]:void 0}var mt=_t,vt=_t;function _t(t,e,r,n,i){xt(t,e,r||0,n||t.length-1,i||wt)}function xt(t,e,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=e-r+1,s=Math.log(o),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1);xt(t,e,Math.max(r,Math.floor(e-a*u/o+l)),Math.min(n,Math.floor(e+(o-a)*u/o+l)),i)}var c=t[e],h=r,p=n;for(bt(t,r,e),i(t[n],c)>0&&bt(t,r,n);h<p;){for(bt(t,h,p),h++,p--;i(t[h],c)<0;)h++;for(;i(t[p],c)>0;)p--}0===i(t[r],c)?bt(t,r,p):bt(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function bt(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function wt(t,e){return t<e?-1:t>e?1:0}mt.default=vt;var Et=St,It=St;function St(t,e){if(!(this instanceof St))return new St(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function Ct(t,e,r){if(!r)return e.indexOf(t);for(var n=0;n<e.length;n++)if(r(t,e[n]))return n;return-1}function Pt(t,e){Mt(t,0,t.children.length,e,t)}function Mt(t,e,r,n,i){i||(i=Ot(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,a=e;a<r;a++)o=t.children[a],Tt(i,t.leaf?n(o):o);return i}function Tt(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Lt(t,e){return t.minX-e.minX}function At(t,e){return t.minY-e.minY}function kt(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Nt(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Dt(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Rt(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Ot(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function zt(t,e,r,n,i){for(var o,a=[e,r];a.length;)(r=a.pop())-(e=a.pop())<=n||(o=e+Math.ceil((r-e)/n/2)*n,mt(t,o,e,r,i),a.push(e,o,o,r))}function Ft(t){var e={exports:{}};return t(e,e.exports),e.exports}St.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,r=[],n=this.toBBox;if(!Rt(t,e))return r;for(var i,o,a,s,u=[];e;){for(i=0,o=e.children.length;i<o;i++)a=e.children[i],Rt(t,s=e.leaf?n(a):a)&&(e.leaf?r.push(a):Dt(t,s)?this._all(a,r):u.push(a));e=u.pop()}return r},collides:function(t){var e=this.data,r=this.toBBox;if(!Rt(t,e))return!1;for(var n,i,o,a,s=[];e;){for(n=0,i=e.children.length;n<i;n++)if(o=e.children[n],Rt(t,a=e.leaf?r(o):o)){if(e.leaf||Dt(t,a))return!0;s.push(o)}e=s.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,r=t.length;e<r;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var i=this.data;this.data=n,n=i}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=Ot([]),this},remove:function(t,e){if(!t)return this;for(var r,n,i,o,a=this.data,s=this.toBBox(t),u=[],l=[];a||u.length;){if(a||(a=u.pop(),n=u[u.length-1],r=l.pop(),o=!0),a.leaf&&-1!==(i=Ct(t,a.children,e)))return a.children.splice(i,1),u.push(a),this._condense(u),this;o||a.leaf||!Dt(a,s)?n?(r++,a=n.children[r],o=!1):a=null:(u.push(a),l.push(r),r=0,n=a,a=a.children[0])}return this},toBBox:function(t){return t},compareMinX:Lt,compareMinY:At,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var r=[];t;)t.leaf?e.push.apply(e,t.children):r.push.apply(r,t.children),t=r.pop();return e},_build:function(t,e,r,n){var i,o=r-e+1,a=this._maxEntries;if(o<=a)return Pt(i=Ot(t.slice(e,r+1)),this.toBBox),i;n||(n=Math.ceil(Math.log(o)/Math.log(a)),a=Math.ceil(o/Math.pow(a,n-1))),(i=Ot([])).leaf=!1,i.height=n;var s,u,l,c,h=Math.ceil(o/a),p=h*Math.ceil(Math.sqrt(a));for(zt(t,e,r,p,this.compareMinX),s=e;s<=r;s+=p)for(zt(t,s,l=Math.min(s+p-1,r),h,this.compareMinY),u=s;u<=l;u+=h)c=Math.min(u+h-1,l),i.children.push(this._build(t,u,c,n-1));return Pt(i,this.toBBox),i},_chooseSubtree:function(t,e,r,n){for(var i,o,a,s,u,l,c,h,p,f;n.push(e),!e.leaf&&n.length-1!==r;){for(c=h=1/0,i=0,o=e.children.length;i<o;i++)u=kt(a=e.children[i]),p=t,f=a,(l=(Math.max(f.maxX,p.maxX)-Math.min(f.minX,p.minX))*(Math.max(f.maxY,p.maxY)-Math.min(f.minY,p.minY))-u)<h?(h=l,c=u<c?u:c,s=a):l===h&&u<c&&(c=u,s=a);e=s||e.children[0]}return e},_insert:function(t,e,r){var n=this.toBBox,i=r?t:n(t),o=[],a=this._chooseSubtree(i,this.data,e,o);for(a.children.push(t),Tt(a,i);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var o=this._chooseSplitIndex(r,i,n),a=Ot(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,Pt(r,this.toBBox),Pt(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(r,a)},_splitRoot:function(t,e){this.data=Ot([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Pt(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,r){var n,i,o,a,s,u,l,c,h,p,f,d,g,y;for(u=l=1/0,n=e;n<=r-e;n++)h=i=Mt(t,0,n,this.toBBox),p=o=Mt(t,n,r,this.toBBox),void 0,void 0,void 0,void 0,f=Math.max(h.minX,p.minX),d=Math.max(h.minY,p.minY),g=Math.min(h.maxX,p.maxX),y=Math.min(h.maxY,p.maxY),a=Math.max(0,g-f)*Math.max(0,y-d),s=kt(i)+kt(o),a<u?(u=a,c=n,l=s<l?s:l):a===u&&s<l&&(l=s,c=n);return c},_chooseSplitAxis:function(t,e,r){var n=t.leaf?this.compareMinX:Lt,i=t.leaf?this.compareMinY:At;this._allDistMargin(t,e,r,n)<this._allDistMargin(t,e,r,i)&&t.children.sort(n)},_allDistMargin:function(t,e,r,n){t.children.sort(n);var i,o,a=this.toBBox,s=Mt(t,0,e,a),u=Mt(t,r-e,r,a),l=Nt(s)+Nt(u);for(i=e;i<r-e;i++)o=t.children[i],Tt(s,t.leaf?a(o):o),l+=Nt(s);for(i=r-e-1;i>=e;i--)o=t.children[i],Tt(u,t.leaf?a(o):o),l+=Nt(u);return l},_adjustParentBBoxes:function(t,e,r){for(var n=r;n>=0;n--)Tt(e[n],t)},_condense:function(t){for(var e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children).splice(e.indexOf(t[r]),1):this.clear():Pt(t[r],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}},Et.default=It;var Bt=function(t,e,r){var n=t*e,i=Ut*t,o=i-(i-t),a=t-o,s=Ut*e,u=s-(s-e),l=e-u,c=a*l-(n-o*u-a*u-o*l);return r?(r[0]=c,r[1]=n,r):[c,n]},Ut=+(Math.pow(2,27)+1),jt=function(t,e){var r=0|t.length,n=0|e.length;if(1===r&&1===n)return function(t,e){var r=t+e,n=r-t,i=t-(r-n)+(e-n);return i?[i,r]:[r]}(t[0],e[0]);var i,o,a=new Array(r+n),s=0,u=0,l=0,c=Math.abs,h=t[u],p=c(h),f=e[l],d=c(f);p<d?(o=h,(u+=1)<r&&(p=c(h=t[u]))):(o=f,(l+=1)<n&&(d=c(f=e[l])));u<r&&p<d||l>=n?(i=h,(u+=1)<r&&(p=c(h=t[u]))):(i=f,(l+=1)<n&&(d=c(f=e[l])));for(var g,y,m=i+o,v=m-i,_=o-v,x=_,b=m;u<r&&l<n;)p<d?(i=h,(u+=1)<r&&(p=c(h=t[u]))):(i=f,(l+=1)<n&&(d=c(f=e[l]))),(_=(o=x)-(v=(m=i+o)-i))&&(a[s++]=_),x=b-((g=b+m)-(y=g-b))+(m-y),b=g;for(;u<r;)(_=(o=x)-(v=(m=(i=h)+o)-i))&&(a[s++]=_),x=b-((g=b+m)-(y=g-b))+(m-y),b=g,(u+=1)<r&&(h=t[u]);for(;l<n;)(_=(o=x)-(v=(m=(i=f)+o)-i))&&(a[s++]=_),x=b-((g=b+m)-(y=g-b))+(m-y),b=g,(l+=1)<n&&(f=e[l]);x&&(a[s++]=x);b&&(a[s++]=b);s||(a[s++]=0);return a.length=s,a},Vt=function(t,e,r){var n=t+e,i=n-t,o=e-i,a=t-(n-i);return r?(r[0]=a+o,r[1]=n,r):[a+o,n]},qt=function(t,e){var r=t.length;if(1===r){var n=Bt(t[0],e);return n[0]?n:[n[1]]}var i=new Array(2*r),o=[.1,.1],a=[.1,.1],s=0;Bt(t[0],e,o),o[0]&&(i[s++]=o[0]);for(var u=1;u<r;++u){Bt(t[u],e,a);var l=o[1];Vt(l,a[0],o),o[0]&&(i[s++]=o[0]);var c=a[1],h=o[1],p=c+h,f=h-(p-c);o[1]=p,f&&(i[s++]=f)}o[1]&&(i[s++]=o[1]);0===s&&(i[s++]=0);return i.length=s,i},Gt=function(t,e){var r=0|t.length,n=0|e.length;if(1===r&&1===n)return function(t,e){var r=t+e,n=r-t,i=t-(r-n)+(e-n);return i?[i,r]:[r]}(t[0],-e[0]);var i,o,a=new Array(r+n),s=0,u=0,l=0,c=Math.abs,h=t[u],p=c(h),f=-e[l],d=c(f);p<d?(o=h,(u+=1)<r&&(p=c(h=t[u]))):(o=f,(l+=1)<n&&(d=c(f=-e[l])));u<r&&p<d||l>=n?(i=h,(u+=1)<r&&(p=c(h=t[u]))):(i=f,(l+=1)<n&&(d=c(f=-e[l])));for(var g,y,m=i+o,v=m-i,_=o-v,x=_,b=m;u<r&&l<n;)p<d?(i=h,(u+=1)<r&&(p=c(h=t[u]))):(i=f,(l+=1)<n&&(d=c(f=-e[l]))),(_=(o=x)-(v=(m=i+o)-i))&&(a[s++]=_),x=b-((g=b+m)-(y=g-b))+(m-y),b=g;for(;u<r;)(_=(o=x)-(v=(m=(i=h)+o)-i))&&(a[s++]=_),x=b-((g=b+m)-(y=g-b))+(m-y),b=g,(u+=1)<r&&(h=t[u]);for(;l<n;)(_=(o=x)-(v=(m=(i=f)+o)-i))&&(a[s++]=_),x=b-((g=b+m)-(y=g-b))+(m-y),b=g,(l+=1)<n&&(f=-e[l]);x&&(a[s++]=x);b&&(a[s++]=b);s||(a[s++]=0);return a.length=s,a},Xt=Ft((function(t){function e(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),o=0,a=0;o<t.length;++o)o!==e&&(i[a++]=t[n][o]);return r}function r(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",r(t.slice(0,e)),",",r(t.slice(e)),")"].join("")}function n(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var i=[],o=0;o<t.length;++o)i.push(["scale(",r(n(e(t,o))),",",(a=o,1&a?"-":""),t[0][o],")"].join(""));return i;var a}function i(t){for(var i=[],o=[],a=function(t){for(var e=new Array(t),r=0;r<t;++r){e[r]=new Array(t);for(var n=0;n<t;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join("")}return e}(t),s=[],u=0;u<t;++u)0==(1&u)?i.push.apply(i,n(e(a,u))):o.push.apply(o,n(e(a,u))),s.push("m"+u);var l=r(i),c=r(o),h="orientation"+t+"Exact",p=["function ",h,"(",s.join(),"){var p=",l,",n=",c,",d=sub(p,n);return d[d.length-1];};return ",h].join("");return new Function("sum","prod","scale","sub",p)(jt,Bt,qt,Gt)}var o=i(3),a=i(4),s=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,r){var n,i=(t[1]-r[1])*(e[0]-r[0]),a=(t[0]-r[0])*(e[1]-r[1]),s=i-a;if(i>0){if(a<=0)return s;n=i+a}else{if(!(i<0))return s;if(a>=0)return s;n=-(i+a)}var u=33306690738754716e-32*n;return s>=u||s<=-u?s:o(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],o=e[0]-n[0],s=r[0]-n[0],u=t[1]-n[1],l=e[1]-n[1],c=r[1]-n[1],h=t[2]-n[2],p=e[2]-n[2],f=r[2]-n[2],d=o*c,g=s*l,y=s*u,m=i*c,v=i*l,_=o*u,x=h*(d-g)+p*(y-m)+f*(v-_),b=7771561172376103e-31*((Math.abs(d)+Math.abs(g))*Math.abs(h)+(Math.abs(y)+Math.abs(m))*Math.abs(p)+(Math.abs(v)+Math.abs(_))*Math.abs(f));return x>b||-x>b?x:a(t,e,r,n)}];function u(t){var e=s[t.length];return e||(e=s[t.length]=i(t.length)),e.apply(void 0,t)}!function(){for(;s.length<=5;)s.push(i(s.length));for(var e=[],r=["slow"],n=0;n<=5;++n)e.push("a"+n),r.push("o"+n);var o=["function getOrientation(",e.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(n=2;n<=5;++n)o.push("case ",n,":return o",n,"(",e.slice(0,n).join(),");");o.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),r.push(o.join(""));var a=Function.apply(void 0,r);for(t.exports=a.apply(void 0,[u].concat(s)),n=0;n<=5;++n)t.exports[n]=s[n]}()})),Zt=Xt[3],Yt=Ht,Wt=Ht;function Ht(t,e){if(!(this instanceof Ht))return new Ht(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||Jt,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}function Jt(t,e){return t<e?-1:t>e?1:0}Ht.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t<n;){var o=1+(t<<1),a=o+1,s=e[o];if(a<this.length&&r(e[a],s)<0&&(o=a,s=e[a]),r(s,i)>=0)break;e[t]=s,t=o}e[t]=i}},Yt.default=Wt;var Kt=function(t,e){for(var r=t[0],n=t[1],i=!1,o=0,a=e.length-1;o<e.length;a=o++){var s=e[o][0],u=e[o][1],l=e[a][0],c=e[a][1];u>n!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(i=!i)}return i},$t=Xt[3],Qt=ee,te=ee;function ee(t,e,r){e=Math.max(0,void 0===e?2:e),r=r||0;for(var n,i=function(t){for(var e=t[0],r=t[0],n=t[0],i=t[0],o=0;o<t.length;o++){var a=t[o];a[0]<e[0]&&(e=a),a[0]>n[0]&&(n=a),a[1]<r[1]&&(r=a),a[1]>i[1]&&(i=a)}var s=[e,r,n,i],u=s.slice();for(o=0;o<t.length;o++)Kt(t[o],s)||u.push(t[o]);var l=function(t){var e=t.length;if(e<3){for(var r=new Array(e),n=0;n<e;++n)r[n]=n;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:r}var i=new Array(e);for(n=0;n<e;++n)i[n]=n;i.sort((function(e,r){return t[e][0]-t[r][0]||t[e][1]-t[r][1]}));var o=[i[0],i[1]],a=[i[0],i[1]];for(n=2;n<e;++n){for(var s=i[n],u=t[s],l=o.length;l>1&&Zt(t[o[l-2]],t[o[l-1]],u)<=0;)l-=1,o.pop();for(o.push(s),l=a.length;l>1&&Zt(t[a[l-2]],t[a[l-1]],u)>=0;)l-=1,a.pop();a.push(s)}r=new Array(a.length+o.length-2);for(var c=0,h=(n=0,o.length);n<h;++n)r[c++]=o[n];for(var p=a.length-2;p>0;--p)r[c++]=a[p];return r}(u),c=[];for(o=0;o<l.length;o++)c.push(u[l[o]]);return c}(t),o=Et(16,["[0]","[1]","[0]","[1]"]).load(t),a=[],s=0;s<i.length;s++){var u=i[s];o.remove(u),n=ue(u,n),a.push(n)}var l=Et(16);for(s=0;s<a.length;s++)l.insert(se(a[s]));for(var c=e*e,h=r*r;a.length;){var p=a.shift(),f=p.p,d=p.next.p,g=le(f,d);if(!(g<h)){var y=g/c;(u=re(o,p.prev.p,f,d,p.next.next.p,y,l))&&Math.min(le(u,f),le(u,d))<=y&&(a.push(p),a.push(ue(u,p)),o.remove(u),l.remove(p),l.insert(se(p)),l.insert(se(p.next)))}}p=n;var m=[];do{m.push(p.p),p=p.next}while(p!==n);return m.push(p.p),m}function re(t,e,r,n,i,o,a){for(var s=new Yt(null,ne),u=t.data;u;){for(var l=0;l<u.children.length;l++){var c=u.children[l],h=u.leaf?ce(c,r,n):ie(r,n,c);h>o||s.push({node:c,dist:h})}for(;s.length&&!s.peek().node.children;){var p=s.pop(),f=p.node,d=ce(f,e,r),g=ce(f,n,i);if(p.dist<d&&p.dist<g&&ae(r,f,a)&&ae(n,f,a))return f}(u=s.pop())&&(u=u.node)}return null}function ne(t,e){return t.dist-e.dist}function ie(t,e,r){if(oe(t,r)||oe(e,r))return 0;var n=he(t[0],t[1],e[0],e[1],r.minX,r.minY,r.maxX,r.minY);if(0===n)return 0;var i=he(t[0],t[1],e[0],e[1],r.minX,r.minY,r.minX,r.maxY);if(0===i)return 0;var o=he(t[0],t[1],e[0],e[1],r.maxX,r.minY,r.maxX,r.maxY);if(0===o)return 0;var a=he(t[0],t[1],e[0],e[1],r.minX,r.maxY,r.maxX,r.maxY);return 0===a?0:Math.min(n,i,o,a)}function oe(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function ae(t,e,r){for(var n,i,o,a,s=Math.min(t[0],e[0]),u=Math.min(t[1],e[1]),l=Math.max(t[0],e[0]),c=Math.max(t[1],e[1]),h=r.search({minX:s,minY:u,maxX:l,maxY:c}),p=0;p<h.length;p++)if(n=h[p].p,i=h[p].next.p,o=t,n!==(a=e)&&i!==o&&$t(n,i,o)>0!=$t(n,i,a)>0&&$t(o,a,n)>0!=$t(o,a,i)>0)return!1;return!0}function se(t){var e=t.p,r=t.next.p;return t.minX=Math.min(e[0],r[0]),t.minY=Math.min(e[1],r[1]),t.maxX=Math.max(e[0],r[0]),t.maxY=Math.max(e[1],r[1]),t}function ue(t,e){var r={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function le(t,e){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function ce(t,e,r){var n=e[0],i=e[1],o=r[0]-n,a=r[1]-i;if(0!==o||0!==a){var s=((t[0]-n)*o+(t[1]-i)*a)/(o*o+a*a);s>1?(n=r[0],i=r[1]):s>0&&(n+=o*s,i+=a*s)}return(o=t[0]-n)*o+(a=t[1]-i)*a}function he(t,e,r,n,i,o,a,s){var u,l,c,h,p=r-t,f=n-e,d=a-i,g=s-o,y=t-i,m=e-o,v=p*p+f*f,_=p*d+f*g,x=d*d+g*g,b=p*y+f*m,w=d*y+g*m,E=v*x-_*_,I=E,S=E;0===E?(l=0,I=1,h=w,S=x):(h=v*w-_*b,(l=_*w-x*b)<0?(l=0,h=w,S=x):l>I&&(l=I,h=w+_,S=x)),h<0?(h=0,-b<0?l=0:-b>v?l=I:(l=-b,I=v)):h>S&&(h=S,-b+_<0?l=0:-b+_>v?l=I:(l=-b+_,I=v));var C=(1-(c=0===h?0:h/S))*i+c*a-((1-(u=0===l?0:l/I))*t+u*r),P=(1-c)*o+c*s-((1-u)*e+u*n);return C*C+P*P}function pe(t,e){void 0===e&&(e={}),e.concavity=e.concavity||1/0;var r=[];if(k(t,(function(t){r.push([t[0],t[1]])})),!r.length)return null;var n=Qt(r,e.concavity);return n.length>3?l([n]):null}function fe(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var n=K(t),i=nt(e),o=i.type,a=e.bbox,s=i.coordinates;if(a&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(n,a))return!1;"Polygon"===o&&(s=[s]);for(var u=!1,l=0;l<s.length&&!u;l++)if(de(n,s[l][0],r.ignoreBoundary)){for(var c=!1,h=1;h<s[l].length&&!c;)de(n,s[l][h],!r.ignoreBoundary)&&(c=!0),h++;c||(u=!0)}return u}function de(t,e,r){var n=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,o=e.length-1;i<e.length;o=i++){var a=e[i][0],s=e[i][1],u=e[o][0],l=e[o][1];if(t[1]*(a-u)+s*(u-t[0])+l*(t[0]-a)==0&&(a-t[0])*(u-t[0])<=0&&(s-t[1])*(l-t[1])<=0)return!r;s>t[1]!=l>t[1]&&t[0]<(u-a)*(t[1]-s)/(l-s)+a&&(n=!n)}return n}function ge(t,e){var r=[];return O(t,(function(t){var n=!1;if("Point"===t.geometry.type)B(e,(function(e){fe(t,e)&&(n=!0)})),n&&r.push(t);else{if("MultiPoint"!==t.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var i=[];B(e,(function(e){k(t,(function(t){fe(t,e)&&(n=!0,i.push(t))}))})),n&&r.push(g(i))}})),f(r)}function ye(t,e,r){void 0===r&&(r={});var n=K(t),i=K(e),o=I(i[1]-n[1]),a=I(i[0]-n[0]),s=I(n[1]),u=I(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(s)*Math.cos(u);return _(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),r.units)}function me(t,e){var r=!1;return f(function(t){if(t.length<3)return[];t.sort(_e);for(var e,r,n,i,o,a,s=t.length-1,u=t[s].x,l=t[0].x,c=t[s].y,h=c;s--;)t[s].y<c&&(c=t[s].y),t[s].y>h&&(h=t[s].y);var p,f=l-u,d=h-c,g=f>d?f:d,y=.5*(l+u),m=.5*(h+c),v=[new ve({__sentinel:!0,x:y-20*g,y:m-g},{__sentinel:!0,x:y,y:m+20*g},{__sentinel:!0,x:y+20*g,y:m-g})],_=[],x=[];s=t.length;for(;s--;){for(x.length=0,p=v.length;p--;)(f=t[s].x-v[p].x)>0&&f*f>v[p].r?(_.push(v[p]),v.splice(p,1)):f*f+(d=t[s].y-v[p].y)*d>v[p].r||(x.push(v[p].a,v[p].b,v[p].b,v[p].c,v[p].c,v[p].a),v.splice(p,1));for(xe(x),p=x.length;p;)r=x[--p],e=x[--p],n=t[s],i=r.x-e.x,o=r.y-e.y,a=2*(i*(n.y-r.y)-o*(n.x-r.x)),Math.abs(a)>1e-12&&v.push(new ve(e,r,n))}Array.prototype.push.apply(_,v),s=_.length;for(;s--;)(_[s].a.__sentinel||_[s].b.__sentinel||_[s].c.__sentinel)&&_.splice(s,1);return _}(t.features.map((function(t){var n={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return e?n.z=t.properties[e]:3===t.geometry.coordinates.length&&(r=!0,n.z=t.geometry.coordinates[2]),n}))).map((function(t){var e=[t.a.x,t.a.y],n=[t.b.x,t.b.y],i=[t.c.x,t.c.y],o={};return r?(e.push(t.a.z),n.push(t.b.z),i.push(t.c.z)):o={a:t.a.z,b:t.b.z,c:t.c.z},l([[e,n,i,e]],o)})))}Qt.default=te;var ve=function(t,e,r){this.a=t,this.b=e,this.c=r;var n,i,o=e.x-t.x,a=e.y-t.y,s=r.x-t.x,u=r.y-t.y,l=o*(t.x+e.x)+a*(t.y+e.y),c=s*(t.x+r.x)+u*(t.y+r.y),h=2*(o*(r.y-e.y)-a*(r.x-e.x));this.x=(u*l-a*c)/h,this.y=(o*c-s*l)/h,n=this.x-t.x,i=this.y-t.y,this.r=n*n+i*i};function _e(t,e){return e.x-t.x}function xe(t){var e,r,n,i,o,a=t.length;t:for(;a;)for(r=t[--a],e=t[--a],n=a;n;)if(o=t[--n],e===(i=t[--n])&&r===o||e===o&&r===i){t.splice(a,2),t.splice(n,2),a-=2;continue t}}function be(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return we(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(r){switch(r){case"type":case"features":return;default:e[r]=t[r]}})),e.features=t.features.map((function(t){return we(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ie(t);default:throw new Error("unknown GeoJSON type")}}function we(t){var e={type:"Feature"};return Object.keys(t).forEach((function(r){switch(r){case"type":case"properties":case"geometry":return;default:e[r]=t[r]}})),e.properties=Ee(t.properties),e.geometry=Ie(t.geometry),e}function Ee(t){var e={};return t?(Object.keys(t).forEach((function(r){var n=t[r];"object"==typeof n?null===n?e[r]=null:Array.isArray(n)?e[r]=n.map((function(t){return t})):e[r]=Ee(n):e[r]=n})),e):e}function Ie(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Ie(t)})),e):(e.coordinates=Se(t.coordinates),e)}function Se(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Se(t)}))}function Ce(t){return t[0].toString()+","+t[1].toString()}function Pe(t){return t}function Me(t,e){var r=function(t){if(null==t)return Pe;var e,r,n=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,s){s||(e=r=0);var u=2,l=t.length,c=new Array(l);for(c[0]=(e+=t[0])*n+o,c[1]=(r+=t[1])*i+a;u<l;)c[u]=t[u],++u;return c}}(t.transform),n=t.arcs;function i(t,e){e.length&&e.pop();for(var i=n[t<0?~t:t],o=0,a=i.length;o<a;++o)e.push(r(i[o],o));t<0&&function(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r}(e,a)}function o(t){return r(t)}function a(t){for(var e=[],r=0,n=t.length;r<n;++r)i(t[r],e);return e.length<2&&e.push(e[0]),e}function s(t){for(var e=a(t);e.length<4;)e.push(e[0]);return e}function u(t){return t.map(s)}return function t(e){var r,n=e.type;switch(n){case"GeometryCollection":return{type:n,geometries:e.geometries.map(t)};case"Point":r=o(e.coordinates);break;case"MultiPoint":r=e.coordinates.map(o);break;case"LineString":r=a(e.arcs);break;case"MultiLineString":r=e.arcs.map(a);break;case"Polygon":r=u(e.arcs);break;case"MultiPolygon":r=e.arcs.map(u);break;default:return null}return{type:n,coordinates:r}}(e)}function Te(t,e){var r={},n=[],i=[];function o(t){t.forEach((function(e){e.forEach((function(e){(r[e=e<0?~e:e]||(r[e]=[])).push(t)}))})),n.push(t)}function a(e){return function(t){for(var e,r=-1,n=t.length,i=t[n-1],o=0;++r<n;)e=i,i=t[r],o+=e[0]*i[1]-e[1]*i[0];return Math.abs(o)}(Me(t,{type:"Polygon",arcs:[e]}).coordinates[0])}return e.forEach((function t(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"Polygon":o(e.arcs);break;case"MultiPolygon":e.arcs.forEach(o)}})),n.forEach((function(t){if(!t._){var e=[],n=[t];for(t._=1,i.push(e);t=n.pop();)e.push(t),t.forEach((function(t){t.forEach((function(t){r[t<0?~t:t].forEach((function(t){t._||(t._=1,n.push(t))}))}))}))}})),n.forEach((function(t){delete t._})),{type:"MultiPolygon",arcs:i.map((function(e){var n,i=[];if(e.forEach((function(t){t.forEach((function(t){t.forEach((function(t){r[t<0?~t:t].length<2&&i.push(t)}))}))})),(n=(i=function(t,e){var r={},n={},i={},o=[],a=-1;function s(t,e){for(var n in t){var i=t[n];delete e[i.start],delete i.start,delete i.end,i.forEach((function(t){r[t<0?~t:t]=1})),o.push(i)}}return e.forEach((function(r,n){var i,o=t.arcs[r<0?~r:r];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++a],e[a]=r,e[n]=i)})),e.forEach((function(e){var r,o,a=function(e){var r,n=t.arcs[e<0?~e:e],i=n[0];t.transform?(r=[0,0],n.forEach((function(t){r[0]+=t[0],r[1]+=t[1]}))):r=n[n.length-1];return e<0?[r,i]:[i,r]}(e),s=a[0],u=a[1];if(r=i[s])if(delete i[r.end],r.push(e),r.end=u,o=n[u]){delete n[o.start];var l=o===r?r:r.concat(o);n[l.start=r.start]=i[l.end=o.end]=l}else n[r.start]=i[r.end]=r;else if(r=n[u])if(delete n[r.start],r.unshift(e),r.start=s,o=i[s]){delete i[o.end];var c=o===r?r:o.concat(r);n[c.start=o.start]=i[c.end=r.end]=c}else n[r.start]=i[r.end]=r;else n[(r=[e]).start=s]=i[r.end=u]=r})),s(i,n),s(n,i),e.forEach((function(t){r[t<0?~t:t]||o.push([t])})),o}(t,i)).length)>1)for(var o,s,u=1,l=a(i[0]);u<n;++u)(o=a(i[u]))>l&&(s=i[0],i[0]=i[u],i[u]=s,l=o);return i})).filter((function(t){return t.length>0}))}}var Le=Object.prototype.hasOwnProperty;function Ae(t,e,r,n,i,o){3===arguments.length&&(n=o=Array,i=null);for(var a=new n(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),s=new o(t),u=t-1,l=0;l<t;++l)a[l]=i;return{set:function(n,o){for(var l=e(n)&u,c=a[l],h=0;c!=i;){if(r(c,n))return s[l]=o;if(++h>=t)throw new Error("full hashmap");c=a[l=l+1&u]}return a[l]=n,s[l]=o,o},maybeSet:function(n,o){for(var l=e(n)&u,c=a[l],h=0;c!=i;){if(r(c,n))return s[l];if(++h>=t)throw new Error("full hashmap");c=a[l=l+1&u]}return a[l]=n,s[l]=o,o},get:function(n,o){for(var l=e(n)&u,c=a[l],h=0;c!=i;){if(r(c,n))return s[l];if(++h>=t)break;c=a[l=l+1&u]}return o},keys:function(){for(var t=[],e=0,r=a.length;e<r;++e){var n=a[e];n!=i&&t.push(n)}return t}}}function ke(t,e){return t[0]===e[0]&&t[1]===e[1]}var Ne=new ArrayBuffer(16),De=new Float64Array(Ne),Re=new Uint32Array(Ne);function Oe(t){De[0]=t[0],De[1]=t[1];var e=Re[0]^Re[1];return 2147483647&(e<<5^e>>7^Re[2]^Re[3])}function ze(t,e,r,n){Fe(t,e,r),Fe(t,e,e+n),Fe(t,e+n,r)}function Fe(t,e,r){for(var n,i=e+(r---e>>1);e<i;++e,--r)n=t[e],t[e]=t[r],t[r]=n}function Be(t){var e={type:"GeometryCollection",geometries:t.features.map(Ue)};return null!=t.bbox&&(e.bbox=t.bbox),e}function Ue(t){var e,r=je(t.geometry);for(e in null!=t.id&&(r.id=t.id),null!=t.bbox&&(r.bbox=t.bbox),t.properties){r.properties=t.properties;break}return r}function je(t){if(null==t)return{type:null};var e="GeometryCollection"===t.type?{type:"GeometryCollection",geometries:t.geometries.map(je)}:"Point"===t.type||"MultiPoint"===t.type?{type:t.type,coordinates:t.coordinates}:{type:t.type,arcs:t.coordinates};return null!=t.bbox&&(e.bbox=t.bbox),e}function Ve(t,e){var r=function(t){var e=1/0,r=1/0,n=-1/0,i=-1/0;function o(t){null!=t&&Le.call(a,t.type)&&a[t.type](t)}var a={GeometryCollection:function(t){t.geometries.forEach(o)},Point:function(t){s(t.coordinates)},MultiPoint:function(t){t.coordinates.forEach(s)},LineString:function(t){u(t.arcs)},MultiLineString:function(t){t.arcs.forEach(u)},Polygon:function(t){t.arcs.forEach(u)},MultiPolygon:function(t){t.arcs.forEach(l)}};function s(t){var o=t[0],a=t[1];o<e&&(e=o),o>n&&(n=o),a<r&&(r=a),a>i&&(i=a)}function u(t){t.forEach(s)}function l(t){t.forEach(u)}for(var c in t)o(t[c]);return n>=e&&i>=r?[e,r,n,i]:void 0}(t=function(t){var e,r,n={};for(e in t)n[e]=null==(r=t[e])?{type:null}:("FeatureCollection"===r.type?Be:"Feature"===r.type?Ue:je)(r);return n}(t)),n=e>0&&r&&function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=o-n?(r-1)/(o-n):1,u=a-i?(r-1)/(a-i):1;function l(t){return[Math.round((t[0]-n)*s),Math.round((t[1]-i)*u)]}function c(t,e){for(var r,o,a,l,c,h=-1,p=0,f=t.length,d=new Array(f);++h<f;)r=t[h],l=Math.round((r[0]-n)*s),c=Math.round((r[1]-i)*u),l===o&&c===a||(d[p++]=[o=l,a=c]);for(d.length=p;p<e;)p=d.push([d[0][0],d[0][1]]);return d}function h(t){return c(t,2)}function p(t){return c(t,4)}function f(t){return t.map(p)}function d(t){null!=t&&Le.call(g,t.type)&&g[t.type](t)}var g={GeometryCollection:function(t){t.geometries.forEach(d)},Point:function(t){t.coordinates=l(t.coordinates)},MultiPoint:function(t){t.coordinates=t.coordinates.map(l)},LineString:function(t){t.arcs=h(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(h)},Polygon:function(t){t.arcs=f(t.arcs)},MultiPolygon:function(t){t.arcs=t.arcs.map(f)}};for(var y in t)d(t[y]);return{scale:[1/s,1/u],translate:[n,i]}}(t,r,e),i=function(t){var e,r,n,i,o=t.coordinates,a=t.lines,s=t.rings,u=a.length+s.length;for(delete t.lines,delete t.rings,n=0,i=a.length;n<i;++n)for(e=a[n];e=e.next;)++u;for(n=0,i=s.length;n<i;++n)for(r=s[n];r=r.next;)++u;var l=Ae(2*u*1.4,Oe,ke),c=t.arcs=[];for(n=0,i=a.length;n<i;++n){e=a[n];do{h(e)}while(e=e.next)}for(n=0,i=s.length;n<i;++n)if((r=s[n]).next)do{h(r)}while(r=r.next);else p(r);function h(t){var e,r,n,i,a,s,u,h;if(n=l.get(e=o[t[0]]))for(u=0,h=n.length;u<h;++u)if(f(i=n[u],t))return t[0]=i[0],void(t[1]=i[1]);if(a=l.get(r=o[t[1]]))for(u=0,h=a.length;u<h;++u)if(d(s=a[u],t))return t[1]=s[0],void(t[0]=s[1]);n?n.push(t):l.set(e,[t]),a?a.push(t):l.set(r,[t]),c.push(t)}function p(t){var e,r,n,i,a;if(r=l.get(o[t[0]]))for(i=0,a=r.length;i<a;++i){if(g(n=r[i],t))return t[0]=n[0],void(t[1]=n[1]);if(y(n,t))return t[0]=n[1],void(t[1]=n[0])}if(r=l.get(e=o[t[0]+m(t)]))for(i=0,a=r.length;i<a;++i){if(g(n=r[i],t))return t[0]=n[0],void(t[1]=n[1]);if(y(n,t))return t[0]=n[1],void(t[1]=n[0])}r?r.push(t):l.set(e,[t]),c.push(t)}function f(t,e){var r=t[0],n=e[0],i=t[1];if(r-i!=n-e[1])return!1;for(;r<=i;++r,++n)if(!ke(o[r],o[n]))return!1;return!0}function d(t,e){var r=t[0],n=e[0],i=t[1],a=e[1];if(r-i!=n-a)return!1;for(;r<=i;++r,--a)if(!ke(o[r],o[a]))return!1;return!0}function g(t,e){var r=t[0],n=e[0],i=t[1]-r;if(i!==e[1]-n)return!1;for(var a=m(t),s=m(e),u=0;u<i;++u)if(!ke(o[r+(u+a)%i],o[n+(u+s)%i]))return!1;return!0}function y(t,e){var r=t[0],n=e[0],i=t[1],a=e[1],s=i-r;if(s!==a-n)return!1;for(var u=m(t),l=s-m(e),c=0;c<s;++c)if(!ke(o[r+(c+u)%s],o[a-(c+l)%s]))return!1;return!0}function m(t){for(var e=t[0],r=t[1],n=e,i=n,a=o[n];++n<r;){var s=o[n];(s[0]<a[0]||s[0]===a[0]&&s[1]<a[1])&&(i=n,a=s)}return i-e}return t}(function(t){var e,r,n,i=function(t){var e,r,n,i,o=t.coordinates,a=t.lines,s=t.rings,u=function(){for(var t=Ae(1.4*o.length,b,w,Int32Array,-1,Int32Array),e=new Int32Array(o.length),r=0,n=o.length;r<n;++r)e[r]=t.maybeSet(r,r);return e}(),l=new Int32Array(o.length),c=new Int32Array(o.length),h=new Int32Array(o.length),p=new Int8Array(o.length),f=0;for(e=0,r=o.length;e<r;++e)l[e]=c[e]=h[e]=-1;for(e=0,r=a.length;e<r;++e){var d=a[e],g=d[0],y=d[1];for(n=u[g],i=u[++g],++f,p[n]=1;++g<=y;)x(e,n,n=i,i=u[g]);++f,p[i]=1}for(e=0,r=o.length;e<r;++e)l[e]=-1;for(e=0,r=s.length;e<r;++e){var m=s[e],v=m[0]+1,_=m[1];for(x(e,u[_-1],n=u[v-1],i=u[v]);++v<=_;)x(e,n,n=i,i=u[v])}function x(t,e,r,n){if(l[r]!==t){l[r]=t;var i=c[r];if(i>=0){var o=h[r];i===e&&o===n||i===n&&o===e||(++f,p[r]=1)}else c[r]=e,h[r]=n}}function b(t){return Oe(o[t])}function w(t,e){return ke(o[t],o[e])}l=c=h=null;var E,I=function(t,e,r,n,i){3===arguments.length&&(n=Array,i=null);for(var o=new n(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),a=t-1,s=0;s<t;++s)o[s]=i;return{add:function(n){for(var s=e(n)&a,u=o[s],l=0;u!=i;){if(r(u,n))return!0;if(++l>=t)throw new Error("full hashset");u=o[s=s+1&a]}return o[s]=n,!0},has:function(n){for(var s=e(n)&a,u=o[s],l=0;u!=i;){if(r(u,n))return!0;if(++l>=t)break;u=o[s=s+1&a]}return!1},values:function(){for(var t=[],e=0,r=o.length;e<r;++e){var n=o[e];n!=i&&t.push(n)}return t}}}(1.4*f,Oe,ke);for(e=0,r=o.length;e<r;++e)p[E=u[e]]&&I.add(o[E]);return I}(t),o=t.coordinates,a=t.lines,s=t.rings;for(r=0,n=a.length;r<n;++r)for(var u=a[r],l=u[0],c=u[1];++l<c;)i.has(o[l])&&(e={0:l,1:u[1]},u[1]=l,u=u.next=e);for(r=0,n=s.length;r<n;++r)for(var h=s[r],p=h[0],f=p,d=h[1],g=i.has(o[p]);++f<d;)i.has(o[f])&&(g?(e={0:f,1:h[1]},h[1]=f,h=h.next=e):(ze(o,p,d,d-f),o[d]=o[p],g=!0,f=p));return t}(function(t){var e=-1,r=[],n=[],i=[];function o(t){t&&Le.call(a,t.type)&&a[t.type](t)}var a={GeometryCollection:function(t){t.geometries.forEach(o)},LineString:function(t){t.arcs=s(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(s)},Polygon:function(t){t.arcs=t.arcs.map(u)},MultiPolygon:function(t){t.arcs=t.arcs.map(l)}};function s(t){for(var n=0,o=t.length;n<o;++n)i[++e]=t[n];var a={0:e-o+1,1:e};return r.push(a),a}function u(t){for(var r=0,o=t.length;r<o;++r)i[++e]=t[r];var a={0:e-o+1,1:e};return n.push(a),a}function l(t){return t.map(u)}for(var c in t)o(t[c]);return{type:"Topology",coordinates:i,lines:r,rings:n,objects:t}}(t))),o=i.coordinates,a=Ae(1.4*i.arcs.length,qe,Ge);function s(t){t&&Le.call(u,t.type)&&u[t.type](t)}t=i.objects,i.bbox=r,i.arcs=i.arcs.map((function(t,e){return a.set(t,e),o.slice(t[0],t[1]+1)})),delete i.coordinates,o=null;var u={GeometryCollection:function(t){t.geometries.forEach(s)},LineString:function(t){t.arcs=l(t.arcs)},MultiLineString:function(t){t.arcs=t.arcs.map(l)},Polygon:function(t){t.arcs=t.arcs.map(l)},MultiPolygon:function(t){t.arcs=t.arcs.map(c)}};function l(t){var e=[];do{var r=a.get(t);e.push(t[0]<t[1]?r:~r)}while(t=t.next);return e}function c(t){return t.map(l)}for(var h in t)s(t[h]);return n&&(i.transform=n,i.arcs=function(t){for(var e=-1,r=t.length;++e<r;){for(var n,i,o=t[e],a=0,s=1,u=o.length,l=o[0],c=l[0],h=l[1];++a<u;)n=(l=o[a])[0],i=l[1],n===c&&i===h||(o[s++]=[n-c,i-h],c=n,h=i);1===s&&(o[s++]=[0,0]),o.length=s}return t}(i.arcs)),i}function qe(t){var e,r=t[0],n=t[1];return n<r&&(e=r,r=n,n=e),r+31*n}function Ge(t,e){var r,n=t[0],i=t[1],o=e[0],a=e[1];return i<n&&(r=n,n=i,i=r),a<o&&(r=o,o=a,a=r),n===o&&i===a}function Xe(t,e){if(void 0===e&&(e={}),"FeatureCollection"!==it(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==e.mutate&&void 0!==e.mutate||(t=be(t));var r=[];j(t,(function(t){r.push(t.geometry)}));var n=Ve({geoms:m(r).geometry});return function(t){return Me(t,Te.apply(this,arguments))}(n,n.objects.geoms.geometries)}function Ze(t,e){if(void 0===e&&(e={}),!M(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if("FeatureCollection"!==it(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==r&&void 0!==r||(t=be(t));var n=function(t){var e={};j(t,(function(t){e[t.geometry.type]=!0}));var r=Object.keys(e);return 1===r.length?r[0]:null}(t);if(!n)throw new Error("geojson must be homogenous");var i=t;switch(n){case"LineString":return function(t,e){if(void 0===e&&(e={}),!M(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if("FeatureCollection"!==it(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==r&&void 0!==r||(t=be(t));var n=[],i=Z(t,(function(t,e){var r=function(t,e){var r,n=t.geometry.coordinates,i=e.geometry.coordinates,o=Ce(n[0]),a=Ce(n[n.length-1]),s=Ce(i[0]),u=Ce(i[i.length-1]);if(o===u)r=i.concat(n.slice(1));else if(s===a)r=n.concat(i.slice(1));else if(o===s)r=n.slice(1).reverse().concat(i);else{if(a!==u)return null;r=n.concat(i.reverse().slice(1))}return h(r)}(t,e);return r||(n.push(t),e)}));return i&&n.push(i),n.length?1===n.length?n[0]:d(n.map((function(t){return t.coordinates}))):null}(i,e);case"Polygon":return Xe(i,e);default:throw new Error(n+" is not supported")}}function Ye(t,e){void 0===e&&(e={});var r="object"==typeof e?e.mutate:e;if(!t)throw new Error("geojson is required");var n=it(t),i=[];switch(n){case"LineString":i=We(t);break;case"MultiLineString":case"Polygon":$(t).forEach((function(t){i.push(We(t))}));break;case"MultiPolygon":$(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(We(t))})),i.push(e)}));break;case"Point":return t;case"MultiPoint":var a={};$(t).forEach((function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(a,e)||(i.push(t),a[e]=!0)}));break;default:throw new Error(n+" geometry not supported")}return t.coordinates?!0===r?(t.coordinates=i,t):{type:n,coordinates:i}:!0===r?(t.geometry.coordinates=i,t):o({type:n,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}function We(t){var e=$(t);if(2===e.length&&!He(e[0],e[1]))return e;var r=[],n=e.length-1,i=r.length;r.push(e[0]);for(var o=1;o<n;o++){var a=r[r.length-1];e[o][0]===a[0]&&e[o][1]===a[1]||(r.push(e[o]),(i=r.length)>2&&Je(r[i-3],r[i-1],r[i-2])&&r.splice(r.length-2,1))}if(r.push(e[e.length-1]),i=r.length,He(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return Je(r[i-3],r[i-1],r[i-2])&&r.splice(r.length-2,1),r}function He(t,e){return t[0]===e[0]&&t[1]===e[1]}function Je(t,e,r){var n=r[0],i=r[1],o=t[0],a=t[1],s=e[0],u=e[1],l=s-o,c=u-a;return 0==(n-o)*c-(i-a)*l&&(Math.abs(l)>=Math.abs(c)?l>0?o<=n&&n<=s:s<=n&&n<=o:c>0?a<=i&&i<=u:u<=i&&i<=a)}function Ke(t,e,r){var n=e.x,i=e.y,o=r.x-n,a=r.y-i;if(0!==o||0!==a){var s=((t.x-n)*o+(t.y-i)*a)/(o*o+a*a);s>1?(n=r.x,i=r.y):s>0&&(n+=o*s,i+=a*s)}return(o=t.x-n)*o+(a=t.y-i)*a}function $e(t,e,r,n,i){for(var o,a=n,s=e+1;s<r;s++){var u=Ke(t[s],t[e],t[r]);u>a&&(o=s,a=u)}a>n&&(o-e>1&&$e(t,e,o,n,i),i.push(t[o]),r-o>1&&$e(t,o,r,n,i))}function Qe(t,e){var r=t.length-1,n=[t[0]];return $e(t,0,r,e,n),n.push(t[r]),n}function tr(t,e,r){if(t.length<=2)return t;var n=void 0!==e?e*e:1;return Qe(t=r?t:function(t,e){for(var r,n,i,o,a,s=t[0],u=[s],l=1,c=t.length;l<c;l++)i=s,void 0,void 0,(o=(n=r=t[l]).x-i.x)*o+(a=n.y-i.y)*a>e&&(u.push(r),s=r);return s!==r&&u.push(r),u}(t,n),n)}function er(t,e,r){return tr(t.map((function(t){return{x:t[0],y:t[1],z:t[2]}})),e,r).map((function(t){return t.z?[t.x,t.y,t.z]:[t.x,t.y]}))}function rr(t,e,r){return t.map((function(t){var n=t.map((function(t){return{x:t[0],y:t[1]}}));if(n.length<4)throw new Error("invalid polygon");for(var i=tr(n,e,r).map((function(t){return[t.x,t.y]}));!nr(i);)i=tr(n,e-=.01*e,r).map((function(t){return[t.x,t.y]}));return i[i.length-1][0]===i[0][0]&&i[i.length-1][1]===i[0][1]||i.push(i[0]),i}))}function nr(t){return!(t.length<3||3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}var ir=function(){function t(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(e=0;e<this.length-1;e++){var r=this.points[e],n=this.points[e+1];this.centers.push({x:(r.x+n.x)/2,y:(r.y+n.y)/2,z:(r.z+n.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(e=0;e<this.centers.length-1;e++){var i=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,o=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,a=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+o),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+a)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+i),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+o),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+a)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return t.prototype.cacheSteps=function(t){var e=[],r=this.pos(0);e.push(0);for(var n=0;n<this.duration;n+=10){var i=this.pos(n);Math.sqrt((i.x-r.x)*(i.x-r.x)+(i.y-r.y)*(i.y-r.y)+(i.z-r.z)*(i.z-r.z))>t&&(e.push(n),r=i)}return e},t.prototype.vector=function(t){var e=this.pos(t+10),r=this.pos(t-10);return{angle:180*Math.atan2(e.y-r.y,e.x-r.x)/3.14,speed:Math.sqrt((r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y)+(r.z-e.z)*(r.z-e.z))}},t.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var r=e/this.duration;if(r>=1)return this.points[this.length-1];var n=Math.floor((this.points.length-1)*r);return function(t,e,r,n,i){var o=function(t){var e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(t);return{x:i.x*o[0]+n.x*o[1]+r.x*o[2]+e.x*o[3],y:i.y*o[0]+n.y*o[1]+r.y*o[2]+e.y*o[3],z:i.z*o[0]+n.z*o[1]+r.z*o[2]+e.z*o[3]}}((this.length-1)*r-n,this.points[n],this.controls[n][1],this.controls[n+1][0],this.points[n+1])},t}();function or(t,e){void 0===e&&(e={});for(var r=e.resolution||1e4,n=e.sharpness||.85,i=[],o=nt(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),a=new ir({duration:r,points:o,sharpness:n}),s=function(t){var e=a.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},u=0;u<a.duration;u+=10)s(u);return s(a.duration),h(i,e.properties)}function ar(t,e){void 0===e&&(e={});var r=Number(t[0]),n=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var a=[r,n];return l([[a,[i,n],[i,o],[r,o],a]],e.properties,{bbox:t,id:e.id})}function sr(t){return ar(J(t))}function ur(t){var e=t[0],r=t[1],n=t[2],i=t[3];if(ye(t.slice(0,2),[n,r])>=ye(t.slice(0,2),[e,i])){var o=(r+i)/2;return[e,o-(n-e)/2,n,o+(n-e)/2]}var a=(e+n)/2;return[a-(i-r)/2,r,a+(i-r)/2,i]}function lr(t,e,r,n){void 0===n&&(n={});var i=K(t),o=I(i[0]),a=I(i[1]),u=I(r),l=x(e,n.units),c=Math.asin(Math.sin(a)*Math.cos(l)+Math.cos(a)*Math.sin(l)*Math.cos(u));return s([E(o+Math.atan2(Math.sin(u)*Math.sin(l)*Math.cos(a),Math.cos(l)-Math.sin(a)*Math.sin(c))),E(c)],n.properties)}function cr(t,e,r){void 0===r&&(r={});for(var n=r.steps||64,i=r.properties?r.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},o=[],a=0;a<n;a++)o.push(lr(t,e,-360*a/n,r).geometry.coordinates);return o.push(o[0]),l([o],i)}function hr(t,e,r){if(void 0===r&&(r={}),!0===r.final)return function(t,e){var r=hr(e,t);return(r+180)%360}(t,e);var n=K(t),i=K(e),o=I(n[0]),a=I(i[0]),s=I(n[1]),u=I(i[1]),l=Math.sin(a-o)*Math.cos(u),c=Math.cos(s)*Math.sin(u)-Math.sin(s)*Math.cos(u)*Math.cos(a-o);return E(Math.atan2(l,c))}function pr(t,e){void 0===e&&(e={});var r=J(t);return s([(r[0]+r[2])/2,(r[1]+r[3])/2],e.properties,e)}function fr(t,e){void 0===e&&(e={});var r=0,n=0,i=0;return k(t,(function(t){r+=t[0],n+=t[1],i++}),!0),s([r/i,n/i],e.properties)}function dr(t){var e=[];return"FeatureCollection"===t.type?O(t,(function(t){k(t,(function(r){e.push(s(r,t.properties))}))})):k(t,(function(r){e.push(s(r,t.properties))})),f(e)}var gr=mr,yr=mr;function mr(t,e,r){r=r||2;var n,i,o,a,s,u,l,c=e&&e.length,h=c?e[0]*r:t.length,p=vr(t,0,h,r,!0),f=[];if(!p)return f;if(c&&(p=function(t,e,r,n){var i,o,a,s=[];for(i=0,o=e.length;i<o;i++)(a=vr(t,e[i]*n,i<o-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),s.push(Mr(a));for(s.sort(Sr),i=0;i<s.length;i++)Cr(s[i],r),r=_r(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=o=t[0],i=a=t[1];for(var d=r;d<h;d+=r)(s=t[d])<n&&(n=s),(u=t[d+1])<i&&(i=u),s>o&&(o=s),u>a&&(a=u);l=0!==(l=Math.max(o-n,a-i))?1/l:0}return xr(p,f,r,n,i,l),f}function vr(t,e,r,n,i){var o,a;if(i===Br(t,e,r,n)>0)for(o=e;o<r;o+=n)a=Or(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=Or(o,t[o],t[o+1],a);return a&&kr(a,a.next)&&(zr(a),a=a.next),a}function _r(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!kr(n,n.next)&&0!==Ar(n.prev,n,n.next))n=n.next;else{if(zr(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function xr(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Pr(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,o,a,s,u,l=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,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--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(a>1)}(i)}(t,n,i,o);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?wr(t,n,i,o):br(t))e.push(s.i/r),e.push(t.i/r),e.push(u.i/r),zr(t),t=u.next,l=u.next;else if((t=u)===l){a?1===a?xr(t=Er(t,e,r),e,r,n,i,o,2):2===a&&Ir(t,e,r,n,i,o):xr(_r(t),e,r,n,i,o,1);break}}}function br(t){var e=t.prev,r=t,n=t.next;if(Ar(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Tr(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Ar(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function wr(t,e,r,n){var i=t.prev,o=t,a=t.next;if(Ar(i,o,a)>=0)return!1;for(var s=i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,u=i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,l=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=Pr(s,u,e,r,n),p=Pr(l,c,e,r,n),f=t.prevZ,d=t.nextZ;f&&f.z>=h&&d&&d.z<=p;){if(f!==t.prev&&f!==t.next&&Tr(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Ar(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,d!==t.prev&&d!==t.next&&Tr(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Ar(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&Tr(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Ar(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=p;){if(d!==t.prev&&d!==t.next&&Tr(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Ar(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function Er(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!kr(i,o)&&Nr(i,n,n.next,o)&&Dr(i,o)&&Dr(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),zr(n),zr(n.next),n=t=o),n=n.next}while(n!==t);return n}function Ir(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Lr(a,s)){var u=Rr(a,s);return a=_r(a,a.next),u=_r(u,u.next),xr(a,e,r,n,i,o),void xr(u,e,r,n,i,o)}s=s.next}a=a.next}while(a!==t)}function Sr(t,e){return t.x-e.x}function Cr(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===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===a)return r.prev;var u,l=r,c=r.x,h=r.y,p=1/0;n=r.next;for(;n!==l;)i>=n.x&&n.x>=c&&i!==n.x&&Tr(o<h?i:a,o,c,h,o<h?a:i,o,n.x,n.y)&&((u=Math.abs(o-n.y)/(i-n.x))<p||u===p&&n.x>r.x)&&Dr(n,t)&&(r=n,p=u),n=n.next;return r}(t,e)){var r=Rr(e,t);_r(r,r.next)}}function Pr(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 Mr(t){var e=t,r=t;do{e.x<r.x&&(r=e),e=e.next}while(e!==t);return r}function Tr(t,e,r,n,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function Lr(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&&Nr(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&Dr(t,e)&&Dr(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)}function Ar(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function kr(t,e){return t.x===e.x&&t.y===e.y}function Nr(t,e,r,n){return!!(kr(t,e)&&kr(r,n)||kr(t,n)&&kr(r,e))||Ar(t,e,r)>0!=Ar(t,e,n)>0&&Ar(r,n,t)>0!=Ar(r,n,e)>0}function Dr(t,e){return Ar(t.prev,t,t.next)<0?Ar(t,e,t.next)>=0&&Ar(t,t.prev,e)>=0:Ar(t,e,t.prev)<0||Ar(t,t.next,e)<0}function Rr(t,e){var r=new Fr(t.i,t.x,t.y),n=new Fr(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Or(t,e,r,n){var i=new Fr(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 zr(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 Fr(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 Br(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}function Ur(t){var e=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}(t),r=gr(e.vertices,e.holes,2),n=[],i=[];r.forEach((function(t,n){var o=r[n];i.push([e.vertices[2*o],e.vertices[2*o+1]])}));for(var o=0;o<i.length;o+=3){var a=i.slice(o,o+3);a.push(i[o]),n.push(l([a]))}return n}function jr(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var r,n=1/0,i=0;return O(e,(function(e,r){var o=ye(t,e);o<n&&(i=r,n=o)})),(r=be(e.features[i])).properties.featureIndex=i,r.properties.distanceToPoint=n,r}function Vr(t){if(!t)throw new Error("geojson is required");var e=[];return j(t,(function(t){!function(t,e){var r=[],n=t.geometry;if(null!==n){switch(n.type){case"Polygon":r=$(n);break;case"LineString":r=[$(n)]}r.forEach((function(r){(function(t,e){var r=[];return t.reduce((function(t,n){var i=h([t,n],e);return i.bbox=function(t,e){var r=t[0],n=t[1],i=e[0],o=e[1];return[r<i?r:i,n<o?n:o,r>i?r:i,n>o?n:o]}(t,n),r.push(i),n})),r})(r,t.properties).forEach((function(t){t.id=e.length,e.push(t)}))}))}}(t,e)})),f(e)}mr.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(Br(t,0,o,r));if(i)for(var s=0,u=e.length;s<u;s++){var l=e[s]*r,c=s<u-1?e[s+1]*r:t.length;a-=Math.abs(Br(t,l,c,r))}var h=0;for(s=0;s<n.length;s+=3){var p=n[s]*r,f=n[s+1]*r,d=n[s+2]*r;h+=Math.abs((t[p]-t[d])*(t[f+1]-t[p+1])-(t[p]-t[f])*(t[d+1]-t[p+1]))}return 0===a&&0===h?0:Math.abs((h-a)/a)},mr.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 o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r},gr.default=yr;var qr=Ft((function(t,e){function r(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function n(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!f(t[0])||!f(t[1]))throw new Error("coordinates must contain numbers");return r({type:"Point",coordinates:t},e,n)}function i(t,e,n){void 0===n&&(n={});for(var i=0,o=t;i<o.length;i++){var a=o[i];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:t},e,n)}function o(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return r({type:"LineString",coordinates:t},e,n)}function a(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function s(t,e,n){return void 0===n&&(n={}),r({type:"MultiLineString",coordinates:t},e,n)}function u(t,e,n){return void 0===n&&(n={}),r({type:"MultiPoint",coordinates:t},e,n)}function l(t,e,n){return void 0===n&&(n={}),r({type:"MultiPolygon",coordinates:t},e,n)}function c(t,r){void 0===r&&(r="kilometers");var n=e.factors[r];if(!n)throw new Error(r+" units is invalid");return t*n}function h(t,r){void 0===r&&(r="kilometers");var n=e.factors[r];if(!n)throw new Error(r+" units is invalid");return t/n}function p(t){return t%(2*Math.PI)*180/Math.PI}function f(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=6371008.8,e.factors={centimeters:100*e.earthRadius,centimetres:100*e.earthRadius,degrees:e.earthRadius/111325,feet:3.28084*e.earthRadius,inches:39.37*e.earthRadius,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:1e3*e.earthRadius,millimetres:1e3*e.earthRadius,nauticalmiles:e.earthRadius/1852,radians:1,yards:1.0936*e.earthRadius},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1.0936133},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},e.feature=r,e.geometry=function(t,e,r){switch(t){case"Point":return n(e).geometry;case"LineString":return o(e).geometry;case"Polygon":return i(e).geometry;case"MultiPoint":return u(e).geometry;case"MultiLineString":return s(e).geometry;case"MultiPolygon":return l(e).geometry;default:throw new Error(t+" is invalid")}},e.point=n,e.points=function(t,e,r){return void 0===r&&(r={}),a(t.map((function(t){return n(t,e)})),r)},e.polygon=i,e.polygons=function(t,e,r){return void 0===r&&(r={}),a(t.map((function(t){return i(t,e)})),r)},e.lineString=o,e.lineStrings=function(t,e,r){return void 0===r&&(r={}),a(t.map((function(t){return o(t,e)})),r)},e.featureCollection=a,e.multiLineString=s,e.multiPoint=u,e.multiPolygon=l,e.geometryCollection=function(t,e,n){return void 0===n&&(n={}),r({type:"GeometryCollection",geometries:t},e,n)},e.round=function(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},e.radiansToLength=c,e.lengthToRadians=h,e.lengthToDegrees=function(t,e){return p(h(t,e))},e.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=p,e.degreesToRadians=function(t){return t%360*Math.PI/180},e.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return c(h(t,e),r)},e.convertArea=function(t,r,n){if(void 0===r&&(r="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=e.areaFactors[r];if(!i)throw new Error("invalid original units");var o=e.areaFactors[n];if(!o)throw new Error("invalid final units");return t/i*o},e.isNumber=f,e.isObject=function(t){return!!t&&t.constructor===Object},e.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!f(t))throw new Error("bbox must only contain numbers")}))},e.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}}));function Gr(t,e,r){if(null!==t)for(var n,i,o,a,s,u,l,c,h=0,p=0,f=t.type,d="FeatureCollection"===f,g="Feature"===f,y=d?t.features.length:1,m=0;m<y;m++){s=(c=!!(l=d?t.features[m].geometry:g?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var v=0;v<s;v++){var _=0,x=0;if(null!==(a=c?l.geometries[v]:l)){u=a.coordinates;var b=a.type;switch(h=!r||"Polygon"!==b&&"MultiPolygon"!==b?0:1,b){case null:break;case"Point":if(!1===e(u,p,m,_,x))return!1;p++,_++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],p,m,_,x))return!1;p++,"MultiPoint"===b&&_++}"LineString"===b&&_++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-h;i++){if(!1===e(u[n][i],p,m,_,x))return!1;p++}"MultiLineString"===b&&_++,"Polygon"===b&&x++}"Polygon"===b&&_++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(x=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-h;o++){if(!1===e(u[n][i][o],p,m,_,x))return!1;p++}x++}_++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(!1===Gr(a.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Xr(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&!1!==e(t.features[r].properties,r);r++);break;case"Feature":e(t.properties,0)}}function Zr(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length&&!1!==e(t.features[r],r);r++);}function Yr(t,e){var r,n,i,o,a,s,u,l,c,h,p=0,f="FeatureCollection"===t.type,d="Feature"===t.type,g=f?t.features.length:1;for(r=0;r<g;r++){for(s=f?t.features[r].geometry:d?t.geometry:t,l=f?t.features[r].properties:d?t.properties:{},c=f?t.features[r].bbox:d?t.bbox:void 0,h=f?t.features[r].id:d?t.id:void 0,a=(u=!!s&&"GeometryCollection"===s.type)?s.geometries.length:1,i=0;i<a;i++)if(null!==(o=u?s.geometries[i]:s))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,p,l,c,h))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===e(o.geometries[n],p,l,c,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,p,l,c,h))return!1;p++}}function Wr(t,e){Yr(t,(function(t,r,n,i,o){var a,s=null===t?null:t.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return!1!==e(qr.feature(t,n,{bbox:i,id:o}),r,0)&&void 0}switch(s){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}for(var u=0;u<t.coordinates.length;u++){var l={type:a,coordinates:t.coordinates[u]};if(!1===e(qr.feature(l,n),r,u))return!1}}))}function Hr(t,e){Wr(t,(function(t,r,n){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var a,s=0,u=0,l=0;return!1!==Gr(t,(function(o,c,h,p,f){if(void 0===a||r>s||p>u||f>l)return a=o,s=r,u=p,l=f,void(i=0);var d=qr.lineString([a,o],t.properties);if(!1===e(d,r,n,f,i))return!1;i++,a=o}))&&void 0}}}))}function Jr(t,e){if(!t)throw new Error("geojson is required");Wr(t,(function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var a=0;a<o.length;a++)if(!1===e(qr.lineString(o[a],t.properties),r,n,a))return!1}}}))}var Kr=Gr,$r=Zr,Qr=Wr,tn=Yr,en=Jr,rn=Xr,nn=Hr,on=Object.defineProperty({coordAll:function(t){var e=[];return Gr(t,(function(t){e.push(t)})),e},coordEach:Kr,coordReduce:function(t,e,r,n){var i=r;return Gr(t,(function(t,n,o,a,s){i=0===n&&void 0===r?t:e(i,t,n,o,a,s)}),n),i},featureEach:$r,featureReduce:function(t,e,r){var n=r;return Zr(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n},findPoint:function(t,e){if(e=e||{},!qr.isObject(e))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,a=e.coordIndex||0,s=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),s=s||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":s=s||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":return qr.point(u,s,e);case"MultiPoint":return i<0&&(i=u.length+i),qr.point(u[i],s,e);case"LineString":return a<0&&(a=u.length+a),qr.point(u[a],s,e);case"Polygon":return o<0&&(o=u.length+o),a<0&&(a=u[o].length+a),qr.point(u[o][a],s,e);case"MultiLineString":return i<0&&(i=u.length+i),a<0&&(a=u[i].length+a),qr.point(u[i][a],s,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),a<0&&(a=u[i][o].length-a),qr.point(u[i][o][a],s,e)}throw new Error("geojson is invalid")},findSegment:function(t,e){if(e=e||{},!qr.isObject(e))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,a=e.segmentIndex||0,s=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),s=s||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":s=s||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return a<0&&(a=u.length+a-1),qr.lineString([u[a],u[a+1]],s,e);case"Polygon":return o<0&&(o=u.length+o),a<0&&(a=u[o].length+a-1),qr.lineString([u[o][a],u[o][a+1]],s,e);case"MultiLineString":return i<0&&(i=u.length+i),a<0&&(a=u[i].length+a-1),qr.lineString([u[i][a],u[i][a+1]],s,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),a<0&&(a=u[i][o].length-a-1),qr.lineString([u[i][o][a],u[i][o][a+1]],s,e)}throw new Error("geojson is invalid")},flattenEach:Qr,flattenReduce:function(t,e,r){var n=r;return Wr(t,(function(t,i,o){n=0===i&&0===o&&void 0===r?t:e(n,t,i,o)})),n},geomEach:tn,geomReduce:function(t,e,r){var n=r;return Yr(t,(function(t,i,o,a,s){n=0===i&&void 0===r?t:e(n,t,i,o,a,s)})),n},lineEach:en,lineReduce:function(t,e,r){var n=r;return Jr(t,(function(t,i,o,a){n=0===i&&void 0===r?t:e(n,t,i,o,a)})),n},propEach:rn,propReduce:function(t,e,r){var n=r;return Xr(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n},segmentEach:nn,segmentReduce:function(t,e,r){var n=r,i=!1;return Hr(t,(function(t,o,a,s,u){n=!1===i&&void 0===r?t:e(n,t,o,a,s,u),i=!0})),n}},"__esModule",{value:!0});function an(t){var e=[1/0,1/0,-1/0,-1/0];return on.coordEach(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}an.default=an;var sn=an,un=Object.defineProperty({default:sn},"__esModule",{value:!0}).default,ln=on.featureEach,cn=(on.coordEach,qr.polygon,qr.featureCollection);function hn(t){var e=Et(t);return e.insert=function(t){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:un(t),Et.prototype.insert.call(this,t)},e.load=function(t){var e=[];return Array.isArray(t)?t.forEach((function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:un(t),e.push(t)})):ln(t,(function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:un(t),e.push(t)})),Et.prototype.load.call(this,e)},e.remove=function(t,e){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:un(t),Et.prototype.remove.call(this,t,e)},e.clear=function(){return Et.prototype.clear.call(this)},e.search=function(t){var e=Et.prototype.search.call(this,this.toBBox(t));return cn(e)},e.collides=function(t){return Et.prototype.collides.call(this,this.toBBox(t))},e.all=function(){var t=Et.prototype.all.call(this);return cn(t)},e.toJSON=function(){return Et.prototype.toJSON.call(this)},e.fromJSON=function(t){return Et.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var e;if(t.bbox)e=t.bbox;else if(Array.isArray(t)&&4===t.length)e=t;else if(Array.isArray(t)&&6===t.length)e=[t[0],t[1],t[3],t[4]];else if("Feature"===t.type)e=un(t);else{if("FeatureCollection"!==t.type)throw new Error("invalid geojson");e=un(t)}return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}},e}var pn=hn,fn=hn;function dn(t,e){var r={},n=[];if("LineString"===t.type&&(t=o(t)),"LineString"===e.type&&(e=o(e)),"Feature"===t.type&&"Feature"===e.type&&null!==t.geometry&&null!==e.geometry&&"LineString"===t.geometry.type&&"LineString"===e.geometry.type&&2===t.geometry.coordinates.length&&2===e.geometry.coordinates.length){var i=gn(t,e);return i&&n.push(i),f(n)}var a=pn();return a.load(Vr(e)),O(Vr(t),(function(t){O(a.search(t),(function(e){var i=gn(t,e);if(i){var o=$(i).join(",");r[o]||(r[o]=!0,n.push(i))}}))})),f(n)}function gn(t,e){var r=$(t),n=$(e);if(2!==r.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==n.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var i=r[0][0],o=r[0][1],a=r[1][0],u=r[1][1],l=n[0][0],c=n[0][1],h=n[1][0],p=n[1][1],f=(p-c)*(a-i)-(h-l)*(u-o);if(0===f)return null;var d=((h-l)*(o-c)-(p-c)*(i-l))/f,g=((a-i)*(o-c)-(u-o)*(i-l))/f;return d>=0&&d<=1&&g>=0&&g<=1?s([i+d*(a-i),o+d*(u-o)]):null}function yn(t,e,r){void 0===r&&(r={});var n=s([1/0,1/0],{dist:1/0}),i=0;return j(t,(function(t){for(var o=$(t),a=0;a<o.length-1;a++){var u=s(o[a]);u.properties.dist=ye(e,u,r);var l=s(o[a+1]);l.properties.dist=ye(e,l,r);var c=ye(u,l,r),p=Math.max(u.properties.dist,l.properties.dist),f=hr(u,l),d=lr(e,p,f+90,r),g=lr(e,p,f-90,r),y=dn(h([d.geometry.coordinates,g.geometry.coordinates]),h([u.geometry.coordinates,l.geometry.coordinates])),m=null;y.features.length>0&&((m=y.features[0]).properties.dist=ye(e,m,r),m.properties.location=i+ye(u,m,r)),u.properties.dist<n.properties.dist&&((n=u).properties.index=a,n.properties.location=i),l.properties.dist<n.properties.dist&&((n=l).properties.index=a+1,n.properties.location=i+c),m&&m.properties.dist<n.properties.dist&&((n=m).properties.index=a),i+=c}})),n}function mn(t,r,n){void 0===n&&(n={});var i=K(t),o=K(r);return o[0]+=o[0]-i[0]>180?-360:i[0]-o[0]>180?360:0,S(function(t,r,n){var i=n=void 0===n?e:Number(n),o=t[1]*Math.PI/180,a=r[1]*Math.PI/180,s=a-o,u=Math.abs(r[0]-t[0])*Math.PI/180;u>Math.PI&&(u-=2*Math.PI);var l=Math.log(Math.tan(a/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),c=Math.abs(l)>1e-11?s/l:Math.cos(o);return Math.sqrt(s*s+c*c*u*u)*i}(i,o),"meters",n.units)}function vn(t,e,r){if(void 0===r&&(r={}),r.method||(r.method="geodesic"),r.units||(r.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=s(t):"Point"===t.type?t=o(t):et(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=h(e):"LineString"===e.type?e=o(e):et(e,"LineString","line");var n=1/0,i=t.geometry.coordinates;return q(e,(function(t){var e=t.geometry.coordinates[0],o=t.geometry.coordinates[1],a=function(t,e,r,n){var i=[r[0]-e[0],r[1]-e[1]],o=_n([t[0]-e[0],t[1]-e[1]],i);if(o<=0)return xn(t,e,{method:n.method,units:"degrees"});var a=_n(i,i);if(a<=o)return xn(t,r,{method:n.method,units:"degrees"});var s=o/a;return xn(t,[e[0]+s*i[0],e[1]+s*i[1]],{method:n.method,units:"degrees"})}(i,e,o,r);a<n&&(n=a)})),S(n,"degrees",r.units)}function _n(t,e){return t[0]*e[0]+t[1]*e[1]}function xn(t,e,r){return"planar"===r.method?mn(t,e,r):ye(t,e,r)}function bn(t,e,r,n,i,o,a,s){var u,l,c,h,p={x:null,y:null,onLine1:!1,onLine2:!1};return 0==(u=(s-o)*(r-t)-(a-i)*(n-e))?null!==p.x&&null!==p.y&&p:(h=(r-t)*(l=e-o)-(n-e)*(c=t-i),l=((a-i)*l-(s-o)*c)/u,c=h/u,p.x=t+l*(r-t),p.y=e+l*(n-e),l>=0&&l<=1&&(p.onLine1=!0),c>=0&&c<=1&&(p.onLine2=!0),!(!p.onLine1||!p.onLine2)&&[p.x,p.y])}function wn(t){for(var e=function(t){return"FeatureCollection"!==t.type?"Feature"!==t.type?f([o(t)]):f([t]):t}(t),r=pr(e),n=!1,i=0;!n&&i<e.features.length;){var a,u=e.features[i].geometry,l=!1;if("Point"===u.type)r.geometry.coordinates[0]===u.coordinates[0]&&r.geometry.coordinates[1]===u.coordinates[1]&&(n=!0);else if("MultiPoint"===u.type){var c=!1;for(a=0;!c&&a<u.coordinates.length;)r.geometry.coordinates[0]===u.coordinates[a][0]&&r.geometry.coordinates[1]===u.coordinates[a][1]&&(n=!0,c=!0),a++}else if("LineString"===u.type)for(a=0;!l&&a<u.coordinates.length-1;)En(r.geometry.coordinates[0],r.geometry.coordinates[1],u.coordinates[a][0],u.coordinates[a][1],u.coordinates[a+1][0],u.coordinates[a+1][1])&&(l=!0,n=!0),a++;else if("MultiLineString"===u.type)for(var h=0;h<u.coordinates.length;){l=!1,a=0;for(var p=u.coordinates[h];!l&&a<p.length-1;)En(r.geometry.coordinates[0],r.geometry.coordinates[1],p[a][0],p[a][1],p[a+1][0],p[a+1][1])&&(l=!0,n=!0),a++;h++}else"Polygon"!==u.type&&"MultiPolygon"!==u.type||fe(r,u)&&(n=!0);i++}if(n)return r;var d=f([]);for(i=0;i<e.features.length;i++)d.features=d.features.concat(dr(e.features[i]).features);return s(jr(r,d).geometry.coordinates)}function En(t,e,r,n,i,o){return Math.sqrt((i-r)*(i-r)+(o-n)*(o-n))===Math.sqrt((t-r)*(t-r)+(e-n)*(e-n))+Math.sqrt((i-t)*(i-t)+(o-e)*(o-e))}pn.default=fn;var In=6378137;function Sn(t){return U(t,(function(t,e){return t+function(t){var e,r=0;switch(t.type){case"Polygon":return Cn(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)r+=Cn(t.coordinates[e]);return r;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)}),0)}function Cn(t){var e=0;if(t&&t.length>0){e+=Math.abs(Pn(t[0]));for(var r=1;r<t.length;r++)e-=Math.abs(Pn(t[r]))}return e}function Pn(t){var e,r,n,i,o,a,s=0,u=t.length;if(u>2){for(a=0;a<u;a++)a===u-2?(n=u-2,i=u-1,o=0):a===u-1?(n=u-1,i=0,o=1):(n=a,i=a+1,o=a+2),e=t[n],r=t[i],s+=(Mn(t[o][0])-Mn(e[0]))*Math.sin(Mn(r[1]));s=s*In*In/2}return s}function Mn(t){return t*Math.PI/180}function Tn(t,e){return void 0===e&&(e={}),G(t,(function(t,r){var n=r.geometry.coordinates;return t+ye(n[0],n[1],e)}),0)}function Ln(t,e,r,n){if(!M(n=n||{}))throw new Error("options is invalid");var i,o=[];if("Feature"===t.type)i=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");i=t.coordinates}for(var a,s,u,l=i.length,c=0,p=0;p<i.length&&!(e>=c&&p===i.length-1);p++){if(c>e&&0===o.length){if(!(a=e-c))return o.push(i[p]),h(o);s=hr(i[p],i[p-1])-180,u=lr(i[p],a,s,n),o.push(u.geometry.coordinates)}if(c>=r)return(a=r-c)?(s=hr(i[p],i[p-1])-180,u=lr(i[p],a,s,n),o.push(u.geometry.coordinates),h(o)):(o.push(i[p]),h(o));if(c>=e&&o.push(i[p]),p===i.length-1)return h(o);c+=ye(i[p],i[p+1],n)}if(c<e&&i.length===l)throw new Error("Start position is beyond line");var f=i[i.length-1];return h([f,f])}function An(t,e,r){void 0===r&&(r={});for(var n=K(t),i=$(e),o=0;o<i.length-1;o++){var a=!1;if(r.ignoreEndVertices&&(0===o&&(a="start"),o===i.length-2&&(a="end"),0===o&&o+1===i.length-1&&(a="both")),kn(i[o],i[o+1],n,a,void 0===r.epsilon?null:r.epsilon))return!0}return!1}function kn(t,e,r,n,i){var o=r[0],a=r[1],s=t[0],u=t[1],l=e[0],c=e[1],h=l-s,p=c-u,f=(r[0]-s)*p-(r[1]-u)*h;if(null!==i){if(Math.abs(f)>i)return!1}else if(0!==f)return!1;return n?"start"===n?Math.abs(h)>=Math.abs(p)?h>0?s<o&&o<=l:l<=o&&o<s:p>0?u<a&&a<=c:c<=a&&a<u:"end"===n?Math.abs(h)>=Math.abs(p)?h>0?s<=o&&o<l:l<o&&o<=s:p>0?u<=a&&a<c:c<a&&a<=u:"both"===n&&(Math.abs(h)>=Math.abs(p)?h>0?s<o&&o<l:l<o&&o<s:p>0?u<a&&a<c:c<a&&a<u):Math.abs(h)>=Math.abs(p)?h>0?s<=o&&o<=l:l<=o&&o<=s:p>0?u<=a&&a<=c:c<=a&&a<=u}function Nn(t,e){var r=nt(t),n=nt(e),i=r.type,o=n.type;switch(i){case"Point":switch(o){case"MultiPoint":return function(t,e){var r,n=!1;for(r=0;r<e.coordinates.length;r++)if(Rn(e.coordinates[r],t.coordinates)){n=!0;break}return n}(r,n);case"LineString":return An(r,n,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return fe(r,n,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return function(t,e){for(var r=0;r<t.coordinates.length;r++){for(var n=!1,i=0;i<e.coordinates.length;i++)Rn(t.coordinates[r],e.coordinates[i])&&(n=!0);if(!n)return!1}return!0}(r,n);case"LineString":return function(t,e){for(var r=!1,n=0;n<t.coordinates.length;n++){if(!An(t.coordinates[n],e))return!1;r||(r=An(t.coordinates[n],e,{ignoreEndVertices:!0}))}return r}(r,n);case"Polygon":case"MultiPolygon":return function(t,e){for(var r=!0,n=!1,i=0;i<t.coordinates.length;i++){if(!(n=fe(t.coordinates[1],e))){r=!1;break}n=fe(t.coordinates[1],e,{ignoreBoundary:!0})}return r&&n}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return function(t,e){for(var r=0;r<t.coordinates.length;r++)if(!An(t.coordinates[r],e))return!1;return!0}(r,n);case"Polygon":case"MultiPolygon":return function(t,e){if(!Dn(J(e),J(t)))return!1;for(var r=!1,n=0;n<t.coordinates.length-1;n++){if(!fe(t.coordinates[n],e))return!1;(r||(r=fe(t.coordinates[n],e,{ignoreBoundary:!0})),r)||(r=fe(On(t.coordinates[n],t.coordinates[n+1]),e,{ignoreBoundary:!0}))}return r}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return function(t,e){var r=J(t);if(!Dn(J(e),r))return!1;for(var n=0;n<t.coordinates[0].length;n++)if(!fe(t.coordinates[0][n],e))return!1;return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function Dn(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Rn(t,e){return t[0]===e[0]&&t[1]===e[1]}function On(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function zn(t,e,r){void 0===r&&(r={}),r.mask&&!r.units&&(r.units="kilometers");for(var n=[],i=t[0],o=t[1],a=t[2],u=t[3],l=e/ye([i,o],[a,o],r)*(a-i),c=e/ye([i,o],[i,u],r)*(u-o),h=a-i,p=u-o,d=Math.floor(h/l),g=(p-Math.floor(p/c)*c)/2,y=i+(h-d*l)/2;y<=a;){for(var m=o+g;m<=u;){var v=s([y,m],r.properties);r.mask?Nn(v,r.mask)&&n.push(v):n.push(v),m+=c}y+=l}return f(n)}function Fn(t,e){void 0===e&&(e={});var r=e.precision,n=e.coordinates,i=e.mutate;if(r=null==r||isNaN(r)?6:r,n=null==n||isNaN(n)?3:n,!t)throw new Error("<geojson> is required");if("number"!=typeof r)throw new Error("<precision> must be a number");if("number"!=typeof n)throw new Error("<coordinates> must be a number");!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,r);return k(t,(function(t){!function(t,e,r){t.length>r&&t.splice(r,t.length);for(var n=0;n<t.length;n++)t[n]=Math.round(t[n]*e)/e}(t,o,n)})),t}function Bn(t){if(!t)throw new Error("geojson is required");var e=[];return j(t,(function(t){e.push(t)})),f(e)}function Un(t,e){if(!t||!e)return!1;if(t.length!==e.length)return!1;for(var r=0,n=t.length;r<n;r++)if(t[r]instanceof Array&&e[r]instanceof Array){if(!Un(t[r],e[r]))return!1}else if(t[r]!==e[r])return!1;return!0}function jn(t){if("Feature"!=t.type)throw new Error("The input must a geojson object of type Feature");if(void 0===t.geometry||null==t.geometry)throw new Error("The input must a geojson object with a non-empty geometry");if("Polygon"!=t.geometry.type)throw new Error("The input must be a geojson Polygon");for(var e=t.geometry.coordinates.length,r=[],n=0;n<e;n++){var i=t.geometry.coordinates[n];Zn(i[0],i[i.length-1])||i.push(i[0]),r.push.apply(r,i.slice(0,i.length-1))}if(!function(t){for(var e={},r=1,n=0,i=t.length;n<i;++n){if(Object.prototype.hasOwnProperty.call(e,t[n])){r=0;break}e[t[n]]=1}return r}(r))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var o=r.length,a=function(t,e,r){if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");void 0===r&&(r=1);var n=t.geometry.coordinates,i=[],o={};if(r){for(var a=[],s=0;s<n.length;s++)for(var u=0;u<n[s].length-1;u++)a.push(g(s,u));var l=Et();l.load(a)}for(var c=0;c<n.length;c++)for(var h=0;h<n[c].length-1;h++)if(r)l.search(g(c,h)).forEach((function(t){var e=t.ring,r=t.edge;d(c,h,e,r)}));else for(var p=0;p<n.length;p++)for(var f=0;f<n[p].length-1;f++)d(c,h,p,f);return e||(i={type:"Feature",geometry:{type:"MultiPoint",coordinates:i}}),i;function d(t,r,a,s){var u,l,c=n[t][r],h=n[t][r+1],p=n[a][s],f=n[a][s+1],d=function(t,e,r,n){if(Un(t,r)||Un(t,n)||Un(e,r)||Un(n,r))return null;var i=t[0],o=t[1],a=e[0],s=e[1],u=r[0],l=r[1],c=n[0],h=n[1],p=(i-a)*(l-h)-(o-s)*(u-c);return 0===p?null:[((i*s-o*a)*(u-c)-(i-a)*(u*h-l*c))/p,((i*s-o*a)*(l-h)-(o-s)*(u*h-l*c))/p]}(c,h,p,f);if(null!==d&&(u=h[0]!==c[0]?(d[0]-c[0])/(h[0]-c[0]):(d[1]-c[1])/(h[1]-c[1]),l=f[0]!==p[0]?(d[0]-p[0])/(f[0]-p[0]):(d[1]-p[1])/(f[1]-p[1]),!(u>=1||u<=0||l>=1||l<=0))){var g=d,y=!o[g];y&&(o[g]=!0),e?i.push(e(d,t,r,c,h,u,a,s,p,f,l,y)):i.push(d)}}function g(t,e){var r,i,o,a,s=n[t][e],u=n[t][e+1];return s[0]<u[0]?(r=s[0],i=u[0]):(r=u[0],i=s[0]),s[1]<u[1]?(o=s[1],a=u[1]):(o=u[1],a=s[1]),{minX:r,minY:o,maxX:i,maxY:a,ring:t,edge:e}}}(t,(function(t,e,r,n,i,o,a,s,u,l,c,h){return[t,e,r,n,i,o,a,s,u,l,c,h]})),s=a.length;if(0==s){var u=[];for(n=0;n<e;n++)u.push(l([t.geometry.coordinates[n]],{parent:-1,winding:Xn(t.geometry.coordinates[n])}));var c=f(u);return F(),B(),c}var h=[],p=[];for(n=0;n<e;n++){h.push([]);for(var d=0;d<t.geometry.coordinates[n].length-1;d++)h[n].push([new Vn(t.geometry.coordinates[n][Yn(d+1,t.geometry.coordinates[n].length-1)],1,[n,d],[n,Yn(d+1,t.geometry.coordinates[n].length-1)],void 0)]),p.push(new qn(t.geometry.coordinates[n][d],[n,Yn(d-1,t.geometry.coordinates[n].length-1)],[n,d],void 0,void 0,!1,!0))}for(n=0;n<s;n++)h[a[n][1]][a[n][2]].push(new Vn(a[n][0],a[n][5],[a[n][1],a[n][2]],[a[n][6],a[n][7]],void 0)),a[n][11]&&p.push(new qn(a[n][0],[a[n][1],a[n][2]],[a[n][6],a[n][7]],void 0,void 0,!0,!0));var g=p.length;for(n=0;n<h.length;n++)for(d=0;d<h[n].length;d++)h[n][d].sort((function(t,e){return t.param<e.param?-1:1}));var y=[];for(n=0;n<g;n++)y.push({minX:p[n].coord[0],minY:p[n].coord[1],maxX:p[n].coord[0],maxY:p[n].coord[1],index:n});var m=Et();m.load(y);for(n=0;n<h.length;n++)for(d=0;d<h[n].length;d++)for(var v=0;v<h[n][d].length;v++){x=v==h[n][d].length-1?h[n][Yn(d+1,t.geometry.coordinates[n].length-1)][0].coord:h[n][d][v+1].coord;var _=m.search({minX:x[0],minY:x[1],maxX:x[0],maxY:x[1]})[0];h[n][d][v].nxtIsectAlongEdgeIn=_.index}for(n=0;n<h.length;n++)for(d=0;d<h[n].length;d++)for(v=0;v<h[n][d].length;v++){var x=h[n][d][v].coord,b=(_=m.search({minX:x[0],minY:x[1],maxX:x[0],maxY:x[1]})[0]).index;b<o?p[b].nxtIsectAlongRingAndEdge2=h[n][d][v].nxtIsectAlongEdgeIn:Zn(p[b].ringAndEdge1,h[n][d][v].ringAndEdgeIn)?p[b].nxtIsectAlongRingAndEdge1=h[n][d][v].nxtIsectAlongEdgeIn:p[b].nxtIsectAlongRingAndEdge2=h[n][d][v].nxtIsectAlongEdgeIn}var w=[];for(n=0,d=0;d<e;d++){var E=n;for(v=0;v<t.geometry.coordinates[d].length-1;v++)p[n].coord[0]<p[E].coord[0]&&(E=n),n++;var I=p[E].nxtIsectAlongRingAndEdge2;for(v=0;v<p.length;v++)if(p[v].nxtIsectAlongRingAndEdge1==E||p[v].nxtIsectAlongRingAndEdge2==E){var S=v;break}var C=Gn([p[S].coord,p[E].coord,p[I].coord],!0)?1:-1;w.push({isect:E,parent:-1,winding:C})}w.sort((function(t,e){return p[t.isect].coord>p[e.isect].coord?-1:1}));for(u=[];w.length>0;){var P=w.pop(),M=P.isect,T=P.parent,L=P.winding,A=u.length,k=[p[M].coord],N=M;if(p[M].ringAndEdge1Walkable)var D=p[M].ringAndEdge1,R=p[M].nxtIsectAlongRingAndEdge1;else D=p[M].ringAndEdge2,R=p[M].nxtIsectAlongRingAndEdge2;for(;!Zn(p[M].coord,p[R].coord);){k.push(p[R].coord);var O=void 0;for(n=0;n<w.length;n++)if(w[n].isect==R){O=n;break}if(null!=O&&w.splice(O,1),Zn(D,p[R].ringAndEdge1)){if(D=p[R].ringAndEdge2,p[R].ringAndEdge2Walkable=!1,p[R].ringAndEdge1Walkable){var z={isect:R};Gn([p[N].coord,p[R].coord,p[p[R].nxtIsectAlongRingAndEdge2].coord],1==L)?(z.parent=T,z.winding=-L):(z.parent=A,z.winding=L),w.push(z)}N=R,R=p[R].nxtIsectAlongRingAndEdge2}else{if(D=p[R].ringAndEdge1,p[R].ringAndEdge1Walkable=!1,p[R].ringAndEdge2Walkable){z={isect:R};Gn([p[N].coord,p[R].coord,p[p[R].nxtIsectAlongRingAndEdge1].coord],1==L)?(z.parent=T,z.winding=-L):(z.parent=A,z.winding=L),w.push(z)}N=R,R=p[R].nxtIsectAlongRingAndEdge1}}k.push(p[R].coord),u.push(l([k],{index:A,parent:T,winding:L,netWinding:void 0}))}c=f(u);function F(){for(var t=[],e=0;e<c.features.length;e++)-1==c.features[e].properties.parent&&t.push(e);if(t.length>1)for(e=0;e<t.length;e++){for(var r=-1,n=0;n<c.features.length;n++)t[e]!=n&&fe(c.features[t[e]].geometry.coordinates[0][0],c.features[n],{ignoreBoundary:!0})&&Sn(c.features[n])<1/0&&(r=n);c.features[t[e]].properties.parent=r}}function B(){for(var t=0;t<c.features.length;t++)if(-1==c.features[t].properties.parent){var e=c.features[t].properties.winding;c.features[t].properties.netWinding=e,U(t,e)}}function U(t,e){for(var r=0;r<c.features.length;r++)if(c.features[r].properties.parent==t){var n=e+c.features[r].properties.winding;c.features[r].properties.netWinding=n,U(r,n)}}return F(),B(),c}var Vn=function(t,e,r,n,i){this.coord=t,this.param=e,this.ringAndEdgeIn=r,this.ringAndEdgeOut=n,this.nxtIsectAlongEdgeIn=i},qn=function(t,e,r,n,i,o,a){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=r,this.nxtIsectAlongRingAndEdge1=n,this.nxtIsectAlongRingAndEdge2=i,this.ringAndEdge1Walkable=o,this.ringAndEdge2Walkable=a};function Gn(t,e){if(void 0===e&&(e=!0),3!=t.length)throw new Error("This function requires an array of three points [x,y]");return(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0])>=0==e}function Xn(t){for(var e=0,r=0;r<t.length-1;r++)t[r][0]<t[e][0]&&(e=r);if(Gn([t[Yn(e-1,t.length-1)],t[e],t[Yn(e+1,t.length-1)]],!0))var n=1;else n=-1;return n}function Zn(t,e){if(!t||!e)return!1;if(t.length!=e.length)return!1;for(var r=0,n=t.length;r<n;r++)if(t[r]instanceof Array&&e[r]instanceof Array){if(!Zn(t[r],e[r]))return!1}else if(t[r]!=e[r])return!1;return!0}function Yn(t,e){return(t%e+e)%e}var Wn=Math.PI/180,Hn=180/Math.PI,Jn=function(t,e){this.lon=t,this.lat=e,this.x=Wn*t,this.y=Wn*e};Jn.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},Jn.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new Jn(e,t)};var Kn=function(){this.coords=[],this.length=0};Kn.prototype.move_to=function(t){this.length++,this.coords.push(t)};var $n=function(t){this.properties=t||{},this.geometries=[]};$n.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(1===this.geometries.length)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var t=[],e=0;e<this.geometries.length;e++)t.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:t},type:"Feature",properties:this.properties}},$n.prototype.wkt=function(){for(var t="",e="LINESTRING(",r=function(t){e+=t[0]+" "+t[1]+","},n=0;n<this.geometries.length;n++){if(0===this.geometries[n].coords.length)return"LINESTRING(empty)";this.geometries[n].coords.forEach(r),t+=e.substring(0,e.length-1)+")"}return t};var Qn=function(t,e,r){if(!t||void 0===t.x||void 0===t.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||void 0===e.x||void 0===e.y)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new Jn(t.x,t.y),this.end=new Jn(e.x,e.y),this.properties=r||{};var n=this.start.x-this.end.x,i=this.start.y-this.end.y,o=Math.pow(Math.sin(i/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(n/2),2);if(this.g=2*Math.asin(Math.sqrt(o)),this.g===Math.PI)throw new Error("it appears "+t.view()+" and "+e.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+t+" and "+e)};function ti(t,e){var r=[],n=pn();return j(e,(function(e){if(r.forEach((function(t,e){t.id=e})),r.length){var i=n.search(e);if(i.features.length){var o=ri(e,i);r=r.filter((function(t){return t.id!==o.id})),n.remove(o),O(ei(o,e),(function(t){r.push(t),n.insert(t)}))}}else(r=ei(t,e).features).forEach((function(t){t.bbox||(t.bbox=ur(J(t)))})),n.load(f(r))})),f(r)}function ei(t,e){var r=[],n=$(t)[0],i=$(t)[t.geometry.coordinates.length-1];if(ni(n,K(e))||ni(i,K(e)))return f([t]);var o=pn(),a=Vr(t);o.load(a);var s=o.search(e);if(!s.features.length)return f([t]);var u=ri(e,s),l=z(a,(function(t,n,i){var o=$(n)[1],a=K(e);return i===u.id?(t.push(a),r.push(h(t)),ni(a,o)?[a]:[a,o]):(t.push(o),t)}),[n]);return l.length>1&&r.push(h(l)),f(r)}function ri(t,e){if(!e.features.length)throw new Error("lines must contain features");if(1===e.features.length)return e.features[0];var r,n=1/0;return O(e,(function(e){var i=yn(e,t).properties.dist;i<n&&(r=e,n=i)})),r}function ni(t,e){return t[0]===e[0]&&t[1]===e[1]}function ii(t,e,r,n,i){void 0===i&&(i={});var o=i.steps||64,a=oi(r),s=oi(n),u=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(a===s)return h(cr(t,e,i).geometry.coordinates[0],u);for(var l=a,c=a<s?s:s+360,p=l,f=[],d=0;p<c;)f.push(lr(t,e,p,i).geometry.coordinates),p=l+360*++d/o;return p>c&&f.push(lr(t,e,c,i).geometry.coordinates),h(f,u)}function oi(t){var e=t%360;return e<0&&(e+=360),e}function ai(t,e){void 0===e&&(e={});var r=nt(t);switch(e.properties||"Feature"!==t.type||(e.properties=t.properties),r.type){case"Polygon":return si(r,e);case"MultiPolygon":return function(t,e){void 0===e&&(e={});var r=nt(t).coordinates,n=e.properties?e.properties:"Feature"===t.type?t.properties:{},i=[];return r.forEach((function(t){i.push(ui(t,n))})),f(i)}(r,e);default:throw new Error("invalid poly")}}function si(t,e){return void 0===e&&(e={}),ui(nt(t).coordinates,e.properties?e.properties:"Feature"===t.type?t.properties:{})}function ui(t,e){return t.length>1?d(t,e):h(t[0],e)}function li(t,e){var r,n,i;void 0===e&&(e={});var o=e.properties,a=null===(r=e.autoComplete)||void 0===r||r,s=null===(n=e.orderCoords)||void 0===n||n;if("FeatureCollection"===(null!==(i=e.mutate)&&void 0!==i&&i||(t=be(t)),t.type)){var u=[];return t.features.forEach((function(t){u.push($(ci(t,{},a,s)))})),y(u,o)}return ci(t,o,a,s)}function ci(t,e,r,n){e=e||("Feature"===t.type?t.properties:{});var i=nt(t),o=i.coordinates,a=i.type;if(!o.length)throw new Error("line must contain coordinates");switch(a){case"LineString":return r&&(o=hi(o)),l([o],e);case"MultiLineString":var s=[],u=0;return o.forEach((function(t){if(r&&(t=hi(t)),n){var e=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.abs(e-n)*Math.abs(r-i)}(J(h(t)));e>u?(s.unshift(t),u=e):s.push(t)}else s.push(t)})),l(s,e);default:throw new Error("geometry type "+a+" is not supported")}}function hi(t){var e=t[0],r=e[0],n=e[1],i=t[t.length-1],o=i[0],a=i[1];return r===o&&n===a||t.push(e),t}function pi(t,e){var r,n,i,o,a,s,u;for(n=1;n<=8;n*=2){for(r=[],o=!(di(i=t[t.length-1],e)&n),a=0;a<t.length;a++)(u=!(di(s=t[a],e)&n))!==o&&r.push(fi(i,s,n,e)),u&&r.push(s),i=s,o=u;if(!(t=r).length)break}return r}function fi(t,e,r,n){return 8&r?[t[0]+(e[0]-t[0])*(n[3]-t[1])/(e[1]-t[1]),n[3]]:4&r?[t[0]+(e[0]-t[0])*(n[1]-t[1])/(e[1]-t[1]),n[1]]:2&r?[n[2],t[1]+(e[1]-t[1])*(n[2]-t[0])/(e[0]-t[0])]:1&r?[n[0],t[1]+(e[1]-t[1])*(n[0]-t[0])/(e[0]-t[0])]:null}function di(t,e){var r=0;return t[0]<e[0]?r|=1:t[0]>e[2]&&(r|=2),t[1]<e[1]?r|=4:t[1]>e[3]&&(r|=8),r}function gi(t,e){for(var r=[],n=0,i=t;n<i.length;n++){var o=pi(i[n],e);o.length>0&&(o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]||o.push(o[0]),o.length>=4&&r.push(o))}return r}Qn.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),r=Math.sin(t*this.g)/Math.sin(this.g),n=e*Math.cos(this.start.y)*Math.cos(this.start.x)+r*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+r*Math.cos(this.end.y)*Math.sin(this.end.x),o=e*Math.sin(this.start.y)+r*Math.sin(this.end.y),a=Hn*Math.atan2(o,Math.sqrt(Math.pow(n,2)+Math.pow(i,2)));return[Hn*Math.atan2(i,n),a]},Qn.prototype.Arc=function(t,e){var r=[];if(!t||t<=2)r.push([this.start.lon,this.start.lat]),r.push([this.end.lon,this.end.lat]);else for(var n=1/(t-1),i=0;i<t;++i){var o=n*i,a=this.interpolate(o);r.push(a)}for(var s=!1,u=0,l=e&&e.offset?e.offset:10,c=180-l,h=-180+l,p=360-l,f=1;f<r.length;++f){var d=r[f-1][0],g=r[f][0],y=Math.abs(g-d);y>p&&(g>c&&d<h||d>c&&g<h)?s=!0:y>u&&(u=y)}var m=[];if(s&&u<l){var v=[];m.push(v);for(var _=0;_<r.length;++_){var x=parseFloat(r[_][0]);if(_>0&&Math.abs(x-r[_-1][0])>p){var b=parseFloat(r[_-1][0]),w=parseFloat(r[_-1][1]),E=parseFloat(r[_][0]),I=parseFloat(r[_][1]);if(b>-180&&b<h&&180===E&&_+1<r.length&&r[_-1][0]>-180&&r[_-1][0]<h){v.push([-180,r[_][1]]),_++,v.push([r[_][0],r[_][1]]);continue}if(b>c&&b<180&&-180===E&&_+1<r.length&&r[_-1][0]>c&&r[_-1][0]<180){v.push([180,r[_][1]]),_++,v.push([r[_][0],r[_][1]]);continue}if(b<h&&E>c){var S=b;b=E,E=S;var C=w;w=I,I=C}if(b>c&&E<h&&(E+=360),b<=180&&E>=180&&b<E){var P=(180-b)/(E-b),M=P*I+(1-P)*w;v.push([r[_-1][0]>c?180:-180,M]),(v=[]).push([r[_-1][0]>c?-180:180,M]),m.push(v)}else v=[],m.push(v);v.push([x,r[_][1]])}else v.push([r[_][0],r[_][1]])}}else{var T=[];m.push(T);for(var L=0;L<r.length;++L)T.push([r[L][0],r[L][1]])}for(var A=new $n(this.properties),k=0;k<m.length;++k){var N=new Kn;A.geometries.push(N);for(var D=m[k],R=0;R<D.length;++R)N.move_to(D[R])}return A};var yi=Ft((function(t,e){function r(t){var e=[];for(var r in t)e.push(r);return e}(t.exports="function"==typeof Object.keys?Object.keys:r).shim=r})),mi=Ft((function(t,e){var r="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();function n(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function i(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}(e=t.exports=r?n:i).supported=n,e.unsupported=i})),vi=Ft((function(t){var e=Array.prototype.slice,r=t.exports=function(t,o,a){return a||(a={}),t===o||(t instanceof Date&&o instanceof Date?t.getTime()===o.getTime():!t||!o||"object"!=typeof t&&"object"!=typeof o?a.strict?t===o:t==o:function(t,o,a){var s,u;if(n(t)||n(o))return!1;if(t.prototype!==o.prototype)return!1;if(mi(t))return!!mi(o)&&(t=e.call(t),o=e.call(o),r(t,o,a));if(i(t)){if(!i(o))return!1;if(t.length!==o.length)return!1;for(s=0;s<t.length;s++)if(t[s]!==o[s])return!1;return!0}try{var l=yi(t),c=yi(o)}catch(t){return!1}if(l.length!=c.length)return!1;for(l.sort(),c.sort(),s=l.length-1;s>=0;s--)if(l[s]!=c[s])return!1;for(s=l.length-1;s>=0;s--)if(u=l[s],!r(t[u],o[u],a))return!1;return typeof t==typeof o}(t,o,a))};function n(t){return null==t}function i(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length||"function"!=typeof t.copy||"function"!=typeof t.slice||t.length>0&&"number"!=typeof t[0])}}));function _i(t,e,r){if(void 0===r&&(r={}),!M(r=r||{}))throw new Error("options is invalid");var n,i=r.tolerance||0,o=[],a=pn(),s=Vr(t);return a.load(s),q(e,(function(t){var e=!1;t&&(O(a.search(t),(function(r){if(!1===e){var o=$(t).sort(),a=$(r).sort();vi(o,a)||(0===i?An(o[0],r)&&An(o[1],r):yn(r,o[0]).properties.dist<=i&&yn(r,o[1]).properties.dist<=i)?(e=!0,n=n?xi(n,t):t):(0===i?An(a[0],t)&&An(a[1],t):yn(t,a[0]).properties.dist<=i&&yn(t,a[1]).properties.dist<=i)&&(n=n?xi(n,r):r)}})),!1===e&&n&&(o.push(n),n=void 0))})),n&&o.push(n),f(o)}function xi(t,e){var r=$(e),n=$(t),i=n[0],o=n[n.length-1],a=t.geometry.coordinates;return vi(r[0],i)?a.unshift(r[1]):vi(r[0],o)?a.push(r[1]):vi(r[1],i)?a.unshift(r[0]):vi(r[1],o)&&a.push(r[0]),t}function bi(t){var e=t%360;return e<0&&(e+=360),e}function wi(t,e,r){var n;return void 0===r&&(r={}),(n=r.final?Ei(K(e),K(t)):Ei(K(t),K(e)))>180?-(360-n):n}function Ei(t,e){var r=I(t[1]),n=I(e[1]),i=I(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(n/2+Math.PI/4)/Math.tan(r/2+Math.PI/4));return(E(Math.atan2(i,o))+360)%360}function Ii(t,r,n,i){void 0===i&&(i={});var o=r<0,a=S(Math.abs(r),i.units,"meters");o&&(a=-Math.abs(a));var u=K(t),l=function(t,r,n,i){var o=r/(i=void 0===i?e:Number(i)),a=t[0]*Math.PI/180,s=I(t[1]),u=I(n),l=o*Math.cos(u),c=s+l;Math.abs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c);var h=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(s/2+Math.PI/4)),p=Math.abs(h)>1e-11?l/h:Math.cos(s);return[(180*(a+o*Math.sin(u)/p)/Math.PI+540)%360-180,180*c/Math.PI]}(u,a,n);return l[0]+=l[0]-u[0]>180?-360:u[0]-l[0]>180?360:0,s(l,i.properties)}function Si(t,e,r,n,i,o){for(var a=0;a<t.length;a++){var s=t[a],u=t[a+1];a===t.length-1&&(u=t[0]),n=Pi(s,u,e),r<=0&&n>0?Pi(e,s,i)<0||(i=s):r>0&&n<=0&&(Ci(e,s,o)||(o=s)),r=n}return[i,o]}function Ci(t,e,r){return Pi(t,e,r)>0}function Pi(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(r[0]-t[0])*(e[1]-t[1])}function Mi(t){for(var e,r,n=$(t),i=0,o=1;o<n.length;)e=r||n[0],i+=((r=n[o])[0]-e[0])*(r[1]+e[1]),o++;return i>0}function Ti(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return B(t,(function(t){Ti(t,e)})),t;case"LineString":return Li($(t),e),t;case"Polygon":return Ai($(t),e),t;case"MultiLineString":return $(t).forEach((function(t){Li(t,e)})),t;case"MultiPolygon":return $(t).forEach((function(t){Ai(t,e)})),t;case"Point":case"MultiPoint":return t}}function Li(t,e){Mi(t)===e&&t.reverse()}function Ai(t,e){Mi(t[0])!==e&&t[0].reverse();for(var r=1;r<t.length;r++)Mi(t[r])===e&&t[r].reverse()}var ki={successCallback:null,verbose:!1,polygons:!1},Ni={};function Di(t,e,r,n){n=n||{};for(var i=Object.keys(ki),o=0;o<i.length;o++){var a=i[o],s=n[a];s=null!=s?s:ki[a],Ni[a]=s}Ni.verbose&&console.log("MarchingSquaresJS-isoBands: computing isobands for ["+e+":"+(e+r)+"]");var u,l=function(t,e,r){for(var n=t.length-1,i=t[0].length-1,o={rows:n,cols:i,cells:[]},a=e+Math.abs(r),s=0;s<n;++s){o.cells[s]=[];for(var u=0;u<i;++u){var l=0,c=t[s+1][u],h=t[s+1][u+1],p=t[s][u+1],f=t[s][u];if(!(isNaN(c)||isNaN(h)||isNaN(p)||isNaN(f))){l|=c<e?0:c>a?128:64,l|=h<e?0:h>a?32:16,l|=p<e?0:p>a?8:4;var d=+(l|=f<e?0:f>a?2:1),g=0;if(17===l||18===l||33===l||34===l||38===l||68===l||72===l||98===l||102===l||132===l||136===l||137===l||152===l||153===l){var y=(c+h+p+f)/4;g=y>a?2:y<e?0:1,34===l?1===g?l=35:0===g&&(l=136):136===l?1===g?(l=35,g=4):0===g&&(l=34):17===l?1===g?(l=155,g=4):0===g&&(l=153):68===l?1===g?(l=103,g=4):0===g&&(l=102):153===l?1===g&&(l=155):102===l?1===g&&(l=103):152===l?g<2&&(l=156,g=1):137===l?g<2&&(l=139,g=1):98===l?g<2&&(l=99,g=1):38===l?g<2&&(l=39,g=1):18===l?g>0?(l=156,g=4):l=152:33===l?g>0?(l=139,g=4):l=137:72===l?g>0?(l=99,g=4):l=98:132===l&&(g>0?(l=39,g=4):l=38)}if(0!=l&&170!=l){var m,v,_,x,b,w,E,I;m=v=_=x=b=w=E=I=.5;var S=[];1===l?(_=1-So(e,p,f),I=1-So(e,c,f),S.push(_o[l])):169===l?(_=So(a,f,p),I=So(a,f,c),S.push(_o[l])):4===l?(w=1-So(e,h,p),x=So(e,f,p),S.push(mo[l])):166===l?(w=So(a,p,h),x=1-So(a,p,f),S.push(mo[l])):16===l?(b=So(e,p,h),v=So(e,c,h),S.push(yo[l])):154===l?(b=1-So(a,h,p),v=1-So(a,h,c),S.push(yo[l])):64===l?(E=So(e,f,c),m=1-So(e,h,c),S.push(bo[l])):106===l?(E=1-So(a,c,f),m=So(a,c,h),S.push(bo[l])):168===l?(x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),S.push(vo[l]),S.push(_o[l])):2===l?(x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),S.push(vo[l]),S.push(_o[l])):162===l?(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),S.push(vo[l]),S.push(_o[l])):8===l?(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),S.push(yo[l]),S.push(mo[l])):138===l?(b=1-So(e,h,p),w=1-So(a,h,p),m=1-So(a,h,c),v=1-So(e,h,c),S.push(yo[l]),S.push(mo[l])):32===l?(b=So(a,p,h),w=So(e,p,h),m=So(e,c,h),v=So(a,c,h),S.push(yo[l]),S.push(mo[l])):42===l?(I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h),S.push(xo[l]),S.push(bo[l])):128===l&&(I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c),S.push(xo[l]),S.push(bo[l])),5===l?(w=1-So(e,h,p),I=1-So(e,c,f),S.push(mo[l])):165===l?(w=So(a,p,h),I=So(a,f,c),S.push(mo[l])):20===l?(x=So(e,f,p),v=So(e,c,h),S.push(vo[l])):150===l?(x=1-So(a,p,f),v=1-So(a,h,c),S.push(vo[l])):80===l?(b=So(e,p,h),E=So(e,f,c),S.push(yo[l])):90===l?(b=1-So(a,h,p),E=1-So(a,c,f),S.push(yo[l])):65===l?(_=1-So(e,p,f),m=1-So(e,h,c),S.push(_o[l])):105===l?(_=So(a,f,p),m=So(a,c,h),S.push(_o[l])):160===l?(b=So(a,p,h),w=So(e,p,h),I=So(e,f,c),E=So(a,f,c),S.push(yo[l]),S.push(mo[l])):10===l?(b=1-So(e,h,p),w=1-So(a,h,p),I=1-So(a,c,f),E=1-So(e,c,f),S.push(yo[l]),S.push(mo[l])):130===l?(x=1-So(e,p,f),_=1-So(a,p,f),m=1-So(a,h,c),v=1-So(e,h,c),S.push(vo[l]),S.push(_o[l])):40===l?(x=So(a,f,p),_=So(e,f,p),m=So(e,c,h),v=So(a,c,h),S.push(vo[l]),S.push(_o[l])):101===l?(w=So(a,p,h),m=So(a,c,h),S.push(mo[l])):69===l?(w=1-So(e,h,p),m=1-So(e,h,c),S.push(mo[l])):149===l?(I=So(a,f,c),v=1-So(a,h,c),S.push(xo[l])):21===l?(I=1-So(e,c,f),v=So(e,c,h),S.push(xo[l])):86===l?(x=1-So(a,p,f),E=1-So(a,c,f),S.push(vo[l])):84===l?(x=So(e,f,p),E=So(e,f,c),S.push(vo[l])):89===l?(b=1-So(a,h,p),_=So(a,f,p),S.push(_o[l])):81===l?(b=So(e,p,h),_=1-So(e,p,f),S.push(_o[l])):96===l?(b=So(a,p,h),w=So(e,p,h),E=So(e,f,c),m=So(a,c,h),S.push(yo[l]),S.push(mo[l])):74===l?(b=1-So(e,h,p),w=1-So(a,h,p),E=1-So(a,c,f),m=1-So(e,h,c),S.push(yo[l]),S.push(mo[l])):24===l?(b=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),v=So(e,c,h),S.push(yo[l]),S.push(_o[l])):146===l?(b=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),v=1-So(a,h,c),S.push(yo[l]),S.push(_o[l])):6===l?(w=1-So(e,h,p),x=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),S.push(mo[l]),S.push(vo[l])):164===l?(w=So(a,p,h),x=So(e,f,p),I=So(e,f,c),E=So(a,f,c),S.push(mo[l]),S.push(vo[l])):129===l?(_=1-So(e,p,f),I=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c),S.push(_o[l]),S.push(xo[l])):41===l?(_=So(a,f,p),I=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h),S.push(_o[l]),S.push(xo[l])):66===l?(x=1-So(e,p,f),_=1-So(a,p,f),E=1-So(a,c,f),m=1-So(e,h,c),S.push(vo[l]),S.push(_o[l])):104===l?(x=So(a,f,p),_=So(e,f,p),E=So(e,f,c),m=So(a,c,h),S.push(_o[l]),S.push(wo[l])):144===l?(b=So(e,p,h),I=So(e,f,c),E=So(a,f,c),v=1-So(a,h,c),S.push(yo[l]),S.push(bo[l])):26===l?(b=1-So(a,h,p),I=1-So(a,c,f),E=1-So(e,c,f),v=So(e,c,h),S.push(yo[l]),S.push(bo[l])):36===l?(w=So(a,p,h),x=So(e,f,p),m=So(e,c,h),v=So(a,c,h),S.push(mo[l]),S.push(vo[l])):134===l?(w=1-So(e,h,p),x=1-So(a,p,f),m=1-So(a,h,c),v=1-So(e,h,c),S.push(mo[l]),S.push(vo[l])):9===l?(b=1-So(e,h,p),w=1-So(a,h,p),_=So(a,f,p),I=1-So(e,c,f),S.push(yo[l]),S.push(mo[l])):161===l?(b=So(a,p,h),w=So(e,p,h),_=1-So(e,p,f),I=So(a,f,c),S.push(yo[l]),S.push(mo[l])):37===l?(w=So(a,p,h),I=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h),S.push(mo[l]),S.push(xo[l])):133===l?(w=1-So(e,h,p),I=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c),S.push(mo[l]),S.push(xo[l])):148===l?(x=So(e,f,p),I=So(e,f,c),E=So(a,f,c),v=1-So(a,h,c),S.push(vo[l]),S.push(bo[l])):22===l?(x=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),v=So(e,c,h),S.push(vo[l]),S.push(bo[l])):82===l?(b=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),E=1-So(a,c,f),S.push(yo[l]),S.push(_o[l])):88===l?(b=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),E=So(e,f,c),S.push(yo[l]),S.push(_o[l])):73===l?(b=1-So(e,h,p),w=1-So(a,h,p),_=So(a,f,p),m=1-So(e,h,c),S.push(yo[l]),S.push(mo[l])):97===l?(b=So(a,p,h),w=So(e,p,h),_=1-So(e,p,f),m=So(a,c,h),S.push(yo[l]),S.push(mo[l])):145===l?(b=So(e,p,h),_=1-So(e,p,f),I=So(a,f,c),v=1-So(a,h,c),S.push(yo[l]),S.push(xo[l])):25===l?(b=1-So(a,h,p),_=So(a,f,p),I=1-So(e,c,f),v=So(e,c,h),S.push(yo[l]),S.push(xo[l])):70===l?(w=1-So(e,h,p),x=1-So(a,p,f),E=1-So(a,c,f),m=1-So(e,h,c),S.push(mo[l]),S.push(vo[l])):100===l?(w=So(a,p,h),x=So(e,f,p),E=So(e,f,c),m=So(a,c,h),S.push(mo[l]),S.push(vo[l])):34===l?(0===g?(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)):(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)),S.push(yo[l]),S.push(mo[l]),S.push(xo[l]),S.push(bo[l])):35===l?(4===g?(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)):(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)),S.push(yo[l]),S.push(mo[l]),S.push(_o[l]),S.push(bo[l])):136===l?(0===g?(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)):(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)),S.push(yo[l]),S.push(mo[l]),S.push(xo[l]),S.push(bo[l])):153===l?(0===g?(b=So(e,p,h),_=1-So(e,p,f),I=1-So(e,c,f),v=So(e,c,h)):(b=1-So(a,h,p),_=So(a,f,p),I=So(a,f,c),v=1-So(a,h,c)),S.push(yo[l]),S.push(_o[l])):102===l?(0===g?(w=1-So(e,h,p),x=So(e,f,p),E=So(e,f,c),m=1-So(e,h,c)):(w=So(a,p,h),x=1-So(a,p,f),E=1-So(a,c,f),m=So(a,c,h)),S.push(mo[l]),S.push(bo[l])):155===l?(4===g?(b=So(e,p,h),_=1-So(e,p,f),I=1-So(e,c,f),v=So(e,c,h)):(b=1-So(a,h,p),_=So(a,f,p),I=So(a,f,c),v=1-So(a,h,c)),S.push(yo[l]),S.push(xo[l])):103===l?(4===g?(w=1-So(e,h,p),x=So(e,f,p),E=So(e,f,c),m=1-So(e,h,c)):(w=So(a,p,h),x=1-So(a,p,f),E=1-So(a,c,f),m=So(a,c,h)),S.push(mo[l]),S.push(vo[l])):152===l?(0===g?(b=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),v=So(e,c,h)):(b=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),v=1-So(a,h,c)),S.push(yo[l]),S.push(vo[l]),S.push(_o[l])):156===l?(4===g?(b=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),v=So(e,c,h)):(b=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),v=1-So(a,h,c)),S.push(yo[l]),S.push(_o[l]),S.push(bo[l])):137===l?(0===g?(b=So(a,p,h),w=So(e,p,h),_=1-So(e,p,f),I=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)):(b=1-So(e,h,p),w=1-So(a,h,p),_=So(a,f,p),I=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)),S.push(yo[l]),S.push(mo[l]),S.push(_o[l])):139===l?(4===g?(b=So(a,p,h),w=So(e,p,h),_=1-So(e,p,f),I=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)):(b=1-So(e,h,p),w=1-So(a,h,p),_=So(a,f,p),I=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)),S.push(yo[l]),S.push(mo[l]),S.push(xo[l])):98===l?(0===g?(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),E=So(e,f,c),m=1-So(e,h,c)):(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),E=1-So(a,c,f),m=So(a,c,h)),S.push(yo[l]),S.push(mo[l]),S.push(bo[l])):99===l?(4===g?(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),E=So(e,f,c),m=1-So(e,h,c)):(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),E=1-So(a,c,f),m=So(a,c,h)),S.push(yo[l]),S.push(mo[l]),S.push(_o[l])):38===l?(0===g?(w=1-So(e,h,p),x=So(e,f,p),I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)):(w=So(a,p,h),x=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)),S.push(mo[l]),S.push(xo[l]),S.push(bo[l])):39===l?(4===g?(w=1-So(e,h,p),x=So(e,f,p),I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)):(w=So(a,p,h),x=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)),S.push(mo[l]),S.push(vo[l]),S.push(bo[l])):85===l&&(b=1,w=0,x=1,_=0,I=0,E=1,m=0,v=1),(m<0||m>1||v<0||v>1||b<0||b>1||x<0||x>1||I<0||I>1||E<0||E>1)&&console.log("MarchingSquaresJS-isoBands: "+l+" "+d+" "+c+","+h+","+p+","+f+" "+g+" "+m+" "+v+" "+b+" "+w+" "+x+" "+_+" "+I+" "+E),o.cells[s][u]={cval:l,cval_real:d,flipped:g,topleft:m,topright:v,righttop:b,rightbottom:w,bottomright:x,bottomleft:_,leftbottom:I,lefttop:E,edges:S}}}}}return o}(t,e,r);return Ni.polygons?(Ni.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),u=function(t){var e=[],r=0;return t.cells.forEach((function(t,n){t.forEach((function(t,i){if(void 0!==t){var o=Io[t.cval](t);"object"==typeof o&&Co(o)?"object"==typeof o[0]&&Co(o[0])?"object"==typeof o[0][0]&&Co(o[0][0])?o.forEach((function(t){t.forEach((function(t){t[0]+=i,t[1]+=n})),e[r++]=t})):(o.forEach((function(t){t[0]+=i,t[1]+=n})),e[r++]=o):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")}}))})),e}(l)):(Ni.verbose&&console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"),u=function(t){for(var e=[],r=t.rows,n=t.cols,i=[],o=0;o<r;o++)for(var a=0;a<n;a++)if(void 0!==t.cells[o][a]&&t.cells[o][a].edges.length>0){var s=Mo(t.cells[o][a]),u=null,l=a,c=o;null!==s&&i.push([s.p[0]+l,s.p[1]+c]);do{if(null===(u=To(t.cells[c][l],s.x,s.y,s.o)))break;if(i.push([u.p[0]+l,u.p[1]+c]),l+=u.x,s=u,(c+=u.y)<0||c>=r||l<0||l>=n||void 0===t.cells[c][l]){var h=Po(t,l-=u.x,c-=u.y,u.x,u.y,u.o);if(null===h)break;h.path.forEach((function(t){i.push(t)})),l=h.i,c=h.j,s=h}}while(void 0!==t.cells[c][l]&&t.cells[c][l].edges.length>0);e.push(i),i=[],t.cells[o][a].edges.length>0&&a--}return e}(l)),"function"==typeof Ni.successCallback&&Ni.successCallback(u),u}var Ri=64,Oi=16,zi=[],Fi=[],Bi=[],Ui=[],ji=[],Vi=[],qi=[],Gi=[],Xi=[],Zi=[],Yi=[],Wi=[],Hi=[],Ji=[],Ki=[],$i=[],Qi=[],to=[],eo=[],ro=[],no=[],io=[],oo=[],ao=[];qi[85]=Zi[85]=-1,Gi[85]=Yi[85]=0,Xi[85]=Wi[85]=1,eo[85]=io[85]=1,ro[85]=oo[85]=0,no[85]=ao[85]=1,zi[85]=Ui[85]=0,Fi[85]=ji[85]=-1,Bi[85]=Ki[85]=0,$i[85]=Hi[85]=0,Qi[85]=Ji[85]=1,Vi[85]=to[85]=1,io[1]=io[169]=0,oo[1]=oo[169]=-1,ao[1]=ao[169]=0,Hi[1]=Hi[169]=-1,Ji[1]=Ji[169]=0,Ki[1]=Ki[169]=0,Zi[4]=Zi[166]=0,Yi[4]=Yi[166]=-1,Wi[4]=Wi[166]=1,$i[4]=$i[166]=1,Qi[4]=Qi[166]=0,to[4]=to[166]=0,qi[16]=qi[154]=0,Gi[16]=Gi[154]=1,Xi[16]=Xi[154]=1,Ui[16]=Ui[154]=1,ji[16]=ji[154]=0,Vi[16]=Vi[154]=1,eo[64]=eo[106]=0,ro[64]=ro[106]=1,no[64]=no[106]=0,zi[64]=zi[106]=-1,Fi[64]=Fi[106]=0,Bi[64]=Bi[106]=1,eo[2]=eo[168]=0,ro[2]=ro[168]=-1,no[2]=no[168]=1,io[2]=io[168]=0,oo[2]=oo[168]=-1,ao[2]=ao[168]=0,Hi[2]=Hi[168]=-1,Ji[2]=Ji[168]=0,Ki[2]=Ki[168]=0,$i[2]=$i[168]=-1,Qi[2]=Qi[168]=0,to[2]=to[168]=1,qi[8]=qi[162]=0,Gi[8]=Gi[162]=-1,Xi[8]=Xi[162]=0,Zi[8]=Zi[162]=0,Yi[8]=Yi[162]=-1,Wi[8]=Wi[162]=1,Hi[8]=Hi[162]=1,Ji[8]=Ji[162]=0,Ki[8]=Ki[162]=1,$i[8]=$i[162]=1,Qi[8]=Qi[162]=0,to[8]=to[162]=0,qi[32]=qi[138]=0,Gi[32]=Gi[138]=1,Xi[32]=Xi[138]=1,Zi[32]=Zi[138]=0,Yi[32]=Yi[138]=1,Wi[32]=Wi[138]=0,zi[32]=zi[138]=1,Fi[32]=Fi[138]=0,Bi[32]=Bi[138]=0,Ui[32]=Ui[138]=1,ji[32]=ji[138]=0,Vi[32]=Vi[138]=1,io[128]=io[42]=0,oo[128]=oo[42]=1,ao[128]=ao[42]=1,eo[128]=eo[42]=0,ro[128]=ro[42]=1,no[128]=no[42]=0,zi[128]=zi[42]=-1,Fi[128]=Fi[42]=0,Bi[128]=Bi[42]=1,Ui[128]=Ui[42]=-1,ji[128]=ji[42]=0,Vi[128]=Vi[42]=0,Zi[5]=Zi[165]=-1,Yi[5]=Yi[165]=0,Wi[5]=Wi[165]=0,io[5]=io[165]=1,oo[5]=oo[165]=0,ao[5]=ao[165]=0,$i[20]=$i[150]=0,Qi[20]=Qi[150]=1,to[20]=to[150]=1,Ui[20]=Ui[150]=0,ji[20]=ji[150]=-1,Vi[20]=Vi[150]=1,qi[80]=qi[90]=-1,Gi[80]=Gi[90]=0,Xi[80]=Xi[90]=1,eo[80]=eo[90]=1,ro[80]=ro[90]=0,no[80]=no[90]=1,Hi[65]=Hi[105]=0,Ji[65]=Ji[105]=1,Ki[65]=Ki[105]=0,zi[65]=zi[105]=0,Fi[65]=Fi[105]=-1,Bi[65]=Bi[105]=0,qi[160]=qi[10]=-1,Gi[160]=Gi[10]=0,Xi[160]=Xi[10]=1,Zi[160]=Zi[10]=-1,Yi[160]=Yi[10]=0,Wi[160]=Wi[10]=0,io[160]=io[10]=1,oo[160]=oo[10]=0,ao[160]=ao[10]=0,eo[160]=eo[10]=1,ro[160]=ro[10]=0,no[160]=no[10]=1,$i[130]=$i[40]=0,Qi[130]=Qi[40]=1,to[130]=to[40]=1,Hi[130]=Hi[40]=0,Ji[130]=Ji[40]=1,Ki[130]=Ki[40]=0,zi[130]=zi[40]=0,Fi[130]=Fi[40]=-1,Bi[130]=Bi[40]=0,Ui[130]=Ui[40]=0,ji[130]=ji[40]=-1,Vi[130]=Vi[40]=1,Zi[37]=Zi[133]=0,Yi[37]=Yi[133]=1,Wi[37]=Wi[133]=1,io[37]=io[133]=0,oo[37]=oo[133]=1,ao[37]=ao[133]=0,zi[37]=zi[133]=-1,Fi[37]=Fi[133]=0,Bi[37]=Bi[133]=0,Ui[37]=Ui[133]=1,ji[37]=ji[133]=0,Vi[37]=Vi[133]=0,$i[148]=$i[22]=-1,Qi[148]=Qi[22]=0,to[148]=to[22]=0,io[148]=io[22]=0,oo[148]=oo[22]=-1,ao[148]=ao[22]=1,eo[148]=eo[22]=0,ro[148]=ro[22]=1,no[148]=no[22]=1,Ui[148]=Ui[22]=-1,ji[148]=ji[22]=0,Vi[148]=Vi[22]=1,qi[82]=qi[88]=0,Gi[82]=Gi[88]=-1,Xi[82]=Xi[88]=1,$i[82]=$i[88]=1,Qi[82]=Qi[88]=0,to[82]=to[88]=1,Hi[82]=Hi[88]=-1,Ji[82]=Ji[88]=0,Ki[82]=Ki[88]=1,eo[82]=eo[88]=0,ro[82]=ro[88]=-1,no[82]=no[88]=0,qi[73]=qi[97]=0,Gi[73]=Gi[97]=1,Xi[73]=Xi[97]=0,Zi[73]=Zi[97]=0,Yi[73]=Yi[97]=-1,Wi[73]=Wi[97]=0,Hi[73]=Hi[97]=1,Ji[73]=Ji[97]=0,Ki[73]=Ki[97]=0,zi[73]=zi[97]=1,Fi[73]=Fi[97]=0,Bi[73]=Bi[97]=1,qi[145]=qi[25]=0,Gi[145]=Gi[25]=-1,Xi[145]=Xi[25]=0,Hi[145]=Hi[25]=1,Ji[145]=Ji[25]=0,Ki[145]=Ki[25]=1,io[145]=io[25]=0,oo[145]=oo[25]=1,ao[145]=ao[25]=1,Ui[145]=Ui[25]=-1,ji[145]=ji[25]=0,Vi[145]=Vi[25]=0,Zi[70]=Zi[100]=0,Yi[70]=Yi[100]=1,Wi[70]=Wi[100]=0,$i[70]=$i[100]=-1,Qi[70]=Qi[100]=0,to[70]=to[100]=1,eo[70]=eo[100]=0,ro[70]=ro[100]=-1,no[70]=no[100]=1,zi[70]=zi[100]=1,Fi[70]=Fi[100]=0,Bi[70]=Bi[100]=0,Zi[101]=Zi[69]=0,Yi[101]=Yi[69]=1,Wi[101]=Wi[69]=0,zi[101]=zi[69]=1,Fi[101]=Fi[69]=0,Bi[101]=Bi[69]=0,io[149]=io[21]=0,oo[149]=oo[21]=1,ao[149]=ao[21]=1,Ui[149]=Ui[21]=-1,ji[149]=ji[21]=0,Vi[149]=Vi[21]=0,$i[86]=$i[84]=-1,Qi[86]=Qi[84]=0,to[86]=to[84]=1,eo[86]=eo[84]=0,ro[86]=ro[84]=-1,no[86]=no[84]=1,qi[89]=qi[81]=0,Gi[89]=Gi[81]=-1,Xi[89]=Xi[81]=0,Hi[89]=Hi[81]=1,Ji[89]=Ji[81]=0,Ki[89]=Ki[81]=1,qi[96]=qi[74]=0,Gi[96]=Gi[74]=1,Xi[96]=Xi[74]=0,Zi[96]=Zi[74]=-1,Yi[96]=Yi[74]=0,Wi[96]=Wi[74]=1,eo[96]=eo[74]=1,ro[96]=ro[74]=0,no[96]=no[74]=0,zi[96]=zi[74]=1,Fi[96]=Fi[74]=0,Bi[96]=Bi[74]=1,qi[24]=qi[146]=0,Gi[24]=Gi[146]=-1,Xi[24]=Xi[146]=1,$i[24]=$i[146]=1,Qi[24]=Qi[146]=0,to[24]=to[146]=1,Hi[24]=Hi[146]=0,Ji[24]=Ji[146]=1,Ki[24]=Ki[146]=1,Ui[24]=Ui[146]=0,ji[24]=ji[146]=-1,Vi[24]=Vi[146]=0,Zi[6]=Zi[164]=-1,Yi[6]=Yi[164]=0,Wi[6]=Wi[164]=1,$i[6]=$i[164]=-1,Qi[6]=Qi[164]=0,to[6]=to[164]=0,io[6]=io[164]=0,oo[6]=oo[164]=-1,ao[6]=ao[164]=1,eo[6]=eo[164]=1,ro[6]=ro[164]=0,no[6]=no[164]=0,Hi[129]=Hi[41]=0,Ji[129]=Ji[41]=1,Ki[129]=Ki[41]=1,io[129]=io[41]=0,oo[129]=oo[41]=1,ao[129]=ao[41]=0,zi[129]=zi[41]=-1,Fi[129]=Fi[41]=0,Bi[129]=Bi[41]=0,Ui[129]=Ui[41]=0,ji[129]=ji[41]=-1,Vi[129]=Vi[41]=0,$i[66]=$i[104]=0,Qi[66]=Qi[104]=1,to[66]=to[104]=0,Hi[66]=Hi[104]=-1,Ji[66]=Ji[104]=0,Ki[66]=Ki[104]=1,eo[66]=eo[104]=0,ro[66]=ro[104]=-1,no[66]=no[104]=0,zi[66]=zi[104]=0,Fi[66]=Fi[104]=-1,Bi[66]=Bi[104]=1,qi[144]=qi[26]=-1,Gi[144]=Gi[26]=0,Xi[144]=Xi[26]=0,io[144]=io[26]=1,oo[144]=oo[26]=0,ao[144]=ao[26]=1,eo[144]=eo[26]=0,ro[144]=ro[26]=1,no[144]=no[26]=1,Ui[144]=Ui[26]=-1,ji[144]=ji[26]=0,Vi[144]=Vi[26]=1,Zi[36]=Zi[134]=0,Yi[36]=Yi[134]=1,Wi[36]=Wi[134]=1,$i[36]=$i[134]=0,Qi[36]=Qi[134]=1,to[36]=to[134]=0,zi[36]=zi[134]=0,Fi[36]=Fi[134]=-1,Bi[36]=Bi[134]=1,Ui[36]=Ui[134]=1,ji[36]=ji[134]=0,Vi[36]=Vi[134]=0,qi[9]=qi[161]=-1,Gi[9]=Gi[161]=0,Xi[9]=Xi[161]=0,Zi[9]=Zi[161]=0,Yi[9]=Yi[161]=-1,Wi[9]=Wi[161]=0,Hi[9]=Hi[161]=1,Ji[9]=Ji[161]=0,Ki[9]=Ki[161]=0,io[9]=io[161]=1,oo[9]=oo[161]=0,ao[9]=ao[161]=1,qi[136]=0,Gi[136]=1,Xi[136]=1,Zi[136]=0,Yi[136]=1,Wi[136]=0,$i[136]=-1,Qi[136]=0,to[136]=1,Hi[136]=-1,Ji[136]=0,Ki[136]=0,io[136]=0,oo[136]=-1,ao[136]=0,eo[136]=0,ro[136]=-1,no[136]=1,zi[136]=1,Fi[136]=0,Bi[136]=0,Ui[136]=1,ji[136]=0,Vi[136]=1,qi[34]=0,Gi[34]=-1,Xi[34]=0,Zi[34]=0,Yi[34]=-1,Wi[34]=1,$i[34]=1,Qi[34]=0,to[34]=0,Hi[34]=1,Ji[34]=0,Ki[34]=1,io[34]=0,oo[34]=1,ao[34]=1,eo[34]=0,ro[34]=1,no[34]=0,zi[34]=-1,Fi[34]=0,Bi[34]=1,Ui[34]=-1,ji[34]=0,Vi[34]=0,qi[35]=0,Gi[35]=1,Xi[35]=1,Zi[35]=0,Yi[35]=-1,Wi[35]=1,$i[35]=1,Qi[35]=0,to[35]=0,Hi[35]=-1,Ji[35]=0,Ki[35]=0,io[35]=0,oo[35]=-1,ao[35]=0,eo[35]=0,ro[35]=1,no[35]=0,zi[35]=-1,Fi[35]=0,Bi[35]=1,Ui[35]=1,ji[35]=0,Vi[35]=1,qi[153]=0,Gi[153]=1,Xi[153]=1,Hi[153]=-1,Ji[153]=0,Ki[153]=0,io[153]=0,oo[153]=-1,ao[153]=0,Ui[153]=1,ji[153]=0,Vi[153]=1,Zi[102]=0,Yi[102]=-1,Wi[102]=1,$i[102]=1,Qi[102]=0,to[102]=0,eo[102]=0,ro[102]=1,no[102]=0,zi[102]=-1,Fi[102]=0,Bi[102]=1,qi[155]=0,Gi[155]=-1,Xi[155]=0,Hi[155]=1,Ji[155]=0,Ki[155]=1,io[155]=0,oo[155]=1,ao[155]=1,Ui[155]=-1,ji[155]=0,Vi[155]=0,Zi[103]=0,Yi[103]=1,Wi[103]=0,$i[103]=-1,Qi[103]=0,to[103]=1,eo[103]=0,ro[103]=-1,no[103]=1,zi[103]=1,Fi[103]=0,Bi[103]=0,qi[152]=0,Gi[152]=1,Xi[152]=1,$i[152]=-1,Qi[152]=0,to[152]=1,Hi[152]=-1,Ji[152]=0,Ki[152]=0,io[152]=0,oo[152]=-1,ao[152]=0,eo[152]=0,ro[152]=-1,no[152]=1,Ui[152]=1,ji[152]=0,Vi[152]=1,qi[156]=0,Gi[156]=-1,Xi[156]=1,$i[156]=1,Qi[156]=0,to[156]=1,Hi[156]=-1,Ji[156]=0,Ki[156]=0,io[156]=0,oo[156]=-1,ao[156]=0,eo[156]=0,ro[156]=1,no[156]=1,Ui[156]=-1,ji[156]=0,Vi[156]=1,qi[137]=0,Gi[137]=1,Xi[137]=1,Zi[137]=0,Yi[137]=1,Wi[137]=0,Hi[137]=-1,Ji[137]=0,Ki[137]=0,io[137]=0,oo[137]=-1,ao[137]=0,zi[137]=1,Fi[137]=0,Bi[137]=0,Ui[137]=1,ji[137]=0,Vi[137]=1,qi[139]=0,Gi[139]=1,Xi[139]=1,Zi[139]=0,Yi[139]=-1,Wi[139]=0,Hi[139]=1,Ji[139]=0,Ki[139]=0,io[139]=0,oo[139]=1,ao[139]=0,zi[139]=-1,Fi[139]=0,Bi[139]=0,Ui[139]=1,ji[139]=0,Vi[139]=1,qi[98]=0,Gi[98]=-1,Xi[98]=0,Zi[98]=0,Yi[98]=-1,Wi[98]=1,$i[98]=1,Qi[98]=0,to[98]=0,Hi[98]=1,Ji[98]=0,Ki[98]=1,eo[98]=0,ro[98]=1,no[98]=0,zi[98]=-1,Fi[98]=0,Bi[98]=1,qi[99]=0,Gi[99]=1,Xi[99]=0,Zi[99]=0,Yi[99]=-1,Wi[99]=1,$i[99]=1,Qi[99]=0,to[99]=0,Hi[99]=-1,Ji[99]=0,Ki[99]=1,eo[99]=0,ro[99]=-1,no[99]=0,zi[99]=1,Fi[99]=0,Bi[99]=1,Zi[38]=0,Yi[38]=-1,Wi[38]=1,$i[38]=1,Qi[38]=0,to[38]=0,io[38]=0,oo[38]=1,ao[38]=1,eo[38]=0,ro[38]=1,no[38]=0,zi[38]=-1,Fi[38]=0,Bi[38]=1,Ui[38]=-1,ji[38]=0,Vi[38]=0,Zi[39]=0,Yi[39]=1,Wi[39]=1,$i[39]=-1,Qi[39]=0,to[39]=0,io[39]=0,oo[39]=-1,ao[39]=1,eo[39]=0,ro[39]=1,no[39]=0,zi[39]=-1,Fi[39]=0,Bi[39]=1,Ui[39]=1,ji[39]=0,Vi[39]=0;var so=function(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]},uo=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]},lo=function(t){return[[t.topright,1],[1,1],[1,t.righttop]]},co=function(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]},ho=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]},po=function(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]},fo=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]},go=function(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},yo=[],mo=[],vo=[],_o=[],xo=[],bo=[],wo=[],Eo=[];_o[1]=xo[1]=18,_o[169]=xo[169]=18,vo[4]=mo[4]=12,vo[166]=mo[166]=12,yo[16]=Eo[16]=4,yo[154]=Eo[154]=4,bo[64]=wo[64]=22,bo[106]=wo[106]=22,vo[2]=bo[2]=17,_o[2]=xo[2]=18,vo[168]=bo[168]=17,_o[168]=xo[168]=18,yo[8]=_o[8]=9,mo[8]=vo[8]=12,yo[162]=_o[162]=9,mo[162]=vo[162]=12,yo[32]=Eo[32]=4,mo[32]=wo[32]=1,yo[138]=Eo[138]=4,mo[138]=wo[138]=1,xo[128]=Eo[128]=21,bo[128]=wo[128]=22,xo[42]=Eo[42]=21,bo[42]=wo[42]=22,mo[5]=xo[5]=14,mo[165]=xo[165]=14,vo[20]=Eo[20]=6,vo[150]=Eo[150]=6,yo[80]=bo[80]=11,yo[90]=bo[90]=11,_o[65]=wo[65]=3,_o[105]=wo[105]=3,yo[160]=bo[160]=11,mo[160]=xo[160]=14,yo[10]=bo[10]=11,mo[10]=xo[10]=14,vo[130]=Eo[130]=6,_o[130]=wo[130]=3,vo[40]=Eo[40]=6,_o[40]=wo[40]=3,mo[101]=wo[101]=1,mo[69]=wo[69]=1,xo[149]=Eo[149]=21,xo[21]=Eo[21]=21,vo[86]=bo[86]=17,vo[84]=bo[84]=17,yo[89]=_o[89]=9,yo[81]=_o[81]=9,yo[96]=wo[96]=0,mo[96]=bo[96]=15,yo[74]=wo[74]=0,mo[74]=bo[74]=15,yo[24]=vo[24]=8,_o[24]=Eo[24]=7,yo[146]=vo[146]=8,_o[146]=Eo[146]=7,mo[6]=bo[6]=15,vo[6]=xo[6]=16,mo[164]=bo[164]=15,vo[164]=xo[164]=16,_o[129]=Eo[129]=7,xo[129]=wo[129]=20,_o[41]=Eo[41]=7,xo[41]=wo[41]=20,vo[66]=wo[66]=2,_o[66]=bo[66]=19,vo[104]=wo[104]=2,_o[104]=bo[104]=19,yo[144]=xo[144]=10,bo[144]=Eo[144]=23,yo[26]=xo[26]=10,bo[26]=Eo[26]=23,mo[36]=Eo[36]=5,vo[36]=wo[36]=2,mo[134]=Eo[134]=5,vo[134]=wo[134]=2,yo[9]=xo[9]=10,mo[9]=_o[9]=13,yo[161]=xo[161]=10,mo[161]=_o[161]=13,mo[37]=Eo[37]=5,xo[37]=wo[37]=20,mo[133]=Eo[133]=5,xo[133]=wo[133]=20,vo[148]=xo[148]=16,bo[148]=Eo[148]=23,vo[22]=xo[22]=16,bo[22]=Eo[22]=23,yo[82]=vo[82]=8,_o[82]=bo[82]=19,yo[88]=vo[88]=8,_o[88]=bo[88]=19,yo[73]=wo[73]=0,mo[73]=_o[73]=13,yo[97]=wo[97]=0,mo[97]=_o[97]=13,yo[145]=_o[145]=9,xo[145]=Eo[145]=21,yo[25]=_o[25]=9,xo[25]=Eo[25]=21,mo[70]=wo[70]=1,vo[70]=bo[70]=17,mo[100]=wo[100]=1,vo[100]=bo[100]=17,yo[34]=_o[34]=9,mo[34]=vo[34]=12,xo[34]=Eo[34]=21,bo[34]=wo[34]=22,yo[136]=Eo[136]=4,mo[136]=wo[136]=1,vo[136]=bo[136]=17,_o[136]=xo[136]=18,yo[35]=Eo[35]=4,mo[35]=vo[35]=12,_o[35]=xo[35]=18,bo[35]=wo[35]=22,yo[153]=Eo[153]=4,_o[153]=xo[153]=18,mo[102]=vo[102]=12,bo[102]=wo[102]=22,yo[155]=_o[155]=9,xo[155]=Eo[155]=23,mo[103]=wo[103]=1,vo[103]=bo[103]=17,yo[152]=Eo[152]=4,vo[152]=bo[152]=17,_o[152]=xo[152]=18,yo[156]=vo[156]=8,_o[156]=xo[156]=18,bo[156]=Eo[156]=23,yo[137]=Eo[137]=4,mo[137]=wo[137]=1,_o[137]=xo[137]=18,yo[139]=Eo[139]=4,mo[139]=_o[139]=13,xo[139]=wo[139]=20,yo[98]=_o[98]=9,mo[98]=vo[98]=12,bo[98]=wo[98]=22,yo[99]=wo[99]=0,mo[99]=vo[99]=12,_o[99]=bo[99]=19,mo[38]=vo[38]=12,xo[38]=Eo[38]=21,bo[38]=wo[38]=22,mo[39]=Eo[39]=5,vo[39]=xo[39]=16,bo[39]=wo[39]=22;var Io=[];function So(t,e,r){return(t-e)/(r-e)}function Co(t){return t.constructor.toString().indexOf("Array")>-1}function Po(t,e,r,n,i,o){for(var a=t.cells[r][e],s=a.cval_real,u=e+n,l=r+i,c=[],h=!1;!h;){if(void 0===t.cells[l]||void 0===t.cells[l][u])if(l-=i,u-=n,s=(a=t.cells[l][u]).cval_real,-1===i)if(0===o)if(1&s)c.push([u,l]),n=-1,i=0,o=0;else{if(!(4&s)){c.push([u+a.bottomright,l]),n=0,i=1,o=1,h=!0;break}c.push([u+1,l]),n=1,i=0,o=0}else{if(!(1&s)){if(4&s){c.push([u+a.bottomright,l]),n=0,i=1,o=1,h=!0;break}c.push([u+a.bottomleft,l]),n=0,i=1,o=0,h=!0;break}c.push([u,l]),n=-1,i=0,o=0}else if(1===i)if(0===o){if(!(s&Oi)){if(s&Ri){c.push([u+a.topleft,l+1]),n=0,i=-1,o=0,h=!0;break}c.push([u+a.topright,l+1]),n=0,i=-1,o=1,h=!0;break}c.push([u+1,l+1]),n=1,i=0,o=1}else c.push([u+1,l+1]),n=1,i=0,o=1;else if(-1===n)if(0===o){if(!(s&Ri)){if(1&s){c.push([u,l+a.leftbottom]),n=1,i=0,o=0,h=!0;break}c.push([u,l+a.lefttop]),n=1,i=0,o=1,h=!0;break}c.push([u,l+1]),n=0,i=1,o=0}else{if(!(s&Ri)){console.log("MarchingSquaresJS-isoBands: wtf");break}c.push([u,l+1]),n=0,i=1,o=0}else{if(1!==n){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===o){if(!(4&s)){c.push([u+1,l+a.rightbottom]),n=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),n=0,i=-1,o=1}else{if(!(4&s)){if(s&Oi){c.push([u+1,l+a.righttop]),n=-1,i=0,o=1;break}c.push([u+1,l+a.rightbottom]),n=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),n=0,i=-1,o=1}}else if(s=(a=t.cells[l][u]).cval_real,-1===n)if(0===o)if(void 0!==t.cells[l-1]&&void 0!==t.cells[l-1][u])n=0,i=-1,o=1;else{if(!(1&s)){c.push([u+a.bottomright,l]),n=0,i=1,o=1,h=!0;break}c.push([u,l])}else{if(!(s&Ri)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+l);break}console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!")}else if(1===n){if(0===o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l+1]&&void 0!==t.cells[l+1][u])n=0,i=1,o=0;else{if(!(s&Oi)){c.push([u+a.topleft,l+1]),n=0,i=-1,o=0,h=!0;break}c.push([u+1,l+1]),n=1,i=0,o=1}}else if(-1===i){if(1!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l][u+1])n=1,i=0,o=1;else{if(!(4&s)){c.push([u+1,l+a.righttop]),n=-1,i=0,o=1,h=!0;break}c.push([u+1,l]),n=0,i=-1,o=1}}else{if(1!==i){console.log("MarchingSquaresJS-isoBands: where did we came from???");break}if(0!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l][u-1])n=-1,i=0,o=0;else{if(!(s&Ri)){c.push([u,l+a.leftbottom]),n=1,i=0,o=0,h=!0;break}c.push([u,l+1]),n=0,i=1,o=0}}if(l+=i,(u+=n)===e&&l===r)break}return{path:c,i:u,j:l,x:n,y:i,o:o}}function Mo(t){if(t.edges.length>0){var e=t.edges[t.edges.length-1],r=t.cval_real;switch(e){case 0:return r&Oi?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return 4&r?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return 4&r?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return 1&r?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return r&Oi?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return 4&r?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return 4&r?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return 1&r?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return 4&r?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return 1&r?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return 1&r?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return r&Ri?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return 4&r?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return 1&r?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return 1&r?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return r&Ri?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return 4&r?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return r&Ri?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return 1&r?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return r&Ri?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return r&Ri?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return r&Oi?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return r&Ri?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return r&Oi?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t)}}return null}function To(t,e,r,n){var i,o,a,s,u,l=t.cval;switch(e){case-1:if(0===n)i=mo[l],a=Zi[l],s=Yi[l],u=Wi[l];else i=yo[l],a=qi[l],s=Gi[l],u=Xi[l];break;case 1:if(0===n)i=xo[l],a=io[l],s=oo[l],u=ao[l];else i=bo[l],a=eo[l],s=ro[l],u=no[l];break;default:switch(r){case-1:if(0===n)i=wo[l],a=zi[l],s=Fi[l],u=Bi[l];else i=Eo[l],a=Ui[l],s=ji[l],u=Vi[l];break;case 1:if(0===n)i=_o[l],a=Hi[l],s=Ji[l],u=Ki[l];else i=vo[l],a=$i[l],s=Qi[l],u=to[l]}}if(o=t.edges.indexOf(i),void 0===t.edges[o])return null;switch(function(t,e){delete t.edges[e];for(var r=e+1;r<t.edges.length;r++)t.edges[r-1]=t.edges[r];t.edges.pop()}(t,o),l=t.cval_real,i){case 0:l&Oi?(e=t.topleft,r=1):(e=1,r=t.righttop);break;case 1:4&l?(e=1,r=t.rightbottom):(e=t.topleft,r=1);break;case 2:4&l?(e=t.topleft,r=1):(e=t.bottomright,r=0);break;case 3:1&l?(e=t.bottomleft,r=0):(e=t.topleft,r=1);break;case 4:l&Oi?(e=t.topright,r=1):(e=1,r=t.righttop);break;case 5:4&l?(e=1,r=t.rightbottom):(e=t.topright,r=1);break;case 6:4&l?(e=t.topright,r=1):(e=t.bottomright,r=0);break;case 7:1&l?(e=t.bottomleft,r=0):(e=t.topright,r=1);break;case 8:4&l?(e=1,r=t.righttop):(e=t.bottomright,r=0);break;case 9:1&l?(e=t.bottomleft,r=0):(e=1,r=t.righttop);break;case 10:1&l?(e=1,r=t.righttop):(e=0,r=t.leftbottom);break;case 11:l&Ri?(e=0,r=t.lefttop):(e=1,r=t.righttop);break;case 12:4&l?(e=1,r=t.rightbottom):(e=t.bottomright,r=0);break;case 13:1&l?(e=t.bottomleft,r=0):(e=1,r=t.rightbottom);break;case 14:1&l?(e=1,r=t.rightbottom):(e=0,r=t.leftbottom);break;case 15:l&Ri?(e=0,r=t.lefttop):(e=1,r=t.rightbottom);break;case 16:4&l?(e=0,r=t.leftbottom):(e=t.bottomright,r=0);break;case 17:l&Ri?(e=0,r=t.lefttop):(e=t.bottomright,r=0);break;case 18:1&l?(e=t.bottomleft,r=0):(e=0,r=t.leftbottom);break;case 19:l&Ri?(e=0,r=t.lefttop):(e=t.bottomleft,r=0);break;case 20:l&Ri?(e=0,r=t.leftbottom):(e=t.topleft,r=1);break;case 21:l&Oi?(e=t.topright,r=1):(e=0,r=t.leftbottom);break;case 22:l&Ri?(e=0,r=t.lefttop):(e=t.topleft,r=1);break;case 23:l&Oi?(e=t.topright,r=1):(e=0,r=t.lefttop);break;default:return console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t),null}return void 0!==e&&void 0!==r&&void 0!==a&&void 0!==s&&void 0!==u||(console.log("MarchingSquaresJS-isoBands: undefined value!"),console.log(t),console.log(e+" "+r+" "+a+" "+s+" "+u)),{p:[e,r],x:a,y:s,o:u}}function Lo(t){var e=[],r=[];t.forEach((function(t){var n=Sn(l([t]));r.push(n),e.push({ring:t,area:n})})),r.sort((function(t,e){return e-t}));var n=[];return r.forEach((function(t){for(var r=0;r<e.length;r++)if(e[r].area===t){n.push(e[r].ring),e.splice(r,1);break}})),n}function Ao(t){for(var e=t.map((function(t){return{lrCoordinates:t,grouped:!1}})),r=[];!No(e);)for(var n=0;n<e.length;n++)if(!e[n].grouped){var i=[];i.push(e[n].lrCoordinates),e[n].grouped=!0;for(var o=l([e[n].lrCoordinates]),a=n+1;a<e.length;a++)e[a].grouped||ko(l([e[a].lrCoordinates]),o)&&(i.push(e[a].lrCoordinates),e[a].grouped=!0);r.push(i)}return r}function ko(t,e){for(var r=dr(t),n=0;n<r.features.length;n++)if(!fe(r.features[n],e))return!1;return!0}function No(t){for(var e=0;e<t.length;e++)if(!1===t[e].grouped)return!1;return!0}function Do(t,e,r){if(!M(r=r||{}))throw new Error("options is invalid");var n=r.pivot,i=r.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("angle is required");return 0===e||(n||(n=fr(t)),!1!==i&&void 0!==i||(t=be(t)),k(t,(function(t){var r=wi(n,t)+e,i=mn(n,t),o=$(Ii(n,i,r));t[0]=o[0],t[1]=o[1]}))),t}function Ro(t,e,r){if(!M(r=r||{}))throw new Error("options is invalid");var n=r.origin,i=r.mutate;if(!t)throw new Error("geojson required");if("number"!=typeof e||0===e)throw new Error("invalid factor");var o=Array.isArray(n)||"object"==typeof n;return!0!==i&&(t=be(t)),"FeatureCollection"!==t.type||o?Oo(t,e,n):(O(t,(function(r,i){t.features[i]=Oo(r,e,n)})),t)}function Oo(t,e,r){var n="Point"===it(t);return r=function(t,e){null==e&&(e="centroid");if(Array.isArray(e)||"object"==typeof e)return K(e);var r=t.bbox?t.bbox:J(t),n=r[0],i=r[1],o=r[2],a=r[3];switch(e){case"sw":case"southwest":case"westsouth":case"bottomleft":return s([n,i]);case"se":case"southeast":case"eastsouth":case"bottomright":return s([o,i]);case"nw":case"northwest":case"westnorth":case"topleft":return s([n,a]);case"ne":case"northeast":case"eastnorth":case"topright":return s([o,a]);case"center":return pr(t);case void 0:case null:case"centroid":return fr(t);default:throw new Error("invalid origin")}}(t,r),1===e||n||k(t,(function(t){var n=mn(r,t),i=wi(r,t),o=$(Ii(r,n*e,i));t[0]=o[0],t[1]=o[1],3===t.length&&(t[2]*=e)})),t}function zo(t){var e=t[0],r=t[1];return[r[0]-e[0],r[1]-e[1]]}function Fo(t,e){return t[0]*e[1]-e[0]*t[1]}function Bo(t,e,r){var n=[],i=b(e,r),o=$(t),a=[];return o.forEach((function(t,e){if(e!==o.length-1){var r=(l=t,c=o[e+1],h=i,p=Math.sqrt((l[0]-c[0])*(l[0]-c[0])+(l[1]-c[1])*(l[1]-c[1])),f=l[0]+h*(c[1]-l[1])/p,d=c[0]+h*(c[1]-l[1])/p,[[f,l[1]+h*(l[0]-c[0])/p],[d,c[1]+h*(l[0]-c[0])/p]]);if(n.push(r),e>0){var s=n[e-1],u=function(t,e){return!function(t,e){return 0===Fo(zo(t),zo(e))}(t,e)&&function(t,e){var r,n,i=t[0],o=zo(t),a=e[0],s=zo(e),u=Fo(o,s);return function(t,e){return[t[0]+e[0],t[1]+e[1]]}(i,function(t,e){return[t*e[0],t*e[1]]}(Fo((n=i,[(r=a)[0]-n[0],r[1]-n[1]]),s)/u,o))}(t,e)}(r,s);!1!==u&&(s[1]=u,r[0]=u),a.push(s[0]),e===o.length-2&&(a.push(r[0]),a.push(r[1]))}2===o.length&&(a.push(r[0]),a.push(r[1]))}var l,c,h,p,f,d})),h(a,t.properties)}function Uo(t,e,r){var n=e[0]-t[0],i=e[1]-t[1],o=r[0]-e[0];return function(t){return(t>0)-(t<0)||+t}(n*(r[1]-e[1])-o*i)}function jo(t,e){return e.geometry.coordinates[0].every((function(e){return fe(s(e),t)}))}Io[1]=Io[169]=so,Io[4]=Io[166]=uo,Io[16]=Io[154]=lo,Io[64]=Io[106]=co,Io[168]=Io[2]=ho,Io[162]=Io[8]=po,Io[138]=Io[32]=fo,Io[42]=Io[128]=go,Io[5]=Io[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},Io[20]=Io[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},Io[80]=Io[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},Io[65]=Io[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Io[160]=Io[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},Io[130]=Io[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},Io[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},Io[101]=Io[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},Io[149]=Io[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},Io[86]=Io[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},Io[89]=Io[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},Io[96]=Io[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[24]=Io[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},Io[6]=Io[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},Io[129]=Io[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},Io[66]=Io[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[144]=Io[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Io[36]=Io[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},Io[9]=Io[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},Io[37]=Io[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Io[148]=Io[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Io[82]=Io[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},Io[73]=Io[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Io[145]=Io[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Io[70]=Io[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[34]=function(t){return[go(t),po(t)]},Io[35]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},Io[136]=function(t){return[fo(t),ho(t)]},Io[153]=function(t){return[lo(t),so(t)]},Io[102]=function(t){return[uo(t),co(t)]},Io[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Io[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[152]=function(t){return[lo(t),ho(t)]},Io[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Io[137]=function(t){return[fo(t),so(t)]},Io[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Io[98]=function(t){return[po(t),co(t)]},Io[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[38]=function(t){return[uo(t),go(t)]},Io[39]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]};var Vo=function(){function t(e){this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return t.buildId=function(t){return t.join(",")},t.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter((function(e){return e.from.id!==t.from.id}))},t.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter((function(e){return e.to.id!==t.to.id}))},t.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},t.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort((function(e,r){var n=e.to,i=r.to;if(n.coordinates[0]-t.coordinates[0]>=0&&i.coordinates[0]-t.coordinates[0]<0)return 1;if(n.coordinates[0]-t.coordinates[0]<0&&i.coordinates[0]-t.coordinates[0]>=0)return-1;if(n.coordinates[0]-t.coordinates[0]==0&&i.coordinates[0]-t.coordinates[0]==0)return n.coordinates[1]-t.coordinates[1]>=0||i.coordinates[1]-t.coordinates[1]>=0?n.coordinates[1]-i.coordinates[1]:i.coordinates[1]-n.coordinates[1];var o=Uo(t.coordinates,n.coordinates,i.coordinates);return o<0?1:o>0?-1:Math.pow(n.coordinates[0]-t.coordinates[0],2)+Math.pow(n.coordinates[1]-t.coordinates[1],2)-(Math.pow(i.coordinates[0]-t.coordinates[0],2)+Math.pow(i.coordinates[1]-t.coordinates[1],2))})),this.outerEdgesSorted=!0)},t.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},t.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},t.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},t}(),qo=function(){function t(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return t.prototype.getSymetric=function(){return this.symetric||(this.symetric=new t(this.to,this.from),this.symetric.symetric=this),this.symetric},t.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},t.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},t.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},t.prototype.toLineString=function(){return h([this.from.coordinates,this.to.coordinates])},t.prototype.compareTo=function(t){return Uo(t.from.coordinates,t.to.coordinates,this.to.coordinates)},t}(),Go=function(){function t(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return t.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},t.prototype.get=function(t){return this.edges[t]},Object.defineProperty(t.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),t.prototype.forEach=function(t){this.edges.forEach(t)},t.prototype.map=function(t){return this.edges.map(t)},t.prototype.some=function(t){return this.edges.some(t)},t.prototype.isValid=function(){return!0},t.prototype.isHole=function(){var t=this,e=this.edges.reduce((function(e,r,n){return r.from.coordinates[1]>t.edges[e].from.coordinates[1]&&(e=n),e}),0),r=(0===e?this.length:e)-1,n=(e+1)%this.length,i=Uo(this.edges[r].from.coordinates,this.edges[e].from.coordinates,this.edges[n].from.coordinates);return 0===i?this.edges[r].from.coordinates[0]>this.edges[n].from.coordinates[0]:i>0},t.prototype.toMultiPoint=function(){return g(this.edges.map((function(t){return t.from.coordinates})))},t.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map((function(t){return t.from.coordinates}));return t.push(this.edges[0].from.coordinates),this.polygon=l([t])},t.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=sr(this.toPolygon())},t.findEdgeRingContaining=function(t,e){var r,n,i=t.getEnvelope();return e.forEach((function(e){var o,a,u,l,c,h,p=e.getEnvelope();if((n&&(r=n.getEnvelope()),a=i,u=(o=p).geometry.coordinates[0].map((function(t){return t[0]})),l=o.geometry.coordinates[0].map((function(t){return t[1]})),c=a.geometry.coordinates[0].map((function(t){return t[0]})),h=a.geometry.coordinates[0].map((function(t){return t[1]})),Math.max.apply(null,u)!==Math.max.apply(null,c)||Math.max.apply(null,l)!==Math.max.apply(null,h)||Math.min.apply(null,u)!==Math.min.apply(null,c)||Math.min.apply(null,l)!==Math.min.apply(null,h))&&jo(p,i)){for(var f=t.map((function(t){return t.from.coordinates})),d=void 0,g=function(t){e.some((function(e){return r=t,n=e.from.coordinates,r[0]===n[0]&&r[1]===n[1];var r,n}))||(d=t)},y=0,m=f;y<m.length;y++)g(m[y]);d&&e.inside(s(d))&&(n&&!jo(r,p)||(n=e))}})),n},t.prototype.inside=function(t){return fe(t,this.toPolygon())},t}(),Xo=function(){function t(){this.edges=[],this.nodes={}}return t.fromGeoJson=function(e){!function(t){if(!t)throw new Error("No geojson passed");if("FeatureCollection"!==t.type&&"GeometryCollection"!==t.type&&"MultiLineString"!==t.type&&"LineString"!==t.type&&"Feature"!==t.type)throw new Error("Invalid input type '"+t.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}(e);var r=new t;return j(e,(function(t){et(t,"LineString","Graph::fromGeoJson"),N(t,(function(t,e){if(t){var n=r.getNode(t),i=r.getNode(e);r.addEdge(n,i)}return e}))})),r},t.prototype.getNode=function(t){var e=Vo.buildId(t),r=this.nodes[e];return r||(r=this.nodes[e]=new Vo(t)),r},t.prototype.addEdge=function(t,e){var r=new qo(t,e),n=r.getSymetric();this.edges.push(r),this.edges.push(n)},t.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map((function(e){return t.nodes[e]})).forEach((function(e){return t._removeIfDangle(e)}))},t.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var r=t.getOuterEdges().map((function(t){return t.to}));this.removeNode(t),r.forEach((function(t){return e._removeIfDangle(t)}))}},t.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach((function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))}))},t.prototype._computeNextCWEdges=function(t){var e=this;void 0===t?Object.keys(this.nodes).forEach((function(t){return e._computeNextCWEdges(e.nodes[t])})):t.getOuterEdges().forEach((function(e,r){t.getOuterEdge((0===r?t.getOuterEdges().length:r)-1).symetric.next=e}))},t.prototype._computeNextCCWEdges=function(t,e){for(var r,n,i=t.getOuterEdges(),o=i.length-1;o>=0;--o){var a=i[o],s=a.symetric,u=void 0,l=void 0;a.label===e&&(u=a),s.label===e&&(l=s),u&&l&&(l&&(n=l),u&&(n&&(n.next=u,n=void 0),r||(r=u)))}n&&(n.next=r)},t.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach((function(r){if(!(r.label>=0)){t.push(r);var n=r;do{n.label=e,n=n.next}while(!r.isEqual(n));e++}})),t},t.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach((function(t){t.label=void 0})),this._findLabeledEdgeRings().forEach((function(e){t._findIntersectionNodes(e).forEach((function(r){t._computeNextCCWEdges(r,e.label)}))}));var e=[];return this.edges.forEach((function(r){r.ring||e.push(t._findEdgeRing(r))})),e},t.prototype._findIntersectionNodes=function(t){var e=[],r=t,n=function(){var n=0;r.from.getOuterEdges().forEach((function(e){e.label===t.label&&++n})),n>1&&e.push(r.from),r=r.next};do{n()}while(!t.isEqual(r));return e},t.prototype._findEdgeRing=function(t){var e=t,r=new Go;do{r.push(e),e.ring=r,e=e.next}while(!t.isEqual(e));return r},t.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach((function(t){return e.removeEdge(t)})),t.innerEdges.forEach((function(t){return e.removeEdge(t)})),delete this.nodes[t.id]},t.prototype.removeEdge=function(t){this.edges=this.edges.filter((function(e){return!e.isEqual(t)})),t.deleteEdge()},t}();function Zo(t,e){var r=!0;return j(t,(function(t){j(e,(function(e){if(!1===r)return!1;r=function(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return r=t.coordinates,n=e.coordinates,!(r[0]===n[0]&&r[1]===n[1]);case"LineString":return!Yo(e,t);case"Polygon":return!fe(t,e)}break;case"LineString":switch(e.type){case"Point":return!Yo(t,e);case"LineString":return!function(t,e){return dn(t,e).features.length>0}(t,e);case"Polygon":return!Wo(e,t)}break;case"Polygon":switch(e.type){case"Point":return!fe(e,t);case"LineString":return!Wo(t,e);case"Polygon":return!function(t,e){for(var r=0,n=t.coordinates[0];r<n.length;r++)if(fe(n[r],e))return!0;for(var i=0,o=e.coordinates[0];i<o.length;i++)if(fe(o[i],t))return!0;return dn(ai(t),ai(e)).features.length>0}(e,t)}}var r,n;return!1}(t.geometry,e.geometry)}))})),r}function Yo(t,e){for(var r=0;r<t.coordinates.length-1;r++)if(Ho(t.coordinates[r],t.coordinates[r+1],e.coordinates))return!0;return!1}function Wo(t,e){for(var r=0,n=e.coordinates;r<n.length;r++)if(fe(n[r],t))return!0;return dn(e,ai(t)).features.length>0}function Ho(t,e,r){var n=r[0]-t[0],i=r[1]-t[1],o=e[0]-t[0],a=e[1]-t[1];return 0==n*a-i*o&&(Math.abs(o)>=Math.abs(a)?o>0?t[0]<=r[0]&&r[0]<=e[0]:e[0]<=r[0]&&r[0]<=t[0]:a>0?t[1]<=r[1]&&r[1]<=e[1]:e[1]<=r[1]&&r[1]<=t[1])}function Jo(t,e){return!(t[0]>e[0]||t[2]<e[2]||t[1]>e[1]||t[3]<e[3])}function Ko(t,e){return t[0]===e[0]&&t[1]===e[1]}function $o(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function Qo(t,e){for(var r=!1,n=!1,i=t.coordinates.length,o=0;o<i&&!r&&!n;){for(var a=0;a<e.coordinates.length-1;a++){var s=!0;0!==a&&a!==e.coordinates.length-2||(s=!1),ra(e.coordinates[a],e.coordinates[a+1],t.coordinates[o],s)?r=!0:n=!0}o++}return r&&n}function ta(t,e){return dn(t,si(e)).features.length>0}function ea(t,e){for(var r=!1,n=!1,i=t.coordinates.length,o=0;o<i&&(!r||!n);o++)fe(s(t.coordinates[o]),e)?r=!0:n=!0;return n&&r}function ra(t,e,r,n){var i=r[0]-t[0],o=r[1]-t[1],a=e[0]-t[0],s=e[1]-t[1];return 0==i*s-o*a&&(n?Math.abs(a)>=Math.abs(s)?a>0?t[0]<=r[0]&&r[0]<=e[0]:e[0]<=r[0]&&r[0]<=t[0]:s>0?t[1]<=r[1]&&r[1]<=e[1]:e[1]<=r[1]&&r[1]<=t[1]:Math.abs(a)>=Math.abs(s)?a>0?t[0]<r[0]&&r[0]<e[0]:e[0]<r[0]&&r[0]<t[0]:s>0?t[1]<r[1]&&r[1]<e[1]:e[1]<r[1]&&r[1]<t[1])}var na=function(t){this.precision=t&&t.precision?t.precision:17,this.direction=!(!t||!t.direction)&&t.direction,this.pseudoNode=!(!t||!t.pseudoNode)&&t.pseudoNode,this.objectComparator=t&&t.objectComparator?t.objectComparator:aa};function ia(t){return t.coordinates.map((function(e){return{type:t.type.replace("Multi",""),coordinates:e}}))}function oa(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function aa(t,e){return vi(t,e,{strict:!0})}na.prototype.compare=function(t,e){if(t.type!==e.type||!oa(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates,0,!1);case"Polygon":return this.comparePolygon(t,e);case"Feature":return this.compareFeature(t,e);default:if(0===t.type.indexOf("Multi")){var r=this,n=ia(t),i=ia(e);return n.every((function(t){return this.some((function(e){return r.compare(t,e)}))}),i)}}return!1},na.prototype.compareCoord=function(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(t[r].toFixed(this.precision)!==e[r].toFixed(this.precision))return!1;return!0},na.prototype.compareLine=function(t,e,r,n){if(!oa(t,e))return!1;var i=this.pseudoNode?t:this.removePseudo(t),o=this.pseudoNode?e:this.removePseudo(e);if(!n||this.compareCoord(i[0],o[0])||(o=this.fixStartIndex(o,i))){var a=this.compareCoord(i[r],o[r]);return this.direction||a?this.comparePath(i,o):!!this.compareCoord(i[r],o[o.length-(1+r)])&&this.comparePath(i.slice().reverse(),o)}},na.prototype.fixStartIndex=function(t,e){for(var r,n=-1,i=0;i<t.length;i++)if(this.compareCoord(t[i],e[0])){n=i;break}return n>=0&&(r=[].concat(t.slice(n,t.length),t.slice(1,n+1))),r},na.prototype.comparePath=function(t,e){var r=this;return t.every((function(t,e){return r.compareCoord(t,this[e])}),e)},na.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var r=t.coordinates.slice(1,t.coordinates.length),n=e.coordinates.slice(1,e.coordinates.length),i=this;return r.every((function(t){return this.some((function(e){return i.compareLine(t,e,1,!0)}))}),n)}return!1},na.prototype.compareFeature=function(t,e){return!(t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e))&&this.compare(t.geometry,e.geometry)},na.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},na.prototype.removePseudo=function(t){return t};var sa=na;function ua(t,e){var r=!1;return j(t,(function(t){j(e,(function(e){if(!0===r)return!0;r=!Zo(t.geometry,e.geometry)}))})),r}var la=Ft((function(t){function e(t,e,r,n){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(t,e,r,n)}e.prototype.run=function(t,e,r,n){this._init(t,e,r,n);for(var i=0;i<this._datasetLength;i++)if(1!==this._visited[i]){this._visited[i]=1;var o=this._regionQuery(i);if(o.length<this.minPts)this.noise.push(i);else{var a=this.clusters.length;this.clusters.push([]),this._addToCluster(i,a),this._expandCluster(a,o)}}return this.clusters},e.prototype._init=function(t,e,r,n){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+typeof t+" given");this.dataset=t,this.clusters=[],this.noise=[],this._datasetLength=t.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}e&&(this.epsilon=e),r&&(this.minPts=r),n&&(this.distance=n)},e.prototype._expandCluster=function(t,e){for(var r=0;r<e.length;r++){var n=e[r];if(1!==this._visited[n]){this._visited[n]=1;var i=this._regionQuery(n);i.length>=this.minPts&&(e=this._mergeArrays(e,i))}1!==this._assigned[n]&&this._addToCluster(n,t)}},e.prototype._addToCluster=function(t,e){this.clusters[e].push(t),this._assigned[t]=1},e.prototype._regionQuery=function(t){for(var e=[],r=0;r<this._datasetLength;r++)this.distance(this.dataset[t],this.dataset[r])<this.epsilon&&e.push(r);return e},e.prototype._mergeArrays=function(t,e){for(var r=e.length,n=0;n<r;n++){var i=e[n];t.indexOf(i)<0&&t.push(i)}return t},e.prototype._euclideanDistance=function(t,e){for(var r=0,n=Math.min(t.length,e.length);n--;)r+=(t[n]-e[n])*(t[n]-e[n]);return Math.sqrt(r)},t.exports&&(t.exports=e)})),ca=Ft((function(t){function e(t,e,r){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(t,e,r)}e.prototype.init=function(t,e,r){this.assignments=[],this.centroids=[],void 0!==t&&(this.dataset=t),void 0!==e&&(this.k=e),void 0!==r&&(this.distance=r)},e.prototype.run=function(t,e){this.init(t,e);for(var r=this.dataset.length,n=0;n<this.k;n++)this.centroids[n]=this.randomCentroid();for(var i=!0;i;){i=this.assign();for(var o=0;o<this.k;o++){for(var a=new Array(c),s=0,u=0;u<c;u++)a[u]=0;for(var l=0;l<r;l++){var c=this.dataset[l].length;if(o===this.assignments[l]){for(u=0;u<c;u++)a[u]+=this.dataset[l][u];s++}}if(s>0){for(u=0;u<c;u++)a[u]/=s;this.centroids[o]=a}else this.centroids[o]=this.randomCentroid(),i=!0}}return this.getClusters()},e.prototype.randomCentroid=function(){var t,e,r=this.dataset.length-1;do{e=Math.round(Math.random()*r),t=this.dataset[e]}while(this.centroids.indexOf(t)>=0);return t},e.prototype.assign=function(){for(var t,e=!1,r=this.dataset.length,n=0;n<r;n++)(t=this.argmin(this.dataset[n],this.centroids,this.distance))!=this.assignments[n]&&(this.assignments[n]=t,e=!0);return e},e.prototype.getClusters=function(){for(var t,e=new Array(this.k),r=0;r<this.assignments.length;r++)void 0===e[t=this.assignments[r]]&&(e[t]=[]),e[t].push(r);return e},e.prototype.argmin=function(t,e,r){for(var n,i=Number.MAX_VALUE,o=0,a=e.length,s=0;s<a;s++)(n=r(t,e[s]))<i&&(i=n,o=s);return o},e.prototype.distance=function(t,e){for(var r=0,n=Math.min(t.length,e.length);n--;){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)},t.exports&&(t.exports=e)})),ha=Ft((function(t){function e(t,e,r){this._queue=[],this._priorities=[],this._sorting="desc",this._init(t,e,r)}e.prototype.insert=function(t,e){for(var r=this._queue.length,n=r;n--;){var i=this._priorities[n];"desc"===this._sorting?e>i&&(r=n):e<i&&(r=n)}this._insertAt(t,e,r)},e.prototype.remove=function(t){for(var e=this._queue.length;e--;)if(t===this._queue[e]){this._queue.splice(e,1),this._priorities.splice(e,1);break}},e.prototype.forEach=function(t){this._queue.forEach(t)},e.prototype.getElements=function(){return this._queue},e.prototype.getElementPriority=function(t){return this._priorities[t]},e.prototype.getPriorities=function(){return this._priorities},e.prototype.getElementsWithPriorities=function(){for(var t=[],e=0,r=this._queue.length;e<r;e++)t.push([this._queue[e],this._priorities[e]]);return t},e.prototype._init=function(t,e,r){if(t&&e){if(this._queue=[],this._priorities=[],t.length!==e.length)throw new Error("Arrays must have the same length");for(var n=0;n<t.length;n++)this.insert(t[n],e[n])}r&&(this._sorting=r)},e.prototype._insertAt=function(t,e,r){this._queue.length===r?(this._queue.push(t),this._priorities.push(e)):(this._queue.splice(r,0,t),this._priorities.splice(r,0,e))},t.exports&&(t.exports=e)})),pa=Ft((function(t){if(t.exports)var e=ha;function r(t,e,r,n){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(t,e,r,n)}r.prototype.run=function(t,r,n,i){this._init(t,r,n,i);for(var o=0,a=this.dataset.length;o<a;o++)if(1!==this._processed[o]){this._processed[o]=1,this.clusters.push([o]);var s=this.clusters.length-1;this._orderedList.push(o);var u=new e(null,null,"asc"),l=this._regionQuery(o);void 0!==this._distanceToCore(o)&&(this._updateQueue(o,l,u),this._expandCluster(s,u))}return this.clusters},r.prototype.getReachabilityPlot=function(){for(var t=[],e=0,r=this._orderedList.length;e<r;e++){var n=this._orderedList[e],i=this._reachability[n];t.push([n,i])}return t},r.prototype._init=function(t,e,r,n){if(t){if(!(t instanceof Array))throw Error("Dataset must be of type array, "+typeof t+" given");this.dataset=t,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}e&&(this.epsilon=e),r&&(this.minPts=r),n&&(this.distance=n)},r.prototype._updateQueue=function(t,e,r){var n=this;this._coreDistance=this._distanceToCore(t),e.forEach((function(e){if(void 0===n._processed[e]){var i=n.distance(n.dataset[t],n.dataset[e]),o=Math.max(n._coreDistance,i);void 0===n._reachability[e]?(n._reachability[e]=o,r.insert(e,o)):o<n._reachability[e]&&(n._reachability[e]=o,r.remove(e),r.insert(e,o))}}))},r.prototype._expandCluster=function(t,e){for(var r=e.getElements(),n=0,i=r.length;n<i;n++){var o=r[n];if(void 0===this._processed[o]){var a=this._regionQuery(o);this._processed[o]=1,this.clusters[t].push(o),this._orderedList.push(o),void 0!==this._distanceToCore(o)&&(this._updateQueue(o,a,e),this._expandCluster(t,e))}}},r.prototype._distanceToCore=function(t){for(var e=this.epsilon,r=0;r<e;r++)if(this._regionQuery(t,r).length>=this.minPts)return r},r.prototype._regionQuery=function(t,e){e=e||this.epsilon;for(var r=[],n=0,i=this.dataset.length;n<i;n++)this.distance(this.dataset[t],this.dataset[n])<e&&r.push(n);return r},r.prototype._euclideanDistance=function(t,e){for(var r=0,n=Math.min(t.length,e.length);n--;)r+=(t[n]-e[n])*(t[n]-e[n]);return Math.sqrt(r)},t.exports&&(t.exports=r)})),fa=Ft((function(t){t.exports&&(t.exports={DBSCAN:la,KMEANS:ca,OPTICS:pa,PriorityQueue:ha})})),da=function(t,e,r){for(var n=t.length,i=0,o=0;o<n;o++){var a=(t[o]||0)-(e[o]||0);i+=a*a}return r?Math.sqrt(i):i},ga=da,ya=function(t,e,r){var n=Math.abs(t-e);return r?n:n*n},ma=da;function va(t,e,r){r=r||[];for(var n=0;n<t;n++)r[n]=e;return r}var _a=function(t,e,r,n){var i=[],o=[],a=[],s=[],u=!1,l=n||1e4,c=t.length,h=t[0].length,p=h>0,f=[];if(r)i="kmrand"==r?function(t,e){for(var r={},n=[],i=e<<2,o=t.length,a=t[0].length>0;n.length<e&&i-- >0;){var s=t[Math.floor(Math.random()*o)],u=a?s.join("_"):""+s;r[u]||(r[u]=!0,n.push(s))}if(n.length<e)throw new Error("Error initializating clusters");return n}(t,e):"kmpp"==r?function(t,e){var r=t[0].length?ga:ya,n=[],i=t.length,o=t[0].length>0,a=t[Math.floor(Math.random()*i)];o&&a.join("_");for(n.push(a);n.length<e;){for(var s=[],u=n.length,l=0,c=[],h=0;h<i;h++){for(var p=1/0,f=0;f<u;f++){var d=r(t[h],n[f]);d<=p&&(p=d)}s[h]=p}for(var g=0;g<i;g++)l+=s[g];for(var y=0;y<i;y++)c[y]={i:y,v:t[y],pr:s[y]/l,cs:0};c.sort((function(t,e){return t.pr-e.pr})),c[0].cs=c[0].pr;for(var m=1;m<i;m++)c[m].cs=c[m-1].cs+c[m].pr;for(var v=Math.random(),_=0;_<i-1&&c[_++].cs<v;);n.push(c[_-1].v)}return n}(t,e):r;else for(var d={};i.length<e;){var g=Math.floor(Math.random()*c);d[g]||(d[g]=!0,i.push(t[g]))}do{va(e,0,f);for(var y=0;y<c;y++){for(var m=1/0,v=0,_=0;_<e;_++)(s=p?ma(t[y],i[_]):Math.abs(t[y]-i[_]))<=m&&(m=s,v=_);a[y]=v,f[v]++}for(var x=[],b=(o=[],0);b<e;b++)x[b]=p?va(h,0,x[b]):0,o[b]=i[b];if(p){for(var w=0;w<e;w++)i[w]=[];for(var E=0;E<c;E++)for(var I=x[a[E]],S=t[E],C=0;C<h;C++)I[C]+=S[C];u=!0;for(var P=0;P<e;P++){for(var M=i[P],T=x[P],L=o[P],A=f[P],k=0;k<h;k++)M[k]=T[k]/A||0;if(u)for(var N=0;N<h;N++)if(L[N]!=M[N]){u=!1;break}}}else{for(var D=0;D<c;D++)x[a[D]]+=t[D];for(var R=0;R<e;R++)i[R]=x[R]/f[R]||0;u=!0;for(var O=0;O<e;O++)if(o[O]!=i[O]){u=!1;break}}u=u||--l<=0}while(!u);return{it:1e4-l,k:e,idxs:a,centroids:i}};function xa(t,e){return w(wi(t[0],t[1]))===w(wi(e[0],e[1]))}function ba(t,e){if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error("Invalid GeoJSON object for "+e)}function wa(t){for(var e=t,r=[];e.parent;)r.unshift(e),e=e.parent;return r}var Ea={search:function(t,e,r,n){t.cleanDirty();var i=(n=n||{}).heuristic||Ea.heuristics.manhattan,o=n.closest||!1,a=new Ca((function(t){return t.f})),s=e;for(e.h=i(e,r),a.push(e);a.size()>0;){var u=a.pop();if(u===r)return wa(u);u.closed=!0;for(var l=t.neighbors(u),c=0,h=l.length;c<h;++c){var p=l[c];if(!p.closed&&!p.isWall()){var f=u.g+p.getCost(u),d=p.visited;(!d||f<p.g)&&(p.visited=!0,p.parent=u,p.h=p.h||i(p,r),p.g=f,p.f=p.g+p.h,t.markDirty(p),o&&(p.h<s.h||p.h===s.h&&p.g<s.g)&&(s=p),d?a.rescoreElement(p):a.push(p))}}}return o?wa(s):[]},heuristics:{manhattan:function(t,e){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},diagonal:function(t,e){var r=Math.sqrt(2),n=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return 1*(n+i)+(r-2)*Math.min(n,i)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function Ia(t,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var r=0;r<t.length;r++){this.grid[r]=[];for(var n=0,i=t[r];n<i.length;n++){var o=new Sa(r,n,i[n]);this.grid[r][n]=o,this.nodes.push(o)}}this.init()}function Sa(t,e,r){this.x=t,this.y=e,this.weight=r}function Ca(t){this.content=[],this.scoreFunction=t}function Pa(t,e){for(var r=0;r<e.features.length;r++)if(fe(t,e.features[r]))return!0;return!1}function Ma(t){return function(){return t}}function Ta(t){return t[0]}function La(t){return t[1]}function Aa(){this._=null}function ka(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Na(t,e){var r=e,n=e.R,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.R=n.L,r.R&&(r.R.U=r),n.L=r}function Da(t,e){var r=e,n=e.L,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.L=n.R,r.L&&(r.L.U=r),n.R=r}function Ra(t){for(;t.L;)t=t.L;return t}function Oa(t,e,r,n){var i=[null,null],o=as.push(i)-1;return i.left=t,i.right=e,r&&Fa(i,t,e,r),n&&Fa(i,e,t,n),is[t.index].halfedges.push(o),is[e.index].halfedges.push(o),i}function za(t,e,r){var n=[e,r];return n.left=t,n}function Fa(t,e,r,n){t[0]||t[1]?t.left===r?t[1]=n:t[0]=n:(t[0]=n,t.left=e,t.right=r)}function Ba(t,e,r,n,i){var o,a=t[0],s=t[1],u=a[0],l=a[1],c=0,h=1,p=s[0]-u,f=s[1]-l;if(o=e-u,p||!(o>0)){if(o/=p,p<0){if(o<c)return;o<h&&(h=o)}else if(p>0){if(o>h)return;o>c&&(c=o)}if(o=n-u,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>c&&(c=o)}else if(p>0){if(o<c)return;o<h&&(h=o)}if(o=r-l,f||!(o>0)){if(o/=f,f<0){if(o<c)return;o<h&&(h=o)}else if(f>0){if(o>h)return;o>c&&(c=o)}if(o=i-l,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>c&&(c=o)}else if(f>0){if(o<c)return;o<h&&(h=o)}return!(c>0||h<1)||(c>0&&(t[0]=[u+c*p,l+c*f]),h<1&&(t[1]=[u+h*p,l+h*f]),!0)}}}}}function Ua(t,e,r,n,i){var o=t[1];if(o)return!0;var a,s,u=t[0],l=t.left,c=t.right,h=l[0],p=l[1],f=c[0],d=c[1],g=(h+f)/2,y=(p+d)/2;if(d===p){if(g<e||g>=n)return;if(h>f){if(u){if(u[1]>=i)return}else u=[g,r];o=[g,i]}else{if(u){if(u[1]<r)return}else u=[g,i];o=[g,r]}}else if(s=y-(a=(h-f)/(d-p))*g,a<-1||a>1)if(h>f){if(u){if(u[1]>=i)return}else u=[(r-s)/a,r];o=[(i-s)/a,i]}else{if(u){if(u[1]<r)return}else u=[(i-s)/a,i];o=[(r-s)/a,r]}else if(p<d){if(u){if(u[0]>=n)return}else u=[e,a*e+s];o=[n,a*n+s]}else{if(u){if(u[0]<e)return}else u=[n,a*n+s];o=[e,a*e+s]}return t[0]=u,t[1]=o,!0}function ja(t,e){var r=t.site,n=e.left,i=e.right;return r===i&&(i=n,n=r),i?Math.atan2(i[1]-n[1],i[0]-n[0]):(r===n?(n=e[1],i=e[0]):(n=e[0],i=e[1]),Math.atan2(n[0]-i[0],i[1]-n[1]))}function Va(t,e){return e[+(e.left!==t.site)]}function qa(t,e){return e[+(e.left===t.site)]}Ia.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)Ea.cleanNode(this.nodes[t])},Ia.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)Ea.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},Ia.prototype.markDirty=function(t){this.dirtyNodes.push(t)},Ia.prototype.neighbors=function(t){var e=[],r=t.x,n=t.y,i=this.grid;return i[r-1]&&i[r-1][n]&&e.push(i[r-1][n]),i[r+1]&&i[r+1][n]&&e.push(i[r+1][n]),i[r]&&i[r][n-1]&&e.push(i[r][n-1]),i[r]&&i[r][n+1]&&e.push(i[r][n+1]),this.diagonal&&(i[r-1]&&i[r-1][n-1]&&e.push(i[r-1][n-1]),i[r+1]&&i[r+1][n-1]&&e.push(i[r+1][n-1]),i[r-1]&&i[r-1][n+1]&&e.push(i[r-1][n+1]),i[r+1]&&i[r+1][n+1]&&e.push(i[r+1][n+1])),e},Ia.prototype.toString=function(){for(var t,e,r,n,i=[],o=this.grid,a=0,s=o.length;a<s;a++){for(t=[],r=0,n=(e=o[a]).length;r<n;r++)t.push(e[r].weight);i.push(t.join(" "))}return i.join("\n")},Sa.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},Sa.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},Sa.prototype.isWall=function(){return 0===this.weight},Ca.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),r=this.content.pop();e!==this.content.length-1&&(this.content[e]=r,this.scoreFunction(r)<this.scoreFunction(t)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(t){this.sinkDown(this.content.indexOf(t))},sinkDown:function(t){for(var e=this.content[t];t>0;){var r=(t+1>>1)-1,n=this.content[r];if(!(this.scoreFunction(e)<this.scoreFunction(n)))break;this.content[r]=e,this.content[t]=n,t=r}},bubbleUp:function(t){for(var e=this.content.length,r=this.content[t],n=this.scoreFunction(r);;){var i,o=t+1<<1,a=o-1,s=null;if(a<e){var u=this.content[a];(i=this.scoreFunction(u))<n&&(s=a)}if(o<e){var l=this.content[o];this.scoreFunction(l)<(null===s?n:i)&&(s=o)}if(null===s)break;this.content[t]=this.content[s],this.content[s]=r,t=s}}},Aa.prototype={constructor:Aa,insert:function(t,e){var r,n,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;r=t}else this._?(t=Ra(this._),e.P=null,e.N=t,t.P=t.L=e,r=t):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,t=e;r&&r.C;)r===(n=r.U).L?(i=n.R)&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.R&&(Na(this,r),r=(t=r).U),r.C=!1,n.C=!0,Da(this,n)):(i=n.L)&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.L&&(Da(this,r),r=(t=r).U),r.C=!1,n.C=!0,Na(this,n)),r=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,r,n,i=t.U,o=t.L,a=t.R;if(r=o?a?Ra(a):o:a,i?i.L===t?i.L=r:i.R=r:this._=r,o&&a?(n=r.C,r.C=t.C,r.L=o,o.U=r,r!==a?(i=r.U,r.U=t.U,t=r.R,i.L=t,r.R=a,a.U=r):(r.U=i,i=r,t=r.R)):(n=t.C,t=r),t&&(t.U=i),!n)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&&(e.C=!1,i.C=!0,Na(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,Da(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,Na(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,Da(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,Na(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,Da(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var Ga,Xa=[];function Za(){ka(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ya(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,o=r.site;if(n!==o){var a=i[0],s=i[1],u=n[0]-a,l=n[1]-s,c=o[0]-a,h=o[1]-s,p=2*(u*h-l*c);if(!(p>=-us)){var f=u*u+l*l,d=c*c+h*h,g=(h*f-l*d)/p,y=(u*d-c*f)/p,m=Xa.pop()||new Za;m.arc=t,m.site=i,m.x=g+a,m.y=(m.cy=y+s)+Math.sqrt(g*g+y*y),t.circle=m;for(var v=null,_=os._;_;)if(m.y<_.y||m.y===_.y&&m.x<=_.x){if(!_.L){v=_.P;break}_=_.L}else{if(!_.R){v=_;break}_=_.R}os.insert(v,m),v||(Ga=m)}}}}function Wa(t){var e=t.circle;e&&(e.P||(Ga=e.N),os.remove(e),Xa.push(e),ka(e),t.circle=null)}var Ha=[];function Ja(){ka(this),this.edge=this.site=this.circle=null}function Ka(t){var e=Ha.pop()||new Ja;return e.site=t,e}function $a(t){Wa(t),ns.remove(t),Ha.push(t),ka(t)}function Qa(t){var e=t.circle,r=e.x,n=e.cy,i=[r,n],o=t.P,a=t.N,s=[t];$a(t);for(var u=o;u.circle&&Math.abs(r-u.circle.x)<ss&&Math.abs(n-u.circle.cy)<ss;)o=u.P,s.unshift(u),$a(u),u=o;s.unshift(u),Wa(u);for(var l=a;l.circle&&Math.abs(r-l.circle.x)<ss&&Math.abs(n-l.circle.cy)<ss;)a=l.N,s.push(l),$a(l),l=a;s.push(l),Wa(l);var c,h=s.length;for(c=1;c<h;++c)l=s[c],u=s[c-1],Fa(l.edge,u.site,l.site,i);u=s[0],(l=s[h-1]).edge=Oa(u.site,l.site,null,i),Ya(u),Ya(l)}function ts(t){for(var e,r,n,i,o=t[0],a=t[1],s=ns._;s;)if((n=es(s,a)-o)>ss)s=s.L;else{if(!((i=o-rs(s,a))>ss)){n>-ss?(e=s.P,r=s):i>-ss?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}!function(t){is[t.index]={site:t,halfedges:[]}}(t);var u=Ka(t);if(ns.insert(e,u),e||r){if(e===r)return Wa(e),r=Ka(e.site),ns.insert(u,r),u.edge=r.edge=Oa(e.site,u.site),Ya(e),void Ya(r);if(r){Wa(e),Wa(r);var l=e.site,c=l[0],h=l[1],p=t[0]-c,f=t[1]-h,d=r.site,g=d[0]-c,y=d[1]-h,m=2*(p*y-f*g),v=p*p+f*f,_=g*g+y*y,x=[(y*v-f*_)/m+c,(p*_-g*v)/m+h];Fa(r.edge,l,d,x),u.edge=Oa(l,t,null,x),r.edge=Oa(t,d,null,x),Ya(e),Ya(r)}else u.edge=Oa(e.site,u.site)}}function es(t,e){var r=t.site,n=r[0],i=r[1],o=i-e;if(!o)return n;var a=t.P;if(!a)return-1/0;var s=(r=a.site)[0],u=r[1],l=u-e;if(!l)return s;var c=s-n,h=1/o-1/l,p=c/l;return h?(-p+Math.sqrt(p*p-2*h*(c*c/(-2*l)-u+l/2+i-o/2)))/h+n:(n+s)/2}function rs(t,e){var r=t.N;if(r)return es(r,e);var n=t.site;return n[1]===e?n[0]:1/0}var ns,is,os,as,ss=1e-6,us=1e-12;function ls(t,e){return e[1]-t[1]||e[0]-t[0]}function cs(t,e){var r,n,i,o=t.sort(ls).pop();for(as=[],is=new Array(t.length),ns=new Aa,os=new Aa;;)if(i=Ga,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===r&&o[1]===n||(ts(o),r=o[0],n=o[1]),o=t.pop();else{if(!i)break;Qa(i.arc)}if(function(){for(var t,e,r,n,i=0,o=is.length;i<o;++i)if((t=is[i])&&(n=(e=t.halfedges).length)){var a=new Array(n),s=new Array(n);for(r=0;r<n;++r)a[r]=r,s[r]=ja(t,as[e[r]]);for(a.sort((function(t,e){return s[e]-s[t]})),r=0;r<n;++r)s[r]=e[a[r]];for(r=0;r<n;++r)e[r]=s[r]}}(),e){var a=+e[0][0],s=+e[0][1],u=+e[1][0],l=+e[1][1];!function(t,e,r,n){for(var i,o=as.length;o--;)Ua(i=as[o],t,e,r,n)&&Ba(i,t,e,r,n)&&(Math.abs(i[0][0]-i[1][0])>ss||Math.abs(i[0][1]-i[1][1])>ss)||delete as[o]}(a,s,u,l),function(t,e,r,n){var i,o,a,s,u,l,c,h,p,f,d,g,y=is.length,m=!0;for(i=0;i<y;++i)if(o=is[i]){for(a=o.site,s=(u=o.halfedges).length;s--;)as[u[s]]||u.splice(s,1);for(s=0,l=u.length;s<l;)d=(f=qa(o,as[u[s]]))[0],g=f[1],h=(c=Va(o,as[u[++s%l]]))[0],p=c[1],(Math.abs(d-h)>ss||Math.abs(g-p)>ss)&&(u.splice(s,0,as.push(za(a,f,Math.abs(d-t)<ss&&n-g>ss?[t,Math.abs(h-t)<ss?p:n]:Math.abs(g-n)<ss&&r-d>ss?[Math.abs(p-n)<ss?h:r,n]:Math.abs(d-r)<ss&&g-e>ss?[r,Math.abs(h-r)<ss?p:e]:Math.abs(g-e)<ss&&d-t>ss?[Math.abs(p-e)<ss?h:t,e]:null))-1),++l);l&&(m=!1)}if(m){var v,_,x,b=1/0;for(i=0,m=null;i<y;++i)(o=is[i])&&(x=(v=(a=o.site)[0]-t)*v+(_=a[1]-e)*_)<b&&(b=x,m=o);if(m){var w=[t,e],E=[t,n],I=[r,n],S=[r,e];m.halfedges.push(as.push(za(a=m.site,w,E))-1,as.push(za(a,E,I))-1,as.push(za(a,I,S))-1,as.push(za(a,S,w))-1)}}for(i=0;i<y;++i)(o=is[i])&&(o.halfedges.length||delete is[i])}(a,s,u,l)}this.edges=as,this.cells=is,ns=os=as=is=null}function hs(t){return(t=t.slice()).push(t[0]),l([t])}function ps(t,e,r,n){var i=(n=n||{}).steps||64,o=n.units||"kilometers",a=n.angle||0,s=n.pivot||t,u=n.properties||t.properties||{};if(!t)throw new Error("center is required");if(!e)throw new Error("xSemiAxis is required");if(!r)throw new Error("ySemiAxis is required");if(!M(n))throw new Error("options must be an object");if(!P(i))throw new Error("steps must be a number");if(!P(a))throw new Error("angle must be a number");var c=K(t);if("degrees"===o)var h=I(a);else e=Ii(t,e,90,{units:o}),r=Ii(t,r,0,{units:o}),e=K(e)[0]-c[0],r=K(r)[1]-c[1];for(var p=[],f=0;f<i;f+=1){var d=-360*f/i,g=e*r/Math.sqrt(Math.pow(r,2)+Math.pow(e,2)*Math.pow(fs(d),2)),y=e*r/Math.sqrt(Math.pow(e,2)+Math.pow(r,2)/Math.pow(fs(d),2));if(d<-90&&d>=-270&&(g=-g),d<-180&&d>=-360&&(y=-y),"degrees"===o){var m=g*Math.cos(h)+y*Math.sin(h),v=y*Math.cos(h)-g*Math.sin(h);g=m,y=v}p.push([g+c[0],y+c[1]])}return p.push(p[0]),"degrees"===o?l([p],u):Do(l([p],u),a,{pivot:s})}function fs(t){var e=t*Math.PI/180;return Math.tan(e)}function ds(t,e){void 0===e&&(e={});var r=0,n=0,i=0;return B(t,(function(t,o,a){var s=e.weight?null==a?void 0:a[e.weight]:void 0;if(!P(s=null==s?1:s))throw new Error("weight value must be a number for feature index "+o);(s=Number(s))>0&&k(t,(function(t){r+=t[0]*s,n+=t[1]*s,i+=s}))})),s([r/i,n/i],e.properties,e)}function gs(t,e,r,n,i){var o=n.tolerance||.001,a=0,u=0,l=0,c=0;if(O(r,(function(e){var r,n=null===(r=e.properties)||void 0===r?void 0:r.weight,i=null==n?1:n;if(!P(i=Number(i)))throw new Error("weight value must be a number");if(i>0){c+=1;var o=i*ye(e,t);0===o&&(o=1);var s=i/o;a+=e.geometry.coordinates[0]*s,u+=e.geometry.coordinates[1]*s,l+=s}})),c<1)throw new Error("no features to measure");var h=a/l,p=u/l;return 1===c||0===i||Math.abs(h-e[0])<o&&Math.abs(p-e[1])<o?s([h,p],{medianCandidates:n.medianCandidates}):(n.medianCandidates.push([h,p]),gs([h,p],t,r,n,i-1))}function ys(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function ms(t,e){var r=0,n=0;k(t,(function(i,o,a,s,u){u>r&&(r=u,n=o,e.push([]));var l=o-n,c=t.coordinates[u][l+1],h=i[0],p=i[1],f=c[0],d=c[1];e[u].push([.75*h+.25*f,.75*p+.25*d]),e[u].push([.25*h+.75*f,.25*p+.75*d])}),!0),e.forEach((function(t){t.push(t[0])}))}function vs(t,e){var r=0,n=0,i=0;k(t,(function(o,a,s,u,l){u>i&&(i=u,n=a,e.push([[]])),l>r&&(r=l,n=a,e[u].push([]));var c=a-n,h=t.coordinates[u][l][c+1],p=o[0],f=o[1],d=h[0],g=h[1];e[u][l].push([.75*p+.25*d,.75*f+.25*g]),e[u][l].push([.25*p+.75*d,.25*f+.75*g])}),!0),e.forEach((function(t){t.forEach((function(t){t.push(t[0])}))}))}function _s(t,e,r){void 0===r&&(r=2);var n=K(t),i=K(e),o=n[0]-i[0],a=n[1]-i[1];return 1===r?Math.abs(o)+Math.abs(a):Math.pow(Math.pow(o,r)+Math.pow(a,r),1/r)}function xs(t,e){var r=(e=e||{}).threshold||1e4,n=e.p||2,i=e.binary||!1,o=e.alpha||-1,a=e.standardization||!1,s=[];O(t,(function(t){s.push(fr(t))}));for(var u=[],l=0;l<s.length;l++)u[l]=[];for(l=0;l<s.length;l++)for(var c=l;c<s.length;c++){l===c&&(u[l][c]=0);var h=_s(s[l],s[c],n);u[l][c]=h,u[c][l]=h}for(l=0;l<s.length;l++)for(c=0;c<s.length;c++)0!==(h=u[l][c])&&(u[l][c]=i?h<=r?1:0:h<=r?Math.pow(h,o):0);if(a)for(l=0;l<s.length;l++){var p=u[l].reduce((function(t,e){return t+e}),0);for(c=0;c<s.length;c++)u[l][c]=u[l][c]/p}return u}function bs(t){for(var e=0,r=0,n=t;r<n.length;r++)e+=n[r];return e/t.length}function ws(t,e){return void 0===e&&(e={}),Is(t,"mercator",e)}function Es(t,e){return void 0===e&&(e={}),Is(t,"wgs84",e)}function Is(t,e,r){void 0===r&&(r={});var n=(r=r||{}).mutate;if(!t)throw new Error("geojson is required");return Array.isArray(t)&&P(t[0])?t="mercator"===e?Ss(t):Cs(t):(!0!==n&&(t=be(t)),k(t,(function(t){var r="mercator"===e?Ss(t):Cs(t);t[0]=r[0],t[1]=r[1]}))),t}function Ss(t){var e=Math.PI/180,r=6378137,n=20037508.342789244,i=[r*(Math.abs(t[0])<=180?t[0]:t[0]-360*function(t){return t<0?-1:t>0?1:0}(t[0]))*e,r*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return i[0]>n&&(i[0]=n),i[0]<-n&&(i[0]=-n),i[1]>n&&(i[1]=n),i[1]<-n&&(i[1]=-n),i}function Cs(t){var e=180/Math.PI,r=6378137;return[t[0]*e/r,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/r)))*e]}cs.prototype={constructor:cs,polygons:function(){var t=this.edges;return this.cells.map((function(e){var r=e.halfedges.map((function(r){return Va(e,t[r])}));return r.data=e.site.data,r}))},triangles:function(){var t=[],e=this.edges;return this.cells.forEach((function(r,n){if(o=(i=r.halfedges).length)for(var i,o,a,s,u,l,c=r.site,h=-1,p=e[i[o-1]],f=p.left===c?p.right:p.left;++h<o;)a=f,f=(p=e[i[h]]).left===c?p.right:p.left,a&&f&&n<a.index&&n<f.index&&(u=a,l=f,((s=c)[0]-l[0])*(u[1]-s[1])-(s[0]-u[0])*(l[1]-s[1])<0)&&t.push([c.data,a.data,f.data])})),t},links:function(){return this.edges.filter((function(t){return t.right})).map((function(t){return{source:t.left.data,target:t.right.data}}))},find:function(t,e,r){for(var n,i,o=this,a=o._found||0,s=o.cells.length;!(i=o.cells[a]);)if(++a>=s)return null;var u=t-i.site[0],l=e-i.site[1],c=u*u+l*l;do{i=o.cells[n=a],a=null,i.halfedges.forEach((function(r){var n=o.edges[r],s=n.left;if(s!==i.site&&s||(s=n.right)){var u=t-s[0],l=e-s[1],h=u*u+l*l;h<c&&(c=h,a=s.index)}}))}while(null!==a);return o._found=n,null==r||c<=r*r?i.site:null}};var Ps=Object.freeze({__proto__:null,toMercator:ws,toWgs84:Es});function Ms(t){return Array.isArray(t)?Ns(t):t&&t.bbox?Ns(t.bbox):[360*ks(),180*ks()]}function Ts(t,e){void 0===e&&(e={}),null==t&&(t=1);for(var r=[],n=0;n<t;n++)r.push(s(Ms(e.bbox)));return f(r)}function Ls(t,e){void 0===e&&(e={}),null==t&&(t=1),P(e.num_vertices)&&void 0!==e.num_vertices||(e.num_vertices=10),P(e.max_radial_length)&&void 0!==e.max_radial_length||(e.max_radial_length=10);for(var r=[],n=function(t){var n,i=[],o=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)n[i]=o[a];return n}(Array(e.num_vertices+1)).map(Math.random);o.forEach((function(t,e,r){r[e]=e>0?t+r[e-1]:t})),o.forEach((function(t){t=2*t*Math.PI/o[o.length-1];var r=Math.random();i.push([r*(e.max_radial_length||10)*Math.sin(t),r*(e.max_radial_length||10)*Math.cos(t)])})),i[i.length-1]=i[0],i=i.map((n=Ms(e.bbox),function(t){return[t[0]+n[0],t[1]+n[1]]})),r.push(l([i]))},i=0;i<t;i++)n();return f(r)}function As(t,e){if(void 0===e&&(e={}),!M(e=e||{}))throw new Error("options is invalid");var r=e.bbox,n=e.num_vertices,i=e.max_length,o=e.max_rotation;null==t&&(t=1),(!P(n)||void 0===n||n<2)&&(n=10),P(i)&&void 0!==i||(i=1e-4),P(o)&&void 0!==o||(o=Math.PI/8);for(var a=[],s=0;s<t;s++){for(var u=[Ms(r)],l=0;l<n-1;l++){var c=(0===l?2*Math.random()*Math.PI:Math.tan((u[l][1]-u[l-1][1])/(u[l][0]-u[l-1][0])))+(Math.random()-.5)*o*2,p=Math.random()*i;u.push([u[l][0]+p*Math.cos(c),u[l][1]+p*Math.sin(c)])}a.push(h(u))}return f(a)}function ks(){return Math.random()-.5}function Ns(t){return[Math.random()*(t[2]-t[0])+t[0],Math.random()*(t[3]-t[1])+t[1]]}var Ds=Object.freeze({__proto__:null,randomPosition:Ms,randomPoint:Ts,randomPolygon:Ls,randomLineString:As});function Rs(t,e){if(!t)throw new Error("geojson is required");if("FeatureCollection"!==t.type)throw new Error("geojson must be a FeatureCollection");if(null==e)throw new Error("filter is required");var r=[];return O(t,(function(t){Bs(t.properties,e)&&r.push(t)})),f(r)}function Os(t,e,r){if(!t)throw new Error("geojson is required");if("FeatureCollection"!==t.type)throw new Error("geojson must be a FeatureCollection");if(null==e)throw new Error("property is required");for(var n=Fs(t,e),i=Object.keys(n),o=0;o<i.length;o++){for(var a=i[o],s=n[a],u=[],l=0;l<s.length;l++)u.push(t.features[s[l]]);r(f(u),a,o)}}function zs(t,e,r,n){var i=n;return Os(t,e,(function(t,e,o){i=0===o&&void 0===n?t:r(i,t,e,o)})),i}function Fs(t,e){var r={};return O(t,(function(t,n){var i=t.properties||{};if(Object.prototype.hasOwnProperty.call(i,String(e))){var o=i[e];Object.prototype.hasOwnProperty.call(r,o)?r[o].push(n):r[o]=[n]}})),r}function Bs(t,e){if(void 0===t)return!1;var r=typeof e;if("number"===r||"string"===r)return Object.prototype.hasOwnProperty.call(t,e);if(Array.isArray(e)){for(var n=0;n<e.length;n++)if(!Bs(t,e[n]))return!1;return!0}return Us(t,e)}function Us(t,e){for(var r=Object.keys(e),n=0;n<r.length;n++){var i=r[n];if(t[i]!==e[i])return!1}return!0}function js(t,e){if(!e)return{};if(!e.length)return{};for(var r={},n=0;n<e.length;n++){var i=e[n];Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r}var Vs=Object.freeze({__proto__:null,getCluster:Rs,clusterEach:Os,clusterReduce:zs,createBins:Fs,applyFilter:Bs,propertiesContainsFilter:Us,filterProperties:js}),qs=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function Gs(t,e){return t>e?1:t<e?-1:0}function Xs(t,e,r){for(var n=new qs(null,null),i=n,o=n;;){var a=r(t,e.key);if(a<0){if(null===e.left)break;if(r(t,e.left.key)<0){var s=e.left;if(e.left=s.right,s.right=e,null===(e=s).left)break}o.left=e,o=e,e=e.left}else{if(!(a>0))break;if(null===e.right)break;if(r(t,e.right.key)>0){s=e.right;if(e.right=s.left,s.left=e,null===(e=s).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function Zs(t,e,r,n){var i=new qs(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=Xs(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function Ys(t,e,r){var n=null,i=null;if(e){var o=r((e=Xs(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function Ws(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&Ws(t.left,o,!1,n,i),t.right&&Ws(t.right,o,!0,n,i)}}var Hs=function(){function t(t){void 0===t&&(t=Gs),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=Zs(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new qs(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=Xs(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=Xs(t,e,r)).key)?(null===e.left?n=e.right:(n=Xs(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Xs(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=Xs(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,a=this._root;0!==i.length||a;)if(a)i.push(a),a=a.left;else{if(o((a=i.pop()).key,e)>0)break;if(o(a.key,t)>=0&&r.call(n,a))return this;a=a.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){for(var e=t,r=[],n=!1,i=new qs(null,null),o=i;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&$s(t,e,0,n-1,i),null===this._root)this._root=Js(t,e,0,n),this._size=n;else{var o=function(t,e,r){for(var n=new qs(null,null),i=n,o=t,a=e;null!==o&&null!==a;)r(o.key,a.key)<0?(i.next=o,o=o.next):(i.next=a,a=a.next),i=i.next;null!==o?i.next=o:null!==a&&(i.next=a);return n.next}(this.toList(),function(t,e){for(var r=new qs(null,null),n=r,i=0;i<t.length;i++)n=n.next=new qs(t[i],e[i]);return n.next=null,r.next}(t,e),i);n=this._size+n,this._root=Ks({head:o},0,n)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return Ws(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=Ys(t,this._root,n),o=i.left,a=i.right;n(t,e)<0?a=Zs(e,r,a,n):o=Zs(e,r,o,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=Xs(t.key,e,r)).left=t),e)}(o,a,n)},t.prototype.split=function(t){return Ys(t,this._root,this._comparator)},t}();function Js(t,e,r,n){var i=n-r;if(i>0){var o=r+Math.floor(i/2),a=t[o],s=e[o],u=new qs(a,s);return u.left=Js(t,e,r,o),u.right=Js(t,e,o+1,n),u}return null}function Ks(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=Ks(t,e,i),a=t.head;return a.left=o,t.head=t.head.next,a.right=Ks(t,i+1,r),a}return null}function $s(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],a=r-1,s=n+1;;){do{a++}while(i(t[a],o)<0);do{s--}while(i(t[s],o)>0);if(a>=s)break;var u=t[a];t[a]=t[s],t[s]=u,u=e[a],e[a]=e[s],e[s]=u}$s(t,e,r,s,i),$s(t,e,s+1,n,i)}}function Qs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function eu(t,e,r){return e&&tu(t.prototype,e),r&&tu(t,r),t}var ru=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},nu=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},iu=Number.EPSILON;void 0===iu&&(iu=Math.pow(2,-52));var ou=iu*iu,au=function(t,e){if(-iu<t&&t<iu&&-iu<e&&e<iu)return 0;var r=t-e;return r*r<ou*t*e?0:t<e?-1:1},su=function(){function t(){Qs(this,t),this.reset()}return eu(t,[{key:"reset",value:function(){this.xRounder=new uu,this.yRounder=new uu}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),uu=function(){function t(){Qs(this,t),this.tree=new Hs,this.round(0)}return eu(t,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===au(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===au(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),t}(),lu=new su,cu=function(t,e){return t.x*e.y-t.y*e.x},hu=function(t,e){return t.x*e.x+t.y*e.y},pu=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=cu(n,i);return au(o,0)},fu=function(t){return Math.sqrt(hu(t,t))},du=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return hu(i,n)/fu(i)/fu(n)},gu=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},yu=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},mu=function(){function t(e,r){Qs(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=r}return eu(t,null,[{key:"compare",value:function(e,r){var n=t.comparePoints(e.point,r.point);return 0!==n?n:(e.point!==r.point&&e.link(r),e.isLeft!==r.isLeft?e.isLeft?1:-1:_u.compare(e.segment,r.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),eu(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r<n;r++){var i=e[r];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,a,s,u,l=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,a=l.point,s={x:o.x-i.x,y:o.y-i.y},u={x:a.x-i.x,y:a.y-i.y},cu(u,s)/fu(u)/fu(s)),cosine:du(e.point,t.point,l.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,a=i.cosine,s=r.get(e),u=s.sine,l=s.cosine;return o>=0&&u>=0?a<l?1:a>l?-1:0:o<0&&u<0?a<l?-1:a>l?1:0:u<o?-1:u>o?1:0}}}]),t}(),vu=0,_u=function(){function t(e,r,n,i){Qs(this,t),this.id=++vu,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return eu(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var a=t.leftSE.point.y,s=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(r<n){if(s<a&&s<u)return 1;if(s>a&&s>u)return-1;var c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(r>n){if(a<s&&a<l)return-1;if(a>s&&a>l)return 1;var p=e.comparePoint(t.leftSE.point);if(0!==p)return p;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(a<s)return-1;if(a>s)return 1;if(i<o){var d=e.comparePoint(t.rightSE.point);if(0!==d)return d}if(i>o){var g=t.comparePoint(e.rightSE.point);if(g<0)return 1;if(g>0)return-1}if(i!==o){var y=u-a,m=i-r,v=l-s,_=o-n;if(y>m&&v<_)return 1;if(y<m&&v>_)return-1}return i>o?1:i<o||u<l?-1:u>l?1:t.id<e.id?-1:t.id>e.id?1:0}}]),eu(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var a=(t.x-e.x)/n.x,s=e.y+a*n.y;return t.y===s?0:t.y<s?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=nu(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,a=t.leftSE.point,s=t.rightSE.point,u=ru(e,a)&&0===this.comparePoint(a),l=ru(r,i)&&0===t.comparePoint(i),c=ru(e,s)&&0===this.comparePoint(s),h=ru(r,o)&&0===t.comparePoint(o);if(l&&u)return h&&!c?o:!h&&c?s:null;if(l)return c&&i.x===s.x&&i.y===s.y?null:i;if(u)return h&&o.x===a.x&&o.y===a.y?null:a;if(h&&c)return null;if(h)return o;if(c)return s;var p=function(t,e,r,n){if(0===e.x)return yu(r,n,t.x);if(0===n.x)return yu(t,e,r.x);if(0===e.y)return gu(r,n,t.y);if(0===n.y)return gu(t,e,r.y);var i=cu(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},a=cu(o,e)/i,s=cu(o,n)/i;return{x:(t.x+s*e.x+(r.x+a*n.x))/2,y:(t.y+s*e.y+(r.y+a*n.y))/2}}(i,this.vector(),a,t.vector());return null===p?null:ru(n,p)?lu.round(p.x,p.y):null}},{key:"split",value:function(e){var r=[],n=void 0!==e.events,i=new mu(e,!0),o=new mu(e,!1),a=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var s=new t(i,a,this.rings.slice(),this.windings.slice());return mu.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),mu.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var r=this,n=e;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=t.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var a=r;r=n,n=a}for(var s=0,u=n.rings.length;s<u;s++){var l=n.rings[s],c=n.windings[s],h=r.rings.indexOf(l);-1===h?(r.rings.push(l),r.windings.push(c)):r.windings[h]+=c}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var a=this.rings[i],s=this.windings[i],u=e.indexOf(a);-1===u?(e.push(a),r.push(s)):r[u]+=s}for(var l=[],c=[],h=0,p=e.length;h<p;h++)if(0!==r[h]){var f=e[h],d=f.poly;if(-1===c.indexOf(d))if(f.isExterior)l.push(d);else{-1===c.indexOf(d)&&c.push(d);var g=l.indexOf(f.poly);-1!==g&&l.splice(g,1)}}for(var y=0,m=l.length;y<m;y++){var v=l[y].multiPoly;-1===n.indexOf(v)&&n.push(v)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(Tu.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===Tu.numMultiPolys&&i<o;break;case"xor":var a=Math.abs(t.length-e.length);this._isInResult=a%2==1;break;case"difference":var s=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=s(t)!==s(e);break;default:throw new Error("Unrecognized operation type found ".concat(Tu.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,r,n){var i,o,a,s=mu.comparePoints(e,r);if(s<0)i=e,o=r,a=1;else{if(!(s>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,a=-1}return new t(new mu(i,!0),new mu(o,!1),[n],[a])}}]),t}(),xu=function(){function t(e,r,n){if(Qs(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=lu.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,a=1,s=e.length;a<s;a++){if("number"!=typeof e[a][0]||"number"!=typeof e[a][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=lu.round(e[a][0],e[a][1]);u.x===o.x&&u.y===o.y||(this.segments.push(_u.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(_u.fromRing(o,i,this))}return eu(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),t}(),bu=function(){function t(e,r){if(Qs(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new xu(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var n=1,i=e.length;n<i;n++){var o=new xu(e[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return eu(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),wu=function(){function t(e,r){if(Qs(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var n=0,i=e.length;n<i;n++){var o=new bu(e[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return eu(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),t}(),Eu=function(){function t(e){Qs(this,t),this.events=e;for(var r=0,n=e.length;r<n;r++)e[r].segment.ringOut=this;this.poly=null}return eu(t,null,[{key:"factory",value:function(e){for(var r=[],n=0,i=e.length;n<i;n++){var o=e[n];if(o.isInResult()&&!o.ringOut){for(var a=null,s=o.leftSE,u=o.rightSE,l=[s],c=s.point,h=[];a=s,s=u,l.push(s),s.point!==c;)for(;;){var p=s.getAvailableLinkedEvents();if(0===p.length){var f=l[0].point,d=l[l.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(f.x,",")+" ".concat(f.y,"]. Last matching segment found ends at")+" [".concat(d.x,", ").concat(d.y,"]."))}if(1===p.length){u=p[0].otherSE;break}for(var g=null,y=0,m=h.length;y<m;y++)if(h[y].point===s.point){g=y;break}if(null===g){h.push({index:l.length,point:s.point});var v=s.getLeftmostComparator(a);u=p.sort(v)[0].otherSE;break}var _=h.splice(g)[0],x=l.splice(_.index);x.unshift(x[0].otherSE),r.push(new t(x.reverse()))}r.push(new t(l))}}return r}}]),eu(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==pu(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var a=e[0],s=e[1];0===pu(a,t,s)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,l=this.isExteriorRing()?0:e.length-1,c=this.isExteriorRing()?e.length:-1,h=[],p=l;p!=c;p+=u)h.push([e[p].x,e[p].y]);return h}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,r=this.events.length;e<r;e++){var n=this.events[e];mu.compare(t,n)>0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),Iu=function(){function t(e){Qs(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return eu(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),t}(),Su=function(){function t(e){Qs(this,t),this.rings=e,this.polys=this._composePolys(e)}return eu(t,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new Iu(i));else{var o=i.enclosingRing();o.poly||e.push(new Iu(o)),o.poly.addInterior(i)}}return e}}]),t}(),Cu=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_u.compare;Qs(this,t),this.queue=e,this.tree=new Hs(r),this.segments=[]}return eu(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,a=void 0,s=void 0;void 0===a;)null===(i=this.tree.prev(i))?a=null:void 0===i.key.consumedBy&&(a=i.key);for(;void 0===s;)null===(o=this.tree.next(o))?s=null:void 0===o.key.consumedBy&&(s=o.key);if(t.isLeft){var u=null;if(a){var l=a.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!a.isAnEndpoint(l)))for(var c=this._splitSafely(a,l),h=0,p=c.length;h<p;h++)r.push(c[h])}var f=null;if(s){var d=s.getIntersection(e);if(null!==d&&(e.isAnEndpoint(d)||(f=d),!s.isAnEndpoint(d)))for(var g=this._splitSafely(s,d),y=0,m=g.length;y<m;y++)r.push(g[y])}if(null!==u||null!==f){var v=null;v=null===u?f:null===f||mu.comparePoints(u,f)<=0?u:f;this.queue.remove(e.rightSE),r.push(e.rightSE);for(var _=e.split(v),x=0,b=_.length;x<b;x++)r.push(_[x])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=a)}else{if(a&&s){var w=a.getIntersection(s);if(null!==w){if(!a.isAnEndpoint(w))for(var E=this._splitSafely(a,w),I=0,S=E.length;I<S;I++)r.push(E[I]);if(!s.isAnEndpoint(w))for(var C=this._splitSafely(s,w),P=0,M=C.length;P<M;P++)r.push(C[P])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),t}(),Pu="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Mu="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Tu=new(function(){function t(){Qs(this,t)}return eu(t,[{key:"run",value:function(t,e,r){Tu.type=t,lu.reset();for(var n=[new wu(e,!0)],i=0,o=r.length;i<o;i++)n.push(new wu(r[i],!1));if(Tu.numMultiPolys=n.length,"difference"===Tu.type)for(var a=n[0],s=1;s<n.length;)null!==nu(n[s].bbox,a.bbox)?s++:n.splice(s,1);if("intersection"===Tu.type)for(var u=0,l=n.length;u<l;u++)for(var c=n[u],h=u+1,p=n.length;h<p;h++)if(null===nu(c.bbox,n[h].bbox))return[];for(var f=new Hs(mu.compare),d=0,g=n.length;d<g;d++)for(var y=n[d].getSweepEvents(),m=0,v=y.length;m<v;m++)if(f.insert(y[m]),f.size>Pu)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var _=new Cu(f),x=f.size,b=f.pop();b;){var w=b.key;if(f.size===x){var E=w.segment;throw new Error("Unable to pop() ".concat(w.isLeft?"left":"right"," SweepEvent ")+"[".concat(w.point.x,", ").concat(w.point.y,"] from segment #").concat(E.id," ")+"[".concat(E.leftSE.point.x,", ").concat(E.leftSE.point.y,"] -> ")+"[".concat(E.rightSE.point.x,", ").concat(E.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(f.size>Pu)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(_.segments.length>Mu)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=_.process(w),S=0,C=I.length;S<C;S++){var P=I[S];void 0===P.consumedBy&&f.insert(P)}x=f.size,b=f.pop()}lu.reset();var M=Eu.factory(_.segments);return new Su(M).getGeom()}}]),t}()),Lu={union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Tu.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Tu.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Tu.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return Tu.run("difference",t,r)}};"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),r=Math.max(Math.min(e.length,9007199254740991),0)||0,n=1 in arguments&&parseInt(Number(arguments[1]),10)||0;n=n<0?Math.max(r+n,0):Math.min(n,r);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:r;for(i=i<0?Math.max(r+arguments[2],0):Math.min(i,r);n<i;)e[n]=t,++n;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var Au=function(){};Au.prototype.interfaces_=function(){return[]},Au.prototype.getClass=function(){return Au},Au.prototype.equalsWithTolerance=function(t,e,r){return Math.abs(t-e)<=r};var ku=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Nu=function(){},Du={MAX_VALUE:{configurable:!0}};Nu.isNaN=function(t){return Number.isNaN(t)},Nu.doubleToLongBits=function(t){return t},Nu.longBitsToDouble=function(t){return t},Nu.isInfinite=function(t){return!Number.isFinite(t)},Du.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(Nu,Du);var Ru=function(){},Ou=function(){},zu=function(){};function Fu(){}var Bu=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},Uu={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};Bu.prototype.setOrdinate=function(t,e){switch(t){case Bu.X:this.x=e;break;case Bu.Y:this.y=e;break;case Bu.Z:this.z=e;break;default:throw new ku("Invalid ordinate index: "+t)}},Bu.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!Au.equalsWithTolerance(this.x,e.x,r)&&!!Au.equalsWithTolerance(this.y,e.y,r)}},Bu.prototype.getOrdinate=function(t){switch(t){case Bu.X:return this.x;case Bu.Y:return this.y;case Bu.Z:return this.z}throw new ku("Invalid ordinate index: "+t)},Bu.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||Nu.isNaN(this.z))&&Nu.isNaN(t.z)},Bu.prototype.equals=function(t){return t instanceof Bu&&this.equals2D(t)},Bu.prototype.equalInZ=function(t,e){return Au.equalsWithTolerance(this.z,t.z,e)},Bu.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},Bu.prototype.clone=function(){},Bu.prototype.copy=function(){return new Bu(this)},Bu.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},Bu.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},Bu.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},Bu.prototype.hashCode=function(){var t=17;return 37*(t=37*t+Bu.hashCode(this.x))+Bu.hashCode(this.y)},Bu.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},Bu.prototype.interfaces_=function(){return[Ru,Ou,Fu]},Bu.prototype.getClass=function(){return Bu},Bu.hashCode=function(){if(1===arguments.length){var t=Nu.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},Uu.DimensionalComparator.get=function(){return ju},Uu.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},Uu.NULL_ORDINATE.get=function(){return Nu.NaN},Uu.X.get=function(){return 0},Uu.Y.get=function(){return 1},Uu.Z.get=function(){return 2},Object.defineProperties(Bu,Uu);var ju=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new ku("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};ju.prototype.compare=function(t,e){var r=t,n=e,i=ju.compare(r.x,n.x);if(0!==i)return i;var o=ju.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:ju.compare(r.z,n.z)},ju.prototype.interfaces_=function(){return[zu]},ju.prototype.getClass=function(){return ju},ju.compare=function(t,e){return t<e?-1:t>e?1:Nu.isNaN(t)?Nu.isNaN(e)?0:-1:Nu.isNaN(e)?1:0};var Vu=function(){};Vu.prototype.create=function(){},Vu.prototype.interfaces_=function(){return[]},Vu.prototype.getClass=function(){return Vu};var qu=function(){},Gu={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};qu.prototype.interfaces_=function(){return[]},qu.prototype.getClass=function(){return qu},qu.toLocationSymbol=function(t){switch(t){case qu.EXTERIOR:return"e";case qu.BOUNDARY:return"b";case qu.INTERIOR:return"i";case qu.NONE:return"-"}throw new ku("Unknown location value: "+t)},Gu.INTERIOR.get=function(){return 0},Gu.BOUNDARY.get=function(){return 1},Gu.EXTERIOR.get=function(){return 2},Gu.NONE.get=function(){return-1},Object.defineProperties(qu,Gu);var Xu=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Zu=function(){},Yu={LOG_10:{configurable:!0}};Zu.prototype.interfaces_=function(){return[]},Zu.prototype.getClass=function(){return Zu},Zu.log10=function(t){var e=Math.log(t);return Nu.isInfinite(e)||Nu.isNaN(e)?e:e/Zu.LOG_10},Zu.min=function(t,e,r,n){var i=t;return e<i&&(i=e),r<i&&(i=r),n<i&&(i=n),i},Zu.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],r=arguments[2];return t<e?e:t>r?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return n<i?i:n>o?o:n}},Zu.wrap=function(t,e){return t<0?e- -t%e:t%e},Zu.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],a=arguments[0];return n>a&&(a=n),i>a&&(a=i),o>a&&(a=o),a}},Zu.average=function(t,e){return(t+e)/2},Yu.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(Zu,Yu);var Wu=function(t){this.str=t};Wu.prototype.append=function(t){this.str+=t},Wu.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},Wu.prototype.toString=function(t){return this.str};var Hu=function(t){this.value=t};Hu.prototype.intValue=function(){return this.value},Hu.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},Hu.isNaN=function(t){return Number.isNaN(t)};var Ju=function(){};Ju.isWhitespace=function(t){return t<=32&&t>=0||127===t},Ju.toUpperCase=function(t){return t.toUpperCase()};var Ku=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else if("string"==typeof arguments[0]){t.call(this,t.parse(arguments[0]))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},$u={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};Ku.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},Ku.prototype.extractSignificantDigits=function(t,e){var r=this.abs(),n=Ku.magnitude(r._hi),i=Ku.TEN.pow(n);(r=r.divide(i)).gt(Ku.TEN)?(r=r.divide(Ku.TEN),n+=1):r.lt(Ku.ONE)&&(r=r.multiply(Ku.TEN),n-=1);for(var o=n+1,a=new Wu,s=Ku.MAX_PRINT_DIGITS-1,u=0;u<=s;u++){t&&u===o&&a.append(".");var l=Math.trunc(r._hi);if(l<0)break;var c=!1,h=0;l>9?(c=!0,h="9"):h="0"+l,a.append(h),r=r.subtract(Ku.valueOf(l)).multiply(Ku.TEN),c&&r.selfAdd(Ku.TEN);var p=!0,f=Ku.magnitude(r._hi);if(f<0&&Math.abs(f)>=s-u&&(p=!1),!p)break}return e[0]=n,a.toString()},Ku.prototype.sqr=function(){return this.multiply(this)},Ku.prototype.doubleValue=function(){return this._hi+this._lo},Ku.prototype.subtract=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},Ku.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},Ku.prototype.isZero=function(){return 0===this._hi&&0===this._lo},Ku.prototype.selfSubtract=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},Ku.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},Ku.prototype.min=function(t){return this.le(t)?this:t},Ku.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof Ku){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var r,n,i,o,a=arguments[0],s=arguments[1],u=null,l=null,c=null,h=null;return i=this._hi/a,h=(u=(c=Ku.SPLIT*i)-(u=c-i))*(l=(h=Ku.SPLIT*a)-(l=h-a))-(o=i*a)+u*(n=a-l)+(r=i-u)*l+r*n,h=i+(c=(this._hi-o-h+this._lo-i*s)/a),this._hi=h,this._lo=i-h+c,this}},Ku.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},Ku.prototype.divide=function(){if(arguments[0]instanceof Ku){var t,e,r,n,i=arguments[0],o=null,a=null,s=null,u=null;t=(r=this._hi/i._hi)-(o=(s=Ku.SPLIT*r)-(o=s-r)),u=o*(a=(u=Ku.SPLIT*i._hi)-(a=u-i._hi))-(n=r*i._hi)+o*(e=i._hi-a)+t*a+t*e;var l=u=r+(s=(this._hi-n-u+this._lo-r*i._lo)/i._hi);return new Ku(l,r-u+s)}if("number"==typeof arguments[0]){var c=arguments[0];return Nu.isNaN(c)?Ku.createNaN():Ku.copy(this).selfDivide(c,0)}},Ku.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},Ku.prototype.pow=function(t){if(0===t)return Ku.valueOf(1);var e=new Ku(this),r=Ku.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},Ku.prototype.ceil=function(){if(this.isNaN())return Ku.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new Ku(t,e)},Ku.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},Ku.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},Ku.prototype.setValue=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},Ku.prototype.max=function(t){return this.ge(t)?this:t},Ku.prototype.sqrt=function(){if(this.isZero())return Ku.valueOf(0);if(this.isNegative())return Ku.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=Ku.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},Ku.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof Ku){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,a=arguments[0],s=null;return s=(n=this._hi+a)-(i=n-this._hi),r=(o=(s=a-i+(this._hi-s))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var u,l,c,h,p=arguments[0],f=arguments[1],d=null,g=null,y=null;c=this._hi+p,l=this._lo+f,g=c-(y=c-this._hi),d=l-(h=l-this._lo);var m=(u=c+(y=(g=p-y+(this._hi-g))+l))+(y=(d=f-h+(this._lo-d))+(y+(c-u))),v=y+(u-m);return this._hi=m,this._lo=v,this}},Ku.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof Ku){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var r,n,i=arguments[0],o=arguments[1],a=null,s=null,u=null,l=null;a=(u=Ku.SPLIT*this._hi)-this._hi,l=Ku.SPLIT*i,a=u-a,r=this._hi-a,s=l-i;var c=(u=this._hi*i)+(l=a*(s=l-s)-u+a*(n=i-s)+r*s+r*n+(this._hi*o+this._lo*i)),h=l+(a=u-c);return this._hi=c,this._lo=h,this}},Ku.prototype.selfSqr=function(){return this.selfMultiply(this)},Ku.prototype.floor=function(){if(this.isNaN())return Ku.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new Ku(t,e)},Ku.prototype.negate=function(){return this.isNaN()?this:new Ku(-this._hi,-this._lo)},Ku.prototype.clone=function(){},Ku.prototype.multiply=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return t.isNaN()?Ku.createNaN():Ku.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Nu.isNaN(e)?Ku.createNaN():Ku.copy(this).selfMultiply(e,0)}},Ku.prototype.isNaN=function(){return Nu.isNaN(this._hi)},Ku.prototype.intValue=function(){return Math.trunc(this._hi)},Ku.prototype.toString=function(){var t=Ku.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},Ku.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+Ku.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+Ku.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},Ku.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,a=null,s=null;t=(r=1/this._hi)-(i=(a=Ku.SPLIT*r)-(i=a-r)),o=(s=Ku.SPLIT*this._hi)-this._hi;var u=r+(a=(1-(n=r*this._hi)-(s=i*(o=s-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new Ku(u,r-u+a)},Ku.prototype.toSciNotation=function(){if(this.isZero())return Ku.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=Ku.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},Ku.prototype.abs=function(){return this.isNaN()?Ku.NaN:this.isNegative()?this.negate():new Ku(this)},Ku.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},Ku.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},Ku.prototype.add=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return Ku.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Ku.copy(this).selfAdd(e)}},Ku.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof Ku){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._hi=r,this._lo=n}},Ku.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},Ku.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},Ku.prototype.trunc=function(){return this.isNaN()?Ku.NaN:this.isPositive()?this.floor():this.ceil()},Ku.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},Ku.prototype.interfaces_=function(){return[Fu,Ru,Ou]},Ku.prototype.getClass=function(){return Ku},Ku.sqr=function(t){return Ku.valueOf(t).selfMultiply(t)},Ku.valueOf=function(){if("string"==typeof arguments[0]){return Ku.parse(arguments[0])}if("number"==typeof arguments[0]){return new Ku(arguments[0])}},Ku.sqrt=function(t){return Ku.valueOf(t).sqrt()},Ku.parse=function(t){for(var e=0,r=t.length;Ju.isWhitespace(t.charAt(e));)e++;var n=!1;if(e<r){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(n=!0))}for(var o=new Ku,a=0,s=0,u=0;!(e>=r);){var l=t.charAt(e);if(e++,Ju.isDigit(l)){var c=l-"0";o.selfMultiply(Ku.TEN),o.selfAdd(c),a++}else{if("."!==l){if("e"===l||"E"===l){var h=t.substring(e);try{u=Hu.parseInt(h)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+h+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}s=a}}var p=o,f=a-s-u;if(0===f)p=o;else if(f>0){var d=Ku.TEN.pow(f);p=o.divide(d)}else if(f<0){var g=Ku.TEN.pow(-f);p=o.multiply(g)}return n?p.negate():p},Ku.createNaN=function(){return new Ku(Nu.NaN,Nu.NaN)},Ku.copy=function(t){return new Ku(t)},Ku.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},Ku.stringOfChar=function(t,e){for(var r=new Wu,n=0;n<e;n++)r.append(t);return r.toString()},$u.PI.get=function(){return new Ku(3.141592653589793,12246467991473532e-32)},$u.TWO_PI.get=function(){return new Ku(6.283185307179586,24492935982947064e-32)},$u.PI_2.get=function(){return new Ku(1.5707963267948966,6123233995736766e-32)},$u.E.get=function(){return new Ku(2.718281828459045,14456468917292502e-32)},$u.NaN.get=function(){return new Ku(Nu.NaN,Nu.NaN)},$u.EPS.get=function(){return 123259516440783e-46},$u.SPLIT.get=function(){return 134217729},$u.MAX_PRINT_DIGITS.get=function(){return 32},$u.TEN.get=function(){return Ku.valueOf(10)},$u.ONE.get=function(){return Ku.valueOf(1)},$u.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},$u.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(Ku,$u);var Qu=function(){},tl={DP_SAFE_EPSILON:{configurable:!0}};Qu.prototype.interfaces_=function(){return[]},Qu.prototype.getClass=function(){return Qu},Qu.orientationIndex=function(t,e,r){var n=Qu.orientationIndexFilter(t,e,r);if(n<=1)return n;var i=Ku.valueOf(e.x).selfAdd(-t.x),o=Ku.valueOf(e.y).selfAdd(-t.y),a=Ku.valueOf(r.x).selfAdd(-e.x),s=Ku.valueOf(r.y).selfAdd(-e.y);return i.selfMultiply(s).selfSubtract(o.selfMultiply(a)).signum()},Qu.signOfDet2x2=function(t,e,r,n){return t.multiply(n).selfSubtract(e.multiply(r)).signum()},Qu.intersection=function(t,e,r,n){var i=Ku.valueOf(n.y).selfSubtract(r.y).selfMultiply(Ku.valueOf(e.x).selfSubtract(t.x)),o=Ku.valueOf(n.x).selfSubtract(r.x).selfMultiply(Ku.valueOf(e.y).selfSubtract(t.y)),a=i.subtract(o),s=Ku.valueOf(n.x).selfSubtract(r.x).selfMultiply(Ku.valueOf(t.y).selfSubtract(r.y)),u=Ku.valueOf(n.y).selfSubtract(r.y).selfMultiply(Ku.valueOf(t.x).selfSubtract(r.x)),l=s.subtract(u).selfDivide(a).doubleValue(),c=Ku.valueOf(t.x).selfAdd(Ku.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),h=Ku.valueOf(e.x).selfSubtract(t.x).selfMultiply(Ku.valueOf(t.y).selfSubtract(r.y)),p=Ku.valueOf(e.y).selfSubtract(t.y).selfMultiply(Ku.valueOf(t.x).selfSubtract(r.x)),f=h.subtract(p).selfDivide(a).doubleValue(),d=Ku.valueOf(r.y).selfAdd(Ku.valueOf(n.y).selfSubtract(r.y).selfMultiply(f)).doubleValue();return new Bu(c,d)},Qu.orientationIndexFilter=function(t,e,r){var n=null,i=(t.x-r.x)*(e.y-r.y),o=(t.y-r.y)*(e.x-r.x),a=i-o;if(i>0){if(o<=0)return Qu.signum(a);n=i+o}else{if(!(i<0))return Qu.signum(a);if(o>=0)return Qu.signum(a);n=-i-o}var s=Qu.DP_SAFE_EPSILON*n;return a>=s||-a>=s?Qu.signum(a):2},Qu.signum=function(t){return t>0?1:t<0?-1:0},tl.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Qu,tl);var el=function(){},rl={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};rl.X.get=function(){return 0},rl.Y.get=function(){return 1},rl.Z.get=function(){return 2},rl.M.get=function(){return 3},el.prototype.setOrdinate=function(t,e,r){},el.prototype.size=function(){},el.prototype.getOrdinate=function(t,e){},el.prototype.getCoordinate=function(){},el.prototype.getCoordinateCopy=function(t){},el.prototype.getDimension=function(){},el.prototype.getX=function(t){},el.prototype.clone=function(){},el.prototype.expandEnvelope=function(t){},el.prototype.copy=function(){},el.prototype.getY=function(t){},el.prototype.toCoordinateArray=function(){},el.prototype.interfaces_=function(){return[Ou]},el.prototype.getClass=function(){return el},Object.defineProperties(el,rl);var nl=function(){},il=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(nl),ol=function(){};ol.arraycopy=function(t,e,r,n,i){for(var o=0,a=e;a<e+i;a++)r[n+o]=t[a],o++},ol.getProperty=function(t){return{"line.separator":"\n"}[t]};var al=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this.x=r,this.y=n,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof Bu&&arguments[1]instanceof Bu){var a=arguments[0],s=arguments[1];this.x=a.y-s.y,this.y=s.x-a.x,this.w=a.x*s.y-s.x*a.y}}else if(3===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2];this.x=u,this.y=l,this.w=c}else if(4===arguments.length){var h=arguments[0],p=arguments[1],f=arguments[2],d=arguments[3],g=h.y-p.y,y=p.x-h.x,m=h.x*p.y-p.x*h.y,v=f.y-d.y,_=d.x-f.x,x=f.x*d.y-d.x*f.y;this.x=y*x-_*m,this.y=v*m-g*x,this.w=g*_-v*y}};al.prototype.getY=function(){var t=this.y/this.w;if(Nu.isNaN(t)||Nu.isInfinite(t))throw new il;return t},al.prototype.getX=function(){var t=this.x/this.w;if(Nu.isNaN(t)||Nu.isInfinite(t))throw new il;return t},al.prototype.getCoordinate=function(){var t=new Bu;return t.x=this.getX(),t.y=this.getY(),t},al.prototype.interfaces_=function(){return[]},al.prototype.getClass=function(){return al},al.intersection=function(t,e,r,n){var i=t.y-e.y,o=e.x-t.x,a=t.x*e.y-e.x*t.y,s=r.y-n.y,u=n.x-r.x,l=r.x*n.y-n.x*r.y,c=i*u-s*o,h=(o*l-u*a)/c,p=(s*a-i*l)/c;if(Nu.isNaN(h)||Nu.isInfinite(h)||Nu.isNaN(p)||Nu.isInfinite(p))throw new il;return new Bu(h,p)};var sl=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof Bu){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var o=arguments[0],a=arguments[1],s=arguments[2],u=arguments[3];this.init(o,a,s,u)}},ul={serialVersionUID:{configurable:!0}};sl.prototype.getArea=function(){return this.getWidth()*this.getHeight()},sl.prototype.equals=function(t){if(!(t instanceof sl))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},sl.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new sl;var e=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new sl(e,n,r,i)},sl.prototype.isNull=function(){return this._maxx<this._minx},sl.prototype.getMaxX=function(){return this._maxx},sl.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof Bu){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof sl){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy}},sl.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof sl){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof Bu){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&!(r>this._maxx||r<this._minx||n>this._maxy||n<this._miny)}},sl.prototype.getMinY=function(){return this._miny},sl.prototype.getMinX=function(){return this._minx},sl.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof Bu){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof sl){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(r<this._minx&&(this._minx=r),r>this._maxx&&(this._maxx=r),n<this._miny&&(this._miny=n),n>this._maxy&&(this._maxy=n))}},sl.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},sl.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},sl.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},sl.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},sl.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},sl.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},sl.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},sl.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},sl.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},sl.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof sl){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof Bu){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},sl.prototype.centre=function(){return this.isNull()?null:new Bu((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},sl.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof Bu){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof sl){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2],s=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),a<s?(this._miny=a,this._maxy=s):(this._miny=s,this._maxy=a)}},sl.prototype.getMaxY=function(){return this._maxy},sl.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var r=0;return this._maxy<t._miny?r=t._miny-this._maxy:this._miny>t._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},sl.prototype.hashCode=function(){var t=17;return 37*(t=37*(t=37*(t=37*t+Bu.hashCode(this._minx))+Bu.hashCode(this._maxx))+Bu.hashCode(this._miny))+Bu.hashCode(this._maxy)},sl.prototype.interfaces_=function(){return[Ru,Fu]},sl.prototype.getClass=function(){return sl},sl.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.x<e.x?t.x:e.x)&&r.x<=(t.x>e.x?t.x:e.x)&&r.y>=(t.y<e.y?t.y:e.y)&&r.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],a=arguments[3],s=Math.min(o.x,a.x),u=Math.max(o.x,a.x),l=Math.min(n.x,i.x),c=Math.max(n.x,i.x);return!(l>u||c<s||(s=Math.min(o.y,a.y),u=Math.max(o.y,a.y),l=Math.min(n.y,i.y),c=Math.max(n.y,i.y),l>u||c<s))}},ul.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(sl,ul);var ll={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},cl=function(t){this.geometryFactory=t||new Hc};cl.prototype.read=function(t){var e,r,n;t=t.replace(/[\n\r]/g," ");var i=ll.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=ll.emptyTypeStr.exec(t))[2]=void 0),i&&(r=i[1].toLowerCase(),n=i[2],pl[r]&&(e=pl[r].apply(this,[n]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},cl.prototype.write=function(t){return this.extractGeometry(t)},cl.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!hl[e])return null;var r=e.toUpperCase();return t.isEmpty()?r+" EMPTY":r+"("+hl[e].apply(this,[t])+")"};var hl={coordinate:function(t){return t.x+" "+t.y},point:function(t){return hl.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+hl.point.apply(this,[t._geometries[r]])+")");return e.join(",")},linestring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(hl.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},linearring:function(t){for(var e=[],r=0,n=t._points._coordinates.length;r<n;++r)e.push(hl.coordinate.apply(this,[t._points._coordinates[r]]));return e.join(",")},multilinestring:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+hl.linestring.apply(this,[t._geometries[r]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+hl.linestring.apply(this,[t._shell])+")");for(var r=0,n=t._holes.length;r<n;++r)e.push("("+hl.linestring.apply(this,[t._holes[r]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push("("+hl.polygon.apply(this,[t._geometries[r]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],r=0,n=t._geometries.length;r<n;++r)e.push(this.extractGeometry(t._geometries[r]));return e.join(",")}},pl={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(ll.spaces);return this.geometryFactory.createPoint(new Bu(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(ll.trimParens,"$1"),n.push(pl.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(n)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(ll.spaces),n.push(new Bu(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(n)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,r=t.trim().split(","),n=[],i=0,o=r.length;i<o;++i)e=r[i].trim().split(ll.spaces),n.push(new Bu(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(n)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var r=t.trim().split(ll.parenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(ll.trimParens,"$1"),n.push(pl.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(n)},polygon:function(t){var e,r,n;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(ll.parenComma),a=[],s=0,u=o.length;s<u;++s)e=o[s].replace(ll.trimParens,"$1"),r=pl.linestring.apply(this,[e]),n=this.geometryFactory.createLinearRing(r._points),0===s?i=n:a.push(n);return this.geometryFactory.createPolygon(i,a)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var r=t.trim().split(ll.doubleParenComma),n=[],i=0,o=r.length;i<o;++i)e=r[i].replace(ll.trimParens,"$1"),n.push(pl.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(n)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),r=[],n=0,i=e.length;n<i;++n)r.push(this.read(e[n]));return this.geometryFactory.createGeometryCollection(r)}},fl=function(t){this.parser=new cl(t)};fl.prototype.write=function(t){return this.parser.write(t)},fl.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var dl=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),gl=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments[0];t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dl),yl=function(){};yl.prototype.interfaces_=function(){return[]},yl.prototype.getClass=function(){return yl},yl.shouldNeverReachHere=function(){if(0===arguments.length)yl.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new gl("Should never reach here"+(null!==t?": "+t:""))}},yl.isTrue=function(){var t;if(1===arguments.length)yl.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new gl:new gl(t)},yl.equals=function(){var t,e,r;if(2===arguments.length)yl.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],r=arguments[2],!(e=arguments[1]).equals(t)))throw new gl("Expected "+t+" but encountered "+e+(null!==r?": "+r:""))};var ml=function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new Bu,this._intPt[1]=new Bu,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},vl={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};ml.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},ml.prototype.getTopologySummary=function(){var t=new Wu;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},ml.prototype.computeIntersection=function(t,e,r,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=r,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,r,n)},ml.prototype.getIntersectionNum=function(){return this._result},ml.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},ml.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ml.prototype.setPrecisionModel=function(t){this._precisionModel=t},ml.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;r<this._result;r++)if(!t._intPt[r].equals2D(t._inputLines[e][0])&&!t._intPt[r].equals2D(t._inputLines[e][1]))return!0;return!1}},ml.prototype.getIntersection=function(t){return this._intPt[t]},ml.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},ml.prototype.hasIntersection=function(){return this._result!==ml.NO_INTERSECTION},ml.prototype.getEdgeDistance=function(t,e){return ml.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},ml.prototype.isCollinear=function(){return this._result===ml.COLLINEAR_INTERSECTION},ml.prototype.toString=function(){return fl.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+fl.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},ml.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},ml.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},ml.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},ml.prototype.interfaces_=function(){return[]},ml.prototype.getClass=function(){return ml},ml.computeEdgeDistance=function(t,e,r){var n=Math.abs(r.x-e.x),i=Math.abs(r.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(r))o=n>i?n:i;else{var a=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);0!==(o=n>i?a:s)||t.equals(e)||(o=Math.max(a,s))}return yl.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},ml.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return yl.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},vl.DONT_INTERSECT.get=function(){return 0},vl.DO_INTERSECT.get=function(){return 1},vl.COLLINEAR.get=function(){return 2},vl.NO_INTERSECTION.get=function(){return 0},vl.POINT_INTERSECTION.get=function(){return 1},vl.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ml,vl);var _l=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.isInSegmentEnvelopes=function(t){var e=new sl(this._inputLines[0][0],this._inputLines[0][1]),r=new sl(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,sl.intersects(r,n,e)&&0===wl.orientationIndex(r,n,e)&&0===wl.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=al.intersection(t,r,n,i)}catch(a){if(!(a instanceof il))throw a;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new Bu(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(r)<o&&(i=r,o=Math.abs(r)),Math.abs(n)<o&&(i=n),i},e.prototype.checkDD=function(t,e,r,n,i){var o=Qu.intersection(t,e,r,n),a=this.isInSegmentEnvelopes(o);ol.out.println("DD in env = "+a+" --------------------- "+o),i.distance(o)>1e-4&&ol.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new Bu(t),o=new Bu(e),a=new Bu(r),s=new Bu(n),u=new Bu;this.normalizeToEnvCentre(i,o,a,s,u);var l=this.safeHCoordinateIntersection(i,o,a,s);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=sl.intersects(e,r,n),a=sl.intersects(e,r,i),s=sl.intersects(n,i,e),u=sl.intersects(n,i,r);return o&&a?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):s&&u?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&s?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||a||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||a||s?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):a&&s?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):a&&u?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||s?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.x<e.x?t.x:e.x,a=t.y<e.y?t.y:e.y,s=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=r.x<n.x?r.x:n.x,c=r.y<n.y?r.y:n.y,h=r.x>n.x?r.x:n.x,p=r.y>n.y?r.y:n.y,f=((o>l?o:l)+(s<h?s:h))/2,d=((a>c?a:c)+(u<p?u:p))/2;i.x=f,i.y=d,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.computeIntersect=function(e,r,n,i){if(this._isProper=!1,!sl.intersects(e,r,n,i))return t.NO_INTERSECTION;var o=wl.orientationIndex(e,r,n),a=wl.orientationIndex(e,r,i);if(o>0&&a>0||o<0&&a<0)return t.NO_INTERSECTION;var s=wl.orientationIndex(n,i,e),u=wl.orientationIndex(n,i,r);return s>0&&u>0||s<0&&u<0?t.NO_INTERSECTION:0===o&&0===a&&0===s&&0===u?this.computeCollinearIntersection(e,r,n,i):(0===o||0===a||0===s||0===u?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new Bu(n):0===a?this._intPt[0]=new Bu(i):0===s?this._intPt[0]=new Bu(e):0===u&&(this._intPt[0]=new Bu(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=wl.distancePointLine(t,r,n),a=wl.distancePointLine(e,r,n);return a<o&&(o=a,i=e),(a=wl.distancePointLine(r,t,e))<o&&(o=a,i=r),(a=wl.distancePointLine(n,t,e))<o&&(o=a,i=n),i},e}(ml),xl=function(){};xl.prototype.interfaces_=function(){return[]},xl.prototype.getClass=function(){return xl},xl.orientationIndex=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=r.x-e.x,a=r.y-e.y;return xl.signOfDet2x2(n,i,o,a)},xl.signOfDet2x2=function(t,e,r,n){var i=null,o=null,a=null;if(i=1,0===t||0===n)return 0===e||0===r?0:e>0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(a=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=a*t)+r){if(e<n+n)return i}else{if(e>n+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(a=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=a*r)+t){if(n<e+e)return-i}else{if(n>e+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var bl=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};bl.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var r=t.x,n=e.x;return r>n&&(r=e.x,n=t.x),this._p.x>=r&&this._p.x<=n&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,a=e.x-this._p.x,s=e.y-this._p.y,u=xl.signOfDet2x2(i,o,a,s);if(0===u)return this._isPointOnSegment=!0,null;s<o&&(u=-u),u>0&&this._crossingCount++}},bl.prototype.isPointInPolygon=function(){return this.getLocation()!==qu.EXTERIOR},bl.prototype.getLocation=function(){return this._isPointOnSegment?qu.BOUNDARY:this._crossingCount%2==1?qu.INTERIOR:qu.EXTERIOR},bl.prototype.isOnSegment=function(){return this._isPointOnSegment},bl.prototype.interfaces_=function(){return[]},bl.prototype.getClass=function(){return bl},bl.locatePointInRing=function(){if(arguments[0]instanceof Bu&&Xu(arguments[1],el)){for(var t=arguments[1],e=new bl(arguments[0]),r=new Bu,n=new Bu,i=1;i<t.size();i++)if(t.getCoordinate(i,r),t.getCoordinate(i-1,n),e.countSegment(r,n),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof Bu&&arguments[1]instanceof Array){for(var o=arguments[1],a=new bl(arguments[0]),s=1;s<o.length;s++){var u=o[s],l=o[s-1];if(a.countSegment(u,l),a.isOnSegment())return a.getLocation()}return a.getLocation()}};var wl=function(){},El={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};wl.prototype.interfaces_=function(){return[]},wl.prototype.getClass=function(){return wl},wl.orientationIndex=function(t,e,r){return Qu.orientationIndex(t,e,r)},wl.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,r=t[0].x,n=1;n<t.length-1;n++){var i=t[n].x-r,o=t[n+1].y;e+=i*(t[n-1].y-o)}return e/2}if(Xu(arguments[0],el)){var a=arguments[0],s=a.size();if(s<3)return 0;var u=new Bu,l=new Bu,c=new Bu;a.getCoordinate(0,l),a.getCoordinate(1,c);var h=l.x;c.x-=h;for(var p=0,f=1;f<s-1;f++)u.y=l.y,l.x=c.x,l.y=c.y,a.getCoordinate(f+1,c),c.x-=h,p+=l.x*(u.y-c.y);return p/2}},wl.distanceLineLine=function(t,e,r,n){if(t.equals(e))return wl.distancePointLine(t,r,n);if(r.equals(n))return wl.distancePointLine(n,t,e);var i=!1;if(sl.intersects(t,e,r,n)){var o=(e.x-t.x)*(n.y-r.y)-(e.y-t.y)*(n.x-r.x);if(0===o)i=!0;else{var a=(t.y-r.y)*(n.x-r.x)-(t.x-r.x)*(n.y-r.y),s=((t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y))/o,u=a/o;(u<0||u>1||s<0||s>1)&&(i=!0)}}else i=!0;return i?Zu.min(wl.distancePointLine(t,r,n),wl.distancePointLine(e,r,n),wl.distancePointLine(r,t,e),wl.distancePointLine(n,t,e)):0},wl.isPointInRing=function(t,e){return wl.locatePointInRing(t,e)!==qu.EXTERIOR},wl.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new Bu;t.getCoordinate(0,n);for(var i=n.x,o=n.y,a=1;a<e;a++){t.getCoordinate(a,n);var s=n.x,u=n.y,l=s-i,c=u-o;r+=Math.sqrt(l*l+c*c),i=s,o=u}return r},wl.isCCW=function(t){var e=t.length-1;if(e<3)throw new ku("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],n=0,i=1;i<=e;i++){var o=t[i];o.y>r.y&&(r=o,n=i)}var a=n;do{(a-=1)<0&&(a=e)}while(t[a].equals2D(r)&&a!==n);var s=n;do{s=(s+1)%e}while(t[s].equals2D(r)&&s!==n);var u=t[a],l=t[s];if(u.equals2D(r)||l.equals2D(r)||u.equals2D(l))return!1;var c=wl.computeOrientation(u,r,l);return 0===c?u.x>l.x:c>0},wl.locatePointInRing=function(t,e){return bl.locatePointInRing(t,e)},wl.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},wl.computeOrientation=function(t,e,r){return wl.orientationIndex(t,e,r)},wl.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new ku("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n<e.length-1;n++){var i=wl.distancePointLine(t,e[n],e[n+1]);i<r&&(r=i)}return r}if(3===arguments.length){var o=arguments[0],a=arguments[1],s=arguments[2];if(a.x===s.x&&a.y===s.y)return o.distance(a);var u=(s.x-a.x)*(s.x-a.x)+(s.y-a.y)*(s.y-a.y),l=((o.x-a.x)*(s.x-a.x)+(o.y-a.y)*(s.y-a.y))/u;if(l<=0)return o.distance(a);if(l>=1)return o.distance(s);var c=((a.y-o.y)*(s.x-a.x)-(a.x-o.x)*(s.y-a.y))/u;return Math.abs(c)*Math.sqrt(u)}},wl.isOnLine=function(t,e){for(var r=new _l,n=1;n<e.length;n++){var i=e[n-1],o=e[n];if(r.computeIntersection(t,i,o),r.hasIntersection())return!0}return!1},El.CLOCKWISE.get=function(){return-1},El.RIGHT.get=function(){return wl.CLOCKWISE},El.COUNTERCLOCKWISE.get=function(){return 1},El.LEFT.get=function(){return wl.COUNTERCLOCKWISE},El.COLLINEAR.get=function(){return 0},El.STRAIGHT.get=function(){return wl.COLLINEAR},Object.defineProperties(wl,El);var Il=function(){};Il.prototype.filter=function(t){},Il.prototype.interfaces_=function(){return[]},Il.prototype.getClass=function(){return Il};var Sl=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},Cl={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};Sl.prototype.isGeometryCollection=function(){return this.getSortIndex()===Sl.SORTINDEX_GEOMETRYCOLLECTION},Sl.prototype.getFactory=function(){return this._factory},Sl.prototype.getGeometryN=function(t){return this},Sl.prototype.getArea=function(){return 0},Sl.prototype.isRectangle=function(){return!1},Sl.prototype.equals=function(){if(arguments[0]instanceof Sl){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof Sl))return!1;var r=e;return this.equalsExact(r)}},Sl.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},Sl.prototype.geometryChanged=function(){this.apply(Sl.geometryChangedFilter)},Sl.prototype.geometryChangedAction=function(){this._envelope=null},Sl.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},Sl.prototype.getLength=function(){return 0},Sl.prototype.getNumGeometries=function(){return 1},Sl.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.getSortIndex()!==r.getSortIndex()?this.getSortIndex()-r.getSortIndex():this.isEmpty()&&r.isEmpty()?0:this.isEmpty()?-1:r.isEmpty()?1:this.compareToSameClass(r,n)}},Sl.prototype.getUserData=function(){return this._userData},Sl.prototype.getSRID=function(){return this._SRID},Sl.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Sl.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===Sl.SORTINDEX_GEOMETRYCOLLECTION)throw new ku("This method does not support GeometryCollection arguments")},Sl.prototype.equal=function(t,e,r){return 0===r?t.equals(e):t.distance(e)<=r},Sl.prototype.norm=function(){var t=this.copy();return t.normalize(),t},Sl.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Sl.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new sl(this._envelope)},Sl.prototype.setSRID=function(t){this._SRID=t},Sl.prototype.setUserData=function(t){this._userData=t},Sl.prototype.compare=function(t,e){for(var r=t.iterator(),n=e.iterator();r.hasNext()&&n.hasNext();){var i=r.next(),o=n.next(),a=i.compareTo(o);if(0!==a)return a}return r.hasNext()?1:n.hasNext()?-1:0},Sl.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Sl.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Sl.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Sl.SORTINDEX_MULTIPOINT||this.getSortIndex()===Sl.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Sl.SORTINDEX_MULTIPOLYGON},Sl.prototype.interfaces_=function(){return[Ou,Ru,Fu]},Sl.prototype.getClass=function(){return Sl},Sl.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},Sl.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},Cl.serialVersionUID.get=function(){return 0x799ea46522854c00},Cl.SORTINDEX_POINT.get=function(){return 0},Cl.SORTINDEX_MULTIPOINT.get=function(){return 1},Cl.SORTINDEX_LINESTRING.get=function(){return 2},Cl.SORTINDEX_LINEARRING.get=function(){return 3},Cl.SORTINDEX_MULTILINESTRING.get=function(){return 4},Cl.SORTINDEX_POLYGON.get=function(){return 5},Cl.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Cl.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Cl.geometryChangedFilter.get=function(){return Pl},Object.defineProperties(Sl,Cl);var Pl=function(){};Pl.interfaces_=function(){return[Il]},Pl.filter=function(t){t.geometryChangedAction()};var Ml=function(){};Ml.prototype.filter=function(t){},Ml.prototype.interfaces_=function(){return[]},Ml.prototype.getClass=function(){return Ml};var Tl=function(){},Ll={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Tl.prototype.isInBoundary=function(t){},Tl.prototype.interfaces_=function(){return[]},Tl.prototype.getClass=function(){return Tl},Ll.Mod2BoundaryNodeRule.get=function(){return Al},Ll.EndPointBoundaryNodeRule.get=function(){return kl},Ll.MultiValentEndPointBoundaryNodeRule.get=function(){return Nl},Ll.MonoValentEndPointBoundaryNodeRule.get=function(){return Dl},Ll.MOD2_BOUNDARY_RULE.get=function(){return new Al},Ll.ENDPOINT_BOUNDARY_RULE.get=function(){return new kl},Ll.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Nl},Ll.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Dl},Ll.OGC_SFS_BOUNDARY_RULE.get=function(){return Tl.MOD2_BOUNDARY_RULE},Object.defineProperties(Tl,Ll);var Al=function(){};Al.prototype.isInBoundary=function(t){return t%2==1},Al.prototype.interfaces_=function(){return[Tl]},Al.prototype.getClass=function(){return Al};var kl=function(){};kl.prototype.isInBoundary=function(t){return t>0},kl.prototype.interfaces_=function(){return[Tl]},kl.prototype.getClass=function(){return kl};var Nl=function(){};Nl.prototype.isInBoundary=function(t){return t>1},Nl.prototype.interfaces_=function(){return[Tl]},Nl.prototype.getClass=function(){return Nl};var Dl=function(){};Dl.prototype.isInBoundary=function(t){return 1===t},Dl.prototype.interfaces_=function(){return[Tl]},Dl.prototype.getClass=function(){return Dl};var Rl=function(){};function Ol(t){this.message=t||""}Rl.prototype.add=function(){},Rl.prototype.addAll=function(){},Rl.prototype.isEmpty=function(){},Rl.prototype.iterator=function(){},Rl.prototype.size=function(){},Rl.prototype.toArray=function(){},Rl.prototype.remove=function(){},Ol.prototype=new Error,Ol.prototype.name="IndexOutOfBoundsException";var zl=function(){};zl.prototype.hasNext=function(){},zl.prototype.next=function(){},zl.prototype.remove=function(){};var Fl=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(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Rl);function Bl(t){this.message=t||""}Bl.prototype=new Error,Bl.prototype.name="NoSuchElementException";var Ul=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Rl&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,Rl]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new jl(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new Ol;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,r=0,n=this.array_.length;r<n;r++)if(this.array_[r]===t){this.array_.splice(r,1),e=!0;break}return e},e}(Fl),jl=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new Bl;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(zl),Vl=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.ensureCapacity(r.length),this.add(r,n)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={coordArrayType:{configurable:!0}};return r.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],r=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),e),r=!0;return r}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),r=0;r<this.size();r++)e.add(r,this.get(r).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var r=arguments[0];t.prototype.add.call(this,r)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return this.add(n,i,!0),!0}if(arguments[0]instanceof Bu&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1]&&this.size()>=1){if(this.get(this.size()-1).equals2D(o))return null}t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var a=arguments[0],s=arguments[1];return this.add(a,s),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1];if(arguments[2])for(var c=0;c<u.length;c++)e.add(u[c],l);else for(var h=u.length-1;h>=0;h--)e.add(u[h],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof Bu){var p=arguments[0],f=arguments[1];if(!arguments[2]){var d=this.size();if(d>0){if(p>0){if(this.get(p-1).equals2D(f))return null}if(p<d){if(this.get(p).equals2D(f))return null}}}t.prototype.add.call(this,p,f)}}else if(4===arguments.length){var g=arguments[0],y=arguments[1],m=arguments[2],v=arguments[3],_=1;m>v&&(_=-1);for(var x=m;x!==v;x+=_)e.add(g[x],y);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Bu(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(Ul),ql=function(){},Gl={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Gl.ForwardComparator.get=function(){return Xl},Gl.BidirectionalComparator.get=function(){return Zl},Gl.coordArrayType.get=function(){return new Array(0).fill(null)},ql.prototype.interfaces_=function(){return[]},ql.prototype.getClass=function(){return ql},ql.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},ql.ptNotInList=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(ql.indexOf(n,e)<0)return n}return null},ql.scroll=function(t,e){var r=ql.indexOf(e,t);if(r<0)return null;var n=new Array(t.length).fill(null);ol.arraycopy(t,r,n,0,t.length-r),ol.arraycopy(t,0,n,t.length-r,r),ol.arraycopy(n,0,t,0,t.length)},ql.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!t[r].equals(e[r]))return!1;return!0}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];if(n===i)return!0;if(null===n||null===i)return!1;if(n.length!==i.length)return!1;for(var a=0;a<n.length;a++)if(0!==o.compare(n[a],i[a]))return!1;return!0}},ql.intersection=function(t,e){for(var r=new Vl,n=0;n<t.length;n++)e.intersects(t[n])&&r.add(t[n],!0);return r.toCoordinateArray()},ql.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},ql.removeRepeatedPoints=function(t){return ql.hasRepeatedPoints(t)?new Vl(t,!1).toCoordinateArray():t},ql.reverse=function(t){for(var e=t.length-1,r=Math.trunc(e/2),n=0;n<=r;n++){var i=t[n];t[n]=t[e-n],t[e-n]=i}},ql.removeNull=function(t){for(var e=0,r=0;r<t.length;r++)null!==t[r]&&e++;var n=new Array(e).fill(null);if(0===e)return n;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(n[i++]=t[o]);return n},ql.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),r=0;r<t.length;r++)e[r]=new Bu(t[r]);return e}if(5===arguments.length)for(var n=arguments[0],i=arguments[1],o=arguments[2],a=arguments[3],s=arguments[4],u=0;u<s;u++)o[a+u]=new Bu(n[i+u])},ql.isEqualReversed=function(t,e){for(var r=0;r<t.length;r++){var n=t[r],i=e[t.length-r-1];if(0!==n.compareTo(i))return!1}return!0},ql.envelope=function(t){for(var e=new sl,r=0;r<t.length;r++)e.expandToInclude(t[r]);return e},ql.toCoordinateArray=function(t){return t.toArray(ql.coordArrayType)},ql.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},ql.indexOf=function(t,e){for(var r=0;r<e.length;r++)if(t.equals(e[r]))return r;return-1},ql.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var r=t.length-1-e,n=t[e].compareTo(t[r]);if(0!==n)return n}return 1},ql.compare=function(t,e){for(var r=0;r<t.length&&r<e.length;){var n=t[r].compareTo(e[r]);if(0!==n)return n;r++}return r<e.length?-1:r<t.length?1:0},ql.minCoordinate=function(t){for(var e=null,r=0;r<t.length;r++)(null===e||e.compareTo(t[r])>0)&&(e=t[r]);return e},ql.extract=function(t,e,r){e=Zu.clamp(e,0,t.length);var n=(r=Zu.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),r<e&&(n=0);var i=new Array(n).fill(null);if(0===n)return i;for(var o=0,a=e;a<=r;a++)i[o++]=t[a];return i},Object.defineProperties(ql,Gl);var Xl=function(){};Xl.prototype.compare=function(t,e){return ql.compare(t,e)},Xl.prototype.interfaces_=function(){return[zu]},Xl.prototype.getClass=function(){return Xl};var Zl=function(){};Zl.prototype.compare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;var i=ql.compare(r,n);return ql.isEqualReversed(r,n)?0:i},Zl.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.length<n.length)return-1;if(r.length>n.length)return 1;if(0===r.length)return 0;for(var i=ql.increasingDirection(r),o=ql.increasingDirection(n),a=i>0?0:r.length-1,s=o>0?0:r.length-1,u=0;u<r.length;u++){var l=r[a].compareTo(n[s]);if(0!==l)return l;a+=i,s+=o}return 0},Zl.prototype.interfaces_=function(){return[zu]},Zl.prototype.getClass=function(){return Zl};var Yl=function(){};Yl.prototype.get=function(){},Yl.prototype.put=function(){},Yl.prototype.size=function(){},Yl.prototype.values=function(){},Yl.prototype.entrySet=function(){};var Wl=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}(Yl);function Hl(t){this.message=t||""}function Jl(){}Hl.prototype=new Error,Hl.prototype.name="OperationNotSupported",Jl.prototype=new Rl,Jl.prototype.contains=function(){};var Kl=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Rl&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++)if(this.array_[e]===t)return!0;return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new $l(this)},e}(Jl),$l=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new Bl;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new Hl},e}(zl);function Ql(t){return null===t?0:t.color}function tc(t){return null===t?null:t.parent}function ec(t,e){null!==t&&(t.color=e)}function rc(t){return null===t?null:t.left}function nc(t){return null===t?null:t.right}function ic(){this.root_=null,this.size_=0}ic.prototype=new Wl,ic.prototype.get=function(t){for(var e=this.root_;null!==e;){var r=t.compareTo(e.key);if(r<0)e=e.left;else{if(!(r>0))return e.value;e=e.right}}return null},ic.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var a={key:t,left:null,right:null,value:e,parent:r,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=a:r.right=a,this.fixAfterInsertion(a),this.size_++,null},ic.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(tc(t)===rc(tc(tc(t)))){var r=nc(tc(tc(t)));1===Ql(r)?(ec(tc(t),0),ec(r,0),ec(tc(tc(t)),1),t=tc(tc(t))):(t===nc(tc(t))&&(t=tc(t),e.rotateLeft(t)),ec(tc(t),0),ec(tc(tc(t)),1),e.rotateRight(tc(tc(t))))}else{var n=rc(tc(tc(t)));1===Ql(n)?(ec(tc(t),0),ec(n,0),ec(tc(tc(t)),1),t=tc(tc(t))):(t===rc(tc(t))&&(t=tc(t),e.rotateRight(t)),ec(tc(t),0),ec(tc(tc(t)),1),e.rotateLeft(tc(tc(t))))}this.root_.color=0},ic.prototype.values=function(){var t=new Ul,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=ic.successor(e));)t.add(e.value);return t},ic.prototype.entrySet=function(){var t=new Kl,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=ic.successor(e));)t.add(e);return t},ic.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},ic.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},ic.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},ic.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},ic.prototype.size=function(){return this.size_};var oc=function(){};function ac(){}function sc(){this.array_=[],arguments[0]instanceof Rl&&this.addAll(arguments[0])}oc.prototype.interfaces_=function(){return[]},oc.prototype.getClass=function(){return oc},ac.prototype=new Jl,sc.prototype=new ac,sc.prototype.contains=function(t){for(var e=0,r=this.array_.length;e<r;e++)if(0===this.array_[e].compareTo(t))return!0;return!1},sc.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,r=this.array_.length;e<r;e++)if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0;return this.array_.push(t),!0},sc.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},sc.prototype.remove=function(t){throw new Hl},sc.prototype.size=function(){return this.array_.length},sc.prototype.isEmpty=function(){return 0===this.array_.length},sc.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t},sc.prototype.iterator=function(){return new uc(this)};var uc=function(t){this.treeSet_=t,this.position_=0};uc.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new Bl;return this.treeSet_.array_[this.position_++]},uc.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},uc.prototype.remove=function(){throw new Hl};var lc=function(){};lc.sort=function(){var t,e,r,n,i=arguments[0];if(1===arguments.length)n=function(t,e){return t.compareTo(e)},i.sort(n);else if(2===arguments.length)r=arguments[1],n=function(t,e){return r.compare(t,e)},i.sort(n);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),r=arguments[3],n=function(t,e){return r.compare(t,e)},e.sort(n),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},lc.asList=function(t){for(var e=new Ul,r=0,n=t.length;r<n;r++)e.add(t[r]);return e};var cc=function(){},hc={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};hc.P.get=function(){return 0},hc.L.get=function(){return 1},hc.A.get=function(){return 2},hc.FALSE.get=function(){return-1},hc.TRUE.get=function(){return-2},hc.DONTCARE.get=function(){return-3},hc.SYM_FALSE.get=function(){return"F"},hc.SYM_TRUE.get=function(){return"T"},hc.SYM_DONTCARE.get=function(){return"*"},hc.SYM_P.get=function(){return"0"},hc.SYM_L.get=function(){return"1"},hc.SYM_A.get=function(){return"2"},cc.prototype.interfaces_=function(){return[]},cc.prototype.getClass=function(){return cc},cc.toDimensionSymbol=function(t){switch(t){case cc.FALSE:return cc.SYM_FALSE;case cc.TRUE:return cc.SYM_TRUE;case cc.DONTCARE:return cc.SYM_DONTCARE;case cc.P:return cc.SYM_P;case cc.L:return cc.SYM_L;case cc.A:return cc.SYM_A}throw new ku("Unknown dimension value: "+t)},cc.toDimensionValue=function(t){switch(Ju.toUpperCase(t)){case cc.SYM_FALSE:return cc.FALSE;case cc.SYM_TRUE:return cc.TRUE;case cc.SYM_DONTCARE:return cc.DONTCARE;case cc.SYM_P:return cc.P;case cc.SYM_L:return cc.L;case cc.SYM_A:return cc.A}throw new ku("Unknown dimension symbol: "+t)},Object.defineProperties(cc,hc);var pc=function(){};pc.prototype.filter=function(t){},pc.prototype.interfaces_=function(){return[]},pc.prototype.getClass=function(){return pc};var fc=function(){};fc.prototype.filter=function(t,e){},fc.prototype.isDone=function(){},fc.prototype.isGeometryChanged=function(){},fc.prototype.interfaces_=function(){return[]},fc.prototype.getClass=function(){return fc};var dc=function(t){function e(e,r){if(t.call(this,r),this._geometries=e||[],t.hasNullElements(this._geometries))throw new ku("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new sl,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=0;r<this._geometries.length;r++)for(var n=this._geometries[r].getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._geometries.length!==n._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(n._geometries[i],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();lc.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=cc.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=cc.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new sc(lc.asList(this._geometries)),r=new sc(lc.asList(t._geometries));return this.compare(e,r)}if(2===arguments.length){for(var n=arguments[1],i=arguments[0],o=this.getNumGeometries(),a=i.getNumGeometries(),s=0;s<o&&s<a;){var u=this.getGeometryN(s),l=i.getGeometryN(s),c=u.compareToSameClass(l,n);if(0!==c)return c;s++}return s<o?1:s<a?-1:0}},e.prototype.apply=function(){var t=this;if(Xu(arguments[0],Ml))for(var e=arguments[0],r=0;r<this._geometries.length;r++)t._geometries[r].apply(e);else if(Xu(arguments[0],fc)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(Xu(arguments[0],pc)){var o=arguments[0];o.filter(this);for(var a=0;a<this._geometries.length;a++)t._geometries[a].apply(o)}else if(Xu(arguments[0],Il)){var s=arguments[0];s.filter(this);for(var u=0;u<this._geometries.length;u++)t._geometries[u].apply(s)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),yl.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var r=0;r<this._geometries.length;r++)e._geometries[r]=this._geometries[r].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,r),e}(Sl),gc=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={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Sl.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?cc.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[t-1-r]=this._geometries[r].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new yc(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[oc]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,r),e}(dc),yc=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=Tl.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this._geom=r,this._geomFact=r.getFactory(),this._bnRule=n}};yc.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},yc.prototype.getBoundary=function(){return this._geom instanceof Pc?this.boundaryLineString(this._geom):this._geom instanceof gc?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},yc.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},yc.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},yc.prototype.computeBoundaryCoordinates=function(t){var e=this,r=new Ul;this._endpointMap=new ic;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var a=o.next(),s=a.getValue().count;e._bnRule.isInBoundary(s)&&r.add(a.getKey())}return ql.toCoordinateArray(r)},yc.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new mc,this._endpointMap.put(t,e)),e.count++},yc.prototype.interfaces_=function(){return[]},yc.prototype.getClass=function(){return yc},yc.getBoundary=function(){if(1===arguments.length){return new yc(arguments[0]).getBoundary()}if(2===arguments.length){return new yc(arguments[0],arguments[1]).getBoundary()}};var mc=function(){this.count=null};function vc(){}function _c(){}mc.prototype.interfaces_=function(){return[]},mc.prototype.getClass=function(){return mc};var xc=function(){};function bc(){}function wc(){}function Ec(){}var Ic=function(){},Sc={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Ic.prototype.interfaces_=function(){return[]},Ic.prototype.getClass=function(){return Ic},Ic.chars=function(t,e){for(var r=new Array(e).fill(null),n=0;n<e;n++)r[n]=t;return String(r)},Ic.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new bc,r=new vc(e);return t.printStackTrace(r),e.toString()}if(2===arguments.length){for(var n=arguments[1],i="",o=new Ec(new _c(Ic.getStackTrace(arguments[0]))),a=0;a<n;a++)try{i+=o.readLine()+Ic.NEWLINE}catch(t){if(!(t instanceof wc))throw t;yl.shouldNeverReachHere()}return i}},Ic.split=function(t,e){for(var r=e.length,n=new Ul,i=""+t,o=i.indexOf(e);o>=0;){var a=i.substring(0,o);n.add(a),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var s=new Array(n.size()).fill(null),u=0;u<s.length;u++)s[u]=n.get(u);return s},Ic.toString=function(){if(1===arguments.length){var t=arguments[0];return Ic.SIMPLE_ORDINATE_FORMAT.format(t)}},Ic.spaces=function(t){return Ic.chars(" ",t)},Sc.NEWLINE.get=function(){return ol.getProperty("line.separator")},Sc.SIMPLE_ORDINATE_FORMAT.get=function(){return new xc("0.#")},Object.defineProperties(Ic,Sc);var Cc=function(){};Cc.prototype.interfaces_=function(){return[]},Cc.prototype.getClass=function(){return Cc},Cc.copyCoord=function(t,e,r,n){for(var i=Math.min(t.getDimension(),r.getDimension()),o=0;o<i;o++)r.setOrdinate(n,o,t.getOrdinate(e,o))},Cc.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,el.X)===t.getOrdinate(e-1,el.X)&&t.getOrdinate(0,el.Y)===t.getOrdinate(e-1,el.Y)},Cc.isEqual=function(t,e){var r=t.size();if(r!==e.size())return!1;for(var n=Math.min(t.getDimension(),e.getDimension()),i=0;i<r;i++)for(var o=0;o<n;o++){var a=t.getOrdinate(i,o),s=e.getOrdinate(i,o);if(!(t.getOrdinate(i,o)===e.getOrdinate(i,o)||Nu.isNaN(a)&&Nu.isNaN(s)))return!1}return!0},Cc.extend=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();if(Cc.copy(e,0,n,0,i),i>0)for(var o=i;o<r;o++)Cc.copy(e,i-1,n,o,1);return n},Cc.reverse=function(t){for(var e=t.size()-1,r=Math.trunc(e/2),n=0;n<=r;n++)Cc.swap(t,n,e-n)},Cc.swap=function(t,e,r){if(e===r)return null;for(var n=0;n<t.getDimension();n++){var i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(r,n)),t.setOrdinate(r,n,i)}},Cc.copy=function(t,e,r,n,i){for(var o=0;o<i;o++)Cc.copyCoord(t,e+o,r,n+o)},Cc.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var r=t.getDimension(),n=new Wu;n.append("(");for(var i=0;i<e;i++){i>0&&n.append(" ");for(var o=0;o<r;o++)o>0&&n.append(","),n.append(Ic.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},Cc.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?Cc.createClosedRing(t,e,4):e.getOrdinate(0,el.X)===e.getOrdinate(r-1,el.X)&&e.getOrdinate(0,el.Y)===e.getOrdinate(r-1,el.Y)?e:Cc.createClosedRing(t,e,r+1)},Cc.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();Cc.copy(e,0,n,0,i);for(var o=i;o<r;o++)Cc.copy(e,0,n,o,1);return n};var Pc=function(t){function e(e,r){t.call(this,r),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new sl:this._points.expandEnvelope(new sl)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e;if(this._points.size()!==n._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),n._points.getCoordinate(i),r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var r=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(r)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(r))>0&&Cc.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?cc.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return wl.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return Cc.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e<this._points.size()&&r<t._points.size();){var n=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(r));if(0!==n)return n;e++,r++}return e<this._points.size()?1:r<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(Xu(arguments[0],Ml))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(Xu(arguments[0],fc)){var r=arguments[0];if(0===this._points.size())return null;for(var n=0;n<this._points.size()&&(r.filter(this._points,n),!r.isDone());n++);r.isGeometryChanged()&&this.geometryChanged()}else if(Xu(arguments[0],pc)){arguments[0].filter(this)}else if(Xu(arguments[0],Il)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return new yc(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new ku("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[oc]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,r),e}(Sl),Mc=function(){};Mc.prototype.interfaces_=function(){return[]},Mc.prototype.getClass=function(){return Mc};var Tc=function(t){function e(e,r){t.call(this,r),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new sl;var t=new sl;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),r))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return cc.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(Xu(arguments[0],Ml)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(Xu(arguments[0],fc)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(Xu(arguments[0],pc)){arguments[0].filter(this)}else if(Xu(arguments[0],Il)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),yl.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[Mc]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,r),e}(Sl),Lc=function(){};Lc.prototype.interfaces_=function(){return[]},Lc.prototype.getClass=function(){return Lc};var Ac=function(t){function e(e,r,n){if(t.call(this,n),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===r&&(r=[]),t.hasNullElements(r))throw new ku("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(r))throw new ku("shell is empty but holes are not");this._shell=e,this._holes=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,r=this._shell.getCoordinates(),n=0;n<r.length;n++)t[++e]=r[n];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),a=0;a<o.length;a++)t[++e]=o[a];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(wl.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(wl.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),r=0;r<5;r++){var n=t.getX(r);if(n!==e.getMinX()&&n!==e.getMaxX())return!1;var i=t.getY(r);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),a=t.getY(0),s=1;s<=4;s++){var u=t.getX(s),l=t.getY(s);if(u!==o==(l!==a))return!1;o=u,a=l}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];if(!this.isEquivalentClass(e))return!1;var n=e,i=this._shell,o=n._shell;if(!i.equalsExact(o,r))return!1;if(this._holes.length!==n._holes.length)return!1;for(var a=0;a<this._holes.length;a++)if(!this._holes[a].equalsExact(n._holes[a],r))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);lc.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(e.isEmpty())return null;var n=new Array(e.getCoordinates().length-1).fill(null);ol.arraycopy(e.getCoordinates(),0,n,0,n.length);var i=ql.minCoordinate(e.getCoordinates());ql.scroll(n,i),ol.arraycopy(n,0,e.getCoordinates(),0,n.length),e.getCoordinates()[n.length]=n[0],wl.isCCW(e.getCoordinates())===r&&ql.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,r=t._shell;return e.compareToSameClass(r)}if(2===arguments.length){var n=arguments[1],i=arguments[0],o=this._shell,a=i._shell,s=o.compareToSameClass(a,n);if(0!==s)return s;for(var u=this.getNumInteriorRing(),l=i.getNumInteriorRing(),c=0;c<u&&c<l;){var h=this.getInteriorRingN(c),p=i.getInteriorRingN(c),f=h.compareToSameClass(p,n);if(0!==f)return f;c++}return c<u?1:c<l?-1:0}},e.prototype.apply=function(t){var e=this;if(Xu(t,Ml)){this._shell.apply(t);for(var r=0;r<this._holes.length;r++)e._holes[r].apply(t)}else if(Xu(t,fc)){if(this._shell.apply(t),!t.isDone())for(var n=0;n<this._holes.length&&(e._holes[n].apply(t),!t.isDone());n++);t.isGeometryChanged()&&this.geometryChanged()}else if(Xu(t,pc))t.filter(this);else if(Xu(t,Il)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var r=0;r<this._holes.length;r++)e._holes[r]=this._holes[r].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),r=new Array(this._holes.length).fill(null),n=0;n<r.length;n++)r[n]=this._holes[n].copy();return new e(t,r,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[Lc]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,r),e}(Sl),kc=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={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Sl.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return cc.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Mc]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,r),e}(dc),Nc=function(t){function e(e,r){e instanceof Bu&&r instanceof Hc&&(e=r.getCoordinateSequenceFactory().create(e)),t.call(this,e,r),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Sl.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return cc.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return Cc.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new ku("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new ku("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(Pc),Dc=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={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Sl.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r<this._geometries.length;r++)e[r]=this._geometries[r].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new Ul,e=0;e<this._geometries.length;e++)for(var r=this._geometries[e].getBoundary(),n=0;n<r.getNumGeometries();n++)t.add(r.getGeometryN(n));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),r=0;r<t.length;r++)t[r]=this._geometries[r].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Lc]},e.prototype.getClass=function(){return e},r.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,r),e}(dc),Rc=function(t){this._factory=t||null,this._isUserDataCopied=!1},Oc={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Rc.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Rc.prototype.edit=function(t,e){if(null===t)return null;var r=this.editInternal(t,e);return this._isUserDataCopied&&r.setUserData(t.getUserData()),r},Rc.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof dc?this.editGeometryCollection(t,e):t instanceof Ac?this.editPolygon(t,e):t instanceof Tc||t instanceof Pc?e.edit(t,this._factory):(yl.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Rc.prototype.editGeometryCollection=function(t,e){for(var r=e.edit(t,this._factory),n=new Ul,i=0;i<r.getNumGeometries();i++){var o=this.edit(r.getGeometryN(i),e);null===o||o.isEmpty()||n.add(o)}return r.getClass()===kc?this._factory.createMultiPoint(n.toArray([])):r.getClass()===gc?this._factory.createMultiLineString(n.toArray([])):r.getClass()===Dc?this._factory.createMultiPolygon(n.toArray([])):this._factory.createGeometryCollection(n.toArray([]))},Rc.prototype.editPolygon=function(t,e){var r=e.edit(t,this._factory);if(null===r&&(r=this._factory.createPolygon(null)),r.isEmpty())return r;var n=this.edit(r.getExteriorRing(),e);if(null===n||n.isEmpty())return this._factory.createPolygon();for(var i=new Ul,o=0;o<r.getNumInteriorRing();o++){var a=this.edit(r.getInteriorRingN(o),e);null===a||a.isEmpty()||i.add(a)}return this._factory.createPolygon(n,i.toArray([]))},Rc.prototype.interfaces_=function(){return[]},Rc.prototype.getClass=function(){return Rc},Rc.GeometryEditorOperation=function(){},Oc.NoOpGeometryOperation.get=function(){return zc},Oc.CoordinateOperation.get=function(){return Fc},Oc.CoordinateSequenceOperation.get=function(){return Bc},Object.defineProperties(Rc,Oc);var zc=function(){};zc.prototype.edit=function(t,e){return t},zc.prototype.interfaces_=function(){return[Rc.GeometryEditorOperation]},zc.prototype.getClass=function(){return zc};var Fc=function(){};Fc.prototype.edit=function(t,e){var r=this.editCoordinates(t.getCoordinates(),t);return null===r?t:t instanceof Nc?e.createLinearRing(r):t instanceof Pc?e.createLineString(r):t instanceof Tc?r.length>0?e.createPoint(r[0]):e.createPoint():t},Fc.prototype.interfaces_=function(){return[Rc.GeometryEditorOperation]},Fc.prototype.getClass=function(){return Fc};var Bc=function(){};Bc.prototype.edit=function(t,e){return t instanceof Nc?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Pc?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Tc?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},Bc.prototype.interfaces_=function(){return[Rc.GeometryEditorOperation]},Bc.prototype.getClass=function(){return Bc};var Uc=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var r=0;r<e;r++)t._coordinates[r]=new Bu}else if(Xu(arguments[0],el)){var n=arguments[0];if(null===n)return this._coordinates=new Array(0).fill(null),null;this._dimension=n.getDimension(),this._coordinates=new Array(n.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=n.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],a=arguments[1];this._coordinates=o,this._dimension=a,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var s=arguments[0],u=arguments[1];this._coordinates=new Array(s).fill(null),this._dimension=u;for(var l=0;l<s;l++)t._coordinates[l]=new Bu}},jc={serialVersionUID:{configurable:!0}};Uc.prototype.setOrdinate=function(t,e,r){switch(e){case el.X:this._coordinates[t].x=r;break;case el.Y:this._coordinates[t].y=r;break;case el.Z:this._coordinates[t].z=r;break;default:throw new ku("invalid ordinateIndex")}},Uc.prototype.size=function(){return this._coordinates.length},Uc.prototype.getOrdinate=function(t,e){switch(e){case el.X:return this._coordinates[t].x;case el.Y:return this._coordinates[t].y;case el.Z:return this._coordinates[t].z}return Nu.NaN},Uc.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],r=arguments[1];r.x=this._coordinates[e].x,r.y=this._coordinates[e].y,r.z=this._coordinates[e].z}},Uc.prototype.getCoordinateCopy=function(t){return new Bu(this._coordinates[t])},Uc.prototype.getDimension=function(){return this._dimension},Uc.prototype.getX=function(t){return this._coordinates[t].x},Uc.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new Uc(t,this._dimension)},Uc.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},Uc.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new Uc(t,this._dimension)},Uc.prototype.toString=function(){if(this._coordinates.length>0){var t=new Wu(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},Uc.prototype.getY=function(t){return this._coordinates[t].y},Uc.prototype.toCoordinateArray=function(){return this._coordinates},Uc.prototype.interfaces_=function(){return[el,Fu]},Uc.prototype.getClass=function(){return Uc},jc.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(Uc,jc);var Vc=function(){},qc={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Vc.prototype.readResolve=function(){return Vc.instance()},Vc.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array){return new Uc(arguments[0])}if(Xu(arguments[0],el)){return new Uc(arguments[0])}}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new Uc(t):new Uc(t,e)}},Vc.prototype.interfaces_=function(){return[Vu,Fu]},Vc.prototype.getClass=function(){return Vc},Vc.instance=function(){return Vc.instanceObject},qc.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},qc.instanceObject.get=function(){return new Vc},Object.defineProperties(Vc,qc);var Gc=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new Ul,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new Kl;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(Yl),Xc=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof Yc){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},Zc={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Xc.prototype.equals=function(t){if(!(t instanceof Xc))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},Xc.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new Hu(r).compareTo(new Hu(n))},Xc.prototype.getScale=function(){return this._scale},Xc.prototype.isFloating=function(){return this._modelType===Xc.FLOATING||this._modelType===Xc.FLOATING_SINGLE},Xc.prototype.getType=function(){return this._modelType},Xc.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Xc.FLOATING?t="Floating":this._modelType===Xc.FLOATING_SINGLE?t="Floating-Single":this._modelType===Xc.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},Xc.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return Nu.isNaN(t)||this._modelType===Xc.FLOATING_SINGLE?t:this._modelType===Xc.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof Bu){var e=arguments[0];if(this._modelType===Xc.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},Xc.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Xc.FLOATING?t=16:this._modelType===Xc.FLOATING_SINGLE?t=6:this._modelType===Xc.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},Xc.prototype.setScale=function(t){this._scale=Math.abs(t)},Xc.prototype.interfaces_=function(){return[Fu,Ru]},Xc.prototype.getClass=function(){return Xc},Xc.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Zc.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},Zc.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Xc,Zc);var Yc=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Wc={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Yc.prototype.readResolve=function(){return Yc.nameToTypeMap.get(this._name)},Yc.prototype.toString=function(){return this._name},Yc.prototype.interfaces_=function(){return[Fu]},Yc.prototype.getClass=function(){return Yc},Wc.serialVersionUID.get=function(){return-552860263173159e4},Wc.nameToTypeMap.get=function(){return new Gc},Object.defineProperties(Yc,Wc),Xc.Type=Yc,Xc.FIXED=new Yc("FIXED"),Xc.FLOATING=new Yc("FLOATING"),Xc.FLOATING_SINGLE=new Yc("FLOATING SINGLE");var Hc=function t(){this._precisionModel=new Xc,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?Xu(arguments[0],Vu)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Xc&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Jc={serialVersionUID:{configurable:!0}};Hc.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Bu(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Bu(t.getMinX(),t.getMinY()),new Bu(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Bu(t.getMinX(),t.getMinY()),new Bu(t.getMinX(),t.getMaxY()),new Bu(t.getMaxX(),t.getMaxY()),new Bu(t.getMaxX(),t.getMinY()),new Bu(t.getMinX(),t.getMinY())]),null)},Hc.prototype.createLineString=function(t){return t?t instanceof Array?new Pc(this.getCoordinateSequenceFactory().create(t),this):Xu(t,el)?new Pc(t,this):void 0:new Pc(this.getCoordinateSequenceFactory().create([]),this)},Hc.prototype.createMultiLineString=function(){if(0===arguments.length)return new gc(null,this);if(1===arguments.length){return new gc(arguments[0],this)}},Hc.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),a=o.getClass();null===e&&(e=a),a!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(Hc.toGeometryArray(t));var s=t.iterator().next();if(t.size()>1){if(s instanceof Ac)return this.createMultiPolygon(Hc.toPolygonArray(t));if(s instanceof Pc)return this.createMultiLineString(Hc.toLineStringArray(t));if(s instanceof Tc)return this.createMultiPoint(Hc.toPointArray(t));yl.shouldNeverReachHere("Unhandled class: "+s.getClass().getName())}return s},Hc.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},Hc.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Bu){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(Xu(arguments[0],el)){return new Tc(arguments[0],this)}}},Hc.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Hc.prototype.createPolygon=function(){if(0===arguments.length)return new Ac(null,null,this);if(1===arguments.length){if(Xu(arguments[0],el)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Nc){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length){return new Ac(arguments[0],arguments[1],this)}},Hc.prototype.getSRID=function(){return this._SRID},Hc.prototype.createGeometryCollection=function(){if(0===arguments.length)return new dc(null,this);if(1===arguments.length){return new dc(arguments[0],this)}},Hc.prototype.createGeometry=function(t){return new Rc(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},Hc.prototype.getPrecisionModel=function(){return this._precisionModel},Hc.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(Xu(arguments[0],el)){return new Nc(arguments[0],this)}}},Hc.prototype.createMultiPolygon=function(){if(0===arguments.length)return new Dc(null,this);if(1===arguments.length){return new Dc(arguments[0],this)}},Hc.prototype.createMultiPoint=function(){if(0===arguments.length)return new kc(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){return new kc(arguments[0],this)}if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(Xu(arguments[0],el)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n<e.size();n++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());Cc.copy(e,n,i,0,1),r[n]=this.createPoint(i)}return this.createMultiPoint(r)}}},Hc.prototype.interfaces_=function(){return[Fu]},Hc.prototype.getClass=function(){return Hc},Hc.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Hc.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},Hc.getDefaultCoordinateSequenceFactory=function(){return Vc.instance()},Hc.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Hc.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Hc.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Hc.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Hc.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Hc.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},Hc.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},Jc.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(Hc,Jc);var Kc=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],$c=function(t){this.geometryFactory=t||new Hc};$c.prototype.read=function(t){var e,r=(e="string"==typeof t?JSON.parse(t):t).type;if(!Qc[r])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Kc.indexOf(r)?Qc[r].apply(this,[e.coordinates]):"GeometryCollection"===r?Qc[r].apply(this,[e.geometries]):Qc[r].apply(this,[e])},$c.prototype.write=function(t){var e=t.getGeometryType();if(!th[e])throw new Error("Geometry is not supported");return th[e].apply(this,[t])};var Qc={Feature:function(t){var e={};for(var r in t)e[r]=t[r];if(t.geometry){var n=t.geometry.type;if(!Qc[n])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Qc.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var r=0;r<t.features.length;++r)e.features.push(this.read(t.features[r]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(new Bu(n[0],n[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new Bu(t[0],t[1]),new Bu(t[2],t[1]),new Bu(t[2],t[3]),new Bu(t[0],t[3]),new Bu(t[0],t[1])])},Point:function(t){var e=new Bu(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],r=0;r<t.length;++r)e.push(Qc.Point.apply(this,[t[r]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=Qc.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],r=0;r<t.length;++r)e.push(Qc.LineString.apply(this,[t[r]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=Qc.coordinates.apply(this,[t[0]]),r=this.geometryFactory.createLinearRing(e),n=[],i=1;i<t.length;++i){var o=t[i],a=Qc.coordinates.apply(this,[o]),s=this.geometryFactory.createLinearRing(a);n.push(s)}return this.geometryFactory.createPolygon(r,n)},MultiPolygon:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(Qc.Polygon.apply(this,[n]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],r=0;r<t.length;++r){var n=t[r];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},th={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:th.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=th.Point.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],r=t.getCoordinates(),n=0;n<r.length;++n){var i=r[n];e.push(th.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=th.LineString.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],r=th.LineString.apply(this,[t._shell]);e.push(r.coordinates);for(var n=0;n<t._holes.length;++n){var i=t._holes[n],o=th.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=th.Polygon.apply(this,[n]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],r=0;r<t._geometries.length;++r){var n=t._geometries[r],i=n.getGeometryType();e.push(th[i].apply(this,[n]))}return{type:"GeometryCollection",geometries:e}}},eh=function(t){this.geometryFactory=t||new Hc,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new $c(this.geometryFactory)};eh.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===Xc.FIXED&&this.reducePrecision(e),e},eh.prototype.reducePrecision=function(t){var e,r;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,r=t.points.length;e<r;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,r=t.geometries.length;e<r;e++)this.reducePrecision(t.geometries[e])};var rh=function(){this.parser=new $c(this.geometryFactory)};rh.prototype.write=function(t){return this.parser.write(t)};var nh=function(){},ih={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function oh(t){this.message=t||""}function ah(){this.array_=[]}nh.prototype.interfaces_=function(){return[]},nh.prototype.getClass=function(){return nh},nh.opposite=function(t){return t===nh.LEFT?nh.RIGHT:t===nh.RIGHT?nh.LEFT:t},ih.ON.get=function(){return 0},ih.LEFT.get=function(){return 1},ih.RIGHT.get=function(){return 2},Object.defineProperties(nh,ih),oh.prototype=new Error,oh.prototype.name="EmptyStackException",ah.prototype=new Fl,ah.prototype.add=function(t){return this.array_.push(t),!0},ah.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},ah.prototype.push=function(t){return this.array_.push(t),t},ah.prototype.pop=function(t){if(0===this.array_.length)throw new oh;return this.array_.pop()},ah.prototype.peek=function(){if(0===this.array_.length)throw new oh;return this.array_[this.array_.length-1]},ah.prototype.empty=function(){return 0===this.array_.length},ah.prototype.isEmpty=function(){return this.empty()},ah.prototype.search=function(t){return this.array_.indexOf(t)},ah.prototype.size=function(){return this.array_.length},ah.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e<r;e++)t.push(this.array_[e]);return t};var sh=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};sh.prototype.getCoordinate=function(){return this._minCoord},sh.prototype.getRightmostSide=function(t,e){var r=this.getRightmostSideOfSegment(t,e);return r<0&&(r=this.getRightmostSideOfSegment(t,e-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),r},sh.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();yl.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],r=t[this._minIndex+1],n=wl.computeOrientation(this._minCoord,r,e),i=!1;(e.y<this._minCoord.y&&r.y<this._minCoord.y&&n===wl.COUNTERCLOCKWISE||e.y>this._minCoord.y&&r.y>this._minCoord.y&&n===wl.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},sh.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=nh.LEFT;return r[e].y<r[e+1].y&&(n=nh.RIGHT),n},sh.prototype.getEdge=function(){return this._orientedDe},sh.prototype.checkForRightmostCoordinate=function(t){for(var e=this,r=t.getEdge().getCoordinates(),n=0;n<r.length-1;n++)(null===e._minCoord||r[n].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},sh.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},sh.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}yl.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===nh.LEFT&&(this._orientedDe=this._minDe.getSym())},sh.prototype.interfaces_=function(){return[]},sh.prototype.getClass=function(){return sh};var uh=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new Bu(n):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(dl),lh=function(){this.array_=[]};lh.prototype.addLast=function(t){this.array_.push(t)},lh.prototype.removeFirst=function(){return this.array_.shift()},lh.prototype.isEmpty=function(){return 0===this.array_.length};var ch=function(){this._finder=null,this._dirEdgeList=new Ul,this._nodes=new Ul,this._rightMostCoord=null,this._env=null,this._finder=new sh};ch.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},ch.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},ch.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new uh("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},ch.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(nh.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},ch.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},ch.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(nh.RIGHT)>=1&&e.getDepth(nh.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},ch.prototype.computeDepths=function(t){var e=new Kl,r=new lh,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var a=o.next().getSym();if(!a.isVisited()){var s=a.getNode();e.contains(s)||(r.addLast(s),e.add(s))}}}},ch.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},ch.prototype.getEnvelope=function(){if(null===this._env){for(var t=new sl,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;n<r.length-1;n++)t.expandToInclude(r[n]);this._env=t}return this._env},ch.prototype.addReachable=function(t){var e=new ah;for(e.add(t);!e.empty();){var r=e.pop();this.add(r,e)}},ch.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(nh.LEFT,t.getDepth(nh.RIGHT)),e.setDepth(nh.RIGHT,t.getDepth(nh.LEFT))},ch.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var r=t.getEdges().iterator();r.hasNext();){var n=r.next();this._dirEdgeList.add(n);var i=n.getSym().getNode();i.isVisited()||e.push(i)}},ch.prototype.getNodes=function(){return this._nodes},ch.prototype.getDirectedEdges=function(){return this._dirEdgeList},ch.prototype.interfaces_=function(){return[Ru]},ch.prototype.getClass=function(){return ch};var hh=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[nh.ON]=r}else if(arguments[0]instanceof t){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var o=arguments[0],a=arguments[1],s=arguments[2];this.init(3),this.location[nh.ON]=o,this.location[nh.LEFT]=a,this.location[nh.RIGHT]=s}};hh.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},hh.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==qu.NONE)return!1;return!0},hh.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===qu.NONE&&(this.location[e]=t)},hh.prototype.isLine=function(){return 1===this.location.length},hh.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[nh.ON]=this.location[nh.ON],e[nh.LEFT]=qu.NONE,e[nh.RIGHT]=qu.NONE,this.location=e}for(var r=0;r<this.location.length;r++)this.location[r]===qu.NONE&&r<t.location.length&&(this.location[r]=t.location[r])},hh.prototype.getLocations=function(){return this.location},hh.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[nh.LEFT];this.location[nh.LEFT]=this.location[nh.RIGHT],this.location[nh.RIGHT]=t},hh.prototype.toString=function(){var t=new Wu;return this.location.length>1&&t.append(qu.toLocationSymbol(this.location[nh.LEFT])),t.append(qu.toLocationSymbol(this.location[nh.ON])),this.location.length>1&&t.append(qu.toLocationSymbol(this.location[nh.RIGHT])),t.toString()},hh.prototype.setLocations=function(t,e,r){this.location[nh.ON]=t,this.location[nh.LEFT]=e,this.location[nh.RIGHT]=r},hh.prototype.get=function(t){return t<this.location.length?this.location[t]:qu.NONE},hh.prototype.isArea=function(){return this.location.length>1},hh.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===qu.NONE)return!0;return!1},hh.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(nh.ON,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.location[e]=r}},hh.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(qu.NONE)},hh.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},hh.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},hh.prototype.interfaces_=function(){return[]},hh.prototype.getClass=function(){return hh};var ph=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new hh(e),this.elt[1]=new hh(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.elt[0]=new hh(r.elt[0]),this.elt[1]=new hh(r.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new hh(qu.NONE),this.elt[1]=new hh(qu.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var o=arguments[0],a=arguments[1],s=arguments[2];this.elt[0]=new hh(o,a,s),this.elt[1]=new hh(o,a,s)}else if(4===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2],h=arguments[3];this.elt[0]=new hh(qu.NONE,qu.NONE,qu.NONE),this.elt[1]=new hh(qu.NONE,qu.NONE,qu.NONE),this.elt[u].setLocations(l,c,h)}};ph.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},ph.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},ph.prototype.isNull=function(t){return this.elt[t].isNull()},ph.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.elt[e].setAllLocationsIfNull(r)}},ph.prototype.isLine=function(t){return this.elt[t].isLine()},ph.prototype.merge=function(t){for(var e=this,r=0;r<2;r++)null===e.elt[r]&&null!==t.elt[r]?e.elt[r]=new hh(t.elt[r]):e.elt[r].merge(t.elt[r])},ph.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},ph.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(nh.ON)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return this.elt[e].get(r)}},ph.prototype.toString=function(){var t=new Wu;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},ph.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},ph.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},ph.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(nh.ON,e)}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this.elt[r].setLocation(n,i)}},ph.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},ph.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},ph.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new hh(this.elt[t].location[0]))},ph.prototype.interfaces_=function(){return[]},ph.prototype.getClass=function(){return ph},ph.toLineLabel=function(t){for(var e=new ph(qu.NONE),r=0;r<2;r++)e.setLocation(r,t.getLocation(r));return e};var fh=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new Ul,this._pts=new Ul,this._label=new ph(qu.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Ul,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};fh.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=wl.isCCW(this._ring.getCoordinates())},fh.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},fh.prototype.computePoints=function(t){var e=this;this._startDe=t;var r=t,n=!0;do{if(null===r)throw new uh("Found null DirectedEdge");if(r.getEdgeRing()===e)throw new uh("Directed Edge visited twice during ring-building at "+r.getCoordinate());e._edges.add(r);var i=r.getLabel();yl.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(r.getEdge(),r.isForward(),n),n=!1,e.setEdgeRing(r,e),r=e.getNext(r)}while(r!==this._startDe)},fh.prototype.getLinearRing=function(){return this._ring},fh.prototype.getCoordinate=function(t){return this._pts.get(t)},fh.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var r=e.getNode().getEdges().getOutgoingDegree(t);r>t._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},fh.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o<n.length;o++)this._pts.add(n[o])}else{var a=n.length-2;r&&(a=n.length-1);for(var s=a;s>=0;s--)this._pts.add(n[s])}},fh.prototype.isHole=function(){return this._isHole},fh.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},fh.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!wl.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();)if(r.next().containsPoint(t))return!1;return!0},fh.prototype.addHole=function(t){this._holes.add(t)},fh.prototype.isShell=function(){return null===this._shell},fh.prototype.getLabel=function(){return this._label},fh.prototype.getEdges=function(){return this._edges},fh.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},fh.prototype.getShell=function(){return this._shell},fh.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],r=arguments[0].getLocation(e,nh.RIGHT);if(r===qu.NONE)return null;if(this._label.getLocation(e)===qu.NONE)return this._label.setLocation(e,r),null}},fh.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},fh.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)e[r]=this._holes.get(r).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},fh.prototype.interfaces_=function(){return[]},fh.prototype.getClass=function(){return fh};var dh=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fh),gh=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new Ul,e=this._startDe;do{if(null===e.getMinEdgeRing()){var r=new dh(e,this._geometryFactory);t.add(r)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fh),yh=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};yh.prototype.setVisited=function(t){this._isVisited=t},yh.prototype.setInResult=function(t){this._isInResult=t},yh.prototype.isCovered=function(){return this._isCovered},yh.prototype.isCoveredSet=function(){return this._isCoveredSet},yh.prototype.setLabel=function(t){this._label=t},yh.prototype.getLabel=function(){return this._label},yh.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},yh.prototype.updateIM=function(t){yl.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},yh.prototype.isInResult=function(){return this._isInResult},yh.prototype.isVisited=function(){return this._isVisited},yh.prototype.interfaces_=function(){return[]},yh.prototype.getClass=function(){return yh};var mh=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new ph(0,qu.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var r=qu.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==qu.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new ph(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof ph)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===qu.NONE&&t._label.setLocation(i,o)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=qu.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;if(e===qu.BOUNDARY)r=qu.INTERIOR;else r=qu.BOUNDARY;this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(yh),vh=function(){this.nodeMap=new ic,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};vh.prototype.find=function(t){return this.nodeMap.get(t)},vh.prototype.addNode=function(){if(arguments[0]instanceof Bu){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof mh){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},vh.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},vh.prototype.iterator=function(){return this.nodeMap.values().iterator()},vh.prototype.values=function(){return this.nodeMap.values()},vh.prototype.getBoundaryNodes=function(t){for(var e=new Ul,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===qu.BOUNDARY&&e.add(n)}return e},vh.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},vh.prototype.interfaces_=function(){return[]},vh.prototype.getClass=function(){return vh};var _h=function(){},xh={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};_h.prototype.interfaces_=function(){return[]},_h.prototype.getClass=function(){return _h},_h.isNorthern=function(t){return t===_h.NE||t===_h.NW},_h.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},_h.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var r=t<e?t:e;return 0===r&&3===(t>e?t:e)?3:r},_h.isInHalfPlane=function(t,e){return e===_h.SE?t===_h.SE||t===_h.SW:t===e||t===e+1},_h.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new ku("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?_h.NE:_h.SE:e>=0?_h.NW:_h.SW}if(arguments[0]instanceof Bu&&arguments[1]instanceof Bu){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new ku("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?_h.NE:_h.SE:n.y>=r.y?_h.NW:_h.SW}},xh.NE.get=function(){return 0},xh.NW.get=function(){return 1},xh.SW.get=function(){return 2},xh.SE.get=function(){return 3},Object.defineProperties(_h,xh);var bh=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2],s=arguments[3];this._edge=i,this.init(o,a),this._label=s}};bh.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:wl.computeOrientation(t._p0,t._p1,this._p1)},bh.prototype.getDy=function(){return this._dy},bh.prototype.getCoordinate=function(){return this._p0},bh.prototype.setNode=function(t){this._node=t},bh.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),n=r.lastIndexOf("."),i=r.substring(n+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},bh.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},bh.prototype.getDirectedCoordinate=function(){return this._p1},bh.prototype.getDx=function(){return this._dx},bh.prototype.getLabel=function(){return this._label},bh.prototype.getEdge=function(){return this._edge},bh.prototype.getQuadrant=function(){return this._quadrant},bh.prototype.getNode=function(){return this._node},bh.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),r=e.lastIndexOf(".");return" "+e.substring(r+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},bh.prototype.computeLabel=function(t){},bh.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=_h.quadrant(this._dx,this._dy),yl.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},bh.prototype.interfaces_=function(){return[Ru]},bh.prototype.getClass=function(){return bh};var wh=function(t){function e(){var e=arguments[0],r=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=r,r)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var n=e.getNumPoints()-1;this.init(e.getCoordinate(n),e.getCoordinate(n-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new ph(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new uh("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,r=0;r<2;r++)t._label.isArea(r)&&t._label.getLocation(r,nh.LEFT)===qu.INTERIOR&&t._label.getLocation(r,nh.RIGHT)===qu.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[nh.LEFT]+"/"+this._depth[nh.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,qu.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,qu.EXTERIOR);return t&&e&&r},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var n=1;t===nh.LEFT&&(n=-1);var i=nh.opposite(t),o=e+r*n;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===qu.EXTERIOR&&e===qu.INTERIOR?1:t===qu.INTERIOR&&e===qu.EXTERIOR?-1:0},e}(bh),Eh=function(){};Eh.prototype.createNode=function(t){return new mh(t,null)},Eh.prototype.interfaces_=function(){return[]},Eh.prototype.getClass=function(){return Eh};var Ih=function(){if(this._edges=new Ul,this._nodes=null,this._edgeEndList=new Ul,0===arguments.length)this._nodes=new vh(new Eh);else if(1===arguments.length){var t=arguments[0];this._nodes=new vh(t)}};Ih.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var r=this._edges.get(e);r.print(t),r.eiList.print(t)}},Ih.prototype.find=function(t){return this._nodes.find(t)},Ih.prototype.addNode=function(){if(arguments[0]instanceof mh){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof Bu){var e=arguments[0];return this._nodes.addNode(e)}},Ih.prototype.getNodeIterator=function(){return this._nodes.iterator()},Ih.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},Ih.prototype.debugPrintln=function(t){ol.out.println(t)},Ih.prototype.isBoundaryNode=function(t,e){var r=this._nodes.find(e);if(null===r)return!1;var n=r.getLabel();return null!==n&&n.getLocation(t)===qu.BOUNDARY},Ih.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},Ih.prototype.matchInSameDirection=function(t,e,r,n){return!!t.equals(r)&&wl.computeOrientation(t,e,n)===wl.COLLINEAR&&_h.quadrant(t,e)===_h.quadrant(r,n)},Ih.prototype.getEdgeEnds=function(){return this._edgeEndList},Ih.prototype.debugPrint=function(t){ol.out.print(t)},Ih.prototype.getEdgeIterator=function(){return this._edges.iterator()},Ih.prototype.findEdgeInSameDirection=function(t,e){for(var r=this,n=0;n<this._edges.size();n++){var i=r._edges.get(n),o=i.getCoordinates();if(r.matchInSameDirection(t,e,o[0],o[1]))return i;if(r.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},Ih.prototype.insertEdge=function(t){this._edges.add(t)},Ih.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var r=e.next();if(r.getEdge()===t)return r}return null},Ih.prototype.addEdges=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next();e._edges.add(n);var i=new wh(n,!0),o=new wh(n,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},Ih.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},Ih.prototype.getNodes=function(){return this._nodes.values()},Ih.prototype.findEdge=function(t,e){for(var r=0;r<this._edges.size();r++){var n=this._edges.get(r),i=n.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return n}return null},Ih.prototype.interfaces_=function(){return[]},Ih.prototype.getClass=function(){return Ih},Ih.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var Sh=function(){this._geometryFactory=null,this._shellList=new Ul;var t=arguments[0];this._geometryFactory=t};Sh.prototype.sortShellsAndHoles=function(t,e,r){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()?r.add(i):e.add(i)}},Sh.prototype.computePolygons=function(t){for(var e=new Ul,r=t.iterator();r.hasNext();){var n=r.next().toPolygon(this._geometryFactory);e.add(n)}return e},Sh.prototype.placeFreeHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(null===n.getShell()){var i=this.findEdgeRingContaining(n,t);if(null===i)throw new uh("unable to assign hole to a shell",n.getCoordinate(0));n.setShell(i)}}},Sh.prototype.buildMinimalEdgeRings=function(t,e,r){for(var n=new Ul,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var a=o.buildMinimalRings(),s=this.findShell(a);null!==s?(this.placePolygonHoles(s,a),e.add(s)):r.addAll(a)}else n.add(o)}return n},Sh.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},Sh.prototype.buildMaximalEdgeRings=function(t){for(var e=new Ul,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new gh(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},Sh.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},Sh.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Sh.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,a=null,s=e.iterator();s.hasNext();){var u=s.next(),l=u.getLinearRing(),c=l.getEnvelopeInternal();null!==o&&(a=o.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(n)&&wl.isPointInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||a.contains(c))&&(o=u)}return o},Sh.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return yl.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},Sh.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0];Ih.linkResultDirectedEdges(arguments[1]);var r=this.buildMaximalEdgeRings(e),n=new Ul,i=this.buildMinimalEdgeRings(r,this._shellList,n);this.sortShellsAndHoles(i,this._shellList,n),this.placeFreeHoles(this._shellList,n)}},Sh.prototype.interfaces_=function(){return[]},Sh.prototype.getClass=function(){return Sh};var Ch=function(){};Ch.prototype.getBounds=function(){},Ch.prototype.interfaces_=function(){return[]},Ch.prototype.getClass=function(){return Ch};var Ph=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Ph.prototype.getItem=function(){return this._item},Ph.prototype.getBounds=function(){return this._bounds},Ph.prototype.interfaces_=function(){return[Ch,Fu]},Ph.prototype.getClass=function(){return Ph};var Mh=function(){this._size=null,this._items=null,this._size=0,this._items=new Ul,this._items.add(null)};Mh.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},Mh.prototype.size=function(){return this._size},Mh.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},Mh.prototype.clear=function(){this._size=0,this._items.clear()},Mh.prototype.isEmpty=function(){return 0===this._size},Mh.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},Mh.prototype.interfaces_=function(){return[]},Mh.prototype.getClass=function(){return Mh};var Th=function(){};Th.prototype.visitItem=function(t){},Th.prototype.interfaces_=function(){return[]},Th.prototype.getClass=function(){return Th};var Lh=function(){};Lh.prototype.insert=function(t,e){},Lh.prototype.remove=function(t,e){},Lh.prototype.query=function(){},Lh.prototype.interfaces_=function(){return[]},Lh.prototype.getClass=function(){return Lh};var Ah=function(){if(this._childBoundables=new Ul,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},kh={serialVersionUID:{configurable:!0}};Ah.prototype.getLevel=function(){return this._level},Ah.prototype.size=function(){return this._childBoundables.size()},Ah.prototype.getChildBoundables=function(){return this._childBoundables},Ah.prototype.addChildBoundable=function(t){yl.isTrue(null===this._bounds),this._childBoundables.add(t)},Ah.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ah.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Ah.prototype.interfaces_=function(){return[Ch,Fu]},Ah.prototype.getClass=function(){return Ah},kh.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Ah,kh);var Nh=function(){};Nh.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Nh.min=function(t){return Nh.sort(t),t.get(0)},Nh.sort=function(t,e){var r=t.toArray();e?lc.sort(r,e):lc.sort(r);for(var n=t.iterator(),i=0,o=r.length;i<o;i++)n.next(),n.set(r[i])},Nh.singletonList=function(t){var e=new Ul;return e.add(t),e};var Dh=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],r=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=r,this._distance=this.distance()};Dh.prototype.expandToQueue=function(t,e){var r=Dh.isComposite(this._boundable1),n=Dh.isComposite(this._boundable2);if(r&&n)return Dh.area(this._boundable1)>Dh.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new ku("neither boundable is composite")},Dh.prototype.isLeaves=function(){return!(Dh.isComposite(this._boundable1)||Dh.isComposite(this._boundable2))},Dh.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},Dh.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),a=new Dh(o,e,this._itemDistance);a.getDistance()<n&&r.add(a)}},Dh.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},Dh.prototype.getDistance=function(){return this._distance},Dh.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Dh.prototype.interfaces_=function(){return[Ru]},Dh.prototype.getClass=function(){return Dh},Dh.area=function(t){return t.getBounds().getArea()},Dh.isComposite=function(t){return t instanceof Ah};var Rh=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new Ul,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var r=arguments[0];yl.isTrue(r>1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},Oh={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Rh.prototype.getNodeCapacity=function(){return this._nodeCapacity},Rh.prototype.lastNode=function(t){return t.get(t.size()-1)},Rh.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();r instanceof Ah?t+=this.size(r):r instanceof Ph&&(t+=1)}return t}},Rh.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof Ph&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},Rh.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new Ul:t}if(1===arguments.length){for(var e=arguments[0],r=new Ul,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof Ah){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof Ph?r.add(i.getItem()):yl.shouldNeverReachHere()}return r.size()<=0?null:r}},Rh.prototype.insert=function(t,e){yl.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ph(t,e))},Rh.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new Ul;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(yl.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var a=o.next();a instanceof Ah?this.boundablesAtLevel(r,a,i):(yl.isTrue(a instanceof Ph),-1===r&&i.add(a))}return null}},Rh.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new Ul;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(Xu(arguments[2],Th)&&arguments[0]instanceof Object&&arguments[1]instanceof Ah)for(var o=arguments[0],a=arguments[2],s=arguments[1].getChildBoundables(),u=0;u<s.size();u++){var l=s.get(u);t.getIntersectsOp().intersects(l.getBounds(),o)&&(l instanceof Ah?t.query(o,l,a):l instanceof Ph?a.visitItem(l.getItem()):yl.shouldNeverReachHere())}else if(Xu(arguments[2],Fl)&&arguments[0]instanceof Object&&arguments[1]instanceof Ah)for(var c=arguments[0],h=arguments[2],p=arguments[1].getChildBoundables(),f=0;f<p.size();f++){var d=p.get(f);t.getIntersectsOp().intersects(d.getBounds(),c)&&(d instanceof Ah?t.query(c,d,h):d instanceof Ph?h.add(d.getItem()):yl.shouldNeverReachHere())}},Rh.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},Rh.prototype.getRoot=function(){return this.build(),this._root},Rh.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=this.removeItem(n,i);if(o)return!0;for(var a=null,s=n.getChildBoundables().iterator();s.hasNext();){var u=s.next();if(this.getIntersectsOp().intersects(u.getBounds(),r)&&u instanceof Ah&&(o=this.remove(r,u,i))){a=u;break}}return null!==a&&a.getChildBoundables().isEmpty()&&n.getChildBoundables().remove(a),o}},Rh.prototype.createHigherLevels=function(t,e){yl.isTrue(!t.isEmpty());var r=this.createParentBoundables(t,e+1);return 1===r.size()?r.get(0):this.createHigherLevels(r,e+1)},Rh.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();if(r instanceof Ah){var n=this.depth(r);n>t&&(t=n)}}return t+1}},Rh.prototype.createParentBoundables=function(t,e){var r=this;yl.isTrue(!t.isEmpty());var n=new Ul;n.add(this.createNode(e));var i=new Ul(t);Nh.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var a=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(a)}return n},Rh.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Rh.prototype.interfaces_=function(){return[Fu]},Rh.prototype.getClass=function(){return Rh},Rh.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},Oh.IntersectsOp.get=function(){return zh},Oh.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},Oh.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Rh,Oh);var zh=function(){},Fh=function(){};Fh.prototype.distance=function(t,e){},Fh.prototype.interfaces_=function(){return[]},Fh.prototype.getClass=function(){return Fh};var Bh=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){yl.isTrue(t.length>0);for(var r=new Ul,n=0;n<t.length;n++)r.addAll(this.createParentBoundablesFromVerticalSlice(t[n],e));return r},e.prototype.createNode=function(t){return new Uh(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],r=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,r)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var r=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){n[o]=new Ul;for(var a=0;i.hasNext()&&a<r;){var s=i.next();n[o].add(s),a++}}return n},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var r=arguments[0],n=arguments[1];t.prototype.query.call(this,r,n)}else if(3===arguments.length)if(Xu(arguments[2],Th)&&arguments[0]instanceof Object&&arguments[1]instanceof Ah){var i=arguments[0],o=arguments[1],a=arguments[2];t.prototype.query.call(this,i,o,a)}else if(Xu(arguments[2],Fl)&&arguments[0]instanceof Object&&arguments[1]instanceof Ah){var s=arguments[0],u=arguments[1],l=arguments[2];t.prototype.query.call(this,s,u,l)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,r){return t.prototype.createParentBoundables.call(this,e,r)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return t.prototype.remove.call(this,e,r)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,r){yl.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new Ul(t);Nh.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(o,r)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(Xu(arguments[0],Fh)){var t=arguments[0],r=new Dh(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(r)}if(arguments[0]instanceof Dh){var n=arguments[0];return this.nearestNeighbour(n,Nu.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&Xu(arguments[1],Fh)){var i=arguments[0],o=arguments[1],a=new Dh(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(a)}if(arguments[0]instanceof Dh&&"number"==typeof arguments[1]){var s=arguments[0],u=arguments[1],l=null,c=new Mh;for(c.add(s);!c.isEmpty()&&u>0;){var h=c.poll(),p=h.getDistance();if(p>=u)break;h.isLeaves()?(u=p,l=h):h.expandToQueue(c,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var f=arguments[2],d=new Ph(arguments[0],arguments[1]),g=new Dh(this.getRoot(),d,f);return this.nearestNeighbour(g)[0]}},e.prototype.interfaces_=function(){return[Lh,Fu]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},r.STRtreeNode.get=function(){return Uh},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[zu]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[zu]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(Rh),Uh=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var r=e.next();null===t?t=new sl(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ah),jh=function(){};jh.prototype.interfaces_=function(){return[]},jh.prototype.getClass=function(){return jh},jh.relativeSign=function(t,e){return t<e?-1:t>e?1:0},jh.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=jh.relativeSign(e.x,r.x),i=jh.relativeSign(e.y,r.y);switch(t){case 0:return jh.compareValue(n,i);case 1:return jh.compareValue(i,n);case 2:return jh.compareValue(i,-n);case 3:return jh.compareValue(-n,i);case 4:return jh.compareValue(-n,-i);case 5:return jh.compareValue(-i,-n);case 6:return jh.compareValue(-i,n);case 7:return jh.compareValue(n,-i)}return yl.shouldNeverReachHere("invalid octant value"),0},jh.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Vh=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new Bu(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};Vh.prototype.getCoordinate=function(){return this.coord},Vh.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},Vh.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:jh.compare(this._segmentOctant,this.coord,e.coord)},Vh.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},Vh.prototype.isInterior=function(){return this._isInterior},Vh.prototype.interfaces_=function(){return[Ru]},Vh.prototype.getClass=function(){return Vh};var qh=function(){this._nodeMap=new ic,this._edge=null;var t=arguments[0];this._edge=t};qh.prototype.getSplitCoordinates=function(){var t=new Vl;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},qh.prototype.addCollapsedNodes=function(){var t=new Ul;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},qh.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},qh.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var r=this._edge.getCoordinate(e),n=this._edge.getCoordinate(e+2);r.equals2D(n)&&t.add(new Hu(e+1))}},qh.prototype.addEdgeCoordinates=function(t,e,r){var n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);r.add(new Bu(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)r.add(this._edge.getCoordinate(o));i&&r.add(new Bu(e.coord))},qh.prototype.iterator=function(){return this._nodeMap.values().iterator()},qh.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},qh.prototype.findCollapseIndex=function(t,e,r){if(!t.coord.equals2D(e.coord))return!1;var n=e.segmentIndex-t.segmentIndex;return e.isInterior()||n--,1===n&&(r[0]=t.segmentIndex+1,!0)},qh.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),r=this.iterator(),n=r.next();r.hasNext();){var i=r.next();this.findCollapseIndex(n,i,e)&&t.add(new Hu(e[0])),n=i}},qh.prototype.getEdge=function(){return this._edge},qh.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},qh.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),a=0;o[a++]=new Bu(t.coord);for(var s=t.segmentIndex+1;s<=e.segmentIndex;s++)o[a++]=this._edge.getCoordinate(s);return i&&(o[a]=new Bu(e.coord)),new Yh(o,this._edge.getData())},qh.prototype.add=function(t,e){var r=new Vh(this._edge,t,e,this._edge.getSegmentOctant(e)),n=this._nodeMap.get(r);return null!==n?(yl.isTrue(n.coord.equals2D(t),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(r,r),r)},qh.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),r=t.get(0).getCoordinate(0);if(!r.equals2D(e[0]))throw new dl("bad split edge start point at "+r);var n=t.get(t.size()-1).getCoordinates(),i=n[n.length-1];if(!i.equals2D(e[e.length-1]))throw new dl("bad split edge end point at "+i)},qh.prototype.interfaces_=function(){return[]},qh.prototype.getClass=function(){return qh};var Gh=function(){};Gh.prototype.interfaces_=function(){return[]},Gh.prototype.getClass=function(){return Gh},Gh.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new ku("Cannot compute the octant for point ( "+t+", "+e+" )");var r=Math.abs(t),n=Math.abs(e);return t>=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof Bu&&arguments[1]instanceof Bu){var i=arguments[0],o=arguments[1],a=o.x-i.x,s=o.y-i.y;if(0===a&&0===s)throw new ku("Cannot compute the octant for two identical points "+i);return Gh.octant(a,s)}};var Xh=function(){};Xh.prototype.getCoordinates=function(){},Xh.prototype.size=function(){},Xh.prototype.getCoordinate=function(t){},Xh.prototype.isClosed=function(){},Xh.prototype.setData=function(t){},Xh.prototype.getData=function(){},Xh.prototype.interfaces_=function(){return[]},Xh.prototype.getClass=function(){return Xh};var Zh=function(){};Zh.prototype.addIntersection=function(t,e){},Zh.prototype.interfaces_=function(){return[Xh]},Zh.prototype.getClass=function(){return Zh};var Yh=function(){this._nodeList=new qh(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Yh.prototype.getCoordinates=function(){return this._pts},Yh.prototype.size=function(){return this._pts.length},Yh.prototype.getCoordinate=function(t){return this._pts[t]},Yh.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Yh.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Yh.prototype.setData=function(t){this._data=t},Yh.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Gh.octant(t,e)},Yh.prototype.getData=function(){return this._data},Yh.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new Bu(arguments[0].getIntersection(n));this.addIntersection(i,r)}},Yh.prototype.toString=function(){return fl.toLineString(new Uc(this._pts))},Yh.prototype.getNodeList=function(){return this._nodeList},Yh.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n<this._pts.length){var i=this._pts[n];t.equals2D(i)&&(r=n)}return this._nodeList.add(t,r)},Yh.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},Yh.prototype.interfaces_=function(){return[Zh]},Yh.prototype.getClass=function(){return Yh},Yh.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new Ul;return Yh.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){n.next().getNodeList().addSplitEdges(r)}};var Wh=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new Bu,this.p1=new Bu;else if(1===arguments.length){var t=arguments[0];this.p0=new Bu(t.p0),this.p1=new Bu(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=arguments[3];this.p0=new Bu(e,r),this.p1=new Bu(n,i)}},Hh={serialVersionUID:{configurable:!0}};Wh.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Wh.prototype.orientationIndex=function(){if(arguments[0]instanceof Wh){var t=arguments[0],e=wl.orientationIndex(this.p0,this.p1,t.p0),r=wl.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof Bu){var n=arguments[0];return wl.orientationIndex(this.p0,this.p1,n)}},Wh.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},Wh.prototype.isVertical=function(){return this.p0.x===this.p1.x},Wh.prototype.equals=function(t){if(!(t instanceof Wh))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},Wh.prototype.intersection=function(t){var e=new _l;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},Wh.prototype.project=function(){if(arguments[0]instanceof Bu){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Bu(t);var e=this.projectionFactor(t),r=new Bu;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof Wh){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var a=this.project(n.p0);i<0&&(a=this.p0),i>1&&(a=this.p1);var s=this.project(n.p1);return o<0&&(s=this.p0),o>1&&(s=this.p1),new Wh(a,s)}},Wh.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Wh.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Wh.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},Wh.prototype.distancePerpendicular=function(t){return wl.distancePointLinePerpendicular(t,this.p0,this.p1)},Wh.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Wh.prototype.midPoint=function(){return Wh.midPoint(this.p0,this.p1)},Wh.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?Nu.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},Wh.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=Nu.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var a=this.closestPoint(t.p1);(i=a.distance(t.p1))<n&&(n=i,r[0]=a,r[1]=t.p1);var s=t.closestPoint(this.p0);(i=s.distance(this.p0))<n&&(n=i,r[0]=this.p0,r[1]=s);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<n&&(n=i,r[0]=this.p1,r[1]=u),r},Wh.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},Wh.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Wh.prototype.getLength=function(){return this.p0.distance(this.p1)},Wh.prototype.compareTo=function(t){var e=t,r=this.p0.compareTo(e.p0);return 0!==r?r:this.p1.compareTo(e.p1)},Wh.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},Wh.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},Wh.prototype.lineIntersection=function(t){try{return al.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof il))throw t}return null},Wh.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Wh.prototype.pointAlongOffset=function(t,e){var r=this.p0.x+t*(this.p1.x-this.p0.x),n=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,a=Math.sqrt(i*i+o*o),s=0,u=0;if(0!==e){if(a<=0)throw new Error("Cannot compute offset from zero-length line segment");s=e*i/a,u=e*o/a}return new Bu(r-u,n+s)},Wh.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=r.x,this.p1.y=r.y}},Wh.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||Nu.isNaN(e))&&(e=1),e},Wh.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Wh.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Wh.prototype.distance=function(){if(arguments[0]instanceof Wh){var t=arguments[0];return wl.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof Bu){var e=arguments[0];return wl.distancePointLine(e,this.p0,this.p1)}},Wh.prototype.pointAlong=function(t){var e=new Bu;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},Wh.prototype.hashCode=function(){var t=Nu.doubleToLongBits(this.p0.x);t^=31*Nu.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=Nu.doubleToLongBits(this.p1.x);return r^=31*Nu.doubleToLongBits(this.p1.y),e^Math.trunc(r)^Math.trunc(r>>32)},Wh.prototype.interfaces_=function(){return[Ru,Fu]},Wh.prototype.getClass=function(){return Wh},Wh.midPoint=function(t,e){return new Bu((t.x+e.x)/2,(t.y+e.y)/2)},Hh.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Wh,Hh);var Jh=function(){this.tempEnv1=new sl,this.tempEnv2=new sl,this._overlapSeg1=new Wh,this._overlapSeg2=new Wh};Jh.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},Jh.prototype.interfaces_=function(){return[]},Jh.prototype.getClass=function(){return Jh};var Kh=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};Kh.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},Kh.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var a=Math.trunc((e+r)/2);e<a&&this.computeSelect(t,e,a,n),a<r&&this.computeSelect(t,a,r,n)},Kh.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,r=this._start;r<=this._end;r++)t[e++]=this._pts[r];return t},Kh.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},Kh.prototype.setId=function(t){this._id=t},Kh.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},Kh.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new sl(t,e)}return this._env},Kh.prototype.getEndIndex=function(){return this._end},Kh.prototype.getStartIndex=function(){return this._start},Kh.prototype.getContext=function(){return this._context},Kh.prototype.getId=function(){return this._id},Kh.prototype.computeOverlapsInternal=function(t,e,r,n,i,o){var a=this._pts[t],s=this._pts[e],u=r._pts[n],l=r._pts[i];if(e-t==1&&i-n==1)return o.overlap(this,t,r,n),null;if(o.tempEnv1.init(a,s),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var c=Math.trunc((t+e)/2),h=Math.trunc((n+i)/2);t<c&&(n<h&&this.computeOverlapsInternal(t,c,r,n,h,o),h<i&&this.computeOverlapsInternal(t,c,r,h,i,o)),c<e&&(n<h&&this.computeOverlapsInternal(c,e,r,n,h,o),h<i&&this.computeOverlapsInternal(c,e,r,h,i,o))},Kh.prototype.interfaces_=function(){return[]},Kh.prototype.getClass=function(){return Kh};var $h=function(){};$h.prototype.interfaces_=function(){return[]},$h.prototype.getClass=function(){return $h},$h.getChainStartIndices=function(t){var e=0,r=new Ul;r.add(new Hu(e));do{var n=$h.findChainEnd(t,e);r.add(new Hu(n)),e=n}while(e<t.length-1);return $h.toIntArray(r)},$h.findChainEnd=function(t,e){for(var r=e;r<t.length-1&&t[r].equals2D(t[r+1]);)r++;if(r>=t.length-1)return t.length-1;for(var n=_h.quadrant(t[r],t[r+1]),i=e+1;i<t.length&&(t[i-1].equals2D(t[i])||_h.quadrant(t[i-1],t[i])===n);)i++;return i-1},$h.getChains=function(){if(1===arguments.length){return $h.getChains(arguments[0],null)}if(2===arguments.length){for(var t=arguments[0],e=arguments[1],r=new Ul,n=$h.getChainStartIndices(t),i=0;i<n.length-1;i++){var o=new Kh(t,n[i],n[i+1],e);r.add(o)}return r}},$h.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var Qh=function(){};Qh.prototype.computeNodes=function(t){},Qh.prototype.getNodedSubstrings=function(){},Qh.prototype.interfaces_=function(){return[]},Qh.prototype.getClass=function(){return Qh};var tp=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};tp.prototype.setSegmentIntersector=function(t){this._segInt=t},tp.prototype.interfaces_=function(){return[Qh]},tp.prototype.getClass=function(){return tp};var ep=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new Ul,this._index=new Bh,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return Yh.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,r=$h.getChains(t.getCoordinates(),t).iterator();r.hasNext();){var n=r.next();n.setId(e._idCounter++),e._index.insert(n.getEnvelope(),n),e._monoChains.add(n)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=this,e=new rp(this._segInt),r=this._monoChains.iterator();r.hasNext();)for(var n=r.next(),i=t._index.query(n.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>n.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return rp},Object.defineProperties(e,r),e}(tp),rp=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Jh),np=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2],s=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(a),this.setMitreLimit(s)}},ip={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};np.prototype.getEndCapStyle=function(){return this._endCapStyle},np.prototype.isSingleSided=function(){return this._isSingleSided},np.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=np.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=np.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==np.JOIN_ROUND&&(this._quadrantSegments=np.DEFAULT_QUADRANT_SEGMENTS)},np.prototype.getJoinStyle=function(){return this._joinStyle},np.prototype.setJoinStyle=function(t){this._joinStyle=t},np.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},np.prototype.getSimplifyFactor=function(){return this._simplifyFactor},np.prototype.getQuadrantSegments=function(){return this._quadrantSegments},np.prototype.setEndCapStyle=function(t){this._endCapStyle=t},np.prototype.getMitreLimit=function(){return this._mitreLimit},np.prototype.setMitreLimit=function(t){this._mitreLimit=t},np.prototype.setSingleSided=function(t){this._isSingleSided=t},np.prototype.interfaces_=function(){return[]},np.prototype.getClass=function(){return np},np.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},ip.CAP_ROUND.get=function(){return 1},ip.CAP_FLAT.get=function(){return 2},ip.CAP_SQUARE.get=function(){return 3},ip.JOIN_ROUND.get=function(){return 1},ip.JOIN_MITRE.get=function(){return 2},ip.JOIN_BEVEL.get=function(){return 3},ip.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},ip.DEFAULT_MITRE_LIMIT.get=function(){return 5},ip.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(np,ip);var op=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=wl.COUNTERCLOCKWISE,this._inputLine=t||null},ap={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};op.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],a=this._inputLine[r];return!!this.isConcave(i,o,a)&&!!this.isShallow(i,o,a,n)&&this.isShallowSampled(i,o,t,r,n)},op.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n<this._inputLine.length;){var o=!1;t.isDeletable(e,r,n,t._distanceTol)&&(t._isDeleted[r]=op.DELETE,o=!0,i=!0),e=o?n:r,r=t.findNextNonDeletedIndex(e),n=t.findNextNonDeletedIndex(r)}return i},op.prototype.isShallowConcavity=function(t,e,r,n){return wl.computeOrientation(t,e,r)===this._angleOrientation&&wl.distancePointLine(e,t,r)<n},op.prototype.isShallowSampled=function(t,e,r,n,i){var o=Math.trunc((n-r)/op.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var a=r;a<n;a+=o)if(!this.isShallow(t,e,this._inputLine[a],i))return!1;return!0},op.prototype.isConcave=function(t,e,r){return wl.computeOrientation(t,e,r)===this._angleOrientation},op.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=wl.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},op.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===op.DELETE;)e++;return e},op.prototype.isShallow=function(t,e,r,n){return wl.distancePointLine(e,t,r)<n},op.prototype.collapseLine=function(){for(var t=new Vl,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==op.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},op.prototype.interfaces_=function(){return[]},op.prototype.getClass=function(){return op},op.simplify=function(t,e){return new op(t).simplify(e)},ap.INIT.get=function(){return 0},ap.DELETE.get=function(){return 1},ap.KEEP.get=function(){return 1},ap.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(op,ap);var sp=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Ul},up={COORDINATE_ARRAY_TYPE:{configurable:!0}};sp.prototype.getCoordinates=function(){return this._ptList.toArray(sp.COORDINATE_ARRAY_TYPE)},sp.prototype.setPrecisionModel=function(t){this._precisionModel=t},sp.prototype.addPt=function(t){var e=new Bu(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},sp.prototype.revere=function(){},sp.prototype.addPts=function(t,e){if(e)for(var r=0;r<t.length;r++)this.addPt(t[r]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},sp.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},sp.prototype.toString=function(){return(new Hc).createLineString(this.getCoordinates()).toString()},sp.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new Bu(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},sp.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},sp.prototype.interfaces_=function(){return[]},sp.prototype.getClass=function(){return sp},up.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(sp,up);var lp=function(){},cp={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};lp.prototype.interfaces_=function(){return[]},lp.prototype.getClass=function(){return lp},lp.toDegrees=function(t){return 180*t/Math.PI},lp.normalize=function(t){for(;t>Math.PI;)t-=lp.PI_TIMES_2;for(;t<=-Math.PI;)t+=lp.PI_TIMES_2;return t},lp.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},lp.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},lp.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},lp.interiorAngle=function(t,e,r){var n=lp.angle(e,t),i=lp.angle(e,r);return Math.abs(i-n)},lp.normalizePositive=function(t){if(t<0){for(;t<0;)t+=lp.PI_TIMES_2;t>=lp.PI_TIMES_2&&(t=0)}else{for(;t>=lp.PI_TIMES_2;)t-=lp.PI_TIMES_2;t<0&&(t=0)}return t},lp.angleBetween=function(t,e,r){var n=lp.angle(e,t),i=lp.angle(e,r);return lp.diff(n,i)},lp.diff=function(t,e){var r=null;return(r=t<e?e-t:t-e)>Math.PI&&(r=2*Math.PI-r),r},lp.toRadians=function(t){return t*Math.PI/180},lp.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?lp.COUNTERCLOCKWISE:r<0?lp.CLOCKWISE:lp.NONE},lp.angleBetweenOriented=function(t,e,r){var n=lp.angle(e,t),i=lp.angle(e,r)-n;return i<=-Math.PI?i+lp.PI_TIMES_2:i>Math.PI?i-lp.PI_TIMES_2:i},cp.PI_TIMES_2.get=function(){return 2*Math.PI},cp.PI_OVER_2.get=function(){return Math.PI/2},cp.PI_OVER_4.get=function(){return Math.PI/4},cp.COUNTERCLOCKWISE.get=function(){return wl.COUNTERCLOCKWISE},cp.CLOCKWISE.get=function(){return wl.CLOCKWISE},cp.NONE.get=function(){return wl.COLLINEAR},Object.defineProperties(lp,cp);var hp=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Wh,this._seg1=new Wh,this._offset0=new Wh,this._offset1=new Wh,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new _l,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===np.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},pp={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};hp.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=wl.computeOrientation(this._s0,this._s1,this._s2),n=r===wl.CLOCKWISE&&this._side===nh.LEFT||r===wl.COUNTERCLOCKWISE&&this._side===nh.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},hp.prototype.addLineEndCap=function(t,e){var r=new Wh(t,e),n=new Wh;this.computeOffsetSegment(r,nh.LEFT,this._distance,n);var i=new Wh;this.computeOffsetSegment(r,nh.RIGHT,this._distance,i);var o=e.x-t.x,a=e.y-t.y,s=Math.atan2(a,o);switch(this._bufParams.getEndCapStyle()){case np.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,s+Math.PI/2,s-Math.PI/2,wl.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case np.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case np.CAP_SQUARE:var u=new Bu;u.x=Math.abs(this._distance)*Math.cos(s),u.y=Math.abs(this._distance)*Math.sin(s);var l=new Bu(n.p1.x+u.x,n.p1.y+u.y),c=new Bu(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},hp.prototype.getCoordinates=function(){return this._segList.getCoordinates()},hp.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=al.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof il))throw t;o=new Bu(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},hp.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,a=e.y-t.y,s=Math.atan2(a,o),u=r.x-t.x,l=r.y-t.y,c=Math.atan2(l,u);n===wl.CLOCKWISE?s<=c&&(s+=2*Math.PI):s>=c&&(s-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,s,c,n,i),this._segList.addPt(r)},hp.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*hp.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===np.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===np.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},hp.prototype.createSquare=function(t){this._segList.addPt(new Bu(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new Bu(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new Bu(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new Bu(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},hp.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},hp.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},hp.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},hp.prototype.initSideSegments=function(t,e,r){this._s1=t,this._s2=e,this._side=r,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,r,this._distance,this._offset1)},hp.prototype.addLimitedMitreJoin=function(t,e,r,n){var i=this._seg0.p1,o=lp.angle(i,this._seg0.p0),a=lp.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,s=lp.normalize(o+a),u=lp.normalize(s+Math.PI),l=n*r,c=r-l*Math.abs(Math.sin(a)),h=i.x+l*Math.cos(u),p=i.y+l*Math.sin(u),f=new Bu(h,p),d=new Wh(i,f),g=d.pointAlongOffset(1,c),y=d.pointAlongOffset(1,-c);this._side===nh.LEFT?(this._segList.addPt(g),this._segList.addPt(y)):(this._segList.addPt(y),this._segList.addPt(g))},hp.prototype.computeOffsetSegment=function(t,e,r,n){var i=e===nh.LEFT?1:-1,o=t.p1.x-t.p0.x,a=t.p1.y-t.p0.y,s=Math.sqrt(o*o+a*a),u=i*r*o/s,l=i*r*a/s;n.p0.x=t.p0.x-l,n.p0.y=t.p0.y+u,n.p1.x=t.p1.x-l,n.p1.y=t.p1.y+u},hp.prototype.addFilletArc=function(t,e,r,n,i){var o=n===wl.CLOCKWISE?-1:1,a=Math.abs(e-r),s=Math.trunc(a/this._filletAngleQuantum+.5);if(s<1)return null;for(var u=a/s,l=0,c=new Bu;l<a;){var h=e+o*l;c.x=t.x+i*Math.cos(h),c.y=t.y+i*Math.sin(h),this._segList.addPt(c),l+=u}},hp.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*hp.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var r=new Bu((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var n=new Bu((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},hp.prototype.createCircle=function(t){var e=new Bu(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},hp.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},hp.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new sp,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*hp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},hp.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===np.JOIN_BEVEL||this._bufParams.getJoinStyle()===np.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,wl.CLOCKWISE,this._distance))},hp.prototype.closeRing=function(){this._segList.closeRing()},hp.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},hp.prototype.interfaces_=function(){return[]},hp.prototype.getClass=function(){return hp},pp.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},pp.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},pp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},pp.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(hp,pp);var fp=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};fp.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&ql.reverse(o),o},fp.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=op.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],nh.LEFT),r.addFirstSegment();for(var a=o-2;a>=0;a--)r.addNextSegment(i[a],!0)}else{r.addSegments(t,!1);var s=op.simplify(t,n),u=s.length-1;r.initSideSegments(s[0],s[1],nh.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(s[l],!0)}r.addLastSegment(),r.closeRing()},fp.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===nh.RIGHT&&(n=-n);var i=op.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var a=1;a<=o;a++){var s=1!==a;r.addNextSegment(i[a],s)}r.closeRing()},fp.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=op.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],nh.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var a=op.simplify(t,-r),s=a.length-1;e.initSideSegments(a[s],a[s-1],nh.LEFT);for(var u=s-2;u>=0;u--)e.addNextSegment(a[u],!0);e.addLastSegment(),e.addLineEndCap(a[1],a[0]),e.closeRing()},fp.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case np.CAP_ROUND:e.createCircle(t);break;case np.CAP_SQUARE:e.createSquare(t)}},fp.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},fp.prototype.getBufferParameters=function(){return this._bufParams},fp.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},fp.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return fp.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},fp.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=op.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],nh.LEFT),r.addFirstSegment();for(var a=o-2;a>=0;a--)r.addNextSegment(i[a],!0)}else{var s=op.simplify(t,n),u=s.length-1;r.initSideSegments(s[0],s[1],nh.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(s[l],!0)}r.addLastSegment()},fp.prototype.getSegGen=function(t){return new hp(this._precisionModel,this._bufParams,t)},fp.prototype.interfaces_=function(){return[]},fp.prototype.getClass=function(){return fp},fp.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;r<e.length;r++)e[r]=new Bu(t[r]);return e};var dp=function(){this._subgraphs=null,this._seg=new Wh,this._cga=new wl;var t=arguments[0];this._subgraphs=t},gp={DepthSegment:{configurable:!0}};dp.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=new Ul,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(Xu(arguments[2],Fl)&&arguments[0]instanceof Bu&&arguments[1]instanceof wh)for(var a=arguments[0],s=arguments[1],u=arguments[2],l=s.getEdge().getCoordinates(),c=0;c<l.length-1;c++){t._seg.p0=l[c],t._seg.p1=l[c+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse();if(!(Math.max(t._seg.p0.x,t._seg.p1.x)<a.x||t._seg.isHorizontal()||a.y<t._seg.p0.y||a.y>t._seg.p1.y||wl.computeOrientation(t._seg.p0,t._seg.p1,a)===wl.RIGHT)){var h=s.getDepth(nh.LEFT);t._seg.p0.equals(l[c])||(h=s.getDepth(nh.RIGHT));var p=new yp(t._seg,h);u.add(p)}}else if(Xu(arguments[2],Fl)&&arguments[0]instanceof Bu&&Xu(arguments[1],Fl))for(var f=arguments[0],d=arguments[2],g=arguments[1].iterator();g.hasNext();){var y=g.next();y.isForward()&&t.findStabbedSegments(f,y,d)}},dp.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Nh.min(e)._leftDepth},dp.prototype.interfaces_=function(){return[]},dp.prototype.getClass=function(){return dp},gp.DepthSegment.get=function(){return yp},Object.defineProperties(dp,gp);var yp=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Wh(t),this._leftDepth=e};yp.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!=(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},yp.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},yp.prototype.toString=function(){return this._upwardSeg.toString()},yp.prototype.interfaces_=function(){return[Ru]},yp.prototype.getClass=function(){return yp};var mp=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};mp.prototype.area=function(){return mp.area(this.p0,this.p1,this.p2)},mp.prototype.signedArea=function(){return mp.signedArea(this.p0,this.p1,this.p2)},mp.prototype.interpolateZ=function(t){if(null===t)throw new ku("Supplied point is null.");return mp.interpolateZ(t,this.p0,this.p1,this.p2)},mp.prototype.longestSideLength=function(){return mp.longestSideLength(this.p0,this.p1,this.p2)},mp.prototype.isAcute=function(){return mp.isAcute(this.p0,this.p1,this.p2)},mp.prototype.circumcentre=function(){return mp.circumcentre(this.p0,this.p1,this.p2)},mp.prototype.area3D=function(){return mp.area3D(this.p0,this.p1,this.p2)},mp.prototype.centroid=function(){return mp.centroid(this.p0,this.p1,this.p2)},mp.prototype.inCentre=function(){return mp.inCentre(this.p0,this.p1,this.p2)},mp.prototype.interfaces_=function(){return[]},mp.prototype.getClass=function(){return mp},mp.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},mp.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},mp.det=function(t,e,r,n){return t*n-e*r},mp.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,a=r.x-i,s=n.x-i,u=r.y-o,l=n.y-o,c=a*l-s*u,h=t.x-i,p=t.y-o,f=(l*h-s*p)/c,d=(-u*h+a*p)/c;return e.z+f*(r.z-e.z)+d*(n.z-e.z)},mp.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),a=n;return i>a&&(a=i),o>a&&(a=o),a},mp.isAcute=function(t,e,r){return!!lp.isAcute(t,e,r)&&!!lp.isAcute(e,r,t)&&!!lp.isAcute(r,t,e)},mp.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,a=t.y-i,s=e.x-n,u=e.y-i,l=2*mp.det(o,a,s,u),c=mp.det(a,o*o+a*a,u,s*s+u*u),h=mp.det(o,o*o+a*a,s,s*s+u*u);return new Bu(n-c/l,i+h/l)},mp.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new al(t.x+r/2,t.y+n/2,1),o=new al(t.x-n+r/2,t.y+r+n/2,1);return new al(i,o)},mp.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,a=r.y-t.y;return new Bu(t.x+i*o,t.y+i*a)},mp.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,a=r.x-t.x,s=r.y-t.y,u=r.z-t.z,l=i*u-o*s,c=o*a-n*u,h=n*s-i*a,p=l*l+c*c+h*h;return Math.sqrt(p)/2},mp.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new Bu(n,i)},mp.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),a=n+i+o,s=(n*t.x+i*e.x+o*r.x)/a,u=(n*t.y+i*e.y+o*r.y)/a;return new Bu(s,u)};var vp=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Ul;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};vp.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,qu.EXTERIOR,qu.INTERIOR)},vp.prototype.addPolygon=function(t){var e=this,r=this._distance,n=nh.LEFT;this._distance<0&&(r=-this._distance,n=nh.RIGHT);var i=t.getExteriorRing(),o=ql.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,qu.EXTERIOR,qu.INTERIOR);for(var a=0;a<t.getNumInteriorRing();a++){var s=t.getInteriorRingN(a),u=ql.removeRepeatedPoints(s.getCoordinates());e._distance>0&&e.isErodedCompletely(s,-e._distance)||e.addPolygonRing(u,r,nh.opposite(n),qu.INTERIOR,qu.EXTERIOR)}},vp.prototype.isTriangleErodedCompletely=function(t,e){var r=new mp(t[0],t[1],t[2]),n=r.inCentre();return wl.distancePointLine(n,r.p0,r.p1)<Math.abs(e)},vp.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=ql.removeRepeatedPoints(t.getCoordinates()),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,qu.EXTERIOR,qu.INTERIOR)},vp.prototype.addCurve=function(t,e,r){if(null===t||t.length<2)return null;var n=new Yh(t,new ph(0,qu.BOUNDARY,e,r));this._curveList.add(n)},vp.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},vp.prototype.addPolygonRing=function(t,e,r,n,i){if(0===e&&t.length<Nc.MINIMUM_VALID_SIZE)return null;var o=n,a=i;t.length>=Nc.MINIMUM_VALID_SIZE&&wl.isCCW(t)&&(o=i,a=n,r=nh.opposite(r));var s=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(s,o,a)},vp.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Ac?this.addPolygon(t):t instanceof Pc?this.addLineString(t):t instanceof Tc?this.addPoint(t):(t instanceof kc||t instanceof gc||t instanceof Dc||t instanceof dc)&&this.addCollection(t)},vp.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},vp.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},vp.prototype.interfaces_=function(){return[]},vp.prototype.getClass=function(){return vp};var _p=function(){};_p.prototype.locate=function(t){},_p.prototype.interfaces_=function(){return[]},_p.prototype.getClass=function(){return _p};var xp=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};xp.prototype.next=function(){if(this._atStart)return this._atStart=!1,xp.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new Bl;var t=this._parent.getGeometryN(this._index++);return t instanceof dc?(this._subcollectionIterator=new xp(t),this._subcollectionIterator.next()):t},xp.prototype.remove=function(){throw new Error(this.getClass().getName())},xp.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},xp.prototype.interfaces_=function(){return[zl]},xp.prototype.getClass=function(){return xp},xp.isAtomic=function(t){return!(t instanceof dc)};var bp=function(){this._geom=null;var t=arguments[0];this._geom=t};bp.prototype.locate=function(t){return bp.locate(t,this._geom)},bp.prototype.interfaces_=function(){return[_p]},bp.prototype.getClass=function(){return bp},bp.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&wl.isPointInRing(t,e.getCoordinates())},bp.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!bp.isPointInRing(t,r))return!1;for(var n=0;n<e.getNumInteriorRing();n++){var i=e.getInteriorRingN(n);if(bp.isPointInRing(t,i))return!1}return!0},bp.containsPoint=function(t,e){if(e instanceof Ac)return bp.containsPointInPolygon(t,e);if(e instanceof dc)for(var r=new xp(e);r.hasNext();){var n=r.next();if(n!==e&&bp.containsPoint(t,n))return!0}return!1},bp.locate=function(t,e){return e.isEmpty()?qu.EXTERIOR:bp.containsPoint(t,e)?qu.INTERIOR:qu.EXTERIOR};var wp=function(){this._edgeMap=new ic,this._edgeList=null,this._ptInAreaLocation=[qu.NONE,qu.NONE]};wp.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),r=e-1;return 0===e&&(r=this._edgeList.size()-1),this._edgeList.get(r)},wp.prototype.propagateSideLabels=function(t){for(var e=qu.NONE,r=this.iterator();r.hasNext();){var n=r.next().getLabel();n.isArea(t)&&n.getLocation(t,nh.LEFT)!==qu.NONE&&(e=n.getLocation(t,nh.LEFT))}if(e===qu.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var a=o.next(),s=a.getLabel();if(s.getLocation(t,nh.ON)===qu.NONE&&s.setLocation(t,nh.ON,i),s.isArea(t)){var u=s.getLocation(t,nh.LEFT),l=s.getLocation(t,nh.RIGHT);if(l!==qu.NONE){if(l!==i)throw new uh("side location conflict",a.getCoordinate());u===qu.NONE&&yl.shouldNeverReachHere("found single null side (at "+a.getCoordinate()+")"),i=u}else yl.isTrue(s.getLocation(t,nh.LEFT)===qu.NONE,"found single null side"),s.setLocation(t,nh.RIGHT,i),s.setLocation(t,nh.LEFT,i)}}},wp.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},wp.prototype.print=function(t){ol.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},wp.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},wp.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var r=e.size()-1,n=e.get(r).getLabel().getLocation(t,nh.LEFT);yl.isTrue(n!==qu.NONE,"Found unlabelled area edge");for(var i=n,o=this.iterator();o.hasNext();){var a=o.next().getLabel();yl.isTrue(a.isArea(t),"Found non-area edge");var s=a.getLocation(t,nh.LEFT),u=a.getLocation(t,nh.RIGHT);if(s===u)return!1;if(u!==i)return!1;i=s}return!0},wp.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++)if(this._edgeList.get(e)===t)return e;return-1},wp.prototype.iterator=function(){return this.getEdges().iterator()},wp.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new Ul(this._edgeMap.values())),this._edgeList},wp.prototype.getLocation=function(t,e,r){return this._ptInAreaLocation[t]===qu.NONE&&(this._ptInAreaLocation[t]=bp.locate(e,r[t].getGeometry())),this._ptInAreaLocation[t]},wp.prototype.toString=function(){var t=new Wu;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var r=e.next();t.append(r),t.append("\n")}return t.toString()},wp.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},wp.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],r=this.iterator();r.hasNext();)for(var n=r.next().getLabel(),i=0;i<2;i++)n.isLine(i)&&n.getLocation(i)===qu.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var a=o.next(),s=a.getLabel(),u=0;u<2;u++)if(s.isAnyNull(u)){var l=qu.NONE;if(e[u])l=qu.EXTERIOR;else{var c=a.getCoordinate();l=this.getLocation(u,c,t)}s.setAllLocationsIfNull(u,l)}},wp.prototype.getDegree=function(){return this._edgeMap.size()},wp.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},wp.prototype.interfaces_=function(){return[]},wp.prototype.getClass=function(){return wp};var Ep=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var t=this;this.getResultAreaEdges();for(var e=null,r=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),a=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),n){case t._SCANNING_FOR_INCOMING:if(!a.isInResult())continue;r=a,n=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;r.setNext(o),n=t._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===e)throw new uh("no outgoing dirEdge found",this.getCoordinate());yl.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),r.setNext(e)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var r=t.get(0);if(1===e)return r;var n=t.get(e-1),i=r.getQuadrant(),o=n.getQuadrant();return _h.isNorthern(i)&&_h.isNorthern(o)?r:_h.isNorthern(i)||_h.isNorthern(o)?0!==r.getDy()?r:0!==n.getDy()?n:(yl.shouldNeverReachHere("found two horizontal edges incident on node"),null):n},e.prototype.print=function(t){ol.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var r=e.next();t.print("out "),r.print(t),t.println(),t.print("in "),r.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new Ul;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var r=e.next().getLabel();r.setAllLocationsIfNull(0,t.getLocation(0)),r.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,r=this._edgeList.size()-1;r>=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(nh.LEFT),n=t.getDepth(nh.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new uh("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],a=arguments[2],s=arguments[0];s<o;s++){var u=this._edgeList.get(s);u.setEdgeDepths(nh.RIGHT,a),a=u.getDepth(nh.LEFT)}return a}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=this,r=null,n=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var a=e._resultAreaEdgeList.get(o),s=a.getSym();switch(null===r&&a.getEdgeRing()===t&&(r=a),i){case e._SCANNING_FOR_INCOMING:if(s.getEdgeRing()!==t)continue;n=s,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(a.getEdgeRing()!==t)continue;n.setNextMin(a),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(yl.isTrue(null!==r,"found null for first outgoing dirEdge"),yl.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){e.next().isInResult()&&t++}return t}if(1===arguments.length){for(var r=arguments[0],n=0,i=this.iterator();i.hasNext();){i.next().getEdgeRing()===r&&n++}return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=qu.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=qu.INTERIOR;break}if(n.isInResult()){t=qu.EXTERIOR;break}}}if(t===qu.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var a=o.next(),s=a.getSym();a.isLineEdge()?a.getEdge().setCovered(i===qu.INTERIOR):(a.isInResult()&&(i=qu.EXTERIOR),s.isInResult()&&(i=qu.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new ph(qu.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==qu.INTERIOR&&o!==qu.BOUNDARY||this._label.setLocation(i,qu.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wp),Ip=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.createNode=function(t){return new mh(t,new Ep)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Eh),Sp=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Sp.prototype.compareTo=function(t){var e=t;return Sp.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Sp.prototype.interfaces_=function(){return[Ru]},Sp.prototype.getClass=function(){return Sp},Sp.orientation=function(t){return 1===ql.increasingDirection(t)},Sp.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,a=e?t.length:-1,s=n?r.length:-1,u=e?0:t.length-1,l=n?0:r.length-1;;){var c=t[u].compareTo(r[l]);if(0!==c)return c;var h=(u+=i)===a,p=(l+=o)===s;if(h&&!p)return-1;if(!h&&p)return 1;if(h&&p)return 0}};var Cp=function(){this._edges=new Ul,this._ocaMap=new ic};Cp.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var r=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i<n.length;i++)i>0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},Cp.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Cp.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Cp.prototype.iterator=function(){return this._edges.iterator()},Cp.prototype.getEdges=function(){return this._edges},Cp.prototype.get=function(t){return this._edges.get(t)},Cp.prototype.findEqualEdge=function(t){var e=new Sp(t.getCoordinates());return this._ocaMap.get(e)},Cp.prototype.add=function(t){this._edges.add(t);var e=new Sp(t.getCoordinates());this._ocaMap.put(e,t)},Cp.prototype.interfaces_=function(){return[]},Cp.prototype.getClass=function(){return Cp};var Pp=function(){};Pp.prototype.processIntersections=function(t,e,r,n){},Pp.prototype.isDone=function(){},Pp.prototype.interfaces_=function(){return[]},Pp.prototype.getClass=function(){return Pp};var Mp=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};Mp.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(Mp.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},Mp.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Mp.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Mp.prototype.getLineIntersector=function(){return this._li},Mp.prototype.hasProperIntersection=function(){return this._hasProper},Mp.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=r.getCoordinates()[n],s=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,a,s),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Mp.prototype.hasIntersection=function(){return this._hasIntersection},Mp.prototype.isDone=function(){return!1},Mp.prototype.hasInteriorIntersection=function(){return this._hasInterior},Mp.prototype.interfaces_=function(){return[Pp]},Mp.prototype.getClass=function(){return Mp},Mp.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Tp=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],r=arguments[2];this.coord=new Bu(t),this.segmentIndex=e,this.dist=r};Tp.prototype.getSegmentIndex=function(){return this.segmentIndex},Tp.prototype.getCoordinate=function(){return this.coord},Tp.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Tp.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Tp.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Tp.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Tp.prototype.getDistance=function(){return this.dist},Tp.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Tp.prototype.interfaces_=function(){return[Ru]},Tp.prototype.getClass=function(){return Tp};var Lp=function(){this._nodeMap=new ic,this.edge=null;var t=arguments[0];this.edge=t};Lp.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},Lp.prototype.iterator=function(){return this._nodeMap.values().iterator()},Lp.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next(),i=this.createSplitEdge(r,n);t.add(i),r=n}},Lp.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Lp.prototype.createSplitEdge=function(t,e){var r=e.segmentIndex-t.segmentIndex+2,n=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),a=0;o[a++]=new Bu(t.coord);for(var s=t.segmentIndex+1;s<=e.segmentIndex;s++)o[a++]=this.edge.pts[s];return i&&(o[a]=e.coord),new Rp(o,new ph(this.edge._label))},Lp.prototype.add=function(t,e,r){var n=new Tp(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},Lp.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},Lp.prototype.interfaces_=function(){return[]},Lp.prototype.getClass=function(){return Lp};var Ap=function(){};Ap.prototype.getChainStartIndices=function(t){var e=0,r=new Ul;r.add(new Hu(e));do{var n=this.findChainEnd(t,e);r.add(new Hu(n)),e=n}while(e<t.length-1);return Ap.toIntArray(r)},Ap.prototype.findChainEnd=function(t,e){for(var r=_h.quadrant(t[e],t[e+1]),n=e+1;n<t.length&&_h.quadrant(t[n-1],t[n])===r;)n++;return n-1},Ap.prototype.interfaces_=function(){return[]},Ap.prototype.getClass=function(){return Ap},Ap.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),r=0;r<e.length;r++)e[r]=t.get(r).intValue();return e};var kp=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new sl,this.env2=new sl;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Ap;this.startIndex=e.getChainStartIndices(this.pts)};kp.prototype.getCoordinates=function(){return this.pts},kp.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e>r?e:r},kp.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return e<r?e:r},kp.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[r],e.startIndex[r+1],n)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2],s=arguments[3],u=arguments[4],l=arguments[5],c=this.pts[i],h=this.pts[o],p=a.pts[s],f=a.pts[u];if(o-i==1&&u-s==1)return l.addIntersections(this.e,i,a.e,s),null;if(this.env1.init(c,h),this.env2.init(p,f),!this.env1.intersects(this.env2))return null;var d=Math.trunc((i+o)/2),g=Math.trunc((s+u)/2);i<d&&(s<g&&this.computeIntersectsForChain(i,d,a,s,g,l),g<u&&this.computeIntersectsForChain(i,d,a,g,u,l)),d<o&&(s<g&&this.computeIntersectsForChain(d,o,a,s,g,l),g<u&&this.computeIntersectsForChain(d,o,a,g,u,l))}},kp.prototype.getStartIndexes=function(){return this.startIndex},kp.prototype.computeIntersects=function(t,e){for(var r=0;r<this.startIndex.length-1;r++)for(var n=0;n<t.startIndex.length-1;n++)this.computeIntersectsForChain(r,t,n,e)},kp.prototype.interfaces_=function(){return[]},kp.prototype.getClass=function(){return kp};var Np=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var r=0;r<3;r++)this._depth[e][r]=t.NULL_VALUE},Dp={NULL_VALUE:{configurable:!0}};Np.prototype.getDepth=function(t,e){return this._depth[t][e]},Np.prototype.setDepth=function(t,e,r){this._depth[t][e]=r},Np.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==Np.NULL_VALUE)return!1;return!0}if(1===arguments.length){var r=arguments[0];return this._depth[r][1]===Np.NULL_VALUE}if(2===arguments.length){var n=arguments[0],i=arguments[1];return this._depth[n][i]===Np.NULL_VALUE}},Np.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var r=t._depth[e][1];t._depth[e][2]<r&&(r=t._depth[e][2]),r<0&&(r=0);for(var n=1;n<3;n++){var i=0;t._depth[e][n]>r&&(i=1),t._depth[e][n]=i}}},Np.prototype.getDelta=function(t){return this._depth[t][nh.RIGHT]-this._depth[t][nh.LEFT]},Np.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?qu.EXTERIOR:qu.INTERIOR},Np.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Np.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==qu.EXTERIOR&&i!==qu.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=Np.depthAtLocation(i):t._depth[r][n]+=Np.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],a=arguments[1];arguments[2]===qu.INTERIOR&&this._depth[o][a]++}},Np.prototype.interfaces_=function(){return[]},Np.prototype.getClass=function(){return Np},Np.depthAtLocation=function(t){return t===qu.EXTERIOR?0:t===qu.INTERIOR?1:Np.NULL_VALUE},Dp.NULL_VALUE.get=function(){return-1},Object.defineProperties(Np,Dp);var Rp=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Lp(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Np,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,ph.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,a=0;a<this.pts.length;a++)if(this.pts[a].equals2D(r.pts[a])||(n=!1),this.pts[a].equals2D(r.pts[--o])||(i=!1),!n&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new kp(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new sl;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,r,n){var i=new Bu(t.getIntersection(n)),o=e,a=t.getEdgeDistance(r,n),s=o+1;if(s<this.pts.length){var u=this.pts[s];i.equals2D(u)&&(o=s,a=0)}this.eiList.add(i,o,a)},e.prototype.toString=function(){var t=new Wu;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++)this.addIntersection(t,e,r,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],r=arguments[1];r.setAtLeastIfValid(e.getLocation(0,nh.ON),e.getLocation(1,nh.ON),1),e.isArea()&&(r.setAtLeastIfValid(e.getLocation(0,nh.LEFT),e.getLocation(1,nh.LEFT),2),r.setAtLeastIfValid(e.getLocation(0,nh.RIGHT),e.getLocation(1,nh.RIGHT),2))},e}(yh),Op=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Cp,this._bufParams=t||null};Op.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Op.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new ph(t.getLabel())).flip(),r.merge(n);var i=Op.depthDelta(n),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(Op.depthDelta(t.getLabel()))},Op.prototype.buildSubgraphs=function(t,e){for(var r=new Ul,n=t.iterator();n.hasNext();){var i=n.next(),o=i.getRightmostCoordinate(),a=new dp(r).getDepth(o);i.computeDepth(a),i.findResultEdges(),r.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},Op.prototype.createSubgraphs=function(t){for(var e=new Ul,r=t.getNodes().iterator();r.hasNext();){var n=r.next();if(!n.isVisited()){var i=new ch;i.create(n),e.add(i)}}return Nh.sort(e,Nh.reverseOrder()),e},Op.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Op.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new ep,r=new _l;return r.setPrecisionModel(t),e.setSegmentIntersector(new Mp(r)),e},Op.prototype.buffer=function(t,e){var r=this._workingPrecisionModel;null===r&&(r=t.getPrecisionModel()),this._geomFact=t.getFactory();var n=new fp(r,this._bufParams),i=new vp(t,e,n).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,r),this._graph=new Ih(new Ip),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),a=new Sh(this._geomFact);this.buildSubgraphs(o,a);var s=a.getPolygons();return s.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(s)},Op.prototype.computeNodedEdges=function(t,e){var r=this.getNoder(e);r.computeNodes(t);for(var n=r.getNodedSubstrings().iterator();n.hasNext();){var i=n.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var a=i.getData(),s=new Rp(i.getCoordinates(),new ph(a));this.insertUniqueEdge(s)}}},Op.prototype.setNoder=function(t){this._workingNoder=t},Op.prototype.interfaces_=function(){return[]},Op.prototype.getClass=function(){return Op},Op.depthDelta=function(t){var e=t.getLocation(0,nh.LEFT),r=t.getLocation(0,nh.RIGHT);return e===qu.INTERIOR&&r===qu.EXTERIOR?1:e===qu.EXTERIOR&&r===qu.INTERIOR?-1:0},Op.convertSegStrings=function(t){for(var e=new Hc,r=new Ul;t.hasNext();){var n=t.next(),i=e.createLineString(n.getCoordinates());r.add(i)}return e.buildGeometry(r)};var zp=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2],o=arguments[3];this._noder=r,this._scaleFactor=n,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};zp.prototype.rescale=function(){var t=this;if(Xu(arguments[0],Rl))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],i=0;i<n.length;i++)n[i].x=n[i].x/t._scaleFactor+t._offsetX,n[i].y=n[i].y/t._scaleFactor+t._offsetY;2===n.length&&n[0].equals2D(n[1])&&ol.out.println(n)}},zp.prototype.scale=function(){var t=this;if(Xu(arguments[0],Rl)){for(var e=arguments[0],r=new Ul,n=e.iterator();n.hasNext();){var i=n.next();r.add(new Yh(t.scale(i.getCoordinates()),i.getData()))}return r}if(arguments[0]instanceof Array){for(var o=arguments[0],a=new Array(o.length).fill(null),s=0;s<o.length;s++)a[s]=new Bu(Math.round((o[s].x-t._offsetX)*t._scaleFactor),Math.round((o[s].y-t._offsetY)*t._scaleFactor),o[s].z);return ql.removeRepeatedPoints(a)}},zp.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},zp.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},zp.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},zp.prototype.interfaces_=function(){return[Qh]},zp.prototype.getClass=function(){return zp};var Fp=function(){this._li=new _l,this._segStrings=null;var t=arguments[0];this._segStrings=t},Bp={fact:{configurable:!0}};Fp.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var r=e.next().getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(2===arguments.length)for(var n=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),a=1;a<o.length-1;a++)if(o[a].equals(n))throw new dl("found endpt/interior pt intersection at index "+a+" :pt "+n)},Fp.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),r=this._segStrings.iterator();r.hasNext();){var n=r.next();this.checkInteriorIntersections(e,n)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],a=i.getCoordinates(),s=o.getCoordinates(),u=0;u<a.length-1;u++)for(var l=0;l<s.length-1;l++)this.checkInteriorIntersections(i,u,o,l);else if(4===arguments.length){var c=arguments[0],h=arguments[1],p=arguments[2],f=arguments[3];if(c===p&&h===f)return null;var d=c.getCoordinates()[h],g=c.getCoordinates()[h+1],y=p.getCoordinates()[f],m=p.getCoordinates()[f+1];if(this._li.computeIntersection(d,g,y,m),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,d,g)||this.hasInteriorIntersection(this._li,y,m)))throw new dl("found non-noded intersection at "+d+"-"+g+" and "+y+"-"+m)}},Fp.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Fp.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var r=arguments[0].getCoordinates(),n=0;n<r.length-2;n++)this.checkCollapse(r[n],r[n+1],r[n+2])},Fp.prototype.hasInteriorIntersection=function(t,e,r){for(var n=0;n<t.getIntersectionNum();n++){var i=t.getIntersection(n);if(!i.equals(e)&&!i.equals(r))return!0}return!1},Fp.prototype.checkCollapse=function(t,e,r){if(t.equals(r))throw new dl("found non-noded collapse at "+Fp.fact.createLineString([t,e,r]))},Fp.prototype.interfaces_=function(){return[]},Fp.prototype.getClass=function(){return Fp},Bp.fact.get=function(){return new Hc},Object.defineProperties(Fp,Bp);var Up=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],r=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=r,e<=0)throw new ku("Scale factor must be non-zero");1!==e&&(this._pt=new Bu(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new Bu,this._p1Scaled=new Bu),this.initCorners(this._pt)},jp={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Up.prototype.intersectsScaled=function(t,e){var r=Math.min(t.x,e.x),n=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),a=this._maxx<r||this._minx>n||this._maxy<i||this._miny>o;if(a)return!1;var s=this.intersectsToleranceSquare(t,e);return yl.isTrue(!(a&&s),"Found bad envelope test"),s},Up.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new Bu(this._maxx,this._maxy),this._corner[1]=new Bu(this._minx,this._maxy),this._corner[2]=new Bu(this._minx,this._miny),this._corner[3]=new Bu(this._maxx,this._miny)},Up.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Up.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Up.prototype.getCoordinate=function(){return this._originalPt},Up.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Up.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=Up.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new sl(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},Up.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))))},Up.prototype.intersectsToleranceSquare=function(t,e){var r=!1,n=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||r&&n||t.equals(this._pt)||e.equals(this._pt)))))},Up.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},Up.prototype.interfaces_=function(){return[]},Up.prototype.getClass=function(){return Up},jp.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(Up,jp);var Vp=function(){this.tempEnv1=new sl,this.selectedSegment=new Wh};Vp.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},Vp.prototype.interfaces_=function(){return[]},Vp.prototype.getClass=function(){return Vp};var qp=function(){this._index=null;var t=arguments[0];this._index=t},Gp={HotPixelSnapAction:{configurable:!0}};qp.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new Xp(e,r,n);return this._index.query(i,{interfaces_:function(){return[Th]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},qp.prototype.interfaces_=function(){return[]},qp.prototype.getClass=function(){return qp},Gp.HotPixelSnapAction.get=function(){return Xp},Object.defineProperties(qp,Gp);var Xp=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,this._hotPixelVertexIndex=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Vp),Zp=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new Ul};Zp.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=r.getCoordinates()[n],s=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,a,s),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)}},Zp.prototype.isDone=function(){return!1},Zp.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Zp.prototype.interfaces_=function(){return[Pp]},Zp.prototype.getClass=function(){return Zp};var Yp=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new _l,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};Yp.prototype.checkCorrectness=function(t){var e=Yh.getNodedSubstrings(t),r=new Fp(e);try{r.checkValid()}catch(t){if(!(t instanceof nl))throw t;t.printStackTrace()}},Yp.prototype.getNodedSubstrings=function(){return Yh.getNodedSubstrings(this._nodedSegStrings)},Yp.prototype.snapRound=function(t,e){var r=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(r),this.computeVertexSnaps(t)},Yp.prototype.findInteriorIntersections=function(t,e){var r=new Zp(e);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(t),r.getInteriorIntersections()},Yp.prototype.computeVertexSnaps=function(){var t=this;if(Xu(arguments[0],Rl))for(var e=arguments[0].iterator();e.hasNext();){var r=e.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof Yh)for(var n=arguments[0],i=n.getCoordinates(),o=0;o<i.length;o++){var a=new Up(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(a,n,o)&&n.addIntersection(i[o],o)}},Yp.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new ep,this._pointSnapper=new qp(this._noder.getIndex()),this.snapRound(t,this._li)},Yp.prototype.computeIntersectionSnaps=function(t){for(var e=this,r=t.iterator();r.hasNext();){var n=r.next(),i=new Up(n,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},Yp.prototype.interfaces_=function(){return[Qh]},Yp.prototype.getClass=function(){return Yp};var Wp=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new np,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._argGeom=e,this._bufParams=r}},Hp={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Wp.prototype.bufferFixedPrecision=function(t){var e=new zp(new Yp(new Xc(1)),t.getScale()),r=new Op(this._bufParams);r.setWorkingPrecisionModel(t),r.setNoder(e),this._resultGeometry=r.buffer(this._argGeom,this._distance)},Wp.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=Wp.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof uh))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=Wp.precisionScaleFactor(this._argGeom,this._distance,r),i=new Xc(n);this.bufferFixedPrecision(i)}},Wp.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Xc.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},Wp.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},Wp.prototype.bufferOriginalPrecision=function(){try{var t=new Op(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof dl))throw t;this._saveException=t}},Wp.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},Wp.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},Wp.prototype.interfaces_=function(){return[]},Wp.prototype.getClass=function(){return Wp},Wp.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new Wp(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Sl&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new Wp(arguments[0]);n.setQuadrantSegments(r);return n.getResultGeometry(e)}if(arguments[2]instanceof np&&arguments[0]instanceof Sl&&"number"==typeof arguments[1]){var i=arguments[1];return new Wp(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],a=arguments[2],s=arguments[3],u=new Wp(arguments[0]);u.setQuadrantSegments(a),u.setEndCapStyle(s);return u.getResultGeometry(o)}},Wp.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=Zu.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},Hp.CAP_ROUND.get=function(){return np.CAP_ROUND},Hp.CAP_BUTT.get=function(){return np.CAP_FLAT},Hp.CAP_FLAT.get=function(){return np.CAP_FLAT},Hp.CAP_SQUARE.get=function(){return np.CAP_SQUARE},Hp.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Wp,Hp);var Jp=function(){this._pt=[new Bu,new Bu],this._distance=Nu.NaN,this._isNull=!0};Jp.prototype.getCoordinates=function(){return this._pt},Jp.prototype.getCoordinate=function(t){return this._pt[t]},Jp.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},Jp.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},Jp.prototype.getDistance=function(){return this._distance},Jp.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},Jp.prototype.interfaces_=function(){return[]},Jp.prototype.getClass=function(){return Jp};var Kp=function(){};Kp.prototype.interfaces_=function(){return[]},Kp.prototype.getClass=function(){return Kp},Kp.computeDistance=function(){if(arguments[2]instanceof Jp&&arguments[0]instanceof Pc&&arguments[1]instanceof Bu)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new Wh,i=0;i<r.length-1;i++){n.setCoordinates(r[i],r[i+1]);var o=n.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof Jp&&arguments[0]instanceof Ac&&arguments[1]instanceof Bu){var a=arguments[0],s=arguments[1],u=arguments[2];Kp.computeDistance(a.getExteriorRing(),s,u);for(var l=0;l<a.getNumInteriorRing();l++)Kp.computeDistance(a.getInteriorRingN(l),s,u)}else if(arguments[2]instanceof Jp&&arguments[0]instanceof Sl&&arguments[1]instanceof Bu){var c=arguments[0],h=arguments[1],p=arguments[2];if(c instanceof Pc)Kp.computeDistance(c,h,p);else if(c instanceof Ac)Kp.computeDistance(c,h,p);else if(c instanceof dc)for(var f=c,d=0;d<f.getNumGeometries();d++){var g=f.getGeometryN(d);Kp.computeDistance(g,h,p)}else p.setMinimum(c.getCoordinate(),h)}else if(arguments[2]instanceof Jp&&arguments[0]instanceof Wh&&arguments[1]instanceof Bu){var y=arguments[1],m=arguments[2],v=arguments[0].closestPoint(y);m.setMinimum(v,y)}};var $p=function(t){this._maxPtDist=new Jp,this._inputGeom=t||null},Qp={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};$p.prototype.computeMaxMidpointDistance=function(t){var e=new ef(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},$p.prototype.computeMaxVertexDistance=function(t){var e=new tf(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},$p.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},$p.prototype.getDistancePoints=function(){return this._maxPtDist},$p.prototype.interfaces_=function(){return[]},$p.prototype.getClass=function(){return $p},Qp.MaxPointDistanceFilter.get=function(){return tf},Qp.MaxMidpointDistanceFilter.get=function(){return ef},Object.defineProperties($p,Qp);var tf=function(t){this._maxPtDist=new Jp,this._minPtDist=new Jp,this._geom=t||null};tf.prototype.filter=function(t){this._minPtDist.initialize(),Kp.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},tf.prototype.getMaxPointDistance=function(){return this._maxPtDist},tf.prototype.interfaces_=function(){return[Ml]},tf.prototype.getClass=function(){return tf};var ef=function(t){this._maxPtDist=new Jp,this._minPtDist=new Jp,this._geom=t||null};ef.prototype.filter=function(t,e){if(0===e)return null;var r=t.getCoordinate(e-1),n=t.getCoordinate(e),i=new Bu((r.x+n.x)/2,(r.y+n.y)/2);this._minPtDist.initialize(),Kp.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ef.prototype.isDone=function(){return!1},ef.prototype.isGeometryChanged=function(){return!1},ef.prototype.getMaxPointDistance=function(){return this._maxPtDist},ef.prototype.interfaces_=function(){return[fc]},ef.prototype.getClass=function(){return ef};var rf=function(t){this._comps=t||null};rf.prototype.filter=function(t){t instanceof Ac&&this._comps.add(t)},rf.prototype.interfaces_=function(){return[pc]},rf.prototype.getClass=function(){return rf},rf.getPolygons=function(){if(1===arguments.length){return rf.getPolygons(arguments[0],new Ul)}if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof Ac?e.add(t):t instanceof dc&&t.apply(new rf(e)),e}};var nf=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],r=arguments[1];this._lines=e,this._isForcedToLineString=r}};nf.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Nc){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Pc&&this._lines.add(t)},nf.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},nf.prototype.interfaces_=function(){return[Il]},nf.prototype.getClass=function(){return nf},nf.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(nf.getLines(t))}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().buildGeometry(nf.getLines(e,r))}},nf.getLines=function(){if(1===arguments.length){return nf.getLines(arguments[0],!1)}if(2===arguments.length){if(Xu(arguments[0],Rl)&&Xu(arguments[1],Rl)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var r=e.next();nf.getLines(r,t)}return t}if(arguments[0]instanceof Sl&&"boolean"==typeof arguments[1]){var n=arguments[0],i=arguments[1],o=new Ul;return n.apply(new nf(o,i)),o}if(arguments[0]instanceof Sl&&Xu(arguments[1],Rl)){var a=arguments[0],s=arguments[1];return a instanceof Pc?s.add(a):a.apply(new nf(s)),s}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&Xu(arguments[0],Rl)&&Xu(arguments[1],Rl)){for(var u=arguments[1],l=arguments[2],c=arguments[0].iterator();c.hasNext();){var h=c.next();nf.getLines(h,u,l)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof Sl&&Xu(arguments[1],Rl)){var p=arguments[1],f=arguments[2];return arguments[0].apply(new nf(p,f)),p}}};var of=function(){if(this._boundaryRule=Tl.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new ku("Rule must be non-null");this._boundaryRule=t}};of.prototype.locateInternal=function(){if(arguments[0]instanceof Bu&&arguments[1]instanceof Ac){var t=arguments[0],e=arguments[1];if(e.isEmpty())return qu.EXTERIOR;var r=e.getExteriorRing(),n=this.locateInPolygonRing(t,r);if(n===qu.EXTERIOR)return qu.EXTERIOR;if(n===qu.BOUNDARY)return qu.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),a=this.locateInPolygonRing(t,o);if(a===qu.INTERIOR)return qu.EXTERIOR;if(a===qu.BOUNDARY)return qu.BOUNDARY}return qu.INTERIOR}if(arguments[0]instanceof Bu&&arguments[1]instanceof Pc){var s=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(s))return qu.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!s.equals(l[0])&&!s.equals(l[l.length-1])?wl.isOnLine(s,l)?qu.INTERIOR:qu.EXTERIOR:qu.BOUNDARY}if(arguments[0]instanceof Bu&&arguments[1]instanceof Tc){var c=arguments[0];return arguments[1].getCoordinate().equals2D(c)?qu.INTERIOR:qu.EXTERIOR}},of.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?wl.locatePointInRing(t,e.getCoordinates()):qu.EXTERIOR},of.prototype.intersects=function(t,e){return this.locate(t,e)!==qu.EXTERIOR},of.prototype.updateLocationInfo=function(t){t===qu.INTERIOR&&(this._isIn=!0),t===qu.BOUNDARY&&this._numBoundaries++},of.prototype.computeLocation=function(t,e){var r=this;if(e instanceof Tc&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof Pc)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Ac)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof gc)for(var n=e,i=0;i<n.getNumGeometries();i++){var o=n.getGeometryN(i);r.updateLocationInfo(r.locateInternal(t,o))}else if(e instanceof Dc)for(var a=e,s=0;s<a.getNumGeometries();s++){var u=a.getGeometryN(s);r.updateLocationInfo(r.locateInternal(t,u))}else if(e instanceof dc)for(var l=new xp(e);l.hasNext();){var c=l.next();c!==e&&r.computeLocation(t,c)}},of.prototype.locate=function(t,e){return e.isEmpty()?qu.EXTERIOR:e instanceof Pc||e instanceof Ac?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?qu.BOUNDARY:this._numBoundaries>0||this._isIn?qu.INTERIOR:qu.EXTERIOR)},of.prototype.interfaces_=function(){return[]},of.prototype.getClass=function(){return of};var af=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){t.call(this,arguments[0],t.INSIDE_AREA,arguments[1])}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},sf={INSIDE_AREA:{configurable:!0}};af.prototype.isInsideArea=function(){return this._segIndex===af.INSIDE_AREA},af.prototype.getCoordinate=function(){return this._pt},af.prototype.getGeometryComponent=function(){return this._component},af.prototype.getSegmentIndex=function(){return this._segIndex},af.prototype.interfaces_=function(){return[]},af.prototype.getClass=function(){return af},sf.INSIDE_AREA.get=function(){return-1},Object.defineProperties(af,sf);var uf=function(t){this._pts=t||null};uf.prototype.filter=function(t){t instanceof Tc&&this._pts.add(t)},uf.prototype.interfaces_=function(){return[pc]},uf.prototype.getClass=function(){return uf},uf.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Tc?Nh.singletonList(t):uf.getPoints(t,new Ul)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof Tc?r.add(e):e instanceof dc&&e.apply(new uf(r)),r}};var lf=function(){this._locations=null;var t=arguments[0];this._locations=t};lf.prototype.filter=function(t){(t instanceof Tc||t instanceof Pc||t instanceof Ac)&&this._locations.add(new af(t,0,t.getCoordinate()))},lf.prototype.interfaces_=function(){return[pc]},lf.prototype.getClass=function(){return lf},lf.getLocations=function(t){var e=new Ul;return t.apply(new lf(e)),e};var cf=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new of,this._minDistanceLocation=null,this._minDistance=Nu.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};cf.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1],i=1-r,o=rf.getPolygons(this._geom[r]);if(o.size()>0){var a=lf.getLocations(this._geom[i]);if(this.computeContainmentDistance(a,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&Xu(arguments[0],Fl)&&Xu(arguments[1],Fl)){for(var s=arguments[0],u=arguments[1],l=arguments[2],c=0;c<s.size();c++)for(var h=s.get(c),p=0;p<u.size();p++)if(t.computeContainmentDistance(h,u.get(p),l),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof af&&arguments[1]instanceof Ac){var f=arguments[0],d=arguments[1],g=arguments[2],y=f.getCoordinate();if(qu.EXTERIOR!==this._ptLocator.locate(y,d))return this._minDistance=0,g[0]=f,g[1]=new af(d,y),null}},cf.prototype.computeMinDistanceLinesPoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),a=0;a<e.size();a++){var s=e.get(a);if(n.computeMinDistance(o,s,r),n._minDistance<=n._terminateDistance)return null}},cf.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=nf.getLines(this._geom[0]),r=nf.getLines(this._geom[1]),n=uf.getPoints(this._geom[0]),i=uf.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,r,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(r,n,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(n,i,t),void this.updateMinDistance(t,!1))))},cf.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},cf.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},cf.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},cf.prototype.computeMinDistance=function(){var t=this;if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof Pc&&arguments[1]instanceof Tc){var e=arguments[0],r=arguments[1],n=arguments[2];if(e.getEnvelopeInternal().distance(r.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),a=0;a<i.length-1;a++){var s=wl.distancePointLine(o,i[a],i[a+1]);if(s<t._minDistance){t._minDistance=s;var u=new Wh(i[a],i[a+1]).closestPoint(o);n[0]=new af(e,a,u),n[1]=new af(r,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Pc&&arguments[1]instanceof Pc){var l=arguments[0],c=arguments[1],h=arguments[2];if(l.getEnvelopeInternal().distance(c.getEnvelopeInternal())>this._minDistance)return null;for(var p=l.getCoordinates(),f=c.getCoordinates(),d=0;d<p.length-1;d++)for(var g=0;g<f.length-1;g++){var y=wl.distanceLineLine(p[d],p[d+1],f[g],f[g+1]);if(y<t._minDistance){t._minDistance=y;var m=new Wh(p[d],p[d+1]),v=new Wh(f[g],f[g+1]),_=m.closestPoints(v);h[0]=new af(l,d,_[0]),h[1]=new af(c,g,_[1])}if(t._minDistance<=t._terminateDistance)return null}}},cf.prototype.computeMinDistancePoints=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),a=0;a<e.size();a++){var s=e.get(a),u=o.getCoordinate().distance(s.getCoordinate());if(u<n._minDistance&&(n._minDistance=u,r[0]=new af(o,0,o.getCoordinate()),r[1]=new af(s,0,s.getCoordinate())),n._minDistance<=n._terminateDistance)return null}},cf.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new ku("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},cf.prototype.computeMinDistanceLines=function(t,e,r){for(var n=this,i=0;i<t.size();i++)for(var o=t.get(i),a=0;a<e.size();a++){var s=e.get(a);if(n.computeMinDistance(o,s,r),n._minDistance<=n._terminateDistance)return null}},cf.prototype.interfaces_=function(){return[]},cf.prototype.getClass=function(){return cf},cf.distance=function(t,e){return new cf(t,e).distance()},cf.isWithinDistance=function(t,e,r){return new cf(t,e,r).distance()<=r},cf.nearestPoints=function(t,e){return new cf(t,e).nearestPoints()};var hf=function(){this._pt=[new Bu,new Bu],this._distance=Nu.NaN,this._isNull=!0};hf.prototype.getCoordinates=function(){return this._pt},hf.prototype.getCoordinate=function(t){return this._pt[t]},hf.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n<this._distance&&this.initialize(e,r,n)}},hf.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(n),this._distance=i,this._isNull=!1}},hf.prototype.toString=function(){return fl.toLineString(this._pt[0],this._pt[1])},hf.prototype.getDistance=function(){return this._distance},hf.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);n>this._distance&&this.initialize(e,r,n)}},hf.prototype.interfaces_=function(){return[]},hf.prototype.getClass=function(){return hf};var pf=function(){};pf.prototype.interfaces_=function(){return[]},pf.prototype.getClass=function(){return pf},pf.computeDistance=function(){if(arguments[2]instanceof hf&&arguments[0]instanceof Pc&&arguments[1]instanceof Bu)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new Wh,i=t.getCoordinates(),o=0;o<i.length-1;o++){n.setCoordinates(i[o],i[o+1]);var a=n.closestPoint(e);r.setMinimum(a,e)}else if(arguments[2]instanceof hf&&arguments[0]instanceof Ac&&arguments[1]instanceof Bu){var s=arguments[0],u=arguments[1],l=arguments[2];pf.computeDistance(s.getExteriorRing(),u,l);for(var c=0;c<s.getNumInteriorRing();c++)pf.computeDistance(s.getInteriorRingN(c),u,l)}else if(arguments[2]instanceof hf&&arguments[0]instanceof Sl&&arguments[1]instanceof Bu){var h=arguments[0],p=arguments[1],f=arguments[2];if(h instanceof Pc)pf.computeDistance(h,p,f);else if(h instanceof Ac)pf.computeDistance(h,p,f);else if(h instanceof dc)for(var d=h,g=0;g<d.getNumGeometries();g++){var y=d.getGeometryN(g);pf.computeDistance(y,p,f)}else f.setMinimum(h.getCoordinate(),p)}else if(arguments[2]instanceof hf&&arguments[0]instanceof Wh&&arguments[1]instanceof Bu){var m=arguments[1],v=arguments[2],_=arguments[0].closestPoint(m);v.setMinimum(_,m)}};var ff=function(){this._g0=null,this._g1=null,this._ptDist=new hf,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},df={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};ff.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},ff.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new ku("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},ff.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},ff.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},ff.prototype.computeOrientedDistance=function(t,e,r){var n=new gf(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new yf(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},ff.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},ff.prototype.interfaces_=function(){return[]},ff.prototype.getClass=function(){return ff},ff.distance=function(){if(2===arguments.length){return new ff(arguments[0],arguments[1]).distance()}if(3===arguments.length){var t=arguments[2],e=new ff(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},df.MaxPointDistanceFilter.get=function(){return gf},df.MaxDensifiedByFractionDistanceFilter.get=function(){return yf},Object.defineProperties(ff,df);var gf=function(){this._maxPtDist=new hf,this._minPtDist=new hf,this._euclideanDist=new pf,this._geom=null;var t=arguments[0];this._geom=t};gf.prototype.filter=function(t){this._minPtDist.initialize(),pf.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},gf.prototype.getMaxPointDistance=function(){return this._maxPtDist},gf.prototype.interfaces_=function(){return[Ml]},gf.prototype.getClass=function(){return gf};var yf=function(){this._maxPtDist=new hf,this._minPtDist=new hf,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};yf.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,a=(i.y-n.y)/this._numSubSegs,s=0;s<this._numSubSegs;s++){var u=n.x+s*o,l=n.y+s*a,c=new Bu(u,l);r._minPtDist.initialize(),pf.computeDistance(r._geom,c,r._minPtDist),r._maxPtDist.setMaximum(r._minPtDist)}},yf.prototype.isDone=function(){return!1},yf.prototype.isGeometryChanged=function(){return!1},yf.prototype.getMaxPointDistance=function(){return this._maxPtDist},yf.prototype.interfaces_=function(){return[fc]},yf.prototype.getClass=function(){return yf};var mf=function(t,e,r){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=r||null},vf={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};mf.prototype.checkMaximumDistance=function(t,e,r){var n=new ff(e,t);if(n.setDensifyFraction(.25),this._maxDistanceFound=n.orientedDistance(),this._maxDistanceFound>r){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+fl.toLineString(i[0],i[1])+")"}},mf.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=mf.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),mf.VERBOSE&&ol.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},mf.prototype.checkNegativeValid=function(){if(!(this._input instanceof Ac||this._input instanceof Dc||this._input instanceof dc))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},mf.prototype.getErrorIndicator=function(){return this._errorIndicator},mf.prototype.checkMinimumDistance=function(t,e,r){var n=new cf(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound<r){this._isValid=!1;var i=n.nearestPoints();this._errorLocation=n.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+fl.toLineString(i[0],i[1])+" )"}},mf.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},mf.prototype.getErrorLocation=function(){return this._errorLocation},mf.prototype.getPolygonLines=function(t){for(var e=new Ul,r=new nf(e),n=rf.getPolygons(t).iterator();n.hasNext();)n.next().apply(r);return t.getFactory().buildGeometry(e)},mf.prototype.getErrorMessage=function(){return this._errMsg},mf.prototype.interfaces_=function(){return[]},mf.prototype.getClass=function(){return mf},vf.VERBOSE.get=function(){return!1},vf.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(mf,vf);var _f=function(t,e,r){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=r||null},xf={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};_f.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},_f.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*_f.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new sl(this._input.getEnvelopeInternal());e.expandBy(this._distance);var r=new sl(this._result.getEnvelopeInternal());r.expandBy(t),r.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(r)),this.report("Envelope")},_f.prototype.checkDistance=function(){var t=new mf(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},_f.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},_f.prototype.checkPolygonal=function(){this._result instanceof Ac||this._result instanceof Dc||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},_f.prototype.getErrorIndicator=function(){return this._errorIndicator},_f.prototype.getErrorLocation=function(){return this._errorLocation},_f.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},_f.prototype.report=function(t){if(!_f.VERBOSE)return null;ol.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},_f.prototype.getErrorMessage=function(){return this._errorMsg},_f.prototype.interfaces_=function(){return[]},_f.prototype.getClass=function(){return _f},_f.isValidMsg=function(t,e,r){var n=new _f(t,e,r);return n.isValid()?null:n.getErrorMessage()},_f.isValid=function(t,e,r){return!!new _f(t,e,r).isValid()},xf.VERBOSE.get=function(){return!1},xf.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(_f,xf);var bf=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};bf.prototype.getCoordinates=function(){return this._pts},bf.prototype.size=function(){return this._pts.length},bf.prototype.getCoordinate=function(t){return this._pts[t]},bf.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},bf.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Gh.octant(this.getCoordinate(t),this.getCoordinate(t+1))},bf.prototype.setData=function(t){this._data=t},bf.prototype.getData=function(){return this._data},bf.prototype.toString=function(){return fl.toLineString(new Uc(this._pts))},bf.prototype.interfaces_=function(){return[Xh]},bf.prototype.getClass=function(){return bf};var wf=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Ul,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};wf.prototype.getInteriorIntersection=function(){return this._interiorIntersection},wf.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},wf.prototype.getIntersectionSegments=function(){return this._intSegments},wf.prototype.count=function(){return this._intersectionCount},wf.prototype.getIntersections=function(){return this._intersections},wf.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},wf.prototype.setKeepIntersections=function(t){this._keepIntersections=t},wf.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(t,e)&&!this.isEndSegment(r,n))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=r.getCoordinates()[n],s=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,a,s),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=a,this._intSegments[3]=s,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},wf.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},wf.prototype.hasIntersection=function(){return null!==this._interiorIntersection},wf.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},wf.prototype.interfaces_=function(){return[Pp]},wf.prototype.getClass=function(){return wf},wf.createAllIntersectionsFinder=function(t){var e=new wf(t);return e.setFindAllIntersections(!0),e},wf.createAnyIntersectionFinder=function(t){return new wf(t)},wf.createIntersectionCounter=function(t){var e=new wf(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Ef=function(){this._li=new _l,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Ef.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Ef.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ef.prototype.isValid=function(){return this.execute(),this._isValid},Ef.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Ef.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new wf(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new ep;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ef.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new uh(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ef.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+fl.toLineString(t[0],t[1])+" and "+fl.toLineString(t[2],t[3])},Ef.prototype.interfaces_=function(){return[]},Ef.prototype.getClass=function(){return Ef},Ef.computeIntersections=function(t){var e=new Ef(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var If=function t(){this._nv=null;var e=arguments[0];this._nv=new Ef(t.toSegmentStrings(e))};If.prototype.checkValid=function(){this._nv.checkValid()},If.prototype.interfaces_=function(){return[]},If.prototype.getClass=function(){return If},If.toSegmentStrings=function(t){for(var e=new Ul,r=t.iterator();r.hasNext();){var n=r.next();e.add(new bf(n.getCoordinates(),n))}return e},If.checkValid=function(t){new If(t).checkValid()};var Sf=function(t){this._mapOp=t};Sf.prototype.map=function(t){for(var e=new Ul,r=0;r<t.getNumGeometries();r++){var n=this._mapOp.map(t.getGeometryN(r));n.isEmpty()||e.add(n)}return t.getFactory().createGeometryCollection(Hc.toGeometryArray(e))},Sf.prototype.interfaces_=function(){return[]},Sf.prototype.getClass=function(){return Sf},Sf.map=function(t,e){return new Sf(e).map(t)};var Cf=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new Ul,this._resultLineList=new Ul;var t=arguments[0],e=arguments[1],r=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=r};Cf.prototype.collectLines=function(t){for(var e=this,r=this._op.getGraph().getEdgeEnds().iterator();r.hasNext();){var n=r.next();e.collectLineEdge(n,t,e._lineEdgesList),e.collectBoundaryTouchEdge(n,t,e._lineEdgesList)}},Cf.prototype.labelIsolatedLine=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,r)},Cf.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Cf.prototype.collectLineEdge=function(t,e,r){var n=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!ad.isResultOfOp(n,e)||i.isCovered()||(r.add(i),t.setVisitedEdge(!0)))},Cf.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var r=e.next(),n=r.getEdge();if(r.isLineEdge()&&!n.isCoveredSet()){var i=this._op.isCoveredByA(r.getCoordinate());n.setCovered(i)}}},Cf.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next(),n=r.getLabel();r.isIsolated()&&(n.isNull(0)?this.labelIsolatedLine(r,0):this.labelIsolatedLine(r,1))}},Cf.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var r=e.next(),n=this._geometryFactory.createLineString(r.getCoordinates());this._resultLineList.add(n),r.setInResult(!0)}},Cf.prototype.collectBoundaryTouchEdge=function(t,e,r){var n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(yl.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(ad.isResultOfOp(n,e)&&e===ad.INTERSECTION&&(r.add(t.getEdge()),t.setVisitedEdge(!0))))},Cf.prototype.interfaces_=function(){return[]},Cf.prototype.getClass=function(){return Cf};var Pf=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new Ul;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};Pf.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var r=this._geometryFactory.createPoint(e);this._resultPointList.add(r)}},Pf.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var r=e.next();if(!(r.isInResult()||r.isIncidentEdgeInResult()||0!==r.getEdges().getDegree()&&t!==ad.INTERSECTION)){var n=r.getLabel();ad.isResultOfOp(n,t)&&this.filterCoveredNodeToPoint(r)}}},Pf.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Pf.prototype.interfaces_=function(){return[]},Pf.prototype.getClass=function(){return Pf};var Mf=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Mf.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},Mf.prototype.transformPolygon=function(t,e){var r=!0,n=this.transformLinearRing(t.getExteriorRing(),t);null!==n&&n instanceof Nc&&!n.isEmpty()||(r=!1);for(var i=new Ul,o=0;o<t.getNumInteriorRing();o++){var a=this.transformLinearRing(t.getInteriorRingN(o),t);null===a||a.isEmpty()||(a instanceof Nc||(r=!1),i.add(a))}if(r)return this._factory.createPolygon(n,i.toArray([]));var s=new Ul;return null!==n&&s.add(n),s.addAll(i),this._factory.buildGeometry(s)},Mf.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},Mf.prototype.getInputGeometry=function(){return this._inputGeom},Mf.prototype.transformMultiLineString=function(t,e){for(var r=new Ul,n=0;n<t.getNumGeometries();n++){var i=this.transformLineString(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},Mf.prototype.transformCoordinates=function(t,e){return this.copy(t)},Mf.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},Mf.prototype.transformMultiPoint=function(t,e){for(var r=new Ul,n=0;n<t.getNumGeometries();n++){var i=this.transformPoint(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},Mf.prototype.transformMultiPolygon=function(t,e){for(var r=new Ul,n=0;n<t.getNumGeometries();n++){var i=this.transformPolygon(t.getGeometryN(n),t);null!==i&&(i.isEmpty()||r.add(i))}return this._factory.buildGeometry(r)},Mf.prototype.copy=function(t){return t.copy()},Mf.prototype.transformGeometryCollection=function(t,e){for(var r=new Ul,n=0;n<t.getNumGeometries();n++){var i=this.transform(t.getGeometryN(n));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||r.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Hc.toGeometryArray(r)):this._factory.buildGeometry(r)},Mf.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Tc)return this.transformPoint(t,null);if(t instanceof kc)return this.transformMultiPoint(t,null);if(t instanceof Nc)return this.transformLinearRing(t,null);if(t instanceof Pc)return this.transformLineString(t,null);if(t instanceof gc)return this.transformMultiLineString(t,null);if(t instanceof Ac)return this.transformPolygon(t,null);if(t instanceof Dc)return this.transformMultiPolygon(t,null);if(t instanceof dc)return this.transformGeometryCollection(t,null);throw new ku("Unknown Geometry subtype: "+t.getClass().getName())},Mf.prototype.transformLinearRing=function(t,e){var r=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===r)return this._factory.createLinearRing(null);var n=r.size();return n>0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},Mf.prototype.interfaces_=function(){return[]},Mf.prototype.getClass=function(){return Mf};var Tf=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Wh,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Pc&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};Tf.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n<r;n++){var i=t.get(n),o=this.findSnapForVertex(i,e);null!==o&&(t.set(n,new Bu(o)),0===n&&this._isClosed&&t.set(t.size()-1,new Bu(o)))}},Tf.prototype.findSnapForVertex=function(t,e){for(var r=0;r<e.length;r++){if(t.equals2D(e[r]))return null;if(t.distance(e[r])<this._snapTolerance)return e[r]}return null},Tf.prototype.snapTo=function(t){var e=new Vl(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},Tf.prototype.snapSegments=function(t,e){if(0===e.length)return null;var r=e.length;e[0].equals2D(e[e.length-1])&&(r=e.length-1);for(var n=0;n<r;n++){var i=e[n],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new Bu(i),!1)}},Tf.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=Nu.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(r._seg.p0=e.get(o),r._seg.p1=e.get(o+1),r._seg.p0.equals2D(t)||r._seg.p1.equals2D(t)){if(r._allowSnappingToSourceVertices)continue;return-1}var a=r._seg.distance(t);a<r._snapTolerance&&a<n&&(n=a,i=o)}return i},Tf.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Tf.prototype.interfaces_=function(){return[]},Tf.prototype.getClass=function(){return Tf},Tf.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Lf=function(t){this._srcGeom=t||null},Af={SNAP_PRECISION_FACTOR:{configurable:!0}};Lf.prototype.snapTo=function(t,e){var r=this.extractTargetCoordinates(t);return new kf(e,r).transform(this._srcGeom)},Lf.prototype.snapToSelf=function(t,e){var r=this.extractTargetCoordinates(this._srcGeom),n=new kf(t,r,!0).transform(this._srcGeom),i=n;return e&&Xu(i,Lc)&&(i=n.buffer(0)),i},Lf.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Lf.prototype.extractTargetCoordinates=function(t){for(var e=new sc,r=t.getCoordinates(),n=0;n<r.length;n++)e.add(r[n]);return e.toArray(new Array(0).fill(null))},Lf.prototype.computeMinimumSegmentLength=function(t){for(var e=Nu.MAX_VALUE,r=0;r<t.length-1;r++){var n=t[r].distance(t[r+1]);n<e&&(e=n)}return e},Lf.prototype.interfaces_=function(){return[]},Lf.prototype.getClass=function(){return Lf},Lf.snap=function(t,e,r){var n=new Array(2).fill(null),i=new Lf(t);n[0]=i.snapTo(e,r);var o=new Lf(e);return n[1]=o.snapTo(n[0],r),n},Lf.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=Lf.computeSizeBasedSnapTolerance(t),r=t.getPrecisionModel();if(r.getType()===Xc.FIXED){var n=1/r.getScale()*2/1.415;n>e&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(Lf.computeOverlaySnapTolerance(i),Lf.computeOverlaySnapTolerance(o))}},Lf.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Lf.SNAP_PRECISION_FACTOR},Lf.snapToSelf=function(t,e,r){return new Lf(t).snapToSelf(e,r)},Af.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Lf,Af);var kf=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||null,this._isSelfSnap=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var r=new Tf(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Mf),Nf=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Nf.prototype.getCommon=function(){return Nu.longBitsToDouble(this._commonBits)},Nf.prototype.add=function(t){var e=Nu.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=Nf.signExpBits(this._commonBits),this._isFirst=!1,null):Nf.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=Nf.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=Nf.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},Nf.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=Nu.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+Nu.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},Nf.prototype.interfaces_=function(){return[]},Nf.prototype.getClass=function(){return Nf},Nf.getBit=function(t,e){return 0!=(t&1<<e)?1:0},Nf.signExpBits=function(t){return t>>52},Nf.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},Nf.numCommonMostSigMantissaBits=function(t,e){for(var r=0,n=52;n>=0;n--){if(Nf.getBit(t,n)!==Nf.getBit(e,n))return r;r++}return 52};var Df=function(){this._commonCoord=null,this._ccFilter=new Of},Rf={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Df.prototype.addCommonBits=function(t){var e=new zf(this._commonCoord);t.apply(e),t.geometryChanged()},Df.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new Bu(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new zf(e);return t.apply(r),t.geometryChanged(),t},Df.prototype.getCommonCoordinate=function(){return this._commonCoord},Df.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Df.prototype.interfaces_=function(){return[]},Df.prototype.getClass=function(){return Df},Rf.CommonCoordinateFilter.get=function(){return Of},Rf.Translater.get=function(){return zf},Object.defineProperties(Df,Rf);var Of=function(){this._commonBitsX=new Nf,this._commonBitsY=new Nf};Of.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Of.prototype.getCommonCoordinate=function(){return new Bu(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Of.prototype.interfaces_=function(){return[Ml]},Of.prototype.getClass=function(){return Of};var zf=function(){this.trans=null;var t=arguments[0];this.trans=t};zf.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},zf.prototype.isDone=function(){return!1},zf.prototype.isGeometryChanged=function(){return!0},zf.prototype.interfaces_=function(){return[fc]},zf.prototype.getClass=function(){return zf};var Ff=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};Ff.prototype.selfSnap=function(t){return new Lf(t).snapTo(t,this._snapTolerance)},Ff.prototype.removeCommonBits=function(t){this._cbr=new Df,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},Ff.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},Ff.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=ad.overlayOp(e[0],e[1],t);return this.prepareResult(r)},Ff.prototype.checkValid=function(t){t.isValid()||ol.out.println("Snapped geometry is invalid")},Ff.prototype.computeSnapTolerance=function(){this._snapTolerance=Lf.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Ff.prototype.snap=function(t){var e=this.removeCommonBits(t);return Lf.snap(e[0],e[1],this._snapTolerance)},Ff.prototype.interfaces_=function(){return[]},Ff.prototype.getClass=function(){return Ff},Ff.overlayOp=function(t,e,r){return new Ff(t,e).getResultGeometry(r)},Ff.union=function(t,e){return Ff.overlayOp(t,e,ad.UNION)},Ff.intersection=function(t,e){return Ff.overlayOp(t,e,ad.INTERSECTION)},Ff.symDifference=function(t,e){return Ff.overlayOp(t,e,ad.SYMDIFFERENCE)},Ff.difference=function(t,e){return Ff.overlayOp(t,e,ad.DIFFERENCE)};var Bf=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Bf.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=ad.overlayOp(this._geom[0],this._geom[1],t);r=!0}catch(t){if(!(t instanceof dl))throw t;n=t}if(!r)try{e=Ff.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof dl?n:t}return e},Bf.prototype.interfaces_=function(){return[]},Bf.prototype.getClass=function(){return Bf},Bf.overlayOp=function(t,e,r){return new Bf(t,e).getResultGeometry(r)},Bf.union=function(t,e){return Bf.overlayOp(t,e,ad.UNION)},Bf.intersection=function(t,e){return Bf.overlayOp(t,e,ad.INTERSECTION)},Bf.symDifference=function(t,e){return Bf.overlayOp(t,e,ad.SYMDIFFERENCE)},Bf.difference=function(t,e){return Bf.overlayOp(t,e,ad.DIFFERENCE)};var Uf=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Uf.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},Uf.prototype.interfaces_=function(){return[]},Uf.prototype.getClass=function(){return Uf};var jf=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},Vf={INSERT:{configurable:!0},DELETE:{configurable:!0}};jf.prototype.isDelete=function(){return this._eventType===jf.DELETE},jf.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},jf.prototype.getObject=function(){return this._obj},jf.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},jf.prototype.getInsertEvent=function(){return this._insertEvent},jf.prototype.isInsert=function(){return this._eventType===jf.INSERT},jf.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},jf.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},jf.prototype.interfaces_=function(){return[Ru]},jf.prototype.getClass=function(){return jf},Vf.INSERT.get=function(){return 1},Vf.DELETE.get=function(){return 2},Object.defineProperties(jf,Vf);var qf=function(){};qf.prototype.interfaces_=function(){return[]},qf.prototype.getClass=function(){return qf};var Gf=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};Gf.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(Gf.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},Gf.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Gf.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},Gf.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Gf.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},Gf.prototype.hasProperIntersection=function(){return this._hasProper},Gf.prototype.hasIntersection=function(){return this._hasIntersection},Gf.prototype.isDone=function(){return this._isDone},Gf.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},Gf.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},Gf.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=r.getCoordinates()[n],s=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,a,s),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},Gf.prototype.interfaces_=function(){return[]},Gf.prototype.getClass=function(){return Gf},Gf.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Xf=function(t){function e(){t.call(this),this.events=new Ul,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Nh.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var r=this.events.get(e);if(r.isInsert()&&this.processOverlaps(e,r.getDeleteEventIndex(),r,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof Gf&&Xu(arguments[0],Fl)&&Xu(arguments[1],Fl)){var n=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(n,n),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&Xu(arguments[0],Fl)&&arguments[1]instanceof Gf){var a=arguments[0],s=arguments[1];arguments[2]?this.addEdges(a,null):this.addEdges(a),this.computeIntersections(s)}},e.prototype.addEdge=function(t,e){for(var r=t.getMonotoneChainEdge(),n=r.getStartIndexes(),i=0;i<n.length-1;i++){var o=new Uf(r,i),a=new jf(e,r.getMinX(i),o);this.events.add(a),this.events.add(new jf(r.getMaxX(i),a))}},e.prototype.processOverlaps=function(t,e,r,n){for(var i=r.getObject(),o=t;o<e;o++){var a=this.events.get(o);if(a.isInsert()){var s=a.getObject();r.isSameLabel(a)||(i.computeIntersections(s,n),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var r=arguments[1],n=arguments[0].iterator();n.hasNext();){var i=n.next();this.addEdge(i,r)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(qf),Zf=function(){this._min=Nu.POSITIVE_INFINITY,this._max=Nu.NEGATIVE_INFINITY},Yf={NodeComparator:{configurable:!0}};Zf.prototype.getMin=function(){return this._min},Zf.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},Zf.prototype.getMax=function(){return this._max},Zf.prototype.toString=function(){return fl.toLineString(new Bu(this._min,0),new Bu(this._max,0))},Zf.prototype.interfaces_=function(){return[]},Zf.prototype.getClass=function(){return Zf},Yf.NodeComparator.get=function(){return Wf},Object.defineProperties(Zf,Yf);var Wf=function(){};Wf.prototype.compare=function(t,e){var r=t,n=e,i=(r._min+r._max)/2,o=(n._min+n._max)/2;return i<o?-1:i>o?1:0},Wf.prototype.interfaces_=function(){return[zu]},Wf.prototype.getClass=function(){return Wf};var Hf=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,this._item=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Zf),Jf=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Zf),Kf=function(){this._leaves=new Ul,this._root=null,this._level=0};Kf.prototype.buildTree=function(){Nh.sort(this._leaves,new Zf.NodeComparator);for(var t=this._leaves,e=null,r=new Ul;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},Kf.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Hf(t,e,r))},Kf.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},Kf.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},Kf.prototype.printNode=function(t){ol.out.println(fl.toLineString(new Bu(t._min,this._level),new Bu(t._max,this._level)))},Kf.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},Kf.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r<t.size();r+=2){var n=t.get(r);if(null===(r+1<t.size()?t.get(r):null))e.add(n);else{var i=new Jf(t.get(r),t.get(r+1));e.add(i)}}},Kf.prototype.interfaces_=function(){return[]},Kf.prototype.getClass=function(){return Kf};var $f=function(){this._items=new Ul};$f.prototype.visitItem=function(t){this._items.add(t)},$f.prototype.getItems=function(){return this._items},$f.prototype.interfaces_=function(){return[Th]},$f.prototype.getClass=function(){return $f};var Qf=function(){this._index=null;var t=arguments[0];if(!Xu(t,Lc))throw new ku("Argument must be Polygonal");this._index=new rd(t)},td={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};Qf.prototype.locate=function(t){var e=new bl(t),r=new ed(e);return this._index.query(t.y,t.y,r),e.getLocation()},Qf.prototype.interfaces_=function(){return[_p]},Qf.prototype.getClass=function(){return Qf},td.SegmentVisitor.get=function(){return ed},td.IntervalIndexedGeometry.get=function(){return rd},Object.defineProperties(Qf,td);var ed=function(){this._counter=null;var t=arguments[0];this._counter=t};ed.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},ed.prototype.interfaces_=function(){return[Th]},ed.prototype.getClass=function(){return ed};var rd=function(){this._index=new Kf;var t=arguments[0];this.init(t)};rd.prototype.init=function(t){for(var e=nf.getLines(t).iterator();e.hasNext();){var r=e.next().getCoordinates();this.addLine(r)}},rd.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var r=new Wh(t[e-1],t[e]),n=Math.min(r.p0.y,r.p1.y),i=Math.max(r.p0.y,r.p1.y);this._index.insert(n,i,r)}},rd.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new $f;return this._index.query(t,e,r),r.getItems()}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._index.query(n,i,o)}},rd.prototype.interfaces_=function(){return[]},rd.prototype.getClass=function(){return rd};var nd=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new Gc,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new of,2===arguments.length){var e=arguments[0],r=arguments[1],n=Tl.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=r,this._boundaryNodeRule=n,null!==r&&this.add(r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=a,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,r){var n=this._nodes.addNode(r).getLabel(),i=1;n.getLocation(t,nh.ON)===qu.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);n.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var r=arguments[1],n=arguments[2],i=new Gf(arguments[0],!0,!1);i.setIsDoneIfProperInt(n);var o=this.createEdgeSetIntersector(),a=this._parentGeom instanceof Nc||this._parentGeom instanceof Ac||this._parentGeom instanceof Dc,s=r||!a;return o.computeIntersections(this._edges,i,s),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();)e.next().eiList.addSplitEdges(t)},e.prototype.computeEdgeIntersections=function(t,e,r){var n=new Gf(e,r,!0);return n.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,n),n},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof Tc){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,qu.INTERIOR)}else if(arguments[0]instanceof Bu){var e=arguments[0];this.insertPoint(this._argIndex,e,qu.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),qu.EXTERIOR,qu.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var r=t.getInteriorRingN(e);this.addPolygonRing(r,qu.INTERIOR,qu.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],qu.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],qu.BOUNDARY)},e.prototype.addLineString=function(t){var e=ql.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var r=new Rp(e,new ph(this._argIndex,qu.INTERIOR));this._lineEdgeMap.put(t,r),this.insertEdge(r),yl.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,r){if(this.isBoundaryNode(t,e))return null;r===qu.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=ql.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;wl.isCCW(n)&&(i=r,o=e);var a=new Rp(n,new ph(this._argIndex,qu.BOUNDARY,i,o));this._lineEdgeMap.put(t,a),this.insertEdge(a),this.insertPoint(this._argIndex,n[0],qu.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new ph(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new Xf},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,n)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof Dc&&(this._useBoundaryDeterminationRule=!1),e instanceof Ac)this.addPolygon(e);else if(e instanceof Pc)this.addLineString(e);else if(e instanceof Tc)this.addPoint(e);else if(e instanceof kc)this.addCollection(e);else if(e instanceof gc)this.addCollection(e);else if(e instanceof Dc)this.addCollection(e);else{if(!(e instanceof dc))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var r=t.getGeometryN(e);this.add(r)}},e.prototype.locate=function(t){return Xu(this._parentGeom,Lc)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new Qf(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?qu.BOUNDARY:qu.INTERIOR},e}(Ih),id=function(){if(this._li=new _l,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new nd(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=Tl.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new nd(0,e,n),this._arg[1]=new nd(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new nd(0,i,a),this._arg[1]=new nd(1,o,a)}};id.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},id.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},id.prototype.interfaces_=function(){return[]},id.prototype.getClass=function(){return id};var od=function(){};od.prototype.interfaces_=function(){return[]},od.prototype.getClass=function(){return od},od.map=function(){if(arguments[0]instanceof Sl&&Xu(arguments[1],od.MapOp)){for(var t=arguments[0],e=arguments[1],r=new Ul,n=0;n<t.getNumGeometries();n++){var i=e.map(t.getGeometryN(n));null!==i&&r.add(i)}return t.getFactory().buildGeometry(r)}if(Xu(arguments[0],Rl)&&Xu(arguments[1],od.MapOp)){for(var o=arguments[0],a=arguments[1],s=new Ul,u=o.iterator();u.hasNext();){var l=u.next(),c=a.map(l);null!==c&&s.add(c)}return s}},od.MapOp=function(){};var ad=function(t){function e(){var e=arguments[0],r=arguments[1];t.call(this,e,r),this._ptLocator=new of,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Cp,this._resultPolyList=new Ul,this._resultLineList=new Ul,this._resultPointList=new Ul,this._graph=new Ih(new Ip),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var r=e.getLabel(),n=t.getLabel();e.isPointwiseEqual(t)||(n=new ph(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(r),i.add(n),r.merge(n)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),r=e.getSym();e.isInResult()&&r.isInResult()&&(e.setInResult(!1),r.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,r,n,i){var o=new Ul;return o.addAll(t),o.addAll(r),o.addAll(n),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()},e.prototype.isCovered=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();if(this._ptLocator.locate(t,n)!==qu.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new Ul,e=this._edgeList.iterator();e.hasNext();){var r=e.next();r.isCollapsed()&&(e.remove(),t.add(r.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getEdges().getLabel();e.getLabel().merge(r)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();this.insertUniqueEdge(r)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new Ul;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),If.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var r=new Sh(this._geomFact);r.add(this._graph),this._resultPolyList=r.getPolygons();var n=new Cf(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);var i=new Pf(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var r=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,r)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var r=e.next();this._graph.addNode(r.getCoordinate()).setLabel(t,r.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var n=r.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,nh.RIGHT),i.getLocation(1,nh.RIGHT),t)&&n.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),r=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(var i=0;i<2;i++)r.isNull(i)||!r.isArea()||n.isNull(i)||(0===n.getDelta(i)?r.toLine(i):(yl.isTrue(!n.isNull(i,nh.LEFT),"depth of LEFT side has not been initialized"),r.setLocation(i,nh.LEFT,n.getLocation(i,nh.LEFT)),yl.isTrue(!n.isNull(i,nh.RIGHT),"depth of RIGHT side has not been initialized"),r.setLocation(i,nh.RIGHT,n.getLocation(i,nh.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),r=e.getLabel();e.isIsolated()&&(r.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(r)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(id);ad.overlayOp=function(t,e,r){return new ad(t,e).getResultGeometry(r)},ad.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return ad.createEmptyResult(ad.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var r=e;return Sf.map(t,{interfaces_:function(){return[od.MapOp]},map:function(t){return t.intersection(r)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Bf.overlayOp(t,e,ad.INTERSECTION)},ad.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ad.createEmptyResult(ad.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Bf.overlayOp(t,e,ad.SYMDIFFERENCE)},ad.resultDimension=function(t,e,r){var n=e.getDimension(),i=r.getDimension(),o=-1;switch(t){case ad.INTERSECTION:o=Math.min(n,i);break;case ad.UNION:o=Math.max(n,i);break;case ad.DIFFERENCE:o=n;break;case ad.SYMDIFFERENCE:o=Math.max(n,i)}return o},ad.createEmptyResult=function(t,e,r,n){var i=null;switch(ad.resultDimension(t,e,r)){case-1:i=n.createGeometryCollection(new Array(0).fill(null));break;case 0:i=n.createPoint();break;case 1:i=n.createLineString();break;case 2:i=n.createPolygon()}return i},ad.difference=function(t,e){return t.isEmpty()?ad.createEmptyResult(ad.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Bf.overlayOp(t,e,ad.DIFFERENCE))},ad.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=t.getLocation(0),n=t.getLocation(1);return ad.isResultOfOp(r,n,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===qu.BOUNDARY&&(i=qu.INTERIOR),o===qu.BOUNDARY&&(o=qu.INTERIOR),arguments[2]){case ad.INTERSECTION:return i===qu.INTERIOR&&o===qu.INTERIOR;case ad.UNION:return i===qu.INTERIOR||o===qu.INTERIOR;case ad.DIFFERENCE:return i===qu.INTERIOR&&o!==qu.INTERIOR;case ad.SYMDIFFERENCE:return i===qu.INTERIOR&&o!==qu.INTERIOR||i!==qu.INTERIOR&&o===qu.INTERIOR}return!1}},ad.INTERSECTION=1,ad.UNION=2,ad.DIFFERENCE=3,ad.SYMDIFFERENCE=4;var sd=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new of,this._seg=new Wh;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};sd.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,r=0;r<this._linework.getNumGeometries();r++)for(var n=e._linework.getGeometryN(r).getCoordinateSequence(),i=0;i<n.size()-1;i++)if(n.getCoordinate(i,e._seg.p0),n.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0;return!1},sd.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?qu.BOUNDARY:this._ptLocator.locate(t,this._g)},sd.prototype.extractLinework=function(t){var e=new ud;t.apply(e);var r=e.getLinework(),n=Hc.toLineStringArray(r);return t.getFactory().createMultiLineString(n)},sd.prototype.interfaces_=function(){return[]},sd.prototype.getClass=function(){return sd};var ud=function(){this._linework=null,this._linework=new Ul};ud.prototype.getLinework=function(){return this._linework},ud.prototype.filter=function(t){if(t instanceof Ac){var e=t;this._linework.add(e.getExteriorRing());for(var r=0;r<e.getNumInteriorRing();r++)this._linework.add(e.getInteriorRingN(r))}},ud.prototype.interfaces_=function(){return[pc]},ud.prototype.getClass=function(){return ud};var ld=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};ld.prototype.extractPoints=function(t,e,r){for(var n=t.getCoordinates(),i=0;i<n.length-1;i++)this.computeOffsetPoints(n[i],n[i+1],e,r)},ld.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},ld.prototype.getPoints=function(t){for(var e=new Ul,r=nf.getLines(this._g).iterator();r.hasNext();){var n=r.next();this.extractPoints(n,t,e)}return e},ld.prototype.computeOffsetPoints=function(t,e,r,n){var i=e.x-t.x,o=e.y-t.y,a=Math.sqrt(i*i+o*o),s=r*i/a,u=r*o/a,l=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var h=new Bu(l-u,c+s);n.add(h)}if(this._doRight){var p=new Bu(l+u,c-s);n.add(p)}},ld.prototype.interfaces_=function(){return[]},ld.prototype.getClass=function(){return ld};var cd=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new Ul;var e=arguments[0],r=arguments[1],n=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,r),this._geom=[e,r,n],this._locFinder=[new sd(this._geom[0],this._boundaryDistanceTolerance),new sd(this._geom[1],this._boundaryDistanceTolerance),new sd(this._geom[2],this._boundaryDistanceTolerance)]},hd={TOLERANCE:{configurable:!0}};cd.prototype.reportResult=function(t,e,r){ol.out.println("Overlay result invalid - A:"+qu.toLocationSymbol(e[0])+" B:"+qu.toLocationSymbol(e[1])+" expected:"+(r?"i":"e")+" actual:"+qu.toLocationSymbol(e[2]))},cd.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);return this.checkValid(t)},cd.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],r=0;r<this._testCoords.size();r++){var n=t._testCoords.get(r);if(!t.checkValid(e,n))return t._invalidLocation=n,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!cd.hasLocation(this._location,qu.BOUNDARY)||this.isValidResult(i,this._location)}},cd.prototype.addTestPts=function(t){var e=new ld(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},cd.prototype.isValidResult=function(t,e){var r=ad.isResultOfOp(e[0],e[1],t),n=!(r^e[2]===qu.INTERIOR);return n||this.reportResult(t,e,r),n},cd.prototype.getInvalidLocation=function(){return this._invalidLocation},cd.prototype.interfaces_=function(){return[]},cd.prototype.getClass=function(){return cd},cd.hasLocation=function(t,e){for(var r=0;r<3;r++)if(t[r]===e)return!0;return!1},cd.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Lf.computeSizeBasedSnapTolerance(t),Lf.computeSizeBasedSnapTolerance(e))},cd.isValid=function(t,e,r,n){return new cd(t,e,n).isValid(r)},hd.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(cd,hd);var pd=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};pd.prototype.extractElements=function(t,e){if(null===t)return null;for(var r=0;r<t.getNumGeometries();r++){var n=t.getGeometryN(r);this._skipEmpty&&n.isEmpty()||e.add(n)}},pd.prototype.combine=function(){for(var t=new Ul,e=this._inputGeoms.iterator();e.hasNext();){var r=e.next();this.extractElements(r,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},pd.prototype.interfaces_=function(){return[]},pd.prototype.getClass=function(){return pd},pd.combine=function(){if(1===arguments.length){return new pd(arguments[0]).combine()}if(2===arguments.length){return new pd(pd.createList(arguments[0],arguments[1])).combine()}if(3===arguments.length){return new pd(pd.createList(arguments[0],arguments[1],arguments[2])).combine()}},pd.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},pd.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],r=new Ul;return r.add(t),r.add(e),r}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],a=new Ul;return a.add(n),a.add(i),a.add(o),a}};var fd=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new Ul)},dd={STRTREE_NODE_CAPACITY:{configurable:!0}};fd.prototype.reduceToGeometries=function(t){for(var e=new Ul,r=t.iterator();r.hasNext();){var n=r.next(),i=null;Xu(n,Fl)?i=this.unionTree(n):n instanceof Sl&&(i=n),e.add(i)}return e},fd.prototype.extractByEnvelope=function(t,e,r){for(var n=new Ul,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?n.add(o):r.add(o)}return this._geomFactory.buildGeometry(n)},fd.prototype.unionOptimized=function(t,e){var r=t.getEnvelopeInternal(),n=e.getEnvelopeInternal();if(!r.intersects(n))return pd.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=r.intersection(n);return this.unionUsingEnvelopeIntersection(t,e,i)},fd.prototype.union=function(){if(null===this._inputPolys)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new Bh(fd.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var r=e.next();t.insert(r.getEnvelopeInternal(),r)}this._inputPolys=null;var n=t.itemsTree();return this.unionTree(n)},fd.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];if(n-r<=1){var i=fd.getGeometry(e,r);return this.unionSafe(i,null)}if(n-r==2)return this.unionSafe(fd.getGeometry(e,r),fd.getGeometry(e,r+1));var o=Math.trunc((n+r)/2),a=this.binaryUnion(e,r,o),s=this.binaryUnion(e,o,n);return this.unionSafe(a,s)}},fd.prototype.repeatedUnion=function(t){for(var e=null,r=t.iterator();r.hasNext();){var n=r.next();e=null===e?n.copy():e.union(n)}return e},fd.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},fd.prototype.unionActual=function(t,e){return fd.restrictToPolygons(t.union(e))},fd.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},fd.prototype.unionUsingEnvelopeIntersection=function(t,e,r){var n=new Ul,i=this.extractByEnvelope(r,t,n),o=this.extractByEnvelope(r,e,n),a=this.unionActual(i,o);return n.add(a),pd.combine(n)},fd.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e.getFactory().createGeometryCollection([e,r]).buffer(0)}},fd.prototype.interfaces_=function(){return[]},fd.prototype.getClass=function(){return fd},fd.restrictToPolygons=function(t){if(Xu(t,Lc))return t;var e=rf.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(Hc.toPolygonArray(e))},fd.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},fd.union=function(t){return new fd(t).union()},dd.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(fd,dd);var gd=function(){};function yd(){return new md}function md(){this.reset()}gd.prototype.interfaces_=function(){return[]},gd.prototype.getClass=function(){return gd},gd.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ad.createEmptyResult(ad.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Bf.overlayOp(t,e,ad.UNION)},md.prototype={constructor:md,reset:function(){this.s=this.t=0},add:function(t){_d(vd,t,this.t),_d(this,vd.s,this.s),this.s?this.t+=vd.t:this.s=vd.t},valueOf:function(){return this.s}};var vd=new md;function _d(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var xd=1e-6,bd=Math.PI,wd=bd/2,Ed=bd/4,Id=2*bd,Sd=180/bd,Cd=bd/180,Pd=Math.abs,Md=Math.atan,Td=Math.atan2,Ld=Math.cos,Ad=Math.sin,kd=Math.sqrt;function Nd(t){return t>1?0:t<-1?bd:Math.acos(t)}function Dd(t){return t>1?wd:t<-1?-wd:Math.asin(t)}function Rd(){}function Od(t,e){t&&Ud.hasOwnProperty(t.type)&&Ud[t.type](t,e)}var zd,Fd,Bd={Feature:function(t,e){Od(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)Od(r[n].geometry,e)}},Ud={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){jd(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)jd(r[n],e,0)},Polygon:function(t,e){Vd(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)Vd(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)Od(r[n],e)}};function jd(t,e,r){var n,i=-1,o=t.length-r;for(e.lineStart();++i<o;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function Vd(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)jd(t[r],e,1);e.polygonEnd()}yd(),yd();function qd(t){return[Td(t[1],t[0]),Dd(t[2])]}function Gd(t){var e=t[0],r=t[1],n=Ld(r);return[n*Ld(e),n*Ad(e),Ad(r)]}function Xd(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Zd(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Yd(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Wd(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Hd(t){var e=kd(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}yd();function Jd(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function Kd(t,e){return[t>bd?t-Id:t<-bd?t+Id:t,e]}function $d(t){return function(e,r){return[(e+=t)>bd?e-Id:e<-bd?e+Id:e,r]}}function Qd(t){var e=$d(t);return e.invert=$d(-t),e}function tg(t,e){var r=Ld(t),n=Ad(t),i=Ld(e),o=Ad(e);function a(t,e){var a=Ld(e),s=Ld(t)*a,u=Ad(t)*a,l=Ad(e),c=l*r+s*n;return[Td(u*i-c*o,s*r-l*n),Dd(c*i+u*o)]}return a.invert=function(t,e){var a=Ld(e),s=Ld(t)*a,u=Ad(t)*a,l=Ad(e),c=l*i-u*o;return[Td(u*i+l*o,s*r+c*n),Dd(c*r-s*n)]},a}function eg(t,e){(e=Gd(e))[0]-=t,Hd(e);var r=Nd(-e[1]);return((-e[2]<0?-r:r)+Id-xd)%Id}function rg(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:Rd,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function ng(t,e){return Pd(t[0]-e[0])<xd&&Pd(t[1]-e[1])<xd}function ig(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function og(t,e,r,n,i){var o,a,s=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,r,n=t[0],a=t[e];if(ng(n,a)){for(i.lineStart(),o=0;o<e;++o)i.point((n=t[o])[0],n[1]);i.lineEnd()}else s.push(r=new ig(n,t,null,!0)),u.push(r.o=new ig(n,null,r,!1)),s.push(r=new ig(a,t,null,!1)),u.push(r.o=new ig(a,null,r,!0))}})),s.length){for(u.sort(e),ag(s),ag(u),o=0,a=u.length;o<a;++o)u[o].e=r=!r;for(var l,c,h=s[0];;){for(var p=h,f=!0;p.v;)if((p=p.n)===h)return;l=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(f)for(o=0,a=l.length;o<a;++o)i.point((c=l[o])[0],c[1]);else n(p.x,p.n.x,1,i);p=p.n}else{if(f)for(l=p.p.z,o=l.length-1;o>=0;--o)i.point((c=l[o])[0],c[1]);else n(p.x,p.p.x,-1,i);p=p.p}l=(p=p.o).z,f=!f}while(!p.v);i.lineEnd()}}}function ag(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function sg(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}Kd.invert=Kd;1===(zd=sg).length&&(Fd=zd,zd=function(t,e){return sg(Fd(t),e)});function ug(t){for(var e,r,n,i=t.length,o=-1,a=0;++o<i;)a+=t[o].length;for(r=new Array(a);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--a]=n[e];return r}var lg=1e9,cg=-lg;var hg=yd();yd();function pg(t){return t}yd(),yd();var fg=1/0,dg=fg,gg=-fg,yg=gg,mg={point:function(t,e){t<fg&&(fg=t);t>gg&&(gg=t);e<dg&&(dg=e);e>yg&&(yg=e)},lineStart:Rd,lineEnd:Rd,polygonStart:Rd,polygonEnd:Rd,result:function(){var t=[[fg,dg],[gg,yg]];return gg=yg=-(dg=fg=1/0),t}};yd();function vg(t,e,r,n){return function(i,o){var a,s,u,l=e(o),c=i.invert(n[0],n[1]),h=rg(),p=e(h),f=!1,d={point:g,lineStart:m,lineEnd:v,polygonStart:function(){d.point=_,d.lineStart=x,d.lineEnd=b,s=[],a=[]},polygonEnd:function(){d.point=g,d.lineStart=m,d.lineEnd=v,s=ug(s);var t=function(t,e){var r=e[0],n=e[1],i=[Ad(r),-Ld(r),0],o=0,a=0;hg.reset();for(var s=0,u=t.length;s<u;++s)if(c=(l=t[s]).length)for(var l,c,h=l[c-1],p=h[0],f=h[1]/2+Ed,d=Ad(f),g=Ld(f),y=0;y<c;++y,p=v,d=x,g=b,h=m){var m=l[y],v=m[0],_=m[1]/2+Ed,x=Ad(_),b=Ld(_),w=v-p,E=w>=0?1:-1,I=E*w,S=I>bd,C=d*x;if(hg.add(Td(C*E*Ad(I),g*b+C*Ld(I))),o+=S?w+E*Id:w,S^p>=r^v>=r){var P=Zd(Gd(h),Gd(m));Hd(P);var M=Zd(i,P);Hd(M);var T=(S^w>=0?-1:1)*Dd(M[2]);(n>T||n===T&&(P[0]||P[1]))&&(a+=S^w>=0?1:-1)}}return(o<-1e-6||o<xd&&hg<-1e-6)^1&a}(a,c);s.length?(f||(o.polygonStart(),f=!0),og(s,xg,t,r,o)):t&&(f||(o.polygonStart(),f=!0),o.lineStart(),r(null,null,1,o),o.lineEnd()),f&&(o.polygonEnd(),f=!1),s=a=null},sphere:function(){o.polygonStart(),o.lineStart(),r(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function g(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&o.point(e,r)}function y(t,e){var r=i(t,e);l.point(r[0],r[1])}function m(){d.point=y,l.lineStart()}function v(){d.point=g,l.lineEnd()}function _(t,e){u.push([t,e]);var r=i(t,e);p.point(r[0],r[1])}function x(){p.lineStart(),u=[]}function b(){_(u[0][0],u[0][1]),p.lineEnd();var t,e,r,n,i=p.clean(),l=h.result(),c=l.length;if(u.pop(),a.push(u),u=null,c)if(1&i){if((e=(r=l[0]).length-1)>0){for(f||(o.polygonStart(),f=!0),o.lineStart(),t=0;t<e;++t)o.point((n=r[t])[0],n[1]);o.lineEnd()}}else c>1&&2&i&&l.push(l.pop().concat(l.shift())),s.push(l.filter(_g))}return d}}function _g(t){return t.length>1}function xg(t,e){return((t=t.x)[0]<0?t[1]-wd-xd:wd-t[1])-((e=e.x)[0]<0?e[1]-wd-xd:wd-e[1])}var bg=vg((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?bd:-bd,u=Pd(o-r);Pd(u-bd)<xd?(t.point(r,n=(n+a)/2>0?wd:-wd),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(o,n),e=0):i!==s&&u>=bd&&(Pd(r-i)<xd&&(r-=i*xd),Pd(o-s)<xd&&(o-=s*xd),n=function(t,e,r,n){var i,o,a=Ad(t-r);return Pd(a)>xd?Md((Ad(e)*(o=Ld(n))*Ad(r)-Ad(n)*(i=Ld(e))*Ad(t))/(i*o*a)):(e+n)/2}(r,n,o,a),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=o,n=a),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*wd,n.point(-bd,i),n.point(0,i),n.point(bd,i),n.point(bd,0),n.point(bd,-i),n.point(0,-i),n.point(-bd,-i),n.point(-bd,0),n.point(-bd,i);else if(Pd(t[0]-e[0])>xd){var o=t[0]<e[0]?bd:-bd;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(e[0],e[1])}),[-bd,-wd]);function wg(t){return function(e){var r=new Eg;for(var n in t)r[n]=t[n];return r.stream=e,r}}function Eg(){}function Ig(t,e,r){var n=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&Bd.hasOwnProperty(t.type)?Bd[t.type](t,e):Od(t,e)}(r,t.stream(mg));var a=mg.result(),s=Math.min(n/(a[1][0]-a[0][0]),i/(a[1][1]-a[0][1])),u=+e[0][0]+(n-s*(a[1][0]+a[0][0]))/2,l=+e[0][1]+(i-s*(a[1][1]+a[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*s).translate([u,l])}Eg.prototype={constructor:Eg,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Sg=Ld(30*Cd);function Cg(t,e){return+e?function(t,e){function r(n,i,o,a,s,u,l,c,h,p,f,d,g,y){var m=l-n,v=c-i,_=m*m+v*v;if(_>4*e&&g--){var x=a+p,b=s+f,w=u+d,E=kd(x*x+b*b+w*w),I=Dd(w/=E),S=Pd(Pd(w)-1)<xd||Pd(o-h)<xd?(o+h)/2:Td(b,x),C=t(S,I),P=C[0],M=C[1],T=P-n,L=M-i,A=v*T-m*L;(A*A/_>e||Pd((m*T+v*L)/_-.5)>.3||a*p+s*f+u*d<Sg)&&(r(n,i,o,a,s,u,P,M,S,x/=E,b/=E,w,g,y),y.point(P,M),r(P,M,S,x,b,w,l,c,h,p,f,d,g,y))}}return function(e){var n,i,o,a,s,u,l,c,h,p,f,d,g={point:y,lineStart:m,lineEnd:_,polygonStart:function(){e.polygonStart(),g.lineStart=x},polygonEnd:function(){e.polygonEnd(),g.lineStart=m}};function y(r,n){r=t(r,n),e.point(r[0],r[1])}function m(){c=NaN,g.point=v,e.lineStart()}function v(n,i){var o=Gd([n,i]),a=t(n,i);r(c,h,l,p,f,d,c=a[0],h=a[1],l=n,p=o[0],f=o[1],d=o[2],16,e),e.point(c,h)}function _(){g.point=y,e.lineEnd()}function x(){m(),g.point=b,g.lineEnd=w}function b(t,e){v(n=t,e),i=c,o=h,a=p,s=f,u=d,g.point=v}function w(){r(c,h,l,p,f,d,i,o,n,a,s,u,16,e),g.lineEnd=_,_()}return g}}(t,e):function(t){return wg({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}(t)}var Pg=wg({point:function(t,e){this.stream.point(t*Cd,e*Cd)}});function Mg(t){return function(t){var e,r,n,i,o,a,s,u,l,c,h=150,p=480,f=250,d=0,g=0,y=0,m=0,v=0,_=null,x=bg,b=null,w=pg,E=.5,I=Cg(P,E);function S(t){return[(t=o(t[0]*Cd,t[1]*Cd))[0]*h+r,n-t[1]*h]}function C(t){return(t=o.invert((t[0]-r)/h,(n-t[1])/h))&&[t[0]*Sd,t[1]*Sd]}function P(t,i){return[(t=e(t,i))[0]*h+r,n-t[1]*h]}function M(){o=Jd(i=function(t,e,r){return(t%=Id)?e||r?Jd(Qd(t),tg(e,r)):Qd(t):e||r?tg(e,r):Kd}(y,m,v),e);var t=e(d,g);return r=p-t[0]*h,n=f+t[1]*h,T()}function T(){return l=c=null,S}return S.stream=function(t){return l&&c===t?l:l=Pg(x(i,I(w(c=t))))},S.clipAngle=function(t){return arguments.length?(x=+t?function(t,e){var r=Ld(t),n=r>0,i=Pd(r)>xd;function o(t,e){return Ld(t)*Ld(e)>r}function a(t,e,n){var i=[1,0,0],o=Zd(Gd(t),Gd(e)),a=Xd(o,o),s=o[0],u=a-s*s;if(!u)return!n&&t;var l=r*a/u,c=-r*s/u,h=Zd(i,o),p=Wd(i,l);Yd(p,Wd(o,c));var f=h,d=Xd(p,f),g=Xd(f,f),y=d*d-g*(Xd(p,p)-1);if(!(y<0)){var m=kd(y),v=Wd(f,(-d-m)/g);if(Yd(v,p),v=qd(v),!n)return v;var _,x=t[0],b=e[0],w=t[1],E=e[1];b<x&&(_=x,x=b,b=_);var I=b-x,S=Pd(I-bd)<xd;if(!S&&E<w&&(_=w,w=E,E=_),S||I<xd?S?w+E>0^v[1]<(Pd(v[0]-x)<xd?w:E):w<=v[1]&&v[1]<=E:I>bd^(x<=v[0]&&v[0]<=b)){var C=Wd(f,(-d+m)/g);return Yd(C,p),[v,qd(C)]}}}function s(e,r){var i=n?t:bd-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return vg(o,(function(t){var e,r,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(h,p){var f,d=[h,p],g=o(h,p),y=n?g?0:s(h,p):g?s(h+(h<0?bd:-bd),p):0;if(!e&&(l=u=g)&&t.lineStart(),g!==u&&(!(f=a(e,d))||ng(e,f)||ng(d,f))&&(d[0]+=xd,d[1]+=xd,g=o(d[0],d[1])),g!==u)c=0,g?(t.lineStart(),f=a(d,e),t.point(f[0],f[1])):(f=a(e,d),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&n^g){var m;y&r||!(m=a(d,e,!0))||(c=0,n?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||e&&ng(e,d)||t.point(d[0],d[1]),e=d,u=g,r=y},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var a=Ld(e),s=Ad(e),u=n*r;null==i?(i=e+n*Id,o=e-u/2):(i=eg(a,i),o=eg(a,o),(n>0?i<o:i>o)&&(i+=n*Id));for(var l,c=i;n>0?c>o:c<o;c-=u)l=qd([a,-s*Ld(c),-s*Ad(c)]),t.point(l[0],l[1])}}(o,t,e,i,r,n)}),n?[0,-t]:[-bd,t-bd])}(_=t*Cd,6*Cd):(_=null,bg),T()):_*Sd},S.clipExtent=function(t){return arguments.length?(w=null==t?(b=a=s=u=null,pg):function(t,e,r,n){function i(i,o){return t<=i&&i<=r&&e<=o&&o<=n}function o(i,o,s,l){var c=0,h=0;if(null==i||(c=a(i,s))!==(h=a(o,s))||u(i,o)<0^s>0)do{l.point(0===c||3===c?t:r,c>1?n:e)}while((c=(c+s+4)%4)!==h);else l.point(o[0],o[1])}function a(n,i){return Pd(n[0]-t)<xd?i>0?0:3:Pd(n[0]-r)<xd?i>0?2:1:Pd(n[1]-e)<xd?i>0?1:0:i>0?3:2}function s(t,e){return u(t.x,e.x)}function u(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(a){var u,l,c,h,p,f,d,g,y,m,v,_=a,x=rg(),b={point:w,lineStart:function(){b.point=E,l&&l.push(c=[]);m=!0,y=!1,d=g=NaN},lineEnd:function(){u&&(E(h,p),f&&y&&x.rejoin(),u.push(x.result()));b.point=w,y&&_.lineEnd()},polygonStart:function(){_=x,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=l.length;r<i;++r)for(var o,a,s=l[r],u=1,c=s.length,h=s[0],p=h[0],f=h[1];u<c;++u)o=p,a=f,p=(h=s[u])[0],f=h[1],a<=n?f>n&&(p-o)*(n-a)>(f-a)*(t-o)&&++e:f<=n&&(p-o)*(n-a)<(f-a)*(t-o)&&--e;return e}(),r=v&&e,i=(u=ug(u)).length;(r||i)&&(a.polygonStart(),r&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&og(u,s,e,o,a),a.polygonEnd());_=a,u=l=c=null}};function w(t,e){i(t,e)&&_.point(t,e)}function E(o,a){var s=i(o,a);if(l&&c.push([o,a]),m)h=o,p=a,f=s,m=!1,s&&(_.lineStart(),_.point(o,a));else if(s&&y)_.point(o,a);else{var u=[d=Math.max(cg,Math.min(lg,d)),g=Math.max(cg,Math.min(lg,g))],x=[o=Math.max(cg,Math.min(lg,o)),a=Math.max(cg,Math.min(lg,a))];!function(t,e,r,n,i,o){var a,s=t[0],u=t[1],l=0,c=1,h=e[0]-s,p=e[1]-u;if(a=r-s,h||!(a>0)){if(a/=h,h<0){if(a<l)return;a<c&&(c=a)}else if(h>0){if(a>c)return;a>l&&(l=a)}if(a=i-s,h||!(a<0)){if(a/=h,h<0){if(a>c)return;a>l&&(l=a)}else if(h>0){if(a<l)return;a<c&&(c=a)}if(a=n-u,p||!(a>0)){if(a/=p,p<0){if(a<l)return;a<c&&(c=a)}else if(p>0){if(a>c)return;a>l&&(l=a)}if(a=o-u,p||!(a<0)){if(a/=p,p<0){if(a>c)return;a>l&&(l=a)}else if(p>0){if(a<l)return;a<c&&(c=a)}return l>0&&(t[0]=s+l*h,t[1]=u+l*p),c<1&&(e[0]=s+c*h,e[1]=u+c*p),!0}}}}}(u,x,t,e,r,n)?s&&(_.lineStart(),_.point(o,a),v=!1):(y||(_.lineStart(),_.point(u[0],u[1])),_.point(x[0],x[1]),s||_.lineEnd(),v=!1)}d=o,g=a,y=s}return b}}(b=+t[0][0],a=+t[0][1],s=+t[1][0],u=+t[1][1]),T()):null==b?null:[[b,a],[s,u]]},S.scale=function(t){return arguments.length?(h=+t,M()):h},S.translate=function(t){return arguments.length?(p=+t[0],f=+t[1],M()):[p,f]},S.center=function(t){return arguments.length?(d=t[0]%360*Cd,g=t[1]%360*Cd,M()):[d*Sd,g*Sd]},S.rotate=function(t){return arguments.length?(y=t[0]%360*Cd,m=t[1]%360*Cd,v=t.length>2?t[2]%360*Cd:0,M()):[y*Sd,m*Sd,v*Sd]},S.precision=function(t){return arguments.length?(I=Cg(P,E=t*t),T()):kd(E)},S.fitExtent=function(t,e){return Ig(S,t,e)},S.fitSize=function(t,e){return function(t,e,r){return Ig(t,[[0,0],e],r)}(S,t,e)},function(){return e=t.apply(this,arguments),S.invert=e.invert&&C,M()}}((function(){return t}))()}var Tg=function(t,e){var r=Ld(t),n=Ld(e),i=function(t){return(t=Nd(t))&&t/Ad(t)}(r*n);return[i*n*Ad(t),i*Ad(e)]};function Lg(t,r,n,i){var a=t.properties||{},s="Feature"===t.type?t.geometry:t;if("GeometryCollection"===s.type){var u=[];return B(t,(function(t){var e=Lg(t,r,n,i);e&&u.push(e)})),f(u)}var l=function(t){var r=pr(t).geometry.coordinates,n=[-r[0],-r[1]];return Mg(Tg).scale(79.4188).clipAngle(179.999).rotate(n).scale(e)}(s),c={type:s.type,coordinates:kg(s.coordinates,l)},h=(new eh).read(c),p=_(x(r,n),"meters"),d=Wp.bufferOp(h,p,i);if(!Ag((d=(new rh).write(d)).coordinates))return o({type:d.type,coordinates:Ng(d.coordinates,l)},a)}function Ag(t){return Array.isArray(t[0])?Ag(t[0]):isNaN(t[0])}function kg(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return kg(t,e)}))}function Ng(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return Ng(t,e)}))}function Dg(t,e,r){void 0===r&&(r={});var n=nt(t),i=nt(e),o=Lu.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?l(o[0],r.properties):y(o,r.properties)}function Rg(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],a=t[2],s=t[3],u=(o+s)/2,l=(i+a)/2,c=2*e/ye([i,u],[a,u],r)*(a-i),h=2*e/ye([l,o],[l,s],r)*(s-o),p=c/2,d=2*p,g=Math.sqrt(3)/2*h,y=a-i,m=s-o,v=3/4*d,_=g,x=(y-d)/(d-p/2),b=Math.floor(x),w=(b*v-p/2-y)/2-p/2+v/2,E=Math.floor((m-g)/g),I=(m-E*g)/2,S=E*g-m>g/2;S&&(I-=g/4);for(var C=[],P=[],M=0;M<6;M++){var T=2*Math.PI/6*M;C.push(Math.cos(T)),P.push(Math.sin(T))}for(var L=[],A=0;A<=b;A++)for(var k=0;k<=E;k++){var N=A%2==1;if(!(0===k&&N||0===k&&S)){var D=A*v+i-w,R=k*_+o+I;if(N&&(R-=g/2),!0===r.triangles)zg([D,R],c/2,h/2,JSON.parse(n),C,P).forEach((function(t){r.mask?Dg(r.mask,t)&&L.push(t):L.push(t)}));else{var O=Og([D,R],c/2,h/2,JSON.parse(n),C,P);r.mask?Dg(r.mask,O)&&L.push(O):L.push(O)}}}return f(L)}function Og(t,e,r,n,i,o){for(var a=[],s=0;s<6;s++){var u=t[0]+e*i[s],c=t[1]+r*o[s];a.push([u,c])}return a.push(a[0].slice()),l([a],n)}function zg(t,e,r,n,i,o){for(var a=[],s=0;s<6;s++){var u=[];u.push(t),u.push([t[0]+e*i[s],t[1]+r*o[s]]),u.push([t[0]+e*i[(s+1)%6],t[1]+r*o[(s+1)%6]]),u.push(t),a.push(l([u],n))}return a}function Fg(t){return y(t)}function Bg(t,e,r){return void 0===r&&(r={}),function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],a=t[1],s=t[2],u=t[3],c=e/ye([o,a],[s,a],n)*(s-o),h=r/ye([o,a],[o,u],n)*(u-a),p=s-o,d=u-a,g=Math.floor(p/c),y=Math.floor(d/h),m=(d-y*h)/2,v=o+(p-g*c)/2,_=0;_<g;_++){for(var x=a+m,b=0;b<y;b++){var w=l([[[v,x],[v,x+h],[v+c,x+h],[v+c,x],[v,x]]],n.properties);n.mask?ua(n.mask,w)&&i.push(w):i.push(w),x+=h}v+=c}return f(i)}(t,e,e,r)}function Ug(t,e,r){void 0===r&&(r={});for(var n=[],i=e/ye([t[0],t[1]],[t[2],t[1]],r)*(t[2]-t[0]),o=e/ye([t[0],t[1]],[t[0],t[3]],r)*(t[3]-t[1]),a=0,s=t[0];s<=t[2];){for(var u=0,c=t[1];c<=t[3];){var h=null,p=null;a%2==0&&u%2==0?(h=l([[[s,c],[s,c+o],[s+i,c],[s,c]]],r.properties),p=l([[[s,c+o],[s+i,c+o],[s+i,c],[s,c+o]]],r.properties)):a%2==0&&u%2==1?(h=l([[[s,c],[s+i,c+o],[s+i,c],[s,c]]],r.properties),p=l([[[s,c],[s,c+o],[s+i,c+o],[s,c]]],r.properties)):u%2==0&&a%2==1?(h=l([[[s,c],[s,c+o],[s+i,c+o],[s,c]]],r.properties),p=l([[[s,c],[s+i,c+o],[s+i,c],[s,c]]],r.properties)):u%2==1&&a%2==1&&(h=l([[[s,c],[s,c+o],[s+i,c],[s,c]]],r.properties),p=l([[[s,c+o],[s+i,c+o],[s+i,c],[s,c+o]]],r.properties)),r.mask?(Dg(r.mask,h)&&n.push(h),Dg(r.mask,p)&&n.push(p)):(n.push(h),n.push(p)),c+=o,u++}a++,s+=i}return f(n)}Tg.invert=function(t,e){var r=kd(t*t+e*e),n=r,i=Ad(n),o=Ld(n);return[Td(t*i,r*o),Dd(r&&e*i/r)]},t.along=function(t,e,r){void 0===r&&(r={});for(var n=nt(t).coordinates,i=0,o=0;o<n.length&&!(e>=i&&o===n.length-1);o++){if(i>=e){var a=e-i;if(a){var u=hr(n[o],n[o-1])-180;return lr(n[o],a,u,r)}return s(n[o])}i+=ye(n[o],n[o+1],r)}return s(n[n.length-1])},t.angle=function(t,e,r,n){if(void 0===n&&(n={}),!M(n))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!r)throw new Error("endPoint is required");var i=t,o=e,a=r,s=w(!0!==n.mercator?hr(i,o):wi(i,o)),u=w(!0!==n.mercator?hr(a,o):wi(a,o)),l=Math.abs(s-u);return!0===n.explementary?360-l:l},t.applyFilter=Bs,t.area=Sn,t.areaFactors=i,t.bbox=J,t.bboxClip=function(t,e){var r=nt(t),n=r.type,i="Feature"===t.type?t.properties:{},o=r.coordinates;switch(n){case"LineString":case"MultiLineString":var a=[];return"LineString"===n&&(o=[o]),o.forEach((function(t){!function(t,e,r){var n,i,o,a,s,u=t.length,l=di(t[0],e),c=[];for(r||(r=[]),n=1;n<u;n++){for(a=t[n-1],i=o=di(s=t[n],e);;){if(!(l|i)){c.push(a),i!==o?(c.push(s),n<u-1&&(r.push(c),c=[])):n===u-1&&c.push(s);break}if(l&i)break;l?l=di(a=fi(a,s,l,e),e):i=di(s=fi(a,s,i,e),e)}l=o}c.length&&r.push(c)}(t,e,a)})),1===a.length?h(a[0],i):d(a,i);case"Polygon":return l(gi(o,e),i);case"MultiPolygon":return y(o.map((function(t){return gi(t,e)})),i);default:throw new Error("geometry "+n+" not supported")}},t.bboxPolygon=ar,t.bearing=hr,t.bearingToAngle=w,t.bearingToAzimuth=w,t.bezier=or,t.bezierSpline=or,t.booleanClockwise=Mi,t.booleanContains=function(t,e){var r=nt(t),n=nt(e),i=r.type,o=n.type,a=r.coordinates,s=n.coordinates;switch(i){case"Point":if("Point"===o)return Ko(a,s);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return function(t,e){var r,n=!1;for(r=0;r<t.coordinates.length;r++)if(Ko(t.coordinates[r],e.coordinates)){n=!0;break}return n}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++){for(var i=n[r],o=!1,a=0,s=t.coordinates;a<s.length;a++)if(Ko(i,s[a])){o=!0;break}if(!o)return!1}return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return An(n,r,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(An({type:"Point",coordinates:o},t,{ignoreEndVertices:!0})&&(r=!0),!An({type:"Point",coordinates:o},t,{ignoreEndVertices:!1}))return!1}return r}(r,n);case"MultiPoint":return function(t,e){for(var r=!1,n=0,i=e.coordinates;n<i.length;n++){var o=i[n];if(An(o,t,{ignoreEndVertices:!0})&&(r=!0),!An(o,t))return!1}return!!r}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return fe(n,r,{ignoreBoundary:!0});case"LineString":return function(t,e){var r=!1,n=0;if(!Jo(J(t),J(e)))return!1;for(;n<e.coordinates.length-1;n++)if(fe({type:"Point",coordinates:$o(e.coordinates[n],e.coordinates[n+1])},t,{ignoreBoundary:!0})){r=!0;break}return r}(r,n);case"Polygon":return function(t,e){if("Feature"===t.type&&null===t.geometry)return!1;if("Feature"===e.type&&null===e.geometry)return!1;if(!Jo(J(t),J(e)))return!1;for(var r=0,n=nt(e).coordinates;r<n.length;r++)for(var i=0,o=n[r];i<o.length;i++)if(!fe(o[i],t))return!1;return!0}(r,n);case"MultiPoint":return function(t,e){for(var r=0,n=e.coordinates;r<n.length;r++)if(!fe(n[r],t,{ignoreBoundary:!0}))return!1;return!0}(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},t.booleanCrosses=function(t,e){var r=nt(t),n=nt(e),i=r.type,o=n.type;switch(i){case"MultiPoint":switch(o){case"LineString":return Qo(r,n);case"Polygon":return ea(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return Qo(n,r);case"LineString":return function(t,e){if(dn(t,e).features.length>0)for(var r=0;r<t.coordinates.length-1;r++)for(var n=0;n<e.coordinates.length-1;n++){var i=!0;if(0!==n&&n!==e.coordinates.length-2||(i=!1),ra(t.coordinates[r],t.coordinates[r+1],e.coordinates[n],i))return!0}return!1}(r,n);case"Polygon":return ta(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return ea(n,r);case"LineString":return ta(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},t.booleanDisjoint=Zo,t.booleanEqual=function(t,e){return nt(t).type===nt(e).type&&new sa({precision:6}).compare(Ye(t),Ye(e))},t.booleanIntersects=ua,t.booleanOverlap=function(t,e){var r=nt(t),n=nt(e),i=r.type,o=n.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new sa({precision:6}).compare(t,e))return!1;var a=0;switch(i){case"MultiPoint":for(var s=0;s<r.coordinates.length;s++)for(var u=0;u<n.coordinates.length;u++){var l=r.coordinates[s],c=n.coordinates[u];if(l[0]===c[0]&&l[1]===c[1])return!0}return!1;case"LineString":case"MultiLineString":q(t,(function(t){q(e,(function(e){_i(t,e).features.length&&a++}))}));break;case"Polygon":case"MultiPolygon":q(t,(function(t){q(e,(function(e){dn(t,e).features.length&&a++}))}))}return a>0},t.booleanParallel=function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==ba(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==ba(e,"line2"))throw new Error("line2 must be a LineString");for(var r=Vr(Ye(t)).features,n=Vr(Ye(e)).features,i=0;i<r.length;i++){var o=r[i].geometry.coordinates;if(!n[i])break;if(!xa(o,n[i].geometry.coordinates))return!1}return!0},t.booleanPointInPolygon=fe,t.booleanPointOnLine=An,t.booleanWithin=Nn,t.buffer=function(t,e,r){var n=(r=r||{}).units||"kilometers",i=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof r)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return B(t,(function(t){var r=Lg(t,e,n,i);r&&o.push(r)})),f(o);case"FeatureCollection":return O(t,(function(t){var r=Lg(t,e,n,i);r&&O(r,(function(t){t&&o.push(t)}))})),f(o)}return Lg(t,e,n,i)},t.center=pr,t.centerMean=ds,t.centerMedian=function(t,e){if(void 0===e&&(e={}),!M(e=e||{}))throw new Error("options is invalid");var r=e.counter||10;if(!P(r))throw new Error("counter must be a number");var n=e.weight,i=ds(t,{weight:e.weight}),o=f([]);O(t,(function(t){var e;o.features.push(fr(t,{properties:{weight:null===(e=t.properties)||void 0===e?void 0:e[n]}}))}));var a={tolerance:e.tolerance,medianCandidates:[]};return gs(i.geometry.coordinates,[0,0],o,a,r)},t.centerOfMass=function t(e,r){switch(void 0===r&&(r={}),it(e)){case"Point":return s(K(e),r.properties);case"Polygon":var n=[];k(e,(function(t){n.push(t)}));var i,o,a,u,l,c,h,p,f=fr(e,{properties:r.properties}),d=f.geometry.coordinates,g=0,y=0,m=0,v=n.map((function(t){return[t[0]-d[0],t[1]-d[1]]}));for(i=0;i<n.length-1;i++)u=(o=v[i])[0],c=o[1],l=(a=v[i+1])[0],m+=p=u*(h=a[1])-l*c,g+=(u+l)*p,y+=(c+h)*p;if(0===m)return f;var _=1/(.5*m*6);return s([d[0]+_*g,d[1]+_*y],r.properties);default:var x=pe(e);return x?t(x,{properties:r.properties}):fr(e,{properties:r.properties})}},t.centroid=fr,t.circle=cr,t.cleanCoords=Ye,t.clone=be,t.clusterEach=Os,t.clusterReduce=zs,t.clusters=Vs,t.clustersDbscan=function(t,e,r){void 0===r&&(r={}),!0!==r.mutate&&(t=be(t)),r.minPoints=r.minPoints||3;var n=new fa.DBSCAN,i=n.run(F(t),S(e,r.units),r.minPoints,ye),o=-1;return i.forEach((function(e){o++,e.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster=o,r.properties.dbscan="core"}))})),n.noise.forEach((function(e){var r=t.features[e];r.properties||(r.properties={}),r.properties.cluster?r.properties.dbscan="edge":r.properties.dbscan="noise"})),t},t.clustersKmeans=function(t,e){void 0===e&&(e={});var r=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(r/2)),e.numberOfClusters>r&&(e.numberOfClusters=r),!0!==e.mutate&&(t=be(t));var n=F(t),i=n.slice(0,e.numberOfClusters),o=_a(n,e.numberOfClusters,i),a={};return o.centroids.forEach((function(t,e){a[e]=t})),O(t,(function(t,e){var r=o.idxs[e];t.properties.cluster=r,t.properties.centroid=a[r]})),t},t.collect=function(t,e,r,n){var i=Et(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[r]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=J(t),r=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];r.forEach((function(e){fe([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[n]=o})),t},t.collectionOf=rt,t.combine=function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return O(t,(function(t){var r,n,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(r=e.MultiPoint.coordinates).push.apply(r,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(n=e.MultiLineString.coordinates).push.apply(n,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),f(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return o({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},t.concave=function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=me(function(t){var e=[],r={};return O(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),f(e)}(t));if(n.features=n.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],a=ye(n,i,e),s=ye(i,o,e),u=ye(n,o,e);return a<=r&&s<=r&&u<=r})),n.features.length<1)return null;var i=Ze(n);return 1===i.coordinates.length&&(i.coordinates=i.coordinates[0],i.type="Polygon"),o(i)},t.containsNumber=Q,t.convertArea=C,t.convertDistance=S,t.convertLength=S,t.convex=pe,t.coordAll=F,t.coordEach=k,t.coordReduce=N,t.createBins=Fs,t.degrees2radians=I,t.degreesToRadians=I,t.destination=lr,t.difference=function(t,e){var r=nt(t),n=nt(e),i=t.properties||{},o=Lu.difference(r.coordinates,n.coordinates);return 0===o.length?null:1===o.length?l(o[0],i):y(o,i)},t.dissolve=function(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r=e.propertyName;rt(t,"Polygon","dissolve");var n=[];if(!e.propertyName)return Bn(y(Lu.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};O(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[r])||(i[t.properties[r]]=[]),i[t.properties[r]].push(t)}));for(var o=Object.keys(i),a=0;a<o.length;a++){var s=y(Lu.union.apply(null,i[o[a]].map((function(t){return t.geometry.coordinates}))));s.properties[r]=o[a],n.push(s)}return Bn(f(n))},t.distance=ye,t.distanceToDegrees=b,t.distanceToRadians=x,t.distanceWeight=xs,t.earthRadius=e,t.ellipse=ps,t.envelope=sr,t.explode=dr,t.factors=r,t.feature=o,t.featureCollection=f,t.featureEach=O,t.featureOf=et,t.featureReduce=z,t.filterProperties=js,t.findPoint=W,t.findSegment=Y,t.flatten=Bn,t.flattenEach=j,t.flattenReduce=V,t.flip=function(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r=e.mutate;if(!t)throw new Error("geojson is required");return!1!==r&&void 0!==r||(t=be(t)),k(t,(function(t){var e=t[0],r=t[1];t[0]=r,t[1]=e})),t},t.geojsonType=tt,t.geomEach=B,t.geomReduce=U,t.geometry=a,t.geometryCollection=m,t.getCluster=Rs,t.getCoord=K,t.getCoords=$,t.getGeom=nt,t.getType=it,t.greatCircle=function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.properties,i=r.npoints,o=r.offset;return t=K(t),e=K(e),n=n||{},i=i||100,o=o||10,new Qn({x:t[0],y:t[1]},{x:e[0],y:e[1]},n).Arc(i,{offset:o}).json()},t.helpers=A,t.hexGrid=Rg,t.inside=fe,t.interpolate=function(t,e,r){if("object"!=typeof(r=r||{}))throw new Error("options is invalid");var n=r.gridType,i=r.property,o=r.weight;if(!t)throw new Error("points is required");if(rt(t,"Point","input must contain Points"),!e)throw new Error("cellSize is required");if(void 0!==o&&"number"!=typeof o)throw new Error("weight must be a number");i=i||"elevation",n=n||"square",o=o||1;var a,s=J(t);switch(n){case"point":case"points":a=zn(s,e,r);break;case"square":case"squares":a=Bg(s,e,r);break;case"hex":case"hexes":a=Rg(s,e,r);break;case"triangle":case"triangles":a=Ug(s,e,r);break;default:throw new Error("invalid gridType")}var u=[];return O(a,(function(e){var a=0,s=0;O(t,(function(t){var u,l=ye("point"===n?e:fr(e),t,r);if(void 0!==i&&(u=t.properties[i]),void 0===u&&(u=t.geometry.coordinates[2]),void 0===u)throw new Error("zValue is missing");0===l&&(a=u);var c=1/Math.pow(l,o);s+=c,a+=c*u}));var l=be(e);l.properties[i]=a/s,u.push(l)})),f(u)},t.intersect=Dg,t.invariant=ot,t.isNumber=P,t.isObject=M,t.isobands=function(t,e,r){if(!M(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(rt(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!M(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var a=function(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r=e.zProperty||"elevation",n=e.flip,i=e.flags;rt(t,"Point","input must contain Points");for(var o=function(t,e){var r={};return O(t,(function(t){var e=$(t)[1];r[e]||(r[e]=[]),r[e].push(t)})),Object.keys(r).map((function(t){return r[t].sort((function(t,e){return $(t)[0]-$(e)[0]}))})).sort((function(t,r){return e?$(t[0])[1]-$(r[0])[1]:$(r[0])[1]-$(t[0])[1]}))}(t,n),a=[],s=0;s<o.length;s++){for(var u=o[s],l=[],c=0;c<u.length;c++){var h=u[c];h.properties[r]?l.push(h.properties[r]):l.push(0),!0===i&&(h.properties.matrixPosition=[s,c])}a.push(l)}return a}(t,{zProperty:n,flip:!0}),s=function(t,e,r){for(var n=[],i=1;i<e.length;i++){var o=+e[i-1],a=+e[i],s=Ao(Lo(Di(t,o,a-o))),u={};u.groupedRings=s,u[r]=o+"-"+a,n.push(u)}return n}(a,e,n);return f((s=function(t,e,r){var n=J(r),i=n[2]-n[0],o=n[3]-n[1],a=n[0],s=n[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,p=function(t){t[0]=t[0]*c+a,t[1]=t[1]*h+s};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(p)}))}))})),t}(s,a,t)).map((function(t,e){if(o[e]&&!M(o[e]))throw new Error("Each mappedProperty is required to be an Object");var r=lt({},i,o[e]);return r[n]=t[n],y(t.groupedRings,r)})))},t.isolines=function(t,e,r){if(!M(r=r||{}))throw new Error("options is invalid");var n=r.zProperty||"elevation",i=r.commonProperties||{},o=r.breaksProperties||[];if(rt(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks must be an Array");if(!M(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var a=function(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r=e.zProperty||"elevation",n=e.flip,i=e.flags;rt(t,"Point","input must contain Points");for(var o=function(t,e){var r={};return O(t,(function(t){var e=$(t)[1];r[e]||(r[e]=[]),r[e].push(t)})),Object.keys(r).map((function(t){return r[t].sort((function(t,e){return $(t)[0]-$(e)[0]}))})).sort((function(t,r){return e?$(t[0])[1]-$(r[0])[1]:$(r[0])[1]-$(t[0])[1]}))}(t,n),a=[],s=0;s<o.length;s++){for(var u=o[s],l=[],c=0;c<u.length;c++){var h=u[c];h.properties[r]?l.push(h.properties[r]):l.push(0),!0===i&&(h.properties.matrixPosition=[s,c])}a.push(l)}return a}(t,{zProperty:n,flip:!0});return f(function(t,e,r){var n=J(r),i=n[2]-n[0],o=n[3]-n[1],a=n[0],s=n[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,p=function(t){t[0]=t[0]*c+a,t[1]=t[1]*h+s};return t.forEach((function(t){k(t,p)})),t}(function(t,e,r,n,i){for(var o=[],a=1;a<e.length;a++){var s=+e[a],u=lt({},n,i[a]);u[r]=s;var l=d(pt(t,s),u);o.push(l)}return o}(a,e,n,i,o),a,t))},t.kinks=function(t){var e,r,n={type:"FeatureCollection",features:[]};if("LineString"===(r="Feature"===t.type?t.geometry:t).type)e=[r.coordinates];else if("MultiLineString"===r.type)e=r.coordinates;else if("MultiPolygon"===r.type)e=[].concat.apply([],r.coordinates);else{if("Polygon"!==r.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=r.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var r=0;r<t.length-1;r++)for(var i=r;i<e.length-1;i++){if(t===e){if(1===Math.abs(r-i))continue;if(0===r&&i===t.length-2&&t[r][0]===t[t.length-1][0]&&t[r][1]===t[t.length-1][1])continue}var o=bn(t[r][0],t[r][1],t[r+1][0],t[r+1][1],e[i][0],e[i][1],e[i+1][0],e[i+1][1]);o&&n.features.push(s([o[0],o[1]]))}}))})),n},t.length=Tn,t.lengthToDegrees=b,t.lengthToRadians=x,t.lineArc=ii,t.lineChunk=function(t,e,r){if(!M(r=r||{}))throw new Error("options is invalid");var n=r.units,i=r.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return j(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,r,n){var i=Tn(t,{units:r});if(i<=e)return n(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var a=0;a<o;a++)n(Ln(t,e*a,e*(a+1),{units:r}))}(t,e,n,(function(t){o.push(t)}))})),f(o)},t.lineDistance=Tn,t.lineEach=X,t.lineIntersect=dn,t.lineOffset=function(t,e,r){if(!M(r=r||{}))throw new Error("options is invalid");var n=r.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=it(t),o=t.properties;switch(i){case"LineString":return Bo(t,e,n);case"MultiLineString":var a=[];return j(t,(function(t){a.push(Bo(t,e,n).geometry.coordinates)})),d(a,o);default:throw new Error("geometry "+i+" is not supported")}},t.lineOverlap=_i,t.lineReduce=Z,t.lineSegment=Vr,t.lineSlice=function(t,e,r){var n=$(r);if("LineString"!==it(r))throw new Error("line must be a LineString");for(var i,o=yn(r,t),a=yn(r,e),s=[(i=o.properties.index<=a.properties.index?[o,a]:[a,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)s.push(n[u]);return s.push(i[1].geometry.coordinates),h(s,r.properties)},t.lineSliceAlong=Ln,t.lineSplit=function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var r=it(t),n=it(e);if("LineString"!==r)throw new Error("line must be LineString");if("FeatureCollection"===n)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===n)throw new Error("splitter cannot be a GeometryCollection");var i=Fn(e,{precision:7});switch(n){case"Point":return ei(t,i);case"MultiPoint":return ti(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return ti(t,dn(t,i))}},t.lineString=h,t.lineStringToPolygon=li,t.lineStrings=p,t.lineToPolygon=li,t.mask=function(t,e){var r,n=function(t){return l(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}(e);return("FeatureCollection"===t.type?Fg(2===(r=t).features.length?Lu.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):Lu.union.apply(Lu,r.features.map((function(t){return t.geometry.coordinates})))):Fg(Lu.union(t.geometry.coordinates))).geometry.coordinates.forEach((function(t){n.geometry.coordinates.push(t[0])})),n},t.meta=H,t.midpoint=function(t,e){return lr(t,ye(t,e)/2,hr(t,e))},t.moranIndex=function(t,e){var r=e.inputField,n=e.threshold||1e5,i=e.p||2,o=e.binary||!1,a=xs(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:n}),s=[];O(t,(function(t){var e=t.properties||{};s.push(e[r])}));for(var u=bs(s),l=function(t){for(var e=bs(t),r=0,n=0,i=t;n<i.length;n++){var o=i[n];r+=Math.pow(o-e,2)}return r/t.length}(s),c=0,h=0,p=0,f=0,d=a.length,g=0;g<d;g++){for(var y=0,m=0;m<d;m++)c+=a[g][m]*(s[g]-u)*(s[m]-u),h+=a[g][m],p+=Math.pow(a[g][m]+a[m][g],2),y+=a[g][m]+a[m][g];f+=Math.pow(y,2)}var v=c/h/l,_=-1/(d-1),x=(d*d*(p*=.5)-d*f+h*h*3)/((d-1)*(d+1)*(h*h))-_*_,b=Math.sqrt(x);return{expectedMoranIndex:_,moranIndex:v,stdNorm:b,zNorm:(v-_)/b}},t.multiLineString=d,t.multiPoint=g,t.multiPolygon=y,t.nearest=jr,t.nearestPoint=jr,t.nearestPointOnLine=yn,t.nearestPointToLine=function(t,e,r){void 0===r&&(r={});var n=r.units,i=r.properties||{},o=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return B(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}(t);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==it(e))throw new Error("line must be a LineString");var a=1/0,s=null;return O(o,(function(t){var r=vn(t,e,{units:n});r<a&&(a=r,s=t)})),s&&(s.properties=lt({dist:a},s.properties,i)),s},t.planepoint=function(t,e){var r=K(t),n=nt(e).coordinates[0];if(n.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var i=e.properties||{},o=i.a,a=i.b,s=i.c,u=r[0],l=r[1],c=n[0][0],h=n[0][1],p=void 0!==o?o:n[0][2],f=n[1][0],d=n[1][1],g=void 0!==a?a:n[1][2],y=n[2][0],m=n[2][1],v=void 0!==s?s:n[2][2];return(v*(u-c)*(l-d)+p*(u-f)*(l-m)+g*(u-y)*(l-h)-g*(u-c)*(l-m)-v*(u-f)*(l-h)-p*(u-y)*(l-d))/((u-c)*(l-d)+(u-f)*(l-m)+(u-y)*(l-h)-(u-c)*(l-m)-(u-f)*(l-h)-(u-y)*(l-d))},t.point=s,t.pointGrid=zn,t.pointOnFeature=wn,t.pointOnLine=yn,t.pointOnSurface=wn,t.pointToLineDistance=vn,t.points=u,t.pointsWithinPolygon=ge,t.polygon=l,t.polygonSmooth=function(t,e){var r=[],n=e.iterations||1;if(!t)throw new Error("inputPolys is required");return B(t,(function(t,e,i){var o,a,s;switch(t.type){case"Polygon":o=[[]];for(var u=0;u<n;u++)s=[[]],a=t,u>0&&(a=l(o).geometry),ms(a,s),o=s.slice(0);r.push(l(o,i));break;case"MultiPolygon":o=[[[]]];for(var c=0;c<n;c++)s=[[[]]],a=t,c>0&&(a=y(o).geometry),vs(a,s),o=s.slice(0);r.push(y(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),f(r)},t.polygonTangents=function(t,e){var r,n,i,o,a=$(t),u=$(e),l=J(e),c=0,h=null;switch(a[0]>l[0]&&a[0]<l[2]&&a[1]>l[1]&&a[1]<l[3]&&(c=(h=jr(t,dr(e))).properties.featureIndex),it(e)){case"Polygon":r=u[0][c],n=u[0][0],null!==h&&h.geometry.coordinates[1]<a[1]&&(n=u[0][c]),o=Pi(u[0][0],u[0][u[0].length-1],a);var p=Si(u[0],a,o,i,r,n);r=p[0],n=p[1];break;case"MultiPolygon":for(var d=0,g=0,y=0,m=0;m<u[0].length;m++){d=m;for(var v=!1,_=0;_<u[0][m].length;_++){if(g=_,y===c){v=!0;break}y++}if(v)break}r=u[0][d][g],n=u[0][d][g],o=Pi(u[0][0][0],u[0][0][u[0][0].length-1],a),u.forEach((function(t){var e=Si(t[0],a,o,i,r,n);r=e[0],n=e[1]}))}return f([s(r),s(n)])},t.polygonToLine=ai,t.polygonToLineString=ai,t.polygonize=function(t){var e=Xo.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var r=[],n=[];return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?r.push(t):n.push(t)})),r.forEach((function(t){Go.findEdgeRingContaining(t,n)&&n.push(t)})),f(n.map((function(t){return t.toPolygon()})))},t.polygons=c,t.projection=Ps,t.propEach=D,t.propReduce=R,t.propertiesContainsFilter=Us,t.radians2degrees=E,t.radiansToDegrees=E,t.radiansToDistance=_,t.radiansToLength=_,t.random=Ds,t.randomLineString=As,t.randomPoint=Ts,t.randomPolygon=Ls,t.randomPosition=Ms,t.rewind=function(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r=e.reverse||!1,n=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof r)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof n)throw new Error("<mutate> must be a boolean");!1===n&&(t=be(t));var i=[];switch(t.type){case"GeometryCollection":return B(t,(function(t){Ti(t,r)})),t;case"FeatureCollection":return O(t,(function(t){O(Ti(t,r),(function(t){i.push(t)}))})),f(i)}return Ti(t,r)},t.rhumbBearing=wi,t.rhumbDestination=Ii,t.rhumbDistance=mn,t.round=v,t.sample=function(t,e){if(!t)throw new Error("featurecollection is required");if(null==e)throw new Error("num is required");if("number"!=typeof e)throw new Error("num must be a number");return f(function(t,e){for(var r,n,i=t.slice(0),o=t.length,a=o-e;o-- >a;)r=i[n=Math.floor((o+1)*Math.random())],i[n]=i[o],i[o]=r;return i.slice(a)}(t.features,e))},t.sector=function(t,e,r,n,i){if(!M(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(bi(r)===bi(n))return cr(t,e,i);var a=$(t),s=ii(t,e,r,n,i),u=[[a]];return k(s,(function(t){u[0].push(t)})),u[0].push(a),l(u,o)},t.segmentEach=q,t.segmentReduce=G,t.shortestPath=function(t,e,r){if(!M(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,a=r.obstacles||f([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!P(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var u=K(t),l=K(e);switch(t=s(u),e=s(l),it(a)){case"FeatureCollection":if(0===a.features.length)return h([u,l]);break;case"Polygon":a=f([o(nt(a))]);break;default:throw new Error("invalid obstacles")}var c=a;c.features.push(t),c.features.push(e);var p=J(Ro(ar(J(c)),1.15));n||(n=ye([p[0],p[1]],[p[2],p[1]],r)/100),c.features.pop(),c.features.pop();for(var d=p[0],g=p[1],y=p[2],m=p[3],v=n/ye([d,g],[y,g],r)*(y-d),_=n/ye([d,g],[d,m],r)*(m-g),x=y-d,b=m-g,w=Math.floor(x/v),E=Math.floor(b/_),I=(x-w*v)/2,S=[],C=[],T=[],L=[],A=1/0,k=1/0,N=m-(b-E*_)/2,D=0;N>=g;){for(var R=[],O=[],z=d+I,F=0;z<=y;){var B=s([z,N]),U=Pa(B,a);R.push(U?0:1),O.push(z+"|"+N);var j=ye(B,t);!U&&j<A&&(A=j,T={x:F,y:D});var V=ye(B,e);!U&&V<k&&(k=V,L={x:F,y:D}),z+=v,F++}C.push(R),S.push(O),N-=_,D++}var q=new Ia(C,{diagonal:!0}),G=q.grid[T.y][T.x],X=q.grid[L.y][L.x],Z=Ea.search(q,G,X),Y=[u];return Z.forEach((function(t){var e=S[t.x][t.y].split("|");Y.push([+e[0],+e[1]])})),Y.push(l),Ye(h(Y))},t.simplify=function(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r=void 0!==e.tolerance?e.tolerance:1,n=e.highQuality||!1,i=e.mutate||!1;if(!t)throw new Error("geojson is required");if(r&&r<0)throw new Error("invalid tolerance");return!0!==i&&(t=be(t)),B(t,(function(t){!function(t,e,r){var n=t.type;if("Point"===n||"MultiPoint"===n)return t;Ye(t,!0);var i=t.coordinates;switch(n){case"LineString":t.coordinates=er(i,e,r);break;case"MultiLineString":t.coordinates=i.map((function(t){return er(t,e,r)}));break;case"Polygon":t.coordinates=rr(i,e,r);break;case"MultiPolygon":t.coordinates=i.map((function(t){return rr(t,e,r)}))}}(t,r,n)})),t},t.square=ur,t.squareGrid=Bg,t.standardDeviationalEllipse=function(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r=e.steps||64,n=e.weight,i=e.properties||{};if(!P(r))throw new Error("steps must be a number");if(!M(i))throw new Error("properties must be a number");var o=F(t).length,a=ds(t,{weight:n}),s=0,u=0,l=0;O(t,(function(t){var e=t.properties[n]||1,r=ys($(t),$(a));s+=Math.pow(r.x,2)*e,u+=Math.pow(r.y,2)*e,l+=r.x*r.y*e}));var c=s-u,h=Math.sqrt(Math.pow(c,2)+4*Math.pow(l,2)),p=2*l,d=Math.atan((c+h)/p),g=180*d/Math.PI,y=0,m=0,v=0;O(t,(function(t){var e=t.properties[n]||1,r=ys($(t),$(a));y+=Math.pow(r.x*Math.cos(d)-r.y*Math.sin(d),2)*e,m+=Math.pow(r.x*Math.sin(d)+r.y*Math.cos(d),2)*e,v+=e}));var _=Math.sqrt(2*y/v),x=Math.sqrt(2*m/v),b=ps(a,_,x,{units:"degrees",angle:g,steps:r,properties:i}),w=ge(t,f([b])),E={meanCenterCoordinates:$(a),semiMajorAxis:_,semiMinorAxis:x,numberOfFeatures:o,angle:g,percentageWithinEllipse:100*F(w).length/o};return b.properties.standardDeviationalEllipse=E,b},t.tag=function(t,e,r,n){return t=be(t),e=be(e),O(t,(function(t){t.properties||(t.properties={}),O(e,(function(e){void 0===t.properties[n]&&fe(t,e)&&(t.properties[n]=e.properties[r])}))})),t},t.tesselate=function(t){if(!t.geometry||"Polygon"!==t.geometry.type&&"MultiPolygon"!==t.geometry.type)throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return"Polygon"===t.geometry.type?e.features=Ur(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(Ur(t))})),e},t.tin=me,t.toMercator=ws,t.toWgs84=Es,t.transformRotate=Do,t.transformScale=Ro,t.transformTranslate=function(t,e,r,n){if(!M(n=n||{}))throw new Error("options is invalid");var i=n.units,o=n.zTranslation,a=n.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");if(o&&"number"!=typeof o&&isNaN(o))throw new Error("zTranslation is not a number");if(o=void 0!==o?o:0,0===e&&0===o)return t;if(null==r||isNaN(r))throw new Error("direction is required");return e<0&&(e=-e,r+=180),!1!==a&&void 0!==a||(t=be(t)),k(t,(function(t){var n=$(Ii(t,e,r,{units:i}));t[0]=n[0],t[1]=n[1],o&&3===t.length&&(t[2]+=o)})),t},t.triangleGrid=Ug,t.truncate=Fn,t.union=function(t,e,r){void 0===r&&(r={});var n=nt(t),i=nt(e),o=Lu.union(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?l(o[0],r.properties):y(o,r.properties)},t.unitsFactors=n,t.unkinkPolygon=function(t){var e=[];return j(t,(function(t){"Polygon"===t.geometry.type&&O(jn(t),(function(r){e.push(l(r.geometry.coordinates,t.properties))}))})),f(e)},t.validateBBox=T,t.validateId=L,t.voronoi=function(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(r))throw new Error("bbox is invalid");return rt(t,"Point","points"),f(function(){var t=Ta,e=La,r=null;function n(n){return new cs(n.map((function(r,i){var o=[Math.round(t(r,i,n)/ss)*ss,Math.round(e(r,i,n)/ss)*ss];return o.index=i,o.data=r,o})),r)}return n.polygons=function(t){return n(t).polygons()},n.links=function(t){return n(t).links()},n.triangles=function(t){return n(t).triangles()},n.x=function(e){return arguments.length?(t="function"==typeof e?e:Ma(+e),n):t},n.y=function(t){return arguments.length?(e="function"==typeof t?t:Ma(+t),n):e},n.extent=function(t){return arguments.length?(r=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],n):r&&[[r[0][0],r[0][1]],[r[1][0],r[1][1]]]},n.size=function(t){return arguments.length?(r=null==t?null:[[0,0],[+t[0],+t[1]]],n):r&&[r[1][0]-r[0][0],r[1][1]-r[0][1]]},n}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[r[0],r[1]],[r[2],r[3]]]).polygons(t.features).map(hs))},t.within=ge,Object.defineProperty(t,"__esModule",{value:!0})}));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).maplibregl=e()}(this,(function(){"use strict";var t,e,r;function n(n,i){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a);r=i(a);"undefined"!=typeof window&&(r.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else e=i;else t=i}n(0,(function(t){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,o,a;for(void 0===e&&(e=1e-6),i=t,a=0;a<8;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=o/s}if((i=t)<(r=0))return r;if(i>(n=1))return n;for(;r<n;){if(o=this.sampleCurveX(i),Math.abs(o-t)<e)return i;t>o?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=o;function o(t,e){this.x=t,this.y=e}o.prototype={clone:function(){return new o(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[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,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=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(t){return t instanceof o?t:Array.isArray(t)?new o(t[0],t[1]):t};var a="undefined"!=typeof self?self:{},s=Math.pow(2,53)-1;function u(t,e,n,i){var o=new r(t,e,n,i);return function(t){return o.solve(t)}}var l=u(.25,.1,.25,1);function c(t,e,r){return Math.min(r,Math.max(e,t))}function h(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function p(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 o=i[n];for(var a in o)t[a]=o[a]}return t}var f=1;function d(){return f++}function g(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function y(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 _(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?_(t,b):t}var w={};function E(t){w[t]||("undefined"!=typeof console&&console.warn(t),w[t]=!0)}function I(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,o=void 0,a=void 0;r<n;i=r++)e+=((a=t[i]).x-(o=t[r]).x)*(o.y+a.y);return e}function C(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function P(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var o=n||i;return e[r]=!o||o.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var M=null;function T(t){if(null==M){var e=t.navigator?t.navigator.userAgent:null;M=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return M}function L(t){try{var e=a[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var A,k,N,D,R=a.performance&&a.performance.now?a.performance.now.bind(a.performance):Date.now.bind(Date),O=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||a.msRequestAnimationFrame,z=a.cancelAnimationFrame||a.mozCancelAnimationFrame||a.webkitCancelAnimationFrame||a.msCancelAnimationFrame,F={now:R,frame:function(t){var e=O(t);return{cancel:function(){return z(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=a.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 A||(A=a.document.createElement("a")),A.href=t,A.href},hardwareConcurrency:a.navigator&&a.navigator.hardwareConcurrency||4,get devicePixelRatio(){return a.devicePixelRatio},get prefersReducedMotion(){return!!a.matchMedia&&(null==k&&(k=a.matchMedia("(prefers-reduced-motion: reduce)")),k.matches)}},B={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},U={supported:!1,testSupport:function(t){!j&&D&&(V?q(t):N=t)}},j=!1,V=!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,D),t.isContextLost())return;U.supported=!0}catch(t){}t.deleteTexture(e),j=!0}a.document&&((D=a.document.createElement("img")).onload=function(){N&&q(N),N=null,V=!0},D.onerror=function(){j=!0,N=null},D.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var G="01",X=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function Z(t){return 0===t.indexOf("mapbox:")}X.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",G,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},X.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},X.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},X.prototype.normalizeStyleURL=function(t,e){if(!Z(t))return t;var r=J(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},X.prototype.normalizeGlyphsURL=function(t,e){if(!Z(t))return t;var r=J(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},X.prototype.normalizeSourceURL=function(t,e){if(!Z(t))return t;var r=J(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},X.prototype.normalizeSpriteURL=function(t,e,r,n){var i=J(t);return Z(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=""+e+r,K(i))},X.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!Z(t))return t;var r=J(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(F.devicePixelRatio>=2||512===e?"@2x":"")+(U.supported?".webp":"$1")),r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/v4"+r.path;var n=this._customAccessToken||function(t){for(var e=0,r=t;e<r.length;e+=1){var n=r[e].match(/^access_token=(.*)$/);if(n)return n[1]}return null}(r.params)||B.ACCESS_TOKEN;return B.REQUIRE_ACCESS_TOKEN&&n&&this._skuToken&&r.params.push("sku="+this._skuToken),this._makeAPIURL(r,n)},X.prototype.canonicalizeTileURL=function(t,e){var r=J(t);if(!r.path.match(/(^\/v4\/)/)||!r.path.match(/\.[\w]+$/))return t;var n="mapbox://tiles/";n+=r.path.replace("/v4/","");var i=r.params;return e&&(i=i.filter((function(t){return!t.match(/^access_token=/)}))),i.length&&(n+="?"+i.join("&")),n},X.prototype.canonicalizeTileset=function(t,e){for(var r=!!e&&Z(e),n=[],i=0,o=t.tiles||[];i<o.length;i+=1){var a=o[i];W(a)?n.push(this.canonicalizeTileURL(a,r)):n.push(a)}return n},X.prototype._makeAPIURL=function(t,e){var r="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",n=J(B.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,"http"===t.protocol){var i=t.params.indexOf("secure");i>=0&&t.params.splice(i,1)}if("/"!==n.path&&(t.path=""+n.path+t.path),!B.REQUIRE_ACCESS_TOKEN)return K(t);if(!(e=e||B.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),K(t)},X.prototype.setTransformRequest=function(t){this._transformRequestFn=t};var Y=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function W(t){return Y.test(t)}var H=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function J(t){var e=t.match(H);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 K(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=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(a.atob(e[1]).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return null}}var Q=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};Q.prototype.getStorageKey=function(t){var e,r=$(B.ACCESS_TOKEN);return e=r&&r.u?a.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x"+e))}))):B.ACCESS_TOKEN||"",t?"mapbox.eventData."+t+":"+e:"mapbox.eventData:"+e},Q.prototype.fetchEventData=function(){var t=L("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{var n=a.localStorage.getItem(e);n&&(this.eventData=JSON.parse(n));var i=a.localStorage.getItem(r);i&&(this.anonId=i)}catch(t){E("Unable to read from LocalStorage")}},Q.prototype.saveEventData=function(){var t=L("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{a.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&a.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){E("Unable to write to LocalStorage")}},Q.prototype.processRequests=function(t){},Q.prototype.postEvent=function(t,e,r,n){var i=this;if(B.EVENTS_URL){var o=J(B.EVENTS_URL);o.params.push("access_token="+(n||B.ACCESS_TOKEN||""));var a={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.15.2",skuId:G,userId:this.anonId},s=e?p(a,e):a,u={url:K(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=wt(u,(function(t){i.pendingRequest=null,r(t),i.saveEventData(),i.processRequests(n)}))}},Q.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var tt,et,rt=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)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,r,n){this.skuToken=r,(B.EVENTS_URL&&n||B.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return Z(t)||W(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(),y(this.anonId)||(this.anonId=g()),this.postEvent(i,{skuToken:this.skuToken},(function(t){t||n&&(e.success[n]=!0)}),t))}},e}(Q),nt=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)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){B.EVENTS_URL&&B.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return Z(t)||W(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=$(B.ACCESS_TOKEN),n=r?r.u:B.ACCESS_TOKEN,i=n!==this.eventData.tokenU;y(this.anonId)||(this.anonId=g(),i=!0);var o=this.queue.shift();if(this.eventData.lastSuccess){var a=new Date(this.eventData.lastSuccess),s=new Date(o),u=(o-this.eventData.lastSuccess)/864e5;i=i||u>=1||u<-1||a.getDate()!==s.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(o,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=o,e.eventData.tokenU=n)}),t)}},e}(Q)),it=nt.postTurnstileEvent.bind(nt),ot=new rt,at=ot.postMapLoadEvent.bind(ot),st=500,ut=50;function lt(){a.caches&&!tt&&(tt=a.caches.open("mapbox-tiles"))}function ct(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ht,pt=1/0;function ft(){return null==ht&&(ht=a.OffscreenCanvas&&new a.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.createImageBitmap),ht}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 gt=function(t){function e(e,r,n){401===r&&W(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)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),yt=C()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===a.location.protocol?a.parent:a).location.href};function mt(t,e){var r,n=new a.AbortController,i=new a.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:yt(),signal:n.signal}),o=!1,s=!1,u=(r=i.url).indexOf("sku=")>0&&W(r);"json"===t.type&&i.headers.set("Accept","application/json");var l=function(r,n,o){if(!s){if(r&&"SecurityError"!==r.message&&E(r),n&&o)return c(n);var l=Date.now();a.fetch(i).then((function(r){if(r.ok){var n=u?r.clone():null;return c(r,n,l)}return e(new gt(r.statusText,r.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},c=function(r,n,u){("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((function(t){s||(n&&u&&function(t,e,r){if(lt(),tt){var n={status:e.status,statusText:e.statusText,headers:new a.Headers};e.headers.forEach((function(t,e){return n.headers.set(e,t)}));var i=P(e.headers.get("Cache-Control")||"");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<42e4||function(t,e){if(void 0===et)try{new Response(new ReadableStream),et=!0}catch(t){et=!1}et?e(t.body):t.blob().then(e)}(e,(function(e){var r=new a.Response(e,n);lt(),tt&&tt.then((function(e){return e.put(ct(t.url),r)})).catch((function(t){return E(t.message)}))})))}}(i,n,u),o=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((function(t){s||e(new Error(t.message))}))};return u?function(t,e){if(lt(),!tt)return e(null);var r=ct(t.url);tt.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=P(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)}(i,l):l(null,null),{cancel:function(){s=!0,o||n.abort()}}}var vt,_t,xt=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(C()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!C()){var r=t.url.substring(0,t.url.indexOf("://"));return(B.REGISTERED_PROTOCOLS[r]||mt)(t,e)}}if(!(/^file:/.test(n=t.url)||/^file:/.test(yt())&&!/^\w+:/.test(n))){if(a.fetch&&a.Request&&a.AbortController&&a.Request.prototype.hasOwnProperty("signal"))return mt(t,e);if(C()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var n;return function(t,e){var r=new a.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 gt(r.statusText,r.status,t.url))},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e)},bt=function(t,e){return xt(p(t,{type:"arrayBuffer"}),e)},wt=function(t,e){return xt(p(t,{method:"POST"}),e)},Et="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";vt=[],_t=0;var It=function(t,e){if(U.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),_t>=B.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return vt.push(r),r}_t++;var n=!1,i=function(){if(!n)for(n=!0,_t--;vt.length&&_t<B.MAX_PARALLEL_IMAGE_REQUESTS;){var t=vt.shift();t.cancelled||(t.cancel=It(t.requestParameters,t.callback).cancel)}},o=bt(t,(function(t,r,n,o){i(),t?e(t):r&&(ft()?function(t,e){var r=new a.Blob([new Uint8Array(t)],{type:"image/png"});a.createImageBitmap(r).then((function(t){e(null,t)})).catch((function(t){e(new Error("Could not load image because of "+t.message+". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}))}(r,e):function(t,e,r,n){var i=new a.Image,o=a.URL;i.onload=function(){e(null,i),o.revokeObjectURL(i.src),i.onload=null,a.requestAnimationFrame((function(){i.src=Et}))},i.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 a.Blob([new Uint8Array(t)],{type:"image/png"});i.cacheControl=r,i.expires=n,i.src=t.byteLength?o.createObjectURL(s):Et}(r,e,n,o))}));return{cancel:function(){o.cancel(),i()}}};function St(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function Ct(t,e,r){if(r&&r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}var Pt=function(t,e){void 0===e&&(e={}),p(this,e),this.type=t},Mt=function(t){function e(e,r){void 0===r&&(r={}),t.call(this,"error",p({error:e},r))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Pt),Tt=function(){};Tt.prototype.on=function(t,e){return this._listeners=this._listeners||{},St(t,e,this._listeners),this},Tt.prototype.off=function(t,e){return Ct(t,e,this._listeners),Ct(t,e,this._oneTimeListeners),this},Tt.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},St(t,e,this._oneTimeListeners),this},Tt.prototype.fire=function(t,e){"string"==typeof t&&(t=new Pt(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 o=0,a=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];o<a.length;o+=1){var s=a[o];Ct(r,s,this._oneTimeListeners),s.call(this,t)}var u=this._eventedParent;u&&(p(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),u.fire(t))}else t instanceof Mt&&console.error(t.error);return this},Tt.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)},Tt.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Lt={$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"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{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"},volatile:{type:"boolean",default:!1},"*":{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"},volatile:{type:"boolean",default:!1},"*":{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},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},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":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},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"}},promoteId:{"*":{type:"string"}}},At=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function kt(t){var e=t.value;return e?[new At(t.key,e,"constants have been deprecated as of v8")]:[]}function Nt(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 o=i[n];for(var a in o)t[a]=o[a]}return t}function Dt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Rt(t){if(Array.isArray(t))return t.map(Rt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){var e={};for(var r in t)e[r]=Rt(t[r]);return e}return Dt(t)}var Ot=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)).constructor=e,e}(Error),zt=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];this.bindings[i[0]]=i[1]}};zt.prototype.concat=function(t){return new zt(this,t)},zt.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.")},zt.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var Ft={kind:"null"},Bt={kind:"number"},Ut={kind:"string"},jt={kind:"boolean"},Vt={kind:"color"},qt={kind:"object"},Gt={kind:"value"},Xt={kind:"collator"},Zt={kind:"formatted"},Yt={kind:"resolvedImage"};function Wt(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 Jt=[Ft,Bt,Ut,jt,Vt,Zt,qt,Wt(Gt),Yt];function Kt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Kt(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=Jt;r<n.length;r+=1)if(!Kt(n[r],e))return null}return"Expected "+Ht(t)+" but found "+Ht(e)+" instead."}function $t(t,e){return e.some((function(e){return e.kind===t.kind}))}function Qt(t,e){return e.some((function(e){return"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t}))}var te=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 n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function a(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,s=t.replace(/ /g,"").toLowerCase();if(s in r)return r[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.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===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var u=s.indexOf("("),l=s.indexOf(")");if(-1!==u&&l+1===s.length){var c=s.substr(0,u),h=s.substr(u+1,l-(u+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=o(h.pop());case"rgb":return 3!==h.length?null:[i(h[0]),i(h[1]),i(h[2]),p];case"hsla":if(4!==h.length)return null;p=o(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,d=o(h[1]),g=o(h[2]),y=g<=.5?g*(d+1):g+d-g*d,m=2*g-y;return[n(255*a(m,y,f+1/3)),n(255*a(m,y,f)),n(255*a(m,y,f-1/3)),p];default:return null}}return null}}catch(t){}})).parseCSSColor,ee=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};ee.parse=function(t){if(t){if(t instanceof ee)return t;if("string"==typeof t){var e=te(t);if(e)return new ee(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},ee.prototype.toString=function(){var t=this.toArray(),e=t[1],r=t[2],n=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(r)+","+n+")"},ee.prototype.toArray=function(){var t=this.a;return 0===t?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},ee.black=new ee(0,0,0,1),ee.white=new ee(1,1,1,1),ee.transparent=new ee(0,0,0,0),ee.red=new ee(1,0,0,1);var re=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"})};re.prototype.compare=function(t,e){return this.collator.compare(t,e)},re.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var ne=function(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i},ie=function(t){this.sections=t};ie.fromString=function(t){return new ie([new ne(t,null,null,null,null)])},ie.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}))},ie.factory=function(t){return t instanceof ie?t:ie.fromString(t)},ie.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},ie.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 oe=function(t){this.name=t.name,this.available=t.available};function ae(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 se(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof ee)return!0;if(t instanceof re)return!0;if(t instanceof ie)return!0;if(t instanceof oe)return!0;if(Array.isArray(t)){for(var e=0,r=t;e<r.length;e+=1)if(!se(r[e]))return!1;return!0}if("object"==typeof t){for(var n in t)if(!se(t[n]))return!1;return!0}return!1}function ue(t){if(null===t)return Ft;if("string"==typeof t)return Ut;if("boolean"==typeof t)return jt;if("number"==typeof t)return Bt;if(t instanceof ee)return Vt;if(t instanceof re)return Xt;if(t instanceof ie)return Zt;if(t instanceof oe)return Yt;if(Array.isArray(t)){for(var e,r=t.length,n=0,i=t;n<i.length;n+=1){var o=ue(i[n]);if(e){if(e===o)continue;e=Gt;break}e=o}return Wt(e||Gt,r)}return qt}function le(t){var e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof ee||t instanceof ie||t instanceof oe?t.toString():JSON.stringify(t)}oe.prototype.toString=function(){return this.name},oe.fromString=function(t){return t?new oe({name:t,available:!1}):null},oe.prototype.serialize=function(){return["image",this.name]};var ce=function(t,e){this.type=t,this.value=e};ce.parse=function(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!se(t[1]))return e.error("invalid value");var r=t[1],n=ue(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 ce(n,r)},ce.prototype.evaluate=function(){return this.value},ce.prototype.eachChild=function(){},ce.prototype.outputDefined=function(){return!0},ce.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof ee?["rgba"].concat(this.value.toArray()):this.value instanceof ie?this.value.serialize():this.value};var he=function(t){this.name="ExpressionEvaluationError",this.message=t};he.prototype.toJSON=function(){return this.message};var pe={string:Ut,number:Bt,boolean:jt,object:qt},fe=function(t,e){this.type=t,this.args=e};fe.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 o,a;if(t.length>2){var s=t[1];if("string"!=typeof s||!(s in pe)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);o=pe[s],n++}else o=Gt;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);a=t[2],n++}r=Wt(o,a)}else r=pe[i];for(var u=[];n<t.length;n++){var l=e.parse(t[n],n,Gt);if(!l)return null;u.push(l)}return new fe(r,u)},fe.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var r=this.args[e].evaluate(t);if(!Kt(this.type,ue(r)))return r;if(e===this.args.length-1)throw new he("Expected value to be of type "+Ht(this.type)+", but found "+Ht(ue(r))+" instead.")}return null},fe.prototype.eachChild=function(t){this.args.forEach(t)},fe.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},fe.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 de=function(t){this.type=Zt,this.sections=t};de.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,o=1;o<=t.length-1;++o){var a=t[o];if(i&&"object"==typeof a&&!Array.isArray(a)){i=!1;var s=null;if(a["font-scale"]&&!(s=e.parse(a["font-scale"],1,Bt)))return null;var u=null;if(a["text-font"]&&!(u=e.parse(a["text-font"],1,Wt(Ut))))return null;var l=null;if(a["text-color"]&&!(l=e.parse(a["text-color"],1,Vt)))return null;var c=n[n.length-1];c.scale=s,c.font=u,c.textColor=l}else{var h=e.parse(t[o],1,Gt);if(!h)return null;var p=h.type.kind;if("string"!==p&&"value"!==p&&"null"!==p&&"resolvedImage"!==p)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:h,scale:null,font:null,textColor:null})}}return new de(n)},de.prototype.evaluate=function(t){return new ie(this.sections.map((function(e){var r=e.content.evaluate(t);return ue(r)===Yt?new ne("",r,null,null,null):new ne(le(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},de.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)}},de.prototype.outputDefined=function(){return!1},de.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 ge=function(t){this.type=Yt,this.input=t};ge.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 ge(r):e.error("No image name provided.")},ge.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=oe.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r},ge.prototype.eachChild=function(t){t(this.input)},ge.prototype.outputDefined=function(){return!1},ge.prototype.serialize=function(){return["image",this.input.serialize()]};var ye={"to-boolean":jt,"to-color":Vt,"to-number":Bt,"to-string":Ut},me=function(t,e){this.type=t,this.args=e};me.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=ye[r],i=[],o=1;o<t.length;o++){var a=e.parse(t[o],o,Gt);if(!a)return null;i.push(a)}return new me(n,i)},me.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 ee)return e;if("string"==typeof e){var o=t.parseColor(e);if(o)return o}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.":ae(e[0],e[1],e[2],e[3])))return new ee(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new he(r||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var a=null,s=0,u=this.args;s<u.length;s+=1){if(null===(a=u[s].evaluate(t)))return 0;var l=Number(a);if(!isNaN(l))return l}throw new he("Could not convert "+JSON.stringify(a)+" to number.")}return"formatted"===this.type.kind?ie.fromString(le(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?oe.fromString(le(this.args[0].evaluate(t))):le(this.args[0].evaluate(t))},me.prototype.eachChild=function(t){this.args.forEach(t)},me.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},me.prototype.serialize=function(){if("formatted"===this.type.kind)return new de([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ge(this.args[0]).serialize();var t=["to-"+this.type.kind];return this.eachChild((function(e){t.push(e.serialize())})),t};var ve=["Unknown","Point","LineString","Polygon"],_e=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null};_e.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},_e.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?ve[this.feature.type]:this.feature.type:null},_e.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},_e.prototype.canonicalID=function(){return this.canonical},_e.prototype.properties=function(){return this.feature&&this.feature.properties||{}},_e.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=ee.parse(t)),e};var xe=function(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n};xe.prototype.evaluate=function(t){return this._evaluate(t,this.args)},xe.prototype.eachChild=function(t){this.args.forEach(t)},xe.prototype.outputDefined=function(){return!1},xe.prototype.serialize=function(){return[this.name].concat(this.args.map((function(t){return t.serialize()})))},xe.parse=function(t,e){var r,n=t[0],i=xe.definitions[n];if(!i)return e.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0);for(var o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter((function(e){var r=e[0];return!Array.isArray(r)||r.length===t.length-1})),u=null,l=0,c=s;l<c.length;l+=1){var h=c[l],p=h[0],f=h[1];u=new Ve(e.registry,e.path,null,e.scope);for(var d=[],g=!1,y=1;y<t.length;y++){var m=t[y],v=Array.isArray(p)?p[y-1]:p.type,_=u.parse(m,1+d.length,v);if(!_){g=!0;break}d.push(_)}if(!g)if(Array.isArray(p)&&p.length!==d.length)u.error("Expected "+p.length+" arguments, but found "+d.length+" instead.");else{for(var x=0;x<d.length;x++){var b=Array.isArray(p)?p[x]:p.type,w=d[x];u.concat(x+1).checkSubtype(b,w.type)}if(0===u.errors.length)return new xe(n,o,f,d)}}if(1===s.length)(r=e.errors).push.apply(r,u.errors);else{for(var E=(s.length?s:a).map((function(t){var e;return e=t[0],Array.isArray(e)?"("+e.map(Ht).join(", ")+")":"("+Ht(e.type)+"...)"})).join(" | "),I=[],S=1;S<t.length;S++){var C=e.parse(t[S],1+I.length);if(!C)return null;I.push(Ht(C.type))}e.error("Expected arguments of type "+E+", but found ("+I.join(", ")+") instead.")}return null},xe.register=function(t,e){for(var r in xe.definitions=e,e)t[r]=xe};var be=function(t,e,r){this.type=Xt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e};function we(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Ee(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Ie(t,e){var r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*8192),Math.round(n*i*8192)]}function Se(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function Ce(t,e){for(var r,n,i,o,a,s,u,l=!1,c=0,h=e.length;c<h;c++)for(var p=e[c],f=0,d=p.length;f<d-1;f++){if((o=(r=t)[0]-(n=p[f])[0])*(u=r[1]-(i=p[f+1])[1])-(s=r[0]-i[0])*(a=r[1]-n[1])==0&&o*s<=0&&a*u<=0)return!1;Se(t,p[f],p[f+1])&&(l=!l)}return l}function Pe(t,e){for(var r=0;r<e.length;r++)if(Ce(t,e[r]))return!0;return!1}function Me(t,e,r,n){var i=n[0]-r[0],o=n[1]-r[1],a=(t[0]-r[0])*o-i*(t[1]-r[1]),s=(e[0]-r[0])*o-i*(e[1]-r[1]);return a>0&&s<0||a<0&&s>0}function Te(t,e,r){for(var n=0,i=r;n<i.length;n+=1)for(var o=i[n],a=0;a<o.length-1;++a)if(0!=(h=[(c=o[a+1])[0]-(l=o[a])[0],c[1]-l[1]])[0]*(p=[(u=e)[0]-(s=t)[0],u[1]-s[1]])[1]-h[1]*p[0]&&Me(s,u,l,c)&&Me(l,c,s,u))return!0;var s,u,l,c,h,p;return!1}function Le(t,e){for(var r=0;r<t.length;++r)if(!Ce(t[r],e))return!1;for(var n=0;n<t.length-1;++n)if(Te(t[n],t[n+1],e))return!1;return!0}function Ae(t,e){for(var r=0;r<e.length;r++)if(Le(t,e[r]))return!0;return!1}function ke(t,e,r){for(var n=[],i=0;i<t.length;i++){for(var o=[],a=0;a<t[i].length;a++){var s=Ie(t[i][a],r);we(e,s),o.push(s)}n.push(o)}return n}function Ne(t,e,r){for(var n=[],i=0;i<t.length;i++){var o=ke(t[i],e,r);n.push(o)}return n}function De(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){var i=.5*n,o=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;0===o&&(o=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=o}we(e,t)}function Re(t,e,r,n){for(var i=8192*Math.pow(2,n.z),o=[8192*n.x,8192*n.y],a=[],s=0,u=t;s<u.length;s+=1)for(var l=0,c=u[s];l<c.length;l+=1){var h=c[l],p=[h.x+o[0],h.y+o[1]];De(p,e,r,i),a.push(p)}return a}function Oe(t,e,r,n){for(var i,o=8192*Math.pow(2,n.z),a=[8192*n.x,8192*n.y],s=[],u=0,l=t;u<l.length;u+=1){for(var c=[],h=0,p=l[u];h<p.length;h+=1){var f=p[h],d=[f.x+a[0],f.y+a[1]];we(e,d),c.push(d)}s.push(c)}if(e[2]-e[0]<=o/2){(i=e)[0]=i[1]=1/0,i[2]=i[3]=-1/0;for(var g=0,y=s;g<y.length;g+=1)for(var m=0,v=y[g];m<v.length;m+=1)De(v[m],e,r,o)}return s}be.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 o=null;return r.locale&&!(o=e.parse(r.locale,1,Ut))?null:new be(n,i,o)},be.prototype.evaluate=function(t){return new re(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},be.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},be.prototype.outputDefined=function(){return!1},be.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 ze=function(t,e){this.type=jt,this.geojson=t,this.geometries=e};function Fe(t){if(t instanceof xe){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}if(t instanceof ze)return!1;var e=!0;return t.eachChild((function(t){e&&!Fe(t)&&(e=!1)})),e}function Be(t){if(t instanceof xe&&"feature-state"===t.name)return!1;var e=!0;return t.eachChild((function(t){e&&!Be(t)&&(e=!1)})),e}function Ue(t,e){if(t instanceof xe&&e.indexOf(t.name)>=0)return!1;var r=!0;return t.eachChild((function(t){r&&!Ue(t,e)&&(r=!1)})),r}ze.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(se(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;n<r.features.length;++n){var i=r.features[n].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new ze(r,r.features[n].geometry)}else if("Feature"===r.type){var o=r.geometry.type;if("Polygon"===o||"MultiPolygon"===o)return new ze(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new ze(r,r)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")},ze.prototype.evaluate=function(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){var r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){var o=ke(e.coordinates,n,i),a=Re(t.geometry(),r,n,i);if(!Ee(r,n))return!1;for(var s=0,u=a;s<u.length;s+=1)if(!Ce(u[s],o))return!1}if("MultiPolygon"===e.type){var l=Ne(e.coordinates,n,i),c=Re(t.geometry(),r,n,i);if(!Ee(r,n))return!1;for(var h=0,p=c;h<p.length;h+=1)if(!Pe(p[h],l))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){var r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if("Polygon"===e.type){var o=ke(e.coordinates,n,i),a=Oe(t.geometry(),r,n,i);if(!Ee(r,n))return!1;for(var s=0,u=a;s<u.length;s+=1)if(!Le(u[s],o))return!1}if("MultiPolygon"===e.type){var l=Ne(e.coordinates,n,i),c=Oe(t.geometry(),r,n,i);if(!Ee(r,n))return!1;for(var h=0,p=c;h<p.length;h+=1)if(!Ae(p[h],l))return!1}return!0}(t,this.geometries)}return!1},ze.prototype.eachChild=function(){},ze.prototype.outputDefined=function(){return!0},ze.prototype.serialize=function(){return["within",this.geojson]};var je=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};je.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 je(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)},je.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},je.prototype.eachChild=function(){},je.prototype.outputDefined=function(){return!1},je.prototype.serialize=function(){return["var",this.name]};var Ve=function(t,e,r,n,i){void 0===e&&(e=[]),void 0===n&&(n=new zt),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 qe(t,e){for(var r,n=t.length-1,i=0,o=n,a=0;i<=o;)if((r=t[a=Math.floor((i+o)/2)])<=e){if(a===n||e<t[a+1])return a;i=a+1}else{if(!(r>e))throw new he("Input is not a number.");o=a-1}return 0}Ve.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)},Ve.prototype._parse=function(t,e){function r(t,e,r){return"assert"===r?new fe(e,[t]):"coerce"===r?new me(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 o=i.parse(t,this);if(!o)return null;if(this.expectedType){var a=this.expectedType,s=o.type;if("string"!==a.kind&&"number"!==a.kind&&"boolean"!==a.kind&&"object"!==a.kind&&"array"!==a.kind||"value"!==s.kind)if("color"!==a.kind&&"formatted"!==a.kind&&"resolvedImage"!==a.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(a,s))return null}else o=r(o,a,e.typeAnnotation||"coerce");else o=r(o,a,e.typeAnnotation||"assert")}if(!(o instanceof ce)&&"resolvedImage"!==o.type.kind&&function t(e){if(e instanceof je)return t(e.boundExpression);if(e instanceof xe&&"error"===e.name)return!1;if(e instanceof be)return!1;if(e instanceof ze)return!1;var r=e instanceof me||e instanceof fe,n=!0;return e.eachChild((function(e){n=r?n&&t(e):n&&e instanceof ce})),!!n&&Fe(e)&&Ue(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(o)){var u=new _e;try{o=new ce(o.type,o.evaluate(u))}catch(t){return this.error(t.message),null}}return o}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},Ve.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 Ve(this.registry,n,e||null,i,this.errors)},Ve.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 Ot(n,t))},Ve.prototype.checkSubtype=function(t,e){var r=Kt(t,e);return r&&this.error(r),r};var Ge=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 o=i[n],a=o[1];this.labels.push(o[0]),this.outputs.push(a)}};function Xe(t,e,r){return t*(1-r)+e*r}Ge.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,Bt);if(!r)return null;var n=[],i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(var o=1;o<t.length;o+=2){var a=1===o?-1/0:t[o],s=t[o+1],u=o,l=o+1;if("number"!=typeof a)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]>=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var c=e.parse(s,l,i);if(!c)return null;i=i||c.type,n.push([a,c])}return new Ge(i,r,n)},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;return n>=e[i-1]?r[i-1].evaluate(t):r[qe(e,n)].evaluate(t)},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.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},Ge.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:Xe,color:function(t,e,r){return new ee(Xe(t.r,e.r,r),Xe(t.g,e.g,r),Xe(t.b,e.b,r),Xe(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,n){return Xe(t,e[n],r)}))}}),Ye=6/29*3*(6/29),We=Math.PI/180,He=180/Math.PI;function Je(t){return t>.008856451679035631?Math.pow(t,1/3):t/Ye+4/29}function Ke(t){return t>6/29?t*t*t:Ye*(t-4/29)}function $e(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Qe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function tr(t){var e=Qe(t.r),r=Qe(t.g),n=Qe(t.b),i=Je((.4124564*e+.3575761*r+.1804375*n)/.95047),o=Je((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*o-16,a:500*(i-o),b:200*(o-Je((.0193339*e+.119192*r+.9503041*n)/1.08883)),alpha:t.a}}function er(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=1*Ke(e),r=.95047*Ke(r),n=1.08883*Ke(n),new ee($e(3.2404542*r-1.5371385*e-.4985314*n),$e(-.969266*r+1.8760108*e+.041556*n),$e(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function rr(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var nr={forward:tr,reverse:er,interpolate:function(t,e,r){return{l:Xe(t.l,e.l,r),a:Xe(t.a,e.a,r),b:Xe(t.b,e.b,r),alpha:Xe(t.alpha,e.alpha,r)}}},ir={forward:function(t){var e=tr(t),r=e.l,n=e.a,i=e.b,o=Math.atan2(i,n)*He;return{h:o<0?o+360:o,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*We,r=t.c;return er({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:rr(t.h,e.h,r),c:Xe(t.c,e.c,r),l:Xe(t.l,e.l,r),alpha:Xe(t.alpha,e.alpha,r)}}},or=Object.freeze({__proto__:null,lab:nr,hcl:ir}),ar=function(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var o=0,a=i;o<a.length;o+=1){var s=a[o],u=s[1];this.labels.push(s[0]),this.outputs.push(u)}};function sr(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}ar.interpolationFactor=function(t,e,n,i){var o=0;if("exponential"===t.name)o=sr(e,t.base,n,i);else if("linear"===t.name)o=sr(e,1,n,i);else if("cubic-bezier"===t.name){var a=t.controlPoints;o=new r(a[0],a[1],a[2],a[3]).solve(sr(e,1,n,i))}return o},ar.parse=function(t,e){var r=t[0],n=t[1],i=t[2],o=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 a=n[1];if("number"!=typeof a)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:a}}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,Bt)))return null;var u=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=Vt:e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(var c=0;c<o.length;c+=2){var h=o[c],p=o[c+1],f=c+3,d=c+4;if("number"!=typeof h)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]>=h)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var g=e.parse(p,d,l);if(!g)return null;l=l||g.type,u.push([h,g])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new ar(l,r,n,i,u):e.error("Type "+Ht(l)+" is not interpolatable.")},ar.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 o=qe(e,n),a=ar.interpolationFactor(this.interpolation,n,e[o],e[o+1]),s=r[o].evaluate(t),u=r[o+1].evaluate(t);return"interpolate"===this.operator?Ze[this.type.kind.toLowerCase()](s,u,a):"interpolate-hcl"===this.operator?ir.reverse(ir.interpolate(ir.forward(s),ir.forward(u),a)):nr.reverse(nr.interpolate(nr.forward(s),nr.forward(u),a))},ar.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e<r.length;e+=1)t(r[e])},ar.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},ar.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 ur=function(t,e){this.type=t,this.args=e};ur.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=[],o=0,a=t.slice(1);o<a.length;o+=1){var s=e.parse(a[o],1+i.length,r,void 0,{typeAnnotation:"omit"});if(!s)return null;r=r||s.type,i.push(s)}var u=n&&i.some((function(t){return Kt(n,t.type)}));return new ur(u?Gt:r,i)},ur.prototype.evaluate=function(t){for(var e,r=null,n=0,i=0,o=this.args;i<o.length&&(n++,(r=o[i].evaluate(t))&&r instanceof oe&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null===r);i+=1);return r},ur.prototype.eachChild=function(t){this.args.forEach(t)},ur.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},ur.prototype.serialize=function(){var t=["coalesce"];return this.eachChild((function(e){t.push(e.serialize())})),t};var lr=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};lr.prototype.evaluate=function(t){return this.result.evaluate(t)},lr.prototype.eachChild=function(t){for(var e=0,r=this.bindings;e<r.length;e+=1)t(r[e][1]);t(this.result)},lr.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 o=e.parse(t[n+1],n+1);if(!o)return null;r.push([i,o])}var a=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return a?new lr(r,a):null},lr.prototype.outputDefined=function(){return this.result.outputDefined()},lr.prototype.serialize=function(){for(var t=["let"],e=0,r=this.bindings;e<r.length;e+=1){var n=r[e];t.push(n[0],n[1].serialize())}return t.push(this.result.serialize()),t};var cr=function(t,e,r){this.type=t,this.index=e,this.input=r};cr.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,Bt),n=e.parse(t[2],2,Wt(e.expectedType||Gt));return r&&n?new cr(n.type.itemType,r,n):null},cr.prototype.evaluate=function(t){var e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new he("Array index out of bounds: "+e+" < 0.");if(e>=r.length)throw new he("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new he("Array index must be an integer, but found "+e+" instead.");return r[e]},cr.prototype.eachChild=function(t){t(this.index),t(this.input)},cr.prototype.outputDefined=function(){return!1},cr.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var hr=function(t,e){this.type=jt,this.needle=t,this.haystack=e};hr.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,Gt),n=e.parse(t[2],2,Gt);return r&&n?$t(r.type,[jt,Ut,Bt,Ft,Gt])?new hr(r,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Ht(r.type)+" instead"):null},hr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!Qt(e,["boolean","string","number","null"]))throw new he("Expected first argument to be of type boolean, string, number or null, but found "+Ht(ue(e))+" instead.");if(!Qt(r,["string","array"]))throw new he("Expected second argument to be of type array or string, but found "+Ht(ue(r))+" instead.");return r.indexOf(e)>=0},hr.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},hr.prototype.outputDefined=function(){return!0},hr.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var pr=function(t,e,r){this.type=Bt,this.needle=t,this.haystack=e,this.fromIndex=r};pr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Gt),n=e.parse(t[2],2,Gt);if(!r||!n)return null;if(!$t(r.type,[jt,Ut,Bt,Ft,Gt]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Ht(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Bt);return i?new pr(r,n,i):null}return new pr(r,n)},pr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Qt(e,["boolean","string","number","null"]))throw new he("Expected first argument to be of type boolean, string, number or null, but found "+Ht(ue(e))+" instead.");if(!Qt(r,["string","array"]))throw new he("Expected second argument to be of type array or string, but found "+Ht(ue(r))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)},pr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},pr.prototype.outputDefined=function(){return!1},pr.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var fr=function(t,e,r,n,i,o){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=o};fr.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={},o=[],a=2;a<t.length-1;a+=2){var s=t[a],u=t[a+1];Array.isArray(s)||(s=[s]);var l=e.concat(a);if(0===s.length)return l.error("Expected at least one branch label.");for(var c=0,h=s;c<h.length;c+=1){var p=h[c];if("number"!=typeof p&&"string"!=typeof p)return l.error("Branch labels must be numbers or strings.");if("number"==typeof p&&Math.abs(p)>Number.MAX_SAFE_INTEGER)return l.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof p&&Math.floor(p)!==p)return l.error("Numeric branch labels must be integer values.");if(r){if(l.checkSubtype(r,ue(p)))return null}else r=ue(p);if(void 0!==i[String(p)])return l.error("Branch labels must be unique.");i[String(p)]=o.length}var f=e.parse(u,a,n);if(!f)return null;n=n||f.type,o.push(f)}var d=e.parse(t[1],1,Gt);if(!d)return null;var g=e.parse(t[t.length-1],t.length-1,n);return g?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new fr(r,n,d,i,o,g):null},fr.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(ue(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},fr.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},fr.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},fr.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,o=Object.keys(this.cases).sort();i<o.length;i+=1){var a=o[i];void 0===(h=n[this.cases[a]])?(n[this.cases[a]]=r.length,r.push([this.cases[a],[a]])):r[h][1].push(a)}for(var s=function(e){return"number"===t.inputType.kind?Number(e):e},u=0,l=r;u<l.length;u+=1){var c=l[u],h=c[0],p=c[1];e.push(1===p.length?s(p[0]):p.map(s)),e.push(this.outputs[outputIndex$1].serialize())}return e.push(this.otherwise.serialize()),e};var dr=function(t,e,r){this.type=t,this.branches=e,this.otherwise=r};dr.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 o=e.parse(t[i],i,jt);if(!o)return null;var a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([o,a]),r=r||a.type}var s=e.parse(t[t.length-1],t.length-1,r);return s?new dr(r,n,s):null},dr.prototype.evaluate=function(t){for(var e=0,r=this.branches;e<r.length;e+=1){var n=r[e],i=n[1];if(n[0].evaluate(t))return i.evaluate(t)}return this.otherwise.evaluate(t)},dr.prototype.eachChild=function(t){for(var e=0,r=this.branches;e<r.length;e+=1){var n=r[e],i=n[1];t(n[0]),t(i)}t(this.otherwise)},dr.prototype.outputDefined=function(){return this.branches.every((function(t){return t[1].outputDefined()}))&&this.otherwise.outputDefined()},dr.prototype.serialize=function(){var t=["case"];return this.eachChild((function(e){t.push(e.serialize())})),t};var gr=function(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n};function yr(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 mr(t,e,r,n){return 0===n.compare(e,r)}function vr(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],o=e.parse(t[1],1,Gt);if(!o)return null;if(!yr(r,o.type))return e.concat(1).error('"'+r+"\" comparisons are not supported for type '"+Ht(o.type)+"'.");var a=e.parse(t[2],2,Gt);if(!a)return null;if(!yr(r,a.type))return e.concat(2).error('"'+r+"\" comparisons are not supported for type '"+Ht(a.type)+"'.");if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot compare types '"+Ht(o.type)+"' and '"+Ht(a.type)+"'.");n&&("value"===o.type.kind&&"value"!==a.type.kind?o=new fe(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new fe(o.type,[a])));var s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.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(o,a,s)},i.prototype.evaluate=function(i){var o=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){var s=ue(o),u=ue(a);if(s.kind!==u.kind||"string"!==s.kind&&"number"!==s.kind)throw new he('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=ue(o),c=ue(a);if("string"!==l.kind||"string"!==c.kind)return e(i,o,a)}return this.collator?r(i,o,a,this.collator.evaluate(i)):e(i,o,a)},i.prototype.eachChild=function(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)},i.prototype.outputDefined=function(){return!0},i.prototype.serialize=function(){var e=[t];return this.eachChild((function(t){e.push(t.serialize())})),e},i}()}gr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Gt),n=e.parse(t[2],2,Bt);if(!r||!n)return null;if(!$t(r.type,[Wt(Gt),Ut,Gt]))return e.error("Expected first argument to be of type array or string, but found "+Ht(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Bt);return i?new gr(r.type,r,n,i):null}return new gr(r.type,r,n)},gr.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Qt(e,["string","array"]))throw new he("Expected first argument to be of type array or string, but found "+Ht(ue(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)},gr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},gr.prototype.outputDefined=function(){return!1},gr.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var _r=vr("==",(function(t,e,r){return e===r}),mr),xr=vr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!mr(0,e,r,n)})),br=vr("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),wr=vr(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),Er=vr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Ir=vr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0})),Sr=function(t,e,r,n,i){this.type=Ut,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i};Sr.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Bt);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 o=null;if(n.currency&&!(o=e.parse(n.currency,1,Ut)))return null;var a=null;if(n["min-fraction-digits"]&&!(a=e.parse(n["min-fraction-digits"],1,Bt)))return null;var s=null;return n["max-fraction-digits"]&&!(s=e.parse(n["max-fraction-digits"],1,Bt))?null:new Sr(r,i,o,a,s)},Sr.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))},Sr.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)},Sr.prototype.outputDefined=function(){return!1},Sr.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=Bt,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 he("Expected value to be of type string or array, but found "+Ht(ue(e))+" instead.")},Cr.prototype.eachChild=function(t){t(this.input)},Cr.prototype.outputDefined=function(){return!1},Cr.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Pr={"==":_r,"!=":xr,">":wr,"<":br,">=":Ir,"<=":Er,array:fe,at:cr,boolean:fe,case:dr,coalesce:ur,collator:be,format:de,image:ge,in:hr,"index-of":pr,interpolate:ar,"interpolate-hcl":ar,"interpolate-lab":ar,length:Cr,let:lr,literal:ce,match:fr,number:fe,"number-format":Sr,object:fe,slice:gr,step:Ge,string:fe,"to-boolean":me,"to-color":me,"to-number":me,"to-string":me,var:je,within:ze};function Mr(t,e){var r=e[0],n=e[1],i=e[2],o=e[3];r=r.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);var a=o?o.evaluate(t):1,s=ae(r,n,i,a);if(s)throw new he(s);return new ee(r/255*a,n/255*a,i/255*a,a)}function Tr(t,e){return t in e}function Lr(t,e){var r=e[t];return void 0===r?null:r}function Ar(t){return{type:t}}function kr(t){return{result:"success",value:t}}function Nr(t){return{result:"error",value:t}}function Dr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Rr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Or(t){return!!t.expression&&t.expression.interpolated}function zr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Fr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Br(t){return t}function Ur(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function jr(t,e,r,n,i){return Ur(typeof r===i?n[r]:void 0,t.default,e.default)}function Vr(t,e,r){if("number"!==zr(r))return Ur(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=qe(t.stops.map((function(t){return t[0]})),r);return t.stops[i][1]}function qr(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==zr(r))return Ur(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 o=qe(t.stops.map((function(t){return t[0]})),r),a=function(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],u=t.stops[o+1][1],l=Ze[e.type]||Br;if(t.colorSpace&&"rgb"!==t.colorSpace){var c=or[t.colorSpace];l=function(t,e){return c.reverse(c.interpolate(c.forward(t),c.forward(e),a))}}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,a)}}:l(s,u,a)}function Gr(t,e,r){return"color"===e.type?r=ee.parse(r):"formatted"===e.type?r=ie.fromString(r.toString()):"resolvedImage"===e.type?r=oe.fromString(r.toString()):zr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Ur(r,t.default,e.default)}xe.register(Pr,{error:[{kind:"error"},[Ut],function(t,e){throw new he(e[0].evaluate(t))}],typeof:[Ut,[Gt],function(t,e){return Ht(ue(e[0].evaluate(t)))}],"to-rgba":[Wt(Bt,4),[Vt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Vt,[Bt,Bt,Bt],Mr],rgba:[Vt,[Bt,Bt,Bt,Bt],Mr],has:{type:jt,overloads:[[[Ut],function(t,e){return Tr(e[0].evaluate(t),t.properties())}],[[Ut,qt],function(t,e){var r=e[1];return Tr(e[0].evaluate(t),r.evaluate(t))}]]},get:{type:Gt,overloads:[[[Ut],function(t,e){return Lr(e[0].evaluate(t),t.properties())}],[[Ut,qt],function(t,e){var r=e[1];return Lr(e[0].evaluate(t),r.evaluate(t))}]]},"feature-state":[Gt,[Ut],function(t,e){return Lr(e[0].evaluate(t),t.featureState||{})}],properties:[qt,[],function(t){return t.properties()}],"geometry-type":[Ut,[],function(t){return t.geometryType()}],id:[Gt,[],function(t){return t.id()}],zoom:[Bt,[],function(t){return t.globals.zoom}],"heatmap-density":[Bt,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Bt,[],function(t){return t.globals.lineProgress||0}],accumulated:[Gt,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Bt,Ar(Bt),function(t,e){for(var r=0,n=0,i=e;n<i.length;n+=1)r+=i[n].evaluate(t);return r}],"*":[Bt,Ar(Bt),function(t,e){for(var r=1,n=0,i=e;n<i.length;n+=1)r*=i[n].evaluate(t);return r}],"-":{type:Bt,overloads:[[[Bt,Bt],function(t,e){var r=e[1];return e[0].evaluate(t)-r.evaluate(t)}],[[Bt],function(t,e){return-e[0].evaluate(t)}]]},"/":[Bt,[Bt,Bt],function(t,e){var r=e[1];return e[0].evaluate(t)/r.evaluate(t)}],"%":[Bt,[Bt,Bt],function(t,e){var r=e[1];return e[0].evaluate(t)%r.evaluate(t)}],ln2:[Bt,[],function(){return Math.LN2}],pi:[Bt,[],function(){return Math.PI}],e:[Bt,[],function(){return Math.E}],"^":[Bt,[Bt,Bt],function(t,e){var r=e[1];return Math.pow(e[0].evaluate(t),r.evaluate(t))}],sqrt:[Bt,[Bt],function(t,e){return Math.sqrt(e[0].evaluate(t))}],log10:[Bt,[Bt],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN10}],ln:[Bt,[Bt],function(t,e){return Math.log(e[0].evaluate(t))}],log2:[Bt,[Bt],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN2}],sin:[Bt,[Bt],function(t,e){return Math.sin(e[0].evaluate(t))}],cos:[Bt,[Bt],function(t,e){return Math.cos(e[0].evaluate(t))}],tan:[Bt,[Bt],function(t,e){return Math.tan(e[0].evaluate(t))}],asin:[Bt,[Bt],function(t,e){return Math.asin(e[0].evaluate(t))}],acos:[Bt,[Bt],function(t,e){return Math.acos(e[0].evaluate(t))}],atan:[Bt,[Bt],function(t,e){return Math.atan(e[0].evaluate(t))}],min:[Bt,Ar(Bt),function(t,e){return Math.min.apply(Math,e.map((function(e){return e.evaluate(t)})))}],max:[Bt,Ar(Bt),function(t,e){return Math.max.apply(Math,e.map((function(e){return e.evaluate(t)})))}],abs:[Bt,[Bt],function(t,e){return Math.abs(e[0].evaluate(t))}],round:[Bt,[Bt],function(t,e){var r=e[0].evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Bt,[Bt],function(t,e){return Math.floor(e[0].evaluate(t))}],ceil:[Bt,[Bt],function(t,e){return Math.ceil(e[0].evaluate(t))}],"filter-==":[jt,[Ut,Gt],function(t,e){var r=e[0],n=e[1];return t.properties()[r.value]===n.value}],"filter-id-==":[jt,[Gt],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,Gt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i<o}],"filter-id-<":[jt,[Gt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<i}],"filter->":[jt,[Ut,Gt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>o}],"filter-id->":[jt,[Gt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[jt,[Ut,Gt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i<=o}],"filter-id-<=":[jt,[Gt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[jt,[Ut,Gt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>=o}],"filter-id->=":[jt,[Gt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[jt,[Gt],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[jt,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[jt,[Wt(Ut)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[jt,[Wt(Gt)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[jt,[Ut,Wt(Gt)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[jt,[Ut,Wt(Gt)],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[1];return e[0].evaluate(t)&&r.evaluate(t)}],[Ar(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[1];return e[0].evaluate(t)||r.evaluate(t)}],[Ar(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=t.globals&&t.globals.isSupportedScript;return!r||r(e[0].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,Ar(Gt),function(t,e){return e.map((function(e){return le(e.evaluate(t))})).join("")}],"resolved-locale":[Ut,[Xt],function(t,e){return e[0].evaluate(t).resolvedLocale()}]});var Xr=function(t,e){this.expression=t,this._warningHistory={},this._evaluator=new _e,this._defaultValue=e?function(t){return"color"===t.type&&Fr(t.default)?new ee(0,0,0,0):"color"===t.type?ee.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null};function Zr(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Pr}function Yr(t,e){var r=new Ve(Pr,[],e?function(t){var e={color:Vt,string:Ut,number:Bt,enum:Ut,boolean:jt,formatted:Zt,resolvedImage:Yt};return"array"===t.type?Wt(e[t.value]||Gt,t.length):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?kr(new Xr(n,e)):Nr(r.errors)}Xr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)},Xr.prototype.evaluate=function(t,e,r,n,i,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o||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 he("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 Wr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Be(e.expression)};Wr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,o)},Wr.prototype.evaluate=function(t,e,r,n,i,o){return this._styleExpression.evaluate(t,e,r,n,i,o)};var Hr=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 Jr(t,e){if("error"===(t=Yr(t,e)).result)return t;var r=t.value.expression,n=Fe(r);if(!n&&!Dr(e))return Nr([new Ot("","data expressions not supported")]);var i=Ue(r,["zoom"]);if(!i&&!Rr(e))return Nr([new Ot("","zoom expressions not supported")]);var o=function t(e){var r=null;if(e instanceof lr)r=t(e.result);else if(e instanceof ur)for(var n=0,i=e.args;n<i.length&&!(r=t(i[n]));n+=1);else(e instanceof Ge||e instanceof ar)&&e.input instanceof xe&&"zoom"===e.input.name&&(r=e);return r instanceof Ot||e.eachChild((function(e){var n=t(e);n instanceof Ot?r=n:!r&&n?r=new Ot("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):r&&n&&r!==n&&(r=new Ot("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),r}(r);return o||i?o instanceof Ot?Nr([o]):o instanceof ar&&!Or(e)?Nr([new Ot("",'"interpolate" expressions cannot be used with this property')]):kr(o?new Hr(n?"camera":"composite",t.value,o.labels,o instanceof ar?o.interpolation:void 0):new Wr(n?"constant":"source",t.value)):Nr([new Ot("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}Hr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,o)},Hr.prototype.evaluate=function(t,e,r,n,i,o){return this._styleExpression.evaluate(t,e,r,n,i,o)},Hr.prototype.interpolationFactor=function(t,e,r){return this.interpolationType?ar.interpolationFactor(this.interpolationType,t,e,r):0};var Kr=function(t,e){this._parameters=t,this._specification=e,Nt(this,function t(e,r){var n,i,o,a="color"===r.type,s=e.stops&&"object"==typeof e.stops[0][0],u=s||!(s||void 0!==e.property),l=e.type||(Or(r)?"exponential":"interval");if(a&&((e=Nt({},e)).stops&&(e.stops=e.stops.map((function(t){return[t[0],ee.parse(t[1])]}))),e.default=ee.parse(e.default?e.default:r.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!or[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);if("exponential"===l)n=qr;else if("interval"===l)n=Vr;else if("categorical"===l){n=jr,i=Object.create(null);for(var c=0,h=e.stops;c<h.length;c+=1){var p=h[c];i[p[0]]=p[1]}o=typeof e.stops[0][0]}else{if("identity"!==l)throw new Error('Unknown function type "'+l+'"');n=Gr}if(s){for(var f={},d=[],g=0;g<e.stops.length;g++){var y=e.stops[g],m=y[0].zoom;void 0===f[m]&&(f[m]={zoom:m,type:e.type,property:e.property,default:e.default,stops:[]},d.push(m)),f[m].stops.push([y[0].value,y[1]])}for(var v=[],_=0,x=d;_<x.length;_+=1){var b=x[_];v.push([f[b].zoom,t(f[b],r)])}var w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:ar.interpolationFactor.bind(void 0,w),zoomStops:v.map((function(t){return t[0]})),evaluate:function(t,n){var i=t.zoom;return qr({stops:v,base:e.base},r,i).evaluate(i,n)}}}if(u){var E="exponential"===l?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:E,interpolationFactor:ar.interpolationFactor.bind(void 0,E),zoomStops:e.stops.map((function(t){return t[0]})),evaluate:function(t){return n(e,r,t.zoom,i,o)}}}return{kind:"source",evaluate:function(t,a){var s=a&&a.properties?a.properties[e.property]:void 0;return void 0===s?Ur(e.default,r.default):n(e,r,s,i,o)}}}(this._parameters,this._specification))};function $r(t){var e=t.key,r=t.value,n=t.valueSpec||{},i=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=[],u=zr(r);if("object"!==u)return[new At(e,r,"object expected, "+u+" found")];for(var l in r){var c=l.split(".")[0],h=n[c]||n["*"],p=void 0;if(i[c])p=i[c];else if(n[c])p=In;else if(i["*"])p=i["*"];else{if(!n["*"]){s.push(new At(e,r[l],'unknown property "'+l+'"'));continue}p=In}s=s.concat(p({key:(e?e+".":e)+l,value:r[l],valueSpec:h,style:o,styleSpec:a,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 At(e,r,'missing required property "'+f+'"'));return s}function Qr(t){var e=t.value,r=t.valueSpec,n=t.style,i=t.styleSpec,o=t.key,a=t.arrayElementValidator||In;if("array"!==zr(e))return[new At(o,e,"array expected, "+zr(e)+" found")];if(r.length&&e.length!==r.length)return[new At(o,e,"array length "+r.length+" expected, length "+e.length+" found")];if(r["min-length"]&&e.length<r["min-length"])return[new At(o,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"===zr(r.value)&&(s=r.value);for(var u=[],l=0;l<e.length;l++)u=u.concat(a({array:e,arrayIndex:l,value:e[l],valueSpec:s,style:n,styleSpec:i,key:o+"["+l+"]"}));return u}function tn(t){var e=t.key,r=t.value,n=t.valueSpec,i=zr(r);return"number"===i&&r!=r&&(i="NaN"),"number"!==i?[new At(e,r,"number expected, "+i+" found")]:"minimum"in n&&r<n.minimum?[new At(e,r,r+" is less than the minimum value "+n.minimum)]:"maximum"in n&&r>n.maximum?[new At(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function en(t){var e,r,n,i=t.valueSpec,o=Dt(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,u=!s,l="array"===zr(t.value.stops)&&"array"===zr(t.value.stops[0])&&"object"===zr(t.value.stops[0][0]),c=$r({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new At(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Qr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===zr(r)&&0===r.length&&e.push(new At(t.key,r,"array must have at least one stop")),e},default:function(t){return In({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&c.push(new At(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||c.push(new At(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!Or(t.valueSpec)&&c.push(new At(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(u&&!Dr(t.valueSpec)?c.push(new At(t.key,t.value,"property functions not supported")):s&&!Rr(t.valueSpec)&&c.push(new At(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!l||void 0!==t.value.property||c.push(new At(t.key,t.value,'"property" property is required')),c;function h(t){var e=[],o=t.value,s=t.key;if("array"!==zr(o))return[new At(s,o,"array expected, "+zr(o)+" found")];if(2!==o.length)return[new At(s,o,"array length 2 expected, length "+o.length+" found")];if(l){if("object"!==zr(o[0]))return[new At(s,o,"object expected, "+zr(o[0])+" found")];if(void 0===o[0].zoom)return[new At(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new At(s,o,"object stop key must have value")];if(n&&n>Dt(o[0].zoom))return[new At(s,o[0].zoom,"stop zoom values must appear in ascending order")];Dt(o[0].zoom)!==n&&(n=Dt(o[0].zoom),r=void 0,a={}),e=e.concat($r({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:tn,value:p}}))}else e=e.concat(p({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return Zr(Rt(o[1]))?e.concat([new At(s+"[1]",o[1],"expressions are not allowed in function stops.")]):e.concat(In({key:s+"[1]",value:o[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function p(t,n){var s=zr(t.value),u=Dt(t.value),l=null!==t.value?t.value:n;if(e){if(s!==e)return[new At(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 At(t.key,l,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var c="number expected, "+s+" found";return Dr(i)&&void 0===o&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new At(t.key,l,c)]}return"categorical"!==o||"number"!==s||isFinite(u)&&Math.floor(u)===u?"categorical"!==o&&"number"===s&&void 0!==r&&u<r?[new At(t.key,l,"stop domain values must appear in ascending order")]:(r=u,"categorical"===o&&u in a?[new At(t.key,l,"stop domain values must be unique")]:(a[u]=!0,[])):[new At(t.key,l,"integer expected, found "+u)]}}function rn(t){var e=("property"===t.expressionContext?Jr:Yr)(Rt(t.value),t.valueSpec);if("error"===e.result)return e.value.map((function(e){return new At(""+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&&!r.outputDefined())return[new At(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 At(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!Be(r))return[new At(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!Ue(r,["zoom","feature-state"]))return[new At(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!Fe(r))return[new At(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function nn(t){var e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(Dt(r))&&i.push(new At(e,r,"expected one of ["+n.values.join(", ")+"], "+JSON.stringify(r)+" found")):-1===Object.keys(n.values).indexOf(Dt(r))&&i.push(new At(e,r,"expected one of ["+Object.keys(n.values).join(", ")+"], "+JSON.stringify(r)+" found")),i}function on(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&&("string"!=typeof t[1]||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(!on(n)&&"boolean"!=typeof n)return!1}return!0;default:return!0}}Kr.deserialize=function(t){return new Kr(t._parameters,t._specification)},Kr.serialize=function(t){return{_parameters:t._parameters,_specification:t._specification}};var an={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function sn(t){if(null==t)return{filter:function(){return!0},needGeometry:!1};on(t)||(t=ln(t));var e=Yr(t,an);if("error"===e.result)throw new Error(e.value.map((function(t){return t.key+": "+t.message})).join(", "));return{filter:function(t,r,n){return e.value.evaluate(t,r,{},n)},needGeometry:function t(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(var r=1;r<e.length;r++)if(t(e[r]))return!0;return!1}(t)}}function un(t,e){return t<e?-1:t>e?1:0}function ln(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?cn(t[1],t[2],"=="):"!="===r?fn(cn(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?cn(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(ln))):"all"===r?["all"].concat(t.slice(1).map(ln)):"none"===r?["all"].concat(t.slice(1).map(ln).map(fn)):"in"===r?hn(t[1],t.slice(2)):"!in"===r?fn(hn(t[1],t.slice(2))):"has"===r?pn(t[1]):"!has"===r?fn(pn(t[1])):"within"!==r||t}function cn(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 hn(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(un)]]:["filter-in-small",t,["literal",e]]}}function pn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function fn(t){return["!",t]}function dn(t){return on(Rt(t.value))?rn(Nt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==zr(r))return[new At(n,r,"array expected, "+zr(r)+" found")];var i,o=e.styleSpec,a=[];if(r.length<1)return[new At(n,r,"filter array must have at least 1 element")];switch(a=a.concat(nn({key:n+"[0]",value:r[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),Dt(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===Dt(r[1])&&a.push(new At(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&a.push(new At(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=zr(r[1]))&&a.push(new At(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s<r.length;s++)i=zr(r[s]),"$type"===Dt(r[1])?a=a.concat(nn({key:n+"["+s+"]",value:r[s],valueSpec:o.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&a.push(new At(n+"["+s+"]",r[s],"string, number, or boolean expected, "+i+" found"));break;case"any":case"all":case"none":for(var u=1;u<r.length;u++)a=a.concat(t({key:n+"["+u+"]",value:r[u],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=zr(r[1]),2!==r.length?a.push(new At(n,r,'filter array for "'+r[0]+'" operator must have 2 elements')):"string"!==i&&a.push(new At(n+"[1]",r[1],"string expected, "+i+" found"));break;case"within":i=zr(r[1]),2!==r.length?a.push(new At(n,r,'filter array for "'+r[0]+'" operator must have 2 elements')):"object"!==i&&a.push(new At(n+"[1]",r[1],"object expected, "+i+" found"))}return a}(t)}function gn(t,e){var r=t.key,n=t.style,i=t.styleSpec,o=t.value,a=t.objectKey,s=i[e+"_"+t.layerType];if(!s)return[];var u=a.match(/^(.*)-transition$/);if("paint"===e&&u&&s[u[1]]&&s[u[1]].transition)return In({key:r,value:o,valueSpec:i.transition,style:n,styleSpec:i});var l,c=t.valueSpec||s[a];if(!c)return[new At(r,o,'unknown property "'+a+'"')];if("string"===zr(o)&&Dr(c)&&!c.tokens&&(l=/^{([^}]+)}$/.exec(o)))return[new At(r,o,'"'+a+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(l[1])+" }`.")];var h=[];return"symbol"===t.layerType&&("text-field"===a&&n&&!n.glyphs&&h.push(new At(r,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&Fr(Rt(o))&&"identity"===Dt(o.type)&&h.push(new At(r,o,'"text-font" does not support identity functions'))),h.concat(In({key:t.key,value:o,valueSpec:c,style:n,styleSpec:i,expressionContext:"property",propertyType:e,propertyKey:a}))}function yn(t){return gn(t,"paint")}function mn(t){return gn(t,"layout")}function vn(t){var e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;r.type||r.ref||e.push(new At(n,r,'either "type" or "ref" is required'));var a,s=Dt(r.type),u=Dt(r.ref);if(r.id)for(var l=Dt(r.id),c=0;c<t.arrayIndex;c++){var h=i.layers[c];Dt(h.id)===l&&e.push(new At(n,r.id,'duplicate layer id "'+r.id+'", previously used at line '+h.id.__line__))}if("ref"in r)["type","source","source-layer","filter","layout"].forEach((function(t){t in r&&e.push(new At(n,r[t],'"'+t+'" is prohibited for ref layers'))})),i.layers.forEach((function(t){Dt(t.id)===u&&(a=t)})),a?a.ref?e.push(new At(n,r.ref,"ref cannot reference another ref layer")):s=Dt(a.type):e.push(new At(n,r.ref,'ref layer "'+u+'" not found'));else if("background"!==s)if(r.source){var p=i.sources&&i.sources[r.source],f=p&&Dt(p.type);p?"vector"===f&&"raster"===s?e.push(new At(n,r.source,'layer "'+r.id+'" requires a raster source')):"raster"===f&&"raster"!==s?e.push(new At(n,r.source,'layer "'+r.id+'" requires a vector source')):"vector"!==f||r["source-layer"]?"raster-dem"===f&&"hillshade"!==s?e.push(new At(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!r.paint||!r.paint["line-gradient"]||"geojson"===f&&p.lineMetrics||e.push(new At(n,r,'layer "'+r.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):e.push(new At(n,r,'layer "'+r.id+'" must specify a "source-layer"')):e.push(new At(n,r.source,'source "'+r.source+'" not found'))}else e.push(new At(n,r,'missing required property "source"'));return e=e.concat($r({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return In({key:n+".type",value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"})},filter:dn,layout:function(t){return $r({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return mn(Nt({layerType:s},t))}}})},paint:function(t){return $r({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return yn(Nt({layerType:s},t))}}})}}}))}function _n(t){var e=t.value,r=t.key,n=zr(e);return"string"!==n?[new At(r,e,"string expected, "+n+" found")]:[]}var xn={promoteId:function(t){var e=t.key,r=t.value;if("string"===zr(r))return _n({key:e,value:r});var n=[];for(var i in r)n.push.apply(n,_n({key:e+"."+i,value:r[i]}));return n}};function bn(t){var e=t.value,r=t.key,n=t.styleSpec,i=t.style;if(!e.type)return[new At(r,e,'"type" is required')];var o,a=Dt(e.type);switch(a){case"vector":case"raster":case"raster-dem":return $r({key:r,value:e,valueSpec:n["source_"+a.replace("-","_")],style:t.style,styleSpec:n,objectElementValidators:xn});case"geojson":if(o=$r({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,objectElementValidators:xn}),e.cluster)for(var s in e.clusterProperties){var u=e.clusterProperties[s],l=u[0],c="string"==typeof l?[l,["accumulated"],["get",s]]:l;o.push.apply(o,rn({key:r+"."+s+".map",value:u[1],expressionContext:"cluster-map"})),o.push.apply(o,rn({key:r+"."+s+".reduce",value:c,expressionContext:"cluster-reduce"}))}return o;case"video":return $r({key:r,value:e,valueSpec:n.source_video,style:i,styleSpec:n});case"image":return $r({key:r,value:e,valueSpec:n.source_image,style:i,styleSpec:n});case"canvas":return[new At(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return nn({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,styleSpec:n})}}function wn(t){var e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=zr(e);if(void 0===e)return o;if("object"!==a)return o.concat([new At("light",e,"object expected, "+a+" found")]);for(var s in e){var u=s.match(/^(.*)-transition$/);o=o.concat(u&&n[u[1]]&&n[u[1]].transition?In({key:s,value:e[s],valueSpec:r.transition,style:i,styleSpec:r}):n[s]?In({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r}):[new At(s,e[s],'unknown property "'+s+'"')])}return o}var En={"*":function(){return[]},array:Qr,boolean:function(t){var e=t.value,r=t.key,n=zr(e);return"boolean"!==n?[new At(r,e,"boolean expected, "+n+" found")]:[]},number:tn,color:function(t){var e=t.key,r=t.value,n=zr(r);return"string"!==n?[new At(e,r,"color expected, "+n+" found")]:null===te(r)?[new At(e,r,'color expected, "'+r+'" found')]:[]},constants:kt,enum:nn,filter:dn,function:en,layer:vn,object:$r,source:bn,light:wn,string:_n,formatted:function(t){return 0===_n(t).length?[]:rn(t)},resolvedImage:function(t){return 0===_n(t).length?[]:rn(t)}};function In(t){var e=t.value,r=t.valueSpec,n=t.styleSpec;return r.expression&&Fr(Dt(e))?en(t):r.expression&&Zr(Rt(e))?rn(t):r.type&&En[r.type]?En[r.type](t):$r(Nt({},t,{valueSpec:r.type?n[r.type]:r}))}function Sn(t){var e=t.value,r=t.key,n=_n(t);return n.length||(-1===e.indexOf("{fontstack}")&&n.push(new At(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&n.push(new At(r,e,'"glyphs" url must include a "{range}" token'))),n}function Cn(t,e){void 0===e&&(e=Lt);var r=[];return r=r.concat(In({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Sn,"*":function(){return[]}}})),t.constants&&(r=r.concat(kt({key:"constants",value:t.constants,style:t,styleSpec:e}))),Pn(r)}function Pn(t){return[].concat(t).sort((function(t,e){return t.line-e.line}))}function Mn(t){return function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return Pn(t.apply(this,e))}}Cn.source=Mn(bn),Cn.light=Mn(wn),Cn.layer=Mn(vn),Cn.filter=Mn(dn),Cn.paintProperty=Mn(yn),Cn.layoutProperty=Mn(mn);var Tn=Cn,Ln=Tn.light,An=Tn.paintProperty,kn=Tn.layoutProperty;function Nn(t,e){var r=!1;if(e&&e.length)for(var n=0,i=e;n<i.length;n+=1)t.fire(new Mt(new Error(i[n].message))),r=!0;return r}var Dn=Rn;function Rn(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(var o=0;o<this.d*this.d;o++){var a=i[3+o],s=i[3+o+1];n.push(a===s?null:i.subarray(a,s))}var u=i[3+n.length+1];this.keys=i.subarray(i[3+n.length],u),this.bboxes=i.subarray(u),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var l=0;l<this.d*this.d;l++)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}Rn.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)},Rn.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},Rn.prototype._insertCell=function(t,e,r,n,i,o){this.cells[i].push(o)},Rn.prototype.query=function(t,e,r,n,i){var o=this.min,a=this.max;if(t<=o&&e<=o&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(t,e,r,n,this._queryCell,s,{},i),s},Rn.prototype._queryCell=function(t,e,r,n,i,o,a,s){var u=this.cells[i];if(null!==u)for(var l=this.keys,c=this.bboxes,h=0;h<u.length;h++){var p=u[h];if(void 0===a[p]){var f=4*p;(s?s(c[f+0],c[f+1],c[f+2],c[f+3]):t<=c[f+2]&&e<=c[f+3]&&r>=c[f+0]&&n>=c[f+1])?(a[p]=!0,o.push(l[p])):a[p]=!1}}},Rn.prototype._forEachCell=function(t,e,r,n,i,o,a,s){for(var u=this._convertToCellCoord(t),l=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n),p=u;p<=c;p++)for(var f=l;f<=h;f++){var d=this.d*f+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,d,o,a,s))return}},Rn.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Rn.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Rn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+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 o=e,a=0;a<t.length;a++){var s=t[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+t.length]=o,i.set(this.keys,o),i[3+t.length+1]=o+=this.keys.length,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer};var On=a.ImageData,zn=a.ImageBitmap,Fn={};function Bn(t,e,r){void 0===r&&(r={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Fn[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}for(var Un in Bn("Object",Object),Dn.serialize=function(t,e){var r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}},Dn.deserialize=function(t){return new Dn(t.buffer)},Bn("Grid",Dn),Bn("Color",ee),Bn("Error",Error),Bn("ResolvedImage",oe),Bn("StylePropertyFunction",Kr),Bn("StyleExpression",Xr,{omit:["_evaluator"]}),Bn("ZoomDependentExpression",Hr),Bn("ZoomConstantExpression",Wr),Bn("CompoundExpression",xe,{omit:["_evaluate"]}),Pr)Pr[Un]._classRegistryKey||Bn("Expression_"+Un,Pr[Un]);function jn(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function Vn(t){return zn&&t instanceof zn}function qn(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(jn(t)||Vn(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){var r=t;return e&&e.push(r.buffer),r}if(t instanceof On)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){for(var n=[],i=0,o=t;i<o.length;i+=1)n.push(qn(o[i],e));return n}if("object"==typeof t){var a=t.constructor,s=a._classRegistryKey;if(!s)throw new Error("can't serialize object of unregistered class");var u=a.serialize?a.serialize(t,e):{};if(!a.serialize){for(var l in t)if(t.hasOwnProperty(l)&&!(Fn[s].omit.indexOf(l)>=0)){var c=t[l];u[l]=Fn[s].shallow.indexOf(l)>=0?c:qn(c,e)}t instanceof Error&&(u.message=t.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(u.$name=s),u}throw new Error("can't serialize object of type "+typeof t)}function Gn(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||jn(t)||Vn(t)||ArrayBuffer.isView(t)||t instanceof On)return t;if(Array.isArray(t))return t.map(Gn);if("object"==typeof t){var e=t.$name||"Object",r=Fn[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,o=Object.keys(t);i<o.length;i+=1){var a=o[i];if("$name"!==a){var s=t[a];n[a]=Fn[e].shallow.indexOf(a)>=0?s:Gn(s)}}return n}throw new Error("can't deserialize object of type "+typeof t)}var Xn=function(){this.first=!0};Xn.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 Zn={"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 Yn(t){for(var e=0,r=t;e<r.length;e+=1)if(Wn(r[e].charCodeAt(0)))return!0;return!1}function Wn(t){return!(746!==t&&747!==t&&(t<4352||!(Zn["Bopomofo Extended"](t)||Zn.Bopomofo(t)||Zn["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Zn["CJK Compatibility Ideographs"](t)||Zn["CJK Compatibility"](t)||Zn["CJK Radicals Supplement"](t)||Zn["CJK Strokes"](t)||!(!Zn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Zn["CJK Unified Ideographs Extension A"](t)||Zn["CJK Unified Ideographs"](t)||Zn["Enclosed CJK Letters and Months"](t)||Zn["Hangul Compatibility Jamo"](t)||Zn["Hangul Jamo Extended-A"](t)||Zn["Hangul Jamo Extended-B"](t)||Zn["Hangul Jamo"](t)||Zn["Hangul Syllables"](t)||Zn.Hiragana(t)||Zn["Ideographic Description Characters"](t)||Zn.Kanbun(t)||Zn["Kangxi Radicals"](t)||Zn["Katakana Phonetic Extensions"](t)||Zn.Katakana(t)&&12540!==t||!(!Zn["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)||!(!Zn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Zn["Unified Canadian Aboriginal Syllabics"](t)||Zn["Unified Canadian Aboriginal Syllabics Extended"](t)||Zn["Vertical Forms"](t)||Zn["Yijing Hexagram Symbols"](t)||Zn["Yi Syllables"](t)||Zn["Yi Radicals"](t))))}function Hn(t){return!(Wn(t)||function(t){return!!(Zn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Zn["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)||Zn["Letterlike Symbols"](t)||Zn["Number Forms"](t)||Zn["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)||Zn["Control Pictures"](t)&&9251!==t||Zn["Optical Character Recognition"](t)||Zn["Enclosed Alphanumerics"](t)||Zn["Geometric Shapes"](t)||Zn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Zn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Zn["CJK Symbols and Punctuation"](t)||Zn.Katakana(t)||Zn["Private Use Area"](t)||Zn["CJK Compatibility Forms"](t)||Zn["Small Form Variants"](t)||Zn["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 Jn(t){return t>=1424&&t<=2303||Zn["Arabic Presentation Forms-A"](t)||Zn["Arabic Presentation Forms-B"](t)}function Kn(t,e){return!(!e&&Jn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Zn.Khmer(t))}function $n(t){for(var e=0,r=t;e<r.length;e+=1)if(Jn(r[e].charCodeAt(0)))return!0;return!1}var Qn=null,ti="unavailable",ei=null,ri=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(ti="error"),Qn&&Qn(t)};function ni(){ii.fire(new Pt("pluginStateChange",{pluginStatus:ti,pluginURL:ei}))}var ii=new Tt,oi=function(){return ti},ai=function(){if("deferred"!==ti||!ei)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ti="loading",ni(),ei&&bt({url:ei},(function(t){t?ri(t):(ti="loaded",ni())}))},si={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return"loaded"===ti||null!=si.applyArabicShaping},isLoading:function(){return"loading"===ti},setState:function(t){ti=t.pluginStatus,ei=t.pluginURL},isParsed:function(){return null!=si.applyArabicShaping&&null!=si.processBidirectionalText&&null!=si.processStyledBidirectionalText},getPluginURL:function(){return ei}},ui=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 Xn,this.transition={})};ui.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;r<n.length;r+=1)if(!Kn(n[r].charCodeAt(0),e))return!1;return!0}(t,si.isLoaded())},ui.prototype.crossFadingFactor=function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},ui.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 li=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Fr(t))return new Kr(t,e);if(Zr(t)){var r=Jr(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=ee.parse(t)),{kind:"constant",evaluate:function(){return n}}}(void 0===e?t.specification.default:e,t.specification)};li.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},li.prototype.possiblyEvaluate=function(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)};var ci=function(t){this.property=t,this.value=new li(t,void 0)};ci.prototype.transitioned=function(t,e){return new pi(this.property,this.value,e,p({},t.transition,this.transition),t.now)},ci.prototype.untransitioned=function(){return new pi(this.property,this.value,null,{},0)};var hi=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};hi.prototype.getValue=function(t){return b(this._values[t].value.value)},hi.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new ci(this._values[t].property)),this._values[t].value=new li(this._values[t].property,null===e?void 0:b(e))},hi.prototype.getTransition=function(t){return b(this._values[t].transition)},hi.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new ci(this._values[t].property)),this._values[t].transition=b(e)||void 0},hi.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 o=this.getTransition(n);void 0!==o&&(t[n+"-transition"]=o)}return t},hi.prototype.transitioned=function(t,e){for(var r=new fi(this._properties),n=0,i=Object.keys(this._values);n<i.length;n+=1){var o=i[n];r._values[o]=this._values[o].transitioned(t,e._values[o])}return r},hi.prototype.untransitioned=function(){for(var t=new fi(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 pi=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)};pi.prototype.possiblyEvaluate=function(t,e,r){var n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),o=this.prior;if(o){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return o.possiblyEvaluate(t,e,r);var a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,r),i,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 i};var fi=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};fi.prototype.possiblyEvaluate=function(t,e,r){for(var n=new yi(this._properties),i=0,o=Object.keys(this._values);i<o.length;i+=1){var a=o[i];n._values[a]=this._values[a].possiblyEvaluate(t,e,r)}return n},fi.prototype.hasTransition=function(){for(var t=0,e=Object.keys(this._values);t<e.length;t+=1)if(this._values[e[t]].prior)return!0;return!1};var di=function(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)};di.prototype.getValue=function(t){return b(this._values[t].value)},di.prototype.setValue=function(t,e){this._values[t]=new li(this._values[t].property,null===e?void 0:b(e))},di.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},di.prototype.possiblyEvaluate=function(t,e,r){for(var n=new yi(this._properties),i=0,o=Object.keys(this._values);i<o.length;i+=1){var a=o[i];n._values[a]=this._values[a].possiblyEvaluate(t,e,r)}return n};var gi=function(t,e,r){this.property=t,this.value=e,this.parameters=r};gi.prototype.isConstant=function(){return"constant"===this.value.kind},gi.prototype.constantOr=function(t){return"constant"===this.value.kind?this.value.value:t},gi.prototype.evaluate=function(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)};var yi=function(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)};yi.prototype.get=function(t){return this._values[t]};var mi=function(t){this.specification=t};mi.prototype.possiblyEvaluate=function(t,e){return t.expression.evaluate(e)},mi.prototype.interpolate=function(t,e,r){var n=Ze[this.specification.type];return n?n(t,e,r):t};var vi=function(t,e){this.specification=t,this.overrides=e};vi.prototype.possiblyEvaluate=function(t,e,r,n){return new gi(this,"constant"===t.expression.kind||"camera"===t.expression.kind?{kind:"constant",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)},vi.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 gi(this,{kind:"constant",value:void 0},t.parameters);var n=Ze[this.specification.type];return n?new gi(this,{kind:"constant",value:n(t.value.value,e.value.value,r)},t.parameters):t},vi.prototype.evaluate=function(t,e,r,n,i,o){return"constant"===t.kind?t.value:t.evaluate(e,r,n,i,o)};var _i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0===t.value)return new gi(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},r,n),o="resolvedImage"===t.property.specification.type&&"string"!=typeof i?i.name:i,a=this._calculate(o,o,o,e);return new gi(this,{kind:"constant",value:a},e)}if("camera"===t.expression.kind){var s=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 gi(this,{kind:"constant",value:s},e)}return new gi(this,t.expression,e)},e.prototype.evaluate=function(t,e,r,n,i,o){if("source"===t.kind){var a=t.evaluate(e,r,n,i,o);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}(vi),xi=function(t){this.specification=t};xi.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new ui(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ui(Math.floor(e.zoom),e)),t.expression.evaluate(new ui(Math.floor(e.zoom+1),e)),e)}},xi.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},xi.prototype.interpolate=function(t){return t};var bi=function(t){this.specification=t};bi.prototype.possiblyEvaluate=function(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)},bi.prototype.interpolate=function(){return!1};var wi=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 li(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new ci(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};Bn("DataDrivenProperty",vi),Bn("DataConstantProperty",mi),Bn("CrossFadedDataDrivenProperty",_i),Bn("CrossFadedProperty",xi),Bn("ColorRampProperty",bi);var Ei=function(t){function e(e,r){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},"custom"!==e.type&&(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 di(r.layout)),r.paint)){for(var n in this._transitionablePaint=new hi(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(),this.paint=new yi(r.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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){void 0===r&&(r={}),null!=e&&this._validate(kn,"layers."+this.id+".layout."+t,t,e,r)||("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&&this._validate(An,"layers."+this.id+".paint."+t,t,e,r))return!1;if(v(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var n=this._transitionablePaint._values[t],i="cross-faded-data-driven"===n.property.specification["property-type"],o=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||o||i||this._handleOverridablePaintPropertyUpdate(t,a,s)},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,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,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)&&Nn(this,t.call(Tn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:Lt,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 gi&&Dr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(Tt),Ii={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Si=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},Ci=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Pi(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map((function(t){var i=Ii[t.type].BYTES_PER_ELEMENT,o=r=Mi(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:o}})),size:Mi(r,Math.max(n,e)),alignment:e}}function Mi(t,e){return Math.ceil(t/e)*e}Ci.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Ci.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},Ci.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Ci.prototype.clear=function(){this.length=0},Ci.prototype.resize=function(t){this.reserve(t),this.length=t},Ci.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)}},Ci.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Ti=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(Ci);Ti.prototype.bytesPerElement=4,Bn("StructArrayLayout2i4",Ti);var Li=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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 o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,t},e}(Ci);Li.prototype.bytesPerElement=8,Bn("StructArrayLayout4i8",Li);var Ai=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){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]=o,this.int16[s+5]=a,t},e}(Ci);Ai.prototype.bytesPerElement=12,Bn("StructArrayLayout2i4i12",Ai);var ki=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){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]=o,this.uint8[u+7]=a,t},e}(Ci);ki.prototype.bytesPerElement=8,Bn("StructArrayLayout2i4ub8",ki);var Ni=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(Ci);Ni.prototype.bytesPerElement=8,Bn("StructArrayLayout2f8",Ni);var Di=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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,o,a,s,u,l){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,o,a,s,u,l)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c){var h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=u,this.uint16[h+8]=l,this.uint16[h+9]=c,t},e}(Ci);Di.prototype.bytesPerElement=20,Bn("StructArrayLayout10ui20",Di);var Ri=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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,o,a,s,u,l,c,h){var p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,o,a,s,u,l,c,h)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c,h,p){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]=o,this.uint16[f+5]=a,this.uint16[f+6]=s,this.uint16[f+7]=u,this.int16[f+8]=l,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t},e}(Ci);Ri.prototype.bytesPerElement=24,Bn("StructArrayLayout4i4ui4i24",Ri);var Oi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(Ci);Oi.prototype.bytesPerElement=12,Bn("StructArrayLayout3f12",Oi);var zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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){return this.uint32[1*t+0]=e,t},e}(Ci);zi.prototype.bytesPerElement=4,Bn("StructArrayLayout1ul4",zi);var Fi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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,o,a,s,u){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,n,i,o,a,s,u)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l){var c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=o,this.int16[c+5]=a,this.uint32[h+3]=s,this.uint16[c+8]=u,this.uint16[c+9]=l,t},e}(Ci);Fi.prototype.bytesPerElement=20,Bn("StructArrayLayout6i1ul2ui20",Fi);var Bi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){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]=o,this.int16[s+5]=a,t},e}(Ci);Bi.prototype.bytesPerElement=12,Bn("StructArrayLayout2i2i2i12",Bi);var Ui=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i)},e.prototype.emplace=function(t,e,r,n,i,o){var a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[s+6]=i,this.int16[s+7]=o,t},e}(Ci);Ui.prototype.bytesPerElement=16,Bn("StructArrayLayout2f1f2i16",Ui);var ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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 o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t},e}(Ci);ji.prototype.bytesPerElement=12,Bn("StructArrayLayout2ub2f12",ji);var Vi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(Ci);Vi.prototype.bytesPerElement=6,Bn("StructArrayLayout3ui6",Vi);var qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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,o,a,s,u,l,c,h,p,f,d,g,y){var m=this.length;return this.resize(m+1),this.emplace(m,t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y,m){var v=24*t,_=12*t,x=48*t;return this.int16[v+0]=e,this.int16[v+1]=r,this.uint16[v+2]=n,this.uint16[v+3]=i,this.uint32[_+2]=o,this.uint32[_+3]=a,this.uint32[_+4]=s,this.uint16[v+10]=u,this.uint16[v+11]=l,this.uint16[v+12]=c,this.float32[_+7]=h,this.float32[_+8]=p,this.uint8[x+36]=f,this.uint8[x+37]=d,this.uint8[x+38]=g,this.uint32[_+10]=y,this.int16[v+22]=m,t},e}(Ci);qi.prototype.bytesPerElement=48,Bn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",qi);var Gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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,o,a,s,u,l,c,h,p,f,d,g,y,m,v,_,x,b,w,E,I,S,C,P){var M=this.length;return this.resize(M+1),this.emplace(M,t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y,m,v,_,x,b,w,E,I,S,C,P)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y,m,v,_,x,b,w,E,I,S,C,P,M){var T=34*t,L=17*t;return this.int16[T+0]=e,this.int16[T+1]=r,this.int16[T+2]=n,this.int16[T+3]=i,this.int16[T+4]=o,this.int16[T+5]=a,this.int16[T+6]=s,this.int16[T+7]=u,this.uint16[T+8]=l,this.uint16[T+9]=c,this.uint16[T+10]=h,this.uint16[T+11]=p,this.uint16[T+12]=f,this.uint16[T+13]=d,this.uint16[T+14]=g,this.uint16[T+15]=y,this.uint16[T+16]=m,this.uint16[T+17]=v,this.uint16[T+18]=_,this.uint16[T+19]=x,this.uint16[T+20]=b,this.uint16[T+21]=w,this.uint16[T+22]=E,this.uint32[L+12]=I,this.float32[L+13]=S,this.float32[L+14]=C,this.float32[L+15]=P,this.float32[L+16]=M,t},e}(Ci);Gi.prototype.bytesPerElement=68,Bn("StructArrayLayout8i15ui1ul4f68",Gi);var Xi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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){return this.float32[1*t+0]=e,t},e}(Ci);Xi.prototype.bytesPerElement=4,Bn("StructArrayLayout1f4",Xi);var Zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(Ci);Zi.prototype.bytesPerElement=6,Bn("StructArrayLayout3i6",Zi);var Yi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t},e}(Ci);Yi.prototype.bytesPerElement=8,Bn("StructArrayLayout1ul2ui8",Yi);var Wi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(Ci);Wi.prototype.bytesPerElement=4,Bn("StructArrayLayout2ui4",Wi);var Hi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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){return this.uint16[1*t+0]=e,t},e}(Ci);Hi.prototype.bytesPerElement=2,Bn("StructArrayLayout1ui2",Hi);var Ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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 o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.float32[o+3]=i,t},e}(Ci);Ji.prototype.bytesPerElement=16,Bn("StructArrayLayout4f16",Ji);var Ki=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.anchorPoint.get=function(){return new i(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(Si);Ki.prototype.size=20;var $i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Ki(this,t)},e}(Fi);Bn("CollisionBoxArray",$i);var Qi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},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]},Object.defineProperties(e.prototype,r),e}(Si);Qi.prototype.size=48;var to=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Qi(this,t)},e}(qi);Bn("PlacedSymbolArray",to);var eo=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},r.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,r),e}(Si);eo.prototype.size=68;var ro=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new eo(this,t)},e}(Gi);Bn("SymbolInstanceArray",ro);var no=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(Xi);Bn("GlyphOffsetArray",no);var io=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(Zi);Bn("SymbolLineVertexArray",io);var oo=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,r),e}(Si);oo.prototype.size=8;var ao=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new oo(this,t)},e}(Yi);Bn("FeatureIndexArray",ao);var so=Pi([{name:"a_pos",components:2,type:"Int16"}],4).members,uo=function(t){void 0===t&&(t=[]),this.segments=t};function lo(t,e){return 256*(t=c(Math.floor(t),0,255))+c(Math.floor(e),0,255)}uo.prototype.prepareSegment=function(t,e,r,n){var i=this.segments[this.segments.length-1];return t>uo.MAX_VERTEX_ARRAY_LENGTH&&E("Max vertices per segment is "+uo.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>uo.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},uo.prototype.get=function(){return this.segments},uo.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()}},uo.simpleSegment=function(t,e,r,n){return new uo([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])},uo.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Bn("SegmentVector",uo);var co=Pi([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),ho=e((function(t){t.exports=function(t,e){var r,n,i,o,a,s,u,l;for(n=t.length-(r=3&t.length),i=e,a=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&(o=5*(65535&(i=(i^=u=(65535&(u=(u=(65535&u)*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(o>>>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)))*a+(((u>>>16)*a&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}})),po=e((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,o=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<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,++o;switch(n){case 3:i^=(255&t.charCodeAt(o+2))<<16;case 2:i^=(255&t.charCodeAt(o+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(o)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),fo=ho,go=po;fo.murmur3=ho,fo.murmur2=go;var yo=function(){this.ids=[],this.positions=[],this.indexed=!1};yo.prototype.add=function(t,e,r,n){this.ids.push(vo(t)),this.positions.push(e,r,n)},yo.prototype.getPositions=function(t){for(var e=vo(t),r=0,n=this.ids.length-1;r<n;){var i=r+n>>1;this.ids[i]>=e?n=i:r=i+1}for(var o=[];this.ids[r]===e;)o.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return o},yo.serialize=function(t,e){var r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,r,n,i){for(;n<i;){for(var o=e[n+i>>1],a=n-1,s=i+1;;){do{a++}while(e[a]<o);do{s--}while(e[s]>o);if(a>=s)break;_o(e,a,s),_o(r,3*a,3*s),_o(r,3*a+1,3*s+1),_o(r,3*a+2,3*s+2)}s-n<i-s?(t(e,r,n,s),n=s+1):(t(e,r,s+1,i),i=s)}}(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}},yo.deserialize=function(t){var e=new yo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e};var mo=Math.pow(2,53)-1;function vo(t){var e=+t;return!isNaN(e)&&e<=mo?e:fo(String(t))}function _o(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}Bn("FeaturePositionMap",yo);var xo=function(t,e){this.gl=t.gl,this.location=e},bo=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)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))},e}(xo),wo=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)).constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))},e}(xo),Eo=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)).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}(xo),Io=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)).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}(xo),So=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)).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}(xo),Co=function(t){function e(e,r){t.call(this,e,r),this.current=ee.transparent}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(xo),Po=new Float32Array(16),Mo=function(t){function e(e,r){t.call(this,e,r),this.current=Po}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(xo);function To(t){return[lo(255*t.r,255*t.g),lo(255*t.b,255*t.a)]}var Lo=function(t,e,r){this.value=t,this.uniformNames=e.map((function(t){return"u_"+t})),this.type=r};Lo.prototype.setUniform=function(t,e,r){t.set(r.constantOr(this.value))},Lo.prototype.getBinding=function(t,e,r){return"color"===this.type?new Co(t,e):new wo(t,e)};var Ao=function(t,e){this.uniformNames=e.map((function(t){return"u_"+t})),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1};Ao.prototype.setConstantPatternPositions=function(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr},Ao.prototype.setUniform=function(t,e,r,n){var i="u_pattern_to"===n?this.patternTo:"u_pattern_from"===n?this.patternFrom:"u_pixel_ratio_to"===n?this.pixelRatioTo:"u_pixel_ratio_from"===n?this.pixelRatioFrom:null;i&&t.set(i)},Ao.prototype.getBinding=function(t,e,r){return"u_pattern"===r.substr(0,9)?new So(t,e):new wo(t,e)};var ko=function(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===r?2:1,offset:0}})),this.paintVertexArray=new n};ko.prototype.populatePaintArray=function(t,e,r,n,i){var o=this.paintVertexArray.length,a=this.expression.evaluate(new ui(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(o,t,a)},ko.prototype.updatePaintArray=function(t,e,r,n){var i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i)},ko.prototype._setPaintValue=function(t,e,r){if("color"===this.type)for(var n=To(r),i=t;i<e;i++)this.paintVertexArray.emplace(i,n[0],n[1]);else{for(var o=t;o<e;o++)this.paintVertexArray.emplace(o,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}},ko.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))},ko.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()};var No=function(t,e,r,n,i,o){this.expression=t,this.uniformNames=e.map((function(t){return"u_"+t+"_t"})),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((function(t){return{name:"a_"+t,type:"Float32",components:"color"===r?4:2,offset:0}})),this.paintVertexArray=new o};No.prototype.populatePaintArray=function(t,e,r,n,i){var o=this.expression.evaluate(new ui(this.zoom),e,{},n,[],i),a=this.expression.evaluate(new ui(this.zoom+1),e,{},n,[],i),s=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(s,t,o,a)},No.prototype.updatePaintArray=function(t,e,r,n){var i=this.expression.evaluate({zoom:this.zoom},r,n),o=this.expression.evaluate({zoom:this.zoom+1},r,n);this._setPaintValue(t,e,i,o)},No.prototype._setPaintValue=function(t,e,r,n){if("color"===this.type)for(var i=To(r),o=To(n),a=t;a<e;a++)this.paintVertexArray.emplace(a,i[0],i[1],o[0],o[1]);else{for(var s=t;s<e;s++)this.paintVertexArray.emplace(s,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}},No.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))},No.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},No.prototype.setUniform=function(t,e){var r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,n=c(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(n)},No.prototype.getBinding=function(t,e,r){return new wo(t,e)};var Do=function(t,e,r,n,i,o){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=n,this.layerId=o,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i};Do.prototype.populatePaintArray=function(t,e,r){var n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(n,t,e.patterns&&e.patterns[this.layerId],r)},Do.prototype.updatePaintArray=function(t,e,r,n,i){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],i)},Do.prototype._setPaintValues=function(t,e,r,n){if(n&&r){var i=n[r.min],o=n[r.mid],a=n[r.max];if(i&&o&&a)for(var s=t;s<e;s++)this.zoomInPaintVertexArray.emplace(s,o.tl[0],o.tl[1],o.br[0],o.br[1],i.tl[0],i.tl[1],i.br[0],i.br[1],o.pixelRatio,i.pixelRatio),this.zoomOutPaintVertexArray.emplace(s,o.tl[0],o.tl[1],o.br[0],o.br[1],a.tl[0],a.tl[1],a.br[0],a.br[1],o.pixelRatio,a.pixelRatio)}},Do.prototype.upload=function(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,co.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,co.members,this.expression.isStateDependent))},Do.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()};var Ro=function(t,e,r){this.binders={},this._buffers=[];var n=[];for(var i in t.paint._values)if(r(i)){var o=t.paint.get(i);if(o instanceof gi&&Dr(o.property.specification)){var a=zo(i,t.type),s=o.value,u=o.property.specification.type,l=o.property.useIntegerZoom,c=o.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===s.kind)this.binders[i]=h?new Ao(s.value,a):new Lo(s.value,a,u),n.push("/u_"+i);else if("source"===s.kind||h){var p=Fo(i,u,"source");this.binders[i]=h?new Do(s,u,l,e,p,t.id):new ko(s,a,u,p),n.push("/a_"+i)}else{var f=Fo(i,u,"composite");this.binders[i]=new No(s,a,u,l,e,f),n.push("/z_"+i)}}}this.cacheKey=n.sort().join("")};Ro.prototype.getMaxValue=function(t){var e=this.binders[t];return e instanceof ko||e instanceof No?e.maxValue:0},Ro.prototype.populatePaintArrays=function(t,e,r,n,i){for(var o in this.binders){var a=this.binders[o];(a instanceof ko||a instanceof No||a instanceof Do)&&a.populatePaintArray(t,e,r,n,i)}},Ro.prototype.setConstantPatternPositions=function(t,e){for(var r in this.binders){var n=this.binders[r];n instanceof Ao&&n.setConstantPatternPositions(t,e)}},Ro.prototype.updatePaintArrays=function(t,e,r,n,i){var o=!1;for(var a in t)for(var s=0,u=e.getPositions(a);s<u.length;s+=1){var l=u[s],c=r.feature(l.index);for(var h in this.binders){var p=this.binders[h];if((p instanceof ko||p instanceof No||p instanceof Do)&&!0===p.expression.isStateDependent){var f=n.paint.get(h);p.expression=f.value,p.updatePaintArray(l.start,l.end,c,t[a],i),o=!0}}}return o},Ro.prototype.defines=function(){var t=[];for(var e in this.binders){var r=this.binders[e];(r instanceof Lo||r instanceof Ao)&&t.push.apply(t,r.uniformNames.map((function(t){return"#define HAS_UNIFORM_"+t})))}return t},Ro.prototype.getBinderAttributes=function(){var t=[];for(var e in this.binders){var r=this.binders[e];if(r instanceof ko||r instanceof No)for(var n=0;n<r.paintVertexAttributes.length;n++)t.push(r.paintVertexAttributes[n].name);else if(r instanceof Do)for(var i=0;i<co.members.length;i++)t.push(co.members[i].name)}return t},Ro.prototype.getBinderUniforms=function(){var t=[];for(var e in this.binders){var r=this.binders[e];if(r instanceof Lo||r instanceof Ao||r instanceof No)for(var n=0,i=r.uniformNames;n<i.length;n+=1)t.push(i[n])}return t},Ro.prototype.getPaintVertexBuffers=function(){return this._buffers},Ro.prototype.getUniforms=function(t,e){var r=[];for(var n in this.binders){var i=this.binders[n];if(i instanceof Lo||i instanceof Ao||i instanceof No)for(var o=0,a=i.uniformNames;o<a.length;o+=1){var s=a[o];if(e[s]){var u=i.getBinding(t,e[s],s);r.push({name:s,property:n,binding:u})}}}return r},Ro.prototype.setUniforms=function(t,e,r,n){for(var i=0,o=e;i<o.length;i+=1){var a=o[i],s=a.name,u=a.property;this.binders[u].setUniform(a.binding,n,r.get(u),s)}},Ro.prototype.updatePaintBuffers=function(t){for(var e in this._buffers=[],this.binders){var r=this.binders[e];if(t&&r instanceof Do){var n=2===t.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;n&&this._buffers.push(n)}else(r instanceof ko||r instanceof No)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}},Ro.prototype.upload=function(t){for(var e in this.binders){var r=this.binders[e];(r instanceof ko||r instanceof No||r instanceof Do)&&r.upload(t)}this.updatePaintBuffers()},Ro.prototype.destroy=function(){for(var t in this.binders){var e=this.binders[t];(e instanceof ko||e instanceof No||e instanceof Do)&&e.destroy()}};var Oo=function(t,e,r){void 0===r&&(r=function(){return!0}),this.programConfigurations={};for(var n=0,i=t;n<i.length;n+=1){var o=i[n];this.programConfigurations[o.id]=new Ro(o,e,r)}this.needsUpload=!1,this._featureMap=new yo,this._bufferOffset=0};function zo(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","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(e+"-","").replace(/-/g,"_")]}function Fo(t,e,r){var n={color:{source:Ni,composite:Ji},number:{source:Xi,composite:Ni}},i=function(t){return{"line-pattern":{source:Di,composite:Di},"fill-pattern":{source:Di,composite:Di},"fill-extrusion-pattern":{source:Di,composite:Di}}[t]}(t);return i&&i[r]||n[e][r]}Oo.prototype.populatePaintArrays=function(t,e,r,n,i,o){for(var a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(t,e,n,i,o);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0},Oo.prototype.updatePaintArrays=function(t,e,r,n){for(var i=0,o=r;i<o.length;i+=1){var a=o[i];this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(t,this._featureMap,e,a,n)||this.needsUpload}},Oo.prototype.get=function(t){return this.programConfigurations[t]},Oo.prototype.upload=function(t){if(this.needsUpload){for(var e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}},Oo.prototype.destroy=function(){for(var t in this.programConfigurations)this.programConfigurations[t].destroy()},Bn("ConstantBinder",Lo),Bn("CrossFadedConstantBinder",Ao),Bn("SourceExpressionBinder",ko),Bn("CrossFadedCompositeBinder",Do),Bn("CompositeExpressionBinder",No),Bn("ProgramConfiguration",Ro,{omit:["_buffers"]}),Bn("ProgramConfigurationSet",Oo);var Bo=Math.pow(2,14)-1,Uo=-Bo-1;function jo(t){for(var e=8192/t.extent,r=t.loadGeometry(),n=0;n<r.length;n++)for(var i=r[n],o=0;o<i.length;o++){var a=i[o],s=Math.round(a.x*e),u=Math.round(a.y*e);a.x=c(s,Uo,Bo),a.y=c(u,Uo,Bo),(s<a.x||s>a.x+1||u<a.y||u>a.y+1)&&E("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function Vo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?jo(t):[]}}function qo(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}var Go=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 Ti,this.indexArray=new Vi,this.segments=new uo,this.programConfigurations=new Oo(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Xo(t,e){for(var r=0;r<t.length;r++)if(ta(e,t[r]))return!0;for(var n=0;n<e.length;n++)if(ta(t,e[n]))return!0;return!!Ho(t,e)}function Zo(t,e,r){return!!ta(t,e)||!!Ko(e,t,r)}function Yo(t,e){if(1===t.length)return Qo(e,t[0]);for(var r=0;r<e.length;r++)for(var n=e[r],i=0;i<n.length;i++)if(ta(t,n[i]))return!0;for(var o=0;o<t.length;o++)if(Qo(e,t[o]))return!0;for(var a=0;a<e.length;a++)if(Ho(t,e[a]))return!0;return!1}function Wo(t,e,r){if(t.length>1){if(Ho(t,e))return!0;for(var n=0;n<e.length;n++)if(Ko(e[n],t,r))return!0}for(var i=0;i<t.length;i++)if(Ko(t[i],e,r))return!0;return!1}function Ho(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],o=0;o<e.length-1;o++)if(Jo(n,i,e[o],e[o+1]))return!0;return!1}function Jo(t,e,r,n){return I(t,r,n)!==I(e,r,n)&&I(t,e,r)!==I(t,e,n)}function Ko(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($o(t,e[i-1],e[i])<n)return!0;return!1}function $o(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 t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function Qo(t,e){for(var r,n,i,o=!1,a=0;a<t.length;a++)for(var s=0,u=(r=t[a]).length-1;s<r.length;u=s++)(n=r[s]).y>e.y!=(i=r[u]).y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o);return o}function ta(t,e){for(var r=!1,n=0,i=t.length-1;n<t.length;i=n++){var o=t[n],a=t[i];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function ea(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 o=I(t,e,r[0]);return o!==I(t,e,r[1])||o!==I(t,e,r[2])||o!==I(t,e,r[3])}function ra(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function na(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ia(t,e,r,n,o){if(!e[0]&&!e[1])return t;var a=i.convert(e)._mult(o);"viewport"===r&&a._rotate(-n);for(var s=[],u=0;u<t.length;u++)s.push(t[u].sub(a));return s}Go.prototype.populate=function(t,e,r){var n=this.layers[0],i=[],o=null,a=!1;"circle"===n.type&&(a=!(o=n.layout.get("circle-sort-key")).isConstant());for(var s=0,u=t;s<u.length;s+=1){var l=u[s],c=l.feature,h=l.id,p=l.index,f=l.sourceLayerIndex,d=this.layers[0]._featureFilter.needGeometry,g=Vo(c,d);if(this.layers[0]._featureFilter.filter(new ui(this.zoom),g,r)){var y=a?o.evaluate(g,{},r):void 0,m={id:h,properties:c.properties,type:c.type,sourceLayerIndex:f,index:p,geometry:d?g.geometry:jo(c),patterns:{},sortKey:y};i.push(m)}}a&&i.sort((function(t,e){return t.sortKey-e.sortKey}));for(var v=0,_=i;v<_.length;v+=1){var x=_[v],b=x.geometry,w=x.index,E=x.sourceLayerIndex,I=t[w].feature;this.addFeature(x,b,w,r),e.featureIndex.insert(I,b,w,E,this.index)}},Go.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},Go.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Go.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Go.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,so),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Go.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Go.prototype.addFeature=function(t,e,r,n){for(var i=0,o=e;i<o.length;i+=1)for(var a=0,s=o[i];a<s.length;a+=1){var u=s[a],l=u.x,c=u.y;if(!(l<0||l>=8192||c<0||c>=8192)){var h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),p=h.vertexLength;qo(this.layoutVertexArray,l,c,-1,-1),qo(this.layoutVertexArray,l,c,1,-1),qo(this.layoutVertexArray,l,c,1,1),qo(this.layoutVertexArray,l,c,-1,1),this.indexArray.emplaceBack(p,p+1,p+2),this.indexArray.emplaceBack(p,p+3,p+2),h.vertexLength+=4,h.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)},Bn("CircleBucket",Go,{omit:["layers"]});var oa=new wi({"circle-sort-key":new vi(Lt.layout_circle["circle-sort-key"])}),aa={paint:new wi({"circle-radius":new vi(Lt.paint_circle["circle-radius"]),"circle-color":new vi(Lt.paint_circle["circle-color"]),"circle-blur":new vi(Lt.paint_circle["circle-blur"]),"circle-opacity":new vi(Lt.paint_circle["circle-opacity"]),"circle-translate":new mi(Lt.paint_circle["circle-translate"]),"circle-translate-anchor":new mi(Lt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new mi(Lt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new mi(Lt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new vi(Lt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new vi(Lt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new vi(Lt.paint_circle["circle-stroke-opacity"])}),layout:oa},sa="undefined"!=typeof Float32Array?Float32Array:Array;function ua(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}function la(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],g=e[12],y=e[13],m=e[14],v=e[15],_=r[0],x=r[1],b=r[2],w=r[3];return t[0]=_*n+x*s+b*h+w*g,t[1]=_*i+x*u+b*p+w*y,t[2]=_*o+x*l+b*f+w*m,t[3]=_*a+x*c+b*d+w*v,t[4]=(_=r[4])*n+(x=r[5])*s+(b=r[6])*h+(w=r[7])*g,t[5]=_*i+x*u+b*p+w*y,t[6]=_*o+x*l+b*f+w*m,t[7]=_*a+x*c+b*d+w*v,t[8]=(_=r[8])*n+(x=r[9])*s+(b=r[10])*h+(w=r[11])*g,t[9]=_*i+x*u+b*p+w*y,t[10]=_*o+x*l+b*f+w*m,t[11]=_*a+x*c+b*d+w*v,t[12]=(_=r[12])*n+(x=r[13])*s+(b=r[14])*h+(w=r[15])*g,t[13]=_*i+x*u+b*p+w*y,t[14]=_*o+x*l+b*f+w*m,t[15]=_*a+x*c+b*d+w*v,t}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 ca,ha=la;function pa(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}ca=new sa(3),sa!=Float32Array&&(ca[0]=0,ca[1]=0,ca[2]=0),function(){var t=new sa(4);sa!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var fa=(function(){var t=new sa(2);sa!=Float32Array&&(t[0]=0,t[1]=0)}(),function(t){function e(e){t.call(this,e,aa)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Go(t)},e.prototype.queryRadius=function(t){var e=t;return ra("circle-radius",this,e)+ra("circle-stroke-width",this,e)+na(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,a,s){for(var u=ia(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),l=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),h=c?u:function(t,e){return t.map((function(t){return da(t,e)}))}(u,s),p=c?l*a:l,f=0,d=n;f<d.length;f+=1)for(var g=0,y=d[f];g<y.length;g+=1){var m=y[g],v=c?m:da(m,s),_=p,x=pa([],[m.x,m.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?_*=x[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(_*=o.cameraToCenterDistance/x[3]),Zo(h,v,_))return!0}return!1},e}(Ei));function da(t,e){var r=pa([],[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)).constructor=e,e}(Go);function ya(t,e,r,n){var i=e.width,o=e.height;if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==i*o*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(i*o*r);return t.width=i,t.height=o,t.data=n,t}function ma(t,e,r){var n=e.width,i=e.height;if(n!==t.width||i!==t.height){var o=ya({},{width:n,height:i},r);va(t,o,{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=o.data}}function va(t,e,r,n,i,o){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 a=t.data,s=e.data,u=0;u<i.height;u++)for(var l=((r.y+u)*t.width+r.x)*o,c=((n.y+u)*e.width+n.x)*o,h=0;h<i.width*o;h++)s[c+h]=a[l+h];return e}Bn("HeatmapBucket",ga,{omit:["layers"]});var _a=function(t,e){ya(this,t,1,e)};_a.prototype.resize=function(t){ma(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){va(t,e,r,n,i,1)};var xa=function(t,e){ya(this,t,4,e)};xa.prototype.resize=function(t){ma(this,t,4)},xa.prototype.replace=function(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t},xa.prototype.clone=function(){return new xa({width:this.width,height:this.height},new Uint8Array(this.data))},xa.copy=function(t,e,r,n,i){va(t,e,r,n,i,4)},Bn("AlphaImage",_a),Bn("RGBAImage",xa);var ba={paint:new wi({"heatmap-radius":new vi(Lt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new vi(Lt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new mi(Lt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new bi(Lt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new mi(Lt.paint_heatmap["heatmap-opacity"])})};function wa(t){var e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new xa({width:r,height:n}),o=function(r,n,o){e[t.evaluationKey]=o;var a=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a)};if(t.clips)for(var a=0,s=0;a<n;++a,s+=4*r)for(var u=0,l=0;u<r;u++,l+=4){var c=u/(r-1),h=t.clips[a];o(s,l,h.start*(1-c)+h.end*c)}else for(var p=0,f=0;p<r;p++,f+=4)o(0,f,p/(r-1));return i}var Ea=function(t){function e(e){t.call(this,e,ba),this._updateColorRamp()}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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(){this.colorRamp=wa({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),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}(Ei),Ia={paint:new wi({"hillshade-illumination-direction":new mi(Lt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new mi(Lt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new mi(Lt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new mi(Lt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new mi(Lt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new mi(Lt.paint_hillshade["hillshade-accent-color"])})},Sa=function(t){function e(e){t.call(this,e,Ia)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility},e}(Ei),Ca=Pi([{name:"a_pos",components:2,type:"Int16"}],4).members,Pa=Ta,Ma=Ta;function Ta(t,e,r){r=r||2;var n,i,o,a,s,u,l,c=e&&e.length,h=c?e[0]*r:t.length,p=La(t,0,h,r,!0),f=[];if(!p||p.next===p.prev)return f;if(c&&(p=function(t,e,r,n){var i,o,a,s=[];for(i=0,o=e.length;i<o;i++)(a=La(t,e[i]*n,i<o-1?e[i+1]*n:t.length,n,!1))===a.next&&(a.steiner=!0),s.push(ja(a));for(s.sort(za),i=0;i<s.length;i++)Fa(s[i],r),r=Aa(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=o=t[0],i=a=t[1];for(var d=r;d<h;d+=r)(s=t[d])<n&&(n=s),(u=t[d+1])<i&&(i=u),s>o&&(o=s),u>a&&(a=u);l=0!==(l=Math.max(o-n,a-i))?1/l:0}return ka(p,f,r,n,i,l),f}function La(t,e,r,n,i){var o,a;if(i===ts(t,e,r,n)>0)for(o=e;o<r;o+=n)a=Ka(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=Ka(o,t[o],t[o+1],a);return a&&Xa(a,a.next)&&($a(a),a=a.next),a}function Aa(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Xa(n,n.next)&&0!==Ga(n.prev,n,n.next))n=n.next;else{if($a(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function ka(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Ua(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,o,a,s,u,l=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,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--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(a>1)}(i)}(t,n,i,o);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?Da(t,n,i,o):Na(t))e.push(s.i/r),e.push(t.i/r),e.push(u.i/r),$a(t),t=u.next,l=u.next;else if((t=u)===l){a?1===a?ka(t=Ra(Aa(t),e,r),e,r,n,i,o,2):2===a&&Oa(t,e,r,n,i,o):ka(Aa(t),e,r,n,i,o,1);break}}}function Na(t){var e=t.prev,r=t,n=t.next;if(Ga(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Va(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Ga(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Da(t,e,r,n){var i=t.prev,o=t,a=t.next;if(Ga(i,o,a)>=0)return!1;for(var s=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,u=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,l=Ua(i.x<o.x?i.x<a.x?i.x:a.x:o.x<a.x?o.x:a.x,i.y<o.y?i.y<a.y?i.y:a.y:o.y<a.y?o.y:a.y,e,r,n),c=Ua(s,u,e,r,n),h=t.prevZ,p=t.nextZ;h&&h.z>=l&&p&&p.z<=c;){if(h!==t.prev&&h!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,h.x,h.y)&&Ga(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,p!==t.prev&&p!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Ga(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;h&&h.z>=l;){if(h!==t.prev&&h!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,h.x,h.y)&&Ga(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;p&&p.z<=c;){if(p!==t.prev&&p!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Ga(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Ra(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!Xa(i,o)&&Za(i,n,n.next,o)&&Ha(i,o)&&Ha(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),$a(n),$a(n.next),n=t=o),n=n.next}while(n!==t);return Aa(n)}function Oa(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&qa(a,s)){var u=Ja(a,s);return a=Aa(a,a.next),u=Aa(u,u.next),ka(a,e,r,n,i,o),void ka(u,e,r,n,i,o)}s=s.next}a=a.next}while(a!==t)}function za(t,e){return t.x-e.x}function Fa(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===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===a)return r;var u,l=r,c=r.x,h=r.y,p=1/0;n=r;do{i>=n.x&&n.x>=c&&i!==n.x&&Va(o<h?i:a,o,c,h,o<h?a:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),Ha(n,t)&&(u<p||u===p&&(n.x>r.x||n.x===r.x&&Ba(r,n)))&&(r=n,p=u)),n=n.next}while(n!==l);return r}(t,e)){var r=Ja(e,t);Aa(e,e.next),Aa(r,r.next)}}function Ba(t,e){return Ga(t.prev,t,e.prev)<0&&Ga(e.next,t,t.next)<0}function Ua(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 ja(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 Va(t,e,r,n,i,o,a,s){return(i-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function qa(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&&Za(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Ha(t,e)&&Ha(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ga(t.prev,t,e.prev)||Ga(t,e.prev,e))||Xa(t,e)&&Ga(t.prev,t,t.next)>0&&Ga(e.prev,e,e.next)>0)}function Ga(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Xa(t,e){return t.x===e.x&&t.y===e.y}function Za(t,e,r,n){var i=Wa(Ga(t,e,r)),o=Wa(Ga(t,e,n)),a=Wa(Ga(r,n,t)),s=Wa(Ga(r,n,e));return i!==o&&a!==s||!(0!==i||!Ya(t,r,e))||!(0!==o||!Ya(t,n,e))||!(0!==a||!Ya(r,t,n))||!(0!==s||!Ya(r,e,n))}function Ya(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 Wa(t){return t>0?1:t<0?-1:0}function Ha(t,e){return Ga(t.prev,t,t.next)<0?Ga(t,e,t.next)>=0&&Ga(t,t.prev,e)>=0:Ga(t,e,t.prev)<0||Ga(t,t.next,e)<0}function Ja(t,e){var r=new Qa(t.i,t.x,t.y),n=new Qa(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Ka(t,e,r,n){var i=new Qa(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 $a(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 Qa(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 ts(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}function es(t,e,r,n,i){!function t(e,r,n,i,o){for(;i>n;){if(i-n>600){var a=i-n+1,s=r-n+1,u=Math.log(a),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(a-l)/a)*(s-a/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*l/a+c)),Math.min(i,Math.floor(r+(a-s)*l/a+c)),o)}var h=e[r],p=n,f=i;for(rs(e,n,r),o(e[i],h)>0&&rs(e,n,i);p<f;){for(rs(e,p,f),p++,f--;o(e[p],h)<0;)p++;for(;o(e[f],h)>0;)f--}0===o(e[n],h)?rs(e,n,f):rs(e,++f,i),f<=r&&(n=f+1),r<=f&&(i=f-1)}}(t,e,r||0,n||t.length-1,i||ns)}function rs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function ns(t,e){return t<e?-1:t>e?1:0}function is(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,o=[],a=0;a<r;a++){var s=S(t[a]);0!==s&&(t[a].area=Math.abs(s),void 0===i&&(i=s<0),i===s<0?(n&&o.push(n),n=[t[a]]):n.push(t[a]))}if(n&&o.push(n),e>1)for(var u=0;u<o.length;u++)o[u].length<=e||(es(o[u],e,1,o[u].length-1,os),o[u]=o[u].slice(0,e));return o}function os(t,e){return e.area-t.area}function as(t,e,r){for(var n=r.patternDependencies,i=!1,o=0,a=e;o<a.length;o+=1){var s=a[o].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 ss(t,e,r,n,i){for(var o=i.patternDependencies,a=0,s=e;a<s.length;a+=1){var u=s[a],l=u.paint.get(t+"-pattern").value;if("constant"!==l.kind){var c=l.evaluate({zoom:n-1},r,{},i.availableImages),h=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);h=h&&h.name?h.name:h,p=p&&p.name?p.name:p,o[c=c&&c.name?c.name:c]=!0,o[h]=!0,o[p]=!0,r.patterns[u.id]={min:c,mid:h,max:p}}}return r}Ta.deviation=function(t,e,r,n){var i=e&&e.length,o=Math.abs(ts(t,0,i?e[0]*r:t.length,r));if(i)for(var a=0,s=e.length;a<s;a++)o-=Math.abs(ts(t,e[a]*r,a<s-1?e[a+1]*r:t.length,r));var u=0;for(a=0;a<n.length;a+=3){var l=n[a]*r,c=n[a+1]*r,h=n[a+2]*r;u+=Math.abs((t[l]-t[h])*(t[c+1]-t[l+1])-(t[l]-t[c])*(t[h+1]-t[l+1]))}return 0===o&&0===u?0:Math.abs((u-o)/o)},Ta.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 o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&r.holes.push(n+=t[i-1].length)}return r},Pa.default=Ma;var us=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 Ti,this.indexArray=new Vi,this.indexArray2=new Wi,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new uo,this.segments2=new uo,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};us.prototype.populate=function(t,e,r){this.hasPattern=as("fill",this.layers,e);for(var n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),o=[],a=0,s=t;a<s.length;a+=1){var u=s[a],l=u.feature,c=u.id,h=u.index,p=u.sourceLayerIndex,f=this.layers[0]._featureFilter.needGeometry,d=Vo(l,f);if(this.layers[0]._featureFilter.filter(new ui(this.zoom),d,r)){var g=i?n.evaluate(d,{},r,e.availableImages):void 0,y={id:c,properties:l.properties,type:l.type,sourceLayerIndex:p,index:h,geometry:f?d.geometry:jo(l),patterns:{},sortKey:g};o.push(y)}}i&&o.sort((function(t,e){return t.sortKey-e.sortKey}));for(var m=0,v=o;m<v.length;m+=1){var _=v[m],x=_.geometry,b=_.index,w=_.sourceLayerIndex;if(this.hasPattern){var E=ss("fill",this.layers,_,this.zoom,e);this.patternFeatures.push(E)}else this.addFeature(_,x,b,r,{});e.featureIndex.insert(t[b].feature,x,b,w,this.index)}},us.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},us.prototype.addFeatures=function(t,e,r){for(var n=0,i=this.patternFeatures;n<i.length;n+=1){var o=i[n];this.addFeature(o,o.geometry,o.index,e,r)}},us.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},us.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},us.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ca),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0},us.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},us.prototype.addFeature=function(t,e,r,n,i){for(var o=0,a=is(e,500);o<a.length;o+=1){for(var s=a[o],u=0,l=0,c=s;l<c.length;l+=1)u+=c[l].length;for(var h=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray),p=h.vertexLength,f=[],d=[],g=0,y=s;g<y.length;g+=1){var m=y[g];if(0!==m.length){m!==s[0]&&d.push(f.length/2);var v=this.segments2.prepareSegment(m.length,this.layoutVertexArray,this.indexArray2),_=v.vertexLength;this.layoutVertexArray.emplaceBack(m[0].x,m[0].y),this.indexArray2.emplaceBack(_+m.length-1,_),f.push(m[0].x),f.push(m[0].y);for(var x=1;x<m.length;x++)this.layoutVertexArray.emplaceBack(m[x].x,m[x].y),this.indexArray2.emplaceBack(_+x-1,_+x),f.push(m[x].x),f.push(m[x].y);v.vertexLength+=m.length,v.primitiveLength+=m.length}}for(var b=Pa(f,d),w=0;w<b.length;w+=3)this.indexArray.emplaceBack(p+b[w],p+b[w+1],p+b[w+2]);h.vertexLength+=u,h.primitiveLength+=b.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)},Bn("FillBucket",us,{omit:["layers","patternFeatures"]});var ls=new wi({"fill-sort-key":new vi(Lt.layout_fill["fill-sort-key"])}),cs={paint:new wi({"fill-antialias":new mi(Lt.paint_fill["fill-antialias"]),"fill-opacity":new vi(Lt.paint_fill["fill-opacity"]),"fill-color":new vi(Lt.paint_fill["fill-color"]),"fill-outline-color":new vi(Lt.paint_fill["fill-outline-color"]),"fill-translate":new mi(Lt.paint_fill["fill-translate"]),"fill-translate-anchor":new mi(Lt.paint_fill["fill-translate-anchor"]),"fill-pattern":new _i(Lt.paint_fill["fill-pattern"])}),layout:ls},hs=function(t){function e(e){t.call(this,e,cs)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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 us(t)},e.prototype.queryRadius=function(){return na(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,a){return Yo(ia(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),n)},e.prototype.isTileClipped=function(){return!0},e}(Ei),ps=Pi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4).members,fs=ds;function ds(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(gs,this,e)}function gs(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;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 ys(t){for(var e,r,n=0,i=0,o=t.length,a=o-1;i<o;a=i++)n+=((r=t[a]).x-(e=t[i]).x)*(e.y+r.y);return n}ds.types=["Unknown","Point","LineString","Polygon"],ds.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,o=0,a=0,s=0,u=[];t.pos<r;){if(o<=0){var l=t.readVarint();n=7&l,o=l>>3}if(o--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&u.push(e),e=[]),e.push(new i(a,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&u.push(e),u},ds.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,u=1/0,l=-1/0;t.pos<e;){if(n<=0){var c=t.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)(i+=t.readSVarint())<a&&(a=i),i>s&&(s=i),(o+=t.readSVarint())<u&&(u=o),o>l&&(l=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,u,s,l]},ds.prototype.toGeoJSON=function(t,e,r){var n,i,o=this.extent*Math.pow(2,r),a=this.extent*t,s=this.extent*e,u=this.loadGeometry(),l=ds.types[this.type];function c(t){for(var e=0;e<t.length;e++){var r=t[e];t[e]=[360*(r.x+a)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+s)/o)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(n=0;n<u.length;n++)h[n]=u[n][0];c(u=h);break;case 2:for(n=0;n<u.length;n++)c(u[n]);break;case 3:for(u=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],o=0;o<e;o++){var a=ys(t[o]);0!==a&&(void 0===n&&(n=a<0),n===a<0?(r&&i.push(r),r=[t[o]]):r.push(t[o]))}return r&&i.push(r),i}(u),n=0;n<u.length;n++)for(i=0;i<u[n].length;i++)c(u[n][i])}1===u.length?u=u[0]:l="Multi"+l;var p={type:"Feature",geometry:{type:l,coordinates:u},properties:this.properties};return"id"in this&&(p.id=this.id),p};var ms=vs;function vs(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(_s,this,e),this.length=this._features.length}function _s(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){for(var e=null,r=t.readVarint()+t.pos;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 xs(t,e,r){if(3===t){var n=new ms(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}vs.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 fs(this._pbf,e,this.extent,this._keys,this._values)};var bs={VectorTile:function(t,e){this.layers=t.readFields(xs,{},e)},VectorTileFeature:fs,VectorTileLayer:ms},ws=bs.VectorTileFeature.types,Es=Math.pow(2,13);function Is(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,2*Math.floor(n*Es)+a,i*Es*2,o*Es*2,Math.round(s))}var Ss=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 Ai,this.indexArray=new Vi,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new uo,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Cs(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}Ss.prototype.populate=function(t,e,r){this.features=[],this.hasPattern=as("fill-extrusion",this.layers,e);for(var n=0,i=t;n<i.length;n+=1){var o=i[n],a=o.feature,s=o.id,u=o.index,l=o.sourceLayerIndex,c=this.layers[0]._featureFilter.needGeometry,h=Vo(a,c);if(this.layers[0]._featureFilter.filter(new ui(this.zoom),h,r)){var p={id:s,sourceLayerIndex:l,index:u,geometry:c?h.geometry:jo(a),properties:a.properties,type:a.type,patterns:{}};this.hasPattern?this.features.push(ss("fill-extrusion",this.layers,p,this.zoom,e)):this.addFeature(p,p.geometry,u,r,{}),e.featureIndex.insert(a,p.geometry,u,l,this.index,!0)}}},Ss.prototype.addFeatures=function(t,e,r){for(var n=0,i=this.features;n<i.length;n+=1){var o=i[n];this.addFeature(o,o.geometry,o.index,e,r)}},Ss.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},Ss.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Ss.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Ss.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ps),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Ss.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Ss.prototype.addFeature=function(t,e,r,n,i){for(var o=0,a=is(e,500);o<a.length;o+=1){for(var s=a[o],u=0,l=0,c=s;l<c.length;l+=1)u+=c[l].length;for(var h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),p=0,f=s;p<f.length;p+=1){var d=f[p];if(0!==d.length&&!((k=d).every((function(t){return t.x<0}))||k.every((function(t){return t.x>8192}))||k.every((function(t){return t.y<0}))||k.every((function(t){return t.y>8192}))))for(var g=0,y=0;y<d.length;y++){var m=d[y];if(y>=1){var v=d[y-1];if(!Cs(m,v)){h.vertexLength+4>uo.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var _=m.sub(v)._perp()._unit(),x=v.dist(m);g+x>32768&&(g=0),Is(this.layoutVertexArray,m.x,m.y,_.x,_.y,0,0,g),Is(this.layoutVertexArray,m.x,m.y,_.x,_.y,0,1,g),Is(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,0,g+=x),Is(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,1,g);var b=h.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),h.vertexLength+=4,h.primitiveLength+=2}}}}if(h.vertexLength+u>uo.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),"Polygon"===ws[t.type]){for(var w=[],E=[],I=h.vertexLength,S=0,C=s;S<C.length;S+=1){var P=C[S];if(0!==P.length){P!==s[0]&&E.push(w.length/2);for(var M=0;M<P.length;M++){var T=P[M];Is(this.layoutVertexArray,T.x,T.y,0,0,1,1,0),w.push(T.x),w.push(T.y)}}}for(var L=Pa(w,E),A=0;A<L.length;A+=3)this.indexArray.emplaceBack(I+L[A],I+L[A+2],I+L[A+1]);h.primitiveLength+=L.length/3,h.vertexLength+=u}}var k;this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)},Bn("FillExtrusionBucket",Ss,{omit:["layers","features"]});var Ps={paint:new wi({"fill-extrusion-opacity":new mi(Lt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new vi(Lt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new mi(Lt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new mi(Lt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new _i(Lt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new vi(Lt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new vi(Lt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new mi(Lt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})},Ms=function(t){function e(e){t.call(this,e,Ps)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Ss(t)},e.prototype.queryRadius=function(){return na(this.paint.get("fill-extrusion-translate"))},e.prototype.is3D=function(){return!0},e.prototype.queryIntersectsFeature=function(t,e,r,n,o,a,s,u){var l=ia(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),c=this.paint.get("fill-extrusion-height").evaluate(e,r),h=this.paint.get("fill-extrusion-base").evaluate(e,r),p=function(t,e,r,n){for(var o=[],a=0,s=t;a<s.length;a+=1){var u=s[a],l=[u.x,u.y,0,1];pa(l,l,e),o.push(new i(l[0]/l[3],l[1]/l[3]))}return o}(l,u),f=function(t,e,r,n){for(var o=[],a=[],s=n[8]*e,u=n[9]*e,l=n[10]*e,c=n[11]*e,h=n[8]*r,p=n[9]*r,f=n[10]*r,d=n[11]*r,g=0,y=t;g<y.length;g+=1){for(var m=[],v=[],_=0,x=y[g];_<x.length;_+=1){var b=x[_],w=b.x,E=b.y,I=n[0]*w+n[4]*E+n[12],S=n[1]*w+n[5]*E+n[13],C=n[2]*w+n[6]*E+n[14],P=n[3]*w+n[7]*E+n[15],M=C+l,T=P+c,L=I+h,A=S+p,k=C+f,N=P+d,D=new i((I+s)/T,(S+u)/T);D.z=M/T,m.push(D);var R=new i(L/N,A/N);R.z=k/N,v.push(R)}o.push(m),a.push(v)}return[o,a]}(n,h,c,u);return function(t,e,r){var n=1/0;Yo(r,e)&&(n=Ls(r,e[0]));for(var i=0;i<e.length;i++)for(var o=e[i],a=t[i],s=0;s<o.length-1;s++){var u=o[s],l=[u,o[s+1],a[s+1],a[s],u];Xo(r,l)&&(n=Math.min(n,Ls(r,l)))}return n!==1/0&&n}(f[0],f[1],p)},e}(Ei);function Ts(t,e){return t.x*e.x+t.y*e.y}function Ls(t,e){if(1===t.length){for(var r,n=0,i=e[n++];!r||i.equals(r);)if(!(r=e[n++]))return 1/0;for(;n<e.length;n++){var o=e[n],a=t[0],s=r.sub(i),u=o.sub(i),l=a.sub(i),c=Ts(s,s),h=Ts(s,u),p=Ts(u,u),f=Ts(l,s),d=Ts(l,u),g=c*p-h*h,y=(p*f-h*d)/g,m=(c*d-h*f)/g,v=i.z*(1-y-m)+r.z*y+o.z*m;if(isFinite(v))return v}return 1/0}for(var _=1/0,x=0,b=e;x<b.length;x+=1)_=Math.min(_,b[x].z);return _}var As=Pi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,ks=Pi([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,Ns=bs.VectorTileFeature.types,Ds=Math.cos(Math.PI/180*37.5),Rs=Math.pow(2,14)/.5,Os=function(t){var e=this;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.lineClipsArray=[],this.gradients={},this.layers.forEach((function(t){e.gradients[t.id]={}})),this.layoutVertexArray=new ki,this.layoutVertexArray2=new Ni,this.indexArray=new Vi,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new uo,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};Os.prototype.populate=function(t,e,r){this.hasPattern=as("line",this.layers,e);for(var n=this.layers[0].layout.get("line-sort-key"),i=!n.isConstant(),o=[],a=0,s=t;a<s.length;a+=1){var u=s[a],l=u.feature,c=u.id,h=u.index,p=u.sourceLayerIndex,f=this.layers[0]._featureFilter.needGeometry,d=Vo(l,f);if(this.layers[0]._featureFilter.filter(new ui(this.zoom),d,r)){var g=i?n.evaluate(d,{},r):void 0,y={id:c,properties:l.properties,type:l.type,sourceLayerIndex:p,index:h,geometry:f?d.geometry:jo(l),patterns:{},sortKey:g};o.push(y)}}i&&o.sort((function(t,e){return t.sortKey-e.sortKey}));for(var m=0,v=o;m<v.length;m+=1){var _=v[m],x=_.geometry,b=_.index,w=_.sourceLayerIndex;if(this.hasPattern){var E=ss("line",this.layers,_,this.zoom,e);this.patternFeatures.push(E)}else this.addFeature(_,x,b,r,{});e.featureIndex.insert(t[b].feature,x,b,w,this.index)}},Os.prototype.update=function(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)},Os.prototype.addFeatures=function(t,e,r){for(var n=0,i=this.patternFeatures;n<i.length;n+=1){var o=i[n];this.addFeature(o,o.geometry,o.index,e,r)}},Os.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Os.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Os.prototype.upload=function(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,ks)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,As),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Os.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Os.prototype.lineFeatureClips=function(t){if(t.properties&&t.properties.hasOwnProperty("mapbox_clip_start")&&t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}},Os.prototype.addFeature=function(t,e,r,n,i){var o=this.layers[0].layout,a=o.get("line-join").evaluate(t,{}),s=o.get("line-cap"),u=o.get("line-miter-limit"),l=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(var c=0,h=e;c<h.length;c+=1)this.addLine(h[c],t,a,s,u,l);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n)},Os.prototype.addLine=function(t,e,r,n,i,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(var a=0;a<t.length-1;a++)this.totalDistance+=t[a].dist(t[a+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}for(var s="Polygon"===Ns[e.type],u=t.length;u>=2&&t[u-1].equals(t[u-2]);)u--;for(var l=0;l<u-1&&t[l].equals(t[l+1]);)l++;if(!(u<(s?3:2))){"bevel"===r&&(i=1.05);var c,h=this.overscaling<=16?122880/(512*this.overscaling):0,p=this.segments.prepareSegment(10*u,this.layoutVertexArray,this.indexArray),f=void 0,d=void 0,g=void 0,y=void 0;this.e1=this.e2=-1,s&&(y=t[l].sub(c=t[u-2])._unit()._perp());for(var m=l;m<u;m++)if(!(d=m===u-1?s?t[l+1]:void 0:t[m+1])||!t[m].equals(d)){y&&(g=y),c&&(f=c),c=t[m],y=d?d.sub(c)._unit()._perp():g;var v=(g=g||y).add(y);0===v.x&&0===v.y||v._unit();var _=g.x*y.x+g.y*y.y,x=v.x*y.x+v.y*y.y,b=0!==x?1/x:1/0,w=2*Math.sqrt(2-2*x),E=x<Ds&&f&&d,I=g.x*y.y-g.y*y.x>0;if(E&&m>l){var S=c.dist(f);if(S>2*h){var C=c.sub(c.sub(f)._mult(h/S)._round());this.updateDistance(f,C),this.addCurrentVertex(C,g,0,0,p),f=C}}var P=f&&d,M=P?r:s?"butt":n;if(P&&"round"===M&&(b<o?M="miter":b<=2&&(M="fakeround")),"miter"===M&&b>i&&(M="bevel"),"bevel"===M&&(b>2&&(M="flipbevel"),b<i&&(M="miter")),f&&this.updateDistance(f,c),"miter"===M)v._mult(b),this.addCurrentVertex(c,v,0,0,p);else if("flipbevel"===M){if(b>100)v=y.mult(-1);else{var T=b*g.add(y).mag()/g.sub(y).mag();v._perp()._mult(T*(I?-1:1))}this.addCurrentVertex(c,v,0,0,p),this.addCurrentVertex(c,v.mult(-1),0,0,p)}else if("bevel"===M||"fakeround"===M){var L=-Math.sqrt(b*b-1),A=I?L:0,k=I?0:L;if(f&&this.addCurrentVertex(c,g,A,k,p),"fakeround"===M)for(var N=Math.round(180*w/Math.PI/20),D=1;D<N;D++){var R=D/N;if(.5!==R){var O=R-.5;R+=R*O*(R-1)*((1.0904+_*(_*(3.55645-1.43519*_)-3.2452))*O*O+(.848013+_*(.215638*_-1.06021)))}var z=y.sub(g)._mult(R)._add(g)._unit()._mult(I?-1:1);this.addHalfVertex(c,z.x,z.y,!1,I,0,p)}d&&this.addCurrentVertex(c,y,-A,-k,p)}else if("butt"===M)this.addCurrentVertex(c,v,0,0,p);else if("square"===M){var F=f?1:-1;this.addCurrentVertex(c,v,F,F,p)}else"round"===M&&(f&&(this.addCurrentVertex(c,g,0,0,p),this.addCurrentVertex(c,g,1,1,p,!0)),d&&(this.addCurrentVertex(c,y,-1,-1,p,!0),this.addCurrentVertex(c,y,0,0,p)));if(E&&m<u-1){var B=c.dist(d);if(B>2*h){var U=c.add(d.sub(c)._mult(h/B)._round());this.updateDistance(c,U),this.addCurrentVertex(U,y,0,0,p),c=U}}}}},Os.prototype.addCurrentVertex=function(t,e,r,n,i,o){void 0===o&&(o=!1);var a=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,o,!1,r,i),this.addHalfVertex(t,a,s,o,!0,-n,i),this.distance>Rs/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,o))},Os.prototype.addHalfVertex=function(t,e,r,n,i,o,a){var s=.5*(this.lineClips?this.scaledDistance*(Rs-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t.x<<1)+(n?1:0),(t.y<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===o?0:o<0?-1:1)|(63&s)<<2,s>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);var u=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),a.primitiveLength++),i?this.e2=u:this.e1=u},Os.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},Os.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},Bn("LineBucket",Os,{omit:["layers","patternFeatures"]});var zs=new wi({"line-cap":new mi(Lt.layout_line["line-cap"]),"line-join":new vi(Lt.layout_line["line-join"]),"line-miter-limit":new mi(Lt.layout_line["line-miter-limit"]),"line-round-limit":new mi(Lt.layout_line["line-round-limit"]),"line-sort-key":new vi(Lt.layout_line["line-sort-key"])}),Fs={paint:new wi({"line-opacity":new vi(Lt.paint_line["line-opacity"]),"line-color":new vi(Lt.paint_line["line-color"]),"line-translate":new mi(Lt.paint_line["line-translate"]),"line-translate-anchor":new mi(Lt.paint_line["line-translate-anchor"]),"line-width":new vi(Lt.paint_line["line-width"]),"line-gap-width":new vi(Lt.paint_line["line-gap-width"]),"line-offset":new vi(Lt.paint_line["line-offset"]),"line-blur":new vi(Lt.paint_line["line-blur"]),"line-dasharray":new xi(Lt.paint_line["line-dasharray"]),"line-pattern":new _i(Lt.paint_line["line-pattern"]),"line-gradient":new bi(Lt.paint_line["line-gradient"])}),layout:zs},Bs=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new ui(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=p({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(vi))(Fs.paint.properties["line-width"].specification);Bs.useIntegerZoom=!0;var Us=function(t){function e(e){t.call(this,e,Fs),this.gradientVersion=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ge,this.gradientVersion=(this.gradientVersion+1)%s)},e.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=Bs.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Os(t)},e.prototype.queryRadius=function(t){var e=t,r=js(ra("line-width",this,e),ra("line-gap-width",this,e)),n=ra("line-offset",this,e);return r/2+Math.abs(n)+na(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,o,a,s){var u=ia(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),l=s/2*js(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),c=this.paint.get("line-offset").evaluate(e,r);return c&&(n=function(t,e){for(var r=[],n=new i(0,0),o=0;o<t.length;o++){for(var a=t[o],s=[],u=0;u<a.length;u++){var l=a[u],c=a[u+1],h=0===u?n:l.sub(a[u-1])._unit()._perp(),p=u===a.length-1?n:c.sub(l)._unit()._perp(),f=h._add(p)._unit();f._mult(1/(f.x*p.x+f.y*p.y)),s.push(f._mult(e)._add(l))}r.push(s)}return r}(n,c*s)),function(t,e,r){for(var n=0;n<e.length;n++){var i=e[n];if(t.length>=3)for(var o=0;o<i.length;o++)if(ta(t,i[o]))return!0;if(Wo(t,i,r))return!0}return!1}(u,n,l)},e.prototype.isTileClipped=function(){return!0},e}(Ei);function js(t,e){return e>0?e+2*t:t}var Vs=Pi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),qs=Pi([{name:"a_projected_pos",components:3,type:"Float32"}],4),Gs=(Pi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Pi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Xs=(Pi([{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"}]),Pi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Zs=Pi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ys(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()),si.applyArabicShaping&&(t=si.applyArabicShaping(t)),t}(t.text,e,r)})),t}Pi([{name:"triangle",components:3,type:"Uint16"}]),Pi([{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"}]),Pi([{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:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Pi([{type:"Float32",name:"offsetX"}]),Pi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Ws={"!":"︕","#":"",$:"","%":"","&":"","(":"︵",")":"︶","*":"","+":"",",":"︐","-":"︲",".":"・","/":"",":":"︓",";":"︔","<":"︿","=":"",">":"﹀","?":"︖","@":"","[":"﹇","\\":"","]":"﹈","^":"",_:"︳","`":"","{":"︷","|":"―","}":"︸","~":"","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","":"︲","—":"︱","":"﹃","":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","":"︹","":"︺","〖":"︗","〗":"︘","":"︕","":"︵","":"︶","":"︐","":"︲","":"・","":"︓","":"︔","":"︿","":"﹀","":"︖","":"﹇","":"﹈","_":"︳","":"︷","":"―","":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Hs=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,l=u>>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=l}return(f?-1:1)*a*Math.pow(2,o-n)},Js=function(t,e,r,n,i,o){var a,s,u,l=8*o-i-1,c=(1<<l)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?p/u:p*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;t[r+f]=255&a,f+=d,a/=256,l-=8);t[r+f-d]|=128*g},Ks=$s;function $s(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}$s.Varint=0,$s.Fixed64=1,$s.Bytes=2,$s.Fixed32=5;var Qs="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function tu(t){return t.type===$s.Bytes?t.readVarint()+t.pos:t.pos+1}function eu(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function ru(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 nu(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function iu(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function ou(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function au(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function su(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function uu(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function lu(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function cu(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function hu(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function pu(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function fu(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function du(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function gu(t,e,r){1===t&&r.readMessage(yu,e)}function yu(t,e,r){if(3===t){var n=r.readMessage(mu,{}),i=n.width,o=n.height,a=n.left,s=n.top,u=n.advance;e.push({id:n.id,bitmap:new _a({width:i+6,height:o+6},n.bitmap),metrics:{width:i,height:o,left:a,top:s,advance:u}})}}function mu(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())}function vu(t){for(var e=0,r=0,n=0,i=t;n<i.length;n+=1){var o=i[n];e+=o.w*o.h,r=Math.max(r,o.w)}t.sort((function(t,e){return e.h-t.h}));for(var a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],s=0,u=0,l=0,c=t;l<c.length;l+=1)for(var h=c[l],p=a.length-1;p>=0;p--){var f=a[p];if(!(h.w>f.w||h.h>f.h)){if(h.x=f.x,h.y=f.y,u=Math.max(u,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===f.w&&h.h===f.h){var d=a.pop();p<a.length&&(a[p]=d)}else h.h===f.h?(f.x+=h.w,f.w-=h.w):h.w===f.w?(f.y+=h.h,f.h-=h.h):(a.push({x:f.x+h.w,y:f.y,w:f.w-h.w,h:h.h}),f.y+=h.h,f.h-=h.h);break}}return{w:s,h:u,fill:e/(s*u)||0}}$s.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,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=pu(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=du(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=pu(this.buf,this.pos)+4294967296*pu(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=pu(this.buf,this.pos)+4294967296*du(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Hs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Hs(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,o=r.buf;if(n=(112&(i=o[r.pos++]))>>4,i<128)return eu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<3,i<128)return eu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<10,i<128)return eu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<17,i<128)return eu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<24,i<128)return eu(t,n,e);if(n|=(1&(i=o[r.pos++]))<<31,i<128)return eu(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&&Qs?function(t,e,r){return Qs.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i<r;){var o,a,s,u=t[i],l=null,c=u>239?4:u>223?3:u>191?2:1;if(i+c>r)break;1===c?u<128&&(l=u):2===c?128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)<=127&&(l=null):3===c?(a=t[i+2],128==(192&(o=t[i+1]))&&128==(192&a)&&((l=(15&u)<<12|(63&o)<<6|63&a)<=2047||l>=55296&&l<=57343)&&(l=null)):4===c&&(a=t[i+2],s=t[i+3],128==(192&(o=t[i+1]))&&128==(192&a)&&128==(192&s)&&((l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=c}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!==$s.Bytes)return t.push(this.readVarint(e));var r=tu(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==$s.Bytes)return t.push(this.readSVarint());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==$s.Bytes)return t.push(this.readBoolean());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==$s.Bytes)return t.push(this.readFloat());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==$s.Bytes)return t.push(this.readDouble());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==$s.Bytes)return t.push(this.readFixed32());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==$s.Bytes)return t.push(this.readSFixed32());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==$s.Bytes)return t.push(this.readFixed64());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==$s.Bytes)return t.push(this.readSFixed64());var e=tu(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===$s.Varint)for(;this.buf[this.pos++]>127;);else if(e===$s.Bytes)this.pos=this.readVarint()+this.pos;else if(e===$s.Fixed32)this.pos+=4;else{if(e!==$s.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),fu(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),fu(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),fu(this.buf,-1&t,this.pos),fu(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),fu(this.buf,-1&t,this.pos),fu(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;if(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)),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,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(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,o=0;o<e.length;o++){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){n>56319||o+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&&ru(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Js(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Js(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&&ru(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,$s.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,nu,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,iu,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,su,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,ou,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,au,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,uu,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,lu,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,cu,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,hu,e)},writeBytesField:function(t,e){this.writeTag(t,$s.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,$s.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,$s.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,$s.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,$s.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,$s.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,$s.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,$s.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,$s.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,$s.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var _u=function(t,e){var r=e.pixelRatio,n=e.version,i=e.stretchX,o=e.stretchY,a=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n},xu={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};xu.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},xu.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},xu.tlbr.get=function(){return this.tl.concat(this.br)},xu.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(_u.prototype,xu);var bu=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,r,i),this.addImages(e,n,i);var o=vu(i),a=new xa({width:o.w||1,height:o.h||1});for(var s in t){var u=t[s],l=r[s].paddedRect;xa.copy(u.data,a,{x:0,y:0},{x:l.x+1,y:l.y+1},u.data)}for(var c in e){var h=e[c],p=n[c].paddedRect,f=p.x+1,d=p.y+1,g=h.data.width,y=h.data.height;xa.copy(h.data,a,{x:0,y:0},{x:f,y:d},h.data),xa.copy(h.data,a,{x:0,y:y-1},{x:f,y:d-1},{width:g,height:1}),xa.copy(h.data,a,{x:0,y:0},{x:f,y:d+y},{width:g,height:1}),xa.copy(h.data,a,{x:g-1,y:0},{x:f-1,y:d},{width:1,height:y}),xa.copy(h.data,a,{x:0,y:0},{x:f+g,y:d},{width:1,height:y})}this.image=a,this.iconPositions=r,this.patternPositions=n};bu.prototype.addImages=function(t,e,r){for(var n in t){var i=t[n],o={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(o),e[n]=new _u(o,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}},bu.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)},bu.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl;r.update(e.data,void 0,{x:n[0],y:n[1]})}},Bn("ImagePosition",_u),Bn("ImageAtlas",bu);var wu={horizontal:1,vertical:2,horizontalOnly:3},Eu=function(){this.scale=1,this.fontStack="",this.imageName=null};Eu.forText=function(t,e){var r=new Eu;return r.scale=t||1,r.fontStack=e,r},Eu.forImage=function(t){var e=new Eu;return e.imageName=t,e};var Iu=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function Su(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g){var y,m=Iu.fromFeature(t,i);h===wu.vertical&&m.verticalizePunctuation();var v=si.processBidirectionalText,_=si.processStyledBidirectionalText;if(v&&1===m.sections.length){y=[];for(var x=0,b=v(m.toString(),ku(m,l,o,e,n,f,d));x<b.length;x+=1){var w=b[x],E=new Iu;E.text=w,E.sections=m.sections;for(var I=0;I<w.length;I++)E.sectionIndex.push(0);y.push(E)}}else if(_){y=[];for(var S=0,C=_(m.text,m.sectionIndex,ku(m,l,o,e,n,f,d));S<C.length;S+=1){var P=C[S],M=new Iu;M.text=P[0],M.sectionIndex=P[1],M.sections=m.sections,y.push(M)}}else y=function(t,e){for(var r=[],n=t.text,i=0,o=0,a=e;o<a.length;o+=1){var s=a[o];r.push(t.substring(i,s)),i=s}return i<n.length&&r.push(t.substring(i,n.length)),r}(m,ku(m,l,o,e,n,f,d));var T=[],L={positionedLines:T,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1};return function(t,e,r,n,i,o,a,s,u,l,c,h){for(var p=0,f=-17,d=0,g=0,y="right"===s?1:"left"===s?0:.5,m=0,v=0,_=i;v<_.length;v+=1){var x=_[v];x.trim();var b=x.getMaxScale(),w=24*(b-1),E={positionedGlyphs:[],lineOffset:0};t.positionedLines[m]=E;var I=E.positionedGlyphs,S=0;if(x.length()){for(var C=0;C<x.length();C++){var P=x.getSection(C),M=x.getSectionIndex(C),T=x.getCharCode(C),L=0,A=null,k=null,N=null,D=24,R=!(u===wu.horizontal||!c&&!Wn(T)||c&&(Cu[T]||(G=T,Zn.Arabic(G)||Zn["Arabic Supplement"](G)||Zn["Arabic Extended-A"](G)||Zn["Arabic Presentation Forms-A"](G)||Zn["Arabic Presentation Forms-B"](G))));if(P.imageName){var O=n[P.imageName];if(!O)continue;N=P.imageName,t.iconsInText=t.iconsInText||!0,k=O.paddedRect;var z=O.displaySize;P.scale=24*P.scale/h,L=w+(24-z[1]*P.scale),D=(A={width:z[0],height:z[1],left:1,top:-3,advance:R?z[1]:z[0]}).advance;var F=R?z[0]*P.scale-24*b:z[1]*P.scale-24*b;F>0&&F>S&&(S=F)}else{var B=r[P.fontStack],U=B&&B[T];if(U&&U.rect)k=U.rect,A=U.metrics;else{var j=e[P.fontStack],V=j&&j[T];if(!V)continue;A=V.metrics}L=24*(b-P.scale)}R?(t.verticalizable=!0,I.push({glyph:T,imageName:N,x:p,y:f+L,vertical:R,scale:P.scale,fontStack:P.fontStack,sectionIndex:M,metrics:A,rect:k}),p+=D*P.scale+l):(I.push({glyph:T,imageName:N,x:p,y:f+L,vertical:R,scale:P.scale,fontStack:P.fontStack,sectionIndex:M,metrics:A,rect:k}),p+=A.advance*P.scale+l)}0!==I.length&&(d=Math.max(p-l,d),Du(I,0,I.length-1,y,S)),p=0;var q=o*b+S;E.lineOffset=Math.max(S,w),f+=q,g=Math.max(q,g),++m}else f+=o,++m}var G,X=f- -17,Z=Nu(a),Y=Z.horizontalAlign,W=Z.verticalAlign;(function(t,e,r,n,i,o,a,s,u){var l,c=(e-r)*i;l=o!==a?-s*n- -17:(-n*u+.5)*a;for(var h=0,p=t;h<p.length;h+=1)for(var f=0,d=p[h].positionedGlyphs;f<d.length;f+=1){var g=d[f];g.x+=c,g.y+=l}})(t.positionedLines,y,Y,W,d,g,o,X,i.length),t.top+=-W*X,t.bottom=t.top+X,t.left+=-Y*d,t.right=t.left+d}(L,e,r,n,y,a,s,u,h,l,p,g),!function(t){for(var e=0,r=t;e<r.length;e+=1)if(0!==r[e].positionedGlyphs.length)return!1;return!0}(T)&&L}Iu.fromFeature=function(t,e){for(var r=new Iu,n=0;n<t.sections.length;n++){var i=t.sections[n];i.image?r.addImageSection(i):r.addTextSection(i,e)}return r},Iu.prototype.length=function(){return this.text.length},Iu.prototype.getSection=function(t){return this.sections[this.sectionIndex[t]]},Iu.prototype.getSectionIndex=function(t){return this.sectionIndex[t]},Iu.prototype.getCharCode=function(t){return this.text.charCodeAt(t)},Iu.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;e+=n&&Hn(n)&&!Ws[t[r+1]]||i&&Hn(i)&&!Ws[t[r-1]]||!Ws[t[r]]?t[r]:Ws[t[r]]}return e}(this.text)},Iu.prototype.trim=function(){for(var t=0,e=0;e<this.text.length&&Cu[this.text.charCodeAt(e)];e++)t++;for(var r=this.text.length,n=this.text.length-1;n>=0&&n>=t&&Cu[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},Iu.prototype.substring=function(t,e){var r=new Iu;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},Iu.prototype.toString=function(){return this.text},Iu.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},Iu.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(Eu.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n<t.text.length;++n)this.sectionIndex.push(r)},Iu.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(Eu.forImage(e)),this.sectionIndex.push(this.sections.length-1)):E("Reached maximum number of images 6401")}else E("Can't add FormattedSection with an empty image.")},Iu.prototype.getNextImageSectionCharCode=function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var Cu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Pu={};function Mu(t,e,r,n,i,o){if(e.imageName){var a=n[e.imageName];return a?a.displaySize[0]*e.scale*24/o+i:0}var s=r[e.fontStack],u=s&&s[t];return u?u.metrics.advance*e.scale+i:0}function Tu(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 Lu(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 Au(t,e,r,n,i,o){for(var a=null,s=Tu(e,r,i,o),u=0,l=n;u<l.length;u+=1){var c=l[u],h=Tu(e-c.x,r,i,o)+c.badness;h<=s&&(a=c,s=h)}return{index:t,x:e,priorBreak:a,badness:s}}function ku(t,e,r,n,i,o,a){if("point"!==o)return[];if(!t)return[];for(var s,u=[],l=function(t,e,r,n,i,o){for(var a=0,s=0;s<t.length();s++){var u=t.getSection(s);a+=Mu(t.getCharCode(s),u,n,i,e,o)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,a),c=t.text.indexOf("")>=0,h=0,p=0;p<t.length();p++){var f=t.getSection(p),d=t.getCharCode(p);if(Cu[d]||(h+=Mu(d,f,n,i,e,a)),p<t.length()-1){var g=!((s=d)<11904||!(Zn["Bopomofo Extended"](s)||Zn.Bopomofo(s)||Zn["CJK Compatibility Forms"](s)||Zn["CJK Compatibility Ideographs"](s)||Zn["CJK Compatibility"](s)||Zn["CJK Radicals Supplement"](s)||Zn["CJK Strokes"](s)||Zn["CJK Symbols and Punctuation"](s)||Zn["CJK Unified Ideographs Extension A"](s)||Zn["CJK Unified Ideographs"](s)||Zn["Enclosed CJK Letters and Months"](s)||Zn["Halfwidth and Fullwidth Forms"](s)||Zn.Hiragana(s)||Zn["Ideographic Description Characters"](s)||Zn["Kangxi Radicals"](s)||Zn["Katakana Phonetic Extensions"](s)||Zn.Katakana(s)||Zn["Vertical Forms"](s)||Zn["Yi Radicals"](s)||Zn["Yi Syllables"](s)));(Pu[d]||g||f.imageName)&&u.push(Au(p+1,h,l,u,Lu(d,t.getCharCode(p+1),g&&c),!1))}}return function t(e){return e?t(e.priorBreak).concat(e.index):[]}(Au(t.length(),h,l,u,0,!0))}function Nu(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 Du(t,e,r,n,i){if(n||i)for(var o=t[r],a=(t[r].x+o.metrics.advance*o.scale)*n,s=e;s<=r;s++)t[s].x-=a,t[s].y+=i}function Ru(t,e,r,n,i,o){var a,s=t.image;if(s.content){var u=s.content,l=s.pixelRatio||1;a=[u[0]/l,u[1]/l,s.displaySize[0]-u[2]/l,s.displaySize[1]-u[3]/l]}var c,h,p,f,d=e.left*o,g=e.right*o;"width"===r||"both"===r?(f=i[0]+d-n[3],h=i[0]+g+n[1]):h=(f=i[0]+(d+g-s.displaySize[0])/2)+s.displaySize[0];var y=e.top*o,m=e.bottom*o;return"height"===r||"both"===r?(c=i[1]+y-n[0],p=i[1]+m+n[2]):p=(c=i[1]+(y+m-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:c,right:h,bottom:p,left:f,collisionPadding:a}}Pu[10]=!0,Pu[32]=!0,Pu[38]=!0,Pu[40]=!0,Pu[41]=!0,Pu[43]=!0,Pu[45]=!0,Pu[47]=!0,Pu[173]=!0,Pu[183]=!0,Pu[8203]=!0,Pu[8208]=!0,Pu[8211]=!0,Pu[8231]=!0;var Ou=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)).constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(i);function zu(t,e){var r=e.expression;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new ui(t+1))};if("source"===r.kind)return{kind:"source"};for(var n=r.zoomStops,i=r.interpolationType,o=0;o<n.length&&n[o]<=t;)o++;for(var a=o=Math.max(0,o-1);a<n.length&&n[a]<t+1;)a++;a=Math.min(n.length-1,a);var s=n[o],u=n[a];return"composite"===r.kind?{kind:"composite",minZoom:s,maxZoom:u,interpolationType:i}:{kind:"camera",minZoom:s,maxZoom:u,minSize:r.evaluate(new ui(s)),maxSize:r.evaluate(new ui(u)),interpolationType:i}}function Fu(t,e,r){var n=e.uSize,i=r.lowerSize;return"source"===t.kind?i/128:"composite"===t.kind?Xe(i/128,r.upperSize/128,e.uSizeT):n}function Bu(t,e){var r=0,n=0;if("constant"===t.kind)n=t.layoutSize;else if("source"!==t.kind){var i=t.interpolationType,o=i?c(ar.interpolationFactor(i,e,t.minZoom,t.maxZoom),0,1):0;"camera"===t.kind?n=Xe(t.minSize,t.maxSize,o):r=o}return{uSizeT:r,uSize:n}}Bn("Anchor",Ou);var Uu=Object.freeze({__proto__:null,getSizeData:zu,evaluateSizeForFeature:Fu,evaluateSizeForZoom:Bu,SIZE_PACK_FACTOR:128});function ju(t,e,r,n,i){if(void 0===e.segment)return!0;for(var o=e,a=e.segment+1,s=0;s>-r/2;){if(--a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var u=[],l=0;s<r/2;){var c=t[a],h=t[a+1];if(!h)return!1;var p=t[a-1].angleTo(c)-c.angleTo(h);for(p=Math.abs((p+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:s,angleDelta:p}),l+=p;s-u[0].distance>n;)l-=u.shift().angleDelta;if(l>i)return!1;a++,s+=c.dist(h)}return!0}function Vu(t){for(var e=0,r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function qu(t,e,r){return t?.6*e*r:0}function Gu(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Xu(t,e,r,n,i,o){for(var a=qu(r,i,o),s=Gu(r,n)*o,u=0,l=Vu(t)/2,c=0;c<t.length-1;c++){var h=t[c],p=t[c+1],f=h.dist(p);if(u+f>l){var d=(l-u)/f,g=Xe(h.x,p.x,d),y=Xe(h.y,p.y,d),m=new Ou(g,y,p.angleTo(h),c);return m._round(),!a||ju(t,m,s,a,e)?m:void 0}u+=f}}function Zu(t,e,r,n,i,o,a,s,u){var l=qu(n,o,a),c=Gu(n,i),h=c*a,p=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return e-h<e/4&&(e=h+e/4),function t(e,r,n,i,o,a,s,u,l){for(var c=a/2,h=Vu(e),p=0,f=r-n,d=[],g=0;g<e.length-1;g++){for(var y=e[g],m=e[g+1],v=y.dist(m),_=m.angleTo(y);f+n<p+v;){var x=((f+=n)-p)/v,b=Xe(y.x,m.x,x),w=Xe(y.y,m.y,x);if(b>=0&&b<l&&w>=0&&w<l&&f-c>=0&&f+c<=h){var E=new Ou(b,w,_,g);E._round(),i&&!ju(e,E,a,i,o)||d.push(E)}}p+=v}return u||d.length||s||(d=t(e,p/2,n,i,o,a,s,!0,l)),d}(t,p?e/2*s%e:(c/2+2*o)*a*s%e,e,l,r,h,p,!1,u)}function Yu(t,e,r,n,o){for(var a=[],s=0;s<t.length;s++)for(var u=t[s],l=void 0,c=0;c<u.length-1;c++){var h=u[c],p=u[c+1];h.x<e&&p.x<e||(h.x<e?h=new i(e,h.y+(e-h.x)/(p.x-h.x)*(p.y-h.y))._round():p.x<e&&(p=new i(e,h.y+(e-h.x)/(p.x-h.x)*(p.y-h.y))._round()),h.y<r&&p.y<r||(h.y<r?h=new i(h.x+(r-h.y)/(p.y-h.y)*(p.x-h.x),r)._round():p.y<r&&(p=new i(h.x+(r-h.y)/(p.y-h.y)*(p.x-h.x),r)._round()),h.x>=n&&p.x>=n||(h.x>=n?h=new i(n,h.y+(n-h.x)/(p.x-h.x)*(p.y-h.y))._round():p.x>=n&&(p=new i(n,h.y+(n-h.x)/(p.x-h.x)*(p.y-h.y))._round()),h.y>=o&&p.y>=o||(h.y>=o?h=new i(h.x+(o-h.y)/(p.y-h.y)*(p.x-h.x),o)._round():p.y>=o&&(p=new i(h.x+(o-h.y)/(p.y-h.y)*(p.x-h.x),o)._round()),l&&h.equals(l[l.length-1])||a.push(l=[h]),l.push(p)))))}return a}function Wu(t,e,r,n){var o=[],a=t.image,s=a.pixelRatio,u=a.paddedRect.w-2,l=a.paddedRect.h-2,c=t.right-t.left,h=t.bottom-t.top,p=a.stretchX||[[0,u]],f=a.stretchY||[[0,l]],d=function(t,e){return t+e[1]-e[0]},g=p.reduce(d,0),y=f.reduce(d,0),m=u-g,v=l-y,_=0,x=g,b=0,w=y,E=0,I=m,S=0,C=v;if(a.content&&n){var P=a.content;_=Hu(p,0,P[0]),b=Hu(f,0,P[1]),x=Hu(p,P[0],P[2]),w=Hu(f,P[1],P[3]),E=P[0]-_,S=P[1]-b,I=P[2]-P[0]-x,C=P[3]-P[1]-w}var M=function(n,o,u,l){var p=Ku(n.stretch-_,x,c,t.left),f=$u(n.fixed-E,I,n.stretch,g),d=Ku(o.stretch-b,w,h,t.top),m=$u(o.fixed-S,C,o.stretch,y),v=Ku(u.stretch-_,x,c,t.left),P=$u(u.fixed-E,I,u.stretch,g),M=Ku(l.stretch-b,w,h,t.top),T=$u(l.fixed-S,C,l.stretch,y),L=new i(p,d),A=new i(v,d),k=new i(v,M),N=new i(p,M),D=new i(f/s,m/s),R=new i(P/s,T/s),O=e*Math.PI/180;if(O){var z=Math.sin(O),F=Math.cos(O),B=[F,-z,z,F];L._matMult(B),A._matMult(B),N._matMult(B),k._matMult(B)}var U=n.stretch+n.fixed,j=o.stretch+o.fixed;return{tl:L,tr:A,bl:N,br:k,tex:{x:a.paddedRect.x+1+U,y:a.paddedRect.y+1+j,w:u.stretch+u.fixed-U,h:l.stretch+l.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:R,minFontScaleX:I/s/c,minFontScaleY:C/s/h,isSDF:r}};if(n&&(a.stretchX||a.stretchY))for(var T=Ju(p,m,g),L=Ju(f,v,y),A=0;A<T.length-1;A++)for(var k=T[A],N=T[A+1],D=0;D<L.length-1;D++)o.push(M(k,L[D],N,L[D+1]));else o.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:u+1},{fixed:0,stretch:l+1}));return o}function Hu(t,e,r){for(var n=0,i=0,o=t;i<o.length;i+=1){var a=o[i];n+=Math.max(e,Math.min(r,a[1]))-Math.max(e,Math.min(r,a[0]))}return n}function Ju(t,e,r){for(var n=[{fixed:-1,stretch:0}],i=0,o=t;i<o.length;i+=1){var a=o[i],s=a[0],u=a[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+1,stretch:r}),n}function Ku(t,e,r,n){return t/e*r+n}function $u(t,e,r,n){return t-e*r/n}var Qu=function(t,e,r,n,o,a,s,u,l,c){if(this.boxStartIndex=t.length,l){var h=a.top,p=a.bottom,f=a.collisionPadding;f&&(h-=f[1],p+=f[3]);var d=p-h;d>0&&(d=Math.max(10,d),this.circleDiameter=d)}else{var g=a.top*s-u,y=a.bottom*s+u,m=a.left*s-u,v=a.right*s+u,_=a.collisionPadding;if(_&&(m-=_[0]*s,g-=_[1]*s,v+=_[2]*s,y+=_[3]*s),c){var x=new i(m,g),b=new i(v,g),w=new i(m,y),E=new i(v,y),I=c*Math.PI/180;x._rotate(I),b._rotate(I),w._rotate(I),E._rotate(I),m=Math.min(x.x,b.x,w.x,E.x),v=Math.max(x.x,b.x,w.x,E.x),g=Math.min(x.y,b.y,w.y,E.y),y=Math.max(x.y,b.y,w.y,E.y)}t.emplaceBack(e.x,e.y,m,g,v,y,r,n,o)}this.boxEndIndex=t.length},tl=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=el),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 el(t,e){return t<e?-1:t>e?1:0}function rl(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,o=1/0,a=-1/0,s=-1/0,u=t[0],l=0;l<u.length;l++){var c=u[l];(!l||c.x<n)&&(n=c.x),(!l||c.y<o)&&(o=c.y),(!l||c.x>a)&&(a=c.x),(!l||c.y>s)&&(s=c.y)}var h=Math.min(a-n,s-o),p=h/2,f=new tl([],nl);if(0===h)return new i(n,o);for(var d=n;d<a;d+=h)for(var g=o;g<s;g+=h)f.push(new il(d+p,g+p,p,t));for(var y=function(t){for(var e=0,r=0,n=0,i=t[0],o=0,a=i.length,s=a-1;o<a;s=o++){var u=i[o],l=i[s],c=u.x*l.y-l.x*u.y;r+=(u.x+l.x)*c,n+=(u.y+l.y)*c,e+=3*c}return new il(r/e,n/e,0,t)}(t),m=f.length;f.length;){var v=f.pop();(v.d>y.d||!y.d)&&(y=v,r&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,m)),v.max-y.d<=e||(f.push(new il(v.p.x-(p=v.h/2),v.p.y-p,p,t)),f.push(new il(v.p.x+p,v.p.y-p,p,t)),f.push(new il(v.p.x-p,v.p.y+p,p,t)),f.push(new il(v.p.x+p,v.p.y+p,p,t)),m+=4)}return r&&(console.log("num probes: "+m),console.log("best distance: "+y.d)),y.p}function nl(t,e){return e.max-t.max}function il(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 o=e[i],a=0,s=o.length,u=s-1;a<s;u=a++){var l=o[a],c=o[u];l.y>t.y!=c.y>t.y&&t.x<(c.x-l.x)*(t.y-l.y)/(c.y-l.y)+l.x&&(r=!r),n=Math.min(n,$o(t,l,c))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}tl.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},tl.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}},tl.prototype.peek=function(){return this.data[0]},tl.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},tl.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t<n;){var o=1+(t<<1),a=e[o],s=o+1;if(s<this.length&&r(e[s],a)<0&&(o=s,a=e[s]),r(a,i)>=0)break;e[t]=a,t=o}e[t]=i};var ol=Number.POSITIVE_INFINITY;function al(t,e){return e[1]!==ol?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-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}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-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}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 sl(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"}function ul(t,e,r,n,o,a,s,u,l,c,h,p,f,d,g){var y=function(t,e,r,n,o,a,s,u){for(var l=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,c=[],h=0,p=e.positionedLines;h<p.length;h+=1)for(var f=p[h],d=0,g=f.positionedGlyphs;d<g.length;d+=1){var y=g[d];if(y.rect){var m=y.rect||{},v=4,_=!0,x=1,b=0,w=(o||u)&&y.vertical,E=y.metrics.advance*y.scale/2;if(u&&e.verticalizable&&(b=f.lineOffset/2-(y.imageName?-(24-y.metrics.width*y.scale)/2:24*(y.scale-1))),y.imageName){var I=s[y.imageName];_=I.sdf,v=1/(x=I.pixelRatio)}var S=o?[y.x+E,y.y]:[0,0],C=o?[0,0]:[y.x+E+r[0],y.y+r[1]-b],P=[0,0];w&&(P=C,C=[0,0]);var M=(y.metrics.left-v)*y.scale-E+C[0],T=(-y.metrics.top-v)*y.scale+C[1],L=M+m.w*y.scale/x,A=T+m.h*y.scale/x,k=new i(M,T),N=new i(L,T),D=new i(M,A),R=new i(L,A);if(w){var O=new i(-E,E- -17),z=-Math.PI/2,F=12-E,B=new i(22-F,-(y.imageName?F:0)),U=new(Function.prototype.bind.apply(i,[null].concat(P)));k._rotateAround(z,O)._add(B)._add(U),N._rotateAround(z,O)._add(B)._add(U),D._rotateAround(z,O)._add(B)._add(U),R._rotateAround(z,O)._add(B)._add(U)}if(l){var j=Math.sin(l),V=Math.cos(l),q=[V,-j,j,V];k._matMult(q),N._matMult(q),D._matMult(q),R._matMult(q)}var G=new i(0,0),X=new i(0,0);c.push({tl:k,tr:N,bl:D,br:R,tex:m,writingMode:e.writingMode,glyphOffset:S,sectionIndex:y.sectionIndex,isSDF:_,pixelOffsetTL:G,pixelOffsetBR:X,minFontScaleX:0,minFontScaleY:0})}}return c}(0,r,u,o,a,s,n,t.allowVerticalPlacement),m=t.textSizeData,v=null;"source"===m.kind?(v=[128*o.layout.get("text-size").evaluate(s,{})])[0]>32640&&E(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===m.kind&&((v=[128*d.compositeTextSizes[0].evaluate(s,{},g),128*d.compositeTextSizes[1].evaluate(s,{},g)])[0]>32640||v[1]>32640)&&E(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,y,v,u,a,s,c,e,l.lineStartIndex,l.lineLength,f,g);for(var _=0,x=h;_<x.length;_+=1)p[x[_]]=t.text.placedSymbolArray.length-1;return 4*y.length}function ll(t){for(var e in t)return t[e];return null}function cl(t,e,r,n){var i=t.compareText;if(e in i){for(var o=i[e],a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}else i[e]=[];return i[e].push(n),!1}var hl=bs.VectorTileFeature.types,pl=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function fl(t,e,r,n,i,o,a,s,u,l,c,h,p){var f=s?Math.min(32640,Math.round(s[0])):0,d=s?Math.min(32640,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),o,a,(f<<1)+(u?1:0),d,16*l,16*c,256*h,256*p)}function dl(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 gl(t){for(var e=0,r=t.sections;e<r.length;e+=1)if($n(r[e].text))return!0;return!1}var yl=function(t){this.layoutVertexArray=new Ri,this.indexArray=new Vi,this.programConfigurations=t,this.segments=new uo,this.dynamicLayoutVertexArray=new Oi,this.opacityVertexArray=new zi,this.placedSymbolArray=new to};yl.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length},yl.prototype.upload=function(t,e,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Vs.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,qs.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,pl,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t))},yl.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},Bn("SymbolBuffers",yl);var ml=function(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new uo,this.collisionVertexArray=new ji};ml.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Gs.members,!0)},ml.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},Bn("CollisionBuffers",ml);var vl=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.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ua([]),this.placementViewportMatrix=ua([]);var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=zu(this.zoom,e["text-size"]),this.iconSizeData=zu(this.zoom,e["icon-size"]);var r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((function(t){return wu[t]}))),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id})),this.sourceID=t.sourceID};vl.prototype.createArrays=function(){this.text=new yl(new Oo(this.layers,this.zoom,(function(t){return/^text/.test(t)}))),this.icon=new yl(new Oo(this.layers,this.zoom,(function(t){return/^icon/.test(t)}))),this.glyphOffsetArray=new no,this.lineVertexArray=new io,this.symbolInstances=new ro},vl.prototype.calculateGlyphDependencies=function(t,e,r,n,i){for(var o=0;o<t.length;o++)if(e[t.charCodeAt(o)]=!0,(r||n)&&i){var a=Ws[t.charAt(o)];a&&(e[a.charCodeAt(0)]=!0)}},vl.prototype.populate=function(t,e,r){var n=this.layers[0],i=n.layout,o=i.get("text-font"),a=i.get("text-field"),s=i.get("icon-image"),u=("constant"!==a.value.kind||a.value.value instanceof ie&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),l="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,c=i.get("symbol-sort-key");if(this.features=[],u||l){for(var h=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new ui(this.zoom),g=0,y=t;g<y.length;g+=1){var m=y[g],v=m.feature,_=m.id,x=m.index,b=m.sourceLayerIndex,w=n._featureFilter.needGeometry,E=Vo(v,w);if(n._featureFilter.filter(d,E,r)){w||(E.geometry=jo(v));var I=void 0;if(u){var S=n.getValueAndResolveTokens("text-field",E,r,f),C=ie.factory(S);gl(C)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===oi()||this.hasRTLText&&si.isParsed())&&(I=Ys(C,n,E))}var P=void 0;if(l){var M=n.getValueAndResolveTokens("icon-image",E,r,f);P=M instanceof oe?M:oe.fromString(M)}if(I||P){var T=this.sortFeaturesByKey?c.evaluate(E,{},r):void 0;if(this.features.push({id:_,text:I,icon:P,index:x,sourceLayerIndex:b,geometry:E.geometry,properties:v.properties,type:hl[v.type],sortKey:T}),P&&(h[P.name]=!0),I){var L=o.evaluate(E,{},r).join(","),A="map"===i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(wu.vertical)>=0;for(var k=0,N=I.sections;k<N.length;k+=1){var D=N[k];if(D.image)h[D.image.name]=!0;else{var R=Yn(I.toString()),O=D.fontStack||L,z=p[O]=p[O]||{};this.calculateGlyphDependencies(D.text,z,A,this.allowVerticalPlacement,R)}}}}}}"line"===i.get("symbol-placement")&&(this.features=function(t){var e={},r={},n=[],i=0;function o(e){n.push(t[e]),i++}function a(t,e,i){var o=r[t];return delete r[t],r[e]=o,n[o].geometry[0].pop(),n[o].geometry[0]=n[o].geometry[0].concat(i[0]),o}function s(t,r,i){var o=e[r];return delete e[r],e[t]=o,n[o].geometry[0].shift(),n[o].geometry[0]=i[0].concat(n[o].geometry[0]),o}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 c=t[l],h=c.geometry,p=c.text?c.text.toString():null;if(p){var f=u(p,h),d=u(p,h,!0);if(f in r&&d in e&&r[f]!==e[d]){var g=s(f,d,h),y=a(f,d,n[g].geometry);delete e[f],delete r[d],r[u(p,n[y].geometry,!0)]=y,n[g].geometry=null}else f in r?a(f,d,h):d in e?s(f,d,h):(o(l),e[f]=i-1,r[d]=i-1)}else o(l)}return n.filter((function(t){return t.geometry}))}(this.features)),this.sortFeaturesByKey&&this.features.sort((function(t,e){return t.sortKey-e.sortKey}))}},vl.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))},vl.prototype.isEmpty=function(){return 0===this.symbolInstances.length&&!this.hasRTLText},vl.prototype.uploadPending=function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload},vl.prototype.upload=function(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.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},vl.prototype.destroyDebugData=function(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()},vl.prototype.destroy=function(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()},vl.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]),o={},a=t.segment+1;a<e.length;a++)o[a]={x:e[a].x,y:e[a].y,tileUnitDistanceFromAnchor:n},a<e.length-1&&(n+=e[a+1].dist(e[a]));for(var s=t.segment||0;s>=0;s--)o[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=o[u];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}},vl.prototype.addSymbols=function(t,e,r,n,i,o,a,s,u,l,c,h){for(var p=t.indexArray,f=t.layoutVertexArray,d=t.segments.prepareSegment(4*e.length,f,p,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,y=d.vertexLength,m=this.allowVerticalPlacement&&a===wu.vertical?Math.PI/2:0,v=o.text&&o.text.sections,_=0;_<e.length;_++){var x=e[_],b=x.tl,w=x.tr,E=x.bl,I=x.br,S=x.tex,C=x.pixelOffsetTL,P=x.pixelOffsetBR,M=x.minFontScaleX,T=x.minFontScaleY,L=x.glyphOffset,A=x.isSDF,k=x.sectionIndex,N=d.vertexLength,D=L[1];fl(f,s.x,s.y,b.x,D+b.y,S.x,S.y,r,A,C.x,C.y,M,T),fl(f,s.x,s.y,w.x,D+w.y,S.x+S.w,S.y,r,A,P.x,C.y,M,T),fl(f,s.x,s.y,E.x,D+E.y,S.x,S.y+S.h,r,A,C.x,P.y,M,T),fl(f,s.x,s.y,I.x,D+I.y,S.x+S.w,S.y+S.h,r,A,P.x,P.y,M,T),dl(t.dynamicLayoutVertexArray,s,m),p.emplaceBack(N,N+1,N+2),p.emplaceBack(N+1,N+2,N+3),d.vertexLength+=4,d.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(L[0]),_!==e.length-1&&k===e[_+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,o,o.index,{},h,v&&v[k])}t.placedSymbolArray.emplaceBack(s.x,s.y,g,this.glyphOffsetArray.length-g,y,u,l,s.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,!1,0,c)},vl.prototype._addCollisionDebugVertex=function(t,e,r,n,i,o){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,n,i,Math.round(o.x),Math.round(o.y))},vl.prototype.addCollisionDebugVertices=function(t,e,r,n,o,a,s){var u=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),l=u.vertexLength,c=o.layoutVertexArray,h=o.collisionVertexArray,p=s.anchorX,f=s.anchorY;this._addCollisionDebugVertex(c,h,a,p,f,new i(t,e)),this._addCollisionDebugVertex(c,h,a,p,f,new i(r,e)),this._addCollisionDebugVertex(c,h,a,p,f,new i(r,n)),this._addCollisionDebugVertex(c,h,a,p,f,new i(t,n)),u.vertexLength+=4;var d=o.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),u.primitiveLength+=4},vl.prototype.addDebugCollisionBoxes=function(t,e,r,n){for(var i=t;i<e;i++){var o=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(o.x1,o.y1,o.x2,o.y2,n?this.textCollisionBox:this.iconCollisionBox,o.anchorPoint,r)}},vl.prototype.generateCollisionDebugBuffers=function(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ml(Bi,Xs.members,Wi),this.iconCollisionBox=new ml(Bi,Xs.members,Wi);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)}},vl.prototype._deserializeCollisionBoxesForSymbol=function(t,e,r,n,i,o,a,s,u){for(var l={},c=e;c<r;c++){var h=t.get(c);l.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},l.textFeatureIndex=h.featureIndex;break}for(var p=n;p<i;p++){var f=t.get(p);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 d=o;d<a;d++){var g=t.get(d);l.iconBox={x1:g.x1,y1:g.y1,x2:g.x2,y2:g.y2,anchorPointX:g.anchorPointX,anchorPointY:g.anchorPointY},l.iconFeatureIndex=g.featureIndex;break}for(var y=s;y<u;y++){var m=t.get(y);l.verticalIconBox={x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2,anchorPointX:m.anchorPointX,anchorPointY:m.anchorPointY},l.verticalIconFeatureIndex=m.featureIndex;break}return l},vl.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))}},vl.prototype.hasTextData=function(){return this.text.segments.get().length>0},vl.prototype.hasIconData=function(){return this.icon.segments.get().length>0},vl.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},vl.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},vl.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},vl.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)},vl.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=[],o=[],a=0;a<this.symbolInstances.length;++a){o.push(a);var s=this.symbolInstances.get(a);n.push(0|Math.round(e*s.anchorX+r*s.anchorY)),i.push(s.featureIndex)}return o.sort((function(t,e){return n[t]-n[e]||i[e]-i[t]})),o},vl.prototype.addToSortKeyRanges=function(t,e){var r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})},vl.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=this.symbolInstances.get(n[r]);this.featureSortOrder.push(i.featureIndex),[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((function(t,r,n){t>=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t)})),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},Bn("SymbolBucket",vl,{omit:["layers","collisionBoxArray","features","compareText"]}),vl.MAX_GLYPHS=65535,vl.addDynamicAttributes=dl;var _l=new wi({"symbol-placement":new mi(Lt.layout_symbol["symbol-placement"]),"symbol-spacing":new mi(Lt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new mi(Lt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new vi(Lt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new mi(Lt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new mi(Lt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new mi(Lt.layout_symbol["icon-ignore-placement"]),"icon-optional":new mi(Lt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new mi(Lt.layout_symbol["icon-rotation-alignment"]),"icon-size":new vi(Lt.layout_symbol["icon-size"]),"icon-text-fit":new mi(Lt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new mi(Lt.layout_symbol["icon-text-fit-padding"]),"icon-image":new vi(Lt.layout_symbol["icon-image"]),"icon-rotate":new vi(Lt.layout_symbol["icon-rotate"]),"icon-padding":new mi(Lt.layout_symbol["icon-padding"]),"icon-keep-upright":new mi(Lt.layout_symbol["icon-keep-upright"]),"icon-offset":new vi(Lt.layout_symbol["icon-offset"]),"icon-anchor":new vi(Lt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new mi(Lt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new mi(Lt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new mi(Lt.layout_symbol["text-rotation-alignment"]),"text-field":new vi(Lt.layout_symbol["text-field"]),"text-font":new vi(Lt.layout_symbol["text-font"]),"text-size":new vi(Lt.layout_symbol["text-size"]),"text-max-width":new vi(Lt.layout_symbol["text-max-width"]),"text-line-height":new mi(Lt.layout_symbol["text-line-height"]),"text-letter-spacing":new vi(Lt.layout_symbol["text-letter-spacing"]),"text-justify":new vi(Lt.layout_symbol["text-justify"]),"text-radial-offset":new vi(Lt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new mi(Lt.layout_symbol["text-variable-anchor"]),"text-anchor":new vi(Lt.layout_symbol["text-anchor"]),"text-max-angle":new mi(Lt.layout_symbol["text-max-angle"]),"text-writing-mode":new mi(Lt.layout_symbol["text-writing-mode"]),"text-rotate":new vi(Lt.layout_symbol["text-rotate"]),"text-padding":new mi(Lt.layout_symbol["text-padding"]),"text-keep-upright":new mi(Lt.layout_symbol["text-keep-upright"]),"text-transform":new vi(Lt.layout_symbol["text-transform"]),"text-offset":new vi(Lt.layout_symbol["text-offset"]),"text-allow-overlap":new mi(Lt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new mi(Lt.layout_symbol["text-ignore-placement"]),"text-optional":new mi(Lt.layout_symbol["text-optional"])}),xl={paint:new wi({"icon-opacity":new vi(Lt.paint_symbol["icon-opacity"]),"icon-color":new vi(Lt.paint_symbol["icon-color"]),"icon-halo-color":new vi(Lt.paint_symbol["icon-halo-color"]),"icon-halo-width":new vi(Lt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new vi(Lt.paint_symbol["icon-halo-blur"]),"icon-translate":new mi(Lt.paint_symbol["icon-translate"]),"icon-translate-anchor":new mi(Lt.paint_symbol["icon-translate-anchor"]),"text-opacity":new vi(Lt.paint_symbol["text-opacity"]),"text-color":new vi(Lt.paint_symbol["text-color"],{runtimeType:Vt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new vi(Lt.paint_symbol["text-halo-color"]),"text-halo-width":new vi(Lt.paint_symbol["text-halo-width"]),"text-halo-blur":new vi(Lt.paint_symbol["text-halo-blur"]),"text-translate":new mi(Lt.paint_symbol["text-translate"]),"text-translate-anchor":new mi(Lt.paint_symbol["text-translate-anchor"])}),layout:_l},bl=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Ft,this.defaultValue=t};bl.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},bl.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},bl.prototype.outputDefined=function(){return!1},bl.prototype.serialize=function(){return null},Bn("FormatSectionOverride",bl,{omit:["defaultValue"]});var wl=function(t){function e(e){t.call(this,e,xl)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var n=this.layout.get("text-writing-mode");if(n){for(var i=[],o=0,a=n;o<a.length;o+=1){var s=a[o];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,n){var i=this.layout.get(t).evaluate(e,{},r,n),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Zr(o.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,(function(e,r){return r in t?String(t[r]):""}))}(e.properties,i)},e.prototype.createBucket=function(t){return new vl(t)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype._setPaintOverrides=function(){for(var t=0,r=xl.paint.overridableProperties;t<r.length;t+=1){var n=r[t];if(e.hasPaintOverride(this.layout,n)){var i,o=this.paint.get(n),a=new bl(o),s=new Xr(a,o.property.specification);i="constant"===o.value.kind||"source"===o.value.kind?new Wr("source",s):new Hr("composite",s,o.value.zoomStops,o.value._interpolationType),this.paint._values[n]=new gi(o.property,i,o.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=xl.paint.properties[e],i=!1,o=function(t){for(var e=0,r=t;e<r.length;e+=1)if(n.overrides&&n.overrides.hasOverride(r[e]))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof ie)o(r.value.value.sections);else if("source"===r.value.kind){var a=function(t){i||(t instanceof ce&&ue(t.value)===Zt?o(t.value.sections):t instanceof de?o(t.sections):t.eachChild(a))},s=r.value;s._styleExpression&&a(s._styleExpression.expression)}return i},e}(Ei),El={paint:new wi({"background-color":new mi(Lt.paint_background["background-color"]),"background-pattern":new xi(Lt.paint_background["background-pattern"]),"background-opacity":new mi(Lt.paint_background["background-opacity"])})},Il=function(t){function e(e){t.call(this,e,El)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Ei),Sl={paint:new wi({"raster-opacity":new mi(Lt.paint_raster["raster-opacity"]),"raster-hue-rotate":new mi(Lt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new mi(Lt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new mi(Lt.paint_raster["raster-brightness-max"]),"raster-saturation":new mi(Lt.paint_raster["raster-saturation"]),"raster-contrast":new mi(Lt.paint_raster["raster-contrast"]),"raster-resampling":new mi(Lt.paint_raster["raster-resampling"]),"raster-fade-duration":new mi(Lt.paint_raster["raster-fade-duration"])})},Cl=function(t){function e(e){t.call(this,e,Sl)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Ei),Pl=function(t){function e(e){t.call(this,e,{}),this.implementation=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(Ei),Ml={circle:fa,heatmap:Ea,hillshade:Sa,fill:hs,"fill-extrusion":Ms,line:Us,symbol:wl,background:Il,raster:Cl},Tl=a.HTMLImageElement,Ll=a.HTMLCanvasElement,Al=a.HTMLVideoElement,kl=a.ImageData,Nl=a.ImageBitmap,Dl=function(t,e,r,n){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,n)};Dl.prototype.update=function(t,e,r){var n=t.width,i=t.height,o=!(this.size&&this.size[0]===n&&this.size[1]===i||r),a=this.context,s=a.gl;if(this.useMipmap=Boolean(e&&e.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!e||!1!==e.premultiply)),o)this.size=[n,i],t instanceof Tl||t instanceof Ll||t instanceof Al||t instanceof kl||Nl&&t instanceof Nl?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,c=u.y;t instanceof Tl||t instanceof Ll||t instanceof Al||t instanceof kl||Nl&&t instanceof Nl?s.texSubImage2D(s.TEXTURE_2D,0,l,c,s.RGBA,s.UNSIGNED_BYTE,t):s.texSubImage2D(s.TEXTURE_2D,0,l,c,n,i,s.RGBA,s.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D)},Dl.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)},Dl.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},Dl.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var Rl=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()})};Rl.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))},Rl.prototype.remove=function(){delete this._channel,this._callback=function(){}};var Ol=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 Rl(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=C()?t:a};function zl(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]}Ol.prototype.send=function(t,e,r,n,i){var o=this;void 0===i&&(i=!1);var a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[a]=r);var s=T(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:qn(e,s)},s),{cancel:function(){r&&delete o.callbacks[a],o.target.postMessage({id:a,type:"<cancel>",targetMapId:n,sourceMapId:o.mapId})}}},Ol.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n()}else C()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},Ol.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)}},Ol.prototype.processTask=function(t,e){var r=this;if("<response>"===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(Gn(e.error)):n(null,Gn(e.data)))}else{var i=!1,o=T(this.globalScope)?void 0:[],a=e.hasCallback?function(e,n){i=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"<response>",sourceMapId:r.mapId,error:e?qn(e):null,data:qn(n,o)},o)}:function(t){i=!0},s=null,u=Gn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,u,a);else if(this.parent.getWorkerSource){var l=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,l[0],u.source)[l[1]](u,a)}else a(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},Ol.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Fl=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]))};Fl.prototype.setNorthEast=function(t){return this._ne=t instanceof Bl?new Bl(t.lng,t.lat):Bl.convert(t),this},Fl.prototype.setSouthWest=function(t){return this._sw=t instanceof Bl?new Bl(t.lng,t.lat):Bl.convert(t),this},Fl.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof Bl)e=t,r=t;else{if(!(t instanceof Fl))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Fl.convert(t)):this.extend(Bl.convert(t)):this;if(r=t._ne,!(e=t._sw)||!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 Bl(e.lng,e.lat),this._ne=new Bl(r.lng,r.lat)),this},Fl.prototype.getCenter=function(){return new Bl((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Fl.prototype.getSouthWest=function(){return this._sw},Fl.prototype.getNorthEast=function(){return this._ne},Fl.prototype.getNorthWest=function(){return new Bl(this.getWest(),this.getNorth())},Fl.prototype.getSouthEast=function(){return new Bl(this.getEast(),this.getSouth())},Fl.prototype.getWest=function(){return this._sw.lng},Fl.prototype.getSouth=function(){return this._sw.lat},Fl.prototype.getEast=function(){return this._ne.lng},Fl.prototype.getNorth=function(){return this._ne.lat},Fl.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Fl.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Fl.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Fl.prototype.contains=function(t){var e=Bl.convert(t),r=e.lng,n=e.lat,i=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&i},Fl.convert=function(t){return!t||t instanceof Fl?t:new Fl(t)};var Bl=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")};Bl.prototype.wrap=function(){return new Bl(h(this.lng,-180,180),this.lat)},Bl.prototype.toArray=function(){return[this.lng,this.lat]},Bl.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Bl.prototype.distanceTo=function(t){var e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(i,1))},Bl.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 Fl(new Bl(this.lng-r,this.lat-e),new Bl(this.lng+r,this.lat+e))},Bl.convert=function(t){if(t instanceof Bl)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Bl(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Bl(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: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")};var Ul=2*Math.PI*6371008.8;function jl(t){return Ul*Math.cos(t*Math.PI/180)}function Vl(t){return(180+t)/360}function ql(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Gl(t,e){return t/jl(e)}function Xl(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Zl=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};Zl.fromLngLat=function(t,e){void 0===e&&(e=0);var r=Bl.convert(t);return new Zl(Vl(r.lng),ql(r.lat),Gl(e,r.lat))},Zl.prototype.toLngLat=function(){return new Bl(360*this.x-180,Xl(this.y))},Zl.prototype.toAltitude=function(){return this.z*jl(Xl(this.y))},Zl.prototype.meterInMercatorCoordinateUnits=function(){return 1/Ul*(t=Xl(this.y),1/Math.cos(t*Math.PI/180));var t};var Yl=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=Jl(0,t,t,e,r)};Yl.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Yl.prototype.url=function(t,e){var r,n,i,o,a,s=(n=this.y,i=this.z,o=zl(256*(r=this.x),256*(n=Math.pow(2,i)-n-1),i),a=zl(256*(r+1),256*(n+1),i),o[0]+","+o[1]+","+a[0]+","+a[1]),u=function(t,e,r){for(var n,i="",o=t;o>0;o--)i+=(e&(n=1<<o-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)},Yl.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new i(8192*(t.x*e-this.x),8192*(t.y*e-this.y))},Yl.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var Wl=function(t,e){this.wrap=t,this.canonical=e,this.key=Jl(t,e.z,e.z,e.x,e.y)},Hl=function(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new Yl(r,+n,+i),this.key=Jl(e,t,r,n,i)};function Jl(t,e,r,n,i){(t*=2)<0&&(t=-1*t-1);var o=1<<r;return(o*o*t+o*i+n).toString(36)+r.toString(36)+e.toString(36)}Hl.prototype.equals=function(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)},Hl.prototype.scaledTo=function(t){var e=this.canonical.z-t;return t>this.canonical.z?new Hl(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Hl(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Hl.prototype.calculateScaledKey=function(t,e){var r=this.canonical.z-t;return t>this.canonical.z?Jl(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Jl(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)},Hl.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},Hl.prototype.children=function(t){if(this.overscaledZ>=t)return[new Hl(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 Hl(e,this.wrap,e,r,n),new Hl(e,this.wrap,e,r+1,n),new Hl(e,this.wrap,e,r,n+1),new Hl(e,this.wrap,e,r+1,n+1)]},Hl.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))},Hl.prototype.wrapped=function(){return new Hl(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},Hl.prototype.unwrapTo=function(t){return new Hl(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)},Hl.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},Hl.prototype.toUnwrapped=function(){return new Wl(this.wrap,this.canonical)},Hl.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},Hl.prototype.getTilePoint=function(t){return this.canonical.getTilePoint(new Zl(t.x-this.wrap,t.y))},Bn("CanonicalTileID",Yl),Bn("OverscaledTileID",Hl,{omit:["posMatrix"]});var Kl=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 E('"'+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)]};Kl.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])},Kl.prototype.getUnpackVector=function(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]},Kl.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)},Kl.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},Kl.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Kl.prototype.getPixels=function(){return new xa({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Kl.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,o=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:o=a-1;break;case 1:a=o+1}for(var s=-e*this.dim,u=-r*this.dim,l=o;l<a;l++)for(var c=n;c<i;c++)this.data[this._idx(c,l)]=t.data[this._idx(c+s,l+u)]},Bn("DEMData",Kl);var $l=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}};$l.prototype.encode=function(t){return this._stringToNumber[t]},$l.prototype.decode=function(t){return this._numberToString[t]};var Ql=function(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i},tc={geometry:{configurable:!0}};tc.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},tc.geometry.set=function(t){this._geometry=t},Ql.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(Ql.prototype,tc);var ec=function(){this.state={},this.stateChanges={},this.deletedStates={}};ec.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]||{},p(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 o in this.deletedStates[t][n]={},this.state[t][n])r[o]||(this.deletedStates[t][n][o]=null);else for(var a in r)this.deletedStates[t]&&this.deletedStates[t][n]&&null===this.deletedStates[t][n][a]&&delete this.deletedStates[t][n][a]},ec.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)null!==this.deletedStates[t][n]&&(this.deletedStates[t][n]=this.deletedStates[t][n]||{},this.deletedStates[t][n][r]=null);else if(void 0!==e)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}},ec.prototype.getState=function(t,e){var r=String(e),n=p({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){var i=this.deletedStates[t][e];if(null===i)return{};for(var o in i)delete n[o]}return n},ec.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},ec.prototype.coalesceChanges=function(t,e){var r={};for(var n in this.stateChanges){this.state[n]=this.state[n]||{};var i={};for(var o in this.stateChanges[n])this.state[n][o]||(this.state[n][o]={}),p(this.state[n][o],this.stateChanges[n][o]),i[o]=this.state[n][o];r[n]=i}for(var a in this.deletedStates){this.state[a]=this.state[a]||{};var s={};if(null===this.deletedStates[a])for(var u in this.state[a])s[u]={},this.state[a][u]={};else for(var l in this.deletedStates[a]){if(null===this.deletedStates[a][l])this.state[a][l]={};else for(var c=0,h=Object.keys(this.deletedStates[a][l]);c<h.length;c+=1)delete this.state[a][l][h[c]];s[l]=this.state[a][l]}r[a]=r[a]||{},p(r[a],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(var f in t)t[f].setFeatureState(r,e)};var rc=function(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Dn(8192,16,0),this.grid3D=new Dn(8192,16,0),this.featureIndexArray=new ao,this.promoteId=e};function nc(t,e,r,n,i){return _(t,(function(t,o){var a=e instanceof yi?e.get(o):null;return a&&a.evaluate?a.evaluate(r,n,i):a}))}function ic(t){for(var e=1/0,r=1/0,n=-1/0,i=-1/0,o=0,a=t;o<a.length;o+=1){var s=a[o];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 oc(t,e){return e-t}rc.prototype.insert=function(t,e,r,n,i,o){var a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);for(var s=o?this.grid3D:this.grid,u=0;u<e.length;u++){for(var l=e[u],c=[1/0,1/0,-1/0,-1/0],h=0;h<l.length;h++){var p=l[h];c[0]=Math.min(c[0],p.x),c[1]=Math.min(c[1],p.y),c[2]=Math.max(c[2],p.x),c[3]=Math.max(c[3],p.y)}c[0]<8192&&c[1]<8192&&c[2]>=0&&c[3]>=0&&s.insert(a,c[0],c[1],c[2],c[3])}},rc.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new bs.VectorTile(new Ks(this.rawTileData)).layers,this.sourceLayerCoder=new $l(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},rc.prototype.query=function(t,e,r,n){var o=this;this.loadVTLayers();for(var a=t.params||{},s=8192/t.tileSize/t.scale,u=sn(a.filter),l=t.queryGeometry,c=t.queryPadding*s,h=ic(l),p=this.grid.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c),f=ic(t.cameraQueryGeometry),d=this.grid3D.query(f.minX-c,f.minY-c,f.maxX+c,f.maxY+c,(function(e,r,n,o){return function(t,e,r,n,o){for(var a=0,s=t;a<s.length;a+=1){var u=s[a];if(e<=u.x&&r<=u.y&&n>=u.x&&o>=u.y)return!0}var l=[new i(e,r),new i(e,o),new i(n,o),new i(n,r)];if(t.length>2)for(var c=0,h=l;c<h.length;c+=1)if(ta(t,h[c]))return!0;for(var p=0;p<t.length-1;p++)if(ea(t[p],t[p+1],l))return!0;return!1}(t.cameraQueryGeometry,e-c,r-c,n+c,o+c)})),g=0,y=d;g<y.length;g+=1)p.push(y[g]);p.sort(oc);for(var m,v={},_=function(i){var c=p[i];if(c!==m){m=c;var h=o.featureIndexArray.get(c),f=null;o.loadMatchingFeature(v,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,u,a.layers,a.availableImages,e,r,n,(function(e,r,n){return f||(f=jo(e)),r.queryIntersectsFeature(l,e,n,f,o.z,t.transform,s,t.pixelPosMatrix)}))}},x=0;x<p.length;x++)_(x);return v},rc.prototype.loadMatchingFeature=function(t,e,r,n,i,o,a,s,u,l,c){var h=this.bucketLayerIDs[e];if(!o||function(t,e){for(var r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}(o,h)){var f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(n);if(i.needGeometry){var g=Vo(d,!0);if(!i.filter(new ui(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!i.filter(new ui(this.tileID.overscaledZ),d))return;for(var y=this.getId(d,f),m=0;m<h.length;m++){var v=h[m];if(!(o&&o.indexOf(v)<0)){var _=s[v];if(_){var x={};void 0!==y&&l&&(x=l.getState(_.sourceLayer||"_geojsonTileLayer",y));var b=p({},u[v]);b.paint=nc(b.paint,_.paint,d,x,a),b.layout=nc(b.layout,_.layout,d,x,a);var w=!c||c(d,_,x);if(w){var E=new Ql(d,this.z,this.x,this.y,y);E.layer=b;var I=t[v];void 0===I&&(I=t[v]=[]),I.push({featureIndex:n,feature:E,intersectionZ:w})}}}}}},rc.prototype.lookupSymbolFeatures=function(t,e,r,n,i,o,a,s){var u={};this.loadVTLayers();for(var l=sn(i),c=0,h=t;c<h.length;c+=1)this.loadMatchingFeature(u,r,n,h[c],l,o,a,s,e);return u},rc.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},rc.prototype.getId=function(t,e){var r=t.id;return this.promoteId&&"boolean"==typeof(r=t.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[e]])&&(r=Number(r)),r},Bn("FeatureIndex",rc,{omit:["rawTileData","sourceLayerCoder"]});var ac=function(t,e){this.tileID=t,this.uid=d(),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"};ac.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e<F.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)},ac.prototype.wasRequested=function(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state},ac.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=o[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 a=0,s=n;a<s.length;a+=1)r[s[a].id]=t}},i=0,o=t;i<o.length;i+=1)n();return r}(t.buckets,e.style),this.hasSymbolBuckets=!1,this.buckets){var i=this.buckets[n];if(i instanceof vl){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var o in this.buckets){var a=this.buckets[o];if(a instanceof vl&&a.hasRTLText){this.hasRTLText=!0,si.isLoading()||si.isLoaded()||"deferred"!==oi()||ai();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 $i},ac.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"},ac.prototype.getBucket=function(t){return this.buckets[t.id]},ac.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 Dl(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Dl(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)},ac.prototype.prepare=function(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)},ac.prototype.queryRenderedFeatures=function(t,e,r,n,i,o,a,s,u,l){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:i,scale:o,tileSize:this.tileSize,pixelPosMatrix:l,transform:s,params:a,queryPadding:this.queryPadding*u},t,e,r):{}},ac.prototype.querySourceFeatures=function(t,e){var r=this.latestFeatureIndex;if(r&&r.rawTileData){var n=r.loadVTLayers(),i=e?e.sourceLayer:"",o=n._geojsonTileLayer||n[i];if(o)for(var a=sn(e&&e.filter),s=this.tileID.canonical,u=s.z,l=s.x,c=s.y,h={z:u,x:l,y:c},p=0;p<o.length;p++){var f=o.feature(p);if(a.needGeometry){var d=Vo(f,!0);if(!a.filter(new ui(this.tileID.overscaledZ),d,this.tileID.canonical))continue}else if(!a.filter(new ui(this.tileID.overscaledZ),f))continue;var g=r.getId(f,i),y=new Ql(f,u,l,c,g);y.tile=h,t.push(y)}}},ac.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},ac.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},ac.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=P(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 o=this.expirationTime-e;o?this.expirationTime=n+Math.max(o,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},ac.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)},ac.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)if(e.style.hasLayer(n)){var i=this.buckets[n],o=i.layers[0].sourceLayer||"_geojsonTileLayer",a=r[o],s=t[o];if(a&&s&&0!==Object.keys(s).length){i.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});var u=e&&e.style&&e.style.getLayer(n);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(i)))}}}},ac.prototype.holdingForFade=function(){return void 0!==this.symbolFadeHoldUntil},ac.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<F.now()},ac.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},ac.prototype.setHoldDuration=function(t){this.symbolFadeHoldUntil=F.now()+t},ac.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},ac.prototype.hasDependency=function(t,e){for(var r=0,n=t;r<n.length;r+=1){var i=this.dependencies[n[r]];if(i)for(var o=0,a=e;o<a.length;o+=1)if(i[a[o]])return!0}return!1};var sc=a.performance,uc=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},sc.mark(this._marks.start)};uc.prototype.finish=function(){sc.mark(this._marks.end);var t=sc.getEntriesByName(this._marks.measure);return 0===t.length&&(sc.measure(this._marks.measure,this._marks.start,this._marks.end),t=sc.getEntriesByName(this._marks.measure),sc.clearMarks(this._marks.start),sc.clearMarks(this._marks.end),sc.clearMeasures(this._marks.measure)),t},t.Actor=Ol,t.AlphaImage=_a,t.CanonicalTileID=Yl,t.CollisionBoxArray=$i,t.Color=ee,t.DEMData=Kl,t.DataConstantProperty=mi,t.DictionaryCoder=$l,t.EXTENT=8192,t.ErrorEvent=Mt,t.EvaluationParameters=ui,t.Event=Pt,t.Evented=Tt,t.FeatureIndex=rc,t.FillBucket=us,t.FillExtrusionBucket=Ss,t.ImageAtlas=bu,t.ImagePosition=_u,t.LineBucket=Os,t.LngLat=Bl,t.LngLatBounds=Fl,t.MercatorCoordinate=Zl,t.ONE_EM=24,t.OverscaledTileID=Hl,t.Point=i,t.Point$1=i,t.Properties=wi,t.Protobuf=Ks,t.RGBAImage=xa,t.RequestManager=X,t.RequestPerformance=uc,t.ResourceType=dt,t.SegmentVector=uo,t.SourceFeatureState=ec,t.StructArrayLayout1ui2=Hi,t.StructArrayLayout2f1f2i16=Ui,t.StructArrayLayout2i4=Ti,t.StructArrayLayout3ui6=Vi,t.StructArrayLayout4i8=Li,t.SymbolBucket=vl,t.Texture=Dl,t.Tile=ac,t.Transitionable=hi,t.Uniform1f=wo,t.Uniform1i=bo,t.Uniform2f=Eo,t.Uniform3f=Io,t.Uniform4f=So,t.UniformColor=Co,t.UniformMatrix4f=Mo,t.UnwrappedTileID=Wl,t.ValidationError=At,t.WritingMode=wu,t.ZoomHistory=Xn,t.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},t.addDynamicAttributes=dl,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),o=null;t.forEach((function(t,a){e(t,(function(t,e){t&&(o=t),i[a]=e,0==--n&&r(o,i)}))}))},t.bezier=u,t.bindAll=m,t.browser=F,t.cacheEntryPossiblyAdded=function(t){++pt>ut&&(t.getActor().send("enforceCacheSizeLimit",st),pt=0)},t.clamp=c,t.clearTileCache=function(t){var e=a.caches.delete("mapbox-tiles");t&&e.catch(t).then((function(){return t()}))},t.clipLine=Yu,t.clone=function(t){var e=new sa(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.clone$2=function(t){var e=new sa(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=Zs,t.config=B,t.create=function(){var t=new sa(16);return sa!=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 sa(9);return sa!=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 sa(4);return sa!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=Yr,t.createLayout=Pi,t.createStyleLayer=function(t){return"custom"===t.type?new Pl(t):new Ml[t.type](t)},t.cross=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],u=r[2];return t[0]=i*u-o*s,t[1]=o*a-n*u,t[2]=n*s-i*a,t},t.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var n=0;n<e.length;n++)if(!t(e[n],r[n]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==r){if("object"!=typeof r)return!1;if(Object.keys(e).length!==Object.keys(r).length)return!1;for(var i in e)if(!t(e[i],r[i]))return!1;return!0}return e===r},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.dot$1=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},t.ease=l,t.emitValidationErrors=Nn,t.endsWith=v,t.enforceCacheSizeLimit=function(t){lt(),tt&&tt.then((function(e){e.keys().then((function(r){for(var n=0;n<r.length-t;n++)e.delete(r[n])}))}))},t.evaluateSizeForFeature=Fu,t.evaluateSizeForZoom=Bu,t.evaluateVariableOffset=al,t.evented=ii,t.extend=p,t.featureFilter=sn,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=Nu,t.getAnchorJustification=sl,t.getArrayBuffer=bt,t.getImage=It,t.getJSON=function(t,e){return xt(p(t,{type:"json"}),e)},t.getRTLTextPluginStatus=oi,t.getReferrer=yt,t.getVideo=function(t,e){var r,n,i=a.document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(var o=0;o<t.length;o++){var s=a.document.createElement("source");r=t[o],n=void 0,(n=a.document.createElement("a")).href=r,(n.protocol!==a.document.location.protocol||n.host!==a.document.location.host)&&(i.crossOrigin="Anonymous"),s.src=t[o],i.appendChild(s)}return{cancel:function(){}}},t.identity=ua,t.invert=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],l=e[7],c=e[8],h=e[9],p=e[10],f=e[11],d=e[12],g=e[13],y=e[14],m=e[15],v=r*s-n*a,_=r*u-i*a,x=r*l-o*a,b=n*u-i*s,w=n*l-o*s,E=i*l-o*u,I=c*g-h*d,S=c*y-p*d,C=c*m-f*d,P=h*y-p*g,M=h*m-f*g,T=p*m-f*y,L=v*T-_*M+x*P+b*C-w*S+E*I;return L?(t[0]=(s*T-u*M+l*P)*(L=1/L),t[1]=(i*M-n*T-o*P)*L,t[2]=(g*E-y*w+m*b)*L,t[3]=(p*w-h*E-f*b)*L,t[4]=(u*C-a*T-l*S)*L,t[5]=(r*T-i*C+o*S)*L,t[6]=(y*x-d*E-m*_)*L,t[7]=(c*E-p*x+f*_)*L,t[8]=(a*M-s*C+l*I)*L,t[9]=(n*C-r*M-o*I)*L,t[10]=(d*w-g*x+m*v)*L,t[11]=(h*x-c*w-f*v)*L,t[12]=(s*S-a*P-u*I)*L,t[13]=(r*P-n*S+i*I)*L,t[14]=(g*_-d*b-y*v)*L,t[15]=(c*b-h*_+p*v)*L,t):null},t.isChar=Zn,t.isMapboxURL=Z,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=_,t.mercatorXfromLng=Vl,t.mercatorYfromLat=ql,t.mercatorZfromAltitude=Gl,t.mul=ha,t.multiply=la,t.mvt=bs,t.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},t.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},t.number=Xe,t.offscreenCanvasSupported=ft,t.ortho=function(t,e,r,n,i,o,a){var s=1/(e-r),u=1/(n-i),l=1/(o-a);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]=(a+o)*l,t[15]=1,t},t.parseGlyphPBF=function(t){return new Ks(t).readFields(gu,[])},t.pbf=Ks,t.performSymbolLayout=function(t,e,r,n,i,o,a){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var s=t.layers[0].layout,u=t.layers[0]._unevaluatedLayout._values,l={};if("composite"===t.textSizeData.kind){var c=t.textSizeData,h=c.maxZoom;l.compositeTextSizes=[u["text-size"].possiblyEvaluate(new ui(c.minZoom),a),u["text-size"].possiblyEvaluate(new ui(h),a)]}if("composite"===t.iconSizeData.kind){var p=t.iconSizeData,f=p.maxZoom;l.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new ui(p.minZoom),a),u["icon-size"].possiblyEvaluate(new ui(f),a)]}l.layoutTextSize=u["text-size"].possiblyEvaluate(new ui(t.zoom+1),a),l.layoutIconSize=u["icon-size"].possiblyEvaluate(new ui(t.zoom+1),a),l.textMaxSize=u["text-size"].possiblyEvaluate(new ui(18));for(var d=24*s.get("text-line-height"),g="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),y=s.get("text-keep-upright"),m=s.get("text-size"),v=function(){var o=x[_],u=s.get("text-font").evaluate(o,{},a).join(","),c=m.evaluate(o,{},a),h=l.layoutTextSize.evaluate(o,{},a),p=l.layoutIconSize.evaluate(o,{},a),f={horizontal:{},vertical:void 0},v=o.text,b=[0,0];if(v){var w=v.toString(),I=24*s.get("text-letter-spacing").evaluate(o,{},a),S=function(t){for(var e=0,r=t;e<r.length;e+=1)if(n=r[e].charCodeAt(0),Zn.Arabic(n)||Zn["Arabic Supplement"](n)||Zn["Arabic Extended-A"](n)||Zn["Arabic Presentation Forms-A"](n)||Zn["Arabic Presentation Forms-B"](n))return!1;var n;return!0}(w)?I:0,C=s.get("text-anchor").evaluate(o,{},a),P=s.get("text-variable-anchor");if(!P){var M=s.get("text-radial-offset").evaluate(o,{},a);b=M?al(C,[24*M,ol]):s.get("text-offset").evaluate(o,{},a).map((function(t){return 24*t}))}var T=g?"center":s.get("text-justify").evaluate(o,{},a),L=s.get("symbol-placement"),A="point"===L?24*s.get("text-max-width").evaluate(o,{},a):0,k=function(){t.allowVerticalPlacement&&Yn(w)&&(f.vertical=Su(v,e,r,i,u,A,d,C,"left",S,b,wu.vertical,!0,L,h,c))};if(!g&&P){for(var N="auto"===T?P.map((function(t){return sl(t)})):[T],D=!1,R=0;R<N.length;R++){var O=N[R];if(!f.horizontal[O])if(D)f.horizontal[O]=f.horizontal[0];else{var z=Su(v,e,r,i,u,A,d,"center",O,S,b,wu.horizontal,!1,L,h,c);z&&(f.horizontal[O]=z,D=1===z.positionedLines.length)}}k()}else{"auto"===T&&(T=sl(C));var F=Su(v,e,r,i,u,A,d,C,T,S,b,wu.horizontal,!1,L,h,c);F&&(f.horizontal[T]=F),k(),Yn(w)&&g&&y&&(f.vertical=Su(v,e,r,i,u,A,d,C,T,S,b,wu.vertical,!1,L,h,c))}}var B=void 0,U=!1;if(o.icon&&o.icon.name){var j=n[o.icon.name];j&&(B=function(t,e,r){var n=Nu(r),i=e[0]-t.displaySize[0]*n.horizontalAlign,o=e[1]-t.displaySize[1]*n.verticalAlign;return{image:t,top:o,bottom:o+t.displaySize[1],left:i,right:i+t.displaySize[0]}}(i[o.icon.name],s.get("icon-offset").evaluate(o,{},a),s.get("icon-anchor").evaluate(o,{},a)),U=j.sdf,void 0===t.sdfIcons?t.sdfIcons=j.sdf:t.sdfIcons!==j.sdf&&E("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(j.pixelRatio!==t.pixelRatio||0!==s.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0))}var V=ll(f.horizontal)||f.vertical;t.iconsInText=!!V&&V.iconsInText,(V||B)&&function(t,e,r,n,i,o,a,s,u,l,c){var h=o.textMaxSize.evaluate(e,{});void 0===h&&(h=a);var p,f=t.layers[0].layout,d=f.get("icon-offset").evaluate(e,{},c),g=ll(r.horizontal),y=a/24,m=t.tilePixelRatio*y,v=t.tilePixelRatio*h/24,_=t.tilePixelRatio*s,x=t.tilePixelRatio*f.get("symbol-spacing"),b=f.get("text-padding")*t.tilePixelRatio,w=f.get("icon-padding")*t.tilePixelRatio,I=f.get("text-max-angle")/180*Math.PI,S="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),C="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),P=f.get("symbol-placement"),M=x/2,T=f.get("icon-text-fit");n&&"none"!==T&&(t.allowVerticalPlacement&&r.vertical&&(p=Ru(n,r.vertical,T,f.get("icon-text-fit-padding"),d,y)),g&&(n=Ru(n,g,T,f.get("icon-text-fit-padding"),d,y)));var L=function(s,h){h.x<0||h.x>=8192||h.y<0||h.y>=8192||function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y,m,v,_,x,b,w,I,S){var C,P,M,T,L,A=t.addToLineVertexArray(e,r),k=0,N=0,D=0,R=0,O=-1,z=-1,F={},B=fo(""),U=0,j=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(U=(C=s.layout.get("text-offset").evaluate(x,{},I).map((function(t){return 24*t})))[0],j=C[1]):(U=24*s.layout.get("text-radial-offset").evaluate(x,{},I),j=ol),t.allowVerticalPlacement&&n.vertical){var V=s.layout.get("text-rotate").evaluate(x,{},I)+90;T=new Qu(u,e,l,c,h,n.vertical,p,f,d,V),a&&(L=new Qu(u,e,l,c,h,a,y,m,d,V))}if(i){var q=s.layout.get("icon-rotate").evaluate(x,{}),G="none"!==s.layout.get("icon-text-fit"),X=Wu(i,q,w,G),Z=a?Wu(a,q,w,G):void 0;M=new Qu(u,e,l,c,h,i,y,m,!1,q),k=4*X.length;var Y=t.iconSizeData,W=null;"source"===Y.kind?(W=[128*s.layout.get("icon-size").evaluate(x,{})])[0]>32640&&E(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===Y.kind&&((W=[128*b.compositeIconSizes[0].evaluate(x,{},I),128*b.compositeIconSizes[1].evaluate(x,{},I)])[0]>32640||W[1]>32640)&&E(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,X,W,_,v,x,!1,e,A.lineStartIndex,A.lineLength,-1,I),O=t.icon.placedSymbolArray.length-1,Z&&(N=4*Z.length,t.addSymbols(t.icon,Z,W,_,v,x,wu.vertical,e,A.lineStartIndex,A.lineLength,-1,I),z=t.icon.placedSymbolArray.length-1)}for(var H in n.horizontal){var J=n.horizontal[H];if(!P){B=fo(J.text);var K=s.layout.get("text-rotate").evaluate(x,{},I);P=new Qu(u,e,l,c,h,J,p,f,d,K)}var $=1===J.positionedLines.length;if(D+=ul(t,e,J,o,s,d,x,g,A,n.vertical?wu.horizontal:wu.horizontalOnly,$?Object.keys(n.horizontal):[H],F,O,b,I),$)break}n.vertical&&(R+=ul(t,e,n.vertical,o,s,d,x,g,A,wu.vertical,["vertical"],F,z,b,I));var Q=P?P.boxStartIndex:t.collisionBoxArray.length,tt=P?P.boxEndIndex:t.collisionBoxArray.length,et=T?T.boxStartIndex:t.collisionBoxArray.length,rt=T?T.boxEndIndex:t.collisionBoxArray.length,nt=M?M.boxStartIndex:t.collisionBoxArray.length,it=M?M.boxEndIndex:t.collisionBoxArray.length,ot=L?L.boxStartIndex:t.collisionBoxArray.length,at=L?L.boxEndIndex:t.collisionBoxArray.length,st=-1,ut=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=ut(P,st),st=ut(T,st),st=ut(M,st);var lt=(st=ut(L,st))>-1?1:0;lt&&(st*=S/24),t.glyphOffsetArray.length>=vl.MAX_GLYPHS&&E("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,F.right>=0?F.right:-1,F.center>=0?F.center:-1,F.left>=0?F.left:-1,F.vertical||-1,O,z,B,Q,tt,et,rt,nt,it,ot,at,l,D,R,k,N,lt,0,p,U,j,st)}(t,h,s,r,n,i,p,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,m,b,S,u,_,w,C,d,e,o,l,c,a)};if("line"===P)for(var A=0,k=Yu(e.geometry,0,0,8192,8192);A<k.length;A+=1)for(var N=k[A],D=0,R=Zu(N,x,I,r.vertical||g,n,24,v,t.overscaling,8192);D<R.length;D+=1){var O=R[D];g&&cl(t,g.text,M,O)||L(N,O)}else if("line-center"===P)for(var z=0,F=e.geometry;z<F.length;z+=1){var B=F[z];if(B.length>1){var U=Xu(B,I,r.vertical||g,n,24,v);U&&L(B,U)}}else if("Polygon"===e.type)for(var j=0,V=is(e.geometry,0);j<V.length;j+=1){var q=V[j],G=rl(q,16);L(q[0],new Ou(G.x,G.y,0))}else if("LineString"===e.type)for(var X=0,Z=e.geometry;X<Z.length;X+=1){var Y=Z[X];L(Y,new Ou(Y[0].x,Y[0].y,0))}else if("Point"===e.type)for(var W=0,H=e.geometry;W<H.length;W+=1)for(var J=0,K=H[W];J<K.length;J+=1){var $=K[J];L([$],new Ou($.x,$.y,0))}}(t,o,f,B,n,l,h,p,b,U,a)},_=0,x=t.features;_<x.length;_+=1)v();o&&t.generateCollisionDebugBuffers()},t.perspective=function(t,e,r,n,i){var o,a=1/Math.tan(e/2);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,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?(t[10]=(i+n)*(o=1/(n-i)),t[14]=2*i*n*o):(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=si,t.polygonIntersectsPolygon=Xo,t.postMapLoadEvent=at,t.postTurnstileEvent=it,t.potpack=vu,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.register=Bn,t.registerForPluginStateChange=function(t){return t({pluginStatus:ti,pluginURL:ei}),ii.on("pluginStateChange",t),t},t.renderColorRamp=wa,t.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+o*s,t[1]=i*u+a*s,t[2]=n*-s+o*u,t[3]=i*-s+a*u,t},t.rotateX=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],u=e[7],l=e[8],c=e[9],h=e[10],p=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]=o*i+l*n,t[5]=a*i+c*n,t[6]=s*i+h*n,t[7]=u*i+p*n,t[8]=l*i-o*n,t[9]=c*i-a*n,t[10]=h*i-s*n,t[11]=p*i-u*n,t},t.rotateZ=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],u=e[3],l=e[4],c=e[5],h=e[6],p=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]=o*i+l*n,t[1]=a*i+c*n,t[2]=s*i+h*n,t[3]=u*i+p*n,t[4]=l*i-o*n,t[5]=c*i-a*n,t[6]=h*i-s*n,t[7]=p*i-u*n,t},t.scale=function(t,e,r){var n=r[0],i=r[1],o=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]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.scale$1=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},t.scale$2=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},t.setCacheLimits=function(t,e){st=t,ut=e},t.setRTLTextPlugin=function(t,e,r){if(void 0===r&&(r=!1),"deferred"===ti||"loading"===ti||"loaded"===ti)throw new Error("setRTLTextPlugin cannot be called multiple times.");ei=F.resolveURL(t),ti="deferred",Qn=e,ni(),r||ai()},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.sqrLen=function(t){var e=t[0],r=t[1];return e*e+r*r},t.styleSpec=Lt,t.sub=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},t.symbolSize=Uu,t.transformMat3=function(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t},t.transformMat4=pa,t.translate=function(t,e,r){var n,i,o,a,s,u,l,c,h,p,f,d,g=r[0],y=r[1],m=r[2];return e===t?(t[12]=e[0]*g+e[4]*y+e[8]*m+e[12],t[13]=e[1]*g+e[5]*y+e[9]*m+e[13],t[14]=e[2]*g+e[6]*y+e[10]*m+e[14],t[15]=e[3]*g+e[7]*y+e[11]*m+e[15]):(i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=n=e[0],t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=l,t[7]=c,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=n*g+s*y+h*m+e[12],t[13]=i*g+u*y+p*m+e[13],t[14]=o*g+l*y+f*m+e[14],t[15]=a*g+c*y+d*m+e[15]),t},t.triggerPluginCompletionEvent=ri,t.uniqueId=d,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=Ln,t.validateStyle=Tn,t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.vectorTile=bs,t.version="1.15.2",t.warnOnce=E,t.webpSupported=U,t.window=a,t.wrap=h}));n(0,(function(t){function e(t){var r=typeof t;if("number"===r||"boolean"===r||"string"===r||null==t)return JSON.stringify(t);if(Array.isArray(t)){for(var n="[",i=0,o=t;i<o.length;i+=1)n+=e(o[i])+",";return n+"]"}for(var a=Object.keys(t).sort(),s="{",u=0;u<a.length;u++)s+=JSON.stringify(a[u])+":"+e(t[a[u]])+",";return s+"}"}function r(r){for(var n="",i=0,o=t.refProperties;i<o.length;i+=1)n+="/"+e(r[o[i]]);return n}var n=function(t){this.keyCache={},t&&this.replace(t)};n.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},n.prototype.update=function(e,n){for(var i=this,o=0,a=e;o<a.length;o+=1){var s=a[o];this._layerConfigs[s.id]=s;var u=this._layers[s.id]=t.createStyleLayer(s);u._featureFilter=t.featureFilter(u.filter),this.keyCache[s.id]&&delete this.keyCache[s.id]}for(var l=0,c=n;l<c.length;l+=1){var h=c[l];delete this.keyCache[h],delete this._layerConfigs[h],delete this._layers[h]}this.familiesBySource={};for(var p=0,f=function(t,e){for(var n={},i=0;i<t.length;i++){var o=e&&e[t[i].id]||r(t[i]);e&&(e[t[i].id]=o);var a=n[o];a||(a=n[o]=[]),a.push(t[i])}var s=[];for(var u in n)s.push(n[u]);return s}(t.values(this._layerConfigs),this.keyCache);p<f.length;p+=1){var d=f[p].map((function(t){return i._layers[t.id]})),g=d[0];if("none"!==g.visibility){var y=g.source||"",m=this.familiesBySource[y];m||(m=this.familiesBySource[y]={});var v=g.sourceLayer||"_geojsonTileLayer",_=m[v];_||(_=m[v]=[]),_.push(d)}}};var i=function(e){var r={},n=[];for(var i in e){var o=e[i],a=r[i]={};for(var s in o){var u=o[+s];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var l={x:0,y:0,w:u.bitmap.width+2,h:u.bitmap.height+2};n.push(l),a[s]={rect:l,metrics:u.metrics}}}}var c=t.potpack(n),h=new t.AlphaImage({width:c.w||1,height:c.h||1});for(var p in e){var f=e[p];for(var d in f){var g=f[+d];if(g&&0!==g.bitmap.width&&0!==g.bitmap.height){var y=r[p][d].rect;t.AlphaImage.copy(g.bitmap,h,{x:0,y:0},{x:y.x+1,y:y.y+1},g.bitmap)}}}this.image=h,this.positions=r};t.register("GlyphAtlas",i);var o=function(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId};function a(e,r,n){for(var i=new t.EvaluationParameters(r),o=0,a=e;o<a.length;o+=1)a[o].recalculate(i,n)}function s(e,r){var n=t.getArrayBuffer(e.request,(function(e,n,i,o){e?r(e):n&&r(null,{vectorTile:new t.vectorTile.VectorTile(new t.pbf(n)),rawData:n,cacheControl:i,expires:o})}));return function(){n.cancel(),r()}}o.prototype.parse=function(e,r,n,o,s){var u=this;this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;var l=new t.DictionaryCoder(Object.keys(e.layers).sort()),c=new t.FeatureIndex(this.tileID,this.promoteId);c.bucketLayerIDs=[];var h,p,f,d,g={},y={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},m=r.familiesBySource[this.source];for(var v in m){var _=e.layers[v];if(_){1===_.version&&t.warnOnce('Vector tile source "'+this.source+'" layer "'+v+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var x=l.encode(v),b=[],w=0;w<_.length;w++){var E=_.feature(w),I=c.getId(E,v);b.push({feature:E,id:I,index:w,sourceLayerIndex:x})}for(var S=0,C=m[v];S<C.length;S+=1){var P=C[S],M=P[0];M.minzoom&&this.zoom<Math.floor(M.minzoom)||M.maxzoom&&this.zoom>=M.maxzoom||"none"!==M.visibility&&(a(P,this.zoom,n),(g[M.id]=M.createBucket({index:c.bucketLayerIDs.length,layers:P,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:x,sourceID:this.source})).populate(b,y,this.tileID.canonical),c.bucketLayerIDs.push(P.map((function(t){return t.id}))))}}}var T=t.mapObject(y.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(T).length?o.send("getGlyphs",{uid:this.uid,stacks:T},(function(t,e){h||(h=t,p=e,k.call(u))})):p={};var L=Object.keys(y.iconDependencies);L.length?o.send("getImages",{icons:L,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){h||(h=t,f=e,k.call(u))})):f={};var A=Object.keys(y.patternDependencies);function k(){if(h)return s(h);if(p&&f&&d){var e=new i(p),r=new t.ImageAtlas(f,d);for(var o in g){var u=g[o];u instanceof t.SymbolBucket?(a(u.layers,this.zoom,n),t.performSymbolLayout(u,p,e.positions,f,r.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):u.hasPattern&&(u instanceof t.LineBucket||u instanceof t.FillBucket||u instanceof t.FillExtrusionBucket)&&(a(u.layers,this.zoom,n),u.addFeatures(y,this.tileID.canonical,r.patternPositions))}this.status="done",s(null,{buckets:t.values(g).filter((function(t){return!t.isEmpty()})),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?e.positions:null})}}A.length?o.send("getImages",{icons:A,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){h||(h=t,d=e,k.call(u))})):d={},k.call(this)};var u=function(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||s,this.loading={},this.loaded={}};u.prototype.loadTile=function(e,r){var n=this,i=e.uid;this.loading||(this.loading={});var a=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[i]=new o(e);s.abort=this.loadVectorData(e,(function(e,o){if(delete n.loading[i],e||!o)return s.status="done",n.loaded[i]=s,r(e);var u=o.rawData,l={};o.expires&&(l.expires=o.expires),o.cacheControl&&(l.cacheControl=o.cacheControl);var c={};if(a){var h=a.finish();h&&(c.resourceTiming=JSON.parse(JSON.stringify(h)))}s.vectorTile=o.vectorTile,s.parse(o.vectorTile,n.layerIndex,n.availableImages,n.actor,(function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:u.slice(0)},n,l,c))})),n.loaded=n.loaded||{},n.loaded[i]=s}))},u.prototype.reloadTile=function(t,e){var r=this,n=this.loaded,i=t.uid,o=this;if(n&&n[i]){var a=n[i];a.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,n){var i=a.reloadCallback;i&&(delete a.reloadCallback,a.parse(a.vectorTile,o.layerIndex,r.availableImages,o.actor,i)),e(t,n)};"parsing"===a.status?a.reloadCallback=s:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},u.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},u.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var l=t.window.ImageBitmap,c=function(){this.loaded={}};function h(t,e){if(0!==t.length){p(t[0],e);for(var r=1;r<t.length;r++)p(t[r],!e)}}function p(t,e){for(var r=0,n=0,i=t.length,o=i-1;n<i;o=n++)r+=(t[n][0]-t[o][0])*(t[o][1]+t[n][1]);r>=0!=!!e&&t.reverse()}c.prototype.loadTile=function(e,r){var n=e.uid,i=e.encoding,o=e.rawImageData,a=l&&o instanceof l?this.getImageData(o):o,s=new t.DEMData(n,a,i);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)},c.prototype.getImageData=function(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var r=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:r.width,height:r.height},r.data)},c.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var f=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,d=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};d.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r<n.length;r+=1){var i=n[r];e.push([new t.Point$1(i[0],i[1])])}return e}for(var o=[],a=0,s=this._feature.geometry;a<s.length;a+=1){for(var u=[],l=0,c=s[a];l<c.length;l+=1){var h=c[l];u.push(new t.Point$1(h[0],h[1]))}o.push(u)}return o},d.prototype.toGeoJSON=function(t,e,r){return f.call(this,t,e,r)};var g=function(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e};g.prototype.feature=function(t){return new d(this._features[t])};var y=t.vectorTile.VectorTileFeature,m=v;function v(t,e){this.options=e||{},this.features=t,this.length=t.length}function _(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}v.prototype.feature=function(t){return new _(this.features[t],this.options.extent)},_.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var r=0;r<e.length;r++){for(var n=e[r],i=[],o=0;o<n.length;o++)i.push(new t.Point$1(n[o][0],n[o][1]));this.geometry.push(i)}return this.geometry},_.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var u=a[s];e=Math.min(e,u.x),r=Math.max(r,u.x),n=Math.min(n,u.y),i=Math.max(i,u.y)}return[e,n,r,i]},_.prototype.toGeoJSON=y.prototype.toGeoJSON;var x=w,b=m;function w(e){var r=new t.pbf;return function(t,e){for(var r in t.layers)e.writeMessage(3,E,t.layers[r])}(e,r),r.finish()}function E(t,e){var r;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<t.length;r++)n.feature=t.feature(r),e.writeMessage(2,I,n);var i=n.keys;for(r=0;r<i.length;r++)e.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)e.writeMessage(4,T,o[r])}function I(t,e){var r=t.feature;void 0!==r.id&&e.writeVarintField(1,r.id),e.writeMessage(2,S,t),e.writeVarintField(3,r.type),e.writeMessage(4,M,r)}function S(t,e){var r=t.feature,n=t.keys,i=t.values,o=t.keycache,a=t.valuecache;for(var s in r.properties){var u=o[s];void 0===u&&(n.push(s),o[s]=u=n.length-1),e.writeVarint(u);var l=r.properties[s],c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,p=a[h];void 0===p&&(i.push(l),a[h]=p=i.length-1),e.writeVarint(p)}}function C(t,e){return(e<<3)+(7&t)}function P(t){return t<<1^t>>31}function M(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;s<a;s++){var u=r[s],l=1;1===n&&(l=u.length),e.writeVarint(C(1,l));for(var c=3===n?u.length-1:u.length,h=0;h<c;h++){1===h&&1!==n&&e.writeVarint(C(2,c-1));var p=u[h].x-i,f=u[h].y-o;e.writeVarint(P(p)),e.writeVarint(P(f)),i+=p,o+=f}3===n&&e.writeVarint(C(7,1))}}function T(t,e){var r=typeof t;"string"===r?e.writeStringField(1,t):"boolean"===r?e.writeBooleanField(7,t):"number"===r&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function L(t,e,r,n){A(t,r,n),A(e,2*r,2*n),A(e,2*r+1,2*n+1)}function A(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function k(t,e,r,n){var i=t-r,o=e-n;return i*i+o*o}x.fromVectorTileJs=w,x.fromGeojsonVt=function(t,e){e=e||{};var r={};for(var n in t)r[n]=new m(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return w({layers:r})},x.GeoJSONWrapper=b;var N=function(t){return t[0]},D=function(t){return t[1]},R=function(t,e,r,n,i){void 0===e&&(e=N),void 0===r&&(r=D),void 0===n&&(n=64),void 0===i&&(i=Float64Array),this.nodeSize=n,this.points=t;for(var o=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(t.length),s=this.coords=new i(2*t.length),u=0;u<t.length;u++)a[u]=u,s[2*u]=e(t[u]),s[2*u+1]=r(t[u]);!function t(e,r,n,i,o,a){if(!(o-i<=n)){var s=i+o>>1;!function t(e,r,n,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,u=n-i+1,l=Math.log(s),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(s-c)/s)*(u-s/2<0?-1:1);t(e,r,n,Math.max(i,Math.floor(n-u*c/s+h)),Math.min(o,Math.floor(n+(s-u)*c/s+h)),a)}var p=r[2*n+a],f=i,d=o;for(L(e,r,i,n),r[2*o+a]>p&&L(e,r,i,o);f<d;){for(L(e,r,f,d),f++,d--;r[2*f+a]<p;)f++;for(;r[2*d+a]>p;)d--}r[2*i+a]===p?L(e,r,i,d):L(e,r,++d,o),d<=n&&(i=d+1),n<=d&&(o=d-1)}}(e,r,s,i,o,a%2),t(e,r,n,i,s-1,a+1),t(e,r,n,s+1,o,a+1)}}(a,s,n,0,a.length-1,0)};R.prototype.range=function(t,e,r,n){return function(t,e,r,n,i,o,a){for(var s,u,l=[0,t.length-1,0],c=[];l.length;){var h=l.pop(),p=l.pop(),f=l.pop();if(p-f<=a)for(var d=f;d<=p;d++)u=e[2*d+1],(s=e[2*d])>=r&&s<=i&&u>=n&&u<=o&&c.push(t[d]);else{var g=Math.floor((f+p)/2);u=e[2*g+1],(s=e[2*g])>=r&&s<=i&&u>=n&&u<=o&&c.push(t[g]);var y=(h+1)%2;(0===h?r<=s:n<=u)&&(l.push(f),l.push(g-1),l.push(y)),(0===h?i>=s:o>=u)&&(l.push(g+1),l.push(p),l.push(y))}}return c}(this.ids,this.coords,t,e,r,n,this.nodeSize)},R.prototype.within=function(t,e,r){return function(t,e,r,n,i,o){for(var a=[0,t.length-1,0],s=[],u=i*i;a.length;){var l=a.pop(),c=a.pop(),h=a.pop();if(c-h<=o)for(var p=h;p<=c;p++)k(e[2*p],e[2*p+1],r,n)<=u&&s.push(t[p]);else{var f=Math.floor((h+c)/2),d=e[2*f],g=e[2*f+1];k(d,g,r,n)<=u&&s.push(t[f]);var y=(l+1)%2;(0===l?r-i<=d:n-i<=g)&&(a.push(h),a.push(f-1),a.push(y)),(0===l?r+i>=d:n+i>=g)&&(a.push(f+1),a.push(c),a.push(y))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var O={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},z=function(t){this.options=G(Object.create(O),t),this.trees=new Array(this.options.maxZoom+1)};function F(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function B(t,e){var r=t.geometry.coordinates,n=r[1];return{x:V(r[0]),y:q(n),zoom:1/0,index:e,parentId:-1}}function U(t){return{type:"Feature",id:t.id,properties:j(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function j(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return G(G({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function V(t){return t/360+.5}function q(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function G(t,e){for(var r in e)t[r]=e[r];return t}function X(t){return t.x}function Z(t){return t.y}function Y(t,e,r,n,i,o){var a=i-r,s=o-n;if(0!==a||0!==s){var u=((t-r)*a+(e-n)*s)/(a*a+s*s);u>1?(r=i,n=o):u>0&&(r+=a*u,n+=s*u)}return(a=t-r)*a+(s=e-n)*s}function W(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)H(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n<e.length;n++)H(t,e[n]);else if("MultiPolygon"===r)for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)H(t,e[n][i])}(i),i}function H(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function J(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],u=e.id;if(r.promoteId?u=e.properties[r.promoteId]:r.generateId&&(u=n||0),"Point"===o)K(i,s);else if("MultiPoint"===o)for(var l=0;l<i.length;l++)K(i[l],s);else if("LineString"===o)$(i,s,a,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(l=0;l<i.length;l++)$(i[l],s=[],a,!1),t.push(W(u,"LineString",s,e.properties));return}Q(i,s,a,!1)}else if("Polygon"===o)Q(i,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(l=0;l<e.geometry.geometries.length;l++)J(t,{id:u,geometry:e.geometry.geometries[l],properties:e.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(l=0;l<i.length;l++){var c=[];Q(i[l],c,a,!0),s.push(c)}}t.push(W(u,o,s,e.properties))}}function K(t,e){e.push(tt(t[0])),e.push(et(t[1])),e.push(0)}function $(t,e,r,n){for(var i,o,a=0,s=0;s<t.length;s++){var u=tt(t[s][0]),l=et(t[s][1]);e.push(u),e.push(l),e.push(0),s>0&&(a+=n?(i*l-u*o)/2:Math.sqrt(Math.pow(u-i,2)+Math.pow(l-o,2))),i=u,o=l}var c=e.length-3;e[2]=1,function t(e,r,n,i){for(var o,a=i,s=n-r>>1,u=n-r,l=e[r],c=e[r+1],h=e[n],p=e[n+1],f=r+3;f<n;f+=3){var d=Y(e[f],e[f+1],l,c,h,p);if(d>a)o=f,a=d;else if(d===a){var g=Math.abs(f-s);g<u&&(o=f,u=g)}}a>i&&(o-r>3&&t(e,r,o,i),e[o+2]=a,n-o>3&&t(e,o,n,i))}(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Q(t,e,r,n){for(var i=0;i<t.length;i++){var o=[];$(t[i],o,r,n),e.push(o)}}function tt(t){return t/360+.5}function et(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function rt(t,e,r,n,i,o,a,s){if(n/=e,o>=(r/=e)&&a<n)return t;if(a<r||o>=n)return null;for(var u=[],l=0;l<t.length;l++){var c=t[l],h=c.geometry,p=c.type,f=0===i?c.minX:c.minY,d=0===i?c.maxX:c.maxY;if(f>=r&&d<n)u.push(c);else if(!(d<r||f>=n)){var g=[];if("Point"===p||"MultiPoint"===p)nt(h,g,r,n,i);else if("LineString"===p)it(h,g,r,n,i,!1,s.lineMetrics);else if("MultiLineString"===p)at(h,g,r,n,i,!1);else if("Polygon"===p)at(h,g,r,n,i,!0);else if("MultiPolygon"===p)for(var y=0;y<h.length;y++){var m=[];at(h[y],m,r,n,i,!0),m.length&&g.push(m)}if(g.length){if(s.lineMetrics&&"LineString"===p){for(y=0;y<g.length;y++)u.push(W(c.id,p,g[y],c.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"),u.push(W(c.id,p,g,c.tags))}}}return u.length?u:null}function nt(t,e,r,n,i){for(var o=0;o<t.length;o+=3){var a=t[o+i];a>=r&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function it(t,e,r,n,i,o,a){for(var s,u,l=ot(t),c=0===i?ut:lt,h=t.start,p=0;p<t.length-3;p+=3){var f=t[p],d=t[p+1],g=t[p+2],y=t[p+3],m=t[p+4],v=0===i?f:d,_=0===i?y:m,x=!1;a&&(s=Math.sqrt(Math.pow(f-y,2)+Math.pow(d-m,2))),v<r?_>r&&(u=c(l,f,d,y,m,r),a&&(l.start=h+s*u)):v>n?_<n&&(u=c(l,f,d,y,m,n),a&&(l.start=h+s*u)):st(l,f,d,g),_<r&&v>=r&&(u=c(l,f,d,y,m,r),x=!0),_>n&&v<=n&&(u=c(l,f,d,y,m,n),x=!0),!o&&x&&(a&&(l.end=h+s*u),e.push(l),l=ot(t)),a&&(h+=s)}var b=t.length-3;f=t[b],d=t[b+1],g=t[b+2],(v=0===i?f:d)>=r&&v<=n&&st(l,f,d,g),b=l.length-3,o&&b>=3&&(l[b]!==l[0]||l[b+1]!==l[1])&&st(l,l[0],l[1],l[2]),l.length&&e.push(l)}function ot(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function at(t,e,r,n,i,o){for(var a=0;a<t.length;a++)it(t[a],e,r,n,i,o,!1)}function st(t,e,r,n){t.push(e),t.push(r),t.push(n)}function ut(t,e,r,n,i,o){var a=(o-e)/(n-e);return t.push(o),t.push(r+(i-r)*a),t.push(1),a}function lt(t,e,r,n,i,o){var a=(o-r)/(i-r);return t.push(e+(n-e)*a),t.push(o),t.push(1),a}function ct(t,e){for(var r=[],n=0;n<t.length;n++){var i,o=t[n],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)i=ht(o.geometry,e);else if("MultiLineString"===a||"Polygon"===a){i=[];for(var s=0;s<o.geometry.length;s++)i.push(ht(o.geometry[s],e))}else if("MultiPolygon"===a)for(i=[],s=0;s<o.geometry.length;s++){for(var u=[],l=0;l<o.geometry[s].length;l++)u.push(ht(o.geometry[s][l],e));i.push(u)}r.push(W(o.id,a,i,o.tags))}return r}function ht(t,e){var r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function pt(t,e){if(t.transformed)return t;var r,n,i,o=1<<t.z,a=t.x,s=t.y;for(r=0;r<t.features.length;r++){var u=t.features[r],l=u.geometry,c=u.type;if(u.geometry=[],1===c)for(n=0;n<l.length;n+=2)u.geometry.push(ft(l[n],l[n+1],e,o,a,s));else for(n=0;n<l.length;n++){var h=[];for(i=0;i<l[n].length;i+=2)h.push(ft(l[n][i],l[n][i+1],e,o,a,s));u.geometry.push(h)}}return t.transformed=!0,t}function ft(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function dt(t,e,r,n,i){for(var o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,gt(a,t[s],o,i);var u=t[s].minX,l=t[s].minY,c=t[s].maxX,h=t[s].maxY;u<a.minX&&(a.minX=u),l<a.minY&&(a.minY=l),c>a.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function gt(t,e,r,n){var i=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)yt(a,i,t,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<i.length;s++)yt(a,i[s],t,r,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(var u=0;u<i.length;u++){var l=i[u];for(s=0;s<l.length;s++)yt(a,l[s],t,r,!0,0===s)}if(a.length){var c=e.tags||null;if("LineString"===o&&n.lineMetrics){for(var h in c={},e.tags)c[h]=e.tags[h];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var p={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==e.id&&(p.id=e.id),t.features.push(p)}}function yt(t,e,r,n,i,o){var a=n*n;if(n>0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var s=[],u=0;u<e.length;u+=3)(0===n||e[u+2]>a)&&(r.numSimplified++,s.push(e[u]),s.push(e[u+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,o=i-2;n<i;o=n,n+=2)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===e)for(n=0,i=t.length;n<i/2;n+=2){var a=t[n],s=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=s}}(s,o),t.push(s)}}function mt(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)J(r,t.features[n],e,n);else J(r,"Feature"===t.type?t:{geometry:t},e);return r}(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=function(t,e){var r=e.buffer/e.extent,n=t,i=rt(t,1,-1-r,r,0,-1,2,e),o=rt(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=rt(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=ct(i,1).concat(n)),o&&(n=n.concat(ct(o,-1)))),n}(n,e)).length&&this.splitTile(n,0,0,0),r&&(n.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 vt(t,e,r){return 32*((1<<t)*r+e)+t}function _t(t,e){var r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);var n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return e(null,null);var i=new g(n.features),o=x(i);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:i,rawData:o.buffer})}z.prototype.load=function(t){var e=this.options,r=e.log,n=e.minZoom,i=e.maxZoom,o=e.nodeSize;r&&console.time("total time");var a="prepare "+t.length+" points";r&&console.time(a),this.points=t;for(var s=[],u=0;u<t.length;u++)t[u].geometry&&s.push(B(t[u],u));this.trees[i+1]=new R(s,X,Z,o,Float32Array),r&&console.timeEnd(a);for(var l=i;l>=n;l--){var c=+Date.now();s=this._cluster(s,l),this.trees[l]=new R(s,X,Z,o,Float32Array),r&&console.log("z%d: %d clusters in %dms",l,s.length,+Date.now()-c)}return r&&console.timeEnd("total time"),this},z.prototype.getClusters=function(t,e){var r=((t[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,t[1])),i=180===t[2]?180:((t[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){var a=this.getClusters([r,n,180,o],e),s=this.getClusters([-180,n,i,o],e);return a.concat(s)}for(var u=this.trees[this._limitZoom(e)],l=[],c=0,h=u.range(V(r),q(o),V(i),q(n));c<h.length;c+=1){var p=u.points[h[c]];l.push(p.numPoints?U(p):this.points[p.index])}return l},z.prototype.getChildren=function(t){var e=this._getOriginId(t),r=this._getOriginZoom(t),n="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(n);var o=i.points[e];if(!o)throw new Error(n);for(var a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=[],u=0,l=i.within(o.x,o.y,a);u<l.length;u+=1){var c=i.points[l[u]];c.parentId===t&&s.push(c.numPoints?U(c):this.points[c.index])}if(0===s.length)throw new Error(n);return s},z.prototype.getLeaves=function(t,e,r){var n=[];return this._appendLeaves(n,t,e=e||10,r=r||0,0),n},z.prototype.getTile=function(t,e,r){var n=this.trees[this._limitZoom(t)],i=Math.pow(2,t),o=this.options,a=o.radius/o.extent,s=(r-a)/i,u=(r+1+a)/i,l={features:[]};return this._addTileFeatures(n.range((e-a)/i,s,(e+1+a)/i,u),n.points,e,r,i,l),0===e&&this._addTileFeatures(n.range(1-a/i,s,1,u),n.points,i,r,i,l),e===i-1&&this._addTileFeatures(n.range(0,s,a/i,u),n.points,-1,r,i,l),l.features.length?l:null},z.prototype.getClusterExpansionZoom=function(t){for(var e=this._getOriginZoom(t)-1;e<=this.options.maxZoom;){var r=this.getChildren(t);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e},z.prototype._appendLeaves=function(t,e,r,n,i){for(var o=0,a=this.getChildren(e);o<a.length;o+=1){var s=a[o],u=s.properties;if(u&&u.cluster?i+u.point_count<=n?i+=u.point_count:i=this._appendLeaves(t,u.cluster_id,r,n,i):i<n?i++:t.push(s),t.length===r)break}return i},z.prototype._addTileFeatures=function(t,e,r,n,i,o){for(var a=0,s=t;a<s.length;a+=1){var u=e[s[a]],l=u.numPoints,c={type:1,geometry:[[Math.round(this.options.extent*(u.x*i-r)),Math.round(this.options.extent*(u.y*i-n))]],tags:l?j(u):this.points[u.index].properties},h=void 0;l?h=u.id:this.options.generateId?h=u.index:this.points[u.index].id&&(h=this.points[u.index].id),void 0!==h&&(c.id=h),o.features.push(c)}},z.prototype._limitZoom=function(t){return Math.max(this.options.minZoom,Math.min(+t,this.options.maxZoom+1))},z.prototype._cluster=function(t,e){for(var r=[],n=this.options,i=n.reduce,o=n.minPoints,a=n.radius/(n.extent*Math.pow(2,e)),s=0;s<t.length;s++){var u=t[s];if(!(u.zoom<=e)){u.zoom=e;for(var l=this.trees[e+1],c=l.within(u.x,u.y,a),h=u.numPoints||1,p=h,f=0,d=c;f<d.length;f+=1){var g=l.points[d[f]];g.zoom>e&&(p+=g.numPoints||1)}if(p>=o){for(var y=u.x*h,m=u.y*h,v=i&&h>1?this._map(u,!0):null,_=(s<<5)+(e+1)+this.points.length,x=0,b=c;x<b.length;x+=1){var w=l.points[b[x]];if(!(w.zoom<=e)){w.zoom=e;var E=w.numPoints||1;y+=w.x*E,m+=w.y*E,w.parentId=_,i&&(v||(v=this._map(u,!0)),i(v,this._map(w)))}}u.parentId=_,r.push(F(y/p,m/p,_,p,v))}else if(r.push(u),p>1)for(var I=0,S=c;I<S.length;I+=1){var C=l.points[S[I]];C.zoom<=e||(C.zoom=e,r.push(C))}}}return r},z.prototype._getOriginId=function(t){return t-this.points.length>>5},z.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},z.prototype._map=function(t,e){if(t.numPoints)return e?G({},t.properties):t.properties;var r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?G({},n):n},mt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},mt.prototype.splitTile=function(t,e,r,n,i,o,a){for(var s=[t,e,r,n],u=this.options,l=u.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var c=1<<e,h=vt(e,r,n),p=this.tiles[h];if(!p&&(l>1&&console.time("creation"),p=this.tiles[h]=dt(t,e,r,n,u),this.tileCoords.push({z:e,x:r,y:n}),l)){l>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===u.maxZoom||e===i)continue;var d=1<<i-e;if(r!==Math.floor(o/d)||n!==Math.floor(a/d))continue}else if(e===u.indexMaxZoom||p.numPoints<=u.indexMaxPoints)continue;if(p.source=null,0!==t.length){l>1&&console.time("clipping");var g,y,m,v,_,x,b=.5*u.buffer/u.extent,w=.5-b,E=.5+b,I=1+b;g=y=m=v=null,_=rt(t,c,r-b,r+E,0,p.minX,p.maxX,u),x=rt(t,c,r+w,r+I,0,p.minX,p.maxX,u),t=null,_&&(g=rt(_,c,n-b,n+E,1,p.minY,p.maxY,u),y=rt(_,c,n+w,n+I,1,p.minY,p.maxY,u),_=null),x&&(m=rt(x,c,n-b,n+E,1,p.minY,p.maxY,u),v=rt(x,c,n+w,n+I,1,p.minY,p.maxY,u),x=null),l>1&&console.timeEnd("clipping"),s.push(g||[],e+1,2*r,2*n),s.push(y||[],e+1,2*r,2*n+1),s.push(m||[],e+1,2*r+1,2*n),s.push(v||[],e+1,2*r+1,2*n+1)}}},mt.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<<t,s=vt(t,e=(e%a+a)%a,r);if(this.tiles[s])return pt(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var u,l=t,c=e,h=r;!u&&l>0;)l--,c=Math.floor(c/2),h=Math.floor(h/2),u=this.tiles[vt(l,c,h)];return u&&u.source?(o>1&&console.log("found parent tile z%d-%d-%d",l,c,h),o>1&&console.time("drilling down"),this.splitTile(u.source,l,c,h,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?pt(this.tiles[s],i):null):null};var xt=function(e){function r(t,r,n,i){e.call(this,t,r,n,_t),i&&(this.loadGeoJSON=i)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var i=!!(n&&n.request&&n.request.collectResourceTiming)&&new t.RequestPerformance(n.request);this.loadGeoJSON(n,(function(o,a){if(o||!a)return r(o);if("object"!=typeof a)return r(new Error("Input data given to '"+n.source+"' is not a valid GeoJSON object."));!function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n<e.features.length;n++)t(e.features[n],r);else if("GeometryCollection"===i)for(n=0;n<e.geometries.length;n++)t(e.geometries[n],r);else if("Feature"===i)t(e.geometry,r);else if("Polygon"===i)h(e.coordinates,r);else if("MultiPolygon"===i)for(n=0;n<e.coordinates.length;n++)h(e.coordinates[n],r);return e}(a,!0);try{if(n.filter){var s=t.createExpression(n.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===s.result)throw new Error(s.value.map((function(t){return t.key+": "+t.message})).join(", "));var u=a.features.filter((function(t){return s.value.evaluate({zoom:0},t)}));a={type:"FeatureCollection",features:u}}e._geoJSONIndex=n.cluster?new z(function(e){var r=e.superclusterOptions,n=e.clusterProperties;if(!n||!r)return r;for(var i={},o={},a={accumulated:null,zoom:0},s={properties:null},u=Object.keys(n),l=0,c=u;l<c.length;l+=1){var h=c[l],p=n[h],f=p[0],d=t.createExpression(p[1]),g=t.createExpression("string"==typeof f?[f,["accumulated"],["get",h]]:f);i[h]=d.value,o[h]=g.value}return r.map=function(t){s.properties=t;for(var e={},r=0,n=u;r<n.length;r+=1){var o=n[r];e[o]=i[o].evaluate(a,s)}return e},r.reduce=function(t,e){s.properties=e;for(var r=0,n=u;r<n.length;r+=1){var i=n[r];a.accumulated=t[i],t[i]=o[i].evaluate(a,s)}},r}(n)).load(a.features):function(t,e){return new mt(t,e)}(a,n.geojsonVtOptions)}catch(o){return r(o)}e.loaded={};var l={};if(i){var c=i.finish();c&&(l.resourceTiming={},l.resourceTiming[n.source]=JSON.parse(JSON.stringify(c)))}r(null,l)}))}},r.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},r.prototype.reloadTile=function(t,r){var n=this.loaded;return n&&n[t.uid]?e.prototype.reloadTile.call(this,t,r):this.loadTile(t,r)},r.prototype.loadGeoJSON=function(e,r){if(e.request)t.getJSON(e.request,r);else{if("string"!=typeof e.data)return r(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."));try{return r(null,JSON.parse(e.data))}catch(t){return r(new Error("Input data given to '"+e.source+"' is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},r.prototype.getClusterExpansionZoom=function(t,e){try{e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))}catch(t){e(t)}},r.prototype.getClusterChildren=function(t,e){try{e(null,this._geoJSONIndex.getChildren(t.clusterId))}catch(t){e(t)}},r.prototype.getClusterLeaves=function(t,e){try{e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))}catch(t){e(t)}},r}(u),bt=function(e){var r=this;this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:u,geojson:xt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(t,e){if(r.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');r.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isParsed())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}};return bt.prototype.setReferrer=function(t,e){this.referrer=e},bt.prototype.setImages=function(t,e,r){for(var n in this.availableImages[t]=e,this.workerSources[t]){var i=this.workerSources[t][n];for(var o in i)i[o].availableImages=e}r()},bt.prototype.setLayers=function(t,e,r){this.getLayerIndex(t).replace(e),r()},bt.prototype.updateLayers=function(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()},bt.prototype.loadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)},bt.prototype.loadDEMTile=function(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)},bt.prototype.reloadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)},bt.prototype.abortTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)},bt.prototype.removeTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)},bt.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},bt.prototype.removeSource=function(t,e,r){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}},bt.prototype.loadWorkerSource=function(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}},bt.prototype.syncRTLPluginState=function(e,r,n){try{t.plugin.setState(r);var i=t.plugin.getPluginURL();if(t.plugin.isLoaded()&&!t.plugin.isParsed()&&null!=i){this.self.importScripts(i);var o=t.plugin.isParsed();n(o?void 0:new Error("RTL Text Plugin failed to import scripts from "+i),o)}}catch(t){n(t.toString())}},bt.prototype.getAvailableImages=function(t){var e=this.availableImages[t];return e||(e=[]),e},bt.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new n),e},bt.prototype.getWorkerSource=function(t,e,r){var n=this;return this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),this.workerSources[t][e][r]||(this.workerSources[t][e][r]=new this.workerSourceTypes[e]({send:function(e,r,i){n.actor.send(e,r,i,t)}},this.getLayerIndex(t),this.getAvailableImages(t))),this.workerSources[t][e][r]},bt.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new c),this.demWorkerSources[t][e]},bt.prototype.enforceCacheSizeLimit=function(e,r){t.enforceCacheSizeLimit(r)},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new bt(self)),bt}));n(0,(function(t){var e=t.createCommonjsModule((function(t){function e(t){return!r(t)}function r(t){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":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,r=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(r);try{e=new Worker(n),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(n),t}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var t=document.createElement("canvas");t.width=t.height=1;var e=t.getContext("2d");if(!e)return!1;var r=e.getImageData(0,0,1,1);return r&&r.width===t.width}()?(void 0===n[r=t&&t.failIfMajorPerformanceCaveat]&&(n[r]=function(t){var r=function(t){var r=document.createElement("canvas"),n=Object.create(e.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,r.probablySupportsContext?r.probablySupportsContext("webgl",n)||r.probablySupportsContext("experimental-webgl",n):r.supportsContext?r.supportsContext("webgl",n)||r.supportsContext("experimental-webgl",n):r.getContext("webgl",n)||r.getContext("experimental-webgl",n)}(t);if(!r)return!1;var n=r.createShader(r.VERTEX_SHADER);return!(!n||r.isContextLost())&&(r.shaderSource(n,"void main() {}"),r.compileShader(n),!0===r.getShaderParameter(n,r.COMPILE_STATUS))}(r)),n[r]?void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var r}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e,window.mapboxgl.notSupportedReason=r);var n={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}})),r={create:function(e,r,n){var i=t.window.document.createElement(e);return void 0!==r&&(i.className=r),n&&n.appendChild(i),i},createNS:function(e,r){return t.window.document.createElementNS(e,r)}},n=t.window.document&&t.window.document.documentElement.style;function i(t){if(!n)return t[0];for(var e=0;e<t.length;e++)if(t[e]in n)return t[e];return t[0]}var o,a=i(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);r.disableDrag=function(){n&&a&&(o=n[a],n[a]="none")},r.enableDrag=function(){n&&a&&(n[a]=o)};var s=i(["transform","WebkitTransform"]);r.setTransform=function(t,e){t.style[s]=e};var u=!1;try{var l=Object.defineProperty({},"passive",{get:function(){u=!0}});t.window.addEventListener("test",l,l),t.window.removeEventListener("test",l,l)}catch(t){u=!1}r.addEventListener=function(t,e,r,n){void 0===n&&(n={}),t.addEventListener(e,r,"passive"in n&&u?n:n.capture)},r.removeEventListener=function(t,e,r,n){void 0===n&&(n={}),t.removeEventListener(e,r,"passive"in n&&u?n:n.capture)};var c=function(e){e.preventDefault(),e.stopPropagation(),t.window.removeEventListener("click",c,!0)};function h(t){var e=t.userImage;return!!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}r.suppressClick=function(){t.window.addEventListener("click",c,!0),t.window.setTimeout((function(){t.window.removeEventListener("click",c,!0)}),0)},r.mousePos=function(e,r){var n=e.getBoundingClientRect();return new t.Point(r.clientX-n.left-e.clientLeft,r.clientY-n.top-e.clientTop)},r.touchPos=function(e,r){for(var n=e.getBoundingClientRect(),i=[],o=0;o<r.length;o++)i.push(new t.Point(r[o].clientX-n.left-e.clientLeft,r[o].clientY-n.top-e.clientTop));return i},r.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},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var p=function(e){function r(){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&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.isLoaded=function(){return this.loaded},r.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,r=this.requestors;e<r.length;e+=1){var n=r[e];this._notify(n.ids,n.callback)}this.requestors=[]}},r.prototype.getImage=function(t){return this.images[t]},r.prototype.addImage=function(t,e){this._validate(t,e)&&(this.images[t]=e)},r.prototype._validate=function(e,r){var n=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchX" value'))),n=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "stretchY" value'))),n=!1),this._validateContent(r.content,r)||(this.fire(new t.ErrorEvent(new Error('Image "'+e+'" has invalid "content" value'))),n=!1),n},r.prototype._validateStretch=function(t,e){if(!t)return!0;for(var r=0,n=0,i=t;n<i.length;n+=1){var o=i[n];if(o[0]<r||o[1]<o[0]||e<o[1])return!1;r=o[1]}return!0},r.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]))},r.prototype.updateImage=function(t,e){e.version=this.images[t].version+1,this.images[t]=e,this.updatedImages[t]=!0},r.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()},r.prototype.listImages=function(){return Object.keys(this.images)},r.prototype.getImages=function(t,e){var r=!0;if(!this.isLoaded())for(var n=0,i=t;n<i.length;n+=1)this.images[i[n]]||(r=!1);this.isLoaded()||r?this._notify(t,e):this.requestors.push({ids:t,callback:e})},r.prototype._notify=function(e,r){for(var n={},i=0,o=e;i<o.length;i+=1){var a=o[i];this.images[a]||this.fire(new t.Event("styleimagemissing",{id:a}));var s=this.images[a];s?n[a]={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 "'+a+'" 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.')}r(null,n)},r.prototype.getPixelSize=function(){var t=this.atlasImage;return{width:t.width,height:t.height}},r.prototype.getPattern=function(e){var r=this.patterns[e],n=this.getImage(e);if(!n)return null;if(r&&r.position.version===n.version)return r.position;if(r)r.position.version=n.version;else{var i={w:n.data.width+2,h:n.data.height+2,x:0,y:0},o=new t.ImagePosition(i,n);this.patterns[e]={bin:i,position:o}}return this._updatePatternAtlas(),this.patterns[e].position},r.prototype.bind=function(e){var r=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.Texture(e,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)},r.prototype._updatePatternAtlas=function(){var e=[];for(var r in this.patterns)e.push(this.patterns[r].bin);var n=t.potpack(e),i=n.w,o=n.h,a=this.atlasImage;for(var s in a.resize({width:i||1,height:o||1}),this.patterns){var u=this.patterns[s].bin,l=u.x+1,c=u.y+1,h=this.images[s].data,p=h.width,f=h.height;t.RGBAImage.copy(h,a,{x:0,y:0},{x:l,y:c},{width:p,height:f}),t.RGBAImage.copy(h,a,{x:0,y:f-1},{x:l,y:c-1},{width:p,height:1}),t.RGBAImage.copy(h,a,{x:0,y:0},{x:l,y:c+f},{width:p,height:1}),t.RGBAImage.copy(h,a,{x:p-1,y:0},{x:l-1,y:c},{width:1,height:f}),t.RGBAImage.copy(h,a,{x:0,y:0},{x:l+p,y:c},{width:1,height:f})}this.dirty=!0},r.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},r.prototype.dispatchRenderCallbacks=function(t){for(var e=0,r=t;e<r.length;e+=1){var n=r[e];if(!this.callbackDispatchedThisFrame[n]){this.callbackDispatchedThisFrame[n]=!0;var i=this.images[n];h(i)&&this.updateImage(n,i)}}},r}(t.Evented),f=y,d=y,g=1e20;function y(t,e,r,n,i,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,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(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.d=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Int16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function m(t,e,r,n,i,o,a){for(var s=0;s<e;s++){for(var u=0;u<r;u++)n[u]=t[u*e+s];for(v(n,i,o,a,r),u=0;u<r;u++)t[u*e+s]=i[u]}for(u=0;u<r;u++){for(s=0;s<e;s++)n[s]=t[u*e+s];for(v(n,i,o,a,e),s=0;s<e;s++)t[u*e+s]=Math.sqrt(i[s])}}function v(t,e,r,n,i){r[0]=0,n[0]=-g,n[1]=+g;for(var o=1,a=0;o<i;o++){for(var s=(t[o]+o*o-(t[r[a]]+r[a]*r[a]))/(2*o-2*r[a]);s<=n[a];)a--,s=(t[o]+o*o-(t[r[a]]+r[a]*r[a]))/(2*o-2*r[a]);r[++a]=o,n[a]=s,n[a+1]=+g}for(o=0,a=0;o<i;o++){for(;n[a+1]<o;)a++;e[o]=(o-r[a])*(o-r[a])+t[r[a]]}}y.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),r=new Uint8ClampedArray(this.size*this.size),n=0;n<this.size*this.size;n++){var i=e.data[4*n+3]/255;this.gridOuter[n]=1===i?0:0===i?g:Math.pow(Math.max(0,.5-i),2),this.gridInner[n]=1===i?g:0===i?0:Math.pow(Math.max(0,i-.5),2)}for(m(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),m(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),n=0;n<this.size*this.size;n++)r[n]=Math.max(0,Math.min(255,Math.round(255-255*((this.gridOuter[n]-this.gridInner[n])/this.radius+this.cutoff))));return r},f.default=d;var _=function(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}};_.prototype.setURL=function(t){this.url=t},_.prototype.getGlyphs=function(e,r){var n=this,i=[];for(var o in e)for(var a=0,s=e[o];a<s.length;a+=1)i.push({stack:o,id:s[a]});t.asyncAll(i,(function(t,e){var r=t.stack,i=t.id,o=n.entries[r];o||(o=n.entries[r]={glyphs:{},requests:{},ranges:{}});var a=o.glyphs[i];if(void 0===a){if(a=n._tinySDF(o,r,i))return o.glyphs[i]=a,void e(null,{stack:r,id:i,glyph:a});var s=Math.floor(i/256);if(256*s>65535)e(new Error("glyphs > 65535 not supported"));else if(o.ranges[s])e(null,{stack:r,id:i,glyph:a});else{var u=o.requests[s];u||(u=o.requests[s]=[],_.loadGlyphRange(r,s,n.url,n.requestManager,(function(t,e){if(e){for(var r in e)n._doesCharSupportLocalGlyph(+r)||(o.glyphs[+r]=e[+r]);o.ranges[s]=!0}for(var i=0,a=u;i<a.length;i+=1)(0,a[i])(t,e);delete o.requests[s]}))),u.push((function(t,n){t?e(t):n&&e(null,{stack:r,id:i,glyph:n[i]||null})}))}}else e(null,{stack:r,id:i,glyph:a})}),(function(t,e){if(t)r(t);else if(e){for(var n={},i=0,o=e;i<o.length;i+=1){var a=o[i],s=a.stack,u=a.id,l=a.glyph;(n[s]||(n[s]={}))[u]=l&&{id:l.id,bitmap:l.bitmap.clone(),metrics:l.metrics}}r(null,n)}}))},_.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))},_.prototype._tinySDF=function(e,r,n){var i=this.localIdeographFontFamily;if(i&&this._doesCharSupportLocalGlyph(n)){var o=e.tinySDF;if(!o){var a="400";/bold/i.test(r)?a="900":/medium/i.test(r)?a="500":/light/i.test(r)&&(a="200"),o=e.tinySDF=new _.TinySDF(24,3,8,.25,i,a)}return{id:n,bitmap:new t.AlphaImage({width:30,height:30},o.draw(String.fromCharCode(n))),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}},_.loadGlyphRange=function(e,r,n,i,o){var a=256*r,s=a+255,u=i.transformRequest(i.normalizeGlyphsURL(n).replace("{fontstack}",e).replace("{range}",a+"-"+s),t.ResourceType.Glyphs);t.getArrayBuffer(u,(function(e,r){if(e)o(e);else if(r){for(var n={},i=0,a=t.parseGlyphPBF(r);i<a.length;i+=1){var s=a[i];n[s.id]=s}o(null,n)}}))},_.TinySDF=f;var x=function(){this.specification=t.styleSpec.light.position};x.prototype.possiblyEvaluate=function(e,r){return t.sphericalToCartesian(e.expression.evaluate(r))},x.prototype.interpolate=function(e,r,n){return{x:t.number(e.x,r.x,n),y:t.number(e.y,r.y,n),z:t.number(e.z,r.z,n)}};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 r(r){e.call(this),this._transitionable=new t.Transitionable(b),this.setLight(r),this._transitioning=this._transitionable.untransitioned()}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getLight=function(){return this._transitionable.serialize()},r.prototype.setLight=function(e,r){if(void 0===r&&(r={}),!this._validate(t.validateLight,e,r))for(var n in e){var i=e[n];t.endsWith(n,"-transition")?this._transitionable.setTransition(n.slice(0,-"-transition".length),i):this._transitionable.setValue(n,i)}},r.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},r.prototype.hasTransition=function(){return this._transitioning.hasTransition()},r.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},r.prototype._validate=function(e,r,n){return(!n||!1!==n.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:r,style:{glyphs:!0,sprite:!0},styleSpec:t.styleSpec})))},r}(t.Evented),E=function(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}};E.prototype.getDash=function(t,e){var r=t.join(",")+String(e);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(t,e)),this.dashEntry[r]},E.prototype.getDashRanges=function(t,e,r){var n=[],i=t.length%2==1?-t[t.length-1]*r:0,o=t[0]*r,a=!0;n.push({left:i,right:o,isDash:a,zeroLength:0===t[0]});for(var s=t[0],u=1;u<t.length;u++){var l=t[u];n.push({left:i=s*r,right:o=(s+=l)*r,isDash:a=!a,zeroLength:0===l})}return n},E.prototype.addRoundDash=function(t,e,r){for(var n=e/2,i=-r;i<=r;i++)for(var o=this.width*(this.nextRow+r+i),a=0,s=t[a],u=0;u<this.width;u++){u/s.right>1&&(s=t[++a]);var l=Math.abs(u-s.left),c=Math.abs(u-s.right),h=Math.min(l,c),p=void 0,f=i/r*(n+1);if(s.isDash){var d=n-Math.abs(f);p=Math.sqrt(h*h+d*d)}else p=n-Math.sqrt(h*h+f*f);this.data[o+u]=Math.max(0,Math.min(255,p+128))}},E.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}var i=t[0],o=t[t.length-1];i.isDash===o.isDash&&(i.left=o.left-this.width,o.right=i.right+this.width);for(var a=this.width*this.nextRow,s=0,u=t[s],l=0;l<this.width;l++){l/u.right>1&&(u=t[++s]);var c=Math.abs(l-u.left),h=Math.abs(l-u.right),p=Math.min(c,h);this.data[a+l]=Math.max(0,Math.min(255,(u.isDash?p:-p)+128))}},E.prototype.addDash=function(e,r){var n=r?7:0,i=2*n+1;if(this.nextRow+i>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var o=0,a=0;a<e.length;a++)o+=e[a];if(0!==o){var s=this.width/o,u=this.getDashRanges(e,this.width,s);r?this.addRoundDash(u,s,n):this.addRegularDash(u)}var l={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:o};return this.nextRow+=i,this.dirty=!0,l},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.ALPHA,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.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))};var I=function e(r,n){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=t.uniqueId();for(var i=this.workerPool.acquire(this.id),o=0;o<i.length;o++){var a=new e.Actor(i[o],n,this.id);a.name="Worker "+o,this.actors.push(a)}};function S(e,r,n){var i=function(i,o){if(i)return n(i);if(o){var a=t.pick(t.extend(o,e),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(a.vectorLayers=o.vector_layers,a.vectorLayerIds=a.vectorLayers.map((function(t){return t.id}))),a.tiles=r.canonicalizeTileset(a,e.url),n(null,a)}};return e.url?t.getJSON(r.transformRequest(r.normalizeSourceURL(e.url),t.ResourceType.Source),i):t.browser.frame((function(){return i(null,e)}))}I.prototype.broadcast=function(e,r,n){t.asyncAll(this.actors,(function(t,n){t.send(e,r,n)}),n=n||function(){})},I.prototype.getActor=function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]},I.prototype.remove=function(){this.actors.forEach((function(t){t.remove()})),this.actors=[],this.workerPool.release(this.id)},I.Actor=t.Actor;var C=function(e,r,n){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=r||0,this.maxzoom=n||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 r=Math.pow(2,e.z),n=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*r),i=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*r),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*r),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*r);return e.x>=n&&e.x<o&&e.y>=i&&e.y<a};var P=function(e){function r(r,n,i,o){if(e.call(this),this.id=r,this.dispatcher=i,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(n,["url","scheme","tileSize","promoteId"])),this._options=t.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=S(this._options,this.map._requestManager,(function(r,n){e._tileJSONRequest=null,e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):n&&(t.extend(e,n),n.bounds&&(e.tileBounds=new C(n.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(n.tiles,e.map._requestManager._customAccessToken),t.postMapLoadEvent(n.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"})))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setSourceProperty=function(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.map.style.sourceCaches[this.id].clearTiles(),this.load()},r.prototype.setTiles=function(t){var e=this;return this.setSourceProperty((function(){e._options.tiles=t})),this},r.prototype.setUrl=function(t){var e=this;return this.setSourceProperty((function(){e.url=t,e._options.url=t})),this},r.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},r.prototype.serialize=function(){return t.extend({},this._options)},r.prototype.loadTile=function(e,r){var n=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),i={request:this.map._requestManager.transformRequest(n,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,promoteId:this.promoteId};function o(n,i){return delete e.request,e.aborted?r(null):n&&404!==n.status?r(n):(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),t.cacheEntryPossiblyAdded(this.dispatcher),r(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}i.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=r:e.request=e.actor.send("reloadTile",i,o.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",i,o.bind(this)))},r.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)},r.prototype.unloadTile=function(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)},r.prototype.hasTransition=function(){return!1},r}(t.Evented),M=function(e){function r(r,n,i,o){e.call(this),this.id=r,this.dispatcher=i,this.setEventedParent(o),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"},n),t.extend(this,t.pick(n,["url","scheme","tileSize"]))}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){var e=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=S(this._options,this.map._requestManager,(function(r,n){e._tileJSONRequest=null,e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):n&&(t.extend(e,n),n.bounds&&(e.tileBounds=new C(n.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(n.tiles),t.postMapLoadEvent(n.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"})))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},r.prototype.serialize=function(){return t.extend({},this._options)},r.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},r.prototype.loadTile=function(e,r){var n=this,i=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);e.request=t.getImage(this.map._requestManager.transformRequest(i,t.ResourceType.Tile),(function(i,o){if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(i)e.state="errored",r(i);else if(o){n.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=n.map.painter.context,s=a.gl;e.texture=n.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0}):(e.texture=new t.Texture(a,o,s.RGBA,{useMipmap:!0}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),a.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax)),e.state="loaded",t.cacheEntryPossiblyAdded(n.dispatcher),r(null)}}))},r.prototype.abortTile=function(t,e){t.request&&(t.request.cancel(),delete t.request),e()},r.prototype.unloadTile=function(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()},r.prototype.hasTransition=function(){return!1},r}(t.Evented),T=function(e){function r(r,n,i,o){e.call(this,r,n,i,o),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.serialize=function(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}},r.prototype.loadTile=function(e,r){var n=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);function i(t,n){t&&(e.state="errored",r(t)),n&&(e.dem=n,e.needsHillshadePrepare=!0,e.state="loaded",r(null))}e.request=t.getImage(this.map._requestManager.transformRequest(n,t.ResourceType.Tile),function(n,o){if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(n)e.state="errored",r(n);else if(o){this.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=t.window.ImageBitmap&&o instanceof t.window.ImageBitmap&&t.offscreenCanvasSupported()?o:t.browser.getImageData(o,1),s={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:a,encoding:this.encoding};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",s,i.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)},r.prototype._getNeighboringTiles=function(e){var r=e.canonical,n=Math.pow(2,r.z),i=(r.x-1+n)%n,o=0===r.x?e.wrap-1:e.wrap,a=(r.x+1+n)%n,s=r.x+1===n?e.wrap+1:e.wrap,u={};return u[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(u[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y-1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<n&&(u[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y+1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y+1).key]={backfilled:!1}),u},r.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.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})},r}(M),L=function(e){function r(r,n,i,o){e.call(this),this.id=r,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=i.getActor(),this.setEventedParent(o),this._data=n.data,this._options=t.extend({},n),this._collectResourceTiming=n.collectResourceTiming,this._resourceTiming=[],void 0!==n.maxzoom&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;var a=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(void 0!==n.buffer?n.buffer:128)*a,tolerance:(void 0!==n.tolerance?n.tolerance:.375)*a,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:void 0!==n.clusterMaxZoom?Math.min(n.clusterMaxZoom,this.maxzoom-1):this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:t.EXTENT,radius:(n.clusterRadius||50)*a,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){var e=this;this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(r){if(r)e.fire(new t.ErrorEvent(r));else{var n={dataType:"source",sourceDataType:"metadata"};e._collectResourceTiming&&e._resourceTiming&&e._resourceTiming.length>0&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}}))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)r.fire(new t.ErrorEvent(e));else{var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}})),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},r.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},r.prototype.getClusterLeaves=function(t,e,r,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},n),this},r.prototype._updateWorkerData=function(e){var r=this;this._loaded=!1;var n=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(n.request=this.map._requestManager.transformRequest(t.browser.resolveURL(i),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(i),this.actor.send(this.type+".loadData",n,(function(t,i){r._removed||i&&i.abandoned||(r._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[r.id]&&(r._resourceTiming=i.resourceTiming[r.id].slice(0)),r.actor.send(r.type+".coalesce",{source:n.source},null),e(t))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.loadTile=function(e,r){var n=this,i=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(i,{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,promoteId:this.promoteId},(function(t,o){return delete e.request,e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(o,n.map.painter,"reloadTile"===i),r(null))}))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},r.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),A=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),k=function(e){function r(t,r,n,i){e.call(this),this.id=t,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(e,r){var n=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(i,o){n._loaded=!0,i?n.fire(new t.ErrorEvent(i)):o&&(n.image=o,e&&(n.coordinates=e),r&&r(),n._finishLoading())}))},r.prototype.loaded=function(){return this._loaded},r.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},r.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setCoordinates=function(e){var r=this;this.coordinates=e;var n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var r=1/0,n=1/0,i=-1/0,o=-1/0,a=0,s=e;a<s.length;a+=1){var u=s[a];r=Math.min(r,u.x),n=Math.min(n,u.y),i=Math.max(i,u.x),o=Math.max(o,u.y)}var l=Math.max(i-r,o-n),c=Math.max(0,Math.floor(-Math.log(l)/Math.LN2)),h=Math.pow(2,c);return new t.CanonicalTileID(c,Math.floor((r+i)/2*h),Math.floor((n+o)/2*h))}(n),this.minzoom=this.maxzoom=this.tileID.z;var i=n.map((function(t){return r.tileID.getTilePoint(t)._round()}));return this._boundsArray=new t.StructArrayLayout4i8,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(i[2].x,i[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},r.prototype.prepare=function(){if(0!==Object.keys(this.tiles).length&&this.image){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,A.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(e,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[n];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.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))},r.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return!1},r}(t.Evented),N=function(e){function r(t,r,n,i){e.call(this,t,r,n,i),this.roundZoom=!0,this.type="video",this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){var e=this;this._loaded=!1;var r=this.options;this.urls=[];for(var n=0,i=r.urls;n<i.length;n+=1)this.urls.push(this.map._requestManager.transformRequest(i[n],t.ResourceType.Source).url);t.getVideo(this.urls,(function(r,n){e._loaded=!0,r?e.fire(new t.ErrorEvent(r)):n&&(e.video=n,e.video.loop=!0,e.video.addEventListener("playing",(function(){e.map.triggerRepaint()})),e.map&&e.video.play(),e._finishLoading())}))},r.prototype.pause=function(){this.video&&this.video.pause()},r.prototype.play=function(){this.video&&this.video.play()},r.prototype.seek=function(e){if(this.video){var r=this.video.seekable;e<r.start(0)||e>r.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+r.start(0)+" and "+r.end(0)+"-second mark."))):this.video.currentTime=e}},r.prototype.getVideo=function(){return this.video},r.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},r.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,A.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[n];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this.video&&!this.video.paused},r}(k),D=function(e){function r(r,n,i,o){e.call(this,r,n,i,o),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.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."+r,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.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())},r.prototype.getCanvas=function(){return this.canvas},r.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},r.prototype.onRemove=function(){this.pause()},r.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 r=this.map.painter.context,n=r.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,A.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(r,this.canvas,n.RGBA,{premultiply:!0}),this.tiles){var o=this.tiles[i];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this._playing},r.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];t<e.length;t+=1){var r=e[t];if(isNaN(r)||r<=0)return!0}return!1},r}(k),R={vector:P,raster:M,"raster-dem":T,geojson:L,video:N,image:k,canvas:D};function O(e,r){var n=t.identity([]);return t.translate(n,n,[1,1,0]),t.scale(n,n,[.5*e.width,.5*e.height,1]),t.multiply(n,n,e.calculatePosMatrix(r.toUnwrapped()))}function z(t,e,r,n,i,o){var a=function(t,e,r){if(t)for(var n=0,i=t;n<i.length;n+=1){var o=e[i[n]];if(o&&o.source===r&&"fill-extrusion"===o.type)return!0}else for(var a in e){var s=e[a];if(s.source===r&&"fill-extrusion"===s.type)return!0}return!1}(i&&i.layers,e,t.id),s=o.maxPitchScaleFactor(),u=t.tilesIn(n,s,a);u.sort(F);for(var l=[],c=0,h=u;c<h.length;c+=1){var p=h[c];l.push({wrappedTileID:p.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(e,r,t._state,p.queryGeometry,p.cameraQueryGeometry,p.scale,i,o,s,O(t.transform,p.tileID))})}var f=function(t){for(var e={},r={},n=0,i=t;n<i.length;n+=1){var o=i[n],a=o.queryResults,s=o.wrappedTileID,u=r[s]=r[s]||{};for(var l in a)for(var c=a[l],h=u[l]=u[l]||{},p=e[l]=e[l]||[],f=0,d=c;f<d.length;f+=1){var g=d[f];h[g.featureIndex]||(h[g.featureIndex]=!0,p.push(g))}}return e}(l);for(var d in f)f[d].forEach((function(e){var r=e.feature,n=t.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}));return f}function F(t,e){var r=t.tileID,n=e.tileID;return r.overscaledZ-n.overscaledZ||r.canonical.y-n.canonical.y||r.wrap-n.wrap||r.canonical.x-n.canonical.x}var B=function(t,e){this.max=t,this.onRemove=e,this.reset()};B.prototype.reset=function(){for(var t in this.data)for(var e=0,r=this.data[t];e<r.length;e+=1){var n=r[e];n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value)}return this.data={},this.order=[],this},B.prototype.add=function(t,e,r){var n=this,i=t.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);var o={value:e,timeout:void 0};if(void 0!==r&&(o.timeout=setTimeout((function(){n.remove(t,o)}),r)),this.data[i].push(o),this.order.push(i),this.order.length>this.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},B.prototype.has=function(t){return t.wrapped().key in this.data},B.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},B.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},B.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},B.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},B.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this},B.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},B.prototype.filter=function(t){var e=[];for(var r in this.data)for(var n=0,i=this.data[r];n<i.length;n+=1){var o=i[n];t(o.value)||e.push(o)}for(var a=0,s=e;a<s.length;a+=1){var u=s[a];this.remove(u.value.tileID,u)}};var U=function(t,e,r){this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};U.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},U.prototype.updateData=function(t){var e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},U.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var j={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},V=function(t,e,r,n){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;var i=t.gl;this.buffer=i.createBuffer(),t.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};V.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},V.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},V.prototype.enableAttributes=function(t,e){for(var r=0;r<this.attributes.length;r++){var n=e.attributes[this.attributes[r].name];void 0!==n&&t.enableVertexAttribArray(n)}},V.prototype.setVertexAttribPointers=function(t,e,r){for(var n=0;n<this.attributes.length;n++){var i=this.attributes[n],o=e.attributes[i.name];void 0!==o&&t.vertexAttribPointer(o,i.components,t[j[i.type]],!1,this.itemSize,i.offset+this.itemSize*(r||0))}},V.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var q=function(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};q.prototype.get=function(){return this.current},q.prototype.set=function(t){},q.prototype.getDefault=function(){return this.default},q.prototype.setDefault=function(){this.set(this.default)};var G=function(e){function r(){e.apply(this,arguments)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getDefault=function(){return t.Color.transparent},r.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)},r}(q),X=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),Z=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),Y=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),W=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),H=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),J=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),K=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),$=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),Q=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),tt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),et=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),rt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),nt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),it=function(e){function r(){e.apply(this,arguments)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getDefault=function(){return t.Color.transparent},r.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)},r}(q),ot=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),at=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),st=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),ut=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),lt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),ct=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),ht=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),pt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),ft=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),dt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),gt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),yt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),mt=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)).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}(q),vt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),_t=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),xt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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}(q),bt=function(t){function e(e,r){t.call(this,e),this.context=e,this.parent=r}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getDefault=function(){return null},e}(q),wt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.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)).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),It=function(t,e,r,n){this.context=t,this.width=e,this.height=r;var i=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new wt(t,i),n&&(this.depthAttachment=new Et(t,i))};It.prototype.destroy=function(){var t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){var r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}t.deleteFramebuffer(this.framebuffer)};var St=function(t,e,r){this.func=t,this.mask=e,this.range=r};St.ReadOnly=!1,St.ReadWrite=!0,St.disabled=new St(519,St.ReadOnly,[0,1]);var Ct=function(t,e,r,n,i,o){this.test=t,this.ref=e,this.mask=r,this.fail=n,this.depthFail=i,this.pass=o};Ct.disabled=new Ct({func:519,mask:0},0,0,7680,7680,7680);var Pt=function(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r};Pt.disabled=new Pt(Pt.Replace=[1,0],t.Color.transparent,[!1,!1,!1,!1]),Pt.unblended=new Pt(Pt.Replace,t.Color.transparent,[!0,!0,!0,!0]),Pt.alphaBlended=new Pt([1,771],t.Color.transparent,[!0,!0,!0,!0]);var Mt=function(t,e,r){this.enable=t,this.mode=e,this.frontFace=r};Mt.disabled=new Mt(!1,1029,2305),Mt.backCCW=new Mt(!0,1029,2305);var Tt=function(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new G(this),this.clearDepth=new X(this),this.clearStencil=new Z(this),this.colorMask=new Y(this),this.depthMask=new W(this),this.stencilMask=new H(this),this.stencilFunc=new J(this),this.stencilOp=new K(this),this.stencilTest=new $(this),this.depthRange=new Q(this),this.depthTest=new tt(this),this.depthFunc=new et(this),this.blend=new rt(this),this.blendFunc=new nt(this),this.blendColor=new it(this),this.blendEquation=new ot(this),this.cullFace=new at(this),this.cullFaceSide=new st(this),this.frontFace=new ut(this),this.program=new lt(this),this.activeTexture=new ct(this),this.viewport=new ht(this),this.bindFramebuffer=new pt(this),this.bindRenderbuffer=new ft(this),this.bindTexture=new dt(this),this.bindVertexBuffer=new gt(this),this.bindElementBuffer=new yt(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new mt(this),this.pixelStoreUnpack=new vt(this),this.pixelStoreUnpackPremultiplyAlpha=new _t(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.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)};Tt.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()},Tt.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},Tt.prototype.createIndexBuffer=function(t,e){return new U(this,t,e)},Tt.prototype.createVertexBuffer=function(t,e,r){return new V(this,t,e,r)},Tt.prototype.createRenderbuffer=function(t,e,r){var n=this.gl,i=n.createRenderbuffer();return this.bindRenderbuffer.set(i),n.renderbufferStorage(n.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),i},Tt.prototype.createFramebuffer=function(t,e,r){return new It(this,t,e,r)},Tt.prototype.clear=function(t){var e=t.color,r=t.depth,n=this.gl,i=0;e&&(i|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(i|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),n.clear(i)},Tt.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))},Tt.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)},Tt.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)},Tt.prototype.setColorMode=function(e){t.deepEqual(e.blendFunction,Pt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)},Tt.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var Lt=function(e){function r(r,n,i){var o=this;e.call(this),this.id=r,this.dispatcher=i,this.on("data",(function(t){"source"===t.dataType&&"metadata"===t.sourceDataType&&(o._sourceLoaded=!0),o._sourceLoaded&&!o._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(o.reload(),o.transform&&o.update(o.transform))})),this.on("error",(function(){o._sourceErrored=!0})),this._source=function(e,r,n,i){var o=new R[r.type](e,r,n,i);if(o.id!==e)throw new Error("Expected Source id to be "+e+" instead of "+o.id);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o}(r,n,i,this),this._tiles={},this._cache=new B(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new t.SourceFeatureState}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.onAdd=function(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)},r.prototype.onRemove=function(t){this._source&&this._source.onRemove&&this._source.onRemove(t)},r.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},r.prototype.getSource=function(){return this._source},r.prototype.pause=function(){this._paused=!0},r.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)}},r.prototype._loadTile=function(t,e){return this._source.loadTile(t,e)},r.prototype._unloadTile=function(t){if(this._source.unloadTile)return this._source.unloadTile(t,(function(){}))},r.prototype._abortTile=function(t){if(this._source.abortTile)return this._source.abortTile(t,(function(){}))},r.prototype.serialize=function(){return this._source.serialize()},r.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 r=this._tiles[e];r.upload(t),r.prepare(this.map.style.imageManager)}},r.prototype.getIds=function(){return t.values(this._tiles).map((function(t){return t.tileID})).sort(At).map((function(t){return t.key}))},r.prototype.getRenderableIds=function(e){var r=this,n=[];for(var i in this._tiles)this._isIdRenderable(i,e)&&n.push(this._tiles[i]);return e?n.sort((function(e,n){var i=e.tileID,o=n.tileID,a=new t.Point(i.canonical.x,i.canonical.y)._rotate(r.transform.angle),s=new t.Point(o.canonical.x,o.canonical.y)._rotate(r.transform.angle);return i.overscaledZ-o.overscaledZ||s.y-a.y||s.x-a.x})).map((function(t){return t.tileID.key})):n.map((function(t){return t.tileID})).sort(At).map((function(t){return t.key}))},r.prototype.hasRenderableParent=function(t){var e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)},r.prototype._isIdRenderable=function(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())},r.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")},r.prototype._reloadTile=function(t,e){var r=this._tiles[t];r&&("loading"!==r.state&&(r.state=e),this._loadTile(r,this._tileLoaded.bind(this,r,t,e)))},r.prototype._tileLoaded=function(e,r,n,i){if(i)return e.state="errored",void(404!==i.status?this._source.fire(new t.ErrorEvent(i,{tile:e})):this.update(this.transform));e.timeAdded=t.browser.now(),"expired"===n&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,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}))},r.prototype._backfillDEM=function(t){for(var e=this.getRenderableIds(),r=0;r<e.length;r++){var n=e[r];if(t.neighboringTiles&&t.neighboringTiles[n]){var i=this.getTileByID(n);o(t,i),o(i,t)}}function o(t,e){t.needsHillshadePrepare=!0;var r=e.tileID.canonical.x-t.tileID.canonical.x,n=e.tileID.canonical.y-t.tileID.canonical.y,i=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===r&&0===n||Math.abs(n)>1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype._retainLoadedChildren=function(t,e,r,n){for(var i in this._tiles){var o=this._tiles[i];if(!(n[i]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>r)){for(var a=o.tileID;o&&o.tileID.overscaledZ>e+1;){var s=o.tileID.scaledTo(o.tileID.overscaledZ-1);(o=this._tiles[s.key])&&o.hasData()&&(a=s)}for(var u=a;u.overscaledZ>e;)if(t[(u=u.scaledTo(u.overscaledZ-1)).key]){n[a.key]=a;break}}}},r.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(var n=t.overscaledZ-1;n>=e;n--){var i=t.scaledTo(n),o=this._getLoadedTile(i);if(o)return o}},r.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},r.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(e*r*5),i="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(i)},r.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var r={};for(var n in this._tiles){var i=this._tiles[n];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),r[i.tileID.key]=i}for(var o in this._tiles=r,this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(var a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=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)})):(i=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&&(i=i.filter((function(t){return n._source.hasTile(t)})))):i=[];var o=e.coveringZoomLevel(this._source),a=Math.max(o-r.maxOverzooming,this._source.minzoom),s=Math.max(o+r.maxUnderzooming,this._source.minzoom),u=this._updateRetainedTiles(i,o);if(kt(this._source.type)){for(var l={},c={},h=0,p=Object.keys(u);h<p.length;h+=1){var f=p[h],d=u[f],g=this._tiles[f];if(g&&!(g.fadeEndTime&&g.fadeEndTime<=t.browser.now())){var y=this.findLoadedParent(d,a);y&&(this._addTile(y.tileID),l[y.tileID.key]=y.tileID),c[f]=d}}for(var m in this._retainLoadedChildren(c,o,s,u),l)u[m]||(this._coveredTiles[m]=!0,u[m]=l[m])}for(var v in u)this._tiles[v].clearFadeHold();for(var _=0,x=t.keysDifference(this._tiles,u);_<x.length;_+=1){var b=x[_],w=this._tiles[b];w.hasSymbolBuckets&&!w.holdingForFade()?w.setHoldDuration(this.map._fadeDuration):w.hasSymbolBuckets&&!w.symbolFadeFinished()||this._removeTile(b)}this._updateLoadedParentTileCache()}},r.prototype.releaseSymbolFadeTiles=function(){for(var t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)},r.prototype._updateRetainedTiles=function(t,e){for(var n={},i={},o=Math.max(e-r.maxOverzooming,this._source.minzoom),a=Math.max(e+r.maxUnderzooming,this._source.minzoom),s={},u=0,l=t;u<l.length;u+=1){var c=l[u],h=this._addTile(c);n[c.key]=c,h.hasData()||e<this._source.maxzoom&&(s[c.key]=c)}this._retainLoadedChildren(s,e,a,n);for(var p=0,f=t;p<f.length;p+=1){var d=f[p],g=this._tiles[d.key];if(!g.hasData()){if(e+1>this._source.maxzoom){var y=d.children(this._source.maxzoom)[0],m=this.getTile(y);if(m&&m.hasData()){n[y.key]=y;continue}}else{var v=d.children(this._source.maxzoom);if(n[v[0].key]&&n[v[1].key]&&n[v[2].key]&&n[v[3].key])continue}for(var _=g.wasRequested(),x=d.overscaledZ-1;x>=o;--x){var b=d.scaledTo(x);if(i[b.key])break;if(i[b.key]=!0,!(g=this.getTile(b))&&_&&(g=this._addTile(b)),g&&(n[b.key]=b,_=g.wasRequested(),g.hasData()))break}}}return n},r.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],r=void 0,n=this._tiles[t].tileID;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}e.push(n.key);var i=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(i))break;n=i}for(var o=0,a=e;o<a.length;o+=1)this._loadedParentTiles[a[o]]=r}},r.prototype._addTile=function(e){var r=this._tiles[e.key];if(r)return r;(r=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));var n=Boolean(r);return n||(r=new t.Tile(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r?(r.uses++,this._tiles[e.key]=r,n||this._source.fire(new t.Event("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null},r.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout((function(){r._reloadTile(t,"expired"),delete r._timers[t]}),n))},r.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))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r,n){var i=this,o=[],a=this.transform;if(!a)return o;for(var s=n?a.getCameraQueryGeometry(e):e,u=e.map((function(t){return a.pointCoordinate(t)})),l=s.map((function(t){return a.pointCoordinate(t)})),c=this.getIds(),h=1/0,p=1/0,f=-1/0,d=-1/0,g=0,y=l;g<y.length;g+=1){var m=y[g];h=Math.min(h,m.x),p=Math.min(p,m.y),f=Math.max(f,m.x),d=Math.max(d,m.y)}for(var v=function(e){var n=i._tiles[c[e]];if(!n.holdingForFade()){var s=n.tileID,g=Math.pow(2,a.zoom-n.tileID.overscaledZ),y=r*n.queryPadding*t.EXTENT/n.tileSize/g,m=[s.getTilePoint(new t.MercatorCoordinate(h,p)),s.getTilePoint(new t.MercatorCoordinate(f,d))];if(m[0].x-y<t.EXTENT&&m[0].y-y<t.EXTENT&&m[1].x+y>=0&&m[1].y+y>=0){var v=u.map((function(t){return s.getTilePoint(t)})),_=l.map((function(t){return s.getTilePoint(t)}));o.push({tile:n,tileID:s,queryGeometry:v,cameraQueryGeometry:_,scale:g})}}},_=0;_<c.length;_++)v(_);return o},r.prototype.getVisibleCoordinates=function(t){for(var e=this,r=this.getRenderableIds(t).map((function(t){return e._tiles[t].tileID})),n=0,i=r;n<i.length;n+=1){var o=i[n];o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped())}return r},r.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(kt(this._source.type))for(var e in this._tiles){var r=this._tiles[e];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=t.browser.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)},r.prototype.removeFeatureState=function(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)},r.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},r.prototype.setDependencies=function(t,e,r){var n=this._tiles[t];n&&n.setDependencies(e,r)},r.prototype.reloadTilesForDependencies=function(t,e){for(var r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter((function(r){return!r.hasDependency(t,e)}))},r}(t.Evented);function At(t,e){var r=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function kt(t){return"raster"===t||"image"===t||"video"===t}function Nt(){return new t.window.Worker(Hi.workerUrl)}Lt.maxOverzooming=10,Lt.maxUnderzooming=3;var Dt="mapboxgl_preloaded_worker_pool",Rt=function(){this.active={}};Rt.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length<Rt.workerCount;)this.workers.push(new Nt);return this.active[t]=!0,this.workers.slice()},Rt.prototype.release=function(t){delete this.active[t],0===this.numActive()&&(this.workers.forEach((function(t){t.terminate()})),this.workers=null)},Rt.prototype.isPreloaded=function(){return!!this.active[Dt]},Rt.prototype.numActive=function(){return Object.keys(this.active).length};var Ot,zt=Math.floor(t.browser.hardwareConcurrency/2);function Ft(){return Ot||(Ot=new Rt),Ot}function Bt(e,r){var n={};for(var i in e)"ref"!==i&&(n[i]=e[i]);return t.refProperties.forEach((function(t){t in r&&(n[t]=r[t])})),n}function Ut(t){t=t.slice();for(var e=Object.create(null),r=0;r<t.length;r++)e[t[r].id]=t[r];for(var n=0;n<t.length;n++)"ref"in t[n]&&(t[n]=Bt(t[n],e[t[n].ref]));return t}Rt.workerCount=Math.max(Math.min(zt,6),1);var jt={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 Vt(t,e,r){r.push({command:jt.addSource,args:[t,e[t]]})}function qt(t,e,r){e.push({command:jt.removeSource,args:[t]}),r[t]=!0}function Gt(t,e,r,n){qt(t,r,n),Vt(t,e,r)}function Xt(e,r,n){var i;for(i in e[n])if(e[n].hasOwnProperty(i)&&"data"!==i&&!t.deepEqual(e[n][i],r[n][i]))return!1;for(i in r[n])if(r[n].hasOwnProperty(i)&&"data"!==i&&!t.deepEqual(e[n][i],r[n][i]))return!1;return!0}function Zt(e,r,n,i,o,a){var s;for(s in r=r||{},e=e||{})e.hasOwnProperty(s)&&(t.deepEqual(e[s],r[s])||n.push({command:a,args:[i,s,r[s],o]}));for(s in r)r.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(t.deepEqual(e[s],r[s])||n.push({command:a,args:[i,s,r[s],o]}))}function Yt(t){return t.id}function Wt(t,e){return t[e.id]=e,t}var Ht=function(t,e){this.reset(t,e)};Ht.prototype.reset=function(t,e){this.points=t||[],this._distances=[0];for(var r=1;r<this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,.5*this.length),this.paddedLength=this.length-2*this.padding},Ht.prototype.lerp=function(e){if(1===this.points.length)return this.points[0];e=t.clamp(e,0,1);for(var r=1,n=this._distances[r],i=e*this.paddedLength+this.padding;n<i&&r<this._distances.length;)n=this._distances[++r];var o=r-1,a=this._distances[o],s=n-a,u=s>0?(i-a)/s:0;return this.points[o].mult(1-u).add(this.points[r].mult(u))};var Jt=function(t,e,r){var n=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var o=0;o<this.xCellCount*this.yCellCount;o++)n.push([]),i.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,r,n,i,o){var a=t.create();return r?(t.scale(a,a,[1/o,1/o,1]),n||t.rotateZ(a,a,i.angle)):t.multiply(a,i.labelPlaneMatrix,e),a}function $t(e,r,n,i,o){if(r){var a=t.clone(e);return t.scale(a,a,[o,o,1]),n||t.rotateZ(a,a,-i.angle),a}return i.glCoordMatrix}function Qt(e,r){var n=[e.x,e.y,0,1];ce(n,n,r);var i=n[3];return{point:new t.Point(n[0]/i,n[1]/i),signedDistanceFromCamera:i}}function te(t,e){return.5+t/e*.5}function ee(t,e){var r=t[0]/t[3],n=t[1]/t[3];return r>=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function re(e,r,n,i,o,a,s,u){var l=i?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(l,n.transform.zoom),h=[256/n.width*2+1,256/n.height*2+1],p=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();for(var f=e.lineVertexArray,d=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=n.transform.width/n.transform.height,y=!1,m=0;m<d.length;m++){var v=d.get(m);if(v.hidden||v.writingMode===t.WritingMode.vertical&&!y)le(v.numGlyphs,p);else{y=!1;var _=[v.anchorX,v.anchorY,0,1];if(t.transformMat4(_,_,r),ee(_,h)){var x=te(n.transform.cameraToCenterDistance,_[3]),b=t.evaluateSizeForFeature(l,c,v),w=s?b/x:b*x,E=new t.Point(v.anchorX,v.anchorY),I=Qt(E,o).point,S={},C=oe(v,w,!1,u,r,o,a,e.glyphOffsetArray,f,p,I,E,S,g);y=C.useVertical,(C.notEnoughRoom||y||C.needsFlipping&&oe(v,w,!0,u,r,o,a,e.glyphOffsetArray,f,p,I,E,S,g).notEnoughRoom)&&le(v.numGlyphs,p)}else le(v.numGlyphs,p)}}i?e.text.dynamicLayoutVertexBuffer.updateData(p):e.icon.dynamicLayoutVertexBuffer.updateData(p)}function ne(t,e,r,n,i,o,a,s,u,l,c){var h=s.glyphStartIndex+s.numGlyphs,p=s.lineStartIndex,f=s.lineStartIndex+s.lineLength,d=e.getoffsetX(s.glyphStartIndex),g=e.getoffsetX(h-1),y=se(t*d,r,n,i,o,a,s.segment,p,f,u,l,c);if(!y)return null;var m=se(t*g,r,n,i,o,a,s.segment,p,f,u,l,c);return m?{first:y,last:m}:null}function ie(e,r,n,i){return e===t.WritingMode.horizontal&&Math.abs(n.y-r.y)>Math.abs(n.x-r.x)*i?{useVertical:!0}:(e===t.WritingMode.vertical?r.y<n.y:r.x>n.x)?{needsFlipping:!0}:null}function oe(e,r,n,i,o,a,s,u,l,c,h,p,f,d){var g,y=r/24,m=e.lineOffsetX*y,v=e.lineOffsetY*y;if(e.numGlyphs>1){var _=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=ne(y,u,m,v,n,h,p,e,l,a,f);if(!w)return{notEnoughRoom:!0};var E=Qt(w.first.point,s).point,I=Qt(w.last.point,s).point;if(i&&!n){var S=ie(e.writingMode,E,I,d);if(S)return S}g=[w.first];for(var C=e.glyphStartIndex+1;C<_-1;C++)g.push(se(y*u.getoffsetX(C),m,v,n,h,p,e.segment,x,b,l,a,f));g.push(w.last)}else{if(i&&!n){var P=Qt(p,o).point,M=e.lineStartIndex+e.segment+1,T=new t.Point(l.getx(M),l.gety(M)),L=Qt(T,o),A=L.signedDistanceFromCamera>0?L.point:ae(p,T,P,1,o),k=ie(e.writingMode,P,A,d);if(k)return k}var N=se(y*u.getoffsetX(e.glyphStartIndex),m,v,n,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,l,a,f);if(!N)return{notEnoughRoom:!0};g=[N]}for(var D=0,R=g;D<R.length;D+=1){var O=R[D];t.addDynamicAttributes(c,O.point,O.angle)}return{}}function ae(t,e,r,n,i){var o=Qt(t.add(t.sub(e)._unit()),i).point,a=r.sub(o);return r.add(a._mult(n/a.mag()))}function se(e,r,n,i,o,a,s,u,l,c,h,p){var f=i?e-r:e+r,d=f>0?1:-1,g=0;i&&(d*=-1,g=Math.PI),d<0&&(g+=Math.PI);for(var y=d>0?u+s:u+s+1,m=o,v=o,_=0,x=0,b=Math.abs(f),w=[];_+x<=b;){if((y+=d)<u||y>=l)return null;if(v=m,w.push(m),void 0===(m=p[y])){var E=new t.Point(c.getx(y),c.gety(y)),I=Qt(E,h);if(I.signedDistanceFromCamera>0)m=p[y]=I.point;else{var S=y-d;m=ae(0===_?a:new t.Point(c.getx(S),c.gety(S)),E,v,b-_+1,h)}}_+=x,x=v.dist(m)}var C=(b-_)/x,P=m.sub(v),M=P.mult(C)._add(v);M._add(P._unit()._perp()._mult(n*d));var T=g+Math.atan2(m.y-v.y,m.x-v.x);return w.push(M),{point:M,angle:T,path:w}}Jt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Jt.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},Jt.prototype.insertCircle=function(t,e,r,n){this._forEachCell(e-n,r-n,e+n,r+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(n)},Jt.prototype._insertBoxCell=function(t,e,r,n,i,o){this.boxCells[i].push(o)},Jt.prototype._insertCircleCell=function(t,e,r,n,i,o){this.circleCells[i].push(o)},Jt.prototype._query=function(t,e,r,n,i,o){if(r<0||t>this.width||n<0||e>this.height)return!i&&[];var a=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(i)return!0;for(var s=0;s<this.boxKeys.length;s++)a.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 u=0;u<this.circleKeys.length;u++){var l=this.circles[3*u],c=this.circles[3*u+1],h=this.circles[3*u+2];a.push({key:this.circleKeys[u],x1:l-h,y1:c-h,x2:l+h,y2:c+h})}return o?a.filter(o):a}return this._forEachCell(t,e,r,n,this._queryCell,a,{hitTest:i,seenUids:{box:{},circle:{}}},o),i?a.length>0:a},Jt.prototype._queryCircle=function(t,e,r,n,i){var o=t-r,a=t+r,s=e-r,u=e+r;if(a<0||o>this.width||u<0||s>this.height)return!n&&[];var l=[];return this._forEachCell(o,s,a,u,this._queryCellCircle,l,{hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},i),n?l.length>0:l},Jt.prototype.query=function(t,e,r,n,i){return this._query(t,e,r,n,!1,i)},Jt.prototype.hitTest=function(t,e,r,n,i){return this._query(t,e,r,n,!0,i)},Jt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},Jt.prototype._queryCell=function(t,e,r,n,i,o,a,s){var u=a.seenUids,l=this.boxCells[i];if(null!==l)for(var c=this.bboxes,h=0,p=l;h<p.length;h+=1){var f=p[h];if(!u.box[f]){u.box[f]=!0;var d=4*f;if(t<=c[d+2]&&e<=c[d+3]&&r>=c[d+0]&&n>=c[d+1]&&(!s||s(this.boxKeys[f]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[f],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}var g=this.circleCells[i];if(null!==g)for(var y=this.circles,m=0,v=g;m<v.length;m+=1){var _=v[m];if(!u.circle[_]){u.circle[_]=!0;var x=3*_;if(this._circleAndRectCollide(y[x],y[x+1],y[x+2],t,e,r,n)&&(!s||s(this.circleKeys[_]))){if(a.hitTest)return o.push(!0),!0;var b=y[x],w=y[x+1],E=y[x+2];o.push({key:this.circleKeys[_],x1:b-E,y1:w-E,x2:b+E,y2:w+E})}}}},Jt.prototype._queryCellCircle=function(t,e,r,n,i,o,a,s){var u=a.circle,l=a.seenUids,c=this.boxCells[i];if(null!==c)for(var h=this.bboxes,p=0,f=c;p<f.length;p+=1){var d=f[p];if(!l.box[d]){l.box[d]=!0;var g=4*d;if(this._circleAndRectCollide(u.x,u.y,u.radius,h[g+0],h[g+1],h[g+2],h[g+3])&&(!s||s(this.boxKeys[d])))return o.push(!0),!0}}var y=this.circleCells[i];if(null!==y)for(var m=this.circles,v=0,_=y;v<_.length;v+=1){var x=_[v];if(!l.circle[x]){l.circle[x]=!0;var b=3*x;if(this._circlesCollide(m[b],m[b+1],m[b+2],u.x,u.y,u.radius)&&(!s||s(this.circleKeys[x])))return o.push(!0),!0}}},Jt.prototype._forEachCell=function(t,e,r,n,i,o,a,s){for(var u=this._convertToXCellCoord(t),l=this._convertToYCellCoord(e),c=this._convertToXCellCoord(r),h=this._convertToYCellCoord(n),p=u;p<=c;p++)for(var f=l;f<=h;f++)if(i.call(this,t,e,r,n,this.xCellCount*f+p,o,a,s))return},Jt.prototype._convertToXCellCoord=function(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))},Jt.prototype._convertToYCellCoord=function(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))},Jt.prototype._circlesCollide=function(t,e,r,n,i,o){var a=n-t,s=i-e,u=r+o;return u*u>a*a+s*s},Jt.prototype._circleAndRectCollide=function(t,e,r,n,i,o,a){var s=(o-n)/2,u=Math.abs(t-(n+s));if(u>s+r)return!1;var l=(a-i)/2,c=Math.abs(e-(i+l));if(c>l+r)return!1;if(u<=s||c<=l)return!0;var h=u-s,p=c-l;return h*h+p*p<=r*r};var ue=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function le(t,e){for(var r=0;r<t;r++){var n=e.length;e.resize(n+4),e.float32.set(ue,3*n)}}function ce(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t[3]=r[3]*n+r[7]*i+r[15],t}var he=function(t,e,r){void 0===e&&(e=new Jt(t.width+200,t.height+200,25)),void 0===r&&(r=new Jt(t.width+200,t.height+200,25)),this.transform=t,this.grid=e,this.ignoredGrid=r,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 pe(e,r,n){return r*(t.EXTENT/(e.tileSize*Math.pow(2,n-e.tileID.overscaledZ)))}he.prototype.placeCollisionBox=function(t,e,r,n,i){var o=this.projectAndGetPerspectiveRatio(n,t.anchorPointX,t.anchorPointY),a=r*o.perspectiveRatio,s=t.x1*a+o.point.x,u=t.y1*a+o.point.y,l=t.x2*a+o.point.x,c=t.y2*a+o.point.y;return!this.isInsideGrid(s,u,l,c)||!e&&this.grid.hitTest(s,u,l,c,i)?{box:[],offscreen:!1}:{box:[s,u,l,c],offscreen:this.isOffscreen(s,u,l,c)}},he.prototype.placeCollisionCircles=function(e,r,n,i,o,a,s,u,l,c,h,p,f){var d=[],g=new t.Point(r.anchorX,r.anchorY),y=Qt(g,a),m=te(this.transform.cameraToCenterDistance,y.signedDistanceFromCamera),v=(c?o/m:o*m)/t.ONE_EM,_=Qt(g,s).point,x=ne(v,i,r.lineOffsetX*v,r.lineOffsetY*v,!1,_,g,r,n,s,{}),b=!1,w=!1,E=!0;if(x){for(var I=.5*p*m+f,S=new t.Point(-100,-100),C=new t.Point(this.screenRightBoundary,this.screenBottomBoundary),P=new Ht,M=x.first,T=x.last,L=[],A=M.path.length-1;A>=1;A--)L.push(M.path[A]);for(var k=1;k<T.path.length;k++)L.push(T.path[k]);var N=2.5*I;if(u){var D=L.map((function(t){return Qt(t,u)}));L=D.some((function(t){return t.signedDistanceFromCamera<=0}))?[]:D.map((function(t){return t.point}))}var R=[];if(L.length>0){for(var O=L[0].clone(),z=L[0].clone(),F=1;F<L.length;F++)O.x=Math.min(O.x,L[F].x),O.y=Math.min(O.y,L[F].y),z.x=Math.max(z.x,L[F].x),z.y=Math.max(z.y,L[F].y);R=O.x>=S.x&&z.x<=C.x&&O.y>=S.y&&z.y<=C.y?[L]:z.x<S.x||O.x>C.x||z.y<S.y||O.y>C.y?[]:t.clipLine([L],S.x,S.y,C.x,C.y)}for(var B=0,U=R;B<U.length;B+=1){var j;P.reset(U[B],.25*I),j=P.length<=.5*I?1:Math.ceil(P.paddedLength/N)+1;for(var V=0;V<j;V++){var q=V/Math.max(j-1,1),G=P.lerp(q),X=G.x+100,Z=G.y+100;d.push(X,Z,I,0);var Y=X-I,W=Z-I,H=X+I,J=Z+I;if(E=E&&this.isOffscreen(Y,W,H,J),w=w||this.isInsideGrid(Y,W,H,J),!e&&this.grid.hitTestCircle(X,Z,I,h)&&(b=!0,!l))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!l&&b||!w?[]:d,offscreen:E,collisionDetected:b}},he.prototype.queryRenderedSymbols=function(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};for(var r=[],n=1/0,i=1/0,o=-1/0,a=-1/0,s=0,u=e;s<u.length;s+=1){var l=u[s],c=new t.Point(l.x+100,l.y+100);n=Math.min(n,c.x),i=Math.min(i,c.y),o=Math.max(o,c.x),a=Math.max(a,c.y),r.push(c)}for(var h={},p={},f=0,d=this.grid.query(n,i,o,a).concat(this.ignoredGrid.query(n,i,o,a));f<d.length;f+=1){var g=d[f],y=g.key;if(void 0===h[y.bucketInstanceId]&&(h[y.bucketInstanceId]={}),!h[y.bucketInstanceId][y.featureIndex]){var m=[new t.Point(g.x1,g.y1),new t.Point(g.x2,g.y1),new t.Point(g.x2,g.y2),new t.Point(g.x1,g.y2)];t.polygonIntersectsPolygon(r,m)&&(h[y.bucketInstanceId][y.featureIndex]=!0,void 0===p[y.bucketInstanceId]&&(p[y.bucketInstanceId]=[]),p[y.bucketInstanceId].push(y.featureIndex))}}return p},he.prototype.insertCollisionBox=function(t,e,r,n,i){(e?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:i},t[0],t[1],t[2],t[3])},he.prototype.insertCollisionCircles=function(t,e,r,n,i){for(var o=e?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:n,collisionGroupID:i},s=0;s<t.length;s+=4)o.insertCircle(a,t[s],t[s+1],t[s+2])},he.prototype.projectAndGetPerspectiveRatio=function(e,r,n){var i=[r,n,0,1];return ce(i,i,e),{point:new t.Point((i[0]/i[3]+1)/2*this.transform.width+100,(-i[1]/i[3]+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/i[3]*.5}},he.prototype.isOffscreen=function(t,e,r,n){return r<100||t>=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},he.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t<this.gridRightBoundary&&n>=0&&e<this.gridBottomBoundary},he.prototype.getViewportMatrix=function(){var e=t.identity([]);return t.translate(e,e,[-100,-100,0]),e};var fe=function(t,e,r,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):n&&r?1:0,this.placed=r};fe.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var de=function(t,e,r,n,i){this.text=new fe(t?t.text:null,e,r,i),this.icon=new fe(t?t.icon:null,e,n,i)};de.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var ge=function(t,e,r){this.text=t,this.icon=e,this.skipFade=r},ye=function(){this.invProjMatrix=t.create(),this.viewportMatrix=t.create(),this.circles=[]},me=function(t,e,r,n,i){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=n,this.tileID=i},ve=function(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}};function _e(e,r,n,i,o){var a=t.getAnchorAlignment(e),s=-(a.horizontalAlign-.5)*r,u=-(a.verticalAlign-.5)*n,l=t.evaluateVariableOffset(e,i);return new t.Point(s+l[0]*o,u+l[1]*o)}function xe(e,r,n,i,o,a){var s=e.x1,u=e.x2,l=e.y1,c=e.y2,h=e.anchorPointX,p=e.anchorPointY,f=new t.Point(r,n);return i&&f._rotate(o?a:-a),{x1:s+f.x,y1:l+f.y,x2:u+f.x,y2:c+f.y,anchorPointX:h,anchorPointY:p}}ve.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 be=function(t,e,r,n){this.transform=t.clone(),this.collisionIndex=new he(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new ve(r),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}};function we(t,e,r,n,i){t.emplaceBack(e?1:0,r?1:0,n||0,i||0),t.emplaceBack(e?1:0,r?1:0,n||0,i||0),t.emplaceBack(e?1:0,r?1:0,n||0,i||0),t.emplaceBack(e?1:0,r?1:0,n||0,i||0)}be.prototype.getBucketParts=function(e,r,n,i){var o=n.getBucket(r),a=n.latestFeatureIndex;if(o&&a&&r.id===o.layerIds[0]){var s=n.collisionBoxArray,u=o.layers[0].layout,l=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),c=n.tileSize/t.EXTENT,h=this.transform.calculatePosMatrix(n.tileID.toUnwrapped()),p="map"===u.get("text-pitch-alignment"),f="map"===u.get("text-rotation-alignment"),d=pe(n,1,this.transform.zoom),g=Kt(h,p,f,this.transform,d),y=null;if(p){var m=$t(h,p,f,this.transform,d);y=t.multiply([],this.transform.labelPlaneMatrix,m)}this.retainedQueryData[o.bucketInstanceId]=new me(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID);var v={bucket:o,layout:u,posMatrix:h,textLabelPlaneMatrix:g,labelToScreenMatrix:y,scale:l,textPixelRatio:c,holdingForFade:n.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(i)for(var _=0,x=o.sortKeyRanges;_<x.length;_+=1){var b=x[_];e.push({sortKey:b.sortKey,symbolInstanceStart:b.symbolInstanceStart,symbolInstanceEnd:b.symbolInstanceEnd,parameters:v})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:v})}},be.prototype.attemptAnchorPlacement=function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d){var g,y=[h.textOffset0,h.textOffset1],m=_e(t,r,n,y,i),v=this.collisionIndex.placeCollisionBox(xe(e,m.x,m.y,o,a,this.transform.angle),c,s,u,l.predicate);if(!d||0!==this.collisionIndex.placeCollisionBox(xe(d,m.x,m.y,o,a,this.transform.angle),c,s,u,l.predicate).box.length)return v.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(g=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:y,width:r,height:n,anchor:t,textBoxScale:i,prevAnchor:g},this.markUsedJustification(p,t,h,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,h),this.placedOrientations[h.crossTileID]=f),{shift:m,placedGlyphBoxes:v}):void 0},be.prototype.placeLayerBucketPart=function(e,r,n){var i=this,o=e.parameters,a=o.bucket,s=o.layout,u=o.posMatrix,l=o.textLabelPlaneMatrix,c=o.labelToScreenMatrix,h=o.textPixelRatio,p=o.holdingForFade,f=o.collisionBoxArray,d=o.partiallyEvaluatedTextSize,g=o.collisionGroup,y=s.get("text-optional"),m=s.get("icon-optional"),v=s.get("text-allow-overlap"),_=s.get("icon-allow-overlap"),x="map"===s.get("text-rotation-alignment"),b="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),E="viewport-y"===s.get("symbol-z-order"),I=v&&(_||!a.hasIconData()||m),S=_&&(v||!a.hasTextData()||y);!a.collisionArrays&&f&&a.deserializeCollisionBoxes(f);var C=function(e,o){if(!r[e.crossTileID])if(p)i.placements[e.crossTileID]=new ge(!1,!1,!1);else{var f,E=!1,C=!1,P=!0,M=null,T={box:null,offscreen:null},L={box:null,offscreen:null},A=null,k=null,N=0,D=0,R=0;o.textFeatureIndex?N=o.textFeatureIndex:e.useRuntimeCollisionCircles&&(N=e.featureIndex),o.verticalTextFeatureIndex&&(D=o.verticalTextFeatureIndex);var O=o.textBox;if(O){var z=function(r){var n=t.WritingMode.horizontal;if(a.allowVerticalPlacement&&!r&&i.prevPlacement){var o=i.prevPlacement.placedOrientations[e.crossTileID];o&&(i.placedOrientations[e.crossTileID]=o,i.markUsedOrientation(a,n=o,e))}return n},F=function(r,n){if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&o.verticalTextBox)for(var i=0,s=a.writingModes;i<s.length&&(s[i]===t.WritingMode.vertical?(T=n(),L=T):T=r(),!(T&&T.box&&T.box.length));i+=1);else T=r()};if(s.get("text-variable-anchor")){var B=s.get("text-variable-anchor");if(i.prevPlacement&&i.prevPlacement.variableOffsets[e.crossTileID]){var U=i.prevPlacement.variableOffsets[e.crossTileID];B.indexOf(U.anchor)>0&&(B=B.filter((function(t){return t!==U.anchor}))).unshift(U.anchor)}var j=function(t,r,n){for(var o=t.x2-t.x1,s=t.y2-t.y1,l=e.textBoxScale,c=w&&!_?r:null,p={box:[],offscreen:!1},f=v?2*B.length:B.length,d=0;d<f;++d){var y=i.attemptAnchorPlacement(B[d%B.length],t,o,s,l,x,b,h,u,g,d>=B.length,e,a,n,c);if(y&&(p=y.placedGlyphBoxes)&&p.box&&p.box.length){E=!0,M=y.shift;break}}return p};F((function(){return j(O,o.iconBox,t.WritingMode.horizontal)}),(function(){var r=o.verticalTextBox;return a.allowVerticalPlacement&&!(T&&T.box&&T.box.length)&&e.numVerticalGlyphVertices>0&&r?j(r,o.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),T&&(E=T.box,P=T.offscreen);var V=z(T&&T.box);if(!E&&i.prevPlacement){var q=i.prevPlacement.variableOffsets[e.crossTileID];q&&(i.variableOffsets[e.crossTileID]=q,i.markUsedJustification(a,q.anchor,e,V))}}else{var G=function(t,r){var n=i.collisionIndex.placeCollisionBox(t,v,h,u,g.predicate);return n&&n.box&&n.box.length&&(i.markUsedOrientation(a,r,e),i.placedOrientations[e.crossTileID]=r),n};F((function(){return G(O,t.WritingMode.horizontal)}),(function(){var r=o.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&r?G(r,t.WritingMode.vertical):{box:null,offscreen:null}})),z(T&&T.box&&T.box.length)}}if(E=(f=T)&&f.box&&f.box.length>0,P=f&&f.offscreen,e.useRuntimeCollisionCircles){var X=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),Z=t.evaluateSizeForFeature(a.textSizeData,d,X),Y=s.get("text-padding");A=i.collisionIndex.placeCollisionCircles(v,X,a.lineVertexArray,a.glyphOffsetArray,Z,u,l,c,n,b,g.predicate,e.collisionCircleDiameter,Y),E=v||A.circles.length>0&&!A.collisionDetected,P=P&&A.offscreen}if(o.iconFeatureIndex&&(R=o.iconFeatureIndex),o.iconBox){var W=function(t){var e=w&&M?xe(t,M.x,M.y,x,b,i.transform.angle):t;return i.collisionIndex.placeCollisionBox(e,_,h,u,g.predicate)};C=L&&L.box&&L.box.length&&o.verticalIconBox?(k=W(o.verticalIconBox)).box.length>0:(k=W(o.iconBox)).box.length>0,P=P&&k.offscreen}var H=y||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,J=m||0===e.numIconVertices;if(H||J?J?H||(C=C&&E):E=C&&E:C=E=C&&E,E&&f&&f.box&&i.collisionIndex.insertCollisionBox(f.box,s.get("text-ignore-placement"),a.bucketInstanceId,L&&L.box&&D?D:N,g.ID),C&&k&&i.collisionIndex.insertCollisionBox(k.box,s.get("icon-ignore-placement"),a.bucketInstanceId,R,g.ID),A&&(E&&i.collisionIndex.insertCollisionCircles(A.circles,s.get("text-ignore-placement"),a.bucketInstanceId,N,g.ID),n)){var K=a.bucketInstanceId,$=i.collisionCircleArrays[K];void 0===$&&($=i.collisionCircleArrays[K]=new ye);for(var Q=0;Q<A.circles.length;Q+=4)$.circles.push(A.circles[Q+0]),$.circles.push(A.circles[Q+1]),$.circles.push(A.circles[Q+2]),$.circles.push(A.collisionDetected?1:0)}i.placements[e.crossTileID]=new ge(E||I,C||S,P||a.justReloaded),r[e.crossTileID]=!0}};if(E)for(var P=a.getSortedSymbolIndexes(this.transform.angle),M=P.length-1;M>=0;--M){var T=P[M];C(a.symbolInstances.get(T),a.collisionArrays[T])}else for(var L=e.symbolInstanceStart;L<e.symbolInstanceEnd;L++)C(a.symbolInstances.get(L),a.collisionArrays[L]);if(n&&a.bucketInstanceId in this.collisionCircleArrays){var A=this.collisionCircleArrays[a.bucketInstanceId];t.invert(A.invProjMatrix,u),A.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1},be.prototype.markUsedJustification=function(e,r,n,i){var o;o=i===t.WritingMode.vertical?n.verticalPlacedTextSymbolIndex:{left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex}[t.getAnchorJustification(r)];for(var a=0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];a<s.length;a+=1){var u=s[a];u>=0&&(e.text.placedSymbolArray.get(u).crossTileID=o>=0&&u!==o?0:n.crossTileID)}},be.prototype.markUsedOrientation=function(e,r,n){for(var i=r===t.WritingMode.horizontal||r===t.WritingMode.horizontalOnly?r:0,o=r===t.WritingMode.vertical?r:0,a=0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];a<s.length;a+=1)e.text.placedSymbolArray.get(s[a]).placedOrientation=i;n.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).placedOrientation=o)},be.prototype.commit=function(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;var e=this.prevPlacement,r=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;var n=e?e.symbolFadeChange(t):1,i=e?e.opacities:{},o=e?e.variableOffsets:{},a=e?e.placedOrientations:{};for(var s in this.placements){var u=this.placements[s],l=i[s];l?(this.opacities[s]=new de(l,n,u.text,u.icon),r=r||u.text!==l.text.placed||u.icon!==l.icon.placed):(this.opacities[s]=new de(null,n,u.text,u.icon,u.skipFade),r=r||u.text||u.icon)}for(var c in i){var h=i[c];if(!this.opacities[c]){var p=new de(h,n,!1,!1);p.isHidden()||(this.opacities[c]=p,r=r||h.text.placed||h.icon.placed)}}for(var f in o)this.variableOffsets[f]||!this.opacities[f]||this.opacities[f].isHidden()||(this.variableOffsets[f]=o[f]);for(var d in a)this.placedOrientations[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.placedOrientations[d]=a[d]);r?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)},be.prototype.updateLayerOpacities=function(t,e){for(var r={},n=0,i=e;n<i.length;n+=1){var o=i[n],a=o.getBucket(t);a&&o.latestFeatureIndex&&t.id===a.layerIds[0]&&this.updateBucketOpacities(a,r,o.collisionBoxArray)}},be.prototype.updateBucketOpacities=function(e,r,n){var i=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();var o=e.layers[0].layout,a=new de(null,0,!1,!1,!0),s=o.get("text-allow-overlap"),u=o.get("icon-allow-overlap"),l=o.get("text-variable-anchor"),c="map"===o.get("text-rotation-alignment"),h="map"===o.get("text-pitch-alignment"),p="none"!==o.get("icon-text-fit"),f=new de(null,0,s&&(u||!e.hasIconData()||o.get("icon-optional")),u&&(s||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);for(var d=function(t,e,r){for(var n=0;n<e/4;n++)t.opacityVertexArray.emplaceBack(r)},g=function(n){var o=e.symbolInstances.get(n),s=o.numHorizontalGlyphVertices,u=o.numVerticalGlyphVertices,g=o.crossTileID,y=i.opacities[g];r[g]?y=a:y||(i.opacities[g]=y=f),r[g]=!0;var m=o.numIconVertices>0,v=i.placedOrientations[o.crossTileID],_=v===t.WritingMode.vertical,x=v===t.WritingMode.horizontal||v===t.WritingMode.horizontalOnly;if(s>0||u>0){var b=Le(y.text);d(e.text,s,_?Ae:b),d(e.text,u,x?Ae:b);var w=y.text.isHidden();[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||_?1:0)})),o.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var E=i.variableOffsets[o.crossTileID];E&&i.markUsedJustification(e,E.anchor,o,v);var I=i.placedOrientations[o.crossTileID];I&&(i.markUsedJustification(e,"left",o,I),i.markUsedOrientation(e,I,o))}if(m){var S=Le(y.icon),C=!(p&&o.verticalPlacedIconSymbolIndex&&_);o.placedIconSymbolIndex>=0&&(d(e.icon,o.numIconVertices,C?S:Ae),e.icon.placedSymbolArray.get(o.placedIconSymbolIndex).hidden=y.icon.isHidden()),o.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,o.numVerticalIconVertices,C?Ae:S),e.icon.placedSymbolArray.get(o.verticalPlacedIconSymbolIndex).hidden=y.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var P=e.collisionArrays[n];if(P){var M=new t.Point(0,0);if(P.textBox||P.verticalTextBox){var T=!0;if(l){var L=i.variableOffsets[g];L?(M=_e(L.anchor,L.width,L.height,L.textOffset,L.textBoxScale),c&&M._rotate(h?i.transform.angle:-i.transform.angle)):T=!1}P.textBox&&we(e.textCollisionBox.collisionVertexArray,y.text.placed,!T||_,M.x,M.y),P.verticalTextBox&&we(e.textCollisionBox.collisionVertexArray,y.text.placed,!T||x,M.x,M.y)}var A=Boolean(!x&&P.verticalIconBox);P.iconBox&&we(e.iconCollisionBox.collisionVertexArray,y.icon.placed,A,p?M.x:0,p?M.y:0),P.verticalIconBox&&we(e.iconCollisionBox.collisionVertexArray,y.icon.placed,!A,p?M.x:0,p?M.y:0)}}},y=0;y<e.symbolInstances.length;y++)g(y);if(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.bucketInstanceId in this.collisionCircleArrays){var m=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=m.invProjMatrix,e.placementViewportMatrix=m.viewportMatrix,e.collisionCircleArray=m.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}},be.prototype.symbolFadeChange=function(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},be.prototype.zoomAdjustment=function(t){return Math.max(0,(this.transform.zoom-t)/1.5)},be.prototype.hasTransitions=function(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration},be.prototype.stillRecent=function(t,e){var r=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*r>t},be.prototype.setStale=function(){this.stale=!0};var Ee=Math.pow(2,25),Ie=Math.pow(2,24),Se=Math.pow(2,17),Ce=Math.pow(2,16),Pe=Math.pow(2,9),Me=Math.pow(2,8),Te=Math.pow(2,1);function Le(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*Ee+e*Ie+r*Se+e*Ce+r*Pe+e*Me+r*Te+e}var Ae=0,ke=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};ke.prototype.continuePlacement=function(t,e,r,n,i){for(var o=this._bucketParts;this._currentTileIndex<t.length;)if(e.getBucketParts(o,n,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,i())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((function(t,e){return t.sortKey-e.sortKey})));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,r),this._currentPartIndex++,i())return!0;return!1};var Ne=function(t,e,r,n,i,o,a){this.placement=new be(t,i,o,a),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1};Ne.prototype.isDone=function(){return this._done},Ne.prototype.continuePlacement=function(e,r,n){for(var i=this,o=t.browser.now(),a=function(){var e=t.browser.now()-o;return!i._forceFullPlacement&&e>2};this._currentPlacementIndex>=0;){var s=r[e[this._currentPlacementIndex]],u=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=u)&&(!s.maxzoom||s.maxzoom>u)){if(this._inProgressLayer||(this._inProgressLayer=new ke(s)),this._inProgressLayer.continuePlacement(n[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},Ne.prototype.commit=function(t){return this.placement.commit(t),this.placement};var De=512/t.EXTENT/2,Re=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;n<e.length;n++){var i=e.get(n),o=i.key;this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:i.crossTileID,coord:this.getScaledCoordinates(i,t)})}};Re.prototype.getScaledCoordinates=function(e,r){var n=De/Math.pow(2,r.canonical.z-this.tileID.canonical.z);return{x:Math.floor((r.canonical.x*t.EXTENT+e.anchorX)*n),y:Math.floor((r.canonical.y*t.EXTENT+e.anchorY)*n)}},Re.prototype.findMatches=function(t,e,r){for(var n=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z),i=0;i<t.length;i++){var o=t.get(i);if(!o.crossTileID){var a=this.indexedSymbolInstances[o.key];if(a)for(var s=this.getScaledCoordinates(o,e),u=0,l=a;u<l.length;u+=1){var c=l[u];if(Math.abs(c.coord.x-s.x)<=n&&Math.abs(c.coord.y-s.y)<=n&&!r[c.crossTileID]){r[c.crossTileID]=!0,o.crossTileID=c.crossTileID;break}}}}};var Oe=function(){this.maxCrossTileID=0};Oe.prototype.generate=function(){return++this.maxCrossTileID};var ze=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};ze.prototype.handleWrapJump=function(t){var e=Math.round((t-this.lng)/360);if(0!==e)for(var r in this.indexes){var n=this.indexes[r],i={};for(var o in n){var a=n[o];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),i[a.tileID.key]=a}this.indexes[r]=i}this.lng=t},ze.prototype.addBucket=function(t,e,r){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 n=0;n<e.symbolInstances.length;n++)e.symbolInstances.get(n).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});var i=this.usedCrossTileIDs[t.overscaledZ];for(var o in this.indexes){var a=this.indexes[o];if(Number(o)>t.overscaledZ)for(var s in a){var u=a[s];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,i)}else{var l=a[t.scaledTo(Number(o)).key];l&&l.findMatches(e.symbolInstances,t,i)}}for(var c=0;c<e.symbolInstances.length;c++){var h=e.symbolInstances.get(c);h.crossTileID||(h.crossTileID=r.generate(),i[h.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Re(t,e.symbolInstances,e.bucketInstanceId),!0},ze.prototype.removeBucketCrossTileIDs=function(t,e){for(var r in e.indexedSymbolInstances)for(var n=0,i=e.indexedSymbolInstances[r];n<i.length;n+=1)delete this.usedCrossTileIDs[t][i[n].crossTileID]},ze.prototype.removeStaleBuckets=function(t){var e=!1;for(var r in this.indexes){var n=this.indexes[r];for(var i in n)t[n[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,n[i]),delete n[i],e=!0)}return e};var Fe=function(){this.layerIndexes={},this.crossTileIDs=new Oe,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};Fe.prototype.addLayer=function(t,e,r){var n=this.layerIndexes[t.id];void 0===n&&(n=this.layerIndexes[t.id]=new ze);var i=!1,o={};n.handleWrapJump(r);for(var a=0,s=e;a<s.length;a+=1){var u=s[a],l=u.getBucket(t);l&&t.id===l.layerIds[0]&&(l.bucketInstanceId||(l.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(u.tileID,l,this.crossTileIDs)&&(i=!0),o[l.bucketInstanceId]=!0)}return n.removeStaleBuckets(o)&&(i=!0),i},Fe.prototype.pruneUnusedLayers=function(t){var e={};for(var r in t.forEach((function(t){e[t]=!0})),this.layerIndexes)e[r]||delete this.layerIndexes[r]};var Be=function(e,r){return t.emitValidationErrors(e,r&&r.filter((function(t){return"source.canvas"!==t.identifier})))},Ue=t.pick(jt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),je=t.pick(jt,["setCenter","setZoom","setBearing","setPitch"]),Ve=function(){var e={},r=t.styleSpec.$version;for(var n in t.styleSpec.$root){var i,o=t.styleSpec.$root[n];o.required&&null!=(i="version"===n?r:"array"===o.type?[]:{})&&(e[n]=i)}return e}(),qe=function(e){function r(n,i){var o=this;void 0===i&&(i={}),e.call(this),this.map=n,this.dispatcher=new I(Ft(),this),this.imageManager=new p,this.imageManager.setEventedParent(this),this.glyphManager=new _(n._requestManager,i.localIdeographFontFamily),this.lineAtlas=new E(256,512),this.crossTileSymbolIndex=new Fe,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());var a=this;this._rtlTextPluginCallback=r.registerForPluginStateChange((function(e){a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},(function(e,r){if(t.triggerPluginCompletionEvent(e),r&&r.every((function(t){return t})))for(var n in a.sourceCaches)a.sourceCaches[n].reload()}))})),this.on("data",(function(t){if("source"===t.dataType&&"metadata"===t.sourceDataType){var e=o.sourceCaches[t.sourceId];if(e){var r=e.getSource();if(r&&r.vectorLayerIds)for(var n in o._layers){var i=o._layers[n];i.source===r.id&&o._validateLayer(i)}}}}))}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.loadURL=function(e,r){var n=this;void 0===r&&(r={}),this.fire(new t.Event("dataloading",{dataType:"style"}));var i="boolean"==typeof r.validate?r.validate:!t.isMapboxURL(e);e=this.map._requestManager.normalizeStyleURL(e,r.accessToken);var o=this.map._requestManager.transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(o,(function(e,r){n._request=null,e?n.fire(new t.ErrorEvent(e)):r&&n._load(r,i)}))},r.prototype.loadJSON=function(e,r){var n=this;void 0===r&&(r={}),this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame((function(){n._request=null,n._load(e,!1!==r.validate)}))},r.prototype.loadEmpty=function(){this.fire(new t.Event("dataloading",{dataType:"style"})),this._load(Ve,!1)},r.prototype._load=function(e,r){if(!r||!Be(this,t.validateStyle(e))){for(var n in this._loaded=!0,this.stylesheet=e,e.sources)this.addSource(n,e.sources[n],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var i=Ut(this.stylesheet.layers);this._order=i.map((function(t){return t.id})),this._layers={},this._serializedLayers={};for(var o=0,a=i;o<a.length;o+=1){var s=a[o];(s=t.createStyleLayer(s)).setEventedParent(this,{layer:{id:s.id}}),this._layers[s.id]=s,this._serializedLayers[s.id]=s.serialize()}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"))}},r.prototype._loadSprite=function(e){var r=this;this._spriteRequest=function(e,r,n){var i,o,a,s=t.browser.devicePixelRatio>1?"@2x":"",u=t.getJSON(r.transformRequest(r.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){u=null,a||(a=t,i=e,c())})),l=t.getImage(r.transformRequest(r.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){l=null,a||(a=t,o=e,c())}));function c(){if(a)n(a);else if(i&&o){var e=t.browser.getImageData(o),r={};for(var s in i){var u=i[s],l=u.width,c=u.height,h=u.x,p=u.y,f=u.sdf,d=u.pixelRatio,g=u.stretchX,y=u.stretchY,m=u.content,v=new t.RGBAImage({width:l,height:c});t.RGBAImage.copy(e,v,{x:h,y:p},{x:0,y:0},{width:l,height:c}),r[s]={data:v,pixelRatio:d,sdf:f,stretchX:g,stretchY:y,content:m}}n(null,r)}}return{cancel:function(){u&&(u.cancel(),u=null),l&&(l.cancel(),l=null)}}}(e,this.map._requestManager,(function(e,n){if(r._spriteRequest=null,e)r.fire(new t.ErrorEvent(e));else if(n)for(var i in n)r.imageManager.addImage(i,n[i]);r.imageManager.setLoaded(!0),r._availableImages=r.imageManager.listImages(),r.dispatcher.broadcast("setImages",r._availableImages),r.fire(new t.Event("data",{dataType:"style"}))}))},r.prototype._validateLayer=function(e){var r=this.sourceCaches[e.source];if(r){var n=e.sourceLayer;if(n){var i=r.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+n+'" does not exist on source "'+i.id+'" as specified by style layer "'+e.id+'"')))}}},r.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()},r.prototype._serializeLayers=function(t){for(var e=[],r=0,n=t;r<n.length;r+=1){var i=this._layers[n[r]];"custom"!==i.type&&e.push(i.serialize())}return e},r.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},r.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},r.prototype.update=function(e){if(this._loaded){var r=this._changed;if(this._changed){var n=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);for(var o in(n.length||i.length)&&this._updateWorkerLayers(n,i),this._updatedSources){var a=this._updatedSources[o];"reload"===a?this._reloadSource(o):"clear"===a&&this._clearSource(o)}for(var s in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}var u={};for(var l in this.sourceCaches){var c=this.sourceCaches[l];u[l]=c.used,c.used=!1}for(var h=0,p=this._order;h<p.length;h+=1){var f=this._layers[p[h]];f.recalculate(e,this._availableImages),!f.isHidden(e.zoom)&&f.source&&(this.sourceCaches[f.source].used=!0)}for(var d in u){var g=this.sourceCaches[d];u[d]!==g.used&&g.fire(new t.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.z=e.zoom,r&&this.fire(new t.Event("data",{dataType:"style"}))}},r.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={}}},r.prototype._updateWorkerLayers=function(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})},r.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}},r.prototype.setState=function(e){var r=this;if(this._checkLoaded(),Be(this,t.validateStyle(e)))return!1;(e=t.clone$1(e)).layers=Ut(e.layers);var n=function(e,r){if(!e)return[{command:jt.setStyle,args:[r]}];var n=[];try{if(!t.deepEqual(e.version,r.version))return[{command:jt.setStyle,args:[r]}];t.deepEqual(e.center,r.center)||n.push({command:jt.setCenter,args:[r.center]}),t.deepEqual(e.zoom,r.zoom)||n.push({command:jt.setZoom,args:[r.zoom]}),t.deepEqual(e.bearing,r.bearing)||n.push({command:jt.setBearing,args:[r.bearing]}),t.deepEqual(e.pitch,r.pitch)||n.push({command:jt.setPitch,args:[r.pitch]}),t.deepEqual(e.sprite,r.sprite)||n.push({command:jt.setSprite,args:[r.sprite]}),t.deepEqual(e.glyphs,r.glyphs)||n.push({command:jt.setGlyphs,args:[r.glyphs]}),t.deepEqual(e.transition,r.transition)||n.push({command:jt.setTransition,args:[r.transition]}),t.deepEqual(e.light,r.light)||n.push({command:jt.setLight,args:[r.light]});var i={},o=[];!function(e,r,n,i){var o;for(o in r=r||{},e=e||{})e.hasOwnProperty(o)&&(r.hasOwnProperty(o)||qt(o,n,i));for(o in r)r.hasOwnProperty(o)&&(e.hasOwnProperty(o)?t.deepEqual(e[o],r[o])||("geojson"===e[o].type&&"geojson"===r[o].type&&Xt(e,r,o)?n.push({command:jt.setGeoJSONSourceData,args:[o,r[o].data]}):Gt(o,r,n,i)):Vt(o,r,n))}(e.sources,r.sources,o,i);var a=[];e.layers&&e.layers.forEach((function(t){i[t.source]?n.push({command:jt.removeLayer,args:[t.id]}):a.push(t)})),n=n.concat(o),function(e,r,n){r=r||[];var i,o,a,s,u,l,c,h=(e=e||[]).map(Yt),p=r.map(Yt),f=e.reduce(Wt,{}),d=r.reduce(Wt,{}),g=h.slice(),y=Object.create(null);for(i=0,o=0;i<h.length;i++)d.hasOwnProperty(a=h[i])?o++:(n.push({command:jt.removeLayer,args:[a]}),g.splice(g.indexOf(a,o),1));for(i=0,o=0;i<p.length;i++)g[g.length-1-i]!==(a=p[p.length-1-i])&&(f.hasOwnProperty(a)?(n.push({command:jt.removeLayer,args:[a]}),g.splice(g.lastIndexOf(a,g.length-o),1)):o++,n.push({command:jt.addLayer,args:[d[a],l=g[g.length-i]]}),g.splice(g.length-i,0,a),y[a]=!0);for(i=0;i<p.length;i++)if(s=f[a=p[i]],u=d[a],!y[a]&&!t.deepEqual(s,u))if(t.deepEqual(s.source,u.source)&&t.deepEqual(s["source-layer"],u["source-layer"])&&t.deepEqual(s.type,u.type)){for(c in Zt(s.layout,u.layout,n,a,null,jt.setLayoutProperty),Zt(s.paint,u.paint,n,a,null,jt.setPaintProperty),t.deepEqual(s.filter,u.filter)||n.push({command:jt.setFilter,args:[a,u.filter]}),t.deepEqual(s.minzoom,u.minzoom)&&t.deepEqual(s.maxzoom,u.maxzoom)||n.push({command:jt.setLayerZoomRange,args:[a,u.minzoom,u.maxzoom]}),s)s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?Zt(s[c],u[c],n,a,c.slice(6),jt.setPaintProperty):t.deepEqual(s[c],u[c])||n.push({command:jt.setLayerProperty,args:[a,c,u[c]]}));for(c in u)u.hasOwnProperty(c)&&!s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?Zt(s[c],u[c],n,a,c.slice(6),jt.setPaintProperty):t.deepEqual(s[c],u[c])||n.push({command:jt.setLayerProperty,args:[a,c,u[c]]}))}else n.push({command:jt.removeLayer,args:[a]}),l=g[g.lastIndexOf(a)+1],n.push({command:jt.addLayer,args:[u,l]})}(a,r.layers,n)}catch(t){console.warn("Unable to compute style diff:",t),n=[{command:jt.setStyle,args:[r]}]}return n}(this.serialize(),e).filter((function(t){return!(t.command in je)}));if(0===n.length)return!1;var i=n.filter((function(t){return!(t.command in Ue)}));if(i.length>0)throw new Error("Unimplemented: "+i.map((function(t){return t.command})).join(", ")+".");return n.forEach((function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)})),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this._afterImageUpdated(e)},r.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.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._afterImageUpdated(e)},r.prototype._afterImageUpdated=function(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,n){var i=this;if(void 0===n&&(n={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,n))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Lt(e,r,this.dispatcher);o.style=this,o.setEventedParent(this,(function(){return{isSourceLoaded:i.loaded(),source:o.serialize(),sourceId:e}})),o.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=e.id;if(this.getLayer(i))this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" already exists on this map')));else{var o;if("custom"===e.type){if(Be(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(i,e.source),e=t.clone$1(e),e=t.extend(e,{source:i})),this._validate(t.validateStyle.layer,"layers."+i,e,{arrayIndex:-1},n))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:i}}),this._serializedLayers[o.id]=o.serialize()}var a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(a,0,i),this._layerOrderChanged=!0,this._layers[i]=o,this._removedLayers[i]&&o.source&&"custom"!==o.type){var s=this._removedLayers[i];delete this._removedLayers[i],s.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var i=r?this._order.indexOf(r):this._order.length;r&&-1===i?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(i,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.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.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.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.hasLayer=function(t){return t in this._layers},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?i.minzoom===r&&i.maxzoom===n||(null!=r&&(i.minzoom=r),null!=n&&(i.maxzoom=n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=this.getLayer(e);if(i){if(!t.deepEqual(i.filter,r))return null==r?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.validateStyle.filter,"layers."+i.id+".filter",r,null,n)||(i.filter=t.clone$1(r),this._updateLayer(i)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(r),n)||(o.setLayoutProperty(r,n,i),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(e,r){var n=this.getLayer(e);if(n)return n.getLayoutProperty(r);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},r.prototype.setPaintProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(r),n)||(o.setPaintProperty(r,n,i)&&this._updateLayer(o),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.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=e.sourceLayer,o=this.sourceCaches[n];if(void 0!==o){var a=o.getSource().type;"geojson"===a&&i?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||i?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.setFeatureState(i,e.id,r)):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 '"+n+"' does not exist in the map's style.")))},r.prototype.removeFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=this.sourceCaches[n];if(void 0!==i){var o=i.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?r&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):i.removeFeatureState(a,e.id,r):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 '"+n+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,n=e.sourceLayer,i=this.sourceCaches[r];if(void 0!==i){if("vector"!==i.getSource().type||n)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),i.getFeatureState(n,e.id);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 '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.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}))},r.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},r.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,r=function(t){return"fill-extrusion"===e._layers[t].type},n={},i=[],o=this._order.length-1;o>=0;o--){var a=this._order[o];if(r(a)){n[a]=o;for(var s=0,u=t;s<u.length;s+=1){var l=u[s][a];if(l)for(var c=0,h=l;c<h.length;c+=1)i.push(h[c])}}}i.sort((function(t,e){return e.intersectionZ-t.intersectionZ}));for(var p=[],f=this._order.length-1;f>=0;f--){var d=this._order[f];if(r(d))for(var g=i.length-1;g>=0;g--){var y=i[g].feature;if(n[y.layer.id]<f)break;p.push(y),i.pop()}else for(var m=0,v=t;m<v.length;m+=1){var _=v[m][d];if(_)for(var x=0,b=_;x<b.length;x+=1)p.push(b[x].feature)}}return p},r.prototype.queryRenderedFeatures=function(e,r,n){r&&r.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",r.filter,null,r);var i={};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var o=0,a=r.layers;o<a.length;o+=1){var s=a[o],u=this._layers[s];if(!u)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."))),[];i[u.source]=!0}}var l=[];for(var c in r.availableImages=this._availableImages,this.sourceCaches)r.layers&&!i[c]||l.push(z(this.sourceCaches[c],this._layers,this._serializedLayers,e,r,n));return this.placement&&l.push(function(t,e,r,n,i,o,a){for(var s={},u=o.queryRenderedSymbols(n),l=[],c=0,h=Object.keys(u).map(Number);c<h.length;c+=1)l.push(a[h[c]]);l.sort(F);for(var p=function(){var r=d[f],n=r.featureIndex.lookupSymbolFeatures(u[r.bucketInstanceId],e,r.bucketIndex,r.sourceLayerIndex,i.filter,i.layers,i.availableImages,t);for(var o in n){var a=s[o]=s[o]||[],l=n[o];l.sort((function(t,e){var n=r.featureSortOrder;if(n){var i=n.indexOf(t.featureIndex);return n.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(var c=0,h=l;c<h.length;c+=1)a.push(h[c])}},f=0,d=l;f<d.length;f+=1)p();var g=function(e){s[e].forEach((function(n){var i=n.feature,o=r[t[e].source].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}))};for(var y in s)g(y);return s}(this._layers,this._serializedLayers,this.sourceCaches,e,r,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(l)},r.prototype.querySourceFeatures=function(e,r){r&&r.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",r.filter,null,r);var n=this.sourceCaches[e];return n?function(t,e){for(var r=t.getRenderableIds().map((function(e){return t.getTileByID(e)})),n=[],i={},o=0;o<r.length;o++){var a=r[o],s=a.tileID.canonical.key;i[s]||(i[s]=!0,a.querySourceFeatures(n,e))}return n}(n,r):[]},r.prototype.addSourceType=function(t,e,n){return r.getSourceType(t)?n(new Error('A source type called "'+t+'" already exists.')):(r.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},n):n(null,null))},r.prototype.getLight=function(){return this.light.getLight()},r.prototype.setLight=function(e,r){void 0===r&&(r={}),this._checkLoaded();var n=this.light.getLight(),i=!1;for(var o in e)if(!t.deepEqual(e[o],n[o])){i=!0;break}if(i){var a={now:t.browser.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,r),this.light.updateTransitions(a)}},r.prototype._validate=function(e,r,n,i,o){return void 0===o&&(o={}),(!o||!1!==o.validate)&&Be(this,e.call(t.validateStyle,t.extend({key:r,style:this.serialize(),value:n,styleSpec:t.styleSpec},i)))},r.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 r in this.sourceCaches)this.sourceCaches[r].clearTiles(),this.sourceCaches[r].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()},r.prototype._clearSource=function(t){this.sourceCaches[t].clearTiles()},r.prototype._reloadSource=function(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()},r.prototype._updateSources=function(t){for(var e in this.sourceCaches)this.sourceCaches[e].update(t)},r.prototype._generateCollisionBoxes=function(){for(var t in this.sourceCaches)this._reloadSource(t)},r.prototype._updatePlacement=function(e,r,n,i,o){void 0===o&&(o=!1);for(var a=!1,s=!1,u={},l=0,c=this._order;l<c.length;l+=1){var h=this._layers[c[l]];if("symbol"===h.type){if(!u[h.source]){var p=this.sourceCaches[h.source];u[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 f=this.crossTileSymbolIndex.addLayer(h,u[h.source],e.center.lng);a=a||f}}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((o=o||this._layerOrderChanged||0===n)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now(),e.zoom))&&(this.pauseablePlacement=new Ne(e,this._order,o,r,n,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,u),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(t.browser.now()),s=!0),a&&this.pauseablePlacement.placement.setStale()),s||a)for(var d=0,g=this._order;d<g.length;d+=1){var y=this._layers[g[d]];"symbol"===y.type&&this.placement.updateLayerOpacities(y,u[y.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.browser.now())},r.prototype._releaseSymbolFadeTiles=function(){for(var t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()},r.prototype.getImages=function(t,e,r){this.imageManager.getImages(e.icons,r),this._updateTilesForChangedImages();var n=this.sourceCaches[e.source];n&&n.setDependencies(e.tileID.key,e.type,e.icons)},r.prototype.getGlyphs=function(t,e,r){this.glyphManager.getGlyphs(e.stacks,r)},r.prototype.getResource=function(e,r,n){return t.makeRequest(r,n)},r}(t.Evented);qe.getSourceType=function(t){return R[t]},qe.setSourceType=function(t,e){R[t]=e},qe.registerForPluginStateChange=t.registerForPluginStateChange;var Ge=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),Xe=mr("#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;}"),Ze=mr("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);}"),Ye=mr("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);}"),We=mr("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);}"),He=mr("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);}"),Je=mr("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;}"),Ke=mr("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;}"),$e=mr("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;}"),Qe=mr("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),tr=mr("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),er=mr("#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);}"),rr=mr("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;}"),nr=mr("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 vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ir=mr("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 vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),or=mr("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;}"),ar=mr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 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 vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute 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\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=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;}"),sr=mr("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,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 exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,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;}"),ur=mr("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;}"),lr=mr("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);}"),cr=mr("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 vec2 v_uv;\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,v_uv);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;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\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;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);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);}"),hr=mr("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);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;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;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);v_width=floorwidth;}"),pr=mr("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);}"),fr=mr("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;}"),dr=mr("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));}"),gr=mr("#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);}"),yr=mr("#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 mr(t,e){var r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/attribute ([\w]+) ([\w]+)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(i):i,s={};return{fragmentSource:t=t.replace(r,(function(t,e,r,n,i){return s[i]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nvarying "+r+" "+n+" "+i+";\n#else\nuniform "+r+" "+n+" u_"+i+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+i+"\n "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n"})),vertexSource:e=e.replace(r,(function(t,e,r,n,i){var o="float"===n?"vec2":"vec4",a=i.match(/color/)?"color":o;return s[i]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float u_"+i+"_t;\nattribute "+r+" "+o+" a_"+i+";\nvarying "+r+" "+n+" "+i+";\n#else\nuniform "+r+" "+n+" u_"+i+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = a_"+i+";\n#else\n "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = unpack_mix_"+a+"(a_"+i+", u_"+i+"_t);\n#else\n "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float u_"+i+"_t;\nattribute "+r+" "+o+" a_"+i+";\n#else\nuniform "+r+" "+n+" u_"+i+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+r+" "+n+" "+i+" = a_"+i+";\n#else\n "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+r+" "+n+" "+i+" = unpack_mix_"+a+"(a_"+i+", u_"+i+"_t);\n#else\n "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n"})),staticAttributes:n,staticUniforms:a}}var vr=Object.freeze({__proto__:null,prelude:Xe,background:Ze,backgroundPattern:Ye,circle:We,clippingMask:He,heatmap:Je,heatmapTexture:Ke,collisionBox:$e,collisionCircle:Qe,debug:tr,fill:er,fillOutline:rr,fillOutlinePattern:nr,fillPattern:ir,fillExtrusion:or,fillExtrusionPattern:ar,hillshadePrepare:sr,hillshade:ur,line:lr,lineGradient:cr,linePattern:hr,lineSDF:pr,raster:fr,symbolIcon:dr,symbolSDF:gr,symbolTextAndIcon:yr}),_r=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function xr(t){for(var e=[],r=0;r<t.length;r++)if(null!==t[r]){var n=t[r].split(" ");e.push(n.pop())}return e}_r.prototype.bind=function(t,e,r,n,i,o,a,s){this.context=t;for(var u=this.boundPaintVertexBuffers.length!==n.length,l=0;!u&&l<n.length;l++)this.boundPaintVertexBuffers[l]!==n[l]&&(u=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===e&&this.boundLayoutVertexBuffer===r&&!u&&this.boundIndexBuffer===i&&this.boundVertexOffset===o&&this.boundDynamicVertexBuffer===a&&this.boundDynamicVertexBuffer2===s?(t.bindVertexArrayOES.set(this.vao),a&&a.bind(),i&&i.dynamicDraw&&i.bind(),s&&s.bind()):this.freshBind(e,r,n,i,o,a,s)},_r.prototype.freshBind=function(t,e,r,n,i,o,a){var s,u=t.numAttributes,l=this.context,c=l.gl;if(l.extVertexArrayObject)this.vao&&this.destroy(),this.vao=l.extVertexArrayObject.createVertexArrayOES(),l.bindVertexArrayOES.set(this.vao),s=0,this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=n,this.boundVertexOffset=i,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a;else{s=l.currentNumAttributes||0;for(var h=u;h<s;h++)c.disableVertexAttribArray(h)}e.enableAttributes(c,t);for(var p=0,f=r;p<f.length;p+=1)f[p].enableAttributes(c,t);o&&o.enableAttributes(c,t),a&&a.enableAttributes(c,t),e.bind(),e.setVertexAttribPointers(c,t,i);for(var d=0,g=r;d<g.length;d+=1){var y=g[d];y.bind(),y.setVertexAttribPointers(c,t,i)}o&&(o.bind(),o.setVertexAttribPointers(c,t,i)),n&&n.bind(),a&&(a.bind(),a.setVertexAttribPointers(c,t,i)),l.currentNumAttributes=u},_r.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var br=function(t,e,r,n,i,o){var a=t.gl;this.program=a.createProgram();for(var s=xr(r.staticAttributes),u=n?n.getBinderAttributes():[],l=s.concat(u),c=r.staticUniforms?xr(r.staticUniforms):[],h=n?n.getBinderUniforms():[],p=[],f=0,d=c.concat(h);f<d.length;f+=1){var g=d[f];p.indexOf(g)<0&&p.push(g)}var y=n?n.defines():[];o&&y.push("#define OVERDRAW_INSPECTOR;");var m=y.concat(Xe.fragmentSource,r.fragmentSource).join("\n"),v=y.concat(Xe.vertexSource,r.vertexSource).join("\n"),_=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(_,m),a.compileShader(_),a.attachShader(this.program,_);var x=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(x,v),a.compileShader(x),a.attachShader(this.program,x),this.attributes={};var b={};this.numAttributes=l.length;for(var w=0;w<this.numAttributes;w++)l[w]&&(a.bindAttribLocation(this.program,w,l[w]),this.attributes[l[w]]=w);a.linkProgram(this.program),a.deleteShader(x),a.deleteShader(_);for(var E=0;E<p.length;E++){var I=p[E];if(I&&!b[I]){var S=a.getUniformLocation(this.program,I);S&&(b[I]=S)}}this.fixedUniforms=i(t,b),this.binderUniforms=n?n.getUniforms(t,b):[]}}};function wr(t,e,r){var n=1/pe(r,1,e.transform.tileZoom),i=Math.pow(2,r.tileID.overscaledZ),o=r.tileSize*Math.pow(2,e.transform.tileZoom)/i,a=o*(r.tileID.canonical.x+r.tileID.wrap*i),s=o*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}br.prototype.draw=function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g){var y,m=t.gl;if(!this.failedToCreate){for(var v in t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(n),t.setColorMode(i),t.setCullFace(o),this.fixedUniforms)this.fixedUniforms[v].set(a[v]);f&&f.setUniforms(t,this.binderUniforms,h,{zoom:p});for(var _=(y={},y[m.LINES]=2,y[m.TRIANGLES]=3,y[m.LINE_STRIP]=1,y)[e],x=0,b=c.get();x<b.length;x+=1){var w=b[x],E=w.vaos||(w.vaos={});(E[s]||(E[s]=new _r)).bind(t,this,u,f?f.getPaintVertexBuffers():[],l,w.vertexOffset,d,g),m.drawElements(e,w.primitiveLength*_,m.UNSIGNED_SHORT,w.primitiveOffset*_*2)}}};var Er=function(e,r,n,i){var o=r.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],u=t.create$1();"viewport"===o.properties.get("anchor")&&t.fromRotation(u,-r.transform.angle),t.transformMat3(s,s,u);var l=o.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+n,u_opacity:i}},Ir=function(e,r,n,i,o,a,s){return t.extend(Er(e,r,n,i),wr(a,r,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8})},Sr=function(t){return{u_matrix:t}},Cr=function(e,r,n,i){return t.extend(Sr(e),wr(n,r,i))},Pr=function(t,e){return{u_matrix:t,u_world:e}},Mr=function(e,r,n,i,o){return t.extend(Cr(e,r,n,i),{u_world:o})},Tr=function(e,r,n,i){var o,a,s=e.transform;if("map"===i.paint.get("circle-pitch-alignment")){var u=pe(n,1,s.zoom);o=!0,a=[u,u]}else o=!1,a=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(r.posMatrix,n,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:t.browser.devicePixelRatio,u_extrude_scale:a}},Lr=function(t,e,r){var n=pe(r,1,e.zoom),i=Math.pow(2,e.zoom-r.tileID.overscaledZ),o=r.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:n,u_extrude_scale:[e.pixelsToGLUnits[0]/(n*i),e.pixelsToGLUnits[1]/(n*i)],u_overscale_factor:o}},Ar=function(t,e,r){return{u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:r.cameraToCenterDistance,u_viewport_size:[r.width,r.height]}},kr=function(t,e,r){return void 0===r&&(r=1),{u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:r}},Nr=function(t){return{u_matrix:t}},Dr=function(t,e,r,n){return{u_matrix:t,u_extrude_scale:pe(e,1,r),u_intensity:n}},Rr=function(e,r,n){var i=e.transform;return{u_matrix:Ur(e,r,n),u_ratio:1/pe(r,1,i.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},Or=function(e,r,n,i){return t.extend(Rr(e,r,n),{u_image:0,u_image_height:i})},zr=function(e,r,n,i){var o=e.transform,a=Br(r,o);return{u_matrix:Ur(e,r,n),u_texsize:r.imageAtlasTexture.size,u_ratio:1/pe(r,1,o.zoom),u_device_pixel_ratio:t.browser.devicePixelRatio,u_image:0,u_scale:[a,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Fr=function(e,r,n,i,o){var a=e.lineAtlas,s=Br(r,e.transform),u="round"===n.layout.get("line-cap"),l=a.getDash(i.from,u),c=a.getDash(i.to,u),h=l.width*o.fromScale,p=c.width*o.toScale;return t.extend(Rr(e,r,n),{u_patternscale_a:[s/h,-l.height/2],u_patternscale_b:[s/p,-c.height/2],u_sdfgamma:a.width/(256*Math.min(h,p)*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:l.y,u_tex_y_b:c.y,u_mix:o.t})};function Br(t,e){return 1/pe(t,1,e.tileZoom)}function Ur(t,e,r){return t.translatePosMatrix(e.tileID.posMatrix,e,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}var jr=function(t,e,r,n,i){return{u_matrix:t,u_tl_parent:e,u_scale_parent:r,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:(a=i.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=i.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Vr(i.paint.get("raster-hue-rotate"))};var o,a};function Vr(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}var qr,Gr=function(t,e,r,n,i,o,a,s,u,l){var c=i.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:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:c.width/c.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+u,u_pitch_with_map:+n,u_texsize:l,u_texture:0}},Xr=function(e,r,n,i,o,a,s,u,l,c,h){var p=o.transform;return t.extend(Gr(e,r,n,i,o,a,s,u,l,c),{u_gamma_scale:i?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+h})},Zr=function(e,r,n,i,o,a,s,u,l,c){return t.extend(Xr(e,r,n,i,o,a,s,u,!0,l,!0),{u_texsize_icon:c,u_texture_icon:1})},Yr=function(t,e,r){return{u_matrix:t,u_opacity:e,u_color:r}},Wr=function(e,r,n,i,o,a){return t.extend(function(t,e,r,n){var i=r.imageManager.getPattern(t.from.toString()),o=r.imageManager.getPattern(t.to.toString()),a=r.imageManager.getPixelSize(),s=a.width,u=a.height,l=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,r.transform.tileZoom)/l,h=c*(n.tileID.canonical.x+n.tileID.wrap*l),p=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,u],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/pe(n,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,p>>16],u_pixel_coord_lower:[65535&h,65535&p]}}(i,a,n,o),{u_matrix:e,u_opacity:r})},Hr={fillExtrusion:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fillExtrusionPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,r.u_height_factor),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fill:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},fillPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},fillOutline:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world)}},fillOutlinePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},circle:function(e,r){return{u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,r.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},collisionBox:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,r.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,r.u_overscale_factor)}},collisionCircle:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,r.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,r.u_viewport_size)}},debug:function(e,r){return{u_color:new t.UniformColor(e,r.u_color),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_overlay:new t.Uniform1i(e,r.u_overlay),u_overlay_scale:new t.Uniform1f(e,r.u_overlay_scale)}},clippingMask:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmap:function(e,r){return{u_extrude_scale:new t.Uniform1f(e,r.u_extrude_scale),u_intensity:new t.Uniform1f(e,r.u_intensity),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmapTexture:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_color_ramp:new t.Uniform1i(e,r.u_color_ramp),u_opacity:new t.Uniform1f(e,r.u_opacity)}},hillshade:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_latrange:new t.Uniform2f(e,r.u_latrange),u_light:new t.Uniform2f(e,r.u_light),u_shadow:new t.UniformColor(e,r.u_shadow),u_highlight:new t.UniformColor(e,r.u_highlight),u_accent:new t.UniformColor(e,r.u_accent)}},hillshadePrepare:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_dimension:new t.Uniform2f(e,r.u_dimension),u_zoom:new t.Uniform1f(e,r.u_zoom),u_unpack:new t.Uniform4f(e,r.u_unpack)}},line:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels)}},lineGradient:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_image:new t.Uniform1i(e,r.u_image),u_image_height:new t.Uniform1f(e,r.u_image_height)}},linePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_texsize:new t.Uniform2f(e,r.u_texsize),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_image:new t.Uniform1i(e,r.u_image),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},lineSDF:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,r.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,r.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,r.u_sdfgamma),u_image:new t.Uniform1i(e,r.u_image),u_tex_y_a:new t.Uniform1f(e,r.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,r.u_tex_y_b),u_mix:new t.Uniform1f(e,r.u_mix)}},raster:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_tl_parent:new t.Uniform2f(e,r.u_tl_parent),u_scale_parent:new t.Uniform1f(e,r.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,r.u_buffer_scale),u_fade_t:new t.Uniform1f(e,r.u_fade_t),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image0:new t.Uniform1i(e,r.u_image0),u_image1:new t.Uniform1i(e,r.u_image1),u_brightness_low:new t.Uniform1f(e,r.u_brightness_low),u_brightness_high:new t.Uniform1f(e,r.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,r.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,r.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,r.u_spin_weights)}},symbolIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture)}},symbolSDF:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},symbolTextAndIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texsize_icon:new t.Uniform2f(e,r.u_texsize_icon),u_texture:new t.Uniform1i(e,r.u_texture),u_texture_icon:new t.Uniform1i(e,r.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},background:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_color:new t.UniformColor(e,r.u_color)}},backgroundPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image:new t.Uniform1i(e,r.u_image),u_pattern_tl_a:new t.Uniform2f(e,r.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,r.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,r.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,r.u_pattern_br_b),u_texsize:new t.Uniform2f(e,r.u_texsize),u_mix:new t.Uniform1f(e,r.u_mix),u_pattern_size_a:new t.Uniform2f(e,r.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,r.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,r.u_scale_a),u_scale_b:new t.Uniform1f(e,r.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,r.u_tile_units_to_pixels)}}};function Jr(e,r,n,i,o,a,s){for(var u=e.context,l=u.gl,c=e.useProgram("collisionBox"),h=[],p=0,f=0,d=0;d<i.length;d++){var g=i[d],y=r.getTile(g),m=y.getBucket(n);if(m){var v=g.posMatrix;0===o[0]&&0===o[1]||(v=e.translatePosMatrix(g.posMatrix,y,o,a));var _=s?m.textCollisionBox:m.iconCollisionBox,x=m.collisionCircleArray;if(x.length>0){var b=t.create(),w=v;t.mul(b,m.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,m.placementViewportMatrix),h.push({circleArray:x,circleOffset:f,transform:w,invTransform:b}),f=p+=x.length/4}_&&c.draw(u,l.LINES,St.disabled,Ct.disabled,e.colorModeForRenderPass(),Mt.disabled,Lr(v,e.transform,y),n.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,null,e.transform.zoom,null,null,_.collisionVertexBuffer)}}if(s&&h.length){var E=e.useProgram("collisionCircle"),I=new t.StructArrayLayout2f1f2i16;I.resize(4*p),I._trim();for(var S=0,C=0,P=h;C<P.length;C+=1)for(var M=P[C],T=0;T<M.circleArray.length/4;T++){var L=4*T,A=M.circleArray[L+0],k=M.circleArray[L+1],N=M.circleArray[L+2],D=M.circleArray[L+3];I.emplace(S++,A,k,N,D,0),I.emplace(S++,A,k,N,D,1),I.emplace(S++,A,k,N,D,2),I.emplace(S++,A,k,N,D,3)}(!qr||qr.length<2*p)&&(qr=function(e){var r=2*e,n=new t.StructArrayLayout3ui6;n.resize(r),n._trim();for(var i=0;i<r;i++){var o=6*i;n.uint16[o+0]=4*i+0,n.uint16[o+1]=4*i+1,n.uint16[o+2]=4*i+2,n.uint16[o+3]=4*i+2,n.uint16[o+4]=4*i+3,n.uint16[o+5]=4*i+0}return n}(p));for(var R=u.createIndexBuffer(qr,!0),O=u.createVertexBuffer(I,t.collisionCircleLayout.members,!0),z=0,F=h;z<F.length;z+=1){var B=F[z],U=Ar(B.transform,B.invTransform,e.transform);E.draw(u,l.TRIANGLES,St.disabled,Ct.disabled,e.colorModeForRenderPass(),Mt.disabled,U,n.id,O,R,t.SegmentVector.simpleSegment(0,2*B.circleOffset,B.circleArray.length,B.circleArray.length/2),null,e.transform.zoom,null,null,null)}O.destroy(),R.destroy()}}var Kr=t.identity(new Float32Array(16));function $r(e,r,n,i,o,a){var s=t.getAnchorAlignment(e),u=-(s.horizontalAlign-.5)*r,l=-(s.verticalAlign-.5)*n,c=t.evaluateVariableOffset(e,i);return new t.Point((u/o+c[0])*a,(l/o+c[1])*a)}function Qr(e,r,n,i,o,a,s,u,l,c,h){var p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,d=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(var y=0;y<p.length;y++){var m=p.get(y),v=m.hidden||!m.crossTileID||e.allowVerticalPlacement&&!m.placedOrientation?null:i[m.crossTileID];if(v){var _=new t.Point(m.anchorX,m.anchorY),x=Qt(_,n?u:s),b=te(a.cameraToCenterDistance,x.signedDistanceFromCamera),w=o.evaluateSizeForFeature(e.textSizeData,c,m)*b/t.ONE_EM;n&&(w*=e.tilePixelRatio/l);for(var E=$r(v.anchor,v.width,v.height,v.textOffset,v.textBoxScale,w),I=n?Qt(_.add(E),s).point:x.point.add(r?E.rotate(-a.angle):E),S=e.allowVerticalPlacement&&m.placedOrientation===t.WritingMode.vertical?Math.PI/2:0,C=0;C<m.numGlyphs;C++)t.addDynamicAttributes(f,I,S);h&&m.associatedIconIndex>=0&&(g[m.associatedIconIndex]={shiftedAnchor:I,angle:S})}else le(m.numGlyphs,f)}if(h){d.clear();for(var P=e.icon.placedSymbolArray,M=0;M<P.length;M++){var T=P.get(M);if(T.hidden)le(T.numGlyphs,d);else{var L=g[M];if(L)for(var A=0;A<T.numGlyphs;A++)t.addDynamicAttributes(d,L.shiftedAnchor,L.angle);else le(T.numGlyphs,d)}}e.icon.dynamicLayoutVertexBuffer.updateData(d)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function tn(t,e,r){return r.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function en(e,r,n,i,o,a,s,u,l,c,h,p){for(var f=e.context,d=f.gl,g=e.transform,y="map"===u,m="map"===l,v=y&&"point"!==n.layout.get("symbol-placement"),_=y&&!m&&!v,x=!n.layout.get("symbol-sort-key").isConstant(),b=!1,w=e.depthModeForSublayer(0,St.ReadOnly),E=n.layout.get("text-variable-anchor"),I=[],S=0,C=i;S<C.length;S+=1){var P=C[S],M=r.getTile(P),T=M.getBucket(n);if(T){var L=o?T.text:T.icon;if(L&&L.segments.get().length){var A=L.programConfigurations.get(n.id),k=o||T.sdfIcons,N=o?T.textSizeData:T.iconSizeData,D=m||0!==g.pitch,R=e.useProgram(tn(k,o,T),A),O=t.evaluateSizeForZoom(N,g.zoom),z=void 0,F=[0,0],B=void 0,U=void 0,j=null,V=void 0;if(o)B=M.glyphAtlasTexture,U=d.LINEAR,z=M.glyphAtlasTexture.size,T.iconsInText&&(F=M.imageAtlasTexture.size,j=M.imageAtlasTexture,V=D||e.options.rotating||e.options.zooming||"composite"===N.kind||"camera"===N.kind?d.LINEAR:d.NEAREST);else{var q=1!==n.layout.get("icon-size").constantOr(0)||T.iconsNeedLinear;B=M.imageAtlasTexture,U=k||e.options.rotating||e.options.zooming||q||D?d.LINEAR:d.NEAREST,z=M.imageAtlasTexture.size}var G=pe(M,1,e.transform.zoom),X=Kt(P.posMatrix,m,y,e.transform,G),Z=$t(P.posMatrix,m,y,e.transform,G),Y=E&&T.hasTextData(),W="none"!==n.layout.get("icon-text-fit")&&Y&&T.hasIconData();v&&re(T,P.posMatrix,e,o,X,Z,m,c);var H=e.translatePosMatrix(P.posMatrix,M,a,s),J=v||o&&E||W?Kr:X,K=e.translatePosMatrix(Z,M,a,s,!0),$=k&&0!==n.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1),Q={program:R,buffers:L,uniformValues:k?T.iconsInText?Zr(N.kind,O,_,m,e,H,J,K,z,F):Xr(N.kind,O,_,m,e,H,J,K,o,z,!0):Gr(N.kind,O,_,m,e,H,J,K,o,z),atlasTexture:B,atlasTextureIcon:j,atlasInterpolation:U,atlasInterpolationIcon:V,isSDF:k,hasHalo:$};if(x&&T.canOverlap){b=!0;for(var tt=0,et=L.segments.get();tt<et.length;tt+=1){var rt=et[tt];I.push({segments:new t.SegmentVector([rt]),sortKey:rt.sortKey,state:Q})}}else I.push({segments:L.segments,sortKey:0,state:Q})}}}b&&I.sort((function(t,e){return t.sortKey-e.sortKey}));for(var nt=0,it=I;nt<it.length;nt+=1){var ot=it[nt],at=ot.state;if(f.activeTexture.set(d.TEXTURE0),at.atlasTexture.bind(at.atlasInterpolation,d.CLAMP_TO_EDGE),at.atlasTextureIcon&&(f.activeTexture.set(d.TEXTURE1),at.atlasTextureIcon&&at.atlasTextureIcon.bind(at.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),at.isSDF){var st=at.uniformValues;at.hasHalo&&(st.u_is_halo=1,rn(at.buffers,ot.segments,n,e,at.program,w,h,p,st)),st.u_is_halo=0}rn(at.buffers,ot.segments,n,e,at.program,w,h,p,at.uniformValues)}}function rn(t,e,r,n,i,o,a,s,u){var l=n.context;i.draw(l,l.gl.TRIANGLES,o,a,s,Mt.disabled,u,r.id,t.layoutVertexBuffer,t.indexBuffer,e,r.paint,n.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function nn(t,e,r,n,i,o,a){var s,u,l,c,h,p=t.context.gl,f=r.paint.get("fill-pattern"),d=f&&f.constantOr(1),g=r.getCrossfadeParameters();a?(u=d&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",s=p.LINES):(u=d?"fillPattern":"fill",s=p.TRIANGLES);for(var y=0,m=n;y<m.length;y+=1){var v=m[y],_=e.getTile(v);if(!d||_.patternsLoaded()){var x=_.getBucket(r);if(x){var b=x.programConfigurations.get(r.id),w=t.useProgram(u,b);d&&(t.context.activeTexture.set(p.TEXTURE0),_.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),b.updatePaintBuffers(g));var E=f.constantOr(null);if(E&&_.imageAtlas){var I=_.imageAtlas,S=I.patternPositions[E.to.toString()],C=I.patternPositions[E.from.toString()];S&&C&&b.setConstantPatternPositions(S,C)}var P=t.translatePosMatrix(v.posMatrix,_,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(a){c=x.indexBuffer2,h=x.segments2;var M=[p.drawingBufferWidth,p.drawingBufferHeight];l="fillOutlinePattern"===u&&d?Mr(P,t,g,_,M):Pr(P,M)}else c=x.indexBuffer,h=x.segments,l=d?Cr(P,t,g,_):Sr(P);w.draw(t.context,s,i,t.stencilModeForClipping(v),o,Mt.disabled,l,r.id,x.layoutVertexBuffer,c,h,r.paint,t.transform.zoom,b)}}}}function on(t,e,r,n,i,o,a){for(var s=t.context,u=s.gl,l=r.paint.get("fill-extrusion-pattern"),c=l.constantOr(1),h=r.getCrossfadeParameters(),p=r.paint.get("fill-extrusion-opacity"),f=0,d=n;f<d.length;f+=1){var g=d[f],y=e.getTile(g),m=y.getBucket(r);if(m){var v=m.programConfigurations.get(r.id),_=t.useProgram(c?"fillExtrusionPattern":"fillExtrusion",v);c&&(t.context.activeTexture.set(u.TEXTURE0),y.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),v.updatePaintBuffers(h));var x=l.constantOr(null);if(x&&y.imageAtlas){var b=y.imageAtlas,w=b.patternPositions[x.to.toString()],E=b.patternPositions[x.from.toString()];w&&E&&v.setConstantPatternPositions(w,E)}var I=t.translatePosMatrix(g.posMatrix,y,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),S=r.paint.get("fill-extrusion-vertical-gradient"),C=c?Ir(I,t,S,p,g,h,y):Er(I,t,S,p);_.draw(s,s.gl.TRIANGLES,i,o,a,Mt.backCCW,C,r.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,r.paint,t.transform.zoom,v)}}}function an(e,r,n,i,o,a){var s=e.context,u=s.gl,l=r.fbo;if(l){var c=e.useProgram("hillshade");s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,l.colorAttachment.get());var h=function(e,r,n){var i=n.paint.get("hillshade-shadow-color"),o=n.paint.get("hillshade-highlight-color"),a=n.paint.get("hillshade-accent-color"),s=n.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===n.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);var u,l,c,h=!e.options.moving;return{u_matrix:e.transform.calculatePosMatrix(r.tileID.toUnwrapped(),h),u_image:0,u_latrange:(u=r.tileID,l=Math.pow(2,u.canonical.z),c=u.canonical.y,[new t.MercatorCoordinate(0,c/l).toLngLat().lat,new t.MercatorCoordinate(0,(c+1)/l).toLngLat().lat]),u_light:[n.paint.get("hillshade-exaggeration"),s],u_shadow:i,u_highlight:o,u_accent:a}}(e,r,n);c.draw(s,u.TRIANGLES,i,o,a,Mt.disabled,h,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}}function sn(e,r,n,i,o,a){var s=e.context,u=s.gl,l=r.dem;if(l&&l.data){var c=l.dim,h=l.stride,p=l.getPixels();if(s.activeTexture.set(u.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||e.getTileTexture(h),r.demTexture){var f=r.demTexture;f.update(p,{premultiply:!1}),f.bind(u.NEAREST,u.CLAMP_TO_EDGE)}else r.demTexture=new t.Texture(s,p,u.RGBA,{premultiply:!1}),r.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);s.activeTexture.set(u.TEXTURE0);var d=r.fbo;if(!d){var g=new t.Texture(s,{width:c,height:c,data:null},u.RGBA);g.bind(u.LINEAR,u.CLAMP_TO_EDGE),(d=r.fbo=s.createFramebuffer(c,c,!0)).colorAttachment.set(g.texture)}s.bindFramebuffer.set(d.framebuffer),s.viewport.set([0,0,c,c]),e.useProgram("hillshadePrepare").draw(s,u.TRIANGLES,i,o,a,Mt.disabled,function(e,r){var n=r.stride,i=t.create();return t.ortho(i,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(i,i,[0,-t.EXTENT,0]),{u_matrix:i,u_image:1,u_dimension:[n,n],u_zoom:e.overscaledZ,u_unpack:r.getUnpackVector()}}(r.tileID,l),n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),r.needsHillshadePrepare=!1}}function un(e,r,n,i,o){var a=i.paint.get("raster-fade-duration");if(a>0){var s=t.browser.now(),u=(s-e.timeAdded)/a,l=r?(s-r.timeAdded)/a:-1,c=n.getSource(),h=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!r||Math.abs(r.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),f=p&&e.refreshedUponExpiration?1:t.clamp(p?u:1-l,0,1);return e.refreshedUponExpiration&&u>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}var ln=new t.Color(1,0,0,1),cn=new t.Color(0,1,0,1),hn=new t.Color(0,0,1,1),pn=new t.Color(1,0,1,1),fn=new t.Color(0,1,1,1);function dn(t,e,r,n){yn(t,0,e+r/2,t.transform.width,r,n)}function gn(t,e,r,n){yn(t,e-r/2,0,r,t.transform.height,n)}function yn(e,r,n,i,o,a){var s=e.context,u=s.gl;u.enable(u.SCISSOR_TEST),u.scissor(r*t.browser.devicePixelRatio,n*t.browser.devicePixelRatio,i*t.browser.devicePixelRatio,o*t.browser.devicePixelRatio),s.clear({color:a}),u.disable(u.SCISSOR_TEST)}function mn(e,r,n){var i=e.context,o=i.gl,a=n.posMatrix,s=e.useProgram("debug"),u=St.disabled,l=Ct.disabled,c=e.colorModeForRenderPass();i.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.draw(i,o.LINE_STRIP,u,l,c,Mt.disabled,kr(a,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var h=r.getTileByID(n.key).latestRawTileData,p=Math.floor((h&&h.byteLength||0)/1024),f=r.getTile(n).tileSize,d=512/Math.min(f,512)*(n.overscaledZ/e.transform.zoom)*.5,g=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(g+=" => "+n.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var r=t.debugOverlayCanvas,n=t.context.gl,i=t.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,r.width,r.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(e,5,5),i.strokeText(e,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,g+" "+p+"kb"),s.draw(i,o.TRIANGLES,u,l,Pt.alphaBlended,Mt.disabled,kr(a,t.Color.transparent,d),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var vn={symbol:function(e,r,n,i,o){if("translucent"===e.renderPass){var a=Ct.disabled,s=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,r,n,i,o,a,s){for(var u=r.transform,l="map"===o,c="map"===a,h=0,p=e;h<p.length;h+=1){var f=p[h],d=i.getTile(f),g=d.getBucket(n);if(g&&g.text&&g.text.segments.get().length){var y=t.evaluateSizeForZoom(g.textSizeData,u.zoom),m=pe(d,1,r.transform.zoom),v=Kt(f.posMatrix,c,l,r.transform,m),_="none"!==n.layout.get("icon-text-fit")&&g.hasIconData();if(y){var x=Math.pow(2,u.zoom-d.tileID.overscaledZ);Qr(g,l,c,s,t.symbolSize,u,v,f.posMatrix,x,y,_)}}}}(i,e,n,r,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),o),0!==n.paint.get("icon-opacity").constantOr(1)&&en(e,r,n,i,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),a,s),0!==n.paint.get("text-opacity").constantOr(1)&&en(e,r,n,i,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),a,s),r.map.showCollisionBoxes&&(Jr(e,r,n,i,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Jr(e,r,n,i,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))}},circle:function(e,r,n,i){if("translucent"===e.renderPass){var o=n.paint.get("circle-opacity"),a=n.paint.get("circle-stroke-width"),s=n.paint.get("circle-stroke-opacity"),u=!n.layout.get("circle-sort-key").isConstant();if(0!==o.constantOr(1)||0!==a.constantOr(1)&&0!==s.constantOr(1)){for(var l=e.context,c=l.gl,h=e.depthModeForSublayer(0,St.ReadOnly),p=Ct.disabled,f=e.colorModeForRenderPass(),d=[],g=0;g<i.length;g++){var y=i[g],m=r.getTile(y),v=m.getBucket(n);if(v){var _=v.programConfigurations.get(n.id),x={programConfiguration:_,program:e.useProgram("circle",_),layoutVertexBuffer:v.layoutVertexBuffer,indexBuffer:v.indexBuffer,uniformValues:Tr(e,y,m,n)};if(u)for(var b=0,w=v.segments.get();b<w.length;b+=1){var E=w[b];d.push({segments:new t.SegmentVector([E]),sortKey:E.sortKey,state:x})}else d.push({segments:v.segments,sortKey:0,state:x})}}u&&d.sort((function(t,e){return t.sortKey-e.sortKey}));for(var I=0,S=d;I<S.length;I+=1){var C=S[I],P=C.state;P.program.draw(l,c.TRIANGLES,h,p,f,Mt.disabled,P.uniformValues,n.id,P.layoutVertexBuffer,P.indexBuffer,C.segments,n.paint,e.transform.zoom,P.programConfiguration)}}}},heatmap:function(e,r,n,i){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){var o=e.context,a=o.gl,s=Ct.disabled,u=new Pt([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,r){var n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);var i=r.heatmapFbo;if(i)n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),t.bindFramebuffer.set(i.framebuffer);else{var o=n.createTexture();n.bindTexture(n.TEXTURE_2D,o),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),i=r.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4,!1),function(t,e,r,n){var i=t.gl;i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e.width/4,e.height/4,0,i.RGBA,t.extRenderToTextureHalfFloat?t.extTextureHalfFloat.HALF_FLOAT_OES:i.UNSIGNED_BYTE,null),n.colorAttachment.set(r)}(t,e,o,i)}}(o,e,n),o.clear({color:t.Color.transparent});for(var l=0;l<i.length;l++){var c=i[l];if(!r.hasRenderableParent(c)){var h=r.getTile(c),p=h.getBucket(n);if(p){var f=p.programConfigurations.get(n.id);e.useProgram("heatmap",f).draw(o,a.TRIANGLES,St.disabled,s,u,Mt.disabled,Dr(c.posMatrix,h,e.transform.zoom,n.paint.get("heatmap-intensity")),n.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,n.paint,e.transform.zoom,f)}}}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,r){var n=e.context,i=n.gl,o=r.heatmapFbo;if(o){n.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,o.colorAttachment.get()),n.activeTexture.set(i.TEXTURE1);var a=r.colorRampTexture;a||(a=r.colorRampTexture=new t.Texture(n,r.colorRamp,i.RGBA)),a.bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(n,i.TRIANGLES,St.disabled,Ct.disabled,e.colorModeForRenderPass(),Mt.disabled,function(e,r,n,i){var o=t.create();t.ortho(o,0,e.width,e.height,0,0,1);var a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:r.paint.get("heatmap-opacity")}}(e,r),r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom)}}(e,n))},line:function(e,r,n,i){if("translucent"===e.renderPass){var o=n.paint.get("line-opacity"),a=n.paint.get("line-width");if(0!==o.constantOr(1)&&0!==a.constantOr(1))for(var s=e.depthModeForSublayer(0,St.ReadOnly),u=e.colorModeForRenderPass(),l=n.paint.get("line-dasharray"),c=n.paint.get("line-pattern"),h=c.constantOr(1),p=n.paint.get("line-gradient"),f=n.getCrossfadeParameters(),d=h?"linePattern":l?"lineSDF":p?"lineGradient":"line",g=e.context,y=g.gl,m=!0,v=0,_=i;v<_.length;v+=1){var x=_[v],b=r.getTile(x);if(!h||b.patternsLoaded()){var w=b.getBucket(n);if(w){var E=w.programConfigurations.get(n.id),I=e.context.program.get(),S=e.useProgram(d,E),C=m||S.program!==I,P=c.constantOr(null);if(P&&b.imageAtlas){var M=b.imageAtlas,T=M.patternPositions[P.to.toString()],L=M.patternPositions[P.from.toString()];T&&L&&E.setConstantPatternPositions(T,L)}var A=h?zr(e,b,n,f):l?Fr(e,b,n,l,f):p?Or(e,b,n,w.lineClipsArray.length):Rr(e,b,n);if(h)g.activeTexture.set(y.TEXTURE0),b.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),E.updatePaintBuffers(f);else if(l&&(C||e.lineAtlas.dirty))g.activeTexture.set(y.TEXTURE0),e.lineAtlas.bind(g);else if(p){var k=w.gradients[n.id],N=k.texture;if(n.gradientVersion!==k.version){var D=256;if(n.stepInterpolant){var R=r.getSource().maxzoom,O=x.canonical.z===R?Math.ceil(1<<e.transform.maxZoom-x.canonical.z):1;D=t.clamp(t.nextPowerOfTwo(w.maxLineLength/t.EXTENT*1024*O),256,g.maxTextureSize)}k.gradient=t.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:D,image:k.gradient||void 0,clips:w.lineClipsArray}),k.texture?k.texture.update(k.gradient):k.texture=new t.Texture(g,k.gradient,y.RGBA),k.version=n.gradientVersion,N=k.texture}g.activeTexture.set(y.TEXTURE0),N.bind(n.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}S.draw(g,y.TRIANGLES,s,e.stencilModeForClipping(x),u,Mt.disabled,A,n.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,n.paint,e.transform.zoom,E,w.layoutVertexBuffer2),m=!1}}}}},fill:function(e,r,n,i){var o=n.paint.get("fill-color"),a=n.paint.get("fill-opacity");if(0!==a.constantOr(1)){var s=e.colorModeForRenderPass(),u=n.paint.get("fill-pattern"),l=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===o.constantOr(t.Color.transparent).a&&1===a.constantOr(0)?"opaque":"translucent";if(e.renderPass===l){var c=e.depthModeForSublayer(1,"opaque"===e.renderPass?St.ReadWrite:St.ReadOnly);nn(e,r,n,i,c,s,!1)}if("translucent"===e.renderPass&&n.paint.get("fill-antialias")){var h=e.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,St.ReadOnly);nn(e,r,n,i,h,s,!0)}}},"fill-extrusion":function(t,e,r,n){var i=r.paint.get("fill-extrusion-opacity");if(0!==i&&"translucent"===t.renderPass){var o=new St(t.context.gl.LEQUAL,St.ReadWrite,t.depthRangeFor3D);if(1!==i||r.paint.get("fill-extrusion-pattern").constantOr(1))on(t,e,r,n,o,Ct.disabled,Pt.disabled),on(t,e,r,n,o,t.stencilModeFor3D(),t.colorModeForRenderPass());else{var a=t.colorModeForRenderPass();on(t,e,r,n,o,Ct.disabled,a)}}},hillshade:function(t,e,r,n){if("offscreen"===t.renderPass||"translucent"===t.renderPass){for(var i=t.context,o=t.depthModeForSublayer(0,St.ReadOnly),a=t.colorModeForRenderPass(),s="translucent"===t.renderPass?t.stencilConfigForOverlap(n):[{},n],u=s[0],l=0,c=s[1];l<c.length;l+=1){var h=c[l],p=e.getTile(h);p.needsHillshadePrepare&&"offscreen"===t.renderPass?sn(t,p,r,o,Ct.disabled,a):"translucent"===t.renderPass&&an(t,p,r,o,u[h.overscaledZ],a)}i.viewport.set([0,0,t.width,t.height])}},raster:function(t,e,r,n){if("translucent"===t.renderPass&&0!==r.paint.get("raster-opacity")&&n.length)for(var i=t.context,o=i.gl,a=e.getSource(),s=t.useProgram("raster"),u=t.colorModeForRenderPass(),l=a instanceof k?[{},n]:t.stencilConfigForOverlap(n),c=l[0],h=l[1],p=h[h.length-1].overscaledZ,f=!t.options.moving,d=0,g=h;d<g.length;d+=1){var y=g[d],m=t.depthModeForSublayer(y.overscaledZ-p,1===r.paint.get("raster-opacity")?St.ReadWrite:St.ReadOnly,o.LESS),v=e.getTile(y),_=t.transform.calculatePosMatrix(y.toUnwrapped(),f);v.registerFadeDuration(r.paint.get("raster-fade-duration"));var x=e.findLoadedParent(y,0),b=un(v,x,e,r,t.transform),w=void 0,E=void 0,I="nearest"===r.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;i.activeTexture.set(o.TEXTURE0),v.texture.bind(I,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.activeTexture.set(o.TEXTURE1),x?(x.texture.bind(I,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),w=Math.pow(2,x.tileID.overscaledZ-v.tileID.overscaledZ),E=[v.tileID.canonical.x*w%1,v.tileID.canonical.y*w%1]):v.texture.bind(I,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);var S=jr(_,E||[0,0],w||1,b,r);a instanceof k?s.draw(i,o.TRIANGLES,m,Ct.disabled,u,Mt.disabled,S,r.id,a.boundsBuffer,t.quadTriangleIndexBuffer,a.boundsSegments):s.draw(i,o.TRIANGLES,m,c[y.overscaledZ],u,Mt.disabled,S,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,r){var n=r.paint.get("background-color"),i=r.paint.get("background-opacity");if(0!==i){var o=t.context,a=o.gl,s=t.transform,u=s.tileSize,l=r.paint.get("background-pattern");if(!t.isPatternMissing(l)){var c=!l&&1===n.a&&1===i&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass===c){var h=Ct.disabled,p=t.depthModeForSublayer(0,"opaque"===c?St.ReadWrite:St.ReadOnly),f=t.colorModeForRenderPass(),d=t.useProgram(l?"backgroundPattern":"background"),g=s.coveringTiles({tileSize:u});l&&(o.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));for(var y=r.getCrossfadeParameters(),m=0,v=g;m<v.length;m+=1){var _=v[m],x=t.transform.calculatePosMatrix(_.toUnwrapped()),b=l?Wr(x,i,t,l,{tileID:_,tileSize:u},y):Yr(x,i,n);d.draw(o,a.TRIANGLES,p,h,f,Mt.disabled,b,r.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}}}},debug:function(t,e,r){for(var n=0;n<r.length;n++)mn(t,e,r[n])},custom:function(t,e,r){var n=t.context,i=r.implementation;if("offscreen"===t.renderPass){var o=i.prerender;o&&(t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),o.call(i,n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass){t.setCustomLayerDefaults(),n.setColorMode(t.colorModeForRenderPass()),n.setStencilMode(Ct.disabled);var a="3d"===i.renderingMode?new St(t.context.gl.LEQUAL,St.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,St.ReadOnly);n.setDepthMode(a),i.render(n.gl,t.transform.customLayerMatrix()),n.setDirty(),t.setBaseState(),n.bindFramebuffer.set(null)}}},_n=function(t,e){this.context=new Tt(t),this.transform=e,this._tileTextures={},this.setup(),this.numSublayers=Lt.maxUnderzooming+Lt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Fe,this.gpuTimers={}};_n.prototype.resize=function(e,r){if(this.width=e*t.browser.devicePixelRatio,this.height=r*t.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var n=0,i=this.style._order;n<i.length;n+=1)this.style._layers[i[n]].resize()},_n.prototype.setup=function(){var e=this.context,r=new t.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(t.EXTENT,0),r.emplaceBack(0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(r,Ge.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);var n=new t.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(n,Ge.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);var i=new t.StructArrayLayout4i8;i.emplaceBack(0,0,0,0),i.emplaceBack(t.EXTENT,0,t.EXTENT,0),i.emplaceBack(0,t.EXTENT,0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(i,A.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);var o=new t.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,Ge.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);var a=new t.StructArrayLayout1ui2;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);var s=new t.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s),this.emptyTexture=new t.Texture(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);var u=this.context.gl;this.stencilClearMode=new Ct({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO)},_n.prototype.clearStencil=function(){var e=this.context,r=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;var n=t.create();t.ortho(n,0,this.width,this.height,0,0,1),t.scale(n,n,[r.drawingBufferWidth,r.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,r.TRIANGLES,St.disabled,this.stencilClearMode,Pt.disabled,Mt.disabled,Nr(n),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},_n.prototype._renderTileClippingMasks=function(t,e){if(this.currentStencilSource!==t.source&&t.isTileClipped()&&e&&e.length){this.currentStencilSource=t.source;var r=this.context,n=r.gl;this.nextStencilID+e.length>256&&this.clearStencil(),r.setColorMode(Pt.disabled),r.setDepthMode(St.disabled);var i=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var o=0,a=e;o<a.length;o+=1){var s=a[o],u=this._tileClippingMaskIDs[s.key]=this.nextStencilID++;i.draw(r,n.TRIANGLES,St.disabled,new Ct({func:n.ALWAYS,mask:0},u,255,n.KEEP,n.KEEP,n.REPLACE),Pt.disabled,Mt.disabled,Nr(s.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}},_n.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)},_n.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)},_n.prototype.stencilConfigForOverlap=function(t){var e,r=this.context.gl,n=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),i=n[n.length-1].overscaledZ,o=n[0].overscaledZ-i+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();for(var a={},s=0;s<o;s++)a[s+i]=new Ct({func:r.GEQUAL,mask:255},s+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=o,[a,n]}return[(e={},e[i]=Ct.disabled,e),n]},_n.prototype.colorModeForRenderPass=function(){var e=this.context.gl;return this._showOverdrawInspector?new Pt([e.CONSTANT_COLOR,e.ONE],new t.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):"opaque"===this.renderPass?Pt.unblended:Pt.alphaBlended},_n.prototype.depthModeForSublayer=function(t,e,r){if(!this.opaquePassEnabledForLayer())return St.disabled;var n=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new St(r||this.context.gl.LEQUAL,e,[n,n])},_n.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},_n.prototype.render=function(e,r){var n=this;this.style=e,this.options=r,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.browser.now()),this.imageManager.beginFrame();var i=this.style._order,o=this.style.sourceCaches;for(var a in o){var s=o[a];s.used&&s.prepare(this.context)}var u,l,c={},h={},p={};for(var f in o){var d=o[f];c[f]=d.getVisibleCoordinates(),h[f]=c[f].slice().reverse(),p[f]=d.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(var g=0;g<i.length;g++)if(this.style._layers[i[g]].is3D()){this.opaquePassCutoff=g;break}this.renderPass="offscreen";for(var y=0,m=i;y<m.length;y+=1){var v=this.style._layers[m[y]];if(v.hasOffscreenPass()&&!v.isHidden(this.transform.zoom)){var _=h[v.source];("custom"===v.type||_.length)&&this.renderLayer(this,o[v.source],v,_)}}for(this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){var x=this.style._layers[i[this.currentLayer]],b=o[x.source],w=c[x.source];this._renderTileClippingMasks(x,w),this.renderLayer(this,b,x,w)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){var E=this.style._layers[i[this.currentLayer]],I=o[E.source],S=("symbol"===E.type?p:h)[E.source];this._renderTileClippingMasks(E,c[E.source]),this.renderLayer(this,I,E,S)}this.options.showTileBoundaries&&(t.values(this.style._layers).forEach((function(t){t.source&&!t.isHidden(n.transform.zoom)&&(t.source!==(l&&l.id)&&(l=n.style.sourceCaches[t.source]),(!u||u.getSource().maxzoom<l.getSource().maxzoom)&&(u=l))})),u&&vn.debug(this,u,u.getVisibleCoordinates())),this.options.showPadding&&function(t){var e=t.transform.padding;dn(t,t.transform.height-(e.top||0),3,ln),dn(t,e.bottom||0,3,cn),gn(t,e.left||0,3,hn),gn(t,t.transform.width-(e.right||0),3,pn);var r=t.transform.centerPoint;!function(t,e,r,n){yn(t,e-1,r-10,2,20,n),yn(t,e-10,r-1,20,2,n)}(t,r.x,t.transform.height-r.y,fn)}(this),this.context.setDefault()},_n.prototype.renderLayer=function(t,e,r,n){r.isHidden(this.transform.zoom)||("background"===r.type||"custom"===r.type||n.length)&&(this.id=r.id,this.gpuTimingStart(r),vn[r.type](t,e,r,n,this.style.placement.variableOffsets),this.gpuTimingEnd())},_n.prototype.gpuTimingStart=function(t){if(this.options.gpuTiming){var e=this.context.extTimerQuery,r=this.gpuTimers[t.id];r||(r=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:e.createQueryEXT()}),r.calls++,e.beginQueryEXT(e.TIME_ELAPSED_EXT,r.query)}},_n.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}},_n.prototype.collectGpuTimers=function(){var t=this.gpuTimers;return this.gpuTimers={},t},_n.prototype.queryGpuTimers=function(t){var e={};for(var r in t){var n=t[r],i=this.context.extTimerQuery,o=i.getQueryObjectEXT(n.query,i.QUERY_RESULT_EXT)/1e6;i.deleteQueryEXT(n.query),e[r]=o}return e},_n.prototype.translatePosMatrix=function(e,r,n,i,o){if(!n[0]&&!n[1])return e;var a=o?"map"===i?this.transform.angle:0:"viewport"===i?-this.transform.angle:0;if(a){var s=Math.sin(a),u=Math.cos(a);n=[n[0]*u-n[1]*s,n[0]*s+n[1]*u]}var l=[o?n[0]:pe(r,n[0],this.transform.zoom),o?n[1]:pe(r,n[1],this.transform.zoom),0],c=new Float32Array(16);return t.translate(c,e,l),c},_n.prototype.saveTileTexture=function(t){var e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]},_n.prototype.getTileTexture=function(t){var e=this._tileTextures[t];return e&&e.length>0?e.pop():null},_n.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r},_n.prototype.useProgram=function(t,e){this.cache=this.cache||{};var r=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new br(this.context,t,vr[t],e,Hr[t],this._showOverdrawInspector)),this.cache[r]},_n.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()},_n.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)},_n.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},_n.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var xn=function(t,e){this.points=t,this.planes=e};xn.fromInvProjectionMatrix=function(e,r,n){var i=Math.pow(2,n),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(r){return t.transformMat4([],r,e)})).map((function(e){return t.scale$1([],e,1/e[3]/r*i)})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var r=t.sub([],o[e[0]],o[e[1]]),n=t.sub([],o[e[2]],o[e[1]]),i=t.normalize([],t.cross([],r,n)),a=-t.dot(i,o[e[1]]);return i.concat(a)}));return new xn(o,a)};var bn=function(e,r){this.min=e,this.max=r,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};bn.prototype.quadrant=function(e){for(var r=[e%2==0,e<2],n=t.clone$2(this.min),i=t.clone$2(this.max),o=0;o<r.length;o++)n[o]=r[o]?this.min[o]:this.center[o],i[o]=r[o]?this.center[o]:this.max[o];return i[2]=this.max[2],new bn(n,i)},bn.prototype.distanceX=function(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]},bn.prototype.distanceY=function(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]},bn.prototype.intersects=function(e){for(var r=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]],n=!0,i=0;i<e.planes.length;i++){for(var o=e.planes[i],a=0,s=0;s<r.length;s++)a+=t.dot$1(o,r[s])>=0;if(0===a)return 0;a!==r.length&&(n=!1)}if(n)return 2;for(var u=0;u<3;u++){for(var l=Number.MAX_VALUE,c=-Number.MAX_VALUE,h=0;h<e.points.length;h++){var p=e.points[h][u]-this.min[u];l=Math.min(l,p),c=Math.max(c,p)}if(c<0||l>this.max[u]-this.min[u])return 0}return 1};var wn=function(t,e,r,n){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=n};wn.prototype.interpolate=function(e,r,n){return null!=r.top&&null!=e.top&&(this.top=t.number(e.top,r.top,n)),null!=r.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,r.bottom,n)),null!=r.left&&null!=e.left&&(this.left=t.number(e.left,r.left,n)),null!=r.right&&null!=e.right&&(this.right=t.number(e.right,r.right,n)),this},wn.prototype.getCenter=function(e,r){var n=t.clamp((this.left+e-this.right)/2,0,e),i=t.clamp((this.top+r-this.bottom)/2,0,r);return new t.Point(n,i)},wn.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},wn.prototype.clone=function(){return new wn(this.top,this.bottom,this.left,this.right)},wn.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var En=function(e,r,n,i,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||o,this._minZoom=e||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==i?60:i,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._edgeInsets=new wn,this._posMatrixCache={},this._alignedPosMatrixCache={}},In={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};En.prototype.clone=function(){var t=new En(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._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},In.minZoom.get=function(){return this._minZoom},In.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},In.maxZoom.get=function(){return this._maxZoom},In.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},In.minPitch.get=function(){return this._minPitch},In.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},In.maxPitch.get=function(){return this._maxPitch},In.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},In.renderWorldCopies.get=function(){return this._renderWorldCopies},In.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},In.worldSize.get=function(){return this.tileSize*this.scale},In.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},In.size.get=function(){return new t.Point(this.width,this.height)},In.bearing.get=function(){return-this.angle/Math.PI*180},In.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},In.pitch.get=function(){return this._pitch/Math.PI*180},In.pitch.set=function(e){var r=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},In.fov.get=function(){return this._fov/Math.PI*180},In.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())},In.zoom.get=function(){return this._zoom},In.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())},In.center.get=function(){return this._center},In.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},In.padding.get=function(){return this._edgeInsets.toJSON()},In.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},In.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},En.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},En.prototype.interpolatePadding=function(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()},En.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)},En.prototype.getVisibleUnwrappedCoordinates=function(e){var r=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var n=this.pointCoordinate(new t.Point(0,0)),i=this.pointCoordinate(new t.Point(this.width,0)),o=this.pointCoordinate(new t.Point(this.width,this.height)),a=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(n.x,i.x,o.x,a.x)),u=Math.floor(Math.max(n.x,i.x,o.x,a.x)),l=s-1;l<=u+1;l++)0!==l&&r.push(new t.UnwrappedTileID(l,e));return r},En.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&r<e.minzoom)return[];void 0!==e.maxzoom&&r>e.maxzoom&&(r=e.maxzoom);var i=t.MercatorCoordinate.fromLngLat(this.center),o=Math.pow(2,r),a=[o*i.x,o*i.y,0],s=xn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r),u=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(u=r);var l=function(t){return{aabb:new bn([t*o,0,0],[(t+1)*o,o,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},c=[],h=[],p=r,f=e.reparseOverscaled?n:r;if(this._renderWorldCopies)for(var d=1;d<=3;d++)c.push(l(-d)),c.push(l(d));for(c.push(l(0));c.length>0;){var g=c.pop(),y=g.x,m=g.y,v=g.fullyVisible;if(!v){var _=g.aabb.intersects(s);if(0===_)continue;v=2===_}var x=g.aabb.distanceX(a),b=g.aabb.distanceY(a),w=Math.max(Math.abs(x),Math.abs(b));if(g.zoom===p||w>3+(1<<p-g.zoom)-2&&g.zoom>=u)h.push({tileID:new t.OverscaledTileID(g.zoom===p?f:g.zoom,g.wrap,g.zoom,y,m),distanceSq:t.sqrLen([a[0]-.5-y,a[1]-.5-m])});else for(var E=0;E<4;E++){var I=(y<<1)+E%2,S=(m<<1)+(E>>1);c.push({aabb:g.aabb.quadrant(E),zoom:g.zoom+1,x:I,y:S,wrap:g.wrap,fullyVisible:v})}}return h.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},En.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},In.unmodified.get=function(){return this._unmodified},En.prototype.zoomScale=function(t){return Math.pow(2,t)},En.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},En.prototype.project=function(e){var r=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(r)*this.worldSize)},En.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},In.point.get=function(){return this.project(this.center)},En.prototype.setLocationAtPoint=function(e,r){var n=this.pointCoordinate(r),i=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(n.x-i.x),o.y-(n.y-i.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())},En.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},En.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},En.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},En.prototype.coordinateLocation=function(t){return t.toLngLat()},En.prototype.pointCoordinate=function(e){var r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],o=n[3],a=r[1]/i,s=n[1]/o,u=r[2]/i,l=n[2]/o,c=u===l?0:(0-u)/(l-u);return new t.MercatorCoordinate(t.number(r[0]/i,n[0]/o,c)/this.worldSize,t.number(a,s,c)/this.worldSize)},En.prototype.coordinatePoint=function(e){var r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix),new t.Point(r[0]/r[3],r[1]/r[3])},En.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)))},En.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},En.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])},En.prototype.calculatePosMatrix=function(e,r){void 0===r&&(r=!1);var n=e.key,i=r?this._alignedPosMatrixCache:this._posMatrixCache;if(i[n])return i[n];var o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,u=t.identity(new Float64Array(16));return t.translate(u,u,[s*a,o.y*a,0]),t.scale(u,u,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(u,r?this.alignedProjMatrix:this.projMatrix,u),i[n]=new Float32Array(u),i[n]},En.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},En.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,r,n,i,o=-90,a=90,s=-180,u=180,l=this.size,c=this._unmodified;if(this.latRange){var h=this.latRange;o=t.mercatorYfromLat(h[1])*this.worldSize,e=(a=t.mercatorYfromLat(h[0])*this.worldSize)-o<l.y?l.y/(a-o):0}if(this.lngRange){var p=this.lngRange;s=t.mercatorXfromLng(p[0])*this.worldSize,r=(u=t.mercatorXfromLng(p[1])*this.worldSize)-s<l.x?l.x/(u-s):0}var f=this.point,d=Math.max(r||0,e||0);if(d)return this.center=this.unproject(new t.Point(r?(u+s)/2:f.x,e?(a+o)/2:f.y)),this.zoom+=this.scaleZoom(d),this._unmodified=c,void(this._constraining=!1);if(this.latRange){var g=f.y,y=l.y/2;g-y<o&&(i=o+y),g+y>a&&(i=a-y)}if(this.lngRange){var m=f.x,v=l.x/2;m-v<s&&(n=s+v),m+v>u&&(n=u-v)}void 0===n&&void 0===i||(this.center=this.unproject(new t.Point(void 0!==n?n:f.x,void 0!==i?i:f.y))),this._unmodified=c,this._constraining=!1}},En.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var r=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),i=Math.sin(n)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-r-n,.01,Math.PI-.01)),o=this.point,a=o.x,s=o.y,u=1.01*(Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance),l=this.height/50,c=new Float64Array(16);t.perspective(c,this._fov,this.width/this.height,l,u),c[8]=2*-e.x/this.width,c[9]=2*e.y/this.height,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,-s,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,this.invProjMatrix=t.invert([],this.projMatrix);var h=this.width%2/2,p=this.height%2/2,f=Math.cos(this.angle),d=Math.sin(this.angle),g=a-Math.round(a)+f*h+d*p,y=s-Math.round(s)+f*p+d*h,m=new Float64Array(c);if(t.translate(m,m,[g>.5?g-1:g,y>.5?y-1:y,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={}}},En.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},En.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},En.prototype.getCameraQueryGeometry=function(e){var r=this.getCameraPoint();if(1===e.length)return[e[0],r];for(var n=r.x,i=r.y,o=r.x,a=r.y,s=0,u=e;s<u.length;s+=1){var l=u[s];n=Math.min(n,l.x),i=Math.min(i,l.y),o=Math.max(o,l.x),a=Math.max(a,l.y)}return[new t.Point(n,i),new t.Point(o,i),new t.Point(o,a),new t.Point(n,a),new t.Point(n,i)]},Object.defineProperties(En.prototype,In);var Sn=function(e){var r,n,i,o;this._hashName=e&&encodeURIComponent(e),t.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(r=this._updateHashUnthrottled.bind(this),n=!1,i=null,o=function(){i=null,n&&(r(),i=setTimeout(o,300),n=!1)},function(){return n=!0,i||o(),i})};Sn.prototype.addTo=function(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Sn.prototype.remove=function(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Sn.prototype.getHashString=function(e){var r=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,i),a=Math.round(r.lng*o)/o,s=Math.round(r.lat*o)/o,u=this._map.getBearing(),l=this._map.getPitch(),c="";if(c+=e?"/"+a+"/"+s+"/"+n:n+"/"+s+"/"+a,(u||l)&&(c+="/"+Math.round(10*u)/10),l&&(c+="/"+Math.round(l)),this._hashName){var h=this._hashName,p=!1,f=t.window.location.hash.slice(1).split("&").map((function(t){var e=t.split("=")[0];return e===h?(p=!0,e+"="+c):t})).filter((function(t){return t}));return p||f.push(h+"="+c),"#"+f.join("&")}return"#"+c},Sn.prototype._getCurrentHash=function(){var e,r=this,n=t.window.location.hash.replace("#","");return this._hashName?(n.split("&").map((function(t){return t.split("=")})).forEach((function(t){t[0]===r._hashName&&(e=t)})),(e&&e[1]||"").split("/")):n.split("/")},Sn.prototype._onHashChange=function(){var t=this._getCurrentHash();if(t.length>=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},Sn.prototype._updateHashUnthrottled=function(){var e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());try{t.window.history.replaceState(t.window.history.state,null,e)}catch(t){}};var Cn={linearity:.3,easing:t.bezier(0,0,.3,1)},Pn=t.extend({deceleration:2500,maxSpeed:1400},Cn),Mn=t.extend({deceleration:20,maxSpeed:1400},Cn),Tn=t.extend({deceleration:1e3,maxSpeed:360},Cn),Ln=t.extend({deceleration:1e3,maxSpeed:90},Cn),An=function(t){this._map=t,this.clear()};function kn(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function Nn(e,r,n){var i=n.maxSpeed,o=n.linearity,a=n.deceleration,s=t.clamp(e*o/(r/1e3),-i,i),u=Math.abs(s)/(a*o);return{easing:n.easing,duration:1e3*u,amount:s*(u/2)}}An.prototype.clear=function(){this._inertiaBuffer=[]},An.prototype.record=function(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:t.browser.now(),settings:e})},An.prototype._drainInertiaBuffer=function(){for(var e=this._inertiaBuffer,r=t.browser.now();e.length>0&&r-e[0].time>160;)e.shift()},An.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var r={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},n=0,i=this._inertiaBuffer;n<i.length;n+=1){var o=i[n].settings;r.zoom+=o.zoomDelta||0,r.bearing+=o.bearingDelta||0,r.pitch+=o.pitchDelta||0,o.panDelta&&r.pan._add(o.panDelta),o.around&&(r.around=o.around),o.pinchAround&&(r.pinchAround=o.pinchAround)}var a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(r.pan.mag()){var u=Nn(r.pan.mag(),a,t.extend({},Pn,e||{}));s.offset=r.pan.mult(u.amount/r.pan.mag()),s.center=this._map.transform.center,kn(s,u)}if(r.zoom){var l=Nn(r.zoom,a,Mn);s.zoom=this._map.transform.zoom+l.amount,kn(s,l)}if(r.bearing){var c=Nn(r.bearing,a,Tn);s.bearing=this._map.transform.bearing+t.clamp(c.amount,-179,179),kn(s,c)}if(r.pitch){var h=Nn(r.pitch,a,Ln);s.pitch=this._map.transform.pitch+h.amount,kn(s,h)}if(s.zoom||s.bearing){var p=void 0===r.pinchAround?r.around:r.pinchAround;s.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),t.extend(s,{noMoveStart:!0})}};var Dn=function(e){function n(n,i,o,a){void 0===a&&(a={});var s=r.mousePos(i.getCanvasContainer(),o),u=i.unproject(s);e.call(this,n,t.extend({point:s,lngLat:u,originalEvent:o},a)),this._defaultPrevented=!1,this.target=i}e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n;var i={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,i),n}(t.Event),Rn=function(e){function n(n,i,o){var a="touchend"===n?o.changedTouches:o.touches,s=r.touchPos(i.getCanvasContainer(),a),u=s.map((function(t){return i.unproject(t)})),l=s.reduce((function(t,e,r,n){return t.add(e.div(n.length))}),new t.Point(0,0)),c=i.unproject(l);e.call(this,n,{points:s,point:l,lngLats:u,lngLat:c,originalEvent:o}),this._defaultPrevented=!1}e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n;var i={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,i),n}(t.Event),On=function(t){function e(e,r,n){t.call(this,e,{originalEvent:n}),this._defaultPrevented=!1}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,r),e}(t.Event),zn=function(t,e){this._map=t,this._clickTolerance=e.clickTolerance};zn.prototype.reset=function(){delete this._mousedownPos},zn.prototype.wheel=function(t){return this._firePreventable(new On(t.type,this._map,t))},zn.prototype.mousedown=function(t,e){return this._mousedownPos=e,this._firePreventable(new Dn(t.type,this._map,t))},zn.prototype.mouseup=function(t){this._map.fire(new Dn(t.type,this._map,t))},zn.prototype.click=function(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Dn(t.type,this._map,t))},zn.prototype.dblclick=function(t){return this._firePreventable(new Dn(t.type,this._map,t))},zn.prototype.mouseover=function(t){this._map.fire(new Dn(t.type,this._map,t))},zn.prototype.mouseout=function(t){this._map.fire(new Dn(t.type,this._map,t))},zn.prototype.touchstart=function(t){return this._firePreventable(new Rn(t.type,this._map,t))},zn.prototype.touchmove=function(t){this._map.fire(new Rn(t.type,this._map,t))},zn.prototype.touchend=function(t){this._map.fire(new Rn(t.type,this._map,t))},zn.prototype.touchcancel=function(t){this._map.fire(new Rn(t.type,this._map,t))},zn.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},zn.prototype.isEnabled=function(){return!0},zn.prototype.isActive=function(){return!1},zn.prototype.enable=function(){},zn.prototype.disable=function(){};var Fn=function(t){this._map=t};Fn.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Fn.prototype.mousemove=function(t){this._map.fire(new Dn(t.type,this._map,t))},Fn.prototype.mousedown=function(){this._delayContextMenu=!0},Fn.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Dn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Fn.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Dn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},Fn.prototype.isEnabled=function(){return!0},Fn.prototype.isActive=function(){return!1},Fn.prototype.enable=function(){},Fn.prototype.disable=function(){};var Bn=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function Un(t,e){for(var r={},n=0;n<t.length;n++)r[t[n].identifier]=e[n];return r}Bn.prototype.isEnabled=function(){return!!this._enabled},Bn.prototype.isActive=function(){return!!this._active},Bn.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Bn.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Bn.prototype.mousedown=function(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(r.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)},Bn.prototype.mousemoveWindow=function(t,e){if(this._active){var n=e;if(!(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)){var i=this._startPos;this._lastPos=n,this._box||(this._box=r.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var o=Math.min(i.x,n.x),a=Math.max(i.x,n.x),s=Math.min(i.y,n.y),u=Math.max(i.y,n.y);r.setTransform(this._box,"translate("+o+"px,"+s+"px)"),this._box.style.width=a-o+"px",this._box.style.height=u-s+"px"}}},Bn.prototype.mouseupWindow=function(e,n){var i=this;if(this._active&&0===e.button){var o=this._startPos,a=n;if(this.reset(),r.suppressClick(),o.x!==a.x||o.y!==a.y)return this._map.fire(new t.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:function(t){return t.fitScreenCoordinates(o,a,i._map.getBearing(),{linear:!0})}};this._fireEvent("boxzoomcancel",e)}},Bn.prototype.keydown=function(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))},Bn.prototype.reset=function(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(r.remove(this._box),this._box=null),r.enableDrag(),delete this._startPos,delete this._lastPos},Bn.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,{originalEvent:r}))};var jn=function(t){this.reset(),this.numTouches=t.numTouches};jn.prototype.reset=function(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1},jn.prototype.touchstart=function(e,r,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){for(var r=new t.Point(0,0),n=0,i=e;n<i.length;n+=1)r._add(i[n]);return r.div(e.length)}(r),this.touches=Un(n,r)))},jn.prototype.touchmove=function(t,e,r){if(!this.aborted&&this.centroid){var n=Un(r,e);for(var i in this.touches){var o=n[i];(!o||o.dist(this.touches[i])>30)&&(this.aborted=!0)}}},jn.prototype.touchend=function(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){var n=!this.aborted&&this.centroid;if(this.reset(),n)return n}};var Vn=function(t){this.singleTap=new jn(t),this.numTaps=t.numTaps,this.reset()};Vn.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},Vn.prototype.touchstart=function(t,e,r){this.singleTap.touchstart(t,e,r)},Vn.prototype.touchmove=function(t,e,r){this.singleTap.touchmove(t,e,r)},Vn.prototype.touchend=function(t,e,r){var n=this.singleTap.touchend(t,e,r);if(n){var i=t.timeStamp-this.lastTime<500,o=!this.lastTap||this.lastTap.dist(n)<30;if(i&&o||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}};var qn=function(){this._zoomIn=new Vn({numTouches:1,numTaps:2}),this._zoomOut=new Vn({numTouches:2,numTaps:1}),this.reset()};qn.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},qn.prototype.touchstart=function(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)},qn.prototype.touchmove=function(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)},qn.prototype.touchend=function(t,e,r){var n=this,i=this._zoomIn.touchend(t,e,r),o=this._zoomOut.touchend(t,e,r);return i?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(i)},{originalEvent:t})}}):o?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(o)},{originalEvent:t})}}):void 0},qn.prototype.touchcancel=function(){this.reset()},qn.prototype.enable=function(){this._enabled=!0},qn.prototype.disable=function(){this._enabled=!1,this.reset()},qn.prototype.isEnabled=function(){return this._enabled},qn.prototype.isActive=function(){return this._active};var Gn={0:1,2:2},Xn=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};Xn.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},Xn.prototype._correctButton=function(t,e){return!1},Xn.prototype._move=function(t,e){return{}},Xn.prototype.mousedown=function(t,e){if(!this._lastPoint){var n=r.mouseButton(t);this._correctButton(t,n)&&(this._lastPoint=e,this._eventButton=n)}},Xn.prototype.mousemoveWindow=function(t,e){var r=this._lastPoint;if(r)if(t.preventDefault(),function(t,e){var r=Gn[e];return void 0===t.buttons||(t.buttons&r)!==r}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=e,this._move(r,e)},Xn.prototype.mouseupWindow=function(t){this._lastPoint&&r.mouseButton(t)===this._eventButton&&(this._moved&&r.suppressClick(),this.reset())},Xn.prototype.enable=function(){this._enabled=!0},Xn.prototype.disable=function(){this._enabled=!1,this.reset()},Xn.prototype.isEnabled=function(){return this._enabled},Xn.prototype.isActive=function(){return this._active};var Zn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.mousedown=function(e,r){t.prototype.mousedown.call(this,e,r),this._lastPoint&&(this._active=!0)},e.prototype._correctButton=function(t,e){return 0===e&&!t.ctrlKey},e.prototype._move=function(t,e){return{around:e,panDelta:e.sub(t)}},e}(Xn),Yn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._correctButton=function(t,e){return 0===e&&t.ctrlKey||2===e},e.prototype._move=function(t,e){var r=.8*(e.x-t.x);if(r)return this._active=!0,{bearingDelta:r}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(Xn),Wn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._correctButton=function(t,e){return 0===e&&t.ctrlKey||2===e},e.prototype._move=function(t,e){var r=-.5*(e.y-t.y);if(r)return this._active=!0,{pitchDelta:r}},e.prototype.contextmenu=function(t){t.preventDefault()},e}(Xn),Hn=function(t){this._minTouches=1,this._clickTolerance=t.clickTolerance||1,this.reset()};Hn.prototype.reset=function(){this._active=!1,this._touches={},this._sum=new t.Point(0,0)},Hn.prototype.touchstart=function(t,e,r){return this._calculateTransform(t,e,r)},Hn.prototype.touchmove=function(t,e,r){if(this._active&&!(r.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,e,r)},Hn.prototype.touchend=function(t,e,r){this._calculateTransform(t,e,r),this._active&&r.length<this._minTouches&&this.reset()},Hn.prototype.touchcancel=function(){this.reset()},Hn.prototype._calculateTransform=function(e,r,n){n.length>0&&(this._active=!0);var i=Un(n,r),o=new t.Point(0,0),a=new t.Point(0,0),s=0;for(var u in i){var l=i[u],c=this._touches[u];c&&(o._add(l),a._add(l.sub(c)),s++,i[u]=l)}if(this._touches=i,!(s<this._minTouches)&&a.mag()){var h=a.div(s);if(this._sum._add(h),!(this._sum.mag()<this._clickTolerance))return{around:o.div(s),panDelta:h}}},Hn.prototype.enable=function(){this._enabled=!0},Hn.prototype.disable=function(){this._enabled=!1,this.reset()},Hn.prototype.isEnabled=function(){return this._enabled},Hn.prototype.isActive=function(){return this._active};var Jn=function(){this.reset()};function Kn(t,e,r){for(var n=0;n<t.length;n++)if(t[n].identifier===r)return e[n]}function $n(t,e){return Math.log(t/e)/Math.LN2}Jn.prototype.reset=function(){this._active=!1,delete this._firstTwoTouches},Jn.prototype._start=function(t){},Jn.prototype._move=function(t,e,r){return{}},Jn.prototype.touchstart=function(t,e,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([e[0],e[1]]))},Jn.prototype.touchmove=function(t,e,r){if(this._firstTwoTouches){t.preventDefault();var n=this._firstTwoTouches,i=n[1],o=Kn(r,e,n[0]),a=Kn(r,e,i);if(o&&a){var s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,t)}}},Jn.prototype.touchend=function(t,e,n){if(this._firstTwoTouches){var i=this._firstTwoTouches,o=i[1],a=Kn(n,e,i[0]),s=Kn(n,e,o);a&&s||(this._active&&r.suppressClick(),this.reset())}},Jn.prototype.touchcancel=function(){this.reset()},Jn.prototype.enable=function(t){this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around},Jn.prototype.disable=function(){this._enabled=!1,this.reset()},Jn.prototype.isEnabled=function(){return this._enabled},Jn.prototype.isActive=function(){return this._active};var Qn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),delete this._distance,delete this._startDistance},e.prototype._start=function(t){this._startDistance=this._distance=t[0].dist(t[1])},e.prototype._move=function(t,e){var r=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs($n(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:$n(this._distance,r),pinchAround:e}},e}(Jn);function ti(t,e){return 180*t.angleWith(e)/Math.PI}var ei=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),delete this._minDiameter,delete this._startVector,delete this._vector},e.prototype._start=function(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])},e.prototype._move=function(t,e){var r=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ti(this._vector,r),pinchAround:e}},e.prototype._isBelowThreshold=function(t){this._minDiameter=Math.min(this._minDiameter,t.mag());var e=25/(Math.PI*this._minDiameter)*360,r=ti(t,this._startVector);return Math.abs(r)<e},e}(Jn);function ri(t){return Math.abs(t.y)>Math.abs(t.x)}var ni=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},e.prototype._start=function(t){this._lastPoints=t,ri(t[0].sub(t[1]))&&(this._valid=!1)},e.prototype._move=function(t,e,r){var n=t[0].sub(this._lastPoints[0]),i=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(n,i,r.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+i.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,r){if(void 0!==this._valid)return this._valid;var n=t.mag()>=2,i=e.mag()>=2;if(n||i){if(!n||!i)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;var o=t.y>0==e.y>0;return ri(t)&&ri(e)&&o}},e}(Jn),ii={panStep:100,bearingStep:15,pitchStep:10},oi=function(){var t=ii;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1};function ai(t){return t*(2-t)}oi.prototype.reset=function(){this._active=!1},oi.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var r=0,n=0,i=0,o=0,a=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),o=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),a=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,i=0),{cameraAnimation:function(s){var u=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:ai,zoom:r?Math.round(u)+r*(t.shiftKey?2:1):u,bearing:s.getBearing()+n*e._bearingStep,pitch:s.getPitch()+i*e._pitchStep,offset:[-o*e._panStep,-a*e._panStep],center:s.getCenter()},{originalEvent:t})}}}},oi.prototype.enable=function(){this._enabled=!0},oi.prototype.disable=function(){this._enabled=!1,this.reset()},oi.prototype.isEnabled=function(){return this._enabled},oi.prototype.isActive=function(){return this._active},oi.prototype.disableRotation=function(){this._rotationDisabled=!0},oi.prototype.enableRotation=function(){this._rotationDisabled=!1};var si=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._handler=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onTimeout"],this)};si.prototype.setZoomRate=function(t){this._defaultZoomRate=t},si.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},si.prototype.isEnabled=function(){return!!this._enabled},si.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},si.prototype.isZooming=function(){return!!this._zooming},si.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},si.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},si.prototype.wheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.browser.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this._active||this._start(e)),e.preventDefault()}},si.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},si.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var n=r.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},si.prototype.renderFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==i&&(i=1/i);var o="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(o*i))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a,s="number"==typeof this._targetZoom?this._targetZoom:r.zoom,u=this._startZoom,l=this._easing,c=!1;if("wheel"===this._type&&u&&l){var h=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),p=l(h);a=t.number(u,s,p),h<1?this._frameId||(this._frameId=!0):c=!0}else a=s,c=!0;return this._active=!0,c&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!c,zoomDelta:a-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},si.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,i=(t.browser.now()-n.start)/n.duration,o=n.easing(i+.01)-n.easing(i),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);r=t.bezier(a,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:r},r},si.prototype.reset=function(){this._active=!1};var ui=function(t,e){this._clickZoom=t,this._tapZoom=e};ui.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},ui.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},ui.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},ui.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var li=function(){this.reset()};li.prototype.reset=function(){this._active=!1},li.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(r){r.easeTo({duration:300,zoom:r.getZoom()+(t.shiftKey?-1:1),around:r.unproject(e)},{originalEvent:t})}}},li.prototype.enable=function(){this._enabled=!0},li.prototype.disable=function(){this._enabled=!1,this.reset()},li.prototype.isEnabled=function(){return this._enabled},li.prototype.isActive=function(){return this._active};var ci=function(){this._tap=new Vn({numTouches:1,numTaps:1}),this.reset()};ci.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},ci.prototype.touchstart=function(t,e,r){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=e[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(t,e,r))},ci.prototype.touchmove=function(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;var n=e[0],i=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:i/128}}}else this._tap.touchmove(t,e,r)},ci.prototype.touchend=function(t,e,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(t,e,r)&&(this._tapTime=t.timeStamp)},ci.prototype.touchcancel=function(){this.reset()},ci.prototype.enable=function(){this._enabled=!0},ci.prototype.disable=function(){this._enabled=!1,this.reset()},ci.prototype.isEnabled=function(){return this._enabled},ci.prototype.isActive=function(){return this._active};var hi=function(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r};hi.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")},hi.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")},hi.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},hi.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var pi=function(t,e,r){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=r};pi.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},pi.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},pi.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},pi.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var fi=function(t,e,r,n){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0};fi.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")},fi.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")},fi.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},fi.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},fi.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},fi.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var di=function(t){return t.zoom||t.drag||t.pitch||t.rotate},gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function yi(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var mi=function(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new An(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),t.bindAll(["handleEvent","handleWindowEvent"],this);var i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[t.window,"blur",void 0]];for(var o=0,a=this._listeners;o<a.length;o+=1){var s=a[o],u=s[0];r.addEventListener(u,s[1],u===t.window.document?this.handleWindowEvent:this.handleEvent,s[2])}};mi.prototype.destroy=function(){for(var e=0,n=this._listeners;e<n.length;e+=1){var i=n[e],o=i[0];r.removeEventListener(o,i[1],o===t.window.document?this.handleWindowEvent:this.handleEvent,i[2])}},mi.prototype._addDefaultHandlers=function(t){var e=this._map,r=e.getCanvasContainer();this._add("mapEvent",new zn(e,t));var n=e.boxZoom=new Bn(e,t);this._add("boxZoom",n);var i=new qn,o=new li;e.doubleClickZoom=new ui(o,i),this._add("tapZoom",i),this._add("clickZoom",o);var a=new ci;this._add("tapDragZoom",a);var s=e.touchPitch=new ni;this._add("touchPitch",s);var u=new Yn(t),l=new Wn(t);e.dragRotate=new pi(t,u,l),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",l,["mouseRotate"]);var c=new Zn(t),h=new Hn(t);e.dragPan=new hi(r,c,h),this._add("mousePan",c),this._add("touchPan",h,["touchZoom","touchRotate"]);var p=new ei,f=new Qn;e.touchZoomRotate=new fi(r,f,p,a),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",f,["touchPan","touchRotate"]);var d=e.scrollZoom=new si(e,this);this._add("scrollZoom",d,["mousePan"]);var g=e.keyboard=new oi;this._add("keyboard",g),this._add("blockableMapEvent",new Fn(e));for(var y=0,m=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];y<m.length;y+=1){var v=m[y];t.interactive&&t[v]&&e[v].enable(t[v])}},mi.prototype._add=function(t,e,r){this._handlers.push({handlerName:t,handler:e,allowed:r}),this._handlersById[t]=e},mi.prototype.stop=function(t){if(!this._updatingCamera){for(var e=0,r=this._handlers;e<r.length;e+=1)r[e].handler.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}},mi.prototype.isActive=function(){for(var t=0,e=this._handlers;t<e.length;t+=1)if(e[t].handler.isActive())return!0;return!1},mi.prototype.isZooming=function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()},mi.prototype.isRotating=function(){return!!this._eventsInProgress.rotate},mi.prototype.isMoving=function(){return Boolean(di(this._eventsInProgress))||this.isZooming()},mi.prototype._blockedByActive=function(t,e,r){for(var n in t)if(n!==r&&(!e||e.indexOf(n)<0))return!0;return!1},mi.prototype.handleWindowEvent=function(t){this.handleEvent(t,t.type+"Window")},mi.prototype._getMapTouches=function(t){for(var e=[],r=0,n=t;r<n.length;r+=1){var i=n[r];this._el.contains(i.target)&&e.push(i)}return e},mi.prototype.handleEvent=function(t,e){if("blur"!==t.type){this._updatingCamera=!0;for(var n="renderFrame"===t.type?void 0:t,i={needsRenderFrame:!1},o={},a={},s=t.touches?this._getMapTouches(t.touches):void 0,u=s?r.touchPos(this._el,s):r.mousePos(this._el,t),l=0,c=this._handlers;l<c.length;l+=1){var h=c[l],p=h.handlerName,f=h.handler,d=h.allowed;if(f.isEnabled()){var g=void 0;this._blockedByActive(a,d,p)?f.reset():f[e||t.type]&&(g=f[e||t.type](t,u,s),this.mergeHandlerResult(i,o,g,p,n),g&&g.needsRenderFrame&&this._triggerRenderFrame()),(g||f.isActive())&&(a[p]=f)}}var y={};for(var m in this._previousActiveHandlers)a[m]||(y[m]=n);this._previousActiveHandlers=a,(Object.keys(y).length||yi(i))&&(this._changes.push([i,o,y]),this._triggerRenderFrame()),(Object.keys(a).length||yi(i))&&this._map._stop(!0),this._updatingCamera=!1;var v=i.cameraAnimation;v&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],v(this._map))}else this.stop(!0)},mi.prototype.mergeHandlerResult=function(e,r,n,i,o){if(n){t.extend(e,n);var a={handlerName:i,originalEvent:n.originalEvent||o};void 0!==n.zoomDelta&&(r.zoom=a),void 0!==n.panDelta&&(r.drag=a),void 0!==n.pitchDelta&&(r.pitch=a),void 0!==n.bearingDelta&&(r.rotate=a)}},mi.prototype._applyChanges=function(){for(var e={},r={},n={},i=0,o=this._changes;i<o.length;i+=1){var a=o[i],s=a[0],u=a[1],l=a[2];s.panDelta&&(e.panDelta=(e.panDelta||new t.Point(0,0))._add(s.panDelta)),s.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(e.around=s.around),void 0!==s.pinchAround&&(e.pinchAround=s.pinchAround),s.noInertia&&(e.noInertia=s.noInertia),t.extend(r,u),t.extend(n,l)}this._updateMapTransform(e,r,n),this._changes=[]},mi.prototype._updateMapTransform=function(t,e,r){var n=this._map,i=n.transform;if(!yi(t))return this._fireEvents(e,r,!0);var o=t.panDelta,a=t.zoomDelta,s=t.bearingDelta,u=t.pitchDelta,l=t.around,c=t.pinchAround;void 0!==c&&(l=c),n._stop(!0),l=l||n.transform.centerPoint;var h=i.pointLocation(o?l.sub(o):l);s&&(i.bearing+=s),u&&(i.pitch+=u),a&&(i.zoom+=a),i.setLocationAtPoint(h,l),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,r,!0)},mi.prototype._fireEvents=function(e,r,n){var i=this,o=di(this._eventsInProgress),a=di(e),s={};for(var u in e)this._eventsInProgress[u]||(s[u+"start"]=e[u].originalEvent),this._eventsInProgress[u]=e[u];for(var l in!o&&a&&this._fireEvent("movestart",a.originalEvent),s)this._fireEvent(l,s[l]);for(var c in a&&this._fireEvent("move",a.originalEvent),e)this._fireEvent(c,e[c].originalEvent);var h,p={};for(var f in this._eventsInProgress){var d=this._eventsInProgress[f],g=d.handlerName,y=d.originalEvent;this._handlersById[g].isActive()||(delete this._eventsInProgress[f],p[f+"end"]=h=r[g]||y)}for(var m in p)this._fireEvent(m,p[m]);var v=di(this._eventsInProgress);if(n&&(o||a)&&!v){this._updatingCamera=!0;var _=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),x=function(t){return 0!==t&&-i._bearingSnap<t&&t<i._bearingSnap};_?(x(_.bearing||this._map.getBearing())&&(_.bearing=0),this._map.easeTo(_,{originalEvent:h})):(this._map.fire(new t.Event("moveend",{originalEvent:h})),x(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}},mi.prototype._fireEvent=function(e,r){this._map.fire(new t.Event(e,r?{originalEvent:r}:{}))},mi.prototype._requestFrame=function(){var t=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add((function(e){delete t._frameId,t.handleEvent(new gi("renderFrame",{timeStamp:e})),t._applyChanges()}))},mi.prototype._triggerRenderFrame=function(){void 0===this._frameId&&(this._frameId=this._requestFrame())};var vi=function(e){function r(r,n){e.call(this),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.getCenter=function(){return new t.LngLat(this.transform.center.lng,this.transform.center.lat)},r.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},r.prototype.panBy=function(e,r,n){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},r),n)},r.prototype.panTo=function(e,r,n){return this.easeTo(t.extend({center:e},r),n)},r.prototype.getZoom=function(){return this.transform.zoom},r.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},r.prototype.zoomTo=function(e,r,n){return this.easeTo(t.extend({zoom:e},r),n)},r.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},r.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},r.prototype.getBearing=function(){return this.transform.bearing},r.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},r.prototype.getPadding=function(){return this.transform.padding},r.prototype.setPadding=function(t,e){return this.jumpTo({padding:t},e),this},r.prototype.rotateTo=function(e,r,n){return this.easeTo(t.extend({bearing:e},r),n)},r.prototype.resetNorth=function(e,r){return this.rotateTo(0,t.extend({duration:1e3},e),r),this},r.prototype.resetNorthPitch=function(e,r){return this.easeTo(t.extend({bearing:0,pitch:0,duration:1e3},e),r),this},r.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this},r.prototype.getPitch=function(){return this.transform.pitch},r.prototype.setPitch=function(t,e){return this.jumpTo({pitch:t},e),this},r.prototype.cameraForBounds=function(e,r){e=t.LngLatBounds.convert(e);var n=r&&r.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),n,r)},r.prototype._cameraForBoxAndBearing=function(e,r,n,i){var o={top:0,bottom:0,right:0,left:0};if("number"==typeof(i=t.extend({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding){var a=i.padding;i.padding={top:a,bottom:a,right:a,left:a}}i.padding=t.extend(o,i.padding);var s=this.transform,u=s.padding,l=s.project(t.LngLat.convert(e)),c=s.project(t.LngLat.convert(r)),h=l.rotate(-n*Math.PI/180),p=c.rotate(-n*Math.PI/180),f=new t.Point(Math.max(h.x,p.x),Math.max(h.y,p.y)),d=new t.Point(Math.min(h.x,p.x),Math.min(h.y,p.y)),g=f.sub(d),y=(s.width-(u.left+u.right+i.padding.left+i.padding.right))/g.x,m=(s.height-(u.top+u.bottom+i.padding.top+i.padding.bottom))/g.y;if(!(m<0||y<0)){var v=Math.min(s.scaleZoom(s.scale*Math.min(y,m)),i.maxZoom),_="number"==typeof i.offset.x?new t.Point(i.offset.x,i.offset.y):t.Point.convert(i.offset),x=new t.Point((i.padding.left-i.padding.right)/2,(i.padding.top-i.padding.bottom)/2).rotate(n*Math.PI/180),b=_.add(x).mult(s.scale/s.zoomScale(v));return{center:s.unproject(l.add(c).div(2).sub(b)),zoom:v,bearing:n}}t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},r.prototype.fitBounds=function(t,e,r){return this._fitInternal(this.cameraForBounds(t,e),e,r)},r.prototype.fitScreenCoordinates=function(e,r,n,i,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(r)),n,i),i,o)},r.prototype._fitInternal=function(e,r,n){return e?(delete(r=t.extend(e,r)).padding,r.linear?this.easeTo(r,n):this.flyTo(r,n)):this},r.prototype.jumpTo=function(e,r){this.stop();var n=this.transform,i=!1,o=!1,a=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(i=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=t.LngLat.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(o=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(a=!0,n.pitch=+e.pitch),null==e.padding||n.isPaddingEqual(e.padding)||(n.padding=e.padding),this.fire(new t.Event("movestart",r)).fire(new t.Event("move",r)),i&&this.fire(new t.Event("zoomstart",r)).fire(new t.Event("zoom",r)).fire(new t.Event("zoomend",r)),o&&this.fire(new t.Event("rotatestart",r)).fire(new t.Event("rotate",r)).fire(new t.Event("rotateend",r)),a&&this.fire(new t.Event("pitchstart",r)).fire(new t.Event("pitch",r)).fire(new t.Event("pitchend",r)),this.fire(new t.Event("moveend",r))},r.prototype.easeTo=function(e,r){var n=this;this._stop(!1,e.easeId),(!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate||!e.essential&&t.browser.prefersReducedMotion)&&(e.duration=0);var i=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),u=this.getPadding(),l="zoom"in e?+e.zoom:o,c="bearing"in e?this._normalizeBearing(e.bearing,a):a,h="pitch"in e?+e.pitch:s,p="padding"in e?e.padding:i.padding,f=t.Point.convert(e.offset),d=i.centerPoint.add(f),g=i.pointLocation(d),y=t.LngLat.convert(e.center||g);this._normalizeCenter(y);var m,v,_=i.project(g),x=i.project(y).sub(_),b=i.zoomScale(l-o);e.around&&(m=t.LngLat.convert(e.around),v=i.locationPoint(m));var w={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==o,this._rotating=this._rotating||a!==c,this._pitching=this._pitching||h!==s,this._padding=!i.isPaddingEqual(p),this._easeId=e.easeId,this._prepareEase(r,e.noMoveStart,w),this._ease((function(e){if(n._zooming&&(i.zoom=t.number(o,l,e)),n._rotating&&(i.bearing=t.number(a,c,e)),n._pitching&&(i.pitch=t.number(s,h,e)),n._padding&&(i.interpolatePadding(u,p,e),d=i.centerPoint.add(f)),m)i.setLocationAtPoint(m,v);else{var g=i.zoomScale(i.zoom-o),y=l>o?Math.min(2,b):Math.max(.5,b),w=Math.pow(y,1-e),E=i.unproject(_.add(x.mult(e*w)).mult(g));i.setLocationAtPoint(i.renderWorldCopies?E.wrap():E,d)}n._fireMoveEvents(r)}),(function(t){n._afterEase(r,t)}),e),this},r.prototype._prepareEase=function(e,r,n){void 0===n&&(n={}),this._moving=!0,r||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))},r.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))},r.prototype._afterEase=function(e,r){if(!this._easeId||!r||this._easeId!==r){delete this._easeId;var n=this._zooming,i=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),i&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}},r.prototype.flyTo=function(e,r){var n=this;if(!e.essential&&t.browser.prefersReducedMotion){var i=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,r)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var o=this.transform,a=this.getZoom(),s=this.getBearing(),u=this.getPitch(),l=this.getPadding(),c="zoom"in e?t.clamp(+e.zoom,o.minZoom,o.maxZoom):a,h="bearing"in e?this._normalizeBearing(e.bearing,s):s,p="pitch"in e?+e.pitch:u,f="padding"in e?e.padding:o.padding,d=o.zoomScale(c-a),g=t.Point.convert(e.offset),y=o.centerPoint.add(g),m=o.pointLocation(y),v=t.LngLat.convert(e.center||m);this._normalizeCenter(v);var _=o.project(m),x=o.project(v).sub(_),b=e.curve,w=Math.max(o.width,o.height),E=w/d,I=x.mag();if("minZoom"in e){var S=t.clamp(Math.min(e.minZoom,a,c),o.minZoom,o.maxZoom),C=w/o.zoomScale(S-a);b=Math.sqrt(C/I*2)}var P=b*b;function M(t){var e=(E*E-w*w+(t?-1:1)*P*P*I*I)/(2*(t?E:w)*P*I);return Math.log(Math.sqrt(e*e+1)-e)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function L(t){return(Math.exp(t)+Math.exp(-t))/2}var A=M(0),k=function(t){return L(A)/L(A+b*t)},N=function(t){return w*((L(A)*(T(e=A+b*t)/L(e))-T(A))/P)/I;var e},D=(M(1)-A)/b;if(Math.abs(I)<1e-6||!isFinite(D)){if(Math.abs(w-E)<1e-6)return this.easeTo(e,r);var R=E<w?-1:1;D=Math.abs(Math.log(E/w))/b,N=function(){return 0},k=function(t){return Math.exp(R*b*t)}}return e.duration="duration"in e?+e.duration:1e3*D/("screenSpeed"in e?+e.screenSpeed/b:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==h,this._pitching=p!==u,this._padding=!o.isPaddingEqual(f),this._prepareEase(r,!1),this._ease((function(e){var i=e*D,d=1/k(i);o.zoom=1===e?c:a+o.scaleZoom(d),n._rotating&&(o.bearing=t.number(s,h,e)),n._pitching&&(o.pitch=t.number(u,p,e)),n._padding&&(o.interpolatePadding(l,f,e),y=o.centerPoint.add(g));var m=1===e?v:o.unproject(_.add(x.mult(N(i))).mult(d));o.setLocationAtPoint(o.renderWorldCopies?m.wrap():m,y),n._fireMoveEvents(r)}),(function(){return n._afterEase(r)}),e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){return this._stop()},r.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,e)}if(!t){var n=this.handlers;n&&n.stop(!1)}return this},r.prototype._ease=function(e,r,n){!1===n.animate||0===n.duration?(e(1),r()):(this._easeStart=t.browser.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.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()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)<n&&(e-=360),Math.abs(e+360-r)<n&&(e+=360),e},r.prototype._normalizeCenter=function(t){var e=this.transform;if(e.renderWorldCopies&&!e.lngRange){var r=t.lng-e.center.lng;t.lng+=r>180?-360:r<-180?360:0}},r}(t.Evented),_i=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};_i.prototype.getDefaultPosition=function(){return"bottom-right"},_i.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=r.create("button","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.type="button",this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=r.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),e&&this._container.classList.add("maplibregl-compact","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},_i.prototype.onRemove=function(){r.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},_i.prototype._setElementTitle=function(t,e){var r=this._map._getUIString("AttributionControl."+e);t.title=r,t.setAttribute("aria-label",r)},_i.prototype._toggleAttribution=function(){this._container.classList.contains("maplibregl-compact-show")||this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))},_i.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var r=[{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 n=r.reduce((function(t,e,n){return e.value&&(t+=e.key+"="+e.value+(n<r.length-1?"&":"")),t}),"?");e.href=t.config.FEEDBACK_URL+"/"+n+(this._map._hash?this._map._hash.getHashString(!0):""),e.rel="noopener nofollow",this._setElementTitle(e,"MapFeedback")}},_i.prototype._updateData=function(t){!t||"metadata"!==t.sourceDataType&&"visibility"!==t.sourceDataType&&"style"!==t.dataType||(this._updateAttributions(),this._updateEditLink())},_i.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 r=this._map.style.sourceCaches;for(var n in r){var i=r[n];if(i.used){var o=i.getSource();o.attribution&&t.indexOf(o.attribution)<0&&t.push(o.attribution)}}t.sort((function(t,e){return t.length-e.length}));var a=(t=t.filter((function(e,r){for(var n=r+1;n<t.length;n++)if(t[n].indexOf(e)>=0)return!1;return!0}))).join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._editLink=null)}},_i.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("maplibregl-compact","mapboxgl-compact"):this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show")};var xi=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};xi.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","maplibregl-ctrl mapboxgl-ctrl");var e=r.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",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},xi.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},xi.prototype.getDefaultPosition=function(){return"bottom-left"},xi.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},xi.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}},xi.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("maplibregl-compact","mapboxgl-compact"):e.classList.remove("maplibregl-compact","mapboxgl-compact")}};var bi=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};bi.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},bi.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;r<n.length;r+=1){var i=n[r];if(i.id===t)return void(i.cancelled=!0)}},bi.prototype.run=function(t){void 0===t&&(t=0);var e=this._currentlyRunning=this._queue;this._queue=[];for(var r=0,n=e;r<n.length;r+=1){var i=n[r];if(!i.cancelled&&(i.callback(t),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},bi.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var wi={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},Ei=t.window.HTMLImageElement,Ii=t.window.HTMLElement,Si=t.window.ImageBitmap,Ci={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},Pi=function(n){function i(e){var r=this;if(null!=(e=t.extend({},Ci,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<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var i=new En(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(n.call(this,i,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 bi,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},wi,e.locale),this._clickTolerance=e.clickTolerance,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 Ii))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","_onMapScroll","_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),t.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new mi(this,e),this._hash=e.hash&&new Sn("string"==typeof e.hash&&e.hash||void 0).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 _i({customAttribution:e.customAttribution})),this.addControl(new xi,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))}))}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var o={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return i.prototype._getMapId=function(){return this._mapId},i.prototype.addControl=function(e,r){if(void 0===r&&(r=e.getDefaultPosition?e.getDefaultPosition():"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 n=e.onAdd(this);this._controls.push(e);var i=this._controlPositions[r];return-1!==r.indexOf("bottom")?i.insertBefore(n,i.firstChild):i.appendChild(n),this},i.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 r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this},i.prototype.hasControl=function(t){return this._controls.indexOf(t)>-1},i.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],i=r[1];this._resizeCanvas(n,i),this.transform.resize(n,i),this.painter.resize(n,i);var o=!this._moving;return o&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),o&&this.fire(new t.Event("moveend",e)),this},i.prototype.getBounds=function(){return this.transform.getBounds()},i.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},i.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},i.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")},i.prototype.getMinZoom=function(){return this.transform.minZoom},i.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")},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&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 0 and the current maxPitch, inclusive")},i.prototype.getMinPitch=function(){return this.transform.minPitch},i.prototype.setMaxPitch=function(t){if((t=null==t?60:t)>60)throw new Error("maxPitch must be less than or equal to 60");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")},i.prototype.getMaxPitch=function(){return this.transform.maxPitch},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},i.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},i.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},i.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},i.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},i.prototype._createDelegatedListener=function(t,e,r){var n,i=this;if("mouseenter"===t||"mouseover"===t){var o=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){var a=i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[];a.length?o||(o=!0,r.call(i,new Dn(t,i,n.originalEvent,{features:a}))):o=!1},mouseout:function(){o=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){(i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,r.call(i,new Dn(t,i,n.originalEvent)))},mouseout:function(e){a&&(a=!1,r.call(i,new Dn(t,i,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(n={},n[t]=function(t){var n=i.getLayer(e)?i.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,r.call(i,t),delete t.features)},n)}},i.prototype.on=function(t,e,r){if(void 0===r)return n.prototype.on.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var o in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(i),i.delegates)this.on(o,i.delegates[o]);return this},i.prototype.once=function(t,e,r){if(void 0===r)return n.prototype.once.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var o in i.delegates)this.once(o,i.delegates[o]);return this},i.prototype.off=function(t,e,r){var i=this;return void 0===r?n.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(n){for(var o=n[t],a=0;a<o.length;a++){var s=o[a];if(s.layer===e&&s.listener===r){for(var u in s.delegates)i.off(u,s.delegates[u]);return o.splice(a,1),i}}}(this._delegatedListeners),this)},i.prototype.queryRenderedFeatures=function(e,r){if(!this.style)return[];var n;if(void 0!==r||void 0===e||e instanceof t.Point||Array.isArray(e)||(r=e,e=void 0),r=r||{},(e=e||[[0,0],[this.transform.width,this.transform.height]])instanceof t.Point||"number"==typeof e[0])n=[t.Point.convert(e)];else{var i=t.Point.convert(e[0]),o=t.Point.convert(e[1]);n=[i,new t.Point(o.x,i.y),o,new t.Point(i.x,o.y),i]}return this.style.queryRenderedFeatures(n,r,this.transform)},i.prototype.querySourceFeatures=function(t,e){return this.style.querySourceFeatures(t,e)},i.prototype.setStyle=function(e,r){return!1!==(r=t.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))},i.prototype.setTransformRequest=function(t){return this._requestManager.setTransformRequest(t),this},i.prototype._getUIString=function(t){var e=this._locale[t];if(null==e)throw new Error("Missing UI string '"+t+"'");return e},i.prototype._updateStyle=function(t,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),t?(this.style=new qe(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)},i.prototype._lazyInitEmptyStyle=function(){this.style||(this.style=new qe(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())},i.prototype._diffStyle=function(e,r){var n=this;if("string"==typeof e){var i=this._requestManager.normalizeStyleURL(e),o=this._requestManager.transformRequest(i,t.ResourceType.Style);t.getJSON(o,(function(e,i){e?n.fire(new t.ErrorEvent(e)):i&&n._updateDiff(i,r)}))}else"object"==typeof e&&this._updateDiff(e,r)},i.prototype._updateDiff=function(e,r){try{this.style.setState(e)&&this._update(!0)}catch(n){t.warnOnce("Unable to perform style diff: "+(n.message||n.error||n)+". Rebuilding the style from scratch."),this._updateStyle(e,r)}},i.prototype.getStyle=function(){if(this.style)return this.style.serialize()},i.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")},i.prototype.addSource=function(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)},i.prototype.isSourceLoaded=function(e){var r=this.style&&this.style.sourceCaches[e];if(void 0!==r)return r.loaded();this.fire(new t.ErrorEvent(new Error("There is no source with ID '"+e+"'")))},i.prototype.areTilesLoaded=function(){var t=this.style&&this.style.sourceCaches;for(var e in t){var r=t[e]._tiles;for(var n in r){var i=r[n];if("loaded"!==i.state&&"errored"!==i.state)return!1}}return!0},i.prototype.addSourceType=function(t,e,r){return this._lazyInitEmptyStyle(),this.style.addSourceType(t,e,r)},i.prototype.removeSource=function(t){return this.style.removeSource(t),this._update(!0)},i.prototype.getSource=function(t){return this.style.getSource(t)},i.prototype.addImage=function(e,r,n){void 0===n&&(n={});var i=n.pixelRatio;void 0===i&&(i=1);var o=n.sdf;void 0===o&&(o=!1);var a=n.stretchX,s=n.stretchY,u=n.content;if(this._lazyInitEmptyStyle(),r instanceof Ei||Si&&r instanceof Si){var l=t.browser.getImageData(r);this.style.addImage(e,{data:new t.RGBAImage({width:l.width,height:l.height},l.data),pixelRatio:i,stretchX:a,stretchY:s,content:u,sdf:o,version:0})}else{if(void 0===r.width||void 0===r.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));var c=r;this.style.addImage(e,{data:new t.RGBAImage({width:r.width,height:r.height},new Uint8Array(r.data)),pixelRatio:i,stretchX:a,stretchY:s,content:u,sdf:o,version:0,userImage:c}),c.onAdd&&c.onAdd(this,e)}},i.prototype.updateImage=function(e,r){var n=this.style.getImage(e);if(!n)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 i=r instanceof Ei||Si&&r instanceof Si?t.browser.getImageData(r):r,o=i.width,a=i.height,s=i.data;return void 0===o||void 0===a?this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))):o!==n.data.width||a!==n.data.height?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"))):(n.data.replace(s,!(r instanceof Ei||Si&&r instanceof Si)),void this.style.updateImage(e,n))},i.prototype.hasImage=function(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)},i.prototype.removeImage=function(t){this.style.removeImage(t)},i.prototype.loadImage=function(e,r){t.getImage(this._requestManager.transformRequest(e,t.ResourceType.Image),r)},i.prototype.listImages=function(){return this.style.listImages()},i.prototype.addLayer=function(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)},i.prototype.moveLayer=function(t,e){return this.style.moveLayer(t,e),this._update(!0)},i.prototype.removeLayer=function(t){return this.style.removeLayer(t),this._update(!0)},i.prototype.getLayer=function(t){return this.style.getLayer(t)},i.prototype.setLayerZoomRange=function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0)},i.prototype.setFilter=function(t,e,r){return void 0===r&&(r={}),this.style.setFilter(t,e,r),this._update(!0)},i.prototype.getFilter=function(t){return this.style.getFilter(t)},i.prototype.setPaintProperty=function(t,e,r,n){return void 0===n&&(n={}),this.style.setPaintProperty(t,e,r,n),this._update(!0)},i.prototype.getPaintProperty=function(t,e){return this.style.getPaintProperty(t,e)},i.prototype.setLayoutProperty=function(t,e,r,n){return void 0===n&&(n={}),this.style.setLayoutProperty(t,e,r,n),this._update(!0)},i.prototype.getLayoutProperty=function(t,e){return this.style.getLayoutProperty(t,e)},i.prototype.setLight=function(t,e){return void 0===e&&(e={}),this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)},i.prototype.getLight=function(){return this.style.getLight()},i.prototype.setFeatureState=function(t,e){return this.style.setFeatureState(t,e),this._update()},i.prototype.removeFeatureState=function(t,e){return this.style.removeFeatureState(t,e),this._update()},i.prototype.getFeatureState=function(t){return this.style.getFeatureState(t)},i.prototype.getContainer=function(){return this._container},i.prototype.getCanvasContainer=function(){return this._canvasContainer},i.prototype.getCanvas=function(){return this._canvas},i.prototype._containerDimensions=function(){var t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]},i.prototype._setupContainer=function(){var t=this._container;t.classList.add("maplibregl-map","mapboxgl-map");var e=this._canvasContainer=r.create("div","maplibregl-canvas-container mapboxgl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=r.create("canvas","maplibregl-canvas mapboxgl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");var n=this._containerDimensions();this._resizeCanvas(n[0],n[1]);var i=this._controlContainer=r.create("div","maplibregl-control-container mapboxgl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((function(t){o[t]=r.create("div","maplibregl-ctrl-"+t+" mapboxgl-ctrl-"+t,i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)},i.prototype._resizeCanvas=function(e,r){var n=t.browser.devicePixelRatio||1;this._canvas.width=n*e,this._canvas.height=n*r,this._canvas.style.width=e+"px",this._canvas.style.height=r+"px"},i.prototype._setupPainter=function(){var r=t.extend({},e.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r);n?(this.painter=new _n(n,this.transform),t.webpSupported.testSupport(n)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))},i.prototype._contextLost=function(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))},i.prototype._contextRestored=function(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))},i.prototype._onMapScroll=function(t){if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},i.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},i.prototype._update=function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this},i.prototype._requestRenderFrame=function(t){return this._update(),this._renderTaskQueue.add(t)},i.prototype._cancelRenderFrame=function(t){this._renderTaskQueue.remove(t)},i.prototype._render=function(e){var r,n=this,i=0,o=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(r=o.createQueryEXT(),o.beginQueryEXT(o.TIME_ELAPSED_EXT,r),i=t.browser.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),!this._removed){var a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;var s=this.transform.zoom,u=t.browser.now();this.style.zoomHistory.update(s,u);var l=new t.EvaluationParameters(s,{now:u,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(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),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 h=t.browser.now()-i;o.endQueryEXT(o.TIME_ELAPSED_EXT,r),setTimeout((function(){var e=o.getQueryObjectEXT(r,o.QUERY_RESULT_EXT)/1e6;o.deleteQueryEXT(r),n.fire(new t.Event("gpu-timing-frame",{cpuTime:h,gpuTime:e}))}),50)}if(this.listens("gpu-timing-layer")){var p=this.painter.collectGpuTimers();setTimeout((function(){var e=n.painter.queryGpuTimers(p);n.fire(new t.Event("gpu-timing-layer",{layerTimes:e}))}),50)}var f=this._sourcesDirty||this._styleDirty||this._placementDirty;return f||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),!this._loaded||this._fullyLoaded||f||(this._fullyLoaded=!0),this}},i.prototype.remove=function(){this._hash&&this._hash.remove();for(var e=0,r=this._controls;e<r.length;e+=1)r[e].onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),void 0!==t.window&&(t.window.removeEventListener("resize",this._onWindowResize,!1),t.window.removeEventListener("orientationchange",this._onWindowResize,!1),t.window.removeEventListener("online",this._onWindowOnline,!1));var n=this.painter.context.gl.getExtension("WEBGL_lose_context");n&&n.loseContext(),Mi(this._canvasContainer),Mi(this._controlContainer),this._container.classList.remove("maplibregl-map","mapboxgl-map"),this._removed=!0,this.fire(new t.Event("remove"))},i.prototype.triggerRepaint=function(){var e=this;this.style&&!this._frame&&(this._frame=t.browser.frame((function(t){e._frame=null,e._render(t)})))},i.prototype._onWindowOnline=function(){this._update()},i.prototype._onWindowResize=function(t){this._trackResize&&this.resize({originalEvent:t})._update()},o.showTileBoundaries.get=function(){return!!this._showTileBoundaries},o.showTileBoundaries.set=function(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},o.showPadding.get=function(){return!!this._showPadding},o.showPadding.set=function(t){this._showPadding!==t&&(this._showPadding=t,this._update())},o.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},o.showCollisionBoxes.set=function(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())},o.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},o.showOverdrawInspector.set=function(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},o.repaint.get=function(){return!!this._repaint},o.repaint.set=function(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())},o.vertices.get=function(){return!!this._vertices},o.vertices.set=function(t){this._vertices=t,this._update()},i.prototype._setCacheLimits=function(e,r){t.setCacheLimits(e,r)},o.version.get=function(){return t.version},Object.defineProperties(i.prototype,o),i}(vi);function Mi(t){t.parentNode&&t.parentNode.removeChild(t)}var Ti={showCompass:!0,showZoom:!0,visualizePitch:!1},Li=function(e){var n=this;this.options=t.extend({},Ti,e),this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-group 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("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",(function(t){return n._map.zoomIn({},{originalEvent:t})})),r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",(function(t){return n._map.zoomOut({},{originalEvent:t})})),r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",(function(t){n.options.visualizePitch?n._map.resetNorthPitch({},{originalEvent:t}):n._map.resetNorth({},{originalEvent:t})})),this._compassIcon=r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))};Li.prototype._updateZoomButtons=function(){var t=this._map.getZoom(),e=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},Li.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},Li.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 Ai(this._map,this._compass,this.options.visualizePitch)),this._container},Li.prototype.onRemove=function(){r.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),this._handler.off(),delete this._handler),delete this._map},Li.prototype._createButton=function(t,e){var n=r.create("button",t,this._container);return n.type="button",n.addEventListener("click",e),n},Li.prototype._setButtonTitle=function(t,e){var r=this._map._getUIString("NavigationControl."+e);t.title=r,t.setAttribute("aria-label",r)};var Ai=function(e,n,i){void 0===i&&(i=!1),this._clickTolerance=10,this.element=n,this.mouseRotate=new Yn({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,i&&(this.mousePitch=new Wn({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),t.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener(n,"mousedown",this.mousedown),r.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),r.addEventListener(n,"touchmove",this.touchmove),r.addEventListener(n,"touchend",this.touchend),r.addEventListener(n,"touchcancel",this.reset)};function ki(e,r,n){if(e=new t.LngLat(e.lng,e.lat),r){var i=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=n.locationPoint(e).distSqr(r);n.locationPoint(i).distSqr(r)<a?e=i:n.locationPoint(o).distSqr(r)<a&&(e=o)}for(;Math.abs(e.lng-n.center.lng)>180;){var s=n.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}Ai.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),r.disableDrag()},Ai.prototype.move=function(t,e){var r=this.map,n=this.mouseRotate.mousemoveWindow(t,e);if(n&&n.bearingDelta&&r.setBearing(r.getBearing()+n.bearingDelta),this.mousePitch){var i=this.mousePitch.mousemoveWindow(t,e);i&&i.pitchDelta&&r.setPitch(r.getPitch()+i.pitchDelta)}},Ai.prototype.off=function(){var t=this.element;r.removeEventListener(t,"mousedown",this.mousedown),r.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),r.removeEventListener(t,"touchmove",this.touchmove),r.removeEventListener(t,"touchend",this.touchend),r.removeEventListener(t,"touchcancel",this.reset),this.offTemp()},Ai.prototype.offTemp=function(){r.enableDrag(),r.removeEventListener(t.window,"mousemove",this.mousemove),r.removeEventListener(t.window,"mouseup",this.mouseup)},Ai.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),r.mousePos(this.element,e)),r.addEventListener(t.window,"mousemove",this.mousemove),r.addEventListener(t.window,"mouseup",this.mouseup)},Ai.prototype.mousemove=function(t){this.move(t,r.mousePos(this.element,t))},Ai.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},Ai.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos))},Ai.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos))},Ai.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()},Ai.prototype.reset=function(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};var Ni={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 Di(t,e,r){var n=t.classList;for(var i in Ni)n.remove("maplibregl-"+r+"-anchor-"+i,"mapboxgl-"+r+"-anchor-"+i);n.add("maplibregl-"+r+"-anchor-"+e,"mapboxgl-"+r+"-anchor-"+e)}var Ri,Oi=function(e){function n(n,i){if(e.call(this),(n instanceof t.window.HTMLElement||i)&&(n=t.extend({element:n},i)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=n&&n.anchor||"center",this._color=n&&n.color||"#3FB1CE",this._scale=n&&n.scale||1,this._draggable=n&&n.draggable||!1,this._clickTolerance=n&&n.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=n&&n.rotation||0,this._rotationAlignment=n&&n.rotationAlignment||"auto",this._pitchAlignment=n&&n.pitchAlignment&&"auto"!==n.pitchAlignment?n.pitchAlignment:this._rotationAlignment,n&&n.element)this._element=n.element,this._offset=t.Point.convert(n&&n.offset||[0,0]);else{this._defaultMarker=!0,this._element=r.create("div"),this._element.setAttribute("aria-label","Map marker");var o=r.createNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS(null,"display","block"),o.setAttributeNS(null,"height","41px"),o.setAttributeNS(null,"width","27px"),o.setAttributeNS(null,"viewBox","0 0 27 41");var a=r.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");var s=r.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");var u=r.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"transform","translate(3.0, 29.0)"),u.setAttributeNS(null,"fill","#000000");for(var l=0,c=[{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"}];l<c.length;l+=1){var h=c[l],p=r.createNS("http://www.w3.org/2000/svg","ellipse");p.setAttributeNS(null,"opacity","0.04"),p.setAttributeNS(null,"cx","10.5"),p.setAttributeNS(null,"cy","5.80029008"),p.setAttributeNS(null,"rx",h.rx),p.setAttributeNS(null,"ry",h.ry),u.appendChild(p)}var f=r.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill",this._color);var d=r.createNS("http://www.w3.org/2000/svg","path");d.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"),f.appendChild(d);var g=r.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"fill","#000000");var y=r.createNS("http://www.w3.org/2000/svg","path");y.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"),g.appendChild(y);var m=r.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(6.0, 7.0)"),m.setAttributeNS(null,"fill","#FFFFFF");var v=r.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"transform","translate(8.0, 8.0)");var _=r.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#000000"),_.setAttributeNS(null,"opacity","0.25"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962");var x=r.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#FFFFFF"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962"),v.appendChild(_),v.appendChild(x),s.appendChild(u),s.appendChild(f),s.appendChild(g),s.appendChild(m),s.appendChild(v),o.appendChild(s),o.setAttributeNS(null,"height",41*this._scale+"px"),o.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(o),this._offset=t.Point.convert(n&&n.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",(function(t){t.preventDefault()})),this._element.addEventListener("mousedown",(function(t){t.preventDefault()})),Di(this._element,this._anchor,"marker"),this._popup=null}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.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},n.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),r.remove(this._element),this._popup&&this._popup.remove(),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},n.prototype.getElement=function(){return this._element},n.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},n.prototype._onKeyPress=function(t){var e=t.code,r=t.charCode||t.keyCode;"Space"!==e&&"Enter"!==e&&32!==r&&13!==r||this.togglePopup()},n.prototype._onMapClick=function(t){var e=t.originalEvent.target,r=this._element;this._popup&&(e===r||r.contains(e))&&this.togglePopup()},n.prototype.getPopup=function(){return this._popup},n.prototype.togglePopup=function(){var t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this},n.prototype._update=function(t){if(this._map){this._map.transform.renderWorldCopies&&(this._lngLat=ki(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 n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n="rotateX("+this._map.getPitch()+"deg)"),t&&"moveend"!==t.type||(this._pos=this._pos.round()),r.setTransform(this._element,Ni[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+n+" "+e)}},n.prototype.getOffset=function(){return this._offset},n.prototype.setOffset=function(e){return this._offset=t.Point.convert(e),this._update(),this},n.prototype._onMove=function(e){if(!this._isDragging){var r=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=r}this._isDragging&&(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")))},n.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},n.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},n.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},n.prototype.isDraggable=function(){return this._draggable},n.prototype.setRotation=function(t){return this._rotation=t||0,this._update(),this},n.prototype.getRotation=function(){return this._rotation},n.prototype.setRotationAlignment=function(t){return this._rotationAlignment=t||"auto",this._update(),this},n.prototype.getRotationAlignment=function(){return this._rotationAlignment},n.prototype.setPitchAlignment=function(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this},n.prototype.getPitchAlignment=function(){return this._pitchAlignment},n}(t.Evented),zi={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Fi=0,Bi=!1,Ui=function(e){function n(r){e.call(this),this.options=t.extend({},zi,r),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.onAdd=function(e){var n;return this._map=e,this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),n=this._setupUI,void 0!==Ri?n(Ri):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then((function(t){n(Ri="denied"!==t.state)})):n(Ri=!!t.window.navigator.geolocation),this._container},n.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(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),r.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Fi=0,Bi=!1},n.prototype._isOutOfMapMaxBounds=function(t){var e=this._map.getMaxBounds(),r=t.coords;return e&&(r.longitude<e.getWest()||r.longitude>e.getEast()||r.latitude<e.getSouth()||r.latitude>e.getNorth())},n.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting")}},n.prototype._onSuccess=function(e){if(this._map){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("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","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("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},n.prototype._updateCamera=function(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,i=this._map.getBearing(),o=t.extend({bearing:i},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(n),o,{geolocateSource:!0})},n.prototype._updateMarker=function(e){if(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},n.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),r=this._map.unproject([1,t]),n=e.distanceTo(r),i=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=i+"px",this._circleElement.style.height=i+"px"},n.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},n.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Bi)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},n.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},n.prototype._setupUI=function(e){var n=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=r.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),r.create("span","maplibregl-ctrl-icon 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 i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{var o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Oi(this._dotElement),this._circleElement=r.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Oi({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==n._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(n._watchState="BACKGROUND",n._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),n._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),n.fire(new t.Event("trackuserlocationend")))}))},n.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":Fi--,Bi=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","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("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Fi>1?(e={maximumAge:6e5,timeout:0},Bi=!0):(e=this.options.positionOptions,Bi=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},n.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},n}(t.Evented),ji={maxWidth:100,unit:"metric"},Vi=function(e){this.options=t.extend({},ji,e),t.bindAll(["_onMove","setUnit"],this)};function qi(t,e,r){var n=r&&r.maxWidth||100,i=t._container.clientHeight/2,o=t.unproject([0,i]),a=t.unproject([n,i]),s=o.distanceTo(a);if(r&&"imperial"===r.unit){var u=3.2808*s;u>5280?Gi(e,n,u/5280,t._getUIString("ScaleControl.Miles")):Gi(e,n,u,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?Gi(e,n,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?Gi(e,n,s/1e3,t._getUIString("ScaleControl.Kilometers")):Gi(e,n,s,t._getUIString("ScaleControl.Meters"))}function Gi(t,e,r,n){var i,o,a,s=(i=r,(o=Math.pow(10,(""+Math.floor(i)).length-1))*(a=(a=i/o)>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(a)));t.style.width=e*(s/r)+"px",t.innerHTML=s+"&nbsp;"+n}Vi.prototype.getDefaultPosition=function(){return"bottom-left"},Vi.prototype._onMove=function(){qi(this._map,this._container,this.options)},Vi.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},Vi.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},Vi.prototype.setUnit=function(t){this.options.unit=t,qi(this._map,this._container,this.options)};var Xi=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")};Xi.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","maplibregl-ctrl maplibregl-ctrl-group 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},Xi.prototype.onRemove=function(){r.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Xi.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},Xi.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","maplibregl-ctrl-icon 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)},Xi.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},Xi.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},Xi.prototype._isFullscreen=function(){return this._fullscreen},Xi.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("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},Xi.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 Zi={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Yi=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Wi=function(e){function n(r){e.call(this),this.options=t.extend(Object.create(Zi),r),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},n.prototype.isOpen=function(){return!!this._map},n.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},n.prototype.getLngLat=function(){return this._lngLat},n.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._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this},n.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this},n.prototype.getElement=function(){return this._container},n.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},n.prototype.setHTML=function(e){var r,n=t.window.document.createDocumentFragment(),i=t.window.document.createElement("body");for(i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return this.setDOMContent(n)},n.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},n.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},n.prototype.setDOMContent=function(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=r.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this},n.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},n.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},n.prototype.setOffset=function(t){return this.options.offset=t,this._update(),this},n.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},n.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=r.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))},n.prototype._onMouseUp=function(t){this._update(t.point)},n.prototype._onMouseMove=function(t){this._update(t.point)},n.prototype._onDrag=function(t){this._update(t.point)},n.prototype._update=function(e){var n=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=r.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return n._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","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=ki(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),o=this.options.anchor,a=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.Point(0,0),top:new t.Point(0,r),"top-left":new t.Point(n,n),"top-right":new t.Point(-n,n),bottom:new t.Point(0,-r),"bottom-left":new t.Point(n,-n),"bottom-right":new t.Point(-n,-n),left:new t.Point(r,0),right:new t.Point(-r,0)}}if(r instanceof t.Point||Array.isArray(r)){var i=t.Point.convert(r);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(r.center||[0,0]),top:t.Point.convert(r.top||[0,0]),"top-left":t.Point.convert(r["top-left"]||[0,0]),"top-right":t.Point.convert(r["top-right"]||[0,0]),bottom:t.Point.convert(r.bottom||[0,0]),"bottom-left":t.Point.convert(r["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(r["bottom-right"]||[0,0]),left:t.Point.convert(r.left||[0,0]),right:t.Point.convert(r.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!o){var s,u=this._container.offsetWidth,l=this._container.offsetHeight;s=i.y+a.bottom.y<l?["top"]:i.y>this._map.transform.height-l?["bottom"]:[],i.x<u/2?s.push("left"):i.x>this._map.transform.width-u/2&&s.push("right"),o=0===s.length?"bottom":s.join("-")}var c=i.add(a[o]).round();r.setTransform(this._container,Ni[o]+" translate("+c.x+"px,"+c.y+"px)"),Di(this._container,o,"popup")}},n.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var t=this._container.querySelector(Yi);t&&t.focus()}},n.prototype._onClose=function(){this.remove()},n}(t.Evented),Hi={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:Pi,NavigationControl:Li,GeolocateControl:Ui,AttributionControl:_i,ScaleControl:Vi,FullscreenControl:Xi,Popup:Wi,Marker:Oi,Style:qe,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){Ft().acquire(Dt)},clearPrewarmedResources:function(){var t=Ot;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Dt),Ot=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return 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:"",addProtocol:function(e,r){t.config.REGISTERED_PROTOCOLS[e]=r},removeProtocol:function(e){delete t.config.REGISTERED_PROTOCOLS[e]}};return Hi}));return r}));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).MapboxDraw=e()}(this,(function(){"use strict";var t=function(t,e){var r={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},n={on:function(t,e,n){if(void 0===r[t])throw new Error("Invalid event type: "+t);r[t].push({selector:e,fn:n})},render:function(t){e.store.featureChanged(t)}},i=function(t,i){for(var o=r[t],a=o.length;a--;){var s=o[a];if(s.selector(i)){s.fn.call(n,i)||e.store.render(),e.ui.updateMapClasses();break}}};return t.start.call(n),{render:t.render,stop:function(){t.stop&&t.stop()},trash:function(){t.trash&&(t.trash(),e.store.render())},combineFeatures:function(){t.combineFeatures&&t.combineFeatures()},uncombineFeatures:function(){t.uncombineFeatures&&t.uncombineFeatures()},drag:function(t){i("drag",t)},click:function(t){i("click",t)},mousemove:function(t){i("mousemove",t)},mousedown:function(t){i("mousedown",t)},mouseup:function(t){i("mouseup",t)},mouseout:function(t){i("mouseout",t)},keydown:function(t){i("keydown",t)},keyup:function(t){i("keyup",t)},touchstart:function(t){i("touchstart",t)},touchmove:function(t){i("touchmove",t)},touchend:function(t){i("touchend",t)},tap:function(t){i("tap",t)}}},e=6378137;function r(t){var e=0;if(t&&t.length>0){e+=Math.abs(n(t[0]));for(var r=1;r<t.length;r++)e-=Math.abs(n(t[r]))}return e}function n(t){var r,n,o,a,s,u,l=0,c=t.length;if(c>2){for(u=0;u<c;u++)u===c-2?(o=c-2,a=c-1,s=0):u===c-1?(o=c-1,a=0,s=1):(o=u,a=u+1,s=u+2),r=t[o],n=t[a],l+=(i(t[s][0])-i(r[0]))*Math.sin(i(n[1]));l=l*e*e/2}return l}function i(t){return t*Math.PI/180}var o=function t(e){var n,i=0;switch(e.type){case"Polygon":return r(e.coordinates);case"MultiPolygon":for(n=0;n<e.coordinates.length;n++)i+=r(e.coordinates[n]);return i;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(n=0;n<e.geometries.length;n++)i+=t(e.geometries[n]);return i}},a="active",s="mapbox-gl-draw-hot",u="mapbox-gl-draw-cold",l="add",c="move",h="pointer",p="none",f={POLYGON:"polygon",LINE:"line_string",POINT:"point"},d="Feature",g="Polygon",y="LineString",m="Point",v="FeatureCollection",_="Multi",x={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select",STATIC:"static"},b="draw.create",w="draw.delete",E="draw.update",I="draw.selectionchange",S="draw.render",C="feature",P="midpoint",M="vertex",T="true",L="false",A=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],k={Point:0,LineString:1,Polygon:2};function N(t,e){var r=k[t.geometry.type]-k[e.geometry.type];return 0===r&&t.geometry.type===g?t.area-e.area:r}function D(t){if(this._items={},this._nums={},this._length=t?t.length:0,t)for(var e=0,r=t.length;e<r;e++)this.add(t[e]),void 0!==t[e]&&("string"==typeof t[e]?this._items[t[e]]=e:this._nums[t[e]]=e)}D.prototype.add=function(t){return this.has(t)||(this._length++,"string"==typeof t?this._items[t]=this._length:this._nums[t]=this._length),this},D.prototype.delete=function(t){return!1===this.has(t)||(this._length--,delete this._items[t],delete this._nums[t]),this},D.prototype.has=function(t){return!("string"!=typeof t&&"number"!=typeof t||void 0===this._items[t]&&void 0===this._nums[t])},D.prototype.values=function(){var t=this,e=[];return Object.keys(this._items).forEach((function(r){e.push({k:r,v:t._items[r]})})),Object.keys(this._nums).forEach((function(r){e.push({k:JSON.parse(r),v:t._nums[r]})})),e.sort((function(t,e){return t.v-e.v})).map((function(t){return t.k}))},D.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};var R=[C,P,M],O={click:function(t,e,r){return z(t,e,r,r.options.clickBuffer)},touch:function(t,e,r){return z(t,e,r,r.options.touchBuffer)}};function z(t,e,r,n){if(null===r.map)return[];var i=t?function(t,e){return void 0===e&&(e=0),[[t.point.x-e,t.point.y-e],[t.point.x+e,t.point.y+e]]}(t,n):e,a={};r.options.styles&&(a.layers=r.options.styles.map((function(t){return t.id})));var s=r.map.queryRenderedFeatures(i,a).filter((function(t){return-1!==R.indexOf(t.properties.meta)})),u=new D,l=[];return s.forEach((function(t){var e=t.properties.id;u.has(e)||(u.add(e),l.push(t))})),function(t){return t.map((function(t){return t.geometry.type===g&&(t.area=o({type:d,property:{},geometry:t.geometry})),t})).sort(N).map((function(t){return delete t.area,t}))}(l)}function F(t,e){var r=O.click(t,null,e),n={mouse:p};return r[0]&&(n.mouse=r[0].properties.active===T?c:h,n.feature=r[0].properties.meta),-1!==e.events.currentModeName().indexOf("draw")&&(n.mouse=l),e.ui.queueMapClasses(n),e.ui.updateMapClasses(),r[0]}function B(t,e){var r=t.x-e.x,n=t.y-e.y;return Math.sqrt(r*r+n*n)}function U(t,e,r){void 0===r&&(r={});var n=null!=r.fineTolerance?r.fineTolerance:4,i=null!=r.grossTolerance?r.grossTolerance:12,o=null!=r.interval?r.interval:500;t.point=t.point||e.point,t.time=t.time||e.time;var a=B(t.point,e.point);return a<n||a<i&&e.time-t.time<o}function j(t,e,r){void 0===r&&(r={});var n=null!=r.tolerance?r.tolerance:25,i=null!=r.interval?r.interval:250;return t.point=t.point||e.point,t.time=t.time||e.time,B(t.point,e.point)<n&&e.time-t.time<i}function V(t,e){return t(e={exports:{}},e.exports),e.exports}var q=V((function(t){var e=t.exports=function(t,r){if(r||(r=16),void 0===t&&(t=128),t<=0)return"0";for(var n=Math.log(Math.pow(2,t))/Math.log(r),i=2;n===1/0;i*=2)n=Math.log(Math.pow(2,t/i))/Math.log(r)*i;var o=n-Math.floor(n),a="";for(i=0;i<Math.floor(n);i++)a=Math.floor(Math.random()*r).toString(r)+a;if(o){var s=Math.pow(r,o);a=Math.floor(Math.random()*s).toString(r)+a}var u=parseInt(a,r);return u!==1/0&&u>=Math.pow(2,t)?e(t,r):a};e.rack=function(t,r,n){var i=function(i){var a=0;do{if(a++>10){if(!n)throw new Error("too many ID collisions, use more bits");t+=n}var s=e(t,r)}while(Object.hasOwnProperty.call(o,s));return o[s]=i,s},o=i.hats={};return i.get=function(t){return i.hats[t]},i.set=function(t,e){return i.hats[t]=e,i},i.bits=t||128,i.base=r||16,i}})),G=function(t,e){this.ctx=t,this.properties=e.properties||{},this.coordinates=e.geometry.coordinates,this.id=e.id||q(),this.type=e.geometry.type};G.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},G.prototype.incomingCoords=function(t){this.setCoordinates(t)},G.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},G.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},G.prototype.setProperty=function(t,e){this.properties[t]=e},G.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:d,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},G.prototype.internal=function(t){var e={id:this.id,meta:C,"meta:type":this.type,active:L,mode:t};if(this.ctx.options.userProperties)for(var r in this.properties)e["user_"+r]=this.properties[r];return{type:d,properties:e,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var X=function(t,e){G.call(this,t,e)};(X.prototype=Object.create(G.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},X.prototype.updateCoordinate=function(t,e,r){this.coordinates=3===arguments.length?[e,r]:[t,e],this.changed()},X.prototype.getCoordinate=function(){return this.getCoordinates()};var Z=function(t,e){G.call(this,t,e)};(Z.prototype=Object.create(G.prototype)).isValid=function(){return this.coordinates.length>1},Z.prototype.addCoordinate=function(t,e,r){this.changed();var n=parseInt(t,10);this.coordinates.splice(n,0,[e,r])},Z.prototype.getCoordinate=function(t){var e=parseInt(t,10);return JSON.parse(JSON.stringify(this.coordinates[e]))},Z.prototype.removeCoordinate=function(t){this.changed(),this.coordinates.splice(parseInt(t,10),1)},Z.prototype.updateCoordinate=function(t,e,r){var n=parseInt(t,10);this.coordinates[n]=[e,r],this.changed()};var Y=function(t,e){G.call(this,t,e),this.coordinates=this.coordinates.map((function(t){return t.slice(0,-1)}))};(Y.prototype=Object.create(G.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((function(t){return t.length>2}))},Y.prototype.incomingCoords=function(t){this.coordinates=t.map((function(t){return t.slice(0,-1)})),this.changed()},Y.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},Y.prototype.addCoordinate=function(t,e,r){this.changed();var n=t.split(".").map((function(t){return parseInt(t,10)}));this.coordinates[n[0]].splice(n[1],0,[e,r])},Y.prototype.removeCoordinate=function(t){this.changed();var e=t.split(".").map((function(t){return parseInt(t,10)})),r=this.coordinates[e[0]];r&&(r.splice(e[1],1),r.length<3&&this.coordinates.splice(e[0],1))},Y.prototype.getCoordinate=function(t){var e=t.split(".").map((function(t){return parseInt(t,10)})),r=this.coordinates[e[0]];return JSON.parse(JSON.stringify(r[e[1]]))},Y.prototype.getCoordinates=function(){return this.coordinates.map((function(t){return t.concat([t[0]])}))},Y.prototype.updateCoordinate=function(t,e,r){this.changed();var n=t.split("."),i=parseInt(n[0],10),o=parseInt(n[1],10);void 0===this.coordinates[i]&&(this.coordinates[i]=[]),this.coordinates[i][o]=[e,r]};var W={MultiPoint:X,MultiLineString:Z,MultiPolygon:Y},H=function(t,e,r,n,i){var o=r.split("."),a=parseInt(o[0],10),s=o[1]?o.slice(1).join("."):null;return t[a][e](s,n,i)},J=function(t,e){if(G.call(this,t,e),delete this.coordinates,this.model=W[e.geometry.type],void 0===this.model)throw new TypeError(e.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(e.geometry.coordinates)};function K(t){this.map=t.map,this.drawConfig=JSON.parse(JSON.stringify(t.options||{})),this._ctx=t}(J.prototype=Object.create(G.prototype))._coordinatesToFeatures=function(t){var e=this,r=this.model.bind(this);return t.map((function(t){return new r(e.ctx,{id:q(),type:d,properties:{},geometry:{coordinates:t,type:e.type.replace("Multi","")}})}))},J.prototype.isValid=function(){return this.features.every((function(t){return t.isValid()}))},J.prototype.setCoordinates=function(t){this.features=this._coordinatesToFeatures(t),this.changed()},J.prototype.getCoordinate=function(t){return H(this.features,"getCoordinate",t)},J.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((function(t){return t.type===g?t.getCoordinates():t.coordinates}))))},J.prototype.updateCoordinate=function(t,e,r){H(this.features,"updateCoordinate",t,e,r),this.changed()},J.prototype.addCoordinate=function(t,e,r){H(this.features,"addCoordinate",t,e,r),this.changed()},J.prototype.removeCoordinate=function(t){H(this.features,"removeCoordinate",t),this.changed()},J.prototype.getFeatures=function(){return this.features},K.prototype.setSelected=function(t){return this._ctx.store.setSelected(t)},K.prototype.setSelectedCoordinates=function(t){var e=this;this._ctx.store.setSelectedCoordinates(t),t.reduce((function(t,r){return void 0===t[r.feature_id]&&(t[r.feature_id]=!0,e._ctx.store.get(r.feature_id).changed()),t}),{})},K.prototype.getSelected=function(){return this._ctx.store.getSelected()},K.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},K.prototype.isSelected=function(t){return this._ctx.store.isSelected(t)},K.prototype.getFeature=function(t){return this._ctx.store.get(t)},K.prototype.select=function(t){return this._ctx.store.select(t)},K.prototype.deselect=function(t){return this._ctx.store.deselect(t)},K.prototype.deleteFeature=function(t,e){return void 0===e&&(e={}),this._ctx.store.delete(t,e)},K.prototype.addFeature=function(t){return this._ctx.store.add(t)},K.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},K.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},K.prototype.setActionableState=function(t){void 0===t&&(t={});var e={trash:t.trash||!1,combineFeatures:t.combineFeatures||!1,uncombineFeatures:t.uncombineFeatures||!1};return this._ctx.events.actionable(e)},K.prototype.changeMode=function(t,e,r){return void 0===e&&(e={}),void 0===r&&(r={}),this._ctx.events.changeMode(t,e,r)},K.prototype.updateUIClasses=function(t){return this._ctx.ui.queueMapClasses(t)},K.prototype.activateUIButton=function(t){return this._ctx.ui.setActiveButton(t)},K.prototype.featuresAt=function(t,e,r){if(void 0===r&&(r="click"),"click"!==r&&"touch"!==r)throw new Error("invalid buffer type");return O[r](t,e,this._ctx)},K.prototype.newFeature=function(t){var e=t.geometry.type;return e===m?new X(this._ctx,t):e===y?new Z(this._ctx,t):e===g?new Y(this._ctx,t):new J(this._ctx,t)},K.prototype.isInstanceOf=function(t,e){if(t===m)return e instanceof X;if(t===y)return e instanceof Z;if(t===g)return e instanceof Y;if("MultiFeature"===t)return e instanceof J;throw new Error("Unknown feature class: "+t)},K.prototype.doRender=function(t){return this._ctx.store.featureChanged(t)},K.prototype.onSetup=function(){},K.prototype.onDrag=function(){},K.prototype.onClick=function(){},K.prototype.onMouseMove=function(){},K.prototype.onMouseDown=function(){},K.prototype.onMouseUp=function(){},K.prototype.onMouseOut=function(){},K.prototype.onKeyUp=function(){},K.prototype.onKeyDown=function(){},K.prototype.onTouchStart=function(){},K.prototype.onTouchMove=function(){},K.prototype.onTouchEnd=function(){},K.prototype.onTap=function(){},K.prototype.onStop=function(){},K.prototype.onTrash=function(){},K.prototype.onCombineFeature=function(){},K.prototype.onUncombineFeature=function(){},K.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var $={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},Q=Object.keys($);function tt(t){return[].concat(t).filter((function(t){return void 0!==t}))}function et(){var t=this;if(!t.ctx.map||void 0===t.ctx.map.getSource(s))return c();var e=t.ctx.events.currentModeName();t.ctx.ui.queueMapClasses({mode:e});var r=[],n=[];t.isDirty?n=t.getAllIds():(r=t.getChangedIds().filter((function(e){return void 0!==t.get(e)})),n=t.sources.hot.filter((function(e){return e.properties.id&&-1===r.indexOf(e.properties.id)&&void 0!==t.get(e.properties.id)})).map((function(t){return t.properties.id}))),t.sources.hot=[];var i=t.sources.cold.length;t.sources.cold=t.isDirty?[]:t.sources.cold.filter((function(t){var e=t.properties.id||t.properties.parent;return-1===r.indexOf(e)}));var o=i!==t.sources.cold.length||n.length>0;function a(r,n){var i=t.get(r).internal(e);t.ctx.events.currentModeRender(i,(function(e){t.sources[n].push(e)}))}if(r.forEach((function(t){return a(t,"hot")})),n.forEach((function(t){return a(t,"cold")})),o&&t.ctx.map.getSource(u).setData({type:v,features:t.sources.cold}),t.ctx.map.getSource(s).setData({type:v,features:t.sources.hot}),t._emitSelectionChange&&(t.ctx.map.fire(I,{features:t.getSelected().map((function(t){return t.toGeoJSON()})),points:t.getSelectedCoordinates().map((function(t){return{type:d,properties:{},geometry:{type:m,coordinates:t.coordinates}}}))}),t._emitSelectionChange=!1),t._deletedFeaturesToEmit.length){var l=t._deletedFeaturesToEmit.map((function(t){return t.toGeoJSON()}));t._deletedFeaturesToEmit=[],t.ctx.map.fire(w,{features:l})}function c(){t.isDirty=!1,t.clearChangedIds()}c(),t.ctx.map.fire(S,{})}function rt(t){var e,r=this;this._features={},this._featureIds=new D,this._selectedFeatureIds=new D,this._selectedCoordinates=[],this._changedFeatureIds=new D,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=t,this.sources={hot:[],cold:[]},this.render=function(){e||(e=requestAnimationFrame((function(){e=null,et.call(r)})))},this.isDirty=!1}function nt(t,e){var r=t._selectedCoordinates.filter((function(e){return t._selectedFeatureIds.has(e.feature_id)}));t._selectedCoordinates.length===r.length||e.silent||(t._emitSelectionChange=!0),t._selectedCoordinates=r}rt.prototype.createRenderBatch=function(){var t=this,e=this.render,r=0;return this.render=function(){r++},function(){t.render=e,r>0&&t.render()}},rt.prototype.setDirty=function(){return this.isDirty=!0,this},rt.prototype.featureChanged=function(t){return this._changedFeatureIds.add(t),this},rt.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},rt.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},rt.prototype.getAllIds=function(){return this._featureIds.values()},rt.prototype.add=function(t){return this.featureChanged(t.id),this._features[t.id]=t,this._featureIds.add(t.id),this},rt.prototype.delete=function(t,e){var r=this;return void 0===e&&(e={}),tt(t).forEach((function(t){r._featureIds.has(t)&&(r._featureIds.delete(t),r._selectedFeatureIds.delete(t),e.silent||-1===r._deletedFeaturesToEmit.indexOf(r._features[t])&&r._deletedFeaturesToEmit.push(r._features[t]),delete r._features[t],r.isDirty=!0)})),nt(this,e),this},rt.prototype.get=function(t){return this._features[t]},rt.prototype.getAll=function(){var t=this;return Object.keys(this._features).map((function(e){return t._features[e]}))},rt.prototype.select=function(t,e){var r=this;return void 0===e&&(e={}),tt(t).forEach((function(t){r._selectedFeatureIds.has(t)||(r._selectedFeatureIds.add(t),r._changedFeatureIds.add(t),e.silent||(r._emitSelectionChange=!0))})),this},rt.prototype.deselect=function(t,e){var r=this;return void 0===e&&(e={}),tt(t).forEach((function(t){r._selectedFeatureIds.has(t)&&(r._selectedFeatureIds.delete(t),r._changedFeatureIds.add(t),e.silent||(r._emitSelectionChange=!0))})),nt(this,e),this},rt.prototype.clearSelected=function(t){return void 0===t&&(t={}),this.deselect(this._selectedFeatureIds.values(),{silent:t.silent}),this},rt.prototype.setSelected=function(t,e){var r=this;return void 0===e&&(e={}),t=tt(t),this.deselect(this._selectedFeatureIds.values().filter((function(e){return-1===t.indexOf(e)})),{silent:e.silent}),this.select(t.filter((function(t){return!r._selectedFeatureIds.has(t)})),{silent:e.silent}),this},rt.prototype.setSelectedCoordinates=function(t){return this._selectedCoordinates=t,this._emitSelectionChange=!0,this},rt.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},rt.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},rt.prototype.getSelected=function(){var t=this;return this._selectedFeatureIds.values().map((function(e){return t.get(e)}))},rt.prototype.getSelectedCoordinates=function(){var t=this;return this._selectedCoordinates.map((function(e){return{coordinates:t.get(e.feature_id).getCoordinate(e.coord_path)}}))},rt.prototype.isSelected=function(t){return this._selectedFeatureIds.has(t)},rt.prototype.setFeatureProperty=function(t,e,r){this.get(t).setProperty(e,r),this.featureChanged(t)},rt.prototype.storeMapConfig=function(){var t=this;A.forEach((function(e){t.ctx.map[e]&&(t._mapInitialConfig[e]=t.ctx.map[e].isEnabled())}))},rt.prototype.restoreMapConfig=function(){var t=this;Object.keys(this._mapInitialConfig).forEach((function(e){t._mapInitialConfig[e]?t.ctx.map[e].enable():t.ctx.map[e].disable()}))},rt.prototype.getInitialConfigValue=function(t){return void 0===this._mapInitialConfig[t]||this._mapInitialConfig[t]};var it=function(){for(var t=arguments,e={},r=0;r<arguments.length;r++){var n=t[r];for(var i in n)ot.call(n,i)&&(e[i]=n[i])}return e},ot=Object.prototype.hasOwnProperty,at=["mode","feature","mouse"];function st(e){var r=null,n=null,i={onRemove:function(){return e.map.off("load",i.connect),clearInterval(n),i.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.map=null,e.container=null,e.store=null,r&&r.parentNode&&r.parentNode.removeChild(r),r=null,this},connect:function(){e.map.off("load",i.connect),clearInterval(n),i.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd:function(o){var s=o.fire;return o.fire=function(t,e){var r=arguments;return 1===s.length&&1!==arguments.length&&(r=[it({},{type:t},e)]),s.apply(o,r)},e.map=o,e.events=function(e){var r=Object.keys(e.options.modes).reduce((function(t,r){return t[r]=function(t){var e=Object.keys(t);return function(r,n){void 0===n&&(n={});var i={},o=e.reduce((function(e,r){return e[r]=t[r],e}),new K(r));return{start:function(){var e=this;i=o.onSetup(n),Q.forEach((function(r){var n,a=$[r],s=function(){return!1};t[a]&&(s=function(){return!0}),e.on(r,s,(n=a,function(t){return o[n](i,t)}))}))},stop:function(){o.onStop(i)},trash:function(){o.onTrash(i)},combineFeatures:function(){o.onCombineFeatures(i)},uncombineFeatures:function(){o.onUncombineFeatures(i)},render:function(t,e){o.toDisplayFeatures(i,t,e)}}}}(e.options.modes[r]),t}),{}),n={},i={},o={},a=null,s=null;o.drag=function(t,r){r({point:t.point,time:(new Date).getTime()})?(e.ui.queueMapClasses({mouse:"drag"}),s.drag(t)):t.originalEvent.stopPropagation()},o.mousedrag=function(t){o.drag(t,(function(t){return!U(n,t)}))},o.touchdrag=function(t){o.drag(t,(function(t){return!j(i,t)}))},o.mousemove=function(t){if(1===(void 0!==t.originalEvent.buttons?t.originalEvent.buttons:t.originalEvent.which))return o.mousedrag(t);var r=F(t,e);t.featureTarget=r,s.mousemove(t)},o.mousedown=function(t){n={time:(new Date).getTime(),point:t.point};var r=F(t,e);t.featureTarget=r,s.mousedown(t)},o.mouseup=function(t){var r=F(t,e);t.featureTarget=r,U(n,{point:t.point,time:(new Date).getTime()})?s.click(t):s.mouseup(t)},o.mouseout=function(t){s.mouseout(t)},o.touchstart=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled){i={time:(new Date).getTime(),point:t.point};var r=O.touch(t,null,e)[0];t.featureTarget=r,s.touchstart(t)}},o.touchmove=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled)return s.touchmove(t),o.touchdrag(t)},o.touchend=function(t){if(t.originalEvent.preventDefault(),e.options.touchEnabled){var r=O.touch(t,null,e)[0];t.featureTarget=r,j(i,{time:(new Date).getTime(),point:t.point})?s.tap(t):s.touchend(t)}};var u=function(t){return!(8===t||46===t||t>=48&&t<=57)};function l(n,i,o){void 0===o&&(o={}),s.stop();var u=r[n];if(void 0===u)throw new Error(n+" is not valid");a=n;var l=u(e,i);s=t(l,e),o.silent||e.map.fire("draw.modechange",{mode:n}),e.store.setDirty(),e.store.render()}o.keydown=function(t){"mapboxgl-canvas"===(t.srcElement||t.target).classList[0]&&(8!==t.keyCode&&46!==t.keyCode||!e.options.controls.trash?u(t.keyCode)?s.keydown(t):49===t.keyCode&&e.options.controls.point?l(x.DRAW_POINT):50===t.keyCode&&e.options.controls.line_string?l(x.DRAW_LINE_STRING):51===t.keyCode&&e.options.controls.polygon&&l(x.DRAW_POLYGON):(t.preventDefault(),s.trash()))},o.keyup=function(t){u(t.keyCode)&&s.keyup(t)},o.zoomend=function(){e.store.changeZoom()},o.data=function(t){if("style"===t.dataType){var r=e.setup,n=e.map,i=e.options,o=e.store;i.styles.some((function(t){return n.getLayer(t.id)}))||(r.addLayers(),o.setDirty(),o.render())}};var c={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){a=e.options.defaultMode,s=t(r[a](e),e)},changeMode:l,actionable:function(t){var r=!1;Object.keys(t).forEach((function(e){if(void 0===c[e])throw new Error("Invalid action type");c[e]!==t[e]&&(r=!0),c[e]=t[e]})),r&&e.map.fire("draw.actionable",{actions:c})},currentModeName:function(){return a},currentModeRender:function(t,e){return s.render(t,e)},fire:function(t,e){o[t]&&o[t](e)},addEventListeners:function(){e.map.on("mousemove",o.mousemove),e.map.on("mousedown",o.mousedown),e.map.on("mouseup",o.mouseup),e.map.on("data",o.data),e.map.on("touchmove",o.touchmove),e.map.on("touchstart",o.touchstart),e.map.on("touchend",o.touchend),e.container.addEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",o.keydown),e.container.addEventListener("keyup",o.keyup))},removeEventListeners:function(){e.map.off("mousemove",o.mousemove),e.map.off("mousedown",o.mousedown),e.map.off("mouseup",o.mouseup),e.map.off("data",o.data),e.map.off("touchmove",o.touchmove),e.map.off("touchstart",o.touchstart),e.map.off("touchend",o.touchend),e.container.removeEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",o.keydown),e.container.removeEventListener("keyup",o.keyup))},trash:function(t){s.trash(t)},combineFeatures:function(){s.combineFeatures()},uncombineFeatures:function(){s.uncombineFeatures()},getMode:function(){return a}}}(e),e.ui=function(t){var e={},r=null,n={mode:null,feature:null,mouse:null},i={mode:null,feature:null,mouse:null};function o(t){i=it(i,t)}function s(){var e,r;if(t.container){var o=[],a=[];at.forEach((function(t){i[t]!==n[t]&&(o.push(t+"-"+n[t]),null!==i[t]&&a.push(t+"-"+i[t]))})),o.length>0&&(e=t.container.classList).remove.apply(e,o),a.length>0&&(r=t.container.classList).add.apply(r,a),n=it(n,i)}}function u(t,e){void 0===e&&(e={});var n=document.createElement("button");return n.className="mapbox-gl-draw_ctrl-draw-btn "+e.className,n.setAttribute("title",e.title),e.container.appendChild(n),n.addEventListener("click",(function(n){if(n.preventDefault(),n.stopPropagation(),n.target===r)return l(),void e.onDeactivate();c(t),e.onActivate()}),!0),n}function l(){r&&(r.classList.remove(a),r=null)}function c(t){l();var n=e[t];n&&n&&"trash"!==t&&(n.classList.add(a),r=n)}return{setActiveButton:c,queueMapClasses:o,updateMapClasses:s,clearMapClasses:function(){o({mode:null,feature:null,mouse:null}),s()},addButtons:function(){var r=t.options.controls,n=document.createElement("div");return n.className="mapboxgl-ctrl-group mapboxgl-ctrl",r?(r[f.LINE]&&(e[f.LINE]=u(f.LINE,{container:n,className:"mapbox-gl-draw_line",title:"LineString tool "+(t.options.keybindings?"(l)":""),onActivate:function(){return t.events.changeMode(x.DRAW_LINE_STRING)},onDeactivate:function(){return t.events.trash()}})),r[f.POLYGON]&&(e[f.POLYGON]=u(f.POLYGON,{container:n,className:"mapbox-gl-draw_polygon",title:"Polygon tool "+(t.options.keybindings?"(p)":""),onActivate:function(){return t.events.changeMode(x.DRAW_POLYGON)},onDeactivate:function(){return t.events.trash()}})),r[f.POINT]&&(e[f.POINT]=u(f.POINT,{container:n,className:"mapbox-gl-draw_point",title:"Marker tool "+(t.options.keybindings?"(m)":""),onActivate:function(){return t.events.changeMode(x.DRAW_POINT)},onDeactivate:function(){return t.events.trash()}})),r.trash&&(e.trash=u("trash",{container:n,className:"mapbox-gl-draw_trash",title:"Delete",onActivate:function(){t.events.trash()}})),r.combine_features&&(e.combine_features=u("combineFeatures",{container:n,className:"mapbox-gl-draw_combine",title:"Combine",onActivate:function(){t.events.combineFeatures()}})),r.uncombine_features&&(e.uncombine_features=u("uncombineFeatures",{container:n,className:"mapbox-gl-draw_uncombine",title:"Uncombine",onActivate:function(){t.events.uncombineFeatures()}})),n):n},removeButtons:function(){Object.keys(e).forEach((function(t){var r=e[t];r.parentNode&&r.parentNode.removeChild(r),delete e[t]}))}}}(e),e.container=o.getContainer(),e.store=new rt(e),r=e.ui.addButtons(),e.options.boxSelect&&(o.boxZoom.disable(),o.dragPan.disable(),o.dragPan.enable()),o.loaded()?i.connect():(o.on("load",i.connect),n=setInterval((function(){o.loaded()&&i.connect()}),16)),e.events.start(),r},addLayers:function(){e.map.addSource(u,{data:{type:v,features:[]},type:"geojson"}),e.map.addSource(s,{data:{type:v,features:[]},type:"geojson"}),e.options.styles.forEach((function(t){e.map.addLayer(t)})),e.store.setDirty(!0),e.store.render()},removeLayers:function(){e.options.styles.forEach((function(t){e.map.getLayer(t.id)&&e.map.removeLayer(t.id)})),e.map.getSource(u)&&e.map.removeSource(u),e.map.getSource(s)&&e.map.removeSource(s)}};return e.setup=i,i}function ut(t){return function(e){var r=e.featureTarget;return!!r&&!!r.properties&&r.properties.meta===t}}function lt(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.active===T&&t.featureTarget.properties.meta===C}function ct(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.active===L&&t.featureTarget.properties.meta===C}function ht(t){return void 0===t.featureTarget}function pt(t){var e=t.featureTarget;return!!e&&!!e.properties&&e.properties.meta===M}function ft(t){return!!t.originalEvent&&!0===t.originalEvent.shiftKey}function dt(t){return 27===t.keyCode}function gt(t){return 13===t.keyCode}var yt=mt;function mt(t,e){this.x=t,this.y=e}function vt(t,e){var r=e.getBoundingClientRect();return new yt(t.clientX-r.left-(e.clientLeft||0),t.clientY-r.top-(e.clientTop||0))}function _t(t,e,r,n){return{type:d,properties:{meta:M,parent:t,coord_path:r,active:n?T:L},geometry:{type:m,coordinates:e}}}function xt(t,e,r){void 0===e&&(e={}),void 0===r&&(r=null);var n,i=t.geometry,o=i.type,a=i.coordinates,s=t.properties&&t.properties.id,u=[];function l(t,r){var n="",i=null;t.forEach((function(t,o){var a=null!=r?r+"."+o:String(o),l=_t(s,t,a,c(a));if(e.midpoints&&i){var h=function(t,e,r){var n=e.geometry.coordinates,i=r.geometry.coordinates;if(n[1]>85||n[1]<-85||i[1]>85||i[1]<-85)return null;var o={lng:(n[0]+i[0])/2,lat:(n[1]+i[1])/2};return{type:d,properties:{meta:P,parent:t,lng:o.lng,lat:o.lat,coord_path:r.properties.coord_path},geometry:{type:m,coordinates:[o.lng,o.lat]}}}(s,i,l);h&&u.push(h)}i=l;var p=JSON.stringify(t);n!==p&&u.push(l),0===o&&(n=p)}))}function c(t){return!!e.selectedPaths&&-1!==e.selectedPaths.indexOf(t)}return o===m?u.push(_t(s,a,r,c(r))):o===g?a.forEach((function(t,e){l(t,null!==r?r+"."+e:String(e))})):o===y?l(a,r):0===o.indexOf(_)&&(n=o.replace(_,""),a.forEach((function(r,i){var o={type:d,properties:t.properties,geometry:{type:n,coordinates:r}};u=u.concat(xt(o,e,i))}))),u}mt.prototype={clone:function(){return new mt(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),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},mt.convert=function(t){return t instanceof mt?t:Array.isArray(t)?new mt(t[0],t[1]):t};var bt=function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t._ctx&&t._ctx.store&&t._ctx.store.getInitialConfigValue&&t._ctx.store.getInitialConfigValue("doubleClickZoom")&&t.map.doubleClickZoom.enable()}),0)},wt=function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t.map.doubleClickZoom.disable()}),0)},Et=function(t){if(!t||!t.type)return null;var e=It[t.type];return e?"geometry"===e?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]}:"feature"===e?{type:"FeatureCollection",features:[t]}:"featurecollection"===e?t:void 0:null},It={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};function St(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce((function(t,e){return t.concat(St(e))}),[]),t;case"Feature":return t.geometry?St(t.geometry).map((function(e){var r={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(r.id=t.id),r})):[t];case"MultiPoint":return t.coordinates.map((function(t){return{type:"Point",coordinates:t}}));case"MultiPolygon":return t.coordinates.map((function(t){return{type:"Polygon",coordinates:t}}));case"MultiLineString":return t.coordinates.map((function(t){return{type:"LineString",coordinates:t}}));case"GeometryCollection":return t.geometries.map(St).reduce((function(t,e){return t.concat(e)}),[]);case"Point":case"Polygon":case"LineString":return[t]}}var Ct=V((function(t){var e=t.exports=function(t){return new r(t)};function r(t){this.value=t}function n(t,e,r){var n=[],a=[],c=!0;return function t(h){var p=r?i(h):h,f={},d=!0,g={node:p,node_:h,path:[].concat(n),parent:a[a.length-1],parents:a,key:n.slice(-1)[0],isRoot:0===n.length,level:n.length,circular:null,update:function(t,e){g.isRoot||(g.parent.node[g.key]=t),g.node=t,e&&(d=!1)},delete:function(t){delete g.parent.node[g.key],t&&(d=!1)},remove:function(t){s(g.parent.node)?g.parent.node.splice(g.key,1):delete g.parent.node[g.key],t&&(d=!1)},keys:null,before:function(t){f.before=t},after:function(t){f.after=t},pre:function(t){f.pre=t},post:function(t){f.post=t},stop:function(){c=!1},block:function(){d=!1}};if(!c)return g;function y(){if("object"==typeof g.node&&null!==g.node){g.keys&&g.node_===g.node||(g.keys=o(g.node)),g.isLeaf=0==g.keys.length;for(var t=0;t<a.length;t++)if(a[t].node_===h){g.circular=a[t];break}}else g.isLeaf=!0,g.keys=null;g.notLeaf=!g.isLeaf,g.notRoot=!g.isRoot}y();var m=e.call(g,g.node);return void 0!==m&&g.update&&g.update(m),f.before&&f.before.call(g,g.node),d?("object"!=typeof g.node||null===g.node||g.circular||(a.push(g),y(),u(g.keys,(function(e,i){n.push(e),f.pre&&f.pre.call(g,g.node[e],e);var o=t(g.node[e]);r&&l.call(g.node,e)&&(g.node[e]=o.node),o.isLast=i==g.keys.length-1,o.isFirst=0==i,f.post&&f.post.call(g,o),n.pop()})),a.pop()),f.after&&f.after.call(g,g.node),g):g}(t).node}function i(t){if("object"==typeof t&&null!==t){var e;if(s(t))e=[];else if("[object Date]"===a(t))e=new Date(t.getTime?t.getTime():t);else if(function(t){return"[object RegExp]"===a(t)}(t))e=new RegExp(t);else if(function(t){return"[object Error]"===a(t)}(t))e={message:t.message};else if(function(t){return"[object Boolean]"===a(t)}(t))e=new Boolean(t);else if(function(t){return"[object Number]"===a(t)}(t))e=new Number(t);else if(function(t){return"[object String]"===a(t)}(t))e=new String(t);else if(Object.create&&Object.getPrototypeOf)e=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)e={};else{var r=t.constructor&&t.constructor.prototype||t.__proto__||{},n=function(){};n.prototype=r,e=new n}return u(o(t),(function(r){e[r]=t[r]})),e}return t}r.prototype.get=function(t){for(var e=this.value,r=0;r<t.length;r++){var n=t[r];if(!e||!l.call(e,n)){e=void 0;break}e=e[n]}return e},r.prototype.has=function(t){for(var e=this.value,r=0;r<t.length;r++){var n=t[r];if(!e||!l.call(e,n))return!1;e=e[n]}return!0},r.prototype.set=function(t,e){for(var r=this.value,n=0;n<t.length-1;n++){var i=t[n];l.call(r,i)||(r[i]={}),r=r[i]}return r[t[n]]=e,e},r.prototype.map=function(t){return n(this.value,t,!0)},r.prototype.forEach=function(t){return this.value=n(this.value,t,!1),this.value},r.prototype.reduce=function(t,e){var r=1===arguments.length,n=r?this.value:e;return this.forEach((function(e){this.isRoot&&r||(n=t.call(this,n,e))})),n},r.prototype.paths=function(){var t=[];return this.forEach((function(e){t.push(this.path)})),t},r.prototype.nodes=function(){var t=[];return this.forEach((function(e){t.push(this.node)})),t},r.prototype.clone=function(){var t=[],e=[];return function r(n){for(var a=0;a<t.length;a++)if(t[a]===n)return e[a];if("object"==typeof n&&null!==n){var s=i(n);return t.push(n),e.push(s),u(o(n),(function(t){s[t]=r(n[t])})),t.pop(),e.pop(),s}return n}(this.value)};var o=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};function a(t){return Object.prototype.toString.call(t)}var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},u=function(t,e){if(t.forEach)return t.forEach(e);for(var r=0;r<t.length;r++)e(t[r],r,t)};u(o(r.prototype),(function(t){e[t]=function(e){var n=[].slice.call(arguments,1),i=new r(e);return i[t].apply(i,n)}}));var l=Object.hasOwnProperty||function(t,e){return e in t}})),Pt=Mt;function Mt(t){if(!(this instanceof Mt))return new Mt(t);this._bbox=t||[1/0,1/0,-1/0,-1/0],this._valid=!!t}Mt.prototype.include=function(t){return this._valid=!0,this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[0]),this._bbox[3]=Math.max(this._bbox[3],t[1]),this},Mt.prototype.equals=function(t){var e;return e=t instanceof Mt?t.bbox():t,this._bbox[0]==e[0]&&this._bbox[1]==e[1]&&this._bbox[2]==e[2]&&this._bbox[3]==e[3]},Mt.prototype.center=function(t){return this._valid?[(this._bbox[0]+this._bbox[2])/2,(this._bbox[1]+this._bbox[3])/2]:null},Mt.prototype.union=function(t){var e;return this._valid=!0,e=t instanceof Mt?t.bbox():t,this._bbox[0]=Math.min(this._bbox[0],e[0]),this._bbox[1]=Math.min(this._bbox[1],e[1]),this._bbox[2]=Math.max(this._bbox[2],e[2]),this._bbox[3]=Math.max(this._bbox[3],e[3]),this},Mt.prototype.bbox=function(){return this._valid?this._bbox:null},Mt.prototype.contains=function(t){if(!t)return this._fastContains();if(!this._valid)return null;var e=t[0],r=t[1];return this._bbox[0]<=e&&this._bbox[1]<=r&&this._bbox[2]>=e&&this._bbox[3]>=r},Mt.prototype.intersect=function(t){return this._valid?(e=t instanceof Mt?t.bbox():t,!(this._bbox[0]>e[2]||this._bbox[2]<e[0]||this._bbox[3]<e[1]||this._bbox[1]>e[3])):null;var e},Mt.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},Mt.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var Tt={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},Lt=Object.keys(Tt),At=function(t){return kt(t).bbox()};function kt(t){for(var e=Pt(),r=function(t){if(!t)return[];var e=St(Et(t)),r=[];return e.features.forEach((function(t){t.geometry&&(r=r.concat(function t(e){return Array.isArray(e)&&e.length&&"number"==typeof e[0]?[e]:e.reduce((function(e,r){return Array.isArray(r)&&Array.isArray(r[0])?e.concat(t(r)):(e.push(r),e)}),[])}(t.geometry.coordinates)))})),r}(t),n=0;n<r.length;n++)e.include(r[n]);return e}At.polygon=function(t){return kt(t).polygon()},At.bboxify=function(t){return Ct(t).map((function(t){t&&Lt.some((function(e){return!!t[e]&&-1!==Tt[e].indexOf(t.type)}))&&(t.bbox=kt(t).bbox(),this.update(t))}))};function Nt(t,e){var r=-90,n=90,i=-90,o=90,a=270,s=-270;t.forEach((function(t){var e=At(t),u=e[1],l=e[3],c=e[0],h=e[2];u>r&&(r=u),l<n&&(n=l),l>i&&(i=l),u<o&&(o=u),c<a&&(a=c),h>s&&(s=h)}));var u=e;return r+u.lat>85&&(u.lat=85-r),i+u.lat>90&&(u.lat=90-i),n+u.lat<-85&&(u.lat=-85-n),o+u.lat<-90&&(u.lat=-90-o),a+u.lng<=-270&&(u.lng+=360*Math.ceil(Math.abs(u.lng)/360)),s+u.lng>=270&&(u.lng-=360*Math.ceil(Math.abs(u.lng)/360)),u}function Dt(t,e){var r=Nt(t.map((function(t){return t.toGeoJSON()})),e);t.forEach((function(t){var e,n=t.getCoordinates(),i=function(t){var e={lng:t[0]+r.lng,lat:t[1]+r.lat};return[e.lng,e.lat]},o=function(t){return t.map((function(t){return i(t)}))};t.type===m?e=i(n):t.type===y||"MultiPoint"===t.type?e=n.map(i):t.type===g||"MultiLineString"===t.type?e=n.map(o):"MultiPolygon"===t.type&&(e=n.map((function(t){return t.map((function(t){return o(t)}))}))),t.incomingCoords(e)}))}var Rt={onSetup:function(t){var e=this,r={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:t.featureIds||[]};return this.setSelected(r.initiallySelectedFeatureIds.filter((function(t){return void 0!==e.getFeature(t)}))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),r},fireUpdate:function(){this.map.fire(E,{action:"move",features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(){var t=this,e=this.getSelected(),r=e.filter((function(e){return t.isInstanceOf("MultiFeature",e)})),n=!1;if(e.length>1){n=!0;var i=e[0].type.replace("Multi","");e.forEach((function(t){t.type.replace("Multi","")!==i&&(n=!1)}))}var o=r.length>0,a=e.length>0;this.setActionableState({combineFeatures:n,uncombineFeatures:o,trash:a})},getUniqueIds:function(t){return t.length?t.map((function(t){return t.properties.id})).filter((function(t){return void 0!==t})).reduce((function(t,e){return t.add(e),t}),new D).values():[]},stopExtendedInteractions:function(t){t.boxSelectElement&&(t.boxSelectElement.parentNode&&t.boxSelectElement.parentNode.removeChild(t.boxSelectElement),t.boxSelectElement=null),this.map.dragPan.enable(),t.boxSelecting=!1,t.canBoxSelect=!1,t.dragMoving=!1,t.canDragMove=!1},onStop:function(){bt(this)},onMouseMove:function(t){return this.stopExtendedInteractions(t),!0},onMouseOut:function(t){return!t.dragMoving||this.fireUpdate()}};Rt.onTap=Rt.onClick=function(t,e){return ht(e)?this.clickAnywhere(t,e):ut(M)(e)?this.clickOnVertex(t,e):function(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.meta===C}(e)?this.clickOnFeature(t,e):void 0},Rt.clickAnywhere=function(t){var e=this,r=this.getSelectedIds();r.length&&(this.clearSelectedFeatures(),r.forEach((function(t){return e.doRender(t)}))),bt(this),this.stopExtendedInteractions(t)},Rt.clickOnVertex=function(t,e){this.changeMode(x.DIRECT_SELECT,{featureId:e.featureTarget.properties.parent,coordPath:e.featureTarget.properties.coord_path,startPos:e.lngLat}),this.updateUIClasses({mouse:c})},Rt.startOnActiveFeature=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),this.doRender(e.featureTarget.properties.id),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},Rt.clickOnFeature=function(t,e){var r=this;wt(this),this.stopExtendedInteractions(t);var n=ft(e),i=this.getSelectedIds(),o=e.featureTarget.properties.id,a=this.isSelected(o);if(!n&&a&&this.getFeature(o).type!==m)return this.changeMode(x.DIRECT_SELECT,{featureId:o});a&&n?(this.deselect(o),this.updateUIClasses({mouse:h}),1===i.length&&bt(this)):!a&&n?(this.select(o),this.updateUIClasses({mouse:c})):a||n||(i.forEach((function(t){return r.doRender(t)})),this.setSelected(o),this.updateUIClasses({mouse:c})),this.doRender(o)},Rt.onMouseDown=function(t,e){return lt(e)?this.startOnActiveFeature(t,e):this.drawConfig.boxSelect&&function(t){return!!t.originalEvent&&!!t.originalEvent.shiftKey&&0===t.originalEvent.button}(e)?this.startBoxSelect(t,e):void 0},Rt.startBoxSelect=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),t.boxSelectStartLocation=vt(e.originalEvent,this.map.getContainer()),t.canBoxSelect=!0},Rt.onTouchStart=function(t,e){if(lt(e))return this.startOnActiveFeature(t,e)},Rt.onDrag=function(t,e){return t.canDragMove?this.dragMove(t,e):this.drawConfig.boxSelect&&t.canBoxSelect?this.whileBoxSelect(t,e):void 0},Rt.whileBoxSelect=function(t,e){t.boxSelecting=!0,this.updateUIClasses({mouse:l}),t.boxSelectElement||(t.boxSelectElement=document.createElement("div"),t.boxSelectElement.classList.add("mapbox-gl-draw_boxselect"),this.map.getContainer().appendChild(t.boxSelectElement));var r=vt(e.originalEvent,this.map.getContainer()),n=Math.min(t.boxSelectStartLocation.x,r.x),i=Math.max(t.boxSelectStartLocation.x,r.x),o=Math.min(t.boxSelectStartLocation.y,r.y),a=Math.max(t.boxSelectStartLocation.y,r.y),s="translate("+n+"px, "+o+"px)";t.boxSelectElement.style.transform=s,t.boxSelectElement.style.WebkitTransform=s,t.boxSelectElement.style.width=i-n+"px",t.boxSelectElement.style.height=a-o+"px"},Rt.dragMove=function(t,e){t.dragMoving=!0,e.originalEvent.stopPropagation();var r={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};Dt(this.getSelected(),r),t.dragMoveLocation=e.lngLat},Rt.onTouchEnd=Rt.onMouseUp=function(t,e){var r=this;if(t.dragMoving)this.fireUpdate();else if(t.boxSelecting){var n=[t.boxSelectStartLocation,vt(e.originalEvent,this.map.getContainer())],i=this.featuresAt(null,n,"click"),o=this.getUniqueIds(i).filter((function(t){return!r.isSelected(t)}));o.length&&(this.select(o),o.forEach((function(t){return r.doRender(t)})),this.updateUIClasses({mouse:c}))}this.stopExtendedInteractions(t)},Rt.toDisplayFeatures=function(t,e,r){e.properties.active=this.isSelected(e.properties.id)?T:L,r(e),this.fireActionable(),e.properties.active===T&&e.geometry.type!==m&&xt(e).forEach(r)},Rt.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},Rt.onCombineFeatures=function(){var t=this.getSelected();if(!(0===t.length||t.length<2)){for(var e=[],r=[],n=t[0].type.replace("Multi",""),i=0;i<t.length;i++){var o=t[i];if(o.type.replace("Multi","")!==n)return;o.type.includes("Multi")?o.getCoordinates().forEach((function(t){e.push(t)})):e.push(o.getCoordinates()),r.push(o.toGeoJSON())}if(r.length>1){var a=this.newFeature({type:d,properties:r[0].properties,geometry:{type:"Multi"+n,coordinates:e}});this.addFeature(a),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([a.id]),this.map.fire("draw.combine",{createdFeatures:[a.toGeoJSON()],deletedFeatures:r})}this.fireActionable()}},Rt.onUncombineFeatures=function(){var t=this,e=this.getSelected();if(0!==e.length){for(var r=[],n=[],i=function(i){var o=e[i];t.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach((function(e){t.addFeature(e),e.properties=o.properties,r.push(e.toGeoJSON()),t.select([e.id])})),t.deleteFeature(o.id,{silent:!0}),n.push(o.toGeoJSON()))},o=0;o<e.length;o++)i(o);r.length>1&&this.map.fire("draw.uncombine",{createdFeatures:r,deletedFeatures:n}),this.fireActionable()}};var Ot=ut(M),zt=ut(P),Ft={fireUpdate:function(){this.map.fire(E,{action:"change_coordinates",features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(t){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:t.selectedCoordPaths.length>0})},startDragging:function(t,e){this.map.dragPan.disable(),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},stopDragging:function(t){this.map.dragPan.enable(),t.dragMoving=!1,t.canDragMove=!1,t.dragMoveLocation=null},onVertex:function(t,e){this.startDragging(t,e);var r=e.featureTarget.properties,n=t.selectedCoordPaths.indexOf(r.coord_path);ft(e)||-1!==n?ft(e)&&-1===n&&t.selectedCoordPaths.push(r.coord_path):t.selectedCoordPaths=[r.coord_path];var i=this.pathsToCoordinates(t.featureId,t.selectedCoordPaths);this.setSelectedCoordinates(i)},onMidpoint:function(t,e){this.startDragging(t,e);var r=e.featureTarget.properties;t.feature.addCoordinate(r.coord_path,r.lng,r.lat),this.fireUpdate(),t.selectedCoordPaths=[r.coord_path]},pathsToCoordinates:function(t,e){return e.map((function(e){return{feature_id:t,coord_path:e}}))},onFeature:function(t,e){0===t.selectedCoordPaths.length?this.startDragging(t,e):this.stopDragging(t)},dragFeature:function(t,e,r){Dt(this.getSelected(),r),t.dragMoveLocation=e.lngLat},dragVertex:function(t,e,r){for(var n=t.selectedCoordPaths.map((function(e){return t.feature.getCoordinate(e)})),i=Nt(n.map((function(t){return{type:d,properties:{},geometry:{type:m,coordinates:t}}})),r),o=0;o<n.length;o++){var a=n[o];t.feature.updateCoordinate(t.selectedCoordPaths[o],a[0]+i.lng,a[1]+i.lat)}},clickNoTarget:function(){this.changeMode(x.SIMPLE_SELECT)},clickInactive:function(){this.changeMode(x.SIMPLE_SELECT)},clickActiveFeature:function(t){t.selectedCoordPaths=[],this.clearSelectedCoordinates(),t.feature.changed()},onSetup:function(t){var e=t.featureId,r=this.getFeature(e);if(!r)throw new Error("You must provide a featureId to enter direct_select mode");if(r.type===m)throw new TypeError("direct_select mode doesn't handle point features");var n={featureId:e,feature:r,dragMoveLocation:t.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:t.coordPath?[t.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(e,n.selectedCoordPaths)),this.setSelected(e),wt(this),this.setActionableState({trash:!0}),n},onStop:function(){bt(this),this.clearSelectedCoordinates()},toDisplayFeatures:function(t,e,r){t.featureId===e.properties.id?(e.properties.active=T,r(e),xt(e,{map:this.map,midpoints:!0,selectedPaths:t.selectedCoordPaths}).forEach(r)):(e.properties.active=L,r(e)),this.fireActionable(t)},onTrash:function(t){t.selectedCoordPaths.sort((function(t,e){return e.localeCompare(t,"en",{numeric:!0})})).forEach((function(e){return t.feature.removeCoordinate(e)})),this.fireUpdate(),t.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(t),!1===t.feature.isValid()&&(this.deleteFeature([t.featureId]),this.changeMode(x.SIMPLE_SELECT,{}))},onMouseMove:function(t,e){var r=lt(e),n=Ot(e),i=0===t.selectedCoordPaths.length;return r&&i||n&&!i?this.updateUIClasses({mouse:c}):this.updateUIClasses({mouse:p}),this.stopDragging(t),!0},onMouseOut:function(t){return t.dragMoving&&this.fireUpdate(),!0}};Ft.onTouchStart=Ft.onMouseDown=function(t,e){return Ot(e)?this.onVertex(t,e):lt(e)?this.onFeature(t,e):zt(e)?this.onMidpoint(t,e):void 0},Ft.onDrag=function(t,e){if(!0===t.canDragMove){t.dragMoving=!0,e.originalEvent.stopPropagation();var r={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};t.selectedCoordPaths.length>0?this.dragVertex(t,e,r):this.dragFeature(t,e,r),t.dragMoveLocation=e.lngLat}},Ft.onClick=function(t,e){return ht(e)?this.clickNoTarget(t,e):lt(e)?this.clickActiveFeature(t,e):ct(e)?this.clickInactive(t,e):void this.stopDragging(t)},Ft.onTap=function(t,e){return ht(e)?this.clickNoTarget(t,e):lt(e)?this.clickActiveFeature(t,e):ct(e)?this.clickInactive(t,e):void 0},Ft.onTouchEnd=Ft.onMouseUp=function(t){t.dragMoving&&this.fireUpdate(),this.stopDragging(t)};var Bt={};function Ut(t,e){return!!t.lngLat&&t.lngLat.lng===e[0]&&t.lngLat.lat===e[1]}Bt.onSetup=function(){var t=this.newFeature({type:d,properties:{},geometry:{type:m,coordinates:[]}});return this.addFeature(t),this.clearSelectedFeatures(),this.updateUIClasses({mouse:l}),this.activateUIButton(f.POINT),this.setActionableState({trash:!0}),{point:t}},Bt.stopDrawingAndRemove=function(t){this.deleteFeature([t.point.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT)},Bt.onTap=Bt.onClick=function(t,e){this.updateUIClasses({mouse:c}),t.point.updateCoordinate("",e.lngLat.lng,e.lngLat.lat),this.map.fire(b,{features:[t.point.toGeoJSON()]}),this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.point.id]})},Bt.onStop=function(t){this.activateUIButton(),t.point.getCoordinate().length||this.deleteFeature([t.point.id],{silent:!0})},Bt.toDisplayFeatures=function(t,e,r){var n=e.properties.id===t.point.id;if(e.properties.active=n?T:L,!n)return r(e)},Bt.onTrash=Bt.stopDrawingAndRemove,Bt.onKeyUp=function(t,e){if(dt(e)||gt(e))return this.stopDrawingAndRemove(t,e)};var jt={onSetup:function(){var t=this.newFeature({type:d,properties:{},geometry:{type:g,coordinates:[[]]}});return this.addFeature(t),this.clearSelectedFeatures(),wt(this),this.updateUIClasses({mouse:l}),this.activateUIButton(f.POLYGON),this.setActionableState({trash:!0}),{polygon:t,currentVertexPosition:0}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&Ut(e,t.polygon.coordinates[0][t.currentVertexPosition-1]))return this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.polygon.id]});this.updateUIClasses({mouse:l}),t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),t.currentVertexPosition++,t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},onMouseMove:function(t,e){t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),pt(e)&&this.updateUIClasses({mouse:h})}};jt.onTap=jt.onClick=function(t,e){return pt(e)?this.clickOnVertex(t,e):this.clickAnywhere(t,e)},jt.onKeyUp=function(t,e){dt(e)?(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT)):gt(e)&&this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},jt.onStop=function(t){this.updateUIClasses({mouse:p}),bt(this),this.activateUIButton(),void 0!==this.getFeature(t.polygon.id)&&(t.polygon.removeCoordinate("0."+t.currentVertexPosition),t.polygon.isValid()?this.map.fire(b,{features:[t.polygon.toGeoJSON()]}):(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT,{},{silent:!0})))},jt.toDisplayFeatures=function(t,e,r){var n=e.properties.id===t.polygon.id;if(e.properties.active=n?T:L,!n)return r(e);if(0!==e.geometry.coordinates.length){var i=e.geometry.coordinates[0].length;if(!(i<3)){if(e.properties.meta=C,r(_t(t.polygon.id,e.geometry.coordinates[0][0],"0.0",!1)),i>3){var o=e.geometry.coordinates[0].length-3;r(_t(t.polygon.id,e.geometry.coordinates[0][o],"0."+o,!1))}if(i<=4){var a=[[e.geometry.coordinates[0][0][0],e.geometry.coordinates[0][0][1]],[e.geometry.coordinates[0][1][0],e.geometry.coordinates[0][1][1]]];if(r({type:d,properties:e.properties,geometry:{coordinates:a,type:y}}),3===i)return}return r(e)}}},jt.onTrash=function(t){this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT)};var Vt={onSetup:function(t){var e,r,n=(t=t||{}).featureId,i="forward";if(n){if(!(e=this.getFeature(n)))throw new Error("Could not find a feature with the provided featureId");var o=t.from;if(o&&"Feature"===o.type&&o.geometry&&"Point"===o.geometry.type&&(o=o.geometry),o&&"Point"===o.type&&o.coordinates&&2===o.coordinates.length&&(o=o.coordinates),!o||!Array.isArray(o))throw new Error("Please use the `from` property to indicate which point to continue the line from");var a=e.coordinates.length-1;if(e.coordinates[a][0]===o[0]&&e.coordinates[a][1]===o[1])r=a+1,e.addCoordinate.apply(e,[r].concat(e.coordinates[a]));else{if(e.coordinates[0][0]!==o[0]||e.coordinates[0][1]!==o[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");i="backwards",r=0,e.addCoordinate.apply(e,[r].concat(e.coordinates[0]))}}else e=this.newFeature({type:d,properties:{},geometry:{type:y,coordinates:[]}}),r=0,this.addFeature(e);return this.clearSelectedFeatures(),wt(this),this.updateUIClasses({mouse:l}),this.activateUIButton(f.LINE),this.setActionableState({trash:!0}),{line:e,currentVertexPosition:r,direction:i}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&Ut(e,t.line.coordinates[t.currentVertexPosition-1])||"backwards"===t.direction&&Ut(e,t.line.coordinates[t.currentVertexPosition+1]))return this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.line.id]});this.updateUIClasses({mouse:l}),t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),"forward"===t.direction?(t.currentVertexPosition++,t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)):t.line.addCoordinate(0,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.line.id]})},onMouseMove:function(t,e){t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),pt(e)&&this.updateUIClasses({mouse:h})}};Vt.onTap=Vt.onClick=function(t,e){if(pt(e))return this.clickOnVertex(t,e);this.clickAnywhere(t,e)},Vt.onKeyUp=function(t,e){gt(e)?this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.line.id]}):dt(e)&&(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT))},Vt.onStop=function(t){bt(this),this.activateUIButton(),void 0!==this.getFeature(t.line.id)&&(t.line.removeCoordinate(""+t.currentVertexPosition),t.line.isValid()?this.map.fire(b,{features:[t.line.toGeoJSON()]}):(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT,{},{silent:!0})))},Vt.onTrash=function(t){this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT)},Vt.toDisplayFeatures=function(t,e,r){var n=e.properties.id===t.line.id;if(e.properties.active=n?T:L,!n)return r(e);e.geometry.coordinates.length<2||(e.properties.meta=C,r(_t(t.line.id,e.geometry.coordinates["forward"===t.direction?e.geometry.coordinates.length-2:1],""+("forward"===t.direction?e.geometry.coordinates.length-2:1),!1)),r(e))};var qt={simple_select:Rt,direct_select:Ft,draw_point:Bt,draw_polygon:jt,draw_line_string:Vt},Gt={defaultMode:x.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}],modes:qt,controls:{},userProperties:!1},Xt={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Zt={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function Yt(t,e){return t.map((function(t){return t.source?t:it(t,{id:t.id+"."+e,source:"hot"===e?s:u})}))}var Wt=V((function(t,e){var r="[object Arguments]",n="[object Map]",i="[object Object]",o="[object Set]",a=/^\[object .+?Constructor\]$/,s=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[r]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u[n]=u["[object Number]"]=u[i]=u["[object RegExp]"]=u[o]=u["[object String]"]=u["[object WeakMap]"]=!1;var l="object"==typeof global&&global&&global.Object===Object&&global,c="object"==typeof self&&self&&self.Object===Object&&self,h=l||c||Function("return this")(),p=e&&!e.nodeType&&e,f=p&&t&&!t.nodeType&&t,d=f&&f.exports===p,g=d&&l.process,y=function(){try{return g&&g.binding&&g.binding("util")}catch(t){}}(),m=y&&y.isTypedArray;function v(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function _(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function x(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var b,w,E,I=Array.prototype,S=Function.prototype,C=Object.prototype,P=h["__core-js_shared__"],M=S.toString,T=C.hasOwnProperty,L=(b=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||""))?"Symbol(src)_1."+b:"",A=C.toString,k=RegExp("^"+M.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),N=d?h.Buffer:void 0,D=h.Symbol,R=h.Uint8Array,O=C.propertyIsEnumerable,z=I.splice,F=D?D.toStringTag:void 0,B=Object.getOwnPropertySymbols,U=N?N.isBuffer:void 0,j=(w=Object.keys,E=Object,function(t){return w(E(t))}),V=ft(h,"DataView"),q=ft(h,"Map"),G=ft(h,"Promise"),X=ft(h,"Set"),Z=ft(h,"WeakMap"),Y=ft(Object,"create"),W=mt(V),H=mt(q),J=mt(G),K=mt(X),$=mt(Z),Q=D?D.prototype:void 0,tt=Q?Q.valueOf:void 0;function et(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function rt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function nt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function it(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new nt;++e<r;)this.add(t[e])}function ot(t){var e=this.__data__=new rt(t);this.size=e.size}function at(t,e){for(var r=t.length;r--;)if(vt(t[r][0],e))return r;return-1}function st(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":F&&F in Object(t)?function(t){var e=T.call(t,F),r=t[F];try{t[F]=void 0;var n=!0}catch(t){}var i=A.call(t);n&&(e?t[F]=r:delete t[F]);return i}(t):function(t){return A.call(t)}(t)}function ut(t){return St(t)&&st(t)==r}function lt(t,e,a,s,u){return t===e||(null==t||null==e||!St(t)&&!St(e)?t!=t&&e!=e:function(t,e,a,s,u,l){var c=xt(t),h=xt(e),p=c?"[object Array]":gt(t),f=h?"[object Array]":gt(e),d=(p=p==r?i:p)==i,g=(f=f==r?i:f)==i,y=p==f;if(y&&bt(t)){if(!bt(e))return!1;c=!0,d=!1}if(y&&!d)return l||(l=new ot),c||Ct(t)?ct(t,e,a,s,u,l):function(t,e,r,i,a,s,u){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!s(new R(t),new R(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return vt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case n:var l=_;case o:var c=1&i;if(l||(l=x),t.size!=e.size&&!c)return!1;var h=u.get(t);if(h)return h==e;i|=2,u.set(t,e);var p=ct(l(t),l(e),i,a,s,u);return u.delete(t),p;case"[object Symbol]":if(tt)return tt.call(t)==tt.call(e)}return!1}(t,e,p,a,s,u,l);if(!(1&a)){var m=d&&T.call(t,"__wrapped__"),v=g&&T.call(e,"__wrapped__");if(m||v){var b=m?t.value():t,w=v?e.value():e;return l||(l=new ot),u(b,w,a,s,l)}}return!!y&&(l||(l=new ot),function(t,e,r,n,i,o){var a=1&r,s=ht(t),u=s.length;if(u!=ht(e).length&&!a)return!1;for(var l=u;l--;){var c=s[l];if(!(a?c in e:T.call(e,c)))return!1}var h=o.get(t);if(h&&o.get(e))return h==e;var p=!0;o.set(t,e),o.set(e,t);for(var f=a;++l<u;){var d=t[c=s[l]],g=e[c];if(n)var y=a?n(g,d,c,e,t,o):n(d,g,c,t,e,o);if(!(void 0===y?d===g||i(d,g,r,n,o):y)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){var m=t.constructor,v=e.constructor;m==v||!("constructor"in t)||!("constructor"in e)||"function"==typeof m&&m instanceof m&&"function"==typeof v&&v instanceof v||(p=!1)}return o.delete(t),o.delete(e),p}(t,e,a,s,u,l))}(t,e,a,s,lt,u))}function ct(t,e,r,n,i,o){var a=1&r,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var l=o.get(t);if(l&&o.get(e))return l==e;var c=-1,h=!0,p=2&r?new it:void 0;for(o.set(t,e),o.set(e,t);++c<s;){var f=t[c],d=e[c];if(n)var g=a?n(d,f,c,e,t,o):n(f,d,c,t,e,o);if(void 0!==g){if(g)continue;h=!1;break}if(p){if(!v(e,(function(t,e){if(a=e,!p.has(a)&&(f===t||i(f,t,r,n,o)))return p.push(e);var a}))){h=!1;break}}else if(f!==d&&!i(f,d,r,n,o)){h=!1;break}}return o.delete(t),o.delete(e),h}function ht(t){return function(t,e,r){var n=e(t);return xt(t)?n:function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}(n,r(t))}(t,Pt,dt)}function pt(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function ft(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!It(t)||function(t){return!!L&&L in t}(t))&&(wt(t)?k:a).test(mt(t))}(r)?r:void 0}et.prototype.clear=function(){this.__data__=Y?Y(null):{},this.size=0},et.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},et.prototype.get=function(t){var e=this.__data__;if(Y){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return T.call(e,t)?e[t]:void 0},et.prototype.has=function(t){var e=this.__data__;return Y?void 0!==e[t]:T.call(e,t)},et.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Y&&void 0===e?"__lodash_hash_undefined__":e,this},rt.prototype.clear=function(){this.__data__=[],this.size=0},rt.prototype.delete=function(t){var e=this.__data__,r=at(e,t);return!(r<0||(r==e.length-1?e.pop():z.call(e,r,1),--this.size,0))},rt.prototype.get=function(t){var e=this.__data__,r=at(e,t);return r<0?void 0:e[r][1]},rt.prototype.has=function(t){return at(this.__data__,t)>-1},rt.prototype.set=function(t,e){var r=this.__data__,n=at(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},nt.prototype.clear=function(){this.size=0,this.__data__={hash:new et,map:new(q||rt),string:new et}},nt.prototype.delete=function(t){var e=pt(this,t).delete(t);return this.size-=e?1:0,e},nt.prototype.get=function(t){return pt(this,t).get(t)},nt.prototype.has=function(t){return pt(this,t).has(t)},nt.prototype.set=function(t,e){var r=pt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},it.prototype.add=it.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},it.prototype.has=function(t){return this.__data__.has(t)},ot.prototype.clear=function(){this.__data__=new rt,this.size=0},ot.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},ot.prototype.get=function(t){return this.__data__.get(t)},ot.prototype.has=function(t){return this.__data__.has(t)},ot.prototype.set=function(t,e){var r=this.__data__;if(r instanceof rt){var n=r.__data__;if(!q||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new nt(n)}return r.set(t,e),this.size=r.size,this};var dt=B?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r<n;){var a=t[r];e(a)&&(o[i++]=a)}return o}(B(t),(function(e){return O.call(t,e)})))}:function(){return[]},gt=st;function yt(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||s.test(t))&&t>-1&&t%1==0&&t<e}function mt(t){if(null!=t){try{return M.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function vt(t,e){return t===e||t!=t&&e!=e}(V&&"[object DataView]"!=gt(new V(new ArrayBuffer(1)))||q&&gt(new q)!=n||G&&"[object Promise]"!=gt(G.resolve())||X&&gt(new X)!=o||Z&&"[object WeakMap]"!=gt(new Z))&&(gt=function(t){var e=st(t),r=e==i?t.constructor:void 0,a=r?mt(r):"";if(a)switch(a){case W:return"[object DataView]";case H:return n;case J:return"[object Promise]";case K:return o;case $:return"[object WeakMap]"}return e});var _t=ut(function(){return arguments}())?ut:function(t){return St(t)&&T.call(t,"callee")&&!O.call(t,"callee")},xt=Array.isArray,bt=U||function(){return!1};function wt(t){if(!It(t))return!1;var e=st(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Et(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function It(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function St(t){return null!=t&&"object"==typeof t}var Ct=m?function(t){return function(e){return t(e)}}(m):function(t){return St(t)&&Et(t.length)&&!!u[st(t)]};function Pt(t){return null!=(e=t)&&Et(e.length)&&!wt(e)?function(t,e){var r=xt(t),n=!r&&_t(t),i=!r&&!n&&bt(t),o=!r&&!n&&!i&&Ct(t),a=r||n||i||o,s=a?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],u=s.length;for(var l in t)!e&&!T.call(t,l)||a&&("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||yt(l,u))||s.push(l);return s}(t):function(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||C))return j(t);var e,r,n=[];for(var i in Object(t))T.call(t,i)&&"constructor"!=i&&n.push(i);return n}(t);var e}t.exports=function(t,e){return lt(t,e)}})),Ht={Polygon:Y,LineString:Z,Point:X,MultiPolygon:J,MultiLineString:J,MultiPoint:J};var Jt=function(t,e){var r={options:t=function(t){void 0===t&&(t={});var e=it(t);return t.controls||(e.controls={}),!1===t.displayControlsDefault?e.controls=it(Zt,t.controls):e.controls=it(Xt,t.controls),(e=it(Gt,e)).styles=Yt(e.styles,"cold").concat(Yt(e.styles,"hot")),e}(t)};e=function(t,e){return e.modes=x,e.getFeatureIdsAt=function(e){return O.click({point:e},null,t).map((function(t){return t.properties.id}))},e.getSelectedIds=function(){return t.store.getSelectedIds()},e.getSelected=function(){return{type:v,features:t.store.getSelectedIds().map((function(e){return t.store.get(e)})).map((function(t){return t.toGeoJSON()}))}},e.getSelectedPoints=function(){return{type:v,features:t.store.getSelectedCoordinates().map((function(t){return{type:d,properties:{},geometry:{type:m,coordinates:t.coordinates}}}))}},e.set=function(r){if(void 0===r.type||r.type!==v||!Array.isArray(r.features))throw new Error("Invalid FeatureCollection");var n=t.store.createRenderBatch(),i=t.store.getAllIds().slice(),o=e.add(r),a=new D(o);return(i=i.filter((function(t){return!a.has(t)}))).length&&e.delete(i),n(),o},e.add=function(e){var r=JSON.parse(JSON.stringify(Et(e))).features.map((function(e){if(e.id=e.id||q(),null===e.geometry)throw new Error("Invalid geometry: null");if(void 0===t.store.get(e.id)||t.store.get(e.id).type!==e.geometry.type){var r=Ht[e.geometry.type];if(void 0===r)throw new Error("Invalid geometry type: "+e.geometry.type+".");var n=new r(t,e);t.store.add(n)}else{var i=t.store.get(e.id);i.properties=e.properties,Wt(i.getCoordinates(),e.geometry.coordinates)||i.incomingCoords(e.geometry.coordinates)}return e.id}));return t.store.render(),r},e.get=function(e){var r=t.store.get(e);if(r)return r.toGeoJSON()},e.getAll=function(){return{type:v,features:t.store.getAll().map((function(t){return t.toGeoJSON()}))}},e.delete=function(r){return t.store.delete(r,{silent:!0}),e.getMode()!==x.DIRECT_SELECT||t.store.getSelectedIds().length?t.store.render():t.events.changeMode(x.SIMPLE_SELECT,void 0,{silent:!0}),e},e.deleteAll=function(){return t.store.delete(t.store.getAllIds(),{silent:!0}),e.getMode()===x.DIRECT_SELECT?t.events.changeMode(x.SIMPLE_SELECT,void 0,{silent:!0}):t.store.render(),e},e.changeMode=function(r,n){return void 0===n&&(n={}),r===x.SIMPLE_SELECT&&e.getMode()===x.SIMPLE_SELECT?(i=n.featureIds||[],o=t.store.getSelectedIds(),i.length===o.length&&JSON.stringify(i.map((function(t){return t})).sort())===JSON.stringify(o.map((function(t){return t})).sort())||(t.store.setSelected(n.featureIds,{silent:!0}),t.store.render()),e):(r===x.DIRECT_SELECT&&e.getMode()===x.DIRECT_SELECT&&n.featureId===t.store.getSelectedIds()[0]||t.events.changeMode(r,n,{silent:!0}),e);var i,o},e.getMode=function(){return t.events.getMode()},e.trash=function(){return t.events.trash({silent:!0}),e},e.combineFeatures=function(){return t.events.combineFeatures({silent:!0}),e},e.uncombineFeatures=function(){return t.events.uncombineFeatures({silent:!0}),e},e.setFeatureProperty=function(r,n,i){return t.store.setFeatureProperty(r,n,i),e},e}(r,e),r.api=e;var n=st(r);return e.onAdd=n.onAdd,e.onRemove=n.onRemove,e.types=f,e.options=t,e};function Kt(t){Jt(t,this)}return Kt.modes=qt,Kt}));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("leaflet")):"function"==typeof define&&define.amd?define(["exports","leaflet"],e):e((t=t||self).GeoSearch={},t.L)}(this,(function(t,e){function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t,e,r){return(o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&i(o,r.prototype),o}).apply(null,arguments)}function a(t,e,r,n){void 0===e&&(e=""),void 0===n&&(n={});var i=document.createElement(t);return e&&(i.className=e),Object.keys(n).forEach((function(t){if("function"==typeof n[t]){var e=0===t.indexOf("on")?t.substr(2).toLowerCase():t;i.addEventListener(e,n[t])}else"html"===t?i.innerHTML=n[t]:"text"===t?i.innerText=n[t]:i.setAttribute(t,n[t])})),r&&r.appendChild(i),i}function s(t){t.preventDefault(),t.stopPropagation()}e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;var u=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.filter(Boolean).join(" ").trim()};function l(t,e){t&&t.classList&&(Array.isArray(e)?e:[e]).forEach((function(e){t.classList.contains(e)||t.classList.add(e)}))}function c(t,e){t&&t.classList&&(Array.isArray(e)?e:[e]).forEach((function(e){t.classList.contains(e)&&t.classList.remove(e)}))}var h,p=13,f=40,d=38,g=[p,27,f,d,37,39],y=function(){function t(t){var e=this,r=t.handleSubmit,n=t.searchLabel,i=t.classNames,o=void 0===i?{}:i;this.hasError=!1,this.container=a("div",u("geosearch",o.container)),this.form=a("form",["",o.form].join(" "),this.container,{autocomplete:"none",onClick:s,onDblClick:s,touchStart:s,touchEnd:s}),this.input=a("input",["glass",o.input].join(" "),this.form,{type:"text",placeholder:n||"search",onInput:this.onInput,onKeyUp:function(t){return e.onKeyUp(t)},onKeyPress:function(t){return e.onKeyPress(t)},onFocus:this.onFocus,onBlur:this.onBlur,onClick:function(){e.input.focus(),e.input.dispatchEvent(new Event("focus"))}}),this.handleSubmit=r}var e=t.prototype;return e.onFocus=function(){l(this.form,"active")},e.onBlur=function(){c(this.form,"active")},e.onSubmit=function(t){try{var e=this;return s(t),c(r=e.container,"error"),l(r,"pending"),Promise.resolve(e.handleSubmit({query:e.input.value})).then((function(){c(e.container,"pending")}))}catch(t){return Promise.reject(t)}var r},e.onInput=function(){this.hasError&&(c(this.container,"error"),this.hasError=!1)},e.onKeyUp=function(t){27===t.keyCode&&(c(this.container,["pending","active"]),this.input.value="",document.body.focus(),document.body.blur())},e.onKeyPress=function(t){t.keyCode===p&&this.onSubmit(t)},e.setQuery=function(t){this.input.value=t},t}(),m=function(){function t(t){var e=this,r=t.handleClick,n=t.classNames,i=void 0===n?{}:n;this.selected=-1,this.results=[],this.onClick=function(t){if("function"==typeof e.handleClick){var r=t.target;if(r&&e.container.contains(r)&&r.hasAttribute("data-key")){var n=Number(r.getAttribute("data-key"));e.handleClick({result:e.results[n]})}}},this.handleClick=r,this.container=a("div",u("results",i.container)),this.container.addEventListener("click",this.onClick,!0),this.resultItem=a("div",u(i.item))}var e=t.prototype;return e.render=function(t){var e=this;void 0===t&&(t=[]),this.clear(),t.forEach((function(t,r){var n=e.resultItem.cloneNode(!0);n.setAttribute("data-key",""+r),n.innerHTML=t.label,e.container.appendChild(n)})),t.length>0&&(l(this.container.parentElement,"open"),l(this.container,"active")),this.results=t},e.select=function(t){return Array.from(this.container.children).forEach((function(e,r){return r===t?l(e,"active"):c(e,"active")})),this.selected=t,this.results[t]},e.count=function(){return this.results?this.results.length:0},e.clear=function(){for(this.selected=-1;this.container.lastChild;)this.container.removeChild(this.container.lastChild);c(this.container.parentElement,"open"),c(this.container,"active")},t}(),v={position:"topleft",style:"button",showMarker:!0,showPopup:!1,popupFormat:function(t){return""+t.result.label},marker:{icon:e&&e.Icon?new e.Icon.Default:void 0,draggable:!1},maxMarkers:1,maxSuggestions:5,retainZoomLevel:!1,animateZoom:!0,searchLabel:"Enter address",notFoundMessage:"Sorry, that address could not be found.",messageHideDelay:3e3,zoomLevel:18,classNames:{container:"leaflet-bar leaflet-control leaflet-control-geosearch",button:"leaflet-bar-part leaflet-bar-part-single",resetButton:"reset",msgbox:"leaflet-bar message",form:"",input:""},autoComplete:!0,autoCompleteDelay:250,autoClose:!1,keepResult:!1},_={},x=["dragging","touchZoom","doubleClickZoom","scrollWheelZoom","boxZoom","keyboard"],b="Leaflet must be loaded before instantiating the GeoSearch control",w={options:r({},v),classNames:r({},v.classNames),initialize:function(t){var n,i,o,u,l=this;if(!e)throw new Error(b);if(!t.provider)throw new Error("Provider is missing from options");this.options=r({},this.options,{},t),this.classNames=r({},this.classNames,{},t.classNames),this.markers=new e.FeatureGroup,this.classNames.container+=" leaflet-geosearch-"+this.options.style,this.searchElement=new y({searchLabel:this.options.searchLabel,classNames:{container:this.classNames.container,form:this.classNames.form,input:this.classNames.input},handleSubmit:function(t){return l.onSubmit(t)}}),this.button=a("a",this.classNames.button,this.searchElement.container,{title:this.options.searchLabel,href:"#",onClick:function(t){return l.onClick(t)},onDblClick:function(t){return s(t)}}),this.resetButton=a("a",this.classNames.resetButton,this.searchElement.form,{text:"×",href:"#",onClick:function(){return l.clearResults(null,!0)}}),this.options.autoComplete&&(this.resultList=new m({handleClick:function(t){var e=t.result;l.searchElement.input.value=e.label,l.onSubmit({query:e.label,data:e})}}),this.searchElement.form.appendChild(this.resultList.container),this.searchElement.input.addEventListener("keyup",(n=function(t){return l.autoSearch(t)},void 0===(i=this.options.autoCompleteDelay)&&(i=250),void 0===o&&(o=!1),function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];u&&clearTimeout(u),u=setTimeout((function(){u=null,o||n.apply(void 0,e)}),i),o&&!u&&n.apply(void 0,e)}),!0),this.searchElement.input.addEventListener("keydown",(function(t){return l.selectResult(t)}),!0),this.searchElement.input.addEventListener("keydown",(function(t){return l.clearResults(t,!0)}),!0)),this.searchElement.form.addEventListener("mouseenter",(function(t){l.disableHandlers(t)}),!0),this.searchElement.form.addEventListener("mouseleave",(function(){return l.restoreHandlers()}),!0),this.searchElement.form.addEventListener("click",(function(t){t.preventDefault()}),!1)},onAdd:function(t){var e=this.options,r=e.showMarker,n=e.style;if(this.map=t,r&&this.markers.addTo(t),"bar"===n){var i=t.getContainer().querySelector(".leaflet-control-container");this.container=a("div","leaflet-control-geosearch leaflet-geosearch-bar"),this.container.appendChild(this.searchElement.form),i.appendChild(this.container)}return this.searchElement.container},onRemove:function(){var t;return null==(t=this.container)||t.remove(),this},onClick:function(t){t.preventDefault(),t.stopPropagation();var e=this.searchElement,r=e.container,n=e.input;r.classList.contains("active")?(c(r,"active"),this.clearResults()):(l(r,"active"),n.focus())},disableHandlers:function(t){var e=this;this.searchElement.form.contains(t.target)&&x.forEach((function(t){var r,n;_[t]=null==(r=e.map[t])?void 0:r.enabled(),null==(n=e.map[t])||n.disable()}))},restoreHandlers:function(t){var e=this;t&&!this.searchElement.form.includes(t.target)||x.forEach((function(t){var r;_[t]&&(null==(r=e.map[t])||r.enable())}))},selectResult:function(t){if(-1!==[p,f,d].indexOf(t.keyCode))if(t.preventDefault(),t.keyCode!==p){var e=this.resultList.count()-1;if(!(e<0)){var r=this.resultList.selected,n=t.keyCode===f?r+1:r-1,i=this.resultList.select(n<0?e:n>e?0:n);this.searchElement.input.value=i.label}}else{var o=this.resultList.select(this.resultList.selected);this.onSubmit({query:this.searchElement.input.value,data:o})}},clearResults:function(t,e){if(void 0===e&&(e=!1),!t||27===t.keyCode){var r=this.options,n=r.autoComplete;!e&&r.keepResult||(this.searchElement.input.value="",this.markers.clearLayers()),n&&this.resultList.clear()}},autoSearch:function(t){try{var e=this;if(g.indexOf(t.keyCode)>-1)return Promise.resolve();var r=t.target.value,n=e.options.provider,i=function(){if(r.length)return Promise.resolve(n.search({query:r})).then((function(t){t=t.slice(0,e.options.maxSuggestions),e.resultList.render(t)}));e.resultList.clear()}();return Promise.resolve(i&&i.then?i.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},onSubmit:function(t){try{var e=this;return Promise.resolve(e.options.provider.search(t)).then((function(r){r&&r.length>0&&e.showResult(r[0],t)}))}catch(t){return Promise.reject(t)}},showResult:function(t,e){var r=this.options.autoClose,n=Object.keys(this.markers._layers);n.length>=this.options.maxMarkers&&this.markers.removeLayer(n[0]);var i=this.addMarker(t,e);this.centerMap(t),this.map.fireEvent("geosearch/showlocation",{location:t,marker:i}),r&&this.closeResults()},closeResults:function(){var t=this.searchElement.container;t.classList.contains("active")&&c(t,"active"),this.restoreHandlers(),this.clearResults()},addMarker:function(t,r){var n=this,i=this.options,o=i.marker,a=i.showPopup,s=i.popupFormat,u=new e.Marker([t.y,t.x],o),l=t.label;return"function"==typeof s&&(l=s({query:r,result:t})),u.bindPopup(l),this.markers.addLayer(u),a&&u.openPopup(),o.draggable&&u.on("dragend",(function(t){n.map.fireEvent("geosearch/marker/dragend",{location:u.getLatLng(),event:t})})),u},centerMap:function(t){var r=this.options,n=r.retainZoomLevel,i=r.animateZoom,o=t.bounds?new e.LatLngBounds(t.bounds):new e.LatLng(t.y,t.x).toBounds(10),a=o.isValid()?o:this.markers.getBounds();!n&&o.isValid()?this.map.fitBounds(a,{animate:i}):this.map.setView(a.getCenter(),this.getZoom(),{animate:i})},getZoom:function(){var t=this.options,e=t.zoomLevel;return t.retainZoomLevel?this.map.getZoom():e}};function E(){if(!e)throw new Error(b);for(var t=e.Control.extend(w),r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return o(t,n)}!function(t){t[t.SEARCH=0]="SEARCH",t[t.REVERSE=1]="REVERSE"}(h||(h={}));var I=function(){function t(t){void 0===t&&(t={}),this.options=t}var e=t.prototype;return e.getParamString=function(t){void 0===t&&(t={});var e=r({},this.options.params,{},t);return Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&")},e.getUrl=function(t,e){return t+"?"+this.getParamString(e)},e.search=function(t){try{var e=this,r=e.endpoint({query:t.query,type:h.SEARCH});return Promise.resolve(fetch(r)).then((function(t){return Promise.resolve(t.json()).then((function(t){return e.parse({data:t})}))}))}catch(t){return Promise.reject(t)}},t}(),S=function(t){function e(){return t.apply(this,arguments)||this}n(e,t);var i=e.prototype;return i.endpoint=function(){return"https://places-dsn.algolia.net/1/places/query"},i.findBestMatchLevelIndex=function(t){var e=t.find((function(t){return"full"===t.matchLevel}))||t.find((function(t){return"partial"===t.matchLevel}));return e?t.indexOf(e):0},i.getLabel=function(t){var e,r,n,i;return[null==(e=t.locale_names)?void 0:e.default[this.findBestMatchLevelIndex(t._highlightResult.locale_names.default)],null==(r=t.city)?void 0:r.default[this.findBestMatchLevelIndex(t._highlightResult.city.default)],t.administrative[this.findBestMatchLevelIndex(t._highlightResult.administrative)],null==(n=t.postcode)?void 0:n[this.findBestMatchLevelIndex(t._highlightResult.postcode)],null==(i=t.country)?void 0:i.default].filter(Boolean).join(", ")},i.parse=function(t){var e=this;return t.data.hits.map((function(t){return{x:t._geoloc.lng,y:t._geoloc.lat,label:e.getLabel(t),bounds:null,raw:t}}))},i.search=function(t){var e=t.query;try{var n=this,i="string"==typeof e?{query:e}:e;return Promise.resolve(fetch(n.endpoint(),{method:"POST",body:JSON.stringify(r({},n.options.params,{},i))})).then((function(t){return Promise.resolve(t.json()).then((function(t){return n.parse({data:t})}))}))}catch(t){return Promise.reject(t)}},e}(I),C=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).searchUrl="https://dev.virtualearth.net/REST/v1/Locations",e}n(e,t);var r=e.prototype;return r.endpoint=function(t){var e=t.query,r="string"==typeof e?{q:e}:e;return r.jsonp=t.jsonp,this.getUrl(this.searchUrl,r)},r.parse=function(t){return 0===t.data.resourceSets.length?[]:t.data.resourceSets[0].resources.map((function(t){return{x:t.point.coordinates[1],y:t.point.coordinates[0],label:t.address.formattedAddress,bounds:[[t.bbox[0],t.bbox[1]],[t.bbox[2],t.bbox[3]]],raw:t}}))},r.search=function(t){var e,r,n,i=t.query;try{var o=this,s="BING_JSONP_CB_"+Date.now();return Promise.resolve((e=o.endpoint({query:i,jsonp:s}),r=s,n=a("script",null,document.body),n.setAttribute("type","text/javascript"),new Promise((function(t){window[r]=function(e){n.remove(),delete window[r],t(e)},n.setAttribute("src",e)})))).then((function(t){return o.parse({data:t})}))}catch(t){return Promise.reject(t)}},e}(I),P=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).searchUrl="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find",e}n(e,t);var r=e.prototype;return r.endpoint=function(t){var e=t.query,r="string"==typeof e?{text:e}:e;return r.f="json",this.getUrl(this.searchUrl,r)},r.parse=function(t){return t.data.locations.map((function(t){return{x:t.feature.geometry.x,y:t.feature.geometry.y,label:t.name,bounds:[[t.extent.ymin,t.extent.xmin],[t.extent.ymax,t.extent.xmax]],raw:t}}))},e}(I),M=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).searchUrl="https://maps.googleapis.com/maps/api/geocode/json",e}n(e,t);var r=e.prototype;return r.endpoint=function(t){var e=t.query;return this.getUrl(this.searchUrl,"string"==typeof e?{address:e}:e)},r.parse=function(t){return t.data.results.map((function(t){return{x:t.geometry.location.lng,y:t.geometry.location.lat,label:t.formatted_address,bounds:[[t.geometry.viewport.southwest.lat,t.geometry.viewport.southwest.lng],[t.geometry.viewport.northeast.lat,t.geometry.viewport.northeast.lng]],raw:t}}))},e}(I),T=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).searchUrl="https://geocode.search.hereapi.com/v1/geocode",e}n(e,t);var r=e.prototype;return r.endpoint=function(t){var e=t.query;return this.getUrl(this.searchUrl,"string"==typeof e?{q:e}:e)},r.parse=function(t){return t.data.items.map((function(t){return{x:t.position.lng,y:t.position.lat,label:t.address.label,bounds:null,raw:t}}))},e}(I),L=function(t){function e(e){var r;void 0===e&&(e={});var n="https://nominatim.openstreetmap.org";return(r=t.call(this,e)||this).searchUrl=e.searchUrl||n+"/search",r.reverseUrl=e.reverseUrl||n+"/reverse",r}n(e,t);var r=e.prototype;return r.endpoint=function(t){var e=t.query,r=t.type,n="string"==typeof e?{q:e}:e;return(n.format="json",r)===h.REVERSE?this.getUrl(this.reverseUrl,n):this.getUrl(this.searchUrl,n)},r.parse=function(t){return(Array.isArray(t.data)?t.data:[t.data]).map((function(t){return{x:Number(t.lon),y:Number(t.lat),label:t.display_name,bounds:[[parseFloat(t.boundingbox[0]),parseFloat(t.boundingbox[2])],[parseFloat(t.boundingbox[1]),parseFloat(t.boundingbox[3])]],raw:t}}))},e}(I),A=function(t){function e(e){return t.call(this,r({},e,{searchUrl:"https://locationiq.org/v1/search.php",reverseUrl:"https://locationiq.org/v1/reverse.php"}))||this}return n(e,t),e}(L),k=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).searchUrl="https://api.opencagedata.com/geocode/v1/json",e}n(e,t);var r=e.prototype;return r.endpoint=function(t){var e=t.query,r="string"==typeof e?{q:e}:e;return r.format="json",this.getUrl(this.searchUrl,r)},r.parse=function(t){return t.data.results.map((function(t){return{x:t.geometry.lng,y:t.geometry.lat,label:t.formatted,bounds:[[t.bounds.southwest.lat,t.bounds.southwest.lng],[t.bounds.northeast.lat,t.bounds.northeast.lng]],raw:t}}))},r.search=function(e){try{return Promise.resolve(e.query.length<2?[]:t.prototype.search.call(this,e))}catch(t){return Promise.reject(t)}},e}(I);t.AlgoliaProvider=S,t.BingProvider=C,t.EsriProvider=P,t.GeoSearchControl=E,t.GoogleProvider=M,t.HereProvider=T,t.JsonProvider=I,t.LocationIQProvider=A,t.OpenCageProvider=k,t.OpenStreetMapProvider=L,t.SearchControl=E,t.SearchElement=y}));!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).geojsonhint=t()}}((function(){return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[a]={exports:{}};e[a][0].call(c.exports,(function(t){return i(e[a][1][t]||t)}),c,c.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,r){var n=t("./rhr");e.exports.hint=function(t,e){var r=[],i=0,o=10,a=6;function s(t){e&&!1===e.noDuplicateMembers||!t.__duplicateProperties__||r.push({message:"An object contained duplicate members, making parsing ambigous: "+t.__duplicateProperties__.join(", "),line:t.__line__});if(!l(t,"type","string"))if(g[t.type])t&&g[t.type](t);else{var n=y[t.type.toLowerCase()];void 0!==n?r.push({message:"Expected "+n+" but got "+t.type+" (case sensitive)",line:t.__line__}):r.push({message:"The type "+t.type+" is unknown",line:t.__line__})}}function u(t,e){return t.every((function(t){return null!==t&&typeof t===e}))}function l(t,e,n){if(void 0===t[e])return r.push({message:'"'+e+'" member required',line:t.__line__});if("array"===n){if(!Array.isArray(t[e]))return r.push({message:'"'+e+'" member should be an array, but is an '+typeof t[e]+" instead",line:t.__line__})}else{if("object"===n&&t[e]&&t[e].constructor!==Object)return r.push({message:'"'+e+'" member should be '+n+", but is an "+t[e].constructor.name+" instead",line:t.__line__});if(n&&typeof t[e]!==n)return r.push({message:'"'+e+'" member should be '+n+", but is an "+typeof t[e]+" instead",line:t.__line__})}}function c(t,n){if(!Array.isArray(t))return r.push({message:"position should be an array, is a "+typeof t+" instead",line:t.__line__||n});if(t.length<2)return r.push({message:"position must have 2 or more elements",line:t.__line__||n});if(t.length>3)return r.push({message:"position should not have more than 3 elements",level:"message",line:t.__line__||n});if(!u(t,"number"))return r.push({message:"each element in a position must be a number",line:t.__line__||n});if(e&&e.precisionWarning){if(i===o){i+=1;return r.push({message:"truncated warnings: we've encountered coordinate precision warning "+o+" times, no more warnings will be reported",level:"message",line:t.__line__||n})}i<o&&t.forEach((function(e){var o=0,s=String(e).split(".")[1];void 0!==s&&(o=s.length);if(o>a){i+=1;return r.push({message:"precision of coordinates should be reduced",level:"message",line:t.__line__||n})}}))}}function h(t,e,n,i){void 0===i&&void 0!==t.__line__&&(i=t.__line__);if(0===n)return c(t,i);if(1===n&&e)if("LinearRing"===e){if(!Array.isArray(t[t.length-1])){r.push({message:"a number was found where a coordinate array should have been found: this needs to be nested more deeply",line:i});return!0}t.length<4&&r.push({message:"a LinearRing of coordinates needs to have four or more positions",line:i});if(t.length&&(t[t.length-1].length!==t[0].length||!t[t.length-1].every((function(e,r){return t[0][r]===e})))){r.push({message:"the first and last positions in a LinearRing of coordinates must be the same",line:i});return!0}}else if("Line"===e&&t.length<2)return r.push({message:"a line needs to have two or more coordinates to be valid",line:i});if(Array.isArray(t)){return t.map((function(t){return h(t,e,n-1,t.__line__||i)})).some((function(t){return t}))}r.push({message:"a number was found where a coordinate array should have been found: this needs to be nested more deeply",line:i})}function p(t){if(t.crs){"object"==typeof t.crs&&t.crs.properties&&"urn:ogc:def:crs:OGC:1.3:CRS84"===t.crs.properties.name?r.push({message:"old-style crs member is not recommended, this object is equivalent to the default and should be removed",line:t.__line__}):r.push({message:"old-style crs member is not recommended",line:t.__line__})}}function f(t){if(t.bbox){if(Array.isArray(t.bbox)){u(t.bbox,"number")||r.push({message:"each element in a bbox member must be a number",line:t.bbox.__line__});4!==t.bbox.length&&6!==t.bbox.length&&r.push({message:"bbox must contain 4 elements (for 2D) or 6 elements (for 3D)",line:t.bbox.__line__});return r.length}r.push({message:"bbox member must be an array of numbers, but is a "+typeof t.bbox,line:t.__line__})}}function d(t){p(t);f(t);void 0!==t.id&&"string"!=typeof t.id&&"number"!=typeof t.id&&r.push({message:'Feature "id" member must have a string or number value',line:t.__line__});void 0!==t.features&&r.push({message:'Feature object cannot contain a "features" member',line:t.__line__});void 0!==t.coordinates&&r.push({message:'Feature object cannot contain a "coordinates" member',line:t.__line__});"Feature"!==t.type&&r.push({message:"GeoJSON features must have a type=feature member",line:t.__line__});l(t,"properties","object");l(t,"geometry","object")||t.geometry&&s(t.geometry)}var g={Point:function(t){p(t);f(t);!function(t){void 0!==t.properties&&r.push({message:'geometry object cannot contain a "properties" member',line:t.__line__});void 0!==t.geometry&&r.push({message:'geometry object cannot contain a "geometry" member',line:t.__line__});void 0!==t.features&&r.push({message:'geometry object cannot contain a "features" member',line:t.__line__})}(t);l(t,"coordinates","array")||c(t.coordinates)},Feature:d,MultiPoint:function(t){p(t);f(t);l(t,"coordinates","array")||h(t.coordinates,"",1)},LineString:function(t){p(t);f(t);l(t,"coordinates","array")||h(t.coordinates,"Line",1)},MultiLineString:function(t){p(t);f(t);l(t,"coordinates","array")||h(t.coordinates,"Line",2)},FeatureCollection:function(t){p(t);f(t);void 0!==t.properties&&r.push({message:'FeatureCollection object cannot contain a "properties" member',line:t.__line__});void 0!==t.coordinates&&r.push({message:'FeatureCollection object cannot contain a "coordinates" member',line:t.__line__});if(!l(t,"features","array")){if(!u(t.features,"object"))return r.push({message:"Every feature must be an object",line:t.__line__});t.features.forEach(d)}},GeometryCollection:function(t){p(t);f(t);if(!l(t,"geometries","array")){u(t.geometries,"object")||r.push({message:"The geometries array in a GeometryCollection must contain only geometry objects",line:t.__line__});1===t.geometries.length&&r.push({message:"GeometryCollection with a single geometry should be avoided in favor of single part or a single object of multi-part type",line:t.geometries.__line__});t.geometries.forEach((function(e){if(e){"GeometryCollection"===e.type&&r.push({message:"GeometryCollection should avoid nested geometry collections",line:t.geometries.__line__});s(e)}}))}},Polygon:function(t){p(t);f(t);l(t,"coordinates","array")||h(t.coordinates,"LinearRing",2)||n(t,r)},MultiPolygon:function(t){p(t);f(t);l(t,"coordinates","array")||h(t.coordinates,"LinearRing",3)||n(t,r)}},y=Object.keys(g).reduce((function(t,e){t[e.toLowerCase()]=e;return t}),{});if("object"!=typeof t||null==t){r.push({message:"The root of a GeoJSON object must be an object.",line:0});return r}s(t);r.forEach((function(t){({}).hasOwnProperty.call(t,"line")&&void 0===t.line&&delete t.line}));return r}},{"./rhr":2}],2:[function(t,e,r){function n(t){var e=0;if(t.length>2)for(var r,n,i=0;i<t.length-1;i++){r=t[i];e+=((n=t[i+1])[0]-r[0])*(n[1]+r[1])}return e>=0}function i(t){if(t&&t.length>0){if(n(t[0]))return!1;if(!t.slice(1,t.length).every(n))return!1}return!0}e.exports=function(t,e){(function(t){return"Polygon"===t.type?i(t.coordinates):"MultiPolygon"===t.type?t.coordinates.every(i):void 0})(t)||e.push({message:"Polygons and MultiPolygons should follow the right-hand rule",level:"message",line:t.__line__})}},{}],3:[function(t,e,r){},{}],4:[function(t,e,r){(function(n){(function(){var i=function(){var t=function(t,e,r,n){for(r=r||{},n=t.length;n--;r[t[n]]=e);return r},e=[1,12],r=[1,13],n=[1,9],i=[1,10],o=[1,11],a=[1,14],s=[1,15],u=[14,18,22,24],l=[18,22],c=[22,24],h={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(t,e,r,n,i,o,a){var s=o.length-1;switch(i){case 1:this.$=t.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(t);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=o[s-1];case 13:this.$={};Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 14:case 19:this.$=o[s-1];Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 15:this.$=[o[s-2],o[s]];break;case 16:this.$={};this.$[o[s][0]]=o[s][1];break;case 17:this.$=o[s-2];if(void 0!==o[s-2][o[s][0]]){this.$.__duplicateProperties__||Object.defineProperty(this.$,"__duplicateProperties__",{value:[],enumerable:!1});this.$.__duplicateProperties__.push(o[s][0])}o[s-2][o[s][0]]=o[s][1];break;case 18:this.$=[];Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 20:this.$=[o[s]];break;case 21:this.$=o[s-2];o[s-2].push(o[s])}},table:[{3:5,4:e,5:6,6:r,7:3,8:n,9:4,10:i,11:o,12:1,13:2,15:7,16:8,17:a,23:s},{1:[3]},{14:[1,16]},t(u,[2,7]),t(u,[2,8]),t(u,[2,9]),t(u,[2,10]),t(u,[2,11]),t(u,[2,12]),t(u,[2,3]),t(u,[2,4]),t(u,[2,5]),t([14,18,21,22,24],[2,1]),t(u,[2,2]),{3:20,4:e,18:[1,17],19:18,20:19},{3:5,4:e,5:6,6:r,7:3,8:n,9:4,10:i,11:o,13:23,15:7,16:8,17:a,23:s,24:[1,21],25:22},{1:[2,6]},t(u,[2,13]),{18:[1,24],22:[1,25]},t(l,[2,16]),{21:[1,26]},t(u,[2,18]),{22:[1,28],24:[1,27]},t(c,[2,20]),t(u,[2,14]),{3:20,4:e,20:29},{3:5,4:e,5:6,6:r,7:3,8:n,9:4,10:i,11:o,13:30,15:7,16:8,17:a,23:s},t(u,[2,19]),{3:5,4:e,5:6,6:r,7:3,8:n,9:4,10:i,11:o,13:31,15:7,16:8,17:a,23:s},t(l,[2,17]),t(l,[2,15]),t(c,[2,21])],defaultActions:{16:[2,6]},parseError:function(t,e){if(!e.recoverable){function r(t,e){this.message=t;this.hash=e}r.prototype=Error;throw new r(t,e)}this.trace(t)},parse:function(t){var e=this,r=[0],n=[null],i=[],o=this.table,a="",s=0,u=0,l=0,c=i.slice.call(arguments,1),h=Object.create(this.lexer),p={yy:{}};for(var f in this.yy)Object.prototype.hasOwnProperty.call(this.yy,f)&&(p.yy[f]=this.yy[f]);h.setInput(t,p.yy);p.yy.lexer=h;p.yy.parser=this;void 0===h.yylloc&&(h.yylloc={});var d=h.yylloc;i.push(d);var g=h.options&&h.options.ranges;"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var y,m,v,_,x,b,w,E,I,S=function(){var t;"number"!=typeof(t=h.lex()||1)&&(t=e.symbols_[t]||t);return t},C={};;){v=r[r.length-1];if(this.defaultActions[v])_=this.defaultActions[v];else{null==y&&(y=S());_=o[v]&&o[v][y]}if(void 0===_||!_.length||!_[0]){var P="";I=[];for(b in o[v])this.terminals_[b]&&b>2&&I.push("'"+this.terminals_[b]+"'");P=h.showPosition?"Parse error on line "+(s+1)+":\n"+h.showPosition()+"\nExpecting "+I.join(", ")+", got '"+(this.terminals_[y]||y)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==y?"end of input":"'"+(this.terminals_[y]||y)+"'");this.parseError(P,{text:h.match,token:this.terminals_[y]||y,line:h.yylineno,loc:d,expected:I})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+y);switch(_[0]){case 1:r.push(y);n.push(h.yytext);i.push(h.yylloc);r.push(_[1]);y=null;if(m){y=m;m=null}else{u=h.yyleng;a=h.yytext;s=h.yylineno;d=h.yylloc;l>0&&l--}break;case 2:w=this.productions_[_[1]][1];C.$=n[n.length-w];C._$={first_line:i[i.length-(w||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(w||1)].first_column,last_column:i[i.length-1].last_column};g&&(C._$.range=[i[i.length-(w||1)].range[0],i[i.length-1].range[1]]);if(void 0!==(x=this.performAction.apply(C,[a,u,s,p.yy,_[1],n,i].concat(c))))return x;if(w){r=r.slice(0,-1*w*2);n=n.slice(0,-1*w);i=i.slice(0,-1*w)}r.push(this.productions_[_[1]][0]);n.push(C.$);i.push(C._$);E=o[r[r.length-2]][r[r.length-1]];r.push(E);break;case 3:return!0}}return!0}},p={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){this.yy=e||this.yy||{};this._input=t;this._more=this._backtrack=this.done=!1;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};this.options.ranges&&(this.yylloc.range=[0,0]);this.offset=0;return this},input:function(){var t=this._input[0];this.yytext+=t;this.yyleng++;this.offset++;this.match+=t;this.matched+=t;if(t.match(/(?:\r\n?|\n).*/g)){this.yylineno++;this.yylloc.last_line++}else this.yylloc.last_column++;this.options.ranges&&this.yylloc.range[1]++;this._input=this._input.slice(1);return t},unput:function(t){var e=t.length,r=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-e);this.offset-=e;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);r.length-1&&(this.yylineno-=r.length-1);var i=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===n.length?this.yylloc.first_column:0)+n[n.length-r.length].length-r[0].length:this.yylloc.first_column-e};this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]);this.yyleng=this.yytext.length;return this},more:function(){this._more=!0;return this},reject:function(){if(!this.options.backtrack_lexer)return this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno});this._backtrack=!0;return this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;t.length<20&&(t+=this._input.substr(0,20-t.length));return(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var r,n,i;if(this.options.backtrack_lexer){i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done};this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))}(n=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length);this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length};this.yytext+=t[0];this.match+=t[0];this.matches=t;this.yyleng=this.yytext.length;this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]);this._more=!1;this._backtrack=!1;this._input=this._input.slice(t[0].length);this.matched+=t[0];r=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]);this.done&&this._input&&(this.done=!1);if(r)return r;if(this._backtrack){for(var o in i)this[o]=i[o];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,r,n;if(!this._more){this.yytext="";this.match=""}for(var i=this._currentRules(),o=0;o<i.length;o++)if((r=this._input.match(this.rules[i[o]]))&&(!e||r[0].length>e[0].length)){e=r;n=o;if(this.options.backtrack_lexer){if(!1!==(t=this.test_match(r,i[o])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[n]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,r,n){switch(r){case 0:break;case 1:return 6;case 2:e.yytext=e.yytext.substr(1,e.yyleng-2);return 4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt\/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}}};h.lexer=p;function f(){this.yy={}}f.prototype=h;h.Parser=f;return new f}();if(void 0!==t&&void 0!==r){r.parser=i;r.Parser=i.Parser;r.parse=function(){return i.parse.apply(i,arguments)};r.main=function(e){if(!e[1]){console.log("Usage: "+e[0]+" FILE");n.exit(1)}var i=t("fs").readFileSync(t("path").normalize(e[1]),"utf8");return r.parser.parse(i)};void 0!==e&&t.main===e&&r.main(n.argv.slice(1))}}).call(this)}).call(this,t("_process"))},{_process:6,fs:3,path:5}],5:[function(t,e,r){(function(t){(function(){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];if("."===i)t.splice(n,1);else if(".."===i){t.splice(n,1);r++}else if(r){t.splice(n,1);r--}}if(e)for(;r--;r)t.unshift("..");return t}r.resolve=function(){for(var r="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");if(a){r=a+"/"+r;i="/"===a.charAt(0)}}return(i?"/":"")+(r=e(n(r.split("/"),(function(t){return!!t})),!i).join("/"))||"."};r.normalize=function(t){var o=r.isAbsolute(t),a="/"===i(t,-1);(t=e(n(t.split("/"),(function(t){return!!t})),!o).join("/"))||o||(t=".");t&&a&&(t+="/");return(o?"/":"")+t};r.isAbsolute=function(t){return"/"===t.charAt(0)};r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))};r.relative=function(t,e){t=r.resolve(t).substr(1);e=r.resolve(e).substr(1);function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}for(var i=n(t.split("/")),o=n(e.split("/")),a=Math.min(i.length,o.length),s=a,u=0;u<a;u++)if(i[u]!==o[u]){s=u;break}var l=[];for(u=s;u<i.length;u++)l.push("..");return(l=l.concat(o.slice(s))).join("/")};r.sep="/";r.delimiter=":";r.dirname=function(t){"string"!=typeof t&&(t+="");if(0===t.length)return".";for(var e=t.charCodeAt(0),r=47===e,n=-1,i=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":t.slice(0,n)};r.basename=function(t,e){var r=function(t){"string"!=typeof t&&(t+="");var e,r=0,n=-1,i=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!i){r=e+1;break}}else if(-1===n){i=!1;n=e+1}return-1===n?"":t.slice(r,n)}(t);e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length));return r};r.extname=function(t){"string"!=typeof t&&(t+="");for(var e=-1,r=0,n=-1,i=!0,o=0,a=t.length-1;a>=0;--a){var s=t.charCodeAt(a);if(47!==s){if(-1===n){i=!1;n=a+1}46===s?-1===e?e=a:1!==o&&(o=1):-1!==e&&(o=-1)}else if(!i){r=a+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===r+1?"":t.slice(e,n)};function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n<t.length;n++)e(t[n],n,t)&&r.push(t[n]);return r}var i="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){e<0&&(e=t.length+e);return t.substr(e,r)}}).call(this)}).call(this,t("_process"))},{_process:6}],6:[function(t,e,r){var n,i,o=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(t){n=a}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();function u(t){if(n===setTimeout)return setTimeout(t,0);if((n===a||!n)&&setTimeout){n=setTimeout;return setTimeout(t,0)}try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}var l,c=[],h=!1,p=-1;function f(){if(h&&l){h=!1;l.length?c=l.concat(c):p=-1;c.length&&d()}}function d(){if(!h){var t=u(f);h=!0;for(var e=c.length;e;){l=c;c=[];for(;++p<e;)l&&l[p].run();p=-1;e=c.length}l=null;h=!1;!function(t){if(i===clearTimeout)return clearTimeout(t);if((i===s||!i)&&clearTimeout){i=clearTimeout;return clearTimeout(t)}try{return i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new g(t,e));1!==c.length||h||u(d)};function g(t,e){this.fun=t;this.array=e}g.prototype.run=function(){this.fun.apply(null,this.array)};o.title="browser";o.browser=!0;o.env={};o.argv=[];o.version="";o.versions={};function y(){}o.on=y;o.addListener=y;o.once=y;o.off=y;o.removeListener=y;o.removeAllListeners=y;o.emit=y;o.prependListener=y;o.prependOnceListener=y;o.listeners=function(t){return[]};o.binding=function(t){throw new Error("process.binding is not supported")};o.cwd=function(){return"/"};o.chdir=function(t){throw new Error("process.chdir is not supported")};o.umask=function(){return 0}},{}],7:[function(t,e,r){var n=t("jsonlint-lines"),i=t("./object");e.exports.hint=function(t,e){var r,o=[];if("object"==typeof t)r=t;else{if("string"!=typeof t)return[{message:"Expected string or object as input",line:0}];try{r=n.parse(t)}catch(t){var a=t.message.match(/line (\d+)/);return[{line:parseInt(a[1],10)-1,message:t.message,error:t}]}}return o=o.concat(i.hint(r,e))}},{"./object":1,"jsonlint-lines":4}]},{},[7])(7)}));!function(t){var e=!1,r=!1,n=!1;function i(e){let r=function(){let t=[0,0]
;return t}(),n=function(){let t=2;
;return t}();if(t(".mapster-map-submission-frontend").length){r=t(".mapster-front-submission-options").data("center");n=t(".mapster-front-submission-options").data("zoom")}let i={container:e,style:{version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{"raster-tiles":{type:"raster",tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256,attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}},layers:[{id:"simple-tiles",type:"raster",source:"raster-tiles",minzoom:0,maxzoom:22}]},center:r,zoom:n}
let o=new maplibregl.Map(i);o.on("load",(()=>{o.resize();P();if(I().features.length>0){var t=turf.bbox(I());o.fitBounds(t,{padding:20,maxZoom:13,duration:0})}}));return o}function o(){if("location"===E()){"circle"===y()&&r.addLayer({id:"feature",type:"circle",source:"feature"});if("label"===y()||"marker"===y()){r.addLayer({id:"feature",type:"symbol",source:"feature"});"marker"===y()&&s()}}"line"===E()&&r.addLayer({id:"feature",type:"line",source:"feature"});"polygon"===E()&&"fill"===m()&&r.addLayer({id:"feature",type:"fill",source:"feature"});"polygon"===E()&&"fill-extrusion"===m()&&r.addLayer({id:"feature",type:"fill-extrusion",source:"feature"});c()}function a(){n&&n.remove()}function s(){if("location"===E()&&"marker"===y()){a();if(I().features.length>0){var t=v().marker,e=new maplibregl.Marker(t).setLngLat(I().features[0].geometry.coordinates);e.addTo(r);n=e}}}function u(){t('.acf-field[data-name="polygon_style"]').length&&t(document).on("change",'.acf-field[data-name="polygon_style"] :input',(function(){!function(){r.getLayer("feature")&&r.removeLayer("feature");o();h()}();c()}))}function l(){t('.acf-field[data-name="location_style"]').length&&t(document).on("change",'.acf-field[data-name="location_style"] :input',(function(){!function(){a();r.getLayer("feature")&&r.removeLayer("feature");o();h()}();c()}))}function c(){var t=v();if("location"===E()&&"marker"===y())s();else if("location"===E()&&"marker"!==y()&&"3d-model"!==y()||"line"===E()||"polygon"===E()){for(var e in t.paint)r.setPaintProperty("feature",`${_()}${e}`,t.paint[e]);for(var e in t.layout)r.setLayoutProperty("feature",`${_()}${e}`,t.layout[e])}else"location"===E()&&"3d-model"===y()&&x()}function h(){var e=v();for(var r in e)for(var n in e[r])t(document).on("change",`.acf-field[data-name="${n}"] :input`,(function(){c()}));if("line"===E()){["dashed_line","dash_length","gap_length"].forEach((e=>{t(document).on("change",`.acf-field[data-name="${e}"] :input`,(function(){c()}))}))}if("location"===E()&&"label"===y()){["label_on","icon_on","icon-image","icon-translate-x","icon-translate-y","text-translate-x","text-translate-y"].forEach((e=>{t(document).on("change",`.acf-field[data-name="${e}"] :input`,(function(){c()}))}))}
}function p(){let e=!1;t(document).on("click",".open-multigeom",(function(){t(".open-multigeom-a").trigger("click");if(!e){"line"===E()?t("#draw-single-line").show():"polygon"===E()&&t("#draw-single-polygon").show();!function(e){
}(i(b().attr("id")+"-multi"));e=!0}}))}function f(n){e=n;r=i(b().attr("id"));!function(){jQuery(document).on("click",".mapster-edit-full-width",(()=>{if("flex"===jQuery(".mapster-map-container").css("display")){jQuery(".mapster-map-container").css("display","block");jQuery(".mapster-map-container > div").css("width","100%");jQuery(".mapster-map-container > div").css("marginBottom","15px");jQuery(".mapster-edit-full-width").text("Collapse Map");r.resize()}else{jQuery(".mapster-map-container").css("display","flex");jQuery(".mapster-map-container > div").css("width","50%");jQuery(".mapster-map-container > div").css("marginBottom","0px");jQuery(".mapster-edit-full-width").text("Expand Map");r.resize()}}));let t=!1;jQuery(document).on("click",".mapster-simplify-shape",(()=>{if(jQuery(".mapster-simplify-shape-slider").length){jQuery(".mapster-simplify-shape").html("Simplify Shape");jQuery(".mapster-simplify-container").remove();d(t)}else{jQuery(".mapster-simplify-shape").html("Cancel Simplify Shape");jQuery(".mapster-map-container > div:first-child").append('\n\t\t\t\t\t<div class="mapster-simplify-container" style="margin-top: 30px; text-align: right;">\n\t\t\t\t\t\t<input class="mapster-simplify-shape-slider" type="range" min="1" max="100" value="1" />\n\t\t\t\t\t</div>\n\t\t\t\t');t=I()}}));jQuery(document).on("input",".mapster-simplify-shape-slider",(function(){let e=jQuery(this).val();d(turf.simplify(t,{tolerance:parseInt(e)/100}))}));jQuery(document).on("click",".mapster-download-geojson",(()=>{var t=document.createElement("a"),e=new Blob(["\ufeff",JSON.stringify(I())]),r=URL.createObjectURL(e);t.href=r;t.download="geojson-download.json";document.getElementById("acf-form-data").appendChild(t);t.click();document.getElementById("acf-form-data").removeChild(t)}));jQuery(document).on("click",".mapster-image-base",(()=>{
}))}();!function(){var e=S(),n=new MapboxDraw({displayControlsDefault:!1,controls:{point:e.pointAllowed,line_string:e.lineStringAllowed,polygon:e.polygonAllowed,trash:!0}});r.addControl(n,"top-left");r.on("draw.create",(e=>{var i=I();S().multipleAllowed?i.features.push(e.features[0]):i.features=[e.features[0]];r.setLayoutProperty("feature","visibility","visible");t("#finish-drawing div").fadeOut();n.deleteAll();d(i)}));r.on("draw.delete",(t=>{var e=I();e.features=[];r.setLayoutProperty("feature","visibility","visible");d(e)}));r.on("draw.update",(t=>{var e=I();e.features=[t.features[0]];d(e)}));r.on("load",(()=>{t(document).on("click","#draw-point",(()=>{r.setLayoutProperty("feature","visibility","none");t("#finish-drawing div").fadeIn();n.changeMode("draw_point")}));t(document).on("click","#draw-linestring",(()=>{r.setLayoutProperty("feature","visibility","none");t("#finish-drawing div").fadeIn();n.changeMode("draw_line_string")}));t(document).on("click","#edit-linestring",(()=>{if(I().features[0]){r.setLayoutProperty("feature","visibility","none");t("#finish-drawing div").fadeIn();var e=n.add(I());n.changeMode("direct_select",{featureId:e[0]})}}));t(document).on("click","#draw-polygon",(()=>{r.setLayoutProperty("feature","visibility","none");n.changeMode("draw_polygon")}));t(document).on("click","#edit-polygon",(()=>{if(I().features[0]){r.setLayoutProperty("feature","visibility","none");t("#finish-drawing div").fadeIn();var e=n.add(I());n.changeMode("direct_select",{featureId:e[0]})}}));t(document).on("click","#finish-drawing div",(()=>{var e=I(),i=n.getAll(),o=e.features.findIndex((t=>t.id===i.features[0].id));o>-1&&(e.features[o]=i.features[0]);r.setLayoutProperty("feature","visibility","visible");t("#finish-drawing div").fadeOut();n.deleteAll();d(e)}));t(document).on("click","#draw-delete",(()=>{n.deleteAll();r.setLayoutProperty("feature","visibility","none");d({type:"FeatureCollection",features:[]})}))}))}();!function(){"location"===E()&&C();v();r.on("load",(()=>{r.addSource("feature",{type:"geojson",data:I()});o()}))}();h();!function(){if(t("#mapster-map-geosearch").length){const e=new GeoSearch.OpenStreetMapProvider;t(document).on("click","#mapster-get-results",(async function(){var r=t("#mapster-map-geosearch").val();if(r.length>2){const o=await e.search({query:r});var i=n(o);t("#mapster-geocoder-results").empty().append(i)}else t("#mapster-geocoder-results").empty()}));t(document).on("keyup","#mapster-map-geosearch",(function(){t("#mapster-map-geosearch").val().length<=2&&t("#mapster-geocoder-results").empty()}));t(document).on("click","#mapster-geocoder-results li",(function(){var e=t(this).data("bounds");d({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t(this).data("center")}}]});r.fitBounds(e.map((t=>t.slice().reverse())),{padding:20});t("#mapster-geocoder-results").empty()}));const n=t=>{var e="";t.slice(0,5).forEach((t=>{e+=`<li data-center="${JSON.stringify([t.x,t.y])}" data-bounds="${JSON.stringify(t.bounds)}">${t.label}</li>`}));return e}}if(t("#mapster-geocoder-mapbox").length){const e=t("#mapster-geocoder-mapbox").data("access_token"),n=new MapboxGeocoder({accessToken:e,mapboxgl:maplibregl,marker:!1});n.on("result",(t=>{d({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t.result.center}}]})}));document.getElementById("mapster-geocoder-mapbox").appendChild(n.onAdd(r))}}();p();"line"!==E()&&"polygon"!==E()||function(){t("#mapster-map-upload").change((function(t){e(t)}));const e=async t=>{const e=await new Response(t.target.files[0]).json();r(e)},r=e=>{if(e){const n=geojsonhint.hint(e);if(0===n.length){if(r=e.features.find((e=>t("#mapster-map-upload").data("type").indexOf(e.geometry.type)>-1))){if(window.confirm("Are you sure you want to upload this geoJSON? It will overwrite all existing features.")){r.id||(r.id=parseInt(Math.random()*Math.random()*1e7));d({type:"FeatureCollection",features:[r]})}}else window.alert("Please double-check that your geoJSON has the right geometry type for this post.")}else{var r;if(r=e.features.find((e=>t("#mapster-map-upload").data("type").indexOf(e.geometry.type)>-1))){if(window.confirm("There was an error with your upload: "+JSON.stringify(n)+". Are you sure you want to upload this geoJSON? It will overwrite all existing features.")){r.id||(r.id=parseInt(Math.random()*Math.random()*1e7));d({type:"FeatureCollection",features:[r]})}}else window.alert("GeoJSON error: "+JSON.stringify(n))}}else window.alert("Please upload a file.")}}();if("location"===E()){l();t(document).on("click","#set-manual-point",(function(){let e=t("#mapster-map-point-longitude").val(),r=t("#mapster-map-point-latitude").val();d({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[parseFloat(e),parseFloat(r)]}}]})}))}"polygon"===E()&&u()}function d(e){!function(t){t.features.forEach((t=>{t.geometry.coordinates=t.geometry.coordinates.map(g)}))}(e);!function(e){t(`#mapster-map-geojson-${w()}`).attr("value",JSON.stringify(e))}(e);r.getSource("feature").setData(e);s();if("location"===E()){C();"3d-model"===y()&&x()}}function g(t){return isNaN(t)?t.map(g):Math.round(1e8*t)/1e8}function y(){return t(".mapster-map-submission-frontend").length?"marker":t('.acf-field[data-name="location_style"]').find("select").val()}function m(){return t('.acf-field[data-name="polygon_style"]').find("select").val()}function v(){if("location"===E()&&"circle"===y()){var e=t('.acf-field[data-name="circle"] .acf-field[data-name="color"]').find(":input").val(),n=t('.acf-field[data-name="circle"] .acf-field[data-name="opacity"]').find(":input").val(),i=t('.acf-field[data-name="circle"] .acf-field[data-name="radius"]').find(":input").val(),o=t('.acf-field[data-name="circle"] .acf-field[data-name="stroke-width"]').find(":input").val(),a=t('.acf-field[data-name="circle"] .acf-field[data-name="stroke-color"]').find(":input").val(),s=t('.acf-field[data-name="circle"] .acf-field[data-name="stroke-opacity"]').find(":input").val();return{paint:{color:""!==e?e:"#000",opacity:""!==n?parseFloat(n)/100:1,radius:""!==i?parseFloat(i):5,"stroke-width":""!==o?parseFloat(o):0,"stroke-color":""!==a?a:"#FFF","stroke-opacity":""!==s?parseFloat(s)/100:1}}}if("location"===E()&&"marker"===y()){e=t('.acf-field[data-name="marker"] .acf-field[data-name="color"]').find(":input").val();var u=t('.acf-field[data-name="marker"] .acf-field[data-name="scale"]').find(":input").val(),l=t('.acf-field[data-name="marker"] .acf-field[data-name="rotation"]').find(":input").val(),c=t('.acf-field[data-name="marker"] .acf-field[data-name="anchor"]').find(":input").val();return{marker:{color:""!==e?e:"#000",scale:""!==u?parseFloat(u)/100:1,rotation:""!==l?parseFloat(l):0,anchor:""!==c?c:"center"}}}if("location"===E()&&"label"===y()){var h=t('.acf-field[data-name="label"] .acf-field[data-name="label_on"]').find(":input").is(":checked"),p=t('.acf-field[data-name="label"] .acf-field[data-name="text-field"]').find(":input").val(),f=t('.acf-field[data-name="label"] .acf-field[data-name="text-font"]').find(":input").val(),d=t('.acf-field[data-name="label"] .acf-field[data-name="text-size"]').find(":input").val(),g=t('.acf-field[data-name="label"] .acf-field[data-name="text-color"]').find(":input").val(),v=t('.acf-field[data-name="label"] .acf-field[data-name="text-opacity"]').find(":input").val(),_=t('.acf-field[data-name="label"] .acf-field[data-name="text-rotate"]').find(":input").val(),x=t('.acf-field[data-name="label"] .acf-field[data-name="text-translate-x"]').find(":input").val(),b=t('.acf-field[data-name="label"] .acf-field[data-name="text-translate-y"]').find(":input").val(),w=t('.acf-field[data-name="label"] .acf-field[data-name="text-halo-width"]').find(":input").val(),I=t('.acf-field[data-name="label"] .acf-field[data-name="text-halo-color"]').find(":input").val(),S=t('.acf-field[data-name="label"] .acf-field[data-name="text-halo-blur"]').find(":input").val(),C=t('.acf-field[data-name="icon"] .acf-field[data-name="icon_on"]').find(":input").is(":checked"),P=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-image"] img').attr("src"),M=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-size"]').find(":input").val(),T=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-opacity"]').find(":input").val(),L=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-rotate"]').find(":input").val(),A=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-translate-x"]').find(":input").val(),k=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-translate-y"]').find(":input").val(),N=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-anchor"]').find(":input").val();""!==P&&function(t,e){t||e();"https:"===window.location.protocol&&t.indexOf("http://")>-1&&(t=t.replace("http","https"));r.loadImage(t,((t,n)=>{if(r.loaded()){r.hasImage("icon-image-location")?r.updateImage("icon-image-location",n):r.addImage("icon-image-location",n);e()}else r.once("idle",(()=>{r.hasImage("icon-image-location")?r.updateImage("icon-image-location",n):r.addImage("icon-image-location",n);e()}))}))}(P,(()=>{r.setLayoutProperty("feature","icon-image","icon-image-location")}));const e={layout:{"text-field":""!==p?p:"","text-font":[f],"text-rotate":""!==_?parseFloat(_):0,"text-size":""!==d?parseFloat(d):16,"icon-size":""!==M?parseFloat(M)/100:1,"icon-rotate":""!==L?parseFloat(L):0,"icon-anchor":""!==N?N:"center","icon-offset":""!==A&&""!==k?[parseFloat(A),parseFloat(k)]:[0,0],"text-offset":""!==x&&""!==b?[parseFloat(x),parseFloat(b)]:[0,0]},paint:{"text-color":""!==g?g:"#000000","text-halo-width":""!==w?parseFloat(w):1,"text-halo-color":""!==I?I:"#FFFFFF","text-halo-blur":""!==S?parseFloat(S)/100:.5,"text-opacity":""!==v?parseFloat(v)/100:1,"icon-opacity":""!==T?parseFloat(T)/100:1}};h||(e.layout["text-size"]=0);C||(e.layout["icon-size"]=0);return e}if("line"===E()){e=t('.acf-field[data-name="color"]').find(":input").val(),n=t('.acf-field[data-name="opacity"]').find(":input").val();var D=t('.acf-field[data-name="width"]').find(":input").val(),R=t('.acf-field[data-name="dashed_line"]').find(":input").is(":checked"),O=t('.acf-field[data-name="dash_length"]').find(":input").val(),z=t('.acf-field[data-name="gap_length"]').find(":input").val();const r={paint:{color:""!==e?e:"#000",opacity:""!==n?parseFloat(n)/100:1,width:""!==D?parseFloat(D):5}};r.paint.dasharray=R?""!==O&&""!==z?[parseFloat(O),parseFloat(z)]:[1,1]:[1,0];return r}if("polygon"===E()&&"fill"===m()){e=t('.acf-field[data-name="color"]').find("input").val(),n=t('.acf-field[data-name="opacity"]').find("input").val();var F=t('.acf-field[data-name="outline-color"]').find("input").val();return{paint:{color:""!==e?e:"#000",opacity:""!==n?parseFloat(n)/100:1,"outline-color":""!==F?F:"rgba(0, 0, 0, 0)"}}}if("polygon"===E()&&"fill-extrusion"===m()){e=t('.acf-field[data-name="color"]').find("input").val(),n=t('.acf-field[data-name="opacity"]').find("input").val();var B=t('.acf-field[data-name="base"]').find("input").val(),U=t('.acf-field[data-name="height"]').find("input").val();return{paint:{color:""!==e?e:"#000",opacity:""!==n?parseFloat(n)/100:1,base:""!==B?parseFloat(B):0,height:""!==U?parseFloat(U):0}}}}function _(){return"location"===E()&&"circle"===y()?"circle-":"location"===E()&&"label"===y()?"":"line"===E()?"line-":"polygon"===E()&&"fill"===m()?"fill-":"polygon"===E()&&"fill-extrusion"===m()?"fill-extrusion-":void 0}function x(){
}function b(){return t(e).find(".mapster-map")}function w(){return b().attr("id").replace("mapster-map-","")}function E(){if(t(".mapster-map-submission-frontend").length){let e=1===t(".mapster-submission-map").data("linestring")?"line":"";e=1===t(".mapster-submission-map").data("point")?"location":e;e=1===t(".mapster-submission-map").data("polygon")?"polygon":e;return e}var e=t("body").attr("class").split(/\s+/).find((t=>t.indexOf("post-type-mapster-wp-")>-1)).replace("post-type-mapster-wp-","");return e="user-sub"===e?"location":e}function I(){var e=t(`#mapster-map-geojson-${w()}`).val();if(e&&""!==e){return JSON.parse(e)}return{type:"FeatureCollection",features:[]}}function S(){return{pointAllowed:1===b().data("point"),lineStringAllowed:1===b().data("linestring"),polygonAllowed:1===b().data("polygon"),multipleAllowed:1===b().data("multiple")}}function C(){if(I().features[0]){var e=I().features[0].geometry.coordinates;t("#mapster-map-point-longitude").val(e[0]);t("#mapster-map-point-latitude").val(e[1])}else{t("#mapster-map-point-longitude").val("");t("#mapster-map-point-latitude").val("")}}function P(){
}if(void 0!==acf.add_action){acf.add_action("ready_field/type=mapster-map",f);acf.add_action("append_field/type=mapster-map",f);acf.add_action("show_field/type=mapster-map",f)}else t(document).on("acf/setup_fields",(function(e,r){t(r).find('.field[data-field_type="mapster-map"]').each((function(){f(t(this))}))}))}(jQuery);