var T, m;
function Z() {
  if (m) return T;
  m = 1;
  const k = 39, p = 34, d = 92, w = 47, h = 10, l = 32, A = 12, C = 9, f = 13, B = 91, H = 93, q = 40, v = 41, z = 123, Q = 125, K = 59, F = 42, W = 58, Y = 64, E = /[\t\n\f\r "#'()/;[\\\]{}]/g, u = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g, G = /.[\r\n"'(/\\]/, L = /[\da-f]/i;
  return T = function(N, M = {}) {
    let c = N.css.valueOf(), _ = M.ignoreErrors, r, g, O, e, I, o, n, a, s, U, P = c.length, t = 0, R = [], S = [];
    function X() {
      return t;
    }
    function b(i) {
      throw N.error("Unclosed " + i, t);
    }
    function j() {
      return S.length === 0 && t >= P;
    }
    function y(i) {
      if (S.length) return S.pop();
      if (t >= P) return;
      let x = i ? i.ignoreUnclosed : !1;
      switch (r = c.charCodeAt(t), r) {
        case h:
        case l:
        case C:
        case f:
        case A: {
          e = t;
          do
            e += 1, r = c.charCodeAt(e);
          while (r === l || r === h || r === C || r === f || r === A);
          o = ["space", c.slice(t, e)], t = e - 1;
          break;
        }
        case B:
        case H:
        case z:
        case Q:
        case W:
        case K:
        case v: {
          let D = String.fromCharCode(r);
          o = [D, D, t];
          break;
        }
        case q: {
          if (U = R.length ? R.pop()[1] : "", s = c.charCodeAt(t + 1), U === "url" && s !== k && s !== p && s !== l && s !== h && s !== C && s !== A && s !== f) {
            e = t;
            do {
              if (n = !1, e = c.indexOf(")", e + 1), e === -1)
                if (_ || x) {
                  e = t;
                  break;
                } else
                  b("bracket");
              for (a = e; c.charCodeAt(a - 1) === d; )
                a -= 1, n = !n;
            } while (n);
            o = ["brackets", c.slice(t, e + 1), t, e], t = e;
          } else
            e = c.indexOf(")", t + 1), g = c.slice(t, e + 1), e === -1 || G.test(g) ? o = ["(", "(", t] : (o = ["brackets", g, t, e], t = e);
          break;
        }
        case k:
        case p: {
          I = r === k ? "'" : '"', e = t;
          do {
            if (n = !1, e = c.indexOf(I, e + 1), e === -1)
              if (_ || x) {
                e = t + 1;
                break;
              } else
                b("string");
            for (a = e; c.charCodeAt(a - 1) === d; )
              a -= 1, n = !n;
          } while (n);
          o = ["string", c.slice(t, e + 1), t, e], t = e;
          break;
        }
        case Y: {
          E.lastIndex = t + 1, E.test(c), E.lastIndex === 0 ? e = c.length - 1 : e = E.lastIndex - 2, o = ["at-word", c.slice(t, e + 1), t, e], t = e;
          break;
        }
        case d: {
          for (e = t, O = !0; c.charCodeAt(e + 1) === d; )
            e += 1, O = !O;
          if (r = c.charCodeAt(e + 1), O && r !== w && r !== l && r !== h && r !== C && r !== f && r !== A && (e += 1, L.test(c.charAt(e)))) {
            for (; L.test(c.charAt(e + 1)); )
              e += 1;
            c.charCodeAt(e + 1) === l && (e += 1);
          }
          o = ["word", c.slice(t, e + 1), t, e], t = e;
          break;
        }
        default: {
          r === w && c.charCodeAt(t + 1) === F ? (e = c.indexOf("*/", t + 2) + 1, e === 0 && (_ || x ? e = c.length : b("comment")), o = ["comment", c.slice(t, e + 1), t, e], t = e) : (u.lastIndex = t + 1, u.test(c), u.lastIndex === 0 ? e = c.length - 1 : e = u.lastIndex - 2, o = ["word", c.slice(t, e + 1), t, e], R.push(o), t = e);
          break;
        }
      }
      return t++, o;
    }
    function J(i) {
      S.push(i);
    }
    return {
      back: J,
      endOfFile: j,
      nextToken: y,
      position: X
    };
  }, T;
}
export {
  Z as __require
};
//# sourceMappingURL=tokenize.js.map
