import{d as g,H as w,b as i,er as c,e as s,eA as p,eB as q,eC as D,v as k,ex as $,ey as C,G as S,r as L,u as t,c as M,f as m}from"./registerWidgets.faec4901.js";import{L as N}from"./CircularLoading.ca58d6f5.js";import{F as A,R as H}from"./broker.67a502ef.js";import{B as O}from"./BackButton.17fb9fc5.js";import{a as b}from"./asyncComputed.04758d6d.js";import{F as V}from"./forms.c3e90e83.js";import{W}from"./workspaces.6b009dc4.js";import{r as j}from"./index.dabe2e32.js";import"./passwordlessManager.90d3a316.js";import"./pubsub.c32c984e.js";import"./storage.02df2e1a.js";import"./Passwordless.961add2f.js";import"./icons.4b27c20b.js";import"./executeJs.b1249f30.js";import"./PlayerNavbar.49b00875.js";import"./Steps.77469d63.js";import"./Modal.c4a3eb37.js";import"./WidgetsFrame.6243aeb3.js";import"./ActionButton.vue_vue_type_script_setup_true_lang.5737790c.js";import"./activeRecord.64153c3d.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]="b06f1654-2dbe-45a5-afb9-67bf357c2942",e._sentryDebugIdIdentifier="sentry-dbid-b06f1654-2dbe-45a5-afb9-67bf357c2942")}catch{}})();const x=e=>(q("data-v-d3846761"),e=e(),D(),e),G={class:"error"},T=x(()=>s("h1",{class:"error-header"},"Error",-1)),U={class:"error-body"},z={class:"error-message"},J={class:"error-details"},K=x(()=>s("span",null,"Reload",-1)),Q=[K],X=g({__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,_)=>(i(),c("div",G,[T,s("div",U,[s("div",z,[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=g({__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:_,result:f,error:h,refetch:y}=b(()=>V.get(o.params.formPath)),{result:v}=b(()=>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())},B=()=>{r.push(`/_editor/form/${encodeURIComponent(o.params.formPath)}`)},E=()=>{n.started=!0},F=()=>{n.started=!1};return(a,d)=>(i(),c("div",Z,[t(_)||!t(f)||!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(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:F,onStart:E,onRedirect:l},null,8,["form","params","broker"]),m(O,{onExitFullscreenPreview:B})])]))]))}});const Pe=k(te,[["__scopeId","data-v-fa4f1951"]]);export{Pe as default};
//# sourceMappingURL=FormPreview.c70b1337.js.map
