"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const index = require("../micromark-util-sanitize-uri/index.cjs");
const revert = require("./lib-revert.cjs");
function imageReference(state, node) {
  const id = String(node.identifier).toUpperCase();
  const definition = state.definitionById.get(id);
  if (!definition) {
    return revert.revert(state, node);
  }
  const properties = { src: index.normalizeUri(definition.url || ""), alt: node.alt };
  if (definition.title !== null && definition.title !== void 0) {
    properties.title = definition.title;
  }
  const result = { type: "element", tagName: "img", properties, children: [] };
  state.patch(node, result);
  return state.applyData(node, result);
}
exports.imageReference = imageReference;
//# sourceMappingURL=lib-handlers-image-reference.cjs.map
