import { __commonJS } from "../../../_virtual/rolldown_runtime.mjs";
import { require_xpath } from "../node_modules/xpath/xpath.mjs";
import { require_dist } from "../../@xmldom/is-dom-node/dist/index.mjs";

//#region ../../node_modules/xml-crypto/lib/enveloped-signature.js
var require_enveloped_signature = /* @__PURE__ */ __commonJS({ "../../node_modules/xml-crypto/lib/enveloped-signature.js": ((exports) => {
	Object.defineProperty(exports, "__esModule", { value: true });
	exports.EnvelopedSignature = void 0;
	const xpath = require_xpath();
	const isDomNode = require_dist();
	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
export default require_enveloped_signature();

export { require_enveloped_signature };
//# sourceMappingURL=enveloped-signature.mjs.map