var __awaiter=this&&this.__awaiter||function(e,t,n,a){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,c){function o(e){try{s(a.next(e))}catch(e){c(e)}}function r(e){try{s(a["throw"](e))}catch(e){c(e)}}function s(e){e.done?n(e.value):i(e.value).then(o,r)}s((a=a.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},a,i,c,o;return o={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function r(e){return function(t){return s([e,t])}}function s(o){if(a)throw new TypeError("Generator is already executing.");while(n)try{if(a=1,i&&(c=o[0]&2?i["return"]:o[0]?i["throw"]||((c=i["return"])&&c.call(i),0):i.next)&&!(c=c.call(i,o[1])).done)return c;if(i=0,c)o=[o[0]&2,c.value];switch(o[0]){case 0:case 1:c=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(!(c=n.trys,c=c.length>0&&c[c.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!c||o[1]>c[0]&&o[1]<c[3])){n.label=o[1];break}if(o[0]===6&&n.label<c[1]){n.label=c[1];c=o;break}if(c&&n.label<c[2]){n.label=c[2];n.ops.push(o);break}if(c[2])n.ops.pop();n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e];i=0}finally{a=c=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};System.register(["./p-2172a2da.system.js","./p-8c01ffbc.system.js","./p-b5dd9b68.system.js","./p-f887c8bb.system.js"],(function(e){"use strict";var t,n,a,i,c,o;return{setters:[function(e){t=e.r;n=e.c;a=e.h;i=e.g},function(e){c=e.d},function(e){o=e.d},function(){}],execute:function(){var r={"Top up balance":"Fyll på saldo",Cancel:"Avbryt",Amount:"Summa","Equalize balance to zero.":"Justera saldot till noll."};function s(e){return o.create({sv:r},e)}var l=".sc-ig-balance-add-h{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;min-width:15em}[hidden].sc-ig-balance-add-h{display:none}.sc-ig-balance-add-h>form.sc-ig-balance-add>section.sc-ig-balance-add{display:-ms-flexbox;display:flex;width:100%;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;max-width:15em}.sc-ig-balance-add-h>form.sc-ig-balance-add>section.sc-ig-balance-add:last-of-type{margin-top:.5em}.sc-ig-balance-add-h>form.sc-ig-balance-add>section.sc-ig-balance-add>smoothly-display.sc-ig-balance-add{font-size:xx-large}.sc-ig-balance-add-h>form.sc-ig-balance-add>section.sc-ig-balance-add>smoothly-icon.sc-ig-balance-add{cursor:pointer;padding-left:1em}.sc-ig-balance-add-h>form.sc-ig-balance-add>section.sc-ig-balance-add>smoothly-input.sc-ig-balance-add{border:1px solid rgb(var(--smoothly-medium-color))}.sc-ig-balance-add-h>form.sc-ig-balance-add>section.sc-ig-balance-add>smoothly-submit.sc-ig-balance-add smoothly-icon.sc-ig-balance-add{margin-right:-.4em}.sc-ig-balance-add-h>form.sc-ig-balance-add>section.sc-ig-balance-add>smoothly-trigger.sc-ig-balance-add{padding-left:1em;margin-right:-1em}smoothly-submit.sc-ig-balance-add,smoothly-trigger.sc-ig-balance-add{border:none}";var d=e("ig_balance_add",function(){function e(e){t(this,e);this.addFunds=n(this,"addFunds",7);this.opened=false}e.prototype.componentWillLoad=function(){this.t=s(this.element)};e.prototype.submit=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,a;return __generator(this,(function(i){t=c.parse(e.detail.price,"price",this.customer.currency);n={number:"Manual balance charge.",items:{name:"Manual balance charge.",price:t},currency:this.customer.currency,payment:{type:"customer",charge:"balance"},customer:this.customer.id};this.addFunds.emit(n);this.opened=false;a=document.getElementsByTagName("form")[0];a.reset();return[2]}))}))};e.prototype.render=function(){var e=this;return[a("form",null,a("section",null,a("smoothly-display",{type:"price",value:this.customer.total,currency:this.customer.currency}),this.customer.balance.length>0&&this.customer.total<0?a("smoothly-trigger",{style:{display:this.opened?"":"none"}},a("smoothly-icon",{toolTip:this.t("Equalize balance to zero."),name:"arrow-up-circle-outline",size:"small",color:"medium",fill:"clear"})):[],a("smoothly-icon",{toolTip:this.opened?this.t("Cancel"):this.t("Top up balance"),color:this.opened?"medium":"default",fill:this.opened?"clear":"solid",name:this.opened?"close":"add-circle",onClick:function(){return e.opened=!e.opened}})),a("section",{style:{display:this.opened?"":"none"}},a("smoothly-input",{name:"price",type:"price",currency:this.customer.currency},this.t("Amount")),a("smoothly-submit",{prevent:true,onSubmit:function(t){return e.submit(t)}},a("smoothly-icon",{toolTip:this.t("Top up balance"),class:"add",color:"success",fill:"clear",name:"add-circle"}))))]};Object.defineProperty(e.prototype,"element",{get:function(){return i(this)},enumerable:false,configurable:true});return e}());d.style=l}}}));