import { options as W } from "../../dist/preact.module.js";
var h, n, d, k, m = 0, U = [], o = W, q = o.__b, C = o.__r, F = o.diffed, b = o.__c, g = o.unmount, x = o.__;
function v(t, _) {
  o.__h && o.__h(n, t, m || _), m = 0;
  var u = n.__H || (n.__H = { __: [], __h: [] });
  return t >= u.__.length && u.__.push({}), u.__[t];
}
function D(t) {
  return m = 1, j(R, t);
}
function j(t, _, u) {
  var e = v(h++, 2);
  if (e.t = t, !e.__c && (e.__ = [u ? u(_) : R(void 0, _), function(i) {
    var c = e.__N ? e.__N[0] : e.__[0], f = e.t(c, i);
    c !== f && (e.__N = [f, e.__[1]], e.__c.setState({}));
  }], e.__c = n, !n.__f)) {
    var a = function(i, c, f) {
      if (!e.__c.__H) return !0;
      var l = e.__c.__H.__.filter(function(r) {
        return r.__c;
      });
      if (l.every(function(r) {
        return !r.__N;
      })) return !s || s.call(this, i, c, f);
      var A = e.__c.props !== i;
      return l.some(function(r) {
        if (r.__N) {
          var S = r.__[0];
          r.__ = r.__N, r.__N = void 0, S !== r.__[0] && (A = !0);
        }
      }), s && s.call(this, i, c, f) || A;
    };
    n.__f = !0;
    var s = n.shouldComponentUpdate, y = n.componentWillUpdate;
    n.componentWillUpdate = function(i, c, f) {
      if (this.__e) {
        var l = s;
        s = void 0, a(i, c, f), s = l;
      }
      y && y.call(this, i, c, f);
    }, n.shouldComponentUpdate = a;
  }
  return e.__N || e.__;
}
function L(t, _) {
  var u = v(h++, 3);
  !o.__s && N(u.__H, _) && (u.__ = t, u.u = _, n.__H.__h.push(u));
}
function M(t, _) {
  var u = v(h++, 4);
  !o.__s && N(u.__H, _) && (u.__ = t, u.u = _, n.__h.push(u));
}
function P(t) {
  return m = 5, E(function() {
    return { current: t };
  }, []);
}
function E(t, _) {
  var u = v(h++, 7);
  return N(u.__H, _) && (u.__ = t(), u.__H = _, u.__h = t), u.__;
}
function $(t, _) {
  return m = 8, E(function() {
    return t;
  }, _);
}
function G(t) {
  var _ = n.context[t.__c], u = v(h++, 9);
  return u.c = t, _ ? (u.__ == null && (u.__ = !0, _.sub(n)), _.props.value) : t.__;
}
function w() {
  for (var t; t = U.shift(); ) {
    var _ = t.__H;
    if (t.__P && _) try {
      _.__h.some(p), _.__h.some(H), _.__h = [];
    } catch (u) {
      _.__h = [], o.__e(u, t.__v);
    }
  }
}
o.__b = function(t) {
  n = null, q && q(t);
}, o.__ = function(t, _) {
  t && _.__k && _.__k.__m && (t.__m = _.__k.__m), x && x(t, _);
}, o.__r = function(t) {
  C && C(t), h = 0;
  var _ = (n = t.__c).__H;
  _ && (d === n ? (_.__h = [], n.__h = [], _.__.some(function(u) {
    u.__N && (u.__ = u.__N), u.u = u.__N = void 0;
  })) : (_.__h.some(p), _.__h.some(H), _.__h = [], h = 0)), d = n;
}, o.diffed = function(t) {
  F && F(t);
  var _ = t.__c;
  _ && _.__H && (_.__H.__h.length && (U.push(_) !== 1 && k === o.requestAnimationFrame || ((k = o.requestAnimationFrame) || z)(w)), _.__H.__.some(function(u) {
    u.u && (u.__H = u.u), u.u = void 0;
  })), d = n = null;
}, o.__c = function(t, _) {
  _.some(function(u) {
    try {
      u.__h.some(p), u.__h = u.__h.filter(function(e) {
        return !e.__ || H(e);
      });
    } catch (e) {
      _.some(function(a) {
        a.__h && (a.__h = []);
      }), _ = [], o.__e(e, u.__v);
    }
  }), b && b(t, _);
}, o.unmount = function(t) {
  g && g(t);
  var _, u = t.__c;
  u && u.__H && (u.__H.__.some(function(e) {
    try {
      p(e);
    } catch (a) {
      _ = a;
    }
  }), u.__H = void 0, _ && o.__e(_, u.__v));
};
var T = typeof requestAnimationFrame == "function";
function z(t) {
  var _, u = function() {
    clearTimeout(e), T && cancelAnimationFrame(_), setTimeout(t);
  }, e = setTimeout(u, 35);
  T && (_ = requestAnimationFrame(u));
}
function p(t) {
  var _ = n, u = t.__c;
  typeof u == "function" && (t.__c = void 0, u()), n = _;
}
function H(t) {
  var _ = n;
  t.__c = t.__(), n = _;
}
function N(t, _) {
  return !t || t.length !== _.length || _.some(function(u, e) {
    return u !== t[e];
  });
}
function R(t, _) {
  return typeof _ == "function" ? _(t) : _;
}
export {
  $ as useCallback,
  G as useContext,
  L as useEffect,
  M as useLayoutEffect,
  E as useMemo,
  j as useReducer,
  P as useRef,
  D as useState
};
