import{j as t,S as p,h as l,a1 as h,a2 as S,H as y,e as x,R as v,s as w}from"./vendor-ClLR6ncd.js";import{g,h as j,o as b,j as I,v as k}from"./lodash-ZyeDnt0e.js";import{d as B}from"./Add-CLrXAvOx.js";import{S as L,u as A,a as u,i as c}from"./initStatement-DliSOXN8.js";import{a as f}from"./configs-Cm_sEDXb.js";import{h as R,i as N,f as T,Y as _}from"./index-OtVJl4GC.js";import"./pluralize-BF8NJH6e.js";import"./highlightSearch-BTHB3jgf.js";import"./model-Dfrorm_S.js";import"./ui-DKzyPIqx.js";import{B as C}from"./Box-Co2WcNPC.js";import{u as D,A as E}from"./useDefaultMutationOptions-CUrzq21a.js";import{L as P}from"./Link-BLwKPJFF.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./WithMeasure-BDk9QPMF.js";import"./TableRow-CGDSOtFZ.js";import"./TableSortLabel-BJFq2axQ.js";import"./TypographyWithTooltip-BFAG3Va9.js";import"./useNamespaces-B-2wwTCG.js";import"./model-DgFcCvKB.js";import"./Autocomplete-Cjt7Q9VV.js";import"./Chip-DoCs8Smb.js";import"./Messages-BRmQDxrZ.js";import"./index-BpKmttxq.js";import"./model-mC-LLJuv.js";import"./DialogContent-DR8Wx7Lo.js";import"./DialogTitle-i0lt2jWQ.js";import"./DialogContentText-5YOBSelz.js";function U({disabled:e,statements:a,addStatement:o,updateStatement:n,removeStatement:r}){return t.jsxs(p,{spacing:1,children:[g(a,i=>t.jsx(L,{statement:i,updateStatement:n,statementInputs:f.map(s=>({...s,disabled:e})),Header:t.jsxs(p,{direction:"row",justifyContent:"space-between",children:[t.jsx(l,{variant:"h6",children:"New statement"}),t.jsx(h,{disabled:e,onClick:()=>r(i.id),children:t.jsx(S,{})})]})},i.id)),t.jsx(C,{sx:{alignSelf:"flex-end"},children:t.jsx(y,{startIcon:t.jsx(B,{}),onClick:o,disabled:e,children:"New input"})})]})}const m=c(),d={statements:{[m.id]:m},invalid:!0};function $(){const{search:e}=x(),a=new URLSearchParams(e),[o,n]=v.useState(a.has("field")&&a.has("value")?{statements:{[m.id]:{...m,[a.get("field")]:a.get("value")}},invalid:!0}:d);return{statements:o,removeStatement:s=>u(n,j(b,s)),addStatement:()=>{const s=c();return u(n,I(s.id,s))},updateStatement:A(n),resetStatements:()=>{n(d)}}}function q(e,a){return R((o,n)=>N({url:T(n,"statements"),method:"post",data:e.map(r=>f.map(({key:i})=>r[i]||null))}),D({onSuccess:()=>{a()}}))}function ft(){const{statements:e,resetStatements:a,removeStatement:o,addStatement:n,updateStatement:r}=$(),i=k(e.statements),s=q(i,a);return t.jsx(E,{actionTitle:"Input statements",description:t.jsxs(l,{sx:{whiteSpace:"pre-wrap"},children:[`To specify a node or literal in any of the four fields, use syntax resembling N-triples:
- <http://example.com/node20>
- "a literal with a \\n newline"
- "a literal with a type"^^<http://example.com/type2>
- a language tagged literal, such as this literal in French: "un littéral avec une langue"@fr
- rdf:type

Important notes:
- "rdf:type" only works if you have a namespace prefix 'rdf' defined.
- Unicode characters may be escaped, as "\\u00e9" in "littéral".
- Attributes must be `,t.jsx(P,{component:w,to:`../../${_.control}/attribute-definitions`,children:"defined"}),` before their usage.

Examples of invalid inputs:
- 1234 (must be a literal wrapped in double-quotes and optionally a type)
- <rdf:type> (must be either rdf:type or <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)

If you want to add multiple statements, click on the "+ NEW INPUT" button`]}),action:t.jsx(U,{disabled:s.isLoading,statements:e.statements,addStatement:n,updateStatement:r,removeStatement:o}),applyButtonTooltip:e.invalid?"Input statements are invalid":void 0,applyButtonLabel:"verify & import",applyButtonDisabled:e.invalid,mutation:s})}export{ft as default};
