import n from"@babel/runtime/helpers/slicedToArray";import{estimateTileCount as t,MAX_VIEWPORT_TILES_FOR_FETCH as o,getZoomIncreaseForTileLimit as r}from"../../../../utils/tile-math.js";import{MapConfig as i,ClusterConfig as e}from"../constants.js";import{getViewportBounds as a}from"./getViewportBounds.js";var l=function(n){return Array.isArray(n)?[n[0],n[1]]:"lng"in n?[n.lng,n.lat]:"lon"in n?[n.lon,n.lat]:[0,0]},d=.01,u=function(n,i,l,d){for(var u=Math.max(i,e.unclusteredMinZoom),m=0;m<5;m+=1){var s=a(n,u,l,d),c=t(s);if(c<=o)break;u+=r(c)}return u},m=function(n){var t=n.getCenter(),o=n.getCanvas(),r=o.clientWidth,i=o.clientHeight;return r<=0||i<=0?null:u([t.lng,t.lat],n.getZoom(),r,i)},s=function(t,o){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},e=r.padding,a=void 0===e?i.FitBounds.Padding:e,d=r.duration,m=void 0===d?700:d,s=n(o,4),c=s[0],g=s[1],f=s[2],v=s[3],p=[[c,g],[f,v]],h=t.cameraForBounds(p,{padding:a});if(null!=(null==h?void 0:h.zoom)&&h.center){var y=l(h.center),B=t.getCanvas(),b=u(y,h.zoom,B.clientWidth,B.clientHeight);t.flyTo({center:y,zoom:b,duration:m})}else t.fitBounds(p,{padding:a,duration:m})};export{d as MIN_ZOOM_DELTA,m as computeCurrentTileSafeZoom,u as computeTileSafeZoom,l as normalizeLngLat,s as smartFitBounds};
//# sourceMappingURL=smartFitBounds.js.map
