const E=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),v=function(e,t){return new URL(e,t).href},h={},a=function(t,n,m){let f=Promise.resolve();if(n&&n.length>0){let c=function(o){return Promise.all(o.map(s=>Promise.resolve(s).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};const r=document.getElementsByTagName("link"),w=document.querySelector("meta[property=csp-nonce]"),p=w?.nonce||w?.getAttribute("nonce");f=c(n.map(o=>{if(o=v(o,m),o in h)return;h[o]=!0;const s=o.endsWith(".css"),u=s?'[rel="stylesheet"]':"";if(!!m)for(let l=r.length-1;l>=0;l--){const d=r[l];if(d.href===o&&(!s||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${u}`))return;const i=document.createElement("link");if(i.rel=s?"stylesheet":E,s||(i.as="script"),i.crossOrigin="",i.href=o,p&&i.setAttribute("nonce",p),document.head.appendChild(i),s)return new Promise((l,d)=>{i.addEventListener("load",l),i.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})}))}function _(c){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=c,window.dispatchEvent(r),!r.defaultPrevented)throw c}return f.then(c=>{for(const r of c||[])r.status==="rejected"&&_(r.reason);return t().catch(_)})};let y={};function g(){return y}function A(e){y=e}async function P(){document.body.insertAdjacentHTML("beforeend",(await a(async()=>{const{default:t}=await import("./assets/login-animation-C19mPA3E.js");return{default:t}},[],import.meta.url)).default);const e=document.createElement("script");e.type="module",e.textContent=(await a(async()=>{const{default:t}=await import("./assets/login-animation-BGaBQ_p9.js");return{default:t}},[],import.meta.url)).default,document.body.insertAdjacentElement("beforeend",e),await new Promise(t=>setTimeout(t,3500))}async function L(){await P();const{useAuth:e}=await a(async()=>{const{useAuth:t}=await import("./assets/use-auth-BXZ-WjP0.js").then(n=>n.i);return{useAuth:t}},[],import.meta.url);await e().openLoginPage()}async function R(){const e=new URL(window.location.href);if(e.searchParams.get("code")&&e.searchParams.get("state")){const{useAuth:t}=await a(async()=>{const{useAuth:n}=await import("./assets/use-auth-BXZ-WjP0.js").then(m=>m.i);return{useAuth:n}},[],import.meta.url);await t().requestAuth()}else await Promise.reject(new Error("error in requestAuth"))}async function C(){if(localStorage.getItem("wysiwyg-auth"))try{const{isConfigValid:e}=await a(async()=>{const{isConfigValid:n}=await import("./assets/check-config-Kxf7eIh-.js");return{isConfigValid:n}},[],import.meta.url);e(g()),(await a(()=>import("./assets/wysiwyg-layer-BKaKmIMf.js").then(n=>n.z),[],import.meta.url)).openApp()}catch(e){await Promise.reject(e)}}async function T(){localStorage.getItem("wysiwyg-auth")&&(await a(()=>import("./assets/wysiwyg-layer-BKaKmIMf.js").then(t=>t.z),[],import.meta.url)).closeApp()}async function I(e){if(localStorage.getItem("wysiwyg-auth")){const{useContext:t}=await a(async()=>{const{useContext:n}=await import("./assets/use-context-C_06QeWJ.js");return{useContext:n}},[],import.meta.url);t().setContext(e)}}const S={close:T,goToLogin:L,open:C,requestAuth:R,setConfig:A,getConfig:g,setContext:I};window.wysiwyg=S;export{a as _,g};