import{d as b,J as w,b as i,eu as c,e as s,eC as p,eD as q,eE as D,x as k,ez as $,eA as C,H as S,r as L,u as t,c as M,f as m}from"./outputWidgets.d94fff8c.js";import{L as N}from"./CircularLoading.8c280b78.js";import{F as A,R as H}from"./broker.44d4092d.js";import{B as O}from"./BackButton.49804c07.js";import{a as g}from"./asyncComputed.6da48dd7.js";import{F as V}from"./forms.6cfc05eb.js";import{W}from"./workspaces.c4438eba.js";import{r as j}from"./index.3dad0da1.js";import"./index.7a77fb2c.js";import"./pubsub.39314a92.js";import"./executeJs.99ff6d52.js";import"./icons.fec42461.js";import"./PlayerNavbar.7583d5f4.js";import"./Steps.0a5e4246.js";import"./WidgetsFrame.2f3ca3a1.js";import"./ActionButton.vue_vue_type_script_setup_true_lang.4e98488d.js";import"./activeRecord.4bb9e983.js";import"./url.596d80c9.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]="b5263f59-f72e-4e0f-b299-894f5121176a",e._sentryDebugIdIdentifier="sentry-dbid-b5263f59-f72e-4e0f-b299-894f5121176a")}catch{}})();const x=e=>(q("data-v-d3846761"),e=e(),D(),e),z={class:"error"},J=x(()=>s("h1",{class:"error-header"},"Error",-1)),T={class:"error-body"},U={class:"error-message"},G={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,f)=>(i(),c("div",z,[J,s("div",T,[s("div",U,[s("p",null,p(n.value),1),s("p",G,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,d){j("preview",r,a,d)}const u=L(null),{loading:f,result:_,error:h,refetch:y}=g(()=>V.get(o.params.formPath)),{result:v}=g(()=>W.get()),P=w(()=>H.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:d})=>{d==="dash"?r.push({name:"dashPreview",params:{dashPath:a},query:o.query}):(r.push({name:"formPreview",params:{formPath:a},query:o.query}),y())},E=()=>{r.push(`/_editor/form/${encodeURIComponent(o.params.formPath)}`)},B=()=>{n.started=!0},F=()=>{n.started=!1};return(a,d)=>(i(),c("div",Z,[t(f)||!t(_)||!t(v)?(i(),M(N,{key:0})):t(h)?(i(),c("div",ee,[m(Y,{error:t(h),onReload:t(y)},null,8,["error","onReload"])])):(i(),c("main",re,[s("div",oe,[m(A,{ref_key:"runner",ref:u,form:t(_).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:F,onStart:B,onRedirect:l},null,8,["form","params","broker"]),m(O,{onExitFullscreenPreview:E})])]))]))}});const ke=k(te,[["__scopeId","data-v-fa4f1951"]]);export{ke as default};
//# sourceMappingURL=FormPreview.f7342358.js.map
