@shiva004/surveys 0.5.0 → 0.6.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/dist/index.js CHANGED
@@ -1,184 +1,818 @@
1
- import { jsxs as n, jsx as e, Fragment as V } from "react/jsx-runtime";
2
- import ue, { useState as j, useEffect as $, useMemo as ae, useCallback as F, useRef as B, useLayoutEffect as oe, useContext as me, useSyncExternalStore as pe, createContext as ge } from "react";
3
- import { createPortal as le } from "react-dom";
4
- const fe = ["Ease of use", "Performance", "Design & appearance", "Features", "Navigation", "Something else"], ve = ["", "Poor", "Fair", "Good", "Very good", "Excellent"];
5
- function we({ rating: t, onRate: a }) {
6
- const [i, s] = j(0), o = i || t;
7
- return /* @__PURE__ */ n(V, { children: [
8
- /* @__PURE__ */ e("div", { className: "rating", role: "radiogroup", "aria-label": "Star rating", onMouseLeave: () => s(0), children: [1, 2, 3, 4, 5].map((u) => /* @__PURE__ */ e(
1
+ import { jsxs as i, jsx as t, Fragment as B } from "react/jsx-runtime";
2
+ import Lt, { useState as x, useRef as q, useEffect as P, useSyncExternalStore as Me, useMemo as te, useCallback as H, useLayoutEffect as it, useContext as It, createContext as Tt } from "react";
3
+ import { createPortal as rt } from "react-dom";
4
+ const Ct = ["Ease of use", "Performance", "Design & appearance", "Features", "Navigation", "Something else"], jt = ["", "Poor", "Fair", "Good", "Very good", "Excellent"];
5
+ function Rt({ rating: e, onRate: n }) {
6
+ const [s, a] = x(0), o = s || e;
7
+ return /* @__PURE__ */ i(B, { children: [
8
+ /* @__PURE__ */ t("div", { className: "rating", role: "radiogroup", "aria-label": "Star rating", onMouseLeave: () => a(0), children: [1, 2, 3, 4, 5].map((c) => /* @__PURE__ */ t(
9
9
  "button",
10
10
  {
11
11
  type: "button",
12
12
  role: "radio",
13
- "aria-checked": t === u,
14
- "aria-label": `${u} star${u > 1 ? "s" : ""}`,
15
- className: `star ${u <= o ? "active" : ""}`,
16
- onMouseEnter: () => s(u),
17
- onFocus: () => s(u),
18
- onBlur: () => s(0),
19
- onClick: () => a(u),
13
+ "aria-checked": e === c,
14
+ "aria-label": `${c} star${c > 1 ? "s" : ""}`,
15
+ className: `star ${c <= o ? "active" : ""}`,
16
+ onMouseEnter: () => a(c),
17
+ onFocus: () => a(c),
18
+ onBlur: () => a(0),
19
+ onClick: () => n(c),
20
20
  children: "★"
21
21
  },
22
- u
22
+ c
23
23
  )) }),
24
- /* @__PURE__ */ e("div", { className: "hint", children: o ? `${o} out of 5 · ${ve[o]}` : "Select a rating to continue" })
24
+ /* @__PURE__ */ t("div", { className: "hint", children: o ? `${o} out of 5 · ${jt[o]}` : "Select a rating to continue" })
25
25
  ] });
26
26
  }
27
- function be({ onClose: t }) {
28
- const [a, i] = j(1), [s, o] = j(0), [u, T] = j([]), [g, N] = j(""), d = (l) => T((h) => h.includes(l) ? h.filter((b) => b !== l) : [...h, l]);
29
- return /* @__PURE__ */ e("div", { className: "overlay", onClick: (l) => {
30
- l.target === l.currentTarget && t();
31
- }, children: /* @__PURE__ */ n("div", { className: "modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "survey-title", children: [
32
- /* @__PURE__ */ e("button", { className: "close", onClick: t, "aria-label": "Close survey", children: "×" }),
33
- /* @__PURE__ */ e("div", { className: "progress", children: [1, 2, 3, 4].map((l) => /* @__PURE__ */ e("span", { className: l <= a ? "done" : "" }, l)) }),
34
- a === 1 && /* @__PURE__ */ n(V, { children: [
35
- /* @__PURE__ */ e("div", { className: "label", children: "Step 01 / 04 · Quick rating" }),
36
- /* @__PURE__ */ e("h2", { id: "survey-title", children: "How was your experience?" }),
37
- /* @__PURE__ */ e("p", { className: "desc", children: "Your feedback helps us make things better." }),
38
- /* @__PURE__ */ e(we, { rating: s, onRate: o }),
39
- /* @__PURE__ */ n("div", { className: "actions", children: [
40
- /* @__PURE__ */ e("button", { className: "btn secondary", onClick: t, children: "Cancel" }),
41
- /* @__PURE__ */ e("button", { className: "btn", disabled: !s, onClick: () => i(2), children: "Next →" })
42
- ] })
43
- ] }),
44
- a === 2 && /* @__PURE__ */ n(V, { children: [
45
- /* @__PURE__ */ e("div", { className: "label", children: "Step 02 / 04 · What matters?" }),
46
- /* @__PURE__ */ e("h2", { id: "survey-title", children: "What would you like us to improve?" }),
47
- /* @__PURE__ */ e("p", { className: "desc", children: "Choose all that apply." }),
48
- /* @__PURE__ */ e("div", { className: "choices", children: fe.map((l) => /* @__PURE__ */ n("label", { className: `choice ${u.includes(l) ? "checked" : ""}`, children: [
49
- /* @__PURE__ */ e("input", { type: "checkbox", checked: u.includes(l), onChange: () => d(l) }),
50
- l
51
- ] }, l)) }),
52
- /* @__PURE__ */ n("div", { className: "actions", children: [
53
- /* @__PURE__ */ e("button", { className: "btn secondary", onClick: () => i(1), children: "← Back" }),
54
- /* @__PURE__ */ e("button", { className: "btn", onClick: () => i(3), children: "Next →" })
55
- ] })
27
+ const Ot = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, Je = 500, Te = "Something else";
28
+ function At({ onClose: e, onSubmit: n }) {
29
+ const [s, a] = x(1), [o, c] = x(0), [d, r] = x([]), [p, l] = x(""), [h, g] = x(""), [u, f] = x(""), [v, _] = x(!1), N = (b) => r((R) => R.includes(b) ? R.filter((L) => L !== b) : [...R, b]), M = u.trim(), E = M !== "" && !Ot.test(M), I = d.includes(Te) && !p.trim(), w = () => {
30
+ n == null || n({
31
+ rating: o,
32
+ topics: d,
33
+ otherTopic: d.includes(Te) ? p.trim() : "",
34
+ comment: h.trim(),
35
+ email: M,
36
+ contactOk: v && M !== "",
37
+ submittedAt: (/* @__PURE__ */ new Date()).toISOString()
38
+ }), a(4);
39
+ };
40
+ return /* @__PURE__ */ t("div", { className: "overlay", onClick: (b) => {
41
+ b.target === b.currentTarget && e();
42
+ }, children: /* @__PURE__ */ i("div", { className: "modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "survey-title", children: [
43
+ /* @__PURE__ */ i("header", { className: "modal-head", children: [
44
+ /* @__PURE__ */ t("div", { className: "progress", "aria-hidden": "true", children: [1, 2, 3, 4].map((b) => /* @__PURE__ */ t("span", { className: b <= s ? "done" : "" }, b)) }),
45
+ /* @__PURE__ */ t("button", { className: "close", onClick: e, "aria-label": "Close survey", children: "×" })
56
46
  ] }),
57
- a === 3 && /* @__PURE__ */ n(V, { children: [
58
- /* @__PURE__ */ e("div", { className: "label", children: "Step 03 / 04 · Your thoughts" }),
59
- /* @__PURE__ */ e("h2", { id: "survey-title", children: "Anything else you'd like to share?" }),
60
- /* @__PURE__ */ e("p", { className: "desc", children: "Comments are optional." }),
61
- /* @__PURE__ */ e(
62
- "textarea",
63
- {
64
- className: "field",
65
- placeholder: "Share your thoughts, ideas, or suggestions...",
66
- value: g,
67
- onChange: (l) => N(l.target.value)
68
- }
69
- ),
70
- /* @__PURE__ */ n("div", { className: "actions", children: [
71
- /* @__PURE__ */ e("button", { className: "btn secondary", onClick: () => i(2), children: "← Back" }),
72
- /* @__PURE__ */ e("button", { className: "btn", onClick: () => i(4), children: "Submit →" })
47
+ /* @__PURE__ */ i("div", { className: "modal-body", children: [
48
+ s === 1 && /* @__PURE__ */ i(B, { children: [
49
+ /* @__PURE__ */ t("div", { className: "label", children: "Step 1 of 4 · Quick rating" }),
50
+ /* @__PURE__ */ t("h2", { id: "survey-title", children: "How was your experience?" }),
51
+ /* @__PURE__ */ t("p", { className: "desc", children: "Your feedback helps us make things better." }),
52
+ /* @__PURE__ */ t(Rt, { rating: o, onRate: c })
53
+ ] }),
54
+ s === 2 && /* @__PURE__ */ i(B, { children: [
55
+ /* @__PURE__ */ t("div", { className: "label", children: "Step 2 of 4 · What matters?" }),
56
+ /* @__PURE__ */ t("h2", { id: "survey-title", children: "What would you like us to improve?" }),
57
+ /* @__PURE__ */ t("p", { className: "desc", children: "Choose all that apply." }),
58
+ /* @__PURE__ */ t("div", { className: "choices", children: Ct.map((b) => /* @__PURE__ */ i("label", { className: `choice ${d.includes(b) ? "checked" : ""}`, children: [
59
+ /* @__PURE__ */ t("input", { type: "checkbox", checked: d.includes(b), onChange: () => N(b) }),
60
+ /* @__PURE__ */ t("span", { children: b })
61
+ ] }, b)) }),
62
+ d.includes(Te) && /* @__PURE__ */ t(
63
+ "input",
64
+ {
65
+ className: "input",
66
+ type: "text",
67
+ autoFocus: !0,
68
+ maxLength: 120,
69
+ placeholder: "Tell us what else...",
70
+ "aria-label": "Something else",
71
+ value: p,
72
+ onChange: (b) => l(b.target.value)
73
+ }
74
+ )
75
+ ] }),
76
+ s === 3 && /* @__PURE__ */ i(B, { children: [
77
+ /* @__PURE__ */ t("div", { className: "label", children: "Step 3 of 4 · Your thoughts" }),
78
+ /* @__PURE__ */ t("h2", { id: "survey-title", children: "Anything else you'd like to share?" }),
79
+ /* @__PURE__ */ t("p", { className: "desc", children: "Comments and email are optional." }),
80
+ /* @__PURE__ */ t(
81
+ "textarea",
82
+ {
83
+ className: "field",
84
+ maxLength: Je,
85
+ placeholder: "Share your thoughts, ideas, or suggestions...",
86
+ value: h,
87
+ onChange: (b) => g(b.target.value)
88
+ }
89
+ ),
90
+ /* @__PURE__ */ i("div", { className: "counter", children: [
91
+ h.length,
92
+ " / ",
93
+ Je
94
+ ] }),
95
+ /* @__PURE__ */ t("label", { className: "field-label", htmlFor: "fb-email", children: "Email (optional)" }),
96
+ /* @__PURE__ */ t(
97
+ "input",
98
+ {
99
+ id: "fb-email",
100
+ className: `input ${E ? "invalid" : ""}`,
101
+ type: "email",
102
+ inputMode: "email",
103
+ autoComplete: "email",
104
+ placeholder: "you@example.com",
105
+ value: u,
106
+ onChange: (b) => f(b.target.value),
107
+ "aria-invalid": E
108
+ }
109
+ ),
110
+ E && /* @__PURE__ */ t("div", { className: "error", children: "Please enter a valid email address." }),
111
+ /* @__PURE__ */ i("label", { className: `choice small ${M === "" ? "disabled" : ""}`, children: [
112
+ /* @__PURE__ */ t("input", { type: "checkbox", disabled: M === "", checked: v, onChange: (b) => _(b.target.checked) }),
113
+ /* @__PURE__ */ t("span", { children: "You can contact me about this feedback" })
114
+ ] })
115
+ ] }),
116
+ s === 4 && /* @__PURE__ */ i("div", { className: "success", children: [
117
+ /* @__PURE__ */ t("div", { className: "success-mark", children: "✓" }),
118
+ /* @__PURE__ */ t("div", { className: "label", children: "Step 4 of 4 · Completed" }),
119
+ /* @__PURE__ */ t("h2", { id: "survey-title", children: "Thank you for your feedback!" }),
120
+ /* @__PURE__ */ t("p", { children: n ? `Your ${o} ★ response has been recorded.` : `This is a preview, so your response (${o} ★) isn't sent anywhere.` })
73
121
  ] })
74
122
  ] }),
75
- a === 4 && /* @__PURE__ */ n("div", { className: "success", children: [
76
- /* @__PURE__ */ e("div", { className: "success-mark", children: "✓" }),
77
- /* @__PURE__ */ e("div", { className: "label", children: "Step 04 / 04 · Completed" }),
78
- /* @__PURE__ */ e("h2", { id: "survey-title", children: "Thank you for your feedback!" }),
79
- /* @__PURE__ */ n("p", { children: [
80
- "This is a preview, so your response (",
81
- s,
82
- " ★) isn't sent anywhere."
123
+ /* @__PURE__ */ i("footer", { className: "actions", children: [
124
+ s === 1 && /* @__PURE__ */ i(B, { children: [
125
+ /* @__PURE__ */ t("button", { className: "btn secondary", onClick: e, children: "Cancel" }),
126
+ /* @__PURE__ */ t("button", { className: "btn", disabled: !o, onClick: () => a(2), children: "Next →" })
127
+ ] }),
128
+ s === 2 && /* @__PURE__ */ i(B, { children: [
129
+ /* @__PURE__ */ t("button", { className: "btn secondary", onClick: () => a(1), children: "← Back" }),
130
+ /* @__PURE__ */ t("button", { className: "btn", disabled: I, onClick: () => a(3), children: "Next →" })
131
+ ] }),
132
+ s === 3 && /* @__PURE__ */ i(B, { children: [
133
+ /* @__PURE__ */ t("button", { className: "btn secondary", onClick: () => a(2), children: "← Back" }),
134
+ /* @__PURE__ */ t("button", { className: "btn", disabled: E, onClick: w, children: "Submit →" })
83
135
  ] }),
84
- /* @__PURE__ */ e("button", { className: "btn", onClick: t, children: "Done" })
136
+ s === 4 && /* @__PURE__ */ t("button", { className: "btn full", onClick: e, children: "Done" })
85
137
  ] })
86
138
  ] }) });
87
139
  }
88
- const ye = () => {
89
- const [t, a] = j(!1);
90
- return $(() => {
91
- if (!t) return;
92
- const i = (o) => {
93
- o.key === "Escape" && a(!1);
140
+ const Pt = ({ autoOpen: e = !0, onClose: n, onSubmit: s }) => {
141
+ const [a, o] = x(e), c = q(n);
142
+ c.current = n;
143
+ const d = () => {
144
+ var r;
145
+ o(!1), (r = c.current) == null || r.call(c);
146
+ };
147
+ return P(() => {
148
+ if (!a) return;
149
+ const r = (l) => {
150
+ var h;
151
+ l.key === "Escape" && (o(!1), (h = c.current) == null || h.call(c));
94
152
  };
95
- document.addEventListener("keydown", i);
96
- const s = document.body.style.overflow;
153
+ document.addEventListener("keydown", r);
154
+ const p = document.body.style.overflow;
97
155
  return document.body.style.overflow = "hidden", () => {
98
- document.removeEventListener("keydown", i), document.body.style.overflow = s;
156
+ document.removeEventListener("keydown", r), document.body.style.overflow = p;
99
157
  };
100
- }, [t]), /* @__PURE__ */ n("div", { className: "fb-root", children: [
101
- /* @__PURE__ */ e("main", { className: "page", children: /* @__PURE__ */ e("button", { className: "btn", onClick: () => a(!0), children: "Preview Feedback" }) }),
102
- t && /* @__PURE__ */ e(be, { onClose: () => a(!1) })
158
+ }, [a]), /* @__PURE__ */ i("div", { className: "fb-root", children: [
159
+ /* @__PURE__ */ t("main", { className: "page" }),
160
+ a && /* @__PURE__ */ t(At, { onClose: d, onSubmit: s })
103
161
  ] });
104
- }, se = {
105
- login: { name: "login.logger.log", lines: [
106
- { t: "09:14:02", l: "INFO", m: "Login request received for user=jdoe@example.com", d: { meaning: "Normal event. The login flow started.", fix: "Nothing to do." } },
107
- { t: "09:14:02", l: "DEBUG", m: "Validating credentials payload (fields: email, password)", d: { meaning: "Extra detail for developers while tracing a request.", fix: "Nothing to do." } },
108
- { t: "09:14:03", l: "DEBUG", m: "Looking up user record in users table", d: { meaning: "Shows which step the app is on. Useful to see where a flow stops.", fix: "Nothing to do." } },
109
- { t: "09:14:04", l: "WARN", m: "Password attempt 2 of 3 for user=jdoe@example.com", d: { meaning: "Something unusual, but the app kept going. A third failure will lock the account.", fix: "Ask the user to reset the password if this repeats." } },
110
- { t: "09:14:05", l: "ERROR", m: "Authentication failed: invalid credentials (HTTP 401)", d: { meaning: "The login was rejected. The server answered 401, so the email or password did not match.", fix: "Check the typed credentials, then confirm the account exists and is not locked.", stack: `AuthError: invalid credentials
111
- at AuthService.verify (auth.service.js:88:15)
112
- at async login (login.controller.js:42:9)` } },
113
- { t: "09:14:35", l: "INFO", m: "Retry allowed after 30s cooldown", d: { meaning: "Normal event. The user may try again.", fix: "Nothing to do." } },
114
- { t: "09:14:51", l: "WARN", m: "Session cookie missing SameSite attribute", d: { meaning: "Login works, but some browsers may block the cookie later.", fix: "Set SameSite=Lax (or Strict) when the cookie is created." } },
115
- { t: "09:15:10", l: "INFO", m: "Login succeeded for user=jdoe@example.com session=a91f3c", d: { meaning: "Normal event. The login worked on the retry.", fix: "Nothing to do." } },
116
- { t: "09:15:42", l: "ERROR", m: "Token refresh failed: network timeout after 5000ms", d: { meaning: "The app could not reach the auth server in time, so the session may expire.", fix: "Check the Network tab for the refresh request and the server response time.", stack: `TimeoutError: 5000ms exceeded
117
- at refreshToken (token.service.js:57:11)` } }
118
- ] },
119
- console: { name: "console.log", lines: [
120
- { t: "09:10:11", l: "INFO", m: "[vite] connected.", d: { meaning: "Normal event. The dev server connected.", fix: "Nothing to do." } },
121
- { t: "09:10:12", l: "WARN", m: 'Warning: Each child in a list should have a unique "key" prop.', d: { meaning: "React warns that list items have no stable key. The page works, but updates may be slow or glitchy.", fix: "Add a unique key prop to each item rendered in the list." } },
122
- { t: "09:10:14", l: "ERROR", m: "Uncaught TypeError: Cannot read properties of undefined (reading 'name')", d: { meaning: "The code read .name from a value that was undefined, so the component crashed.", fix: "Open the file and line in the stack trace, and check why the value is missing.", stack: `TypeError: Cannot read properties of undefined (reading 'name')
123
- at ProfileCard (ProfileCard.jsx:14:28)
124
- at renderWithHooks (react-dom.js:1482:18)` } },
125
- { t: "09:10:14", l: "DEBUG", m: "Rendering <ProfileCard /> props={ user: undefined }", d: { meaning: "This line shows the cause: user was undefined when the card rendered.", fix: "Make sure the profile request finished before rendering." } },
126
- { t: "09:10:15", l: "ERROR", m: "GET /api/profile 500 (Internal Server Error)", d: { meaning: "The server failed while handling the request. This explains the missing user above.", fix: "Check the server logs for this request and its error.", stack: `GET /api/profile
127
- Status: 500
128
- Request-Id: req_7f2c9` } },
129
- { t: "09:10:19", l: "WARN", m: "Deprecated API: componentWillMount will be removed", d: { meaning: "Still works today, but will break in a future upgrade.", fix: "Move the logic to componentDidMount or a useEffect hook." } },
130
- { t: "09:10:21", l: "INFO", m: "Route changed: /login → /dashboard", d: { meaning: "Normal event.", fix: "Nothing to do." } }
131
- ] },
132
- debug: { name: "app.debug.log", lines: [
133
- { t: "09:00:01", l: "INFO", m: "Application initialized successfully", d: { meaning: "Normal event.", fix: "Nothing to do." } },
134
- { t: "09:00:02", l: "DEBUG", m: "Config loaded from /etc/app/config.json", d: { meaning: "Developer detail.", fix: "Nothing to do." } },
135
- { t: "09:00:04", l: "WARN", m: "Image resource took longer than expected (assets/profile.webp)", d: { meaning: "A slow asset. The page still loads.", fix: "Compress the image or serve it from a CDN." } }
136
- ] }
137
- }, Ne = ["ALL", "ERROR", "WARN", "INFO", "DEBUG"], Y = [
162
+ }, Ft = [
163
+ "ALL",
164
+ "ERROR",
165
+ "WARN",
166
+ "INFO",
167
+ "DEBUG"
168
+ ], Ce = (e) => String(e).padStart(2, "0"), Dt = (e) => `${Ce(e.getHours())}:${Ce(e.getMinutes())}:${Ce(e.getSeconds())}`, Ht = [
169
+ {
170
+ key: "console",
171
+ name: "console.log",
172
+ match: () => !0
173
+ },
174
+ {
175
+ key: "errors",
176
+ name: "errors.log",
177
+ match: (e) => e.l === "ERROR" || e.l === "WARN"
178
+ },
179
+ {
180
+ key: "debug",
181
+ name: "debug.log",
182
+ match: (e) => e.l === "DEBUG"
183
+ }
184
+ ], Wt = (e) => {
185
+ const n = Array.from(
186
+ new Set(
187
+ e.map((s) => s.src).filter((s) => !!s)
188
+ )
189
+ );
190
+ return [
191
+ ...Ht,
192
+ ...n.map((s) => ({
193
+ key: `${s}.logger`,
194
+ name: `${s}.logger.log`,
195
+ match: (a) => a.src === s
196
+ }))
197
+ ];
198
+ }, Ue = {
199
+ ERROR: {
200
+ meaning: "Something failed in the application.",
201
+ fix: "Check the error message and stack trace."
202
+ },
203
+ WARN: {
204
+ meaning: "Something unusual happened.",
205
+ fix: "Review the warning and investigate if necessary."
206
+ },
207
+ INFO: {
208
+ meaning: "Normal application activity.",
209
+ fix: "No action is normally required."
210
+ },
211
+ DEBUG: {
212
+ meaning: "Developer debugging information.",
213
+ fix: "Use this information to investigate code behavior."
214
+ }
215
+ };
216
+ let ke = [], _t = 1;
217
+ const Pe = /* @__PURE__ */ new Set();
218
+ let je = !1;
219
+ const lt = () => {
220
+ je || (je = !0, queueMicrotask(() => {
221
+ je = !1, Pe.forEach((e) => e());
222
+ }));
223
+ }, Ve = /token|secret|pass|pwd|auth|jwt|session|cookie|otp|credential|api[-_]?key/i, ye = (e) => e.replace(
224
+ /\b(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,
225
+ "$1***"
226
+ ).replace(
227
+ /\b(password|passwd|token|secret|api[-_]?key|authorization)\s*[:=]\s*["']?[^"',\s}]+/gi,
228
+ "$1=***"
229
+ ), me = (e, n = "") => {
230
+ if (Ve.test(n)) return "***";
231
+ if (typeof e == "string")
232
+ return ye(e);
233
+ if (e instanceof Error)
234
+ return ye(e.message || String(e));
235
+ if (e == null)
236
+ return String(e);
237
+ if (typeof e == "object")
238
+ try {
239
+ const s = /* @__PURE__ */ new WeakSet();
240
+ return JSON.stringify(
241
+ e,
242
+ (a, o) => {
243
+ if (Ve.test(a)) return "***";
244
+ if (typeof o == "string") return ye(o);
245
+ if (typeof o == "object" && o !== null) {
246
+ if (s.has(o)) return "[Circular]";
247
+ s.add(o);
248
+ }
249
+ return o;
250
+ }
251
+ ) ?? String(e);
252
+ } catch {
253
+ return "[Unserializable object]";
254
+ }
255
+ return String(e);
256
+ }, Bt = (e) => {
257
+ const n = e[0];
258
+ if (typeof n != "string" || !/%[sdifoOjc%]/.test(n))
259
+ return e.map((o) => me(o)).join(" ");
260
+ let s = 1;
261
+ return [
262
+ n.replace(
263
+ /%([sdifoOjc%])/g,
264
+ (o, c) => {
265
+ if (c === "%") return "%";
266
+ if (s >= e.length) return o;
267
+ const d = e[s++];
268
+ switch (c) {
269
+ case "s":
270
+ return me(d);
271
+ case "d":
272
+ case "i":
273
+ return String(parseInt(String(d), 10));
274
+ case "f":
275
+ return String(parseFloat(String(d)));
276
+ case "c":
277
+ return "";
278
+ default:
279
+ return me(d);
280
+ }
281
+ }
282
+ ),
283
+ ...e.slice(s).map((o) => me(o))
284
+ ].join(" ");
285
+ }, pe = (e, n, s, a) => {
286
+ const o = n.find(
287
+ (h) => h instanceof Error
288
+ ), c = /* @__PURE__ */ new Date();
289
+ let d = Bt(n), r = s ?? (o == null ? void 0 : o.stack);
290
+ const p = d.search(/\n\s+at\s/);
291
+ p > 0 && (r || (r = d.slice(p).trim()), d = d.slice(0, p).trim());
292
+ const l = {
293
+ id: _t++,
294
+ at: c.getTime(),
295
+ t: Dt(c),
296
+ l: e,
297
+ m: d,
298
+ stack: r,
299
+ src: a
300
+ };
301
+ ke = [
302
+ ...ke,
303
+ l
304
+ ].slice(-1e3), lt();
305
+ }, ct = {};
306
+ function qt() {
307
+ if (typeof window > "u" || window.__pulseLogsCapture)
308
+ return;
309
+ window.__pulseLogsCapture = !0, [
310
+ ["log", "INFO"],
311
+ ["info", "INFO"],
312
+ ["warn", "WARN"],
313
+ ["error", "ERROR"],
314
+ ["debug", "DEBUG"]
315
+ ].forEach(([n, s]) => {
316
+ const a = console[n].bind(console);
317
+ ct[n] = a, console[n] = (...o) => {
318
+ a(...o), pe(s, o);
319
+ };
320
+ }), window.addEventListener("error", (n) => {
321
+ var s, a;
322
+ !n.error && !n.message || pe(
323
+ "ERROR",
324
+ [
325
+ `Uncaught ${((s = n.error) == null ? void 0 : s.name) ?? "Error"}: ${n.message}`
326
+ ],
327
+ (a = n.error) == null ? void 0 : a.stack
328
+ );
329
+ }), window.addEventListener("unhandledrejection", (n) => {
330
+ const s = n.reason;
331
+ pe(
332
+ "ERROR",
333
+ [`Unhandled promise rejection: ${me(s)}`],
334
+ s instanceof Error ? s.stack : void 0
335
+ );
336
+ });
337
+ }
338
+ qt();
339
+ function Le(e) {
340
+ const n = (o, c) => (...d) => {
341
+ const r = d.map((l) => typeof l == "string" ? ye(l) : l), p = ct[o];
342
+ if (p)
343
+ p(`[${e}]`, ...r);
344
+ else {
345
+ pe(c, r, void 0, e);
346
+ return;
347
+ }
348
+ pe(c, r, void 0, e);
349
+ }, s = {
350
+ debug: n("debug", "DEBUG"),
351
+ info: n("info", "INFO"),
352
+ warn: n("warn", "WARN"),
353
+ error: n("error", "ERROR")
354
+ };
355
+ return {
356
+ ...s,
357
+ wrap: (o, c, d = {}) => (...r) => {
358
+ const p = performance.now(), l = () => `${Math.round(performance.now() - p)}ms`;
359
+ s.debug(
360
+ `${o} started`,
361
+ ...d.logArgs ? [{ args: r }] : []
362
+ );
363
+ const h = (u) => (s.info(
364
+ `${o} succeeded (${l()})`,
365
+ ...d.logResult ? [{ result: u }] : []
366
+ ), u), g = (u) => {
367
+ throw s.error(
368
+ `${o} failed (${l()}): ${u instanceof Error ? u.message : String(u)}`,
369
+ u
370
+ ), u;
371
+ };
372
+ try {
373
+ const u = c(...r);
374
+ return u !== null && (typeof u == "object" || typeof u == "function") && typeof u.then == "function" ? Promise.resolve(u).then(
375
+ h,
376
+ g
377
+ ) : h(u);
378
+ } catch (u) {
379
+ return g(u);
380
+ }
381
+ }
382
+ };
383
+ }
384
+ const Dn = Le("app"), Yt = (e) => (Pe.add(e), () => {
385
+ Pe.delete(e);
386
+ }), Ge = () => ke, zt = () => {
387
+ ke = [], lt();
388
+ }, Jt = () => Me(
389
+ Yt,
390
+ Ge,
391
+ Ge
392
+ ), Ke = Le("network"), de = Le("storage"), ie = "pulseLogs.", Fe = ie + "networkName", De = ie + "publicLookup", Ut = /token|secret|pass|pwd|auth|jwt|session|cookie|otp|credential|api[-_]?key/i, ne = () => typeof window < "u" && typeof navigator < "u", re = (e) => {
393
+ if (!ne()) return null;
394
+ try {
395
+ return e === "local" ? window.localStorage : window.sessionStorage;
396
+ } catch {
397
+ return null;
398
+ }
399
+ }, X = (e, n = 2) => String(e).padStart(n, "0"), Be = () => {
400
+ try {
401
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || "local";
402
+ } catch {
403
+ return "local";
404
+ }
405
+ }, V = (e = /* @__PURE__ */ new Date()) => {
406
+ const n = new Date(e);
407
+ if (Number.isNaN(n.getTime())) return "Invalid date";
408
+ const s = -n.getTimezoneOffset(), a = Math.abs(s);
409
+ return `${n.getFullYear()}-${X(n.getMonth() + 1)}-${X(n.getDate())} ${X(n.getHours())}:${X(n.getMinutes())}:${X(n.getSeconds())}.${X(n.getMilliseconds(), 3)} (UTC${s >= 0 ? "+" : "-"}${X(Math.floor(a / 60))}:${X(a % 60)})`;
410
+ }, Ie = {
411
+ publicIp: null,
412
+ localIps: [],
413
+ localIpsHidden: !1,
414
+ isp: null,
415
+ location: null
416
+ }, dt = {
417
+ online: !1,
418
+ type: "unknown",
419
+ effectiveType: "unknown",
420
+ downlinkMbps: null,
421
+ rttMs: null,
422
+ connectionName: null,
423
+ ...Ie
424
+ }, Xe = (e) => {
425
+ var n;
426
+ try {
427
+ return ((n = re("local")) == null ? void 0 : n.getItem(e)) ?? null;
428
+ } catch {
429
+ return null;
430
+ }
431
+ }, C = ne() && window.__pulseEnvStore || {
432
+ state: { net: dt, local: [], session: [] },
433
+ listeners: /* @__PURE__ */ new Set(),
434
+ ip: { ...Ie },
435
+ manualName: Xe(Fe),
436
+ lookupEnabled: Xe(De) !== "0",
437
+ run: 0
438
+ };
439
+ ne() && (window.__pulseEnvStore = C);
440
+ const ht = () => {
441
+ if (!ne()) return;
442
+ const e = navigator;
443
+ return e.connection || e.mozConnection || e.webkitConnection;
444
+ }, Qe = typeof window < "u" && window.fetch ? window.fetch.bind(window) : null, Ze = async (e, n = 3e3) => {
445
+ if (!Qe) throw new Error("Fetch unavailable");
446
+ const s = new AbortController(), a = setTimeout(() => s.abort(), n);
447
+ try {
448
+ const o = await Qe(e, { signal: s.signal });
449
+ if (!o.ok) throw new Error(`HTTP ${o.status}`);
450
+ return await o.json();
451
+ } finally {
452
+ clearTimeout(a);
453
+ }
454
+ }, Vt = async () => {
455
+ var e, n;
456
+ try {
457
+ const s = await Ze("https://ipwho.is/");
458
+ if ((s == null ? void 0 : s.success) !== !1 && typeof (s == null ? void 0 : s.ip) == "string")
459
+ return {
460
+ publicIp: s.ip,
461
+ isp: ((e = s.connection) == null ? void 0 : e.isp) || ((n = s.connection) == null ? void 0 : n.org) || null,
462
+ location: [s.city, s.region, s.country].filter(Boolean).join(", ") || null
463
+ };
464
+ } catch {
465
+ }
466
+ try {
467
+ const s = await Ze("https://api.ipify.org?format=json");
468
+ return { publicIp: (s == null ? void 0 : s.ip) ?? null, isp: null, location: null };
469
+ } catch {
470
+ return { publicIp: null, isp: null, location: null };
471
+ }
472
+ }, Gt = () => new Promise((e) => {
473
+ if (!ne() || typeof RTCPeerConnection > "u") {
474
+ e({ ips: [], hidden: !1 });
475
+ return;
476
+ }
477
+ const n = /* @__PURE__ */ new Set();
478
+ let s = !1, a = !1, o, c;
479
+ try {
480
+ c = new RTCPeerConnection({ iceServers: [] });
481
+ } catch {
482
+ e({ ips: [], hidden: !1 });
483
+ return;
484
+ }
485
+ const d = () => {
486
+ if (!a) {
487
+ a = !0, clearTimeout(o);
488
+ try {
489
+ c.close();
490
+ } catch {
491
+ }
492
+ e({ ips: [...n], hidden: s });
493
+ }
494
+ };
495
+ o = setTimeout(d, 1500);
496
+ try {
497
+ c.createDataChannel("pulse"), c.onicecandidate = (r) => {
498
+ var h;
499
+ const p = (h = r.candidate) == null ? void 0 : h.candidate;
500
+ if (!p) {
501
+ d();
502
+ return;
503
+ }
504
+ const l = p.split(" ")[4];
505
+ l && (l.endsWith(".local") ? s = !0 : n.add(l));
506
+ }, c.createOffer().then((r) => c.setLocalDescription(r)).catch(d);
507
+ } catch {
508
+ d();
509
+ }
510
+ }), ut = () => {
511
+ if (!ne()) return { ...dt };
512
+ const e = ht();
513
+ return {
514
+ online: navigator.onLine,
515
+ type: (e == null ? void 0 : e.type) ?? "unknown",
516
+ effectiveType: (e == null ? void 0 : e.effectiveType) ?? "unknown",
517
+ downlinkMbps: typeof (e == null ? void 0 : e.downlink) == "number" ? e.downlink : null,
518
+ rttMs: typeof (e == null ? void 0 : e.rtt) == "number" ? e.rtt : null,
519
+ connectionName: C.manualName,
520
+ ...C.ip
521
+ };
522
+ }, mt = (e, n) => {
523
+ if (Ut.test(e)) return "***";
524
+ const s = n ?? "";
525
+ return s.length > 100 ? s.slice(0, 100) + "…" : s;
526
+ }, He = (e) => {
527
+ if (!e) return [];
528
+ try {
529
+ const n = [];
530
+ for (let s = 0; s < e.length; s++) {
531
+ const a = e.key(s);
532
+ if (!a || a.startsWith(ie)) continue;
533
+ const o = e.getItem(a) ?? "";
534
+ n.push({ key: a, size: o.length, value: mt(a, o) });
535
+ }
536
+ return n;
537
+ } catch {
538
+ return [];
539
+ }
540
+ }, Re = (e) => {
541
+ try {
542
+ if (e === window.localStorage) return "localStorage";
543
+ if (e === window.sessionStorage) return "sessionStorage";
544
+ } catch {
545
+ }
546
+ return "storage";
547
+ }, U = () => {
548
+ C.state = {
549
+ net: ut(),
550
+ local: He(re("local")),
551
+ session: He(re("session"))
552
+ }, queueMicrotask(() => {
553
+ C.listeners.forEach((e) => e());
554
+ });
555
+ }, pt = (e) => [
556
+ e.online ? "Online" : "OFFLINE",
557
+ e.connectionName ? `"${e.connectionName}"` : null,
558
+ e.publicIp ? `IP ${e.publicIp}` : null,
559
+ e.localIps.length ? `LAN ${e.localIps.join(", ")}` : e.localIpsHidden ? "LAN hidden by browser" : null,
560
+ e.isp,
561
+ e.type !== "unknown" ? e.type : null,
562
+ e.effectiveType !== "unknown" ? e.effectiveType : null,
563
+ e.downlinkMbps !== null ? `${e.downlinkMbps} Mbps` : null,
564
+ e.rttMs !== null ? `RTT ${e.rttMs}ms` : null
565
+ ].filter(Boolean).join(" · "), Se = (e) => {
566
+ const n = ut(), s = { at: V(), timezone: Be(), ...n };
567
+ (n.online ? Ke.info : Ke.warn)(`${e}: ${pt(n)}`, s);
568
+ }, ge = async (e) => {
569
+ if (!ne()) return;
570
+ const n = ++C.run;
571
+ if (!navigator.onLine) {
572
+ C.ip = { ...Ie }, U(), Se(e);
573
+ return;
574
+ }
575
+ const [s, a] = await Promise.all([
576
+ C.lookupEnabled ? Vt() : Promise.resolve({ publicIp: null, isp: null, location: null }),
577
+ Gt()
578
+ ]);
579
+ n === C.run && (C.ip = { ...s, localIps: a.ips, localIpsHidden: a.hidden }, U(), Se(e));
580
+ }, Kt = (e) => {
581
+ C.manualName = e.trim() || null;
582
+ try {
583
+ const n = re("local");
584
+ n && (C.manualName ? n.setItem(Fe, C.manualName) : n.removeItem(Fe));
585
+ } catch {
586
+ }
587
+ U(), Se("network name set");
588
+ }, Xt = (e) => {
589
+ C.lookupEnabled = e;
590
+ try {
591
+ const n = re("local");
592
+ n && (e ? n.removeItem(De) : n.setItem(De, "0"));
593
+ } catch {
594
+ }
595
+ ge(e ? "public lookup enabled" : "public lookup disabled");
596
+ }, Qt = () => C.lookupEnabled, Zt = () => {
597
+ ge("network refreshed");
598
+ };
599
+ function en() {
600
+ var d, r;
601
+ if (!ne() || window.__pulseEnvCapture) return;
602
+ window.__pulseEnvCapture = !0;
603
+ const e = Storage.prototype, n = e.setItem, s = e.removeItem, a = e.clear;
604
+ let o = !1;
605
+ const c = (p) => {
606
+ if (!o) {
607
+ o = !0;
608
+ try {
609
+ p();
610
+ } finally {
611
+ o = !1;
612
+ }
613
+ }
614
+ };
615
+ e.setItem = function(p, l) {
616
+ const h = !o && this.getItem(p) !== null;
617
+ n.call(this, p, l), !(o || p.startsWith(ie)) && c(() => {
618
+ de.info(
619
+ `${Re(this)} ${h ? "update" : "add"} ${p} = ${mt(p, String(l))}`,
620
+ { size: String(l).length, at: V() }
621
+ ), U();
622
+ });
623
+ }, e.removeItem = function(p) {
624
+ const l = !o && this.getItem(p) !== null;
625
+ s.call(this, p), !(o || !l || p.startsWith(ie)) && c(() => {
626
+ de.info(`${Re(this)} remove ${p}`, { at: V() }), U();
627
+ });
628
+ }, e.clear = function() {
629
+ if (o) {
630
+ a.call(this);
631
+ return;
632
+ }
633
+ const p = Re(this), l = He(this).length > 0;
634
+ a.call(this), c(() => {
635
+ l && de.warn(`${p} cleared`, { at: V() }), U();
636
+ });
637
+ }, window.addEventListener("storage", (p) => {
638
+ var l;
639
+ (l = p.key) != null && l.startsWith(ie) || c(() => {
640
+ de.info(
641
+ `${p.storageArea === re("session") ? "sessionStorage" : "localStorage"} changed in other tab: ${p.key ?? "(clear)"}`,
642
+ { at: V() }
643
+ ), U();
644
+ });
645
+ }), window.addEventListener("online", () => {
646
+ ge("online");
647
+ }), window.addEventListener("offline", () => {
648
+ C.run++, C.ip = { ...Ie }, U(), Se("offline");
649
+ }), (r = (d = ht()) == null ? void 0 : d.addEventListener) == null || r.call(d, "change", () => {
650
+ ge("connection changed");
651
+ }), U(), c(() => {
652
+ de.info(
653
+ `snapshot: localStorage ${C.state.local.length} keys, sessionStorage ${C.state.session.length} keys`,
654
+ {
655
+ at: V(),
656
+ timezone: Be(),
657
+ localStorage: C.state.local,
658
+ sessionStorage: C.state.session
659
+ }
660
+ );
661
+ }), ge("network at start");
662
+ }
663
+ const tn = (e) => (C.listeners.add(e), () => {
664
+ C.listeners.delete(e);
665
+ }), et = () => C.state, nn = () => (P(() => {
666
+ en();
667
+ }, []), Me(tn, et, et));
668
+ function tt({ title: e, items: n }) {
669
+ return /* @__PURE__ */ i("div", { className: "env-box", children: [
670
+ /* @__PURE__ */ i("b", { children: [
671
+ e,
672
+ " (",
673
+ n.length,
674
+ " ",
675
+ n.length === 1 ? "key" : "keys",
676
+ ")"
677
+ ] }),
678
+ n.length === 0 ? /* @__PURE__ */ t("span", { className: "env-muted", children: "Empty." }) : /* @__PURE__ */ t("div", { className: "env-scroll", children: /* @__PURE__ */ t("table", { className: "mono", children: /* @__PURE__ */ t("tbody", { children: n.map((s) => /* @__PURE__ */ i("tr", { children: [
679
+ /* @__PURE__ */ t("td", { title: s.key, children: s.key }),
680
+ /* @__PURE__ */ i("td", { children: [
681
+ s.size,
682
+ " B"
683
+ ] }),
684
+ /* @__PURE__ */ t("td", { title: s.value, children: s.value })
685
+ ] }, s.key)) }) }) })
686
+ ] });
687
+ }
688
+ function sn() {
689
+ const { net: e, local: n, session: s } = nn(), [a, o] = x(!1), [c, d] = x(() => V()), [r, p] = x(e.connectionName ?? ""), [l, h] = x(Qt());
690
+ P(() => {
691
+ if (!a) return;
692
+ d(V());
693
+ const u = setInterval(() => d(V()), 1e3);
694
+ return () => clearInterval(u);
695
+ }, [a]);
696
+ const g = () => Kt(r);
697
+ return /* @__PURE__ */ i("div", { className: "env", "data-tour": "env", children: [
698
+ /* @__PURE__ */ i("button", { className: "env-head", onClick: () => o((u) => !u), "aria-expanded": a, children: [
699
+ /* @__PURE__ */ i("span", { children: [
700
+ a ? "▾" : "▸",
701
+ " Environment"
702
+ ] }),
703
+ /* @__PURE__ */ t("span", { className: `env-sum ${e.online ? "" : "off"}`, children: pt(e) })
704
+ ] }),
705
+ a && /* @__PURE__ */ i("div", { className: "env-body", children: [
706
+ /* @__PURE__ */ i("div", { className: "env-box", children: [
707
+ /* @__PURE__ */ t("b", { children: "Local time" }),
708
+ /* @__PURE__ */ t("span", { className: "mono", children: c }),
709
+ /* @__PURE__ */ i("span", { className: "env-muted", children: [
710
+ "Time zone: ",
711
+ Be()
712
+ ] })
713
+ ] }),
714
+ /* @__PURE__ */ i("div", { className: "env-box", children: [
715
+ /* @__PURE__ */ t("b", { children: "Network" }),
716
+ /* @__PURE__ */ t("span", { children: e.online ? "Online" : "Offline" }),
717
+ /* @__PURE__ */ i("span", { className: "env-muted", children: [
718
+ "Public IP: ",
719
+ e.publicIp ?? (l ? "unknown" : "lookup off"),
720
+ e.isp ? ` · ${e.isp}` : "",
721
+ e.location ? ` · ${e.location}` : ""
722
+ ] }),
723
+ /* @__PURE__ */ i("span", { className: "env-muted", children: [
724
+ "LAN IP: ",
725
+ e.localIps.length ? e.localIps.join(", ") : e.localIpsHidden ? "hidden by browser" : "unknown"
726
+ ] }),
727
+ /* @__PURE__ */ i("span", { className: "env-muted", children: [
728
+ "Connection: ",
729
+ e.type,
730
+ " · ",
731
+ e.effectiveType,
732
+ e.downlinkMbps !== null ? ` · ${e.downlinkMbps} Mbps` : "",
733
+ e.rttMs !== null ? ` · RTT ${e.rttMs} ms` : ""
734
+ ] }),
735
+ /* @__PURE__ */ i("div", { className: "env-row", children: [
736
+ /* @__PURE__ */ t(
737
+ "input",
738
+ {
739
+ className: "search",
740
+ placeholder: "Wi-Fi / network name (browsers cannot read it)",
741
+ value: r,
742
+ onChange: (u) => p(u.target.value),
743
+ onKeyDown: (u) => {
744
+ u.key === "Enter" && g();
745
+ },
746
+ "aria-label": "Network name"
747
+ }
748
+ ),
749
+ /* @__PURE__ */ t("button", { className: "btn ghost", onClick: g, children: "Save name" }),
750
+ /* @__PURE__ */ t("button", { className: "btn ghost", onClick: Zt, children: "Refresh" })
751
+ ] }),
752
+ /* @__PURE__ */ i("label", { className: "env-muted", style: { display: "flex", gap: 6, alignItems: "center", marginTop: 4 }, children: [
753
+ /* @__PURE__ */ t(
754
+ "input",
755
+ {
756
+ type: "checkbox",
757
+ checked: l,
758
+ onChange: (u) => {
759
+ h(u.target.checked), Xt(u.target.checked);
760
+ }
761
+ }
762
+ ),
763
+ "Look up public IP, ISP and location (sends a request to ipwho.is / ipify)"
764
+ ] })
765
+ ] }),
766
+ /* @__PURE__ */ t(tt, { title: "localStorage", items: n }),
767
+ /* @__PURE__ */ t(tt, { title: "sessionStorage", items: s })
768
+ ] })
769
+ ] });
770
+ }
771
+ const Ne = [
138
772
  {
139
773
  target: "titlebar",
140
774
  place: "bottom",
141
775
  title: "Meet the Log Viewer",
142
776
  body: "The Log Viewer shows what your application recorded while it ran. When something breaks, it is the first place to look to find out what happened and why.",
143
- enter: (t) => {
144
- t.setFile("login"), t.setLevel("ALL"), t.setQuery(""), t.setSel(null);
777
+ enter: (e) => {
778
+ e.setFile("console"), e.setLevel("ALL"), e.setQuery(""), e.setSel(null);
145
779
  }
146
780
  },
147
781
  {
148
782
  target: "files",
149
783
  place: "right",
150
784
  title: "Open a log file",
151
- body: "Every log file lives in this list. Click one to open it. Each file records a different part of the app: login activity, browser console output, or general debug messages. The number shows how many lines it holds.",
152
- enter: (t) => {
153
- t.setFile("login"), t.setLevel("ALL"), t.setSel(null);
785
+ body: "Every log file lives in this list. Click one to open it. console.log holds all console output, errors.log holds only errors and warnings, and debug.log holds debug messages. The number shows how many live lines each holds.",
786
+ enter: (e) => {
787
+ e.setFile("console"), e.setLevel("ALL"), e.setQuery(""), e.setSel(null);
154
788
  }
155
789
  },
156
790
  {
157
791
  target: "logpane",
158
792
  place: "top",
159
- title: "Inspect login.logger.log",
160
- body: "This file records every step of the login flow, one line per event: a line number, the time, a level, and a message. Read it top to bottom to follow what happened in order. Click any line to see more about it.",
161
- enter: (t) => {
162
- t.setFile("login"), t.setLevel("ALL"), t.setQuery(""), t.setSel(null);
793
+ title: "Inspect console.log",
794
+ body: "This file shows everything this project prints to the browser console, live, one line per event: a line number, the time it happened, a level, and a message. Read it top to bottom to follow what happened in order. Click any line to see more about it.",
795
+ enter: (e) => {
796
+ e.setFile("console"), e.setLevel("ALL"), e.setQuery(""), e.setSel(null);
163
797
  }
164
798
  },
165
799
  {
166
800
  target: "filters",
167
801
  place: "bottom",
168
802
  title: "Find console errors fast",
169
- body: "Open console.log, which holds what the browser console printed, then press the Error filter. Only the red lines are left, such as an uncaught TypeError or a failed request. The search box narrows it down further.",
170
- enter: (t) => {
171
- t.setFile("console"), t.setLevel("ERROR"), t.setQuery(""), t.setSel(null);
803
+ body: "Press the Error filter. Only the red lines are left, such as an uncaught error or a failed request. The search box narrows it down further.",
804
+ enter: (e) => {
805
+ e.setFile("console"), e.setLevel("ERROR"), e.setQuery(""), e.setSel(null);
172
806
  }
173
807
  },
174
808
  {
175
809
  target: "details",
176
810
  place: "left",
177
811
  title: "Read errors and warnings",
178
- body: "Select a line and its details appear here: what the message means, a suggested fix, and the stack trace showing the exact file and line. Levels tell you how serious a line is.",
812
+ body: "Select a line and its details appear here: what the level means, a suggested fix, and the stack trace (when one was captured) showing the exact file and line. Levels tell you how serious a line is.",
179
813
  legend: !0,
180
- enter: (t) => {
181
- t.setFile("login"), t.setLevel("ALL"), t.setQuery(""), t.setSel(4);
814
+ enter: (e) => {
815
+ e.setFile("console"), e.setLevel("ALL"), e.setQuery(""), e.setSel("auto");
182
816
  }
183
817
  },
184
818
  {
@@ -186,222 +820,689 @@ Request-Id: req_7f2c9` } },
186
820
  place: "bottom",
187
821
  title: "Debug problems with it",
188
822
  body: "Use these counters to see how healthy a session was. Start with the errors, read the warnings around them, then follow the debug lines before an error to find the cause. Fix it, reload, and check that the error is gone.",
189
- enter: (t) => {
190
- t.setFile("console"), t.setLevel("ALL"), t.setQuery(""), t.setSel(2);
823
+ enter: (e) => {
824
+ e.setFile("console"), e.setLevel("ALL"), e.setQuery(""), e.setSel("auto");
191
825
  }
192
826
  }
193
827
  ];
194
- function ke({ step: t, total: a, onNext: i, onBack: s, onClose: o }) {
195
- const u = Y[t], T = B(null), [g, N] = j(null), [d, l] = j({ w: 340, h: 260 }), [h, b] = j({ w: window.innerWidth, h: window.innerHeight }), m = F(() => {
196
- const r = document.querySelector(`[data-tour="${u.target}"]`);
197
- if (b({ w: window.innerWidth, h: window.innerHeight }), !r) {
198
- N(null);
828
+ function an({ step: e, total: n, onNext: s, onBack: a, onClose: o }) {
829
+ const c = Ne[e], d = q(null), [r, p] = x(null), [l, h] = x({ w: 340, h: 260 }), [g, u] = x({ w: window.innerWidth, h: window.innerHeight }), f = H(() => {
830
+ const k = document.querySelector(`[data-tour="${c.target}"]`);
831
+ if (u({ w: window.innerWidth, h: window.innerHeight }), !k) {
832
+ p(null);
199
833
  return;
200
834
  }
201
- const f = r.getBoundingClientRect(), S = 8, M = Math.max(4, f.left - S), y = Math.max(4, f.top - S), P = Math.min(window.innerWidth - 8, f.width + S * 2) - Math.max(0, 4 - (f.left - S)), A = Math.min(f.height + S * 2, window.innerHeight - 8);
202
- N({ x: M, y, w: P, h: A });
203
- }, [u.target]);
204
- $(() => {
205
- const f = [setTimeout(() => {
206
- const S = document.querySelector(`[data-tour="${u.target}"]`);
207
- S && S.scrollIntoView({ block: "center", behavior: "smooth" });
208
- }, 60), ...[0, 120, 300, 550, 800].map((S) => setTimeout(m, S))];
209
- return () => f.forEach(clearTimeout);
210
- }, [t, m, u.target]), $(() => (window.addEventListener("resize", m), window.addEventListener("scroll", m, !0), () => {
211
- window.removeEventListener("resize", m), window.removeEventListener("scroll", m, !0);
212
- }), [m]), oe(() => {
213
- T.current && l({ w: T.current.offsetWidth, h: T.current.offsetHeight });
214
- }, [t, h.w]), $(() => {
215
- const r = (f) => {
216
- f.key === "ArrowRight" ? (f.preventDefault(), i()) : f.key === "ArrowLeft" ? (f.preventDefault(), s()) : f.key === "Escape" && o();
835
+ const S = k.getBoundingClientRect(), $ = 8, T = 4, m = Math.max(T, S.left - $), W = Math.max(T, S.top - $), D = Math.min(window.innerWidth - T, S.right + $), F = Math.min(window.innerHeight - T, S.bottom + $);
836
+ p({ x: m, y: W, w: Math.max(0, D - m), h: Math.max(0, F - W) });
837
+ }, [c.target]);
838
+ P(() => {
839
+ const S = [
840
+ setTimeout(() => {
841
+ const $ = document.querySelector(`[data-tour="${c.target}"]`);
842
+ $ && $.scrollIntoView({ block: "center", behavior: "smooth" });
843
+ }, 60),
844
+ ...[0, 120, 300, 550, 800].map(($) => setTimeout(f, $))
845
+ ];
846
+ return () => S.forEach(clearTimeout);
847
+ }, [e, f, c.target]), P(() => (window.addEventListener("resize", f), window.addEventListener("scroll", f, !0), () => {
848
+ window.removeEventListener("resize", f), window.removeEventListener("scroll", f, !0);
849
+ }), [f]), it(() => {
850
+ d.current && h({
851
+ w: d.current.offsetWidth,
852
+ h: d.current.offsetHeight
853
+ });
854
+ }, [e, g.w]), P(() => {
855
+ const k = (S) => {
856
+ S.key === "ArrowRight" ? (S.preventDefault(), s()) : S.key === "ArrowLeft" ? (S.preventDefault(), a()) : S.key === "Escape" && o();
217
857
  };
218
- return window.addEventListener("keydown", r), () => window.removeEventListener("keydown", r);
219
- }, [i, s, o]), $(() => {
220
- var r;
221
- (r = T.current) == null || r.focus({ preventScroll: !0 });
222
- }, [t]);
223
- const p = g || { x: h.w / 2, y: h.h / 2, w: 0, h: 0 }, q = `polygon(0 0, 0 100%, ${p.x}px 100%, ${p.x}px ${p.y}px, ${p.x + p.w}px ${p.y}px, ${p.x + p.w}px ${p.y + p.h}px, ${p.x}px ${p.y + p.h}px, ${p.x}px 100%, 100% 100%, 100% 0)`, w = 14, k = 16, O = h.w < 700, E = Math.min(360, h.w - w * 2), c = d.h;
224
- let W = { left: (h.w - E) / 2, top: Math.max(w, (h.h - c) / 2) };
225
- if (g) {
226
- const r = g.x + g.w / 2 - E / 2, f = g.y + g.h / 2 - c / 2, S = (I) => Math.min(Math.max(w, I), h.w - E - w), M = (I) => Math.min(Math.max(w, I), h.h - c - w), y = {
227
- right: { ok: g.x + g.w + k + E <= h.w - w, left: g.x + g.w + k, top: M(f) },
228
- left: { ok: g.x - k - E >= w, left: g.x - k - E, top: M(f) },
229
- bottom: { ok: g.y + g.h + k + c <= h.h - w, left: S(r), top: g.y + g.h + k },
230
- top: { ok: g.y - k - c >= w, left: S(r), top: g.y - k - c }
231
- }, A = (O ? ["bottom", "top"] : [u.place, "right", "left", "bottom", "top"]).find((I) => y[I].ok);
232
- W = A ? { left: y[A].left, top: y[A].top } : { left: O ? (h.w - E) / 2 : h.w - E - w, top: h.h - c - w };
233
- }
234
- const D = t === 0, x = t === a - 1;
235
- return /* @__PURE__ */ n("div", { className: "tour-root", role: "dialog", "aria-modal": "true", "aria-labelledby": "tour-title", children: [
236
- /* @__PURE__ */ e("div", { className: "tour-dim", style: { clipPath: q, WebkitClipPath: q }, onClick: (r) => r.stopPropagation() }),
237
- g && /* @__PURE__ */ e("div", { className: "tour-ring", style: { left: g.x, top: g.y, width: g.w, height: g.h } }),
238
- /* @__PURE__ */ n("div", { className: "tour-tip", ref: T, tabIndex: -1, style: { width: E, left: W.left, top: W.top }, children: [
239
- /* @__PURE__ */ n("div", { className: "tip-head", children: [
240
- /* @__PURE__ */ n("span", { className: "counter", "aria-live": "polite", children: [
241
- t + 1,
242
- "/",
243
- a
244
- ] }),
245
- /* @__PURE__ */ e("button", { className: "xbtn", onClick: o, "aria-label": "Close tutorial", children: "×" })
246
- ] }),
247
- /* @__PURE__ */ n("div", { className: "tip-body", children: [
248
- /* @__PURE__ */ e("h2", { id: "tour-title", children: u.title }),
249
- /* @__PURE__ */ e("p", { children: u.body }),
250
- u.legend && /* @__PURE__ */ n("div", { className: "legend", children: [
251
- /* @__PURE__ */ e("span", { className: "lvl ERROR", children: "ERROR" }),
252
- /* @__PURE__ */ e("span", { className: "lvl WARN", children: "WARN" }),
253
- /* @__PURE__ */ e("span", { className: "lvl INFO", children: "INFO" }),
254
- /* @__PURE__ */ e("span", { className: "lvl DEBUG", children: "DEBUG" })
255
- ] }),
256
- u.legend && /* @__PURE__ */ e("p", { style: { marginTop: 8, fontSize: 12, color: "#a1a1aa" }, children: "ERROR: something failed. WARN: something unusual, but it kept going. INFO: normal events. DEBUG: developer detail." })
257
- ] }, t),
258
- /* @__PURE__ */ e("div", { className: "dots", children: Array.from({ length: a }, (r, f) => /* @__PURE__ */ e("i", { className: f <= t ? "on" : "" }, f)) }),
259
- /* @__PURE__ */ n("div", { className: "tip-foot", children: [
260
- /* @__PURE__ */ e("button", { className: "btn ghost", onClick: s, disabled: D, children: "← Back" }),
261
- /* @__PURE__ */ e("span", { className: "sp" }),
262
- x && /* @__PURE__ */ e("button", { className: "btn", onClick: o, children: "Finish" }),
263
- /* @__PURE__ */ e("button", { className: x ? "btn ghost" : "btn", onClick: i, disabled: x, children: "Next →" })
264
- ] }),
265
- /* @__PURE__ */ n("div", { className: "kbd", children: [
266
- /* @__PURE__ */ e("kbd", { children: "←" }),
267
- " ",
268
- /* @__PURE__ */ e("kbd", { children: "→" }),
269
- " to navigate · ",
270
- /* @__PURE__ */ e("kbd", { children: "Esc" }),
271
- " to close"
272
- ] })
273
- ] })
274
- ] });
858
+ return window.addEventListener("keydown", k), () => window.removeEventListener("keydown", k);
859
+ }, [s, a, o]), P(() => {
860
+ var k;
861
+ (k = d.current) == null || k.focus({ preventScroll: !0 });
862
+ }, [e]);
863
+ const v = r || { x: g.w / 2, y: g.h / 2, w: 0, h: 0 }, _ = `polygon(0 0, 0 100%, ${v.x}px 100%, ${v.x}px ${v.y}px, ${v.x + v.w}px ${v.y}px, ${v.x + v.w}px ${v.y + v.h}px, ${v.x}px ${v.y + v.h}px, ${v.x}px 100%, 100% 100%, 100% 0)`, N = 14, M = 16, E = g.w < 700, I = Math.min(360, g.w - N * 2), w = l.h;
864
+ let b = { left: (g.w - I) / 2, top: Math.max(N, (g.h - w) / 2) };
865
+ if (r) {
866
+ const k = r.x + r.w / 2 - I / 2, S = r.y + r.h / 2 - w / 2, $ = (F) => Math.min(Math.max(N, F), g.w - I - N), T = (F) => Math.min(Math.max(N, F), g.h - w - N), m = {
867
+ right: {
868
+ ok: r.x + r.w + M + I <= g.w - N,
869
+ left: r.x + r.w + M,
870
+ top: T(S)
871
+ },
872
+ left: {
873
+ ok: r.x - M - I >= N,
874
+ left: r.x - M - I,
875
+ top: T(S)
876
+ },
877
+ bottom: {
878
+ ok: r.y + r.h + M + w <= g.h - N,
879
+ left: $(k),
880
+ top: r.y + r.h + M
881
+ },
882
+ top: {
883
+ ok: r.y - M - w >= N,
884
+ left: $(k),
885
+ top: r.y - M - w
886
+ }
887
+ }, D = (E ? ["bottom", "top"] : [c.place, "right", "left", "bottom", "top"]).find((F) => m[F].ok);
888
+ b = D ? { left: m[D].left, top: m[D].top } : { left: E ? (g.w - I) / 2 : g.w - I - N, top: g.h - w - N };
889
+ }
890
+ const R = e === 0, L = e === n - 1;
891
+ return /* @__PURE__ */ i(
892
+ "div",
893
+ {
894
+ className: "tour-root",
895
+ role: "dialog",
896
+ "aria-modal": "true",
897
+ "aria-labelledby": "tour-title",
898
+ children: [
899
+ /* @__PURE__ */ t(
900
+ "div",
901
+ {
902
+ className: "tour-dim",
903
+ style: { clipPath: _, WebkitClipPath: _ },
904
+ onClick: (k) => k.stopPropagation()
905
+ }
906
+ ),
907
+ r && /* @__PURE__ */ t(
908
+ "div",
909
+ {
910
+ className: "tour-ring",
911
+ style: { left: r.x, top: r.y, width: r.w, height: r.h }
912
+ }
913
+ ),
914
+ /* @__PURE__ */ i(
915
+ "div",
916
+ {
917
+ className: "tour-tip",
918
+ ref: d,
919
+ tabIndex: -1,
920
+ style: { width: I, left: b.left, top: b.top },
921
+ children: [
922
+ /* @__PURE__ */ i("div", { className: "tip-head", children: [
923
+ /* @__PURE__ */ i("span", { className: "counter", "aria-live": "polite", children: [
924
+ e + 1,
925
+ "/",
926
+ n
927
+ ] }),
928
+ /* @__PURE__ */ t(
929
+ "button",
930
+ {
931
+ className: "xbtn",
932
+ onClick: o,
933
+ "aria-label": "Close tutorial",
934
+ children: "×"
935
+ }
936
+ )
937
+ ] }),
938
+ /* @__PURE__ */ i("div", { className: "tip-body", children: [
939
+ /* @__PURE__ */ t("h2", { id: "tour-title", children: c.title }),
940
+ /* @__PURE__ */ t("p", { children: c.body }),
941
+ c.legend && /* @__PURE__ */ i(B, { children: [
942
+ /* @__PURE__ */ i("div", { className: "legend", children: [
943
+ /* @__PURE__ */ t("span", { className: "lvl ERROR", children: "ERROR" }),
944
+ /* @__PURE__ */ t("span", { className: "lvl WARN", children: "WARN" }),
945
+ /* @__PURE__ */ t("span", { className: "lvl INFO", children: "INFO" }),
946
+ /* @__PURE__ */ t("span", { className: "lvl DEBUG", children: "DEBUG" })
947
+ ] }),
948
+ /* @__PURE__ */ t("p", { style: { marginTop: 8, fontSize: 12, color: "#a1a1aa" }, children: "ERROR: something failed. WARN: something unusual, but it kept going. INFO: normal events. DEBUG: developer detail." })
949
+ ] })
950
+ ] }, e),
951
+ /* @__PURE__ */ t("div", { className: "dots", children: Array.from({ length: n }, (k, S) => /* @__PURE__ */ t("i", { className: S <= e ? "on" : "" }, S)) }),
952
+ /* @__PURE__ */ i("div", { className: "tip-foot", children: [
953
+ /* @__PURE__ */ t("button", { className: "btn ghost", onClick: a, disabled: R, children: "← Back" }),
954
+ /* @__PURE__ */ t("span", { className: "sp" }),
955
+ L && /* @__PURE__ */ t("button", { className: "btn", onClick: o, children: "Finish" }),
956
+ /* @__PURE__ */ t(
957
+ "button",
958
+ {
959
+ className: L ? "btn ghost" : "btn",
960
+ onClick: s,
961
+ disabled: L,
962
+ children: "Next →"
963
+ }
964
+ )
965
+ ] }),
966
+ /* @__PURE__ */ i("div", { className: "kbd", children: [
967
+ /* @__PURE__ */ t("kbd", { children: "←" }),
968
+ " ",
969
+ /* @__PURE__ */ t("kbd", { children: "→" }),
970
+ " to navigate · ",
971
+ /* @__PURE__ */ t("kbd", { children: "Esc" }),
972
+ " to close"
973
+ ] })
974
+ ]
975
+ }
976
+ )
977
+ ]
978
+ }
979
+ );
275
980
  }
276
- let re = !1;
277
- const Se = ({ autoStart: t = !0 }) => {
278
- const [a, i] = j("login"), [s, o] = j("ALL"), [u, T] = j(""), [g, N] = j(null), [d, l] = j(!1), [h, b] = j(0), m = { setFile: i, setLevel: o, setQuery: T, setSel: N }, p = se[a].lines, q = ae(
279
- () => p.map((r, f) => ({ ...r, i: f })).filter((r) => (s === "ALL" || r.l === s) && r.m.toLowerCase().includes(u.toLowerCase())),
280
- [p, s, u]
281
- ), w = (r) => p.filter((f) => f.l === r).length, k = g != null ? p[g] : null, O = F((r) => {
282
- b(r), Y[r].enter(m);
283
- }, []), E = () => {
284
- O(0), l(!0);
285
- }, c = F(() => b((r) => r >= Y.length - 1 ? r : (Y[r + 1].enter(m), r + 1)), []), W = F(() => b((r) => r <= 0 ? r : (Y[r - 1].enter(m), r - 1)), []), D = F(() => l(!1), []);
286
- $(() => {
287
- if (!t || re) return;
288
- const r = setTimeout(() => {
289
- re = !0, E();
981
+ let nt = !1;
982
+ const on = ({
983
+ autoStart: e = !0
984
+ }) => {
985
+ const [n, s] = x("console"), [a, o] = x("ALL"), [c, d] = x(""), [r, p] = x(null), l = Jt(), [h, g] = x(!1), [u, f] = x(0), v = q(0), _ = te(
986
+ () => ({ setFile: s, setLevel: o, setQuery: d, setSel: p }),
987
+ []
988
+ ), N = te(
989
+ () => Wt(l).map((m) => ({
990
+ key: m.key,
991
+ name: m.name,
992
+ lines: l.filter(m.match)
993
+ })),
994
+ [l]
995
+ ), M = N.find((m) => m.key === n) ?? N[0], E = M.lines, I = te(
996
+ () => E.map((m, W) => ({ ...m, i: W })).filter(
997
+ (m) => (a === "ALL" || m.l === a) && m.m.toLowerCase().includes(c.toLowerCase())
998
+ ),
999
+ [E, a, c]
1000
+ ), w = (m) => E.filter((W) => W.l === m).length, b = r === "auto" ? [...E].reverse().find((m) => m.l === "ERROR") ?? E[E.length - 1] ?? null : r != null ? E.find((m) => m.id === r) ?? null : null, R = H(
1001
+ (m) => {
1002
+ v.current = m, f(m), Ne[m].enter(_);
1003
+ },
1004
+ [_]
1005
+ ), L = H(() => {
1006
+ v.current < Ne.length - 1 && R(v.current + 1);
1007
+ }, [R]), k = H(() => {
1008
+ v.current > 0 && R(v.current - 1);
1009
+ }, [R]), S = H(() => g(!1), []), $ = H(() => {
1010
+ R(0), g(!0);
1011
+ }, [R]);
1012
+ P(() => {
1013
+ if (!e || nt) return;
1014
+ const m = setTimeout(() => {
1015
+ nt = !0, $();
290
1016
  }, 600);
291
- return () => clearTimeout(r);
292
- }, []);
293
- const x = (r) => {
294
- i(r), o("ALL"), T(""), N(null);
1017
+ return () => clearTimeout(m);
1018
+ }, [e, $]);
1019
+ const T = (m) => {
1020
+ s(m), o("ALL"), d(""), p(null);
295
1021
  };
296
- return /* @__PURE__ */ e("div", { className: "lg-root", children: /* @__PURE__ */ n("div", { className: "app", children: [
297
- /* @__PURE__ */ n("div", { className: "top", children: [
298
- /* @__PURE__ */ n("div", { className: "brand", children: [
1022
+ return /* @__PURE__ */ t("div", { className: "lg-root", children: /* @__PURE__ */ i("div", { className: "app", children: [
1023
+ /* @__PURE__ */ i("div", { className: "top", children: [
1024
+ /* @__PURE__ */ i("div", { className: "brand", children: [
299
1025
  "pulse",
300
- /* @__PURE__ */ e("span", { children: ".logs" })
1026
+ /* @__PURE__ */ t("span", { children: ".logs" })
301
1027
  ] }),
302
- /* @__PURE__ */ e("button", { className: "btn", onClick: E, children: "▶ Start tutorial" })
1028
+ /* @__PURE__ */ t("button", { className: "btn", onClick: $, children: "▶ Start tutorial" })
303
1029
  ] }),
304
- /* @__PURE__ */ n("div", { className: "viewer", children: [
305
- /* @__PURE__ */ n("div", { className: "titlebar", "data-tour": "titlebar", children: [
306
- /* @__PURE__ */ n("div", { children: [
307
- /* @__PURE__ */ e("h1", { children: "Log Viewer" }),
308
- /* @__PURE__ */ e("small", { children: "Inspect application errors, warnings and debug output" })
1030
+ /* @__PURE__ */ i("div", { className: "viewer", children: [
1031
+ /* @__PURE__ */ i("div", { className: "titlebar", "data-tour": "titlebar", children: [
1032
+ /* @__PURE__ */ i("div", { children: [
1033
+ /* @__PURE__ */ t("h1", { children: "Log Viewer" }),
1034
+ /* @__PURE__ */ t("small", { children: "Inspect application errors, warnings and debug output" })
309
1035
  ] }),
310
- /* @__PURE__ */ e("span", { className: "badge", children: "SAMPLE DATA" })
1036
+ /* @__PURE__ */ i("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
1037
+ /* @__PURE__ */ t(
1038
+ "button",
1039
+ {
1040
+ className: "btn ghost",
1041
+ onClick: () => {
1042
+ zt(), p(null);
1043
+ },
1044
+ children: "Clear"
1045
+ }
1046
+ ),
1047
+ /* @__PURE__ */ i("span", { className: "badge live", children: [
1048
+ /* @__PURE__ */ t("i", { className: "dot" }),
1049
+ "LIVE"
1050
+ ] })
1051
+ ] })
311
1052
  ] }),
312
- /* @__PURE__ */ n("div", { className: "layout", children: [
313
- /* @__PURE__ */ n("aside", { className: "files", "data-tour": "files", children: [
314
- /* @__PURE__ */ e("h3", { children: "Log files" }),
315
- Object.entries(se).map(([r, f]) => /* @__PURE__ */ n("button", { className: `file mono ${a === r ? "on" : ""}`, onClick: () => x(r), children: [
316
- /* @__PURE__ */ e("span", { children: "📄" }),
317
- f.name,
318
- /* @__PURE__ */ e("span", { className: "n", children: f.lines.length })
319
- ] }, r))
1053
+ /* @__PURE__ */ i("div", { className: "layout", children: [
1054
+ /* @__PURE__ */ i("aside", { className: "files", "data-tour": "files", children: [
1055
+ /* @__PURE__ */ t("h3", { children: "Log files" }),
1056
+ N.map((m) => /* @__PURE__ */ i(
1057
+ "button",
1058
+ {
1059
+ className: `file mono ${n === m.key ? "on" : ""}`,
1060
+ onClick: () => T(m.key),
1061
+ children: [
1062
+ /* @__PURE__ */ t("span", { children: "📄" }),
1063
+ m.name,
1064
+ /* @__PURE__ */ t("span", { className: "n", children: m.lines.length })
1065
+ ]
1066
+ },
1067
+ m.key
1068
+ ))
320
1069
  ] }),
321
- /* @__PURE__ */ n("section", { className: "main", children: [
322
- /* @__PURE__ */ n("div", { className: "summary", "data-tour": "summary", children: [
323
- /* @__PURE__ */ n("div", { className: "stat e", children: [
324
- /* @__PURE__ */ e("b", { children: w("ERROR") }),
325
- /* @__PURE__ */ e("span", { children: "Errors" })
1070
+ /* @__PURE__ */ i("section", { className: "main", children: [
1071
+ /* @__PURE__ */ t(sn, {}),
1072
+ /* @__PURE__ */ i("div", { className: "summary", "data-tour": "summary", children: [
1073
+ /* @__PURE__ */ i("div", { className: "stat e", children: [
1074
+ /* @__PURE__ */ t("b", { children: w("ERROR") }),
1075
+ /* @__PURE__ */ t("span", { children: "Errors" })
326
1076
  ] }),
327
- /* @__PURE__ */ n("div", { className: "stat w", children: [
328
- /* @__PURE__ */ e("b", { children: w("WARN") }),
329
- /* @__PURE__ */ e("span", { children: "Warnings" })
1077
+ /* @__PURE__ */ i("div", { className: "stat w", children: [
1078
+ /* @__PURE__ */ t("b", { children: w("WARN") }),
1079
+ /* @__PURE__ */ t("span", { children: "Warnings" })
330
1080
  ] }),
331
- /* @__PURE__ */ n("div", { className: "stat", children: [
332
- /* @__PURE__ */ e("b", { children: p.length }),
333
- /* @__PURE__ */ e("span", { children: "Total lines" })
1081
+ /* @__PURE__ */ i("div", { className: "stat", children: [
1082
+ /* @__PURE__ */ t("b", { children: E.length }),
1083
+ /* @__PURE__ */ t("span", { children: "Total lines" })
334
1084
  ] })
335
1085
  ] }),
336
- /* @__PURE__ */ n("div", { className: "filters", "data-tour": "filters", children: [
337
- Ne.map((r) => /* @__PURE__ */ n("button", { className: `chip ${s === r ? "on" : ""}`, onClick: () => {
338
- o(r), N(null);
339
- }, children: [
340
- r === "ALL" ? "All" : r[0] + r.slice(1).toLowerCase(),
341
- r !== "ALL" && ` (${w(r)})`
342
- ] }, r)),
343
- /* @__PURE__ */ e("input", { className: "search", placeholder: "Search logs…", value: u, onChange: (r) => T(r.target.value), "aria-label": "Search logs" })
1086
+ /* @__PURE__ */ i("div", { className: "filters", "data-tour": "filters", children: [
1087
+ Ft.map((m) => /* @__PURE__ */ i(
1088
+ "button",
1089
+ {
1090
+ className: `chip tag ${m} ${a === m ? "on" : ""}`,
1091
+ onClick: () => {
1092
+ o(m), p(null);
1093
+ },
1094
+ children: [
1095
+ /* @__PURE__ */ t("i", { className: "dot" }),
1096
+ m === "ALL" ? "All" : m[0] + m.slice(1).toLowerCase(),
1097
+ /* @__PURE__ */ t("em", { className: "cnt", children: m === "ALL" ? E.length : w(m) })
1098
+ ]
1099
+ },
1100
+ m
1101
+ )),
1102
+ /* @__PURE__ */ t(
1103
+ "input",
1104
+ {
1105
+ className: "search",
1106
+ placeholder: "Search logs…",
1107
+ value: c,
1108
+ onChange: (m) => d(m.target.value),
1109
+ "aria-label": "Search logs"
1110
+ }
1111
+ )
344
1112
  ] }),
345
- /* @__PURE__ */ n("div", { className: "logpane mono", "data-tour": "logpane", children: [
346
- /* @__PURE__ */ n("div", { className: "head", children: [
347
- se[a].name,
1113
+ /* @__PURE__ */ i("div", { className: "logpane mono", "data-tour": "logpane", children: [
1114
+ /* @__PURE__ */ i("div", { className: "head", children: [
1115
+ M.name,
348
1116
  " · ",
349
- q.length,
1117
+ I.length,
350
1118
  " line",
351
- q.length !== 1 && "s"
1119
+ I.length !== 1 && "s"
352
1120
  ] }),
353
- q.length === 0 && /* @__PURE__ */ e("div", { className: "empty", children: "No lines match this filter." }),
354
- q.map((r) => /* @__PURE__ */ n("button", { className: `line ${g === r.i ? "sel" : ""}`, onClick: () => N(r.i), children: [
355
- /* @__PURE__ */ e("span", { className: "ln", children: r.i + 1 }),
356
- /* @__PURE__ */ e("span", { className: "ts", children: r.t }),
357
- /* @__PURE__ */ e("span", { className: `lvl ${r.l}`, children: r.l }),
358
- /* @__PURE__ */ e("span", { className: "msg", "data-lvl": r.l, children: r.m })
359
- ] }, r.i))
1121
+ I.length === 0 && /* @__PURE__ */ t("div", { className: "empty", children: E.length === 0 ? "No console output captured yet. New console.log, warn, error and debug calls appear here live." : "No lines match this filter." }),
1122
+ I.map((m) => /* @__PURE__ */ i(
1123
+ "button",
1124
+ {
1125
+ className: `line ${(b == null ? void 0 : b.id) === m.id ? "sel" : ""}`,
1126
+ onClick: () => p(m.id),
1127
+ children: [
1128
+ /* @__PURE__ */ t("span", { className: "ln", children: m.i + 1 }),
1129
+ /* @__PURE__ */ t("span", { className: "ts", title: new Date(m.at).toISOString(), children: m.t }),
1130
+ /* @__PURE__ */ t("span", { className: `lvl ${m.l}`, children: m.l }),
1131
+ /* @__PURE__ */ t("span", { className: "msg", "data-lvl": m.l, children: m.m })
1132
+ ]
1133
+ },
1134
+ m.id
1135
+ ))
360
1136
  ] })
361
1137
  ] }),
362
- /* @__PURE__ */ n("aside", { className: "details", "data-tour": "details", children: [
363
- /* @__PURE__ */ e("h3", { children: "Details" }),
364
- !k && /* @__PURE__ */ e("div", { className: "placeholder", children: "Select a log line to see what it means and how to fix it." }),
365
- k && /* @__PURE__ */ n(V, { children: [
366
- /* @__PURE__ */ n("div", { className: "box", children: [
367
- /* @__PURE__ */ e("b", { children: "Message" }),
368
- /* @__PURE__ */ e("span", { className: `lvl ${k.l}`, style: { marginRight: 6 }, children: k.l }),
369
- k.m
1138
+ /* @__PURE__ */ i("aside", { className: "details", "data-tour": "details", children: [
1139
+ /* @__PURE__ */ t("h3", { children: "Details" }),
1140
+ !b && /* @__PURE__ */ t("div", { className: "placeholder", children: "Select a log line to see what it means and how to fix it." }),
1141
+ b && /* @__PURE__ */ i(B, { children: [
1142
+ /* @__PURE__ */ i("div", { className: "box", children: [
1143
+ /* @__PURE__ */ t("b", { children: "Message" }),
1144
+ /* @__PURE__ */ t(
1145
+ "span",
1146
+ {
1147
+ className: `lvl ${b.l}`,
1148
+ style: { marginRight: 6 },
1149
+ children: b.l
1150
+ }
1151
+ ),
1152
+ b.m
370
1153
  ] }),
371
- /* @__PURE__ */ n("div", { className: "box", children: [
372
- /* @__PURE__ */ e("b", { children: "What it means" }),
373
- k.d.meaning
1154
+ /* @__PURE__ */ i("div", { className: "box", children: [
1155
+ /* @__PURE__ */ t("b", { children: "What it means" }),
1156
+ Ue[b.l].meaning
374
1157
  ] }),
375
- /* @__PURE__ */ n("div", { className: "box", children: [
376
- /* @__PURE__ */ e("b", { children: "Suggested fix" }),
377
- k.d.fix
1158
+ /* @__PURE__ */ i("div", { className: "box", children: [
1159
+ /* @__PURE__ */ t("b", { children: "Suggested fix" }),
1160
+ Ue[b.l].fix
378
1161
  ] }),
379
- k.d.stack && /* @__PURE__ */ n("div", { className: "box", children: [
380
- /* @__PURE__ */ e("b", { children: "Stack trace" }),
381
- /* @__PURE__ */ e("pre", { className: "mono", children: k.d.stack })
1162
+ b.stack && /* @__PURE__ */ i("div", { className: "box", children: [
1163
+ /* @__PURE__ */ t("b", { children: "Stack trace" }),
1164
+ /* @__PURE__ */ t("pre", { className: "mono", children: b.stack })
382
1165
  ] })
383
1166
  ] })
384
1167
  ] })
385
1168
  ] })
386
1169
  ] }),
387
- d && /* @__PURE__ */ e(ke, { step: h, total: Y.length, onNext: c, onBack: W, onClose: D })
1170
+ h && /* @__PURE__ */ t(
1171
+ an,
1172
+ {
1173
+ step: u,
1174
+ total: Ne.length,
1175
+ onNext: L,
1176
+ onBack: k,
1177
+ onClose: S
1178
+ }
1179
+ )
1180
+ ] }) });
1181
+ }, gt = Le("heatmap"), fe = 20, ee = 10, rn = 250, ln = 5e3, cn = 3e3, qe = "pulseLogs.heatmap.v1", dn = (e) => ({
1182
+ path: e,
1183
+ visits: 0,
1184
+ activeMs: 0,
1185
+ docW: 0,
1186
+ docH: 0,
1187
+ maxScrollPct: 0,
1188
+ cells: {},
1189
+ clicks: {},
1190
+ clickCount: 0,
1191
+ bands: Array(ee).fill(0),
1192
+ bandReach: Array(ee).fill(0),
1193
+ elements: {},
1194
+ updatedAt: Date.now()
1195
+ });
1196
+ let Y = (() => {
1197
+ try {
1198
+ return JSON.parse(localStorage.getItem(qe) || "{}");
1199
+ } catch {
1200
+ return {};
1201
+ }
1202
+ })(), Ye = Y;
1203
+ const xe = /* @__PURE__ */ new Set();
1204
+ let Oe = null, We = null;
1205
+ const ft = () => {
1206
+ Oe || (Oe = setTimeout(() => {
1207
+ Oe = null, Ye = { ...Y }, xe.forEach((e) => e());
1208
+ }, 1e3));
1209
+ }, st = (e, n) => {
1210
+ const s = Object.keys(e);
1211
+ s.length <= n || s.sort((a, o) => e[a] - e[o]).slice(0, s.length - Math.floor(n / 2)).forEach((a) => delete e[a]);
1212
+ }, wt = () => {
1213
+ We = null, Object.values(Y).forEach((e) => {
1214
+ st(e.cells, 6e3), st(e.clicks, 3e3);
1215
+ const n = Object.entries(e.elements);
1216
+ n.length > 200 && (e.elements = Object.fromEntries(n.sort((s, a) => a[1].ms - s[1].ms).slice(0, 100)));
1217
+ });
1218
+ try {
1219
+ localStorage.setItem(qe, JSON.stringify(Y));
1220
+ } catch {
1221
+ }
1222
+ }, vt = () => {
1223
+ We || (We = setTimeout(wt, 2e3));
1224
+ }, at = () => Ye, hn = () => {
1225
+ Y = {}, Ye = {}, z = null;
1226
+ try {
1227
+ localStorage.removeItem(qe);
1228
+ } catch {
1229
+ }
1230
+ xe.forEach((e) => e());
1231
+ }, un = () => Me((e) => (xe.add(e), () => {
1232
+ xe.delete(e);
1233
+ }), at, at), mn = (e, n = 40) => e.length > n ? e.slice(0, n) + "…" : e, pn = (e) => {
1234
+ const n = e.closest('button, a, [role="button"], input, select, textarea, h1, h2, h3, h4, [data-track]') || e, s = [];
1235
+ let a = n, o = 0;
1236
+ for (; a && a.tagName.toLowerCase() !== "body" && o < 3; ) {
1237
+ let r = a.tagName.toLowerCase();
1238
+ const p = a.getAttribute("data-testid");
1239
+ if (p) {
1240
+ s.unshift(`${r}[data-testid="${p}"]`);
1241
+ break;
1242
+ }
1243
+ if (a.id) {
1244
+ s.unshift(`${r}#${a.id}`);
1245
+ break;
1246
+ }
1247
+ const l = typeof a.className == "string" ? a.className.trim().split(/\s+/).filter(Boolean).slice(0, 2).join(".") : "";
1248
+ s.unshift(l ? `${r}.${l}` : r), a = a.parentElement, o++;
1249
+ }
1250
+ const c = n.tagName.toLowerCase(), d = ["input", "textarea", "select"].includes(c) ? n.getAttribute("aria-label") || n.getAttribute("name") || n.getAttribute("placeholder") || "" : n.getAttribute("aria-label") || n.innerText || "";
1251
+ return { key: s.join(" > ") || c, text: mn(d.trim().replace(/\s+/g, " ")) };
1252
+ }, _e = (e) => !e || !!e.closest("[data-heatmap-ignore]");
1253
+ let z = null, bt = Date.now(), Z = null, Ee = Date.now(), yt = !1;
1254
+ const ot = (e) => {
1255
+ yt = e, Ee = Date.now();
1256
+ }, Nt = (e) => {
1257
+ const n = Object.entries(e.elements).sort((a, o) => o[1].ms - a[1].ms)[0], s = e.bands.indexOf(Math.max(...e.bands));
1258
+ gt.info(`${e.path}: active ${Math.round(e.activeMs / 1e3)}s, max scroll ${Math.round(e.maxScrollPct)}%, most time on page section ${s * 10}-${s * 10 + 10}%${n ? `, most hovered "${n[1].text || n[0]}" ${Math.round(n[1].ms / 1e3)}s` : ""}, clicks ${e.clickCount}`);
1259
+ }, kt = (e) => (Y[e] || (Y[e] = dn(e)), (!z || z.path !== e) && (z && Y[z.path] && Nt(Y[z.path]), z = { path: e, reached: /* @__PURE__ */ new Set() }, Y[e].visits += 1), Y[e]), gn = () => {
1260
+ const e = Date.now(), n = Math.min(e - Ee, 500);
1261
+ if (Ee = e, yt || document.visibilityState !== "visible" || e - bt > ln) return;
1262
+ const s = kt(window.location.pathname);
1263
+ s.activeMs += n, s.updatedAt = e;
1264
+ const a = document.documentElement.scrollWidth, o = Math.max(document.documentElement.scrollHeight, window.innerHeight);
1265
+ s.docW = Math.max(s.docW, a), s.docH = o;
1266
+ const c = window.scrollY, d = window.innerHeight, r = Math.min(ee - 1, Math.floor((c + d / 2) / o * ee));
1267
+ s.bands[r] += n;
1268
+ const p = Math.min(100, (c + d) / o * 100);
1269
+ s.maxScrollPct = Math.max(s.maxScrollPct, p);
1270
+ const l = Math.min(ee - 1, Math.floor((c + d) / o * ee - 1e-4));
1271
+ for (let h = 0; h <= l; h++) z.reached.has(h) || (z.reached.add(h), s.bandReach[h] += 1);
1272
+ if (Z && e - Z.at < cn) {
1273
+ const h = document.elementFromPoint(Z.x, Z.y);
1274
+ if (h && !_e(h)) {
1275
+ const g = `${Math.floor((Z.x + window.scrollX) / fe)},${Math.floor((Z.y + window.scrollY) / fe)}`;
1276
+ s.cells[g] = (s.cells[g] || 0) + n;
1277
+ const u = pn(h), f = s.elements[u.key] || (s.elements[u.key] = { ms: 0, text: u.text });
1278
+ f.ms += n, u.text && (f.text = u.text);
1279
+ }
1280
+ }
1281
+ ft(), vt();
1282
+ };
1283
+ function St() {
1284
+ if (typeof window > "u" || window.__pulseHeatmap) return;
1285
+ window.__pulseHeatmap = !0;
1286
+ const e = () => {
1287
+ bt = Date.now();
1288
+ };
1289
+ window.addEventListener("mousemove", (s) => {
1290
+ _e(s.target) || (Z = { x: s.clientX, y: s.clientY, at: Date.now() }, e());
1291
+ }, { passive: !0 }), document.addEventListener("mouseleave", () => {
1292
+ Z = null;
1293
+ }), window.addEventListener("scroll", e, { passive: !0, capture: !0 }), window.addEventListener("keydown", e), window.addEventListener("touchstart", e, { passive: !0 }), document.addEventListener("click", (s) => {
1294
+ e();
1295
+ const a = s.target;
1296
+ if (!a || !(a instanceof Element) || _e(a)) return;
1297
+ const o = kt(window.location.pathname), c = `${Math.floor((s.clientX + window.scrollX) / fe)},${Math.floor((s.clientY + window.scrollY) / fe)}`;
1298
+ o.clicks[c] = (o.clicks[c] || 0) + 1, o.clickCount += 1, ft(), vt();
1299
+ }, !0);
1300
+ const n = () => {
1301
+ z && Y[z.path] && Nt(Y[z.path]), wt();
1302
+ };
1303
+ window.addEventListener("pagehide", n), document.addEventListener("visibilitychange", () => {
1304
+ document.visibilityState === "hidden" ? n() : Ee = Date.now();
1305
+ }), setInterval(gn, rn), gt.info("Heatmap capture started (mouse, clicks, scroll, time per section)");
1306
+ }
1307
+ const ae = fe * 2;
1308
+ function xt(e, n) {
1309
+ const s = n === "time" ? e.cells : e.clicks, a = /* @__PURE__ */ new Map();
1310
+ for (const [d, r] of Object.entries(s)) {
1311
+ const [p, l] = d.split(",").map(Number), h = `${Math.floor(p / 2)},${Math.floor(l / 2)}`;
1312
+ a.set(h, (a.get(h) || 0) + r);
1313
+ }
1314
+ let o = 0;
1315
+ a.forEach((d) => {
1316
+ d > o && (o = d);
1317
+ });
1318
+ const c = [...a.entries()].sort((d, r) => r[1] - d[1]).slice(0, 3).map(([d, r]) => {
1319
+ const [p, l] = d.split(",").map(Number);
1320
+ return { x: p * ae, y: l * ae, v: r };
1321
+ });
1322
+ return { tiles: a, max: o, top: c };
1323
+ }
1324
+ const se = [[0, [40, 90, 255]], [0.33, [0, 200, 150]], [0.66, [255, 220, 0]], [1, [255, 50, 40]]], fn = (e) => {
1325
+ for (let n = 1; n < se.length; n++)
1326
+ if (e <= se[n][0]) {
1327
+ const [s, a] = se[n - 1], [o, c] = se[n], d = (e - s) / (o - s);
1328
+ return [0, 1, 2].map((r) => Math.round(a[r] + (c[r] - a[r]) * d));
1329
+ }
1330
+ return se[se.length - 1][1];
1331
+ }, wn = `linear-gradient(90deg, ${se.map(([e, n]) => `rgb(${n.join(",")}) ${e * 100}%`).join(", ")})`;
1332
+ function vn(e, n, s, a) {
1333
+ const o = Math.max(1, Math.round(n.docW * a)), c = Math.max(1, Math.round(n.docH * a));
1334
+ e.width = o, e.height = c;
1335
+ const d = e.getContext("2d");
1336
+ if (!d) return;
1337
+ d.clearRect(0, 0, o, c);
1338
+ const { tiles: r, max: p, top: l } = xt(n, s);
1339
+ if (!r.size) return;
1340
+ const h = ae * a;
1341
+ r.forEach((g, u) => {
1342
+ const [f, v] = u.split(",").map(Number), _ = Math.min(1, Math.sqrt(g / p)), [N, M, E] = fn(_);
1343
+ d.fillStyle = `rgba(${N},${M},${E},${0.3 + 0.65 * _})`, d.fillRect(f * h + 0.5, v * h + 0.5, h - 1, h - 1);
1344
+ }), l.forEach((g, u) => {
1345
+ const f = (g.x + ae / 2) * a, v = (g.y + ae / 2) * a;
1346
+ d.beginPath(), d.arc(f, v, 11, 0, Math.PI * 2), d.fillStyle = "#fff", d.fill(), d.lineWidth = 2, d.strokeStyle = "#0d0d12", d.stroke(), d.fillStyle = "#0d0d12", d.font = "bold 12px sans-serif", d.textAlign = "center", d.textBaseline = "middle", d.fillText(String(u + 1), f, v + 0.5);
1347
+ });
1348
+ }
1349
+ const he = (e) => {
1350
+ if (e > 0 && e < 1e4) return `${(e / 1e3).toFixed(1)}s`;
1351
+ const n = Math.round(e / 1e3);
1352
+ return n >= 60 ? `${Math.floor(n / 60)}m ${n % 60}s` : `${n}s`;
1353
+ }, bn = (e) => `${e * 100 / ee}-${(e + 1) * 100 / ee}%`, yn = () => {
1354
+ P(() => (St(), ot(!0), () => ot(!1)), []);
1355
+ const e = un(), n = te(() => Object.keys(e).sort((u, f) => e[f].activeMs - e[u].activeMs), [e]), [s, a] = x(""), [o, c] = x("time"), d = q(null), r = e[s] ?? e[n[0]];
1356
+ P(() => {
1357
+ !r || !d.current || !r.docW || vn(d.current, r, o, Math.min(1, 820 / r.docW));
1358
+ }, [r, o]);
1359
+ const p = te(() => r ? Object.entries(r.elements).sort((u, f) => f[1].ms - u[1].ms) : [], [r]), l = te(() => r ? xt(r, o) : null, [r, o]), h = r ? r.bands.indexOf(Math.max(...r.bands)) : 0, g = (u) => o === "time" ? he(u) : `${u} click${u === 1 ? "" : "s"}`;
1360
+ return /* @__PURE__ */ t("div", { className: "lg-root hm-root", "data-heatmap-ignore": !0, children: /* @__PURE__ */ i("div", { className: "app", children: [
1361
+ /* @__PURE__ */ t("div", { className: "top", children: /* @__PURE__ */ i("div", { className: "brand", children: [
1362
+ "pulse",
1363
+ /* @__PURE__ */ t("span", { children: ".heatmap" })
1364
+ ] }) }),
1365
+ /* @__PURE__ */ i("div", { className: "viewer", children: [
1366
+ /* @__PURE__ */ i("div", { className: "titlebar", children: [
1367
+ /* @__PURE__ */ i("div", { children: [
1368
+ /* @__PURE__ */ t("h1", { children: "Heatmap" }),
1369
+ /* @__PURE__ */ t("small", { children: "See where visitors spend time and click" })
1370
+ ] }),
1371
+ /* @__PURE__ */ i("div", { style: { display: "flex", gap: 8, alignItems: "center" }, children: [
1372
+ /* @__PURE__ */ t("button", { className: "btn ghost", onClick: () => {
1373
+ hn(), a("");
1374
+ }, children: "Clear" }),
1375
+ /* @__PURE__ */ i("span", { className: "badge live", children: [
1376
+ /* @__PURE__ */ t("i", { className: "dot" }),
1377
+ "LIVE"
1378
+ ] })
1379
+ ] })
1380
+ ] }),
1381
+ /* @__PURE__ */ i("div", { className: "layout", children: [
1382
+ /* @__PURE__ */ i("aside", { className: "files", children: [
1383
+ /* @__PURE__ */ t("h3", { children: "Pages" }),
1384
+ n.length === 0 && /* @__PURE__ */ t("div", { className: "placeholder", children: "No pages recorded yet." }),
1385
+ n.map((u) => /* @__PURE__ */ i("button", { className: `file mono ${(r == null ? void 0 : r.path) === u ? "on" : ""}`, onClick: () => a(u), title: u, children: [
1386
+ /* @__PURE__ */ t("span", { children: "📄" }),
1387
+ /* @__PURE__ */ t("span", { className: "hm-fname", children: u }),
1388
+ /* @__PURE__ */ t("span", { className: "n", children: he(e[u].activeMs) })
1389
+ ] }, u))
1390
+ ] }),
1391
+ /* @__PURE__ */ t("section", { className: "main", children: r ? /* @__PURE__ */ i(B, { children: [
1392
+ /* @__PURE__ */ i("div", { className: "summary", children: [
1393
+ /* @__PURE__ */ i("div", { className: "stat", children: [
1394
+ /* @__PURE__ */ t("b", { children: he(r.activeMs) }),
1395
+ /* @__PURE__ */ t("span", { children: "Active time" })
1396
+ ] }),
1397
+ /* @__PURE__ */ i("div", { className: "stat", children: [
1398
+ /* @__PURE__ */ i("b", { children: [
1399
+ Math.round(r.maxScrollPct),
1400
+ "%"
1401
+ ] }),
1402
+ /* @__PURE__ */ t("span", { children: "Max scroll depth" })
1403
+ ] }),
1404
+ /* @__PURE__ */ i("div", { className: "stat", children: [
1405
+ /* @__PURE__ */ t("b", { children: r.clickCount }),
1406
+ /* @__PURE__ */ t("span", { children: "Clicks" })
1407
+ ] }),
1408
+ /* @__PURE__ */ i("div", { className: "stat", children: [
1409
+ /* @__PURE__ */ t("b", { children: r.visits }),
1410
+ /* @__PURE__ */ t("span", { children: "Visits" })
1411
+ ] })
1412
+ ] }),
1413
+ /* @__PURE__ */ i("div", { className: "filters", children: [
1414
+ /* @__PURE__ */ i("button", { className: `chip tag ${o === "time" ? "on" : ""}`, onClick: () => c("time"), children: [
1415
+ /* @__PURE__ */ t("i", { className: "dot" }),
1416
+ "Mouse time"
1417
+ ] }),
1418
+ /* @__PURE__ */ i("button", { className: `chip tag ${o === "clicks" ? "on" : ""}`, onClick: () => c("clicks"), children: [
1419
+ /* @__PURE__ */ t("i", { className: "dot" }),
1420
+ "Clicks"
1421
+ ] })
1422
+ ] }),
1423
+ /* @__PURE__ */ i("div", { className: "hm-pane", children: [
1424
+ /* @__PURE__ */ i("div", { className: "head mono", children: [
1425
+ r.path,
1426
+ " · ",
1427
+ o === "time" ? "mouse time" : "clicks"
1428
+ ] }),
1429
+ /* @__PURE__ */ i("div", { className: "hm-body", children: [
1430
+ l && l.tiles.size === 0 ? /* @__PURE__ */ t("div", { className: "hm-note", children: o === "time" ? "No mouse movement recorded on this page yet." : "No clicks recorded on this page yet." }) : /* @__PURE__ */ t("div", { className: "hm-canvas", children: /* @__PURE__ */ t("canvas", { ref: d }) }),
1431
+ /* @__PURE__ */ i("div", { className: "hm-legend", children: [
1432
+ /* @__PURE__ */ t("span", { children: "Low" }),
1433
+ /* @__PURE__ */ t("i", { style: { background: wn } }),
1434
+ /* @__PURE__ */ i("span", { children: [
1435
+ "High",
1436
+ l && l.max ? ` (${g(l.max)})` : ""
1437
+ ] })
1438
+ ] }),
1439
+ /* @__PURE__ */ i("small", { className: "hm-muted", children: [
1440
+ "Each square is ",
1441
+ ae,
1442
+ "×",
1443
+ ae,
1444
+ "px of the page (",
1445
+ r.docW,
1446
+ "×",
1447
+ r.docH,
1448
+ "px). Numbers 1-3 mark the strongest spots."
1449
+ ] })
1450
+ ] })
1451
+ ] })
1452
+ ] }) : /* @__PURE__ */ t("div", { className: "empty", children: "No data yet. Move the mouse, scroll and click on the other tabs; time is recorded while the tab is active. Recording is paused while this tab is open." }) }),
1453
+ /* @__PURE__ */ i("aside", { className: "details", children: [
1454
+ /* @__PURE__ */ t("h3", { children: "Details" }),
1455
+ !r && /* @__PURE__ */ t("div", { className: "placeholder", children: "Details appear here once a page has been recorded." }),
1456
+ r && l && /* @__PURE__ */ i(B, { children: [
1457
+ /* @__PURE__ */ i("div", { className: "box", children: [
1458
+ /* @__PURE__ */ t("b", { children: "Strongest spots on the map" }),
1459
+ l.top.length === 0 ? "No data yet" : l.top.map((u, f) => /* @__PURE__ */ i("div", { className: "hm-spot", children: [
1460
+ /* @__PURE__ */ t("span", { className: "hm-badge", children: f + 1 }),
1461
+ /* @__PURE__ */ i("span", { className: "mono", children: [
1462
+ "x ",
1463
+ u.x,
1464
+ ", y ",
1465
+ u.y
1466
+ ] }),
1467
+ /* @__PURE__ */ t("span", { children: g(u.v) })
1468
+ ] }, f))
1469
+ ] }),
1470
+ /* @__PURE__ */ i("div", { className: "box", children: [
1471
+ /* @__PURE__ */ t("b", { children: "Most time spent (scrolling)" }),
1472
+ r.activeMs ? `${bn(h)} of the page (${he(r.bands[h])})` : "No data yet"
1473
+ ] }),
1474
+ /* @__PURE__ */ i("div", { className: "box", children: [
1475
+ /* @__PURE__ */ t("b", { children: "Most hovered element" }),
1476
+ p[0] ? `${p[0][1].text || p[0][0]} (${he(p[0][1].ms)})` : "No hover data yet"
1477
+ ] }),
1478
+ /* @__PURE__ */ i("div", { className: "box", children: [
1479
+ /* @__PURE__ */ t("b", { children: "Deepest scroll" }),
1480
+ Math.round(r.maxScrollPct),
1481
+ "% of the page"
1482
+ ] })
1483
+ ] })
1484
+ ] })
1485
+ ] })
1486
+ ] })
388
1487
  ] }) });
389
- }, xe = ({ items: t, value: a, onChange: i }) => /* @__PURE__ */ e("div", { className: "tabs", children: t.map((s) => /* @__PURE__ */ e("button", { type: "button", className: s.id === a ? "tab active" : "tab", onClick: () => i(s.id), children: s.label }, s.id)) }), Be = () => {
390
- const [t, a] = j("logs");
391
- return /* @__PURE__ */ n("div", { className: "shell", children: [
392
- /* @__PURE__ */ n("header", { className: "topbar", children: [
393
- /* @__PURE__ */ e("strong", { children: "POC" }),
394
- /* @__PURE__ */ e(xe, { items: [{ id: "logs", label: "Logs" }, { id: "feedback", label: "Feedback" }], value: t, onChange: a })
1488
+ }, Nn = ({ items: e, value: n, onChange: s }) => /* @__PURE__ */ t("div", { className: "tabs", children: e.map((a) => /* @__PURE__ */ t("button", { type: "button", className: a.id === n ? "tab active" : "tab", onClick: () => s(a.id), children: a.label }, a.id)) }), Hn = () => {
1489
+ const [e, n] = x("logs");
1490
+ return P(() => {
1491
+ St();
1492
+ }, []), /* @__PURE__ */ i("div", { className: "shell", children: [
1493
+ /* @__PURE__ */ i("header", { className: "topbar", children: [
1494
+ /* @__PURE__ */ t("strong", { children: "POC" }),
1495
+ /* @__PURE__ */ t(Nn, { items: [{ id: "logs", label: "Logs" }, { id: "feedback", label: "Feedback" }, { id: "heatmap", label: "Heatmap" }, { id: "journey", label: "user journey" }], value: e, onChange: n })
395
1496
  ] }),
396
- /* @__PURE__ */ e("main", { children: t === "logs" ? /* @__PURE__ */ e(Se, {}) : /* @__PURE__ */ e(ye, {}) })
1497
+ /* @__PURE__ */ t("main", { children: e === "logs" ? /* @__PURE__ */ t(on, {}) : e === "heatmap" ? /* @__PURE__ */ t(yn, {}) : /* @__PURE__ */ t(Pt, {}) })
397
1498
  ] });
398
- }, G = (t, a) => {
1499
+ }, Q = (e, n) => {
399
1500
  try {
400
- return t();
1501
+ return e();
401
1502
  } catch {
402
- return a;
1503
+ return n;
403
1504
  }
404
- }, ne = (t) => Math.random().toString(36).slice(2, 2 + t), X = () => location.pathname + location.hash, je = ".sj, [data-sj-ignore]", Te = () => ({
1505
+ }, Ae = (e) => Math.random().toString(36).slice(2, 2 + e), ue = () => location.pathname + location.hash, kn = ".sj, [data-sj-ignore]", Sn = () => ({
405
1506
  pages: {},
406
1507
  scrollMs: 0,
407
1508
  clicks: 0,
@@ -414,45 +1515,45 @@ const Se = ({ autoStart: t = !0 }) => {
414
1515
  drops: {},
415
1516
  log: []
416
1517
  });
417
- class Ee {
418
- constructor(a) {
419
- this.getCfg = a, this.activeStep = null, this.q = [], this.version = 0, this.subs = /* @__PURE__ */ new Set(), this.navSubs = /* @__PURE__ */ new Set(), this.overrides = {}, this.prev = "", this.booted = !1, this.scrolling = !1, this.scrollTimer = 0, this.lastMove = 0, this.subscribe = (i) => (this.subs.add(i), () => {
420
- this.subs.delete(i);
421
- }), this.getVersion = () => this.version, this.uid = G(() => localStorage.getItem("sjU") || (localStorage.setItem("sjU", ne(10)), localStorage.getItem("sjU")), "anon"), this.sid = G(() => sessionStorage.getItem("sjS") || (sessionStorage.setItem("sjS", ne(8)), sessionStorage.getItem("sjS")), ne(8)), this.state = { ...Te(), ...G(() => JSON.parse(sessionStorage.getItem("sjState") || "null"), null) };
1518
+ class xn {
1519
+ constructor(n) {
1520
+ this.getCfg = n, this.activeStep = null, this.q = [], this.version = 0, this.subs = /* @__PURE__ */ new Set(), this.navSubs = /* @__PURE__ */ new Set(), this.overrides = {}, this.prev = "", this.booted = !1, this.scrolling = !1, this.scrollTimer = 0, this.lastMove = 0, this.subscribe = (s) => (this.subs.add(s), () => {
1521
+ this.subs.delete(s);
1522
+ }), this.getVersion = () => this.version, this.uid = Q(() => localStorage.getItem("sjU") || (localStorage.setItem("sjU", Ae(10)), localStorage.getItem("sjU")), "anon"), this.sid = Q(() => sessionStorage.getItem("sjS") || (sessionStorage.setItem("sjS", Ae(8)), sessionStorage.getItem("sjS")), Ae(8)), this.state = { ...Sn(), ...Q(() => JSON.parse(sessionStorage.getItem("sjState") || "null"), null) };
422
1523
  }
423
1524
  get cfg() {
424
1525
  return { ...this.getCfg(), ...this.overrides };
425
1526
  }
426
- configure(a) {
427
- this.overrides = { ...this.overrides, ...a };
1527
+ configure(n) {
1528
+ this.overrides = { ...this.overrides, ...n };
428
1529
  }
429
1530
  emit() {
430
- this.version++, this.subs.forEach((a) => a());
1531
+ this.version++, this.subs.forEach((n) => n());
431
1532
  }
432
- onNavigate(a) {
433
- return this.navSubs.add(a), () => {
434
- this.navSubs.delete(a);
1533
+ onNavigate(n) {
1534
+ return this.navSubs.add(n), () => {
1535
+ this.navSubs.delete(n);
435
1536
  };
436
1537
  }
437
1538
  /* ---- data ---- */
438
- page(a = X()) {
439
- return this.state.pages[a] || (this.state.pages[a] = { ms: 0, scrollMs: 0, depth: 0, clicks: 0, views: 0, m: {} });
1539
+ page(n = ue()) {
1540
+ return this.state.pages[n] || (this.state.pages[n] = { ms: 0, scrollMs: 0, depth: 0, clicks: 0, views: 0, m: {} });
440
1541
  }
441
1542
  save() {
442
- G(() => sessionStorage.setItem("sjState", JSON.stringify({ ...this.state, log: this.state.log.slice(0, 40) })), void 0);
1543
+ Q(() => sessionStorage.setItem("sjState", JSON.stringify({ ...this.state, log: this.state.log.slice(0, 40) })), void 0);
443
1544
  }
444
- bin(a, i, s) {
445
- const o = X(), u = document.documentElement.scrollWidth || 1, T = this.state.heat[o] || (this.state.heat[o] = {}), g = Math.round(a / u * 100) + "," + (i / 20 | 0);
446
- T[g] = (T[g] || 0) + s;
1545
+ bin(n, s, a) {
1546
+ const o = ue(), c = document.documentElement.scrollWidth || 1, d = this.state.heat[o] || (this.state.heat[o] = {}), r = Math.round(n / c * 100) + "," + (s / 20 | 0);
1547
+ d[r] = (d[r] || 0) + a;
447
1548
  }
448
- track(a, i = {}) {
449
- const s = { sid: this.sid, uid: this.uid, type: a, t: Date.now(), page: X(), ...i };
450
- this.q.push(s), this.state.log.unshift(s), this.state.log.length > 60 && this.state.log.pop();
1549
+ track(n, s = {}) {
1550
+ const a = { sid: this.sid, uid: this.uid, type: n, t: Date.now(), page: ue(), ...s };
1551
+ this.q.push(a), this.state.log.unshift(a), this.state.log.length > 60 && this.state.log.pop();
451
1552
  const o = this.cfg.onEvent;
452
- o && G(() => o(s), void 0);
1553
+ o && Q(() => o(a), void 0);
453
1554
  }
454
- payload(a) {
455
- const i = this.state;
1555
+ payload(n) {
1556
+ const s = this.state;
456
1557
  return JSON.stringify({
457
1558
  sessionId: this.sid,
458
1559
  userId: this.uid,
@@ -460,207 +1561,207 @@ class Ee {
460
1561
  url: location.href,
461
1562
  viewport: [innerWidth, innerHeight],
462
1563
  doc: [document.documentElement.scrollWidth, document.documentElement.scrollHeight],
463
- events: a,
1564
+ events: n,
464
1565
  summary: {
465
- pages: i.pages,
466
- scrollMs: i.scrollMs,
467
- clicks: i.clicks,
468
- nav: i.nav,
469
- tour: { started: i.started, completed: i.completed, skipped: i.skipped, drops: i.drops, steps: i.steps },
470
- heat: i.heat
1566
+ pages: s.pages,
1567
+ scrollMs: s.scrollMs,
1568
+ clicks: s.clicks,
1569
+ nav: s.nav,
1570
+ tour: { started: s.started, completed: s.completed, skipped: s.skipped, drops: s.drops, steps: s.steps },
1571
+ heat: s.heat
471
1572
  }
472
1573
  });
473
1574
  }
474
- flush(a = !1) {
1575
+ flush(n = !1) {
475
1576
  if (this.save(), !this.q.length) return;
476
- const i = this.q;
1577
+ const s = this.q;
477
1578
  this.q = [];
478
- const s = this.cfg;
479
- if (!s.endpoint) {
480
- this.state.log.unshift({ type: "flush (dry-run)", t: Date.now(), n: `${i.length} events` });
1579
+ const a = this.cfg;
1580
+ if (!a.endpoint) {
1581
+ this.state.log.unshift({ type: "flush (dry-run)", t: Date.now(), n: `${s.length} events` });
481
1582
  return;
482
1583
  }
483
- const o = this.payload(i);
484
- a && navigator.sendBeacon && navigator.sendBeacon(s.endpoint, new Blob([o], { type: "application/json" })) || fetch(s.endpoint, { method: "POST", body: o, keepalive: !0, headers: { "Content-Type": "application/json", ...s.headers || {} } }).then((u) => {
485
- if (!u.ok) throw new Error("bad status");
1584
+ const o = this.payload(s);
1585
+ n && navigator.sendBeacon && navigator.sendBeacon(a.endpoint, new Blob([o], { type: "application/json" })) || fetch(a.endpoint, { method: "POST", body: o, keepalive: !0, headers: { "Content-Type": "application/json", ...a.headers || {} } }).then((c) => {
1586
+ if (!c.ok) throw new Error("bad status");
486
1587
  }).catch(() => {
487
- this.q = i.concat(this.q).slice(-500);
1588
+ this.q = s.concat(this.q).slice(-500);
488
1589
  });
489
1590
  }
490
1591
  /* ---- tour funnel ---- */
491
- tourStart(a, i) {
492
- i || this.state.started++, this.track(i ? "tour_resume" : "tour_start", { steps: a });
1592
+ tourStart(n, s) {
1593
+ s || this.state.started++, this.track(s ? "tour_resume" : "tour_start", { steps: n });
493
1594
  }
494
- stepView(a, i, s) {
495
- const o = this.state.steps[a] || (this.state.steps[a] = { views: 0, ms: 0, title: i });
496
- o.views++, this.activeStep = a, this.track("step_view", { step: a, title: i, total: s }), this.save();
1595
+ stepView(n, s, a) {
1596
+ const o = this.state.steps[n] || (this.state.steps[n] = { views: 0, ms: 0, title: s });
1597
+ o.views++, this.activeStep = n, this.track("step_view", { step: n, title: s, total: a }), this.save();
497
1598
  }
498
- tourEnd(a, i, s, o) {
499
- a === "complete" ? (this.state.completed++, this.track("tour_complete", { steps: o })) : (this.state.skipped++, this.state.drops[i] = (this.state.drops[i] || 0) + 1, this.track("tour_skip", { step: i, title: s })), this.activeStep = null, G(() => sessionStorage.removeItem("sjTour"), void 0), G(() => localStorage.setItem("sjDone", a), void 0), this.flush();
1599
+ tourEnd(n, s, a, o) {
1600
+ n === "complete" ? (this.state.completed++, this.track("tour_complete", { steps: o })) : (this.state.skipped++, this.state.drops[s] = (this.state.drops[s] || 0) + 1, this.track("tour_skip", { step: s, title: a })), this.activeStep = null, Q(() => sessionStorage.removeItem("sjTour"), void 0), Q(() => localStorage.setItem("sjDone", n), void 0), this.flush();
500
1601
  }
501
1602
  /* ---- passive listeners; returns a cleanup function (safe under React StrictMode) ---- */
502
1603
  attach() {
503
- const a = this.state;
504
- this.prev = X();
505
- let i = performance.now();
1604
+ const n = this.state;
1605
+ this.prev = ue();
1606
+ let s = performance.now();
506
1607
  this.booted || (this.booted = !0, this.page().views++, this.track("session_start", { ua: navigator.userAgent.slice(0, 60), ref: document.referrer }));
507
- const s = [], o = (d, l, h, b) => {
508
- d.addEventListener(l, h, b), s.push(() => d.removeEventListener(l, h, b));
509
- }, u = window.setInterval(() => {
510
- const d = performance.now(), l = d - i;
511
- if (i = d, document.hidden) return;
512
- const h = this.page();
513
- h.ms += l, this.scrolling && (h.scrollMs += l, a.scrollMs += l), this.activeStep !== null && a.steps[this.activeStep] && (a.steps[this.activeStep].ms += l);
514
- }, 250), T = window.setInterval(() => this.emit(), 500), g = window.setInterval(() => this.flush(), this.cfg.flushMs || 5e3);
515
- s.push(() => {
516
- clearInterval(u), clearInterval(T), clearInterval(g);
1608
+ const a = [], o = (l, h, g, u) => {
1609
+ l.addEventListener(h, g, u), a.push(() => l.removeEventListener(h, g, u));
1610
+ }, c = window.setInterval(() => {
1611
+ const l = performance.now(), h = l - s;
1612
+ if (s = l, document.hidden) return;
1613
+ const g = this.page();
1614
+ g.ms += h, this.scrolling && (g.scrollMs += h, n.scrollMs += h), this.activeStep !== null && n.steps[this.activeStep] && (n.steps[this.activeStep].ms += h);
1615
+ }, 250), d = window.setInterval(() => this.emit(), 500), r = window.setInterval(() => this.flush(), this.cfg.flushMs || 5e3);
1616
+ a.push(() => {
1617
+ clearInterval(c), clearInterval(d), clearInterval(r);
517
1618
  }), o(window, "scroll", () => {
518
1619
  this.scrolling = !0, clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
519
1620
  this.scrolling = !1;
520
1621
  }, 160);
521
- const d = this.page(), l = Math.min(100, Math.round((scrollY + innerHeight) / document.documentElement.scrollHeight * 100));
522
- l > d.depth && (d.depth = l, [25, 50, 75, 100].forEach((h) => {
523
- l >= h && !d.m[h] && (d.m[h] = 1, this.track("scroll_depth", { pct: h }));
1622
+ const l = this.page(), h = Math.min(100, Math.round((scrollY + innerHeight) / document.documentElement.scrollHeight * 100));
1623
+ h > l.depth && (l.depth = h, [25, 50, 75, 100].forEach((g) => {
1624
+ h >= g && !l.m[g] && (l.m[g] = 1, this.track("scroll_depth", { pct: g }));
524
1625
  }));
525
- }, { passive: !0 }), o(window, "mousemove", (d) => {
526
- const l = Date.now();
527
- l - this.lastMove > 120 && (this.lastMove = l, this.bin(d.pageX, d.pageY, 1));
528
- }, { passive: !0 }), o(document, "click", (d) => {
529
- const l = d.target;
530
- if (!l || !l.closest || l.closest(je)) return;
531
- a.clicks++, this.page().clicks++, this.bin(d.pageX, d.pageY, 6);
532
- const h = l.id ? "#" + l.id : l.tagName.toLowerCase() + (typeof l.className == "string" && l.className ? "." + l.className.trim().split(/\s+/)[0] : "");
533
- this.track("click", { sel: h, x: d.pageX, y: d.pageY, text: (l.textContent || "").trim().slice(0, 30), step: this.activeStep });
534
- const b = l.closest("a[href]");
535
- b && !b.getAttribute("href").startsWith("#") && (this.track("navigate_out", { to: b.href }), this.flush(!0));
1626
+ }, { passive: !0 }), o(window, "mousemove", (l) => {
1627
+ const h = Date.now();
1628
+ h - this.lastMove > 120 && (this.lastMove = h, this.bin(l.pageX, l.pageY, 1));
1629
+ }, { passive: !0 }), o(document, "click", (l) => {
1630
+ const h = l.target;
1631
+ if (!h || !h.closest || h.closest(kn)) return;
1632
+ n.clicks++, this.page().clicks++, this.bin(l.pageX, l.pageY, 6);
1633
+ const g = h.id ? "#" + h.id : h.tagName.toLowerCase() + (typeof h.className == "string" && h.className ? "." + h.className.trim().split(/\s+/)[0] : "");
1634
+ this.track("click", { sel: g, x: l.pageX, y: l.pageY, text: (h.textContent || "").trim().slice(0, 30), step: this.activeStep });
1635
+ const u = h.closest("a[href]");
1636
+ u && !u.getAttribute("href").startsWith("#") && (this.track("navigate_out", { to: u.href }), this.flush(!0));
536
1637
  }, !0);
537
- const N = () => {
538
- const d = X();
539
- d !== this.prev && (a.nav++, this.track("navigate", { from: this.prev, to: d }), this.prev = d, this.page().views++, this.navSubs.forEach((l) => l()));
1638
+ const p = () => {
1639
+ const l = ue();
1640
+ l !== this.prev && (n.nav++, this.track("navigate", { from: this.prev, to: l }), this.prev = l, this.page().views++, this.navSubs.forEach((h) => h()));
540
1641
  };
541
- return ["pushState", "replaceState"].forEach((d) => {
542
- const l = history[d];
543
- history[d] = function(...h) {
544
- const b = l.apply(this, h);
545
- return setTimeout(N), b;
546
- }, s.push(() => {
547
- history[d] = l;
1642
+ return ["pushState", "replaceState"].forEach((l) => {
1643
+ const h = history[l];
1644
+ history[l] = function(...g) {
1645
+ const u = h.apply(this, g);
1646
+ return setTimeout(p), u;
1647
+ }, a.push(() => {
1648
+ history[l] = h;
548
1649
  });
549
- }), o(window, "popstate", N), o(window, "hashchange", N), o(document, "visibilitychange", () => {
1650
+ }), o(window, "popstate", p), o(window, "hashchange", p), o(document, "visibilitychange", () => {
550
1651
  document.hidden && this.flush(!0);
551
1652
  }), o(window, "pagehide", () => {
552
- const d = this.activeStep;
553
- d !== null && (this.track("tour_abandon", { step: d }), a.drops[d] = (a.drops[d] || 0) + 1, G(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: d, t: Date.now() })), void 0)), this.flush(!0);
554
- }), () => s.forEach((d) => d());
1653
+ const l = this.activeStep;
1654
+ l !== null && (this.track("tour_abandon", { step: l }), n.drops[l] = (n.drops[l] || 0) + 1, Q(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: l, t: Date.now() })), void 0)), this.flush(!0);
1655
+ }), () => a.forEach((l) => l());
555
1656
  }
556
1657
  }
557
- const te = (t) => !!t && t.isConnected && t.getClientRects().length > 0;
558
- function Ce(t) {
559
- var s;
560
- const a = t.dataset, i = (t.getAttribute("aria-label") || t.getAttribute("title") || t.textContent || "").trim().replace(/\s+/g, " ");
1658
+ const $e = (e) => !!e && e.isConnected && e.getClientRects().length > 0;
1659
+ function En(e) {
1660
+ var a;
1661
+ const n = e.dataset, s = (e.getAttribute("aria-label") || e.getAttribute("title") || e.textContent || "").trim().replace(/\s+/g, " ");
561
1662
  return {
562
- el: t,
563
- title: a.sjTitle || t.getAttribute("aria-label") || ((s = t.querySelector("h1,h2,h3")) == null ? void 0 : s.textContent) || i.slice(0, 28) || t.tagName.toLowerCase(),
564
- body: a.sjBody || i.slice(0, 140),
565
- placement: a.sjPlace || "auto"
1663
+ el: e,
1664
+ title: n.sjTitle || e.getAttribute("aria-label") || ((a = e.querySelector("h1,h2,h3")) == null ? void 0 : a.textContent) || s.slice(0, 28) || e.tagName.toLowerCase(),
1665
+ body: n.sjBody || s.slice(0, 140),
1666
+ placement: n.sjPlace || "auto"
566
1667
  };
567
1668
  }
568
- function Le(t) {
569
- const a = (s) => !s.page || s.page === location.pathname;
570
- let i;
571
- if (t.steps)
572
- i = t.steps.map((s) => ({
573
- ...s,
574
- placement: s.placement ?? "auto",
575
- el: s.target && a(s) ? document.querySelector(s.target) : null,
576
- wait: !!s.target && a(s)
1669
+ function $n(e) {
1670
+ const n = (a) => !a.page || a.page === location.pathname;
1671
+ let s;
1672
+ if (e.steps)
1673
+ s = e.steps.map((a) => ({
1674
+ ...a,
1675
+ placement: a.placement ?? "auto",
1676
+ el: a.target && n(a) ? document.querySelector(a.target) : null,
1677
+ wait: !!a.target && n(a)
577
1678
  }));
578
1679
  else {
579
- let s = [...document.querySelectorAll("[data-sj-title],[data-sj-step]")];
580
- s.length || (s = [...document.querySelectorAll("header,nav,main>section,footer")].slice(0, 6)), i = s.filter(te).sort((o, u) => (+(o.dataset.sjStep || 0) || 99) - (+(u.dataset.sjStep || 0) || 99)).map(Ce);
1680
+ let a = [...document.querySelectorAll("[data-sj-title],[data-sj-step]")];
1681
+ a.length || (a = [...document.querySelectorAll("header,nav,main>section,footer")].slice(0, 6)), s = a.filter($e).sort((o, c) => (+(o.dataset.sjStep || 0) || 99) - (+(c.dataset.sjStep || 0) || 99)).map(En);
581
1682
  }
582
- return t.welcome && i.unshift({ ...t.welcome, el: null, placement: "auto", welcome: !0 }), t.outro && i.push({ ...t.outro, el: null, placement: "auto", outro: !0 }), i;
1683
+ return e.welcome && s.unshift({ ...e.welcome, el: null, placement: "auto", welcome: !0 }), e.outro && s.push({ ...e.outro, el: null, placement: "auto", outro: !0 }), s;
583
1684
  }
584
- const Z = (t, a, i) => Math.max(a, Math.min(i, t)), Re = ({ open: t, anim: a, theme: i, steps: s, index: o, startLabel: u, tracker: T, onNext: g, onBack: N, onSkip: d, onTheme: l }) => {
585
- const h = B(null), b = B(null), m = B(0), [p, q] = j(null), w = s[o], k = F(() => {
586
- const x = h.current;
587
- if (!t || !w || !x) return;
588
- const r = innerWidth, f = innerHeight, S = 12, M = 16;
589
- let y = { x: r / 2, y: f / 2, w: 0, h: 0 }, P = !0;
590
- if (te(w.el)) {
591
- const R = w.el.getBoundingClientRect(), U = Math.max(R.left - 8, 0), C = Math.max(R.top - 8, 0);
592
- y = { x: U, y: C, w: Math.min(R.right + 8, r) - U, h: Math.min(R.bottom + 8, f) - C }, P = !1;
1685
+ const ve = (e, n, s) => Math.max(n, Math.min(s, e)), Mn = ({ open: e, anim: n, theme: s, steps: a, index: o, startLabel: c, tracker: d, onNext: r, onBack: p, onSkip: l, onTheme: h }) => {
1686
+ const g = q(null), u = q(null), f = q(0), [v, _] = x(null), N = a[o], M = H(() => {
1687
+ const L = g.current;
1688
+ if (!e || !N || !L) return;
1689
+ const k = innerWidth, S = innerHeight, $ = 12, T = 16;
1690
+ let m = { x: k / 2, y: S / 2, w: 0, h: 0 }, W = !0;
1691
+ if ($e(N.el)) {
1692
+ const A = N.el.getBoundingClientRect(), K = Math.max(A.left - 8, 0), j = Math.max(A.top - 8, 0);
1693
+ m = { x: K, y: j, w: Math.min(A.right + 8, k) - K, h: Math.min(A.bottom + 8, S) - j }, W = !1;
593
1694
  }
594
- const A = x.offsetWidth, I = x.offsetHeight;
595
- let J = (r - A) / 2, H = (f - I) / 2, z = "c", v = 0, L = 0;
596
- if (!P) {
597
- const R = y.x + y.w / 2, U = y.y + y.h / 2, C = {
598
- top: { x: R - A / 2, y: y.y - I - M, ok: y.y - I - M >= S },
599
- bottom: { x: R - A / 2, y: y.y + y.h + M, ok: y.y + y.h + M + I <= f - S },
600
- left: { x: y.x - A - M, y: U - I / 2, ok: y.x - A - M >= S },
601
- right: { x: y.x + y.w + M, y: U - I / 2, ok: y.x + y.w + M + A <= r - S }
602
- }, Q = w.placement !== "auto" && w.placement in C ? w.placement : "bottom", de = { top: "bottom", bottom: "top", left: "right", right: "left" }[Q], K = (w.placement === "auto" ? ["bottom", "top", "right", "left"] : [Q, de, "bottom", "top", "right", "left"]).find((he) => C[he].ok);
603
- K ? (J = C[K].x, H = C[K].y, z = K) : (H = f - I - S, z = "in"), J = Z(J, S, r - A - S), H = Z(H, S, f - I - S), v = Z(R - J, 22, A - 22), L = Z(U - H, 22, I - 22);
1695
+ const D = L.offsetWidth, F = L.offsetHeight;
1696
+ let G = (k - D) / 2, J = (S - F) / 2, le = "c", y = 0, O = 0;
1697
+ if (!W) {
1698
+ const A = m.x + m.w / 2, K = m.y + m.h / 2, j = {
1699
+ top: { x: A - D / 2, y: m.y - F - T, ok: m.y - F - T >= $ },
1700
+ bottom: { x: A - D / 2, y: m.y + m.h + T, ok: m.y + m.h + T + F <= S - $ },
1701
+ left: { x: m.x - D - T, y: K - F / 2, ok: m.x - D - T >= $ },
1702
+ right: { x: m.x + m.w + T, y: K - F / 2, ok: m.x + m.w + T + D <= k - $ }
1703
+ }, ce = N.placement !== "auto" && N.placement in j ? N.placement : "bottom", $t = { top: "bottom", bottom: "top", left: "right", right: "left" }[ce], we = (N.placement === "auto" ? ["bottom", "top", "right", "left"] : [ce, $t, "bottom", "top", "right", "left"]).find((Mt) => j[Mt].ok);
1704
+ we ? (G = j[we].x, J = j[we].y, le = we) : (J = S - F - $, le = "in"), G = ve(G, $, k - D - $), J = ve(J, $, S - F - $), y = ve(A - G, 22, D - 22), O = ve(K - J, 22, F - 22);
604
1705
  }
605
- q({ hole: y, centered: P, x: Math.round(J), y: Math.round(H), side: z, ax: v, ay: L, vw: r, vh: f });
606
- }, [t, w]), O = F(() => {
607
- cancelAnimationFrame(m.current), m.current = requestAnimationFrame(k);
608
- }, [k]);
609
- if (oe(() => {
610
- if (!t) return;
611
- k();
612
- const x = window.setTimeout(k, 380), r = window.setTimeout(k, 700);
1706
+ _({ hole: m, centered: W, x: Math.round(G), y: Math.round(J), side: le, ax: y, ay: O, vw: k, vh: S });
1707
+ }, [e, N]), E = H(() => {
1708
+ cancelAnimationFrame(f.current), f.current = requestAnimationFrame(M);
1709
+ }, [M]);
1710
+ if (it(() => {
1711
+ if (!e) return;
1712
+ M();
1713
+ const L = window.setTimeout(M, 380), k = window.setTimeout(M, 700);
613
1714
  return () => {
614
- clearTimeout(x), clearTimeout(r);
1715
+ clearTimeout(L), clearTimeout(k);
615
1716
  };
616
- }, [t, o, k]), $(() => {
617
- if (!t) return;
618
- addEventListener("scroll", O, { passive: !0 }), addEventListener("resize", O);
619
- const x = T.onNavigate(O);
1717
+ }, [e, o, M]), P(() => {
1718
+ if (!e) return;
1719
+ addEventListener("scroll", E, { passive: !0 }), addEventListener("resize", E);
1720
+ const L = d.onNavigate(E);
620
1721
  return () => {
621
- removeEventListener("scroll", O), removeEventListener("resize", O), x(), cancelAnimationFrame(m.current);
1722
+ removeEventListener("scroll", E), removeEventListener("resize", E), L(), cancelAnimationFrame(f.current);
622
1723
  };
623
- }, [t, O, T]), $(() => {
624
- var x;
625
- t && w && ((x = b.current) == null || x.focus({ preventScroll: !0 }));
626
- }, [t, o, w]), !w) return null;
627
- const E = o === s.length - 1, c = p, W = c ? [
628
- [0, 0, c.vw, c.hole.y],
629
- [c.hole.y + c.hole.h, 0, c.vw, c.vh - c.hole.y - c.hole.h],
630
- [c.hole.y, 0, c.hole.x, c.hole.h],
631
- [c.hole.y, c.hole.x + c.hole.w, c.vw - c.hole.x - c.hole.w, c.hole.h]
632
- ] : [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], D = (x) => Math.max(0, x) + "px";
633
- return le(
634
- /* @__PURE__ */ n("div", { className: `sj${t ? " on" : ""}${a ? " anim" : ""}`, "data-theme": i, "data-sj-ignore": !0, children: [
635
- W.map(([x, r, f, S], M) => /* @__PURE__ */ e("div", { className: "sj-p", style: { top: D(x), left: D(r), width: D(f), height: D(S) } }, M)),
636
- /* @__PURE__ */ e("div", { className: "sj-ring", style: c ? { top: c.hole.y, left: c.hole.x, width: D(c.hole.w), height: D(c.hole.h), opacity: c.centered ? 0 : 1 } : { opacity: 0 } }),
637
- /* @__PURE__ */ n(
1724
+ }, [e, E, d]), P(() => {
1725
+ var L;
1726
+ e && N && ((L = u.current) == null || L.focus({ preventScroll: !0 }));
1727
+ }, [e, o, N]), !N) return null;
1728
+ const I = o === a.length - 1, w = v, b = w ? [
1729
+ [0, 0, w.vw, w.hole.y],
1730
+ [w.hole.y + w.hole.h, 0, w.vw, w.vh - w.hole.y - w.hole.h],
1731
+ [w.hole.y, 0, w.hole.x, w.hole.h],
1732
+ [w.hole.y, w.hole.x + w.hole.w, w.vw - w.hole.x - w.hole.w, w.hole.h]
1733
+ ] : [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], R = (L) => Math.max(0, L) + "px";
1734
+ return rt(
1735
+ /* @__PURE__ */ i("div", { className: `sj${e ? " on" : ""}${n ? " anim" : ""}`, "data-theme": s, "data-sj-ignore": !0, children: [
1736
+ b.map(([L, k, S, $], T) => /* @__PURE__ */ t("div", { className: "sj-p", style: { top: R(L), left: R(k), width: R(S), height: R($) } }, T)),
1737
+ /* @__PURE__ */ t("div", { className: "sj-ring", style: w ? { top: w.hole.y, left: w.hole.x, width: R(w.hole.w), height: R(w.hole.h), opacity: w.centered ? 0 : 1 } : { opacity: 0 } }),
1738
+ /* @__PURE__ */ i(
638
1739
  "div",
639
1740
  {
640
- ref: h,
1741
+ ref: g,
641
1742
  className: "sj-pop",
642
1743
  role: "dialog",
643
1744
  "aria-modal": "true",
644
1745
  "aria-live": "polite",
645
- "data-side": (c == null ? void 0 : c.side) ?? "c",
646
- style: { transform: c ? `translate(${c.x}px,${c.y}px)` : void 0, "--ax": ((c == null ? void 0 : c.ax) ?? 0) + "px", "--ay": ((c == null ? void 0 : c.ay) ?? 0) + "px" },
1746
+ "data-side": (w == null ? void 0 : w.side) ?? "c",
1747
+ style: { transform: w ? `translate(${w.x}px,${w.y}px)` : void 0, "--ax": ((w == null ? void 0 : w.ax) ?? 0) + "px", "--ay": ((w == null ? void 0 : w.ay) ?? 0) + "px" },
647
1748
  children: [
648
- /* @__PURE__ */ e("i", { className: "sj-arr" }),
649
- /* @__PURE__ */ e("div", { className: "sj-bar", children: /* @__PURE__ */ e("b", { style: { width: Math.round((o + 1) / s.length * 100) + "%" } }) }),
650
- /* @__PURE__ */ n("div", { className: "sj-hd", children: [
651
- /* @__PURE__ */ e("span", { children: w.welcome ? "Welcome" : `Step ${o + 1} of ${s.length}` }),
652
- /* @__PURE__ */ n("span", { children: [
653
- /* @__PURE__ */ e("button", { className: "sj-x", "aria-label": "Switch light or dark theme", onClick: l, children: "◐" }),
654
- /* @__PURE__ */ e("button", { className: "sj-x", "aria-label": "Close tour", onClick: d, children: "×" })
1749
+ /* @__PURE__ */ t("i", { className: "sj-arr" }),
1750
+ /* @__PURE__ */ t("div", { className: "sj-bar", children: /* @__PURE__ */ t("b", { style: { width: Math.round((o + 1) / a.length * 100) + "%" } }) }),
1751
+ /* @__PURE__ */ i("div", { className: "sj-hd", children: [
1752
+ /* @__PURE__ */ t("span", { children: N.welcome ? "Welcome" : `Step ${o + 1} of ${a.length}` }),
1753
+ /* @__PURE__ */ i("span", { children: [
1754
+ /* @__PURE__ */ t("button", { className: "sj-x", "aria-label": "Switch light or dark theme", onClick: h, children: "◐" }),
1755
+ /* @__PURE__ */ t("button", { className: "sj-x", "aria-label": "Close tour", onClick: l, children: "×" })
655
1756
  ] })
656
1757
  ] }),
657
- /* @__PURE__ */ e("h3", { children: w.title }),
658
- /* @__PURE__ */ e("p", { children: w.body }),
659
- /* @__PURE__ */ n("div", { className: "sj-ft", children: [
660
- /* @__PURE__ */ e("button", { className: "sj-g", style: { visibility: E ? "hidden" : "visible" }, onClick: d, children: "Skip" }),
661
- /* @__PURE__ */ n("span", { children: [
662
- /* @__PURE__ */ e("button", { className: "sj-g", style: { visibility: o ? "visible" : "hidden" }, onClick: N, children: "Back" }),
663
- /* @__PURE__ */ e("button", { ref: b, className: "sj-b", onClick: g, children: w.welcome ? u || "Start tour" : E ? "Finish" : "Next" })
1758
+ /* @__PURE__ */ t("h3", { children: N.title }),
1759
+ /* @__PURE__ */ t("p", { children: N.body }),
1760
+ /* @__PURE__ */ i("div", { className: "sj-ft", children: [
1761
+ /* @__PURE__ */ t("button", { className: "sj-g", style: { visibility: I ? "hidden" : "visible" }, onClick: l, children: "Skip" }),
1762
+ /* @__PURE__ */ i("span", { children: [
1763
+ /* @__PURE__ */ t("button", { className: "sj-g", style: { visibility: o ? "visible" : "hidden" }, onClick: p, children: "Back" }),
1764
+ /* @__PURE__ */ t("button", { ref: u, className: "sj-b", onClick: r, children: N.welcome ? c || "Start tour" : I ? "Finish" : "Next" })
664
1765
  ] })
665
1766
  ] })
666
1767
  ]
@@ -669,143 +1770,143 @@ const Z = (t, a, i) => Math.max(a, Math.min(i, t)), Re = ({ open: t, anim: a, th
669
1770
  ] }),
670
1771
  document.body
671
1772
  );
672
- }, Me = ({ tracker: t }) => {
673
- const a = B(null);
674
- return $(() => {
675
- const i = () => {
676
- const o = a.current;
1773
+ }, Ln = ({ tracker: e }) => {
1774
+ const n = q(null);
1775
+ return P(() => {
1776
+ const s = () => {
1777
+ const o = n.current;
677
1778
  if (!o) return;
678
- const u = o.getContext("2d");
679
- if (!u) return;
680
- const T = document.documentElement.scrollWidth, g = t.state.heat[location.pathname + location.hash] || {};
681
- o.width = innerWidth, o.height = innerHeight, u.globalCompositeOperation = "lighter";
682
- for (const N in g) {
683
- const [d, l] = N.split(",").map(Number), h = d / 100 * T - scrollX, b = l * 20 + 10 - scrollY;
684
- if (h < -40 || b < -40 || h > innerWidth + 40 || b > innerHeight + 40) continue;
685
- const m = Math.min(1, g[N] / 6), p = u.createRadialGradient(h, b, 0, h, b, 34);
686
- p.addColorStop(0, `rgba(255,70,50,${0.5 * m + 0.1})`), p.addColorStop(1, "rgba(255,70,50,0)"), u.fillStyle = p, u.fillRect(h - 34, b - 34, 68, 68);
1779
+ const c = o.getContext("2d");
1780
+ if (!c) return;
1781
+ const d = document.documentElement.scrollWidth, r = e.state.heat[location.pathname + location.hash] || {};
1782
+ o.width = innerWidth, o.height = innerHeight, c.globalCompositeOperation = "lighter";
1783
+ for (const p in r) {
1784
+ const [l, h] = p.split(",").map(Number), g = l / 100 * d - scrollX, u = h * 20 + 10 - scrollY;
1785
+ if (g < -40 || u < -40 || g > innerWidth + 40 || u > innerHeight + 40) continue;
1786
+ const f = Math.min(1, r[p] / 6), v = c.createRadialGradient(g, u, 0, g, u, 34);
1787
+ v.addColorStop(0, `rgba(255,70,50,${0.5 * f + 0.1})`), v.addColorStop(1, "rgba(255,70,50,0)"), c.fillStyle = v, c.fillRect(g - 34, u - 34, 68, 68);
687
1788
  }
688
1789
  };
689
- i();
690
- const s = window.setInterval(i, 250);
691
- return addEventListener("scroll", i, { passive: !0 }), addEventListener("resize", i), () => {
692
- clearInterval(s), removeEventListener("scroll", i), removeEventListener("resize", i);
1790
+ s();
1791
+ const a = window.setInterval(s, 250);
1792
+ return addEventListener("scroll", s, { passive: !0 }), addEventListener("resize", s), () => {
1793
+ clearInterval(a), removeEventListener("scroll", s), removeEventListener("resize", s);
693
1794
  };
694
- }, [t]), le(/* @__PURE__ */ e("canvas", { ref: a, className: "sj-heat", "data-sj-ignore": !0 }), document.body);
695
- }, ce = ge(null);
696
- function ie() {
697
- const t = me(ce);
698
- if (!t) throw new Error("useJourney must be used inside <JourneyProvider>");
699
- return t;
1795
+ }, [e]), rt(/* @__PURE__ */ t("canvas", { ref: n, className: "sj-heat", "data-sj-ignore": !0 }), document.body);
1796
+ }, Et = Tt(null);
1797
+ function ze() {
1798
+ const e = It(Et);
1799
+ if (!e) throw new Error("useJourney must be used inside <JourneyProvider>");
1800
+ return e;
700
1801
  }
701
- function Ae() {
702
- const { tracker: t } = ie();
703
- return pe(t.subscribe, t.getVersion, t.getVersion), t.state;
1802
+ function In() {
1803
+ const { tracker: e } = ze();
1804
+ return Me(e.subscribe, e.getVersion, e.getVersion), e.state;
704
1805
  }
705
- const _ = (t, a) => {
1806
+ const oe = (e, n) => {
706
1807
  try {
707
- return t();
1808
+ return e();
708
1809
  } catch {
709
- return a;
710
- }
711
- }, Ie = ({ config: t, children: a }) => {
712
- const i = B(t ?? {});
713
- i.current = t ?? {};
714
- const s = ae(() => new Ee(() => i.current), []), [o, u] = j(() => _(() => localStorage.getItem("sjTheme"), null) ?? (t == null ? void 0 : t.theme) ?? "auto"), [T, g] = j(() => _(() => matchMedia("(prefers-color-scheme:dark)").matches, !1));
715
- $(() => {
716
- const v = matchMedia("(prefers-color-scheme:dark)"), L = () => g(v.matches);
717
- return v.addEventListener("change", L), () => v.removeEventListener("change", L);
1810
+ return n;
1811
+ }
1812
+ }, Tn = ({ config: e, children: n }) => {
1813
+ const s = q(e ?? {});
1814
+ s.current = e ?? {};
1815
+ const a = te(() => new xn(() => s.current), []), [o, c] = x(() => oe(() => localStorage.getItem("sjTheme"), null) ?? (e == null ? void 0 : e.theme) ?? "auto"), [d, r] = x(() => oe(() => matchMedia("(prefers-color-scheme:dark)").matches, !1));
1816
+ P(() => {
1817
+ const y = matchMedia("(prefers-color-scheme:dark)"), O = () => r(y.matches);
1818
+ return y.addEventListener("change", O), () => y.removeEventListener("change", O);
718
1819
  }, []);
719
- const N = o === "auto" ? T ? "dark" : "light" : o;
720
- $(() => {
721
- document.documentElement.setAttribute("data-sj-theme", N);
722
- }, [N]);
723
- const d = F((v) => {
724
- u(v), _(() => localStorage.setItem("sjTheme", v), void 0), s.track("theme", { theme: v });
725
- }, [s]);
726
- $(() => s.attach(), [s]);
727
- const [l, h] = j(!1), [b, m] = j([]), [p, q] = j(-1), [w, k] = j(!1), O = B([]), E = B(-1), c = B(!1), W = B(!1), D = B(0), x = F((v) => {
728
- if (!c.current) return;
729
- const L = O.current[E.current];
730
- s.tourEnd(v, E.current, (L == null ? void 0 : L.title) ?? "", O.current.length), c.current = !1, h(!1);
731
- }, [s]), r = F((v, L = 0) => {
732
- const R = O.current, U = i.current;
733
- if (v < 0 && (v = 0), v >= R.length) return x("complete");
734
- const C = R[v];
735
- if (C.page && C.page !== location.pathname) {
736
- _(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: v, t: Date.now(), go: 1 })), void 0), s.track("step_navigate", { step: v, to: C.page }), s.flush(!0), location.href = C.page;
1820
+ const p = o === "auto" ? d ? "dark" : "light" : o;
1821
+ P(() => {
1822
+ document.documentElement.setAttribute("data-sj-theme", p);
1823
+ }, [p]);
1824
+ const l = H((y) => {
1825
+ c(y), oe(() => localStorage.setItem("sjTheme", y), void 0), a.track("theme", { theme: y });
1826
+ }, [a]);
1827
+ P(() => a.attach(), [a]);
1828
+ const [h, g] = x(!1), [u, f] = x([]), [v, _] = x(-1), [N, M] = x(!1), E = q([]), I = q(-1), w = q(!1), b = q(!1), R = q(0), L = H((y) => {
1829
+ if (!w.current) return;
1830
+ const O = E.current[I.current];
1831
+ a.tourEnd(y, I.current, (O == null ? void 0 : O.title) ?? "", E.current.length), w.current = !1, g(!1);
1832
+ }, [a]), k = H((y, O = 0) => {
1833
+ const A = E.current, K = s.current;
1834
+ if (y < 0 && (y = 0), y >= A.length) return L("complete");
1835
+ const j = A[y];
1836
+ if (j.page && j.page !== location.pathname) {
1837
+ oe(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: y, t: Date.now(), go: 1 })), void 0), a.track("step_navigate", { step: y, to: j.page }), a.flush(!0), location.href = j.page;
737
1838
  return;
738
1839
  }
739
- if (C.wait && !C.el && C.target && (C.el = document.querySelector(C.target)), C.target && !te(C.el)) {
740
- if (L < (U.waitMs ?? 2500) / 100) {
1840
+ if (j.wait && !j.el && j.target && (j.el = document.querySelector(j.target)), j.target && !$e(j.el)) {
1841
+ if (O < (K.waitMs ?? 2500) / 100) {
741
1842
  window.setTimeout(() => {
742
- c.current && r(v, L + 1);
1843
+ w.current && k(y, O + 1);
743
1844
  }, 100);
744
1845
  return;
745
1846
  }
746
- s.track("step_missing", { step: v, target: C.target });
747
- const Q = v >= E.current ? 1 : -1;
748
- return r(v + (v + Q < 0 ? 1 : Q), 0);
1847
+ a.track("step_missing", { step: y, target: j.target });
1848
+ const ce = y >= I.current ? 1 : -1;
1849
+ return k(y + (y + ce < 0 ? 1 : ce), 0);
749
1850
  }
750
- E.current = v, q(v), s.stepView(v, C.title, R.length), W.current && (k(!0), clearTimeout(D.current), D.current = window.setTimeout(() => k(!1), 520)), te(C.el) && C.el.scrollIntoView({ block: "center", behavior: W.current ? "smooth" : "auto" }), W.current || requestAnimationFrame(() => {
751
- W.current = !0;
1851
+ I.current = y, _(y), a.stepView(y, j.title, A.length), b.current && (M(!0), clearTimeout(R.current), R.current = window.setTimeout(() => M(!1), 520)), $e(j.el) && j.el.scrollIntoView({ block: "center", behavior: b.current ? "smooth" : "auto" }), b.current || requestAnimationFrame(() => {
1852
+ b.current = !0;
752
1853
  });
753
- }, [x, s]), f = F((v = 0, L = !1) => {
754
- const R = Le(i.current);
755
- R.length && (O.current = R, m(R), c.current = !0, W.current = !1, h(!0), s.tourStart(R.length, L), r(v));
756
- }, [r, s]), S = F(() => f(0), [f]), M = F(() => x("skip"), [x]), y = F(() => {
757
- c.current && (s.track("step_next", { step: E.current }), r(E.current + 1));
758
- }, [r, s]), P = F(() => {
759
- c.current && r(E.current - 1);
760
- }, [r]);
761
- $(() => {
762
- const v = _(() => JSON.parse(sessionStorage.getItem("sjTour") || "null"), null), L = i.current;
763
- let R;
764
- return v && Date.now() - v.t < 3e5 ? R = window.setTimeout(() => f(v.i, !0), 400) : L.autoStart !== !1 && !(L.once && _(() => localStorage.getItem("sjDone"), null)) && (R = window.setTimeout(() => f(0), 600)), () => clearTimeout(R);
765
- }, [f]), $(() => () => {
766
- c.current = !1;
767
- }, []), $(() => {
768
- if (!l) return;
769
- const v = (L) => {
770
- L.key === "Escape" ? x("skip") : L.key === "ArrowRight" ? y() : L.key === "ArrowLeft" && P();
1854
+ }, [L, a]), S = H((y = 0, O = !1) => {
1855
+ const A = $n(s.current);
1856
+ A.length && (E.current = A, f(A), w.current = !0, b.current = !1, g(!0), a.tourStart(A.length, O), k(y));
1857
+ }, [k, a]), $ = H(() => S(0), [S]), T = H(() => L("skip"), [L]), m = H(() => {
1858
+ w.current && (a.track("step_next", { step: I.current }), k(I.current + 1));
1859
+ }, [k, a]), W = H(() => {
1860
+ w.current && k(I.current - 1);
1861
+ }, [k]);
1862
+ P(() => {
1863
+ const y = oe(() => JSON.parse(sessionStorage.getItem("sjTour") || "null"), null), O = s.current;
1864
+ let A;
1865
+ return y && Date.now() - y.t < 3e5 ? A = window.setTimeout(() => S(y.i, !0), 400) : O.autoStart !== !1 && !(O.once && oe(() => localStorage.getItem("sjDone"), null)) && (A = window.setTimeout(() => S(0), 600)), () => clearTimeout(A);
1866
+ }, [S]), P(() => () => {
1867
+ w.current = !1;
1868
+ }, []), P(() => {
1869
+ if (!h) return;
1870
+ const y = (O) => {
1871
+ O.key === "Escape" ? L("skip") : O.key === "ArrowRight" ? m() : O.key === "ArrowLeft" && W();
771
1872
  };
772
- return addEventListener("keydown", v), () => removeEventListener("keydown", v);
773
- }, [l, x, y, P]);
774
- const [A, I] = j(!1), J = F(() => I((v) => !v), []), H = F((v) => s.configure(v), [s]), z = ae(() => ({
775
- tracker: s,
1873
+ return addEventListener("keydown", y), () => removeEventListener("keydown", y);
1874
+ }, [h, L, m, W]);
1875
+ const [D, F] = x(!1), G = H(() => F((y) => !y), []), J = H((y) => a.configure(y), [a]), le = te(() => ({
1876
+ tracker: a,
776
1877
  theme: o,
777
- resolvedTheme: N,
778
- setTheme: d,
779
- open: l,
780
- start: S,
781
- stop: M,
782
- next: y,
783
- back: P,
784
- heat: A,
785
- toggleHeat: J,
786
- configure: H
787
- }), [s, o, N, d, l, S, M, y, P, A, J, H]);
788
- return /* @__PURE__ */ n(ce.Provider, { value: z, children: [
789
- a,
790
- b.length > 0 && /* @__PURE__ */ e(
791
- Re,
1878
+ resolvedTheme: p,
1879
+ setTheme: l,
1880
+ open: h,
1881
+ start: $,
1882
+ stop: T,
1883
+ next: m,
1884
+ back: W,
1885
+ heat: D,
1886
+ toggleHeat: G,
1887
+ configure: J
1888
+ }), [a, o, p, l, h, $, T, m, W, D, G, J]);
1889
+ return /* @__PURE__ */ i(Et.Provider, { value: le, children: [
1890
+ n,
1891
+ u.length > 0 && /* @__PURE__ */ t(
1892
+ Mn,
792
1893
  {
793
- open: l,
794
- anim: w,
795
- theme: N,
796
- steps: b,
797
- index: p,
798
- startLabel: t == null ? void 0 : t.startLabel,
799
- tracker: s,
800
- onNext: y,
801
- onBack: P,
802
- onSkip: M,
803
- onTheme: () => d(N === "dark" ? "light" : "dark")
1894
+ open: h,
1895
+ anim: N,
1896
+ theme: p,
1897
+ steps: u,
1898
+ index: v,
1899
+ startLabel: e == null ? void 0 : e.startLabel,
1900
+ tracker: a,
1901
+ onNext: m,
1902
+ onBack: W,
1903
+ onSkip: T,
1904
+ onTheme: () => l(p === "dark" ? "light" : "dark")
804
1905
  }
805
1906
  ),
806
- A && /* @__PURE__ */ e(Me, { tracker: s })
1907
+ D && /* @__PURE__ */ t(Ln, { tracker: a })
807
1908
  ] });
808
- }, ee = (t) => t < 6e4 ? (t / 1e3).toFixed(1) + "s" : Math.floor(t / 6e4) + "m " + Math.round(t % 6e4 / 1e3) + "s", Fe = `import { JourneyProvider } from '@shiva004/surveys';
1909
+ }, be = (e) => e < 6e4 ? (e / 1e3).toFixed(1) + "s" : Math.floor(e / 6e4) + "m " + Math.round(e % 6e4 / 1e3) + "s", Cn = `import { JourneyProvider } from '@shiva004/surveys';
809
1910
 
810
1911
  <JourneyProvider
811
1912
  config={{
@@ -821,189 +1922,201 @@ const _ = (t, a) => {
821
1922
  }}
822
1923
  >
823
1924
  <App />
824
- </JourneyProvider>`, Oe = ({ open: t, onClose: a }) => {
825
- const { toggleHeat: i, configure: s } = ie(), o = Ae(), [u, T] = j("m"), g = location.pathname + location.hash, N = o.pages[g] || { ms: 0, depth: 0 }, d = o.started ? Math.round(o.completed / o.started * 100) + "%" : "–", l = [["Time on page", ee(N.ms)], ["Scrolling", ee(o.scrollMs)], ["Scroll depth", N.depth + "%"], ["Clicks", o.clicks], ["Completion", d], ["Navigations", o.nav]], h = Object.entries(o.steps).sort((m, p) => +m[0] - +p[0]), b = Math.max(1, ...h.map((m) => m[1].ms));
826
- return /* @__PURE__ */ n("aside", { className: `nw-ins${t ? " open" : ""}`, "data-sj-ignore": !0, "aria-label": "Journey insights", children: [
827
- /* @__PURE__ */ n("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
828
- /* @__PURE__ */ e("strong", { children: "Journey insights" }),
829
- /* @__PURE__ */ e("button", { className: "nw-x", onClick: a, "aria-label": "Close", children: "×" })
1925
+ </JourneyProvider>`, jn = ({ open: e, onClose: n }) => {
1926
+ const { toggleHeat: s, configure: a } = ze(), o = In(), [c, d] = x("m"), r = location.pathname + location.hash, p = o.pages[r] || { ms: 0, depth: 0 }, l = o.started ? Math.round(o.completed / o.started * 100) + "%" : "–", h = [["Time on page", be(p.ms)], ["Scrolling", be(o.scrollMs)], ["Scroll depth", p.depth + "%"], ["Clicks", o.clicks], ["Completion", l], ["Navigations", o.nav]], g = Object.entries(o.steps).sort((f, v) => +f[0] - +v[0]), u = Math.max(1, ...g.map((f) => f[1].ms));
1927
+ return /* @__PURE__ */ i("aside", { className: `nw-ins${e ? " open" : ""}`, "data-sj-ignore": !0, "aria-label": "Journey insights", children: [
1928
+ /* @__PURE__ */ i("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
1929
+ /* @__PURE__ */ t("strong", { children: "Journey insights" }),
1930
+ /* @__PURE__ */ t("button", { className: "nw-x", onClick: n, "aria-label": "Close", children: "×" })
830
1931
  ] }),
831
- /* @__PURE__ */ e("div", { className: "nw-tabs", children: [["m", "Metrics"], ["e", "Events"], ["c", "Embed"]].map(([m, p]) => /* @__PURE__ */ e("button", { className: u === m ? "on" : "", onClick: () => T(m), children: p }, m)) }),
832
- u === "m" && /* @__PURE__ */ n(V, { children: [
833
- /* @__PURE__ */ e("div", { className: "nw-kpis", children: l.map(([m, p]) => /* @__PURE__ */ n("div", { className: "nw-kpi", children: [
834
- /* @__PURE__ */ e("small", { children: m }),
835
- /* @__PURE__ */ e("b", { children: p })
836
- ] }, m)) }),
837
- /* @__PURE__ */ e("h4", { children: "Time per page" }),
838
- Object.entries(o.pages).map(([m, p]) => /* @__PURE__ */ n("div", { className: "nw-row", children: [
839
- /* @__PURE__ */ e("span", { children: m }),
840
- /* @__PURE__ */ n("span", { children: [
841
- ee(p.ms),
1932
+ /* @__PURE__ */ t("div", { className: "nw-tabs", children: [["m", "Metrics"], ["e", "Events"], ["c", "Embed"]].map(([f, v]) => /* @__PURE__ */ t("button", { className: c === f ? "on" : "", onClick: () => d(f), children: v }, f)) }),
1933
+ c === "m" && /* @__PURE__ */ i(B, { children: [
1934
+ /* @__PURE__ */ t("div", { className: "nw-kpis", children: h.map(([f, v]) => /* @__PURE__ */ i("div", { className: "nw-kpi", children: [
1935
+ /* @__PURE__ */ t("small", { children: f }),
1936
+ /* @__PURE__ */ t("b", { children: v })
1937
+ ] }, f)) }),
1938
+ /* @__PURE__ */ t("h4", { children: "Time per page" }),
1939
+ Object.entries(o.pages).map(([f, v]) => /* @__PURE__ */ i("div", { className: "nw-row", children: [
1940
+ /* @__PURE__ */ t("span", { children: f }),
1941
+ /* @__PURE__ */ i("span", { children: [
1942
+ be(v.ms),
842
1943
  " · ",
843
- p.depth,
1944
+ v.depth,
844
1945
  "% deep"
845
1946
  ] })
846
- ] }, m)),
847
- /* @__PURE__ */ e("h4", { children: "Walkthrough funnel and drop-offs" }),
848
- h.length ? h.map(([m, p]) => /* @__PURE__ */ n(ue.Fragment, { children: [
849
- /* @__PURE__ */ n("div", { className: "nw-row", children: [
850
- /* @__PURE__ */ n("span", { children: [
851
- +m + 1,
1947
+ ] }, f)),
1948
+ /* @__PURE__ */ t("h4", { children: "Walkthrough funnel and drop-offs" }),
1949
+ g.length ? g.map(([f, v]) => /* @__PURE__ */ i(Lt.Fragment, { children: [
1950
+ /* @__PURE__ */ i("div", { className: "nw-row", children: [
1951
+ /* @__PURE__ */ i("span", { children: [
1952
+ +f + 1,
852
1953
  ". ",
853
- p.title
1954
+ v.title
854
1955
  ] }),
855
- /* @__PURE__ */ n("span", { children: [
856
- p.views,
1956
+ /* @__PURE__ */ i("span", { children: [
1957
+ v.views,
857
1958
  "× · ",
858
- ee(p.ms),
859
- o.drops[+m] ? /* @__PURE__ */ n(V, { children: [
1959
+ be(v.ms),
1960
+ o.drops[+f] ? /* @__PURE__ */ i(B, { children: [
860
1961
  " · ",
861
- /* @__PURE__ */ n("b", { className: "nw-warn", children: [
862
- o.drops[+m],
1962
+ /* @__PURE__ */ i("b", { className: "nw-warn", children: [
1963
+ o.drops[+f],
863
1964
  " dropped"
864
1965
  ] })
865
1966
  ] }) : null
866
1967
  ] })
867
1968
  ] }),
868
- /* @__PURE__ */ e("div", { className: "nw-meter", children: /* @__PURE__ */ e("i", { style: { width: Math.round(p.ms / b * 100) + "%" } }) })
869
- ] }, m)) : /* @__PURE__ */ n("div", { className: "nw-row", children: [
870
- /* @__PURE__ */ e("span", { children: "No tour data yet" }),
871
- /* @__PURE__ */ e("span", {})
1969
+ /* @__PURE__ */ t("div", { className: "nw-meter", children: /* @__PURE__ */ t("i", { style: { width: Math.round(v.ms / u * 100) + "%" } }) })
1970
+ ] }, f)) : /* @__PURE__ */ i("div", { className: "nw-row", children: [
1971
+ /* @__PURE__ */ t("span", { children: "No tour data yet" }),
1972
+ /* @__PURE__ */ t("span", {})
872
1973
  ] }),
873
- /* @__PURE__ */ e("h4", { children: "Heatmap" }),
874
- /* @__PURE__ */ e("button", { className: "nw-btn", onClick: i, children: "Toggle heatmap overlay" })
1974
+ /* @__PURE__ */ t("h4", { children: "Heatmap" }),
1975
+ /* @__PURE__ */ t("button", { className: "nw-btn", onClick: s, children: "Toggle heatmap overlay" })
875
1976
  ] }),
876
- u === "e" && o.log.slice(0, 30).map((m, p) => /* @__PURE__ */ n("div", { className: "nw-row", children: [
877
- /* @__PURE__ */ e("span", { children: m.type }),
878
- /* @__PURE__ */ n("span", { children: [
879
- String(m.title || m.sel || m.pct || m.n || m.to || m.theme || ""),
1977
+ c === "e" && o.log.slice(0, 30).map((f, v) => /* @__PURE__ */ i("div", { className: "nw-row", children: [
1978
+ /* @__PURE__ */ t("span", { children: f.type }),
1979
+ /* @__PURE__ */ i("span", { children: [
1980
+ String(f.title || f.sel || f.pct || f.n || f.to || f.theme || ""),
880
1981
  " · ",
881
- new Date(m.t).toLocaleTimeString()
1982
+ new Date(f.t).toLocaleTimeString()
882
1983
  ] })
883
- ] }, `${m.t}-${p}`)),
884
- u === "c" && /* @__PURE__ */ n(V, { children: [
885
- /* @__PURE__ */ e("h4", { children: "Install in a React app" }),
886
- /* @__PURE__ */ e("pre", { children: Fe }),
887
- /* @__PURE__ */ n("p", { children: [
1984
+ ] }, `${f.t}-${v}`)),
1985
+ c === "c" && /* @__PURE__ */ i(B, { children: [
1986
+ /* @__PURE__ */ t("h4", { children: "Install in a React app" }),
1987
+ /* @__PURE__ */ t("pre", { children: Cn }),
1988
+ /* @__PURE__ */ i("p", { children: [
888
1989
  "No ",
889
- /* @__PURE__ */ e("code", { children: "steps" }),
1990
+ /* @__PURE__ */ t("code", { children: "steps" }),
890
1991
  "? Add ",
891
- /* @__PURE__ */ e("code", { children: "data-sj-title" }),
1992
+ /* @__PURE__ */ t("code", { children: "data-sj-title" }),
892
1993
  ", ",
893
- /* @__PURE__ */ e("code", { children: "data-sj-body" }),
1994
+ /* @__PURE__ */ t("code", { children: "data-sj-body" }),
894
1995
  ", ",
895
- /* @__PURE__ */ e("code", { children: "data-sj-place" }),
1996
+ /* @__PURE__ */ t("code", { children: "data-sj-place" }),
896
1997
  " and ",
897
- /* @__PURE__ */ e("code", { children: "data-sj-step" }),
1998
+ /* @__PURE__ */ t("code", { children: "data-sj-step" }),
898
1999
  " to any element, or it falls back to the page’s header, nav, sections and footer. A step with ",
899
- /* @__PURE__ */ e("code", { children: "page" }),
2000
+ /* @__PURE__ */ t("code", { children: "page" }),
900
2001
  " continues the tour after navigating."
901
2002
  ] }),
902
- /* @__PURE__ */ e("h4", { children: "Backend endpoint" }),
903
- /* @__PURE__ */ e("input", { placeholder: "/api/journey/events", onChange: (m) => s({ endpoint: m.target.value.trim() }) }),
904
- /* @__PURE__ */ n("p", { children: [
2003
+ /* @__PURE__ */ t("h4", { children: "Backend endpoint" }),
2004
+ /* @__PURE__ */ t("input", { placeholder: "/api/journey/events", onChange: (f) => a({ endpoint: f.target.value.trim() }) }),
2005
+ /* @__PURE__ */ i("p", { children: [
905
2006
  "Run ",
906
- /* @__PURE__ */ e("code", { children: "node server.js" }),
2007
+ /* @__PURE__ */ t("code", { children: "node server.js" }),
907
2008
  ", open ",
908
- /* @__PURE__ */ e("code", { children: "http://localhost:4000/?api=/api/journey/events" }),
2009
+ /* @__PURE__ */ t("code", { children: "http://localhost:4000/?api=/api/journey/events" }),
909
2010
  ". Without an endpoint it runs in dry-run mode and the Events tab shows each flush."
910
2011
  ] })
911
2012
  ] })
912
2013
  ] });
913
- }, $e = () => {
914
- const { start: t, setTheme: a, resolvedTheme: i } = ie(), [s, o] = j(!1);
915
- return /* @__PURE__ */ n("div", { className: "nw", id: "top", children: [
916
- /* @__PURE__ */ n("header", { className: "nw-head", "data-sj-step": 1, "data-sj-title": "Main navigation", "data-sj-body": "Jump between Features, Pricing and Contact from here. It stays visible as you scroll.", "data-sj-place": "bottom", children: [
917
- /* @__PURE__ */ n("a", { className: "nw-logo", href: "#top", children: [
918
- /* @__PURE__ */ e("i", { children: "◆" }),
2014
+ }, Rn = () => {
2015
+ const { start: e, setTheme: n, resolvedTheme: s } = ze(), [a, o] = x(!1);
2016
+ return /* @__PURE__ */ i("div", { className: "nw", id: "top", children: [
2017
+ /* @__PURE__ */ i("header", { className: "nw-head", "data-sj-step": 1, "data-sj-title": "Main navigation", "data-sj-body": "Jump between Features, Pricing and Contact from here. It stays visible as you scroll.", "data-sj-place": "bottom", children: [
2018
+ /* @__PURE__ */ i("a", { className: "nw-logo", href: "#top", children: [
2019
+ /* @__PURE__ */ t("i", { children: "◆" }),
919
2020
  " Northwind"
920
2021
  ] }),
921
- /* @__PURE__ */ n("nav", { className: "nw-nav", children: [
922
- /* @__PURE__ */ e("a", { href: "#features", children: "Features" }),
923
- /* @__PURE__ */ e("a", { href: "#pricing", children: "Pricing" }),
924
- /* @__PURE__ */ e("a", { href: "#contact", children: "Contact" })
2022
+ /* @__PURE__ */ i("nav", { className: "nw-nav", children: [
2023
+ /* @__PURE__ */ t("a", { href: "#features", children: "Features" }),
2024
+ /* @__PURE__ */ t("a", { href: "#pricing", children: "Pricing" }),
2025
+ /* @__PURE__ */ t("a", { href: "#contact", children: "Contact" })
925
2026
  ] }),
926
- /* @__PURE__ */ e("button", { className: "nw-btn", id: "srch", "data-sj-step": 2, "data-sj-title": "Search", "data-sj-body": "Find any page or help article instantly.", "data-sj-place": "left", children: "Search" })
2027
+ /* @__PURE__ */ t("button", { className: "nw-btn", id: "srch", "data-sj-step": 2, "data-sj-title": "Search", "data-sj-body": "Find any page or help article instantly.", "data-sj-place": "left", children: "Search" })
927
2028
  ] }),
928
- /* @__PURE__ */ n("main", { className: "nw-wrap", children: [
929
- /* @__PURE__ */ n("section", { className: "nw-hero", children: [
930
- /* @__PURE__ */ e("h1", { children: "Ship products people actually finish onboarding." }),
931
- /* @__PURE__ */ e("p", { children: "Northwind is a sample site. The walkthrough reads each element’s position at runtime, so the same component fits any layout." }),
932
- /* @__PURE__ */ n("div", { className: "nw-acts", children: [
933
- /* @__PURE__ */ e("a", { className: "nw-btn p", href: "#pricing", "data-sj-step": 3, "data-sj-title": "Primary action", "data-sj-body": "Start here. This button takes new visitors straight to the plans. You can click it while it is highlighted.", "data-sj-place": "right", children: "Get started" }),
934
- /* @__PURE__ */ e("a", { className: "nw-btn", href: "#features", children: "See features" })
2029
+ /* @__PURE__ */ i("main", { className: "nw-wrap", children: [
2030
+ /* @__PURE__ */ i("section", { className: "nw-hero", children: [
2031
+ /* @__PURE__ */ t("h1", { children: "Ship products people actually finish onboarding." }),
2032
+ /* @__PURE__ */ t("p", { children: "Northwind is a sample site. The walkthrough reads each element’s position at runtime, so the same component fits any layout." }),
2033
+ /* @__PURE__ */ i("div", { className: "nw-acts", children: [
2034
+ /* @__PURE__ */ t("a", { className: "nw-btn p", href: "#pricing", "data-sj-step": 3, "data-sj-title": "Primary action", "data-sj-body": "Start here. This button takes new visitors straight to the plans. You can click it while it is highlighted.", "data-sj-place": "right", children: "Get started" }),
2035
+ /* @__PURE__ */ t("a", { className: "nw-btn", href: "#features", children: "See features" })
935
2036
  ] })
936
2037
  ] }),
937
- /* @__PURE__ */ n("section", { id: "features", "data-sj-step": 4, "data-sj-title": "Feature overview", "data-sj-body": "Three things Northwind does best. Large sections are fitted to the screen automatically.", "data-sj-place": "top", children: [
938
- /* @__PURE__ */ e("h2", { children: "Features" }),
939
- /* @__PURE__ */ n("div", { className: "nw-grid", children: [
940
- /* @__PURE__ */ n("div", { className: "nw-card", children: [
941
- /* @__PURE__ */ e("h3", { children: "Live analytics" }),
942
- /* @__PURE__ */ e("p", { children: "Page time, scroll depth and clicks, collected as people browse." })
2038
+ /* @__PURE__ */ i("section", { id: "features", "data-sj-step": 4, "data-sj-title": "Feature overview", "data-sj-body": "Three things Northwind does best. Large sections are fitted to the screen automatically.", "data-sj-place": "top", children: [
2039
+ /* @__PURE__ */ t("h2", { children: "Features" }),
2040
+ /* @__PURE__ */ i("div", { className: "nw-grid", children: [
2041
+ /* @__PURE__ */ i("div", { className: "nw-card", children: [
2042
+ /* @__PURE__ */ t("h3", { children: "Live analytics" }),
2043
+ /* @__PURE__ */ t("p", { children: "Page time, scroll depth and clicks, collected as people browse." })
943
2044
  ] }),
944
- /* @__PURE__ */ n("div", { className: "nw-card", children: [
945
- /* @__PURE__ */ e("h3", { children: "Heatmaps" }),
946
- /* @__PURE__ */ e("p", { children: "See where attention gathers and where it never reaches." })
2045
+ /* @__PURE__ */ i("div", { className: "nw-card", children: [
2046
+ /* @__PURE__ */ t("h3", { children: "Heatmaps" }),
2047
+ /* @__PURE__ */ t("p", { children: "See where attention gathers and where it never reaches." })
947
2048
  ] }),
948
- /* @__PURE__ */ n("div", { className: "nw-card", children: [
949
- /* @__PURE__ */ e("h3", { children: "Guided tours" }),
950
- /* @__PURE__ */ e("p", { children: "Spotlight any element with a popup that repositions itself." })
2049
+ /* @__PURE__ */ i("div", { className: "nw-card", children: [
2050
+ /* @__PURE__ */ t("h3", { children: "Guided tours" }),
2051
+ /* @__PURE__ */ t("p", { children: "Spotlight any element with a popup that repositions itself." })
951
2052
  ] })
952
2053
  ] })
953
2054
  ] }),
954
- /* @__PURE__ */ n("section", { id: "pricing", children: [
955
- /* @__PURE__ */ e("h2", { children: "Pricing" }),
956
- /* @__PURE__ */ n("div", { className: "nw-grid", children: [
957
- /* @__PURE__ */ n("div", { className: "nw-card", children: [
958
- /* @__PURE__ */ e("h3", { children: "Starter" }),
959
- /* @__PURE__ */ e("div", { className: "nw-big", children: "$0" }),
960
- /* @__PURE__ */ e("p", { children: "For side projects." })
2055
+ /* @__PURE__ */ i("section", { id: "pricing", children: [
2056
+ /* @__PURE__ */ t("h2", { children: "Pricing" }),
2057
+ /* @__PURE__ */ i("div", { className: "nw-grid", children: [
2058
+ /* @__PURE__ */ i("div", { className: "nw-card", children: [
2059
+ /* @__PURE__ */ t("h3", { children: "Starter" }),
2060
+ /* @__PURE__ */ t("div", { className: "nw-big", children: "$0" }),
2061
+ /* @__PURE__ */ t("p", { children: "For side projects." })
961
2062
  ] }),
962
- /* @__PURE__ */ n("div", { className: "nw-card", children: [
963
- /* @__PURE__ */ e("h3", { children: "Team" }),
964
- /* @__PURE__ */ e("div", { className: "nw-big", children: "$29" }),
965
- /* @__PURE__ */ e("p", { children: "For growing teams." })
2063
+ /* @__PURE__ */ i("div", { className: "nw-card", children: [
2064
+ /* @__PURE__ */ t("h3", { children: "Team" }),
2065
+ /* @__PURE__ */ t("div", { className: "nw-big", children: "$29" }),
2066
+ /* @__PURE__ */ t("p", { children: "For growing teams." })
966
2067
  ] }),
967
- /* @__PURE__ */ n("div", { className: "nw-card hot", "data-sj-step": 5, "data-sj-title": "Recommended plan", "data-sj-body": "Most teams pick this one. The popup flips sides on its own when there is no room.", "data-sj-place": "left", children: [
968
- /* @__PURE__ */ e("h3", { children: "Scale" }),
969
- /* @__PURE__ */ e("div", { className: "nw-big", children: "$99" }),
970
- /* @__PURE__ */ e("p", { children: "Unlimited journeys and exports." })
2068
+ /* @__PURE__ */ i("div", { className: "nw-card hot", "data-sj-step": 5, "data-sj-title": "Recommended plan", "data-sj-body": "Most teams pick this one. The popup flips sides on its own when there is no room.", "data-sj-place": "left", children: [
2069
+ /* @__PURE__ */ t("h3", { children: "Scale" }),
2070
+ /* @__PURE__ */ t("div", { className: "nw-big", children: "$99" }),
2071
+ /* @__PURE__ */ t("p", { children: "Unlimited journeys and exports." })
971
2072
  ] })
972
2073
  ] })
973
2074
  ] }),
974
- /* @__PURE__ */ n("section", { id: "contact", children: [
975
- /* @__PURE__ */ e("h2", { children: "Contact" }),
976
- /* @__PURE__ */ e("div", { className: "nw-card", children: /* @__PURE__ */ e("p", { children: "hello@northwind.example: we reply within a day." }) })
2075
+ /* @__PURE__ */ i("section", { id: "contact", children: [
2076
+ /* @__PURE__ */ t("h2", { children: "Contact" }),
2077
+ /* @__PURE__ */ t("div", { className: "nw-card", children: /* @__PURE__ */ t("p", { children: "hello@northwind.example: we reply within a day." }) })
977
2078
  ] })
978
2079
  ] }),
979
- /* @__PURE__ */ e("footer", { className: "nw-foot", "data-sj-step": 6, "data-sj-title": "Footer and help", "data-sj-body": "Legal links, support and contact details live down here.", "data-sj-place": "top", children: "© Northwind · Privacy · Terms · Status" }),
980
- /* @__PURE__ */ n("div", { className: "nw-dock", "data-sj-ignore": !0, children: [
981
- /* @__PURE__ */ e("button", { onClick: t, children: "▶ Tour" }),
982
- /* @__PURE__ */ e("button", { onClick: () => a(i === "dark" ? "light" : "dark"), children: "◐ Theme" }),
983
- /* @__PURE__ */ e("button", { onClick: () => o((u) => !u), children: "▤ Insights" })
2080
+ /* @__PURE__ */ t("footer", { className: "nw-foot", "data-sj-step": 6, "data-sj-title": "Footer and help", "data-sj-body": "Legal links, support and contact details live down here.", "data-sj-place": "top", children: "© Northwind · Privacy · Terms · Status" }),
2081
+ /* @__PURE__ */ i("div", { className: "nw-dock", "data-sj-ignore": !0, children: [
2082
+ /* @__PURE__ */ t("button", { onClick: e, children: "▶ Tour" }),
2083
+ /* @__PURE__ */ t("button", { onClick: () => n(s === "dark" ? "light" : "dark"), children: "◐ Theme" }),
2084
+ /* @__PURE__ */ t("button", { onClick: () => o((c) => !c), children: "▤ Insights" })
984
2085
  ] }),
985
- /* @__PURE__ */ e(Oe, { open: s, onClose: () => o(!1) })
2086
+ /* @__PURE__ */ t(jn, { open: a, onClose: () => o(!1) })
986
2087
  ] });
987
- }, He = ({ endpoint: t, config: a }) => /* @__PURE__ */ e(
988
- Ie,
2088
+ }, Wn = ({ endpoint: e, config: n }) => /* @__PURE__ */ t(
2089
+ Tn,
989
2090
  {
990
2091
  config: {
991
- endpoint: t ?? new URLSearchParams(location.search).get("api") ?? "",
2092
+ endpoint: e ?? new URLSearchParams(location.search).get("api") ?? "",
992
2093
  theme: "auto",
993
2094
  welcome: { title: "Welcome to Northwind", body: "Take a 30-second tour of the key parts of this site. Skip any time, or use the arrow keys." },
994
2095
  outro: { title: "You’re all set", body: "Open Insights to see the time, scroll depth, clicks and heatmap this session just generated." },
995
- ...a
2096
+ ...n
996
2097
  },
997
- children: /* @__PURE__ */ e($e, {})
2098
+ children: /* @__PURE__ */ t(Rn, {})
998
2099
  }
999
2100
  );
1000
2101
  export {
1001
- ye as FeedbackApp,
1002
- Ie as JourneyProvider,
1003
- Ee as JourneyTracker,
1004
- Se as LogsApp,
1005
- Be as LogsFeedbackApp,
1006
- He as WalkthroughDemo,
1007
- ie as useJourney,
1008
- Ae as useJourneyStats
2102
+ Pt as FeedbackApp,
2103
+ yn as HeatmapApp,
2104
+ Tn as JourneyProvider,
2105
+ xn as JourneyTracker,
2106
+ on as LogsApp,
2107
+ Hn as LogsFeedbackApp,
2108
+ Wn as WalkthroughDemo,
2109
+ hn as clearHeatmap,
2110
+ Le as createLogger,
2111
+ V as formatLocalTime,
2112
+ at as getHeatmapData,
2113
+ ut as getNetworkInfo,
2114
+ Qt as isPublicLookupEnabled,
2115
+ Dn as logger,
2116
+ Zt as refreshNetwork,
2117
+ Kt as setNetworkName,
2118
+ Xt as setPublicLookup,
2119
+ St as startHeatmapCapture,
2120
+ ze as useJourney,
2121
+ In as useJourneyStats
1009
2122
  };