hermesbuttons 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,398 @@
1
+ var b=`<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon">
2
+ <!-- Wing helmet -->
3
+ <path d="M12 2C8.5 2 6 4.5 6 7c0 1.5.5 2.8 1.5 3.8L6 14h12l-1.5-3.2C17.5 9.8 18 8.5 18 7c0-2.5-2.5-5-6-5z" fill="currentColor" opacity="0.2"/>
4
+ <path d="M12 2C8.5 2 6 4.5 6 7c0 1.5.5 2.8 1.5 3.8L6 14h12l-1.5-3.2C17.5 9.8 18 8.5 18 7c0-2.5-2.5-5-6-5z" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linejoin="round"/>
5
+ <!-- Wings -->
6
+ <path d="M6 6.5C4.5 5 2 5 2 7s1.5 3 3 3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
7
+ <path d="M18 6.5C19.5 5 22 5 22 7s-1.5 3-3 3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
8
+ <!-- Caduceus staff -->
9
+ <line x1="12" y1="14" x2="12" y2="22" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
10
+ <!-- Snakes -->
11
+ <path d="M9.5 16c1.5 1 3.5 1 5 0" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" fill="none"/>
12
+ <path d="M9.5 19c1.5 1 3.5 1 5 0" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" fill="none"/>
13
+ <!-- Eye -->
14
+ <circle cx="12" cy="7.5" r="1.5" fill="currentColor"/>
15
+ </svg>`,m=`<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon">
16
+ <!-- Brain/memory symbol -->
17
+ <path d="M12 3C8 3 5 6 5 9c0 2 1 3.5 2 4.5V16a2 2 0 002 2h6a2 2 0 002-2v-2.5c1-1 2-2.5 2-4.5 0-3-3-6-7-6z" fill="currentColor" opacity="0.15"/>
18
+ <path d="M12 3C8 3 5 6 5 9c0 2 1 3.5 2 4.5V16a2 2 0 002 2h6a2 2 0 002-2v-2.5c1-1 2-2.5 2-4.5 0-3-3-6-7-6z" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linejoin="round"/>
19
+ <!-- Neural connections -->
20
+ <path d="M9 9.5c0-1 .5-2 1.5-2.5M15 9.5c0-1-.5-2-1.5-2.5M10.5 11c.5.5 1.5 1 3 0" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" fill="none"/>
21
+ <!-- Growing roots -->
22
+ <path d="M9 18v2M12 18v3M15 18v2" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
23
+ <!-- Sparkle -->
24
+ <circle cx="8" cy="6" r="0.8" fill="currentColor"/>
25
+ <circle cx="16" cy="6" r="0.8" fill="currentColor"/>
26
+ </svg>`,n=`<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon-sm">
27
+ <rect x="5" y="5" width="8" height="8" rx="1.5" stroke="currentColor" stroke-width="1.5" fill="none"/>
28
+ <path d="M3 10V3.5A1.5 1.5 0 014.5 2H10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
29
+ </svg>`,x=`<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon-sm">
30
+ <path d="M3 8.5l3.5 3.5L13 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
31
+ </svg>`;var u=`<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon-sm">
32
+ <path d="M4 4l8 8m0-8l-8 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
33
+ </svg>`;var d="#7C3AED",l="#6D28D9",E="#5B21B6",g="#14B8A6",p={branded:{bg:d,text:"#FFFFFF",border:"transparent",surface:"#FFFFFF",surfaceText:"#1A1025",muted:"#7C7589",primary:d,primaryText:"#FFFFFF",codeBg:"#1A1025",codeText:"#F3EEFF"},"branded-alt":{bg:g,text:"#FFFFFF",border:"transparent",surface:"#FFFFFF",surfaceText:"#1A1025",muted:"#7C7589",primary:g,primaryText:"#FFFFFF",codeBg:"#1A1025",codeText:"#F3EEFF"},dark:{bg:"#1A1025",text:"#F3EEFF",border:"#2D2440",surface:"#231A35",surfaceText:"#F3EEFF",muted:"#9F95B0",primary:d,primaryText:"#FFFFFF",codeBg:"#0F0A18",codeText:"#F3EEFF"},light:{bg:"#FFFFFF",text:"#1A1025",border:"#E8E0F0",surface:"#FAF8FF",surfaceText:"#1A1025",muted:"#7C7589",primary:d,primaryText:"#FFFFFF",codeBg:"#1A1025",codeText:"#F3EEFF"}};function s(r){return r!=="system"?p[r]:typeof window>"u"?p.light:window.matchMedia("(prefers-color-scheme: dark)").matches?p.dark:p.light}function v(r){return`
34
+ --hb-bg: ${r.bg};
35
+ --hb-text: ${r.text};
36
+ --hb-border: ${r.border};
37
+ --hb-surface: ${r.surface};
38
+ --hb-surface-text: ${r.surfaceText};
39
+ --hb-muted: ${r.muted};
40
+ --hb-primary: ${r.primary};
41
+ --hb-primary-text: ${r.primaryText};
42
+ --hb-code-bg: ${r.codeBg};
43
+ --hb-code-text: ${r.codeText};
44
+ `}var M={rounded:{sm:"0.375rem",md:"0.5rem",lg:"0.625rem"},pill:{sm:"999px",md:"999px",lg:"999px"},square:{sm:"0",md:"0",lg:"0"}},_={sm:{height:"2rem",fontSize:"0.75rem",iconSize:"0.875rem",padding:"0 0.75rem",ccPadding:"0 0.5rem",gap:"0.375rem",radius:"0.375rem"},md:{height:"2.5rem",fontSize:"0.875rem",iconSize:"1.125rem",padding:"0 1rem",ccPadding:"0 0.75rem",gap:"0.5rem",radius:"0.5rem"},lg:{height:"3rem",fontSize:"1rem",iconSize:"1.375rem",padding:"0 1.25rem",ccPadding:"0 1rem",gap:"0.625rem",radius:"0.625rem"}};var F=`
45
+ :host {
46
+ position: fixed;
47
+ inset: 0;
48
+ z-index: 999999;
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
53
+ }
54
+
55
+ * { box-sizing: border-box; margin: 0; padding: 0; }
56
+
57
+ .hb-backdrop {
58
+ position: absolute;
59
+ inset: 0;
60
+ background: rgba(0, 0, 0, 0.5);
61
+ backdrop-filter: blur(4px);
62
+ -webkit-backdrop-filter: blur(4px);
63
+ animation: hb-fade-in 0.15s ease-out;
64
+ }
65
+
66
+ .hb-dialog {
67
+ position: relative;
68
+ width: 90%;
69
+ max-width: 460px;
70
+ background: var(--hb-surface);
71
+ color: var(--hb-surface-text);
72
+ border-radius: 16px;
73
+ box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--hb-border);
74
+ overflow: hidden;
75
+ animation: hb-scale-in 0.2s ease-out;
76
+ }
77
+
78
+ .hb-dialog-header {
79
+ display: flex;
80
+ align-items: center;
81
+ gap: 12px;
82
+ padding: 20px 24px 16px;
83
+ border-bottom: 1px solid var(--hb-border);
84
+ }
85
+
86
+ .hb-dialog-header-icon {
87
+ width: 36px;
88
+ height: 36px;
89
+ color: var(--hb-primary);
90
+ flex-shrink: 0;
91
+ }
92
+
93
+ .hb-dialog-header-text {
94
+ flex: 1;
95
+ min-width: 0;
96
+ }
97
+
98
+ .hb-dialog-title {
99
+ font-size: 16px;
100
+ font-weight: 600;
101
+ line-height: 1.3;
102
+ color: var(--hb-surface-text);
103
+ }
104
+
105
+ .hb-dialog-description {
106
+ font-size: 13px;
107
+ color: var(--hb-muted);
108
+ margin-top: 2px;
109
+ line-height: 1.4;
110
+ }
111
+
112
+ .hb-dialog-close {
113
+ width: 32px;
114
+ height: 32px;
115
+ display: flex;
116
+ align-items: center;
117
+ justify-content: center;
118
+ border: none;
119
+ background: transparent;
120
+ color: var(--hb-muted);
121
+ cursor: pointer;
122
+ border-radius: 8px;
123
+ flex-shrink: 0;
124
+ transition: background 0.15s, color 0.15s;
125
+ }
126
+
127
+ .hb-dialog-close:hover {
128
+ background: var(--hb-border);
129
+ color: var(--hb-surface-text);
130
+ }
131
+
132
+ .hb-dialog-close svg { width: 14px; height: 14px; }
133
+
134
+ .hb-dialog-body { padding: 20px 24px; }
135
+
136
+ .hb-step {
137
+ display: flex;
138
+ gap: 12px;
139
+ margin-bottom: 16px;
140
+ }
141
+
142
+ .hb-step:last-child { margin-bottom: 0; }
143
+
144
+ .hb-step-num {
145
+ width: 24px;
146
+ height: 24px;
147
+ border-radius: 50%;
148
+ background: var(--hb-primary);
149
+ color: var(--hb-primary-text);
150
+ font-size: 12px;
151
+ font-weight: 600;
152
+ display: flex;
153
+ align-items: center;
154
+ justify-content: center;
155
+ flex-shrink: 0;
156
+ margin-top: 1px;
157
+ }
158
+
159
+ .hb-step-content {
160
+ flex: 1;
161
+ min-width: 0;
162
+ }
163
+
164
+ .hb-step-label {
165
+ font-size: 13px;
166
+ font-weight: 500;
167
+ color: var(--hb-surface-text);
168
+ margin-bottom: 8px;
169
+ line-height: 1.4;
170
+ }
171
+
172
+ .hb-code-block {
173
+ display: flex;
174
+ align-items: center;
175
+ background: var(--hb-code-bg);
176
+ color: var(--hb-code-text);
177
+ border-radius: 10px;
178
+ padding: 2px 2px 2px 14px;
179
+ font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, monospace;
180
+ font-size: 13px;
181
+ line-height: 1.5;
182
+ gap: 8px;
183
+ overflow: hidden;
184
+ }
185
+
186
+ .hb-code-text {
187
+ flex: 1;
188
+ overflow-x: auto;
189
+ white-space: nowrap;
190
+ padding: 10px 0;
191
+ scrollbar-width: none;
192
+ }
193
+
194
+ .hb-code-text::-webkit-scrollbar { display: none; }
195
+
196
+ .hb-code-prefix {
197
+ color: var(--hb-muted);
198
+ user-select: none;
199
+ margin-right: 6px;
200
+ }
201
+
202
+ .hb-copy-btn {
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: center;
206
+ gap: 6px;
207
+ height: 36px;
208
+ min-width: 36px;
209
+ padding: 0 12px;
210
+ border: none;
211
+ background: var(--hb-primary);
212
+ color: var(--hb-primary-text);
213
+ cursor: pointer;
214
+ border-radius: 8px;
215
+ font-family: inherit;
216
+ font-size: 12px;
217
+ font-weight: 500;
218
+ flex-shrink: 0;
219
+ transition: background 0.15s, transform 0.1s;
220
+ white-space: nowrap;
221
+ }
222
+
223
+ .hb-copy-btn:hover { background: ${l}; }
224
+ .hb-copy-btn:active { transform: scale(0.96); }
225
+ .hb-copy-btn svg { width: 14px; height: 14px; }
226
+
227
+ .hb-copy-btn[data-copied="true"] {
228
+ background: #16a34a;
229
+ }
230
+
231
+ .hb-dialog-footer {
232
+ padding: 16px 24px 20px;
233
+ display: flex;
234
+ flex-direction: column;
235
+ gap: 10px;
236
+ }
237
+
238
+ .hb-action-btn {
239
+ display: flex;
240
+ align-items: center;
241
+ justify-content: center;
242
+ gap: 8px;
243
+ width: 100%;
244
+ height: 44px;
245
+ border: none;
246
+ background: var(--hb-primary);
247
+ color: var(--hb-primary-text);
248
+ cursor: pointer;
249
+ border-radius: 10px;
250
+ font-family: inherit;
251
+ font-size: 14px;
252
+ font-weight: 600;
253
+ transition: background 0.15s, transform 0.1s;
254
+ }
255
+
256
+ .hb-action-btn:hover { background: ${l}; }
257
+ .hb-action-btn:active { transform: scale(0.98); }
258
+ .hb-action-btn svg { width: 16px; height: 16px; }
259
+
260
+ .hb-hint {
261
+ font-size: 12px;
262
+ color: var(--hb-muted);
263
+ text-align: center;
264
+ line-height: 1.4;
265
+ }
266
+
267
+ .hb-hint kbd {
268
+ display: inline-block;
269
+ padding: 1px 5px;
270
+ font-family: inherit;
271
+ font-size: 11px;
272
+ background: var(--hb-border);
273
+ border-radius: 4px;
274
+ border: 1px solid var(--hb-border);
275
+ }
276
+
277
+ @keyframes hb-fade-in {
278
+ from { opacity: 0; }
279
+ to { opacity: 1; }
280
+ }
281
+
282
+ @keyframes hb-scale-in {
283
+ from { opacity: 0; transform: scale(0.95) translateY(8px); }
284
+ to { opacity: 1; transform: scale(1) translateY(0); }
285
+ }
286
+
287
+ @media (max-width: 480px) {
288
+ .hb-dialog {
289
+ width: 96%;
290
+ max-width: none;
291
+ border-radius: 14px;
292
+ max-height: 90dvh;
293
+ overflow-y: auto;
294
+ overscroll-behavior: contain;
295
+ }
296
+
297
+ .hb-dialog-header { padding: 16px 16px 12px; gap: 10px; }
298
+ .hb-dialog-header-icon { width: 28px; height: 28px; }
299
+ .hb-dialog-body { padding: 16px; }
300
+ .hb-dialog-footer { padding: 12px 16px 16px; }
301
+
302
+ .hb-step { gap: 10px; margin-bottom: 14px; }
303
+ .hb-step-num { width: 22px; height: 22px; font-size: 11px; }
304
+ .hb-step-label { font-size: 12px; margin-bottom: 6px; }
305
+
306
+ .hb-code-block { font-size: 12px; padding: 2px 2px 2px 10px; border-radius: 8px; }
307
+ .hb-copy-btn { height: 32px; padding: 0 10px; font-size: 11px; border-radius: 6px; }
308
+ .hb-action-btn { height: 40px; font-size: 13px; border-radius: 8px; }
309
+ .hb-hint { font-size: 11px; }
310
+ }
311
+
312
+ @media (max-width: 360px) {
313
+ .hb-dialog { width: 100%; border-radius: 12px 12px 0 0; align-self: flex-end; }
314
+ .hb-copy-btn span { display: none; }
315
+ .hb-copy-btn { min-width: 32px; padding: 0 8px; }
316
+ }
317
+
318
+ @supports (padding: env(safe-area-inset-bottom)) {
319
+ .hb-dialog-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
320
+ }
321
+ `,c=class extends HTMLElement{constructor(){super();this._mqCleanup=null;this.attachShadow({mode:"open"})}set options(e){this._options=e,this.render()}get options(){return this._options}disconnectedCallback(){this._mqCleanup?.(),this._mqCleanup=null}resolvePopupTokens(){let{theme:e}=this._options;if(e==="dark"||e==="light")return s(e);let t=typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches;if(e==="system")return t?s("dark"):s("light");let o=t?s("dark"):s("light"),i=s(e);return{...o,primary:i.primary,primaryText:i.primaryText}}render(){if(!this.shadowRoot||!this._options)return;let{variant:e,title:t,description:o,command:i,fullCommand:f,skillUrl:y}=this._options,k=this.resolvePopupTokens(),w=e==="hermes"?b:m,h=e==="hermes",C=f||i;this.shadowRoot.innerHTML=`
322
+ <style>${F}</style>
323
+ <div style="${v(k)}">
324
+ <div class="hb-backdrop" data-action="close"></div>
325
+ <div class="hb-dialog" role="dialog" aria-modal="true" aria-labelledby="hb-dialog-title">
326
+ <div class="hb-dialog-header">
327
+ <div class="hb-dialog-header-icon">${w}</div>
328
+ <div class="hb-dialog-header-text">
329
+ <div class="hb-dialog-title" id="hb-dialog-title">${t}</div>
330
+ ${o?`<div class="hb-dialog-description">${o}</div>`:""}
331
+ </div>
332
+ <button class="hb-dialog-close" data-action="close" aria-label="Close">${u}</button>
333
+ </div>
334
+ <div class="hb-dialog-body">
335
+ ${h?this.renderHermesTerminalBody(C):this.renderHermesSkillBody(i,y)}
336
+ </div>
337
+ <div class="hb-dialog-footer">
338
+ ${h?`
339
+ <div class="hb-hint">Press <kbd>\u2318</kbd>+<kbd>V</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd> in your terminal to run</div>
340
+ `:`
341
+ <div class="hb-hint">Press <kbd>\u2318</kbd>+<kbd>V</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd> in your Hermes session to run</div>
342
+ `}
343
+ </div>
344
+ </div>
345
+ </div>
346
+ `,this.setupListeners(),this.setupSystemThemeWatch()}renderHermesTerminalBody(e){return`
347
+ <div class="hb-step">
348
+ <div class="hb-step-num">1</div>
349
+ <div class="hb-step-content">
350
+ <div class="hb-step-label">Copy this command to your clipboard</div>
351
+ <div class="hb-code-block">
352
+ <div class="hb-code-text"><span class="hb-code-prefix">$</span>${this.escapeHtml(e)}</div>
353
+ <button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(e)}">${n}<span>Copy</span></button>
354
+ </div>
355
+ </div>
356
+ </div>
357
+ <div class="hb-step">
358
+ <div class="hb-step-num">2</div>
359
+ <div class="hb-step-content">
360
+ <div class="hb-step-label">Paste and run in your terminal</div>
361
+ </div>
362
+ </div>
363
+ `}renderHermesSkillBody(e,t){let o="";if(t){let i=`Install the skill from ${t} and run ${e}`;o+=`
364
+ <div class="hb-step">
365
+ <div class="hb-step-num">1</div>
366
+ <div class="hb-step-content">
367
+ <div class="hb-step-label">Copy this prompt to your clipboard</div>
368
+ <div class="hb-code-block">
369
+ <div class="hb-code-text">${this.escapeHtml(i)}</div>
370
+ <button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(i)}">${n}<span>Copy</span></button>
371
+ </div>
372
+ </div>
373
+ </div>
374
+ <div class="hb-step">
375
+ <div class="hb-step-num">2</div>
376
+ <div class="hb-step-content">
377
+ <div class="hb-step-label">Paste into a Hermes session \u2014 the agent will fetch the skill and set it up for you</div>
378
+ </div>
379
+ </div>
380
+ `}else o+=`
381
+ <div class="hb-step">
382
+ <div class="hb-step-num">1</div>
383
+ <div class="hb-step-content">
384
+ <div class="hb-step-label">Copy this command to your clipboard</div>
385
+ <div class="hb-code-block">
386
+ <div class="hb-code-text">${this.escapeHtml(e)}</div>
387
+ <button class="hb-copy-btn" data-action="copy" data-command="${this.escapeAttr(e)}">${n}<span>Copy</span></button>
388
+ </div>
389
+ </div>
390
+ </div>
391
+ <div class="hb-step">
392
+ <div class="hb-step-num">2</div>
393
+ <div class="hb-step-content">
394
+ <div class="hb-step-label">Paste and send in your Hermes session</div>
395
+ </div>
396
+ </div>
397
+ `;return o}setupListeners(){this.shadowRoot&&(this.shadowRoot.addEventListener("click",e=>{let t=e.target.closest("[data-action]");if(!t)return;let o=t.dataset.action;if(o==="close")this.close();else if(o==="copy"){let i=t.dataset.command||"";this.copyToClipboard(i,t)}}),this.shadowRoot.addEventListener("keydown",e=>{e.key==="Escape"&&this.close()}))}setupSystemThemeWatch(){this._mqCleanup?.(),this._mqCleanup=null;let e=this._options.theme;if(!(e==="system"||e==="branded"||e==="branded-alt")||typeof window>"u")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>this.render();o.addEventListener("change",i),this._mqCleanup=()=>o.removeEventListener("change",i)}async copyToClipboard(e,t){try{await navigator.clipboard.writeText(e);let o=t.querySelector("span"),i=t;t.setAttribute("data-copied","true"),o&&(o.textContent="Copied!"),i.innerHTML=`${x}<span>Copied!</span>`,this._options.onCopy?.(e),setTimeout(()=>{t.setAttribute("data-copied","false"),i.innerHTML=`${n}<span>Copy</span>`},2e3)}catch{let o=document.createElement("textarea");o.value=e,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o),this._options.onCopy?.(e)}}close(){let e=this.shadowRoot?.querySelector(".hb-dialog"),t=this.shadowRoot?.querySelector(".hb-backdrop");e&&(e.style.animation="hb-scale-in 0.15s ease-in reverse"),t&&(t.style.animation="hb-fade-in 0.15s ease-in reverse"),setTimeout(()=>{this._options.onClose?.(),this.remove()},140)}escapeHtml(e){let t=document.createElement("div");return t.textContent=e,t.innerHTML}escapeAttr(e){return e.replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}};typeof customElements<"u"&&!customElements.get("hermes-popup-dialog")&&customElements.define("hermes-popup-dialog",c);function $(r){let a=document.createElement("hermes-popup-dialog");return a.options=r,document.body.appendChild(a),a}export{b as a,m as b,d as c,l as d,E as e,s as f,v as g,M as h,_ as i,$ as j};
398
+ //# sourceMappingURL=chunk-3CPSZAJ2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/icons.ts","../src/themes.ts","../src/popup-dialog.ts"],"sourcesContent":["export const HERMES_ICON = `<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" class=\"hb-icon\">\n <!-- Wing helmet -->\n <path d=\"M12 2C8.5 2 6 4.5 6 7c0 1.5.5 2.8 1.5 3.8L6 14h12l-1.5-3.2C17.5 9.8 18 8.5 18 7c0-2.5-2.5-5-6-5z\" fill=\"currentColor\" opacity=\"0.2\"/>\n <path d=\"M12 2C8.5 2 6 4.5 6 7c0 1.5.5 2.8 1.5 3.8L6 14h12l-1.5-3.2C17.5 9.8 18 8.5 18 7c0-2.5-2.5-5-6-5z\" stroke=\"currentColor\" stroke-width=\"1.5\" fill=\"none\" stroke-linejoin=\"round\"/>\n <!-- Wings -->\n <path d=\"M6 6.5C4.5 5 2 5 2 7s1.5 3 3 3\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n <path d=\"M18 6.5C19.5 5 22 5 22 7s-1.5 3-3 3\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n <!-- Caduceus staff -->\n <line x1=\"12\" y1=\"14\" x2=\"12\" y2=\"22\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>\n <!-- Snakes -->\n <path d=\"M9.5 16c1.5 1 3.5 1 5 0\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" fill=\"none\"/>\n <path d=\"M9.5 19c1.5 1 3.5 1 5 0\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" fill=\"none\"/>\n <!-- Eye -->\n <circle cx=\"12\" cy=\"7.5\" r=\"1.5\" fill=\"currentColor\"/>\n</svg>`;\n\nexport const HERMES_SKILL_ICON = `<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" class=\"hb-icon\">\n <!-- Brain/memory symbol -->\n <path d=\"M12 3C8 3 5 6 5 9c0 2 1 3.5 2 4.5V16a2 2 0 002 2h6a2 2 0 002-2v-2.5c1-1 2-2.5 2-4.5 0-3-3-6-7-6z\" fill=\"currentColor\" opacity=\"0.15\"/>\n <path d=\"M12 3C8 3 5 6 5 9c0 2 1 3.5 2 4.5V16a2 2 0 002 2h6a2 2 0 002-2v-2.5c1-1 2-2.5 2-4.5 0-3-3-6-7-6z\" stroke=\"currentColor\" stroke-width=\"1.5\" fill=\"none\" stroke-linejoin=\"round\"/>\n <!-- Neural connections -->\n <path d=\"M9 9.5c0-1 .5-2 1.5-2.5M15 9.5c0-1-.5-2-1.5-2.5M10.5 11c.5.5 1.5 1 3 0\" stroke=\"currentColor\" stroke-width=\"1.2\" stroke-linecap=\"round\" fill=\"none\"/>\n <!-- Growing roots -->\n <path d=\"M9 18v2M12 18v3M15 18v2\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n <!-- Sparkle -->\n <circle cx=\"8\" cy=\"6\" r=\"0.8\" fill=\"currentColor\"/>\n <circle cx=\"16\" cy=\"6\" r=\"0.8\" fill=\"currentColor\"/>\n</svg>`;\n\nexport const COPY_ICON = `<svg viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" class=\"hb-icon-sm\">\n <rect x=\"5\" y=\"5\" width=\"8\" height=\"8\" rx=\"1.5\" stroke=\"currentColor\" stroke-width=\"1.5\" fill=\"none\"/>\n <path d=\"M3 10V3.5A1.5 1.5 0 014.5 2H10\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n</svg>`;\n\nexport const CHECK_ICON = `<svg viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" class=\"hb-icon-sm\">\n <path d=\"M3 8.5l3.5 3.5L13 4\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>`;\n\nexport const DOWNLOAD_ICON = `<svg viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" class=\"hb-icon-sm\">\n <path d=\"M8 2v8m0 0l-3-3m3 3l3-3\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M3 12v1.5a1 1 0 001 1h8a1 1 0 001-1V12\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n</svg>`;\n\nexport const CLOSE_ICON = `<svg viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" class=\"hb-icon-sm\">\n <path d=\"M4 4l8 8m0-8l-8 8\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n</svg>`;\n\nexport const TERMINAL_ICON = `<svg viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" class=\"hb-icon-sm\">\n <rect x=\"1\" y=\"2\" width=\"14\" height=\"12\" rx=\"2\" stroke=\"currentColor\" stroke-width=\"1.5\" fill=\"none\"/>\n <path d=\"M4 6l3 2.5L4 11\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M9 11h3\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/>\n</svg>`;\n","import type { ThemeTokens, Theme } from './types';\n\nexport const BRAND_COLOR = '#7C3AED';\nexport const BRAND_COLOR_HOVER = '#6D28D9';\nexport const BRAND_COLOR_ACTIVE = '#5B21B6';\n\nexport const ALT_BRAND_COLOR = '#14B8A6';\n\nexport const themes: Record<Exclude<Theme, 'system'>, ThemeTokens> = {\n branded: {\n bg: BRAND_COLOR,\n text: '#FFFFFF',\n border: 'transparent',\n surface: '#FFFFFF',\n surfaceText: '#1A1025',\n muted: '#7C7589',\n primary: BRAND_COLOR,\n primaryText: '#FFFFFF',\n codeBg: '#1A1025',\n codeText: '#F3EEFF',\n },\n 'branded-alt': {\n bg: ALT_BRAND_COLOR,\n text: '#FFFFFF',\n border: 'transparent',\n surface: '#FFFFFF',\n surfaceText: '#1A1025',\n muted: '#7C7589',\n primary: ALT_BRAND_COLOR,\n primaryText: '#FFFFFF',\n codeBg: '#1A1025',\n codeText: '#F3EEFF',\n },\n dark: {\n bg: '#1A1025',\n text: '#F3EEFF',\n border: '#2D2440',\n surface: '#231A35',\n surfaceText: '#F3EEFF',\n muted: '#9F95B0',\n primary: BRAND_COLOR,\n primaryText: '#FFFFFF',\n codeBg: '#0F0A18',\n codeText: '#F3EEFF',\n },\n light: {\n bg: '#FFFFFF',\n text: '#1A1025',\n border: '#E8E0F0',\n surface: '#FAF8FF',\n surfaceText: '#1A1025',\n muted: '#7C7589',\n primary: BRAND_COLOR,\n primaryText: '#FFFFFF',\n codeBg: '#1A1025',\n codeText: '#F3EEFF',\n },\n};\n\nexport function resolveTheme(theme: Theme): ThemeTokens {\n if (theme !== 'system') return themes[theme];\n if (typeof window === 'undefined') return themes.light;\n return window.matchMedia('(prefers-color-scheme: dark)').matches\n ? themes.dark\n : themes.light;\n}\n\nexport function themeToCSS(tokens: ThemeTokens): string {\n return `\n --hb-bg: ${tokens.bg};\n --hb-text: ${tokens.text};\n --hb-border: ${tokens.border};\n --hb-surface: ${tokens.surface};\n --hb-surface-text: ${tokens.surfaceText};\n --hb-muted: ${tokens.muted};\n --hb-primary: ${tokens.primary};\n --hb-primary-text: ${tokens.primaryText};\n --hb-code-bg: ${tokens.codeBg};\n --hb-code-text: ${tokens.codeText};\n `;\n}\n\nexport const SHAPE_MAP = {\n rounded: { sm: '0.375rem', md: '0.5rem', lg: '0.625rem' },\n pill: { sm: '999px', md: '999px', lg: '999px' },\n square: { sm: '0', md: '0', lg: '0' },\n} as const;\n\nexport const SIZE_MAP = {\n sm: { height: '2rem', fontSize: '0.75rem', iconSize: '0.875rem', padding: '0 0.75rem', ccPadding: '0 0.5rem', gap: '0.375rem', radius: '0.375rem' },\n md: { height: '2.5rem', fontSize: '0.875rem', iconSize: '1.125rem', padding: '0 1rem', ccPadding: '0 0.75rem', gap: '0.5rem', radius: '0.5rem' },\n lg: { height: '3rem', fontSize: '1rem', iconSize: '1.375rem', padding: '0 1.25rem', ccPadding: '0 1rem', gap: '0.625rem', radius: '0.625rem' },\n};\n","import type { PopupOptions, ThemeTokens } from './types';\nimport { HERMES_ICON, HERMES_SKILL_ICON, COPY_ICON, CHECK_ICON, CLOSE_ICON } from './icons';\nimport { resolveTheme, themeToCSS, BRAND_COLOR_HOVER } from './themes';\n\nconst POPUP_STYLES = `\n :host {\n position: fixed;\n inset: 0;\n z-index: 999999;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n }\n\n * { box-sizing: border-box; margin: 0; padding: 0; }\n\n .hb-backdrop {\n position: absolute;\n inset: 0;\n background: rgba(0, 0, 0, 0.5);\n backdrop-filter: blur(4px);\n -webkit-backdrop-filter: blur(4px);\n animation: hb-fade-in 0.15s ease-out;\n }\n\n .hb-dialog {\n position: relative;\n width: 90%;\n max-width: 460px;\n background: var(--hb-surface);\n color: var(--hb-surface-text);\n border-radius: 16px;\n box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--hb-border);\n overflow: hidden;\n animation: hb-scale-in 0.2s ease-out;\n }\n\n .hb-dialog-header {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 20px 24px 16px;\n border-bottom: 1px solid var(--hb-border);\n }\n\n .hb-dialog-header-icon {\n width: 36px;\n height: 36px;\n color: var(--hb-primary);\n flex-shrink: 0;\n }\n\n .hb-dialog-header-text {\n flex: 1;\n min-width: 0;\n }\n\n .hb-dialog-title {\n font-size: 16px;\n font-weight: 600;\n line-height: 1.3;\n color: var(--hb-surface-text);\n }\n\n .hb-dialog-description {\n font-size: 13px;\n color: var(--hb-muted);\n margin-top: 2px;\n line-height: 1.4;\n }\n\n .hb-dialog-close {\n width: 32px;\n height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n background: transparent;\n color: var(--hb-muted);\n cursor: pointer;\n border-radius: 8px;\n flex-shrink: 0;\n transition: background 0.15s, color 0.15s;\n }\n\n .hb-dialog-close:hover {\n background: var(--hb-border);\n color: var(--hb-surface-text);\n }\n\n .hb-dialog-close svg { width: 14px; height: 14px; }\n\n .hb-dialog-body { padding: 20px 24px; }\n\n .hb-step {\n display: flex;\n gap: 12px;\n margin-bottom: 16px;\n }\n\n .hb-step:last-child { margin-bottom: 0; }\n\n .hb-step-num {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n background: var(--hb-primary);\n color: var(--hb-primary-text);\n font-size: 12px;\n font-weight: 600;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n margin-top: 1px;\n }\n\n .hb-step-content {\n flex: 1;\n min-width: 0;\n }\n\n .hb-step-label {\n font-size: 13px;\n font-weight: 500;\n color: var(--hb-surface-text);\n margin-bottom: 8px;\n line-height: 1.4;\n }\n\n .hb-code-block {\n display: flex;\n align-items: center;\n background: var(--hb-code-bg);\n color: var(--hb-code-text);\n border-radius: 10px;\n padding: 2px 2px 2px 14px;\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, monospace;\n font-size: 13px;\n line-height: 1.5;\n gap: 8px;\n overflow: hidden;\n }\n\n .hb-code-text {\n flex: 1;\n overflow-x: auto;\n white-space: nowrap;\n padding: 10px 0;\n scrollbar-width: none;\n }\n\n .hb-code-text::-webkit-scrollbar { display: none; }\n\n .hb-code-prefix {\n color: var(--hb-muted);\n user-select: none;\n margin-right: 6px;\n }\n\n .hb-copy-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n height: 36px;\n min-width: 36px;\n padding: 0 12px;\n border: none;\n background: var(--hb-primary);\n color: var(--hb-primary-text);\n cursor: pointer;\n border-radius: 8px;\n font-family: inherit;\n font-size: 12px;\n font-weight: 500;\n flex-shrink: 0;\n transition: background 0.15s, transform 0.1s;\n white-space: nowrap;\n }\n\n .hb-copy-btn:hover { background: ${BRAND_COLOR_HOVER}; }\n .hb-copy-btn:active { transform: scale(0.96); }\n .hb-copy-btn svg { width: 14px; height: 14px; }\n\n .hb-copy-btn[data-copied=\"true\"] {\n background: #16a34a;\n }\n\n .hb-dialog-footer {\n padding: 16px 24px 20px;\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n .hb-action-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n width: 100%;\n height: 44px;\n border: none;\n background: var(--hb-primary);\n color: var(--hb-primary-text);\n cursor: pointer;\n border-radius: 10px;\n font-family: inherit;\n font-size: 14px;\n font-weight: 600;\n transition: background 0.15s, transform 0.1s;\n }\n\n .hb-action-btn:hover { background: ${BRAND_COLOR_HOVER}; }\n .hb-action-btn:active { transform: scale(0.98); }\n .hb-action-btn svg { width: 16px; height: 16px; }\n\n .hb-hint {\n font-size: 12px;\n color: var(--hb-muted);\n text-align: center;\n line-height: 1.4;\n }\n\n .hb-hint kbd {\n display: inline-block;\n padding: 1px 5px;\n font-family: inherit;\n font-size: 11px;\n background: var(--hb-border);\n border-radius: 4px;\n border: 1px solid var(--hb-border);\n }\n\n @keyframes hb-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes hb-scale-in {\n from { opacity: 0; transform: scale(0.95) translateY(8px); }\n to { opacity: 1; transform: scale(1) translateY(0); }\n }\n\n @media (max-width: 480px) {\n .hb-dialog {\n width: 96%;\n max-width: none;\n border-radius: 14px;\n max-height: 90dvh;\n overflow-y: auto;\n overscroll-behavior: contain;\n }\n\n .hb-dialog-header { padding: 16px 16px 12px; gap: 10px; }\n .hb-dialog-header-icon { width: 28px; height: 28px; }\n .hb-dialog-body { padding: 16px; }\n .hb-dialog-footer { padding: 12px 16px 16px; }\n\n .hb-step { gap: 10px; margin-bottom: 14px; }\n .hb-step-num { width: 22px; height: 22px; font-size: 11px; }\n .hb-step-label { font-size: 12px; margin-bottom: 6px; }\n\n .hb-code-block { font-size: 12px; padding: 2px 2px 2px 10px; border-radius: 8px; }\n .hb-copy-btn { height: 32px; padding: 0 10px; font-size: 11px; border-radius: 6px; }\n .hb-action-btn { height: 40px; font-size: 13px; border-radius: 8px; }\n .hb-hint { font-size: 11px; }\n }\n\n @media (max-width: 360px) {\n .hb-dialog { width: 100%; border-radius: 12px 12px 0 0; align-self: flex-end; }\n .hb-copy-btn span { display: none; }\n .hb-copy-btn { min-width: 32px; padding: 0 8px; }\n }\n\n @supports (padding: env(safe-area-inset-bottom)) {\n .hb-dialog-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }\n }\n`;\n\nexport class HermesPopupDialog extends HTMLElement {\n private _options!: PopupOptions;\n private _mqCleanup: (() => void) | null = null;\n\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n\n set options(opts: PopupOptions) {\n this._options = opts;\n this.render();\n }\n\n get options() {\n return this._options;\n }\n\n disconnectedCallback() {\n this._mqCleanup?.();\n this._mqCleanup = null;\n }\n\n private resolvePopupTokens(): ThemeTokens {\n const { theme } = this._options;\n\n if (theme === 'dark' || theme === 'light') return resolveTheme(theme);\n\n const prefersDark = typeof window !== 'undefined'\n && window.matchMedia('(prefers-color-scheme: dark)').matches;\n\n if (theme === 'system') {\n return prefersDark ? resolveTheme('dark') : resolveTheme('light');\n }\n\n const base = prefersDark ? resolveTheme('dark') : resolveTheme('light');\n const brand = resolveTheme(theme);\n return {\n ...base,\n primary: brand.primary,\n primaryText: brand.primaryText,\n };\n }\n\n private render() {\n if (!this.shadowRoot || !this._options) return;\n\n const { variant, title, description, command, fullCommand, skillUrl } = this._options;\n const tokens = this.resolvePopupTokens();\n const icon = variant === 'hermes' ? HERMES_ICON : HERMES_SKILL_ICON;\n\n const isHermesTerminal = variant === 'hermes';\n const displayCommand = fullCommand || command;\n\n this.shadowRoot.innerHTML = `\n <style>${POPUP_STYLES}</style>\n <div style=\"${themeToCSS(tokens)}\">\n <div class=\"hb-backdrop\" data-action=\"close\"></div>\n <div class=\"hb-dialog\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"hb-dialog-title\">\n <div class=\"hb-dialog-header\">\n <div class=\"hb-dialog-header-icon\">${icon}</div>\n <div class=\"hb-dialog-header-text\">\n <div class=\"hb-dialog-title\" id=\"hb-dialog-title\">${title}</div>\n ${description ? `<div class=\"hb-dialog-description\">${description}</div>` : ''}\n </div>\n <button class=\"hb-dialog-close\" data-action=\"close\" aria-label=\"Close\">${CLOSE_ICON}</button>\n </div>\n <div class=\"hb-dialog-body\">\n ${isHermesTerminal ? this.renderHermesTerminalBody(displayCommand) : this.renderHermesSkillBody(command, skillUrl)}\n </div>\n <div class=\"hb-dialog-footer\">\n ${isHermesTerminal ? `\n <div class=\"hb-hint\">Press <kbd>⌘</kbd>+<kbd>V</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd> in your terminal to run</div>\n ` : `\n <div class=\"hb-hint\">Press <kbd>⌘</kbd>+<kbd>V</kbd> or <kbd>Ctrl</kbd>+<kbd>V</kbd> in your Hermes session to run</div>\n `}\n </div>\n </div>\n </div>\n `;\n\n this.setupListeners();\n this.setupSystemThemeWatch();\n }\n\n private renderHermesTerminalBody(command: string): string {\n return `\n <div class=\"hb-step\">\n <div class=\"hb-step-num\">1</div>\n <div class=\"hb-step-content\">\n <div class=\"hb-step-label\">Copy this command to your clipboard</div>\n <div class=\"hb-code-block\">\n <div class=\"hb-code-text\"><span class=\"hb-code-prefix\">$</span>${this.escapeHtml(command)}</div>\n <button class=\"hb-copy-btn\" data-action=\"copy\" data-command=\"${this.escapeAttr(command)}\">${COPY_ICON}<span>Copy</span></button>\n </div>\n </div>\n </div>\n <div class=\"hb-step\">\n <div class=\"hb-step-num\">2</div>\n <div class=\"hb-step-content\">\n <div class=\"hb-step-label\">Paste and run in your terminal</div>\n </div>\n </div>\n `;\n }\n\n private renderHermesSkillBody(command: string, skillUrl?: string): string {\n let steps = '';\n\n if (skillUrl) {\n const fullPrompt = `Install the skill from ${skillUrl} and run ${command}`;\n steps += `\n <div class=\"hb-step\">\n <div class=\"hb-step-num\">1</div>\n <div class=\"hb-step-content\">\n <div class=\"hb-step-label\">Copy this prompt to your clipboard</div>\n <div class=\"hb-code-block\">\n <div class=\"hb-code-text\">${this.escapeHtml(fullPrompt)}</div>\n <button class=\"hb-copy-btn\" data-action=\"copy\" data-command=\"${this.escapeAttr(fullPrompt)}\">${COPY_ICON}<span>Copy</span></button>\n </div>\n </div>\n </div>\n <div class=\"hb-step\">\n <div class=\"hb-step-num\">2</div>\n <div class=\"hb-step-content\">\n <div class=\"hb-step-label\">Paste into a Hermes session — the agent will fetch the skill and set it up for you</div>\n </div>\n </div>\n `;\n } else {\n steps += `\n <div class=\"hb-step\">\n <div class=\"hb-step-num\">1</div>\n <div class=\"hb-step-content\">\n <div class=\"hb-step-label\">Copy this command to your clipboard</div>\n <div class=\"hb-code-block\">\n <div class=\"hb-code-text\">${this.escapeHtml(command)}</div>\n <button class=\"hb-copy-btn\" data-action=\"copy\" data-command=\"${this.escapeAttr(command)}\">${COPY_ICON}<span>Copy</span></button>\n </div>\n </div>\n </div>\n <div class=\"hb-step\">\n <div class=\"hb-step-num\">2</div>\n <div class=\"hb-step-content\">\n <div class=\"hb-step-label\">Paste and send in your Hermes session</div>\n </div>\n </div>\n `;\n }\n\n return steps;\n }\n\n private setupListeners() {\n if (!this.shadowRoot) return;\n\n this.shadowRoot.addEventListener('click', (e) => {\n const target = (e.target as HTMLElement).closest('[data-action]') as HTMLElement | null;\n if (!target) return;\n\n const action = target.dataset.action;\n\n if (action === 'close') {\n this.close();\n } else if (action === 'copy') {\n const cmd = target.dataset.command || '';\n this.copyToClipboard(cmd, target);\n }\n });\n\n this.shadowRoot.addEventListener('keydown', (e) => {\n if ((e as KeyboardEvent).key === 'Escape') this.close();\n });\n }\n\n private setupSystemThemeWatch() {\n this._mqCleanup?.();\n this._mqCleanup = null;\n\n const theme = this._options.theme;\n const needsWatch = theme === 'system' || theme === 'branded' || theme === 'branded-alt';\n if (!needsWatch || typeof window === 'undefined') return;\n\n const mq = window.matchMedia('(prefers-color-scheme: dark)');\n const handler = () => this.render();\n mq.addEventListener('change', handler);\n this._mqCleanup = () => mq.removeEventListener('change', handler);\n }\n\n private async copyToClipboard(command: string, button: HTMLElement) {\n try {\n await navigator.clipboard.writeText(command);\n const label = button.querySelector('span');\n const iconContainer = button;\n\n button.setAttribute('data-copied', 'true');\n if (label) label.textContent = 'Copied!';\n iconContainer.innerHTML = `${CHECK_ICON}<span>Copied!</span>`;\n\n this._options.onCopy?.(command);\n\n setTimeout(() => {\n button.setAttribute('data-copied', 'false');\n iconContainer.innerHTML = `${COPY_ICON}<span>Copy</span>`;\n }, 2000);\n } catch {\n const textarea = document.createElement('textarea');\n textarea.value = command;\n textarea.style.position = 'fixed';\n textarea.style.opacity = '0';\n document.body.appendChild(textarea);\n textarea.select();\n document.execCommand('copy');\n document.body.removeChild(textarea);\n\n this._options.onCopy?.(command);\n }\n }\n\n close() {\n const dialog = this.shadowRoot?.querySelector('.hb-dialog') as HTMLElement;\n const backdrop = this.shadowRoot?.querySelector('.hb-backdrop') as HTMLElement;\n\n if (dialog) {\n dialog.style.animation = 'hb-scale-in 0.15s ease-in reverse';\n }\n if (backdrop) {\n backdrop.style.animation = 'hb-fade-in 0.15s ease-in reverse';\n }\n\n setTimeout(() => {\n this._options.onClose?.();\n this.remove();\n }, 140);\n }\n\n private escapeHtml(str: string): string {\n const div = document.createElement('div');\n div.textContent = str;\n return div.innerHTML;\n }\n\n private escapeAttr(str: string): string {\n return str.replace(/\"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n }\n}\n\nif (typeof customElements !== 'undefined' && !customElements.get('hermes-popup-dialog')) {\n customElements.define('hermes-popup-dialog', HermesPopupDialog);\n}\n\nexport function showPopup(options: PopupOptions): HermesPopupDialog {\n const popup = document.createElement('hermes-popup-dialog') as HermesPopupDialog;\n popup.options = options;\n document.body.appendChild(popup);\n return popup;\n}\n"],"mappings":"AAAO,IAAMA,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAgBdC,EAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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tC,OAAOA,EAAI,QAAQ,KAAM,QAAQ,EAAE,QAAQ,KAAM,OAAO,EAAE,QAAQ,KAAM,MAAM,EAAE,QAAQ,KAAM,MAAM,CACtG,CACF,EAEI,OAAO,eAAmB,KAAe,CAAC,eAAe,IAAI,qBAAqB,GACpF,eAAe,OAAO,sBAAuBpC,CAAiB,EAGzD,SAASsC,EAAUC,EAA0C,CAClE,IAAMC,EAAQ,SAAS,cAAc,qBAAqB,EAC1D,OAAAA,EAAM,QAAUD,EAChB,SAAS,KAAK,YAAYC,CAAK,EACxBA,CACT","names":["HERMES_ICON","HERMES_SKILL_ICON","COPY_ICON","CHECK_ICON","CLOSE_ICON","BRAND_COLOR","BRAND_COLOR_HOVER","BRAND_COLOR_ACTIVE","ALT_BRAND_COLOR","themes","resolveTheme","theme","themeToCSS","tokens","SHAPE_MAP","SIZE_MAP","POPUP_STYLES","BRAND_COLOR_HOVER","HermesPopupDialog","opts","theme","resolveTheme","prefersDark","base","brand","variant","title","description","command","fullCommand","skillUrl","tokens","icon","HERMES_ICON","HERMES_SKILL_ICON","isHermesTerminal","displayCommand","themeToCSS","CLOSE_ICON","COPY_ICON","steps","fullPrompt","target","action","cmd","mq","handler","button","label","iconContainer","CHECK_ICON","textarea","dialog","backdrop","str","div","showPopup","options","popup"]}