var m=Object.defineProperty;var v=(t,e,i)=>e in t?m(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var s=(t,e,i)=>(v(t,typeof e!="symbol"?e+"":e,i),i);import{d as g,X as w,ah as y,o,c as l,w as n,b as r,u as a,dh as p,dd as I,aG as c,dc as u,cP as b,em as x,en as W,a as h,a0 as A,e as P,ea as j}from"./index.b466b20d.js";import{_ as T}from"./AbstraLogo.vue_vue_type_script_setup_true_lang.dd217b89.js";import{B as k}from"./BaseLayout.8e0836b5.js";import{l as f}from"./fetch.cd0b404e.js";import"./gateway.973a0055.js";import{a as E}from"./project.eb1f21da.js";import"./tables.1fa225bd.js";import"./Logo.19805c7a.js";import"./popupNotifcation.d1201e83.js";import"./record.fd6fbc29.js";import"./string.42378387.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="7b2aaba1-99a2-4250-94e6-d4630bf90477",t._sentryDebugIdIdentifier="sentry-dbid-7b2aaba1-99a2-4250-94e6-d4630bf90477")}catch{}})();const R=t=>(x("data-v-2536661a"),t=t(),W(),t),U=R(()=>h("div",{class:"video-container"},[h("iframe",{class:"responsive-iframe",src:"https://www.youtube.com/embed/videoseries?list=PLFPJgKA6K86ZdAHZ3aPWsrZHX_7jJ3Cc9&autoplay=1&mute=1",frameborder:"0",allow:"autoplay; picture-in-picture;",referrerpolicy:"strict-origin-when-cross-origin",allowfullscreen:""})],-1)),V=g({__name:"View",props:{controller:{}},setup(t){const e=t,i=e.controller.loadingPercentage();return w(()=>{e.controller.start()}),y(()=>{e.controller.cleanUp()}),(d,_)=>(o(),l(k,null,{content:n(()=>[r(a(p),{align:"center",justify:"center",style:{width:"100vw",height:"100dvh"}},{default:n(()=>[r(a(p),{gap:"large",align:"center",vertical:"",style:{width:"45%","min-width":"600px"}},{default:n(()=>[r(T,{size:"large"}),U,r(a(I),{level:3},{default:n(()=>[c("Preparing your environment")]),_:1}),a(i)<100?(o(),l(a(u),{key:0},{default:n(()=>[c("We are setting things up... This may take up to 1 minute.")]),_:1})):(o(),l(a(u),{key:1},{default:n(()=>[c("You will be redirected soon")]),_:1})),r(a(b),{size:[10,10],"show-info":!1,percent:a(i),"stroke-color":"#EA576A"},null,8,["percent"])]),_:1})]),_:1})]),_:1}))}});const B=A(V,[["__scopeId","data-v-2536661a"]]);class C{constructor(e,i=f){s(this,"projectId");s(this,"loading");s(this,"fetch",f);s(this,"interval",null);s(this,"urls",null);s(this,"totalWaitTime");s(this,"poolingInterval");s(this,"pingResponded",!1);this.projectId=e,this.loading=P(0),this.fetch=i,this.totalWaitTime=6e4,this.poolingInterval=2500}increment(){this.loading.value+=100/(this.totalWaitTime/this.poolingInterval)}speedUp(){this.totalWaitTime=5e3,this.poolingInterval=500,this.interval&&clearInterval(this.interval),this.interval=setInterval(async()=>{this.increment(),this.loading.value>=100&&this.navigate()},this.poolingInterval)}navigate(){this.urls&&window.location.replace(this.urls.redirect),this.cleanUp()}async ping(){if(!this.urls)return!1;if(this.pingResponded)return!0;const e=await this.fetch(this.urls.ping,{signal:AbortSignal.timeout(500)});return this.pingResponded=e.status===200,this.pingResponded}async start(){const e=await E.startWebEditor(this.projectId);this.urls=e,this.interval=setInterval(async()=>{this.increment(),this.pingResponded||await this.ping()&&this.speedUp(),this.loading.value>=100&&this.navigate()},this.poolingInterval)}cleanUp(){this.interval&&clearInterval(this.interval)}loadingPercentage(){return this.loading}}const G=g({__name:"WebEditor",setup(t){const i=j().params.projectId,d=new C(i);return(_,D)=>(o(),l(B,{controller:a(d)},null,8,["controller"]))}});export{G as default};
//# sourceMappingURL=WebEditor.7563efe3.js.map
