Liferay.Loader.define("layout-template-admin-web@1.0.75/js/ActionsComponentPropsTransformer", ['module', 'exports', 'require', 'frontend-js-web'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = propsTransformer;

    var _frontendJsWeb = require("frontend-js-web");

    function ownKeys(object, enumerableOnly) {
      var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {
          return Object.getOwnPropertyDescriptor(object, sym).enumerable;
        });keys.push.apply(keys, symbols);
      }return keys;
    }

    function _objectSpread(target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {
          ownKeys(Object(source), true).forEach(function (key) {
            _defineProperty(target, key, source[key]);
          });
        } else if (Object.getOwnPropertyDescriptors) {
          Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
        } else {
          ownKeys(Object(source)).forEach(function (key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
          });
        }
      }return target;
    }

    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    function _objectWithoutProperties(source, excluded) {
      if (source == null) return {};var target = _objectWithoutPropertiesLoose(source, excluded);var key, i;if (Object.getOwnPropertySymbols) {
        var sourceSymbolKeys = Object.getOwnPropertySymbols(source);for (i = 0; i < sourceSymbolKeys.length; i++) {
          key = sourceSymbolKeys[i];if (excluded.indexOf(key) >= 0) continue;if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;target[key] = source[key];
        }
      }return target;
    }

    function _objectWithoutPropertiesLoose(source, excluded) {
      if (source == null) return {};var target = {};var sourceKeys = Object.keys(source);var key, i;for (i = 0; i < sourceKeys.length; i++) {
        key = sourceKeys[i];if (excluded.indexOf(key) >= 0) continue;target[key] = source[key];
      }return target;
    }

    var ACTIONS = {
      deleteCollections: function deleteCollections(_ref) {
        var deleteLayoutPageTemplateCollectionURL = _ref.deleteLayoutPageTemplateCollectionURL,
            portletNamespace = _ref.portletNamespace,
            viewLayoutPageTemplateCollectionURL = _ref.viewLayoutPageTemplateCollectionURL;
        var layoutPageTemplateCollectionsForm = document.createElement('form');
        layoutPageTemplateCollectionsForm.setAttribute('method', 'post');
        (0, _frontendJsWeb.openSelectionModal)({
          buttonAddLabel: Liferay.Language.get('delete'),
          multiple: true,
          onSelect: function onSelect(selectedItems) {
            if (selectedItems) {
              if (confirm(Liferay.Language.get('are-you-sure-you-want-to-delete-the-selected-entries'))) {
                selectedItems.forEach(function (item) {
                  layoutPageTemplateCollectionsForm.appendChild(item.cloneNode(true));
                });
                submitForm(layoutPageTemplateCollectionsForm, deleteLayoutPageTemplateCollectionURL);
              }
            }
          },
          selectEventName: "".concat(portletNamespace, "selectCollections"),
          title: Liferay.Language.get('delete-collection'),
          url: viewLayoutPageTemplateCollectionURL
        });
      }
    };

    function propsTransformer(_ref2) {
      var deleteLayoutPageTemplateCollectionURL = _ref2.deleteLayoutPageTemplateCollectionURL,
          items = _ref2.items,
          portletNamespace = _ref2.portletNamespace,
          viewLayoutPageTemplateCollectionURL = _ref2.viewLayoutPageTemplateCollectionURL,
          otherProps = _objectWithoutProperties(_ref2, ["deleteLayoutPageTemplateCollectionURL", "items", "portletNamespace", "viewLayoutPageTemplateCollectionURL"]);

      return _objectSpread(_objectSpread({}, otherProps), {}, {
        items: items.map(function (item) {
          return _objectSpread(_objectSpread({}, item), {}, {
            onClick: function onClick(event) {
              var _item$data;

              var action = (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.action;

              if (action) {
                event.preventDefault();
                ACTIONS[action]({
                  deleteLayoutPageTemplateCollectionURL: deleteLayoutPageTemplateCollectionURL,
                  portletNamespace: portletNamespace,
                  viewLayoutPageTemplateCollectionURL: viewLayoutPageTemplateCollectionURL
                });
              }
            }
          });
        })
      });
    }
    //# sourceMappingURL=ActionsComponentPropsTransformer.js.map
  }
});
//# sourceMappingURL=ActionsComponentPropsTransformer.js.map