

const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
const require_JsonTransformer = require('../../../../utils/JsonTransformer.js');
const require_DidDocument = require('../../domain/DidDocument.js');
require('../../domain/index.js');
let did_resolver = require("did-resolver");
did_resolver = require_rolldown_runtime.__toESM(did_resolver);
let web_did_resolver = require("web-did-resolver");
web_did_resolver = require_rolldown_runtime.__toESM(web_did_resolver);

//#region src/modules/dids/methods/web/WebDidResolver.ts
var WebDidResolver = class {
	constructor() {
		this.allowsCaching = true;
		this.allowsLocalDidRecord = true;
		this._resolverInstance = new did_resolver.Resolver();
		this.resolver = web_did_resolver.getResolver();
		this.supportedMethods = Object.keys(this.resolver);
	}
	async resolve(_agentContext, did, parsed, didResolutionOptions) {
		const result = await this.resolver[parsed.method](did, parsed, this._resolverInstance, didResolutionOptions);
		let didDocument = null;
		if (!result.didDocument?.verificationMethod && result.didDocument?.publicKey) result.didDocument.verificationMethod = result.didDocument.publicKey;
		if (result.didDocument) didDocument = require_JsonTransformer.JsonTransformer.fromJSON(result.didDocument, require_DidDocument.DidDocument);
		return {
			...result,
			didDocument
		};
	}
};

//#endregion
exports.WebDidResolver = WebDidResolver;