function l(e, i = "defs") {
  let f = "";
  const s = e.indexOf("<" + i);
  for (; s >= 0; ) {
    const d = e.indexOf(">", s), r = e.indexOf("</" + i);
    if (d === -1 || r === -1) break;
    const n = e.indexOf(">", r);
    if (n === -1) break;
    f += e.slice(d + 1, r).trim(), e = e.slice(0, s).trim() + e.slice(n + 1);
  }
  return {
    defs: f,
    content: e
  };
}
function t(e, i) {
  return e ? "<defs>" + e + "</defs>" + i : i;
}
function u(e, i, f) {
  const s = l(e);
  return t(s.defs, i + s.content + f);
}
export {
  t as mergeDefsAndContent,
  l as splitSVGDefs,
  u as wrapSVGContent
};
