import { __exports as M } from "../../../../../../_virtual/tokenize.js";
import "./tokenTypes.js";
import { __exports as z } from "../../../../../../_virtual/tokenTypes.js";
(function(_) {
  _.__esModule = !0, _.default = N, _.FIELDS = void 0;
  var e = L(z), m, n;
  function T() {
    if (typeof WeakMap != "function")
      return null;
    var t = /* @__PURE__ */ new WeakMap();
    return T = function() {
      return t;
    }, t;
  }
  function L(t) {
    if (t && t.__esModule)
      return t;
    if (t === null || typeof t != "object" && typeof t != "function")
      return { default: t };
    var o = T();
    if (o && o.has(t))
      return o.get(t);
    var r = {}, u = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for (var f in t)
      if (Object.prototype.hasOwnProperty.call(t, f)) {
        var l = u ? Object.getOwnPropertyDescriptor(t, f) : null;
        l && (l.get || l.set) ? Object.defineProperty(r, f, l) : r[f] = t[f];
      }
    return r.default = t, o && o.set(t, r), r;
  }
  for (var y = (m = {}, m[e.tab] = !0, m[e.newline] = !0, m[e.cr] = !0, m[e.feed] = !0, m), x = (n = {}, n[e.space] = !0, n[e.tab] = !0, n[e.newline] = !0, n[e.cr] = !0, n[e.feed] = !0, n[e.ampersand] = !0, n[e.asterisk] = !0, n[e.bang] = !0, n[e.comma] = !0, n[e.colon] = !0, n[e.semicolon] = !0, n[e.openParenthesis] = !0, n[e.closeParenthesis] = !0, n[e.openSquare] = !0, n[e.closeSquare] = !0, n[e.singleQuote] = !0, n[e.doubleQuote] = !0, n[e.plus] = !0, n[e.pipe] = !0, n[e.tilde] = !0, n[e.greaterThan] = !0, n[e.equals] = !0, n[e.dollar] = !0, n[e.caret] = !0, n[e.slash] = !0, n), P = {}, q = "0123456789abcdefABCDEF", k = 0; k < q.length; k++)
    P[q.charCodeAt(k)] = !0;
  function R(t, o) {
    var r = o, u;
    do {
      if (u = t.charCodeAt(r), x[u])
        return r - 1;
      u === e.backslash ? r = W(t, r) + 1 : r++;
    } while (r < t.length);
    return r - 1;
  }
  function W(t, o) {
    var r = o, u = t.charCodeAt(r + 1);
    if (!y[u])
      if (P[u]) {
        var f = 0;
        do
          r++, f++, u = t.charCodeAt(r + 1);
        while (P[u] && f < 6);
        f < 6 && u === e.space && r++;
      } else
        r++;
    return r;
  }
  var I = {
    TYPE: 0,
    START_LINE: 1,
    START_COL: 2,
    END_LINE: 3,
    END_COL: 4,
    START_POS: 5,
    END_POS: 6
  };
  _.FIELDS = I;
  function N(t) {
    var o = [], r = t.css.valueOf(), u = r, f = u.length, l = -1, i = 1, s = 0, d = 0, c, E, h, p, g, A, O, b, a, C, w, S, v;
    function D(Q, F) {
      if (t.safe)
        r += F, a = r.length - 1;
      else
        throw t.error("Unclosed " + Q, i, s - l, s);
    }
    for (; s < f; ) {
      switch (c = r.charCodeAt(s), c === e.newline && (l = s, i += 1), c) {
        case e.space:
        case e.tab:
        case e.newline:
        case e.cr:
        case e.feed:
          a = s;
          do
            a += 1, c = r.charCodeAt(a), c === e.newline && (l = a, i += 1);
          while (c === e.space || c === e.newline || c === e.tab || c === e.cr || c === e.feed);
          v = e.space, p = i, h = a - l - 1, d = a;
          break;
        case e.plus:
        case e.greaterThan:
        case e.tilde:
        case e.pipe:
          a = s;
          do
            a += 1, c = r.charCodeAt(a);
          while (c === e.plus || c === e.greaterThan || c === e.tilde || c === e.pipe);
          v = e.combinator, p = i, h = s - l, d = a;
          break;
        case e.asterisk:
        case e.ampersand:
        case e.bang:
        case e.comma:
        case e.equals:
        case e.dollar:
        case e.caret:
        case e.openSquare:
        case e.closeSquare:
        case e.colon:
        case e.semicolon:
        case e.openParenthesis:
        case e.closeParenthesis:
          a = s, v = c, p = i, h = s - l, d = a + 1;
          break;
        case e.singleQuote:
        case e.doubleQuote:
          S = c === e.singleQuote ? "'" : '"', a = s;
          do
            for (g = !1, a = r.indexOf(S, a + 1), a === -1 && D("quote", S), A = a; r.charCodeAt(A - 1) === e.backslash; )
              A -= 1, g = !g;
          while (g);
          v = e.str, p = i, h = s - l, d = a + 1;
          break;
        default:
          c === e.slash && r.charCodeAt(s + 1) === e.asterisk ? (a = r.indexOf("*/", s + 2) + 1, a === 0 && D("comment", "*/"), E = r.slice(s, a + 1), b = E.split(`
`), O = b.length - 1, O > 0 ? (C = i + O, w = a - b[O].length) : (C = i, w = l), v = e.comment, i = C, p = C, h = a - w) : c === e.slash ? (a = s, v = c, p = i, h = s - l, d = a + 1) : (a = R(r, s), v = e.word, p = i, h = a - l), d = a + 1;
          break;
      }
      o.push([
        v,
        i,
        s - l,
        p,
        h,
        s,
        d
      ]), w && (l = w, w = null), s = d;
    }
    return o;
  }
})(M);
//# sourceMappingURL=tokenize.js.map
