var i=class{constructor(e={}){this.config=e,this.enabled=e.enabled!==!1,this.priority=e.priority||50}getName(){throw new Error("EventEnricher.getName() must be implemented")}canEnrich(e){return this.enabled}async enrich(e,a){throw new Error("EventEnricher.enrich() must be implemented")}handleError(e,a){return console.warn(`[${this.getName()}] Enrichment failed for event ${a.type}:`,e.message),null}};var u=class extends i{constructor(e={}){super(e),this.priority=200}getName(){return"MCPRef"}getPriority(){return this.priority}async enrich(e,a){let o=e.data?.params?.ref,l=e.data?.params?.element;if(!o&&!l)return null;let n=null,c=null,s=null;if(a?.element)try{let t=await a.element.evaluate(r=>({text:r.textContent?.trim()||"",innerText:r.innerText?.trim()||"",value:r.value||"",label:r.getAttribute("aria-label")||r.getAttribute("label")||"",role:r.getAttribute("role")||r.tagName.toLowerCase(),placeholder:r.getAttribute("placeholder")||"",title:r.getAttribute("title")||""}));n=t.text||t.innerText||t.value||t.placeholder,c=t.role,s=t.label||t.title,console.log(`[MCPRefEnricher] \u2705 Captured actual text: "${n}" (AI said: "${l}")`)}catch(t){console.log(`[MCPRefEnricher] \u26A0\uFE0F  Could not extract actual text: ${t.message}`)}return{mcpRef:o,mcpElement:l,actualText:n,actualRole:c,actualLabel:s,recordedSelector:n||l}}};export{u as MCPRefEnricher};
