var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(e){return function(t){return s([e,t])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;i=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1];o=u;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(u);break}if(o[2])n.ops.pop();n.trys.pop();continue}u=t.call(e,n)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-2fc64b72.system.js","./p-af035210.system.js","./p-fba672db.system.js","./p-5ccdd889.system.js","./p-f887c8bb.system.js","./p-8a0a3550.system.js"],(function(e){"use strict";var t,n,r,i,o;return{setters:[function(e){t=e.C;n=e.E},function(e){r=e.I;i=e.a},function(e){o=e.a},function(){},function(){},function(){}],execute:function(){var u=undefined&&undefined.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function u(e){try{s(r.next(e))}catch(e){o(e)}}function a(e){try{s(r["throw"](e))}catch(e){o(e)}}function s(e){e.done?n(e.value):i(e.value).then(u,a)}s((r=r.apply(e,t||[])).next())}))};var a=function(){function e(e){var t=this;this.connection=e;this.connection.onUnauthorized=function(){return u(t,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=this.onUnauthorized!=undefined;if(!e)return[3,2];return[4,this.onUnauthorized(this)];case 1:e=t.sent();t.label=2;case 2:return[2,e]}}))}))}}e.prototype.login=function(e,r){return u(this,void 0,void 0,(function(){var i,u;return __generator(this,(function(a){switch(a.label){case 0:i=typeof e=="string"?{user:e,password:r}:e;return[4,this.connection.get("me",{authorization:t.toBasic(i)})];case 1:u=a.sent();if(!n.is(u)){o.key=Array.isArray(u.merchant)?u.merchant[0].key.private:u.merchant.key.private;this.user=u}return[2,u]}}))}))};e.prototype.logout=function(){o.url=undefined;o.key=undefined;this.user=undefined};Object.defineProperty(e.prototype,"user",{get:function(){var e=o.storage;if(e){var t=e.getItem("Intergiro user");this.userValue=t?JSON.parse(t):undefined}return this.userValue},set:function(e){var t=o.storage;if(t)e?t.setItem("Intergiro user",JSON.stringify(e)):t.removeItem("Intergiro user");this.userValue=e},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"customerKeys",{get:function(){var e;var t=o.storage;var n=[];for(var u=0;u<((e=t===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0);u++){var a=t===null||t===void 0?void 0:t.key(u);if(r.is(a,16))n.push(t===null||t===void 0?void 0:t.getItem(a))}return n.filter(i.is)},enumerable:false,configurable:true});e.prototype.addCustomerKey=function(e,t){var n=o.storage;n&&n.setItem(t,e)};e.open=function(t,n){var r=o.open(t,n);return r&&new e(r)};return e}();e("Me",a)}}}));