import{proxyCustomElement,HTMLElement,createEvent,h,Host}from"@stencil/core/internal/client";import{c as classnames}from"./index2.js";import{d as defineCustomElement$4}from"./va-card2.js";import{d as defineCustomElement$3}from"./va-icon2.js";import{d as defineCustomElement$2}from"./va-link2.js";const vaNotificationCss=":host{display:block;position:relative}:host([has-border=false])>va-card{border:none !important;-webkit-box-shadow:none !important;box-shadow:none !important}::slotted([slot=date]){display:block;color:var(--vads-color-base-darker);font-size:16px}va-link{display:block;margin-top:3px}:host va-icon{margin-right:16px}va-icon.action-required{color:var(--vads-color-secondary-dark)}va-icon.update{color:var(--vads-color-primary)}.va-notification{display:table;width:100%;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box}div.body{display:table-cell;vertical-align:middle;width:100%}h1,h2,h3,h4,h5,h6{margin:0;font-size:17px;font-family:var(--font-serif);line-height:22px;width:66%}@media (min-width: 768px){h1,h2,h3,h4,h5,h6{width:100%}}p{line-height:24px}.va-notification-close{margin:18px 12px;padding:0px;width:auto;color:var(--vads-color-base-darker);font-size:16px;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0px;cursor:pointer;background:transparent;display:block;position:absolute;right:0px;top:0px}.va-notification-close:hover{color:var(--vads-color-base);background-color:transparent}.va-notification-close:active,.va-notification-close:focus{color:var(--vads-color-base);background-color:transparent;outline:2px solid var(--vads-color-action-focus-on-light);outline-offset:2px}.va-notification-close>i{margin-right:8px;vertical-align:middle}.va-notification-close>span{font-weight:600;margin-right:5px}",VaNotificationStyle0=vaNotificationCss,VaNotification$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.closeEvent=createEvent(this,"closeEvent",7),this.componentLibraryAnalytics=createEvent(this,"component-library-analytics",7),this.visible=!0,this.symbol="none",this.closeBtnAriaLabel="Close notification",this.closeable=!1,this.hasBorder=!0,this.hasCloseText=!1,this.headline=void 0,this.headlineLevel="3",this.dateTime=void 0,this.href=void 0,this.text=void 0,this.disableAnalytics=!1}handleLinkAnalytics(e){var i,t;if("va-notification"!==e.detail.componentName&&(e.stopPropagation(),!this.disableAnalytics)){const a={componentName:"va-notification",action:"linkClick",details:{clickLabel:null===(t=null===(i=e.detail)||void 0===i?void 0:i.details)||void 0===t?void 0:t.label,type:this.symbol,headline:this.headline}};this.componentLibraryAnalytics.emit(a)}}closeHandler(e){if(this.closeEvent.emit(e),!this.disableAnalytics){const e={componentName:"va-notification",action:"close",details:{type:this.symbol,headline:this.headline}};this.componentLibraryAnalytics.emit(e)}}getHeadlineLevel(){const e=parseInt(this.headlineLevel,10);return e>=1&&e<=6?`h${e}`:"h3"}render(){const{visible:e,symbol:i,headline:t,dateTime:a,href:o,text:n,closeable:s,hasBorder:l,hasCloseText:r}=this,c=this.getHeadlineLevel();if(!e)return h("div",{"aria-live":"polite"});const d=classnames("va-notification",i,{"has-border":l}),m=`${t} ${a}`;return h(Host,null,h("va-card",{"show-shadow":"true"},h("div",{class:d},i&&"none"!==i?h("va-icon",{"aria-hidden":"true",role:"img",size:5,icon:"action-required"===i?"error":"update"===i?"info":null,class:i}):null,h("div",{class:"body",role:"presentation"},t?h(c,{part:"headline","aria-describedby":m},t):null,a?h("time",{dateTime:a},a):null,h("slot",null),o&&n?h("va-link",{active:!0,href:o,text:n}):null)),s&&h("button",{class:"va-notification-close","aria-label":this.closeBtnAriaLabel,onClick:this.closeHandler.bind(this)},h("va-icon",{icon:"close"}),r&&h("span",null,"CLOSE"))))}get el(){return this}static get style(){return VaNotificationStyle0}},[1,"va-notification",{visible:[4],symbol:[1],closeBtnAriaLabel:[1,"close-btn-aria-label"],closeable:[516],hasBorder:[516,"has-border"],hasCloseText:[4,"has-close-text"],headline:[1],headlineLevel:[1,"headline-level"],dateTime:[1,"date-time"],href:[1],text:[1],disableAnalytics:[4,"disable-analytics"]},[[0,"component-library-analytics","handleLinkAnalytics"]]]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["va-notification","va-card","va-icon","va-link"].forEach(e=>{switch(e){case"va-notification":customElements.get(e)||customElements.define(e,VaNotification$1);break;case"va-card":customElements.get(e)||defineCustomElement$4();break;case"va-icon":customElements.get(e)||defineCustomElement$3();break;case"va-link":customElements.get(e)||defineCustomElement$2()}})}const VaNotification=VaNotification$1,defineCustomElement=defineCustomElement$1;export{VaNotification,defineCustomElement};