'use strict';var _typeof=require('./typeof-6b9e62b8.js');require('./es.array.concat-cf822c2c.js');var unsupportedIterableToArray=require('./unsupportedIterableToArray-40a00645.js');require('./es.object.to-string-6eda7e05.js'),require('./es.array.includes-cbacb659.js'),require('./es.string.includes-fd50111e.js'),require('./es.object.keys-258d7358.js');var i18n=require('./i18n-2a279d89.js'),normalizeComponent=require('./normalize-component-a3a558e7.js');function _createForOfIteratorHelper(o, allowArrayLike) {
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];

  if (!it) {
    if (Array.isArray(o) || (it = unsupportedIterableToArray._(o)) || allowArrayLike && o && typeof o.length === "number") {
      if (it) o = it;
      var i = 0;

      var F = function F() {};

      return {
        s: F,
        n: function n() {
          if (i >= o.length) return {
            done: true
          };
          return {
            done: false,
            value: o[i++]
          };
        },
        e: function e(_e) {
          throw _e;
        },
        f: F
      };
    }

    throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }

  var normalCompletion = true,
      didErr = false,
      err;
  return {
    s: function s() {
      it = it.call(o);
    },
    n: function n() {
      var step = it.next();
      normalCompletion = step.done;
      return step;
    },
    e: function e(_e2) {
      didErr = true;
      err = _e2;
    },
    f: function f() {
      try {
        if (!normalCompletion && it["return"] != null) it["return"]();
      } finally {
        if (didErr) throw err;
      }
    }
  };
}/**
 * Component to render data in p | ul | dt tags depending on field type 'data'
 */

var script = {
  name: 'BaseTextList',
  components: {
    BaseLink: function BaseLink() {
      return Promise.resolve().then(function(){return require('./BaseLink-57b9cd89.js')}).then(function (m) {
        return m.default || m;
      });
    }
  },
  mixins: [i18n.i],
  props: {
    /**
     * data structure for different rendered tags: <br>
     * p: { label: 'String|Object', data: 'String' } <br>
     * ul: { label: 'String|Object, data: ['String']}} <br>
     * dt: {<br>
     *  label: 'String|Object,<br>
     *  data: [{
     *    label: 'String|Object',
     *    value: 'String',
     *    url: 'String',
     *    additional: 'Object' }]}} or<br>
     * dt: {<br>
     *  label: 'String|Object,<br>
     *  data: {
     *    label: 'String|Object',
     *    value: 'String',
     *    url: 'String'
     *    additional: 'Object'}}}<br><br>
     *
     * label might be a string or a language object with ISO 639-1 as object properties
     *  (e.g. { en: 'x', de: 'y' })<br>
     *  additional property creates a tooltip and takes an object in the same format as
     *    data: label, value and url<br>
     * Note: for dt property 'url' will render 'value' as a link<br>
     */
    data: {
      type: Array,
      default: function _default() {
        return [];
      }
    },

    /**
     * render component as e.g.: 'h2' | 'h3'
     */
    renderLabelAs: {
      type: String,
      default: 'div'
    },

    /**
     * set margin-bottom for the label
     */
    labelMarginBottom: {
      type: Boolean,
      default: false
    },

    /**
     * render content in two columns
     */
    cols2: {
      type: Boolean,
      default: false
    },

    /**
     * set box height to auto
     */
    autoHeight: {
      type: Boolean,
      default: false
    },

    /**
     * specify how link element should be rendered - this needs to be a
     * valid vue link component (e.g. router-link, nuxt-link) and vue-router
     * is necessary
     */
    renderLinkAs: {
      type: String,
      default: 'router-link'
    },

    /**
     * specify how data-list (label, value) should be rendered:
     */
    listType: {
      type: String,
      default: 'horizontal',
      validate: function validate(val) {
        return ['horizontal', 'vertical'].includes(val);
      }
    }
  },
  methods: {
    /**
     * check if all array objects have a key label
     *
     * @param {array} data
     * @param {string} key
     * @returns {boolean}
     */
    containKeys: function containKeys(data, key) {
      // eslint-disable-next-line
      var _iterator = _createForOfIteratorHelper(data),
          _step;

      try {
        for (_iterator.s(); !(_step = _iterator.n()).done;) {
          var obj = _step.value;

          if (!Object.keys(obj).includes(key)) {
            return false;
          }
        }
      } catch (err) {
        _iterator.e(err);
      } finally {
        _iterator.f();
      }

      return true;
    }
  }
};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', {
    class: ['base-text-list', {
      'base-text-list-2-cols': _vm.cols2,
      'base-text-list-2-cols-single-content': _vm.cols2 && _vm.data.length === 1 && typeof _vm.data[0].data === 'string'
    }]
  }, _vm._l(_vm.data, function (item, index) {
    return _vm._ssrNode("<div class=\"base-text-list-group\" data-v-24ecdcec>", "</div>", [item.label ? _c(_vm.renderLabelAs, {
      tag: "component",
      class: ['base-text-list-label', {
        'base-text-list-label-mb': _vm.labelMarginBottom
      }]
    }, [_vm._v("\n      " + _vm._s(_vm.getLangLabel(item.label)) + "\n    ")]) : _vm._e(), _vm._ssrNode(" "), typeof item.data === 'string' ? _vm._ssrNode("<p" + _vm._ssrClass(null, ['base-text-list-content', 'base-text-list-content-pre-line', {
      'base-text-list-2-cols': _vm.data.length === 1
    }]) + " data-v-24ecdcec>", "</p>", [_vm._ssrNode(_vm._ssrEscape(_vm._s(item.data)))], 2) : _typeof._(item.data) === 'object' && typeof item.data[0] === 'string' ? _vm._ssrNode("<ul class=\"base-text-list-content\" data-v-24ecdcec>" + _vm._ssrList(item.data, function (arrayItem, listIndex) {
      return "<li data-v-24ecdcec>" + _vm._ssrEscape("\n        " + _vm._s(arrayItem) + "\n      ") + "</li>";
    }) + "</ul>") : _typeof._(item.data) === 'object' ? [!_vm.containKeys([].concat(item.data), 'label') ? [_vm._ssrNode("<div class=\"base-text-list-content\" data-v-24ecdcec>", "</div>", [_vm._l([].concat(item.data), function (objectItem, objectIndex) {
      return [_c('BaseLink', {
        key: objectIndex,
        attrs: {
          "source": objectItem.source,
          "tooltip": objectItem.additional,
          "type": objectItem.type,
          "url": objectItem.url,
          "value": objectItem.value
        },
        scopedSlots: _vm._u([{
          key: "tooltip",
          fn: function fn() {
            return [_vm._t("tooltip", null, {
              "data": objectItem.additional
            })];
          },
          proxy: true
        }], null, true)
      }), _vm._ssrNode(_vm._ssrEscape(_vm._s(item.data.length && objectIndex !== item.data.length - 1 ? ', ' : '') + "\n            "))];
    })], 2)] : _vm._e(), _vm._ssrNode(" "), _vm.containKeys([].concat(item.data), 'label') ? [_typeof._(item.data) === 'object' ? _vm._ssrNode("<dl" + _vm._ssrClass(null, ['base-text-list-content', 'base-text-list-content--' + _vm.listType]) + " data-v-24ecdcec>", "</dl>", [_vm._l([].concat(item.data), function (objectItem, objectIndex) {
      return [_vm._ssrNode("<dt class=\"base-text-list__content__label\" data-v-24ecdcec>" + (objectItem.label ? _vm._ssrEscape("\n                " + _vm._s(_vm.getLangLabel(objectItem.label)) + ":\n              ") : "<!---->") + "</dt> "), _vm._ssrNode("<dd class=\"base-text-list__content__label base-text-list__content__value\" data-v-24ecdcec>", "</dd>", [_c('BaseLink', {
        attrs: {
          "render-link-as": _vm.renderLinkAs,
          "source": objectItem.source,
          "tooltip": objectItem.additional,
          "type": objectItem.type,
          "url": objectItem.url,
          "value": objectItem.value
        }
      }, [_vm._t("tooltip")], 2)], 1)];
    })], 2) : _vm._e()] : _vm._e()] : _vm._e()], 2);
  }), 0);
};

var __vue_staticRenderFns__ = [];
/* style */

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = "data-v-24ecdcec";
/* module identifier */

var __vue_module_identifier__ = "data-v-24ecdcec";
/* 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 BaseTextList = __vue_component__;exports.B=BaseTextList;