import{proxyCustomElement,HTMLElement,createEvent,h}from"@stencil/core/internal/client";import{o as onChange,s as state}from"./mutations2.js";import{d as defineCustomElement$4}from"./sc-form-control2.js";import{d as defineCustomElement$3}from"./sc-phone-input2.js";import{d as defineCustomElement$2}from"./sc-visually-hidden2.js";const scCustomerPhoneCss=":host{display:block}",ScCustomerPhoneStyle0=scCustomerPhoneCss,ScCustomerPhone$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.scChange=createEvent(this,"scChange",7),this.scClear=createEvent(this,"scClear",7),this.scInput=createEvent(this,"scInput",7),this.scFocus=createEvent(this,"scFocus",7),this.scBlur=createEvent(this,"scBlur",7),this.size="medium",this.value="",this.pill=!1,this.label=void 0,this.showLabel=!0,this.help="",this.placeholder=void 0,this.disabled=!1,this.readonly=!1,this.required=!1,this.invalid=!1,this.autofocus=void 0,this.hasFocus=void 0,this.error=void 0}async handleChange(){this.value=this.input.value,this.scChange.emit()}async reportValidity(){var e,t;return null===(t=null===(e=this.input)||void 0===e?void 0:e.reportValidity)||void 0===t?void 0:t.call(e)}componentWillLoad(){this.handleCheckoutChange(),this.removeChangeListener=onChange("checkout",(()=>this.handleCheckoutChange()))}disconnectedCallback(){this.removeChangeListener()}handleCheckoutChange(){var e,t,s,o,i,n;(null==this?void 0:this.value)||((null===(e=state.checkout)||void 0===e?void 0:e.phone)?this.value=null===(t=state.checkout)||void 0===t?void 0:t.phone:(null===(o=null===(s=state.checkout)||void 0===s?void 0:s.customer)||void 0===o?void 0:o.phone)&&(this.value=null===(n=null===(i=state.checkout)||void 0===i?void 0:i.customer)||void 0===n?void 0:n.phone))}render(){return h("sc-phone-input",{key:"ffa46581cc85dead7a0ca10463dee021f0496ab4",name:"phone",ref:e=>this.input=e,value:this.value,label:this.label,help:this.help,autocomplete:"phone",placeholder:this.placeholder,readonly:this.readonly,required:this.required,invalid:this.invalid,autofocus:this.autofocus,hasFocus:this.hasFocus,onScChange:()=>this.handleChange(),onScInput:()=>this.scInput.emit(),onScFocus:()=>this.scFocus.emit(),onScBlur:()=>this.scBlur.emit()})}static get style(){return ScCustomerPhoneStyle0}},[1,"sc-customer-phone",{size:[513],value:[1025],pill:[516],label:[1],showLabel:[4,"show-label"],help:[1],placeholder:[1],disabled:[516],readonly:[516],required:[516],invalid:[1540],autofocus:[4],hasFocus:[1540,"has-focus"],error:[1028],reportValidity:[64]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["sc-customer-phone","sc-form-control","sc-phone-input","sc-visually-hidden"].forEach((e=>{switch(e){case"sc-customer-phone":customElements.get(e)||customElements.define(e,ScCustomerPhone$1);break;case"sc-form-control":customElements.get(e)||defineCustomElement$4();break;case"sc-phone-input":customElements.get(e)||defineCustomElement$3();break;case"sc-visually-hidden":customElements.get(e)||defineCustomElement$2()}}))}const ScCustomerPhone=ScCustomerPhone$1,defineCustomElement=defineCustomElement$1;export{ScCustomerPhone,defineCustomElement};