import{Fragment,Host,h}from"@stencil/core";import{__}from"@wordpress/i18n";import{state as formState}from"../../../../store/form/index";import{state as checkoutState}from"../../../../store/checkout/index";export class ScLineItemShipping{constructor(){this.label=void 0}renderShippingFees(e){var t,i,s,l;return(null===(i=null===(t=null==e?void 0:e.shipping_fees)||void 0===t?void 0:t.data)||void 0===i?void 0:i.length)?h(Fragment,null,null===(l=null===(s=null==e?void 0:e.shipping_fees)||void 0===s?void 0:s.data)||void 0===l?void 0:l.map((e=>h("sc-line-item",{key:e.id},h("span",{slot:"description"},e.description),h("span",{slot:"price"},e.display_amount))))):null}render(){const{checkout:e}=checkoutState;return(null==e?void 0:e.selected_shipping_choice)?"loading"===formState.formState.value?h("sc-line-item",null,h("sc-skeleton",{slot:"title",style:{width:"120px",display:"inline-block"}}),h("sc-skeleton",{slot:"price",style:{width:"70px",display:"inline-block","--border-radius":"6px"}})):h(Fragment,null,h("sc-line-item",null,h("span",{slot:"description"},this.label||__("Shipping","surecart")),h("span",{slot:"price"},null==e?void 0:e.shipping_display_amount)),this.renderShippingFees(e)):h(Host,{style:{display:"none"}})}static get is(){return"sc-line-item-shipping"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-line-item-shipping.scss"]}}static get styleUrls(){return{$:["sc-line-item-shipping.css"]}}static get properties(){return{label:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Label"},attribute:"label",reflect:!1}}}}