const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
const require_xpath$1 = require('../node_modules/xpath/xpath.cjs');
const require_index = require('../../@xmldom/is-dom-node/dist/index.cjs');

//#region ../../node_modules/xml-crypto/lib/enveloped-signature.js
var require_enveloped_signature = /* @__PURE__ */ require_rolldown_runtime.__commonJS({ "../../node_modules/xml-crypto/lib/enveloped-signature.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	exports.EnvelopedSignature = void 0;
	const xpath = require_xpath$1.default;
	const isDomNode = require_index.default;
	var EnvelopedSignature = class {
		constructor() {
			this.includeComments = false;
			this.includeComments = false;
		}
		process(node, options) {
			if (null == options.signatureNode) {
				const signature = xpath.select1("./*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']", node);
				if (isDomNode.isNodeLike(signature) && signature.parentNode) signature.parentNode.removeChild(signature);
				return node;
			}
			const signatureNode = options.signatureNode;
			const expectedSignatureValue = xpath.select1(".//*[local-name(.)='SignatureValue']/text()", signatureNode);
			if (isDomNode.isTextNode(expectedSignatureValue)) {
				const expectedSignatureValueData = expectedSignatureValue.data;
				const signatures = xpath.select(".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']", node);
				for (const nodeSignature of Array.isArray(signatures) ? signatures : []) {
					const signatureValue = xpath.select1(".//*[local-name(.)='SignatureValue']/text()", nodeSignature);
					if (isDomNode.isTextNode(signatureValue)) {
						if (expectedSignatureValueData === signatureValue.data) {
							if (nodeSignature.parentNode) nodeSignature.parentNode.removeChild(nodeSignature);
						}
					}
				}
			}
			return node;
		}
		getAlgorithmName() {
			return "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
		}
	};
	exports.EnvelopedSignature = EnvelopedSignature;
}) });

//#endregion
Object.defineProperty(exports, 'default', {
  enumerable: true,
  get: function () {
    return require_enveloped_signature();
  }
});
//# sourceMappingURL=enveloped-signature.cjs.map