import{d as p,G as k,b as c,eu as d,e as a,eD as _,eE as $,eF as D,t as m,a as q,f as u,u as t,aq as C,eA as S,eB as A,F as L,r as N,c as M}from"./outputWidgets.e822ff0f.js";import{L as V}from"./CircularLoading.c2a83eb7.js";import{F as O,r as T,R as W}from"./FormRunner.3993f75f.js";import{r as j}from"./icons.0ab0d55f.js";import{a as w}from"./asyncComputed.68870ff7.js";import{F as G}from"./forms.16259019.js";import{W as H}from"./workspaces.aee6e5f8.js";import"./url.c786ab78.js";import"./index.7c28b641.js";import"./pubsub.ae710ef5.js";import"./PlayerNavbar.101bb2a2.js";import"./ActionButton.vue_vue_type_script_setup_true_lang.a778a11a.js";import"./WidgetsFrame.8afe7997.js";import"./record.edca104e.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]="a65338bf-bad2-436c-a087-971cb3341acc",e._sentryDebugIdIdentifier="sentry-dbid-a65338bf-bad2-436c-a087-971cb3341acc")}catch{}})();const x=e=>($("data-v-d3846761"),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=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 i(){r("reload")}return(l,f)=>(c(),d("div",U,[z,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:i},Y)])])]))}});const ee=m(Z,[["__scopeId","data-v-d3846761"]]),re=p({__name:"BackButton",emits:["exitFullscreenPreview"],setup(e,{emit:r}){return(o,s)=>{const i=q("icon");return c(),d("button",{class:"back-btn",onClick:s[0]||(s[0]=l=>r("exitFullscreenPreview"))},[u(i,{class:"icon",path:t(j),width:"20",height:"20",fill:"#5A677A"},null,8,["path"]),C(" 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 i(n,g){T("preview",r,n,g)}const l=N(null),{loading:f,result:v,error:h,refetch:y}=w(()=>G.get(o.params.id)),{result:b}=w(()=>H.get()),B=k(()=>W.create(o.params.id)),F=async()=>{var n;if(!s.started){(n=l.value)==null||n.run();return}s.started=!1},I=({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,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(O,{ref_key:"runner",ref:l,form:t(v).makeRunnerData(t(b)),params:t(o).query,"is-preview":!0,"enable-auto-focus":!0,broker:B.value,style:{height:"unset",flex:1,overflow:"hidden"},onNavigate:I,onLogout:F,onExit:P,onStart:R,onRedirect:i},null,8,["form","params","broker"]),u(te,{onExitFullscreenPreview:E})])]))]))}});const ke=m(ce,[["__scopeId","data-v-e5c3d383"]]);export{ke as default};
//# sourceMappingURL=FormPreview.d450b324.js.map
