import { Component as x, options as m, Fragment as U, isValidElement as C } from "../../../../../preact@10.29.0/node_modules/preact/dist/preact.module.js";
import { useMemo as g, useRef as A, useEffect as R } from "../../../../../preact@10.29.0/node_modules/preact/hooks/dist/hooks.module.js";
import { effect as l, signal as k, computed as y, Signal as S, batch as w } from "../../../../../@preact_signals-core@1.14.1/node_modules/@preact/signals-core/dist/signals-core.module.js";
import { untracked as W } from "../../../../../@preact_signals-core@1.14.1/node_modules/@preact/signals-core/dist/signals-core.module.js";
var b, $, d, M = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, T = [], N = [];
l(function() {
  b = this.N;
})();
function s(t, e) {
  m[t] = e.bind(null, m[t] || function() {
  });
}
function h(t) {
  if (d) {
    var e = d;
    d = void 0, e();
  }
  d = t && t.S();
}
function q(t) {
  var e = this, i = t.data, r = V(i);
  r.value = i;
  var f = g(function() {
    for (var a = e, o = e.__v; o = o.__; ) if (o.__c) {
      o.__c.__$f |= 4;
      break;
    }
    var _ = y(function() {
      var c = r.value.value;
      return c === 0 ? 0 : c === !0 ? "" : c || "";
    }), v = y(function() {
      return !Array.isArray(_.value) && !C(_.value);
    }), p = l(function() {
      if (this.N = F, v.value) {
        var c = _.value;
        a.__v && a.__v.__e && a.__v.__e.nodeType === 3 && (a.__v.__e.data = c);
      }
    }), E = e.__$u.d;
    return e.__$u.d = function() {
      p(), E.call(this);
    }, [v, _];
  }, []), n = f[0], u = f[1];
  return n.value ? u.peek() : u.value;
}
q.displayName = "ReactiveTextNode";
Object.defineProperties(S.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: q }, props: { configurable: !0, get: function() {
  var t = this;
  return { data: { get value() {
    return t.value;
  } } };
} }, __b: { configurable: !0, value: 1 } });
s("__b", function(t, e) {
  if (typeof e.type == "string") {
    var i, r = e.props;
    for (var f in r) if (f !== "children") {
      var n = r[f];
      n instanceof S && (i || (e.__np = i = {}), i[f] = n, r[f] = n.peek());
    }
  }
  t(e);
});
s("__r", function(t, e) {
  if (t(e), e.type !== U) {
    h();
    var i, r = e.__c;
    r && (r.__$f &= -2, (i = r.__$u) === void 0 && (r.__$u = i = (function(f, n) {
      var u;
      return l(function() {
        u = this;
      }, { name: n }), u.c = f, u;
    })(function() {
      var f;
      M && ((f = i.y) == null || f.call(i)), r.__$f |= 1, r.setState({});
    }, typeof e.type == "function" ? e.type.displayName || e.type.name : ""))), $ = r, h(i);
  }
});
s("__e", function(t, e, i, r) {
  h(), $ = void 0, t(e, i, r);
});
s("diffed", function(t, e) {
  h(), $ = void 0;
  var i;
  if (typeof e.type == "string" && (i = e.__e)) {
    var r = e.__np, f = e.props;
    if (r) {
      var n = i.U;
      if (n) for (var u in n) {
        var a = n[u];
        a !== void 0 && !(u in r) && (a.d(), n[u] = void 0);
      }
      else
        n = {}, i.U = n;
      for (var o in r) {
        var _ = n[o], v = r[o];
        _ === void 0 ? (_ = O(i, o, v), n[o] = _) : _.o(v, f);
      }
      for (var p in r) f[p] = r[p];
    }
  }
  t(e);
});
function O(t, e, i, r) {
  var f = e in t && t.ownerSVGElement === void 0, n = k(i), u = i.peek();
  return { o: function(a, o) {
    n.value = a, u = a.peek();
  }, d: l(function() {
    this.N = F;
    var a = n.value.value;
    u !== a ? (u = void 0, f ? t[e] = a : a != null && (a !== !1 || e[4] === "-") ? t.setAttribute(e, a) : t.removeAttribute(e)) : u = void 0;
  }) };
}
s("unmount", function(t, e) {
  if (typeof e.type == "string") {
    var i = e.__e;
    if (i) {
      var r = i.U;
      if (r) {
        i.U = void 0;
        for (var f in r) {
          var n = r[f];
          n && n.d();
        }
      }
    }
    e.__np = void 0;
  } else {
    var u = e.__c;
    if (u) {
      var a = u.__$u;
      a && (u.__$u = void 0, a.d());
    }
  }
  t(e);
});
s("__h", function(t, e, i, r) {
  (r < 3 || r === 9) && (e.__$f |= 2), t(e, i, r);
});
x.prototype.shouldComponentUpdate = function(t, e) {
  if (this.__R) return !0;
  var i = this.__$u, r = i && i.s !== void 0;
  for (var f in e) return !0;
  if (this.__f || typeof this.u == "boolean" && this.u === !0) {
    var n = 2 & this.__$f;
    if (!(r || n || 4 & this.__$f) || 1 & this.__$f) return !0;
  } else if (!(r || 4 & this.__$f) || 3 & this.__$f) return !0;
  for (var u in t) if (u !== "__source" && t[u] !== this.props[u]) return !0;
  for (var a in this.props) if (!(a in t)) return !0;
  return !1;
};
function V(t, e) {
  return g(function() {
    return k(t, e);
  }, []);
}
function H(t, e) {
  var i = A(t);
  return i.current = t, $.__$f |= 4, g(function() {
    return y(function() {
      return i.current();
    }, e);
  }, []);
}
var j = typeof requestAnimationFrame > "u" ? setTimeout : function(t) {
  var e = function() {
    clearTimeout(i), cancelAnimationFrame(r), t();
  }, i = setTimeout(e, 35), r = requestAnimationFrame(e);
}, G = function(t) {
  queueMicrotask(function() {
    queueMicrotask(t);
  });
};
function L() {
  w(function() {
    for (var t; t = T.shift(); ) b.call(t);
  });
}
function P() {
  T.push(this) === 1 && (m.requestAnimationFrame || j)(L);
}
function D() {
  w(function() {
    for (var t; t = N.shift(); ) b.call(t);
  });
}
function F() {
  N.push(this) === 1 && (m.requestAnimationFrame || G)(D);
}
function J(t, e) {
  var i = A(t);
  i.current = t, R(function() {
    return l(function() {
      return this.N = P, i.current();
    }, e);
  }, []);
}
export {
  S as Signal,
  w as batch,
  y as computed,
  l as effect,
  k as signal,
  W as untracked,
  H as useComputed,
  V as useSignal,
  J as useSignalEffect
};
