var __awaiter=this&&this.__awaiter||function(t,e,n,r){function i(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r["throw"](t))}catch(t){s(t)}}function l(t){t.done?n(t.value):i(t.value).then(o,a)}l((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return l([t,e])}}function l(o){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(s=o[0]&2?i["return"]:o[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,o[1])).done)return s;if(i=0,s)o=[o[0]&2,s.value];switch(o[0]){case 0:case 1:s=o;break;case 4:n.label++;return{value:o[1],done:false};case 5:n.label++;i=o[1];o=[0];continue;case 7:o=n.ops.pop();n.trys.pop();continue;default:if(!(s=n.trys,s=s.length>0&&s[s.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!s||o[1]>s[0]&&o[1]<s[3])){n.label=o[1];break}if(o[0]===6&&n.label<s[1]){n.label=s[1];s=o;break}if(s&&n.label<s[2]){n.label=s[2];n.ops.push(o);break}if(s[2])n.ops.pop();n.trys.pop();continue}o=e.call(t,n)}catch(t){o=[6,t];i=0}finally{r=s=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};System.register(["./p-4d5bf942.system.js","./p-fba672db.system.js","./p-52cc4207.system.js","./p-74208c80.system.js","./p-af035210.system.js","./p-a3c7b64b.system.js","./p-bad9e52e.system.js"],(function(t){"use strict";var e,n;return{setters:[function(t){e=t.E},function(){},function(t){n=t.a},function(){},function(){},function(){},function(){}],execute:function(){var r=function(){function t(){}t.register=function(e,n,r){this.client=r;this.callbacks.push(e);e(this.states,this.logs,this.merchants,this.settlements,this.conversion);if(!t.timer){this.download(n);t.timer=setInterval(t.download,6e5)}};t.download=function(r){return __awaiter(this,void 0,void 0,(function(){var i,s,o,a,l,c,u,f,d,h,v,p;return __generator(this,(function(y){switch(y.label){case 0:if(!!this.downloading)return[3,5];y.label=1;case 1:y.trys.push([1,4,,5]);this.downloading=true;return[4,(i=t.client)===null||i===void 0?void 0:i.merchant.list()];case 2:c=y.sent();return[4,Promise.all([c&&!e.is(c)?Promise.all(c.map((function(e){var n;return(n=t.client)===null||n===void 0?void 0:n.authorization.list(true,e.id)}))).then((function(t){return t.reduce((function(t,n){return n!=undefined&&Array.isArray(n)&&t&&!e.is(t)?__spreadArray(__spreadArray([],t),n):t}),[])})):(s=t.client)===null||s===void 0?void 0:s.authorization.list(true),r!="test"?(o=t.client)===null||o===void 0?void 0:o.settlement.list():[],(a=t.client)===null||a===void 0?void 0:a.settlement.connection.get("currency/conversion")])];case 3:u=y.sent(),f=u[0],d=u[1],h=u[2];v=r=="developer"?(l=t.client)===null||l===void 0?void 0:l.log.list():Promise.resolve([]);if(!e.is(f)&&f&&!f.some(n.is))t.states=f;t.logs=v;if(!e.is(c)&&typeof c!="string")t.merchants=c;if(!e.is(d)&&typeof d!="string")t.settlements=d;if(!e.is(h)&&typeof h!="string")t.conversion=h;t.callbacks.forEach((function(e){return e(t.states,t.logs,t.merchants,t.settlements,t.conversion)}));this.downloading=false;return[3,5];case 4:p=y.sent();this.downloading=false;return[3,5];case 5:return[2]}}))}))};return t}();t("H",r);r.downloading=false;r.callbacks=[]}}}));