'use strict';

var index = require('../../../../micromark-util-combine-extensions@1.1.0/node_modules/micromark-util-combine-extensions/index.js');
var content = require('./initialize/content.js');
var document = require('./initialize/document.js');
var flow = require('./initialize/flow.js');
var text = require('./initialize/text.js');
var createTokenizer = require('./create-tokenizer.js');
var constructs = require('./constructs.js');

/**
 * @typedef {import('micromark-util-types').Create} Create
 * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension
 * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
 * @typedef {import('micromark-util-types').ParseContext} ParseContext
 * @typedef {import('micromark-util-types').ParseOptions} ParseOptions
 */


/**
 * @param {ParseOptions | null | undefined} [options]
 * @returns {ParseContext}
 */
function parse(options) {
  const settings = options || {};
  const constructs$1 =
    /** @type {FullNormalizedExtension} */
    index.combineExtensions([constructs, ...(settings.extensions || [])]);

  /** @type {ParseContext} */
  const parser = {
    defined: [],
    lazy: {},
    constructs: constructs$1,
    content: create(content.content),
    document: create(document.document),
    flow: create(flow.flow),
    string: create(text.string),
    text: create(text.text)
  };
  return parser

  /**
   * @param {InitialConstruct} initial
   */
  function create(initial) {
    return creator
    /** @type {Create} */
    function creator(from) {
      return createTokenizer.createTokenizer(parser, initial, from)
    }
  }
}

exports.parse = parse;
//# sourceMappingURL=parse.js.map
