"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }

var _chunkCDFVRIETcjs = require('./chunk-CDFVRIET.cjs');


var _chunkZ6EUSUADcjs = require('./chunk-Z6EUSUAD.cjs');

// src/utils/NextLink.tsx




var _react = require('react');
var _jsxruntime = require('@emotion/react/jsx-runtime');
function NextLink({
  href,
  text,
  children,
  id,
  target: targetProp,
  typography
}) {
  const NextLinkRef = _react.useRef.call(void 0, null);
  const [ready, setReady] = _react.useState.call(void 0, false);
  const isExternal = href.startsWith("http");
  const target = targetProp ? targetProp : isExternal ? "_blank" : void 0;
  _react.useEffect.call(void 0, () => {
    void (() => _chunkZ6EUSUADcjs.__async.call(void 0, this, null, function* () {
      try {
        const nextLinkModule = yield Promise.resolve().then(() => _interopRequireWildcard(require("next/link.js")));
        NextLinkRef.current = nextLinkModule.default;
      } catch (e) {
      }
      setReady(true);
    }))();
  });
  const InternalNextLink = NextLinkRef.current;
  let content = children;
  if (text) {
    content = typography ? _chunkCDFVRIETcjs.renderTypography.call(void 0, typography.type, {
      size: typography.size,
      color: typography.color,
      children: text
    }) : text;
  }
  if (!ready || !InternalNextLink) {
    return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", { href, target, id, children: content });
  }
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InternalNextLink, { href, target, id, children: content });
}



exports.NextLink = NextLink;
