import{b1 as p,j as r,h as a,S as n,H as d}from"./vendor-ClLR6ncd.js";import{L as h}from"./index-OtVJl4GC.js";import{C as x}from"./ui-BT12DGgR.js";import{W as g}from"./WarningMessage-4TK5GdCH.js";import{u as m}from"./model-DcIOZJyF.js";import"./lodash-ZyeDnt0e.js";import"./Warning-DsmyDRzF.js";function w(){const o=m(),{queryResult:e,isTableFetching:c}=p();if(c)return r.jsx(h,{});if((e==null?void 0:e._queryType)==="nl-query"&&Array.isArray(e==null?void 0:e.values)||(e==null?void 0:e._queryType)==="boolean-nl-query")return r.jsx(a,{sx:{color:"text.disabled",p:2,textAlign:"center"},children:"No critique available. Backend produced SPARQL query and results."});const t=e==null?void 0:e["failed-attempts"];return!Array.isArray(t)||t.length===0?r.jsx(a,{sx:{color:"text.disabled",p:2,textAlign:"center"},children:"SPARQL generation failed without explanation. Please change the natural language query and try again."}):r.jsxs(n,{p:2,spacing:1,children:[r.jsx(g,{text:"Backend generated several queries but none of them correct syntactically or semantically correct. Below are SPARQL queries and reason why they are incorrect:"}),t.map(({"SPARQL query":i,reason:l},s)=>r.jsxs(n,{spacing:1,children:[r.jsxs(n,{direction:"row",spacing:2,alignItems:"center",children:[r.jsxs(a,{fontWeight:"bold",children:[s+1,". SPARQL query:"]}),r.jsx(d,{variant:"outlined",onClick:()=>{o({local:i})},children:"insert in sparql editor"})]}),r.jsx(x,{style:{whiteSpace:"pre-wrap"},children:i}),r.jsx(a,{fontWeight:"bold",children:"Reason:"}),r.jsx(a,{whiteSpace:"pre-wrap",children:l})]},s))]})}export{w as default};
