import { checkQuote as c } from "../util/check-quote.es.js";
n.peek = v;
function n(o, a, t, u) {
  const f = c(t), l = f === '"' ? "Quote" : "Apostrophe", m = t.enter("image");
  let i = t.enter("label");
  const e = t.createTracker(u);
  let r = e.move("![");
  return r += e.move(
    t.safe(o.alt, { before: r, after: "]", ...e.current() })
  ), r += e.move("]("), i(), // If there’s no url but there is a title…
  !o.url && o.title || // If there are control characters or whitespace.
  /[\0- \u007F]/.test(o.url) ? (i = t.enter("destinationLiteral"), r += e.move("<"), r += e.move(
    t.safe(o.url, { before: r, after: ">", ...e.current() })
  ), r += e.move(">")) : (i = t.enter("destinationRaw"), r += e.move(
    t.safe(o.url, {
      before: r,
      after: o.title ? " " : ")",
      ...e.current()
    })
  )), i(), o.title && (i = t.enter(`title${l}`), r += e.move(" " + f), r += e.move(
    t.safe(o.title, {
      before: r,
      after: f,
      ...e.current()
    })
  ), r += e.move(f), i()), r += e.move(")"), m(), r;
}
function v() {
  return "!";
}
export {
  n as image
};
//# sourceMappingURL=image.es.js.map
