"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isPlaceholderConfig = isPlaceholderConfig;
exports.usePlaceholderConfig = void 0;
var _vue = require("vue");
var _is = require("../../_util/is");
var _propsUtil = require("../../_util/props-util");
function isPlaceholderConfig(placeholder) {
  return (0, _is.isPlainObject)(placeholder) && !(0, _propsUtil.isValidElement)(placeholder);
}
const usePlaceholderConfig = placeholder => {
  const placeholderConfig = (0, _vue.computed)(() => {
    if (!placeholder.value || !isPlaceholderConfig(placeholder.value)) {
      return {};
    }
    if (typeof placeholder.value.progress === 'boolean') {
      return {
        progressConfig: placeholder.value.progress ? {} : undefined
      };
    }
    return {
      progressConfig: placeholder.value.progress
    };
  });
  const showProgressOverlay = (0, _vue.computed)(() => placeholderConfig.value.progressConfig !== undefined);
  const placeholderNode = (0, _vue.computed)(() => isPlaceholderConfig(placeholder.value) ? undefined : placeholder.value);
  return {
    placeholderConfig,
    showProgressOverlay,
    placeholderNode
  };
};
exports.usePlaceholderConfig = usePlaceholderConfig;