import { createElement as c, render as m, Component as f, options as l, Fragment as y, toChildArray as v } from "../../dist/preact.module.js";
import { createContext as Q, createRef as X } from "../../dist/preact.module.js";
import { useCallback as ee, useContext as te, useEffect as re, useImperativeHandle as oe, useLayoutEffect as ne, useMemo as _e, useReducer as ue, useRef as ae, useState as le } from "../../hooks/dist/hooks.module.js";
function R(e, t) {
  for (var r in t) e[r] = t[r];
  return e;
}
function h(e, t) {
  for (var r in e) if (r !== "__source" && !(r in t)) return !0;
  for (var o in t) if (o !== "__source" && e[o] !== t[o]) return !0;
  return !1;
}
function b(e, t) {
  this.props = e, this.context = t;
}
function z(e, t) {
  function r(n) {
    var u = this.props.ref, _ = u == n.ref;
    return !_ && u && (u.call ? u(null) : u.current = null), t ? !t(this.props, n) || !_ : h(this.props, n);
  }
  function o(n) {
    return this.shouldComponentUpdate = r, c(e, n);
  }
  return o.displayName = "Memo(" + (e.displayName || e.name) + ")", o.prototype.isReactComponent = !0, o.__f = !0, o.type = e, o;
}
(b.prototype = new f()).isPureReactComponent = !0, b.prototype.shouldComponentUpdate = function(e, t) {
  return h(this.props, e) || h(this.state, t);
};
var g = l.__b;
l.__b = function(e) {
  e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), g && g(e);
};
var U = typeof Symbol < "u" && Symbol.for && /* @__PURE__ */ Symbol.for("react.forward_ref") || 3911;
function G(e) {
  function t(r) {
    var o = R({}, r);
    return delete o.ref, e(o, r.ref || null);
  }
  return t.$$typeof = U, t.render = e, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t;
}
var A = l.__e;
l.__e = function(e, t, r, o) {
  if (e.then) {
    for (var n, u = t; u = u.__; ) if ((n = u.__c) && n.__c) return t.__e == null && (t.__e = r.__e, t.__k = r.__k), n.__c(e, t);
  }
  A(e, t, r, o);
};
var k = l.unmount;
function O(e, t, r) {
  return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(o) {
    typeof o.__c == "function" && o.__c();
  }), e.__c.__H = null), (e = R({}, e)).__c != null && (e.__c.__P === r && (e.__c.__P = t), e.__c.__e = !0, e.__c = null), e.__k = e.__k && e.__k.map(function(o) {
    return O(o, t, r);
  })), e;
}
function w(e, t, r) {
  return e && r && (e.__v = null, e.__k = e.__k && e.__k.map(function(o) {
    return w(o, t, r);
  }), e.__c && e.__c.__P === t && (e.__e && r.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = r)), e;
}
function d() {
  this.__u = 0, this.o = null, this.__b = null;
}
function E(e) {
  var t = e.__.__c;
  return t && t.__a && t.__a(e);
}
function p() {
  this.i = null, this.l = null;
}
l.unmount = function(e) {
  var t = e.__c;
  t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), k && k(e);
}, (d.prototype = new f()).__c = function(e, t) {
  var r = t.__c, o = this;
  o.o == null && (o.o = []), o.o.push(r);
  var n = E(o.__v), u = !1, _ = function() {
    u || (u = !0, r.__R = null, n ? n(i) : i());
  };
  r.__R = _;
  var i = function() {
    if (!--o.__u) {
      if (o.state.__a) {
        var a = o.state.__a;
        o.__v.__k[0] = w(a, a.__c.__P, a.__c.__O);
      }
      var s;
      for (o.setState({ __a: o.__b = null }); s = o.o.pop(); ) s.forceUpdate();
    }
  };
  o.__u++ || 32 & t.__u || o.setState({ __a: o.__b = o.__v.__k[0] }), e.then(_, _);
}, d.prototype.componentWillUnmount = function() {
  this.o = [];
}, d.prototype.render = function(e, t) {
  if (this.__b) {
    if (this.__v.__k) {
      var r = document.createElement("div"), o = this.__v.__k[0].__c;
      this.__v.__k[0] = O(this.__b, r, o.__O = o.__P);
    }
    this.__b = null;
  }
  var n = t.__a && c(y, null, e.fallback);
  return n && (n.__u &= -33), [c(y, null, t.__a ? null : e.children), n];
};
var C = function(e, t, r) {
  if (++r[1] === r[0] && e.l.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.l.size)) for (r = e.i; r; ) {
    for (; r.length > 3; ) r.pop()();
    if (r[1] < r[0]) break;
    e.i = r = r[2];
  }
};
function W(e) {
  return this.getChildContext = function() {
    return e.context;
  }, e.children;
}
function $(e) {
  var t = this, r = e.h;
  if (t.componentWillUnmount = function() {
    m(null, t.v), t.v = null, t.h = null;
  }, t.h && t.h !== r && t.componentWillUnmount(), !t.v) {
    for (var o = t.__v; o !== null && !o.__m && o.__ !== null; ) o = o.__;
    t.h = r, t.v = { nodeType: 1, parentNode: r, childNodes: [], __k: { __m: o.__m }, contains: function() {
      return !0;
    }, insertBefore: function(n, u) {
      this.childNodes.push(n), t.h.insertBefore(n, u);
    }, removeChild: function(n) {
      this.childNodes.splice(this.childNodes.indexOf(n) >>> 1, 1), t.h.removeChild(n);
    } };
  }
  m(c(W, { context: t.context }, e.__v), t.v);
}
function q(e, t) {
  var r = c($, { __v: e, h: t });
  return r.containerInfo = t, r;
}
(p.prototype = new f()).__a = function(e) {
  var t = this, r = E(t.__v), o = t.l.get(e);
  return o[0]++, function(n) {
    var u = function() {
      t.props.revealOrder ? (o.push(n), C(t, e, o)) : n();
    };
    r ? r(u) : u();
  };
}, p.prototype.render = function(e) {
  this.i = null, this.l = /* @__PURE__ */ new Map();
  var t = v(e.children);
  e.revealOrder && e.revealOrder[0] === "b" && t.reverse();
  for (var r = t.length; r--; ) this.l.set(t[r], this.i = [1, 0, this.i]);
  return e.children;
}, p.prototype.componentDidUpdate = p.prototype.componentDidMount = function() {
  var e = this;
  this.l.forEach(function(t, r) {
    C(e, r, t);
  });
};
var H = typeof Symbol < "u" && Symbol.for && /* @__PURE__ */ Symbol.for("react.element") || 60103, M = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|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]/, V = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, B = /[A-Z0-9]/g, F = typeof document < "u", L = function(e) {
  return (typeof Symbol < "u" && typeof /* @__PURE__ */ Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
};
f.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiveProps", "componentWillUpdate"].forEach(function(e) {
  Object.defineProperty(f.prototype, e, { configurable: !0, get: function() {
    return this["UNSAFE_" + e];
  }, set: function(t) {
    Object.defineProperty(this, e, { configurable: !0, writable: !0, value: t });
  } });
});
var x = l.event;
function j() {
}
function D() {
  return this.cancelBubble;
}
function T() {
  return this.defaultPrevented;
}
l.event = function(e) {
  return x && (e = x(e)), e.persist = j, e.isPropagationStopped = D, e.isDefaultPrevented = T, e.nativeEvent = e;
};
var I = { enumerable: !1, configurable: !0, get: function() {
  return this.class;
} }, N = l.vnode;
l.vnode = function(e) {
  typeof e.type == "string" && (function(t) {
    var r = t.props, o = t.type, n = {}, u = o.indexOf("-") === -1;
    for (var _ in r) {
      var i = r[_];
      if (!(_ === "value" && "defaultValue" in r && i == null || F && _ === "children" && o === "noscript" || _ === "class" || _ === "className")) {
        var a = _.toLowerCase();
        _ === "defaultValue" && "value" in r && r.value == null ? _ = "value" : _ === "download" && i === !0 ? i = "" : a === "translate" && i === "no" ? i = !1 : a[0] === "o" && a[1] === "n" ? a === "ondoubleclick" ? _ = "ondblclick" : a !== "onchange" || o !== "input" && o !== "textarea" || L(r.type) ? a === "onfocus" ? _ = "onfocusin" : a === "onblur" ? _ = "onfocusout" : V.test(_) && (_ = a) : a = _ = "oninput" : u && M.test(_) ? _ = _.replace(B, "-$&").toLowerCase() : i === null && (i = void 0), a === "oninput" && n[_ = a] && (_ = "oninputCapture"), n[_] = i;
      }
    }
    o == "select" && n.multiple && Array.isArray(n.value) && (n.value = v(r.children).forEach(function(s) {
      s.props.selected = n.value.indexOf(s.props.value) != -1;
    })), o == "select" && n.defaultValue != null && (n.value = v(r.children).forEach(function(s) {
      s.props.selected = n.multiple ? n.defaultValue.indexOf(s.props.value) != -1 : n.defaultValue == s.props.value;
    })), r.class && !r.className ? (n.class = r.class, Object.defineProperty(n, "className", I)) : (r.className && !r.class || r.class && r.className) && (n.class = n.className = r.className), t.props = n;
  })(e), e.$$typeof = H, N && N(e);
};
var P = l.__r;
l.__r = function(e) {
  P && P(e), e.__c;
};
var S = l.diffed;
l.diffed = function(e) {
  S && S(e);
  var t = e.props, r = e.__e;
  r != null && e.type === "textarea" && "value" in t && t.value !== r.value && (r.value = t.value == null ? "" : t.value);
};
export {
  f as Component,
  y as Fragment,
  b as PureComponent,
  d as Suspense,
  p as SuspenseList,
  Q as createContext,
  c as createElement,
  q as createPortal,
  X as createRef,
  G as forwardRef,
  z as memo,
  ee as useCallback,
  te as useContext,
  re as useEffect,
  oe as useImperativeHandle,
  ne as useLayoutEffect,
  _e as useMemo,
  ue as useReducer,
  ae as useRef,
  le as useState
};
