import{r as R}from"./index.5e96dbf3.js";import{u as g}from"./log.812f9d15.js";import{F as q,R as x}from"./broker.0b03ffc6.js";import{d as S,v as B,R as w,K as f,z as o,b as s,c as u,e as K,t as b,J as E,H as L,O as N,Q as O,x as d,q as T}from"./registerWidgets.ad696c68.js";import{D as F,n as C}from"./DashPlayer.f08ddbe4.js";import{a as V}from"./asyncComputed.40a67fe8.js";import{r as j,n as z}from"./runnerData.50606928.js";import{L as A}from"./CircularLoading.1b0ceab6.js";import"./passwordlessManager.86ad8b48.js";import"./icons.1c1f9d53.js";import"./ActionButton.vue_vue_type_script_setup_true_lang.a0f7f94d.js";import"./Passwordless.896adb7f.js";import"./executeJs.5aebf107.js";import"./PlayerNavbar.049fd037.js";import"./WidgetsFrame.afffe632.js";import"./colors.698f0f3f.js";import"./Modal.d606972f.js";import"./lottie.d1a83079.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="0f897fb5-0fc6-432a-9e84-ce210b5854aa",a._sentryDebugIdIdentifier="sentry-dbid-0f897fb5-0fc6-432a-9e84-ce210b5854aa")}catch{}})();async function H(a){const e=await fetch(`/_api/${a}`);if(e.status==404)return null;if(!e.ok)throw new Error(await e.text());const{form:n,dash:c}=await e.json();return{form:n&&j(n),dash:c&&z(c)}}const p=a=>(N("data-v-7a49cef6"),a=a(),O(),a),J={key:0,class:"loading"},Q={key:1,class:"error"},$=p(()=>d("h1",null,"Oops! Something went wrong",-1)),G=p(()=>d("p",null,"An unknown error ocurred. Please try again or contact support.",-1)),M=[$,G],U={key:2,class:"form"},W={key:3,class:"dash-wrapper"},X={key:4,class:"error not-found"},Y=p(()=>d("h1",null,"Page not found",-1)),Z=p(()=>d("p",null,"The page you requested could not be found.",-1)),ee=[Y,Z],te=S({__name:"Player",setup(a){const e=E(),n=L(),c=B({playerKey:g()}),m=({path:t})=>{n.push({name:"player",query:e.query,params:{path:t.split("/")}})},_=async()=>{c.playerKey=g()};w([()=>e.path,()=>e.query],()=>_());const{loading:k,result:r,error:D}=V(()=>{var t;return H((t=e.path.slice(1))!=null?t:"")}),y=f(()=>i.value?x.create({isLocal:!1,isPreview:!1,formPath:i.value.path}):null),i=f(()=>{var t,l;return(l=(t=r.value)==null?void 0:t.form)!=null?l:null}),h=f(()=>{var l,v;if(!((l=r.value)!=null&&l.dash))return null;const t=C.create((v=r.value)==null?void 0:v.dash,!1);return t.onRedirect(({url:P,queryParams:I})=>R(n,P,I)),t});return w(r,()=>{var t;!r.value||(r.value.form?document.title=(t=r.value.form.welcomeTitle)!=null?t:r.value.form.title:r.value.dash&&(document.title=r.value.dash.title))}),(t,l)=>o(k)?(s(),u("div",J,[K(A)])):o(D)?(s(),u("div",Q,M)):o(i)&&o(y)?(s(),u("div",U,[(s(),b(q,{key:c.playerKey,class:"player",form:o(i),params:o(e).query,broker:o(y),"enable-auto-focus":!0,onNavigate:m,onLogout:_},null,8,["form","params","broker"]))])):o(h)?(s(),u("div",W,[(s(),b(F,{key:c.playerKey,class:"player","is-preview":!1,params:o(e).query,"dash-player-state":o(h),onNavigate:m},null,8,["params","dash-player-state"]))])):(s(),u("div",X,ee))}});const we=T(te,[["__scopeId","data-v-7a49cef6"]]);export{we as default};
//# sourceMappingURL=Player.ff90ee4a.js.map
