import{d as _,G as k,b as c,ev as d,e as a,eD as u,eE as $,eF as D,v as m,a as q,f as p,u as t,aq as C,eA as S,eB as A,F as L,r as N,c as M}from"./outputWidgets.0c4e4661.js";import{L as V}from"./CircularLoading.2da7f7f8.js";import{F as O,r as T,R as W}from"./FormRunner.5ef07947.js";import{x as j}from"./icons.d6072388.js";import{a as w}from"./asyncComputed.5f444091.js";import{F as G}from"./forms.81fce7f9.js";import{W as H}from"./workspaces.da165694.js";import"./url.f50daeb8.js";import"./index.200aaaf8.js";import"./pubsub.459a9503.js";import"./PlayerNavbar.805adfeb.js";import"./ActionButton.19a8b7f8.js";import"./WidgetsFrame.0baf259e.js";import"./index.305a8bf4.js";import"./Card.7bcc5f4f.js";import"./TabPane.c41ed501.js";import"./hasIn.c776179d.js";import"./index.86e85f3e.js";import"./Text.fd757b8d.js";import"./Link.0a8a648d.js";import"./Title.0df8cfae.js";import"./record.2fdce707.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]="d1ebc4b7-1602-42c5-9223-23990be5795d",e._sentryDebugIdIdentifier="sentry-dbid-d1ebc4b7-1602-42c5-9223-23990be5795d")}catch{}})();const x=e=>($("data-v-3e46b76c"),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=_({__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,u(s.value),1),a("p",Q,u(e.error.name)+": "+u(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-3e46b76c"]]),re=_({__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"))},[p(i,{class:"icon",path:t(j),width:"20",height:"20",fill:"#5A677A"},null,8,["path"]),C(" Editor ")])}}});const te=m(re,[["__scopeId","data-v-a3f31716"]]),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=_({__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,[p(ee,{error:t(h),onReload:t(y)},null,8,["error","onReload"])])):(c(),d("main",ae,[a("div",ne,[p(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"]),p(te,{onExitFullscreenPreview:E})])]))]))}});const $e=m(ce,[["__scopeId","data-v-e5c3d383"]]);export{$e as default};
//# sourceMappingURL=FormPreview.e9254d51.js.map
