import{u as E}from"./index.6db17c6b.js";import{d as I,eE as U,eK as C,I as F,r as g,K as R,ax as A,o as L,O as x,u as n,b as u,ew as d,f as B,c as W,eC as q,eD as K,e as p,x as V}from"./outputWidgets.eb498848.js";import{b as M,r as P,c as N,d as T}from"./FormRunner.c1be8465.js";import{a as O}from"./asyncComputed.6b2a5298.js";import{u as w}from"./uuid.b89c56bf.js";import{L as j}from"./CircularLoading.cf62d2dd.js";import{f as z}from"./api.e416522b.js";import"./fetch.fcae2051.js";import"./pubsub.1ca1fb40.js";import"./url.1d686ce1.js";import"./Login.vue_vue_type_script_setup_true_lang.4e924163.js";import"./Link.32e09244.js";import"./Base.60455d70.js";import"./index.d4197b75.js";import"./PlayerNavbar.f03d8458.js";import"./PhKanban.vue.7f700aad.js";import"./PhSignOut.vue.91be2cfd.js";import"./Text.c3630863.js";import"./index.9769729d.js";import"./Paragraph.82d8120c.js";import"./Title.ef0a0830.js";import"./index.c6702b27.js";import"./WidgetsFrame.81c1eb3e.js";import"./Steps.c1ea3740.js";import"./PhInfo.vue.740bbbe0.js";import"./Card.70a00c39.js";import"./TabPane.73c86943.js";import"./hasIn.ceb11556.js";import"./runnerData.c01bfcd7.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},l=new Error().stack;l&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[l]="47418b8f-fc8c-4d05-8f8f-e91099979917",r._sentryDebugIdIdentifier="sentry-dbid-47418b8f-fc8c-4d05-8f8f-e91099979917")}catch{}})();const m=r=>(q("data-v-4bf1c184"),r=r(),K(),r),G={key:0,class:"loading"},H={key:1,class:"error"},J=m(()=>p("h1",null,"Oops! Something went wrong",-1)),Q=m(()=>p("p",null,"An unknown error ocurred. Please try again or contact support.",-1)),X=[J,Q],Y={key:2,class:"form"},Z={key:3,class:"error not-found",style:{height:"100vh"}},$=m(()=>p("h1",null,"Page not found",-1)),ee=m(()=>p("p",null,"The page you requested could not be found.",-1)),te=[$,ee],oe=I({__name:"Form",setup(r){const l=U(),f=C(),h=F({playerKey:w()}),c=g(null),_=g(null);R(l,()=>D());const{loading:b,result:t,error:k,refetch:D}=O(async()=>{h.playerKey=w();const o=l.path.slice(1),e=await z(o);if(!e)return null;const a=new N({formRunnerData:e,queryParams:l.query,userManager:E,logService:null,connectionManager:new T(e.id,"player"),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:i=>_.value=i,onStackTraceUpdate:null,onStateUpdate:i=>c.value=i}),s=a.getState();return _.value=s.passwordlessUser,c.value=s.formState,{runnerData:e,controller:a}});A(()=>{var o,e,a,s,i;!((o=t.value)!=null&&o.runnerData)||(e=t.value)!=null&&e.runnerData&&(document.title=(i=(a=t.value)==null?void 0:a.runnerData.welcomeTitle)!=null?i:(s=t.value)==null?void 0:s.runnerData.title)});function v(o,e){P("player",f,o,e)}const S=({path:o})=>{f.push({name:"form",query:l.query,params:{path:o.split("/")}})};L(async()=>{var e;!((e=window.should_ask_before_leave)==null||e)||window.addEventListener("beforeunload",y)}),x(()=>{window.removeEventListener("beforeunload",y)});const y=o=>{var e;if((e=t.value)!=null&&e.controller.handleCloseAttempt())return o.preventDefault(),""};return(o,e)=>{var a,s;return n(b)?(u(),d("div",G,[B(j)])):n(k)||n(t)===null||c.value===null?(u(),d("div",H,X)):(a=n(t))!=null&&a.runnerData?(u(),d("div",Y,[(u(),W(M,{key:h.playerKey,"form-runner-data":n(t).runnerData,"form-state":c.value,"is-preview":!1,"user-email":(s=_.value)==null?void 0:s.claims.email,class:"player",onNavigate:S,onRedirect:v,onActionClicked:n(t).controller.handleActionClick,onUpdateWidgetErrors:n(t).controller.updateWidgetFrontendErrors,onUpdateWidgetValue:n(t).controller.updateWidgetValue,onLogout:n(t).controller.logout},null,8,["form-runner-data","form-state","user-email","onActionClicked","onUpdateWidgetErrors","onUpdateWidgetValue","onLogout"]))])):(u(),d("div",Z,te))}}});const Le=V(oe,[["__scopeId","data-v-4bf1c184"]]);export{Le as default};
//# sourceMappingURL=Form.a7114135.js.map
