@m3e/autocomplete 1.0.6 → 1.1.1

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.js CHANGED
@@ -20,33 +20,30 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20
20
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21
21
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
22
  PERFORMANCE OF THIS SOFTWARE.
23
- ***************************************************************************** */
24
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
25
-
26
-
27
- function __decorate(decorators, target, key, desc) {
28
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
31
- return c > 3 && r && Object.defineProperty(target, key, r), r;
32
- }
33
-
34
- function __classPrivateFieldGet(receiver, state, kind, f) {
35
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
36
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
37
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
38
- }
39
-
40
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
41
- if (kind === "m") throw new TypeError("Private method is not writable");
42
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
43
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
44
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
45
- }
46
-
47
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
48
- var e = new Error(message);
49
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
23
+ ***************************************************************************** */
24
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
25
+
26
+ function __decorate(decorators, target, key, desc) {
27
+ var c = arguments.length,
28
+ r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
29
+ d;
30
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
31
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
32
+ }
33
+ function __classPrivateFieldGet(receiver, state, kind, f) {
34
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
35
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
36
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
37
+ }
38
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
39
+ if (kind === "m") throw new TypeError("Private method is not writable");
40
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
41
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
42
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
43
+ }
44
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
45
+ var e = new Error(message);
46
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
50
47
  };
51
48
 
52
49
  /**
@@ -54,26 +51,372 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
54
51
  * Copyright 2017 Google LLC
55
52
  * SPDX-License-Identifier: BSD-3-Clause
56
53
  */
57
- const t$1=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
54
+ const t$1 = t => (e, o) => {
55
+ void 0 !== o ? o.addInitializer(() => {
56
+ customElements.define(t, e);
57
+ }) : customElements.define(t, e);
58
+ };
58
59
 
59
60
  /**
60
61
  * @license
61
62
  * Copyright 2019 Google LLC
62
63
  * SPDX-License-Identifier: BSD-3-Clause
63
64
  */
64
- const t=globalThis,e$1=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o$2=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$1&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$2.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$2.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$2("string"==typeof t?t:t+"",void 0,s),S=(s,o)=>{if(e$1)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$1=e$1?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
65
+ const t = globalThis,
66
+ e$1 = t.ShadowRoot && (void 0 === t.ShadyCSS || t.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype,
67
+ s = Symbol(),
68
+ o$2 = new WeakMap();
69
+ let n$2 = class n {
70
+ constructor(t, e, o) {
71
+ if (this._$cssResult$ = true, o !== s) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
72
+ this.cssText = t, this.t = e;
73
+ }
74
+ get styleSheet() {
75
+ let t = this.o;
76
+ const s = this.t;
77
+ if (e$1 && void 0 === t) {
78
+ const e = void 0 !== s && 1 === s.length;
79
+ e && (t = o$2.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$2.set(s, t));
80
+ }
81
+ return t;
82
+ }
83
+ toString() {
84
+ return this.cssText;
85
+ }
86
+ };
87
+ const r$2 = t => new n$2("string" == typeof t ? t : t + "", void 0, s),
88
+ S = (s, o) => {
89
+ if (e$1) s.adoptedStyleSheets = o.map(t => t instanceof CSSStyleSheet ? t : t.styleSheet);else for (const e of o) {
90
+ const o = document.createElement("style"),
91
+ n = t.litNonce;
92
+ void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
93
+ }
94
+ },
95
+ c$1 = e$1 ? t => t : t => t instanceof CSSStyleSheet ? (t => {
96
+ let e = "";
97
+ for (const s of t.cssRules) e += s.cssText;
98
+ return r$2(e);
99
+ })(t) : t;
65
100
 
66
101
  /**
67
102
  * @license
68
103
  * Copyright 2017 Google LLC
69
104
  * SPDX-License-Identifier: BSD-3-Clause
70
- */const{is:i,defineProperty:e,getOwnPropertyDescriptor:h,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$1,getPrototypeOf:n$1}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:"",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f=(t,s)=>!i(t,s),b={attribute:true,type:String,converter:u,reflect:false,useDefault:false,hasChanged:f};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...r$1(t),...o$1(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$1(s));}else void 0!==s&&i.push(c$1(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[d("elementProperties")]=new Map,y[d("finalized")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push("2.1.1");
105
+ */
106
+ const {
107
+ is: i,
108
+ defineProperty: e,
109
+ getOwnPropertyDescriptor: h,
110
+ getOwnPropertyNames: r$1,
111
+ getOwnPropertySymbols: o$1,
112
+ getPrototypeOf: n$1
113
+ } = Object,
114
+ a = globalThis,
115
+ c = a.trustedTypes,
116
+ l = c ? c.emptyScript : "",
117
+ p = a.reactiveElementPolyfillSupport,
118
+ d = (t, s) => t,
119
+ u = {
120
+ toAttribute(t, s) {
121
+ switch (s) {
122
+ case Boolean:
123
+ t = t ? l : null;
124
+ break;
125
+ case Object:
126
+ case Array:
127
+ t = null == t ? t : JSON.stringify(t);
128
+ }
129
+ return t;
130
+ },
131
+ fromAttribute(t, s) {
132
+ let i = t;
133
+ switch (s) {
134
+ case Boolean:
135
+ i = null !== t;
136
+ break;
137
+ case Number:
138
+ i = null === t ? null : Number(t);
139
+ break;
140
+ case Object:
141
+ case Array:
142
+ try {
143
+ i = JSON.parse(t);
144
+ } catch (t) {
145
+ i = null;
146
+ }
147
+ }
148
+ return i;
149
+ }
150
+ },
151
+ f = (t, s) => !i(t, s),
152
+ b = {
153
+ attribute: true,
154
+ type: String,
155
+ converter: u,
156
+ reflect: false,
157
+ useDefault: false,
158
+ hasChanged: f
159
+ };
160
+ Symbol.metadata ??= Symbol("metadata"), a.litPropertyMetadata ??= new WeakMap();
161
+ class y extends HTMLElement {
162
+ static addInitializer(t) {
163
+ this._$Ei(), (this.l ??= []).push(t);
164
+ }
165
+ static get observedAttributes() {
166
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
167
+ }
168
+ static createProperty(t, s = b) {
169
+ if (s.state && (s.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = true), this.elementProperties.set(t, s), !s.noAccessor) {
170
+ const i = Symbol(),
171
+ h = this.getPropertyDescriptor(t, i, s);
172
+ void 0 !== h && e(this.prototype, t, h);
173
+ }
174
+ }
175
+ static getPropertyDescriptor(t, s, i) {
176
+ const {
177
+ get: e,
178
+ set: r
179
+ } = h(this.prototype, t) ?? {
180
+ get() {
181
+ return this[s];
182
+ },
183
+ set(t) {
184
+ this[s] = t;
185
+ }
186
+ };
187
+ return {
188
+ get: e,
189
+ set(s) {
190
+ const h = e?.call(this);
191
+ r?.call(this, s), this.requestUpdate(t, h, i);
192
+ },
193
+ configurable: true,
194
+ enumerable: true
195
+ };
196
+ }
197
+ static getPropertyOptions(t) {
198
+ return this.elementProperties.get(t) ?? b;
199
+ }
200
+ static _$Ei() {
201
+ if (this.hasOwnProperty(d("elementProperties"))) return;
202
+ const t = n$1(this);
203
+ t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
204
+ }
205
+ static finalize() {
206
+ if (this.hasOwnProperty(d("finalized"))) return;
207
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d("properties"))) {
208
+ const t = this.properties,
209
+ s = [...r$1(t), ...o$1(t)];
210
+ for (const i of s) this.createProperty(i, t[i]);
211
+ }
212
+ const t = this[Symbol.metadata];
213
+ if (null !== t) {
214
+ const s = litPropertyMetadata.get(t);
215
+ if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
216
+ }
217
+ this._$Eh = new Map();
218
+ for (const [t, s] of this.elementProperties) {
219
+ const i = this._$Eu(t, s);
220
+ void 0 !== i && this._$Eh.set(i, t);
221
+ }
222
+ this.elementStyles = this.finalizeStyles(this.styles);
223
+ }
224
+ static finalizeStyles(s) {
225
+ const i = [];
226
+ if (Array.isArray(s)) {
227
+ const e = new Set(s.flat(1 / 0).reverse());
228
+ for (const s of e) i.unshift(c$1(s));
229
+ } else void 0 !== s && i.push(c$1(s));
230
+ return i;
231
+ }
232
+ static _$Eu(t, s) {
233
+ const i = s.attribute;
234
+ return false === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
235
+ }
236
+ constructor() {
237
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
238
+ }
239
+ _$Ev() {
240
+ this._$ES = new Promise(t => this.enableUpdating = t), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(t => t(this));
241
+ }
242
+ addController(t) {
243
+ (this._$EO ??= new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
244
+ }
245
+ removeController(t) {
246
+ this._$EO?.delete(t);
247
+ }
248
+ _$E_() {
249
+ const t = new Map(),
250
+ s = this.constructor.elementProperties;
251
+ for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
252
+ t.size > 0 && (this._$Ep = t);
253
+ }
254
+ createRenderRoot() {
255
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
256
+ return S(t, this.constructor.elementStyles), t;
257
+ }
258
+ connectedCallback() {
259
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(t => t.hostConnected?.());
260
+ }
261
+ enableUpdating(t) {}
262
+ disconnectedCallback() {
263
+ this._$EO?.forEach(t => t.hostDisconnected?.());
264
+ }
265
+ attributeChangedCallback(t, s, i) {
266
+ this._$AK(t, i);
267
+ }
268
+ _$ET(t, s) {
269
+ const i = this.constructor.elementProperties.get(t),
270
+ e = this.constructor._$Eu(t, i);
271
+ if (void 0 !== e && true === i.reflect) {
272
+ const h = (void 0 !== i.converter?.toAttribute ? i.converter : u).toAttribute(s, i.type);
273
+ this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
274
+ }
275
+ }
276
+ _$AK(t, s) {
277
+ const i = this.constructor,
278
+ e = i._$Eh.get(t);
279
+ if (void 0 !== e && this._$Em !== e) {
280
+ const t = i.getPropertyOptions(e),
281
+ h = "function" == typeof t.converter ? {
282
+ fromAttribute: t.converter
283
+ } : void 0 !== t.converter?.fromAttribute ? t.converter : u;
284
+ this._$Em = e;
285
+ const r = h.fromAttribute(s, t.type);
286
+ this[e] = r ?? this._$Ej?.get(e) ?? r, this._$Em = null;
287
+ }
288
+ }
289
+ requestUpdate(t, s, i) {
290
+ if (void 0 !== t) {
291
+ const e = this.constructor,
292
+ h = this[t];
293
+ if (i ??= e.getPropertyOptions(t), !((i.hasChanged ?? f)(h, s) || i.useDefault && i.reflect && h === this._$Ej?.get(t) && !this.hasAttribute(e._$Eu(t, i)))) return;
294
+ this.C(t, s, i);
295
+ }
296
+ false === this.isUpdatePending && (this._$ES = this._$EP());
297
+ }
298
+ C(t, s, {
299
+ useDefault: i,
300
+ reflect: e,
301
+ wrapped: h
302
+ }, r) {
303
+ i && !(this._$Ej ??= new Map()).has(t) && (this._$Ej.set(t, r ?? s ?? this[t]), true !== h || void 0 !== r) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), true === e && this._$Em !== t && (this._$Eq ??= new Set()).add(t));
304
+ }
305
+ async _$EP() {
306
+ this.isUpdatePending = true;
307
+ try {
308
+ await this._$ES;
309
+ } catch (t) {
310
+ Promise.reject(t);
311
+ }
312
+ const t = this.scheduleUpdate();
313
+ return null != t && (await t), !this.isUpdatePending;
314
+ }
315
+ scheduleUpdate() {
316
+ return this.performUpdate();
317
+ }
318
+ performUpdate() {
319
+ if (!this.isUpdatePending) return;
320
+ if (!this.hasUpdated) {
321
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
322
+ for (const [t, s] of this._$Ep) this[t] = s;
323
+ this._$Ep = void 0;
324
+ }
325
+ const t = this.constructor.elementProperties;
326
+ if (t.size > 0) for (const [s, i] of t) {
327
+ const {
328
+ wrapped: t
329
+ } = i,
330
+ e = this[s];
331
+ true !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
332
+ }
333
+ }
334
+ let t = false;
335
+ const s = this._$AL;
336
+ try {
337
+ t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach(t => t.hostUpdate?.()), this.update(s)) : this._$EM();
338
+ } catch (s) {
339
+ throw t = false, this._$EM(), s;
340
+ }
341
+ t && this._$AE(s);
342
+ }
343
+ willUpdate(t) {}
344
+ _$AE(t) {
345
+ this._$EO?.forEach(t => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t)), this.updated(t);
346
+ }
347
+ _$EM() {
348
+ this._$AL = new Map(), this.isUpdatePending = false;
349
+ }
350
+ get updateComplete() {
351
+ return this.getUpdateComplete();
352
+ }
353
+ getUpdateComplete() {
354
+ return this._$ES;
355
+ }
356
+ shouldUpdate(t) {
357
+ return true;
358
+ }
359
+ update(t) {
360
+ this._$Eq &&= this._$Eq.forEach(t => this._$ET(t, this[t])), this._$EM();
361
+ }
362
+ updated(t) {}
363
+ firstUpdated(t) {}
364
+ }
365
+ y.elementStyles = [], y.shadowRootOptions = {
366
+ mode: "open"
367
+ }, y[d("elementProperties")] = new Map(), y[d("finalized")] = new Map(), p?.({
368
+ ReactiveElement: y
369
+ }), (a.reactiveElementVersions ??= []).push("2.1.1");
71
370
 
72
371
  /**
73
372
  * @license
74
373
  * Copyright 2017 Google LLC
75
374
  * SPDX-License-Identifier: BSD-3-Clause
76
- */const o={attribute:true,type:String,converter:u,reflect:false,hasChanged:f},r=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
375
+ */
376
+ const o = {
377
+ attribute: true,
378
+ type: String,
379
+ converter: u,
380
+ reflect: false,
381
+ hasChanged: f
382
+ },
383
+ r = (t = o, e, r) => {
384
+ const {
385
+ kind: n,
386
+ metadata: i
387
+ } = r;
388
+ let s = globalThis.litPropertyMetadata.get(i);
389
+ if (void 0 === s && globalThis.litPropertyMetadata.set(i, s = new Map()), "setter" === n && ((t = Object.create(t)).wrapped = true), s.set(r.name, t), "accessor" === n) {
390
+ const {
391
+ name: o
392
+ } = r;
393
+ return {
394
+ set(r) {
395
+ const n = e.get.call(this);
396
+ e.set.call(this, r), this.requestUpdate(o, n, t);
397
+ },
398
+ init(e) {
399
+ return void 0 !== e && this.C(o, void 0, t, e), e;
400
+ }
401
+ };
402
+ }
403
+ if ("setter" === n) {
404
+ const {
405
+ name: o
406
+ } = r;
407
+ return function (r) {
408
+ const n = this[o];
409
+ e.call(this, r), this.requestUpdate(o, n, t);
410
+ };
411
+ }
412
+ throw Error("Unsupported decorator location: " + n);
413
+ };
414
+ function n(t) {
415
+ return (e, o) => "object" == typeof o ? r(t, e, o) : ((t, e, o) => {
416
+ const r = e.hasOwnProperty(o);
417
+ return e.constructor.createProperty(o, t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
418
+ })(t, e, o);
419
+ }
77
420
 
78
421
  var _M3eAutocompleteElement_instances, _M3eAutocompleteElement_id, _M3eAutocompleteElement_menuId, _M3eAutocompleteElement_ignoreFocusVisible, _M3eAutocompleteElement_menu, _M3eAutocompleteElement_textHighlight, _M3eAutocompleteElement_ignoreHideMenuOnBlur, _M3eAutocompleteElement_clickHandler, _M3eAutocompleteElement_formFieldPointerDownHandler, _M3eAutocompleteElement_focusHandler, _M3eAutocompleteElement_blurHandler, _M3eAutocompleteElement_keyDownHandler, _M3eAutocompleteElement_inputHandler, _M3eAutocompleteElement_changeHandler, _M3eAutocompleteElement_menuToggleHandler, _M3eAutocompleteElement_menuPointerDownHandler, _M3eAutocompleteElement_input_get, _M3eAutocompleteElement_hasVisibleOptions_get, _M3eAutocompleteElement_minMenuWidth_get, _M3eAutocompleteElement_formField_get, _M3eAutocompleteElement_handleSlotChange, _M3eAutocompleteElement_handleClick, _M3eAutocompleteElement_handleFormFieldPointerDown, _M3eAutocompleteElement_handleFocus, _M3eAutocompleteElement_handleBlur, _M3eAutocompleteElement_handleInput, _M3eAutocompleteElement_handleChange, _M3eAutocompleteElement_handleKeyDown, _M3eAutocompleteElement_handleMenuPointerDown, _M3eAutocompleteElement_handleMenuToggle, _M3eAutocompleteElement_destroyMenu, _M3eAutocompleteElement_showMenu, _M3eAutocompleteElement_hideMenu, _M3eAutocompleteElement_activateOption, _M3eAutocompleteElement_selectOption, _M3eAutocompleteElement_filterOptions, _M3eAutocompleteElement_autoActivate, _M3eAutocompleteElement_deactivateOption;
79
422
  var M3eAutocompleteElement_1;
@@ -110,118 +453,118 @@ var M3eAutocompleteElement_1;
110
453
  * @slot - Renders the options of the autocomplete.
111
454
  */
112
455
  let M3eAutocompleteElement = M3eAutocompleteElement_1 = class M3eAutocompleteElement extends HtmlFor(LitElement) {
113
- constructor() {
114
- super(...arguments);
115
- _M3eAutocompleteElement_instances.add(this);
116
- /** @private */ _M3eAutocompleteElement_id.set(this, `m3e-autocomplete-${M3eAutocompleteElement_1.__nextId}`);
117
- /** @private */ _M3eAutocompleteElement_menuId.set(this, `${__classPrivateFieldGet(this, _M3eAutocompleteElement_id, "f")}-menu`);
118
- /** @private */ _M3eAutocompleteElement_ignoreFocusVisible.set(this, false);
119
- /** @private */ _M3eAutocompleteElement_menu.set(this, void 0);
120
- /** @private */ _M3eAutocompleteElement_textHighlight.set(this, void 0);
121
- /** @private */ _M3eAutocompleteElement_ignoreHideMenuOnBlur.set(this, false);
122
- /** @private */ _M3eAutocompleteElement_clickHandler.set(this, () => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleClick).call(this));
123
- /** @private */ _M3eAutocompleteElement_formFieldPointerDownHandler.set(this, () => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleFormFieldPointerDown).call(this));
124
- /** @private */ _M3eAutocompleteElement_focusHandler.set(this, () => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleFocus).call(this));
125
- /** @private */ _M3eAutocompleteElement_blurHandler.set(this, () => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleBlur).call(this));
126
- /** @private */ _M3eAutocompleteElement_keyDownHandler.set(this, (e) => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleKeyDown).call(this, e));
127
- /** @private */ _M3eAutocompleteElement_inputHandler.set(this, (e) => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleInput).call(this, e));
128
- /** @private */ _M3eAutocompleteElement_changeHandler.set(this, () => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleChange).call(this));
129
- /** @private */ _M3eAutocompleteElement_menuToggleHandler.set(this, (e) => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleMenuToggle).call(this, e));
130
- /** @private */ _M3eAutocompleteElement_menuPointerDownHandler.set(this, (e) => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleMenuPointerDown).call(this, e));
131
- /** @private */ this._listKeyManager = new ListKeyManager()
132
- .withWrap()
133
- .withHomeAndEnd()
134
- .withPageUpAndDown()
135
- .withVerticalOrientation()
136
- .withSkipPredicate((item) => item.disabled || item.style.display === "none")
137
- .onActiveItemChange(() => {
138
- if (this._listKeyManager.activeItem) {
139
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_activateOption).call(this, this._listKeyManager.activeItem);
140
- }
141
- });
142
- /**
143
- * Whether to hide the selection indicator.
144
- * @default false
145
- */
146
- this.hideSelectionIndicator = false;
147
- /**
148
- * Whether the user is required to make a selection when interacting with the autocomplete.
149
- * @default false
150
- */
151
- this.required = false;
152
- /**
153
- * Whether the first option should be automatically activated.
154
- * @default false
155
- */
156
- this.autoActivate = false;
157
- }
158
- /** The options that can be selected. */
159
- get options() {
160
- return this._listKeyManager?.items ?? [];
161
- }
162
- /** @inheritdoc */
163
- attach(control) {
164
- if (!(control instanceof HTMLInputElement))
165
- return;
166
- super.attach(control);
167
- control.autocomplete = "off";
168
- control.role = "combobox";
169
- control.ariaAutoComplete = "list";
170
- control.ariaExpanded = "false";
171
- control.addEventListener("click", __classPrivateFieldGet(this, _M3eAutocompleteElement_clickHandler, "f"));
172
- control.addEventListener("focus", __classPrivateFieldGet(this, _M3eAutocompleteElement_focusHandler, "f"));
173
- control.addEventListener("blur", __classPrivateFieldGet(this, _M3eAutocompleteElement_blurHandler, "f"));
174
- control.addEventListener("keydown", __classPrivateFieldGet(this, _M3eAutocompleteElement_keyDownHandler, "f"));
175
- control.addEventListener("input", __classPrivateFieldGet(this, _M3eAutocompleteElement_inputHandler, "f"));
176
- control.addEventListener("change", __classPrivateFieldGet(this, _M3eAutocompleteElement_changeHandler, "f"));
177
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.addEventListener("pointerdown", __classPrivateFieldGet(this, _M3eAutocompleteElement_formFieldPointerDownHandler, "f"));
178
- }
179
- /** @inheritdoc */
180
- detach() {
181
- if (this.control) {
182
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.removeEventListener("pointerdown", __classPrivateFieldGet(this, _M3eAutocompleteElement_formFieldPointerDownHandler, "f"));
183
- this.control.role = null;
184
- this.control.ariaAutoComplete = null;
185
- this.control.ariaExpanded = null;
186
- this.control.removeEventListener("click", __classPrivateFieldGet(this, _M3eAutocompleteElement_clickHandler, "f"));
187
- this.control.removeEventListener("focus", __classPrivateFieldGet(this, _M3eAutocompleteElement_focusHandler, "f"));
188
- this.control.removeEventListener("blur", __classPrivateFieldGet(this, _M3eAutocompleteElement_blurHandler, "f"));
189
- this.control.removeEventListener("keydown", __classPrivateFieldGet(this, _M3eAutocompleteElement_keyDownHandler, "f"));
190
- this.control.removeEventListener("input", __classPrivateFieldGet(this, _M3eAutocompleteElement_inputHandler, "f"));
191
- this.control.removeEventListener("change", __classPrivateFieldGet(this, _M3eAutocompleteElement_changeHandler, "f"));
192
- }
193
- super.detach();
194
- }
456
+ constructor() {
457
+ super(...arguments);
458
+ _M3eAutocompleteElement_instances.add(this);
459
+ /** @private */
460
+ _M3eAutocompleteElement_id.set(this, `m3e-autocomplete-${M3eAutocompleteElement_1.__nextId}`);
461
+ /** @private */
462
+ _M3eAutocompleteElement_menuId.set(this, `${__classPrivateFieldGet(this, _M3eAutocompleteElement_id, "f")}-menu`);
463
+ /** @private */
464
+ _M3eAutocompleteElement_ignoreFocusVisible.set(this, false);
465
+ /** @private */
466
+ _M3eAutocompleteElement_menu.set(this, void 0);
467
+ /** @private */
468
+ _M3eAutocompleteElement_textHighlight.set(this, void 0);
469
+ /** @private */
470
+ _M3eAutocompleteElement_ignoreHideMenuOnBlur.set(this, false);
471
+ /** @private */
472
+ _M3eAutocompleteElement_clickHandler.set(this, () => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleClick).call(this));
473
+ /** @private */
474
+ _M3eAutocompleteElement_formFieldPointerDownHandler.set(this, () => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleFormFieldPointerDown).call(this));
475
+ /** @private */
476
+ _M3eAutocompleteElement_focusHandler.set(this, () => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleFocus).call(this));
477
+ /** @private */
478
+ _M3eAutocompleteElement_blurHandler.set(this, () => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleBlur).call(this));
479
+ /** @private */
480
+ _M3eAutocompleteElement_keyDownHandler.set(this, e => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleKeyDown).call(this, e));
481
+ /** @private */
482
+ _M3eAutocompleteElement_inputHandler.set(this, e => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleInput).call(this, e));
483
+ /** @private */
484
+ _M3eAutocompleteElement_changeHandler.set(this, () => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleChange).call(this));
485
+ /** @private */
486
+ _M3eAutocompleteElement_menuToggleHandler.set(this, e => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleMenuToggle).call(this, e));
487
+ /** @private */
488
+ _M3eAutocompleteElement_menuPointerDownHandler.set(this, e => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleMenuPointerDown).call(this, e));
489
+ /** @private */
490
+ this._listKeyManager = new ListKeyManager().withWrap().withHomeAndEnd().withPageUpAndDown().withVerticalOrientation().withSkipPredicate(item => item.disabled || item.style.display === "none").onActiveItemChange(() => {
491
+ if (this._listKeyManager.activeItem) {
492
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_activateOption).call(this, this._listKeyManager.activeItem);
493
+ }
494
+ });
195
495
  /**
196
- * Clears the value of the element.
197
- * @param [restoreFocus=false] Whether to restore input focus.
496
+ * Whether to hide the selection indicator.
497
+ * @default false
198
498
  */
199
- clear(restoreFocus = false) {
200
- if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get))
201
- return;
202
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value = "";
203
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f")) {
204
- __classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").term = "";
205
- }
206
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_filterOptions).call(this);
207
- if (restoreFocus) {
208
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).focus();
209
- }
210
- else {
211
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
212
- }
499
+ this.hideSelectionIndicator = false;
500
+ /**
501
+ * Whether the user is required to make a selection when interacting with the autocomplete.
502
+ * @default false
503
+ */
504
+ this.required = false;
505
+ /**
506
+ * Whether the first option should be automatically activated.
507
+ * @default false
508
+ */
509
+ this.autoActivate = false;
510
+ }
511
+ /** The options that can be selected. */
512
+ get options() {
513
+ return this._listKeyManager?.items ?? [];
514
+ }
515
+ /** @inheritdoc */
516
+ attach(control) {
517
+ if (!(control instanceof HTMLInputElement)) return;
518
+ super.attach(control);
519
+ control.autocomplete = "off";
520
+ control.role = "combobox";
521
+ control.ariaAutoComplete = "list";
522
+ control.ariaExpanded = "false";
523
+ control.addEventListener("click", __classPrivateFieldGet(this, _M3eAutocompleteElement_clickHandler, "f"));
524
+ control.addEventListener("focus", __classPrivateFieldGet(this, _M3eAutocompleteElement_focusHandler, "f"));
525
+ control.addEventListener("blur", __classPrivateFieldGet(this, _M3eAutocompleteElement_blurHandler, "f"));
526
+ control.addEventListener("keydown", __classPrivateFieldGet(this, _M3eAutocompleteElement_keyDownHandler, "f"));
527
+ control.addEventListener("input", __classPrivateFieldGet(this, _M3eAutocompleteElement_inputHandler, "f"));
528
+ control.addEventListener("change", __classPrivateFieldGet(this, _M3eAutocompleteElement_changeHandler, "f"));
529
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.addEventListener("pointerdown", __classPrivateFieldGet(this, _M3eAutocompleteElement_formFieldPointerDownHandler, "f"));
530
+ }
531
+ /** @inheritdoc */
532
+ detach() {
533
+ if (this.control) {
534
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.removeEventListener("pointerdown", __classPrivateFieldGet(this, _M3eAutocompleteElement_formFieldPointerDownHandler, "f"));
535
+ this.control.role = null;
536
+ this.control.ariaAutoComplete = null;
537
+ this.control.ariaExpanded = null;
538
+ this.control.removeEventListener("click", __classPrivateFieldGet(this, _M3eAutocompleteElement_clickHandler, "f"));
539
+ this.control.removeEventListener("focus", __classPrivateFieldGet(this, _M3eAutocompleteElement_focusHandler, "f"));
540
+ this.control.removeEventListener("blur", __classPrivateFieldGet(this, _M3eAutocompleteElement_blurHandler, "f"));
541
+ this.control.removeEventListener("keydown", __classPrivateFieldGet(this, _M3eAutocompleteElement_keyDownHandler, "f"));
542
+ this.control.removeEventListener("input", __classPrivateFieldGet(this, _M3eAutocompleteElement_inputHandler, "f"));
543
+ this.control.removeEventListener("change", __classPrivateFieldGet(this, _M3eAutocompleteElement_changeHandler, "f"));
213
544
  }
214
- /** @inheritdoc */
215
- connectedCallback() {
216
- this.role = this.role || "none";
217
- super.connectedCallback();
545
+ super.detach();
546
+ }
547
+ /**
548
+ * Clears the value of the element.
549
+ * @param [restoreFocus=false] Whether to restore input focus.
550
+ */
551
+ clear(restoreFocus = false) {
552
+ if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)) return;
553
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value = "";
554
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f")) {
555
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").term = "";
218
556
  }
219
- /** @inheritdoc */
220
- render() {
221
- return html `<div class="options" role="listbox">
222
- <slot @slotchange="${__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleSlotChange)}"></slot>
223
- </div>`;
557
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_filterOptions).call(this);
558
+ if (restoreFocus) {
559
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).focus();
560
+ } else {
561
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
224
562
  }
563
+ }
564
+ /** @inheritdoc */
565
+ render() {
566
+ return html`<div class="options" role="listbox"><slot @slotchange="${__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_handleSlotChange)}"></slot></div>`;
567
+ }
225
568
  };
226
569
  _M3eAutocompleteElement_id = new WeakMap();
227
570
  _M3eAutocompleteElement_menuId = new WeakMap();
@@ -240,300 +583,285 @@ _M3eAutocompleteElement_menuToggleHandler = new WeakMap();
240
583
  _M3eAutocompleteElement_menuPointerDownHandler = new WeakMap();
241
584
  _M3eAutocompleteElement_instances = new WeakSet();
242
585
  _M3eAutocompleteElement_input_get = function _M3eAutocompleteElement_input_get() {
243
- return this.control ? this.control : null;
586
+ return this.control ? this.control : null;
244
587
  };
245
588
  _M3eAutocompleteElement_hasVisibleOptions_get = function _M3eAutocompleteElement_hasVisibleOptions_get() {
246
- return this.options.some((x) => x.style.display !== "none");
589
+ return this.options.some(x => x.style.display !== "none");
247
590
  };
248
591
  _M3eAutocompleteElement_minMenuWidth_get = function _M3eAutocompleteElement_minMenuWidth_get() {
249
- const formField = __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get);
250
- return `${formField ? formField.menuAnchor.clientWidth : (this.control?.clientWidth ?? 0)}px`;
592
+ const formField = __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get);
593
+ return `${formField ? formField.menuAnchor.clientWidth : this.control?.clientWidth ?? 0}px`;
251
594
  };
252
595
  _M3eAutocompleteElement_formField_get = function _M3eAutocompleteElement_formField_get() {
253
- return this.control?.closest("m3e-form-field") ?? null;
596
+ return this.control?.closest("m3e-form-field") ?? null;
254
597
  };
255
598
  _M3eAutocompleteElement_handleSlotChange = function _M3eAutocompleteElement_handleSlotChange() {
256
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f"))
257
- return;
258
- const { added } = this._listKeyManager.setItems([...this.querySelectorAll("m3e-option")]);
259
- added.forEach((x) => {
260
- x.id = x.id || `${__classPrivateFieldGet(this, _M3eAutocompleteElement_id, "f")}-option-${this._listKeyManager.items.indexOf(x)}`;
261
- x.classList.toggle("-hide-selection-indicator", this.hideSelectionIndicator);
262
- });
599
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) return;
600
+ const {
601
+ added
602
+ } = this._listKeyManager.setItems([...this.querySelectorAll("m3e-option")]);
603
+ added.forEach(x => {
604
+ x.id = x.id || `${__classPrivateFieldGet(this, _M3eAutocompleteElement_id, "f")}-option-${this._listKeyManager.items.indexOf(x)}`;
605
+ x.classList.toggle("-hide-selection-indicator", this.hideSelectionIndicator);
606
+ });
263
607
  };
264
608
  _M3eAutocompleteElement_handleClick = function _M3eAutocompleteElement_handleClick() {
265
- __classPrivateFieldSet(this, _M3eAutocompleteElement_ignoreFocusVisible, true, "f");
266
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_showMenu).call(this);
609
+ __classPrivateFieldSet(this, _M3eAutocompleteElement_ignoreFocusVisible, true, "f");
610
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_showMenu).call(this);
267
611
  };
268
612
  _M3eAutocompleteElement_handleFormFieldPointerDown = function _M3eAutocompleteElement_handleFormFieldPointerDown() {
269
- __classPrivateFieldSet(this, _M3eAutocompleteElement_ignoreHideMenuOnBlur, true, "f");
613
+ __classPrivateFieldSet(this, _M3eAutocompleteElement_ignoreHideMenuOnBlur, true, "f");
270
614
  };
271
615
  _M3eAutocompleteElement_handleFocus = function _M3eAutocompleteElement_handleFocus() {
272
- __classPrivateFieldSet(this, _M3eAutocompleteElement_ignoreFocusVisible, true, "f");
273
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_showMenu).call(this);
616
+ __classPrivateFieldSet(this, _M3eAutocompleteElement_ignoreFocusVisible, true, "f");
617
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_showMenu).call(this);
274
618
  };
275
619
  _M3eAutocompleteElement_handleBlur = function _M3eAutocompleteElement_handleBlur() {
276
- if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_ignoreHideMenuOnBlur, "f")) {
277
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
278
- }
279
- __classPrivateFieldSet(this, _M3eAutocompleteElement_ignoreHideMenuOnBlur, false, "f");
620
+ if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_ignoreHideMenuOnBlur, "f")) {
621
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
622
+ }
623
+ __classPrivateFieldSet(this, _M3eAutocompleteElement_ignoreHideMenuOnBlur, false, "f");
280
624
  };
281
625
  _M3eAutocompleteElement_handleInput = function _M3eAutocompleteElement_handleInput(e) {
282
- if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get) || e.defaultPrevented)
283
- return;
284
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f")) {
285
- __classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").term = __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value;
286
- }
287
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_filterOptions).call(this);
288
- if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) {
289
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_showMenu).call(this);
290
- }
291
- else if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_hasVisibleOptions_get)) {
292
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
293
- }
294
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.notifyControlStateChange(true);
626
+ if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get) || e.defaultPrevented) return;
627
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f")) {
628
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").term = __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value;
629
+ }
630
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_filterOptions).call(this);
631
+ if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) {
632
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_showMenu).call(this);
633
+ } else if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_hasVisibleOptions_get)) {
634
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
635
+ }
636
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.notifyControlStateChange(true);
295
637
  };
296
638
  _M3eAutocompleteElement_handleChange = function _M3eAutocompleteElement_handleChange() {
297
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get) && this.required && !this.options.some((x) => x.selected && !x.disabled)) {
298
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value = "";
299
- }
639
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get) && this.required && !this.options.some(x => x.selected && !x.disabled)) {
640
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value = "";
641
+ }
300
642
  };
301
643
  _M3eAutocompleteElement_handleKeyDown = function _M3eAutocompleteElement_handleKeyDown(e) {
302
- if (e.defaultPrevented)
303
- return;
304
- __classPrivateFieldSet(this, _M3eAutocompleteElement_ignoreFocusVisible, false, "f");
305
- switch (e.key) {
306
- case "Backspace":
307
- case "Delete":
308
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get) && !__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value) {
309
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
310
- }
311
- break;
312
- case "Enter":
313
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f") && this._listKeyManager.activeItem) {
314
- e.preventDefault();
315
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_selectOption).call(this, this._listKeyManager.activeItem);
316
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
317
- }
318
- else if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) {
319
- setTimeout(() => {
320
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get) && !__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value) {
321
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
322
- }
323
- });
324
- }
325
- break;
326
- case "Escape":
327
- case "Tab":
644
+ if (e.defaultPrevented) return;
645
+ __classPrivateFieldSet(this, _M3eAutocompleteElement_ignoreFocusVisible, false, "f");
646
+ switch (e.key) {
647
+ case "Backspace":
648
+ case "Delete":
649
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get) && !__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value) {
650
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
651
+ }
652
+ break;
653
+ case "Enter":
654
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f") && this._listKeyManager.activeItem) {
655
+ e.preventDefault();
656
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_selectOption).call(this, this._listKeyManager.activeItem);
657
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
658
+ } else if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) {
659
+ setTimeout(() => {
660
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get) && !__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value) {
328
661
  __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
329
- break;
330
- case "Up":
331
- case "ArrowUp":
332
- if (e.altKey) {
333
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
334
- }
335
- else {
336
- this._listKeyManager.onKeyDown(e);
337
- }
338
- break;
339
- case "Down":
340
- case "ArrowDown":
341
- if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) {
342
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_showMenu).call(this);
343
- e.preventDefault();
344
- }
345
- else {
346
- this._listKeyManager.onKeyDown(e);
347
- }
348
- break;
349
- default:
350
- this._listKeyManager.onKeyDown(e);
351
- break;
352
- }
662
+ }
663
+ });
664
+ }
665
+ break;
666
+ case "Escape":
667
+ case "Tab":
668
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
669
+ break;
670
+ case "Up":
671
+ case "ArrowUp":
672
+ if (e.altKey) {
673
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
674
+ } else {
675
+ this._listKeyManager.onKeyDown(e);
676
+ }
677
+ break;
678
+ case "Down":
679
+ case "ArrowDown":
680
+ if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) {
681
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_showMenu).call(this);
682
+ e.preventDefault();
683
+ } else {
684
+ this._listKeyManager.onKeyDown(e);
685
+ }
686
+ break;
687
+ default:
688
+ this._listKeyManager.onKeyDown(e);
689
+ break;
690
+ }
353
691
  };
354
692
  _M3eAutocompleteElement_handleMenuPointerDown = function _M3eAutocompleteElement_handleMenuPointerDown(e) {
355
- e.preventDefault();
356
- e.stopImmediatePropagation();
357
- const option = (e.composedPath().find((x) => x instanceof HTMLElement && x.tagName === "M3E-OPTION"));
358
- if (option && !option.disabled) {
359
- this._listKeyManager.setActiveItem(option);
360
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_selectOption).call(this, option);
361
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
362
- }
693
+ e.preventDefault();
694
+ e.stopImmediatePropagation();
695
+ const option = e.composedPath().find(x => x instanceof HTMLElement && x.tagName === "M3E-OPTION");
696
+ if (option && !option.disabled) {
697
+ this._listKeyManager.setActiveItem(option);
698
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_selectOption).call(this, option);
699
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_hideMenu).call(this);
700
+ }
363
701
  };
364
702
  _M3eAutocompleteElement_handleMenuToggle = function _M3eAutocompleteElement_handleMenuToggle(e) {
365
- if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f"))
366
- return;
367
- if (e.newState !== "closed") {
368
- const option = this.options.find((x) => x.selected && !x.disabled);
369
- if (option) {
370
- this._listKeyManager.setActiveItem(option);
371
- scrollIntoViewIfNeeded(option, __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f"));
372
- }
373
- else {
374
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_autoActivate).call(this);
375
- }
376
- this.dispatchEvent(new ToggleEvent("toggle", {
377
- oldState: e.oldState,
378
- newState: e.newState,
379
- }));
703
+ if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) return;
704
+ if (e.newState !== "closed") {
705
+ const option = this.options.find(x => x.selected && !x.disabled);
706
+ if (option) {
707
+ this._listKeyManager.setActiveItem(option);
708
+ scrollIntoViewIfNeeded(option, __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f"));
709
+ } else {
710
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_autoActivate).call(this);
380
711
  }
381
- else {
382
- if (prefersReducedMotion()) {
383
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_destroyMenu).call(this, e);
384
- }
385
- else {
386
- // NOTE: use transitionend is preferred but doesn't fire when used here.
387
- // This is a workaround until that is fixed.
388
- setTimeout(() => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_destroyMenu).call(this, e), 100);
389
- }
712
+ this.dispatchEvent(new ToggleEvent("toggle", {
713
+ oldState: e.oldState,
714
+ newState: e.newState
715
+ }));
716
+ } else {
717
+ if (prefersReducedMotion()) {
718
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_destroyMenu).call(this, e);
719
+ } else {
720
+ // NOTE: use transitionend is preferred but doesn't fire when used here.
721
+ // This is a workaround until that is fixed.
722
+ setTimeout(() => __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_destroyMenu).call(this, e), 100);
390
723
  }
724
+ }
391
725
  };
392
726
  _M3eAutocompleteElement_destroyMenu = function _M3eAutocompleteElement_destroyMenu(e) {
393
- if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f") || !__classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f"))
394
- return;
395
- [...__classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").childNodes].forEach((x) => this.append(x));
396
- __classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").remove();
397
- __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").remove();
398
- __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").removeEventListener("toggle", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuToggleHandler, "f"));
399
- __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").removeEventListener("pointerdown", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuPointerDownHandler, "f"));
400
- __classPrivateFieldSet(this, _M3eAutocompleteElement_menu, undefined, "f");
401
- __classPrivateFieldSet(this, _M3eAutocompleteElement_textHighlight, undefined, "f");
402
- this.ariaExpanded = "false";
403
- this.removeAttribute("aria-controls");
404
- this.removeAttribute("aria-owns");
405
- this.requestUpdate();
406
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.notifyControlStateChange();
407
- this.dispatchEvent(new ToggleEvent("toggle", {
408
- oldState: e.oldState,
409
- newState: e.newState,
410
- }));
727
+ if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f") || !__classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f")) return;
728
+ [...__classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").childNodes].forEach(x => this.append(x));
729
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").remove();
730
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").remove();
731
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").removeEventListener("toggle", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuToggleHandler, "f"));
732
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").removeEventListener("pointerdown", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuPointerDownHandler, "f"));
733
+ __classPrivateFieldSet(this, _M3eAutocompleteElement_menu, undefined, "f");
734
+ __classPrivateFieldSet(this, _M3eAutocompleteElement_textHighlight, undefined, "f");
735
+ this.ariaExpanded = "false";
736
+ this.removeAttribute("aria-controls");
737
+ this.removeAttribute("aria-owns");
738
+ this.requestUpdate();
739
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.notifyControlStateChange();
740
+ this.dispatchEvent(new ToggleEvent("toggle", {
741
+ oldState: e.oldState,
742
+ newState: e.newState
743
+ }));
411
744
  };
412
745
  _M3eAutocompleteElement_showMenu = function _M3eAutocompleteElement_showMenu() {
413
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f") || !__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get) || __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).readOnly || __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).disabled || !__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_hasVisibleOptions_get))
414
- return;
415
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_filterOptions).call(this);
416
- __classPrivateFieldSet(this, _M3eAutocompleteElement_menu, document.createElement("m3e-option-panel"), "f");
417
- __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").id = __classPrivateFieldGet(this, _M3eAutocompleteElement_menuId, "f");
418
- __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").style.overflowX = "hidden";
419
- __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").style.minWidth = __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_minMenuWidth_get);
420
- __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").addEventListener("toggle", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuToggleHandler, "f"));
421
- __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").addEventListener("pointerdown", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuPointerDownHandler, "f"));
422
- __classPrivateFieldSet(this, _M3eAutocompleteElement_textHighlight, document.createElement("m3e-text-highlight"), "f");
423
- __classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").term = __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value;
424
- __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").appendChild(__classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f"));
425
- for (const node of [...this.childNodes]) {
426
- __classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").append(node);
427
- }
428
- (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get) ?? __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)).insertAdjacentElement("afterend", __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f"));
429
- this.ariaExpanded = "true";
430
- this.setAttribute("aria-controls", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuId, "f"));
431
- this.setAttribute("aria-owns", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuId, "f"));
432
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.notifyControlStateChange();
433
- if (this._listKeyManager.activeItem && this.autoActivate) {
434
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_activateOption).call(this, this._listKeyManager.activeItem, true);
435
- }
436
- setTimeout(() => __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")?.show(this, __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.menuAnchor));
746
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f") || !__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get) || __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).readOnly || __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).disabled || !__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_hasVisibleOptions_get)) return;
747
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_filterOptions).call(this);
748
+ __classPrivateFieldSet(this, _M3eAutocompleteElement_menu, document.createElement("m3e-option-panel"), "f");
749
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").id = __classPrivateFieldGet(this, _M3eAutocompleteElement_menuId, "f");
750
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").style.overflowX = "hidden";
751
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").style.minWidth = __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_minMenuWidth_get);
752
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").addEventListener("toggle", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuToggleHandler, "f"));
753
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").addEventListener("pointerdown", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuPointerDownHandler, "f"));
754
+ __classPrivateFieldSet(this, _M3eAutocompleteElement_textHighlight, document.createElement("m3e-text-highlight"), "f");
755
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").term = __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value;
756
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f").appendChild(__classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f"));
757
+ for (const node of [...this.childNodes]) {
758
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_textHighlight, "f").append(node);
759
+ }
760
+ (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get) ?? __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)).insertAdjacentElement("afterend", __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f"));
761
+ this.ariaExpanded = "true";
762
+ this.setAttribute("aria-controls", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuId, "f"));
763
+ this.setAttribute("aria-owns", __classPrivateFieldGet(this, _M3eAutocompleteElement_menuId, "f"));
764
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.notifyControlStateChange();
765
+ if (this._listKeyManager.activeItem && this.autoActivate) {
766
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_activateOption).call(this, this._listKeyManager.activeItem, true);
767
+ }
768
+ setTimeout(() => __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")?.show(this, __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.menuAnchor));
437
769
  };
438
770
  _M3eAutocompleteElement_hideMenu = function _M3eAutocompleteElement_hideMenu() {
439
- __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")?.hide();
440
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)?.removeAttribute("aria-activedescendant");
771
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")?.hide();
772
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)?.removeAttribute("aria-activedescendant");
441
773
  };
442
774
  _M3eAutocompleteElement_activateOption = function _M3eAutocompleteElement_activateOption(option, forceFocusVisible = false) {
443
- if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get))
444
- return;
445
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).setAttribute("aria-activedescendant", option.id);
446
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) {
447
- scrollIntoViewIfNeeded(option, __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f"), { block: "nearest", behavior: "instant" });
448
- const focusVisible = forceFocusVisible ||
449
- (!__classPrivateFieldGet(this, _M3eAutocompleteElement_ignoreFocusVisible, "f") && (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).matches(":focus-visible") || forcedColorsActive()));
450
- this.options.forEach((x) => {
451
- const active = x === option && focusVisible;
452
- if (active) {
453
- x.focusRing?.show();
454
- x.stateLayer?.show("focused");
455
- }
456
- else {
457
- x.focusRing?.hide();
458
- x.stateLayer?.hide("focused");
459
- }
460
- });
461
- }
775
+ if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)) return;
776
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).setAttribute("aria-activedescendant", option.id);
777
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) {
778
+ scrollIntoViewIfNeeded(option, __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f"), {
779
+ block: "nearest",
780
+ behavior: "instant"
781
+ });
782
+ const focusVisible = forceFocusVisible || !__classPrivateFieldGet(this, _M3eAutocompleteElement_ignoreFocusVisible, "f") && (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).matches(":focus-visible") || forcedColorsActive());
783
+ this.options.forEach(x => {
784
+ const active = x === option && focusVisible;
785
+ if (active) {
786
+ x.focusRing?.show();
787
+ x.stateLayer?.show("focused");
788
+ } else {
789
+ x.focusRing?.hide();
790
+ x.stateLayer?.hide("focused");
791
+ }
792
+ });
793
+ }
462
794
  };
463
795
  _M3eAutocompleteElement_selectOption = function _M3eAutocompleteElement_selectOption(option) {
464
- if (option.selected)
465
- return;
466
- option.selected = true;
467
- option.requestUpdate();
468
- this.requestUpdate();
469
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)) {
470
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value = option.value;
471
- }
472
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.notifyControlStateChange(true);
796
+ if (option.selected) return;
797
+ option.selected = true;
798
+ option.requestUpdate();
799
+ this.requestUpdate();
800
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)) {
801
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value = option.value;
802
+ }
803
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_formField_get)?.notifyControlStateChange(true);
473
804
  };
474
805
  _M3eAutocompleteElement_filterOptions = function _M3eAutocompleteElement_filterOptions() {
475
- if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get))
476
- return;
477
- const term = __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value.toLocaleLowerCase();
478
- for (const option of this.options) {
479
- const value = option.value.toLocaleLowerCase();
480
- const hidden = !value.includes(term);
481
- option.style.display = hidden ? "none" : "";
482
- if (hidden) {
483
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_deactivateOption).call(this, option);
484
- }
485
- if (option.selected && value !== term) {
486
- option.selected = false;
487
- }
806
+ if (!__classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)) return;
807
+ const term = __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get).value.toLocaleLowerCase();
808
+ for (const option of this.options) {
809
+ const value = option.value.toLocaleLowerCase();
810
+ const hidden = !value.includes(term);
811
+ option.style.display = hidden ? "none" : "";
812
+ if (hidden) {
813
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_deactivateOption).call(this, option);
488
814
  }
489
- const groups = __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")?.querySelectorAll("m3e-optgroup") ?? this.querySelectorAll("m3e-optgroup");
490
- for (const group of groups) {
491
- const hidden = [...group.querySelectorAll("m3e-option")].every((x) => x.style.display === "none");
492
- group.style.display = hidden ? "none" : "";
815
+ if (option.selected && value !== term) {
816
+ option.selected = false;
493
817
  }
494
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_autoActivate).call(this);
818
+ }
819
+ const groups = __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")?.querySelectorAll("m3e-optgroup") ?? this.querySelectorAll("m3e-optgroup");
820
+ for (const group of groups) {
821
+ const hidden = [...group.querySelectorAll("m3e-option")].every(x => x.style.display === "none");
822
+ group.style.display = hidden ? "none" : "";
823
+ }
824
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "m", _M3eAutocompleteElement_autoActivate).call(this);
495
825
  };
496
826
  _M3eAutocompleteElement_autoActivate = function _M3eAutocompleteElement_autoActivate() {
497
- if (this.autoActivate && (!this._listKeyManager.activeItem || !this._listKeyManager.activeItem.selected)) {
498
- const option = this.options.find((x) => !x.disabled && x.style.display !== "none");
499
- if (option) {
500
- this._listKeyManager.setActiveItem(option);
501
- if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) {
502
- scrollIntoViewIfNeeded(option, __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f"), { block: "nearest", behavior: "instant" });
503
- }
504
- }
827
+ if (this.autoActivate && (!this._listKeyManager.activeItem || !this._listKeyManager.activeItem.selected)) {
828
+ const option = this.options.find(x => !x.disabled && x.style.display !== "none");
829
+ if (option) {
830
+ this._listKeyManager.setActiveItem(option);
831
+ if (__classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f")) {
832
+ scrollIntoViewIfNeeded(option, __classPrivateFieldGet(this, _M3eAutocompleteElement_menu, "f"), {
833
+ block: "nearest",
834
+ behavior: "instant"
835
+ });
836
+ }
505
837
  }
838
+ }
506
839
  };
507
840
  _M3eAutocompleteElement_deactivateOption = function _M3eAutocompleteElement_deactivateOption(option) {
508
- option.focusRing?.hide();
509
- option.stateLayer?.hide("focused");
510
- if (option === this._listKeyManager.activeItem) {
511
- this._listKeyManager.updateActiveItem(null);
512
- __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)?.removeAttribute("aria-activedescendant");
513
- }
841
+ option.focusRing?.hide();
842
+ option.stateLayer?.hide("focused");
843
+ if (option === this._listKeyManager.activeItem) {
844
+ this._listKeyManager.updateActiveItem(null);
845
+ __classPrivateFieldGet(this, _M3eAutocompleteElement_instances, "a", _M3eAutocompleteElement_input_get)?.removeAttribute("aria-activedescendant");
846
+ }
514
847
  };
515
848
  /** The styles of the element. */
516
- M3eAutocompleteElement.styles = css `
517
- :host {
518
- display: contents;
519
- }
520
- .options {
521
- display: none;
522
- }
523
- `;
524
- /** @private */ M3eAutocompleteElement.__nextId = 0;
525
- __decorate([
526
- n({ attribute: "hide-selection-indicator", type: Boolean })
527
- ], M3eAutocompleteElement.prototype, "hideSelectionIndicator", void 0);
528
- __decorate([
529
- n({ type: Boolean, reflect: true })
530
- ], M3eAutocompleteElement.prototype, "required", void 0);
531
- __decorate([
532
- n({ attribute: "auto-activate", type: Boolean })
533
- ], M3eAutocompleteElement.prototype, "autoActivate", void 0);
534
- M3eAutocompleteElement = M3eAutocompleteElement_1 = __decorate([
535
- t$1("m3e-autocomplete")
536
- ], M3eAutocompleteElement);
849
+ M3eAutocompleteElement.styles = css`:host { display: contents; } .options { display: none; }`;
850
+ /** @private */
851
+ M3eAutocompleteElement.__nextId = 0;
852
+ __decorate([n({
853
+ attribute: "hide-selection-indicator",
854
+ type: Boolean
855
+ })], M3eAutocompleteElement.prototype, "hideSelectionIndicator", void 0);
856
+ __decorate([n({
857
+ type: Boolean,
858
+ reflect: true
859
+ })], M3eAutocompleteElement.prototype, "required", void 0);
860
+ __decorate([n({
861
+ attribute: "auto-activate",
862
+ type: Boolean
863
+ })], M3eAutocompleteElement.prototype, "autoActivate", void 0);
864
+ M3eAutocompleteElement = M3eAutocompleteElement_1 = __decorate([t$1("m3e-autocomplete")], M3eAutocompleteElement);
537
865
 
538
866
  export { M3eAutocompleteElement };
539
867
  //# sourceMappingURL=index.js.map