import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{O as t,P as n,b as r,u as i}from"./semantic-ui-react-m4AAKEby.js";import{f as a,m as o}from"./react-vendor-dEvHdx-C.js";import{t as s}from"./TooltipButton-BjMAnUHT.js";import"./Shared-UgWX_AkN.js";var c=e(o()),l=a();function u(){let[e,a]=(0,c.useState)(null),[o,u]=(0,c.useState)(``),[d,f]=(0,c.useState)(null),[p,m]=(0,c.useState)(``),h=e=>{let t=e?.response?.data;if(typeof t==`string`&&t.trim().length>0)return t;if(t!=null&&typeof t!=`string`)try{return JSON.stringify(t)}catch{return String(t)}return e?.message??String(e)};return(0,c.useEffect)(()=>{(async()=>{m(``);try{let e=await n.get(`/solid/status`);a(e.data)}catch(e){if(e?.response?.status===404){a({enabled:!1});return}m(h(e))}})()},[]),(0,l.jsxs)(t,{"data-testid":`solid-root`,children:[(0,l.jsx)(`h2`,{children:`Solid`}),e&&!e.enabled&&(0,l.jsx)(r,{warning:!0,children:`Solid integration is disabled (Feature.Solid=false).`}),e&&e.enabled&&(0,l.jsxs)(r,{info:!0,children:[`Client ID: `,(0,l.jsx)(`code`,{children:e.clientId}),(0,l.jsx)(`br`,{}),`Redirect path: `,(0,l.jsx)(`code`,{children:e.redirectPath})]}),p&&(0,l.jsx)(r,{negative:!0,children:p}),(0,l.jsxs)(i,{children:[(0,l.jsx)(i.Input,{label:`WebID`,placeholder:`https://example.com/profile/card#me`,value:o,onChange:e=>u(e.target.value),"data-testid":`solid-webid-input`}),(0,l.jsx)(s,{primary:!0,type:`button`,onClick:async()=>{m(``),f(null);try{let e=await n.post(`/solid/resolve-webid`,{webId:o});f(e.data)}catch(e){m(h(e))}},"data-testid":`solid-resolve-webid`,tooltip:`Resolve this WebID and show the Solid identity document returned by the server.`,children:`Resolve WebID`})]}),d&&(0,l.jsx)(t,{children:(0,l.jsx)(`pre`,{style:{whiteSpace:`pre-wrap`},children:JSON.stringify(d,null,2)})})]})}export{u as default};