@m3e/chips 1.0.5 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -3,29 +3,29 @@
3
3
  * Copyright (c) 2025 matraic
4
4
  * See LICENSE file in the project root for full license text.
5
5
  */
6
- import{unsafeCSS as e,css as t,LitElement as i,nothing as s,html as o}from"lit";import{DesignToken as n,isDisabledMixin as r,isDisabledInteractiveMixin as a,isLinkButtonMixin as l,renderPseudoLink as c,hasAssignedNodes as h,getTextContent as d,FormSubmitter as p,AttachInternals as u,LinkButton as v,KeyboardClick as m,Focusable as f,DisabledInteractive as b,Disabled as g,Role as $,Vertical as y,Selected as _,Labelled as w,Dirty as A,Touched as E,FormAssociated as S,formValue as x,EventAttribute as C,RequiredConstraintValidation as k,Required as P,ConstraintValidation as T}from"@m3e/core";import{selectionManager as M,SelectionManager as I,ListManager as U,ListKeyManager as O}from"@m3e/core/a11y";function L(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r}function H(e,t,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(e):s?s.value:t.get(e)}function N(e,t,i,s,o){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?o.call(e,i):o?o.value=i:t.set(e,i),i}"function"==typeof SuppressedError&&SuppressedError;
6
+ import{unsafeCSS as e,css as t,LitElement as i,nothing as s,html as o}from"lit";import{DesignToken as n,isDisabledMixin as r,isDisabledInteractiveMixin as a,isLinkButtonMixin as l,renderPseudoLink as c,hasAssignedNodes as h,getTextContent as d,FormSubmitter as p,AttachInternals as u,LinkButton as v,KeyboardClick as m,Focusable as f,DisabledInteractive as b,Disabled as g,Role as $,Vertical as y,Selected as w,Labelled as _,Dirty as A,Touched as E,FormAssociated as S,formValue as x,EventAttribute as C,RequiredConstraintValidation as k,Required as P,ConstraintValidation as M}from"@m3e/core";import{selectionManager as T,SelectionManager as I,ListManager as U,ListKeyManager as O}from"@m3e/core/a11y";import{M3eDirectionality as L}from"@m3e/core/bidi";function H(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r}function N(e,t,i,s){if("a"===i&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(e):s?s.value:t.get(e)}function R(e,t,i,s,o){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?o.call(e,i):o?o.value=i:t.set(e,i),i}"function"==typeof SuppressedError&&SuppressedError;
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
11
  */
12
- const R=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},z=globalThis,W=z.ShadowRoot&&(void 0===z.ShadyCSS||z.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,j=Symbol(),B=new WeakMap;
12
+ const W=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},z=globalThis,j=z.ShadowRoot&&(void 0===z.ShadyCSS||z.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,D=Symbol(),B=new WeakMap;
13
13
  /**
14
14
  * @license
15
15
  * Copyright 2019 Google LLC
16
16
  * SPDX-License-Identifier: BSD-3-Clause
17
- */let D=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==j)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(W&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=B.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&B.set(t,e))}return e}toString(){return this.cssText}};const q=W?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new D("string"==typeof e?e:e+"",void 0,j))(t)})(e):e,{is:V,defineProperty:F,getOwnPropertyDescriptor:K,getOwnPropertyNames:Z,getOwnPropertySymbols:G,getPrototypeOf:J}=Object,Q=globalThis,X=Q.trustedTypes,Y=X?X.emptyScript:"",ee=Q.reactiveElementPolyfillSupport,te=(e,t)=>e,ie={toAttribute(e,t){switch(t){case Boolean:e=e?Y:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},se=(e,t)=>!V(e,t),oe={attribute:!0,type:String,converter:ie,reflect:!1,useDefault:!1,hasChanged:se};
17
+ */let q=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==D)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(j&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=B.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&B.set(t,e))}return e}toString(){return this.cssText}};const V=j?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new q("string"==typeof e?e:e+"",void 0,D))(t)})(e):e,{is:F,defineProperty:K,getOwnPropertyDescriptor:Z,getOwnPropertyNames:G,getOwnPropertySymbols:J,getPrototypeOf:Q}=Object,X=globalThis,Y=X.trustedTypes,ee=Y?Y.emptyScript:"",te=X.reactiveElementPolyfillSupport,ie=(e,t)=>e,se={toAttribute(e,t){switch(t){case Boolean:e=e?ee:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},oe=(e,t)=>!F(e,t),ne={attribute:!0,type:String,converter:se,reflect:!1,useDefault:!1,hasChanged:oe};
18
18
  /**
19
19
  * @license
20
20
  * Copyright 2017 Google LLC
21
21
  * SPDX-License-Identifier: BSD-3-Clause
22
- */Symbol.metadata??=Symbol("metadata"),Q.litPropertyMetadata??=new WeakMap;class ne extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=oe){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);void 0!==s&&F(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:o}=K(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const n=s?.call(this);o?.call(this,t),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??oe}static _$Ei(){if(this.hasOwnProperty(te("elementProperties")))return;const e=J(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(te("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(te("properties"))){const e=this.properties,t=[...Z(e),...G(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(q(e))}else void 0!==e&&t.push(q(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(W)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const i of t){const t=document.createElement("style"),s=z.litNonce;void 0!==s&&t.setAttribute("nonce",s),t.textContent=i.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:ie).toAttribute(t,i.type);this._$Em=e,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=i.getPropertyOptions(s),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:ie;this._$Em=s;const n=o.fromAttribute(t,e.type);this[s]=n??this._$Ej?.get(s)??n,this._$Em=null}}requestUpdate(e,t,i){if(void 0!==e){const s=this.constructor,o=this[e];if(i??=s.getPropertyOptions(e),!((i.hasChanged??se)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:o},n){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),!0!==o||void 0!==n)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,i,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}}ne.elementStyles=[],ne.shadowRootOptions={mode:"open"},ne[te("elementProperties")]=new Map,ne[te("finalized")]=new Map,ee?.({ReactiveElement:ne}),(Q.reactiveElementVersions??=[]).push("2.1.1");
22
+ */Symbol.metadata??=Symbol("metadata"),X.litPropertyMetadata??=new WeakMap;class re extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ne){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);void 0!==s&&K(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:o}=Z(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const n=s?.call(this);o?.call(this,t),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ne}static _$Ei(){if(this.hasOwnProperty(ie("elementProperties")))return;const e=Q(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ie("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ie("properties"))){const e=this.properties,t=[...G(e),...J(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(V(e))}else void 0!==e&&t.push(V(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(j)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const i of t){const t=document.createElement("style"),s=z.litNonce;void 0!==s&&t.setAttribute("nonce",s),t.textContent=i.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(void 0!==s&&!0===i.reflect){const o=(void 0!==i.converter?.toAttribute?i.converter:se).toAttribute(t,i.type);this._$Em=e,null==o?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=i.getPropertyOptions(s),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:se;this._$Em=s;const n=o.fromAttribute(t,e.type);this[s]=n??this._$Ej?.get(s)??n,this._$Em=null}}requestUpdate(e,t,i){if(void 0!==e){const s=this.constructor,o=this[e];if(i??=s.getPropertyOptions(e),!((i.hasChanged??oe)(o,t)||i.useDefault&&i.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:o},n){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),!0!==o||void 0!==n)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,i,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}}re.elementStyles=[],re.shadowRootOptions={mode:"open"},re[ie("elementProperties")]=new Map,re[ie("finalized")]=new Map,te?.({ReactiveElement:re}),(X.reactiveElementVersions??=[]).push("2.1.1");
23
23
  /**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
27
  */
28
- const re={attribute:!0,type:String,converter:ie,reflect:!1,hasChanged:se},ae=(e=re,t,i)=>{const{kind:s,metadata:o}=i;let n=globalThis.litPropertyMetadata.get(o);if(void 0===n&&globalThis.litPropertyMetadata.set(o,n=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),n.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const o=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,o,e)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];t.call(this,i),this.requestUpdate(s,o,e)}}throw Error("Unsupported decorator location: "+s)};function le(e){return(t,i)=>"object"==typeof i?ae(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}
28
+ const ae={attribute:!0,type:String,converter:se,reflect:!1,hasChanged:oe},le=(e=ae,t,i)=>{const{kind:s,metadata:o}=i;let n=globalThis.litPropertyMetadata.get(o);if(void 0===n&&globalThis.litPropertyMetadata.set(o,n=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),n.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const o=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,o,e)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const o=this[s];t.call(this,i),this.requestUpdate(s,o,e)}}throw Error("Unsupported decorator location: "+s)};function ce(e){return(t,i)=>"object"==typeof i?le(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}
29
29
  /**
30
30
  * @license
31
31
  * Copyright 2017 Google LLC
@@ -36,457 +36,11 @@ const re={attribute:!0,type:String,converter:ie,reflect:!1,hasChanged:se},ae=(e=
36
36
  * Copyright 2017 Google LLC
37
37
  * SPDX-License-Identifier: BSD-3-Clause
38
38
  */
39
- function ce(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}var he,de,pe,ue,ve,me,fe;let be=class extends i{constructor(){super(...arguments),he.add(this),de.set(this,void 0),pe.set(this,""),this.variant="outlined"}get value(){return H(this,de,"f")??H(this,pe,"f")}set value(e){N(this,de,e,"f")}firstUpdated(e){super.firstUpdated(e),"listitem"===this.role&&this.removeAttribute("tabindex"),[this._elevation,this._focusRing,this._stateLayer,this._ripple].forEach(e=>{e?.htmlFor||e?.attach(this)})}render(){const e=!r(this)||this.disabled,t=a(this)&&this.disabledInteractive;return o`<div class="base">
40
- <m3e-elevation class="elevation" ?disabled="${e||t}"></m3e-elevation>
41
- <m3e-state-layer class="state-layer" ?disabled="${e||t}"></m3e-state-layer>
42
- <m3e-focus-ring class="focus-ring" ?disabled="${e}"></m3e-focus-ring>
43
- <m3e-ripple class="ripple" ?disabled="${e||t}"></m3e-ripple>
44
- <div class="touch" aria-hidden="true"></div>
45
- ${l(this)?this[c]():s}
46
- <div class="wrapper">${H(this,he,"m",ue).call(this)}</div>
47
- </div>`}_renderIcon(){return o`<slot name="icon" aria-hidden="true" @slotchange="${H(this,he,"m",ve)}"></slot>`}_renderTrailingIcon(){return o`<slot
48
- name="trailing-icon"
49
- aria-hidden="true"
50
- @slotchange="${H(this,he,"m",me)}"
51
- ></slot>`}_renderSlot(){return o`<slot @slotchange="${H(this,he,"m",fe)}"></slot>`}};de=new WeakMap,pe=new WeakMap,he=new WeakSet,ue=function(){return o`${this._renderIcon()}
52
- <div class="label">${this._renderSlot()}</div>
53
- ${this._renderTrailingIcon()}`},ve=function(e){this.classList.toggle("-with-icon",h(e.target))},me=function(e){this.classList.toggle("-with-trailing-icon",h(e.target))},fe=function(e){N(this,pe,d(e.target),"f")},be.styles=t`
54
- :host {
55
- display: inline-block;
56
- vertical-align: middle;
57
- outline: none;
58
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
59
- }
60
- .base {
61
- box-sizing: border-box;
62
- vertical-align: middle;
63
- display: inline-flex;
64
- align-items: center;
65
- justify-content: center;
66
- position: relative;
67
- width: 100%;
68
- transition: ${e(`background-color ${n.motion.duration.short4} ${n.motion.easing.standard}`)};
69
- border-radius: var(--m3e-chip-container-shape, ${n.shape.corner.small});
70
- height: calc(var(--m3e-chip-container-height, 2rem) + ${n.density.calc(-2)});
71
- font-size: var(--m3e-chip-label-text-font-size, ${n.typescale.standard.label.large.fontSize});
72
- font-weight: var(--m3e-chip-label-text-font-weight, ${n.typescale.standard.label.large.fontWeight});
73
- line-height: var(--m3e-chip-label-text-line-height, ${n.typescale.standard.label.large.lineHeight});
74
- letter-spacing: var(--m3e-chip-label-text-tracking, ${n.typescale.standard.label.large.tracking});
75
- }
76
- :host(:not(m3e-chip):not(:disabled):not([disabled-interactive])) {
77
- cursor: pointer;
78
- }
79
- :host(:not(m3e-chip):not(:disabled)[disabled-interactive]) {
80
- cursor: not-allowed;
81
- }
82
- :host(:not(m3e-chip):not(:disabled):not([disabled-interactive])) .base {
83
- user-select: none;
84
- }
85
- .touch {
86
- position: absolute;
87
- height: 3rem;
88
- left: 0;
89
- right: 0;
90
- }
91
- .wrapper {
92
- width: 100%;
93
- overflow: hidden;
94
- display: inline-flex;
95
- align-items: center;
96
- column-gap: var(--m3e-chip-spacing, 0.5rem);
97
- }
98
- .label {
99
- flex: 1 1 auto;
100
- min-width: 0;
101
- white-space: nowrap;
102
- overflow: hidden;
103
- text-overflow: ellipsis;
104
- }
105
- a {
106
- all: unset;
107
- display: block;
108
- position: absolute;
109
- top: 0px;
110
- left: 0px;
111
- right: 0px;
112
- bottom: 0px;
113
- z-index: 1;
114
- }
115
- :host([variant="elevated"]) .base {
116
- background-color: var(--m3e-elevated-chip-container-color, ${n.color.surfaceContainerLow});
117
-
118
- --m3e-elevation-level: var(--m3e-elevated-chip-elevation, ${n.elevation.level1});
119
- --m3e-elevation-hover-level: var(--m3e-elevated-chip-hover-elevation, ${n.elevation.level2});
120
- --m3e-elevation-focus-level: var(--m3e-elevated-chip-elevation, ${n.elevation.level1});
121
- --m3e-elevation-pressed-level: var(--m3e-elevated-chip-elevation, ${n.elevation.level1});
122
- }
123
- :host([variant="outlined"]) .base {
124
- outline-width: var(--m3e-outlined-chip-outline-thickness, 1px);
125
- outline-style: solid;
126
- outline-offset: calc(0px - var(--m3e-outlined-chip-outline-thickness, 1px));
127
- }
128
- :host(:not(:disabled):not([disabled-interactive])[variant="outlined"]) .base {
129
- outline-color: var(--m3e-outlined-chip-outline-color, ${n.color.outlineVariant});
130
- }
131
- :host(:disabled[variant="outlined"]) .base,
132
- :host([disabled-interactive][variant="outlined"]) .base {
133
- outline-color: color-mix(
134
- in srgb,
135
- var(--m3e-outlined-chip-disabled-outline-color, ${n.color.onSurface})
136
- var(--m3e-outlined-chip-disabled-outline-opacity, 12%),
137
- transparent
138
- );
139
- }
140
- :host(.-with-icon) .wrapper {
141
- padding-inline-start: var(--m3e-chip-with-icon-padding-start, 0.5rem);
142
- }
143
- :host(:not(.-with-icon)) .wrapper {
144
- padding-inline-start: var(--m3e-chip-padding-start, 1rem);
145
- }
146
- :host(.-with-trailing-icon) .wrapper {
147
- padding-inline-end: var(--m3e-chip-with-icon-padding-end, 0.5rem);
148
- }
149
- :host(:not(.-with-trailing-icon)) .wrapper {
150
- padding-inline-end: var(--m3e-chip-padding-end, 1rem);
151
- }
152
- ::slotted([slot="icon"]),
153
- ::slotted([slot="trailing-icon"]) {
154
- flex: none;
155
- width: 1em;
156
- font-size: var(--m3e-chip-icon-size, 1.125rem) !important;
157
- }
158
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base {
159
- color: var(--m3e-chip-label-text-color, ${n.color.onSurface});
160
- }
161
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]),
162
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
163
- color: var(--m3e-chip-icon-color, ${n.color.primary});
164
- }
165
- :host(:disabled) .base,
166
- :host([disabled-interactive]) .base {
167
- color: color-mix(
168
- in srgb,
169
- var(--m3e-chip-disabled-label-text-color, ${n.color.onSurface})
170
- var(--m3e-chip-disabled-label-text-opacity, 38%),
171
- transparent
172
- );
173
- }
174
- :host(:disabled) ::slotted([slot="icon"]),
175
- :host([disabled-interactive]) ::slotted([slot="icon"]),
176
- :host(:disabled) ::slotted([slot="trailing-icon"]),
177
- :host([disabled-interactive]) ::slotted([slot="trailing-icon"]) {
178
- color: color-mix(
179
- in srgb,
180
- var(--m3e-chip-disabled-icon-color, ${n.color.onSurface}) var(--m3e-chip-disabled-icon-opacity, 38%),
181
- transparent
182
- );
183
- }
184
- :host([variant="elevated"]:disabled) .base,
185
- :host([variant="elevated"][disabled-interactive]) .base {
186
- background-color: color-mix(
187
- in srgb,
188
- var(--m3e-elevated-chip-disabled-container-color, ${n.color.onSurface})
189
- var(--m3e-elevated-chip-disabled-container-opacity, 12%),
190
- transparent
191
- );
192
- --m3e-elevation-level: var(--m3e-elevated-chip-disabled-elevation, ${n.elevation.level0});
193
- }
194
- @media (prefers-reduced-motion) {
195
- .base {
196
- transition: none;
197
- }
198
- }
199
- @media (forced-colors: active) {
200
- .base {
201
- transition: none;
202
- }
203
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base,
204
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]),
205
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
206
- color: CanvasText;
207
- }
208
- :host(:not(:disabled):not([disabled-interactive])[variant="outlined"]) .base {
209
- outline-color: CanvasText;
210
- }
211
- :host(:disabled) .base,
212
- :host([disabled-interactive]) .base,
213
- :host(:disabled) ::slotted([slot="icon"]),
214
- :host([disabled-interactive]) ::slotted([slot="icon"]),
215
- :host(:disabled) ::slotted([slot="trailing-icon"]),
216
- :host([disabled-interactive]) ::slotted([slot="trailing-icon"]) {
217
- color: GrayText;
218
- }
219
- :host(:disabled[variant="outlined"]) .base,
220
- :host([disabled-interactive][variant="outlined"]) .base {
221
- outline-color: GrayText;
222
- }
223
- }
224
- `,L([ce(".elevation")],be.prototype,"_elevation",void 0),L([ce(".focus-ring")],be.prototype,"_focusRing",void 0),L([ce(".state-layer")],be.prototype,"_stateLayer",void 0),L([ce(".ripple")],be.prototype,"_ripple",void 0),L([le({reflect:!0})],be.prototype,"variant",void 0),L([le()],be.prototype,"value",null),be=L([R("m3e-chip")],be);let ge=class extends(p(u(v(m(f(b(g($(be,"button")))))),!0))){_renderTrailingIcon(){return s}};ge=L([R("m3e-assist-chip")],ge);let $e=class extends(y(i)){render(){return o`<slot></slot>`}};var ye,_e,we;$e.styles=t`
225
- :host {
226
- display: inline-flex;
227
- flex-wrap: wrap;
228
- vertical-align: middle;
229
- gap: var(--m3e-chip-set-spacing, 0.5rem);
230
- outline: none;
231
- }
232
- :host([vertical]) {
233
- flex-direction: column;
234
- }
235
- `,$e=L([R("m3e-chip-set")],$e);let Ae=class extends(_(m(f(b(g(u($(be,"radio"),!0))))))){constructor(){super(...arguments),ye.add(this),_e.set(this,e=>H(this,ye,"m",we).call(this,e))}connectedCallback(){super.connectedCallback(),this.addEventListener("click",H(this,_e,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",H(this,_e,"f"))}update(e){super.update(e),e.has("selected")&&this.closest("m3e-filter-chip-set")?.[M].notifySelectionChange(this)}_renderIcon(){return o`<div class="icon" aria-hidden="true">
236
- <svg class="check" viewBox="0 -960 960 960" aria-hidden="true">
237
- <path fill="currentColor" d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
238
- </svg>
239
- ${super._renderIcon()}
240
- </div>`}};var Ee,Se,xe,Ce,ke,Pe;_e=new WeakMap,ye=new WeakSet,we=function(e){if(e.defaultPrevented)return;const t=this.selected;this.selected=!this.selected,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))?(this.closest("m3e-filter-chip-set")?.[M].notifySelectionChange(this),this.dispatchEvent(new Event("change",{bubbles:!0}))):this.selected=t},Ae.styles=[be.styles,t`
241
- :host([selected]:not(.-hide-selection)) .wrapper {
242
- padding-inline-start: var(--m3e-chip-with-icon-padding-start, 0.5rem);
243
- }
244
- .icon {
245
- display: flex;
246
- align-items: center;
247
- justify-content: center;
248
- }
249
- .check {
250
- width: 1em;
251
- font-size: var(--m3e-chip-icon-size, 1.125rem);
252
- }
253
- :host(:not(:disabled):not([disabled-interactive])) .check {
254
- color: var(--m3e-chip-selected-leading-icon-color, ${n.color.onSecondaryContainer});
255
- }
256
- :host(:not([selected])) .check,
257
- :host(.-hide-selection) .check,
258
- :host(.-hide-selection:not(.-with-icon)) .icon {
259
- display: none;
260
- }
261
- :host(:not(.-with-icon)) .icon {
262
- margin-inline-start: calc(0px - var(--m3e-chip-with-icon-padding-start, 0.5rem));
263
- transition: margin-inline-start ${n.motion.spring.fastEffects};
264
- }
265
- :host([selected]) .icon {
266
- margin-inline-start: 0;
267
- }
268
- :host([selected]:not(.-hide-selection)) ::slotted([slot="icon"]) {
269
- display: none !important;
270
- }
271
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base {
272
- color: var(--m3e-chip-unselected-label-text-color, ${n.color.onSurfaceVariant});
273
- --m3e-ripple-color: var(--m3e-chip-unselected-ripple-color, ${n.color.onSurfaceVariant});
274
- --m3e-state-layer-focus-color: var(
275
- --m3e-chip-unselected-state-layer-focus-color,
276
- ${n.color.onSurfaceVariant}
277
- );
278
- --m3e-state-layer-hover-color: var(
279
- --m3e-chip-unselected-state-layer-hover-color,
280
- ${n.color.onSurfaceVariant}
281
- );
282
- }
283
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]) {
284
- color: var(--m3e-chip-unselected-leading-icon-color, ${n.color.primary});
285
- }
286
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
287
- color: var(--m3e-chip-unselected-trailing-icon-color, ${n.color.onSurfaceVariant});
288
- }
289
- :host(:not(:disabled):not([disabled-interactive])[selected]) .base {
290
- outline-offset: unset;
291
- outline-width: var(--m3e-chip-selected-outline-thickness, 0);
292
- color: var(--m3e-chip-selected-label-text-color, ${n.color.onSecondaryContainer});
293
- background-color: var(--m3e-chip-selected-container-color, ${n.color.secondaryContainer});
294
- --m3e-state-layer-hover-color: var(
295
- --m3e-chip-selected-container-hover-color,
296
- ${n.color.onSecondaryContainer}
297
- );
298
- --m3e-state-layer-focus-color: var(
299
- --m3e-chip-selected-container-focus-color,
300
- ${n.color.onSecondaryContainer}
301
- );
302
- --m3e-elevation-hover-level: var(--m3e-chip-selected-hover-elevation, ${n.elevation.level1});
303
- --m3e-ripple-color: var(--m3e-chip-selected-ripple-color, ${n.color.onSecondaryContainer});
304
- --m3e-state-layer-focus-color: var(
305
- --m3e-chip-selected-state-layer-focus-color,
306
- ${n.color.onSecondaryContainer}
307
- );
308
- --m3e-state-layer-hover-color: var(
309
- --m3e-chip-selected-state-layer-hover-color,
310
- ${n.color.onSecondaryContainer}
311
- );
312
- }
313
- :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="icon"]) {
314
- color: var(--m3e-chip-selected-leading-icon-color, ${n.color.onSecondaryContainer});
315
- }
316
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
317
- color: var(--m3e-chip-selected-trailing-icon-color, ${n.color.onSecondaryContainer});
318
- }
319
- @media (prefers-reduced-motion) {
320
- .base,
321
- :host(:not(.-with-icon)) .icon {
322
- transition: none;
323
- }
324
- }
325
- @media (forced-colors: active) {
326
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base,
327
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]),
328
- :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) {
329
- color: CanvasText;
330
- }
331
- :host(:not(:disabled):not([disabled-interactive])[selected]) .base,
332
- :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="icon"]),
333
- :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="trailing-icon"]),
334
- :host(:not(:disabled):not([disabled-interactive])) .check {
335
- color: ButtonText;
336
- }
337
- :host(:not(:disabled):not([disabled-interactive])[selected]) .base {
338
- outline-offset: calc(0px - var(--m3e-outlined-chip-outline-thickness, 1px));
339
- outline-width: var(--m3e-outlined-chip-outline-thickness, 1px);
340
- outline-color: ButtonText;
341
- }
342
- }
343
- `],Ae=L([R("m3e-filter-chip")],Ae);let Te=class extends(w(A(E(S(g(u($($e,"radiogroup")))))))){constructor(){super(...arguments),Ee.add(this),this[Pe]=(new I).onActiveItemChange(()=>this[M].activeItem?.focus()).withWrap(),this.multi=!1,this.hideSelectionIndicator=!1}get chips(){return this[M]?.items??[]}get selected(){return this[M]?.selectedItems??[]}get value(){const e=this.selected.map(e=>e.value);switch(e.length){case 0:return null;case 1:return e[0];default:return e}}get[(Ee=new WeakSet,Pe=M,x)](){const e=this.value;if(Array.isArray(e)){const t=new FormData;for(const i of e)t.append(this.name,i);return t}return e}update(e){super.update(e),e.has("vertical")&&(this[M].vertical=this.vertical),e.has("disabled")&&(void 0!==e.get("disabled")||this.disabled)&&(this[M].disabled=this.disabled),e.has("multi")&&(this.role=this.multi?"group":"radiogroup",H(this,Ee,"m",ke).call(this),this[M].multi=this.multi,this[M].disableRovingTabIndex(this.multi)),(e.has("multi")||e.has("disabled"))&&(this.ariaDisabled=this.multi&&this.disabled?"true":null),e.has("hideSelectionIndicator")&&this.chips.forEach(e=>e.classList.toggle("-hide-selection",this.hideSelectionIndicator))}render(){return o`<slot
344
- @slotchange="${H(this,Ee,"m",Se)}"
345
- @keydown="${H(this,Ee,"m",xe)}"
346
- @change="${H(this,Ee,"m",Ce)}"
347
- ></slot>`}};Se=function(){const{added:e}=this[M].setItems([...this.querySelectorAll("m3e-filter-chip")]);e.forEach(e=>e.classList.toggle("-hide-selection",this.hideSelectionIndicator)),H(this,Ee,"m",ke).call(this)},xe=function(e){this.multi||this[M].onKeyDown(e)},Ce=function(e){e.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!0}))},ke=function(){this.chips.forEach(e=>e.role=this.multi?"button":"radio")},L([le({type:Boolean})],Te.prototype,"multi",void 0),L([le({attribute:"hide-selection-indicator",type:Boolean})],Te.prototype,"hideSelectionIndicator",void 0),Te=L([R("m3e-filter-chip-set")],Te);
39
+ function he(e,t){return(t,i,s)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}var de,pe,ue,ve,me,fe,be;let ge=class extends i{constructor(){super(...arguments),de.add(this),pe.set(this,void 0),ue.set(this,""),this.variant="outlined"}get value(){return N(this,pe,"f")??N(this,ue,"f")}set value(e){R(this,pe,e,"f")}firstUpdated(e){super.firstUpdated(e),"listitem"===this.role&&this.removeAttribute("tabindex"),[this._elevation,this._focusRing,this._stateLayer,this._ripple].forEach(e=>{e?.htmlFor||e?.attach(this)})}render(){const e=!r(this)||this.disabled,t=a(this)&&this.disabledInteractive;return o`<div class="base"><m3e-elevation class="elevation" ?disabled="${e||t}"></m3e-elevation><m3e-state-layer class="state-layer" ?disabled="${e||t}"></m3e-state-layer><m3e-focus-ring class="focus-ring" ?disabled="${e}"></m3e-focus-ring><m3e-ripple class="ripple" ?disabled="${e||t}"></m3e-ripple><div class="touch" aria-hidden="true"></div>${l(this)?this[c]():s}<div class="wrapper">${N(this,de,"m",ve).call(this)}</div></div>`}_renderIcon(){return o`<slot name="icon" aria-hidden="true" @slotchange="${N(this,de,"m",me)}"></slot>`}_renderTrailingIcon(){return o`<slot name="trailing-icon" aria-hidden="true" @slotchange="${N(this,de,"m",fe)}"></slot>`}_renderSlot(){return o`<slot @slotchange="${N(this,de,"m",be)}"></slot>`}};pe=new WeakMap,ue=new WeakMap,de=new WeakSet,ve=function(){return o`${this._renderIcon()}<div class="label">${this._renderSlot()}</div>${this._renderTrailingIcon()}`},me=function(e){this.classList.toggle("-with-icon",h(e.target))},fe=function(e){this.classList.toggle("-with-trailing-icon",h(e.target))},be=function(e){R(this,ue,d(e.target),"f")},ge.styles=t`:host { display: inline-block; vertical-align: middle; outline: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .base { box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; position: relative; width: 100%; transition: ${e(`background-color ${n.motion.duration.short4} ${n.motion.easing.standard}`)}; border-radius: var(--m3e-chip-container-shape, ${n.shape.corner.small}); height: calc(var(--m3e-chip-container-height, 2rem) + ${n.density.calc(-2)}); font-size: var(--m3e-chip-label-text-font-size, ${n.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-chip-label-text-font-weight, ${n.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-chip-label-text-line-height, ${n.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-chip-label-text-tracking, ${n.typescale.standard.label.large.tracking}); } :host(:not(m3e-chip):not(:disabled):not([disabled-interactive])) { cursor: pointer; } :host(:not(m3e-chip):not(:disabled)[disabled-interactive]) { cursor: not-allowed; } :host(:not(m3e-chip):not(:disabled):not([disabled-interactive])) .base { user-select: none; } .touch { position: absolute; height: 3rem; left: 0; right: 0; } .wrapper { width: 100%; overflow: hidden; display: inline-flex; align-items: center; column-gap: var(--m3e-chip-spacing, 0.5rem); } .label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; } :host([variant="elevated"]) .base { background-color: var(--m3e-elevated-chip-container-color, ${n.color.surfaceContainerLow}); --m3e-elevation-level: var(--m3e-elevated-chip-elevation, ${n.elevation.level1}); --m3e-elevation-hover-level: var(--m3e-elevated-chip-hover-elevation, ${n.elevation.level2}); --m3e-elevation-focus-level: var(--m3e-elevated-chip-elevation, ${n.elevation.level1}); --m3e-elevation-pressed-level: var(--m3e-elevated-chip-elevation, ${n.elevation.level1}); } :host([variant="outlined"]) .base { outline-width: var(--m3e-outlined-chip-outline-thickness, 1px); outline-style: solid; outline-offset: calc(0px - var(--m3e-outlined-chip-outline-thickness, 1px)); } :host(:not(:disabled):not([disabled-interactive])[variant="outlined"]) .base { outline-color: var(--m3e-outlined-chip-outline-color, ${n.color.outlineVariant}); } :host(:disabled[variant="outlined"]) .base, :host([disabled-interactive][variant="outlined"]) .base { outline-color: color-mix( in srgb, var(--m3e-outlined-chip-disabled-outline-color, ${n.color.onSurface}) var(--m3e-outlined-chip-disabled-outline-opacity, 12%), transparent ); } :host(.-with-icon) .wrapper { padding-inline-start: var(--m3e-chip-with-icon-padding-start, 0.5rem); } :host(:not(.-with-icon)) .wrapper { padding-inline-start: var(--m3e-chip-padding-start, 1rem); } :host(.-with-trailing-icon) .wrapper { padding-inline-end: var(--m3e-chip-with-icon-padding-end, 0.5rem); } :host(:not(.-with-trailing-icon)) .wrapper { padding-inline-end: var(--m3e-chip-padding-end, 1rem); } ::slotted([slot="icon"]), ::slotted([slot="trailing-icon"]) { flex: none; width: 1em; font-size: var(--m3e-chip-icon-size, 1.125rem) !important; } :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base { color: var(--m3e-chip-label-text-color, ${n.color.onSurface}); } :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]), :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) { color: var(--m3e-chip-icon-color, ${n.color.primary}); } :host(:disabled) .base, :host([disabled-interactive]) .base { color: color-mix( in srgb, var(--m3e-chip-disabled-label-text-color, ${n.color.onSurface}) var(--m3e-chip-disabled-label-text-opacity, 38%), transparent ); } :host(:disabled) ::slotted([slot="icon"]), :host([disabled-interactive]) ::slotted([slot="icon"]), :host(:disabled) ::slotted([slot="trailing-icon"]), :host([disabled-interactive]) ::slotted([slot="trailing-icon"]) { color: color-mix( in srgb, var(--m3e-chip-disabled-icon-color, ${n.color.onSurface}) var(--m3e-chip-disabled-icon-opacity, 38%), transparent ); } :host([variant="elevated"]:disabled) .base, :host([variant="elevated"][disabled-interactive]) .base { background-color: color-mix( in srgb, var(--m3e-elevated-chip-disabled-container-color, ${n.color.onSurface}) var(--m3e-elevated-chip-disabled-container-opacity, 12%), transparent ); --m3e-elevation-level: var(--m3e-elevated-chip-disabled-elevation, ${n.elevation.level0}); } @media (prefers-reduced-motion) { .base { transition: none; } } @media (forced-colors: active) { .base { transition: none; } :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base, :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]), :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) { color: CanvasText; } :host(:not(:disabled):not([disabled-interactive])[variant="outlined"]) .base { outline-color: CanvasText; } :host(:disabled) .base, :host([disabled-interactive]) .base, :host(:disabled) ::slotted([slot="icon"]), :host([disabled-interactive]) ::slotted([slot="icon"]), :host(:disabled) ::slotted([slot="trailing-icon"]), :host([disabled-interactive]) ::slotted([slot="trailing-icon"]) { color: GrayText; } :host(:disabled[variant="outlined"]) .base, :host([disabled-interactive][variant="outlined"]) .base { outline-color: GrayText; } }`,H([he(".elevation")],ge.prototype,"_elevation",void 0),H([he(".focus-ring")],ge.prototype,"_focusRing",void 0),H([he(".state-layer")],ge.prototype,"_stateLayer",void 0),H([he(".ripple")],ge.prototype,"_ripple",void 0),H([ce({reflect:!0})],ge.prototype,"variant",void 0),H([ce()],ge.prototype,"value",null),ge=H([W("m3e-chip")],ge);let $e=class extends(p(u(v(m(f(b(g($(ge,"button")))))),!0))){_renderTrailingIcon(){return s}};$e=H([W("m3e-assist-chip")],$e);let ye=class extends(y(i)){render(){return o`<slot></slot>`}};var we,_e,Ae;ye.styles=t`:host { display: inline-flex; flex-wrap: wrap; vertical-align: middle; gap: var(--m3e-chip-set-spacing, 0.5rem); outline: none; } :host([vertical]) { flex-direction: column; }`,ye=H([W("m3e-chip-set")],ye);let Ee=class extends(w(m(f(b(g(u($(ge,"radio"),!0))))))){constructor(){super(...arguments),we.add(this),_e.set(this,e=>N(this,we,"m",Ae).call(this,e))}connectedCallback(){super.connectedCallback(),this.addEventListener("click",N(this,_e,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",N(this,_e,"f"))}update(e){super.update(e),e.has("selected")&&this.closest("m3e-filter-chip-set")?.[T].notifySelectionChange(this)}_renderIcon(){return o`<div class="icon" aria-hidden="true"><svg class="check" viewBox="0 -960 960 960" aria-hidden="true"><path fill="currentColor" d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/></svg> ${super._renderIcon()}</div>`}};var Se,xe,Ce,ke,Pe,Me,Te;_e=new WeakMap,we=new WeakSet,Ae=function(e){if(e.defaultPrevented)return;const t=this.selected;this.selected=!this.selected,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))?(this.closest("m3e-filter-chip-set")?.[T].notifySelectionChange(this),this.dispatchEvent(new Event("change",{bubbles:!0}))):this.selected=t},Ee.styles=[ge.styles,t`:host([selected]:not(.-hide-selection)) .wrapper { padding-inline-start: var(--m3e-chip-with-icon-padding-start, 0.5rem); } .icon { display: flex; align-items: center; justify-content: center; } .check { width: 1em; font-size: var(--m3e-chip-icon-size, 1.125rem); } :host(:not(:disabled):not([disabled-interactive])) .check { color: var(--m3e-chip-selected-leading-icon-color, ${n.color.onSecondaryContainer}); } :host(:not([selected])) .check, :host(.-hide-selection) .check, :host(.-hide-selection:not(.-with-icon)) .icon { display: none; } :host(:not(.-with-icon)) .icon { margin-inline-start: calc(0px - var(--m3e-chip-with-icon-padding-start, 0.5rem)); transition: margin-inline-start ${n.motion.spring.fastEffects}; } :host([selected]) .icon { margin-inline-start: 0; } :host([selected]:not(.-hide-selection)) ::slotted([slot="icon"]) { display: none !important; } :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base { color: var(--m3e-chip-unselected-label-text-color, ${n.color.onSurfaceVariant}); --m3e-ripple-color: var(--m3e-chip-unselected-ripple-color, ${n.color.onSurfaceVariant}); --m3e-state-layer-focus-color: var( --m3e-chip-unselected-state-layer-focus-color, ${n.color.onSurfaceVariant} ); --m3e-state-layer-hover-color: var( --m3e-chip-unselected-state-layer-hover-color, ${n.color.onSurfaceVariant} ); } :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]) { color: var(--m3e-chip-unselected-leading-icon-color, ${n.color.primary}); } :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) { color: var(--m3e-chip-unselected-trailing-icon-color, ${n.color.onSurfaceVariant}); } :host(:not(:disabled):not([disabled-interactive])[selected]) .base { outline-offset: unset; outline-width: var(--m3e-chip-selected-outline-thickness, 0); color: var(--m3e-chip-selected-label-text-color, ${n.color.onSecondaryContainer}); background-color: var(--m3e-chip-selected-container-color, ${n.color.secondaryContainer}); --m3e-state-layer-hover-color: var( --m3e-chip-selected-container-hover-color, ${n.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-chip-selected-container-focus-color, ${n.color.onSecondaryContainer} ); --m3e-elevation-hover-level: var(--m3e-chip-selected-hover-elevation, ${n.elevation.level1}); --m3e-ripple-color: var(--m3e-chip-selected-ripple-color, ${n.color.onSecondaryContainer}); --m3e-state-layer-focus-color: var( --m3e-chip-selected-state-layer-focus-color, ${n.color.onSecondaryContainer} ); --m3e-state-layer-hover-color: var( --m3e-chip-selected-state-layer-hover-color, ${n.color.onSecondaryContainer} ); } :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="icon"]) { color: var(--m3e-chip-selected-leading-icon-color, ${n.color.onSecondaryContainer}); } :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) { color: var(--m3e-chip-selected-trailing-icon-color, ${n.color.onSecondaryContainer}); } @media (prefers-reduced-motion) { .base, :host(:not(.-with-icon)) .icon { transition: none; } } @media (forced-colors: active) { :host(:not(:disabled):not([disabled-interactive]):not([selected])) .base, :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="icon"]), :host(:not(:disabled):not([disabled-interactive]):not([selected])) ::slotted([slot="trailing-icon"]) { color: CanvasText; } :host(:not(:disabled):not([disabled-interactive])[selected]) .base, :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="icon"]), :host(:not(:disabled):not([disabled-interactive])[selected]) ::slotted([slot="trailing-icon"]), :host(:not(:disabled):not([disabled-interactive])) .check { color: ButtonText; } :host(:not(:disabled):not([disabled-interactive])[selected]) .base { outline-offset: calc(0px - var(--m3e-outlined-chip-outline-thickness, 1px)); outline-width: var(--m3e-outlined-chip-outline-thickness, 1px); outline-color: ButtonText; } }`],Ee=H([W("m3e-filter-chip")],Ee);let Ie=class extends(_(A(E(S(g(u($(ye,"radiogroup")))))))){constructor(){super(...arguments),Se.add(this),xe.set(this,void 0),this[Te]=(new I).onActiveItemChange(()=>this[T].activeItem?.focus()).withWrap().withDirectionality(L.current),this.multi=!1,this.hideSelectionIndicator=!1}get chips(){return this[T]?.items??[]}get selected(){return this[T]?.selectedItems??[]}get value(){const e=this.selected.map(e=>e.value);switch(e.length){case 0:return null;case 1:return e[0];default:return e}}get[(xe=new WeakMap,Se=new WeakSet,Te=T,x)](){const e=this.value;if(Array.isArray(e)){const t=new FormData;for(const i of e)t.append(this.name,i);return t}return e}connectedCallback(){super.connectedCallback(),R(this,xe,L.observe(()=>this[T].directionality=L.current),"f")}disconnectedCallback(){super.disconnectedCallback(),N(this,xe,"f")?.call(this)}update(e){super.update(e),e.has("vertical")&&(this[T].vertical=this.vertical),e.has("disabled")&&(void 0!==e.get("disabled")||this.disabled)&&(this[T].disabled=this.disabled),e.has("multi")&&(this.role=this.multi?"group":"radiogroup",N(this,Se,"m",Me).call(this),this[T].multi=this.multi,this[T].disableRovingTabIndex(this.multi)),(e.has("multi")||e.has("disabled"))&&(this.ariaDisabled=this.multi&&this.disabled?"true":null),e.has("hideSelectionIndicator")&&this.chips.forEach(e=>e.classList.toggle("-hide-selection",this.hideSelectionIndicator))}render(){return o`<slot @slotchange="${N(this,Se,"m",Ce)}" @keydown="${N(this,Se,"m",ke)}" @change="${N(this,Se,"m",Pe)}"></slot>`}};Ce=function(){const{added:e}=this[T].setItems([...this.querySelectorAll("m3e-filter-chip")]);e.forEach(e=>e.classList.toggle("-hide-selection",this.hideSelectionIndicator)),N(this,Se,"m",Me).call(this)},ke=function(e){this.multi||this[T].onKeyDown(e)},Pe=function(e){e.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!0}))},Me=function(){this.chips.forEach(e=>e.role=this.multi?"button":"radio")},H([ce({type:Boolean})],Ie.prototype,"multi",void 0),H([ce({attribute:"hide-selection-indicator",type:Boolean})],Ie.prototype,"hideSelectionIndicator",void 0),Ie=H([W("m3e-filter-chip-set")],Ie);
348
40
  /**
349
41
  * @license
350
42
  * Copyright 2017 Google LLC
351
43
  * SPDX-License-Identifier: BSD-3-Clause
352
44
  */
353
- const Me=globalThis,Ie=Me.trustedTypes,Ue=Ie?Ie.createPolicy("lit-html",{createHTML:e=>e}):void 0,Oe="$lit$",Le=`lit$${Math.random().toFixed(9).slice(2)}$`,He="?"+Le,Ne=`<${He}>`,Re=document,ze=()=>Re.createComment(""),We=e=>null===e||"object"!=typeof e&&"function"!=typeof e,je=Array.isArray,Be="[ \t\n\f\r]",De=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,qe=/-->/g,Ve=/>/g,Fe=RegExp(`>|${Be}(?:([^\\s"'>=/]+)(${Be}*=${Be}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Ke=/'/g,Ze=/"/g,Ge=/^(?:script|style|textarea|title)$/i,Je=Symbol.for("lit-noChange"),Qe=Symbol.for("lit-nothing"),Xe=new WeakMap,Ye=Re.createTreeWalker(Re,129);function et(e,t){if(!je(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Ue?Ue.createHTML(t):t}const tt=(e,t)=>{const i=e.length-1,s=[];let o,n=2===t?"<svg>":3===t?"<math>":"",r=De;for(let t=0;t<i;t++){const i=e[t];let a,l,c=-1,h=0;for(;h<i.length&&(r.lastIndex=h,l=r.exec(i),null!==l);)h=r.lastIndex,r===De?"!--"===l[1]?r=qe:void 0!==l[1]?r=Ve:void 0!==l[2]?(Ge.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=Fe):void 0!==l[3]&&(r=Fe):r===Fe?">"===l[0]?(r=o??De,c=-1):void 0===l[1]?c=-2:(c=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?Fe:'"'===l[3]?Ze:Ke):r===Ze||r===Ke?r=Fe:r===qe||r===Ve?r=De:(r=Fe,o=void 0);const d=r===Fe&&e[t+1].startsWith("/>")?" ":"";n+=r===De?i+Ne:c>=0?(s.push(a),i.slice(0,c)+Oe+i.slice(c)+Le+d):i+Le+(-2===c?t:d)}return[et(e,n+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]};class it{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let o=0,n=0;const r=e.length-1,a=this.parts,[l,c]=tt(e,t);if(this.el=it.createElement(l,i),Ye.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=Ye.nextNode())&&a.length<r;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(Oe)){const t=c[n++],i=s.getAttribute(e).split(Le),r=/([.?@])?(.*)/.exec(t);a.push({type:1,index:o,name:r[2],strings:i,ctor:"."===r[1]?at:"?"===r[1]?lt:"@"===r[1]?ct:rt}),s.removeAttribute(e)}else e.startsWith(Le)&&(a.push({type:6,index:o}),s.removeAttribute(e));if(Ge.test(s.tagName)){const e=s.textContent.split(Le),t=e.length-1;if(t>0){s.textContent=Ie?Ie.emptyScript:"";for(let i=0;i<t;i++)s.append(e[i],ze()),Ye.nextNode(),a.push({type:2,index:++o});s.append(e[t],ze())}}}else if(8===s.nodeType)if(s.data===He)a.push({type:2,index:o});else{let e=-1;for(;-1!==(e=s.data.indexOf(Le,e+1));)a.push({type:7,index:o}),e+=Le.length-1}o++}}static createElement(e,t){const i=Re.createElement("template");return i.innerHTML=e,i}}function st(e,t,i=e,s){if(t===Je)return t;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const n=We(t)?void 0:t._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),void 0===n?o=void 0:(o=new n(e),o._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(t=st(e,o._$AS(e,t.values),o,s)),t}class ot{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??Re).importNode(t,!0);Ye.currentNode=s;let o=Ye.nextNode(),n=0,r=0,a=i[0];for(;void 0!==a;){if(n===a.index){let t;2===a.type?t=new nt(o,o.nextSibling,this,e):1===a.type?t=new a.ctor(o,a.name,a.strings,this,e):6===a.type&&(t=new ht(o,this,e)),this._$AV.push(t),a=i[++r]}n!==a?.index&&(o=Ye.nextNode(),n++)}return Ye.currentNode=Re,s}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class nt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=Qe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=st(this,e,t),We(e)?e===Qe||null==e||""===e?(this._$AH!==Qe&&this._$AR(),this._$AH=Qe):e!==this._$AH&&e!==Je&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>je(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Qe&&We(this._$AH)?this._$AA.nextSibling.data=e:this.T(Re.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,s="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=it.createElement(et(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new ot(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=Xe.get(e.strings);return void 0===t&&Xe.set(e.strings,t=new it(e)),t}k(e){je(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const o of e)s===t.length?t.push(i=new nt(this.O(ze()),this.O(ze()),this,this.options)):i=t[s],i._$AI(o),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class rt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,o){this.type=1,this._$AH=Qe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Qe}_$AI(e,t=this,i,s){const o=this.strings;let n=!1;if(void 0===o)e=st(this,e,t,0),n=!We(e)||e!==this._$AH&&e!==Je,n&&(this._$AH=e);else{const s=e;let r,a;for(e=o[0],r=0;r<o.length-1;r++)a=st(this,s[i+r],t,r),a===Je&&(a=this._$AH[r]),n||=!We(a)||a!==this._$AH[r],a===Qe?e=Qe:e!==Qe&&(e+=(a??"")+o[r+1]),this._$AH[r]=a}n&&!s&&this.j(e)}j(e){e===Qe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class at extends rt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Qe?void 0:e}}class lt extends rt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Qe)}}class ct extends rt{constructor(e,t,i,s,o){super(e,t,i,s,o),this.type=5}_$AI(e,t=this){if((e=st(this,e,t,0)??Qe)===Je)return;const i=this._$AH,s=e===Qe&&i!==Qe||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==Qe&&(i===Qe||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ht{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){st(this,e)}}const dt=Me.litHtmlPolyfillSupport;dt?.(it,nt),(Me.litHtmlVersions??=[]).push("3.3.1");var pt,ut,vt,mt;let ft=class extends(C(b(g(u($(be,"row"),!0))),"remove")){constructor(){super(...arguments),pt.add(this),this.removable=!1,this.removeLabel="Remove"}connectedCallback(){super.connectedCallback(),this.removeAttribute("tabindex")}update(e){super.update(e),this.removeAttribute("tabindex"),e.has("removable")&&this.classList.toggle("-with-trailing-icon",this.removable)}render(){return o`<div class="base">
354
- <m3e-elevation
355
- class="elevation"
356
- for="cell"
357
- ?disabled="${this.disabled||this.disabledInteractive}"
358
- ></m3e-elevation>
359
- <m3e-state-layer
360
- class="state-layer"
361
- for="cell"
362
- ?disabled="${this.disabled||this.disabledInteractive}"
363
- ></m3e-state-layer>
364
- <m3e-focus-ring class="focus-ring" for="cell" ?disabled="${this.disabled}"></m3e-focus-ring>
365
- <m3e-ripple class="ripple" for="cell" ?disabled="${this.disabled||this.disabledInteractive}"></m3e-ripple>
366
- <div class="wrapper">
367
- <div
368
- id="cell"
369
- class="cell"
370
- role="gridcell"
371
- tabindex="${(e=>e??Qe)(this.disabled?void 0:"-1")}"
372
- @keydown="${H(this,pt,"m",mt)}"
373
- >
374
- <slot name="avatar" @slotchange="${H(this,pt,"m",ut)}"></slot>
375
- ${this._renderIcon()}
376
- <div class="label">${this._renderSlot()}</div>
377
- <div class="touch" aria-hidden="true"></div>
378
- </div>
379
- ${this._renderTrailingIcon()}
380
- </div>
381
- </div>`}_renderTrailingIcon(){return this.removable?o`<span role="gridcell" class="remove">
382
- <m3e-icon-button
383
- class="remove-button"
384
- aria-label="${this.removeLabel}"
385
- size="extra-small"
386
- tabindex="-1"
387
- ?disabled="${this.disabled}"
388
- ?disabled-interactive="${this.disabledInteractive}"
389
- @click="${H(this,pt,"m",vt)}"
390
- >
391
- <slot name="remove-icon">
392
- <svg class="remove-icon" viewBox="0 -960 960 960" fill="currentColor">
393
- <path
394
- d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"
395
- />
396
- </svg>
397
- </slot>
398
- </m3e-icon-button>
399
- </span>`:s}};var bt,gt,$t,yt,_t,wt,At,Et,St,xt,Ct,kt,Pt,Tt,Mt,It,Ut,Ot,Lt,Ht,Nt,Rt,zt;pt=new WeakSet,ut=function(e){this.classList.toggle("-with-avatar",h(e.target))},vt=function(e){e.stopPropagation(),this.dispatchEvent(new Event("remove"))},mt=function(e){if(this.removable)switch(e.key){case"Backspace":case"Delete":this.dispatchEvent(new Event("remove"))}},ft.styles=[be.styles,t`
400
- .cell {
401
- display: inline-flex;
402
- align-items: center;
403
- outline: none;
404
- column-gap: var(--m3e-chip-spacing, 0.5rem);
405
- min-width: 0;
406
- }
407
- .remove-button {
408
- --m3e-icon-button-extra-small-container-height: 1.5rem;
409
- --m3e-icon-button-extra-small-icon-size: var(--m3e-chip-icon-size, 1.125rem);
410
- width: 1.5rem;
411
- }
412
- .remove-icon {
413
- flex: none;
414
- width: var(--m3e-chip-icon-size, 1.125rem);
415
- height: var(--m3e-chip-icon-size, 1.125rem);
416
- }
417
- .touch {
418
- top: calc(
419
- 0px - calc(calc(3rem - calc(var(--m3e-chip-container-height, 2rem) + ${n.density.calc(-2)})) / 2)
420
- );
421
- }
422
- .wrapper {
423
- height: 100%;
424
- overflow: visible;
425
- min-width: 0;
426
- }
427
- ::slotted([slot="avatar"]) {
428
- flex: none;
429
- font-size: var(--m3e-chip-avatar-size, 1.5rem);
430
- }
431
- :host(:disabled) ::slotted([slot="avatar"]),
432
- :host([disabled-interactive]) ::slotted([slot="avatar"]) {
433
- opacity: var(--m3e-chip-disabled-avatar-opacity, 38%);
434
- color: var(--m3e-chip-disabled-icon-color, ${n.color.onSurface});
435
- }
436
- :host(.-with-avatar) ::slotted([slot="icon"]) {
437
- display: none;
438
- }
439
- :host(.-with-avatar) .wrapper {
440
- padding-inline-start: var(--m3e-chip-with-avatar-padding-start, 0.25rem);
441
- }
442
- @media (forced-colors: active) {
443
- :host(:disabled) ::slotted([slot="avatar"]),
444
- :host([disabled-interactive]) ::slotted([slot="avatar"]) {
445
- color: CanvasText;
446
- }
447
- }
448
- `],L([ce(".cell")],ft.prototype,"cell",void 0),L([ce(".remove-button")],ft.prototype,"removeButton",void 0),L([le({type:Boolean})],ft.prototype,"removable",void 0),L([le({attribute:"remove-label"})],ft.prototype,"removeLabel",void 0),ft=L([R("m3e-input-chip")],ft);let Wt=class extends(k(P(T(A(E(S(g(u($($e,"grid")))))))))){constructor(){super(...arguments),bt.add(this),gt.set(this,()=>H(this,bt,"m",Rt).call(this)),$t.set(this,e=>H(this,bt,"m",zt).call(this,e)),yt.set(this,()=>H(this,bt,"m",Ut).call(this)),_t.set(this,()=>H(this,bt,"m",Ot).call(this)),wt.set(this,()=>H(this,bt,"m",Lt).call(this)),At.set(this,e=>H(this,bt,"m",Ht).call(this,e)),Et.set(this,e=>H(this,bt,"m",Nt).call(this,e)),St.set(this,new U),xt.set(this,(new O).onActiveItemChange(()=>H(this,xt,"f").activeItem?.focus()).withHomeAndEnd().withSkipPredicate(e=>!e.hasAttribute("tabindex"))),Ct.set(this,!1),kt.set(this,null),Pt.set(this,0)}get chips(){return[...this.querySelectorAll("m3e-input-chip")]}get value(){const e=this.chips.map(e=>e.value);return 0==e.length?null:e}get[(gt=new WeakMap,$t=new WeakMap,yt=new WeakMap,_t=new WeakMap,wt=new WeakMap,At=new WeakMap,Et=new WeakMap,St=new WeakMap,xt=new WeakMap,Ct=new WeakMap,kt=new WeakMap,Pt=new WeakMap,bt=new WeakSet,x)](){const e=this.value;if(!e)return null;const t=new FormData;for(const i of e)t.append(this.name,i);return t}get shouldLabelFloat(){return this.chips.length>0}onContainerClick(){H(this,kt,"f")?.focus()}connectedCallback(){super.connectedCallback(),this.closest("m3e-form-field")?.notifyControlStateChange(),N(this,Pt,Number.parseInt(this.getAttribute("tabindex")??"0"),"f"),this.addEventListener("focus",H(this,yt,"f")),this.addEventListener("focusin",H(this,_t,"f")),this.addEventListener("focusout",H(this,wt,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("focus",H(this,yt,"f")),this.removeEventListener("focusin",H(this,_t,"f")),this.removeEventListener("focusout",H(this,wt,"f"))}firstUpdated(e){super.firstUpdated(e),this.hasAttribute("tabindex")||this.setAttribute("tabindex",`${H(this,Pt,"f")}`)}update(e){super.update(e),e.has("vertical")&&(this.ariaOrientation=null),e.has("disabled")&&(H(this,St,"f").items.forEach(e=>e.disabled=this.disabled),H(this,kt,"f")&&(H(this,kt,"f").disabled=this.disabled))}render(){return o`<slot @keydown="${H(this,bt,"m",Tt)}" @slotchange="${H(this,bt,"m",Mt)}"></slot>
449
- <span role="row">
450
- <span role="gridcell"><slot name="input" @slotchange="${H(this,bt,"m",It)}"></slot></span>
451
- </span> `}};Tt=function(e){H(this,xt,"f").onKeyDown(e)},Mt=async function(){const{added:e,removed:t}=H(this,St,"f").setItems([...this.querySelectorAll("m3e-input-chip")]);for(const t of e)t.isUpdatePending&&await t.updateComplete,this.disabled&&(t.disabled=!0),t.addEventListener("remove",H(this,At,"f")),t.cell.addEventListener("click",H(this,Et,"f"));t.forEach(e=>{e.removeEventListener("remove",H(this,At,"f")),e.cell.removeEventListener("click",H(this,Et,"f"))}),H(this,xt,"f").setItems(H(this,St,"f").items.flatMap(e=>e.removeButton?[e.cell,e.removeButton]:[e.cell])),H(this,xt,"f").activeItem||H(this,xt,"f").updateActiveItem(H(this,xt,"f").items.find(e=>e.hasAttribute("tabindex")))},It=function(){const e=this.querySelector("input");if(H(this,kt,"f")&&(H(this,kt,"f").removeEventListener("change",H(this,gt,"f")),H(this,kt,"f").removeEventListener("keydown",H(this,$t,"f"))),N(this,kt,e,"f"),H(this,kt,"f")){H(this,kt,"f").disabled=this.disabled,H(this,kt,"f").addEventListener("change",H(this,gt,"f")),H(this,kt,"f").addEventListener("keydown",H(this,$t,"f"));const t=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");Object.defineProperty(e,"value",{get:()=>t.get?.call(e),set:i=>{t.set?.call(e,i),H(this,kt,"f")!==e||H(this,Ct,"f")||H(this,bt,"m",Rt).call(this)}})}},Ut=function(){setTimeout(()=>(H(this,xt,"f").activeItem??H(this,kt,"f"))?.focus())},Ot=function(){this.setAttribute("tabindex","-1")},Lt=function(){this.setAttribute("tabindex",`${H(this,Pt,"f")}`)},Ht=function(e){const t=e.target,i=H(this,St,"f").items.indexOf(t),s=H(this,St,"f").items.find((e,t)=>t>i&&!e.disabled&&e.removable);t.remove(),H(this,xt,"f").setActiveItem(H(this,xt,"f").items.find(e=>e===s?.removeButton)),H(this,xt,"f").activeItem||H(this,kt,"f")?.focus(),this.dispatchEvent(new Event("change",{bubbles:!0}))},Nt=function(e){H(this,xt,"f").updateActiveItem(e.composedPath().find(e=>e instanceof ft)?.cell)},Rt=function(){const e=H(this,kt,"f")?.value;e&&setTimeout(()=>{const e=H(this,kt,"f")?.value;if(!e)return;const t=document.createElement("m3e-input-chip");if(t.removable=!0,t.appendChild(document.createTextNode(e)),this.appendChild(t),H(this,kt,"f"))try{N(this,Ct,!0,"f"),H(this,kt,"f").value=""}finally{N(this,Ct,!1,"f")}this.dispatchEvent(new Event("change",{bubbles:!0}))})},zt=function(e){if("Backspace"===e.key&&!H(this,kt,"f")?.value){const e=[...H(this,St,"f").items].reverse().find(e=>!e.disabled&&!e.disabledInteractive&&e.removable);e&&e.dispatchEvent(new Event("remove"))}},(()=>{const e=new CSSStyleSheet;e.replaceSync(t`
452
- m3e-input-chip-set [slot="input"]::placeholder {
453
- user-select: none;
454
- color: currentColor;
455
- transition: opacity ${n.motion.duration.extraLong1};
456
- }
457
- m3e-input-chip-set:not(:focus-within) [slot="input"]::placeholder {
458
- opacity: 0;
459
- transition: 0s;
460
- }
461
- m3e-input-chip-set:hover [slot="input"]::placeholder {
462
- transition: 0s;
463
- }
464
- @media (prefers-reduced-motion) {
465
- m3e-input-chip-set [slot="input"]::placeholder {
466
- transition: none !important;
467
- }
468
- }
469
- `.toString()),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e]})(),Wt.styles=[$e.styles,t`
470
- ::slotted([slot="input"]) {
471
- outline: unset;
472
- border: unset;
473
- background-color: transparent;
474
- box-shadow: none;
475
- font-family: inherit;
476
- font-size: inherit;
477
- line-height: initial;
478
- letter-spacing: inherit;
479
- color: var(--_form-field-input-color, inherit);
480
- flex: 1 1 auto;
481
- min-width: 0;
482
- padding: unset;
483
- }
484
- ::slotted(m3e-input-chip) {
485
- min-width: 0;
486
- }
487
- span[role="row"],
488
- span[role="gridcell"] {
489
- display: contents;
490
- }
491
- `],Wt=L([R("m3e-input-chip-set")],Wt);let jt=class extends(p(u(v(m(f(b(g($(be,"button")))))),!0))){_renderTrailingIcon(){return s}};jt=L([R("m3e-suggestion-chip")],jt);export{ge as M3eAssistChipElement,be as M3eChipElement,$e as M3eChipSetElement,Ae as M3eFilterChipElement,Te as M3eFilterChipSetElement,ft as M3eInputChipElement,Wt as M3eInputChipSetElement,jt as M3eSuggestionChipElement};
45
+ const Ue=globalThis,Oe=Ue.trustedTypes,Le=Oe?Oe.createPolicy("lit-html",{createHTML:e=>e}):void 0,He="$lit$",Ne=`lit$${Math.random().toFixed(9).slice(2)}$`,Re="?"+Ne,We=`<${Re}>`,ze=document,je=()=>ze.createComment(""),De=e=>null===e||"object"!=typeof e&&"function"!=typeof e,Be=Array.isArray,qe="[ \t\n\f\r]",Ve=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fe=/-->/g,Ke=/>/g,Ze=RegExp(`>|${qe}(?:([^\\s"'>=/]+)(${qe}*=${qe}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Ge=/'/g,Je=/"/g,Qe=/^(?:script|style|textarea|title)$/i,Xe=Symbol.for("lit-noChange"),Ye=Symbol.for("lit-nothing"),et=new WeakMap,tt=ze.createTreeWalker(ze,129);function it(e,t){if(!Be(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Le?Le.createHTML(t):t}const st=(e,t)=>{const i=e.length-1,s=[];let o,n=2===t?"<svg>":3===t?"<math>":"",r=Ve;for(let t=0;t<i;t++){const i=e[t];let a,l,c=-1,h=0;for(;h<i.length&&(r.lastIndex=h,l=r.exec(i),null!==l);)h=r.lastIndex,r===Ve?"!--"===l[1]?r=Fe:void 0!==l[1]?r=Ke:void 0!==l[2]?(Qe.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=Ze):void 0!==l[3]&&(r=Ze):r===Ze?">"===l[0]?(r=o??Ve,c=-1):void 0===l[1]?c=-2:(c=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?Ze:'"'===l[3]?Je:Ge):r===Je||r===Ge?r=Ze:r===Fe||r===Ke?r=Ve:(r=Ze,o=void 0);const d=r===Ze&&e[t+1].startsWith("/>")?" ":"";n+=r===Ve?i+We:c>=0?(s.push(a),i.slice(0,c)+He+i.slice(c)+Ne+d):i+Ne+(-2===c?t:d)}return[it(e,n+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]};class ot{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let o=0,n=0;const r=e.length-1,a=this.parts,[l,c]=st(e,t);if(this.el=ot.createElement(l,i),tt.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=tt.nextNode())&&a.length<r;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(He)){const t=c[n++],i=s.getAttribute(e).split(Ne),r=/([.?@])?(.*)/.exec(t);a.push({type:1,index:o,name:r[2],strings:i,ctor:"."===r[1]?ct:"?"===r[1]?ht:"@"===r[1]?dt:lt}),s.removeAttribute(e)}else e.startsWith(Ne)&&(a.push({type:6,index:o}),s.removeAttribute(e));if(Qe.test(s.tagName)){const e=s.textContent.split(Ne),t=e.length-1;if(t>0){s.textContent=Oe?Oe.emptyScript:"";for(let i=0;i<t;i++)s.append(e[i],je()),tt.nextNode(),a.push({type:2,index:++o});s.append(e[t],je())}}}else if(8===s.nodeType)if(s.data===Re)a.push({type:2,index:o});else{let e=-1;for(;-1!==(e=s.data.indexOf(Ne,e+1));)a.push({type:7,index:o}),e+=Ne.length-1}o++}}static createElement(e,t){const i=ze.createElement("template");return i.innerHTML=e,i}}function nt(e,t,i=e,s){if(t===Xe)return t;let o=void 0!==s?i._$Co?.[s]:i._$Cl;const n=De(t)?void 0:t._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),void 0===n?o=void 0:(o=new n(e),o._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=o:i._$Cl=o),void 0!==o&&(t=nt(e,o._$AS(e,t.values),o,s)),t}class rt{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??ze).importNode(t,!0);tt.currentNode=s;let o=tt.nextNode(),n=0,r=0,a=i[0];for(;void 0!==a;){if(n===a.index){let t;2===a.type?t=new at(o,o.nextSibling,this,e):1===a.type?t=new a.ctor(o,a.name,a.strings,this,e):6===a.type&&(t=new pt(o,this,e)),this._$AV.push(t),a=i[++r]}n!==a?.index&&(o=tt.nextNode(),n++)}return tt.currentNode=ze,s}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class at{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=Ye,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=nt(this,e,t),De(e)?e===Ye||null==e||""===e?(this._$AH!==Ye&&this._$AR(),this._$AH=Ye):e!==this._$AH&&e!==Xe&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>Be(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Ye&&De(this._$AH)?this._$AA.nextSibling.data=e:this.T(ze.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,s="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=ot.createElement(it(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new rt(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=et.get(e.strings);return void 0===t&&et.set(e.strings,t=new ot(e)),t}k(e){Be(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const o of e)s===t.length?t.push(i=new at(this.O(je()),this.O(je()),this,this.options)):i=t[s],i._$AI(o),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class lt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,o){this.type=1,this._$AH=Ye,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Ye}_$AI(e,t=this,i,s){const o=this.strings;let n=!1;if(void 0===o)e=nt(this,e,t,0),n=!De(e)||e!==this._$AH&&e!==Xe,n&&(this._$AH=e);else{const s=e;let r,a;for(e=o[0],r=0;r<o.length-1;r++)a=nt(this,s[i+r],t,r),a===Xe&&(a=this._$AH[r]),n||=!De(a)||a!==this._$AH[r],a===Ye?e=Ye:e!==Ye&&(e+=(a??"")+o[r+1]),this._$AH[r]=a}n&&!s&&this.j(e)}j(e){e===Ye?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ct extends lt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ye?void 0:e}}class ht extends lt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Ye)}}class dt extends lt{constructor(e,t,i,s,o){super(e,t,i,s,o),this.type=5}_$AI(e,t=this){if((e=nt(this,e,t,0)??Ye)===Xe)return;const i=this._$AH,s=e===Ye&&i!==Ye||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==Ye&&(i===Ye||s);s&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class pt{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){nt(this,e)}}const ut=Ue.litHtmlPolyfillSupport;ut?.(ot,at),(Ue.litHtmlVersions??=[]).push("3.3.1");var vt,mt,ft,bt;let gt=class extends(C(b(g(u($(ge,"row"),!0))),"remove")){constructor(){super(...arguments),vt.add(this),this.removable=!1,this.removeLabel="Remove"}connectedCallback(){super.connectedCallback(),this.removeAttribute("tabindex")}update(e){super.update(e),this.removeAttribute("tabindex"),e.has("removable")&&this.classList.toggle("-with-trailing-icon",this.removable)}render(){return o`<div class="base"><m3e-elevation class="elevation" for="cell" ?disabled="${this.disabled||this.disabledInteractive}"></m3e-elevation><m3e-state-layer class="state-layer" for="cell" ?disabled="${this.disabled||this.disabledInteractive}"></m3e-state-layer><m3e-focus-ring class="focus-ring" for="cell" ?disabled="${this.disabled}"></m3e-focus-ring><m3e-ripple class="ripple" for="cell" ?disabled="${this.disabled||this.disabledInteractive}"></m3e-ripple><div class="wrapper"><div id="cell" class="cell" role="gridcell" tabindex="${(e=>e??Ye)(this.disabled?void 0:"-1")}" @keydown="${N(this,vt,"m",bt)}"><slot name="avatar" @slotchange="${N(this,vt,"m",mt)}"></slot>${this._renderIcon()}<div class="label">${this._renderSlot()}</div><div class="touch" aria-hidden="true"></div></div>${this._renderTrailingIcon()}</div></div>`}_renderTrailingIcon(){return this.removable?o`<span role="gridcell" class="remove"><m3e-icon-button class="remove-button" aria-label="${this.removeLabel}" size="extra-small" tabindex="-1" ?disabled="${this.disabled}" ?disabled-interactive="${this.disabledInteractive}" @click="${N(this,vt,"m",ft)}"><slot name="remove-icon"><svg class="remove-icon" viewBox="0 -960 960 960" fill="currentColor"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg></slot></m3e-icon-button></span>`:s}};var $t,yt,wt,_t,At,Et,St,xt,Ct,kt,Pt,Mt,Tt,It,Ut,Ot,Lt,Ht,Nt,Rt,Wt,zt,jt,Dt;vt=new WeakSet,mt=function(e){this.classList.toggle("-with-avatar",h(e.target))},ft=function(e){e.stopPropagation(),this.dispatchEvent(new Event("remove"))},bt=function(e){if(this.removable)switch(e.key){case"Backspace":case"Delete":this.dispatchEvent(new Event("remove"))}},gt.styles=[ge.styles,t`.cell { display: inline-flex; align-items: center; outline: none; column-gap: var(--m3e-chip-spacing, 0.5rem); min-width: 0; } .remove-button { --m3e-icon-button-extra-small-container-height: 1.5rem; --m3e-icon-button-extra-small-icon-size: var(--m3e-chip-icon-size, 1.125rem); width: 1.5rem; } .remove-icon { flex: none; width: var(--m3e-chip-icon-size, 1.125rem); height: var(--m3e-chip-icon-size, 1.125rem); } .touch { top: calc( 0px - calc(calc(3rem - calc(var(--m3e-chip-container-height, 2rem) + ${n.density.calc(-2)})) / 2) ); } .wrapper { height: 100%; overflow: visible; min-width: 0; } ::slotted([slot="avatar"]) { flex: none; font-size: var(--m3e-chip-avatar-size, 1.5rem); } :host(:disabled) ::slotted([slot="avatar"]), :host([disabled-interactive]) ::slotted([slot="avatar"]) { opacity: var(--m3e-chip-disabled-avatar-opacity, 38%); color: var(--m3e-chip-disabled-icon-color, ${n.color.onSurface}); } :host(.-with-avatar) ::slotted([slot="icon"]) { display: none; } :host(.-with-avatar) .wrapper { padding-inline-start: var(--m3e-chip-with-avatar-padding-start, 0.25rem); } @media (forced-colors: active) { :host(:disabled) ::slotted([slot="avatar"]), :host([disabled-interactive]) ::slotted([slot="avatar"]) { color: CanvasText; } }`],H([he(".cell")],gt.prototype,"cell",void 0),H([he(".remove-button")],gt.prototype,"removeButton",void 0),H([ce({type:Boolean})],gt.prototype,"removable",void 0),H([ce({attribute:"remove-label"})],gt.prototype,"removeLabel",void 0),gt=H([W("m3e-input-chip")],gt);let Bt=class extends(k(P(M(A(E(S(g(u($(ye,"grid")))))))))){constructor(){super(...arguments),$t.add(this),yt.set(this,void 0),wt.set(this,()=>N(this,$t,"m",jt).call(this)),_t.set(this,e=>N(this,$t,"m",Dt).call(this,e)),At.set(this,()=>N(this,$t,"m",Ht).call(this)),Et.set(this,()=>N(this,$t,"m",Nt).call(this)),St.set(this,()=>N(this,$t,"m",Rt).call(this)),xt.set(this,e=>N(this,$t,"m",Wt).call(this,e)),Ct.set(this,e=>N(this,$t,"m",zt).call(this,e)),kt.set(this,new U),Pt.set(this,(new O).onActiveItemChange(()=>N(this,Pt,"f").activeItem?.focus()).withHomeAndEnd().withSkipPredicate(e=>!e.hasAttribute("tabindex")).withDirectionality(L.current)),Mt.set(this,!1),Tt.set(this,null),It.set(this,0)}get chips(){return[...this.querySelectorAll("m3e-input-chip")]}get value(){const e=this.chips.map(e=>e.value);return 0==e.length?null:e}get[(yt=new WeakMap,wt=new WeakMap,_t=new WeakMap,At=new WeakMap,Et=new WeakMap,St=new WeakMap,xt=new WeakMap,Ct=new WeakMap,kt=new WeakMap,Pt=new WeakMap,Mt=new WeakMap,Tt=new WeakMap,It=new WeakMap,$t=new WeakSet,x)](){const e=this.value;if(!e)return null;const t=new FormData;for(const i of e)t.append(this.name,i);return t}get shouldLabelFloat(){return this.chips.length>0}onContainerClick(){N(this,Tt,"f")?.focus()}connectedCallback(){super.connectedCallback(),this.closest("m3e-form-field")?.notifyControlStateChange(),R(this,It,Number.parseInt(this.getAttribute("tabindex")??"0"),"f"),this.addEventListener("focus",N(this,At,"f")),this.addEventListener("focusin",N(this,Et,"f")),this.addEventListener("focusout",N(this,St,"f")),R(this,yt,L.observe(()=>N(this,Pt,"f").directionality=L.current),"f")}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("focus",N(this,At,"f")),this.removeEventListener("focusin",N(this,Et,"f")),this.removeEventListener("focusout",N(this,St,"f")),N(this,yt,"f")?.call(this)}firstUpdated(e){super.firstUpdated(e),this.hasAttribute("tabindex")||this.setAttribute("tabindex",`${N(this,It,"f")}`)}update(e){super.update(e),e.has("vertical")&&(this.ariaOrientation=null),e.has("disabled")&&(N(this,kt,"f").items.forEach(e=>e.disabled=this.disabled),N(this,Tt,"f")&&(N(this,Tt,"f").disabled=this.disabled))}render(){return o`<slot @keydown="${N(this,$t,"m",Ut)}" @slotchange="${N(this,$t,"m",Ot)}"></slot><span role="row"><span role="gridcell"><slot name="input" @slotchange="${N(this,$t,"m",Lt)}"></slot></span></span>`}};Ut=function(e){N(this,Pt,"f").onKeyDown(e)},Ot=async function(){const{added:e,removed:t}=N(this,kt,"f").setItems([...this.querySelectorAll("m3e-input-chip")]);for(const t of e)t.isUpdatePending&&await t.updateComplete,this.disabled&&(t.disabled=!0),t.addEventListener("remove",N(this,xt,"f")),t.cell.addEventListener("click",N(this,Ct,"f"));t.forEach(e=>{e.removeEventListener("remove",N(this,xt,"f")),e.cell.removeEventListener("click",N(this,Ct,"f"))}),N(this,Pt,"f").setItems(N(this,kt,"f").items.flatMap(e=>e.removeButton?[e.cell,e.removeButton]:[e.cell])),N(this,Pt,"f").activeItem||N(this,Pt,"f").updateActiveItem(N(this,Pt,"f").items.find(e=>e.hasAttribute("tabindex")))},Lt=function(){const e=this.querySelector("input");if(N(this,Tt,"f")&&(N(this,Tt,"f").removeEventListener("change",N(this,wt,"f")),N(this,Tt,"f").removeEventListener("keydown",N(this,_t,"f"))),R(this,Tt,e,"f"),N(this,Tt,"f")){N(this,Tt,"f").disabled=this.disabled,N(this,Tt,"f").addEventListener("change",N(this,wt,"f")),N(this,Tt,"f").addEventListener("keydown",N(this,_t,"f"));const t=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");Object.defineProperty(e,"value",{get:()=>t.get?.call(e),set:i=>{t.set?.call(e,i),N(this,Tt,"f")!==e||N(this,Mt,"f")||N(this,$t,"m",jt).call(this)}})}},Ht=function(){setTimeout(()=>(N(this,Pt,"f").activeItem??N(this,Tt,"f"))?.focus())},Nt=function(){this.setAttribute("tabindex","-1")},Rt=function(){this.setAttribute("tabindex",`${N(this,It,"f")}`)},Wt=function(e){const t=e.target,i=N(this,kt,"f").items.indexOf(t),s=N(this,kt,"f").items.find((e,t)=>t>i&&!e.disabled&&e.removable);t.remove(),N(this,Pt,"f").setActiveItem(N(this,Pt,"f").items.find(e=>e===s?.removeButton)),N(this,Pt,"f").activeItem||N(this,Tt,"f")?.focus(),this.dispatchEvent(new Event("change",{bubbles:!0}))},zt=function(e){N(this,Pt,"f").updateActiveItem(e.composedPath().find(e=>e instanceof gt)?.cell)},jt=function(){const e=N(this,Tt,"f")?.value;e&&setTimeout(()=>{const e=N(this,Tt,"f")?.value;if(!e)return;const t=document.createElement("m3e-input-chip");if(t.removable=!0,t.appendChild(document.createTextNode(e)),this.appendChild(t),N(this,Tt,"f"))try{R(this,Mt,!0,"f"),N(this,Tt,"f").value=""}finally{R(this,Mt,!1,"f")}this.dispatchEvent(new Event("change",{bubbles:!0}))})},Dt=function(e){if("Backspace"===e.key&&!N(this,Tt,"f")?.value){const e=[...N(this,kt,"f").items].reverse().find(e=>!e.disabled&&!e.disabledInteractive&&e.removable);e&&e.dispatchEvent(new Event("remove"))}},(()=>{const e=new CSSStyleSheet;e.replaceSync(t`m3e-input-chip-set [slot="input"]::placeholder { user-select: none; color: currentColor; transition: opacity ${n.motion.duration.extraLong1}; } m3e-input-chip-set:not(:focus-within) [slot="input"]::placeholder { opacity: 0; transition: 0s; } m3e-input-chip-set:hover [slot="input"]::placeholder { transition: 0s; } @media (prefers-reduced-motion) { m3e-input-chip-set [slot="input"]::placeholder { transition: none !important; } }`.toString()),document.adoptedStyleSheets=[...document.adoptedStyleSheets,e]})(),Bt.styles=[ye.styles,t`::slotted([slot="input"]) { outline: unset; border: unset; background-color: transparent; box-shadow: none; font-family: inherit; font-size: inherit; line-height: initial; letter-spacing: inherit; color: var(--_form-field-input-color, inherit); flex: 1 1 auto; min-width: 0; padding: unset; } ::slotted(m3e-input-chip) { min-width: 0; } span[role="row"], span[role="gridcell"] { display: contents; }`],Bt=H([W("m3e-input-chip-set")],Bt);let qt=class extends(p(u(v(m(f(b(g($(ge,"button")))))),!0))){_renderTrailingIcon(){return s}};qt=H([W("m3e-suggestion-chip")],qt);export{$e as M3eAssistChipElement,ge as M3eChipElement,ye as M3eChipSetElement,Ee as M3eFilterChipElement,Ie as M3eFilterChipSetElement,gt as M3eInputChipElement,Bt as M3eInputChipSetElement,qt as M3eSuggestionChipElement};
492
46
  //# sourceMappingURL=index.min.js.map