"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const React = require("react");
const emotionCache_browser_esm = require("../../../../../@emotion_cache@11.10.3/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js");
const emotionUtils_browser_esm = require("../../../../../@emotion_utils@1.2.0/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js");
const emotionSerialize_browser_esm = require("../../../../../@emotion_serialize@1.1.0/node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js");
const emotionUseInsertionEffectWithFallbacks_browser_esm = require("../../../../../@emotion_use-insertion-effect-with-fallbacks@1.0.0_react@18.2.0/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js");
var hasOwnProperty = {}.hasOwnProperty;
var EmotionCacheContext = /* @__PURE__ */ React.createContext(
  typeof HTMLElement !== "undefined" ? /* @__PURE__ */ emotionCache_browser_esm({
    key: "css"
  }) : null
);
if (process.env.NODE_ENV !== "production") {
  EmotionCacheContext.displayName = "EmotionCacheContext";
}
EmotionCacheContext.Provider;
var withEmotionCache = function withEmotionCache2(func) {
  return /* @__PURE__ */ React.forwardRef(function(props, ref) {
    var cache = React.useContext(EmotionCacheContext);
    return func(props, cache, ref);
  });
};
var ThemeContext = /* @__PURE__ */ React.createContext({});
if (process.env.NODE_ENV !== "production") {
  ThemeContext.displayName = "EmotionThemeContext";
}
var getLastPart = function getLastPart2(functionName) {
  var parts = functionName.split(".");
  return parts[parts.length - 1];
};
var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine2(line) {
  var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
  if (match)
    return getLastPart(match[1]);
  match = /^([A-Za-z0-9$.]+)@/.exec(line);
  if (match)
    return getLastPart(match[1]);
  return void 0;
};
var internalReactFunctionNames = /* @__PURE__ */ new Set(["renderWithHooks", "processChild", "finishClassComponent", "renderToString"]);
var sanitizeIdentifier = function sanitizeIdentifier2(identifier) {
  return identifier.replace(/\$/g, "-");
};
var getLabelFromStackTrace = function getLabelFromStackTrace2(stackTrace) {
  if (!stackTrace)
    return void 0;
  var lines = stackTrace.split("\n");
  for (var i = 0; i < lines.length; i++) {
    var functionName = getFunctionNameFromStackTraceLine(lines[i]);
    if (!functionName)
      continue;
    if (internalReactFunctionNames.has(functionName))
      break;
    if (/^[A-Z]/.test(functionName))
      return sanitizeIdentifier(functionName);
  }
  return void 0;
};
var typePropName = "__EMOTION_TYPE_PLEASE_DO_NOT_USE__";
var labelPropName = "__EMOTION_LABEL_PLEASE_DO_NOT_USE__";
var createEmotionProps = function createEmotionProps2(type, props) {
  if (process.env.NODE_ENV !== "production" && typeof props.css === "string" && props.css.indexOf(":") !== -1) {
    throw new Error("Strings are not allowed as css prop values, please wrap it in a css template literal from '@emotion/react' like this: css`" + props.css + "`");
  }
  var newProps = {};
  for (var key in props) {
    if (hasOwnProperty.call(props, key)) {
      newProps[key] = props[key];
    }
  }
  newProps[typePropName] = type;
  if (process.env.NODE_ENV !== "production" && !!props.css && (typeof props.css !== "object" || typeof props.css.name !== "string" || props.css.name.indexOf("-") === -1)) {
    var label = getLabelFromStackTrace(new Error().stack);
    if (label)
      newProps[labelPropName] = label;
  }
  return newProps;
};
var Insertion = function Insertion2(_ref) {
  var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag;
  emotionUtils_browser_esm.registerStyles(cache, serialized, isStringTag);
  emotionUseInsertionEffectWithFallbacks_browser_esm.useInsertionEffectAlwaysWithSyncFallback(function() {
    return emotionUtils_browser_esm.insertStyles(cache, serialized, isStringTag);
  });
  return null;
};
var Emotion = /* @__PURE__ */ withEmotionCache(function(props, cache, ref) {
  var cssProp = props.css;
  if (typeof cssProp === "string" && cache.registered[cssProp] !== void 0) {
    cssProp = cache.registered[cssProp];
  }
  var WrappedComponent = props[typePropName];
  var registeredStyles = [cssProp];
  var className = "";
  if (typeof props.className === "string") {
    className = emotionUtils_browser_esm.getRegisteredStyles(cache.registered, registeredStyles, props.className);
  } else if (props.className != null) {
    className = props.className + " ";
  }
  var serialized = emotionSerialize_browser_esm.serializeStyles(registeredStyles, void 0, React.useContext(ThemeContext));
  if (process.env.NODE_ENV !== "production" && serialized.name.indexOf("-") === -1) {
    var labelFromStack = props[labelPropName];
    if (labelFromStack) {
      serialized = emotionSerialize_browser_esm.serializeStyles([serialized, "label:" + labelFromStack + ";"]);
    }
  }
  className += cache.key + "-" + serialized.name;
  var newProps = {};
  for (var key in props) {
    if (hasOwnProperty.call(props, key) && key !== "css" && key !== typePropName && (process.env.NODE_ENV === "production" || key !== labelPropName)) {
      newProps[key] = props[key];
    }
  }
  newProps.ref = ref;
  newProps.className = className;
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Insertion, {
    cache,
    serialized,
    isStringTag: typeof WrappedComponent === "string"
  }), /* @__PURE__ */ React.createElement(WrappedComponent, newProps));
});
if (process.env.NODE_ENV !== "production") {
  Emotion.displayName = "EmotionCssPropInternal";
}
exports.E = Emotion;
exports.T = ThemeContext;
exports.c = createEmotionProps;
exports.h = hasOwnProperty;
exports.w = withEmotionCache;
//# sourceMappingURL=emotion-element-6a883da9.browser.esm.js.map
