/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import{a as i,b as a,e as g}from"./chunk.IY43YPCQ.js";import{a as y}from"./chunk.UWYANU5D.js";import{a as n}from"./chunk.KTGSZEAG.js";import{a as f}from"./chunk.DL7NX432.js";import{a as m,e as _,g as v,l as C}from"./chunk.LJLEPTLU.js";import{t as b}from"./chunk.4LA6HEA7.js";import{k as l}from"./chunk.J2M2MXP2.js";import{f as p}from"./chunk.MCIQXNKY.js";var d=class extends y{constructor(e){super(e);this._rootElement=v(this._component,i.selectors.ROOT)}setVertical(e){b(this._rootElement,e,i.classes.VERTICAL)}setType(e){this._getChips().forEach(t=>t.type=e)}setDense(e){this._getChips().forEach(t=>t.dense=e)}setDisabled(e){this._getChips().forEach(t=>t.disabled=e)}tryFocusPrevious(e){let o=this._getChips(),t=o.findIndex(h=>h===e);t>=0&&(t===0?o[o.length-1].tryFocusDelete():o[t-1].tryFocusDelete())}tryFocusNext(e){let o=this._getChips(),t=o.findIndex(h=>h===e);t>=0&&(t===o.length-1?o[0].focus():o[t+1].focus())}_getChips(){return Array.from(this._component.querySelectorAll(a.elementName))}};var c=class{constructor(s){this._adapter=s;this._vertical=!1;this._type=a.defaults.TYPE;this._dense=!1;this._disabled=!1;this._focusPreviousListener=e=>this._adapter.tryFocusPrevious(e.target),this._focusNextListener=e=>this._adapter.tryFocusNext(e.target)}initialize(){this._adapter.addHostListener(a.events.FOCUS_PREVIOUS,this._focusPreviousListener),this._adapter.addHostListener(a.events.FOCUS_NEXT,this._focusNextListener),this._applyVertical(),this._applyType(),this._applyDense(),this._applyDisabled()}destroy(){this._adapter.removeHostListener(a.events.FOCUS_PREVIOUS,this._focusPreviousListener),this._adapter.removeHostListener(a.events.FOCUS_NEXT,this._focusNextListener)}_applyVertical(){this._adapter.setVertical(this._vertical),this._adapter.toggleHostAttribute(i.attributes.VERTICAL,this._vertical)}_applyType(){this._adapter.setType(this._type),this._adapter.setHostAttribute(i.attributes.TYPE,this._type)}_applyDense(){this._adapter.setDense(this._dense),this._adapter.toggleHostAttribute(i.attributes.DENSE,this._dense)}_applyDisabled(){this._adapter.setDisabled(this._disabled),this._adapter.toggleHostAttribute(i.attributes.DISABLED,this._disabled)}get vertical(){return this._vertical}set vertical(s){this._vertical!==s&&(this._vertical=s,this._applyVertical())}get type(){return this._type}set type(s){this._type!==s&&(this._type=s,this._applyType())}get dense(){return this._dense}set dense(s){this._dense!==s&&(this._dense=s,this._applyDense())}get disabled(){return this._disabled}set disabled(s){this._disabled!==s&&(this._disabled=s,this._applyDisabled())}};var T='<template><div class="forge-chip-set" part="root"><slot></slot></div></template>',E=".forge-chip-set{gap:4px;gap:var(--forge-chip-set-spacing,4px);display:-webkit-box;display:flex;flex-wrap:wrap}.forge-chip-set ::slotted(forge-chip:not(:last-child)){margin-right:4px;margin-right:var(--forge-chip-set-spacing,4px)}.forge-chip-set--vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.forge-chip-set--vertical ::slotted(forge-chip:not(:last-child)){margin-bottom:4px;margin-bottom:var(--forge-chip-set-spacing,4px)}:host{display:inline-block}:host([hidden]){display:none}",r=class extends C{constructor(){super();_(this,T,E),this._foundation=new c(new d(this))}static get observedAttributes(){return[i.attributes.VERTICAL,i.attributes.TYPE,i.attributes.DENSE,i.attributes.DISABLED]}connectedCallback(){this._foundation.initialize()}disconnectedCallback(){this._foundation.destroy()}attributeChangedCallback(e,o,t){switch(e){case i.attributes.VERTICAL:this.vertical=l(t);break;case i.attributes.TYPE:this.type=t;break;case i.attributes.DENSE:this.dense=l(t);break;case i.attributes.DISABLED:this.disabled=l(t);break}}};p([n()],r.prototype,"vertical",2),p([n()],r.prototype,"type",2),p([n()],r.prototype,"dense",2),p([n()],r.prototype,"disabled",2),r=p([f({name:i.elementName,dependencies:[g]})],r);function q(){m(r)}export{d as a,c as b,r as c,q as d};
//# sourceMappingURL=chunk.MA573DEE.js.map
