hermesbuttons 1.1.3 → 1.1.4

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.
@@ -1,4 +1,4 @@
1
- "use strict";var HermesButtons=(()=>{var N=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var Z=(a,n)=>{for(var t in n)N(a,t,{get:n[t],enumerable:!0})},X=(a,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Y(n))!J.call(a,o)&&o!==t&&N(a,o,{get:()=>n[o],enumerable:!(e=K(n,o))||e.enumerable});return a};var Q=a=>X(N({},"__esModule",{value:!0}),a);var it={};Z(it,{ALT_BRAND_COLOR:()=>m,BRAND_COLOR:()=>i,HERMES_ICON:()=>x,HERMES_SKILL_ICON:()=>k,HermesButton:()=>A,HermesPopupDialog:()=>F,HermesSkillButton:()=>_,createHermesButton:()=>U,createHermesSkillButton:()=>W,discoverButtons:()=>D,generateStructuredData:()=>I,injectStructuredData:()=>G,register:()=>nt,registerHermesButton:()=>T,registerHermesSkillButton:()=>$,resolveTheme:()=>p,showPopup:()=>w,themes:()=>y});var P="agentpreferences";function q(){return typeof document<"u"}function tt(){if(!q())return null;let a=document.cookie.split(";").map(t=>t.trim()).find(t=>t.startsWith(`${P}=`));if(!a)return null;let n=a.slice(P.length+1);if(!n)return null;try{let t=decodeURIComponent(n),e=JSON.parse(t);return!e||typeof e!="object"||!Array.isArray(e.order)?null:{order:e.order.filter(r=>typeof r=="string"&&r.length>0)}}catch{return null}}function et(a){if(!q())return;let n=a.order.slice(0,24),t=JSON.stringify({order:n}),e=new Date;e.setFullYear(e.getFullYear()+1),document.cookie=`${P}=${encodeURIComponent(t)}; Path=/; SameSite=Lax; Expires=${e.toUTCString()}`}function f(a){if(!a||typeof a!="string")return;let t=tt()?.order.filter(e=>e!==a)??[];et({order:[a,...t]})}var x=`<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon">
1
+ "use strict";var HermesButtons=(()=>{var z=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var Q=(a,n)=>{for(var t in n)z(a,t,{get:n[t],enumerable:!0})},tt=(a,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Z(n))!X.call(a,o)&&o!==t&&z(a,o,{get:()=>n[o],enumerable:!(e=J(n,o))||e.enumerable});return a};var et=a=>tt(z({},"__esModule",{value:!0}),a);var ht={};Q(ht,{ALT_BRAND_COLOR:()=>m,BRAND_COLOR:()=>i,HERMES_ICON:()=>x,HERMES_SKILL_ICON:()=>k,HermesButton:()=>A,HermesPopupDialog:()=>F,HermesSkillButton:()=>_,createHermesButton:()=>U,createHermesSkillButton:()=>W,discoverButtons:()=>D,generateStructuredData:()=>I,injectStructuredData:()=>G,register:()=>dt,registerHermesButton:()=>T,registerHermesSkillButton:()=>$,resolveTheme:()=>p,showPopup:()=>C,themes:()=>y});var P="agentpreferences";function q(){return typeof document<"u"}function ot(){if(!q())return null;let a=document.cookie.split(";").map(t=>t.trim()).find(t=>t.startsWith(`${P}=`));if(!a)return null;let n=a.slice(P.length+1);if(!n)return null;try{let t=decodeURIComponent(n),e=JSON.parse(t);return!e||typeof e!="object"||!Array.isArray(e.order)?null:{order:e.order.filter(r=>typeof r=="string"&&r.length>0)}}catch{return null}}function at(a){if(!q())return;let n=a.order.slice(0,24),t=JSON.stringify({order:n}),e=new Date;e.setFullYear(e.getFullYear()+1),document.cookie=`${P}=${encodeURIComponent(t)}; Path=/; SameSite=Lax; Expires=${e.toUTCString()}`}function f(a){if(!a||typeof a!="string")return;let t=ot()?.order.filter(e=>e!==a)??[];at({order:[a,...t]})}var x=`<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon">
2
2
  <!-- Wing helmet -->
3
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
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"/>
@@ -30,7 +30,7 @@
30
30
  <path d="M3 8.5l3.5 3.5L13 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
31
31
  </svg>`;var j=`<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" class="hb-icon-sm">
32
32
  <path d="M4 4l8 8m0-8l-8 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
33
- </svg>`;var i="#2B8CFF",v="#1E7AEB",S="#186BD4",d="43, 140, 255",m="#8FA3E8",O="#7B91DC",L="#6B82CC",c="143, 163, 232",y={branded:{bg:i,text:"#FFFFFF",border:"transparent",surface:"#FFFFFF",surfaceText:"#0F172A",muted:"#64748B",primary:i,primaryText:"#FFFFFF",codeBg:"#0F172A",codeText:"#F1F5F9"},"branded-alt":{bg:m,text:"#FFFFFF",border:"transparent",surface:"#FFFFFF",surfaceText:"#0F172A",muted:"#64748B",primary:m,primaryText:"#FFFFFF",codeBg:"#0F172A",codeText:"#F1F5F9"},dark:{bg:"#141C2E",text:"#F1F5F9",border:"#2A3F5C",surface:"#1A2740",surfaceText:"#F1F5F9",muted:"#94A3B8",primary:i,primaryText:"#FFFFFF",codeBg:"#0A0E18",codeText:"#F1F5F9"},light:{bg:"#FFFFFF",text:"#0F172A",border:"#CBD5E1",surface:"#F8FAFC",surfaceText:"#0F172A",muted:"#64748B",primary:i,primaryText:"#FFFFFF",codeBg:"#0F172A",codeText:"#F1F5F9"}};function p(a){return a!=="system"?y[a]:typeof window>"u"?y.light:window.matchMedia("(prefers-color-scheme: dark)").matches?y.dark:y.light}function C(a){return`
33
+ </svg>`;var i="#2B8CFF",v="#1E7AEB",S="#186BD4",d="43, 140, 255",m="#8FA3E8",O="#7B91DC",L="#6B82CC",c="143, 163, 232",y={branded:{bg:i,text:"#FFFFFF",border:"transparent",surface:"#FFFFFF",surfaceText:"#0F172A",muted:"#64748B",primary:i,primaryText:"#FFFFFF",codeBg:"#0F172A",codeText:"#F1F5F9"},"branded-alt":{bg:m,text:"#FFFFFF",border:"transparent",surface:"#FFFFFF",surfaceText:"#0F172A",muted:"#64748B",primary:m,primaryText:"#FFFFFF",codeBg:"#0F172A",codeText:"#F1F5F9"},dark:{bg:"#141C2E",text:"#F1F5F9",border:"#2A3F5C",surface:"#1A2740",surfaceText:"#F1F5F9",muted:"#94A3B8",primary:i,primaryText:"#FFFFFF",codeBg:"#0A0E18",codeText:"#F1F5F9"},light:{bg:"#FFFFFF",text:"#0F172A",border:"#CBD5E1",surface:"#F8FAFC",surfaceText:"#0F172A",muted:"#64748B",primary:i,primaryText:"#FFFFFF",codeBg:"#0F172A",codeText:"#F1F5F9"}};function p(a){return a!=="system"?y[a]:typeof window>"u"?y.light:window.matchMedia("(prefers-color-scheme: dark)").matches?y.dark:y.light}function w(a){return`
34
34
  --hb-bg: ${a.bg};
35
35
  --hb-text: ${a.text};
36
36
  --hb-border: ${a.border};
@@ -41,7 +41,7 @@
41
41
  --hb-primary-text: ${a.primaryText};
42
42
  --hb-code-bg: ${a.codeBg};
43
43
  --hb-code-text: ${a.codeText};
44
- `}var B={rounded:{sm:"0.375rem",md:"0.5rem",lg:"0.625rem"},pill:{sm:"999px",md:"999px",lg:"999px"},square:{sm:"0",md:"0",lg:"0"}},H={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 ot=`
44
+ `}var B={rounded:{sm:"0.375rem",md:"0.5rem",lg:"0.625rem"},pill:{sm:"999px",md:"999px",lg:"999px"},square:{sm:"0",md:"0",lg:"0"}},H={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 rt=`
45
45
  :host {
46
46
  position: fixed;
47
47
  inset: 0;
@@ -319,8 +319,8 @@
319
319
  .hb-dialog-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
320
320
  }
321
321
  `,F=class extends HTMLElement{constructor(){super();this._mqCleanup=null;this.attachShadow({mode:"open"})}set options(t){this._options=t,this.render()}get options(){return this._options}disconnectedCallback(){this._mqCleanup?.(),this._mqCleanup=null}resolvePopupTokens(){let{theme:t}=this._options;if(t==="dark"||t==="light")return p(t);let e=typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches;if(t==="system")return e?p("dark"):p("light");let o=e?p("dark"):p("light"),r=p(t);return{...o,primary:r.primary,primaryText:r.primaryText}}render(){if(!this.shadowRoot||!this._options)return;let{variant:t,title:e,description:o,command:r,fullCommand:s}=this._options,l=this.resolvePopupTokens(),h=t==="hermes"?x:k,b=t==="hermes",u=s||r;this.shadowRoot.innerHTML=`
322
- <style>${ot}</style>
323
- <div style="${C(l)}">
322
+ <style>${rt}</style>
323
+ <div style="${w(l)}">
324
324
  <div class="hb-backdrop" data-action="close"></div>
325
325
  <div class="hb-dialog" role="dialog" aria-modal="true" aria-labelledby="hb-dialog-title">
326
326
  <div class="hb-dialog-header">
@@ -377,7 +377,7 @@
377
377
  <div class="hb-step-label">Paste and send in your Hermes session</div>
378
378
  </div>
379
379
  </div>
380
- `}setupListeners(){this.shadowRoot&&(this.shadowRoot.addEventListener("click",t=>{let e=t.target.closest("[data-action]");if(!e)return;let o=e.dataset.action;if(o==="close")this.close();else if(o==="copy"){let r=e.dataset.command||"";this.copyToClipboard(r,e)}}),this.shadowRoot.addEventListener("keydown",t=>{t.key==="Escape"&&this.close()}))}setupSystemThemeWatch(){this._mqCleanup?.(),this._mqCleanup=null;let t=this._options.theme;if(!(t==="system"||t==="branded"||t==="branded-alt")||typeof window>"u")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>this.render();o.addEventListener("change",r),this._mqCleanup=()=>o.removeEventListener("change",r)}async copyToClipboard(t,e){try{await navigator.clipboard.writeText(t);let o=e.querySelector("span"),r=e;e.setAttribute("data-copied","true"),o&&(o.textContent="Copied!"),r.innerHTML=`${V}<span>Copied!</span>`,this._options.onCopy?.(t),setTimeout(()=>{e.setAttribute("data-copied","false"),r.innerHTML=`${R}<span>Copy</span>`},2e3)}catch{let o=document.createElement("textarea");o.value=t,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o),this._options.onCopy?.(t)}}close(){let t=this.shadowRoot?.querySelector(".hb-dialog"),e=this.shadowRoot?.querySelector(".hb-backdrop");t&&(t.style.animation="hb-scale-in 0.15s ease-in reverse"),e&&(e.style.animation="hb-fade-in 0.15s ease-in reverse"),setTimeout(()=>{this._options.onClose?.(),this.remove()},140)}escapeHtml(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}escapeAttr(t){return t.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",F);function w(a){let n=document.createElement("hermes-popup-dialog");return n.options=a,document.body.appendChild(n),n}var at=`
380
+ `}setupListeners(){this.shadowRoot&&(this.shadowRoot.addEventListener("click",t=>{let e=t.target.closest("[data-action]");if(!e)return;let o=e.dataset.action;if(o==="close")this.close();else if(o==="copy"){let r=e.dataset.command||"";this.copyToClipboard(r,e)}}),this.shadowRoot.addEventListener("keydown",t=>{t.key==="Escape"&&this.close()}))}setupSystemThemeWatch(){this._mqCleanup?.(),this._mqCleanup=null;let t=this._options.theme;if(!(t==="system"||t==="branded"||t==="branded-alt")||typeof window>"u")return;let o=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>this.render();o.addEventListener("change",r),this._mqCleanup=()=>o.removeEventListener("change",r)}async copyToClipboard(t,e){try{await navigator.clipboard.writeText(t);let o=e.querySelector("span"),r=e;e.setAttribute("data-copied","true"),o&&(o.textContent="Copied!"),r.innerHTML=`${V}<span>Copied!</span>`,this._options.onCopy?.(t),setTimeout(()=>{e.setAttribute("data-copied","false"),r.innerHTML=`${R}<span>Copy</span>`},2e3)}catch{let o=document.createElement("textarea");o.value=t,o.style.position="fixed",o.style.opacity="0",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o),this._options.onCopy?.(t)}}close(){let t=this.shadowRoot?.querySelector(".hb-dialog"),e=this.shadowRoot?.querySelector(".hb-backdrop");t&&(t.style.animation="hb-scale-in 0.15s ease-in reverse"),e&&(e.style.animation="hb-fade-in 0.15s ease-in reverse"),setTimeout(()=>{this._options.onClose?.(),this.remove()},140)}escapeHtml(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}escapeAttr(t){return t.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",F);function C(a){let n=document.createElement("hermes-popup-dialog");return n.options=a,document.body.appendChild(n),n}var nt=`
381
381
  :host {
382
382
  display: inline-block;
383
383
  vertical-align: middle;
@@ -614,16 +614,16 @@
614
614
  .hb-btn-label {
615
615
  letter-spacing: -0.01em;
616
616
  }
617
- `,A=class extends HTMLElement{constructor(){super();this._options={command:"",theme:"branded",size:"md",variant:"filled",popup:!0,promptFlag:!0};this._mqCleanup=null;this._rendered=!1;this.attachShadow({mode:"open"})}connectedCallback(){this.syncFromAttributes(),this.render(),this.updateLightDOM()}disconnectedCallback(){this._mqCleanup?.(),this._mqCleanup=null}attributeChangedCallback(){this._rendered&&(this.syncFromAttributes(),this.render(),this.updateLightDOM())}set options(t){this._options={...this._options,...t},this.render(),this.updateLightDOM()}get options(){return this._options}syncFromAttributes(){let t=this.getAttribute("command"),e=this.getAttribute("theme"),o=this.getAttribute("size"),r=this.getAttribute("variant"),s=this.getAttribute("shape"),l=this.getAttribute("popup"),h=this.getAttribute("prompt-flag"),b=this.getAttribute("popup-title"),u=this.getAttribute("popup-description");t!==null&&(this._options.command=t),e&&(this._options.theme=e),o&&(this._options.size=o),r&&(this._options.variant=r),s&&(this._options.shape=s),l!==null&&(this._options.popup=l!=="false"),h!==null&&(this._options.promptFlag=h!=="false"),b!==null&&(this._options.popupTitle=b),u!==null&&(this._options.popupDescription=u)}updateLightDOM(){let{command:t}=this._options,e=this.getFullCommand();this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-label",`Run on Hermes: ${t}`),this._options.popup!==!1?this.setAttribute("aria-haspopup","dialog"):this.removeAttribute("aria-haspopup");let o=this.querySelector("a[data-hb-crawl]");o||(o=document.createElement("a"),o.setAttribute("data-hb-crawl",""),o.setAttribute("aria-hidden","true"),o.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",this.appendChild(o)),o.href=`https://hermes.ai/run?command=${encodeURIComponent(e)}`,o.textContent=`Run on Hermes: ${t}`,o.setAttribute("data-platform","hermes"),o.setAttribute("data-command",t),o.setAttribute("data-full-command",e)}getResolvedTheme(){return this._options.theme||"branded"}getFullCommand(){let{command:t,promptFlag:e}=this._options;return e===!1?t:`hermes -p "${t}"`}render(){if(!this.shadowRoot)return;let t=this.getResolvedTheme(),e=t==="system"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,o=this._options.variant||"filled",r=p(t),s=this._options.size||"md",l=this._options.shape||"rounded",h=H[s],b=B[l][s];this.setAttribute("data-theme",e),this.setAttribute("data-variant",o);let u=o!=="filled"?"transparent":r.bg,M=o==="ghost"?"transparent":o==="outline"?r.primary:r.border,z=o!=="filled"?r.primary:r.text;this.shadowRoot.innerHTML=`
618
- <style>${at}</style>
617
+ `,A=class extends HTMLElement{constructor(){super();this._options={command:"",theme:"branded",size:"md",variant:"filled",popup:!0,promptFlag:!0};this._mqCleanup=null;this._rendered=!1;this.attachShadow({mode:"open"})}connectedCallback(){this.syncFromAttributes(),this.render(),this.updateLightDOM()}disconnectedCallback(){this._mqCleanup?.(),this._mqCleanup=null}attributeChangedCallback(){this._rendered&&(this.syncFromAttributes(),this.render(),this.updateLightDOM())}set options(t){this._options={...this._options,...t},this.render(),this.updateLightDOM()}get options(){return this._options}syncFromAttributes(){let t=this.getAttribute("command"),e=this.getAttribute("theme"),o=this.getAttribute("size"),r=this.getAttribute("variant"),s=this.getAttribute("shape"),l=this.getAttribute("popup"),h=this.getAttribute("prompt-flag"),b=this.getAttribute("popup-title"),u=this.getAttribute("popup-description");t!==null&&(this._options.command=t),e&&(this._options.theme=e),o&&(this._options.size=o),r&&(this._options.variant=r),s&&(this._options.shape=s),l!==null&&(this._options.popup=l!=="false"),h!==null&&(this._options.promptFlag=h!=="false"),b!==null&&(this._options.popupTitle=b),u!==null&&(this._options.popupDescription=u)}updateLightDOM(){let{command:t}=this._options,e=this.getFullCommand();this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-label",`Run on Hermes: ${t}`),this._options.popup!==!1?this.setAttribute("aria-haspopup","dialog"):this.removeAttribute("aria-haspopup");let o=this.querySelector("a[data-hb-crawl]");o||(o=document.createElement("a"),o.setAttribute("data-hb-crawl",""),o.setAttribute("aria-hidden","true"),o.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",this.appendChild(o)),o.href=`https://hermes.ai/run?command=${encodeURIComponent(e)}`,o.textContent=`Run on Hermes: ${t}`,o.setAttribute("data-platform","hermes"),o.setAttribute("data-command",t),o.setAttribute("data-full-command",e)}getResolvedTheme(){return this._options.theme||"branded"}getFullCommand(){let{command:t,promptFlag:e}=this._options;return e===!1?t:`hermes -p "${t}"`}render(){if(!this.shadowRoot)return;let t=this.getResolvedTheme(),e=t==="system"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,o=this._options.variant||"filled",r=p(t),s=this._options.size||"md",l=this._options.shape||"rounded",h=H[s],b=B[l][s];this.setAttribute("data-theme",e),this.setAttribute("data-variant",o);let u=o!=="filled"?"transparent":r.bg,M=o==="ghost"?"transparent":o==="outline"?r.primary:r.border,N=o!=="filled"?r.primary:r.text;this.shadowRoot.innerHTML=`
618
+ <style>${nt}</style>
619
619
  <button
620
620
  class="hb-btn"
621
621
  type="button"
622
622
  style="
623
- ${C(r)}
623
+ ${w(r)}
624
624
  --hb-bg: ${u};
625
625
  --hb-border: ${M};
626
- --hb-text: ${z};
626
+ --hb-text: ${N};
627
627
  --hb-accent-color: ${r.primary};
628
628
  --hb-focus-color: ${r.primary};
629
629
  --hb-height: ${h.height};
@@ -638,7 +638,7 @@
638
638
  <span class="hb-btn-icon" aria-hidden="true">${x}</span>
639
639
  <span class="hb-btn-label">Run on Hermes</span>
640
640
  </button>
641
- `;let E=this.shadowRoot.querySelector(".hb-btn");E.addEventListener("click",()=>this.handleClick()),E.addEventListener("keydown",g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),this.handleClick())}),this._rendered=!0,this.setupSystemThemeWatch()}handleClick(){let{popup:t,command:e,popupTitle:o,popupDescription:r}=this._options,s=this.getFullCommand();if(this.dispatchEvent(new CustomEvent("hb-open",{bubbles:!0,composed:!0,detail:{command:e,fullCommand:s}})),t===!1){navigator.clipboard.writeText(s).then(()=>{this._options.onCopy?.(s),f("hermes"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:s}}))});return}w({variant:"hermes",theme:this.getResolvedTheme(),title:o||"Run on Hermes",description:r||"Execute this command in your terminal to get started with Hermes Agent.",command:e,fullCommand:s,onCopy:l=>{this._options.onCopy?.(l),f("hermes"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:l}}))},onClose:()=>{this.dispatchEvent(new CustomEvent("hb-close",{bubbles:!0,composed:!0}))}})}setupSystemThemeWatch(){if(this._mqCleanup?.(),this._mqCleanup=null,this.getResolvedTheme()!=="system"||typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),e=()=>this.render();t.addEventListener("change",e),this._mqCleanup=()=>t.removeEventListener("change",e)}};A.observedAttributes=["command","theme","size","variant","shape","popup","prompt-flag","popup-title","popup-description"];function T(a="hermes-button"){typeof customElements>"u"||customElements.get(a)||customElements.define(a,A)}T();function U(a){let n=document.createElement("hermes-button");return n.options=a,n}var rt=`
641
+ `;let E=this.shadowRoot.querySelector(".hb-btn");E.addEventListener("click",()=>this.handleClick()),E.addEventListener("keydown",g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),this.handleClick())}),this._rendered=!0,this.setupSystemThemeWatch()}handleClick(){let{popup:t,command:e,popupTitle:o,popupDescription:r}=this._options,s=this.getFullCommand();if(this.dispatchEvent(new CustomEvent("hb-open",{bubbles:!0,composed:!0,detail:{command:e,fullCommand:s}})),t===!1){navigator.clipboard.writeText(s).then(()=>{this._options.onCopy?.(s),f("hermes"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:s}}))});return}C({variant:"hermes",theme:this.getResolvedTheme(),title:o||"Run on Hermes",description:r||"Execute this command in your terminal to get started with Hermes Agent.",command:e,fullCommand:s,onCopy:l=>{this._options.onCopy?.(l),f("hermes"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:l}}))},onClose:()=>{this.dispatchEvent(new CustomEvent("hb-close",{bubbles:!0,composed:!0}))}})}setupSystemThemeWatch(){if(this._mqCleanup?.(),this._mqCleanup=null,this.getResolvedTheme()!=="system"||typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),e=()=>this.render();t.addEventListener("change",e),this._mqCleanup=()=>t.removeEventListener("change",e)}};A.observedAttributes=["command","theme","size","variant","shape","popup","prompt-flag","popup-title","popup-description"];function T(a="hermes-button"){typeof customElements>"u"||customElements.get(a)||customElements.define(a,A)}T();function U(a){let n=document.createElement("hermes-button");return n.options=a,n}var it=`
642
642
  :host {
643
643
  display: inline-block;
644
644
  vertical-align: middle;
@@ -875,16 +875,16 @@
875
875
  .hb-btn-label {
876
876
  letter-spacing: -0.01em;
877
877
  }
878
- `,_=class extends HTMLElement{constructor(){super();this._options={command:"",theme:"branded",size:"md",variant:"filled",popup:!0};this._mqCleanup=null;this._rendered=!1;this.attachShadow({mode:"open"})}connectedCallback(){this.syncFromAttributes(),this.render(),this.updateLightDOM()}disconnectedCallback(){this._mqCleanup?.(),this._mqCleanup=null}attributeChangedCallback(){this._rendered&&(this.syncFromAttributes(),this.render(),this.updateLightDOM())}set options(t){this._options={...this._options,...t},this.render(),this.updateLightDOM()}get options(){return this._options}syncFromAttributes(){let t=this.getAttribute("command"),e=this.getAttribute("theme"),o=this.getAttribute("size"),r=this.getAttribute("variant"),s=this.getAttribute("shape"),l=this.getAttribute("popup"),h=this.getAttribute("popup-title"),b=this.getAttribute("popup-description");t!==null&&(this._options.command=t),e&&(this._options.theme=e),o&&(this._options.size=o),r&&(this._options.variant=r),s&&(this._options.shape=s),l!==null&&(this._options.popup=l!=="false"),h!==null&&(this._options.popupTitle=h),b!==null&&(this._options.popupDescription=b)}updateLightDOM(){let{command:t}=this._options;this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-label",`Run on Hermes Skills: ${t}`),this._options.popup!==!1?this.setAttribute("aria-haspopup","dialog"):this.removeAttribute("aria-haspopup");let e=this.querySelector("a[data-hb-crawl]");e||(e=document.createElement("a"),e.setAttribute("data-hb-crawl",""),e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",this.appendChild(e)),e.textContent=`Run on Hermes Skills: ${t}`,e.setAttribute("data-platform","hermes-skill"),e.setAttribute("data-command",t),e.href=`https://hermes.ai/skills?command=${encodeURIComponent(t)}`}getResolvedTheme(){return this._options.theme||"branded"}render(){if(!this.shadowRoot)return;let t=this.getResolvedTheme(),e=t==="system"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,o=this._options.variant||"filled",r=p(t),s=this._options.size||"md",l=this._options.shape||"rounded",h=H[s],b=B[l][s];this.setAttribute("data-theme",e),this.setAttribute("data-variant",o);let u=o!=="filled"?"transparent":r.bg,M=o==="ghost"?"transparent":o==="outline"?r.primary:r.border,z=o!=="filled"?r.primary:r.text;this.shadowRoot.innerHTML=`
879
- <style>${rt}</style>
878
+ `,_=class extends HTMLElement{constructor(){super();this._options={command:"",theme:"branded",size:"md",variant:"filled",popup:!0};this._mqCleanup=null;this._rendered=!1;this.attachShadow({mode:"open"})}connectedCallback(){this.syncFromAttributes(),this.render(),this.updateLightDOM()}disconnectedCallback(){this._mqCleanup?.(),this._mqCleanup=null}attributeChangedCallback(){this._rendered&&(this.syncFromAttributes(),this.render(),this.updateLightDOM())}set options(t){this._options={...this._options,...t},this.render(),this.updateLightDOM()}get options(){return this._options}syncFromAttributes(){let t=this.getAttribute("command"),e=this.getAttribute("theme"),o=this.getAttribute("size"),r=this.getAttribute("variant"),s=this.getAttribute("shape"),l=this.getAttribute("popup"),h=this.getAttribute("popup-title"),b=this.getAttribute("popup-description");t!==null&&(this._options.command=t),e&&(this._options.theme=e),o&&(this._options.size=o),r&&(this._options.variant=r),s&&(this._options.shape=s),l!==null&&(this._options.popup=l!=="false"),h!==null&&(this._options.popupTitle=h),b!==null&&(this._options.popupDescription=b)}updateLightDOM(){let{command:t}=this._options;this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.setAttribute("aria-label",`Run on Hermes Skills: ${t}`),this._options.popup!==!1?this.setAttribute("aria-haspopup","dialog"):this.removeAttribute("aria-haspopup");let e=this.querySelector("a[data-hb-crawl]");e||(e=document.createElement("a"),e.setAttribute("data-hb-crawl",""),e.setAttribute("aria-hidden","true"),e.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",this.appendChild(e)),e.textContent=`Run on Hermes Skills: ${t}`,e.setAttribute("data-platform","hermes-skill"),e.setAttribute("data-command",t),e.href=`https://hermes.ai/skills?command=${encodeURIComponent(t)}`}getResolvedTheme(){return this._options.theme||"branded"}render(){if(!this.shadowRoot)return;let t=this.getResolvedTheme(),e=t==="system"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t,o=this._options.variant||"filled",r=p(t),s=this._options.size||"md",l=this._options.shape||"rounded",h=H[s],b=B[l][s];this.setAttribute("data-theme",e),this.setAttribute("data-variant",o);let u=o!=="filled"?"transparent":r.bg,M=o==="ghost"?"transparent":o==="outline"?r.primary:r.border,N=o!=="filled"?r.primary:r.text;this.shadowRoot.innerHTML=`
879
+ <style>${it}</style>
880
880
  <button
881
881
  class="hb-btn"
882
882
  type="button"
883
883
  style="
884
- ${C(r)}
884
+ ${w(r)}
885
885
  --hb-bg: ${u};
886
886
  --hb-border: ${M};
887
- --hb-text: ${z};
887
+ --hb-text: ${N};
888
888
  --hb-accent-color: ${r.primary};
889
889
  --hb-focus-color: ${r.primary};
890
890
  --hb-height: ${h.height};
@@ -899,5 +899,5 @@
899
899
  <span class="hb-btn-icon" aria-hidden="true">${k}</span>
900
900
  <span class="hb-btn-label">Run on Hermes Skills</span>
901
901
  </button>
902
- `;let E=this.shadowRoot.querySelector(".hb-btn");E.addEventListener("click",()=>this.handleClick()),E.addEventListener("keydown",g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),this.handleClick())}),this._rendered=!0,this.setupSystemThemeWatch()}handleClick(){let{popup:t,command:e,popupTitle:o,popupDescription:r}=this._options;if(this.dispatchEvent(new CustomEvent("hb-open",{bubbles:!0,composed:!0,detail:{command:e}})),t===!1){navigator.clipboard.writeText(e).then(()=>{this._options.onCopy?.(e),f("hermes-skill"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:e}}))});return}w({variant:"hermes-skill",theme:this.getResolvedTheme(),title:o||"Run on Hermes Skills",description:r||"Copy and paste into a Hermes session to get started.",command:e,onCopy:s=>{this._options.onCopy?.(s),f("hermes-skill"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:s}}))},onClose:()=>{this.dispatchEvent(new CustomEvent("hb-close",{bubbles:!0,composed:!0}))}})}setupSystemThemeWatch(){if(this._mqCleanup?.(),this._mqCleanup=null,this.getResolvedTheme()!=="system"||typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),e=()=>this.render();t.addEventListener("change",e),this._mqCleanup=()=>t.removeEventListener("change",e)}};_.observedAttributes=["command","theme","size","variant","shape","popup","popup-title","popup-description"];function $(a="hermes-skill-button"){typeof customElements>"u"||customElements.get(a)||customElements.define(a,_)}$();function W(a){let n=document.createElement("hermes-skill-button");return n.options=a,n}function D(){if(typeof document>"u")return[];let a=[];return document.querySelectorAll("hermes-button").forEach(n=>{let t=n.getAttribute("command")||"",r=n.getAttribute("prompt-flag")!=="false"?`hermes -p "${t}"`:t;a.push({platform:"hermes",command:t,fullCommand:r})}),document.querySelectorAll("hermes-skill-button").forEach(n=>{let t=n.getAttribute("command")||"";a.push({platform:"hermes-skill",command:t})}),a}function I(){let a=D();return a.length===0?{}:{"@context":"https://schema.org","@type":"WebPage",potentialAction:a.map(t=>{if(t.platform==="hermes")return{"@type":"Action",name:`Run on Hermes: ${t.command}`,description:t.command,target:{"@type":"EntryPoint",urlTemplate:`https://hermes.ai/run?command=${encodeURIComponent(t.fullCommand||t.command)}`,actionPlatform:"https://hermes.ai/run"},object:{"@type":"SoftwareSourceCode",runtimePlatform:"Hermes Agent",text:t.fullCommand||t.command}};let e={"@type":"EntryPoint",actionPlatform:"https://hermes.ai/skills",urlTemplate:`https://hermes.ai/skills?command=${encodeURIComponent(t.command)}`};return{"@type":"Action",name:`Run on Hermes Skills: ${t.command}`,description:t.command,target:e}})}}function G(){if(typeof document>"u")return;let a=document.querySelector("script[data-hermesbuttons-jsonld]");a&&a.remove();let n=I();if(!n||!("potentialAction"in n))return;let t=document.createElement("script");t.type="application/ld+json",t.setAttribute("data-hermesbuttons-jsonld",""),t.textContent=JSON.stringify(n,null,2),document.head.appendChild(t)}function nt(){T(),$()}return Q(it);})();
902
+ `;let E=this.shadowRoot.querySelector(".hb-btn");E.addEventListener("click",()=>this.handleClick()),E.addEventListener("keydown",g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),this.handleClick())}),this._rendered=!0,this.setupSystemThemeWatch()}handleClick(){let{popup:t,command:e,popupTitle:o,popupDescription:r}=this._options;if(this.dispatchEvent(new CustomEvent("hb-open",{bubbles:!0,composed:!0,detail:{command:e}})),t===!1){navigator.clipboard.writeText(e).then(()=>{this._options.onCopy?.(e),f("hermes-skill"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:e}}))});return}C({variant:"hermes-skill",theme:this.getResolvedTheme(),title:o||"Run on Hermes Skills",description:r||"Copy and paste into a Hermes session to get started.",command:e,onCopy:s=>{this._options.onCopy?.(s),f("hermes-skill"),this.dispatchEvent(new CustomEvent("hb-copy",{bubbles:!0,composed:!0,detail:{command:s}}))},onClose:()=>{this.dispatchEvent(new CustomEvent("hb-close",{bubbles:!0,composed:!0}))}})}setupSystemThemeWatch(){if(this._mqCleanup?.(),this._mqCleanup=null,this.getResolvedTheme()!=="system"||typeof window>"u")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),e=()=>this.render();t.addEventListener("change",e),this._mqCleanup=()=>t.removeEventListener("change",e)}};_.observedAttributes=["command","theme","size","variant","shape","popup","popup-title","popup-description"];function $(a="hermes-skill-button"){typeof customElements>"u"||customElements.get(a)||customElements.define(a,_)}$();function W(a){let n=document.createElement("hermes-skill-button");return n.options=a,n}function D(){if(typeof document>"u")return[];let a=[];return document.querySelectorAll("hermes-button").forEach(n=>{let t=n.getAttribute("command")||"",r=n.getAttribute("prompt-flag")!=="false"?`hermes -p "${t}"`:t;a.push({platform:"hermes",command:t,fullCommand:r})}),document.querySelectorAll("hermes-skill-button").forEach(n=>{let t=n.getAttribute("command")||"";a.push({platform:"hermes-skill",command:t})}),a}function I(){let a=D();return a.length===0?{}:{"@context":"https://schema.org","@type":"WebPage",potentialAction:a.map(t=>{if(t.platform==="hermes")return{"@type":"Action",name:`Run on Hermes: ${t.command}`,description:t.command,target:{"@type":"EntryPoint",urlTemplate:`https://hermes.ai/run?command=${encodeURIComponent(t.fullCommand||t.command)}`,actionPlatform:"https://hermes.ai/run"},object:{"@type":"SoftwareSourceCode",runtimePlatform:"Hermes Agent",text:t.fullCommand||t.command}};let e={"@type":"EntryPoint",actionPlatform:"https://hermes.ai/skills",urlTemplate:`https://hermes.ai/skills?command=${encodeURIComponent(t.command)}`};return{"@type":"Action",name:`Run on Hermes Skills: ${t.command}`,description:t.command,target:e}})}}function G(){if(typeof document>"u")return;let a=document.querySelector("script[data-hermesbuttons-jsonld]");a&&a.remove();let n=I();if(!n||!("potentialAction"in n))return;let t=document.createElement("script");t.type="application/ld+json",t.setAttribute("data-hermesbuttons-jsonld",""),t.textContent=JSON.stringify(n,null,2),document.head.appendChild(t)}var K="https://hermesbuttons.vercel.app/api/ping",Y=!1;function st(){if(Y||typeof window>"u"||typeof navigator>"u")return;let a=window.location?.origin;if(!(!a||a==="null"||a.startsWith("file:"))){Y=!0;try{let n=JSON.stringify({origin:a}),t=new Blob([n],{type:"text/plain"});typeof navigator.sendBeacon=="function"?navigator.sendBeacon(K,t):fetch(K,{method:"POST",body:n,keepalive:!0}).catch(()=>{})}catch{}}}if(typeof window<"u")try{st()}catch{}function dt(){T(),$()}return et(ht);})();
903
903
  //# sourceMappingURL=index.global.js.map