'use strict';Object.defineProperty(exports,'__esModule',{value:true});var normalizeComponent=require('./normalize-component-d9981c57.js');require('./es.object.to-string-f27a75a8.js'),require('./es.array.includes-3990bfec.js'),require('./es.number.constructor-daccdeab.js'),require('./es.array.filter-6fabfac0.js'),require('./web.dom-collections.for-each-c07b0e22.js'),require('./es.array.map-4cfed4ef.js'),require('./es.array.from-6c133395.js'),require('./es.string.iterator-97f3177b.js'),require('./web.dom-collections.iterator-b68605b3.js'),require('./es.json.stringify-f88f52bf.js');var BaseTextList=require('./BaseTextList-9a94417c.js');require('./classof-819fc780.js'),require('./export-61511812.js'),require('./object-keys-12f2c5e5.js'),require('./object-set-prototype-of-dfa14cf5.js'),require('./array-iteration-f8b4483d.js'),require('./function-bind-context-e4685306.js'),require('./array-species-create-c414c2ec.js'),require('./array-method-has-species-support-983ac207.js'),require('./dom-iterables-e2602b7e.js'),require('./array-method-is-strict-99341ee3.js'),require('./create-property-240c71a5.js'),require('./string-multibyte-a2dff6e3.js'),require('./set-to-string-tag-240bb3b0.js'),require('./set-species-08510c13.js'),require('./typeof-6b9e62b8.js'),require('./es.array.concat-bb8715dc.js'),require('./unsupportedIterableToArray-40a00645.js'),require('./es.string.includes-ec03e639.js'),require('./is-regexp-d6f1551e.js'),require('./es.object.keys-c57f02bd.js'),require('./i18n-68e039d3.js'),require('./regexp-exec-abstract-216cd44a.js'),require('./regexp-flags-abc49c4a.js'),require('./es.string.split-98e29ede.js');/**
 * A component to display Basemap, locations-list and interact with each other
 */

var script = {
  name: 'BaseMapLocations',
  components: {
    BaseMap: function BaseMap() {
      return Promise.resolve().then(function(){return require('./BaseMap-9b33d889.js')}).then(function (m) {
        return m.default || m;
      });
    },
    BaseTextList: BaseTextList.B
  },
  props: {
    /**
     * set additional styles for map e.g. height
     */
    additionalMapStyles: {
      type: Object,
      default: function _default() {
        return {
          height: '368px'
        };
      }
    },

    /**
     * define map attribution
     */
    attribution: {
      type: String,
      default: 'Source: <a href=https://openstreetmap.org/>OpenStreetMap contributors</a>'
    },

    /**
     * define position of map attribution<br>
     *   valid options: 'topright' | 'bottomleft' | 'bottomright'
     */
    attributionPosition: {
      type: String,
      default: 'bottomright',
      validate: function validate(val) {
        return ['topright', 'bottomleft', 'bottomright'].includes(val);
      }
    },

    /**
     * define number of items for cluster sizes<br>
     *   structure: { medium: 5, large: 20, xlarge: 100 }<br>
     *   Note: medium, large, xlarge is mandatory
     */
    clusterSizes: {
      type: Object,
      default: function _default() {
        return {
          medium: 5,
          large: 20,
          xlarge: 100
        };
      },
      validator: function validator(data) {
        return data.medium && data.large && data.xlarge;
      }
    },

    /**
     * define map copyright
     */
    copyright: {
      type: String,
      default: '<a href=http://creativecommons.org/licenses/by-sa/3.0/>CC BY-SA 3.0</a>'
    },

    /*
     * define icon
     */
    icon: {
      type: String,
      default: '<svg viewBox="0 0 70.866 70.866" xmlns="http://www.w3.org/2000/svg"><path d="m35.433 0a22.731 22.731 0 0 0-22.731 22.82 24.125 24.125 0 0 0 1.872 9.1814l19.611 38.063a1.3718 1.3718 0 0 0 2.496 0l19.611-38.063a22.249 22.249 0 0 0 1.872-9.1814 22.731 22.731 0 0 0-22.731-22.82zm0 32.858a10.216 10.216 0 1 1 10.216-10.216 10.241 10.241 0 0 1-10.216 10.216z" fill="#010101"/></svg>'
    },

    /**
     * define icon size
     */
    iconSize: {
      type: Number,
      default: 32
    },

    /**
     * define label for the locations-list
     */
    label: {
      type: String,
      default: 'Addresses'
    },

    /**
     * define locations<br>
     *   structure: [{<br>
     *     coordinates: [16.382782, 48.208309],<br>
     *     latLng: [48.208309, 16.382782],<br>
     *     data: [ 'University of Applied Arts', 'Oskar Kokoschka-Platz 2',
     *     '1010 Vienna', 'Austria']<br>
     *   }]<br><br>
     *   Note: either coordinates or latLng is mandatory
     */
    locations: {
      type: Array,
      default: function _default() {
        return [];
      },
      validator: function validator(data) {
        return data.filter(function (item) {
          return item.latLng || item.coordinates;
        }).length === data.length;
      }
    },

    /**
     * deactivate popups for marker
     */
    markerPopups: {
      type: Boolean,
      default: true
    },

    /**
     * define max zoom factor
     */
    maxZoom: {
      type: Number,
      default: 18
    },

    /**
     * define custom options for map data<br>
     *   e.g. {
     *          style: 'normal',
     *          subdomains: ['maps'],
     *          tileMatrixSet: 'google3857',
     *          type: 'geolandbasemap'
     *   }<br>
     *   usage custom keys in url property:
     *   https://{s}.wien.gv.at/basemap/{type}/{style}/{tileMatrixSet}/{z}/{y}/{x}.png
     */
    options: {
      type: Object,
      default: function _default() {
        return {};
      }
    },

    /**
     * define url to tileLayer service
     */
    url: {
      type: String,
      default: ''
    },

    /**
     * specify service for the [tileLayer](https://leafletjs.com/examples/wms/wms.html)<br>
     * valid values: 'WMTS' | 'TMS' | 'WMS'
     */
    tileLayerService: {
      type: String,
      default: 'WMTS',
      validator: function validator(val) {
        return ['WMTS', 'TMS', 'WMS'].includes(val);
      }
    },

    /**
     * define initial zoom factor
     */
    zoom: {
      type: Number,
      default: 16
    }
  },
  data: function data() {
    return {
      highlightedMarker: null,
      highlightedLocation: null,
      centeredMarker: null,
      initMap: false
    };
  },
  computed: {
    // Observer to check if component is in viewport and show baseMap
    observer: function observer() {
      var _this = this;

      return new IntersectionObserver(function (entries, observer) {
        entries.forEach(function (entry) {
          // If the entry is not in the viewport, do nothing
          if (!entry.isIntersecting) return; // Stop observing

          observer.unobserve(entry.target); // Init map

          _this.initMap = true;
        });
      });
    },
    // compare marker objects and remove duplicates
    locationsFiltered: function locationsFiltered() {
      return Array.from(new Set(this.locations.map(JSON.stringify))).map(JSON.parse);
    }
  },
  beforeDestroy: function beforeDestroy() {
    this.observer.disconnect();
  },
  mounted: function mounted() {
    // Execute only on clientside
    if (!process.browser) {
      return;
    } // Add observer to check if component is in viewport and init baseMap


    this.observer.observe(this.$el);
  },
  methods: {
    highlightLocation: function highlightLocation(value) {
      this.highlightedLocation = value;
    },
    resetMarker: function resetMarker() {
      this.highlightedMarker = null;
      this.centeredMarker = null;
    }
  }
};/* script */
var __vue_script__ = script;
/* template */

var __vue_render__ = function __vue_render__() {
  var _vm = this;

  var _h = _vm.$createElement;

  var _c = _vm._self._c || _h;

  return _c('div', {
    staticClass: "base-map-locations"
  }, [_vm._ssrNode("<div class=\"base-map-locations__map\"" + _vm._ssrStyle(null, _vm.additionalMapStyles, null) + " data-v-5fa70c92>", "</div>", [_vm.initMap ? _c('BaseMap', {
    style: _vm.additionalMapStyles,
    attrs: {
      "attribution": _vm.attribution,
      "attribution-position": _vm.attributionPosition,
      "cluster-sizes": _vm.clusterSizes,
      "copyright": _vm.copyright,
      "center-marker": _vm.centeredMarker,
      "icon": _vm.icon,
      "icon-size": _vm.iconSize,
      "highlight-marker": _vm.highlightedMarker,
      "marker": _vm.locationsFiltered,
      "marker-popups": _vm.markerPopups,
      "max-zoom": _vm.maxZoom,
      "options": _vm.options,
      "tile-layer-service": _vm.tileLayerService,
      "url": _vm.url,
      "zoom": _vm.zoom
    },
    on: {
      "highlighted": _vm.highlightLocation
    }
  }) : _vm._e()], 1), _vm._ssrNode(" " + (_vm.label ? "<h2 class=\"base-map-locations__label\" data-v-5fa70c92>" + _vm._ssrEscape("\n    " + _vm._s(_vm.label) + "\n  ") + "</h2>" : "<!---->") + " "), _vm._ssrNode("<div class=\"base-map-locations__list\" data-v-5fa70c92>", "</div>", [_vm._l(_vm.locationsFiltered, function (location, index) {
    return [location.latLng || location.coordinates ? _c('baseTextList', {
      key: index,
      class: ['base-map-locations__list__group', {
        'base-map-locations__list__group--highlight': index === _vm.highlightedLocation
      }],
      attrs: {
        "data": [location]
      },
      nativeOn: {
        "click": function click($event) {
          _vm.centeredMarker = index;
        },
        "mouseenter": function mouseenter($event) {
          _vm.highlightedMarker = index;
        },
        "mouseleave": function mouseleave($event) {
          return _vm.resetMarker.apply(null, arguments);
        }
      }
    }) : _vm._e()];
  })], 2)], 2);
};

var __vue_staticRenderFns__ = [];
/* style */

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = "data-v-5fa70c92";
/* module identifier */

var __vue_module_identifier__ = "data-v-5fa70c92";
/* functional template */

var __vue_is_functional_template__ = false;
/* style inject */

/* style inject SSR */

/* style inject shadow dom */

var __vue_component__ = /*#__PURE__*/normalizeComponent.n({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);

var BaseMapLocations = __vue_component__;var Plugin = {
  install: function install(Vue) {
    normalizeComponent.r(Vue, BaseMapLocations);
  }
};
normalizeComponent.u(Plugin);exports.BaseMapLocations=BaseMapLocations;exports["default"]=Plugin;