function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import React from "react";
import "./proj4";
import tarifverbundkarteLegend from "../img/tarifverbund_legend.url.svg";
import railplusLegend from "../img/railplus_legend.svg";
import energieLegendPub from "../img/energie_legend_pub.url.svg";
import { getRailplusLayers } from "./ch.railplus.mitglieder";
import { getNetzkarteLayers } from "./ch.sbb.netzkarte";
// import constructionLayers from "./ch.sbb.construction";
import { getHandicapLayers } from "./ch.sbb.handicap";
import { getInfrastrukturLayers } from "./ch.sbb.infrastruktur";
import { getEnergieLayers } from "./ch.sbb.energie";
import { getTarifverbundkarteLayers } from "./ch.sbb.tarifverbundkarte.public";
import { getRegionenkartePublicLayers } from "./ch.sbb.regionenkarte.public";
import { getBeleuchtungsLayers } from "./ch.sbb.beleuchtungsstaerken";
import { getIsbLayers } from "./ch.sbb.isb";
import { getSandboxLayers } from "./ch.sbb.netzkarte.sandbox";
import { getZweitausbildungLayers } from "./ch.sbb.zweitausbildung";
import { getGeltungsbereicheLayers, TK_LAYER_KEY, HTA_LAYER_KEY, GA_LAYER_KEY } from "./ch.sbb.geltungsbereiche.mvp";
import { getGeltungsbereicheIframeLayers } from "./ch.sbb.geltungsbereiche.iframe";
import { getStsLayers } from "./ch.sbb.sts";
import { getDirektverbindungenLayers } from "./ch.sbb.direktverbindungen";
import { getDefaultSearches, getSearchByName, SearchName } from "./searches";
import GeltungsbereicheTopicMenu from "../menus/GeltungsbereicheTopicMenu";
import StsMenu from "../menus/StsMenu";
import { DV_KEY, INFRASTRUKTUR_LAYER_NAME, MapsGeneralFilter, MapsGeneralFilterValues, ONLY_WHEN_NOT_LOGGED_IN, PDF_DOWNLOAD_EVENT_TYPE, RAILPLUS_EXPORTBTN_ID } from "../utils/constants";
import DvMenu from "../menus/DirektverbindungenMenu/DvMenu";
import DvListButton from "./ch.sbb.direktverbindungen/DvListButton";
import applyPermalinkVisiblity from "../utils/applyPermalinkVisibility";
import RailplusMenu from "../menus/RailplusMenu";
import RailplusExportButton from "./ch.railplus.mitglieder/RailplusExportButton";
import GaExportMapButton from "../menus/GaExportMenu/GaExportMapButton";
import geltungsbereicheLegends from "../img/geltungsbereicheLegends";
import { getFunkmesswagenLayers } from "./ch.sbb.funkmesswagen";
import MesswagenFollowButton from "./ch.sbb.funkmesswagen/MesswagenFollowButton";
import { MesswagenPopup } from "../popups";
import StsMenuToggler from "./ch.sbb.sts/StsMenuToggler/StsMenuToggler";
import MapboxStyleLayer from "../layers/MapboxStyleLayer";
import { getDirektverbindungenSingleLayers } from "./ch.sbb.direktverbindungen.single";
export const defaultElements = {
  header: true,
  footer: true,
  menu: true,
  permalink: true,
  mapControls: true,
  baseLayerSwitcher: true,
  popup: true,
  search: true,
  drawMenu: true,
  overlay: true,
  geolocationButton: true
};
export const getTopics = () => {
  const defaultSearches = getDefaultSearches();
  const handicapStopFinder = getSearchByName(SearchName.HandicapStopFinder);
  const stopFinder = getSearchByName(SearchName.Stationen);
  const netzkarte = {
    name: "ch.sbb.netzkarte.topic",
    key: "ch.sbb.netzkarte",
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      popup: true,
      shareMenu: true,
      trackerMenu: true,
      floorSwitcher: true
    }),
    layers: getNetzkarteLayers(),
    projection: "EPSG:3857",
    layerInfoComponent: "NetzkarteTopicInfo",
    searches: defaultSearches
  };
  const handicap = {
    name: "ch.sbb.handicap",
    key: "ch.sbb.handicap",
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      shareMenu: true,
      popup: true
    }),
    layers: getHandicapLayers(),
    projection: "EPSG:3857",
    layerInfoComponent: "HandicapTopicInfo",
    searches: {
      Stationen: handicapStopFinder
    },
    minZoom: 7
  };
  const netzkarteStelen = {
    name: "ch.sbb.netzkarte.topic",
    key: "ch.sbb.netzkarte",
    // layers: [dataLayer, netzkarteLayer, stationsLayer, bahnhofplaene],
    elements: {},
    projection: "EPSG:3857"
  };
  const infrastruktur = {
    name: "ch.sbb.infrastruktur",
    key: "ch.sbb.infrastruktur",
    maxZoom: 14,
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      shareMenu: true,
      popup: true
    }),
    layers: getInfrastrukturLayers(),
    projection: "EPSG:3857",
    layerInfoComponent: "InfrastrukturTopicInfo",
    searches: defaultSearches
  };
  const netzkarteEisenbahninfrastruktur = infrastruktur.layers.find(l => l.name === INFRASTRUKTUR_LAYER_NAME);
  // Clone layer to set visibility true by default for appName="betriebsregionen" [TRAFDIV-421]
  const betriebsRegionenVisible = new MapboxStyleLayer({
    name: "ch.sbb.betriebsregionen",
    visible: true,
    mapboxLayer: netzkarteEisenbahninfrastruktur,
    styleLayersFilter: _ref => {
      let {
        metadata
      } = _ref;
      return (metadata === null || metadata === void 0 ? void 0 : metadata[MapsGeneralFilter]) === MapsGeneralFilterValues.OPERATIONAL_REGIONS;
    },
    properties: {
      isQueryable: true,
      hasInfos: true,
      useOverlay: true,
      popupComponent: "BetriebsRegionenPopup",
      layerInfoComponent: "BetriebsRegionenLayerInfo"
    }
  });
  const betriebsregionen = {
    name: "ch.sbb.infrastruktur",
    key: "ch.sbb.infrastruktur",
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      header: false,
      search: false,
      drawMenu: false,
      popup: true
    }),
    layers: [netzkarteEisenbahninfrastruktur, betriebsRegionenVisible],
    projection: "EPSG:3857"
  };
  const regionenkartePublic = {
    name: "ch.sbb.regionenkarte.public",
    key: "ch.sbb.regionenkarte.public",
    maxZoom: 14,
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      popup: true,
      overlay: true
    }),
    layers: getRegionenkartePublicLayers(),
    layerInfoComponent: "RegionenkartePublicTopicInfo",
    searches: defaultSearches,
    minZoom: 7
  };
  const tarifverbundkarte = {
    name: "ch.sbb.tarifverbundkarte.public",
    key: "ch.sbb.tarifverbundkarte.public",
    layerInfoComponent: "TarifverbundkarteTopicInfo",
    layers: getTarifverbundkarteLayers(),
    maxZoom: 12,
    minZoom: 7,
    exportConfig: {
      getTemplateValues: () => ({
        publisher: "tobias.hauser@sbb.ch",
        publishedAt: "12/2025",
        dateDe: "14.12.2025",
        dateFr: "14.12.2025",
        year: "2025"
      }),
      getOverlayImageUrl: () => tarifverbundkarteLegend
    },
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      popup: true,
      shareMenu: {
        collapsedOnLoad: true
      },
      trackerMenu: true,
      exportMenu: true,
      drawMenu: {
        collapsedOnLoad: true
      }
    }),
    searches: defaultSearches
  };
  const zweitausbildung = {
    name: "ch.sbb.zweitausbildung",
    key: "ch.sbb.zweitausbildung",
    maxZoom: 13,
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      shareMenu: true,
      popup: true
    }),
    layers: getZweitausbildungLayers(),
    projection: "EPSG:3857",
    layerInfoComponent: "ZweitausbildungTopicInfo",
    searches: defaultSearches,
    minZoom: 7
  };
  const beleuchtungsstaerken = {
    name: "ch.sbb.beleuchtungsstaerken",
    key: "ch.sbb.beleuchtungsstaerken",
    maxZoom: 14,
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      shareMenu: true,
      popup: true
    }),
    layers: getBeleuchtungsLayers(),
    projection: "EPSG:3857",
    layerInfoComponent: "BeleuchtungTopicInfo",
    searches: defaultSearches,
    minZoom: 7
  };
  const energiePublic = {
    name: "ch.sbb.energie",
    key: "ch.sbb.energie",
    maxZoom: 14,
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      shareMenu: true,
      popup: true,
      overlay: true,
      exportMenu: true
    }),
    exportConfig: {
      getTemplateValues: () => ({
        publisher: "I-EN-DAE-OAN-BUI, trassensicherung-energie@sbb.ch",
        publishedAt: () => {
          const date = new Date();
          return "".concat(date.getMonth() + 1, "/").concat(date.getFullYear());
        },
        year: () => new Date().getFullYear()
      }),
      getOverlayImageUrl: () => energieLegendPub
    },
    layers: getEnergieLayers(),
    projection: "EPSG:3857",
    layerInfoComponent: "EnergiePublicTopicInfo",
    searches: defaultSearches,
    minZoom: 7
  };
  const isb = {
    name: "ch.sbb.isb",
    key: "ch.sbb.isb",
    maxZoom: 14,
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      shareMenu: true,
      popup: true
    }),
    layers: getIsbLayers(),
    projection: "EPSG:3857",
    layerInfoComponent: "IsbTopicInfo",
    searches: defaultSearches,
    minZoom: 7
  };
  const sandbox = {
    name: "ch.sbb.netzkarte.sandbox",
    key: "ch.sbb.netzkarte.sandbox",
    layers: getSandboxLayers(),
    projection: "EPSG:3857",
    elements: defaultElements,
    layerInfoComponent: "SandboxTopicInfo",
    searches: defaultSearches
  };
  const geltunsbereicheLayers = getGeltungsbereicheLayers();
  const geltungsbereicheTk = geltunsbereicheLayers.find(l => l.name === TK_LAYER_KEY);
  const geltungsbereicheHta = geltunsbereicheLayers.find(l => l.name === HTA_LAYER_KEY);
  const geltungsbereicheGA = geltunsbereicheLayers.find(l => l.name === GA_LAYER_KEY);
  const getVisibleGbExportLayer = () => [geltungsbereicheTk, geltungsbereicheHta, geltungsbereicheGA].find(l => l.visible);
  const geltungsbereicheMvp = {
    name: "ch.sbb.geltungsbereiche",
    key: "ch.sbb.geltungsbereiche",
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      popup: true,
      shareMenu: true
    }),
    maxZoom: 14,
    minZoom: 7,
    layers: geltunsbereicheLayers,
    projection: "EPSG:3857",
    layerInfoComponent: "GeltungsbereicheTopicInfo",
    searches: defaultSearches,
    mapControls: /*#__PURE__*/React.createElement(GaExportMapButton, null),
    exportConfig: {
      getTemplateValues: () => ({
        publishedAt: new Date().toLocaleDateString("en-GB", {
          year: "numeric",
          month: "2-digit"
        })
      }),
      getOverlayImageUrl: (lang, paperSize) => {
        var _geltungsbereicheLege;
        const visibleLayer = getVisibleGbExportLayer();
        return ((_geltungsbereicheLege = geltungsbereicheLegends.find(l => l.paperSize === paperSize && l.language === lang && l.validity === (visibleLayer === null || visibleLayer === void 0 ? void 0 : visibleLayer.name))) === null || _geltungsbereicheLege === void 0 ? void 0 : _geltungsbereicheLege.legend) || geltungsbereicheLegends[0].legend;
      },
      getExportFileName: (t, paperSize, lang) => {
        const nameByLang = t("ch.sbb.geltungsbereiche").replaceAll(" ", "_");
        const date = new Date().toISOString().slice(0, 10);
        return "".concat(nameByLang, "_").concat(paperSize.toUpperCase(), "_").concat(lang.toUpperCase(), "_").concat(date, ".pdf");
      }
    }
  };
  const geltungsbereicheIframe = _objectSpread(_objectSpread({}, geltungsbereicheMvp), {}, {
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      popup: true,
      shareMenu: false,
      drawMenu: false,
      permalink: true,
      geolocationButton: false,
      header: false,
      search: false,
      footer: false,
      menu: false
    }),
    key: "ch.sbb.geltungsbereiche-iframe",
    layers: getGeltungsbereicheIframeLayers(),
    only: true,
    hideInLayerTree: true,
    menu: /*#__PURE__*/React.createElement(GeltungsbereicheTopicMenu, null)
  });
  const sts = {
    name: "ch.sbb.sts",
    key: "ch.sbb.sts",
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      overlay: false,
      popup: false,
      shareMenu: false,
      drawMenu: false,
      permalink: true,
      geolocationButton: false,
      header: false,
      search: false,
      footer: false,
      menu: false,
      menuToggler: true,
      baseLayerSwitcher: false
    }),
    layers: getStsLayers(),
    only: true,
    hideInLayerTree: true,
    menu: /*#__PURE__*/React.createElement(StsMenu, null),
    enableFeatureClick: true,
    disablePermalinkLayers: false,
    center: [915788.3813658276, 5909670.533831286],
    zoom: 8,
    constrainOnlyCenter: true,
    overlaySide: "left",
    searches: {
      Stationen: stopFinder
    },
    menuToggler: /*#__PURE__*/React.createElement(StsMenuToggler, null)
  };
  const direktverbindungen = {
    name: "".concat(DV_KEY, ".topic"),
    key: "".concat(DV_KEY),
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      popup: true,
      shareMenu: true,
      fitExtent: false
    }),
    maxZoom: 13,
    minZoom: 6,
    layers: getDirektverbindungenLayers(),
    projection: "EPSG:3857",
    layerInfoComponent: "DvTopicInfo",
    searches: defaultSearches,
    mapControls: /*#__PURE__*/React.createElement(DvListButton, null)
  };
  const direktverbindungenIframe = {
    name: "".concat(DV_KEY, "-iframe.topic"),
    key: "".concat(DV_KEY, "-iframe"),
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      overlay: false,
      popup: false,
      shareMenu: false,
      drawMenu: false,
      permalink: true,
      geolocationButton: true,
      header: false,
      search: false,
      footer: false,
      menu: false,
      baseLayerSwitcher: false,
      fitExtent: false
    }),
    maxZoom: 13,
    minZoom: 6,
    layers: getDirektverbindungenLayers(),
    enableFeatureClick: true,
    only: true,
    hideInLayerTree: true,
    menu: /*#__PURE__*/React.createElement(DvMenu, null),
    mapControls: /*#__PURE__*/React.createElement(DvListButton, null),
    overlaySide: "left"
  };
  const direktverbindungenSingle = {
    name: "".concat(DV_KEY, "-single.topic"),
    key: "".concat(DV_KEY, "-single"),
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      overlay: false,
      popup: false,
      shareMenu: false,
      drawMenu: false,
      permalink: false,
      geolocationButton: false,
      header: false,
      search: false,
      footer: false,
      menu: false,
      baseLayerSwitcher: false,
      fitExtent: false
    }),
    maxZoom: 13,
    minZoom: 6,
    layers: getDirektverbindungenSingleLayers(),
    enableFeatureClick: false,
    only: true,
    hideInLayerTree: true
    // menu: <DvMenu />,
    // mapControls: <DvListButton />,
    // overlaySide: "left",
  };
  const railPlus = {
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      overlay: false,
      popup: false,
      shareMenu: false,
      drawMenu: false,
      permalink: true,
      geolocationButton: false,
      header: false,
      search: false,
      footer: false,
      menu: false
    }),
    key: "ch.railplus.mitglieder",
    name: "ch.railplus.mitglieder",
    layers: getRailplusLayers(),
    only: true,
    hideInLayerTree: true,
    enableFeatureClick: true,
    mapControls: /*#__PURE__*/React.createElement(RailplusExportButton, null),
    menu: /*#__PURE__*/React.createElement(RailplusMenu, null),
    embedded: true,
    overlaySide: "left",
    messageEvents: [{
      eventType: PDF_DOWNLOAD_EVENT_TYPE,
      callback: () => document.getElementById(RAILPLUS_EXPORTBTN_ID).click()
    }],
    exportConfig: {
      getTemplateValues: () => ({
        publishedAt: "12/2025",
        year: "2025"
      }),
      getOverlayImageUrl: () => railplusLegend,
      getExportFileName: () => "RAILplus Streckennetz-Carte du r\xE9seau-Carta della rete  ".concat(new Date().toISOString().slice(0, 10))
    },
    minZoom: 7,
    maxZoom: 13,
    noTracking: true
  };
  const messwagen = {
    name: "ch.sbb.funkmesswagen",
    key: "ch.sbb.funkmesswagen",
    layers: getFunkmesswagenLayers(),
    elements: _objectSpread(_objectSpread({}, defaultElements), {}, {
      drawMenu: false
    }),
    hideInLayerTree: ONLY_WHEN_NOT_LOGGED_IN,
    mapControls: /*#__PURE__*/React.createElement(MesswagenFollowButton, null),
    searches: defaultSearches,
    layerInfoComponent: "MesswagenTopicInfo",
    customElements: /*#__PURE__*/React.createElement(MesswagenPopup, null)
  };
  return {
    wkp: [netzkarte, geltungsbereicheMvp, direktverbindungen, direktverbindungenIframe, direktverbindungenSingle, zweitausbildung, handicap, tarifverbundkarte, infrastruktur, isb, regionenkartePublic, beleuchtungsstaerken, geltungsbereicheIframe, sts, energiePublic, sandbox, railPlus, messwagen],
    stelen: [netzkarteStelen],
    betriebsregionen: [betriebsregionen]
  };
};
export const getTopicsFromAppName = name => {
  const topics = getTopics();
  topics.wkp.forEach(topic => {
    applyPermalinkVisiblity(topic.layers, pathname => (pathname === null || pathname === void 0 ? void 0 : pathname.indexOf("/".concat(topic.key))) !== -1);
  });
  return topics[name];
};
//# sourceMappingURL=topics.js.map