import _extends from "@babel/runtime-corejs3/helpers/extends";
import React from "react";
import { SvgRenderer } from "./SvgRenderer";
import { jsx as ___EmotionJSX } from "@emotion/react";
const mapV2toV4 = document => {
  var _document$issuers$0$i, _document$issuers$0$i2;
  const clonedDocument = {
    ...document
  };
  const propsToOmit = ["$template", "id", "issuers", "network", "renderMethod", "attachments"];
  propsToOmit.forEach(v2Property => delete clonedDocument[v2Property]);
  return {
    "@context": ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/alpha-context.json"],
    type: ["VerifiableCredential", "OpenAttestationCredential"],
    issuer: {
      id: document.issuers[0].id || "issuers[0].id not found",
      identityProof: {
        identifier: ((_document$issuers$0$i = document.issuers[0].identityProof) === null || _document$issuers$0$i === void 0 ? void 0 : _document$issuers$0$i.location) || "issuers[0].identityProof.location not found",
        identityProofType: ((_document$issuers$0$i2 = document.issuers[0].identityProof) === null || _document$issuers$0$i2 === void 0 ? void 0 : _document$issuers$0$i2.type) || "DNS-DID"
      },
      name: document.issuers[0].name,
      type: "OpenAttestationIssuer"
    },
    renderMethod: document.renderMethod,
    credentialSubject: clonedDocument // Need to cast due to mismatch in "attachments" typing
  };
};
const __unsafe__not__for__production__v2__SvgRenderer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
  let {
    document,
    ...rest
  } = _ref;
  const remappedDocument = mapV2toV4(document);
  return ___EmotionJSX(SvgRenderer, _extends({}, rest, {
    document: remappedDocument,
    ref: ref
  }));
});
__unsafe__not__for__production__v2__SvgRenderer.displayName = "SvgRendererAdapterComponent";
export { __unsafe__not__for__production__v2__SvgRenderer };
//# sourceMappingURL=SvgV2Adapter.js.map