@sidebandai/sideband-web 1.4.5-rc.5 → 1.4.6-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/sideband.iife.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -118,7 +118,7 @@ The SDK has no consent setting of its own.
|
|
|
118
118
|
## Server-rendered apps and React 18
|
|
119
119
|
|
|
120
120
|
Start Sideband in the browser only, once per page load. With React 18 and server
|
|
121
|
-
rendering, use this package (the React package
|
|
121
|
+
rendering, you can use this package (the React package also supports React 18.3 and 19). Load it from an
|
|
122
122
|
effect, so the server never imports it, and guard the start at module level, so
|
|
123
123
|
StrictMode's second effect run does not start it again:
|
|
124
124
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EventMetadata, SidebandCoreConfig, SidebandRuntime, SimulatedPulseDefinition, TrackOptions } from '@sidebandai/sideband-core';
|
|
2
2
|
export { createSidebandClient, getDeviceId, getSessionId, PendingInteractionStorageError, SidebandApiError, SurveySessionStore, buildFabTitle, getChoiceValue, SyncEngine, } from '@sidebandai/sideband-core';
|
|
3
|
-
export type { AnsweredInteraction, ApiErrorDetail, ClientContext, CompletionActionStyle, CompletionActionType, CompletionIconType, CompletionType, DismissedInteraction, EventMetadata, EventRecord, Fab, FabOffset, FabPlacement, FabPoint, FabState, Interaction, Platform, PendingInteractionStorageReason, PendingPulse, SyncEndpoint, Pulse, PulseAnswer, PulseCompletion, PulseCompletionAction, PulseQuestion, QuestionType, SentimentPresentation, SentimentPresentationOptions, BarPosition, BarBehavior, SimulatedPulseDefinition, SidebandClient, SidebandClientConfig, SidebandCoreConfig, SurveyAnswerDraft, SurveyAnswerMap, SurveyAnswerValue, SurveySessionState, SurveyStoreSnapshot, SurveyStoreUpdateReason, SyncEngineDeps, SyncEngineOptions, SyncErrorResponse, ServiceUnavailableError, SyncOptions, SyncRequest, SyncResponse, TrackedEvent, TrackOptions, Theme, ThemeColor, TimerStyle, SurveyPresentationDecision, SurveyPresentationKind, } from '@sidebandai/sideband-core';
|
|
3
|
+
export type { AnsweredInteraction, ApiErrorDetail, ClientContext, CompletionActionStyle, CompletionActionType, CompletionIconType, CompletionType, DismissedInteraction, EventMetadata, EventRecord, Fab, FabOffset, FabPlacement, FabPoint, FabState, Interaction, Platform, PendingInteractionStorageReason, PendingPulse, SyncEndpoint, Pulse, PulseAnswer, PulseCompletion, PulseCompletionAction, PulseQuestion, QuestionType, SentimentPresentation, SentimentPresentationOptions, BarPosition, BarBehavior, SimulatedPulseDefinition, SidebandClient, SidebandClientConfig, SidebandCoreConfig, SurveyAnswerDraft, SurveyAnswerMap, SurveyAnswerValue, SurveySessionState, SurveyStoreSnapshot, SurveyStoreUpdateReason, SyncEngineDeps, SyncEngineOptions, SyncErrorResponse, ServiceUnavailableError, SyncOptions, SyncRequest, SyncResponse, TrackedEvent, TrackOptions, Theme, ThemeColor, TimerStyle, SurveyPresentationDecision, PresentedPulseKind, SurveyPresentationKind, } from '@sidebandai/sideband-core';
|
|
4
4
|
export type SidebandWebConfig = SidebandCoreConfig & {
|
|
5
5
|
ui?: boolean;
|
|
6
6
|
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,YAAY,EACb,MAAM,2BAA2B,CAAA;AAIlC,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,8BAA8B,EAC9B,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,GAAG,EACH,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,+BAA+B,EAC/B,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,4BAA4B,EAC5B,WAAW,EACX,WAAW,EACX,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,UAAU,EACV,UAAU,EACV,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,2BAA2B,CAAA;AAElC,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG;IACnD,EAAE,CAAC,EAAE,OAAO,CAAA;CACb,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,IAAI,CAAA;IACpF,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC7B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,qBAAqB,EAAE,CAAC,UAAU,EAAE,wBAAwB,KAAK,OAAO,CAAA;IACxE,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAwDD,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,gBAAgB,CAKrE;AAED,wBAAgB,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY,QAExF;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,QAAkC;AACxE,wBAAgB,SAAS,SAA+B;AACxD,wBAAgB,KAAK,kBAAkC;AACvD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,wBAAwB,WAA2D;AACrI,wBAAgB,OAAO,SAGtB;AAED,eAAO,MAAM,QAAQ;;;;;;;;CAAkF,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,YAAY,EACb,MAAM,2BAA2B,CAAA;AAIlC,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,8BAA8B,EAC9B,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,GAAG,EACH,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,+BAA+B,EAC/B,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,4BAA4B,EAC5B,WAAW,EACX,WAAW,EACX,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,UAAU,EACV,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,2BAA2B,CAAA;AAElC,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,GAAG;IACnD,EAAE,CAAC,EAAE,OAAO,CAAA;CACb,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,IAAI,CAAA;IACpF,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;IAC7B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,qBAAqB,EAAE,CAAC,UAAU,EAAE,wBAAwB,KAAK,OAAO,CAAA;IACxE,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAwDD,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,gBAAgB,CAKrE;AAED,wBAAgB,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY,QAExF;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,QAAkC;AACxE,wBAAgB,SAAS,SAA+B;AACxD,wBAAgB,KAAK,kBAAkC;AACvD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,wBAAwB,WAA2D;AACrI,wBAAgB,OAAO,SAGtB;AAED,eAAO,MAAM,QAAQ;;;;;;;;CAAkF,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1166,7 +1166,7 @@ function Se(e) {
|
|
|
1166
1166
|
onError: e.onError
|
|
1167
1167
|
}), n = c({
|
|
1168
1168
|
...e,
|
|
1169
|
-
libraryVersion: "1.4.
|
|
1169
|
+
libraryVersion: "1.4.6-rc.1",
|
|
1170
1170
|
onSyncResponse: (e) => t.handleSyncResponse(e)
|
|
1171
1171
|
}), i = e.ui === !1 ? null : new xe(t);
|
|
1172
1172
|
return n.start(), {
|
package/dist/sideband.iife.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Sideband=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=`sideband:device_id`,n=`sideband:session_id`,r=`sideband:user_id`,i=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function a(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`)crypto.getRandomValues(e);else for(let t=0;t<e.length;t+=1)e[t]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function o(e){try{return e===`local`?window.localStorage:window.sessionStorage}catch{return null}}function s(e,t){let n=o(e);try{let e=n?.getItem(t);if(e&&i.test(e))return e.toLowerCase()}catch{}let r=a();try{n?.setItem(t,r)}catch{}return r}var c=null,l=null;function u(){return c||=s(`local`,t),c}function d(){return l||=s(`session`,n),l}function f(){try{return o(`local`)?.getItem(r)??null}catch{return null}}function p(e){try{o(`local`)?.setItem(r,e)}catch{}}function m(){try{o(`local`)?.removeItem(r)}catch{}}function h(e,t=`1.4.5-rc.5`){let n={device_id:u(),platform:`web`,app_version:e,session_id:d(),library_version:t};if(typeof navigator<`u`&&navigator.language){n.locale=navigator.language;let e=navigator.language.split(`-`)[0]?.toLowerCase();e&&(n.language=e)}return n}function g(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}function ee(e,t,n){return async()=>{let r=typeof t==`function`?await t():t;return{...h(e,n),...g(r??{})}}}function te(e){if(typeof e!=`string`||!e.trim())throw TypeError(`Sideband.configure apiKey must be a non-empty string.`)}function ne(e,t=`Sideband.configure appVersion`){if(typeof e!=`string`||!e.trim()||Array.from(e).length>64)throw TypeError(`${t} must be a non-empty string of at most 64 characters.`)}function re(e,t){if(typeof e!=`string`||!e.length)throw TypeError(`Sideband.track eventName must be a non-empty string.`);if(t!==void 0){if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`Sideband.track metadata must be a string-to-string map.`);for(let[e,n]of Object.entries(t))if(typeof n!=`string`)throw TypeError(`Sideband.track metadata value for "${e}" must be a string.`)}}function ie(e){return Array.from(e).length}function ae(e){return ie(e)>256}var oe=Symbol(`sideband.syncAttemptMetadata`),se=new WeakSet;function ce(e,t){let n={...e};return n[oe]=t,n}function le(e){return e?.[oe]}function ue(e){(typeof e==`object`&&e||typeof e==`function`)&&se.add(e)}function de(e){return(typeof e==`object`&&!!e||typeof e==`function`)&&se.has(e)}var fe=`/v1/sync`,pe={local:`https://api.pancake-betelgeuse.ts.net`,dev:`https://api.dev-sideband.ai`,prod:`https://api.sideband.ai`};function me(e){if(e)return e;if(typeof fetch!=`function`)throw Error(`Sideband requires a fetch implementation.`);return fetch}async function he(e){return typeof e==`function`?await e():e}async function ge(e){let t=typeof e==`function`?await e():e;return new Headers(t)}function _e(e){return e.baseUrl??pe[e.syncEndpoint??`prod`]}function ve(e){return new URL(fe,e).toString()}async function ye(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}function be(e,t){return typeof e==`object`&&e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`message`in e.error&&typeof e.error.message==`string`?e.error.message:t}function xe(e){let t=e.headers.get(`retry-after`);if(!t)return;let n=Number(t);if(Number.isFinite(n))return Math.max(n,0);let r=Date.parse(t);if(!Number.isNaN(r))return Math.max((r-Date.now())/1e3,0)}var Se=class extends Error{status;body;retryAfterSeconds;constructor(e,t,n,r){super(e),this.name=`SidebandApiError`,this.status=t,this.body=n,this.retryAfterSeconds=r}};function Ce(e){if(te(e.apiKey),e.syncEndpoint!==void 0&&!Object.hasOwn(pe,e.syncEndpoint))throw TypeError(`Sideband.configure syncEndpoint must be local, dev, or prod.`);async function t(t,n){let r=me(e.fetch),i=t.context??await he(e.context);ne(i.app_version,`Sideband context.app_version`);let a=await ge(e.headers),o=le(n);a.set(`content-type`,`application/json`),a.set(`x-bc-api-key`,e.apiKey),a.set(`x-bc-sync-attempt`,String(o?.attempt??1)),o?.retryReason?a.set(`x-bc-sync-retry-reason`,o.retryReason):a.delete(`x-bc-sync-retry-reason`);let s=ve(_e(e)),c={method:`POST`,headers:a,body:JSON.stringify({...t,context:i}),signal:n?.signal,...n?.keepalive?{keepalive:!0}:{}},l;try{l=await r(s,c)}catch(e){throw ue(e),e}let u=await ye(l);if(!l.ok)throw new Se(be(u,`Sideband sync request failed.`),l.status,u,xe(l));return u}async function n(e,n,r){return re(e,n),t({events:[{event_id:a(),event_name:e,metadata:n,timestamp:r?.timestamp??new Date().toISOString()}]},r)}return{sync:t,track:n}}var we=`sideband:pending_interactions:`,Te=1440*60*1e3,Ee=new Set([`completed`,`partial`,`not_now`,`never`]),_=class extends Error{reason;constructor(e,t,n){super(t,n===void 0?void 0:{cause:n}),this.name=`PendingInteractionStorageError`,this.reason=e}};function De(e,t){return`${we}${Oe(`${t}\n${e}`)}`}function Oe(e){let t=3735928559,n=1103547991;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);t=Math.imul(t^i,2654435761),n=Math.imul(n^i,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&n)+(t>>>0)).toString(36)}function ke(){if(typeof window>`u`)return null;try{return window.sessionStorage}catch(e){throw new _(`storage_unavailable`,`Sideband cannot use sessionStorage; pending answers are kept for this page only.`,e)}}function v(e){return e===void 0||typeof e==`string`}function Ae(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.values(e).every(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.answered_at==`string`&&v(t.answer_key)&&v(t.value)})}function je(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.pulse_id!=`string`||typeof t.action!=`string`||!Ee.has(t.action)||t.pulse_version!==void 0&&typeof t.pulse_version!=`number`||!v(t.impression_id)||!v(t.responded_at)?!1:t.action===`completed`||t.action===`partial`?Ae(t.answers)&&v(t.completion_action_id):!0}function Me(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.stored_at==`number`&&(t.user_id===null||typeof t.user_id==`string`)&&je(t.interaction)}function Ne(e,t=Date.now()){let n=ke(),r;try{r=n?.getItem(e)??null}catch(e){throw new _(`storage_unavailable`,`Sideband could not read pending answers.`,e)}if(!r)return[];try{let e=JSON.parse(r);return Array.isArray(e)?e.filter(Me).filter(e=>t-e.stored_at<Te).slice(-10):[]}catch{return[]}}function Pe(e,t){let n=ke();if(!n)return;let r=t.slice(-10);try{r.length?n.setItem(e,JSON.stringify(r)):n.removeItem(e)}catch(e){throw new _(`storage_write_failed`,`Sideband could not save pending answers to sessionStorage (it may be full); they are kept for this page only.`,e)}if(r.length<t.length)throw new _(`queue_full`,`Sideband keeps at most 10 pending answers across page loads; the oldest were not saved.`)}var Fe=20,Ie=50,Le=1,Re=15,ze=1e3,Be=300*1e3,Ve=2147483647,He=1e4;function Ue(e,t,n){return Math.min(Math.max(e,t),n)}function We(e){let t=e?.status;return typeof t==`number`?t:void 0}function Ge(e){let t=e?.status;return typeof t!=`number`||t===408||t===425||t===429||t>=500}function y(e){let t=e?.retryAfterSeconds;return typeof t==`number`&&Number.isFinite(t)?Math.max(t,0)*1e3:void 0}function Ke(e){return e?.status===503&&y(e)!==void 0?`server_retry`:de(e)?`network`:`server_error`}var b=class{deps;maxBatchSize;flushIntervalMs;retryIntervalMs;maxQueuedEvents;queuedEvents=[];queuedInteractions=[];restoredInteractions=[];replayedInteractions=new WeakSet;interactionMeta=new WeakMap;restoreReleaseTimer=null;unpersistedInteractions=new WeakSet;contextRevision=0;acknowledgedContextRevision=0;inFlightEventIds=new Set;timerId=null;timerDueAt=null;inFlight=null;abortController=null;regularDueAt=null;urgentDueAt=null;paceUntil=0;retryUntil=0;retrySnapshot=null;failureStreak=0;automaticRetrySuspended=!1;overflowReported=!1;started=!1;destroyed=!1;backgrounded=!1;pendingLifecycleForce=!1;pendingForcedRetry=null;manualFlushPromise=null;lastAttemptAccepted=!1;acceptedEvents=0;acceptedInteractions=0;syncAttempts=0;detachLifecycle=null;constructor(e,t={}){this.deps=e,this.maxBatchSize=Ue(t.maxBatchSize??Fe,1,Ie),this.flushIntervalMs=Math.max(t.flushIntervalSeconds??Le,1)*1e3,this.retryIntervalMs=Math.max(t.retryIntervalSeconds??Re,1)*1e3,this.maxQueuedEvents=Math.max(t.maxQueuedEvents??ze,this.maxBatchSize)}start(){this.started||this.destroyed||(this.started=!0,this.restoreInteractions(),this.attachLifecycle(),this.track(`system_app_launch`))}getDeliveryStatus(){let e=new Set([...this.queuedEvents,...this.retrySnapshot?.events??[]].map(e=>e.record.event_id));return{acceptedEvents:this.acceptedEvents,acceptedInteractions:this.acceptedInteractions,syncAttempts:this.syncAttempts,pendingEvents:e.size,pendingInteractions:this.queuedInteractions.length+this.restoredInteractions.length,hasPendingContext:this.contextRevision>this.acknowledgedContextRevision,isSyncing:this.inFlight!==null,isTerminal:this.destroyed||this.automaticRetrySuspended}}track(e,t,n){if(re(e,t),this.destroyed)return;let r=Date.now();if(this.enqueueEvent(e,t,n?.timestamp??new Date().toISOString(),r),this.enforceQueueLimit(),e===`system_did_present_pulse`){this.requestUrgent();return}this.requestRegularAt(this.queuedEvents.length>=this.maxBatchSize?r:r+this.flushIntervalMs)}enqueueEvent(e,t,n,r){let i={event_id:a(),event_name:e,timestamp:n,...t?{metadata:t}:{}};this.queuedEvents.push({record:i,tagEvent:{name:e,metadata:t},queuedAt:r})}tagUser(e=null,t=null,n=new Date().toISOString()){if(!this.destroyed){if(e!==t){let r=Date.now();e!==null&&this.enqueueEvent(`system_logout`,{user_id:e},n,r),t!==null&&this.enqueueEvent(`system_login`,{user_id:t},n,r),this.enforceQueueLimit()}this.contextRevision+=1,this.requestRegular()}}submitInteraction(e){this.destroyed||(this.interactionMeta.set(e,{owner:this.currentOwner(),storedAt:Date.now()}),this.queuedInteractions.push(e),this.persistInteractions(),this.requestUrgent())}requestRegular(){this.requestRegularAt(Date.now())}async observeResponse(e){this.destroyed||(this.retrySnapshot||this.clearRetryState(),this.applyServerPacing(e),await this.notifyResponse(e),this.clearUrgencyIfSatisfied(),this.updateSchedule())}notePacing(e){this.observeResponse(e)}async flush(){if(!this.destroyed)return this.manualFlushPromise||=this.drainForcedSnapshots().finally(()=>{this.manualFlushPromise=null,this.afterAttempt()}),this.manualFlushPromise}destroy(){this.destroyed||(this.destroyed=!0,this.clearTimer(),this.restoreReleaseTimer!==null&&(clearTimeout(this.restoreReleaseTimer),this.restoreReleaseTimer=null),this.detachLifecycle?.(),this.detachLifecycle=null,this.abortController?.abort(),this.abortController=null,this.pendingLifecycleForce=!1)}async drainForcedSnapshots(){for(;!this.destroyed;){if(this.inFlight){await this.inFlight;continue}if(!this.hasWork())return;if(this.pendingLifecycleForce){if(this.pendingLifecycleForce=!1,this.lastAttemptAccepted=!1,await this.beginAttempt(`forced-lifecycle`),!this.lastAttemptAccepted)return;continue}if(this.lastAttemptAccepted=!1,await this.beginAttempt(`forced-manual`),!this.lastAttemptAccepted)return}}requestRegularAt(e){this.destroyed||this.automaticRetrySuspended||(this.regularDueAt=this.regularDueAt===null?e:Math.min(this.regularDueAt,e),this.updateSchedule())}requestUrgent(){if(this.destroyed||this.automaticRetrySuspended)return;let e=Date.now();this.urgentDueAt=this.urgentDueAt===null?e:Math.min(this.urgentDueAt,e),this.updateSchedule()}hasWork(){return this.queuedEvents.length>0||this.sendableInteractions().length>0||this.contextRevision>this.acknowledgedContextRevision}createSnapshot(e){let t=this.queuedEvents.slice(0,this.maxBatchSize);if(e===`urgent`){let e=this.queuedEvents.find(e=>e.record.event_name===`system_did_present_pulse`);e&&!t.includes(e)&&(t[t.length-1]=e)}if(e===`forced-lifecycle`){let e=[...this.queuedEvents].reverse().find(e=>e.record.event_name===`system_app_background`),n=[this.queuedEvents.find(e=>e.record.event_name===`system_did_present_pulse`),e].filter(e=>!!e);if(n.length){let e=Math.max(this.maxBatchSize,n.length),r=new Set(n);t=[...this.queuedEvents.filter(e=>!r.has(e)).slice(0,e-n.length),...n]}}let n=this.sendableInteractions(),r=e===`forced-lifecycle`?n.find(e=>!this.replayedInteractions.has(e)):n[0];return r&&this.replayedInteractions.has(r)&&(t=[]),{events:t,interaction:r,contextRevision:this.contextRevision,attempt:1,trigger:e}}beginAttempt(e){if(this.destroyed||this.inFlight)return this.inFlight??Promise.resolve();if((e===`regular`||e===`urgent`)&&this.automaticRetrySuspended)return Promise.resolve();if(e===`urgent`&&!this.hasUrgentWork())return this.clearUrgencyIfSatisfied(),this.updateSchedule(),Promise.resolve();let t=this.retrySnapshot!==null,n=this.retrySnapshot??this.createSnapshot(e);if(!n.events.length&&!n.interaction&&n.contextRevision<=this.acknowledgedContextRevision&&e!==`regular`)return Promise.resolve();e===`regular`&&!t&&(this.regularDueAt=null),e===`urgent`&&!t&&(this.urgentDueAt=null),this.abortController=new AbortController,this.inFlightEventIds=new Set(n.events.flatMap(e=>e.record.event_id?[e.record.event_id]:[]));let r=this.runAttempt(n,this.abortController.signal);return this.inFlight=r,r.finally(()=>{this.inFlight===r&&(this.inFlight=null,this.abortController=null,this.inFlightEventIds.clear(),this.afterAttempt())}),r}async runAttempt(e,t){try{if(!e.context&&this.deps.resolveContext&&(e.context={...await this.deps.resolveContext()}),e.interaction&&!this.ownerMatches(e.interaction,e.context)&&(e.interaction=void 0,!e.events.length&&e.contextRevision<=this.acknowledgedContextRevision))return;this.syncAttempts++;let n=await this.deps.sendSync({...e.context?{context:e.context}:{},...e.events.length?{events:e.events.map(e=>e.record)}:{},...e.interaction?{interaction:e.interaction}:{}},ce({signal:t,...e.trigger===`forced-lifecycle`?{keepalive:!0}:{}},{attempt:e.attempt,...e.retryReason?{retryReason:e.retryReason}:{}}));if(this.destroyed)return;await this.handleDecodedResponse(n,e,e.trigger)}catch(t){this.destroyed||this.handleFailure(t,e)}}async handleDecodedResponse(e,t,n){if(this.lastAttemptAccepted=e.accepted,this.clearRetryState(),this.applyServerPacing(e),e.accepted){this.acceptedEvents+=t.events.length,this.acknowledgedContextRevision=Math.max(this.acknowledgedContextRevision,t.contextRevision);let e=new Set(t.events.flatMap(e=>e.record.event_id?[e.record.event_id]:[]));this.queuedEvents=this.queuedEvents.filter(t=>!t.record.event_id||!e.has(t.record.event_id))}if(e.accepted&&t.interaction){let e=this.queuedInteractions.indexOf(t.interaction);e>=0&&(this.acceptedInteractions++,this.queuedInteractions.splice(e,1),this.persistInteractions())}if(e.accepted&&this.releaseRestoredInteractions(),await this.notifyResponse(e,t.events.length?t.events[t.events.length-1]?.tagEvent:void 0),!e.accepted){this.regularDueAt=null,this.urgentDueAt=null;return}if(this.clearUrgencyIfSatisfied(),!this.hasWork()){this.regularDueAt=null,this.pendingLifecycleForce=!1;return}if(n===`urgent`&&this.hasUrgentWork()&&!this.manualFlushPromise){this.requestUrgent();return}this.hasWork()&&!this.manualFlushPromise&&this.requestRegular()}handleFailure(e,t){if(this.lastAttemptAccepted=!1,t.interaction&&We(e)===404){this.dropInteraction(t.interaction),this.clearRetryState(),this.reportError(e),this.regularDueAt=null,this.urgentDueAt=null,this.requestRegular();return}if(!Ge(e)){t.interaction&&(this.unpersistedInteractions.add(t.interaction),this.persistInteractions()),this.retrySnapshot=null,this.automaticRetrySuspended=!0,this.regularDueAt=null,this.reportError(e);return}this.failureStreak+=1,t.attempt=Math.min(t.attempt+1,1e3),t.retryReason=Ke(e),this.retrySnapshot=t;let n=y(e),r=Math.min(this.retryIntervalMs*2**(this.failureStreak-1),Be)*(.5+Math.random()*.5),i=Math.max(r,n??0);this.retryUntil=Date.now()+i,this.regularDueAt=this.retryUntil,t.trigger!==`regular`&&(this.pendingForcedRetry=t.trigger),this.failureStreak===1&&this.reportError(e)}clearRetryState(){this.failureStreak=0,this.retryUntil=0,this.automaticRetrySuspended=!1,this.overflowReported=!1,this.pendingForcedRetry=null,this.retrySnapshot=null}applyServerPacing(e){let t=e.next_sync_seconds;if(typeof t!=`number`||!Number.isFinite(t)||t<=0){this.paceUntil=0;return}this.paceUntil=Date.now()+t*1e3}async notifyResponse(e,t){if(!(!this.deps.onSyncResponse||this.destroyed))try{await this.deps.onSyncResponse(e,t)}catch(e){this.reportError(e)}}afterAttempt(){if(!(this.destroyed||this.inFlight||this.manualFlushPromise)){if(this.clearUrgencyIfSatisfied(),this.hasWork()||(this.pendingLifecycleForce=!1,this.pendingForcedRetry=null),this.pendingLifecycleForce&&this.hasWork()){if(this.retrySnapshot){this.updateSchedule();return}this.pendingLifecycleForce=!1,this.pendingForcedRetry=null,this.beginAttempt(`forced-lifecycle`);return}if(this.urgentDueAt!==null&&this.hasWork()&&!this.automaticRetrySuspended&&this.retryUntil<=Date.now()){this.beginAttempt(`urgent`);return}this.updateSchedule()}}updateSchedule(){if(this.destroyed||this.inFlight||this.manualFlushPromise||this.automaticRetrySuspended){this.clearTimer();return}let e=this.pendingForcedRetry?this.retryUntil:this.urgentDueAt===null?this.regularDueAt===null?null:Math.max(this.regularDueAt,this.paceUntil,this.retryUntil):Math.max(this.urgentDueAt,this.retryUntil);if(e===null){this.clearTimer();return}this.scheduleTimer(e)}scheduleTimer(e){this.timerId!==null&&this.timerDueAt===e||(this.clearTimer(),this.timerDueAt=e,this.timerId=setTimeout(()=>{this.timerId=null,this.timerDueAt=null;let e=this.pendingForcedRetry,t=e??(this.urgentDueAt===null?`regular`:`urgent`),n=e?this.retryUntil:t===`urgent`?Math.max(this.urgentDueAt??Date.now(),this.retryUntil):this.regularDueAt===null?null:Math.max(this.regularDueAt,this.paceUntil,this.retryUntil);if(n!==null){if(n>Date.now()){this.scheduleTimer(n);return}this.pendingForcedRetry=null,this.beginAttempt(t)}},Math.min(Math.max(e-Date.now(),0),Ve)))}clearTimer(){this.timerId!==null&&(clearTimeout(this.timerId),this.timerId=null),this.timerDueAt=null}hasUrgentWork(){return this.sendableInteractions().length>0||this.queuedEvents.some(e=>e.record.event_name===`system_did_present_pulse`)}clearUrgencyIfSatisfied(){this.hasUrgentWork()||(this.urgentDueAt=null,this.pendingForcedRetry===`urgent`&&(this.pendingForcedRetry=null))}enforceQueueLimit(){if(this.queuedEvents.length<=this.maxQueuedEvents)return;let e=this.queuedEvents.length-this.maxQueuedEvents,t=[],n=!1;for(let r of this.queuedEvents){let i=!!(r.record.event_id&&this.inFlightEventIds.has(r.record.event_id)),a=r.record.event_name===`system_did_present_pulse`;if(e>0&&!i&&!a){--e,n=!0;continue}t.push(r)}this.queuedEvents=t,n&&!this.overflowReported&&(this.overflowReported=!0,this.reportError(Error(`Sideband event queue exceeded ${this.maxQueuedEvents}; dropping oldest events.`)))}attachLifecycle(){if(typeof window>`u`||typeof document>`u`)return;let e=()=>{this.backgrounded||(this.backgrounded=!0,this.track(`system_app_background`))},t=()=>{e(),this.requestLifecycleForce()},n=()=>{if(document.visibilityState===`hidden`){e(),this.requestLifecycleForce();return}this.backgrounded&&(this.backgrounded=!1,this.track(`system_app_foreground`),this.requestRegular())};window.addEventListener(`pagehide`,t),document.addEventListener(`visibilitychange`,n),this.detachLifecycle=()=>{window.removeEventListener(`pagehide`,t),document.removeEventListener(`visibilitychange`,n)}}requestLifecycleForce(){if(!this.destroyed){if(this.inFlight||this.manualFlushPromise){this.pendingLifecycleForce=!0;return}if(this.retrySnapshot){this.pendingLifecycleForce=!0,this.updateSchedule();return}this.hasWork()&&this.beginAttempt(`forced-lifecycle`)}}restoreInteractions(){if(!this.deps.interactionPersistence)return;let e=[];try{e=this.deps.interactionPersistence.restore()}catch(e){this.reportError(e)}this.restoredInteractions=e.map(e=>(this.interactionMeta.set(e.interaction,{owner:e.owner,storedAt:e.storedAt}),this.replayedInteractions.add(e.interaction),e.interaction)),this.restoredInteractions.length&&(this.restoreReleaseTimer=setTimeout(()=>{this.restoreReleaseTimer=null,!(this.destroyed||!this.restoredInteractions.length)&&(this.releaseRestoredInteractions(),this.requestRegular())},He))}releaseRestoredInteractions(){this.restoreReleaseTimer!==null&&(clearTimeout(this.restoreReleaseTimer),this.restoreReleaseTimer=null),this.restoredInteractions.length&&(this.queuedInteractions=[...this.restoredInteractions,...this.queuedInteractions],this.restoredInteractions=[])}currentOwner(){return this.deps.currentInteractionOwner?this.deps.currentInteractionOwner():null}ownerMatches(e,t){return!this.deps.currentInteractionOwner||(this.interactionMeta.get(e)?.owner??null)===(t?t.user_id??null:this.currentOwner())}sendableInteractions(){if(!this.deps.currentInteractionOwner)return this.queuedInteractions;let e=this.currentOwner();return this.queuedInteractions.filter(t=>(this.interactionMeta.get(t)?.owner??null)===e)}dropInteraction(e){let t=this.queuedInteractions.indexOf(e);t>=0&&this.queuedInteractions.splice(t,1),this.persistInteractions()}persistInteractions(){if(this.deps.interactionPersistence)try{this.deps.interactionPersistence.save([...this.restoredInteractions,...this.queuedInteractions].filter(e=>!this.unpersistedInteractions.has(e)).map(e=>{let t=this.interactionMeta.get(e)??{owner:this.currentOwner(),storedAt:Date.now()};return{interaction:e,owner:t.owner,storedAt:t.storedAt}}))}catch(e){this.reportError(e)}}reportError(e){try{this.deps.onError?this.deps.onError(e):console.error(`[sideband]`,e)}catch{}}};function qe(e){ne(e.appVersion);let t=Je(e.onError),n=ee(e.appVersion,e.context,e.libraryVersion),r=e.context&&typeof e.context==`object`?e.context.user_id??null:null,i=async()=>{let e=await n();return r=e.user_id??null,t===null?e:{...e,user_id:t}},a=Ce({baseUrl:e.baseUrl,syncEndpoint:e.syncEndpoint,apiKey:e.apiKey,context:i,headers:e.headers,fetch:e.fetch}),o=De(e.apiKey,_e(e)),s=new b({sendSync:(e,t)=>a.sync(e,t),resolveContext:i,onSyncResponse:e.onSyncResponse,onError:e.onError,interactionPersistence:{restore:()=>Ne(o).map(e=>({interaction:e.interaction,owner:e.user_id,storedAt:e.stored_at})),save:e=>{Pe(o,e.map(e=>({interaction:e.interaction,user_id:e.owner,stored_at:e.storedAt})))}},currentInteractionOwner:()=>t??r},{maxBatchSize:e.maxBatchSize,flushIntervalSeconds:e.flushIntervalSeconds,retryIntervalSeconds:e.retryIntervalSeconds,maxQueuedEvents:e.maxQueuedEvents,maxServerPacingSeconds:e.maxServerPacingSeconds}),c=n=>{if(n!==null&&ae(n)){e.onError?.(Error(`Sideband.tagUser rejected a user ID longer than 256 characters.`));return}let r=new Date().toISOString(),i=t;t=n,n===null?m():p(n),s.tagUser(i,n,r)};return{getDeliveryStatus:()=>s.getDeliveryStatus(),start:()=>s.start(),track:(e,t,n)=>{s.track(e,t,n)},tagUser:e=>c(e),untagUser:()=>c(null),submitInteraction:e=>s.submitInteraction(e),async sync(e,t){let n=await a.sync(e,t);return await s.observeResponse(n),n},flush:()=>s.flush(),getDeviceId:u,destroy:()=>s.destroy()}}function Je(e){let t=f();return t===null||!ae(t)?t:(m(),e?.(Error(`Sideband cleared a stored user ID longer than 256 characters.`)),null)}function Ye(e){if(!e||typeof e!=`object`)return!1;let t=e;return[`position`,`anchor`,`offset`].every(e=>{let n=t[e];if(!n||typeof n!=`object`)return!1;let{x:r,y:i}=n;return typeof r==`number`&&Number.isFinite(r)&&typeof i==`number`&&Number.isFinite(i)&&(e!==`offset`||Number.isInteger(r)&&Number.isInteger(i))})}function x(e,t){return{imageUrl:e.imageUrl??t?.imageUrl,placement:Ye(e.placement)?e.placement:t?.placement}}var S={destroyed:!1,state:null},Xe=0;function C(e){return e.fab?.title??e.title}function w(e){return e.id}function T(e){return typeof e.impression_id==`string`?`${e.pulse_id}:${e.version}:${e.impression_id}`:`${e.pulse_id}:${e.version}`}function E(e){return typeof e.impression_id==`string`?{impression_id:e.impression_id}:{}}function D(e,t){return t?e.questions[t]??null:null}function O(e,t){return t?e.completions[t]??null:null}function k(e){return e.id===`system_other`}function A(e){let t=`${e.id} ${e.label}`.toLowerCase();return!t.includes(`no`)&&!t.includes(`down`)&&!t.includes(`bad`)}function Ze(e){return e.type===`yes_no`||e.type===`multiple_choice`}function j(e,t){return!!(D(e,t)||O(e,t))}function Qe(e){if(!e.pulse_id||!Number.isFinite(e.version)||!e.root_node_id)return`Pulse is missing a usable id, version, or root node.`;if(!j(e,e.root_node_id))return`Pulse root node does not exist.`;if(!Object.keys(e.questions).length)return`Pulse must include at least one question.`;for(let t of Object.keys(e.questions))if(e.completions[t])return`Pulse node ${t} is both a question and completion.`;for(let[t,n]of Object.entries(e.questions)){if(n.node_id!==t)return`Question map key ${t} does not match node_id ${n.node_id}.`;if(![`yes_no`,`multiple_choice`,`free_text`].includes(n.type))return`Question ${n.node_id} has unsupported type ${n.type}.`;if(Ze(n)&&!n.answers?.length)return`Choice question ${n.node_id} has no answers.`;let r=new Set;for(let t of n.answers??[]){if(!t.id)return`Choice question ${n.node_id} has an answer without id.`;if(r.has(t.id))return`Choice question ${n.node_id} has duplicate answer id ${t.id}.`;if(r.add(t.id),t.next_node_id!==void 0&&!j(e,t.next_node_id))return`Choice ${t.id} references missing node ${t.next_node_id}.`}if(n.next_node_id!==void 0&&!j(e,n.next_node_id))return`Question ${n.node_id} references missing node ${n.next_node_id}.`}for(let[t,n]of Object.entries(e.completions)){if(n.node_id!==t)return`Completion map key ${t} does not match node_id ${n.node_id}.`;if(n.type!==`thank_you`)return`Completion ${n.node_id} has unsupported type ${n.type}.`}return null}function $e(e,t){if(t?.answer_key){let n=e.answers?.find(e=>e.id===t.answer_key);if(n?.next_node_id)return n.next_node_id}return e.next_node_id??null}var et=class{snapshot=S;listeners=new Set;deps;fabTimeoutId=null;sentimentAdvanceTimeoutId=null;completionTransitionTimeoutId=null;destroyed=!1;decisionGeneration=0;seenPulseKeys=new Set;presentedKeys=new Set;constructor(e){this.deps=e}getState(){return this.snapshot.state}getSnapshot(){return this.snapshot}getServerSnapshot(){return S}subscribe(e){return this.destroyed?()=>{}:(this.listeners.add(e),()=>this.listeners.delete(e))}destroy(){this.destroyed||(this.destroyed=!0,this.decisionGeneration+=1,this.clearFabTimeout(),this.clearSurveyTransitionTimeouts(),this.publish(null,`destroyed`,!0),this.listeners.clear())}currentQuestion(){let e=this.snapshot.state;return e?D(e.survey,e.currentNodeId):null}currentAnswer(){let e=this.snapshot.state,t=this.currentQuestion();return e&&t?e.answers[t.node_id]:void 0}currentDraft(){let e=this.snapshot.state,t=this.currentQuestion();return e&&t?e.drafts[t.node_id]:void 0}currentText(){let e=this.snapshot.state,t=this.currentQuestion();return!e||!t?``:e.drafts[t.node_id]?.value??e.answers[t.node_id]?.value??``}isSentimentStep(){let e=this.snapshot.state,t=this.currentQuestion();return!!(e&&t&&(Object.keys(e.answers).length===0||e.snackbar&&e.snackbar.phase!==`journey`)&&t.node_id===e.survey.root_node_id&&t.type===`yes_no`&&t.answers?.length===2)}sentimentChoices(){let e=this.currentQuestion();return!e||!this.isSentimentStep()?[]:[...e.answers??[]].sort((e,t)=>{let n=A(e);return n===A(t)?0:n?-1:1})}shouldShowContinue(){return!!(this.currentQuestion()&&!this.isSentimentStep())}progress(){let e=this.snapshot.state;if(!e)return 0;if(e.completion||e.isCompleting)return 1;let t=Math.max(this.projectedQuestionIds(e).length,1),n=D(e.survey,e.survey.root_node_id),r=n&&!this.rendersAsSentiment(e,n)?1:0;return Math.min((Object.keys(e.answers).length+r)/t,1)}canContinue(){let e=this.snapshot.state,t=this.currentQuestion();if(!e||!t||e.isBusy)return!1;if(t.type===`free_text`)return!t.required||!!this.currentText().trim();let n=e.drafts[t.node_id];if(!n?.answer_key)return!t.required;let r=t.answers?.find(e=>e.id===n.answer_key);return!!(r&&(!k(r)||!t.required||n.value?.trim()))}async handleSyncResponse(e){let t=e.pending_pulse;if(!t||this.destroyed)return;let n=Qe(t);if(n){this.reportError(Error(n));return}let r=T(t);if(this.seenPulseKeys.has(r))return;this.seenPulseKeys.add(r);let i=++this.decisionGeneration,a=await this.resolvePresentationDecision(t);if(!(this.destroyed||i!==this.decisionGeneration)){if(a!==`showNow`){await this.sendPresentationDecline(t,a);return}this.beginPulse(t,`sheet`,!1)}}presentPulse(e,t={}){return this.presentLocalPulse(e,t.sentimentPresentation??`sheet`,!1)}presentSimulatedPulse(e){return this.presentLocalPulse(e.pulse,e.sentimentPresentation??`sheet`,!0)}presentLocalPulse(e,t,n){if(this.destroyed)return!1;let r=Qe(e);return r?(this.reportError(Error(r)),!1):(this.decisionGeneration+=1,this.beginPulse(e,t,n),!0)}beginPulse(e,t,n){let r=D(e,e.root_node_id),i=O(e,e.root_node_id),a=e.sentimentPresentation===`toolbar`,o=e.sentimentPresentation===void 0?r?.isSnackBar===!0||r?.isSnackBar!==!1&&t===`snackbar`&&!!e.fab:e.sentimentPresentation===`snackbar`,s=(a||o)&&r?.type===`yes_no`&&r.answers?.length===2&&!r.answers.some(k);this.clearSurveyTransitionTimeouts(),this.publish({presentationId:++Xe,sentimentPresentation:s?a?`bar`:`snackbar`:`sheet`,barPosition:`bottom`,barBehavior:`dismiss`,isSimulated:n,snackbar:s?{phase:`question`,selectedKey:null,startedAt:null,deadline:null,frozenFraction:null,pausedRemainingMs:null}:null,survey:e,answers:{},drafts:{},currentNodeId:r?.node_id??null,completion:i,history:r?[r.node_id]:[],fabState:e.fab||s?`expanded`:`hidden`,isOpen:!e.fab&&!s||!!i,isBusy:!1,sentimentSelectionLocked:!1,isCompleting:!1,presentationConfirmed:!1,presentationReported:!1,fabEntranceCompleted:!1},`transition`)}openSurvey(){let e=this.snapshot.state;!e||e.isBusy||e.snackbar||this.publish({...e,fabState:`hidden`,isOpen:!0},`transition`)}async closeSurvey(){let e=this.snapshot.state;if(!(!e||e.isBusy)){if(this.clearSurveyTransitionTimeouts(),e.sentimentPresentation===`bar`&&e.barBehavior===`dismiss`&&Object.keys(e.answers).length>0){await this.completeTerminal(e,e.answers);return}await this.dismiss(e)}}async selectChoice(e){let t=this.snapshot.state,n=this.currentQuestion();if(!t||!n||t.isBusy||t.sentimentSelectionLocked||t.snackbar&&t.snackbar.phase!==`journey`||!Ze(n))return;let r=n.answers?.find(t=>t.id===e.id);if(!r)return;let i=t.drafts[n.node_id],a={answer_key:r.id,...k(r)&&i?.answer_key===r.id&&i.value?{value:i.value}:{}},o={...t,drafts:{...t.drafts,[n.node_id]:a},sentimentSelectionLocked:this.isSentimentStep()};if(this.publish(o,`select`),this.isSentimentStep()&&!k(r)){this.sentimentAdvanceTimeoutId!==null&&clearTimeout(this.sentimentAdvanceTimeoutId);let e=r.comment?.trim()?1400:A(r)?700:500,i=T(t.survey);this.sentimentAdvanceTimeoutId=setTimeout(()=>{this.sentimentAdvanceTimeoutId=null;let e=this.snapshot.state;e&&T(e.survey)===i&&e.currentNodeId===n.node_id&&e.drafts[n.node_id]?.answer_key===r.id&&this.advance()},e)}}setText(e){let t=this.snapshot.state,n=this.currentQuestion();!t||!n||t.isBusy||n.type!==`free_text`&&!this.isSystemOtherDraft(n)||this.publish({...t,drafts:{...t.drafts,[n.node_id]:{...t.drafts[n.node_id],value:e}}},`text`)}async advance(){let e=this.snapshot.state,t=this.currentQuestion();if(!e||!t||e.isBusy||!this.canContinue()||e.snackbar&&e.snackbar.phase!==`journey`)return;let n=this.commitCurrentAnswer(e,t);await this.advanceFrom(e,t,n)}async handleCompletionAction(e){let t=this.snapshot.state;if(!t||!t.completion||t.isBusy)return;let n={pulse_id:t.survey.pulse_id,pulse_version:t.survey.version,...E(t.survey),action:`completed`,responded_at:new Date().toISOString(),answers:t.answers,completion_action_id:e.id};if(this.publish(null,`transition`),await this.queueInteraction(n,t.isSimulated),e.action.type===`app_rating`&&!t.isSimulated)try{await this.deps.onRateApp?.()}catch(e){this.reportError(e)}}confirmPresentation(e,t){let n=this.snapshot.state;if(!(!n||this.destroyed||t!==void 0&&n.presentationId!==t)&&!(e===`sheet`&&!n.isOpen)&&!(e===`expanded_fab`&&n.fabState!==`expanded`)&&(this.emitPresentationEvent(n,e),e===`expanded_fab`&&!n.presentationReported)){let e=n.snackbar&&n.fabEntranceCompleted&&n.snackbar.phase===`question`&&n.snackbar.deadline===null&&n.snackbar.pausedRemainingMs===null?{...n.snackbar,...tt(Date.now(),n.survey.fab?.expandedTimeout)}:n.snackbar;this.publish({...n,presentationConfirmed:!0,presentationReported:!0,snackbar:e},`transition`)}}confirmEntryDisplayed(e){let t=this.snapshot.state;!t||this.destroyed||t.fabState!==`expanded`||t.presentationConfirmed||e!==void 0&&t.presentationId!==e||this.publish({...t,presentationConfirmed:!0},`transition`)}confirmFabEntranceCompleted(e){let t=this.snapshot.state;!t||t.fabState!==`expanded`||!t.presentationConfirmed||t.fabEntranceCompleted||e!==void 0&&t.presentationId!==e||this.destroyed||this.publish({...t,fabEntranceCompleted:!0,snackbar:t.snackbar&&t.presentationReported?{...t.snackbar,...tt(Date.now(),t.survey.fab?.expandedTimeout)}:t.snackbar},`transition`)}answerSnackbar(e,t){let n=this.snapshot.state,r=n?.snackbar,i=this.currentQuestion(),a=i?.answers?.find(e=>e.id===t&&!k(e)),o=Date.now();if(!n||!r||!i||!a||n.presentationId!==e||n.isOpen||!n.fabEntranceCompleted||r.phase!==`question`||r.deadline!==null&&o>=r.deadline)return!1;let s={answer_key:a.id,answered_at:new Date(o).toISOString()},c=r.pausedRemainingMs===null?r.deadline!==null&&r.startedAt!==null?Math.max(0,Math.min(1,(r.deadline-o)/Math.max(1,r.deadline-r.startedAt))):1:r.pausedRemainingMs/Math.max(1,n.survey.fab?.expandedTimeout??1),l=n.sentimentPresentation===`bar`&&n.barBehavior===`dismiss`;return this.publish({...n,answers:{...n.answers,[i.node_id]:s},drafts:{...n.drafts,[i.node_id]:{answer_key:a.id}},sentimentSelectionLocked:!0,snackbar:{...r,phase:`feedback`,selectedKey:a.id,deadline:null,frozenFraction:c,pausedRemainingMs:null}},`transition`),this.sentimentAdvanceTimeoutId=setTimeout(()=>{this.sentimentAdvanceTimeoutId=null;let t=this.snapshot.state;if(!(t?.presentationId!==e||t.snackbar?.phase!==`feedback`)){if(l){this.completeTerminal(t,t.answers);return}this.publish({...t,isOpen:!0,fabState:`hidden`,snackbar:{...t.snackbar,phase:`awaitingReady`}},`transition`)}},l?3e3:500),!0}setBarTimerPaused(e,t){let n=this.snapshot.state,r=n?.snackbar,i=n?.survey.fab?.expandedTimeout;if(!(!n||n.presentationId!==e||n.sentimentPresentation!==`bar`||!r||r.phase!==`question`||typeof i!=`number`||!Number.isFinite(i)||i<=0)){if(t&&r.deadline!==null){let e=Math.max(0,r.deadline-Date.now());if(e===0){this.closeSurvey();return}this.publish({...n,snackbar:{...r,deadline:null,pausedRemainingMs:e}},`transition`)}else if(!t&&r.pausedRemainingMs!==null){let e=Date.now()+r.pausedRemainingMs;this.publish({...n,snackbar:{...r,deadline:e,startedAt:e-i,pausedRemainingMs:null}},`transition`)}}}confirmSnackbarContentReady(e){let t=this.snapshot.state,n=this.currentQuestion();if(!t||t.presentationId!==e||t.snackbar?.phase!==`awaitingReady`||!n)return;let r=n.answers?.find(e=>e.id===t.snackbar?.selectedKey);if(!r)return;this.publish({...t,snackbar:{...t.snackbar,phase:`dwelling`}},`transition`);let i=r.comment?.trim()?1400:A(r)?700:500;this.sentimentAdvanceTimeoutId=setTimeout(()=>{this.sentimentAdvanceTimeoutId=null;let t=this.snapshot.state;t?.presentationId!==e||t.snackbar?.phase!==`dwelling`||this.advanceFrom({...t,snackbar:{...t.snackbar,phase:`journey`}},n,t.answers)},i)}async resolvePresentationDecision(e){try{if(this.deps.shouldPresentPulse)return await this.deps.shouldPresentPulse({pulseId:e.pulse_id,version:e.version,title:e.title,...e.fab?{fab:e.fab}:{}})}catch(e){return this.reportError(e),`notNow`}return`showNow`}async sendPresentationDecline(e,t){await this.queueInteraction({pulse_id:e.pulse_id,pulse_version:e.version,...E(e),action:t===`never`?`never`:`not_now`,responded_at:new Date().toISOString()})}commitCurrentAnswer(e,t){let n=e.drafts[t.node_id];if(t.type===`free_text`){let r=n?.value?.trim()??``;return{...e.answers,[t.node_id]:r?{answered_at:new Date().toISOString(),value:r}:{answered_at:new Date().toISOString()}}}if(!n?.answer_key)return t.required?e.answers:{...e.answers,[t.node_id]:{answered_at:new Date().toISOString()}};let r=t.answers?.find(e=>e.id===n.answer_key);if(!r)return e.answers;let i=n.value?.trim();return k(r)&&!t.required&&!i?{...e.answers,[t.node_id]:{answered_at:new Date().toISOString()}}:{...e.answers,[t.node_id]:{answered_at:new Date().toISOString(),answer_key:r.id,...k(r)&&i?{value:i}:{}}}}async advanceFrom(e,t,n){let r=$e(t,n[t.node_id]);if(!r){await this.completeTerminal(e,n);return}let i=D(e.survey,r);if(i){if(e.history.includes(i.node_id)){this.reportError(Error(`Pulse graph cycle detected at ${i.node_id}.`)),await this.dismissOrPartial(e,n);return}this.publish({...e,answers:n,currentNodeId:i.node_id,history:[...e.history,i.node_id],fabState:`hidden`,isOpen:!0,sentimentSelectionLocked:!1,isCompleting:!1},`transition`);return}let a=O(e.survey,r);if(a){if(!(!this.rendersAsSentiment(e,t)&&this.progress()<1)){this.publish({...e,answers:n,completion:a,currentNodeId:null,fabState:`hidden`,isOpen:!0,sentimentSelectionLocked:!1,isCompleting:!1},`transition`);return}this.publish({...e,answers:n,isCompleting:!0,sentimentSelectionLocked:!1,fabState:`hidden`,isOpen:!0},`transition`);let r=T(e.survey);this.completionTransitionTimeoutId=setTimeout(()=>{this.completionTransitionTimeoutId=null;let e=this.snapshot.state;!e||T(e.survey)!==r||!e.isCompleting||this.publish({...e,completion:a,currentNodeId:null,isCompleting:!1},`transition`)},500);return}this.reportError(Error(`Pulse graph references missing node ${r}.`)),await this.dismissOrPartial(e,n)}async completeTerminal(e,t){this.publish(null,`transition`),await this.queueInteraction({pulse_id:e.survey.pulse_id,pulse_version:e.survey.version,...E(e.survey),action:`completed`,responded_at:new Date().toISOString(),answers:t},e.isSimulated)}async dismiss(e){await this.dismissOrPartial(e,e.answers)}async dismissOrPartial(e,t){this.clearSurveyTransitionTimeouts();let n=Object.keys(t).length>0;this.publish(null,`transition`),await this.queueInteraction(n?{pulse_id:e.survey.pulse_id,pulse_version:e.survey.version,...E(e.survey),action:`partial`,responded_at:new Date().toISOString(),answers:t}:{pulse_id:e.survey.pulse_id,pulse_version:e.survey.version,...E(e.survey),action:`not_now`,responded_at:new Date().toISOString()},e.isSimulated)}async queueInteraction(e,t=!1){if(!t)try{await this.deps.syncInteraction(e)}catch(e){this.reportError(e)}}emitPresentationEvent(e,t){if(e.isSimulated)return;let n=`${T(e.survey)}:${t}`;this.presentedKeys.has(n)||(this.presentedKeys.add(n),this.deps.trackEvent?.(`system_did_present_pulse`,{kind:t,pulse_id:e.survey.pulse_id,pulse_version:String(e.survey.version),...E(e.survey)}))}scheduleFabTimeout(e){if(this.clearFabTimeout(),!e||e.fabState!==`expanded`||!e.presentationReported||!e.fabEntranceCompleted||e.snackbar&&e.snackbar.phase!==`question`||e.snackbar?.pausedRemainingMs!=null)return;let t=e.survey.fab?.expandedTimeout;if(typeof t!=`number`||!Number.isFinite(t)||t<0)return;let n=T(e.survey);this.fabTimeoutId=setTimeout(()=>{let e=this.snapshot.state;this.destroyed||!e||T(e.survey)!==n||e.fabState!==`expanded`||this.dismissOrPartial(e,e.answers)},e.snackbar?.deadline!==null&&e.snackbar?.deadline!==void 0?Math.max(0,e.snackbar.deadline-Date.now()):t)}clearFabTimeout(){this.fabTimeoutId!==null&&(clearTimeout(this.fabTimeoutId),this.fabTimeoutId=null)}clearSurveyTransitionTimeouts(){this.sentimentAdvanceTimeoutId!==null&&(clearTimeout(this.sentimentAdvanceTimeoutId),this.sentimentAdvanceTimeoutId=null),this.completionTransitionTimeoutId!==null&&(clearTimeout(this.completionTransitionTimeoutId),this.completionTransitionTimeoutId=null)}rendersAsSentiment(e,t){return t.node_id===e.survey.root_node_id&&t.type===`yes_no`&&t.answers?.length===2}projectedQuestionIds(e){let t=[],n=new Set,r=D(e.survey,e.survey.root_node_id)?.node_id??null;for(;r;){let i=D(e.survey,r);if(!i||n.has(r))break;t.push(r),n.add(r),r=this.projectedNextQuestionId(e,i)}return t}projectedNextQuestionId(e,t){let n=e.answers[t.node_id];if(n){let r=$e(t,n);return r&&D(e.survey,r)?r:null}if(!t.required){let n=t.next_node_id??null;return n&&D(e.survey,n)?n:null}let r=new Set((t.answers??[]).map(e=>e.next_node_id).filter(Boolean)),i=r.size===0?t.next_node_id??null:r.size===1?[...r][0]??t.next_node_id??null:null;return i&&D(e.survey,i)?i:null}publish(e,t,n=!1){this.clearFabTimeout(),this.snapshot={state:e,destroyed:n},this.scheduleFabTimeout(e);for(let e of this.listeners)try{e(t)}catch(e){this.reportError(e)}}reportError(e){try{this.deps.onError?this.deps.onError(e):console.error(`[sideband]`,e)}catch{}}isSystemOtherDraft(e){let t=this.snapshot.state?.drafts[e.node_id];return!!(t?.answer_key&&e.answers?.some(e=>e.id===t.answer_key&&k(e)))}};function tt(e,t){return{startedAt:e,deadline:typeof t==`number`&&Number.isFinite(t)&&t>=0?e+t:null}}function nt(e,t){let n=!1,r=null,i=null,a=null,o=Date.now(),s=()=>{n=!0,r?.disconnect(),r=null,i!==null&&clearInterval(i),i=null,document.removeEventListener(`visibilitychange`,l)},c=()=>a===null?r&&Date.now()-o<1e3?!1:it(e):a;function l(){n||!rt(e)||!c()||(s(),t())}return typeof IntersectionObserver<`u`&&(r=new IntersectionObserver(e=>{let t=e[e.length-1];t&&(a=t.isIntersecting),l()}),r.observe(e)),l(),n?s:(document.addEventListener(`visibilitychange`,l),i=setInterval(l,200),s)}function rt(e){if(!e.isConnected)return!1;for(let t of[e,...ct(e)]){let e=t.ownerDocument.defaultView;if(!e||t.ownerDocument.visibilityState===`hidden`||!st(t,e))return!1}return!0}function it(e){let t=e,n=M(e.getBoundingClientRect());for(;;){if(n=at(t,n),!n)return!1;let e=P(t);if(!e)return!0;let r=e.getBoundingClientRect();if(n=N({left:n.left+r.left,right:n.right+r.left,top:n.top+r.top,bottom:n.bottom+r.top},M(r)),!n)return!1;t=e}}var M=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function at(e,t){let n=e.ownerDocument.defaultView;if(!n)return null;let r=e.ownerDocument,i=ot(n.getComputedStyle(r.documentElement)),a=!i.x&&!i.y,o=n.getComputedStyle(e).position===`fixed`,s=t;for(let t=F(e);t&&s;t=F(t)){if(t===r.documentElement||t===r.body&&a)continue;let e=n.getComputedStyle(t);if(!o){let{x:n,y:r}=ot(e);if(n||r){let e=M(t.getBoundingClientRect());s=N(s,{left:n?e.left:-1/0,right:n?e.right:1/0,top:r?e.top:-1/0,bottom:r?e.bottom:1/0})}}e.position===`fixed`&&(o=!0)}if(!s)return null;let c=n.innerWidth||e.ownerDocument.documentElement.clientWidth,l=n.innerHeight||e.ownerDocument.documentElement.clientHeight;return N(s,{left:0,top:0,right:c,bottom:l})}function ot(e){let t=e=>e!==``&&e!==`visible`;return{x:t(e.overflowX||e.overflow),y:t(e.overflowY||e.overflow)}}function N(e,t){let n={left:Math.max(e.left,t.left),top:Math.max(e.top,t.top),right:Math.min(e.right,t.right),bottom:Math.min(e.bottom,t.bottom)};return n.left<=n.right&&n.top<=n.bottom?n:null}function st(e,t){let n=e;if(typeof n.checkVisibility==`function`)return n.checkVisibility({visibilityProperty:!0})&&e.offsetWidth>0&&e.offsetHeight>0;if(t.getComputedStyle(e).visibility===`hidden`)return!1;for(let n=e;n;n=F(n))if(t.getComputedStyle(n).display===`none`)return!1;return!0}function ct(e){let t=[];for(let n=P(e);n;n=P(n))t.push(n);return t}function P(e){let t=e.ownerDocument.defaultView;if(!t||t.parent===t)return null;try{return t.frameElement}catch{return null}}function F(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode();return t!==e.ownerDocument&&t.host?t.host:null}var lt=`rgba(0, 0, 0, 0)`,I=(e,t=1)=>({hex:e,alpha:t}),L=(e,t)=>[{variable:`--sb-theme-choice-${e}-background`,path:[`choice`,e,`background`],fallback:t[0]},{variable:`--sb-theme-choice-${e}-foreground`,path:[`choice`,e,`foreground`],fallback:t[1]},{variable:`--sb-theme-choice-${e}-border`,path:[`choice`,e,`border`],fallback:t[2]}],R=(e,t)=>[{variable:`--sb-theme-button-${e}-foreground`,path:[`button`,e,`foreground`],fallback:t[0]},{variable:`--sb-theme-button-${e}-background`,path:[`button`,e,`background`],fallback:t[1]},{variable:`--sb-theme-button-${e}-hover-background`,path:[`button`,e,`hoverBackground`],fallback:t[2]},{variable:`--sb-theme-button-${e}-pressed-background`,path:[`button`,e,`pressedBackground`],fallback:t[3]},{variable:`--sb-theme-button-${e}-disabled-background`,path:[`button`,e,`disabledBackground`],fallback:t[4]},{variable:`--sb-theme-button-${e}-disabled-foreground`,path:[`button`,e,`disabledForeground`],fallback:t[5]}],z=[{variable:`--sb-theme-sheet-background`,path:[`sheet`,`background`],fallback:I(`#FFFFFF`)},{variable:`--sb-theme-sheet-scrim`,path:[`sheet`,`scrim`],fallback:I(`#000000`,.5)},{variable:`--sb-theme-sheet-divider`,path:[`sheet`,`divider`],fallback:I(`#E5E5E5`)},{variable:`--sb-theme-sheet-progress-track`,path:[`sheet`,`progressTrack`],fallback:I(`#000000`,.12)},{variable:`--sb-theme-sheet-progress-fill`,path:[`sheet`,`progressFill`],fallback:I(`#000000`)},{variable:`--sb-theme-sheet-close-button-background`,path:[`sheet`,`closeButtonBackground`],fallback:I(`#000000`,0)},{variable:`--sb-theme-sheet-close-button-foreground`,path:[`sheet`,`closeButtonForeground`],fallback:I(`#000000`)},{variable:`--sb-theme-content-heading`,path:[`content`,`heading`],fallback:I(`#000000`)},{variable:`--sb-theme-content-body`,path:[`content`,`body`],fallback:I(`#333030`)},{variable:`--sb-theme-content-helper`,path:[`content`,`helper`],fallback:I(`#5C5C5C`)},{variable:`--sb-theme-content-error`,path:[`content`,`error`],fallback:I(`#B42318`)},{variable:`--sb-theme-completion-outer-background`,path:[`completion`,`outerBackground`],fallback:I(`#E8E8E8`)},{variable:`--sb-theme-completion-inner-background`,path:[`completion`,`innerBackground`],fallback:I(`#000000`)},{variable:`--sb-theme-completion-glyph`,path:[`completion`,`glyph`],fallback:I(`#FFFFFF`)},...L(`default`,[I(`#FFFFFF`),I(`#000000`),I(`#DBDBDB`)]),...L(`hover`,[I(`#F5F5F5`),I(`#000000`),I(`#DBDBDB`)]),...L(`pressed`,[I(`#000000`),I(`#FFFFFF`),I(`#000000`)]),...L(`selected`,[I(`#000000`),I(`#FFFFFF`),I(`#000000`)]),...L(`disabled`,[I(`#F2F2F2`),I(`#8A8A8A`),I(`#E5E5E5`)]),...R(`primary`,[I(`#FFFFFF`),I(`#121212`),I(`#292929`),I(`#000000`),I(`#E5E5E5`),I(`#8A8A8A`)]),...R(`secondary`,[I(`#000000`),I(`#F2F2F2`),I(`#E8E8E8`),I(`#DBDBDB`),I(`#E5E5E5`),I(`#8A8A8A`)]),...R(`tertiary`,[I(`#000000`),I(`#FFFFFF`),I(`#F5F5F5`),I(`#E8E8E8`),I(`#E5E5E5`),I(`#8A8A8A`)]),{variable:`--sb-theme-input-background`,path:[`input`,`background`],fallback:I(`#FFFFFF`)},{variable:`--sb-theme-input-foreground`,path:[`input`,`foreground`],fallback:I(`#000000`)},{variable:`--sb-theme-input-placeholder`,path:[`input`,`placeholder`],fallback:I(`#000000`,.4)},{variable:`--sb-theme-input-border`,path:[`input`,`border`],fallback:I(`#000000`,.18)},{variable:`--sb-theme-input-focused-border`,path:[`input`,`focusedBorder`],fallback:I(`#000000`,.7)},{variable:`--sb-theme-input-error-border`,path:[`input`,`errorBorder`],fallback:I(`#B42318`)},{variable:`--sb-theme-input-disabled-background`,path:[`input`,`disabledBackground`],fallback:I(`#F2F2F2`)},{variable:`--sb-theme-input-disabled-foreground`,path:[`input`,`disabledForeground`],fallback:I(`#8A8A8A`)},{variable:`--sb-theme-fab-background`,path:[`fab`,`background`],fallback:I(`#000000`)},{variable:`--sb-theme-fab-foreground`,path:[`fab`,`foreground`],fallback:I(`#FFFFFF`)},{variable:`--sb-theme-fab-border`,path:[`fab`,`border`],fallback:I(`#FFFFFF`,.15)},{variable:`--sb-theme-fab-accent-primary`,path:[`fab`,`accentPrimary`],fallback:I(`#000000`)},{variable:`--sb-theme-fab-accent-secondary`,path:[`fab`,`accentSecondary`],fallback:I(`#FFFFFF`)},{variable:`--sb-theme-fab-timer-track`,path:[`fab`,`timerTrack`],fallback:I(`#000000`,.16)},{variable:`--sb-theme-fab-timer-fill`,path:[`fab`,`timerFill`],fallback:I(`#000000`)}];z.map(e=>e.variable);var ut=Object.fromEntries(z.map(e=>[e.variable,V(e.fallback)]));function B(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function V(e,t=lt){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})`}function dt(e,t){let n=e;for(let e of t)n=B(n)[e];return n}function ft(e){return Object.fromEntries(z.map(t=>[t.variable,V(dt(e,t.path),V(t.fallback))]))}function H(e,t){return I(`#${[1,3,5].map(n=>{let r=Number.parseInt(e.hex.slice(n,n+2),16),i=Number.parseInt(t.hex.slice(n,n+2),16);return Math.round(r*e.alpha+i*(1-e.alpha)).toString(16).padStart(2,`0`)}).join(``)}`,1)}function pt(e){let t=t=>{let n=z.find(e=>e.path.join(`.`)===t.join(`.`)),r=dt(e,t);return V(r,``)?r:n.fallback},n={...t([`sheet`,`background`]),alpha:1},r=t([`content`,`heading`]),i=t([`choice`,`selected`,`background`]),a=H(i,n),o=[1,3,5].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)=>V(H({...e,alpha:e.alpha*t},n)),u=H({...r,alpha:r.alpha*(s?c?.15:.08:.14)},n),d=e=>[1,3,5].reduce((t,n,r)=>t+Number.parseInt(e.hex.slice(n,n+2),16)*[.2126,.7152,.0722][r],0),f=d(u)>d(n);return{"--sb-snackbar-surface":V(n),"--sb-snackbar-text":V(r),"--sb-snackbar-border":V(I(s?`#FFFFFF`:`#000000`,s?.1:.05)),"--sb-snackbar-normal":l(r,s?c?.2:.14:c?.08:.1),"--sb-snackbar-hover":l(r,s?c?.24:.18:.04),"--sb-snackbar-pressed":l(i,s?c?.28:.24:.2),"--sb-snackbar-active":V(a),"--sb-snackbar-on-active":V(t([`choice`,`selected`,`foreground`])),"--sb-snackbar-ghost":V(u),"--sb-snackbar-remaining":V(f?u:n),"--sb-snackbar-elapsed":V(f?n:u)}}var U={visible:185.84,entrance:1969.207,timerEntrance:2169.207,widen:200,expand:450},W={delay:400,enter:450,exit:400,removal:450,reduced:150},mt=W.delay+W.enter;function ht(e,t){return t?0:e?W.delay:U.visible}function gt(e,t){let{viewport:n,safeArea:r={},compactHeight:i}=t,a=G(r.left)+12,o=G(r.right)+12,s=G(r.top)+24,c=G(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);if(t.barPosition)return{compactWidth:n.width,compactLeft:0,compactBottom:0,cardWidth:d,cardHeight:p,maxCardHeight:f,cardLeft:a+(l-d)/2,cardBottom:c,cardTop:G(r.top)+12,entranceOffset:0,transformOrigin:t.barPosition===`top`?`50% 0%`:`50% 100%`};let m=bt(e,{viewport:n,element:{width:u,height:i},safeArea:r}),h=Math.max(a,Math.min(m.left,n.width-o-u)),g=Math.max(c,Math.min(n.height-m.top-i,n.height-s-i));return{compactWidth:u,cardWidth:d,compactLeft:h,compactBottom:g,cardHeight:p,maxCardHeight:f,cardTop:0,entranceOffset:(u-i)*K(e?.anchor).x,cardLeft:a+(l-d)/2,cardBottom:Math.max(c,Math.min(g,n.height-s-p)),transformOrigin:m.transformOrigin}}var _t={x:1,y:1},vt={x:-16,y:-24};function G(e){return typeof e==`number`&&Number.isFinite(e)?Math.max(0,e):0}function yt(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function K(e){let t=B(e),n=typeof t.x==`number`&&Number.isFinite(t.x)?t.x:_t.x,r=typeof t.y==`number`&&Number.isFinite(t.y)?t.y:_t.y;return{x:Math.min(1,Math.max(0,n)),y:Math.min(1,Math.max(0,r))}}function bt(e,t){let n=B(e),r=K(n.position),i=K(n.anchor),a=B(n.offset),o=e?yt(a.x):vt.x,s=e?yt(a.y):vt.y,c=t.safeArea??{},l=G(c.left),u=G(c.right),d=G(c.top),f=G(c.bottom),p=Math.max(0,G(t.viewport.width)-l-u-G(t.element.width)),m=Math.max(0,G(t.viewport.height)-d-f-G(t.element.height));return{left:l+r.x*p+o,top:d+r.y*m+s,travelX:p,travelY:m,position:r,anchor:i,transformOrigin:`${i.x*100}% ${i.y*100}%`}}function xt(e,t,n=`forward`){let r=e===`bar`||e===`fill`?e:`none`,i=n===`reverse`?`reverse`:`forward`,a=typeof t==`number`&&Number.isFinite(t)&&t>0?t:null;return{style:r,direction:i,durationMs:a,visible:r!==`none`,cssVariables:{"--sb-timer-style":r,"--sb-timer-direction":i,...a===null?{}:{"--sb-timer-duration":`${a}ms`}}}}var St=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6.4 6.4 17.6 17.6M17.6 6.4 6.4 17.6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`,Ct=`<svg viewBox="0 0 14 14" aria-hidden="true"><path d="M6.66667 0 5.49167 1.175 10.1417 5.83333H0V7.5h10.1417l-4.65 4.6583 1.175 1.175L13.3333 6.66667 6.66667 0Z" fill="currentColor"/></svg>`,wt=`<svg viewBox="0 0 36 28" aria-hidden="true"><path d="m11.2619 21.3151-8.40108-8.4011L0 15.7546l11.2619 11.262L35.4379 2.84067 32.5972 0 11.2619 21.3151Z" fill="currentColor"/></svg>`,q=`<svg viewBox="0 0 35.5556 35.5556" aria-hidden="true"><path d="M19.436 3.05195 11.2286 11.2594c-.5481.5481-.8592 1.3037-.8592 2.0888v14.8c0 1.6297 1.3333 2.963 2.9629 2.963h13.3334c1.1851 0 2.2518-.7111 2.7259-1.7926l4.8296-11.2741c1.2445-2.9333-.9037-6.1925-4.0889-6.1925H21.762l1.4074-6.78523c.1481-.74075-.0741-1.4963-.6074-2.02963-.8741-.85926-2.2667-.85926-3.126.01481ZM4.44343 31.1112c1.62963 0 2.96296-1.3333 2.96296-2.963V16.2964c0-1.6296-1.33333-2.963-2.96296-2.963-1.62963 0-2.96296 1.3334-2.96296 2.963v11.8518c0 1.6297 1.33333 2.963 2.96296 2.963Z" fill="currentColor"/></svg>`,Tt=`<svg viewBox="0 0 35.5556 35.5556" aria-hidden="true"><path d="m16.1165 32.5036 8.1926-8.2074c.5481-.5482.8592-1.3037.8592-2.0889v-14.8c0-1.62963-1.3333-2.96296-2.9629-2.96296H8.88686c-1.18519 0-2.25185.71111-2.71111 1.79259L1.34612 17.511c-1.25926 2.9333.88889 6.1926 4.07407 6.1926h8.37041l-1.4074 6.7852c-.1482.7407.074 1.4963.6074 2.0296.874.8593 2.2666.8593 3.1259-.0148ZM31.1091 4.44434c-1.6296 0-2.963 1.33333-2.963 2.96296v11.8519c0 1.6296 1.3334 2.9629 2.963 2.9629 1.6296 0 2.9629-1.3333 2.9629-2.9629V7.4073c0-1.62963-1.3333-2.96296-2.9629-2.96296Z" fill="currentColor"/></svg>`,Et=`.sb-snackbar-root{--sb-text:var(--sb-snackbar-text);--sb-text-muted:var(--sb-theme-content-body);--sb-surface:var(--sb-snackbar-surface);z-index:1100;pointer-events:none;color:var(--sb-snackbar-text);font-family:Inter,-apple-system,BlinkMacSystemFont,system-ui,sans-serif;position:fixed;inset:0}.sb-snackbar-root *,.sb-snackbar-root :before,.sb-snackbar-root :after{box-sizing:border-box}.sb-snackbar-root h2{text-transform:none;letter-spacing:normal}.sb-snackbar-shell{left:var(--sb-snackbar-left);bottom:var(--sb-snackbar-bottom);width:var(--sb-snackbar-width);transition:left .2s ease-in-out,bottom .2s ease-in-out,width .2s ease-in-out;position:absolute}.sb-snackbar-surface{width:100%;height:var(--sb-snackbar-height,64px);border-radius:calc(var(--sb-snackbar-compact-height,64px) / 2);background:var(--sb-snackbar-surface);box-shadow:inset 0 0 0 1px var(--sb-snackbar-border);transition:height .45s cubic-bezier(0,.87,.39,1),border-radius .45s cubic-bezier(0,.87,.39,1);position:relative;overflow:hidden}.sb-snackbar-compact{width:var(--sb-snackbar-compact-width,364px);align-items:center;gap:10px;min-height:64px;padding:10px;transition:opacity .12s ease-out;display:flex;position:relative}.sb-snackbar-artwork{--sb-theme-fab-accent-primary:var(--sb-theme-sheet-progress-fill);--sb-theme-fab-accent-secondary:var(--sb-snackbar-surface);--sb-theme-fab-foreground:var(--sb-snackbar-text);background:var(--sb-theme-sheet-progress-fill);border-radius:50%;flex:0 0 40px;width:40px;height:40px;position:relative;overflow:hidden}.sb-snackbar-artwork img{z-index:2;object-fit:cover;width:100%;height:100%;position:absolute;inset:0}.sb-snackbar-prompt{overflow-wrap:anywhere;flex:1;min-width:0;margin:0;font-size:14px;font-weight:600;line-height:20px;position:relative}.sb-snackbar-answers{flex:none;gap:4px;display:flex;position:relative}.sb-snackbar-answer{width:44px;height:44px;color:var(--sb-snackbar-text);background:var(--sb-snackbar-normal);cursor:pointer;pointer-events:auto;border:0;border-radius:50%;place-items:center;margin:0;padding:0;transition:background .12s ease-out,scale .12s ease-out;display:grid}.sb-snackbar-answer svg{width:18px;height:18px}.sb-snackbar-answer:hover:not(:disabled){background:var(--sb-snackbar-hover)}.sb-snackbar-answer:active:not(:disabled){background:var(--sb-snackbar-pressed);scale:.94}.sb-snackbar-answer[aria-pressed=true]{color:var(--sb-snackbar-on-active);background:var(--sb-snackbar-active)}.sb-snackbar-answer:disabled{cursor:default;pointer-events:none;opacity:1}.sb-snackbar-close{top:-25px;width:44px;height:44px;color:var(--sb-snackbar-text);pointer-events:auto;cursor:pointer;background:0 0;border:0;place-items:center;margin:0;padding:13px;display:grid;position:absolute;inset-inline-start:-15px}.sb-snackbar-close svg{background:var(--sb-snackbar-surface);border-radius:50%;width:18px;height:18px;padding:2px}.sb-snackbar-answer:focus-visible,.sb-snackbar-close:focus-visible{outline:2px solid var(--sb-snackbar-text);outline-offset:2px}.sb-snackbar-timer{pointer-events:none;position:absolute;overflow:hidden}.sb-snackbar-timer--fill{background:var(--sb-snackbar-elapsed);inset:0}.sb-snackbar-timer--bar{inset-inline:1px 3px;background:var(--sb-theme-sheet-progress-track);height:2px;bottom:-6px}.sb-snackbar-timer-fill{transform-origin:0;background:var(--sb-theme-sheet-progress-fill);width:100%;height:100%;display:block}.sb-snackbar-timer--fill .sb-snackbar-timer-fill{background:var(--sb-snackbar-remaining)}.sb-snackbar-root:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)) .sb-snackbar-timer-fill{transform-origin:100%}.sb-snackbar-root[data-counting=true] .sb-snackbar-timer-fill{animation:sb-snackbar-countdown var(--sb-snackbar-duration) linear forwards}.sb-snackbar-root[data-frozen=true] .sb-snackbar-timer-fill{transform:scaleX(var(--sb-snackbar-fraction));animation:none}.sb-snackbar-overlay{background:var(--sb-theme-sheet-scrim);opacity:0;pointer-events:none;border:0;width:100%;height:100%;margin:0;padding:0;transition:opacity .45s ease-out;position:absolute;inset:0}.sb-snackbar-card{width:var(--sb-snackbar-card-width);max-height:var(--sb-snackbar-max-height);opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;overflow:auto}.sb-snackbar-root .sb-snackbar-card .sb-sheet-root{position:static;inset:auto}.sb-snackbar-root .sb-snackbar-card .sb-sheet-root__overlay{display:none}.sb-snackbar-root .sb-snackbar-card .sb-sheet{width:100%;max-height:none;box-shadow:none;background:0 0;border:0;margin:0;animation:none;position:relative;inset:auto;transform:none}.sb-snackbar-card[inert] *{animation-play-state:paused}.sb-snackbar-root[data-stage=widening] .sb-snackbar-compact,.sb-snackbar-root[data-stage=expanding] .sb-snackbar-compact,.sb-snackbar-root[data-stage=ready] .sb-snackbar-compact{opacity:0}.sb-snackbar-root[data-expanded=true] .sb-snackbar-overlay{opacity:1;pointer-events:auto}.sb-snackbar-root[data-expanded=true] .sb-snackbar-close{display:none}.sb-snackbar-root[data-stage=expanding] .sb-snackbar-surface,.sb-snackbar-root[data-stage=ready] .sb-snackbar-surface{box-shadow:none;background:var(--sb-theme-sheet-background);border-radius:40px}.sb-snackbar-root[data-stage=expanding] .sb-snackbar-card{opacity:1;transition:opacity .3s ease-out .12s}.sb-snackbar-root[data-stage=ready] .sb-snackbar-card{opacity:1;pointer-events:auto}.sb-snackbar-root[data-stage=entering] .sb-snackbar-shell{animation:.89016s cubic-bezier(.649439,.0577174,.124599,1) .18584s both sb-snackbar-enter-scale,.893207s cubic-bezier(.649439,.0577174,.124599,1) 1.076s both sb-snackbar-enter-width}.sb-snackbar-root[data-stage=entering] .sb-snackbar-surface{transition:none}.sb-snackbar-root[data-stage=entering] .sb-snackbar-prompt,.sb-snackbar-root[data-stage=entering] .sb-snackbar-answers,.sb-snackbar-root[data-stage=entering] .sb-snackbar-close{animation:.2s ease-out 1.076s both sb-snackbar-label}.sb-snackbar-root[data-stage=entering] .sb-snackbar-timer{animation:.2s ease-out 1.96921s both sb-snackbar-label}.sb-root--inline .sb-snackbar-root{position:absolute}@keyframes sb-snackbar-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@keyframes sb-snackbar-enter-scale{0%{scale:0}to{scale:1}}@keyframes sb-snackbar-enter-width{0%{width:var(--sb-snackbar-compact-height,64px);translate:var(--sb-snackbar-entrance-offset) 0}to{width:var(--sb-snackbar-width);translate:0}}@keyframes sb-snackbar-label{0%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion:reduce){.sb-snackbar-root[data-counting=true] .sb-snackbar-timer-fill{animation-duration:var(--sb-snackbar-duration)!important}.sb-snackbar-root .sb-snackbar-shell,.sb-snackbar-root .sb-snackbar-surface,.sb-snackbar-root .sb-snackbar-card,.sb-snackbar-root .sb-snackbar-compact,.sb-snackbar-root .sb-snackbar-overlay{transition:none}.sb-snackbar-root[data-stage=entering] .sb-snackbar-shell,.sb-snackbar-root[data-stage=entering] .sb-snackbar-prompt,.sb-snackbar-root[data-stage=entering] .sb-snackbar-timer,.sb-snackbar-root[data-stage=entering] .sb-snackbar-close,.sb-snackbar-root[data-stage=entering] .sb-snackbar-answers{animation:none}}.sb-snackbar-root[data-presentation=bar]{--sb-bar-hidden-y:max(80px, 100%)}.sb-snackbar-root[data-presentation=bar][data-position=top]{--sb-bar-hidden-y:calc(-1 * max(80px, 100%))}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-shell{top:var(--sb-bar-top,0px);transition:left .2s ease-in-out,top .2s ease-in-out,width .2s ease-in-out;bottom:auto}.sb-snackbar-root[data-presentation=bar]:not([data-expanded=true]) .sb-snackbar-surface{box-shadow:none;border-radius:0}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-compact{border-block-start:1px solid var(--sb-snackbar-border);min-height:48px;padding:10px max(108px, env(safe-area-inset-right,0px)) 10px max(108px, env(safe-area-inset-left,0px));pointer-events:auto;justify-content:center}.sb-snackbar-root[data-presentation=bar][data-position=bottom] .sb-snackbar-compact{padding-bottom:calc(10px + env(safe-area-inset-bottom,0px))}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-compact{padding-top:calc(10px + env(safe-area-inset-top,0px));border-block-start:0;border-block-end:1px solid var(--sb-snackbar-border)}.sb-bar-content{align-items:center;gap:12px;min-width:0;transition:opacity .25s ease-out;display:flex;position:relative}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-prompt{text-align:center;text-wrap:pretty;flex:0 auto;font-size:14px;font-weight:400;line-height:1.3}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answers{gap:4px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer{border:1px solid var(--sb-snackbar-border);background:var(--sb-snackbar-surface);-webkit-tap-highlight-color:transparent;border-radius:36px;width:36px;height:24px;transition:background .18s,border-color .18s,scale .15s ease-out}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer svg{width:14.4px;height:14.4px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer[aria-pressed=true]{background:var(--sb-snackbar-active);color:var(--sb-snackbar-on-active)}.sb-bar-acknowledgement{opacity:0;visibility:hidden;pointer-events:none;text-align:center;color:var(--sb-snackbar-text);justify-content:center;align-items:center;padding:10px 24px;font-size:18px;font-weight:600;line-height:1.4;transition:opacity .35s cubic-bezier(.16,1,.3,1) .1s,translate .35s cubic-bezier(.16,1,.3,1) .1s;display:flex;position:absolute;inset:0;translate:0 10px}.sb-snackbar-root[data-rated=true] .sb-bar-content,.sb-snackbar-root[data-rated=true] .sb-bar-dismiss,.sb-snackbar-root[data-rated=true][data-presentation=bar] .sb-snackbar-timer{opacity:0;pointer-events:none}.sb-snackbar-root[data-rated=true] .sb-bar-acknowledgement{opacity:1;visibility:visible;translate:0}.sb-bar-acknowledgement-copy{overflow-wrap:anywhere;min-width:0;max-width:100%}.sb-snackbar-root[data-presentation=bar][data-rated=true] .sb-snackbar-compact{min-height:var(--sb-snackbar-height,48px)}.sb-bar-dismiss{inset-inline-end:20px;width:68px;height:44px;color:var(--sb-theme-content-body);font:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:0;margin:0;padding:0 5px;font-size:14px;line-height:1.3;transition:opacity .25s ease-out;position:absolute;top:50%;translate:0 -50%}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:hover:not(:disabled){background:var(--sb-snackbar-surface)}@media (hover:hover){.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:hover:not(:disabled){background:var(--sb-snackbar-hover);border-color:var(--sb-theme-input-border)}}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:not(:disabled):active{background:var(--sb-snackbar-pressed);scale:.96}.sb-bar-dismiss:focus-visible{outline:2px solid var(--sb-snackbar-text);outline-offset:2px}.sb-bar-dismiss:disabled{cursor:default}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer{transition:opacity .25s ease-out}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer--bar{inset-inline:auto 25px;background:var(--sb-snackbar-border);width:58px;height:1px;top:calc(50% + 8px);bottom:auto}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer--bar .sb-snackbar-timer-fill{background:var(--sb-theme-content-body)}.sb-snackbar-root[data-presentation=bar][data-paused=true] .sb-snackbar-timer-fill{animation-play-state:paused}.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-shell{animation:.45s cubic-bezier(.16,1,.3,1) .4s both sb-bar-enter}.sb-snackbar-root[data-presentation=bar][data-exiting=true] .sb-snackbar-shell{pointer-events:none;animation:.4s cubic-bezier(.55,0,.55,.2) both sb-bar-exit}.sb-snackbar-root[data-presentation=bar][data-exiting=true] .sb-snackbar-overlay{opacity:0;pointer-events:none}.sb-snackbar-root[data-presentation=bar][data-exiting=true][data-expanded=true] .sb-snackbar-shell{animation:.4s ease-out both sb-bar-card-exit}.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-prompt,.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-answers,.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-timer{animation:none}@keyframes sb-bar-enter{0%{translate:0 var(--sb-bar-hidden-y)}to{translate:0}}@keyframes sb-bar-exit{0%{translate:0}to{translate:0 var(--sb-bar-hidden-y)}}@keyframes sb-bar-fade-in{0%{opacity:0}to{opacity:1}}@keyframes sb-bar-fade-out{0%{opacity:1}to{opacity:0}}@keyframes sb-bar-card-exit{0%{opacity:1;translate:0}to{opacity:0;translate:0 12px}}@media (width<=768px){.sb-snackbar-root[data-presentation=bar] .sb-snackbar-compact{padding-inline:max(24px, env(safe-area-inset-left,0px)) max(24px, env(safe-area-inset-right,0px))}.sb-bar-content{width:100%}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-prompt{text-align:start;flex:1}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answers{gap:5.333px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer{border-radius:48px;width:48px;height:32px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer svg{width:19.2px;height:19.2px}.sb-bar-acknowledgement{text-align:start;justify-content:flex-start}.sb-snackbar-root[data-presentation=bar][data-timed=true] .sb-bar-dismiss{display:none}.sb-snackbar-root[data-presentation=bar][data-timed=false] .sb-bar-content{padding-inline-end:76px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer--bar{inset-inline:0;width:auto;top:0}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-timer--bar{top:auto;bottom:0}}.sb-root--inline .sb-snackbar-root[data-presentation=bar] .sb-snackbar-compact{padding-block:10px}@media (prefers-reduced-motion:reduce){.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-shell{animation:.15s ease-out both sb-bar-fade-in}.sb-snackbar-root[data-presentation=bar][data-exiting=true] .sb-snackbar-shell,.sb-snackbar-root[data-presentation=bar][data-exiting=true][data-expanded=true] .sb-snackbar-shell{animation:.15s ease-out both sb-bar-fade-out}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-shell{transition:none}.sb-bar-acknowledgement{transition:opacity .15s ease-out;translate:none}.sb-bar-content,.sb-bar-dismiss{transition:opacity .15s ease-out}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:not(:disabled):active{scale:1}}.sb-sheet__close:before{content:"";background:currentColor;width:24px;height:24px;display:block;-webkit-mask:url("data:image/svg+xml,%3csvg%20preserveAspectRatio='none'%20overflow='visible'%20style='display:%20block;'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='close'%3e%3cpath%20id='Vector'%20d='M12%2013.4L7.1%2018.3C6.91667%2018.4833%206.68333%2018.575%206.4%2018.575C6.11667%2018.575%205.88333%2018.4833%205.7%2018.3C5.51667%2018.1167%205.425%2017.8833%205.425%2017.6C5.425%2017.3167%205.51667%2017.0833%205.7%2016.9L10.6%2012L5.7%207.1C5.51667%206.91667%205.425%206.68333%205.425%206.4C5.425%206.11667%205.51667%205.88333%205.7%205.7C5.88333%205.51667%206.11667%205.425%206.4%205.425C6.68333%205.425%206.91667%205.51667%207.1%205.7L12%2010.6L16.9%205.7C17.0833%205.51667%2017.3167%205.425%2017.6%205.425C17.8833%205.425%2018.1167%205.51667%2018.3%205.7C18.4833%205.88333%2018.575%206.11667%2018.575%206.4C18.575%206.68333%2018.4833%206.91667%2018.3%207.1L13.4%2012L18.3%2016.9C18.4833%2017.0833%2018.575%2017.3167%2018.575%2017.6C18.575%2017.8833%2018.4833%2018.1167%2018.3%2018.3C18.1167%2018.4833%2017.8833%2018.575%2017.6%2018.575C17.3167%2018.575%2017.0833%2018.4833%2016.9%2018.3L12%2013.4Z'%20fill='%23E8E8E8'/%3e%3c/g%3e%3c/svg%3e") 50%/24px 24px no-repeat;mask:url("data:image/svg+xml,%3csvg%20preserveAspectRatio='none'%20overflow='visible'%20style='display:%20block;'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='close'%3e%3cpath%20id='Vector'%20d='M12%2013.4L7.1%2018.3C6.91667%2018.4833%206.68333%2018.575%206.4%2018.575C6.11667%2018.575%205.88333%2018.4833%205.7%2018.3C5.51667%2018.1167%205.425%2017.8833%205.425%2017.6C5.425%2017.3167%205.51667%2017.0833%205.7%2016.9L10.6%2012L5.7%207.1C5.51667%206.91667%205.425%206.68333%205.425%206.4C5.425%206.11667%205.51667%205.88333%205.7%205.7C5.88333%205.51667%206.11667%205.425%206.4%205.425C6.68333%205.425%206.91667%205.51667%207.1%205.7L12%2010.6L16.9%205.7C17.0833%205.51667%2017.3167%205.425%2017.6%205.425C17.8833%205.425%2018.1167%205.51667%2018.3%205.7C18.4833%205.88333%2018.575%206.11667%2018.575%206.4C18.575%206.68333%2018.4833%206.91667%2018.3%207.1L13.4%2012L18.3%2016.9C18.4833%2017.0833%2018.575%2017.3167%2018.575%2017.6C18.575%2017.8833%2018.4833%2018.1167%2018.3%2018.3C18.1167%2018.4833%2017.8833%2018.575%2017.6%2018.575C17.3167%2018.575%2017.0833%2018.4833%2016.9%2018.3L12%2013.4Z'%20fill='%23E8E8E8'/%3e%3c/g%3e%3c/svg%3e") 50%/24px 24px no-repeat}:host{--sb-surface:var(--sb-theme-sheet-background,#fff);--sb-surface-muted:var(--sb-theme-button-secondary-background,#f2f2f2);--sb-border:var(--sb-theme-input-border,#0808081f);--sb-border-strong:#0808083d;--sb-border-active:var(--sb-theme-input-focused-border,#080808b3);--sb-text:var(--sb-theme-content-heading,#080808);--sb-text-muted:var(--sb-theme-content-body,#5c5c5c);--sb-overlay:var(--sb-theme-sheet-scrim,#00000061);--sb-ease:cubic-bezier(.2, .9, .2, 1);--sb-fab-motion-ease:cubic-bezier(.649439, .0577174, .124599, 1);--sb-sheet-motion-ease:cubic-bezier(0, .87, .39, 1);font-family:-apple-system,BlinkMacSystemFont,system-ui,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.sb-safe-area-probe{visibility:hidden;pointer-events:none;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);position:fixed;inset:0}.sb-fab{right:16px;bottom:calc(24px + env(safe-area-inset-bottom,0px));z-index:1000;box-sizing:border-box;border:1px solid var(--sb-theme-fab-border,#080808);background:var(--sb-theme-fab-background,#080808);min-width:0;height:60px;color:var(--sb-theme-fab-foreground,#fff);border-color:var(--sb-theme-fab-border,#080808);cursor:pointer;will-change:transform;align-items:center;transition:scale .12s ease-out;display:inline-flex;position:fixed;overflow:hidden}.sb-fab--entering{animation:sb-fab-enter-scale .89016s var(--sb-fab-motion-ease) .259705s both, sb-fab-enter-width .893207s var(--sb-fab-motion-ease) 1.076s both;transform-origin:50%!important}.sb-fab--entering .sb-fab__label{animation:sb-fab-label-in .2s var(--sb-fab-motion-ease) 1.14987s both}.sb-fab--entering .sb-fab__timer{animation:sb-fab-timer-in .2s var(--sb-fab-motion-ease) 1.96921s both}.sb-fab--entering .sb-fab__timer-fill{animation-delay:1.96921s}.sb-fab--exiting{width:var(--sb-fab-exit-width,var(--sb-fab-expanded-width));pointer-events:none;scale:var(--sb-fab-exit-scale,1);translate:var(--sb-fab-exit-offset,0) 0;animation:.292089s cubic-bezier(.677885,.170122,.695982,.997824) .3s forwards sb-fab-exit-width,.390467s cubic-bezier(.362165,.0946429,.49708,.932961) .466372s forwards sb-fab-exit-scale;transform:none;transform-origin:50%!important}.sb-fab--exiting .sb-fab__label{opacity:var(--sb-fab-exit-label-opacity,1);animation:.389727s cubic-bezier(.5,0,.5,1) .3s forwards sb-fab-label-out}.sb-fab--exiting .sb-fab__timer{opacity:var(--sb-fab-exit-timer-opacity,0)}.sb-fab--exiting .sb-fab__badge{animation:.297243s cubic-bezier(.5,0,1,.600461) .398177s forwards sb-fab-badge-out}.sb-next:hover,.sb-next:focus-visible,.sb-button:hover,.sb-button:focus-visible,.sb-choice:hover,.sb-choice:focus-visible{transform:translateY(-1px)}.sb-fab:active{transition-duration:80ms;scale:.97}.sb-fab:focus-visible,.sb-next:focus-visible,.sb-button:focus-visible,.sb-choice:focus-visible,.sb-sheet__close:focus-visible,.sb-sentiment:focus-visible,.sb-sheet-root__overlay:focus-visible{outline-offset:2px;outline:2px solid #6366f1a6}.sb-sheet h2[tabindex="-1"]:focus{outline:none}.sb-fab--expanded{width:var(--sb-fab-expanded-width,auto);border-radius:999px;justify-content:flex-start;gap:12px;min-height:60px;padding:13px 28px 13px 14px}.sb-fab__label{z-index:1;width:var(--sb-fab-label-width,auto);color:currentColor;text-align:left;white-space:nowrap;text-overflow:clip;min-width:0;font-size:14px;font-weight:600;line-height:1;position:relative;overflow:hidden}.sb-fab__badge{z-index:1;background:var(--sb-theme-fab-accent-primary,#f97316);border-radius:50%;flex:none;place-items:center;width:32px;height:32px;display:grid;position:relative}.sb-fab__badge-artwork{background:var(--sb-theme-fab-accent-secondary,#2563eb);border-radius:50%;display:block;position:absolute;inset:5.44px}.sb-fab__badge-image{z-index:2;border-radius:inherit;object-fit:cover;width:100%;height:100%;display:block;position:absolute;inset:0}.sb-fab__badge-glyph-center,.sb-fab__badge-glyph-amber,.sb-fab__badge-glyph-mint,.sb-fab__badge-glyph-rose{border-radius:999px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.sb-fab__badge-glyph-center{background:var(--sb-theme-fab-foreground,#fff);border-radius:3.52px;width:4.16px;height:11.52px}.sb-fab__badge-glyph-amber{background:#fac143;width:2.88px;height:6.72px;translate:-3.04px .8px}.sb-fab__badge-glyph-mint{background:#39c690;width:2.88px;height:5.44px;translate:3.04px -.32px}.sb-fab__badge-glyph-rose{background:#e86398;width:2.56px;height:4.16px;translate:.96px 3.68px}.sb-fab__timer{z-index:0;pointer-events:none;position:absolute;overflow:hidden}.sb-fab__timer--bar{background:var(--sb-theme-fab-timer-track,#08080829);border-radius:999px;height:2px;bottom:4px;left:59px;right:29px}.sb-fab[data-timer-direction=rtl] .sb-fab__timer--bar{left:29px;right:59px}.sb-fab__timer--fill{border-radius:inherit;background:var(--sb-theme-fab-timer-track,#08080829);inset:0}.sb-fab__timer-fill{border-radius:inherit;background:var(--sb-theme-fab-timer-fill,#080808e6);width:100%;height:100%;transform-origin:var(--sb-fab-timer-origin,left);animation:sb-fab-timer-bar var(--sb-timer-duration) linear forwards;display:block}.sb-sheet-root{z-index:1100;position:fixed;inset:0}.sb-sheet-root__overlay{background:var(--sb-overlay);cursor:pointer;border:none;animation:.2s ease-in both sb-overlay-in;position:absolute;inset:0}.sb-sheet-root--exiting{pointer-events:none}.sb-sheet-root--exiting .sb-sheet-root__overlay{animation:.2s ease-in forwards sb-overlay-out}.sb-sheet{width:min(100%,100vw);min-height:418px;padding:24px 20px calc(18px + env(safe-area-inset-bottom,0px));box-sizing:border-box;background:var(--sb-surface);box-shadow:var(--sb-shadow);color:var(--sb-text);animation:sb-sheet-in-mobile .45s var(--sb-sheet-motion-ease) both;border-radius:40px 40px 0 0;position:absolute;bottom:0;left:0;right:0}.sb-sheet--thanks{min-height:381px;padding-top:18px}.sb-sheet__header{justify-content:flex-end;align-items:flex-start;min-height:28px;margin-bottom:22px;display:flex;position:relative}.sb-progress{background:var(--sb-theme-sheet-progress-track,#eaeaea);border-radius:999px;width:219px;max-width:calc(100% - 96px);height:6px;position:absolute;top:5px;left:50%;overflow:hidden;transform:translate(-50%)}.sb-progress__fill{border-radius:inherit;background:var(--sb-theme-sheet-progress-fill,#080808);height:100%;transition:width .22s var(--sb-ease);display:block}.sb-sheet__close{background:var(--sb-theme-sheet-close-button-background,transparent);width:20px;height:20px;color:var(--sb-theme-sheet-close-button-foreground,var(--sb-text));cursor:pointer;border:none;padding:0}.sb-sheet__close svg,.sb-next svg,.sb-thanks__icon-core svg{width:100%;height:100%;display:block}.sb-sheet__body{gap:26px;display:grid}.sb-sheet__copy{justify-items:center;gap:8px;display:grid}.sb-sheet__eyebrow{color:var(--sb-theme-content-helper,var(--sb-text-muted));text-align:center;margin:0;font-size:16px;font-weight:400;line-height:1.4}.sb-sheet__body h2,.sb-thanks__copy h2{color:var(--sb-theme-content-heading,var(--sb-text));text-align:center;margin:0;font-size:22px;font-weight:600;line-height:1.2}.sb-sheet__body h2{justify-self:center;width:min(297px,100%)}.sb-choice--selected,.sb-choice:hover,.sb-textarea-shell:focus-within{border-color:var(--sb-theme-choice-hover-border,var(--sb-border-active))}.sb-choice:hover{background:var(--sb-theme-choice-hover-background,var(--sb-surface));color:var(--sb-theme-choice-hover-foreground,var(--sb-text))}.sb-choice:active{border-color:var(--sb-theme-choice-pressed-border,var(--sb-border-active));background:var(--sb-theme-choice-pressed-background,var(--sb-surface-muted));color:var(--sb-theme-choice-pressed-foreground,var(--sb-text))}.sb-choice--selected{box-shadow:0 0 0 3px #0808080d}.sb-choice:disabled{border-color:var(--sb-theme-choice-disabled-border,#e2e2e2);background:var(--sb-theme-choice-disabled-background,#f2f2f2);color:var(--sb-theme-choice-disabled-foreground,#5c5c5c);cursor:not-allowed}.sb-question--choices{grid-template-columns:repeat(2,160px);justify-content:center;justify-self:center;gap:9px;width:min(330px,100%)}.sb-choice{border:1px solid var(--sb-theme-choice-default-border,#e2e2e2);background:var(--sb-theme-choice-default-background,var(--sb-surface));width:160px;height:51px;color:var(--sb-theme-choice-default-foreground,var(--sb-text));text-align:center;white-space:nowrap;cursor:pointer;transition:transform .2s var(--sb-ease), border-color .18s ease, box-shadow .18s ease, background-color .18s ease;border-radius:999px;justify-content:center;align-items:center;padding:0 16px;font-size:16px;font-weight:700;line-height:1.2;display:flex}.sb-choice__label{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.sb-choice--other{border-color:var(--sb-theme-choice-default-border,#e2e2e2);padding:0;font-weight:400}.sb-choice__other-content{align-items:center;gap:0;display:inline-flex}.sb-choice__other-caret{background:var(--sb-theme-input-foreground,var(--sb-text));flex:none;width:1px;height:22px}.sb-choice__other-label{color:var(--sb-theme-input-placeholder,#08080866);line-height:1.2}.sb-choice--selected{border-color:var(--sb-theme-choice-selected-border,var(--sb-text));background:var(--sb-theme-choice-selected-background,var(--sb-text));color:var(--sb-theme-choice-selected-foreground,var(--sb-surface))}.sb-question--text{justify-self:center;width:min(330px,100%)}.sb-textarea-shell{border:1px solid var(--sb-theme-input-border,#08080833);background:var(--sb-theme-input-background,var(--sb-surface));border-radius:16px;width:100%;min-height:155px;transition:border-color .18s,box-shadow .18s}.sb-textarea{resize:none;width:100%;min-height:155px;color:var(--sb-theme-input-foreground,var(--sb-text));font:inherit;box-sizing:border-box;background:0 0;border:none;outline:none;padding:16px 22px;font-size:16px;line-height:1.2}.sb-textarea::placeholder{color:var(--sb-theme-input-placeholder,#08080866)}.sb-textarea-shell:focus-within{border-color:var(--sb-theme-input-focused-border,var(--sb-border-active))}.sb-textarea:disabled{color:var(--sb-theme-input-disabled-foreground,var(--sb-text-muted))}.sb-textarea-shell:has(.sb-textarea:disabled){background:var(--sb-theme-input-disabled-background,var(--sb-surface-muted))}.sb-sheet__footer{min-height:84px;margin:0 -20px calc(-18px - env(safe-area-inset-bottom,0px));padding:18px 20px calc(18px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--sb-theme-sheet-divider,#e2e2e2);box-sizing:border-box;justify-content:flex-end;align-items:center;gap:16px;display:flex}.sb-next,.sb-button{cursor:pointer;min-height:48px;font:inherit;transition:transform .2s var(--sb-ease), opacity .18s ease, box-shadow .18s ease;border:none;border-radius:999px}.sb-next{background:var(--sb-theme-button-primary-background,#080808);width:101px;color:var(--sb-theme-button-primary-foreground,#fff);place-items:center;padding:0;display:grid}.sb-next--acknowledging svg{animation:.36s cubic-bezier(.2,.8,.2,1) both sb-next-acknowledgement}.sb-next:disabled,.sb-button:disabled{cursor:not-allowed;box-shadow:none;transform:none}.sb-next:disabled{background:var(--sb-theme-button-primary-disabled-background,#080808);color:var(--sb-theme-button-primary-disabled-foreground,#fff)}.sb-thanks{justify-items:center;gap:23px;padding-top:12px;display:grid}.sb-thanks__icon-shell{background:var(--sb-theme-completion-outer-background,#f0f0f0);border-radius:999px;place-items:center;width:120px;height:120px;display:grid}.sb-thanks__icon-core{background:var(--sb-theme-completion-inner-background,#080808);width:66px;height:66px;color:var(--sb-theme-completion-glyph,#fff);border-radius:999px;place-items:center;display:grid}.sb-thanks__copy{gap:8px;max-width:313px;display:grid}.sb-thanks__copy h2{letter-spacing:-.03em;font-size:30px;line-height:1.1}.sb-thanks__copy p{color:var(--sb-theme-content-body,var(--sb-text-muted));text-align:center;margin:0;font-size:14px;line-height:1.3}.sb-thanks__actions{gap:10px;width:100%;display:flex}.sb-button{flex:1 1 0;padding:16px;font-size:14px;font-weight:600;line-height:1}.sb-button--primary{background:var(--sb-theme-button-primary-background,#080808);color:var(--sb-theme-button-primary-foreground,#fff)}.sb-button--secondary{background:var(--sb-theme-button-secondary-background,#f2f2f2);color:var(--sb-theme-button-secondary-foreground,var(--sb-text))}.sb-button--tertiary{background:var(--sb-theme-button-tertiary-background,transparent);color:var(--sb-theme-button-tertiary-foreground,var(--sb-text))}.sb-button--primary:hover,.sb-button--primary:focus-visible{background:var(--sb-theme-button-primary-hover-background,#080808)}.sb-button--secondary:hover,.sb-button--secondary:focus-visible{background:var(--sb-theme-button-secondary-hover-background,#f2f2f2)}.sb-button--tertiary:hover,.sb-button--tertiary:focus-visible{background:var(--sb-theme-button-tertiary-hover-background,#f2f2f2)}.sb-button--primary:active{background:var(--sb-theme-button-primary-pressed-background,#080808)}.sb-button--secondary:active{background:var(--sb-theme-button-secondary-pressed-background,#e2e2e2)}.sb-button--tertiary:active{background:var(--sb-theme-button-tertiary-pressed-background,#e2e2e2)}.sb-button--primary:disabled{background:var(--sb-theme-button-primary-disabled-background,#080808);color:var(--sb-theme-button-primary-disabled-foreground,#fff)}.sb-button--secondary:disabled{background:var(--sb-theme-button-secondary-disabled-background,#f2f2f2);color:var(--sb-theme-button-secondary-disabled-foreground,var(--sb-text))}.sb-button--tertiary:disabled{background:var(--sb-theme-button-tertiary-disabled-background,#f2f2f2);color:var(--sb-theme-button-tertiary-disabled-foreground,var(--sb-text))}@media (width>=768px){.sb-fab{bottom:24px;right:24px}}.sb-sheet-root__overlay{padding:0}.sb-sheet{top:auto;right:auto;bottom:calc(8px + env(safe-area-inset-bottom,0px));width:min(376px,100% - 24px);min-height:0;max-height:calc(100% - 16px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));box-shadow:none;animation:sb-card-in .45s var(--sb-sheet-motion-ease) both;interpolate-size:allow-keywords;border-radius:40px;padding:0;transition:height .45s cubic-bezier(0,.83,.363,.994);position:absolute;left:50%;overflow:hidden;transform:translate(-50%)}.sb-sheet-root--exiting .sb-sheet{animation:.45s ease-in forwards sb-card-out}.sb-sheet--thanks{min-height:0;padding:22px 20px}.sb-sheet__header{height:50px;min-height:0;margin:0;display:block;position:relative}.sb-progress{width:216px;max-width:calc(100% - 96px);height:6px;top:27px}.sb-progress__fill{transition:width .45s var(--sb-sheet-motion-ease)}.sb-sheet__close{box-sizing:border-box;border-radius:1000px;width:40px;height:40px;padding:8px;position:absolute;top:10px;right:16px}.sb-sheet__body{display:block}.sb-step{animation:.25s ease-in-out both sb-step-in}.sb-sheet__copy{box-sizing:border-box;align-content:center;justify-items:center;gap:0;height:88px;padding:0 23px;display:grid}.sb-sheet__body h2{text-align:center;text-wrap:balance;width:100%;margin:0;font-size:19px;font-weight:600;line-height:1.22}.sb-sheet__body--sentiment{padding:12px 24px 22px}.sb-sheet__body--sentiment .sb-sheet__copy{gap:8px;height:auto;min-height:84px;padding:0}.sb-sheet__body--sentiment .sb-sheet__eyebrow{color:var(--sb-theme-content-helper,var(--sb-text-muted));text-align:center;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;font-size:16px;font-weight:400;line-height:1.2;display:-webkit-box;overflow:hidden}.sb-sheet__body--sentiment h2{-webkit-line-clamp:3;-webkit-box-orient:vertical;font-size:22px;font-weight:600;line-height:1.2;display:-webkit-box;overflow:hidden}.sb-sheet__body--sentiment h2.sb-sheet__acknowledgement{align-content:center;min-height:70px;font-size:29px;line-height:1.08;animation:.28s cubic-bezier(.2,.8,.2,1) both sb-acknowledgement-in}.sb-question{justify-items:stretch;display:grid}.sb-question--sentiment{grid-template-columns:repeat(2,80px);justify-content:center;gap:25px;width:185px;margin:37px auto 31px;position:relative}.sb-sheet__body--sentiment:has(.sb-sheet__acknowledgement) .sb-question--sentiment{margin-top:35px}.sb-sentiment{z-index:0;border:1.111px solid var(--sb-theme-choice-default-border,#e2e2e2);background:var(--sb-theme-choice-default-background,var(--sb-surface));width:80px;height:80px;color:var(--sb-theme-choice-default-foreground,var(--sb-text));cursor:pointer;border-radius:50%;place-items:center;padding:0;transition:transform .12s ease-out,border-color .18s,background-color .18s;display:grid;position:relative}.sb-sentiment__icon{z-index:1;width:35.5556px;height:35.5556px}.sb-sentiment__icon svg{width:100%;height:100%;display:block}.sb-sentiment:hover{border-color:var(--sb-theme-choice-hover-border,var(--sb-border-active));background:var(--sb-theme-choice-hover-background,var(--sb-surface));color:var(--sb-theme-choice-hover-foreground,var(--sb-text))}.sb-sentiment:active{border-color:var(--sb-theme-choice-pressed-border,var(--sb-border-active));background:var(--sb-theme-choice-pressed-background,var(--sb-surface-muted));color:var(--sb-theme-choice-pressed-foreground,var(--sb-text));transform:scale(.97)}.sb-sentiment--selected,.sb-sentiment--selected:disabled{border-color:var(--sb-theme-choice-selected-border,var(--sb-text));background:var(--sb-theme-choice-selected-background,var(--sb-text));color:var(--sb-theme-choice-selected-foreground,var(--sb-surface))}.sb-sentiment:disabled:not(.sb-sentiment--selected){border-color:var(--sb-theme-choice-disabled-border,#e2e2e2);background:var(--sb-theme-choice-disabled-background,#f2f2f2);color:var(--sb-theme-choice-disabled-foreground,#5c5c5c)}.sb-sentiment:disabled{cursor:default}.sb-spark-ring{z-index:-1;pointer-events:none;animation:.22s cubic-bezier(.25,.46,.45,.94) both sb-spark-ring-in;position:absolute;inset:-26px}.sb-spark-ring__spark{--sb-spark-angle:calc(var(--sb-spark-index) * 30deg);width:7px;height:7px;transform:translate(-50%, -50%) rotate(var(--sb-spark-angle)) translateY(-54px);background:#dedede;border-radius:50%;position:absolute;top:50%;left:50%}.sb-spark-ring__spark:nth-child(2n){width:12px;height:12px;transform:translate(-50%, -50%) rotate(var(--sb-spark-angle)) translateY(-59px)}.sb-question--choices,.sb-question--text{justify-self:stretch;width:auto;margin:0 24px}.sb-question--choices{scrollbar-gutter:stable;align-content:start;gap:8px;max-height:320.5px;overflow:hidden auto}.sb-question--choices-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sb-question--choices-single{grid-template-columns:minmax(0,1fr)}.sb-question--choices-scrolling{padding-bottom:20px}.sb-choice{white-space:normal;overflow-wrap:anywhere;width:100%;min-width:0;height:51px;padding:0 8px}.sb-question--choices-single .sb-choice{text-align:left;border-radius:16px;justify-content:flex-start;height:auto;min-height:51px;padding:16px 22px}.sb-choice--other{color:var(--sb-theme-input-placeholder,#08080866);gap:0;font-weight:400}.sb-choice--other:before{background:var(--sb-theme-input-foreground,var(--sb-text));flex:0 0 1px;width:1px;height:22px;position:static;transform:none}.sb-question--text{padding-top:10px}.sb-question--other{animation:.25s ease-in-out both sb-step-in}.sb-textarea-shell,.sb-textarea{height:155px;min-height:155px}.sb-textarea{padding:17px 22px;font-size:16px;font-weight:400;line-height:1.2}.sb-sheet__body--question{padding-bottom:16px}.sb-sheet__footer{border-top:1px solid var(--sb-theme-sheet-divider,#e2e2e2);justify-content:flex-end;align-items:center;gap:16px;min-height:84px;margin:0;padding:16px 20px 20px;display:flex}.sb-sheet__footer-comment{color:var(--sb-theme-content-helper,var(--sb-text-muted));text-align:left;-webkit-line-clamp:2;-webkit-box-orient:vertical;flex:auto;margin:0;font-size:16px;font-weight:600;line-height:1.2;animation:.18s ease-out both sb-footer-comment-in,.18s ease-in 1s forwards sb-footer-comment-out;display:-webkit-box;overflow:hidden}.sb-next{flex:0 0 101px;height:48px}.sb-next svg{width:20px;height:20px;transform:none}.sb-sheet--completing .sb-progress__fill{transition-duration:.5s}.sb-thanks{gap:23px;padding:0;animation:.3s ease-in-out .89s both sb-completion-in}.sb-thanks__icon-shell{animation:sb-completion-icon-in .72s var(--sb-sheet-motion-ease) .35s both}.sb-thanks__icon-core svg{width:35.44px;height:27.02px}.sb-thanks__copy{width:100%;max-width:330px}.sb-thanks__copy h2{letter-spacing:-.6px;font-weight:600}.sb-thanks__copy p{max-width:292px;margin-inline:auto;line-height:1.5}.sb-thanks__actions{gap:10px}.sb-choice-measure{white-space:nowrap;visibility:hidden;width:max-content;padding:0 8px;font-size:16px;font-weight:700;position:fixed;top:-10000px;left:-10000px}.sb-choice-measure--other{padding-left:9px;padding-right:8px;font-weight:400}@keyframes sb-fab-enter-scale{0%{scale:0}to{scale:1}}@keyframes sb-fab-enter-width{0%{width:60px;translate:var(--sb-fab-anchor-offset) 0}to{width:var(--sb-fab-expanded-width);translate:0}}@keyframes sb-fab-label-in{0%{opacity:0}to{opacity:1}}@keyframes sb-fab-timer-in{0%{opacity:0}to{opacity:1}}@keyframes sb-fab-exit-width{0%{width:var(--sb-fab-exit-width,var(--sb-fab-expanded-width));translate:var(--sb-fab-exit-offset,0) 0}to{width:60px;translate:var(--sb-fab-anchor-offset) 0}}@keyframes sb-fab-label-out{0%{opacity:var(--sb-fab-exit-label-opacity,1)}to{opacity:0}}@keyframes sb-fab-badge-out{0%{scale:1}to{scale:0}}@keyframes sb-fab-exit-scale{0%{scale:var(--sb-fab-exit-scale,1)}to{scale:0}}@keyframes sb-sheet-in-mobile{0%{opacity:0;transform:translateY(28px)}to{opacity:1;transform:translateY(0)}}@keyframes sb-sheet-in-desktop{0%{opacity:0;transform:translate(-50%,calc(28px - 50%))}to{opacity:1;transform:translate(-50%,-50%)}}@keyframes sb-sheet-out-mobile{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(100%)}}@keyframes sb-sheet-out-desktop{0%{opacity:1;transform:translate(-50%,-50%)}to{opacity:0;transform:translate(-50%,100vh)}}@keyframes sb-overlay-in{0%{opacity:0}to{opacity:1}}@keyframes sb-overlay-out{0%{opacity:1}to{opacity:0}}@keyframes sb-fab-timer-bar{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@keyframes sb-card-in{0%{opacity:0;transform:translate(-50%,28px)}to{opacity:1;transform:translate(-50%)}}@keyframes sb-card-out{0%{opacity:1;transform:translate(-50%)}to{opacity:0;transform:translate(-50%,calc(100% + 8px))}}@keyframes sb-step-in{0%{opacity:0}to{opacity:1}}@keyframes sb-acknowledgement-in{0%{opacity:0;transform:scale(1.12)}to{opacity:1;transform:scale(1)}}@keyframes sb-next-acknowledgement{0%,to{rotate:0deg;scale:1}39%{rotate:-14deg;scale:1.18}}@keyframes sb-spark-ring-in{0%{opacity:0;transform:scale(.55)}to{opacity:1;transform:scale(1)}}@keyframes sb-footer-comment-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes sb-footer-comment-out{0%{opacity:1}to{opacity:0}}@keyframes sb-completion-icon-in{0%{opacity:0;transform:translateY(46px)scale(.72)}58%{opacity:1;transform:translateY(46px)scale(1.82)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes sb-completion-in{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){.sb-fab--entering,.sb-fab--entering .sb-fab__label,.sb-fab--entering .sb-fab__timer,.sb-fab--exiting,.sb-fab--exiting .sb-fab__label,.sb-fab--exiting .sb-fab__badge,.sb-sheet,.sb-step,.sb-spark-ring,.sb-sheet__acknowledgement,.sb-sheet__footer-comment,.sb-thanks,.sb-thanks__icon-shell,.sb-sheet-root__overlay,.sb-sheet-root--exiting .sb-sheet,.sb-sheet-root--exiting .sb-sheet-root__overlay{animation-duration:.001ms;animation-delay:0s}.sb-fab--entering .sb-fab__timer-fill{animation-delay:0s}.sb-sheet__footer-comment{animation:none}}`;function J(e,t){let n=document.createElement(e);return n.className=t,n}var Dt=class{root=J(`div`,`sb-snackbar-root`);shell=J(`div`,`sb-snackbar-shell`);surface=J(`div`,`sb-snackbar-surface`);compact=J(`div`,`sb-snackbar-compact`);card=J(`div`,`sb-snackbar-card`);overlay=document.createElement(`button`);close=document.createElement(`button`);acknowledgement=J(`span`,`sb-bar-acknowledgement`);acknowledgementCopy=J(`span`,`sb-bar-acknowledgement-copy`);barContent=J(`div`,`sb-bar-content`);answers=new Map;timers=new Set;observer;session;stage=`entering`;expanded=!1;destroyed=!1;seen=!1;cancelVisibilityGate=null;store;safeAreaProbe;renderCard;onReady;constructor(e,t,n,r,i,a){this.store=e,this.safeAreaProbe=r,this.renderCard=i,this.onReady=a,this.session=t;let o=t.sentimentPresentation===`bar`;this.root.dataset.presentation=t.sentimentPresentation,this.root.dataset.position=t.barPosition;let s=t.survey.questions[t.survey.root_node_id],{imageUrl:c}=x(s,t.survey.fab);this.compact.setAttribute(`role`,`group`),this.compact.setAttribute(`aria-label`,s.prompt);let l=J(`span`,`sb-snackbar-artwork`);l.setAttribute(`aria-hidden`,`true`);let u=J(`span`,`sb-fab__badge-artwork`);for(let e of[`center`,`amber`,`mint`,`rose`])u.append(J(`span`,`sb-fab__badge-glyph-${e}`));if(l.append(u),c){let e=document.createElement(`img`);e.src=c,e.alt=``,e.addEventListener(`error`,()=>e.remove(),{once:!0}),l.append(e)}let d=J(`p`,`sb-snackbar-prompt`);d.textContent=s.prompt,o&&t.barBehavior===`dismiss`&&(this.acknowledgement.setAttribute(`role`,`status`),this.acknowledgement.append(this.acknowledgementCopy));let f=J(`div`,`sb-snackbar-answers`);for(let n of s.answers??[]){let r=document.createElement(`button`);r.type=`button`,r.className=`sb-snackbar-answer`,r.setAttribute(`aria-label`,n.label),r.innerHTML=A(n)?q:Tt,r.addEventListener(`click`,()=>{this.confirmSeenByUser(),e.answerSnackbar(t.presentationId,n.id)}),this.answers.set(n.id,r),f.append(r)}let p=t.survey.fab?.timerStyle??`none`,m=null;p!==`none`&&(m=J(`span`,`sb-snackbar-timer sb-snackbar-timer--${p}`),m.setAttribute(`aria-hidden`,`true`),m.append(J(`span`,`sb-snackbar-timer-fill`)),p===`bar`&&!o?d.append(m):this.compact.append(m)),o||this.compact.append(l),o?(this.barContent.append(d,f),this.compact.append(this.barContent)):this.compact.append(d,f),this.overlay.type=`button`,this.overlay.className=`sb-snackbar-overlay`,this.overlay.tabIndex=-1,this.overlay.setAttribute(`aria-hidden`,`true`),this.overlay.addEventListener(`click`,()=>void e.closeSurvey()),this.close.type=`button`,this.close.className=o?`sb-bar-dismiss`:`sb-snackbar-close`,o?this.close.textContent=`Not Now`:(this.close.setAttribute(`aria-label`,`Close survey`),this.close.innerHTML=St),this.close.addEventListener(`click`,this.closeByUser),this.surface.append(this.compact,this.card),this.shell.append(this.surface),o?this.compact.append(this.close):this.shell.append(this.close),o&&t.barBehavior===`dismiss`&&this.compact.append(this.acknowledgement),this.root.append(this.overlay,this.shell),n.append(this.root),this.observer=typeof ResizeObserver>`u`?null:new ResizeObserver(this.updatePlacement),this.observer?.observe(this.compact),this.observer?.observe(this.card),window.addEventListener(`resize`,this.updatePlacement),window.visualViewport?.addEventListener(`resize`,this.updatePlacement),window.visualViewport?.addEventListener(`scroll`,this.updatePlacement),o&&(this.surface.addEventListener(`pointerenter`,this.onPointerEnter),this.surface.addEventListener(`pointerleave`,this.onPointerLeave)),this.update(t),this.after(ht(o,this.reducedMotion()),this.startVisibilityGate),this.after(o?this.reducedMotion()?W.reduced:mt:this.reducedMotion()?0:p===`none`?U.entrance:U.timerEntrance,()=>{this.stage=`compact`,this.updateStage(),e.confirmEntryDisplayed(t.presentationId),e.confirmFabEntranceCompleted(t.presentationId),this.startVisibilityGate(),o&&this.surface.matches(`:hover`)&&window.matchMedia?.(`(hover: hover)`).matches&&e.setBarTimerPaused(t.presentationId,!0)})}startVisibilityGate=()=>{this.seen||this.cancelVisibilityGate||this.destroyed||(this.cancelVisibilityGate=nt(this.surface,()=>{this.cancelVisibilityGate=null,this.markSeen()}))};markSeen(){this.seen||this.destroyed||(this.seen=!0,this.cancelVisibilityGate?.(),this.cancelVisibilityGate=null,this.store.confirmPresentation(`expanded_fab`,this.session.presentationId))}confirmSeenByUser(){document.visibilityState!==`hidden`&&this.markSeen()}closeByUser=()=>{this.confirmSeenByUser(),this.store.closeSurvey()};update(e){this.session=e;for(let[t,n]of Object.entries(pt(e.survey.theme)))this.root.style.setProperty(t,n);this.root.style.setProperty(`--sb-snackbar-duration`,`${e.survey.fab?.expandedTimeout??0}ms`),this.root.style.setProperty(`--sb-snackbar-fraction`,String(e.snackbar?.frozenFraction??1)),this.root.dataset.counting=String(e.snackbar?.deadline!=null||e.snackbar?.pausedRemainingMs!=null),this.root.dataset.paused=String(e.snackbar?.pausedRemainingMs!=null),this.root.dataset.timed=String((e.survey.fab?.timerStyle===`bar`||e.survey.fab?.timerStyle===`fill`)&&typeof e.survey.fab.expandedTimeout==`number`&&e.survey.fab.expandedTimeout>0),this.root.dataset.frozen=String(e.snackbar?.frozenFraction!=null),this.root.dataset.expanded=String(e.isOpen),this.root.dataset.behavior=e.barBehavior;let t=e.sentimentPresentation===`bar`&&e.barBehavior===`dismiss`&&e.snackbar?.selectedKey!=null;if(this.root.dataset.rated=String(t),this.barContent.inert=t,this.barContent.toggleAttribute(`inert`,t),this.barContent.setAttribute(`aria-hidden`,String(t)),e.sentimentPresentation===`bar`&&e.barBehavior===`dismiss`){let t=e.survey.questions[e.survey.root_node_id].answers?.find(t=>t.id===e.snackbar?.selectedKey),n=t?t.comment?.trim()||`Thanks for your feedback.`:``;this.acknowledgementCopy.textContent!==n&&(this.acknowledgementCopy.textContent=n)}for(let[t,n]of this.answers)n.disabled=!e.fabEntranceCompleted||e.snackbar?.phase!==`question`,n.setAttribute(`aria-pressed`,String(e.snackbar?.selectedKey===t));if(e.isOpen){let t=this.renderCard(e);this.card.contains(t)||this.card.replaceChildren(t),this.expanded||(this.expanded=!0,this.stage=`widening`,this.after(this.reducedMotion()?0:U.widen,()=>{this.stage=`expanding`,this.updateStage()}),this.after(this.reducedMotion()?0:U.widen+U.expand,()=>{this.stage=`ready`,this.updateStage(),this.store.confirmPresentation(`sheet`,e.presentationId),this.store.confirmSnackbarContentReady(e.presentationId),this.onReady()}))}this.updateStage()}updateStage(){this.root.dataset.stage=this.stage,this.compact.inert=this.session.isOpen||this.stage===`entering`||this.stage===`exiting`,this.compact.toggleAttribute(`inert`,this.compact.inert),this.compact.setAttribute(`aria-hidden`,String(this.compact.inert)),this.card.inert=this.stage!==`ready`,this.card.toggleAttribute(`inert`,this.card.inert),this.card.setAttribute(`aria-hidden`,String(this.card.inert)),this.overlay.disabled=this.stage!==`ready`,this.close.disabled=this.session.isOpen||this.stage===`exiting`||this.root.dataset.rated===`true`,this.updatePlacement()}updatePlacement=()=>{if(this.stage===`exiting`)return;let e=window.visualViewport,t=e?.width||window.innerWidth,n=e?.height||window.innerHeight,r=getComputedStyle(this.safeAreaProbe),i=e=>Number.parseFloat(e)||0,{survey:a}=this.session,{placement:o}=x(a.questions[a.root_node_id],a.fab),s={viewport:{width:t,height:n},safeArea:{left:i(r.paddingLeft),right:i(r.paddingRight),top:i(r.paddingTop),bottom:i(r.paddingBottom)},compactHeight:64,cardHeight:this.card.querySelector(`.sb-sheet`)?.offsetHeight||0,barPosition:this.session.sentimentPresentation===`bar`?this.session.barPosition:void 0};this.root.style.setProperty(`--sb-snackbar-compact-width`,`${gt(o,s).compactWidth}px`);let c=this.root.dataset.rated===`true`;c&&(this.compact.style.minHeight=`48px`);let l=getComputedStyle(this.compact),u=Number.parseFloat(l.height)||this.compact.offsetHeight||(s.barPosition?48:64),d=c?Math.max(u,this.acknowledgementCopy.scrollHeight+i(l.paddingTop)+i(l.paddingBottom)):u;c&&this.compact.style.removeProperty(`min-height`);let f=gt(o,{...s,compactHeight:d});this.root.style.left=`${e?.offsetLeft??0}px`,this.root.style.top=`${e?.offsetTop??0}px`,this.root.style.width=`${t}px`,this.root.style.height=`${n}px`;let p=[`widening`,`expanding`,`ready`].includes(this.stage);this.root.style.setProperty(`--sb-bar-top`,`${p?f.cardTop:0}px`);let m=[`expanding`,`ready`].includes(this.stage),h={left:p?f.cardLeft:f.compactLeft,bottom:p?f.cardBottom:f.compactBottom,width:p?f.cardWidth:f.compactWidth,height:m?f.cardHeight:d,"compact-height":d,"card-width":f.cardWidth,"compact-width":f.compactWidth,"entrance-offset":f.entranceOffset,"max-height":f.maxCardHeight};for(let[e,t]of Object.entries(h))this.root.style.setProperty(`--sb-snackbar-${e}`,`${t}px`);this.shell.style.transformOrigin=f.transformOrigin};reducedMotion(){return window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}onPointerEnter=e=>{e.pointerType===`mouse`&&window.matchMedia?.(`(hover: hover)`).matches&&this.store.setBarTimerPaused(this.session.presentationId,!0)};onPointerLeave=()=>this.store.setBarTimerPaused(this.session.presentationId,!1);exit(e){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.stage=`exiting`,this.root.dataset.exiting=`true`;for(let e of this.answers.values())e.disabled=!0;this.updateStage(),this.after(this.reducedMotion()?W.reduced:W.removal,()=>{this.destroy(),e()})}after(e,t){let n=setTimeout(()=>{this.timers.delete(n),this.destroyed||t()},e);this.timers.add(n)}destroy(){this.destroyed=!0;for(let e of this.timers)clearTimeout(e);this.cancelVisibilityGate?.(),this.cancelVisibilityGate=null,this.observer?.disconnect(),window.removeEventListener(`resize`,this.updatePlacement),window.visualViewport?.removeEventListener(`resize`,this.updatePlacement),window.visualViewport?.removeEventListener(`scroll`,this.updatePlacement),this.surface.removeEventListener(`pointerenter`,this.onPointerEnter),this.surface.removeEventListener(`pointerleave`,this.onPointerLeave),this.root.remove()}},Ot=1969.207,kt=2169.207,At=856.839,jt=450;function Y(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function X(e,t){let n=Y(`button`,e);return n.type=`button`,t&&n.setAttribute(`aria-label`,t),n}var Mt=0,Nt=class{host;root;store;unsubscribe;continueButton=null;activeFabEl=null;activeFabIdentity=null;outgoingFabEls=new Set;fabExitTimers=new Set;fabEntranceTimer=null;fabSettlingTimer=null;sheetEl=null;sheetRootEl=null;sheetExitTimer=null;progressTimer=null;completionRevealTimer=null;renderedProgress=null;renderedSheetStep=null;restoreFocus=null;restoreFocusPending=!1;safeAreaProbe;uiId=++Mt;snackbarUi=null;snackbarIdentity=null;outgoingSnackbarUis=new Set;constructor(e,t=document.body){this.store=e,this.host=Y(`div`),this.host.setAttribute(`data-sideband`,``),this.host.tabIndex=-1;let n=this.host.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=Et,n.appendChild(r),this.safeAreaProbe=Y(`div`,`sb-safe-area-probe`),n.appendChild(this.safeAreaProbe),this.root=Y(`div`),n.appendChild(this.root),t.appendChild(this.host),this.applyTheme(),this.unsubscribe=e.subscribe(e=>{if(e===`text`){this.updateContinueButton();return}if(e===`select`){let e=this.focusedChoiceValue();this.render();let t=this.root.querySelector(`.sb-question--other-text .sb-textarea`);if(t){t.focus();return}if(e){for(let t of this.root.querySelectorAll(`[data-choice-value]`))if(t.dataset.choiceValue===e){t.focus();break}}return}this.render(e===`transition`)}),window.addEventListener(`keydown`,this.onKeyDown),window.addEventListener(`resize`,this.onViewportChange),window.addEventListener(`orientationchange`,this.onViewportChange),window.visualViewport?.addEventListener(`resize`,this.onViewportChange),window.visualViewport?.addEventListener(`scroll`,this.onViewportChange),this.render()}destroy(){this.unsubscribe(),this.snackbarUi?.destroy();for(let e of this.outgoingSnackbarUis)e.destroy();this.outgoingSnackbarUis.clear(),this.clearFabEntranceTimer();for(let e of this.fabExitTimers)clearTimeout(e);this.fabExitTimers.clear(),this.sheetExitTimer!==null&&(clearTimeout(this.sheetExitTimer),this.sheetExitTimer=null),this.progressTimer!==null&&clearTimeout(this.progressTimer),this.completionRevealTimer!==null&&clearTimeout(this.completionRevealTimer),window.removeEventListener(`keydown`,this.onKeyDown),window.removeEventListener(`resize`,this.onViewportChange),window.removeEventListener(`orientationchange`,this.onViewportChange),window.visualViewport?.removeEventListener(`resize`,this.onViewportChange),window.visualViewport?.removeEventListener(`scroll`,this.onViewportChange),this.host.remove()}onKeyDown=e=>{if(e.key===`Escape`&&(this.store.getState()?.isOpen||this.snackbarUi&&this.host.shadowRoot?.activeElement)){this.snackbarUi&&!this.store.getState()?.isOpen?this.snackbarUi.closeByUser():this.store.closeSurvey();return}if(e.key!==`Tab`||!this.sheetEl||this.store.getState()?.snackbar?.phase===`awaitingReady`)return;let t=Array.from(this.sheetEl.querySelectorAll(`button:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`));if(!t.length){e.preventDefault(),this.sheetEl.querySelector(`[tabindex="-1"]`)?.focus();return}let n=this.root.getRootNode(),r=n instanceof ShadowRoot?n.activeElement:null,i=t.indexOf(r),a=e.shiftKey?i<=0?t.length-1:i-1:i===t.length-1?0:i+1;e.preventDefault(),t[a]?.focus()};focusTextArea(e){queueMicrotask(()=>{e.isConnected&&!e.disabled&&e.focus()})}selectedChoice(e){let t=this.store.currentDraft()?.answer_key;return e.answers?.find(e=>w(e)===t)}selectedChoiceComment(e){return this.selectedChoice(e)?.comment?.trim()||null}estimatedTextWidth(e){let t=0;for(let n of e)t+=/[MW@#%&]/.test(n)?11:/[ilI1.,' ]/.test(n)?4:7.5;return Math.ceil(t)}onViewportChange=()=>{let e=this.store.getState(),t=this.root.querySelector(`.sb-fab`);e?.fabState===`expanded`&&!e.isOpen&&t&&this.updateFabPlacement(t,e)};render(e=!1){let t=this.store.getState();if(this.continueButton=null,t){for(let e of this.outgoingSnackbarUis)e.destroy();this.outgoingSnackbarUis.clear(),this.restoreFocusPending=!1,this.applyTheme(t.survey.theme)}if(this.snackbarUi&&this.snackbarIdentity!==t?.presentationId){let e=this.snackbarUi;!t&&e.root.dataset.presentation===`bar`?(this.outgoingSnackbarUis.add(e),e.exit(()=>{this.outgoingSnackbarUis.delete(e),this.restoreFocusWhenAnimationsComplete()})):e.destroy(),this.snackbarUi=null,this.snackbarIdentity=null,this.sheetEl=null,this.sheetRootEl=null}if(t?.snackbar){this.snackbarUi?(this.snackbarUi.update(t),e&&t.snackbar.phase===`journey`&&this.focusSheet()):(this.startActiveFabExit(),this.sheetExitTimer!==null&&clearTimeout(this.sheetExitTimer),this.sheetRootEl?.remove(),this.sheetEl=null,this.sheetRootEl=null,this.restoreFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.snackbarIdentity=t.presentationId,this.snackbarUi=new Dt(this.store,t,this.root,this.safeAreaProbe,e=>this.sheetEl&&this.sheetRootEl?(this.fillSheet(this.sheetEl,e),this.sheetRootEl):this.renderSheet(e),()=>this.focusSheet()));return}if(t&&(t.isOpen||t.completion)){this.startActiveFabExit(),this.sheetRootEl?.classList.contains(`sb-sheet-root--exiting`)&&(this.sheetExitTimer!==null&&(clearTimeout(this.sheetExitTimer),this.sheetExitTimer=null),this.sheetRootEl.classList.remove(`sb-sheet-root--exiting`)),this.sheetEl&&this.root.contains(this.sheetEl)?this.fillSheet(this.sheetEl,t):this.root.appendChild(this.renderSheet(t)),e&&this.focusSheet(),this.store.confirmPresentation(`sheet`);return}if(this.startSheetExit(),!t){this.startActiveFabExit(),this.restoreFocusPending=!0,this.restoreFocusWhenAnimationsComplete();return}if(t.fabState!==`hidden`){let e=typeof t.survey.impression_id==`string`?`${t.survey.pulse_id}:${t.survey.version}:${t.survey.impression_id}`:`${t.survey.pulse_id}:${t.survey.version}`;if(this.activeFabEl&&this.activeFabIdentity===e){this.applyFabPresentation(this.activeFabEl,t);return}this.startActiveFabExit();let n=this.renderFab(t);this.activeFabEl=n,this.activeFabIdentity=e,this.root.appendChild(n),this.applyFabPresentation(n,t),this.startFabEntranceConfirmation(n,e)}}updateContinueButton(){if(!this.continueButton)return;let e=this.store.getState();this.continueButton.disabled=!!e?.isBusy||!this.store.canContinue()}renderFab(e){let{survey:t,fabState:n}=e,r=C(t),i=X(`sb-fab sb-fab--${n} sb-fab--entering`,r);i.addEventListener(`click`,()=>{this.restoreFocus=i,this.store.openSurvey()});let a=Y(`span`,`sb-fab__badge`);if(a.setAttribute(`aria-hidden`,`true`),t.fab?.imageUrl){let e=Y(`img`,`sb-fab__badge-image`);e.src=t.fab.imageUrl,e.alt=``,e.addEventListener(`error`,()=>e.remove(),{once:!0}),a.appendChild(e)}let o=Y(`span`,`sb-fab__badge-artwork`);if(o.appendChild(Y(`span`,`sb-fab__badge-glyph-center`)),o.appendChild(Y(`span`,`sb-fab__badge-glyph-amber`)),o.appendChild(Y(`span`,`sb-fab__badge-glyph-mint`)),o.appendChild(Y(`span`,`sb-fab__badge-glyph-rose`)),a.appendChild(o),i.appendChild(a),n===`expanded`){let e=Y(`span`,`sb-fab__label`);e.textContent=r,i.appendChild(e)}return i}applyTheme(e){let t=e?ft(e):ut;for(let[e,n]of Object.entries(t))this.host.style.setProperty(e,n)}applyFabPresentation(e,t){this.updateFabPlacement(e,t),this.applyFabTimer(e,t)}updateFabPlacement(e,t){let n=window.visualViewport,r=n&&Number.isFinite(n.width)&&n.width>0?n.width:window.innerWidth,i=n&&Number.isFinite(n.height)&&n.height>0?n.height:window.innerHeight,a=n&&Number.isFinite(n.offsetLeft)?n.offsetLeft:0,o=n&&Number.isFinite(n.offsetTop)?n.offsetTop:0,s=this.readSafeArea(),c=e.querySelector(`.sb-fab__label`),l=c?c.scrollWidth||c.getBoundingClientRect().width||this.estimatedTextWidth(c.textContent??``):0,u=Math.max(0,r-s.left-s.right),d=Math.min(u,Math.max(86,86+Math.ceil(l))),f=e.getBoundingClientRect(),p=e.offsetHeight||f.height||60,m=bt(t.survey.fab?.placement,{viewport:{width:r,height:i},element:{width:d,height:p},safeArea:s});e.style.left=`${m.left+a}px`,e.style.top=`${m.top+o}px`,e.style.right=`auto`,e.style.bottom=`auto`,e.style.transformOrigin=m.transformOrigin,e.style.setProperty(`--sb-fab-expanded-width`,`${d}px`),e.style.setProperty(`--sb-fab-label-width`,`${Math.max(0,d-86)}px`);let h=Math.max(0,Math.min(1,t.survey.fab?.placement?.anchor.x??1));e.style.setProperty(`--sb-fab-anchor-offset`,`${(d-60)*h}px`)}applyFabTimer(e,t){let n=xt(t.survey.fab?.timerStyle,t.survey.fab?.expandedTimeout,`forward`),r=`${n.style}:${n.durationMs??`static`}`,i=e.querySelector(`.sb-fab__timer`);e.dataset.timerStyle=n.style;for(let[t,r]of Object.entries(n.cssVariables))e.style.setProperty(t,r);if(!n.visible){i?.remove(),delete e.dataset.timerSignature;return}let a=this.getTextDirection();if(e.style.setProperty(`--sb-fab-timer-origin`,a===`rtl`?`right`:`left`),e.dataset.timerDirection=a,i&&e.dataset.timerSignature===r)return;i?.remove();let o=Y(`span`,`sb-fab__timer sb-fab__timer--${n.style}`);o.setAttribute(`aria-hidden`,`true`),o.appendChild(Y(`span`,`sb-fab__timer-fill`)),e.appendChild(o),e.dataset.timerSignature=r}startFabEntranceConfirmation(e,t){this.clearFabEntranceTimer();let n=this.prefersReducedMotion();this.fabEntranceTimer=setTimeout(()=>{this.fabEntranceTimer=null,!(this.activeFabEl!==e||this.activeFabIdentity!==t)&&(this.store.confirmPresentation(`expanded_fab`),this.store.confirmFabEntranceCompleted())},n?0:Ot);let r=e.querySelector(`.sb-fab__timer`)?kt:Ot;this.fabSettlingTimer=setTimeout(()=>{this.fabSettlingTimer=null,this.activeFabEl===e&&this.activeFabIdentity===t&&e.classList.remove(`sb-fab--entering`)},n?0:r)}clearFabEntranceTimer(){this.fabEntranceTimer!==null&&(clearTimeout(this.fabEntranceTimer),this.fabEntranceTimer=null),this.fabSettlingTimer!==null&&(clearTimeout(this.fabSettlingTimer),this.fabSettlingTimer=null)}startActiveFabExit(){let e=this.activeFabEl;if(!e)return;this.clearFabEntranceTimer();let t=getComputedStyle(e),n=Number.parseFloat(t.width)||e.offsetWidth||314,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`);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`),e.classList.remove(`sb-fab--entering`),e.classList.add(`sb-fab--exiting`),e.disabled=!0,e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,this.activeFabEl=null,this.activeFabIdentity=null,this.outgoingFabEls.add(e);let c=this.prefersReducedMotion()?0:At,l=setTimeout(()=>{this.fabExitTimers.delete(l),this.outgoingFabEls.delete(e),e.remove(),this.restoreFocusWhenAnimationsComplete()},c);this.fabExitTimers.add(l)}startSheetExit(){let e=this.sheetRootEl;if(!e||e.classList.contains(`sb-sheet-root--exiting`))return;e.classList.add(`sb-sheet-root--exiting`),e.setAttribute(`aria-hidden`,`true`),e.querySelectorAll(`button`).forEach(e=>{e.disabled=!0}),this.sheetEl=null;let t=this.prefersReducedMotion()?0:jt;this.sheetExitTimer=setTimeout(()=>{this.sheetExitTimer=null,this.sheetRootEl===e&&(e.remove(),this.sheetRootEl=null,this.restoreFocusWhenAnimationsComplete())},t)}restoreFocusWhenAnimationsComplete(){!this.restoreFocusPending||this.activeFabEl||this.outgoingFabEls.size>0||this.outgoingSnackbarUis.size>0||this.sheetRootEl||(this.restoreFocus?.isConnected?this.restoreFocus.focus():this.restoreFocus&&this.host.focus(),this.restoreFocus=null,this.restoreFocusPending=!1,this.applyTheme())}prefersReducedMotion(){return window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}focusSheet(){(this.sheetEl?.querySelector(`.sb-textarea[autofocus]`)??this.sheetEl?.querySelector(`.sb-sheet__body h2, .sb-thanks__copy h2`)??this.sheetEl?.querySelector(`.sb-sheet__close, .sb-thanks__actions .sb-button`))?.focus()}getTextDirection(){return(this.host.getAttribute(`dir`)||getComputedStyle(this.host).direction)===`rtl`||document.documentElement.dir===`rtl`?`rtl`:`ltr`}focusedChoiceValue(){let e=this.root.getRootNode(),t=e instanceof ShadowRoot?e.activeElement:null;return t instanceof HTMLElement?t.dataset.choiceValue:void 0}readSafeArea(){let e=getComputedStyle(this.safeAreaProbe),t=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?Math.max(0,t):0};return{top:t(e.paddingTop),right:t(e.paddingRight),bottom:t(e.paddingBottom),left:t(e.paddingLeft)}}renderSheet(e){let t=Y(`div`,`sb-sheet-root`),n=X(`sb-sheet-root__overlay`,`Dismiss survey`);n.tabIndex=-1,n.addEventListener(`click`,()=>void this.store.closeSurvey()),t.appendChild(n);let r=Y(`div`,`sb-sheet`);return r.setAttribute(`role`,`dialog`),r.setAttribute(`aria-modal`,`true`),t.appendChild(r),this.sheetEl=r,this.sheetRootEl=t,this.renderedSheetStep=null,this.fillSheet(r,e),t}fillSheet(e,t){if(this.completionRevealTimer!==null&&(clearTimeout(this.completionRevealTimer),this.completionRevealTimer=null),e.classList.toggle(`sb-sheet--thanks`,!!t.completion),e.classList.toggle(`sb-sheet--sentiment`,!t.completion&&this.store.isSentimentStep()),e.classList.toggle(`sb-sheet--completing`,t.isCompleting),e.toggleAttribute(`aria-busy`,t.isCompleting),e.replaceChildren(),t.completion){this.renderedSheetStep=null,e.setAttribute(`aria-labelledby`,`sb-completion-${this.uiId}`),e.setAttribute(`aria-describedby`,`sb-completion-body-${this.uiId}`);let n=this.renderThankYou(t);e.appendChild(n),this.completionRevealTimer=setTimeout(()=>{this.completionRevealTimer=null,n.isConnected&&(n.querySelectorAll(`[data-reveal-content]`).forEach(e=>{e.removeAttribute(`aria-hidden`)}),n.querySelectorAll(`.sb-button`).forEach(e=>{e.disabled=!!this.store.getState()?.isBusy}),n.querySelector(`h2`)?.focus())},this.prefersReducedMotion()?0:890);return}let n=this.store.currentQuestion();n&&(e.setAttribute(`aria-labelledby`,`sb-question-${this.uiId}`),e.removeAttribute(`aria-describedby`),this.renderQuestionSheet(e,t,n))}renderQuestionSheet(e,t,n){let r=this.store.isSentimentStep(),i=this.selectedChoice(n),a=!!(i&&k(i)),o=`${t.presentationId}:${n.node_id}:${a?`text`:`question`}`,s=this.renderedSheetStep!==o;this.renderedSheetStep=o;let c=Y(`div`,`sb-sheet__header`);if(r)this.renderedProgress=null;else{let e=Y(`div`,`sb-progress`);e.setAttribute(`aria-hidden`,`true`);let n=Y(`span`,`sb-progress__fill`),r=Math.max(0,Math.min(1,t.isCompleting?1:this.store.progress())),i=this.renderedProgress??0;n.style.width=`${i*100}%`,this.renderedProgress=r,this.progressTimer!==null&&clearTimeout(this.progressTimer),this.progressTimer=setTimeout(()=>{this.progressTimer=null,n.isConnected&&(n.style.width=`${r*100}%`)},i===0?100:0),e.appendChild(n),c.appendChild(e)}let l=X(`sb-sheet__close`,`Close survey`);l.addEventListener(`click`,()=>void this.store.closeSurvey()),c.appendChild(l),e.appendChild(c);let u=Y(`div`,`sb-sheet__body ${s?`sb-step`:``} ${r?`sb-sheet__body--sentiment`:`sb-sheet__body--question`}`),d=Y(`div`,`sb-sheet__copy`),f=r?this.selectedChoiceComment(n):null;if(r&&!f){let e=Y(`p`,`sb-sheet__eyebrow`);e.textContent=t.survey.title,d.appendChild(e)}let p=Y(`h2`);if(p.id=`sb-question-${this.uiId}`,p.tabIndex=-1,p.textContent=f??n.prompt,f&&(p.className=`sb-sheet__acknowledgement`,p.setAttribute(`aria-live`,`polite`)),d.appendChild(p),u.appendChild(d),u.appendChild(this.renderQuestionView(n,r)),e.appendChild(u),this.store.shouldShowContinue()){let r=Y(`div`,`sb-sheet__footer`),i=this.selectedChoiceComment(n);if(i){let e=Y(`p`,`sb-sheet__footer-comment`);e.textContent=i,e.setAttribute(`aria-live`,`polite`),r.appendChild(e)}let a=X(`sb-next`,`Continue`);this.selectedChoice(n)&&a.classList.add(`sb-next--acknowledging`),a.innerHTML=Ct,a.disabled=t.isBusy||t.isCompleting||!this.store.canContinue(),a.addEventListener(`click`,()=>void this.store.advance()),r.appendChild(a),e.appendChild(r),this.continueButton=a}}renderQuestionView(e,t){let n=this.store.currentDraft(),r=this.store.getState(),i=!!(r?.isBusy||r?.isCompleting);if(t){let e=Y(`div`,`sb-question sb-question--sentiment`);return this.store.sentimentChoices().forEach(t=>{let a=n?.answer_key===w(t),o=X(`sb-sentiment ${a?`sb-sentiment--selected`:``}`,t.label);o.dataset.choiceValue=w(t),o.disabled=i||!!r?.sentimentSelectionLocked,o.setAttribute(`aria-pressed`,String(a));let s=A(t);if(a&&s){let e=Y(`span`,`sb-spark-ring`);e.setAttribute(`aria-hidden`,`true`);for(let t=0;t<12;t+=1){let n=Y(`span`,`sb-spark-ring__spark`);n.style.setProperty(`--sb-spark-index`,String(t)),e.appendChild(n)}o.appendChild(e)}let c=Y(`span`,`sb-sentiment__icon`);c.innerHTML=s?q:Tt,o.appendChild(c),o.addEventListener(`click`,()=>void this.store.selectChoice(t)),e.appendChild(o)}),e}if(e.type===`yes_no`||e.type===`multiple_choice`){let t=this.selectedChoice(e);if(t&&k(t))return this.renderTextInput(t.label,`Other response`,!0,i,!0);let r=this.usesTwoColumnChoices(e.answers??[]),a=r?Math.ceil((e.answers?.length??0)/2):e.answers?.length??0,o=Y(`div`,`sb-question sb-question--choices sb-question--choices-${r?`grid`:`single`} ${a>=5?`sb-question--choices-scrolling`:``}`);for(let t of e.answers??[]){let e=n?.answer_key===w(t),r=X(`sb-choice ${e?`sb-choice--selected`:``} ${k(t)?`sb-choice--other`:``}`,t.label);if(r.dataset.choiceValue=w(t),r.disabled=i,r.setAttribute(`aria-pressed`,String(e)),k(t)){let e=Y(`span`,`sb-choice__other-content`);e.setAttribute(`aria-hidden`,`true`),e.appendChild(Y(`span`,`sb-choice__other-caret`));let n=Y(`span`,`sb-choice__label sb-choice__other-label`);n.textContent=t.label,e.appendChild(n),r.appendChild(e)}else{let e=Y(`span`,`sb-choice__label`);e.textContent=t.label,r.appendChild(e)}r.addEventListener(`click`,()=>void this.store.selectChoice(t)),o.appendChild(r)}return o}return this.renderTextInput(e.free_text_placeholder??`Please explain more... (Optional)`,e.prompt,e.required,i)}renderTextInput(e,t,n,r,i=!1){let a=Y(`div`,`sb-question sb-question--text ${i?`sb-question--other sb-question--other-text`:``}`),o=Y(`div`,`sb-textarea-shell`),s=Y(`textarea`,`sb-textarea`);return s.value=this.store.currentText(),s.disabled=r,s.placeholder=e,s.setAttribute(`aria-label`,t),n&&(s.autofocus=!0,this.focusTextArea(s)),s.addEventListener(`input`,()=>this.store.setText(s.value)),o.appendChild(s),a.appendChild(o),a}usesTwoColumnChoices(e){return e.every(e=>{let t=Y(`span`,`sb-choice-measure ${k(e)?`sb-choice-measure--other`:``}`);t.textContent=e.label.trim(),this.root.appendChild(t);let n=t.getBoundingClientRect().width||t.scrollWidth;t.remove();let r=this.estimatedTextWidth(e.label.trim())+(k(e)?17:16);return(n||r)<160})}renderThankYou(e){let t=e.completion,n=Y(`div`,`sb-thanks`),r=Y(`div`,`sb-thanks__icon-shell`);r.setAttribute(`aria-hidden`,`true`);let i=Y(`div`,`sb-thanks__icon-core`);i.innerHTML=wt,r.appendChild(i),n.appendChild(r);let a=Y(`div`,`sb-thanks__copy`);a.dataset.revealContent=``,a.setAttribute(`aria-hidden`,`true`);let o=Y(`h2`);o.id=`sb-completion-${this.uiId}`,o.tabIndex=-1,o.textContent=t?.title??``;let s=Y(`p`);if(s.id=`sb-completion-body-${this.uiId}`,s.textContent=t?.body??``,a.appendChild(o),a.appendChild(s),n.appendChild(a),t?.actions.length){let e=Y(`div`,`sb-thanks__actions`);e.dataset.revealContent=``,e.setAttribute(`aria-hidden`,`true`);for(let n of t.actions){let t=X(`sb-button sb-button--${n.style===`primary`||n.style===`secondary`?n.style:`tertiary`}`);t.textContent=n.label,t.disabled=!0,t.addEventListener(`click`,()=>void this.store.handleCompletionAction(n)),e.appendChild(t)}n.appendChild(e)}return n}};function Pt(e){if(typeof document>`u`&&e.ui!==!1)return{track:()=>{},tagUser:()=>{},untagUser:()=>{},sync:async()=>{throw Error(`Sideband UI runtime is unavailable during SSR.`)},flush:async()=>{},openSurvey:()=>{},presentSimulatedPulse:()=>!1,closeSurvey:async()=>{},getDeviceId:()=>``,destroy:()=>{}};let t=new et({syncInteraction:async e=>{n.submitInteraction(e)},trackEvent:(e,t)=>n.track(e,t),shouldPresentPulse:e.shouldPresentPulse,onRateApp:e.onRateApp,onError:e.onError}),n=qe({...e,libraryVersion:`1.4.5-rc.5`,onSyncResponse:e=>t.handleSyncResponse(e)}),r=e.ui===!1?null:new Nt(t);return n.start(),{track:n.track,tagUser:n.tagUser,untagUser:n.untagUser,sync:n.sync,flush:n.flush,openSurvey:()=>t.openSurvey(),presentSimulatedPulse:e=>t.presentSimulatedPulse(e),closeSurvey:()=>t.closeSurvey(),getDeviceId:n.getDeviceId,destroy:()=>{n.destroy(),r?.destroy(),t.destroy()}}}var Z=null;function Q(){if(!Z)throw Error(`Call Sideband.configure() before using Sideband.`);return Z}function Ft(e){$();let t=Pt(e);return Z=t,t}function It(e,t,n){Q().track(e,t,n)}function Lt(e){Q().tagUser(e)}function Rt(){Q().untagUser()}function zt(){return Q().flush()}function Bt(e){return Q().presentSimulatedPulse(e)}function $(){Z?.destroy(),Z=null}var Vt={configure:Ft,track:It,tagUser:Lt,untagUser:Rt,flush:zt,presentSimulatedPulse:Bt,destroy:$};return e.PendingInteractionStorageError=_,e.Sideband=Vt,e.SidebandApiError=Se,e.SurveySessionStore=et,e.SyncEngine=b,e.buildFabTitle=C,e.configure=Ft,e.createSidebandClient=Ce,e.destroy=$,e.flush=zt,e.getChoiceValue=w,e.getDeviceId=u,e.getSessionId=d,e.presentSimulatedPulse=Bt,e.tagUser=Lt,e.track=It,e.untagUser=Rt,e})({});
|
|
1
|
+
var Sideband=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=`sideband:device_id`,n=`sideband:session_id`,r=`sideband:user_id`,i=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function a(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(16);if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`)crypto.getRandomValues(e);else for(let t=0;t<e.length;t+=1)e[t]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function o(e){try{return e===`local`?window.localStorage:window.sessionStorage}catch{return null}}function s(e,t){let n=o(e);try{let e=n?.getItem(t);if(e&&i.test(e))return e.toLowerCase()}catch{}let r=a();try{n?.setItem(t,r)}catch{}return r}var c=null,l=null;function u(){return c||=s(`local`,t),c}function d(){return l||=s(`session`,n),l}function f(){try{return o(`local`)?.getItem(r)??null}catch{return null}}function p(e){try{o(`local`)?.setItem(r,e)}catch{}}function m(){try{o(`local`)?.removeItem(r)}catch{}}function h(e,t=`1.4.6-rc.1`){let n={device_id:u(),platform:`web`,app_version:e,session_id:d(),library_version:t};if(typeof navigator<`u`&&navigator.language){n.locale=navigator.language;let e=navigator.language.split(`-`)[0]?.toLowerCase();e&&(n.language=e)}return n}function g(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}function ee(e,t,n){return async()=>{let r=typeof t==`function`?await t():t;return{...h(e,n),...g(r??{})}}}function te(e){if(typeof e!=`string`||!e.trim())throw TypeError(`Sideband.configure apiKey must be a non-empty string.`)}function ne(e,t=`Sideband.configure appVersion`){if(typeof e!=`string`||!e.trim()||Array.from(e).length>64)throw TypeError(`${t} must be a non-empty string of at most 64 characters.`)}function re(e,t){if(typeof e!=`string`||!e.length)throw TypeError(`Sideband.track eventName must be a non-empty string.`);if(t!==void 0){if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`Sideband.track metadata must be a string-to-string map.`);for(let[e,n]of Object.entries(t))if(typeof n!=`string`)throw TypeError(`Sideband.track metadata value for "${e}" must be a string.`)}}function ie(e){return Array.from(e).length}function ae(e){return ie(e)>256}var oe=Symbol(`sideband.syncAttemptMetadata`),se=new WeakSet;function ce(e,t){let n={...e};return n[oe]=t,n}function le(e){return e?.[oe]}function ue(e){(typeof e==`object`&&e||typeof e==`function`)&&se.add(e)}function de(e){return(typeof e==`object`&&!!e||typeof e==`function`)&&se.has(e)}var fe=`/v1/sync`,pe={local:`https://api.pancake-betelgeuse.ts.net`,dev:`https://api.dev-sideband.ai`,prod:`https://api.sideband.ai`};function me(e){if(e)return e;if(typeof fetch!=`function`)throw Error(`Sideband requires a fetch implementation.`);return fetch}async function he(e){return typeof e==`function`?await e():e}async function ge(e){let t=typeof e==`function`?await e():e;return new Headers(t)}function _e(e){return e.baseUrl??pe[e.syncEndpoint??`prod`]}function ve(e){return new URL(fe,e).toString()}async function ye(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}function be(e,t){return typeof e==`object`&&e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`message`in e.error&&typeof e.error.message==`string`?e.error.message:t}function xe(e){let t=e.headers.get(`retry-after`);if(!t)return;let n=Number(t);if(Number.isFinite(n))return Math.max(n,0);let r=Date.parse(t);if(!Number.isNaN(r))return Math.max((r-Date.now())/1e3,0)}var Se=class extends Error{status;body;retryAfterSeconds;constructor(e,t,n,r){super(e),this.name=`SidebandApiError`,this.status=t,this.body=n,this.retryAfterSeconds=r}};function Ce(e){if(te(e.apiKey),e.syncEndpoint!==void 0&&!Object.hasOwn(pe,e.syncEndpoint))throw TypeError(`Sideband.configure syncEndpoint must be local, dev, or prod.`);async function t(t,n){let r=me(e.fetch),i=t.context??await he(e.context);ne(i.app_version,`Sideband context.app_version`);let a=await ge(e.headers),o=le(n);a.set(`content-type`,`application/json`),a.set(`x-bc-api-key`,e.apiKey),a.set(`x-bc-sync-attempt`,String(o?.attempt??1)),o?.retryReason?a.set(`x-bc-sync-retry-reason`,o.retryReason):a.delete(`x-bc-sync-retry-reason`);let s=ve(_e(e)),c={method:`POST`,headers:a,body:JSON.stringify({...t,context:i}),signal:n?.signal,...n?.keepalive?{keepalive:!0}:{}},l;try{l=await r(s,c)}catch(e){throw ue(e),e}let u=await ye(l);if(!l.ok)throw new Se(be(u,`Sideband sync request failed.`),l.status,u,xe(l));return u}async function n(e,n,r){return re(e,n),t({events:[{event_id:a(),event_name:e,metadata:n,timestamp:r?.timestamp??new Date().toISOString()}]},r)}return{sync:t,track:n}}var we=`sideband:pending_interactions:`,Te=1440*60*1e3,Ee=new Set([`completed`,`partial`,`not_now`,`never`]),_=class extends Error{reason;constructor(e,t,n){super(t,n===void 0?void 0:{cause:n}),this.name=`PendingInteractionStorageError`,this.reason=e}};function De(e,t){return`${we}${Oe(`${t}\n${e}`)}`}function Oe(e){let t=3735928559,n=1103547991;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);t=Math.imul(t^i,2654435761),n=Math.imul(n^i,1597334677)}return t=Math.imul(t^t>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2097151&n)+(t>>>0)).toString(36)}function ke(){if(typeof window>`u`)return null;try{return window.sessionStorage}catch(e){throw new _(`storage_unavailable`,`Sideband cannot use sessionStorage; pending answers are kept for this page only.`,e)}}function v(e){return e===void 0||typeof e==`string`}function Ae(e){return!!e&&typeof e==`object`&&!Array.isArray(e)&&Object.values(e).every(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.answered_at==`string`&&v(t.answer_key)&&v(t.value)})}function je(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.pulse_id!=`string`||typeof t.action!=`string`||!Ee.has(t.action)||t.pulse_version!==void 0&&typeof t.pulse_version!=`number`||!v(t.impression_id)||!v(t.responded_at)?!1:t.action===`completed`||t.action===`partial`?Ae(t.answers)&&v(t.completion_action_id):!0}function Me(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.stored_at==`number`&&(t.user_id===null||typeof t.user_id==`string`)&&je(t.interaction)}function Ne(e,t=Date.now()){let n=ke(),r;try{r=n?.getItem(e)??null}catch(e){throw new _(`storage_unavailable`,`Sideband could not read pending answers.`,e)}if(!r)return[];try{let e=JSON.parse(r);return Array.isArray(e)?e.filter(Me).filter(e=>t-e.stored_at<Te).slice(-10):[]}catch{return[]}}function Pe(e,t){let n=ke();if(!n)return;let r=t.slice(-10);try{r.length?n.setItem(e,JSON.stringify(r)):n.removeItem(e)}catch(e){throw new _(`storage_write_failed`,`Sideband could not save pending answers to sessionStorage (it may be full); they are kept for this page only.`,e)}if(r.length<t.length)throw new _(`queue_full`,`Sideband keeps at most 10 pending answers across page loads; the oldest were not saved.`)}var Fe=20,Ie=50,Le=1,Re=15,ze=1e3,Be=300*1e3,Ve=2147483647,He=1e4;function Ue(e,t,n){return Math.min(Math.max(e,t),n)}function We(e){let t=e?.status;return typeof t==`number`?t:void 0}function Ge(e){let t=e?.status;return typeof t!=`number`||t===408||t===425||t===429||t>=500}function y(e){let t=e?.retryAfterSeconds;return typeof t==`number`&&Number.isFinite(t)?Math.max(t,0)*1e3:void 0}function Ke(e){return e?.status===503&&y(e)!==void 0?`server_retry`:de(e)?`network`:`server_error`}var b=class{deps;maxBatchSize;flushIntervalMs;retryIntervalMs;maxQueuedEvents;queuedEvents=[];queuedInteractions=[];restoredInteractions=[];replayedInteractions=new WeakSet;interactionMeta=new WeakMap;restoreReleaseTimer=null;unpersistedInteractions=new WeakSet;contextRevision=0;acknowledgedContextRevision=0;inFlightEventIds=new Set;timerId=null;timerDueAt=null;inFlight=null;abortController=null;regularDueAt=null;urgentDueAt=null;paceUntil=0;retryUntil=0;retrySnapshot=null;failureStreak=0;automaticRetrySuspended=!1;overflowReported=!1;started=!1;destroyed=!1;backgrounded=!1;pendingLifecycleForce=!1;pendingForcedRetry=null;manualFlushPromise=null;lastAttemptAccepted=!1;acceptedEvents=0;acceptedInteractions=0;syncAttempts=0;detachLifecycle=null;constructor(e,t={}){this.deps=e,this.maxBatchSize=Ue(t.maxBatchSize??Fe,1,Ie),this.flushIntervalMs=Math.max(t.flushIntervalSeconds??Le,1)*1e3,this.retryIntervalMs=Math.max(t.retryIntervalSeconds??Re,1)*1e3,this.maxQueuedEvents=Math.max(t.maxQueuedEvents??ze,this.maxBatchSize)}start(){this.started||this.destroyed||(this.started=!0,this.restoreInteractions(),this.attachLifecycle(),this.track(`system_app_launch`))}getDeliveryStatus(){let e=new Set([...this.queuedEvents,...this.retrySnapshot?.events??[]].map(e=>e.record.event_id));return{acceptedEvents:this.acceptedEvents,acceptedInteractions:this.acceptedInteractions,syncAttempts:this.syncAttempts,pendingEvents:e.size,pendingInteractions:this.queuedInteractions.length+this.restoredInteractions.length,hasPendingContext:this.contextRevision>this.acknowledgedContextRevision,isSyncing:this.inFlight!==null,isTerminal:this.destroyed||this.automaticRetrySuspended}}track(e,t,n){if(re(e,t),this.destroyed)return;let r=Date.now();if(this.enqueueEvent(e,t,n?.timestamp??new Date().toISOString(),r),this.enforceQueueLimit(),e===`system_did_present_pulse`){this.requestUrgent();return}this.requestRegularAt(this.queuedEvents.length>=this.maxBatchSize?r:r+this.flushIntervalMs)}enqueueEvent(e,t,n,r){let i={event_id:a(),event_name:e,timestamp:n,...t?{metadata:t}:{}};this.queuedEvents.push({record:i,tagEvent:{name:e,metadata:t},queuedAt:r})}tagUser(e=null,t=null,n=new Date().toISOString()){if(!this.destroyed){if(e!==t){let r=Date.now();e!==null&&this.enqueueEvent(`system_logout`,{user_id:e},n,r),t!==null&&this.enqueueEvent(`system_login`,{user_id:t},n,r),this.enforceQueueLimit()}this.contextRevision+=1,this.requestRegular()}}submitInteraction(e){this.destroyed||(this.interactionMeta.set(e,{owner:this.currentOwner(),storedAt:Date.now()}),this.queuedInteractions.push(e),this.persistInteractions(),this.requestUrgent())}requestRegular(){this.requestRegularAt(Date.now())}async observeResponse(e){this.destroyed||(this.retrySnapshot||this.clearRetryState(),this.applyServerPacing(e),await this.notifyResponse(e),this.clearUrgencyIfSatisfied(),this.updateSchedule())}notePacing(e){this.observeResponse(e)}async flush(){if(!this.destroyed)return this.manualFlushPromise||=this.drainForcedSnapshots().finally(()=>{this.manualFlushPromise=null,this.afterAttempt()}),this.manualFlushPromise}destroy(){this.destroyed||(this.destroyed=!0,this.clearTimer(),this.restoreReleaseTimer!==null&&(clearTimeout(this.restoreReleaseTimer),this.restoreReleaseTimer=null),this.detachLifecycle?.(),this.detachLifecycle=null,this.abortController?.abort(),this.abortController=null,this.pendingLifecycleForce=!1)}async drainForcedSnapshots(){for(;!this.destroyed;){if(this.inFlight){await this.inFlight;continue}if(!this.hasWork())return;if(this.pendingLifecycleForce){if(this.pendingLifecycleForce=!1,this.lastAttemptAccepted=!1,await this.beginAttempt(`forced-lifecycle`),!this.lastAttemptAccepted)return;continue}if(this.lastAttemptAccepted=!1,await this.beginAttempt(`forced-manual`),!this.lastAttemptAccepted)return}}requestRegularAt(e){this.destroyed||this.automaticRetrySuspended||(this.regularDueAt=this.regularDueAt===null?e:Math.min(this.regularDueAt,e),this.updateSchedule())}requestUrgent(){if(this.destroyed||this.automaticRetrySuspended)return;let e=Date.now();this.urgentDueAt=this.urgentDueAt===null?e:Math.min(this.urgentDueAt,e),this.updateSchedule()}hasWork(){return this.queuedEvents.length>0||this.sendableInteractions().length>0||this.contextRevision>this.acknowledgedContextRevision}createSnapshot(e){let t=this.queuedEvents.slice(0,this.maxBatchSize);if(e===`urgent`){let e=this.queuedEvents.find(e=>e.record.event_name===`system_did_present_pulse`);e&&!t.includes(e)&&(t[t.length-1]=e)}if(e===`forced-lifecycle`){let e=[...this.queuedEvents].reverse().find(e=>e.record.event_name===`system_app_background`),n=[this.queuedEvents.find(e=>e.record.event_name===`system_did_present_pulse`),e].filter(e=>!!e);if(n.length){let e=Math.max(this.maxBatchSize,n.length),r=new Set(n);t=[...this.queuedEvents.filter(e=>!r.has(e)).slice(0,e-n.length),...n]}}let n=this.sendableInteractions(),r=e===`forced-lifecycle`?n.find(e=>!this.replayedInteractions.has(e)):n[0];return r&&this.replayedInteractions.has(r)&&(t=[]),{events:t,interaction:r,contextRevision:this.contextRevision,attempt:1,trigger:e}}beginAttempt(e){if(this.destroyed||this.inFlight)return this.inFlight??Promise.resolve();if((e===`regular`||e===`urgent`)&&this.automaticRetrySuspended)return Promise.resolve();if(e===`urgent`&&!this.hasUrgentWork())return this.clearUrgencyIfSatisfied(),this.updateSchedule(),Promise.resolve();let t=this.retrySnapshot!==null,n=this.retrySnapshot??this.createSnapshot(e);if(!n.events.length&&!n.interaction&&n.contextRevision<=this.acknowledgedContextRevision&&e!==`regular`)return Promise.resolve();e===`regular`&&!t&&(this.regularDueAt=null),e===`urgent`&&!t&&(this.urgentDueAt=null),this.abortController=new AbortController,this.inFlightEventIds=new Set(n.events.flatMap(e=>e.record.event_id?[e.record.event_id]:[]));let r=this.runAttempt(n,this.abortController.signal);return this.inFlight=r,r.finally(()=>{this.inFlight===r&&(this.inFlight=null,this.abortController=null,this.inFlightEventIds.clear(),this.afterAttempt())}),r}async runAttempt(e,t){try{if(!e.context&&this.deps.resolveContext&&(e.context={...await this.deps.resolveContext()}),e.interaction&&!this.ownerMatches(e.interaction,e.context)&&(e.interaction=void 0,!e.events.length&&e.contextRevision<=this.acknowledgedContextRevision))return;this.syncAttempts++;let n=await this.deps.sendSync({...e.context?{context:e.context}:{},...e.events.length?{events:e.events.map(e=>e.record)}:{},...e.interaction?{interaction:e.interaction}:{}},ce({signal:t,...e.trigger===`forced-lifecycle`?{keepalive:!0}:{}},{attempt:e.attempt,...e.retryReason?{retryReason:e.retryReason}:{}}));if(this.destroyed)return;await this.handleDecodedResponse(n,e,e.trigger)}catch(t){this.destroyed||this.handleFailure(t,e)}}async handleDecodedResponse(e,t,n){if(this.lastAttemptAccepted=e.accepted,this.clearRetryState(),this.applyServerPacing(e),e.accepted){this.acceptedEvents+=t.events.length,this.acknowledgedContextRevision=Math.max(this.acknowledgedContextRevision,t.contextRevision);let e=new Set(t.events.flatMap(e=>e.record.event_id?[e.record.event_id]:[]));this.queuedEvents=this.queuedEvents.filter(t=>!t.record.event_id||!e.has(t.record.event_id))}if(e.accepted&&t.interaction){let e=this.queuedInteractions.indexOf(t.interaction);e>=0&&(this.acceptedInteractions++,this.queuedInteractions.splice(e,1),this.persistInteractions())}if(e.accepted&&this.releaseRestoredInteractions(),await this.notifyResponse(e,t.events.length?t.events[t.events.length-1]?.tagEvent:void 0),!e.accepted){this.regularDueAt=null,this.urgentDueAt=null;return}if(this.clearUrgencyIfSatisfied(),!this.hasWork()){this.regularDueAt=null,this.pendingLifecycleForce=!1;return}if(n===`urgent`&&this.hasUrgentWork()&&!this.manualFlushPromise){this.requestUrgent();return}this.hasWork()&&!this.manualFlushPromise&&this.requestRegular()}handleFailure(e,t){if(this.lastAttemptAccepted=!1,t.interaction&&We(e)===404){this.dropInteraction(t.interaction),this.clearRetryState(),this.reportError(e),this.regularDueAt=null,this.urgentDueAt=null,this.requestRegular();return}if(!Ge(e)){t.interaction&&(this.unpersistedInteractions.add(t.interaction),this.persistInteractions()),this.retrySnapshot=null,this.automaticRetrySuspended=!0,this.regularDueAt=null,this.reportError(e);return}this.failureStreak+=1,t.attempt=Math.min(t.attempt+1,1e3),t.retryReason=Ke(e),this.retrySnapshot=t;let n=y(e),r=Math.min(this.retryIntervalMs*2**(this.failureStreak-1),Be)*(.5+Math.random()*.5),i=Math.max(r,n??0);this.retryUntil=Date.now()+i,this.regularDueAt=this.retryUntil,t.trigger!==`regular`&&(this.pendingForcedRetry=t.trigger),this.failureStreak===1&&this.reportError(e)}clearRetryState(){this.failureStreak=0,this.retryUntil=0,this.automaticRetrySuspended=!1,this.overflowReported=!1,this.pendingForcedRetry=null,this.retrySnapshot=null}applyServerPacing(e){let t=e.next_sync_seconds;if(typeof t!=`number`||!Number.isFinite(t)||t<=0){this.paceUntil=0;return}this.paceUntil=Date.now()+t*1e3}async notifyResponse(e,t){if(!(!this.deps.onSyncResponse||this.destroyed))try{await this.deps.onSyncResponse(e,t)}catch(e){this.reportError(e)}}afterAttempt(){if(!(this.destroyed||this.inFlight||this.manualFlushPromise)){if(this.clearUrgencyIfSatisfied(),this.hasWork()||(this.pendingLifecycleForce=!1,this.pendingForcedRetry=null),this.pendingLifecycleForce&&this.hasWork()){if(this.retrySnapshot){this.updateSchedule();return}this.pendingLifecycleForce=!1,this.pendingForcedRetry=null,this.beginAttempt(`forced-lifecycle`);return}if(this.urgentDueAt!==null&&this.hasWork()&&!this.automaticRetrySuspended&&this.retryUntil<=Date.now()){this.beginAttempt(`urgent`);return}this.updateSchedule()}}updateSchedule(){if(this.destroyed||this.inFlight||this.manualFlushPromise||this.automaticRetrySuspended){this.clearTimer();return}let e=this.pendingForcedRetry?this.retryUntil:this.urgentDueAt===null?this.regularDueAt===null?null:Math.max(this.regularDueAt,this.paceUntil,this.retryUntil):Math.max(this.urgentDueAt,this.retryUntil);if(e===null){this.clearTimer();return}this.scheduleTimer(e)}scheduleTimer(e){this.timerId!==null&&this.timerDueAt===e||(this.clearTimer(),this.timerDueAt=e,this.timerId=setTimeout(()=>{this.timerId=null,this.timerDueAt=null;let e=this.pendingForcedRetry,t=e??(this.urgentDueAt===null?`regular`:`urgent`),n=e?this.retryUntil:t===`urgent`?Math.max(this.urgentDueAt??Date.now(),this.retryUntil):this.regularDueAt===null?null:Math.max(this.regularDueAt,this.paceUntil,this.retryUntil);if(n!==null){if(n>Date.now()){this.scheduleTimer(n);return}this.pendingForcedRetry=null,this.beginAttempt(t)}},Math.min(Math.max(e-Date.now(),0),Ve)))}clearTimer(){this.timerId!==null&&(clearTimeout(this.timerId),this.timerId=null),this.timerDueAt=null}hasUrgentWork(){return this.sendableInteractions().length>0||this.queuedEvents.some(e=>e.record.event_name===`system_did_present_pulse`)}clearUrgencyIfSatisfied(){this.hasUrgentWork()||(this.urgentDueAt=null,this.pendingForcedRetry===`urgent`&&(this.pendingForcedRetry=null))}enforceQueueLimit(){if(this.queuedEvents.length<=this.maxQueuedEvents)return;let e=this.queuedEvents.length-this.maxQueuedEvents,t=[],n=!1;for(let r of this.queuedEvents){let i=!!(r.record.event_id&&this.inFlightEventIds.has(r.record.event_id)),a=r.record.event_name===`system_did_present_pulse`;if(e>0&&!i&&!a){--e,n=!0;continue}t.push(r)}this.queuedEvents=t,n&&!this.overflowReported&&(this.overflowReported=!0,this.reportError(Error(`Sideband event queue exceeded ${this.maxQueuedEvents}; dropping oldest events.`)))}attachLifecycle(){if(typeof window>`u`||typeof document>`u`)return;let e=()=>{this.backgrounded||(this.backgrounded=!0,this.track(`system_app_background`))},t=()=>{e(),this.requestLifecycleForce()},n=()=>{if(document.visibilityState===`hidden`){e(),this.requestLifecycleForce();return}this.backgrounded&&(this.backgrounded=!1,this.track(`system_app_foreground`),this.requestRegular())};window.addEventListener(`pagehide`,t),document.addEventListener(`visibilitychange`,n),this.detachLifecycle=()=>{window.removeEventListener(`pagehide`,t),document.removeEventListener(`visibilitychange`,n)}}requestLifecycleForce(){if(!this.destroyed){if(this.inFlight||this.manualFlushPromise){this.pendingLifecycleForce=!0;return}if(this.retrySnapshot){this.pendingLifecycleForce=!0,this.updateSchedule();return}this.hasWork()&&this.beginAttempt(`forced-lifecycle`)}}restoreInteractions(){if(!this.deps.interactionPersistence)return;let e=[];try{e=this.deps.interactionPersistence.restore()}catch(e){this.reportError(e)}this.restoredInteractions=e.map(e=>(this.interactionMeta.set(e.interaction,{owner:e.owner,storedAt:e.storedAt}),this.replayedInteractions.add(e.interaction),e.interaction)),this.restoredInteractions.length&&(this.restoreReleaseTimer=setTimeout(()=>{this.restoreReleaseTimer=null,!(this.destroyed||!this.restoredInteractions.length)&&(this.releaseRestoredInteractions(),this.requestRegular())},He))}releaseRestoredInteractions(){this.restoreReleaseTimer!==null&&(clearTimeout(this.restoreReleaseTimer),this.restoreReleaseTimer=null),this.restoredInteractions.length&&(this.queuedInteractions=[...this.restoredInteractions,...this.queuedInteractions],this.restoredInteractions=[])}currentOwner(){return this.deps.currentInteractionOwner?this.deps.currentInteractionOwner():null}ownerMatches(e,t){return!this.deps.currentInteractionOwner||(this.interactionMeta.get(e)?.owner??null)===(t?t.user_id??null:this.currentOwner())}sendableInteractions(){if(!this.deps.currentInteractionOwner)return this.queuedInteractions;let e=this.currentOwner();return this.queuedInteractions.filter(t=>(this.interactionMeta.get(t)?.owner??null)===e)}dropInteraction(e){let t=this.queuedInteractions.indexOf(e);t>=0&&this.queuedInteractions.splice(t,1),this.persistInteractions()}persistInteractions(){if(this.deps.interactionPersistence)try{this.deps.interactionPersistence.save([...this.restoredInteractions,...this.queuedInteractions].filter(e=>!this.unpersistedInteractions.has(e)).map(e=>{let t=this.interactionMeta.get(e)??{owner:this.currentOwner(),storedAt:Date.now()};return{interaction:e,owner:t.owner,storedAt:t.storedAt}}))}catch(e){this.reportError(e)}}reportError(e){try{this.deps.onError?this.deps.onError(e):console.error(`[sideband]`,e)}catch{}}};function qe(e){ne(e.appVersion);let t=Je(e.onError),n=ee(e.appVersion,e.context,e.libraryVersion),r=e.context&&typeof e.context==`object`?e.context.user_id??null:null,i=async()=>{let e=await n();return r=e.user_id??null,t===null?e:{...e,user_id:t}},a=Ce({baseUrl:e.baseUrl,syncEndpoint:e.syncEndpoint,apiKey:e.apiKey,context:i,headers:e.headers,fetch:e.fetch}),o=De(e.apiKey,_e(e)),s=new b({sendSync:(e,t)=>a.sync(e,t),resolveContext:i,onSyncResponse:e.onSyncResponse,onError:e.onError,interactionPersistence:{restore:()=>Ne(o).map(e=>({interaction:e.interaction,owner:e.user_id,storedAt:e.stored_at})),save:e=>{Pe(o,e.map(e=>({interaction:e.interaction,user_id:e.owner,stored_at:e.storedAt})))}},currentInteractionOwner:()=>t??r},{maxBatchSize:e.maxBatchSize,flushIntervalSeconds:e.flushIntervalSeconds,retryIntervalSeconds:e.retryIntervalSeconds,maxQueuedEvents:e.maxQueuedEvents,maxServerPacingSeconds:e.maxServerPacingSeconds}),c=n=>{if(n!==null&&ae(n)){e.onError?.(Error(`Sideband.tagUser rejected a user ID longer than 256 characters.`));return}let r=new Date().toISOString(),i=t;t=n,n===null?m():p(n),s.tagUser(i,n,r)};return{getDeliveryStatus:()=>s.getDeliveryStatus(),start:()=>s.start(),track:(e,t,n)=>{s.track(e,t,n)},tagUser:e=>c(e),untagUser:()=>c(null),submitInteraction:e=>s.submitInteraction(e),async sync(e,t){let n=await a.sync(e,t);return await s.observeResponse(n),n},flush:()=>s.flush(),getDeviceId:u,destroy:()=>s.destroy()}}function Je(e){let t=f();return t===null||!ae(t)?t:(m(),e?.(Error(`Sideband cleared a stored user ID longer than 256 characters.`)),null)}function Ye(e){if(!e||typeof e!=`object`)return!1;let t=e;return[`position`,`anchor`,`offset`].every(e=>{let n=t[e];if(!n||typeof n!=`object`)return!1;let{x:r,y:i}=n;return typeof r==`number`&&Number.isFinite(r)&&typeof i==`number`&&Number.isFinite(i)&&(e!==`offset`||Number.isInteger(r)&&Number.isInteger(i))})}function x(e,t){return{imageUrl:e.imageUrl??t?.imageUrl,placement:Ye(e.placement)?e.placement:t?.placement}}var S={destroyed:!1,state:null},Xe=0;function C(e){return e.fab?.title??e.title}function w(e){return e.id}function T(e){return typeof e.impression_id==`string`?`${e.pulse_id}:${e.version}:${e.impression_id}`:`${e.pulse_id}:${e.version}`}function E(e){return typeof e.impression_id==`string`?{impression_id:e.impression_id}:{}}function D(e,t){return t?e.questions[t]??null:null}function O(e,t){return t?e.completions[t]??null:null}function k(e){return e.id===`system_other`}function A(e){let t=`${e.id} ${e.label}`.toLowerCase();return!t.includes(`no`)&&!t.includes(`down`)&&!t.includes(`bad`)}function Ze(e){return e.type===`yes_no`||e.type===`multiple_choice`}function j(e,t){return!!(D(e,t)||O(e,t))}function Qe(e){if(!e.pulse_id||!Number.isFinite(e.version)||!e.root_node_id)return`Pulse is missing a usable id, version, or root node.`;if(!j(e,e.root_node_id))return`Pulse root node does not exist.`;if(!Object.keys(e.questions).length)return`Pulse must include at least one question.`;for(let t of Object.keys(e.questions))if(e.completions[t])return`Pulse node ${t} is both a question and completion.`;for(let[t,n]of Object.entries(e.questions)){if(n.node_id!==t)return`Question map key ${t} does not match node_id ${n.node_id}.`;if(![`yes_no`,`multiple_choice`,`free_text`].includes(n.type))return`Question ${n.node_id} has unsupported type ${n.type}.`;if(Ze(n)&&!n.answers?.length)return`Choice question ${n.node_id} has no answers.`;let r=new Set;for(let t of n.answers??[]){if(!t.id)return`Choice question ${n.node_id} has an answer without id.`;if(r.has(t.id))return`Choice question ${n.node_id} has duplicate answer id ${t.id}.`;if(r.add(t.id),t.next_node_id!==void 0&&!j(e,t.next_node_id))return`Choice ${t.id} references missing node ${t.next_node_id}.`}if(n.next_node_id!==void 0&&!j(e,n.next_node_id))return`Question ${n.node_id} references missing node ${n.next_node_id}.`}for(let[t,n]of Object.entries(e.completions)){if(n.node_id!==t)return`Completion map key ${t} does not match node_id ${n.node_id}.`;if(n.type!==`thank_you`)return`Completion ${n.node_id} has unsupported type ${n.type}.`}return null}function $e(e,t){if(t?.answer_key){let n=e.answers?.find(e=>e.id===t.answer_key);if(n?.next_node_id)return n.next_node_id}return e.next_node_id??null}var M=class{snapshot=S;listeners=new Set;deps;fabTimeoutId=null;sentimentAdvanceTimeoutId=null;completionTransitionTimeoutId=null;destroyed=!1;decisionGeneration=0;seenPulseKeys=new Set;presentedKeys=new Set;constructor(e){this.deps=e}getState(){return this.snapshot.state}getSnapshot(){return this.snapshot}getServerSnapshot(){return S}subscribe(e){return this.destroyed?()=>{}:(this.listeners.add(e),()=>this.listeners.delete(e))}destroy(){this.destroyed||(this.destroyed=!0,this.decisionGeneration+=1,this.clearFabTimeout(),this.clearSurveyTransitionTimeouts(),this.publish(null,`destroyed`,!0),this.listeners.clear())}currentQuestion(){let e=this.snapshot.state;return e?D(e.survey,e.currentNodeId):null}currentAnswer(){let e=this.snapshot.state,t=this.currentQuestion();return e&&t?e.answers[t.node_id]:void 0}currentDraft(){let e=this.snapshot.state,t=this.currentQuestion();return e&&t?e.drafts[t.node_id]:void 0}currentText(){let e=this.snapshot.state,t=this.currentQuestion();return!e||!t?``:e.drafts[t.node_id]?.value??e.answers[t.node_id]?.value??``}isSentimentStep(){let e=this.snapshot.state,t=this.currentQuestion();return!!(e&&t&&(Object.keys(e.answers).length===0||e.snackbar&&e.snackbar.phase!==`journey`)&&t.node_id===e.survey.root_node_id&&t.type===`yes_no`&&t.answers?.length===2)}sentimentChoices(){let e=this.currentQuestion();return!e||!this.isSentimentStep()?[]:[...e.answers??[]].sort((e,t)=>{let n=A(e);return n===A(t)?0:n?-1:1})}shouldShowContinue(){return!!(this.currentQuestion()&&!this.isSentimentStep())}progress(){let e=this.snapshot.state;if(!e)return 0;if(e.completion||e.isCompleting)return 1;let t=Math.max(this.projectedQuestionIds(e).length,1),n=D(e.survey,e.survey.root_node_id),r=n&&!this.rendersAsSentiment(e,n)?1:0;return Math.min((Object.keys(e.answers).length+r)/t,1)}canContinue(){let e=this.snapshot.state,t=this.currentQuestion();if(!e||!t||e.isBusy)return!1;if(t.type===`free_text`)return!t.required||!!this.currentText().trim();let n=e.drafts[t.node_id];if(!n?.answer_key)return!t.required;let r=t.answers?.find(e=>e.id===n.answer_key);return!!(r&&(!k(r)||!t.required||n.value?.trim()))}async handleSyncResponse(e){let t=e.pending_pulse;if(!t||this.destroyed)return;let n=Qe(t);if(n){this.reportError(Error(n));return}let r=T(t);if(this.seenPulseKeys.has(r))return;this.seenPulseKeys.add(r);let i=++this.decisionGeneration,a=await this.resolvePresentationDecision(t);if(!(this.destroyed||i!==this.decisionGeneration)){if(a!==`showNow`){await this.sendPresentationDecline(t,a);return}this.beginPulse(t,`sheet`,!1)}}presentPulse(e,t={}){return this.presentLocalPulse(e,t.sentimentPresentation??`sheet`,!1)}presentSimulatedPulse(e){return this.presentLocalPulse(e.pulse,e.sentimentPresentation??`sheet`,!0)}presentLocalPulse(e,t,n){if(this.destroyed)return!1;let r=Qe(e);return r?(this.reportError(Error(r)),!1):(this.decisionGeneration+=1,this.beginPulse(e,t,n),!0)}beginPulse(e,t,n){let r=D(e,e.root_node_id),i=O(e,e.root_node_id),a=e.sentimentPresentation===`toolbar`,o=e.sentimentPresentation===void 0?r?.isSnackBar===!0||r?.isSnackBar!==!1&&t===`snackbar`&&!!e.fab:e.sentimentPresentation===`snackbar`,s=(a||o)&&r?.type===`yes_no`&&r.answers?.length===2&&!r.answers.some(k);this.clearSurveyTransitionTimeouts(),this.publish({presentationId:++Xe,sentimentPresentation:s?a?`bar`:`snackbar`:`sheet`,barPosition:`bottom`,barBehavior:`dismiss`,isSimulated:n,snackbar:s?{phase:`question`,selectedKey:null,startedAt:null,deadline:null,frozenFraction:null,pausedRemainingMs:null}:null,survey:e,answers:{},drafts:{},currentNodeId:r?.node_id??null,completion:i,history:r?[r.node_id]:[],fabState:e.fab||s?`expanded`:`hidden`,isOpen:!e.fab&&!s||!!i,isBusy:!1,sentimentSelectionLocked:!1,isCompleting:!1,presentationConfirmed:!1,presentationReported:!1,fabEntranceCompleted:!1},`transition`)}openSurvey(){let e=this.snapshot.state;!e||e.isBusy||e.snackbar||this.publish({...e,fabState:`hidden`,isOpen:!0},`transition`)}async closeSurvey(){let e=this.snapshot.state;if(!(!e||e.isBusy)){if(this.clearSurveyTransitionTimeouts(),e.sentimentPresentation===`bar`&&e.barBehavior===`dismiss`&&Object.keys(e.answers).length>0){await this.completeTerminal(e,e.answers);return}await this.dismiss(e)}}async selectChoice(e){let t=this.snapshot.state,n=this.currentQuestion();if(!t||!n||t.isBusy||t.sentimentSelectionLocked||t.snackbar&&t.snackbar.phase!==`journey`||!Ze(n))return;let r=n.answers?.find(t=>t.id===e.id);if(!r)return;let i=t.drafts[n.node_id],a={answer_key:r.id,...k(r)&&i?.answer_key===r.id&&i.value?{value:i.value}:{}},o={...t,drafts:{...t.drafts,[n.node_id]:a},sentimentSelectionLocked:this.isSentimentStep()};if(this.publish(o,`select`),this.isSentimentStep()&&!k(r)){this.sentimentAdvanceTimeoutId!==null&&clearTimeout(this.sentimentAdvanceTimeoutId);let e=r.comment?.trim()?1400:A(r)?700:500,i=T(t.survey);this.sentimentAdvanceTimeoutId=setTimeout(()=>{this.sentimentAdvanceTimeoutId=null;let e=this.snapshot.state;e&&T(e.survey)===i&&e.currentNodeId===n.node_id&&e.drafts[n.node_id]?.answer_key===r.id&&this.advance()},e)}}setText(e){let t=this.snapshot.state,n=this.currentQuestion();!t||!n||t.isBusy||n.type!==`free_text`&&!this.isSystemOtherDraft(n)||this.publish({...t,drafts:{...t.drafts,[n.node_id]:{...t.drafts[n.node_id],value:e}}},`text`)}async advance(){let e=this.snapshot.state,t=this.currentQuestion();if(!e||!t||e.isBusy||!this.canContinue()||e.snackbar&&e.snackbar.phase!==`journey`)return;let n=this.commitCurrentAnswer(e,t);await this.advanceFrom(e,t,n)}async handleCompletionAction(e){let t=this.snapshot.state;if(!t||!t.completion||t.isBusy)return;let n={pulse_id:t.survey.pulse_id,pulse_version:t.survey.version,...E(t.survey),action:`completed`,responded_at:new Date().toISOString(),answers:t.answers,completion_action_id:e.id};if(this.publish(null,`transition`),await this.queueInteraction(n,t.isSimulated),e.action.type===`app_rating`&&!t.isSimulated)try{await this.deps.onRateApp?.()}catch(e){this.reportError(e)}}confirmPresentation(e,t){let n=this.snapshot.state;if(!(!n||this.destroyed||t!==void 0&&n.presentationId!==t)&&!(e===`sheet`&&!n.isOpen)&&!(e===`expanded_fab`&&n.fabState!==`expanded`)&&(this.emitPresentationEvent(n,e),e===`expanded_fab`&&!n.presentationReported)){let e=n.snackbar&&n.fabEntranceCompleted&&n.snackbar.phase===`question`&&n.snackbar.deadline===null&&n.snackbar.pausedRemainingMs===null?{...n.snackbar,...et(Date.now(),n.survey.fab?.expandedTimeout)}:n.snackbar;this.publish({...n,presentationConfirmed:!0,presentationReported:!0,snackbar:e},`transition`)}}confirmEntryDisplayed(e){let t=this.snapshot.state;!t||this.destroyed||t.fabState!==`expanded`||t.presentationConfirmed||e!==void 0&&t.presentationId!==e||this.publish({...t,presentationConfirmed:!0},`transition`)}confirmFabEntranceCompleted(e){let t=this.snapshot.state;!t||t.fabState!==`expanded`||!t.presentationConfirmed||t.fabEntranceCompleted||e!==void 0&&t.presentationId!==e||this.destroyed||this.publish({...t,fabEntranceCompleted:!0,snackbar:t.snackbar&&t.presentationReported?{...t.snackbar,...et(Date.now(),t.survey.fab?.expandedTimeout)}:t.snackbar},`transition`)}answerSnackbar(e,t){let n=this.snapshot.state,r=n?.snackbar,i=this.currentQuestion(),a=i?.answers?.find(e=>e.id===t&&!k(e)),o=Date.now();if(!n||!r||!i||!a||n.presentationId!==e||n.isOpen||!n.fabEntranceCompleted||r.phase!==`question`||r.deadline!==null&&o>=r.deadline)return!1;let s={answer_key:a.id,answered_at:new Date(o).toISOString()},c=r.pausedRemainingMs===null?r.deadline!==null&&r.startedAt!==null?Math.max(0,Math.min(1,(r.deadline-o)/Math.max(1,r.deadline-r.startedAt))):1:r.pausedRemainingMs/Math.max(1,n.survey.fab?.expandedTimeout??1),l=n.sentimentPresentation===`bar`&&n.barBehavior===`dismiss`;return this.publish({...n,answers:{...n.answers,[i.node_id]:s},drafts:{...n.drafts,[i.node_id]:{answer_key:a.id}},sentimentSelectionLocked:!0,snackbar:{...r,phase:`feedback`,selectedKey:a.id,deadline:null,frozenFraction:c,pausedRemainingMs:null}},`transition`),this.sentimentAdvanceTimeoutId=setTimeout(()=>{this.sentimentAdvanceTimeoutId=null;let t=this.snapshot.state;if(!(t?.presentationId!==e||t.snackbar?.phase!==`feedback`)){if(l){this.completeTerminal(t,t.answers);return}this.publish({...t,isOpen:!0,fabState:`hidden`,snackbar:{...t.snackbar,phase:`awaitingReady`}},`transition`)}},l?3e3:500),!0}setBarTimerPaused(e,t){let n=this.snapshot.state,r=n?.snackbar,i=n?.survey.fab?.expandedTimeout;if(!(!n||n.presentationId!==e||n.sentimentPresentation!==`bar`||!r||r.phase!==`question`||typeof i!=`number`||!Number.isFinite(i)||i<=0)){if(t&&r.deadline!==null){let e=Math.max(0,r.deadline-Date.now());if(e===0){this.closeSurvey();return}this.publish({...n,snackbar:{...r,deadline:null,pausedRemainingMs:e}},`transition`)}else if(!t&&r.pausedRemainingMs!==null){let e=Date.now()+r.pausedRemainingMs;this.publish({...n,snackbar:{...r,deadline:e,startedAt:e-i,pausedRemainingMs:null}},`transition`)}}}confirmSnackbarContentReady(e){let t=this.snapshot.state,n=this.currentQuestion();if(!t||t.presentationId!==e||t.snackbar?.phase!==`awaitingReady`||!n)return;let r=n.answers?.find(e=>e.id===t.snackbar?.selectedKey);if(!r)return;this.publish({...t,snackbar:{...t.snackbar,phase:`dwelling`}},`transition`);let i=r.comment?.trim()?1400:A(r)?700:500;this.sentimentAdvanceTimeoutId=setTimeout(()=>{this.sentimentAdvanceTimeoutId=null;let t=this.snapshot.state;t?.presentationId!==e||t.snackbar?.phase!==`dwelling`||this.advanceFrom({...t,snackbar:{...t.snackbar,phase:`journey`}},n,t.answers)},i)}async resolvePresentationDecision(e){try{if(this.deps.shouldPresentPulse)return await this.deps.shouldPresentPulse({pulseId:e.pulse_id,version:e.version,title:e.title,...e.fab?{fab:e.fab}:{}})}catch(e){return this.reportError(e),`notNow`}return`showNow`}async sendPresentationDecline(e,t){await this.queueInteraction({pulse_id:e.pulse_id,pulse_version:e.version,...E(e),action:t===`never`?`never`:`not_now`,responded_at:new Date().toISOString()})}commitCurrentAnswer(e,t){let n=e.drafts[t.node_id];if(t.type===`free_text`){let r=n?.value?.trim()??``;return{...e.answers,[t.node_id]:r?{answered_at:new Date().toISOString(),value:r}:{answered_at:new Date().toISOString()}}}if(!n?.answer_key)return t.required?e.answers:{...e.answers,[t.node_id]:{answered_at:new Date().toISOString()}};let r=t.answers?.find(e=>e.id===n.answer_key);if(!r)return e.answers;let i=n.value?.trim();return k(r)&&!t.required&&!i?{...e.answers,[t.node_id]:{answered_at:new Date().toISOString()}}:{...e.answers,[t.node_id]:{answered_at:new Date().toISOString(),answer_key:r.id,...k(r)&&i?{value:i}:{}}}}async advanceFrom(e,t,n){let r=$e(t,n[t.node_id]);if(!r){await this.completeTerminal(e,n);return}let i=D(e.survey,r);if(i){if(e.history.includes(i.node_id)){this.reportError(Error(`Pulse graph cycle detected at ${i.node_id}.`)),await this.dismissOrPartial(e,n);return}this.publish({...e,answers:n,currentNodeId:i.node_id,history:[...e.history,i.node_id],fabState:`hidden`,isOpen:!0,sentimentSelectionLocked:!1,isCompleting:!1},`transition`);return}let a=O(e.survey,r);if(a){if(!(!this.rendersAsSentiment(e,t)&&this.progress()<1)){this.publish({...e,answers:n,completion:a,currentNodeId:null,fabState:`hidden`,isOpen:!0,sentimentSelectionLocked:!1,isCompleting:!1},`transition`);return}this.publish({...e,answers:n,isCompleting:!0,sentimentSelectionLocked:!1,fabState:`hidden`,isOpen:!0},`transition`);let r=T(e.survey);this.completionTransitionTimeoutId=setTimeout(()=>{this.completionTransitionTimeoutId=null;let e=this.snapshot.state;!e||T(e.survey)!==r||!e.isCompleting||this.publish({...e,completion:a,currentNodeId:null,isCompleting:!1},`transition`)},500);return}this.reportError(Error(`Pulse graph references missing node ${r}.`)),await this.dismissOrPartial(e,n)}async completeTerminal(e,t){this.publish(null,`transition`),await this.queueInteraction({pulse_id:e.survey.pulse_id,pulse_version:e.survey.version,...E(e.survey),action:`completed`,responded_at:new Date().toISOString(),answers:t},e.isSimulated)}async dismiss(e){await this.dismissOrPartial(e,e.answers)}async dismissOrPartial(e,t){this.clearSurveyTransitionTimeouts();let n=Object.keys(t).length>0;this.publish(null,`transition`),await this.queueInteraction(n?{pulse_id:e.survey.pulse_id,pulse_version:e.survey.version,...E(e.survey),action:`partial`,responded_at:new Date().toISOString(),answers:t}:{pulse_id:e.survey.pulse_id,pulse_version:e.survey.version,...E(e.survey),action:`not_now`,responded_at:new Date().toISOString()},e.isSimulated)}async queueInteraction(e,t=!1){if(!t)try{await this.deps.syncInteraction(e)}catch(e){this.reportError(e)}}emitPresentationEvent(e,t){if(e.isSimulated)return;let n=`${T(e.survey)}:${t}`;this.presentedKeys.has(n)||(this.presentedKeys.add(n),this.deps.trackEvent?.(`system_did_present_pulse`,{kind:tt(e,t),pulse_id:e.survey.pulse_id,pulse_version:String(e.survey.version),...E(e.survey)}))}scheduleFabTimeout(e){if(this.clearFabTimeout(),!e||e.fabState!==`expanded`||!e.presentationReported||!e.fabEntranceCompleted||e.snackbar&&e.snackbar.phase!==`question`||e.snackbar?.pausedRemainingMs!=null)return;let t=e.survey.fab?.expandedTimeout;if(typeof t!=`number`||!Number.isFinite(t)||t<0)return;let n=T(e.survey);this.fabTimeoutId=setTimeout(()=>{let e=this.snapshot.state;this.destroyed||!e||T(e.survey)!==n||e.fabState!==`expanded`||this.dismissOrPartial(e,e.answers)},e.snackbar?.deadline!==null&&e.snackbar?.deadline!==void 0?Math.max(0,e.snackbar.deadline-Date.now()):t)}clearFabTimeout(){this.fabTimeoutId!==null&&(clearTimeout(this.fabTimeoutId),this.fabTimeoutId=null)}clearSurveyTransitionTimeouts(){this.sentimentAdvanceTimeoutId!==null&&(clearTimeout(this.sentimentAdvanceTimeoutId),this.sentimentAdvanceTimeoutId=null),this.completionTransitionTimeoutId!==null&&(clearTimeout(this.completionTransitionTimeoutId),this.completionTransitionTimeoutId=null)}rendersAsSentiment(e,t){return t.node_id===e.survey.root_node_id&&t.type===`yes_no`&&t.answers?.length===2}projectedQuestionIds(e){let t=[],n=new Set,r=D(e.survey,e.survey.root_node_id)?.node_id??null;for(;r;){let i=D(e.survey,r);if(!i||n.has(r))break;t.push(r),n.add(r),r=this.projectedNextQuestionId(e,i)}return t}projectedNextQuestionId(e,t){let n=e.answers[t.node_id];if(n){let r=$e(t,n);return r&&D(e.survey,r)?r:null}if(!t.required){let n=t.next_node_id??null;return n&&D(e.survey,n)?n:null}let r=new Set((t.answers??[]).map(e=>e.next_node_id).filter(Boolean)),i=r.size===0?t.next_node_id??null:r.size===1?[...r][0]??t.next_node_id??null:null;return i&&D(e.survey,i)?i:null}publish(e,t,n=!1){this.clearFabTimeout(),this.snapshot={state:e,destroyed:n},this.scheduleFabTimeout(e);for(let e of this.listeners)try{e(t)}catch(e){this.reportError(e)}}reportError(e){try{this.deps.onError?this.deps.onError(e):console.error(`[sideband]`,e)}catch{}}isSystemOtherDraft(e){let t=this.snapshot.state?.drafts[e.node_id];return!!(t?.answer_key&&e.answers?.some(e=>e.id===t.answer_key&&k(e)))}};function et(e,t){return{startedAt:e,deadline:typeof t==`number`&&Number.isFinite(t)&&t>=0?e+t:null}}function tt(e,t){return t!==`expanded_fab`||!e.snackbar?t:e.sentimentPresentation===`bar`?`toolbar`:`snackbar`}function nt(e,t){let n=!1,r=null,i=null,a=null,o=Date.now(),s=()=>{n=!0,r?.disconnect(),r=null,i!==null&&clearInterval(i),i=null,document.removeEventListener(`visibilitychange`,l)},c=()=>a===null?r&&Date.now()-o<1e3?!1:it(e):a;function l(){n||!rt(e)||!c()||(s(),t())}return typeof IntersectionObserver<`u`&&(r=new IntersectionObserver(e=>{let t=e[e.length-1];t&&(a=t.isIntersecting),l()}),r.observe(e)),l(),n?s:(document.addEventListener(`visibilitychange`,l),i=setInterval(l,200),s)}function rt(e){if(!e.isConnected)return!1;for(let t of[e,...ct(e)]){let e=t.ownerDocument.defaultView;if(!e||t.ownerDocument.visibilityState===`hidden`||!st(t,e))return!1}return!0}function it(e){let t=e,n=N(e.getBoundingClientRect());for(;;){if(n=at(t,n),!n)return!1;let e=F(t);if(!e)return!0;let r=e.getBoundingClientRect();if(n=P({left:n.left+r.left,right:n.right+r.left,top:n.top+r.top,bottom:n.bottom+r.top},N(r)),!n)return!1;t=e}}var N=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function at(e,t){let n=e.ownerDocument.defaultView;if(!n)return null;let r=e.ownerDocument,i=ot(n.getComputedStyle(r.documentElement)),a=!i.x&&!i.y,o=n.getComputedStyle(e).position===`fixed`,s=t;for(let t=I(e);t&&s;t=I(t)){if(t===r.documentElement||t===r.body&&a)continue;let e=n.getComputedStyle(t);if(!o){let{x:n,y:r}=ot(e);if(n||r){let e=N(t.getBoundingClientRect());s=P(s,{left:n?e.left:-1/0,right:n?e.right:1/0,top:r?e.top:-1/0,bottom:r?e.bottom:1/0})}}e.position===`fixed`&&(o=!0)}if(!s)return null;let c=n.innerWidth||e.ownerDocument.documentElement.clientWidth,l=n.innerHeight||e.ownerDocument.documentElement.clientHeight;return P(s,{left:0,top:0,right:c,bottom:l})}function ot(e){let t=e=>e!==``&&e!==`visible`;return{x:t(e.overflowX||e.overflow),y:t(e.overflowY||e.overflow)}}function P(e,t){let n={left:Math.max(e.left,t.left),top:Math.max(e.top,t.top),right:Math.min(e.right,t.right),bottom:Math.min(e.bottom,t.bottom)};return n.left<=n.right&&n.top<=n.bottom?n:null}function st(e,t){let n=e;if(typeof n.checkVisibility==`function`)return n.checkVisibility({visibilityProperty:!0})&&e.offsetWidth>0&&e.offsetHeight>0;if(t.getComputedStyle(e).visibility===`hidden`)return!1;for(let n=e;n;n=I(n))if(t.getComputedStyle(n).display===`none`)return!1;return!0}function ct(e){let t=[];for(let n=F(e);n;n=F(n))t.push(n);return t}function F(e){let t=e.ownerDocument.defaultView;if(!t||t.parent===t)return null;try{return t.frameElement}catch{return null}}function I(e){if(e.parentElement)return e.parentElement;let t=e.getRootNode();return t!==e.ownerDocument&&t.host?t.host:null}var lt=`rgba(0, 0, 0, 0)`,L=(e,t=1)=>({hex:e,alpha:t}),R=(e,t)=>[{variable:`--sb-theme-choice-${e}-background`,path:[`choice`,e,`background`],fallback:t[0]},{variable:`--sb-theme-choice-${e}-foreground`,path:[`choice`,e,`foreground`],fallback:t[1]},{variable:`--sb-theme-choice-${e}-border`,path:[`choice`,e,`border`],fallback:t[2]}],z=(e,t)=>[{variable:`--sb-theme-button-${e}-foreground`,path:[`button`,e,`foreground`],fallback:t[0]},{variable:`--sb-theme-button-${e}-background`,path:[`button`,e,`background`],fallback:t[1]},{variable:`--sb-theme-button-${e}-hover-background`,path:[`button`,e,`hoverBackground`],fallback:t[2]},{variable:`--sb-theme-button-${e}-pressed-background`,path:[`button`,e,`pressedBackground`],fallback:t[3]},{variable:`--sb-theme-button-${e}-disabled-background`,path:[`button`,e,`disabledBackground`],fallback:t[4]},{variable:`--sb-theme-button-${e}-disabled-foreground`,path:[`button`,e,`disabledForeground`],fallback:t[5]}],B=[{variable:`--sb-theme-sheet-background`,path:[`sheet`,`background`],fallback:L(`#FFFFFF`)},{variable:`--sb-theme-sheet-scrim`,path:[`sheet`,`scrim`],fallback:L(`#000000`,.5)},{variable:`--sb-theme-sheet-divider`,path:[`sheet`,`divider`],fallback:L(`#E5E5E5`)},{variable:`--sb-theme-sheet-progress-track`,path:[`sheet`,`progressTrack`],fallback:L(`#000000`,.12)},{variable:`--sb-theme-sheet-progress-fill`,path:[`sheet`,`progressFill`],fallback:L(`#000000`)},{variable:`--sb-theme-sheet-close-button-background`,path:[`sheet`,`closeButtonBackground`],fallback:L(`#000000`,0)},{variable:`--sb-theme-sheet-close-button-foreground`,path:[`sheet`,`closeButtonForeground`],fallback:L(`#000000`)},{variable:`--sb-theme-content-heading`,path:[`content`,`heading`],fallback:L(`#000000`)},{variable:`--sb-theme-content-body`,path:[`content`,`body`],fallback:L(`#333030`)},{variable:`--sb-theme-content-helper`,path:[`content`,`helper`],fallback:L(`#5C5C5C`)},{variable:`--sb-theme-content-error`,path:[`content`,`error`],fallback:L(`#B42318`)},{variable:`--sb-theme-completion-outer-background`,path:[`completion`,`outerBackground`],fallback:L(`#E8E8E8`)},{variable:`--sb-theme-completion-inner-background`,path:[`completion`,`innerBackground`],fallback:L(`#000000`)},{variable:`--sb-theme-completion-glyph`,path:[`completion`,`glyph`],fallback:L(`#FFFFFF`)},...R(`default`,[L(`#FFFFFF`),L(`#000000`),L(`#DBDBDB`)]),...R(`hover`,[L(`#F5F5F5`),L(`#000000`),L(`#DBDBDB`)]),...R(`pressed`,[L(`#000000`),L(`#FFFFFF`),L(`#000000`)]),...R(`selected`,[L(`#000000`),L(`#FFFFFF`),L(`#000000`)]),...R(`disabled`,[L(`#F2F2F2`),L(`#8A8A8A`),L(`#E5E5E5`)]),...z(`primary`,[L(`#FFFFFF`),L(`#121212`),L(`#292929`),L(`#000000`),L(`#E5E5E5`),L(`#8A8A8A`)]),...z(`secondary`,[L(`#000000`),L(`#F2F2F2`),L(`#E8E8E8`),L(`#DBDBDB`),L(`#E5E5E5`),L(`#8A8A8A`)]),...z(`tertiary`,[L(`#000000`),L(`#FFFFFF`),L(`#F5F5F5`),L(`#E8E8E8`),L(`#E5E5E5`),L(`#8A8A8A`)]),{variable:`--sb-theme-input-background`,path:[`input`,`background`],fallback:L(`#FFFFFF`)},{variable:`--sb-theme-input-foreground`,path:[`input`,`foreground`],fallback:L(`#000000`)},{variable:`--sb-theme-input-placeholder`,path:[`input`,`placeholder`],fallback:L(`#000000`,.4)},{variable:`--sb-theme-input-border`,path:[`input`,`border`],fallback:L(`#000000`,.18)},{variable:`--sb-theme-input-focused-border`,path:[`input`,`focusedBorder`],fallback:L(`#000000`,.7)},{variable:`--sb-theme-input-error-border`,path:[`input`,`errorBorder`],fallback:L(`#B42318`)},{variable:`--sb-theme-input-disabled-background`,path:[`input`,`disabledBackground`],fallback:L(`#F2F2F2`)},{variable:`--sb-theme-input-disabled-foreground`,path:[`input`,`disabledForeground`],fallback:L(`#8A8A8A`)},{variable:`--sb-theme-fab-background`,path:[`fab`,`background`],fallback:L(`#000000`)},{variable:`--sb-theme-fab-foreground`,path:[`fab`,`foreground`],fallback:L(`#FFFFFF`)},{variable:`--sb-theme-fab-border`,path:[`fab`,`border`],fallback:L(`#FFFFFF`,.15)},{variable:`--sb-theme-fab-accent-primary`,path:[`fab`,`accentPrimary`],fallback:L(`#000000`)},{variable:`--sb-theme-fab-accent-secondary`,path:[`fab`,`accentSecondary`],fallback:L(`#FFFFFF`)},{variable:`--sb-theme-fab-timer-track`,path:[`fab`,`timerTrack`],fallback:L(`#000000`,.16)},{variable:`--sb-theme-fab-timer-fill`,path:[`fab`,`timerFill`],fallback:L(`#000000`)}];B.map(e=>e.variable);var ut=Object.fromEntries(B.map(e=>[e.variable,H(e.fallback)]));function V(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function H(e,t=lt){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})`}function dt(e,t){let n=e;for(let e of t)n=V(n)[e];return n}function ft(e){return Object.fromEntries(B.map(t=>[t.variable,H(dt(e,t.path),H(t.fallback))]))}function U(e,t){return L(`#${[1,3,5].map(n=>{let r=Number.parseInt(e.hex.slice(n,n+2),16),i=Number.parseInt(t.hex.slice(n,n+2),16);return Math.round(r*e.alpha+i*(1-e.alpha)).toString(16).padStart(2,`0`)}).join(``)}`,1)}function pt(e){let t=t=>{let n=B.find(e=>e.path.join(`.`)===t.join(`.`)),r=dt(e,t);return H(r,``)?r:n.fallback},n={...t([`sheet`,`background`]),alpha:1},r=t([`content`,`heading`]),i=t([`choice`,`selected`,`background`]),a=U(i,n),o=[1,3,5].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)=>H(U({...e,alpha:e.alpha*t},n)),u=U({...r,alpha:r.alpha*(s?c?.15:.08:.14)},n),d=e=>[1,3,5].reduce((t,n,r)=>t+Number.parseInt(e.hex.slice(n,n+2),16)*[.2126,.7152,.0722][r],0),f=d(u)>d(n);return{"--sb-snackbar-surface":H(n),"--sb-snackbar-text":H(r),"--sb-snackbar-border":H(L(s?`#FFFFFF`:`#000000`,s?.1:.05)),"--sb-snackbar-normal":l(r,s?c?.2:.14:c?.08:.1),"--sb-snackbar-hover":l(r,s?c?.24:.18:.04),"--sb-snackbar-pressed":l(i,s?c?.28:.24:.2),"--sb-snackbar-active":H(a),"--sb-snackbar-on-active":H(t([`choice`,`selected`,`foreground`])),"--sb-snackbar-ghost":H(u),"--sb-snackbar-remaining":H(f?u:n),"--sb-snackbar-elapsed":H(f?n:u)}}var W={visible:185.84,entrance:1969.207,timerEntrance:2169.207,widen:200,expand:450},G={delay:400,enter:450,exit:400,removal:450,reduced:150},mt=G.delay+G.enter;function ht(e,t){return t?0:e?G.delay:W.visible}function gt(e,t){let{viewport:n,safeArea:r={},compactHeight:i}=t,a=K(r.left)+12,o=K(r.right)+12,s=K(r.top)+24,c=K(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);if(t.barPosition)return{compactWidth:n.width,compactLeft:0,compactBottom:0,cardWidth:d,cardHeight:p,maxCardHeight:f,cardLeft:a+(l-d)/2,cardBottom:c,cardTop:K(r.top)+12,entranceOffset:0,transformOrigin:t.barPosition===`top`?`50% 0%`:`50% 100%`};let m=bt(e,{viewport:n,element:{width:u,height:i},safeArea:r}),h=Math.max(a,Math.min(m.left,n.width-o-u)),g=Math.max(c,Math.min(n.height-m.top-i,n.height-s-i));return{compactWidth:u,cardWidth:d,compactLeft:h,compactBottom:g,cardHeight:p,maxCardHeight:f,cardTop:0,entranceOffset:(u-i)*q(e?.anchor).x,cardLeft:a+(l-d)/2,cardBottom:Math.max(c,Math.min(g,n.height-s-p)),transformOrigin:m.transformOrigin}}var _t={x:1,y:1},vt={x:-16,y:-24};function K(e){return typeof e==`number`&&Number.isFinite(e)?Math.max(0,e):0}function yt(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function q(e){let t=V(e),n=typeof t.x==`number`&&Number.isFinite(t.x)?t.x:_t.x,r=typeof t.y==`number`&&Number.isFinite(t.y)?t.y:_t.y;return{x:Math.min(1,Math.max(0,n)),y:Math.min(1,Math.max(0,r))}}function bt(e,t){let n=V(e),r=q(n.position),i=q(n.anchor),a=V(n.offset),o=e?yt(a.x):vt.x,s=e?yt(a.y):vt.y,c=t.safeArea??{},l=K(c.left),u=K(c.right),d=K(c.top),f=K(c.bottom),p=Math.max(0,K(t.viewport.width)-l-u-K(t.element.width)),m=Math.max(0,K(t.viewport.height)-d-f-K(t.element.height));return{left:l+r.x*p+o,top:d+r.y*m+s,travelX:p,travelY:m,position:r,anchor:i,transformOrigin:`${i.x*100}% ${i.y*100}%`}}function xt(e,t,n=`forward`){let r=e===`bar`||e===`fill`?e:`none`,i=n===`reverse`?`reverse`:`forward`,a=typeof t==`number`&&Number.isFinite(t)&&t>0?t:null;return{style:r,direction:i,durationMs:a,visible:r!==`none`,cssVariables:{"--sb-timer-style":r,"--sb-timer-direction":i,...a===null?{}:{"--sb-timer-duration":`${a}ms`}}}}var St=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6.4 6.4 17.6 17.6M17.6 6.4 6.4 17.6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`,Ct=`<svg viewBox="0 0 14 14" aria-hidden="true"><path d="M6.66667 0 5.49167 1.175 10.1417 5.83333H0V7.5h10.1417l-4.65 4.6583 1.175 1.175L13.3333 6.66667 6.66667 0Z" fill="currentColor"/></svg>`,wt=`<svg viewBox="0 0 36 28" aria-hidden="true"><path d="m11.2619 21.3151-8.40108-8.4011L0 15.7546l11.2619 11.262L35.4379 2.84067 32.5972 0 11.2619 21.3151Z" fill="currentColor"/></svg>`,Tt=`<svg viewBox="0 0 35.5556 35.5556" aria-hidden="true"><path d="M19.436 3.05195 11.2286 11.2594c-.5481.5481-.8592 1.3037-.8592 2.0888v14.8c0 1.6297 1.3333 2.963 2.9629 2.963h13.3334c1.1851 0 2.2518-.7111 2.7259-1.7926l4.8296-11.2741c1.2445-2.9333-.9037-6.1925-4.0889-6.1925H21.762l1.4074-6.78523c.1481-.74075-.0741-1.4963-.6074-2.02963-.8741-.85926-2.2667-.85926-3.126.01481ZM4.44343 31.1112c1.62963 0 2.96296-1.3333 2.96296-2.963V16.2964c0-1.6296-1.33333-2.963-2.96296-2.963-1.62963 0-2.96296 1.3334-2.96296 2.963v11.8518c0 1.6297 1.33333 2.963 2.96296 2.963Z" fill="currentColor"/></svg>`,Et=`<svg viewBox="0 0 35.5556 35.5556" aria-hidden="true"><path d="m16.1165 32.5036 8.1926-8.2074c.5481-.5482.8592-1.3037.8592-2.0889v-14.8c0-1.62963-1.3333-2.96296-2.9629-2.96296H8.88686c-1.18519 0-2.25185.71111-2.71111 1.79259L1.34612 17.511c-1.25926 2.9333.88889 6.1926 4.07407 6.1926h8.37041l-1.4074 6.7852c-.1482.7407.074 1.4963.6074 2.0296.874.8593 2.2666.8593 3.1259-.0148ZM31.1091 4.44434c-1.6296 0-2.963 1.33333-2.963 2.96296v11.8519c0 1.6296 1.3334 2.9629 2.963 2.9629 1.6296 0 2.9629-1.3333 2.9629-2.9629V7.4073c0-1.62963-1.3333-2.96296-2.9629-2.96296Z" fill="currentColor"/></svg>`,Dt=`.sb-snackbar-root{--sb-text:var(--sb-snackbar-text);--sb-text-muted:var(--sb-theme-content-body);--sb-surface:var(--sb-snackbar-surface);z-index:1100;pointer-events:none;color:var(--sb-snackbar-text);font-family:Inter,-apple-system,BlinkMacSystemFont,system-ui,sans-serif;position:fixed;inset:0}.sb-snackbar-root *,.sb-snackbar-root :before,.sb-snackbar-root :after{box-sizing:border-box}.sb-snackbar-root h2{text-transform:none;letter-spacing:normal}.sb-snackbar-shell{left:var(--sb-snackbar-left);bottom:var(--sb-snackbar-bottom);width:var(--sb-snackbar-width);transition:left .2s ease-in-out,bottom .2s ease-in-out,width .2s ease-in-out;position:absolute}.sb-snackbar-surface{width:100%;height:var(--sb-snackbar-height,64px);border-radius:calc(var(--sb-snackbar-compact-height,64px) / 2);background:var(--sb-snackbar-surface);box-shadow:inset 0 0 0 1px var(--sb-snackbar-border);transition:height .45s cubic-bezier(0,.87,.39,1),border-radius .45s cubic-bezier(0,.87,.39,1);position:relative;overflow:hidden}.sb-snackbar-compact{width:var(--sb-snackbar-compact-width,364px);align-items:center;gap:10px;min-height:64px;padding:10px;transition:opacity .12s ease-out;display:flex;position:relative}.sb-snackbar-artwork{--sb-theme-fab-accent-primary:var(--sb-theme-sheet-progress-fill);--sb-theme-fab-accent-secondary:var(--sb-snackbar-surface);--sb-theme-fab-foreground:var(--sb-snackbar-text);background:var(--sb-theme-sheet-progress-fill);border-radius:50%;flex:0 0 40px;width:40px;height:40px;position:relative;overflow:hidden}.sb-snackbar-artwork img{z-index:2;object-fit:cover;width:100%;height:100%;position:absolute;inset:0}.sb-snackbar-prompt{overflow-wrap:anywhere;flex:1;min-width:0;margin:0;font-size:14px;font-weight:600;line-height:20px;position:relative}.sb-snackbar-answers{flex:none;gap:4px;display:flex;position:relative}.sb-snackbar-answer{width:44px;height:44px;color:var(--sb-snackbar-text);background:var(--sb-snackbar-normal);cursor:pointer;pointer-events:auto;border:0;border-radius:50%;place-items:center;margin:0;padding:0;transition:background .12s ease-out,scale .12s ease-out;display:grid}.sb-snackbar-answer svg{width:18px;height:18px}.sb-snackbar-answer:hover:not(:disabled){background:var(--sb-snackbar-hover)}.sb-snackbar-answer:active:not(:disabled){background:var(--sb-snackbar-pressed);scale:.94}.sb-snackbar-answer[aria-pressed=true]{color:var(--sb-snackbar-on-active);background:var(--sb-snackbar-active)}.sb-snackbar-answer:disabled{cursor:default;pointer-events:none;opacity:1}.sb-snackbar-close{top:-25px;width:44px;height:44px;color:var(--sb-snackbar-text);pointer-events:auto;cursor:pointer;background:0 0;border:0;place-items:center;margin:0;padding:13px;display:grid;position:absolute;inset-inline-start:-15px}.sb-snackbar-close svg{background:var(--sb-snackbar-surface);border-radius:50%;width:18px;height:18px;padding:2px}.sb-snackbar-answer:focus-visible,.sb-snackbar-close:focus-visible{outline:2px solid var(--sb-snackbar-text);outline-offset:2px}.sb-snackbar-timer{pointer-events:none;position:absolute;overflow:hidden}.sb-snackbar-timer--fill{background:var(--sb-snackbar-elapsed);inset:0}.sb-snackbar-timer--bar{inset-inline:1px 3px;background:var(--sb-theme-sheet-progress-track);height:2px;bottom:-6px}.sb-snackbar-timer-fill{transform-origin:0;background:var(--sb-theme-sheet-progress-fill);width:100%;height:100%;display:block}.sb-snackbar-timer--fill .sb-snackbar-timer-fill{background:var(--sb-snackbar-remaining)}.sb-snackbar-root:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)) .sb-snackbar-timer-fill{transform-origin:100%}.sb-snackbar-root[data-counting=true] .sb-snackbar-timer-fill{animation:sb-snackbar-countdown var(--sb-snackbar-duration) linear forwards}.sb-snackbar-root[data-frozen=true] .sb-snackbar-timer-fill{transform:scaleX(var(--sb-snackbar-fraction));animation:none}.sb-snackbar-overlay{background:var(--sb-theme-sheet-scrim);opacity:0;pointer-events:none;border:0;width:100%;height:100%;margin:0;padding:0;transition:opacity .45s ease-out;position:absolute;inset:0}.sb-snackbar-card{width:var(--sb-snackbar-card-width);max-height:var(--sb-snackbar-max-height);opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;overflow:auto}.sb-snackbar-root .sb-snackbar-card .sb-sheet-root{position:static;inset:auto}.sb-snackbar-root .sb-snackbar-card .sb-sheet-root__overlay{display:none}.sb-snackbar-root .sb-snackbar-card .sb-sheet{width:100%;max-height:none;box-shadow:none;background:0 0;border:0;margin:0;animation:none;position:relative;inset:auto;transform:none}.sb-snackbar-card[inert] *{animation-play-state:paused}.sb-snackbar-root[data-stage=widening] .sb-snackbar-compact,.sb-snackbar-root[data-stage=expanding] .sb-snackbar-compact,.sb-snackbar-root[data-stage=ready] .sb-snackbar-compact{opacity:0}.sb-snackbar-root[data-expanded=true] .sb-snackbar-overlay{opacity:1;pointer-events:auto}.sb-snackbar-root[data-expanded=true] .sb-snackbar-close{display:none}.sb-snackbar-root[data-stage=expanding] .sb-snackbar-surface,.sb-snackbar-root[data-stage=ready] .sb-snackbar-surface{box-shadow:none;background:var(--sb-theme-sheet-background);border-radius:40px}.sb-snackbar-root[data-stage=expanding] .sb-snackbar-card{opacity:1;transition:opacity .3s ease-out .12s}.sb-snackbar-root[data-stage=ready] .sb-snackbar-card{opacity:1;pointer-events:auto}.sb-snackbar-root[data-stage=entering] .sb-snackbar-shell{animation:.89016s cubic-bezier(.649439,.0577174,.124599,1) .18584s both sb-snackbar-enter-scale,.893207s cubic-bezier(.649439,.0577174,.124599,1) 1.076s both sb-snackbar-enter-width}.sb-snackbar-root[data-stage=entering] .sb-snackbar-surface{transition:none}.sb-snackbar-root[data-stage=entering] .sb-snackbar-prompt,.sb-snackbar-root[data-stage=entering] .sb-snackbar-answers,.sb-snackbar-root[data-stage=entering] .sb-snackbar-close{animation:.2s ease-out 1.076s both sb-snackbar-label}.sb-snackbar-root[data-stage=entering] .sb-snackbar-timer{animation:.2s ease-out 1.96921s both sb-snackbar-label}.sb-root--inline .sb-snackbar-root{position:absolute}@keyframes sb-snackbar-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@keyframes sb-snackbar-enter-scale{0%{scale:0}to{scale:1}}@keyframes sb-snackbar-enter-width{0%{width:var(--sb-snackbar-compact-height,64px);translate:var(--sb-snackbar-entrance-offset) 0}to{width:var(--sb-snackbar-width);translate:0}}@keyframes sb-snackbar-label{0%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion:reduce){.sb-snackbar-root[data-counting=true] .sb-snackbar-timer-fill{animation-duration:var(--sb-snackbar-duration)!important}.sb-snackbar-root .sb-snackbar-shell,.sb-snackbar-root .sb-snackbar-surface,.sb-snackbar-root .sb-snackbar-card,.sb-snackbar-root .sb-snackbar-compact,.sb-snackbar-root .sb-snackbar-overlay{transition:none}.sb-snackbar-root[data-stage=entering] .sb-snackbar-shell,.sb-snackbar-root[data-stage=entering] .sb-snackbar-prompt,.sb-snackbar-root[data-stage=entering] .sb-snackbar-timer,.sb-snackbar-root[data-stage=entering] .sb-snackbar-close,.sb-snackbar-root[data-stage=entering] .sb-snackbar-answers{animation:none}}.sb-snackbar-root[data-presentation=bar]{--sb-bar-hidden-y:max(80px, 100%)}.sb-snackbar-root[data-presentation=bar][data-position=top]{--sb-bar-hidden-y:calc(-1 * max(80px, 100%))}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-shell{top:var(--sb-bar-top,0px);transition:left .2s ease-in-out,top .2s ease-in-out,width .2s ease-in-out;bottom:auto}.sb-snackbar-root[data-presentation=bar]:not([data-expanded=true]) .sb-snackbar-surface{box-shadow:none;border-radius:0}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-compact{border-block-start:1px solid var(--sb-snackbar-border);min-height:48px;padding:10px max(108px, env(safe-area-inset-right,0px)) 10px max(108px, env(safe-area-inset-left,0px));pointer-events:auto;justify-content:center}.sb-snackbar-root[data-presentation=bar][data-position=bottom] .sb-snackbar-compact{padding-bottom:calc(10px + env(safe-area-inset-bottom,0px))}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-compact{padding-top:calc(10px + env(safe-area-inset-top,0px));border-block-start:0;border-block-end:1px solid var(--sb-snackbar-border)}.sb-bar-content{align-items:center;gap:12px;min-width:0;transition:opacity .25s ease-out;display:flex;position:relative}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-prompt{text-align:center;text-wrap:pretty;flex:0 auto;font-size:14px;font-weight:400;line-height:1.3}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answers{gap:4px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer{border:1px solid var(--sb-snackbar-border);background:var(--sb-snackbar-surface);-webkit-tap-highlight-color:transparent;border-radius:36px;width:36px;height:24px;transition:background .18s,border-color .18s,scale .15s ease-out}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer svg{width:14.4px;height:14.4px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer[aria-pressed=true]{background:var(--sb-snackbar-active);color:var(--sb-snackbar-on-active)}.sb-bar-acknowledgement{opacity:0;visibility:hidden;pointer-events:none;text-align:center;color:var(--sb-snackbar-text);justify-content:center;align-items:center;padding:10px 24px;font-size:18px;font-weight:600;line-height:1.4;transition:opacity .35s cubic-bezier(.16,1,.3,1) .1s,translate .35s cubic-bezier(.16,1,.3,1) .1s;display:flex;position:absolute;inset:0;translate:0 10px}.sb-snackbar-root[data-rated=true] .sb-bar-content,.sb-snackbar-root[data-rated=true] .sb-bar-dismiss,.sb-snackbar-root[data-rated=true][data-presentation=bar] .sb-snackbar-timer{opacity:0;pointer-events:none}.sb-snackbar-root[data-rated=true] .sb-bar-acknowledgement{opacity:1;visibility:visible;translate:0}.sb-bar-acknowledgement-copy{overflow-wrap:anywhere;min-width:0;max-width:100%}.sb-snackbar-root[data-presentation=bar][data-rated=true] .sb-snackbar-compact{min-height:var(--sb-snackbar-height,48px)}.sb-bar-dismiss{inset-inline-end:20px;width:68px;height:44px;color:var(--sb-theme-content-body);font:inherit;white-space:nowrap;cursor:pointer;background:0 0;border:0;border-radius:0;margin:0;padding:0 5px;font-size:14px;line-height:1.3;transition:opacity .25s ease-out;position:absolute;top:50%;translate:0 -50%}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:hover:not(:disabled){background:var(--sb-snackbar-surface)}@media (hover:hover){.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:hover:not(:disabled){background:var(--sb-snackbar-hover);border-color:var(--sb-theme-input-border)}}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:not(:disabled):active{background:var(--sb-snackbar-pressed);scale:.96}.sb-bar-dismiss:focus-visible{outline:2px solid var(--sb-snackbar-text);outline-offset:2px}.sb-bar-dismiss:disabled{cursor:default}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer{transition:opacity .25s ease-out}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer--bar{inset-inline:auto 25px;background:var(--sb-snackbar-border);width:58px;height:1px;top:calc(50% + 8px);bottom:auto}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer--bar .sb-snackbar-timer-fill{background:var(--sb-theme-content-body)}.sb-snackbar-root[data-presentation=bar][data-paused=true] .sb-snackbar-timer-fill{animation-play-state:paused}.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-shell{animation:.45s cubic-bezier(.16,1,.3,1) .4s both sb-bar-enter}.sb-snackbar-root[data-presentation=bar][data-exiting=true] .sb-snackbar-shell{pointer-events:none;animation:.4s cubic-bezier(.55,0,.55,.2) both sb-bar-exit}.sb-snackbar-root[data-presentation=bar][data-exiting=true] .sb-snackbar-overlay{opacity:0;pointer-events:none}.sb-snackbar-root[data-presentation=bar][data-exiting=true][data-expanded=true] .sb-snackbar-shell{animation:.4s ease-out both sb-bar-card-exit}.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-prompt,.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-answers,.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-timer{animation:none}@keyframes sb-bar-enter{0%{translate:0 var(--sb-bar-hidden-y)}to{translate:0}}@keyframes sb-bar-exit{0%{translate:0}to{translate:0 var(--sb-bar-hidden-y)}}@keyframes sb-bar-fade-in{0%{opacity:0}to{opacity:1}}@keyframes sb-bar-fade-out{0%{opacity:1}to{opacity:0}}@keyframes sb-bar-card-exit{0%{opacity:1;translate:0}to{opacity:0;translate:0 12px}}@media (width<=768px){.sb-snackbar-root[data-presentation=bar] .sb-snackbar-compact{padding-inline:max(24px, env(safe-area-inset-left,0px)) max(24px, env(safe-area-inset-right,0px))}.sb-bar-content{width:100%}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-prompt{text-align:start;flex:1}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answers{gap:5.333px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer{border-radius:48px;width:48px;height:32px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer svg{width:19.2px;height:19.2px}.sb-bar-acknowledgement{text-align:start;justify-content:flex-start}.sb-snackbar-root[data-presentation=bar][data-timed=true] .sb-bar-dismiss{display:none}.sb-snackbar-root[data-presentation=bar][data-timed=false] .sb-bar-content{padding-inline-end:76px}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-timer--bar{inset-inline:0;width:auto;top:0}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-timer--bar{top:auto;bottom:0}}.sb-root--inline .sb-snackbar-root[data-presentation=bar] .sb-snackbar-compact{padding-block:10px}@media (prefers-reduced-motion:reduce){.sb-snackbar-root[data-presentation=bar][data-stage=entering] .sb-snackbar-shell{animation:.15s ease-out both sb-bar-fade-in}.sb-snackbar-root[data-presentation=bar][data-exiting=true] .sb-snackbar-shell,.sb-snackbar-root[data-presentation=bar][data-exiting=true][data-expanded=true] .sb-snackbar-shell{animation:.15s ease-out both sb-bar-fade-out}.sb-snackbar-root[data-presentation=bar][data-position=top] .sb-snackbar-shell{transition:none}.sb-bar-acknowledgement{transition:opacity .15s ease-out;translate:none}.sb-bar-content,.sb-bar-dismiss{transition:opacity .15s ease-out}.sb-snackbar-root[data-presentation=bar] .sb-snackbar-answer:not(:disabled):active{scale:1}}.sb-sheet__close:before{content:"";background:currentColor;width:24px;height:24px;display:block;-webkit-mask:url("data:image/svg+xml,%3csvg%20preserveAspectRatio='none'%20overflow='visible'%20style='display:%20block;'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='close'%3e%3cpath%20id='Vector'%20d='M12%2013.4L7.1%2018.3C6.91667%2018.4833%206.68333%2018.575%206.4%2018.575C6.11667%2018.575%205.88333%2018.4833%205.7%2018.3C5.51667%2018.1167%205.425%2017.8833%205.425%2017.6C5.425%2017.3167%205.51667%2017.0833%205.7%2016.9L10.6%2012L5.7%207.1C5.51667%206.91667%205.425%206.68333%205.425%206.4C5.425%206.11667%205.51667%205.88333%205.7%205.7C5.88333%205.51667%206.11667%205.425%206.4%205.425C6.68333%205.425%206.91667%205.51667%207.1%205.7L12%2010.6L16.9%205.7C17.0833%205.51667%2017.3167%205.425%2017.6%205.425C17.8833%205.425%2018.1167%205.51667%2018.3%205.7C18.4833%205.88333%2018.575%206.11667%2018.575%206.4C18.575%206.68333%2018.4833%206.91667%2018.3%207.1L13.4%2012L18.3%2016.9C18.4833%2017.0833%2018.575%2017.3167%2018.575%2017.6C18.575%2017.8833%2018.4833%2018.1167%2018.3%2018.3C18.1167%2018.4833%2017.8833%2018.575%2017.6%2018.575C17.3167%2018.575%2017.0833%2018.4833%2016.9%2018.3L12%2013.4Z'%20fill='%23E8E8E8'/%3e%3c/g%3e%3c/svg%3e") 50%/24px 24px no-repeat;mask:url("data:image/svg+xml,%3csvg%20preserveAspectRatio='none'%20overflow='visible'%20style='display:%20block;'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='close'%3e%3cpath%20id='Vector'%20d='M12%2013.4L7.1%2018.3C6.91667%2018.4833%206.68333%2018.575%206.4%2018.575C6.11667%2018.575%205.88333%2018.4833%205.7%2018.3C5.51667%2018.1167%205.425%2017.8833%205.425%2017.6C5.425%2017.3167%205.51667%2017.0833%205.7%2016.9L10.6%2012L5.7%207.1C5.51667%206.91667%205.425%206.68333%205.425%206.4C5.425%206.11667%205.51667%205.88333%205.7%205.7C5.88333%205.51667%206.11667%205.425%206.4%205.425C6.68333%205.425%206.91667%205.51667%207.1%205.7L12%2010.6L16.9%205.7C17.0833%205.51667%2017.3167%205.425%2017.6%205.425C17.8833%205.425%2018.1167%205.51667%2018.3%205.7C18.4833%205.88333%2018.575%206.11667%2018.575%206.4C18.575%206.68333%2018.4833%206.91667%2018.3%207.1L13.4%2012L18.3%2016.9C18.4833%2017.0833%2018.575%2017.3167%2018.575%2017.6C18.575%2017.8833%2018.4833%2018.1167%2018.3%2018.3C18.1167%2018.4833%2017.8833%2018.575%2017.6%2018.575C17.3167%2018.575%2017.0833%2018.4833%2016.9%2018.3L12%2013.4Z'%20fill='%23E8E8E8'/%3e%3c/g%3e%3c/svg%3e") 50%/24px 24px no-repeat}:host{--sb-surface:var(--sb-theme-sheet-background,#fff);--sb-surface-muted:var(--sb-theme-button-secondary-background,#f2f2f2);--sb-border:var(--sb-theme-input-border,#0808081f);--sb-border-strong:#0808083d;--sb-border-active:var(--sb-theme-input-focused-border,#080808b3);--sb-text:var(--sb-theme-content-heading,#080808);--sb-text-muted:var(--sb-theme-content-body,#5c5c5c);--sb-overlay:var(--sb-theme-sheet-scrim,#00000061);--sb-ease:cubic-bezier(.2, .9, .2, 1);--sb-fab-motion-ease:cubic-bezier(.649439, .0577174, .124599, 1);--sb-sheet-motion-ease:cubic-bezier(0, .87, .39, 1);font-family:-apple-system,BlinkMacSystemFont,system-ui,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.sb-safe-area-probe{visibility:hidden;pointer-events:none;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);position:fixed;inset:0}.sb-fab{right:16px;bottom:calc(24px + env(safe-area-inset-bottom,0px));z-index:1000;box-sizing:border-box;border:1px solid var(--sb-theme-fab-border,#080808);background:var(--sb-theme-fab-background,#080808);min-width:0;height:60px;color:var(--sb-theme-fab-foreground,#fff);border-color:var(--sb-theme-fab-border,#080808);cursor:pointer;will-change:transform;align-items:center;transition:scale .12s ease-out;display:inline-flex;position:fixed;overflow:hidden}.sb-fab--entering{animation:sb-fab-enter-scale .89016s var(--sb-fab-motion-ease) .259705s both, sb-fab-enter-width .893207s var(--sb-fab-motion-ease) 1.076s both;transform-origin:50%!important}.sb-fab--entering .sb-fab__label{animation:sb-fab-label-in .2s var(--sb-fab-motion-ease) 1.14987s both}.sb-fab--entering .sb-fab__timer{animation:sb-fab-timer-in .2s var(--sb-fab-motion-ease) 1.96921s both}.sb-fab--entering .sb-fab__timer-fill{animation-delay:1.96921s}.sb-fab--exiting{width:var(--sb-fab-exit-width,var(--sb-fab-expanded-width));pointer-events:none;scale:var(--sb-fab-exit-scale,1);translate:var(--sb-fab-exit-offset,0) 0;animation:.292089s cubic-bezier(.677885,.170122,.695982,.997824) .3s forwards sb-fab-exit-width,.390467s cubic-bezier(.362165,.0946429,.49708,.932961) .466372s forwards sb-fab-exit-scale;transform:none;transform-origin:50%!important}.sb-fab--exiting .sb-fab__label{opacity:var(--sb-fab-exit-label-opacity,1);animation:.389727s cubic-bezier(.5,0,.5,1) .3s forwards sb-fab-label-out}.sb-fab--exiting .sb-fab__timer{opacity:var(--sb-fab-exit-timer-opacity,0)}.sb-fab--exiting .sb-fab__badge{animation:.297243s cubic-bezier(.5,0,1,.600461) .398177s forwards sb-fab-badge-out}.sb-next:hover,.sb-next:focus-visible,.sb-button:hover,.sb-button:focus-visible,.sb-choice:hover,.sb-choice:focus-visible{transform:translateY(-1px)}.sb-fab:active{transition-duration:80ms;scale:.97}.sb-fab:focus-visible,.sb-next:focus-visible,.sb-button:focus-visible,.sb-choice:focus-visible,.sb-sheet__close:focus-visible,.sb-sentiment:focus-visible,.sb-sheet-root__overlay:focus-visible{outline-offset:2px;outline:2px solid #6366f1a6}.sb-sheet h2[tabindex="-1"]:focus{outline:none}.sb-fab--expanded{width:var(--sb-fab-expanded-width,auto);border-radius:999px;justify-content:flex-start;gap:12px;min-height:60px;padding:13px 28px 13px 14px}.sb-fab__label{z-index:1;width:var(--sb-fab-label-width,auto);color:currentColor;text-align:left;white-space:nowrap;text-overflow:clip;min-width:0;font-size:14px;font-weight:600;line-height:1;position:relative;overflow:hidden}.sb-fab__badge{z-index:1;background:var(--sb-theme-fab-accent-primary,#f97316);border-radius:50%;flex:none;place-items:center;width:32px;height:32px;display:grid;position:relative}.sb-fab__badge-artwork{background:var(--sb-theme-fab-accent-secondary,#2563eb);border-radius:50%;display:block;position:absolute;inset:5.44px}.sb-fab__badge-image{z-index:2;border-radius:inherit;object-fit:cover;width:100%;height:100%;display:block;position:absolute;inset:0}.sb-fab__badge-glyph-center,.sb-fab__badge-glyph-amber,.sb-fab__badge-glyph-mint,.sb-fab__badge-glyph-rose{border-radius:999px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.sb-fab__badge-glyph-center{background:var(--sb-theme-fab-foreground,#fff);border-radius:3.52px;width:4.16px;height:11.52px}.sb-fab__badge-glyph-amber{background:#fac143;width:2.88px;height:6.72px;translate:-3.04px .8px}.sb-fab__badge-glyph-mint{background:#39c690;width:2.88px;height:5.44px;translate:3.04px -.32px}.sb-fab__badge-glyph-rose{background:#e86398;width:2.56px;height:4.16px;translate:.96px 3.68px}.sb-fab__timer{z-index:0;pointer-events:none;position:absolute;overflow:hidden}.sb-fab__timer--bar{background:var(--sb-theme-fab-timer-track,#08080829);border-radius:999px;height:2px;bottom:4px;left:59px;right:29px}.sb-fab[data-timer-direction=rtl] .sb-fab__timer--bar{left:29px;right:59px}.sb-fab__timer--fill{border-radius:inherit;background:var(--sb-theme-fab-timer-track,#08080829);inset:0}.sb-fab__timer-fill{border-radius:inherit;background:var(--sb-theme-fab-timer-fill,#080808e6);width:100%;height:100%;transform-origin:var(--sb-fab-timer-origin,left);animation:sb-fab-timer-bar var(--sb-timer-duration) linear forwards;display:block}.sb-sheet-root{z-index:1100;position:fixed;inset:0}.sb-sheet-root__overlay{background:var(--sb-overlay);cursor:pointer;border:none;animation:.2s ease-in both sb-overlay-in;position:absolute;inset:0}.sb-sheet-root--exiting{pointer-events:none}.sb-sheet-root--exiting .sb-sheet-root__overlay{animation:.2s ease-in forwards sb-overlay-out}.sb-sheet{width:min(100%,100vw);min-height:418px;padding:24px 20px calc(18px + env(safe-area-inset-bottom,0px));box-sizing:border-box;background:var(--sb-surface);box-shadow:var(--sb-shadow);color:var(--sb-text);animation:sb-sheet-in-mobile .45s var(--sb-sheet-motion-ease) both;border-radius:40px 40px 0 0;position:absolute;bottom:0;left:0;right:0}.sb-sheet--thanks{min-height:381px;padding-top:18px}.sb-sheet__header{justify-content:flex-end;align-items:flex-start;min-height:28px;margin-bottom:22px;display:flex;position:relative}.sb-progress{background:var(--sb-theme-sheet-progress-track,#eaeaea);border-radius:999px;width:219px;max-width:calc(100% - 96px);height:6px;position:absolute;top:5px;left:50%;overflow:hidden;transform:translate(-50%)}.sb-progress__fill{border-radius:inherit;background:var(--sb-theme-sheet-progress-fill,#080808);height:100%;transition:width .22s var(--sb-ease);display:block}.sb-sheet__close{background:var(--sb-theme-sheet-close-button-background,transparent);width:20px;height:20px;color:var(--sb-theme-sheet-close-button-foreground,var(--sb-text));cursor:pointer;border:none;padding:0}.sb-sheet__close svg,.sb-next svg,.sb-thanks__icon-core svg{width:100%;height:100%;display:block}.sb-sheet__body{gap:26px;display:grid}.sb-sheet__copy{justify-items:center;gap:8px;display:grid}.sb-sheet__eyebrow{color:var(--sb-theme-content-helper,var(--sb-text-muted));text-align:center;margin:0;font-size:16px;font-weight:400;line-height:1.4}.sb-sheet__body h2,.sb-thanks__copy h2{color:var(--sb-theme-content-heading,var(--sb-text));text-align:center;margin:0;font-size:22px;font-weight:600;line-height:1.2}.sb-sheet__body h2{justify-self:center;width:min(297px,100%)}.sb-choice--selected,.sb-choice:hover,.sb-textarea-shell:focus-within{border-color:var(--sb-theme-choice-hover-border,var(--sb-border-active))}.sb-choice:hover{background:var(--sb-theme-choice-hover-background,var(--sb-surface));color:var(--sb-theme-choice-hover-foreground,var(--sb-text))}.sb-choice:active{border-color:var(--sb-theme-choice-pressed-border,var(--sb-border-active));background:var(--sb-theme-choice-pressed-background,var(--sb-surface-muted));color:var(--sb-theme-choice-pressed-foreground,var(--sb-text))}.sb-choice--selected{box-shadow:0 0 0 3px #0808080d}.sb-choice:disabled{border-color:var(--sb-theme-choice-disabled-border,#e2e2e2);background:var(--sb-theme-choice-disabled-background,#f2f2f2);color:var(--sb-theme-choice-disabled-foreground,#5c5c5c);cursor:not-allowed}.sb-question--choices{grid-template-columns:repeat(2,160px);justify-content:center;justify-self:center;gap:9px;width:min(330px,100%)}.sb-choice{border:1px solid var(--sb-theme-choice-default-border,#e2e2e2);background:var(--sb-theme-choice-default-background,var(--sb-surface));width:160px;height:51px;color:var(--sb-theme-choice-default-foreground,var(--sb-text));text-align:center;white-space:nowrap;cursor:pointer;transition:transform .2s var(--sb-ease), border-color .18s ease, box-shadow .18s ease, background-color .18s ease;border-radius:999px;justify-content:center;align-items:center;padding:0 16px;font-size:16px;font-weight:700;line-height:1.2;display:flex}.sb-choice__label{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.sb-choice--other{border-color:var(--sb-theme-choice-default-border,#e2e2e2);padding:0;font-weight:400}.sb-choice__other-content{align-items:center;gap:0;display:inline-flex}.sb-choice__other-caret{background:var(--sb-theme-input-foreground,var(--sb-text));flex:none;width:1px;height:22px}.sb-choice__other-label{color:var(--sb-theme-input-placeholder,#08080866);line-height:1.2}.sb-choice--selected{border-color:var(--sb-theme-choice-selected-border,var(--sb-text));background:var(--sb-theme-choice-selected-background,var(--sb-text));color:var(--sb-theme-choice-selected-foreground,var(--sb-surface))}.sb-question--text{justify-self:center;width:min(330px,100%)}.sb-textarea-shell{border:1px solid var(--sb-theme-input-border,#08080833);background:var(--sb-theme-input-background,var(--sb-surface));border-radius:16px;width:100%;min-height:155px;transition:border-color .18s,box-shadow .18s}.sb-textarea{resize:none;width:100%;min-height:155px;color:var(--sb-theme-input-foreground,var(--sb-text));font:inherit;box-sizing:border-box;background:0 0;border:none;outline:none;padding:16px 22px;font-size:16px;line-height:1.2}.sb-textarea::placeholder{color:var(--sb-theme-input-placeholder,#08080866)}.sb-textarea-shell:focus-within{border-color:var(--sb-theme-input-focused-border,var(--sb-border-active))}.sb-textarea:disabled{color:var(--sb-theme-input-disabled-foreground,var(--sb-text-muted))}.sb-textarea-shell:has(.sb-textarea:disabled){background:var(--sb-theme-input-disabled-background,var(--sb-surface-muted))}.sb-sheet__footer{min-height:84px;margin:0 -20px calc(-18px - env(safe-area-inset-bottom,0px));padding:18px 20px calc(18px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--sb-theme-sheet-divider,#e2e2e2);box-sizing:border-box;justify-content:flex-end;align-items:center;gap:16px;display:flex}.sb-next,.sb-button{cursor:pointer;min-height:48px;font:inherit;transition:transform .2s var(--sb-ease), opacity .18s ease, box-shadow .18s ease;border:none;border-radius:999px}.sb-next{background:var(--sb-theme-button-primary-background,#080808);width:101px;color:var(--sb-theme-button-primary-foreground,#fff);place-items:center;padding:0;display:grid}.sb-next--acknowledging svg{animation:.36s cubic-bezier(.2,.8,.2,1) both sb-next-acknowledgement}.sb-next:disabled,.sb-button:disabled{cursor:not-allowed;box-shadow:none;transform:none}.sb-next:disabled{background:var(--sb-theme-button-primary-disabled-background,#080808);color:var(--sb-theme-button-primary-disabled-foreground,#fff)}.sb-thanks{justify-items:center;gap:23px;padding-top:12px;display:grid}.sb-thanks__icon-shell{background:var(--sb-theme-completion-outer-background,#f0f0f0);border-radius:999px;place-items:center;width:120px;height:120px;display:grid}.sb-thanks__icon-core{background:var(--sb-theme-completion-inner-background,#080808);width:66px;height:66px;color:var(--sb-theme-completion-glyph,#fff);border-radius:999px;place-items:center;display:grid}.sb-thanks__copy{gap:8px;max-width:313px;display:grid}.sb-thanks__copy h2{letter-spacing:-.03em;font-size:30px;line-height:1.1}.sb-thanks__copy p{color:var(--sb-theme-content-body,var(--sb-text-muted));text-align:center;margin:0;font-size:14px;line-height:1.3}.sb-thanks__actions{gap:10px;width:100%;display:flex}.sb-button{flex:1 1 0;padding:16px;font-size:14px;font-weight:600;line-height:1}.sb-button--primary{background:var(--sb-theme-button-primary-background,#080808);color:var(--sb-theme-button-primary-foreground,#fff)}.sb-button--secondary{background:var(--sb-theme-button-secondary-background,#f2f2f2);color:var(--sb-theme-button-secondary-foreground,var(--sb-text))}.sb-button--tertiary{background:var(--sb-theme-button-tertiary-background,transparent);color:var(--sb-theme-button-tertiary-foreground,var(--sb-text))}.sb-button--primary:hover,.sb-button--primary:focus-visible{background:var(--sb-theme-button-primary-hover-background,#080808)}.sb-button--secondary:hover,.sb-button--secondary:focus-visible{background:var(--sb-theme-button-secondary-hover-background,#f2f2f2)}.sb-button--tertiary:hover,.sb-button--tertiary:focus-visible{background:var(--sb-theme-button-tertiary-hover-background,#f2f2f2)}.sb-button--primary:active{background:var(--sb-theme-button-primary-pressed-background,#080808)}.sb-button--secondary:active{background:var(--sb-theme-button-secondary-pressed-background,#e2e2e2)}.sb-button--tertiary:active{background:var(--sb-theme-button-tertiary-pressed-background,#e2e2e2)}.sb-button--primary:disabled{background:var(--sb-theme-button-primary-disabled-background,#080808);color:var(--sb-theme-button-primary-disabled-foreground,#fff)}.sb-button--secondary:disabled{background:var(--sb-theme-button-secondary-disabled-background,#f2f2f2);color:var(--sb-theme-button-secondary-disabled-foreground,var(--sb-text))}.sb-button--tertiary:disabled{background:var(--sb-theme-button-tertiary-disabled-background,#f2f2f2);color:var(--sb-theme-button-tertiary-disabled-foreground,var(--sb-text))}@media (width>=768px){.sb-fab{bottom:24px;right:24px}}.sb-sheet-root__overlay{padding:0}.sb-sheet{top:auto;right:auto;bottom:calc(8px + env(safe-area-inset-bottom,0px));width:min(376px,100% - 24px);min-height:0;max-height:calc(100% - 16px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));box-shadow:none;animation:sb-card-in .45s var(--sb-sheet-motion-ease) both;interpolate-size:allow-keywords;border-radius:40px;padding:0;transition:height .45s cubic-bezier(0,.83,.363,.994);position:absolute;left:50%;overflow:hidden;transform:translate(-50%)}.sb-sheet-root--exiting .sb-sheet{animation:.45s ease-in forwards sb-card-out}.sb-sheet--thanks{min-height:0;padding:22px 20px}.sb-sheet__header{height:50px;min-height:0;margin:0;display:block;position:relative}.sb-progress{width:216px;max-width:calc(100% - 96px);height:6px;top:27px}.sb-progress__fill{transition:width .45s var(--sb-sheet-motion-ease)}.sb-sheet__close{box-sizing:border-box;border-radius:1000px;width:40px;height:40px;padding:8px;position:absolute;top:10px;right:16px}.sb-sheet__body{display:block}.sb-step{animation:.25s ease-in-out both sb-step-in}.sb-sheet__copy{box-sizing:border-box;align-content:center;justify-items:center;gap:0;height:88px;padding:0 23px;display:grid}.sb-sheet__body h2{text-align:center;text-wrap:balance;width:100%;margin:0;font-size:19px;font-weight:600;line-height:1.22}.sb-sheet__body--sentiment{padding:12px 24px 22px}.sb-sheet__body--sentiment .sb-sheet__copy{gap:8px;height:auto;min-height:84px;padding:0}.sb-sheet__body--sentiment .sb-sheet__eyebrow{color:var(--sb-theme-content-helper,var(--sb-text-muted));text-align:center;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin:0;font-size:16px;font-weight:400;line-height:1.2;display:-webkit-box;overflow:hidden}.sb-sheet__body--sentiment h2{-webkit-line-clamp:3;-webkit-box-orient:vertical;font-size:22px;font-weight:600;line-height:1.2;display:-webkit-box;overflow:hidden}.sb-sheet__body--sentiment h2.sb-sheet__acknowledgement{align-content:center;min-height:70px;font-size:29px;line-height:1.08;animation:.28s cubic-bezier(.2,.8,.2,1) both sb-acknowledgement-in}.sb-question{justify-items:stretch;display:grid}.sb-question--sentiment{grid-template-columns:repeat(2,80px);justify-content:center;gap:25px;width:185px;margin:37px auto 31px;position:relative}.sb-sheet__body--sentiment:has(.sb-sheet__acknowledgement) .sb-question--sentiment{margin-top:35px}.sb-sentiment{z-index:0;border:1.111px solid var(--sb-theme-choice-default-border,#e2e2e2);background:var(--sb-theme-choice-default-background,var(--sb-surface));width:80px;height:80px;color:var(--sb-theme-choice-default-foreground,var(--sb-text));cursor:pointer;border-radius:50%;place-items:center;padding:0;transition:transform .12s ease-out,border-color .18s,background-color .18s;display:grid;position:relative}.sb-sentiment__icon{z-index:1;width:35.5556px;height:35.5556px}.sb-sentiment__icon svg{width:100%;height:100%;display:block}.sb-sentiment:hover{border-color:var(--sb-theme-choice-hover-border,var(--sb-border-active));background:var(--sb-theme-choice-hover-background,var(--sb-surface));color:var(--sb-theme-choice-hover-foreground,var(--sb-text))}.sb-sentiment:active{border-color:var(--sb-theme-choice-pressed-border,var(--sb-border-active));background:var(--sb-theme-choice-pressed-background,var(--sb-surface-muted));color:var(--sb-theme-choice-pressed-foreground,var(--sb-text));transform:scale(.97)}.sb-sentiment--selected,.sb-sentiment--selected:disabled{border-color:var(--sb-theme-choice-selected-border,var(--sb-text));background:var(--sb-theme-choice-selected-background,var(--sb-text));color:var(--sb-theme-choice-selected-foreground,var(--sb-surface))}.sb-sentiment:disabled:not(.sb-sentiment--selected){border-color:var(--sb-theme-choice-disabled-border,#e2e2e2);background:var(--sb-theme-choice-disabled-background,#f2f2f2);color:var(--sb-theme-choice-disabled-foreground,#5c5c5c)}.sb-sentiment:disabled{cursor:default}.sb-spark-ring{z-index:-1;pointer-events:none;animation:.22s cubic-bezier(.25,.46,.45,.94) both sb-spark-ring-in;position:absolute;inset:-26px}.sb-spark-ring__spark{--sb-spark-angle:calc(var(--sb-spark-index) * 30deg);width:7px;height:7px;transform:translate(-50%, -50%) rotate(var(--sb-spark-angle)) translateY(-54px);background:#dedede;border-radius:50%;position:absolute;top:50%;left:50%}.sb-spark-ring__spark:nth-child(2n){width:12px;height:12px;transform:translate(-50%, -50%) rotate(var(--sb-spark-angle)) translateY(-59px)}.sb-question--choices,.sb-question--text{justify-self:stretch;width:auto;margin:0 24px}.sb-question--choices{scrollbar-gutter:stable;align-content:start;gap:8px;max-height:320.5px;overflow:hidden auto}.sb-question--choices-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sb-question--choices-single{grid-template-columns:minmax(0,1fr)}.sb-question--choices-scrolling{padding-bottom:20px}.sb-choice{white-space:normal;overflow-wrap:anywhere;width:100%;min-width:0;height:51px;padding:0 8px}.sb-question--choices-single .sb-choice{text-align:left;border-radius:16px;justify-content:flex-start;height:auto;min-height:51px;padding:16px 22px}.sb-choice--other{color:var(--sb-theme-input-placeholder,#08080866);gap:0;font-weight:400}.sb-choice--other:before{background:var(--sb-theme-input-foreground,var(--sb-text));flex:0 0 1px;width:1px;height:22px;position:static;transform:none}.sb-question--text{padding-top:10px}.sb-question--other{animation:.25s ease-in-out both sb-step-in}.sb-textarea-shell,.sb-textarea{height:155px;min-height:155px}.sb-textarea{padding:17px 22px;font-size:16px;font-weight:400;line-height:1.2}.sb-sheet__body--question{padding-bottom:16px}.sb-sheet__footer{border-top:1px solid var(--sb-theme-sheet-divider,#e2e2e2);justify-content:flex-end;align-items:center;gap:16px;min-height:84px;margin:0;padding:16px 20px 20px;display:flex}.sb-sheet__footer-comment{color:var(--sb-theme-content-helper,var(--sb-text-muted));text-align:left;-webkit-line-clamp:2;-webkit-box-orient:vertical;flex:auto;margin:0;font-size:16px;font-weight:600;line-height:1.2;animation:.18s ease-out both sb-footer-comment-in,.18s ease-in 1s forwards sb-footer-comment-out;display:-webkit-box;overflow:hidden}.sb-next{flex:0 0 101px;height:48px}.sb-next svg{width:20px;height:20px;transform:none}.sb-sheet--completing .sb-progress__fill{transition-duration:.5s}.sb-thanks{gap:23px;padding:0;animation:.3s ease-in-out .89s both sb-completion-in}.sb-thanks__icon-shell{animation:sb-completion-icon-in .72s var(--sb-sheet-motion-ease) .35s both}.sb-thanks__icon-core svg{width:35.44px;height:27.02px}.sb-thanks__copy{width:100%;max-width:330px}.sb-thanks__copy h2{letter-spacing:-.6px;font-weight:600}.sb-thanks__copy p{max-width:292px;margin-inline:auto;line-height:1.5}.sb-thanks__actions{gap:10px}.sb-choice-measure{white-space:nowrap;visibility:hidden;width:max-content;padding:0 8px;font-size:16px;font-weight:700;position:fixed;top:-10000px;left:-10000px}.sb-choice-measure--other{padding-left:9px;padding-right:8px;font-weight:400}@keyframes sb-fab-enter-scale{0%{scale:0}to{scale:1}}@keyframes sb-fab-enter-width{0%{width:60px;translate:var(--sb-fab-anchor-offset) 0}to{width:var(--sb-fab-expanded-width);translate:0}}@keyframes sb-fab-label-in{0%{opacity:0}to{opacity:1}}@keyframes sb-fab-timer-in{0%{opacity:0}to{opacity:1}}@keyframes sb-fab-exit-width{0%{width:var(--sb-fab-exit-width,var(--sb-fab-expanded-width));translate:var(--sb-fab-exit-offset,0) 0}to{width:60px;translate:var(--sb-fab-anchor-offset) 0}}@keyframes sb-fab-label-out{0%{opacity:var(--sb-fab-exit-label-opacity,1)}to{opacity:0}}@keyframes sb-fab-badge-out{0%{scale:1}to{scale:0}}@keyframes sb-fab-exit-scale{0%{scale:var(--sb-fab-exit-scale,1)}to{scale:0}}@keyframes sb-sheet-in-mobile{0%{opacity:0;transform:translateY(28px)}to{opacity:1;transform:translateY(0)}}@keyframes sb-sheet-in-desktop{0%{opacity:0;transform:translate(-50%,calc(28px - 50%))}to{opacity:1;transform:translate(-50%,-50%)}}@keyframes sb-sheet-out-mobile{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(100%)}}@keyframes sb-sheet-out-desktop{0%{opacity:1;transform:translate(-50%,-50%)}to{opacity:0;transform:translate(-50%,100vh)}}@keyframes sb-overlay-in{0%{opacity:0}to{opacity:1}}@keyframes sb-overlay-out{0%{opacity:1}to{opacity:0}}@keyframes sb-fab-timer-bar{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@keyframes sb-card-in{0%{opacity:0;transform:translate(-50%,28px)}to{opacity:1;transform:translate(-50%)}}@keyframes sb-card-out{0%{opacity:1;transform:translate(-50%)}to{opacity:0;transform:translate(-50%,calc(100% + 8px))}}@keyframes sb-step-in{0%{opacity:0}to{opacity:1}}@keyframes sb-acknowledgement-in{0%{opacity:0;transform:scale(1.12)}to{opacity:1;transform:scale(1)}}@keyframes sb-next-acknowledgement{0%,to{rotate:0deg;scale:1}39%{rotate:-14deg;scale:1.18}}@keyframes sb-spark-ring-in{0%{opacity:0;transform:scale(.55)}to{opacity:1;transform:scale(1)}}@keyframes sb-footer-comment-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@keyframes sb-footer-comment-out{0%{opacity:1}to{opacity:0}}@keyframes sb-completion-icon-in{0%{opacity:0;transform:translateY(46px)scale(.72)}58%{opacity:1;transform:translateY(46px)scale(1.82)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes sb-completion-in{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@media (prefers-reduced-motion:reduce){.sb-fab--entering,.sb-fab--entering .sb-fab__label,.sb-fab--entering .sb-fab__timer,.sb-fab--exiting,.sb-fab--exiting .sb-fab__label,.sb-fab--exiting .sb-fab__badge,.sb-sheet,.sb-step,.sb-spark-ring,.sb-sheet__acknowledgement,.sb-sheet__footer-comment,.sb-thanks,.sb-thanks__icon-shell,.sb-sheet-root__overlay,.sb-sheet-root--exiting .sb-sheet,.sb-sheet-root--exiting .sb-sheet-root__overlay{animation-duration:.001ms;animation-delay:0s}.sb-fab--entering .sb-fab__timer-fill{animation-delay:0s}.sb-sheet__footer-comment{animation:none}}`;function J(e,t){let n=document.createElement(e);return n.className=t,n}var Ot=class{root=J(`div`,`sb-snackbar-root`);shell=J(`div`,`sb-snackbar-shell`);surface=J(`div`,`sb-snackbar-surface`);compact=J(`div`,`sb-snackbar-compact`);card=J(`div`,`sb-snackbar-card`);overlay=document.createElement(`button`);close=document.createElement(`button`);acknowledgement=J(`span`,`sb-bar-acknowledgement`);acknowledgementCopy=J(`span`,`sb-bar-acknowledgement-copy`);barContent=J(`div`,`sb-bar-content`);answers=new Map;timers=new Set;observer;session;stage=`entering`;expanded=!1;destroyed=!1;seen=!1;cancelVisibilityGate=null;store;safeAreaProbe;renderCard;onReady;constructor(e,t,n,r,i,a){this.store=e,this.safeAreaProbe=r,this.renderCard=i,this.onReady=a,this.session=t;let o=t.sentimentPresentation===`bar`;this.root.dataset.presentation=t.sentimentPresentation,this.root.dataset.position=t.barPosition;let s=t.survey.questions[t.survey.root_node_id],{imageUrl:c}=x(s,t.survey.fab);this.compact.setAttribute(`role`,`group`),this.compact.setAttribute(`aria-label`,s.prompt);let l=J(`span`,`sb-snackbar-artwork`);l.setAttribute(`aria-hidden`,`true`);let u=J(`span`,`sb-fab__badge-artwork`);for(let e of[`center`,`amber`,`mint`,`rose`])u.append(J(`span`,`sb-fab__badge-glyph-${e}`));if(l.append(u),c){let e=document.createElement(`img`);e.src=c,e.alt=``,e.addEventListener(`error`,()=>e.remove(),{once:!0}),l.append(e)}let d=J(`p`,`sb-snackbar-prompt`);d.textContent=s.prompt,o&&t.barBehavior===`dismiss`&&(this.acknowledgement.setAttribute(`role`,`status`),this.acknowledgement.append(this.acknowledgementCopy));let f=J(`div`,`sb-snackbar-answers`);for(let n of s.answers??[]){let r=document.createElement(`button`);r.type=`button`,r.className=`sb-snackbar-answer`,r.setAttribute(`aria-label`,n.label),r.innerHTML=A(n)?Tt:Et,r.addEventListener(`click`,()=>{this.confirmSeenByUser(),e.answerSnackbar(t.presentationId,n.id)}),this.answers.set(n.id,r),f.append(r)}let p=t.survey.fab?.timerStyle??`none`,m=null;p!==`none`&&(m=J(`span`,`sb-snackbar-timer sb-snackbar-timer--${p}`),m.setAttribute(`aria-hidden`,`true`),m.append(J(`span`,`sb-snackbar-timer-fill`)),p===`bar`&&!o?d.append(m):this.compact.append(m)),o||this.compact.append(l),o?(this.barContent.append(d,f),this.compact.append(this.barContent)):this.compact.append(d,f),this.overlay.type=`button`,this.overlay.className=`sb-snackbar-overlay`,this.overlay.tabIndex=-1,this.overlay.setAttribute(`aria-hidden`,`true`),this.overlay.addEventListener(`click`,()=>void e.closeSurvey()),this.close.type=`button`,this.close.className=o?`sb-bar-dismiss`:`sb-snackbar-close`,o?this.close.textContent=`Not Now`:(this.close.setAttribute(`aria-label`,`Close survey`),this.close.innerHTML=St),this.close.addEventListener(`click`,this.closeByUser),this.surface.append(this.compact,this.card),this.shell.append(this.surface),o?this.compact.append(this.close):this.shell.append(this.close),o&&t.barBehavior===`dismiss`&&this.compact.append(this.acknowledgement),this.root.append(this.overlay,this.shell),n.append(this.root),this.observer=typeof ResizeObserver>`u`?null:new ResizeObserver(this.updatePlacement),this.observer?.observe(this.compact),this.observer?.observe(this.card),window.addEventListener(`resize`,this.updatePlacement),window.visualViewport?.addEventListener(`resize`,this.updatePlacement),window.visualViewport?.addEventListener(`scroll`,this.updatePlacement),o&&(this.surface.addEventListener(`pointerenter`,this.onPointerEnter),this.surface.addEventListener(`pointerleave`,this.onPointerLeave)),this.update(t),this.after(ht(o,this.reducedMotion()),this.startVisibilityGate),this.after(o?this.reducedMotion()?G.reduced:mt:this.reducedMotion()?0:p===`none`?W.entrance:W.timerEntrance,()=>{this.stage=`compact`,this.updateStage(),e.confirmEntryDisplayed(t.presentationId),e.confirmFabEntranceCompleted(t.presentationId),this.startVisibilityGate(),o&&this.surface.matches(`:hover`)&&window.matchMedia?.(`(hover: hover)`).matches&&e.setBarTimerPaused(t.presentationId,!0)})}startVisibilityGate=()=>{this.seen||this.cancelVisibilityGate||this.destroyed||(this.cancelVisibilityGate=nt(this.surface,()=>{this.cancelVisibilityGate=null,this.markSeen()}))};markSeen(){this.seen||this.destroyed||(this.seen=!0,this.cancelVisibilityGate?.(),this.cancelVisibilityGate=null,this.store.confirmPresentation(`expanded_fab`,this.session.presentationId))}confirmSeenByUser(){document.visibilityState!==`hidden`&&this.markSeen()}closeByUser=()=>{this.confirmSeenByUser(),this.store.closeSurvey()};update(e){this.session=e;for(let[t,n]of Object.entries(pt(e.survey.theme)))this.root.style.setProperty(t,n);this.root.style.setProperty(`--sb-snackbar-duration`,`${e.survey.fab?.expandedTimeout??0}ms`),this.root.style.setProperty(`--sb-snackbar-fraction`,String(e.snackbar?.frozenFraction??1)),this.root.dataset.counting=String(e.snackbar?.deadline!=null||e.snackbar?.pausedRemainingMs!=null),this.root.dataset.paused=String(e.snackbar?.pausedRemainingMs!=null),this.root.dataset.timed=String((e.survey.fab?.timerStyle===`bar`||e.survey.fab?.timerStyle===`fill`)&&typeof e.survey.fab.expandedTimeout==`number`&&e.survey.fab.expandedTimeout>0),this.root.dataset.frozen=String(e.snackbar?.frozenFraction!=null),this.root.dataset.expanded=String(e.isOpen),this.root.dataset.behavior=e.barBehavior;let t=e.sentimentPresentation===`bar`&&e.barBehavior===`dismiss`&&e.snackbar?.selectedKey!=null;if(this.root.dataset.rated=String(t),this.barContent.inert=t,this.barContent.toggleAttribute(`inert`,t),this.barContent.setAttribute(`aria-hidden`,String(t)),e.sentimentPresentation===`bar`&&e.barBehavior===`dismiss`){let t=e.survey.questions[e.survey.root_node_id].answers?.find(t=>t.id===e.snackbar?.selectedKey),n=t?t.comment?.trim()||`Thanks for your feedback.`:``;this.acknowledgementCopy.textContent!==n&&(this.acknowledgementCopy.textContent=n)}for(let[t,n]of this.answers)n.disabled=!e.fabEntranceCompleted||e.snackbar?.phase!==`question`,n.setAttribute(`aria-pressed`,String(e.snackbar?.selectedKey===t));if(e.isOpen){let t=this.renderCard(e);this.card.contains(t)||this.card.replaceChildren(t),this.expanded||(this.expanded=!0,this.stage=`widening`,this.after(this.reducedMotion()?0:W.widen,()=>{this.stage=`expanding`,this.updateStage()}),this.after(this.reducedMotion()?0:W.widen+W.expand,()=>{this.stage=`ready`,this.updateStage(),this.store.confirmPresentation(`sheet`,e.presentationId),this.store.confirmSnackbarContentReady(e.presentationId),this.onReady()}))}this.updateStage()}updateStage(){this.root.dataset.stage=this.stage,this.compact.inert=this.session.isOpen||this.stage===`entering`||this.stage===`exiting`,this.compact.toggleAttribute(`inert`,this.compact.inert),this.compact.setAttribute(`aria-hidden`,String(this.compact.inert)),this.card.inert=this.stage!==`ready`,this.card.toggleAttribute(`inert`,this.card.inert),this.card.setAttribute(`aria-hidden`,String(this.card.inert)),this.overlay.disabled=this.stage!==`ready`,this.close.disabled=this.session.isOpen||this.stage===`exiting`||this.root.dataset.rated===`true`,this.updatePlacement()}updatePlacement=()=>{if(this.stage===`exiting`)return;let e=window.visualViewport,t=e?.width||window.innerWidth,n=e?.height||window.innerHeight,r=getComputedStyle(this.safeAreaProbe),i=e=>Number.parseFloat(e)||0,{survey:a}=this.session,{placement:o}=x(a.questions[a.root_node_id],a.fab),s={viewport:{width:t,height:n},safeArea:{left:i(r.paddingLeft),right:i(r.paddingRight),top:i(r.paddingTop),bottom:i(r.paddingBottom)},compactHeight:64,cardHeight:this.card.querySelector(`.sb-sheet`)?.offsetHeight||0,barPosition:this.session.sentimentPresentation===`bar`?this.session.barPosition:void 0};this.root.style.setProperty(`--sb-snackbar-compact-width`,`${gt(o,s).compactWidth}px`);let c=this.root.dataset.rated===`true`;c&&(this.compact.style.minHeight=`48px`);let l=getComputedStyle(this.compact),u=Number.parseFloat(l.height)||this.compact.offsetHeight||(s.barPosition?48:64),d=c?Math.max(u,this.acknowledgementCopy.scrollHeight+i(l.paddingTop)+i(l.paddingBottom)):u;c&&this.compact.style.removeProperty(`min-height`);let f=gt(o,{...s,compactHeight:d});this.root.style.left=`${e?.offsetLeft??0}px`,this.root.style.top=`${e?.offsetTop??0}px`,this.root.style.width=`${t}px`,this.root.style.height=`${n}px`;let p=[`widening`,`expanding`,`ready`].includes(this.stage);this.root.style.setProperty(`--sb-bar-top`,`${p?f.cardTop:0}px`);let m=[`expanding`,`ready`].includes(this.stage),h={left:p?f.cardLeft:f.compactLeft,bottom:p?f.cardBottom:f.compactBottom,width:p?f.cardWidth:f.compactWidth,height:m?f.cardHeight:d,"compact-height":d,"card-width":f.cardWidth,"compact-width":f.compactWidth,"entrance-offset":f.entranceOffset,"max-height":f.maxCardHeight};for(let[e,t]of Object.entries(h))this.root.style.setProperty(`--sb-snackbar-${e}`,`${t}px`);this.shell.style.transformOrigin=f.transformOrigin};reducedMotion(){return window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}onPointerEnter=e=>{e.pointerType===`mouse`&&window.matchMedia?.(`(hover: hover)`).matches&&this.store.setBarTimerPaused(this.session.presentationId,!0)};onPointerLeave=()=>this.store.setBarTimerPaused(this.session.presentationId,!1);exit(e){for(let e of this.timers)clearTimeout(e);this.timers.clear(),this.stage=`exiting`,this.root.dataset.exiting=`true`;for(let e of this.answers.values())e.disabled=!0;this.updateStage(),this.after(this.reducedMotion()?G.reduced:G.removal,()=>{this.destroy(),e()})}after(e,t){let n=setTimeout(()=>{this.timers.delete(n),this.destroyed||t()},e);this.timers.add(n)}destroy(){this.destroyed=!0;for(let e of this.timers)clearTimeout(e);this.cancelVisibilityGate?.(),this.cancelVisibilityGate=null,this.observer?.disconnect(),window.removeEventListener(`resize`,this.updatePlacement),window.visualViewport?.removeEventListener(`resize`,this.updatePlacement),window.visualViewport?.removeEventListener(`scroll`,this.updatePlacement),this.surface.removeEventListener(`pointerenter`,this.onPointerEnter),this.surface.removeEventListener(`pointerleave`,this.onPointerLeave),this.root.remove()}},kt=1969.207,At=2169.207,jt=856.839,Mt=450;function Y(e,t){let n=document.createElement(e);return t&&(n.className=t),n}function X(e,t){let n=Y(`button`,e);return n.type=`button`,t&&n.setAttribute(`aria-label`,t),n}var Nt=0,Pt=class{host;root;store;unsubscribe;continueButton=null;activeFabEl=null;activeFabIdentity=null;outgoingFabEls=new Set;fabExitTimers=new Set;fabEntranceTimer=null;fabSettlingTimer=null;sheetEl=null;sheetRootEl=null;sheetExitTimer=null;progressTimer=null;completionRevealTimer=null;renderedProgress=null;renderedSheetStep=null;restoreFocus=null;restoreFocusPending=!1;safeAreaProbe;uiId=++Nt;snackbarUi=null;snackbarIdentity=null;outgoingSnackbarUis=new Set;constructor(e,t=document.body){this.store=e,this.host=Y(`div`),this.host.setAttribute(`data-sideband`,``),this.host.tabIndex=-1;let n=this.host.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=Dt,n.appendChild(r),this.safeAreaProbe=Y(`div`,`sb-safe-area-probe`),n.appendChild(this.safeAreaProbe),this.root=Y(`div`),n.appendChild(this.root),t.appendChild(this.host),this.applyTheme(),this.unsubscribe=e.subscribe(e=>{if(e===`text`){this.updateContinueButton();return}if(e===`select`){let e=this.focusedChoiceValue();this.render();let t=this.root.querySelector(`.sb-question--other-text .sb-textarea`);if(t){t.focus();return}if(e){for(let t of this.root.querySelectorAll(`[data-choice-value]`))if(t.dataset.choiceValue===e){t.focus();break}}return}this.render(e===`transition`)}),window.addEventListener(`keydown`,this.onKeyDown),window.addEventListener(`resize`,this.onViewportChange),window.addEventListener(`orientationchange`,this.onViewportChange),window.visualViewport?.addEventListener(`resize`,this.onViewportChange),window.visualViewport?.addEventListener(`scroll`,this.onViewportChange),this.render()}destroy(){this.unsubscribe(),this.snackbarUi?.destroy();for(let e of this.outgoingSnackbarUis)e.destroy();this.outgoingSnackbarUis.clear(),this.clearFabEntranceTimer();for(let e of this.fabExitTimers)clearTimeout(e);this.fabExitTimers.clear(),this.sheetExitTimer!==null&&(clearTimeout(this.sheetExitTimer),this.sheetExitTimer=null),this.progressTimer!==null&&clearTimeout(this.progressTimer),this.completionRevealTimer!==null&&clearTimeout(this.completionRevealTimer),window.removeEventListener(`keydown`,this.onKeyDown),window.removeEventListener(`resize`,this.onViewportChange),window.removeEventListener(`orientationchange`,this.onViewportChange),window.visualViewport?.removeEventListener(`resize`,this.onViewportChange),window.visualViewport?.removeEventListener(`scroll`,this.onViewportChange),this.host.remove()}onKeyDown=e=>{if(e.key===`Escape`&&(this.store.getState()?.isOpen||this.snackbarUi&&this.host.shadowRoot?.activeElement)){this.snackbarUi&&!this.store.getState()?.isOpen?this.snackbarUi.closeByUser():this.store.closeSurvey();return}if(e.key!==`Tab`||!this.sheetEl||this.store.getState()?.snackbar?.phase===`awaitingReady`)return;let t=Array.from(this.sheetEl.querySelectorAll(`button:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`));if(!t.length){e.preventDefault(),this.sheetEl.querySelector(`[tabindex="-1"]`)?.focus();return}let n=this.root.getRootNode(),r=n instanceof ShadowRoot?n.activeElement:null,i=t.indexOf(r),a=e.shiftKey?i<=0?t.length-1:i-1:i===t.length-1?0:i+1;e.preventDefault(),t[a]?.focus()};focusTextArea(e){queueMicrotask(()=>{e.isConnected&&!e.disabled&&e.focus()})}selectedChoice(e){let t=this.store.currentDraft()?.answer_key;return e.answers?.find(e=>w(e)===t)}selectedChoiceComment(e){return this.selectedChoice(e)?.comment?.trim()||null}estimatedTextWidth(e){let t=0;for(let n of e)t+=/[MW@#%&]/.test(n)?11:/[ilI1.,' ]/.test(n)?4:7.5;return Math.ceil(t)}onViewportChange=()=>{let e=this.store.getState(),t=this.root.querySelector(`.sb-fab`);e?.fabState===`expanded`&&!e.isOpen&&t&&this.updateFabPlacement(t,e)};render(e=!1){let t=this.store.getState();if(this.continueButton=null,t){for(let e of this.outgoingSnackbarUis)e.destroy();this.outgoingSnackbarUis.clear(),this.restoreFocusPending=!1,this.applyTheme(t.survey.theme)}if(this.snackbarUi&&this.snackbarIdentity!==t?.presentationId){let e=this.snackbarUi;!t&&e.root.dataset.presentation===`bar`?(this.outgoingSnackbarUis.add(e),e.exit(()=>{this.outgoingSnackbarUis.delete(e),this.restoreFocusWhenAnimationsComplete()})):e.destroy(),this.snackbarUi=null,this.snackbarIdentity=null,this.sheetEl=null,this.sheetRootEl=null}if(t?.snackbar){this.snackbarUi?(this.snackbarUi.update(t),e&&t.snackbar.phase===`journey`&&this.focusSheet()):(this.startActiveFabExit(),this.sheetExitTimer!==null&&clearTimeout(this.sheetExitTimer),this.sheetRootEl?.remove(),this.sheetEl=null,this.sheetRootEl=null,this.restoreFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.snackbarIdentity=t.presentationId,this.snackbarUi=new Ot(this.store,t,this.root,this.safeAreaProbe,e=>this.sheetEl&&this.sheetRootEl?(this.fillSheet(this.sheetEl,e),this.sheetRootEl):this.renderSheet(e),()=>this.focusSheet()));return}if(t&&(t.isOpen||t.completion)){this.startActiveFabExit(),this.sheetRootEl?.classList.contains(`sb-sheet-root--exiting`)&&(this.sheetExitTimer!==null&&(clearTimeout(this.sheetExitTimer),this.sheetExitTimer=null),this.sheetRootEl.classList.remove(`sb-sheet-root--exiting`)),this.sheetEl&&this.root.contains(this.sheetEl)?this.fillSheet(this.sheetEl,t):this.root.appendChild(this.renderSheet(t)),e&&this.focusSheet(),this.store.confirmPresentation(`sheet`);return}if(this.startSheetExit(),!t){this.startActiveFabExit(),this.restoreFocusPending=!0,this.restoreFocusWhenAnimationsComplete();return}if(t.fabState!==`hidden`){let e=typeof t.survey.impression_id==`string`?`${t.survey.pulse_id}:${t.survey.version}:${t.survey.impression_id}`:`${t.survey.pulse_id}:${t.survey.version}`;if(this.activeFabEl&&this.activeFabIdentity===e){this.applyFabPresentation(this.activeFabEl,t);return}this.startActiveFabExit();let n=this.renderFab(t);this.activeFabEl=n,this.activeFabIdentity=e,this.root.appendChild(n),this.applyFabPresentation(n,t),this.startFabEntranceConfirmation(n,e)}}updateContinueButton(){if(!this.continueButton)return;let e=this.store.getState();this.continueButton.disabled=!!e?.isBusy||!this.store.canContinue()}renderFab(e){let{survey:t,fabState:n}=e,r=C(t),i=X(`sb-fab sb-fab--${n} sb-fab--entering`,r);i.addEventListener(`click`,()=>{this.restoreFocus=i,this.store.openSurvey()});let a=Y(`span`,`sb-fab__badge`);if(a.setAttribute(`aria-hidden`,`true`),t.fab?.imageUrl){let e=Y(`img`,`sb-fab__badge-image`);e.src=t.fab.imageUrl,e.alt=``,e.addEventListener(`error`,()=>e.remove(),{once:!0}),a.appendChild(e)}let o=Y(`span`,`sb-fab__badge-artwork`);if(o.appendChild(Y(`span`,`sb-fab__badge-glyph-center`)),o.appendChild(Y(`span`,`sb-fab__badge-glyph-amber`)),o.appendChild(Y(`span`,`sb-fab__badge-glyph-mint`)),o.appendChild(Y(`span`,`sb-fab__badge-glyph-rose`)),a.appendChild(o),i.appendChild(a),n===`expanded`){let e=Y(`span`,`sb-fab__label`);e.textContent=r,i.appendChild(e)}return i}applyTheme(e){let t=e?ft(e):ut;for(let[e,n]of Object.entries(t))this.host.style.setProperty(e,n)}applyFabPresentation(e,t){this.updateFabPlacement(e,t),this.applyFabTimer(e,t)}updateFabPlacement(e,t){let n=window.visualViewport,r=n&&Number.isFinite(n.width)&&n.width>0?n.width:window.innerWidth,i=n&&Number.isFinite(n.height)&&n.height>0?n.height:window.innerHeight,a=n&&Number.isFinite(n.offsetLeft)?n.offsetLeft:0,o=n&&Number.isFinite(n.offsetTop)?n.offsetTop:0,s=this.readSafeArea(),c=e.querySelector(`.sb-fab__label`),l=c?c.scrollWidth||c.getBoundingClientRect().width||this.estimatedTextWidth(c.textContent??``):0,u=Math.max(0,r-s.left-s.right),d=Math.min(u,Math.max(86,86+Math.ceil(l))),f=e.getBoundingClientRect(),p=e.offsetHeight||f.height||60,m=bt(t.survey.fab?.placement,{viewport:{width:r,height:i},element:{width:d,height:p},safeArea:s});e.style.left=`${m.left+a}px`,e.style.top=`${m.top+o}px`,e.style.right=`auto`,e.style.bottom=`auto`,e.style.transformOrigin=m.transformOrigin,e.style.setProperty(`--sb-fab-expanded-width`,`${d}px`),e.style.setProperty(`--sb-fab-label-width`,`${Math.max(0,d-86)}px`);let h=Math.max(0,Math.min(1,t.survey.fab?.placement?.anchor.x??1));e.style.setProperty(`--sb-fab-anchor-offset`,`${(d-60)*h}px`)}applyFabTimer(e,t){let n=xt(t.survey.fab?.timerStyle,t.survey.fab?.expandedTimeout,`forward`),r=`${n.style}:${n.durationMs??`static`}`,i=e.querySelector(`.sb-fab__timer`);e.dataset.timerStyle=n.style;for(let[t,r]of Object.entries(n.cssVariables))e.style.setProperty(t,r);if(!n.visible){i?.remove(),delete e.dataset.timerSignature;return}let a=this.getTextDirection();if(e.style.setProperty(`--sb-fab-timer-origin`,a===`rtl`?`right`:`left`),e.dataset.timerDirection=a,i&&e.dataset.timerSignature===r)return;i?.remove();let o=Y(`span`,`sb-fab__timer sb-fab__timer--${n.style}`);o.setAttribute(`aria-hidden`,`true`),o.appendChild(Y(`span`,`sb-fab__timer-fill`)),e.appendChild(o),e.dataset.timerSignature=r}startFabEntranceConfirmation(e,t){this.clearFabEntranceTimer();let n=this.prefersReducedMotion();this.fabEntranceTimer=setTimeout(()=>{this.fabEntranceTimer=null,!(this.activeFabEl!==e||this.activeFabIdentity!==t)&&(this.store.confirmPresentation(`expanded_fab`),this.store.confirmFabEntranceCompleted())},n?0:kt);let r=e.querySelector(`.sb-fab__timer`)?At:kt;this.fabSettlingTimer=setTimeout(()=>{this.fabSettlingTimer=null,this.activeFabEl===e&&this.activeFabIdentity===t&&e.classList.remove(`sb-fab--entering`)},n?0:r)}clearFabEntranceTimer(){this.fabEntranceTimer!==null&&(clearTimeout(this.fabEntranceTimer),this.fabEntranceTimer=null),this.fabSettlingTimer!==null&&(clearTimeout(this.fabSettlingTimer),this.fabSettlingTimer=null)}startActiveFabExit(){let e=this.activeFabEl;if(!e)return;this.clearFabEntranceTimer();let t=getComputedStyle(e),n=Number.parseFloat(t.width)||e.offsetWidth||314,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`);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`),e.classList.remove(`sb-fab--entering`),e.classList.add(`sb-fab--exiting`),e.disabled=!0,e.setAttribute(`aria-hidden`,`true`),e.tabIndex=-1,this.activeFabEl=null,this.activeFabIdentity=null,this.outgoingFabEls.add(e);let c=this.prefersReducedMotion()?0:jt,l=setTimeout(()=>{this.fabExitTimers.delete(l),this.outgoingFabEls.delete(e),e.remove(),this.restoreFocusWhenAnimationsComplete()},c);this.fabExitTimers.add(l)}startSheetExit(){let e=this.sheetRootEl;if(!e||e.classList.contains(`sb-sheet-root--exiting`))return;e.classList.add(`sb-sheet-root--exiting`),e.setAttribute(`aria-hidden`,`true`),e.querySelectorAll(`button`).forEach(e=>{e.disabled=!0}),this.sheetEl=null;let t=this.prefersReducedMotion()?0:Mt;this.sheetExitTimer=setTimeout(()=>{this.sheetExitTimer=null,this.sheetRootEl===e&&(e.remove(),this.sheetRootEl=null,this.restoreFocusWhenAnimationsComplete())},t)}restoreFocusWhenAnimationsComplete(){!this.restoreFocusPending||this.activeFabEl||this.outgoingFabEls.size>0||this.outgoingSnackbarUis.size>0||this.sheetRootEl||(this.restoreFocus?.isConnected?this.restoreFocus.focus():this.restoreFocus&&this.host.focus(),this.restoreFocus=null,this.restoreFocusPending=!1,this.applyTheme())}prefersReducedMotion(){return window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}focusSheet(){(this.sheetEl?.querySelector(`.sb-textarea[autofocus]`)??this.sheetEl?.querySelector(`.sb-sheet__body h2, .sb-thanks__copy h2`)??this.sheetEl?.querySelector(`.sb-sheet__close, .sb-thanks__actions .sb-button`))?.focus()}getTextDirection(){return(this.host.getAttribute(`dir`)||getComputedStyle(this.host).direction)===`rtl`||document.documentElement.dir===`rtl`?`rtl`:`ltr`}focusedChoiceValue(){let e=this.root.getRootNode(),t=e instanceof ShadowRoot?e.activeElement:null;return t instanceof HTMLElement?t.dataset.choiceValue:void 0}readSafeArea(){let e=getComputedStyle(this.safeAreaProbe),t=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?Math.max(0,t):0};return{top:t(e.paddingTop),right:t(e.paddingRight),bottom:t(e.paddingBottom),left:t(e.paddingLeft)}}renderSheet(e){let t=Y(`div`,`sb-sheet-root`),n=X(`sb-sheet-root__overlay`,`Dismiss survey`);n.tabIndex=-1,n.addEventListener(`click`,()=>void this.store.closeSurvey()),t.appendChild(n);let r=Y(`div`,`sb-sheet`);return r.setAttribute(`role`,`dialog`),r.setAttribute(`aria-modal`,`true`),t.appendChild(r),this.sheetEl=r,this.sheetRootEl=t,this.renderedSheetStep=null,this.fillSheet(r,e),t}fillSheet(e,t){if(this.completionRevealTimer!==null&&(clearTimeout(this.completionRevealTimer),this.completionRevealTimer=null),e.classList.toggle(`sb-sheet--thanks`,!!t.completion),e.classList.toggle(`sb-sheet--sentiment`,!t.completion&&this.store.isSentimentStep()),e.classList.toggle(`sb-sheet--completing`,t.isCompleting),e.toggleAttribute(`aria-busy`,t.isCompleting),e.replaceChildren(),t.completion){this.renderedSheetStep=null,e.setAttribute(`aria-labelledby`,`sb-completion-${this.uiId}`),e.setAttribute(`aria-describedby`,`sb-completion-body-${this.uiId}`);let n=this.renderThankYou(t);e.appendChild(n),this.completionRevealTimer=setTimeout(()=>{this.completionRevealTimer=null,n.isConnected&&(n.querySelectorAll(`[data-reveal-content]`).forEach(e=>{e.removeAttribute(`aria-hidden`)}),n.querySelectorAll(`.sb-button`).forEach(e=>{e.disabled=!!this.store.getState()?.isBusy}),n.querySelector(`h2`)?.focus())},this.prefersReducedMotion()?0:890);return}let n=this.store.currentQuestion();n&&(e.setAttribute(`aria-labelledby`,`sb-question-${this.uiId}`),e.removeAttribute(`aria-describedby`),this.renderQuestionSheet(e,t,n))}renderQuestionSheet(e,t,n){let r=this.store.isSentimentStep(),i=this.selectedChoice(n),a=!!(i&&k(i)),o=`${t.presentationId}:${n.node_id}:${a?`text`:`question`}`,s=this.renderedSheetStep!==o;this.renderedSheetStep=o;let c=Y(`div`,`sb-sheet__header`);if(r)this.renderedProgress=null;else{let e=Y(`div`,`sb-progress`);e.setAttribute(`aria-hidden`,`true`);let n=Y(`span`,`sb-progress__fill`),r=Math.max(0,Math.min(1,t.isCompleting?1:this.store.progress())),i=this.renderedProgress??0;n.style.width=`${i*100}%`,this.renderedProgress=r,this.progressTimer!==null&&clearTimeout(this.progressTimer),this.progressTimer=setTimeout(()=>{this.progressTimer=null,n.isConnected&&(n.style.width=`${r*100}%`)},i===0?100:0),e.appendChild(n),c.appendChild(e)}let l=X(`sb-sheet__close`,`Close survey`);l.addEventListener(`click`,()=>void this.store.closeSurvey()),c.appendChild(l),e.appendChild(c);let u=Y(`div`,`sb-sheet__body ${s?`sb-step`:``} ${r?`sb-sheet__body--sentiment`:`sb-sheet__body--question`}`),d=Y(`div`,`sb-sheet__copy`),f=r?this.selectedChoiceComment(n):null;if(r&&!f){let e=Y(`p`,`sb-sheet__eyebrow`);e.textContent=t.survey.title,d.appendChild(e)}let p=Y(`h2`);if(p.id=`sb-question-${this.uiId}`,p.tabIndex=-1,p.textContent=f??n.prompt,f&&(p.className=`sb-sheet__acknowledgement`,p.setAttribute(`aria-live`,`polite`)),d.appendChild(p),u.appendChild(d),u.appendChild(this.renderQuestionView(n,r)),e.appendChild(u),this.store.shouldShowContinue()){let r=Y(`div`,`sb-sheet__footer`),i=this.selectedChoiceComment(n);if(i){let e=Y(`p`,`sb-sheet__footer-comment`);e.textContent=i,e.setAttribute(`aria-live`,`polite`),r.appendChild(e)}let a=X(`sb-next`,`Continue`);this.selectedChoice(n)&&a.classList.add(`sb-next--acknowledging`),a.innerHTML=Ct,a.disabled=t.isBusy||t.isCompleting||!this.store.canContinue(),a.addEventListener(`click`,()=>void this.store.advance()),r.appendChild(a),e.appendChild(r),this.continueButton=a}}renderQuestionView(e,t){let n=this.store.currentDraft(),r=this.store.getState(),i=!!(r?.isBusy||r?.isCompleting);if(t){let e=Y(`div`,`sb-question sb-question--sentiment`);return this.store.sentimentChoices().forEach(t=>{let a=n?.answer_key===w(t),o=X(`sb-sentiment ${a?`sb-sentiment--selected`:``}`,t.label);o.dataset.choiceValue=w(t),o.disabled=i||!!r?.sentimentSelectionLocked,o.setAttribute(`aria-pressed`,String(a));let s=A(t);if(a&&s){let e=Y(`span`,`sb-spark-ring`);e.setAttribute(`aria-hidden`,`true`);for(let t=0;t<12;t+=1){let n=Y(`span`,`sb-spark-ring__spark`);n.style.setProperty(`--sb-spark-index`,String(t)),e.appendChild(n)}o.appendChild(e)}let c=Y(`span`,`sb-sentiment__icon`);c.innerHTML=s?Tt:Et,o.appendChild(c),o.addEventListener(`click`,()=>void this.store.selectChoice(t)),e.appendChild(o)}),e}if(e.type===`yes_no`||e.type===`multiple_choice`){let t=this.selectedChoice(e);if(t&&k(t))return this.renderTextInput(t.label,`Other response`,!0,i,!0);let r=this.usesTwoColumnChoices(e.answers??[]),a=r?Math.ceil((e.answers?.length??0)/2):e.answers?.length??0,o=Y(`div`,`sb-question sb-question--choices sb-question--choices-${r?`grid`:`single`} ${a>=5?`sb-question--choices-scrolling`:``}`);for(let t of e.answers??[]){let e=n?.answer_key===w(t),r=X(`sb-choice ${e?`sb-choice--selected`:``} ${k(t)?`sb-choice--other`:``}`,t.label);if(r.dataset.choiceValue=w(t),r.disabled=i,r.setAttribute(`aria-pressed`,String(e)),k(t)){let e=Y(`span`,`sb-choice__other-content`);e.setAttribute(`aria-hidden`,`true`),e.appendChild(Y(`span`,`sb-choice__other-caret`));let n=Y(`span`,`sb-choice__label sb-choice__other-label`);n.textContent=t.label,e.appendChild(n),r.appendChild(e)}else{let e=Y(`span`,`sb-choice__label`);e.textContent=t.label,r.appendChild(e)}r.addEventListener(`click`,()=>void this.store.selectChoice(t)),o.appendChild(r)}return o}return this.renderTextInput(e.free_text_placeholder??`Please explain more... (Optional)`,e.prompt,e.required,i)}renderTextInput(e,t,n,r,i=!1){let a=Y(`div`,`sb-question sb-question--text ${i?`sb-question--other sb-question--other-text`:``}`),o=Y(`div`,`sb-textarea-shell`),s=Y(`textarea`,`sb-textarea`);return s.value=this.store.currentText(),s.disabled=r,s.placeholder=e,s.setAttribute(`aria-label`,t),n&&(s.autofocus=!0,this.focusTextArea(s)),s.addEventListener(`input`,()=>this.store.setText(s.value)),o.appendChild(s),a.appendChild(o),a}usesTwoColumnChoices(e){return e.every(e=>{let t=Y(`span`,`sb-choice-measure ${k(e)?`sb-choice-measure--other`:``}`);t.textContent=e.label.trim(),this.root.appendChild(t);let n=t.getBoundingClientRect().width||t.scrollWidth;t.remove();let r=this.estimatedTextWidth(e.label.trim())+(k(e)?17:16);return(n||r)<160})}renderThankYou(e){let t=e.completion,n=Y(`div`,`sb-thanks`),r=Y(`div`,`sb-thanks__icon-shell`);r.setAttribute(`aria-hidden`,`true`);let i=Y(`div`,`sb-thanks__icon-core`);i.innerHTML=wt,r.appendChild(i),n.appendChild(r);let a=Y(`div`,`sb-thanks__copy`);a.dataset.revealContent=``,a.setAttribute(`aria-hidden`,`true`);let o=Y(`h2`);o.id=`sb-completion-${this.uiId}`,o.tabIndex=-1,o.textContent=t?.title??``;let s=Y(`p`);if(s.id=`sb-completion-body-${this.uiId}`,s.textContent=t?.body??``,a.appendChild(o),a.appendChild(s),n.appendChild(a),t?.actions.length){let e=Y(`div`,`sb-thanks__actions`);e.dataset.revealContent=``,e.setAttribute(`aria-hidden`,`true`);for(let n of t.actions){let t=X(`sb-button sb-button--${n.style===`primary`||n.style===`secondary`?n.style:`tertiary`}`);t.textContent=n.label,t.disabled=!0,t.addEventListener(`click`,()=>void this.store.handleCompletionAction(n)),e.appendChild(t)}n.appendChild(e)}return n}};function Ft(e){if(typeof document>`u`&&e.ui!==!1)return{track:()=>{},tagUser:()=>{},untagUser:()=>{},sync:async()=>{throw Error(`Sideband UI runtime is unavailable during SSR.`)},flush:async()=>{},openSurvey:()=>{},presentSimulatedPulse:()=>!1,closeSurvey:async()=>{},getDeviceId:()=>``,destroy:()=>{}};let t=new M({syncInteraction:async e=>{n.submitInteraction(e)},trackEvent:(e,t)=>n.track(e,t),shouldPresentPulse:e.shouldPresentPulse,onRateApp:e.onRateApp,onError:e.onError}),n=qe({...e,libraryVersion:`1.4.6-rc.1`,onSyncResponse:e=>t.handleSyncResponse(e)}),r=e.ui===!1?null:new Pt(t);return n.start(),{track:n.track,tagUser:n.tagUser,untagUser:n.untagUser,sync:n.sync,flush:n.flush,openSurvey:()=>t.openSurvey(),presentSimulatedPulse:e=>t.presentSimulatedPulse(e),closeSurvey:()=>t.closeSurvey(),getDeviceId:n.getDeviceId,destroy:()=>{n.destroy(),r?.destroy(),t.destroy()}}}var Z=null;function Q(){if(!Z)throw Error(`Call Sideband.configure() before using Sideband.`);return Z}function It(e){$();let t=Ft(e);return Z=t,t}function Lt(e,t,n){Q().track(e,t,n)}function Rt(e){Q().tagUser(e)}function zt(){Q().untagUser()}function Bt(){return Q().flush()}function Vt(e){return Q().presentSimulatedPulse(e)}function $(){Z?.destroy(),Z=null}var Ht={configure:It,track:Lt,tagUser:Rt,untagUser:zt,flush:Bt,presentSimulatedPulse:Vt,destroy:$};return e.PendingInteractionStorageError=_,e.Sideband=Ht,e.SidebandApiError=Se,e.SurveySessionStore=M,e.SyncEngine=b,e.buildFabTitle=C,e.configure=It,e.createSidebandClient=Ce,e.destroy=$,e.flush=Bt,e.getChoiceValue=w,e.getDeviceId=u,e.getSessionId=d,e.presentSimulatedPulse=Vt,e.tagUser=Rt,e.track=Lt,e.untagUser=zt,e})({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sidebandai/sideband-web",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.6-rc.1",
|
|
4
4
|
"description": "Framework-agnostic web SDK for Sideband client sync surveys and prompts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"./iife": "./dist/sideband.iife.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@sidebandai/sideband-core": "1.4.
|
|
29
|
+
"@sidebandai/sideband-core": "1.4.6-rc.1"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "vite build --config ../../vite.html.config.ts && vite build --config ../../vite.html.config.ts --mode iife && tsc -p tsconfig.lib.json",
|