var __awaiter=this&&this.__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 s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r["throw"](e))}catch(e){o(e)}}function u(e){e.done?n(e.value):i(e.value).then(s,a)}u((r=r.apply(e,t||[])).next())}))};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,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return u([e,t])}}function u(s){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,i&&(o=s[0]&2?i["return"]:s[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;if(i=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;i=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];i=0}finally{r=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./index-c820db66.system.js","./index-39cc694b.system.js","./index-04238c17.system.js","./index-dc84aac6.system.js","./index-2d937df8.system.js","./index-8fad73f5.system.js","./App-f9075e71.system.js","./index-9ceb7f8c.system.js","./_commonjsHelpers-c8881874.system.js","./index-b0fe4e4c.system.js"],(function(e){"use strict";var t,n,r,i,o,s,a,u;return{setters:[function(e){t=e.r;n=e.j;r=e.h;i=e.g},function(e){o=e.E},function(){},function(e){s=e.C},function(e){a=e.d},function(e){u=e.N},function(){},function(){},function(){},function(){}],execute:function(){var d={"Deleting payment method...":"Raderar betalningsmetod...","Updating payment methods...":"Uppdaterar betalningsmetoder...","Failed to delete payment method.":"Kunde inte radera betalningsmetod.","Failed to update payment methods.":"Kunde inte uppdatera betalningsmetoder.","Payment method was deleted.":"Betalningsmetod raderades.","Updated payment methods.":"Betalningsmetod uppdaterades."};function c(e){return a.create({sv:d},e)}var l="[hidden].sc-ig-customer-method-h{display:none}.sc-ig-customer-method-h{display:-ms-flexbox;display:flex;padding:1em;padding-left:4.5em}";var m=e("ig_customer_method",function(){function e(e){t(this,e);this.reorder=n(this,"reorder",7);this.notice=n(this,"notice",7);this.updateCustomers=n(this,"updateCustomers",7)}e.prototype.componentWillLoad=function(){this.t=c(this.element)};e.prototype.onUpdate=function(e,t){return __awaiter(this,void 0,void 0,(function(){var n=this;return __generator(this,(function(r){this.notice.emit(u.execute(this.t(t=="delete"?"Deleting payment method...":"Updating payment methods..."),(function(){return __awaiter(n,void 0,void 0,(function(){var n,r,i;return __generator(this,(function(a){switch(a.label){case 0:return[4,s.put("customer/"+this.customer.id+"/methods",e.detail)];case 1:r=a.sent();if(!o.is(r))return[3,2];n=[false,this.t(t=="delete"?"Failed to delete payment method.":"Failed to update payment methods.")];return[3,4];case 2:n=[true,this.t(t=="delete"?"Payment method was deleted.":"Updated payment methods.")];return[4,s.get("customer/")];case 3:i=a.sent();this.updateCustomers.emit(i);a.label=4;case 4:return[2,n]}}))}))})));return[2]}))}))};e.prototype.render=function(){var e=this;return r("ig-payment-methods",{onUpdate:function(t){return e.onUpdate(t,"update")},onDelete:function(t){return e.onUpdate(t,"delete")},deletable:true,methods:this.customer.method,mode:"table"})};Object.defineProperty(e.prototype,"element",{get:function(){return i(this)},enumerable:false,configurable:true});return e}());m.style=l}}}));