import{u as C}from"./userStore-Bt7tYPGp.js";import{F as D,a as E,b as R}from"./FormRunner-CkM-RtPx.js";import{a as S,P as F,r as y,H as U,ac as A,ae as I,c as W,b3 as L,D as V,k as N,b as x,p as B,g as K,u as t,j as M,e as v,aN as P}from"./jwt-decode.esm-DPxUepXu.js";import{r as j}from"./redirect-DXZWtyQS.js";import{a as q}from"./asyncComputed-DaiiKC7j.js";import{u as h}from"./uuid-Dgxt1inB.js";import{L as G}from"./CircularLoading-17mT-AAg.js";import{f as H,b as T}from"./workspaceStore-BpEDIRCC.js";import"./Login.vue_vue_type_script_setup_true_lang-DvDpKcfK.js";import"./OTPInput-CjXP6YQT.js";import"./Logo-CAibQBUf.js";import"./string-B5AbZUMC.js";import"./index-CAcZ5QF-.js";import"./Steps-2LBOSv0W.js";import"./index-BkzXuLDR.js";import"./Watermark-BJuHR4ao.js";import"./constants-X52IQ9Ps.js";import"./url-D-YQ5puQ.js";import"./colorHelpers-mTQK8wKi.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="c70b7fbc-02bf-489d-8773-18f2ac1c25f4",n._sentryDebugIdIdentifier="sentry-dbid-c70b7fbc-02bf-489d-8773-18f2ac1c25f4")}catch{}})();const z={key:0,class:"loading"},J=S({__name:"Form",setup(n){const a=A(),c=I(),d=F({playerKey:h()}),g=C(),s=y(null),m=y(null);U(a,()=>{a.name==="form"&&w()});const{loading:l,result:e,error:p,refetch:w}=q(async()=>{d.playerKey=h();const o=a.path.slice(1),r=await H(o);if(m.value=await T(),!r){c.push({name:"error",params:{status:"404"}});return}const i=new D({formRunnerData:r,logService:null,connectionManager:new E(r.id,"player",a.query),onRedirect:f,onFormStart:()=>{},onFormEnd:()=>{},onStackTraceUpdate:null,onStateUpdate:k=>s.value=k}),_=i.getState();return s.value=_.formState,{runnerData:r,controller:i}}),b=W(()=>{const o=!l,r=!!p,i=!e||s.value===null;return o&&(r||i)});L(()=>{b.value&&c.push({name:"error",params:{status:"500"}}),e.value?.runnerData&&e.value?.runnerData&&(document.title=e.value?.runnerData.title)});function f(o,r){window.removeEventListener("beforeunload",u),j("player",c,o,r)}V(async()=>{window.addEventListener("beforeunload",u)}),N(()=>{window.removeEventListener("beforeunload",u),e.value?.controller.stop()});const u=o=>{if(e.value?.controller.handleCloseAttempt())return o.preventDefault(),""};return(o,r)=>t(l)?(v(),x("div",z,[M(G)])):t(e)&&t(e).runnerData&&s.value&&!t(p)&&!t(l)?(v(),B(R,{key:d.playerKey,"form-runner-data":t(e).runnerData,"form-state":s.value,"is-preview":!1,"user-email":t(g).email,"worker-capacity":m.value,onRedirect:f,onActionClicked:t(e)?.controller.handleActionClick,onUpdateWidgetErrors:t(e)?.controller.updateWidgetFrontendErrors,onUpdateWidgetValue:t(e)?.controller.updateWidgetValue,onAuthComplete:t(e)?.controller.handleAuthComplete},null,8,["form-runner-data","form-state","user-email","worker-capacity","onActionClicked","onUpdateWidgetErrors","onUpdateWidgetValue","onAuthComplete"])):K("",!0)}}),pe=P(J,[["__scopeId","data-v-22488e59"]]);export{pe as default};
//# sourceMappingURL=Form-Cn9E9wog.js.map
