import{d as b,G as w,b as d,et as i,e as s,eB as p,eC as q,eD as D,t as k,ey as $,ez as C,F as S,r as L,u as t,c as M,f as m}from"./outputWidgets.0fb707c7.js";import{L as N}from"./CircularLoading.1ef881a2.js";import{F as O,R as V}from"./FormRunner.a8fff01f.js";import{B as W}from"./BackButton.0c9cf904.js";import{a as g}from"./asyncComputed.a0ca296c.js";import{F as j}from"./forms.d1706940.js";import{W as z}from"./workspaces.3d9f34c7.js";import{r as A}from"./executeJs.0928a564.js";import"./index.4da42521.js";import"./pubsub.7d8bce56.js";import"./WidgetsFrame.06b01801.js";import"./ActionButton.vue_vue_type_script_setup_true_lang.c56900fa.js";import"./icons.24a85994.js";import"./activeRecord.204186f3.js";import"./url.d43b75f5.js";import"./runnerData.123d166f.js";import"./PlayerNavbar.64dd8421.js";import"./Steps.4891f1c9.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]="16d36336-f09e-41bf-9ca4-bcf3757cd8da",e._sentryDebugIdIdentifier="sentry-dbid-16d36336-f09e-41bf-9ca4-bcf3757cd8da")}catch{}})();const x=e=>(q("data-v-d3846761"),e=e(),D(),e),G={class:"error"},H=x(()=>s("h1",{class:"error-header"},"Error",-1)),T={class:"error-body"},U={class:"error-message"},J={class:"error-details"},K=x(()=>s("span",null,"Reload",-1)),Q=[K],X=b({__name:"Error",props:{error:{type:Object,required:!0},repeated:{type:Boolean,required:!1}},emits:["reload"],setup(e,{emit:r}){const o=e,n=w(()=>o.repeated?"Ooops. The same error occured, please try again later.":"An error occurred while loading.");function l(){r("reload")}return(u,_)=>(d(),i("div",G,[H,s("div",T,[s("div",U,[s("p",null,p(n.value),1),s("p",J,p(e.error.name)+": "+p(e.error.message),1)]),s("div",{class:"error-actions"},[s("button",{class:"btn btn-primary",onClick:l},Q)])])]))}});const Y=k(X,[["__scopeId","data-v-d3846761"]]),Z={class:"page"},ee={key:1,class:"error"},re={key:2,style:{width:"100%",height:"100%",display:"flex"}},oe={style:{width:"100%",height:"100%",display:"flex"}},te=b({__name:"FormPreview",setup(e){const r=$(),o=C(),n=S({started:!1});function l(a,c){A("preview",r,a,c)}const u=L(null),{loading:_,result:f,error:h,refetch:y}=g(()=>j.get(o.params.formPath)),{result:v}=g(()=>z.get()),P=w(()=>V.create({formPath:o.params.formPath})),I=async()=>{var a;if(!n.started){(a=u.value)==null||a.run();return}n.started=!1},R=({path:a,type:c})=>{c==="dash"?r.push({name:"dashPreview",params:{dashPath:a},query:o.query}):(r.push({name:"formPreview",params:{formPath:a},query:o.query}),y())},B=()=>{r.push(`/_editor/form/${encodeURIComponent(o.params.formPath)}`)},F=()=>{n.started=!0},E=()=>{n.started=!1};return(a,c)=>(d(),i("div",Z,[t(_)||!t(f)||!t(v)?(d(),M(N,{key:0})):t(h)?(d(),i("div",ee,[m(Y,{error:t(h),onReload:t(y)},null,8,["error","onReload"])])):(d(),i("main",re,[s("div",oe,[m(O,{ref_key:"runner",ref:u,form:t(f).makeRunnerData(t(v)),params:t(o).query,"is-preview":!0,"enable-auto-focus":!0,broker:P.value,style:{height:"unset",flex:1,overflow:"hidden"},onNavigate:R,onLogout:I,onExit:E,onStart:F,onRedirect:l},null,8,["form","params","broker"]),m(W,{onExitFullscreenPreview:B})])]))]))}});const ke=k(te,[["__scopeId","data-v-fa4f1951"]]);export{ke as default};
//# sourceMappingURL=FormPreview.f3907b84.js.map
