var h=Object.defineProperty;var y=(r,t,e)=>t in r?h(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var o=(r,t,e)=>(y(r,typeof t!="symbol"?t+"":t,e),e);import{g as d,h as l,_ as p,S as c,q as b}from"./outputWidgets.a4629ff8.js";import{P as g}from"./pubsub.25dc8c41.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[t]="3b838f44-b2cc-404b-8877-5fa6bf63ef97",r._sentryDebugIdIdentifier="sentry-dbid-3b838f44-b2cc-404b-8877-5fa6bf63ef97")}catch{}})();const w=[{path:"/:path(.*)*",name:"player",component:()=>p(()=>import("./Player.958af7b3.js"),["assets/Player.958af7b3.js","assets/outputWidgets.a4629ff8.js","assets/outputWidgets.e8fba759.css","assets/index.339c7421.js","assets/executeJs.559e86f5.js","assets/runnerData.83399038.js","assets/url.d6a620b9.js","assets/icons.73bff2ab.js","assets/CircularLoading.79e4a789.js","assets/CircularLoading.f81b57b4.css","assets/PlayerNavbar.403ee6e8.js","assets/PlayerNavbar.76a7eb2f.css","assets/Steps.dce825a5.js","assets/Steps.998aa76d.css","assets/executeJs.acda9a57.css","assets/uuid.af431a29.js","assets/FormRunner.332769c0.js","assets/WidgetsFrame.893465cb.js","assets/WidgetsFrame.0816a5f5.css","assets/ActionButton.vue_vue_type_script_setup_true_lang.b200fdcb.js","assets/FormRunner.49d66771.css","assets/index.97c2f464.js","assets/geometryUtils.6cff4208.js","assets/pubsub.25dc8c41.js","assets/index.b0953bcd.css","assets/asyncComputed.fb8b9ba6.js","assets/Player.77337a17.css"])}],T=d({history:l("/"),routes:w,scrollBehavior(r){if(r.hash)return{el:r.hash}}}),i=class{constructor(t,e){this.providerConfig=t,this.userManager=e}static async init(t,e){i.instance=new i(t,e)}get provider(){return this.providerConfig.provider}async authenticate(t){try{const e=await fetch(`${this.providerConfig.authority}/authenticate`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:t})});if(!e.ok)throw new Error(await e.text());return null}catch(e){return e.message}}async verify(t,e){const u=await fetch(`${this.providerConfig.authority}/verify`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({email:t,token:e})});if(!u.ok)return null;const f=await u.json();return this.userManager.saveJWT(f.jwt),this.userManager.getUser()}};let n=i;o(n,"instance",null);const s=class{constructor(t=new g){this.pubsub=t}saveJWT(t){c.set(s.key,t),this.notify()}notify(){const t=this.getUser();this.pubsub.publish("authenticated",t)}getJWT(){return c.get(s.key)}getUser(){const t=this.getJWT();if(t)try{const e=b(t);if(e.exp&&e.exp>Date.now()/1e3)return{jwt:t,claims:e}}catch{console.warn("Invalid JWT")}return null}removeUser(){this.pubsub.publish("authenticated",null),c.remove(s.key)}};let a=s;o(a,"key","abstra:auth:jwt");const v=new a;async function _(){const r=await fetch("/_auth/config");if(!r.ok)throw new Error(await r.text());const t=await r.json();await n.init(t,v)}export{n as A,T as a,v as b,w as r,_ as u};
//# sourceMappingURL=index.cecf191d.js.map
