function T(r, t) {
  if (r.ownerDocument !== t.ownerDocument)
    try {
      return t.ownerDocument.importNode(r, true);
    } catch {
    }
  return r;
}
function y(r, t) {
  return t.appendChild(T(r, t));
}
function _(r, t) {
  return y(t, r), r;
}
var f = 2, m = {
  "alignment-baseline": 1,
  "baseline-shift": 1,
  clip: 1,
  "clip-path": 1,
  "clip-rule": 1,
  color: 1,
  "color-interpolation": 1,
  "color-interpolation-filters": 1,
  "color-profile": 1,
  "color-rendering": 1,
  cursor: 1,
  direction: 1,
  display: 1,
  "dominant-baseline": 1,
  "enable-background": 1,
  fill: 1,
  "fill-opacity": 1,
  "fill-rule": 1,
  filter: 1,
  "flood-color": 1,
  "flood-opacity": 1,
  font: 1,
  "font-family": 1,
  "font-size": f,
  "font-size-adjust": 1,
  "font-stretch": 1,
  "font-style": 1,
  "font-variant": 1,
  "font-weight": 1,
  "glyph-orientation-horizontal": 1,
  "glyph-orientation-vertical": 1,
  "image-rendering": 1,
  kerning: 1,
  "letter-spacing": 1,
  "lighting-color": 1,
  marker: 1,
  "marker-end": 1,
  "marker-mid": 1,
  "marker-start": 1,
  mask: 1,
  opacity: 1,
  overflow: 1,
  "pointer-events": 1,
  "shape-rendering": 1,
  "stop-color": 1,
  "stop-opacity": 1,
  stroke: 1,
  "stroke-dasharray": 1,
  "stroke-dashoffset": 1,
  "stroke-linecap": 1,
  "stroke-linejoin": 1,
  "stroke-miterlimit": 1,
  "stroke-opacity": 1,
  "stroke-width": f,
  "text-anchor": 1,
  "text-decoration": 1,
  "text-rendering": 1,
  "unicode-bidi": 1,
  visibility: 1,
  "word-spacing": 1,
  "writing-mode": 1
};
function k(r, t) {
  return m[t] ? r.style[t] : r.getAttributeNS(null, t);
}
function v(r, t, e) {
  var i = t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), n = m[i];
  n ? (n === f && typeof e == "number" && (e = String(e) + "px"), r.style[i] = e) : r.setAttributeNS(null, t, e);
}
function S(r, t) {
  var e = Object.keys(t), i, n;
  for (i = 0, n; n = e[i]; i++)
    v(r, n, t[n]);
}
function N(r, t, e) {
  if (typeof t == "string")
    if (e !== void 0)
      v(r, t, e);
    else
      return k(r, t);
  else
    S(r, t);
  return r;
}
const x = Object.prototype.toString;
function z(r) {
  return new o(r);
}
function o(r) {
  if (!r || !r.nodeType)
    throw new Error("A DOM element reference is required");
  this.el = r, this.list = r.classList;
}
o.prototype.add = function(r) {
  return this.list.add(r), this;
};
o.prototype.remove = function(r) {
  return x.call(r) == "[object RegExp]" ? this.removeMatching(r) : (this.list.remove(r), this);
};
o.prototype.removeMatching = function(r) {
  const t = this.array();
  for (let e = 0; e < t.length; e++)
    r.test(t[e]) && this.remove(t[e]);
  return this;
};
o.prototype.toggle = function(r, t) {
  return typeof t < "u" ? t !== this.list.toggle(r, t) && this.list.toggle(r) : this.list.toggle(r), this;
};
o.prototype.array = function() {
  return Array.from(this.list);
};
o.prototype.has = o.prototype.contains = function(r) {
  return this.list.contains(r);
};
function A(r) {
  var t = r.parentNode;
  return t && t.removeChild(r), r;
}
function E(r) {
  for (var t; t = r.firstChild; )
    A(t);
  return r;
}
var p = {
  svg: "http://www.w3.org/2000/svg"
}, h = '<svg xmlns="' + p.svg + '"';
function b(r) {
  var t = false;
  r.substring(0, 4) === "<svg" ? r.indexOf(p.svg) === -1 && (r = h + r.substring(4)) : (r = h + ">" + r + "</svg>", t = true);
  var e = C(r);
  if (!t)
    return e;
  for (var i = document.createDocumentFragment(), n = e.firstChild; n.firstChild; )
    i.appendChild(n.firstChild);
  return i;
}
function C(r) {
  var t;
  return t = new DOMParser(), t.async = false, t.parseFromString(r, "text/xml");
}
function M(r, t) {
  var e;
  return r.charAt(0) === "<" ? (e = b(r).firstChild, e = document.importNode(e, true)) : e = document.createElementNS(p.svg, r), e;
}
var c = null;
function u() {
  return c === null && (c = M("svg")), c;
}
function d(r, t) {
  var e, i, n = Object.keys(t);
  for (e = 0; i = n[e]; e++)
    r[i] = t[i];
  return r;
}
function L(r, t, e, i, n, s) {
  var a = u().createSVGMatrix();
  switch (arguments.length) {
    case 0:
      return a;
    case 1:
      return d(a, r);
    case 6:
      return d(a, {
        a: r,
        b: t,
        c: e,
        d: i,
        e: n,
        f: s
      });
  }
}
function P(r) {
  return u().createSVGTransform();
}
var g = /([&<>]{1})/g, V = /([\n\r"]{1})/g, G = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "'"
};
function l(r, t) {
  function e(i, n) {
    return G[n] || n;
  }
  return r.replace(t, e);
}
function w(r, t) {
  var e, i, n, s, a;
  switch (r.nodeType) {
    case 3:
      t.push(l(r.textContent, g));
      break;
    case 1:
      if (t.push("<", r.tagName), r.hasAttributes())
        for (n = r.attributes, e = 0, i = n.length; e < i; ++e)
          s = n.item(e), t.push(" ", s.name, '="', l(s.value, V), '"');
      if (r.hasChildNodes()) {
        for (t.push(">"), a = r.childNodes, e = 0, i = a.length; e < i; ++e)
          w(a.item(e), t);
        t.push("</", r.tagName, ">");
      } else
        t.push("/>");
      break;
    case 8:
      t.push("<!--", l(r.nodeValue, g), "-->");
      break;
    case 4:
      t.push("<![CDATA[", r.nodeValue, "]]>");
      break;
    default:
      throw new Error("unable to handle node " + r.nodeType);
  }
  return t;
}
function I(r) {
  for (var t = r.firstChild, e = []; t; )
    w(t, e), t = t.nextSibling;
  return e.join("");
}
function $(r, t) {
  return I(r);
}
function j(r, t) {
  return t instanceof SVGMatrix ? r.createSVGTransformFromMatrix(t) : t;
}
function F(r, t) {
  var e, i;
  for (r.clear(), e = 0; i = t[e]; e++)
    r.appendItem(j(r, i));
}
function q(r, t) {
  var e = r.transform.baseVal;
  return t && (Array.isArray(t) || (t = [t]), F(e, t)), e.consolidate();
}
export {
  _ as append,
  y as appendTo,
  N as attr,
  z as classes,
  E as clear,
  M as create,
  L as createMatrix,
  P as createTransform,
  $ as innerSVG,
  A as remove,
  q as transform
};
