import{e as u,n as S,G as l,a as y,K as c}from"./index-DjCrtoJM.js";function w(o,a){const e=u.c(8);let s;e[0]!==o?(s=c.orgSsoStatus(o??""),e[0]=o,e[1]=s):s=e[1];let t;e[2]!==a?(t=async()=>{const r=await fetch(`/api/${a}/sso/status`);if(!r.ok)throw new Error("Failed to check SSO status");return r.json()},e[2]=a,e[3]=t):t=e[3];const n=!!o&&!!a;let i;return e[4]!==s||e[5]!==t||e[6]!==n?(i={queryKey:s,queryFn:t,enabled:n},e[4]=s,e[5]=t,e[6]=n,e[7]=i):i=e[7],S(i)}function q(o,a){const e=u.c(8);let s;e[0]!==o?(s=c.orgSsoConfig(o??""),e[0]=o,e[1]=s):s=e[1];let t;e[2]!==a?(t=async()=>{const r=await fetch(`/api/${a}/sso/config`);if(!r.ok)throw new Error("Failed to fetch SSO config");return r.json()},e[2]=a,e[3]=t):t=e[3];const n=!!o&&!!a;let i;return e[4]!==s||e[5]!==t||e[6]!==n?(i={queryKey:s,queryFn:t,enabled:n},e[4]=s,e[5]=t,e[6]=n,e[7]=i):i=e[7],S(i)}function C(o,a){const e=u.c(8),s=l();let t;e[0]!==a?(t=async r=>{const f=await fetch(`/api/${a}/sso/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!f.ok){const p=await f.json();throw new Error(p.error||"Failed to save SSO config")}return f.json()},e[0]=a,e[1]=t):t=e[1];let n;e[2]!==o||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(o)}),s.invalidateQueries({queryKey:c.orgSsoStatus(o)})},e[2]=o,e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==t||e[6]!==n?(i={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=i):i=e[7],y(i)}function O(o,a){const e=u.c(8),s=l();let t;e[0]!==a?(t=async()=>{const r=await fetch(`/api/${a}/sso/config`,{method:"DELETE"});if(!r.ok)throw new Error("Failed to delete SSO config");return r.json()},e[0]=a,e[1]=t):t=e[1];let n;e[2]!==o||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(o)}),s.invalidateQueries({queryKey:c.orgSsoStatus(o)})},e[2]=o,e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==t||e[6]!==n?(i={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=i):i=e[7],y(i)}function m(o,a){const e=u.c(8),s=l();let t;e[0]!==a?(t=async r=>{const f=await fetch(`/api/${a}/sso/config/enforce`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enforced:r})});if(!f.ok)throw new Error("Failed to toggle SSO enforcement");return f.json()},e[0]=a,e[1]=t):t=e[1];let n;e[2]!==o||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(o)}),s.invalidateQueries({queryKey:c.orgSsoStatus(o)})},e[2]=o,e[3]=s,e[4]=n):n=e[4];let i;return e[5]!==t||e[6]!==n?(i={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=i):i=e[7],y(i)}export{q as a,C as b,O as c,m as d,w as u};
