import AbstractDIDModule from '../../modules/abstract/did/module.js';
import '../../utils/types/array.js';
import 'crypto';
import { ensureInstanceOf } from '../../utils/inheritance.js';
import 'bs58';
import 'multiformats/bases/base58';
import 'varint';
import '../../utils/encoding/ss-58.js';
import { parseDIDUrl } from '../../utils/ident/parsers.js';
import Resolver from '../generic/resolver.js';
import '../../modules/abstract/common/abstract-api-provider.js';
import '../../utils/types/object.js';
import '../../utils/types/iterable.js';
import '../../utils/types/set.js';
import 'blake2b';
import '../../utils/types/bytes.js';
import '../../utils/interfaces.js';
import '../../utils/assert.js';
import '../../utils/error.js';
import '../../utils/types/string.js';
import '../../modules/abstract/common/abstract-base-module.js';
import '../../utils/ident/matchers.js';
import '../generic/const.js';

class DIDResolver extends Resolver {
  prefix = 'did';

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

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

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

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

    return document.toJSON();
  }
}

export { DIDResolver as default };
//# sourceMappingURL=did-resolver.js.map
