import{h}from"@stencil/core";export class ScProductItemPrice{constructor(){this.prices=void 0,this.range=!0,this.metrics=void 0}componentWillLoad(){var e,r,t,i,c,o;this.range&&(null===(e=this.metrics)||void 0===e?void 0:e.min_price_amount)!==(null===(r=this.metrics)||void 0===r?void 0:r.max_price_amount)&&(this.prices=[{amount:null===(t=this.metrics)||void 0===t?void 0:t.min_price_amount,currency:null===(i=this.metrics)||void 0===i?void 0:i.currency},{amount:null===(c=this.metrics)||void 0===c?void 0:c.max_price_amount,currency:null===(o=this.metrics)||void 0===o?void 0:o.currency}])}render(){var e;const r=(this.prices||[]).sort(((e,r)=>(null==e?void 0:e.position)-(null==r?void 0:r.position))).find((e=>!(null==e?void 0:e.archived)));return h("div",{key:"86430f460e43cb75a3e07b4ff40f379ea028fd15",class:"product-price",part:"base"},!this.range&&(null===(e=this.prices)||void 0===e?void 0:e.length)?h("sc-format-number",{type:"currency",currency:(null==r?void 0:r.currency)||"usd",value:null==r?void 0:r.amount}):h("sc-price-range",{prices:this.prices}))}static get is(){return"sc-product-item-price"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-product-item-price.scss"]}}static get styleUrls(){return{$:["sc-product-item-price.css"]}}static get properties(){return{prices:{type:"unknown",mutable:!1,complexType:{original:"Price[]",resolved:"Price[]",references:{Price:{location:"import",path:"src/types",id:"src/types.ts::Price"}}},required:!1,optional:!1,docs:{tags:[],text:""}},range:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Show price range?"},attribute:"range",reflect:!1,defaultValue:"true"},metrics:{type:"unknown",mutable:!1,complexType:{original:"ProductMetrics",resolved:"ProductMetrics",references:{ProductMetrics:{location:"import",path:"src/types",id:"src/types.ts::ProductMetrics"}}},required:!1,optional:!1,docs:{tags:[],text:"Product metrics"}}}}}