import { onNextFrame as u, defaultTimestep as i } from "./on-next-frame.es.js";
import { createRenderStep as h } from "./create-render-step.es.js";
const x = 40;
let o = !0, s = !1, c = !1;
const r = {
  delta: 0,
  timestamp: 0
}, a = [
  "read",
  "update",
  "preRender",
  "render",
  "postRender"
], n = a.reduce((e, t) => (e[t] = h(() => s = !0), e), {}), g = a.reduce((e, t) => {
  const p = n[t];
  return e[t] = (d, f = !1, m = !1) => (s || S(), p.schedule(d, f, m)), e;
}, {}), D = a.reduce((e, t) => (e[t] = n[t].cancel, e), {}), M = a.reduce((e, t) => (e[t] = () => n[t].process(r), e), {}), F = (e) => n[e].process(r), l = (e) => {
  s = !1, r.delta = o ? i : Math.max(Math.min(e - r.timestamp, x), 1), r.timestamp = e, c = !0, a.forEach(F), c = !1, s && (o = !1, u(l));
}, S = () => {
  s = !0, o = !0, c || u(l);
}, N = () => r;
export {
  D as cancelSync,
  g as default,
  M as flushSync,
  N as getFrameData
};
//# sourceMappingURL=index.es.js.map
