import{proxyCustomElement,HTMLElement,createEvent,h,Fragment}from"@stencil/core/internal/client";import{g as getLineItemByPriceId}from"./index5.js";import{s as state}from"./mutations2.js";import{d as defineCustomElement$4}from"./sc-choices2.js";import{d as defineCustomElement$3}from"./sc-form-control2.js";import{d as defineCustomElement$2}from"./sc-visually-hidden2.js";const scPriceChoicesCss="sc-price-choices{display:block;position:relative}sc-block-ui{z-index:9}",ScPriceChoicesStyle0=scPriceChoicesCss,ScPriceChoices$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.scRemoveLineItem=createEvent(this,"scRemoveLineItem",7),this.scUpdateLineItem=createEvent(this,"scUpdateLineItem",7),this.label=void 0,this.columns=1,this.required=!0}handleChange(){this.el.querySelectorAll("sc-price-choice").forEach((e=>{var t;const c=e.querySelector("sc-choice")||e.querySelector("sc-choice-container");if(null==c?void 0:c.checked){const s=getLineItemByPriceId(null===(t=state.checkout)||void 0===t?void 0:t.line_items,c.value);this.scUpdateLineItem.emit({price_id:e.priceId,quantity:(null==s?void 0:s.quantity)||(null==e?void 0:e.quantity)||1})}else this.scRemoveLineItem.emit({price_id:e.priceId,quantity:e.quantity})}))}render(){return h(Fragment,{key:"e70d6ebfce58c91e8150b536e395b21da02229e9"},h("sc-choices",{key:"0341d15d7b9f01bd49570f777bd411de318fa752",label:this.label,required:this.required,class:"loaded price-selector",style:{"--columns":this.columns.toString()}},h("slot",{key:"9b74bb26fd5629592d460b36a847074eec60df5c"})))}get el(){return this}static get style(){return ScPriceChoicesStyle0}},[4,"sc-price-choices",{label:[1],columns:[2],required:[4]},[[0,"scChange","handleChange"]]]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["sc-price-choices","sc-choices","sc-form-control","sc-visually-hidden"].forEach((e=>{switch(e){case"sc-price-choices":customElements.get(e)||customElements.define(e,ScPriceChoices$1);break;case"sc-choices":customElements.get(e)||defineCustomElement$4();break;case"sc-form-control":customElements.get(e)||defineCustomElement$3();break;case"sc-visually-hidden":customElements.get(e)||defineCustomElement$2()}}))}const ScPriceChoices=ScPriceChoices$1,defineCustomElement=defineCustomElement$1;export{ScPriceChoices,defineCustomElement};