'use strict';

var modules_abstract_did_module = require('../../modules/abstract/did/module.cjs');
require('../../utils/types/array.cjs');
require('crypto');
var utils_inheritance = require('../../utils/inheritance.cjs');
require('bs58');
require('multiformats/bases/base58');
require('varint');
require('../../utils/encoding/ss-58.cjs');
var utils_ident_parsers = require('../../utils/ident/parsers.cjs');
var resolver_generic_resolver = require('../generic/resolver.cjs');
require('../../modules/abstract/common/abstract-api-provider.cjs');
require('../../utils/types/object.cjs');
require('../../utils/types/iterable.cjs');
require('../../utils/types/set.cjs');
require('blake2b');
require('../../utils/types/bytes.cjs');
require('../../utils/interfaces.cjs');
require('../../utils/assert.cjs');
require('../../utils/error.cjs');
require('../../utils/types/string.cjs');
require('../../modules/abstract/common/abstract-base-module.cjs');
require('../../utils/ident/matchers.cjs');
require('../generic/const.cjs');

class DIDResolver extends resolver_generic_resolver {
  prefix = 'did';

  get method() {
    return this.didModule.methods();
  }

  /**
   * @param {AbstractDIDModule}
   * @constructor
   */
  constructor(didModule) {
    super();

    /**
     * @type {AbstractDIDModule}
     */
    this.didModule = utils_inheritance.ensureInstanceOf(didModule, modules_abstract_did_module);
  }

  async resolve(didURL) {
    const { did } = utils_ident_parsers.parseDIDUrl(didURL);
    const document = await this.didModule.getDocument(did);

    return document.toJSON();
  }
}

module.exports = DIDResolver;
//# sourceMappingURL=did-resolver.cjs.map
