Liferay.Loader.define("frontend-js-web@4.0.60/liferay/portlet/register.es", ['module', 'exports', 'require', './PortletInit.es', './portlet_util.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = exports.register = void 0;

    var _PortletInit = _interopRequireDefault(require("./PortletInit.es"));

    var _portlet_util = require("./portlet_util.es");

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    /**
     * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
     * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
     */

    /**
     * Registers a portlet client with the portlet hub.
     * @param {string} portletId The unique portlet identifier
     * @return {Promise} A Promise object. Returns an {@link PortletInit} object
     * containing functions for use by the portlet client on successful resolution.
     * Returns an Error object containing a descriptive message on failure.
     * @review
     */
    var register = function register(portletId) {
      (0, _portlet_util.validateArguments)(arguments, 1, 1, ['string']);
      var pageRenderState = global.portlet.data.pageRenderState;
      return new Promise(function (resolve, reject) {
        if ((0, _portlet_util.validatePortletId)(pageRenderState, portletId)) {
          resolve(new _PortletInit.default(portletId));
        } else {
          reject(new Error('Invalid portlet ID'));
        }
      });
    };

    exports.register = register;
    var _default = register;
    exports.default = _default;
    //# sourceMappingURL=register.es.js.map
  }
});
//# sourceMappingURL=register.es.js.map