import { v as c, O as u, S as m, cJ as v, M as x, F as g, G as h, aa as i, ac as n, J as t, dY as w, hd as C, cc as f } from "./603b75d9.js";
import "react";
import "react-dom";
const l = function() {
  const e = {
    v1: c("abc"),
    v2: c("v2"),
    visible: u,
    value: m,
    num: v("num")
  };
  return new x(e, (o) => o).setPropertyViewFn(() => /* @__PURE__ */ g(h, {})).build();
}(), d = i(l, [new n("v1"), new n("visible"), new n("value"), new n("num")]);
test("exposing data and methods", () => {
  let e = new d({});
  e = t(e);
  const o = e.extraNode().node;
  e = t(e.reduce(e.changeChildAction("v2", "ppp"))), expect(e.children.v2.getView()).toBe("ppp");
  const p = e.extraNode().node;
  expect(w(o, p)).toBe(!0), e = t(e.reduce(e.changeChildAction("v1", "v1_value"))), expect(t(e)).toBe(e), expect(e.exposingValues.v1).toBe("v1_value"), expect(e.exposingValues.visible).toBe(!1), expect(Object.keys(e.exposingInfo().methods)).toContain("setNum");
});
test("run exposing method", () => {
  let e = new d({
    dispatch: (o) => {
      e = t(e.reduce(o));
    }
  });
  e = t(e), e.reduce(C({
    type: "execute",
    methodName: "setNum",
    params: [100]
  }, !1)), expect(e.getView().num.value).toEqual(100);
});
test("exposing deps", () => {
  const e = i(l, [new n("v1"), f({
    name: "X",
    desc: "",
    depKeys: ["v1", "visible"],
    func: (s) => s.v1 + " " + s.visible
  })]);
  let o = new e({});
  o = t(o);
  const p = o.exposingInfo().property;
  expect(o.exposingValues.X).toBe("abc false"), o = t(o.reduce(o.changeChildAction("v2", "ppp")));
  const r = o.exposingInfo().property;
  function a(s) {
    return s.children.X;
  }
  expect(a(p)).toBe(a(r));
});
