import{ax as u,g,o as k,b as y,A as _,z as h,r as A,L as v,M as R}from"./_plugin-vue_export-helper-DC3K5mG-.js";import{R as T}from"./RestrictedAuth-CgICmToz.js";import"./pow-DUr-T9XX.js";function l(){const o=new URLSearchParams(location.hash.slice(1));return g()||o.get("theme")||""}u(l());addEventListener("hashchange",()=>u(l()));const x={__name:"RestrictedApi",setup(o){const c=A(null),p=window.location.search.includes("client_id=")?window.location.search:null;function m(){const a=window.location.pathname.match(/\/auth\/([^/]+)$/);if(a){const s=a[1],d=s.split(".");if(d.length===5&&d.every(f=>f.length>0))return s}return null}const i=new URLSearchParams(window.location.hash.slice(1));let t;window.location.pathname==="/auth/restricted/oidc"?t="oidc":t=["reauth","forbidden"].includes(i.get("mode"))?i.get("mode"):"login";function n(e){window.parent&&window.parent!==window&&window.parent.postMessage(e,"*")}function w(e){if(e.redirect_url){window.location.href=e.redirect_url;return}n({type:"auth-success",authenticated:!0,exchangeCode:e.exchange_code})}function r(){n({type:"auth-back"})}return k(()=>{c.value=m(),n({type:"auth-ready"}),window.addEventListener("keydown",e=>{e.key==="Escape"&&r()})}),(e,a)=>(y(),_(T,{mode:h(t),"remote-auth-token":c.value,"oidc-query-string":h(p),onAuthenticated:w,onBack:r},null,8,["mode","remote-auth-token","oidc-query-string"]))}};v(x).mount("#app");R();
