import{proxyCustomElement,HTMLElement,createEvent,h}from"@stencil/core/internal/client";import{s as state}from"./mutations2.js";import{d as defineCustomElement$3}from"./sc-icon2.js";import{d as defineCustomElement$2}from"./sc-tag2.js";const scCartHeaderCss=".cart-header{display:flex;align-items:center;justify-content:space-between;width:100%;font-size:1em}.cart-title{text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 var(--sc-spacing-small)}.cart__close{cursor:pointer}",ScCartHeaderStyle0=scCartHeaderCss,ScCartHeader$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.scCloseCart=createEvent(this,"scCloseCart",7)}getItemsCount(){var e,t;const s=(null===(t=null===(e=state.checkout)||void 0===e?void 0:e.line_items)||void 0===t?void 0:t.data)||[];let a=0;return s.forEach((e=>{a+=null==e?void 0:e.quantity})),a}render(){var e;return h("div",{key:"a98d0178e7cee53855de66b2b8a482a7b3979b4f",class:"cart-header"},h("sc-icon",{key:"6d033a04e5bf15426db6bf0209adb82fc24f3518",class:"cart__close",name:"arrow-right",onClick:()=>this.scCloseCart.emit(),onKeyDown:e=>{"Enter"!==(null==e?void 0:e.code)&&"Space"!==(null==e?void 0:e.code)||this.scCloseCart.emit()},tabIndex:0,role:"button","aria-label":wp.i18n.__("Close Cart","surecart")}),h("div",{key:"2fc4b580ae472ff20329a16a76a5d35090891c6e",class:"cart-title"},h("slot",{key:"f24d357acfa1ac9c5fa5c6382790c1c74f31d3d9"})),h("sc-tag",{key:"13ae05191d43b57a126fe93df4b520cd6c34f082",size:"small"},(null===(e=null==this?void 0:this.getItemsCount)||void 0===e?void 0:e.call(this))||0))}static get style(){return ScCartHeaderStyle0}},[1,"sc-cart-header"]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["sc-cart-header","sc-icon","sc-tag"].forEach((e=>{switch(e){case"sc-cart-header":customElements.get(e)||customElements.define(e,ScCartHeader$1);break;case"sc-icon":customElements.get(e)||defineCustomElement$3();break;case"sc-tag":customElements.get(e)||defineCustomElement$2()}}))}const ScCartHeader=ScCartHeader$1,defineCustomElement=defineCustomElement$1;export{ScCartHeader,defineCustomElement};