import{u as k}from"./index.5efb03fa.js";import{d as E,eE as U,eK as R,I as C,r as h,K as F,J as I,ax as S,o as A,O as L,u as n,b as g,ew as x,f as W,c as B,ey as K,x as V}from"./outputWidgets.eb68177a.js";import{b as M,r as N,c as q,d as P}from"./FormRunner.6affd24f.js";import{a as T}from"./asyncComputed.d7d35a9b.js";import{u as w}from"./uuid.865984c9.js";import{L as G}from"./CircularLoading.b65c70bb.js";import{f as J}from"./api.81454d28.js";import"./fetch.48bfa89a.js";import"./pubsub.bf42621d.js";import"./url.1bbc2ec6.js";import"./Login.vue_vue_type_script_setup_true_lang.7c1e6a89.js";import"./Link.59e40dde.js";import"./Base.20dd2a14.js";import"./index.9e24d2fa.js";import"./PhArrowClockwise.vue.ffa991d1.js";import"./WidgetsFrame.f4d94fb2.js";import"./Steps.8d50a32c.js";import"./PhInfo.vue.f630a8ff.js";import"./Card.c49c4ced.js";import"./TabPane.cc10803f.js";import"./hasIn.5508971f.js";import"./runnerData.fcb41115.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},u=new Error().stack;u&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[u]="9c2729e1-1724-451b-ab10-2255d6dbf1cf",l._sentryDebugIdIdentifier="sentry-dbid-9c2729e1-1724-451b-ab10-2255d6dbf1cf")}catch{}})();const O={key:0,class:"loading"},j=E({__name:"Form",setup(l){const u=U(),d=R(),p=C({playerKey:w()}),i=h(null),c=h(null);F(u,()=>b());const{loading:m,result:r,error:f,refetch:b}=T(async()=>{p.playerKey=w();const t=u.path.slice(1),e=await J(t);if(!e){d.push({name:"error",params:{status:"404"}});return}const o=new q({formRunnerData:e,queryParams:u.query,userManager:k,logService:null,connectionManager:new P(e.id,"player"),onRedirect:v,onFormStart:()=>{},onFormEnd:()=>{},onAuthUpdate:a=>c.value=a,onStackTraceUpdate:null,onStateUpdate:a=>i.value=a}),s=o.getState();return c.value=s.passwordlessUser,i.value=s.formState,{runnerData:e,controller:o}}),D=I(()=>{const t=!m,e=!!f,o=!r||i.value===null;return t&&(e||o)});S(()=>{var t,e,o,s,a;D.value&&d.push({name:"error",params:{status:"500"}}),!!((t=r.value)!=null&&t.runnerData)&&(e=r.value)!=null&&e.runnerData&&(document.title=(a=(o=r.value)==null?void 0:o.runnerData.welcomeTitle)!=null?a:(s=r.value)==null?void 0:s.runnerData.title)});function v(t,e){N("player",d,t,e)}A(async()=>{var e;!((e=window.should_ask_before_leave)==null||e)||window.addEventListener("beforeunload",_)}),L(()=>{window.removeEventListener("beforeunload",_)});const _=t=>{var e;if((e=r.value)!=null&&e.controller.handleCloseAttempt())return t.preventDefault(),""};return(t,e)=>{var o,s,a,y;return n(m)?(g(),x("div",O,[W(G)])):n(r)&&n(r).runnerData&&i.value&&!n(f)&&!n(m)?(g(),B(M,{key:p.playerKey,"form-runner-data":n(r).runnerData,"form-state":i.value,"is-preview":!1,"user-email":(o=c.value)==null?void 0:o.claims.email,onRedirect:v,onActionClicked:(s=n(r))==null?void 0:s.controller.handleActionClick,onUpdateWidgetErrors:(a=n(r))==null?void 0:a.controller.updateWidgetFrontendErrors,onUpdateWidgetValue:(y=n(r))==null?void 0:y.controller.updateWidgetValue},null,8,["form-runner-data","form-state","user-email","onActionClicked","onUpdateWidgetErrors","onUpdateWidgetValue"])):K("",!0)}}});const ve=V(j,[["__scopeId","data-v-02db4d57"]]);export{ve as default};
//# sourceMappingURL=Form.109d3e06.js.map
