import{p as t,H as s,c as e,h as i,a as o}from"./index.js";import{v as c}from"./p-BKP-F1qP.js";import{g as a}from"./p-DKo9A5gq.js";import{p as h}from"./p-CQvUntGY.js";import{S as n}from"./p-BcQO4NH2.js";import{a as r,c as f}from"./p-CNqoJU2V.js";import{c as d}from"./p-vN03FcXN.js";import{p as l}from"./p-GYov8gU1.js";import{i as b,A as p,a as m}from"./p-CXgom82_.js";import{d as u}from"./p-BJnSrRNH.js";const g=h(n,["_XS","_S","_M"]);var v;(function(t){t["SOLID"]="solid";t["OUTLINED"]="outlined"})(v||(v={}));var y;(function(t){t["A"]="a";t["SPAN"]="span";t["BUTTON"]="button"})(y||(y={}));const k={root:"gov-chip",hasRight:"gov-chip--has-right",hasLeft:"gov-chip--has-left"};const j=t(class t extends s{constructor(){super();this.__registerHost();this.govClick=e(this,"gov-click");this.hydrated=false;this.disabled=false;this.size=g._M;this.tag="span";this.color=r.PRIMARY;this.focusable=true;this.inheritedAttributes={};this.h=a(this.host);this.chipId=d("GovChip")}validateColor(t){c(r,t,k.root)}validateSize(t){c(f,t,k.root)}componentWillLoad(){this.validateColor(this.color);this.validateSize(this.size);this.inheritedAttributes=b(this.host)}componentDidLoad(){this.attributeObserver=new p(this.host,((t,s)=>{this.onAriaAttributeChange(t,s)}));this.attributeObserver.startObserving(m)}disconnectedCallback(){var t;(t=this.attributeObserver)===null||t===void 0?void 0:t.stopObserving()}connectedCallback(){this.hydrated=true}onAriaAttributeChange(t,s){this.host.removeAttribute(t);this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:s})}render(){const t=this.href?y.A:this.tag;const s=t==y.BUTTON?y.BUTTON:undefined;const e=l(this.iconStart);const c=l(this.iconEnd);return i(o,{key:"ef86316065b17ea753e6f46944203be579c9669c",class:this.h.classes([k.root,this.h.hasSlot("right")?k.hasRight:undefined,this.h.hasSlot("left")?k.hasLeft:undefined]),disabled:this.disabled,href:this.href,color:this.color,type:this.type,size:this.size,focusable:this.focusable,hydrated:this.hydrated},i(t,Object.assign({key:"0ecb833e5c5f4e30914d9f12764b78bfd22973b6",class:"element",href:this.href,target:this.target,ref:t=>this.triggerRef=t,onClick:this.onClickHandler.bind(this),tabindex:this.h.hasSlot("left")||this.h.hasSlot("right")||this.disabled||!this.focusable?"-1":"0",id:this.identifier||this.chipId,type:s},this.inheritedAttributes,{"aria-disabled":this.disabled}),i("slot",{key:"9793b743f288573932aec95f68c0f1b1bb617add",name:"left"}),i("slot",{key:"be7cc7cb0a94c666faf842d8ee70701245305001",name:"icon-start"},e&&i("gov-icon",{key:"464ebc3d08b609a17e5e126eca9b0fb8eefc2bd4",type:e.type,name:e.name})),i("slot",{key:"faffc742599b65f40b61b8cbd45e32891f43a869"}),i("slot",{key:"dce2fa1d55332f8cc3d51e8a11e56735f5bcf683",name:"icon-end"},c&&i("gov-icon",{key:"afc841c471bc376cc650150e168d307f3393ef15",type:c.type,name:c.name})),i("slot",{key:"16dc2b17d2b813c2ced12ae44c12d621a82c6cb5",name:"right"})))}onClickHandler(t){t.stopPropagation();if(this.disabled===false&&this.tag===y.BUTTON){this.govClick.emit(t)}}async geRef(){return this.triggerRef}async setFocus(){this.triggerRef.focus()}get host(){return this}static get watchers(){return{color:["validateColor"],size:["validateSize"]}}},[4,"gov-chip",{disabled:[516],href:[1],target:[1],iconStart:[1,"icon-start"],iconEnd:[1,"icon-end"],size:[1],tag:[1],color:[1],type:[513],focusable:[4],identifier:[1],inheritedAttributes:[32],geRef:[64],setFocus:[64]},undefined,{color:["validateColor"],size:["validateSize"]}]);function C(){if(typeof customElements==="undefined"){return}const t=["gov-chip","gov-icon"];t.forEach((t=>{switch(t){case"gov-chip":if(!customElements.get(t)){customElements.define(t,j)}break;case"gov-icon":if(!customElements.get(t)){u()}break}}))}C();export{j as G,C as d};
//# sourceMappingURL=p-DW1DKFMF.js.map