import { jsx as f } from "react/jsx-runtime";
import { ENGINE_TYPE_HARP as s, DEFAULT_RASTER_LAYER_FORMAT as l, DEFAULT_TILE_SIZE as n, ENGINE_TYPE_P2D as y } from "../../../constants.js";
import p from "./Layer.js";
import { useMapContext as T } from "../../../MapContext.js";
import { isVectorBased as m } from "../../../../utils/rendering.js";
const L = (e, r, a, t) => {
  const i = new H.service.Url("https", "traffic.maps.hereapi.com"), o = e.platform?.getRasterTileService({
    baseUrl: i,
    format: l,
    path: "v3",
    resource: "flow",
    queryParams: {
      apikey: e.credentials?.apikey,
      lang: t,
      ppi: 400,
      style: "explore.day"
    }
  }), c = new H.service.rasterTile.Provider(o, {
    engineType: y,
    tileSize: n
  });
  return new H.map.layer.TileLayer(c);
}, _ = (e, r, a) => {
  const t = new H.service.trafficVectorTile.Provider(
    // @ts-expect-error-next-line: it works despite TS throwing an error
    e.platform?.getTrafficVectorTileService({ layer: "flow" }),
    // @ts-expect-error-next-line
    new H.map.render.harp.Style({}),
    { engineType: s }
  );
  return new H.map.layer.TileLayer(t, { min: 2, max: 24 });
}, P = (e) => {
  const r = T(), a = m(r.enableWebGL, r.baseLayer) ? _ : L;
  return /* @__PURE__ */ f(p, { ...e, createLayer: a });
};
export {
  P as default
};
//# sourceMappingURL=TrafficLayer.js.map
