"use client";
import { splice as l } from "../micromark-util-chunked/index.js";
const f = {}.hasOwnProperty;
function d(e) {
  const t = {};
  let n = -1;
  for (; ++n < e.length; )
    a(t, e[n]);
  return t;
}
function a(e, t) {
  let n;
  for (n in t) {
    const i = (f.call(e, n) ? e[n] : void 0) || (e[n] = {}), s = t[n];
    let o;
    if (s)
      for (o in s) {
        f.call(i, o) || (i[o] = []);
        const r = s[o];
        h(
          // @ts-expect-error Looks like a list.
          i[o],
          Array.isArray(r) ? r : r ? [r] : []
        );
      }
  }
}
function h(e, t) {
  let n = -1;
  const c = [];
  for (; ++n < t.length; )
    (t[n].add === "after" ? e : c).push(t[n]);
  l(e, 0, 0, c);
}
export {
  d as combineExtensions
};
