import { c as v } from "../../../../../../../_virtual/container.js";
import "./node.js";
import "./types.js";
import { __exports as S } from "../../../../../../../_virtual/types.js";
import { n as b } from "../../../../../../../_virtual/node.js";
(function(y, h) {
  h.__esModule = !0, h.default = void 0;
  var _ = g(b.exports), o = m(S);
  function c() {
    if (typeof WeakMap != "function")
      return null;
    var n = /* @__PURE__ */ new WeakMap();
    return c = function() {
      return n;
    }, n;
  }
  function m(n) {
    if (n && n.__esModule)
      return n;
    if (n === null || typeof n != "object" && typeof n != "function")
      return { default: n };
    var a = c();
    if (a && a.has(n))
      return a.get(n);
    var e = {}, r = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for (var t in n)
      if (Object.prototype.hasOwnProperty.call(n, t)) {
        var i = r ? Object.getOwnPropertyDescriptor(n, t) : null;
        i && (i.get || i.set) ? Object.defineProperty(e, t, i) : e[t] = n[t];
      }
    return e.default = n, a && a.set(n, e), e;
  }
  function g(n) {
    return n && n.__esModule ? n : { default: n };
  }
  function w(n, a) {
    var e;
    if (typeof Symbol > "u" || n[Symbol.iterator] == null) {
      if (Array.isArray(n) || (e = k(n)) || a && n && typeof n.length == "number") {
        e && (n = e);
        var r = 0;
        return function() {
          return r >= n.length ? { done: !0 } : { done: !1, value: n[r++] };
        };
      }
      throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
    }
    return e = n[Symbol.iterator](), e.next.bind(e);
  }
  function k(n, a) {
    if (!!n) {
      if (typeof n == "string")
        return d(n, a);
      var e = Object.prototype.toString.call(n).slice(8, -1);
      if (e === "Object" && n.constructor && (e = n.constructor.name), e === "Map" || e === "Set")
        return Array.from(n);
      if (e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))
        return d(n, a);
    }
  }
  function d(n, a) {
    (a == null || a > n.length) && (a = n.length);
    for (var e = 0, r = new Array(a); e < a; e++)
      r[e] = n[e];
    return r;
  }
  function p(n, a) {
    for (var e = 0; e < a.length; e++) {
      var r = a[e];
      r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(n, r.key, r);
    }
  }
  function x(n, a, e) {
    return a && p(n.prototype, a), e && p(n, e), n;
  }
  function A(n, a) {
    n.prototype = Object.create(a.prototype), n.prototype.constructor = n, l(n, a);
  }
  function l(n, a) {
    return l = Object.setPrototypeOf || function(r, t) {
      return r.__proto__ = t, r;
    }, l(n, a);
  }
  var O = /* @__PURE__ */ function(n) {
    A(a, n);
    function a(r) {
      var t;
      return t = n.call(this, r) || this, t.nodes || (t.nodes = []), t;
    }
    var e = a.prototype;
    return e.append = function(t) {
      return t.parent = this, this.nodes.push(t), this;
    }, e.prepend = function(t) {
      return t.parent = this, this.nodes.unshift(t), this;
    }, e.at = function(t) {
      return this.nodes[t];
    }, e.index = function(t) {
      return typeof t == "number" ? t : this.nodes.indexOf(t);
    }, e.removeChild = function(t) {
      t = this.index(t), this.at(t).parent = void 0, this.nodes.splice(t, 1);
      var i;
      for (var s in this.indexes)
        i = this.indexes[s], i >= t && (this.indexes[s] = i - 1);
      return this;
    }, e.removeAll = function() {
      for (var t = w(this.nodes), i; !(i = t()).done; ) {
        var s = i.value;
        s.parent = void 0;
      }
      return this.nodes = [], this;
    }, e.empty = function() {
      return this.removeAll();
    }, e.insertAfter = function(t, i) {
      i.parent = this;
      var s = this.index(t);
      this.nodes.splice(s + 1, 0, i), i.parent = this;
      var u;
      for (var f in this.indexes)
        u = this.indexes[f], s <= u && (this.indexes[f] = u + 1);
      return this;
    }, e.insertBefore = function(t, i) {
      i.parent = this;
      var s = this.index(t);
      this.nodes.splice(s, 0, i), i.parent = this;
      var u;
      for (var f in this.indexes)
        u = this.indexes[f], u <= s && (this.indexes[f] = u + 1);
      return this;
    }, e._findChildAtPosition = function(t, i) {
      var s = void 0;
      return this.each(function(u) {
        if (u.atPosition) {
          var f = u.atPosition(t, i);
          if (f)
            return s = f, !1;
        } else if (u.isAtPosition(t, i))
          return s = u, !1;
      }), s;
    }, e.atPosition = function(t, i) {
      if (this.isAtPosition(t, i))
        return this._findChildAtPosition(t, i) || this;
    }, e._inferEndPosition = function() {
      this.last && this.last.source && this.last.source.end && (this.source = this.source || {}, this.source.end = this.source.end || {}, Object.assign(this.source.end, this.last.source.end));
    }, e.each = function(t) {
      this.lastEach || (this.lastEach = 0), this.indexes || (this.indexes = {}), this.lastEach++;
      var i = this.lastEach;
      if (this.indexes[i] = 0, !!this.length) {
        for (var s, u; this.indexes[i] < this.length && (s = this.indexes[i], u = t(this.at(s), s), u !== !1); )
          this.indexes[i] += 1;
        if (delete this.indexes[i], u === !1)
          return !1;
      }
    }, e.walk = function(t) {
      return this.each(function(i, s) {
        var u = t(i, s);
        if (u !== !1 && i.length && (u = i.walk(t)), u === !1)
          return !1;
      });
    }, e.walkAttributes = function(t) {
      var i = this;
      return this.walk(function(s) {
        if (s.type === o.ATTRIBUTE)
          return t.call(i, s);
      });
    }, e.walkClasses = function(t) {
      var i = this;
      return this.walk(function(s) {
        if (s.type === o.CLASS)
          return t.call(i, s);
      });
    }, e.walkCombinators = function(t) {
      var i = this;
      return this.walk(function(s) {
        if (s.type === o.COMBINATOR)
          return t.call(i, s);
      });
    }, e.walkComments = function(t) {
      var i = this;
      return this.walk(function(s) {
        if (s.type === o.COMMENT)
          return t.call(i, s);
      });
    }, e.walkIds = function(t) {
      var i = this;
      return this.walk(function(s) {
        if (s.type === o.ID)
          return t.call(i, s);
      });
    }, e.walkNesting = function(t) {
      var i = this;
      return this.walk(function(s) {
        if (s.type === o.NESTING)
          return t.call(i, s);
      });
    }, e.walkPseudos = function(t) {
      var i = this;
      return this.walk(function(s) {
        if (s.type === o.PSEUDO)
          return t.call(i, s);
      });
    }, e.walkTags = function(t) {
      var i = this;
      return this.walk(function(s) {
        if (s.type === o.TAG)
          return t.call(i, s);
      });
    }, e.walkUniversals = function(t) {
      var i = this;
      return this.walk(function(s) {
        if (s.type === o.UNIVERSAL)
          return t.call(i, s);
      });
    }, e.split = function(t) {
      var i = this, s = [];
      return this.reduce(function(u, f, P) {
        var I = t.call(i, f);
        return s.push(f), I ? (u.push(s), s = []) : P === i.length - 1 && u.push(s), u;
      }, []);
    }, e.map = function(t) {
      return this.nodes.map(t);
    }, e.reduce = function(t, i) {
      return this.nodes.reduce(t, i);
    }, e.every = function(t) {
      return this.nodes.every(t);
    }, e.some = function(t) {
      return this.nodes.some(t);
    }, e.filter = function(t) {
      return this.nodes.filter(t);
    }, e.sort = function(t) {
      return this.nodes.sort(t);
    }, e.toString = function() {
      return this.map(String).join("");
    }, x(a, [{
      key: "first",
      get: function() {
        return this.at(0);
      }
    }, {
      key: "last",
      get: function() {
        return this.at(this.length - 1);
      }
    }, {
      key: "length",
      get: function() {
        return this.nodes.length;
      }
    }]), a;
  }(_.default);
  h.default = O, y.exports = h.default;
})(v, v.exports);
//# sourceMappingURL=container.js.map
