import{d as p,G as k,b as c,eu as i,e as a,eC as _,eD as $,eE as C,t as m,a as D,f as u,u as t,az as q,ez as S,eA as A,F as L,r as N,c as M}from"./outputWidgets.723dbd35.js";import{L as V}from"./CircularLoading.21635bcf.js";import{F as z,r as O,R as T}from"./FormRunner.b3d2b489.js";import{r as W}from"./icons.d199659e.js";import{a as b}from"./asyncComputed.6087fd05.js";import{F as j}from"./forms.f3fa32b1.js";import{W as G}from"./workspaces.559f775c.js";import"./url.c8598ea1.js";import"./index.5a48ff75.js";import"./pubsub.97441533.js";import"./PlayerNavbar.a21a0d16.js";import"./ActionButton.vue_vue_type_script_setup_true_lang.b7e285dc.js";import"./WidgetsFrame.17930203.js";import"./record.c3c42720.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]="e44dd9c5-ffd9-4d8c-a473-c99e325a3f23",e._sentryDebugIdIdentifier="sentry-dbid-e44dd9c5-ffd9-4d8c-a473-c99e325a3f23")}catch{}})();const x=e=>($("data-v-d3846761"),e=e(),C(),e),H={class:"error"},U=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=p({__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 d(){r("reload")}return(l,f)=>(c(),i("div",H,[U,a("div",J,[a("div",K,[a("p",null,_(s.value),1),a("p",Q,_(e.error.name)+": "+_(e.error.message),1)]),a("div",{class:"error-actions"},[a("button",{class:"btn btn-primary",onClick:d},Y)])])]))}});const ee=m(Z,[["__scopeId","data-v-d3846761"]]),re=p({__name:"BackButton",emits:["exitFullscreenPreview"],setup(e,{emit:r}){return(o,s)=>{const d=D("icon");return c(),i("button",{class:"back-btn",onClick:s[0]||(s[0]=l=>r("exitFullscreenPreview"))},[u(d,{class:"icon",path:t(W),width:"20",height:"20",fill:"#5A677A"},null,8,["path"]),q(" Editor ")])}}});const te=m(re,[["__scopeId","data-v-eaeb3a6e"]]),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=p({__name:"FormPreview",setup(e){const r=S(),o=A(),s=L({started:!1});function d(n,w){O("preview",r,n,w)}const l=N(null),{loading:f,result:v,error:h,refetch:y}=b(()=>j.get(o.params.id)),{result:g}=b(()=>G.get()),I=k(()=>T.create(o.params.id)),B=async()=>{var n;if(!s.started){(n=l.value)==null||n.run();return}s.started=!1},F=({id:n})=>{r.push({params:{id:n},name:"formPreview",query:o.query}),y()},E=()=>{r.push(`/_editor/form/${encodeURIComponent(o.params.id)}`)},R=()=>{s.started=!0},P=()=>{s.started=!1};return(n,w)=>(c(),i("div",oe,[t(f)||!t(v)||!t(g)?(c(),M(V,{key:0})):t(h)?(c(),i("div",se,[u(ee,{error:t(h),onReload:t(y)},null,8,["error","onReload"])])):(c(),i("main",ae,[a("div",ne,[u(z,{ref_key:"runner",ref:l,form:t(v).makeRunnerData(t(g)),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:R,onRedirect:d},null,8,["form","params","broker"]),u(te,{onExitFullscreenPreview:E})])]))]))}});const ke=m(ce,[["__scopeId","data-v-e5c3d383"]]);export{ke as default};
//# sourceMappingURL=FormPreview.8bff573c.js.map
