import React, { useState, useEffect } from 'react';
import { initLearnCard } from '@learncard/init';
import { V as VCDisplayCard } from './VCDisplayCard-fb1b7706.js';
import { V as VCDisplayCard2 } from './VCDisplayCard2-325d6536.js';

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] = useState(true);
  const [vcVerification, setVCVerification] = useState([]);
  useEffect(() => {
    const verify = () => __async(null, null, function* () {
      const wallet = yield initLearnCard();
      const verification = yield wallet.invoke.verifyCredential(credential, {}, true);
      setVCVerification(verification);
      setLoading(false);
    });
    verify();
  }, [credential]);
  if (version === "1") {
    return /* @__PURE__ */ React.createElement(
      VCDisplayCard,
      {
        credential,
        issueeOverride,
        className,
        loading,
        verification: vcVerification
      }
    );
  }
  return /* @__PURE__ */ React.createElement(
    VCDisplayCard2,
    {
      credential,
      issueeOverride,
      verificationInProgress: loading,
      verificationItems: vcVerification,
      subjectImageComponent,
      handleXClick,
      getFileMetadata,
      getVideoMetadata,
      onMediaAttachmentClick,
      bottomRightIcon
    }
  );
};

export { VCCard as V };
//# sourceMappingURL=VCCard-e89d7a98.js.map
