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