const g=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),E=function(e,t){return new URL(e,t).href},w={},a=function(t,n,l){let d=Promise.resolve();if(n&&n.length>0){const s=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),_=o?.nonce||o?.getAttribute("nonce");d=Promise.allSettled(n.map(r=>{if(r=E(r,l),r in w)return;w[r]=!0;const c=r.endsWith(".css"),y=c?'[rel="stylesheet"]':"";if(!!l)for(let u=s.length-1;u>=0;u--){const m=s[u];if(m.href===r&&(!c||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${r}"]${y}`))return;const i=document.createElement("link");if(i.rel=c?"stylesheet":g,c||(i.as="script"),i.crossOrigin="",i.href=r,_&&i.setAttribute("nonce",_),document.head.appendChild(i),c)return new Promise((u,m)=>{i.addEventListener("load",u),i.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${r}`)))})}))}function f(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return d.then(s=>{for(const o of s||[])o.status==="rejected"&&f(o.reason);return t().catch(f)})};let p={};function h(){return p}function A(e){p=e}async function v(){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 P(){await v();const{useAuth:e}=await a(async()=>{const{useAuth:t}=await import("./assets/use-auth-C6VEirDS.js").then(n=>n.p);return{useAuth:t}},[],import.meta.url);await e().openLoginPage()}async function L(){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-C6VEirDS.js").then(l=>l.p);return{useAuth:n}},[],import.meta.url);await t().requestAuth()}else await Promise.reject(new Error("error in requestAuth"))}async function R(){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(h()),(await a(()=>import("./assets/wysiwyg-layer-BBHwuX3M.js").then(n=>n.w),[],import.meta.url)).openApp()}catch(e){await Promise.reject(e)}}async function C(){localStorage.getItem("wysiwyg-auth")&&(await a(()=>import("./assets/wysiwyg-layer-BBHwuX3M.js").then(t=>t.w),[],import.meta.url)).closeApp()}async function T(e){if(localStorage.getItem("wysiwyg-auth")){const{useContext:t}=await a(async()=>{const{useContext:n}=await import("./assets/use-context-CrOz8dju.js");return{useContext:n}},[],import.meta.url);t().setContext(e)}}const I={close:C,goToLogin:P,open:R,requestAuth:L,setConfig:A,getConfig:h,setContext:T};window.wysiwyg=I;export{a as _,h as g};