import{u as S}from"./index.f6ce12ef.js";import{d as E,eA as U,eI as F,G as A,r as g,I as R,av as C,o as L,K as B,u as n,b as u,eu as c,f as W,c as q,eE as V,eF as x,e as p,v as K}from"./outputWidgets.8f35e76b.js";import{b as M,r as P,c as N,d as T}from"./FormRunner.4141173f.js";import{a as G}from"./asyncComputed.b2c7682e.js";import{u as w}from"./uuid.0ba51d83.js";import{L as O}from"./CircularLoading.cdfdf5ef.js";import{f as j}from"./api.43bf4307.js";import"./pubsub.aac2ae7d.js";import"./fetch.5a9928e7.js";import"./url.99f1e379.js";import"./Passwordless.ceae5811.js";import"./index.74670cde.js";import"./PhArrowClockwise.vue.d84d962d.js";import"./PlayerNavbar.2eec09a3.js";import"./PhKanban.vue.c924b5ce.js";import"./PhSignOut.vue.2543e2c9.js";import"./Text.cb1b4ad4.js";import"./index.8416d0cc.js";import"./Link.453a8ef1.js";import"./Paragraph.5b35e944.js";import"./Title.984d5105.js";import"./index.31b873d2.js";import"./WidgetsFrame.87b1c2ad.js";import"./Steps.e437de6a.js";import"./PhInfo.vue.470a74d9.js";import"./Card.05a66930.js";import"./index.1b34424f.js";import"./TabPane.385f8290.js";import"./hasIn.38270313.js";import"./runnerData.6e315e3e.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new Error().stack;i&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[i]="c1388152-a5fd-45a2-9382-5515f835bae7",r._sentryDebugIdIdentifier="sentry-dbid-c1388152-a5fd-45a2-9382-5515f835bae7")}catch{}})();const m=r=>(V("data-v-f61ea327"),r=r(),x(),r),z={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=E({__name:"Form",setup(r){const i=U(),f=F(),h=A({playerKey:w()}),d=g(null),_=g(null);R(i,()=>D());const{loading:k,result:t,error:b,refetch:D}=G(async()=>{h.playerKey=w();const o=i.path.slice(1),e=await j(o);if(!e)return null;const a=new N({formRunnerData:e,queryParams:i.query,userManager:S,logService:null,connectionManager:new T(e.id),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:l=>_.value=l,onStackTraceUpdate:null,onStateUpdate:l=>d.value=l}),s=a.getState();return _.value=s.passwordlessUser,d.value=s.formState,{runnerData:e,controller:a}});C(()=>{var o,e,a,s,l;!((o=t.value)!=null&&o.runnerData)||(e=t.value)!=null&&e.runnerData&&(document.title=(l=(a=t.value)==null?void 0:a.runnerData.welcomeTitle)!=null?l:(s=t.value)==null?void 0:s.runnerData.title)});function v(o,e){P("player",f,o,e)}const I=({path:o})=>{f.push({name:"form",query:i.query,params:{path:o.split("/")}})};L(async()=>{var e;!((e=window.should_ask_before_leave)==null||e)||window.addEventListener("beforeunload",y)}),B(()=>{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(k)?(u(),c("div",z,[W(O)])):n(b)||n(t)===null||d.value===null?(u(),c("div",H,X)):(a=n(t))!=null&&a.runnerData?(u(),c("div",Y,[(u(),q(M,{key:h.playerKey,"form-runner-data":n(t).runnerData,"form-state":d.value,"is-preview":!1,"user-email":(s=_.value)==null?void 0:s.claims.email,class:"player",onNavigate:I,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(),c("div",Z,te))}}});const Be=K(oe,[["__scopeId","data-v-f61ea327"]]);export{Be as default};
//# sourceMappingURL=Form.4c2f67f2.js.map
