import { mapStores as o } from "pinia";
import { u as p } from "./index-CgeNF-PU.js";
const l = function(t) {
  return t ? [...new Set(t.map((e) => JSON.stringify(e)))].map(
    (e) => JSON.parse(e)
  ) : [];
}, u = {
  computed: {
    ...o(p)
  },
  methods: {
    flatmapPanZoomCallback: function(t) {
      if (this.mouseHovered) {
        const e = {
          paneIndex: this.entry.id,
          eventType: "panZoom",
          payload: t,
          type: this.entry.type
        };
        this.$emit("resource-selected", e);
      }
    },
    /**
     * Function used for updating the flatmap markers.
     * We set the markers based on what was searched and the flatmap clusters them.
     */
    flatmapMarkerUpdate(t) {
      if (!this.flatmapReady) return;
      let e = t;
      if (e || (e = this.getFlatmapImp()), e) {
        let a = this.settingsStore.globalSettings.displayMarkers ? this.settingsStore.markers : [];
        a = l(a), e.clearMarkers(), e.clearDatasetMarkers(), e.addDatasetMarkers(a), this.entry.type === "MultiFlatmap" && this.restoreFeaturedMarkers(e);
      }
    },
    // removeMarkersNotOnFlatmap: rewrites the dataset marker list to only include markers that are on the flatmap
    removeMarkersNotOnFlatmap(t, e) {
      let a = t.anatomicalIdentifiers, m = [];
      for (let i = 0; i < e.length; i++) {
        let r = e[i], n = { id: r.id, terms: [] };
        for (let s = 0; s < r.terms.length; s++)
          a.includes(r.terms[s]) && n.terms.push(r.terms[s]);
        m.push(n);
      }
      return m;
    },
    flatmapReadyForMarkerUpdates: function(t) {
      if (t) {
        t.enablePanZoomEvents(!0), this.flatmapReady = !0;
        const e = t.mapImp;
        this.flatmapMarkerUpdate(e);
      }
    }
  }
};
export {
  u as D
};
