import{u as D}from"./index.4f7b2ab2.js";import{d as b,H as P,b as d,ev as m,e as n,eD as h,eE as U,eF as A,v as w,a as W,f as v,u as a,ar as $,eA as q,eB as L,r as y,c as M,eL as V}from"./outputWidgets.f0391a74.js";import{b as N,c as T,d as H,r as O}from"./FormRunner.65c2c2fe.js";import{a as j}from"./asyncComputed.363f961e.js";import{L as J}from"./CircularLoading.d9f967cd.js";import{F as z}from"./forms.dc43c477.js";import{W as G}from"./workspaces.0a261adb.js";import"./envVars.2e25c3f4.js";import{J as K}from"./icons.f7511453.js";import"./pubsub.73224ce6.js";import"./url.3db2a8aa.js";import"./Passwordless.e5e4e0e6.js";import"./index.03310b61.js";import"./PlayerNavbar.23eb39a3.js";import"./repository.b2311d69.js";import"./ArrowRightOutlined.08fa31dd.js";import"./WidgetsFrame.cd5304d0.js";import"./Steps.e64a9914.js";import"./Card.70d77b70.js";import"./TabPane.595c3088.js";import"./hasIn.23612021.js";import"./Typography.2e02df67.js";import"./record.6f7f627d.js";import"./runnerData.e6656cbd.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="307c2612-3a81-41bc-9726-09efb81ba21d",e._sentryDebugIdIdentifier="sentry-dbid-307c2612-3a81-41bc-9726-09efb81ba21d")}catch{}})();const E=e=>(U("data-v-3e46b76c"),e=e(),A(),e),Q={class:"error"},X=E(()=>n("h1",{class:"error-header"},"Error",-1)),Y={class:"error-body"},Z={class:"error-message"},ee={class:"error-details"},re=E(()=>n("span",null,"Reload",-1)),oe=[re],te=b({__name:"Error",props:{error:{type:Object,required:!0},repeated:{type:Boolean,required:!1}},emits:["reload"],setup(e,{emit:r}){const s=e,o=P(()=>s.repeated?"Ooops. The same error occured, please try again later.":"An error occurred while loading.");function i(){r("reload")}return(g,_)=>(d(),m("div",Q,[X,n("div",Y,[n("div",Z,[n("p",null,h(o.value),1),n("p",ee,h(e.error.name)+": "+h(e.error.message),1)]),n("div",{class:"error-actions"},[n("button",{class:"btn btn-primary",onClick:i},oe)])])]))}});const ae=w(te,[["__scopeId","data-v-3e46b76c"]]),ne=b({__name:"BackButton",emits:["exitFullscreenPreview"],setup(e,{emit:r}){return(s,o)=>{const i=W("icon");return d(),m("button",{class:"back-btn",onClick:o[0]||(o[0]=g=>r("exitFullscreenPreview"))},[v(i,{class:"icon",path:a(K),width:"20",height:"20",fill:"#5A677A"},null,8,["path"]),$(" Editor ")])}}});const se=w(ne,[["__scopeId","data-v-a3f31716"]]),ie={class:"page"},ce={key:1,class:"error"},le={key:2,style:{width:"100%",height:"100%",display:"flex"}},de={style:{width:"100%",height:"100%",display:"flex"}},ue=b({__name:"FormPreview",setup(e){const r=q(),s=L(),o=y(null),i=y(null),g=s.query,_=y(null);function I(t,c){O("preview",r,t,c)}const{result:f,loading:B,refetch:k,error:x}=j(async()=>{const[t,c]=await Promise.all([z.get(s.params.id),G.get()]),u=new T({formRunnerData:t.makeRunnerData(c),queryParams:g,userManager:D,connectionManager:new H(t.id),onFormStart:()=>{},onFormEnd:()=>{},onRedirect:I,onAuthUpdate:l=>_.value=l,onStateUpdate:l=>o.value=l,logService:null,onStackTraceUpdate:null});i.value=t.makeRunnerData(c);const p=u.getState();return o.value=p.formState,_.value=p.passwordlessUser,V({form:t,workspace:c,controller:u})}),S=async({id:t})=>{await r.push({params:{id:t},name:"formPreview",query:s.query}),k()},C=()=>{r.push(`/_editor/form/${encodeURIComponent(s.params.id)}`)};return(t,c)=>{var u,p,l,F,R;return d(),m("div",ie,[a(B)||!o.value||!i.value?(d(),M(J,{key:0})):a(x)?(d(),m("div",ce,[v(ae,{error:a(x),onReload:a(k)},null,8,["error","onReload"])])):(d(),m("main",le,[n("div",de,[v(N,{style:{height:"unset",flex:1,overflow:"hidden"},"is-preview":!1,"form-runner-data":i.value,"form-state":o.value,"user-email":(u=_.value)==null?void 0:u.claims.email,onUpdateWidgetErrors:(p=a(f))==null?void 0:p.controller.updateWidgetFrontendErrors,onUpdateWidgetValue:(l=a(f))==null?void 0:l.controller.updateWidgetValue,onActionClicked:(F=a(f))==null?void 0:F.controller.handleActionClick,onNavigate:S,onLogout:(R=a(f))==null?void 0:R.controller.logout},null,8,["form-runner-data","form-state","user-email","onUpdateWidgetErrors","onUpdateWidgetValue","onActionClicked","onLogout"]),v(se,{onExitFullscreenPreview:C})])]))])}}});const $e=w(ue,[["__scopeId","data-v-2b94eb6e"]]);export{$e as default};
//# sourceMappingURL=FormPreview.b7926ec5.js.map
