@hanzo/browser-extension 1.9.56 → 1.9.65

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.
Files changed (60) hide show
  1. package/README.md +11 -0
  2. package/chrome/background.js +527 -0
  3. package/chrome/content-script.js +550 -0
  4. package/{src → chrome}/manifest.json +2 -12
  5. package/chrome/newtab.js +230 -0
  6. package/chrome/onboarding.js +31 -0
  7. package/chrome/page.js +35 -0
  8. package/{src → chrome}/popup.html +8 -0
  9. package/chrome/popup.js +48 -0
  10. package/chrome/sidebar.js +291 -0
  11. package/firefox/ai-worker.js +571 -0
  12. package/firefox/background.js +235 -0
  13. package/firefox/callback.html +17 -0
  14. package/firefox/content-script.js +550 -0
  15. package/firefox/icon128.png +0 -0
  16. package/firefox/icon16.png +0 -0
  17. package/firefox/icon48.png +0 -0
  18. package/{src/manifest-firefox.json → firefox/manifest.json} +2 -3
  19. package/firefox/newtab.css +543 -0
  20. package/firefox/newtab.html +13 -0
  21. package/firefox/newtab.js +230 -0
  22. package/firefox/onboarding.css +78 -0
  23. package/firefox/onboarding.html +45 -0
  24. package/firefox/onboarding.js +31 -0
  25. package/firefox/page.js +35 -0
  26. package/firefox/popup.css +761 -0
  27. package/firefox/popup.html +413 -0
  28. package/firefox/popup.js +48 -0
  29. package/firefox/sidebar.css +1350 -0
  30. package/firefox/sidebar.html +388 -0
  31. package/firefox/sidebar.js +291 -0
  32. package/package.json +4 -53
  33. package/manifest.json +0 -34
  34. package/src/Chat.tsx +0 -164
  35. package/src/answer/AnswerEngine.tsx +0 -410
  36. package/src/answer/Mark.tsx +0 -14
  37. package/src/answer/Rail.tsx +0 -95
  38. package/src/answer/Stories.tsx +0 -27
  39. package/src/answer/Toolbar.tsx +0 -93
  40. package/src/answer/WidgetView.tsx +0 -136
  41. package/src/icon128.png +0 -0
  42. package/src/icon16.png +0 -0
  43. package/src/icon32.png +0 -0
  44. package/src/icon48.png +0 -0
  45. package/src/package.json +0 -41
  46. package/src/safari/SafariWebExtensionHandler.swift +0 -153
  47. package/src/shared/Prose.tsx +0 -29
  48. package/src/webgpu.d.ts +0 -131
  49. /package/{src → chrome}/ai-worker.js +0 -0
  50. /package/{src → chrome}/callback.html +0 -0
  51. /package/{images → chrome}/icon128.png +0 -0
  52. /package/{images → chrome}/icon16.png +0 -0
  53. /package/{images → chrome}/icon48.png +0 -0
  54. /package/{src → chrome}/newtab.css +0 -0
  55. /package/{src → chrome}/newtab.html +0 -0
  56. /package/{src → chrome}/onboarding.css +0 -0
  57. /package/{src → chrome}/onboarding.html +0 -0
  58. /package/{src → chrome}/popup.css +0 -0
  59. /package/{src → chrome}/sidebar.css +0 -0
  60. /package/{src → chrome}/sidebar.html +0 -0
@@ -0,0 +1,413 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Hanzo AI</title>
7
+ <link rel="stylesheet" href="popup.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <header>
12
+ <svg class="logo" viewBox="0 0 67 67" xmlns="http://www.w3.org/2000/svg">
13
+ <path d="M22.21 67V44.6369H0V67H22.21Z" fill="currentColor"/>
14
+ <path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z" fill="currentColor"/>
15
+ <path d="M22.21 0H0V22.3184H22.21V0Z" fill="currentColor"/>
16
+ <path d="M66.7198 0H44.5098V22.3184H66.7198V0Z" fill="currentColor"/>
17
+ <path d="M66.7198 67V44.6369H44.5098V67H66.7198Z" fill="currentColor"/>
18
+ </svg>
19
+ <h1>Hanzo AI</h1>
20
+ </header>
21
+
22
+ <!-- Login Section -->
23
+ <div id="login-section" class="section login-section">
24
+ <div class="login-card">
25
+ <svg class="login-logo" viewBox="0 0 67 67" xmlns="http://www.w3.org/2000/svg">
26
+ <path d="M22.21 67V44.6369H0V67H22.21Z" fill="currentColor"/>
27
+ <path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z" fill="currentColor"/>
28
+ <path d="M22.21 0H0V22.3184H22.21V0Z" fill="currentColor"/>
29
+ <path d="M66.7198 0H44.5098V22.3184H66.7198V0Z" fill="currentColor"/>
30
+ <path d="M66.7198 67V44.6369H44.5098V67H66.7198Z" fill="currentColor"/>
31
+ </svg>
32
+ <h2 class="login-headline">Sign in to Hanzo AI</h2>
33
+ <p class="login-sub">Chat with AI, use browser tools, and build with agents.</p>
34
+ <button id="login-btn" class="login-signin-btn">Sign in</button>
35
+ <button id="signup-btn-popup" class="login-create-btn">Create account</button>
36
+ <p class="login-note">
37
+ Browser tools work without sign-in. <a href="https://docs.hanzo.ai" target="_blank">Learn more</a>
38
+ </p>
39
+ </div>
40
+ </div>
41
+
42
+ <!-- Main Section (shown after login) -->
43
+ <div id="main-section" class="section hidden">
44
+ <div id="user-info-section" class="hidden">
45
+ <div class="user-info">
46
+ <img id="user-avatar" class="avatar" src="" alt="">
47
+ <div>
48
+ <div id="user-name" class="user-name"></div>
49
+ <div id="user-email" class="user-email"></div>
50
+ </div>
51
+ <button id="logout-btn" class="btn-icon" title="Sign out">
52
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
53
+ <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9"/>
54
+ </svg>
55
+ </button>
56
+ </div>
57
+ <div class="divider"></div>
58
+ </div>
59
+
60
+ <!-- Embedded search: run a query through the Hanzo answer engine. -->
61
+ <form id="search-form" style="display:flex;gap:6px;margin-bottom:10px;">
62
+ <input id="search-input" type="text" placeholder="Search Hanzo AI…" autocomplete="off"
63
+ style="flex:1;min-width:0;padding:9px 12px;background:var(--surface-light,#171717);border:1px solid var(--border,rgba(255,255,255,0.12));border-radius:8px;color:var(--text,#fafafa);font-size:13px;font-family:inherit;outline:none;">
64
+ <button id="search-btn" type="submit" title="Search" aria-label="Search"
65
+ style="width:36px;height:36px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--primary,#fafafa);border:none;border-radius:8px;color:#000;cursor:pointer;">
66
+ <svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.8">
67
+ <circle cx="7" cy="7" r="4.5"/><path d="M11 11l3.5 3.5" stroke-linecap="round"/>
68
+ </svg>
69
+ </button>
70
+ </form>
71
+
72
+ <!-- Actions: single Open Chat button + on-page surface settings. -->
73
+ <button id="open-panel" class="btn btn-secondary" style="margin-bottom: 8px;">
74
+ <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor">
75
+ <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
76
+ </svg>
77
+ Open Chat
78
+ </button>
79
+
80
+ <!-- On-page chat config -->
81
+ <div class="onpage-config" style="display:flex;flex-direction:column;gap:6px;margin-bottom:12px;font-size:11px;">
82
+ <div class="feature-toggle" style="display:flex;justify-content:space-between;align-items:center;">
83
+ <label style="display:flex;align-items:center;gap:6px;cursor:pointer;">
84
+ <input type="checkbox" id="overlay-enabled" checked>
85
+ <span>On-page chat panel</span>
86
+ </label>
87
+ <span style="color:var(--text-muted,#888);font-size:10px;">overlay vs new tab</span>
88
+ </div>
89
+
90
+ <div id="overlay-side-row" class="side-picker" style="display:flex;gap:6px;align-items:center;">
91
+ <span style="color:var(--text-muted,#888);">Pin:</span>
92
+ <button id="pin-left" class="btn btn-ghost" style="flex:1;padding:4px 8px;font-size:11px;">Left</button>
93
+ <button id="pin-right" class="btn btn-ghost" style="flex:1;padding:4px 8px;font-size:11px;" data-active="true">Right</button>
94
+ </div>
95
+
96
+ <div id="overlay-width-row" style="display:flex;gap:6px;align-items:center;">
97
+ <span style="color:var(--text-muted,#888);">Width:</span>
98
+ <button class="btn btn-ghost width-btn" data-width="compact" style="flex:1;padding:4px 8px;font-size:11px;">Compact</button>
99
+ <button class="btn btn-ghost width-btn" data-width="default" style="flex:1;padding:4px 8px;font-size:11px;" data-active="true">Default</button>
100
+ <button class="btn btn-ghost width-btn" data-width="wide" style="flex:1;padding:4px 8px;font-size:11px;">Wide</button>
101
+ </div>
102
+
103
+ <span style="color:var(--text-muted,#888);font-size:10px;line-height:1.4;">
104
+ FF native sidebar: View → Sidebar → Hanzo AI.<br>
105
+ Disable to fall back to a standalone tab — useful on sites with strict CSP.
106
+ </span>
107
+ </div>
108
+
109
+ <div class="divider"></div>
110
+
111
+ <!-- AI Usage (Claude + Codex, from the current browser session) -->
112
+ <div class="usage-header" style="display:flex;align-items:center;justify-content:space-between;">
113
+ <h3>AI Usage</h3>
114
+ <button id="usage-refresh" class="btn-icon" title="Refresh usage">
115
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
116
+ <path d="M23 4v6h-6M1 20v-6h6"/>
117
+ <path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>
118
+ </svg>
119
+ </button>
120
+ </div>
121
+ <div id="usage-list" class="usage-list" style="display:flex;flex-direction:column;gap:8px;"></div>
122
+ <a href="https://console.hanzo.ai/ai-accounts" target="_blank"
123
+ style="display:inline-block;margin-top:8px;font-size:11px;color:var(--text-muted,#888);">Manage AI accounts →</a>
124
+
125
+ <div class="divider"></div>
126
+
127
+ <!-- Tools -->
128
+ <h3>Tools</h3>
129
+ <div class="tools-grid">
130
+ <button id="tool-picker" class="tool-btn" title="Pick an element on the page">
131
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
132
+ <path d="M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/>
133
+ <path d="M13 13l6 6"/>
134
+ </svg>
135
+ <span>Selector</span>
136
+ </button>
137
+ <button id="tool-screenshot" class="tool-btn" title="Capture visible page">
138
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
139
+ <path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/>
140
+ <circle cx="12" cy="13" r="4"/>
141
+ </svg>
142
+ <span>Screenshot</span>
143
+ </button>
144
+ <button id="tool-pageinfo" class="tool-btn" title="Copy page info to clipboard">
145
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
146
+ <circle cx="12" cy="12" r="10"/>
147
+ <path d="M12 16v-4M12 8h.01"/>
148
+ </svg>
149
+ <span>Page Info</span>
150
+ </button>
151
+ <button id="tool-accessibility" class="tool-btn" title="Run accessibility audit">
152
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
153
+ <circle cx="12" cy="4" r="2"/>
154
+ <path d="M12 6v6M8 8l4 2 4-2M8 22l2-6h4l2 6"/>
155
+ </svg>
156
+ <span>A11y Audit</span>
157
+ </button>
158
+ <button id="tool-performance" class="tool-btn" title="Run performance audit">
159
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
160
+ <path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/>
161
+ </svg>
162
+ <span>Perf Audit</span>
163
+ </button>
164
+ <button id="tool-console" class="tool-btn" title="Evaluate JS in page context">
165
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
166
+ <polyline points="4 17 10 11 4 5"/>
167
+ <line x1="12" y1="19" x2="20" y2="19"/>
168
+ </svg>
169
+ <span>Console</span>
170
+ </button>
171
+ </div>
172
+
173
+ <div class="divider"></div>
174
+
175
+ <!-- Features -->
176
+ <h3>Features</h3>
177
+ <div class="features">
178
+ <div class="feature-toggle">
179
+ <label>
180
+ <input type="checkbox" id="source-maps" checked>
181
+ <span class="toggle"></span>
182
+ <div class="feature-info">
183
+ <strong>Source Maps</strong>
184
+ <small>Click-to-code navigation</small>
185
+ </div>
186
+ </label>
187
+ </div>
188
+
189
+ <div class="feature-toggle">
190
+ <label>
191
+ <input type="checkbox" id="webgpu-ai" checked>
192
+ <span class="toggle"></span>
193
+ <div class="feature-info">
194
+ <strong>WebGPU AI</strong>
195
+ <small>Local AI inference</small>
196
+ </div>
197
+ </label>
198
+ </div>
199
+
200
+ <div class="feature-toggle">
201
+ <label>
202
+ <input type="checkbox" id="browser-control">
203
+ <span class="toggle"></span>
204
+ <div class="feature-info">
205
+ <strong>Browser Control</strong>
206
+ <small>AI browser automation</small>
207
+ </div>
208
+ </label>
209
+ </div>
210
+
211
+ <div class="feature-toggle">
212
+ <label>
213
+ <input type="checkbox" id="tab-filesystem">
214
+ <span class="toggle"></span>
215
+ <div class="feature-info">
216
+ <strong>Tab Filesystem</strong>
217
+ <small>Mount tabs as files</small>
218
+ </div>
219
+ </label>
220
+ </div>
221
+ </div>
222
+
223
+ <div class="divider"></div>
224
+
225
+ <!-- Privacy & data -->
226
+ <h3>Privacy &amp; data</h3>
227
+ <div class="features">
228
+ <div class="feature-toggle">
229
+ <label>
230
+ <input type="checkbox" id="insights-enabled" checked>
231
+ <span class="toggle"></span>
232
+ <div class="feature-info">
233
+ <strong>Usage insights</strong>
234
+ <small>Anonymous, helps improve Hanzo. Never your search text.</small>
235
+ </div>
236
+ </label>
237
+ </div>
238
+
239
+ <div class="feature-toggle">
240
+ <label>
241
+ <input type="checkbox" id="share-training">
242
+ <span class="toggle"></span>
243
+ <div class="feature-info">
244
+ <strong>Contribute to training</strong>
245
+ <small>Opt in to share your searches &amp; answers to train Hanzo's open models. Off by default.</small>
246
+ </div>
247
+ </label>
248
+ </div>
249
+ </div>
250
+
251
+ <div class="divider"></div>
252
+
253
+ <!-- Browser Backend -->
254
+ <div class="setting-group backend-picker">
255
+ <h3>Backend</h3>
256
+ <div class="backend-select-wrapper">
257
+ <select id="browser-backend">
258
+ <option value="auto">Auto (default)</option>
259
+ <option value="this">This Browser</option>
260
+ <option value="firefox">Firefox</option>
261
+ <option value="chrome">Chrome</option>
262
+ <option value="playwright">Playwright Only</option>
263
+ </select>
264
+ </div>
265
+ <div class="backend-status">
266
+ <span class="status-dot" id="bridge-status"></span>
267
+ <span id="bridge-detail" class="status-detail">Checking bridge...</span>
268
+ </div>
269
+ </div>
270
+
271
+ <div class="divider"></div>
272
+
273
+ <!-- Connection Status -->
274
+ <h3>Status</h3>
275
+ <div class="status">
276
+ <div class="status-item">
277
+ <span class="status-dot" id="zap-status"></span>
278
+ <span>ZAP Bridge</span>
279
+ <span id="zap-detail" class="status-detail">Discovering...</span>
280
+ </div>
281
+ <div class="status-item">
282
+ <span class="status-dot" id="cdp-status"></span>
283
+ <span>CDP Bridge</span>
284
+ <span id="cdp-detail" class="status-detail">Checking...</span>
285
+ </div>
286
+ <div class="status-item">
287
+ <span class="status-dot" id="mcp-status"></span>
288
+ <span>MCP Bridge</span>
289
+ <span id="mcp-port" class="status-detail">:9224</span>
290
+ </div>
291
+ <div class="status-item">
292
+ <span class="status-dot" id="gpu-status"></span>
293
+ <span>WebGPU</span>
294
+ <span id="gpu-detail" class="status-detail">Checking...</span>
295
+ </div>
296
+ </div>
297
+
298
+ <!-- Pairing: once per browser, with this computer's ZAP router -->
299
+ <div class="setting-group" id="zap-pair" hidden>
300
+ <label for="zap-code">Pair with this computer: run <code>hanzo-mcp pair</code> and paste the code it prints.</label>
301
+ <input type="text" id="zap-code" placeholder="ws://127.0.0.1:…/#…" autocomplete="off" spellcheck="false">
302
+ <button id="zap-pair-btn" class="btn btn-secondary" style="margin-top: 6px;">Pair</button>
303
+ <span id="zap-pair-error" class="status-detail"></span>
304
+ </div>
305
+
306
+ <div class="divider"></div>
307
+
308
+ <!-- Actions -->
309
+ <div class="actions">
310
+ <button id="test-connection" class="btn btn-ghost">Test Connection</button>
311
+ <button id="open-settings" class="btn btn-ghost">Settings</button>
312
+ </div>
313
+
314
+ <!-- Quick Guide -->
315
+ <div class="guide" style="margin-top: 12px;">
316
+ <h3 style="text-transform: none; letter-spacing: 0; color: var(--text);">Shortcuts</h3>
317
+ <p>
318
+ <kbd id="inspect-shortcut-display">Ctrl</kbd> + <kbd>Click</kbd>
319
+ any element to jump to source
320
+ <button id="record-inspect-shortcut" class="btn-link" style="margin-left:6px;font-size:11px;">edit</button>
321
+ </p>
322
+ <p><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>H</kbd> open Hanzo panel</p>
323
+ </div>
324
+ </div>
325
+
326
+ <!-- Settings Section -->
327
+ <div id="settings-section" class="section hidden">
328
+ <div class="settings-header">
329
+ <button id="back-btn" class="btn-icon">
330
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
331
+ <path d="M19 12H5M12 19l-7-7 7-7"/>
332
+ </svg>
333
+ </button>
334
+ <h2>Settings</h2>
335
+ </div>
336
+
337
+ <div class="settings-content">
338
+ <div class="setting-group">
339
+ <h3>Connection</h3>
340
+ <label>
341
+ MCP Port
342
+ <input type="number" id="mcp-port-setting" value="3001" min="1024" max="65535">
343
+ </label>
344
+ <label>
345
+ CDP Bridge Port
346
+ <input type="number" id="cdp-port-setting" value="9223" min="1024" max="65535">
347
+ </label>
348
+ </div>
349
+
350
+ <div class="setting-group">
351
+ <h3>AI Models</h3>
352
+ <label>
353
+ Local Model Path
354
+ <input type="text" id="model-path" placeholder="/models/browser-control-4bit.bin">
355
+ </label>
356
+ <label>
357
+ Model Quantization
358
+ <select id="model-quant">
359
+ <option value="4bit">4-bit (Fastest)</option>
360
+ <option value="8bit">8-bit (Balanced)</option>
361
+ <option value="fp16">FP16 (Best Quality)</option>
362
+ </select>
363
+ </label>
364
+ </div>
365
+
366
+ <div class="setting-group">
367
+ <h3>Browser Control</h3>
368
+ <label>
369
+ <input type="checkbox" id="safe-mode" checked>
370
+ Safe Mode (require confirmation for actions)
371
+ </label>
372
+ <label>
373
+ Max Workers
374
+ <input type="number" id="max-workers" value="3" min="1" max="10">
375
+ </label>
376
+ </div>
377
+
378
+ <div class="setting-group">
379
+ <h3>Keyboard</h3>
380
+ <label>
381
+ Inspect modifier
382
+ <div style="display:flex;gap:8px;align-items:center;margin-top:4px;">
383
+ <kbd id="inspect-shortcut-current" style="flex:1;font-family:monospace;padding:4px 8px;background:var(--surface-2,#222);border-radius:4px;font-size:12px;">Ctrl</kbd>
384
+ <button id="inspect-shortcut-record" type="button" class="btn btn-ghost" style="padding:4px 10px;">Record</button>
385
+ <button id="inspect-shortcut-reset" type="button" class="btn btn-ghost" style="padding:4px 10px;">Reset</button>
386
+ </div>
387
+ <small style="color:var(--text-muted,#888);font-size:11px;">
388
+ Hold + click any element on a page to jump to its source. Default
389
+ is Ctrl (or ⌘ on Mac). Click "Record" then press the chord you
390
+ want — modifiers alone or modifier+letter both work.
391
+ </small>
392
+ </label>
393
+ </div>
394
+
395
+ <button id="save-settings" class="btn btn-primary">Save Settings</button>
396
+ </div>
397
+ </div>
398
+
399
+ <!-- Footer: version + nav links -->
400
+ <div class="footer-version" style="text-align:center;font-size:10px;color:var(--text-muted,#888);margin-top:14px;letter-spacing:0.04em;">
401
+ Hanzo AI <span id="footer-version">…</span>
402
+ </div>
403
+ <div class="footer-links">
404
+ <a href="https://docs.hanzo.ai" target="_blank">Docs</a>
405
+ <a href="https://console.hanzo.ai" target="_blank">Console</a>
406
+ <a href="https://github.com/hanzoai/extension" target="_blank">GitHub</a>
407
+ <a href="https://hanzo.ai" target="_blank">hanzo.ai</a>
408
+ </div>
409
+ </div>
410
+
411
+ <script src="popup.js"></script>
412
+ </body>
413
+ </html>
@@ -0,0 +1,48 @@
1
+ "use strict";(()=>{var qt=Object.create;var tt=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty;var Qt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var en=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Yt(t))!Xt.call(e,o)&&o!==n&&tt(e,o,{get:()=>t[o],enumerable:!(i=Zt(t,o))||i.enumerable});return e};var tn=(e,t,n)=>(n=e!=null?qt(Jt(e)):{},en(t||!e||!e.__esModule?tt(n,"default",{value:e,enumerable:!0}):n,e));var rt=Qt((ke,nt)=>{(function(e,t){if(typeof define=="function"&&define.amd)define("webextension-polyfill",["module"],t);else if(typeof ke<"u")t(nt);else{var n={exports:{}};t(n),e.browser=n.exports}})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:ke,function(e){"use strict";if(!(globalThis.chrome&&globalThis.chrome.runtime&&globalThis.chrome.runtime.id))throw new Error("This script should only be loaded in a browser extension.");if(globalThis.browser&&globalThis.browser.runtime&&globalThis.browser.runtime.id)e.exports=globalThis.browser;else{let t="The message port closed before a response was received.",n=i=>{let o={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getSubTree:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{disable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},enable:{minArgs:0,maxArgs:1,fallbackToNoCallback:!0},getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},openPopup:{minArgs:0,maxArgs:0},setBadgeBackgroundColor:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setBadgeText:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},browsingData:{remove:{minArgs:2,maxArgs:2},removeCache:{minArgs:1,maxArgs:1},removeCookies:{minArgs:1,maxArgs:1},removeDownloads:{minArgs:1,maxArgs:1},removeFormData:{minArgs:1,maxArgs:1},removeHistory:{minArgs:1,maxArgs:1},removeLocalStorage:{minArgs:1,maxArgs:1},removePasswords:{minArgs:1,maxArgs:1},removePluginData:{minArgs:1,maxArgs:1},settings:{minArgs:0,maxArgs:0}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},devtools:{inspectedWindow:{eval:{minArgs:1,maxArgs:2,singleCallbackArg:!1}},panels:{create:{minArgs:3,maxArgs:3,singleCallbackArg:!0},elements:{createSidebarPane:{minArgs:1,maxArgs:1}}}},downloads:{cancel:{minArgs:1,maxArgs:1},download:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},identity:{launchWebAuthFlow:{minArgs:1,maxArgs:1}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},setEnabled:{minArgs:2,maxArgs:2},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setIcon:{minArgs:1,maxArgs:1},setPopup:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},setTitle:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0},show:{minArgs:1,maxArgs:1,fallbackToNoCallback:!0}},permissions:{contains:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},request:{minArgs:1,maxArgs:1}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},sessions:{getDevices:{minArgs:0,maxArgs:1},getRecentlyClosed:{minArgs:0,maxArgs:1},restore:{minArgs:0,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{captureVisibleTab:{minArgs:0,maxArgs:2},create:{minArgs:1,maxArgs:1},detectLanguage:{minArgs:0,maxArgs:1},discard:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},goBack:{minArgs:0,maxArgs:1},goForward:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},query:{minArgs:1,maxArgs:1},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},topSites:{get:{minArgs:0,maxArgs:0}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(Object.keys(o).length===0)throw new Error("api-metadata.json has not been included in browser-polyfill");class d extends WeakMap{constructor(u,h=void 0){super(h),this.createItem=u}get(u){return this.has(u)||this.set(u,this.createItem(u)),super.get(u)}}let m=l=>l&&typeof l=="object"&&typeof l.then=="function",g=(l,u)=>(...h)=>{i.runtime.lastError?l.reject(new Error(i.runtime.lastError.message)):u.singleCallbackArg||h.length<=1&&u.singleCallbackArg!==!1?l.resolve(h[0]):l.resolve(h)},E=l=>l==1?"argument":"arguments",_=(l,u)=>function(A,...w){if(w.length<u.minArgs)throw new Error(`Expected at least ${u.minArgs} ${E(u.minArgs)} for ${l}(), got ${w.length}`);if(w.length>u.maxArgs)throw new Error(`Expected at most ${u.maxArgs} ${E(u.maxArgs)} for ${l}(), got ${w.length}`);return new Promise((P,S)=>{if(u.fallbackToNoCallback)try{A[l](...w,g({resolve:P,reject:S},u))}catch(f){console.warn(`${l} API method doesn't seem to support the callback parameter, falling back to call it without a callback: `,f),A[l](...w),u.fallbackToNoCallback=!1,u.noCallback=!0,P()}else u.noCallback?(A[l](...w),P()):A[l](...w,g({resolve:P,reject:S},u))})},T=(l,u,h)=>new Proxy(u,{apply(A,w,P){return h.call(w,l,...P)}}),z=Function.call.bind(Object.prototype.hasOwnProperty),W=(l,u={},h={})=>{let A=Object.create(null),w={has(S,f){return f in l||f in A},get(S,f,I){if(f in A)return A[f];if(!(f in l))return;let b=l[f];if(typeof b=="function")if(typeof u[f]=="function")b=T(l,l[f],u[f]);else if(z(h,f)){let C=_(f,h[f]);b=T(l,l[f],C)}else b=b.bind(l);else if(typeof b=="object"&&b!==null&&(z(u,f)||z(h,f)))b=W(b,u[f],h[f]);else if(z(h,"*"))b=W(b,u[f],h["*"]);else return Object.defineProperty(A,f,{configurable:!0,enumerable:!0,get(){return l[f]},set(C){l[f]=C}}),b;return A[f]=b,b},set(S,f,I,b){return f in A?A[f]=I:l[f]=I,!0},defineProperty(S,f,I){return Reflect.defineProperty(A,f,I)},deleteProperty(S,f){return Reflect.deleteProperty(A,f)}},P=Object.create(l);return new Proxy(P,w)},K=l=>({addListener(u,h,...A){u.addListener(l.get(h),...A)},hasListener(u,h){return u.hasListener(l.get(h))},removeListener(u,h){u.removeListener(l.get(h))}}),ge=new d(l=>typeof l!="function"?l:function(h){let A=W(h,{},{getContent:{minArgs:0,maxArgs:0}});l(A)}),fe=new d(l=>typeof l!="function"?l:function(h,A,w){let P=!1,S,f=new Promise(j=>{S=function(N){P=!0,j(N)}}),I;try{I=l(h,A,S)}catch(j){I=Promise.reject(j)}let b=I!==!0&&m(I);if(I!==!0&&!b&&!P)return!1;let C=j=>{j.then(N=>{w(N)},N=>{let G;N&&(N instanceof Error||typeof N.message=="string")?G=N.message:G="An unexpected error occurred",w({__mozWebExtensionPolyfillReject__:!0,message:G})}).catch(N=>{console.error("Failed to send onMessage rejected reply",N)})};return C(b?I:f),!0}),_e=({reject:l,resolve:u},h)=>{i.runtime.lastError?i.runtime.lastError.message===t?u():l(new Error(i.runtime.lastError.message)):h&&h.__mozWebExtensionPolyfillReject__?l(new Error(h.message)):u(h)},he=(l,u,h,...A)=>{if(A.length<u.minArgs)throw new Error(`Expected at least ${u.minArgs} ${E(u.minArgs)} for ${l}(), got ${A.length}`);if(A.length>u.maxArgs)throw new Error(`Expected at most ${u.maxArgs} ${E(u.maxArgs)} for ${l}(), got ${A.length}`);return new Promise((w,P)=>{let S=_e.bind(null,{resolve:w,reject:P});A.push(S),h.sendMessage(...A)})},pe={devtools:{network:{onRequestFinished:K(ge)}},runtime:{onMessage:K(fe),onMessageExternal:K(fe),sendMessage:he.bind(null,"sendMessage",{minArgs:1,maxArgs:3})},tabs:{sendMessage:he.bind(null,"sendMessage",{minArgs:2,maxArgs:3})}},J={clear:{minArgs:1,maxArgs:1},get:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}};return o.privacy={network:{"*":J},services:{"*":J},websites:{"*":J}},W(i,pe,o)};e.exports=n(chrome)}})});var Mr=tn(rt());var Se="hanzo_shortcut_inspect",Ce={ctrl:!0,meta:!1,alt:!1,shift:!1,key:""};function it(e,t){let n=(t==null?void 0:t.mac)??(typeof navigator<"u"&&/Mac/i.test(navigator.platform||"")),i=[];return e.ctrl&&i.push(n?"\u2303":"Ctrl"),e.meta&&i.push(n?"\u2318":"Meta"),e.alt&&i.push(n?"\u2325":"Alt"),e.shift&&i.push(n?"\u21E7":"Shift"),e.key&&i.push(e.key.length===1?e.key.toUpperCase():e.key),t!=null&&t.click&&i.push("Click"),i.join("+")||"(unset)"}function st(e){let t=e.key||"";return["Control","Meta","Alt","Shift"].includes(t)?{ctrl:!!e.ctrlKey,meta:!!e.metaKey,alt:!!e.altKey,shift:!!e.shiftKey,key:""}:["Tab","Escape","Enter",""].includes(t)?null:{ctrl:!!e.ctrlKey,meta:!!e.metaKey,alt:!!e.altKey,shift:!!e.shiftKey,key:t}}async function ot(e){try{let n=(await e.get([Se]))[Se];if(n&&typeof n=="object"&&typeof n.ctrl=="boolean"&&typeof n.alt=="boolean"&&typeof n.shift=="boolean"&&typeof n.meta=="boolean"&&typeof n.key=="string")return n}catch{}return{...Ce}}async function Le(e,t){await e.set({[Se]:t})}var p={SIGNUP_VIEWED:"signup_viewed",SIGNUP_SUBMITTED:"signup_submitted",SIGNUP_VERIFIED:"signup_verified",SIGNUP_COMPLETED:"signup_completed",LOGIN_COMPLETED:"login_completed",FIRST_ACTION:"first_action",WAITLIST_JOINED:"waitlist_joined",WAITLIST_SHARED:"waitlist_shared",REFERRAL_USED:"referral_used",REFERRAL_CLAIMED:"referral_claimed",PRICING_VIEWED:"pricing_viewed",PLAN_CLICKED:"plan_clicked",CHECKOUT_STARTED:"checkout_started",ORDER_COMPLETED:"order_completed",FEATURE_USED:"feature_used",API_KEY_CREATED:"api_key_created",APP_CREATED:"app_created",PROJECT_CREATED:"project_created",AGENT_CREATED:"agent_created",CHAT_STARTED:"chat_started",CHAT_MESSAGE_SENT:"chat_message_sent",MODEL_SWITCHED:"model_switched",TASK_STARTED:"task_started",TASK_COMPLETED:"task_completed",BUILD_STARTED:"build_started",GENERATION_COMPLETED:"generation_completed",GENERATION_FAILED:"generation_failed",DEPLOY_STARTED:"deploy_started",DEPLOY_SUCCEEDED:"deploy_succeeded",DEPLOY_FAILED:"deploy_failed"},B="$pageview",te="$exception";var v=(e,t,n)=>({event:e,label:t,...n??{}}),Pe={signup:{label:"Signup",products:["site","id"],join:"aggregate",steps:[v(B,"Landed",{product:"site"}),v(p.SIGNUP_VIEWED,"Opened signup",{product:"site"}),v(p.SIGNUP_SUBMITTED,"Redirected to Hanzo ID",{product:"site"}),v(p.SIGNUP_VIEWED,"Saw the form",{product:"id"}),v(p.SIGNUP_SUBMITTED,"Submitted the form",{product:"id"}),v(p.SIGNUP_COMPLETED,"Account created",{product:"site"})]},apiActivation:{label:"API activation",products:["site","cloud"],join:"person",steps:[v(p.SIGNUP_COMPLETED,"Account created"),v(p.API_KEY_CREATED,"Key minted"),v(p.FIRST_ACTION,"First successful API call",{where:{property:"action",equals:"api_call"}})]},upgrade:{label:"Upgrade",products:["site","app","console","billing","pay"],join:"person",steps:[v(p.PRICING_VIEWED,"Viewed pricing"),v(p.PLAN_CLICKED,"Chose a plan"),v(p.CHECKOUT_STARTED,"Left for checkout",{product:"billing"}),v(p.CHECKOUT_STARTED,"Reached the card form",{product:"pay"}),v(p.ORDER_COMPLETED,"Paid")]},appShip:{label:"Describe \u2192 ship",products:["app"],join:"person",steps:[v(B,"Landed"),v(p.BUILD_STARTED,"Described an app"),v(p.GENERATION_COMPLETED,"Got a working build"),v(p.DEPLOY_STARTED,"Hit publish"),v(p.DEPLOY_SUCCEEDED,"Live URL")]},chatEngage:{label:"Chat engagement",products:["chat"],join:"person",steps:[v(B,"Landed"),v(p.CHAT_STARTED,"Started a conversation"),v(p.CHAT_MESSAGE_SENT,"Sent a message"),v(p.GENERATION_COMPLETED,"Got an answer")]},siteToChat:{label:"Site \u2192 Chat handoff",products:["site","chat"],join:"aggregate",steps:[v(p.CHAT_STARTED,"Submitted the hanzo.ai composer",{product:"site",where:{property:"source",equals:"composer"}}),v(p.CHAT_STARTED,"Landed in hanzo.chat",{product:"chat",where:{property:"referrerProduct",equals:"site"}}),v(p.GENERATION_COMPLETED,"Got an answer")]}};function Z(e){return Pe[e].steps.map(t=>t.event)}var yr=Object.freeze(Object.values(p)),Er=Object.freeze([B,te]);var sn=["facebook.","instagram.","twitter.","x.com","t.co","linkedin.","reddit.","youtube.","tiktok.","pinterest.","news.ycombinator.com"],on=["google.","bing.","duckduckgo.","yahoo.","baidu.","ecosia."];function an(e,t){let n=new URLSearchParams(e||""),i=d=>{let m=n.get(d);return m?m.trim():void 0},o={utm:{source:i("utm_source"),medium:i("utm_medium"),campaign:i("utm_campaign"),term:i("utm_term"),content:i("utm_content")},referrer:t?t.trim():void 0,refCode:i("ref")||i("refCode")||i("ref_code")||void 0};return o.channel=_t(o),o}function _t(e){let t=(e.utm.medium||"").toLowerCase();if(/(cpc|ppc|paid|paidsearch|display|cpm)/.test(t))return"paid";if(e.utm.source||e.utm.campaign)return"campaign";if(e.refCode)return"referral";let n=xt(e.referrer);return n?sn.some(i=>n.includes(i))?"social":on.some(i=>n.includes(i))?"organic":"referral":"direct"}function xt(e){if(!e)return"";let t=e.trim(),n=t.indexOf("://");n>=0&&(t=t.slice(n+3));let i=t.search(/[/?#]/);i>=0&&(t=t.slice(0,i));let o=t.indexOf("@");o>=0&&(t=t.slice(o+1));let d=t.indexOf(":");return d>=0&&(t=t.slice(0,d)),t.toLowerCase().trim()}function cn(e){return!!(e.utm.source||e.utm.medium||e.utm.campaign||e.utm.term||e.utm.content||e.refCode||e.referrer&&xt(e.referrer))}var ln=Object.freeze({console:"019fa40b-94ae-7f1d-8f7b-e92f123fad42",app:"019f9b1e-57eb-7171-9d92-72c0b85e4b4b",site:"019f9b1e-5785-7359-ad0b-f75db8e58c99"});function at(e,t){if(!e||!t)return;let n=ln[e];if(n)return`https://${t}@api.hanzo.ai/v1/event/${n}`}var dn=Object.freeze({hanzo:Object.freeze(["hanzo.ai","hanzo.app","hanzo.bot","hanzo.chat","hanzo.codes","hanzo.id","hanzo.sh","hanzo.team","hanzo.ventures","hanzo.works","hanzoskills.com"]),lux:Object.freeze(["lux.network","lux.exchange","lux.market","lux.finance","lux.financial","lux.credit","lux.fund","lux.id"]),zoo:Object.freeze(["zoo.ngo","zoo.network","zoolabs.id","zoolabs.io"])}),Tt=Object.freeze({hanzo:"pk-rM_CdaF2MQckGCrla113SrR1oH4zvqN8xh2I95Z9tY8",lux:"pk-gUZp6ZVfhJzSwK-rb4oLbVkpCnMBx5uSCpxf_5yEhQk",zoo:"pk-3TKpKnERV9AQSsBUERWkZejC1O1mUxc1jRzsP3MPbs4"}),un="pk-",mn=e=>e.trim().toLowerCase().replace(/\.$/,"").split(":")[0]??"";function gn(e){let t=mn(e);if(!t)return;let n,i=0;for(let[o,d]of Object.entries(dn))for(let m of d)(t===m||t.endsWith(`.${m}`))&&m.length>i&&(n=o,i=m.length);return n}function fn(e,t=Tt){let n=gn(e);if(!n)return;let i=t[n];if(typeof i!="string")return;let o=i.trim();return o.startsWith(un)?o:void 0}function hn(e=Tt){if(!(typeof location>"u"))return fn(location.hostname,e)}var De="[redacted]",pn="[email]",ct="[ip]",An=[/-----BEGIN[ A-Z]*PRIVATE KEY-----[\s\S]*?-----END[ A-Z]*PRIVATE KEY-----/g,/eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{6,}/g,/\bbearer\s+[A-Za-z0-9._~+/-]{12,}=*/gi,/\b(?:sk|pk|rk)-[A-Za-z0-9]{2,}-?[A-Za-z0-9]{12,}/g,/\b(?:sk|pk)_(?:live|test)_[A-Za-z0-9]{16,}/g,/\bhk-[A-Za-z0-9]{16,}/g,/\bAKIA[0-9A-Z]{16}\b/g,/\bASIA[0-9A-Z]{16}\b/g,/\bAIza[0-9A-Za-z_-]{20,}/g,/\bgh[posru]_[A-Za-z0-9]{20,}/g,/\bxox[baprs]-[A-Za-z0-9-]{10,}/g,/[a-zA-Z][a-zA-Z0-9+.-]{0,32}:\/\/[^\s:@/]{1,256}:[^\s@/]{1,256}@/g],yn=/\b(?:\d[ -]?){13,19}\b/g;function En(e){let t=0,n=!1;for(let i=e.length-1;i>=0;i--){let o=e.charCodeAt(i)-48;n&&(o*=2,o>9&&(o-=9)),t+=o,n=!n}return t%10===0}function bn(e){return e.replace(yn,t=>{let n=t.replace(/[ -]/g,"");return n.length<13||n.length>19?t:En(n)?De:t})}var vn=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,_n=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g,xn=/\b(?:[0-9A-Fa-f]{1,4}:){2,7}[0-9A-Fa-f]{1,4}\b/g,Tn=["code","state","token","access_token","id_token","refresh_token","auth","authorization","secret","client_secret","password","passwd","pwd","api_key","apikey","key","session","session_id","sid","sig","signature","nonce","otp","invite","invitation","reset_token","confirmation_token","magic","ticket","assertion"],wn=new RegExp("([?&#;](?:"+Tn.join("|")+")=)[^&#;\\s]{1,4096}","gi");function In(e){return e.replace(wn,(t,n)=>n+De)}function kn(e){e=In(e);for(let t of An)e=e.replace(t,De);return bn(e)}function Sn(e){return e=e.replace(vn,pn),e=e.replace(xn,ct),e=e.replace(_n,ct),e}var Cn=8192;function Ln(e,t=Cn){return e.length>t?e.slice(0,t)+"\u2026 [truncated]":e}function de(e,t=!1){return e?(e=Ln(e),e=kn(e),t||(e=Sn(e)),e):e??""}var le="iam-anon-id",Ne=["hz_anon_id","hz_id"],Oe="hanzo.ai",Pn=2*365*24*60*60,lt;function ue(e){var t=new Uint8Array(16),n,i=typeof crypto<"u"?crypto:void 0;if(i&&typeof i.getRandomValues=="function")i.getRandomValues(t);else for(n=0;n<16;n++)t[n]=Math.random()*256|0;var o=Math.floor(e===void 0?Date.now():e);for(n=5;n>=0;n--)t[n]=o%256,o=Math.floor(o/256);t[6]=112|t[6]&15,t[8]=128|t[8]&63;var d="";for(n=0;n<16;n++)d+=(t[n]+256).toString(16).slice(1),(n===3||n===5||n===7||n===9)&&(d+="-");return d}function wt(){try{return typeof document>"u"||typeof document.cookie!="string"?null:document}catch{return null}}function Nn(){try{return typeof window>"u"||!window.localStorage?null:window.localStorage}catch{return null}}function It(e,t){try{return e&&e.getItem(t)||""}catch{return""}}function kt(e){var t=wt();if(!t)return"";for(var n=t.cookie.split(";"),i=0;i<n.length;i++){var o=n[i].indexOf("=");if(!(o<0||n[i].slice(0,o).trim()!==e)){var d=n[i].slice(o+1).trim();if(d)try{return decodeURIComponent(d)}catch{return d}}}return""}function On(e,t){var n=wt();if(n){var i="",o=!1;try{typeof window<"u"&&window.location&&(i=window.location.hostname||"",o=window.location.protocol==="https:")}catch{}var d=e+"="+encodeURIComponent(t);d+="; Path=/; Max-Age="+Pn+"; SameSite=Lax",("."+i).slice(-(Oe.length+1))==="."+Oe&&(d+="; Domain="+Oe),o&&(d+="; Secure");try{n.cookie=d}catch{}}}function Rn(e){for(var t=0;t<Ne.length;t++){var n=kt(Ne[t])||It(e,Ne[t]);if(n)return n}return""}function Mn(){if(typeof window>"u")return"";var e=Nn(),t=kt(le)||It(e,le)||Rn(e)||lt||ue();lt=t,On(le,t);try{e&&e.getItem(le)!==t&&e.setItem(le,t)}catch{}return t}var zn="0.3.41",St=zn,dt=50,Dn=500,Un=2048,ut=1024,Bn=50;function $n(){return ue().replace(/-/g,"")}function Wn(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e).length:typeof Buffer<"u"?Buffer.byteLength(e,"utf8"):e.length}function mt(e){if(!e)return null;let t=/^(https?):\/\/([^@]+)@([^/]+)(\/.*)?$/.exec(e.trim());if(!t)return null;let n=t[1],i=t[2],o=t[3],d=t[4]??"";if(!i||!o)return null;let m=d.split("/").filter(Boolean),g=m.length>0?m[m.length-1]:"";if(!g)return null;let E=`${n}://${o}`,_=`${E}/${m.map(encodeURIComponent).join("/")}`,T=`${_}/envelope/?sentry_key=${encodeURIComponent(i)}`;return{publicKey:i,origin:E,projectId:g,base:_,ingestUrl:T}}var Kn=/^\s*at\s+(?:(.+?)\s+\()?(?:(.+?):(\d+):(\d+)|([^)]+))\)?\s*$/,Hn=/^\s*(?:(.*?)@)?(.+?):(\d+):(\d+)\s*$/;function Fn(e){return e?!(e.includes("node_modules")||e.startsWith("webpack-internal")||e.startsWith("webpack://")||e.startsWith("chrome-extension://")||e.startsWith("moz-extension://")):!1}function Ct(e){if(!e)return[];let t=e.split(`
2
+ `,Dn),n=[];for(let i of t){if(i.length>Un)continue;let o=i.trimEnd();if(!o)continue;let d,m="",g=0,E=0,_=Kn.exec(o);if(_)d=_[1],_[2]?(m=_[2],g=Number(_[3])||0,E=Number(_[4])||0):m=(_[5]||"").trim();else{let T=Hn.exec(o);if(!T)continue;d=T[1],m=T[2],g=Number(T[3])||0,E=Number(T[4])||0}!m&&!d||n.push({function:d||"<anonymous>",filename:m,abs_path:m,lineno:g,colno:E,in_app:Fn(m)})}return n.reverse(),n.length>dt?n.slice(n.length-dt):n}function Ue(e){if(e instanceof Error){let t=Re(e,"name"),n=Re(e,"message"),i=Re(e,"stack");return{name:typeof t=="string"&&t?t:"Error",message:typeof n=="string"&&n?n:Me(e),stack:typeof i=="string"?i:void 0}}if(typeof e=="string")return{name:"Error",message:e};try{return{name:"Error",message:JSON.stringify(e)??Me(e)}}catch{return{name:"Error",message:Me(e)}}}function Re(e,t){try{return e[t]}catch{return}}function Me(e){try{return String(e)}catch{return"[unstringifiable]"}}function jn(e){let t=typeof e=="string"?e:(()=>{try{return JSON.stringify(e)??String(e)}catch{try{return String(e)}catch{return"[unstringifiable]"}}})();return t.length>ut?t.slice(0,ut):t}function Gn(e){let{error:t,options:n={},identity:i,capturePII:o=!1}=e,d=Ue(t),m=n.handled!==!1,g=n.level??(m?"error":"fatal"),E={handled:String(m)};i.product&&(E.product=i.product),i.sessionId&&(E.session=i.sessionId);try{let T=n.properties??{},z=0;for(let W of Object.keys(T)){if(z>=Bn)break;try{let K=T[W];if(K==null)continue;E[W]=de(jn(K),o),z++}catch{continue}}}catch{}let _={event_id:e.id??$n(),timestamp:(e.now??Date.now())/1e3,platform:"javascript",level:g,logger:i.product,environment:i.environment,release:i.release,exception:{values:[{type:d.name,value:de(d.message,o),stacktrace:{frames:Ct(d.stack)}}]},tags:E,sdk:{name:"@hanzo/event",version:St}};return i.userId&&(_.user={id:i.userId}),_}function Vn(e,t,n){let i=JSON.stringify(e),o=JSON.stringify({event_id:e.event_id,dsn:t.base,sent_at:n??new Date().toISOString()}),d=JSON.stringify({type:"event",content_type:"application/json",length:Wn(i)});return`${o}
3
+ ${d}
4
+ ${i}
5
+ `}var qn=4096;function Lt(e){let t="";for(let n of[2166136261,16777619,2654435769,2246822507]){let i=n>>>0;for(let o=0;o<e.length;o++)i^=e.charCodeAt(o),i=i+(i<<1)+(i<<4)+(i<<7)+(i<<8)+(i<<24)>>>0;t+=i.toString(16).padStart(8,"0")}return t}function Zn(e){let t=e.filename??"",n=e.function??"<anonymous>",i=e.lineno??0,o=e.colno??0;return{raw_id:`${Lt(`${t}|${n}|${i}|${o}`)}/0`,mangled_name:n,source:t,line:i,column:o,in_app:e.in_app??!1,lang:"javascript",resolved:!1,resolve_failure:"no symbol set uploaded for this release",resolved_name:null,module:null}}function Yn(e,t){if(e.length<=t)return e;let n=t,i=e.charCodeAt(n-1);return i>=55296&&i<=56319&&n--,e.slice(0,n)}function Jn(e,t){let n=Ue(e),i=Ct(n.stack).slice(-50),o={id:t.id,type:n.name,value:Yn(n.message,qn),mechanism:{type:"generic",handled:t.handled,synthetic:!(e instanceof Error)}};return i.length>0&&(o.stacktrace={type:"resolved",frames:i.map(Zn)}),o}function Xn(e){var i;let n=(((i=e.stacktrace)==null?void 0:i.frames)??[]).filter(o=>o.in_app).map(o=>`${o.mangled_name}@${o.source}`);return Lt([e.type,...n].join(`
6
+ `))}function Qn(e,t){var d,m;let n=Jn(e,t),i=((d=n.stacktrace)==null?void 0:d.frames)??[],o=Xn(n);return{$exception_list:[n],$exception_fingerprint:o,$exception_fingerprint_record:[{type:"manual"}],$exception_type:n.type,$exception_message:n.value,$exception_level:t.level??"error",$exception_handled:t.handled,$exception_synthetic:((m=n.mechanism)==null?void 0:m.synthetic)??!1,$exception_types:[n.type],$exception_values:[n.value],$exception_sources:i.map(g=>g.source).filter(g=>!!g),$exception_functions:i.map(g=>g.resolved_name??g.mangled_name).filter(g=>!!g)}}var ne={session:"hz_session",firstTouch:"hz_first_touch",cohort:"hz_cohort"},er=1800*1e3;function me(){try{return typeof window>"u"||!window.localStorage?void 0:window.localStorage}catch{return}}function gt(){return Mn()||void 0}function ft(e=Date.now()){let t=me();if(!t)return;let n=null;try{n=JSON.parse(t.getItem(ne.session)||"null")}catch{n=null}return!n||e-n.last>er?n={id:ue(e),last:e}:n.last=e,t.setItem(ne.session,JSON.stringify(n)),n.id}function Pt(){let e=me();if(e)try{let t=e.getItem(ne.firstTouch);return t?JSON.parse(t):void 0}catch{return}}function tr(e){let t=me(),n=Pt();return n||(t&&t.setItem(ne.firstTouch,JSON.stringify(e)),e)}function nr(){let e=me();if(e)try{let t=e.getItem(ne.cohort);return t?JSON.parse(t):void 0}catch{return}}function ht(e){let t=me(),n=nr()||{},i={signupWeek:n.signupWeek||e.signupWeek,channel:e.channel||n.channel,refCode:n.refCode||e.refCode};return t&&t.setItem(ne.cohort,JSON.stringify(i)),i}var pt="/v1/event",Nt="https://api.hanzo.ai",rr="application/x-sentry-envelope",At="text/plain";function yt(){try{if(typeof process<"u"&&process.env)return process.env.NEXT_PUBLIC_HANZO_EVENT_DSN||process.env.HANZO_EVENT_DSN||void 0}catch{}}function ze(e){try{if(typeof process<"u"&&process.env)return process.env[e]||void 0}catch{}}function Et(e,t,n){return e+(e.includes("?")?"&":"?")+t+"="+encodeURIComponent(n)}function ir(e){let t=Ue(e);return{type:t.name,message:t.message,stack:t.stack}}var Y=()=>typeof window<"u"&&typeof document<"u";function sr(e){try{return JSON.stringify({batch:e})}catch{}let t=[];for(let n of e)try{t.push(JSON.stringify(n))}catch{try{t.push(JSON.stringify({...n,properties:{$unserializable:!0}}))}catch{}}return t.length>0?'{"batch":['+t.join(",")+"]}":null}var or=class{send(e,t,n){if(n.beacon&&Y()&&typeof navigator.sendBeacon=="function"){let m=n.ingestKey?Et(e,"ingest_key",n.ingestKey):e;try{if(navigator.sendBeacon(m,new Blob([t],{type:At})))return;n.debug&&console.warn("[event] beacon refused, falling back to fetch")}catch{}}if(typeof fetch!="function")return;let i=n.ingestKey!==void 0&&n.contentType===void 0,o={"Content-Type":i?At:n.contentType??"application/json"},d=i?void 0:n.ingestKey??n.token;d&&(o.Authorization=`Bearer ${d}`),fetch(i?Et(e,"ingest_key",n.ingestKey):e,{method:"POST",headers:o,body:t,keepalive:!0,credentials:i?"omit":"include"}).then(m=>{!m.ok&&n.debug&&console.warn("[event] ingest rejected",m.status,e.split("?")[0])}).catch(m=>{n.debug&&console.warn("[event] ingest failed",e.split("?")[0],m)})}},bt=class{constructor(e){this.queue=[],this.timer=null,this.attribution={utm:{}},this.cohort={},this.started=!1,this.reentrant=!1,this.cfg={host:Nt,batchSize:20,flushIntervalMs:5e3,enabled:!0,captureErrors:!0,...e,ingestKey:e.ingestKey??ze("NEXT_PUBLIC_PUBLISHABLE_KEY")??hn()},this.transport=e.transport??new or,this.dsn=mt(e.dsn??yt()??at(this.cfg.product,this.cfg.ingestKey))}adopt(e){e.ingestKey&&!this.cfg.ingestKey&&(this.cfg.ingestKey=e.ingestKey),e.getToken&&!this.cfg.getToken&&(this.cfg.getToken=e.getToken),this.dsn||(this.dsn=mt(e.dsn??yt()??at(this.cfg.product,this.cfg.ingestKey)))}get errorPlaneEnabled(){return this.dsn!==null}get errorIngestUrl(){var e;return(e=this.dsn)==null?void 0:e.ingestUrl}init(){if(this.started||!this.cfg.enabled||(this.started=!0,!Y()))return;let e=an(window.location.search,document.referrer);this.attribution=cn(e)?tr(e):Pt()??e,this.cohort=ht({channel:this.attribution.channel??_t(this.attribution),refCode:this.attribution.refCode});let t=()=>{document.visibilityState==="hidden"&&this.flush(!0)};window.addEventListener("visibilitychange",t),window.addEventListener("pagehide",()=>this.flush(!0)),this.cfg.captureErrors&&(window.addEventListener("error",n=>{this.captureError(n.error??n.message,{handled:!1})}),window.addEventListener("unhandledrejection",n=>{this.captureError(n.reason,{handled:!1})}))}identify(e,t){this.personId=e,this.enqueue("identify",void 0,{properties:t})}group(e,t){this.enqueue("group",void 0,{groupId:e,properties:t})}pageview(e,t){let n=e??(Y()?window.location.pathname:void 0),i=(n??"")+"\0"+(Y()?window.location.href:"");i!==this.counted&&(this.counted=i,this.enqueue("pageview",B,{path:n,properties:t}))}capture(e,t,n){this.enqueue("event",e,{properties:t,...n})}captureError(e,t){if(!this.reentrant){this.reentrant=!0;try{try{this.sendError(e,t)}catch{}try{let n=(t==null?void 0:t.handled)??!0,i=ir(e);i.handled=n,this.enqueue("event",te,{error:i,properties:{...t==null?void 0:t.properties,...Qn(e,{handled:n,id:ue(),level:t==null?void 0:t.level})}}),this.flush()}catch{}}finally{this.reentrant=!1}}}setCohort(e){this.cohort=ht(e)}flush(e=!1){var m,g,E;if(!this.cfg.enabled||this.queue.length===0)return;let t=this.queue;this.queue=[],this.clearTimer();let n=((g=(m=this.cfg).getToken)==null?void 0:g.call(m))??void 0,i=n?void 0:((E=this.cfg.ingestKey)==null?void 0:E.trim())||void 0,o=e&&!n,d=sr(t);if(d===null){this.cfg.debug&&console.debug("[event] flush \u2192 dropped, batch unserializable");return}this.cfg.debug&&console.debug("[event] flush \u2192",pt,t.length),this.transport.send(this.cfg.host+pt,d,{beacon:o,token:n,ingestKey:i,debug:this.cfg.debug})}sendError(e,t){if(!this.cfg.enabled||!this.dsn)return;let n=Gn({error:e,options:t,identity:this.errorIdentity(),capturePII:this.cfg.capturePII??!1}),i=Vn(n,this.dsn);this.cfg.debug&&console.debug("[event] error \u2192",this.dsn.ingestUrl,n.event_id),this.transport.send(this.dsn.ingestUrl,i,{beacon:!1,contentType:rr,debug:this.cfg.debug})}errorIdentity(){return{userId:this.personId??gt(),sessionId:ft(),product:this.cfg.product,release:this.cfg.release??ze("NEXT_PUBLIC_HANZO_RELEASE"),environment:this.cfg.environment??ze("NODE_ENV")}}enqueue(e,t,n){this.cfg.enabled&&(this.started||this.init(),this.queue.push(this.build(e,t,n)),this.queue.length>=this.cfg.batchSize?this.flush():this.schedule())}build(e,t,n){let i=gt(),o={messageId:ue(),type:e,event:t,timestamp:new Date().toISOString(),distinctId:this.personId??i,anonymousId:i,personId:this.personId,sessionId:ft(),product:this.cfg.product,referrer:this.attribution.referrer,utm:this.attribution.utm,refCode:this.cohort.refCode??this.attribution.refCode,channel:this.cohort.channel??this.attribution.channel,signupWeek:this.cohort.signupWeek,url:Y()?window.location.href:void 0,path:Y()?window.location.pathname:void 0,library:"@hanzo/event",libraryVersion:St,...n},d=this.cfg.capturePII??!1;return o.url&&(o.url=de(o.url,d)),o.path&&(o.path=de(o.path,d)),o.referrer&&(o.referrer=de(o.referrer,d)),o}schedule(){this.timer||!this.cfg.enabled||(this.timer=setTimeout(()=>{this.timer=null,this.flush()},this.cfg.flushIntervalMs))}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}},vt=Symbol.for("hanzo.event.clients");function ar(){let e=globalThis,t=e[vt];if(t)return t;let n=new Map;return e[vt]=n,n}function Ot(e){if(!Y()||e.enabled===!1)return new bt(e);let t=(e.host??Nt)+"\0"+e.product,n=ar(),i=n.get(t);if(i)return i.adopt(e),i;let o=new bt(e);return n.set(t,o),o}var wr={signup:{label:"Signup",event:p.SIGNUP_COMPLETED,funnelId:"signup",funnel:Z("signup")},sale:{label:"Sale",event:p.ORDER_COMPLETED,funnelId:"upgrade",funnel:Z("upgrade"),filter:{property:"kind",equals:"plan"}},upgradeIntent:{label:"Upgrade Intent",event:p.PLAN_CLICKED,funnelId:"upgrade",funnel:Z("upgrade")},activation:{label:"Activation",event:p.FIRST_ACTION,funnelId:"apiActivation",funnel:Z("apiActivation")}};var ve="https://api.hanzo.ai";var Rt=void 0;var Lr=60*1e3;var $={insights:"hanzo_insights_enabled",training:"hanzo_share_training",onboarded:"hanzo_onboarded"},Be=globalThis.browser??globalThis.chrome;function Mt(){var e,t,n,i;return((t=(e=globalThis.chrome)==null?void 0:e.storage)==null?void 0:t.local)??((i=(n=globalThis.browser)==null?void 0:n.storage)==null?void 0:i.local)}function zt(e){return new Promise(t=>{let n=Mt();if(!n)return t({});try{n.get(e,i=>t(i||{}))}catch{t({})}})}function Dt(e){return new Promise(t=>{let n=Mt();if(!n)return t();try{n.set(e,()=>t())}catch{t()}})}async function Ut(){var e,t;try{let n=await((t=(e=Be==null?void 0:Be.runtime)==null?void 0:e.sendMessage)==null?void 0:t.call(e,{action:"auth.getToken"}));return(n==null?void 0:n.token)??null}catch{return null}}function Bt(e){return{insights:e[$.insights]!==!1,shareTraining:e[$.training]===!0}}async function We(){let e=Bt(await zt([$.insights,$.training])),t=await Ut();if(!t)return e;try{let n=await fetch(`${ve}/v1/iam/consent`,{headers:{authorization:`Bearer ${t}`}});if(n.ok){let i=await n.json(),o={insights:i.insights!==!1,shareTraining:i.shareTraining===!0};return await Dt({[$.insights]:o.insights,[$.training]:o.shareTraining}),o}}catch{}return e}async function Ke(e){let t=Bt(await zt([$.insights,$.training])),n={insights:e.insights??t.insights,shareTraining:e.shareTraining??t.shareTraining};await Dt({[$.insights]:n.insights,[$.training]:n.shareTraining});let i=await Ut();if(i)try{await fetch(`${ve}/v1/iam/consent`,{method:"PUT",headers:{"content-type":"application/json",authorization:`Bearer ${i}`},body:JSON.stringify(n),keepalive:!0}).catch(()=>{})}catch{}}function cr(){if(typeof navigator>"u")return!0;let e=navigator,t=e.doNotTrack??e.msDoNotTrack;return!(t==="1"||t==="yes"||e.globalPrivacyControl)}var $e=null;function lr(){return $e||($e=Ot({product:"extension",host:ve,ingestKey:Rt,captureErrors:!1})),$e}async function $t(e,t){try{if(!cr()||!(await We()).insights)return;let i=lr();i.capture(e,t),i.flush(!0)}catch{}}document.addEventListener("DOMContentLoaded",()=>{var Ze,be,Ye,Je,Xe,Qe,et;let e=document.getElementById("login-section"),t=document.getElementById("main-section"),n=document.getElementById("settings-section"),i=document.getElementById("footer-version");if(i)try{i.textContent=`v${chrome.runtime.getManifest().version}`}catch{}let o=document.getElementById("login-btn"),d=document.getElementById("logout-btn"),m=document.getElementById("open-panel"),g=document.getElementById("open-page-overlay"),E=document.getElementById("pin-left"),_=document.getElementById("pin-right"),T=document.getElementById("overlay-enabled"),z=Array.from(document.querySelectorAll(".width-btn")),W=document.getElementById("overlay-side-row"),K=document.getElementById("overlay-width-row");function ge(r,s,a){T&&(T.checked=r),E==null||E.setAttribute("data-active",s==="left"?"true":"false"),_==null||_.setAttribute("data-active",s==="right"?"true":"false"),z.forEach(c=>c.setAttribute("data-active",c.getAttribute("data-width")===a?"true":"false")),[W,K].forEach(c=>{c&&(c.style.opacity=r?"1":"0.5",c.style.pointerEvents=r?"":"none")})}let fe=document.getElementById("zap-status"),_e=document.getElementById("zap-detail"),he=document.getElementById("zap-pair"),pe=document.getElementById("zap-code"),J=document.getElementById("zap-pair-error"),l=document.getElementById("mcp-status"),u=document.getElementById("mcp-port"),h=document.getElementById("cdp-status"),A=document.getElementById("cdp-detail"),w=document.getElementById("gpu-status"),P=document.getElementById("gpu-detail"),S=document.getElementById("open-settings"),f=document.getElementById("back-btn"),I=document.getElementById("save-settings"),b=document.getElementById("test-connection"),C=document.getElementById("user-info-section");function j(){t.classList.remove("hidden"),Te(),chrome.runtime.sendMessage({action:"auth.status"},r=>{if(!chrome.runtime.lastError)if(r!=null&&r.success&&r.authenticated){if(e.classList.add("hidden"),C==null||C.classList.remove("hidden"),r.user){let s=document.getElementById("user-avatar"),a=document.getElementById("user-name"),c=document.getElementById("user-email");s.src=r.user.picture||r.user.avatar||"icon48.png",a.textContent=r.user.name||r.user.displayName||"Hanzo User",c.textContent=r.user.email||""}}else e.classList.remove("hidden"),C==null||C.classList.add("hidden")})}o==null||o.addEventListener("click",()=>{o.disabled=!0,o.textContent="Signing in...",chrome.runtime.sendMessage({action:"auth.login"},r=>{o.disabled=!1,o.textContent="Sign in",r!=null&&r.success&&j()})});let N=document.getElementById("signup-btn-popup");N==null||N.addEventListener("click",()=>{chrome.runtime.sendMessage({action:"auth.signup"})}),d==null||d.addEventListener("click",()=>{chrome.runtime.sendMessage({action:"auth.logout"},()=>{e.classList.remove("hidden"),C==null||C.classList.add("hidden")})});let G=document.getElementById("search-form"),xe=document.getElementById("search-input");G==null||G.addEventListener("submit",r=>{r.preventDefault();let s=xe==null?void 0:xe.value.trim(),a=s?chrome.runtime.getURL("newtab.html")+"?q="+encodeURIComponent(s):chrome.runtime.getURL("newtab.html");chrome.tabs.create({url:a}),window.close()});function He(){chrome.tabs.create({url:chrome.runtime.getURL("sidebar.html")}),window.close()}m==null||m.addEventListener("click",()=>{var r,s,a;(a=(s=(r=chrome.storage)==null?void 0:r.sync)==null?void 0:s.get)==null||a.call(s,["overlayEnabled","overlaySide","overlayWidth"],c=>{let y=(c==null?void 0:c.overlayEnabled)!==!1,k=(c==null?void 0:c.overlaySide)==="left"?"left":"right",O=(c==null?void 0:c.overlayWidth)==="compact"?"compact":(c==null?void 0:c.overlayWidth)==="wide"?"wide":"default";if(!y){He();return}chrome.tabs.query({active:!0,currentWindow:!0},L=>{let U=L[0],M=Ae(U)?U:null;if(!(M!=null&&M.id)){He();return}chrome.runtime.sendMessage({action:"page.overlay.show",tabId:M.id,side:k,width:O},()=>window.close())})})});function Fe(r){var s,a,c;(c=(a=(s=chrome.storage)==null?void 0:s.sync)==null?void 0:a.set)==null||c.call(a,{overlaySide:r}),E==null||E.setAttribute("data-active",r==="left"?"true":"false"),_==null||_.setAttribute("data-active",r==="right"?"true":"false"),chrome.tabs.query({active:!0,currentWindow:!0},y=>{var O;let k=(O=y[0])==null?void 0:O.id;k&&chrome.runtime.sendMessage({action:"page.overlay.setSide",tabId:k,side:r})})}function Wt(r){var s,a,c;(c=(a=(s=chrome.storage)==null?void 0:s.sync)==null?void 0:a.set)==null||c.call(a,{overlayWidth:r}),z.forEach(y=>y.setAttribute("data-active",y.getAttribute("data-width")===r?"true":"false")),chrome.tabs.query({active:!0,currentWindow:!0},y=>{var O;let k=(O=y[0])==null?void 0:O.id;k&&chrome.runtime.sendMessage({action:"page.overlay.setWidth",tabId:k,width:r})})}function Kt(r){var s,a,c,y,k,O;(c=(a=(s=chrome.storage)==null?void 0:s.sync)==null?void 0:a.set)==null||c.call(a,{overlayEnabled:r}),chrome.tabs.query({active:!0,currentWindow:!0},L=>{var M;let U=(M=L[0])==null?void 0:M.id;U&&chrome.runtime.sendMessage({action:"page.overlay.setEnabled",tabId:U,enabled:r})}),(O=(k=(y=chrome.storage)==null?void 0:y.sync)==null?void 0:k.get)==null||O.call(k,["overlaySide","overlayWidth"],L=>{let U=(L==null?void 0:L.overlaySide)==="left"?"left":"right",M=(L==null?void 0:L.overlayWidth)==="compact"?"compact":(L==null?void 0:L.overlayWidth)==="wide"?"wide":"default";ge(r,U,M)})}E==null||E.addEventListener("click",()=>Fe("left")),_==null||_.addEventListener("click",()=>Fe("right")),z.forEach(r=>r.addEventListener("click",()=>{let s=r.getAttribute("data-width");(s==="compact"||s==="default"||s==="wide")&&Wt(s)})),T==null||T.addEventListener("change",r=>{Kt(r.target.checked)}),(Ye=(be=(Ze=chrome.storage)==null?void 0:Ze.sync)==null?void 0:be.get)==null||Ye.call(be,["overlayEnabled","overlaySide","overlayWidth"],r=>{let s=(r==null?void 0:r.overlayEnabled)!==!1,a=(r==null?void 0:r.overlaySide)==="left"?"left":"right",c=(r==null?void 0:r.overlayWidth)==="compact"?"compact":(r==null?void 0:r.overlayWidth)==="wide"?"wide":"default";ge(s,a,c)});let re=document.getElementById("insights-enabled"),ie=document.getElementById("share-training");We().then(r=>{re&&(re.checked=r.insights),ie&&(ie.checked=r.shareTraining)}),re==null||re.addEventListener("change",r=>{Ke({insights:r.target.checked})}),ie==null||ie.addEventListener("change",r=>{Ke({shareTraining:r.target.checked})}),$t("popup_opened");function Ae(r){if(!r||!r.id)return!1;let s=r.url||"";return!(!s||s.startsWith("chrome://")||s.startsWith("chrome-extension://")||s.startsWith("devtools://")||s.startsWith("edge://")||s.startsWith("about:")||s.startsWith("view-source:")||s.startsWith("moz-extension://"))}g==null||g.addEventListener("click",()=>{g.textContent="Opening...",g.setAttribute("disabled","true"),chrome.tabs.query({active:!0,currentWindow:!0},r=>{let s=r[0],a=Ae(s)?s:null;if(!a){chrome.tabs.query({currentWindow:!0},c=>{if(a=c.find(y=>Ae(y))||null,!(a!=null&&a.id)){g.textContent="No valid page tab",setTimeout(()=>{g.textContent="Toggle On-Page Overlay",g.removeAttribute("disabled")},1200);return}chrome.runtime.sendMessage({action:"page.overlay.toggle",tabId:a.id},y=>{if(chrome.runtime.lastError||!(y!=null&&y.success))g.textContent="Unavailable on this page";else{let k=!!(y!=null&&y.open);g.textContent=k?"Overlay Opened":"Overlay Hidden"}setTimeout(()=>{g.textContent="Toggle On-Page Overlay",g.removeAttribute("disabled")},900)})});return}if(!(a!=null&&a.id)){g.textContent="No Active Tab",setTimeout(()=>{g.textContent="Toggle On-Page Overlay",g.removeAttribute("disabled")},1200);return}chrome.runtime.sendMessage({action:"page.overlay.toggle",tabId:a.id},c=>{if(chrome.runtime.lastError||!(c!=null&&c.success))g.textContent="Unavailable on this page";else{let y=!!(c!=null&&c.open);g.textContent=y?"Overlay Opened":"Overlay Hidden"}setTimeout(()=>{g.textContent="Toggle On-Page Overlay",g.removeAttribute("disabled")},900)})})});function V(r,s,a,c){r.classList.toggle("connected",a),r.classList.toggle("disconnected",!a),s.textContent=c}(Je=document.getElementById("zap-pair-btn"))==null||Je.addEventListener("click",()=>{J.textContent="",chrome.runtime.sendMessage({action:"zap.pair",code:pe.value},r=>{if(!chrome.runtime.lastError){if(!(r!=null&&r.success)){J.textContent=(r==null?void 0:r.error)||"Pairing failed";return}pe.value="",setTimeout(Te,800)}})});function Te(){chrome.runtime.sendMessage({action:"zap.status"},r=>{var s;if(!chrome.runtime.lastError&&r!=null&&r.success){let a=r.zap,c=a.connected?`${((s=a.caps)==null?void 0:s.length)||0} tools`:a.paired?a.error==="no-router"?"No router \u2014 start hanzo-mcp":a.error==="mismatch"?"Pairing mismatch \u2014 pair again":a.error==="refused"?"Router refused this browser":"Connecting\u2026":"Not paired";V(fe,_e,a.connected,c),he.hidden=a.connected||a.paired&&a.error!=="mismatch"}}),chrome.runtime.sendMessage({action:"bridge.status"},r=>{if(!chrome.runtime.lastError)if(r!=null&&r.success&&r.connected){let s=r.browsers||[];V(h,A,!0,(s.length,"Connected"))}else V(h,A,!1,"Not connected")}),chrome.storage.local.get(["mcpBridgePort"],r=>{let s=Number(r.mcpBridgePort)||9224,a=`http://localhost:${s}`,c=()=>V(l,u,!1,`:${s} offline`);try{fetch(a,{signal:AbortSignal.timeout(2e3)}).then(y=>y.json()).then(y=>{(y==null?void 0:y.service)==="hanzo.browser"?V(l,u,!0,`:${s} OK`):V(l,u,!1,`:${s} N/A`)}).catch(c)}catch{c()}}),chrome.runtime.sendMessage({action:"runLocalAI",prompt:""},r=>{chrome.runtime.lastError||V(w,P,!!(r!=null&&r.success),r!=null&&r.success?"Available":"Not available")})}S==null||S.addEventListener("click",()=>{t.classList.add("hidden"),n.classList.remove("hidden"),Ht()}),f==null||f.addEventListener("click",()=>{n.classList.add("hidden"),t.classList.remove("hidden")});function Ht(){chrome.storage.local.get(["mcpPort","cdpPort"],r=>{let s=document.getElementById("mcp-port-setting"),a=document.getElementById("cdp-port-setting");s&&(s.value=String(r.mcpPort||3001)),a&&(a.value=String(r.cdpPort||9223))}),oe()}let ye=!1,se=null;async function oe(){let r=document.getElementById("inspect-shortcut-display"),s=document.getElementById("inspect-shortcut-current"),a=await ot(chrome.storage.local),c=it(a);r&&(r.textContent=c),s&&(s.textContent=c)}oe();function je(r){ye||(ye=!0,r.textContent="Press a key\u2026",se=async s=>{s.preventDefault(),s.stopPropagation();let a=st(s);if(!a){we();return}await Le(chrome.storage.local,a),we(),oe()},document.addEventListener("keydown",se,{capture:!0}),setTimeout(()=>{ye&&we()},1e4))}function we(){se&&document.removeEventListener("keydown",se,{capture:!0}),se=null,ye=!1,oe()}(Xe=document.getElementById("record-inspect-shortcut"))==null||Xe.addEventListener("click",r=>{r.preventDefault();let s=document.getElementById("inspect-shortcut-display");s&&je(s)}),(Qe=document.getElementById("inspect-shortcut-record"))==null||Qe.addEventListener("click",r=>{r.preventDefault();let s=document.getElementById("inspect-shortcut-current");s&&je(s)}),(et=document.getElementById("inspect-shortcut-reset"))==null||et.addEventListener("click",async r=>{r.preventDefault(),await Le(chrome.storage.local,{...Ce}),oe()}),I==null||I.addEventListener("click",()=>{var a,c;let r=parseInt((a=document.getElementById("mcp-port-setting"))==null?void 0:a.value)||3001,s=parseInt((c=document.getElementById("cdp-port-setting"))==null?void 0:c.value)||9223;chrome.storage.local.set({mcpPort:r,cdpPort:s},()=>{I.textContent="Saved!",setTimeout(()=>{I.textContent="Save Settings"},1500)})}),b==null||b.addEventListener("click",()=>{b.textContent="Testing...",b.disabled=!0,Te(),b.textContent="Test Connection",b.disabled=!1}),["source-maps","webgpu-ai","browser-control","tab-filesystem"].forEach(r=>{let s=document.getElementById(r);s&&(chrome.storage.local.get([r],a=>{s.checked=a[r]!==!1}),s.addEventListener("change",()=>{chrome.storage.local.set({[r]:s.checked})}))});let X=document.getElementById("browser-backend"),R=document.getElementById("bridge-status"),Ge=document.getElementById("bridge-detail");function Ft(){chrome.storage.sync.get(["browserBackend"],r=>{X&&r.browserBackend&&(X.value=r.browserBackend)})}function jt(){chrome.runtime.sendMessage({action:"bridge.status"},r=>{if(!chrome.runtime.lastError)if(r!=null&&r.success&&r.connected){R==null||R.classList.add("connected"),R==null||R.classList.remove("disconnected");let s=r.browsers||[];Ge.textContent=s.length?`Connected: ${s.join(", ")}`:"Connected"}else R==null||R.classList.remove("connected"),R==null||R.classList.add("disconnected"),Ge.textContent="Not connected"})}X==null||X.addEventListener("change",()=>{let r=X.value;chrome.storage.sync.set({browserBackend:r}),chrome.runtime.sendMessage({action:"config.save",key:"browserBackend",value:r})}),Ft(),jt();function x(r,s,a=1200){let c=document.createElement("div");c.className="tool-feedback",c.textContent=s,r.style.position="relative",r.appendChild(c),setTimeout(()=>c.remove(),a)}function ae(){return new Promise(r=>{chrome.tabs.query({active:!0,currentWindow:!0},s=>{r(s[0]&&Ae(s[0])?s[0]:null)})})}let Q=document.getElementById("tool-picker");Q==null||Q.addEventListener("click",async()=>{let r=await ae();if(!(r!=null&&r.id)){x(Q,"No page");return}chrome.tabs.sendMessage(r.id,{action:"tool.picker.start"},s=>{if(chrome.runtime.lastError||!(s!=null&&s.success)){x(Q,"N/A");return}x(Q,"Pick..."),setTimeout(()=>window.close(),400)})});let D=document.getElementById("tool-screenshot");D==null||D.addEventListener("click",async()=>{D.setAttribute("disabled","true");try{chrome.tabs.captureVisibleTab(null,{format:"png"},r=>{if(chrome.runtime.lastError||!r){x(D,"Failed"),D.removeAttribute("disabled");return}fetch(r).then(s=>s.blob()).then(s=>{let a=new ClipboardItem({"image/png":s});return navigator.clipboard.write([a])}).then(()=>{x(D,"Copied!")}).catch(()=>{chrome.tabs.create({url:r}),x(D,"Opened")}).finally(()=>{D.removeAttribute("disabled")})})}catch{x(D,"Error"),D.removeAttribute("disabled")}});let q=document.getElementById("tool-pageinfo");q==null||q.addEventListener("click",async()=>{let r=await ae();if(!(r!=null&&r.id)){x(q,"No page");return}chrome.tabs.sendMessage(r.id,{action:"tool.pageinfo"},s=>{if(chrome.runtime.lastError||!(s!=null&&s.success)){let a=`Title: ${r.title}
7
+ URL: ${r.url}`;navigator.clipboard.writeText(a).then(()=>{x(q,"Copied!")});return}navigator.clipboard.writeText(s.info).then(()=>{x(q,"Copied!")}).catch(()=>{x(q,"Failed")})})});let H=document.getElementById("tool-accessibility");H==null||H.addEventListener("click",async()=>{let r=await ae();if(!(r!=null&&r.id)){x(H,"No page");return}H.setAttribute("disabled","true"),x(H,"Running..."),chrome.runtime.sendMessage({action:"audit.accessibility",tabId:r.id},s=>{var c;if(H.removeAttribute("disabled"),chrome.runtime.lastError||!(s!=null&&s.success)){x(H,"Failed");return}let a=((c=s.issues)==null?void 0:c.length)||0;x(H,a?`${a} issues`:"Clean!")})});let F=document.getElementById("tool-performance");F==null||F.addEventListener("click",async()=>{let r=await ae();if(!(r!=null&&r.id)){x(F,"No page");return}F.setAttribute("disabled","true"),x(F,"Running..."),chrome.runtime.sendMessage({action:"audit.performance",tabId:r.id},s=>{if(F.removeAttribute("disabled"),chrome.runtime.lastError||!(s!=null&&s.success)){x(F,"Failed");return}x(F,"Done")})});let ee=document.getElementById("tool-console");ee==null||ee.addEventListener("click",async()=>{let r=await ae();if(!(r!=null&&r.id)){x(ee,"No page");return}chrome.tabs.sendMessage(r.id,{action:"tool.console.start"},s=>{if(chrome.runtime.lastError||!(s!=null&&s.success)){x(ee,"N/A");return}x(ee,"Open"),setTimeout(()=>window.close(),400)})});let ce=document.getElementById("usage-list"),Ie=document.getElementById("usage-refresh"),Ee=r=>r.replace(/[&<>"]/g,s=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[s]);function Gt(r){if(!r)return"";let s=new Date(r).getTime()-Date.now();if(!Number.isFinite(s))return"";if(s<=0)return"resets now";let a=Math.round(s/6e4);if(a<60)return`resets in ${a}m`;let c=Math.round(a/60);return c<24?`resets in ${c}h`:`resets in ${Math.round(c/24)}d`}function Ve(r,s,a){if(!s||typeof s.usedPercent!="number")return"";let c=Math.max(0,Math.min(100,Math.round(s.usedPercent)));return`
8
+ <div class="usage-lane" style="display:flex;align-items:center;gap:8px;font-size:11px;margin-top:4px;">
9
+ <span style="width:52px;color:var(--text-muted,#888);">${r}</span>
10
+ <span style="flex:1;height:6px;border-radius:3px;background:var(--surface-2,#222);overflow:hidden;">
11
+ <span style="display:block;height:100%;width:${c}%;background:${a||"var(--accent,#d97757)"};"></span>
12
+ </span>
13
+ <span style="width:34px;text-align:right;">${c}%</span>
14
+ </div>`}function Vt(r){ce&&(ce.innerHTML=r.map(s=>{var y,k,O,L,U,M;let a=s.error?`<div style="font-size:11px;color:var(--text-muted,#888);margin-top:4px;">${Ee(s.error)}</div>`:`${Ve("Session",(y=s.snapshot)==null?void 0:y.primary,s.color)}${Ve("Weekly",(k=s.snapshot)==null?void 0:k.secondary,s.color)}
15
+ <div style="font-size:10px;color:var(--text-muted,#888);margin-top:3px;">${Ee(Gt((L=(O=s.snapshot)==null?void 0:O.primary)==null?void 0:L.resetsAt))}</div>`,c=(M=(U=s.snapshot)==null?void 0:U.identity)==null?void 0:M.plan;return`
16
+ <div class="usage-row" style="padding:8px;border:1px solid var(--border,#2a2a2a);border-radius:8px;">
17
+ <div style="display:flex;align-items:center;gap:6px;">
18
+ <span style="width:8px;height:8px;border-radius:50%;background:${s.color||"#888"};"></span>
19
+ <strong style="font-size:12px;">${Ee(s.displayName)}</strong>
20
+ ${c?`<span style="font-size:10px;color:var(--text-muted,#888);">${Ee(c)}</span>`:""}
21
+ </div>
22
+ ${a}
23
+ </div>`}).join(""))}function qe(){ce&&(ce.innerHTML='<div style="font-size:11px;color:var(--text-muted,#888);">Loading\u2026</div>',chrome.runtime.sendMessage({action:"usage.fetch"},r=>{if(chrome.runtime.lastError||!(r!=null&&r.success)){ce.innerHTML='<div style="font-size:11px;color:var(--text-muted,#888);">Usage unavailable</div>';return}Vt(r.providers)}))}Ie==null||Ie.addEventListener("click",qe),qe(),j()});})();
24
+ /*! Bundled license information:
25
+
26
+ @hanzo/event/dist/index.mjs:
27
+ (*! anon.js — THE anonymous-identity chain. ONE implementation, two distributions.
28
+ *
29
+ * One browser is ONE person on every Hanzo surface, whichever client a page
30
+ * happens to have loaded. There were once three implementations writing TWO keys —
31
+ * `hz_anon_id` and `hz_id` — so the same visitor was several people depending on
32
+ * which snippet the surface shipped.
33
+ *
34
+ * The two call sites:
35
+ * 1. src/storage.ts — the bundled npm client; IMPORTS this file.
36
+ * 2. hanzoai/cloud apps/analytics/tag.js — the tag served at
37
+ * /v1/event.js; vendors this file and its tag.go serves the marked region
38
+ * with the tag as one asset, so cloud holds no second copy either.
39
+ *
40
+ * (2) has no bundler and cannot import anything, which is why the chain lives in a
41
+ * file that is plain ES5 rather than in a .ts: the region between the BEGIN and END
42
+ * markers is COPIED VERBATIM. Keep it ES5, dependency-free, `hz`-prefixed (it is
43
+ * spliced into other people's scopes) and unformatted — a reformat here is a diff
44
+ * against the vendored copy. After editing, resync that copy:
45
+ *
46
+ * curl -fsSL https://unpkg.com/@hanzo/event/src/anon.js -o apps/analytics/anon.js
47
+ *)
48
+ */