import { Component as a, options as i, createElement as s, Fragment as v, toChildArray as d, render as m } from "../../dist/preact.module.mjs";
import { createContext as G, createRef as J } from "../../dist/preact.module.mjs";
import "../../hooks/dist/hooks.module.mjs";
function $(e, t) {
  for (var o in t)
    e[o] = t[o];
  return e;
}
function y(e, t) {
  for (var o in e)
    if (o !== "__source" && !(o in t))
      return !0;
  for (var n in t)
    if (n !== "__source" && e[n] !== t[n])
      return !0;
  return !1;
}
function b(e) {
  this.props = e;
}
(b.prototype = new a()).isPureReactComponent = !0, b.prototype.shouldComponentUpdate = function(e, t) {
  return y(this.props, e) || y(this.state, t);
};
var g = i.__b;
i.__b = function(e) {
  e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), g && g(e);
};
var R = i.__e;
i.__e = function(e, t, o, n) {
  if (e.then) {
    for (var _, r = t; r = r.__; )
      if ((_ = r.__c) && _.__c)
        return t.__e == null && (t.__e = o.__e, t.__k = o.__k), _.__c(e, t);
  }
  R(e, t, o, n);
};
var C = i.unmount;
function N(e, t, o) {
  return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(n) {
    typeof n.__c == "function" && n.__c();
  }), e.__c.__H = null), (e = $({}, e)).__c != null && (e.__c.__P === o && (e.__c.__P = t), e.__c = null), e.__k = e.__k && e.__k.map(function(n) {
    return N(n, t, o);
  })), e;
}
function U(e, t, o) {
  return e && (e.__v = null, e.__k = e.__k && e.__k.map(function(n) {
    return U(n, t, o);
  }), e.__c && e.__c.__P === t && (e.__e && o.insertBefore(e.__e, e.__d), e.__c.__e = !0, e.__c.__P = o)), e;
}
function f() {
  this.__u = 0, this.t = null, this.__b = null;
}
function S(e) {
  var t = e.__.__c;
  return t && t.__a && t.__a(e);
}
function c() {
  this.u = null, this.o = null;
}
i.unmount = function(e) {
  var t = e.__c;
  t && t.__R && t.__R(), t && e.__h === !0 && (e.type = null), C && C(e);
}, (f.prototype = new a()).__c = function(e, t) {
  var o = t.__c, n = this;
  n.t == null && (n.t = []), n.t.push(o);
  var _ = S(n.__v), r = !1, l = function() {
    r || (r = !0, o.__R = null, _ ? _(u) : u());
  };
  o.__R = l;
  var u = function() {
    if (!--n.__u) {
      if (n.state.__a) {
        var p = n.state.__a;
        n.__v.__k[0] = U(p, p.__c.__P, p.__c.__O);
      }
      var h;
      for (n.setState({ __a: n.__b = null }); h = n.t.pop(); )
        h.forceUpdate();
    }
  }, E = t.__h === !0;
  n.__u++ || E || n.setState({ __a: n.__b = n.__v.__k[0] }), e.then(l, l);
}, f.prototype.componentWillUnmount = function() {
  this.t = [];
}, f.prototype.render = function(e, t) {
  if (this.__b) {
    if (this.__v.__k) {
      var o = document.createElement("div"), n = this.__v.__k[0].__c;
      this.__v.__k[0] = N(this.__b, o, n.__O = n.__P);
    }
    this.__b = null;
  }
  var _ = t.__a && s(v, null, e.fallback);
  return _ && (_.__h = null), [s(v, null, t.__a ? null : e.children), _];
};
var k = function(e, t, o) {
  if (++o[1] === o[0] && e.o.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.o.size))
    for (o = e.u; o; ) {
      for (; o.length > 3; )
        o.pop()();
      if (o[1] < o[0])
        break;
      e.u = o = o[2];
    }
};
function W(e) {
  return this.getChildContext = function() {
    return e.context;
  }, e.children;
}
function A(e) {
  var t = this, o = e.i;
  t.componentWillUnmount = function() {
    m(null, t.l), t.l = null, t.i = null;
  }, t.i && t.i !== o && t.componentWillUnmount(), e.__v ? (t.l || (t.i = o, t.l = { nodeType: 1, parentNode: o, childNodes: [], appendChild: function(n) {
    this.childNodes.push(n), t.i.appendChild(n);
  }, insertBefore: function(n, _) {
    this.childNodes.push(n), t.i.appendChild(n);
  }, removeChild: function(n) {
    this.childNodes.splice(this.childNodes.indexOf(n) >>> 1, 1), t.i.removeChild(n);
  } }), m(s(W, { context: t.context }, e.__v), t.l)) : t.l && t.componentWillUnmount();
}
function I(e, t) {
  var o = s(A, { __v: e, i: t });
  return o.containerInfo = t, o;
}
(c.prototype = new a()).__a = function(e) {
  var t = this, o = S(t.__v), n = t.o.get(e);
  return n[0]++, function(_) {
    var r = function() {
      t.props.revealOrder ? (n.push(_), k(t, e, n)) : _();
    };
    o ? o(r) : r();
  };
}, c.prototype.render = function(e) {
  this.u = null, this.o = /* @__PURE__ */ new Map();
  var t = d(e.children);
  e.revealOrder && e.revealOrder[0] === "b" && t.reverse();
  for (var o = t.length; o--; )
    this.o.set(t[o], this.u = [1, 0, this.u]);
  return e.children;
}, c.prototype.componentDidUpdate = c.prototype.componentDidMount = function() {
  var e = this;
  this.o.forEach(function(t, o) {
    k(e, o, t);
  });
};
var L = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, V = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, j = typeof document < "u", B = function(e) {
  return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/i : /fil|che|ra/i).test(e);
};
a.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) {
  Object.defineProperty(a.prototype, e, { configurable: !0, get: function() {
    return this["UNSAFE_" + e];
  }, set: function(t) {
    Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t });
  } });
});
var P = i.event;
function D() {
}
function H() {
  return this.cancelBubble;
}
function F() {
  return this.defaultPrevented;
}
i.event = function(e) {
  return P && (e = P(e)), e.persist = D, e.isPropagationStopped = H, e.isDefaultPrevented = F, e.nativeEvent = e;
};
var x = { configurable: !0, get: function() {
  return this.class;
} }, O = i.vnode;
i.vnode = function(e) {
  var t = e.type, o = e.props, n = o;
  if (typeof t == "string") {
    var _ = t.indexOf("-") === -1;
    for (var r in n = {}, o) {
      var l = o[r];
      j && r === "children" && t === "noscript" || r === "value" && "defaultValue" in o && l == null || (r === "defaultValue" && "value" in o && o.value == null ? r = "value" : r === "download" && l === !0 ? l = "" : /ondoubleclick/i.test(r) ? r = "ondblclick" : /^onchange(textarea|input)/i.test(r + t) && !B(o.type) ? r = "oninput" : /^onfocus$/i.test(r) ? r = "onfocusin" : /^onblur$/i.test(r) ? r = "onfocusout" : /^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(r) ? r = r.toLowerCase() : _ && V.test(r) ? r = r.replace(/[A-Z0-9]/g, "-$&").toLowerCase() : l === null && (l = void 0), /^oninput$/i.test(r) && (r = r.toLowerCase(), n[r] && (r = "oninputCapture")), n[r] = l);
    }
    t == "select" && n.multiple && Array.isArray(n.value) && (n.value = d(o.children).forEach(function(u) {
      u.props.selected = n.value.indexOf(u.props.value) != -1;
    })), t == "select" && n.defaultValue != null && (n.value = d(o.children).forEach(function(u) {
      u.props.selected = n.multiple ? n.defaultValue.indexOf(u.props.value) != -1 : n.defaultValue == u.props.value;
    })), e.props = n, o.class != o.className && (x.enumerable = "className" in o, o.className != null && (n.class = o.className), Object.defineProperty(n, "className", x));
  }
  e.$$typeof = L, O && O(e);
};
var w = i.__r;
i.__r = function(e) {
  w && w(e), e.__c;
};
export {
  a as Component,
  v as Fragment,
  b as PureComponent,
  f as Suspense,
  c as SuspenseList,
  G as createContext,
  s as createElement,
  I as createPortal,
  J as createRef
};
