Liferay.Loader.define("layout-content-page-editor-web@2.0.102/page_editor/app/utils/getLayoutDataItemLabel", ['module', 'exports', 'require', '../config/constants/layoutDataItemTypeLabels', '../config/constants/layoutDataItemTypes'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = getLayoutDataItemLabel;

    var _layoutDataItemTypeLabels = require("../config/constants/layoutDataItemTypeLabels");

    var _layoutDataItemTypes = require("../config/constants/layoutDataItemTypes");

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * This library is free software; you can redistribute it and/or modify it under
     * the terms of the GNU Lesser General Public License as published by the Free
     * Software Foundation; either version 2.1 of the License, or (at your option)
     * any later version.
     *
     * This library is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
     * details.
     */
    function getLayoutDataItemLabel(item, fragmentEntryLinks) {
      if (item.type === _layoutDataItemTypes.LAYOUT_DATA_ITEM_TYPES.fragment && item.config && item.config.fragmentEntryLinkId && fragmentEntryLinks[item.config.fragmentEntryLinkId]) {
        return fragmentEntryLinks[item.config.fragmentEntryLinkId].name;
      }

      var itemTypeKey = Object.keys(_layoutDataItemTypes.LAYOUT_DATA_ITEM_TYPES).find(function (key) {
        return _layoutDataItemTypes.LAYOUT_DATA_ITEM_TYPES[key] === item.type;
      });

      if (itemTypeKey in _layoutDataItemTypeLabels.LAYOUT_DATA_ITEM_TYPE_LABELS) {
        return _layoutDataItemTypeLabels.LAYOUT_DATA_ITEM_TYPE_LABELS[itemTypeKey];
      }

      return item.type;
    }
    //# sourceMappingURL=getLayoutDataItemLabel.js.map
  }
});
//# sourceMappingURL=getLayoutDataItemLabel.js.map