import { createElement as l, hydrate as g, render as d, cloneElement as f, Fragment as C } from "../../../../preact@10.29.0/node_modules/preact/dist/preact.module.js";
function u() {
  return u = Object.assign ? Object.assign.bind() : function(t) {
    for (var s = 1; s < arguments.length; s++) {
      var e = arguments[s];
      for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
    }
    return t;
  }, u.apply(this, arguments);
}
function v(t, s) {
  if (t == null) return {};
  var e, r, a = {}, n = Object.keys(t);
  for (r = 0; r < n.length; r++) s.indexOf(e = n[r]) >= 0 || (a[e] = t[e]);
  return a;
}
var E = ["context", "children"], O = ["useFragment"];
function A(t, s, e, r) {
  function a() {
    var n, o = Reflect.construct(HTMLElement, [], a);
    return o._vdomComponent = t, r && r.shadow ? (o._root = o.attachShadow({ mode: r.mode || "open", serializable: (n = r.serializable) != null && n }), r.adoptedStyleSheets && (o._root.adoptedStyleSheets = r.adoptedStyleSheets)) : o._root = o, o;
  }
  return (a.prototype = Object.create(HTMLElement.prototype)).constructor = a, a.prototype.connectedCallback = function() {
    j.call(this, r);
  }, a.prototype.attributeChangedCallback = k, a.prototype.disconnectedCallback = w, e = e || t.observedAttributes || Object.keys(t.propTypes || {}), a.observedAttributes = e, t.formAssociated && (a.formAssociated = !0), e.forEach(function(n) {
    Object.defineProperty(a.prototype, n, { get: function() {
      return this._vdom ? this._vdom.props[n] : this._props[n];
    }, set: function(o) {
      this._vdom ? this.attributeChangedCallback(n, null, o) : (this._props || (this._props = {}), this._props[n] = o);
      var i = typeof o;
      o != null && i !== "string" && i !== "boolean" && i !== "number" || this.setAttribute(n, o);
    } });
  }), customElements.define(s || t.tagName || t.displayName || t.name, a), a;
}
function x(t) {
  this.getChildContext = function() {
    return t.context;
  };
  var s = t.children, e = v(t, E);
  return f(s, e);
}
function j(t) {
  var s = new CustomEvent("_preact", { detail: {}, bubbles: !0, cancelable: !0 });
  this.dispatchEvent(s), this._vdom = l(x, u({}, this._props, { context: s.detail.context }), b(this, this._vdomComponent, t)), (this.hasAttribute("hydrate") ? g : d)(this._vdom, this._root);
}
function _(t) {
  return t.replace(/-(\w)/g, function(s, e) {
    return e ? e.toUpperCase() : "";
  });
}
function k(t, s, e) {
  if (this._vdom) {
    var r = {};
    r[t] = e = e ?? void 0, r[_(t)] = e, this._vdom = f(this._vdom, r), d(this._vdom, this._root);
  }
}
function w() {
  d(this._vdom = null, this._root);
}
function m(t, s) {
  var e = this, r = t.useFragment, a = v(t, O);
  return l(r ? C : "slot", u({}, a, { ref: function(n) {
    n ? (e.ref = n, e._listener || (e._listener = function(o) {
      o.stopPropagation(), o.detail.context = s;
    }, n.addEventListener("_preact", e._listener))) : e.ref.removeEventListener("_preact", e._listener);
  } }));
}
function b(t, s, e) {
  if (t.nodeType === 3) return t.data;
  if (t.nodeType !== 1) return null;
  var r = [], a = {}, n = 0, o = t.attributes, i = t.childNodes;
  for (n = o.length; n--; ) o[n].name !== "slot" && (a[o[n].name] = o[n].value, a[_(o[n].name)] = o[n].value);
  for (n = i.length; n--; ) {
    var p = b(i[n], null, e), c = i[n].slot;
    c ? a[c] = l(m, { name: c }, p) : r[n] = p;
  }
  var h = !(!e || !e.shadow), y = s ? l(m, { useFragment: !h }, r) : r;
  return !h && s && (t.innerHTML = ""), l(s || t.nodeName.toLowerCase(), a, y);
}
export {
  A as default
};
