@haiilo/catalyst 0.0.11 → 0.2.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.
Files changed (78) hide show
  1. package/LICENSE +1 -1
  2. package/dist/catalyst/catalyst.css +1 -1403
  3. package/dist/catalyst/catalyst.esm.js +1 -126
  4. package/dist/catalyst/index.esm.js +0 -1
  5. package/dist/catalyst/p-4c438c2d.entry.js +11 -0
  6. package/dist/catalyst/p-73ee291d.js +1 -0
  7. package/dist/catalyst/p-94273abf.js +1 -0
  8. package/dist/cjs/app-globals-a3b3cf88.js +135 -0
  9. package/dist/cjs/cat-alert_7.cjs.entry.js +3115 -0
  10. package/dist/cjs/cat-icon-registry-eeff9b7d.js +1359 -0
  11. package/dist/cjs/catalyst.cjs.js +21 -0
  12. package/dist/cjs/index.cjs.js +2 -0
  13. package/dist/cjs/loader.cjs.js +23 -0
  14. package/dist/collection/collection-manifest.json +19 -0
  15. package/dist/collection/components/cat-alert/cat-alert.css +57 -0
  16. package/dist/collection/components/cat-alert/cat-alert.js +49 -0
  17. package/dist/collection/components/cat-badge/cat-badge.css +154 -0
  18. package/dist/collection/components/cat-badge/cat-badge.js +141 -0
  19. package/dist/collection/components/cat-button/cat-button.css +319 -0
  20. package/dist/collection/components/cat-button/cat-button.js +590 -0
  21. package/dist/collection/components/cat-icon/cat-icon-registry.js +41 -0
  22. package/dist/collection/components/cat-icon/cat-icon.css +50 -0
  23. package/dist/collection/components/cat-icon/cat-icon.js +89 -0
  24. package/dist/collection/components/cat-menu/cat-menu.css +33 -0
  25. package/dist/collection/components/cat-menu/cat-menu.js +185 -0
  26. package/dist/collection/components/cat-skeleton/cat-skeleton.css +177 -0
  27. package/dist/collection/components/cat-skeleton/cat-skeleton.js +130 -0
  28. package/dist/collection/components/cat-spinner/cat-spinner.css +63 -0
  29. package/dist/collection/components/cat-spinner/cat-spinner.js +64 -0
  30. package/dist/collection/index.cdn.js +21 -0
  31. package/dist/collection/index.js +1 -0
  32. package/dist/collection/init.js +8 -0
  33. package/dist/collection/utils/breakpoints.js +11 -0
  34. package/dist/collection/utils/media-matcher.js +54 -0
  35. package/dist/collection/utils/platform.js +49 -0
  36. package/dist/collection/utils/utils.js +3 -0
  37. package/dist/components/cat-alert.d.ts +11 -0
  38. package/dist/components/cat-alert.js +43 -0
  39. package/dist/components/cat-badge.d.ts +11 -0
  40. package/dist/components/cat-badge.js +67 -0
  41. package/dist/{catalyst/cat-button.entry.js → components/cat-button.js} +76 -44
  42. package/dist/{catalyst/cat-icon-registry-59da2e37.js → components/cat-icon-registry.js} +0 -0
  43. package/dist/components/cat-icon.js +6 -0
  44. package/dist/components/cat-icon2.js +47 -0
  45. package/dist/components/cat-menu.d.ts +11 -0
  46. package/dist/components/cat-menu.js +2378 -0
  47. package/dist/components/cat-skeleton.d.ts +11 -0
  48. package/dist/components/cat-skeleton.js +77 -0
  49. package/dist/components/cat-spinner.js +6 -0
  50. package/dist/{catalyst/cat-spinner.entry.js → components/cat-spinner2.js} +25 -6
  51. package/dist/components/index.js +134 -0
  52. package/dist/esm/app-globals-fc0806a7.js +133 -0
  53. package/dist/esm/cat-alert_7.entry.js +3105 -0
  54. package/dist/esm/cat-icon-registry-d877de13.js +1331 -0
  55. package/dist/esm/catalyst.js +19 -0
  56. package/dist/esm/index.js +1 -0
  57. package/dist/esm/loader.js +19 -0
  58. package/dist/esm/polyfills/core-js.js +11 -0
  59. package/dist/esm/polyfills/css-shim.js +1 -0
  60. package/dist/esm/polyfills/dom.js +79 -0
  61. package/dist/esm/polyfills/es5-html-element.js +1 -0
  62. package/dist/esm/polyfills/index.js +34 -0
  63. package/dist/esm/polyfills/system.js +6 -0
  64. package/dist/index.cjs.js +1 -0
  65. package/dist/index.js +1 -0
  66. package/dist/types/components/cat-alert/cat-alert.d.ts +12 -0
  67. package/dist/types/components/cat-badge/cat-badge.d.ts +28 -0
  68. package/dist/types/components/cat-button/cat-button.d.ts +6 -0
  69. package/dist/types/components/cat-menu/cat-menu.d.ts +32 -0
  70. package/dist/types/components/cat-skeleton/cat-skeleton.d.ts +28 -0
  71. package/dist/types/components.d.ts +153 -0
  72. package/package.json +9 -6
  73. package/dist/catalyst/app-globals-54573336.js +0 -716
  74. package/dist/catalyst/cat-icon.entry.js +0 -27
  75. package/dist/catalyst/css-shim-20dbffa5.js +0 -4
  76. package/dist/catalyst/dom-c5ed0ba5.js +0 -73
  77. package/dist/catalyst/index-6672be93.js +0 -3031
  78. package/dist/catalyst/shadow-css-8c625855.js +0 -388
@@ -0,0 +1,3115 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const catIconRegistry = require('./cat-icon-registry-eeff9b7d.js');
6
+
7
+ const catAlertCss = ":host{display:block;margin-bottom:1rem}:host([hidden]){display:none}.cat-alert{font:inherit;color:rgb(var(--text));background-color:rgba(var(--bg), 0.1);box-shadow:inset 0 0 0 1px rgba(var(--border), 0.2);border-radius:0.25rem;padding:0.75rem 1rem;width:100%}::slotted(:last-child){margin-bottom:0 !important}.cat-alert-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--text:var(--cat-primary-text, 32, 127, 138);--border:var(--cat-primary-text, 32, 127, 138)}.cat-alert-secondary{--bg:105, 118, 135;--text:0, 0, 0;--border:105, 118, 135}.cat-alert-success{--bg:0, 132, 88;--text:0, 132, 88;--border:0, 132, 88}.cat-alert-warning{--bg:255, 206, 128;--text:159, 97, 0;--border:159, 97, 0}.cat-alert-danger{--bg:217, 52, 13;--text:217, 52, 13;--border:217, 52, 13}";
8
+
9
+ let CatAlert = class {
10
+ constructor(hostRef) {
11
+ catIconRegistry.registerInstance(this, hostRef);
12
+ /**
13
+ * The color palette of the alert.
14
+ */
15
+ this.color = 'primary';
16
+ }
17
+ render() {
18
+ return (catIconRegistry.h("div", { part: "alert", class: {
19
+ 'cat-alert': true,
20
+ [`cat-alert-${this.color}`]: Boolean(this.color)
21
+ } }, catIconRegistry.h("slot", null)));
22
+ }
23
+ };
24
+ CatAlert.style = catAlertCss;
25
+
26
+ const catBadgeCss = ":host{display:inline-flex;max-width:100%;vertical-align:baseline}:host([hidden]){display:none}.cat-badge{font:inherit;flex:1 1 auto;display:inline-flex;align-items:center;justify-content:center;border-radius:0.125rem;text-decoration:none;width:100%;box-sizing:border-box;line-height:1;white-space:nowrap}.cat-badge slot{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-badge-round{border-radius:10rem}.cat-badge-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-badge-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--border), 0.2);color:rgb(var(--text))}.cat-badge-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 32, 127, 138);--border:var(--cat-primary-text, 32, 127, 138)}.cat-badge-secondary{--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0;--border:105, 118, 135}.cat-badge-success{--bg:0, 132, 88;--fill:255, 255, 255;--text:0, 132, 88;--border:0, 132, 88}.cat-badge-warning{--bg:255, 206, 128;--fill:0, 0, 0;--text:159, 97, 0;--border:159, 97, 0}.cat-badge-danger{--bg:217, 52, 13;--fill:255, 255, 255;--text:217, 52, 13;--border:217, 52, 13}.cat-badge-xs{height:0.75rem;min-width:0.75rem;font-size:0.75rem;padding:0 0.1875rem}.cat-badge-s{height:1rem;min-width:1rem;font-size:0.75rem;padding:0 0.25rem}.cat-badge-m{height:1.25rem;min-width:1.25rem;font-size:0.75rem;padding:0 0.3125rem}.cat-badge-l{height:1.5rem;min-width:1.5rem;font-size:0.875rem;padding:0 0.375rem}.cat-badge-xl{height:1.75rem;min-width:1.75rem;font-size:0.9375rem;padding:0 0.4375rem}.cat-badge-pulse.cat-badge-filled{animation:1.5s ease 0s infinite normal none running pulse}.cat-badge-pulse.cat-badge-outlined{animation:1.5s ease 0s infinite normal none running pulse-outlined}@keyframes pulse{0%{box-shadow:0 0 0 0 rgb(var(--bg))}70%{box-shadow:transparent 0px 0px 0px 0.5rem}100%{box-shadow:transparent 0px 0px 0px 0px}}@keyframes pulse-outlined{0%{box-shadow:0 0 0 0 rgb(var(--bg)), inset 0 0 0 1px rgba(var(--border), 0.2)}70%{box-shadow:transparent 0px 0px 0px 0.5rem, inset 0 0 0 1px rgba(var(--border), 0.2)}100%{box-shadow:transparent 0px 0px 0px 0px, inset 0 0 0 1px rgba(var(--border), 0.2)}}";
27
+
28
+ let CatBadge = class {
29
+ constructor(hostRef) {
30
+ catIconRegistry.registerInstance(this, hostRef);
31
+ /**
32
+ * The rendering style of the badge.
33
+ */
34
+ this.variant = 'filled';
35
+ /**
36
+ * The color palette of the badge.
37
+ */
38
+ this.color = 'primary';
39
+ /**
40
+ * The size of the badge.
41
+ */
42
+ this.size = 'm';
43
+ /**
44
+ * Use round badge edges.
45
+ */
46
+ this.round = false;
47
+ /**
48
+ * Draw attention to the badge with a subtle animation.
49
+ */
50
+ this.pulse = false;
51
+ }
52
+ render() {
53
+ return (catIconRegistry.h("span", { part: "badge", class: {
54
+ 'cat-badge': true,
55
+ 'cat-badge-round': this.round,
56
+ 'cat-badge-pulse': this.pulse,
57
+ [`cat-badge-${this.variant}`]: Boolean(this.variant),
58
+ [`cat-badge-${this.color}`]: Boolean(this.color),
59
+ [`cat-badge-${this.size}`]: Boolean(this.size)
60
+ } }, catIconRegistry.h("slot", null)));
61
+ }
62
+ };
63
+ CatBadge.style = catBadgeCss;
64
+
65
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
66
+
67
+ function createCommonjsModule(fn, basedir, module) {
68
+ return module = {
69
+ path: basedir,
70
+ exports: {},
71
+ require: function (path, base) {
72
+ return commonjsRequire();
73
+ }
74
+ }, fn(module, module.exports), module.exports;
75
+ }
76
+
77
+ function commonjsRequire () {
78
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
79
+ }
80
+
81
+ var loglevel = createCommonjsModule(function (module) {
82
+ /*
83
+ * loglevel - https://github.com/pimterry/loglevel
84
+ *
85
+ * Copyright (c) 2013 Tim Perry
86
+ * Licensed under the MIT license.
87
+ */
88
+ (function (root, definition) {
89
+ if (module.exports) {
90
+ module.exports = definition();
91
+ } else {
92
+ root.log = definition();
93
+ }
94
+ }(commonjsGlobal, function () {
95
+
96
+ // Slightly dubious tricks to cut down minimized file size
97
+ var noop = function() {};
98
+ var undefinedType = "undefined";
99
+ var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (
100
+ /Trident\/|MSIE /.test(window.navigator.userAgent)
101
+ );
102
+
103
+ var logMethods = [
104
+ "trace",
105
+ "debug",
106
+ "info",
107
+ "warn",
108
+ "error"
109
+ ];
110
+
111
+ // Cross-browser bind equivalent that works at least back to IE6
112
+ function bindMethod(obj, methodName) {
113
+ var method = obj[methodName];
114
+ if (typeof method.bind === 'function') {
115
+ return method.bind(obj);
116
+ } else {
117
+ try {
118
+ return Function.prototype.bind.call(method, obj);
119
+ } catch (e) {
120
+ // Missing bind shim or IE8 + Modernizr, fallback to wrapping
121
+ return function() {
122
+ return Function.prototype.apply.apply(method, [obj, arguments]);
123
+ };
124
+ }
125
+ }
126
+ }
127
+
128
+ // Trace() doesn't print the message in IE, so for that case we need to wrap it
129
+ function traceForIE() {
130
+ if (console.log) {
131
+ if (console.log.apply) {
132
+ console.log.apply(console, arguments);
133
+ } else {
134
+ // In old IE, native console methods themselves don't have apply().
135
+ Function.prototype.apply.apply(console.log, [console, arguments]);
136
+ }
137
+ }
138
+ if (console.trace) console.trace();
139
+ }
140
+
141
+ // Build the best logging method possible for this env
142
+ // Wherever possible we want to bind, not wrap, to preserve stack traces
143
+ function realMethod(methodName) {
144
+ if (methodName === 'debug') {
145
+ methodName = 'log';
146
+ }
147
+
148
+ if (typeof console === undefinedType) {
149
+ return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives
150
+ } else if (methodName === 'trace' && isIE) {
151
+ return traceForIE;
152
+ } else if (console[methodName] !== undefined) {
153
+ return bindMethod(console, methodName);
154
+ } else if (console.log !== undefined) {
155
+ return bindMethod(console, 'log');
156
+ } else {
157
+ return noop;
158
+ }
159
+ }
160
+
161
+ // These private functions always need `this` to be set properly
162
+
163
+ function replaceLoggingMethods(level, loggerName) {
164
+ /*jshint validthis:true */
165
+ for (var i = 0; i < logMethods.length; i++) {
166
+ var methodName = logMethods[i];
167
+ this[methodName] = (i < level) ?
168
+ noop :
169
+ this.methodFactory(methodName, level, loggerName);
170
+ }
171
+
172
+ // Define log.log as an alias for log.debug
173
+ this.log = this.debug;
174
+ }
175
+
176
+ // In old IE versions, the console isn't present until you first open it.
177
+ // We build realMethod() replacements here that regenerate logging methods
178
+ function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
179
+ return function () {
180
+ if (typeof console !== undefinedType) {
181
+ replaceLoggingMethods.call(this, level, loggerName);
182
+ this[methodName].apply(this, arguments);
183
+ }
184
+ };
185
+ }
186
+
187
+ // By default, we use closely bound real methods wherever possible, and
188
+ // otherwise we wait for a console to appear, and then try again.
189
+ function defaultMethodFactory(methodName, level, loggerName) {
190
+ /*jshint validthis:true */
191
+ return realMethod(methodName) ||
192
+ enableLoggingWhenConsoleArrives.apply(this, arguments);
193
+ }
194
+
195
+ function Logger(name, defaultLevel, factory) {
196
+ var self = this;
197
+ var currentLevel;
198
+ defaultLevel = defaultLevel == null ? "WARN" : defaultLevel;
199
+
200
+ var storageKey = "loglevel";
201
+ if (typeof name === "string") {
202
+ storageKey += ":" + name;
203
+ } else if (typeof name === "symbol") {
204
+ storageKey = undefined;
205
+ }
206
+
207
+ function persistLevelIfPossible(levelNum) {
208
+ var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
209
+
210
+ if (typeof window === undefinedType || !storageKey) return;
211
+
212
+ // Use localStorage if available
213
+ try {
214
+ window.localStorage[storageKey] = levelName;
215
+ return;
216
+ } catch (ignore) {}
217
+
218
+ // Use session cookie as fallback
219
+ try {
220
+ window.document.cookie =
221
+ encodeURIComponent(storageKey) + "=" + levelName + ";";
222
+ } catch (ignore) {}
223
+ }
224
+
225
+ function getPersistedLevel() {
226
+ var storedLevel;
227
+
228
+ if (typeof window === undefinedType || !storageKey) return;
229
+
230
+ try {
231
+ storedLevel = window.localStorage[storageKey];
232
+ } catch (ignore) {}
233
+
234
+ // Fallback to cookies if local storage gives us nothing
235
+ if (typeof storedLevel === undefinedType) {
236
+ try {
237
+ var cookie = window.document.cookie;
238
+ var location = cookie.indexOf(
239
+ encodeURIComponent(storageKey) + "=");
240
+ if (location !== -1) {
241
+ storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];
242
+ }
243
+ } catch (ignore) {}
244
+ }
245
+
246
+ // If the stored level is not valid, treat it as if nothing was stored.
247
+ if (self.levels[storedLevel] === undefined) {
248
+ storedLevel = undefined;
249
+ }
250
+
251
+ return storedLevel;
252
+ }
253
+
254
+ function clearPersistedLevel() {
255
+ if (typeof window === undefinedType || !storageKey) return;
256
+
257
+ // Use localStorage if available
258
+ try {
259
+ window.localStorage.removeItem(storageKey);
260
+ return;
261
+ } catch (ignore) {}
262
+
263
+ // Use session cookie as fallback
264
+ try {
265
+ window.document.cookie =
266
+ encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
267
+ } catch (ignore) {}
268
+ }
269
+
270
+ /*
271
+ *
272
+ * Public logger API - see https://github.com/pimterry/loglevel for details
273
+ *
274
+ */
275
+
276
+ self.name = name;
277
+
278
+ self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3,
279
+ "ERROR": 4, "SILENT": 5};
280
+
281
+ self.methodFactory = factory || defaultMethodFactory;
282
+
283
+ self.getLevel = function () {
284
+ return currentLevel;
285
+ };
286
+
287
+ self.setLevel = function (level, persist) {
288
+ if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {
289
+ level = self.levels[level.toUpperCase()];
290
+ }
291
+ if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
292
+ currentLevel = level;
293
+ if (persist !== false) { // defaults to true
294
+ persistLevelIfPossible(level);
295
+ }
296
+ replaceLoggingMethods.call(self, level, name);
297
+ if (typeof console === undefinedType && level < self.levels.SILENT) {
298
+ return "No console available for logging";
299
+ }
300
+ } else {
301
+ throw "log.setLevel() called with invalid level: " + level;
302
+ }
303
+ };
304
+
305
+ self.setDefaultLevel = function (level) {
306
+ defaultLevel = level;
307
+ if (!getPersistedLevel()) {
308
+ self.setLevel(level, false);
309
+ }
310
+ };
311
+
312
+ self.resetLevel = function () {
313
+ self.setLevel(defaultLevel, false);
314
+ clearPersistedLevel();
315
+ };
316
+
317
+ self.enableAll = function(persist) {
318
+ self.setLevel(self.levels.TRACE, persist);
319
+ };
320
+
321
+ self.disableAll = function(persist) {
322
+ self.setLevel(self.levels.SILENT, persist);
323
+ };
324
+
325
+ // Initialize with the right level
326
+ var initialLevel = getPersistedLevel();
327
+ if (initialLevel == null) {
328
+ initialLevel = defaultLevel;
329
+ }
330
+ self.setLevel(initialLevel, false);
331
+ }
332
+
333
+ /*
334
+ *
335
+ * Top-level API
336
+ *
337
+ */
338
+
339
+ var defaultLogger = new Logger();
340
+
341
+ var _loggersByName = {};
342
+ defaultLogger.getLogger = function getLogger(name) {
343
+ if ((typeof name !== "symbol" && typeof name !== "string") || name === "") {
344
+ throw new TypeError("You must supply a name when creating a logger.");
345
+ }
346
+
347
+ var logger = _loggersByName[name];
348
+ if (!logger) {
349
+ logger = _loggersByName[name] = new Logger(
350
+ name, defaultLogger.getLevel(), defaultLogger.methodFactory);
351
+ }
352
+ return logger;
353
+ };
354
+
355
+ // Grab the current global log variable in case of overwrite
356
+ var _log = (typeof window !== undefinedType) ? window.log : undefined;
357
+ defaultLogger.noConflict = function() {
358
+ if (typeof window !== undefinedType &&
359
+ window.log === defaultLogger) {
360
+ window.log = _log;
361
+ }
362
+
363
+ return defaultLogger;
364
+ };
365
+
366
+ defaultLogger.getLoggers = function getLoggers() {
367
+ return _loggersByName;
368
+ };
369
+
370
+ // ES6 default export, for compatibility
371
+ defaultLogger['default'] = defaultLogger;
372
+
373
+ return defaultLogger;
374
+ }));
375
+ });
376
+
377
+ const _breakpoints = ['xs', 's', 'm', 'l', 'xl'];
378
+ const Breakpoints = {
379
+ xs: '(max-width: 539.98px)',
380
+ s: '(max-width: 767.98px)',
381
+ m: '(max-width: 991.98px)',
382
+ l: '(max-width: 1199.98px)',
383
+ xl: '(max-width: 1399.98px)'
384
+ };
385
+ function isBreakpoint(value) {
386
+ return typeof value === 'string' && _breakpoints.includes(value);
387
+ }
388
+
389
+ // https://github.com/angular/components/blob/master/src/cdk/platform/platform.ts
390
+ // Whether the current platform supports the V8 Break Iterator. The V8 check
391
+ // is necessary to detect all Blink based browsers.
392
+ let hasV8BreakIterator;
393
+ // We need a try/catch around the reference to `Intl`, because accessing it in some cases can
394
+ // cause IE to throw. These cases are tied to particular versions of Windows and can happen if
395
+ // the consumer is providing a polyfilled `Map`. See:
396
+ // https://github.com/Microsoft/ChakraCore/issues/3189
397
+ // https://github.com/angular/components/issues/15687
398
+ try {
399
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
400
+ hasV8BreakIterator = typeof Intl !== 'undefined' && Intl.v8BreakIterator;
401
+ }
402
+ catch (_a) {
403
+ hasV8BreakIterator = false;
404
+ }
405
+ class Platform {
406
+ constructor() {
407
+ /** Whether the current browser is Microsoft Edge. */
408
+ this.EDGE = /(edge)/i.test(navigator.userAgent);
409
+ /** Whether the current rendering engine is Microsoft Trident. */
410
+ this.TRIDENT = /(msie|trident)/i.test(navigator.userAgent);
411
+ // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.
412
+ /** Whether the current rendering engine is Blink. */
413
+ this.BLINK =
414
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
415
+ !!(window.chrome || hasV8BreakIterator) && typeof CSS !== 'undefined' && !this.EDGE && !this.TRIDENT;
416
+ // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to
417
+ // ensure that Webkit runs standalone and is not used as another engine's base.
418
+ /** Whether the current rendering engine is WebKit. */
419
+ this.WEBKIT = /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;
420
+ /** Whether the current platform is Apple iOS. */
421
+ this.IOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);
422
+ // It's difficult to detect the plain Gecko engine, because most of the browsers identify
423
+ // them self as Gecko-like browsers and modify the userAgent's according to that.
424
+ // Since we only cover one explicit Firefox case, we can simply check for Firefox
425
+ // instead of having an unstable check for Gecko.
426
+ /** Whether the current browser is Firefox. */
427
+ this.FIREFOX = /(firefox|minefield)/i.test(navigator.userAgent);
428
+ /** Whether the current platform is Android. */
429
+ // Trident on mobile adds the android platform to the userAgent to trick detections.
430
+ this.ANDROID = /android/i.test(navigator.userAgent) && !this.TRIDENT;
431
+ // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake
432
+ // this and just place the Safari keyword in the userAgent. To be more safe about Safari every
433
+ // Safari browser should also use Webkit as its layout engine.
434
+ /** Whether the current browser is Safari. */
435
+ this.SAFARI = /safari/i.test(navigator.userAgent) && this.WEBKIT;
436
+ }
437
+ }
438
+
439
+ // https://github.com/angular/components/blob/master/src/cdk/layout/media-matcher.ts
440
+ /** Global registry for all dynamically-created, injected media queries. */
441
+ const mediaQueriesForWebkitCompatibility = new Set();
442
+ /** Style tag that holds all of the dynamically-created media queries. */
443
+ let mediaQueryStyleNode;
444
+ /** A utility for calling matchMedia queries. */
445
+ class MediaMatcher {
446
+ constructor() {
447
+ this._platform = new Platform();
448
+ this._matchMedia = window.matchMedia.bind(window);
449
+ }
450
+ /**
451
+ * Evaluates the given media query and returns the native MediaQueryList from which results
452
+ * can be retrieved.
453
+ * Confirms the layout engine will trigger for the selector query provided and returns the
454
+ * MediaQueryList for the query provided.
455
+ */
456
+ matchMedia(query) {
457
+ if (this._platform.WEBKIT || this._platform.BLINK) {
458
+ createEmptyStyleRule(query);
459
+ }
460
+ return this._matchMedia(query);
461
+ }
462
+ }
463
+ /**
464
+ * Creates an empty stylesheet that is used to work around browser inconsistencies related to
465
+ * `matchMedia`. At the time of writing, it handles the following cases:
466
+ * 1. On WebKit browsers, a media query has to have at least one rule in order for `matchMedia`
467
+ * to fire. We work around it by declaring a dummy stylesheet with a `@media` declaration.
468
+ * 2. In some cases Blink browsers will stop firing the `matchMedia` listener if none of the rules
469
+ * inside the `@media` match existing elements on the page. We work around it by having one rule
470
+ * targeting the `body`. See https://github.com/angular/components/issues/23546.
471
+ */
472
+ function createEmptyStyleRule(query) {
473
+ if (mediaQueriesForWebkitCompatibility.has(query)) {
474
+ return;
475
+ }
476
+ try {
477
+ if (!mediaQueryStyleNode) {
478
+ mediaQueryStyleNode = document.createElement('style');
479
+ mediaQueryStyleNode.setAttribute('type', 'text/css');
480
+ document.head.appendChild(mediaQueryStyleNode);
481
+ }
482
+ if (mediaQueryStyleNode.sheet) {
483
+ mediaQueryStyleNode.sheet.insertRule(`@media ${query} {body{ }}`, 0);
484
+ mediaQueriesForWebkitCompatibility.add(query);
485
+ }
486
+ }
487
+ catch (e) {
488
+ loglevel.error(e);
489
+ }
490
+ }
491
+
492
+ const catButtonCss = ":host{display:inline-block;max-width:100%;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}.cat-button{font:inherit;display:flex;align-items:center;justify-content:center;border:none;border-radius:0.25rem;text-decoration:none;width:100%;box-sizing:border-box;cursor:pointer;transition:color 0.13s linear, border-color 0.13s linear, background-color 0.13s linear, box-shadow 0.13s linear}.cat-button:focus-visible{outline:2px solid #0071ff;outline-offset:1px}.cat-button-content{flex:1 1 auto;text-align:center}.cat-button-ellipsed .cat-button-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-button-disabled{cursor:not-allowed;opacity:0.65;filter:grayscale(100%)}.cat-button-round{border-radius:10rem}.cat-button-loading{cursor:default}.cat-button-loading cat-spinner{position:absolute}.cat-button-loading>*:not(cat-spinner){visibility:hidden}.cat-button-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-button-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--base), 0.2);color:rgb(var(--text))}.cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.05)}.cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading){background-color:rgba(var(--base), 0.1)}.cat-button-text{background-color:transparent;color:rgb(var(--text));text-decoration:none}.cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading){text-decoration:underline}.cat-button-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 32, 127, 138);--base:var(--cat-primary-text, 32, 127, 138)}.cat-button-primary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-hover, 28, 112, 122);--fill:var(--cat-primary-fill-hover, 255, 255, 255);--text:var(--cat-primary-text-hover, 28, 112, 122)}.cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:var(--cat-primary-bg-active, 25, 101, 110);--fill:var(--cat-primary-fill-active, 255, 255, 255);--text:var(--cat-primary-text-active, 25, 101, 110)}.cat-button-secondary{--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0;--base:105, 118, 135}.cat-button-secondary:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0}.cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0}.cat-button-success{--bg:0, 132, 88;--fill:255, 255, 255;--text:0, 132, 88;--base:0, 132, 88}.cat-button-success:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:0, 117, 78;--fill:255, 255, 255;--text:0, 117, 78}.cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:0, 105, 70;--fill:255, 255, 255;--text:0, 105, 70}.cat-button-warning{--bg:255, 206, 128;--fill:0, 0, 0;--text:159, 97, 0;--base:159, 97, 0}.cat-button-warning:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:255, 214, 148;--fill:0, 0, 0;--text:159, 97, 0}.cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:255, 222, 168;--fill:0, 0, 0;--text:159, 97, 0}.cat-button-danger{--bg:217, 52, 13;--fill:255, 255, 255;--text:217, 52, 13;--base:217, 52, 13}.cat-button-danger:hover:not(.cat-button-disabled):not(.cat-button-loading){--bg:194, 46, 11;--fill:255, 255, 255;--text:194, 46, 11}.cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading){--bg:174, 42, 10;--fill:255, 255, 255;--text:174, 42, 10}.cat-button-xs{min-width:1.5rem;padding:0.25rem 0.25rem;font-size:0.875rem;line-height:1rem}.cat-button-xs .cat-button-prefix{margin-right:0.25rem}.cat-button-xs .cat-button-suffix{margin-left:0.25rem}.cat-button-xs.cat-button-icon{width:1.5rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-xs{padding-left:1rem;padding-right:1rem}.cat-button-s{min-width:2rem;padding:0.375rem 0.5rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-s .cat-button-prefix{margin-right:0.25rem}.cat-button-s .cat-button-suffix{margin-left:0.25rem}.cat-button-s cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-s.cat-button-icon{width:2rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-s{padding-left:1rem;padding-right:1rem}.cat-button-m{min-width:2.5rem;padding:0.625rem 0.75rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-m .cat-button-prefix{margin-right:0.25rem}.cat-button-m .cat-button-suffix{margin-left:0.25rem}.cat-button-m cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-m.cat-button-icon{width:2.5rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-m{padding-left:1rem;padding-right:1rem}.cat-button-l{min-width:3rem;padding:0.875rem 1rem;font-size:0.9375rem;line-height:1.25rem}.cat-button-l .cat-button-prefix{margin-right:0.25rem}.cat-button-l .cat-button-suffix{margin-left:0.25rem}.cat-button-l cat-icon{margin-top:-0.125rem;margin-bottom:-0.125rem}.cat-button-l.cat-button-icon{width:3rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-l{padding-left:1rem;padding-right:1rem}.cat-button-xl{min-width:3.5rem;padding:1rem 1.25rem;font-size:1.125rem;line-height:1.5rem}.cat-button-xl .cat-button-prefix{margin-right:0.25rem}.cat-button-xl .cat-button-suffix{margin-left:0.25rem}.cat-button-xl.cat-button-icon{width:3.5rem;padding-left:0;padding-right:0}:host-context(nav) .cat-button-xl{padding-left:1rem;padding-right:1rem}:host-context(nav){width:100%}:host-context(nav) .cat-button{box-shadow:none;border-radius:0}:host-context(nav) .cat-button:focus-visible{outline-offset:-2px}:host-context(nav) .cat-button-content{text-align:left}";
493
+
494
+ let CatButton = class {
495
+ constructor(hostRef) {
496
+ catIconRegistry.registerInstance(this, hostRef);
497
+ this.catClick = catIconRegistry.createEvent(this, "catClick", 7);
498
+ this.catFocus = catIconRegistry.createEvent(this, "catFocus", 7);
499
+ this.catBlur = catIconRegistry.createEvent(this, "catBlur", 7);
500
+ this._iconOnly = true;
501
+ /**
502
+ * The rendering style of the button.
503
+ */
504
+ this.variant = 'outlined';
505
+ /**
506
+ * The color palette of the button.
507
+ */
508
+ this.color = 'secondary';
509
+ /**
510
+ * The size of the button.
511
+ */
512
+ this.size = 'm';
513
+ /**
514
+ * Specifies that the button should be disabled. A disabled button is unusable
515
+ * and un-clickable. Corresponds with the native HTML disabled attribute.
516
+ */
517
+ this.disabled = false;
518
+ /**
519
+ * Displays the button in a loading state with a spinner. Just like a disabled
520
+ * button, an inactive button is unusable and un-clickable. However, it
521
+ * retains the current focus state.
522
+ */
523
+ this.loading = false;
524
+ /**
525
+ * Allows the button to submit a form.
526
+ */
527
+ this.submit = false;
528
+ /**
529
+ * Ellipse overflowing button content.
530
+ */
531
+ this.ellipsed = true;
532
+ /**
533
+ * Use round button edges.
534
+ */
535
+ this.round = false;
536
+ /**
537
+ * Hide the actual button content and only display the icon.
538
+ */
539
+ this.iconOnly = false;
540
+ /**
541
+ * Display the icon as a suffix.
542
+ */
543
+ this.iconSuffix = false;
544
+ }
545
+ onIconOnlyChanged(value) {
546
+ var _a, _b;
547
+ // teardown
548
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
549
+ (_a = this.mediaQueryList) === null || _a === void 0 ? void 0 : _a.removeEventListener('change', this.mediaQueryListener);
550
+ this.mediaQueryList = undefined;
551
+ this.mediaQueryListener = undefined;
552
+ // setup
553
+ if (isBreakpoint(value)) {
554
+ (_b = this.mediaMatcher) !== null && _b !== void 0 ? _b : (this.mediaMatcher = new MediaMatcher());
555
+ this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);
556
+ this.mediaQueryListener = (event) => (this._iconOnly = event.matches);
557
+ this.mediaQueryList.addEventListener('change', this.mediaQueryListener);
558
+ this._iconOnly = this.mediaQueryList.matches;
559
+ }
560
+ else {
561
+ this._iconOnly = value;
562
+ }
563
+ }
564
+ componentWillLoad() {
565
+ this.onIconOnlyChanged(this.iconOnly);
566
+ }
567
+ componentWillRender() {
568
+ if (this.isIconButton && !this.a11yLabel) {
569
+ loglevel.warn('[A11y] Missing ARIA label on icon button', this);
570
+ }
571
+ }
572
+ haltDisabledEvents(event) {
573
+ if (this.disabled || this.loading) {
574
+ event.preventDefault();
575
+ event.stopImmediatePropagation();
576
+ }
577
+ }
578
+ /**
579
+ * Sets focus on the button. Use this method instead of `button.focus()`.
580
+ *
581
+ * @param options An optional object providing options to control aspects of
582
+ * the focusing process.
583
+ */
584
+ async setFocus(options) {
585
+ this.button.focus(options);
586
+ }
587
+ render() {
588
+ var _a;
589
+ if (this.url) {
590
+ return (catIconRegistry.h("a", { ref: el => (this.button = el), href: this.disabled ? undefined : this.url, target: this.urlTarget, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
591
+ 'cat-button': true,
592
+ 'cat-button-icon': this.isIconButton,
593
+ 'cat-button-round': this.round,
594
+ 'cat-button-loading': this.loading,
595
+ 'cat-button-disabled': this.disabled,
596
+ 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,
597
+ [`cat-button-${this.variant}`]: Boolean(this.variant),
598
+ [`cat-button-${this.color}`]: Boolean(this.color),
599
+ [`cat-button-${this.size}`]: Boolean(this.size)
600
+ }, onClick: this.onClick.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }, this.content));
601
+ }
602
+ else {
603
+ return (catIconRegistry.h("button", { ref: el => (this.button = el), type: this.submit ? 'submit' : 'button', name: this.name, value: this.value, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
604
+ 'cat-button': true,
605
+ 'cat-button-icon': this.isIconButton,
606
+ 'cat-button-round': (_a = this.round) !== null && _a !== void 0 ? _a : this.isIconButton,
607
+ 'cat-button-loading': this.loading,
608
+ 'cat-button-disabled': this.disabled,
609
+ 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,
610
+ [`cat-button-${this.variant}`]: Boolean(this.variant),
611
+ [`cat-button-${this.color}`]: Boolean(this.color),
612
+ [`cat-button-${this.size}`]: Boolean(this.size)
613
+ }, onClick: this.onClick.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }, this.content));
614
+ }
615
+ }
616
+ get iconSize() {
617
+ switch (this.size) {
618
+ case 'xs':
619
+ return 's';
620
+ default:
621
+ return 'l';
622
+ }
623
+ }
624
+ get spinnerSize() {
625
+ switch (this.size) {
626
+ case 'xs':
627
+ return 'xs';
628
+ default:
629
+ return 'm';
630
+ }
631
+ }
632
+ get isIconButton() {
633
+ return Boolean(this.icon) && this._iconOnly;
634
+ }
635
+ get hasPrefixIcon() {
636
+ return Boolean(this.icon) && !this._iconOnly && !this.iconSuffix;
637
+ }
638
+ get hasSuffixIcon() {
639
+ return Boolean(this.icon) && !this._iconOnly && this.iconSuffix;
640
+ }
641
+ get content() {
642
+ return [
643
+ this.hasPrefixIcon ? (catIconRegistry.h("cat-icon", { icon: this.icon, size: this.iconSize, class: "cat-button-prefix", part: "prefix" })) : null,
644
+ this.isIconButton ? (catIconRegistry.h("cat-icon", { icon: this.icon, size: this.iconSize })) : (catIconRegistry.h("span", { class: "cat-button-content", part: "content" }, catIconRegistry.h("slot", null))),
645
+ this.hasSuffixIcon ? (catIconRegistry.h("cat-icon", { icon: this.icon, size: this.iconSize, class: "cat-button-suffix", part: "suffix" })) : null,
646
+ this.loading ? catIconRegistry.h("cat-spinner", { size: this.spinnerSize }) : null
647
+ ];
648
+ }
649
+ onClick(event) {
650
+ this.catClick.emit(event);
651
+ }
652
+ onFocus(event) {
653
+ this.catFocus.emit(event);
654
+ }
655
+ onBlur(event) {
656
+ this.catBlur.emit(event);
657
+ }
658
+ static get watchers() { return {
659
+ "iconOnly": ["onIconOnlyChanged"]
660
+ }; }
661
+ };
662
+ CatButton.style = catButtonCss;
663
+
664
+ const catIconCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}span{display:inline-flex}svg{fill:currentColor;stroke:none;transform-origin:center center;width:1em;height:1em}.cat-icon-xs svg{font-size:0.75rem}.cat-icon-s svg{font-size:1rem}.cat-icon-m svg{font-size:1.25rem}.cat-icon-l svg{font-size:1.5rem}.cat-icon-xl svg{font-size:1.75rem}";
665
+
666
+ let CatIcon = class {
667
+ constructor(hostRef) {
668
+ catIconRegistry.registerInstance(this, hostRef);
669
+ this.iconRegistry = catIconRegistry.CatIconRegistry.getInstance();
670
+ /**
671
+ * The name of the icon.
672
+ */
673
+ this.icon = '';
674
+ /**
675
+ * The size of the icon.
676
+ */
677
+ this.size = 'm';
678
+ }
679
+ render() {
680
+ return (catIconRegistry.h("span", { innerHTML: this.iconRegistry.getIcon(this.icon), "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', part: "icon", class: {
681
+ [`cat-icon-${this.size}`]: this.size !== 'inline'
682
+ } }));
683
+ }
684
+ };
685
+ CatIcon.style = catIconCss;
686
+
687
+ function getSide(placement) {
688
+ return placement.split('-')[0];
689
+ }
690
+
691
+ function getAlignment(placement) {
692
+ return placement.split('-')[1];
693
+ }
694
+
695
+ function getMainAxisFromPlacement(placement) {
696
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
697
+ }
698
+
699
+ function getLengthFromAxis(axis) {
700
+ return axis === 'y' ? 'height' : 'width';
701
+ }
702
+
703
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
704
+ let {
705
+ reference,
706
+ floating
707
+ } = _ref;
708
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
709
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
710
+ const mainAxis = getMainAxisFromPlacement(placement);
711
+ const length = getLengthFromAxis(mainAxis);
712
+ const commonAlign = reference[length] / 2 - floating[length] / 2;
713
+ const side = getSide(placement);
714
+ const isVertical = mainAxis === 'x';
715
+ let coords;
716
+
717
+ switch (side) {
718
+ case 'top':
719
+ coords = {
720
+ x: commonX,
721
+ y: reference.y - floating.height
722
+ };
723
+ break;
724
+
725
+ case 'bottom':
726
+ coords = {
727
+ x: commonX,
728
+ y: reference.y + reference.height
729
+ };
730
+ break;
731
+
732
+ case 'right':
733
+ coords = {
734
+ x: reference.x + reference.width,
735
+ y: commonY
736
+ };
737
+ break;
738
+
739
+ case 'left':
740
+ coords = {
741
+ x: reference.x - floating.width,
742
+ y: commonY
743
+ };
744
+ break;
745
+
746
+ default:
747
+ coords = {
748
+ x: reference.x,
749
+ y: reference.y
750
+ };
751
+ }
752
+
753
+ switch (getAlignment(placement)) {
754
+ case 'start':
755
+ coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
756
+ break;
757
+
758
+ case 'end':
759
+ coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
760
+ break;
761
+ }
762
+
763
+ return coords;
764
+ }
765
+
766
+ /**
767
+ * Computes the `x` and `y` coordinates that will place the floating element
768
+ * next to a reference element when it is given a certain positioning strategy.
769
+ *
770
+ * This export does not have any `platform` interface logic. You will need to
771
+ * write one for the platform you are using Floating UI with.
772
+ */
773
+
774
+ const computePosition$1 = async (reference, floating, config) => {
775
+ const {
776
+ placement = 'bottom',
777
+ strategy = 'absolute',
778
+ middleware = [],
779
+ platform
780
+ } = config;
781
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
782
+
783
+ let rects = await platform.getElementRects({
784
+ reference,
785
+ floating,
786
+ strategy
787
+ });
788
+ let {
789
+ x,
790
+ y
791
+ } = computeCoordsFromPlacement(rects, placement, rtl);
792
+ let statefulPlacement = placement;
793
+ let middlewareData = {};
794
+
795
+ for (let i = 0; i < middleware.length; i++) {
796
+
797
+ const {
798
+ name,
799
+ fn
800
+ } = middleware[i];
801
+ const {
802
+ x: nextX,
803
+ y: nextY,
804
+ data,
805
+ reset
806
+ } = await fn({
807
+ x,
808
+ y,
809
+ initialPlacement: placement,
810
+ placement: statefulPlacement,
811
+ strategy,
812
+ middlewareData,
813
+ rects,
814
+ platform,
815
+ elements: {
816
+ reference,
817
+ floating
818
+ }
819
+ });
820
+ x = nextX != null ? nextX : x;
821
+ y = nextY != null ? nextY : y;
822
+ middlewareData = { ...middlewareData,
823
+ [name]: { ...middlewareData[name],
824
+ ...data
825
+ }
826
+ };
827
+
828
+ if (reset) {
829
+ if (typeof reset === 'object') {
830
+ if (reset.placement) {
831
+ statefulPlacement = reset.placement;
832
+ }
833
+
834
+ if (reset.rects) {
835
+ rects = reset.rects === true ? await platform.getElementRects({
836
+ reference,
837
+ floating,
838
+ strategy
839
+ }) : reset.rects;
840
+ }
841
+
842
+ ({
843
+ x,
844
+ y
845
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
846
+ }
847
+
848
+ i = -1;
849
+ continue;
850
+ }
851
+ }
852
+
853
+ return {
854
+ x,
855
+ y,
856
+ placement: statefulPlacement,
857
+ strategy,
858
+ middlewareData
859
+ };
860
+ };
861
+
862
+ function expandPaddingObject(padding) {
863
+ return {
864
+ top: 0,
865
+ right: 0,
866
+ bottom: 0,
867
+ left: 0,
868
+ ...padding
869
+ };
870
+ }
871
+
872
+ function getSideObjectFromPadding(padding) {
873
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
874
+ top: padding,
875
+ right: padding,
876
+ bottom: padding,
877
+ left: padding
878
+ };
879
+ }
880
+
881
+ function rectToClientRect(rect) {
882
+ return { ...rect,
883
+ top: rect.y,
884
+ left: rect.x,
885
+ right: rect.x + rect.width,
886
+ bottom: rect.y + rect.height
887
+ };
888
+ }
889
+
890
+ /**
891
+ * Resolves with an object of overflow side offsets that determine how much the
892
+ * element is overflowing a given clipping boundary.
893
+ * - positive = overflowing the boundary by that number of pixels
894
+ * - negative = how many pixels left before it will overflow
895
+ * - 0 = lies flush with the boundary
896
+ * @see https://floating-ui.com/docs/detectOverflow
897
+ */
898
+ async function detectOverflow(middlewareArguments, options) {
899
+ var _await$platform$isEle;
900
+
901
+ if (options === void 0) {
902
+ options = {};
903
+ }
904
+
905
+ const {
906
+ x,
907
+ y,
908
+ platform,
909
+ rects,
910
+ elements,
911
+ strategy
912
+ } = middlewareArguments;
913
+ const {
914
+ boundary = 'clippingAncestors',
915
+ rootBoundary = 'viewport',
916
+ elementContext = 'floating',
917
+ altBoundary = false,
918
+ padding = 0
919
+ } = options;
920
+ const paddingObject = getSideObjectFromPadding(padding);
921
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
922
+ const element = elements[altBoundary ? altContext : elementContext];
923
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
924
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
925
+ boundary,
926
+ rootBoundary,
927
+ strategy
928
+ }));
929
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
930
+ rect: elementContext === 'floating' ? { ...rects.floating,
931
+ x,
932
+ y
933
+ } : rects.reference,
934
+ offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
935
+ strategy
936
+ }) : rects[elementContext]); // positive = overflowing the clipping rect
937
+ // 0 or negative = within the clipping rect
938
+
939
+ return {
940
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
941
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
942
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
943
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
944
+ };
945
+ }
946
+
947
+ const hash$1 = {
948
+ left: 'right',
949
+ right: 'left',
950
+ bottom: 'top',
951
+ top: 'bottom'
952
+ };
953
+ function getOppositePlacement(placement) {
954
+ return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
955
+ }
956
+
957
+ function getAlignmentSides(placement, rects, rtl) {
958
+ if (rtl === void 0) {
959
+ rtl = false;
960
+ }
961
+
962
+ const alignment = getAlignment(placement);
963
+ const mainAxis = getMainAxisFromPlacement(placement);
964
+ const length = getLengthFromAxis(mainAxis);
965
+ let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
966
+
967
+ if (rects.reference[length] > rects.floating[length]) {
968
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
969
+ }
970
+
971
+ return {
972
+ main: mainAlignmentSide,
973
+ cross: getOppositePlacement(mainAlignmentSide)
974
+ };
975
+ }
976
+
977
+ const hash = {
978
+ start: 'end',
979
+ end: 'start'
980
+ };
981
+ function getOppositeAlignmentPlacement(placement) {
982
+ return placement.replace(/start|end/g, matched => hash[matched]);
983
+ }
984
+
985
+ function getExpandedPlacements(placement) {
986
+ const oppositePlacement = getOppositePlacement(placement);
987
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
988
+ }
989
+
990
+ /**
991
+ * Changes the placement of the floating element to one that will fit if the
992
+ * initially specified `placement` does not.
993
+ * @see https://floating-ui.com/docs/flip
994
+ */
995
+ const flip = function (options) {
996
+ if (options === void 0) {
997
+ options = {};
998
+ }
999
+
1000
+ return {
1001
+ name: 'flip',
1002
+ options,
1003
+
1004
+ async fn(middlewareArguments) {
1005
+ var _middlewareData$flip;
1006
+
1007
+ const {
1008
+ placement,
1009
+ middlewareData,
1010
+ rects,
1011
+ initialPlacement,
1012
+ platform,
1013
+ elements
1014
+ } = middlewareArguments;
1015
+ const {
1016
+ mainAxis: checkMainAxis = true,
1017
+ crossAxis: checkCrossAxis = true,
1018
+ fallbackPlacements: specifiedFallbackPlacements,
1019
+ fallbackStrategy = 'bestFit',
1020
+ flipAlignment = true,
1021
+ ...detectOverflowOptions
1022
+ } = options;
1023
+ const side = getSide(placement);
1024
+ const isBasePlacement = side === initialPlacement;
1025
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1026
+ const placements = [initialPlacement, ...fallbackPlacements];
1027
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
1028
+ const overflows = [];
1029
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1030
+
1031
+ if (checkMainAxis) {
1032
+ overflows.push(overflow[side]);
1033
+ }
1034
+
1035
+ if (checkCrossAxis) {
1036
+ const {
1037
+ main,
1038
+ cross
1039
+ } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1040
+ overflows.push(overflow[main], overflow[cross]);
1041
+ }
1042
+
1043
+ overflowsData = [...overflowsData, {
1044
+ placement,
1045
+ overflows
1046
+ }]; // One or more sides is overflowing
1047
+
1048
+ if (!overflows.every(side => side <= 0)) {
1049
+ var _middlewareData$flip$, _middlewareData$flip2;
1050
+
1051
+ const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
1052
+ const nextPlacement = placements[nextIndex];
1053
+
1054
+ if (nextPlacement) {
1055
+ // Try next placement and re-run the lifecycle
1056
+ return {
1057
+ data: {
1058
+ index: nextIndex,
1059
+ overflows: overflowsData
1060
+ },
1061
+ reset: {
1062
+ placement: nextPlacement
1063
+ }
1064
+ };
1065
+ }
1066
+
1067
+ let resetPlacement = 'bottom';
1068
+
1069
+ switch (fallbackStrategy) {
1070
+ case 'bestFit':
1071
+ {
1072
+ var _overflowsData$slice$;
1073
+
1074
+ const placement = (_overflowsData$slice$ = overflowsData.slice().sort((a, b) => a.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0) - b.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0))[0]) == null ? void 0 : _overflowsData$slice$.placement;
1075
+
1076
+ if (placement) {
1077
+ resetPlacement = placement;
1078
+ }
1079
+
1080
+ break;
1081
+ }
1082
+
1083
+ case 'initialPlacement':
1084
+ resetPlacement = initialPlacement;
1085
+ break;
1086
+ }
1087
+
1088
+ if (placement !== resetPlacement) {
1089
+ return {
1090
+ reset: {
1091
+ placement: resetPlacement
1092
+ }
1093
+ };
1094
+ }
1095
+ }
1096
+
1097
+ return {};
1098
+ }
1099
+
1100
+ };
1101
+ };
1102
+
1103
+ function convertValueToCoords(placement, rects, value, rtl) {
1104
+ if (rtl === void 0) {
1105
+ rtl = false;
1106
+ }
1107
+
1108
+ const side = getSide(placement);
1109
+ const alignment = getAlignment(placement);
1110
+ const isVertical = getMainAxisFromPlacement(placement) === 'x';
1111
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1112
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1113
+ const rawValue = typeof value === 'function' ? value({ ...rects,
1114
+ placement
1115
+ }) : value;
1116
+ const isNumber = typeof rawValue === 'number'; // eslint-disable-next-line prefer-const
1117
+
1118
+ let {
1119
+ mainAxis,
1120
+ crossAxis,
1121
+ alignmentAxis
1122
+ } = isNumber ? {
1123
+ mainAxis: rawValue,
1124
+ crossAxis: 0,
1125
+ alignmentAxis: null
1126
+ } : {
1127
+ mainAxis: 0,
1128
+ crossAxis: 0,
1129
+ alignmentAxis: null,
1130
+ ...rawValue
1131
+ };
1132
+
1133
+ if (alignment && typeof alignmentAxis === 'number') {
1134
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1135
+ }
1136
+
1137
+ return isVertical ? {
1138
+ x: crossAxis * crossAxisMulti,
1139
+ y: mainAxis * mainAxisMulti
1140
+ } : {
1141
+ x: mainAxis * mainAxisMulti,
1142
+ y: crossAxis * crossAxisMulti
1143
+ };
1144
+ }
1145
+ /**
1146
+ * Displaces the floating element from its reference element.
1147
+ * @see https://floating-ui.com/docs/offset
1148
+ */
1149
+
1150
+ const offset = function (value) {
1151
+ if (value === void 0) {
1152
+ value = 0;
1153
+ }
1154
+
1155
+ return {
1156
+ name: 'offset',
1157
+ options: value,
1158
+
1159
+ async fn(middlewareArguments) {
1160
+ const {
1161
+ x,
1162
+ y,
1163
+ placement,
1164
+ rects,
1165
+ platform,
1166
+ elements
1167
+ } = middlewareArguments;
1168
+ const diffCoords = convertValueToCoords(placement, rects, value, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1169
+ return {
1170
+ x: x + diffCoords.x,
1171
+ y: y + diffCoords.y,
1172
+ data: diffCoords
1173
+ };
1174
+ }
1175
+
1176
+ };
1177
+ };
1178
+
1179
+ function isWindow(value) {
1180
+ return (value == null ? void 0 : value.toString()) === '[object Window]';
1181
+ }
1182
+ function getWindow(node) {
1183
+ if (node == null) {
1184
+ return window;
1185
+ }
1186
+
1187
+ if (!isWindow(node)) {
1188
+ const ownerDocument = node.ownerDocument;
1189
+ return ownerDocument ? ownerDocument.defaultView || window : window;
1190
+ }
1191
+
1192
+ return node;
1193
+ }
1194
+
1195
+ function getComputedStyle$1(element) {
1196
+ return getWindow(element).getComputedStyle(element);
1197
+ }
1198
+
1199
+ function getNodeName(node) {
1200
+ return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
1201
+ }
1202
+
1203
+ function isHTMLElement(value) {
1204
+ return value instanceof getWindow(value).HTMLElement;
1205
+ }
1206
+ function isElement(value) {
1207
+ return value instanceof getWindow(value).Element;
1208
+ }
1209
+ function isNode(value) {
1210
+ return value instanceof getWindow(value).Node;
1211
+ }
1212
+ function isShadowRoot(node) {
1213
+ const OwnElement = getWindow(node).ShadowRoot;
1214
+ return node instanceof OwnElement || node instanceof ShadowRoot;
1215
+ }
1216
+ function isOverflowElement(element) {
1217
+ // Firefox wants us to check `-x` and `-y` variations as well
1218
+ const {
1219
+ overflow,
1220
+ overflowX,
1221
+ overflowY
1222
+ } = getComputedStyle$1(element);
1223
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
1224
+ }
1225
+ function isTableElement(element) {
1226
+ return ['table', 'td', 'th'].includes(getNodeName(element));
1227
+ }
1228
+ function isContainingBlock(element) {
1229
+ // TODO: Try and use feature detection here instead
1230
+ const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
1231
+ const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
1232
+ // create a containing block.
1233
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1234
+
1235
+ return css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
1236
+ }
1237
+ function isLayoutViewport() {
1238
+ // Not Safari
1239
+ return !/^((?!chrome|android).)*safari/i.test(navigator.userAgent); // Feature detection for this fails in various ways
1240
+ // • Always-visible scrollbar or not
1241
+ // • Width of <html>, etc.
1242
+ // const vV = win.visualViewport;
1243
+ // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
1244
+ }
1245
+
1246
+ const min = Math.min;
1247
+ const max = Math.max;
1248
+ const round = Math.round;
1249
+
1250
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
1251
+ if (includeScale === void 0) {
1252
+ includeScale = false;
1253
+ }
1254
+
1255
+ if (isFixedStrategy === void 0) {
1256
+ isFixedStrategy = false;
1257
+ }
1258
+
1259
+ const clientRect = element.getBoundingClientRect();
1260
+ let scaleX = 1;
1261
+ let scaleY = 1;
1262
+
1263
+ if (includeScale && isHTMLElement(element)) {
1264
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
1265
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
1266
+ }
1267
+
1268
+ const win = isElement(element) ? getWindow(element) : window;
1269
+ const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
1270
+ const x = (clientRect.left + (addVisualOffsets ? win.visualViewport.offsetLeft : 0)) / scaleX;
1271
+ const y = (clientRect.top + (addVisualOffsets ? win.visualViewport.offsetTop : 0)) / scaleY;
1272
+ const width = clientRect.width / scaleX;
1273
+ const height = clientRect.height / scaleY;
1274
+ return {
1275
+ width,
1276
+ height,
1277
+ top: y,
1278
+ right: x + width,
1279
+ bottom: y + height,
1280
+ left: x,
1281
+ x,
1282
+ y
1283
+ };
1284
+ }
1285
+
1286
+ function getDocumentElement(node) {
1287
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
1288
+ }
1289
+
1290
+ function getNodeScroll(element) {
1291
+ if (isWindow(element)) {
1292
+ return {
1293
+ scrollLeft: element.pageXOffset,
1294
+ scrollTop: element.pageYOffset
1295
+ };
1296
+ }
1297
+
1298
+ return {
1299
+ scrollLeft: element.scrollLeft,
1300
+ scrollTop: element.scrollTop
1301
+ };
1302
+ }
1303
+
1304
+ function getWindowScrollBarX(element) {
1305
+ // If <html> has a CSS width greater than the viewport, then this will be
1306
+ // incorrect for RTL.
1307
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1308
+ }
1309
+
1310
+ function isScaled(element) {
1311
+ const rect = getBoundingClientRect(element);
1312
+ return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
1313
+ }
1314
+
1315
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1316
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1317
+ const documentElement = getDocumentElement(offsetParent);
1318
+ const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
1319
+ let scroll = {
1320
+ scrollLeft: 0,
1321
+ scrollTop: 0
1322
+ };
1323
+ const offsets = {
1324
+ x: 0,
1325
+ y: 0
1326
+ };
1327
+
1328
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1329
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1330
+ scroll = getNodeScroll(offsetParent);
1331
+ }
1332
+
1333
+ if (isHTMLElement(offsetParent)) {
1334
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1335
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1336
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1337
+ } else if (documentElement) {
1338
+ offsets.x = getWindowScrollBarX(documentElement);
1339
+ }
1340
+ }
1341
+
1342
+ return {
1343
+ x: rect.left + scroll.scrollLeft - offsets.x,
1344
+ y: rect.top + scroll.scrollTop - offsets.y,
1345
+ width: rect.width,
1346
+ height: rect.height
1347
+ };
1348
+ }
1349
+
1350
+ function getParentNode(node) {
1351
+ if (getNodeName(node) === 'html') {
1352
+ return node;
1353
+ }
1354
+
1355
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
1356
+ // @ts-ignore
1357
+ node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
1358
+ node.parentNode || ( // DOM Element detected
1359
+ isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
1360
+ getDocumentElement(node) // fallback
1361
+
1362
+ );
1363
+ }
1364
+
1365
+ function getTrueOffsetParent(element) {
1366
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1367
+ return null;
1368
+ }
1369
+
1370
+ return element.offsetParent;
1371
+ }
1372
+
1373
+ function getContainingBlock(element) {
1374
+ let currentNode = getParentNode(element);
1375
+
1376
+ if (isShadowRoot(currentNode)) {
1377
+ currentNode = currentNode.host;
1378
+ }
1379
+
1380
+ while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
1381
+ if (isContainingBlock(currentNode)) {
1382
+ return currentNode;
1383
+ } else {
1384
+ currentNode = currentNode.parentNode;
1385
+ }
1386
+ }
1387
+
1388
+ return null;
1389
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
1390
+ // such as table ancestors and cross browser bugs.
1391
+
1392
+
1393
+ function getOffsetParent(element) {
1394
+ const window = getWindow(element);
1395
+ let offsetParent = getTrueOffsetParent(element);
1396
+
1397
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
1398
+ offsetParent = getTrueOffsetParent(offsetParent);
1399
+ }
1400
+
1401
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1402
+ return window;
1403
+ }
1404
+
1405
+ return offsetParent || getContainingBlock(element) || window;
1406
+ }
1407
+
1408
+ function getDimensions(element) {
1409
+ if (isHTMLElement(element)) {
1410
+ return {
1411
+ width: element.offsetWidth,
1412
+ height: element.offsetHeight
1413
+ };
1414
+ }
1415
+
1416
+ const rect = getBoundingClientRect(element);
1417
+ return {
1418
+ width: rect.width,
1419
+ height: rect.height
1420
+ };
1421
+ }
1422
+
1423
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1424
+ let {
1425
+ rect,
1426
+ offsetParent,
1427
+ strategy
1428
+ } = _ref;
1429
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1430
+ const documentElement = getDocumentElement(offsetParent);
1431
+
1432
+ if (offsetParent === documentElement) {
1433
+ return rect;
1434
+ }
1435
+
1436
+ let scroll = {
1437
+ scrollLeft: 0,
1438
+ scrollTop: 0
1439
+ };
1440
+ const offsets = {
1441
+ x: 0,
1442
+ y: 0
1443
+ };
1444
+
1445
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1446
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1447
+ scroll = getNodeScroll(offsetParent);
1448
+ }
1449
+
1450
+ if (isHTMLElement(offsetParent)) {
1451
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1452
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1453
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1454
+ } // This doesn't appear to be need to be negated.
1455
+ // else if (documentElement) {
1456
+ // offsets.x = getWindowScrollBarX(documentElement);
1457
+ // }
1458
+
1459
+ }
1460
+
1461
+ return { ...rect,
1462
+ x: rect.x - scroll.scrollLeft + offsets.x,
1463
+ y: rect.y - scroll.scrollTop + offsets.y
1464
+ };
1465
+ }
1466
+
1467
+ function getViewportRect(element, strategy) {
1468
+ const win = getWindow(element);
1469
+ const html = getDocumentElement(element);
1470
+ const visualViewport = win.visualViewport;
1471
+ let width = html.clientWidth;
1472
+ let height = html.clientHeight;
1473
+ let x = 0;
1474
+ let y = 0;
1475
+
1476
+ if (visualViewport) {
1477
+ width = visualViewport.width;
1478
+ height = visualViewport.height;
1479
+ const layoutViewport = isLayoutViewport();
1480
+
1481
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
1482
+ x = visualViewport.offsetLeft;
1483
+ y = visualViewport.offsetTop;
1484
+ }
1485
+ }
1486
+
1487
+ return {
1488
+ width,
1489
+ height,
1490
+ x,
1491
+ y
1492
+ };
1493
+ }
1494
+
1495
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
1496
+
1497
+ function getDocumentRect(element) {
1498
+ var _element$ownerDocumen;
1499
+
1500
+ const html = getDocumentElement(element);
1501
+ const scroll = getNodeScroll(element);
1502
+ const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1503
+ const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1504
+ const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1505
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1506
+ const y = -scroll.scrollTop;
1507
+
1508
+ if (getComputedStyle$1(body || html).direction === 'rtl') {
1509
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1510
+ }
1511
+
1512
+ return {
1513
+ width,
1514
+ height,
1515
+ x,
1516
+ y
1517
+ };
1518
+ }
1519
+
1520
+ function getNearestOverflowAncestor(node) {
1521
+ const parentNode = getParentNode(node);
1522
+
1523
+ if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
1524
+ // @ts-ignore assume body is always available
1525
+ return node.ownerDocument.body;
1526
+ }
1527
+
1528
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1529
+ return parentNode;
1530
+ }
1531
+
1532
+ return getNearestOverflowAncestor(parentNode);
1533
+ }
1534
+
1535
+ function getOverflowAncestors(node, list) {
1536
+ var _node$ownerDocument;
1537
+
1538
+ if (list === void 0) {
1539
+ list = [];
1540
+ }
1541
+
1542
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1543
+ const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
1544
+ const win = getWindow(scrollableAncestor);
1545
+ const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
1546
+ const updatedList = list.concat(target);
1547
+ return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
1548
+ updatedList.concat(getOverflowAncestors(getParentNode(target)));
1549
+ }
1550
+
1551
+ function contains(parent, child) {
1552
+ const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
1553
+
1554
+ if (parent.contains(child)) {
1555
+ return true;
1556
+ } // then fallback to custom implementation with Shadow DOM support
1557
+ else if (rootNode && isShadowRoot(rootNode)) {
1558
+ let next = child;
1559
+
1560
+ do {
1561
+ // use `===` replace node.isSameNode()
1562
+ if (next && parent === next) {
1563
+ return true;
1564
+ } // @ts-ignore: need a better way to handle this...
1565
+
1566
+
1567
+ next = next.parentNode || next.host;
1568
+ } while (next);
1569
+ }
1570
+
1571
+ return false;
1572
+ }
1573
+
1574
+ function getInnerBoundingClientRect(element, strategy) {
1575
+ const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
1576
+ const top = clientRect.top + element.clientTop;
1577
+ const left = clientRect.left + element.clientLeft;
1578
+ return {
1579
+ top,
1580
+ left,
1581
+ x: left,
1582
+ y: top,
1583
+ right: left + element.clientWidth,
1584
+ bottom: top + element.clientHeight,
1585
+ width: element.clientWidth,
1586
+ height: element.clientHeight
1587
+ };
1588
+ }
1589
+
1590
+ function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
1591
+ if (clippingParent === 'viewport') {
1592
+ return rectToClientRect(getViewportRect(element, strategy));
1593
+ }
1594
+
1595
+ if (isElement(clippingParent)) {
1596
+ return getInnerBoundingClientRect(clippingParent, strategy);
1597
+ }
1598
+
1599
+ return rectToClientRect(getDocumentRect(getDocumentElement(element)));
1600
+ } // A "clipping ancestor" is an overflowable container with the characteristic of
1601
+ // clipping (or hiding) overflowing elements with a position different from
1602
+ // `initial`
1603
+
1604
+
1605
+ function getClippingAncestors(element) {
1606
+ const clippingAncestors = getOverflowAncestors(element);
1607
+ const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
1608
+ const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1609
+
1610
+ if (!isElement(clipperElement)) {
1611
+ return [];
1612
+ } // @ts-ignore isElement check ensures we return Array<Element>
1613
+
1614
+
1615
+ return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
1616
+ } // Gets the maximum area that the element is visible in due to any number of
1617
+ // clipping ancestors
1618
+
1619
+
1620
+ function getClippingRect(_ref) {
1621
+ let {
1622
+ element,
1623
+ boundary,
1624
+ rootBoundary,
1625
+ strategy
1626
+ } = _ref;
1627
+ const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
1628
+ const clippingAncestors = [...mainClippingAncestors, rootBoundary];
1629
+ const firstClippingAncestor = clippingAncestors[0];
1630
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1631
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1632
+ accRect.top = max(rect.top, accRect.top);
1633
+ accRect.right = min(rect.right, accRect.right);
1634
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1635
+ accRect.left = max(rect.left, accRect.left);
1636
+ return accRect;
1637
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1638
+ return {
1639
+ width: clippingRect.right - clippingRect.left,
1640
+ height: clippingRect.bottom - clippingRect.top,
1641
+ x: clippingRect.left,
1642
+ y: clippingRect.top
1643
+ };
1644
+ }
1645
+
1646
+ const platform = {
1647
+ getClippingRect,
1648
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1649
+ isElement,
1650
+ getDimensions,
1651
+ getOffsetParent,
1652
+ getDocumentElement,
1653
+ getElementRects: _ref => {
1654
+ let {
1655
+ reference,
1656
+ floating,
1657
+ strategy
1658
+ } = _ref;
1659
+ return {
1660
+ reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
1661
+ floating: { ...getDimensions(floating),
1662
+ x: 0,
1663
+ y: 0
1664
+ }
1665
+ };
1666
+ },
1667
+ getClientRects: element => Array.from(element.getClientRects()),
1668
+ isRTL: element => getComputedStyle$1(element).direction === 'rtl'
1669
+ };
1670
+
1671
+ /**
1672
+ * Automatically updates the position of the floating element when necessary.
1673
+ * @see https://floating-ui.com/docs/autoUpdate
1674
+ */
1675
+ function autoUpdate(reference, floating, update, options) {
1676
+ if (options === void 0) {
1677
+ options = {};
1678
+ }
1679
+
1680
+ const {
1681
+ ancestorScroll: _ancestorScroll = true,
1682
+ ancestorResize: _ancestorResize = true,
1683
+ elementResize: _elementResize = true,
1684
+ animationFrame = false
1685
+ } = options;
1686
+ let cleanedUp = false;
1687
+ const ancestorScroll = _ancestorScroll && !animationFrame;
1688
+ const ancestorResize = _ancestorResize && !animationFrame;
1689
+ const elementResize = _elementResize && !animationFrame;
1690
+ const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
1691
+ ancestors.forEach(ancestor => {
1692
+ ancestorScroll && ancestor.addEventListener('scroll', update, {
1693
+ passive: true
1694
+ });
1695
+ ancestorResize && ancestor.addEventListener('resize', update);
1696
+ });
1697
+ let observer = null;
1698
+
1699
+ if (elementResize) {
1700
+ observer = new ResizeObserver(update);
1701
+ isElement(reference) && observer.observe(reference);
1702
+ observer.observe(floating);
1703
+ }
1704
+
1705
+ let frameId;
1706
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1707
+
1708
+ if (animationFrame) {
1709
+ frameLoop();
1710
+ }
1711
+
1712
+ function frameLoop() {
1713
+ if (cleanedUp) {
1714
+ return;
1715
+ }
1716
+
1717
+ const nextRefRect = getBoundingClientRect(reference);
1718
+
1719
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1720
+ update();
1721
+ }
1722
+
1723
+ prevRefRect = nextRefRect;
1724
+ frameId = requestAnimationFrame(frameLoop);
1725
+ }
1726
+
1727
+ return () => {
1728
+ var _observer;
1729
+
1730
+ cleanedUp = true;
1731
+ ancestors.forEach(ancestor => {
1732
+ ancestorScroll && ancestor.removeEventListener('scroll', update);
1733
+ ancestorResize && ancestor.removeEventListener('resize', update);
1734
+ });
1735
+ (_observer = observer) == null ? void 0 : _observer.disconnect();
1736
+ observer = null;
1737
+
1738
+ if (animationFrame) {
1739
+ cancelAnimationFrame(frameId);
1740
+ }
1741
+ };
1742
+ }
1743
+
1744
+ /**
1745
+ * Computes the `x` and `y` coordinates that will place the floating element
1746
+ * next to a reference element when it is given a certain CSS positioning
1747
+ * strategy.
1748
+ */
1749
+
1750
+ const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
1751
+ platform,
1752
+ ...options
1753
+ });
1754
+
1755
+ /*!
1756
+ * tabbable 5.3.0-beta.1
1757
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
1758
+ */
1759
+ var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]:not(slot)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details'];
1760
+ var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
1761
+ var NoElement = typeof Element === 'undefined';
1762
+ var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1763
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
1764
+ return element.getRootNode();
1765
+ } : function (element) {
1766
+ return element.ownerDocument;
1767
+ };
1768
+ /**
1769
+ * @param {Element} el container to check in
1770
+ * @param {boolean} includeContainer add container to check
1771
+ * @param {(node: Element) => boolean} filter filter candidates
1772
+ * @returns {Element[]}
1773
+ */
1774
+
1775
+ var getCandidates = function getCandidates(el, includeContainer, filter) {
1776
+ var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
1777
+
1778
+ if (includeContainer && matches.call(el, candidateSelector)) {
1779
+ candidates.unshift(el);
1780
+ }
1781
+
1782
+ candidates = candidates.filter(filter);
1783
+ return candidates;
1784
+ };
1785
+ /**
1786
+ * @callback GetShadowRoot
1787
+ * @param {Element} element to check for shadow root
1788
+ * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
1789
+ */
1790
+
1791
+ /**
1792
+ * @typedef {Object} CandidatesScope
1793
+ * @property {Element} scope contains inner candidates
1794
+ * @property {Element[]} candidates
1795
+ */
1796
+
1797
+ /**
1798
+ * @typedef {Object} IterativeOptions
1799
+ * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;
1800
+ * if a function, implies shadow support is enabled and either returns the shadow root of an element
1801
+ * or a boolean stating if it has an undisclosed shadow root
1802
+ * @property {(node: Element) => boolean} filter filter candidates
1803
+ * @property {boolean} flatten if true then result will flatten any CandidatesScope into the returned list
1804
+ */
1805
+
1806
+ /**
1807
+ * @param {Element[]} elements list of element containers to match candidates from
1808
+ * @param {boolean} includeContainer add container list to check
1809
+ * @param {IterativeOptions} options
1810
+ * @returns {Array.<Element|CandidatesScope>}
1811
+ */
1812
+
1813
+
1814
+ var getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
1815
+ var candidates = [];
1816
+ var elementsToCheck = Array.from(elements);
1817
+
1818
+ while (elementsToCheck.length) {
1819
+ var element = elementsToCheck.shift();
1820
+
1821
+ if (element.tagName === 'SLOT') {
1822
+ // add shadow dom slot scope (slot itself cannot be focusable)
1823
+ var assigned = element.assignedElements();
1824
+ var content = assigned.length ? assigned : element.children;
1825
+ var nestedCandidates = getCandidatesIteratively(content, true, options);
1826
+
1827
+ if (options.flatten) {
1828
+ candidates.push.apply(candidates, nestedCandidates);
1829
+ } else {
1830
+ candidates.push({
1831
+ scope: element,
1832
+ candidates: nestedCandidates
1833
+ });
1834
+ }
1835
+ } else {
1836
+ // check candidate element
1837
+ var validCandidate = matches.call(element, candidateSelector);
1838
+
1839
+ if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
1840
+ candidates.push(element);
1841
+ } // iterate over shadow content if possible
1842
+
1843
+
1844
+ var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
1845
+ typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
1846
+
1847
+ if (shadowRoot) {
1848
+ // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
1849
+ // shadow exists, so look at light dom children as fallback BUT create a scope for any
1850
+ // child candidates found because they're likely slotted elements (elements that are
1851
+ // children of the web component element (which has the shadow), in the light dom, but
1852
+ // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
1853
+ // _after_ we return from this recursive call
1854
+ var _nestedCandidates = getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
1855
+
1856
+ if (options.flatten) {
1857
+ candidates.push.apply(candidates, _nestedCandidates);
1858
+ } else {
1859
+ candidates.push({
1860
+ scope: element,
1861
+ candidates: _nestedCandidates
1862
+ });
1863
+ }
1864
+ } else {
1865
+ // there's not shadow so just dig into the element's (light dom) children
1866
+ // __without__ giving the element special scope treatment
1867
+ elementsToCheck.unshift.apply(elementsToCheck, element.children);
1868
+ }
1869
+ }
1870
+ }
1871
+
1872
+ return candidates;
1873
+ };
1874
+
1875
+ var isContentEditable = function isContentEditable(node) {
1876
+ return node.contentEditable === 'true';
1877
+ };
1878
+
1879
+ var getTabindex = function getTabindex(node, isScope) {
1880
+ var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);
1881
+
1882
+ if (!isNaN(tabindexAttr)) {
1883
+ return tabindexAttr;
1884
+ } // Browsers do not return `tabIndex` correctly for contentEditable nodes;
1885
+ // so if they don't have a tabindex attribute specifically set, assume it's 0.
1886
+
1887
+
1888
+ if (isContentEditable(node)) {
1889
+ return 0;
1890
+ } // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
1891
+ // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
1892
+ // yet they are still part of the regular tab order; in FF, they get a default
1893
+ // `tabIndex` of 0; since Chrome still puts those elements in the regular tab
1894
+ // order, consider their tab index to be 0.
1895
+ //
1896
+ // isScope is positive for custom element with shadow root or slot that by default
1897
+ // have tabIndex -1, but need to be sorted by document order in order for their
1898
+ // content to be inserted in the correct position
1899
+
1900
+
1901
+ if ((isScope || node.nodeName === 'AUDIO' || node.nodeName === 'VIDEO' || node.nodeName === 'DETAILS') && node.getAttribute('tabindex') === null) {
1902
+ return 0;
1903
+ }
1904
+
1905
+ return node.tabIndex;
1906
+ };
1907
+
1908
+ var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
1909
+ return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
1910
+ };
1911
+
1912
+ var isInput = function isInput(node) {
1913
+ return node.tagName === 'INPUT';
1914
+ };
1915
+
1916
+ var isHiddenInput = function isHiddenInput(node) {
1917
+ return isInput(node) && node.type === 'hidden';
1918
+ };
1919
+
1920
+ var isDetailsWithSummary = function isDetailsWithSummary(node) {
1921
+ var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
1922
+ return child.tagName === 'SUMMARY';
1923
+ });
1924
+ return r;
1925
+ };
1926
+
1927
+ var getCheckedRadio = function getCheckedRadio(nodes, form) {
1928
+ for (var i = 0; i < nodes.length; i++) {
1929
+ if (nodes[i].checked && nodes[i].form === form) {
1930
+ return nodes[i];
1931
+ }
1932
+ }
1933
+ };
1934
+
1935
+ var isTabbableRadio = function isTabbableRadio(node) {
1936
+ if (!node.name) {
1937
+ return true;
1938
+ }
1939
+
1940
+ var radioScope = node.form || getRootNode(node);
1941
+
1942
+ var queryRadios = function queryRadios(name) {
1943
+ return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
1944
+ };
1945
+
1946
+ var radioSet;
1947
+
1948
+ if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
1949
+ radioSet = queryRadios(window.CSS.escape(node.name));
1950
+ } else {
1951
+ try {
1952
+ radioSet = queryRadios(node.name);
1953
+ } catch (err) {
1954
+ // eslint-disable-next-line no-console
1955
+ console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message);
1956
+ return false;
1957
+ }
1958
+ }
1959
+
1960
+ var checked = getCheckedRadio(radioSet, node.form);
1961
+ return !checked || checked === node;
1962
+ };
1963
+
1964
+ var isRadio = function isRadio(node) {
1965
+ return isInput(node) && node.type === 'radio';
1966
+ };
1967
+
1968
+ var isNonTabbableRadio = function isNonTabbableRadio(node) {
1969
+ return isRadio(node) && !isTabbableRadio(node);
1970
+ };
1971
+
1972
+ var isZeroArea = function isZeroArea(node) {
1973
+ var _node$getBoundingClie = node.getBoundingClientRect(),
1974
+ width = _node$getBoundingClie.width,
1975
+ height = _node$getBoundingClie.height;
1976
+
1977
+ return width === 0 && height === 0;
1978
+ };
1979
+
1980
+ var isHidden = function isHidden(node, _ref) {
1981
+ var displayCheck = _ref.displayCheck,
1982
+ getShadowRoot = _ref.getShadowRoot;
1983
+
1984
+ if (getComputedStyle(node).visibility === 'hidden') {
1985
+ return true;
1986
+ }
1987
+
1988
+ var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
1989
+ var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
1990
+
1991
+ if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
1992
+ return true;
1993
+ }
1994
+
1995
+ if (!displayCheck || displayCheck === 'full') {
1996
+ if (typeof getShadowRoot === 'function') {
1997
+ // figure out if we should consider the node to be in an undisclosed shadow and use the
1998
+ // 'non-zero-area' fallback
1999
+ var originalNode = node;
2000
+
2001
+ while (node) {
2002
+ var parentElement = node.parentElement;
2003
+ var rootNode = getRootNode(node);
2004
+
2005
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow
2006
+ ) {
2007
+ // node has an undisclosed shadow which means we can only treat it as a black box, so we
2008
+ // fall back to a non-zero-area test
2009
+ return isZeroArea(node);
2010
+ } else if (node.assignedSlot) {
2011
+ // iterate up slot
2012
+ node = node.assignedSlot;
2013
+ } else if (!parentElement && rootNode !== node.ownerDocument) {
2014
+ // cross shadow boundary
2015
+ node = rootNode.host;
2016
+ } else {
2017
+ // iterate up normal dom
2018
+ node = parentElement;
2019
+ }
2020
+ }
2021
+
2022
+ node = originalNode;
2023
+ } // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
2024
+ // (i.e. it does not also presume that all nodes might have undisclosed shadows); or
2025
+ // it might be a falsy value, which means shadow DOM support is disabled
2026
+ // didn't find it sitting in an undisclosed shadow (or shadows are disabled) so now we
2027
+ // can just test to see if it would normally be visible or not
2028
+ // this works wherever the node is: if there's at least one client rect, it's
2029
+ // somehow displayed; it also covers the CSS 'display: contents' case where the
2030
+ // node itself is hidden in place of its contents; and there's no need to search
2031
+ // up the hierarchy either
2032
+
2033
+
2034
+ return !node.getClientRects().length;
2035
+ } else if (displayCheck === 'non-zero-area') {
2036
+ return isZeroArea(node);
2037
+ }
2038
+
2039
+ return false;
2040
+ }; // form fields (nested) inside a disabled fieldset are not focusable/tabbable
2041
+ // unless they are in the _first_ <legend> element of the top-most disabled
2042
+ // fieldset
2043
+
2044
+
2045
+ var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
2046
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
2047
+ var parentNode = node.parentElement; // check if `node` is contained in a disabled <fieldset>
2048
+
2049
+ while (parentNode) {
2050
+ if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {
2051
+ // look for the first <legend> among the children of the disabled <fieldset>
2052
+ for (var i = 0; i < parentNode.children.length; i++) {
2053
+ var child = parentNode.children.item(i); // when the first <legend> (in document order) is found
2054
+
2055
+ if (child.tagName === 'LEGEND') {
2056
+ // if its parent <fieldset> is not nested in another disabled <fieldset>,
2057
+ // return whether `node` is a descendant of its first <legend>
2058
+ return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);
2059
+ }
2060
+ } // the disabled <fieldset> containing `node` has no <legend>
2061
+
2062
+
2063
+ return true;
2064
+ }
2065
+
2066
+ parentNode = parentNode.parentElement;
2067
+ }
2068
+ } // else, node's tabbable/focusable state should not be affected by a fieldset's
2069
+ // enabled/disabled state
2070
+
2071
+
2072
+ return false;
2073
+ };
2074
+
2075
+ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
2076
+ if (node.disabled || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
2077
+ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
2078
+ return false;
2079
+ }
2080
+
2081
+ return true;
2082
+ };
2083
+
2084
+ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
2085
+ if (!isNodeMatchingSelectorFocusable(options, node) || isNonTabbableRadio(node) || getTabindex(node) < 0) {
2086
+ return false;
2087
+ }
2088
+
2089
+ return true;
2090
+ };
2091
+ /**
2092
+ * @param {Array.<Element|CandidatesScope>} candidates
2093
+ * @returns Element[]
2094
+ */
2095
+
2096
+
2097
+ var sortByOrder = function sortByOrder(candidates) {
2098
+ var regularTabbables = [];
2099
+ var orderedTabbables = [];
2100
+ candidates.forEach(function (item, i) {
2101
+ var isScope = !!item.scope;
2102
+ var element = isScope ? item.scope : item;
2103
+ var candidateTabindex = getTabindex(element, isScope);
2104
+ var elements = isScope ? sortByOrder(item.candidates) : element;
2105
+
2106
+ if (candidateTabindex === 0) {
2107
+ isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
2108
+ } else {
2109
+ orderedTabbables.push({
2110
+ documentOrder: i,
2111
+ tabIndex: candidateTabindex,
2112
+ item: item,
2113
+ isScope: isScope,
2114
+ content: elements
2115
+ });
2116
+ }
2117
+ });
2118
+ return orderedTabbables.sort(sortOrderedTabbables).reduce(function (acc, sortable) {
2119
+ sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
2120
+ return acc;
2121
+ }, []).concat(regularTabbables);
2122
+ };
2123
+
2124
+ var tabbable = function tabbable(el, options) {
2125
+ options = options || {};
2126
+ var candidates;
2127
+
2128
+ if (options.getShadowRoot) {
2129
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
2130
+ filter: isNodeMatchingSelectorTabbable.bind(null, options),
2131
+ flatten: false,
2132
+ getShadowRoot: options.getShadowRoot
2133
+ });
2134
+ } else {
2135
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
2136
+ }
2137
+
2138
+ return sortByOrder(candidates);
2139
+ };
2140
+
2141
+ var focusable = function focusable(el, options) {
2142
+ options = options || {};
2143
+ var candidates;
2144
+
2145
+ if (options.getShadowRoot) {
2146
+ candidates = getCandidatesIteratively([el], options.includeContainer, {
2147
+ filter: isNodeMatchingSelectorFocusable.bind(null, options),
2148
+ flatten: true,
2149
+ getShadowRoot: options.getShadowRoot
2150
+ });
2151
+ } else {
2152
+ candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
2153
+ }
2154
+
2155
+ return candidates;
2156
+ };
2157
+
2158
+ var isTabbable = function isTabbable(node, options) {
2159
+ options = options || {};
2160
+
2161
+ if (!node) {
2162
+ throw new Error('No node provided');
2163
+ }
2164
+
2165
+ if (matches.call(node, candidateSelector) === false) {
2166
+ return false;
2167
+ }
2168
+
2169
+ return isNodeMatchingSelectorTabbable(options, node);
2170
+ };
2171
+
2172
+ var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
2173
+
2174
+ var isFocusable = function isFocusable(node, options) {
2175
+ options = options || {};
2176
+
2177
+ if (!node) {
2178
+ throw new Error('No node provided');
2179
+ }
2180
+
2181
+ if (matches.call(node, focusableCandidateSelector) === false) {
2182
+ return false;
2183
+ }
2184
+
2185
+ return isNodeMatchingSelectorFocusable(options, node);
2186
+ };
2187
+
2188
+ /*!
2189
+ * focus-trap 6.8.0-beta.2
2190
+ * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
2191
+ */
2192
+
2193
+ function ownKeys(object, enumerableOnly) {
2194
+ var keys = Object.keys(object);
2195
+
2196
+ if (Object.getOwnPropertySymbols) {
2197
+ var symbols = Object.getOwnPropertySymbols(object);
2198
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
2199
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2200
+ })), keys.push.apply(keys, symbols);
2201
+ }
2202
+
2203
+ return keys;
2204
+ }
2205
+
2206
+ function _objectSpread2(target) {
2207
+ for (var i = 1; i < arguments.length; i++) {
2208
+ var source = null != arguments[i] ? arguments[i] : {};
2209
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
2210
+ _defineProperty(target, key, source[key]);
2211
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
2212
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2213
+ });
2214
+ }
2215
+
2216
+ return target;
2217
+ }
2218
+
2219
+ function _defineProperty(obj, key, value) {
2220
+ if (key in obj) {
2221
+ Object.defineProperty(obj, key, {
2222
+ value: value,
2223
+ enumerable: true,
2224
+ configurable: true,
2225
+ writable: true
2226
+ });
2227
+ } else {
2228
+ obj[key] = value;
2229
+ }
2230
+
2231
+ return obj;
2232
+ }
2233
+
2234
+ var activeFocusTraps = function () {
2235
+ var trapQueue = [];
2236
+ return {
2237
+ activateTrap: function activateTrap(trap) {
2238
+ if (trapQueue.length > 0) {
2239
+ var activeTrap = trapQueue[trapQueue.length - 1];
2240
+
2241
+ if (activeTrap !== trap) {
2242
+ activeTrap.pause();
2243
+ }
2244
+ }
2245
+
2246
+ var trapIndex = trapQueue.indexOf(trap);
2247
+
2248
+ if (trapIndex === -1) {
2249
+ trapQueue.push(trap);
2250
+ } else {
2251
+ // move this existing trap to the front of the queue
2252
+ trapQueue.splice(trapIndex, 1);
2253
+ trapQueue.push(trap);
2254
+ }
2255
+ },
2256
+ deactivateTrap: function deactivateTrap(trap) {
2257
+ var trapIndex = trapQueue.indexOf(trap);
2258
+
2259
+ if (trapIndex !== -1) {
2260
+ trapQueue.splice(trapIndex, 1);
2261
+ }
2262
+
2263
+ if (trapQueue.length > 0) {
2264
+ trapQueue[trapQueue.length - 1].unpause();
2265
+ }
2266
+ }
2267
+ };
2268
+ }();
2269
+
2270
+ var isSelectableInput = function isSelectableInput(node) {
2271
+ return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
2272
+ };
2273
+
2274
+ var isEscapeEvent = function isEscapeEvent(e) {
2275
+ return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
2276
+ };
2277
+
2278
+ var isTabEvent = function isTabEvent(e) {
2279
+ return e.key === 'Tab' || e.keyCode === 9;
2280
+ };
2281
+
2282
+ var delay = function delay(fn) {
2283
+ return setTimeout(fn, 0);
2284
+ }; // Array.find/findIndex() are not supported on IE; this replicates enough
2285
+ // of Array.findIndex() for our needs
2286
+
2287
+
2288
+ var findIndex = function findIndex(arr, fn) {
2289
+ var idx = -1;
2290
+ arr.every(function (value, i) {
2291
+ if (fn(value)) {
2292
+ idx = i;
2293
+ return false; // break
2294
+ }
2295
+
2296
+ return true; // next
2297
+ });
2298
+ return idx;
2299
+ };
2300
+ /**
2301
+ * Get an option's value when it could be a plain value, or a handler that provides
2302
+ * the value.
2303
+ * @param {*} value Option's value to check.
2304
+ * @param {...*} [params] Any parameters to pass to the handler, if `value` is a function.
2305
+ * @returns {*} The `value`, or the handler's returned value.
2306
+ */
2307
+
2308
+
2309
+ var valueOrHandler = function valueOrHandler(value) {
2310
+ for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2311
+ params[_key - 1] = arguments[_key];
2312
+ }
2313
+
2314
+ return typeof value === 'function' ? value.apply(void 0, params) : value;
2315
+ };
2316
+
2317
+ var getActualTarget = function getActualTarget(event) {
2318
+ // NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the
2319
+ // shadow host. However, event.target.composedPath() will be an array of
2320
+ // nodes "clicked" from inner-most (the actual element inside the shadow) to
2321
+ // outer-most (the host HTML document). If we have access to composedPath(),
2322
+ // then use its first element; otherwise, fall back to event.target (and
2323
+ // this only works for an _open_ shadow DOM; otherwise,
2324
+ // composedPath()[0] === event.target always).
2325
+ return event.target.shadowRoot && typeof event.composedPath === 'function' ? event.composedPath()[0] : event.target;
2326
+ };
2327
+
2328
+ var createFocusTrap = function createFocusTrap(elements, userOptions) {
2329
+ // SSR: a live trap shouldn't be created in this type of environment so this
2330
+ // should be safe code to execute if the `document` option isn't specified
2331
+ var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
2332
+
2333
+ var config = _objectSpread2({
2334
+ returnFocusOnDeactivate: true,
2335
+ escapeDeactivates: true,
2336
+ delayInitialFocus: true
2337
+ }, userOptions);
2338
+
2339
+ var state = {
2340
+ // containers given to createFocusTrap()
2341
+ // @type {Array<HTMLElement>}
2342
+ containers: [],
2343
+ // list of objects identifying tabbable nodes in `containers` in the trap
2344
+ // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
2345
+ // is active, but the trap should never get to a state where there isn't at least one group
2346
+ // with at least one tabbable node in it (that would lead to an error condition that would
2347
+ // result in an error being thrown)
2348
+ // @type {Array<{
2349
+ // container: HTMLElement,
2350
+ // tabbableNodes: Array<HTMLElement>, // empty if none
2351
+ // focusableNodes: Array<HTMLElement>, // empty if none
2352
+ // firstTabbableNode: HTMLElement|null,
2353
+ // lastTabbableNode: HTMLElement|null,
2354
+ // nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
2355
+ // }>}
2356
+ containerGroups: [],
2357
+ // same order/length as `containers` list
2358
+ // references to objects in `containerGroups`, but only those that actually have
2359
+ // tabbable nodes in them
2360
+ // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
2361
+ // the same length
2362
+ tabbableGroups: [],
2363
+ nodeFocusedBeforeActivation: null,
2364
+ mostRecentlyFocusedNode: null,
2365
+ active: false,
2366
+ paused: false,
2367
+ // timer ID for when delayInitialFocus is true and initial focus in this trap
2368
+ // has been delayed during activation
2369
+ delayInitialFocusTimer: undefined
2370
+ };
2371
+ var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later
2372
+
2373
+ /**
2374
+ * Gets a configuration option value.
2375
+ * @param {Object|undefined} configOverrideOptions If true, and option is defined in this set,
2376
+ * value will be taken from this object. Otherwise, value will be taken from base configuration.
2377
+ * @param {string} optionName Name of the option whose value is sought.
2378
+ * @param {string|undefined} [configOptionName] Name of option to use __instead of__ `optionName`
2379
+ * IIF `configOverrideOptions` is not defined. Otherwise, `optionName` is used.
2380
+ */
2381
+
2382
+ var getOption = function getOption(configOverrideOptions, optionName, configOptionName) {
2383
+ return configOverrideOptions && configOverrideOptions[optionName] !== undefined ? configOverrideOptions[optionName] : config[configOptionName || optionName];
2384
+ };
2385
+ /**
2386
+ * Finds the index of the container that contains the element.
2387
+ * @param {HTMLElement} element
2388
+ * @returns {number} Index of the container in either `state.containers` or
2389
+ * `state.containerGroups` (the order/length of these lists are the same); -1
2390
+ * if the element isn't found.
2391
+ */
2392
+
2393
+
2394
+ var findContainerIndex = function findContainerIndex(element) {
2395
+ // NOTE: search `containerGroups` because it's possible a group contains no tabbable
2396
+ // nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
2397
+ // and we still need to find the element in there
2398
+ return state.containerGroups.findIndex(function (_ref) {
2399
+ var container = _ref.container,
2400
+ tabbableNodes = _ref.tabbableNodes;
2401
+ return container.contains(element) || // fall back to explicit tabbable search which will take into consideration any
2402
+ // web components if the `tabbableOptions.getShadowRoot` option was used for
2403
+ // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
2404
+ // look inside web components even if open)
2405
+ tabbableNodes.find(function (node) {
2406
+ return node === element;
2407
+ });
2408
+ });
2409
+ };
2410
+ /**
2411
+ * Gets the node for the given option, which is expected to be an option that
2412
+ * can be either a DOM node, a string that is a selector to get a node, `false`
2413
+ * (if a node is explicitly NOT given), or a function that returns any of these
2414
+ * values.
2415
+ * @param {string} optionName
2416
+ * @returns {undefined | false | HTMLElement | SVGElement} Returns
2417
+ * `undefined` if the option is not specified; `false` if the option
2418
+ * resolved to `false` (node explicitly not given); otherwise, the resolved
2419
+ * DOM node.
2420
+ * @throws {Error} If the option is set, not `false`, and is not, or does not
2421
+ * resolve to a node.
2422
+ */
2423
+
2424
+
2425
+ var getNodeForOption = function getNodeForOption(optionName) {
2426
+ var optionValue = config[optionName];
2427
+
2428
+ if (typeof optionValue === 'function') {
2429
+ for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2430
+ params[_key2 - 1] = arguments[_key2];
2431
+ }
2432
+
2433
+ optionValue = optionValue.apply(void 0, params);
2434
+ }
2435
+
2436
+ if (!optionValue) {
2437
+ if (optionValue === undefined || optionValue === false) {
2438
+ return optionValue;
2439
+ } // else, empty string (invalid), null (invalid), 0 (invalid)
2440
+
2441
+
2442
+ throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
2443
+ }
2444
+
2445
+ var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point
2446
+
2447
+ if (typeof optionValue === 'string') {
2448
+ node = doc.querySelector(optionValue); // resolve to node, or null if fails
2449
+
2450
+ if (!node) {
2451
+ throw new Error("`".concat(optionName, "` as selector refers to no known node"));
2452
+ }
2453
+ }
2454
+
2455
+ return node;
2456
+ };
2457
+
2458
+ var getInitialFocusNode = function getInitialFocusNode() {
2459
+ var node = getNodeForOption('initialFocus'); // false explicitly indicates we want no initialFocus at all
2460
+
2461
+ if (node === false) {
2462
+ return false;
2463
+ }
2464
+
2465
+ if (node === undefined) {
2466
+ // option not specified: use fallback options
2467
+ if (findContainerIndex(doc.activeElement) >= 0) {
2468
+ node = doc.activeElement;
2469
+ } else {
2470
+ var firstTabbableGroup = state.tabbableGroups[0];
2471
+ var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode; // NOTE: `fallbackFocus` option function cannot return `false` (not supported)
2472
+
2473
+ node = firstTabbableNode || getNodeForOption('fallbackFocus');
2474
+ }
2475
+ }
2476
+
2477
+ if (!node) {
2478
+ throw new Error('Your focus-trap needs to have at least one focusable element');
2479
+ }
2480
+
2481
+ return node;
2482
+ };
2483
+
2484
+ var updateTabbableNodes = function updateTabbableNodes() {
2485
+ state.containerGroups = state.containers.map(function (container) {
2486
+ var _config$tabbableOptio, _config$tabbableOptio2;
2487
+
2488
+ var tabbableNodes = tabbable(container, {
2489
+ getShadowRoot: (_config$tabbableOptio = config.tabbableOptions) === null || _config$tabbableOptio === void 0 ? void 0 : _config$tabbableOptio.getShadowRoot
2490
+ }); // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
2491
+ // are a superset of tabbable nodes
2492
+
2493
+ var focusableNodes = focusable(container, {
2494
+ getShadowRoot: (_config$tabbableOptio2 = config.tabbableOptions) === null || _config$tabbableOptio2 === void 0 ? void 0 : _config$tabbableOptio2.getShadowRoot
2495
+ });
2496
+ return {
2497
+ container: container,
2498
+ tabbableNodes: tabbableNodes,
2499
+ focusableNodes: focusableNodes,
2500
+ firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
2501
+ lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,
2502
+
2503
+ /**
2504
+ * Finds the __tabbable__ node that follows the given node in the specified direction,
2505
+ * in this container, if any.
2506
+ * @param {HTMLElement} node
2507
+ * @param {boolean} [forward] True if going in forward tab order; false if going
2508
+ * in reverse.
2509
+ * @returns {HTMLElement|undefined} The next tabbable node, if any.
2510
+ */
2511
+ nextTabbableNode: function nextTabbableNode(node) {
2512
+ var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2513
+ // NOTE: If tabindex is positive (in order to manipulate the tab order separate
2514
+ // from the DOM order), this __will not work__ because the list of focusableNodes,
2515
+ // while it contains tabbable nodes, does not sort its nodes in any order other
2516
+ // than DOM order, because it can't: Where would you place focusable (but not
2517
+ // tabbable) nodes in that order? They have no order, because they aren't tabbale...
2518
+ // Support for positive tabindex is already broken and hard to manage (possibly
2519
+ // not supportable, TBD), so this isn't going to make things worse than they
2520
+ // already are, and at least makes things better for the majority of cases where
2521
+ // tabindex is either 0/unset or negative.
2522
+ // FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
2523
+ var nodeIdx = focusableNodes.findIndex(function (n) {
2524
+ return n === node;
2525
+ });
2526
+
2527
+ if (nodeIdx < 0) {
2528
+ return undefined;
2529
+ }
2530
+
2531
+ if (forward) {
2532
+ return focusableNodes.slice(nodeIdx + 1).find(function (n) {
2533
+ return isTabbable(n);
2534
+ });
2535
+ }
2536
+
2537
+ return focusableNodes.slice(0, nodeIdx).reverse().find(function (n) {
2538
+ return isTabbable(n);
2539
+ });
2540
+ }
2541
+ };
2542
+ });
2543
+ state.tabbableGroups = state.containerGroups.filter(function (group) {
2544
+ return group.tabbableNodes.length > 0;
2545
+ }); // throw if no groups have tabbable nodes and we don't have a fallback focus node either
2546
+
2547
+ if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus') // returning false not supported for this option
2548
+ ) {
2549
+ throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
2550
+ }
2551
+ };
2552
+
2553
+ var tryFocus = function tryFocus(node) {
2554
+ if (node === false) {
2555
+ return;
2556
+ }
2557
+
2558
+ if (node === doc.activeElement) {
2559
+ return;
2560
+ }
2561
+
2562
+ if (!node || !node.focus) {
2563
+ tryFocus(getInitialFocusNode());
2564
+ return;
2565
+ }
2566
+
2567
+ node.focus({
2568
+ preventScroll: !!config.preventScroll
2569
+ });
2570
+ state.mostRecentlyFocusedNode = node;
2571
+
2572
+ if (isSelectableInput(node)) {
2573
+ node.select();
2574
+ }
2575
+ };
2576
+
2577
+ var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) {
2578
+ var node = getNodeForOption('setReturnFocus', previousActiveElement);
2579
+ return node ? node : node === false ? false : previousActiveElement;
2580
+ }; // This needs to be done on mousedown and touchstart instead of click
2581
+ // so that it precedes the focus event.
2582
+
2583
+
2584
+ var checkPointerDown = function checkPointerDown(e) {
2585
+ var target = getActualTarget(e);
2586
+
2587
+ if (findContainerIndex(target) >= 0) {
2588
+ // allow the click since it ocurred inside the trap
2589
+ return;
2590
+ }
2591
+
2592
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
2593
+ // immediately deactivate the trap
2594
+ trap.deactivate({
2595
+ // if, on deactivation, we should return focus to the node originally-focused
2596
+ // when the trap was activated (or the configured `setReturnFocus` node),
2597
+ // then assume it's also OK to return focus to the outside node that was
2598
+ // just clicked, causing deactivation, as long as that node is focusable;
2599
+ // if it isn't focusable, then return focus to the original node focused
2600
+ // on activation (or the configured `setReturnFocus` node)
2601
+ // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
2602
+ // which will result in the outside click setting focus to the node
2603
+ // that was clicked, whether it's focusable or not; by setting
2604
+ // `returnFocus: true`, we'll attempt to re-focus the node originally-focused
2605
+ // on activation (or the configured `setReturnFocus` node)
2606
+ returnFocus: config.returnFocusOnDeactivate && !isFocusable(target)
2607
+ });
2608
+ return;
2609
+ } // This is needed for mobile devices.
2610
+ // (If we'll only let `click` events through,
2611
+ // then on mobile they will be blocked anyways if `touchstart` is blocked.)
2612
+
2613
+
2614
+ if (valueOrHandler(config.allowOutsideClick, e)) {
2615
+ // allow the click outside the trap to take place
2616
+ return;
2617
+ } // otherwise, prevent the click
2618
+
2619
+
2620
+ e.preventDefault();
2621
+ }; // In case focus escapes the trap for some strange reason, pull it back in.
2622
+
2623
+
2624
+ var checkFocusIn = function checkFocusIn(e) {
2625
+ var target = getActualTarget(e);
2626
+ var targetContained = findContainerIndex(target) >= 0; // In Firefox when you Tab out of an iframe the Document is briefly focused.
2627
+
2628
+ if (targetContained || target instanceof Document) {
2629
+ if (targetContained) {
2630
+ state.mostRecentlyFocusedNode = target;
2631
+ }
2632
+ } else {
2633
+ // escaped! pull it back in to where it just left
2634
+ e.stopImmediatePropagation();
2635
+ tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
2636
+ }
2637
+ }; // Hijack Tab events on the first and last focusable nodes of the trap,
2638
+ // in order to prevent focus from escaping. If it escapes for even a
2639
+ // moment it can end up scrolling the page and causing confusion so we
2640
+ // kind of need to capture the action at the keydown phase.
2641
+
2642
+
2643
+ var checkTab = function checkTab(e) {
2644
+ var target = getActualTarget(e);
2645
+ updateTabbableNodes();
2646
+ var destinationNode = null;
2647
+
2648
+ if (state.tabbableGroups.length > 0) {
2649
+ // make sure the target is actually contained in a group
2650
+ // NOTE: the target may also be the container itself if it's focusable
2651
+ // with tabIndex='-1' and was given initial focus
2652
+ var containerIndex = findContainerIndex(target);
2653
+ var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
2654
+
2655
+ if (containerIndex < 0) {
2656
+ // target not found in any group: quite possible focus has escaped the trap,
2657
+ // so bring it back in to...
2658
+ if (e.shiftKey) {
2659
+ // ...the last node in the last group
2660
+ destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
2661
+ } else {
2662
+ // ...the first node in the first group
2663
+ destinationNode = state.tabbableGroups[0].firstTabbableNode;
2664
+ }
2665
+ } else if (e.shiftKey) {
2666
+ // REVERSE
2667
+ // is the target the first tabbable node in a group?
2668
+ var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref2) {
2669
+ var firstTabbableNode = _ref2.firstTabbableNode;
2670
+ return target === firstTabbableNode;
2671
+ });
2672
+
2673
+ if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target) && !isTabbable(target) && !containerGroup.nextTabbableNode(target, false))) {
2674
+ // an exception case where the target is either the container itself, or
2675
+ // a non-tabbable node that was given focus (i.e. tabindex is negative
2676
+ // and user clicked on it or node was programmatically given focus)
2677
+ // and is not followed by any other tabbable node, in which
2678
+ // case, we should handle shift+tab as if focus were on the container's
2679
+ // first tabbable node, and go to the last tabbable node of the LAST group
2680
+ startOfGroupIndex = containerIndex;
2681
+ }
2682
+
2683
+ if (startOfGroupIndex >= 0) {
2684
+ // YES: then shift+tab should go to the last tabbable node in the
2685
+ // previous group (and wrap around to the last tabbable node of
2686
+ // the LAST group if it's the first tabbable node of the FIRST group)
2687
+ var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
2688
+ var destinationGroup = state.tabbableGroups[destinationGroupIndex];
2689
+ destinationNode = destinationGroup.lastTabbableNode;
2690
+ }
2691
+ } else {
2692
+ // FORWARD
2693
+ // is the target the last tabbable node in a group?
2694
+ var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref3) {
2695
+ var lastTabbableNode = _ref3.lastTabbableNode;
2696
+ return target === lastTabbableNode;
2697
+ });
2698
+
2699
+ if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target) && !isTabbable(target) && !containerGroup.nextTabbableNode(target))) {
2700
+ // an exception case where the target is the container itself, or
2701
+ // a non-tabbable node that was given focus (i.e. tabindex is negative
2702
+ // and user clicked on it or node was programmatically given focus)
2703
+ // and is not followed by any other tabbable node, in which
2704
+ // case, we should handle tab as if focus were on the container's
2705
+ // last tabbable node, and go to the first tabbable node of the FIRST group
2706
+ lastOfGroupIndex = containerIndex;
2707
+ }
2708
+
2709
+ if (lastOfGroupIndex >= 0) {
2710
+ // YES: then tab should go to the first tabbable node in the next
2711
+ // group (and wrap around to the first tabbable node of the FIRST
2712
+ // group if it's the last tabbable node of the LAST group)
2713
+ var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
2714
+
2715
+ var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
2716
+ destinationNode = _destinationGroup.firstTabbableNode;
2717
+ }
2718
+ }
2719
+ } else {
2720
+ // NOTE: the fallbackFocus option does not support returning false to opt-out
2721
+ destinationNode = getNodeForOption('fallbackFocus');
2722
+ }
2723
+
2724
+ if (destinationNode) {
2725
+ e.preventDefault();
2726
+ tryFocus(destinationNode);
2727
+ } // else, let the browser take care of [shift+]tab and move the focus
2728
+
2729
+ };
2730
+
2731
+ var checkKey = function checkKey(e) {
2732
+ if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates, e) !== false) {
2733
+ e.preventDefault();
2734
+ trap.deactivate();
2735
+ return;
2736
+ }
2737
+
2738
+ if (isTabEvent(e)) {
2739
+ checkTab(e);
2740
+ return;
2741
+ }
2742
+ };
2743
+
2744
+ var checkClick = function checkClick(e) {
2745
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
2746
+ return;
2747
+ }
2748
+
2749
+ var target = getActualTarget(e);
2750
+
2751
+ if (findContainerIndex(target) >= 0) {
2752
+ return;
2753
+ }
2754
+
2755
+ if (valueOrHandler(config.allowOutsideClick, e)) {
2756
+ return;
2757
+ }
2758
+
2759
+ e.preventDefault();
2760
+ e.stopImmediatePropagation();
2761
+ }; //
2762
+ // EVENT LISTENERS
2763
+ //
2764
+
2765
+
2766
+ var addListeners = function addListeners() {
2767
+ if (!state.active) {
2768
+ return;
2769
+ } // There can be only one listening focus trap at a time
2770
+
2771
+
2772
+ activeFocusTraps.activateTrap(trap); // Delay ensures that the focused element doesn't capture the event
2773
+ // that caused the focus trap activation.
2774
+
2775
+ state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function () {
2776
+ tryFocus(getInitialFocusNode());
2777
+ }) : tryFocus(getInitialFocusNode());
2778
+ doc.addEventListener('focusin', checkFocusIn, true);
2779
+ doc.addEventListener('mousedown', checkPointerDown, {
2780
+ capture: true,
2781
+ passive: false
2782
+ });
2783
+ doc.addEventListener('touchstart', checkPointerDown, {
2784
+ capture: true,
2785
+ passive: false
2786
+ });
2787
+ doc.addEventListener('click', checkClick, {
2788
+ capture: true,
2789
+ passive: false
2790
+ });
2791
+ doc.addEventListener('keydown', checkKey, {
2792
+ capture: true,
2793
+ passive: false
2794
+ });
2795
+ return trap;
2796
+ };
2797
+
2798
+ var removeListeners = function removeListeners() {
2799
+ if (!state.active) {
2800
+ return;
2801
+ }
2802
+
2803
+ doc.removeEventListener('focusin', checkFocusIn, true);
2804
+ doc.removeEventListener('mousedown', checkPointerDown, true);
2805
+ doc.removeEventListener('touchstart', checkPointerDown, true);
2806
+ doc.removeEventListener('click', checkClick, true);
2807
+ doc.removeEventListener('keydown', checkKey, true);
2808
+ return trap;
2809
+ }; //
2810
+ // TRAP DEFINITION
2811
+ //
2812
+
2813
+
2814
+ trap = {
2815
+ activate: function activate(activateOptions) {
2816
+ if (state.active) {
2817
+ return this;
2818
+ }
2819
+
2820
+ var onActivate = getOption(activateOptions, 'onActivate');
2821
+ var onPostActivate = getOption(activateOptions, 'onPostActivate');
2822
+ var checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap');
2823
+
2824
+ if (!checkCanFocusTrap) {
2825
+ updateTabbableNodes();
2826
+ }
2827
+
2828
+ state.active = true;
2829
+ state.paused = false;
2830
+ state.nodeFocusedBeforeActivation = doc.activeElement;
2831
+
2832
+ if (onActivate) {
2833
+ onActivate();
2834
+ }
2835
+
2836
+ var finishActivation = function finishActivation() {
2837
+ if (checkCanFocusTrap) {
2838
+ updateTabbableNodes();
2839
+ }
2840
+
2841
+ addListeners();
2842
+
2843
+ if (onPostActivate) {
2844
+ onPostActivate();
2845
+ }
2846
+ };
2847
+
2848
+ if (checkCanFocusTrap) {
2849
+ checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
2850
+ return this;
2851
+ }
2852
+
2853
+ finishActivation();
2854
+ return this;
2855
+ },
2856
+ deactivate: function deactivate(deactivateOptions) {
2857
+ if (!state.active) {
2858
+ return this;
2859
+ }
2860
+
2861
+ clearTimeout(state.delayInitialFocusTimer); // noop if undefined
2862
+
2863
+ state.delayInitialFocusTimer = undefined;
2864
+ removeListeners();
2865
+ state.active = false;
2866
+ state.paused = false;
2867
+ activeFocusTraps.deactivateTrap(trap);
2868
+ var onDeactivate = getOption(deactivateOptions, 'onDeactivate');
2869
+ var onPostDeactivate = getOption(deactivateOptions, 'onPostDeactivate');
2870
+ var checkCanReturnFocus = getOption(deactivateOptions, 'checkCanReturnFocus');
2871
+
2872
+ if (onDeactivate) {
2873
+ onDeactivate();
2874
+ }
2875
+
2876
+ var returnFocus = getOption(deactivateOptions, 'returnFocus', 'returnFocusOnDeactivate');
2877
+
2878
+ var finishDeactivation = function finishDeactivation() {
2879
+ delay(function () {
2880
+ if (returnFocus) {
2881
+ tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
2882
+ }
2883
+
2884
+ if (onPostDeactivate) {
2885
+ onPostDeactivate();
2886
+ }
2887
+ });
2888
+ };
2889
+
2890
+ if (returnFocus && checkCanReturnFocus) {
2891
+ checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
2892
+ return this;
2893
+ }
2894
+
2895
+ finishDeactivation();
2896
+ return this;
2897
+ },
2898
+ pause: function pause() {
2899
+ if (state.paused || !state.active) {
2900
+ return this;
2901
+ }
2902
+
2903
+ state.paused = true;
2904
+ removeListeners();
2905
+ return this;
2906
+ },
2907
+ unpause: function unpause() {
2908
+ if (!state.paused || !state.active) {
2909
+ return this;
2910
+ }
2911
+
2912
+ state.paused = false;
2913
+ updateTabbableNodes();
2914
+ addListeners();
2915
+ return this;
2916
+ },
2917
+ updateContainerElements: function updateContainerElements(containerElements) {
2918
+ var elementsAsArray = [].concat(containerElements).filter(Boolean);
2919
+ state.containers = elementsAsArray.map(function (element) {
2920
+ return typeof element === 'string' ? doc.querySelector(element) : element;
2921
+ });
2922
+
2923
+ if (state.active) {
2924
+ updateTabbableNodes();
2925
+ }
2926
+
2927
+ return this;
2928
+ }
2929
+ }; // initialize container elements
2930
+
2931
+ trap.updateContainerElements(elements);
2932
+ return trap;
2933
+ };
2934
+
2935
+ const catMenuCss = ":host{display:inline-block}:host([hidden]){display:none}.content{padding-top:0.5rem;padding-bottom:0.5rem;position:absolute;background:white;display:none;overflow:auto;-webkit-overflow-scrolling:touch;min-width:8rem;max-width:16rem;min-height:2rem;max-height:calc(100vh - 48px);box-shadow:0 1px 4px 0 rgba(16, 29, 48, 0.2);border-radius:0.25rem}";
2936
+
2937
+ let nextUniqueId = 0;
2938
+ let CatMenu = class {
2939
+ constructor(hostRef) {
2940
+ catIconRegistry.registerInstance(this, hostRef);
2941
+ this.catOpen = catIconRegistry.createEvent(this, "catOpen", 7);
2942
+ this.catClose = catIconRegistry.createEvent(this, "catClose", 7);
2943
+ this.id = nextUniqueId++;
2944
+ /**
2945
+ * The placement of the menu.
2946
+ */
2947
+ this.placement = 'bottom-start';
2948
+ }
2949
+ clickHandler(event) {
2950
+ var _a;
2951
+ // hide menu on button click
2952
+ if (this.content && event.composedPath().includes(this.content)) {
2953
+ (_a = this.trap) === null || _a === void 0 ? void 0 : _a.deactivate();
2954
+ this.hide();
2955
+ }
2956
+ }
2957
+ componentDidLoad() {
2958
+ var _a, _b, _c, _d, _e;
2959
+ this.trigger = this.firstTabbable(this.triggerSlot);
2960
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-haspopup', 'true');
2961
+ (_b = this.trigger) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-expanded', 'false');
2962
+ (_c = this.trigger) === null || _c === void 0 ? void 0 : _c.setAttribute('aria-controls', this.contentId);
2963
+ (_d = this.content) === null || _d === void 0 ? void 0 : _d.setAttribute('id', this.contentId);
2964
+ if (this.trigger && this.content) {
2965
+ (_e = this.trigger) === null || _e === void 0 ? void 0 : _e.addEventListener('click', () => this.show());
2966
+ autoUpdate(this.trigger, this.content, () => this.update());
2967
+ }
2968
+ this.keyListener = event => {
2969
+ if (this.content && ['ArrowDown', 'ArrowUp'].includes(event.key)) {
2970
+ const targetElements = tabbable(this.content, { includeContainer: false, getShadowRoot: true });
2971
+ const activeElement = this.firstTabbable(document.activeElement);
2972
+ const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;
2973
+ const activeOff = event.key === 'ArrowDown' ? 1 : -1;
2974
+ const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
2975
+ targetElements[targetIdx].focus();
2976
+ event.preventDefault();
2977
+ }
2978
+ };
2979
+ document.addEventListener('keydown', this.keyListener);
2980
+ }
2981
+ disconnectedCallback() {
2982
+ if (this.keyListener) {
2983
+ document.removeEventListener('keydown', this.keyListener);
2984
+ }
2985
+ }
2986
+ render() {
2987
+ return (catIconRegistry.h(catIconRegistry.Host, null, catIconRegistry.h("slot", { name: "trigger", ref: el => (this.triggerSlot = el) }), catIconRegistry.h("div", { class: "content", ref: el => (this.content = el) }, catIconRegistry.h("slot", { name: "content" }))));
2988
+ }
2989
+ get contentId() {
2990
+ return `cat-menu-${this.id}`;
2991
+ }
2992
+ show() {
2993
+ var _a;
2994
+ if (this.content) {
2995
+ this.content.style.display = 'block';
2996
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'true');
2997
+ this.catOpen.emit();
2998
+ this.trap = this.trap
2999
+ ? this.trap.updateContainerElements(this.content)
3000
+ : createFocusTrap(this.content, {
3001
+ tabbableOptions: {
3002
+ getShadowRoot: true
3003
+ },
3004
+ allowOutsideClick: true,
3005
+ clickOutsideDeactivates: event => !this.content || !event.composedPath().includes(this.content),
3006
+ onPostDeactivate: () => this.hide()
3007
+ });
3008
+ this.trap.activate();
3009
+ }
3010
+ }
3011
+ hide() {
3012
+ var _a;
3013
+ if (this.content) {
3014
+ this.content.style.display = '';
3015
+ (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'false');
3016
+ this.catClose.emit();
3017
+ }
3018
+ }
3019
+ update() {
3020
+ if (this.trigger && this.content) {
3021
+ computePosition(this.trigger, this.content, {
3022
+ placement: this.placement,
3023
+ middleware: [offset(CatMenu.OFFSET), flip()]
3024
+ }).then(({ x, y }) => {
3025
+ if (this.content) {
3026
+ Object.assign(this.content.style, {
3027
+ left: `${x}px`,
3028
+ top: `${y}px`
3029
+ });
3030
+ }
3031
+ });
3032
+ }
3033
+ }
3034
+ firstTabbable(container) {
3035
+ return (container ? tabbable(container, { includeContainer: true, getShadowRoot: true }) : []).shift();
3036
+ }
3037
+ };
3038
+ CatMenu.OFFSET = 4;
3039
+ CatMenu.style = catMenuCss;
3040
+
3041
+ const catSkeletonCss = ":host{display:flex;flex-direction:column;position:relative;--background:#ebecf0;--highlight:#d7dbe0;--speed:2s}:host([variant=square]),:host([variant=circle]){display:inline-flex}:host([hidden]){display:none}:host([variant=head]){margin-bottom:0.5rem}:host([variant=body]){margin-bottom:1rem}.cat-skeleton{display:block;border-radius:0.25rem;background:var(--background)}.cat-skeleton-circle{border-radius:10rem}.cat-skeleton-xs.cat-skeleton-rectangle{width:var(--width, 100%);height:var(--height, 1.5rem)}.cat-skeleton-xs.cat-skeleton-square,.cat-skeleton-xs.cat-skeleton-circle{width:var(--width, 1.5rem);height:var(--height, 1.5rem)}.cat-skeleton-xs.cat-skeleton-head,.cat-skeleton-xs.cat-skeleton-body{width:var(--width, var(--line-width, 100%))}.cat-skeleton-xs.cat-skeleton-head{height:calc(0.9375rem - 4px);margin:calc((1.25rem - 0.9375rem + 4px) * 0.5) 0}.cat-skeleton-xs.cat-skeleton-body{height:calc(0.75rem - 4px);margin:calc((1rem - 0.75rem + 4px) * 0.5) 0}.cat-skeleton-s.cat-skeleton-rectangle{width:var(--width, 100%);height:var(--height, 2rem)}.cat-skeleton-s.cat-skeleton-square,.cat-skeleton-s.cat-skeleton-circle{width:var(--width, 2rem);height:var(--height, 2rem)}.cat-skeleton-s.cat-skeleton-head,.cat-skeleton-s.cat-skeleton-body{width:var(--width, var(--line-width, 100%))}.cat-skeleton-s.cat-skeleton-head{height:calc(1.125rem - 4px);margin:calc((1.5rem - 1.125rem + 4px) * 0.5) 0}.cat-skeleton-s.cat-skeleton-body{height:calc(0.875rem - 4px);margin:calc((1rem - 0.875rem + 4px) * 0.5) 0}.cat-skeleton-m.cat-skeleton-rectangle{width:var(--width, 100%);height:var(--height, 2.5rem)}.cat-skeleton-m.cat-skeleton-square,.cat-skeleton-m.cat-skeleton-circle{width:var(--width, 2.5rem);height:var(--height, 2.5rem)}.cat-skeleton-m.cat-skeleton-head,.cat-skeleton-m.cat-skeleton-body{width:var(--width, var(--line-width, 100%))}.cat-skeleton-m.cat-skeleton-head{height:calc(1.25rem - 4px);margin:calc((1.5rem - 1.25rem + 4px) * 0.5) 0}.cat-skeleton-m.cat-skeleton-body{height:calc(0.9375rem - 4px);margin:calc((1.25rem - 0.9375rem + 4px) * 0.5) 0}.cat-skeleton-l.cat-skeleton-rectangle{width:var(--width, 100%);height:var(--height, 3rem)}.cat-skeleton-l.cat-skeleton-square,.cat-skeleton-l.cat-skeleton-circle{width:var(--width, 3rem);height:var(--height, 3rem)}.cat-skeleton-l.cat-skeleton-head,.cat-skeleton-l.cat-skeleton-body{width:var(--width, var(--line-width, 100%))}.cat-skeleton-l.cat-skeleton-head{height:calc(1.5rem - 4px);margin:calc((1.75rem - 1.5rem + 4px) * 0.5) 0}.cat-skeleton-l.cat-skeleton-body{height:calc(1.125rem - 4px);margin:calc((1.5rem - 1.125rem + 4px) * 0.5) 0}.cat-skeleton-xl.cat-skeleton-rectangle{width:var(--width, 100%);height:var(--height, 3.5rem)}.cat-skeleton-xl.cat-skeleton-square,.cat-skeleton-xl.cat-skeleton-circle{width:var(--width, 3.5rem);height:var(--height, 3.5rem)}.cat-skeleton-xl.cat-skeleton-head,.cat-skeleton-xl.cat-skeleton-body{width:var(--width, var(--line-width, 100%))}.cat-skeleton-xl.cat-skeleton-head{height:calc(1.75rem - 4px);margin:calc((2rem - 1.75rem + 4px) * 0.5) 0}.cat-skeleton-xl.cat-skeleton-body{height:calc(1.25rem - 4px);margin:calc((1.5rem - 1.25rem + 4px) * 0.5) 0}.cat-skeleton-sheen{background:linear-gradient(90deg, var(--background) 33%, var(--highlight) 50%, var(--background) 66%) var(--background);background-size:300% 100%;animation:sheen var(--speed) ease-in-out infinite}.cat-skeleton-pulse{position:relative;overflow:hidden}.cat-skeleton-pulse::before{content:\"\";display:block;position:absolute;width:100%;height:100%;background-color:var(--highlight);animation:var(--speed) ease-in-out 0.5s infinite normal none running pulse;opacity:0}@keyframes sheen{0%{background-position:right}}@keyframes pulse{50%{opacity:1}}";
3042
+
3043
+ let CatSkeleton = class {
3044
+ constructor(hostRef) {
3045
+ catIconRegistry.registerInstance(this, hostRef);
3046
+ /**
3047
+ * The animation style of the skeleton.
3048
+ */
3049
+ this.effect = 'sheen';
3050
+ /**
3051
+ * The rendering style of the skeleton.
3052
+ */
3053
+ this.variant = 'rectangle';
3054
+ /**
3055
+ * The size of the skeleton. If the variant is set to "head", the size values
3056
+ * "xs" to "xl" translate to the head levels `h1` to `h5`.
3057
+ */
3058
+ this.size = 'm';
3059
+ }
3060
+ render() {
3061
+ return (catIconRegistry.h(catIconRegistry.Host, null, Array.from(Array(this.count)).map(() => (catIconRegistry.h("div", { style: this.style, class: {
3062
+ 'cat-skeleton': true,
3063
+ [`cat-skeleton-${this.effect}`]: Boolean(this.effect),
3064
+ [`cat-skeleton-${this.variant}`]: Boolean(this.variant),
3065
+ [`cat-skeleton-${this.size}`]: Boolean(this.size)
3066
+ } })))));
3067
+ }
3068
+ get count() {
3069
+ switch (this.variant) {
3070
+ case 'head':
3071
+ return Math.max(1, this.lines || 1);
3072
+ case 'body':
3073
+ return Math.max(1, this.lines || 3);
3074
+ default:
3075
+ return 1;
3076
+ }
3077
+ }
3078
+ get style() {
3079
+ return this.variant === 'head' || this.variant === 'body'
3080
+ ? {
3081
+ '--line-width': `${this.random(50, 100)}%`
3082
+ }
3083
+ : undefined;
3084
+ }
3085
+ random(min, max) {
3086
+ return Math.floor(Math.random() * (max - min + 1) + min);
3087
+ }
3088
+ };
3089
+ CatSkeleton.style = catSkeletonCss;
3090
+
3091
+ const catSpinnerCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host[hidden]{display:none}span{display:inline-flex}svg{fill:none;stroke:currentColor;stroke-dasharray:135px;stroke-dashoffset:95px;stroke-linecap:round;stroke-width:5px;transform-origin:center center;animation:cat-spinner 0.75s cubic-bezier(0.4, 0.15, 0.6, 0.85) infinite;width:1em;height:1em}.cat-spinner-xs svg{font-size:0.75rem}.cat-spinner-s svg{font-size:1rem}.cat-spinner-m svg{font-size:1.25rem}.cat-spinner-l svg{font-size:1.5rem}.cat-spinner-xl svg{font-size:1.75rem}@keyframes cat-spinner{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}";
3092
+
3093
+ let CatSpinner = class {
3094
+ constructor(hostRef) {
3095
+ catIconRegistry.registerInstance(this, hostRef);
3096
+ /**
3097
+ * The size of the spinner.
3098
+ */
3099
+ this.size = 'm';
3100
+ }
3101
+ render() {
3102
+ return (catIconRegistry.h("span", { "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', class: {
3103
+ [`cat-spinner-${this.size}`]: this.size !== 'inline'
3104
+ } }, catIconRegistry.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48" }, catIconRegistry.h("circle", { cx: "24", cy: "24", r: "21.5" }))));
3105
+ }
3106
+ };
3107
+ CatSpinner.style = catSpinnerCss;
3108
+
3109
+ exports.cat_alert = CatAlert;
3110
+ exports.cat_badge = CatBadge;
3111
+ exports.cat_button = CatButton;
3112
+ exports.cat_icon = CatIcon;
3113
+ exports.cat_menu = CatMenu;
3114
+ exports.cat_skeleton = CatSkeleton;
3115
+ exports.cat_spinner = CatSpinner;