import{proxyCustomElement,HTMLElement,h}from"@stencil/core/internal/client";import{a as getHumanDiscount}from"./price.js";import{o as openWormhole}from"./consumer.js";import{f as formatTaxDisplay}from"./tax.js";import{d as defineCustomElement$6}from"./sc-divider2.js";import{d as defineCustomElement$5}from"./sc-line-item2.js";import{d as defineCustomElement$4}from"./sc-line-item-total2.js";import{d as defineCustomElement$3}from"./sc-skeleton2.js";import{d as defineCustomElement$2}from"./sc-tag2.js";import{d as defineCustomElement$1}from"./sc-total2.js";const scOrderConfirmationTotalsCss=":host{display:block}",ScOrderConfirmationTotalsStyle0=":host{display:block}",ScOrderConfirmationTotals=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.order=void 0}renderDiscountLine(){var e,o,t,s,i,n,a,d,l,r,c,m,u,p;if(!(null===(t=null===(o=null===(e=this.order)||void 0===e?void 0:e.discount)||void 0===o?void 0:o.promotion)||void 0===t?void 0:t.code))return null;let f="";return(null===(i=null===(s=this.order)||void 0===s?void 0:s.discount)||void 0===i?void 0:i.coupon)&&(f=getHumanDiscount(null===(a=null===(n=this.order)||void 0===n?void 0:n.discount)||void 0===a?void 0:a.coupon)),h("sc-line-item",{style:{marginTop:"var(--sc-spacing-small)"}},h("span",{slot:"description"},wp.i18n.__("Discount","surecart"),h("br",null),(null===(r=null===(l=null===(d=this.order)||void 0===d?void 0:d.discount)||void 0===l?void 0:l.promotion)||void 0===r?void 0:r.code)&&h("sc-tag",{type:"success",size:"small"},null===(u=null===(m=null===(c=this.order)||void 0===c?void 0:c.discount)||void 0===m?void 0:m.promotion)||void 0===u?void 0:u.code)),f&&h("span",{class:"coupon-human-discount",slot:"price-description"},"(",f,")"),null===(p=this.order)||void 0===p?void 0:p.discounts_display_amount)}render(){var e,o,t,s,i,n,a,d;return h("div",{key:"e9baa3fcc9954a15132ad68d06a364def7109f2e",class:{"line-item-totals":!0}},h("sc-line-item",{key:"a6573e57b822fba7c6ce510d1e99cc943589a1b7"},h("span",{key:"68e0aebdb9c470b4504659cee45f762bed61c920",slot:"description"},wp.i18n.__("Subtotal","surecart")),h("span",{key:"d02bcbe43afb626843c74ed5d0f65eb204dfc7bf",slot:"price"},null===(e=this.order)||void 0===e?void 0:e.subtotal_display_amount)),this.renderDiscountLine(),!!(null===(o=this.order)||void 0===o?void 0:o.bump_amount)&&h("sc-line-item",{key:"6e7adbb413d2956054f7140e8edddb815478510b",style:{marginTop:"var(--sc-spacing-small)"}},h("span",{key:"16b2e5206ea02cd515c2aa360068984dcb4627e9",slot:"description"},wp.i18n.__("Bundle Discount","surecart")),h("span",{key:"5c1a9690e1d0b51b1c63a3b589f39ea0c6293958",slot:"price"},null===(t=this.order)||void 0===t?void 0:t.bump_display_amount)),!!(null===(s=this.order)||void 0===s?void 0:s.shipping_amount)&&h("sc-line-item",{key:"b7165cef00e6e631049de140ade7fd9dd040e8a6",style:{marginTop:"var(--sc-spacing-small)"}},h("span",{key:"46c8bc1ae218f4370190f258b0e7353baa069854",slot:"description"},wp.i18n.__("Shipping","surecart")),h("span",{key:"eb3fbf3133a31c222275357df2e6a5047679ed67",slot:"price"},null===(i=this.order)||void 0===i?void 0:i.shipping_display_amount)),!!(null===(n=this.order)||void 0===n?void 0:n.tax_amount)&&h("sc-line-item",{key:"e65e8f7db1a1038ab9d8bb14bc6f9f6965f9f1d1",style:{marginTop:"var(--sc-spacing-small)"}},h("span",{key:"14a7aa2a614566910eb6d5ae3838f11bde473367",slot:"description"},formatTaxDisplay(null===(a=this.order)||void 0===a?void 0:a.tax_label)," ",`(${this.order.tax_percent}%)`),h("span",{key:"ac98095305db5ed000430c3aa36eb5adc63132da",slot:"price"},null===(d=this.order)||void 0===d?void 0:d.tax_display_amount)),h("sc-divider",{key:"18111d88a10dc032a709336dab9a4915dc5c6452",style:{"--spacing":"var(--sc-spacing-small)"}}),h("sc-line-item-total",{key:"6780ad586769f79e51bedca85c40d098e54c332a",checkout:this.order,size:"large","show-currency":!0},h("span",{key:"9e972dabaf66e1d070833e388ff8ae872bcbb015",slot:"description"},wp.i18n.__("Total","surecart"))))}static get style(){return":host{display:block}"}},[1,"sc-order-confirmation-totals",{order:[16]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["sc-order-confirmation-totals","sc-divider","sc-line-item","sc-line-item-total","sc-skeleton","sc-tag","sc-total"].forEach((e=>{switch(e){case"sc-order-confirmation-totals":customElements.get(e)||customElements.define(e,ScOrderConfirmationTotals);break;case"sc-divider":customElements.get(e)||defineCustomElement$6();break;case"sc-line-item":customElements.get(e)||defineCustomElement$5();break;case"sc-line-item-total":customElements.get(e)||defineCustomElement$4();break;case"sc-skeleton":customElements.get(e)||defineCustomElement$3();break;case"sc-tag":customElements.get(e)||defineCustomElement$2();break;case"sc-total":customElements.get(e)||defineCustomElement$1()}}))}openWormhole(ScOrderConfirmationTotals,["order","busy","loading","empty"],!1);export{ScOrderConfirmationTotals as S,defineCustomElement as d};