import{n as e}from"./rolldown-runtime-BG2f4sTM.js";import{$ft as t,Jft as n,Xft as r}from"./app-initial-BHB6SClA.js";import{a as i,f as a,m as o,n as s,o as c,t as l}from"./load-script-Cltl04TI.js";function u(e,t,a){return n(this,void 0,void 0,function(){var c,l,u,d,f,p=this;return r(this,function(m){switch(m.label){case 0:return o()?[2,[]]:(c=i(),l=t.enabledMiddleware??{},u=Object.entries(l).filter(function(e){return e[0],e[1]}).map(function(e){return e[0]}),d=u.map(function(t){return n(p,void 0,void 0,function(){var n,i,o,l;return r(this,function(r){switch(r.label){case 0:n=t.replace(`@segment/`,``),i=n,a&&(i=btoa(n).replace(/=/g,``)),o=`${c}/middleware/${i}/latest/${i}.js.gz`,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,s(o)];case 2:return r.sent(),[2,window[`${n}Middleware`]];case 3:return l=r.sent(),e.log(`error`,l),e.stats.increment(`failed_remote_middleware`),[3,4];case 4:return[2]}})})}),[4,Promise.all(d)]);case 1:return f=m.sent(),f=f.filter(Boolean),[2,f]}})})}e((()=>{t(),a(),l(),c()}))();export{u as remoteMiddlewares};
//# sourceMappingURL=remote-middleware-DRFWEjf6.js.map