import{u as C}from"./index.5912e808.js";import{d as F,eE as R,eK as A,I as L,r as b,K as x,ax as B,o as W,O as q,b as i,ew as _,u as r,c as k,eC as K,eD as M,e as d,x as P}from"./outputWidgets.6e1c5425.js";import{b as V,r as T,c as N,d as O}from"./FormRunner.327c7497.js";import{a as j}from"./asyncComputed.06ede41f.js";import{u as D}from"./uuid.c8718262.js";import{L as z}from"./CircularLoading.f493f8ac.js";import{f as G}from"./api.eb323d7c.js";import"./fetch.d2d3ed34.js";import"./pubsub.4f3043c8.js";import"./url.5357e9db.js";import"./Login.vue_vue_type_script_setup_true_lang.b3cb44e1.js";import"./Link.5b1de2a9.js";import"./Base.0277cf44.js";import"./index.0b7245cc.js";import"./PhArrowClockwise.vue.ce26992a.js";import"./Steps.3b1b1a45.js";import"./PhInfo.vue.74926ceb.js";import"./Card.8d975aac.js";import"./TabPane.6f71397e.js";import"./hasIn.bf07751b.js";import"./runnerData.dbd7d7cb.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},u=new Error().stack;u&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[u]="b2cfd1b6-c5c5-4325-9448-70e5ba8ee44f",n._sentryDebugIdIdentifier="sentry-dbid-b2cfd1b6-c5c5-4325-9448-70e5ba8ee44f")}catch{}})();const p=n=>(K("data-v-ab591a6a"),n=n(),M(),n),H={class:"center"},J={key:1,class:"error"},Q=p(()=>d("h1",null,"Oops! Something went wrong",-1)),X=p(()=>d("p",null,"An unknown error ocurred. Please try again or contact support.",-1)),Y=[Q,X],Z={key:3,class:"error not-found"},$=p(()=>d("h1",null,"Page not found",-1)),ee=p(()=>d("p",null,"The page you requested could not be found.",-1)),te=[$,ee],oe=F({__name:"Form",setup(n){const u=R(),m=A(),h=L({playerKey:D()}),c=b(null),f=b(null);x(u,()=>I());const{loading:S,result:t,error:E,refetch:I}=j(async()=>{h.playerKey=D();const o=u.path.slice(1),e=await G(o);if(!e)return null;const s=new N({formRunnerData:e,queryParams:u.query,userManager:C,logService:null,connectionManager:new O(e.id,"player"),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:a=>f.value=a,onStackTraceUpdate:null,onStateUpdate:a=>c.value=a}),l=s.getState();return f.value=l.passwordlessUser,c.value=l.formState,{runnerData:e,controller:s}});B(()=>{var o,e,s,l,a;!((o=t.value)!=null&&o.runnerData)||(e=t.value)!=null&&e.runnerData&&(document.title=(a=(s=t.value)==null?void 0:s.runnerData.welcomeTitle)!=null?a:(l=t.value)==null?void 0:l.runnerData.title)});function v(o,e){T("player",m,o,e)}const U=({path:o})=>{m.push({name:"form",query:u.query,params:{path:o.split("/")}})};W(async()=>{var e;!((e=window.should_ask_before_leave)==null||e)||window.addEventListener("beforeunload",y)}),q(()=>{window.removeEventListener("beforeunload",y)});const y=o=>{var e;if((e=t.value)!=null&&e.controller.handleCloseAttempt())return o.preventDefault(),""};return(o,e)=>{var s,l,a,g,w;return i(),_("div",H,[r(S)?(i(),k(z,{key:0,class:"loading"})):r(E)||r(t)===null||c.value===null?(i(),_("div",J,Y)):r(t)&&r(t).runnerData?(i(),k(V,{class:"player form",key:h.playerKey,"form-runner-data":r(t).runnerData,"form-state":c.value,"is-preview":!1,"user-email":(s=f.value)==null?void 0:s.claims.email,onNavigate:U,onRedirect:v,onActionClicked:(l=r(t))==null?void 0:l.controller.handleActionClick,onUpdateWidgetErrors:(a=r(t))==null?void 0:a.controller.updateWidgetFrontendErrors,onUpdateWidgetValue:(g=r(t))==null?void 0:g.controller.updateWidgetValue,onLogout:(w=r(t))==null?void 0:w.controller.logout},null,8,["form-runner-data","form-state","user-email","onActionClicked","onUpdateWidgetErrors","onUpdateWidgetValue","onLogout"])):(i(),_("div",Z,te))])}}});const Se=P(oe,[["__scopeId","data-v-ab591a6a"]]);export{Se as default};
//# sourceMappingURL=Form.41fe111c.js.map
