import { P as e, M as le, _ as S, s as W, r as X, H as j, t as ue, v as de, J as x, l as fe, b as pe, c as me, g as ve, C as he, B as be } from "./PrizeCard-C2El3VOB.js";
import { jsx as y, jsxs as q } from "react/jsx-runtime";
import ke from "react-dom";
import { C as ge } from "./CheckCircle-DSloUas8.js";
import * as l from "react";
import { d as ye, p as Se, w as P, o as Ce, f as N, s as A, r as Ee, t as De, v as xe, u as Re, a as M, c as Oe, T as $ } from "./Button-DPGn5NZd.js";
import { a as H } from "./useEventCallback-Dqgs56Ox.js";
import { e as Te } from "./ModalDialog-CmE2hP2R.js";
function I(o) {
  return o.substring(2).toLowerCase();
}
function ze(o, n) {
  return n.documentElement.clientWidth < o.clientX || n.documentElement.clientHeight < o.clientY;
}
function R(o) {
  const {
    children: n,
    disableReactTree: f = !1,
    mouseEvent: r = "onClick",
    onClickAway: c,
    touchEvent: i = "onTouchEnd"
  } = o, v = l.useRef(!1), p = l.useRef(null), h = l.useRef(!1), g = l.useRef(!1);
  l.useEffect(() => (setTimeout(() => {
    h.current = !0;
  }, 0), () => {
    h.current = !1;
  }), []);
  const b = ye(Se(n), p), u = H((s) => {
    const d = g.current;
    g.current = !1;
    const k = P(p.current);
    if (!h.current || !p.current || "clientX" in s && ze(s, k))
      return;
    if (v.current) {
      v.current = !1;
      return;
    }
    let t;
    s.composedPath ? t = s.composedPath().indexOf(p.current) > -1 : t = !k.documentElement.contains(
      // @ts-expect-error returns `false` as intended when not dispatched from a Node
      s.target
    ) || p.current.contains(
      // @ts-expect-error returns `false` as intended when not dispatched from a Node
      s.target
    ), !t && (f || !d) && c(s);
  }), C = (s) => (d) => {
    g.current = !0;
    const k = n.props[s];
    k && k(d);
  }, E = {
    ref: b
  };
  return i !== !1 && (E[i] = C(i)), l.useEffect(() => {
    if (i !== !1) {
      const s = I(i), d = P(p.current), k = () => {
        v.current = !0;
      };
      return d.addEventListener(s, u), d.addEventListener("touchmove", k), () => {
        d.removeEventListener(s, u), d.removeEventListener("touchmove", k);
      };
    }
  }, [u, i]), r !== !1 && (E[r] = C(r)), l.useEffect(() => {
    if (r !== !1) {
      const s = I(r), d = P(p.current);
      return d.addEventListener(s, u), () => {
        d.removeEventListener(s, u);
      };
    }
  }, [u, r]), /* @__PURE__ */ y(l.Fragment, {
    children: /* @__PURE__ */ l.cloneElement(n, E)
  });
}
process.env.NODE_ENV !== "production" && (R.propTypes = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * The wrapped element.
   */
  children: Te.isRequired,
  /**
   * If `true`, the React tree is ignored and only the DOM tree is considered.
   * This prop changes how portaled elements are handled.
   * @default false
   */
  disableReactTree: e.bool,
  /**
   * The mouse event to listen to. You can disable the listener by providing `false`.
   * @default 'onClick'
   */
  mouseEvent: e.oneOf(["onClick", "onMouseDown", "onMouseUp", "onPointerDown", "onPointerUp", !1]),
  /**
   * Callback fired when a "click away" event is detected.
   */
  onClickAway: e.func.isRequired,
  /**
   * The touch event to listen to. You can disable the listener by providing `false`.
   * @default 'onTouchEnd'
   */
  touchEvent: e.oneOf(["onTouchEnd", "onTouchStart", !1])
});
process.env.NODE_ENV !== "production" && (R.propTypes = le(R.propTypes));
function we(o = {}) {
  const {
    autoHideDuration: n = null,
    disableWindowBlurListener: f = !1,
    onClose: r,
    open: c,
    resumeHideDuration: i
  } = o, v = Ce();
  l.useEffect(() => {
    if (!c)
      return;
    function t(a) {
      a.defaultPrevented || (a.key === "Escape" || a.key === "Esc") && (r == null || r(a, "escapeKeyDown"));
    }
    return document.addEventListener("keydown", t), () => {
      document.removeEventListener("keydown", t);
    };
  }, [c, r]);
  const p = H((t, a) => {
    r == null || r(t, a);
  }), h = H((t) => {
    !r || t == null || v.start(t, () => {
      p(null, "timeout");
    });
  });
  l.useEffect(() => (c && h(n), v.clear), [c, n, h, v]);
  const g = (t) => {
    r == null || r(t, "clickaway");
  }, b = v.clear, u = l.useCallback(() => {
    n != null && h(i ?? n * 0.5);
  }, [n, i, h]), C = (t) => (a) => {
    const m = t.onBlur;
    m == null || m(a), u();
  }, E = (t) => (a) => {
    const m = t.onFocus;
    m == null || m(a), b();
  }, s = (t) => (a) => {
    const m = t.onMouseEnter;
    m == null || m(a), b();
  }, d = (t) => (a) => {
    const m = t.onMouseLeave;
    m == null || m(a), u();
  };
  return l.useEffect(() => {
    if (!f && c)
      return window.addEventListener("focus", u), window.addEventListener("blur", b), () => {
        window.removeEventListener("focus", u), window.removeEventListener("blur", b);
      };
  }, [f, c, u, b]), {
    getRootProps: (t = {}) => {
      const a = S({}, N(o), N(t));
      return S({
        // ClickAwayListener adds an `onClick` prop which results in the alert not being announced.
        // See https://github.com/mui/material-ui/issues/29080
        role: "presentation"
      }, t, a, {
        onBlur: C(a),
        onFocus: E(a),
        onMouseEnter: s(a),
        onMouseLeave: d(a)
      });
    },
    onClickAway: g
  };
}
function Ve(o) {
  return W("MuiDivider", o);
}
const Ye = X("MuiDivider", ["root", "horizontal", "vertical", "insetContext", "insetNone"]);
function Le(o) {
  return W("MuiSnackbar", o);
}
X("MuiSnackbar", ["root", "anchorOriginTopCenter", "anchorOriginBottomCenter", "anchorOriginTopRight", "anchorOriginBottomRight", "anchorOriginTopLeft", "anchorOriginBottomLeft", "colorPrimary", "colorDanger", "colorNeutral", "colorSuccess", "colorWarning", "endDecorator", "sizeSm", "sizeMd", "sizeLg", "startDecorator", "variantPlain", "variantOutlined", "variantSoft", "variantSolid"]);
const Pe = ["anchorOrigin", "animationDuration", "autoHideDuration", "color", "children", "className", "component", "disableWindowBlurListener", "endDecorator", "invertedColors", "onBlur", "onClose", "onFocus", "onMouseEnter", "onMouseLeave", "onUnmount", "open", "resumeHideDuration", "size", "slots", "slotProps", "startDecorator", "variant"];
let J = (o) => o, F, U;
const Me = (o) => {
  const {
    variant: n,
    color: f,
    size: r,
    anchorOrigin: c
  } = o, i = {
    root: ["root", r && `size${x(r)}`, f && `color${x(f)}`, n && `variant${x(n)}`, `anchorOrigin${x(c.vertical)}${x(c.horizontal)}`],
    startDecorator: ["startDecorator"],
    endDecorator: ["endDecorator"]
  };
  return Oe(i, Le, {});
}, He = j(F || (F = J`
  0% {
    transform: translateX(var(--Snackbar-translateX, 0px)) translateY(calc(var(--_Snackbar-anchorBottom, 1) * 100%));
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateX(var(--Snackbar-translateX, 0px)) translateY(0);
  }
`)), Ae = j(U || (U = J`
  0% {
    transform: translateX(var(--Snackbar-translateX, 0px)) translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateX(var(--Snackbar-translateX, 0px)) translateY(calc(var(--_Snackbar-anchorBottom, 1) * 100%));
    opacity: 0;
  }
`)), _e = A("div", {
  name: "JoySnackbar",
  slot: "Root",
  overridesResolver: (o, n) => n.root
})(({
  theme: o,
  ownerState: n
}) => {
  var f, r, c, i, v, p, h;
  const {
    p: g,
    padding: b,
    borderRadius: u
  } = Ee({
    theme: o,
    ownerState: n
  }, ["p", "padding", "borderRadius"]);
  return [S({
    "--Snackbar-radius": o.vars.radius.sm,
    "--Snackbar-decoratorChildRadius": "max((var(--Snackbar-radius) - var(--variant-borderWidth, 0px)) - var(--Snackbar-padding), min(var(--Snackbar-padding) + var(--variant-borderWidth, 0px), var(--Snackbar-radius) / 2))",
    "--Button-minHeight": "var(--Snackbar-decoratorChildHeight)",
    "--IconButton-size": "var(--Snackbar-decoratorChildHeight)",
    "--Button-radius": "var(--Snackbar-decoratorChildRadius)",
    "--IconButton-radius": "var(--Snackbar-decoratorChildRadius)",
    "--Icon-color": "currentColor"
  }, n.size === "sm" && {
    "--Snackbar-padding": "0.75rem",
    "--Snackbar-inset": "0.5rem",
    "--Snackbar-decoratorChildHeight": "1.5rem",
    "--Icon-fontSize": o.vars.fontSize.xl,
    gap: "0.5rem"
  }, n.size === "md" && {
    "--Snackbar-padding": "1rem",
    "--Snackbar-inset": "0.75rem",
    // the spacing between Snackbar and the viewport
    "--Snackbar-decoratorChildHeight": "2rem",
    "--Icon-fontSize": o.vars.fontSize.xl,
    gap: "0.625rem"
  }, n.size === "lg" && {
    "--Snackbar-padding": "1.25rem",
    "--Snackbar-inset": "1rem",
    "--Snackbar-decoratorChildHeight": "2.375rem",
    "--Icon-fontSize": o.vars.fontSize.xl2,
    gap: "0.875rem"
  }, {
    zIndex: o.vars.zIndex.snackbar,
    position: "fixed",
    display: "flex",
    alignItems: "center",
    minWidth: 300,
    top: ((f = n.anchorOrigin) == null ? void 0 : f.vertical) === "top" ? "var(--Snackbar-inset)" : void 0,
    left: ((r = n.anchorOrigin) == null ? void 0 : r.horizontal) === "left" ? "var(--Snackbar-inset)" : void 0,
    bottom: ((c = n.anchorOrigin) == null ? void 0 : c.vertical) === "bottom" ? "var(--Snackbar-inset)" : void 0,
    right: ((i = n.anchorOrigin) == null ? void 0 : i.horizontal) === "right" ? "var(--Snackbar-inset)" : void 0
  }, ((v = n.anchorOrigin) == null ? void 0 : v.horizontal) === "center" && {
    "--Snackbar-translateX": "-50%",
    left: "50%",
    transform: "translateX(var(--Snackbar-translateX))"
  }, ((p = n.anchorOrigin) == null ? void 0 : p.vertical) === "top" && {
    "--_Snackbar-anchorBottom": "-1"
  }, {
    animation: `${He} ${n.animationDuration}ms forwards`
  }, !n.open && {
    animationName: Ae
  }, {
    boxShadow: o.vars.shadow.lg,
    backgroundColor: o.vars.palette.background.surface,
    padding: "var(--Snackbar-padding)",
    borderRadius: "var(--Snackbar-radius)"
  }, o.typography[`body-${{
    sm: "xs",
    md: "sm",
    lg: "md"
  }[n.size]}`], n.variant === "solid" && n.color && n.invertedColors && De(n.color)(o), n.variant === "soft" && n.color && n.invertedColors && xe(n.color)(o), (h = o.variants[n.variant]) == null ? void 0 : h[n.color]), g !== void 0 && {
    "--Snackbar-padding": g
  }, b !== void 0 && {
    "--Snackbar-padding": b
  }, u !== void 0 && {
    "--Snackbar-radius": u
  }];
}), Be = A("span", {
  name: "JoySnackbar",
  slot: "StartDecorator",
  overridesResolver: (o, n) => n.startDecorator
})({
  display: "inherit",
  flex: "none"
}), Ne = A("span", {
  name: "JoySnackbar",
  slot: "EndDecorator",
  overridesResolver: (o, n) => n.endDecorator
})({
  display: "inherit",
  flex: "none",
  marginLeft: "auto"
}), $e = {
  vertical: "bottom",
  horizontal: "right"
}, V = /* @__PURE__ */ l.forwardRef(function(n, f) {
  const r = Re({
    props: n,
    name: "JoySnackbar"
  }), {
    anchorOrigin: c = $e,
    animationDuration: i = 300,
    autoHideDuration: v = null,
    color: p = "neutral",
    children: h,
    className: g,
    component: b,
    disableWindowBlurListener: u = !1,
    endDecorator: C,
    invertedColors: E = !1,
    onUnmount: s,
    open: d,
    size: k = "md",
    slots: t = {},
    slotProps: a,
    startDecorator: m,
    variant: Y = "outlined"
  } = r, K = ue(r, Pe), [G, _] = l.useState(!0), [Q, O] = l.useState(!1), T = l.useRef(s);
  T.current = s, l.useEffect(() => {
    if (d)
      O(!1), _(!1);
    else {
      O(!0);
      const L = setTimeout(() => {
        var B;
        _(!0), O(!1), (B = T.current) == null || B.call(T);
      }, i);
      return () => {
        clearTimeout(L);
      };
    }
  }, [d, i]);
  const D = S({}, r, {
    anchorOrigin: c,
    autoHideDuration: v,
    color: p,
    animationDuration: i,
    disableWindowBlurListener: u,
    invertedColors: E,
    size: k,
    variant: Y
  });
  delete D.onUnmount;
  const z = Me(D), {
    getRootProps: Z,
    onClickAway: ee
  } = we(D), ne = (L) => {
    Q || ee(L);
  }, w = S({}, K, {
    component: b,
    slots: t,
    slotProps: a
  }), [oe, re] = M("root", {
    ref: f,
    className: de(z.root, g),
    elementType: _e,
    externalForwardedProps: w,
    getSlotProps: Z,
    ownerState: D
  }), [te, ae] = M("startDecorator", {
    className: z.startDecorator,
    elementType: Be,
    externalForwardedProps: w,
    ownerState: D
  }), [se, ie] = M("endDecorator", {
    className: z.endDecorator,
    elementType: Ne,
    externalForwardedProps: w,
    ownerState: D
  }), ce = t.clickAway || R;
  return !d && G ? null : /* @__PURE__ */ y(ce, S({
    onClickAway: ne
  }, typeof (a == null ? void 0 : a.clickAway) == "function" ? a.clickAway(D) : a == null ? void 0 : a.clickAway, {
    children: /* @__PURE__ */ q(oe, S({}, re, {
      children: [m && /* @__PURE__ */ y(te, S({}, ae, {
        children: m
      })), h, C && /* @__PURE__ */ y(se, S({}, ie, {
        children: C
      }))]
    }))
  }));
});
process.env.NODE_ENV !== "production" && (V.propTypes = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * The anchor of the `Snackbar`.
   * On smaller screens, the component grows to occupy all the available width,
   * the horizontal alignment is ignored.
   * @default { vertical: 'bottom', horizontal: 'right' }
   */
  anchorOrigin: e.shape({
    horizontal: e.oneOf(["center", "left", "right"]).isRequired,
    vertical: e.oneOf(["bottom", "top"]).isRequired
  }),
  /**
   * The duration of the animation in milliseconds. This value is used to control
   * the length of time it takes for an animation to complete one cycle. It is also
   * utilized for delaying the unmount of the component.
   * Provide this value if you have your own animation so that we can precisely
   * time the component's unmount to match your custom animation.
   * @default 300
   */
  animationDuration: e.number,
  /**
   * The number of milliseconds to wait before automatically calling the
   * `onClose` function. `onClose` should then set the state of the `open`
   * prop to hide the Snackbar. This behavior is disabled by default with
   * the `null` value.
   * @default null
   */
  autoHideDuration: e.number,
  /**
   * @ignore
   */
  children: e.node,
  /**
   * @ignore
   */
  className: e.string,
  /**
   * The color of the component. It supports those theme colors that make sense for this component.
   * @default 'neutral'
   */
  color: e.oneOf(["danger", "neutral", "primary", "success", "warning"]),
  /**
   * The component used for the root node.
   * Either a string to use a HTML element or a component.
   */
  component: e.elementType,
  /**
   * If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
   * @default false
   */
  disableWindowBlurListener: e.bool,
  /**
   * Element placed after the children.
   */
  endDecorator: e.node,
  /**
   * If `true`, the children with an implicit color prop invert their colors to match the component's variant and color.
   * @default false
   */
  invertedColors: e.bool,
  /**
   * When displaying multiple consecutive snackbars using a single parent-rendered
   * `<Snackbar/>`, add the `key` prop to ensure independent treatment of each message.
   * For instance, use `<Snackbar key={message} />`. Otherwise, messages might update
   * in place, and features like `autoHideDuration` could be affected.
   */
  key: () => null,
  /**
   * @ignore
   */
  onBlur: e.func,
  /**
   * Callback fired when the component requests to be closed.
   * Typically `onClose` is used to set state in the parent component,
   * which is used to control the `Snackbar` `open` prop.
   * The `reason` parameter can optionally be used to control the response to `onClose`,
   * for example ignoring `clickaway`.
   *
   * @param {React.SyntheticEvent<any> | Event} event The event source of the callback.
   * @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`, or `"escapeKeyDown"`.
   */
  onClose: e.func,
  /**
   * @ignore
   */
  onFocus: e.func,
  /**
   * @ignore
   */
  onMouseEnter: e.func,
  /**
   * @ignore
   */
  onMouseLeave: e.func,
  /**
   * A callback fired when the component is about to be unmounted.
   */
  onUnmount: e.func,
  /**
   * If `true`, the component is shown.
   */
  open: e.bool.isRequired,
  /**
   * The number of milliseconds to wait before dismissing after user interaction.
   * If `autoHideDuration` prop isn't specified, it does nothing.
   * If `autoHideDuration` prop is specified but `resumeHideDuration` isn't,
   * we default to `autoHideDuration / 2` ms.
   */
  resumeHideDuration: e.number,
  /**
   * The size of the component.
   * @default 'md'
   */
  size: e.oneOf(["sm", "md", "lg"]),
  /**
   * The props used for each slot inside.
   * @default {}
   */
  slotProps: e.shape({
    clickAway: e.oneOfType([e.func, e.shape({
      children: e.element.isRequired,
      disableReactTree: e.bool,
      mouseEvent: e.oneOf(["onClick", "onMouseDown", "onMouseUp", "onPointerDown", "onPointerUp", !1]),
      onClickAway: e.func.isRequired,
      touchEvent: e.oneOf(["onTouchEnd", "onTouchStart", !1])
    })]),
    endDecorator: e.oneOfType([e.func, e.object]),
    root: e.oneOfType([e.func, e.object]),
    startDecorator: e.oneOfType([e.func, e.object])
  }),
  /**
   * The components used for each slot inside.
   * @default {}
   */
  slots: e.shape({
    clickAway: e.elementType,
    endDecorator: e.elementType,
    root: e.elementType,
    startDecorator: e.elementType
  }),
  /**
   * Element placed before the children.
   */
  startDecorator: e.node,
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx: e.oneOfType([e.arrayOf(e.oneOfType([e.func, e.object, e.bool])), e.func, e.object]),
  /**
   * The [global variant](https://mui.com/joy-ui/main-features/global-variants/) to use.
   * @default 'outlined'
   */
  variant: e.oneOf(["outlined", "plain", "soft", "solid"])
});
const Ie = fe(/* @__PURE__ */ y("path", {
  d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"
}), "Error"), Ke = ({
  notification: o,
  onClose: n
}) => {
  const f = pe(), r = me(), { shadowRootElement: c } = ve(he);
  return o.open ? ke.createPortal(
    /* @__PURE__ */ y(
      V,
      {
        open: o.open,
        onClose: n,
        autoHideDuration: o.variant === "error" ? 5e3 : 3e3,
        anchorOrigin: { vertical: "top", horizontal: "center" },
        color: o.variant === "success" ? "success" : "danger",
        variant: "soft",
        startDecorator: o.variant === "success" ? /* @__PURE__ */ y(ge, {}) : /* @__PURE__ */ y(Ie, {}),
        sx: {
          borderRadius: f.sm,
          fontFamily: r.secondary,
          minWidth: "300px",
          maxWidth: "400px",
          zIndex: 9999,
          position: "fixed"
        },
        children: /* @__PURE__ */ q(be, { sx: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
          o.title && /* @__PURE__ */ y(
            $,
            {
              level: "title-md",
              sx: {
                fontWeight: 600,
                fontSize: "16px",
                lineHeight: 1.2,
                color: "inherit"
              },
              children: o.title
            }
          ),
          o.message && /* @__PURE__ */ y(
            $,
            {
              level: "body-sm",
              sx: {
                fontSize: "14px",
                lineHeight: 1.3,
                color: "inherit",
                opacity: 0.9
              },
              children: o.message
            }
          )
        ] })
      }
    ),
    c ?? document.body
  ) : null;
};
export {
  Ke as N,
  Ye as d,
  Ve as g
};
