@launchsecure/launch-kit 0.0.27 → 0.0.29
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/beacon/beacon.mjs +1003 -440
- package/dist/beacon/beacon.mjs.map +1 -1
- package/dist/beacon/beacon.umd.js +45 -24
- package/dist/beacon/beacon.umd.js.map +1 -1
- package/dist/beacon/types/capture/events.d.ts +20 -0
- package/dist/beacon/types/capture/events.d.ts.map +1 -0
- package/dist/beacon/types/element.d.ts +1 -0
- package/dist/beacon/types/element.d.ts.map +1 -1
- package/dist/beacon/types/index.d.ts +2 -1
- package/dist/beacon/types/index.d.ts.map +1 -1
- package/dist/beacon/types/monitor/dom.d.ts +13 -0
- package/dist/beacon/types/monitor/dom.d.ts.map +1 -0
- package/dist/beacon/types/monitor/index.d.ts +19 -0
- package/dist/beacon/types/monitor/index.d.ts.map +1 -0
- package/dist/beacon/types/monitor/network.d.ts +12 -0
- package/dist/beacon/types/monitor/network.d.ts.map +1 -0
- package/dist/beacon/types/monitor/transport.d.ts +27 -0
- package/dist/beacon/types/monitor/transport.d.ts.map +1 -0
- package/dist/beacon/types/monitor/types.d.ts +117 -0
- package/dist/beacon/types/monitor/types.d.ts.map +1 -0
- package/dist/beacon/types/types.d.ts +10 -0
- package/dist/beacon/types/types.d.ts.map +1 -1
- package/dist/beacon/types/ui/drawer.d.ts +3 -1
- package/dist/beacon/types/ui/drawer.d.ts.map +1 -1
- package/dist/beacon/types/ui/monitor-panel.d.ts +19 -0
- package/dist/beacon/types/ui/monitor-panel.d.ts.map +1 -0
- package/dist/server/beacon-monitor-entry.js +353 -0
- package/dist/server/chart-serve.js +3 -1
- package/dist/server/cli.js +276 -218
- package/dist/server/course-entry.js +246 -0
- package/dist/server/graph-mcp-entry.js +35 -72
- package/dist/server/init-entry.js +1051 -122
- package/dist/server/orbit-entry.js +187 -24
- package/package.json +5 -3
- package/scaffolds/ls-marketplace/.claude-plugin/marketplace.json +15 -0
- package/scaffolds/ls-marketplace/plugins/kit/.claude-plugin/plugin.json +19 -0
- package/scaffolds/ls-marketplace/plugins/kit/commands/activate-beacon.md +216 -0
- package/scaffolds/ls-marketplace/plugins/kit/commands/activate-statusline.md +46 -0
- package/scaffolds/ls-marketplace/plugins/kit/commands/beacon-array.md +92 -0
- package/scaffolds/ls-marketplace/plugins/kit/commands/beacon-clear.md +68 -0
- package/scaffolds/ls-marketplace/plugins/kit/commands/beacon-pulse.md +80 -0
- package/scaffolds/ls-marketplace/plugins/kit/commands/beacon-scan.md +62 -0
- package/scaffolds/ls-marketplace/plugins/kit/commands/deactivate-statusline.md +34 -0
- package/scaffolds/ls-marketplace/plugins/kit/commands/show-mcp-status.md +109 -0
- package/scaffolds/ls-marketplace/plugins/kit/commands/standup.md +191 -0
- package/scaffolds/recall-hook/scripts/ensure-recall.sh +69 -0
- package/scaffolds/statusline/statusline-mcp.sh +192 -0
- package/scaffolds/statusline/statusline-wrapper.sh +50 -0
package/dist/beacon/beacon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const V = '.beacon-drawer,.beacon-pin-popover{--beacon-accent: #0ea5e9;--beacon-bg: #ffffff;--beacon-fg: #0f172a;--beacon-muted: #64748b;--beacon-border: #e2e8f0;--beacon-radius: 10px;--beacon-shadow: 0 10px 30px rgba(0, 0, 0, .15), 0 2px 6px rgba(0, 0, 0, .08);--beacon-z-index: 2147483647;--beacon-bug: #ef4444;--beacon-idea: #22c55e;--beacon-ux: #a855f7;--beacon-a11y: #06b6d4}.beacon-drawer.beacon-theme-dark,.beacon-pin-popover.beacon-theme-dark{--beacon-bg: #0f172a;--beacon-fg: #f1f5f9;--beacon-muted: #94a3b8;--beacon-border: #334155}@media (prefers-color-scheme: dark){.beacon-drawer.beacon-theme-auto,.beacon-pin-popover.beacon-theme-auto{--beacon-bg: #0f172a;--beacon-fg: #f1f5f9;--beacon-muted: #94a3b8;--beacon-border: #334155}}:host{--beacon-accent: #0ea5e9;--beacon-bg: #ffffff;--beacon-fg: #0f172a;--beacon-muted: #64748b;--beacon-border: #e2e8f0;--beacon-radius: 10px;--beacon-z-index: 2147483645;--beacon-shadow: 0 10px 30px rgba(0, 0, 0, .15), 0 2px 6px rgba(0, 0, 0, .08);--beacon-bug: #ef4444;--beacon-idea: #22c55e;--beacon-ux: #a855f7;--beacon-a11y: #06b6d4;position:fixed;z-index:var(--beacon-z-index);font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:14px;color:var(--beacon-fg);line-height:1.5}:host([theme="dark"]){--beacon-bg: #0f172a;--beacon-fg: #f1f5f9;--beacon-muted: #94a3b8;--beacon-border: #334155}@media (prefers-color-scheme: dark){:host([theme="auto"]){--beacon-bg: #0f172a;--beacon-fg: #f1f5f9;--beacon-muted: #94a3b8;--beacon-border: #334155}}:host([position="bottom-right"]){right:20px;bottom:20px;left:auto;top:auto}:host([position="bottom-left"]){left:20px;bottom:20px;right:auto;top:auto}:host([position="hidden"]){position:static;display:contents}:host([position="hidden"]) .beacon-default-trigger{display:none}.beacon-default-trigger{display:inline-flex;align-items:center;gap:6px;background:var(--beacon-accent);color:#fff;border:0;border-radius:999px;padding:10px 16px;font:inherit;font-weight:500;cursor:pointer;box-shadow:var(--beacon-shadow);transition:transform .15s ease,box-shadow .15s ease}.beacon-default-trigger:hover{transform:translateY(-1px);box-shadow:0 14px 36px #0003}.beacon-default-trigger svg{width:18px;height:18px}.beacon-drawer{position:fixed;right:20px;bottom:20px;width:380px;max-width:calc(100vw - 24px);max-height:calc(100vh - 24px);background:var(--beacon-bg);color:var(--beacon-fg);border:1px solid var(--beacon-border);border-radius:var(--beacon-radius);box-shadow:var(--beacon-shadow);display:none;flex-direction:column;overflow:hidden;z-index:var(--beacon-z-index)}:host([position="bottom-left"]) .beacon-drawer{left:20px;right:auto}.beacon-drawer.open{display:flex}.beacon-drawer.minimized{display:none}.beacon-drawer-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--beacon-border)}.beacon-drawer-title{font-weight:600}.beacon-icon-btn{background:transparent;border:0;color:var(--beacon-muted);cursor:pointer;padding:4px;border-radius:4px;display:inline-flex}.beacon-icon-btn:hover{background:var(--beacon-border);color:var(--beacon-fg)}.beacon-icon-btn svg{width:16px;height:16px}.beacon-drawer-body{padding:16px;overflow-y:auto;display:flex;flex-direction:column;gap:14px}.beacon-field{display:flex;flex-direction:column;gap:6px}.beacon-label{font-size:12px;color:var(--beacon-muted);font-weight:500}.beacon-textarea{width:100%;min-height:80px;padding:8px 10px;background:var(--beacon-bg);color:var(--beacon-fg);border:1px solid var(--beacon-border);border-radius:6px;font:inherit;resize:vertical;box-sizing:border-box}.beacon-textarea:focus{outline:2px solid var(--beacon-accent);outline-offset:-1px;border-color:var(--beacon-accent)}.beacon-severity{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}.beacon-severity-opt{position:relative;display:flex;align-items:center;justify-content:center;padding:6px 4px;background:transparent;border:1px solid var(--beacon-border);border-radius:6px;cursor:pointer;font-size:12px;font-weight:500;color:var(--beacon-fg);text-transform:capitalize}.beacon-severity-opt input{position:absolute;opacity:0;pointer-events:none}.beacon-severity-opt:hover{background:var(--beacon-border)}.beacon-severity-opt.selected[data-sev=bug]{border-color:var(--beacon-bug);color:var(--beacon-bug)}.beacon-severity-opt.selected[data-sev=idea]{border-color:var(--beacon-idea);color:var(--beacon-idea)}.beacon-severity-opt.selected[data-sev=ux]{border-color:var(--beacon-ux);color:var(--beacon-ux)}.beacon-severity-opt.selected[data-sev=a11y]{border-color:var(--beacon-a11y);color:var(--beacon-a11y)}.beacon-actions{display:flex;gap:8px;align-items:center}.beacon-btn{display:inline-flex;align-items:center;gap:6px;padding:8px 14px;border-radius:6px;border:0;cursor:pointer;font:inherit;font-weight:500;font-size:13px;transition:opacity .15s ease}.beacon-btn[disabled]{opacity:.5;cursor:not-allowed}.beacon-btn svg{width:14px;height:14px}.beacon-btn.primary{background:var(--beacon-accent);color:#fff}.beacon-btn.secondary{background:transparent;color:var(--beacon-fg);border:1px solid var(--beacon-border)}.beacon-btn.secondary:hover{background:var(--beacon-border)}.beacon-pin-list{display:flex;flex-direction:column;gap:6px;max-height:200px;overflow-y:auto}.beacon-pin-item{display:flex;align-items:flex-start;gap:8px;padding:8px;background:var(--beacon-border);border-radius:6px}.beacon-pin-num{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--beacon-accent);color:#fff;font-size:11px;font-weight:600;flex-shrink:0}.beacon-pin-meta{flex:1;min-width:0}.beacon-pin-selector{font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--beacon-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.beacon-pin-note{margin-top:4px;font-size:12px;color:var(--beacon-fg)}.beacon-pin-note-input{margin-top:4px;width:100%;padding:4px 6px;background:var(--beacon-bg);color:var(--beacon-fg);border:1px solid var(--beacon-border);border-radius:4px;font:inherit;font-size:12px;box-sizing:border-box}.beacon-thumb{width:100%;border:1px solid var(--beacon-border);border-radius:6px;display:block}.beacon-status{font-size:12px;color:var(--beacon-muted);text-align:center;padding:4px}.beacon-status.error{color:var(--beacon-bug)}.beacon-status.success{color:var(--beacon-idea)}.beacon-events{font-size:12px;border:1px solid var(--beacon-border);border-radius:6px;padding:6px 8px}.beacon-events-summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:6px;color:var(--beacon-muted);-webkit-user-select:none;-moz-user-select:none;user-select:none}.beacon-events-summary::-webkit-details-marker{display:none}.beacon-events-dot{color:var(--beacon-bug);font-size:10px;line-height:1}.beacon-events-list{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:4px;max-height:160px;overflow-y:auto}.beacon-events-item{display:flex;align-items:flex-start;gap:6px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;line-height:1.4}.beacon-events-kind{flex-shrink:0;padding:1px 5px;border-radius:3px;font-size:10px;text-transform:uppercase;letter-spacing:.04em}.beacon-events-kind.error{background:#eb141426;color:var(--beacon-bug)}.beacon-events-kind.rejection{background:#f59f0a26;color:#f59f0a}.beacon-events-msg{word-break:break-word;color:var(--beacon-fg)}.beacon-pin-popover{position:fixed;z-index:2147483647;width:240px;background:var(--beacon-bg);color:var(--beacon-fg);border:1px solid var(--beacon-border);border-radius:6px;box-shadow:var(--beacon-shadow);padding:10px;display:none;flex-direction:column;gap:8px}.beacon-pin-popover.open{display:flex}.beacon-pin-popover-header{display:flex;align-items:center;justify-content:space-between;gap:6px}.beacon-pin-popover-actions{display:flex;gap:6px;justify-content:flex-end}', k = {
|
|
2
2
|
feedback: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>',
|
|
3
3
|
pin: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg>',
|
|
4
4
|
close: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',
|
|
@@ -6,22 +6,23 @@ const R = '.beacon-drawer,.beacon-pin-popover{--beacon-accent: #0ea5e9;--beacon-
|
|
|
6
6
|
send: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>',
|
|
7
7
|
check: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>'
|
|
8
8
|
};
|
|
9
|
-
function
|
|
9
|
+
function ke(t = "Feedback") {
|
|
10
10
|
const e = document.createElement("button");
|
|
11
|
-
return e.type = "button", e.className = "beacon-default-trigger", e.setAttribute("aria-label",
|
|
11
|
+
return e.type = "button", e.className = "beacon-default-trigger", e.setAttribute("aria-label", t), e.innerHTML = `${k.feedback}<span>${t}</span>`, e;
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
class
|
|
15
|
-
constructor(e,
|
|
13
|
+
const Ae = ["bug", "idea", "ux", "a11y"];
|
|
14
|
+
class Ce {
|
|
15
|
+
constructor(e, n) {
|
|
16
16
|
this.state = {
|
|
17
17
|
description: "",
|
|
18
18
|
severity: "bug",
|
|
19
19
|
pins: [],
|
|
20
|
+
events: [],
|
|
20
21
|
annotatedScreenshot: void 0,
|
|
21
22
|
submitting: !1,
|
|
22
23
|
status: "",
|
|
23
24
|
statusKind: ""
|
|
24
|
-
}, this.severities = e.length > 0 ? e :
|
|
25
|
+
}, this.severities = e.length > 0 ? e : Ae, this.callbacks = n, this.root = document.createElement("div"), this.root.className = "beacon-drawer", this.root.innerHTML = `
|
|
25
26
|
<div class="beacon-drawer-header">
|
|
26
27
|
<div class="beacon-drawer-title">Send feedback</div>
|
|
27
28
|
<button type="button" class="beacon-icon-btn" data-action="close" aria-label="Close">${k.close}</button>
|
|
@@ -38,8 +39,38 @@ class G {
|
|
|
38
39
|
minimize() {
|
|
39
40
|
this.root.classList.add("minimized"), this.root.classList.remove("open");
|
|
40
41
|
}
|
|
41
|
-
setPins(e,
|
|
42
|
-
this.state.pins = e,
|
|
42
|
+
setPins(e, n) {
|
|
43
|
+
this.state.pins = e, n !== void 0 && (this.state.annotatedScreenshot = n), this.render();
|
|
44
|
+
}
|
|
45
|
+
// Push the latest events buffer into the drawer. element.ts calls this both
|
|
46
|
+
// on open() (initial snapshot) AND from a subscriber so the chip ticks up
|
|
47
|
+
// live as errors fire. We partial-update the chip element only — a full
|
|
48
|
+
// re-render of bodyEl would blow away the textarea's focus + cursor while
|
|
49
|
+
// the user is typing, which is much worse than the chip never animating.
|
|
50
|
+
setEvents(e) {
|
|
51
|
+
this.state.events = e, this.updateEventsChip();
|
|
52
|
+
}
|
|
53
|
+
updateEventsChip() {
|
|
54
|
+
const e = this.bodyEl.querySelector(".beacon-events");
|
|
55
|
+
if (!e) {
|
|
56
|
+
this.render();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const n = this.state.events.length;
|
|
60
|
+
if (n === 0) {
|
|
61
|
+
e.hidden = !0;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
e.hidden = !1, e.dataset.count = String(n);
|
|
65
|
+
const o = e.querySelector(".beacon-events-label");
|
|
66
|
+
o && (o.textContent = `${n} runtime ${n === 1 ? "error" : "errors"} will be included`);
|
|
67
|
+
const s = e.querySelector(".beacon-events-list");
|
|
68
|
+
s && (s.innerHTML = this.state.events.map((i) => `
|
|
69
|
+
<li class="beacon-events-item">
|
|
70
|
+
<span class="beacon-events-kind ${i.kind === "unhandledrejection" ? "rejection" : "error"}">${i.kind === "unhandledrejection" ? "rejection" : "error"}</span>
|
|
71
|
+
<span class="beacon-events-msg">${S(i.message)}</span>
|
|
72
|
+
</li>
|
|
73
|
+
`).join(""));
|
|
43
74
|
}
|
|
44
75
|
getAnnotatedScreenshot() {
|
|
45
76
|
return this.state.annotatedScreenshot;
|
|
@@ -50,14 +81,15 @@ class G {
|
|
|
50
81
|
setSubmitting(e) {
|
|
51
82
|
this.state.submitting = e, this.render();
|
|
52
83
|
}
|
|
53
|
-
setStatus(e,
|
|
54
|
-
this.state.status = e, this.state.statusKind =
|
|
84
|
+
setStatus(e, n = "") {
|
|
85
|
+
this.state.status = e, this.state.statusKind = n, this.render();
|
|
55
86
|
}
|
|
56
87
|
reset() {
|
|
57
88
|
this.state = {
|
|
58
89
|
description: "",
|
|
59
90
|
severity: "bug",
|
|
60
91
|
pins: [],
|
|
92
|
+
events: [],
|
|
61
93
|
annotatedScreenshot: void 0,
|
|
62
94
|
submitting: !1,
|
|
63
95
|
status: "",
|
|
@@ -71,21 +103,21 @@ class G {
|
|
|
71
103
|
return this.state.severity;
|
|
72
104
|
}
|
|
73
105
|
render() {
|
|
74
|
-
var o,
|
|
106
|
+
var o, s;
|
|
75
107
|
const e = this.state.description.trim().length > 0 && !this.state.submitting;
|
|
76
108
|
this.bodyEl.innerHTML = `
|
|
77
109
|
<div class="beacon-field">
|
|
78
110
|
<label class="beacon-label" for="beacon-desc">What's the issue?</label>
|
|
79
|
-
<textarea id="beacon-desc" class="beacon-textarea" placeholder="Describe what you saw, what you expected, anything that helps reproduce…">${
|
|
111
|
+
<textarea id="beacon-desc" class="beacon-textarea" placeholder="Describe what you saw, what you expected, anything that helps reproduce…">${S(this.state.description)}</textarea>
|
|
80
112
|
</div>
|
|
81
113
|
|
|
82
114
|
<div class="beacon-field">
|
|
83
115
|
<span class="beacon-label">Severity</span>
|
|
84
116
|
<div class="beacon-severity" role="radiogroup">
|
|
85
|
-
${this.severities.map((
|
|
86
|
-
<label class="beacon-severity-opt ${
|
|
87
|
-
<input type="radio" name="beacon-severity" value="${
|
|
88
|
-
${
|
|
117
|
+
${this.severities.map((i) => `
|
|
118
|
+
<label class="beacon-severity-opt ${i === this.state.severity ? "selected" : ""}" data-sev="${i}">
|
|
119
|
+
<input type="radio" name="beacon-severity" value="${i}" ${i === this.state.severity ? "checked" : ""}>
|
|
120
|
+
${i}
|
|
89
121
|
</label>
|
|
90
122
|
`).join("")}
|
|
91
123
|
</div>
|
|
@@ -102,20 +134,35 @@ class G {
|
|
|
102
134
|
<div class="beacon-field">
|
|
103
135
|
<span class="beacon-label">Pins (${this.state.pins.length})</span>
|
|
104
136
|
<div class="beacon-pin-list">
|
|
105
|
-
${this.state.pins.map((
|
|
106
|
-
<div class="beacon-pin-item" data-pin="${
|
|
107
|
-
<span class="beacon-pin-num">${
|
|
137
|
+
${this.state.pins.map((i) => `
|
|
138
|
+
<div class="beacon-pin-item" data-pin="${i.number}">
|
|
139
|
+
<span class="beacon-pin-num">${i.number}</span>
|
|
108
140
|
<div class="beacon-pin-meta">
|
|
109
|
-
<div class="beacon-pin-selector" title="${
|
|
110
|
-
<input type="text" class="beacon-pin-note-input" placeholder="Add a note (optional)" value="${
|
|
141
|
+
<div class="beacon-pin-selector" title="${S(i.selector)}">${S(i.selector)}</div>
|
|
142
|
+
<input type="text" class="beacon-pin-note-input" placeholder="Add a note (optional)" value="${S(i.note ?? "")}">
|
|
111
143
|
</div>
|
|
112
|
-
<button type="button" class="beacon-icon-btn" data-pin-delete="${
|
|
144
|
+
<button type="button" class="beacon-icon-btn" data-pin-delete="${i.number}" aria-label="Remove pin ${i.number}">${k.trash}</button>
|
|
113
145
|
</div>
|
|
114
146
|
`).join("")}
|
|
115
147
|
</div>
|
|
116
148
|
</div>
|
|
117
149
|
` : ""}
|
|
118
150
|
|
|
151
|
+
<details class="beacon-events" data-count="${this.state.events.length}" ${this.state.events.length === 0 ? "hidden" : ""}>
|
|
152
|
+
<summary class="beacon-events-summary">
|
|
153
|
+
<span class="beacon-events-dot" aria-hidden="true">●</span>
|
|
154
|
+
<span class="beacon-events-label">${this.state.events.length} runtime ${this.state.events.length === 1 ? "error" : "errors"} will be included</span>
|
|
155
|
+
</summary>
|
|
156
|
+
<ul class="beacon-events-list">
|
|
157
|
+
${this.state.events.map((i) => `
|
|
158
|
+
<li class="beacon-events-item">
|
|
159
|
+
<span class="beacon-events-kind ${i.kind === "unhandledrejection" ? "rejection" : "error"}">${i.kind === "unhandledrejection" ? "rejection" : "error"}</span>
|
|
160
|
+
<span class="beacon-events-msg">${S(i.message)}</span>
|
|
161
|
+
</li>
|
|
162
|
+
`).join("")}
|
|
163
|
+
</ul>
|
|
164
|
+
</details>
|
|
165
|
+
|
|
119
166
|
<div class="beacon-actions">
|
|
120
167
|
<button type="button" class="beacon-btn secondary" data-action="annotate" ${this.state.submitting ? "disabled" : ""}>
|
|
121
168
|
${k.pin} ${this.state.pins.length > 0 ? "Add another pin" : "Annotate elements"}
|
|
@@ -126,38 +173,38 @@ class G {
|
|
|
126
173
|
</button>
|
|
127
174
|
</div>
|
|
128
175
|
|
|
129
|
-
${this.state.status ? `<div class="beacon-status ${this.state.statusKind}">${
|
|
176
|
+
${this.state.status ? `<div class="beacon-status ${this.state.statusKind}">${S(this.state.status)}</div>` : ""}
|
|
130
177
|
`;
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
this.state.description =
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
}), this.bodyEl.querySelectorAll('input[name="beacon-severity"]').forEach((
|
|
137
|
-
|
|
138
|
-
|
|
178
|
+
const n = this.bodyEl.querySelector("#beacon-desc");
|
|
179
|
+
n.addEventListener("input", () => {
|
|
180
|
+
this.state.description = n.value, this.callbacks.onDescriptionChange(n.value);
|
|
181
|
+
const i = this.bodyEl.querySelector('[data-action="submit"]');
|
|
182
|
+
i && (i.disabled = !(n.value.trim().length > 0) || this.state.submitting);
|
|
183
|
+
}), this.bodyEl.querySelectorAll('input[name="beacon-severity"]').forEach((i) => {
|
|
184
|
+
i.addEventListener("change", () => {
|
|
185
|
+
i.checked && (this.state.severity = i.value, this.callbacks.onSeverityChange(this.state.severity), this.render());
|
|
139
186
|
});
|
|
140
|
-
}), (o = this.bodyEl.querySelector('[data-action="annotate"]')) == null || o.addEventListener("click", () => this.callbacks.onAnnotate()), (
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
this.callbacks.onPinDelete(
|
|
187
|
+
}), (o = this.bodyEl.querySelector('[data-action="annotate"]')) == null || o.addEventListener("click", () => this.callbacks.onAnnotate()), (s = this.bodyEl.querySelector('[data-action="submit"]')) == null || s.addEventListener("click", () => this.callbacks.onSubmit()), this.bodyEl.querySelectorAll("[data-pin-delete]").forEach((i) => {
|
|
188
|
+
i.addEventListener("click", () => {
|
|
189
|
+
const r = Number(i.getAttribute("data-pin-delete"));
|
|
190
|
+
this.callbacks.onPinDelete(r);
|
|
144
191
|
});
|
|
145
|
-
}), this.bodyEl.querySelectorAll(".beacon-pin-note-input").forEach((
|
|
146
|
-
const
|
|
147
|
-
|
|
192
|
+
}), this.bodyEl.querySelectorAll(".beacon-pin-note-input").forEach((i) => {
|
|
193
|
+
const r = i.closest("[data-pin]"), l = Number((r == null ? void 0 : r.getAttribute("data-pin")) ?? 0);
|
|
194
|
+
i.addEventListener("input", () => this.callbacks.onPinNoteChange(l, i.value));
|
|
148
195
|
});
|
|
149
196
|
}
|
|
150
197
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
198
|
+
function S(t) {
|
|
199
|
+
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
153
200
|
}
|
|
154
|
-
function
|
|
201
|
+
function Le(t) {
|
|
155
202
|
return new Promise((e) => {
|
|
156
|
-
const
|
|
157
|
-
|
|
203
|
+
const n = document.createElement("div");
|
|
204
|
+
n.className = "beacon-pin-popover open beacon-no-capture beacon-theme-auto", n.innerHTML = `
|
|
158
205
|
<div class="beacon-pin-popover-header">
|
|
159
206
|
<div style="display:flex;align-items:center;gap:6px;font-weight:600;font-size:13px;">
|
|
160
|
-
<span class="beacon-pin-num">${
|
|
207
|
+
<span class="beacon-pin-num">${t.pinNumber}</span>
|
|
161
208
|
<span>Note for this pin</span>
|
|
162
209
|
</div>
|
|
163
210
|
<button type="button" class="beacon-icon-btn" data-action="cancel" aria-label="Discard this pin">${k.close}</button>
|
|
@@ -167,52 +214,52 @@ function Z(n) {
|
|
|
167
214
|
<button type="button" class="beacon-btn primary" data-action="save">${k.check} Save</button>
|
|
168
215
|
</div>
|
|
169
216
|
`;
|
|
170
|
-
const o = 240,
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
function
|
|
175
|
-
document.removeEventListener("keydown",
|
|
176
|
-
}
|
|
177
|
-
function
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
document.addEventListener("keydown",
|
|
181
|
-
var
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
184
|
-
const
|
|
185
|
-
|
|
217
|
+
const o = 240, s = 160, i = Math.min(Math.max(8, t.anchor.x), window.innerWidth - o - 8), r = Math.min(Math.max(8, t.anchor.y + 12), window.innerHeight - s - 8);
|
|
218
|
+
n.style.left = `${i}px`, n.style.top = `${r}px`, document.body.appendChild(n);
|
|
219
|
+
const l = n.querySelector("textarea");
|
|
220
|
+
l.focus();
|
|
221
|
+
function a(d) {
|
|
222
|
+
document.removeEventListener("keydown", c, !0), n.remove(), e(d);
|
|
223
|
+
}
|
|
224
|
+
function c(d) {
|
|
225
|
+
d.key === "Escape" && (d.preventDefault(), d.stopPropagation(), a({ cancelled: "all" }));
|
|
226
|
+
}
|
|
227
|
+
document.addEventListener("keydown", c, !0), n.addEventListener("click", (d) => {
|
|
228
|
+
var y;
|
|
229
|
+
const g = (y = d.target.closest("[data-action]")) == null ? void 0 : y.getAttribute("data-action");
|
|
230
|
+
if (g === "cancel" && a({ cancelled: "pin" }), g === "save") {
|
|
231
|
+
const w = l.value.trim();
|
|
232
|
+
a({ ...w ? { note: w } : {}, cancelled: !1 });
|
|
186
233
|
}
|
|
187
|
-
}),
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
|
|
234
|
+
}), l.addEventListener("keydown", (d) => {
|
|
235
|
+
if (d.key === "Enter" && (d.metaKey || d.ctrlKey)) {
|
|
236
|
+
d.preventDefault();
|
|
237
|
+
const u = l.value.trim();
|
|
238
|
+
a({ ...u ? { note: u } : {}, cancelled: !1 });
|
|
192
239
|
}
|
|
193
240
|
});
|
|
194
241
|
});
|
|
195
242
|
}
|
|
196
|
-
const A = "beacon-no-capture",
|
|
197
|
-
function
|
|
198
|
-
return /^#[0-9a-fA-F]{6}$/.test(
|
|
243
|
+
const A = "beacon-no-capture", Te = "#0ea5e9", K = "Click any element to pin it · Press Esc to finish";
|
|
244
|
+
function X(t, e) {
|
|
245
|
+
return /^#[0-9a-fA-F]{6}$/.test(t) ? `${t}${e}` : t;
|
|
199
246
|
}
|
|
200
|
-
function
|
|
201
|
-
const e =
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
|
|
247
|
+
function Me(t = {}) {
|
|
248
|
+
const e = t.accent ?? Te, n = X(e, "b3"), o = X(e, "2e"), s = document.createElement("style");
|
|
249
|
+
s.className = A, s.textContent = "@keyframes beacon-spin { to { transform: rotate(360deg); } }", document.head.appendChild(s);
|
|
250
|
+
const i = document.createElement("div");
|
|
251
|
+
i.className = A, i.setAttribute("aria-hidden", "true"), i.style.cssText = [
|
|
205
252
|
"position: fixed",
|
|
206
253
|
"inset: 0",
|
|
207
254
|
"pointer-events: none",
|
|
208
255
|
"z-index: 2147483646",
|
|
209
|
-
`border: 2px dashed ${
|
|
256
|
+
`border: 2px dashed ${n}`,
|
|
210
257
|
"border-radius: 4px",
|
|
211
258
|
`box-shadow: inset 0 0 56px ${o}`,
|
|
212
259
|
"box-sizing: border-box"
|
|
213
260
|
].join("; ");
|
|
214
|
-
const
|
|
215
|
-
|
|
261
|
+
const r = document.createElement("div");
|
|
262
|
+
r.className = A, r.setAttribute("role", "status"), r.style.cssText = [
|
|
216
263
|
"position: fixed",
|
|
217
264
|
"top: 16px",
|
|
218
265
|
"left: 50%",
|
|
@@ -227,8 +274,8 @@ function Q(n = {}) {
|
|
|
227
274
|
"pointer-events: none",
|
|
228
275
|
"white-space: nowrap",
|
|
229
276
|
"z-index: 2147483646"
|
|
230
|
-
].join("; "),
|
|
231
|
-
const
|
|
277
|
+
].join("; "), r.textContent = K;
|
|
278
|
+
const l = `<span style="
|
|
232
279
|
display: inline-block;
|
|
233
280
|
width: 12px;
|
|
234
281
|
height: 12px;
|
|
@@ -239,14 +286,14 @@ function Q(n = {}) {
|
|
|
239
286
|
vertical-align: middle;
|
|
240
287
|
margin-right: 8px;
|
|
241
288
|
"></span>`;
|
|
242
|
-
function
|
|
243
|
-
return
|
|
244
|
-
}
|
|
245
|
-
document.body.appendChild(
|
|
246
|
-
const
|
|
247
|
-
function h
|
|
248
|
-
const
|
|
249
|
-
return
|
|
289
|
+
function a(h) {
|
|
290
|
+
return h.replace(/[<>&]/g, (f) => ({ "<": "<", ">": ">", "&": "&" })[f]);
|
|
291
|
+
}
|
|
292
|
+
document.body.appendChild(i), document.body.appendChild(r);
|
|
293
|
+
const c = /* @__PURE__ */ new Map();
|
|
294
|
+
function d(h) {
|
|
295
|
+
const f = document.createElement("div");
|
|
296
|
+
return f.className = A, f.setAttribute("aria-hidden", "true"), f.style.cssText = [
|
|
250
297
|
"position: fixed",
|
|
251
298
|
"width: 24px",
|
|
252
299
|
"height: 24px",
|
|
@@ -261,11 +308,11 @@ function Q(n = {}) {
|
|
|
261
308
|
"box-shadow: 0 2px 8px #00000066",
|
|
262
309
|
"pointer-events: none",
|
|
263
310
|
"z-index: 2147483646"
|
|
264
|
-
].join("; "),
|
|
311
|
+
].join("; "), f.textContent = String(h), document.body.appendChild(f), f;
|
|
265
312
|
}
|
|
266
|
-
function
|
|
267
|
-
const
|
|
268
|
-
return
|
|
313
|
+
function u() {
|
|
314
|
+
const h = document.createElement("div");
|
|
315
|
+
return h.className = A, h.setAttribute("aria-hidden", "true"), h.style.cssText = [
|
|
269
316
|
"position: fixed",
|
|
270
317
|
"pointer-events: none",
|
|
271
318
|
`border: 2px solid ${e}`,
|
|
@@ -273,72 +320,72 @@ function Q(n = {}) {
|
|
|
273
320
|
"box-sizing: border-box",
|
|
274
321
|
// Slightly below marker z so the marker visually "sits on" the outline corner.
|
|
275
322
|
"z-index: 2147483645"
|
|
276
|
-
].join("; "), document.body.appendChild(
|
|
277
|
-
}
|
|
278
|
-
function
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
function
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
function
|
|
286
|
-
|
|
287
|
-
let
|
|
288
|
-
if (document.contains(
|
|
289
|
-
const
|
|
290
|
-
if (
|
|
291
|
-
|
|
323
|
+
].join("; "), document.body.appendChild(h), h;
|
|
324
|
+
}
|
|
325
|
+
function g(h, f, p) {
|
|
326
|
+
const b = p ? "0.5" : "1";
|
|
327
|
+
h.outline.style.display = "block", h.outline.style.opacity = b, h.outline.style.left = `${f.x}px`, h.outline.style.top = `${f.y}px`, h.outline.style.width = `${f.w}px`, h.outline.style.height = `${f.h}px`, h.marker.style.display = "flex", h.marker.style.opacity = b, h.marker.style.left = `${f.x + f.w - 12}px`, h.marker.style.top = `${Math.max(2, f.y - 12)}px`;
|
|
328
|
+
}
|
|
329
|
+
function y(h) {
|
|
330
|
+
h.marker.style.display = "none", h.outline.style.display = "none";
|
|
331
|
+
}
|
|
332
|
+
function w() {
|
|
333
|
+
c.forEach((h) => {
|
|
334
|
+
let f = h.anchor.target;
|
|
335
|
+
if (document.contains(f) || (f = null), !f && h.anchor.selector && (f = document.querySelector(h.anchor.selector), f && (h.anchor.target = f)), f) {
|
|
336
|
+
const b = f.getBoundingClientRect();
|
|
337
|
+
if (b.width > 0 || b.height > 0) {
|
|
338
|
+
g(h, { x: b.left, y: b.top, w: b.width, h: b.height }, !1);
|
|
292
339
|
return;
|
|
293
340
|
}
|
|
294
341
|
}
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
297
|
-
|
|
342
|
+
const p = h.anchor.fallbackRect;
|
|
343
|
+
if (p && (p.w > 0 || p.h > 0)) {
|
|
344
|
+
g(h, p, !0);
|
|
298
345
|
return;
|
|
299
346
|
}
|
|
300
|
-
|
|
347
|
+
y(h);
|
|
301
348
|
});
|
|
302
349
|
}
|
|
303
|
-
let
|
|
304
|
-
function
|
|
305
|
-
|
|
306
|
-
|
|
350
|
+
let x = null;
|
|
351
|
+
function v() {
|
|
352
|
+
x === null && (x = requestAnimationFrame(() => {
|
|
353
|
+
x = null, w();
|
|
307
354
|
}));
|
|
308
355
|
}
|
|
309
|
-
return window.addEventListener("scroll",
|
|
310
|
-
addPin(
|
|
311
|
-
const
|
|
312
|
-
|
|
356
|
+
return window.addEventListener("scroll", v, !0), window.addEventListener("resize", v), {
|
|
357
|
+
addPin(h, f) {
|
|
358
|
+
const p = d(h), b = u();
|
|
359
|
+
c.set(h, { anchor: f, marker: p, outline: b }), w();
|
|
313
360
|
},
|
|
314
|
-
setLoading(
|
|
315
|
-
|
|
361
|
+
setLoading(h) {
|
|
362
|
+
h ? r.innerHTML = l + a(h) : r.textContent = K;
|
|
316
363
|
},
|
|
317
364
|
destroy() {
|
|
318
|
-
window.removeEventListener("scroll",
|
|
319
|
-
|
|
320
|
-
}),
|
|
365
|
+
window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v), x !== null && cancelAnimationFrame(x), i.remove(), r.remove(), s.remove(), c.forEach(({ marker: h, outline: f }) => {
|
|
366
|
+
h.remove(), f.remove();
|
|
367
|
+
}), c.clear();
|
|
321
368
|
}
|
|
322
369
|
};
|
|
323
370
|
}
|
|
324
|
-
const
|
|
325
|
-
function
|
|
326
|
-
return /^#[0-9a-fA-F]{6}$/.test(
|
|
371
|
+
const Ie = "#0ea5e9";
|
|
372
|
+
function _e(t, e) {
|
|
373
|
+
return /^#[0-9a-fA-F]{6}$/.test(t) ? `${t}${e}` : t;
|
|
327
374
|
}
|
|
328
|
-
function
|
|
329
|
-
const { shadowRoot: e, onHover:
|
|
330
|
-
|
|
375
|
+
function $e(t) {
|
|
376
|
+
const { shadowRoot: e, onHover: n } = t, o = t.accent ?? Ie, s = _e(o, "14"), i = document.createElement("div");
|
|
377
|
+
i.style.cssText = [
|
|
331
378
|
"position: fixed",
|
|
332
379
|
"pointer-events: none",
|
|
333
380
|
"z-index: 2147483646",
|
|
334
381
|
`border: 2px solid ${o}`,
|
|
335
|
-
`background: ${
|
|
382
|
+
`background: ${s}`,
|
|
336
383
|
"transition: all 60ms ease-out",
|
|
337
384
|
"box-sizing: border-box",
|
|
338
385
|
"border-radius: 2px"
|
|
339
|
-
].join("; "), document.body.appendChild(
|
|
340
|
-
const
|
|
341
|
-
|
|
386
|
+
].join("; "), document.body.appendChild(i);
|
|
387
|
+
const r = document.createElement("div");
|
|
388
|
+
r.style.cssText = [
|
|
342
389
|
"position: fixed",
|
|
343
390
|
"pointer-events: none",
|
|
344
391
|
"z-index: 2147483647",
|
|
@@ -351,152 +398,152 @@ function ne(n) {
|
|
|
351
398
|
"overflow: hidden",
|
|
352
399
|
"text-overflow: ellipsis",
|
|
353
400
|
"white-space: nowrap"
|
|
354
|
-
].join("; "), document.body.appendChild(
|
|
355
|
-
const
|
|
401
|
+
].join("; "), document.body.appendChild(r);
|
|
402
|
+
const l = document.body.style.cursor;
|
|
356
403
|
document.body.style.cursor = "crosshair";
|
|
357
|
-
let
|
|
404
|
+
let a = !1, c = () => {
|
|
358
405
|
};
|
|
359
|
-
const
|
|
360
|
-
|
|
406
|
+
const d = new Promise((p) => {
|
|
407
|
+
c = p;
|
|
361
408
|
});
|
|
362
|
-
function
|
|
363
|
-
if (!
|
|
364
|
-
let
|
|
365
|
-
for (;
|
|
366
|
-
if (
|
|
367
|
-
|
|
409
|
+
function u(p) {
|
|
410
|
+
if (!p || !(p instanceof Node)) return !1;
|
|
411
|
+
let b = p;
|
|
412
|
+
for (; b; ) {
|
|
413
|
+
if (b === e || b === e.host) return !0;
|
|
414
|
+
b = b.parentNode ?? b.host ?? null;
|
|
368
415
|
}
|
|
369
416
|
return !1;
|
|
370
417
|
}
|
|
371
|
-
function
|
|
372
|
-
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
for (const
|
|
376
|
-
if (!
|
|
418
|
+
function g(p, b) {
|
|
419
|
+
i.style.display = "none", r.style.display = "none";
|
|
420
|
+
const N = document.elementsFromPoint(p, b);
|
|
421
|
+
i.style.display = "block", r.style.display = "block";
|
|
422
|
+
for (const I of N)
|
|
423
|
+
if (!u(I)) return I;
|
|
377
424
|
return null;
|
|
378
425
|
}
|
|
379
|
-
function
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
const
|
|
385
|
-
|
|
426
|
+
function y(p) {
|
|
427
|
+
const b = p.getBoundingClientRect();
|
|
428
|
+
i.style.left = `${b.left}px`, i.style.top = `${b.top}px`, i.style.width = `${b.width}px`, i.style.height = `${b.height}px`;
|
|
429
|
+
const N = p.tagName.toLowerCase(), I = p.classList.length > 0 ? "." + Array.from(p.classList).slice(0, 2).join(".") : "";
|
|
430
|
+
r.textContent = N + I;
|
|
431
|
+
const W = b.top - 22;
|
|
432
|
+
r.style.left = `${b.left}px`, r.style.top = `${W >= 0 ? W : b.bottom + 4}px`;
|
|
386
433
|
}
|
|
387
|
-
function
|
|
388
|
-
const
|
|
389
|
-
|
|
434
|
+
function w(p) {
|
|
435
|
+
const b = g(p.clientX, p.clientY);
|
|
436
|
+
b ? (y(b), n == null || n(b)) : (i.style.display = "none", r.style.display = "none", n == null || n(null));
|
|
390
437
|
}
|
|
391
|
-
function
|
|
392
|
-
if (
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
|
|
438
|
+
function x(p) {
|
|
439
|
+
if (p.button !== 0) return;
|
|
440
|
+
p.preventDefault(), p.stopPropagation();
|
|
441
|
+
const b = g(p.clientX, p.clientY);
|
|
442
|
+
b && f(b);
|
|
396
443
|
}
|
|
397
|
-
function
|
|
398
|
-
|
|
444
|
+
function v(p) {
|
|
445
|
+
p.preventDefault(), p.stopPropagation();
|
|
399
446
|
}
|
|
400
|
-
function
|
|
401
|
-
|
|
447
|
+
function h(p) {
|
|
448
|
+
p.key === "Escape" && (p.preventDefault(), f(null));
|
|
402
449
|
}
|
|
403
|
-
function
|
|
404
|
-
|
|
450
|
+
function f(p) {
|
|
451
|
+
a || (a = !0, document.removeEventListener("mousemove", w, !0), document.removeEventListener("pointerdown", x, !0), document.removeEventListener("click", v, !0), document.removeEventListener("mouseup", v, !0), document.removeEventListener("keydown", h, !0), i.remove(), r.remove(), document.body.style.cursor = l, c(p));
|
|
405
452
|
}
|
|
406
|
-
return document.addEventListener("mousemove",
|
|
407
|
-
cancel: () =>
|
|
408
|
-
promise:
|
|
453
|
+
return document.addEventListener("mousemove", w, !0), document.addEventListener("pointerdown", x, !0), document.addEventListener("click", v, !0), document.addEventListener("mouseup", v, !0), document.addEventListener("keydown", h, !0), {
|
|
454
|
+
cancel: () => f(null),
|
|
455
|
+
promise: d
|
|
409
456
|
};
|
|
410
457
|
}
|
|
411
|
-
const
|
|
412
|
-
function
|
|
413
|
-
if (!
|
|
458
|
+
const Ne = 8;
|
|
459
|
+
function Y(t, e = document) {
|
|
460
|
+
if (!t) return !1;
|
|
414
461
|
try {
|
|
415
|
-
return e.querySelectorAll(`#${CSS.escape(
|
|
462
|
+
return e.querySelectorAll(`#${CSS.escape(t)}`).length === 1;
|
|
416
463
|
} catch {
|
|
417
464
|
return !1;
|
|
418
465
|
}
|
|
419
466
|
}
|
|
420
|
-
function
|
|
421
|
-
const e =
|
|
422
|
-
return e +
|
|
467
|
+
function Re(t) {
|
|
468
|
+
const e = t.tagName.toLowerCase(), n = Array.from(t.classList).filter((o) => o.length > 0 && o.length < 40).slice(0, 3).map((o) => `.${CSS.escape(o)}`).join("");
|
|
469
|
+
return e + n;
|
|
423
470
|
}
|
|
424
|
-
function
|
|
425
|
-
const e =
|
|
426
|
-
return e ? Array.from(e.children).filter((o) => o.tagName ===
|
|
471
|
+
function Pe(t) {
|
|
472
|
+
const e = t.parentElement;
|
|
473
|
+
return e ? Array.from(e.children).filter((o) => o.tagName === t.tagName).indexOf(t) + 1 : 1;
|
|
427
474
|
}
|
|
428
|
-
function
|
|
429
|
-
if (!
|
|
430
|
-
if (
|
|
431
|
-
return `#${CSS.escape(
|
|
475
|
+
function De(t) {
|
|
476
|
+
if (!t || t.nodeType !== Node.ELEMENT_NODE) return "";
|
|
477
|
+
if (t.id && Y(t.id))
|
|
478
|
+
return `#${CSS.escape(t.id)}`;
|
|
432
479
|
const e = [];
|
|
433
|
-
let
|
|
434
|
-
for (;
|
|
435
|
-
const
|
|
436
|
-
if (
|
|
437
|
-
e.unshift(`#${CSS.escape(
|
|
480
|
+
let n = t, o = 0;
|
|
481
|
+
for (; n && n.tagName.toLowerCase() !== "body" && o < Ne; ) {
|
|
482
|
+
const s = n;
|
|
483
|
+
if (s.id && Y(s.id)) {
|
|
484
|
+
e.unshift(`#${CSS.escape(s.id)}`);
|
|
438
485
|
break;
|
|
439
486
|
}
|
|
440
|
-
const
|
|
441
|
-
let
|
|
442
|
-
if (
|
|
487
|
+
const i = Re(s), r = s.parentElement;
|
|
488
|
+
let l = i;
|
|
489
|
+
if (r)
|
|
443
490
|
try {
|
|
444
|
-
const
|
|
445
|
-
Array.from(
|
|
446
|
-
(
|
|
447
|
-
).length > 1 && (
|
|
491
|
+
const a = Array.from(s.classList).join(" ");
|
|
492
|
+
Array.from(r.children).filter(
|
|
493
|
+
(d) => d.tagName === s.tagName && Array.from(d.classList).join(" ") === a
|
|
494
|
+
).length > 1 && (l = `${s.tagName.toLowerCase()}:nth-of-type(${Pe(s)})`);
|
|
448
495
|
} catch {
|
|
449
496
|
}
|
|
450
|
-
e.unshift(
|
|
497
|
+
e.unshift(l), n = r, o++;
|
|
451
498
|
}
|
|
452
499
|
return e.join(" > ");
|
|
453
500
|
}
|
|
454
|
-
function
|
|
455
|
-
const e = Object.keys(
|
|
501
|
+
function Be(t) {
|
|
502
|
+
const e = Object.keys(t).filter((o) => o.startsWith("__reactFiber$") || o.startsWith("__reactInternalInstance$"));
|
|
456
503
|
if (e.length === 0) return null;
|
|
457
|
-
let
|
|
458
|
-
for (let o = 0; o < 10 &&
|
|
459
|
-
const
|
|
460
|
-
if (typeof
|
|
461
|
-
const
|
|
462
|
-
if (
|
|
504
|
+
let n = t[e[0]];
|
|
505
|
+
for (let o = 0; o < 10 && n; o++) {
|
|
506
|
+
const s = n, i = s.type;
|
|
507
|
+
if (typeof i == "function") {
|
|
508
|
+
const r = i.displayName ?? i.name;
|
|
509
|
+
if (r && r !== "_default") return { lib: "react", name: r };
|
|
463
510
|
}
|
|
464
|
-
if (typeof
|
|
465
|
-
const
|
|
466
|
-
if (
|
|
511
|
+
if (typeof i == "object" && i !== null) {
|
|
512
|
+
const r = i.displayName ?? i.name;
|
|
513
|
+
if (r) return { lib: "react", name: r };
|
|
467
514
|
}
|
|
468
|
-
|
|
515
|
+
n = s.return;
|
|
469
516
|
}
|
|
470
517
|
return { lib: "react" };
|
|
471
518
|
}
|
|
472
|
-
function
|
|
473
|
-
var o,
|
|
474
|
-
const e =
|
|
475
|
-
if (
|
|
476
|
-
const
|
|
477
|
-
return { lib: "vue", ...
|
|
519
|
+
function je(t) {
|
|
520
|
+
var o, s;
|
|
521
|
+
const e = t, n = e.__vueParentComponent;
|
|
522
|
+
if (n) {
|
|
523
|
+
const i = ((o = n.type) == null ? void 0 : o.name) ?? ((s = n.type) == null ? void 0 : s.__name);
|
|
524
|
+
return { lib: "vue", ...i ? { name: i } : {} };
|
|
478
525
|
}
|
|
479
526
|
return e.__vue__ ? { lib: "vue" } : null;
|
|
480
527
|
}
|
|
481
|
-
function
|
|
528
|
+
function Oe(t) {
|
|
482
529
|
const e = window.ng;
|
|
483
530
|
if (!(e != null && e.getComponent)) return null;
|
|
484
531
|
try {
|
|
485
|
-
const
|
|
486
|
-
if (!
|
|
487
|
-
const o =
|
|
532
|
+
const n = e.getComponent(t);
|
|
533
|
+
if (!n) return null;
|
|
534
|
+
const o = n.constructor;
|
|
488
535
|
return { lib: "angular", ...o != null && o.name ? { name: o.name } : {} };
|
|
489
536
|
} catch {
|
|
490
537
|
return null;
|
|
491
538
|
}
|
|
492
539
|
}
|
|
493
|
-
function
|
|
494
|
-
return "__svelte_meta" in
|
|
540
|
+
function ze(t) {
|
|
541
|
+
return "__svelte_meta" in t ? { lib: "svelte" } : null;
|
|
495
542
|
}
|
|
496
|
-
function
|
|
497
|
-
return
|
|
543
|
+
function G(t) {
|
|
544
|
+
return Be(t) ?? je(t) ?? Oe(t) ?? ze(t) ?? void 0;
|
|
498
545
|
}
|
|
499
|
-
const
|
|
546
|
+
const Ue = 5e3, He = 1e3, J = 1e3, Z = 200, qe = 50, Q = 200, Fe = 500, We = [
|
|
500
547
|
"display",
|
|
501
548
|
"position",
|
|
502
549
|
"top",
|
|
@@ -535,60 +582,60 @@ const ue = 5e3, pe = 1e3, I = 1e3, D = 200, he = 50, z = 200, be = 500, fe = [
|
|
|
535
582
|
"grid-template-columns",
|
|
536
583
|
"grid-template-rows"
|
|
537
584
|
];
|
|
538
|
-
function
|
|
539
|
-
return
|
|
585
|
+
function ee(t, e) {
|
|
586
|
+
return t.length <= e ? t : t.slice(0, e) + `
|
|
540
587
|
|
|
541
|
-
/* … truncated, original was ${
|
|
588
|
+
/* … truncated, original was ${t.length} chars */`;
|
|
542
589
|
}
|
|
543
|
-
function
|
|
544
|
-
const e = getComputedStyle(
|
|
545
|
-
for (const o of
|
|
546
|
-
const
|
|
547
|
-
|
|
590
|
+
function Ve(t) {
|
|
591
|
+
const e = getComputedStyle(t), n = {};
|
|
592
|
+
for (const o of We) {
|
|
593
|
+
const s = e.getPropertyValue(o);
|
|
594
|
+
s && s !== "normal" && s !== "none" && s !== "auto" && s !== "0px" && (n[o] = s.trim().slice(0, Fe));
|
|
548
595
|
}
|
|
549
|
-
return
|
|
596
|
+
return n;
|
|
550
597
|
}
|
|
551
|
-
function
|
|
552
|
-
return Array.from(
|
|
598
|
+
function Ke(t) {
|
|
599
|
+
return Array.from(t.classList).slice(0, qe).map((n) => n.length > Q ? n.slice(0, Q) : n);
|
|
553
600
|
}
|
|
554
|
-
function
|
|
555
|
-
const e =
|
|
601
|
+
function Xe(t) {
|
|
602
|
+
const e = t.getBoundingClientRect(), n = De(t), o = t.id || null;
|
|
556
603
|
return {
|
|
557
|
-
selector:
|
|
558
|
-
tagName:
|
|
559
|
-
id: o && o.length >
|
|
560
|
-
classList:
|
|
561
|
-
outerHTML:
|
|
562
|
-
...
|
|
563
|
-
computedStyles:
|
|
604
|
+
selector: n.length > J ? n.slice(0, J) : n,
|
|
605
|
+
tagName: t.tagName.toLowerCase(),
|
|
606
|
+
id: o && o.length > Z ? o.slice(0, Z) : o,
|
|
607
|
+
classList: Ke(t),
|
|
608
|
+
outerHTML: ee(t.outerHTML, Ue),
|
|
609
|
+
...t.parentElement ? { parentOuterHTML: ee(t.parentElement.outerHTML, He) } : {},
|
|
610
|
+
computedStyles: Ve(t),
|
|
564
611
|
boundingRect: {
|
|
565
612
|
x: Math.round(e.x),
|
|
566
613
|
y: Math.round(e.y),
|
|
567
614
|
w: Math.round(e.width),
|
|
568
615
|
h: Math.round(e.height)
|
|
569
616
|
},
|
|
570
|
-
...
|
|
617
|
+
...G(t) ? { framework: G(t) } : {}
|
|
571
618
|
};
|
|
572
619
|
}
|
|
573
|
-
function
|
|
574
|
-
var
|
|
575
|
-
const
|
|
576
|
-
return
|
|
577
|
-
brand: ((
|
|
578
|
-
mobile:
|
|
579
|
-
platform:
|
|
620
|
+
function te() {
|
|
621
|
+
var n, o;
|
|
622
|
+
const t = navigator;
|
|
623
|
+
return t.userAgentData ? {
|
|
624
|
+
brand: ((n = t.userAgentData.brands.find((s) => !/Not[.\-]?A.?Brand/i.test(s.brand))) == null ? void 0 : n.brand) ?? ((o = t.userAgentData.brands[0]) == null ? void 0 : o.brand) ?? "unknown",
|
|
625
|
+
mobile: t.userAgentData.mobile,
|
|
626
|
+
platform: t.userAgentData.platform
|
|
580
627
|
} : void 0;
|
|
581
628
|
}
|
|
582
|
-
function
|
|
629
|
+
function ne() {
|
|
583
630
|
if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
|
|
584
631
|
if (window.matchMedia("(prefers-color-scheme: light)").matches) return "light";
|
|
585
632
|
}
|
|
586
|
-
function
|
|
633
|
+
function oe() {
|
|
587
634
|
return {
|
|
588
635
|
url: window.location.href,
|
|
589
636
|
...document.referrer ? { referrer: document.referrer } : {},
|
|
590
637
|
userAgent: navigator.userAgent,
|
|
591
|
-
...
|
|
638
|
+
...te() ? { uaData: te() } : {},
|
|
592
639
|
viewport: {
|
|
593
640
|
w: window.innerWidth,
|
|
594
641
|
h: window.innerHeight,
|
|
@@ -600,54 +647,54 @@ function H() {
|
|
|
600
647
|
},
|
|
601
648
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
602
649
|
locale: navigator.language,
|
|
603
|
-
...
|
|
650
|
+
...ne() ? { theme: ne() } : {},
|
|
604
651
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
605
652
|
};
|
|
606
653
|
}
|
|
607
|
-
let
|
|
608
|
-
async function
|
|
609
|
-
return
|
|
654
|
+
let R = null;
|
|
655
|
+
async function Ye() {
|
|
656
|
+
return R || (R = await import("./index-DAIDnjfR.mjs")), R;
|
|
610
657
|
}
|
|
611
|
-
const
|
|
612
|
-
function
|
|
613
|
-
if (!
|
|
658
|
+
const _ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII=";
|
|
659
|
+
function se(t, e) {
|
|
660
|
+
if (!t || t.startsWith("data:") || t.startsWith("blob:") || t.startsWith("/") || t.startsWith("#")) return !0;
|
|
614
661
|
try {
|
|
615
|
-
if (new URL(
|
|
662
|
+
if (new URL(t, window.location.href).origin === window.location.origin) return !0;
|
|
616
663
|
} catch {
|
|
617
664
|
return !1;
|
|
618
665
|
}
|
|
619
666
|
return e === "anonymous" || e === "use-credentials";
|
|
620
667
|
}
|
|
621
|
-
function
|
|
622
|
-
const
|
|
623
|
-
return document.querySelectorAll("img").forEach((
|
|
624
|
-
|
|
625
|
-
}), document.querySelectorAll("image").forEach((
|
|
626
|
-
const o =
|
|
627
|
-
|
|
668
|
+
function Ge() {
|
|
669
|
+
const t = [], e = [];
|
|
670
|
+
return document.querySelectorAll("img").forEach((n) => {
|
|
671
|
+
se(n.src, n.crossOrigin) || (t.push({ el: n, src: n.src }), n.src = _);
|
|
672
|
+
}), document.querySelectorAll("image").forEach((n) => {
|
|
673
|
+
const o = n, s = o.getAttribute("href"), i = o.getAttributeNS("http://www.w3.org/1999/xlink", "href"), r = s || i || "";
|
|
674
|
+
r && !se(r) && (e.push({ el: o, href: s, xlink: i }), s !== null && o.setAttribute("href", _), i !== null && o.setAttributeNS("http://www.w3.org/1999/xlink", "href", _));
|
|
628
675
|
}), () => {
|
|
629
|
-
for (const { el:
|
|
630
|
-
|
|
631
|
-
for (const { el:
|
|
632
|
-
o !== null &&
|
|
676
|
+
for (const { el: n, src: o } of t)
|
|
677
|
+
n.src = o;
|
|
678
|
+
for (const { el: n, href: o, xlink: s } of e)
|
|
679
|
+
o !== null && n.setAttribute("href", o), s !== null && n.setAttributeNS("http://www.w3.org/1999/xlink", "href", s);
|
|
633
680
|
};
|
|
634
681
|
}
|
|
635
|
-
async function
|
|
636
|
-
const { quality: e = 0.7, pixelRatio:
|
|
637
|
-
let
|
|
638
|
-
for (;
|
|
639
|
-
if (
|
|
640
|
-
|
|
682
|
+
async function ie(t = {}) {
|
|
683
|
+
const { quality: e = 0.7, pixelRatio: n = Math.min(window.devicePixelRatio || 1, 2), excludeShadowRoot: o } = t, s = await Ye(), i = o ? (l) => {
|
|
684
|
+
let a = l;
|
|
685
|
+
for (; a; ) {
|
|
686
|
+
if (a === o.host || a instanceof Element && a.classList.contains("beacon-no-capture")) return !1;
|
|
687
|
+
a = a.parentNode;
|
|
641
688
|
}
|
|
642
689
|
return !0;
|
|
643
|
-
} : void 0,
|
|
690
|
+
} : void 0, r = Ge();
|
|
644
691
|
try {
|
|
645
|
-
return await
|
|
692
|
+
return await s.toJpeg(document.documentElement, {
|
|
646
693
|
quality: e,
|
|
647
|
-
pixelRatio:
|
|
694
|
+
pixelRatio: n,
|
|
648
695
|
cacheBust: !0,
|
|
649
|
-
...
|
|
650
|
-
imagePlaceholder:
|
|
696
|
+
...i ? { filter: i } : {},
|
|
697
|
+
imagePlaceholder: _,
|
|
651
698
|
// Cap dimensions to viewport so we don't accidentally capture full document height.
|
|
652
699
|
width: window.innerWidth,
|
|
653
700
|
height: window.innerHeight,
|
|
@@ -657,88 +704,159 @@ async function W(n = {}) {
|
|
|
657
704
|
}
|
|
658
705
|
});
|
|
659
706
|
} finally {
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
const
|
|
664
|
-
async function
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
const
|
|
668
|
-
if (!
|
|
669
|
-
|
|
670
|
-
const
|
|
671
|
-
for (const
|
|
672
|
-
const
|
|
673
|
-
if (!
|
|
674
|
-
const
|
|
675
|
-
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
}
|
|
679
|
-
return
|
|
680
|
-
}
|
|
681
|
-
function
|
|
682
|
-
const
|
|
683
|
-
if (
|
|
684
|
-
const o =
|
|
707
|
+
r();
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
const Je = 14, Ze = "#ffffff", Qe = "#ffffff", et = 3, tt = "#0ea5e9";
|
|
711
|
+
async function re(t, e, n, o, s = tt) {
|
|
712
|
+
const i = s, r = s, l = await ot(t), a = document.createElement("canvas");
|
|
713
|
+
a.width = l.naturalWidth, a.height = l.naturalHeight;
|
|
714
|
+
const c = a.getContext("2d");
|
|
715
|
+
if (!c) throw new Error("Could not get 2D canvas context");
|
|
716
|
+
c.drawImage(l, 0, 0);
|
|
717
|
+
const d = a.width / n.w, u = a.height / n.h;
|
|
718
|
+
for (const g of e) {
|
|
719
|
+
const y = nt(g, o);
|
|
720
|
+
if (!y) continue;
|
|
721
|
+
const w = y.x * d, x = y.y * u, v = y.w * d, h = y.h * u;
|
|
722
|
+
c.lineWidth = et, c.strokeStyle = r, c.strokeRect(w, x, v, h);
|
|
723
|
+
const f = w + v, p = x;
|
|
724
|
+
c.beginPath(), c.fillStyle = i, c.arc(f, p, Je, 0, Math.PI * 2), c.fill(), c.lineWidth = 3, c.strokeStyle = Ze, c.stroke(), c.fillStyle = Qe, c.font = "bold 16px system-ui, -apple-system, sans-serif", c.textAlign = "center", c.textBaseline = "middle", c.fillText(String(g.number), f, p + 1);
|
|
725
|
+
}
|
|
726
|
+
return a.toDataURL("image/jpeg", 0.85);
|
|
727
|
+
}
|
|
728
|
+
function nt(t, e) {
|
|
729
|
+
const n = e == null ? void 0 : e.get(t);
|
|
730
|
+
if (n && document.contains(n)) {
|
|
731
|
+
const o = n.getBoundingClientRect();
|
|
685
732
|
if (o.width > 0 || o.height > 0)
|
|
686
733
|
return { x: o.left, y: o.top, w: o.width, h: o.height };
|
|
687
734
|
}
|
|
688
|
-
if (
|
|
735
|
+
if (t.selector)
|
|
689
736
|
try {
|
|
690
|
-
const o = document.querySelector(
|
|
737
|
+
const o = document.querySelector(t.selector);
|
|
691
738
|
if (o) {
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
694
|
-
return { x:
|
|
739
|
+
const s = o.getBoundingClientRect();
|
|
740
|
+
if (s.width > 0 || s.height > 0)
|
|
741
|
+
return { x: s.left, y: s.top, w: s.width, h: s.height };
|
|
695
742
|
}
|
|
696
743
|
} catch {
|
|
697
744
|
}
|
|
698
|
-
return
|
|
745
|
+
return t.boundingRect;
|
|
699
746
|
}
|
|
700
|
-
function
|
|
701
|
-
return new Promise((e,
|
|
747
|
+
function ot(t) {
|
|
748
|
+
return new Promise((e, n) => {
|
|
702
749
|
const o = new Image();
|
|
703
|
-
o.onload = () => e(o), o.onerror = (
|
|
750
|
+
o.onload = () => e(o), o.onerror = (s) => n(s), o.src = t;
|
|
704
751
|
});
|
|
705
752
|
}
|
|
706
|
-
|
|
707
|
-
|
|
753
|
+
const st = 30, D = 500, ae = 2e3, it = 500, rt = 5e3, at = /launch-kit-beacon|beacon-client|beacon\.(?:es|umd|mjs)/i, $ = [], P = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Set();
|
|
754
|
+
let ce = !1;
|
|
755
|
+
function C(t, e) {
|
|
756
|
+
if (t)
|
|
757
|
+
return t.length > e ? t.slice(0, e) : t;
|
|
758
|
+
}
|
|
759
|
+
function ct(t, e) {
|
|
760
|
+
const n = (e == null ? void 0 : e.split(`
|
|
761
|
+
`).slice(0, 3).join("|")) ?? "";
|
|
762
|
+
return `${t}::${n}`;
|
|
763
|
+
}
|
|
764
|
+
function lt(t) {
|
|
765
|
+
return !!t && at.test(t);
|
|
766
|
+
}
|
|
767
|
+
function dt(t) {
|
|
768
|
+
try {
|
|
769
|
+
return JSON.stringify(t).slice(0, D);
|
|
770
|
+
} catch {
|
|
771
|
+
return String(t);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
function le(t) {
|
|
775
|
+
if (lt(t.stack) || t.kind === "unhandledrejection" && /AbortError/i.test(t.message)) return;
|
|
776
|
+
const e = ct(t.message, t.stack), n = P.get(e);
|
|
777
|
+
if (n !== void 0 && t.ts - n < rt) {
|
|
778
|
+
P.set(e, t.ts);
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
P.set(e, t.ts), $.push(t), $.length > st && $.shift();
|
|
782
|
+
for (const o of B)
|
|
783
|
+
try {
|
|
784
|
+
o();
|
|
785
|
+
} catch {
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
function ut() {
|
|
789
|
+
ce || typeof window > "u" || (ce = !0, window.addEventListener("error", (t) => {
|
|
790
|
+
try {
|
|
791
|
+
const e = t.error instanceof Error ? t.error.message : void 0, n = t.error instanceof Error ? t.error.stack : void 0;
|
|
792
|
+
le({
|
|
793
|
+
ts: Date.now(),
|
|
794
|
+
kind: "error",
|
|
795
|
+
message: C(t.message || e || "Unknown error", D) ?? "Unknown error",
|
|
796
|
+
...n ? { stack: C(n, ae) } : {},
|
|
797
|
+
...t.filename ? { source: C(t.filename, it) } : {},
|
|
798
|
+
...Number.isFinite(t.lineno) ? { line: t.lineno } : {},
|
|
799
|
+
...Number.isFinite(t.colno) ? { col: t.colno } : {}
|
|
800
|
+
});
|
|
801
|
+
} catch {
|
|
802
|
+
}
|
|
803
|
+
}), window.addEventListener("unhandledrejection", (t) => {
|
|
804
|
+
try {
|
|
805
|
+
const e = t.reason, n = e instanceof Error ? e.message : typeof e == "string" ? e : dt(e), o = e instanceof Error ? e.stack : void 0;
|
|
806
|
+
le({
|
|
807
|
+
ts: Date.now(),
|
|
808
|
+
kind: "unhandledrejection",
|
|
809
|
+
message: C(n || "Unknown rejection", D) ?? "Unknown rejection",
|
|
810
|
+
...o ? { stack: C(o, ae) } : {}
|
|
811
|
+
});
|
|
812
|
+
} catch {
|
|
813
|
+
}
|
|
814
|
+
}));
|
|
815
|
+
}
|
|
816
|
+
function M() {
|
|
817
|
+
return $.slice();
|
|
818
|
+
}
|
|
819
|
+
function ge(t) {
|
|
820
|
+
return B.add(t), () => {
|
|
821
|
+
B.delete(t);
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
async function ht(t, e, n) {
|
|
825
|
+
const o = await fetch(t, {
|
|
708
826
|
method: "POST",
|
|
709
827
|
credentials: "include",
|
|
710
828
|
headers: {
|
|
711
829
|
"Content-Type": "application/json",
|
|
712
|
-
...
|
|
830
|
+
...n ?? {}
|
|
713
831
|
},
|
|
714
832
|
body: JSON.stringify(e)
|
|
715
833
|
});
|
|
716
|
-
let
|
|
834
|
+
let s = null;
|
|
717
835
|
if ((o.headers.get("Content-Type") ?? "").includes("application/json"))
|
|
718
836
|
try {
|
|
719
|
-
|
|
837
|
+
s = await o.json();
|
|
720
838
|
} catch {
|
|
721
|
-
|
|
839
|
+
s = null;
|
|
722
840
|
}
|
|
723
841
|
else
|
|
724
842
|
try {
|
|
725
|
-
|
|
843
|
+
s = await o.text();
|
|
726
844
|
} catch {
|
|
727
|
-
|
|
845
|
+
s = null;
|
|
728
846
|
}
|
|
729
847
|
return {
|
|
730
848
|
ok: o.ok,
|
|
731
849
|
status: o.status,
|
|
732
|
-
body:
|
|
850
|
+
body: s
|
|
733
851
|
};
|
|
734
852
|
}
|
|
735
|
-
const
|
|
736
|
-
function
|
|
737
|
-
if (document.getElementById(
|
|
853
|
+
const pt = ["endpoint", "position", "theme", "severities"], de = "launch-kit-beacon-portal-styles";
|
|
854
|
+
function ft(t) {
|
|
855
|
+
if (document.getElementById(de)) return;
|
|
738
856
|
const e = document.createElement("style");
|
|
739
|
-
e.id =
|
|
857
|
+
e.id = de, e.textContent = t, document.head.appendChild(e);
|
|
740
858
|
}
|
|
741
|
-
const
|
|
859
|
+
const bt = [
|
|
742
860
|
"--beacon-accent",
|
|
743
861
|
"--beacon-bg",
|
|
744
862
|
"--beacon-fg",
|
|
@@ -751,13 +869,13 @@ const Me = [
|
|
|
751
869
|
"--beacon-idea",
|
|
752
870
|
"--beacon-ux",
|
|
753
871
|
"--beacon-a11y"
|
|
754
|
-
],
|
|
755
|
-
class
|
|
872
|
+
], ue = "#0ea5e9";
|
|
873
|
+
class mt extends HTMLElement {
|
|
756
874
|
constructor() {
|
|
757
875
|
super(...arguments), this._config = null, this.pins = [], this.pinElements = /* @__PURE__ */ new WeakMap(), this.description = "", this.severity = "bug", this.submitSucceeded = !1;
|
|
758
876
|
}
|
|
759
877
|
static get observedAttributes() {
|
|
760
|
-
return
|
|
878
|
+
return pt;
|
|
761
879
|
}
|
|
762
880
|
/** Public — wrappers can set `widget.config = {...}` for dynamic endpoint/headers/context. */
|
|
763
881
|
set config(e) {
|
|
@@ -772,44 +890,48 @@ class Ne extends HTMLElement {
|
|
|
772
890
|
if (!this.shadow) {
|
|
773
891
|
this.shadow = this.attachShadow({ mode: "open" });
|
|
774
892
|
const e = document.createElement("style");
|
|
775
|
-
e.textContent =
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
}), this.drawer = new
|
|
893
|
+
e.textContent = V, this.shadow.appendChild(e), this.slotEl = document.createElement("slot"), this.slotEl.name = "trigger", this.shadow.appendChild(this.slotEl), this.trigger = ke(), this.shadow.appendChild(this.trigger), this.trigger.addEventListener("click", () => this.open()), this.slotEl.addEventListener("slotchange", () => {
|
|
894
|
+
const n = this.slotEl.assignedElements();
|
|
895
|
+
n.length > 0 && (this.trigger && (this.trigger.style.display = "none"), n.forEach((o) => o.addEventListener("click", () => this.open())));
|
|
896
|
+
}), this.drawer = new Ce(this.parseSeverities(), {
|
|
779
897
|
onClose: () => this.close(),
|
|
780
898
|
onAnnotate: () => this.startAnnotate(),
|
|
781
899
|
onSubmit: () => this.handleSubmit(),
|
|
782
|
-
onPinNoteChange: (
|
|
783
|
-
onPinDelete: (
|
|
784
|
-
onDescriptionChange: (
|
|
785
|
-
this.description =
|
|
900
|
+
onPinNoteChange: (n, o) => this.updatePinNote(n, o),
|
|
901
|
+
onPinDelete: (n) => this.deletePin(n),
|
|
902
|
+
onDescriptionChange: (n) => {
|
|
903
|
+
this.description = n;
|
|
786
904
|
},
|
|
787
|
-
onSeverityChange: (
|
|
788
|
-
this.severity =
|
|
905
|
+
onSeverityChange: (n) => {
|
|
906
|
+
this.severity = n;
|
|
789
907
|
}
|
|
790
|
-
}),
|
|
908
|
+
}), ft(V), this.drawer.root.classList.add("beacon-no-capture"), this.drawer.root.classList.add(`beacon-theme-${this.getAttribute("theme") ?? "auto"}`), document.body.appendChild(this.drawer.root), this.eventsUnsubscribe = ge(() => {
|
|
909
|
+
var n;
|
|
910
|
+
(n = this.drawer) == null || n.setEvents(M());
|
|
911
|
+
});
|
|
791
912
|
}
|
|
792
913
|
this.hasAttribute("position") || this.setAttribute("position", "bottom-right"), this.hasAttribute("theme") || this.setAttribute("theme", "auto");
|
|
793
914
|
}
|
|
794
|
-
attributeChangedCallback(e,
|
|
795
|
-
e === "severities" && this.drawer && console.warn("[launch-kit-beacon] severities attribute changed after mount; not yet hot-reloaded."), e === "theme" && this.drawer &&
|
|
915
|
+
attributeChangedCallback(e, n, o) {
|
|
916
|
+
e === "severities" && this.drawer && console.warn("[launch-kit-beacon] severities attribute changed after mount; not yet hot-reloaded."), e === "theme" && this.drawer && n !== o && (this.drawer.root.classList.remove(`beacon-theme-${n ?? "auto"}`), this.drawer.root.classList.add(`beacon-theme-${o ?? "auto"}`));
|
|
796
917
|
}
|
|
797
918
|
// ── Public API ──────────────────────────────────────────
|
|
798
919
|
open() {
|
|
799
920
|
var e;
|
|
800
921
|
if (this.drawer) {
|
|
801
922
|
if (this.getAttribute("position") === "hidden") {
|
|
802
|
-
const
|
|
803
|
-
|
|
923
|
+
const n = (e = this.slotEl) == null ? void 0 : e.assignedElements()[0];
|
|
924
|
+
n && wt(this.drawer.root, n);
|
|
804
925
|
}
|
|
805
|
-
this.submitSucceeded = !1, this.syncCustomProperties(), this.installClickBlocker(), this.drawer.open();
|
|
926
|
+
this.submitSucceeded = !1, this.drawer.setEvents(M()), this.syncCustomProperties(), this.installClickBlocker(), this.drawer.open();
|
|
806
927
|
}
|
|
807
928
|
}
|
|
808
929
|
close() {
|
|
809
930
|
this.drawer && (!this.submitSucceeded && this.hasUnsavedData() && !window.confirm("You have unsaved feedback. Close and discard it?") || this.forceClose());
|
|
810
931
|
}
|
|
811
932
|
disconnectedCallback() {
|
|
812
|
-
|
|
933
|
+
var e;
|
|
934
|
+
this.uninstallClickBlocker(), (e = this.eventsUnsubscribe) == null || e.call(this), this.eventsUnsubscribe = void 0, this.drawer && this.drawer.root.parentNode && this.drawer.root.parentNode.removeChild(this.drawer.root);
|
|
813
935
|
}
|
|
814
936
|
async openWithPicker() {
|
|
815
937
|
this.open(), setTimeout(() => this.startAnnotate(), 0);
|
|
@@ -818,11 +940,11 @@ class Ne extends HTMLElement {
|
|
|
818
940
|
async startAnnotate() {
|
|
819
941
|
if (!this.drawer) return;
|
|
820
942
|
this.drawer.minimize();
|
|
821
|
-
const e = this.getAccentColor(),
|
|
943
|
+
const e = this.getAccentColor(), n = Me({ accent: e });
|
|
822
944
|
for (const o of this.pins) {
|
|
823
|
-
const
|
|
824
|
-
|
|
825
|
-
target:
|
|
945
|
+
const s = this.pinElements.get(o);
|
|
946
|
+
s && n.addPin(o.number, {
|
|
947
|
+
target: s,
|
|
826
948
|
selector: o.selector,
|
|
827
949
|
fallbackRect: o.boundingRect
|
|
828
950
|
});
|
|
@@ -830,50 +952,50 @@ class Ne extends HTMLElement {
|
|
|
830
952
|
try {
|
|
831
953
|
let o = !0;
|
|
832
954
|
for (; o; ) {
|
|
833
|
-
const
|
|
834
|
-
if (!
|
|
835
|
-
const
|
|
955
|
+
const i = await $e({ shadowRoot: this.shadow, accent: e }).promise;
|
|
956
|
+
if (!i) break;
|
|
957
|
+
const r = i.getBoundingClientRect(), l = await Le({
|
|
836
958
|
shadowRoot: this.shadow,
|
|
837
|
-
anchor: { x:
|
|
959
|
+
anchor: { x: r.left, y: r.bottom },
|
|
838
960
|
pinNumber: this.pins.length + 1
|
|
839
961
|
});
|
|
840
|
-
if (
|
|
841
|
-
if (
|
|
842
|
-
const
|
|
962
|
+
if (l.cancelled === "all") break;
|
|
963
|
+
if (l.cancelled === "pin") continue;
|
|
964
|
+
const a = Xe(i), c = {
|
|
843
965
|
number: this.pins.length + 1,
|
|
844
|
-
...
|
|
845
|
-
...
|
|
966
|
+
...a,
|
|
967
|
+
...l.note ? { note: l.note } : {}
|
|
846
968
|
};
|
|
847
|
-
this.pins.push(
|
|
848
|
-
target:
|
|
849
|
-
selector:
|
|
850
|
-
fallbackRect:
|
|
969
|
+
this.pins.push(c), this.pinElements.set(c, i), n.addPin(c.number, {
|
|
970
|
+
target: i,
|
|
971
|
+
selector: a.selector,
|
|
972
|
+
fallbackRect: a.boundingRect
|
|
851
973
|
});
|
|
852
974
|
}
|
|
853
975
|
if (this.pins.length > 0) {
|
|
854
|
-
|
|
976
|
+
n.setLoading("Capturing screenshot…"), await new Promise((s) => requestAnimationFrame(() => s()));
|
|
855
977
|
try {
|
|
856
|
-
const
|
|
857
|
-
this.drawer.setPins(this.pins,
|
|
858
|
-
} catch (
|
|
859
|
-
const
|
|
860
|
-
console.error("[launch-kit-beacon] screenshot capture failed:",
|
|
978
|
+
const s = oe(), i = await ie({ excludeShadowRoot: this.shadow }), r = await re(i, this.pins, s.viewport, this.pinElements, e);
|
|
979
|
+
this.drawer.setPins(this.pins, r);
|
|
980
|
+
} catch (s) {
|
|
981
|
+
const i = s instanceof Error ? s.message : String(s);
|
|
982
|
+
console.error("[launch-kit-beacon] screenshot capture failed:", s), this.drawer.setPins(this.pins), this.drawer.setStatus(`Screenshot capture failed: ${i}`, "error");
|
|
861
983
|
}
|
|
862
984
|
}
|
|
863
985
|
} finally {
|
|
864
|
-
|
|
986
|
+
n.destroy();
|
|
865
987
|
}
|
|
866
988
|
this.drawer.open();
|
|
867
989
|
}
|
|
868
|
-
updatePinNote(e,
|
|
869
|
-
const o = this.pins.find((
|
|
870
|
-
o && (
|
|
990
|
+
updatePinNote(e, n) {
|
|
991
|
+
const o = this.pins.find((s) => s.number === e);
|
|
992
|
+
o && (n.trim() ? o.note = n : delete o.note);
|
|
871
993
|
}
|
|
872
994
|
deletePin(e) {
|
|
873
|
-
var
|
|
874
|
-
this.pins = this.pins.filter((
|
|
875
|
-
|
|
876
|
-
}), (
|
|
995
|
+
var n, o;
|
|
996
|
+
this.pins = this.pins.filter((s) => s.number !== e), this.pins.forEach((s, i) => {
|
|
997
|
+
s.number = i + 1;
|
|
998
|
+
}), (n = this.drawer) == null || n.setAnnotatedScreenshot(void 0), (o = this.drawer) == null || o.setPins(this.pins);
|
|
877
999
|
}
|
|
878
1000
|
// ── Submit flow ──────────────────────────────────────────
|
|
879
1001
|
async handleSubmit() {
|
|
@@ -883,54 +1005,55 @@ class Ne extends HTMLElement {
|
|
|
883
1005
|
this.drawer.setStatus("Missing endpoint configuration", "error");
|
|
884
1006
|
return;
|
|
885
1007
|
}
|
|
886
|
-
const
|
|
887
|
-
if (!
|
|
1008
|
+
const n = this.drawer.getDescription().trim(), o = this.drawer.getSeverity();
|
|
1009
|
+
if (!n) {
|
|
888
1010
|
this.drawer.setStatus("Description is required", "error");
|
|
889
1011
|
return;
|
|
890
1012
|
}
|
|
891
1013
|
this.drawer.setSubmitting(!0);
|
|
892
|
-
let
|
|
893
|
-
const
|
|
894
|
-
this.drawer.setStatus(
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
1014
|
+
let s = this.drawer.getAnnotatedScreenshot();
|
|
1015
|
+
const i = !s && this.pins.length > 0;
|
|
1016
|
+
this.drawer.setStatus(i ? "Capturing screenshot…" : "Sending…"), await new Promise((u) => requestAnimationFrame(() => u()));
|
|
1017
|
+
const r = oe();
|
|
1018
|
+
if (i)
|
|
897
1019
|
try {
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
} catch (
|
|
901
|
-
console.error("[launch-kit-beacon] screenshot capture failed at submit:",
|
|
1020
|
+
const u = await ie({ excludeShadowRoot: this.shadow });
|
|
1021
|
+
s = await re(u, this.pins, r.viewport, this.pinElements, this.getAccentColor());
|
|
1022
|
+
} catch (u) {
|
|
1023
|
+
console.error("[launch-kit-beacon] screenshot capture failed at submit:", u);
|
|
902
1024
|
}
|
|
903
|
-
const
|
|
904
|
-
description:
|
|
1025
|
+
const l = M(), a = {
|
|
1026
|
+
description: n,
|
|
905
1027
|
severity: o,
|
|
906
|
-
...
|
|
907
|
-
metadata:
|
|
1028
|
+
...s ? { screenshot: { dataUrl: s, mime: "image/jpeg" } } : {},
|
|
1029
|
+
metadata: r,
|
|
908
1030
|
pins: this.pins,
|
|
1031
|
+
...l.length > 0 ? { events: l } : {},
|
|
909
1032
|
...this.resolveContext() ? { context: this.resolveContext() } : {}
|
|
910
|
-
},
|
|
911
|
-
detail: { payload:
|
|
1033
|
+
}, c = new CustomEvent("beacon-before-submit", {
|
|
1034
|
+
detail: { payload: a },
|
|
912
1035
|
cancelable: !0,
|
|
913
1036
|
bubbles: !0,
|
|
914
1037
|
composed: !0
|
|
915
1038
|
});
|
|
916
|
-
if (!this.dispatchEvent(
|
|
1039
|
+
if (!this.dispatchEvent(c)) {
|
|
917
1040
|
this.drawer.setSubmitting(!1), this.drawer.setStatus("Submission cancelled", "error");
|
|
918
1041
|
return;
|
|
919
1042
|
}
|
|
920
1043
|
this.drawer.setStatus("Sending…");
|
|
921
1044
|
try {
|
|
922
|
-
const
|
|
923
|
-
this.drawer.setSubmitting(!1),
|
|
924
|
-
detail: { response:
|
|
1045
|
+
const u = this.resolveHeaders(), g = await ht(e.endpoint, a, u);
|
|
1046
|
+
this.drawer.setSubmitting(!1), g.ok ? (this.submitSucceeded = !0, this.drawer.setStatus("Sent — thanks!", "success"), this.dispatchEvent(new CustomEvent("beacon-after-submit", {
|
|
1047
|
+
detail: { response: g },
|
|
925
1048
|
bubbles: !0,
|
|
926
1049
|
composed: !0
|
|
927
1050
|
})), setTimeout(() => {
|
|
928
1051
|
this.forceClose();
|
|
929
|
-
}, 1500)) : this.drawer.setStatus(`Failed: ${
|
|
930
|
-
} catch (
|
|
1052
|
+
}, 1500)) : this.drawer.setStatus(`Failed: ${g.status}`, "error");
|
|
1053
|
+
} catch (u) {
|
|
931
1054
|
this.drawer.setSubmitting(!1);
|
|
932
|
-
const
|
|
933
|
-
this.drawer.setStatus(`Failed: ${
|
|
1055
|
+
const g = u instanceof Error ? u.message : "Network error";
|
|
1056
|
+
this.drawer.setStatus(`Failed: ${g}`, "error");
|
|
934
1057
|
}
|
|
935
1058
|
}
|
|
936
1059
|
// ── Helpers ──────────────────────────────────────────
|
|
@@ -940,7 +1063,7 @@ class Ne extends HTMLElement {
|
|
|
940
1063
|
* targeting the host). Falls back to the default sky-blue if unset.
|
|
941
1064
|
*/
|
|
942
1065
|
getAccentColor() {
|
|
943
|
-
return typeof window > "u" ?
|
|
1066
|
+
return typeof window > "u" ? ue : getComputedStyle(this).getPropertyValue("--beacon-accent").trim() || ue;
|
|
944
1067
|
}
|
|
945
1068
|
/**
|
|
946
1069
|
* Mirror every customizable --beacon-* var from the host onto the body-mounted
|
|
@@ -950,14 +1073,14 @@ class Ne extends HTMLElement {
|
|
|
950
1073
|
syncCustomProperties() {
|
|
951
1074
|
if (!this.drawer) return;
|
|
952
1075
|
const e = getComputedStyle(this);
|
|
953
|
-
for (const
|
|
954
|
-
const o = e.getPropertyValue(
|
|
955
|
-
o && this.drawer.root.style.setProperty(
|
|
1076
|
+
for (const n of bt) {
|
|
1077
|
+
const o = e.getPropertyValue(n).trim();
|
|
1078
|
+
o && this.drawer.root.style.setProperty(n, o);
|
|
956
1079
|
}
|
|
957
1080
|
}
|
|
958
1081
|
hasUnsavedData() {
|
|
959
|
-
var
|
|
960
|
-
return this.pins.length > 0 ? !0 : (((
|
|
1082
|
+
var n;
|
|
1083
|
+
return this.pins.length > 0 ? !0 : (((n = this.drawer) == null ? void 0 : n.getDescription()) ?? "").trim().length > 0;
|
|
961
1084
|
}
|
|
962
1085
|
resetState() {
|
|
963
1086
|
var e;
|
|
@@ -969,9 +1092,9 @@ class Ne extends HTMLElement {
|
|
|
969
1092
|
}
|
|
970
1093
|
installClickBlocker() {
|
|
971
1094
|
this.documentClickBlocker || (this.documentClickBlocker = (e) => {
|
|
972
|
-
const
|
|
973
|
-
if (!
|
|
974
|
-
for (const o of
|
|
1095
|
+
const n = e.composedPath();
|
|
1096
|
+
if (!n.includes(this.shadow.host)) {
|
|
1097
|
+
for (const o of n)
|
|
975
1098
|
if (o instanceof Element && o.classList.contains("beacon-no-capture")) return;
|
|
976
1099
|
e.preventDefault(), e.stopPropagation();
|
|
977
1100
|
}
|
|
@@ -981,36 +1104,476 @@ class Ne extends HTMLElement {
|
|
|
981
1104
|
this.documentClickBlocker && (document.removeEventListener("click", this.documentClickBlocker, !0), this.documentClickBlocker = void 0);
|
|
982
1105
|
}
|
|
983
1106
|
resolveHeaders() {
|
|
984
|
-
var
|
|
985
|
-
const e = (
|
|
1107
|
+
var n;
|
|
1108
|
+
const e = (n = this.config) == null ? void 0 : n.headers;
|
|
986
1109
|
if (e)
|
|
987
1110
|
return typeof e == "function" ? e() : e;
|
|
988
1111
|
}
|
|
989
1112
|
resolveContext() {
|
|
990
|
-
var
|
|
991
|
-
const e = (
|
|
1113
|
+
var n;
|
|
1114
|
+
const e = (n = this.config) == null ? void 0 : n.context;
|
|
992
1115
|
if (e)
|
|
993
1116
|
return typeof e == "function" ? e() : e;
|
|
994
1117
|
}
|
|
995
1118
|
parseSeverities() {
|
|
996
1119
|
const e = this.getAttribute("severities");
|
|
997
|
-
return e ? e.split(",").map((
|
|
1120
|
+
return e ? e.split(",").map((n) => n.trim()).filter(Boolean) : ["bug", "idea", "ux", "a11y"];
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
function gt(t = "launch-kit-beacon") {
|
|
1124
|
+
typeof window > "u" || customElements.get(t) || customElements.define(t, mt);
|
|
1125
|
+
}
|
|
1126
|
+
const he = 380, E = 8, yt = 520;
|
|
1127
|
+
function wt(t, e) {
|
|
1128
|
+
const n = e.getBoundingClientRect(), o = window.innerWidth, s = window.innerHeight;
|
|
1129
|
+
let i = Math.max(E, o - n.right);
|
|
1130
|
+
o - i - he < E && (i = Math.max(E, o - he - E));
|
|
1131
|
+
const l = s - n.bottom - E, a = n.top - E;
|
|
1132
|
+
t.style.left = "auto", t.style.right = `${i}px`, l >= yt || l >= a ? (t.style.top = `${n.bottom + E}px`, t.style.bottom = "auto") : (t.style.top = "auto", t.style.bottom = `${s - n.top + E}px`);
|
|
1133
|
+
}
|
|
1134
|
+
const vt = 1024, xt = 5;
|
|
1135
|
+
function Et(t, e) {
|
|
1136
|
+
return t.length > e ? t.slice(0, e) : t;
|
|
1137
|
+
}
|
|
1138
|
+
function ye(t) {
|
|
1139
|
+
if (t.id) return `#${CSS.escape(t.id)}`;
|
|
1140
|
+
const e = [];
|
|
1141
|
+
let n = t;
|
|
1142
|
+
for (let o = 0; o < 3 && n; o++) {
|
|
1143
|
+
const s = n.tagName.toLowerCase(), i = n.id ? `#${CSS.escape(n.id)}` : "", r = n.classList.length > 0 ? "." + Array.from(n.classList).slice(0, 3).map(CSS.escape).join(".") : "";
|
|
1144
|
+
if (e.unshift(`${s}${i}${r}`), i) break;
|
|
1145
|
+
n = n.parentElement;
|
|
1146
|
+
}
|
|
1147
|
+
return e.join(" > ");
|
|
1148
|
+
}
|
|
1149
|
+
function pe(t) {
|
|
1150
|
+
return {
|
|
1151
|
+
tag: t.tagName.toLowerCase(),
|
|
1152
|
+
id: t.id || null,
|
|
1153
|
+
classes: Array.from(t.classList).slice(0, 10),
|
|
1154
|
+
role: t.getAttribute("role"),
|
|
1155
|
+
selector: ye(t)
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
function St(t, e) {
|
|
1159
|
+
const n = [], o = document.querySelectorAll("body *");
|
|
1160
|
+
for (const s of Array.from(o)) {
|
|
1161
|
+
const i = getComputedStyle(s);
|
|
1162
|
+
if (i.position !== "fixed" && i.position !== "sticky") continue;
|
|
1163
|
+
const r = s.getBoundingClientRect();
|
|
1164
|
+
if (t < r.left || t > r.right || e < r.top || e > r.bottom) continue;
|
|
1165
|
+
const l = parseInt(i.zIndex, 10);
|
|
1166
|
+
!Number.isFinite(l) && i.zIndex !== "auto" || n.push({
|
|
1167
|
+
tag: s.tagName.toLowerCase(),
|
|
1168
|
+
zIndex: Number.isFinite(l) ? l : 0,
|
|
1169
|
+
pointerEvents: i.pointerEvents,
|
|
1170
|
+
classes: Array.from(s.classList).slice(0, 5).join(" ")
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
return n.sort((s, i) => i.zIndex - s.zIndex).slice(0, xt);
|
|
1174
|
+
}
|
|
1175
|
+
function kt(t) {
|
|
1176
|
+
const e = (s) => (i) => {
|
|
1177
|
+
const r = i, l = r.target;
|
|
1178
|
+
if (!(l instanceof Element)) return;
|
|
1179
|
+
const a = r.clientX, c = r.clientY, d = document.elementFromPoint(a, c), u = d === l || (d ? l.contains(d) || d.contains(l) : !1), g = document.querySelectorAll('[role="dialog"][data-state="open"]').length, y = getComputedStyle(document.body).pointerEvents, w = St(a, c);
|
|
1180
|
+
t.emitClick({
|
|
1181
|
+
kind: s,
|
|
1182
|
+
target: pe(l),
|
|
1183
|
+
hitMatchesTarget: u,
|
|
1184
|
+
...!u && d instanceof Element ? { hitTarget: pe(d) } : {},
|
|
1185
|
+
coords: { x: a, y: c },
|
|
1186
|
+
openDialogs: g,
|
|
1187
|
+
bodyPointerEvents: y,
|
|
1188
|
+
...w.length > 0 ? { overlaysAtPoint: w } : {}
|
|
1189
|
+
});
|
|
1190
|
+
}, n = e("click"), o = e("mousedown");
|
|
1191
|
+
return document.addEventListener("click", n, { capture: !0, passive: !0 }), document.addEventListener("mousedown", o, { capture: !0, passive: !0 }), () => {
|
|
1192
|
+
document.removeEventListener("click", n, { capture: !0 }), document.removeEventListener("mousedown", o, { capture: !0 });
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
function At(t) {
|
|
1196
|
+
const e = history.pushState, n = history.replaceState;
|
|
1197
|
+
let o = window.location.href;
|
|
1198
|
+
const s = (l) => {
|
|
1199
|
+
const a = window.location.href;
|
|
1200
|
+
if (a === o) return;
|
|
1201
|
+
const c = o;
|
|
1202
|
+
o = a, t.emitRoute({ kind: "route", from: c, to: a, via: l });
|
|
1203
|
+
};
|
|
1204
|
+
history.pushState = function(...a) {
|
|
1205
|
+
const c = e.apply(this, a);
|
|
1206
|
+
return s("pushState"), c;
|
|
1207
|
+
}, history.replaceState = function(...a) {
|
|
1208
|
+
const c = n.apply(this, a);
|
|
1209
|
+
return s("replaceState"), c;
|
|
1210
|
+
};
|
|
1211
|
+
const i = () => s("popstate"), r = () => s("hashchange");
|
|
1212
|
+
return window.addEventListener("popstate", i), window.addEventListener("hashchange", r), () => {
|
|
1213
|
+
history.pushState = e, history.replaceState = n, window.removeEventListener("popstate", i), window.removeEventListener("hashchange", r);
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1216
|
+
function Ct(t) {
|
|
1217
|
+
const e = /* @__PURE__ */ new WeakSet(), n = (s, i) => {
|
|
1218
|
+
const r = ye(s);
|
|
1219
|
+
t.emitDialog({
|
|
1220
|
+
kind: "dialog",
|
|
1221
|
+
action: i,
|
|
1222
|
+
selector: r,
|
|
1223
|
+
state: s.getAttribute("data-state"),
|
|
1224
|
+
...i === "mount" ? { outerHTML: Et(s.outerHTML, vt) } : {}
|
|
1225
|
+
});
|
|
1226
|
+
};
|
|
1227
|
+
for (const s of Array.from(document.querySelectorAll('[role="dialog"]')))
|
|
1228
|
+
e.add(s);
|
|
1229
|
+
const o = new MutationObserver((s) => {
|
|
1230
|
+
var i, r, l, a;
|
|
1231
|
+
for (const c of s) {
|
|
1232
|
+
for (const d of Array.from(c.addedNodes)) {
|
|
1233
|
+
if (!(d instanceof Element)) continue;
|
|
1234
|
+
const u = (i = d.matches) != null && i.call(d, '[role="dialog"]') ? [d] : Array.from(((r = d.querySelectorAll) == null ? void 0 : r.call(d, '[role="dialog"]')) ?? []);
|
|
1235
|
+
for (const g of u)
|
|
1236
|
+
e.has(g) || (e.add(g), n(g, "mount"));
|
|
1237
|
+
}
|
|
1238
|
+
for (const d of Array.from(c.removedNodes)) {
|
|
1239
|
+
if (!(d instanceof Element)) continue;
|
|
1240
|
+
const u = (l = d.matches) != null && l.call(d, '[role="dialog"]') ? [d] : Array.from(((a = d.querySelectorAll) == null ? void 0 : a.call(d, '[role="dialog"]')) ?? []);
|
|
1241
|
+
for (const g of u)
|
|
1242
|
+
e.has(g) && (e.delete(g), n(g, "unmount"));
|
|
1243
|
+
}
|
|
1244
|
+
c.type === "attributes" && c.attributeName === "data-state" && c.target instanceof Element && c.target.getAttribute("role") === "dialog" && n(c.target, "state");
|
|
1245
|
+
}
|
|
1246
|
+
});
|
|
1247
|
+
return o.observe(document.body, {
|
|
1248
|
+
childList: !0,
|
|
1249
|
+
subtree: !0,
|
|
1250
|
+
attributes: !0,
|
|
1251
|
+
attributeFilter: ["data-state"]
|
|
1252
|
+
}), () => o.disconnect();
|
|
1253
|
+
}
|
|
1254
|
+
function Lt(t) {
|
|
1255
|
+
const e = kt(t), n = At(t), o = Ct(t);
|
|
1256
|
+
return {
|
|
1257
|
+
uninstall() {
|
|
1258
|
+
e(), n(), o();
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
const j = 1e3;
|
|
1263
|
+
function O(t, e) {
|
|
1264
|
+
return t.length > e ? t.slice(0, e) : t;
|
|
1265
|
+
}
|
|
1266
|
+
function Tt(t) {
|
|
1267
|
+
const e = window.fetch;
|
|
1268
|
+
if (typeof e != "function") return () => {
|
|
1269
|
+
};
|
|
1270
|
+
const n = async (o, s) => {
|
|
1271
|
+
const i = performance.now(), r = ((s == null ? void 0 : s.method) ?? (o instanceof Request ? o.method : "GET")).toUpperCase(), l = typeof o == "string" ? o : o instanceof URL ? o.toString() : o.url;
|
|
1272
|
+
try {
|
|
1273
|
+
const a = await e.call(window, o, s), c = Math.round(performance.now() - i), d = a.status >= 400;
|
|
1274
|
+
return (d || t.verbose) && t.emit({
|
|
1275
|
+
kind: "fetch",
|
|
1276
|
+
url: O(l, j),
|
|
1277
|
+
method: r,
|
|
1278
|
+
status: a.status,
|
|
1279
|
+
durationMs: c,
|
|
1280
|
+
failed: d
|
|
1281
|
+
}), a;
|
|
1282
|
+
} catch (a) {
|
|
1283
|
+
const c = Math.round(performance.now() - i);
|
|
1284
|
+
throw t.emit({
|
|
1285
|
+
kind: "fetch",
|
|
1286
|
+
url: O(l, j),
|
|
1287
|
+
method: r,
|
|
1288
|
+
status: 0,
|
|
1289
|
+
durationMs: c,
|
|
1290
|
+
failed: !0,
|
|
1291
|
+
error: a instanceof Error ? a.message : String(a)
|
|
1292
|
+
}), a;
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
return n.__lsBeaconWrapped = !0, window.fetch = n, () => {
|
|
1296
|
+
window.fetch.__lsBeaconWrapped && (window.fetch = e);
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
function Mt(t) {
|
|
1300
|
+
const e = XMLHttpRequest.prototype, n = e.open, o = e.send, s = /* @__PURE__ */ new WeakMap();
|
|
1301
|
+
return e.open = function(r, l, ...a) {
|
|
1302
|
+
return s.set(this, {
|
|
1303
|
+
method: r.toUpperCase(),
|
|
1304
|
+
url: typeof l == "string" ? l : l.toString(),
|
|
1305
|
+
start: 0
|
|
1306
|
+
}), n.call(this, r, l, ...a);
|
|
1307
|
+
}, e.send = function(r) {
|
|
1308
|
+
const l = s.get(this);
|
|
1309
|
+
l && (l.start = performance.now());
|
|
1310
|
+
const a = () => {
|
|
1311
|
+
this.removeEventListener("loadend", a);
|
|
1312
|
+
const c = s.get(this);
|
|
1313
|
+
if (!c) return;
|
|
1314
|
+
const d = Math.round(performance.now() - c.start), u = this.status === 0 || this.status >= 400;
|
|
1315
|
+
(u || t.verbose) && t.emit({
|
|
1316
|
+
kind: "xhr",
|
|
1317
|
+
url: O(c.url, j),
|
|
1318
|
+
method: c.method,
|
|
1319
|
+
status: this.status,
|
|
1320
|
+
durationMs: d,
|
|
1321
|
+
failed: u
|
|
1322
|
+
}), s.delete(this);
|
|
1323
|
+
};
|
|
1324
|
+
return this.addEventListener("loadend", a), o.call(this, r);
|
|
1325
|
+
}, () => {
|
|
1326
|
+
e.open = n, e.send = o;
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
function It(t) {
|
|
1330
|
+
const e = Tt(t), n = Mt(t);
|
|
1331
|
+
return {
|
|
1332
|
+
uninstall() {
|
|
1333
|
+
e(), n();
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
const _t = 1e3, fe = 50, $t = 500;
|
|
1338
|
+
class Nt {
|
|
1339
|
+
constructor(e) {
|
|
1340
|
+
this.buffer = [], this.inflight = !1, this.timer = null, this.destroyed = !1, this.handleVisibilityChange = () => {
|
|
1341
|
+
document.visibilityState === "hidden" && this.flushSync();
|
|
1342
|
+
}, this.url = e.url, this.sessionId = e.sessionId, this.onError = e.onError, this.timer = setInterval(() => this.flush(), _t), this.pagehideHandler = () => this.flushSync(), window.addEventListener("pagehide", this.pagehideHandler), document.addEventListener("visibilitychange", this.handleVisibilityChange);
|
|
1343
|
+
}
|
|
1344
|
+
enqueue(e) {
|
|
1345
|
+
this.destroyed || (this.buffer.push(e), this.buffer.length >= $t && this.buffer.shift(), this.buffer.length >= fe && this.flush());
|
|
1346
|
+
}
|
|
1347
|
+
/** Async flush via fetch. No-op when in-flight or empty. */
|
|
1348
|
+
async flush() {
|
|
1349
|
+
var o, s;
|
|
1350
|
+
if (this.destroyed || this.inflight || this.buffer.length === 0) return;
|
|
1351
|
+
const e = this.buffer.splice(0, fe), n = this.makeBatch(e);
|
|
1352
|
+
this.inflight = !0;
|
|
1353
|
+
try {
|
|
1354
|
+
const i = await fetch(this.url, {
|
|
1355
|
+
method: "POST",
|
|
1356
|
+
// No credentials — this is going to the developer's local server,
|
|
1357
|
+
// not the app's own backend. Avoid leaking session cookies.
|
|
1358
|
+
credentials: "omit",
|
|
1359
|
+
headers: { "Content-Type": "application/json" },
|
|
1360
|
+
body: JSON.stringify(n),
|
|
1361
|
+
// keepalive lets the request survive a same-tick navigation when
|
|
1362
|
+
// we missed pagehide (e.g. a window.location.assign from script).
|
|
1363
|
+
keepalive: !0
|
|
1364
|
+
});
|
|
1365
|
+
i.ok || (o = this.onError) == null || o.call(this, new Error(`monitor flush: HTTP ${i.status}`));
|
|
1366
|
+
} catch (i) {
|
|
1367
|
+
(s = this.onError) == null || s.call(this, i instanceof Error ? i : new Error(String(i)));
|
|
1368
|
+
} finally {
|
|
1369
|
+
this.inflight = !1;
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
/** Synchronous flush via sendBeacon, used on pagehide. */
|
|
1373
|
+
flushSync() {
|
|
1374
|
+
if (this.destroyed || this.buffer.length === 0) return;
|
|
1375
|
+
if (!navigator.sendBeacon) {
|
|
1376
|
+
this.flush();
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
const e = this.buffer.splice(0), n = this.makeBatch(e), o = new Blob([JSON.stringify(n)], { type: "application/json" });
|
|
1380
|
+
try {
|
|
1381
|
+
navigator.sendBeacon(this.url, o);
|
|
1382
|
+
} catch {
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
destroy() {
|
|
1386
|
+
this.destroyed || (this.destroyed = !0, this.timer && clearInterval(this.timer), this.pagehideHandler && window.removeEventListener("pagehide", this.pagehideHandler), document.removeEventListener("visibilitychange", this.handleVisibilityChange), this.flushSync());
|
|
1387
|
+
}
|
|
1388
|
+
makeBatch(e) {
|
|
1389
|
+
return {
|
|
1390
|
+
sessionId: this.sessionId,
|
|
1391
|
+
events: e,
|
|
1392
|
+
meta: {
|
|
1393
|
+
url: window.location.href,
|
|
1394
|
+
userAgent: navigator.userAgent,
|
|
1395
|
+
viewport: {
|
|
1396
|
+
w: window.innerWidth,
|
|
1397
|
+
h: window.innerHeight,
|
|
1398
|
+
dpr: window.devicePixelRatio || 1
|
|
1399
|
+
},
|
|
1400
|
+
v: 1
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
const U = "__lsBeaconMonitorUrl", H = "__lsBeaconMonitorSession", q = "__lsBeaconMonitorVerbose", F = "__lsBeaconMonitorDeadline", we = 30 * 6e4, be = 4096;
|
|
1406
|
+
let m = null;
|
|
1407
|
+
const Rt = /* @__PURE__ */ new Set();
|
|
1408
|
+
let L = 0;
|
|
1409
|
+
function ve() {
|
|
1410
|
+
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID().slice(0, 8) : Math.random().toString(36).slice(2, 10);
|
|
1411
|
+
}
|
|
1412
|
+
function Pt(t) {
|
|
1413
|
+
const e = /* @__PURE__ */ new WeakSet(), n = (o) => {
|
|
1414
|
+
if (o === null || typeof o != "object")
|
|
1415
|
+
return typeof o == "string" && o.length > be ? o.slice(0, be) : o;
|
|
1416
|
+
if (e.has(o)) return "[cyclic]";
|
|
1417
|
+
if (e.add(o), Array.isArray(o)) return o.map(n);
|
|
1418
|
+
const s = {};
|
|
1419
|
+
for (const i of Object.keys(o).slice(0, 50))
|
|
1420
|
+
try {
|
|
1421
|
+
s[i] = n(o[i]);
|
|
1422
|
+
} catch {
|
|
1423
|
+
s[i] = "[unreadable]";
|
|
1424
|
+
}
|
|
1425
|
+
return s;
|
|
1426
|
+
};
|
|
1427
|
+
try {
|
|
1428
|
+
return n(t);
|
|
1429
|
+
} catch {
|
|
1430
|
+
return "[unserialisable]";
|
|
998
1431
|
}
|
|
999
1432
|
}
|
|
1000
|
-
function
|
|
1001
|
-
|
|
1433
|
+
function xe() {
|
|
1434
|
+
for (const t of Rt)
|
|
1435
|
+
try {
|
|
1436
|
+
t(m !== null, (m == null ? void 0 : m.url) ?? null);
|
|
1437
|
+
} catch {
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
function Dt(t) {
|
|
1441
|
+
return m ? (m.seq += 1, {
|
|
1442
|
+
...t,
|
|
1443
|
+
ts: Date.now(),
|
|
1444
|
+
sessionId: m.sessionId,
|
|
1445
|
+
seq: m.seq
|
|
1446
|
+
}) : {
|
|
1447
|
+
...t,
|
|
1448
|
+
ts: Date.now(),
|
|
1449
|
+
sessionId: "",
|
|
1450
|
+
seq: 0
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
function T(t) {
|
|
1454
|
+
if (!m) return;
|
|
1455
|
+
const e = Dt(t);
|
|
1456
|
+
m.transport.enqueue(e);
|
|
1457
|
+
}
|
|
1458
|
+
function Bt() {
|
|
1459
|
+
if (m)
|
|
1460
|
+
try {
|
|
1461
|
+
sessionStorage.setItem(U, m.url), sessionStorage.setItem(H, m.sessionId), sessionStorage.setItem(q, m.verbose ? "1" : "0"), sessionStorage.setItem(F, String(m.deadlineMs));
|
|
1462
|
+
} catch {
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
function Ee() {
|
|
1466
|
+
try {
|
|
1467
|
+
sessionStorage.removeItem(U), sessionStorage.removeItem(H), sessionStorage.removeItem(q), sessionStorage.removeItem(F);
|
|
1468
|
+
} catch {
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
function jt() {
|
|
1472
|
+
try {
|
|
1473
|
+
const t = sessionStorage.getItem(U);
|
|
1474
|
+
if (!t) return null;
|
|
1475
|
+
const e = sessionStorage.getItem(H) ?? ve(), n = sessionStorage.getItem(q) === "1", o = sessionStorage.getItem(F), s = o ? Number(o) : Date.now() + we;
|
|
1476
|
+
return Number.isFinite(s) && s <= Date.now() ? (Ee(), null) : { url: t, sessionId: e, verbose: n, deadlineMs: s };
|
|
1477
|
+
} catch {
|
|
1478
|
+
return null;
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
function Se(t) {
|
|
1482
|
+
if (m && z(), !t.url) return;
|
|
1483
|
+
const e = t.maxSessionMs ?? we, n = Date.now() + e, o = ve(), s = !!t.verbose, i = new Nt({
|
|
1484
|
+
url: t.url,
|
|
1485
|
+
sessionId: o,
|
|
1486
|
+
onError: (u) => {
|
|
1487
|
+
console.warn("[launch-kit-beacon] monitor transport error:", u.message);
|
|
1488
|
+
}
|
|
1489
|
+
}), r = M();
|
|
1490
|
+
L = r.length;
|
|
1491
|
+
for (const u of r) me(u, i, o);
|
|
1492
|
+
const l = ge(() => {
|
|
1493
|
+
const u = M();
|
|
1494
|
+
for (; L < u.length; ) {
|
|
1495
|
+
const g = u[L];
|
|
1496
|
+
g && me(g, i, o), L += 1;
|
|
1497
|
+
}
|
|
1498
|
+
}), a = It({
|
|
1499
|
+
emit: (u) => T(u),
|
|
1500
|
+
verbose: s
|
|
1501
|
+
}), c = Lt({
|
|
1502
|
+
emitClick: (u) => T(u),
|
|
1503
|
+
emitRoute: (u) => T(u),
|
|
1504
|
+
emitDialog: (u) => T(u)
|
|
1505
|
+
}), d = setTimeout(() => {
|
|
1506
|
+
console.info("[launch-kit-beacon] monitor session expired (max duration reached)"), z();
|
|
1507
|
+
}, Math.max(0, n - Date.now()));
|
|
1508
|
+
m = {
|
|
1509
|
+
url: t.url,
|
|
1510
|
+
sessionId: o,
|
|
1511
|
+
verbose: s,
|
|
1512
|
+
deadlineMs: n,
|
|
1513
|
+
seq: 0,
|
|
1514
|
+
transport: i,
|
|
1515
|
+
uninstallNetwork: a.uninstall,
|
|
1516
|
+
uninstallDom: c.uninstall,
|
|
1517
|
+
uninstallErrors: l,
|
|
1518
|
+
deadlineTimer: d
|
|
1519
|
+
}, Bt(), xe();
|
|
1520
|
+
}
|
|
1521
|
+
function me(t, e, n) {
|
|
1522
|
+
m && (m.seq += 1, e.enqueue({
|
|
1523
|
+
kind: t.kind,
|
|
1524
|
+
ts: t.ts,
|
|
1525
|
+
sessionId: n,
|
|
1526
|
+
seq: m.seq,
|
|
1527
|
+
message: t.message,
|
|
1528
|
+
...t.stack ? { stack: t.stack } : {},
|
|
1529
|
+
...t.source ? { source: t.source } : {},
|
|
1530
|
+
...typeof t.line == "number" ? { line: t.line } : {},
|
|
1531
|
+
...typeof t.col == "number" ? { col: t.col } : {}
|
|
1532
|
+
}));
|
|
1533
|
+
}
|
|
1534
|
+
function z() {
|
|
1535
|
+
m && (clearTimeout(m.deadlineTimer), m.uninstallNetwork(), m.uninstallDom(), m.uninstallErrors(), m.transport.destroy(), m = null, L = 0, Ee(), xe());
|
|
1536
|
+
}
|
|
1537
|
+
function Ot(t, e) {
|
|
1538
|
+
m && T({
|
|
1539
|
+
kind: "probe",
|
|
1540
|
+
label: t.slice(0, 200),
|
|
1541
|
+
data: Pt(e)
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
function zt() {
|
|
1545
|
+
return m !== null;
|
|
1546
|
+
}
|
|
1547
|
+
function Ut() {
|
|
1548
|
+
return (m == null ? void 0 : m.url) ?? null;
|
|
1549
|
+
}
|
|
1550
|
+
const Ht = {
|
|
1551
|
+
start: Se,
|
|
1552
|
+
stop: z,
|
|
1553
|
+
probe: Ot,
|
|
1554
|
+
isActive: zt,
|
|
1555
|
+
currentUrl: Ut
|
|
1556
|
+
};
|
|
1557
|
+
function qt() {
|
|
1558
|
+
if (m) return;
|
|
1559
|
+
const t = jt();
|
|
1560
|
+
t && Se({
|
|
1561
|
+
url: t.url,
|
|
1562
|
+
verbose: t.verbose,
|
|
1563
|
+
maxSessionMs: Math.max(6e4, t.deadlineMs - Date.now())
|
|
1564
|
+
});
|
|
1002
1565
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
const t =
|
|
1006
|
-
|
|
1007
|
-
o - a - V < y && (a = Math.max(y, o - V - y));
|
|
1008
|
-
const b = i - t.bottom - y, p = t.top - y;
|
|
1009
|
-
n.style.left = "auto", n.style.right = `${a}px`, b >= Pe || b >= p ? (n.style.top = `${t.bottom + y}px`, n.style.bottom = "auto") : (n.style.top = "auto", n.style.bottom = `${i - t.top + y}px`);
|
|
1566
|
+
function Ft() {
|
|
1567
|
+
if (typeof window > "u") return;
|
|
1568
|
+
const t = window;
|
|
1569
|
+
t.__lsBeacon || (t.__lsBeacon = Ht);
|
|
1010
1570
|
}
|
|
1011
|
-
|
|
1571
|
+
gt();
|
|
1572
|
+
ut();
|
|
1573
|
+
Ft();
|
|
1574
|
+
qt();
|
|
1012
1575
|
export {
|
|
1013
|
-
|
|
1014
|
-
|
|
1576
|
+
mt as LaunchKitBeacon,
|
|
1577
|
+
gt as defineBeacon
|
|
1015
1578
|
};
|
|
1016
1579
|
//# sourceMappingURL=beacon.mjs.map
|