import{r as a,c as e,h as s,g as i}from"./p-890a2f7e.js";import{d as c}from"./p-067f8cb2.js";import{d as l}from"./p-9f421a09.js";import"./p-112455b1.js";const t={"Top up balance":"Fyll på saldo",Cancel:"Avbryt",Amount:"Summa","Equalize balance to zero.":"Justera saldot till noll."},o=class{constructor(s){a(this,s),this.addFunds=e(this,"addFunds",7),this.opened=!1}componentWillLoad(){this.t=l.create({sv:t},this.element)}async submit(a){const e=c.parse(a.detail.price,"price",this.customer.currency);this.addFunds.emit({number:"Manual balance charge.",items:{name:"Manual balance charge.",price:e},currency:this.customer.currency,payment:{type:"customer",charge:"balance"},customer:this.customer.id}),this.opened=!1,document.getElementsByTagName("form")[0].reset()}render(){return[s("form",null,s("section",null,s("smoothly-display",{type:"price",value:this.customer.total,currency:this.customer.currency}),this.customer.balance.length>0&&this.customer.total<0?s("smoothly-trigger",{style:{display:this.opened?"":"none"}},s("smoothly-icon",{toolTip:this.t("Equalize balance to zero."),name:"arrow-up-circle-outline",size:"small",color:"medium",fill:"clear"})):[],s("smoothly-icon",{toolTip:this.t(this.opened?"Cancel":"Top up balance"),color:this.opened?"medium":"default",fill:this.opened?"clear":"solid",name:this.opened?"close":"add-circle",onClick:()=>this.opened=!this.opened})),s("section",{style:{display:this.opened?"":"none"}},s("smoothly-input",{name:"price",type:"price",currency:this.customer.currency},this.t("Amount")),s("smoothly-submit",{prevent:!0,onSubmit:a=>this.submit(a)},s("smoothly-icon",{toolTip:this.t("Top up balance"),class:"add",color:"success",fill:"clear",name:"add-circle"}))))]}get element(){return i(this)}};o.style=".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}";export{o as ig_balance_add}