import {
  XYZ_default,
  defaultTileLoadFunction
} from "./chunk-3ZDRPUXW.js";
import {
  WORKER_OFFSCREEN_CANVAS
} from "./chunk-5XHD7RSF.js";

// node_modules/ol/source/OSM.js
var ATTRIBUTION = '&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';
var OSM = class extends XYZ_default {
  /**
   * @param {Options} [options] Open Street Map options.
   */
  constructor(options) {
    options = options || {};
    let attributions;
    if (options.attributions !== void 0) {
      attributions = options.attributions;
    } else {
      attributions = [ATTRIBUTION];
    }
    const crossOrigin = options.crossOrigin !== void 0 ? options.crossOrigin : "anonymous";
    const url = options.url !== void 0 ? options.url : "https://tile.openstreetmap.org/{z}/{x}/{y}.png";
    super({
      attributions,
      attributionsCollapsible: false,
      cacheSize: options.cacheSize,
      crossOrigin,
      interpolate: options.interpolate,
      maxZoom: options.maxZoom !== void 0 ? options.maxZoom : 19,
      reprojectionErrorThreshold: options.reprojectionErrorThreshold,
      tileLoadFunction: (
        /**
         * @param {import("../ImageTile.js").default} tile Image tile
         * @param {string} src Image src
         */
        (tile, src) => {
          const image = tile.getImage();
          if (!WORKER_OFFSCREEN_CANVAS && image instanceof HTMLImageElement) {
            image.referrerPolicy = "origin-when-cross-origin";
          }
          (options.tileLoadFunction || defaultTileLoadFunction)(tile, src);
        }
      ),
      transition: options.transition,
      url,
      wrapX: options.wrapX,
      zDirection: options.zDirection
    });
  }
};
var OSM_default = OSM;

export {
  ATTRIBUTION,
  OSM_default
};
//# sourceMappingURL=chunk-43GYE2V5.js.map
