import{_ as f,a as v,h as b,g as M,l as _}from"./a-14d94dc6.js";import"./index-0d8158eb.js";import"./layout-9e52ad07.js";import"./use-notification-56391e62.js";import"./index-aba65090.js";import"./error-messages-d2d0bb30.js";import"./index.esm-07f1e6d3.js";import"./index-845e4de2.js";import"./index-c0b93546.js";import"./index-9af9f9f3.js";function O(o,w,h){var i;return f(this,void 0,void 0,function(){var s,l,c,d,a,g=this;return v(this,function(m){switch(m.label){case 0:return b()?[2,[]]:(s=M(),l=(i=w.enabledMiddleware)!==null&&i!==void 0?i:{},c=Object.entries(l).filter(function(r){r[0];var e=r[1];return e}).map(function(r){var e=r[0];return e}),d=c.map(function(r){return f(g,void 0,void 0,function(){var e,n,u,p;return v(this,function(t){switch(t.label){case 0:e=r.replace("@segment/",""),n=e,h&&(n=btoa(e).replace(/=/g,"")),u="".concat(s,"/middleware/").concat(n,"/latest/").concat(n,".js.gz"),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,_(u)];case 2:return t.sent(),[2,window["".concat(e,"Middleware")]];case 3:return p=t.sent(),o.log("error",p),o.stats.increment("failed_remote_middleware"),[3,4];case 4:return[2]}})})}),[4,Promise.all(d)]);case 1:return a=m.sent(),a=a.filter(Boolean),[2,a]}})})}export{O as remoteMiddlewares};
