import{proxyCustomElement,HTMLElement,h,Host}from"@stencil/core/internal/client";import{d as defineCustomElement$2}from"./sc-format-number2.js";import{d as defineCustomElement$1}from"./sc-visually-hidden2.js";const scPriceRangeCss=":host{display:block;line-height:1}",ScPriceRangeStyle0=scPriceRangeCss,ScPriceRange=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.prices=void 0,this.minPrice=void 0,this.maxPrice=void 0}handlePricesChange(){let e,t;(this.prices||[]).filter((e=>!(null==e?void 0:e.archived))).forEach((n=>{(!t||n.amount>t.amount)&&(t=n),(!e||n.amount<e.amount)&&(e=n)})),this.minPrice=e,this.maxPrice=t}componentWillLoad(){this.handlePricesChange()}render(){return this.maxPrice&&this.minPrice?h(Host,null,this.maxPrice.amount==this.minPrice.amount?h("span",null,h("sc-format-number",{type:"currency",currency:this.maxPrice.currency,value:this.maxPrice.amount})):h("span",null,h("sc-visually-hidden",null,wp.i18n.__("Price range from","surecart")," "),h("sc-format-number",{type:"currency",currency:this.minPrice.currency,value:this.minPrice.amount}),h("span",{"aria-hidden":!0}," — "),h("sc-visually-hidden",null,wp.i18n.__("to","surecart")),h("sc-format-number",{type:"currency",currency:this.maxPrice.currency,value:this.maxPrice.amount}))):h(Host,null)}static get watchers(){return{prices:["handlePricesChange"]}}static get style(){return ScPriceRangeStyle0}},[1,"sc-price-range",{prices:[16],minPrice:[32],maxPrice:[32]},void 0,{prices:["handlePricesChange"]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["sc-price-range","sc-format-number","sc-visually-hidden"].forEach((e=>{switch(e){case"sc-price-range":customElements.get(e)||customElements.define(e,ScPriceRange);break;case"sc-format-number":customElements.get(e)||defineCustomElement$2();break;case"sc-visually-hidden":customElements.get(e)||defineCustomElement$1()}}))}export{ScPriceRange as S,defineCustomElement as d};