"use client";
const n = /[#.]/g;
function p(r, o) {
  const l = r || "", s = {};
  let t = 0, c, i;
  for (; t < l.length; ) {
    n.lastIndex = t;
    const a = n.exec(l), e = l.slice(t, a ? a.index : l.length);
    e && (c ? c === "#" ? s.id = e : Array.isArray(s.className) ? s.className.push(e) : s.className = [e] : i = e, t += e.length), a && (c = a[0], t++);
  }
  return {
    type: "element",
    // @ts-expect-error: tag name is parsed.
    tagName: i || o || "div",
    properties: s,
    children: []
  };
}
export {
  p as parseSelector
};
