import{n as e}from"./rolldown-runtime-Czos8NxU.js";import{Ax as t,Nx as n,Ox as r}from"./app-initial~app-main~new-thread-panel-page-BZHGOlMi.js";import{a as i,f as a,m as o,n as s,o as c,t as l}from"./load-script-BifiZc4M.js";function u(e,n,a){return r(this,void 0,void 0,function(){var c,l,u,d,f,p=this;return t(this,function(m){switch(m.label){case 0:return o()?[2,[]]:(c=i(),l=n.enabledMiddleware??{},u=Object.entries(l).filter(function(e){return e[0],e[1]}).map(function(e){return e[0]}),d=u.map(function(n){return r(p,void 0,void 0,function(){var r,i,o,l;return t(this,function(t){switch(t.label){case 0:r=n.replace(`@segment/`,``),i=r,a&&(i=btoa(r).replace(/=/g,``)),o=`${c}/middleware/${i}/latest/${i}.js.gz`,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,s(o)];case 2:return t.sent(),[2,window[`${r}Middleware`]];case 3:return l=t.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((()=>{n(),a(),l(),c()}))();export{u as remoteMiddlewares};
//# sourceMappingURL=remote-middleware-Cl3TjKnd.js.map