@supportwire/messenger-js-sdk 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1092 @@
1
+ var ee = Object.getOwnPropertySymbols, Pe = Object.prototype.hasOwnProperty, Me = Object.prototype.propertyIsEnumerable, je = (t, e) => {
2
+ var n = {};
3
+ for (var i in t)
4
+ Pe.call(t, i) && e.indexOf(i) < 0 && (n[i] = t[i]);
5
+ if (t != null && ee)
6
+ for (var i of ee(t))
7
+ e.indexOf(i) < 0 && Me.call(t, i) && (n[i] = t[i]);
8
+ return n;
9
+ };
10
+ const O = globalThis, te = (t) => t, P = O.trustedTypes, ne = P ? P.createPolicy("lit-html", { createHTML: (t) => t }) : void 0, ge = "$lit$", x = `lit$${Math.random().toFixed(9).slice(2)}$`, ve = "?" + x, ze = `<${ve}>`, w = document, E = () => w.createComment(""), S = (t) => t === null || typeof t != "object" && typeof t != "function", D = Array.isArray, Be = (t) => D(t) || typeof t?.[Symbol.iterator] == "function", z = `[
11
+ \f\r]`, k = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ie = /-->/g, oe = />/g, $ = RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^
12
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), re = /'/g, se = /"/g, be = /^(?:script|style|textarea|title)$/i, Re = (t) => (e, ...n) => ({ _$litType$: t, strings: e, values: n }), m = Re(1), C = /* @__PURE__ */ Symbol.for("lit-noChange"), f = /* @__PURE__ */ Symbol.for("lit-nothing"), le = /* @__PURE__ */ new WeakMap(), y = w.createTreeWalker(w, 129);
13
+ function xe(t, e) {
14
+ if (!D(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
15
+ return ne !== void 0 ? ne.createHTML(e) : e;
16
+ }
17
+ const Fe = (t, e) => {
18
+ const n = t.length - 1, i = [];
19
+ let o, r = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", l = k;
20
+ for (let c = 0; c < n; c++) {
21
+ const u = t[c];
22
+ let d, h, p = -1, v = 0;
23
+ for (; v < u.length && (l.lastIndex = v, h = l.exec(u), h !== null); ) v = l.lastIndex, l === k ? h[1] === "!--" ? l = ie : h[1] !== void 0 ? l = oe : h[2] !== void 0 ? (be.test(h[2]) && (o = RegExp("</" + h[2], "g")), l = $) : h[3] !== void 0 && (l = $) : l === $ ? h[0] === ">" ? (l = o ?? k, p = -1) : h[1] === void 0 ? p = -2 : (p = l.lastIndex - h[2].length, d = h[1], l = h[3] === void 0 ? $ : h[3] === '"' ? se : re) : l === se || l === re ? l = $ : l === ie || l === oe ? l = k : (l = $, o = void 0);
24
+ const b = l === $ && t[c + 1].startsWith("/>") ? " " : "";
25
+ r += l === k ? u + ze : p >= 0 ? (i.push(d), u.slice(0, p) + ge + u.slice(p) + x + b) : u + x + (p === -2 ? c : b);
26
+ }
27
+ return [xe(t, r + (t[n] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
28
+ };
29
+ class T {
30
+ constructor({ strings: e, _$litType$: n }, i) {
31
+ let o;
32
+ this.parts = [];
33
+ let r = 0, l = 0;
34
+ const c = e.length - 1, u = this.parts, [d, h] = Fe(e, n);
35
+ if (this.el = T.createElement(d, i), y.currentNode = this.el.content, n === 2 || n === 3) {
36
+ const p = this.el.content.firstChild;
37
+ p.replaceWith(...p.childNodes);
38
+ }
39
+ for (; (o = y.nextNode()) !== null && u.length < c; ) {
40
+ if (o.nodeType === 1) {
41
+ if (o.hasAttributes()) for (const p of o.getAttributeNames()) if (p.endsWith(ge)) {
42
+ const v = h[l++], b = o.getAttribute(p).split(x), H = /([.?@])?(.*)/.exec(v);
43
+ u.push({ type: 1, index: r, name: H[2], strings: b, ctor: H[1] === "." ? De : H[1] === "?" ? Ue : H[1] === "@" ? Ve : M }), o.removeAttribute(p);
44
+ } else p.startsWith(x) && (u.push({ type: 6, index: r }), o.removeAttribute(p));
45
+ if (be.test(o.tagName)) {
46
+ const p = o.textContent.split(x), v = p.length - 1;
47
+ if (v > 0) {
48
+ o.textContent = P ? P.emptyScript : "";
49
+ for (let b = 0; b < v; b++) o.append(p[b], E()), y.nextNode(), u.push({ type: 2, index: ++r });
50
+ o.append(p[v], E());
51
+ }
52
+ }
53
+ } else if (o.nodeType === 8) if (o.data === ve) u.push({ type: 2, index: r });
54
+ else {
55
+ let p = -1;
56
+ for (; (p = o.data.indexOf(x, p + 1)) !== -1; ) u.push({ type: 7, index: r }), p += x.length - 1;
57
+ }
58
+ r++;
59
+ }
60
+ }
61
+ static createElement(e, n) {
62
+ const i = w.createElement("template");
63
+ return i.innerHTML = e, i;
64
+ }
65
+ }
66
+ function I(t, e, n = t, i) {
67
+ var o, r, l;
68
+ if (e === C) return e;
69
+ let c = i !== void 0 ? (o = n._$Co) == null ? void 0 : o[i] : n._$Cl;
70
+ const u = S(e) ? void 0 : e._$litDirective$;
71
+ return c?.constructor !== u && ((r = c?._$AO) == null || r.call(c, !1), u === void 0 ? c = void 0 : (c = new u(t), c._$AT(t, n, i)), i !== void 0 ? ((l = n._$Co) != null ? l : n._$Co = [])[i] = c : n._$Cl = c), c !== void 0 && (e = I(t, c._$AS(t, e.values), c, i)), e;
72
+ }
73
+ class qe {
74
+ constructor(e, n) {
75
+ this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = n;
76
+ }
77
+ get parentNode() {
78
+ return this._$AM.parentNode;
79
+ }
80
+ get _$AU() {
81
+ return this._$AM._$AU;
82
+ }
83
+ u(e) {
84
+ var n;
85
+ const { el: { content: i }, parts: o } = this._$AD, r = ((n = e?.creationScope) != null ? n : w).importNode(i, !0);
86
+ y.currentNode = r;
87
+ let l = y.nextNode(), c = 0, u = 0, d = o[0];
88
+ for (; d !== void 0; ) {
89
+ if (c === d.index) {
90
+ let h;
91
+ d.type === 2 ? h = new N(l, l.nextSibling, this, e) : d.type === 1 ? h = new d.ctor(l, d.name, d.strings, this, e) : d.type === 6 && (h = new We(l, this, e)), this._$AV.push(h), d = o[++u];
92
+ }
93
+ c !== d?.index && (l = y.nextNode(), c++);
94
+ }
95
+ return y.currentNode = w, r;
96
+ }
97
+ p(e) {
98
+ let n = 0;
99
+ for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(e, i, n), n += i.strings.length - 2) : i._$AI(e[n])), n++;
100
+ }
101
+ }
102
+ class N {
103
+ get _$AU() {
104
+ var e, n;
105
+ return (n = (e = this._$AM) == null ? void 0 : e._$AU) != null ? n : this._$Cv;
106
+ }
107
+ constructor(e, n, i, o) {
108
+ var r;
109
+ this.type = 2, this._$AH = f, this._$AN = void 0, this._$AA = e, this._$AB = n, this._$AM = i, this.options = o, this._$Cv = (r = o?.isConnected) != null ? r : !0;
110
+ }
111
+ get parentNode() {
112
+ let e = this._$AA.parentNode;
113
+ const n = this._$AM;
114
+ return n !== void 0 && e?.nodeType === 11 && (e = n.parentNode), e;
115
+ }
116
+ get startNode() {
117
+ return this._$AA;
118
+ }
119
+ get endNode() {
120
+ return this._$AB;
121
+ }
122
+ _$AI(e, n = this) {
123
+ e = I(this, e, n), S(e) ? e === f || e == null || e === "" ? (this._$AH !== f && this._$AR(), this._$AH = f) : e !== this._$AH && e !== C && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Be(e) ? this.k(e) : this._(e);
124
+ }
125
+ O(e) {
126
+ return this._$AA.parentNode.insertBefore(e, this._$AB);
127
+ }
128
+ T(e) {
129
+ this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
130
+ }
131
+ _(e) {
132
+ this._$AH !== f && S(this._$AH) ? this._$AA.nextSibling.data = e : this.T(w.createTextNode(e)), this._$AH = e;
133
+ }
134
+ $(e) {
135
+ var n;
136
+ const { values: i, _$litType$: o } = e, r = typeof o == "number" ? this._$AC(e) : (o.el === void 0 && (o.el = T.createElement(xe(o.h, o.h[0]), this.options)), o);
137
+ if (((n = this._$AH) == null ? void 0 : n._$AD) === r) this._$AH.p(i);
138
+ else {
139
+ const l = new qe(r, this), c = l.u(this.options);
140
+ l.p(i), this.T(c), this._$AH = l;
141
+ }
142
+ }
143
+ _$AC(e) {
144
+ let n = le.get(e.strings);
145
+ return n === void 0 && le.set(e.strings, n = new T(e)), n;
146
+ }
147
+ k(e) {
148
+ D(this._$AH) || (this._$AH = [], this._$AR());
149
+ const n = this._$AH;
150
+ let i, o = 0;
151
+ for (const r of e) o === n.length ? n.push(i = new N(this.O(E()), this.O(E()), this, this.options)) : i = n[o], i._$AI(r), o++;
152
+ o < n.length && (this._$AR(i && i._$AB.nextSibling, o), n.length = o);
153
+ }
154
+ _$AR(e = this._$AA.nextSibling, n) {
155
+ var i;
156
+ for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, n); e !== this._$AB; ) {
157
+ const o = te(e).nextSibling;
158
+ te(e).remove(), e = o;
159
+ }
160
+ }
161
+ setConnected(e) {
162
+ var n;
163
+ this._$AM === void 0 && (this._$Cv = e, (n = this._$AP) == null || n.call(this, e));
164
+ }
165
+ }
166
+ class M {
167
+ get tagName() {
168
+ return this.element.tagName;
169
+ }
170
+ get _$AU() {
171
+ return this._$AM._$AU;
172
+ }
173
+ constructor(e, n, i, o, r) {
174
+ this.type = 1, this._$AH = f, this._$AN = void 0, this.element = e, this.name = n, this._$AM = o, this.options = r, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = f;
175
+ }
176
+ _$AI(e, n = this, i, o) {
177
+ const r = this.strings;
178
+ let l = !1;
179
+ if (r === void 0) e = I(this, e, n, 0), l = !S(e) || e !== this._$AH && e !== C, l && (this._$AH = e);
180
+ else {
181
+ const c = e;
182
+ let u, d;
183
+ for (e = r[0], u = 0; u < r.length - 1; u++) d = I(this, c[i + u], n, u), d === C && (d = this._$AH[u]), l || (l = !S(d) || d !== this._$AH[u]), d === f ? e = f : e !== f && (e += (d ?? "") + r[u + 1]), this._$AH[u] = d;
184
+ }
185
+ l && !o && this.j(e);
186
+ }
187
+ j(e) {
188
+ e === f ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
189
+ }
190
+ }
191
+ class De extends M {
192
+ constructor() {
193
+ super(...arguments), this.type = 3;
194
+ }
195
+ j(e) {
196
+ this.element[this.name] = e === f ? void 0 : e;
197
+ }
198
+ }
199
+ class Ue extends M {
200
+ constructor() {
201
+ super(...arguments), this.type = 4;
202
+ }
203
+ j(e) {
204
+ this.element.toggleAttribute(this.name, !!e && e !== f);
205
+ }
206
+ }
207
+ class Ve extends M {
208
+ constructor(e, n, i, o, r) {
209
+ super(e, n, i, o, r), this.type = 5;
210
+ }
211
+ _$AI(e, n = this) {
212
+ var i;
213
+ if ((e = (i = I(this, e, n, 0)) != null ? i : f) === C) return;
214
+ const o = this._$AH, r = e === f && o !== f || e.capture !== o.capture || e.once !== o.once || e.passive !== o.passive, l = e !== f && (o === f || r);
215
+ r && this.element.removeEventListener(this.name, this, o), l && this.element.addEventListener(this.name, this, e), this._$AH = e;
216
+ }
217
+ handleEvent(e) {
218
+ var n, i;
219
+ typeof this._$AH == "function" ? this._$AH.call((i = (n = this.options) == null ? void 0 : n.host) != null ? i : this.element, e) : this._$AH.handleEvent(e);
220
+ }
221
+ }
222
+ class We {
223
+ constructor(e, n, i) {
224
+ this.element = e, this.type = 6, this._$AN = void 0, this._$AM = n, this.options = i;
225
+ }
226
+ get _$AU() {
227
+ return this._$AM._$AU;
228
+ }
229
+ _$AI(e) {
230
+ I(this, e);
231
+ }
232
+ }
233
+ const ae = O.litHtmlPolyfillSupport;
234
+ var ce;
235
+ ae?.(T, N), ((ce = O.litHtmlVersions) != null ? ce : O.litHtmlVersions = []).push("3.3.2");
236
+ const g = (t, e, n) => {
237
+ const i = e;
238
+ let o = i._$litPart$;
239
+ return o === void 0 && (i._$litPart$ = o = new N(e.insertBefore(E(), null), null, void 0, {})), o._$AI(t), o;
240
+ }, Xe = `
241
+ :host { all: initial; }
242
+ .root {
243
+ position: fixed; inset: 0; pointer-events: none; z-index: 2147483647;
244
+ font-family: system-ui, -apple-system, sans-serif; font-size: 13px;
245
+ }
246
+ .cursor {
247
+ position: absolute; width: 24px; height: 24px;
248
+ background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 2 L3 18 L7 14 L9 21 L13 19 L11 12 L18 12 Z' fill='%23F76808' stroke='white' stroke-width='1.5'/></svg>");
249
+ background-size: contain; background-repeat: no-repeat; background-position: center;
250
+ transform: translate(-50%, -50%);
251
+ transition: left 0.6s cubic-bezier(0.16,1,0.3,1), top 0.6s cubic-bezier(0.16,1,0.3,1);
252
+ filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
253
+ }
254
+ .cursor.shake { animation: shake 0.3s; }
255
+ @keyframes shake {
256
+ 0%,100% { transform: translate(-50%,-50%); }
257
+ 25% { transform: translate(calc(-50% - 4px),-50%); }
258
+ 75% { transform: translate(calc(-50% + 4px),-50%); }
259
+ }
260
+ .tooltip {
261
+ position: absolute; background: #111; color: #fff;
262
+ padding: 8px 12px; border-radius: 8px; max-width: 280px;
263
+ box-shadow: 0 6px 24px rgba(0,0,0,0.25); pointer-events: auto;
264
+ }
265
+ .control-bar {
266
+ position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
267
+ display: inline-flex; align-items: center; gap: 4px;
268
+ padding: 6px 8px; border-radius: 999px;
269
+ background: rgba(17, 17, 17, 0.92);
270
+ color: #fff;
271
+ box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
272
+ border: 1px solid rgba(255, 255, 255, 0.08);
273
+ backdrop-filter: blur(8px);
274
+ -webkit-backdrop-filter: blur(8px);
275
+ pointer-events: auto;
276
+ font: inherit;
277
+ animation: cb-fade-in 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
278
+ }
279
+ @keyframes cb-fade-in {
280
+ from { opacity: 0; transform: translate(-50%, 8px); }
281
+ to { opacity: 1; transform: translate(-50%, 0); }
282
+ }
283
+ .cb-btn {
284
+ display: inline-flex; align-items: center; gap: 6px;
285
+ padding: 6px 10px; border-radius: 999px; border: 0; cursor: pointer;
286
+ background: transparent; color: #fff; font: inherit;
287
+ font-size: 12px; font-weight: 500;
288
+ transition: background-color 120ms ease;
289
+ }
290
+ .cb-btn:hover { background: rgba(255, 255, 255, 0.08); }
291
+ .cb-btn:focus-visible {
292
+ outline: 2px solid #F76808; outline-offset: 2px;
293
+ }
294
+ .cb-btn svg { display: block; }
295
+ .cb-exit svg { color: rgba(255, 255, 255, 0.7); }
296
+ .cb-skip svg { color: rgba(255, 255, 255, 0.7); }
297
+ .cb-counter {
298
+ display: inline-flex; align-items: baseline; gap: 2px;
299
+ padding: 0 8px;
300
+ font-size: 12px; font-weight: 600;
301
+ font-variant-numeric: tabular-nums;
302
+ }
303
+ .cb-current { color: #fff; }
304
+ .cb-sep { color: rgba(255, 255, 255, 0.4); margin: 0 2px; }
305
+ .cb-total { color: rgba(255, 255, 255, 0.6); }
306
+ .cb-divider {
307
+ width: 1px; height: 16px;
308
+ background: rgba(255, 255, 255, 0.12);
309
+ }
310
+ .toast {
311
+ position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
312
+ background: #111; color: #fff; padding: 10px 16px; border-radius: 8px;
313
+ box-shadow: 0 6px 24px rgba(0,0,0,0.25); pointer-events: auto;
314
+ max-width: 90vw;
315
+ }
316
+ .toast.error { background: #b42318; }
317
+ .highlight {
318
+ position: absolute; pointer-events: none;
319
+ border-radius: 8px;
320
+ box-shadow: 0 0 0 3px #F76808, 0 0 0 6px rgba(247, 104, 8, 0.25),
321
+ 0 0 24px rgba(247, 104, 8, 0.45);
322
+ transition: top 0.3s cubic-bezier(0.16,1,0.3,1),
323
+ left 0.3s cubic-bezier(0.16,1,0.3,1),
324
+ width 0.3s cubic-bezier(0.16,1,0.3,1),
325
+ height 0.3s cubic-bezier(0.16,1,0.3,1);
326
+ }
327
+ .highlight.pulse { animation: hl-pulse 1.4s cubic-bezier(0.16,1,0.3,1) 2; }
328
+ @keyframes hl-pulse {
329
+ 0% { box-shadow: 0 0 0 3px #F76808, 0 0 0 6px rgba(247,104,8,0.25),
330
+ 0 0 24px rgba(247,104,8,0.45); }
331
+ 50% { box-shadow: 0 0 0 4px #F76808, 0 0 0 14px rgba(247,104,8,0.18),
332
+ 0 0 36px rgba(247,104,8,0.55); }
333
+ 100% { box-shadow: 0 0 0 3px #F76808, 0 0 0 6px rgba(247,104,8,0.25),
334
+ 0 0 24px rgba(247,104,8,0.45); }
335
+ }
336
+ @media (prefers-reduced-motion: reduce) {
337
+ .highlight { transition: none; }
338
+ .highlight.pulse { animation: none; }
339
+ }
340
+ .hover-frame {
341
+ position: absolute; pointer-events: none;
342
+ border-radius: 6px;
343
+ outline: 2px solid #F76808;
344
+ background: rgba(247, 104, 8, 0.06);
345
+ transition: top 80ms linear, left 80ms linear,
346
+ width 80ms linear, height 80ms linear;
347
+ }
348
+ @media (prefers-reduced-motion: reduce) {
349
+ .hover-frame { transition: none; }
350
+ }
351
+ .pill {
352
+ position: fixed; top: 16px; right: 16px; background: #F76808; color: #fff;
353
+ padding: 8px 12px; border-radius: 999px; pointer-events: auto;
354
+ display: flex; align-items: center; gap: 8px; font-weight: 600;
355
+ }
356
+ .pill button { border: 0; background: transparent; color: #fff; cursor: pointer; }
357
+ `;
358
+ class $e {
359
+ constructor() {
360
+ this.host = document.createElement("div"), this.host.id = "sw-guide-overlay", this.shadow = this.host.attachShadow({ mode: "open" });
361
+ const e = document.createElement("style");
362
+ e.textContent = Xe, this.shadow.appendChild(e), this.root = document.createElement("div"), this.root.className = "root", this.shadow.appendChild(this.root), document.body.appendChild(this.host);
363
+ }
364
+ renderCursor(e, n, i = !1) {
365
+ const o = m`
366
+ <div class="cursor ${i ? "shake" : ""}"
367
+ style="left:${e}px; top:${n}px"></div>
368
+ `;
369
+ let r = this.shadow.querySelector(".cursor-slot");
370
+ r || (r = document.createElement("div"), r.className = "cursor-slot", this.root.appendChild(r)), g(o, r);
371
+ }
372
+ renderTooltip(e, n, i) {
373
+ let o = this.shadow.querySelector(".tooltip-slot");
374
+ o || (o = document.createElement("div"), o.className = "tooltip-slot", this.root.appendChild(o)), g(i ? m`<div class="tooltip" style="left:${e}px; top:${n + 30}px">${i}</div>` : m``, o);
375
+ }
376
+ renderControlBar(e) {
377
+ let n = this.shadow.querySelector(".control-bar-slot");
378
+ if (n || (n = document.createElement("div"), n.className = "control-bar-slot", this.root.appendChild(n)), e.total === null) {
379
+ g(m``, n);
380
+ return;
381
+ }
382
+ g(
383
+ m`
384
+ <div class="control-bar" role="toolbar" aria-label="Guide controls">
385
+ <button class="cb-btn cb-exit" @click=${e.onExit} aria-label="Exit guide">
386
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6l12 12"/></svg>
387
+ <span>Exit</span>
388
+ </button>
389
+ <div class="cb-divider"></div>
390
+ <div class="cb-counter">
391
+ <span class="cb-current">${e.current}</span>
392
+ <span class="cb-sep">/</span>
393
+ <span class="cb-total">${e.total}</span>
394
+ </div>
395
+ <div class="cb-divider"></div>
396
+ <button class="cb-btn cb-skip" @click=${e.onSkip} aria-label="Skip step">
397
+ <span>Skip</span>
398
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 4l10 8-10 8V4zm14 0v16"/></svg>
399
+ </button>
400
+ </div>
401
+ `,
402
+ n
403
+ );
404
+ }
405
+ renderHighlight(e, n = {}) {
406
+ let i = this.shadow.querySelector(".highlight-slot");
407
+ if (i || (i = document.createElement("div"), i.className = "highlight-slot", this.root.appendChild(i)), !e) {
408
+ g(m``, i);
409
+ return;
410
+ }
411
+ const o = 4;
412
+ g(
413
+ m`
414
+ <div
415
+ class="highlight ${n.pulse ? "pulse" : ""}"
416
+ style="left:${e.left - o}px; top:${e.top - o}px;
417
+ width:${e.width + o * 2}px; height:${e.height + o * 2}px"
418
+ ></div>
419
+ `,
420
+ i
421
+ );
422
+ }
423
+ renderHoverFrame(e) {
424
+ let n = this.shadow.querySelector(".hover-frame-slot");
425
+ if (n || (n = document.createElement("div"), n.className = "hover-frame-slot", this.root.appendChild(n)), !e) {
426
+ g(m``, n);
427
+ return;
428
+ }
429
+ const i = 2;
430
+ g(
431
+ m`
432
+ <div
433
+ class="hover-frame"
434
+ style="left:${e.left - i}px; top:${e.top - i}px;
435
+ width:${e.width + i * 2}px; height:${e.height + i * 2}px"
436
+ ></div>
437
+ `,
438
+ n
439
+ );
440
+ }
441
+ toast(e, n = "info", i = 4e3) {
442
+ let o = this.shadow.querySelector(".toast-slot");
443
+ o || (o = document.createElement("div"), o.className = "toast-slot", this.root.appendChild(o)), g(m`<div class="toast ${n === "error" ? "error" : ""}">${e}</div>`, o), setTimeout(() => g(m``, o), i);
444
+ }
445
+ renderPill(e, n, i, o, r) {
446
+ let l = this.shadow.querySelector(".pill-slot");
447
+ l || (l = document.createElement("div"), l.className = "pill-slot", this.root.appendChild(l)), g(m`
448
+ <div class="pill">
449
+ <span>● Recording: ${e}</span>
450
+ <span>${n} step${n === 1 ? "" : "s"}</span>
451
+ ${i ? m`<span style="opacity:0.85">— ${i}</span>` : ""}
452
+ <button @click=${r}>Pause</button>
453
+ <button @click=${o}>Stop</button>
454
+ </div>
455
+ `, l);
456
+ }
457
+ destroy() {
458
+ this.host.remove();
459
+ }
460
+ }
461
+ const Ze = ["data-testid", "data-cy", "data-test"], ue = /(\d.*\d.*\d.*\d.*\d|css-[a-z0-9]{4,})/;
462
+ function ye(t) {
463
+ const e = [], n = de(t, "data-sw-anchor", 5);
464
+ if (n) {
465
+ const l = n.getAttribute("data-sw-anchor");
466
+ e.push(
467
+ n === t ? { kind: "sw-anchor", anchorId: l } : { kind: "sw-anchor", anchorId: l, childPath: Ke(n, t) }
468
+ );
469
+ }
470
+ for (const l of Ze) {
471
+ const c = de(t, l, 3);
472
+ if (c) {
473
+ e.push({ kind: "test-id", attr: l, value: c.getAttribute(l) });
474
+ break;
475
+ }
476
+ }
477
+ const i = Je(t), o = Ye(t);
478
+ i && o && e.push({ kind: "aria", role: i, name: o });
479
+ const r = R(t);
480
+ if (r && r.length <= 80) {
481
+ const l = t.tagName.toLowerCase(), c = Array.from(document.querySelectorAll(l)).filter((u) => R(u) === r).indexOf(t) + 1;
482
+ c > 0 && e.push({ kind: "text", tag: l, text: r, nthOfMatch: c });
483
+ }
484
+ return e.push({ kind: "css-path", path: Qe(t) }), e.push({ kind: "xpath", xpath: tt(t) }), e;
485
+ }
486
+ function de(t, e, n) {
487
+ let i = t;
488
+ for (let o = 0; o <= n && i; o++) {
489
+ if (i.hasAttribute(e)) return i;
490
+ i = i.parentElement;
491
+ }
492
+ return null;
493
+ }
494
+ function Je(t) {
495
+ return t.getAttribute("role") || Ge(t);
496
+ }
497
+ function Ge(t) {
498
+ switch (t.tagName.toLowerCase()) {
499
+ case "button":
500
+ return "button";
501
+ case "a":
502
+ return t.hasAttribute("href") ? "link" : null;
503
+ case "input": {
504
+ const e = t.type;
505
+ return e === "checkbox" ? "checkbox" : e === "radio" ? "radio" : e === "button" || e === "submit" ? "button" : "textbox";
506
+ }
507
+ case "textarea":
508
+ return "textbox";
509
+ case "select":
510
+ return "combobox";
511
+ case "nav":
512
+ return "navigation";
513
+ case "main":
514
+ return "main";
515
+ case "header":
516
+ return "banner";
517
+ case "footer":
518
+ return "contentinfo";
519
+ default:
520
+ return null;
521
+ }
522
+ }
523
+ function Ye(t) {
524
+ const e = t.getAttribute("aria-labelledby");
525
+ if (e) {
526
+ const r = e.split(/\s+/).map((l) => {
527
+ var c, u;
528
+ return (u = (c = document.getElementById(l)) == null ? void 0 : c.textContent) != null ? u : "";
529
+ }).join(" ").trim();
530
+ if (r) return r;
531
+ }
532
+ const n = t.getAttribute("aria-label");
533
+ if (n) return n.trim();
534
+ const i = t.getAttribute("alt");
535
+ if (i) return i.trim();
536
+ const o = t.getAttribute("title");
537
+ if (o) return o.trim();
538
+ if (t.tagName === "INPUT") {
539
+ const r = t.placeholder;
540
+ if (r) return r.trim();
541
+ }
542
+ return R(t) || null;
543
+ }
544
+ function R(t) {
545
+ return Array.from(t.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => {
546
+ var n;
547
+ return (n = e.textContent) != null ? n : "";
548
+ }).join("").trim();
549
+ }
550
+ function Ke(t, e) {
551
+ var n;
552
+ const i = [];
553
+ let o = e;
554
+ for (; o && o !== t; ) {
555
+ const r = Array.from(((n = o.parentElement) == null ? void 0 : n.children) || []).indexOf(o) + 1;
556
+ i.unshift(`${o.tagName.toLowerCase()}:nth-child(${r})`), o = o.parentElement;
557
+ }
558
+ return i.join(" > ");
559
+ }
560
+ function Qe(t) {
561
+ const e = [];
562
+ let n = t;
563
+ for (; n; ) {
564
+ let i = n.tagName.toLowerCase();
565
+ const o = n.id;
566
+ if (o && !ue.test(o)) {
567
+ i = `#${pe(o)}`, e.unshift(i);
568
+ break;
569
+ }
570
+ const r = Array.from(n.classList).find((l) => !ue.test(l));
571
+ if (r && (i += `.${pe(r)}`), n.parentElement) {
572
+ const l = Array.from(n.parentElement.children).indexOf(n) + 1;
573
+ i += `:nth-child(${l})`;
574
+ }
575
+ if (e.unshift(i), et(e.join(" > "))) break;
576
+ n = n.parentElement;
577
+ }
578
+ return e.join(" > ");
579
+ }
580
+ function et(t) {
581
+ try {
582
+ return document.querySelectorAll(t).length === 1;
583
+ } catch {
584
+ return !1;
585
+ }
586
+ }
587
+ function tt(t) {
588
+ var e;
589
+ const n = [];
590
+ let i = t;
591
+ for (; i && i.nodeType === 1; ) {
592
+ const o = Array.from(((e = i.parentElement) == null ? void 0 : e.children) || []).filter(
593
+ (r) => r.tagName === i.tagName
594
+ ).indexOf(i) + 1;
595
+ n.unshift(`${i.tagName.toLowerCase()}[${o}]`), i = i.parentElement;
596
+ }
597
+ return "/" + n.join("/");
598
+ }
599
+ function pe(t) {
600
+ return window.CSS && CSS.escape ? CSS.escape(t) : t.replace(/[^a-zA-Z0-9_-]/g, "\\$&");
601
+ }
602
+ const U = "sw.guide.recording", V = "sw.guide.playback";
603
+ function we(t) {
604
+ localStorage.setItem(U, JSON.stringify(t));
605
+ }
606
+ function _e() {
607
+ const t = localStorage.getItem(U);
608
+ if (!t) return null;
609
+ try {
610
+ return JSON.parse(t);
611
+ } catch {
612
+ return null;
613
+ }
614
+ }
615
+ function Ae() {
616
+ localStorage.removeItem(U);
617
+ }
618
+ function j(t) {
619
+ localStorage.setItem(V, JSON.stringify(t));
620
+ }
621
+ function nt() {
622
+ const t = localStorage.getItem(V);
623
+ if (!t) return null;
624
+ try {
625
+ return JSON.parse(t);
626
+ } catch {
627
+ return null;
628
+ }
629
+ }
630
+ function it() {
631
+ localStorage.removeItem(V);
632
+ }
633
+ let a = null;
634
+ function ot({ guideId: t, title: e }) {
635
+ a && W();
636
+ const n = _e(), i = n && n.guideId === t ? n.steps : [];
637
+ a = {
638
+ guideId: t,
639
+ title: e,
640
+ steps: i,
641
+ shell: new $e(),
642
+ paused: !1,
643
+ lastUrl: location.pathname + location.search
644
+ }, st(), L(), we({ guideId: t, title: e, steps: i, startedAt: Date.now() });
645
+ }
646
+ function Ie() {
647
+ a && (a.paused = !0, a.shell.renderHoverFrame(null), _ = null), L();
648
+ }
649
+ function ke() {
650
+ a && (a.paused = !1), L();
651
+ }
652
+ function W() {
653
+ if (!a) return null;
654
+ for (lt(), X(); a.steps.length && a.steps[a.steps.length - 1].type === "wait_for_navigation"; )
655
+ a.steps.pop();
656
+ const t = { guideId: a.guideId, title: a.title, steps: a.steps };
657
+ return a.shell.destroy(), Ae(), a = null, t;
658
+ }
659
+ function L() {
660
+ if (!a) return;
661
+ const t = a.steps[a.steps.length - 1], e = t ? rt(t) : null;
662
+ a.shell.renderPill(
663
+ a.title,
664
+ a.steps.length,
665
+ e,
666
+ () => {
667
+ const n = W();
668
+ window.dispatchEvent(new CustomEvent("sw-guide:recording-done", { detail: n }));
669
+ },
670
+ () => {
671
+ a.paused ? ke() : Ie();
672
+ }
673
+ );
674
+ }
675
+ function rt(t) {
676
+ switch (t.type) {
677
+ case "click":
678
+ return `clicked '${t.accessibleName || t.elementText || ""}'`;
679
+ case "type":
680
+ return `typed in '${t.fieldLabel || ""}'`;
681
+ case "scroll_to":
682
+ return `scrolled to '${t.anchorText || ""}'`;
683
+ case "wait_for_navigation":
684
+ return "navigated";
685
+ }
686
+ }
687
+ function st() {
688
+ document.addEventListener("click", Ce, !0), document.addEventListener("input", Te, !0), document.addEventListener("blur", Ne, !0), document.addEventListener("mousemove", Ee, !0), document.addEventListener("mouseleave", Se, !0), window.addEventListener("beforeunload", Z), window.addEventListener("popstate", Le);
689
+ }
690
+ function lt() {
691
+ document.removeEventListener("click", Ce, !0), document.removeEventListener("input", Te, !0), document.removeEventListener("blur", Ne, !0), document.removeEventListener("mousemove", Ee, !0), document.removeEventListener("mouseleave", Se, !0), window.removeEventListener("beforeunload", Z), window.removeEventListener("popstate", Le);
692
+ }
693
+ let B = 0, _ = null;
694
+ function Ee(t) {
695
+ !a || a.paused || B || (B = requestAnimationFrame(() => {
696
+ if (B = 0, !a) return;
697
+ const e = document.elementFromPoint(t.clientX, t.clientY);
698
+ if (!e || !(e instanceof HTMLElement) || G(e)) {
699
+ _ && (a.shell.renderHoverFrame(null), _ = null);
700
+ return;
701
+ }
702
+ e !== _ && (_ = e, a.shell.renderHoverFrame(e.getBoundingClientRect()));
703
+ }));
704
+ }
705
+ function Se() {
706
+ a && (a.shell.renderHoverFrame(null), _ = null);
707
+ }
708
+ function Ce(t) {
709
+ if (!a || a.paused) return;
710
+ const e = t.target;
711
+ !e || G(e) || (X(), a.steps.push({
712
+ type: "click",
713
+ selectors: ye(e),
714
+ elementText: he(e),
715
+ accessibleName: e.getAttribute("aria-label") || he(e),
716
+ urlAtCapture: location.pathname + location.search,
717
+ viewportSize: { width: innerWidth, height: innerHeight },
718
+ ts: Date.now()
719
+ }), J(), L());
720
+ }
721
+ function Te(t) {
722
+ if (!a || a.paused) return;
723
+ const e = t.target;
724
+ !e || !("value" in e) || G(e) || (!a.pendingTypeStep || a.pendingTypeStep.fieldElement !== e ? a.pendingTypeStep = {
725
+ type: "type",
726
+ selectors: ye(e),
727
+ fieldLabel: at(e),
728
+ finalValue: e.value,
729
+ prefillValue: e.value,
730
+ urlAtCapture: location.pathname + location.search,
731
+ ts: Date.now(),
732
+ fieldElement: e
733
+ } : (a.pendingTypeStep.finalValue = e.value, a.pendingTypeStep.prefillValue = e.value));
734
+ }
735
+ function Ne(t) {
736
+ if (!a) return;
737
+ const e = t.target;
738
+ a.pendingTypeStep && a.pendingTypeStep.fieldElement === e && (X(), L());
739
+ }
740
+ function X() {
741
+ if (!a || !a.pendingTypeStep) return;
742
+ const t = a.pendingTypeStep, { fieldElement: e } = t, n = je(t, ["fieldElement"]);
743
+ a.steps.push(n), a.pendingTypeStep = void 0, J();
744
+ }
745
+ function Z() {
746
+ a && (a.steps.push({
747
+ type: "wait_for_navigation",
748
+ fromUrl: a.lastUrl,
749
+ toUrl: location.pathname + location.search,
750
+ urlAtCapture: location.pathname + location.search,
751
+ ts: Date.now()
752
+ }), J());
753
+ }
754
+ function Le() {
755
+ Z();
756
+ }
757
+ function J() {
758
+ a && we({
759
+ guideId: a.guideId,
760
+ title: a.title,
761
+ steps: a.steps,
762
+ startedAt: Date.now()
763
+ });
764
+ }
765
+ function at(t) {
766
+ var e;
767
+ return (t.getAttribute("aria-label") || t.placeholder || t.id && ((e = document.querySelector(`label[for="${t.id}"]`)) == null ? void 0 : e.textContent) || "").trim();
768
+ }
769
+ function he(t) {
770
+ return Array.from(t.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => {
771
+ var n;
772
+ return (n = e.textContent) != null ? n : "";
773
+ }).join("").trim();
774
+ }
775
+ function G(t) {
776
+ return !!t.closest("#sw-guide-overlay");
777
+ }
778
+ function ct() {
779
+ const t = _e();
780
+ return t && Date.now() - t.startedAt < 1800 * 1e3 ? t : (t && Ae(), null);
781
+ }
782
+ const Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
783
+ __proto__: null,
784
+ maybeResume: ct,
785
+ pause: Ie,
786
+ resume: ke,
787
+ start: ot,
788
+ stop: W
789
+ }, Symbol.toStringTag, { value: "Module" }));
790
+ async function ut(t, e) {
791
+ const { timeoutMs: n, pollMs: i = 200 } = e, o = performance.now() + n;
792
+ let r = null;
793
+ for (; performance.now() < o; ) {
794
+ for (const l of t) {
795
+ const c = dt(l);
796
+ if (c && pt(c))
797
+ if (!r)
798
+ r = c;
799
+ else {
800
+ if (r === c)
801
+ return c;
802
+ r = c;
803
+ }
804
+ }
805
+ await gt(i);
806
+ }
807
+ return null;
808
+ }
809
+ function dt(t) {
810
+ switch (t.kind) {
811
+ case "sw-anchor": {
812
+ const e = document.querySelector(
813
+ `[data-sw-anchor="${fe(t.anchorId)}"]`
814
+ );
815
+ return e ? t.childPath ? e.querySelector(t.childPath) : e : null;
816
+ }
817
+ case "test-id":
818
+ return document.querySelector(
819
+ `[${t.attr}="${fe(t.value)}"]`
820
+ );
821
+ case "aria":
822
+ return ht(t.role, t.name);
823
+ case "text":
824
+ return ft(t.tag, t.text, t.nthOfMatch);
825
+ case "css-path":
826
+ try {
827
+ return document.querySelector(t.path);
828
+ } catch {
829
+ return null;
830
+ }
831
+ case "xpath":
832
+ return document.evaluate(
833
+ t.xpath,
834
+ document,
835
+ null,
836
+ XPathResult.FIRST_ORDERED_NODE_TYPE,
837
+ null
838
+ ).singleNodeValue || null;
839
+ }
840
+ }
841
+ function pt(t) {
842
+ if (t.offsetParent === null && getComputedStyle(t).position !== "fixed") return !1;
843
+ const e = t.getBoundingClientRect();
844
+ if (e.width === 0 || e.height === 0) return !1;
845
+ const n = getComputedStyle(t);
846
+ if (n.visibility === "hidden" || n.pointerEvents === "none") return !1;
847
+ (e.bottom < 0 || e.top > innerHeight || e.right < 0 || e.left > innerWidth) && t.scrollIntoView({ block: "center", inline: "center" });
848
+ const i = e.left + e.width / 2, o = e.top + e.height / 2, r = document.elementFromPoint(i, o);
849
+ return r ? r === t || t.contains(r) : !1;
850
+ }
851
+ function ht(t, e) {
852
+ const n = Array.from(document.querySelectorAll("*")), i = e.toLowerCase();
853
+ return n.find((o) => {
854
+ if ((o.getAttribute("role") || "").toLowerCase() !== t) return !1;
855
+ const r = (o.getAttribute("aria-label") || o.textContent || "").trim().toLowerCase();
856
+ return r === i || r.startsWith(i);
857
+ }) || null;
858
+ }
859
+ function ft(t, e, n) {
860
+ return Array.from(document.querySelectorAll(t)).filter((i) => mt(i) === e)[n - 1] || null;
861
+ }
862
+ function mt(t) {
863
+ return Array.from(t.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => {
864
+ var n;
865
+ return (n = e.textContent) != null ? n : "";
866
+ }).join("").trim();
867
+ }
868
+ function gt(t) {
869
+ return new Promise((e) => setTimeout(e, t));
870
+ }
871
+ function fe(t) {
872
+ return window.CSS && CSS.escape ? CSS.escape(t) : t.replace(/[^a-zA-Z0-9_-]/g, "\\$&");
873
+ }
874
+ function Y(t, e, n) {
875
+ const [i, o = ""] = t.split("?"), [r, l = ""] = e.split("?");
876
+ return vt(i, r, n) ? !o && !l ? !0 : bt(o, l, n) : !1;
877
+ }
878
+ function vt(t, e, n) {
879
+ const i = t.split("/").filter(Boolean), o = e.split("/").filter(Boolean);
880
+ return i.length !== o.length ? !1 : i.every((r, l) => r === o[l] || n.includes(r));
881
+ }
882
+ function bt(t, e, n) {
883
+ var i, o;
884
+ const r = new URLSearchParams(t), l = new URLSearchParams(e);
885
+ if ([...r.keys()].sort().join() !== [...l.keys()].sort().join())
886
+ return !1;
887
+ for (const c of r.keys()) {
888
+ const u = (i = r.get(c)) != null ? i : "", d = (o = l.get(c)) != null ? o : "";
889
+ if (u !== d && !n.includes(u)) return !1;
890
+ }
891
+ return !0;
892
+ }
893
+ let s = null, F = null;
894
+ function xt(t) {
895
+ F = t;
896
+ }
897
+ async function $t(t) {
898
+ var e;
899
+ if (s && A("superseded", "superseded"), Oe(), s = {
900
+ sessionId: t.sessionId,
901
+ guideId: t.guideId,
902
+ versionId: t.versionId,
903
+ version: t.version,
904
+ stepIndex: (e = t.resumeStepIndex) != null ? e : 0,
905
+ shell: new $e(),
906
+ exited: !1
907
+ }, s.version.domain_strategy === "specific" && s.version.specific_domain && location.host !== s.version.specific_domain)
908
+ return s.shell.toast(`This guide only works on ${s.version.specific_domain}.`, "error"), A("failed", "wrong_start");
909
+ if (s.shell.renderControlBar({
910
+ current: s.stepIndex + 1,
911
+ total: s.version.steps.length,
912
+ onSkip: K,
913
+ onExit: Q
914
+ }), s.stepIndex === 0) {
915
+ const n = s.version.steps[0];
916
+ if (!Y(
917
+ n.url_path,
918
+ location.pathname + location.search,
919
+ s.version.wildcard_values
920
+ )) {
921
+ if (!await yt(n.url_path)) return A("exited", "wrong_start");
922
+ j({
923
+ sessionId: s.sessionId,
924
+ guideId: s.guideId,
925
+ versionId: s.versionId,
926
+ stepIndex: 0,
927
+ version: s.version
928
+ }), location.href = location.origin + n.url_path;
929
+ return;
930
+ }
931
+ }
932
+ await wt();
933
+ }
934
+ async function yt(t) {
935
+ return new Promise((e) => {
936
+ if (!s) return e(!1);
937
+ s.shell.toast(`This guide starts on ${t}.`, "info", 999999), setTimeout(() => e(!0), 0);
938
+ });
939
+ }
940
+ async function wt() {
941
+ for (; s && !s.exited && s.stepIndex < s.version.steps.length; ) {
942
+ const t = s.version.steps[s.stepIndex];
943
+ if (s.shell.renderControlBar({
944
+ current: s.stepIndex + 1,
945
+ total: s.version.steps.length,
946
+ onSkip: K,
947
+ onExit: Q
948
+ }), !Y(
949
+ t.url_path,
950
+ location.pathname + location.search,
951
+ s.version.wildcard_values
952
+ )) {
953
+ j({
954
+ sessionId: s.sessionId,
955
+ guideId: s.guideId,
956
+ versionId: s.versionId,
957
+ stepIndex: s.stepIndex,
958
+ version: s.version
959
+ });
960
+ const n = await kt(t.url_path, 2e4);
961
+ if (!s || s.exited) return;
962
+ if (!n)
963
+ return s.shell.toast("Looks like you've gone elsewhere.", "info"), A("failed", "off_site");
964
+ }
965
+ if (t.step_type === "wait_for_navigation") {
966
+ s.stepIndex++;
967
+ continue;
968
+ }
969
+ const e = await ut(t.selectors, { timeoutMs: 1e4 });
970
+ if (!e) {
971
+ s.shell.toast("We can't find this — Skip / Exit.", "info", 999999), await Et();
972
+ continue;
973
+ }
974
+ t.step_type === "scroll_to" && (e.scrollIntoView({ block: "center", inline: "center", behavior: "smooth" }), await Tt(300)), It(e, s.stepIndex === 0), t.step_type === "click" ? await _t(e, t) : t.step_type === "type" ? await At(e, t) : t.step_type === "scroll_to" && s.stepIndex++, s?.shell.renderHighlight(null), St();
975
+ }
976
+ s && !s.exited && A("completed", "completed");
977
+ }
978
+ async function _t(t, e) {
979
+ s && (q(t), e.tooltip && He(t, e.tooltip), await new Promise((n) => {
980
+ const i = (o) => {
981
+ const r = o.target;
982
+ t === r || t.contains(r) ? (document.removeEventListener("click", i, !0), s && j({
983
+ sessionId: s.sessionId,
984
+ guideId: s.guideId,
985
+ versionId: s.versionId,
986
+ stepIndex: s.stepIndex + 1,
987
+ version: s.version
988
+ }), n()) : (s.shell.toast("Click the highlighted item.", "info", 1500), t && q(t, !0));
989
+ };
990
+ document.addEventListener("click", i, !0);
991
+ }), s.shell.renderTooltip(0, 0, null), s.stepIndex++);
992
+ }
993
+ async function At(t, e) {
994
+ s && (q(t), e.prefill_value && (t.focus(), t.value = e.prefill_value, t.dispatchEvent(new Event("input", { bubbles: !0 }))), (e.tooltip || e.field_label) && He(t, e.tooltip || `Type your ${e.field_label}`), await new Promise((n) => {
995
+ const i = () => {
996
+ t.removeEventListener("blur", i), n();
997
+ };
998
+ t.addEventListener("blur", i);
999
+ }), s.shell.renderTooltip(0, 0, null), s.stepIndex++);
1000
+ }
1001
+ function q(t, e = !1) {
1002
+ if (!s) return;
1003
+ const n = t.getBoundingClientRect();
1004
+ s.shell.renderCursor(n.left + n.width / 2, n.top + n.height / 2, e);
1005
+ }
1006
+ function It(t, e) {
1007
+ s && s.shell.renderHighlight(t.getBoundingClientRect(), { pulse: e });
1008
+ }
1009
+ function He(t, e) {
1010
+ if (!s) return;
1011
+ const n = t.getBoundingClientRect();
1012
+ s.shell.renderTooltip(n.left + n.width / 2, n.bottom, e);
1013
+ }
1014
+ let me = !1;
1015
+ function Oe() {
1016
+ if (me) return;
1017
+ me = !0;
1018
+ const t = () => window.dispatchEvent(new Event("sw-guide:locationchange")), e = history.pushState, n = history.replaceState;
1019
+ history.pushState = function(...i) {
1020
+ const o = e.apply(this, i);
1021
+ return t(), o;
1022
+ }, history.replaceState = function(...i) {
1023
+ const o = n.apply(this, i);
1024
+ return t(), o;
1025
+ }, window.addEventListener("popstate", t);
1026
+ }
1027
+ function kt(t, e) {
1028
+ return Oe(), new Promise((n) => {
1029
+ let i = !1;
1030
+ const o = (u) => {
1031
+ i || (i = !0, clearTimeout(l), clearInterval(c), window.removeEventListener("sw-guide:locationchange", r), n(u));
1032
+ }, r = () => {
1033
+ Y(
1034
+ t,
1035
+ location.pathname + location.search,
1036
+ s?.version.wildcard_values || []
1037
+ ) && o(!0);
1038
+ }, l = setTimeout(() => o(!1), e), c = setInterval(r, 250);
1039
+ window.addEventListener("sw-guide:locationchange", r), r();
1040
+ });
1041
+ }
1042
+ function Et() {
1043
+ return new Promise((t) => {
1044
+ const e = () => {
1045
+ document.removeEventListener("sw-guide:user-choice", e), t();
1046
+ };
1047
+ document.addEventListener("sw-guide:user-choice", e);
1048
+ });
1049
+ }
1050
+ function K() {
1051
+ s && (s.stepIndex++, document.dispatchEvent(new Event("sw-guide:user-choice")));
1052
+ }
1053
+ function Q() {
1054
+ A("exited", "user_exit");
1055
+ }
1056
+ function A(t, e) {
1057
+ if (!s) return;
1058
+ s.exited = !0;
1059
+ const n = s.stepIndex;
1060
+ s.shell.destroy(), it(), F?.(t, e, n), s = null;
1061
+ }
1062
+ function St() {
1063
+ s && (j({
1064
+ sessionId: s.sessionId,
1065
+ guideId: s.guideId,
1066
+ versionId: s.versionId,
1067
+ stepIndex: s.stepIndex,
1068
+ version: s.version
1069
+ }), document.dispatchEvent(new CustomEvent(
1070
+ "sw-guide:playback-progress",
1071
+ { detail: { stepIndex: s.stepIndex } }
1072
+ )));
1073
+ }
1074
+ function Ct() {
1075
+ return nt() || null;
1076
+ }
1077
+ function Tt(t) {
1078
+ return new Promise((e) => setTimeout(e, t));
1079
+ }
1080
+ const Lt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1081
+ __proto__: null,
1082
+ exitGuide: Q,
1083
+ maybeResume: Ct,
1084
+ onDone: xt,
1085
+ skipStep: K,
1086
+ start: $t
1087
+ }, Symbol.toStringTag, { value: "Module" }));
1088
+ export {
1089
+ Lt as playback,
1090
+ Nt as recording
1091
+ };
1092
+ //# sourceMappingURL=index-bfV4xNqW-CRQbrL80.js.map