@sidebandai/sideband-react 1.4.5-rc.4 → 1.4.5-rc.5

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.
@@ -2,11 +2,126 @@ import { buildFabTitle as e, getChoiceValue as t, isPositiveSentimentChoice as n
2
2
  import { memo as a, useCallback as o, useEffect as s, useId as c, useLayoutEffect as l, useRef as u, useState as d, useSyncExternalStore as f } from "react";
3
3
  import { createPortal as p } from "react-dom";
4
4
  import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
5
+ function _(e, t) {
6
+ let n = !1, r = null, i = null, a = null, o = Date.now(), s = () => {
7
+ n = !0, r?.disconnect(), r = null, i !== null && clearInterval(i), i = null, document.removeEventListener("visibilitychange", l);
8
+ }, c = () => a === null ? r && Date.now() - o < 1e3 ? !1 : y(e) : a;
9
+ function l() {
10
+ n || !v(e) || !c() || (s(), t());
11
+ }
12
+ return typeof IntersectionObserver < "u" && (r = new IntersectionObserver((e) => {
13
+ let t = e[e.length - 1];
14
+ t && (a = t.isIntersecting), l();
15
+ }), r.observe(e)), l(), n ? s : (document.addEventListener("visibilitychange", l), i = setInterval(l, 200), s);
16
+ }
17
+ function v(e) {
18
+ if (!e.isConnected) return !1;
19
+ for (let t of [e, ...T(e)]) {
20
+ let e = t.ownerDocument.defaultView;
21
+ if (!e || t.ownerDocument.visibilityState === "hidden" || !w(t, e)) return !1;
22
+ }
23
+ return !0;
24
+ }
25
+ function y(e) {
26
+ let t = e, n = b(e.getBoundingClientRect());
27
+ for (;;) {
28
+ if (n = x(t, n), !n) return !1;
29
+ let e = E(t);
30
+ if (!e) return !0;
31
+ let r = e.getBoundingClientRect();
32
+ if (n = C({
33
+ left: n.left + r.left,
34
+ right: n.right + r.left,
35
+ top: n.top + r.top,
36
+ bottom: n.bottom + r.top
37
+ }, b(r)), !n) return !1;
38
+ t = e;
39
+ }
40
+ }
41
+ var b = (e) => ({
42
+ left: e.left,
43
+ top: e.top,
44
+ right: e.right,
45
+ bottom: e.bottom
46
+ });
47
+ function x(e, t) {
48
+ let n = e.ownerDocument.defaultView;
49
+ if (!n) return null;
50
+ let r = e.ownerDocument, i = S(n.getComputedStyle(r.documentElement)), a = !i.x && !i.y, o = n.getComputedStyle(e).position === "fixed", s = t;
51
+ for (let t = D(e); t && s; t = D(t)) {
52
+ if (t === r.documentElement || t === r.body && a) continue;
53
+ let e = n.getComputedStyle(t);
54
+ if (!o) {
55
+ let { x: n, y: r } = S(e);
56
+ if (n || r) {
57
+ let e = b(t.getBoundingClientRect());
58
+ s = C(s, {
59
+ left: n ? e.left : -Infinity,
60
+ right: n ? e.right : Infinity,
61
+ top: r ? e.top : -Infinity,
62
+ bottom: r ? e.bottom : Infinity
63
+ });
64
+ }
65
+ }
66
+ e.position === "fixed" && (o = !0);
67
+ }
68
+ if (!s) return null;
69
+ let c = n.innerWidth || e.ownerDocument.documentElement.clientWidth, l = n.innerHeight || e.ownerDocument.documentElement.clientHeight;
70
+ return C(s, {
71
+ left: 0,
72
+ top: 0,
73
+ right: c,
74
+ bottom: l
75
+ });
76
+ }
77
+ function S(e) {
78
+ let t = (e) => e !== "" && e !== "visible";
79
+ return {
80
+ x: t(e.overflowX || e.overflow),
81
+ y: t(e.overflowY || e.overflow)
82
+ };
83
+ }
84
+ function C(e, t) {
85
+ let n = {
86
+ left: Math.max(e.left, t.left),
87
+ top: Math.max(e.top, t.top),
88
+ right: Math.min(e.right, t.right),
89
+ bottom: Math.min(e.bottom, t.bottom)
90
+ };
91
+ return n.left <= n.right && n.top <= n.bottom ? n : null;
92
+ }
93
+ function w(e, t) {
94
+ let n = e;
95
+ if (typeof n.checkVisibility == "function") return n.checkVisibility({ visibilityProperty: !0 }) && e.offsetWidth > 0 && e.offsetHeight > 0;
96
+ if (t.getComputedStyle(e).visibility === "hidden") return !1;
97
+ for (let n = e; n; n = D(n)) if (t.getComputedStyle(n).display === "none") return !1;
98
+ return !0;
99
+ }
100
+ function T(e) {
101
+ let t = [];
102
+ for (let n = E(e); n; n = E(n)) t.push(n);
103
+ return t;
104
+ }
105
+ function E(e) {
106
+ let t = e.ownerDocument.defaultView;
107
+ if (!t || t.parent === t) return null;
108
+ try {
109
+ return t.frameElement;
110
+ } catch {
111
+ return null;
112
+ }
113
+ }
114
+ function D(e) {
115
+ if (e.parentElement) return e.parentElement;
116
+ let t = e.getRootNode();
117
+ return t !== e.ownerDocument && t.host ? t.host : null;
118
+ }
119
+ //#endregion
5
120
  //#region ../design-tokens/src/index.ts
6
- var _ = "rgba(0, 0, 0, 0)", v = (e, t = 1) => ({
121
+ var O = "rgba(0, 0, 0, 0)", k = (e, t = 1) => ({
7
122
  hex: e,
8
123
  alpha: t
9
- }), y = (e, t) => [
124
+ }), A = (e, t) => [
10
125
  {
11
126
  variable: `--sb-theme-choice-${e}-background`,
12
127
  path: [
@@ -34,7 +149,7 @@ var _ = "rgba(0, 0, 0, 0)", v = (e, t = 1) => ({
34
149
  ],
35
150
  fallback: t[2]
36
151
  }
37
- ], b = (e, t) => [
152
+ ], j = (e, t) => [
38
153
  {
39
154
  variable: `--sb-theme-button-${e}-foreground`,
40
155
  path: [
@@ -89,219 +204,219 @@ var _ = "rgba(0, 0, 0, 0)", v = (e, t = 1) => ({
89
204
  ],
90
205
  fallback: t[5]
91
206
  }
92
- ], x = [
207
+ ], M = [
93
208
  {
94
209
  variable: "--sb-theme-sheet-background",
95
210
  path: ["sheet", "background"],
96
- fallback: v("#FFFFFF")
211
+ fallback: k("#FFFFFF")
97
212
  },
98
213
  {
99
214
  variable: "--sb-theme-sheet-scrim",
100
215
  path: ["sheet", "scrim"],
101
- fallback: v("#000000", .5)
216
+ fallback: k("#000000", .5)
102
217
  },
103
218
  {
104
219
  variable: "--sb-theme-sheet-divider",
105
220
  path: ["sheet", "divider"],
106
- fallback: v("#E5E5E5")
221
+ fallback: k("#E5E5E5")
107
222
  },
108
223
  {
109
224
  variable: "--sb-theme-sheet-progress-track",
110
225
  path: ["sheet", "progressTrack"],
111
- fallback: v("#000000", .12)
226
+ fallback: k("#000000", .12)
112
227
  },
113
228
  {
114
229
  variable: "--sb-theme-sheet-progress-fill",
115
230
  path: ["sheet", "progressFill"],
116
- fallback: v("#000000")
231
+ fallback: k("#000000")
117
232
  },
118
233
  {
119
234
  variable: "--sb-theme-sheet-close-button-background",
120
235
  path: ["sheet", "closeButtonBackground"],
121
- fallback: v("#000000", 0)
236
+ fallback: k("#000000", 0)
122
237
  },
123
238
  {
124
239
  variable: "--sb-theme-sheet-close-button-foreground",
125
240
  path: ["sheet", "closeButtonForeground"],
126
- fallback: v("#000000")
241
+ fallback: k("#000000")
127
242
  },
128
243
  {
129
244
  variable: "--sb-theme-content-heading",
130
245
  path: ["content", "heading"],
131
- fallback: v("#000000")
246
+ fallback: k("#000000")
132
247
  },
133
248
  {
134
249
  variable: "--sb-theme-content-body",
135
250
  path: ["content", "body"],
136
- fallback: v("#333030")
251
+ fallback: k("#333030")
137
252
  },
138
253
  {
139
254
  variable: "--sb-theme-content-helper",
140
255
  path: ["content", "helper"],
141
- fallback: v("#5C5C5C")
256
+ fallback: k("#5C5C5C")
142
257
  },
143
258
  {
144
259
  variable: "--sb-theme-content-error",
145
260
  path: ["content", "error"],
146
- fallback: v("#B42318")
261
+ fallback: k("#B42318")
147
262
  },
148
263
  {
149
264
  variable: "--sb-theme-completion-outer-background",
150
265
  path: ["completion", "outerBackground"],
151
- fallback: v("#E8E8E8")
266
+ fallback: k("#E8E8E8")
152
267
  },
153
268
  {
154
269
  variable: "--sb-theme-completion-inner-background",
155
270
  path: ["completion", "innerBackground"],
156
- fallback: v("#000000")
271
+ fallback: k("#000000")
157
272
  },
158
273
  {
159
274
  variable: "--sb-theme-completion-glyph",
160
275
  path: ["completion", "glyph"],
161
- fallback: v("#FFFFFF")
276
+ fallback: k("#FFFFFF")
162
277
  },
163
- ...y("default", [
164
- v("#FFFFFF"),
165
- v("#000000"),
166
- v("#DBDBDB")
278
+ ...A("default", [
279
+ k("#FFFFFF"),
280
+ k("#000000"),
281
+ k("#DBDBDB")
167
282
  ]),
168
- ...y("hover", [
169
- v("#F5F5F5"),
170
- v("#000000"),
171
- v("#DBDBDB")
283
+ ...A("hover", [
284
+ k("#F5F5F5"),
285
+ k("#000000"),
286
+ k("#DBDBDB")
172
287
  ]),
173
- ...y("pressed", [
174
- v("#000000"),
175
- v("#FFFFFF"),
176
- v("#000000")
288
+ ...A("pressed", [
289
+ k("#000000"),
290
+ k("#FFFFFF"),
291
+ k("#000000")
177
292
  ]),
178
- ...y("selected", [
179
- v("#000000"),
180
- v("#FFFFFF"),
181
- v("#000000")
293
+ ...A("selected", [
294
+ k("#000000"),
295
+ k("#FFFFFF"),
296
+ k("#000000")
182
297
  ]),
183
- ...y("disabled", [
184
- v("#F2F2F2"),
185
- v("#8A8A8A"),
186
- v("#E5E5E5")
298
+ ...A("disabled", [
299
+ k("#F2F2F2"),
300
+ k("#8A8A8A"),
301
+ k("#E5E5E5")
187
302
  ]),
188
- ...b("primary", [
189
- v("#FFFFFF"),
190
- v("#121212"),
191
- v("#292929"),
192
- v("#000000"),
193
- v("#E5E5E5"),
194
- v("#8A8A8A")
303
+ ...j("primary", [
304
+ k("#FFFFFF"),
305
+ k("#121212"),
306
+ k("#292929"),
307
+ k("#000000"),
308
+ k("#E5E5E5"),
309
+ k("#8A8A8A")
195
310
  ]),
196
- ...b("secondary", [
197
- v("#000000"),
198
- v("#F2F2F2"),
199
- v("#E8E8E8"),
200
- v("#DBDBDB"),
201
- v("#E5E5E5"),
202
- v("#8A8A8A")
311
+ ...j("secondary", [
312
+ k("#000000"),
313
+ k("#F2F2F2"),
314
+ k("#E8E8E8"),
315
+ k("#DBDBDB"),
316
+ k("#E5E5E5"),
317
+ k("#8A8A8A")
203
318
  ]),
204
- ...b("tertiary", [
205
- v("#000000"),
206
- v("#FFFFFF"),
207
- v("#F5F5F5"),
208
- v("#E8E8E8"),
209
- v("#E5E5E5"),
210
- v("#8A8A8A")
319
+ ...j("tertiary", [
320
+ k("#000000"),
321
+ k("#FFFFFF"),
322
+ k("#F5F5F5"),
323
+ k("#E8E8E8"),
324
+ k("#E5E5E5"),
325
+ k("#8A8A8A")
211
326
  ]),
212
327
  {
213
328
  variable: "--sb-theme-input-background",
214
329
  path: ["input", "background"],
215
- fallback: v("#FFFFFF")
330
+ fallback: k("#FFFFFF")
216
331
  },
217
332
  {
218
333
  variable: "--sb-theme-input-foreground",
219
334
  path: ["input", "foreground"],
220
- fallback: v("#000000")
335
+ fallback: k("#000000")
221
336
  },
222
337
  {
223
338
  variable: "--sb-theme-input-placeholder",
224
339
  path: ["input", "placeholder"],
225
- fallback: v("#000000", .4)
340
+ fallback: k("#000000", .4)
226
341
  },
227
342
  {
228
343
  variable: "--sb-theme-input-border",
229
344
  path: ["input", "border"],
230
- fallback: v("#000000", .18)
345
+ fallback: k("#000000", .18)
231
346
  },
232
347
  {
233
348
  variable: "--sb-theme-input-focused-border",
234
349
  path: ["input", "focusedBorder"],
235
- fallback: v("#000000", .7)
350
+ fallback: k("#000000", .7)
236
351
  },
237
352
  {
238
353
  variable: "--sb-theme-input-error-border",
239
354
  path: ["input", "errorBorder"],
240
- fallback: v("#B42318")
355
+ fallback: k("#B42318")
241
356
  },
242
357
  {
243
358
  variable: "--sb-theme-input-disabled-background",
244
359
  path: ["input", "disabledBackground"],
245
- fallback: v("#F2F2F2")
360
+ fallback: k("#F2F2F2")
246
361
  },
247
362
  {
248
363
  variable: "--sb-theme-input-disabled-foreground",
249
364
  path: ["input", "disabledForeground"],
250
- fallback: v("#8A8A8A")
365
+ fallback: k("#8A8A8A")
251
366
  },
252
367
  {
253
368
  variable: "--sb-theme-fab-background",
254
369
  path: ["fab", "background"],
255
- fallback: v("#000000")
370
+ fallback: k("#000000")
256
371
  },
257
372
  {
258
373
  variable: "--sb-theme-fab-foreground",
259
374
  path: ["fab", "foreground"],
260
- fallback: v("#FFFFFF")
375
+ fallback: k("#FFFFFF")
261
376
  },
262
377
  {
263
378
  variable: "--sb-theme-fab-border",
264
379
  path: ["fab", "border"],
265
- fallback: v("#FFFFFF", .15)
380
+ fallback: k("#FFFFFF", .15)
266
381
  },
267
382
  {
268
383
  variable: "--sb-theme-fab-accent-primary",
269
384
  path: ["fab", "accentPrimary"],
270
- fallback: v("#000000")
385
+ fallback: k("#000000")
271
386
  },
272
387
  {
273
388
  variable: "--sb-theme-fab-accent-secondary",
274
389
  path: ["fab", "accentSecondary"],
275
- fallback: v("#FFFFFF")
390
+ fallback: k("#FFFFFF")
276
391
  },
277
392
  {
278
393
  variable: "--sb-theme-fab-timer-track",
279
394
  path: ["fab", "timerTrack"],
280
- fallback: v("#000000", .16)
395
+ fallback: k("#000000", .16)
281
396
  },
282
397
  {
283
398
  variable: "--sb-theme-fab-timer-fill",
284
399
  path: ["fab", "timerFill"],
285
- fallback: v("#000000")
400
+ fallback: k("#000000")
286
401
  }
287
402
  ];
288
- x.map((e) => e.variable), Object.fromEntries(x.map((e) => [e.variable, C(e.fallback)]));
289
- function S(e) {
403
+ M.map((e) => e.variable), Object.fromEntries(M.map((e) => [e.variable, P(e.fallback)]));
404
+ function N(e) {
290
405
  return e && typeof e == "object" && !Array.isArray(e) ? e : {};
291
406
  }
292
- function C(e, t = _) {
407
+ function P(e, t = O) {
293
408
  return !e || typeof e.hex != "string" || !/^#[0-9a-fA-F]{6}$/.test(e.hex) || !Number.isFinite(e.alpha) || e.alpha < 0 || e.alpha > 1 ? t : `rgba(${Number.parseInt(e.hex.slice(1, 3), 16)}, ${Number.parseInt(e.hex.slice(3, 5), 16)}, ${Number.parseInt(e.hex.slice(5, 7), 16)}, ${e.alpha})`;
294
409
  }
295
- function w(e, t) {
410
+ function F(e, t) {
296
411
  let n = e;
297
- for (let e of t) n = S(n)[e];
412
+ for (let e of t) n = N(n)[e];
298
413
  return n;
299
414
  }
300
- function T(e) {
301
- return Object.fromEntries(x.map((t) => [t.variable, C(w(e, t.path), C(t.fallback))]));
415
+ function I(e) {
416
+ return Object.fromEntries(M.map((t) => [t.variable, P(F(e, t.path), P(t.fallback))]));
302
417
  }
303
- function E(e, t) {
304
- return v(`#${[
418
+ function L(e, t) {
419
+ return k(`#${[
305
420
  1,
306
421
  3,
307
422
  5
@@ -312,8 +427,8 @@ function E(e, t) {
312
427
  }
313
428
  function ee(e) {
314
429
  let t = (t) => {
315
- let n = x.find((e) => e.path.join(".") === t.join(".")), r = w(e, t);
316
- return C(r, "") ? r : n.fallback;
430
+ let n = M.find((e) => e.path.join(".") === t.join(".")), r = F(e, t);
431
+ return P(r, "") ? r : n.fallback;
317
432
  }, n = {
318
433
  ...t(["sheet", "background"]),
319
434
  alpha: 1
@@ -321,14 +436,14 @@ function ee(e) {
321
436
  "choice",
322
437
  "selected",
323
438
  "background"
324
- ]), a = E(i, n), o = [
439
+ ]), a = L(i, n), o = [
325
440
  1,
326
441
  3,
327
442
  5
328
- ].map((e) => Number.parseInt(n.hex.slice(e, e + 2), 16) / 255), s = o[0] * .2126 + o[1] * .7152 + o[2] * .0722 < .5, c = n.hex.toUpperCase() === (s ? "#000000" : "#FFFFFF"), l = (e, t) => C(E({
443
+ ].map((e) => Number.parseInt(n.hex.slice(e, e + 2), 16) / 255), s = o[0] * .2126 + o[1] * .7152 + o[2] * .0722 < .5, c = n.hex.toUpperCase() === (s ? "#000000" : "#FFFFFF"), l = (e, t) => P(L({
329
444
  ...e,
330
445
  alpha: e.alpha * t
331
- }, n)), u = E({
446
+ }, n)), u = L({
332
447
  ...r,
333
448
  alpha: r.alpha * (s ? c ? .15 : .08 : .14)
334
449
  }, n), d = (e) => [
@@ -341,37 +456,41 @@ function ee(e) {
341
456
  .0722
342
457
  ][r], 0), f = d(u) > d(n);
343
458
  return {
344
- "--sb-snackbar-surface": C(n),
345
- "--sb-snackbar-text": C(r),
346
- "--sb-snackbar-border": C(v(s ? "#FFFFFF" : "#000000", s ? .1 : .05)),
459
+ "--sb-snackbar-surface": P(n),
460
+ "--sb-snackbar-text": P(r),
461
+ "--sb-snackbar-border": P(k(s ? "#FFFFFF" : "#000000", s ? .1 : .05)),
347
462
  "--sb-snackbar-normal": l(r, s ? c ? .2 : .14 : c ? .08 : .1),
348
463
  "--sb-snackbar-hover": l(r, s ? c ? .24 : .18 : .04),
349
464
  "--sb-snackbar-pressed": l(i, s ? c ? .28 : .24 : .2),
350
- "--sb-snackbar-active": C(a),
351
- "--sb-snackbar-on-active": C(t([
465
+ "--sb-snackbar-active": P(a),
466
+ "--sb-snackbar-on-active": P(t([
352
467
  "choice",
353
468
  "selected",
354
469
  "foreground"
355
470
  ])),
356
- "--sb-snackbar-ghost": C(u),
357
- "--sb-snackbar-remaining": C(f ? u : n),
358
- "--sb-snackbar-elapsed": C(f ? n : u)
471
+ "--sb-snackbar-ghost": P(u),
472
+ "--sb-snackbar-remaining": P(f ? u : n),
473
+ "--sb-snackbar-elapsed": P(f ? n : u)
359
474
  };
360
475
  }
361
- var D = {
476
+ var R = {
477
+ visible: 185.84,
362
478
  entrance: 1969.207,
363
479
  timerEntrance: 2169.207,
364
480
  widen: 200,
365
481
  expand: 450
366
- }, O = {
482
+ }, z = {
367
483
  delay: 400,
368
484
  enter: 450,
369
485
  exit: 400,
370
486
  removal: 450,
371
487
  reduced: 150
372
- }, te = O.delay + O.enter;
373
- function k(e, t) {
374
- let { viewport: n, safeArea: r = {}, compactHeight: i } = t, a = M(r.left) + 12, o = M(r.right) + 12, s = M(r.top) + 24, c = M(r.bottom) + 8, l = Math.max(0, n.width - a - o), u = Math.min(364, l), d = Math.min(376, l), f = Math.max(0, n.height - s - c), p = Math.min(t.cardHeight, f);
488
+ }, te = z.delay + z.enter;
489
+ function ne(e, t) {
490
+ return t ? 0 : e ? z.delay : R.visible;
491
+ }
492
+ function re(e, t) {
493
+ let { viewport: n, safeArea: r = {}, compactHeight: i } = t, a = H(r.left) + 12, o = H(r.right) + 12, s = H(r.top) + 24, c = H(r.bottom) + 8, l = Math.max(0, n.width - a - o), u = Math.min(364, l), d = Math.min(376, l), f = Math.max(0, n.height - s - c), p = Math.min(t.cardHeight, f);
375
494
  if (t.barPosition) return {
376
495
  compactWidth: n.width,
377
496
  compactLeft: 0,
@@ -381,11 +500,11 @@ function k(e, t) {
381
500
  maxCardHeight: f,
382
501
  cardLeft: a + (l - d) / 2,
383
502
  cardBottom: c,
384
- cardTop: M(r.top) + 12,
503
+ cardTop: H(r.top) + 12,
385
504
  entranceOffset: 0,
386
505
  transformOrigin: t.barPosition === "top" ? "50% 0%" : "50% 100%"
387
506
  };
388
- let m = F(e, {
507
+ let m = G(e, {
389
508
  viewport: n,
390
509
  element: {
391
510
  width: u,
@@ -401,34 +520,34 @@ function k(e, t) {
401
520
  cardHeight: p,
402
521
  maxCardHeight: f,
403
522
  cardTop: 0,
404
- entranceOffset: (u - i) * P(e?.anchor).x,
523
+ entranceOffset: (u - i) * W(e?.anchor).x,
405
524
  cardLeft: a + (l - d) / 2,
406
525
  cardBottom: Math.max(c, Math.min(g, n.height - s - p)),
407
526
  transformOrigin: m.transformOrigin
408
527
  };
409
528
  }
410
- var A = {
529
+ var B = {
411
530
  x: 1,
412
531
  y: 1
413
- }, j = {
532
+ }, V = {
414
533
  x: -16,
415
534
  y: -24
416
535
  };
417
- function M(e) {
536
+ function H(e) {
418
537
  return typeof e == "number" && Number.isFinite(e) ? Math.max(0, e) : 0;
419
538
  }
420
- function N(e) {
539
+ function U(e) {
421
540
  return typeof e == "number" && Number.isFinite(e) ? e : 0;
422
541
  }
423
- function P(e) {
424
- let t = S(e), n = typeof t.x == "number" && Number.isFinite(t.x) ? t.x : A.x, r = typeof t.y == "number" && Number.isFinite(t.y) ? t.y : A.y;
542
+ function W(e) {
543
+ let t = N(e), n = typeof t.x == "number" && Number.isFinite(t.x) ? t.x : B.x, r = typeof t.y == "number" && Number.isFinite(t.y) ? t.y : B.y;
425
544
  return {
426
545
  x: Math.min(1, Math.max(0, n)),
427
546
  y: Math.min(1, Math.max(0, r))
428
547
  };
429
548
  }
430
- function F(e, t) {
431
- let n = S(e), r = P(n.position), i = P(n.anchor), a = S(n.offset), o = e ? N(a.x) : j.x, s = e ? N(a.y) : j.y, c = t.safeArea ?? {}, l = M(c.left), u = M(c.right), d = M(c.top), f = M(c.bottom), p = Math.max(0, M(t.viewport.width) - l - u - M(t.element.width)), m = Math.max(0, M(t.viewport.height) - d - f - M(t.element.height));
549
+ function G(e, t) {
550
+ let n = N(e), r = W(n.position), i = W(n.anchor), a = N(n.offset), o = e ? U(a.x) : V.x, s = e ? U(a.y) : V.y, c = t.safeArea ?? {}, l = H(c.left), u = H(c.right), d = H(c.top), f = H(c.bottom), p = Math.max(0, H(t.viewport.width) - l - u - H(t.element.width)), m = Math.max(0, H(t.viewport.height) - d - f - H(t.element.height));
432
551
  return {
433
552
  left: l + r.x * p + o,
434
553
  top: d + r.y * m + s,
@@ -439,7 +558,7 @@ function F(e, t) {
439
558
  transformOrigin: `${i.x * 100}% ${i.y * 100}%`
440
559
  };
441
560
  }
442
- function I(e, t, n = "forward") {
561
+ function K(e, t, n = "forward") {
443
562
  let r = e === "bar" || e === "fill" ? e : "none", i = n === "reverse" ? "reverse" : "forward", a = typeof t == "number" && Number.isFinite(t) && t > 0 ? t : null;
444
563
  return {
445
564
  style: r,
@@ -455,8 +574,8 @@ function I(e, t, n = "forward") {
455
574
  }
456
575
  //#endregion
457
576
  //#region src/lib/components/SurveyFab.tsx
458
- function L({ session: t, fabRef: n, onClick: r, animationState: i }) {
459
- let { survey: a } = t, o = I(a.fab?.timerStyle, a.fab?.expandedTimeout), s = { ...o.cssVariables }, c = a.fab?.imageUrl, [l, u] = d(null), f = !!(c && l !== c);
577
+ function ie({ session: t, fabRef: n, onClick: r, animationState: i }) {
578
+ let { survey: a } = t, o = K(a.fab?.timerStyle, a.fab?.expandedTimeout), s = { ...o.cssVariables }, c = a.fab?.imageUrl, [l, u] = d(null), f = !!(c && l !== c);
460
579
  return /* @__PURE__ */ g("button", {
461
580
  ref: n,
462
581
  type: "button",
@@ -502,7 +621,7 @@ function L({ session: t, fabRef: n, onClick: r, animationState: i }) {
502
621
  }
503
622
  //#endregion
504
623
  //#region src/lib/components/SurveyProgress.tsx
505
- function R({ value: e }) {
624
+ function ae({ value: e }) {
506
625
  return /* @__PURE__ */ h("div", {
507
626
  className: "sb-progress",
508
627
  "aria-hidden": "true",
@@ -514,8 +633,8 @@ function R({ value: e }) {
514
633
  }
515
634
  //#endregion
516
635
  //#region src/lib/components/SurveyQuestionView.tsx
517
- var z = [];
518
- function B() {
636
+ var oe = [];
637
+ function q() {
519
638
  return /* @__PURE__ */ h("svg", {
520
639
  viewBox: "0 0 35.5556 35.5556",
521
640
  "aria-hidden": "true",
@@ -525,7 +644,7 @@ function B() {
525
644
  })
526
645
  });
527
646
  }
528
- function V() {
647
+ function J() {
529
648
  return /* @__PURE__ */ h("svg", {
530
649
  viewBox: "0 0 35.5556 35.5556",
531
650
  "aria-hidden": "true",
@@ -535,7 +654,7 @@ function V() {
535
654
  })
536
655
  });
537
656
  }
538
- function H() {
657
+ function se() {
539
658
  return /* @__PURE__ */ h("span", {
540
659
  className: "sb-spark-ring",
541
660
  "aria-hidden": "true",
@@ -545,23 +664,23 @@ function H() {
545
664
  }, t))
546
665
  });
547
666
  }
548
- function U({ question: e, store: t, isSentiment: n }) {
667
+ function ce({ question: e, store: t, isSentiment: n }) {
549
668
  let i = t.currentDraft(), a = t.getState(), o = !!(a?.isBusy || a?.isCompleting), s = e.answers?.find((e) => e.id === i?.answer_key);
550
- return s && r(s) ? /* @__PURE__ */ h(G, {
669
+ return s && r(s) ? /* @__PURE__ */ h(fe, {
551
670
  store: t,
552
671
  disabled: o,
553
672
  placeholder: s.label,
554
673
  autoFocus: !0,
555
674
  ariaLabel: "Other response",
556
675
  isOther: !0
557
- }) : n ? /* @__PURE__ */ h(W, {
676
+ }) : n ? /* @__PURE__ */ h(le, {
558
677
  store: t,
559
678
  disabled: o || !!a?.sentimentSelectionLocked
560
- }) : e.type === "yes_no" || e.type === "multiple_choice" ? /* @__PURE__ */ h(ne, {
679
+ }) : e.type === "yes_no" || e.type === "multiple_choice" ? /* @__PURE__ */ h(ue, {
561
680
  question: e,
562
681
  store: t,
563
682
  disabled: o
564
- }) : /* @__PURE__ */ h(G, {
683
+ }) : /* @__PURE__ */ h(fe, {
565
684
  store: t,
566
685
  disabled: o,
567
686
  placeholder: e.free_text_placeholder ?? "Please explain more... (Optional)",
@@ -569,7 +688,7 @@ function U({ question: e, store: t, isSentiment: n }) {
569
688
  ariaLabel: e.prompt
570
689
  });
571
690
  }
572
- function W({ store: e, disabled: t }) {
691
+ function le({ store: e, disabled: t }) {
573
692
  let r = e.currentDraft();
574
693
  return /* @__PURE__ */ h("div", {
575
694
  className: "sb-question sb-question--sentiment",
@@ -577,7 +696,7 @@ function W({ store: e, disabled: t }) {
577
696
  let a = n(i), o = r?.answer_key === i.id;
578
697
  return /* @__PURE__ */ g("span", {
579
698
  className: "sb-sentiment-control",
580
- children: [o && a ? /* @__PURE__ */ h(H, {}) : null, /* @__PURE__ */ h("button", {
699
+ children: [o && a ? /* @__PURE__ */ h(se, {}) : null, /* @__PURE__ */ h("button", {
581
700
  type: "button",
582
701
  className: `sb-yesno ${o ? "sb-yesno--selected" : ""}`,
583
702
  "data-choice-value": i.id,
@@ -587,15 +706,15 @@ function W({ store: e, disabled: t }) {
587
706
  "aria-pressed": o,
588
707
  children: /* @__PURE__ */ h("span", {
589
708
  className: "sb-yesno__icon",
590
- children: h(a ? B : V, {})
709
+ children: h(a ? q : J, {})
591
710
  })
592
711
  })]
593
712
  }, i.id);
594
713
  })
595
714
  });
596
715
  }
597
- function ne({ question: e, store: t, disabled: n }) {
598
- let i = e.answers ?? z, a = t.currentDraft(), o = u(null), [c, l] = d(() => i.every((e) => e.label.trim().length < 20));
716
+ function ue({ question: e, store: t, disabled: n }) {
717
+ let i = e.answers ?? oe, a = t.currentDraft(), o = u(null), [c, l] = d(() => i.every((e) => e.label.trim().length < 20));
599
718
  return s(() => {
600
719
  let e = () => {
601
720
  let e = ((o.current?.clientWidth || 328) - 8) / 2, t = document.createElement("span");
@@ -617,7 +736,7 @@ function ne({ question: e, store: t, disabled: n }) {
617
736
  className: `sb-question sb-question--choices ${c ? "sb-question--choices-grid" : "sb-question--choices-list"}`,
618
737
  children: /* @__PURE__ */ h("div", {
619
738
  className: `sb-options-scroll ${(c ? Math.ceil(i.length / 2) : i.length) >= 5 ? "sb-options-scroll--scrolling" : ""}`,
620
- children: i.map((e) => /* @__PURE__ */ h(re, {
739
+ children: i.map((e) => /* @__PURE__ */ h(de, {
621
740
  choice: e,
622
741
  selected: a?.answer_key === e.id,
623
742
  disabled: n,
@@ -626,7 +745,7 @@ function ne({ question: e, store: t, disabled: n }) {
626
745
  })
627
746
  });
628
747
  }
629
- function re({ choice: e, selected: n, disabled: i, store: a }) {
748
+ function de({ choice: e, selected: n, disabled: i, store: a }) {
630
749
  let o = r(e);
631
750
  return /* @__PURE__ */ h("button", {
632
751
  type: "button",
@@ -649,7 +768,7 @@ function re({ choice: e, selected: n, disabled: i, store: a }) {
649
768
  })
650
769
  });
651
770
  }
652
- function G({ store: e, disabled: t, placeholder: n, autoFocus: r, ariaLabel: i, isOther: a = !1 }) {
771
+ function fe({ store: e, disabled: t, placeholder: n, autoFocus: r, ariaLabel: i, isOther: a = !1 }) {
653
772
  let o = u(null);
654
773
  return s(() => {
655
774
  r && !t && o.current?.focus({ preventScroll: !0 });
@@ -673,7 +792,7 @@ function G({ store: e, disabled: t, placeholder: n, autoFocus: r, ariaLabel: i,
673
792
  }
674
793
  //#endregion
675
794
  //#region src/lib/components/SurveyThankYou.tsx
676
- function ie({ completion: e, store: t, isBusy: n, headingId: r, bodyId: i }) {
795
+ function pe({ completion: e, store: t, isBusy: n, headingId: r, bodyId: i }) {
677
796
  let a = u(null), [o, c] = d(!1);
678
797
  return s(() => {
679
798
  let e = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1, t = setTimeout(() => c(!0), e ? 0 : 890);
@@ -726,7 +845,7 @@ function ie({ completion: e, store: t, isBusy: n, headingId: r, bodyId: i }) {
726
845
  }
727
846
  //#endregion
728
847
  //#region src/lib/components/SurveySheet.tsx
729
- var K = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i = !0 }) {
848
+ var me = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i = !0 }) {
730
849
  let a = e.currentNodeId ? e.survey.questions[e.currentNodeId] : void 0, o = !!(a && t.isSentimentStep()), l = a?.answers?.find((e) => e.id === t.currentDraft()?.answer_key), d = l?.comment?.trim() || null, f = l?.id === "system_other", p = u(null), _ = c();
731
850
  s(() => {
732
851
  if (!i) return;
@@ -765,7 +884,7 @@ var K = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i
765
884
  "aria-labelledby": v,
766
885
  "aria-describedby": e.completion?.body ? y : void 0,
767
886
  "aria-busy": e.isCompleting || void 0,
768
- children: e.completion ? /* @__PURE__ */ h(ie, {
887
+ children: e.completion ? /* @__PURE__ */ h(pe, {
769
888
  completion: e.completion,
770
889
  store: t,
771
890
  isBusy: e.isBusy,
@@ -773,7 +892,7 @@ var K = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i
773
892
  bodyId: y
774
893
  }) : a ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("div", {
775
894
  className: "sb-sheet__header",
776
- children: [o ? null : /* @__PURE__ */ h(R, { value: t.progress() }), /* @__PURE__ */ h("button", {
895
+ children: [o ? null : /* @__PURE__ */ h(ae, { value: t.progress() }), /* @__PURE__ */ h("button", {
777
896
  type: "button",
778
897
  className: "sb-sheet__close",
779
898
  onClick: () => void t.closeSurvey(),
@@ -794,7 +913,7 @@ var K = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i
794
913
  "aria-live": o && d ? "polite" : void 0,
795
914
  children: o && d ? d : a.prompt
796
915
  })]
797
- }), /* @__PURE__ */ h(U, {
916
+ }), /* @__PURE__ */ h(ce, {
798
917
  question: a,
799
918
  store: t,
800
919
  isSentiment: o
@@ -824,39 +943,52 @@ var K = a(function({ session: e, store: t, modal: n, rootRef: r, interactive: i
824
943
  }, `${a.node_id}:${f ? "text" : "options"}`)] }) : null
825
944
  })]
826
945
  });
827
- }), ae = typeof window > "u" ? s : l, q = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
828
- function oe({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
829
- let c = u(null), [l, f] = d("entering"), { presentationId: p, survey: _, snackbar: v, isOpen: y } = e, b = e.sentimentPresentation === "bar", x = b ? e.barPosition : void 0, S = o ? "exiting" : y && (l === "entering" || l === "compact") ? "widening" : l, C = _.questions[_.root_node_id], w = i(C, _.fab), T = _.fab?.timerStyle ?? "none", E = b && e.barBehavior === "dismiss" && v?.selectedKey != null, [A, j] = d(!1);
946
+ }), he = typeof window > "u" ? s : l, Y = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
947
+ function ge(e, t, n, r) {
948
+ t.current === r || document.visibilityState === "hidden" || (t.current = r, n.current?.(), n.current = null, e.confirmPresentation("expanded_fab", r));
949
+ }
950
+ function _e({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
951
+ let c = u(null), l = u(null), f = u(null), [p, v] = d("entering"), { presentationId: y, survey: b, snackbar: x, isOpen: S } = e, C = e.sentimentPresentation === "bar", w = C ? e.barPosition : void 0, T = o ? "exiting" : S && (p === "entering" || p === "compact") ? "widening" : p, E = b.questions[b.root_node_id], D = i(E, b.fab), O = b.fab?.timerStyle ?? "none", k = C && e.barBehavior === "dismiss" && x?.selectedKey != null, [A, j] = d(!1);
830
952
  s(() => {
831
953
  if (o) return;
832
- let e = setTimeout(() => {
833
- f("compact"), t.confirmPresentation("expanded_fab", p), t.confirmFabEntranceCompleted(p), b && c.current?.querySelector(".sb-snackbar-surface")?.matches(":hover") && window.matchMedia?.("(hover: hover)").matches && t.setBarTimerPaused(p, !0);
834
- }, b ? q() ? O.reduced : te : q() ? 0 : T === "none" ? D.entrance : D.timerEntrance);
835
- return () => clearTimeout(e);
954
+ let e = c.current?.querySelector(".sb-snackbar-surface"), n = () => {
955
+ l.current === y || f.current || !e || (f.current = _(e, () => {
956
+ f.current = null, l.current = y, t.confirmPresentation("expanded_fab", y);
957
+ }));
958
+ }, r = setTimeout(n, ne(C, Y())), i = setTimeout(() => {
959
+ v("compact"), t.confirmEntryDisplayed(y), t.confirmFabEntranceCompleted(y), n(), C && e?.matches(":hover") && window.matchMedia?.("(hover: hover)").matches && t.setBarTimerPaused(y, !0);
960
+ }, C ? Y() ? z.reduced : te : Y() ? 0 : O === "none" ? R.entrance : R.timerEntrance);
961
+ return () => {
962
+ clearTimeout(r), clearTimeout(i), f.current?.(), f.current = null;
963
+ };
836
964
  }, [
837
- p,
965
+ y,
838
966
  t,
839
- T,
840
- b,
967
+ O,
968
+ C,
841
969
  o
842
- ]), s(() => {
843
- if (!y || o) return;
844
- let e = q(), n = setTimeout(() => f("expanding"), e ? 0 : D.widen), r = setTimeout(() => {
845
- f("ready"), t.confirmPresentation("sheet", p), t.confirmSnackbarContentReady(p), c.current?.querySelector(".sb-sheet h2")?.focus({ preventScroll: !0 });
846
- }, e ? 0 : D.widen + D.expand);
970
+ ]);
971
+ let M = () => ge(t, l, f, y), N = () => {
972
+ M(), t.closeSurvey();
973
+ };
974
+ s(() => {
975
+ if (!S || o) return;
976
+ let e = Y(), n = setTimeout(() => v("expanding"), e ? 0 : R.widen), r = setTimeout(() => {
977
+ v("ready"), t.confirmPresentation("sheet", y), t.confirmSnackbarContentReady(y), c.current?.querySelector(".sb-sheet h2")?.focus({ preventScroll: !0 });
978
+ }, e ? 0 : R.widen + R.expand);
847
979
  return () => {
848
980
  clearTimeout(n), clearTimeout(r);
849
981
  };
850
982
  }, [
983
+ S,
851
984
  y,
852
- p,
853
985
  t,
854
986
  o
855
- ]), ae(() => {
987
+ ]), he(() => {
856
988
  let e = c.current;
857
989
  if (!e || o) return;
858
990
  let t = () => {
859
- let t = e.parentElement, n = window.visualViewport, a = r === "inline" ? t.clientWidth : n?.width || window.innerWidth, o = r === "inline" ? t.clientHeight : n?.height || window.innerHeight, s = t.querySelector(".sb-safe-area-probe"), c = s ? getComputedStyle(s) : null, l = (e) => Number.parseFloat(e ?? "") || 0, u = e.querySelector(".sb-snackbar-compact"), d = e.querySelector(".sb-sheet"), f = i(C, _.fab).placement, p = {
991
+ let t = e.parentElement, n = window.visualViewport, a = r === "inline" ? t.clientWidth : n?.width || window.innerWidth, o = r === "inline" ? t.clientHeight : n?.height || window.innerHeight, s = t.querySelector(".sb-safe-area-probe"), c = s ? getComputedStyle(s) : null, l = (e) => Number.parseFloat(e ?? "") || 0, u = e.querySelector(".sb-snackbar-compact"), d = e.querySelector(".sb-sheet"), f = i(E, b.fab).placement, p = {
860
992
  viewport: {
861
993
  width: a,
862
994
  height: o
@@ -869,31 +1001,31 @@ function oe({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
869
1001
  },
870
1002
  compactHeight: 64,
871
1003
  cardHeight: d?.offsetHeight || 0,
872
- barPosition: x
1004
+ barPosition: w
873
1005
  };
874
- e.style.setProperty("--sb-snackbar-compact-width", `${k(f, p).compactWidth}px`), E && (u.style.minHeight = "48px");
875
- let m = getComputedStyle(u), h = Number.parseFloat(m.height) || u.offsetHeight || (x ? 48 : 64), g = E ? Math.max(h, (e.querySelector(".sb-bar-acknowledgement-copy")?.scrollHeight ?? 0) + l(m.paddingTop) + l(m.paddingBottom)) : h;
876
- E && u.style.removeProperty("min-height");
877
- let v = k(f, {
1006
+ e.style.setProperty("--sb-snackbar-compact-width", `${re(f, p).compactWidth}px`), k && (u.style.minHeight = "48px");
1007
+ let m = getComputedStyle(u), h = Number.parseFloat(m.height) || u.offsetHeight || (w ? 48 : 64), g = k ? Math.max(h, (e.querySelector(".sb-bar-acknowledgement-copy")?.scrollHeight ?? 0) + l(m.paddingTop) + l(m.paddingBottom)) : h;
1008
+ k && u.style.removeProperty("min-height");
1009
+ let _ = re(f, {
878
1010
  ...p,
879
1011
  compactHeight: g
880
1012
  });
881
1013
  r === "fixed" ? (e.style.left = `${n?.offsetLeft ?? 0}px`, e.style.top = `${n?.offsetTop ?? 0}px`, e.style.width = `${a}px`, e.style.height = `${o}px`) : (e.style.left = "0px", e.style.top = "0px", e.style.width = "100%", e.style.height = "100%");
882
- let y = S === "widening" || S === "expanding" || S === "ready";
883
- e.style.setProperty("--sb-bar-top", `${y ? v.cardTop : 0}px`);
884
- let b = S === "expanding" || S === "ready", w = {
885
- left: y ? v.cardLeft : v.compactLeft,
886
- bottom: y ? v.cardBottom : v.compactBottom,
887
- width: y ? v.cardWidth : v.compactWidth,
888
- height: b ? v.cardHeight : g,
1014
+ let v = T === "widening" || T === "expanding" || T === "ready";
1015
+ e.style.setProperty("--sb-bar-top", `${v ? _.cardTop : 0}px`);
1016
+ let y = T === "expanding" || T === "ready", x = {
1017
+ left: v ? _.cardLeft : _.compactLeft,
1018
+ bottom: v ? _.cardBottom : _.compactBottom,
1019
+ width: v ? _.cardWidth : _.compactWidth,
1020
+ height: y ? _.cardHeight : g,
889
1021
  "compact-height": g,
890
- "card-width": v.cardWidth,
891
- "compact-width": v.compactWidth,
892
- "entrance-offset": v.entranceOffset,
893
- "max-height": v.maxCardHeight
1022
+ "card-width": _.cardWidth,
1023
+ "compact-width": _.compactWidth,
1024
+ "entrance-offset": _.entranceOffset,
1025
+ "max-height": _.maxCardHeight
894
1026
  };
895
- for (let [t, n] of Object.entries(w)) e.style.setProperty(`--sb-snackbar-${t}`, `${n}px`);
896
- e.querySelector(".sb-snackbar-shell").style.transformOrigin = v.transformOrigin;
1027
+ for (let [t, n] of Object.entries(x)) e.style.setProperty(`--sb-snackbar-${t}`, `${n}px`);
1028
+ e.querySelector(".sb-snackbar-shell").style.transformOrigin = _.transformOrigin;
897
1029
  };
898
1030
  t();
899
1031
  let n = typeof ResizeObserver > "u" ? null : new ResizeObserver(t), a = e.querySelector(".sb-snackbar-compact");
@@ -904,88 +1036,91 @@ function oe({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
904
1036
  };
905
1037
  }, [
906
1038
  r,
1039
+ T,
1040
+ b,
1041
+ E,
907
1042
  S,
908
- _,
909
- C,
910
- y,
911
- x,
1043
+ w,
912
1044
  o,
913
- E
1045
+ k
914
1046
  ]), s(() => {
915
- if (y || o) return;
1047
+ if (S || o) return;
916
1048
  let e = (e) => {
917
- e.key === "Escape" && c.current?.contains(document.activeElement) && t.closeSurvey();
1049
+ e.key === "Escape" && c.current?.contains(document.activeElement) && (ge(t, l, f, y), t.closeSurvey());
918
1050
  };
919
1051
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
920
1052
  }, [
921
- y,
1053
+ S,
922
1054
  t,
923
- o
1055
+ o,
1056
+ y
924
1057
  ]);
925
- let M = v?.selectedKey, N = b && e.barBehavior === "dismiss", P = C.answers?.find((e) => e.id === M), F = P ? P.comment?.trim() || "Thanks for your feedback." : "", I = E, L = !o && e.fabEntranceCompleted && v?.phase === "question", R = v?.deadline != null || v?.pausedRemainingMs != null, z = T !== "none" && typeof _.fab?.expandedTimeout == "number" && _.fab.expandedTimeout > 0, H = {
926
- ...ee(_.theme),
927
- "--sb-snackbar-duration": `${_.fab?.expandedTimeout ?? 0}ms`,
928
- "--sb-snackbar-fraction": v?.frozenFraction ?? 1
929
- }, U = T === "none" ? null : /* @__PURE__ */ h("span", {
930
- className: `sb-snackbar-timer sb-snackbar-timer--${T}`,
1058
+ let P = x?.selectedKey, F = C && e.barBehavior === "dismiss", I = E.answers?.find((e) => e.id === P), L = I ? I.comment?.trim() || "Thanks for your feedback." : "", B = k, V = !o && e.fabEntranceCompleted && x?.phase === "question", H = x?.deadline != null || x?.pausedRemainingMs != null, U = O !== "none" && typeof b.fab?.expandedTimeout == "number" && b.fab.expandedTimeout > 0, W = {
1059
+ ...ee(b.theme),
1060
+ "--sb-snackbar-duration": `${b.fab?.expandedTimeout ?? 0}ms`,
1061
+ "--sb-snackbar-fraction": x?.frozenFraction ?? 1
1062
+ }, G = O === "none" ? null : /* @__PURE__ */ h("span", {
1063
+ className: `sb-snackbar-timer sb-snackbar-timer--${O}`,
931
1064
  "aria-hidden": "true",
932
1065
  children: /* @__PURE__ */ h("span", { className: "sb-snackbar-timer-fill" })
933
- }), W = /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("p", {
1066
+ }), K = /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("p", {
934
1067
  className: "sb-snackbar-prompt",
935
- children: [C.prompt, T === "bar" && !b ? U : null]
1068
+ children: [E.prompt, O === "bar" && !C ? G : null]
936
1069
  }), /* @__PURE__ */ h("div", {
937
1070
  className: "sb-snackbar-answers",
938
- children: (C.answers ?? []).map((e) => /* @__PURE__ */ h("button", {
1071
+ children: (E.answers ?? []).map((e) => /* @__PURE__ */ h("button", {
939
1072
  className: "sb-snackbar-answer",
940
1073
  type: "button",
941
1074
  "aria-label": e.label,
942
- "aria-pressed": M === e.id,
943
- disabled: !L,
944
- onClick: () => t.answerSnackbar(p, e.id),
945
- children: n(e) ? /* @__PURE__ */ h(B, {}) : /* @__PURE__ */ h(V, {})
1075
+ "aria-pressed": P === e.id,
1076
+ disabled: !V,
1077
+ onClick: () => {
1078
+ M(), t.answerSnackbar(y, e.id);
1079
+ },
1080
+ children: n(e) ? /* @__PURE__ */ h(q, {}) : /* @__PURE__ */ h(J, {})
946
1081
  }, e.id))
947
1082
  })] });
948
1083
  return /* @__PURE__ */ g("div", {
949
1084
  ref: c,
950
1085
  className: "sb-snackbar-root",
951
- style: H,
1086
+ style: W,
952
1087
  "data-presentation": e.sentimentPresentation,
953
- "data-position": x,
1088
+ "data-position": w,
954
1089
  "data-behavior": e.barBehavior,
955
- "data-stage": S,
956
- "data-expanded": y,
957
- "data-counting": R,
958
- "data-paused": v?.pausedRemainingMs != null,
959
- "data-timed": z,
960
- "data-rated": I,
1090
+ "data-stage": T,
1091
+ "data-expanded": S,
1092
+ "data-counting": H,
1093
+ "data-paused": x?.pausedRemainingMs != null,
1094
+ "data-timed": U,
1095
+ "data-rated": B,
961
1096
  "data-exiting": o,
962
- "data-frozen": v?.frozenFraction != null,
1097
+ "data-frozen": x?.frozenFraction != null,
963
1098
  children: [/* @__PURE__ */ h("button", {
964
1099
  className: "sb-snackbar-overlay",
965
1100
  type: "button",
966
1101
  tabIndex: -1,
967
1102
  "aria-hidden": "true",
968
- disabled: S !== "ready",
1103
+ disabled: T !== "ready",
969
1104
  onClick: () => void t.closeSurvey()
970
1105
  }), /* @__PURE__ */ g("div", {
971
1106
  className: "sb-snackbar-shell",
972
1107
  children: [/* @__PURE__ */ g("div", {
973
1108
  className: "sb-snackbar-surface",
974
1109
  onPointerEnter: (e) => {
975
- b && !o && e.pointerType === "mouse" && window.matchMedia?.("(hover: hover)").matches && t.setBarTimerPaused(p, !0);
1110
+ C && !o && e.pointerType === "mouse" && window.matchMedia?.("(hover: hover)").matches && t.setBarTimerPaused(y, !0);
976
1111
  },
977
1112
  onPointerLeave: () => {
978
- b && !o && t.setBarTimerPaused(p, !1);
1113
+ C && !o && t.setBarTimerPaused(y, !1);
979
1114
  },
980
1115
  children: [/* @__PURE__ */ g("div", {
981
1116
  className: "sb-snackbar-compact",
982
1117
  role: "group",
983
- "aria-label": C.prompt,
984
- "aria-hidden": y || S === "entering" || o,
985
- inert: y || S === "entering" || o,
1118
+ "aria-label": E.prompt,
1119
+ "aria-hidden": S || T === "entering" || o,
1120
+ inert: S || T === "entering" || o,
986
1121
  children: [
987
- T === "fill" || b && T === "bar" ? U : null,
988
- b ? null : /* @__PURE__ */ g("span", {
1122
+ O === "fill" || C && O === "bar" ? G : null,
1123
+ C ? null : /* @__PURE__ */ g("span", {
989
1124
  className: "sb-snackbar-artwork",
990
1125
  "aria-hidden": "true",
991
1126
  children: [/* @__PURE__ */ g("span", {
@@ -997,51 +1132,51 @@ function oe({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
997
1132
  /* @__PURE__ */ h("span", { className: "sb-fab__glyph sb-fab__glyph--mint" }),
998
1133
  /* @__PURE__ */ h("span", { className: "sb-fab__glyph sb-fab__glyph--rose" })
999
1134
  ]
1000
- }), w.imageUrl && !A ? /* @__PURE__ */ h("img", {
1001
- src: w.imageUrl,
1135
+ }), D.imageUrl && !A ? /* @__PURE__ */ h("img", {
1136
+ src: D.imageUrl,
1002
1137
  alt: "",
1003
1138
  onError: () => j(!0)
1004
1139
  }) : null]
1005
1140
  }),
1006
- b ? /* @__PURE__ */ h("div", {
1141
+ C ? /* @__PURE__ */ h("div", {
1007
1142
  className: "sb-bar-content",
1008
- inert: I,
1009
- "aria-hidden": I,
1010
- children: W
1011
- }) : W,
1012
- b ? /* @__PURE__ */ h("button", {
1143
+ inert: B,
1144
+ "aria-hidden": B,
1145
+ children: K
1146
+ }) : K,
1147
+ C ? /* @__PURE__ */ h("button", {
1013
1148
  className: "sb-bar-dismiss",
1014
1149
  type: "button",
1015
- disabled: y || I || o,
1016
- onClick: () => void t.closeSurvey(),
1150
+ disabled: S || B || o,
1151
+ onClick: N,
1017
1152
  children: "Not Now"
1018
1153
  }) : null,
1019
- N ? /* @__PURE__ */ h("span", {
1154
+ F ? /* @__PURE__ */ h("span", {
1020
1155
  className: "sb-bar-acknowledgement",
1021
1156
  role: "status",
1022
1157
  children: /* @__PURE__ */ h("span", {
1023
1158
  className: "sb-bar-acknowledgement-copy",
1024
- children: F
1159
+ children: L
1025
1160
  })
1026
1161
  }) : null
1027
1162
  ]
1028
- }), y ? /* @__PURE__ */ h("div", {
1163
+ }), S ? /* @__PURE__ */ h("div", {
1029
1164
  className: "sb-snackbar-card",
1030
- inert: S !== "ready",
1031
- "aria-hidden": S !== "ready",
1032
- children: /* @__PURE__ */ h(K, {
1165
+ inert: T !== "ready",
1166
+ "aria-hidden": T !== "ready",
1167
+ children: /* @__PURE__ */ h(me, {
1033
1168
  session: e,
1034
1169
  store: t,
1035
1170
  modal: a,
1036
- interactive: S === "ready"
1171
+ interactive: T === "ready"
1037
1172
  })
1038
1173
  }) : null]
1039
- }), b ? null : /* @__PURE__ */ h("button", {
1174
+ }), C ? null : /* @__PURE__ */ h("button", {
1040
1175
  className: "sb-snackbar-close",
1041
1176
  type: "button",
1042
1177
  "aria-label": "Close survey",
1043
- disabled: y,
1044
- onClick: () => void t.closeSurvey(),
1178
+ disabled: S,
1179
+ onClick: N,
1045
1180
  children: /* @__PURE__ */ h("svg", {
1046
1181
  viewBox: "0 0 24 24",
1047
1182
  "aria-hidden": "true",
@@ -1058,44 +1193,44 @@ function oe({ session: e, store: t, placement: r, modal: a, exiting: o = !1 }) {
1058
1193
  }
1059
1194
  //#endregion
1060
1195
  //#region src/lib/components/SurveyRenderer.tsx
1061
- var J = typeof window > "u" ? s : l, Y = 1969.207, se = 2169.207, X = 856.839, Z = 450;
1062
- function Q(e) {
1196
+ var X = typeof window > "u" ? s : l, ve = 1969.207, ye = 2169.207, be = 856.839, xe = 450;
1197
+ function Z(e) {
1063
1198
  let t = Number.parseFloat(e);
1064
1199
  return Number.isFinite(t) ? Math.max(0, t) : 0;
1065
1200
  }
1066
- function ce(e) {
1201
+ function Se(e) {
1067
1202
  let t = 0;
1068
1203
  for (let n of e) t += /[MW@#%&]/.test(n) ? 11 : /[ilI1.,' ]/.test(n) ? 4 : 7.5;
1069
1204
  return Math.ceil(t);
1070
1205
  }
1071
- function $() {
1206
+ function Q() {
1072
1207
  return typeof window < "u" && (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1);
1073
1208
  }
1074
- function le(e) {
1209
+ function $(e) {
1075
1210
  if (!e) return null;
1076
1211
  let { pulse_id: t, version: n, impression_id: r } = e.survey;
1077
1212
  return typeof r == "string" ? `${t}:${n}:${r}` : `${t}:${n}`;
1078
1213
  }
1079
- function ue(e) {
1214
+ function Ce(e) {
1080
1215
  if (!e) return;
1081
1216
  let t = getComputedStyle(e), n = Number.parseFloat(t.width) || e.offsetWidth || 86, r = Number.parseFloat(e.style.getPropertyValue("--sb-fab-expanded-width")) || n, i = Number.parseFloat(e.style.getPropertyValue("--sb-fab-anchor-offset")) || 0, a = r === 60 ? 0 : i / (r - 60), o = e.querySelector(".sb-fab__label"), s = e.querySelector(".sb-fab__timer");
1082
1217
  e.style.setProperty("--sb-fab-exit-width", `${n}px`), e.style.setProperty("--sb-fab-exit-offset", `${(r - n) * a}px`), e.style.setProperty("--sb-fab-exit-scale", t.getPropertyValue("scale") || "1"), e.style.setProperty("--sb-fab-exit-label-opacity", o ? getComputedStyle(o).opacity : "0"), e.style.setProperty("--sb-fab-exit-timer-opacity", s ? getComputedStyle(s).opacity : "0");
1083
1218
  }
1084
- function de({ session: e, store: t, fabRef: n, onClick: r }) {
1085
- let [i, a] = d(e), [o, c] = d(null), l = le(e), u = e?.survey.fab, f = (u?.timerStyle === "bar" || u?.timerStyle === "fill") && typeof u.expandedTimeout == "number" && Number.isFinite(u.expandedTimeout) && u.expandedTimeout > 0, p = e ?? i;
1086
- return J(() => {
1219
+ function we({ session: e, store: t, fabRef: n, onClick: r }) {
1220
+ let [i, a] = d(e), [o, c] = d(null), l = $(e), u = e?.survey.fab, f = (u?.timerStyle === "bar" || u?.timerStyle === "fill") && typeof u.expandedTimeout == "number" && Number.isFinite(u.expandedTimeout) && u.expandedTimeout > 0, p = e ?? i;
1221
+ return X(() => {
1087
1222
  e && a(e);
1088
- }, [e]), J(() => {
1089
- !e && i && ue(n.current);
1223
+ }, [e]), X(() => {
1224
+ !e && i && Ce(n.current);
1090
1225
  }, [
1091
1226
  n,
1092
1227
  i,
1093
1228
  e
1094
1229
  ]), s(() => {
1095
1230
  if (!l) return;
1096
- let e = $(), n = setTimeout(() => {
1231
+ let e = Q(), n = setTimeout(() => {
1097
1232
  t.confirmPresentation("expanded_fab"), t.confirmFabEntranceCompleted();
1098
- }, e ? 0 : Y), r = setTimeout(() => c(l), e ? 0 : f ? se : Y);
1233
+ }, e ? 0 : ve), r = setTimeout(() => c(l), e ? 0 : f ? ye : ve);
1099
1234
  return () => {
1100
1235
  clearTimeout(n), clearTimeout(r);
1101
1236
  };
@@ -1105,44 +1240,44 @@ function de({ session: e, store: t, fabRef: n, onClick: r }) {
1105
1240
  t
1106
1241
  ]), s(() => {
1107
1242
  if (e || !i) return;
1108
- let t = setTimeout(() => a(null), $() ? 0 : X);
1243
+ let t = setTimeout(() => a(null), Q() ? 0 : be);
1109
1244
  return () => clearTimeout(t);
1110
- }, [i, e]), p ? /* @__PURE__ */ h(L, {
1245
+ }, [i, e]), p ? /* @__PURE__ */ h(ie, {
1111
1246
  session: p,
1112
1247
  fabRef: n,
1113
1248
  onClick: r,
1114
1249
  animationState: e ? o === l ? "visible" : "entering" : "exiting"
1115
1250
  }) : null;
1116
1251
  }
1117
- function fe({ session: e, store: t, modal: n }) {
1252
+ function Te({ session: e, store: t, modal: n }) {
1118
1253
  let [r, i] = d(e), a = u(null), o = e ?? r;
1119
- return J(() => {
1254
+ return X(() => {
1120
1255
  e && i(e);
1121
- }, [e]), J(() => {
1256
+ }, [e]), X(() => {
1122
1257
  let t = a.current;
1123
1258
  !t || e || (t.classList.add("sb-sheet-root--exiting"), t.setAttribute("aria-hidden", "true"), t.querySelectorAll("button").forEach((e) => {
1124
1259
  e.disabled = !0;
1125
1260
  }));
1126
1261
  }, [e]), s(() => {
1127
1262
  if (e || !r) return;
1128
- let t = setTimeout(() => i(null), $() ? 0 : Z);
1263
+ let t = setTimeout(() => i(null), Q() ? 0 : xe);
1129
1264
  return () => clearTimeout(t);
1130
- }, [r, e]), o ? /* @__PURE__ */ h(K, {
1265
+ }, [r, e]), o ? /* @__PURE__ */ h(me, {
1131
1266
  session: o,
1132
1267
  store: t,
1133
1268
  modal: n,
1134
1269
  rootRef: a
1135
- }, le(o)) : null;
1270
+ }, $(o)) : null;
1136
1271
  }
1137
- function pe({ session: e, store: t, placement: n, modal: r }) {
1272
+ function Ee({ session: e, store: t, placement: n, modal: r }) {
1138
1273
  let [i, a] = d(e), o = e ?? i;
1139
- return J(() => {
1274
+ return X(() => {
1140
1275
  e && a(e);
1141
1276
  }, [e]), s(() => {
1142
1277
  if (e || !i) return;
1143
- let t = i.sentimentPresentation === "bar" ? $() ? O.reduced : O.removal : 0, n = setTimeout(() => a(null), t);
1278
+ let t = i.sentimentPresentation === "bar" ? Q() ? z.reduced : z.removal : 0, n = setTimeout(() => a(null), t);
1144
1279
  return () => clearTimeout(n);
1145
- }, [e, i]), !o || !e && o.sentimentPresentation !== "bar" ? null : /* @__PURE__ */ h(oe, {
1280
+ }, [e, i]), !o || !e && o.sentimentPresentation !== "bar" ? null : /* @__PURE__ */ h(_e, {
1146
1281
  session: o,
1147
1282
  store: t,
1148
1283
  placement: n,
@@ -1150,19 +1285,19 @@ function pe({ session: e, store: t, placement: n, modal: r }) {
1150
1285
  exiting: !e
1151
1286
  }, o.presentationId);
1152
1287
  }
1153
- function me({ store: e, portal: t = !0, placement: n = "fixed" }) {
1288
+ function De({ store: e, portal: t = !0, placement: n = "fixed" }) {
1154
1289
  let r = f(o((t) => e.subscribe(t), [e]), o(() => e.getSnapshot(), [e]), o(() => e.getServerSnapshot(), [e])).state, i = u(null), a = u(null), c = u(null), l = u(null), d = r ? r.completion ? "completion" : r.isOpen ? `sheet:${r.currentNodeId}` : `fab:${r.fabState}` : "none";
1155
- J(() => {
1290
+ X(() => {
1156
1291
  if (!r || !i.current) return;
1157
- let e = T(r.survey.theme);
1292
+ let e = I(r.survey.theme);
1158
1293
  for (let [t, n] of Object.entries(e)) i.current.style.setProperty(t, n);
1159
1294
  }, [r]), s(() => {
1160
1295
  let t = e.getState();
1161
1296
  if (!t) {
1162
- let e = i.current?.querySelector("[data-presentation=\"bar\"][data-exiting=\"true\"]"), t = i.current?.querySelector(".sb-fab--exiting") ? X : Z, n = setTimeout(() => {
1297
+ let e = i.current?.querySelector("[data-presentation=\"bar\"][data-exiting=\"true\"]"), t = i.current?.querySelector(".sb-fab--exiting") ? be : xe, n = setTimeout(() => {
1163
1298
  let e = l.current;
1164
1299
  e?.isConnected ? e.focus() : e && i.current?.focus(), l.current = null;
1165
- }, e ? $() ? O.reduced : O.removal : $() ? 0 : t);
1300
+ }, e ? Q() ? z.reduced : z.removal : Q() ? 0 : t);
1166
1301
  return () => clearTimeout(n);
1167
1302
  }
1168
1303
  if (t.isOpen || t.completion) {
@@ -1170,22 +1305,22 @@ function me({ store: e, portal: t = !0, placement: n = "fixed" }) {
1170
1305
  e.confirmPresentation("sheet"), (i.current?.querySelector("textarea[data-autofocus=\"true\"]") ?? i.current?.querySelector(".sb-sheet__body h2"))?.focus({ preventScroll: !0 });
1171
1306
  }
1172
1307
  t.snackbar && !l.current && document.activeElement instanceof HTMLElement && (l.current = document.activeElement);
1173
- }, [d, e]), J(() => {
1308
+ }, [d, e]), X(() => {
1174
1309
  let e = a.current, t = i.current;
1175
1310
  if (!e || !t || !r || r.fabState !== "expanded" || r.isOpen) return;
1176
1311
  let o = () => {
1177
1312
  let e = a.current;
1178
1313
  if (!e || !c.current) return;
1179
1314
  let i = window.visualViewport, o = n === "inline" ? t.getBoundingClientRect() : null, s = n === "inline" ? t.clientWidth || o.width : i?.width && i.width > 0 ? i.width : window.innerWidth, l = n === "inline" ? t.clientHeight || o.height : i?.height && i.height > 0 ? i.height : window.innerHeight, u = e.getBoundingClientRect(), d = getComputedStyle(c.current), f = {
1180
- top: Q(d.paddingTop),
1181
- right: Q(d.paddingRight),
1182
- bottom: Q(d.paddingBottom),
1183
- left: Q(d.paddingLeft)
1184
- }, p = Math.max(0, s - f.left - f.right), m = e.querySelector(".sb-fab__label"), h = m ? m.scrollWidth || m.getBoundingClientRect().width || ce(m.textContent ?? "") : 0, g = Math.min(p, Math.max(86, 86 + Math.ceil(h))), _ = e.offsetHeight || u.height || 60;
1315
+ top: Z(d.paddingTop),
1316
+ right: Z(d.paddingRight),
1317
+ bottom: Z(d.paddingBottom),
1318
+ left: Z(d.paddingLeft)
1319
+ }, p = Math.max(0, s - f.left - f.right), m = e.querySelector(".sb-fab__label"), h = m ? m.scrollWidth || m.getBoundingClientRect().width || Se(m.textContent ?? "") : 0, g = Math.min(p, Math.max(86, 86 + Math.ceil(h))), _ = e.offsetHeight || u.height || 60;
1185
1320
  e.style.setProperty("--sb-fab-expanded-width", `${g}px`), e.style.setProperty("--sb-fab-label-width", `${Math.max(0, g - 86)}px`);
1186
1321
  let v = Math.max(0, Math.min(1, r.survey.fab?.placement?.anchor.x ?? 1));
1187
1322
  e.style.setProperty("--sb-fab-anchor-offset", `${(g - 60) * v}px`);
1188
- let y = F(r.survey.fab?.placement, {
1323
+ let y = G(r.survey.fab?.placement, {
1189
1324
  viewport: {
1190
1325
  width: s,
1191
1326
  height: l
@@ -1232,21 +1367,21 @@ function me({ store: e, portal: t = !0, placement: n = "fixed" }) {
1232
1367
  ref: c,
1233
1368
  className: "sb-safe-area-probe"
1234
1369
  }),
1235
- /* @__PURE__ */ h(pe, {
1370
+ /* @__PURE__ */ h(Ee, {
1236
1371
  session: r?.snackbar ? r : null,
1237
1372
  store: e,
1238
1373
  placement: n,
1239
1374
  modal: t
1240
1375
  }),
1241
- /* @__PURE__ */ h(de, {
1376
+ /* @__PURE__ */ h(we, {
1242
1377
  session: r && !r.snackbar && !r.isOpen && !r.completion && r.fabState === "expanded" ? r : null,
1243
1378
  store: e,
1244
1379
  fabRef: a,
1245
1380
  onClick: () => {
1246
- ue(a.current), l.current = a.current, e.openSurvey();
1381
+ Ce(a.current), l.current = a.current, e.openSurvey();
1247
1382
  }
1248
1383
  }),
1249
- /* @__PURE__ */ h(fe, {
1384
+ /* @__PURE__ */ h(Te, {
1250
1385
  session: r && !r.snackbar && (r.isOpen || r.completion) ? r : null,
1251
1386
  store: e,
1252
1387
  modal: t
@@ -1256,4 +1391,4 @@ function me({ store: e, portal: t = !0, placement: n = "fixed" }) {
1256
1391
  return t && typeof document < "u" ? p(m, document.body) : m;
1257
1392
  }
1258
1393
  //#endregion
1259
- export { me as t };
1394
+ export { De as t };