import{d as _,H as k,b as c,ev as d,e as a,eD as p,eE as $,eF as D,v as m,a as C,f as u,u as t,ar as q,eA as S,eB as A,G as L,r as N,c as M}from"./outputWidgets.244ba1c8.js";import{L as V}from"./CircularLoading.eff52010.js";import{F as H,r as O,R as T}from"./FormRunner.aa344f6d.js";import{w as W}from"./icons.a522dd78.js";import{a as w}from"./asyncComputed.9805a381.js";import{F as j}from"./forms.8a6a9e13.js";import{W as G}from"./workspaces.5f7fbba3.js";import"./url.f5db59c1.js";import"./Passwordless.ede28e9e.js";import"./index.cc4549b3.js";import"./pubsub.f74b1921.js";import"./PlayerNavbar.61cd08b8.js";import"./ActionButton.9bef0cef.js";import"./WidgetsFrame.e7652a72.js";import"./Card.c3bad4d1.js";import"./TabPane.bad26671.js";import"./hasIn.d73516ff.js";import"./Typography.52981f51.js";import"./record.5766e9f8.js";import"./runnerData.64dc3fe3.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]="ba6710f4-622d-4102-a59e-dbef1e6641b9",e._sentryDebugIdIdentifier="sentry-dbid-ba6710f4-622d-4102-a59e-dbef1e6641b9")}catch{}})();const x=e=>($("data-v-3e46b76c"),e=e(),D(),e),U={class:"error"},z=x(()=>a("h1",{class:"error-header"},"Error",-1)),J={class:"error-body"},K={class:"error-message"},Q={class:"error-details"},X=x(()=>a("span",null,"Reload",-1)),Y=[X],Z=_({__name:"Error",props:{error:{type:Object,required:!0},repeated:{type:Boolean,required:!1}},emits:["reload"],setup(e,{emit:r}){const o=e,s=k(()=>o.repeated?"Ooops. The same error occured, please try again later.":"An error occurred while loading.");function i(){r("reload")}return(l,f)=>(c(),d("div",U,[z,a("div",J,[a("div",K,[a("p",null,p(s.value),1),a("p",Q,p(e.error.name)+": "+p(e.error.message),1)]),a("div",{class:"error-actions"},[a("button",{class:"btn btn-primary",onClick:i},Y)])])]))}});const ee=m(Z,[["__scopeId","data-v-3e46b76c"]]),re=_({__name:"BackButton",emits:["exitFullscreenPreview"],setup(e,{emit:r}){return(o,s)=>{const i=C("icon");return c(),d("button",{class:"back-btn",onClick:s[0]||(s[0]=l=>r("exitFullscreenPreview"))},[u(i,{class:"icon",path:t(W),width:"20",height:"20",fill:"#5A677A"},null,8,["path"]),q(" Editor ")])}}});const te=m(re,[["__scopeId","data-v-a3f31716"]]),oe={class:"page"},se={key:1,class:"error"},ae={key:2,style:{width:"100%",height:"100%",display:"flex"}},ne={style:{width:"100%",height:"100%",display:"flex"}},ce=_({__name:"FormPreview",setup(e){const r=S(),o=A(),s=L({started:!1});function i(n,g){O("preview",r,n,g)}const l=N(null),{loading:f,result:v,error:h,refetch:y}=w(()=>j.get(o.params.id)),{result:b}=w(()=>G.get()),I=k(()=>T.create(o.params.id,{stageRunId:null})),B=async()=>{var n;if(!s.started){(n=l.value)==null||n.run();return}s.started=!1},F=async({id:n})=>{await r.push({params:{id:n},name:"formPreview",query:o.query}),y()},R=()=>{r.push(`/_editor/form/${encodeURIComponent(o.params.id)}`)},E=()=>{s.started=!0},P=()=>{s.started=!1};return(n,g)=>(c(),d("div",oe,[t(f)||!t(v)||!t(b)?(c(),M(V,{key:0})):t(h)?(c(),d("div",se,[u(ee,{error:t(h),onReload:t(y)},null,8,["error","onReload"])])):(c(),d("main",ae,[a("div",ne,[u(H,{ref_key:"runner",ref:l,form:t(v).makeRunnerData(t(b)),params:t(o).query,"is-preview":!0,"enable-auto-focus":!0,broker:I.value,style:{height:"unset",flex:1,overflow:"hidden"},onNavigate:F,onLogout:B,onExit:P,onStart:E,onRedirect:i},null,8,["form","params","broker"]),u(te,{onExitFullscreenPreview:R})])]))]))}});const Ee=m(ce,[["__scopeId","data-v-c0577bfc"]]);export{Ee as default};
//# sourceMappingURL=FormPreview.07c6a879.js.map
