import{u as U}from"./index.618e9d9e.js";import{d as E,H as C,b as u,eu as f,e as o,eD as g,eE as W,eF as q,v as F,eI as A,eA as M,r as v,u as t,c as P,f as R,eK as B}from"./outputWidgets.cb8d4118.js";import{b as V,c as $,d as L,r as N}from"./FormRunner.bdb69c4b.js";import{a as H}from"./asyncComputed.602f821b.js";import{L as O}from"./CircularLoading.0e27e652.js";import{F as T}from"./forms.ff8465ab.js";import{W as j}from"./workspaces.7c770739.js";import"./envVars.0aa492ca.js";import"./pubsub.6650fe4e.js";import"./fetch.a950ecae.js";import"./url.f415825b.js";import"./Passwordless.844a4f18.js";import"./index.99a2c642.js";import"./PhArrowClockwise.vue.b2872b82.js";import"./PlayerNavbar.19a48ee3.js";import"./PhKanban.vue.74e2223b.js";import"./PhSignOut.vue.c3e3ed91.js";import"./Text.9ccde808.js";import"./index.b090e533.js";import"./Link.4ac04f66.js";import"./Paragraph.bf76481e.js";import"./Title.0c6e5569.js";import"./index.ec60d2a0.js";import"./WidgetsFrame.02d82153.js";import"./Steps.d2461ff4.js";import"./PhInfo.vue.0ea1baf8.js";import"./Card.028b3323.js";import"./index.2e27f524.js";import"./TabPane.50eb1b71.js";import"./hasIn.9378fb46.js";import"./record.3c2cc598.js";import"./runnerData.c466048a.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="dc311081-7cc4-435b-9abf-59b57ee0a716",e._sentryDebugIdIdentifier="sentry-dbid-dc311081-7cc4-435b-9abf-59b57ee0a716")}catch{}})();const I=e=>(W("data-v-3e46b76c"),e=e(),q(),e),K={class:"error"},z=I(()=>o("h1",{class:"error-header"},"Error",-1)),G={class:"error-body"},J={class:"error-message"},Q={class:"error-details"},X=I(()=>o("span",null,"Reload",-1)),Y=[X],Z=E({__name:"Error",props:{error:{type:Object,required:!0},repeated:{type:Boolean,required:!1}},emits:["reload"],setup(e,{emit:a}){const s=e,n=C(()=>s.repeated?"Ooops. The same error occured, please try again later.":"An error occurred while loading.");function d(){a("reload")}return(h,m)=>(u(),f("div",K,[z,o("div",G,[o("div",J,[o("p",null,g(n.value),1),o("p",Q,g(e.error.name)+": "+g(e.error.message),1)]),o("div",{class:"error-actions"},[o("button",{class:"btn btn-primary",onClick:d},Y)])])]))}});const ee=F(Z,[["__scopeId","data-v-3e46b76c"]]),re={class:"page"},oe={key:1,class:"error"},te={key:2,style:{width:"100%",height:"100%",display:"flex"}},ae={style:{width:"100%",height:"100%",display:"flex"}},se=E({__name:"FormPreview",setup(e){const a=A(),s=M(),n=v(null),d=v(null),h=s.query,m=v(null);function S(r,i){N("preview",a,r,i)}const{result:_,loading:D,refetch:y,error:w}=H(async()=>{const[r,i]=await Promise.all([T.get(s.params.id),j.get()]),l=new $({formRunnerData:r.makeRunnerData(i),queryParams:h,userManager:U,connectionManager:new L(r.id),onFormStart:()=>{},onFormEnd:()=>{},onRedirect:S,onAuthUpdate:c=>m.value=c,onStateUpdate:c=>n.value=c,logService:null,onStackTraceUpdate:null});d.value=r.makeRunnerData(i);const p=l.getState();return n.value=p.formState,m.value=p.passwordlessUser,B({form:r,workspace:i,controller:l})}),x=async({id:r})=>{await a.push({params:{id:r},name:"formPreview",query:s.query}),y()};return(r,i)=>{var l,p,c,b,k;return u(),f("div",re,[t(D)||!n.value||!d.value?(u(),P(O,{key:0})):t(w)?(u(),f("div",oe,[R(ee,{error:t(w),onReload:t(y)},null,8,["error","onReload"])])):(u(),f("main",te,[o("div",ae,[R(V,{style:{height:"unset",flex:1,overflow:"hidden"},"is-preview":!1,"form-runner-data":d.value,"form-state":n.value,"user-email":(l=m.value)==null?void 0:l.claims.email,onUpdateWidgetErrors:(p=t(_))==null?void 0:p.controller.updateWidgetFrontendErrors,onUpdateWidgetValue:(c=t(_))==null?void 0:c.controller.updateWidgetValue,onActionClicked:(b=t(_))==null?void 0:b.controller.handleActionClick,onNavigate:x,onLogout:(k=t(_))==null?void 0:k.controller.logout},null,8,["form-runner-data","form-state","user-email","onUpdateWidgetErrors","onUpdateWidgetValue","onActionClicked","onLogout"])])]))])}}});const Ve=F(se,[["__scopeId","data-v-a7c36a64"]]);export{Ve as default};
//# sourceMappingURL=FormPreview.202b65b9.js.map
