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

    var _InfoItemService = _interopRequireDefault(require("../services/InfoItemService"));

    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
     */
    function loadBackgroundImage(backgroundImage) {
      if (!backgroundImage) {
        return Promise.resolve('');
      } else if (typeof backgroundImage.url === 'string') {
        return Promise.resolve(backgroundImage.url);
      } else if (backgroundImage.fieldId) {
        return _InfoItemService.default.getInfoItemFieldValue({
          classNameId: backgroundImage.classNameId,
          classPK: backgroundImage.classPK,
          fieldId: backgroundImage.fieldId,
          onNetworkStatus: function onNetworkStatus() {}
        }).then(function (response) {
          if (response.fieldValue && response.fieldValue.url) {
            return response.fieldValue.url;
          }

          return '';
        });
      }

      return Promise.resolve('');
    }
    //# sourceMappingURL=loadBackgroundImage.js.map
  }
});
//# sourceMappingURL=loadBackgroundImage.js.map