import{u as C}from"./userStore-Drxc-3f9.js";import{F as D,a as E,b as R}from"./FormRunner-Cf3gkB-a.js";import{a as S,W as F,r as y,O as U,ak as W,af as A,c as I,b4 as L,J as V,q as x,k as B,b as K,e as M,u as t,h as N,f as v,aO as q}from"./jwt-decode.esm-Dzy-9m8i.js";import{r as O}from"./redirect-CJTJSBMu.js";import{a as G}from"./asyncComputed-Ab6ltgBh.js";import{u as h}from"./uuid-BOHQpd3Z.js";import{L as J}from"./CircularLoading-Bhmkz1og.js";import{f as P,b as T}from"./workspaceStore-CRQkfLa2.js";import"./Login.vue_vue_type_script_setup_true_lang-Dj9-B2IV.js";import"./OTPInput-CO9ifg8r.js";import"./Logo-1eOfZ7jQ.js";import"./string-CBgg-bcW.js";import"./index-k7fKvFYe.js";import"./Steps-Cs5OBdle.js";import"./index-ByyrlDA1.js";import"./Watermark-DU3ArgNw.js";import"./constants-CWkAmIyV.js";import"./url-BEAzlLsl.js";import"./runnerData-CrbzxE5q.js";import"./colorHelpers-B6IvUH0O.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]="ec160cc3-7462-47b3-96b2-cc36b8526a62",n._sentryDebugIdIdentifier="sentry-dbid-ec160cc3-7462-47b3-96b2-cc36b8526a62")}catch{}})();const j={key:0,class:"loading"},z=S({__name:"Form",setup(n){const a=W(),c=A(),d=F({playerKey:h()}),w=C(),s=y(null),m=y(null);U(a,()=>{a.name==="form"&&b()});const{loading:l,result:e,error:p,refetch:b}=G(async()=>{d.playerKey=h();const o=a.path.slice(1),r=await P(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}}),g=I(()=>{const o=!l,r=!!p,i=!e||s.value===null;return o&&(r||i)});L(()=>{g.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),O("player",c,o,r)}V(async()=>{window.addEventListener("beforeunload",u)}),x(()=>{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(),B("div",j,[N(J)])):t(e)&&t(e).runnerData&&s.value&&!t(p)&&!t(l)?(v(),K(R,{key:d.playerKey,"form-runner-data":t(e).runnerData,"form-state":s.value,"is-preview":!1,"user-email":t(w).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"])):M("",!0)}}),fe=q(z,[["__scopeId","data-v-22488e59"]]);export{fe as default};
//# sourceMappingURL=Form-BraooUrx.js.map
