@sprig-technologies/sprig-browser 2.32.2 → 2.32.3

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.
@@ -0,0 +1,1000 @@
1
+ var Lt = Object.defineProperty;
2
+ var Ut = (t, e, n) => e in t ? Lt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var $ = (t, e, n) => (Ut(t, typeof e != "symbol" ? e + "" : e, n), n);
4
+ import { g as z, s as Xe, l as D, e as u, S as w, v as Ze, m as I, b as M, h as St, E as te, D as N, c as It, r as B, i as kt, j as Et, k as _t, n as qe, o as ze, a as xt, p as _e, d as Dt, q as et } from "./metricsReporter-Gimz6xcf.js";
5
+ const At = "360px", ir = "ul-app", nr = "#e6e6e6", or = "#bd282a", sr = 1030, We = () => {
6
+ try {
7
+ return window.parent.Intercom;
8
+ } catch {
9
+ return null;
10
+ }
11
+ }, He = [Object.freeze(Object.defineProperty({ __proto__: null, disable: () => {
12
+ const t = We();
13
+ t && (t.ul_wasVisible = !!document.querySelector("iframe.intercom-launcher-frame"), t.ul_wasVisible && t("update", { hide_default_launcher: !0 }));
14
+ }, enable: () => {
15
+ const t = We();
16
+ t && (t.ul_wasVisible && t("update", { hide_default_launcher: !1 }), delete t.ul_wasVisible);
17
+ } }, Symbol.toStringTag, { value: "Module" }))];
18
+ class Rt {
19
+ static disable() {
20
+ He.forEach((e) => e.disable());
21
+ }
22
+ static enable() {
23
+ He.forEach((e) => e.enable());
24
+ }
25
+ }
26
+ const Ne = "ul-view-sdk-script", Ot = ["ios", "android"], F = "visitors", q = "environments";
27
+ async function T(t, e) {
28
+ var i, o, a;
29
+ const { shouldDropOnRateLimit: n, ...s } = e;
30
+ s.headers = Object.assign(z(window.UserLeap), s.headers);
31
+ const r = await Xe(t, { ...s, shouldDropOnRateLimit: n });
32
+ if (r.ok) {
33
+ const l = (i = r.headers) == null ? void 0 : i.get("Authorization"), c = l ? l.split(" ") : void 0, d = c && c.length === 2 ? c[1] : void 0, p = (o = r.headers) == null ? void 0 : o.get("x-ul-visitor-id");
34
+ if (window.UserLeap.userId && p === window.UserLeap.visitorId) {
35
+ const y = D.getItemObject("sprig.anon.env.vid.map");
36
+ y && y[window.UserLeap.envId] === p && (delete y[window.UserLeap.envId], D.setItemObject("sprig.anon.env.vid.map", y));
37
+ }
38
+ d && p && (p !== window.UserLeap.visitorId || window.UserLeap.token !== d) && (x("token", d), x("vid", p), u.emit(w.VisitorIDUpdated, { visitorId: p }), window.UserLeap.token = d, window.UserLeap.visitorId = p);
39
+ }
40
+ return (a = r.json) != null && a.logMessage && console.warn(`[Sprig] ${r.json.logMessage}`), r;
41
+ }
42
+ function x(t, e) {
43
+ const n = D.getItemObject("userleap.ids");
44
+ let s = n[window.UserLeap.envId];
45
+ s ? s[t] = e : s = { [t]: e }, n[window.UserLeap.envId] = s, D.setItemObject("userleap.ids", n);
46
+ }
47
+ function xe() {
48
+ return window.previewMode ? "0" : window.UserLeap.visitorId ?? "";
49
+ }
50
+ function O(t, e, n) {
51
+ const s = [window.UserLeap._API_URL, "sdk", t];
52
+ return e && e.forEach((r) => {
53
+ s.push(r), r === q ? s.push(window.UserLeap.envId) : r === F && s.push(xe());
54
+ }), n && s.push(n), s.join("/");
55
+ }
56
+ const X = async (t, e) => {
57
+ var Te, je, Me;
58
+ const { context: n, delay: s, forceBrandedLogo: r, endCard: i, isFeedback: o = !1, heatmap: a, locale: l, previewMode: c, productConfig: d, questions: p, responseGroupUid: y, surveyId: g, uuid: m, vid: _, sessionReplay: b, studyType: U } = t, h = z(window.UserLeap), L = we(h), k = De(h);
59
+ if (b)
60
+ if (L)
61
+ u.emit(w.ReplayCapture, { responseGroupUid: y, hasQuestions: !!(p != null && p.length), surveyId: g, uploadId: b.uploadId, replayType: b.replayDurationType ?? "before", seconds: b.replayDurationSeconds, generateVideoUploadUrlPayload: { mediaRecordingUid: Ze(), mediaType: "screen", questionId: 1, responseGroupUid: y, surveyId: g, updatedAt: (/* @__PURE__ */ new Date()).toISOString(), visitorId: window.UserLeap.visitorId, isReplay: !0 } });
62
+ else {
63
+ if (!I.replay)
64
+ return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
65
+ I.replay.scheduleOrCaptureReplay({ responseGroupId: y, surveyId: g, visitorId: _, replayParams: b, completeUploadHeaders: h, apiUrl: window.UserLeap._API_URL, triggerTimestamp: Date.now(), isStandalone: p.length === 0 });
66
+ }
67
+ if (a) {
68
+ if (!I.replay)
69
+ return window.UserLeap.reportError("displayQuestions", new Error("Replay module not registered")), { success: !1, message: "Replay module not registered", surveyState: "no survey" };
70
+ const { eventId: S, replayParams: me, responseGroupUid: ht, surveyId: bt } = a;
71
+ await I.replay.initializeReplay({ maxReplayDurationSeconds: 300, maxInflightRequests: window.UserLeap.maxInflightReplayRequests, teardownAfter: !0 }), I.replay.tryReplayAction(() => {
72
+ var Fe;
73
+ return (Fe = I.replay) == null ? void 0 : Fe.scheduleCapture({ apiUrl: window.UserLeap._API_URL, completeUploadHeaders: h, eventId: S, isHeatmap: !0, replayParams: me, responseGroupId: ht, surveyId: bt, triggerTimestamp: Date.now(), visitorId: _ });
74
+ }, "Error in scheduling/capturing replay");
75
+ }
76
+ if (_ == null || !(p != null && p.length))
77
+ return M.info("CannotDisplaySurvey", { vid: _ }), { success: !1, message: "[Sprig] no survey found", surveyState: "no survey" };
78
+ if (window.UserLeap.container) {
79
+ M.info("AlreadyDisplayingSurvey");
80
+ const S = "[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";
81
+ return console.warn(S), { success: !1, message: S, surveyState: "no survey" };
82
+ }
83
+ if (_ !== window.UserLeap.visitorId && m !== window.UserLeap.visitorId && !window.previewMode) {
84
+ const S = "Attempted to display survey to a different visitor";
85
+ return window.UserLeap.reportError("DisplaySurvey", new Error(S)), { success: !1, message: S, surveyState: "no survey" };
86
+ }
87
+ M.info("ShowingSurvey", { surveyId: g }), (Te = I.replay) == null || Te.RecordSurveyShown({ id: g, userAgent: window.navigator.userAgent }), Rt.disable(), u.emit(w.SurveyWillPresent, { name: w.SurveyWillPresent, "survey.id": g });
88
+ let C, v, E, A, R = document.createElement("div");
89
+ const W = (S) => {
90
+ const { "view.version": me } = S;
91
+ me !== h["x-ul-sdk-version"] && rt(), u.removeListener("verify.view.version", W);
92
+ };
93
+ u.on("verify.view.version", W), window.UserLeap.useMobileStyling = k, St(h) ? (C = "ul-direct-embeded-frame", v = document.head, E = window, A = !1, L && (tt(g, o), R.id = C, window.UserLeap.container.appendChild(R), it(), u.emit(w.SurveyLifeCycle, { state: "presented" }), u.emit(w.SurveyPresented, { name: w.SurveyPresented, "survey.id": g }))) : { frameId: C, contentWinDocHead: v, contentWindow: E, hasOverlay: A, iframe: R } = Pt({ productConfig: d, useMobileStyling: k, surveyId: g, isFeedback: o }), window.UserLeap.frameId = C;
94
+ const P = { apiURL: window.UserLeap._API_URL, cards: p, configureExitOnOverlayClick: (S) => {
95
+ u.once(w.CloseSurveyOnOverlayClick, S);
96
+ }, context: n, endCard: i, envId: window.UserLeap.envId, eventEmitFn: u.emit.bind(u), fontFamily: window.UserLeap.fontFamily, fontFamilyURL: window.UserLeap.fontFamilyURL, forceBrandedLogo: r, frame: R, headers: h, locale: l, mobileSDKVersion: window.UserLeap.mobileSDKVersion, previewKey: D.getItem("sprig.previewKey"), previewMode: c, productConfig: { framePosition: d == null ? void 0 : d.framePosition, desktopDisplay: d == null ? void 0 : d.desktopDisplay, placement: d == null ? void 0 : d.placement }, responseGroupUid: y, startingQuestionIdx: (je = window.UserLeap.config) == null ? void 0 : je.startingQuestionIdx, studyType: U, styleNonce: window.UserLeap.styleNonce, surveyId: g, tabTitle: document.title, trackPageViewUrl: e, ulEvents: te, upchunkLibraryURL: window.UserLeap.upchunkLibraryURL, useMobileStyling: k, userId: m, viewDocument: E == null ? void 0 : E.document, viewWindow: E, visitorAttributes: { externalUserId: window.UserLeap.userId, email: window.UserLeap.email }, ...window.UserLeap._config };
97
+ (Me = window.UserLeap._config) != null && Me.startingQuestionIdx && (window.UserLeap._config = { ...window.UserLeap._config, startingQuestionIdx: null });
98
+ const re = (o ? window.UserLeap.feedbackCustomStyles : window.UserLeap.customStyles) ?? d.customStyles;
99
+ P.customStyles = re, E && (E.__cfg = P);
100
+ const J = window.UserLeap.viewSDKURL ? window.UserLeap.viewSDKURL : P.path, Oe = document.getElementById(Ne);
101
+ Oe && Oe.remove();
102
+ const ge = function() {
103
+ const S = document.createElement("script");
104
+ return window.UserLeap.nonce && S.setAttribute("nonce", window.UserLeap.nonce), S.id = Ne, S;
105
+ }(), Ce = () => {
106
+ window.UserLeap.container && Object.assign(window.UserLeap.container.style, { display: "flex" });
107
+ };
108
+ if (P.installationMethod === "web-npm" || P.installationMethod === "web-npm-bundled") {
109
+ const { default: S } = await import("./view-Csp070UH.js");
110
+ S.configure(P), A && window.UserLeap.container && Ce();
111
+ } else
112
+ J && (ge.src = J, A && ge.addEventListener("load", () => {
113
+ window.UserLeap.container && Ce();
114
+ }), E == null || E.addEventListener("error", (S) => {
115
+ S.target instanceof HTMLScriptElement && S.target.src === J && window.UserLeap.reportError("loadFrameScript", new Error("Frame script failed to load"));
116
+ }, { capture: !0, once: !0 }));
117
+ v == null || v.appendChild(ge);
118
+ const Pe = { success: !0, surveyState: "ready", surveyId: g, responseGroupUid: y };
119
+ return window.UserLeap.isMobileSDK && s && (Pe.delay = s), Pe;
120
+ };
121
+ function De(t) {
122
+ var n;
123
+ if (window.UserLeap.useMobileStyling !== void 0)
124
+ return window.UserLeap.useMobileStyling;
125
+ const e = ((n = window.UserLeap.windowDimensions) == null ? void 0 : n.width) ?? document.body.clientWidth;
126
+ return we(t) || e > 10 && e < 500;
127
+ }
128
+ function we(t) {
129
+ return Ot.includes(t["userleap-platform"]);
130
+ }
131
+ const Ae = "ul-frame";
132
+ window.UserLeap && window.Sprig && (window.Sprig._gtm ? window.Sprig = window.UserLeap : window.UserLeap = window.Sprig), window.UserLeap || (window.UserLeap = window.Sprig), window.Sprig || (window.Sprig = window.UserLeap);
133
+ const ye = "0px", tt = (t, e, n) => {
134
+ window.UserLeap.container = document.createElement("div"), window.UserLeap.container.className = "ul-container" + (e ? " ul-container-feedback" : ""), t && (window.UserLeap.container.dataset.studyId = t.toString());
135
+ const s = ot();
136
+ n && s && !window.UserLeap.useMobileStyling ? s.appendChild(window.UserLeap.container) : document.body.appendChild(window.UserLeap.container);
137
+ }, rt = (t, e) => {
138
+ var s;
139
+ jt();
140
+ const n = window.UserLeap.container;
141
+ if (n)
142
+ try {
143
+ (s = n.parentNode) == null || s.removeChild(n), window.UserLeap.container = null, x("trackStartUrl", null), u.emit(w.SurveyLifeCycle, { state: "dismissed" }), u.emit(w.SurveyClosed, { name: w.SurveyClosed, initiator: t, "survey.id": parseInt(n.dataset.studyId), ...e && { studyType: e } });
144
+ } catch (r) {
145
+ console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${t} ` + n), r instanceof Error && window.UserLeap.reportError("dismissActiveSurvey", r);
146
+ }
147
+ }, it = () => {
148
+ u.once(w.SurveyWillClose, ({ initiator: t, studyType: e }) => {
149
+ u.removeAllListeners(w.CloseSurveyOnOverlayClick), rt(t, e);
150
+ });
151
+ }, Ct = (t, e, n, s) => {
152
+ var d, p;
153
+ const r = { position: "fixed", bottom: "0px", right: ye, border: 0, backgroundColor: "rgba(0,0,0,0)", zIndex: 2147483646, transition: "width 0.2s ease-in-out, height 0.2s ease-in-out", maxWidth: "100%" }, i = Object.assign({}, e, window.UserLeap), { desktopDisplay: o } = e || {}, a = o === "center-modal";
154
+ let l;
155
+ a && (i.framePosition = "center");
156
+ let c = !1;
157
+ if (n)
158
+ (d = window.UserLeap.windowDimensions) != null && d.width ? r.width = `${window.UserLeap.windowDimensions.width}px` : r.width = "100%", (p = window.UserLeap.windowDimensions) != null && p.height ? r.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px" : window.UserLeap.maxHeight ? r.maxHeight = window.UserLeap.maxHeight : r.maxHeight = document.body.clientHeight - 20 + "px", ["light", "dark"].includes(i.overlayStyleMobile) && (c = !0);
159
+ else {
160
+ r.width = At, r.maxHeight = window.UserLeap.maxHeight || "66vh";
161
+ const y = () => {
162
+ c = !0, l = { margin: "auto", position: "static" };
163
+ };
164
+ if (s)
165
+ a ? y() : l = { position: "relative", height: "300px" };
166
+ else
167
+ switch (i.framePosition) {
168
+ case "bottomLeft":
169
+ l = { left: ye };
170
+ break;
171
+ case "topLeft":
172
+ l = { left: ye, top: 0 };
173
+ break;
174
+ case "topRight":
175
+ l = { top: 0 };
176
+ break;
177
+ case "center":
178
+ y();
179
+ }
180
+ }
181
+ return c && ((y, g) => {
182
+ const m = { position: "fixed", overflow: "auto", top: "0px", left: "0px", display: "none", height: "100%", width: "100%", transition: "background-color 0.3s ease-out", zIndex: 2147483646 }, _ = g ? y.overlayStyleMobile : y.overlayStyle;
183
+ m["background-color"] = _ === "light" ? "rgba(255,255,255, 0.95)" : "rgba(0,0,0,0.9)", g || (m.margin = "auto"), window.UserLeap.container && Object.assign(window.UserLeap.container.style, m);
184
+ })(i, n), Object.assign(t.style, r, l), c;
185
+ }, Pt = ({ productConfig: t, useMobileStyling: e, surveyId: n, isFeedback: s }) => {
186
+ var y, g;
187
+ const r = Ae, i = s && t.desktopDisplay === "slider";
188
+ tt(n, s, i), Tt();
189
+ const o = document.createElement("iframe");
190
+ o.id = r, o.setAttribute("title", "Sprig User Feedback Dialog");
191
+ const a = Ct(o, t, e, s);
192
+ it();
193
+ let l = !1;
194
+ o.setHeight = (m) => {
195
+ parseInt(o.style.height) == m && l || (l = !0, o.style.height = `${m}px`, u.emit(w.SurveyHeight, { name: w.SurveyHeight, contentFrameHeight: m, "survey.id": n }));
196
+ };
197
+ let c = !1;
198
+ o.setWidth = (m) => {
199
+ parseInt(o.style.width) == m && c || (c = !0, o.style.width = `${m}px`, u.emit(w.SurveyWidth, { name: w.SurveyWidth, contentFrameWidth: m, "survey.id": n }));
200
+ }, (y = window.UserLeap.container) == null || y.appendChild(o), t && (e ? t.exitOnOverlayClickMobile : t.exitOnOverlayClick) && window.UserLeap.container && (window.UserLeap.container.onclick = () => {
201
+ u.emit(w.CloseSurveyOnOverlayClick);
202
+ }), u.emit(w.SurveyLifeCycle, { state: "presented" }), u.emit(w.SurveyPresented, { name: w.SurveyPresented, "survey.id": n });
203
+ const d = (g = o.contentWindow) == null ? void 0 : g.document;
204
+ if (d && (d.open("text/html", "replace"), d.write("<!doctype html><head></head><body></body></html>"), d.close(), !e)) {
205
+ const m = d.body;
206
+ m.style.display = "flex", m.style.alignItems = "center";
207
+ }
208
+ const p = d == null ? void 0 : d.head;
209
+ return { frameId: r, contentWinDocHead: p, contentWindow: o.contentWindow, hasOverlay: a, iframe: o };
210
+ }, nt = { [w.SurveyFadingOut]: () => {
211
+ window.UserLeap.container && Object.assign(window.UserLeap.container.style, { "background-color": "rgba(0,0,0,0)" });
212
+ } }, Tt = () => {
213
+ Object.entries(nt).forEach(([t, e]) => {
214
+ u.on(t, e);
215
+ });
216
+ }, jt = () => {
217
+ Object.entries(nt).forEach(([t, e]) => {
218
+ u.off(t, e);
219
+ });
220
+ }, G = (t) => !!t && t.nodeType === Node.ELEMENT_NODE, Ve = (t) => t instanceof HTMLElement || t instanceof SVGElement, oe = ({ document: t, elementId: e, styleString: n, nonce: s }) => {
221
+ const r = t.getElementById(e);
222
+ if (r)
223
+ return void (r.textContent = n);
224
+ const i = t.createElement("style");
225
+ s && (i.nonce = s), i.textContent = n, i.id = e, t.head.appendChild(i);
226
+ }, Mt = (t, e) => {
227
+ const n = e.querySelector(".sprig-question-body");
228
+ if (!G(n))
229
+ return t;
230
+ const s = n.scrollHeight;
231
+ return s < 100 ? t : t - (s - 100);
232
+ }, Be = (t, e) => {
233
+ const n = e.querySelector(t);
234
+ if (!G(n))
235
+ return 0;
236
+ const s = getComputedStyle(n);
237
+ return parseFloat(s.paddingLeft) + parseFloat(s.paddingRight) + (parseFloat(s.marginLeft) + parseFloat(s.marginRight)) + (parseFloat(s.borderLeftWidth) + parseFloat(s.borderRightWidth));
238
+ }, Ft = (t) => {
239
+ const e = t.querySelector(".ul-card__container");
240
+ let n = 600, s = 360, r = 0;
241
+ if (G(e)) {
242
+ n = e.clientHeight, n += ((a) => {
243
+ const l = a.querySelector(".sprig-question-body"), c = a.querySelector(".ul-card"), d = a.querySelector(".ul-card-main-content");
244
+ let p = 0;
245
+ return G(c) && (p += c.scrollHeight - c.clientHeight), G(d) && (p += d.scrollHeight - d.clientHeight), G(l) && (p += l.scrollHeight - l.clientHeight), p;
246
+ })(t);
247
+ const i = getComputedStyle(e);
248
+ r = n, n += parseFloat(i.marginTop) + parseFloat(i.marginBottom) + (parseFloat(i.borderTopWidth) + parseFloat(i.borderBottomWidth));
249
+ const o = e.querySelector(".ul-card--matrix_grid");
250
+ s = o ? o.scrollWidth : e.scrollWidth, s += Be(".ul-card__container", t), s += Be(".sprig-question-body", t);
251
+ }
252
+ return [n + 1, s, Mt(r, t)];
253
+ }, ar = (t) => {
254
+ const e = t.querySelector(".ul-card__container");
255
+ e && (e.scrollTop = 0);
256
+ }, ot = () => f, K = () => document.getElementById("sprig-feedback-container"), be = () => document.getElementById("sprig-feedback-loading-animation"), st = () => !!document.getElementById(Ae);
257
+ let $e = !1, f = null, j = null, Re = !1, Z = null, H = null;
258
+ const qt = ["bottom-left", "bottom-right", "center-left", "center-right"], se = () => {
259
+ var e;
260
+ const t = window.UserLeap.container;
261
+ return ((e = t == null ? void 0 : t.parentElement) == null ? void 0 : e.id) === "sprig-feedback-loading-container";
262
+ }, at = () => document.getElementById("sprig-feedback-error-container"), dt = () => {
263
+ if (!f)
264
+ return 0;
265
+ const t = f == null ? void 0 : f.clientWidth, e = window.getComputedStyle(f);
266
+ return t + parseInt(e.borderRightWidth || "0") + parseInt(e.borderLeftWidth || "0");
267
+ }, ae = (t) => {
268
+ const e = K();
269
+ e && (H != null && H.endsWith("right") ? e.style.right = `${t}px` : H != null && H.endsWith("left") && (e.style.left = `${t}px`));
270
+ }, fe = () => {
271
+ if (f && (se() || at())) {
272
+ u.off(w.SurveyAppeared, Y), Le();
273
+ const t = dt();
274
+ return ae(-t), !0;
275
+ }
276
+ return !1;
277
+ }, Y = () => {
278
+ if (!f || !j)
279
+ return;
280
+ const t = be();
281
+ t && t.remove(), f.style.height = "auto", f.style.width = "auto", j.disabled = !1, Re = !1;
282
+ }, Le = () => {
283
+ if (f && !be()) {
284
+ const t = (() => {
285
+ if (be())
286
+ return;
287
+ const e = document.createElement("div");
288
+ return e.className = "ul-loading-spinner-container", e.id = "sprig-feedback-loading-animation", e.role = "progressbar", e.setAttribute("aria-live", "polite"), e.setAttribute("aria-busy", "true"), e.setAttribute("aria-label", "Processing..."), e.innerHTML = `
289
+ <div class="ul-loading-spinner">
290
+ <div class="first"></div>
291
+ <div class="second"></div>
292
+ <div class="third"></div>
293
+ <div class="fourth"></div>
294
+ </div>
295
+ `, e;
296
+ })();
297
+ t && (f.style.height = "300px", f.style.width = "360px", f.appendChild(t));
298
+ }
299
+ }, Ge = () => {
300
+ f && j && (ae(0), j.disabled = !0, Re = !0);
301
+ }, lt = async (t, e, n) => {
302
+ const { buttonTheme: s, customStyles: r, eventId: i, placement: o, desktopDisplay: a, feedbackLabel: l, surveyUuid: c, surveyId: d } = t;
303
+ window.UserLeap.feedbackCustomStyles = void 0;
304
+ let p = K();
305
+ if (p) {
306
+ if (!e && i === Z)
307
+ return;
308
+ p.remove(), u.off(te.SURVEY_FADING_OUT, fe);
309
+ }
310
+ Z = i, oe({ document, elementId: "sprig-feedback-style", styleString: '.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.fade-in-transition{animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}#sprig-feedback-button{border-left:0;border-radius:0 8px 8px 0;display:grid;padding:8px;text-align:center;transition:all ease-in-out 1s;z-index:inherit}#sprig-feedback-button:hover{cursor:pointer}.sprig-feedback-button-label{writing-mode:vertical-lr;text-orientation:sideways}.sprig-feedback-button-right{transform:rotate(180deg)}.sprig-feedback-button-bottom{align-self:flex-end;margin-bottom:20px}.sprig-feedback-button-light{background:#efefee;color:#000;border:1px solid #e2e3e1}.sprig-feedback-button-dark{background:#000;color:#fff;border:1px solid #000000}#sprig-feedback-container{display:flex;align-items:center;position:fixed;transition:right .2s linear,left .2s linear;z-index:2147483646}.sprig-feedback-container-left{flex-flow:row-reverse}.sprig-feedback-container-center{top:50%;transform:translateY(-50%)}.sprig-feedback-container-bottom{bottom:0%;margin-bottom:15px}.sprig-feedback-loading-container{align-items:center;background-color:#fff;border:2px solid var(--feedback-border);display:flex;max-height:90vh;max-width:90vw;min-width:0px}.sprig-feedback-loading-container-left{border-left:none;border-radius:0 8px 8px 0}.sprig-feedback-loading-container-right{border-right:none;border-radius:8px 0 0 8px}#sprig-feedback-error-container{margin:auto;text-align:center;width:360px}.sprig-feedback-error-text{font-weight:400;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol}#sprig-feedback-loading-container .ul-container{position:relative;max-height:inherit}#sprig-feedback-loading-animation{position:absolute}.sprig-feedback-loading-container-previews iframe{max-height:inherit!important}', nonce: window.UserLeap.styleNonce }), oe({ document, elementId: "ul-custom-style", styleString: r ?? "", nonce: window.UserLeap.styleNonce }), $e = a === "center-modal", H = o;
311
+ const [y, g] = o.split("-");
312
+ ((U) => {
313
+ if (K() || !qt.includes(U))
314
+ return;
315
+ const [h, L] = U.split("-"), k = document.createElement("div");
316
+ k.id = "sprig-feedback-container", k.classList.add(`sprig-feedback-container-${L}`, `sprig-feedback-container-${h}`), document.body.appendChild(k);
317
+ })(o), p = K(), j = document.createElement("button");
318
+ const m = document.createElement("div");
319
+ m.className = "sprig-feedback-button-label", m.innerText = l, j.appendChild(m), j.id = "sprig-feedback-button", j.classList.add(`sprig-feedback-button-${g}`, `sprig-feedback-button-${y}`, `sprig-feedback-button-${s}`, "fade-in-transition"), u.on(te.SURVEY_FADING_OUT, fe), j.addEventListener("click", async () => {
320
+ const U = document.getElementById("sprig-feedback-error-container");
321
+ if (st() || at()) {
322
+ if (fe()) {
323
+ u.emit(w.SurveyWillClose, { name: w.SurveyWillClose, initiator: N.FeedbackClosed, studyType: "feedbackButton", "survey.id": d });
324
+ const L = K();
325
+ U && L && (L.remove(), Z = null, f = null);
326
+ }
327
+ return;
328
+ }
329
+ if (De(z(window.UserLeap)) || Re || Ge(), e)
330
+ return f && f.classList.add("sprig-feedback-loading-container-previews"), await X(e), void Y();
331
+ const h = await (async (L) => {
332
+ const k = await T(O("1", [F], "startFeedbackStudy"), { body: JSON.stringify({ surveyUuid: L }), method: "POST" });
333
+ return k.ok ? k.json : null;
334
+ })(c);
335
+ if (h)
336
+ u.once(w.SurveyAppeared, Y), X({ ...h, studyType: "feedbackButton" }, n);
337
+ else if (f) {
338
+ const L = zt();
339
+ f.appendChild(L), Y(), f.style.height = "300px", f.style.width = "360px";
340
+ }
341
+ }), p == null || p.appendChild(j), u.emit(w.FeedbackButtonLoaded, { name: w.FeedbackButtonLoaded, "survey.id": d });
342
+ const { useMobileStyling: _, _config: { border: b } } = window.UserLeap;
343
+ if ($e || _)
344
+ ae(0);
345
+ else {
346
+ const U = document.createElement("div");
347
+ U.id = "sprig-feedback-loading-container", U.className = `sprig-feedback-loading-container sprig-feedback-loading-container-${g}`, U.style.setProperty("--feedback-border", b), f = U, Le(), p == null || p.appendChild(U);
348
+ const h = dt();
349
+ ae(-h);
350
+ }
351
+ window.UserLeap._config.isOnQuestionsTab && e && !se() && f && (Ge(), Le(), f && f.classList.add("sprig-feedback-loading-container-previews"), X(e), Y());
352
+ }, zt = () => {
353
+ const t = document.createElement("div");
354
+ t.id = "sprig-feedback-error-container", t.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40" fill="none">
355
+ <circle cx="20" cy="20" r="14.5" stroke="#B0B5B7" stroke-width="3"/>
356
+ <path d="M20 12L20 21.6" stroke="#B0B5B7" stroke-width="3" stroke-linecap="round"/>
357
+ <circle cx="19.9984" cy="27.6" r="1.6" fill="#B0B5B7"/>
358
+ </svg>`;
359
+ const e = document.createElement("h3");
360
+ return e.className = "sprig-feedback-error-text", e.innerText = "There was an error while loading the survey", t.appendChild(e), t;
361
+ }, Ue = new class {
362
+ constructor() {
363
+ $(this, "_ldData", {});
364
+ }
365
+ getAllLaunchDarklyVariations() {
366
+ return this._ldData;
367
+ }
368
+ setLDFlagsVariations(t) {
369
+ try {
370
+ return !(!t || typeof t != "object" || Array.isArray(t)) && (Object.keys(this._ldData).forEach((e) => {
371
+ delete this._ldData[e];
372
+ }), Object.keys(t).forEach((e) => this._ldData[`!launch_darkly_${e}`] = (t[e] ?? 0) + 1), !0);
373
+ } catch (e) {
374
+ return e instanceof Error && window.UserLeap.reportError("setAllLDFlagsVariations", e), console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."), !1;
375
+ }
376
+ }
377
+ }();
378
+ Object.freeze(Ue);
379
+ const ne = new class {
380
+ constructor() {
381
+ $(this, "_optimizelyData", {});
382
+ }
383
+ setOptimizelyExperiment(t, e = !0) {
384
+ if (!t || typeof t != "object")
385
+ return !1;
386
+ const { experiments: n } = t;
387
+ try {
388
+ return e && Object.keys(this._optimizelyData).map((s) => {
389
+ delete this._optimizelyData[s];
390
+ }), n && n.map((s) => {
391
+ const { id: r, variation: i } = s, o = this.transformExperimentId(r);
392
+ i && typeof i == "string" && (this._optimizelyData[o] = i);
393
+ }), !0;
394
+ } catch (s) {
395
+ return s instanceof Error && window.UserLeap.reportError("setOptimizelyExperiment", s), !1;
396
+ }
397
+ }
398
+ getAllOptimizelyExperiments() {
399
+ return this._optimizelyData;
400
+ }
401
+ getOptimizelyVariationName(t) {
402
+ return this._optimizelyData[this.transformExperimentId(t)];
403
+ }
404
+ transformExperimentId(t) {
405
+ return "!optimizely_experiments_" + t;
406
+ }
407
+ getAndSetWebOptimizelyExperiments() {
408
+ var t;
409
+ try {
410
+ if (window && window.optimizely && typeof window.optimizely.get == "function") {
411
+ const e = (t = window.optimizely.get("state")) == null ? void 0 : t.getExperimentStates({ isActive: !0 });
412
+ if (e) {
413
+ const n = Object.keys(e).map((s) => {
414
+ var r, i;
415
+ return (r = e[s].variation) != null && r.name ? { id: s, variation: (i = e[s].variation) == null ? void 0 : i.name } : { id: s, variation: "Original" };
416
+ });
417
+ return this.setOptimizelyExperiment({ experiments: n }, !1), !0;
418
+ }
419
+ return !1;
420
+ }
421
+ return !1;
422
+ } catch (e) {
423
+ return e instanceof Error && window.UserLeap.reportError("getAndSetWebOptimizely", e), !1;
424
+ }
425
+ }
426
+ }();
427
+ Object.freeze(ne);
428
+ class Wt {
429
+ constructor(e, n) {
430
+ $(this, "paused");
431
+ $(this, "queue");
432
+ $(this, "ul");
433
+ this.ul = e, this.paused = !1, this.queue = [], this.flush(n);
434
+ }
435
+ flush(e) {
436
+ const n = e.length;
437
+ if (n)
438
+ for (let s = 0; s < n; s++)
439
+ this.push(e[s]);
440
+ }
441
+ isPaused() {
442
+ return this.paused;
443
+ }
444
+ pause() {
445
+ this.paused = !0;
446
+ }
447
+ unpause() {
448
+ this.paused = !1;
449
+ const e = this.queue.slice();
450
+ this.empty(), this.flush(e);
451
+ }
452
+ push(e) {
453
+ if (this.paused)
454
+ this.queue.push(e);
455
+ else if (e instanceof Function)
456
+ e();
457
+ else {
458
+ const n = Array.prototype.slice.call(e, 1), s = e[0], r = this.ul[s];
459
+ r instanceof Function ? r.apply(this.ul, n) : s && console.warn("[Sprig] (ERR-100) No valid UserLeap action called", s);
460
+ }
461
+ }
462
+ perform(e) {
463
+ if (this.paused) {
464
+ let n = () => {
465
+ };
466
+ const s = new Promise(function(r) {
467
+ n = function() {
468
+ r(e());
469
+ };
470
+ });
471
+ return this.queue.push(n), s;
472
+ }
473
+ return e();
474
+ }
475
+ empty() {
476
+ this.queue.length = 0;
477
+ }
478
+ }
479
+ let ct, pt;
480
+ const Se = (t) => {
481
+ let e = 0, n = t.firstElementChild;
482
+ for (; n; )
483
+ e += Se(n), n.shadowRoot && (e += Se(n.shadowRoot)), n = n.nextElementSibling, e++;
484
+ return e;
485
+ }, Ke = () => {
486
+ ct.report(Se(document.body)), pt.report(document.documentElement.innerHTML.length);
487
+ }, Ie = (t, e) => {
488
+ const n = performance.now();
489
+ document.hidden ? setTimeout(() => Ie(t, e), t) : setTimeout(() => {
490
+ const s = performance.now() - n;
491
+ e.report(s / 1e3), setTimeout(() => Ie(t, e), t);
492
+ }, 0);
493
+ };
494
+ let de, le, ce, pe, Je, V = {};
495
+ const ie = (t, e = 1) => {
496
+ const { name: n } = t;
497
+ V[n] = (V[n] || 0) + e;
498
+ }, ut = (t) => {
499
+ let e = 1;
500
+ return t.childNodes.forEach((n) => {
501
+ e += ut(n);
502
+ }), e;
503
+ }, Qe = (t) => {
504
+ let e = 0;
505
+ return t.forEach((n) => {
506
+ e += ut(n);
507
+ }), e;
508
+ }, Ht = (t) => {
509
+ switch (t.type) {
510
+ case "childList":
511
+ return ie(de, Qe(t.addedNodes)), void ie(le, Qe(t.removedNodes));
512
+ case "attributes":
513
+ return void ie(ce);
514
+ case "characterData":
515
+ return void ie(pe);
516
+ }
517
+ }, Nt = (t) => t.forEach(Ht), Vt = () => {
518
+ de.report(V[de.name] || 0), le.report(V[le.name] || 0), ce.report(V[ce.name] || 0), pe.report(V[pe.name] || 0), V = {};
519
+ }, Bt = (t = 1e3) => {
520
+ de = B("sdk_mutations_nodes_added"), le = B("sdk_mutations_nodes_removed"), ce = B("sdk_mutations_attributes_changed"), pe = B("sdk_mutations_character_data"), Je = new MutationObserver(Nt), Je.observe(document, { attributes: !0, attributeOldValue: !0, characterData: !0, characterDataOldValue: !0, childList: !0, subtree: !0 }), setInterval(Vt, t);
521
+ }, $t = ({ isWeb: t, reportingIntervalSeconds: e, thresholds: n, postMetrics: s }) => {
522
+ kt(n, (r, i) => {
523
+ var o, a;
524
+ if ((o = I.replay) != null && o.isReplayRecording()) {
525
+ const l = `Value: ${r} on ${i.metric} violated threshold of ${i.type} ${i.value}`;
526
+ (a = I.replay) == null || a.disableRecording("Threshold violated", new Error(l), { reportError: !1 }), window.UserLeap.reportError("Sdk Performance Metric threshold violated", new Error("Sdk Performance Metric threshold violated"), { metricName: i.metric, type: i.type, value: i.value }, { metricName: i.metric }), _t();
527
+ }
528
+ }), Et({ reportingIntervalSeconds: e, postMetrics: s }), t && (((r = 1e3) => {
529
+ const i = B("sdk_event_queue_latency_seconds");
530
+ Ie(r, i);
531
+ })(), ((r = 1e4) => {
532
+ ct = B("sdk_dom_nodes_count"), pt = B("sdk_page_html_characters"), Ke(), setInterval(Ke, r);
533
+ })(), Bt());
534
+ }, Gt = "test", Kt = ["popState", "pushState", "replaceState"];
535
+ let ke;
536
+ const ue = {}, Q = "!email", wt = "pageUrl";
537
+ let ve = window.location.href;
538
+ function ee(t) {
539
+ var a;
540
+ const { pageUrlEvents: e, interactiveEvents: n, dismissOnPageChange: s, platform: r } = window.UserLeap._config;
541
+ if (r && r !== "web")
542
+ return;
543
+ ve !== window.location.href && M.navigation("LocationChange", { from: ve, to: window.location.href }), ve = window.location.href;
544
+ const i = yt().trackStartUrl, o = i ? String(i) : null;
545
+ e && vt(window.location.href), n && (mt(), Jt()), ot() && (() => {
546
+ if (se())
547
+ return;
548
+ const l = K();
549
+ l && (It(Z) || (l.remove(), Z = null, f = null));
550
+ })(), xt.getItem("sprig.isCapturingHeatmap") && ((a = I.replay) == null || a.checkPendingHeatmapsUrl()), !se() && s && o && o !== window.location.href && t && Kt.includes(t.type) && window.UserLeap("dismissActiveSurvey", N.PageChange);
551
+ }
552
+ const gt = { capture: !0 }, Jt = () => {
553
+ const t = window.UserLeap._config.interactiveEvents.filter((n) => _e(n, window.location.href)).map((n) => {
554
+ const { name: s, properties: r } = n, { selector: i, innerText: o } = r;
555
+ return i ? (a) => {
556
+ if (Ve(a.target))
557
+ try {
558
+ a.target.closest(i) && window.UserLeap("track", s);
559
+ } catch {
560
+ }
561
+ return !1;
562
+ } : (a) => (Ve(a.target) && a.target.innerText === o && window.UserLeap("track", s), !1);
563
+ }), e = (n) => t.forEach((s) => s(n));
564
+ window.UserLeap._config.interactiveEventsHandler = e, window.addEventListener("click", e, gt);
565
+ }, mt = () => {
566
+ window.UserLeap._config.interactiveEventsHandler && window.removeEventListener("click", window.UserLeap._config.interactiveEventsHandler, gt), delete window.UserLeap._config.interactiveEventsHandler;
567
+ };
568
+ function yt() {
569
+ const t = D.getItemObject("userleap.ids");
570
+ return t && t[window.UserLeap.envId] || {};
571
+ }
572
+ function ft() {
573
+ if (window.previewMode)
574
+ return;
575
+ const t = D.getItemObject("sprig.anon.env.vid.map") || {}, e = t[window.UserLeap.envId];
576
+ window.UserLeap.visitorId = e || Ze(), M.info("NewVid", { vid: window.UserLeap.visitorId }), x("vid", window.UserLeap.visitorId), e || (t[window.UserLeap.envId] = window.UserLeap.visitorId, D.setItemObject("sprig.anon.env.vid.map", t)), u.emit(w.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId });
577
+ }
578
+ function vt(t, e, n, s) {
579
+ var r, i;
580
+ try {
581
+ if (t.endsWith("mock_snippet.html"))
582
+ return;
583
+ M.info("PageView", { url: t });
584
+ const o = window.UserLeap._config.pageUrlEvents;
585
+ let a = !1;
586
+ if (o && o.length)
587
+ for (let d = 0; d < o.length && (a = _e(o[d], t), !a); d++)
588
+ ;
589
+ if (!a)
590
+ return;
591
+ window.UserLeap.debugMode && console.info("[DEBUG] Sprig trackPageView", t);
592
+ const l = { url: t };
593
+ s && (l.trackPageView = !0), window.UserLeap._queue.push(["track", wt, e, l, n]);
594
+ const c = (r = document == null ? void 0 : document.querySelector('meta[name="description"]')) == null ? void 0 : r.getAttribute("content");
595
+ (i = I.replay) == null || i.RecordPageView({ ...c && { description: c }, url: t, referrer: document.referrer, pageTitle: document.title });
596
+ } catch (o) {
597
+ o instanceof Error && (o.stack = t, window.UserLeap.reportError("trackPageView", o)), console.warn("[Sprig] (ERR-428) Failed to track page view", o);
598
+ }
599
+ }
600
+ function Qt() {
601
+ const t = "Backbone" in window && window.Backbone && window.Backbone.history ? window.Backbone.history : window.history;
602
+ "pushState" in t && (t.pushState = /* @__PURE__ */ ((e) => function(...n) {
603
+ const s = e.apply(this, n), r = new Event("pushState");
604
+ return window.dispatchEvent(r), ee(r), s;
605
+ })(t.pushState)), "replaceState" in t && (t.replaceState = /* @__PURE__ */ ((e) => function(...n) {
606
+ const s = e.apply(this, n), r = new Event("replaceState");
607
+ return window.dispatchEvent(r), ee(r), s;
608
+ })(t.replaceState)), ["hashchange", "popstate"].forEach((e) => window.addEventListener(e, ee, !0));
609
+ }
610
+ async function he(t, e) {
611
+ const n = xe();
612
+ t && !e && (window.UserLeap._config.mode = Gt);
613
+ const s = De(z(window.UserLeap)), r = await T(function(i) {
614
+ const o = new URL(O("1", [q], "questions"));
615
+ return Object.entries(i || {}).forEach(([a, l]) => {
616
+ l && o.searchParams.append(a, String(l));
617
+ }), o.toString();
618
+ }({ desktopDisplay: window.UserLeap._config.desktopDisplay, isMobile: s, previewLanguage: window.UserLeap._config.previewLanguage, surveyid: t == null ? void 0 : t.surveyId, surveytemplateid: t == null ? void 0 : t.surveyTemplateId, vid: n }), { shouldDropOnRateLimit: !0 });
619
+ if (!r.ok)
620
+ return r.reportError && r.error && (console.warn("[Sprig] (ERR-414) Failed to request questions from the server", r.error), window.UserLeap.reportError("getQuestions", r.error)), { success: !1, surveyState: "no survey" };
621
+ if (r.json.delay && await et(r.json.delay), !r.json.isFeedback)
622
+ return X(r.json, ke);
623
+ {
624
+ const { feedbackLabel: i, productConfig: o, surveyUuid: a, feedbackCustomStyles: l } = r.json, { buttonTheme: c, placement: d, desktopDisplay: p } = o;
625
+ lt({ customStyles: l, buttonTheme: c, desktopDisplay: p, eventId: 0, feedbackLabel: i, placement: d, surveyUuid: a, surveyId: t == null ? void 0 : t.surveyId }, r.json);
626
+ }
627
+ }
628
+ function Yt(t) {
629
+ if (!t)
630
+ return;
631
+ window.UserLeap._config = t, t.mute && window.UserLeap._queue.pause();
632
+ const { interactiveEvents: e, pageUrlEvents: n, dismissOnPageChange: s } = t;
633
+ e && function(r) {
634
+ let i = r.length;
635
+ for (; i; ) {
636
+ const o = Math.floor(Math.random() * i);
637
+ i -= 1;
638
+ const a = r[i];
639
+ r[i] = r[o], r[o] = a;
640
+ }
641
+ }(e), (e || n || s) && (Qt(), ee());
642
+ }
643
+ const Xt = function(t) {
644
+ if (!window.UserLeap)
645
+ return;
646
+ const e = async (r = {}) => {
647
+ var U, h, L, k, C;
648
+ const { userId: i, anonymousId: o, metadata: a = {}, properties: l, showSurveyCallback: c } = r;
649
+ let { eventName: d } = r;
650
+ if (window.UserLeap.debugMode && d !== wt && console.info("[DEBUG] Sprig track", r), t.mode === "test")
651
+ return;
652
+ const p = D.getItem("sprig.previewKey") ?? void 0;
653
+ if (t.requireUserIdForTracking && !window.UserLeap.userId && !i) {
654
+ const v = "[Sprig] - Skipping tracking without userId";
655
+ return console.warn(v), { success: !1, message: v, surveyState: "no survey" };
656
+ }
657
+ if (!d || d.trim().length === 0) {
658
+ d = d ? String(d) : "";
659
+ const v = "[Sprig] - Invalid event name " + d;
660
+ return console.warn(v), { success: !1, message: v, surveyState: "no survey" };
661
+ }
662
+ const y = ke ?? window.location.href;
663
+ a.url || (a.url = y), x("trackStartUrl", y), (h = (U = window.UserLeap) == null ? void 0 : U._config) != null && h.optimizelyEnabled && (we(z(window.UserLeap)) || ne.getAndSetWebOptimizelyExperiments(), a.optimizelyExperiments = Object.assign({}, ne.getAllOptimizelyExperiments())), (k = (L = window.UserLeap) == null ? void 0 : L._config) != null && k.launchDarklyEnabled && (a.launchDarklyFlags = Ue.getAllLaunchDarklyVariations()), i && (window.UserLeap.userId = i), o && (window.UserLeap.partnerAnonymousId = o), l && (a.eventProperties = l), (C = I.replay) == null || C.RecordEvent({ name: d, url: a.url }), M.info("TrackEvent", { eventName: d });
664
+ const g = window.UserLeap.delayingSurvey || st() ? await T(O("1", [F], "events/batch"), { body: JSON.stringify({ events: [{ event: d, metadata: a }], previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 }) : await T(O("1", [F], "events"), { body: JSON.stringify({ event: d, metadata: a, previewKey: p }), method: "POST", shouldDropOnRateLimit: !0 });
665
+ if (!g.ok) {
666
+ const v = "[Sprig] (ERR-421) Failed to track event";
667
+ return g.reportError && (console.warn(v, g.error), g.error && window.UserLeap.reportError("track", g.error)), { success: !1, message: v, error: g.error, surveyState: "no survey" };
668
+ }
669
+ i && x("uid", i), o && x("aid", o);
670
+ const m = g.json;
671
+ m.invalidPreviewKey && D.removeItem("sprig.previewKey");
672
+ const _ = a.trackPageView ? a.url : void 0;
673
+ return m != null && m.feedbackButton && lt(m.feedbackButton, void 0, _), await async function(v, E) {
674
+ var R, W;
675
+ let A = !0;
676
+ return !(E && ((R = v == null ? void 0 : v.json) != null && R.surveyId) && (window.UserLeap.delayingSurvey = !0, A = await E(v.json.surveyId), window.UserLeap.delayingSurvey = !1, !A)) && ((W = v == null ? void 0 : v.json) != null && W.delay && !window.UserLeap.isMobileSDK && (window.UserLeap.delayingSurvey = !0, await et(v.json.delay), window.UserLeap.delayingSurvey = !1), A);
677
+ }(g, c) ? function(v, E) {
678
+ const { pageUrlEvents: A, interactiveEvents: R, dismissOnPageChange: W } = window.UserLeap._config;
679
+ if (!W)
680
+ return !0;
681
+ const P = [];
682
+ A && A.length && P.push(...A), R && R.length && P.push(...R);
683
+ const re = v && P.find((J) => J.id === v);
684
+ return re ? _e(re, window.location.href) : E === window.location.href;
685
+ }(m.eventId, y) ? X(m, _) : { success: !1, message: "Study should not be displayed after page navigation", surveyState: "no survey" } : { success: !1, message: "[Sprig] Callback returned false, aborting rendering of survey", surveyState: "no survey" };
686
+ }, n = (r, i) => {
687
+ var a;
688
+ const o = (a = r == null ? void 0 : r.querySelector(`[id="${Ae}"]`)) == null ? void 0 : a.contentDocument;
689
+ o && oe({ document: o, elementId: "ul-custom-style", styleString: i });
690
+ }, s = { displaySurvey: async (r) => (console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."), window.UserLeap("dismissActiveSurvey", N.Override), he({ surveyId: r }, !0)), _previewSurvey(r) {
691
+ window.UserLeap("dismissActiveSurvey", N.Override), he({ surveyTemplateId: r }, !1);
692
+ }, _reviewSurvey(r) {
693
+ window.UserLeap("dismissActiveSurvey", N.Override), he({ surveyId: r }, !1);
694
+ }, previewSurvey(r) {
695
+ s._previewSurvey(r);
696
+ }, reviewSurvey(r) {
697
+ s._reviewSurvey(r);
698
+ }, mute() {
699
+ window.UserLeap._queue.pause();
700
+ }, unmute() {
701
+ window.UserLeap._queue.unpause();
702
+ }, setVisitorToken() {
703
+ console.warn("[Sprig] setVisitorToken is deprecated.");
704
+ }, dismissActiveSurvey(r = N.API) {
705
+ window.UserLeap.container && u.emit(w.SurveyWillClose, { name: w.SurveyWillClose, initiator: r, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) });
706
+ }, async setAttribute(r, i) {
707
+ if (!r || !i && i !== 0 && i !== !1) {
708
+ const o = "[Sprig] - Disregarding empty attribute / value provided";
709
+ return console.warn(o), { success: !1, message: o };
710
+ }
711
+ return this.setAttributes({ [r]: i });
712
+ }, async setAttributes(r) {
713
+ if (r == null || Object.keys(r).length === 0) {
714
+ const i = "[Sprig] - Disregarding empty attributes provided";
715
+ return console.warn(i), { success: !1, message: i };
716
+ }
717
+ return this.identifyAndSetAttributes({ attributes: r });
718
+ }, async identifyAndSetAttributes(r) {
719
+ if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig identifyAndSetAttributes", r), t.mode === "test")
720
+ return;
721
+ if (r === null || typeof r != "object" || !(r.userId || r.anonymousId || r.attributes)) {
722
+ const d = "[Sprig] - Disregarding empty payload provided";
723
+ return console.warn(d), { success: !1, message: d };
724
+ }
725
+ const { userId: i, anonymousId: o, attributes: a } = r;
726
+ if (t.requireUserIdForTracking && !window.UserLeap.userId && !i) {
727
+ const d = "[Sprig] - Skipping tracking without userId";
728
+ return console.warn(d), { success: !1, message: d };
729
+ }
730
+ if (a) {
731
+ a.email && !a[Q] && (a[Q] = a.email, delete a.email);
732
+ const d = Object.keys(a);
733
+ for (const p of d)
734
+ a[p] === ue[p] && delete a[p];
735
+ }
736
+ if (!(a && Object.keys(a).length !== 0 || i && window.UserLeap.userId !== i || o && window.UserLeap.partnerAnonymousId !== o))
737
+ return { success: !0 };
738
+ const l = {};
739
+ let c;
740
+ return i && (l.userId = window.UserLeap.userId = i), o && (l.partnerAnonymousId = window.UserLeap.partnerAnonymousId = o), a && Object.keys(a).length > 0 ? (c = await T(O("1", [q, F], "attributes"), { body: JSON.stringify(a), method: "PUT" }), c.ok ? Object.assign(ue, a) : c.reportError && (console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed", c.error), c.error && window.UserLeap.reportError("identifyAndSetAttributes", c.error))) : c = await T(O("1", [q, F]), { body: JSON.stringify(l), method: "PUT" }), a && a[Q] && (window.UserLeap.email = a[Q]), c.ok && (i && x("uid", i), o && x("aid", o)), { success: !!c.ok };
741
+ }, async removeAttributes(r) {
742
+ if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig removeAttributes", r), t.mode === "test")
743
+ return;
744
+ if (r == null || r.length === 0) {
745
+ const o = "[Sprig] - Disregarding empty attributes provided";
746
+ return console.warn(o), { success: !1, message: o };
747
+ }
748
+ if (t.requireUserIdForTracking && !window.UserLeap.userId) {
749
+ const o = "[Sprig] - Skipping tracking without userId";
750
+ return console.warn(o), { success: !1, message: o };
751
+ }
752
+ const i = await T(O("1", [q, F], "attributes"), { body: JSON.stringify({ delete: r }), method: "DELETE" });
753
+ return !i.ok && i.reportError && (console.warn("[Sprig] (ERR-433) Remove attributes failed", i.error), i.error && window.UserLeap.reportError("removeAttributes", i.error)), { success: !!i.ok };
754
+ }, async addSurveyListener(r) {
755
+ u.on(w.SurveyLifeCycle, r);
756
+ }, async removeSurveyListener(r) {
757
+ u.removeListener(w.SurveyLifeCycle, r);
758
+ }, async addListener(r, i) {
759
+ u.on(r, i);
760
+ }, async removeListener(r, i) {
761
+ u.removeListener(r, i);
762
+ }, async removeAllListeners() {
763
+ u.removeAllListeners();
764
+ }, setPreviewKey(r) {
765
+ r && typeof r == "string" && D.isStorageAvailable && r && D.setItem("sprig.previewKey", r);
766
+ }, async setUserId(r) {
767
+ var a;
768
+ if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig setUserId", r), r == null) {
769
+ const l = `[Sprig] - Invalid userId ${r}`;
770
+ return console.warn(l), { success: !1, message: l };
771
+ }
772
+ if (t.mode === "test" || r === window.UserLeap.userId)
773
+ return;
774
+ window.UserLeap.userId = r;
775
+ const i = window.UserLeap.visitorId, o = await T(O("1", [q, F]), { body: JSON.stringify({ userId: r }), method: "PUT" });
776
+ o.ok ? (i !== window.UserLeap.visitorId && ((a = I.replay) == null || a.clearUserReplayData()), x("uid", r)) : o.reportError && (console.warn("[Sprig] (ERR-420) Failed to set user id", o.error), o.error && window.UserLeap.reportError("setUserId", o.error));
777
+ }, async setPartnerAnonymousId(r) {
778
+ if (window.UserLeap.debugMode && console.info("[DEBUG] Sprig setPartnerAnonymousId", r), r == null) {
779
+ const i = `[Sprig] - Invalid partnerAnonymousId ${r}`;
780
+ return console.warn(i), { success: !1, message: i };
781
+ }
782
+ return window.UserLeap.partnerAnonymousId = r, x("aid", r), { success: !0 };
783
+ }, track: async (r, i, o = {}, a = void 0) => e({ eventName: r, properties: i, metadata: o, showSurveyCallback: a }), identifyAndTrack: async (r) => await e(r), trackPageView(r, i = void 0, o = void 0, a = !0) {
784
+ ke = r, vt(r, i, o, a);
785
+ }, applyFeedbackStyles({ button: r = "", view: i = "" }) {
786
+ window.UserLeap.feedbackCustomStyles = i, document.getElementById("sprig-feedback-style") && oe({ document, elementId: "ul-custom-style", styleString: r, nonce: window.UserLeap.styleNonce }), n(document.querySelector(".ul-container-feedback"), i);
787
+ }, applyStyles(r) {
788
+ window.UserLeap.customStyles = r, n(window.UserLeap.container, r);
789
+ }, setWindowDimensions(r, i) {
790
+ var c, d;
791
+ const o = typeof r == "string" ? parseInt(r, 10) : r, a = typeof i == "string" ? parseInt(i, 10) : i;
792
+ if (isNaN(o) || isNaN(a) || (window.UserLeap.windowDimensions = { width: o, height: a }), !window.UserLeap.frameId)
793
+ return;
794
+ const l = document.getElementById(window.UserLeap.frameId);
795
+ l && (window.UserLeap.useMobileStyling && ((c = window.UserLeap.windowDimensions) != null && c.width && (l.style.width = `${window.UserLeap.windowDimensions.width}px`), (d = window.UserLeap.windowDimensions) != null && d.height && (l.style.maxHeight = window.UserLeap.windowDimensions.height - 20 + "px"), l.contentDocument && (l.style.height = String(Ft(l.contentDocument)[0]) + "px")), u.emit(w.SurveyDimensions, { name: w.SurveyDimensions, contentFrameWidth: l.clientWidth, contentFrameHeight: l.clientHeight, "survey.id": parseInt(window.UserLeap.container.dataset.studyId) }));
796
+ }, logoutUser() {
797
+ var r;
798
+ window.UserLeap.debugMode && console.info("[DEBUG] Sprig logout"), M.info("LogOut", { vid: window.UserLeap.visitorId, userId: window.UserLeap.userId }), window.UserLeap.visitorId = null, window.UserLeap.userId = null, window.UserLeap.partnerAnonymousId = null, window.UserLeap.token = null, window.UserLeap.email = null, D.removeItem("userleap.ids"), window.UserLeap._queue.isPaused() && window.UserLeap._queue.empty(), ft(), (r = I.replay) == null || r.clearUserReplayData(), window.UserLeap._queue.unpause();
799
+ }, teardown() {
800
+ ["hashchange", "popstate"].forEach((r) => window.removeEventListener(r, ee, !0)), window.UserLeap._config.interactiveEvents && mt(), window.UserLeap("dismissActiveSurvey", N.API), delete window.UserLeap, delete window.Sprig, delete window._Sprig;
801
+ }, integrateOptimizely(r, i = !0) {
802
+ var o, a;
803
+ if ((a = (o = window.UserLeap) == null ? void 0 : o._config) != null && a.optimizelyEnabled)
804
+ try {
805
+ const l = typeof r == "string" ? JSON.parse(r) : r;
806
+ ne.setOptimizelyExperiment(l, i);
807
+ } catch (l) {
808
+ console.warn("[Sprig] Error with integrating Optimizely data"), l instanceof Error && window.UserLeap.reportError("integrateOptimizely", l);
809
+ }
810
+ else
811
+ console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");
812
+ }, integrateOptimizelyClient(r) {
813
+ var i, o;
814
+ if (!((o = (i = window.UserLeap) == null ? void 0 : i._config) != null && o.optimizelyEnabled))
815
+ return void console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");
816
+ r.notificationCenter.addNotificationListener("ACTIVATE:experiment, user_id,attributes, variation, event", ({ experiment: a, variation: l }) => {
817
+ const c = { experiments: [{ id: a.id, variation: l.key }] };
818
+ window.UserLeap("integrateOptimizely", c, !1);
819
+ });
820
+ }, importLaunchDarklyData(r) {
821
+ var i, o;
822
+ (o = (i = window.UserLeap) == null ? void 0 : i._config) != null && o.launchDarklyEnabled ? Ue.setLDFlagsVariations(r) : console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");
823
+ }, setVisitorAttribute: (r, i) => (console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"), s.setAttribute(r, i)), setEmail: async (r) => s.setAttribute(Q, r), setVisitorEmail: async (r) => (console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"), s.setEmail(r)), _generateVideoUploadUrl: async (r) => async function(i) {
824
+ var a;
825
+ if (!i)
826
+ return;
827
+ const o = `${window.UserLeap._API_URL}/2/environments/integrations/upload`;
828
+ try {
829
+ const l = await fetch(o, { method: "POST", cache: "no-cache", headers: { "Content-Type": "application/json" }, body: JSON.stringify(i) });
830
+ if (l.ok) {
831
+ const c = await l.json();
832
+ return (a = c == null ? void 0 : c.upload) == null ? void 0 : a.url;
833
+ }
834
+ return null;
835
+ } catch (l) {
836
+ console.warn("[Sprig] Error with generating video upload url"), l instanceof Error && window.UserLeap.reportError("generateVideoUploadUrl", l);
837
+ }
838
+ }(r), _reportMetric(r, i) {
839
+ Dt(r, i);
840
+ }, _completeSessionReplay: async ({ surveyId: r, responseGroupUuid: i, eventDigest: o }) => {
841
+ var a;
842
+ return I.replay ? (a = I.replay) == null ? void 0 : a._completeSessionReplay({ surveyId: r, responseGroupUuid: i, eventDigest: o, headers: z(window.UserLeap) }) : (window.UserLeap.reportError("_completeSessionReplay", new Error("Replay module not registered")), !1);
843
+ } };
844
+ Object.assign(window.UserLeap, s);
845
+ };
846
+ async function Zt(t, e, n = {}, s = {}) {
847
+ const r = window.__cfg && window.__cfg.mode, i = xe(), o = window.UserLeap.envId, a = window.document.documentElement, l = { mode: r, screenWidth: window.screen.width, screenHeight: window.screen.height, clientWidth: a.clientWidth, clientHeight: a.clientHeight, location: window.location.href, language: window.navigator.language, ...n }, c = { action: t, breadcrumbs: M.breadcrumbs, err: { message: `${e == null ? void 0 : e.name} - ${e == null ? void 0 : e.message}`, stack: e == null ? void 0 : e.stack }, meta: l, vid: i, envId: o, ...s };
848
+ (await T(O("1", null, "errors"), { method: "POST", headers: { "x-ul-error": window.btoa(`userleap-${Date.now()}-error`) }, body: JSON.stringify(c), shouldDropOnRateLimit: !0 })).ok || console.warn("[Sprig] (ERR-444) Failed to report error to API", e);
849
+ }
850
+ function er(t = {}) {
851
+ var s;
852
+ (s = window.SprigLoggerCallback) == null || s.call(window, "Initializing Sprig");
853
+ const e = new URLSearchParams(window.location.search).get("sprigPreviewKey") ?? "";
854
+ async function n() {
855
+ var p, y, g, m, _;
856
+ if (window.UserLeap.loaded)
857
+ return;
858
+ if ((p = window.SprigLoggerCallback) == null || p.call(window, "Loading Sprig"), window.UserLeap.reportError = Zt, window.UserLeap.loaded = !0, window.UserLeap._config = Object.assign({}, t, window.UserLeap.config), window.UserLeap.delayingSurvey = !1, window.UserLeap._config && typeof window.UserLeap._config == "object")
859
+ for (const b in window.UserLeap._config)
860
+ window.UserLeap[b] = window.UserLeap._config[b];
861
+ if (!window.UserLeap.envId) {
862
+ if (!window.UserLeap.appId)
863
+ throw new Error("Missing Environment id");
864
+ window.UserLeap.envId = window.UserLeap.appId;
865
+ }
866
+ window.UserLeap.debugMode && console.info("[DEBUG] Sprig debug mode enabled");
867
+ const r = yt(), i = window.UserLeap.sampleRate;
868
+ let o = r.sampled;
869
+ if (i) {
870
+ if (o === null && (o = Math.random() < i, x("sampled", o)), !o)
871
+ return;
872
+ } else
873
+ o !== null && x("sampled", null);
874
+ window.UserLeap._API_URL || (window.UserLeap._API_URL = "https://api.sprig.com");
875
+ const a = [...window.UserLeap._queue];
876
+ window.UserLeap._queue = new Wt(window.UserLeap, []), window.UserLeap._queue.pause();
877
+ for (let b = 0; b < a.length; b++)
878
+ window.UserLeap._queue.push(a[b]);
879
+ const l = r.token;
880
+ l ? (window.UserLeap.token = l, window.UserLeap.visitorId = r.vid ?? null, window.UserLeap.userId = r.uid ?? null, window.UserLeap.partnerAnonymousId = r.aid ?? null) : ft();
881
+ const c = we(z(window.UserLeap));
882
+ (y = window.SprigLoggerCallback) == null || y.call(window, "Sprig fetching config");
883
+ const d = await async function(b) {
884
+ var k, C;
885
+ const U = z(window.UserLeap);
886
+ document.addEventListener("securitypolicyviolation", qe);
887
+ const h = await Xe(O("1", [q], "config"), { headers: U });
888
+ if (document.removeEventListener("securitypolicyviolation", qe), !h.ok)
889
+ return (k = window.SprigLoggerCallback) == null || k.call(window, "Sprig config fetch failed"), h.reportError && (console.warn("[Sprig] (ERR-422) Failed to load configuration", h.error), h.error && window.UserLeap.reportError("applyRemoteConfig", h.error)), ze("Disabled: failed to fetch configuration"), b;
890
+ const L = h.json;
891
+ return L != null && L.disabled ? ((C = window.SprigLoggerCallback) == null || C.call(window, "Sprig config fetch disabled"), ze(`Disabled: ${L.disabled}`), { disabled: L.disabled }) : Object.assign({}, L, b);
892
+ }(t);
893
+ (g = window.SprigLoggerCallback) == null || g.call(window, "Sprig fetched config"), $t({ isWeb: !c, reportingIntervalSeconds: d.metricsReportingEnabled || d.mobileMetricsReportingEnabled ? d.metricsReportingIntervalSeconds : 0, thresholds: d.metricThresholds, postMetrics: async (b) => {
894
+ var U;
895
+ await T(O("1", [q], "metrics"), { body: b, method: "POST", headers: { "x-ul-replay-enabled": `${!!((U = I.replay) != null && U.isReplayRecording())}` }, shouldDropOnRateLimit: !0 });
896
+ } }), await ((m = I.replay) == null ? void 0 : m.initializeReplay({ maxReplayDurationSeconds: d.maxReplayDurationSeconds, maxInflightRequests: window.UserLeap.maxInflightReplayRequests ?? 2, replaySettings: d.replaySettings })), Xt(d), await Yt(d), window.UserLeap._queue.unpause(), (_ = window.SprigLoggerCallback) == null || _.call(window, "SdkReady"), u.emit(w.SDKReady, { mobileMetricsReportingEnabled: !!d.mobileMetricsReportingEnabled, metricsReportingInterval: d.metricsReportingIntervalSeconds || 0, metricsThresholds: d.metricThresholds || [], maxMobileReplayDurationSeconds: d.maxMobileReplayDurationSeconds, mobileReplaySettings: d.mobileReplaySettings }), u.emit(w.VisitorIDUpdated, { visitorId: window.UserLeap.visitorId }), u.on(w.VisitorIDUpdated, () => {
897
+ for (const b in ue)
898
+ delete ue[b];
899
+ });
900
+ }
901
+ window.UserLeap.UPDATES = te, window.UserLeap("setPreviewKey", e), document.readyState === "complete" ? n() : window.attachEvent ? window.attachEvent("onload", n) : window.addEventListener("load", () => {
902
+ n();
903
+ }, !1);
904
+ }
905
+ class Ee {
906
+ constructor() {
907
+ this.UPDATES = te;
908
+ }
909
+ displaySurvey(e) {
910
+ window.Sprig("displaySurvey", e);
911
+ }
912
+ mute() {
913
+ window.Sprig("mute");
914
+ }
915
+ unmute() {
916
+ window.Sprig("unmute");
917
+ }
918
+ dismissActiveSurvey() {
919
+ window.Sprig("dismissActiveSurvey");
920
+ }
921
+ setAttribute(e, n) {
922
+ window.Sprig("setAttribute", e, n);
923
+ }
924
+ setAttributes(e) {
925
+ window.Sprig("setAttributes", e);
926
+ }
927
+ identifyAndSetAttributes(e) {
928
+ window.Sprig("identifyAndSetAttributes", e);
929
+ }
930
+ removeAttributes(e) {
931
+ window.Sprig("removeAttributes", e);
932
+ }
933
+ addListener(e, n) {
934
+ window.Sprig("addListener", e, n);
935
+ }
936
+ removeListener(e, n) {
937
+ window.Sprig("removeListener", e, n);
938
+ }
939
+ removeAllListeners() {
940
+ window.Sprig("removeAllListeners");
941
+ }
942
+ setEmail(e) {
943
+ window.Sprig("setAttribute", "!email", e);
944
+ }
945
+ setUserId(e) {
946
+ window.Sprig("setUserId", e);
947
+ }
948
+ setPartnerAnonymousId(e) {
949
+ window.Sprig("setPartnerAnonymousId", e);
950
+ }
951
+ track(e, n = {}, s = {}) {
952
+ window.Sprig("track", e, n, s);
953
+ }
954
+ identifyAndTrack(e) {
955
+ window.Sprig("identifyAndTrack", e);
956
+ }
957
+ trackPageView(e, n, s) {
958
+ window.Sprig("trackPageView", e, n, s);
959
+ }
960
+ applyStyles(e) {
961
+ window.Sprig("applyStyles", e);
962
+ }
963
+ setWindowDimensions(e, n) {
964
+ window.Sprig("setWindowDimensions", e, n);
965
+ }
966
+ logoutUser() {
967
+ window.Sprig("logoutUser");
968
+ }
969
+ teardown() {
970
+ window.Sprig("teardown");
971
+ }
972
+ }
973
+ const Ye = { configure: (t) => {
974
+ if (!t.envId && !t.environmentId)
975
+ throw new Error("Initialization Error: Sprig configure requires an environmentId");
976
+ if (t.envId || (t.envId = t.environmentId ?? ""), t.installationMethod = "web-npm", window.Sprig)
977
+ return window.Sprig;
978
+ window.Sprig = function() {
979
+ window.Sprig._queue.push(arguments);
980
+ }, Object.getOwnPropertyNames(Ee.prototype).map((n) => {
981
+ n !== "constructor" && (window.Sprig[n] = Ee.prototype[n]);
982
+ });
983
+ const e = window.Sprig;
984
+ return e.appId = t.envId, e._queue = [], window.UserLeap = e, er(t), window.Sprig;
985
+ } }, dr = { sprig: Ye, SprigAPI: Ee, configure: Ye.configure };
986
+ export {
987
+ ir as A,
988
+ Rt as C,
989
+ At as D,
990
+ sr as E,
991
+ Ee as S,
992
+ Ft as a,
993
+ or as b,
994
+ dr as c,
995
+ nr as d,
996
+ oe as e,
997
+ G as i,
998
+ ar as r,
999
+ Ye as s
1000
+ };