import{a7 as y,j as e,a8 as D,R as L,S as p,h as b,s as f,H as i,a6 as A}from"./vendor-ClLR6ncd.js";import{d as M}from"./Add-CLrXAvOx.js";import{d as w}from"./CheckCircle-DkZpQ8Yc.js";import{d as H}from"./Edit-Bg-98YAB.js";import{d as O}from"./Delete-BD9BsoWc.js";import{L as $}from"./index-OtVJl4GC.js";import{E as k}from"./Messages-BRmQDxrZ.js";import{C as R}from"./CreateDialogContext-Buan56-U.js";import{D as E}from"./index-DY-IkI-n.js";import"./lodash-ZyeDnt0e.js";import{D as l}from"./ui-DEn7LX9m.js";import{u as q,a as z,s as W,S as F}from"./model-Cn8i8hm_.js";import{u as T,g as c,a as N}from"./model-AmaTU-rL.js";import{I as U}from"./InfiniteStackFlexWrap-AXya9Nnx.js";import{C as B}from"./Card-DCyqxUVE.js";import{C as G}from"./CardContent-B36bxiGw.js";import{C as J}from"./CardActions-DbEyUhB8.js";import"./DialogContent-DR8Wx7Lo.js";import"./DialogTitle-i0lt2jWQ.js";import"./WarningMessage-4TK5GdCH.js";import"./Warning-DsmyDRzF.js";import"./Box-Co2WcNPC.js";import"./Link-BLwKPJFF.js";import"./ui-BOPU8Yl4.js";import"./index-CQ79H_Lz.js";import"./WithMeasure-BDk9QPMF.js";var h={},K=D;Object.defineProperty(h,"__esModule",{value:!0});var P=h.default=void 0,Y=K(y()),Q=e;P=h.default=(0,Y.default)((0,Q.jsx)("path",{d:"M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.9959.9959 0 0 0-1.41 0L1.29 18.96c-.39.39-.39 1.02 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05c.39-.39.39-1.02 0-1.41zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12z"}),"AutoFixHigh");var j={},X=D;Object.defineProperty(j,"__esModule",{value:!0});var I=j.default=void 0,Z=X(y()),V=e;I=j.default=(0,Z.default)((0,V.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");const{useDialogContext:C,DialogContextProvider:ee}=R();function te({mutation:t,multipleMutation:r}){var n;const o=C(),a=o.openParameter&&!Array.isArray(o.openParameter);return e.jsx(E,{...o,dialogTitle:"Delete index",dialogBodyMessage:a?`Do you want to delete SHACL shape ${c(o.openParameter)} permanently?`:`Do you want to delete ${(n=o.openParameter)==null?void 0:n.length} SHACL shape(s) permanently?`,submitTitle:"Delete",onSubmit:a?t.mutate:r.mutate})}function oe({shaclShape:t,selection:r,setSelection:o}){const{open:a,openParameter:n}=C(),s=!!n,u=JSON.stringify(t,null,2),m=r[c(t)]!==void 0,S=Object.keys(r).length!==0;return e.jsxs(B,{sx:{width:450},children:[e.jsx(A,{title:W(t),sx:{overflowY:"auto",pb:1,"& .MuiCardHeader-content":{flexShrink:0}}}),e.jsx(G,{sx:{pt:0,pb:0,display:"flex",flexDirection:"column",gap:1,height:"27vh",overflow:"auto"},children:e.jsx(F,{readOnly:!0,value:u})}),e.jsxs(J,{disableSpacing:!0,children:[e.jsx(l,{Component:i,componentProps:{disabled:s,startIcon:m?e.jsx(w,{}):e.jsx(I,{}),onClick:()=>{o(x=>{const g=c(t);return m?Object.assign({},...Object.keys(x).filter(d=>d!==g).map(d=>({[d]:x[d]}))):{...x,[g]:{shape:t}}})}},children:m?"selected":"select"}),e.jsx(l,{Component:i,componentProps:{disabled:s||S,component:f,to:`./edit/${encodeURIComponent(N(t))}`,relative:"path",startIcon:e.jsx(H,{})},children:"edit"}),e.jsx(l,{Component:i,componentProps:{disabled:s,color:"error",startIcon:e.jsx(O,{}),onClick:()=>{a(S?Object.values(r):t)}},children:"delete"})]})]})}const re=(t,r)=>c(r);function ae({selection:t,setSelection:r}){const{query:o,fullUri:a}=_(),n=L.useCallback((s,u)=>e.jsx(oe,{fullUri:a,shaclShape:u,selection:t,setSelection:r},s),[a,t,r]);return o.isSuccess?o.data.length===0?e.jsx(b,{children:"No SHACL shapes defined yet"}):e.jsx(U,{data:o.data,isFetchingNextPage:!1,computeItemKey:re,itemContent:n}):e.jsx($,{})}function v(t,r){const o=C();return t(o.openParameter,()=>{o.resetOpenParameter(),r({})})}function _(){return{fullUri:!1,node:null,query:T()}}function ne(){const[t,r]=L.useState({}),o=v(z,r),a=v(q,r),{node:n}=_();return e.jsxs(p,{spacing:2,sx:{flexGrow:1},children:[e.jsx(te,{mutation:o,multipleMutation:a}),e.jsxs(p,{direction:"row",justifyContent:"space-between",children:[e.jsxs(p,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(b,{noWrap:!0,variant:"h4",children:"SHACL Shapes"}),e.jsx("div",{style:{minWidth:"154px"},children:n})]}),e.jsxs(p,{direction:"row",spacing:2,children:[e.jsx(l,{Component:i,componentProps:{variant:"outlined",sx:{alignSelf:"flex-start"},component:f,to:"./new",relative:"path",startIcon:e.jsx(M,{})},children:"Add new SHACL shape"}),e.jsx(l,{Component:i,componentProps:{variant:"contained",sx:{alignSelf:"flex-start"},component:f,to:"./generate",relative:"path",startIcon:e.jsx(P,{})},children:"Generate SHACL shapes"})]})]}),e.jsx(k,{error:o.error,resetError:o.reset}),e.jsx(ae,{selection:t,setSelection:r})]})}function He(){return e.jsx(ee,{children:e.jsx(ne,{})})}export{He as default};
