"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react");exports.default=function(n){var r=t.useState(!1),o=r[0],s=r[1],a=t.useState([]),i=a[0],c=a[1],u=t.useState(null),l=u[0],p=u[1];return{fixAgentRules:function(t,r,o,a,i){return e.__awaiter(void 0,void 0,void 0,function(){var u,l,d,f,_,h,w;return e.__generator(this,function(x){switch(x.label){case 0:s(!0),c([]),p(null),u=e.__assign(e.__assign({},t),{wta:r.wta.map(function(e){return e.text}),wnta:r.wnta.map(function(e){return e.text}),mode:"AgentGenie",agent_description:a,agent_context:o,llm:i,n:1}),x.label=1;case 1:return x.trys.push([1,4,5,6]),[4,fetch("".concat(n,"/instant_learning/mode-wta-validation-fix"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)})];case 2:if(!(l=x.sent()).ok)throw new Error("API Error: ".concat(l.statusText));return[4,l.json()];case 3:return d=x.sent(),f=[],null===(h=d.response.conditions_whentoapply)||void 0===h||h.forEach(function(e){f.push({type:"wta",text:e.whentoapply,score:e.confidence_score,reason:e.reason})}),null===(w=d.response.conditions_whennottoapply)||void 0===w||w.forEach(function(e){f.push({type:"wnta",text:e.whennottoapply,score:e.confidence_score,reason:e.reason})}),c(f),[3,6];case 4:return _=x.sent(),console.error("Failed to fix rules:",_),p(_),[3,6];case 5:return s(!1),[7];case 6:return[2]}})})},isFixing:o,fixedSuggestions:i,error:l}};
//# sourceMappingURL=useAgentFix.js.map
