@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
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
(function(C,L){typeof exports=="object"&&typeof module<"u"?L(exports):typeof define=="function"&&define.amd?define(["exports"],L):(C=typeof globalThis<"u"?globalThis:C||self,L(C.LaunchKitBeacon={}))})(this,function(C){"use strict";const L='.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-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}',A={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>',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>',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>',trash:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>',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>',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>'};function Re(e="Feedback"){const t=document.createElement("button");return t.type="button",t.className="beacon-default-trigger",t.setAttribute("aria-label",e),t.innerHTML=`${A.feedback}<span>${e}</span>`,t}const Te=["bug","idea","ux","a11y"];class $e{constructor(t,n){this.state={description:"",severity:"bug",pins:[],annotatedScreenshot:void 0,submitting:!1,status:"",statusKind:""},this.severities=t.length>0?t:Te,this.callbacks=n,this.root=document.createElement("div"),this.root.className="beacon-drawer",this.root.innerHTML=`
|
|
1
|
+
(function(A,R){typeof exports=="object"&&typeof module<"u"?R(exports):typeof define=="function"&&define.amd?define(["exports"],R):(A=typeof globalThis<"u"?globalThis:A||self,R(A.LaunchKitBeacon={}))})(this,function(A){"use strict";const R='.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}',L={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>',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>',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>',trash:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>',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>',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>'};function rt(e="Feedback"){const t=document.createElement("button");return t.type="button",t.className="beacon-default-trigger",t.setAttribute("aria-label",e),t.innerHTML=`${L.feedback}<span>${e}</span>`,t}const st=["bug","idea","ux","a11y"];class it{constructor(t,n){this.state={description:"",severity:"bug",pins:[],events:[],annotatedScreenshot:void 0,submitting:!1,status:"",statusKind:""},this.severities=t.length>0?t:st,this.callbacks=n,this.root=document.createElement("div"),this.root.className="beacon-drawer",this.root.innerHTML=`
|
|
2
2
|
<div class="beacon-drawer-header">
|
|
3
3
|
<div class="beacon-drawer-title">Send feedback</div>
|
|
4
|
-
<button type="button" class="beacon-icon-btn" data-action="close" aria-label="Close">${
|
|
4
|
+
<button type="button" class="beacon-icon-btn" data-action="close" aria-label="Close">${L.close}</button>
|
|
5
5
|
</div>
|
|
6
6
|
<div class="beacon-drawer-body"></div>
|
|
7
|
-
`,this.bodyEl=this.root.querySelector(".beacon-drawer-body"),this.root.querySelector('[data-action="close"]').addEventListener("click",()=>this.callbacks.onClose()),this.render()}open(){this.root.classList.remove("minimized"),this.root.classList.add("open")}close(){this.root.classList.remove("open")}minimize(){this.root.classList.add("minimized"),this.root.classList.remove("open")}setPins(t,n){this.state.pins=t,n!==void 0&&(this.state.annotatedScreenshot=n),this.render()}
|
|
7
|
+
`,this.bodyEl=this.root.querySelector(".beacon-drawer-body"),this.root.querySelector('[data-action="close"]').addEventListener("click",()=>this.callbacks.onClose()),this.render()}open(){this.root.classList.remove("minimized"),this.root.classList.add("open")}close(){this.root.classList.remove("open")}minimize(){this.root.classList.add("minimized"),this.root.classList.remove("open")}setPins(t,n){this.state.pins=t,n!==void 0&&(this.state.annotatedScreenshot=n),this.render()}setEvents(t){this.state.events=t,this.updateEventsChip()}updateEventsChip(){const t=this.bodyEl.querySelector(".beacon-events");if(!t){this.render();return}const n=this.state.events.length;if(n===0){t.hidden=!0;return}t.hidden=!1,t.dataset.count=String(n);const o=t.querySelector(".beacon-events-label");o&&(o.textContent=`${n} runtime ${n===1?"error":"errors"} will be included`);const r=t.querySelector(".beacon-events-list");r&&(r.innerHTML=this.state.events.map(s=>`
|
|
8
|
+
<li class="beacon-events-item">
|
|
9
|
+
<span class="beacon-events-kind ${s.kind==="unhandledrejection"?"rejection":"error"}">${s.kind==="unhandledrejection"?"rejection":"error"}</span>
|
|
10
|
+
<span class="beacon-events-msg">${T(s.message)}</span>
|
|
11
|
+
</li>
|
|
12
|
+
`).join(""))}getAnnotatedScreenshot(){return this.state.annotatedScreenshot}setAnnotatedScreenshot(t){this.state.annotatedScreenshot=t,this.render()}setSubmitting(t){this.state.submitting=t,this.render()}setStatus(t,n=""){this.state.status=t,this.state.statusKind=n,this.render()}reset(){this.state={description:"",severity:"bug",pins:[],events:[],annotatedScreenshot:void 0,submitting:!1,status:"",statusKind:""},this.render()}getDescription(){return this.state.description}getSeverity(){return this.state.severity}render(){var o,r;const t=this.state.description.trim().length>0&&!this.state.submitting;this.bodyEl.innerHTML=`
|
|
8
13
|
<div class="beacon-field">
|
|
9
14
|
<label class="beacon-label" for="beacon-desc">What's the issue?</label>
|
|
10
|
-
<textarea id="beacon-desc" class="beacon-textarea" placeholder="Describe what you saw, what you expected, anything that helps reproduce…">${
|
|
15
|
+
<textarea id="beacon-desc" class="beacon-textarea" placeholder="Describe what you saw, what you expected, anything that helps reproduce…">${T(this.state.description)}</textarea>
|
|
11
16
|
</div>
|
|
12
17
|
|
|
13
18
|
<div class="beacon-field">
|
|
14
19
|
<span class="beacon-label">Severity</span>
|
|
15
20
|
<div class="beacon-severity" role="radiogroup">
|
|
16
|
-
${this.severities.map(
|
|
17
|
-
<label class="beacon-severity-opt ${
|
|
18
|
-
<input type="radio" name="beacon-severity" value="${
|
|
19
|
-
${
|
|
21
|
+
${this.severities.map(s=>`
|
|
22
|
+
<label class="beacon-severity-opt ${s===this.state.severity?"selected":""}" data-sev="${s}">
|
|
23
|
+
<input type="radio" name="beacon-severity" value="${s}" ${s===this.state.severity?"checked":""}>
|
|
24
|
+
${s}
|
|
20
25
|
</label>
|
|
21
26
|
`).join("")}
|
|
22
27
|
</div>
|
|
@@ -33,44 +38,59 @@
|
|
|
33
38
|
<div class="beacon-field">
|
|
34
39
|
<span class="beacon-label">Pins (${this.state.pins.length})</span>
|
|
35
40
|
<div class="beacon-pin-list">
|
|
36
|
-
${this.state.pins.map(
|
|
37
|
-
<div class="beacon-pin-item" data-pin="${
|
|
38
|
-
<span class="beacon-pin-num">${
|
|
41
|
+
${this.state.pins.map(s=>`
|
|
42
|
+
<div class="beacon-pin-item" data-pin="${s.number}">
|
|
43
|
+
<span class="beacon-pin-num">${s.number}</span>
|
|
39
44
|
<div class="beacon-pin-meta">
|
|
40
|
-
<div class="beacon-pin-selector" title="${
|
|
41
|
-
<input type="text" class="beacon-pin-note-input" placeholder="Add a note (optional)" value="${
|
|
45
|
+
<div class="beacon-pin-selector" title="${T(s.selector)}">${T(s.selector)}</div>
|
|
46
|
+
<input type="text" class="beacon-pin-note-input" placeholder="Add a note (optional)" value="${T(s.note??"")}">
|
|
42
47
|
</div>
|
|
43
|
-
<button type="button" class="beacon-icon-btn" data-pin-delete="${
|
|
48
|
+
<button type="button" class="beacon-icon-btn" data-pin-delete="${s.number}" aria-label="Remove pin ${s.number}">${L.trash}</button>
|
|
44
49
|
</div>
|
|
45
50
|
`).join("")}
|
|
46
51
|
</div>
|
|
47
52
|
</div>
|
|
48
53
|
`:""}
|
|
49
54
|
|
|
55
|
+
<details class="beacon-events" data-count="${this.state.events.length}" ${this.state.events.length===0?"hidden":""}>
|
|
56
|
+
<summary class="beacon-events-summary">
|
|
57
|
+
<span class="beacon-events-dot" aria-hidden="true">●</span>
|
|
58
|
+
<span class="beacon-events-label">${this.state.events.length} runtime ${this.state.events.length===1?"error":"errors"} will be included</span>
|
|
59
|
+
</summary>
|
|
60
|
+
<ul class="beacon-events-list">
|
|
61
|
+
${this.state.events.map(s=>`
|
|
62
|
+
<li class="beacon-events-item">
|
|
63
|
+
<span class="beacon-events-kind ${s.kind==="unhandledrejection"?"rejection":"error"}">${s.kind==="unhandledrejection"?"rejection":"error"}</span>
|
|
64
|
+
<span class="beacon-events-msg">${T(s.message)}</span>
|
|
65
|
+
</li>
|
|
66
|
+
`).join("")}
|
|
67
|
+
</ul>
|
|
68
|
+
</details>
|
|
69
|
+
|
|
50
70
|
<div class="beacon-actions">
|
|
51
71
|
<button type="button" class="beacon-btn secondary" data-action="annotate" ${this.state.submitting?"disabled":""}>
|
|
52
|
-
${
|
|
72
|
+
${L.pin} ${this.state.pins.length>0?"Add another pin":"Annotate elements"}
|
|
53
73
|
</button>
|
|
54
74
|
<span style="flex:1"></span>
|
|
55
75
|
<button type="button" class="beacon-btn primary" data-action="submit" ${t?"":"disabled"}>
|
|
56
|
-
${
|
|
76
|
+
${L.send} ${this.state.submitting?"Sending…":"Send"}
|
|
57
77
|
</button>
|
|
58
78
|
</div>
|
|
59
79
|
|
|
60
|
-
${this.state.status?`<div class="beacon-status ${this.state.statusKind}">${
|
|
61
|
-
`;const n=this.bodyEl.querySelector("#beacon-desc");n.addEventListener("input",()=>{this.state.description=n.value,this.callbacks.onDescriptionChange(n.value);const
|
|
80
|
+
${this.state.status?`<div class="beacon-status ${this.state.statusKind}">${T(this.state.status)}</div>`:""}
|
|
81
|
+
`;const n=this.bodyEl.querySelector("#beacon-desc");n.addEventListener("input",()=>{this.state.description=n.value,this.callbacks.onDescriptionChange(n.value);const s=this.bodyEl.querySelector('[data-action="submit"]');s&&(s.disabled=!(n.value.trim().length>0)||this.state.submitting)}),this.bodyEl.querySelectorAll('input[name="beacon-severity"]').forEach(s=>{s.addEventListener("change",()=>{s.checked&&(this.state.severity=s.value,this.callbacks.onSeverityChange(this.state.severity),this.render())})}),(o=this.bodyEl.querySelector('[data-action="annotate"]'))==null||o.addEventListener("click",()=>this.callbacks.onAnnotate()),(r=this.bodyEl.querySelector('[data-action="submit"]'))==null||r.addEventListener("click",()=>this.callbacks.onSubmit()),this.bodyEl.querySelectorAll("[data-pin-delete]").forEach(s=>{s.addEventListener("click",()=>{const i=Number(s.getAttribute("data-pin-delete"));this.callbacks.onPinDelete(i)})}),this.bodyEl.querySelectorAll(".beacon-pin-note-input").forEach(s=>{const i=s.closest("[data-pin]"),a=Number((i==null?void 0:i.getAttribute("data-pin"))??0);s.addEventListener("input",()=>this.callbacks.onPinNoteChange(a,s.value))})}}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function at(e){return new Promise(t=>{const n=document.createElement("div");n.className="beacon-pin-popover open beacon-no-capture beacon-theme-auto",n.innerHTML=`
|
|
62
82
|
<div class="beacon-pin-popover-header">
|
|
63
83
|
<div style="display:flex;align-items:center;gap:6px;font-weight:600;font-size:13px;">
|
|
64
84
|
<span class="beacon-pin-num">${e.pinNumber}</span>
|
|
65
85
|
<span>Note for this pin</span>
|
|
66
86
|
</div>
|
|
67
|
-
<button type="button" class="beacon-icon-btn" data-action="cancel" aria-label="Discard this pin">${
|
|
87
|
+
<button type="button" class="beacon-icon-btn" data-action="cancel" aria-label="Discard this pin">${L.close}</button>
|
|
68
88
|
</div>
|
|
69
89
|
<textarea class="beacon-textarea" rows="2" placeholder="Optional — describe what's wrong here…" style="min-height:48px;"></textarea>
|
|
70
90
|
<div class="beacon-pin-popover-actions">
|
|
71
|
-
<button type="button" class="beacon-btn primary" data-action="save">${
|
|
91
|
+
<button type="button" class="beacon-btn primary" data-action="save">${L.check} Save</button>
|
|
72
92
|
</div>
|
|
73
|
-
`;const o=240,
|
|
93
|
+
`;const o=240,r=160,s=Math.min(Math.max(8,e.anchor.x),window.innerWidth-o-8),i=Math.min(Math.max(8,e.anchor.y+12),window.innerHeight-r-8);n.style.left=`${s}px`,n.style.top=`${i}px`,document.body.appendChild(n);const a=n.querySelector("textarea");a.focus();function c(d){document.removeEventListener("keydown",l,!0),n.remove(),t(d)}function l(d){d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),c({cancelled:"all"}))}document.addEventListener("keydown",l,!0),n.addEventListener("click",d=>{var w;const g=(w=d.target.closest("[data-action]"))==null?void 0:w.getAttribute("data-action");if(g==="cancel"&&c({cancelled:"pin"}),g==="save"){const v=a.value.trim();c({...v?{note:v}:{},cancelled:!1})}}),a.addEventListener("keydown",d=>{if(d.key==="Enter"&&(d.metaKey||d.ctrlKey)){d.preventDefault();const u=a.value.trim();c({...u?{note:u}:{},cancelled:!1})}})})}const M="beacon-no-capture",ct="#0ea5e9",ae="Click any element to pin it · Press Esc to finish";function ce(e,t){return/^#[0-9a-fA-F]{6}$/.test(e)?`${e}${t}`:e}function lt(e={}){const t=e.accent??ct,n=ce(t,"b3"),o=ce(t,"2e"),r=document.createElement("style");r.className=M,r.textContent="@keyframes beacon-spin { to { transform: rotate(360deg); } }",document.head.appendChild(r);const s=document.createElement("div");s.className=M,s.setAttribute("aria-hidden","true"),s.style.cssText=["position: fixed","inset: 0","pointer-events: none","z-index: 2147483646",`border: 2px dashed ${n}`,"border-radius: 4px",`box-shadow: inset 0 0 56px ${o}`,"box-sizing: border-box"].join("; ");const i=document.createElement("div");i.className=M,i.setAttribute("role","status"),i.style.cssText=["position: fixed","top: 16px","left: 50%","transform: translateX(-50%)",`background: ${t}`,"color: #fff","padding: 6px 14px","border-radius: 999px","font: 500 12px/1.4 system-ui, -apple-system, sans-serif","letter-spacing: 0.01em","box-shadow: 0 4px 12px #0000004d","pointer-events: none","white-space: nowrap","z-index: 2147483646"].join("; "),i.textContent=ae;const a=`<span style="
|
|
74
94
|
display: inline-block;
|
|
75
95
|
width: 12px;
|
|
76
96
|
height: 12px;
|
|
@@ -80,8 +100,9 @@
|
|
|
80
100
|
animation: beacon-spin 800ms linear infinite;
|
|
81
101
|
vertical-align: middle;
|
|
82
102
|
margin-right: 8px;
|
|
83
|
-
"></span>`;function c(
|
|
103
|
+
"></span>`;function c(h){return h.replace(/[<>&]/g,p=>({"<":"<",">":">","&":"&"})[p])}document.body.appendChild(s),document.body.appendChild(i);const l=new Map;function d(h){const p=document.createElement("div");return p.className=M,p.setAttribute("aria-hidden","true"),p.style.cssText=["position: fixed","width: 24px","height: 24px","border-radius: 999px",`background: ${t}`,"color: #fff","display: flex","align-items: center","justify-content: center","font: 700 12px/1 system-ui, -apple-system, sans-serif","border: 2px solid #fff","box-shadow: 0 2px 8px #00000066","pointer-events: none","z-index: 2147483646"].join("; "),p.textContent=String(h),document.body.appendChild(p),p}function u(){const h=document.createElement("div");return h.className=M,h.setAttribute("aria-hidden","true"),h.style.cssText=["position: fixed","pointer-events: none",`border: 2px solid ${t}`,"border-radius: 2px","box-sizing: border-box","z-index: 2147483645"].join("; "),document.body.appendChild(h),h}function g(h,p,f){const m=f?"0.5":"1";h.outline.style.display="block",h.outline.style.opacity=m,h.outline.style.left=`${p.x}px`,h.outline.style.top=`${p.y}px`,h.outline.style.width=`${p.w}px`,h.outline.style.height=`${p.h}px`,h.marker.style.display="flex",h.marker.style.opacity=m,h.marker.style.left=`${p.x+p.w-12}px`,h.marker.style.top=`${Math.max(2,p.y-12)}px`}function w(h){h.marker.style.display="none",h.outline.style.display="none"}function v(){l.forEach(h=>{let p=h.anchor.target;if(document.contains(p)||(p=null),!p&&h.anchor.selector&&(p=document.querySelector(h.anchor.selector),p&&(h.anchor.target=p)),p){const m=p.getBoundingClientRect();if(m.width>0||m.height>0){g(h,{x:m.left,y:m.top,w:m.width,h:m.height},!1);return}}const f=h.anchor.fallbackRect;if(f&&(f.w>0||f.h>0)){g(h,f,!0);return}w(h)})}let E=null;function S(){E===null&&(E=requestAnimationFrame(()=>{E=null,v()}))}return window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),{addPin(h,p){const f=d(h),m=u();l.set(h,{anchor:p,marker:f,outline:m}),v()},setLoading(h){h?i.innerHTML=a+c(h):i.textContent=ae},destroy(){window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S),E!==null&&cancelAnimationFrame(E),s.remove(),i.remove(),r.remove(),l.forEach(({marker:h,outline:p})=>{h.remove(),p.remove()}),l.clear()}}}const dt="#0ea5e9";function ut(e,t){return/^#[0-9a-fA-F]{6}$/.test(e)?`${e}${t}`:e}function ht(e){const{shadowRoot:t,onHover:n}=e,o=e.accent??dt,r=ut(o,"14"),s=document.createElement("div");s.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483646",`border: 2px solid ${o}`,`background: ${r}`,"transition: all 60ms ease-out","box-sizing: border-box","border-radius: 2px"].join("; "),document.body.appendChild(s);const i=document.createElement("div");i.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483647","background: #0f172a","color: #fff","font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace","padding: 3px 6px","border-radius: 3px","max-width: 280px","overflow: hidden","text-overflow: ellipsis","white-space: nowrap"].join("; "),document.body.appendChild(i);const a=document.body.style.cursor;document.body.style.cursor="crosshair";let c=!1,l=()=>{};const d=new Promise(f=>{l=f});function u(f){if(!f||!(f instanceof Node))return!1;let m=f;for(;m;){if(m===t||m===t.host)return!0;m=m.parentNode??m.host??null}return!1}function g(f,m){s.style.display="none",i.style.display="none";const ie=document.elementsFromPoint(f,m);s.style.display="block",i.style.display="block";for(const z of ie)if(!u(z))return z;return null}function w(f){const m=f.getBoundingClientRect();s.style.left=`${m.left}px`,s.style.top=`${m.top}px`,s.style.width=`${m.width}px`,s.style.height=`${m.height}px`;const ie=f.tagName.toLowerCase(),z=f.classList.length>0?"."+Array.from(f.classList).slice(0,2).join("."):"";i.textContent=ie+z;const ot=m.top-22;i.style.left=`${m.left}px`,i.style.top=`${ot>=0?ot:m.bottom+4}px`}function v(f){const m=g(f.clientX,f.clientY);m?(w(m),n==null||n(m)):(s.style.display="none",i.style.display="none",n==null||n(null))}function E(f){if(f.button!==0)return;f.preventDefault(),f.stopPropagation();const m=g(f.clientX,f.clientY);m&&p(m)}function S(f){f.preventDefault(),f.stopPropagation()}function h(f){f.key==="Escape"&&(f.preventDefault(),p(null))}function p(f){c||(c=!0,document.removeEventListener("mousemove",v,!0),document.removeEventListener("pointerdown",E,!0),document.removeEventListener("click",S,!0),document.removeEventListener("mouseup",S,!0),document.removeEventListener("keydown",h,!0),s.remove(),i.remove(),document.body.style.cursor=a,l(f))}return document.addEventListener("mousemove",v,!0),document.addEventListener("pointerdown",E,!0),document.addEventListener("click",S,!0),document.addEventListener("mouseup",S,!0),document.addEventListener("keydown",h,!0),{cancel:()=>p(null),promise:d}}const ft=8;function le(e,t=document){if(!e)return!1;try{return t.querySelectorAll(`#${CSS.escape(e)}`).length===1}catch{return!1}}function pt(e){const t=e.tagName.toLowerCase(),n=Array.from(e.classList).filter(o=>o.length>0&&o.length<40).slice(0,3).map(o=>`.${CSS.escape(o)}`).join("");return t+n}function mt(e){const t=e.parentElement;return t?Array.from(t.children).filter(o=>o.tagName===e.tagName).indexOf(e)+1:1}function bt(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return"";if(e.id&&le(e.id))return`#${CSS.escape(e.id)}`;const t=[];let n=e,o=0;for(;n&&n.tagName.toLowerCase()!=="body"&&o<ft;){const r=n;if(r.id&&le(r.id)){t.unshift(`#${CSS.escape(r.id)}`);break}const s=pt(r),i=r.parentElement;let a=s;if(i)try{const c=Array.from(r.classList).join(" ");Array.from(i.children).filter(d=>d.tagName===r.tagName&&Array.from(d.classList).join(" ")===c).length>1&&(a=`${r.tagName.toLowerCase()}:nth-of-type(${mt(r)})`)}catch{}t.unshift(a),n=i,o++}return t.join(" > ")}function gt(e){const t=Object.keys(e).filter(o=>o.startsWith("__reactFiber$")||o.startsWith("__reactInternalInstance$"));if(t.length===0)return null;let n=e[t[0]];for(let o=0;o<10&&n;o++){const r=n,s=r.type;if(typeof s=="function"){const i=s.displayName??s.name;if(i&&i!=="_default")return{lib:"react",name:i}}if(typeof s=="object"&&s!==null){const i=s.displayName??s.name;if(i)return{lib:"react",name:i}}n=r.return}return{lib:"react"}}function yt(e){var o,r;const t=e,n=t.__vueParentComponent;if(n){const s=((o=n.type)==null?void 0:o.name)??((r=n.type)==null?void 0:r.__name);return{lib:"vue",...s?{name:s}:{}}}return t.__vue__?{lib:"vue"}:null}function wt(e){const t=window.ng;if(!(t!=null&&t.getComponent))return null;try{const n=t.getComponent(e);if(!n)return null;const o=n.constructor;return{lib:"angular",...o!=null&&o.name?{name:o.name}:{}}}catch{return null}}function vt(e){return"__svelte_meta"in e?{lib:"svelte"}:null}function de(e){return gt(e)??yt(e)??wt(e)??vt(e)??void 0}const xt=5e3,St=1e3,ue=1e3,he=200,Et=50,fe=200,kt=500,Ct=["display","position","top","right","bottom","left","width","height","min-width","min-height","max-width","max-height","margin","padding","font-family","font-size","font-weight","line-height","text-align","color","background-color","background-image","border","border-radius","opacity","visibility","overflow","z-index","transform","transition","flex","flex-direction","justify-content","align-items","gap","grid-template-columns","grid-template-rows"];function pe(e,t){return e.length<=t?e:e.slice(0,t)+`
|
|
84
104
|
|
|
85
|
-
/* … truncated, original was ${e.length} chars */`}function Ye(e){const t=getComputedStyle(e),n={};for(const o of Xe){const i=t.getPropertyValue(o);i&&i!=="normal"&&i!=="none"&&i!=="auto"&&i!=="0px"&&(n[o]=i.trim().slice(0,Ge))}return n}function Je(e){return Array.from(e.classList).slice(0,Ke).map(n=>n.length>J?n.slice(0,J):n)}function Qe(e){const t=e.getBoundingClientRect(),n=ze(e),o=e.id||null;return{selector:n.length>X?n.slice(0,X):n,tagName:e.tagName.toLowerCase(),id:o&&o.length>Y?o.slice(0,Y):o,classList:Je(e),outerHTML:Q(e.outerHTML,Ve),...e.parentElement?{parentOuterHTML:Q(e.parentElement.outerHTML,qe)}:{},computedStyles:Ye(e),boundingRect:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},...G(e)?{framework:G(e)}:{}}}function Z(){var n,o;const e=navigator;return e.userAgentData?{brand:((n=e.userAgentData.brands.find(i=>!/Not[.\-]?A.?Brand/i.test(i.brand)))==null?void 0:n.brand)??((o=e.userAgentData.brands[0])==null?void 0:o.brand)??"unknown",mobile:e.userAgentData.mobile,platform:e.userAgentData.platform}:void 0}function ee(){if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark";if(window.matchMedia("(prefers-color-scheme: light)").matches)return"light"}function te(){return{url:window.location.href,...document.referrer?{referrer:document.referrer}:{},userAgent:navigator.userAgent,...Z()?{uaData:Z()}:{},viewport:{w:window.innerWidth,h:window.innerHeight,dpr:window.devicePixelRatio||1},screen:{w:window.screen.width,h:window.screen.height},timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,locale:navigator.language,...ee()?{theme:ee()}:{},capturedAt:new Date().toISOString()}}let B=null;async function Ze(){return B||(B=await Promise.resolve().then(()=>dn)),B}const I="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII=";function ne(e,t){if(!e||e.startsWith("data:")||e.startsWith("blob:")||e.startsWith("/")||e.startsWith("#"))return!0;try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return t==="anonymous"||t==="use-credentials"}function et(){const e=[],t=[];return document.querySelectorAll("img").forEach(n=>{ne(n.src,n.crossOrigin)||(e.push({el:n,src:n.src}),n.src=I)}),document.querySelectorAll("image").forEach(n=>{const o=n,i=o.getAttribute("href"),r=o.getAttributeNS("http://www.w3.org/1999/xlink","href"),a=i||r||"";a&&!ne(a)&&(t.push({el:o,href:i,xlink:r}),i!==null&&o.setAttribute("href",I),r!==null&&o.setAttributeNS("http://www.w3.org/1999/xlink","href",I))}),()=>{for(const{el:n,src:o}of e)n.src=o;for(const{el:n,href:o,xlink:i}of t)o!==null&&n.setAttribute("href",o),i!==null&&n.setAttributeNS("http://www.w3.org/1999/xlink","href",i)}}async function oe(e={}){const{quality:t=.7,pixelRatio:n=Math.min(window.devicePixelRatio||1,2),excludeShadowRoot:o}=e,i=await Ze(),r=o?s=>{let c=s;for(;c;){if(c===o.host||c instanceof Element&&c.classList.contains("beacon-no-capture"))return!1;c=c.parentNode}return!0}:void 0,a=et();try{return await i.toJpeg(document.documentElement,{quality:t,pixelRatio:n,cacheBust:!0,...r?{filter:r}:{},imagePlaceholder:I,width:window.innerWidth,height:window.innerHeight,style:{transform:"none"}})}finally{a()}}const tt=14,nt="#ffffff",ot="#ffffff",rt=3,it="#0ea5e9";async function re(e,t,n,o,i=it){const r=i,a=i,s=await st(e),c=document.createElement("canvas");c.width=s.naturalWidth,c.height=s.naturalHeight;const d=c.getContext("2d");if(!d)throw new Error("Could not get 2D canvas context");d.drawImage(s,0,0);const u=c.width/n.w,b=c.height/n.h;for(const y of t){const w=at(y,o);if(!w)continue;const v=w.x*u,E=w.y*b,x=w.w*u,l=w.h*b;d.lineWidth=rt,d.strokeStyle=a,d.strokeRect(v,E,x,l);const f=v+x,h=E;d.beginPath(),d.fillStyle=r,d.arc(f,h,tt,0,Math.PI*2),d.fill(),d.lineWidth=3,d.strokeStyle=nt,d.stroke(),d.fillStyle=ot,d.font="bold 16px system-ui, -apple-system, sans-serif",d.textAlign="center",d.textBaseline="middle",d.fillText(String(y.number),f,h+1)}return c.toDataURL("image/jpeg",.85)}function at(e,t){const n=t==null?void 0:t.get(e);if(n&&document.contains(n)){const o=n.getBoundingClientRect();if(o.width>0||o.height>0)return{x:o.left,y:o.top,w:o.width,h:o.height}}if(e.selector)try{const o=document.querySelector(e.selector);if(o){const i=o.getBoundingClientRect();if(i.width>0||i.height>0)return{x:i.left,y:i.top,w:i.width,h:i.height}}}catch{}return e.boundingRect}function st(e){return new Promise((t,n)=>{const o=new Image;o.onload=()=>t(o),o.onerror=i=>n(i),o.src=e})}async function ct(e,t,n){const o=await fetch(e,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...n??{}},body:JSON.stringify(t)});let i=null;if((o.headers.get("Content-Type")??"").includes("application/json"))try{i=await o.json()}catch{i=null}else try{i=await o.text()}catch{i=null}return{ok:o.ok,status:o.status,body:i}}const lt=["endpoint","position","theme","severities"],ie="launch-kit-beacon-portal-styles";function dt(e){if(document.getElementById(ie))return;const t=document.createElement("style");t.id=ie,t.textContent=e,document.head.appendChild(t)}const ut=["--beacon-accent","--beacon-bg","--beacon-fg","--beacon-muted","--beacon-border","--beacon-radius","--beacon-shadow","--beacon-z-index","--beacon-bug","--beacon-idea","--beacon-ux","--beacon-a11y"],ae="#0ea5e9";class se extends HTMLElement{constructor(){super(...arguments),this._config=null,this.pins=[],this.pinElements=new WeakMap,this.description="",this.severity="bug",this.submitSucceeded=!1}static get observedAttributes(){return lt}set config(t){this._config=t}get config(){if(this._config)return this._config;const t=this.getAttribute("endpoint");return t?{endpoint:t}:null}connectedCallback(){if(!this.shadow){this.shadow=this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=L,this.shadow.appendChild(t),this.slotEl=document.createElement("slot"),this.slotEl.name="trigger",this.shadow.appendChild(this.slotEl),this.trigger=Re(),this.shadow.appendChild(this.trigger),this.trigger.addEventListener("click",()=>this.open()),this.slotEl.addEventListener("slotchange",()=>{const n=this.slotEl.assignedElements();n.length>0&&(this.trigger&&(this.trigger.style.display="none"),n.forEach(o=>o.addEventListener("click",()=>this.open())))}),this.drawer=new $e(this.parseSeverities(),{onClose:()=>this.close(),onAnnotate:()=>this.startAnnotate(),onSubmit:()=>this.handleSubmit(),onPinNoteChange:(n,o)=>this.updatePinNote(n,o),onPinDelete:n=>this.deletePin(n),onDescriptionChange:n=>{this.description=n},onSeverityChange:n=>{this.severity=n}}),dt(L),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.hasAttribute("position")||this.setAttribute("position","bottom-right"),this.hasAttribute("theme")||this.setAttribute("theme","auto")}attributeChangedCallback(t,n,o){t==="severities"&&this.drawer&&console.warn("[launch-kit-beacon] severities attribute changed after mount; not yet hot-reloaded."),t==="theme"&&this.drawer&&n!==o&&(this.drawer.root.classList.remove(`beacon-theme-${n??"auto"}`),this.drawer.root.classList.add(`beacon-theme-${o??"auto"}`))}open(){var t;if(this.drawer){if(this.getAttribute("position")==="hidden"){const n=(t=this.slotEl)==null?void 0:t.assignedElements()[0];n&&ft(this.drawer.root,n)}this.submitSucceeded=!1,this.syncCustomProperties(),this.installClickBlocker(),this.drawer.open()}}close(){this.drawer&&(!this.submitSucceeded&&this.hasUnsavedData()&&!window.confirm("You have unsaved feedback. Close and discard it?")||this.forceClose())}disconnectedCallback(){this.uninstallClickBlocker(),this.drawer&&this.drawer.root.parentNode&&this.drawer.root.parentNode.removeChild(this.drawer.root)}async openWithPicker(){this.open(),setTimeout(()=>this.startAnnotate(),0)}async startAnnotate(){if(!this.drawer)return;this.drawer.minimize();const t=this.getAccentColor(),n=Ie({accent:t});for(const o of this.pins){const i=this.pinElements.get(o);i&&n.addPin(o.number,{target:i,selector:o.selector,fallbackRect:o.boundingRect})}try{let o=!0;for(;o;){const r=await Fe({shadowRoot:this.shadow,accent:t}).promise;if(!r)break;const a=r.getBoundingClientRect(),s=await Pe({shadowRoot:this.shadow,anchor:{x:a.left,y:a.bottom},pinNumber:this.pins.length+1});if(s.cancelled==="all")break;if(s.cancelled==="pin")continue;const c=Qe(r),d={number:this.pins.length+1,...c,...s.note?{note:s.note}:{}};this.pins.push(d),this.pinElements.set(d,r),n.addPin(d.number,{target:r,selector:c.selector,fallbackRect:c.boundingRect})}if(this.pins.length>0){n.setLoading("Capturing screenshot…"),await new Promise(i=>requestAnimationFrame(()=>i()));try{const i=te(),r=await oe({excludeShadowRoot:this.shadow}),a=await re(r,this.pins,i.viewport,this.pinElements,t);this.drawer.setPins(this.pins,a)}catch(i){const r=i instanceof Error?i.message:String(i);console.error("[launch-kit-beacon] screenshot capture failed:",i),this.drawer.setPins(this.pins),this.drawer.setStatus(`Screenshot capture failed: ${r}`,"error")}}}finally{n.destroy()}this.drawer.open()}updatePinNote(t,n){const o=this.pins.find(i=>i.number===t);o&&(n.trim()?o.note=n:delete o.note)}deletePin(t){var n,o;this.pins=this.pins.filter(i=>i.number!==t),this.pins.forEach((i,r)=>{i.number=r+1}),(n=this.drawer)==null||n.setAnnotatedScreenshot(void 0),(o=this.drawer)==null||o.setPins(this.pins)}async handleSubmit(){if(!this.drawer)return;const t=this.config;if(!(t!=null&&t.endpoint)){this.drawer.setStatus("Missing endpoint configuration","error");return}const n=this.drawer.getDescription().trim(),o=this.drawer.getSeverity();if(!n){this.drawer.setStatus("Description is required","error");return}this.drawer.setSubmitting(!0);let i=this.drawer.getAnnotatedScreenshot();const r=!i&&this.pins.length>0;this.drawer.setStatus(r?"Capturing screenshot…":"Sending…"),await new Promise(u=>requestAnimationFrame(()=>u()));const a=te();if(r)try{const u=await oe({excludeShadowRoot:this.shadow});i=await re(u,this.pins,a.viewport,this.pinElements,this.getAccentColor())}catch(u){console.error("[launch-kit-beacon] screenshot capture failed at submit:",u)}const s={description:n,severity:o,...i?{screenshot:{dataUrl:i,mime:"image/jpeg"}}:{},metadata:a,pins:this.pins,...this.resolveContext()?{context:this.resolveContext()}:{}},c=new CustomEvent("beacon-before-submit",{detail:{payload:s},cancelable:!0,bubbles:!0,composed:!0});if(!this.dispatchEvent(c)){this.drawer.setSubmitting(!1),this.drawer.setStatus("Submission cancelled","error");return}this.drawer.setStatus("Sending…");try{const u=this.resolveHeaders(),b=await ct(t.endpoint,s,u);this.drawer.setSubmitting(!1),b.ok?(this.submitSucceeded=!0,this.drawer.setStatus("Sent — thanks!","success"),this.dispatchEvent(new CustomEvent("beacon-after-submit",{detail:{response:b},bubbles:!0,composed:!0})),setTimeout(()=>{this.forceClose()},1500)):this.drawer.setStatus(`Failed: ${b.status}`,"error")}catch(u){this.drawer.setSubmitting(!1);const b=u instanceof Error?u.message:"Network error";this.drawer.setStatus(`Failed: ${b}`,"error")}}getAccentColor(){return typeof window>"u"?ae:getComputedStyle(this).getPropertyValue("--beacon-accent").trim()||ae}syncCustomProperties(){if(!this.drawer)return;const t=getComputedStyle(this);for(const n of ut){const o=t.getPropertyValue(n).trim();o&&this.drawer.root.style.setProperty(n,o)}}hasUnsavedData(){var n;return this.pins.length>0?!0:(((n=this.drawer)==null?void 0:n.getDescription())??"").trim().length>0}resetState(){var t;this.pins=[],this.description="",this.severity="bug",this.pinElements=new WeakMap,(t=this.drawer)==null||t.reset()}forceClose(){var t;this.uninstallClickBlocker(),this.resetState(),this.submitSucceeded=!1,(t=this.drawer)==null||t.close()}installClickBlocker(){this.documentClickBlocker||(this.documentClickBlocker=t=>{const n=t.composedPath();if(!n.includes(this.shadow.host)){for(const o of n)if(o instanceof Element&&o.classList.contains("beacon-no-capture"))return;t.preventDefault(),t.stopPropagation()}},document.addEventListener("click",this.documentClickBlocker,!0))}uninstallClickBlocker(){this.documentClickBlocker&&(document.removeEventListener("click",this.documentClickBlocker,!0),this.documentClickBlocker=void 0)}resolveHeaders(){var n;const t=(n=this.config)==null?void 0:n.headers;if(t)return typeof t=="function"?t():t}resolveContext(){var n;const t=(n=this.config)==null?void 0:n.context;if(t)return typeof t=="function"?t():t}parseSeverities(){const t=this.getAttribute("severities");return t?t.split(",").map(n=>n.trim()).filter(Boolean):["bug","idea","ux","a11y"]}}function ce(e="launch-kit-beacon"){typeof window>"u"||customElements.get(e)||customElements.define(e,se)}const le=380,S=8,ht=520;function ft(e,t){const n=t.getBoundingClientRect(),o=window.innerWidth,i=window.innerHeight;let r=Math.max(S,o-n.right);o-r-le<S&&(r=Math.max(S,o-le-S));const s=i-n.bottom-S,c=n.top-S;e.style.left="auto",e.style.right=`${r}px`,s>=ht||s>=c?(e.style.top=`${n.bottom+S}px`,e.style.bottom="auto"):(e.style.top="auto",e.style.bottom=`${i-n.top+S}px`)}ce();function pt(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),o=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(o),n.body.appendChild(i),t&&(o.href=t),i.href=e,i.href}const bt=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function k(e){const t=[];for(let n=0,o=e.length;n<o;n++)t.push(e[n]);return t}let R=null;function de(e={}){return R||(e.includeStyleProperties?(R=e.includeStyleProperties,R):(R=k(window.getComputedStyle(document.documentElement)),R))}function _(e,t){const o=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return o?parseFloat(o.replace("px","")):0}function mt(e){const t=_(e,"border-left-width"),n=_(e,"border-right-width");return e.clientWidth+t+n}function gt(e){const t=_(e,"border-top-width"),n=_(e,"border-bottom-width");return e.clientHeight+t+n}function H(e,t={}){const n=t.width||mt(e),o=t.height||gt(e);return{width:n,height:o}}function yt(){let e,t;try{t=process}catch{}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const g=16384;function wt(e){(e.width>g||e.height>g)&&(e.width>g&&e.height>g?e.width>e.height?(e.height*=g/e.width,e.width=g):(e.width*=g/e.height,e.height=g):e.width>g?(e.height*=g/e.width,e.width=g):(e.width*=g/e.height,e.height=g))}function xt(e,t={}){return e.toBlob?new Promise(n=>{e.toBlob(n,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(n=>{const o=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),i=o.length,r=new Uint8Array(i);for(let a=0;a<i;a+=1)r[a]=o.charCodeAt(a);n(new Blob([r],{type:t.type?t.type:"image/png"}))})}function D(e){return new Promise((t,n)=>{const o=new Image;o.onload=()=>{o.decode().then(()=>{requestAnimationFrame(()=>t(o))})},o.onerror=n,o.crossOrigin="anonymous",o.decoding="async",o.src=e})}async function vt(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Et(e,t,n){const o="http://www.w3.org/2000/svg",i=document.createElementNS(o,"svg"),r=document.createElementNS(o,"foreignObject");return i.setAttribute("width",`${t}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${t} ${n}`),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("externalResourcesRequired","true"),i.appendChild(r),r.appendChild(e),vt(i)}const m=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||m(n,t)};function St(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function kt(e,t){return de(t).map(n=>{const o=e.getPropertyValue(n),i=e.getPropertyPriority(n);return`${n}: ${o}${i?" !important":""};`}).join(" ")}function Ct(e,t,n,o){const i=`.${e}:${t}`,r=n.cssText?St(n):kt(n,o);return document.createTextNode(`${i}{${r}}`)}function ue(e,t,n,o){const i=window.getComputedStyle(e,n),r=i.getPropertyValue("content");if(r===""||r==="none")return;const a=bt();try{t.className=`${t.className} ${a}`}catch{return}const s=document.createElement("style");s.appendChild(Ct(a,n,i,o)),t.appendChild(s)}function At(e,t,n){ue(e,t,":before",n),ue(e,t,":after",n)}const he="application/font-woff",fe="image/jpeg",Lt={woff:he,woff2:he,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:fe,jpeg:fe,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Rt(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function z(e){const t=Rt(e).toLowerCase();return Lt[t]||""}function Tt(e){return e.split(/,/)[1]}function U(e){return e.search(/^(data:)/)!==-1}function $t(e,t){return`data:${t};base64,${e}`}async function pe(e,t,n){const o=await fetch(e,t);if(o.status===404)throw new Error(`Resource "${o.url}" not found`);const i=await o.blob();return new Promise((r,a)=>{const s=new FileReader;s.onerror=a,s.onloadend=()=>{try{r(n({res:o,result:s.result}))}catch(c){a(c)}},s.readAsDataURL(i)})}const j={};function Pt(e,t,n){let o=e.replace(/\?.*/,"");return n&&(o=e),/ttf|otf|eot|woff2?/i.test(o)&&(o=o.replace(/.*\//,"")),t?`[${t}]${o}`:o}async function W(e,t,n){const o=Pt(e,t,n.includeQueryParams);if(j[o]!=null)return j[o];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let i;try{const r=await pe(e,n.fetchRequestInit,({res:a,result:s})=>(t||(t=a.headers.get("Content-Type")||""),Tt(s)));i=$t(r,t)}catch(r){i=n.imagePlaceholder||"";let a=`Failed to fetch resource: ${e}`;r&&(a=typeof r=="string"?r:r.message),a&&console.warn(a)}return j[o]=i,i}async function Mt(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):D(t)}async function It(e,t){if(e.currentSrc){const r=document.createElement("canvas"),a=r.getContext("2d");r.width=e.clientWidth,r.height=e.clientHeight,a==null||a.drawImage(e,0,0,r.width,r.height);const s=r.toDataURL();return D(s)}const n=e.poster,o=z(n),i=await W(n,o,t);return D(i)}async function _t(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await F(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function Dt(e,t){return m(e,HTMLCanvasElement)?Mt(e):m(e,HTMLVideoElement)?It(e,t):m(e,HTMLIFrameElement)?_t(e,t):e.cloneNode(be(e))}const Ft=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",be=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function Ot(e,t,n){var o,i;if(be(t))return t;let r=[];return Ft(e)&&e.assignedNodes?r=k(e.assignedNodes()):m(e,HTMLIFrameElement)&&(!((o=e.contentDocument)===null||o===void 0)&&o.body)?r=k(e.contentDocument.body.childNodes):r=k(((i=e.shadowRoot)!==null&&i!==void 0?i:e).childNodes),r.length===0||m(e,HTMLVideoElement)||await r.reduce((a,s)=>a.then(()=>F(s,n)).then(c=>{c&&t.appendChild(c)}),Promise.resolve()),t}function Bt(e,t,n){const o=t.style;if(!o)return;const i=window.getComputedStyle(e);i.cssText?(o.cssText=i.cssText,o.transformOrigin=i.transformOrigin):de(n).forEach(r=>{let a=i.getPropertyValue(r);r==="font-size"&&a.endsWith("px")&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),m(e,HTMLIFrameElement)&&r==="display"&&a==="inline"&&(a="block"),r==="d"&&t.getAttribute("d")&&(a=`path(${t.getAttribute("d")})`),o.setProperty(r,a,i.getPropertyPriority(r))})}function Ht(e,t){m(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),m(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function zt(e,t){if(m(e,HTMLSelectElement)){const n=t,o=Array.from(n.children).find(i=>e.value===i.getAttribute("value"));o&&o.setAttribute("selected","")}}function Ut(e,t,n){return m(t,Element)&&(Bt(e,t,n),At(e,t,n),Ht(e,t),zt(e,t)),t}async function jt(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const o={};for(let r=0;r<n.length;r++){const s=n[r].getAttribute("xlink:href");if(s){const c=e.querySelector(s),d=document.querySelector(s);!c&&d&&!o[s]&&(o[s]=await F(d,t,!0))}}const i=Object.values(o);if(i.length){const r="http://www.w3.org/1999/xhtml",a=document.createElementNS(r,"svg");a.setAttribute("xmlns",r),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";const s=document.createElementNS(r,"defs");a.appendChild(s);for(let c=0;c<i.length;c++)s.appendChild(i[c]);e.appendChild(a)}return e}async function F(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(o=>Dt(o,t)).then(o=>Ot(e,o,t)).then(o=>Ut(e,o,t)).then(o=>jt(o,t))}const me=/url\((['"]?)([^'"]+?)\1\)/g,Wt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Nt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Vt(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function qt(e){const t=[];return e.replace(me,(n,o,i)=>(t.push(i),n)),t.filter(n=>!U(n))}async function Kt(e,t,n,o,i){try{const r=n?pt(t,n):t,a=z(t);let s;return i||(s=await W(r,a,o)),e.replace(Vt(t),`$1${s}$3`)}catch{}return e}function Gt(e,{preferredFontFormat:t}){return t?e.replace(Nt,n=>{for(;;){const[o,,i]=Wt.exec(n)||[];if(!i)return"";if(i===t)return`src: ${o};`}}):e}function ge(e){return e.search(me)!==-1}async function ye(e,t,n){if(!ge(e))return e;const o=Gt(e,n);return qt(o).reduce((r,a)=>r.then(s=>Kt(s,a,t,n)),Promise.resolve(o))}async function T(e,t,n){var o;const i=(o=t.style)===null||o===void 0?void 0:o.getPropertyValue(e);if(i){const r=await ye(i,null,n);return t.style.setProperty(e,r,t.style.getPropertyPriority(e)),!0}return!1}async function Xt(e,t){await T("background",e,t)||await T("background-image",e,t),await T("mask",e,t)||await T("-webkit-mask",e,t)||await T("mask-image",e,t)||await T("-webkit-mask-image",e,t)}async function Yt(e,t){const n=m(e,HTMLImageElement);if(!(n&&!U(e.src))&&!(m(e,SVGImageElement)&&!U(e.href.baseVal)))return;const o=n?e.src:e.href.baseVal,i=await W(o,z(o),t);await new Promise((r,a)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...c)=>{try{r(t.onImageErrorHandler(...c))}catch(d){a(d)}}:a;const s=e;s.decode&&(s.decode=r),s.loading==="lazy"&&(s.loading="eager"),n?(e.srcset="",e.src=i):e.href.baseVal=i})}async function Jt(e,t){const o=k(e.childNodes).map(i=>we(i,t));await Promise.all(o).then(()=>e)}async function we(e,t){m(e,Element)&&(await Xt(e,t),await Yt(e,t),await Jt(e,t))}function Qt(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const o=t.style;return o!=null&&Object.keys(o).forEach(i=>{n[i]=o[i]}),e}const xe={};async function ve(e){let t=xe[e];if(t!=null)return t;const o=await(await fetch(e)).text();return t={url:e,cssText:o},xe[e]=t,t}async function Ee(e,t){let n=e.cssText;const o=/url\(["']?([^"')]+)["']?\)/g,r=(n.match(/url\([^)]+\)/g)||[]).map(async a=>{let s=a.replace(o,"$1");return s.startsWith("https://")||(s=new URL(s,e.url).href),pe(s,t.fetchRequestInit,({result:c})=>(n=n.replace(a,`url(${c})`),[a,c]))});return Promise.all(r).then(()=>n)}function Se(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let o=e.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const c=i.exec(o);if(c===null)break;t.push(c[0])}o=o.replace(i,"");const r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",s=new RegExp(a,"gi");for(;;){let c=r.exec(o);if(c===null){if(c=s.exec(o),c===null)break;r.lastIndex=s.lastIndex}else s.lastIndex=r.lastIndex;t.push(c[0])}return t}async function Zt(e,t){const n=[],o=[];return e.forEach(i=>{if("cssRules"in i)try{k(i.cssRules||[]).forEach((r,a)=>{if(r.type===CSSRule.IMPORT_RULE){let s=a+1;const c=r.href,d=ve(c).then(u=>Ee(u,t)).then(u=>Se(u).forEach(b=>{try{i.insertRule(b,b.startsWith("@import")?s+=1:i.cssRules.length)}catch(y){console.error("Error inserting rule from remote css",{rule:b,error:y})}})).catch(u=>{console.error("Error loading remote css",u.toString())});o.push(d)}})}catch(r){const a=e.find(s=>s.href==null)||document.styleSheets[0];i.href!=null&&o.push(ve(i.href).then(s=>Ee(s,t)).then(s=>Se(s).forEach(c=>{a.insertRule(c,a.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",r)}}),Promise.all(o).then(()=>(e.forEach(i=>{if("cssRules"in i)try{k(i.cssRules||[]).forEach(r=>{n.push(r)})}catch(r){console.error(`Error while reading CSS rules from ${i.href}`,r)}}),n))}function en(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>ge(t.style.getPropertyValue("src")))}async function tn(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=k(e.ownerDocument.styleSheets),o=await Zt(n,t);return en(o)}function ke(e){return e.trim().replace(/["']/g,"")}function nn(e){const t=new Set;function n(o){(o.style.fontFamily||getComputedStyle(o).fontFamily).split(",").forEach(r=>{t.add(ke(r))}),Array.from(o.children).forEach(r=>{r instanceof HTMLElement&&n(r)})}return n(e),t}async function Ce(e,t){const n=await tn(e,t),o=nn(e);return(await Promise.all(n.filter(r=>o.has(ke(r.style.fontFamily))).map(r=>{const a=r.parentStyleSheet?r.parentStyleSheet.href:null;return ye(r.cssText,a,t)}))).join(`
|
|
86
|
-
`)}async function on(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Ce(e,t);if(n){const o=document.createElement("style"),i=document.createTextNode(n);o.appendChild(i),e.firstChild?e.insertBefore(o,e.firstChild):e.appendChild(o)}}async function Ae(e,t={}){const{width:n,height:o}=H(e,t),i=await F(e,t,!0);return await on(i,t),await we(i,t),Qt(i,t),await Et(i,n,o)}async function M(e,t={}){const{width:n,height:o}=H(e,t),i=await Ae(e,t),r=await D(i),a=document.createElement("canvas"),s=a.getContext("2d"),c=t.pixelRatio||yt(),d=t.canvasWidth||n,u=t.canvasHeight||o;return a.width=d*c,a.height=u*c,t.skipAutoScale||wt(a),a.style.width=`${d}`,a.style.height=`${u}`,t.backgroundColor&&(s.fillStyle=t.backgroundColor,s.fillRect(0,0,a.width,a.height)),s.drawImage(r,0,0,a.width,a.height),a}async function rn(e,t={}){const{width:n,height:o}=H(e,t);return(await M(e,t)).getContext("2d").getImageData(0,0,n,o).data}async function an(e,t={}){return(await M(e,t)).toDataURL()}async function sn(e,t={}){return(await M(e,t)).toDataURL("image/jpeg",t.quality||1)}async function cn(e,t={}){const n=await M(e,t);return await xt(n)}async function ln(e,t={}){return Ce(e,t)}const dn=Object.freeze(Object.defineProperty({__proto__:null,getFontEmbedCSS:ln,toBlob:cn,toCanvas:M,toJpeg:sn,toPixelData:rn,toPng:an,toSvg:Ae},Symbol.toStringTag,{value:"Module"}));C.LaunchKitBeacon=se,C.defineBeacon=ce,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
|
105
|
+
/* … truncated, original was ${e.length} chars */`}function At(e){const t=getComputedStyle(e),n={};for(const o of Ct){const r=t.getPropertyValue(o);r&&r!=="normal"&&r!=="none"&&r!=="auto"&&r!=="0px"&&(n[o]=r.trim().slice(0,kt))}return n}function Lt(e){return Array.from(e.classList).slice(0,Et).map(n=>n.length>fe?n.slice(0,fe):n)}function Tt(e){const t=e.getBoundingClientRect(),n=bt(e),o=e.id||null;return{selector:n.length>ue?n.slice(0,ue):n,tagName:e.tagName.toLowerCase(),id:o&&o.length>he?o.slice(0,he):o,classList:Lt(e),outerHTML:pe(e.outerHTML,xt),...e.parentElement?{parentOuterHTML:pe(e.parentElement.outerHTML,St)}:{},computedStyles:At(e),boundingRect:{x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.width),h:Math.round(t.height)},...de(e)?{framework:de(e)}:{}}}function me(){var n,o;const e=navigator;return e.userAgentData?{brand:((n=e.userAgentData.brands.find(r=>!/Not[.\-]?A.?Brand/i.test(r.brand)))==null?void 0:n.brand)??((o=e.userAgentData.brands[0])==null?void 0:o.brand)??"unknown",mobile:e.userAgentData.mobile,platform:e.userAgentData.platform}:void 0}function be(){if(window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark";if(window.matchMedia("(prefers-color-scheme: light)").matches)return"light"}function ge(){return{url:window.location.href,...document.referrer?{referrer:document.referrer}:{},userAgent:navigator.userAgent,...me()?{uaData:me()}:{},viewport:{w:window.innerWidth,h:window.innerHeight,dpr:window.devicePixelRatio||1},screen:{w:window.screen.width,h:window.screen.height},timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,locale:navigator.language,...be()?{theme:be()}:{},capturedAt:new Date().toISOString()}}let q=null;async function Rt(){return q||(q=await Promise.resolve().then(()=>vo)),q}const U="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII=";function ye(e,t){if(!e||e.startsWith("data:")||e.startsWith("blob:")||e.startsWith("/")||e.startsWith("#"))return!0;try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return t==="anonymous"||t==="use-credentials"}function $t(){const e=[],t=[];return document.querySelectorAll("img").forEach(n=>{ye(n.src,n.crossOrigin)||(e.push({el:n,src:n.src}),n.src=U)}),document.querySelectorAll("image").forEach(n=>{const o=n,r=o.getAttribute("href"),s=o.getAttributeNS("http://www.w3.org/1999/xlink","href"),i=r||s||"";i&&!ye(i)&&(t.push({el:o,href:r,xlink:s}),r!==null&&o.setAttribute("href",U),s!==null&&o.setAttributeNS("http://www.w3.org/1999/xlink","href",U))}),()=>{for(const{el:n,src:o}of e)n.src=o;for(const{el:n,href:o,xlink:r}of t)o!==null&&n.setAttribute("href",o),r!==null&&n.setAttributeNS("http://www.w3.org/1999/xlink","href",r)}}async function we(e={}){const{quality:t=.7,pixelRatio:n=Math.min(window.devicePixelRatio||1,2),excludeShadowRoot:o}=e,r=await Rt(),s=o?a=>{let c=a;for(;c;){if(c===o.host||c instanceof Element&&c.classList.contains("beacon-no-capture"))return!1;c=c.parentNode}return!0}:void 0,i=$t();try{return await r.toJpeg(document.documentElement,{quality:t,pixelRatio:n,cacheBust:!0,...s?{filter:s}:{},imagePlaceholder:U,width:window.innerWidth,height:window.innerHeight,style:{transform:"none"}})}finally{i()}}const It=14,Mt="#ffffff",Pt="#ffffff",_t=3,Dt="#0ea5e9";async function ve(e,t,n,o,r=Dt){const s=r,i=r,a=await Ot(e),c=document.createElement("canvas");c.width=a.naturalWidth,c.height=a.naturalHeight;const l=c.getContext("2d");if(!l)throw new Error("Could not get 2D canvas context");l.drawImage(a,0,0);const d=c.width/n.w,u=c.height/n.h;for(const g of t){const w=Ft(g,o);if(!w)continue;const v=w.x*d,E=w.y*u,S=w.w*d,h=w.h*u;l.lineWidth=_t,l.strokeStyle=i,l.strokeRect(v,E,S,h);const p=v+S,f=E;l.beginPath(),l.fillStyle=s,l.arc(p,f,It,0,Math.PI*2),l.fill(),l.lineWidth=3,l.strokeStyle=Mt,l.stroke(),l.fillStyle=Pt,l.font="bold 16px system-ui, -apple-system, sans-serif",l.textAlign="center",l.textBaseline="middle",l.fillText(String(g.number),p,f+1)}return c.toDataURL("image/jpeg",.85)}function Ft(e,t){const n=t==null?void 0:t.get(e);if(n&&document.contains(n)){const o=n.getBoundingClientRect();if(o.width>0||o.height>0)return{x:o.left,y:o.top,w:o.width,h:o.height}}if(e.selector)try{const o=document.querySelector(e.selector);if(o){const r=o.getBoundingClientRect();if(r.width>0||r.height>0)return{x:r.left,y:r.top,w:r.width,h:r.height}}}catch{}return e.boundingRect}function Ot(e){return new Promise((t,n)=>{const o=new Image;o.onload=()=>t(o),o.onerror=r=>n(r),o.src=e})}const Ut=30,W=500,xe=2e3,Bt=500,jt=5e3,Nt=/launch-kit-beacon|beacon-client|beacon\.(?:es|umd|mjs)/i,B=[],V=new Map,K=new Set;let Se=!1;function P(e,t){if(e)return e.length>t?e.slice(0,t):e}function Ht(e,t){const n=(t==null?void 0:t.split(`
|
|
106
|
+
`).slice(0,3).join("|"))??"";return`${e}::${n}`}function zt(e){return!!e&&Nt.test(e)}function qt(e){try{return JSON.stringify(e).slice(0,W)}catch{return String(e)}}function Ee(e){if(zt(e.stack)||e.kind==="unhandledrejection"&&/AbortError/i.test(e.message))return;const t=Ht(e.message,e.stack),n=V.get(t);if(n!==void 0&&e.ts-n<jt){V.set(t,e.ts);return}V.set(t,e.ts),B.push(e),B.length>Ut&&B.shift();for(const o of K)try{o()}catch{}}function Wt(){Se||typeof window>"u"||(Se=!0,window.addEventListener("error",e=>{try{const t=e.error instanceof Error?e.error.message:void 0,n=e.error instanceof Error?e.error.stack:void 0;Ee({ts:Date.now(),kind:"error",message:P(e.message||t||"Unknown error",W)??"Unknown error",...n?{stack:P(n,xe)}:{},...e.filename?{source:P(e.filename,Bt)}:{},...Number.isFinite(e.lineno)?{line:e.lineno}:{},...Number.isFinite(e.colno)?{col:e.colno}:{}})}catch{}}),window.addEventListener("unhandledrejection",e=>{try{const t=e.reason,n=t instanceof Error?t.message:typeof t=="string"?t:qt(t),o=t instanceof Error?t.stack:void 0;Ee({ts:Date.now(),kind:"unhandledrejection",message:P(n||"Unknown rejection",W)??"Unknown rejection",...o?{stack:P(o,xe)}:{}})}catch{}}))}function _(){return B.slice()}function ke(e){return K.add(e),()=>{K.delete(e)}}async function Vt(e,t,n){const o=await fetch(e,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...n??{}},body:JSON.stringify(t)});let r=null;if((o.headers.get("Content-Type")??"").includes("application/json"))try{r=await o.json()}catch{r=null}else try{r=await o.text()}catch{r=null}return{ok:o.ok,status:o.status,body:r}}const Kt=["endpoint","position","theme","severities"],Ce="launch-kit-beacon-portal-styles";function Xt(e){if(document.getElementById(Ce))return;const t=document.createElement("style");t.id=Ce,t.textContent=e,document.head.appendChild(t)}const Gt=["--beacon-accent","--beacon-bg","--beacon-fg","--beacon-muted","--beacon-border","--beacon-radius","--beacon-shadow","--beacon-z-index","--beacon-bug","--beacon-idea","--beacon-ux","--beacon-a11y"],Ae="#0ea5e9";class Le extends HTMLElement{constructor(){super(...arguments),this._config=null,this.pins=[],this.pinElements=new WeakMap,this.description="",this.severity="bug",this.submitSucceeded=!1}static get observedAttributes(){return Kt}set config(t){this._config=t}get config(){if(this._config)return this._config;const t=this.getAttribute("endpoint");return t?{endpoint:t}:null}connectedCallback(){if(!this.shadow){this.shadow=this.attachShadow({mode:"open"});const t=document.createElement("style");t.textContent=R,this.shadow.appendChild(t),this.slotEl=document.createElement("slot"),this.slotEl.name="trigger",this.shadow.appendChild(this.slotEl),this.trigger=rt(),this.shadow.appendChild(this.trigger),this.trigger.addEventListener("click",()=>this.open()),this.slotEl.addEventListener("slotchange",()=>{const n=this.slotEl.assignedElements();n.length>0&&(this.trigger&&(this.trigger.style.display="none"),n.forEach(o=>o.addEventListener("click",()=>this.open())))}),this.drawer=new it(this.parseSeverities(),{onClose:()=>this.close(),onAnnotate:()=>this.startAnnotate(),onSubmit:()=>this.handleSubmit(),onPinNoteChange:(n,o)=>this.updatePinNote(n,o),onPinDelete:n=>this.deletePin(n),onDescriptionChange:n=>{this.description=n},onSeverityChange:n=>{this.severity=n}}),Xt(R),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=ke(()=>{var n;(n=this.drawer)==null||n.setEvents(_())})}this.hasAttribute("position")||this.setAttribute("position","bottom-right"),this.hasAttribute("theme")||this.setAttribute("theme","auto")}attributeChangedCallback(t,n,o){t==="severities"&&this.drawer&&console.warn("[launch-kit-beacon] severities attribute changed after mount; not yet hot-reloaded."),t==="theme"&&this.drawer&&n!==o&&(this.drawer.root.classList.remove(`beacon-theme-${n??"auto"}`),this.drawer.root.classList.add(`beacon-theme-${o??"auto"}`))}open(){var t;if(this.drawer){if(this.getAttribute("position")==="hidden"){const n=(t=this.slotEl)==null?void 0:t.assignedElements()[0];n&&Jt(this.drawer.root,n)}this.submitSucceeded=!1,this.drawer.setEvents(_()),this.syncCustomProperties(),this.installClickBlocker(),this.drawer.open()}}close(){this.drawer&&(!this.submitSucceeded&&this.hasUnsavedData()&&!window.confirm("You have unsaved feedback. Close and discard it?")||this.forceClose())}disconnectedCallback(){var t;this.uninstallClickBlocker(),(t=this.eventsUnsubscribe)==null||t.call(this),this.eventsUnsubscribe=void 0,this.drawer&&this.drawer.root.parentNode&&this.drawer.root.parentNode.removeChild(this.drawer.root)}async openWithPicker(){this.open(),setTimeout(()=>this.startAnnotate(),0)}async startAnnotate(){if(!this.drawer)return;this.drawer.minimize();const t=this.getAccentColor(),n=lt({accent:t});for(const o of this.pins){const r=this.pinElements.get(o);r&&n.addPin(o.number,{target:r,selector:o.selector,fallbackRect:o.boundingRect})}try{let o=!0;for(;o;){const s=await ht({shadowRoot:this.shadow,accent:t}).promise;if(!s)break;const i=s.getBoundingClientRect(),a=await at({shadowRoot:this.shadow,anchor:{x:i.left,y:i.bottom},pinNumber:this.pins.length+1});if(a.cancelled==="all")break;if(a.cancelled==="pin")continue;const c=Tt(s),l={number:this.pins.length+1,...c,...a.note?{note:a.note}:{}};this.pins.push(l),this.pinElements.set(l,s),n.addPin(l.number,{target:s,selector:c.selector,fallbackRect:c.boundingRect})}if(this.pins.length>0){n.setLoading("Capturing screenshot…"),await new Promise(r=>requestAnimationFrame(()=>r()));try{const r=ge(),s=await we({excludeShadowRoot:this.shadow}),i=await ve(s,this.pins,r.viewport,this.pinElements,t);this.drawer.setPins(this.pins,i)}catch(r){const s=r instanceof Error?r.message:String(r);console.error("[launch-kit-beacon] screenshot capture failed:",r),this.drawer.setPins(this.pins),this.drawer.setStatus(`Screenshot capture failed: ${s}`,"error")}}}finally{n.destroy()}this.drawer.open()}updatePinNote(t,n){const o=this.pins.find(r=>r.number===t);o&&(n.trim()?o.note=n:delete o.note)}deletePin(t){var n,o;this.pins=this.pins.filter(r=>r.number!==t),this.pins.forEach((r,s)=>{r.number=s+1}),(n=this.drawer)==null||n.setAnnotatedScreenshot(void 0),(o=this.drawer)==null||o.setPins(this.pins)}async handleSubmit(){if(!this.drawer)return;const t=this.config;if(!(t!=null&&t.endpoint)){this.drawer.setStatus("Missing endpoint configuration","error");return}const n=this.drawer.getDescription().trim(),o=this.drawer.getSeverity();if(!n){this.drawer.setStatus("Description is required","error");return}this.drawer.setSubmitting(!0);let r=this.drawer.getAnnotatedScreenshot();const s=!r&&this.pins.length>0;this.drawer.setStatus(s?"Capturing screenshot…":"Sending…"),await new Promise(u=>requestAnimationFrame(()=>u()));const i=ge();if(s)try{const u=await we({excludeShadowRoot:this.shadow});r=await ve(u,this.pins,i.viewport,this.pinElements,this.getAccentColor())}catch(u){console.error("[launch-kit-beacon] screenshot capture failed at submit:",u)}const a=_(),c={description:n,severity:o,...r?{screenshot:{dataUrl:r,mime:"image/jpeg"}}:{},metadata:i,pins:this.pins,...a.length>0?{events:a}:{},...this.resolveContext()?{context:this.resolveContext()}:{}},l=new CustomEvent("beacon-before-submit",{detail:{payload:c},cancelable:!0,bubbles:!0,composed:!0});if(!this.dispatchEvent(l)){this.drawer.setSubmitting(!1),this.drawer.setStatus("Submission cancelled","error");return}this.drawer.setStatus("Sending…");try{const u=this.resolveHeaders(),g=await Vt(t.endpoint,c,u);this.drawer.setSubmitting(!1),g.ok?(this.submitSucceeded=!0,this.drawer.setStatus("Sent — thanks!","success"),this.dispatchEvent(new CustomEvent("beacon-after-submit",{detail:{response:g},bubbles:!0,composed:!0})),setTimeout(()=>{this.forceClose()},1500)):this.drawer.setStatus(`Failed: ${g.status}`,"error")}catch(u){this.drawer.setSubmitting(!1);const g=u instanceof Error?u.message:"Network error";this.drawer.setStatus(`Failed: ${g}`,"error")}}getAccentColor(){return typeof window>"u"?Ae:getComputedStyle(this).getPropertyValue("--beacon-accent").trim()||Ae}syncCustomProperties(){if(!this.drawer)return;const t=getComputedStyle(this);for(const n of Gt){const o=t.getPropertyValue(n).trim();o&&this.drawer.root.style.setProperty(n,o)}}hasUnsavedData(){var n;return this.pins.length>0?!0:(((n=this.drawer)==null?void 0:n.getDescription())??"").trim().length>0}resetState(){var t;this.pins=[],this.description="",this.severity="bug",this.pinElements=new WeakMap,(t=this.drawer)==null||t.reset()}forceClose(){var t;this.uninstallClickBlocker(),this.resetState(),this.submitSucceeded=!1,(t=this.drawer)==null||t.close()}installClickBlocker(){this.documentClickBlocker||(this.documentClickBlocker=t=>{const n=t.composedPath();if(!n.includes(this.shadow.host)){for(const o of n)if(o instanceof Element&&o.classList.contains("beacon-no-capture"))return;t.preventDefault(),t.stopPropagation()}},document.addEventListener("click",this.documentClickBlocker,!0))}uninstallClickBlocker(){this.documentClickBlocker&&(document.removeEventListener("click",this.documentClickBlocker,!0),this.documentClickBlocker=void 0)}resolveHeaders(){var n;const t=(n=this.config)==null?void 0:n.headers;if(t)return typeof t=="function"?t():t}resolveContext(){var n;const t=(n=this.config)==null?void 0:n.context;if(t)return typeof t=="function"?t():t}parseSeverities(){const t=this.getAttribute("severities");return t?t.split(",").map(n=>n.trim()).filter(Boolean):["bug","idea","ux","a11y"]}}function Te(e="launch-kit-beacon"){typeof window>"u"||customElements.get(e)||customElements.define(e,Le)}const Re=380,k=8,Yt=520;function Jt(e,t){const n=t.getBoundingClientRect(),o=window.innerWidth,r=window.innerHeight;let s=Math.max(k,o-n.right);o-s-Re<k&&(s=Math.max(k,o-Re-k));const a=r-n.bottom-k,c=n.top-k;e.style.left="auto",e.style.right=`${s}px`,a>=Yt||a>=c?(e.style.top=`${n.bottom+k}px`,e.style.bottom="auto"):(e.style.top="auto",e.style.bottom=`${r-n.top+k}px`)}const Qt=1024,Zt=5;function en(e,t){return e.length>t?e.slice(0,t):e}function $e(e){if(e.id)return`#${CSS.escape(e.id)}`;const t=[];let n=e;for(let o=0;o<3&&n;o++){const r=n.tagName.toLowerCase(),s=n.id?`#${CSS.escape(n.id)}`:"",i=n.classList.length>0?"."+Array.from(n.classList).slice(0,3).map(CSS.escape).join("."):"";if(t.unshift(`${r}${s}${i}`),s)break;n=n.parentElement}return t.join(" > ")}function Ie(e){return{tag:e.tagName.toLowerCase(),id:e.id||null,classes:Array.from(e.classList).slice(0,10),role:e.getAttribute("role"),selector:$e(e)}}function tn(e,t){const n=[],o=document.querySelectorAll("body *");for(const r of Array.from(o)){const s=getComputedStyle(r);if(s.position!=="fixed"&&s.position!=="sticky")continue;const i=r.getBoundingClientRect();if(e<i.left||e>i.right||t<i.top||t>i.bottom)continue;const a=parseInt(s.zIndex,10);!Number.isFinite(a)&&s.zIndex!=="auto"||n.push({tag:r.tagName.toLowerCase(),zIndex:Number.isFinite(a)?a:0,pointerEvents:s.pointerEvents,classes:Array.from(r.classList).slice(0,5).join(" ")})}return n.sort((r,s)=>s.zIndex-r.zIndex).slice(0,Zt)}function nn(e){const t=r=>s=>{const i=s,a=i.target;if(!(a instanceof Element))return;const c=i.clientX,l=i.clientY,d=document.elementFromPoint(c,l),u=d===a||(d?a.contains(d)||d.contains(a):!1),g=document.querySelectorAll('[role="dialog"][data-state="open"]').length,w=getComputedStyle(document.body).pointerEvents,v=tn(c,l);e.emitClick({kind:r,target:Ie(a),hitMatchesTarget:u,...!u&&d instanceof Element?{hitTarget:Ie(d)}:{},coords:{x:c,y:l},openDialogs:g,bodyPointerEvents:w,...v.length>0?{overlaysAtPoint:v}:{}})},n=t("click"),o=t("mousedown");return document.addEventListener("click",n,{capture:!0,passive:!0}),document.addEventListener("mousedown",o,{capture:!0,passive:!0}),()=>{document.removeEventListener("click",n,{capture:!0}),document.removeEventListener("mousedown",o,{capture:!0})}}function on(e){const t=history.pushState,n=history.replaceState;let o=window.location.href;const r=a=>{const c=window.location.href;if(c===o)return;const l=o;o=c,e.emitRoute({kind:"route",from:l,to:c,via:a})};history.pushState=function(...c){const l=t.apply(this,c);return r("pushState"),l},history.replaceState=function(...c){const l=n.apply(this,c);return r("replaceState"),l};const s=()=>r("popstate"),i=()=>r("hashchange");return window.addEventListener("popstate",s),window.addEventListener("hashchange",i),()=>{history.pushState=t,history.replaceState=n,window.removeEventListener("popstate",s),window.removeEventListener("hashchange",i)}}function rn(e){const t=new WeakSet,n=(r,s)=>{const i=$e(r);e.emitDialog({kind:"dialog",action:s,selector:i,state:r.getAttribute("data-state"),...s==="mount"?{outerHTML:en(r.outerHTML,Qt)}:{}})};for(const r of Array.from(document.querySelectorAll('[role="dialog"]')))t.add(r);const o=new MutationObserver(r=>{var s,i,a,c;for(const l of r){for(const d of Array.from(l.addedNodes)){if(!(d instanceof Element))continue;const u=(s=d.matches)!=null&&s.call(d,'[role="dialog"]')?[d]:Array.from(((i=d.querySelectorAll)==null?void 0:i.call(d,'[role="dialog"]'))??[]);for(const g of u)t.has(g)||(t.add(g),n(g,"mount"))}for(const d of Array.from(l.removedNodes)){if(!(d instanceof Element))continue;const u=(a=d.matches)!=null&&a.call(d,'[role="dialog"]')?[d]:Array.from(((c=d.querySelectorAll)==null?void 0:c.call(d,'[role="dialog"]'))??[]);for(const g of u)t.has(g)&&(t.delete(g),n(g,"unmount"))}l.type==="attributes"&&l.attributeName==="data-state"&&l.target instanceof Element&&l.target.getAttribute("role")==="dialog"&&n(l.target,"state")}});return o.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-state"]}),()=>o.disconnect()}function sn(e){const t=nn(e),n=on(e),o=rn(e);return{uninstall(){t(),n(),o()}}}const X=1e3;function G(e,t){return e.length>t?e.slice(0,t):e}function an(e){const t=window.fetch;if(typeof t!="function")return()=>{};const n=async(o,r)=>{const s=performance.now(),i=((r==null?void 0:r.method)??(o instanceof Request?o.method:"GET")).toUpperCase(),a=typeof o=="string"?o:o instanceof URL?o.toString():o.url;try{const c=await t.call(window,o,r),l=Math.round(performance.now()-s),d=c.status>=400;return(d||e.verbose)&&e.emit({kind:"fetch",url:G(a,X),method:i,status:c.status,durationMs:l,failed:d}),c}catch(c){const l=Math.round(performance.now()-s);throw e.emit({kind:"fetch",url:G(a,X),method:i,status:0,durationMs:l,failed:!0,error:c instanceof Error?c.message:String(c)}),c}};return n.__lsBeaconWrapped=!0,window.fetch=n,()=>{window.fetch.__lsBeaconWrapped&&(window.fetch=t)}}function cn(e){const t=XMLHttpRequest.prototype,n=t.open,o=t.send,r=new WeakMap;return t.open=function(i,a,...c){return r.set(this,{method:i.toUpperCase(),url:typeof a=="string"?a:a.toString(),start:0}),n.call(this,i,a,...c)},t.send=function(i){const a=r.get(this);a&&(a.start=performance.now());const c=()=>{this.removeEventListener("loadend",c);const l=r.get(this);if(!l)return;const d=Math.round(performance.now()-l.start),u=this.status===0||this.status>=400;(u||e.verbose)&&e.emit({kind:"xhr",url:G(l.url,X),method:l.method,status:this.status,durationMs:d,failed:u}),r.delete(this)};return this.addEventListener("loadend",c),o.call(this,i)},()=>{t.open=n,t.send=o}}function ln(e){const t=an(e),n=cn(e);return{uninstall(){t(),n()}}}const dn=1e3,Me=50,un=500;class hn{constructor(t){this.buffer=[],this.inflight=!1,this.timer=null,this.destroyed=!1,this.handleVisibilityChange=()=>{document.visibilityState==="hidden"&&this.flushSync()},this.url=t.url,this.sessionId=t.sessionId,this.onError=t.onError,this.timer=setInterval(()=>this.flush(),dn),this.pagehideHandler=()=>this.flushSync(),window.addEventListener("pagehide",this.pagehideHandler),document.addEventListener("visibilitychange",this.handleVisibilityChange)}enqueue(t){this.destroyed||(this.buffer.push(t),this.buffer.length>=un&&this.buffer.shift(),this.buffer.length>=Me&&this.flush())}async flush(){var o,r;if(this.destroyed||this.inflight||this.buffer.length===0)return;const t=this.buffer.splice(0,Me),n=this.makeBatch(t);this.inflight=!0;try{const s=await fetch(this.url,{method:"POST",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),keepalive:!0});s.ok||(o=this.onError)==null||o.call(this,new Error(`monitor flush: HTTP ${s.status}`))}catch(s){(r=this.onError)==null||r.call(this,s instanceof Error?s:new Error(String(s)))}finally{this.inflight=!1}}flushSync(){if(this.destroyed||this.buffer.length===0)return;if(!navigator.sendBeacon){this.flush();return}const t=this.buffer.splice(0),n=this.makeBatch(t),o=new Blob([JSON.stringify(n)],{type:"application/json"});try{navigator.sendBeacon(this.url,o)}catch{}}destroy(){this.destroyed||(this.destroyed=!0,this.timer&&clearInterval(this.timer),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),document.removeEventListener("visibilitychange",this.handleVisibilityChange),this.flushSync())}makeBatch(t){return{sessionId:this.sessionId,events:t,meta:{url:window.location.href,userAgent:navigator.userAgent,viewport:{w:window.innerWidth,h:window.innerHeight,dpr:window.devicePixelRatio||1},v:1}}}}const Y="__lsBeaconMonitorUrl",J="__lsBeaconMonitorSession",Q="__lsBeaconMonitorVerbose",Z="__lsBeaconMonitorDeadline",Pe=30*6e4,_e=4096;let b=null;const fn=new Set;let D=0;function De(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10)}function pn(e){const t=new WeakSet,n=o=>{if(o===null||typeof o!="object")return typeof o=="string"&&o.length>_e?o.slice(0,_e):o;if(t.has(o))return"[cyclic]";if(t.add(o),Array.isArray(o))return o.map(n);const r={};for(const s of Object.keys(o).slice(0,50))try{r[s]=n(o[s])}catch{r[s]="[unreadable]"}return r};try{return n(e)}catch{return"[unserialisable]"}}function Fe(){for(const e of fn)try{e(b!==null,(b==null?void 0:b.url)??null)}catch{}}function mn(e){return b?(b.seq+=1,{...e,ts:Date.now(),sessionId:b.sessionId,seq:b.seq}):{...e,ts:Date.now(),sessionId:"",seq:0}}function F(e){if(!b)return;const t=mn(e);b.transport.enqueue(t)}function bn(){if(b)try{sessionStorage.setItem(Y,b.url),sessionStorage.setItem(J,b.sessionId),sessionStorage.setItem(Q,b.verbose?"1":"0"),sessionStorage.setItem(Z,String(b.deadlineMs))}catch{}}function Oe(){try{sessionStorage.removeItem(Y),sessionStorage.removeItem(J),sessionStorage.removeItem(Q),sessionStorage.removeItem(Z)}catch{}}function gn(){try{const e=sessionStorage.getItem(Y);if(!e)return null;const t=sessionStorage.getItem(J)??De(),n=sessionStorage.getItem(Q)==="1",o=sessionStorage.getItem(Z),r=o?Number(o):Date.now()+Pe;return Number.isFinite(r)&&r<=Date.now()?(Oe(),null):{url:e,sessionId:t,verbose:n,deadlineMs:r}}catch{return null}}function Ue(e){if(b&&ee(),!e.url)return;const t=e.maxSessionMs??Pe,n=Date.now()+t,o=De(),r=!!e.verbose,s=new hn({url:e.url,sessionId:o,onError:u=>{console.warn("[launch-kit-beacon] monitor transport error:",u.message)}}),i=_();D=i.length;for(const u of i)Be(u,s,o);const a=ke(()=>{const u=_();for(;D<u.length;){const g=u[D];g&&Be(g,s,o),D+=1}}),c=ln({emit:u=>F(u),verbose:r}),l=sn({emitClick:u=>F(u),emitRoute:u=>F(u),emitDialog:u=>F(u)}),d=setTimeout(()=>{console.info("[launch-kit-beacon] monitor session expired (max duration reached)"),ee()},Math.max(0,n-Date.now()));b={url:e.url,sessionId:o,verbose:r,deadlineMs:n,seq:0,transport:s,uninstallNetwork:c.uninstall,uninstallDom:l.uninstall,uninstallErrors:a,deadlineTimer:d},bn(),Fe()}function Be(e,t,n){b&&(b.seq+=1,t.enqueue({kind:e.kind,ts:e.ts,sessionId:n,seq:b.seq,message:e.message,...e.stack?{stack:e.stack}:{},...e.source?{source:e.source}:{},...typeof e.line=="number"?{line:e.line}:{},...typeof e.col=="number"?{col:e.col}:{}}))}function ee(){b&&(clearTimeout(b.deadlineTimer),b.uninstallNetwork(),b.uninstallDom(),b.uninstallErrors(),b.transport.destroy(),b=null,D=0,Oe(),Fe())}function yn(e,t){b&&F({kind:"probe",label:e.slice(0,200),data:pn(t)})}function wn(){return b!==null}function vn(){return(b==null?void 0:b.url)??null}const xn={start:Ue,stop:ee,probe:yn,isActive:wn,currentUrl:vn};function Sn(){if(b)return;const e=gn();e&&Ue({url:e.url,verbose:e.verbose,maxSessionMs:Math.max(6e4,e.deadlineMs-Date.now())})}function En(){if(typeof window>"u")return;const e=window;e.__lsBeacon||(e.__lsBeacon=xn)}Te(),Wt(),En(),Sn();function kn(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),o=n.createElement("base"),r=n.createElement("a");return n.head.appendChild(o),n.body.appendChild(r),t&&(o.href=t),r.href=e,r.href}const Cn=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function C(e){const t=[];for(let n=0,o=e.length;n<o;n++)t.push(e[n]);return t}let $=null;function je(e={}){return $||(e.includeStyleProperties?($=e.includeStyleProperties,$):($=C(window.getComputedStyle(document.documentElement)),$))}function j(e,t){const o=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return o?parseFloat(o.replace("px","")):0}function An(e){const t=j(e,"border-left-width"),n=j(e,"border-right-width");return e.clientWidth+t+n}function Ln(e){const t=j(e,"border-top-width"),n=j(e,"border-bottom-width");return e.clientHeight+t+n}function te(e,t={}){const n=t.width||An(e),o=t.height||Ln(e);return{width:n,height:o}}function Tn(){let e,t;try{t=process}catch{}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const x=16384;function Rn(e){(e.width>x||e.height>x)&&(e.width>x&&e.height>x?e.width>e.height?(e.height*=x/e.width,e.width=x):(e.width*=x/e.height,e.height=x):e.width>x?(e.height*=x/e.width,e.width=x):(e.width*=x/e.height,e.height=x))}function $n(e,t={}){return e.toBlob?new Promise(n=>{e.toBlob(n,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(n=>{const o=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),r=o.length,s=new Uint8Array(r);for(let i=0;i<r;i+=1)s[i]=o.charCodeAt(i);n(new Blob([s],{type:t.type?t.type:"image/png"}))})}function N(e){return new Promise((t,n)=>{const o=new Image;o.onload=()=>{o.decode().then(()=>{requestAnimationFrame(()=>t(o))})},o.onerror=n,o.crossOrigin="anonymous",o.decoding="async",o.src=e})}async function In(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Mn(e,t,n){const o="http://www.w3.org/2000/svg",r=document.createElementNS(o,"svg"),s=document.createElementNS(o,"foreignObject");return r.setAttribute("width",`${t}`),r.setAttribute("height",`${n}`),r.setAttribute("viewBox",`0 0 ${t} ${n}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),r.appendChild(s),s.appendChild(e),In(r)}const y=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||y(n,t)};function Pn(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function _n(e,t){return je(t).map(n=>{const o=e.getPropertyValue(n),r=e.getPropertyPriority(n);return`${n}: ${o}${r?" !important":""};`}).join(" ")}function Dn(e,t,n,o){const r=`.${e}:${t}`,s=n.cssText?Pn(n):_n(n,o);return document.createTextNode(`${r}{${s}}`)}function Ne(e,t,n,o){const r=window.getComputedStyle(e,n),s=r.getPropertyValue("content");if(s===""||s==="none")return;const i=Cn();try{t.className=`${t.className} ${i}`}catch{return}const a=document.createElement("style");a.appendChild(Dn(i,n,r,o)),t.appendChild(a)}function Fn(e,t,n){Ne(e,t,":before",n),Ne(e,t,":after",n)}const He="application/font-woff",ze="image/jpeg",On={woff:He,woff2:He,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ze,jpeg:ze,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Un(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function ne(e){const t=Un(e).toLowerCase();return On[t]||""}function Bn(e){return e.split(/,/)[1]}function oe(e){return e.search(/^(data:)/)!==-1}function jn(e,t){return`data:${t};base64,${e}`}async function qe(e,t,n){const o=await fetch(e,t);if(o.status===404)throw new Error(`Resource "${o.url}" not found`);const r=await o.blob();return new Promise((s,i)=>{const a=new FileReader;a.onerror=i,a.onloadend=()=>{try{s(n({res:o,result:a.result}))}catch(c){i(c)}},a.readAsDataURL(r)})}const re={};function Nn(e,t,n){let o=e.replace(/\?.*/,"");return n&&(o=e),/ttf|otf|eot|woff2?/i.test(o)&&(o=o.replace(/.*\//,"")),t?`[${t}]${o}`:o}async function se(e,t,n){const o=Nn(e,t,n.includeQueryParams);if(re[o]!=null)return re[o];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let r;try{const s=await qe(e,n.fetchRequestInit,({res:i,result:a})=>(t||(t=i.headers.get("Content-Type")||""),Bn(a)));r=jn(s,t)}catch(s){r=n.imagePlaceholder||"";let i=`Failed to fetch resource: ${e}`;s&&(i=typeof s=="string"?s:s.message),i&&console.warn(i)}return re[o]=r,r}async function Hn(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):N(t)}async function zn(e,t){if(e.currentSrc){const s=document.createElement("canvas"),i=s.getContext("2d");s.width=e.clientWidth,s.height=e.clientHeight,i==null||i.drawImage(e,0,0,s.width,s.height);const a=s.toDataURL();return N(a)}const n=e.poster,o=ne(n),r=await se(n,o,t);return N(r)}async function qn(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await H(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function Wn(e,t){return y(e,HTMLCanvasElement)?Hn(e):y(e,HTMLVideoElement)?zn(e,t):y(e,HTMLIFrameElement)?qn(e,t):e.cloneNode(We(e))}const Vn=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",We=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function Kn(e,t,n){var o,r;if(We(t))return t;let s=[];return Vn(e)&&e.assignedNodes?s=C(e.assignedNodes()):y(e,HTMLIFrameElement)&&(!((o=e.contentDocument)===null||o===void 0)&&o.body)?s=C(e.contentDocument.body.childNodes):s=C(((r=e.shadowRoot)!==null&&r!==void 0?r:e).childNodes),s.length===0||y(e,HTMLVideoElement)||await s.reduce((i,a)=>i.then(()=>H(a,n)).then(c=>{c&&t.appendChild(c)}),Promise.resolve()),t}function Xn(e,t,n){const o=t.style;if(!o)return;const r=window.getComputedStyle(e);r.cssText?(o.cssText=r.cssText,o.transformOrigin=r.transformOrigin):je(n).forEach(s=>{let i=r.getPropertyValue(s);s==="font-size"&&i.endsWith("px")&&(i=`${Math.floor(parseFloat(i.substring(0,i.length-2)))-.1}px`),y(e,HTMLIFrameElement)&&s==="display"&&i==="inline"&&(i="block"),s==="d"&&t.getAttribute("d")&&(i=`path(${t.getAttribute("d")})`),o.setProperty(s,i,r.getPropertyPriority(s))})}function Gn(e,t){y(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),y(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function Yn(e,t){if(y(e,HTMLSelectElement)){const n=t,o=Array.from(n.children).find(r=>e.value===r.getAttribute("value"));o&&o.setAttribute("selected","")}}function Jn(e,t,n){return y(t,Element)&&(Xn(e,t,n),Fn(e,t,n),Gn(e,t),Yn(e,t)),t}async function Qn(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const o={};for(let s=0;s<n.length;s++){const a=n[s].getAttribute("xlink:href");if(a){const c=e.querySelector(a),l=document.querySelector(a);!c&&l&&!o[a]&&(o[a]=await H(l,t,!0))}}const r=Object.values(o);if(r.length){const s="http://www.w3.org/1999/xhtml",i=document.createElementNS(s,"svg");i.setAttribute("xmlns",s),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";const a=document.createElementNS(s,"defs");i.appendChild(a);for(let c=0;c<r.length;c++)a.appendChild(r[c]);e.appendChild(i)}return e}async function H(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(o=>Wn(o,t)).then(o=>Kn(e,o,t)).then(o=>Jn(e,o,t)).then(o=>Qn(o,t))}const Ve=/url\((['"]?)([^'"]+?)\1\)/g,Zn=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,eo=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function to(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function no(e){const t=[];return e.replace(Ve,(n,o,r)=>(t.push(r),n)),t.filter(n=>!oe(n))}async function oo(e,t,n,o,r){try{const s=n?kn(t,n):t,i=ne(t);let a;return r||(a=await se(s,i,o)),e.replace(to(t),`$1${a}$3`)}catch{}return e}function ro(e,{preferredFontFormat:t}){return t?e.replace(eo,n=>{for(;;){const[o,,r]=Zn.exec(n)||[];if(!r)return"";if(r===t)return`src: ${o};`}}):e}function Ke(e){return e.search(Ve)!==-1}async function Xe(e,t,n){if(!Ke(e))return e;const o=ro(e,n);return no(o).reduce((s,i)=>s.then(a=>oo(a,i,t,n)),Promise.resolve(o))}async function I(e,t,n){var o;const r=(o=t.style)===null||o===void 0?void 0:o.getPropertyValue(e);if(r){const s=await Xe(r,null,n);return t.style.setProperty(e,s,t.style.getPropertyPriority(e)),!0}return!1}async function so(e,t){await I("background",e,t)||await I("background-image",e,t),await I("mask",e,t)||await I("-webkit-mask",e,t)||await I("mask-image",e,t)||await I("-webkit-mask-image",e,t)}async function io(e,t){const n=y(e,HTMLImageElement);if(!(n&&!oe(e.src))&&!(y(e,SVGImageElement)&&!oe(e.href.baseVal)))return;const o=n?e.src:e.href.baseVal,r=await se(o,ne(o),t);await new Promise((s,i)=>{e.onload=s,e.onerror=t.onImageErrorHandler?(...c)=>{try{s(t.onImageErrorHandler(...c))}catch(l){i(l)}}:i;const a=e;a.decode&&(a.decode=s),a.loading==="lazy"&&(a.loading="eager"),n?(e.srcset="",e.src=r):e.href.baseVal=r})}async function ao(e,t){const o=C(e.childNodes).map(r=>Ge(r,t));await Promise.all(o).then(()=>e)}async function Ge(e,t){y(e,Element)&&(await so(e,t),await io(e,t),await ao(e,t))}function co(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const o=t.style;return o!=null&&Object.keys(o).forEach(r=>{n[r]=o[r]}),e}const Ye={};async function Je(e){let t=Ye[e];if(t!=null)return t;const o=await(await fetch(e)).text();return t={url:e,cssText:o},Ye[e]=t,t}async function Qe(e,t){let n=e.cssText;const o=/url\(["']?([^"')]+)["']?\)/g,s=(n.match(/url\([^)]+\)/g)||[]).map(async i=>{let a=i.replace(o,"$1");return a.startsWith("https://")||(a=new URL(a,e.url).href),qe(a,t.fetchRequestInit,({result:c})=>(n=n.replace(i,`url(${c})`),[i,c]))});return Promise.all(s).then(()=>n)}function Ze(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let o=e.replace(n,"");const r=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const c=r.exec(o);if(c===null)break;t.push(c[0])}o=o.replace(r,"");const s=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(i,"gi");for(;;){let c=s.exec(o);if(c===null){if(c=a.exec(o),c===null)break;s.lastIndex=a.lastIndex}else a.lastIndex=s.lastIndex;t.push(c[0])}return t}async function lo(e,t){const n=[],o=[];return e.forEach(r=>{if("cssRules"in r)try{C(r.cssRules||[]).forEach((s,i)=>{if(s.type===CSSRule.IMPORT_RULE){let a=i+1;const c=s.href,l=Je(c).then(d=>Qe(d,t)).then(d=>Ze(d).forEach(u=>{try{r.insertRule(u,u.startsWith("@import")?a+=1:r.cssRules.length)}catch(g){console.error("Error inserting rule from remote css",{rule:u,error:g})}})).catch(d=>{console.error("Error loading remote css",d.toString())});o.push(l)}})}catch(s){const i=e.find(a=>a.href==null)||document.styleSheets[0];r.href!=null&&o.push(Je(r.href).then(a=>Qe(a,t)).then(a=>Ze(a).forEach(c=>{i.insertRule(c,i.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",s)}}),Promise.all(o).then(()=>(e.forEach(r=>{if("cssRules"in r)try{C(r.cssRules||[]).forEach(s=>{n.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${r.href}`,s)}}),n))}function uo(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Ke(t.style.getPropertyValue("src")))}async function ho(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=C(e.ownerDocument.styleSheets),o=await lo(n,t);return uo(o)}function et(e){return e.trim().replace(/["']/g,"")}function fo(e){const t=new Set;function n(o){(o.style.fontFamily||getComputedStyle(o).fontFamily).split(",").forEach(s=>{t.add(et(s))}),Array.from(o.children).forEach(s=>{s instanceof HTMLElement&&n(s)})}return n(e),t}async function tt(e,t){const n=await ho(e,t),o=fo(e);return(await Promise.all(n.filter(s=>o.has(et(s.style.fontFamily))).map(s=>{const i=s.parentStyleSheet?s.parentStyleSheet.href:null;return Xe(s.cssText,i,t)}))).join(`
|
|
107
|
+
`)}async function po(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await tt(e,t);if(n){const o=document.createElement("style"),r=document.createTextNode(n);o.appendChild(r),e.firstChild?e.insertBefore(o,e.firstChild):e.appendChild(o)}}async function nt(e,t={}){const{width:n,height:o}=te(e,t),r=await H(e,t,!0);return await po(r,t),await Ge(r,t),co(r,t),await Mn(r,n,o)}async function O(e,t={}){const{width:n,height:o}=te(e,t),r=await nt(e,t),s=await N(r),i=document.createElement("canvas"),a=i.getContext("2d"),c=t.pixelRatio||Tn(),l=t.canvasWidth||n,d=t.canvasHeight||o;return i.width=l*c,i.height=d*c,t.skipAutoScale||Rn(i),i.style.width=`${l}`,i.style.height=`${d}`,t.backgroundColor&&(a.fillStyle=t.backgroundColor,a.fillRect(0,0,i.width,i.height)),a.drawImage(s,0,0,i.width,i.height),i}async function mo(e,t={}){const{width:n,height:o}=te(e,t);return(await O(e,t)).getContext("2d").getImageData(0,0,n,o).data}async function bo(e,t={}){return(await O(e,t)).toDataURL()}async function go(e,t={}){return(await O(e,t)).toDataURL("image/jpeg",t.quality||1)}async function yo(e,t={}){const n=await O(e,t);return await $n(n)}async function wo(e,t={}){return tt(e,t)}const vo=Object.freeze(Object.defineProperty({__proto__:null,getFontEmbedCSS:wo,toBlob:yo,toCanvas:O,toJpeg:go,toPixelData:mo,toPng:bo,toSvg:nt},Symbol.toStringTag,{value:"Module"}));A.LaunchKitBeacon=Le,A.defineBeacon=Te,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
87
108
|
//# sourceMappingURL=beacon.umd.js.map
|