import { parsePositionFromString as i, isValidBoundingBox as l, calculateBoundingBox as c } from "./positions.js";
const b = (e) => {
  const { top: t, left: o, bottom: g, right: n } = e;
  return new H.geo.Rect(t, o, g, n);
}, r = (e) => (t) => t instanceof e, a = r(H.map.AbstractMarker), s = r(H.map.Group), d = r(H.map.Polyline), u = (e) => e.getGeometry(), y = (e) => ({
  getCenter: () => {
    const t = e.getCenter();
    return {
      lat: t.lat,
      lng: t.lng
    };
  },
  setCenter: (t, o) => {
    e.getViewModel().setLookAtData({ position: t }, o);
  },
  getPreciseZoom: () => {
    const { zoom: t } = e.getViewModel().getLookAtData();
    return t === void 0 ? 0 : t;
  },
  getZoom: () => {
    const { zoom: t } = e.getViewModel().getLookAtData();
    return Math.round(t === void 0 ? 0 : t);
  },
  setZoom: (t, o = !1) => {
    e.getViewModel().setLookAtData({ zoom: t }, o);
  },
  getViewPort: () => {
    const t = e.getViewPort();
    return {
      width: t.width,
      height: t.height,
      margin: t.margin,
      padding: {
        top: t.padding.top,
        right: t.padding.right,
        bottom: t.padding.bottom,
        left: t.padding.left
      },
      center: {
        x: t.center.x,
        y: t.center.y
      }
    };
  },
  getBounds: () => {
    const { bounds: t } = e.getViewModel().getLookAtData(), o = t?.getBoundingBox();
    return {
      topLeft: {
        lng: o?.getTopLeft().lng,
        lat: o?.getTopLeft().lat
      },
      bottomRight: {
        lng: o?.getBottomRight().lng,
        lat: o?.getBottomRight().lat
      }
    };
  },
  getObjects: () => e.getObjects(),
  getLayers: () => e.getLayers().asArray(),
  getBaseLayer: () => e.getBaseLayer(),
  getGroups: () => e.getObjects().filter(s),
  getMarkers: () => e.getObjects().filter(a),
  getRoutePolylines: () => e.getObjects().filter(s).flatMap((n) => n.getObjects()).filter(d),
  getPosition: u,
  calculateBoundingBox: c,
  isValidBoundingBox: l,
  parsePositionFromString: i
});
export {
  y as createUtils,
  b as getMapBounds
};
//# sourceMappingURL=mapUtils.js.map
