1import{a as z,r as l,s as v,j as e,C as j,a3 as p,a4 as w,W as N,S,bg as _,e as b}from"./index-DtAltElw.js";const o=v.auth.oauth;function k(){var x;const[C]=z(),n=C.get("authorization_id")??"",[i,y]=l.useState(null),[d,a]=l.useState(null),[h,u]=l.useState(!1);l.useEffect(()=>{let r=!0;return(async()=>{if(!n){a("Missing authorization_id");return}const{data:t}=await v.auth.getSession();if(!t.session){const A=window.location.pathname+window.location.search;window.location.href="/dashboard/login?next="+encodeURIComponent(A);return}if(!o){a("OAuth server not configured on this project.");return}const{data:s,error:c}=await o.getAuthorizationDetails(n);if(!r)return;if(c){a(c.message);return}const g=(s==null?void 0:s.redirect_url)??(s==null?void 0:s.redirect_to);if(g&&!(s!=null&&s.client)){window.location.href=g;return}y(s)})(),()=>{r=!1}},[n]);async function m(r){if(!o)return;u(!0);const{data:t,error:s}=r?await o.approveAuthorization(n):await o.denyAuthorization(n);if(s){u(!1),a(s.message);return}const c=(t==null?void 0:t.redirect_url)??(t==null?void 0:t.redirect_to);if(!c){u(!1),a("No redirect returned by the authorization server.");return}window.location.href=c}if(d)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-muted/30 p-4",children:e.jsxs(j,{className:"max-w-md w-full",children:[e.jsx(p,{children:e.jsx(w,{children:"Autorisierung nicht möglich"})}),e.jsx(N,{className:"text-sm text-muted-foreground",children:d})]})});if(!i)return e.jsx("div",{className:"p-8 text-center text-sm text-muted-foreground",children:"Lädtâ¦"});const f=((x=i.client)==null?void 0:x.name)??"Externer Client";return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-muted/30 p-4",children:e.jsxs(j,{className:"max-w-md w-full",children:[e.jsxs(p,{children:[e.jsxs(w,{className:"flex items-center gap-2",children:[e.jsx(S,{className:"h-5 w-5 text-primary"})," ",f," verbinden"]}),e.jsxs(_,{children:[f," möchte in Ihrem Namen auf Liefersoft LAB zugreifen. Der Zugriff ist auf Ihre Rechte beschränkt (Row Level Security)."]})]}),e.jsxs(N,{className:"space-y-3",children:[i.scopes&&i.scopes.length>0&&e.jsxs("div",{className:"text-xs",children:[e.jsx("div",{className:"font-medium mb-1",children:"Angefragte Berechtigungen:"}),e.jsx("ul",{className:"list-disc pl-5 text-muted-foreground",children:i.scopes.map(r=>e.jsx("li",{children:r},r))})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(b,{variant:"outline",className:"flex-1",disabled:h,onClick:()=>m(!1),children:"Ablehnen"}),e.jsx(b,{className:"flex-1",disabled:h,onClick:()=>m(!0),children:"Zulassen"})]})]})]})})}export{k as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.