import { r as C, L as G, ap as Z, u as W, a3 as r, j as u, aq as m } from "./index-CsBCemCF.js";
import { createContext as x, useContext as A, useState as y, useCallback as b, useEffect as p, useMemo as a } from "react";
const d = x(null);
d.displayName = "ElementFullscreenContext";
const N = /* @__PURE__ */ C("div", process.env.NODE_ENV === "production" ? {
  target: "elp1w7k0"
} : {
  target: "elp1w7k0",
  label: "StyledFullScreenFrame"
})(({
  theme: l,
  isExpanded: e
}) => ({
  width: "100%",
  height: "100%",
  ...e ? {
    position: "fixed",
    top: 0,
    left: 0,
    bottom: 0,
    right: 0,
    background: l.colors.bgColor,
    zIndex: l.zIndices.fullscreenWrapper,
    padding: l.spacing.md,
    paddingTop: l.sizes.fullScreenHeaderHeight,
    overflow: "auto",
    display: "flex",
    // To avoid extra spaces that lead to scrollbars.
    alignItems: "center",
    justifyContent: "center"
  } : {}
}), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL3N0bGl0ZS9zdGxpdGUvc3RyZWFtbGl0L2Zyb250ZW5kL2xpYi9zcmMvY29tcG9uZW50cy9zaGFyZWQvRnVsbFNjcmVlbldyYXBwZXIvc3R5bGVkLWNvbXBvbmVudHMudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXNCcUMiLCJmaWxlIjoiL2hvbWUvcnVubmVyL3dvcmsvc3RsaXRlL3N0bGl0ZS9zdHJlYW1saXQvZnJvbnRlbmQvbGliL3NyYy9jb21wb25lbnRzL3NoYXJlZC9GdWxsU2NyZWVuV3JhcHBlci9zdHlsZWQtY29tcG9uZW50cy50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIENvcHlyaWdodCAoYykgU3RyZWFtbGl0IEluYy4gKDIwMTgtMjAyMikgU25vd2ZsYWtlIEluYy4gKDIwMjItMjAyNSlcbiAqXG4gKiBMaWNlbnNlZCB1bmRlci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RoOiBcIjEwMCVcIixcbiAgICBoZWlnaHQ6IFwiMTAwJVwiLFxuICAgIC4uLihpc0V4cGFuZGVkXG4gICAgICA/IHtcbiAgICAgICAgICBwb3NpdGlvbjogXCJmaXhlZFwiLFxuICAgICAgICAgIHRvcDogMCxcbiAgICAgICAgICBsZWZ0OiAwLFxuICAgICAgICAgIGJvdHRvbTogMCxcbiAgICAgICAgICByaWdodDogMCxcbiAgICAgICAgICBiYWNrZ3JvdW5kOiB0aGVtZS5jb2xvcnMuYmdDb2xvcixcbiAgICAgICAgICB6SW5kZXg6IHRoZW1lLnpJbmRpY2VzLmZ1bGxzY3JlZW5XcmFwcGVyLFxuICAgICAgICAgIHBhZGRpbmc6IHRoZW1lLnNwYWNpbmcubWQsXG4gICAgICAgICAgcGFkZGluZ1RvcDogdGhlbWUuc2l6ZXMuZnVsbFNjcmVlbkhlYWRlckhlaWdodCxcbiAgICAgICAgICBvdmVyZmxvdzogXCJhdXRvXCIsXG4gICAgICAgICAgZGlzcGxheTogXCJmbGV4XCIsIC8vIFRvIGF2b2lkIGV4dHJhIHNwYWNlcyB0aGF0IGxlYWQgdG8gc2Nyb2xsYmFycy5cbiAgICAgICAgICBhbGlnbkl0ZW1zOiBcImNlbnRlclwiLFxuICAgICAgICAgIGp1c3RpZnlDb250ZW50OiBcImNlbnRlclwiLFxuICAgICAgICB9XG4gICAgICA6IHt9KSxcbiAgfSlcbilcbiJdfQ== */"), V = () => {
  const {
    setFullScreen: l
  } = A(G), [e, c] = y(!1), {
    fullHeight: o,
    fullWidth: g
  } = Z(), I = b((n) => {
    c(n), l(n);
  }, [l]), i = b(() => {
    document.body.style.overflow = "hidden", I(!0);
  }, [I]), t = b(() => {
    document.body.style.overflow = "unset", I(!1);
  }, [I]), s = b((n) => {
    n.keyCode === 27 && e && t();
  }, [t, e]);
  return p(() => (document.addEventListener("keydown", s, !1), () => {
    document.removeEventListener("keydown", s, !1);
  }), [s]), a(() => ({
    expanded: e,
    zoomIn: i,
    zoomOut: t,
    fullHeight: o,
    fullWidth: g
  }), [e, i, t, o, g]);
}, F = ({
  children: l
}) => {
  const e = W(), {
    expanded: c,
    fullHeight: o,
    fullWidth: g,
    zoomIn: I,
    zoomOut: i
  } = V(), {
    width: t,
    elementRef: s
  } = r(), n = a(() => ({
    width: c ? g : t,
    height: c ? o : void 0,
    expanded: c,
    expand: I,
    collapse: i
  }), [c, o, g, t, I, i]);
  return /* @__PURE__ */ u.jsx(d.Provider, { value: n, children: /* @__PURE__ */ u.jsx(N, { ref: s, isExpanded: c, "data-testid": "stFullScreenFrame", theme: e, children: l }) });
};
function v(l) {
  const e = (c) => /* @__PURE__ */ u.jsx(F, { children: /* @__PURE__ */ u.jsx(l, { ...c }) });
  return e.displayName = `withFullScreenWrapper(${l.displayName || l.name})`, m(e, l);
}
export {
  d as E,
  v as w
};
//# sourceMappingURL=withFullScreenWrapper-B2V0S41O.js.map
