const require_chunk = require("./chunk-BN4qSVkS.cjs");
const require_styles_colors = require("./styles/colors.cjs");
const require_styles_themes = require("./styles/themes.cjs");
const require_styles_common = require("./styles/common.cjs");
const require_components_Icon_Icon = require("./components/Icon/Icon.cjs");
const require_styles_utils = require("./styles/utils.cjs");
let _emotion_styled = require("@emotion/styled");
_emotion_styled = require_chunk.__toESM(_emotion_styled);
let react = require("react");
let _emotion_react = require("@emotion/react");
let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
let _lightsparkdev_core = require("@lightsparkdev/core");
let qrcode_react = require("qrcode.react");
//#region src/static/images/LogoMark.svg?url
var LogoMark_default = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgdmlld0JveD0iMCAwIDIwNCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzM4MTlfMTE4MzUyKSI+CiAgPHBhdGggZD0iTTcuOTM4NSAxMTQuMjI5TDcxLjQ0ODMgNzIuOTg0OUgtMC4wMDA3MzI0MjJMMjcuNjcxIDU1LjAxNDdIOTEuMTc4N1YxMy43NzIxTDExMi4zODUgMC4wMDA2MjU2MVY0Ni40MDAzTDE2Mi42MjggMTMuNzcyTDE5NS42MjIgMTMuNzcyTDEzMi4xMTQgNTUuMDE0N0gyMDMuNTY3TDE3NS44OTUgNzIuOTg0OUgxMTIuMzg1VjExNC4yMjlMOTEuMTc4NyAxMjhWODEuNTk4Nkw0MC45MzI4IDExNC4yMjlINy45Mzg1WiIgZmlsbD0iY3VycmVudENvbG9yIi8+CiAgPC9nPgogIDxkZWZzPgogIDxjbGlwUGF0aCBpZD0iY2xpcDBfMzgxOV8xMTgzNTIiPgogIDxyZWN0IHdpZHRoPSIyMDMuNTY4IiBoZWlnaHQ9IjEyOCIgZmlsbD0id2hpdGUiLz4KICA8L2NsaXBQYXRoPgogIDwvZGVmcz4KPC9zdmc+Cg==";
//#endregion
//#region src/static/images/UmaLogoQRCode.svg?url
var UmaLogoQRCode_default = "data:image/svg+xml;base64, ";
//#endregion
//#region src/components/QRCode.tsx
function QRCode({ value, children, heading, border = true, isCentered = true, size = 256, kind = "lightspark", showLogo = true, animated = false, level = "L" }) {
	const isUma = kind === "uma";
	const logoSize = Math.round(size * .2);
	const umaLogoSize = Math.round(size * .2);
	const qrCodeProps = { marginSize: isUma ? 4 : 0 };
	if (isUma) {
		qrCodeProps.bgColor = require_styles_colors.colors.grayBlue10;
		qrCodeProps.fgColor = require_styles_colors.colors.white;
	}
	if (showLogo) qrCodeProps.imageSettings = {
		excavate: true,
		height: isUma ? (0, _lightsparkdev_core.round)(umaLogoSize * .8) : logoSize,
		src: isUma ? UmaLogoQRCode_default : LogoMark_default,
		width: isUma ? umaLogoSize : logoSize
	};
	return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(react.Fragment, { children: [
		heading && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(QRCodeLabel, { children: heading }),
		/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(QRCodeContainer, {
			isCentered,
			size,
			children: value ? /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(QRCodeImage, {
				isCentered,
				border,
				isUma,
				children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(qrcode_react.QRCodeSVG, {
					value,
					size,
					level,
					...qrCodeProps
				})
			}) : /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(EmptyQRCodeSizer, {
				size,
				isUma,
				children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(EmptyQRCode, {
					isCentered,
					border,
					animated,
					isUma,
					children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_components_Icon_Icon.Icon, {
						name: isUma ? "Uma" : "LogoMark",
						color: isUma ? "white" : void 0,
						width: isUma ? 42 : 45,
						ml: "auto",
						mr: "auto"
					})
				})
			})
		}),
		children
	] });
}
const borderWidth = 10;
const qr = ({ isCentered, border, isUma }) => _emotion_react.css`
  display: inline-block;
  overflow: hidden;
  ${border && `border: ${borderWidth}px solid #ffffff;`}
  ${border && `border-radius: 8px;`}
  ${border && "box-sizing: content-box;"}
  ${isUma && require_styles_common.standardBorderRadius(16)}
`;
const QRCodeContainer = _emotion_styled.default.div`
  display: flex;
  ${({ size }) => `width: ${size}px;`}
  max-width: 100%;

  ${({ isCentered }) => isCentered && `
      justify-content: center;
      align-items: center;
    `}
  font-size: 12px;
  svg {
    max-width: 100%;
    height: auto;
    display: block;
  }
`;
const QRCodeImage = _emotion_styled.default.div`
  ${qr}
`;
const shadowOffsetA = 2;
const tailRadiusA = 1.1;
const tailRadiusB = .5;
const shadowColor = require_styles_colors.colors.white;
const initialBoxShadow = `
  box-shadow: -${shadowOffsetA}px 0px ${tailRadiusA}px 1.5px ${shadowColor},
  0 0 4px ${tailRadiusB}px ${shadowColor};
`;
const opacityMax = 1;
const opacityMin = .05;
const scaleMin = 4;
const scaleMax = 33;
const startingLeftPer = 55;
const EmptyQRCodeSizer = _emotion_styled.default.div`
  width: ${({ size }) => size}px;
  max-width: 100%;
  position: relative;
  padding-top: 100%;
  ${({ isUma, theme }) => isUma && `background-color: ${require_styles_themes.getColor(theme, "grayBlue10")};
    ${require_styles_common.standardBorderRadius(16)}`}
`;
const EmptyQRCode = _emotion_styled.default.div`
  ${qr}
  border-color: ${({ theme }) => theme.c2Neutral};
  border-width: 1px;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  position: absolute;
  top: 0;
  left: 0;

  @keyframes circle {
    0% {
      top: 0%;
      left: ${startingLeftPer}%;
      box-shadow:
        0px -${shadowOffsetA}px 0px ${tailRadiusA / 2}px ${shadowColor},
        0 0 4px ${tailRadiusB}px ${shadowColor};
    }
    2% {
      top: 0%;
      left: 100%;
      box-shadow:
        0px -${shadowOffsetA}px 0px ${tailRadiusA / 2}px ${shadowColor},
        0 0 4px ${tailRadiusB}px ${shadowColor};
    }
    4% {
      top: 100%;
      left: 100%;
      box-shadow:
        0px -${shadowOffsetA}px 0px ${tailRadiusA / 2}px ${shadowColor},
        0 0 4px ${tailRadiusB}px ${shadowColor};
    }
    6% {
      top: 100%;
      left: 0%;
    }
    8% {
      top: 0%;
      left: 0%;
      box-shadow:
        0px ${shadowOffsetA}px 0px ${tailRadiusA / 2}px ${shadowColor},
        0 0 4px ${tailRadiusB}px ${shadowColor};
    }
    10% {
      top: 0;
      left: ${startingLeftPer - .001}%;
      ${initialBoxShadow};
    }
    100% {
      top: 0;
      left: ${startingLeftPer}%;
      ${initialBoxShadow};
    }
  }

  @keyframes pulse {
    0% {
      opacity: ${opacityMax};
      transform: scaleX(1);
    }
    10% {
      opacity: ${opacityMax * .3};
      transform: scaleX(1);
    }
    25% {
      opacity: ${opacityMin};
      transform: scaleX(${scaleMax / 3 * 1});
    }
    45% {
      opacity: ${opacityMin};
      transform: scaleX(${scaleMin});
    }
    72% {
      opacity: ${opacityMax / 3 * 1.3};
      transform: scaleX(${scaleMax / 4 * 2});
    }
    93% {
      opacity: ${opacityMin};
      transform: scaleX(${scaleMin});
    }
    100% {
      opacity: ${opacityMax};
      transform: scaleX(${scaleMax});
    }
  }

  ${({ animated }) => animated && `
    &:before {
      content: "";
      display: block;
      position: absolute;
      top: 0;
      left: ${startingLeftPer}%;
      transform: scaleX(1);
      transform-origin: 50% 0%;
      animation: circle 7s ease-out infinite,
        pulse 7s cubic-bezier(0.36, 0.11, 0.84, 0.52) infinite;
      ${initialBoxShadow}
    }
  `}

  & > * {
    ${require_styles_utils.absoluteCenter}
  }
`;
const QRCodeLabel = _emotion_styled.default.p`
  color: ${({ theme }) => theme.text};
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
`;
//#endregion
Object.defineProperty(exports, "QRCode", {
	enumerable: true,
	get: function() {
		return QRCode;
	}
});
Object.defineProperty(exports, "QRCodeLabel", {
	enumerable: true,
	get: function() {
		return QRCodeLabel;
	}
});
Object.defineProperty(exports, "qr", {
	enumerable: true,
	get: function() {
		return qr;
	}
});
