import { hs as u, cz as n, _ as i, ht as p, dq as l } from "./603b75d9.js";
import "react";
import "react-dom";
it("test action handler", (c) => {
  const [r] = u();
  let t = 0;
  const a = n(0, !0), e = {
    action: a,
    reduceFn: () => {
      t += 1;
    }
  }, s = {
    ...e,
    action: {
      ...a,
      priority: "defer"
    }
  }, d = {
    ...e,
    action: void 0
  };
  i.range(3).forEach(() => {
    r(e);
  }), expect(t).toBe(3), i.range(3).forEach(() => {
    r(s);
  }), expect(t).toBe(3), r(e), expect(t).toBe(7);
  let o = 0;
  i.range(3).forEach(() => {
    o = r(s);
  }), expect(o).toBe(3), expect(t).toBe(7), setTimeout(() => {
    o = r(d), expect(t).toBe(11), expect(o).toBe(0), c();
  }), r(s);
});
test("nestDispatchHandler", () => {
  const c = p(), r = [], t = (a) => {
    c(a, (e) => {
      e.type === l.CHANGE_VALUE && (r.push("start" + e.value), e.value === 1 && (t(n(2, !0)), t(n(4, !0))), e.value === 2 && t(n(3, !0)), e.value === 4 && t(n(5, !0)), e.value === 6 && t(n(7, !0)), r.push("end" + e.value));
    });
  };
  t(n(1, !0)), t(n(6, !0)), expect(r).toStrictEqual(["start1", "end1", "start2", "end2", "start3", "end3", "start4", "end4", "start5", "end5", "start6", "end6", "start7", "end7"]);
});
