'use strict';

var React = require('react');
var init = require('@learncard/init');
var VCDisplayCard = require('./VCDisplayCard-3346d2f9.js');
var VCDisplayCard2 = require('./VCDisplayCard2-d713808f.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

var __async = (__this, __arguments, generator) => {
  return new Promise((resolve, reject) => {
    var fulfilled = (value) => {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    };
    var rejected = (value) => {
      try {
        step(generator.throw(value));
      } catch (e) {
        reject(e);
      }
    };
    var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
    step((generator = generator.apply(__this, __arguments)).next());
  });
};
const VCCard = ({
  credential,
  issueeOverride,
  className = "",
  version = "1",
  subjectImageComponent,
  // convertTagsToSkills,
  handleXClick,
  getFileMetadata,
  getVideoMetadata,
  onMediaAttachmentClick,
  bottomRightIcon
}) => {
  const [loading, setLoading] = React.useState(true);
  const [vcVerification, setVCVerification] = React.useState([]);
  React.useEffect(() => {
    const verify = () => __async(null, null, function* () {
      const wallet = yield init.initLearnCard();
      const verification = yield wallet.invoke.verifyCredential(credential, {}, true);
      setVCVerification(verification);
      setLoading(false);
    });
    verify();
  }, [credential]);
  if (version === "1") {
    return /* @__PURE__ */ React__default["default"].createElement(
      VCDisplayCard.VCDisplayCard,
      {
        credential,
        issueeOverride,
        className,
        loading,
        verification: vcVerification
      }
    );
  }
  return /* @__PURE__ */ React__default["default"].createElement(
    VCDisplayCard2.VCDisplayCard2,
    {
      credential,
      issueeOverride,
      verificationInProgress: loading,
      verificationItems: vcVerification,
      subjectImageComponent,
      handleXClick,
      getFileMetadata,
      getVideoMetadata,
      onMediaAttachmentClick,
      bottomRightIcon
    }
  );
};

exports.VCCard = VCCard;
//# sourceMappingURL=VCCard-7473b581.js.map
