"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@babel/runtime/helpers/slicedToArray"),e=require("@mapbox/tilebelt");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}require("../components/Map/OffsetWellMap/constants.js");var o=r(t),n=function(t){var e=o.default(t,3),r=e[0],n=e[1],a=e[2];return"".concat(a,"/").concat(r,"/").concat(n)},a=function(t){var e=t.split("/").map(Number),r=o.default(e,3),n=r[0];return[r[1],r[2],n]},s=function(t){var r=e.tileToBBOX(t),n=o.default(r,4),a=n[0],s=n[1],i=n[2];return{lat_start:s,lat_end:n[3],long_start:a,long_end:i}},i=function(t,r){return e.pointToTile(t,r,11)};exports.MAX_TILES_FOR_FETCH=12,exports.MAX_VIEWPORT_TILES_FOR_FETCH=25,exports.TILE_ZOOM=11,exports.estimateTileCount=function(t){var e=t.north,r=t.south,o=t.east,n=t.west,a=i(n,e),s=i(o,r),l=Math.min(a[0],s[0]),u=Math.max(a[0],s[0]),p=Math.min(a[1],s[1]);return(u-l+1)*(Math.max(a[1],s[1])-p+1)},exports.getTilesForViewport=function(t){for(var e=t.north,r=t.south,o=t.east,a=t.west,s=i(a,e),l=i(o,r),u=[],p=Math.min(s[0],l[0]),c=Math.max(s[0],l[0]),_=Math.min(s[1],l[1]),f=Math.max(s[1],l[1]),T=p;T<=c;T+=1)for(var m=_;m<=f;m+=1){var x=[T,m,11];u.push(n(x))}return u},exports.getZoomIncreaseForTileLimit=function(t){if(t<=25)return 0;var e=t/25;return Math.log2(Math.sqrt(e))+.1},exports.keyToTile=a,exports.pointToTile=i,exports.tileToBounds=s,exports.tileToKey=n,exports.tilesToGeoJSON=function(t){return{type:"FeatureCollection",features:t.map((function(t){var e=a(t),r=s(e);return{type:"Feature",properties:{tileKey:t},geometry:{type:"Polygon",coordinates:[[[r.long_start,r.lat_start],[r.long_end,r.lat_start],[r.long_end,r.lat_end],[r.long_start,r.lat_end],[r.long_start,r.lat_start]]]}}}))}};
//# sourceMappingURL=tile-math.js.map
