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